@lightspeed-js/core 0.3.0 → 0.3.2
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/dist/index.js +5 -2
- package/dist/ssg.js +5 -2
- package/dist/types/src/marker.d.ts +2 -0
- package/dist/vite.js +9 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1269,10 +1269,13 @@ function findMarkerEnd(nodes, start) {
|
|
|
1269
1269
|
}
|
|
1270
1270
|
return -1;
|
|
1271
1271
|
}
|
|
1272
|
+
function isSlotStash(node) {
|
|
1273
|
+
return node.nodeType === 1 && node.tagName === "TEMPLATE" && node.hasAttribute("data-lsp-slot");
|
|
1274
|
+
}
|
|
1272
1275
|
function slotNodesFor(payload, between) {
|
|
1273
1276
|
if (!payload.ssr)
|
|
1274
1277
|
return between;
|
|
1275
|
-
const stash = between.find(
|
|
1278
|
+
const stash = between.find(isSlotStash);
|
|
1276
1279
|
return stash ? Array.from(stash.content.childNodes) : [];
|
|
1277
1280
|
}
|
|
1278
1281
|
|
|
@@ -2061,7 +2064,7 @@ class Mounter {
|
|
|
2061
2064
|
return islands;
|
|
2062
2065
|
}
|
|
2063
2066
|
async mountRange(range, props, slotNodes) {
|
|
2064
|
-
const child = await this.mount(range.payload.c, null, props, slotNodes, undefined, range.payload.ssr ? nodesBetween(range.start, range.end) : undefined, range.payload.ssr ? () => this.rescueRendered(range) : undefined);
|
|
2067
|
+
const child = await this.mount(range.payload.c, null, props, slotNodes, undefined, range.payload.ssr ? nodesBetween(range.start, range.end).filter((node) => !isSlotStash(node)) : undefined, range.payload.ssr ? () => this.rescueRendered(range) : undefined);
|
|
2065
2068
|
if (!child)
|
|
2066
2069
|
return null;
|
|
2067
2070
|
const root = child.rootNodes.find((node) => node.nodeType === 1);
|
package/dist/ssg.js
CHANGED
|
@@ -1292,10 +1292,13 @@ function findMarkerEnd(nodes, start) {
|
|
|
1292
1292
|
}
|
|
1293
1293
|
return -1;
|
|
1294
1294
|
}
|
|
1295
|
+
function isSlotStash(node) {
|
|
1296
|
+
return node.nodeType === 1 && node.tagName === "TEMPLATE" && node.hasAttribute("data-lsp-slot");
|
|
1297
|
+
}
|
|
1295
1298
|
function slotNodesFor(payload, between) {
|
|
1296
1299
|
if (!payload.ssr)
|
|
1297
1300
|
return between;
|
|
1298
|
-
const stash = between.find(
|
|
1301
|
+
const stash = between.find(isSlotStash);
|
|
1299
1302
|
return stash ? Array.from(stash.content.childNodes) : [];
|
|
1300
1303
|
}
|
|
1301
1304
|
|
|
@@ -2084,7 +2087,7 @@ class Mounter {
|
|
|
2084
2087
|
return islands;
|
|
2085
2088
|
}
|
|
2086
2089
|
async mountRange(range, props, slotNodes) {
|
|
2087
|
-
const child = await this.mount(range.payload.c, null, props, slotNodes, undefined, range.payload.ssr ? nodesBetween(range.start, range.end) : undefined, range.payload.ssr ? () => this.rescueRendered(range) : undefined);
|
|
2090
|
+
const child = await this.mount(range.payload.c, null, props, slotNodes, undefined, range.payload.ssr ? nodesBetween(range.start, range.end).filter((node) => !isSlotStash(node)) : undefined, range.payload.ssr ? () => this.rescueRendered(range) : undefined);
|
|
2088
2091
|
if (!child)
|
|
2089
2092
|
return null;
|
|
2090
2093
|
const root = child.rootNodes.find((node) => node.nodeType === 1);
|
|
@@ -75,6 +75,8 @@ export declare function parseMarker(node: Node): MarkerPayload | null;
|
|
|
75
75
|
* Returns -1 if unterminated.
|
|
76
76
|
*/
|
|
77
77
|
export declare function findMarkerEnd(nodes: Node[], start: number): number;
|
|
78
|
+
/** The inert `<template data-lsp-slot>` a server-rendered island keeps its slot content in. */
|
|
79
|
+
export declare function isSlotStash(node: Node): boolean;
|
|
78
80
|
/**
|
|
79
81
|
* The slot content for a marker.
|
|
80
82
|
*
|
package/dist/vite.js
CHANGED
|
@@ -721,10 +721,13 @@ function findMarkerEnd(nodes, start) {
|
|
|
721
721
|
}
|
|
722
722
|
return -1;
|
|
723
723
|
}
|
|
724
|
+
function isSlotStash(node) {
|
|
725
|
+
return node.nodeType === 1 && node.tagName === "TEMPLATE" && node.hasAttribute("data-lsp-slot");
|
|
726
|
+
}
|
|
724
727
|
function slotNodesFor(payload, between) {
|
|
725
728
|
if (!payload.ssr)
|
|
726
729
|
return between;
|
|
727
|
-
const stash = between.find(
|
|
730
|
+
const stash = between.find(isSlotStash);
|
|
728
731
|
return stash ? Array.from(stash.content.childNodes) : [];
|
|
729
732
|
}
|
|
730
733
|
|
|
@@ -1513,7 +1516,7 @@ class Mounter {
|
|
|
1513
1516
|
return islands;
|
|
1514
1517
|
}
|
|
1515
1518
|
async mountRange(range, props, slotNodes) {
|
|
1516
|
-
const child = await this.mount(range.payload.c, null, props, slotNodes, undefined, range.payload.ssr ? nodesBetween(range.start, range.end) : undefined, range.payload.ssr ? () => this.rescueRendered(range) : undefined);
|
|
1519
|
+
const child = await this.mount(range.payload.c, null, props, slotNodes, undefined, range.payload.ssr ? nodesBetween(range.start, range.end).filter((node) => !isSlotStash(node)) : undefined, range.payload.ssr ? () => this.rescueRendered(range) : undefined);
|
|
1517
1520
|
if (!child)
|
|
1518
1521
|
return null;
|
|
1519
1522
|
const root = child.rootNodes.find((node) => node.nodeType === 1);
|
|
@@ -5350,6 +5353,8 @@ ${entries.join(`,
|
|
|
5350
5353
|
}
|
|
5351
5354
|
for (const file of await findFragments())
|
|
5352
5355
|
server.watcher.add(file);
|
|
5356
|
+
if (host)
|
|
5357
|
+
return;
|
|
5353
5358
|
const proxied = Object.keys(server.config.server.proxy ?? {});
|
|
5354
5359
|
const isProxied = (pathname) => proxied.some((key) => key.startsWith("^") ? new RegExp(key).test(pathname) : pathname.startsWith(key));
|
|
5355
5360
|
const missing = (res) => {
|
|
@@ -5382,6 +5387,8 @@ ${entries.join(`,
|
|
|
5382
5387
|
});
|
|
5383
5388
|
},
|
|
5384
5389
|
configurePreviewServer(server) {
|
|
5390
|
+
if (host)
|
|
5391
|
+
return;
|
|
5385
5392
|
const ready = buildRouteTable();
|
|
5386
5393
|
server.middlewares.use(async (req, res, next) => {
|
|
5387
5394
|
const url = req.url;
|