diff options
author | 2024-08-16 08:41:10 -0400 | |
---|---|---|
committer | 2024-08-16 08:41:10 -0400 | |
commit | 5ea02b12fdb9b8ca45b1229bb9d04bc3d1270e0f (patch) | |
tree | fbf88e999b0ed319993cc64636bd29c6fc9d583f | |
parent | 5f0b58fb6c656243b0f1456266f07af59834e781 (diff) | |
download | astro-5ea02b12fdb9b8ca45b1229bb9d04bc3d1270e0f.tar.gz astro-5ea02b12fdb9b8ca45b1229bb9d04bc3d1270e0f.tar.zst astro-5ea02b12fdb9b8ca45b1229bb9d04bc3d1270e0f.zip |
Deprecate the functionPerRoute option (#11728)
* Deprecate the functionPerRoute option
* Update .changeset/weak-dancers-beam.md
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
---------
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
-rw-r--r-- | .changeset/weak-dancers-beam.md | 20 | ||||
-rw-r--r-- | packages/integrations/vercel/src/serverless/adapter.ts | 10 |
2 files changed, 29 insertions, 1 deletions
diff --git a/.changeset/weak-dancers-beam.md b/.changeset/weak-dancers-beam.md new file mode 100644 index 000000000..6d4667815 --- /dev/null +++ b/.changeset/weak-dancers-beam.md @@ -0,0 +1,20 @@ +--- +'@astrojs/vercel': minor +--- + +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, + }), +}); +``` diff --git a/packages/integrations/vercel/src/serverless/adapter.ts b/packages/integrations/vercel/src/serverless/adapter.ts index 8cddc0be1..5dbf24f4a 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( |