mnfst-render 0.5.17 → 0.5.19

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.
Files changed (2) hide show
  1. package/manifest.render.mjs +29 -10
  2. package/package.json +1 -1
@@ -363,7 +363,7 @@ function parseYamlPaths(filePath) {
363
363
  let currentGroup = '';
364
364
  const lines = text.split(/\r?\n/);
365
365
  for (const line of lines) {
366
- const groupMatch = line.match(/^group:\s*["']?([^"'\n]+)["']?/);
366
+ const groupMatch = line.match(/^\s*-?\s*group:\s*["']?([^"'\n]+)["']?/);
367
367
  if (groupMatch) {
368
368
  currentGroup = groupMatch[1].trim().toLowerCase().replace(/\s+/g, '-');
369
369
  continue;
@@ -372,12 +372,15 @@ function parseYamlPaths(filePath) {
372
372
  if (pathMatch && currentGroup) {
373
373
  const segment = pathMatch[1].trim();
374
374
  paths.push(`${currentGroup}/${segment}`);
375
- }
376
- const genericPathMatch = line.match(/^\s*(?:-\s*)?(?:path|slug):\s*["']?([^"'\n#]+)["']?/);
377
- if (genericPathMatch) {
378
- const v = genericPathMatch[1].trim().replace(/^\/+|\/+$/g, '');
379
- if (v && !v.includes('*') && !/\.[a-z0-9]+$/i.test(v)) {
380
- paths.push(v);
375
+ } else {
376
+ // No group context — fall back to a bare path/slug. Used by data files
377
+ // whose entries are flat (e.g. articles list with `path:` per item).
378
+ const genericPathMatch = line.match(/^\s*(?:-\s*)?(?:path|slug):\s*["']?([^"'\n#]+)["']?/);
379
+ if (genericPathMatch) {
380
+ const v = genericPathMatch[1].trim().replace(/^\/+|\/+$/g, '');
381
+ if (v && !v.includes('*') && !/\.[a-z0-9]+$/i.test(v)) {
382
+ paths.push(v);
383
+ }
381
384
  }
382
385
  }
383
386
  }
@@ -1813,8 +1816,11 @@ async function runPrerender(config) {
1813
1816
  paths.add(`${locale}/${seg}`);
1814
1817
  }
1815
1818
  }
1816
- // Default locale also under its slug (e.g. /en/, /en/page-1) so linking is symmetric; canonical points to root
1817
- if (defaultLocale) {
1819
+ // Default locale also under its slug (e.g. /en/, /en/page-1) so linking is
1820
+ // symmetric with other locales; canonical points to root. Skip this when
1821
+ // there's only one locale — the duplicates serve no purpose and bloat the
1822
+ // output (every page would be written twice: at root AND under /en/).
1823
+ if (defaultLocale && locales.length > 1) {
1818
1824
  paths.add(defaultLocale);
1819
1825
  for (const seg of localeNeutralSegments) {
1820
1826
  if (seg !== '') paths.add(`${defaultLocale}/${seg}`);
@@ -3087,7 +3093,20 @@ async function runPrerender(config) {
3087
3093
  pagesSinceRecycle++;
3088
3094
  break; // success
3089
3095
  }
3090
- if (attempt >= maxRetries) { pagesSinceRecycle++; break; }
3096
+ if (attempt >= maxRetries) {
3097
+ // Exhausted retries — likely an unstable browser (e.g. cascading
3098
+ // "detached Frame" errors). Force a recycle counter past the
3099
+ // threshold so the next path triggers a fresh browser.
3100
+ pagesSinceRecycle = Math.max(pagesSinceRecycle + 1, browserRecycleEvery);
3101
+ break;
3102
+ }
3103
+ // Halfway through retries with no success → preemptively recycle the
3104
+ // browser before the next attempt. This unblocks cascading frame
3105
+ // failures where the browser process needs a fresh start.
3106
+ if (attempt + 1 >= Math.ceil(maxRetries / 2) && pagesSinceRecycle > 0) {
3107
+ pagesSinceRecycle = Math.max(pagesSinceRecycle, browserRecycleEvery);
3108
+ await maybeRecycleBrowser();
3109
+ }
3091
3110
  failedPaths.pop();
3092
3111
  attempt++;
3093
3112
  const displayPath = pathSeg === '' ? '/' : (pathSeg === NOT_FOUND_PATH ? '/__prerender_404__' : '/' + pathSeg);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mnfst-render",
3
- "version": "0.5.17",
3
+ "version": "0.5.19",
4
4
  "description": "Render Manifest sites to static HTML for SEO",
5
5
  "type": "module",
6
6
  "bin": {