Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate the functionPerRoute option #11728

Merged
merged 2 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .changeset/weak-dancers-beam.md
Original file line number Diff line number Diff line change
@@ -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,
}),
});
```
10 changes: 9 additions & 1 deletion packages/integrations/vercel/src/serverless/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down Expand Up @@ -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(
Expand Down
Loading