Skip to content

Commit

Permalink
[ci] format
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderniebuhr committed Sep 17, 2024
1 parent bf61d7d commit 6e9d891
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 83 deletions.
9 changes: 2 additions & 7 deletions packages/cloudflare/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@
"url": "https://github.com/withastro/adapters.git",
"directory": "packages/cloudflare"
},
"keywords": [
"withastro",
"astro-adapter"
],
"keywords": ["withastro", "astro-adapter"],
"bugs": "https://github.com/withastro/adapters/issues",
"homepage": "https://docs.astro.build/en/guides/integrations-guide/cloudflare/",
"exports": {
Expand All @@ -25,9 +22,7 @@
"./image-endpoint": "./dist/entrypoints/image-endpoint.js",
"./package.json": "./package.json"
},
"files": [
"dist"
],
"files": ["dist"],
"scripts": {
"build": "tsc",
"test": "astro-scripts test \"test/**/*.test.js\""
Expand Down
9 changes: 2 additions & 7 deletions packages/netlify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@
"url": "https://github.com/withastro/adapters.git",
"directory": "packages/netlify"
},
"keywords": [
"withastro",
"astro-adapter"
],
"keywords": ["withastro", "astro-adapter"],
"bugs": "https://github.com/withastro/adapters/issues",
"homepage": "https://docs.astro.build/en/guides/integrations-guide/netlify/",
"exports": {
Expand All @@ -25,9 +22,7 @@
"./image-service.js": "./dist/image-service.js",
"./package.json": "./package.json"
},
"files": [
"dist"
],
"files": ["dist"],
"scripts": {
"build": "tsc",
"test-fn": "astro-scripts test \"test/functions/*.test.js\"",
Expand Down
9 changes: 2 additions & 7 deletions packages/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@
"url": "https://github.com/withastro/adapters.git",
"directory": "packages/node"
},
"keywords": [
"withastro",
"astro-adapter"
],
"keywords": ["withastro", "astro-adapter"],
"bugs": "https://github.com/withastro/adapters/issues",
"homepage": "https://docs.astro.build/en/guides/integrations-guide/node/",
"exports": {
Expand All @@ -23,9 +20,7 @@
"./preview.js": "./dist/preview.js",
"./package.json": "./package.json"
},
"files": [
"dist"
],
"files": ["dist"],
"scripts": {
"build": "tsc",
"test": "astro-scripts test \"test/**/*.test.js\""
Expand Down
18 changes: 4 additions & 14 deletions packages/vercel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
"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": {
Expand All @@ -30,18 +27,11 @@
},
"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\"",
Expand Down
26 changes: 13 additions & 13 deletions packages/vercel/src/lib/redirects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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('/');
}
Expand Down
70 changes: 35 additions & 35 deletions packages/vercel/src/serverless/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,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',
Expand Down Expand Up @@ -384,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),
}
: {}),
});

Expand All @@ -431,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;
Expand Down Expand Up @@ -512,11 +512,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';
}
Expand Down Expand Up @@ -545,10 +545,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`;
}
Expand Down

0 comments on commit 6e9d891

Please sign in to comment.