diff options
Diffstat (limited to 'packages/integrations/vercel/src/serverless/adapter.ts')
-rw-r--r-- | packages/integrations/vercel/src/serverless/adapter.ts | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/packages/integrations/vercel/src/serverless/adapter.ts b/packages/integrations/vercel/src/serverless/adapter.ts index e4ab5ac88..8cddc0be1 100644 --- a/packages/integrations/vercel/src/serverless/adapter.ts +++ b/packages/integrations/vercel/src/serverless/adapter.ts @@ -214,10 +214,10 @@ export default function vercelServerless({ 'astro:config:setup': async ({ command, config, updateConfig, injectScript, logger }) => { if (maxDuration && maxDuration > 900) { logger.warn( - `maxDuration is set to ${maxDuration} seconds, which is longer than the maximum allowed duration of 900 seconds.` + `maxDuration is set to ${maxDuration} seconds, which is longer than the maximum allowed duration of 900 seconds.`, ); logger.warn( - `Please make sure that your plan allows for this duration. See https://vercel.com/docs/functions/serverless-functions/runtimes#maxduration for more information.` + `Please make sure that your plan allows for this duration. See https://vercel.com/docs/functions/serverless-functions/runtimes#maxduration for more information.`, ); } @@ -226,7 +226,7 @@ export default function vercelServerless({ 'head-inline', await getInjectableWebAnalyticsContent({ mode: command === 'dev' ? 'development' : 'production', - }) + }), ); } if (command === 'build' && speedInsights?.enabled) { @@ -242,7 +242,7 @@ export default function vercelServerless({ '\n' + `\tYour "vercel.json" \`trailingSlash\` configuration (set to \`true\`) will conflict with your Astro \`trailinglSlash\` configuration (set to \`"always"\`).\n` + `\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` + `\tTo prevent this, your Astro configuration is updated to \`"ignore"\` during builds.\n`, ); updateConfig({ trailingSlash: 'ignore', @@ -274,7 +274,7 @@ export default function vercelServerless({ imagesConfig, command, devImageService, - config.image + config.image, ), }); }, @@ -284,12 +284,12 @@ export default function vercelServerless({ `\n` + `\tVercel's hosting plans might have limits to the number of functions you can create.\n` + `\tMake sure to check your plan carefully to avoid incurring additional costs.\n` + - `\tYou can set functionPerRoute: false to prevent surpassing the limit.\n` + `\tYou can set functionPerRoute: false to prevent surpassing the limit.\n`, ); } setAdapter( - getAdapter({ functionPerRoute, edgeMiddleware, middlewareSecret, skewProtection }) + getAdapter({ functionPerRoute, edgeMiddleware, middlewareSecret, skewProtection }), ); _config = config; @@ -298,13 +298,13 @@ export default function vercelServerless({ if (config.output === 'static') { throw new AstroError( - '`output: "server"` or `output: "hybrid"` is required to use the serverless adapter.' + '`output: "server"` or `output: "hybrid"` is required to use the serverless adapter.', ); } }, 'astro:build:ssr': async ({ entryPoints, middlewareEntryPoint }) => { _entryPoints = new Map( - Array.from(entryPoints).filter(([routeData]) => !routeData.prerender) + Array.from(entryPoints).filter(([routeData]) => !routeData.prerender), ); _middlewareEntryPoint = middlewareEntryPoint; }, @@ -389,7 +389,7 @@ export default function vercelServerless({ await builder.buildMiddlewareFolder( _middlewareEntryPoint, MIDDLEWARE_PATH, - middlewareSecret + middlewareSecret, ); } const fourOhFourRoute = routes.find((route) => route.pathname === '/404'); @@ -464,7 +464,7 @@ class VercelBuilder { readonly includeFiles: URL[], readonly logger: AstroIntegrationLogger, readonly maxDuration?: number, - readonly runtime = getRuntime(process, logger) + readonly runtime = getRuntime(process, logger), ) {} async buildServerlessFolder(entry: URL, functionName: string) { @@ -483,7 +483,7 @@ class VercelBuilder { excludeFiles, logger, }, - NTF_CACHE + NTF_CACHE, ); // Enable ESM @@ -505,7 +505,7 @@ class VercelBuilder { await this.buildServerlessFolder(entry, functionName); const prerenderConfig = new URL( `./functions/${functionName}.prerender-config.json`, - this.config.outDir + this.config.outDir, ); // https://vercel.com/docs/build-output-api/v3/primitives#prerender-configuration-file await writeJson(prerenderConfig, { @@ -525,7 +525,7 @@ class VercelBuilder { new URL(VERCEL_EDGE_MIDDLEWARE_FILE, this.config.srcDir), new URL('./middleware.mjs', functionFolder), middlewareSecret, - this.logger + this.logger, ); await writeJson(new URL(`./.vc-config.json`, functionFolder), { @@ -544,7 +544,7 @@ function getRuntime(process: NodeJS.Process, logger: AstroIntegrationLogger): Ru `\n` + `\tThe local Node.js version (${major}) is not supported by Vercel Serverless Functions.\n` + `\tYour project will use Node.js 18 as the runtime instead.\n` + - `\tConsider switching your local version to 18.\n` + `\tConsider switching your local version to 18.\n`, ); return 'nodejs18.x'; } @@ -554,26 +554,26 @@ function getRuntime(process: NodeJS.Process, logger: AstroIntegrationLogger): Ru if (support.status === 'retiring') { if (support.warnDate && new Date() >= support.warnDate) { logger.warn( - `Your project is being built for Node.js ${major} as the runtime, which is retiring by ${support.removal}.` + `Your project is being built for Node.js ${major} as the runtime, which is retiring by ${support.removal}.`, ); } return `nodejs${major}.x`; } if (support.status === 'beta') { logger.warn( - `Your project is being built for Node.js ${major} as the runtime, which is currently in beta for Vercel Serverless Functions.` + `Your project is being built for Node.js ${major} as the runtime, which is currently in beta for Vercel Serverless Functions.`, ); return `nodejs${major}.x`; } if (support.status === 'deprecated') { const removeDate = new Intl.DateTimeFormat(undefined, { dateStyle: 'long' }).format( - support.removal + support.removal, ); logger.warn( `\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` + - `\tConsider upgrading your local version to 18.\n` + `\tConsider upgrading your local version to 18.\n`, ); return `nodejs${major}.x`; } |