From 8189f00a64129d75ef31dce3b07c33964fb31b5a Mon Sep 17 00:00:00 2001 From: Matthew Phillips Date: Thu, 15 Aug 2024 10:48:10 -0400 Subject: [PATCH 1/2] Deprecate the functionPerRoute option --- .changeset/weak-dancers-beam.md | 5 +++++ packages/integrations/vercel/src/serverless/adapter.ts | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 .changeset/weak-dancers-beam.md diff --git a/.changeset/weak-dancers-beam.md b/.changeset/weak-dancers-beam.md new file mode 100644 index 000000000000..92463d049d37 --- /dev/null +++ b/.changeset/weak-dancers-beam.md @@ -0,0 +1,5 @@ +--- +'@astrojs/vercel': minor +--- + +Deprecate the functionPerRoute option diff --git a/packages/integrations/vercel/src/serverless/adapter.ts b/packages/integrations/vercel/src/serverless/adapter.ts index 8cddc0be1019..5dbf24f4a60a 100644 --- a/packages/integrations/vercel/src/serverless/adapter.ts +++ b/packages/integrations/vercel/src/serverless/adapter.ts @@ -134,7 +134,10 @@ export interface VercelServerlessConfig { /** Whether to create the Vercel Edge middleware from an Astro middleware in your code base. */ edgeMiddleware?: boolean; - /** Whether to split builds into a separate function for each route. */ + /** + * Whether to split builds into a separate function for each route. + * @deprecated `functionPerRoute` is deprecated and will be removed in the next major release of the adapter. + */ functionPerRoute?: boolean; /** The maximum duration (in seconds) that Serverless Functions can run before timing out. See the [Vercel documentation](https://vercel.com/docs/functions/serverless-functions/runtimes#maxduration) for the default and maximum limit for your account plan. */ @@ -286,6 +289,11 @@ export default function vercelServerless({ `\tMake sure to check your plan carefully to avoid incurring additional costs.\n` + `\tYou can set functionPerRoute: false to prevent surpassing the limit.\n`, ); + + logger.warn( + `\n` + + `\t\`functionPerRoute\` is deprecated and will be removed in a future version of the adapter.\n` + ); } setAdapter( From 580e915780f3c42545ef92ab3cd4374bc3f316b1 Mon Sep 17 00:00:00 2001 From: Matthew Phillips Date: Thu, 15 Aug 2024 13:15:04 -0400 Subject: [PATCH 2/2] Update .changeset/weak-dancers-beam.md Co-authored-by: Sarah Rainsberger --- .changeset/weak-dancers-beam.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.changeset/weak-dancers-beam.md b/.changeset/weak-dancers-beam.md index 92463d049d37..6d4667815492 100644 --- a/.changeset/weak-dancers-beam.md +++ b/.changeset/weak-dancers-beam.md @@ -2,4 +2,19 @@ '@astrojs/vercel': minor --- -Deprecate the functionPerRoute option +Deprecates the `functionPerRoute` option + +This option is now deprecated, and will be removed entirely in Astro v5.0. We suggest removing this option from your configuration as soon as you are able to: + +```diff +import { defineConfig } from 'astro/config'; +import vercel from '@astrojs/vercel/serverless'; + +export default defineConfig({ + // ... + output: 'server', + adapter: vercel({ +- functionPerRoute: true, + }), +}); +```