mnfst-render 0.5.11 → 0.5.14

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.
@@ -2461,7 +2461,7 @@ async function runPrerender(config) {
2461
2461
  // The baked value IS the correct initial render.
2462
2462
  if (src === null) {
2463
2463
  const hasBinding =
2464
- (name === 'style' && (':style' in source || 'x-bind:style' in source)) ||
2464
+ (name === 'style' && (':style' in source || 'x-bind:style' in source || 'x-show' in source)) ||
2465
2465
  (name === 'class' && (':class' in source || 'x-bind:class' in source));
2466
2466
  if (hasBinding) continue;
2467
2467
  }
@@ -2722,6 +2722,27 @@ async function runPrerender(config) {
2722
2722
  runBatch(() => {
2723
2723
  document.querySelectorAll('template[x-for][data-prerender-static-generated="1"]').forEach((tpl) => {
2724
2724
  if (tpl.hasAttribute('data-hydrate') || tpl.closest('[data-hydrate]')) return;
2725
+ // Keep templates whose x-for iterates over $x data — these are data-driven
2726
+ // lists that need Alpine to re-render at runtime (e.g. for locale changes,
2727
+ // filtering). Remove the STATIC CLONES so Alpine's re-render from the
2728
+ // template doesn't produce duplicates, but the template itself stays.
2729
+ const xFor = (tpl.getAttribute('x-for') || '');
2730
+ if (xFor.includes('$x')) {
2731
+ // Remove static clones (siblings with same tag+class as template's first child)
2732
+ const first = tpl.content?.firstElementChild;
2733
+ if (first) {
2734
+ const tag = first.tagName;
2735
+ const cls = first.getAttribute('class') || '';
2736
+ let n = tpl.nextElementSibling;
2737
+ while (n && n.tagName === tag && (n.getAttribute('class') || '') === cls) {
2738
+ const next = n.nextElementSibling;
2739
+ n.remove();
2740
+ n = next;
2741
+ }
2742
+ }
2743
+ tpl.removeAttribute('data-prerender-static-generated');
2744
+ return;
2745
+ }
2725
2746
  const parent = tpl.parentNode;
2726
2747
  if (!parent) {
2727
2748
  tpl.remove();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mnfst-render",
3
- "version": "0.5.11",
3
+ "version": "0.5.14",
4
4
  "description": "Render Manifest sites to static HTML for SEO",
5
5
  "type": "module",
6
6
  "bin": {
@@ -25,6 +25,9 @@
25
25
  "render",
26
26
  "seo"
27
27
  ],
28
+ "dependencies": {
29
+ "js-yaml": "^4.1.0"
30
+ },
28
31
  "author": "Andrew Matlock",
29
32
  "license": "MIT",
30
33
  "repository": {