@solidjs/web 2.0.0-rc.11 → 2.0.0-rc.13
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 +533 -106
- package/dist/server.js +437 -79
- package/dist/server.observe.js +449 -79
- package/dist/web.dev.js +35 -9
- package/dist/web.js +35 -9
- package/dist/web.observe.js +35 -9
- package/frames/dist/client.dev.js +362 -107
- package/frames/dist/client.js +317 -104
- package/frames/dist/client.observe.js +318 -103
- package/frames/dist/server.dev.js +288 -55
- package/frames/dist/server.js +235 -55
- package/frames/dist/server.observe.js +235 -55
- package/package.json +4 -3
- package/server-functions/dist/client.dev.js +79 -11
- package/server-functions/dist/client.observe.js +79 -11
- package/server-functions/dist/server.dev.js +30 -6
- package/server-functions/dist/server.js +30 -6
- package/server-functions/dist/server.observe.js +30 -6
- package/skills/server-components/SKILL.md +206 -0
- package/types/client.d.ts +17 -2
- package/types/frames/client.d.ts +1 -1
- package/types/frames/frame-client.d.ts +0 -18
- package/types/frames/frame-container-plugin.d.ts +0 -8
- package/types/frames/server.d.ts +28 -0
- package/types/frames/tree-rewrite.d.ts +39 -0
- package/types/index.server.d.ts +1 -1
- package/types/jsx.d.ts +11 -1
- package/types/observe.d.ts +178 -10
- package/types/request-error-hook.d.ts +5 -0
- package/types/server-observe.d.ts +8 -0
- package/types/server.d.ts +95 -8
|
@@ -1,10 +1,100 @@
|
|
|
1
|
-
import { ssrSanitizeError, creationStamp, ssrHandleError, runInServerComponentScope, shareAsyncIterable, getProjectionTrace } from 'solid-js/internal';
|
|
2
|
-
import {
|
|
3
|
-
import { isResponseEnvelope, renderToStream, createLiveHoles, CLAIMS_STREAM, CLAIMS_DOCUMENT,
|
|
1
|
+
import { sharedConfig, ssrSanitizeError, creationStamp, ssrHandleError, runInServerComponentScope, shareAsyncIterable, getProjectionTrace } from 'solid-js/internal';
|
|
2
|
+
import { OBSERVE, DEV, getOwner, NoHydration, runWithOwner, createMemo, Hydration, createOwner } from 'solid-js';
|
|
3
|
+
import { isResponseEnvelope, renderToStream, createLiveHoles, CLAIMS_STREAM, CLAIMS_DOCUMENT, SLOT_FACE_DATA, slotValue, SLOT_FACE_STREAM, SLOT_FACE_MARKUP, isSlotValue, SLOT_VALUE } from '@solidjs/web';
|
|
4
4
|
import { Feature, createStream, toCrossJSONStream } from 'seroval';
|
|
5
5
|
import { AbortSignalPlugin, CustomEventPlugin, DOMExceptionPlugin, EventPlugin, FormDataPlugin, HeadersPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLSearchParamsPlugin, URLPlugin } from 'seroval-plugins/web';
|
|
6
6
|
import { textDigest, frameAddress, getEventServerFunctionInvocation, armLiveBody, createEventChunk, createChunk, ChunkReader, serializeStream, guardFailures } from '@solidjs/web/server-functions/server';
|
|
7
7
|
|
|
8
|
+
const DESCEND = Symbol("descend");
|
|
9
|
+
const CYCLE = {};
|
|
10
|
+
const TRACK = 16;
|
|
11
|
+
function rewriteTree(value, visit, withPath) {
|
|
12
|
+
if (value === null || typeof value !== "object") return value;
|
|
13
|
+
const path = withPath ? "" : undefined;
|
|
14
|
+
const state = {
|
|
15
|
+
memo: undefined,
|
|
16
|
+
ancestors: undefined
|
|
17
|
+
};
|
|
18
|
+
try {
|
|
19
|
+
return cow(value, visit, path, 0, state);
|
|
20
|
+
} catch (err) {
|
|
21
|
+
if (err !== CYCLE) throw err;
|
|
22
|
+
}
|
|
23
|
+
return clone(value, visit, path, state.memo || (state.memo = new Map()));
|
|
24
|
+
}
|
|
25
|
+
function shape(value) {
|
|
26
|
+
return Array.isArray(value) ? 1 : Object.getPrototypeOf(value) === Object.prototype ? 2 : 0;
|
|
27
|
+
}
|
|
28
|
+
function cow(value, visit, path, depth, state) {
|
|
29
|
+
const memo = state.memo;
|
|
30
|
+
if (memo !== undefined && memo.has(value)) return memo.get(value);
|
|
31
|
+
const r = visit(value, path);
|
|
32
|
+
if (r !== DESCEND) {
|
|
33
|
+
if (r !== value) (memo || (state.memo = new Map())).set(value, r);
|
|
34
|
+
return r;
|
|
35
|
+
}
|
|
36
|
+
const s = shape(value);
|
|
37
|
+
if (s === 0) return value;
|
|
38
|
+
let ancestors;
|
|
39
|
+
if (depth >= TRACK) {
|
|
40
|
+
ancestors = state.ancestors || (state.ancestors = new Set());
|
|
41
|
+
if (ancestors.has(value)) throw CYCLE;
|
|
42
|
+
ancestors.add(value);
|
|
43
|
+
}
|
|
44
|
+
let out = value;
|
|
45
|
+
if (s === 1) {
|
|
46
|
+
for (let i = 0; i < value.length; i++) {
|
|
47
|
+
const c = value[i];
|
|
48
|
+
if (c === null || typeof c !== "object") continue;
|
|
49
|
+
const next = cow(c, visit, path === undefined ? undefined : `${path}[${i}]`, depth + 1, state);
|
|
50
|
+
if (next !== c) {
|
|
51
|
+
if (out === value) out = value.slice();
|
|
52
|
+
out[i] = next;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
} else {
|
|
56
|
+
for (const k of Object.keys(value)) {
|
|
57
|
+
const c = value[k];
|
|
58
|
+
if (c === null || typeof c !== "object") continue;
|
|
59
|
+
const next = cow(c, visit, path === undefined ? undefined : `${path}.${k}`, depth + 1, state);
|
|
60
|
+
if (next !== c) {
|
|
61
|
+
if (out === value) out = {
|
|
62
|
+
...value
|
|
63
|
+
};
|
|
64
|
+
out[k] = next;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (ancestors !== undefined) ancestors.delete(value);
|
|
69
|
+
return out;
|
|
70
|
+
}
|
|
71
|
+
function clone(value, visit, path, memo) {
|
|
72
|
+
if (memo.has(value)) return memo.get(value);
|
|
73
|
+
const r = visit(value, path);
|
|
74
|
+
if (r !== DESCEND) {
|
|
75
|
+
memo.set(value, r);
|
|
76
|
+
return r;
|
|
77
|
+
}
|
|
78
|
+
const s = shape(value);
|
|
79
|
+
if (s === 0) return value;
|
|
80
|
+
const out = s === 1 ? value.slice() : {
|
|
81
|
+
...value
|
|
82
|
+
};
|
|
83
|
+
memo.set(value, out);
|
|
84
|
+
if (s === 1) {
|
|
85
|
+
for (let i = 0; i < value.length; i++) {
|
|
86
|
+
const c = value[i];
|
|
87
|
+
if (c !== null && typeof c === "object") out[i] = clone(c, visit, path === undefined ? undefined : `${path}[${i}]`, memo);
|
|
88
|
+
}
|
|
89
|
+
} else {
|
|
90
|
+
for (const k of Object.keys(value)) {
|
|
91
|
+
const c = value[k];
|
|
92
|
+
if (c !== null && typeof c === "object") out[k] = clone(c, visit, path === undefined ? undefined : `${path}.${k}`, memo);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return out;
|
|
96
|
+
}
|
|
97
|
+
|
|
8
98
|
const STATE = Symbol.for("solid.container-trace-state");
|
|
9
99
|
const state = globalThis[STATE] || (globalThis[STATE] = {
|
|
10
100
|
materialized: new WeakMap(),
|
|
@@ -29,38 +119,16 @@ function toBorderForm(value, envelopeContainers) {
|
|
|
29
119
|
const resolve = state.resolveTrace ;
|
|
30
120
|
const share = state.shareIterable;
|
|
31
121
|
if (!resolve && !share) return value;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
if (share && isShareableIterable(value)) return share(value);
|
|
39
|
-
if (Array.isArray(value)) {
|
|
40
|
-
let out = value;
|
|
41
|
-
for (let i = 0; i < value.length; i++) {
|
|
42
|
-
const next = toBorderForm(value[i]);
|
|
43
|
-
if (next !== value[i]) {
|
|
44
|
-
if (out === value) out = value.slice();
|
|
45
|
-
out[i] = next;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return out;
|
|
49
|
-
}
|
|
50
|
-
if (Object.getPrototypeOf(value) === Object.prototype) {
|
|
51
|
-
let out = value;
|
|
52
|
-
for (const key of Object.keys(value)) {
|
|
53
|
-
const next = toBorderForm(value[key]);
|
|
54
|
-
if (next !== value[key]) {
|
|
55
|
-
if (out === value) out = {
|
|
56
|
-
...value
|
|
57
|
-
};
|
|
58
|
-
out[key] = next;
|
|
59
|
-
}
|
|
122
|
+
return rewriteTree(value, v => {
|
|
123
|
+
if (resolve) {
|
|
124
|
+
const trace = resolve(v);
|
|
125
|
+
if (trace) return {
|
|
126
|
+
[TRACE]: trace
|
|
127
|
+
};
|
|
60
128
|
}
|
|
61
|
-
return
|
|
62
|
-
|
|
63
|
-
|
|
129
|
+
if (share && isShareableIterable(v)) return share(v);
|
|
130
|
+
return DESCEND;
|
|
131
|
+
}, false);
|
|
64
132
|
}
|
|
65
133
|
function isShareableIterable(value) {
|
|
66
134
|
try {
|
|
@@ -120,6 +188,15 @@ const ContainerTracePlugin = {
|
|
|
120
188
|
}
|
|
121
189
|
};
|
|
122
190
|
|
|
191
|
+
function emitFinding(finding, subject = getOwner()) {
|
|
192
|
+
if (OBSERVE === undefined) return;
|
|
193
|
+
const entry = OBSERVE.diagnostics.emit(finding, subject);
|
|
194
|
+
if (DEV !== undefined) DEV.report(entry);
|
|
195
|
+
}
|
|
196
|
+
function devCheck(finding, subject) {
|
|
197
|
+
emitFinding(finding, subject);
|
|
198
|
+
}
|
|
199
|
+
|
|
123
200
|
setContainerTraceStreamMint(iterable => {
|
|
124
201
|
const stream = createStream();
|
|
125
202
|
(async () => {
|
|
@@ -818,9 +895,96 @@ function frameStream(makeCode, options) {
|
|
|
818
895
|
function slotRange(occurrence) {
|
|
819
896
|
return {
|
|
820
897
|
t: `<!--slot:${occurrence}:start--><!--slot:${occurrence}:end-->`,
|
|
821
|
-
$slot: true
|
|
898
|
+
$slot: true,
|
|
899
|
+
$occurrence: occurrence
|
|
822
900
|
};
|
|
823
901
|
}
|
|
902
|
+
const RANGE_KEYS = new Set(["t", "h", "p", "then", "length", "slice", "constructor", "toString", "valueOf", "toJSON"]);
|
|
903
|
+
const NODE_KEYS = new Set(["t", "h", "p"]);
|
|
904
|
+
function isRangeKey(key) {
|
|
905
|
+
const c = key.charCodeAt(0);
|
|
906
|
+
return c === 36 || c >= 48 && c <= 57 || RANGE_KEYS.has(key);
|
|
907
|
+
}
|
|
908
|
+
function slotProxy(range, occurrence, face, content, onData) {
|
|
909
|
+
return new Proxy(range, {
|
|
910
|
+
get(target, key, receiver) {
|
|
911
|
+
if (typeof key !== "string" || isRangeKey(key)) return Reflect.get(target, key, receiver);
|
|
912
|
+
if (onData) onData = void onData();
|
|
913
|
+
return slotValue(occurrence, key, content ? content[key] : undefined, face);
|
|
914
|
+
}
|
|
915
|
+
});
|
|
916
|
+
}
|
|
917
|
+
function argBorderForm(value, key, occurrence) {
|
|
918
|
+
return toBorderForm(withoutStandIns(value, key, occurrence));
|
|
919
|
+
}
|
|
920
|
+
function withoutStandIns(value, key, occurrence) {
|
|
921
|
+
return rewriteTree(value, (v, path) => {
|
|
922
|
+
if (isContainerTraced(v)) return v;
|
|
923
|
+
if (Object.getPrototypeOf(v) === Object.prototype && isSlotValue(v)) {
|
|
924
|
+
standInArgFinding(v, key, occurrence, path);
|
|
925
|
+
return undefined;
|
|
926
|
+
}
|
|
927
|
+
return DESCEND;
|
|
928
|
+
}, true);
|
|
929
|
+
}
|
|
930
|
+
function standInArgFinding(sv, key, occurrence, path) {
|
|
931
|
+
{
|
|
932
|
+
const ctx = sharedConfig.context;
|
|
933
|
+
if (ctx) {
|
|
934
|
+
const id = `${occurrence}\u0000${key}${path}\u0000arg`;
|
|
935
|
+
const seen = ctx.slotFindings || (ctx.slotFindings = new Set());
|
|
936
|
+
if (seen.has(id)) return;
|
|
937
|
+
seen.add(id);
|
|
938
|
+
}
|
|
939
|
+
const where = path === "" ? `Arg \`${key}\`` : `Arg \`${key}${path}\``;
|
|
940
|
+
devCheck({
|
|
941
|
+
code: "ATTRIBUTE_SLOT_POSITION",
|
|
942
|
+
kind: "ssr",
|
|
943
|
+
severity: "warn",
|
|
944
|
+
message: `[ATTRIBUTE_SLOT_POSITION] ${where} of \`${occurrence}\` is another slot's value ` + `(\`${sv.k}\` of \`${sv[SLOT_VALUE]}\`). The server does not have it — the client owns ` + `it — so it cannot be passed as data; the arg carries \`undefined\` there on both faces. ` + `Pass the server's own value, or have the client fill read it from its own state.`,
|
|
945
|
+
data: {
|
|
946
|
+
reason: "arg",
|
|
947
|
+
occurrence,
|
|
948
|
+
key,
|
|
949
|
+
path: path === "" ? undefined : path,
|
|
950
|
+
from: sv[SLOT_VALUE],
|
|
951
|
+
fromKey: sv.k
|
|
952
|
+
}
|
|
953
|
+
});
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
function slotFace(range, content) {
|
|
957
|
+
if (content == null) return SLOT_FACE_DATA;
|
|
958
|
+
if (typeof content !== "object" || Array.isArray(content)) return SLOT_FACE_MARKUP;
|
|
959
|
+
if (isServerContent(content)) {
|
|
960
|
+
let data = false;
|
|
961
|
+
for (const key in content) {
|
|
962
|
+
if (!NODE_KEYS.has(key)) {
|
|
963
|
+
data = true;
|
|
964
|
+
break;
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
if (!data) return SLOT_FACE_MARKUP;
|
|
968
|
+
}
|
|
969
|
+
{
|
|
970
|
+
for (const key of Object.keys(content)) {
|
|
971
|
+
if (isRangeKey(key)) {
|
|
972
|
+
devCheck({
|
|
973
|
+
code: "ATTRIBUTE_SLOT_POSITION",
|
|
974
|
+
kind: "ssr",
|
|
975
|
+
severity: "warn",
|
|
976
|
+
message: `[ATTRIBUTE_SLOT_POSITION] The fill for \`${range.$occurrence}\` returned a key named \`${key}\`, ` + `which is reserved (keys beginning with \`$\` or a digit, \`length\`, \`slice\`, the node keys \`t\`/\`h\`/\`p\`, ` + `\`then\`, \`constructor\`, \`toString\`, \`valueOf\`, \`toJSON\`): the server reads it as the ` + `slot's range, not as a value. Rename it.`,
|
|
977
|
+
data: {
|
|
978
|
+
reason: "reserved-key",
|
|
979
|
+
occurrence: range.$occurrence,
|
|
980
|
+
key
|
|
981
|
+
}
|
|
982
|
+
});
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
return SLOT_FACE_DATA;
|
|
987
|
+
}
|
|
824
988
|
const OCCURRENCE_UNSAFE = /[^A-Za-z0-9_.-]/g;
|
|
825
989
|
function encodeOccurrenceKey(key) {
|
|
826
990
|
return String(key).replace(OCCURRENCE_UNSAFE, c => {
|
|
@@ -829,14 +993,58 @@ function encodeOccurrenceKey(key) {
|
|
|
829
993
|
});
|
|
830
994
|
}
|
|
831
995
|
function occurrenceId(prop, raw, counts) {
|
|
832
|
-
const
|
|
833
|
-
if (
|
|
834
|
-
return `${prop}#${encodeOccurrenceKey(k)}`;
|
|
835
|
-
}
|
|
996
|
+
const keyed = keyedId(prop, raw);
|
|
997
|
+
if (keyed !== undefined) return keyed;
|
|
836
998
|
const n = counts[prop] || 0;
|
|
837
999
|
counts[prop] = n + 1;
|
|
838
1000
|
return `${prop}#${n}`;
|
|
839
1001
|
}
|
|
1002
|
+
function keyedId(prop, raw) {
|
|
1003
|
+
const k = raw.$key;
|
|
1004
|
+
return typeof k === "string" || typeof k === "number" ? `${prop}#${encodeOccurrenceKey(k)}` : undefined;
|
|
1005
|
+
}
|
|
1006
|
+
function structuralArgsKey(raw) {
|
|
1007
|
+
let out = "";
|
|
1008
|
+
let ancestors;
|
|
1009
|
+
const walk = (v, top) => {
|
|
1010
|
+
if (v === null) out += "N";else if (typeof v === "string") out += "s" + v.length + ":" + v;else if (typeof v === "boolean") out += v ? "T" : "F";else if (typeof v === "undefined") out += "U";else if (typeof v === "number") out += "n" + v + ";";else if (typeof v === "bigint") out += "b" + v + ";";else if (typeof v !== "object") return false;else {
|
|
1011
|
+
const isArray = Array.isArray(v);
|
|
1012
|
+
if (!isArray) {
|
|
1013
|
+
const proto = Object.getPrototypeOf(v);
|
|
1014
|
+
if (proto !== Object.prototype && proto !== null) return false;
|
|
1015
|
+
}
|
|
1016
|
+
if (ancestors === undefined) ancestors = new Set();else if (ancestors.has(v)) return false;
|
|
1017
|
+
ancestors.add(v);
|
|
1018
|
+
try {
|
|
1019
|
+
if (isArray) {
|
|
1020
|
+
out += "[";
|
|
1021
|
+
for (const item of v) if (!walk(item)) return false;
|
|
1022
|
+
out += "]";
|
|
1023
|
+
} else {
|
|
1024
|
+
out += "{";
|
|
1025
|
+
for (const k of Object.keys(v).sort()) {
|
|
1026
|
+
if (top && k === "$key") continue;
|
|
1027
|
+
const desc = Object.getOwnPropertyDescriptor(v, k);
|
|
1028
|
+
if (desc.get || desc.set) return false;
|
|
1029
|
+
out += "k" + k.length + ":" + k;
|
|
1030
|
+
if (!walk(desc.value)) return false;
|
|
1031
|
+
}
|
|
1032
|
+
out += "}";
|
|
1033
|
+
}
|
|
1034
|
+
} finally {
|
|
1035
|
+
ancestors.delete(v);
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
return true;
|
|
1039
|
+
};
|
|
1040
|
+
return walk(raw, true) ? out : undefined;
|
|
1041
|
+
}
|
|
1042
|
+
function repeatKey(prop, raw) {
|
|
1043
|
+
const keyed = keyedId(prop, raw);
|
|
1044
|
+
if (keyed !== undefined) return keyed;
|
|
1045
|
+
const structural = structuralArgsKey(raw);
|
|
1046
|
+
return structural === undefined ? undefined : prop + "\0" + structural;
|
|
1047
|
+
}
|
|
840
1048
|
function isAsyncValue(v) {
|
|
841
1049
|
return !!v && typeof v === "object" && (typeof v.then === "function" || typeof v[Symbol.asyncIterator] === "function");
|
|
842
1050
|
}
|
|
@@ -865,6 +1073,7 @@ function suppressedFill(render) {
|
|
|
865
1073
|
function createDocumentSlotProps(clientProps, frameId) {
|
|
866
1074
|
const counts = Object.create(null);
|
|
867
1075
|
const getters = new Map();
|
|
1076
|
+
const repeats = new Map();
|
|
868
1077
|
const range = (occurrence, content) => {
|
|
869
1078
|
const r = [{
|
|
870
1079
|
t: `<!--slot:${occurrence}:start-->`
|
|
@@ -872,7 +1081,10 @@ function createDocumentSlotProps(clientProps, frameId) {
|
|
|
872
1081
|
t: `<!--slot:${occurrence}:end-->`
|
|
873
1082
|
}];
|
|
874
1083
|
r.$slot = true;
|
|
875
|
-
|
|
1084
|
+
r.$occurrence = occurrence;
|
|
1085
|
+
const face = slotFace(r, content);
|
|
1086
|
+
r.$face = face;
|
|
1087
|
+
return slotProxy(r, occurrence, face, face === SLOT_FACE_DATA ? content : undefined);
|
|
876
1088
|
};
|
|
877
1089
|
const zoneOwner = getOwner ? getOwner() : null;
|
|
878
1090
|
const scoped = (occurrence, render) => {
|
|
@@ -896,12 +1108,20 @@ function createDocumentSlotProps(clientProps, frameId) {
|
|
|
896
1108
|
if (!fn) {
|
|
897
1109
|
fn = (...callArgs) => {
|
|
898
1110
|
if (callArgs.length === 0 || callArgs[0] === undefined) {
|
|
899
|
-
|
|
1111
|
+
const rk = prop + "\0";
|
|
1112
|
+
const repeat = repeats.get(rk);
|
|
1113
|
+
if (repeat) return repeat;
|
|
1114
|
+
const out = suppressedFill(() => scoped(prop, () => {
|
|
900
1115
|
const value = clientProps[prop];
|
|
901
1116
|
return range(prop, typeof value === "function" ? value() : value);
|
|
902
1117
|
}));
|
|
1118
|
+
if (out.$face === SLOT_FACE_DATA) repeats.set(rk, out);
|
|
1119
|
+
return out;
|
|
903
1120
|
}
|
|
904
1121
|
const raw = callArgs[0];
|
|
1122
|
+
const rk = repeatKey(prop, raw);
|
|
1123
|
+
const repeat = rk !== undefined && repeats.get(rk);
|
|
1124
|
+
if (repeat) return repeat;
|
|
905
1125
|
const occurrence = occurrenceId(prop, raw, counts);
|
|
906
1126
|
const slot = clientProps[prop];
|
|
907
1127
|
if (typeof slot !== "function") return range(occurrence, undefined);
|
|
@@ -993,7 +1213,7 @@ function createDocumentSlotProps(clientProps, frameId) {
|
|
|
993
1213
|
configurable: true
|
|
994
1214
|
});
|
|
995
1215
|
} else {
|
|
996
|
-
resolved[key] = value;
|
|
1216
|
+
resolved[key] = vals[key] = withoutStandIns(value, key, occurrence);
|
|
997
1217
|
}
|
|
998
1218
|
}
|
|
999
1219
|
const out = suppressedFill(() => scoped(occurrence, () => range(occurrence, slot(resolved))));
|
|
@@ -1010,7 +1230,7 @@ function createDocumentSlotProps(clientProps, frameId) {
|
|
|
1010
1230
|
continue;
|
|
1011
1231
|
}
|
|
1012
1232
|
if (!isContainerTraced(value) && isServerContent(value)) continue;
|
|
1013
|
-
args[key] =
|
|
1233
|
+
args[key] = argBorderForm(value, key, occurrence);
|
|
1014
1234
|
}
|
|
1015
1235
|
sharedConfig.context.serialize(`sc:slot:${frameId}:${occurrence}`, {
|
|
1016
1236
|
...args
|
|
@@ -1025,7 +1245,7 @@ function createDocumentSlotProps(clientProps, frameId) {
|
|
|
1025
1245
|
if (minted[key]) continue;
|
|
1026
1246
|
const ledgerKey = `${frameId}:${occurrence}:${key}`;
|
|
1027
1247
|
openArgBinding(liveArgs, ledgerKey, occurrence, key, evals[key], states[key], value => {
|
|
1028
|
-
args[key] =
|
|
1248
|
+
args[key] = argBorderForm(value, key, occurrence);
|
|
1029
1249
|
liveArgs.slot(frameId, occurrence, {
|
|
1030
1250
|
...args
|
|
1031
1251
|
});
|
|
@@ -1033,10 +1253,10 @@ function createDocumentSlotProps(clientProps, frameId) {
|
|
|
1033
1253
|
}
|
|
1034
1254
|
}
|
|
1035
1255
|
}
|
|
1256
|
+
if (rk !== undefined && (rk === occurrence || out.$face === SLOT_FACE_DATA)) repeats.has(rk) || repeats.set(rk, out);
|
|
1036
1257
|
return out;
|
|
1037
1258
|
};
|
|
1038
1259
|
fn.$lhSkip = true;
|
|
1039
|
-
fn[CLAIM_PROP] = prop;
|
|
1040
1260
|
getters.set(prop, fn);
|
|
1041
1261
|
}
|
|
1042
1262
|
return fn;
|
|
@@ -1061,7 +1281,7 @@ function armDocumentLiveHoles(ctx) {
|
|
|
1061
1281
|
}
|
|
1062
1282
|
return;
|
|
1063
1283
|
}
|
|
1064
|
-
if (!live || !ctx.async ||
|
|
1284
|
+
if (!live || !ctx.async || !ctx.serialize || typeof ReadableStream !== "function") {
|
|
1065
1285
|
ctx.liveHoles = null;
|
|
1066
1286
|
if (live) live.holes = null;
|
|
1067
1287
|
return;
|
|
@@ -1169,10 +1389,17 @@ function frameTransformDirectResult(value, {
|
|
|
1169
1389
|
t: frameElementOpen(id)
|
|
1170
1390
|
},
|
|
1171
1391
|
serverOwned(() => {
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
const
|
|
1175
|
-
|
|
1392
|
+
const page = sharedConfig.context;
|
|
1393
|
+
armDocumentLiveHoles(page);
|
|
1394
|
+
const ctx = Object.create(page);
|
|
1395
|
+
ctx.claims = CLAIMS_DOCUMENT;
|
|
1396
|
+
sharedConfig.context = ctx;
|
|
1397
|
+
try {
|
|
1398
|
+
const slotProps = createDocumentSlotProps(props, id);
|
|
1399
|
+
return serverComponentScope(() => component(slotProps), !!wrapped[LIVE_SOURCE]);
|
|
1400
|
+
} finally {
|
|
1401
|
+
sharedConfig.context = page;
|
|
1402
|
+
}
|
|
1176
1403
|
}), {
|
|
1177
1404
|
t: FRAME_ELEMENT_CLOSE
|
|
1178
1405
|
}];
|
|
@@ -1280,6 +1507,7 @@ function openArgBinding(sink, ledgerKey, occurrence, key, evaluate, state, emit)
|
|
|
1280
1507
|
function createSlotProps(sink, frame) {
|
|
1281
1508
|
const counts = Object.create(null);
|
|
1282
1509
|
const getters = new Map();
|
|
1510
|
+
const repeats = new Map();
|
|
1283
1511
|
return new Proxy(Object.create(null), {
|
|
1284
1512
|
has() {
|
|
1285
1513
|
return true;
|
|
@@ -1291,8 +1519,11 @@ function createSlotProps(sink, frame) {
|
|
|
1291
1519
|
if (!fn) {
|
|
1292
1520
|
fn = (...callArgs) => {
|
|
1293
1521
|
if (callArgs.length === 0 || callArgs[0] === undefined) {
|
|
1294
|
-
return slotRange(prop);
|
|
1522
|
+
return slotProxy(slotRange(prop), prop, SLOT_FACE_STREAM, undefined);
|
|
1295
1523
|
}
|
|
1524
|
+
const rk = repeatKey(prop, callArgs[0]);
|
|
1525
|
+
const repeat = rk !== undefined && repeats.get(rk);
|
|
1526
|
+
if (repeat) return repeat;
|
|
1296
1527
|
const live = sharedConfig.context && sharedConfig.context.liveHoles;
|
|
1297
1528
|
if (live) {
|
|
1298
1529
|
if (live.sweeping) {
|
|
@@ -1369,7 +1600,7 @@ function createSlotProps(sink, frame) {
|
|
|
1369
1600
|
};
|
|
1370
1601
|
} else {
|
|
1371
1602
|
const ref = `arg:${occurrence}:${key}`;
|
|
1372
|
-
ctx.serialize(ref,
|
|
1603
|
+
ctx.serialize(ref, argBorderForm(value, key, occurrence));
|
|
1373
1604
|
args[key] = {
|
|
1374
1605
|
$ref: ref
|
|
1375
1606
|
};
|
|
@@ -1401,7 +1632,7 @@ function createSlotProps(sink, frame) {
|
|
|
1401
1632
|
} else {
|
|
1402
1633
|
const ref = `arg:${occurrence}:${key}@${sink.nextArgRef(ledgerKey)}`;
|
|
1403
1634
|
sink.mintRef(ref);
|
|
1404
|
-
ctx.serialize(ref,
|
|
1635
|
+
ctx.serialize(ref, argBorderForm(value, key, occurrence));
|
|
1405
1636
|
args[key] = {
|
|
1406
1637
|
$ref: ref
|
|
1407
1638
|
};
|
|
@@ -1411,10 +1642,12 @@ function createSlotProps(sink, frame) {
|
|
|
1411
1642
|
});
|
|
1412
1643
|
});
|
|
1413
1644
|
}
|
|
1414
|
-
|
|
1645
|
+
const keyed = rk === occurrence;
|
|
1646
|
+
const out = slotProxy(slotRange(occurrence), occurrence, SLOT_FACE_STREAM, undefined, rk === undefined || keyed ? undefined : () => repeats.has(rk) || repeats.set(rk, out));
|
|
1647
|
+
if (keyed) repeats.set(rk, out);
|
|
1648
|
+
return out;
|
|
1415
1649
|
};
|
|
1416
1650
|
fn.$lhSkip = true;
|
|
1417
|
-
fn[CLAIM_PROP] = prop;
|
|
1418
1651
|
getters.set(prop, fn);
|
|
1419
1652
|
}
|
|
1420
1653
|
return fn;
|