mnfst-render 0.5.49 → 0.5.50
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 +10 -2
- package/package.json +1 -1
package/manifest.render.mjs
CHANGED
|
@@ -1480,7 +1480,15 @@ function stripResolvedXIconDirectives(html) {
|
|
|
1480
1480
|
}
|
|
1481
1481
|
|
|
1482
1482
|
function markPrerenderedManifestComponents(html) {
|
|
1483
|
-
|
|
1483
|
+
// x-if/x-for template content is authored source Alpine clones at runtime — never mark it.
|
|
1484
|
+
const templates = [];
|
|
1485
|
+
return html.replace(/<(\/?)template(?=[\s>])([^>]*)>|<(x-[a-z][\w-]*)([^>]*)>/gi, (full, close, tplAttrs, tag, attrs) => {
|
|
1486
|
+
if (!tag) {
|
|
1487
|
+
if (close) templates.pop();
|
|
1488
|
+
else templates.push(/\sx-(?:if|for)\s*=/i.test(tplAttrs || ''));
|
|
1489
|
+
return full;
|
|
1490
|
+
}
|
|
1491
|
+
if (templates.includes(true)) return full;
|
|
1484
1492
|
const a = attrs || '';
|
|
1485
1493
|
if (/\bdata-pre-rendered\s*=/i.test(a) || /\bdata-processed\s*=/i.test(a)) return full;
|
|
1486
1494
|
// Inside an explicit hydrate island — the runtime will restore its
|
|
@@ -5188,7 +5196,7 @@ async function runPrerender(config) {
|
|
|
5188
5196
|
let tagged = false;
|
|
5189
5197
|
const lookup = tpl._x_lookup;
|
|
5190
5198
|
if (lookup) {
|
|
5191
|
-
try { Object.values(lookup).forEach((el) => { if (el) { tag(el); tagged = true; } }); } catch { /* not iterable */ }
|
|
5199
|
+
try { (lookup instanceof Map ? [...lookup.values()] : Object.values(lookup)).forEach((el) => { if (el) { tag(el); tagged = true; } }); } catch { /* not iterable */ }
|
|
5192
5200
|
}
|
|
5193
5201
|
if (tagged) return;
|
|
5194
5202
|
const first = tpl.content && tpl.content.firstElementChild;
|