mnfst-render 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/manifest.render.mjs +14 -2
- package/package.json +1 -1
package/manifest.render.mjs
CHANGED
|
@@ -1218,6 +1218,7 @@ async function runPrerender(config) {
|
|
|
1218
1218
|
const timeout = config.wait ?? 15000;
|
|
1219
1219
|
const concurrency = config.concurrency;
|
|
1220
1220
|
const pathTotal = pathList.length;
|
|
1221
|
+
const failedPaths = [];
|
|
1221
1222
|
process.stdout.write(`Prerendering ${pathTotal} path(s)...\n`);
|
|
1222
1223
|
|
|
1223
1224
|
async function processPath(pathSeg, pathIndex) {
|
|
@@ -1331,7 +1332,7 @@ async function runPrerender(config) {
|
|
|
1331
1332
|
// no-op
|
|
1332
1333
|
}
|
|
1333
1334
|
}, { allLocales: locales, currentLocale }).catch(() => { });
|
|
1334
|
-
await
|
|
1335
|
+
await new Promise((resolve) => setTimeout(resolve, 60));
|
|
1335
1336
|
|
|
1336
1337
|
// Optional extra delay so in-page async (e.g. fetch() in x-init for client logos) can complete before snapshot.
|
|
1337
1338
|
if (config.waitAfterIdle > 0) {
|
|
@@ -1501,7 +1502,13 @@ async function runPrerender(config) {
|
|
|
1501
1502
|
mkdirSync(outDir, { recursive: true });
|
|
1502
1503
|
writeFileSync(outFile, html, 'utf8');
|
|
1503
1504
|
} catch (err) {
|
|
1504
|
-
|
|
1505
|
+
failedPaths.push({
|
|
1506
|
+
path: displayPath,
|
|
1507
|
+
message: err && err.message ? err.message : String(err)
|
|
1508
|
+
});
|
|
1509
|
+
if (failedPaths.length <= 10) {
|
|
1510
|
+
process.stderr.write(`prerender: failed ${displayPath}: ${failedPaths[failedPaths.length - 1].message}\n`);
|
|
1511
|
+
}
|
|
1505
1512
|
} finally {
|
|
1506
1513
|
await page.close();
|
|
1507
1514
|
}
|
|
@@ -1523,6 +1530,11 @@ async function runPrerender(config) {
|
|
|
1523
1530
|
await browser.close();
|
|
1524
1531
|
}
|
|
1525
1532
|
|
|
1533
|
+
if (failedPaths.length > 0) {
|
|
1534
|
+
const sample = failedPaths.slice(0, 5).map((f) => `${f.path}: ${f.message}`).join(' | ');
|
|
1535
|
+
throw new Error(`prerender failed for ${failedPaths.length}/${pathTotal} paths. Sample: ${sample}`);
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1526
1538
|
if (bundleUtilities) {
|
|
1527
1539
|
const utilMerged = mergeUtilityCssBlocks(utilityBlocks);
|
|
1528
1540
|
if (utilMerged.trim()) {
|