0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

fix: logging build trace of pages (#9315)

This commit is contained in:
Emanuele Stoppa 2023-12-05 14:31:51 +00:00 committed by GitHub
parent 2f110a5016
commit 631e5d01b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 12 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Fixes an issue where logs that weren't grouped together by route when building the app.

View file

@ -249,13 +249,11 @@ async function generatePage(
// prepare information we need
const logger = pipeline.getLogger();
const config = pipeline.getConfig();
const manifest = pipeline.getManifest();
const pageModulePromise = ssrEntry.page;
const onRequest = ssrEntry.onRequest;
const pageInfo = getPageDataByComponent(pipeline.getInternals(), pageData.route.component);
// Calculate information of the page, like scripts, links and styles
const hoistedScripts = pageInfo?.hoistedScript ?? null;
const styles = pageData.styles
.sort(cssOrder)
.map(({ sheet }) => sheet)
@ -294,6 +292,15 @@ async function generatePage(
};
// Now we explode the routes. A route render itself, and it can render its fallbacks (i18n routing)
for (const route of eachRouteInRouteData(pageData)) {
const icon =
route.type === 'page' || route.type === 'redirect' || route.type === 'fallback'
? green('▶')
: magenta('λ');
if (isRelativePath(route.component)) {
logger.info(null, `${icon} ${route.route}`);
} else {
logger.info(null, `${icon} ${route.component}`);
}
// Get paths for the route, calling getStaticPaths if needed.
const paths = await getPathsForRoute(route, pageModule, pipeline, builtPaths);
let timeStart = performance.now();
@ -515,16 +522,6 @@ async function generatePath(
}
}
const icon =
route.type === 'page' || route.type === 'redirect' || route.type === 'fallback'
? green('▶')
: magenta('λ');
if (isRelativePath(route.component)) {
logger.info(null, `${icon} ${route.route}`);
} else {
logger.info(null, `${icon} ${route.component}`);
}
// This adds the page name to the array so it can be shown as part of stats.
if (route.type === 'page') {
addPageName(pathname, pipeline.getStaticBuildOptions());