mnfst-render 0.5.18 → 0.5.20

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.
@@ -661,6 +661,16 @@ function stripRuntimeTailwindArtifacts(html) {
661
661
  return out;
662
662
  }
663
663
 
664
+ // When tailwindcss isn't installed for the project, the prerender keeps the
665
+ // runtime-injected inline tailwind <style> block (it serves the static page
666
+ // for crawlers). But we must still strip `data-tailwind` from the loader
667
+ // script tag, otherwise the runtime tailwind plugin loads at page boot and
668
+ // injects ANOTHER tailwind <style> block AFTER prerender.utilities.css,
669
+ // breaking the cascade order so .hidden wins over .lg:col etc.
670
+ function stripDataTailwindAttr(html) {
671
+ return html.replace(/\sdata-tailwind(?:=(["']).*?\1)?/gi, '');
672
+ }
673
+
664
674
  /** Manifest utilities plugin: <style id="utility-styles"> and <style id="utility-styles-critical"> */
665
675
  function extractUtilityStyleBlocks(html) {
666
676
  const blocks = [];
@@ -1409,7 +1419,11 @@ function generateLocaleVariantHtml({
1409
1419
  // Standard Node.js post-processing (same sequence as processPath)
1410
1420
  html = stripDevOnlyContent(html);
1411
1421
  html = stripInjectedPluginScripts(html, config.root);
1412
- if (tailwindBuilt) html = stripRuntimeTailwindArtifacts(html);
1422
+ if (tailwindBuilt) {
1423
+ html = stripRuntimeTailwindArtifacts(html);
1424
+ } else {
1425
+ html = stripDataTailwindAttr(html);
1426
+ }
1413
1427
 
1414
1428
  const pageUtilityBlocks = [];
1415
1429
  if (bundleUtilities) {
@@ -2922,6 +2936,8 @@ async function runPrerender(config) {
2922
2936
  html = stripInjectedPluginScripts(html, config.root);
2923
2937
  if (tailwindBuilt) {
2924
2938
  html = stripRuntimeTailwindArtifacts(html);
2939
+ } else {
2940
+ html = stripDataTailwindAttr(html);
2925
2941
  }
2926
2942
  if (bundleUtilities) {
2927
2943
  const extracted = extractUtilityStyleBlocks(html);
@@ -3093,7 +3109,20 @@ async function runPrerender(config) {
3093
3109
  pagesSinceRecycle++;
3094
3110
  break; // success
3095
3111
  }
3096
- if (attempt >= maxRetries) { pagesSinceRecycle++; break; }
3112
+ if (attempt >= maxRetries) {
3113
+ // Exhausted retries — likely an unstable browser (e.g. cascading
3114
+ // "detached Frame" errors). Force a recycle counter past the
3115
+ // threshold so the next path triggers a fresh browser.
3116
+ pagesSinceRecycle = Math.max(pagesSinceRecycle + 1, browserRecycleEvery);
3117
+ break;
3118
+ }
3119
+ // Halfway through retries with no success → preemptively recycle the
3120
+ // browser before the next attempt. This unblocks cascading frame
3121
+ // failures where the browser process needs a fresh start.
3122
+ if (attempt + 1 >= Math.ceil(maxRetries / 2) && pagesSinceRecycle > 0) {
3123
+ pagesSinceRecycle = Math.max(pagesSinceRecycle, browserRecycleEvery);
3124
+ await maybeRecycleBrowser();
3125
+ }
3097
3126
  failedPaths.pop();
3098
3127
  attempt++;
3099
3128
  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.18",
3
+ "version": "0.5.20",
4
4
  "description": "Render Manifest sites to static HTML for SEO",
5
5
  "type": "module",
6
6
  "bin": {