@solidjs/web 2.0.0-rc.20 → 2.0.0-rc.22
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/server.dev.js +521 -280
- package/dist/server.js +518 -279
- package/dist/server.observe.js +518 -279
- package/dist/web.dev.js +142 -106
- package/dist/web.js +120 -105
- package/dist/web.observe.js +120 -105
- package/frames/dist/client.dev.js +7 -2
- package/frames/dist/client.js +7 -2
- package/frames/dist/client.observe.js +7 -2
- package/frames/dist/server.dev.js +124 -68
- package/frames/dist/server.js +124 -68
- package/frames/dist/server.observe.js +124 -68
- package/frames/dist/wire.js +1 -1
- package/package.json +2 -2
- package/serialization/dist/serialization.js +53 -12
- package/serialization/types/index.d.ts +42 -0
- package/serialization/types/serializer.d.ts +42 -0
- package/server-functions/dist/client.dev.js +5 -3
- package/server-functions/dist/client.js +5 -3
- package/server-functions/dist/client.observe.js +5 -3
- package/server-functions/dist/rich-args.js +27 -9
- package/server-functions/dist/server.dev.js +122 -36
- package/server-functions/dist/server.js +122 -36
- package/server-functions/dist/server.observe.js +122 -36
- package/types/client.d.ts +54 -3
- package/types/constants.d.ts +2 -1
- package/types/frames/frame-client.d.ts +2 -0
- package/types/frames/serializer.d.ts +42 -0
- package/types/frames/tree-rewrite.d.ts +7 -0
- package/types/serializer.d.ts +42 -0
- package/types/server-functions/client.d.ts +0 -1
- package/types/server-functions/server.d.ts +0 -1
- package/types/server-functions/shared.d.ts +3 -2
- package/types/server-functions/uploads.d.ts +3 -0
- package/types/server-mock.d.ts +35 -8
- package/types/server.d.ts +89 -18
|
@@ -20,7 +20,15 @@ function rewriteTree(value, visit, withPath) {
|
|
|
20
20
|
} catch (err) {
|
|
21
21
|
if (err !== CYCLE) throw err;
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
const memo = state.memo || (state.memo = new Map());
|
|
24
|
+
const marks = {
|
|
25
|
+
at: new Map(),
|
|
26
|
+
stack: [],
|
|
27
|
+
changed: new Set(),
|
|
28
|
+
next: 0
|
|
29
|
+
};
|
|
30
|
+
mark(value, visit, path, memo, marks);
|
|
31
|
+
return clone(value, memo, marks.changed);
|
|
24
32
|
}
|
|
25
33
|
function shape(value) {
|
|
26
34
|
return Array.isArray(value) ? 1 : Object.getPrototypeOf(value) === Object.prototype ? 2 : 0;
|
|
@@ -68,28 +76,73 @@ function cow(value, visit, path, depth, state) {
|
|
|
68
76
|
if (ancestors !== undefined) ancestors.delete(value);
|
|
69
77
|
return out;
|
|
70
78
|
}
|
|
71
|
-
function
|
|
72
|
-
|
|
79
|
+
function mark(value, visit, path, memo, m) {
|
|
80
|
+
const seen = m.at.get(value);
|
|
81
|
+
if (seen !== undefined) return seen;
|
|
82
|
+
if (memo.has(value)) return -1;
|
|
73
83
|
const r = visit(value, path);
|
|
74
84
|
if (r !== DESCEND) {
|
|
75
85
|
memo.set(value, r);
|
|
76
|
-
return
|
|
86
|
+
return -1;
|
|
77
87
|
}
|
|
78
88
|
const s = shape(value);
|
|
79
|
-
if (s === 0) return
|
|
80
|
-
const
|
|
89
|
+
if (s === 0) return -1;
|
|
90
|
+
const index = m.next++;
|
|
91
|
+
let low = index;
|
|
92
|
+
let changed = false;
|
|
93
|
+
let open = false;
|
|
94
|
+
const keys = s === 1 ? value : Object.keys(value);
|
|
95
|
+
for (let i = 0; i < keys.length; i++) {
|
|
96
|
+
const k = s === 1 ? i : keys[i];
|
|
97
|
+
const c = value[k];
|
|
98
|
+
if (c === null || typeof c !== "object") continue;
|
|
99
|
+
if (!open) {
|
|
100
|
+
open = true;
|
|
101
|
+
m.at.set(value, index);
|
|
102
|
+
m.stack.push(value);
|
|
103
|
+
}
|
|
104
|
+
const l = mark(c, visit, path === undefined ? undefined : s === 1 ? `${path}[${k}]` : `${path}.${k}`, memo, m);
|
|
105
|
+
if (l >= 0 && l < low) low = l;
|
|
106
|
+
if (memo.has(c) && memo.get(c) !== c || l === Infinity && m.changed.has(c)) changed = true;
|
|
107
|
+
}
|
|
108
|
+
if (!open) return -1;
|
|
109
|
+
if (low === index) {
|
|
110
|
+
m.at.set(value, Infinity);
|
|
111
|
+
if (m.stack[m.stack.length - 1] === value) {
|
|
112
|
+
m.stack.pop();
|
|
113
|
+
if (changed) m.changed.add(value);
|
|
114
|
+
return Infinity;
|
|
115
|
+
}
|
|
116
|
+
const members = m.stack.splice(m.stack.lastIndexOf(value));
|
|
117
|
+
if (!changed) for (const n of members) if (m.changed.has(n)) {
|
|
118
|
+
changed = true;
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
for (const n of members) {
|
|
122
|
+
m.at.set(n, Infinity);
|
|
123
|
+
if (changed) m.changed.add(n);
|
|
124
|
+
}
|
|
125
|
+
return Infinity;
|
|
126
|
+
}
|
|
127
|
+
if (changed) m.changed.add(value);
|
|
128
|
+
return low;
|
|
129
|
+
}
|
|
130
|
+
function clone(value, memo, changed) {
|
|
131
|
+
if (memo.has(value)) return memo.get(value);
|
|
132
|
+
if (!changed.has(value)) return value;
|
|
133
|
+
const out = Array.isArray(value) ? value.slice() : {
|
|
81
134
|
...value
|
|
82
135
|
};
|
|
83
136
|
memo.set(value, out);
|
|
84
|
-
if (
|
|
137
|
+
if (Array.isArray(value)) {
|
|
85
138
|
for (let i = 0; i < value.length; i++) {
|
|
86
139
|
const c = value[i];
|
|
87
|
-
if (c !== null && typeof c === "object") out[i] = clone(c,
|
|
140
|
+
if (c !== null && typeof c === "object") out[i] = clone(c, memo, changed);
|
|
88
141
|
}
|
|
89
142
|
} else {
|
|
90
143
|
for (const k of Object.keys(value)) {
|
|
91
144
|
const c = value[k];
|
|
92
|
-
if (c !== null && typeof c === "object") out[k] = clone(c,
|
|
145
|
+
if (c !== null && typeof c === "object") out[k] = clone(c, memo, changed);
|
|
93
146
|
}
|
|
94
147
|
}
|
|
95
148
|
return out;
|
|
@@ -242,7 +295,6 @@ function createKeyedSerializer(serialize, onError, onDone) {
|
|
|
242
295
|
pendingWrites++;
|
|
243
296
|
let settled = false;
|
|
244
297
|
let failed = false;
|
|
245
|
-
let started = false;
|
|
246
298
|
let cancel = null;
|
|
247
299
|
const settle = () => {
|
|
248
300
|
if (settled) return;
|
|
@@ -256,17 +308,14 @@ function createKeyedSerializer(serialize, onError, onDone) {
|
|
|
256
308
|
stream = serialize(key, value, {
|
|
257
309
|
onError: onError && (err => {
|
|
258
310
|
failed = true;
|
|
259
|
-
onError(err);
|
|
311
|
+
onError(err, key);
|
|
260
312
|
if (cancel) {
|
|
261
313
|
cancel();
|
|
262
314
|
settle();
|
|
263
315
|
}
|
|
264
316
|
}),
|
|
265
317
|
onDone: settle
|
|
266
|
-
},
|
|
267
|
-
if (initial) started = true;
|
|
268
|
-
return !closed;
|
|
269
|
-
});
|
|
318
|
+
}, () => !closed);
|
|
270
319
|
} catch (err) {
|
|
271
320
|
settle();
|
|
272
321
|
throw err;
|
|
@@ -316,7 +365,7 @@ function createJSONSerializer({
|
|
|
316
365
|
plugins: resolved.plugins,
|
|
317
366
|
disabledFeatures: resolved.disabledFeatures | serializeOnlyDisabledFeatures(resolved.serializeErrorStacks),
|
|
318
367
|
onParse(node, initial) {
|
|
319
|
-
if (live(
|
|
368
|
+
if (live()) onData({
|
|
320
369
|
key,
|
|
321
370
|
node,
|
|
322
371
|
initial
|
|
@@ -1021,10 +1070,9 @@ function frameStream(makeCode, options) {
|
|
|
1021
1070
|
};
|
|
1022
1071
|
}
|
|
1023
1072
|
function slotRange(occurrence) {
|
|
1024
|
-
return {
|
|
1025
|
-
t: `<!--slot:${occurrence}:start--><!--slot:${occurrence}:end-->`,
|
|
1073
|
+
return Object.assign(markup(`<!--slot:${occurrence}:start--><!--slot:${occurrence}:end-->`), {
|
|
1026
1074
|
$slot: true
|
|
1027
|
-
};
|
|
1075
|
+
});
|
|
1028
1076
|
}
|
|
1029
1077
|
function argBorderForm(value, needs) {
|
|
1030
1078
|
return toBorderForm(noteTraces(value, needs));
|
|
@@ -1161,6 +1209,16 @@ function suppressedFill(render) {
|
|
|
1161
1209
|
live.suppressed--;
|
|
1162
1210
|
}
|
|
1163
1211
|
}
|
|
1212
|
+
const SSR_NODE = Symbol.for("solid.ssrNode");
|
|
1213
|
+
const markup = (t, h, p) => h ? {
|
|
1214
|
+
t,
|
|
1215
|
+
h,
|
|
1216
|
+
p,
|
|
1217
|
+
$: SSR_NODE
|
|
1218
|
+
} : {
|
|
1219
|
+
t,
|
|
1220
|
+
$: SSR_NODE
|
|
1221
|
+
};
|
|
1164
1222
|
let parked = null;
|
|
1165
1223
|
let parkedIds = 0;
|
|
1166
1224
|
const PARKED = /<!--sc-n:(\d+)-->/;
|
|
@@ -1171,9 +1229,7 @@ function park(render) {
|
|
|
1171
1229
|
render,
|
|
1172
1230
|
out: undefined
|
|
1173
1231
|
});
|
|
1174
|
-
return {
|
|
1175
|
-
t: `<!--sc-n:${id}-->`
|
|
1176
|
-
};
|
|
1232
|
+
return markup(`<!--sc-n:${id}-->`);
|
|
1177
1233
|
}
|
|
1178
1234
|
const runParked = (entry, owner) => entry.out || (entry.out = entry.render(owner));
|
|
1179
1235
|
function placeParked(node, nested, owner) {
|
|
@@ -1191,22 +1247,14 @@ function expandParked(node, nested, owner) {
|
|
|
1191
1247
|
if (!node.h) return splitParked(node.t, nested, owner) || node;
|
|
1192
1248
|
const out = [];
|
|
1193
1249
|
node.t.forEach((t, i) => {
|
|
1194
|
-
out.push(splitParked(t, nested, owner) ||
|
|
1195
|
-
|
|
1196
|
-
});
|
|
1197
|
-
if (i < node.h.length) out.push({
|
|
1198
|
-
t: ["", ""],
|
|
1199
|
-
h: [node.h[i]],
|
|
1200
|
-
p: [node.p[i]]
|
|
1201
|
-
});
|
|
1250
|
+
out.push(splitParked(t, nested, owner) || markup(t));
|
|
1251
|
+
if (i < node.h.length) out.push(markup(["", ""], [node.h[i]], [node.p[i]]));
|
|
1202
1252
|
});
|
|
1203
1253
|
return out;
|
|
1204
1254
|
}
|
|
1205
1255
|
function splitParked(t, nested, owner) {
|
|
1206
1256
|
const parts = typeof t === "string" ? t.split(PARKED) : [t];
|
|
1207
|
-
return parts.length > 1 ? parts.map((part, i) => i & 1 ? runParked(nested.get(+part), owner) :
|
|
1208
|
-
t: part
|
|
1209
|
-
}) : undefined;
|
|
1257
|
+
return parts.length > 1 ? parts.map((part, i) => i & 1 ? runParked(nested.get(+part), owner) : markup(part)) : undefined;
|
|
1210
1258
|
}
|
|
1211
1259
|
function createDocumentSlotProps(clientProps, frameId) {
|
|
1212
1260
|
const counts = Object.create(null);
|
|
@@ -1239,11 +1287,7 @@ function createDocumentSlotProps(clientProps, frameId) {
|
|
|
1239
1287
|
const getters = new Map();
|
|
1240
1288
|
const repeats = new Map();
|
|
1241
1289
|
const range = (occurrence, content, tail) => {
|
|
1242
|
-
const r = [{
|
|
1243
|
-
t: `<!--slot:${occurrence}:start-->`
|
|
1244
|
-
}, content, tail, {
|
|
1245
|
-
t: `<!--slot:${occurrence}:end-->`
|
|
1246
|
-
}];
|
|
1290
|
+
const r = [markup(`<!--slot:${occurrence}:start-->`), content, tail, markup(`<!--slot:${occurrence}:end-->`)];
|
|
1247
1291
|
r.$slot = true;
|
|
1248
1292
|
return r;
|
|
1249
1293
|
};
|
|
@@ -1364,11 +1408,7 @@ function createDocumentSlotProps(clientProps, frameId) {
|
|
|
1364
1408
|
resolved[key] = () => {
|
|
1365
1409
|
if (region.locked) return [];
|
|
1366
1410
|
region.used = true;
|
|
1367
|
-
return [
|
|
1368
|
-
t: frameElementOpen(childId)
|
|
1369
|
-
}, region.nested && region.nested.size ? placeParked(value, region.nested, getOwner()) : value, {
|
|
1370
|
-
t: FRAME_ELEMENT_CLOSE
|
|
1371
|
-
}];
|
|
1411
|
+
return [markup(frameElementOpen(childId)), region.nested && region.nested.size ? placeParked(value, region.nested, getOwner()) : value, markup(FRAME_ELEMENT_CLOSE)];
|
|
1372
1412
|
};
|
|
1373
1413
|
} else if (ssrAsyncValue && isAsyncValue(value)) {
|
|
1374
1414
|
let readable = value;
|
|
@@ -1663,9 +1703,7 @@ function frameTransformDirectResult(value, {
|
|
|
1663
1703
|
const address = frameAddress(id, args);
|
|
1664
1704
|
const wrapped = props => {
|
|
1665
1705
|
const siteId = documentSiteId(id);
|
|
1666
|
-
return [
|
|
1667
|
-
t: frameElementOpen(siteId, address.slice(id.length + 1))
|
|
1668
|
-
},
|
|
1706
|
+
return [markup(frameElementOpen(siteId, address.slice(id.length + 1))),
|
|
1669
1707
|
serverOwned(() => {
|
|
1670
1708
|
const page = sharedConfig.context;
|
|
1671
1709
|
armDocumentLiveHoles(page);
|
|
@@ -1681,9 +1719,7 @@ function frameTransformDirectResult(value, {
|
|
|
1681
1719
|
} finally {
|
|
1682
1720
|
sharedConfig.context = page;
|
|
1683
1721
|
}
|
|
1684
|
-
}),
|
|
1685
|
-
t: FRAME_ELEMENT_CLOSE
|
|
1686
|
-
}];
|
|
1722
|
+
}), markup(FRAME_ELEMENT_CLOSE)];
|
|
1687
1723
|
};
|
|
1688
1724
|
wrapped[SERVER_COMPONENT] = id;
|
|
1689
1725
|
wrapped[SERVER_COMPONENT_SOURCE] = component;
|
|
@@ -1826,10 +1862,9 @@ function createSlotProps(sink, frame) {
|
|
|
1826
1862
|
if (repeat) return repeat;
|
|
1827
1863
|
if (sweeping && !live.scope) {
|
|
1828
1864
|
live.gateHit = true;
|
|
1829
|
-
return {
|
|
1830
|
-
t: "",
|
|
1865
|
+
return Object.assign(markup(""), {
|
|
1831
1866
|
$slot: true
|
|
1832
|
-
};
|
|
1867
|
+
});
|
|
1833
1868
|
}
|
|
1834
1869
|
const raw = callArgs[0];
|
|
1835
1870
|
let occurrence = keyedId(prop, raw);
|
|
@@ -2231,25 +2266,23 @@ function snapshot(shared, have) {
|
|
|
2231
2266
|
});
|
|
2232
2267
|
open.r[k] = record;
|
|
2233
2268
|
};
|
|
2234
|
-
|
|
2235
|
-
|
|
2269
|
+
const containers = [];
|
|
2270
|
+
const spliced = new Set();
|
|
2271
|
+
for (const entry of shared.records.values()) {
|
|
2272
|
+
const {
|
|
2236
2273
|
id,
|
|
2237
|
-
version,
|
|
2238
2274
|
k,
|
|
2239
2275
|
record
|
|
2240
|
-
}
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
k
|
|
2250
|
-
record
|
|
2251
|
-
} of shared.records.values()) {
|
|
2252
|
-
if (!k.startsWith("hole:lh:") || k.endsWith(":error") || !record || record.value == null) continue;
|
|
2276
|
+
} = entry;
|
|
2277
|
+
if (id !== shared.id || !record) continue;
|
|
2278
|
+
if (k === "" || /^seg:[^:]+$/.test(k)) {
|
|
2279
|
+
if (typeof record.value === "string") containers.push({
|
|
2280
|
+
e: entry,
|
|
2281
|
+
value: record.value
|
|
2282
|
+
});
|
|
2283
|
+
continue;
|
|
2284
|
+
}
|
|
2285
|
+
if (!k.startsWith("hole:lh:") || k.endsWith(":error") || record.value == null) continue;
|
|
2253
2286
|
const n = k.slice(8);
|
|
2254
2287
|
const startMark = `<!--lh:${n}-->`;
|
|
2255
2288
|
const endMark = `<!--lh:/${n}-->`;
|
|
@@ -2259,9 +2292,32 @@ function snapshot(shared, have) {
|
|
|
2259
2292
|
const end = c.value.indexOf(endMark, start);
|
|
2260
2293
|
if (end < 0) continue;
|
|
2261
2294
|
c.value = c.value.slice(0, start + startMark.length) + record.value + c.value.slice(end);
|
|
2295
|
+
spliced.add(entry);
|
|
2262
2296
|
break;
|
|
2263
2297
|
}
|
|
2264
2298
|
}
|
|
2299
|
+
if (!conditional) {
|
|
2300
|
+
for (const e of shared.records.values()) {
|
|
2301
|
+
const {
|
|
2302
|
+
id,
|
|
2303
|
+
version,
|
|
2304
|
+
k,
|
|
2305
|
+
record
|
|
2306
|
+
} = e;
|
|
2307
|
+
if (spliced.has(e)) continue;
|
|
2308
|
+
const c = containers.find(c => c.e === e);
|
|
2309
|
+
if (c && c.value !== record.value) {
|
|
2310
|
+
const holes = {};
|
|
2311
|
+
if (record.holes) for (const key in record.holes) if (key.startsWith("lha:")) holes[key] = record.holes[key];
|
|
2312
|
+
put(id, version, k, withHoles({
|
|
2313
|
+
...record,
|
|
2314
|
+
value: c.value,
|
|
2315
|
+
digest: k ? textDigest(c.value) : record.digest
|
|
2316
|
+
}, holeDigests(c.value, null, holes)));
|
|
2317
|
+
} else put(id, version, k, record);
|
|
2318
|
+
}
|
|
2319
|
+
return out;
|
|
2320
|
+
}
|
|
2265
2321
|
for (const e of shared.records.values()) {
|
|
2266
2322
|
const {
|
|
2267
2323
|
id,
|
package/frames/dist/server.js
CHANGED
|
@@ -20,7 +20,15 @@ function rewriteTree(value, visit, withPath) {
|
|
|
20
20
|
} catch (err) {
|
|
21
21
|
if (err !== CYCLE) throw err;
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
const memo = state.memo || (state.memo = new Map());
|
|
24
|
+
const marks = {
|
|
25
|
+
at: new Map(),
|
|
26
|
+
stack: [],
|
|
27
|
+
changed: new Set(),
|
|
28
|
+
next: 0
|
|
29
|
+
};
|
|
30
|
+
mark(value, visit, path, memo, marks);
|
|
31
|
+
return clone(value, memo, marks.changed);
|
|
24
32
|
}
|
|
25
33
|
function shape(value) {
|
|
26
34
|
return Array.isArray(value) ? 1 : Object.getPrototypeOf(value) === Object.prototype ? 2 : 0;
|
|
@@ -68,28 +76,73 @@ function cow(value, visit, path, depth, state) {
|
|
|
68
76
|
if (ancestors !== undefined) ancestors.delete(value);
|
|
69
77
|
return out;
|
|
70
78
|
}
|
|
71
|
-
function
|
|
72
|
-
|
|
79
|
+
function mark(value, visit, path, memo, m) {
|
|
80
|
+
const seen = m.at.get(value);
|
|
81
|
+
if (seen !== undefined) return seen;
|
|
82
|
+
if (memo.has(value)) return -1;
|
|
73
83
|
const r = visit(value, path);
|
|
74
84
|
if (r !== DESCEND) {
|
|
75
85
|
memo.set(value, r);
|
|
76
|
-
return
|
|
86
|
+
return -1;
|
|
77
87
|
}
|
|
78
88
|
const s = shape(value);
|
|
79
|
-
if (s === 0) return
|
|
80
|
-
const
|
|
89
|
+
if (s === 0) return -1;
|
|
90
|
+
const index = m.next++;
|
|
91
|
+
let low = index;
|
|
92
|
+
let changed = false;
|
|
93
|
+
let open = false;
|
|
94
|
+
const keys = s === 1 ? value : Object.keys(value);
|
|
95
|
+
for (let i = 0; i < keys.length; i++) {
|
|
96
|
+
const k = s === 1 ? i : keys[i];
|
|
97
|
+
const c = value[k];
|
|
98
|
+
if (c === null || typeof c !== "object") continue;
|
|
99
|
+
if (!open) {
|
|
100
|
+
open = true;
|
|
101
|
+
m.at.set(value, index);
|
|
102
|
+
m.stack.push(value);
|
|
103
|
+
}
|
|
104
|
+
const l = mark(c, visit, path === undefined ? undefined : s === 1 ? `${path}[${k}]` : `${path}.${k}`, memo, m);
|
|
105
|
+
if (l >= 0 && l < low) low = l;
|
|
106
|
+
if (memo.has(c) && memo.get(c) !== c || l === Infinity && m.changed.has(c)) changed = true;
|
|
107
|
+
}
|
|
108
|
+
if (!open) return -1;
|
|
109
|
+
if (low === index) {
|
|
110
|
+
m.at.set(value, Infinity);
|
|
111
|
+
if (m.stack[m.stack.length - 1] === value) {
|
|
112
|
+
m.stack.pop();
|
|
113
|
+
if (changed) m.changed.add(value);
|
|
114
|
+
return Infinity;
|
|
115
|
+
}
|
|
116
|
+
const members = m.stack.splice(m.stack.lastIndexOf(value));
|
|
117
|
+
if (!changed) for (const n of members) if (m.changed.has(n)) {
|
|
118
|
+
changed = true;
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
for (const n of members) {
|
|
122
|
+
m.at.set(n, Infinity);
|
|
123
|
+
if (changed) m.changed.add(n);
|
|
124
|
+
}
|
|
125
|
+
return Infinity;
|
|
126
|
+
}
|
|
127
|
+
if (changed) m.changed.add(value);
|
|
128
|
+
return low;
|
|
129
|
+
}
|
|
130
|
+
function clone(value, memo, changed) {
|
|
131
|
+
if (memo.has(value)) return memo.get(value);
|
|
132
|
+
if (!changed.has(value)) return value;
|
|
133
|
+
const out = Array.isArray(value) ? value.slice() : {
|
|
81
134
|
...value
|
|
82
135
|
};
|
|
83
136
|
memo.set(value, out);
|
|
84
|
-
if (
|
|
137
|
+
if (Array.isArray(value)) {
|
|
85
138
|
for (let i = 0; i < value.length; i++) {
|
|
86
139
|
const c = value[i];
|
|
87
|
-
if (c !== null && typeof c === "object") out[i] = clone(c,
|
|
140
|
+
if (c !== null && typeof c === "object") out[i] = clone(c, memo, changed);
|
|
88
141
|
}
|
|
89
142
|
} else {
|
|
90
143
|
for (const k of Object.keys(value)) {
|
|
91
144
|
const c = value[k];
|
|
92
|
-
if (c !== null && typeof c === "object") out[k] = clone(c,
|
|
145
|
+
if (c !== null && typeof c === "object") out[k] = clone(c, memo, changed);
|
|
93
146
|
}
|
|
94
147
|
}
|
|
95
148
|
return out;
|
|
@@ -242,7 +295,6 @@ function createKeyedSerializer(serialize, onError, onDone) {
|
|
|
242
295
|
pendingWrites++;
|
|
243
296
|
let settled = false;
|
|
244
297
|
let failed = false;
|
|
245
|
-
let started = false;
|
|
246
298
|
let cancel = null;
|
|
247
299
|
const settle = () => {
|
|
248
300
|
if (settled) return;
|
|
@@ -256,17 +308,14 @@ function createKeyedSerializer(serialize, onError, onDone) {
|
|
|
256
308
|
stream = serialize(key, value, {
|
|
257
309
|
onError: onError && (err => {
|
|
258
310
|
failed = true;
|
|
259
|
-
onError(err);
|
|
311
|
+
onError(err, key);
|
|
260
312
|
if (cancel) {
|
|
261
313
|
cancel();
|
|
262
314
|
settle();
|
|
263
315
|
}
|
|
264
316
|
}),
|
|
265
317
|
onDone: settle
|
|
266
|
-
},
|
|
267
|
-
if (initial) started = true;
|
|
268
|
-
return !closed;
|
|
269
|
-
});
|
|
318
|
+
}, () => !closed);
|
|
270
319
|
} catch (err) {
|
|
271
320
|
settle();
|
|
272
321
|
throw err;
|
|
@@ -316,7 +365,7 @@ function createJSONSerializer({
|
|
|
316
365
|
plugins: resolved.plugins,
|
|
317
366
|
disabledFeatures: resolved.disabledFeatures | serializeOnlyDisabledFeatures(resolved.serializeErrorStacks),
|
|
318
367
|
onParse(node, initial) {
|
|
319
|
-
if (live(
|
|
368
|
+
if (live()) onData({
|
|
320
369
|
key,
|
|
321
370
|
node,
|
|
322
371
|
initial
|
|
@@ -1020,10 +1069,9 @@ function frameStream(makeCode, options) {
|
|
|
1020
1069
|
};
|
|
1021
1070
|
}
|
|
1022
1071
|
function slotRange(occurrence) {
|
|
1023
|
-
return {
|
|
1024
|
-
t: `<!--slot:${occurrence}:start--><!--slot:${occurrence}:end-->`,
|
|
1072
|
+
return Object.assign(markup(`<!--slot:${occurrence}:start--><!--slot:${occurrence}:end-->`), {
|
|
1025
1073
|
$slot: true
|
|
1026
|
-
};
|
|
1074
|
+
});
|
|
1027
1075
|
}
|
|
1028
1076
|
function argBorderForm(value, needs) {
|
|
1029
1077
|
return toBorderForm(noteTraces(value, needs));
|
|
@@ -1160,6 +1208,16 @@ function suppressedFill(render) {
|
|
|
1160
1208
|
live.suppressed--;
|
|
1161
1209
|
}
|
|
1162
1210
|
}
|
|
1211
|
+
const SSR_NODE = Symbol.for("solid.ssrNode");
|
|
1212
|
+
const markup = (t, h, p) => h ? {
|
|
1213
|
+
t,
|
|
1214
|
+
h,
|
|
1215
|
+
p,
|
|
1216
|
+
$: SSR_NODE
|
|
1217
|
+
} : {
|
|
1218
|
+
t,
|
|
1219
|
+
$: SSR_NODE
|
|
1220
|
+
};
|
|
1163
1221
|
let parked = null;
|
|
1164
1222
|
let parkedIds = 0;
|
|
1165
1223
|
const PARKED = /<!--sc-n:(\d+)-->/;
|
|
@@ -1170,9 +1228,7 @@ function park(render) {
|
|
|
1170
1228
|
render,
|
|
1171
1229
|
out: undefined
|
|
1172
1230
|
});
|
|
1173
|
-
return {
|
|
1174
|
-
t: `<!--sc-n:${id}-->`
|
|
1175
|
-
};
|
|
1231
|
+
return markup(`<!--sc-n:${id}-->`);
|
|
1176
1232
|
}
|
|
1177
1233
|
const runParked = (entry, owner) => entry.out || (entry.out = entry.render(owner));
|
|
1178
1234
|
function placeParked(node, nested, owner) {
|
|
@@ -1190,22 +1246,14 @@ function expandParked(node, nested, owner) {
|
|
|
1190
1246
|
if (!node.h) return splitParked(node.t, nested, owner) || node;
|
|
1191
1247
|
const out = [];
|
|
1192
1248
|
node.t.forEach((t, i) => {
|
|
1193
|
-
out.push(splitParked(t, nested, owner) ||
|
|
1194
|
-
|
|
1195
|
-
});
|
|
1196
|
-
if (i < node.h.length) out.push({
|
|
1197
|
-
t: ["", ""],
|
|
1198
|
-
h: [node.h[i]],
|
|
1199
|
-
p: [node.p[i]]
|
|
1200
|
-
});
|
|
1249
|
+
out.push(splitParked(t, nested, owner) || markup(t));
|
|
1250
|
+
if (i < node.h.length) out.push(markup(["", ""], [node.h[i]], [node.p[i]]));
|
|
1201
1251
|
});
|
|
1202
1252
|
return out;
|
|
1203
1253
|
}
|
|
1204
1254
|
function splitParked(t, nested, owner) {
|
|
1205
1255
|
const parts = typeof t === "string" ? t.split(PARKED) : [t];
|
|
1206
|
-
return parts.length > 1 ? parts.map((part, i) => i & 1 ? runParked(nested.get(+part), owner) :
|
|
1207
|
-
t: part
|
|
1208
|
-
}) : undefined;
|
|
1256
|
+
return parts.length > 1 ? parts.map((part, i) => i & 1 ? runParked(nested.get(+part), owner) : markup(part)) : undefined;
|
|
1209
1257
|
}
|
|
1210
1258
|
function createDocumentSlotProps(clientProps, frameId) {
|
|
1211
1259
|
const counts = Object.create(null);
|
|
@@ -1238,11 +1286,7 @@ function createDocumentSlotProps(clientProps, frameId) {
|
|
|
1238
1286
|
const getters = new Map();
|
|
1239
1287
|
const repeats = new Map();
|
|
1240
1288
|
const range = (occurrence, content, tail) => {
|
|
1241
|
-
const r = [{
|
|
1242
|
-
t: `<!--slot:${occurrence}:start-->`
|
|
1243
|
-
}, content, tail, {
|
|
1244
|
-
t: `<!--slot:${occurrence}:end-->`
|
|
1245
|
-
}];
|
|
1289
|
+
const r = [markup(`<!--slot:${occurrence}:start-->`), content, tail, markup(`<!--slot:${occurrence}:end-->`)];
|
|
1246
1290
|
r.$slot = true;
|
|
1247
1291
|
return r;
|
|
1248
1292
|
};
|
|
@@ -1363,11 +1407,7 @@ function createDocumentSlotProps(clientProps, frameId) {
|
|
|
1363
1407
|
resolved[key] = () => {
|
|
1364
1408
|
if (region.locked) return [];
|
|
1365
1409
|
region.used = true;
|
|
1366
|
-
return [
|
|
1367
|
-
t: frameElementOpen(childId)
|
|
1368
|
-
}, region.nested && region.nested.size ? placeParked(value, region.nested, getOwner()) : value, {
|
|
1369
|
-
t: FRAME_ELEMENT_CLOSE
|
|
1370
|
-
}];
|
|
1410
|
+
return [markup(frameElementOpen(childId)), region.nested && region.nested.size ? placeParked(value, region.nested, getOwner()) : value, markup(FRAME_ELEMENT_CLOSE)];
|
|
1371
1411
|
};
|
|
1372
1412
|
} else if (ssrAsyncValue && isAsyncValue(value)) {
|
|
1373
1413
|
let readable = value;
|
|
@@ -1662,9 +1702,7 @@ function frameTransformDirectResult(value, {
|
|
|
1662
1702
|
const address = frameAddress(id, args);
|
|
1663
1703
|
const wrapped = props => {
|
|
1664
1704
|
const siteId = documentSiteId(id);
|
|
1665
|
-
return [
|
|
1666
|
-
t: frameElementOpen(siteId, address.slice(id.length + 1))
|
|
1667
|
-
},
|
|
1705
|
+
return [markup(frameElementOpen(siteId, address.slice(id.length + 1))),
|
|
1668
1706
|
serverOwned(() => {
|
|
1669
1707
|
const page = sharedConfig.context;
|
|
1670
1708
|
armDocumentLiveHoles(page);
|
|
@@ -1680,9 +1718,7 @@ function frameTransformDirectResult(value, {
|
|
|
1680
1718
|
} finally {
|
|
1681
1719
|
sharedConfig.context = page;
|
|
1682
1720
|
}
|
|
1683
|
-
}),
|
|
1684
|
-
t: FRAME_ELEMENT_CLOSE
|
|
1685
|
-
}];
|
|
1721
|
+
}), markup(FRAME_ELEMENT_CLOSE)];
|
|
1686
1722
|
};
|
|
1687
1723
|
wrapped[SERVER_COMPONENT] = id;
|
|
1688
1724
|
wrapped[SERVER_COMPONENT_SOURCE] = component;
|
|
@@ -1825,10 +1861,9 @@ function createSlotProps(sink, frame) {
|
|
|
1825
1861
|
if (repeat) return repeat;
|
|
1826
1862
|
if (sweeping && !live.scope) {
|
|
1827
1863
|
live.gateHit = true;
|
|
1828
|
-
return {
|
|
1829
|
-
t: "",
|
|
1864
|
+
return Object.assign(markup(""), {
|
|
1830
1865
|
$slot: true
|
|
1831
|
-
};
|
|
1866
|
+
});
|
|
1832
1867
|
}
|
|
1833
1868
|
const raw = callArgs[0];
|
|
1834
1869
|
let occurrence = keyedId(prop, raw);
|
|
@@ -2229,25 +2264,23 @@ function snapshot(shared, have) {
|
|
|
2229
2264
|
});
|
|
2230
2265
|
open.r[k] = record;
|
|
2231
2266
|
};
|
|
2232
|
-
|
|
2233
|
-
|
|
2267
|
+
const containers = [];
|
|
2268
|
+
const spliced = new Set();
|
|
2269
|
+
for (const entry of shared.records.values()) {
|
|
2270
|
+
const {
|
|
2234
2271
|
id,
|
|
2235
|
-
version,
|
|
2236
2272
|
k,
|
|
2237
2273
|
record
|
|
2238
|
-
}
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
k
|
|
2248
|
-
record
|
|
2249
|
-
} of shared.records.values()) {
|
|
2250
|
-
if (!k.startsWith("hole:lh:") || k.endsWith(":error") || !record || record.value == null) continue;
|
|
2274
|
+
} = entry;
|
|
2275
|
+
if (id !== shared.id || !record) continue;
|
|
2276
|
+
if (k === "" || /^seg:[^:]+$/.test(k)) {
|
|
2277
|
+
if (typeof record.value === "string") containers.push({
|
|
2278
|
+
e: entry,
|
|
2279
|
+
value: record.value
|
|
2280
|
+
});
|
|
2281
|
+
continue;
|
|
2282
|
+
}
|
|
2283
|
+
if (!k.startsWith("hole:lh:") || k.endsWith(":error") || record.value == null) continue;
|
|
2251
2284
|
const n = k.slice(8);
|
|
2252
2285
|
const startMark = `<!--lh:${n}-->`;
|
|
2253
2286
|
const endMark = `<!--lh:/${n}-->`;
|
|
@@ -2257,9 +2290,32 @@ function snapshot(shared, have) {
|
|
|
2257
2290
|
const end = c.value.indexOf(endMark, start);
|
|
2258
2291
|
if (end < 0) continue;
|
|
2259
2292
|
c.value = c.value.slice(0, start + startMark.length) + record.value + c.value.slice(end);
|
|
2293
|
+
spliced.add(entry);
|
|
2260
2294
|
break;
|
|
2261
2295
|
}
|
|
2262
2296
|
}
|
|
2297
|
+
if (!conditional) {
|
|
2298
|
+
for (const e of shared.records.values()) {
|
|
2299
|
+
const {
|
|
2300
|
+
id,
|
|
2301
|
+
version,
|
|
2302
|
+
k,
|
|
2303
|
+
record
|
|
2304
|
+
} = e;
|
|
2305
|
+
if (spliced.has(e)) continue;
|
|
2306
|
+
const c = containers.find(c => c.e === e);
|
|
2307
|
+
if (c && c.value !== record.value) {
|
|
2308
|
+
const holes = {};
|
|
2309
|
+
if (record.holes) for (const key in record.holes) if (key.startsWith("lha:")) holes[key] = record.holes[key];
|
|
2310
|
+
put(id, version, k, withHoles({
|
|
2311
|
+
...record,
|
|
2312
|
+
value: c.value,
|
|
2313
|
+
digest: k ? textDigest(c.value) : record.digest
|
|
2314
|
+
}, holeDigests(c.value, null, holes)));
|
|
2315
|
+
} else put(id, version, k, record);
|
|
2316
|
+
}
|
|
2317
|
+
return out;
|
|
2318
|
+
}
|
|
2263
2319
|
for (const e of shared.records.values()) {
|
|
2264
2320
|
const {
|
|
2265
2321
|
id,
|