mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-21 21:25:11 +00:00
fix(schema)!: default to compatibilityVersion: 4
(#27710)
This commit is contained in:
parent
a0d5145095
commit
bf3a374f85
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -198,7 +198,6 @@ jobs:
|
||||
builder: ["vite", "webpack"]
|
||||
context: ["async", "default"]
|
||||
manifest: ["manifest-on", "manifest-off"]
|
||||
version: ["v4", "v3"]
|
||||
payload: ["json", "js"]
|
||||
node: [18]
|
||||
exclude:
|
||||
@ -244,7 +243,6 @@ jobs:
|
||||
TEST_BUILDER: ${{ matrix.builder }}
|
||||
TEST_MANIFEST: ${{ matrix.manifest }}
|
||||
TEST_CONTEXT: ${{ matrix.context }}
|
||||
TEST_V4: ${{ matrix.version == 'v4' }}
|
||||
TEST_PAYLOAD: ${{ matrix.payload }}
|
||||
SKIP_BUNDLE_SIZE: ${{ github.event_name != 'push' || matrix.env == 'dev' || matrix.builder == 'webpack' || matrix.context == 'default' || matrix.payload == 'js' || runner.os == 'Windows' }}
|
||||
|
||||
|
@ -235,6 +235,7 @@ Previously it was possible to pass `dedupe: boolean` to `refresh`. These were al
|
||||
const { refresh } = await useAsyncData(async () => ({ message: 'Hello, Nuxt 3!' }))
|
||||
|
||||
async function refreshData () {
|
||||
// @ts-expect-error this is no longer valid syntax
|
||||
await refresh({ dedupe: true })
|
||||
}
|
||||
```
|
||||
|
@ -328,7 +328,7 @@ definePageMeta({
|
||||
},
|
||||
middleware (to, from) {
|
||||
if (to.meta.pageTransition && typeof to.meta.pageTransition !== 'boolean')
|
||||
to.meta.pageTransition.name = +to.params.id > +from.params.id ? 'slide-left' : 'slide-right'
|
||||
to.meta.pageTransition.name = +to.params.id! > +from.params.id! ? 'slide-left' : 'slide-right'
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
@ -19,7 +19,7 @@ describe('resolveApp', () => {
|
||||
{
|
||||
"components": [],
|
||||
"configs": [],
|
||||
"dir": "<rootDir>",
|
||||
"dir": "<rootDir>/app",
|
||||
"errorComponent": "<repoRoot>/packages/nuxt/src/app/components/nuxt-error-page.vue",
|
||||
"extensions": [
|
||||
".js",
|
||||
|
@ -7,43 +7,12 @@ export default defineUntypedSchema({
|
||||
*/
|
||||
future: {
|
||||
/**
|
||||
* Enable early access to Nuxt v4 features or flags.
|
||||
* Enable early access to future features or flags.
|
||||
*
|
||||
* Setting `compatibilityVersion` to `4` changes defaults throughout your
|
||||
* Nuxt configuration, but you can granularly re-enable Nuxt v3 behaviour
|
||||
* when testing (see example). Please file issues if so, so that we can
|
||||
* address in Nuxt or in the ecosystem.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* export default defineNuxtConfig({
|
||||
* future: {
|
||||
* compatibilityVersion: 4,
|
||||
* },
|
||||
* // To re-enable _all_ Nuxt v3 behaviour, set the following options:
|
||||
* srcDir: '.',
|
||||
* dir: {
|
||||
* app: 'app'
|
||||
* },
|
||||
* experimental: {
|
||||
* relativeWatchPaths: true,
|
||||
* resetAsyncDataToUndefined: true,
|
||||
* defaults: {
|
||||
* useAsyncData: {
|
||||
* deep: true
|
||||
* }
|
||||
* }
|
||||
* },
|
||||
* unhead: {
|
||||
* renderSSRHeadOptions: {
|
||||
* omitLineBreaks: false
|
||||
* }
|
||||
* }
|
||||
* })
|
||||
* ```
|
||||
* @type {3 | 4}
|
||||
* It is currently not configurable but may be in future.
|
||||
* @type {4}
|
||||
*/
|
||||
compatibilityVersion: 3,
|
||||
compatibilityVersion: 4,
|
||||
/**
|
||||
* This enables early access to the experimental multi-app support.
|
||||
* @see [Nuxt Issue #21635](https://github.com/nuxt/nuxt/issues/21635)
|
||||
|
@ -11,13 +11,13 @@ describe('nuxt folder structure', () => {
|
||||
expect(getDirs(result as unknown as NuxtOptions)).toMatchInlineSnapshot(`
|
||||
{
|
||||
"dir": {
|
||||
"app": "app",
|
||||
"modules": "modules",
|
||||
"public": "public",
|
||||
"app": "<cwd>/app",
|
||||
"modules": "<cwd>/modules",
|
||||
"public": "<cwd>/public",
|
||||
},
|
||||
"rootDir": "<cwd>",
|
||||
"serverDir": "<cwd>/server",
|
||||
"srcDir": "<cwd>",
|
||||
"srcDir": "<cwd>/app",
|
||||
"workspaceDir": "<cwd>",
|
||||
}
|
||||
`)
|
||||
@ -28,12 +28,12 @@ describe('nuxt folder structure', () => {
|
||||
expect(getDirs(result as unknown as NuxtOptions)).toMatchInlineSnapshot(`
|
||||
{
|
||||
"dir": {
|
||||
"app": "app",
|
||||
"modules": "modules",
|
||||
"public": "public",
|
||||
"app": "/test/src",
|
||||
"modules": "/test/modules",
|
||||
"public": "/test/public",
|
||||
},
|
||||
"rootDir": "/test",
|
||||
"serverDir": "/test/src/server",
|
||||
"serverDir": "/test/server",
|
||||
"srcDir": "/test/src",
|
||||
"workspaceDir": "/test",
|
||||
}
|
||||
|
@ -13,7 +13,6 @@ import type { NuxtIslandResponse } from '#app'
|
||||
|
||||
const isWebpack = process.env.TEST_BUILDER === 'webpack'
|
||||
const isTestingAppManifest = process.env.TEST_MANIFEST !== 'manifest-off'
|
||||
const isV4 = process.env.TEST_V4 === 'true'
|
||||
|
||||
await setup({
|
||||
rootDir: fileURLToPath(new URL('./fixtures/basic', import.meta.url)),
|
||||
@ -918,19 +917,14 @@ describe('head tags', () => {
|
||||
expect(headHtml).toContain('<meta content="0;javascript:alert(1)">')
|
||||
})
|
||||
|
||||
it.skipIf(isV4)('SPA should render appHead tags', async () => {
|
||||
const headHtml = await $fetch<string>('/head', { headers: { 'x-nuxt-no-ssr': '1' } })
|
||||
it('SPA should render appHead tags', async () => {
|
||||
const headHtml = await $fetch<string>('/head-spa')
|
||||
|
||||
expect(headHtml).toContain('<meta name="description" content="Nuxt Fixture">')
|
||||
expect(headHtml).toContain('<meta charset="utf-8">')
|
||||
expect(headHtml).toContain('<meta name="viewport" content="width=1024, initial-scale=1">')
|
||||
})
|
||||
|
||||
it.skipIf(isV4)('legacy vueuse/head works', async () => {
|
||||
const headHtml = await $fetch<string>('/vueuse-head')
|
||||
expect(headHtml).toContain('<title>using provides usehead and updateDOM - VueUse head polyfill test</title>')
|
||||
})
|
||||
|
||||
it('should render http-equiv correctly', async () => {
|
||||
const html = await $fetch<string>('/head')
|
||||
// http-equiv should be rendered kebab case
|
||||
@ -2463,7 +2457,7 @@ describe.skipIf(isWindows)('useAsyncData', () => {
|
||||
})
|
||||
|
||||
it('data is null after navigation when immediate false', async () => {
|
||||
const defaultValue = isV4 ? 'undefined' : 'null'
|
||||
const defaultValue = 'undefined'
|
||||
|
||||
const { page } = await renderPage('/useAsyncData/immediate-remove-unmounted')
|
||||
expect(await page.locator('#immediate-data').getByText(defaultValue).textContent()).toBe(defaultValue)
|
||||
|
1
test/fixtures/basic-types/nuxt.config.ts
vendored
1
test/fixtures/basic-types/nuxt.config.ts
vendored
@ -7,7 +7,6 @@ export default defineNuxtConfig({
|
||||
},
|
||||
future: {
|
||||
typescriptBundlerResolution: process.env.MODULE_RESOLUTION === 'bundler',
|
||||
compatibilityVersion: process.env.TEST_V4 === 'true' ? 4 : 3,
|
||||
},
|
||||
buildDir: process.env.NITRO_BUILD_DIR,
|
||||
builder: process.env.TEST_BUILDER as 'webpack' | 'vite' ?? 'vite',
|
||||
|
2
test/fixtures/basic/nuxt.config.ts
vendored
2
test/fixtures/basic/nuxt.config.ts
vendored
@ -12,7 +12,6 @@ declare module 'nitropack' {
|
||||
}
|
||||
|
||||
export default defineNuxtConfig({
|
||||
future: { compatibilityVersion: process.env.TEST_V4 === 'true' ? 4 : 3 },
|
||||
app: {
|
||||
pageTransition: true,
|
||||
layoutTransition: true,
|
||||
@ -63,6 +62,7 @@ export default defineNuxtConfig({
|
||||
},
|
||||
routeRules: {
|
||||
'/route-rules/spa': { ssr: false },
|
||||
'/head-spa': { ssr: false },
|
||||
'/route-rules/middleware': { appMiddleware: 'route-rules-middleware' },
|
||||
'/hydration/spa-redirection/**': { ssr: false },
|
||||
'/no-scripts': { experimentalNoScripts: true },
|
||||
|
1
test/fixtures/minimal-types/nuxt.config.ts
vendored
1
test/fixtures/minimal-types/nuxt.config.ts
vendored
@ -1,4 +1,3 @@
|
||||
export default defineNuxtConfig({
|
||||
future: { compatibilityVersion: process.env.TEST_V4 === 'true' ? 4 : 3 },
|
||||
experimental: { appManifest: true },
|
||||
})
|
||||
|
1
test/fixtures/minimal/nuxt.config.ts
vendored
1
test/fixtures/minimal/nuxt.config.ts
vendored
@ -3,7 +3,6 @@ import { fileURLToPath } from 'node:url'
|
||||
const testWithInlineVue = process.env.EXTERNAL_VUE === 'false'
|
||||
|
||||
export default defineNuxtConfig({
|
||||
future: { compatibilityVersion: process.env.TEST_V4 === 'true' ? 4 : 3 },
|
||||
pages: false,
|
||||
experimental: {
|
||||
externalVue: !testWithInlineVue,
|
||||
|
@ -1,6 +1,5 @@
|
||||
// https://nuxt.com/docs/api/nuxt-config
|
||||
export default defineNuxtConfig({
|
||||
future: { compatibilityVersion: process.env.TEST_V4 === 'true' ? 4 : 3 },
|
||||
experimental: {
|
||||
externalVue: false,
|
||||
},
|
||||
|
1
test/fixtures/suspense/nuxt.config.ts
vendored
1
test/fixtures/suspense/nuxt.config.ts
vendored
@ -3,7 +3,6 @@ import { fileURLToPath } from 'node:url'
|
||||
const testWithInlineVue = process.env.EXTERNAL_VUE === 'false'
|
||||
|
||||
export default defineNuxtConfig({
|
||||
future: { compatibilityVersion: process.env.TEST_V4 === 'true' ? 4 : 3 },
|
||||
experimental: {
|
||||
externalVue: !testWithInlineVue,
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user