From 8903edee88819501026994ab078ef5072dcd7b5d Mon Sep 17 00:00:00 2001 From: matthewp Date: Mon, 12 Sep 2022 20:37:25 +0000 Subject: [PATCH] [ci] format --- packages/astro/src/core/build/graph.ts | 2 +- packages/astro/src/core/build/internal.ts | 8 ++++---- packages/astro/src/core/build/types.ts | 2 +- .../astro/src/core/build/vite-plugin-css.ts | 17 +++++++++++------ packages/astro/test/css-order.test.js | 6 +++--- 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/packages/astro/src/core/build/graph.ts b/packages/astro/src/core/build/graph.ts index e55361d75..819d76589 100644 --- a/packages/astro/src/core/build/graph.ts +++ b/packages/astro/src/core/build/graph.ts @@ -8,7 +8,7 @@ export function* walkParentInfos( ctx: { getModuleInfo: GetModuleInfo }, depth = 0, seen = new Set(), - childId = '', + childId = '' ): Generator<[ModuleInfo, number, number], void, unknown> { seen.add(id); const info = ctx.getModuleInfo(id); diff --git a/packages/astro/src/core/build/internal.ts b/packages/astro/src/core/build/internal.ts index ae1c48361..6d3cc9f36 100644 --- a/packages/astro/src/core/build/internal.ts +++ b/packages/astro/src/core/build/internal.ts @@ -195,13 +195,13 @@ export function sortedCSS(pageData: PageBuildData) { orderA = a[1].order, orderB = b[1].order; - if(orderA === -1 && orderB >= 0) { + if (orderA === -1 && orderB >= 0) { return 1; - } else if(orderB === -1 && orderA >= 0) { + } else if (orderB === -1 && orderA >= 0) { return -1; - } else if(orderA > orderB) { + } else if (orderA > orderB) { return 1; - } else if(orderA < orderB) { + } else if (orderA < orderB) { return -1; } else { if (depthA === -1) { diff --git a/packages/astro/src/core/build/types.ts b/packages/astro/src/core/build/types.ts index 42a4b0716..480af85d0 100644 --- a/packages/astro/src/core/build/types.ts +++ b/packages/astro/src/core/build/types.ts @@ -18,7 +18,7 @@ export interface PageBuildData { component: ComponentPath; route: RouteData; moduleSpecifier: string; - css: Map; + css: Map; hoistedScript: { type: 'inline' | 'external'; value: string } | undefined; } export type AllPagesData = Record; diff --git a/packages/astro/src/core/build/vite-plugin-css.ts b/packages/astro/src/core/build/vite-plugin-css.ts index 202bd5319..4d77f6f15 100644 --- a/packages/astro/src/core/build/vite-plugin-css.ts +++ b/packages/astro/src/core/build/vite-plugin-css.ts @@ -110,7 +110,12 @@ export function rollupPluginAstroBuildCSS(options: PluginOptions): VitePlugin[] importedCss: Set; }; - const appendCSSToPage = (pageData: PageBuildData, meta: ViteMetadata, depth: number, order: number) => { + const appendCSSToPage = ( + pageData: PageBuildData, + meta: ViteMetadata, + depth: number, + order: number + ) => { for (const importedCssImport of meta.importedCss) { // CSS is prioritized based on depth. Shared CSS has a higher depth due to being imported by multiple pages. // Depth info is used when sorting the links on the page. @@ -122,11 +127,11 @@ export function rollupPluginAstroBuildCSS(options: PluginOptions): VitePlugin[] } // Update the order, preferring the lowest order we have. - if(cssInfo.order === -1) { - cssInfo.order = order; - } else if(order < cssInfo.order && order > -1) { - cssInfo.order = order; - } + if (cssInfo.order === -1) { + cssInfo.order = order; + } else if (order < cssInfo.order && order > -1) { + cssInfo.order = order; + } } else { pageData?.css.set(importedCssImport, { depth, order }); } diff --git a/packages/astro/test/css-order.test.js b/packages/astro/test/css-order.test.js index 944452e93..fbcd580dd 100644 --- a/packages/astro/test/css-order.test.js +++ b/packages/astro/test/css-order.test.js @@ -87,7 +87,7 @@ describe('CSS production ordering', () => { ); expect(content).to.have.a.lengthOf(3, 'there are 3 stylesheets'); - const [,found] = content; + const [, found] = content; expect(found.css).to.match(/#00f/); }); @@ -97,11 +97,11 @@ describe('CSS production ordering', () => { let twoHtml = await fixture.readFile('/two/index.html'); let threeHtml = await fixture.readFile('/three/index.html'); - for(const html of [oneHtml, twoHtml, threeHtml]) { + for (const html of [oneHtml, twoHtml, threeHtml]) { const content = await Promise.all( getLinks(html).map((href) => getLinkContent(fixture, href)) ); - + const [first] = content; expect(first.css).to.include('green', 'Came from the injected script'); }