spark-ssr 0.3.3 → 0.3.4
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 +1 -1
- package/src/server.js +8 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spark-ssr",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "Zero-config SSR for spark-html on Bun. The HTML template infers everything: filesystem routing, layouts, <spark-ssr> declarative data (SQL, URLs, globs, modules), auto CRUD with validation, guards, no-JS forms, schema + seeds, live updates, SEO. No build step.",
|
|
5
5
|
"homepage": "https://wilkinnovo.github.io/spark-html",
|
|
6
6
|
"type": "module",
|
package/src/server.js
CHANGED
|
@@ -172,11 +172,18 @@ function pageData(page, cache, pagesDir) {
|
|
|
172
172
|
const pageP = parsed[parsed.length - 1];
|
|
173
173
|
|
|
174
174
|
// Compose bodies innermost-out: the page replaces each layout's <slot>.
|
|
175
|
+
// Comments are masked first so a literal <slot> written inside a layout
|
|
176
|
+
// comment (the template's own explainer text does this) isn't mistaken for
|
|
177
|
+
// the real slot — which would inject the whole page inside the comment.
|
|
175
178
|
let body = pageP.body;
|
|
176
179
|
for (let i = parsed.length - 2; i >= 0; i--) {
|
|
177
180
|
const lay = parsed[i].body;
|
|
178
181
|
const SLOT = /<slot\b[^>]*>(?:\s*<\/slot>)?/i;
|
|
179
|
-
|
|
182
|
+
const { masked, restore } = maskComments(lay);
|
|
183
|
+
const m = masked.match(SLOT);
|
|
184
|
+
body = m
|
|
185
|
+
? restore(masked.slice(0, m.index)) + body + restore(masked.slice(m.index + m[0].length))
|
|
186
|
+
: lay + body;
|
|
180
187
|
}
|
|
181
188
|
|
|
182
189
|
const blocks = parsed.flatMap((p) => p.blocks);
|