From 2c655a57f60eed00dec9df7efcf9ae18870ee88d Mon Sep 17 00:00:00 2001 From: matthewp Date: Wed, 3 May 2023 18:51:25 +0000 Subject: [PATCH] [ci] format --- packages/astro/src/@types/astro.ts | 2 +- packages/astro/src/core/app/index.ts | 2 +- packages/astro/src/core/build/generate.ts | 9 ++------- packages/astro/src/core/build/internal.ts | 2 +- .../astro/src/core/build/plugins/plugin-css.ts | 14 +++++++------- .../astro/src/core/build/plugins/plugin-ssr.ts | 6 +----- packages/astro/src/core/render/ssr-element.ts | 2 +- 7 files changed, 14 insertions(+), 23 deletions(-) diff --git a/packages/astro/src/@types/astro.ts b/packages/astro/src/@types/astro.ts index f45893821..cb66fc2ce 100644 --- a/packages/astro/src/@types/astro.ts +++ b/packages/astro/src/@types/astro.ts @@ -1055,7 +1055,7 @@ export interface AstroUserConfig { * } */ inlineStylesheets?: 'always' | 'auto' | 'never'; - + /** * @docs * @name experimental.middleware diff --git a/packages/astro/src/core/app/index.ts b/packages/astro/src/core/app/index.ts index 13fcc8d45..b657e4943 100644 --- a/packages/astro/src/core/app/index.ts +++ b/packages/astro/src/core/app/index.ts @@ -24,8 +24,8 @@ import { import { RouteCache } from '../render/route-cache.js'; import { createAssetLink, - createStylesheetElementSet, createModuleScriptElement, + createStylesheetElementSet, } from '../render/ssr-element.js'; import { matchRoute } from '../routing/match.js'; export { deserializeManifest } from './common.js'; diff --git a/packages/astro/src/core/build/generate.ts b/packages/astro/src/core/build/generate.ts index d00cef268..7d1f85211 100644 --- a/packages/astro/src/core/build/generate.ts +++ b/packages/astro/src/core/build/generate.ts @@ -40,19 +40,14 @@ import { createEnvironment, createRenderContext, renderPage } from '../render/in import { callGetStaticPaths } from '../render/route-cache.js'; import { createAssetLink, - createStylesheetElementSet, createModuleScriptsSet, + createStylesheetElementSet, } from '../render/ssr-element.js'; import { createRequest } from '../request.js'; import { matchRoute } from '../routing/match.js'; import { getOutputFilename } from '../util.js'; import { getOutDirWithinCwd, getOutFile, getOutFolder } from './common.js'; -import { - eachPageData, - getPageDataByComponent, - cssOrder, - mergeInlineCss, -} from './internal.js'; +import { cssOrder, eachPageData, getPageDataByComponent, mergeInlineCss } from './internal.js'; import type { PageBuildData, SingleFileBuiltModule, diff --git a/packages/astro/src/core/build/internal.ts b/packages/astro/src/core/build/internal.ts index eff3f5bec..1d69849c9 100644 --- a/packages/astro/src/core/build/internal.ts +++ b/packages/astro/src/core/build/internal.ts @@ -272,7 +272,7 @@ export function mergeInlineCss( acc[acc.length - 1] = merged; return acc; } - acc.push(current) + acc.push(current); return acc; } diff --git a/packages/astro/src/core/build/plugins/plugin-css.ts b/packages/astro/src/core/build/plugins/plugin-css.ts index c6a48c091..a5bdb70f1 100644 --- a/packages/astro/src/core/build/plugins/plugin-css.ts +++ b/packages/astro/src/core/build/plugins/plugin-css.ts @@ -58,8 +58,8 @@ function rollupPluginAstroBuildCSS(options: PluginOptions): VitePlugin[] { let resolvedConfig: ResolvedConfig; // stylesheet filenames are kept in here until "post", when they are rendered and ready to be inlined - const pagesToCss: Record> = {} - const pagesToPropagatedCss: Record>> = {} + const pagesToCss: Record> = {}; + const pagesToPropagatedCss: Record>> = {}; const cssBuildPlugin: VitePlugin = { name: 'astro:rollup-plugin-build-css', @@ -129,7 +129,7 @@ function rollupPluginAstroBuildCSS(options: PluginOptions): VitePlugin[] { for (const id of Object.keys(chunk.modules)) { for (const pageData of getParentClientOnlys(id, this, internals)) { for (const importedCssImport of meta.importedCss) { - const cssToInfoRecord = pagesToCss[pageData.moduleSpecifier] ??= {} + const cssToInfoRecord = (pagesToCss[pageData.moduleSpecifier] ??= {}); cssToInfoRecord[importedCssImport] = { depth: -1, order: -1 }; } } @@ -155,8 +155,8 @@ function rollupPluginAstroBuildCSS(options: PluginOptions): VitePlugin[] { if (pageData === undefined) continue; for (const css of meta.importedCss) { - const propagatedStyles = pagesToPropagatedCss[pageData.moduleSpecifier] ??= {} - const existingCss = propagatedStyles[pageInfo.id] ??= new Set(); + const propagatedStyles = (pagesToPropagatedCss[pageData.moduleSpecifier] ??= {}); + const existingCss = (propagatedStyles[pageInfo.id] ??= new Set()); existingCss.add(css); } @@ -194,7 +194,7 @@ function rollupPluginAstroBuildCSS(options: PluginOptions): VitePlugin[] { ); if (cssChunk === undefined) return; for (const pageData of eachPageData(internals)) { - const cssToInfoMap = pagesToCss[pageData.moduleSpecifier] ??= {}; + const cssToInfoMap = (pagesToCss[pageData.moduleSpecifier] ??= {}); cssToInfoMap[cssChunk.fileName] = { depth: -1, order: -1 }; } }, @@ -312,7 +312,7 @@ function appendCSSToPage( cssInfo.order = order; } } else { - const cssToInfoRecord = pagesToCss[pageData.moduleSpecifier] ??= {}; + const cssToInfoRecord = (pagesToCss[pageData.moduleSpecifier] ??= {}); cssToInfoRecord[importedCssImport] = { depth, order }; } } diff --git a/packages/astro/src/core/build/plugins/plugin-ssr.ts b/packages/astro/src/core/build/plugins/plugin-ssr.ts index 9b0a7e848..8259e5e15 100644 --- a/packages/astro/src/core/build/plugins/plugin-ssr.ts +++ b/packages/astro/src/core/build/plugins/plugin-ssr.ts @@ -13,11 +13,7 @@ import { joinPaths, prependForwardSlash } from '../../path.js'; import { serializeRouteData } from '../../routing/index.js'; import { addRollupInput } from '../add-rollup-input.js'; import { getOutFile, getOutFolder } from '../common.js'; -import { - eachPageData, - cssOrder, - mergeInlineCss, -} from '../internal.js'; +import { cssOrder, eachPageData, mergeInlineCss } from '../internal.js'; import type { AstroBuildPlugin } from '../plugin'; export const virtualModuleId = '@astrojs-ssr-virtual-entry'; diff --git a/packages/astro/src/core/render/ssr-element.ts b/packages/astro/src/core/render/ssr-element.ts index 5b8b3e21d..84b0ab531 100644 --- a/packages/astro/src/core/render/ssr-element.ts +++ b/packages/astro/src/core/render/ssr-element.ts @@ -1,7 +1,7 @@ import slashify from 'slash'; import type { SSRElement } from '../../@types/astro'; -import type { StylesheetAsset } from '../app/types'; import { joinPaths, prependForwardSlash } from '../../core/path.js'; +import type { StylesheetAsset } from '../app/types'; export function createAssetLink(href: string, base?: string, assetsPrefix?: string): string { if (assetsPrefix) {