0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-02-03 22:29:08 -05:00

fix: concat & array.from

This commit is contained in:
Goulven Clec'h 2024-04-29 14:55:54 +02:00
parent 7490882f5e
commit c84d72c3eb
3 changed files with 4 additions and 6 deletions

View file

@ -242,7 +242,7 @@ export function getPagesDatasByComponent(
component: string
): PageBuildData[] {
const pageDatas: PageBuildData[] = [];
Array.from(internals.pagesByKeys.values()).forEach((pageData) => {
internals.pagesByKeys.forEach((pageData) => {
if (component === pageData.component) pageDatas.push(pageData);
})
return pageDatas;

View file

@ -171,7 +171,6 @@ export class BuildPipeline extends Pipeline {
/**
* It collects the routes to generate during the build.
*
* It returns a map of page information and their relative entry point as a string.
*/
retrieveRoutesToGenerate(): Map<PageBuildData, string> {
@ -187,14 +186,14 @@ export class BuildPipeline extends Pipeline {
) {
let pageDatas: PageBuildData[] = [];
if (virtualModulePageName.includes(ASTRO_PAGE_RESOLVED_MODULE_ID)) {
pageDatas.concat(getPagesFromVirtualModulePageName(
pageDatas.push(...getPagesFromVirtualModulePageName(
this.internals,
ASTRO_PAGE_RESOLVED_MODULE_ID,
virtualModulePageName
));
}
if (virtualModulePageName.includes(RESOLVED_SPLIT_MODULE_ID)) {
pageDatas.concat(getPagesFromVirtualModulePageName(
pageDatas.push(...getPagesFromVirtualModulePageName(
this.internals,
RESOLVED_SPLIT_MODULE_ID,
virtualModulePageName

View file

@ -249,10 +249,9 @@ function rollupPluginAstroBuildCSS(options: PluginOptions): VitePlugin[] {
? { type: 'inline', content: stylesheet.source }
: { type: 'external', src: stylesheet.fileName };
const pages = Array.from(internals.pagesByKeys.values());
let sheetAddedToPage = false;
pages.forEach((pageData) => {
internals.pagesByKeys.forEach((pageData) => {
const orderingInfo = pagesToCss[pageData.moduleSpecifier]?.[stylesheet.fileName];
if (orderingInfo !== undefined) {
pageData.styles.push({ ...orderingInfo, sheet });