From 10d97b60b89540aca32efe315734391152dd059b Mon Sep 17 00:00:00 2001 From: FredKSchott Date: Thu, 3 Feb 2022 05:40:29 +0000 Subject: [PATCH] [ci] yarn format --- packages/astro/src/core/ssr/sitemap.ts | 43 +++++++++++++++++- .../astro/src/vite-plugin-build-html/index.ts | 45 ++++++++++++++++++- 2 files changed, 85 insertions(+), 3 deletions(-) diff --git a/packages/astro/src/core/ssr/sitemap.ts b/packages/astro/src/core/ssr/sitemap.ts index d641113f82..c4f85b556b 100644 --- a/packages/astro/src/core/ssr/sitemap.ts +++ b/packages/astro/src/core/ssr/sitemap.ts @@ -1,4 +1,45 @@ -const ERROR_STATUS_CODE_REGEXES = [ /400\/?$/,/401\/?$/,/402\/?$/,/403\/?$/,/404\/?$/,/405\/?$/,/406\/?$/,/407\/?$/,/408\/?$/,/409\/?$/,/410\/?$/,/411\/?$/,/412\/?$/,/413\/?$/,/414\/?$/,/415\/?$/,/416\/?$/,/417\/?$/,/418\/?$/,/421\/?$/,/422\/?$/,/423\/?$/,/424\/?$/,/425\/?$/,/426\/?$/,/428\/?$/,/429\/?$/,/431\/?$/,/451\/?$/,/500\/?$/,/501\/?$/,/502\/?$/,/503\/?$/,/504\/?$/,/505\/?$/,/506\/?$/,/507\/?$/,/508\/?$/,/510\/?$/,/511\/?$/ ]; +const ERROR_STATUS_CODE_REGEXES = [ + /400\/?$/, + /401\/?$/, + /402\/?$/, + /403\/?$/, + /404\/?$/, + /405\/?$/, + /406\/?$/, + /407\/?$/, + /408\/?$/, + /409\/?$/, + /410\/?$/, + /411\/?$/, + /412\/?$/, + /413\/?$/, + /414\/?$/, + /415\/?$/, + /416\/?$/, + /417\/?$/, + /418\/?$/, + /421\/?$/, + /422\/?$/, + /423\/?$/, + /424\/?$/, + /425\/?$/, + /426\/?$/, + /428\/?$/, + /429\/?$/, + /431\/?$/, + /451\/?$/, + /500\/?$/, + /501\/?$/, + /502\/?$/, + /503\/?$/, + /504\/?$/, + /505\/?$/, + /506\/?$/, + /507\/?$/, + /508\/?$/, + /510\/?$/, + /511\/?$/, +]; /** Construct sitemap.xml given a set of URLs */ export function generateSitemap(pages: string[]): string { diff --git a/packages/astro/src/vite-plugin-build-html/index.ts b/packages/astro/src/vite-plugin-build-html/index.ts index 8c40166587..33b4ab70f0 100644 --- a/packages/astro/src/vite-plugin-build-html/index.ts +++ b/packages/astro/src/vite-plugin-build-html/index.ts @@ -25,7 +25,48 @@ const ASTRO_PAGE_PREFIX = '@astro-page'; const ASTRO_SCRIPT_PREFIX = '@astro-script'; const ASTRO_EMPTY = '@astro-empty'; -const ERROR_STATUS_CODES = [ '400', '401', '402', '403', '404', '405', '406', '407', '408', '409', '410', '411', '412', '413', '414', '415', '416', '417', '418', '421', '422', '423', '424', '425', '426', '428', '429', '431', '451', '500', '501', '502', '503', '504', '505', '506', '507', '508', '510', '511' ]; +const ERROR_STATUS_CODES = [ + '400', + '401', + '402', + '403', + '404', + '405', + '406', + '407', + '408', + '409', + '410', + '411', + '412', + '413', + '414', + '415', + '416', + '417', + '418', + '421', + '422', + '423', + '424', + '425', + '426', + '428', + '429', + '431', + '451', + '500', + '501', + '502', + '503', + '504', + '505', + '506', + '507', + '508', + '510', + '511', +]; interface PluginOptions { astroConfig: AstroConfig; @@ -483,7 +524,7 @@ export function rollupPluginAstroBuildHTML(options: PluginOptions): VitePlugin { // Output directly to 404.html rather than 404/index.html // Supports any other status codes, too - if (ERROR_STATUS_CODES.find(code => code === name) || astroConfig.buildOptions.pageUrlFormat === 'file') { + if (ERROR_STATUS_CODES.find((code) => code === name) || astroConfig.buildOptions.pageUrlFormat === 'file') { outPath = `${removeEndingForwardSlash(name || 'index')}.html`; } else { outPath = npath.posix.join(name, 'index.html');