mirror of
https://github.com/withastro/astro.git
synced 2025-03-10 23:01:26 -05:00
chore: format
This commit is contained in:
parent
a73afb7f43
commit
a9436546c2
4 changed files with 76 additions and 76 deletions
|
@ -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('/');
|
||||
}
|
||||
|
|
|
@ -246,10 +246,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',
|
||||
|
@ -290,18 +290,18 @@ export default function vercelServerless({
|
|||
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`
|
||||
`\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`
|
||||
// biome-ignore lint/style/noUnusedTemplateLiteral: <explanation>
|
||||
`\t\`functionPerRoute\` is deprecated and will be removed in a future version of the adapter.\n`
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -426,31 +426,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),
|
||||
}
|
||||
: {}),
|
||||
});
|
||||
|
||||
|
@ -483,7 +483,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;
|
||||
|
@ -563,11 +563,11 @@ function getRuntime(process: NodeJS.Process, logger: AstroIntegrationLogger): Ru
|
|||
// biome-ignore lint/style/noUnusedTemplateLiteral: <explanation>
|
||||
// biome-ignore lint/style/useTemplate: <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';
|
||||
}
|
||||
|
@ -596,10 +596,10 @@ function getRuntime(process: NodeJS.Process, logger: AstroIntegrationLogger): Ru
|
|||
// biome-ignore lint/style/noUnusedTemplateLiteral: <explanation>
|
||||
// biome-ignore lint/style/useTemplate: <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`;
|
||||
}
|
||||
|
|
|
@ -11,8 +11,8 @@ const getConnectionSpeed = () => {
|
|||
navigator['connection'] &&
|
||||
// biome-ignore lint/complexity/useLiteralKeys: <explanation>
|
||||
'effectiveType' in (navigator['connection'] as unknown as { effectiveType: string })
|
||||
// biome-ignore lint/complexity/useLiteralKeys: <explanation>
|
||||
? (navigator['connection'] as unknown as { effectiveType: string })['effectiveType']
|
||||
? // biome-ignore lint/complexity/useLiteralKeys: <explanation>
|
||||
(navigator['connection'] as unknown as { effectiveType: string })['effectiveType']
|
||||
: '';
|
||||
};
|
||||
|
||||
|
|
|
@ -128,29 +128,29 @@ export default function vercelStatic({
|
|||
{ handle: 'filesystem' },
|
||||
...(routes.find((route) => route.pathname === '/404')
|
||||
? [
|
||||
{
|
||||
// biome-ignore lint/style/noUnusedTemplateLiteral: <explanation>
|
||||
src: `/.*`,
|
||||
// biome-ignore lint/style/noUnusedTemplateLiteral: <explanation>
|
||||
dest: `/404.html`,
|
||||
status: 404,
|
||||
},
|
||||
]
|
||||
{
|
||||
// biome-ignore lint/style/noUnusedTemplateLiteral: <explanation>
|
||||
src: `/.*`,
|
||||
// biome-ignore lint/style/noUnusedTemplateLiteral: <explanation>
|
||||
dest: `/404.html`,
|
||||
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),
|
||||
}
|
||||
: {}),
|
||||
});
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue