summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/integrations/vercel/CHANGELOG.md49
-rw-r--r--packages/integrations/vercel/package.json25
-rw-r--r--packages/integrations/vercel/src/image/shared.ts5
-rw-r--r--packages/integrations/vercel/src/image/squoosh-dev-service.ts31
-rw-r--r--packages/integrations/vercel/src/lib/prerender.ts5
-rw-r--r--packages/integrations/vercel/src/lib/redirects.ts34
-rw-r--r--packages/integrations/vercel/src/serverless/adapter.ts146
-rw-r--r--packages/integrations/vercel/src/serverless/entrypoint.ts15
-rw-r--r--packages/integrations/vercel/src/serverless/middleware.ts2
-rw-r--r--packages/integrations/vercel/src/serverless/polyfill.ts3
-rw-r--r--packages/integrations/vercel/src/static/adapter.ts13
-rw-r--r--packages/integrations/vercel/test/fixtures/basic/astro.config.mjs4
-rw-r--r--packages/integrations/vercel/test/fixtures/basic/package.json2
-rw-r--r--packages/integrations/vercel/test/fixtures/functionPerRoute/astro.config.mjs9
-rw-r--r--packages/integrations/vercel/test/fixtures/functionPerRoute/package.json9
-rw-r--r--packages/integrations/vercel/test/fixtures/functionPerRoute/src/pages/one.astro8
-rw-r--r--packages/integrations/vercel/test/fixtures/functionPerRoute/src/pages/prerender.astro12
-rw-r--r--packages/integrations/vercel/test/fixtures/functionPerRoute/src/pages/two.astro8
-rw-r--r--packages/integrations/vercel/test/fixtures/image/package.json2
-rw-r--r--packages/integrations/vercel/test/fixtures/isr/package.json2
-rw-r--r--packages/integrations/vercel/test/fixtures/max-duration/package.json14
-rw-r--r--packages/integrations/vercel/test/fixtures/middleware-with-edge-file/package.json2
-rw-r--r--packages/integrations/vercel/test/fixtures/middleware-without-edge-file/package.json2
-rw-r--r--packages/integrations/vercel/test/fixtures/no-output/package.json2
-rw-r--r--packages/integrations/vercel/test/fixtures/prerendered-error-pages/package.json2
-rw-r--r--packages/integrations/vercel/test/fixtures/redirects-serverless/astro.config.mjs2
-rw-r--r--packages/integrations/vercel/test/fixtures/redirects-serverless/package.json2
-rw-r--r--packages/integrations/vercel/test/fixtures/redirects/package.json2
-rw-r--r--packages/integrations/vercel/test/fixtures/server-islands/astro.config.mjs5
-rw-r--r--packages/integrations/vercel/test/fixtures/server-islands/package.json14
-rw-r--r--packages/integrations/vercel/test/fixtures/serverless-prerender/package.json2
-rw-r--r--packages/integrations/vercel/test/fixtures/serverless-prerender/src/pages/index.astro2
-rw-r--r--packages/integrations/vercel/test/fixtures/serverless-with-dynamic-routes/astro.config.mjs1
-rw-r--r--packages/integrations/vercel/test/fixtures/serverless-with-dynamic-routes/package.json2
-rw-r--r--packages/integrations/vercel/test/fixtures/serverless-with-dynamic-routes/src/pages/index.astro2
-rw-r--r--packages/integrations/vercel/test/fixtures/static-assets/package.json2
-rw-r--r--packages/integrations/vercel/test/fixtures/static/package.json2
-rw-r--r--packages/integrations/vercel/test/fixtures/streaming/package.json14
-rw-r--r--packages/integrations/vercel/test/fixtures/with-speed-insights-enabled/output-as-server/package.json2
-rw-r--r--packages/integrations/vercel/test/fixtures/with-speed-insights-enabled/output-as-static/package.json2
-rw-r--r--packages/integrations/vercel/test/fixtures/with-web-analytics-enabled/output-as-static/package.json2
-rw-r--r--packages/integrations/vercel/test/hosted/hosted-astro-project/package.json2
-rw-r--r--packages/integrations/vercel/test/isr.test.js8
-rw-r--r--packages/integrations/vercel/test/no-output.test.js25
-rw-r--r--packages/integrations/vercel/test/serverless-prerender.test.js2
-rw-r--r--packages/integrations/vercel/test/serverless-with-dynamic-routes.test.js9
-rw-r--r--packages/integrations/vercel/test/split.test.js32
47 files changed, 193 insertions, 349 deletions
diff --git a/packages/integrations/vercel/CHANGELOG.md b/packages/integrations/vercel/CHANGELOG.md
index 36b2226df..ea759d192 100644
--- a/packages/integrations/vercel/CHANGELOG.md
+++ b/packages/integrations/vercel/CHANGELOG.md
@@ -6,6 +6,54 @@
- [#381](https://github.com/withastro/adapters/pull/381) [`46fbb26`](https://github.com/withastro/adapters/commit/46fbb26175ab09d12f95dba63cfe76bdcc25ef59) Thanks [@matthewp](https://github.com/matthewp)! - Prevent crawling for dependencies outside of the workspace root
+## 8.0.0-alpha.1
+
+### Major Changes
+
+- [#11679](https://github.com/withastro/astro/pull/11679) [`ea71b90`](https://github.com/withastro/astro/commit/ea71b90c9c08ddd1d3397c78e2e273fb799f7dbd) Thanks [@florian-lefebvre](https://github.com/florian-lefebvre)! - Adds stable support for `astro:env`
+
+- [#11770](https://github.com/withastro/astro/pull/11770) [`cfa6a47`](https://github.com/withastro/astro/commit/cfa6a47ac7a541f99fdad46a68d0cca6e5816cd5) Thanks [@Princesseuh](https://github.com/Princesseuh)! - Removed support for the Squoosh image service. As the underlying library `libsquoosh` is no longer maintained, and the image service sees very little usage we have decided to remove it from Astro.
+
+ Our recommendation is to use the base Sharp image service, which is more powerful, faster, and more actively maintained.
+
+ ```diff
+ - import { squooshImageService } from "astro/config";
+ import { defineConfig } from "astro/config";
+
+ export default defineConfig({
+ - image: {
+ - service: squooshImageService()
+ - }
+ });
+ ```
+
+ If you are using this service, and cannot migrate to the base Sharp image service, a third-party extraction of the previous service is available here: https://github.com/Princesseuh/astro-image-service-squoosh
+
+### Patch Changes
+
+- [#11783](https://github.com/withastro/astro/pull/11783) [`fc81b01`](https://github.com/withastro/astro/commit/fc81b01bcdd43646bcc615b16bf0400a646445c8) Thanks [@matthewp](https://github.com/matthewp)! - Prevent race condition with Node 18
+
+ Using Node 18 there can be a race condition where polyfill for the `crypto` global is not applied in time. This change ensures the polyfills run first.
+
+## 8.0.0-alpha.0
+
+### Major Changes
+
+- [#11714](https://github.com/withastro/astro/pull/11714) [`8a53517`](https://github.com/withastro/astro/commit/8a5351737d6a14fc55f1dafad8f3b04079e81af6) Thanks [@matthewp](https://github.com/matthewp)! - Remove support for functionPerRoute
+
+ This change removes support for the `functionPerRoute` option both in Astro and `@astrojs/vercel`.
+
+ This option made it so that each route got built as separate entrypoints so that they could be loaded as separate functions. The hope was that by doing this it would decrease the size of each function. However in practice routes use most of the same code, and increases in function size limitations made the potential upsides less important.
+
+ Additionally there are downsides to functionPerRoute, such as hitting limits on the number of functions per project. The feature also never worked with some Astro features like i18n domains and request rewriting.
+
+ Given this, the feature has been removed from Astro.
+
+### Patch Changes
+
+- Updated dependencies [[`b6fbdaa`](https://github.com/withastro/astro/commit/b6fbdaa94a9ecec706a99e1938fbf5cd028c72e0), [`89bab1e`](https://github.com/withastro/astro/commit/89bab1e70786123fbe933a9d7a1b80c9334dcc5f), [`d74617c`](https://github.com/withastro/astro/commit/d74617cbd3278feba05909ec83db2d73d57a153e), [`e90f559`](https://github.com/withastro/astro/commit/e90f5593d23043579611452a84b9e18ad2407ef9), [`2df49a6`](https://github.com/withastro/astro/commit/2df49a6fb4f6d92fe45f7429430abe63defeacd6), [`8a53517`](https://github.com/withastro/astro/commit/8a5351737d6a14fc55f1dafad8f3b04079e81af6)]:
+ - astro@5.0.0-alpha.0
+
## 7.8.0
### Minor Changes
@@ -1241,6 +1289,7 @@
{
expires: '1 month',
}
+ }
);
const prefs = Astro.cookies.get<Prefs>('prefs').json();
diff --git a/packages/integrations/vercel/package.json b/packages/integrations/vercel/package.json
index bbd1dbd17..50977fcf4 100644
--- a/packages/integrations/vercel/package.json
+++ b/packages/integrations/vercel/package.json
@@ -1,7 +1,7 @@
{
"name": "@astrojs/vercel",
"description": "Deploy your site to Vercel",
- "version": "7.8.1",
+ "version": "8.0.0-alpha.1",
"type": "module",
"author": "withastro",
"license": "MIT",
@@ -10,7 +10,10 @@
"url": "https://github.com/withastro/adapters.git",
"directory": "packages/vercel"
},
- "keywords": ["withastro", "astro-adapter"],
+ "keywords": [
+ "withastro",
+ "astro-adapter"
+ ],
"bugs": "https://github.com/withastro/adapters/issues",
"homepage": "https://docs.astro.build/en/guides/integrations-guide/vercel/",
"exports": {
@@ -23,16 +26,22 @@
"./speed-insights": "./dist/speed-insights.js",
"./build-image-service": "./dist/image/build-service.js",
"./dev-image-service": "./dist/image/dev-service.js",
- "./squoosh-dev-service": "./dist/image/squoosh-dev-service.js",
"./package.json": "./package.json"
},
"typesVersions": {
"*": {
- "serverless": ["dist/serverless/adapter.d.ts"],
- "static": ["dist/static/adapter.d.ts"]
+ "serverless": [
+ "dist/serverless/adapter.d.ts"
+ ],
+ "static": [
+ "dist/static/adapter.d.ts"
+ ]
}
},
- "files": ["dist", "types.d.ts"],
+ "files": [
+ "dist",
+ "types.d.ts"
+ ],
"scripts": {
"build": "tsc",
"test": "astro-scripts test --timeout 50000 \"test/**/!(hosted).test.js\"",
@@ -48,11 +57,11 @@
"web-vitals": "^3.5.2"
},
"peerDependencies": {
- "astro": "^4.2.0"
+ "astro": "^5.0.0-alpha.8"
},
"devDependencies": {
"@astrojs/test-utils": "workspace:*",
- "astro": "^4.15.4",
+ "astro": "^5.0.0-alpha.8",
"astro-scripts": "workspace:*",
"cheerio": "1.0.0"
},
diff --git a/packages/integrations/vercel/src/image/shared.ts b/packages/integrations/vercel/src/image/shared.ts
index dfae0d06f..21f101912 100644
--- a/packages/integrations/vercel/src/image/shared.ts
+++ b/packages/integrations/vercel/src/image/shared.ts
@@ -13,7 +13,7 @@ export function isESMImportedImage(src: ImageMetadata | string): src is ImageMet
return typeof src === 'object';
}
-export type DevImageService = 'sharp' | 'squoosh' | (string & {});
+export type DevImageService = 'sharp' | (string & {});
// https://vercel.com/docs/build-output-api/v3/configuration#images
type ImageFormat = 'image/avif' | 'image/webp';
@@ -76,9 +76,6 @@ export function getAstroImageConfig(
case 'sharp':
devService = '@astrojs/vercel/dev-image-service';
break;
- case 'squoosh':
- devService = '@astrojs/vercel/squoosh-dev-image-service';
- break;
default:
if (typeof devImageService === 'string') {
devService = devImageService;
diff --git a/packages/integrations/vercel/src/image/squoosh-dev-service.ts b/packages/integrations/vercel/src/image/squoosh-dev-service.ts
deleted file mode 100644
index d3b05bb11..000000000
--- a/packages/integrations/vercel/src/image/squoosh-dev-service.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import type { LocalImageService } from 'astro';
-import squooshService from 'astro/assets/services/squoosh';
-import { baseDevService } from './shared-dev-service.js';
-
-const service: LocalImageService = {
- ...baseDevService,
- getHTMLAttributes(options, serviceOptions) {
- const { inputtedWidth, ...props } = options;
-
- // If `validateOptions` returned a different width than the one of the image, use it for attributes
- if (inputtedWidth) {
- props.width = inputtedWidth;
- }
-
- return squooshService.getHTMLAttributes
- ? squooshService.getHTMLAttributes(props, serviceOptions)
- : {};
- },
- transform(inputBuffer, transform, serviceOptions) {
- // NOTE: Hardcoding webp here isn't accurate to how the Vercel Image Optimization API works, normally what we should
- // do is setup a custom endpoint that sniff the user's accept-content header and serve the proper format based on the
- // user's Vercel config. However, that's: a lot of work for: not much. The dev service is inaccurate to the prod service
- // in many more ways, this is one of the less offending cases and is, imo, okay, erika - 2023-04-27
- transform.format = transform.src.endsWith('svg') ? 'svg' : 'webp';
-
- // The base squoosh service works the same way as the Vercel Image Optimization API, so it's a safe fallback in local
- return squooshService.transform(inputBuffer, transform, serviceOptions);
- },
-};
-
-export default service;
diff --git a/packages/integrations/vercel/src/lib/prerender.ts b/packages/integrations/vercel/src/lib/prerender.ts
deleted file mode 100644
index f69f3b5d4..000000000
--- a/packages/integrations/vercel/src/lib/prerender.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import type { AstroConfig } from 'astro';
-
-export function isServerLikeOutput(config: AstroConfig) {
- return config.output === 'server' || config.output === 'hybrid';
-}
diff --git a/packages/integrations/vercel/src/lib/redirects.ts b/packages/integrations/vercel/src/lib/redirects.ts
index 59a006886..b11a5b2cc 100644
--- a/packages/integrations/vercel/src/lib/redirects.ts
+++ b/packages/integrations/vercel/src/lib/redirects.ts
@@ -1,6 +1,6 @@
import nodePath from 'node:path';
import { appendForwardSlash, removeLeadingForwardSlash } from '@astrojs/internal-helpers/path';
-import type { AstroConfig, RouteData, RoutePart } from 'astro';
+import type { AstroConfig, IntegrationRouteData, RoutePart } from 'astro';
const pathJoin = nodePath.posix.join;
@@ -49,19 +49,19 @@ function getMatchPattern(segments: RoutePart[][]) {
return segment[0].spread
? '(?:\\/(.*?))?'
: segment
- .map((part) => {
- if (part)
- return part.dynamic
- ? '([^/]+?)'
- : part.content
- .normalize()
- .replace(/\?/g, '%3F')
- .replace(/#/g, '%23')
- .replace(/%5B/g, '[')
- .replace(/%5D/g, ']')
- .replace(/[*+?^${}()|[\]\\]/g, '\\$&');
- })
- .join('');
+ .map((part) => {
+ if (part)
+ return part.dynamic
+ ? '([^/]+?)'
+ : part.content
+ .normalize()
+ .replace(/\?/g, '%3F')
+ .replace(/#/g, '%23')
+ .replace(/%5B/g, '[')
+ .replace(/%5D/g, ']')
+ .replace(/[*+?^${}()|[\]\\]/g, '\\$&');
+ })
+ .join('');
})
.join('/');
}
@@ -85,7 +85,7 @@ function getReplacePattern(segments: RoutePart[][]) {
return result;
}
-function getRedirectLocation(route: RouteData, config: AstroConfig): string {
+function getRedirectLocation(route: IntegrationRouteData, config: AstroConfig): string {
if (route.redirectRoute) {
const pattern = getReplacePattern(route.redirectRoute.segments);
const path = config.trailingSlash === 'always' ? appendForwardSlash(pattern) : pattern;
@@ -99,7 +99,7 @@ function getRedirectLocation(route: RouteData, config: AstroConfig): string {
}
}
-function getRedirectStatus(route: RouteData): number {
+function getRedirectStatus(route: IntegrationRouteData): number {
if (typeof route.redirect === 'object') {
return route.redirect.status;
}
@@ -116,7 +116,7 @@ export function escapeRegex(content: string) {
return `^/${getMatchPattern(segments)}$`;
}
-export function getRedirects(routes: RouteData[], config: AstroConfig): VercelRoute[] {
+export function getRedirects(routes: IntegrationRouteData[], config: AstroConfig): VercelRoute[] {
const redirects: VercelRoute[] = [];
for (const route of routes) {
diff --git a/packages/integrations/vercel/src/serverless/adapter.ts b/packages/integrations/vercel/src/serverless/adapter.ts
index e50bd4190..f45743b03 100644
--- a/packages/integrations/vercel/src/serverless/adapter.ts
+++ b/packages/integrations/vercel/src/serverless/adapter.ts
@@ -7,7 +7,7 @@ import type {
AstroConfig,
AstroIntegration,
AstroIntegrationLogger,
- RouteData,
+ IntegrationRouteData,
} from 'astro';
import { AstroError } from 'astro/errors';
import glob from 'fast-glob';
@@ -70,12 +70,10 @@ const SUPPORTED_NODE_VERSIONS: Record<
function getAdapter({
edgeMiddleware,
- functionPerRoute,
middlewareSecret,
skewProtection,
}: {
edgeMiddleware: boolean;
- functionPerRoute: boolean;
middlewareSecret: string;
skewProtection: boolean;
}): AstroAdapter {
@@ -86,19 +84,15 @@ function getAdapter({
args: { middlewareSecret, skewProtection },
adapterFeatures: {
edgeMiddleware,
- functionPerRoute,
+ buildOutput: 'server',
},
supportedAstroFeatures: {
hybridOutput: 'stable',
staticOutput: 'stable',
serverOutput: 'stable',
- assets: {
- supportKind: 'stable',
- isSharpCompatible: true,
- isSquooshCompatible: true,
- },
+ sharpImageService: 'stable',
i18nDomains: 'experimental',
- envGetSecret: 'experimental',
+ envGetSecret: 'stable',
},
};
}
@@ -134,12 +128,6 @@ 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.
- * @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. */
maxDuration?: number;
@@ -186,7 +174,6 @@ export default function vercelServerless({
imageService,
imagesConfig,
devImageService = 'sharp',
- functionPerRoute = false,
edgeMiddleware = false,
maxDuration,
isr = false,
@@ -206,7 +193,7 @@ export default function vercelServerless({
let _config: AstroConfig;
let _buildTempFolder: URL;
let _serverEntry: string;
- let _entryPoints: Map<RouteData, URL>;
+ let _entryPoints: Map<IntegrationRouteData, URL>;
let _middlewareEntryPoint: URL | undefined;
// Extra files to be merged with `includeFiles` during build
const extraFilesToInclude: URL[] = [];
@@ -246,10 +233,10 @@ export default function vercelServerless({
if (vercelConfig.trailingSlash === true && config.trailingSlash === 'always') {
logger.warn(
'\n' +
- `\tYour "vercel.json" \`trailingSlash\` configuration (set to \`true\`) will conflict with your Astro \`trailinglSlash\` configuration (set to \`"always"\`).\n` +
- // biome-ignore lint/style/noUnusedTemplateLiteral: <explanation>
- `\tThis would cause infinite redirects under certain conditions and throw an \`ERR_TOO_MANY_REDIRECTS\` error.\n` +
- `\tTo prevent this, your Astro configuration is updated to \`"ignore"\` during builds.\n`
+ `\tYour "vercel.json" \`trailingSlash\` configuration (set to \`true\`) will conflict with your Astro \`trailinglSlash\` configuration (set to \`"always"\`).\n` +
+ // biome-ignore lint/style/noUnusedTemplateLiteral: <explanation>
+ `\tThis would cause infinite redirects under certain conditions and throw an \`ERR_TOO_MANY_REDIRECTS\` error.\n` +
+ `\tTo prevent this, your Astro configuration is updated to \`"ignore"\` during builds.\n`
);
updateConfig({
trailingSlash: 'ignore',
@@ -270,10 +257,7 @@ export default function vercelServerless({
vite: {
...getSpeedInsightsViteConfig(speedInsights?.enabled),
ssr: {
- external: [
- '@vercel/nft',
- ...((await shouldExternalizeAstroEnvSetup()) ? ['astro/env/setup'] : []),
- ],
+ external: ['@vercel/nft'],
},
},
...getAstroImageConfig(
@@ -285,39 +269,12 @@ export default function vercelServerless({
),
});
},
- 'astro:config:done': ({ setAdapter, config, logger }) => {
- if (functionPerRoute === true) {
- logger.warn(
- // biome-ignore lint/style/noUnusedTemplateLiteral: <explanation>
- `\n` +
- `\tVercel's hosting plans might have limits to the number of functions you can create.\n` +
- // biome-ignore lint/style/noUnusedTemplateLiteral: <explanation>
- `\tMake sure to check your plan carefully to avoid incurring additional costs.\n` +
- // biome-ignore lint/style/noUnusedTemplateLiteral: <explanation>
- `\tYou can set functionPerRoute: false to prevent surpassing the limit.\n`
- );
-
- logger.warn(
- // biome-ignore lint/style/noUnusedTemplateLiteral: <explanation>
- `\n` +
- // biome-ignore lint/style/noUnusedTemplateLiteral: <explanation>
- `\t\`functionPerRoute\` is deprecated and will be removed in a future version of the adapter.\n`
- );
- }
-
- setAdapter(
- getAdapter({ functionPerRoute, edgeMiddleware, middlewareSecret, skewProtection })
- );
+ 'astro:config:done': ({ setAdapter, config }) => {
+ setAdapter(getAdapter({ edgeMiddleware, middlewareSecret, skewProtection }));
_config = config;
_buildTempFolder = config.build.server;
_serverEntry = config.build.serverEntry;
-
- if (config.output === 'static') {
- throw new AstroError(
- '`output: "server"` or `output: "hybrid"` is required to use the serverless adapter.'
- );
- }
},
'astro:build:ssr': async ({ entryPoints, middlewareEntryPoint }) => {
_entryPoints = new Map(
@@ -357,7 +314,8 @@ export default function vercelServerless({
// Multiple entrypoint support
if (_entryPoints.size) {
- const getRouteFuncName = (route: RouteData) => route.component.replace('src/pages/', '');
+ const getRouteFuncName = (route: IntegrationRouteData) =>
+ route.component.replace('src/pages/', '');
const getFallbackFuncName = (entryFile: URL) =>
basename(entryFile.toString())
@@ -426,31 +384,31 @@ export default function vercelServerless({
...routeDefinitions,
...(fourOhFourRoute
? [
- {
- src: '/.*',
- dest: fourOhFourRoute.prerender
- ? '/404.html'
- : _middlewareEntryPoint
- ? MIDDLEWARE_PATH
- : NODE_PATH,
- status: 404,
- },
- ]
+ {
+ src: '/.*',
+ dest: fourOhFourRoute.prerender
+ ? '/404.html'
+ : _middlewareEntryPoint
+ ? MIDDLEWARE_PATH
+ : NODE_PATH,
+ status: 404,
+ },
+ ]
: []),
],
...(imageService || imagesConfig
? {
- images: imagesConfig
- ? {
- ...imagesConfig,
- domains: [...imagesConfig.domains, ..._config.image.domains],
- remotePatterns: [
- ...(imagesConfig.remotePatterns ?? []),
- ..._config.image.remotePatterns,
- ],
- }
- : getDefaultImageConfig(_config.image),
- }
+ images: imagesConfig
+ ? {
+ ...imagesConfig,
+ domains: [...imagesConfig.domains, ..._config.image.domains],
+ remotePatterns: [
+ ...(imagesConfig.remotePatterns ?? []),
+ ..._config.image.remotePatterns,
+ ],
+ }
+ : getDefaultImageConfig(_config.image),
+ }
: {}),
});
@@ -463,16 +421,6 @@ export default function vercelServerless({
type Runtime = `nodejs${string}.x`;
-// TODO: remove once we don't use a TLA anymore
-async function shouldExternalizeAstroEnvSetup() {
- try {
- await import('astro/env/setup');
- return false;
- } catch {
- return true;
- }
-}
-
class VercelBuilder {
readonly NTF_CACHE = {};
@@ -483,7 +431,7 @@ class VercelBuilder {
readonly logger: AstroIntegrationLogger,
readonly maxDuration?: number,
readonly runtime = getRuntime(process, logger)
- ) {}
+ ) { }
async buildServerlessFolder(entry: URL, functionName: string, root: URL) {
const { config, includeFiles, excludeFiles, logger, NTF_CACHE, runtime, maxDuration } = this;
@@ -561,14 +509,14 @@ function getRuntime(process: NodeJS.Process, logger: AstroIntegrationLogger): Ru
const support = SUPPORTED_NODE_VERSIONS[major];
if (support === undefined) {
logger.warn(
- // biome-ignore lint/style/noUnusedTemplateLiteral: <explanation>
// biome-ignore lint/style/useTemplate: <explanation>
+ // biome-ignore lint/style/noUnusedTemplateLiteral: <explanation>
`\n` +
- `\tThe local Node.js version (${major}) is not supported by Vercel Serverless Functions.\n` +
- // biome-ignore lint/style/noUnusedTemplateLiteral: <explanation>
- `\tYour project will use Node.js 18 as the runtime instead.\n` +
- // biome-ignore lint/style/noUnusedTemplateLiteral: <explanation>
- `\tConsider switching your local version to 18.\n`
+ `\tThe local Node.js version (${major}) is not supported by Vercel Serverless Functions.\n` +
+ // biome-ignore lint/style/noUnusedTemplateLiteral: <explanation>
+ `\tYour project will use Node.js 18 as the runtime instead.\n` +
+ // biome-ignore lint/style/noUnusedTemplateLiteral: <explanation>
+ `\tConsider switching your local version to 18.\n`
);
return 'nodejs18.x';
}
@@ -594,13 +542,13 @@ function getRuntime(process: NodeJS.Process, logger: AstroIntegrationLogger): Ru
support.removal
);
logger.warn(
- // biome-ignore lint/style/noUnusedTemplateLiteral: <explanation>
// biome-ignore lint/style/useTemplate: <explanation>
+ // biome-ignore lint/style/noUnusedTemplateLiteral: <explanation>
`\n` +
- `\tYour project is being built for Node.js ${major} as the runtime.\n` +
- `\tThis version is deprecated by Vercel Serverless Functions, and scheduled to be disabled on ${removeDate}.\n` +
- // biome-ignore lint/style/noUnusedTemplateLiteral: <explanation>
- `\tConsider upgrading your local version to 18.\n`
+ `\tYour project is being built for Node.js ${major} as the runtime.\n` +
+ `\tThis version is deprecated by Vercel Serverless Functions, and scheduled to be disabled on ${removeDate}.\n` +
+ // biome-ignore lint/style/noUnusedTemplateLiteral: <explanation>
+ `\tConsider upgrading your local version to 18.\n`
);
return `nodejs${major}.x`;
}
diff --git a/packages/integrations/vercel/src/serverless/entrypoint.ts b/packages/integrations/vercel/src/serverless/entrypoint.ts
index 31f78bb8a..01279a2b4 100644
--- a/packages/integrations/vercel/src/serverless/entrypoint.ts
+++ b/packages/integrations/vercel/src/serverless/entrypoint.ts
@@ -1,6 +1,10 @@
+// Keep at the top
+import './polyfill.js';
+
import type { IncomingMessage, ServerResponse } from 'node:http';
import type { SSRManifest } from 'astro';
-import { NodeApp, applyPolyfills } from 'astro/app/node';
+import { NodeApp } from 'astro/app/node';
+import { setGetEnv } from 'astro/env/setup';
import {
ASTRO_LOCALS_HEADER,
ASTRO_MIDDLEWARE_SECRET_HEADER,
@@ -8,14 +12,7 @@ import {
ASTRO_PATH_PARAM,
} from './adapter.js';
-// Run polyfills immediately so any dependent code can use the globals
-applyPolyfills();
-
-// Won't throw if the virtual module is not available because it's not supported in
-// the users's astro version or if astro:env is not enabled in the project
-await import('astro/env/setup')
- .then((mod) => mod.setGetEnv((key) => process.env[key]))
- .catch(() => {});
+setGetEnv((key) => process.env[key]);
export const createExports = (
manifest: SSRManifest,
diff --git a/packages/integrations/vercel/src/serverless/middleware.ts b/packages/integrations/vercel/src/serverless/middleware.ts
index ca84bff33..973df238f 100644
--- a/packages/integrations/vercel/src/serverless/middleware.ts
+++ b/packages/integrations/vercel/src/serverless/middleware.ts
@@ -98,7 +98,7 @@ export default async function middleware(request, context) {
request,
params: {}
});
- ctx.locals = { vercel: { edge: context }, ...${handlerTemplateCall} };
+ Object.assign(ctx.locals, { vercel: { edge: context }, ...${handlerTemplateCall} });
const { origin } = new URL(request.url);
const next = async () => {
const { vercel, ...locals } = ctx.locals;
diff --git a/packages/integrations/vercel/src/serverless/polyfill.ts b/packages/integrations/vercel/src/serverless/polyfill.ts
new file mode 100644
index 000000000..dc00f45d7
--- /dev/null
+++ b/packages/integrations/vercel/src/serverless/polyfill.ts
@@ -0,0 +1,3 @@
+import { applyPolyfills } from 'astro/app/node';
+
+applyPolyfills();
diff --git a/packages/integrations/vercel/src/static/adapter.ts b/packages/integrations/vercel/src/static/adapter.ts
index 4a5bdf966..458143215 100644
--- a/packages/integrations/vercel/src/static/adapter.ts
+++ b/packages/integrations/vercel/src/static/adapter.ts
@@ -7,7 +7,6 @@ import {
getAstroImageConfig,
getDefaultImageConfig,
} from '../image/shared.js';
-import { isServerLikeOutput } from '../lib/prerender.js';
import { getRedirects } from '../lib/redirects.js';
import {
type VercelSpeedInsightsConfig,
@@ -24,19 +23,15 @@ function getAdapter(): AstroAdapter {
return {
name: PACKAGE_NAME,
supportedAstroFeatures: {
- assets: {
- supportKind: 'stable',
- isSquooshCompatible: true,
- isSharpCompatible: true,
- },
+ sharpImageService: 'stable',
staticOutput: 'stable',
serverOutput: 'unsupported',
hybridOutput: 'unsupported',
envGetSecret: 'unsupported',
},
adapterFeatures: {
+ buildOutput: 'static',
edgeMiddleware: false,
- functionPerRoute: false,
},
};
}
@@ -102,10 +97,6 @@ export default function vercelStatic({
'astro:config:done': ({ setAdapter, config }) => {
setAdapter(getAdapter());
_config = config;
-
- if (isServerLikeOutput(config)) {
- throw new Error(`${PACKAGE_NAME} should be used with output: 'static'`);
- }
},
'astro:build:start': async () => {
// Ensure to have `.vercel/output` empty.
diff --git a/packages/integrations/vercel/test/fixtures/basic/astro.config.mjs b/packages/integrations/vercel/test/fixtures/basic/astro.config.mjs
index 942139f3d..2fba43b6e 100644
--- a/packages/integrations/vercel/test/fixtures/basic/astro.config.mjs
+++ b/packages/integrations/vercel/test/fixtures/basic/astro.config.mjs
@@ -2,7 +2,5 @@ import vercel from '@astrojs/vercel/serverless';
import { defineConfig } from 'astro/config';
export default defineConfig({
- adapter: vercel({
- functionPerRoute: true
- })
+ adapter: vercel({})
});
diff --git a/packages/integrations/vercel/test/fixtures/basic/package.json b/packages/integrations/vercel/test/fixtures/basic/package.json
index 08196aca0..859459d0c 100644
--- a/packages/integrations/vercel/test/fixtures/basic/package.json
+++ b/packages/integrations/vercel/test/fixtures/basic/package.json
@@ -4,6 +4,6 @@
"private": true,
"dependencies": {
"@astrojs/vercel": "workspace:*",
- "astro": "^4.15.4"
+ "astro": "^5.0.0-alpha.8"
}
}
diff --git a/packages/integrations/vercel/test/fixtures/functionPerRoute/astro.config.mjs b/packages/integrations/vercel/test/fixtures/functionPerRoute/astro.config.mjs
deleted file mode 100644
index eb2c7699e..000000000
--- a/packages/integrations/vercel/test/fixtures/functionPerRoute/astro.config.mjs
+++ /dev/null
@@ -1,9 +0,0 @@
-import vercel from '@astrojs/vercel/serverless';
-import { defineConfig } from 'astro/config';
-
-export default defineConfig({
- adapter: vercel({
- functionPerRoute: true
- }),
- output: "server"
-});
diff --git a/packages/integrations/vercel/test/fixtures/functionPerRoute/package.json b/packages/integrations/vercel/test/fixtures/functionPerRoute/package.json
deleted file mode 100644
index b570c0d28..000000000
--- a/packages/integrations/vercel/test/fixtures/functionPerRoute/package.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "name": "@test/astro-vercel-function-per-route",
- "version": "0.0.0",
- "private": true,
- "dependencies": {
- "@astrojs/vercel": "workspace:*",
- "astro": "^4.15.4"
- }
-}
diff --git a/packages/integrations/vercel/test/fixtures/functionPerRoute/src/pages/one.astro b/packages/integrations/vercel/test/fixtures/functionPerRoute/src/pages/one.astro
deleted file mode 100644
index 0c7fb90a7..000000000
--- a/packages/integrations/vercel/test/fixtures/functionPerRoute/src/pages/one.astro
+++ /dev/null
@@ -1,8 +0,0 @@
-<html>
- <head>
- <title>One</title>
- </head>
- <body>
- <h1>One</h1>
- </body>
-</html>
diff --git a/packages/integrations/vercel/test/fixtures/functionPerRoute/src/pages/prerender.astro b/packages/integrations/vercel/test/fixtures/functionPerRoute/src/pages/prerender.astro
deleted file mode 100644
index c61b83a97..000000000
--- a/packages/integrations/vercel/test/fixtures/functionPerRoute/src/pages/prerender.astro
+++ /dev/null
@@ -1,12 +0,0 @@
----
-export const prerender = true;
----
-
-<html>
- <head>
- <title>Prerendered Page</title>
- </head>
- <body>
- <h1>Prerendered Page</h1>
- </body>
-</html>
diff --git a/packages/integrations/vercel/test/fixtures/functionPerRoute/src/pages/two.astro b/packages/integrations/vercel/test/fixtures/functionPerRoute/src/pages/two.astro
deleted file mode 100644
index e7ba9910e..000000000
--- a/packages/integrations/vercel/test/fixtures/functionPerRoute/src/pages/two.astro
+++ /dev/null
@@ -1,8 +0,0 @@
-<html>
- <head>
- <title>Two</title>
- </head>
- <body>
- <h1>Two</h1>
- </body>
-</html>
diff --git a/packages/integrations/vercel/test/fixtures/image/package.json b/packages/integrations/vercel/test/fixtures/image/package.json
index 0718f84e4..28b7bccd2 100644
--- a/packages/integrations/vercel/test/fixtures/image/package.json
+++ b/packages/integrations/vercel/test/fixtures/image/package.json
@@ -7,6 +7,6 @@
},
"dependencies": {
"@astrojs/vercel": "workspace:*",
- "astro": "^4.15.4"
+ "astro": "^5.0.0-alpha.8"
}
}
diff --git a/packages/integrations/vercel/test/fixtures/isr/package.json b/packages/integrations/vercel/test/fixtures/isr/package.json
index a8ef58eda..7d47893c8 100644
--- a/packages/integrations/vercel/test/fixtures/isr/package.json
+++ b/packages/integrations/vercel/test/fixtures/isr/package.json
@@ -4,6 +4,6 @@
"private": true,
"dependencies": {
"@astrojs/vercel": "workspace:*",
- "astro": "^4.15.4"
+ "astro": "^5.0.0-alpha.8"
}
}
diff --git a/packages/integrations/vercel/test/fixtures/max-duration/package.json b/packages/integrations/vercel/test/fixtures/max-duration/package.json
index 9aa5755fa..c44974e78 100644
--- a/packages/integrations/vercel/test/fixtures/max-duration/package.json
+++ b/packages/integrations/vercel/test/fixtures/max-duration/package.json
@@ -1,9 +1,9 @@
{
- "name": "@test/vercel-max-duration",
- "version": "0.0.0",
- "private": true,
- "dependencies": {
- "@astrojs/vercel": "workspace:*",
- "astro": "^4.15.4"
- }
+ "name": "@test/vercel-max-duration",
+ "version": "0.0.0",
+ "private": true,
+ "dependencies": {
+ "@astrojs/vercel": "workspace:*",
+ "astro": "^5.0.0-alpha.8"
+ }
}
diff --git a/packages/integrations/vercel/test/fixtures/middleware-with-edge-file/package.json b/packages/integrations/vercel/test/fixtures/middleware-with-edge-file/package.json
index 157e45f4c..d40a35aac 100644
--- a/packages/integrations/vercel/test/fixtures/middleware-with-edge-file/package.json
+++ b/packages/integrations/vercel/test/fixtures/middleware-with-edge-file/package.json
@@ -4,6 +4,6 @@
"private": true,
"dependencies": {
"@astrojs/vercel": "workspace:*",
- "astro": "^4.15.4"
+ "astro": "^5.0.0-alpha.8"
}
}
diff --git a/packages/integrations/vercel/test/fixtures/middleware-without-edge-file/package.json b/packages/integrations/vercel/test/fixtures/middleware-without-edge-file/package.json
index a4dde8fd1..24e41eb3d 100644
--- a/packages/integrations/vercel/test/fixtures/middleware-without-edge-file/package.json
+++ b/packages/integrations/vercel/test/fixtures/middleware-without-edge-file/package.json
@@ -4,6 +4,6 @@
"private": true,
"dependencies": {
"@astrojs/vercel": "workspace:*",
- "astro": "^4.15.4"
+ "astro": "^5.0.0-alpha.8"
}
}
diff --git a/packages/integrations/vercel/test/fixtures/no-output/package.json b/packages/integrations/vercel/test/fixtures/no-output/package.json
index 4d324c278..ee2bc9cd8 100644
--- a/packages/integrations/vercel/test/fixtures/no-output/package.json
+++ b/packages/integrations/vercel/test/fixtures/no-output/package.json
@@ -4,6 +4,6 @@
"private": true,
"dependencies": {
"@astrojs/vercel": "workspace:*",
- "astro": "^4.15.4"
+ "astro": "^5.0.0-alpha.8"
}
}
diff --git a/packages/integrations/vercel/test/fixtures/prerendered-error-pages/package.json b/packages/integrations/vercel/test/fixtures/prerendered-error-pages/package.json
index 664ec37b7..e503f9b42 100644
--- a/packages/integrations/vercel/test/fixtures/prerendered-error-pages/package.json
+++ b/packages/integrations/vercel/test/fixtures/prerendered-error-pages/package.json
@@ -4,6 +4,6 @@
"private": true,
"dependencies": {
"@astrojs/vercel": "workspace:*",
- "astro": "^4.15.4"
+ "astro": "^5.0.0-alpha.8"
}
}
diff --git a/packages/integrations/vercel/test/fixtures/redirects-serverless/astro.config.mjs b/packages/integrations/vercel/test/fixtures/redirects-serverless/astro.config.mjs
index 1071b7e67..04e8ffa9d 100644
--- a/packages/integrations/vercel/test/fixtures/redirects-serverless/astro.config.mjs
+++ b/packages/integrations/vercel/test/fixtures/redirects-serverless/astro.config.mjs
@@ -2,6 +2,6 @@ import vercel from '@astrojs/vercel/serverless';
import { defineConfig } from 'astro/config';
export default defineConfig({
- output: 'hybrid',
+ output: 'static',
adapter: vercel(),
});
diff --git a/packages/integrations/vercel/test/fixtures/redirects-serverless/package.json b/packages/integrations/vercel/test/fixtures/redirects-serverless/package.json
index 5796f468b..64c719061 100644
--- a/packages/integrations/vercel/test/fixtures/redirects-serverless/package.json
+++ b/packages/integrations/vercel/test/fixtures/redirects-serverless/package.json
@@ -4,6 +4,6 @@
"private": true,
"dependencies": {
"@astrojs/vercel": "workspace:*",
- "astro": "^4.15.4"
+ "astro": "^5.0.0-alpha.8"
}
}
diff --git a/packages/integrations/vercel/test/fixtures/redirects/package.json b/packages/integrations/vercel/test/fixtures/redirects/package.json
index 352f122b5..0f544f40c 100644
--- a/packages/integrations/vercel/test/fixtures/redirects/package.json
+++ b/packages/integrations/vercel/test/fixtures/redirects/package.json
@@ -4,6 +4,6 @@
"private": true,
"dependencies": {
"@astrojs/vercel": "workspace:*",
- "astro": "^4.15.4"
+ "astro": "^5.0.0-alpha.8"
}
}
diff --git a/packages/integrations/vercel/test/fixtures/server-islands/astro.config.mjs b/packages/integrations/vercel/test/fixtures/server-islands/astro.config.mjs
index 534197429..94f52a3d6 100644
--- a/packages/integrations/vercel/test/fixtures/server-islands/astro.config.mjs
+++ b/packages/integrations/vercel/test/fixtures/server-islands/astro.config.mjs
@@ -3,8 +3,5 @@ import { defineConfig } from 'astro/config';
export default defineConfig({
output: "server",
- adapter: vercel(),
- experimental: {
- serverIslands: true,
- }
+ adapter: vercel()
});
diff --git a/packages/integrations/vercel/test/fixtures/server-islands/package.json b/packages/integrations/vercel/test/fixtures/server-islands/package.json
index 1d556e58b..e66accecb 100644
--- a/packages/integrations/vercel/test/fixtures/server-islands/package.json
+++ b/packages/integrations/vercel/test/fixtures/server-islands/package.json
@@ -1,9 +1,9 @@
{
- "name": "@test/vercel-server-islands",
- "version": "0.0.0",
- "private": true,
- "dependencies": {
- "@astrojs/vercel": "workspace:*",
- "astro": "^4.15.4"
- }
+ "name": "@test/vercel-server-islands",
+ "version": "0.0.0",
+ "private": true,
+ "dependencies": {
+ "@astrojs/vercel": "workspace:*",
+ "astro": "^5.0.0-alpha.8"
+ }
}
diff --git a/packages/integrations/vercel/test/fixtures/serverless-prerender/package.json b/packages/integrations/vercel/test/fixtures/serverless-prerender/package.json
index a8d595925..fbfdcb86e 100644
--- a/packages/integrations/vercel/test/fixtures/serverless-prerender/package.json
+++ b/packages/integrations/vercel/test/fixtures/serverless-prerender/package.json
@@ -4,6 +4,6 @@
"private": true,
"dependencies": {
"@astrojs/vercel": "workspace:*",
- "astro": "^4.15.4"
+ "astro": "^5.0.0-alpha.8"
}
}
diff --git a/packages/integrations/vercel/test/fixtures/serverless-prerender/src/pages/index.astro b/packages/integrations/vercel/test/fixtures/serverless-prerender/src/pages/index.astro
index b6b833e53..2a976957b 100644
--- a/packages/integrations/vercel/test/fixtures/serverless-prerender/src/pages/index.astro
+++ b/packages/integrations/vercel/test/fixtures/serverless-prerender/src/pages/index.astro
@@ -1,5 +1,5 @@
---
-export const prerender = import.meta.env.PRERENDER;
+export const prerender = true;
---
<html>
diff --git a/packages/integrations/vercel/test/fixtures/serverless-with-dynamic-routes/astro.config.mjs b/packages/integrations/vercel/test/fixtures/serverless-with-dynamic-routes/astro.config.mjs
index 3132bfc53..4d8f76288 100644
--- a/packages/integrations/vercel/test/fixtures/serverless-with-dynamic-routes/astro.config.mjs
+++ b/packages/integrations/vercel/test/fixtures/serverless-with-dynamic-routes/astro.config.mjs
@@ -5,7 +5,6 @@ export default defineConfig({
adapter: vercel({
// Pass some value to make sure it doesn't error out
includeFiles: ['included.js'],
- functionPerRoute: true,
}),
output: 'server'
});
diff --git a/packages/integrations/vercel/test/fixtures/serverless-with-dynamic-routes/package.json b/packages/integrations/vercel/test/fixtures/serverless-with-dynamic-routes/package.json
index 4e7e50820..bc866494e 100644
--- a/packages/integrations/vercel/test/fixtures/serverless-with-dynamic-routes/package.json
+++ b/packages/integrations/vercel/test/fixtures/serverless-with-dynamic-routes/package.json
@@ -4,6 +4,6 @@
"private": true,
"dependencies": {
"@astrojs/vercel": "workspace:*",
- "astro": "^4.15.4"
+ "astro": "^5.0.0-alpha.8"
}
}
diff --git a/packages/integrations/vercel/test/fixtures/serverless-with-dynamic-routes/src/pages/index.astro b/packages/integrations/vercel/test/fixtures/serverless-with-dynamic-routes/src/pages/index.astro
index b6b833e53..2a976957b 100644
--- a/packages/integrations/vercel/test/fixtures/serverless-with-dynamic-routes/src/pages/index.astro
+++ b/packages/integrations/vercel/test/fixtures/serverless-with-dynamic-routes/src/pages/index.astro
@@ -1,5 +1,5 @@
---
-export const prerender = import.meta.env.PRERENDER;
+export const prerender = true;
---
<html>
diff --git a/packages/integrations/vercel/test/fixtures/static-assets/package.json b/packages/integrations/vercel/test/fixtures/static-assets/package.json
index d3f782842..693155026 100644
--- a/packages/integrations/vercel/test/fixtures/static-assets/package.json
+++ b/packages/integrations/vercel/test/fixtures/static-assets/package.json
@@ -4,6 +4,6 @@
"private": true,
"dependencies": {
"@astrojs/vercel": "workspace:*",
- "astro": "^4.15.4"
+ "astro": "^5.0.0-alpha.8"
}
}
diff --git a/packages/integrations/vercel/test/fixtures/static/package.json b/packages/integrations/vercel/test/fixtures/static/package.json
index 46343416f..440627b64 100644
--- a/packages/integrations/vercel/test/fixtures/static/package.json
+++ b/packages/integrations/vercel/test/fixtures/static/package.json
@@ -4,6 +4,6 @@
"private": true,
"dependencies": {
"@astrojs/vercel": "workspace:*",
- "astro": "^4.15.4"
+ "astro": "^5.0.0-alpha.8"
}
}
diff --git a/packages/integrations/vercel/test/fixtures/streaming/package.json b/packages/integrations/vercel/test/fixtures/streaming/package.json
index 947183d54..d85cebb8e 100644
--- a/packages/integrations/vercel/test/fixtures/streaming/package.json
+++ b/packages/integrations/vercel/test/fixtures/streaming/package.json
@@ -1,9 +1,9 @@
{
- "name": "@test/vercel-streaming",
- "version": "0.0.0",
- "private": true,
- "dependencies": {
- "@astrojs/vercel": "workspace:*",
- "astro": "^4.15.4"
- }
+ "name": "@test/vercel-streaming",
+ "version": "0.0.0",
+ "private": true,
+ "dependencies": {
+ "@astrojs/vercel": "workspace:*",
+ "astro": "^5.0.0-alpha.8"
+ }
}
diff --git a/packages/integrations/vercel/test/fixtures/with-speed-insights-enabled/output-as-server/package.json b/packages/integrations/vercel/test/fixtures/with-speed-insights-enabled/output-as-server/package.json
index 839c0a8e6..4e674fa6d 100644
--- a/packages/integrations/vercel/test/fixtures/with-speed-insights-enabled/output-as-server/package.json
+++ b/packages/integrations/vercel/test/fixtures/with-speed-insights-enabled/output-as-server/package.json
@@ -4,6 +4,6 @@
"private": true,
"dependencies": {
"@astrojs/vercel": "workspace:*",
- "astro": "^4.15.4"
+ "astro": "^5.0.0-alpha.8"
}
}
diff --git a/packages/integrations/vercel/test/fixtures/with-speed-insights-enabled/output-as-static/package.json b/packages/integrations/vercel/test/fixtures/with-speed-insights-enabled/output-as-static/package.json
index bfa74d2bb..fd4b24faa 100644
--- a/packages/integrations/vercel/test/fixtures/with-speed-insights-enabled/output-as-static/package.json
+++ b/packages/integrations/vercel/test/fixtures/with-speed-insights-enabled/output-as-static/package.json
@@ -4,6 +4,6 @@
"private": true,
"dependencies": {
"@astrojs/vercel": "workspace:*",
- "astro": "^4.15.4"
+ "astro": "^5.0.0-alpha.8"
}
}
diff --git a/packages/integrations/vercel/test/fixtures/with-web-analytics-enabled/output-as-static/package.json b/packages/integrations/vercel/test/fixtures/with-web-analytics-enabled/output-as-static/package.json
index 5aabdcf40..61d3de1f0 100644
--- a/packages/integrations/vercel/test/fixtures/with-web-analytics-enabled/output-as-static/package.json
+++ b/packages/integrations/vercel/test/fixtures/with-web-analytics-enabled/output-as-static/package.json
@@ -4,6 +4,6 @@
"private": true,
"dependencies": {
"@astrojs/vercel": "workspace:*",
- "astro": "^4.15.4"
+ "astro": "^5.0.0-alpha.8"
}
}
diff --git a/packages/integrations/vercel/test/hosted/hosted-astro-project/package.json b/packages/integrations/vercel/test/hosted/hosted-astro-project/package.json
index 1e1793a56..914b2f66d 100644
--- a/packages/integrations/vercel/test/hosted/hosted-astro-project/package.json
+++ b/packages/integrations/vercel/test/hosted/hosted-astro-project/package.json
@@ -7,6 +7,6 @@
},
"dependencies": {
"@astrojs/vercel": "workspace:*",
- "astro": "^4.15.4"
+ "astro": "^5.0.0-alpha.8"
}
}
diff --git a/packages/integrations/vercel/test/isr.test.js b/packages/integrations/vercel/test/isr.test.js
index a8df2c0ef..6c88d0081 100644
--- a/packages/integrations/vercel/test/isr.test.js
+++ b/packages/integrations/vercel/test/isr.test.js
@@ -38,10 +38,6 @@ describe('ISR', () => {
dest: '_render',
},
{
- src: '^\\/_image$',
- dest: '_render',
- },
- {
src: '^\\/excluded\\/([^/]+?)\\/?$',
dest: '/_isr?x_astro_path=$0',
},
@@ -53,6 +49,10 @@ describe('ISR', () => {
src: '^\\/two\\/?$',
dest: '/_isr?x_astro_path=$0',
},
+ {
+ src: '^\\/_image\\/?$',
+ dest: '_render',
+ },
]);
});
});
diff --git a/packages/integrations/vercel/test/no-output.test.js b/packages/integrations/vercel/test/no-output.test.js
deleted file mode 100644
index 34709804d..000000000
--- a/packages/integrations/vercel/test/no-output.test.js
+++ /dev/null
@@ -1,25 +0,0 @@
-import assert from 'node:assert/strict';
-import { before, describe, it } from 'node:test';
-import { loadFixture } from './test-utils.js';
-
-describe('Missing output config', () => {
- /** @type {import('./test-utils').Fixture} */
- let fixture;
-
- before(async () => {
- fixture = await loadFixture({
- root: './fixtures/no-output/',
- });
- });
-
- it('throws during the build', async () => {
- let error = undefined;
- try {
- await fixture.build();
- } catch (err) {
- error = err;
- }
- assert.notEqual(error, undefined);
- assert.match(error.message, /output: "server"/);
- });
-});
diff --git a/packages/integrations/vercel/test/serverless-prerender.test.js b/packages/integrations/vercel/test/serverless-prerender.test.js
index 03ec8c225..140e422bd 100644
--- a/packages/integrations/vercel/test/serverless-prerender.test.js
+++ b/packages/integrations/vercel/test/serverless-prerender.test.js
@@ -44,7 +44,7 @@ describe('Serverless hybrid rendering', () => {
process.env.PRERENDER = true;
fixture = await loadFixture({
root: './fixtures/serverless-prerender/',
- output: 'hybrid',
+ output: 'static',
});
await fixture.build();
});
diff --git a/packages/integrations/vercel/test/serverless-with-dynamic-routes.test.js b/packages/integrations/vercel/test/serverless-with-dynamic-routes.test.js
index 0967f864b..19ae4af1a 100644
--- a/packages/integrations/vercel/test/serverless-with-dynamic-routes.test.js
+++ b/packages/integrations/vercel/test/serverless-with-dynamic-routes.test.js
@@ -10,18 +10,13 @@ describe('Serverless with dynamic routes', () => {
process.env.PRERENDER = true;
fixture = await loadFixture({
root: './fixtures/serverless-with-dynamic-routes/',
- output: 'hybrid',
+ output: 'static',
});
await fixture.build();
});
it('build successful', async () => {
assert.ok(await fixture.readFile('../.vercel/output/static/index.html'));
- assert.ok(
- await fixture.readFile('../.vercel/output/functions/[id]/index.astro.func/.vc-config.json')
- );
- assert.ok(
- await fixture.readFile('../.vercel/output/functions/api/[id].js.func/.vc-config.json')
- );
+ assert.ok(await fixture.readFile('../.vercel/output/functions/_render.func/.vc-config.json'));
});
});
diff --git a/packages/integrations/vercel/test/split.test.js b/packages/integrations/vercel/test/split.test.js
deleted file mode 100644
index e64a4dc60..000000000
--- a/packages/integrations/vercel/test/split.test.js
+++ /dev/null
@@ -1,32 +0,0 @@
-import assert from 'node:assert/strict';
-import { before, describe, it } from 'node:test';
-import { loadFixture } from './test-utils.js';
-
-describe('build: split', () => {
- /** @type {import('./test-utils').Fixture} */
- let fixture;
-
- before(async () => {
- fixture = await loadFixture({
- root: './fixtures/functionPerRoute/',
- output: 'server',
- });
- await fixture.build();
- });
-
- it('creates separate functions for non-prerendered pages', async () => {
- const files = await fixture.readdir('../.vercel/output/functions/');
- assert.equal(files.length, 3);
- assert.equal(files.includes('prerender.astro.func'), false);
- });
-
- it('creates the route definitions in the config.json', async () => {
- const json = await fixture.readFile('../.vercel/output/config.json');
- const config = JSON.parse(json);
- assert.equal(config.routes.length, 5);
- assert.equal(
- config.routes.some((route) => route.dest === 'prerender.astro'),
- false
- );
- });
-});