feat(nuxt,schema): add compatibilityDate flag for future (#27512)

This commit is contained in:
Daniel Roe 2024-06-10 21:52:16 +01:00 committed by GitHub
parent 11a79359b8
commit cd95d99704
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 26 additions and 2 deletions

View File

@ -388,7 +388,10 @@ export async function initNitro (nuxt: Nuxt & { _nitro?: Nitro }) {
}
// Init nitro
const nitro = await createNitro(nitroConfig)
const nitro = await createNitro(nitroConfig, {
// @ts-expect-error this will be valid in a future version of Nitro
compatibilityDate: nuxt.options.compatibilityDate,
})
// Trigger Nitro reload when SPA loading template changes
const spaLoadingTemplateFilePath = await spaLoadingTemplatePath(nuxt)

View File

@ -63,6 +63,7 @@
"webpack-dev-middleware": "7.2.1"
},
"dependencies": {
"compatx": "^0.1.3",
"consola": "^3.2.3",
"defu": "^6.1.4",
"hookable": "^5.5.3",
@ -71,8 +72,8 @@
"scule": "^1.3.0",
"std-env": "^3.7.0",
"ufo": "^1.5.3",
"unimport": "^3.7.2",
"uncrypto": "^0.1.3",
"unimport": "^3.7.2",
"untyped": "^1.4.2"
},
"engines": {

View File

@ -20,6 +20,18 @@ export default defineUntypedSchema({
*/
extends: null,
/**
* Specify a compatibility date for your app.
*
* This is used to control the behavior of presets in Nitro, Nuxt Image
* and other modules that may change behavior without a major version bump.
*
* We plan to improve the tooling around this feature in the future.
*
* @type {typeof import('compatx').DateString | Record<string, typeof import('compatx').DateString>}
*/
compatibilityDate: undefined,
/**
* Extend project from a local or remote source.
*

View File

@ -457,6 +457,9 @@ importers:
packages/schema:
dependencies:
compatx:
specifier: ^0.1.3
version: 0.1.3
consola:
specifier: ^3.2.3
version: 3.2.3
@ -3578,6 +3581,9 @@ packages:
commondir@1.0.1:
resolution: {integrity: sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==}
compatx@0.1.3:
resolution: {integrity: sha512-MWspQwvBk5xeLZMetIfjOozTAtmAIICz1mtol6NbBpCSllXOO+HvWMO87B18rcFtqjfrZ0tIFOH9gNG63ep+mw==}
compress-commons@6.0.2:
resolution: {integrity: sha512-6FqVXeETqWPoGcfzrXb37E50NP0LXT8kAMu5ooZayhWWdgEY4lBEEcbQNXtkuKQsGduxiIcI4gOTsxTmuq/bSg==}
engines: {node: '>= 14'}
@ -10489,6 +10495,8 @@ snapshots:
commondir@1.0.1: {}
compatx@0.1.3: {}
compress-commons@6.0.2:
dependencies:
crc-32: 1.2.2