summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/integrations/vercel/package.json18
-rw-r--r--packages/integrations/vercel/src/serverless/adapter.ts70
2 files changed, 49 insertions, 39 deletions
diff --git a/packages/integrations/vercel/package.json b/packages/integrations/vercel/package.json
index 3c9b81a69..1a9785f52 100644
--- a/packages/integrations/vercel/package.json
+++ b/packages/integrations/vercel/package.json
@@ -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": {
@@ -27,11 +30,18 @@
},
"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\"",
diff --git a/packages/integrations/vercel/src/serverless/adapter.ts b/packages/integrations/vercel/src/serverless/adapter.ts
index bdac26222..a762103f9 100644
--- a/packages/integrations/vercel/src/serverless/adapter.ts
+++ b/packages/integrations/vercel/src/serverless/adapter.ts
@@ -235,10 +235,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',
@@ -394,31 +394,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),
+ }
: {}),
});
@@ -451,7 +451,7 @@ class VercelBuilder {
readonly logger: AstroIntegrationLogger,
readonly maxDuration?: number,
readonly runtime = getRuntime(process, logger)
- ) {}
+ ) { }
async buildServerlessFolder(entry: URL, functionName: string) {
const { config, includeFiles, excludeFiles, logger, NTF_CACHE, runtime, maxDuration } = this;
@@ -531,11 +531,11 @@ function getRuntime(process: NodeJS.Process, logger: AstroIntegrationLogger): Ru
// 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';
}
@@ -564,10 +564,10 @@ function getRuntime(process: NodeJS.Process, logger: AstroIntegrationLogger): Ru
// 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`;
}