From 591153f457664bd3f654d0c9a4362b85e4061c4d Mon Sep 17 00:00:00 2001 From: matthewp Date: Fri, 11 Nov 2022 19:36:40 +0000 Subject: [PATCH] [ci] format --- packages/astro/src/core/build/generate.ts | 6 ++++-- .../src/core/build/vite-plugin-hoisted-scripts.ts | 5 ++++- packages/astro/src/core/build/vite-plugin-ssr.ts | 9 +++++---- packages/astro/src/core/config/schema.ts | 14 +++++++------- packages/astro/test/asset-url-base.test.js | 12 ++++++------ packages/astro/test/astro-scripts.test.js | 8 ++++---- packages/astro/test/ssr-request.test.js | 6 +++--- 7 files changed, 33 insertions(+), 27 deletions(-) diff --git a/packages/astro/src/core/build/generate.ts b/packages/astro/src/core/build/generate.ts index a1e6e6489..a92006fe1 100644 --- a/packages/astro/src/core/build/generate.ts +++ b/packages/astro/src/core/build/generate.ts @@ -14,7 +14,6 @@ import type { } from '../../@types/astro'; import type { BuildInternals } from '../../core/build/internal.js'; import { - joinPaths, prependForwardSlash, removeLeadingForwardSlash, removeTrailingForwardSlash, @@ -292,7 +291,10 @@ async function generatePath( debug('build', `Generating: ${pathname}`); const links = createLinkStylesheetElementSet(linkIds, settings.config.base); - const scripts = createModuleScriptsSet(hoistedScripts ? [hoistedScripts] : [], settings.config.base); + const scripts = createModuleScriptsSet( + hoistedScripts ? [hoistedScripts] : [], + settings.config.base + ); if (settings.scripts.some((script) => script.stage === 'page')) { const hashedFilePath = internals.entrySpecifierToBundleMap.get(PAGE_SCRIPT_ID); diff --git a/packages/astro/src/core/build/vite-plugin-hoisted-scripts.ts b/packages/astro/src/core/build/vite-plugin-hoisted-scripts.ts index 7a90f00bb..65d38ec87 100644 --- a/packages/astro/src/core/build/vite-plugin-hoisted-scripts.ts +++ b/packages/astro/src/core/build/vite-plugin-hoisted-scripts.ts @@ -41,7 +41,10 @@ export function vitePluginHoistedScripts( async generateBundle(_options, bundle) { let assetInlineLimit = 4096; - if(settings.config.vite?.build && settings.config.vite.build.assetsInlineLimit !== undefined) { + if ( + settings.config.vite?.build && + settings.config.vite.build.assetsInlineLimit !== undefined + ) { assetInlineLimit = settings.config.vite?.build.assetsInlineLimit; } diff --git a/packages/astro/src/core/build/vite-plugin-ssr.ts b/packages/astro/src/core/build/vite-plugin-ssr.ts index 8cbc0a1b6..03dc20699 100644 --- a/packages/astro/src/core/build/vite-plugin-ssr.ts +++ b/packages/astro/src/core/build/vite-plugin-ssr.ts @@ -139,15 +139,16 @@ function buildManifest( for (const pageData of eachPageData(internals)) { const scripts: SerializedRouteInfo['scripts'] = []; if (pageData.hoistedScript) { - scripts.unshift(Object.assign({}, pageData.hoistedScript, { - value: joinBase(pageData.hoistedScript.value) - })); + scripts.unshift( + Object.assign({}, pageData.hoistedScript, { + value: joinBase(pageData.hoistedScript.value), + }) + ); } if (settings.scripts.some((script) => script.stage === 'page')) { scripts.push({ type: 'external', value: entryModules[PAGE_SCRIPT_ID] }); } - const links = sortedCSS(pageData).map((pth) => joinBase(pth)); routes.push({ diff --git a/packages/astro/src/core/config/schema.ts b/packages/astro/src/core/config/schema.ts index 30b9f65dd..c2011926c 100644 --- a/packages/astro/src/core/config/schema.ts +++ b/packages/astro/src/core/config/schema.ts @@ -326,19 +326,19 @@ export function createRelativeSchema(cmd: string, fileProtocolRoot: URL) { // If there is no base but there is a base for site config, warn. const sitePathname = config.site && new URL(config.site).pathname; - if(!trimmedBase.length && sitePathname && sitePathname !== '/') { + if (!trimmedBase.length && sitePathname && sitePathname !== '/') { config.base = sitePathname; /* eslint-disable no-console */ console.warn(`The site configuration value includes a pathname of ${sitePathname} but there is no base configuration. -A future version of Astro will stop using the site pathname when producing and