diff --git a/.changeset/clever-houses-yawn.md b/.changeset/clever-houses-yawn.md new file mode 100644 index 0000000000..54e4e09cb7 --- /dev/null +++ b/.changeset/clever-houses-yawn.md @@ -0,0 +1,5 @@ +--- +"@astrojs/vercel": patch +--- + +Updates the supported version of Node.js diff --git a/packages/integrations/vercel/src/serverless/adapter.ts b/packages/integrations/vercel/src/serverless/adapter.ts index bb7d9f4373..4aa7a5a995 100644 --- a/packages/integrations/vercel/src/serverless/adapter.ts +++ b/packages/integrations/vercel/src/serverless/adapter.ts @@ -59,11 +59,10 @@ const ISR_PATH = `/_isr?${ASTRO_PATH_PARAM}=$0`; // https://vercel.com/docs/concepts/functions/serverless-functions/runtimes/node-js#node.js-version const SUPPORTED_NODE_VERSIONS: Record< string, - { status: 'current' } | { status: 'beta' } | { status: 'deprecated'; removal: Date } + { status: 'default' } | { status: 'beta' } | { status: 'retiring'; removal: Date | string; warnDate: Date } | { status: 'deprecated'; removal: Date } > = { - 16: { status: 'deprecated', removal: new Date('February 6 2024') }, - 18: { status: 'current' }, - 20: { status: 'beta' }, + 18: { status: 'retiring', removal: "Early 2025", warnDate: new Date('October 1 2024') }, + 20: { status: 'default' }, }; function getAdapter({ @@ -522,9 +521,17 @@ function getRuntime(process: NodeJS.Process, logger: AstroIntegrationLogger): Ru ); return 'nodejs18.x'; } - if (support.status === 'current') { + if (support.status === 'default') { return `nodejs${major}.x`; } + if (support.status === 'retiring') { + if (support.warnDate && new Date() >= support.warnDate) { + logger.warn( + `Your project is being built for Node.js ${major} as the runtime, which is retiring by ${support.removal}.` + ); + } + return `nodejs${major}.x`; + } if (support.status === 'beta') { logger.warn( `Your project is being built for Node.js ${major} as the runtime, which is currently in beta for Vercel Serverless Functions.`