[ci] format
This commit is contained in:
parent
1687009f31
commit
0f071a9723
3 changed files with 8 additions and 10 deletions
|
@ -102,12 +102,12 @@ export function trackClientOnlyPageDatas(
|
||||||
internals: BuildInternals,
|
internals: BuildInternals,
|
||||||
pageData: PageBuildData,
|
pageData: PageBuildData,
|
||||||
clientOnlys: string[],
|
clientOnlys: string[],
|
||||||
astroConfig: AstroConfig,
|
astroConfig: AstroConfig
|
||||||
) {
|
) {
|
||||||
for(const clientOnlyComponent of clientOnlys) {
|
for (const clientOnlyComponent of clientOnlys) {
|
||||||
const coPath = viteID(new URL('.' + clientOnlyComponent, astroConfig.root));
|
const coPath = viteID(new URL('.' + clientOnlyComponent, astroConfig.root));
|
||||||
let pageDataSet: Set<PageBuildData>;
|
let pageDataSet: Set<PageBuildData>;
|
||||||
if(internals.pagesByClientOnly.has(coPath)) {
|
if (internals.pagesByClientOnly.has(coPath)) {
|
||||||
pageDataSet = internals.pagesByClientOnly.get(coPath)!;
|
pageDataSet = internals.pagesByClientOnly.get(coPath)!;
|
||||||
} else {
|
} else {
|
||||||
pageDataSet = new Set<PageBuildData>();
|
pageDataSet = new Set<PageBuildData>();
|
||||||
|
@ -117,8 +117,6 @@ export function trackClientOnlyPageDatas(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export function* getPageDatasByChunk(
|
export function* getPageDatasByChunk(
|
||||||
internals: BuildInternals,
|
internals: BuildInternals,
|
||||||
chunk: RenderedChunk
|
chunk: RenderedChunk
|
||||||
|
@ -136,10 +134,10 @@ export function* getPageDatasByClientOnlyChunk(
|
||||||
chunk: RenderedChunk
|
chunk: RenderedChunk
|
||||||
): Generator<PageBuildData, void, unknown> {
|
): Generator<PageBuildData, void, unknown> {
|
||||||
const pagesByClientOnly = internals.pagesByClientOnly;
|
const pagesByClientOnly = internals.pagesByClientOnly;
|
||||||
if(pagesByClientOnly.size) {
|
if (pagesByClientOnly.size) {
|
||||||
for (const [modulePath] of Object.entries(chunk.modules)) {
|
for (const [modulePath] of Object.entries(chunk.modules)) {
|
||||||
if (pagesByClientOnly.has(modulePath)) {
|
if (pagesByClientOnly.has(modulePath)) {
|
||||||
for(const pageData of pagesByClientOnly.get(modulePath)!) {
|
for (const pageData of pagesByClientOnly.get(modulePath)!) {
|
||||||
yield pageData;
|
yield pageData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,7 +152,7 @@ async function ssrBuild(opts: StaticBuildOptions, internals: BuildInternals, inp
|
||||||
rollupPluginAstroBuildCSS({
|
rollupPluginAstroBuildCSS({
|
||||||
internals,
|
internals,
|
||||||
legacy: false,
|
legacy: false,
|
||||||
target: 'server'
|
target: 'server',
|
||||||
}),
|
}),
|
||||||
...(viteConfig.plugins || []),
|
...(viteConfig.plugins || []),
|
||||||
// SSR needs to be last
|
// SSR needs to be last
|
||||||
|
@ -223,7 +223,7 @@ async function clientBuild(
|
||||||
rollupPluginAstroBuildCSS({
|
rollupPluginAstroBuildCSS({
|
||||||
internals,
|
internals,
|
||||||
legacy: false,
|
legacy: false,
|
||||||
target: 'client'
|
target: 'client',
|
||||||
}),
|
}),
|
||||||
...(viteConfig.plugins || []),
|
...(viteConfig.plugins || []),
|
||||||
],
|
],
|
||||||
|
|
|
@ -29,5 +29,5 @@ describe('Client only components', () => {
|
||||||
const html = await fixture.readFile('/index.html');
|
const html = await fixture.readFile('/index.html');
|
||||||
const $ = cheerioLoad(html);
|
const $ = cheerioLoad(html);
|
||||||
expect($('link[rel=stylesheet]')).to.have.lengthOf(2);
|
expect($('link[rel=stylesheet]')).to.have.lengthOf(2);
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue