[ci] format
This commit is contained in:
parent
80e3d4d3d0
commit
2c655a57f6
7 changed files with 14 additions and 23 deletions
|
@ -1055,7 +1055,7 @@ export interface AstroUserConfig {
|
|||
* }
|
||||
*/
|
||||
inlineStylesheets?: 'always' | 'auto' | 'never';
|
||||
|
||||
|
||||
/**
|
||||
* @docs
|
||||
* @name experimental.middleware
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -272,7 +272,7 @@ export function mergeInlineCss(
|
|||
acc[acc.length - 1] = merged;
|
||||
return acc;
|
||||
}
|
||||
acc.push(current)
|
||||
acc.push(current);
|
||||
return acc;
|
||||
}
|
||||
|
||||
|
|
|
@ -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<string, Record<string, { order: number; depth: number }>> = {}
|
||||
const pagesToPropagatedCss: Record<string, Record<string, Set<string>>> = {}
|
||||
const pagesToCss: Record<string, Record<string, { order: number; depth: number }>> = {};
|
||||
const pagesToPropagatedCss: Record<string, Record<string, Set<string>>> = {};
|
||||
|
||||
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 };
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue