mirror of
https://github.com/withastro/astro.git
synced 2025-01-06 22:10:10 -05:00
[ci] format
This commit is contained in:
parent
9490f0e223
commit
ba1ca7e61f
3 changed files with 24 additions and 12 deletions
|
@ -33,7 +33,7 @@ export function moduleIsTopLevelPage(info: ModuleInfo): boolean {
|
|||
// This could be a .astro page or a .md page.
|
||||
export function* getTopLevelPages(
|
||||
id: string,
|
||||
ctx: { getModuleInfo: GetModuleInfo },
|
||||
ctx: { getModuleInfo: GetModuleInfo }
|
||||
): Generator<[ModuleInfo, number], void, unknown> {
|
||||
for (const res of walkParentInfos(id, ctx)) {
|
||||
if (moduleIsTopLevelPage(res[0])) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { OutputChunk, RenderedChunk, ModuleInfo, GetModuleInfo } from 'rollup';
|
||||
import type { OutputChunk, RenderedChunk } from 'rollup';
|
||||
import type { PageBuildData, ViteID } from './types';
|
||||
|
||||
import { prependForwardSlash } from '../path.js';
|
||||
|
|
|
@ -9,8 +9,14 @@ import npath from 'path';
|
|||
import { Plugin as VitePlugin, ResolvedConfig } from 'vite';
|
||||
import { isCSSRequest } from '../render/util.js';
|
||||
import { relativeToSrcDir } from '../util.js';
|
||||
import { getTopLevelPages, walkParentInfos, moduleIsTopLevelPage } from './graph.js';
|
||||
import { eachPageData, getPageDataByViteID, getPageDatasByClientOnlyID, getPageDatasByHoistedScriptId, isHoistedScript } from './internal.js';
|
||||
import { getTopLevelPages, moduleIsTopLevelPage, walkParentInfos } from './graph.js';
|
||||
import {
|
||||
eachPageData,
|
||||
getPageDataByViteID,
|
||||
getPageDatasByClientOnlyID,
|
||||
getPageDatasByHoistedScriptId,
|
||||
isHoistedScript,
|
||||
} from './internal.js';
|
||||
|
||||
interface PluginOptions {
|
||||
internals: BuildInternals;
|
||||
|
@ -118,7 +124,7 @@ export function rollupPluginAstroBuildCSS(options: PluginOptions): VitePlugin[]
|
|||
pageData?.css.set(importedCssImport, { depth });
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
for (const [_, chunk] of Object.entries(bundle)) {
|
||||
if (chunk.type === 'chunk') {
|
||||
|
@ -150,8 +156,14 @@ export function rollupPluginAstroBuildCSS(options: PluginOptions): VitePlugin[]
|
|||
if (pageData) {
|
||||
appendCSSToPage(pageData, meta, depth);
|
||||
}
|
||||
} else if(options.target === 'client' && isHoistedScript(internals, pageInfo.id)) {
|
||||
for(const pageData of getPageDatasByHoistedScriptId(internals, pageInfo.id)) {
|
||||
} else if (
|
||||
options.target === 'client' &&
|
||||
isHoistedScript(internals, pageInfo.id)
|
||||
) {
|
||||
for (const pageData of getPageDatasByHoistedScriptId(
|
||||
internals,
|
||||
pageInfo.id
|
||||
)) {
|
||||
appendCSSToPage(pageData, meta, -1);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue