@solidjs/web 2.0.0-rc.2 → 2.0.0-rc.21
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/README.md +1 -1
- package/dist/server.dev.js +5165 -0
- package/dist/server.js +1876 -374
- package/dist/{server.cjs → server.observe.js} +2070 -577
- package/dist/{dev.cjs → web.dev.js} +955 -567
- package/dist/web.js +646 -350
- package/dist/{dev.js → web.observe.js} +699 -421
- package/frames/dist/assets.js +92 -0
- package/frames/dist/client.dev.js +1296 -1198
- package/frames/dist/client.js +1128 -1191
- package/frames/dist/client.observe.js +2041 -0
- package/frames/dist/regions.js +171 -0
- package/frames/dist/server.dev.js +2545 -0
- package/frames/dist/server.js +1683 -3004
- package/frames/dist/server.observe.js +2544 -0
- package/frames/dist/trace.js +45 -0
- package/frames/dist/wire.js +594 -0
- package/frames/package.json +2 -25
- package/package.json +244 -256
- package/performance-tracks/dist/performance-tracks.dev.js +679 -0
- package/performance-tracks/dist/performance-tracks.js +6 -0
- package/performance-tracks/dist/performance-tracks.observe.js +667 -0
- package/performance-tracks/package.json +7 -0
- package/performance-tracks/types/index.d.ts +69 -0
- package/serialization/decode/package.json +2 -15
- package/serialization/dist/decode.js +121 -25
- package/serialization/dist/serialization.js +282 -88
- package/serialization/package.json +2 -15
- package/serialization/types/index.d.ts +115 -153
- package/serialization/types/serializer-decode.d.ts +173 -114
- package/serialization/types/serializer.d.ts +144 -0
- package/server-functions/dist/client.dev.js +1462 -0
- package/server-functions/dist/client.js +667 -165
- package/server-functions/dist/client.observe.js +1441 -0
- package/server-functions/dist/rich-args.js +102 -1
- package/server-functions/dist/server.dev.js +2802 -299
- package/server-functions/dist/server.js +2724 -314
- package/server-functions/dist/server.observe.js +3680 -0
- package/server-functions/package.json +2 -35
- package/server-functions/rich-args/package.json +2 -15
- package/skills/server-components/SKILL.md +117 -0
- package/storage/package.json +2 -15
- package/types/client.d.ts +342 -288
- package/types/constants.d.ts +22 -0
- package/types/cookies.d.ts +32 -84
- package/types/diagnostics.d.ts +80 -0
- package/types/frames/assets-tier.d.ts +78 -0
- package/types/frames/client.d.ts +40 -1
- package/types/frames/frame-client.d.ts +443 -280
- package/types/frames/frame-container-plugin.d.ts +64 -0
- package/types/frames/frame-morph.d.ts +29 -0
- package/types/frames/frame-sink.d.ts +141 -161
- package/types/frames/frame-transport.d.ts +263 -184
- package/types/frames/regions-tier.d.ts +60 -0
- package/types/frames/serializer-decode.d.ts +241 -0
- package/types/frames/serializer.d.ts +115 -153
- package/types/frames/server.d.ts +2 -2
- package/types/frames/trace-tier.d.ts +2 -0
- package/types/frames/tree-rewrite.d.ts +39 -0
- package/types/frames/wire-tier.d.ts +169 -0
- package/types/head.d.ts +20 -0
- package/types/index.d.ts +98 -81
- package/types/index.server.d.ts +159 -0
- package/types/jsx.d.ts +49 -44
- package/types/observe.d.ts +535 -0
- package/types/reconcile.d.ts +1 -0
- package/types/render.d.ts +11 -0
- package/types/request-error-hook.d.ts +5 -0
- package/types/response.d.ts +95 -147
- package/types/serializer-decode.d.ts +173 -114
- package/types/serializer.d.ts +115 -153
- package/types/server-functions/argument-codec.d.ts +30 -0
- package/types/server-functions/client.d.ts +237 -223
- package/types/server-functions/flash.d.ts +28 -30
- package/types/server-functions/registry.d.ts +105 -0
- package/types/server-functions/rich-args.d.ts +1 -10
- package/types/server-functions/server.d.ts +538 -531
- package/types/server-functions/shared.d.ts +398 -425
- package/types/server-functions/uploads.d.ts +53 -0
- package/types/server-mock.d.ts +154 -20
- package/types/server-observe.d.ts +86 -0
- package/types/server.d.ts +601 -422
- package/types/trace.d.ts +127 -0
- package/LICENSE +0 -21
- package/dist/web.cjs +0 -2033
- package/frames/dist/client.cjs +0 -2002
- package/frames/dist/client.dev.cjs +0 -2022
- package/frames/dist/server.cjs +0 -3877
- package/serialization/dist/decode.cjs +0 -139
- package/serialization/dist/serialization.cjs +0 -261
- package/serialization/types-cjs/index.d.cts +0 -182
- package/serialization/types-cjs/package.json +0 -3
- package/serialization/types-cjs/serializer-decode.d.cts +0 -182
- package/server-functions/dist/client.cjs +0 -834
- package/server-functions/dist/rich-args.cjs +0 -11
- package/server-functions/dist/server.cjs +0 -1242
- package/server-functions/dist/server.dev.cjs +0 -1242
- package/storage/dist/storage.cjs +0 -12
- package/storage/types-cjs/index.d.cts +0 -28
- package/storage/types-cjs/package.json +0 -3
- package/types/core.d.ts +0 -9
- package/types-cjs/client.d.cts +0 -337
- package/types-cjs/cookies.d.cts +0 -93
- package/types-cjs/core.d.cts +0 -9
- package/types-cjs/frames/client.d.cts +0 -36
- package/types-cjs/frames/frame-client.d.cts +0 -356
- package/types-cjs/frames/frame-sink.d.cts +0 -194
- package/types-cjs/frames/frame-transport.d.cts +0 -222
- package/types-cjs/frames/serializer.d.cts +0 -182
- package/types-cjs/frames/server.d.cts +0 -52
- package/types-cjs/index.d.cts +0 -244
- package/types-cjs/jsx-properties.d.cts +0 -93
- package/types-cjs/jsx.d.cts +0 -4159
- package/types-cjs/package.json +0 -3
- package/types-cjs/response.d.cts +0 -174
- package/types-cjs/serializer-decode.d.cts +0 -182
- package/types-cjs/serializer.d.cts +0 -182
- package/types-cjs/server-functions/client.d.cts +0 -262
- package/types-cjs/server-functions/flash.d.cts +0 -38
- package/types-cjs/server-functions/rich-args.d.cts +0 -10
- package/types-cjs/server-functions/server.d.cts +0 -681
- package/types-cjs/server-functions/shared.d.cts +0 -523
- package/types-cjs/server-mock.d.cts +0 -286
- package/types-cjs/server.d.cts +0 -544
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { createRenderEffect, createMemo, OBSERVE, getOwner, createRoot, $PROXY, onCleanup, runWithOwner, createComponent, omit, getNextChildId } from 'solid-js';
|
|
2
|
+
export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, dynamicComponent, getOwner, merge as mergeProps, untrack } from 'solid-js';
|
|
3
|
+
import { sharedConfig, ssrSanitizeError, beginEdgesRender, reportServerError, viewOf, sourceOwners, ssrHandleError, inServerComponentScope, creationStamp, dynamicCore, getProjectionTrace, shareAsyncIterable } from 'solid-js/internal';
|
|
4
|
+
export { ssrScope as scope } from 'solid-js/internal';
|
|
5
|
+
import { createStream, Feature, crossSerializeStream, isStream, getCrossReferenceHeader } from 'seroval';
|
|
6
|
+
import { AbortSignalPlugin, CustomEventPlugin, DOMExceptionPlugin, EventPlugin, FormDataPlugin, HeadersPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLSearchParamsPlugin, URLPlugin } from 'seroval-plugins/web';
|
|
6
7
|
|
|
7
8
|
const DOMWithState = {
|
|
8
9
|
INPUT: {
|
|
@@ -33,6 +34,7 @@ const DOMWithState = {
|
|
|
33
34
|
}
|
|
34
35
|
};
|
|
35
36
|
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
37
|
+
const LinkAttributes = /*#__PURE__*/new Set(["href", "target", "rel", "download", "link", "aria-current"]);
|
|
36
38
|
const DelegatedEvents = /*#__PURE__*/new Set(["beforeinput", "click", "dblclick", "contextmenu", "focusin", "focusout", "input", "keydown", "keyup", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointermove", "pointerout", "pointerover", "pointerup", "touchend", "touchmove", "touchstart"]);
|
|
37
39
|
const SVGElements = /*#__PURE__*/new Set([
|
|
38
40
|
"altGlyph", "altGlyphDef", "altGlyphItem", "animate", "animateColor", "animateMotion", "animateTransform", "circle", "clipPath", "color-profile", "cursor", "defs", "desc", "ellipse", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence", "filter", "font", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignObject", "g", "glyph", "glyphRef", "hkern", "image", "line", "linearGradient", "marker", "mask", "metadata", "missing-glyph", "mpath", "path", "pattern", "polygon", "polyline", "radialGradient", "rect",
|
|
@@ -49,6 +51,19 @@ const Namespaces = {
|
|
|
49
51
|
const VoidElements = /*#__PURE__*/new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]);
|
|
50
52
|
const RawTextElements = /*#__PURE__*/new Set(["style", "script", "noscript", "template", "textarea", "title"]);
|
|
51
53
|
const DOMElements = /*#__PURE__*/new Set(/*#__PURE__*/"a,abbr,acronym,address,applet,area,article,aside,audio,b,base,basefont,bdi,bdo,bgsound,big,blink,blockquote,body,br,button,canvas,caption,center,cite,code,col,colgroup,content,data,datalist,dd,del,details,dfn,dialog,dir,div,dl,dt,em,embed,fieldset,figcaption,figure,font,footer,form,frame,frameset,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,i,iframe,image,img,input,ins,isindex,kbd,keygen,label,legend,li,link,listing,main,map,mark,marquee,math,menu,menuitem,meta,meter,multicol,nav,nextid,nobr,noembed,noframes,noindex,noscript,object,ol,optgroup,option,output,p,param,picture,plaintext,portal,pre,progress,q,rb,rp,rt,rtc,ruby,s,samp,script,search,section,select,shadow,slot,small,source,spacer,span,strike,strong,style,sub,summary,sup,svg,table,tbody,td,template,textarea,tfoot,th,thead,time,title,tr,track,tt,u,ul,var,video,wbr,webview,xmp".split(","));
|
|
54
|
+
const COMPOSED_BODY_FRAMING = /*#__PURE__*/new Set(["content-length", "content-encoding", "transfer-encoding"]);
|
|
55
|
+
function isHttpNavigationTarget(target) {
|
|
56
|
+
try {
|
|
57
|
+
const protocol = new URL(target, "http://base.invalid").protocol;
|
|
58
|
+
return protocol === "http:" || protocol === "https:";
|
|
59
|
+
} catch {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function isEventName(name) {
|
|
64
|
+
let c;
|
|
65
|
+
return name.startsWith("on") && (c = name.charCodeAt(2)) > 64 && c < 91;
|
|
66
|
+
}
|
|
52
67
|
|
|
53
68
|
const transparentOptions = {
|
|
54
69
|
transparent: true,
|
|
@@ -57,14 +72,365 @@ const transparentOptions = {
|
|
|
57
72
|
const syncOptions = {
|
|
58
73
|
sync: true
|
|
59
74
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
75
|
+
function effect(fn, effectFn, options) {
|
|
76
|
+
const nodeOptions = options ? {
|
|
77
|
+
sync: true,
|
|
78
|
+
...options,
|
|
79
|
+
transparent: !options.scope
|
|
80
|
+
} : transparentOptions;
|
|
81
|
+
createRenderEffect(fn, effectFn, nodeOptions);
|
|
82
|
+
}
|
|
83
|
+
function memo(fn) {
|
|
84
|
+
return createMemo(() => fn(), syncOptions);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const REQUEST_ERROR_HOOK = Symbol.for("solid-js/server/request-error-hook");
|
|
88
|
+
function hooks() {
|
|
89
|
+
const g = globalThis;
|
|
90
|
+
return g[REQUEST_ERROR_HOOK] || (g[REQUEST_ERROR_HOOK] = new WeakMap());
|
|
91
|
+
}
|
|
92
|
+
function setRequestErrorHook(event, hook) {
|
|
93
|
+
if (hook !== undefined) hooks().set(event, hook);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const PROVIDER = Symbol.for("solid-js/observe/server/provider");
|
|
97
|
+
function currentProvider() {
|
|
98
|
+
if (OBSERVE === undefined) return undefined;
|
|
99
|
+
const slot = OBSERVE.server.trace;
|
|
100
|
+
return slot && slot[PROVIDER];
|
|
101
|
+
}
|
|
102
|
+
const TRACEPARENT = /^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})(-.*)?$/;
|
|
103
|
+
const ZERO_TRACE = "00000000000000000000000000000000";
|
|
104
|
+
const ZERO_SPAN = "0000000000000000";
|
|
105
|
+
function parseTraceparent(value) {
|
|
106
|
+
if (!value) return undefined;
|
|
107
|
+
const m = TRACEPARENT.exec(value.trim());
|
|
108
|
+
if (!m) return undefined;
|
|
109
|
+
const [, version, traceId, parentId, flags, rest] = m;
|
|
110
|
+
if (version === "ff") return undefined;
|
|
111
|
+
if (version === "00" && rest !== undefined) return undefined;
|
|
112
|
+
if (traceId === ZERO_TRACE || parentId === ZERO_SPAN) return undefined;
|
|
113
|
+
return {
|
|
114
|
+
traceId,
|
|
115
|
+
parentId,
|
|
116
|
+
sampled: (parseInt(flags, 16) & 1) === 1
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
function randomHex(bytes) {
|
|
120
|
+
let out = "";
|
|
121
|
+
for (let i = 0; i < bytes; i += 4) out += (Math.random() * 0x100000000 >>> 0).toString(16).padStart(8, "0");
|
|
122
|
+
return out.length === bytes * 2 ? out : out.slice(0, bytes * 2);
|
|
123
|
+
}
|
|
124
|
+
function randomTraceId() {
|
|
125
|
+
let id = randomHex(16);
|
|
126
|
+
while (id === ZERO_TRACE) id = randomHex(16);
|
|
127
|
+
return id;
|
|
128
|
+
}
|
|
129
|
+
function randomSpanId() {
|
|
130
|
+
let id = randomHex(8);
|
|
131
|
+
while (id === ZERO_SPAN) id = randomHex(8);
|
|
132
|
+
return id;
|
|
133
|
+
}
|
|
134
|
+
function formatTraceparent(context) {
|
|
135
|
+
return `00-${context.traceId}-${context.spanId}-${context.sampled === true ? "01" : "00"}`;
|
|
136
|
+
}
|
|
137
|
+
const RECORDS_KEY = Symbol.for("@solidjs/web/trace/records");
|
|
138
|
+
function records$1() {
|
|
139
|
+
const g = globalThis;
|
|
140
|
+
return g[RECORDS_KEY] || (g[RECORDS_KEY] = new WeakMap());
|
|
141
|
+
}
|
|
142
|
+
function traceFor(key, request) {
|
|
143
|
+
const store = records$1();
|
|
144
|
+
let record = store.get(key);
|
|
145
|
+
if (record) return record;
|
|
146
|
+
const headers = request ? request.headers : undefined;
|
|
147
|
+
const incoming = headers ? parseTraceparent(headers.get("traceparent")) : undefined;
|
|
148
|
+
const context = {
|
|
149
|
+
traceId: incoming ? incoming.traceId : randomTraceId(),
|
|
150
|
+
spanId: randomSpanId(),
|
|
151
|
+
entries: {}
|
|
152
|
+
};
|
|
153
|
+
if (incoming) {
|
|
154
|
+
context.parentId = incoming.parentId;
|
|
155
|
+
context.sampled = incoming.sampled;
|
|
156
|
+
}
|
|
157
|
+
if (headers) {
|
|
158
|
+
const state = headers.get("tracestate");
|
|
159
|
+
if (state) context.state = state;
|
|
160
|
+
const baggage = headers.get("baggage");
|
|
161
|
+
if (baggage) context.baggage = baggage;
|
|
162
|
+
}
|
|
163
|
+
let answered = false;
|
|
164
|
+
let providedEntries;
|
|
165
|
+
{
|
|
166
|
+
const provider = currentProvider();
|
|
167
|
+
if (provider) {
|
|
168
|
+
let answer;
|
|
169
|
+
try {
|
|
170
|
+
answer = provider(request);
|
|
171
|
+
} catch (error) {
|
|
172
|
+
console.error(error);
|
|
173
|
+
}
|
|
174
|
+
if (answer !== undefined && answer !== null) {
|
|
175
|
+
answered = true;
|
|
176
|
+
if (answer.traceId !== undefined) context.traceId = answer.traceId;
|
|
177
|
+
if (answer.spanId !== undefined) context.spanId = answer.spanId;
|
|
178
|
+
if (answer.parentId !== undefined) context.parentId = answer.parentId;
|
|
179
|
+
if (answer.sampled !== undefined) context.sampled = answer.sampled;
|
|
180
|
+
if (answer.state !== undefined) context.state = answer.state;
|
|
181
|
+
if (answer.baggage !== undefined) context.baggage = answer.baggage;
|
|
182
|
+
providedEntries = answer.entries;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
context.entries.traceparent = formatTraceparent(context);
|
|
187
|
+
if (providedEntries) Object.assign(context.entries, providedEntries);
|
|
188
|
+
record = {
|
|
189
|
+
context,
|
|
190
|
+
emit: incoming !== undefined && incoming.sampled || answered,
|
|
191
|
+
timing: []
|
|
192
|
+
};
|
|
193
|
+
store.set(key, record);
|
|
194
|
+
return record;
|
|
195
|
+
}
|
|
196
|
+
function traceForEvent(event) {
|
|
197
|
+
return traceFor(event.request || event, event.request);
|
|
198
|
+
}
|
|
199
|
+
const TOKEN = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
|
|
200
|
+
function splitServerTiming(value) {
|
|
201
|
+
const entries = [];
|
|
202
|
+
let start = 0;
|
|
203
|
+
let quoted = false;
|
|
204
|
+
for (let i = 0; i < value.length; i++) {
|
|
205
|
+
const c = value[i];
|
|
206
|
+
if (quoted) {
|
|
207
|
+
if (c === "\\") i++;else if (c === '"') quoted = false;
|
|
208
|
+
} else if (c === '"') quoted = true;else if (c === ",") {
|
|
209
|
+
entries.push(value.slice(start, i));
|
|
210
|
+
start = i + 1;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
entries.push(value.slice(start));
|
|
214
|
+
return entries;
|
|
215
|
+
}
|
|
216
|
+
function metricName(entry) {
|
|
217
|
+
return entry.split(";")[0].trim().toLowerCase();
|
|
218
|
+
}
|
|
219
|
+
function namesOnServerTiming(headers) {
|
|
220
|
+
const names = new Set();
|
|
221
|
+
const existing = headers.get("server-timing");
|
|
222
|
+
if (existing) {
|
|
223
|
+
for (const entry of splitServerTiming(existing)) {
|
|
224
|
+
const name = metricName(entry);
|
|
225
|
+
if (name) names.add(name);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
return names;
|
|
229
|
+
}
|
|
230
|
+
function quoteDesc(value) {
|
|
231
|
+
return value.replace(/[\x00-\x1f\x7f]/g, "").replace(/[^\x20-\x7e]/g, "?").replace(/[\\"]/g, m => "\\" + m);
|
|
232
|
+
}
|
|
233
|
+
function shellMs(record) {
|
|
234
|
+
return record.render !== undefined ? record.render.shellMs : undefined;
|
|
235
|
+
}
|
|
236
|
+
function hasServerTiming(record) {
|
|
237
|
+
return record.emit || record.timing.length > 0 || shellMs(record) !== undefined;
|
|
238
|
+
}
|
|
239
|
+
function appendTraceServerTiming(headers, record) {
|
|
240
|
+
if (record.emit) {
|
|
241
|
+
const entries = record.context.entries;
|
|
242
|
+
let present;
|
|
243
|
+
for (const name in entries) {
|
|
244
|
+
if (!TOKEN.test(name)) continue;
|
|
245
|
+
if (!present) present = namesOnServerTiming(headers);
|
|
246
|
+
if (present.has(name.toLowerCase())) continue;
|
|
247
|
+
headers.append("Server-Timing", `${name};desc="${quoteDesc(entries[name])}"`);
|
|
248
|
+
present.add(name.toLowerCase());
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
const shell = shellMs(record);
|
|
252
|
+
if (shell !== undefined) headers.append("Server-Timing", formatMetric("solid-shell", shell));
|
|
253
|
+
for (const work of record.timing) headers.append("Server-Timing", metricOf(work));
|
|
254
|
+
}
|
|
255
|
+
function metricOf(work) {
|
|
256
|
+
if (work.type === "invocation") return formatMetric("solid-invocation", work.event.durationMs, work.event.id);
|
|
257
|
+
const boundary = work.event;
|
|
258
|
+
return formatMetric("solid-boundary", boundary.durationMs, boundary.ownerPath !== undefined ? boundary.ownerPath.join(" > ") : boundary.id);
|
|
259
|
+
}
|
|
260
|
+
function formatMetric(name, dur, desc) {
|
|
261
|
+
let out = `${name};dur=${Math.round(dur * 10) / 10}`;
|
|
262
|
+
if (desc) out += `;desc="${quoteDesc(desc)}"`;
|
|
263
|
+
return out;
|
|
264
|
+
}
|
|
265
|
+
function mergeServerTiming(target, value) {
|
|
266
|
+
const present = namesOnServerTiming(target);
|
|
267
|
+
for (const entry of splitServerTiming(value)) {
|
|
268
|
+
const trimmed = entry.trim();
|
|
269
|
+
const name = metricName(trimmed);
|
|
270
|
+
if (!name || present.has(name)) continue;
|
|
271
|
+
target.append("Server-Timing", trimmed);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
function escapeAttr(value) {
|
|
275
|
+
return value.replace(/[&"<>]/g, c => c === "&" ? "&" : c === '"' ? """ : c === "<" ? "<" : ">");
|
|
276
|
+
}
|
|
277
|
+
function traceMetaMarkup(record) {
|
|
278
|
+
if (!record.emit) return "";
|
|
279
|
+
let markup = "";
|
|
280
|
+
const entries = record.context.entries;
|
|
281
|
+
for (const name in entries) {
|
|
282
|
+
if (!TOKEN.test(name)) continue;
|
|
283
|
+
markup += `<meta name="${name}" content="${escapeAttr(entries[name])}">`;
|
|
284
|
+
}
|
|
285
|
+
return markup;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
const RECORDS = Symbol.for("@solidjs/signals/observe/records");
|
|
289
|
+
function records() {
|
|
290
|
+
return globalThis[RECORDS];
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
function timesServerWork(type) {
|
|
294
|
+
const channel = records();
|
|
295
|
+
if (channel === undefined) return false;
|
|
296
|
+
return channel.observed(type);
|
|
297
|
+
}
|
|
298
|
+
function observeRender(trace, mode, event) {
|
|
299
|
+
if (!timesServerWork("render")) return undefined;
|
|
300
|
+
const record = {
|
|
301
|
+
mode,
|
|
302
|
+
at: performance.now(),
|
|
303
|
+
durationMs: 0,
|
|
304
|
+
boundaries: 0,
|
|
305
|
+
outcome: "complete"
|
|
306
|
+
};
|
|
307
|
+
trace.render = record;
|
|
308
|
+
let settled = false;
|
|
309
|
+
let route;
|
|
310
|
+
return {
|
|
311
|
+
shell() {
|
|
312
|
+
if (!settled && record.shellMs === undefined) record.shellMs = performance.now() - record.at;
|
|
313
|
+
},
|
|
314
|
+
boundary() {
|
|
315
|
+
if (!settled) record.boundaries++;
|
|
316
|
+
},
|
|
317
|
+
route(ref) {
|
|
318
|
+
if (!settled) route = ref;
|
|
319
|
+
},
|
|
320
|
+
settle(outcome) {
|
|
321
|
+
if (settled) return;
|
|
322
|
+
settled = true;
|
|
323
|
+
record.durationMs = performance.now() - record.at;
|
|
324
|
+
record.outcome = outcome;
|
|
325
|
+
if (route !== undefined) {
|
|
326
|
+
const r = {};
|
|
327
|
+
if (route.name !== undefined) r.name = route.name;
|
|
328
|
+
if (route.to !== undefined) r.to = route.to;
|
|
329
|
+
if (route.params !== undefined) r.params = route.params;
|
|
330
|
+
record.route = r;
|
|
331
|
+
}
|
|
332
|
+
const channel = records();
|
|
333
|
+
if (!channel.observed("render")) return;
|
|
334
|
+
const live = {
|
|
335
|
+
trace: trace.context
|
|
336
|
+
};
|
|
337
|
+
if (event !== undefined) live.event = event;
|
|
338
|
+
channel.emit("render", record, live);
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
const DESCEND = Symbol("descend");
|
|
344
|
+
const CYCLE = {};
|
|
345
|
+
const TRACK = 16;
|
|
346
|
+
function rewriteTree(value, visit, withPath) {
|
|
347
|
+
if (value === null || typeof value !== "object") return value;
|
|
348
|
+
const path = undefined;
|
|
349
|
+
const state = {
|
|
350
|
+
memo: undefined,
|
|
351
|
+
ancestors: undefined
|
|
352
|
+
};
|
|
353
|
+
try {
|
|
354
|
+
return cow(value, visit, path, 0, state);
|
|
355
|
+
} catch (err) {
|
|
356
|
+
if (err !== CYCLE) throw err;
|
|
357
|
+
}
|
|
358
|
+
return clone(value, visit, path, state.memo || (state.memo = new Map()));
|
|
359
|
+
}
|
|
360
|
+
function shape(value) {
|
|
361
|
+
return Array.isArray(value) ? 1 : Object.getPrototypeOf(value) === Object.prototype ? 2 : 0;
|
|
362
|
+
}
|
|
363
|
+
function cow(value, visit, path, depth, state) {
|
|
364
|
+
const memo = state.memo;
|
|
365
|
+
if (memo !== undefined && memo.has(value)) return memo.get(value);
|
|
366
|
+
const r = visit(value, path);
|
|
367
|
+
if (r !== DESCEND) {
|
|
368
|
+
if (r !== value) (memo || (state.memo = new Map())).set(value, r);
|
|
369
|
+
return r;
|
|
370
|
+
}
|
|
371
|
+
const s = shape(value);
|
|
372
|
+
if (s === 0) return value;
|
|
373
|
+
let ancestors;
|
|
374
|
+
if (depth >= TRACK) {
|
|
375
|
+
ancestors = state.ancestors || (state.ancestors = new Set());
|
|
376
|
+
if (ancestors.has(value)) throw CYCLE;
|
|
377
|
+
ancestors.add(value);
|
|
378
|
+
}
|
|
379
|
+
let out = value;
|
|
380
|
+
if (s === 1) {
|
|
381
|
+
for (let i = 0; i < value.length; i++) {
|
|
382
|
+
const c = value[i];
|
|
383
|
+
if (c === null || typeof c !== "object") continue;
|
|
384
|
+
const next = cow(c, visit, undefined , depth + 1, state);
|
|
385
|
+
if (next !== c) {
|
|
386
|
+
if (out === value) out = value.slice();
|
|
387
|
+
out[i] = next;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
} else {
|
|
391
|
+
for (const k of Object.keys(value)) {
|
|
392
|
+
const c = value[k];
|
|
393
|
+
if (c === null || typeof c !== "object") continue;
|
|
394
|
+
const next = cow(c, visit, undefined , depth + 1, state);
|
|
395
|
+
if (next !== c) {
|
|
396
|
+
if (out === value) out = {
|
|
397
|
+
...value
|
|
398
|
+
};
|
|
399
|
+
out[k] = next;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
if (ancestors !== undefined) ancestors.delete(value);
|
|
404
|
+
return out;
|
|
405
|
+
}
|
|
406
|
+
function clone(value, visit, path, memo) {
|
|
407
|
+
if (memo.has(value)) return memo.get(value);
|
|
408
|
+
const r = visit(value, path);
|
|
409
|
+
if (r !== DESCEND) {
|
|
410
|
+
memo.set(value, r);
|
|
411
|
+
return r;
|
|
412
|
+
}
|
|
413
|
+
const s = shape(value);
|
|
414
|
+
if (s === 0) return value;
|
|
415
|
+
const out = s === 1 ? value.slice() : {
|
|
416
|
+
...value
|
|
417
|
+
};
|
|
418
|
+
memo.set(value, out);
|
|
419
|
+
if (s === 1) {
|
|
420
|
+
for (let i = 0; i < value.length; i++) {
|
|
421
|
+
const c = value[i];
|
|
422
|
+
if (c !== null && typeof c === "object") out[i] = clone(c, visit, undefined , memo);
|
|
423
|
+
}
|
|
424
|
+
} else {
|
|
425
|
+
for (const k of Object.keys(value)) {
|
|
426
|
+
const c = value[k];
|
|
427
|
+
if (c !== null && typeof c === "object") out[k] = clone(c, visit, undefined , memo);
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
return out;
|
|
431
|
+
}
|
|
66
432
|
|
|
67
|
-
const STATE = Symbol.for("
|
|
433
|
+
const STATE = Symbol.for("solid.container-trace-state");
|
|
68
434
|
const state = globalThis[STATE] || (globalThis[STATE] = {
|
|
69
435
|
materialized: new WeakMap(),
|
|
70
436
|
materializedValues: new WeakSet()
|
|
@@ -72,14 +438,33 @@ const state = globalThis[STATE] || (globalThis[STATE] = {
|
|
|
72
438
|
function setContainerTraceResolver(fn) {
|
|
73
439
|
state.resolveTrace = fn;
|
|
74
440
|
}
|
|
441
|
+
function setAsyncIterableSharer(fn) {
|
|
442
|
+
state.shareIterable = fn;
|
|
443
|
+
}
|
|
75
444
|
function setContainerTraceStreamMint(fn) {
|
|
76
445
|
state.streamOf = fn;
|
|
77
446
|
}
|
|
78
|
-
const TRACE = Symbol.for("
|
|
79
|
-
function
|
|
447
|
+
const TRACE = Symbol.for("solid.container-trace");
|
|
448
|
+
function toBorderForm(value, envelopeContainers) {
|
|
449
|
+
if (value == null || typeof value !== "object") return value;
|
|
450
|
+
const share = state.shareIterable;
|
|
451
|
+
if (!share) return value;
|
|
452
|
+
return rewriteTree(value, v => {
|
|
453
|
+
if (share && isShareableIterable(v)) return share(v);
|
|
454
|
+
return DESCEND;
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
function isShareableIterable(value) {
|
|
458
|
+
try {
|
|
459
|
+
return typeof value[Symbol.asyncIterator] === "function" && !(typeof ReadableStream !== "undefined" && value instanceof ReadableStream);
|
|
460
|
+
} catch {
|
|
461
|
+
return false;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
function materialize(marker, claiming) {
|
|
80
465
|
let value = state.materialized.get(marker.$tr);
|
|
81
466
|
if (value === undefined) {
|
|
82
|
-
value = state.materializeTrace(marker);
|
|
467
|
+
value = state.materializeTrace(marker, claiming);
|
|
83
468
|
state.materialized.set(marker.$tr, value);
|
|
84
469
|
if (value !== null && typeof value === "object") state.materializedValues.add(value);
|
|
85
470
|
}
|
|
@@ -94,7 +479,7 @@ function parseTrace(value, ctx) {
|
|
|
94
479
|
};
|
|
95
480
|
}
|
|
96
481
|
const ContainerTracePlugin = {
|
|
97
|
-
tag: "
|
|
482
|
+
tag: "solid/container-trace",
|
|
98
483
|
test(value) {
|
|
99
484
|
return value != null && typeof value === "object" && TRACE in value;
|
|
100
485
|
},
|
|
@@ -126,7 +511,7 @@ const ContainerTracePlugin = {
|
|
|
126
511
|
};
|
|
127
512
|
|
|
128
513
|
setContainerTraceStreamMint(iterable => {
|
|
129
|
-
const stream =
|
|
514
|
+
const stream = createStream();
|
|
130
515
|
(async () => {
|
|
131
516
|
try {
|
|
132
517
|
for await (const value of iterable) stream.next(value);
|
|
@@ -137,57 +522,186 @@ setContainerTraceStreamMint(iterable => {
|
|
|
137
522
|
})();
|
|
138
523
|
return stream;
|
|
139
524
|
});
|
|
140
|
-
const DEFAULT_WEB_PLUGINS = Object.freeze([
|
|
141
|
-
|
|
142
|
-
|
|
525
|
+
const DEFAULT_WEB_PLUGINS = /* @__PURE__ */Object.freeze([AbortSignalPlugin,
|
|
526
|
+
CustomEventPlugin, DOMExceptionPlugin, EventPlugin,
|
|
527
|
+
FormDataPlugin, HeadersPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLSearchParamsPlugin, URLPlugin,
|
|
143
528
|
ContainerTracePlugin]);
|
|
144
529
|
function resolveSerializerPlugins(customPlugins) {
|
|
145
530
|
return customPlugins ? [...customPlugins, ...DEFAULT_WEB_PLUGINS] : [...DEFAULT_WEB_PLUGINS];
|
|
146
531
|
}
|
|
147
|
-
seroval.Feature.RegExp;
|
|
148
532
|
|
|
149
|
-
const
|
|
150
|
-
const serializeOnlyDisabledFeatures =
|
|
533
|
+
const defaultDisabledFeatures = () => Feature.AggregateError | Feature.BigIntTypedArray;
|
|
534
|
+
const serializeOnlyDisabledFeatures = serializeErrorStacks => (process.env.NODE_ENV === "development" ) ? 0 : Feature.ErrorPrototypeStack;
|
|
151
535
|
const HYDRATION_GLOBAL = "_$HY.r";
|
|
152
|
-
function
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
536
|
+
function createKeyedSerializer(serialize, onError, onDone) {
|
|
537
|
+
const cancels = new Set();
|
|
538
|
+
let pendingWrites = 0;
|
|
539
|
+
let flushed = false;
|
|
540
|
+
let done = false;
|
|
541
|
+
let closed = false;
|
|
542
|
+
const maybeDone = () => {
|
|
543
|
+
if (flushed && pendingWrites === 0 && !done) {
|
|
544
|
+
done = true;
|
|
545
|
+
onDone && onDone();
|
|
546
|
+
}
|
|
547
|
+
};
|
|
548
|
+
return {
|
|
549
|
+
write(key, value) {
|
|
550
|
+
if (flushed) return;
|
|
551
|
+
pendingWrites++;
|
|
552
|
+
let settled = false;
|
|
553
|
+
let failed = false;
|
|
554
|
+
let cancel = null;
|
|
555
|
+
const settle = () => {
|
|
556
|
+
if (settled) return;
|
|
557
|
+
settled = true;
|
|
558
|
+
if (cancel) cancels.delete(cancel);
|
|
559
|
+
pendingWrites--;
|
|
560
|
+
maybeDone();
|
|
561
|
+
};
|
|
562
|
+
let stream;
|
|
563
|
+
try {
|
|
564
|
+
stream = serialize(key, value, {
|
|
565
|
+
onError: onError && (err => {
|
|
566
|
+
failed = true;
|
|
567
|
+
onError(err);
|
|
568
|
+
if (cancel) {
|
|
569
|
+
cancel();
|
|
570
|
+
settle();
|
|
571
|
+
}
|
|
572
|
+
}),
|
|
573
|
+
onDone: settle
|
|
574
|
+
}, () => !closed);
|
|
575
|
+
} catch (err) {
|
|
576
|
+
settle();
|
|
577
|
+
throw err;
|
|
578
|
+
}
|
|
579
|
+
if (settled) return;
|
|
580
|
+
if (closed || failed) {
|
|
581
|
+
stream();
|
|
582
|
+
settle();
|
|
583
|
+
return;
|
|
584
|
+
}
|
|
585
|
+
cancel = stream;
|
|
586
|
+
cancels.add(cancel);
|
|
587
|
+
},
|
|
588
|
+
flush() {
|
|
589
|
+
flushed = true;
|
|
590
|
+
maybeDone();
|
|
591
|
+
},
|
|
592
|
+
close() {
|
|
593
|
+
closed = flushed = true;
|
|
594
|
+
for (const cancel of cancels) cancel();
|
|
595
|
+
cancels.clear();
|
|
596
|
+
if (!done) {
|
|
597
|
+
done = true;
|
|
598
|
+
onDone && onDone();
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
};
|
|
158
602
|
}
|
|
603
|
+
const KEY_ESCAPES = {
|
|
604
|
+
'"': '\\"',
|
|
605
|
+
"\\": "\\\\",
|
|
606
|
+
"\n": "\\n",
|
|
607
|
+
"\r": "\\r",
|
|
608
|
+
"\b": "\\b",
|
|
609
|
+
"\t": "\\t",
|
|
610
|
+
"\f": "\\f",
|
|
611
|
+
"<": "\\x3C",
|
|
612
|
+
"\u2028": "\\u2028",
|
|
613
|
+
"\u2029": "\\u2029"
|
|
614
|
+
};
|
|
615
|
+
const serializeKey = key => ("" + key).replace(/["\\\n\r\b\t\f<\u2028\u2029]/g, c => KEY_ESCAPES[c]);
|
|
159
616
|
function createHydrationSerializer({
|
|
160
617
|
onData,
|
|
161
618
|
onDone,
|
|
162
619
|
scopeId,
|
|
163
620
|
onError,
|
|
164
|
-
plugins
|
|
621
|
+
plugins,
|
|
622
|
+
late
|
|
165
623
|
}) {
|
|
166
|
-
|
|
624
|
+
const resolvedPlugins = resolveSerializerPlugins(plugins);
|
|
625
|
+
const disabledFeatures = defaultDisabledFeatures() | serializeOnlyDisabledFeatures();
|
|
626
|
+
const refs = new Map();
|
|
627
|
+
const serialize = (key, value, callbacks, live) => crossSerializeStream(value, {
|
|
167
628
|
scopeId,
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
629
|
+
refs,
|
|
630
|
+
plugins: resolvedPlugins,
|
|
631
|
+
disabledFeatures,
|
|
632
|
+
onSerialize(data, initial) {
|
|
633
|
+
if (!live()) return;
|
|
634
|
+
onData(initial ? HYDRATION_GLOBAL + '["' + serializeKey(key) + '"]=' + data : data);
|
|
635
|
+
},
|
|
636
|
+
...callbacks
|
|
637
|
+
});
|
|
638
|
+
return createKeyedSerializer(late ? late(serialize, refs, onData, scopeId) : serialize, onError, onDone);
|
|
639
|
+
}
|
|
640
|
+
function rejectUnserializedKey(serialize, refs, onData, scopeId) {
|
|
641
|
+
let taken = 0;
|
|
642
|
+
let fresh = [];
|
|
643
|
+
const set = refs.set;
|
|
644
|
+
refs.set = (value, id) => {
|
|
645
|
+
taken++;
|
|
646
|
+
fresh.push(value);
|
|
647
|
+
return set.call(refs, value, id);
|
|
648
|
+
};
|
|
649
|
+
Object.defineProperty(refs, "size", {
|
|
650
|
+
get: () => taken
|
|
173
651
|
});
|
|
652
|
+
return (key, value, callbacks, live) => {
|
|
653
|
+
const sent = [];
|
|
654
|
+
const failed = () => {
|
|
655
|
+
for (const ref of fresh) refs.delete(ref);
|
|
656
|
+
fresh = [];
|
|
657
|
+
const ids = new Set();
|
|
658
|
+
for (const ref of sent) {
|
|
659
|
+
const id = refs.get(ref);
|
|
660
|
+
if (ref instanceof Promise) ids.add(id + 1);else if (isStream(ref) || Object.getPrototypeOf(ref) === Object.prototype && !Object.keys(ref).length) ids.add(id);
|
|
661
|
+
}
|
|
662
|
+
if (!ids.size) return;
|
|
663
|
+
const body = "for(const i of[" + [...ids] + "]){const v=$R[i];v&&(v.f?v.f(e):v.throw&&v.throw(e))}";
|
|
664
|
+
const message = JSON.stringify("Serialization failed: the hydration value for key " + JSON.stringify(key) + " could not be serialized on the server").replace(/[<\u2028\u2029]/g, c => KEY_ESCAPES[c]);
|
|
665
|
+
onData("($R=>{const e=new Error(" + message + ");" + body + "})(" + (scopeId == null ? "$R" : '$R["' + serializeKey(scopeId) + '"]') + ")");
|
|
666
|
+
};
|
|
667
|
+
return serialize(key, value, {
|
|
668
|
+
...callbacks,
|
|
669
|
+
onError: callbacks.onError && (err => {
|
|
670
|
+
if (live()) failed();
|
|
671
|
+
callbacks.onError(err);
|
|
672
|
+
})
|
|
673
|
+
},
|
|
674
|
+
() => {
|
|
675
|
+
if (!live()) return false;
|
|
676
|
+
sent.push(...fresh);
|
|
677
|
+
fresh = [];
|
|
678
|
+
return true;
|
|
679
|
+
});
|
|
680
|
+
};
|
|
174
681
|
}
|
|
175
682
|
function getLocalHeaderScript(id) {
|
|
176
|
-
return
|
|
683
|
+
return getCrossReferenceHeader(id) + ";";
|
|
177
684
|
}
|
|
178
685
|
|
|
179
686
|
const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
|
|
180
|
-
|
|
181
|
-
const ResponseEnvelope =
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
687
|
+
let EnvelopeClass;
|
|
688
|
+
const ResponseEnvelope = function ResponseEnvelope(response, value) {
|
|
689
|
+
if (!EnvelopeClass) {
|
|
690
|
+
EnvelopeClass = class extends Response {
|
|
691
|
+
constructor(response, value) {
|
|
692
|
+
super(response ? response.body : null, response && {
|
|
693
|
+
status: response.status,
|
|
694
|
+
statusText: response.statusText,
|
|
695
|
+
headers: copyHeaders(response.headers)
|
|
696
|
+
});
|
|
697
|
+
this.response = response ? this : undefined;
|
|
698
|
+
this.value = value;
|
|
699
|
+
}
|
|
700
|
+
};
|
|
701
|
+
EnvelopeClass.prototype[ENVELOPE] = true;
|
|
187
702
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
})();
|
|
703
|
+
return new EnvelopeClass(response, value);
|
|
704
|
+
};
|
|
191
705
|
function isResponseEnvelope(value) {
|
|
192
706
|
return !!(value && typeof value === "object" && value[ENVELOPE]);
|
|
193
707
|
}
|
|
@@ -210,24 +724,38 @@ function isSafeError(value) {
|
|
|
210
724
|
return !!(value && (typeof value === "object" || typeof value === "function") && value[SAFE_ERROR]);
|
|
211
725
|
}
|
|
212
726
|
const REVALIDATE_HEADER = "X-Revalidate";
|
|
213
|
-
|
|
727
|
+
const REVALIDATE_ALL = "*";
|
|
728
|
+
const RESPONSE_HEADER_VALUE_LIMIT = 4096;
|
|
729
|
+
function copyHeaders(init) {
|
|
730
|
+
const source = init;
|
|
731
|
+
if (!source || !source.getSetCookie) return new Headers(init);
|
|
732
|
+
const headers = new Headers();
|
|
733
|
+
source.forEach((value, key) => {
|
|
734
|
+
if (key !== "set-cookie") headers.append(key, value);
|
|
735
|
+
});
|
|
736
|
+
for (const cookie of source.getSetCookie()) headers.append("Set-Cookie", cookie);
|
|
737
|
+
return headers;
|
|
738
|
+
}
|
|
739
|
+
function initWithRevalidate(init = {}) {
|
|
740
|
+
const resolved = typeof init === "number" ? {
|
|
741
|
+
status: init
|
|
742
|
+
} : init;
|
|
214
743
|
const {
|
|
215
744
|
revalidate,
|
|
216
745
|
...responseInit
|
|
217
|
-
} =
|
|
218
|
-
|
|
219
|
-
if (
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
});
|
|
224
|
-
for (const cookie of responseInit.headers.getSetCookie()) {
|
|
225
|
-
headers.append("Set-Cookie", cookie);
|
|
746
|
+
} = resolved;
|
|
747
|
+
const headers = copyHeaders(responseInit.headers);
|
|
748
|
+
if (revalidate !== undefined) {
|
|
749
|
+
const list = Array.isArray(revalidate) ? revalidate : [revalidate];
|
|
750
|
+
if (list.length > 1 && list.includes(REVALIDATE_ALL)) {
|
|
751
|
+
throw new TypeError(`revalidate names "${REVALIDATE_ALL}" alongside other keys; "${REVALIDATE_ALL}" already ` + `means every entry and stands alone — pass revalidate: "${REVALIDATE_ALL}" or the named keys.`);
|
|
226
752
|
}
|
|
227
|
-
|
|
228
|
-
|
|
753
|
+
const keys = list.join(",");
|
|
754
|
+
if (keys.length > RESPONSE_HEADER_VALUE_LIMIT) {
|
|
755
|
+
throw new TypeError(`revalidate names ${keys.length} characters of cache keys; past ` + `${RESPONSE_HEADER_VALUE_LIMIT} the ${REVALIDATE_HEADER} header would overflow ` + `receivers (an 8 KiB proxy buffer holds the whole header block) and the response ` + `dies at the socket after the mutation committed. Split the invalidation across ` + `calls or use coarser keys — a dropped key would be a silently stale cache, so ` + `the runtime refuses rather than trims.`);
|
|
756
|
+
}
|
|
757
|
+
headers.set(REVALIDATE_HEADER, keys);
|
|
229
758
|
}
|
|
230
|
-
revalidate !== undefined && headers.set(REVALIDATE_HEADER, revalidate.toString());
|
|
231
759
|
return {
|
|
232
760
|
responseInit,
|
|
233
761
|
headers
|
|
@@ -240,13 +768,17 @@ function redirect(url, init = 302) {
|
|
|
240
768
|
const {
|
|
241
769
|
responseInit,
|
|
242
770
|
headers
|
|
243
|
-
} = initWithRevalidate(
|
|
244
|
-
status: init
|
|
245
|
-
} : init);
|
|
771
|
+
} = initWithRevalidate(init);
|
|
246
772
|
if (responseInit.status === undefined) {
|
|
247
773
|
responseInit.status = 302;
|
|
248
774
|
}
|
|
249
|
-
|
|
775
|
+
const target = typeof url === "string" ? url : url[HREF];
|
|
776
|
+
const location = typeof target === "string" ? target : String(url);
|
|
777
|
+
const encoded = location.replace(/[^\x00-\x7f]/gu, encodeURIComponent);
|
|
778
|
+
if (encoded.length > RESPONSE_HEADER_VALUE_LIMIT) {
|
|
779
|
+
throw new TypeError(`redirect() target is ${encoded.length} characters; past ` + `${RESPONSE_HEADER_VALUE_LIMIT} the Location header (and the scripted transport's ` + `redirect header) would overflow receivers and the response dies at the socket. ` + `A target this size is usually unbounded input echoed into the url — carry the ` + `state server-side instead. Refused rather than trimmed: a cut target is a ` + `different address.`);
|
|
780
|
+
}
|
|
781
|
+
headers.set("Location", encoded);
|
|
250
782
|
return new Response(null, {
|
|
251
783
|
...responseInit,
|
|
252
784
|
headers
|
|
@@ -262,13 +794,26 @@ function reload(init = {}) {
|
|
|
262
794
|
headers
|
|
263
795
|
});
|
|
264
796
|
}
|
|
797
|
+
const NULL_BODY_STATUSES = new Set([204, 205, 304]);
|
|
265
798
|
function respond(value, init = {}) {
|
|
266
799
|
const {
|
|
267
800
|
responseInit,
|
|
268
801
|
headers
|
|
269
802
|
} = initWithRevalidate(init);
|
|
803
|
+
for (const header of COMPOSED_BODY_FRAMING) headers.delete(header);
|
|
804
|
+
if (NULL_BODY_STATUSES.has(responseInit.status)) {
|
|
805
|
+
return new ResponseEnvelope(new Response(null, {
|
|
806
|
+
...responseInit,
|
|
807
|
+
headers
|
|
808
|
+
}), value);
|
|
809
|
+
}
|
|
270
810
|
headers.set("Content-Type", "application/json");
|
|
271
|
-
return new ResponseEnvelope(new Response(
|
|
811
|
+
return new ResponseEnvelope(new Response(new ReadableStream({
|
|
812
|
+
pull(controller) {
|
|
813
|
+
controller.enqueue(new TextEncoder().encode(JSON.stringify(value)));
|
|
814
|
+
controller.close();
|
|
815
|
+
}
|
|
816
|
+
}), {
|
|
272
817
|
...responseInit,
|
|
273
818
|
headers
|
|
274
819
|
}), value);
|
|
@@ -317,6 +862,7 @@ function serializeCookie(name, value, options = {}) {
|
|
|
317
862
|
if (options.expires) cookie += `; Expires=${options.expires.toUTCString()}`;
|
|
318
863
|
if (options.httpOnly) cookie += "; HttpOnly";
|
|
319
864
|
if (options.secure) cookie += "; Secure";
|
|
865
|
+
if (options.partitioned) cookie += "; Partitioned";
|
|
320
866
|
if (options.sameSite) {
|
|
321
867
|
const sameSite = options.sameSite.toLowerCase();
|
|
322
868
|
cookie += `; SameSite=${sameSite === "none" ? "None" : sameSite === "strict" ? "Strict" : "Lax"}`;
|
|
@@ -324,7 +870,7 @@ function serializeCookie(name, value, options = {}) {
|
|
|
324
870
|
return cookie;
|
|
325
871
|
}
|
|
326
872
|
const FLASH_COOKIE = "flash";
|
|
327
|
-
const FLASH_MATCHER =
|
|
873
|
+
const FLASH_MATCHER = /(?:^|;\s*)flash=([^;]+)/;
|
|
328
874
|
function hasFlashCookie(cookieHeader) {
|
|
329
875
|
return !!cookieHeader && FLASH_MATCHER.test(cookieHeader);
|
|
330
876
|
}
|
|
@@ -334,8 +880,21 @@ function clearFlashCookie() {
|
|
|
334
880
|
|
|
335
881
|
const ERROR_HEADER = "X-Server-Function-Error";
|
|
336
882
|
const BODY_FORMAT_HEADER = "X-Server-Function-Format";
|
|
883
|
+
const REDIRECT_HEADER = "X-Server-Function-Redirect";
|
|
337
884
|
const SINGLE_FLIGHT_HEADER = "X-Single-Flight";
|
|
338
885
|
|
|
886
|
+
function emitFinding(finding, subject = getOwner()) {
|
|
887
|
+
if (OBSERVE === undefined) return;
|
|
888
|
+
OBSERVE.diagnostics.emit(finding, subject);
|
|
889
|
+
}
|
|
890
|
+
function recordFinding(finding, subject = getOwner()) {
|
|
891
|
+
if (OBSERVE !== undefined) OBSERVE.diagnostics.emit(finding, subject);
|
|
892
|
+
}
|
|
893
|
+
function errorText(error) {
|
|
894
|
+
if (error instanceof Error) return error.message ? `${error.name}: ${error.message}` : error.name;
|
|
895
|
+
return String(error);
|
|
896
|
+
}
|
|
897
|
+
|
|
339
898
|
const HEAD_ELIGIBLE_TAGS = new Set(["title", "meta", "link", "style", "script", "base"]);
|
|
340
899
|
const HEAD_ATTR_NAME = /^[a-zA-Z_][a-zA-Z0-9_:.-]*$/;
|
|
341
900
|
const RESOURCE_LINK_RELS = new Set(["preload", "modulepreload", "prefetch", "preconnect", "dns-prefetch", "stylesheet"]);
|
|
@@ -368,11 +927,28 @@ function classifyHeadTag(desc) {
|
|
|
368
927
|
resource: false
|
|
369
928
|
};
|
|
370
929
|
}
|
|
930
|
+
function qualifierValue(name, value) {
|
|
931
|
+
if (value == null || value === false) return null;
|
|
932
|
+
if (name === "imagesrcset" || name === "imagesizes") return typeof value === "string" && value !== "" ? value : null;
|
|
933
|
+
const v = value === true ? "" : String(value);
|
|
934
|
+
if (name === "as") return asciiLowerCase(v);
|
|
935
|
+
if (name !== "crossorigin") return v;
|
|
936
|
+
return v.length === 15 && v.toLowerCase() === "use-credentials" ? v.toLowerCase() : "anonymous";
|
|
937
|
+
}
|
|
938
|
+
function asciiLowerCase(value) {
|
|
939
|
+
return value.replace(/[A-Z]/g, c => String.fromCharCode(c.charCodeAt(0) + 32));
|
|
940
|
+
}
|
|
941
|
+
const JSON_SCRIPT_TYPE = /^(?:importmap|speculationrules)$|^[\t\n\r ]*(?:application\/json|text\/json|[\w!#$%&'*+.^`|~-]+\/[\w!#$%&'*+.^`|~-]*\+json)[\t\n\r ]*(?:;|$)/i;
|
|
942
|
+
function headBodyText(tag, props, text) {
|
|
943
|
+
return tag === "script" && JSON_SCRIPT_TYPE.test(String(props.type)) ? text.replace(/</g, "\\u003C") : text;
|
|
944
|
+
}
|
|
371
945
|
function resourceIdentity(tag, props) {
|
|
372
|
-
|
|
946
|
+
const url = String(props.href || props.src || "");
|
|
947
|
+
let id = "res:" + tag + ":" + (props.rel || "") + ":" + url.length + ":" + url;
|
|
373
948
|
for (let i = 0; i < RESOURCE_QUALIFIERS.length; i++) {
|
|
374
949
|
const q = RESOURCE_QUALIFIERS[i];
|
|
375
|
-
|
|
950
|
+
const value = qualifierValue(q, props[q]);
|
|
951
|
+
if (value !== null) id += ":" + q + "=" + value.length + ":" + value;
|
|
376
952
|
}
|
|
377
953
|
return id;
|
|
378
954
|
}
|
|
@@ -421,6 +997,7 @@ function resolveHead(groups) {
|
|
|
421
997
|
return winners;
|
|
422
998
|
}
|
|
423
999
|
|
|
1000
|
+
const renderConfig = sharedConfig;
|
|
424
1001
|
function joinAssetPath(base, file) {
|
|
425
1002
|
if (/^(?:[a-z][a-z0-9+.-]*:)?\/\//i.test(file)) return file;
|
|
426
1003
|
if (typeof base !== "string" || !base) base = "/";
|
|
@@ -431,41 +1008,65 @@ function resolveAssets(moduleUrl, manifest) {
|
|
|
431
1008
|
if (!manifest) return null;
|
|
432
1009
|
const base = manifest._base;
|
|
433
1010
|
const entry = manifest[moduleUrl];
|
|
434
|
-
if (!entry) return null;
|
|
1011
|
+
if (!entry || typeof entry !== "object") return null;
|
|
435
1012
|
const css = [];
|
|
436
1013
|
const js = [];
|
|
1014
|
+
let preloads;
|
|
437
1015
|
const visited = new Set();
|
|
438
1016
|
const walk = key => {
|
|
439
1017
|
if (visited.has(key)) return;
|
|
440
1018
|
visited.add(key);
|
|
441
1019
|
const e = manifest[key];
|
|
442
|
-
if (!e) return;
|
|
1020
|
+
if (!e || typeof e !== "object") return;
|
|
443
1021
|
js.push(joinAssetPath(base, e.file));
|
|
444
1022
|
if (e.css) for (let i = 0; i < e.css.length; i++) css.push(joinAssetPath(base, e.css[i]));
|
|
1023
|
+
if (e.preloads) {
|
|
1024
|
+
for (let i = 0; i < e.preloads.length; i++) {
|
|
1025
|
+
const link = e.preloads[i];
|
|
1026
|
+
const href = link && typeof link.href === "string" && link.href;
|
|
1027
|
+
const srcset = link && typeof link.imagesrcset === "string" && link.imagesrcset;
|
|
1028
|
+
if (!href && !srcset) continue;
|
|
1029
|
+
if (!preloads) preloads = [];
|
|
1030
|
+
if (href) preloads.push({
|
|
1031
|
+
...link,
|
|
1032
|
+
href: joinAssetPath(base, href)
|
|
1033
|
+
});else {
|
|
1034
|
+
const {
|
|
1035
|
+
href: bad,
|
|
1036
|
+
...rest
|
|
1037
|
+
} = link;
|
|
1038
|
+
preloads.push(rest);
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
445
1042
|
if (e.imports) for (let i = 0; i < e.imports.length; i++) walk(e.imports[i]);
|
|
446
1043
|
};
|
|
447
1044
|
walk(moduleUrl);
|
|
448
|
-
|
|
1045
|
+
const assets = {
|
|
449
1046
|
js,
|
|
450
1047
|
css
|
|
451
1048
|
};
|
|
1049
|
+
if (preloads) assets.preloads = preloads;
|
|
1050
|
+
return assets;
|
|
452
1051
|
}
|
|
453
1052
|
function registerEntryAssets(manifest) {
|
|
454
1053
|
if (!manifest || typeof manifest === "function" || typeof manifest.resolve === "function") return;
|
|
455
|
-
const ctx =
|
|
1054
|
+
const ctx = sharedConfig.context;
|
|
456
1055
|
if (!ctx?.registerAsset) return;
|
|
457
1056
|
for (const key in manifest) {
|
|
458
|
-
|
|
1057
|
+
const entry = manifest[key];
|
|
1058
|
+
if (entry && entry.isEntry) {
|
|
459
1059
|
const assets = resolveAssets(key, manifest);
|
|
460
1060
|
if (assets) {
|
|
1061
|
+
if (assets.preloads) for (let i = 0; i < assets.preloads.length; i++) ctx.registerAsset("preload", assets.preloads[i]);
|
|
461
1062
|
for (let i = 0; i < assets.css.length; i++) ctx.registerAsset("style", assets.css[i]);
|
|
462
|
-
for (let i = 1; i < assets.js.length; i++) ctx.registerAsset("module", assets.js[i]);
|
|
1063
|
+
for (let i = 1; i < assets.js.length; i++) ctx.registerAsset("module", assets.js[i], true);
|
|
463
1064
|
}
|
|
464
1065
|
return;
|
|
465
1066
|
}
|
|
466
1067
|
}
|
|
467
1068
|
}
|
|
468
|
-
function createAssetTracking() {
|
|
1069
|
+
function createAssetTracking(lowPriorityPreloads) {
|
|
469
1070
|
const boundaryModules = new Map();
|
|
470
1071
|
const boundaryStyles = new Map();
|
|
471
1072
|
const emittedAssets = new Set();
|
|
@@ -476,6 +1077,8 @@ function createAssetTracking() {
|
|
|
476
1077
|
boundaryStyles,
|
|
477
1078
|
emittedAssets,
|
|
478
1079
|
inlineStyles,
|
|
1080
|
+
preloadLinks: null,
|
|
1081
|
+
lowModules: lowPriorityPreloads !== false ? new Set() : null,
|
|
479
1082
|
registerInlineStyle(desc) {
|
|
480
1083
|
let entry = inlineStyles.get(desc.id);
|
|
481
1084
|
if (!entry) {
|
|
@@ -550,6 +1153,7 @@ function applyAssetTracking(context, tracking, manifest, noScripts) {
|
|
|
550
1153
|
});
|
|
551
1154
|
context.registerModule = tracking.registerModule;
|
|
552
1155
|
context.getBoundaryModules = tracking.getBoundaryModules;
|
|
1156
|
+
context._lazyAssets = new Map();
|
|
553
1157
|
if (typeof manifest === "function") {
|
|
554
1158
|
context.resolveAssets = guard(manifest);
|
|
555
1159
|
} else if (manifest && typeof manifest.resolve === "function") {
|
|
@@ -567,6 +1171,82 @@ function isCssUrl(url) {
|
|
|
567
1171
|
const q = url.search(/[?#]/);
|
|
568
1172
|
return (q === -1 ? url : url.slice(0, q)).endsWith(".css");
|
|
569
1173
|
}
|
|
1174
|
+
const RESPONSIVE_ATTRIBUTES = ["imagesrcset", "imagesizes"];
|
|
1175
|
+
function isSetAttr(value) {
|
|
1176
|
+
return value != null && value !== false && value !== "";
|
|
1177
|
+
}
|
|
1178
|
+
const PRELOAD_LINK_ATTRIBUTES = ["type", "crossorigin", "integrity", "referrerpolicy", "fetchpriority", "media", "imagesrcset", "imagesizes"];
|
|
1179
|
+
function registerPreloadLink(tracking, headRegistry, link, nonce) {
|
|
1180
|
+
if (!link || typeof link !== "object") {
|
|
1181
|
+
return null;
|
|
1182
|
+
}
|
|
1183
|
+
if (typeof link.as !== "string") {
|
|
1184
|
+
return null;
|
|
1185
|
+
}
|
|
1186
|
+
const as = asciiLowerCase(link.as);
|
|
1187
|
+
let destination = null;
|
|
1188
|
+
switch (as) {
|
|
1189
|
+
case "script":
|
|
1190
|
+
case "style":
|
|
1191
|
+
destination = as;
|
|
1192
|
+
break;
|
|
1193
|
+
case "fetch":
|
|
1194
|
+
case "font":
|
|
1195
|
+
case "image":
|
|
1196
|
+
case "track":
|
|
1197
|
+
break;
|
|
1198
|
+
default:
|
|
1199
|
+
return null;
|
|
1200
|
+
}
|
|
1201
|
+
const responsive = as === "image";
|
|
1202
|
+
let srcset = null;
|
|
1203
|
+
let sizes = null;
|
|
1204
|
+
if (responsive) {
|
|
1205
|
+
for (const name of RESPONSIVE_ATTRIBUTES) {
|
|
1206
|
+
const value = link[name];
|
|
1207
|
+
if (!isSetAttr(value)) continue;
|
|
1208
|
+
if (typeof value !== "string") {
|
|
1209
|
+
continue;
|
|
1210
|
+
}
|
|
1211
|
+
if (name === "imagesrcset") srcset = value;else sizes = value;
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
const href = typeof link.href === "string" && link.href ? link.href : null;
|
|
1215
|
+
if (!href && !srcset) {
|
|
1216
|
+
return null;
|
|
1217
|
+
}
|
|
1218
|
+
const props = {
|
|
1219
|
+
rel: "preload"
|
|
1220
|
+
};
|
|
1221
|
+
if (href) props.href = href;
|
|
1222
|
+
props.as = as;
|
|
1223
|
+
for (let i = 0; i < PRELOAD_LINK_ATTRIBUTES.length; i++) {
|
|
1224
|
+
const name = PRELOAD_LINK_ATTRIBUTES[i];
|
|
1225
|
+
if (RESPONSIVE_ATTRIBUTES.indexOf(name) !== -1) {
|
|
1226
|
+
const value = name === "imagesrcset" ? srcset : sizes;
|
|
1227
|
+
if (value !== null) props[name] = value;
|
|
1228
|
+
continue;
|
|
1229
|
+
}
|
|
1230
|
+
const value = link[name];
|
|
1231
|
+
if (value == null || value === false) continue;
|
|
1232
|
+
props[name] = value === true ? "" : String(value);
|
|
1233
|
+
}
|
|
1234
|
+
const identity = resourceIdentity("link", props);
|
|
1235
|
+
if (headRegistry.resources.has(identity)) return null;
|
|
1236
|
+
const attrs = headAttrRecord(props);
|
|
1237
|
+
const nonceValue = destination && nonce && nonce[destination];
|
|
1238
|
+
if (typeof nonceValue === "string" && nonceValue) attrs.nonce = nonceValue;
|
|
1239
|
+
const entry = {
|
|
1240
|
+
href: props.href,
|
|
1241
|
+
attrs,
|
|
1242
|
+
attrHtml: renderHeadAttrHtml(props) + nonceAttr(nonce, destination)
|
|
1243
|
+
};
|
|
1244
|
+
headRegistry.resources.add(identity);
|
|
1245
|
+
let links = tracking.preloadLinks;
|
|
1246
|
+
if (!links) tracking.preloadLinks = links = [];
|
|
1247
|
+
links.push(entry);
|
|
1248
|
+
return entry;
|
|
1249
|
+
}
|
|
570
1250
|
function createHeadRegistry() {
|
|
571
1251
|
return {
|
|
572
1252
|
pending: [],
|
|
@@ -591,7 +1271,7 @@ function registerHeadTags(registry, context, tracking, emitResource, nonce, tags
|
|
|
591
1271
|
return;
|
|
592
1272
|
}
|
|
593
1273
|
if (!Array.isArray(tags)) tags = [tags];
|
|
594
|
-
const probe =
|
|
1274
|
+
const probe = sharedConfig.context && sharedConfig.context._loadingPhase;
|
|
595
1275
|
let replaceable = null;
|
|
596
1276
|
for (let i = 0; i < tags.length; i++) {
|
|
597
1277
|
const desc = tags[i];
|
|
@@ -606,7 +1286,7 @@ function registerHeadTags(registry, context, tracking, emitResource, nonce, tags
|
|
|
606
1286
|
} : undefined);
|
|
607
1287
|
evalHeadValue(desc.key);
|
|
608
1288
|
} catch (err) {
|
|
609
|
-
if (
|
|
1289
|
+
if (ssrHandleError(err)) throw err;
|
|
610
1290
|
}
|
|
611
1291
|
}
|
|
612
1292
|
if (cls.resource) {
|
|
@@ -628,7 +1308,7 @@ function registerHeadTags(registry, context, tracking, emitResource, nonce, tags
|
|
|
628
1308
|
function headShellReady(registry, block) {
|
|
629
1309
|
let ready = true;
|
|
630
1310
|
const pends = err => {
|
|
631
|
-
const source =
|
|
1311
|
+
const source = ssrHandleError(err, true);
|
|
632
1312
|
if (!source) return false;
|
|
633
1313
|
block(source);
|
|
634
1314
|
ready = false;
|
|
@@ -677,9 +1357,9 @@ function emitHeadResource(registry, context, tracking, emitResource, nonce, desc
|
|
|
677
1357
|
rel
|
|
678
1358
|
} : undefined);
|
|
679
1359
|
} catch (err) {
|
|
680
|
-
const loadingPhase =
|
|
681
|
-
if (loadingPhase &&
|
|
682
|
-
if (!loadingPhase && !context._currentBoundaryId && !registry.shellFlushed && typeof context.block === "function" &&
|
|
1360
|
+
const loadingPhase = sharedConfig.context && sharedConfig.context._loadingPhase;
|
|
1361
|
+
if (loadingPhase && ssrHandleError(err)) throw err;
|
|
1362
|
+
if (!loadingPhase && !context._currentBoundaryId && !registry.shellFlushed && typeof context.block === "function" && ssrHandleError(err, true)) {
|
|
683
1363
|
registry.parkedResources.push({
|
|
684
1364
|
desc,
|
|
685
1365
|
rel,
|
|
@@ -703,7 +1383,7 @@ function emitHeadResource(registry, context, tracking, emitResource, nonce, desc
|
|
|
703
1383
|
if (plain && props.href != null) {
|
|
704
1384
|
const isCss = isCssUrl(props.href);
|
|
705
1385
|
if (rel === "stylesheet" ? isCss : !isCss) {
|
|
706
|
-
context.registerAsset(rel === "stylesheet" ? "style" : "module", props.href);
|
|
1386
|
+
context.registerAsset(rel === "stylesheet" ? "style" : "module", props.href, true);
|
|
707
1387
|
return;
|
|
708
1388
|
}
|
|
709
1389
|
}
|
|
@@ -817,7 +1497,7 @@ function headGroupSignature(winner) {
|
|
|
817
1497
|
}
|
|
818
1498
|
return sig;
|
|
819
1499
|
}
|
|
820
|
-
function renderShellHead(registry, nonce, isPendingFragment, noScripts) {
|
|
1500
|
+
function renderShellHead(registry, nonce, isPendingFragment, noScripts, traceMetas = "") {
|
|
821
1501
|
commitHeadBoundary(registry, "", isPendingFragment);
|
|
822
1502
|
registry.shellFlushed = true;
|
|
823
1503
|
const winners = resolveHead(registry.committed);
|
|
@@ -843,11 +1523,12 @@ function renderShellHead(registry, nonce, isPendingFragment, noScripts) {
|
|
|
843
1523
|
}
|
|
844
1524
|
return {
|
|
845
1525
|
prelude,
|
|
846
|
-
html: registry.eagerHtml + links + metas + others + scripts,
|
|
1526
|
+
html: registry.eagerHtml + links + metas + traceMetas + others + scripts,
|
|
847
1527
|
title,
|
|
848
1528
|
noScripts
|
|
849
1529
|
};
|
|
850
1530
|
}
|
|
1531
|
+
let headBodyHook;
|
|
851
1532
|
function flushHeadFragment(registry, boundary, nonce) {
|
|
852
1533
|
const groups = commitHeadBoundary(registry, boundary);
|
|
853
1534
|
if (!groups.length) return null;
|
|
@@ -871,7 +1552,7 @@ function flushHeadFragment(registry, boundary, nonce) {
|
|
|
871
1552
|
const t = winner.tags[i];
|
|
872
1553
|
const attrs = {};
|
|
873
1554
|
for (const name in t.props) {
|
|
874
|
-
if (name === "children" || name === "ref" || name
|
|
1555
|
+
if (name === "children" || name === "ref" || isEventName(name)) continue;
|
|
875
1556
|
if (!HEAD_ATTR_NAME.test(name)) {
|
|
876
1557
|
continue;
|
|
877
1558
|
}
|
|
@@ -885,7 +1566,7 @@ function flushHeadFragment(registry, boundary, nonce) {
|
|
|
885
1566
|
if (value) attrs.nonce = String(value);
|
|
886
1567
|
}
|
|
887
1568
|
const children = t.props.children;
|
|
888
|
-
ops.push(["a", identity, t.tag, attrs, children == null ? null : String(children)]);
|
|
1569
|
+
ops.push(["a", identity, t.tag, attrs, children == null ? null : headBodyHook ? headBodyHook(t.tag, t.props, String(children)) : String(children)]);
|
|
889
1570
|
}
|
|
890
1571
|
}
|
|
891
1572
|
return ops.length ? ops : null;
|
|
@@ -913,19 +1594,9 @@ function normalizeNonce(nonce) {
|
|
|
913
1594
|
}
|
|
914
1595
|
function destinationNonce(nonce, destination) {
|
|
915
1596
|
if (nonce == null) return undefined;
|
|
916
|
-
|
|
917
|
-
const value = nonce[destination];
|
|
1597
|
+
const value = typeof nonce === "string" ? nonce : nonce[destination];
|
|
918
1598
|
return typeof value === "string" && value ? value : undefined;
|
|
919
1599
|
}
|
|
920
|
-
function scriptNonce(nonce) {
|
|
921
|
-
return destinationNonce(nonce, "script");
|
|
922
|
-
}
|
|
923
|
-
function styleNonce(nonce) {
|
|
924
|
-
return destinationNonce(nonce, "style");
|
|
925
|
-
}
|
|
926
|
-
function asciiLowerCase(value) {
|
|
927
|
-
return value.replace(/[A-Z]/g, c => String.fromCharCode(c.charCodeAt(0) + 32));
|
|
928
|
-
}
|
|
929
1600
|
function hasNonceProp(props) {
|
|
930
1601
|
for (const name in props) if (name.length === 5 && asciiLowerCase(name) === "nonce" && props[name] != null) return true;
|
|
931
1602
|
return false;
|
|
@@ -956,6 +1627,10 @@ function nonceDestination(tag, props) {
|
|
|
956
1627
|
return "script";
|
|
957
1628
|
}
|
|
958
1629
|
}
|
|
1630
|
+
function modulePreloadLink(url, scriptAttr, lowModules) {
|
|
1631
|
+
const priority = lowModules && !lowModules.has(url) ? ' fetchpriority="low"' : "";
|
|
1632
|
+
return `<link rel="modulepreload" href="${url}"${priority}${scriptAttr}>`;
|
|
1633
|
+
}
|
|
959
1634
|
function nonceAttr(nonce, destination) {
|
|
960
1635
|
if (!nonce || !destination) return "";
|
|
961
1636
|
return destination === "script" ? nonce.scriptAttr : nonce.styleAttr;
|
|
@@ -963,7 +1638,7 @@ function nonceAttr(nonce, destination) {
|
|
|
963
1638
|
function renderHeadAttrHtml(props) {
|
|
964
1639
|
let attrs = "";
|
|
965
1640
|
for (const name in props) {
|
|
966
|
-
if (name === "children" || name === "ref" || name
|
|
1641
|
+
if (name === "children" || name === "ref" || isEventName(name)) continue;
|
|
967
1642
|
if (!HEAD_ATTR_NAME.test(name)) {
|
|
968
1643
|
continue;
|
|
969
1644
|
}
|
|
@@ -976,7 +1651,7 @@ function renderHeadAttrHtml(props) {
|
|
|
976
1651
|
function headAttrRecord(props, skipRelHref) {
|
|
977
1652
|
let attrs = null;
|
|
978
1653
|
for (const name in props) {
|
|
979
|
-
if (name === "children" || name === "ref" || name
|
|
1654
|
+
if (name === "children" || name === "ref" || isEventName(name)) continue;
|
|
980
1655
|
if ((name === "rel" || name === "href")) continue;
|
|
981
1656
|
if (!HEAD_ATTR_NAME.test(name)) continue;
|
|
982
1657
|
const v = props[name];
|
|
@@ -991,18 +1666,60 @@ function renderHeadTagMarkup(tag, props, identity, nonce) {
|
|
|
991
1666
|
if (nonce && !hasNonceProp(props)) attrs += nonceAttr(nonce, nonceDestination(tag, props));
|
|
992
1667
|
if (tag === "meta" || tag === "link" || tag === "base") return `<${tag}${attrs}>`;
|
|
993
1668
|
let body = props.children == null ? "" : String(props.children);
|
|
1669
|
+
if (headBodyHook) body = headBodyHook(tag, props, body);
|
|
994
1670
|
if (tag === "script") body = body.replace(/<\/(script)/gi, "<\\/$1");else if (tag === "style") body = escapeStyleContent(body);else body = escape(body);
|
|
995
1671
|
return `<${tag}${attrs}>${body}</${tag}>`;
|
|
996
1672
|
}
|
|
997
1673
|
function useHead(tags) {
|
|
998
|
-
const ctx =
|
|
1674
|
+
const ctx = sharedConfig.context;
|
|
999
1675
|
if (!ctx || !ctx.registerHeadTags) {
|
|
1000
1676
|
return;
|
|
1001
1677
|
}
|
|
1678
|
+
headBodyHook = headBodyText;
|
|
1002
1679
|
ctx.registerHeadTags(tags);
|
|
1003
1680
|
}
|
|
1004
1681
|
const VOID_ELEMENTS = /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
|
|
1005
|
-
const
|
|
1682
|
+
const NOT_NAME = /[\0-\x20\x7F-\x9F"'<>/=]/;
|
|
1683
|
+
const TAG_START = /^[a-zA-Z]/;
|
|
1684
|
+
const tagInfos = /*#__PURE__*/new Map();
|
|
1685
|
+
function tagInfo(tag) {
|
|
1686
|
+
let info = tagInfos.get(tag);
|
|
1687
|
+
if (info === undefined) {
|
|
1688
|
+
if (!TAG_START.test(tag) || NOT_NAME.test(tag)) throw new Error(`"${tag}" is not a valid tag name`);
|
|
1689
|
+
let formDefaults, formAttributes;
|
|
1690
|
+
if (tag === "input" || tag === "option") {
|
|
1691
|
+
formDefaults = Object.create(null);
|
|
1692
|
+
formAttributes = Object.create(null);
|
|
1693
|
+
const state = DOMWithState[tag.toUpperCase()];
|
|
1694
|
+
for (const prop in state) {
|
|
1695
|
+
if (state[prop] === 2) {
|
|
1696
|
+
const attr = prop.slice(7).toLowerCase();
|
|
1697
|
+
formDefaults[attr] = prop;
|
|
1698
|
+
formAttributes[prop] = attr;
|
|
1699
|
+
}
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
info = {
|
|
1703
|
+
open: "<" + tag,
|
|
1704
|
+
close: "</" + tag + ">",
|
|
1705
|
+
isVoid: VOID_ELEMENTS.test(tag),
|
|
1706
|
+
textarea: tag === "textarea",
|
|
1707
|
+
raw: tag === "script" || tag === "style",
|
|
1708
|
+
formDefaults,
|
|
1709
|
+
formAttributes
|
|
1710
|
+
};
|
|
1711
|
+
if (tagInfos.size < 512) tagInfos.set(tag, info);
|
|
1712
|
+
}
|
|
1713
|
+
return info;
|
|
1714
|
+
}
|
|
1715
|
+
const safeAttrNames = /*#__PURE__*/new Set();
|
|
1716
|
+
function isAttrName(prop) {
|
|
1717
|
+
if (safeAttrNames.has(prop)) return true;
|
|
1718
|
+
if (prop === "" || NOT_NAME.test(prop)) return false;
|
|
1719
|
+
if (safeAttrNames.size < 512) safeAttrNames.add(prop);
|
|
1720
|
+
return true;
|
|
1721
|
+
}
|
|
1722
|
+
const REPLACE_SCRIPT = `function $df(e){return _$HY.f?_$HY.f(e):$dfr(e)}function $dfr(e,n,o,t){if(!(n=document.getElementById(e)))return 0;if(!(o=document.getElementById("pl-"+e)))return(_$HY.dq=_$HY.dq||{})[e]=1,0;for(;o&&(8!==o.nodeType||o.nodeValue!=="pl-"+e);)t=o.nextSibling,o.remove(),o=t;t=o.parentNode,(_$HY.v=_$HY.v||{})[e]=n.hasAttribute("e")?[...n.content.childNodes]:1,o.replaceWith(n.content),n.remove(),_$HY.fe(e,t),_$HY.hp&&_$HY.hp[e]&&($dh(_$HY.hp[e]),delete _$HY.hp[e]),$dfd();return 1}function $dfl(e,o,n){if(!(o=document.getElementById("pl-"+e)))return(_$HY.dlq=_$HY.dlq||{})[e]=1,0;if(o._$fl)return 1;for(n=o.nextSibling;n;){if(8===n.nodeType&&n.nodeValue==="pl-"+e){o.parentNode&&o.parentNode.insertBefore(o.content.cloneNode(!0),n),o._$fl=1,$dfd();return 1}n=n.nextSibling}return 0}function $dflj(e,i){for(i=0;i<e.length;i++)$dfl(e[i])}function $dfd(e,i){if(e=_$HY.dq){_$HY.dq=0;for(i in e)$df(i)}if(e=_$HY.dlq){_$HY.dlq=0;for(i in e)$dfl(i)}}function $dfs(e,c,d){(_$HY.sc=_$HY.sc||{})[e]=c,d&&((_$HY.sd=_$HY.sd||{})[e]=1)}function $dfg(e,g,i,k){if(!(g=_$HY.sg&&_$HY.sg[e]))return;for(i=0;i<g.length;i++)if(_$HY.sc&&_$HY.sc[g[i]]>0)return;for(i=0;i<g.length;i++)k=g[i],delete _$HY.sg[k],$df(k)}function $dfc(e){if(--_$HY.sc[e]<=0){delete _$HY.sc[e],_$HY.sg&&_$HY.sg[e]?$dfg(e):!(_$HY.sd&&_$HY.sd[e])&&$df(e);_$HY.sd&&delete _$HY.sd[e]}}function $dfj(e,i,n){for(i=0;i<e.length;i++)if(_$HY.sc&&_$HY.sc[e[i]]>0){for(n=0;n<e.length;n++)(_$HY.sg=_$HY.sg||{})[e[n]]=e;return}for(i=0;i<e.length;i++)$df(e[i])}function $dfe(e,t,k){(t=e.target)&&t.getAttribute&&!t._$dc&&(k=t.getAttribute("data-dfc"))&&(t._$dc=1,$dfc(k))}document.addEventListener("load",$dfe,!0);document.addEventListener("error",$dfe,!0)`;
|
|
1006
1723
|
const HEAD_SCRIPT = `function $dha(o,i,e,n){for(i=0;i<o.length;i++)e=o[i],"t"==e[0]?((n=document.querySelector("title"))?n.hasAttribute("data-dh")||n.setAttribute("data-dhf",n.textContent):(n=document.createElement("title"),document.head.appendChild(n)),n.textContent=e[1],n.setAttribute("data-dh","title")):"r"==e[0]?$dhr(e[1]):(n=document.createElement(e[2]),Object.keys(e[3]).forEach(function(a){n.setAttribute(a,e[3][a])}),null!=e[4]&&(n.textContent=e[4]),n.setAttribute("data-dh",e[1]),document.head.appendChild(n))}function $dhr(v,l,i){for(l=document.head.querySelectorAll("[data-dh]"),i=0;i<l.length;i++)l[i].getAttribute("data-dh")==v&&l[i].remove()}function $dh(o){_$HY.h?_$HY.h(o):$dha(o)}`;
|
|
1007
1724
|
function renderToString(code, options = {}) {
|
|
1008
1725
|
const {
|
|
@@ -1012,6 +1729,8 @@ function renderToString(code, options = {}) {
|
|
|
1012
1729
|
onHead
|
|
1013
1730
|
} = options;
|
|
1014
1731
|
const nonce = normalizeNonce(options.nonce);
|
|
1732
|
+
const requestEvent = peekRequestEvent();
|
|
1733
|
+
const errorScope = requestEvent || {};
|
|
1015
1734
|
let scripts = "";
|
|
1016
1735
|
const serializer = createHydrationSerializer({
|
|
1017
1736
|
scopeId: renderId,
|
|
@@ -1023,26 +1742,33 @@ function renderToString(code, options = {}) {
|
|
|
1023
1742
|
}
|
|
1024
1743
|
scripts += script + ";";
|
|
1025
1744
|
},
|
|
1026
|
-
onError: options.onError
|
|
1745
|
+
onError: serializerErrorHook(options.onError)
|
|
1027
1746
|
});
|
|
1028
|
-
const tracking = createAssetTracking();
|
|
1747
|
+
const tracking = createAssetTracking(options.lowPriorityPreloads);
|
|
1029
1748
|
const headRegistry = createHeadRegistry();
|
|
1030
|
-
|
|
1749
|
+
let closed = false;
|
|
1750
|
+
sharedConfig.context = {
|
|
1031
1751
|
nonce: options.nonce,
|
|
1032
1752
|
escape: escape,
|
|
1033
1753
|
resolve: resolveSSRNode,
|
|
1034
1754
|
ssr: ssr,
|
|
1755
|
+
errorPolicy: options.onError,
|
|
1756
|
+
_errorScope: errorScope,
|
|
1035
1757
|
registerHeadTags(tags) {
|
|
1036
|
-
registerHeadTags(headRegistry,
|
|
1758
|
+
registerHeadTags(headRegistry, sharedConfig.context, tracking, null, nonce, tags);
|
|
1037
1759
|
},
|
|
1038
1760
|
serialize(id, p) {
|
|
1039
|
-
if (
|
|
1761
|
+
if (closed) return;
|
|
1040
1762
|
if (p != null && typeof p === "object" && (typeof p.then === "function" || typeof p[Symbol.asyncIterator] === "function")) {
|
|
1041
1763
|
throw new Error("Cannot serialize async value in renderToString (id: " + id + "). " + "Use renderToStream for async data.");
|
|
1042
1764
|
}
|
|
1043
1765
|
serializer.write(id, p);
|
|
1044
1766
|
},
|
|
1045
|
-
registerAsset(type, value) {
|
|
1767
|
+
registerAsset(type, value, defaultPriority) {
|
|
1768
|
+
if (type === "preload") {
|
|
1769
|
+
registerPreloadLink(tracking, headRegistry, value, nonce);
|
|
1770
|
+
return;
|
|
1771
|
+
}
|
|
1046
1772
|
if (type === "inline-style") {
|
|
1047
1773
|
tracking.registerInlineStyle(value);
|
|
1048
1774
|
return;
|
|
@@ -1055,23 +1781,56 @@ function renderToString(code, options = {}) {
|
|
|
1055
1781
|
}
|
|
1056
1782
|
styles.add(value);
|
|
1057
1783
|
}
|
|
1784
|
+
if (defaultPriority && tracking.lowModules) tracking.lowModules.add(value);
|
|
1058
1785
|
tracking.emittedAssets.add(value);
|
|
1059
1786
|
}
|
|
1060
1787
|
};
|
|
1061
|
-
applyAssetTracking(
|
|
1788
|
+
applyAssetTracking(sharedConfig.context, tracking, manifest, noScripts);
|
|
1062
1789
|
registerEntryAssets(manifest);
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1790
|
+
const context = sharedConfig.context;
|
|
1791
|
+
context.writer = createHydrationWriter(context, () => !closed);
|
|
1792
|
+
if (requestEvent) setRequestErrorHook(requestEvent, options.onError);
|
|
1793
|
+
context.trace = requestEvent ? traceForEvent(requestEvent) : traceFor(context, undefined);
|
|
1794
|
+
const render = timeDocument(context, context.trace, "string", requestEvent);
|
|
1795
|
+
let dispose;
|
|
1796
|
+
let rootOwner;
|
|
1797
|
+
let rendered = false;
|
|
1798
|
+
try {
|
|
1799
|
+
const html = createRoot(d => {
|
|
1800
|
+
dispose = d;
|
|
1801
|
+
rootOwner = claimRenderRoot(context);
|
|
1802
|
+
if (requestEvent) claimEventRender(requestEvent, context);
|
|
1803
|
+
return resolveSSRSync(escape(code()));
|
|
1804
|
+
}, {
|
|
1805
|
+
id: renderId
|
|
1806
|
+
});
|
|
1807
|
+
serializeFragmentAssets("", tracking.boundaryModules, sharedConfig.context, renderId);
|
|
1808
|
+
closed = true;
|
|
1809
|
+
serializer.close();
|
|
1810
|
+
const head = renderShellHead(headRegistry, nonce, null, noScripts, traceMetaMarkup(context.trace));
|
|
1811
|
+
const document = withShellEnd(assembleDocument(resolveSSRSelectValues(html), tracking.emittedAssets, tracking.preloadLinks, tracking.inlineStyles, scripts.length ? scripts : "", nonce, head, onHead, tracking.lowModules), context, renderId, nonce, noScripts);
|
|
1812
|
+
if (render) render.shell();
|
|
1813
|
+
if (requestEvent && requestEvent.response) {
|
|
1814
|
+
commitResponseStub(requestEvent.response, {
|
|
1815
|
+
event: requestEvent
|
|
1816
|
+
});
|
|
1817
|
+
}
|
|
1818
|
+
rendered = true;
|
|
1819
|
+
return document;
|
|
1820
|
+
} catch (err) {
|
|
1821
|
+
reportServerError(err, {
|
|
1822
|
+
kind: "render",
|
|
1823
|
+
handling: "failed"
|
|
1824
|
+
}, null, options.onError, errorScope);
|
|
1825
|
+
throw err;
|
|
1826
|
+
} finally {
|
|
1827
|
+
if (render) settleRender(render, rootOwner, rendered ? "complete" : "error");
|
|
1828
|
+
context.trace = undefined;
|
|
1829
|
+
if (dispose) dispose();
|
|
1830
|
+
}
|
|
1074
1831
|
}
|
|
1832
|
+
const SHELL_ABANDONED = Symbol();
|
|
1833
|
+
const ABANDON_RENDER = Symbol();
|
|
1075
1834
|
function renderToStream(code, options = {}) {
|
|
1076
1835
|
let {
|
|
1077
1836
|
onCompleteShell,
|
|
@@ -1082,12 +1841,59 @@ function renderToStream(code, options = {}) {
|
|
|
1082
1841
|
onHead
|
|
1083
1842
|
} = options;
|
|
1084
1843
|
const nonce = normalizeNonce(options.nonce);
|
|
1844
|
+
const requestEvent = peekRequestEvent();
|
|
1845
|
+
if (requestEvent) setRequestErrorHook(requestEvent, options.onError);
|
|
1846
|
+
const errorScope = requestEvent || {};
|
|
1847
|
+
const reportFailure = (err, handling) => {
|
|
1848
|
+
reportServerError(err, {
|
|
1849
|
+
kind: "render",
|
|
1850
|
+
handling
|
|
1851
|
+
}, null, options.onError, errorScope);
|
|
1852
|
+
if (!options.onError && ambientServerErrorHook() === undefined) console.error(err);
|
|
1853
|
+
};
|
|
1085
1854
|
let dispose;
|
|
1086
1855
|
let dead = false;
|
|
1087
|
-
|
|
1856
|
+
let render;
|
|
1857
|
+
let rootOwner;
|
|
1858
|
+
let serializer;
|
|
1859
|
+
let disconnected = false;
|
|
1860
|
+
let onFailed;
|
|
1861
|
+
const defuse = p => {
|
|
1862
|
+
if (p && typeof p.then === "function") p.then(undefined, () => {});
|
|
1863
|
+
};
|
|
1864
|
+
const abandonedSerializer = {
|
|
1865
|
+
write(_, value) {
|
|
1866
|
+
defuse(value);
|
|
1867
|
+
},
|
|
1868
|
+
flush() {},
|
|
1869
|
+
close() {}
|
|
1870
|
+
};
|
|
1871
|
+
const onFailure = complete => {
|
|
1872
|
+
if (dead) return complete(undefined, disconnected || undefined);
|
|
1873
|
+
const prev = onFailed;
|
|
1874
|
+
onFailed = prev ? (sink, gone) => {
|
|
1875
|
+
prev(sink, gone);
|
|
1876
|
+
complete(sink, gone);
|
|
1877
|
+
} : complete;
|
|
1878
|
+
};
|
|
1879
|
+
const abandon = (disconnect, quiet) => {
|
|
1088
1880
|
if (dead) return;
|
|
1881
|
+
if (disconnect && !quiet) emitFinding({
|
|
1882
|
+
code: "SSR_STREAM_ABANDONED",
|
|
1883
|
+
kind: "ssr",
|
|
1884
|
+
severity: "warn",
|
|
1885
|
+
message: `[SSR_STREAM_ABANDONED] The response stream was abandoned mid-render (${disconnect}) ` + `with ${registry.size} fragment(s) still pending; the render was torn down.`,
|
|
1886
|
+
data: {
|
|
1887
|
+
reason: disconnect,
|
|
1888
|
+
shellFlushed: firstFlushed,
|
|
1889
|
+
pendingFragments: registry.size
|
|
1890
|
+
}
|
|
1891
|
+
}, null);
|
|
1089
1892
|
dead = true;
|
|
1090
1893
|
completed = true;
|
|
1894
|
+
if (disconnect) disconnected = disconnect;
|
|
1895
|
+
if (render) settleRender(render, rootOwner, disconnect ? "abandoned" : "error");
|
|
1896
|
+
const sink = writable;
|
|
1091
1897
|
buffer = {
|
|
1092
1898
|
write() {}
|
|
1093
1899
|
};
|
|
@@ -1099,13 +1905,40 @@ function renderToStream(code, options = {}) {
|
|
|
1099
1905
|
dispose = () => {};
|
|
1100
1906
|
d();
|
|
1101
1907
|
}
|
|
1908
|
+
if (serializer && typeof serializer.close === "function") {
|
|
1909
|
+
try {
|
|
1910
|
+
serializer.close();
|
|
1911
|
+
} catch (err) {
|
|
1912
|
+
reportServerError(err, {
|
|
1913
|
+
kind: "render",
|
|
1914
|
+
handling: "serialize"
|
|
1915
|
+
}, null, options.onError, errorScope);
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
serializer = abandonedSerializer;
|
|
1919
|
+
if (stubBatch) {
|
|
1920
|
+
for (const p of stubBatch.values()) defuse(p);
|
|
1921
|
+
stubBatch = null;
|
|
1922
|
+
}
|
|
1923
|
+
onFailed && onFailed(sink, disconnect);
|
|
1102
1924
|
};
|
|
1103
1925
|
const failRender = err => {
|
|
1104
|
-
|
|
1105
|
-
options.onError ? options.onError(err) : console.error(err);
|
|
1106
|
-
} catch (_) {}
|
|
1926
|
+
reportFailure(err, "failed");
|
|
1107
1927
|
abandon();
|
|
1108
1928
|
};
|
|
1929
|
+
const failRootRender = err => {
|
|
1930
|
+
emitFinding({
|
|
1931
|
+
code: "SSR_RENDER_ERROR_CONTAINED",
|
|
1932
|
+
kind: "ssr",
|
|
1933
|
+
severity: "error",
|
|
1934
|
+
message: `[SSR_RENDER_ERROR_CONTAINED] Render error outside any boundary — the request failed: ` + errorText(err),
|
|
1935
|
+
data: {
|
|
1936
|
+
handling: "failed",
|
|
1937
|
+
error: err
|
|
1938
|
+
}
|
|
1939
|
+
}, null);
|
|
1940
|
+
failRender(err);
|
|
1941
|
+
};
|
|
1109
1942
|
const coalesceWrites = (writeRaw, endRaw) => {
|
|
1110
1943
|
let buf = "";
|
|
1111
1944
|
let scheduled = false;
|
|
@@ -1134,39 +1967,53 @@ function renderToStream(code, options = {}) {
|
|
|
1134
1967
|
};
|
|
1135
1968
|
const guardSink = w => ({
|
|
1136
1969
|
write(payload) {
|
|
1137
|
-
if (
|
|
1970
|
+
if (disconnected) return;
|
|
1138
1971
|
try {
|
|
1139
1972
|
w.write(payload);
|
|
1140
1973
|
} catch (_) {
|
|
1141
|
-
abandon();
|
|
1974
|
+
abandon("sink");
|
|
1142
1975
|
}
|
|
1143
1976
|
},
|
|
1144
1977
|
end() {
|
|
1145
|
-
if (
|
|
1978
|
+
if (disconnected) return;
|
|
1146
1979
|
try {
|
|
1147
1980
|
w.end();
|
|
1148
1981
|
} catch (_) {
|
|
1149
|
-
abandon();
|
|
1982
|
+
abandon("sink");
|
|
1150
1983
|
}
|
|
1151
1984
|
}
|
|
1152
1985
|
});
|
|
1153
1986
|
const blockingPromises = new Set();
|
|
1154
1987
|
const canBatchStubs = !options.serializer && !options.sink;
|
|
1155
1988
|
let stubBatch = null;
|
|
1156
|
-
|
|
1989
|
+
let stableOrder = false;
|
|
1990
|
+
let parkedWrites = null;
|
|
1991
|
+
const byKey = (a, b) => a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0;
|
|
1992
|
+
let writing = 0;
|
|
1993
|
+
let stranded = false;
|
|
1994
|
+
const handOver = (id, value) => {
|
|
1995
|
+
writing++;
|
|
1996
|
+
try {
|
|
1997
|
+
serializer.write(id, value);
|
|
1998
|
+
} finally {
|
|
1999
|
+
writing--;
|
|
2000
|
+
}
|
|
2001
|
+
};
|
|
2002
|
+
const write = (id, value) => {
|
|
2003
|
+
if (stableOrder && !dead) (parkedWrites ||= []).push([id, value]);else handOver(id, value);
|
|
2004
|
+
};
|
|
2005
|
+
const flushParkedWrites = () => {
|
|
2006
|
+
if (!parkedWrites) return;
|
|
2007
|
+
const writes = parkedWrites.sort(byKey);
|
|
2008
|
+
parkedWrites = null;
|
|
2009
|
+
for (let i = 0; i < writes.length; i++) handOver(writes[i][0], writes[i][1]);
|
|
2010
|
+
};
|
|
1157
2011
|
const flushStubBatch = () => {
|
|
1158
2012
|
if (!stubBatch) return;
|
|
1159
|
-
const
|
|
2013
|
+
const entries = [...stubBatch];
|
|
1160
2014
|
stubBatch = null;
|
|
1161
|
-
if (
|
|
1162
|
-
|
|
1163
|
-
serializer.write(id, p);
|
|
1164
|
-
return;
|
|
1165
|
-
}
|
|
1166
|
-
const obj = {};
|
|
1167
|
-
for (const [id, p] of batch) obj[id] = p;
|
|
1168
|
-
serializer.write(STUB_BATCH_KEY, obj);
|
|
1169
|
-
pushTask(`(b=>{for(var k in b)_$HY.r[k]=b[k];delete _$HY.r["${STUB_BATCH_KEY}"]})(_$HY.r["${STUB_BATCH_KEY}"])`);
|
|
2015
|
+
if (stableOrder) entries.sort(byKey);
|
|
2016
|
+
for (let i = 0; i < entries.length; i++) handOver(entries[i][0], entries[i][1]);
|
|
1170
2017
|
};
|
|
1171
2018
|
let headerEmitted = false;
|
|
1172
2019
|
const pushTask = task => {
|
|
@@ -1182,7 +2029,10 @@ function renderToStream(code, options = {}) {
|
|
|
1182
2029
|
}
|
|
1183
2030
|
};
|
|
1184
2031
|
const onDone = () => {
|
|
2032
|
+
if (dead) return;
|
|
1185
2033
|
writeTasks();
|
|
2034
|
+
if (stranded) return abandon();
|
|
2035
|
+
lastBlockingSize = blockingPromises.size;
|
|
1186
2036
|
doShell();
|
|
1187
2037
|
onCompleteAll && onCompleteAll({
|
|
1188
2038
|
write(v) {
|
|
@@ -1191,6 +2041,7 @@ function renderToStream(code, options = {}) {
|
|
|
1191
2041
|
});
|
|
1192
2042
|
writable && writable.end();
|
|
1193
2043
|
completed = true;
|
|
2044
|
+
if (render) settleRender(render, rootOwner, "complete");
|
|
1194
2045
|
if (firstFlushed) dispose();
|
|
1195
2046
|
};
|
|
1196
2047
|
const sink = {
|
|
@@ -1200,6 +2051,7 @@ function renderToStream(code, options = {}) {
|
|
|
1200
2051
|
fragment(key, value, meta) {
|
|
1201
2052
|
const deferActivation = !!meta.revealGroup;
|
|
1202
2053
|
const styles = meta.styles;
|
|
2054
|
+
const tpl = `<template id="${key}"${meta.error ? " e" : ""}>${value}</template>`;
|
|
1203
2055
|
for (let i = 0; i < styles.inline.length; i++) {
|
|
1204
2056
|
buffer.write(renderInlineStyle(styles.inline[i], nonce));
|
|
1205
2057
|
}
|
|
@@ -1207,12 +2059,12 @@ function renderToStream(code, options = {}) {
|
|
|
1207
2059
|
const styleAttr = nonceAttr(nonce, "style");
|
|
1208
2060
|
emitTask(`$dfs("${key}",${styles.links.length},${deferActivation ? 1 : 0})`);
|
|
1209
2061
|
writeTasks();
|
|
2062
|
+
buffer.write(tpl);
|
|
1210
2063
|
for (const entry of styles.links) {
|
|
1211
|
-
buffer.write(typeof entry === "string" ? `<link rel="stylesheet" href="${entry}"${styleAttr}
|
|
2064
|
+
buffer.write(typeof entry === "string" ? `<link rel="stylesheet" href="${entry}"${styleAttr} data-dfc="${key}">` : `<link${entry.attrHtml}${styleAttr} data-dfc="${key}">`);
|
|
1212
2065
|
}
|
|
1213
|
-
buffer.write(`<template id="${key}">${value}</template>`);
|
|
1214
2066
|
} else {
|
|
1215
|
-
buffer.write(
|
|
2067
|
+
buffer.write(tpl);
|
|
1216
2068
|
if (!deferActivation) {
|
|
1217
2069
|
emitTask(`$df("${key}")`);
|
|
1218
2070
|
}
|
|
@@ -1223,7 +2075,9 @@ function renderToStream(code, options = {}) {
|
|
|
1223
2075
|
},
|
|
1224
2076
|
asset(type, value) {
|
|
1225
2077
|
if (type === "module") {
|
|
1226
|
-
buffer.write(
|
|
2078
|
+
buffer.write(modulePreloadLink(value, nonceAttr(nonce, "script"), tracking.lowModules));
|
|
2079
|
+
} else if (type === "preload") {
|
|
2080
|
+
buffer.write(`<link${value.attrHtml}>`);
|
|
1227
2081
|
} else if (type === "inline-style") {
|
|
1228
2082
|
buffer.write(renderInlineStyle(value, nonce));
|
|
1229
2083
|
} else if (type === "head-tag") {
|
|
@@ -1231,16 +2085,20 @@ function renderToStream(code, options = {}) {
|
|
|
1231
2085
|
}
|
|
1232
2086
|
},
|
|
1233
2087
|
shell(shellHtml, meta) {
|
|
1234
|
-
buffer.write(assembleDocument(shellHtml, meta.preloads, meta.inlineStyles, meta.tasks.length ? meta.tasks : "", nonce, meta.head, onHead));
|
|
2088
|
+
buffer.write(withShellEnd(assembleDocument(shellHtml, meta.preloads, meta.preloadLinks, meta.inlineStyles, meta.tasks.length ? meta.tasks : "", nonce, meta.head, onHead, tracking.lowModules), context, renderId, nonce, noScripts));
|
|
1235
2089
|
},
|
|
1236
2090
|
...options.sink
|
|
1237
2091
|
};
|
|
1238
|
-
|
|
2092
|
+
serializer = (options.serializer || createHydrationSerializer)({
|
|
1239
2093
|
scopeId: options.renderId,
|
|
1240
2094
|
plugins: options.plugins,
|
|
1241
2095
|
onData: payload => sink.data(payload),
|
|
1242
2096
|
onDone,
|
|
1243
|
-
onError:
|
|
2097
|
+
onError: err => {
|
|
2098
|
+
reportFailure(err, "serialize");
|
|
2099
|
+
if (!writing && !options.serializer && !firstFlushed) stranded = true;
|
|
2100
|
+
},
|
|
2101
|
+
late: rejectUnserializedKey
|
|
1244
2102
|
});
|
|
1245
2103
|
let rootAssetsSerialized = false;
|
|
1246
2104
|
const serializeRootAssets = () => {
|
|
@@ -1250,7 +2108,7 @@ function renderToStream(code, options = {}) {
|
|
|
1250
2108
|
};
|
|
1251
2109
|
let holds = 0;
|
|
1252
2110
|
const flushEnd = () => {
|
|
1253
|
-
if (!registry.size && !holds) {
|
|
2111
|
+
if (!registry.size && !holds && !rootHoles) {
|
|
1254
2112
|
serializeRootAssets();
|
|
1255
2113
|
queue(() => queue(() => {
|
|
1256
2114
|
if (context.live.end) {
|
|
@@ -1259,11 +2117,103 @@ function renderToStream(code, options = {}) {
|
|
|
1259
2117
|
end();
|
|
1260
2118
|
}
|
|
1261
2119
|
flushStubBatch();
|
|
2120
|
+
flushParkedWrites();
|
|
1262
2121
|
serializer.flush();
|
|
1263
2122
|
}));
|
|
1264
2123
|
}
|
|
1265
2124
|
};
|
|
1266
2125
|
const registry = new Map();
|
|
2126
|
+
const pendingSerialized = new Map();
|
|
2127
|
+
const guardedChannels = new WeakMap();
|
|
2128
|
+
const verdictNow = error => {
|
|
2129
|
+
throw ssrSanitizeError(error, null, undefined, undefined, errorScope);
|
|
2130
|
+
};
|
|
2131
|
+
const borderForm = value => toBorderForm(value);
|
|
2132
|
+
const guardIterable = iterable => ({
|
|
2133
|
+
[Symbol.asyncIterator]() {
|
|
2134
|
+
const iterator = iterable[Symbol.asyncIterator]();
|
|
2135
|
+
return {
|
|
2136
|
+
next: value => iterator.next(value).then(undefined, verdictNow),
|
|
2137
|
+
return: value => iterator.return ? iterator.return(value) : Promise.resolve({
|
|
2138
|
+
done: true,
|
|
2139
|
+
value
|
|
2140
|
+
}),
|
|
2141
|
+
throw: error => iterator.throw ? iterator.throw(error) : Promise.reject(error)
|
|
2142
|
+
};
|
|
2143
|
+
}
|
|
2144
|
+
});
|
|
2145
|
+
const guardStream = source => {
|
|
2146
|
+
const reader = source.getReader();
|
|
2147
|
+
return new ReadableStream({
|
|
2148
|
+
pull: c => reader.read().then(r => r.done ? c.close() : c.enqueue(r.value), e => {
|
|
2149
|
+
try {
|
|
2150
|
+
verdictNow(e);
|
|
2151
|
+
} catch (sanitized) {
|
|
2152
|
+
c.error(sanitized);
|
|
2153
|
+
}
|
|
2154
|
+
}),
|
|
2155
|
+
cancel: reason => reader.cancel(reason)
|
|
2156
|
+
});
|
|
2157
|
+
};
|
|
2158
|
+
const guardChannel = p => {
|
|
2159
|
+
if (!p || typeof p !== "object" || "__SEROVAL_STREAM__" in p) return p;
|
|
2160
|
+
let guarded = guardedChannels.get(p);
|
|
2161
|
+
if (guarded !== undefined) return guarded;
|
|
2162
|
+
if (typeof p.then === "function") {
|
|
2163
|
+
guarded = p.then(borderForm, verdictNow);
|
|
2164
|
+
} else if (typeof ReadableStream === "function" && p instanceof ReadableStream) {
|
|
2165
|
+
guarded = guardStream(p);
|
|
2166
|
+
} else {
|
|
2167
|
+
const border = borderForm(p);
|
|
2168
|
+
guarded = typeof border[Symbol.asyncIterator] === "function" ? guardIterable(border) : border;
|
|
2169
|
+
if (guarded === p) return p;
|
|
2170
|
+
}
|
|
2171
|
+
guardedChannels.set(p, guarded);
|
|
2172
|
+
return guarded;
|
|
2173
|
+
};
|
|
2174
|
+
const trackSerialized = (id, p) => {
|
|
2175
|
+
let settle;
|
|
2176
|
+
const raced = Promise.race([p, new Promise(r => settle = r)]);
|
|
2177
|
+
raced.catch(() => {});
|
|
2178
|
+
pendingSerialized.set(id, settle);
|
|
2179
|
+
const drop = () => pendingSerialized.delete(id);
|
|
2180
|
+
p.then(drop, drop);
|
|
2181
|
+
return raced;
|
|
2182
|
+
};
|
|
2183
|
+
const abandonSubtree = (key, error) => {
|
|
2184
|
+
if (key == null) return;
|
|
2185
|
+
let fragments = 0;
|
|
2186
|
+
let serialized = 0;
|
|
2187
|
+
for (const [k, entry] of registry) {
|
|
2188
|
+
if (k != null && k.length > key.length && k.startsWith(key)) {
|
|
2189
|
+
registry.delete(k);
|
|
2190
|
+
entry.resolve();
|
|
2191
|
+
fragments++;
|
|
2192
|
+
}
|
|
2193
|
+
}
|
|
2194
|
+
const unregister = [];
|
|
2195
|
+
for (const [id, settle] of pendingSerialized) {
|
|
2196
|
+
if (id.startsWith(key)) {
|
|
2197
|
+
pendingSerialized.delete(id);
|
|
2198
|
+
settle();
|
|
2199
|
+
serialized++;
|
|
2200
|
+
if (!stubBatch?.delete(id)) unregister.push(`delete _$HY.r[${JSON.stringify(id)}]`);
|
|
2201
|
+
}
|
|
2202
|
+
}
|
|
2203
|
+
if (unregister.length && !options.sink) pushTask(unregister.join(";"));
|
|
2204
|
+
if ((fragments || serialized)) emitFinding({
|
|
2205
|
+
code: "SSR_SUBTREE_ABANDONED",
|
|
2206
|
+
kind: "ssr",
|
|
2207
|
+
severity: "warn",
|
|
2208
|
+
message: `[SSR_SUBTREE_ABANDONED] Fragment '${key}' failed with ${fragments} nested fragment(s) and ` + `${serialized} serialized value(s) still pending; the subtree was discarded and the client ` + `renders it from scratch.`,
|
|
2209
|
+
data: {
|
|
2210
|
+
fragment: key,
|
|
2211
|
+
fragments,
|
|
2212
|
+
serialized,
|
|
2213
|
+
error
|
|
2214
|
+
}
|
|
2215
|
+
}, null);
|
|
2216
|
+
};
|
|
1267
2217
|
const writeTasks = () => {
|
|
1268
2218
|
if (tasks.length && !completed && firstFlushed) {
|
|
1269
2219
|
buffer.write(`<script${nonceAttr(nonce, "script")}>${tasks}</script>`);
|
|
@@ -1305,12 +2255,18 @@ function renderToStream(code, options = {}) {
|
|
|
1305
2255
|
}
|
|
1306
2256
|
let rootHoles = null;
|
|
1307
2257
|
let nextHoleId = 0;
|
|
2258
|
+
let parkedInlines = null;
|
|
2259
|
+
function inlineFragment(key, value) {
|
|
2260
|
+
if (rootHoles && !html.includes(`<template id="pl-${key}">`)) {
|
|
2261
|
+
(parkedInlines ||= new Map()).set(key, value);
|
|
2262
|
+
} else html = replacePlaceholder(html, key, value);
|
|
2263
|
+
}
|
|
1308
2264
|
let buffer = {
|
|
1309
2265
|
write(payload) {
|
|
1310
2266
|
tmp += payload;
|
|
1311
2267
|
}
|
|
1312
2268
|
};
|
|
1313
|
-
const tracking = createAssetTracking();
|
|
2269
|
+
const tracking = createAssetTracking(options.lowPriorityPreloads);
|
|
1314
2270
|
const headRegistry = createHeadRegistry();
|
|
1315
2271
|
let headScriptFlushed = false;
|
|
1316
2272
|
const emitHeadOps = (key, ops) => {
|
|
@@ -1318,9 +2274,11 @@ function renderToStream(code, options = {}) {
|
|
|
1318
2274
|
emitTask(`${!headScriptFlushed ? HEAD_SCRIPT : ""}(_$HY.hp=_$HY.hp||{})[${JSON.stringify(key)}]=${payload}`);
|
|
1319
2275
|
headScriptFlushed = true;
|
|
1320
2276
|
};
|
|
1321
|
-
|
|
2277
|
+
sharedConfig.context = context = {
|
|
1322
2278
|
async: true,
|
|
1323
2279
|
nonce: options.nonce,
|
|
2280
|
+
document: !options.sink,
|
|
2281
|
+
edges: !!options.plugins && options.plugins.some(p => p.tag === "solid/server-component"),
|
|
1324
2282
|
live: {},
|
|
1325
2283
|
registerHeadTags(tags) {
|
|
1326
2284
|
registerHeadTags(headRegistry, context, tracking,
|
|
@@ -1333,7 +2291,12 @@ function renderToStream(code, options = {}) {
|
|
|
1333
2291
|
}
|
|
1334
2292
|
}, nonce, tags);
|
|
1335
2293
|
},
|
|
1336
|
-
registerAsset(type, value) {
|
|
2294
|
+
registerAsset(type, value, defaultPriority) {
|
|
2295
|
+
if (type === "preload") {
|
|
2296
|
+
const entry = registerPreloadLink(tracking, headRegistry, value, nonce);
|
|
2297
|
+
if (entry && firstFlushed) sink.asset("preload", entry);
|
|
2298
|
+
return;
|
|
2299
|
+
}
|
|
1337
2300
|
if (type === "inline-style") {
|
|
1338
2301
|
const entry = tracking.registerInlineStyle(value);
|
|
1339
2302
|
if (firstFlushed && !tracking.currentBoundaryId && !entry.emitted) {
|
|
@@ -1350,6 +2313,7 @@ function renderToStream(code, options = {}) {
|
|
|
1350
2313
|
}
|
|
1351
2314
|
styles.add(value);
|
|
1352
2315
|
}
|
|
2316
|
+
if (defaultPriority && tracking.lowModules) tracking.lowModules.add(value);
|
|
1353
2317
|
if (!tracking.emittedAssets.has(value)) {
|
|
1354
2318
|
tracking.emittedAssets.add(value);
|
|
1355
2319
|
if (firstFlushed) sink.asset(type, value);
|
|
@@ -1377,19 +2341,20 @@ function renderToStream(code, options = {}) {
|
|
|
1377
2341
|
html = html.slice(0, first) + resolveSSRSync(escape(payloadFn())) + html.slice(last + placeholder.length + 1);
|
|
1378
2342
|
},
|
|
1379
2343
|
serialize(id, p, deferStream) {
|
|
1380
|
-
|
|
1381
|
-
if (
|
|
1382
|
-
if (deferStream) {
|
|
2344
|
+
p = guardChannel(p);
|
|
2345
|
+
if (p && typeof p === "object" && typeof p.then === "function") {
|
|
2346
|
+
if (!firstFlushed && deferStream) {
|
|
1383
2347
|
blockingPromises.add(p);
|
|
1384
|
-
p.then(d =>
|
|
2348
|
+
p.then(d => write(id, d)).catch(e => write(id, e));
|
|
1385
2349
|
return;
|
|
1386
2350
|
}
|
|
1387
|
-
|
|
2351
|
+
p = trackSerialized(id, p);
|
|
2352
|
+
if (!firstFlushed && canBatchStubs && !shellCompleted && !dead) {
|
|
1388
2353
|
(stubBatch ||= new Map()).set(id, p);
|
|
1389
2354
|
return;
|
|
1390
2355
|
}
|
|
1391
2356
|
}
|
|
1392
|
-
|
|
2357
|
+
write(id, p);
|
|
1393
2358
|
},
|
|
1394
2359
|
escape: escape,
|
|
1395
2360
|
resolve: resolveSSRNode,
|
|
@@ -1417,19 +2382,26 @@ function renderToStream(code, options = {}) {
|
|
|
1417
2382
|
if (!registry.has(key)) {
|
|
1418
2383
|
let resolve, reject;
|
|
1419
2384
|
const p = new Promise((r, rej) => (resolve = r, reject = rej));
|
|
2385
|
+
defuse(p);
|
|
1420
2386
|
registry.set(key, {
|
|
1421
2387
|
resolve: err => queue(() => queue(() => {
|
|
1422
|
-
err ? reject(err) : resolve(true);
|
|
2388
|
+
err ? reject(ssrSanitizeError(err, null, undefined, undefined, errorScope)) : resolve(true);
|
|
1423
2389
|
queue(flushEnd);
|
|
1424
2390
|
}))
|
|
1425
2391
|
});
|
|
1426
|
-
if (canBatchStubs && !shellCompleted) (stubBatch ||= new Map()).set(key + "_fr", p);else
|
|
2392
|
+
if (canBatchStubs && !shellCompleted && !dead) (stubBatch ||= new Map()).set(key + "_fr", p);else write(key + "_fr", p);
|
|
1427
2393
|
}
|
|
1428
|
-
return (value, error) => {
|
|
2394
|
+
return (value, error, escaped) => {
|
|
1429
2395
|
if (registry.has(key)) {
|
|
1430
2396
|
const item = registry.get(key);
|
|
1431
2397
|
registry.delete(key);
|
|
1432
|
-
if (
|
|
2398
|
+
if (error) abandonSubtree(key, error);
|
|
2399
|
+
if (error && escaped) {
|
|
2400
|
+
const wire = ssrSanitizeError(error, null, undefined, undefined, errorScope);
|
|
2401
|
+
const message = wire instanceof Error ? wire.message : String(wire);
|
|
2402
|
+
if (sink.error) sink.error("", message);else if (context.live && context.live.error) context.live.error(escaped.frame, message);
|
|
2403
|
+
}
|
|
2404
|
+
if (item.children && !error) {
|
|
1433
2405
|
for (const k in item.children) {
|
|
1434
2406
|
value = replacePlaceholder(value, k, item.children[k]);
|
|
1435
2407
|
}
|
|
@@ -1448,7 +2420,7 @@ function renderToStream(code, options = {}) {
|
|
|
1448
2420
|
if (!completed) {
|
|
1449
2421
|
if (error) dropHeadBoundary(headRegistry, key);
|
|
1450
2422
|
if (!firstFlushed) {
|
|
1451
|
-
queue(() =>
|
|
2423
|
+
queue(() => inlineFragment(key, value !== undefined ? value : ""));
|
|
1452
2424
|
serializeFragmentAssets(key, tracking.boundaryModules, context);
|
|
1453
2425
|
item.resolve(error);
|
|
1454
2426
|
} else {
|
|
@@ -1456,10 +2428,10 @@ function renderToStream(code, options = {}) {
|
|
|
1456
2428
|
const styles = collectStreamStyles(key, tracking, headStyles);
|
|
1457
2429
|
const headOps = error ? null : flushHeadFragment(headRegistry, key, nonce);
|
|
1458
2430
|
if (headOps) emitHeadOps(key, headOps);
|
|
1459
|
-
sink.fragment(key, resolveSSRSelectValues(value !== undefined ? value : " "), {
|
|
2431
|
+
sink.fragment(key, resolveSSRSelectValues(value !== undefined ? value : error ? "" : " "), {
|
|
1460
2432
|
styles,
|
|
1461
2433
|
revealGroup,
|
|
1462
|
-
error
|
|
2434
|
+
error: error ? ssrSanitizeError(error, null, undefined, undefined, errorScope) : error
|
|
1463
2435
|
});
|
|
1464
2436
|
item.resolve(error);
|
|
1465
2437
|
}
|
|
@@ -1485,26 +2457,71 @@ function renderToStream(code, options = {}) {
|
|
|
1485
2457
|
};
|
|
1486
2458
|
applyAssetTracking(context, tracking, manifest, noScripts);
|
|
1487
2459
|
context.failRender = failRender;
|
|
2460
|
+
context.errorPolicy = options.onError;
|
|
2461
|
+
context._errorScope = errorScope;
|
|
2462
|
+
context.flushed = () => firstFlushed;
|
|
2463
|
+
context.trace = requestEvent ? traceForEvent(requestEvent) : traceFor(context, undefined);
|
|
2464
|
+
render = timeDocument(context, context.trace, "stream", requestEvent);
|
|
1488
2465
|
registerEntryAssets(manifest);
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
2466
|
+
context.writer = createHydrationWriter(context, () => !completed);
|
|
2467
|
+
const signal = options.signal;
|
|
2468
|
+
let cancelled = false;
|
|
2469
|
+
const onAbort = signal ? () => {
|
|
2470
|
+
if (dead) return;
|
|
2471
|
+
cancelled = true;
|
|
2472
|
+
abandon("signal", !!(signal.reason && signal.reason.quiet === true));
|
|
2473
|
+
} : undefined;
|
|
2474
|
+
const endEdges = context.edges ? beginEdgesRender() : undefined;
|
|
2475
|
+
let html;
|
|
2476
|
+
try {
|
|
2477
|
+
html = createRoot(d => {
|
|
2478
|
+
dispose = () => {
|
|
2479
|
+
context.trace = undefined;
|
|
2480
|
+
if (onAbort) signal.removeEventListener("abort", onAbort);
|
|
2481
|
+
if (endEdges) endEdges();
|
|
2482
|
+
try {
|
|
2483
|
+
d();
|
|
2484
|
+
} catch (err) {
|
|
2485
|
+
reportFailure(err, "failed");
|
|
2486
|
+
}
|
|
2487
|
+
};
|
|
2488
|
+
rootOwner = claimRenderRoot(context);
|
|
2489
|
+
if (requestEvent) claimEventRender(requestEvent, context);
|
|
2490
|
+
let res;
|
|
2491
|
+
try {
|
|
2492
|
+
res = resolveSSRNode(escape(code()));
|
|
2493
|
+
} catch (err) {
|
|
2494
|
+
reportServerError(err, {
|
|
2495
|
+
kind: "render",
|
|
2496
|
+
handling: "failed"
|
|
2497
|
+
}, null, options.onError, errorScope);
|
|
2498
|
+
throw err;
|
|
2499
|
+
}
|
|
2500
|
+
if (!res.h.length) return res.t[0];
|
|
2501
|
+
rootHoles = [];
|
|
2502
|
+
let out = res.t[0];
|
|
2503
|
+
for (let i = 0; i < res.h.length; i++) {
|
|
2504
|
+
const id = nextHoleId++;
|
|
2505
|
+
rootHoles.push({
|
|
2506
|
+
id,
|
|
2507
|
+
fn: res.h[i]
|
|
2508
|
+
});
|
|
2509
|
+
out += `<!--rh${id}-->` + res.t[i + 1];
|
|
2510
|
+
}
|
|
2511
|
+
for (const p of res.p) blockingPromises.add(p);
|
|
2512
|
+
return out;
|
|
2513
|
+
}, {
|
|
2514
|
+
id: renderId
|
|
2515
|
+
});
|
|
2516
|
+
} catch (err) {
|
|
2517
|
+
if (endEdges) endEdges();
|
|
2518
|
+
throw err;
|
|
2519
|
+
}
|
|
2520
|
+
if (onAbort) {
|
|
2521
|
+
if (signal.aborted) onAbort();else signal.addEventListener("abort", onAbort, {
|
|
2522
|
+
once: true
|
|
2523
|
+
});
|
|
2524
|
+
}
|
|
1508
2525
|
function resolveRootHoles() {
|
|
1509
2526
|
if (!rootHoles) return true;
|
|
1510
2527
|
const pending = [];
|
|
@@ -1530,6 +2547,13 @@ function renderToStream(code, options = {}) {
|
|
|
1530
2547
|
for (const p of res.p) blockingPromises.add(p);
|
|
1531
2548
|
}
|
|
1532
2549
|
}
|
|
2550
|
+
if (parkedInlines) {
|
|
2551
|
+
for (const [key, value] of parkedInlines) {
|
|
2552
|
+
if (!html.includes(`<template id="pl-${key}">`)) continue;
|
|
2553
|
+
html = replacePlaceholder(html, key, value);
|
|
2554
|
+
parkedInlines.delete(key);
|
|
2555
|
+
}
|
|
2556
|
+
}
|
|
1533
2557
|
if (pending.length) {
|
|
1534
2558
|
rootHoles = pending;
|
|
1535
2559
|
return false;
|
|
@@ -1539,10 +2563,10 @@ function renderToStream(code, options = {}) {
|
|
|
1539
2563
|
}
|
|
1540
2564
|
function doShell() {
|
|
1541
2565
|
if (shellCompleted) return;
|
|
1542
|
-
|
|
1543
|
-
|
|
2566
|
+
sharedConfig.context = context;
|
|
2567
|
+
if (blockingPromises.size !== lastBlockingSize) return;
|
|
1544
2568
|
if (!resolveRootHoles()) return;
|
|
1545
|
-
if (blockingPromises.size !==
|
|
2569
|
+
if (blockingPromises.size !== lastBlockingSize) return;
|
|
1546
2570
|
if (!headShellReady(headRegistry, p => blockingPromises.add(p))) return;
|
|
1547
2571
|
headStyles = new Set();
|
|
1548
2572
|
for (const url of tracking.emittedAssets) {
|
|
@@ -1550,9 +2574,11 @@ function renderToStream(code, options = {}) {
|
|
|
1550
2574
|
}
|
|
1551
2575
|
serializeRootAssets();
|
|
1552
2576
|
flushStubBatch();
|
|
1553
|
-
const head = renderShellHead(headRegistry, nonce, k => registry.has(k), noScripts);
|
|
2577
|
+
const head = renderShellHead(headRegistry, nonce, k => registry.has(k), noScripts, traceMetaMarkup(context.trace));
|
|
2578
|
+
if (render) render.shell();
|
|
1554
2579
|
sink.shell(resolveSSRSelectValues(html), {
|
|
1555
2580
|
preloads: tracking.emittedAssets,
|
|
2581
|
+
preloadLinks: tracking.preloadLinks,
|
|
1556
2582
|
inlineStyles: tracking.inlineStyles,
|
|
1557
2583
|
tasks,
|
|
1558
2584
|
head
|
|
@@ -1569,21 +2595,30 @@ function renderToStream(code, options = {}) {
|
|
|
1569
2595
|
let lastBlockingSize = -1;
|
|
1570
2596
|
let lastRegistrySize = -1;
|
|
1571
2597
|
let drainTurn = 0;
|
|
1572
|
-
|
|
2598
|
+
let graced = false;
|
|
2599
|
+
const scheduleFlush = (fn, awaited) => {
|
|
1573
2600
|
const attempt = () => {
|
|
1574
|
-
flushStubBatch();
|
|
2601
|
+
if (!stableOrder) flushStubBatch();
|
|
1575
2602
|
if (registry.size !== lastRegistrySize || drainTurn++ < MIN_DRAIN_TURNS) {
|
|
1576
2603
|
if (registry.size !== lastRegistrySize) drainTurn = 0;
|
|
1577
2604
|
lastRegistrySize = registry.size;
|
|
1578
2605
|
queue(attempt);
|
|
1579
2606
|
return;
|
|
1580
2607
|
}
|
|
2608
|
+
if (!graced && registry.size) {
|
|
2609
|
+
graced = true;
|
|
2610
|
+
lastRegistrySize = -1;
|
|
2611
|
+
drainTurn = 0;
|
|
2612
|
+
deferFlush(attempt);
|
|
2613
|
+
return;
|
|
2614
|
+
}
|
|
1581
2615
|
fn();
|
|
1582
2616
|
};
|
|
1583
|
-
const progressed =
|
|
1584
|
-
lastBlockingSize =
|
|
2617
|
+
const progressed = awaited !== lastBlockingSize;
|
|
2618
|
+
lastBlockingSize = awaited;
|
|
1585
2619
|
lastRegistrySize = -1;
|
|
1586
2620
|
drainTurn = 0;
|
|
2621
|
+
graced = false;
|
|
1587
2622
|
progressed ? queue(attempt) : setTimeout(attempt);
|
|
1588
2623
|
};
|
|
1589
2624
|
let cachedReadable;
|
|
@@ -1597,28 +2632,42 @@ function renderToStream(code, options = {}) {
|
|
|
1597
2632
|
const pipeToImpl = w => {
|
|
1598
2633
|
let resolve;
|
|
1599
2634
|
const p = new Promise(r => resolve = r);
|
|
2635
|
+
let closeOnAbort = () => w.close().catch(() => {});
|
|
2636
|
+
onFailure((sink, gone) => {
|
|
2637
|
+
try {
|
|
2638
|
+
if (!gone) {
|
|
2639
|
+
if (sink) sink.end();else w.close().catch(() => {});
|
|
2640
|
+
} else if (gone === "signal") closeOnAbort();
|
|
2641
|
+
} catch (_) {}
|
|
2642
|
+
resolve();
|
|
2643
|
+
});
|
|
1600
2644
|
function flush() {
|
|
1601
|
-
allSettled(blockingPromises).then(
|
|
2645
|
+
allSettled(blockingPromises).then(awaited => {
|
|
1602
2646
|
scheduleFlush(() => {
|
|
1603
2647
|
if (dead) return resolve();
|
|
1604
2648
|
try {
|
|
1605
2649
|
doShell();
|
|
1606
2650
|
} catch (err) {
|
|
1607
|
-
|
|
1608
|
-
return
|
|
2651
|
+
failRootRender(err);
|
|
2652
|
+
return;
|
|
1609
2653
|
}
|
|
1610
2654
|
if (!shellCompleted) return flush();
|
|
2655
|
+
if (stranded) return abandon();
|
|
1611
2656
|
const encoder = new TextEncoder();
|
|
1612
2657
|
const writer = w.getWriter();
|
|
1613
2658
|
let pendingWrites = Promise.resolve();
|
|
1614
2659
|
let ended = false;
|
|
1615
2660
|
const failed = () => {
|
|
1616
2661
|
if (!ended) {
|
|
1617
|
-
abandon();
|
|
2662
|
+
abandon("consumer");
|
|
1618
2663
|
resolve();
|
|
1619
2664
|
}
|
|
1620
2665
|
};
|
|
1621
2666
|
writer.closed && writer.closed.catch(failed);
|
|
2667
|
+
closeOnAbort = () => {
|
|
2668
|
+
ended = true;
|
|
2669
|
+
pendingWrites.then(() => writer.close()).catch(() => {});
|
|
2670
|
+
};
|
|
1622
2671
|
buffer = writable = coalesceWrites(payload => {
|
|
1623
2672
|
pendingWrites = pendingWrites.then(() => writer.write(encoder.encode(payload))).catch(failed);
|
|
1624
2673
|
}, () => {
|
|
@@ -1636,7 +2685,7 @@ function renderToStream(code, options = {}) {
|
|
|
1636
2685
|
dispose();
|
|
1637
2686
|
writable.end();
|
|
1638
2687
|
} else flushEnd();
|
|
1639
|
-
});
|
|
2688
|
+
}, awaited);
|
|
1640
2689
|
});
|
|
1641
2690
|
}
|
|
1642
2691
|
flush();
|
|
@@ -1644,8 +2693,15 @@ function renderToStream(code, options = {}) {
|
|
|
1644
2693
|
};
|
|
1645
2694
|
return {
|
|
1646
2695
|
then(onFulfilled, onRejected) {
|
|
1647
|
-
|
|
2696
|
+
if (canBatchStubs) stableOrder = true;
|
|
2697
|
+
const freezeHead = () => {
|
|
2698
|
+
if (requestEvent && requestEvent.response) commitResponseStub(requestEvent.response, {
|
|
2699
|
+
event: requestEvent
|
|
2700
|
+
});
|
|
2701
|
+
};
|
|
2702
|
+
const p = new Promise((resolve, reject) => {
|
|
1648
2703
|
function complete() {
|
|
2704
|
+
freezeHead();
|
|
1649
2705
|
dispose();
|
|
1650
2706
|
resolve(tmp);
|
|
1651
2707
|
}
|
|
@@ -1656,18 +2712,20 @@ function renderToStream(code, options = {}) {
|
|
|
1656
2712
|
complete();
|
|
1657
2713
|
};
|
|
1658
2714
|
} else onCompleteAll = complete;
|
|
2715
|
+
onFailure(() => cancelled ? reject(signal.reason) : resolve(tmp));
|
|
1659
2716
|
function flush() {
|
|
1660
|
-
allSettled(blockingPromises).then(
|
|
2717
|
+
allSettled(blockingPromises).then(awaited => {
|
|
1661
2718
|
scheduleFlush(() => {
|
|
2719
|
+
if (dead) return;
|
|
2720
|
+
sharedConfig.context = context;
|
|
1662
2721
|
try {
|
|
1663
|
-
|
|
1664
|
-
if (!resolveRootHoles() || blockingPromises.size !== blockersBefore || !headShellReady(headRegistry, p => blockingPromises.add(p))) return flush();
|
|
2722
|
+
if (blockingPromises.size !== lastBlockingSize || !resolveRootHoles() || blockingPromises.size !== lastBlockingSize || !headShellReady(headRegistry, p => blockingPromises.add(p))) return flush();
|
|
1665
2723
|
} catch (err) {
|
|
1666
|
-
|
|
1667
|
-
return
|
|
2724
|
+
failRootRender(err);
|
|
2725
|
+
return;
|
|
1668
2726
|
}
|
|
1669
2727
|
queue(flushEnd);
|
|
1670
|
-
});
|
|
2728
|
+
}, awaited);
|
|
1671
2729
|
});
|
|
1672
2730
|
}
|
|
1673
2731
|
flush();
|
|
@@ -1676,20 +2734,25 @@ function renderToStream(code, options = {}) {
|
|
|
1676
2734
|
},
|
|
1677
2735
|
pipe(w) {
|
|
1678
2736
|
claimConsumer("pipe");
|
|
2737
|
+
const abandoned = w[SHELL_ABANDONED];
|
|
2738
|
+
onFailure((sink, gone) => {
|
|
2739
|
+
try {
|
|
2740
|
+
if (!gone) sink ? sink.end() : abandoned ? abandoned() : w.end();else if (!sink && abandoned) abandoned();else if (gone === "signal") w.end();
|
|
2741
|
+
} catch (_) {}
|
|
2742
|
+
});
|
|
2743
|
+
if (abandoned) w[ABANDON_RENDER] = abandon;
|
|
1679
2744
|
function flush() {
|
|
1680
|
-
allSettled(blockingPromises).then(
|
|
2745
|
+
allSettled(blockingPromises).then(awaited => {
|
|
1681
2746
|
scheduleFlush(() => {
|
|
1682
2747
|
if (dead) return;
|
|
1683
2748
|
try {
|
|
1684
2749
|
doShell();
|
|
1685
2750
|
} catch (err) {
|
|
1686
|
-
|
|
1687
|
-
try {
|
|
1688
|
-
w.end();
|
|
1689
|
-
} catch (_) {}
|
|
2751
|
+
failRootRender(err);
|
|
1690
2752
|
return;
|
|
1691
2753
|
}
|
|
1692
2754
|
if (!shellCompleted) return flush();
|
|
2755
|
+
if (stranded) return abandon();
|
|
1693
2756
|
const sink = guardSink(w);
|
|
1694
2757
|
buffer = writable = coalesceWrites(sink.write, sink.end);
|
|
1695
2758
|
buffer.write(tmp);
|
|
@@ -1699,7 +2762,7 @@ function renderToStream(code, options = {}) {
|
|
|
1699
2762
|
dispose();
|
|
1700
2763
|
writable.end();
|
|
1701
2764
|
} else flushEnd();
|
|
1702
|
-
});
|
|
2765
|
+
}, awaited);
|
|
1703
2766
|
});
|
|
1704
2767
|
}
|
|
1705
2768
|
flush();
|
|
@@ -1720,25 +2783,29 @@ function renderToStream(code, options = {}) {
|
|
|
1720
2783
|
};
|
|
1721
2784
|
}
|
|
1722
2785
|
function HydrationScript(props) {
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
2786
|
+
if (sharedConfig.context) sharedConfig.context.bootstrap = true;
|
|
2787
|
+
const {
|
|
2788
|
+
eventNames,
|
|
2789
|
+
nonce
|
|
2790
|
+
} = {
|
|
2791
|
+
nonce: sharedConfig.context && sharedConfig.context.nonce,
|
|
1726
2792
|
...props
|
|
1727
|
-
}
|
|
2793
|
+
};
|
|
2794
|
+
return ssr(hydrationBootstrap(eventNames, destinationNonce(nonce, "script"), true));
|
|
1728
2795
|
}
|
|
1729
2796
|
function ssrGroup(fn, n) {
|
|
1730
2797
|
fn.$g = n;
|
|
1731
2798
|
return fn;
|
|
1732
2799
|
}
|
|
1733
2800
|
function buildAsyncWrap(err, node) {
|
|
1734
|
-
const p =
|
|
2801
|
+
const p = ssrHandleError(err);
|
|
1735
2802
|
if (!p) return null;
|
|
1736
2803
|
if (node.$rw) return {
|
|
1737
2804
|
fn: node,
|
|
1738
2805
|
p
|
|
1739
2806
|
};
|
|
1740
|
-
const owner =
|
|
1741
|
-
const live =
|
|
2807
|
+
const owner = getOwner();
|
|
2808
|
+
const live = sharedConfig.context && sharedConfig.context.liveHoles;
|
|
1742
2809
|
const suppress = node.$lhSuppress || live && (live.suppressed || live.sweeping);
|
|
1743
2810
|
if (!owner) {
|
|
1744
2811
|
if (suppress) node.$lhSuppress = true;
|
|
@@ -1747,7 +2814,7 @@ function buildAsyncWrap(err, node) {
|
|
|
1747
2814
|
p
|
|
1748
2815
|
};
|
|
1749
2816
|
}
|
|
1750
|
-
const fn = () =>
|
|
2817
|
+
const fn = () => runWithOwner(owner, node);
|
|
1751
2818
|
fn.$rw = true;
|
|
1752
2819
|
if (suppress) fn.$lhSuppress = true;
|
|
1753
2820
|
if (node.$lhSkip) fn.$lhSkip = true;
|
|
@@ -1813,6 +2880,10 @@ function ssrGroupSlot(fn, idx) {
|
|
|
1813
2880
|
}
|
|
1814
2881
|
};
|
|
1815
2882
|
}
|
|
2883
|
+
function wireErrorMessage(err, scope) {
|
|
2884
|
+
const wire = ssrSanitizeError(err, null, undefined, undefined, scope);
|
|
2885
|
+
return String(wire && wire.message || wire);
|
|
2886
|
+
}
|
|
1816
2887
|
const holePositionCache = new WeakMap();
|
|
1817
2888
|
function holeContentPositions(t) {
|
|
1818
2889
|
let cached = holePositionCache.get(t);
|
|
@@ -1872,19 +2943,86 @@ function holeContentPositions(t) {
|
|
|
1872
2943
|
holePositionCache.set(t, cached);
|
|
1873
2944
|
return cached;
|
|
1874
2945
|
}
|
|
1875
|
-
function createLiveHoles(sink, scoped) {
|
|
2946
|
+
function createLiveHoles(sink, scoped, settled, errorScope) {
|
|
1876
2947
|
let nextId = 0;
|
|
1877
|
-
const stamp = typeof
|
|
1878
|
-
const inScope = scoped && typeof
|
|
1879
|
-
const stripMarkers = html => html.replace(/<!--lh:\/?\d
|
|
2948
|
+
const stamp = typeof creationStamp === "function" ? creationStamp : () => 0;
|
|
2949
|
+
const inScope = scoped && typeof inServerComponentScope === "function" ? inServerComponentScope : null;
|
|
2950
|
+
const stripMarkers = html => html.replace(/<!--lh:\/?\d+-->| data-lha="\d+"/g, "");
|
|
2951
|
+
const swept = (owner, ctx, fn) => {
|
|
2952
|
+
const prev = sharedConfig.context;
|
|
2953
|
+
sharedConfig.context = ctx;
|
|
2954
|
+
let dispose;
|
|
2955
|
+
let before;
|
|
2956
|
+
const run = () => createRoot(d => {
|
|
2957
|
+
dispose = d;
|
|
2958
|
+
before = stamp();
|
|
2959
|
+
return fn();
|
|
2960
|
+
}, {
|
|
2961
|
+
transparent: true
|
|
2962
|
+
});
|
|
2963
|
+
try {
|
|
2964
|
+
return owner ? runWithOwner(owner, run) : run();
|
|
2965
|
+
} finally {
|
|
2966
|
+
sharedConfig.context = prev;
|
|
2967
|
+
engine.sweptOwners = before !== undefined && stamp() !== before;
|
|
2968
|
+
if (dispose) dispose();
|
|
2969
|
+
}
|
|
2970
|
+
};
|
|
2971
|
+
const stripRow = html => html.replace(/<!--lh:\/?\d+-->| data-lha="\d+"|<!--lr-->/g, "");
|
|
2972
|
+
const rowsOf = v => Array.isArray(v) && v.$rows ? v : null;
|
|
2973
|
+
function holeValue(hole) {
|
|
2974
|
+
const b = hole.$lhBinding;
|
|
2975
|
+
if (b) {
|
|
2976
|
+
const v = hole();
|
|
2977
|
+
return b.fn && rowsOf(b.fn()) || v;
|
|
2978
|
+
}
|
|
2979
|
+
if (!hole.$fn) return hole();
|
|
2980
|
+
const v = hole.$fn();
|
|
2981
|
+
return rowsOf(v) || escape(v);
|
|
2982
|
+
}
|
|
2983
|
+
function resolveValue(value, res) {
|
|
2984
|
+
if (!Array.isArray(value) || !value.$rows) {
|
|
2985
|
+
resolveSSRNode(value, res);
|
|
2986
|
+
return null;
|
|
2987
|
+
}
|
|
2988
|
+
let rows = [];
|
|
2989
|
+
for (const row of value) {
|
|
2990
|
+
const r = resolveSSRNode(escape(row));
|
|
2991
|
+
res.t[res.t.length - 1] += "<!--lr-->" + r.t[0];
|
|
2992
|
+
if (r.h.length) {
|
|
2993
|
+
res.t.push(...r.t.slice(1));
|
|
2994
|
+
res.h.push(...r.h);
|
|
2995
|
+
res.p.push(...r.p);
|
|
2996
|
+
rows = null;
|
|
2997
|
+
} else if (rows) rows.push(engine.sweeping ? r.t[0] : stripRow(r.t[0]));
|
|
2998
|
+
}
|
|
2999
|
+
return rows;
|
|
3000
|
+
}
|
|
3001
|
+
function rowOps(last, rows) {
|
|
3002
|
+
const ops = [];
|
|
3003
|
+
const html = [];
|
|
3004
|
+
for (let i = 0; i < rows.length; i++) if (i >= last.length || rows[i] !== last[i]) {
|
|
3005
|
+
const patch = i < last.length ? rowPatch(last[i], rows[i]) : null;
|
|
3006
|
+
ops.push(patch ? [i, patch.p] : [i, rows[i]]);
|
|
3007
|
+
html.push(rows[i]);
|
|
3008
|
+
}
|
|
3009
|
+
if (ops.length >= rows.length) return null;
|
|
3010
|
+
return Object.defineProperty({
|
|
3011
|
+
n: rows.length,
|
|
3012
|
+
r: ops
|
|
3013
|
+
}, ROW_HTML, {
|
|
3014
|
+
value: html
|
|
3015
|
+
});
|
|
3016
|
+
}
|
|
1880
3017
|
function resolveHoleValue(hole) {
|
|
1881
3018
|
const result = {
|
|
1882
3019
|
t: [""],
|
|
1883
3020
|
h: [],
|
|
1884
|
-
p: []
|
|
3021
|
+
p: [],
|
|
3022
|
+
rows: null
|
|
1885
3023
|
};
|
|
1886
3024
|
try {
|
|
1887
|
-
|
|
3025
|
+
result.rows = resolveValue(holeValue(hole), result);
|
|
1888
3026
|
} catch (err) {
|
|
1889
3027
|
const wrap = buildAsyncWrap(err, hole);
|
|
1890
3028
|
if (!wrap) throw err;
|
|
@@ -1902,12 +3040,88 @@ function createLiveHoles(sink, scoped) {
|
|
|
1902
3040
|
}
|
|
1903
3041
|
b.children.length = 0;
|
|
1904
3042
|
}
|
|
3043
|
+
let tops = 0;
|
|
3044
|
+
const ids = new Map();
|
|
3045
|
+
const scopeFor = hole => {
|
|
3046
|
+
const p = engine.scope;
|
|
3047
|
+
return {
|
|
3048
|
+
id: undefined,
|
|
3049
|
+
p,
|
|
3050
|
+
i: p ? p.c++ : tops++,
|
|
3051
|
+
n: null,
|
|
3052
|
+
c: 0,
|
|
3053
|
+
h: hole
|
|
3054
|
+
};
|
|
3055
|
+
};
|
|
3056
|
+
const scopeId = s => s.id !== undefined ? s.id : s.id = s.p ? scopeId(s.p) + "." + s.i : String(s.i);
|
|
3057
|
+
const collect = (v, id, forget) => (v.occ || (v.occ = new Map())).set(id, forget);
|
|
3058
|
+
function rescope(b, hole, fn) {
|
|
3059
|
+
const prevScope = engine.scope;
|
|
3060
|
+
const prevVisit = engine.visit;
|
|
3061
|
+
engine.scope = {
|
|
3062
|
+
id: scopeId(b.scope),
|
|
3063
|
+
p: null,
|
|
3064
|
+
i: 0,
|
|
3065
|
+
n: null,
|
|
3066
|
+
c: 0,
|
|
3067
|
+
h: hole
|
|
3068
|
+
};
|
|
3069
|
+
const visit = engine.visit = {
|
|
3070
|
+
occ: null
|
|
3071
|
+
};
|
|
3072
|
+
try {
|
|
3073
|
+
return fn();
|
|
3074
|
+
} finally {
|
|
3075
|
+
engine.scope = prevScope;
|
|
3076
|
+
engine.visit = prevVisit;
|
|
3077
|
+
b.next = visit.occ;
|
|
3078
|
+
}
|
|
3079
|
+
}
|
|
3080
|
+
function settleOccurrences(b) {
|
|
3081
|
+
const occ = b.next;
|
|
3082
|
+
b.next = null;
|
|
3083
|
+
if (b.occ) for (const [id, forget] of b.occ) if (!occ || !occ.has(id)) forget();
|
|
3084
|
+
b.occ = occ;
|
|
3085
|
+
if (occ) for (let a = b.up; a; a = a.up) for (const [id, forget] of occ) collect(a, id, forget);
|
|
3086
|
+
}
|
|
3087
|
+
function leave(b, parent, scope, visit) {
|
|
3088
|
+
engine.parent = parent;
|
|
3089
|
+
engine.scope = scope;
|
|
3090
|
+
engine.visit = visit;
|
|
3091
|
+
if (visit && b.occ) for (const [id, forget] of b.occ) collect(visit, id, forget);
|
|
3092
|
+
}
|
|
1905
3093
|
const engine = {
|
|
1906
3094
|
suppressed: 0,
|
|
1907
3095
|
sweeping: false,
|
|
1908
3096
|
parent: null,
|
|
1909
|
-
recordStamp: 0,
|
|
1910
3097
|
gateHit: false,
|
|
3098
|
+
sweptOwners: false,
|
|
3099
|
+
scope: null,
|
|
3100
|
+
visit: null,
|
|
3101
|
+
dry: false,
|
|
3102
|
+
slotId(prop, given) {
|
|
3103
|
+
const s = engine.scope;
|
|
3104
|
+
if (!s) return given;
|
|
3105
|
+
const n = s.n || (s.n = Object.create(null));
|
|
3106
|
+
const i = n[prop] || 0;
|
|
3107
|
+
n[prop] = i + 1;
|
|
3108
|
+
const sid = scopeId(s);
|
|
3109
|
+
const at = sid + "." + i + "\0" + prop;
|
|
3110
|
+
if (given !== undefined) {
|
|
3111
|
+
ids.set(at, given);
|
|
3112
|
+
return given;
|
|
3113
|
+
}
|
|
3114
|
+
return ids.get(at) || `${prop}#~${sid}.${i}`;
|
|
3115
|
+
},
|
|
3116
|
+
seen(id, forget) {
|
|
3117
|
+
if (engine.visit) collect(engine.visit, id, forget);
|
|
3118
|
+
},
|
|
3119
|
+
nest(hole) {
|
|
3120
|
+
const s = engine.scope;
|
|
3121
|
+
if (!s || s.h === hole || hole.$lhSkip || inScope && !inScope()) return undefined;
|
|
3122
|
+
engine.scope = scopeFor(hole);
|
|
3123
|
+
return s;
|
|
3124
|
+
},
|
|
1911
3125
|
content(hole) {
|
|
1912
3126
|
if (hole.$lhSuppress) {
|
|
1913
3127
|
const r = {
|
|
@@ -1915,10 +3129,12 @@ function createLiveHoles(sink, scoped) {
|
|
|
1915
3129
|
h: [],
|
|
1916
3130
|
p: []
|
|
1917
3131
|
};
|
|
1918
|
-
|
|
1919
|
-
|
|
3132
|
+
let rows = null;
|
|
3133
|
+
const b = hole.$lhBinding;
|
|
3134
|
+
const run = () => {
|
|
3135
|
+
engine.suppressed++;
|
|
1920
3136
|
try {
|
|
1921
|
-
|
|
3137
|
+
rows = resolveValue(holeValue(hole), r);
|
|
1922
3138
|
} catch (err) {
|
|
1923
3139
|
const wrap = buildAsyncWrap(err, hole);
|
|
1924
3140
|
if (wrap) {
|
|
@@ -1926,45 +3142,53 @@ function createLiveHoles(sink, scoped) {
|
|
|
1926
3142
|
r.p.push(wrap.p);
|
|
1927
3143
|
r.t.push("");
|
|
1928
3144
|
}
|
|
3145
|
+
} finally {
|
|
3146
|
+
engine.suppressed--;
|
|
1929
3147
|
}
|
|
1930
|
-
}
|
|
1931
|
-
|
|
1932
|
-
}
|
|
1933
|
-
const b = hole.$lhBinding;
|
|
3148
|
+
};
|
|
3149
|
+
b && !engine.sweeping ? rescope(b, hole, run) : run();
|
|
1934
3150
|
if (b && !b.closed && !r.h.length && !engine.sweeping) {
|
|
1935
3151
|
b.last = stripMarkers(r.t[0]);
|
|
3152
|
+
b.rows = rows;
|
|
3153
|
+
settleOccurrences(b);
|
|
1936
3154
|
}
|
|
1937
3155
|
return r.h.length ? r : r.t[0];
|
|
1938
3156
|
}
|
|
1939
3157
|
if (engine.suppressed || engine.sweeping) return null;
|
|
1940
3158
|
if (hole.$lhSkip) return null;
|
|
1941
3159
|
if (inScope && !inScope()) return null;
|
|
1942
|
-
const recordsBefore = engine.recordStamp;
|
|
1943
3160
|
const ownersBefore = stamp();
|
|
1944
|
-
const owner =
|
|
3161
|
+
const owner = getOwner();
|
|
3162
|
+
const holeCtx = sharedConfig.context;
|
|
1945
3163
|
const b = {
|
|
1946
3164
|
key: null,
|
|
1947
3165
|
children: [],
|
|
1948
3166
|
last: null,
|
|
3167
|
+
rows: null,
|
|
3168
|
+
fn: hole.$fn,
|
|
1949
3169
|
closed: false,
|
|
3170
|
+
scope: undefined,
|
|
3171
|
+
occ: null,
|
|
3172
|
+
next: null,
|
|
3173
|
+
up: engine.parent,
|
|
1950
3174
|
sweep() {
|
|
1951
3175
|
if (b.closed) return;
|
|
1952
3176
|
const prevSweeping = engine.sweeping;
|
|
1953
3177
|
engine.sweeping = true;
|
|
1954
|
-
engine.
|
|
1955
|
-
const sweepOwnersBefore = stamp();
|
|
3178
|
+
engine.dry = b.last === null;
|
|
1956
3179
|
let res;
|
|
1957
3180
|
try {
|
|
1958
|
-
res =
|
|
3181
|
+
res = rescope(b, hole, () => swept(owner, holeCtx, () => resolveHoleValue(hole)));
|
|
1959
3182
|
} catch (err) {
|
|
1960
3183
|
b.closed = true;
|
|
1961
3184
|
sink.closeBinding(b.key);
|
|
1962
|
-
sink.error(b.key,
|
|
3185
|
+
sink.error(b.key, wireErrorMessage(err, errorScope));
|
|
1963
3186
|
return;
|
|
1964
3187
|
} finally {
|
|
1965
3188
|
engine.sweeping = prevSweeping;
|
|
3189
|
+
engine.dry = false;
|
|
1966
3190
|
}
|
|
1967
|
-
if (engine.
|
|
3191
|
+
if (engine.sweptOwners && res.h.length) {
|
|
1968
3192
|
b.closed = true;
|
|
1969
3193
|
sink.closeBinding(b.key);
|
|
1970
3194
|
return;
|
|
@@ -1972,29 +3196,38 @@ function createLiveHoles(sink, scoped) {
|
|
|
1972
3196
|
if (res.h.length) return;
|
|
1973
3197
|
const html = res.t[0];
|
|
1974
3198
|
if (b.last === null || html === b.last) return;
|
|
3199
|
+
const ops = b.rows && res.rows && rowOps(b.rows, res.rows);
|
|
1975
3200
|
b.last = html;
|
|
3201
|
+
if (ops && !ops.r.length && ops.n === b.rows.length) return;
|
|
3202
|
+
b.rows = res.rows;
|
|
1976
3203
|
closeChildren(b);
|
|
1977
|
-
|
|
3204
|
+
settleOccurrences(b);
|
|
3205
|
+
sink.hole(b.key, html, ops && !html.includes("<!--slot:") ? ops : null);
|
|
1978
3206
|
}
|
|
1979
3207
|
};
|
|
1980
3208
|
if (engine.parent) engine.parent.children.push(b);
|
|
1981
3209
|
const prevParent = engine.parent;
|
|
3210
|
+
const prevScope = engine.scope;
|
|
3211
|
+
const prevVisit = engine.visit;
|
|
3212
|
+
const scope = b.scope = scopeFor(hole);
|
|
1982
3213
|
engine.parent = b;
|
|
3214
|
+
engine.scope = scope;
|
|
3215
|
+
engine.visit = b;
|
|
1983
3216
|
let value;
|
|
1984
3217
|
let escalated = null;
|
|
1985
3218
|
try {
|
|
1986
|
-
value = hole
|
|
3219
|
+
value = holeValue(hole);
|
|
1987
3220
|
} catch (err) {
|
|
1988
3221
|
const wrap = buildAsyncWrap(err, hole);
|
|
1989
3222
|
if (!wrap) {
|
|
1990
|
-
|
|
3223
|
+
leave(b, prevParent, prevScope, prevVisit);
|
|
1991
3224
|
closeChildren(b);
|
|
1992
3225
|
return "";
|
|
1993
3226
|
}
|
|
1994
3227
|
escalated = wrap;
|
|
1995
3228
|
}
|
|
1996
3229
|
if (!escalated && (typeof value === "function" && value.$lhSkip || value !== null && typeof value === "object" && value.$slot)) {
|
|
1997
|
-
|
|
3230
|
+
leave(b, prevParent, prevScope, prevVisit);
|
|
1998
3231
|
const r = {
|
|
1999
3232
|
t: [""],
|
|
2000
3233
|
h: [],
|
|
@@ -2009,6 +3242,7 @@ function createLiveHoles(sink, scoped) {
|
|
|
2009
3242
|
return r.h.length ? r : r.t[0];
|
|
2010
3243
|
}
|
|
2011
3244
|
let res;
|
|
3245
|
+
let rows = null;
|
|
2012
3246
|
if (escalated) {
|
|
2013
3247
|
closeChildren(b);
|
|
2014
3248
|
escalated.fn.$lhSuppress = true;
|
|
@@ -2025,23 +3259,25 @@ function createLiveHoles(sink, scoped) {
|
|
|
2025
3259
|
p: []
|
|
2026
3260
|
};
|
|
2027
3261
|
try {
|
|
2028
|
-
|
|
3262
|
+
rows = resolveValue(value, res);
|
|
2029
3263
|
} catch (_) {
|
|
2030
|
-
|
|
3264
|
+
leave(b, prevParent, prevScope, prevVisit);
|
|
2031
3265
|
closeChildren(b);
|
|
2032
3266
|
return "";
|
|
2033
3267
|
}
|
|
2034
3268
|
}
|
|
2035
|
-
|
|
2036
|
-
if (
|
|
3269
|
+
leave(b, prevParent, prevScope, prevVisit);
|
|
3270
|
+
if (stamp() !== ownersBefore) {
|
|
2037
3271
|
return res.h.length ? res : res.t[0];
|
|
2038
3272
|
}
|
|
3273
|
+
if (!res.h.length && settled && settled()) return res.t[0];
|
|
2039
3274
|
const id = nextId++;
|
|
2040
3275
|
const key = b.key = "lh:" + id;
|
|
2041
3276
|
const open = `<!--lh:${id}-->`;
|
|
2042
3277
|
const close = `<!--lh:/${id}-->`;
|
|
2043
3278
|
if (!res.h.length) {
|
|
2044
3279
|
b.last = stripMarkers(res.t[0]);
|
|
3280
|
+
b.rows = rows;
|
|
2045
3281
|
sink.openBinding(key, b);
|
|
2046
3282
|
return open + res.t[0] + close;
|
|
2047
3283
|
}
|
|
@@ -2059,10 +3295,11 @@ function createLiveHoles(sink, scoped) {
|
|
|
2059
3295
|
return nextId++;
|
|
2060
3296
|
},
|
|
2061
3297
|
active() {
|
|
2062
|
-
return !inScope || inScope();
|
|
3298
|
+
return (!inScope || inScope()) && !(settled && settled());
|
|
2063
3299
|
},
|
|
2064
3300
|
attr(cap) {
|
|
2065
|
-
const owner =
|
|
3301
|
+
const owner = getOwner();
|
|
3302
|
+
const holeCtx = sharedConfig.context;
|
|
2066
3303
|
const b = {
|
|
2067
3304
|
key: "lha:" + cap.id,
|
|
2068
3305
|
children: [],
|
|
@@ -2071,9 +3308,10 @@ function createLiveHoles(sink, scoped) {
|
|
|
2071
3308
|
sweep() {
|
|
2072
3309
|
if (b.closed) return;
|
|
2073
3310
|
const prevSweeping = engine.sweeping;
|
|
3311
|
+
const prevScope = engine.scope;
|
|
2074
3312
|
engine.sweeping = true;
|
|
3313
|
+
engine.scope = null;
|
|
2075
3314
|
engine.gateHit = false;
|
|
2076
|
-
const sweepOwnersBefore = stamp();
|
|
2077
3315
|
let html = "";
|
|
2078
3316
|
try {
|
|
2079
3317
|
let group = null;
|
|
@@ -2098,17 +3336,23 @@ function createLiveHoles(sink, scoped) {
|
|
|
2098
3336
|
if (vt === "string" || vt === "number") html += v;
|
|
2099
3337
|
}
|
|
2100
3338
|
};
|
|
2101
|
-
|
|
3339
|
+
swept(owner, holeCtx, run);
|
|
2102
3340
|
} catch (err) {
|
|
2103
|
-
if (
|
|
3341
|
+
if (ssrHandleError(err, true)) {
|
|
3342
|
+
if (!engine.sweptOwners) return;
|
|
3343
|
+
b.closed = true;
|
|
3344
|
+
sink.closeBinding(b.key);
|
|
3345
|
+
return;
|
|
3346
|
+
}
|
|
2104
3347
|
b.closed = true;
|
|
2105
3348
|
sink.closeBinding(b.key);
|
|
2106
|
-
sink.error("lha:" + cap.id,
|
|
3349
|
+
sink.error("lha:" + cap.id, wireErrorMessage(err, errorScope));
|
|
2107
3350
|
return;
|
|
2108
3351
|
} finally {
|
|
2109
3352
|
engine.sweeping = prevSweeping;
|
|
3353
|
+
engine.scope = prevScope;
|
|
2110
3354
|
}
|
|
2111
|
-
if (engine.gateHit
|
|
3355
|
+
if (engine.gateHit) {
|
|
2112
3356
|
b.closed = true;
|
|
2113
3357
|
sink.closeBinding(b.key);
|
|
2114
3358
|
return;
|
|
@@ -2121,6 +3365,7 @@ function createLiveHoles(sink, scoped) {
|
|
|
2121
3365
|
sink.attr(String(cap.id), html, removed);
|
|
2122
3366
|
}
|
|
2123
3367
|
};
|
|
3368
|
+
if (sink.attrBaseline) sink.attrBaseline(b.key, cap.base);
|
|
2124
3369
|
sink.openBinding(b.key, b);
|
|
2125
3370
|
}
|
|
2126
3371
|
};
|
|
@@ -2133,6 +3378,71 @@ function attrNames(text) {
|
|
|
2133
3378
|
while (m = re.exec(text)) names.push(m[1]);
|
|
2134
3379
|
return names;
|
|
2135
3380
|
}
|
|
3381
|
+
const ROW_HTML = Symbol.for("solid.rowHtml");
|
|
3382
|
+
const ROW_TOKEN = /<(\/?)([a-zA-Z][^\s/>]*)((?:[^>"']|"[^"]*"|'[^']*')*)>|<!--([\s\S]*?)-->/g;
|
|
3383
|
+
const ROW_VOID = /^(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)$/i;
|
|
3384
|
+
const ROW_FOREIGN = /^(?:svg|math)$/i;
|
|
3385
|
+
const ROW_RAW = /^(?:script|style|textarea|title|template)$/i;
|
|
3386
|
+
const ROW_KEY = /\s_key(?:="[^"]*")?(?![^\s/])/;
|
|
3387
|
+
const rowKey = attrs => (ROW_KEY.exec(attrs) || [""])[0];
|
|
3388
|
+
const ROW_ENTITY = /&(?:amp|lt|gt|quot|#39);/g;
|
|
3389
|
+
const ROW_ENTITIES = {
|
|
3390
|
+
"&": "&",
|
|
3391
|
+
"<": "<",
|
|
3392
|
+
">": ">",
|
|
3393
|
+
""": '"',
|
|
3394
|
+
"'": "'"
|
|
3395
|
+
};
|
|
3396
|
+
function rowText(text) {
|
|
3397
|
+
if (!text.includes("&")) return text;
|
|
3398
|
+
if (text.replace(ROW_ENTITY, "").includes("&")) return null;
|
|
3399
|
+
return text.replace(ROW_ENTITY, e => ROW_ENTITIES[e]);
|
|
3400
|
+
}
|
|
3401
|
+
const ROW_HASH_SEED = 0x811c9dc5;
|
|
3402
|
+
function rowPatch(a, b) {
|
|
3403
|
+
const ra = new RegExp(ROW_TOKEN);
|
|
3404
|
+
const rb = new RegExp(ROW_TOKEN);
|
|
3405
|
+
const p = [];
|
|
3406
|
+
const stack = [[-1, 0, false]];
|
|
3407
|
+
let el = -1;
|
|
3408
|
+
let h = ROW_HASH_SEED;
|
|
3409
|
+
let ia = 0;
|
|
3410
|
+
let ib = 0;
|
|
3411
|
+
for (;;) {
|
|
3412
|
+
const ma = ra.exec(a);
|
|
3413
|
+
const mb = rb.exec(b);
|
|
3414
|
+
const ta = a.slice(ia, ma ? ma.index : a.length);
|
|
3415
|
+
const tb = b.slice(ib, mb ? mb.index : b.length);
|
|
3416
|
+
const top = stack[stack.length - 1];
|
|
3417
|
+
if (ta !== tb) {
|
|
3418
|
+
const text = rowText(tb);
|
|
3419
|
+
if (text === null) return null;
|
|
3420
|
+
p.push([top[0], top[1], text]);
|
|
3421
|
+
}
|
|
3422
|
+
if (!ma || !mb) return !ma && !mb ? {
|
|
3423
|
+
p,
|
|
3424
|
+
h: h >>> 0
|
|
3425
|
+
} : null;
|
|
3426
|
+
ia = ra.lastIndex;
|
|
3427
|
+
ib = rb.lastIndex;
|
|
3428
|
+
if (ma[4] !== undefined || mb[4] !== undefined) {
|
|
3429
|
+
if (ma[4] !== mb[4]) return null;
|
|
3430
|
+
top[1]++;
|
|
3431
|
+
} else if (ma[1] !== mb[1] || ma[2] !== mb[2]) return null;else if (ROW_RAW.test(ma[2])) return null;else if (ma[1]) {
|
|
3432
|
+
if (stack.length === 1) return null;
|
|
3433
|
+
stack.pop();
|
|
3434
|
+
} else {
|
|
3435
|
+
el++;
|
|
3436
|
+
top[1]++;
|
|
3437
|
+
const foreign = top[2] || ROW_FOREIGN.test(ma[2]);
|
|
3438
|
+
if (ma[3] !== mb[3]) {
|
|
3439
|
+
if (foreign || rowKey(ma[3]) !== rowKey(mb[3])) return null;
|
|
3440
|
+
p.push([el, mb[3].replace(/\/$/, "")]);
|
|
3441
|
+
}
|
|
3442
|
+
if (!ROW_VOID.test(ma[2]) && !ma[3].endsWith("/")) stack.push([el, 0, foreign]);
|
|
3443
|
+
}
|
|
3444
|
+
}
|
|
3445
|
+
}
|
|
2136
3446
|
function ssr(t) {
|
|
2137
3447
|
const len = arguments.length;
|
|
2138
3448
|
if (len === 1) return {
|
|
@@ -2143,7 +3453,7 @@ function ssr(t) {
|
|
|
2143
3453
|
let lastGroup = null;
|
|
2144
3454
|
let lastGroupVal = null;
|
|
2145
3455
|
let lastGroupIdx = 0;
|
|
2146
|
-
const live =
|
|
3456
|
+
const live = sharedConfig.context && sharedConfig.context.liveHoles;
|
|
2147
3457
|
const hp = live ? holeContentPositions(t) : null;
|
|
2148
3458
|
let lastOpen = null;
|
|
2149
3459
|
let cap = null;
|
|
@@ -2172,7 +3482,9 @@ function ssr(t) {
|
|
|
2172
3482
|
cap = {
|
|
2173
3483
|
id,
|
|
2174
3484
|
parts: [prefix],
|
|
2175
|
-
base: prefix
|
|
3485
|
+
base: prefix,
|
|
3486
|
+
at: lastOpen.seg,
|
|
3487
|
+
inject
|
|
2176
3488
|
};
|
|
2177
3489
|
return true;
|
|
2178
3490
|
};
|
|
@@ -2221,7 +3533,10 @@ function ssr(t) {
|
|
|
2221
3533
|
});
|
|
2222
3534
|
}
|
|
2223
3535
|
} else {
|
|
2224
|
-
cap
|
|
3536
|
+
if (cap) {
|
|
3537
|
+
result.t[cap.at] = result.t[cap.at].replace(cap.inject, "");
|
|
3538
|
+
cap = null;
|
|
3539
|
+
}
|
|
2225
3540
|
result.h.push(ssrGroupSlot(lastGroupVal.fn, lastGroupIdx++));
|
|
2226
3541
|
result.p.push(lastGroupVal.p);
|
|
2227
3542
|
result.t.push("");
|
|
@@ -2283,12 +3598,15 @@ function ssr(t) {
|
|
|
2283
3598
|
f: hole
|
|
2284
3599
|
});
|
|
2285
3600
|
} else {
|
|
3601
|
+
result.t[cap.at] = result.t[cap.at].replace(cap.inject, "");
|
|
2286
3602
|
cap = null;
|
|
2287
3603
|
}
|
|
2288
3604
|
}
|
|
2289
3605
|
} else {
|
|
2290
3606
|
const capturing = live && !hp.pos[i - 1] && captureStart();
|
|
3607
|
+
const scope = live && hp.pos[i - 1] && live.nest(hole);
|
|
2291
3608
|
const r = tryResolveFunctionHole(hole);
|
|
3609
|
+
if (scope) live.scope = scope;
|
|
2292
3610
|
if (typeof r === "string") {
|
|
2293
3611
|
s += r;
|
|
2294
3612
|
if (capturing) {
|
|
@@ -2298,7 +3616,10 @@ function ssr(t) {
|
|
|
2298
3616
|
});
|
|
2299
3617
|
}
|
|
2300
3618
|
} else {
|
|
2301
|
-
if (capturing)
|
|
3619
|
+
if (capturing) {
|
|
3620
|
+
s = s.replace(cap.inject, "");
|
|
3621
|
+
cap = null;
|
|
3622
|
+
}
|
|
2302
3623
|
result = {
|
|
2303
3624
|
t: [s],
|
|
2304
3625
|
h: [],
|
|
@@ -2359,16 +3680,17 @@ function ssr(t) {
|
|
|
2359
3680
|
return result;
|
|
2360
3681
|
}
|
|
2361
3682
|
function ssrClassName(value) {
|
|
3683
|
+
if (typeof value === "number") return "" + value;
|
|
2362
3684
|
if (!value) return "";
|
|
2363
3685
|
if (typeof value === "string") return escape(value, true);
|
|
2364
3686
|
value = classListToObject(value);
|
|
2365
3687
|
let classKeys = Object.keys(value),
|
|
2366
3688
|
result = "";
|
|
2367
3689
|
for (let i = 0, len = classKeys.length; i < len; i++) {
|
|
2368
|
-
const key = classKeys[i]
|
|
2369
|
-
|
|
3690
|
+
const key = classKeys[i];
|
|
3691
|
+
const classValue = value[key];
|
|
2370
3692
|
if (!key || key === "undefined" || !classValue) continue;
|
|
2371
|
-
|
|
3693
|
+
result && (result += " ");
|
|
2372
3694
|
result += escape(key, true);
|
|
2373
3695
|
}
|
|
2374
3696
|
return result;
|
|
@@ -2382,9 +3704,9 @@ function ssrStyle(value) {
|
|
|
2382
3704
|
const s = escape(k[i], true);
|
|
2383
3705
|
const v = value[k[i]];
|
|
2384
3706
|
if (v != undefined) {
|
|
2385
|
-
if (i) result += ";";
|
|
2386
3707
|
const r = escape(v, true);
|
|
2387
3708
|
if (r != undefined && r !== "undefined") {
|
|
3709
|
+
if (result) result += ";";
|
|
2388
3710
|
result += `${s}:${r}`;
|
|
2389
3711
|
}
|
|
2390
3712
|
}
|
|
@@ -2394,76 +3716,185 @@ function ssrStyle(value) {
|
|
|
2394
3716
|
function ssrStyleProperty(name, value) {
|
|
2395
3717
|
return value != null ? name + value : "";
|
|
2396
3718
|
}
|
|
2397
|
-
function
|
|
3719
|
+
function ssrStyleProperties(...entries) {
|
|
3720
|
+
let result = "";
|
|
3721
|
+
for (let i = 0; i < entries.length; i += 2) {
|
|
3722
|
+
const entry = ssrStyleProperty(entries[i], entries[i + 1]);
|
|
3723
|
+
if (entry) result = result ? result + ";" + entry : entry;
|
|
3724
|
+
}
|
|
3725
|
+
return result;
|
|
3726
|
+
}
|
|
3727
|
+
function ssrElement(tag, props, children, needsId, skip, attrs) {
|
|
2398
3728
|
const hk = needsId ? ssrHydrationKey() : "";
|
|
2399
|
-
if (
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
let
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
3729
|
+
if (typeof props === "function") props = props();
|
|
3730
|
+
let sources = null;
|
|
3731
|
+
let proxy = false;
|
|
3732
|
+
let viewKeys = null;
|
|
3733
|
+
let owners = null;
|
|
3734
|
+
const ctx = renderConfig.context;
|
|
3735
|
+
const link = tag === "a" && ctx !== undefined && ctx.linkClaim !== undefined ? {} : null;
|
|
3736
|
+
if (Array.isArray(props)) {
|
|
3737
|
+
let i = 0;
|
|
3738
|
+
for (; i < props.length; i++) {
|
|
3739
|
+
const s = props[i];
|
|
3740
|
+
if (s == null || typeof s === "function" || $PROXY in s) break;
|
|
2408
3741
|
}
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
result += `class="${ssrClassName(value)}"`;
|
|
2414
|
-
} else if (value == undefined || prop === "ref" || prop.slice(0, 2) === "on" || prop.slice(0, 5) === "prop:") {
|
|
2415
|
-
continue;
|
|
2416
|
-
} else if (typeof value === "boolean") {
|
|
2417
|
-
if (!value) continue;
|
|
2418
|
-
result += escape(prop);
|
|
2419
|
-
} else {
|
|
2420
|
-
result += value === "" ? escape(prop) : `${escape(prop)}="${escape(value, true)}"`;
|
|
3742
|
+
if (i === props.length) sources = props;else {
|
|
3743
|
+
viewKeys = [];
|
|
3744
|
+
owners = [];
|
|
3745
|
+
collectSpreadSources(props, viewKeys, owners);
|
|
2421
3746
|
}
|
|
2422
|
-
|
|
3747
|
+
} else if (props == null) {
|
|
3748
|
+
props = {};
|
|
3749
|
+
} else if ($PROXY in props) {
|
|
3750
|
+
if (viewOf(props) !== undefined) {
|
|
3751
|
+
viewKeys = [];
|
|
3752
|
+
owners = [];
|
|
3753
|
+
sourceOwners(props, viewKeys, owners);
|
|
3754
|
+
} else proxy = true;
|
|
3755
|
+
}
|
|
3756
|
+
const info = tagInfo(tag);
|
|
3757
|
+
const skipChildren = info.isVoid;
|
|
3758
|
+
let result = info.open + hk;
|
|
3759
|
+
let childOwner = null;
|
|
3760
|
+
const last = sources === null ? 0 : sources.length - 1;
|
|
3761
|
+
let keysOf = null;
|
|
3762
|
+
if (sources !== null) {
|
|
3763
|
+
keysOf = new Array(last + 1);
|
|
3764
|
+
for (let s = 0; s <= last; s++) keysOf[s] = Object.keys(sources[s]);
|
|
2423
3765
|
}
|
|
3766
|
+
for (let s = 0; s <= last; s++) {
|
|
3767
|
+
const keys = owners !== null ? viewKeys : keysOf !== null ? keysOf[s] : proxy ? Reflect.ownKeys(props) : Object.keys(props);
|
|
3768
|
+
if (sources !== null) props = sources[s];
|
|
3769
|
+
nextKey: for (let i = 0; i < keys.length; i++) {
|
|
3770
|
+
let prop = keys[i];
|
|
3771
|
+
if (typeof prop !== "string" || skip !== undefined && skip(prop)) continue;
|
|
3772
|
+
if (owners !== null) props = owners[i];
|
|
3773
|
+
for (let j = s + 1; j <= last; j++) {
|
|
3774
|
+
if (keysOf[j].includes(prop)) continue nextKey;
|
|
3775
|
+
}
|
|
3776
|
+
if (info.textarea && (prop === "value" || prop === "defaultValue")) {
|
|
3777
|
+
const value = props[prop];
|
|
3778
|
+
if (value !== null) children = escape(value);
|
|
3779
|
+
continue;
|
|
3780
|
+
}
|
|
3781
|
+
if (ChildProperties.has(prop)) {
|
|
3782
|
+
if (children === undefined && childOwner === null && !skipChildren) {
|
|
3783
|
+
if (prop === "children") childOwner = props;else children = info.raw || prop === "innerHTML" ? props[prop] : escape(props[prop]);
|
|
3784
|
+
}
|
|
3785
|
+
continue;
|
|
3786
|
+
}
|
|
3787
|
+
const key = prop;
|
|
3788
|
+
if (info.formAttributes !== undefined) {
|
|
3789
|
+
prop = spreadFormAttribute(prop, info, keys, keysOf, skip);
|
|
3790
|
+
if (prop === undefined) continue;
|
|
3791
|
+
}
|
|
3792
|
+
const value = props[key];
|
|
3793
|
+
if (value == undefined || prop.startsWith("prop:") || prop === "ref" || isEventName(prop)) continue;
|
|
3794
|
+
if (link !== null && LinkAttributes.has(prop)) link[prop] = value;
|
|
3795
|
+
if (prop === "style") {
|
|
3796
|
+
result += ` style="${ssrStyle(value)}"`;
|
|
3797
|
+
} else if (prop === "class") {
|
|
3798
|
+
result += ` class="${ssrClassName(value)}"`;
|
|
3799
|
+
} else if (typeof value === "boolean") {
|
|
3800
|
+
if (value && isAttrName(prop)) result += ` ${prop}`;
|
|
3801
|
+
} else if (isAttrName(prop)) {
|
|
3802
|
+
result += value === "" ? ` ${prop}` : ` ${prop}="${escape(value, true)}"`;
|
|
3803
|
+
}
|
|
3804
|
+
}
|
|
3805
|
+
}
|
|
3806
|
+
if (attrs !== undefined) result += typeof attrs === "function" ? attrs() : attrs;
|
|
3807
|
+
if (link !== null && link.href !== undefined) result += ssrLinkClaim(link);
|
|
2424
3808
|
if (skipChildren) return {
|
|
2425
|
-
t: result + "/>"
|
|
3809
|
+
t: result + " />"
|
|
2426
3810
|
};
|
|
3811
|
+
if (childOwner !== null) children = info.raw ? childOwner.children : escape(childOwner.children);
|
|
2427
3812
|
if (typeof children === "function") children = children();
|
|
2428
|
-
|
|
3813
|
+
let thunk = null;
|
|
3814
|
+
if (typeof children === "function" && (ctx === undefined || !ctx.liveHoles)) {
|
|
3815
|
+
thunk = children;
|
|
3816
|
+
ssrTextTail = false;
|
|
3817
|
+
try {
|
|
3818
|
+
children = thunk();
|
|
3819
|
+
} catch (err) {
|
|
3820
|
+
const res = {
|
|
3821
|
+
t: [""],
|
|
3822
|
+
h: [],
|
|
3823
|
+
p: []
|
|
3824
|
+
};
|
|
3825
|
+
pushSSRAsyncHole(res, err, thunk);
|
|
3826
|
+
return ssr([result + ">", info.close], res);
|
|
3827
|
+
}
|
|
3828
|
+
}
|
|
3829
|
+
const ct = typeof children;
|
|
3830
|
+
if (ct === "string" || ct === "number") return {
|
|
3831
|
+
t: result + ">" + children + info.close
|
|
3832
|
+
};
|
|
3833
|
+
if (children == null || ct === "boolean") return {
|
|
3834
|
+
t: result + ">" + info.close
|
|
3835
|
+
};
|
|
3836
|
+
if (ct === "object" && !children.h && typeof children.t === "string") return {
|
|
3837
|
+
t: result + ">" + children.t + info.close
|
|
3838
|
+
};
|
|
3839
|
+
if (thunk === null) return ssr([result + ">", info.close], resolveSSRNode(children, undefined, true));
|
|
3840
|
+
const res = {
|
|
3841
|
+
t: [""],
|
|
3842
|
+
h: [],
|
|
3843
|
+
p: []
|
|
3844
|
+
};
|
|
3845
|
+
try {
|
|
3846
|
+
resolveSSRNode(children, res, false, true);
|
|
3847
|
+
} catch (err) {
|
|
3848
|
+
pushSSRAsyncHole(res, err, thunk);
|
|
3849
|
+
}
|
|
3850
|
+
return ssr([result + ">", info.close], res);
|
|
3851
|
+
}
|
|
3852
|
+
function collectSpreadSources(props, viewKeys, owners) {
|
|
3853
|
+
for (let i = 0; i < props.length; i++) {
|
|
3854
|
+
let s = props[i];
|
|
3855
|
+
if (typeof s === "function") s = s();
|
|
3856
|
+
if (s != null) sourceOwners(s, viewKeys, owners);
|
|
3857
|
+
}
|
|
3858
|
+
}
|
|
3859
|
+
function spreadFormAttribute(prop, info, keys, keysOf, skip) {
|
|
3860
|
+
const defaultProp = info.formDefaults[prop];
|
|
3861
|
+
if (defaultProp !== undefined && (skip === undefined || !skip(defaultProp))) {
|
|
3862
|
+
if (keysOf !== null) {
|
|
3863
|
+
for (let j = 0; j < keysOf.length; j++) {
|
|
3864
|
+
if (keysOf[j].includes(defaultProp)) return;
|
|
3865
|
+
}
|
|
3866
|
+
} else if (keys.includes(defaultProp)) return;
|
|
3867
|
+
}
|
|
3868
|
+
const attr = info.formAttributes[prop];
|
|
3869
|
+
if (attr !== undefined && skip !== undefined && skip(attr)) return;
|
|
3870
|
+
return attr === undefined ? prop : attr;
|
|
3871
|
+
}
|
|
3872
|
+
function ssrElementAttribute(key, value) {
|
|
3873
|
+
if (value == undefined) return "";
|
|
3874
|
+
if (key === "style" || key === "class") return ` ${key}="${key === "class" ? ssrClassName(value) : ssrStyle(value)}"`;
|
|
3875
|
+
if (typeof value === "boolean") return value ? ` ${key}` : "";
|
|
3876
|
+
return value === "" ? ` ${key}` : ` ${key}="${escape(value, true)}"`;
|
|
2429
3877
|
}
|
|
2430
3878
|
function ssrAttribute(key, value) {
|
|
2431
|
-
|
|
3879
|
+
if (typeof value === "string") return ` ${key}="${value}"`;
|
|
3880
|
+
if (value == null || value === false) return "";
|
|
3881
|
+
if (typeof value === "object") return ` ${key}="${escape(String(value), true)}"`;
|
|
3882
|
+
if (typeof value === "function") return ` ${key}="${escape(String(value), true)}"`;
|
|
3883
|
+
return value === true ? ` ${key}` : ` ${key}="${value}"`;
|
|
2432
3884
|
}
|
|
2433
3885
|
function ssrHydrationKey() {
|
|
2434
3886
|
const hk = getHydrationKey();
|
|
2435
3887
|
return hk ? ` _hk=${hk}` : "";
|
|
2436
3888
|
}
|
|
2437
|
-
|
|
2438
|
-
const
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
function encodeClaimKey(key) {
|
|
2442
|
-
return String(key).replace(CLAIM_UNSAFE, c => encodeURIComponent(c));
|
|
2443
|
-
}
|
|
2444
|
-
function ssrClaim(map) {
|
|
2445
|
-
const mode = solidJs.sharedConfig.context && solidJs.sharedConfig.context.claims;
|
|
2446
|
-
if (!mode || mode === CLAIMS_DOCUMENT && !(typeof solidJs.inServerComponentScope === "function" && solidJs.inServerComponentScope())) {
|
|
2447
|
-
return "";
|
|
2448
|
-
}
|
|
2449
|
-
let out = "";
|
|
2450
|
-
for (const pos in map) {
|
|
2451
|
-
const value = map[pos];
|
|
2452
|
-
const list = Array.isArray(value) ? value : [value];
|
|
2453
|
-
for (const fn of list) {
|
|
2454
|
-
const prop = typeof fn === "function" && fn[CLAIM_PROP] || undefined;
|
|
2455
|
-
if (prop === undefined) {
|
|
2456
|
-
continue;
|
|
2457
|
-
}
|
|
2458
|
-
out += `${out ? "," : ""}${pos}=${encodeClaimKey(prop)}`;
|
|
2459
|
-
}
|
|
2460
|
-
}
|
|
2461
|
-
return out ? ` _bnd="${out}"` : "";
|
|
3889
|
+
function ssrLinkClaim(attrs) {
|
|
3890
|
+
const ctx = renderConfig.context;
|
|
3891
|
+
if (ctx === undefined || ctx.linkClaim === undefined || attrs["aria-current"] != null) return "";
|
|
3892
|
+
return ctx.linkClaim(attrs);
|
|
2462
3893
|
}
|
|
2463
3894
|
function decodeSSREntities(s) {
|
|
2464
3895
|
return s.indexOf("&") < 0 ? s : s.replace(/"/g, '"').replace(/</g, "<").replace(/&/g, "&");
|
|
2465
3896
|
}
|
|
2466
|
-
const SELECT_VALUE_ATTR = /\svalue
|
|
3897
|
+
const SELECT_VALUE_ATTR = /\svalue(?:="([^"]*)")?(?=[\s>]|$)/;
|
|
2467
3898
|
function tagEnd(html, i) {
|
|
2468
3899
|
for (let j = i + 1; j < html.length; j++) {
|
|
2469
3900
|
const c = html.charCodeAt(j);
|
|
@@ -2515,7 +3946,7 @@ function resolveSSRSelectValues(html) {
|
|
|
2515
3946
|
cand = html.indexOf("<select", e0 + 1);
|
|
2516
3947
|
continue;
|
|
2517
3948
|
}
|
|
2518
|
-
const bound = decodeSSREntities(m[1]);
|
|
3949
|
+
const bound = decodeSSREntities(m[1] ?? "");
|
|
2519
3950
|
const sel = {
|
|
2520
3951
|
values: /\smultiple(?=[\s>=])/.test(open) ? bound.split(",") : [bound],
|
|
2521
3952
|
strip: cand + m.index,
|
|
@@ -2552,7 +3983,7 @@ function resolveSSRSelectValues(html) {
|
|
|
2552
3983
|
const attrs = html.slice(i + 7, e);
|
|
2553
3984
|
if (/\sselected(?=[\s=]|$)/.test(attrs)) sel.defaulted = true;else {
|
|
2554
3985
|
const vm = SELECT_VALUE_ATTR.exec(attrs);
|
|
2555
|
-
const value = vm ? decodeSSREntities(vm[1]) : decodeSSREntities(optionText(html, e + 1)).replace(/\s+/g, " ").trim();
|
|
3986
|
+
const value = vm ? decodeSSREntities(vm[1] ?? "") : decodeSSREntities(optionText(html, e + 1)).replace(/\s+/g, " ").trim();
|
|
2556
3987
|
if (sel.values.includes(value)) sel.marks.push(e);
|
|
2557
3988
|
}
|
|
2558
3989
|
}
|
|
@@ -2571,10 +4002,13 @@ function escape(s, attr) {
|
|
|
2571
4002
|
if (!attr && Array.isArray(s)) {
|
|
2572
4003
|
const joined = tryJoinPlainSSRArray(s);
|
|
2573
4004
|
if (joined !== undefined) return joined;
|
|
4005
|
+
const src = s;
|
|
2574
4006
|
s = s.slice();
|
|
2575
4007
|
for (let i = 0; i < s.length; i++) s[i] = escape(s[i]);
|
|
4008
|
+
if (src.$slot) s.$slot = true;
|
|
2576
4009
|
return s;
|
|
2577
4010
|
}
|
|
4011
|
+
if (!attr && t === "function") return escapeLate(s);
|
|
2578
4012
|
if (attr) {
|
|
2579
4013
|
if (s == null || t === "boolean" || t === "number") return s;
|
|
2580
4014
|
return escape(String(s), attr);
|
|
@@ -2585,6 +4019,16 @@ function escape(s, attr) {
|
|
|
2585
4019
|
if (i < 0) return s;
|
|
2586
4020
|
return escapeSlow(s, attr, i);
|
|
2587
4021
|
}
|
|
4022
|
+
function escapeLate(fn) {
|
|
4023
|
+
if (fn.$esc) return fn;
|
|
4024
|
+
const w = () => escape(fn());
|
|
4025
|
+
w.$esc = true;
|
|
4026
|
+
w.$fn = fn;
|
|
4027
|
+
if (fn.$lhSkip) w.$lhSkip = true;
|
|
4028
|
+
if (fn.$lhSuppress) w.$lhSuppress = true;
|
|
4029
|
+
if (fn.$lhBinding) w.$lhBinding = fn.$lhBinding;
|
|
4030
|
+
return w;
|
|
4031
|
+
}
|
|
2588
4032
|
const ESCAPE_CONTENT = /[&<]/;
|
|
2589
4033
|
const ESCAPE_ATTR = /[&"<]/;
|
|
2590
4034
|
function escapeSlow(s, attr, start) {
|
|
@@ -2665,17 +4109,20 @@ function tryJoinPlainSSRArray(nodes) {
|
|
|
2665
4109
|
return out;
|
|
2666
4110
|
}
|
|
2667
4111
|
function getHydrationKey() {
|
|
2668
|
-
const hydrate =
|
|
2669
|
-
return hydrate &&
|
|
4112
|
+
const hydrate = sharedConfig.context;
|
|
4113
|
+
return hydrate && sharedConfig.getNextContextId();
|
|
2670
4114
|
}
|
|
2671
4115
|
function applyRef(r, element) {
|
|
2672
4116
|
Array.isArray(r) ? r.flat(Infinity).forEach(f => f && f(element)) : r(element);
|
|
2673
4117
|
}
|
|
2674
4118
|
function generateHydrationScript({
|
|
2675
|
-
eventNames
|
|
4119
|
+
eventNames,
|
|
2676
4120
|
nonce
|
|
2677
4121
|
} = {}) {
|
|
2678
|
-
return
|
|
4122
|
+
return hydrationBootstrap(eventNames, destinationNonce(nonce, "script"), false);
|
|
4123
|
+
}
|
|
4124
|
+
function hydrationBootstrap(eventNames = ["click", "input"], nonce, ledger) {
|
|
4125
|
+
return `<script${nonce ? ` nonce="${escape(String(nonce), true)}"` : ""}>window._$HY||(e=>{let t=e=>e&&e.hasAttribute&&(e.hasAttribute("_hk")?e:t(e.host&&e.host.nodeType?e.host:e.parentNode));["${eventNames.join('","')}"].forEach((o=>document.addEventListener(o,(o=>{if(!e.events)return;let s=t(o.composedPath&&o.composedPath()[0]||o.target);s&&!e.completed.has(s)&&e.events.push([s,o])}))))})(_$HY={events:[],completed:new WeakSet,r:new Proxy({},{set:(r,k,v)=>(v instanceof Promise&&v.catch(()=>{}),r[k]=v,!0)}),${ledger ? "s:{}," : ""}fe(){}});</script><!--xs-->`;
|
|
2679
4126
|
}
|
|
2680
4127
|
function queue(fn) {
|
|
2681
4128
|
return Promise.resolve().then(fn);
|
|
@@ -2685,15 +4132,22 @@ function allSettled(promises) {
|
|
|
2685
4132
|
let size = promises.size;
|
|
2686
4133
|
return Promise.allSettled(promises).then(() => {
|
|
2687
4134
|
if (promises.size !== size) return allSettled(promises);
|
|
2688
|
-
return;
|
|
4135
|
+
return size;
|
|
2689
4136
|
});
|
|
2690
4137
|
}
|
|
2691
|
-
function
|
|
4138
|
+
function withShellEnd(html, context, renderId, nonce, noScripts) {
|
|
4139
|
+
if (noScripts || !context || !context.bootstrap) return html;
|
|
4140
|
+
const id = JSON.stringify(renderId).replace(/</g, "\\u003C");
|
|
4141
|
+
const marker = `<script${nonceAttr(nonce, "script")}>_$HY.s[${id}]=1,_$HY.sw&&_$HY.sw(${id})</script>`;
|
|
4142
|
+
const at = html.indexOf("</body>", html.length - 512);
|
|
4143
|
+
return at < 0 ? html + marker : html.slice(0, at) + marker + html.slice(at);
|
|
4144
|
+
}
|
|
4145
|
+
function assembleDocument(html, emittedAssets, preloadLinks, inlineStyles, scripts, nonce, headTags, onHead, lowModules) {
|
|
2692
4146
|
const scriptTag = scripts ? `<script${nonceAttr(nonce, "script")}>${scripts}</script>` : "";
|
|
2693
4147
|
const title = headTags ? headTags.title : null;
|
|
2694
4148
|
let headTagsHtml = headTags ? headTags.html : "";
|
|
2695
4149
|
const headPrelude = headTags ? headTags.prelude : "";
|
|
2696
|
-
if (!onHead && title == null && !headTagsHtml && !headPrelude && !(emittedAssets && emittedAssets.size) && !(inlineStyles && inlineStyles.size)) {
|
|
4150
|
+
if (!onHead && title == null && !headTagsHtml && !headPrelude && !(emittedAssets && emittedAssets.size) && !preloadLinks && !(inlineStyles && inlineStyles.size)) {
|
|
2697
4151
|
if (!scriptTag) return html;
|
|
2698
4152
|
const xs = html.indexOf("<!--xs-->");
|
|
2699
4153
|
return xs === -1 ? html + scriptTag : html.slice(0, xs) + scriptTag + html.slice(xs);
|
|
@@ -2712,7 +4166,7 @@ function assembleDocument(html, emittedAssets, inlineStyles, scripts, nonce, hea
|
|
|
2712
4166
|
if (title != null) {
|
|
2713
4167
|
titleHtml = headTags.noScripts ? `<title data-dh="title">${escape(title)}</title>` : `<script${nonceAttr(nonce, "script")}>(function(x,t){(t=document.querySelector("title"))?(t.hasAttribute("data-dh")||t.setAttribute("data-dhf",t.textContent),t.textContent=x):(document.title=x,t=document.querySelector("title"));t&&t.setAttribute("data-dh","title")})(${JSON.stringify(title).replace(/</g, "\\u003C")})</script>`;
|
|
2714
4168
|
}
|
|
2715
|
-
onHead(headPrelude + headTagsHtml + titleHtml + renderHeadAssets(emittedAssets, inlineStyles, nonce));
|
|
4169
|
+
onHead(headPrelude + headTagsHtml + titleHtml + renderHeadAssets(emittedAssets, preloadLinks, inlineStyles, nonce, lowModules));
|
|
2716
4170
|
}
|
|
2717
4171
|
if (!scriptTag) return html;
|
|
2718
4172
|
const xs = html.indexOf("<!--xs-->");
|
|
@@ -2732,21 +4186,24 @@ function assembleDocument(html, emittedAssets, inlineStyles, scripts, nonce, hea
|
|
|
2732
4186
|
headTagsHtml = `<title data-dh="title">${winner}</title>` + headTagsHtml;
|
|
2733
4187
|
}
|
|
2734
4188
|
}
|
|
2735
|
-
const head = headTagsHtml + renderHeadAssets(emittedAssets, inlineStyles, nonce);
|
|
4189
|
+
const head = headTagsHtml + renderHeadAssets(emittedAssets, preloadLinks, inlineStyles, nonce, lowModules);
|
|
2736
4190
|
if (!scriptTag) return html.slice(0, headIdx) + head + html.slice(headIdx);
|
|
2737
4191
|
const xsIdx = html.indexOf("<!--xs-->");
|
|
2738
4192
|
if (xsIdx === -1) return html.slice(0, headIdx) + head + html.slice(headIdx) + scriptTag;
|
|
2739
4193
|
return xsIdx < headIdx ? html.slice(0, xsIdx) + scriptTag + html.slice(xsIdx, headIdx) + head + html.slice(headIdx) : html.slice(0, headIdx) + head + html.slice(headIdx, xsIdx) + scriptTag + html.slice(xsIdx);
|
|
2740
4194
|
}
|
|
2741
|
-
function renderHeadAssets(emittedAssets, inlineStyles, nonce) {
|
|
4195
|
+
function renderHeadAssets(emittedAssets, preloadLinks, inlineStyles, nonce, lowModules) {
|
|
2742
4196
|
let head = "";
|
|
2743
4197
|
const styleAttr = nonceAttr(nonce, "style");
|
|
2744
4198
|
const scriptAttr = nonceAttr(nonce, "script");
|
|
2745
4199
|
if (emittedAssets && emittedAssets.size) {
|
|
2746
4200
|
for (const url of emittedAssets) {
|
|
2747
|
-
head += isCssUrl(url) ? `<link rel="stylesheet" href="${url}"${styleAttr}>` :
|
|
4201
|
+
head += isCssUrl(url) ? `<link rel="stylesheet" href="${url}"${styleAttr}>` : modulePreloadLink(url, scriptAttr, lowModules);
|
|
2748
4202
|
}
|
|
2749
4203
|
}
|
|
4204
|
+
if (preloadLinks) {
|
|
4205
|
+
for (const entry of preloadLinks) head += `<link${entry.attrHtml}>`;
|
|
4206
|
+
}
|
|
2750
4207
|
if (inlineStyles && inlineStyles.size) {
|
|
2751
4208
|
for (const entry of inlineStyles.values()) {
|
|
2752
4209
|
if (entry.emitted) continue;
|
|
@@ -2841,26 +4298,30 @@ function classListToObject(classList) {
|
|
|
2841
4298
|
function flattenClassList(list, result) {
|
|
2842
4299
|
for (let i = 0, len = list.length; i < len; i++) {
|
|
2843
4300
|
const item = list[i];
|
|
2844
|
-
if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);
|
|
4301
|
+
if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);
|
|
4302
|
+
else if (typeof item !== "boolean" && (item || item === 0)) result[item] = true;
|
|
2845
4303
|
}
|
|
2846
4304
|
}
|
|
2847
|
-
|
|
4305
|
+
let ssrTextTail = false;
|
|
4306
|
+
function tryResolveString(node, nested) {
|
|
4307
|
+
if (!nested) ssrTextTail = false;
|
|
2848
4308
|
const t = typeof node;
|
|
2849
|
-
if (t === "string")
|
|
2850
|
-
|
|
4309
|
+
if (t === "string" || t === "number") {
|
|
4310
|
+
const s = ssrTextTail ? "<!--!$-->" + node : "" + node;
|
|
4311
|
+
ssrTextTail = true;
|
|
4312
|
+
return s;
|
|
4313
|
+
}
|
|
2851
4314
|
if (node == null || t === "boolean") return "";
|
|
2852
4315
|
if (t === "object") {
|
|
2853
4316
|
if (Array.isArray(node)) {
|
|
2854
4317
|
const joined = tryJoinPlainSSRArray(node);
|
|
2855
|
-
if (joined !== undefined)
|
|
4318
|
+
if (joined !== undefined) {
|
|
4319
|
+
ssrTextTail = false;
|
|
4320
|
+
return joined;
|
|
4321
|
+
}
|
|
2856
4322
|
let s = "";
|
|
2857
|
-
let prevNonObj = false;
|
|
2858
4323
|
for (let i = 0, len = node.length; i < len; i++) {
|
|
2859
|
-
const
|
|
2860
|
-
const itemNonObj = item !== null && typeof item !== "object";
|
|
2861
|
-
if (prevNonObj && itemNonObj) s += "<!--!$-->";
|
|
2862
|
-
prevNonObj = itemNonObj;
|
|
2863
|
-
const r = tryResolveString(item);
|
|
4324
|
+
const r = tryResolveString(node[i], true);
|
|
2864
4325
|
if (typeof r !== "string") return {
|
|
2865
4326
|
bail: node
|
|
2866
4327
|
};
|
|
@@ -2874,6 +4335,7 @@ function tryResolveString(node) {
|
|
|
2874
4335
|
if (node.t === undefined) {
|
|
2875
4336
|
return "";
|
|
2876
4337
|
}
|
|
4338
|
+
ssrTextTail = false;
|
|
2877
4339
|
return Array.isArray(node.t) ? node.t[0] : node.t;
|
|
2878
4340
|
}
|
|
2879
4341
|
if (t === "function") {
|
|
@@ -2881,9 +4343,11 @@ function tryResolveString(node) {
|
|
|
2881
4343
|
try {
|
|
2882
4344
|
v = node();
|
|
2883
4345
|
} catch (err) {
|
|
2884
|
-
|
|
4346
|
+
const wrap = buildAsyncWrap(err, node);
|
|
4347
|
+
if (wrap) ssrTextTail = true;
|
|
4348
|
+
return wrap || "";
|
|
2885
4349
|
}
|
|
2886
|
-
return tryResolveString(v);
|
|
4350
|
+
return tryResolveString(v, true);
|
|
2887
4351
|
}
|
|
2888
4352
|
return "";
|
|
2889
4353
|
}
|
|
@@ -2891,21 +4355,19 @@ function resolveSSRNode(node, result = {
|
|
|
2891
4355
|
t: [""],
|
|
2892
4356
|
h: [],
|
|
2893
4357
|
p: []
|
|
2894
|
-
}, top) {
|
|
4358
|
+
}, top, nested) {
|
|
4359
|
+
if (!nested) ssrTextTail = false;
|
|
2895
4360
|
const t = typeof node;
|
|
2896
4361
|
if (t === "string" || t === "number") {
|
|
2897
|
-
result.t[result.t.length - 1] += node;
|
|
4362
|
+
result.t[result.t.length - 1] += ssrTextTail ? "<!--!$-->" + node : node;
|
|
4363
|
+
ssrTextTail = true;
|
|
2898
4364
|
} else if (node == null || t === "boolean") ; else if (Array.isArray(node)) {
|
|
2899
|
-
const slotLive = node.$slot &&
|
|
4365
|
+
const slotLive = node.$slot && sharedConfig.context && sharedConfig.context.liveHoles;
|
|
2900
4366
|
if (slotLive) slotLive.suppressed++;
|
|
2901
4367
|
try {
|
|
2902
|
-
let prevNonObj = false;
|
|
2903
4368
|
for (let i = 0, len = node.length; i < len; i++) {
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
if (!top && prevNonObj && itemNonObj) result.t[result.t.length - 1] += `<!--!$-->`;
|
|
2907
|
-
prevNonObj = itemNonObj;
|
|
2908
|
-
resolveSSRNode(item, result);
|
|
4369
|
+
if (top) ssrTextTail = false;
|
|
4370
|
+
resolveSSRNode(node[i], result, false, true);
|
|
2909
4371
|
}
|
|
2910
4372
|
} finally {
|
|
2911
4373
|
if (slotLive) slotLive.suppressed--;
|
|
@@ -2918,37 +4380,186 @@ function resolveSSRNode(node, result = {
|
|
|
2918
4380
|
result.h.push(...node.h);
|
|
2919
4381
|
result.p.push(...node.p);
|
|
2920
4382
|
}
|
|
4383
|
+
ssrTextTail = false;
|
|
2921
4384
|
} else if (node.t !== undefined) {
|
|
2922
4385
|
result.t[result.t.length - 1] += node.t;
|
|
4386
|
+
ssrTextTail = false;
|
|
2923
4387
|
} else ;
|
|
2924
4388
|
} else if (t === "function") {
|
|
2925
|
-
const live =
|
|
4389
|
+
const live = sharedConfig.context && sharedConfig.context.liveHoles;
|
|
2926
4390
|
let liveNode = null;
|
|
2927
4391
|
if (live && (liveNode = live.content(node)) !== null) {
|
|
2928
|
-
if (typeof liveNode === "string")
|
|
4392
|
+
if (typeof liveNode === "string") {
|
|
4393
|
+
result.t[result.t.length - 1] += ssrTextTail ? "<!--!$-->" + liveNode : liveNode;
|
|
4394
|
+
ssrTextTail = true;
|
|
4395
|
+
} else resolveSSRNode(liveNode, result, false, true);
|
|
2929
4396
|
} else {
|
|
4397
|
+
const scope = live && live.nest(node);
|
|
2930
4398
|
try {
|
|
2931
|
-
resolveSSRNode(node(), result);
|
|
4399
|
+
resolveSSRNode(node(), result, false, true);
|
|
2932
4400
|
} catch (err) {
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
result.p.push(wrap.p);
|
|
2937
|
-
result.t.push("");
|
|
2938
|
-
}
|
|
4401
|
+
pushSSRAsyncHole(result, err, node);
|
|
4402
|
+
} finally {
|
|
4403
|
+
if (scope) live.scope = scope;
|
|
2939
4404
|
}
|
|
2940
4405
|
}
|
|
2941
4406
|
}
|
|
2942
4407
|
return result;
|
|
2943
4408
|
}
|
|
4409
|
+
function pushSSRAsyncHole(result, err, node) {
|
|
4410
|
+
const wrap = buildAsyncWrap(err, node);
|
|
4411
|
+
if (wrap) {
|
|
4412
|
+
if (ssrTextTail) result.t[result.t.length - 1] += "<!--!$-->";
|
|
4413
|
+
result.h.push(wrap.fn);
|
|
4414
|
+
result.p.push(wrap.p);
|
|
4415
|
+
result.t.push("");
|
|
4416
|
+
ssrTextTail = true;
|
|
4417
|
+
}
|
|
4418
|
+
}
|
|
2944
4419
|
function resolveSSRSync(node) {
|
|
2945
4420
|
const res = resolveSSRNode(node);
|
|
2946
4421
|
if (!res.h.length) return res.t[0];
|
|
2947
4422
|
throw new Error("This value cannot be rendered synchronously. Are you missing a boundary?");
|
|
2948
4423
|
}
|
|
2949
4424
|
const RequestContext = Symbol.for("solid.RequestContext");
|
|
4425
|
+
const ServerErrors = Symbol.for("solid-js/server/errors");
|
|
4426
|
+
function serializerErrorHook(hook) {
|
|
4427
|
+
return hook === undefined ? undefined : err => {
|
|
4428
|
+
reportServerError(err, {
|
|
4429
|
+
kind: "render",
|
|
4430
|
+
handling: "serialize"
|
|
4431
|
+
}, null, hook);
|
|
4432
|
+
};
|
|
4433
|
+
}
|
|
4434
|
+
function ambientServerErrorHook() {
|
|
4435
|
+
const slot = globalThis[ServerErrors];
|
|
4436
|
+
return slot === undefined ? undefined : slot.hook;
|
|
4437
|
+
}
|
|
4438
|
+
function configureServerErrors(config) {
|
|
4439
|
+
const g = globalThis;
|
|
4440
|
+
if (config && config.onError !== undefined && typeof config.onError !== "function") {
|
|
4441
|
+
throw new TypeError(`Invalid onError: expected a function, received ${typeof config.onError}.`);
|
|
4442
|
+
}
|
|
4443
|
+
(g[ServerErrors] ||= {}).hook = config ? config.onError : undefined;
|
|
4444
|
+
}
|
|
4445
|
+
function reportRequestFailure(error, event) {
|
|
4446
|
+
reportServerError(error, {
|
|
4447
|
+
kind: "request",
|
|
4448
|
+
handling: "failed",
|
|
4449
|
+
event
|
|
4450
|
+
}, null);
|
|
4451
|
+
if (ambientServerErrorHook() === undefined) console.error(error);
|
|
4452
|
+
}
|
|
2950
4453
|
function getRequestEvent() {
|
|
2951
|
-
|
|
4454
|
+
const store = globalThis[RequestContext];
|
|
4455
|
+
if (!store) return undefined;
|
|
4456
|
+
const event = store.getStore();
|
|
4457
|
+
if (event) return event;
|
|
4458
|
+
const ctx = renderContextOf(getOwner());
|
|
4459
|
+
return ctx && ctx.event || console.warn("RequestEvent is missing. This is most likely due to accessing `getRequestEvent` non-managed async scope in a partially polyfilled environment. Try moving it above all `await` calls.");
|
|
4460
|
+
}
|
|
4461
|
+
const RENDER_ROOTS = Symbol.for("@solidjs/web/render-roots");
|
|
4462
|
+
function renderRoots() {
|
|
4463
|
+
const g = globalThis;
|
|
4464
|
+
return g[RENDER_ROOTS] || (g[RENDER_ROOTS] = new WeakMap());
|
|
4465
|
+
}
|
|
4466
|
+
function claimRenderRoot(context) {
|
|
4467
|
+
const owner = getOwner();
|
|
4468
|
+
const roots = renderRoots();
|
|
4469
|
+
roots.set(owner, context);
|
|
4470
|
+
onCleanup(() => roots.delete(owner));
|
|
4471
|
+
return owner;
|
|
4472
|
+
}
|
|
4473
|
+
function settleRender(render, root, outcome) {
|
|
4474
|
+
runWithOwner(root || null, () => render.settle(outcome));
|
|
4475
|
+
}
|
|
4476
|
+
const eventRenders = new WeakMap();
|
|
4477
|
+
function claimEventRender(event, context) {
|
|
4478
|
+
let renders = eventRenders.get(event);
|
|
4479
|
+
if (!renders) eventRenders.set(event, renders = new Set());
|
|
4480
|
+
renders.add(context);
|
|
4481
|
+
onCleanup(() => renders.delete(context));
|
|
4482
|
+
}
|
|
4483
|
+
function createHydrationWriter(context, isOpen) {
|
|
4484
|
+
const keys = new Set();
|
|
4485
|
+
return {
|
|
4486
|
+
async: !!context.async,
|
|
4487
|
+
write(key, value, options) {
|
|
4488
|
+
if (!isOpen() || keys.has(key)) return false;
|
|
4489
|
+
context.serialize(key, value, options && options.deferStream);
|
|
4490
|
+
keys.add(key);
|
|
4491
|
+
return true;
|
|
4492
|
+
}
|
|
4493
|
+
};
|
|
4494
|
+
}
|
|
4495
|
+
function getHydrationWriter() {
|
|
4496
|
+
const ctx = currentRenderContext();
|
|
4497
|
+
return ctx && ctx.writer;
|
|
4498
|
+
}
|
|
4499
|
+
function currentRenderContext() {
|
|
4500
|
+
let ctx = renderContextOf(getOwner());
|
|
4501
|
+
if (!ctx) {
|
|
4502
|
+
const event = peekRequestEvent();
|
|
4503
|
+
const renders = event && eventRenders.get(event);
|
|
4504
|
+
if (renders && renders.size === 1) for (const c of renders) ctx = c;
|
|
4505
|
+
}
|
|
4506
|
+
return ctx;
|
|
4507
|
+
}
|
|
4508
|
+
const LINK_STATE_RECORD = "links";
|
|
4509
|
+
function setLinkClaim(handler) {
|
|
4510
|
+
const ctx = currentRenderContext();
|
|
4511
|
+
if (!ctx) {
|
|
4512
|
+
return false;
|
|
4513
|
+
}
|
|
4514
|
+
ctx.linkClaim = handler;
|
|
4515
|
+
if (handler !== undefined) ctx.writer.write(LINK_STATE_RECORD, 1);
|
|
4516
|
+
return true;
|
|
4517
|
+
}
|
|
4518
|
+
function hasServerLinkState() {
|
|
4519
|
+
return false;
|
|
4520
|
+
}
|
|
4521
|
+
function takeHydrationValue(_key) {
|
|
4522
|
+
return undefined;
|
|
4523
|
+
}
|
|
4524
|
+
function renderContextOf(owner) {
|
|
4525
|
+
const roots = globalThis[RENDER_ROOTS];
|
|
4526
|
+
if (!roots) return undefined;
|
|
4527
|
+
for (; owner; owner = owner._parent) {
|
|
4528
|
+
const context = roots.get(owner);
|
|
4529
|
+
if (context) return context;
|
|
4530
|
+
}
|
|
4531
|
+
}
|
|
4532
|
+
function peekRequestEvent() {
|
|
4533
|
+
const store = globalThis[RequestContext];
|
|
4534
|
+
return store ? store.getStore() : undefined;
|
|
4535
|
+
}
|
|
4536
|
+
function timeDocument(context, trace, mode, requestEvent) {
|
|
4537
|
+
if (records() === undefined) return undefined;
|
|
4538
|
+
const render = observeRender(trace, mode, requestEvent);
|
|
4539
|
+
if (render) context._declareRoute = ref => render.route(ref);
|
|
4540
|
+
if (timesServerWork("boundary")) {
|
|
4541
|
+
context._recordBoundary = event => {
|
|
4542
|
+
trace.timing.push({
|
|
4543
|
+
type: "boundary",
|
|
4544
|
+
event
|
|
4545
|
+
});
|
|
4546
|
+
if (render) render.boundary();
|
|
4547
|
+
};
|
|
4548
|
+
}
|
|
4549
|
+
return render;
|
|
4550
|
+
}
|
|
4551
|
+
function getTraceContext() {
|
|
4552
|
+
const event = peekRequestEvent();
|
|
4553
|
+
if (event) return traceForEvent(event).context;
|
|
4554
|
+
const ctx = renderContextOf(getOwner());
|
|
4555
|
+
return ctx && ctx.trace ? ctx.trace.context : undefined;
|
|
4556
|
+
}
|
|
4557
|
+
function traceForStub(stub, event) {
|
|
4558
|
+
if (!event) {
|
|
4559
|
+
event = peekRequestEvent();
|
|
4560
|
+
if (!event || event.response !== stub) return undefined;
|
|
4561
|
+
}
|
|
4562
|
+
return traceForEvent(event);
|
|
2952
4563
|
}
|
|
2953
4564
|
function createResponseStub() {
|
|
2954
4565
|
return {
|
|
@@ -2967,15 +4578,30 @@ function createRequestEvent(request, init) {
|
|
|
2967
4578
|
};
|
|
2968
4579
|
}
|
|
2969
4580
|
function reportLostHeaderWrite(method, name) {
|
|
2970
|
-
const message = `Response header write dropped: headers.${method}(${JSON.stringify(String(name))}) ` + "ran after the response head was sent. Write headers before the shell flushes " + "(or before the handler returns).";
|
|
4581
|
+
const message = `[LATE_HEADER_WRITE] Response header write dropped: headers.${method}(${JSON.stringify(String(name))}) ` + "ran after the response head was sent. Write headers before the shell flushes " + "(or before the handler returns).";
|
|
4582
|
+
recordFinding({
|
|
4583
|
+
code: "LATE_HEADER_WRITE",
|
|
4584
|
+
kind: "head",
|
|
4585
|
+
severity: "error",
|
|
4586
|
+
message,
|
|
4587
|
+
data: {
|
|
4588
|
+
method,
|
|
4589
|
+
name: String(name)
|
|
4590
|
+
}
|
|
4591
|
+
});
|
|
2971
4592
|
console.error(message);
|
|
2972
4593
|
}
|
|
2973
4594
|
function commitResponseStub(stub, {
|
|
2974
|
-
allowLateLocation = false
|
|
4595
|
+
allowLateLocation = false,
|
|
4596
|
+
event
|
|
2975
4597
|
} = {}) {
|
|
2976
4598
|
if (!stub || stub.committed) return stub;
|
|
2977
|
-
stub.committed = true;
|
|
2978
4599
|
const headers = stub.headers;
|
|
4600
|
+
if (headers && typeof headers.append === "function") {
|
|
4601
|
+
const trace = traceForStub(stub, event);
|
|
4602
|
+
if (trace) appendTraceServerTiming(headers, trace);
|
|
4603
|
+
}
|
|
4604
|
+
stub.committed = true;
|
|
2979
4605
|
if (!headers || typeof headers.set !== "function") return stub;
|
|
2980
4606
|
for (const method of ["set", "append", "delete"]) {
|
|
2981
4607
|
const original = headers[method].bind(headers);
|
|
@@ -2996,7 +4622,7 @@ function getExpectedRedirectStatus(response) {
|
|
|
2996
4622
|
function mergeStubHeaders(target, stub) {
|
|
2997
4623
|
if (!stub) return target;
|
|
2998
4624
|
stub.headers.forEach((value, key) => {
|
|
2999
|
-
if (key !== "set-cookie") target.set(key, value);
|
|
4625
|
+
if (key === "server-timing") mergeServerTiming(target, value);else if (key !== "set-cookie") target.set(key, value);
|
|
3000
4626
|
});
|
|
3001
4627
|
const setCookies = stub.headers.getSetCookie ? stub.headers.getSetCookie() : [];
|
|
3002
4628
|
for (const cookie of setCookies) target.append("set-cookie", cookie);
|
|
@@ -3011,43 +4637,56 @@ function copyInitHeaders(init) {
|
|
|
3011
4637
|
for (const cookie of init.getSetCookie()) headers.append("Set-Cookie", cookie);
|
|
3012
4638
|
return headers;
|
|
3013
4639
|
}
|
|
3014
|
-
|
|
4640
|
+
let stubGapFillExcluded;
|
|
4641
|
+
function isStubGapFillExcluded(key) {
|
|
4642
|
+
return (stubGapFillExcluded ||= new Set([ERROR_HEADER, BODY_FORMAT_HEADER, SINGLE_FLIGHT_HEADER, REVALIDATE_HEADER, REDIRECT_HEADER, "Location",
|
|
4643
|
+
...COMPOSED_BODY_FRAMING].map(header => header.toLowerCase()))).has(key);
|
|
4644
|
+
}
|
|
3015
4645
|
function fillsStubGap(key, headers, response) {
|
|
3016
|
-
if (key === "set-cookie" ||
|
|
4646
|
+
if (key === "set-cookie" || isStubGapFillExcluded(key)) return false;
|
|
3017
4647
|
if (response.body === null && (key === "content-type" || key === "content-length")) return false;
|
|
3018
4648
|
return !headers.has(key);
|
|
3019
4649
|
}
|
|
3020
4650
|
function commitEventResponse(response, event = getRequestEvent()) {
|
|
3021
4651
|
const stub = event && event.response;
|
|
3022
|
-
if (!stub || !stub.headers || stub.committed)
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
stub.headers.forEach((value, key) => {
|
|
3027
|
-
if (fillsStubGap(key, response.headers, response)) hasGaps = true;
|
|
3028
|
-
});
|
|
3029
|
-
if (!cookies.length && !hasGaps) return response;
|
|
3030
|
-
try {
|
|
3031
|
-
for (const cookie of cookies) response.headers.append("Set-Cookie", cookie);
|
|
3032
|
-
stub.headers.forEach((value, key) => {
|
|
3033
|
-
if (fillsStubGap(key, response.headers, response)) response.headers.set(key, value);
|
|
3034
|
-
});
|
|
3035
|
-
return response;
|
|
3036
|
-
} catch {
|
|
4652
|
+
if (!stub || !stub.headers || stub.committed) {
|
|
4653
|
+
if (!event || stub) return response;
|
|
4654
|
+
const trace = traceForEvent(event);
|
|
4655
|
+
if (!hasServerTiming(trace)) return response;
|
|
3037
4656
|
const headers = copyInitHeaders(response.headers);
|
|
3038
|
-
|
|
3039
|
-
stub.headers.forEach((value, key) => {
|
|
3040
|
-
if (fillsStubGap(key, headers, response)) headers.set(key, value);
|
|
3041
|
-
});
|
|
4657
|
+
appendTraceServerTiming(headers, trace);
|
|
3042
4658
|
return new Response(response.body, {
|
|
3043
4659
|
status: response.status,
|
|
3044
4660
|
statusText: response.statusText,
|
|
3045
4661
|
headers
|
|
3046
4662
|
});
|
|
3047
4663
|
}
|
|
4664
|
+
const cookies = stub.headers.getSetCookie ? stub.headers.getSetCookie() : [];
|
|
4665
|
+
commitResponseStub(stub, {
|
|
4666
|
+
event
|
|
4667
|
+
});
|
|
4668
|
+
let hasGaps = false;
|
|
4669
|
+
stub.headers.forEach((value, key) => {
|
|
4670
|
+
if (fillsStubGap(key, response.headers, response)) hasGaps = true;
|
|
4671
|
+
});
|
|
4672
|
+
const timing = stub.headers.get("server-timing");
|
|
4673
|
+
const mergesTiming = timing !== null && response.headers.has("server-timing");
|
|
4674
|
+
if (!cookies.length && !hasGaps && !mergesTiming) return response;
|
|
4675
|
+
const headers = copyInitHeaders(response.headers);
|
|
4676
|
+
for (const cookie of cookies) headers.append("Set-Cookie", cookie);
|
|
4677
|
+
stub.headers.forEach((value, key) => {
|
|
4678
|
+
if (fillsStubGap(key, headers, response)) headers.set(key, value);
|
|
4679
|
+
});
|
|
4680
|
+
if (mergesTiming) mergeServerTiming(headers, timing);
|
|
4681
|
+
return new Response(response.body, {
|
|
4682
|
+
status: response.status,
|
|
4683
|
+
statusText: response.statusText,
|
|
4684
|
+
headers
|
|
4685
|
+
});
|
|
3048
4686
|
}
|
|
3049
4687
|
function deriveHead(stub, responseInit = {}) {
|
|
3050
4688
|
const headers = mergeStubHeaders(copyInitHeaders(responseInit.headers), stub);
|
|
4689
|
+
for (const header of COMPOSED_BODY_FRAMING) headers.delete(header);
|
|
3051
4690
|
const status = stub && stub.status || responseInit.status || 200;
|
|
3052
4691
|
const statusText = stub && stub.statusText || responseInit.statusText || undefined;
|
|
3053
4692
|
return {
|
|
@@ -3064,7 +4703,9 @@ function createSSRResponse(result, event, options = {}) {
|
|
|
3064
4703
|
} = options;
|
|
3065
4704
|
const nonce = normalizeNonce(options.nonce);
|
|
3066
4705
|
if (typeof result === "string") {
|
|
3067
|
-
if (stub) commitResponseStub(stub
|
|
4706
|
+
if (stub) commitResponseStub(stub, {
|
|
4707
|
+
event
|
|
4708
|
+
});
|
|
3068
4709
|
const head = deriveHead(stub, responseInit);
|
|
3069
4710
|
if (stub && stub.headers.get("Location")) {
|
|
3070
4711
|
return new Response(null, {
|
|
@@ -3094,12 +4735,13 @@ function createSSRResponse(result, event, options = {}) {
|
|
|
3094
4735
|
closed = true;
|
|
3095
4736
|
}
|
|
3096
4737
|
};
|
|
3097
|
-
|
|
4738
|
+
const sink = {
|
|
3098
4739
|
write(chunk) {
|
|
3099
4740
|
if (!flushed) {
|
|
3100
4741
|
flushed = true;
|
|
3101
4742
|
if (stub) commitResponseStub(stub, {
|
|
3102
|
-
allowLateLocation: true
|
|
4743
|
+
allowLateLocation: true,
|
|
4744
|
+
event
|
|
3103
4745
|
});
|
|
3104
4746
|
const head = deriveHead(stub, responseInit);
|
|
3105
4747
|
if (stub && stub.headers.get("Location")) {
|
|
@@ -3108,6 +4750,7 @@ function createSSRResponse(result, event, options = {}) {
|
|
|
3108
4750
|
status: getExpectedRedirectStatus(stub),
|
|
3109
4751
|
headers: head.headers
|
|
3110
4752
|
}));
|
|
4753
|
+
sink[ABANDON_RENDER]("redirect", true);
|
|
3111
4754
|
return;
|
|
3112
4755
|
}
|
|
3113
4756
|
if (!head.headers.has("content-type")) {
|
|
@@ -3118,7 +4761,9 @@ function createSSRResponse(result, event, options = {}) {
|
|
|
3118
4761
|
controller = c;
|
|
3119
4762
|
},
|
|
3120
4763
|
cancel() {
|
|
4764
|
+
if (closed) return;
|
|
3121
4765
|
closed = true;
|
|
4766
|
+
sink[ABANDON_RENDER]("consumer");
|
|
3122
4767
|
}
|
|
3123
4768
|
}), {
|
|
3124
4769
|
status: head.status,
|
|
@@ -3129,9 +4774,10 @@ function createSSRResponse(result, event, options = {}) {
|
|
|
3129
4774
|
enqueue(transformChunk ? transformChunk(chunk) : chunk);
|
|
3130
4775
|
},
|
|
3131
4776
|
end() {
|
|
4777
|
+
if (!flushed) sink.write("");
|
|
3132
4778
|
if (closed || !controller) return;
|
|
3133
4779
|
const location = stub && stub.headers.get("Location");
|
|
3134
|
-
if (location) {
|
|
4780
|
+
if (location && isHttpNavigationTarget(location)) {
|
|
3135
4781
|
const attr = nonceAttr(nonce, "script");
|
|
3136
4782
|
enqueue(`<script${attr}>window.location=${JSON.stringify(location).replace(/</g, "\\u003c")}</script>`);
|
|
3137
4783
|
}
|
|
@@ -3139,8 +4785,23 @@ function createSSRResponse(result, event, options = {}) {
|
|
|
3139
4785
|
try {
|
|
3140
4786
|
controller.close();
|
|
3141
4787
|
} catch {}
|
|
3142
|
-
}
|
|
3143
|
-
|
|
4788
|
+
},
|
|
4789
|
+
[SHELL_ABANDONED]() {
|
|
4790
|
+
if (flushed) return;
|
|
4791
|
+
flushed = closed = true;
|
|
4792
|
+
if (stub) commitResponseStub(stub, {
|
|
4793
|
+
event
|
|
4794
|
+
});
|
|
4795
|
+
const head = deriveHead(stub, responseInit);
|
|
4796
|
+
const status = stub && stub.headers.get("Location") ? getExpectedRedirectStatus(stub) : 500;
|
|
4797
|
+
resolve(new Response(null, {
|
|
4798
|
+
status,
|
|
4799
|
+
headers: head.headers
|
|
4800
|
+
}));
|
|
4801
|
+
},
|
|
4802
|
+
[ABANDON_RENDER]() {}
|
|
4803
|
+
};
|
|
4804
|
+
result.pipe(sink);
|
|
3144
4805
|
});
|
|
3145
4806
|
}
|
|
3146
4807
|
function composeMiddleware(middlewares) {
|
|
@@ -3165,42 +4826,32 @@ function claimElement(node) {
|
|
|
3165
4826
|
function claimElementTree(root) {
|
|
3166
4827
|
return root;
|
|
3167
4828
|
}
|
|
4829
|
+
function dispatchAsInteraction(_e, fn) {
|
|
4830
|
+
return fn();
|
|
4831
|
+
}
|
|
3168
4832
|
function notSup() {
|
|
3169
|
-
throw new Error("Client-only API called on the server side. Run client-only code in
|
|
4833
|
+
throw new Error("Client-only API called on the server side. Run client-only code in onSettled, or conditionally run client-only component with <Show>.");
|
|
3170
4834
|
}
|
|
3171
4835
|
|
|
3172
|
-
setContainerTraceResolver(
|
|
4836
|
+
setContainerTraceResolver(getProjectionTrace);
|
|
4837
|
+
setAsyncIterableSharer(shareAsyncIterable);
|
|
3173
4838
|
const isServer = true;
|
|
3174
4839
|
const isDev = false;
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
});
|
|
3179
|
-
return props => {
|
|
3180
|
-
return solidJs.createMemo(() => {
|
|
3181
|
-
const c = cached();
|
|
3182
|
-
if (c) {
|
|
3183
|
-
if (typeof c === "function") return c(props);
|
|
3184
|
-
if (typeof c === "string") {
|
|
3185
|
-
return ssrElement(c, props, undefined, true);
|
|
3186
|
-
}
|
|
3187
|
-
}
|
|
3188
|
-
}, {
|
|
3189
|
-
sync: true
|
|
3190
|
-
});
|
|
3191
|
-
};
|
|
4840
|
+
const ssrTag = (tag, props) => ssrElement(tag, props, undefined, true);
|
|
4841
|
+
function dynamic(source, options) {
|
|
4842
|
+
return dynamicCore(source, options, ssrTag);
|
|
3192
4843
|
}
|
|
3193
4844
|
function Dynamic(props) {
|
|
3194
4845
|
const Comp = dynamic(() => props.component);
|
|
3195
|
-
return
|
|
4846
|
+
return createComponent(Comp, omit(props, "component"));
|
|
3196
4847
|
}
|
|
3197
4848
|
function Portal(props) {
|
|
3198
|
-
const o =
|
|
3199
|
-
if (o?.id != null)
|
|
4849
|
+
const o = getOwner();
|
|
4850
|
+
if (o?.id != null) getNextChildId(o);
|
|
3200
4851
|
return undefined;
|
|
3201
4852
|
}
|
|
3202
4853
|
function registerClientOnlyPreload(moduleUrl) {
|
|
3203
|
-
const ctx =
|
|
4854
|
+
const ctx = sharedConfig.context;
|
|
3204
4855
|
if (!ctx?.registerAsset || !ctx.resolveAssets) return;
|
|
3205
4856
|
const registerAsset = ctx.registerAsset;
|
|
3206
4857
|
const resolve = ctx.resolveAssets;
|
|
@@ -3210,6 +4861,11 @@ function registerClientOnlyPreload(moduleUrl) {
|
|
|
3210
4861
|
const css = assets.css[i];
|
|
3211
4862
|
if (typeof css === "string") registerAsset("style", css);else registerAsset("inline-style", css);
|
|
3212
4863
|
}
|
|
4864
|
+
if (assets.preloads) {
|
|
4865
|
+
for (let i = 0; i < assets.preloads.length; i++) {
|
|
4866
|
+
registerAsset("preload", assets.preloads[i]);
|
|
4867
|
+
}
|
|
4868
|
+
}
|
|
3213
4869
|
for (let i = 0; i < assets.js.length; i++) registerAsset("module", assets.js[i]);
|
|
3214
4870
|
};
|
|
3215
4871
|
const assets = resolve(moduleUrl);
|
|
@@ -3232,7 +4888,7 @@ function registerClientOnlyPreload(moduleUrl) {
|
|
|
3232
4888
|
function clientOnly(_fn, _options = {}, moduleUrl) {
|
|
3233
4889
|
return props => {
|
|
3234
4890
|
if (moduleUrl) registerClientOnlyPreload(moduleUrl);
|
|
3235
|
-
return
|
|
4891
|
+
return createMemo(() => props.fallback);
|
|
3236
4892
|
};
|
|
3237
4893
|
}
|
|
3238
4894
|
const statusLedgers = /* @__PURE__ */new WeakMap();
|
|
@@ -3259,7 +4915,7 @@ function httpStatus(code, text) {
|
|
|
3259
4915
|
ledger.live.push(declaration);
|
|
3260
4916
|
response.status = code;
|
|
3261
4917
|
response.statusText = text;
|
|
3262
|
-
|
|
4918
|
+
onCleanup(() => {
|
|
3263
4919
|
if (response.committed) return;
|
|
3264
4920
|
const index = ledger.live.indexOf(declaration);
|
|
3265
4921
|
if (index < 0) return;
|
|
@@ -3294,7 +4950,7 @@ function httpHeader(name, value, options) {
|
|
|
3294
4950
|
};
|
|
3295
4951
|
ledger.live.push(declaration);
|
|
3296
4952
|
if (declaration.append) headers.append(name, value);else headers.set(name, value);
|
|
3297
|
-
|
|
4953
|
+
onCleanup(() => {
|
|
3298
4954
|
if (response.committed) return;
|
|
3299
4955
|
const index = ledger.live.indexOf(declaration);
|
|
3300
4956
|
if (index < 0) return;
|
|
@@ -3313,167 +4969,4 @@ function httpHeader(name, value, options) {
|
|
|
3313
4969
|
}
|
|
3314
4970
|
}
|
|
3315
4971
|
|
|
3316
|
-
|
|
3317
|
-
enumerable: true,
|
|
3318
|
-
get: function () { return solidJs.Errored; }
|
|
3319
|
-
});
|
|
3320
|
-
Object.defineProperty(exports, "For", {
|
|
3321
|
-
enumerable: true,
|
|
3322
|
-
get: function () { return solidJs.For; }
|
|
3323
|
-
});
|
|
3324
|
-
Object.defineProperty(exports, "Hydration", {
|
|
3325
|
-
enumerable: true,
|
|
3326
|
-
get: function () { return solidJs.Hydration; }
|
|
3327
|
-
});
|
|
3328
|
-
Object.defineProperty(exports, "Loading", {
|
|
3329
|
-
enumerable: true,
|
|
3330
|
-
get: function () { return solidJs.Loading; }
|
|
3331
|
-
});
|
|
3332
|
-
Object.defineProperty(exports, "Match", {
|
|
3333
|
-
enumerable: true,
|
|
3334
|
-
get: function () { return solidJs.Match; }
|
|
3335
|
-
});
|
|
3336
|
-
Object.defineProperty(exports, "NoHydration", {
|
|
3337
|
-
enumerable: true,
|
|
3338
|
-
get: function () { return solidJs.NoHydration; }
|
|
3339
|
-
});
|
|
3340
|
-
Object.defineProperty(exports, "Repeat", {
|
|
3341
|
-
enumerable: true,
|
|
3342
|
-
get: function () { return solidJs.Repeat; }
|
|
3343
|
-
});
|
|
3344
|
-
Object.defineProperty(exports, "Reveal", {
|
|
3345
|
-
enumerable: true,
|
|
3346
|
-
get: function () { return solidJs.Reveal; }
|
|
3347
|
-
});
|
|
3348
|
-
Object.defineProperty(exports, "Show", {
|
|
3349
|
-
enumerable: true,
|
|
3350
|
-
get: function () { return solidJs.Show; }
|
|
3351
|
-
});
|
|
3352
|
-
Object.defineProperty(exports, "Switch", {
|
|
3353
|
-
enumerable: true,
|
|
3354
|
-
get: function () { return solidJs.Switch; }
|
|
3355
|
-
});
|
|
3356
|
-
Object.defineProperty(exports, "createComponent", {
|
|
3357
|
-
enumerable: true,
|
|
3358
|
-
get: function () { return solidJs.createComponent; }
|
|
3359
|
-
});
|
|
3360
|
-
Object.defineProperty(exports, "getOwner", {
|
|
3361
|
-
enumerable: true,
|
|
3362
|
-
get: function () { return solidJs.getOwner; }
|
|
3363
|
-
});
|
|
3364
|
-
Object.defineProperty(exports, "mergeProps", {
|
|
3365
|
-
enumerable: true,
|
|
3366
|
-
get: function () { return solidJs.merge; }
|
|
3367
|
-
});
|
|
3368
|
-
Object.defineProperty(exports, "scope", {
|
|
3369
|
-
enumerable: true,
|
|
3370
|
-
get: function () { return solidJs.ssrScope; }
|
|
3371
|
-
});
|
|
3372
|
-
Object.defineProperty(exports, "sharedConfig", {
|
|
3373
|
-
enumerable: true,
|
|
3374
|
-
get: function () { return solidJs.sharedConfig; }
|
|
3375
|
-
});
|
|
3376
|
-
Object.defineProperty(exports, "untrack", {
|
|
3377
|
-
enumerable: true,
|
|
3378
|
-
get: function () { return solidJs.untrack; }
|
|
3379
|
-
});
|
|
3380
|
-
exports.CLAIMS_DOCUMENT = CLAIMS_DOCUMENT;
|
|
3381
|
-
exports.CLAIMS_STREAM = CLAIMS_STREAM;
|
|
3382
|
-
exports.CLAIM_PROP = CLAIM_PROP;
|
|
3383
|
-
exports.ChildProperties = ChildProperties;
|
|
3384
|
-
exports.DOMElements = DOMElements;
|
|
3385
|
-
exports.DOMWithState = DOMWithState;
|
|
3386
|
-
exports.DelegatedEvents = DelegatedEvents;
|
|
3387
|
-
exports.Dynamic = Dynamic;
|
|
3388
|
-
exports.HREF = HREF;
|
|
3389
|
-
exports.HydrationScript = HydrationScript;
|
|
3390
|
-
exports.MathMLElements = MathMLElements;
|
|
3391
|
-
exports.Namespaces = Namespaces;
|
|
3392
|
-
exports.Portal = Portal;
|
|
3393
|
-
exports.REVALIDATE_HEADER = REVALIDATE_HEADER;
|
|
3394
|
-
exports.RawTextElements = RawTextElements;
|
|
3395
|
-
exports.RequestContext = RequestContext;
|
|
3396
|
-
exports.ResponseEnvelope = ResponseEnvelope;
|
|
3397
|
-
exports.SAFE_ERROR = SAFE_ERROR;
|
|
3398
|
-
exports.SVGElements = SVGElements;
|
|
3399
|
-
exports.VoidElements = VoidElements;
|
|
3400
|
-
exports.acquireAsset = notSup;
|
|
3401
|
-
exports.addEvent = notSup;
|
|
3402
|
-
exports.applyRef = applyRef;
|
|
3403
|
-
exports.assign = notSup;
|
|
3404
|
-
exports.claimElement = claimElement;
|
|
3405
|
-
exports.claimElementTree = claimElementTree;
|
|
3406
|
-
exports.className = notSup;
|
|
3407
|
-
exports.clearFlashCookie = clearFlashCookie;
|
|
3408
|
-
exports.clientOnly = clientOnly;
|
|
3409
|
-
exports.commitEventResponse = commitEventResponse;
|
|
3410
|
-
exports.commitResponseStub = commitResponseStub;
|
|
3411
|
-
exports.composeMiddleware = composeMiddleware;
|
|
3412
|
-
exports.createLiveHoles = createLiveHoles;
|
|
3413
|
-
exports.createRequestEvent = createRequestEvent;
|
|
3414
|
-
exports.createResponseStub = createResponseStub;
|
|
3415
|
-
exports.createSSRResponse = createSSRResponse;
|
|
3416
|
-
exports.delegateEvents = notSup;
|
|
3417
|
-
exports.dynamic = dynamic;
|
|
3418
|
-
exports.dynamicProperty = notSup;
|
|
3419
|
-
exports.effect = effect;
|
|
3420
|
-
exports.escape = escape;
|
|
3421
|
-
exports.generateHydrationScript = generateHydrationScript;
|
|
3422
|
-
exports.getDelegatedRoot = notSup;
|
|
3423
|
-
exports.getExpectedRedirectStatus = getExpectedRedirectStatus;
|
|
3424
|
-
exports.getHydrationKey = getHydrationKey;
|
|
3425
|
-
exports.getNextElement = notSup;
|
|
3426
|
-
exports.getNextMarker = notSup;
|
|
3427
|
-
exports.getNextMatch = notSup;
|
|
3428
|
-
exports.getRequestEvent = getRequestEvent;
|
|
3429
|
-
exports.getServerFunctionMetadata = getServerFunctionMetadata;
|
|
3430
|
-
exports.getServerFunctionRPC = getServerFunctionRPC;
|
|
3431
|
-
exports.hasFlashCookie = hasFlashCookie;
|
|
3432
|
-
exports.httpHeader = httpHeader;
|
|
3433
|
-
exports.httpStatus = httpStatus;
|
|
3434
|
-
exports.hydrate = notSup;
|
|
3435
|
-
exports.insert = notSup;
|
|
3436
|
-
exports.isDev = isDev;
|
|
3437
|
-
exports.isHref = isHref;
|
|
3438
|
-
exports.isResponseEnvelope = isResponseEnvelope;
|
|
3439
|
-
exports.isSafeError = isSafeError;
|
|
3440
|
-
exports.isServer = isServer;
|
|
3441
|
-
exports.isServerFunction = isServerFunction;
|
|
3442
|
-
exports.markSafeError = markSafeError;
|
|
3443
|
-
exports.memo = memo;
|
|
3444
|
-
exports.parseCookieHeader = parseCookieHeader;
|
|
3445
|
-
exports.redirect = redirect;
|
|
3446
|
-
exports.ref = notSup;
|
|
3447
|
-
exports.registerDelegatedContainer = notSup;
|
|
3448
|
-
exports.registerDelegatedRoot = notSup;
|
|
3449
|
-
exports.registerElementClaim = registerElementClaim;
|
|
3450
|
-
exports.reload = reload;
|
|
3451
|
-
exports.render = notSup;
|
|
3452
|
-
exports.renderToStream = renderToStream;
|
|
3453
|
-
exports.renderToString = renderToString;
|
|
3454
|
-
exports.resolveSSRSelectValues = resolveSSRSelectValues;
|
|
3455
|
-
exports.respond = respond;
|
|
3456
|
-
exports.runHydrationEvents = notSup;
|
|
3457
|
-
exports.scriptNonce = scriptNonce;
|
|
3458
|
-
exports.serializeCookie = serializeCookie;
|
|
3459
|
-
exports.setAttribute = notSup;
|
|
3460
|
-
exports.setAttributeNS = notSup;
|
|
3461
|
-
exports.setProperty = notSup;
|
|
3462
|
-
exports.setStyleProperty = notSup;
|
|
3463
|
-
exports.spread = notSup;
|
|
3464
|
-
exports.ssr = ssr;
|
|
3465
|
-
exports.ssrAttribute = ssrAttribute;
|
|
3466
|
-
exports.ssrClaim = ssrClaim;
|
|
3467
|
-
exports.ssrClassName = ssrClassName;
|
|
3468
|
-
exports.ssrElement = ssrElement;
|
|
3469
|
-
exports.ssrGroup = ssrGroup;
|
|
3470
|
-
exports.ssrHydrationKey = ssrHydrationKey;
|
|
3471
|
-
exports.ssrSelectValues = ssrSelectValues;
|
|
3472
|
-
exports.ssrStyle = ssrStyle;
|
|
3473
|
-
exports.ssrStyleProperty = ssrStyleProperty;
|
|
3474
|
-
exports.style = notSup;
|
|
3475
|
-
exports.styleNonce = styleNonce;
|
|
3476
|
-
exports.template = notSup;
|
|
3477
|
-
exports.unregisterDelegatedContainer = notSup;
|
|
3478
|
-
exports.unregisterDelegatedRoot = notSup;
|
|
3479
|
-
exports.useHead = useHead;
|
|
4972
|
+
export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, NULL_BODY_STATUSES, Namespaces, Portal, RESPONSE_HEADER_VALUE_LIMIT, REVALIDATE_ALL, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SAFE_ERROR, SVGElements, VoidElements, notSup as acquireAsset, notSup as addEvent, applyRef, notSup as assign, claimElement, claimElementTree, notSup as className, clearFlashCookie, clientOnly, commitEventResponse, commitResponseStub, composeMiddleware, configureServerErrors, createLiveHoles, createRequestEvent, createResponseStub, createSSRResponse, notSup as delegateEvents, dispatchAsInteraction, dynamic, notSup as dynamicProperty, effect, escape, generateHydrationScript, notSup as getDelegatedRoot, getExpectedRedirectStatus, getHydrationKey, getHydrationWriter, notSup as getNextElement, notSup as getNextMarker, notSup as getNextMatch, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, getTraceContext, hasFlashCookie, hasServerLinkState, httpHeader, httpStatus, notSup as hydrate, notSup as insert, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, parseCookieHeader, notSup as readShallow, redirect, notSup as ref, notSup as registerDelegatedContainer, notSup as registerDelegatedRoot, registerElementClaim, reload, notSup as render, renderToStream, renderToString, reportRequestFailure, resolveSSRNode, resolveSSRSelectValues, respond, notSup as runHydrationEvents, serializeCookie, notSup as setAttribute, notSup as setAttributeNS, setLinkClaim, notSup as setProperty, notSup as setStatefulProperty, notSup as setStyleProperty, notSup as spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrElementAttribute, ssrGroup, ssrHydrationKey, ssrLinkClaim, ssrSelectValues, ssrStyle, ssrStyleProperties, ssrStyleProperty, notSup as style, takeHydrationValue, notSup as template, notSup as unregisterDelegatedContainer, notSup as unregisterDelegatedRoot, useHead };
|