@vojtaholik/static-kit-core 2.1.10 → 2.1.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vojtaholik/static-kit-core",
3
- "version": "2.1.10",
3
+ "version": "2.1.12",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -120,8 +120,8 @@ export async function renderPage(
120
120
  }
121
121
  }
122
122
 
123
- // Update <html> attributes
124
- if (node.nodeName === "html") {
123
+ // Update <html> attributes (data-page-id only in dev for HMR)
124
+ if (node.nodeName === "html" && options.isDev) {
125
125
  setAttr(node, "data-page-id", page.id);
126
126
  }
127
127
 
@@ -166,6 +166,11 @@ export async function renderPage(
166
166
  data: `__REGION_CONTENT_${regionName}__`,
167
167
  } as Node,
168
168
  ];
169
+
170
+ // Strip data-region in production
171
+ if (!options.isDev) {
172
+ removeAttr(node, "data-region");
173
+ }
169
174
  }
170
175
  }
171
176
  });
@@ -293,6 +298,13 @@ function setAttr(node: Node, name: string, value: string): void {
293
298
  }
294
299
  }
295
300
 
301
+ function removeAttr(node: Node, name: string): void {
302
+ const element = node as Element;
303
+ if (element.attrs) {
304
+ element.attrs = element.attrs.filter((a) => a.name !== name);
305
+ }
306
+ }
307
+
296
308
  /**
297
309
  * Strip dev-only attributes (data-block-id, data-schema-address) from production HTML
298
310
  */