mnfst-render 0.4.5 → 0.4.7

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.
@@ -2179,10 +2179,20 @@ async function runPrerender(config) {
2179
2179
  ) {
2180
2180
  try {
2181
2181
  const A = window.Alpine;
2182
- if (A && typeof A.$data === 'function') {
2183
- const scope = A.$data(n);
2184
- if (scope && Object.prototype.hasOwnProperty.call(scope, itemVar)) {
2185
- const raw = scope[itemVar];
2182
+ if (A) {
2183
+ // Alpine.evaluate(el, expr) evaluates in the full scope chain including
2184
+ // x-for loop variables, unlike Alpine.$data() which only sees x-data attrs.
2185
+ let raw = undefined;
2186
+ if (typeof A.evaluate === 'function') {
2187
+ raw = A.evaluate(n, itemVar);
2188
+ } else if (typeof A.$data === 'function') {
2189
+ // Fallback: $data only sees x-data scopes, not x-for vars
2190
+ const scope = A.$data(n);
2191
+ if (scope && Object.prototype.hasOwnProperty.call(scope, itemVar)) {
2192
+ raw = scope[itemVar];
2193
+ }
2194
+ }
2195
+ if (raw !== undefined && raw !== null) {
2186
2196
  // Serialize only own-enumerable properties to avoid circular refs / proxies
2187
2197
  const snapshot = JSON.parse(JSON.stringify(raw));
2188
2198
  n.setAttribute('x-data', JSON.stringify({ [itemVar]: snapshot }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mnfst-render",
3
- "version": "0.4.5",
3
+ "version": "0.4.7",
4
4
  "description": "Render Manifest sites to static HTML for SEO",
5
5
  "type": "module",
6
6
  "bin": {