mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 15:15:19 +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"]
|
builder: ["vite", "webpack"]
|
||||||
context: ["async", "default"]
|
context: ["async", "default"]
|
||||||
manifest: ["manifest-on", "manifest-off"]
|
manifest: ["manifest-on", "manifest-off"]
|
||||||
version: ["v4", "v3"]
|
|
||||||
payload: ["json", "js"]
|
payload: ["json", "js"]
|
||||||
node: [18]
|
node: [18]
|
||||||
exclude:
|
exclude:
|
||||||
@ -244,7 +243,6 @@ jobs:
|
|||||||
TEST_BUILDER: ${{ matrix.builder }}
|
TEST_BUILDER: ${{ matrix.builder }}
|
||||||
TEST_MANIFEST: ${{ matrix.manifest }}
|
TEST_MANIFEST: ${{ matrix.manifest }}
|
||||||
TEST_CONTEXT: ${{ matrix.context }}
|
TEST_CONTEXT: ${{ matrix.context }}
|
||||||
TEST_V4: ${{ matrix.version == 'v4' }}
|
|
||||||
TEST_PAYLOAD: ${{ matrix.payload }}
|
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' }}
|
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!' }))
|
const { refresh } = await useAsyncData(async () => ({ message: 'Hello, Nuxt 3!' }))
|
||||||
|
|
||||||
async function refreshData () {
|
async function refreshData () {
|
||||||
|
// @ts-expect-error this is no longer valid syntax
|
||||||
await refresh({ dedupe: true })
|
await refresh({ dedupe: true })
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -328,7 +328,7 @@ definePageMeta({
|
|||||||
},
|
},
|
||||||
middleware (to, from) {
|
middleware (to, from) {
|
||||||
if (to.meta.pageTransition && typeof to.meta.pageTransition !== 'boolean')
|
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>
|
</script>
|
||||||
|
@ -19,7 +19,7 @@ describe('resolveApp', () => {
|
|||||||
{
|
{
|
||||||
"components": [],
|
"components": [],
|
||||||
"configs": [],
|
"configs": [],
|
||||||
"dir": "<rootDir>",
|
"dir": "<rootDir>/app",
|
||||||
"errorComponent": "<repoRoot>/packages/nuxt/src/app/components/nuxt-error-page.vue",
|
"errorComponent": "<repoRoot>/packages/nuxt/src/app/components/nuxt-error-page.vue",
|
||||||
"extensions": [
|
"extensions": [
|
||||||
".js",
|
".js",
|
||||||
|
@ -7,43 +7,12 @@ export default defineUntypedSchema({
|
|||||||
*/
|
*/
|
||||||
future: {
|
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
|
* It is currently not configurable but may be in future.
|
||||||
* Nuxt configuration, but you can granularly re-enable Nuxt v3 behaviour
|
* @type {4}
|
||||||
* 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}
|
|
||||||
*/
|
*/
|
||||||
compatibilityVersion: 3,
|
compatibilityVersion: 4,
|
||||||
/**
|
/**
|
||||||
* This enables early access to the experimental multi-app support.
|
* This enables early access to the experimental multi-app support.
|
||||||
* @see [Nuxt Issue #21635](https://github.com/nuxt/nuxt/issues/21635)
|
* @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(`
|
expect(getDirs(result as unknown as NuxtOptions)).toMatchInlineSnapshot(`
|
||||||
{
|
{
|
||||||
"dir": {
|
"dir": {
|
||||||
"app": "app",
|
"app": "<cwd>/app",
|
||||||
"modules": "modules",
|
"modules": "<cwd>/modules",
|
||||||
"public": "public",
|
"public": "<cwd>/public",
|
||||||
},
|
},
|
||||||
"rootDir": "<cwd>",
|
"rootDir": "<cwd>",
|
||||||
"serverDir": "<cwd>/server",
|
"serverDir": "<cwd>/server",
|
||||||
"srcDir": "<cwd>",
|
"srcDir": "<cwd>/app",
|
||||||
"workspaceDir": "<cwd>",
|
"workspaceDir": "<cwd>",
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
@ -28,12 +28,12 @@ describe('nuxt folder structure', () => {
|
|||||||
expect(getDirs(result as unknown as NuxtOptions)).toMatchInlineSnapshot(`
|
expect(getDirs(result as unknown as NuxtOptions)).toMatchInlineSnapshot(`
|
||||||
{
|
{
|
||||||
"dir": {
|
"dir": {
|
||||||
"app": "app",
|
"app": "/test/src",
|
||||||
"modules": "modules",
|
"modules": "/test/modules",
|
||||||
"public": "public",
|
"public": "/test/public",
|
||||||
},
|
},
|
||||||
"rootDir": "/test",
|
"rootDir": "/test",
|
||||||
"serverDir": "/test/src/server",
|
"serverDir": "/test/server",
|
||||||
"srcDir": "/test/src",
|
"srcDir": "/test/src",
|
||||||
"workspaceDir": "/test",
|
"workspaceDir": "/test",
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,6 @@ import type { NuxtIslandResponse } from '#app'
|
|||||||
|
|
||||||
const isWebpack = process.env.TEST_BUILDER === 'webpack'
|
const isWebpack = process.env.TEST_BUILDER === 'webpack'
|
||||||
const isTestingAppManifest = process.env.TEST_MANIFEST !== 'manifest-off'
|
const isTestingAppManifest = process.env.TEST_MANIFEST !== 'manifest-off'
|
||||||
const isV4 = process.env.TEST_V4 === 'true'
|
|
||||||
|
|
||||||
await setup({
|
await setup({
|
||||||
rootDir: fileURLToPath(new URL('./fixtures/basic', import.meta.url)),
|
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)">')
|
expect(headHtml).toContain('<meta content="0;javascript:alert(1)">')
|
||||||
})
|
})
|
||||||
|
|
||||||
it.skipIf(isV4)('SPA should render appHead tags', async () => {
|
it('SPA should render appHead tags', async () => {
|
||||||
const headHtml = await $fetch<string>('/head', { headers: { 'x-nuxt-no-ssr': '1' } })
|
const headHtml = await $fetch<string>('/head-spa')
|
||||||
|
|
||||||
expect(headHtml).toContain('<meta name="description" content="Nuxt Fixture">')
|
expect(headHtml).toContain('<meta name="description" content="Nuxt Fixture">')
|
||||||
expect(headHtml).toContain('<meta charset="utf-8">')
|
expect(headHtml).toContain('<meta charset="utf-8">')
|
||||||
expect(headHtml).toContain('<meta name="viewport" content="width=1024, initial-scale=1">')
|
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 () => {
|
it('should render http-equiv correctly', async () => {
|
||||||
const html = await $fetch<string>('/head')
|
const html = await $fetch<string>('/head')
|
||||||
// http-equiv should be rendered kebab case
|
// 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 () => {
|
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')
|
const { page } = await renderPage('/useAsyncData/immediate-remove-unmounted')
|
||||||
expect(await page.locator('#immediate-data').getByText(defaultValue).textContent()).toBe(defaultValue)
|
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: {
|
future: {
|
||||||
typescriptBundlerResolution: process.env.MODULE_RESOLUTION === 'bundler',
|
typescriptBundlerResolution: process.env.MODULE_RESOLUTION === 'bundler',
|
||||||
compatibilityVersion: process.env.TEST_V4 === 'true' ? 4 : 3,
|
|
||||||
},
|
},
|
||||||
buildDir: process.env.NITRO_BUILD_DIR,
|
buildDir: process.env.NITRO_BUILD_DIR,
|
||||||
builder: process.env.TEST_BUILDER as 'webpack' | 'vite' ?? 'vite',
|
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({
|
export default defineNuxtConfig({
|
||||||
future: { compatibilityVersion: process.env.TEST_V4 === 'true' ? 4 : 3 },
|
|
||||||
app: {
|
app: {
|
||||||
pageTransition: true,
|
pageTransition: true,
|
||||||
layoutTransition: true,
|
layoutTransition: true,
|
||||||
@ -63,6 +62,7 @@ export default defineNuxtConfig({
|
|||||||
},
|
},
|
||||||
routeRules: {
|
routeRules: {
|
||||||
'/route-rules/spa': { ssr: false },
|
'/route-rules/spa': { ssr: false },
|
||||||
|
'/head-spa': { ssr: false },
|
||||||
'/route-rules/middleware': { appMiddleware: 'route-rules-middleware' },
|
'/route-rules/middleware': { appMiddleware: 'route-rules-middleware' },
|
||||||
'/hydration/spa-redirection/**': { ssr: false },
|
'/hydration/spa-redirection/**': { ssr: false },
|
||||||
'/no-scripts': { experimentalNoScripts: true },
|
'/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({
|
export default defineNuxtConfig({
|
||||||
future: { compatibilityVersion: process.env.TEST_V4 === 'true' ? 4 : 3 },
|
|
||||||
experimental: { appManifest: true },
|
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'
|
const testWithInlineVue = process.env.EXTERNAL_VUE === 'false'
|
||||||
|
|
||||||
export default defineNuxtConfig({
|
export default defineNuxtConfig({
|
||||||
future: { compatibilityVersion: process.env.TEST_V4 === 'true' ? 4 : 3 },
|
|
||||||
pages: false,
|
pages: false,
|
||||||
experimental: {
|
experimental: {
|
||||||
externalVue: !testWithInlineVue,
|
externalVue: !testWithInlineVue,
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
// https://nuxt.com/docs/api/nuxt-config
|
// https://nuxt.com/docs/api/nuxt-config
|
||||||
export default defineNuxtConfig({
|
export default defineNuxtConfig({
|
||||||
future: { compatibilityVersion: process.env.TEST_V4 === 'true' ? 4 : 3 },
|
|
||||||
experimental: {
|
experimental: {
|
||||||
externalVue: false,
|
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'
|
const testWithInlineVue = process.env.EXTERNAL_VUE === 'false'
|
||||||
|
|
||||||
export default defineNuxtConfig({
|
export default defineNuxtConfig({
|
||||||
future: { compatibilityVersion: process.env.TEST_V4 === 'true' ? 4 : 3 },
|
|
||||||
experimental: {
|
experimental: {
|
||||||
externalVue: !testWithInlineVue,
|
externalVue: !testWithInlineVue,
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user