From a462366ec1f9c5b347fd2e19e0eb648685859457 Mon Sep 17 00:00:00 2001 From: Jacob Lamb Date: Mon, 11 Dec 2023 22:14:19 -0800 Subject: [PATCH 1/9] Add beta option for status --- packages/integrations/vercel/src/serverless/adapter.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/integrations/vercel/src/serverless/adapter.ts b/packages/integrations/vercel/src/serverless/adapter.ts index ef2552cc173f..37a68f6804f8 100644 --- a/packages/integrations/vercel/src/serverless/adapter.ts +++ b/packages/integrations/vercel/src/serverless/adapter.ts @@ -35,11 +35,11 @@ export const VERCEL_EDGE_MIDDLEWARE_FILE = 'vercel-edge-middleware'; // https://vercel.com/docs/concepts/functions/serverless-functions/runtimes/node-js#node.js-version const SUPPORTED_NODE_VERSIONS: Record< string, - { status: 'current' } | { status: 'deprecated'; removal: Date } + { status: 'current' } | { status: 'beta' } | { status: 'deprecated'; removal: Date } > = { - 14: { status: 'deprecated', removal: new Date('August 15 2023') }, 16: { status: 'deprecated', removal: new Date('February 6 2024') }, 18: { status: 'current' }, + 20: { status: 'beta' }, }; function getAdapter({ From 2be4655ae26cee0fc91f39d6aa9365fac91468f0 Mon Sep 17 00:00:00 2001 From: Jacob Lamb Date: Mon, 11 Dec 2023 22:26:58 -0800 Subject: [PATCH 2/9] Create stupid-cheetahs-sell.md --- .changeset/stupid-cheetahs-sell.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/stupid-cheetahs-sell.md diff --git a/.changeset/stupid-cheetahs-sell.md b/.changeset/stupid-cheetahs-sell.md new file mode 100644 index 000000000000..4a09dd98960a --- /dev/null +++ b/.changeset/stupid-cheetahs-sell.md @@ -0,0 +1,5 @@ +--- +'@astrojs/vercel': patch +--- + +Update supported Node versions and add `beta` option. From bfd0770085c69c0b88935f6ee62d1f748e901af4 Mon Sep 17 00:00:00 2001 From: Jacob Lamb Date: Mon, 11 Dec 2023 22:30:10 -0800 Subject: [PATCH 3/9] Add warning for beta --- packages/integrations/vercel/src/serverless/adapter.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/integrations/vercel/src/serverless/adapter.ts b/packages/integrations/vercel/src/serverless/adapter.ts index 37a68f6804f8..fde33f16f018 100644 --- a/packages/integrations/vercel/src/serverless/adapter.ts +++ b/packages/integrations/vercel/src/serverless/adapter.ts @@ -377,6 +377,13 @@ function validateRuntime() { const version = process.version.slice(1); // 'v16.5.0' --> '16.5.0' const major = version.split('.')[0]; // '16.5.0' --> '16' const support = SUPPORTED_NODE_VERSIONS[major]; + if (support.status === 'beta') { + console.warn( + `[${PACKAGE_NAME}] The local Node.js version (${major}) is currently in beta by Vercel Serverless Functions.` + ); + console.warn(`[${PACKAGE_NAME}] Make sure to update your Vercel settings to use ${major}.`); + return; + } if (support === undefined) { console.warn( `[${PACKAGE_NAME}] The local Node.js version (${major}) is not supported by Vercel Serverless Functions.` From 943b5cff0b86dc699c50d3f37a981a95954cb564 Mon Sep 17 00:00:00 2001 From: Jacob Lamb Date: Tue, 12 Dec 2023 07:28:22 -0800 Subject: [PATCH 4/9] Update packages/integrations/vercel/src/serverless/adapter.ts Co-authored-by: Florian Lefebvre --- packages/integrations/vercel/src/serverless/adapter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/integrations/vercel/src/serverless/adapter.ts b/packages/integrations/vercel/src/serverless/adapter.ts index fde33f16f018..26e33663a752 100644 --- a/packages/integrations/vercel/src/serverless/adapter.ts +++ b/packages/integrations/vercel/src/serverless/adapter.ts @@ -379,7 +379,7 @@ function validateRuntime() { const support = SUPPORTED_NODE_VERSIONS[major]; if (support.status === 'beta') { console.warn( - `[${PACKAGE_NAME}] The local Node.js version (${major}) is currently in beta by Vercel Serverless Functions.` + `[${PACKAGE_NAME}] The local Node.js version (${major}) is currently in beta for Vercel Serverless Functions.` ); console.warn(`[${PACKAGE_NAME}] Make sure to update your Vercel settings to use ${major}.`); return; From fd96f1faf58b5a04042fdda35286fe046436bec9 Mon Sep 17 00:00:00 2001 From: Jacob Lamb Date: Tue, 12 Dec 2023 07:50:51 -0800 Subject: [PATCH 5/9] Switch to `minor` and document new API/option --- .changeset/stupid-cheetahs-sell.md | 2 +- packages/integrations/vercel/README.md | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.changeset/stupid-cheetahs-sell.md b/.changeset/stupid-cheetahs-sell.md index 4a09dd98960a..ad84a6cd5af7 100644 --- a/.changeset/stupid-cheetahs-sell.md +++ b/.changeset/stupid-cheetahs-sell.md @@ -1,5 +1,5 @@ --- -'@astrojs/vercel': patch +'@astrojs/vercel': minor --- Update supported Node versions and add `beta` option. diff --git a/packages/integrations/vercel/README.md b/packages/integrations/vercel/README.md index 9f25c25539d9..943736e3c369 100644 --- a/packages/integrations/vercel/README.md +++ b/packages/integrations/vercel/README.md @@ -401,6 +401,22 @@ When you opt in to this feature, there are few constraints to note: - Only `request` and `context` may be used to produce an `Astro.locals` object. Operations like redirects, etc. should be delegated to Astro middleware. - `Astro.locals` **must be serializable**. Failing to do so will result in a **runtime error**. This means that you **cannot** store complex types like `Map`, `function`, `Set`, etc. +To update the `README.md` file for the `@astrojs/vercel` package to reflect your recent changes, you should include a new section that documents the changes made to the `SUPPORTED_NODE_VERSIONS` and the behavior of the `validateRuntime` function. This will ensure that users are aware of the new Node.js versions supported and the addition of the 'beta' status for certain versions. + +Here's a suggested addition to the `README.md` file: + +### Node.js Version Support and Runtime Validation + +The `@astrojs/vercel` adapter supports specific Node.js versions for deploying your Astro project on Vercel. The supported versions are categorized as 'current', 'beta', and 'deprecated'. Each category represents the support status of that Node.js version: + +- **Current**: Fully supported and recommended for use. +- **Beta**: Newer versions that are in beta. These are available for testing and early adoption. +- **Deprecated**: Versions that are no longer recommended and scheduled for removal on a specific date. + +#### Supported Node.js Versions + +To view the supported Node.js versions, click on the settings tab for a project and scroll down to "Node.js Version" section. + ## Troubleshooting **A few known complex packages (example: [puppeteer](https://github.com/puppeteer/puppeteer)) do not support bundling and therefore will not work properly with this adapter.** By default, Vercel doesn't include npm installed files & packages from your project's `./node_modules` folder. To address this, the `@astrojs/vercel` adapter automatically bundles your final build output using `esbuild`. From d659d7d909b205d5dca996d576b01fdd1a56045f Mon Sep 17 00:00:00 2001 From: Jacob Lamb Date: Tue, 12 Dec 2023 07:52:50 -0800 Subject: [PATCH 6/9] Update README.md --- packages/integrations/vercel/README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/packages/integrations/vercel/README.md b/packages/integrations/vercel/README.md index 943736e3c369..0bb200dfdd6f 100644 --- a/packages/integrations/vercel/README.md +++ b/packages/integrations/vercel/README.md @@ -401,10 +401,6 @@ When you opt in to this feature, there are few constraints to note: - Only `request` and `context` may be used to produce an `Astro.locals` object. Operations like redirects, etc. should be delegated to Astro middleware. - `Astro.locals` **must be serializable**. Failing to do so will result in a **runtime error**. This means that you **cannot** store complex types like `Map`, `function`, `Set`, etc. -To update the `README.md` file for the `@astrojs/vercel` package to reflect your recent changes, you should include a new section that documents the changes made to the `SUPPORTED_NODE_VERSIONS` and the behavior of the `validateRuntime` function. This will ensure that users are aware of the new Node.js versions supported and the addition of the 'beta' status for certain versions. - -Here's a suggested addition to the `README.md` file: - ### Node.js Version Support and Runtime Validation The `@astrojs/vercel` adapter supports specific Node.js versions for deploying your Astro project on Vercel. The supported versions are categorized as 'current', 'beta', and 'deprecated'. Each category represents the support status of that Node.js version: From f948305e2c0a22c397d3f5668832c314bfc8134d Mon Sep 17 00:00:00 2001 From: Jacob Lamb Date: Tue, 12 Dec 2023 09:07:29 -0800 Subject: [PATCH 7/9] Update README.md --- packages/integrations/vercel/README.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/integrations/vercel/README.md b/packages/integrations/vercel/README.md index 0bb200dfdd6f..ae9bd9e59080 100644 --- a/packages/integrations/vercel/README.md +++ b/packages/integrations/vercel/README.md @@ -401,18 +401,14 @@ When you opt in to this feature, there are few constraints to note: - Only `request` and `context` may be used to produce an `Astro.locals` object. Operations like redirects, etc. should be delegated to Astro middleware. - `Astro.locals` **must be serializable**. Failing to do so will result in a **runtime error**. This means that you **cannot** store complex types like `Map`, `function`, `Set`, etc. -### Node.js Version Support and Runtime Validation +### Node.js Version Support -The `@astrojs/vercel` adapter supports specific Node.js versions for deploying your Astro project on Vercel. The supported versions are categorized as 'current', 'beta', and 'deprecated'. Each category represents the support status of that Node.js version: +The `@astrojs/vercel` adapter supports specific Node.js versions for deploying your Astro project on Vercel. To view the supported Node.js versions, click on the settings tab for a project and scroll down to "Node.js Version" section. The supported versions are categorized as 'current', 'beta', and 'deprecated'. Each category represents the support status of that Node.js version: - **Current**: Fully supported and recommended for use. - **Beta**: Newer versions that are in beta. These are available for testing and early adoption. - **Deprecated**: Versions that are no longer recommended and scheduled for removal on a specific date. -#### Supported Node.js Versions - -To view the supported Node.js versions, click on the settings tab for a project and scroll down to "Node.js Version" section. - ## Troubleshooting **A few known complex packages (example: [puppeteer](https://github.com/puppeteer/puppeteer)) do not support bundling and therefore will not work properly with this adapter.** By default, Vercel doesn't include npm installed files & packages from your project's `./node_modules` folder. To address this, the `@astrojs/vercel` adapter automatically bundles your final build output using `esbuild`. From 8da60991f2cb123985fa7ce211422aee300491c4 Mon Sep 17 00:00:00 2001 From: Jacob Lamb Date: Wed, 13 Dec 2023 01:01:57 -0800 Subject: [PATCH 8/9] Update packages/integrations/vercel/README.md Co-authored-by: Florian Lefebvre --- packages/integrations/vercel/README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/integrations/vercel/README.md b/packages/integrations/vercel/README.md index ae9bd9e59080..9c80eae4bcb7 100644 --- a/packages/integrations/vercel/README.md +++ b/packages/integrations/vercel/README.md @@ -403,11 +403,9 @@ When you opt in to this feature, there are few constraints to note: ### Node.js Version Support -The `@astrojs/vercel` adapter supports specific Node.js versions for deploying your Astro project on Vercel. To view the supported Node.js versions, click on the settings tab for a project and scroll down to "Node.js Version" section. The supported versions are categorized as 'current', 'beta', and 'deprecated'. Each category represents the support status of that Node.js version: +The `@astrojs/vercel` adapter supports specific Node.js versions for deploying your Astro project on Vercel. To view the supported Node.js versions on Vercel, click on the settings tab for a project and scroll down to "Node.js Version" section. -- **Current**: Fully supported and recommended for use. -- **Beta**: Newer versions that are in beta. These are available for testing and early adoption. -- **Deprecated**: Versions that are no longer recommended and scheduled for removal on a specific date. +Check out the [Vercel documentation](https://vercel.com/docs/functions/serverless-functions/runtimes/node-js#default-and-available-versions) to learn more. ## Troubleshooting From b2f12b6c13d2942d94a053156d36e8d6e4cdcccf Mon Sep 17 00:00:00 2001 From: Jacob Lamb Date: Wed, 13 Dec 2023 01:02:03 -0800 Subject: [PATCH 9/9] Update .changeset/stupid-cheetahs-sell.md Co-authored-by: Florian Lefebvre --- .changeset/stupid-cheetahs-sell.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/stupid-cheetahs-sell.md b/.changeset/stupid-cheetahs-sell.md index ad84a6cd5af7..25edd567e1dc 100644 --- a/.changeset/stupid-cheetahs-sell.md +++ b/.changeset/stupid-cheetahs-sell.md @@ -2,4 +2,4 @@ '@astrojs/vercel': minor --- -Update supported Node versions and add `beta` option. +Adds support for Node 20 (currently in `beta` on Vercel).