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:
parent
2f110a5016
commit
631e5d01b0
2 changed files with 14 additions and 12 deletions
5
.changeset/angry-cows-hug.md
Normal file
5
.changeset/angry-cows-hug.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'astro': patch
|
||||
---
|
||||
|
||||
Fixes an issue where logs that weren't grouped together by route when building the app.
|
|
@ -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());
|
||||
|
|
Loading…
Reference in a new issue