@solidjs/web 2.0.0-rc.7 → 2.0.0-rc.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server.dev.js +15 -2
- package/dist/server.js +15 -2
- package/dist/web.dev.js +41 -9
- package/dist/web.js +39 -8
- package/dist/{web.cjs → web.observe.js} +137 -239
- package/frames/dist/server.dev.js +19 -0
- package/frames/dist/server.js +19 -0
- package/frames/package.json +6 -24
- package/package.json +81 -314
- package/serialization/decode/package.json +3 -9
- package/serialization/package.json +3 -9
- package/serialization/types/serializer-decode.d.ts +49 -2
- package/server-functions/dist/server.dev.js +28 -10
- package/server-functions/dist/server.js +28 -10
- package/server-functions/package.json +6 -24
- package/server-functions/rich-args/package.json +3 -9
- package/storage/package.json +3 -9
- package/types/client.d.ts +17 -0
- package/types/frames/serializer-decode.d.ts +49 -2
- package/types/serializer-decode.d.ts +49 -2
- package/types/server-functions/server.d.ts +27 -4
- package/types/server.d.ts +1 -1
- package/dist/server.cjs +0 -3708
- package/dist/server.dev.cjs +0 -3794
- package/dist/web.dev.cjs +0 -2285
- package/frames/dist/client.cjs +0 -2043
- package/frames/dist/client.dev.cjs +0 -2063
- package/frames/dist/server.cjs +0 -4542
- package/frames/dist/server.dev.cjs +0 -4584
- package/serialization/dist/decode.cjs +0 -155
- package/serialization/dist/serialization.cjs +0 -275
- package/serialization/types-cjs/index.d.cts +0 -101
- package/serialization/types-cjs/package.json +0 -3
- package/serialization/types-cjs/serializer-decode.d.cts +0 -172
- package/serialization/types-cjs/serializer.d.cts +0 -101
- package/server-functions/dist/client.cjs +0 -1069
- package/server-functions/dist/rich-args.cjs +0 -11
- package/server-functions/dist/server.cjs +0 -2381
- package/server-functions/dist/server.dev.cjs +0 -2409
- 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-cjs/client.d.cts +0 -197
- package/types-cjs/constants.d.cts +0 -20
- package/types-cjs/cookies.d.cts +0 -41
- package/types-cjs/frames/client.d.cts +0 -36
- package/types-cjs/frames/frame-client.d.cts +0 -370
- package/types-cjs/frames/frame-container-plugin.d.cts +0 -71
- package/types-cjs/frames/frame-sink.d.cts +0 -92
- package/types-cjs/frames/frame-transport.d.cts +0 -189
- package/types-cjs/frames/serializer-decode.d.cts +0 -172
- package/types-cjs/frames/serializer.d.cts +0 -101
- package/types-cjs/frames/server.d.cts +0 -52
- package/types-cjs/head.d.cts +0 -19
- package/types-cjs/index.d.cts +0 -191
- package/types-cjs/index.server.d.cts +0 -147
- package/types-cjs/jsx-properties.d.cts +0 -93
- package/types-cjs/jsx.d.cts +0 -4146
- package/types-cjs/package.json +0 -3
- package/types-cjs/reconcile.d.cts +0 -1
- package/types-cjs/render.d.cts +0 -6
- package/types-cjs/response.d.cts +0 -81
- package/types-cjs/serializer-decode.d.cts +0 -172
- package/types-cjs/serializer.d.cts +0 -101
- package/types-cjs/server-functions/client.d.cts +0 -184
- package/types-cjs/server-functions/flash.d.cts +0 -36
- package/types-cjs/server-functions/registry.d.cts +0 -100
- package/types-cjs/server-functions/rich-args.d.cts +0 -1
- package/types-cjs/server-functions/server.d.cts +0 -546
- package/types-cjs/server-functions/shared.d.cts +0 -283
- package/types-cjs/server-mock.d.cts +0 -337
- package/types-cjs/server.d.cts +0 -408
package/dist/server.dev.cjs
DELETED
|
@@ -1,3794 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var solidJs = require('solid-js');
|
|
4
|
-
var seroval = require('seroval');
|
|
5
|
-
var web = require('seroval-plugins/web');
|
|
6
|
-
|
|
7
|
-
const DOMWithState = {
|
|
8
|
-
INPUT: {
|
|
9
|
-
value: 1,
|
|
10
|
-
defaultValue: 2,
|
|
11
|
-
checked: 1,
|
|
12
|
-
defaultChecked: 2
|
|
13
|
-
},
|
|
14
|
-
SELECT: {
|
|
15
|
-
value: 1
|
|
16
|
-
},
|
|
17
|
-
OPTION: {
|
|
18
|
-
value: 1,
|
|
19
|
-
selected: 1,
|
|
20
|
-
defaultSelected: 2
|
|
21
|
-
},
|
|
22
|
-
TEXTAREA: {
|
|
23
|
-
value: 1,
|
|
24
|
-
defaultValue: 2
|
|
25
|
-
},
|
|
26
|
-
VIDEO: {
|
|
27
|
-
muted: 1,
|
|
28
|
-
defaultMuted: 2
|
|
29
|
-
},
|
|
30
|
-
AUDIO: {
|
|
31
|
-
muted: 1,
|
|
32
|
-
defaultMuted: 2
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
36
|
-
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
|
-
const SVGElements = /*#__PURE__*/new Set([
|
|
38
|
-
"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",
|
|
39
|
-
"set", "stop",
|
|
40
|
-
"svg", "switch", "symbol", "text", "textPath",
|
|
41
|
-
"tref", "tspan", "use", "view", "vkern"]);
|
|
42
|
-
const MathMLElements = /*#__PURE__*/new Set(["annotation", "annotation-xml", "maction", "math", "menclose", "merror", "mfenced", "mfrac", "mi", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mprescripts", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msubsup", "msup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "semantics"]);
|
|
43
|
-
const Namespaces = {
|
|
44
|
-
svg: "http://www.w3.org/2000/svg",
|
|
45
|
-
mathml: "http://www.w3.org/1998/Math/MathML",
|
|
46
|
-
xlink: "http://www.w3.org/1999/xlink",
|
|
47
|
-
xml: "http://www.w3.org/XML/1998/namespace"
|
|
48
|
-
};
|
|
49
|
-
const VoidElements = /*#__PURE__*/new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]);
|
|
50
|
-
const RawTextElements = /*#__PURE__*/new Set(["style", "script", "noscript", "template", "textarea", "title"]);
|
|
51
|
-
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(","));
|
|
52
|
-
const COMPOSED_BODY_FRAMING = /*#__PURE__*/new Set(["content-length", "content-encoding", "transfer-encoding"]);
|
|
53
|
-
function isHttpNavigationTarget(target) {
|
|
54
|
-
try {
|
|
55
|
-
const protocol = new URL(target, "http://base.invalid").protocol;
|
|
56
|
-
return protocol === "http:" || protocol === "https:";
|
|
57
|
-
} catch {
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const transparentOptions = {
|
|
63
|
-
transparent: true,
|
|
64
|
-
sync: true
|
|
65
|
-
};
|
|
66
|
-
const syncOptions = {
|
|
67
|
-
sync: true
|
|
68
|
-
};
|
|
69
|
-
function effect(fn, effectFn, options) {
|
|
70
|
-
const nodeOptions = options ? {
|
|
71
|
-
sync: true,
|
|
72
|
-
...options,
|
|
73
|
-
transparent: !options.scope
|
|
74
|
-
} : transparentOptions;
|
|
75
|
-
{
|
|
76
|
-
solidJs.createRenderEffect(prev => {
|
|
77
|
-
solidJs.getOwner();
|
|
78
|
-
return fn(prev);
|
|
79
|
-
}, (value, prev) => {
|
|
80
|
-
try {
|
|
81
|
-
return effectFn(value, prev);
|
|
82
|
-
} finally {
|
|
83
|
-
}
|
|
84
|
-
}, nodeOptions);
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
function memo(fn) {
|
|
89
|
-
return solidJs.createMemo(() => fn(), syncOptions);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const STATE = Symbol.for("solid.container-trace-state");
|
|
93
|
-
const state = globalThis[STATE] || (globalThis[STATE] = {
|
|
94
|
-
materialized: new WeakMap(),
|
|
95
|
-
materializedValues: new WeakSet()
|
|
96
|
-
});
|
|
97
|
-
function setContainerTraceResolver(fn) {
|
|
98
|
-
state.resolveTrace = fn;
|
|
99
|
-
}
|
|
100
|
-
function setContainerTraceStreamMint(fn) {
|
|
101
|
-
state.streamOf = fn;
|
|
102
|
-
}
|
|
103
|
-
const TRACE = Symbol.for("solid.container-trace");
|
|
104
|
-
function materialize(marker) {
|
|
105
|
-
let value = state.materialized.get(marker.$tr);
|
|
106
|
-
if (value === undefined) {
|
|
107
|
-
value = state.materializeTrace(marker);
|
|
108
|
-
state.materialized.set(marker.$tr, value);
|
|
109
|
-
if (value !== null && typeof value === "object") state.materializedValues.add(value);
|
|
110
|
-
}
|
|
111
|
-
return value;
|
|
112
|
-
}
|
|
113
|
-
function parseTrace(value, ctx) {
|
|
114
|
-
const trace = value[TRACE];
|
|
115
|
-
const sub = trace.subscribe();
|
|
116
|
-
return {
|
|
117
|
-
a: trace.array ? 1 : 0,
|
|
118
|
-
i: ctx.parse(state.streamOf ? state.streamOf(sub) : sub)
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
const ContainerTracePlugin = {
|
|
122
|
-
tag: "solid/container-trace",
|
|
123
|
-
test(value) {
|
|
124
|
-
return value != null && typeof value === "object" && TRACE in value;
|
|
125
|
-
},
|
|
126
|
-
parse: {
|
|
127
|
-
sync() {
|
|
128
|
-
throw new Error("A reactive container can only be serialized by a streaming serializer.");
|
|
129
|
-
},
|
|
130
|
-
async async(value, ctx) {
|
|
131
|
-
const trace = value[TRACE];
|
|
132
|
-
const sub = trace.subscribe();
|
|
133
|
-
return {
|
|
134
|
-
a: trace.array ? 1 : 0,
|
|
135
|
-
i: await ctx.parse(state.streamOf ? state.streamOf(sub) : sub)
|
|
136
|
-
};
|
|
137
|
-
},
|
|
138
|
-
stream: parseTrace
|
|
139
|
-
},
|
|
140
|
-
serialize(node, ctx) {
|
|
141
|
-
return "{$tr:" + ctx.serialize(node.i) + ",$ta:" + node.a + "}";
|
|
142
|
-
},
|
|
143
|
-
deserialize(node, ctx) {
|
|
144
|
-
const iterable = ctx.deserialize(node.i);
|
|
145
|
-
const marker = {
|
|
146
|
-
$tr: iterable,
|
|
147
|
-
$ta: node.a
|
|
148
|
-
};
|
|
149
|
-
return state.materializeTrace ? materialize(marker) : marker;
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
setContainerTraceStreamMint(iterable => {
|
|
154
|
-
const stream = seroval.createStream();
|
|
155
|
-
(async () => {
|
|
156
|
-
try {
|
|
157
|
-
for await (const value of iterable) stream.next(value);
|
|
158
|
-
stream.return(undefined);
|
|
159
|
-
} catch (error) {
|
|
160
|
-
stream.throw(error);
|
|
161
|
-
}
|
|
162
|
-
})();
|
|
163
|
-
return stream;
|
|
164
|
-
});
|
|
165
|
-
const DEFAULT_WEB_PLUGINS = Object.freeze([web.AbortSignalPlugin,
|
|
166
|
-
web.CustomEventPlugin, web.DOMExceptionPlugin, web.EventPlugin,
|
|
167
|
-
web.FormDataPlugin, web.HeadersPlugin, web.ReadableStreamPlugin, web.RequestPlugin, web.ResponsePlugin, web.URLSearchParamsPlugin, web.URLPlugin,
|
|
168
|
-
ContainerTracePlugin]);
|
|
169
|
-
function resolveSerializerPlugins(customPlugins) {
|
|
170
|
-
return customPlugins ? [...customPlugins, ...DEFAULT_WEB_PLUGINS] : [...DEFAULT_WEB_PLUGINS];
|
|
171
|
-
}
|
|
172
|
-
seroval.Feature.RegExp;
|
|
173
|
-
|
|
174
|
-
const DEFAULT_DISABLED_FEATURES = seroval.Feature.AggregateError | seroval.Feature.BigIntTypedArray;
|
|
175
|
-
const serializeOnlyDisabledFeatures = serializeErrorStacks => (serializeErrorStacks === undefined ? process.env.NODE_ENV === "development" : serializeErrorStacks) ? 0 : seroval.Feature.ErrorPrototypeStack;
|
|
176
|
-
const HYDRATION_GLOBAL = "_$HY.r";
|
|
177
|
-
function createSerializer(options) {
|
|
178
|
-
return new seroval.Serializer({
|
|
179
|
-
...options,
|
|
180
|
-
plugins: resolveSerializerPlugins(options.plugins),
|
|
181
|
-
disabledFeatures: (options.disabledFeatures === undefined ? DEFAULT_DISABLED_FEATURES : options.disabledFeatures) | serializeOnlyDisabledFeatures(options.serializeErrorStacks)
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
function createHydrationSerializer({
|
|
185
|
-
onData,
|
|
186
|
-
onDone,
|
|
187
|
-
scopeId,
|
|
188
|
-
onError,
|
|
189
|
-
plugins
|
|
190
|
-
}) {
|
|
191
|
-
return createSerializer({
|
|
192
|
-
scopeId,
|
|
193
|
-
plugins,
|
|
194
|
-
globalIdentifier: HYDRATION_GLOBAL,
|
|
195
|
-
onData,
|
|
196
|
-
onDone,
|
|
197
|
-
onError
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
function getLocalHeaderScript(id) {
|
|
201
|
-
return seroval.getCrossReferenceHeader(id) + ";";
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
|
|
205
|
-
// PURE-annotated factory (same convention as solid's MockPromise): the brand
|
|
206
|
-
const ResponseEnvelope = /* @__PURE__ */(() => {
|
|
207
|
-
class ResponseEnvelope {
|
|
208
|
-
constructor(response, value) {
|
|
209
|
-
this.response = response;
|
|
210
|
-
this.value = value;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
ResponseEnvelope.prototype[ENVELOPE] = true;
|
|
214
|
-
return ResponseEnvelope;
|
|
215
|
-
})();
|
|
216
|
-
function isResponseEnvelope(value) {
|
|
217
|
-
return !!(value && typeof value === "object" && value[ENVELOPE]);
|
|
218
|
-
}
|
|
219
|
-
const HREF = Symbol.for("solid.Href");
|
|
220
|
-
function isHref(value) {
|
|
221
|
-
return !!(value && (typeof value === "object" || typeof value === "function") && value[HREF]);
|
|
222
|
-
}
|
|
223
|
-
const SAFE_ERROR = Symbol.for("solid.SafeError");
|
|
224
|
-
function markSafeError(error) {
|
|
225
|
-
if (error && (typeof error === "object" || typeof error === "function")) {
|
|
226
|
-
Object.defineProperty(error, SAFE_ERROR, {
|
|
227
|
-
value: true,
|
|
228
|
-
enumerable: false,
|
|
229
|
-
configurable: true
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
return error;
|
|
233
|
-
}
|
|
234
|
-
function isSafeError(value) {
|
|
235
|
-
return !!(value && (typeof value === "object" || typeof value === "function") && value[SAFE_ERROR]);
|
|
236
|
-
}
|
|
237
|
-
const REVALIDATE_HEADER = "X-Revalidate";
|
|
238
|
-
const RESPONSE_HEADER_VALUE_LIMIT = 4096;
|
|
239
|
-
function initWithRevalidate(init = {}) {
|
|
240
|
-
const resolved = typeof init === "number" ? {
|
|
241
|
-
status: init
|
|
242
|
-
} : init;
|
|
243
|
-
const {
|
|
244
|
-
revalidate,
|
|
245
|
-
...responseInit
|
|
246
|
-
} = resolved;
|
|
247
|
-
let headers;
|
|
248
|
-
if (responseInit.headers && responseInit.headers.getSetCookie) {
|
|
249
|
-
headers = new Headers();
|
|
250
|
-
responseInit.headers.forEach((value, key) => {
|
|
251
|
-
if (key !== "set-cookie") headers.append(key, value);
|
|
252
|
-
});
|
|
253
|
-
for (const cookie of responseInit.headers.getSetCookie()) {
|
|
254
|
-
headers.append("Set-Cookie", cookie);
|
|
255
|
-
}
|
|
256
|
-
} else {
|
|
257
|
-
headers = new Headers(responseInit.headers);
|
|
258
|
-
}
|
|
259
|
-
if (revalidate !== undefined) {
|
|
260
|
-
const keys = revalidate.toString();
|
|
261
|
-
if (keys.length > RESPONSE_HEADER_VALUE_LIMIT) {
|
|
262
|
-
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.`);
|
|
263
|
-
}
|
|
264
|
-
headers.set(REVALIDATE_HEADER, keys);
|
|
265
|
-
}
|
|
266
|
-
return {
|
|
267
|
-
responseInit,
|
|
268
|
-
headers
|
|
269
|
-
};
|
|
270
|
-
}
|
|
271
|
-
function redirect(url, init = 302) {
|
|
272
|
-
if (typeof url !== "string" && !isHref(url)) {
|
|
273
|
-
throw new TypeError("redirect() expects a string URL or an Href-branded value (Symbol.for('solid.Href')).");
|
|
274
|
-
}
|
|
275
|
-
const {
|
|
276
|
-
responseInit,
|
|
277
|
-
headers
|
|
278
|
-
} = initWithRevalidate(init);
|
|
279
|
-
if (responseInit.status === undefined) {
|
|
280
|
-
responseInit.status = 302;
|
|
281
|
-
}
|
|
282
|
-
const target = typeof url === "string" ? url : url[HREF];
|
|
283
|
-
const location = typeof target === "string" ? target : String(url);
|
|
284
|
-
const encoded = location.replace(/[^\x00-\x7f]/gu, encodeURIComponent);
|
|
285
|
-
if (encoded.length > RESPONSE_HEADER_VALUE_LIMIT) {
|
|
286
|
-
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.`);
|
|
287
|
-
}
|
|
288
|
-
headers.set("Location", encoded);
|
|
289
|
-
return new Response(null, {
|
|
290
|
-
...responseInit,
|
|
291
|
-
headers
|
|
292
|
-
});
|
|
293
|
-
}
|
|
294
|
-
function reload(init = {}) {
|
|
295
|
-
const {
|
|
296
|
-
responseInit,
|
|
297
|
-
headers
|
|
298
|
-
} = initWithRevalidate(init);
|
|
299
|
-
return new Response(null, {
|
|
300
|
-
...responseInit,
|
|
301
|
-
headers
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
const NULL_BODY_STATUSES = new Set([204, 205, 304]);
|
|
305
|
-
function respond(value, init = {}) {
|
|
306
|
-
const {
|
|
307
|
-
responseInit,
|
|
308
|
-
headers
|
|
309
|
-
} = initWithRevalidate(init);
|
|
310
|
-
for (const header of COMPOSED_BODY_FRAMING) headers.delete(header);
|
|
311
|
-
if (NULL_BODY_STATUSES.has(responseInit.status)) {
|
|
312
|
-
return new ResponseEnvelope(new Response(null, {
|
|
313
|
-
...responseInit,
|
|
314
|
-
headers
|
|
315
|
-
}), value);
|
|
316
|
-
}
|
|
317
|
-
headers.set("Content-Type", "application/json");
|
|
318
|
-
return new ResponseEnvelope(new Response(JSON.stringify(value), {
|
|
319
|
-
...responseInit,
|
|
320
|
-
headers
|
|
321
|
-
}), value);
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
const SERVER_FUNCTION_METADATA = Symbol.for("solid.ServerFunctionMetadata");
|
|
325
|
-
function getServerFunctionMetadata(fn) {
|
|
326
|
-
if (typeof fn !== "function") return undefined;
|
|
327
|
-
return fn[SERVER_FUNCTION_METADATA] || undefined;
|
|
328
|
-
}
|
|
329
|
-
function isServerFunction(fn) {
|
|
330
|
-
return typeof fn === "function" && !!fn[SERVER_FUNCTION_METADATA];
|
|
331
|
-
}
|
|
332
|
-
const SERVER_FUNCTION_RPC = Symbol.for("solid.ServerFunctionRPC");
|
|
333
|
-
function getServerFunctionRPC() {
|
|
334
|
-
return globalThis[SERVER_FUNCTION_RPC];
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
function parseCookieHeader(header) {
|
|
338
|
-
const cookies = {};
|
|
339
|
-
if (!header) return cookies;
|
|
340
|
-
for (const part of header.split(";")) {
|
|
341
|
-
const eq = part.indexOf("=");
|
|
342
|
-
if (eq < 0) continue;
|
|
343
|
-
const name = decodeSafe(part.slice(0, eq).trim());
|
|
344
|
-
let value = part.slice(eq + 1).trim();
|
|
345
|
-
if (value.length > 1 && value[0] === '"' && value[value.length - 1] === '"') {
|
|
346
|
-
value = value.slice(1, -1);
|
|
347
|
-
}
|
|
348
|
-
cookies[name] = decodeSafe(value);
|
|
349
|
-
}
|
|
350
|
-
return cookies;
|
|
351
|
-
}
|
|
352
|
-
function decodeSafe(text) {
|
|
353
|
-
try {
|
|
354
|
-
return decodeURIComponent(text);
|
|
355
|
-
} catch {
|
|
356
|
-
return text;
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
function serializeCookie(name, value, options = {}) {
|
|
360
|
-
assertServableCookie(name, options);
|
|
361
|
-
let cookie = `${encodeURIComponent(name)}=${encodeURIComponent(value)}`;
|
|
362
|
-
cookie += `; Path=${options.path === undefined ? "/" : options.path}`;
|
|
363
|
-
if (options.domain) cookie += `; Domain=${options.domain}`;
|
|
364
|
-
if (options.maxAge !== undefined) cookie += `; Max-Age=${Math.trunc(options.maxAge)}`;
|
|
365
|
-
if (options.expires) cookie += `; Expires=${options.expires.toUTCString()}`;
|
|
366
|
-
if (options.httpOnly) cookie += "; HttpOnly";
|
|
367
|
-
if (options.secure) cookie += "; Secure";
|
|
368
|
-
if (options.partitioned) cookie += "; Partitioned";
|
|
369
|
-
if (options.sameSite) {
|
|
370
|
-
const sameSite = options.sameSite.toLowerCase();
|
|
371
|
-
cookie += `; SameSite=${sameSite === "none" ? "None" : sameSite === "strict" ? "Strict" : "Lax"}`;
|
|
372
|
-
}
|
|
373
|
-
return cookie;
|
|
374
|
-
}
|
|
375
|
-
function assertServableCookie(name, options) {
|
|
376
|
-
const reject = reason => {
|
|
377
|
-
throw new Error(`serializeCookie: every browser silently rejects this cookie — ${reason}. ` + `It would never come back on a request, with no error anywhere.`);
|
|
378
|
-
};
|
|
379
|
-
const lower = name.toLowerCase();
|
|
380
|
-
if (lower.startsWith("__host-")) {
|
|
381
|
-
if (!options.secure) reject(`the __Host- prefix on \`${name}\` requires \`secure: true\``);
|
|
382
|
-
if (options.path !== undefined && options.path !== "/") reject(`the __Host- prefix on \`${name}\` requires \`Path=/\` (got \`${options.path}\`) — ` + `host-locking is the prefix's whole contract, so it cannot be path-scoped`);
|
|
383
|
-
if (options.domain) reject(`the __Host- prefix on \`${name}\` forbids \`Domain\` (got \`${options.domain}\`)`);
|
|
384
|
-
} else if (lower.startsWith("__secure-") && !options.secure) {
|
|
385
|
-
reject(`the __Secure- prefix on \`${name}\` requires \`secure: true\``);
|
|
386
|
-
}
|
|
387
|
-
if (options.sameSite && options.sameSite.toLowerCase() === "none" && !options.secure) {
|
|
388
|
-
reject("`SameSite=None` requires `secure: true`");
|
|
389
|
-
}
|
|
390
|
-
if (options.partitioned && !options.secure) {
|
|
391
|
-
reject("`Partitioned` requires `secure: true`");
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
const FLASH_COOKIE = "flash";
|
|
395
|
-
const FLASH_MATCHER = new RegExp(`(?:^|;\\s*)${FLASH_COOKIE}=([^;]+)`);
|
|
396
|
-
function hasFlashCookie(cookieHeader) {
|
|
397
|
-
return !!cookieHeader && FLASH_MATCHER.test(cookieHeader);
|
|
398
|
-
}
|
|
399
|
-
function clearFlashCookie() {
|
|
400
|
-
return `${FLASH_COOKIE}=; Max-Age=0; Path=/`;
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
const ERROR_HEADER = "X-Server-Function-Error";
|
|
404
|
-
const BODY_FORMAT_HEADER = "X-Server-Function-Format";
|
|
405
|
-
const REDIRECT_HEADER = "X-Server-Function-Redirect";
|
|
406
|
-
const SINGLE_FLIGHT_HEADER = "X-Single-Flight";
|
|
407
|
-
|
|
408
|
-
const HEAD_ELIGIBLE_TAGS = new Set(["title", "meta", "link", "style", "script", "base"]);
|
|
409
|
-
const HEAD_ATTR_NAME = /^[a-zA-Z_][a-zA-Z0-9_:.-]*$/;
|
|
410
|
-
const RESOURCE_LINK_RELS = new Set(["preload", "modulepreload", "prefetch", "preconnect", "dns-prefetch", "stylesheet"]);
|
|
411
|
-
const RESOURCE_QUALIFIERS = ["as", "crossorigin", "type", "media", "imagesrcset", "imagesizes"];
|
|
412
|
-
const STYLESHEET_FETCH_META = new Set(["crossorigin", "integrity", "referrerpolicy", "fetchpriority"]);
|
|
413
|
-
function evalHeadValue(v) {
|
|
414
|
-
return typeof v === "function" ? v() : v;
|
|
415
|
-
}
|
|
416
|
-
function evalHeadProps(props, presets) {
|
|
417
|
-
const out = {};
|
|
418
|
-
for (const name in props) out[name] = presets && name in presets ? presets[name] : evalHeadValue(props[name]);
|
|
419
|
-
return out;
|
|
420
|
-
}
|
|
421
|
-
function classifyHeadTag(desc) {
|
|
422
|
-
const tag = desc.tag;
|
|
423
|
-
if (tag === "link") {
|
|
424
|
-
const rel = evalHeadValue(desc.props && desc.props.rel);
|
|
425
|
-
return {
|
|
426
|
-
resource: RESOURCE_LINK_RELS.has(rel),
|
|
427
|
-
rel
|
|
428
|
-
};
|
|
429
|
-
}
|
|
430
|
-
if (tag === "style") return {
|
|
431
|
-
resource: !!(desc.props && "href" in desc.props)
|
|
432
|
-
};
|
|
433
|
-
if (tag === "script") return {
|
|
434
|
-
resource: !!(desc.props && "src" in desc.props)
|
|
435
|
-
};
|
|
436
|
-
return {
|
|
437
|
-
resource: false
|
|
438
|
-
};
|
|
439
|
-
}
|
|
440
|
-
function qualifierValue(name, value) {
|
|
441
|
-
if (value == null || value === false) return null;
|
|
442
|
-
if (name === "imagesrcset" || name === "imagesizes") return typeof value === "string" && value !== "" ? value : null;
|
|
443
|
-
const v = value === true ? "" : String(value);
|
|
444
|
-
if (name === "as") return asciiLowerCase(v);
|
|
445
|
-
if (name !== "crossorigin") return v;
|
|
446
|
-
return v.length === 15 && v.toLowerCase() === "use-credentials" ? v.toLowerCase() : "anonymous";
|
|
447
|
-
}
|
|
448
|
-
function asciiLowerCase(value) {
|
|
449
|
-
return value.replace(/[A-Z]/g, c => String.fromCharCode(c.charCodeAt(0) + 32));
|
|
450
|
-
}
|
|
451
|
-
function resourceIdentity(tag, props) {
|
|
452
|
-
const url = String(props.href || props.src || "");
|
|
453
|
-
let id = "res:" + tag + ":" + (props.rel || "") + ":" + url.length + ":" + url;
|
|
454
|
-
for (let i = 0; i < RESOURCE_QUALIFIERS.length; i++) {
|
|
455
|
-
const q = RESOURCE_QUALIFIERS[i];
|
|
456
|
-
const value = qualifierValue(q, props[q]);
|
|
457
|
-
if (value !== null) id += ":" + q + "=" + value.length + ":" + value;
|
|
458
|
-
}
|
|
459
|
-
return id;
|
|
460
|
-
}
|
|
461
|
-
function replaceableIdentity(tag, props, key, unique) {
|
|
462
|
-
if (tag === "title") return "title";
|
|
463
|
-
if (tag === "base") return "base";
|
|
464
|
-
if (tag === "meta" && props.charset != null) return "charset";
|
|
465
|
-
if (key != null) return tag + ":key:" + key;
|
|
466
|
-
if (tag === "meta") {
|
|
467
|
-
for (const ns of ["name", "property", "http-equiv"]) if (props[ns] != null) return "meta:" + ns + ":" + props[ns] + (props.media != null ? ":media=" + props.media : "");
|
|
468
|
-
return unique;
|
|
469
|
-
}
|
|
470
|
-
if (tag === "link") {
|
|
471
|
-
const rel = props.rel || "";
|
|
472
|
-
if (rel === "icon" || rel === "apple-touch-icon") return "link:" + rel + (props.sizes != null ? ":sizes=" + props.sizes : "") + (props.type != null ? ":type=" + props.type : "");
|
|
473
|
-
return "link:" + rel + ":" + (props.href || "");
|
|
474
|
-
}
|
|
475
|
-
return unique;
|
|
476
|
-
}
|
|
477
|
-
function resolveHead(groups) {
|
|
478
|
-
const winners = new Map();
|
|
479
|
-
const sorted = groups.slice().sort((a, b) => a.seq - b.seq);
|
|
480
|
-
for (let i = 0; i < sorted.length; i++) {
|
|
481
|
-
const group = sorted[i];
|
|
482
|
-
const byIdentity = new Map();
|
|
483
|
-
for (let j = 0; j < group.tags.length; j++) {
|
|
484
|
-
const t = group.tags[j];
|
|
485
|
-
let list = byIdentity.get(t.identity);
|
|
486
|
-
if (!list) byIdentity.set(t.identity, list = []);
|
|
487
|
-
list.push(t);
|
|
488
|
-
}
|
|
489
|
-
for (const [identity, tags] of byIdentity) {
|
|
490
|
-
if (identity === "title") {
|
|
491
|
-
if (tags.length > 1) console.warn("Multiple <title> tags in one head group; the last one wins.");
|
|
492
|
-
winners.set(identity, {
|
|
493
|
-
seq: group.seq,
|
|
494
|
-
tags: [tags[tags.length - 1]]
|
|
495
|
-
});
|
|
496
|
-
} else {
|
|
497
|
-
winners.set(identity, {
|
|
498
|
-
seq: group.seq,
|
|
499
|
-
tags
|
|
500
|
-
});
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
return winners;
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
function joinAssetPath(base, file) {
|
|
508
|
-
if (/^(?:[a-z][a-z0-9+.-]*:)?\/\//i.test(file)) return file;
|
|
509
|
-
if (typeof base !== "string" || !base) base = "/";
|
|
510
|
-
if (base[base.length - 1] !== "/") base += "/";
|
|
511
|
-
return base + (file[0] === "/" ? file.slice(1) : file);
|
|
512
|
-
}
|
|
513
|
-
function eachCandidate(srcset, visit) {
|
|
514
|
-
let i = 0;
|
|
515
|
-
const n = srcset.length;
|
|
516
|
-
while (i < n) {
|
|
517
|
-
while (i < n && /[\s,]/.test(srcset[i])) i++;
|
|
518
|
-
const start = i;
|
|
519
|
-
while (i < n && !/\s/.test(srcset[i])) i++;
|
|
520
|
-
if (i === start) return false;
|
|
521
|
-
const raw = srcset.slice(start, i);
|
|
522
|
-
const url = raw.replace(/,+$/, "");
|
|
523
|
-
let descriptors = "";
|
|
524
|
-
if (url === raw) {
|
|
525
|
-
const from = i;
|
|
526
|
-
while (i < n && srcset[i] !== ",") i++;
|
|
527
|
-
descriptors = srcset.slice(from, i);
|
|
528
|
-
}
|
|
529
|
-
if (url && visit(url, descriptors)) return true;
|
|
530
|
-
}
|
|
531
|
-
return false;
|
|
532
|
-
}
|
|
533
|
-
function hasRelativeCandidate(srcset) {
|
|
534
|
-
return eachCandidate(srcset, url => !/^(?:[a-zA-Z][a-zA-Z0-9+.-]*:|\/)/.test(url));
|
|
535
|
-
}
|
|
536
|
-
function hasWidthDescriptor(srcset) {
|
|
537
|
-
return eachCandidate(srcset, (_, descriptors) => /(?:^|\s)\d+(?:\.\d+)?w(?=\s|$)/.test(descriptors));
|
|
538
|
-
}
|
|
539
|
-
function resolveAssets(moduleUrl, manifest) {
|
|
540
|
-
if (!manifest) return null;
|
|
541
|
-
const base = manifest._base;
|
|
542
|
-
const entry = manifest[moduleUrl];
|
|
543
|
-
if (!entry) return null;
|
|
544
|
-
const css = [];
|
|
545
|
-
const js = [];
|
|
546
|
-
let preloads;
|
|
547
|
-
const visited = new Set();
|
|
548
|
-
const walk = key => {
|
|
549
|
-
if (visited.has(key)) return;
|
|
550
|
-
visited.add(key);
|
|
551
|
-
const e = manifest[key];
|
|
552
|
-
if (!e) return;
|
|
553
|
-
js.push(joinAssetPath(base, e.file));
|
|
554
|
-
if (e.css) for (let i = 0; i < e.css.length; i++) css.push(joinAssetPath(base, e.css[i]));
|
|
555
|
-
if (e.preloads) {
|
|
556
|
-
for (let i = 0; i < e.preloads.length; i++) {
|
|
557
|
-
const link = e.preloads[i];
|
|
558
|
-
const href = link && typeof link.href === "string" && link.href;
|
|
559
|
-
const srcset = link && typeof link.imagesrcset === "string" && link.imagesrcset;
|
|
560
|
-
if (!href && !srcset) continue;
|
|
561
|
-
if (!preloads) preloads = [];
|
|
562
|
-
if (href) preloads.push({
|
|
563
|
-
...link,
|
|
564
|
-
href: joinAssetPath(base, href)
|
|
565
|
-
});else {
|
|
566
|
-
const {
|
|
567
|
-
href: bad,
|
|
568
|
-
...rest
|
|
569
|
-
} = link;
|
|
570
|
-
if (bad !== undefined) console.warn("Preload href must be a non-empty string; dropping it.", bad);
|
|
571
|
-
preloads.push(rest);
|
|
572
|
-
}
|
|
573
|
-
if (srcset && hasRelativeCandidate(srcset)) console.warn("imagesrcset candidates are not joined with the manifest base — they resolve " + "against the document URL, so a relative candidate points somewhere else " + "than the joined href; the integration should emit resolved URLs.", srcset);
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
if (e.imports) for (let i = 0; i < e.imports.length; i++) walk(e.imports[i]);
|
|
577
|
-
};
|
|
578
|
-
walk(moduleUrl);
|
|
579
|
-
const assets = {
|
|
580
|
-
js,
|
|
581
|
-
css
|
|
582
|
-
};
|
|
583
|
-
if (preloads) assets.preloads = preloads;
|
|
584
|
-
return assets;
|
|
585
|
-
}
|
|
586
|
-
function registerEntryAssets(manifest) {
|
|
587
|
-
if (!manifest || typeof manifest === "function" || typeof manifest.resolve === "function") return;
|
|
588
|
-
const ctx = solidJs.sharedConfig.context;
|
|
589
|
-
if (!ctx?.registerAsset) return;
|
|
590
|
-
for (const key in manifest) {
|
|
591
|
-
if (manifest[key].isEntry) {
|
|
592
|
-
const assets = resolveAssets(key, manifest);
|
|
593
|
-
if (assets) {
|
|
594
|
-
if (assets.preloads) for (let i = 0; i < assets.preloads.length; i++) ctx.registerAsset("preload", assets.preloads[i]);
|
|
595
|
-
for (let i = 0; i < assets.css.length; i++) ctx.registerAsset("style", assets.css[i]);
|
|
596
|
-
for (let i = 1; i < assets.js.length; i++) ctx.registerAsset("module", assets.js[i]);
|
|
597
|
-
}
|
|
598
|
-
return;
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
function createAssetTracking() {
|
|
603
|
-
const boundaryModules = new Map();
|
|
604
|
-
const boundaryStyles = new Map();
|
|
605
|
-
const emittedAssets = new Set();
|
|
606
|
-
const inlineStyles = new Map();
|
|
607
|
-
let currentBoundaryId = null;
|
|
608
|
-
return {
|
|
609
|
-
boundaryModules,
|
|
610
|
-
boundaryStyles,
|
|
611
|
-
emittedAssets,
|
|
612
|
-
inlineStyles,
|
|
613
|
-
preloadLinks: null,
|
|
614
|
-
registerInlineStyle(desc) {
|
|
615
|
-
let entry = inlineStyles.get(desc.id);
|
|
616
|
-
if (!entry) {
|
|
617
|
-
entry = {
|
|
618
|
-
id: desc.id,
|
|
619
|
-
content: desc.content || "",
|
|
620
|
-
attrs: desc.attrs,
|
|
621
|
-
emitted: false
|
|
622
|
-
};
|
|
623
|
-
inlineStyles.set(desc.id, entry);
|
|
624
|
-
}
|
|
625
|
-
if (currentBoundaryId) {
|
|
626
|
-
let styles = boundaryStyles.get(currentBoundaryId);
|
|
627
|
-
if (!styles) {
|
|
628
|
-
styles = new Set();
|
|
629
|
-
boundaryStyles.set(currentBoundaryId, styles);
|
|
630
|
-
}
|
|
631
|
-
styles.add(entry);
|
|
632
|
-
}
|
|
633
|
-
return entry;
|
|
634
|
-
},
|
|
635
|
-
get currentBoundaryId() {
|
|
636
|
-
return currentBoundaryId;
|
|
637
|
-
},
|
|
638
|
-
set currentBoundaryId(v) {
|
|
639
|
-
currentBoundaryId = v;
|
|
640
|
-
},
|
|
641
|
-
registerModule(key, entryUrl) {
|
|
642
|
-
const id = currentBoundaryId || "";
|
|
643
|
-
let map = boundaryModules.get(id);
|
|
644
|
-
if (!map) {
|
|
645
|
-
map = {};
|
|
646
|
-
boundaryModules.set(id, map);
|
|
647
|
-
}
|
|
648
|
-
map[key] = entryUrl;
|
|
649
|
-
},
|
|
650
|
-
getBoundaryModules(id) {
|
|
651
|
-
return boundaryModules.get(id) || null;
|
|
652
|
-
},
|
|
653
|
-
getBoundaryStyles(id) {
|
|
654
|
-
return boundaryStyles.get(id) || null;
|
|
655
|
-
}
|
|
656
|
-
};
|
|
657
|
-
}
|
|
658
|
-
function warnUnresolvedModuleAssets(moduleUrl, warned) {
|
|
659
|
-
if (warned.has(moduleUrl)) return;
|
|
660
|
-
warned.add(moduleUrl);
|
|
661
|
-
console.error(`Asset manifest returned no client assets for module "${moduleUrl}". ` + "If this module is a server-rendered lazy() component, its entry will be missing from " + "the serialized hydration asset map, the client will be unable to preload it, and " + "hydration will fail with 'lazy() module \"…\" was not preloaded before hydration'. " + "This means the integration's asset resolver (dev manifest bridge or build client " + "manifest) failed to answer for this module — check the integration's server logs, " + "restart the dev server, or verify the module is included in the client build.");
|
|
662
|
-
}
|
|
663
|
-
function guardResolvedAssets(moduleUrl, result, warned) {
|
|
664
|
-
if (result && typeof result.then === "function") {
|
|
665
|
-
return result.then(assets => {
|
|
666
|
-
if (!assets || !assets.js || !assets.js.length) warnUnresolvedModuleAssets(moduleUrl, warned);
|
|
667
|
-
return assets;
|
|
668
|
-
});
|
|
669
|
-
}
|
|
670
|
-
if (!result || !result.js || !result.js.length) warnUnresolvedModuleAssets(moduleUrl, warned);
|
|
671
|
-
return result;
|
|
672
|
-
}
|
|
673
|
-
function applyAssetTracking(context, tracking, manifest, noScripts) {
|
|
674
|
-
const warned = new Set();
|
|
675
|
-
const guard = noScripts ? resolve => resolve : resolve => moduleUrl => guardResolvedAssets(moduleUrl, resolve(moduleUrl), warned);
|
|
676
|
-
Object.defineProperty(context, "_currentBoundaryId", {
|
|
677
|
-
get() {
|
|
678
|
-
return tracking.currentBoundaryId;
|
|
679
|
-
},
|
|
680
|
-
set(v) {
|
|
681
|
-
tracking.currentBoundaryId = v;
|
|
682
|
-
},
|
|
683
|
-
configurable: true,
|
|
684
|
-
enumerable: true
|
|
685
|
-
});
|
|
686
|
-
context.registerModule = tracking.registerModule;
|
|
687
|
-
context.getBoundaryModules = tracking.getBoundaryModules;
|
|
688
|
-
if (typeof manifest === "function") {
|
|
689
|
-
context.resolveAssets = guard(manifest);
|
|
690
|
-
} else if (manifest && typeof manifest.resolve === "function") {
|
|
691
|
-
context.resolveAssets = guard(key => manifest.resolve(key));
|
|
692
|
-
if (typeof manifest.resolveSync === "function") {
|
|
693
|
-
context.resolveAssetsSync = key => manifest.resolveSync(key);
|
|
694
|
-
}
|
|
695
|
-
} else if (manifest) {
|
|
696
|
-
const resolve = moduleUrl => resolveAssets(moduleUrl, manifest);
|
|
697
|
-
context.resolveAssets = guard(resolve);
|
|
698
|
-
context.resolveAssetsSync = resolve;
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
function isCssUrl(url) {
|
|
702
|
-
const q = url.search(/[?#]/);
|
|
703
|
-
return (q === -1 ? url : url.slice(0, q)).endsWith(".css");
|
|
704
|
-
}
|
|
705
|
-
const RESPONSIVE_ATTRIBUTES = ["imagesrcset", "imagesizes"];
|
|
706
|
-
function isSetAttr(value) {
|
|
707
|
-
return value != null && value !== false && value !== "";
|
|
708
|
-
}
|
|
709
|
-
const PRELOAD_LINK_ATTRIBUTES = ["type", "crossorigin", "integrity", "referrerpolicy", "fetchpriority", "media", "imagesrcset", "imagesizes"];
|
|
710
|
-
function registerPreloadLink(tracking, headRegistry, link, nonce) {
|
|
711
|
-
if (!link || typeof link !== "object") {
|
|
712
|
-
console.warn('registerAsset("preload") requires a descriptor object.', link);
|
|
713
|
-
return null;
|
|
714
|
-
}
|
|
715
|
-
if (typeof link.as !== "string") {
|
|
716
|
-
console.warn('registerAsset("preload") requires an as destination.');
|
|
717
|
-
return null;
|
|
718
|
-
}
|
|
719
|
-
const as = asciiLowerCase(link.as);
|
|
720
|
-
let destination = null;
|
|
721
|
-
switch (as) {
|
|
722
|
-
case "script":
|
|
723
|
-
case "style":
|
|
724
|
-
destination = as;
|
|
725
|
-
break;
|
|
726
|
-
case "fetch":
|
|
727
|
-
case "font":
|
|
728
|
-
case "image":
|
|
729
|
-
case "track":
|
|
730
|
-
break;
|
|
731
|
-
default:
|
|
732
|
-
console.warn(`registerAsset("preload") received an unsupported as destination "${link.as}".`);
|
|
733
|
-
return null;
|
|
734
|
-
}
|
|
735
|
-
const responsive = as === "image";
|
|
736
|
-
if (!responsive && (isSetAttr(link.imagesrcset) || isSetAttr(link.imagesizes))) console.warn('registerAsset("preload") only supports imagesrcset and imagesizes with as="image".');
|
|
737
|
-
let srcset = null;
|
|
738
|
-
let sizes = null;
|
|
739
|
-
if (responsive) {
|
|
740
|
-
for (const name of RESPONSIVE_ATTRIBUTES) {
|
|
741
|
-
const value = link[name];
|
|
742
|
-
if (!isSetAttr(value)) continue;
|
|
743
|
-
if (typeof value !== "string") {
|
|
744
|
-
console.warn(`registerAsset("preload") expects a string ${name}.`);
|
|
745
|
-
continue;
|
|
746
|
-
}
|
|
747
|
-
if (name === "imagesrcset") srcset = value;else sizes = value;
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
const href = typeof link.href === "string" && link.href ? link.href : null;
|
|
751
|
-
if (!href && link.href != null && link.href !== false) console.warn("Preload href must be a non-empty string; dropping it.", link.href);
|
|
752
|
-
if (!href && !srcset) {
|
|
753
|
-
console.warn('registerAsset("preload") requires a non-empty string href or imagesrcset.');
|
|
754
|
-
return null;
|
|
755
|
-
}
|
|
756
|
-
if (srcset && !sizes && hasWidthDescriptor(srcset)) console.warn("imagesrcset uses a width descriptor, so imagesizes is required; without it the " + "source size defaults to 100vw and the preload may not match the image.", srcset);
|
|
757
|
-
const props = {
|
|
758
|
-
rel: "preload"
|
|
759
|
-
};
|
|
760
|
-
if (href) props.href = href;
|
|
761
|
-
props.as = as;
|
|
762
|
-
for (let i = 0; i < PRELOAD_LINK_ATTRIBUTES.length; i++) {
|
|
763
|
-
const name = PRELOAD_LINK_ATTRIBUTES[i];
|
|
764
|
-
if (RESPONSIVE_ATTRIBUTES.indexOf(name) !== -1) {
|
|
765
|
-
const value = name === "imagesrcset" ? srcset : sizes;
|
|
766
|
-
if (value !== null) props[name] = value;
|
|
767
|
-
continue;
|
|
768
|
-
}
|
|
769
|
-
const value = link[name];
|
|
770
|
-
if (value == null || value === false) continue;
|
|
771
|
-
props[name] = value === true ? "" : String(value);
|
|
772
|
-
}
|
|
773
|
-
const identity = resourceIdentity("link", props);
|
|
774
|
-
if (headRegistry.resources.has(identity)) return null;
|
|
775
|
-
if (props.crossorigin == null && (as === "font" || as === "fetch")) console.warn(`registerAsset("preload") with as="${as}" has no crossorigin and may not match the eventual request.`);
|
|
776
|
-
const attrs = headAttrRecord(props);
|
|
777
|
-
const nonceValue = destination && nonce && nonce[destination];
|
|
778
|
-
if (typeof nonceValue === "string" && nonceValue) attrs.nonce = nonceValue;
|
|
779
|
-
const entry = {
|
|
780
|
-
href: props.href,
|
|
781
|
-
attrs,
|
|
782
|
-
attrHtml: renderHeadAttrHtml(props) + nonceAttr(nonce, destination)
|
|
783
|
-
};
|
|
784
|
-
headRegistry.resources.add(identity);
|
|
785
|
-
let links = tracking.preloadLinks;
|
|
786
|
-
if (!links) tracking.preloadLinks = links = [];
|
|
787
|
-
links.push(entry);
|
|
788
|
-
return entry;
|
|
789
|
-
}
|
|
790
|
-
function createHeadRegistry() {
|
|
791
|
-
return {
|
|
792
|
-
pending: [],
|
|
793
|
-
committed: [],
|
|
794
|
-
seq: 0,
|
|
795
|
-
uniq: 0,
|
|
796
|
-
resources: new Set(),
|
|
797
|
-
eagerHtml: "",
|
|
798
|
-
flushed: null,
|
|
799
|
-
shellFlushed: false,
|
|
800
|
-
parkedResources: []
|
|
801
|
-
};
|
|
802
|
-
}
|
|
803
|
-
function registerHeadTags(registry, context, tracking, emitResource, nonce, tags) {
|
|
804
|
-
const boundary = context._currentBoundaryId || "";
|
|
805
|
-
if (typeof tags === "function") {
|
|
806
|
-
registry.pending.push({
|
|
807
|
-
boundary,
|
|
808
|
-
list: tags,
|
|
809
|
-
resource: (desc, rel) => emitHeadResource(registry, context, tracking, emitResource, nonce, desc, rel)
|
|
810
|
-
});
|
|
811
|
-
return;
|
|
812
|
-
}
|
|
813
|
-
if (!Array.isArray(tags)) tags = [tags];
|
|
814
|
-
const probe = solidJs.sharedConfig.context && solidJs.sharedConfig.context._loadingPhase;
|
|
815
|
-
let replaceable = null;
|
|
816
|
-
for (let i = 0; i < tags.length; i++) {
|
|
817
|
-
const desc = tags[i];
|
|
818
|
-
if (!desc || !HEAD_ELIGIBLE_TAGS.has(desc.tag)) {
|
|
819
|
-
console.warn(`useHead: ignoring non-head tag`, desc);
|
|
820
|
-
continue;
|
|
821
|
-
}
|
|
822
|
-
const cls = classifyHeadTag(desc);
|
|
823
|
-
if (probe && !cls.resource) {
|
|
824
|
-
try {
|
|
825
|
-
evalHeadProps(desc.props || {}, cls.rel !== undefined ? {
|
|
826
|
-
rel: cls.rel
|
|
827
|
-
} : undefined);
|
|
828
|
-
evalHeadValue(desc.key);
|
|
829
|
-
} catch (err) {
|
|
830
|
-
if (solidJs.ssrHandleError(err)) throw err;
|
|
831
|
-
}
|
|
832
|
-
}
|
|
833
|
-
if (cls.resource) {
|
|
834
|
-
emitHeadResource(registry, context, tracking, emitResource, nonce, desc, cls.rel);
|
|
835
|
-
} else {
|
|
836
|
-
(replaceable || (replaceable = [])).push(cls.rel !== undefined ? {
|
|
837
|
-
tag: desc.tag,
|
|
838
|
-
props: desc.props,
|
|
839
|
-
key: desc.key,
|
|
840
|
-
rel: cls.rel
|
|
841
|
-
} : desc);
|
|
842
|
-
}
|
|
843
|
-
}
|
|
844
|
-
if (replaceable) registry.pending.push({
|
|
845
|
-
boundary,
|
|
846
|
-
tags: replaceable
|
|
847
|
-
});
|
|
848
|
-
}
|
|
849
|
-
function headShellReady(registry, block) {
|
|
850
|
-
let ready = true;
|
|
851
|
-
const pends = err => {
|
|
852
|
-
const source = solidJs.ssrHandleError(err, true);
|
|
853
|
-
if (!source) return false;
|
|
854
|
-
block(source);
|
|
855
|
-
ready = false;
|
|
856
|
-
return true;
|
|
857
|
-
};
|
|
858
|
-
const parked = registry.parkedResources;
|
|
859
|
-
for (let i = parked.length - 1; i >= 0; i--) {
|
|
860
|
-
const {
|
|
861
|
-
desc,
|
|
862
|
-
rel,
|
|
863
|
-
emit
|
|
864
|
-
} = parked[i];
|
|
865
|
-
try {
|
|
866
|
-
evalHeadProps(desc.props || {}, rel !== undefined ? {
|
|
867
|
-
rel
|
|
868
|
-
} : undefined);
|
|
869
|
-
} catch (err) {
|
|
870
|
-
if (pends(err)) continue;
|
|
871
|
-
console.warn(`useHead: error evaluating resource tag props`, err);
|
|
872
|
-
parked.splice(i, 1);
|
|
873
|
-
continue;
|
|
874
|
-
}
|
|
875
|
-
parked.splice(i, 1);
|
|
876
|
-
emit();
|
|
877
|
-
}
|
|
878
|
-
for (let i = 0; i < registry.pending.length; i++) {
|
|
879
|
-
const reg = registry.pending[i];
|
|
880
|
-
if (reg.boundary !== "" || reg.list) continue;
|
|
881
|
-
for (let j = 0; j < reg.tags.length; j++) {
|
|
882
|
-
const desc = reg.tags[j];
|
|
883
|
-
try {
|
|
884
|
-
evalHeadProps(desc.props || {}, desc.rel !== undefined ? {
|
|
885
|
-
rel: desc.rel
|
|
886
|
-
} : undefined);
|
|
887
|
-
evalHeadValue(desc.key);
|
|
888
|
-
} catch (err) {
|
|
889
|
-
pends(err);
|
|
890
|
-
}
|
|
891
|
-
}
|
|
892
|
-
}
|
|
893
|
-
return ready;
|
|
894
|
-
}
|
|
895
|
-
function emitHeadResource(registry, context, tracking, emitResource, nonce, desc, rel) {
|
|
896
|
-
let props;
|
|
897
|
-
try {
|
|
898
|
-
props = evalHeadProps(desc.props || {}, rel !== undefined ? {
|
|
899
|
-
rel
|
|
900
|
-
} : undefined);
|
|
901
|
-
} catch (err) {
|
|
902
|
-
const loadingPhase = solidJs.sharedConfig.context && solidJs.sharedConfig.context._loadingPhase;
|
|
903
|
-
if (loadingPhase && solidJs.ssrHandleError(err)) throw err;
|
|
904
|
-
if (!loadingPhase && !context._currentBoundaryId && !registry.shellFlushed && typeof context.block === "function" && solidJs.ssrHandleError(err, true)) {
|
|
905
|
-
registry.parkedResources.push({
|
|
906
|
-
desc,
|
|
907
|
-
rel,
|
|
908
|
-
emit: () => emitHeadResource(registry, context, tracking, emitResource, nonce, desc, rel)
|
|
909
|
-
});
|
|
910
|
-
return;
|
|
911
|
-
}
|
|
912
|
-
console.warn(`useHead: error evaluating resource tag props`, err);
|
|
913
|
-
return;
|
|
914
|
-
}
|
|
915
|
-
const identity = resourceIdentity(desc.tag, props);
|
|
916
|
-
if (registry.resources.has(identity)) return;
|
|
917
|
-
registry.resources.add(identity);
|
|
918
|
-
if (desc.tag === "link" && (rel === "stylesheet" || rel === "modulepreload")) {
|
|
919
|
-
let plain = true;
|
|
920
|
-
let gateable = rel === "stylesheet";
|
|
921
|
-
for (const name in props) {
|
|
922
|
-
if (name === "rel" || name === "href") continue;
|
|
923
|
-
plain = false;
|
|
924
|
-
if (!STYLESHEET_FETCH_META.has(name)) gateable = false;
|
|
925
|
-
}
|
|
926
|
-
if (plain && props.href != null) {
|
|
927
|
-
const isCss = isCssUrl(props.href);
|
|
928
|
-
if (rel === "stylesheet" ? isCss : !isCss) {
|
|
929
|
-
context.registerAsset(rel === "stylesheet" ? "style" : "module", props.href);
|
|
930
|
-
return;
|
|
931
|
-
}
|
|
932
|
-
}
|
|
933
|
-
if (gateable && props.href != null) {
|
|
934
|
-
const attrHtml = renderHeadAttrHtml(props);
|
|
935
|
-
const entry = {
|
|
936
|
-
href: props.href,
|
|
937
|
-
attrHtml,
|
|
938
|
-
attrs: headAttrRecord(props)
|
|
939
|
-
};
|
|
940
|
-
if (tracking.currentBoundaryId) {
|
|
941
|
-
let styles = tracking.boundaryStyles.get(tracking.currentBoundaryId);
|
|
942
|
-
if (!styles) tracking.boundaryStyles.set(tracking.currentBoundaryId, styles = new Set());
|
|
943
|
-
styles.add(entry);
|
|
944
|
-
}
|
|
945
|
-
const markup = `<link${attrHtml}${nonceAttr(nonce, "style")}>`;
|
|
946
|
-
if (emitResource) emitResource(markup, entry);else {
|
|
947
|
-
registry.eagerHtml += markup;
|
|
948
|
-
entry.emitted = true;
|
|
949
|
-
}
|
|
950
|
-
return;
|
|
951
|
-
}
|
|
952
|
-
}
|
|
953
|
-
const url = props.href || props.src;
|
|
954
|
-
if (url != null && tracking.emittedAssets.has(url)) return;
|
|
955
|
-
const markup = renderHeadTagMarkup(desc.tag, props, null, nonce);
|
|
956
|
-
if (emitResource) emitResource(markup);else registry.eagerHtml += markup;
|
|
957
|
-
}
|
|
958
|
-
function commitHeadBoundary(registry, boundary, isPendingFragment) {
|
|
959
|
-
const keep = [];
|
|
960
|
-
const groups = [];
|
|
961
|
-
for (let i = 0; i < registry.pending.length; i++) {
|
|
962
|
-
const reg = registry.pending[i];
|
|
963
|
-
const mine = boundary === "" ? !(isPendingFragment && reg.boundary !== "" && isPendingFragment(reg.boundary)) : reg.boundary === boundary;
|
|
964
|
-
if (!mine) {
|
|
965
|
-
keep.push(reg);
|
|
966
|
-
continue;
|
|
967
|
-
}
|
|
968
|
-
let descs = reg.tags;
|
|
969
|
-
if (reg.list) {
|
|
970
|
-
let resolved;
|
|
971
|
-
try {
|
|
972
|
-
resolved = reg.list();
|
|
973
|
-
} catch (err) {
|
|
974
|
-
console.warn(`useHead: error evaluating head group membership`, err);
|
|
975
|
-
continue;
|
|
976
|
-
}
|
|
977
|
-
if (!Array.isArray(resolved)) resolved = [resolved];
|
|
978
|
-
descs = [];
|
|
979
|
-
for (let j = 0; j < resolved.length; j++) {
|
|
980
|
-
const desc = resolved[j];
|
|
981
|
-
if (!desc || !HEAD_ELIGIBLE_TAGS.has(desc.tag)) {
|
|
982
|
-
console.warn(`useHead: ignoring non-head tag`, desc);
|
|
983
|
-
continue;
|
|
984
|
-
}
|
|
985
|
-
const cls = classifyHeadTag(desc);
|
|
986
|
-
if (cls.resource) {
|
|
987
|
-
reg.resource(desc, cls.rel);
|
|
988
|
-
} else {
|
|
989
|
-
descs.push(cls.rel !== undefined ? {
|
|
990
|
-
tag: desc.tag,
|
|
991
|
-
props: desc.props,
|
|
992
|
-
key: desc.key,
|
|
993
|
-
rel: cls.rel
|
|
994
|
-
} : desc);
|
|
995
|
-
}
|
|
996
|
-
}
|
|
997
|
-
}
|
|
998
|
-
const tags = [];
|
|
999
|
-
for (let j = 0; j < descs.length; j++) {
|
|
1000
|
-
const desc = descs[j];
|
|
1001
|
-
let props, key;
|
|
1002
|
-
try {
|
|
1003
|
-
props = evalHeadProps(desc.props || {}, desc.rel !== undefined ? {
|
|
1004
|
-
rel: desc.rel
|
|
1005
|
-
} : undefined);
|
|
1006
|
-
key = evalHeadValue(desc.key);
|
|
1007
|
-
} catch (err) {
|
|
1008
|
-
console.warn(`useHead: error evaluating tag props`, err);
|
|
1009
|
-
continue;
|
|
1010
|
-
}
|
|
1011
|
-
const identity = replaceableIdentity(desc.tag, props, key, "u:" + registry.uniq++);
|
|
1012
|
-
if ((identity === "base" || identity === "charset") && registry.shellFlushed) {
|
|
1013
|
-
console.warn(`useHead: <${desc.tag}> (${identity}) registered after shell flush is ignored`);
|
|
1014
|
-
continue;
|
|
1015
|
-
}
|
|
1016
|
-
tags.push({
|
|
1017
|
-
tag: desc.tag,
|
|
1018
|
-
props,
|
|
1019
|
-
identity
|
|
1020
|
-
});
|
|
1021
|
-
}
|
|
1022
|
-
if (tags.length) groups.push({
|
|
1023
|
-
seq: registry.seq++,
|
|
1024
|
-
tags
|
|
1025
|
-
});
|
|
1026
|
-
}
|
|
1027
|
-
registry.pending = keep;
|
|
1028
|
-
for (let i = 0; i < groups.length; i++) registry.committed.push(groups[i]);
|
|
1029
|
-
return groups;
|
|
1030
|
-
}
|
|
1031
|
-
function adoptHeadBoundary(registry, childKey, parentKey) {
|
|
1032
|
-
for (let i = 0; i < registry.pending.length; i++) {
|
|
1033
|
-
if (registry.pending[i].boundary === childKey) registry.pending[i].boundary = parentKey;
|
|
1034
|
-
}
|
|
1035
|
-
}
|
|
1036
|
-
function dropHeadBoundary(registry, boundary) {
|
|
1037
|
-
registry.pending = registry.pending.filter(reg => reg.boundary !== boundary);
|
|
1038
|
-
}
|
|
1039
|
-
function headGroupSignature(winner) {
|
|
1040
|
-
let sig = "" + winner.seq;
|
|
1041
|
-
for (let i = 0; i < winner.tags.length; i++) {
|
|
1042
|
-
const t = winner.tags[i];
|
|
1043
|
-
sig += "|" + t.tag + JSON.stringify(t.props);
|
|
1044
|
-
}
|
|
1045
|
-
return sig;
|
|
1046
|
-
}
|
|
1047
|
-
function renderShellHead(registry, nonce, isPendingFragment, noScripts) {
|
|
1048
|
-
commitHeadBoundary(registry, "", isPendingFragment);
|
|
1049
|
-
registry.shellFlushed = true;
|
|
1050
|
-
const winners = resolveHead(registry.committed);
|
|
1051
|
-
registry.flushed = new Map();
|
|
1052
|
-
let prelude = "";
|
|
1053
|
-
let links = "";
|
|
1054
|
-
let metas = "";
|
|
1055
|
-
let others = "";
|
|
1056
|
-
let scripts = "";
|
|
1057
|
-
let title = null;
|
|
1058
|
-
for (const [identity, winner] of winners) {
|
|
1059
|
-
registry.flushed.set(identity, headGroupSignature(winner));
|
|
1060
|
-
if (identity === "title") {
|
|
1061
|
-
const children = winner.tags[0].props.children;
|
|
1062
|
-
title = children == null ? "" : String(children);
|
|
1063
|
-
continue;
|
|
1064
|
-
}
|
|
1065
|
-
for (let i = 0; i < winner.tags.length; i++) {
|
|
1066
|
-
const t = winner.tags[i];
|
|
1067
|
-
const markup = renderHeadTagMarkup(t.tag, t.props, identity, nonce);
|
|
1068
|
-
if (identity === "charset" || identity === "base") prelude += markup;else if (t.tag === "link" || t.tag === "style") links += markup;else if (t.tag === "meta") metas += markup;else if (t.tag === "script") scripts += markup;else others += markup;
|
|
1069
|
-
}
|
|
1070
|
-
}
|
|
1071
|
-
return {
|
|
1072
|
-
prelude,
|
|
1073
|
-
html: registry.eagerHtml + links + metas + others + scripts,
|
|
1074
|
-
title,
|
|
1075
|
-
noScripts
|
|
1076
|
-
};
|
|
1077
|
-
}
|
|
1078
|
-
function flushHeadFragment(registry, boundary, nonce) {
|
|
1079
|
-
const groups = commitHeadBoundary(registry, boundary);
|
|
1080
|
-
if (!groups.length) return null;
|
|
1081
|
-
const winners = resolveHead(registry.committed);
|
|
1082
|
-
const affected = new Set();
|
|
1083
|
-
for (let i = 0; i < groups.length; i++) for (let j = 0; j < groups[i].tags.length; j++) affected.add(groups[i].tags[j].identity);
|
|
1084
|
-
const ops = [];
|
|
1085
|
-
for (const identity of affected) {
|
|
1086
|
-
const winner = winners.get(identity);
|
|
1087
|
-
const sig = headGroupSignature(winner);
|
|
1088
|
-
if (registry.flushed.get(identity) === sig) continue;
|
|
1089
|
-
const existed = registry.flushed.has(identity);
|
|
1090
|
-
registry.flushed.set(identity, sig);
|
|
1091
|
-
if (identity === "title") {
|
|
1092
|
-
const children = winner.tags[0].props.children;
|
|
1093
|
-
ops.push(["t", children == null ? "" : String(children)]);
|
|
1094
|
-
continue;
|
|
1095
|
-
}
|
|
1096
|
-
if (existed) ops.push(["r", identity]);
|
|
1097
|
-
for (let i = 0; i < winner.tags.length; i++) {
|
|
1098
|
-
const t = winner.tags[i];
|
|
1099
|
-
const attrs = {};
|
|
1100
|
-
for (const name in t.props) {
|
|
1101
|
-
if (name === "children" || name === "ref" || name.slice(0, 2) === "on") continue;
|
|
1102
|
-
if (!HEAD_ATTR_NAME.test(name)) {
|
|
1103
|
-
console.warn(`useHead: ignoring invalid attribute name "${name}"`);
|
|
1104
|
-
continue;
|
|
1105
|
-
}
|
|
1106
|
-
const v = t.props[name];
|
|
1107
|
-
if (v == null || v === false) continue;
|
|
1108
|
-
attrs[name] = v === true ? "" : String(v);
|
|
1109
|
-
}
|
|
1110
|
-
if (nonce && !hasNonceProp(t.props)) {
|
|
1111
|
-
const destination = nonceDestination(t.tag, t.props);
|
|
1112
|
-
const value = destination && nonce[destination];
|
|
1113
|
-
if (value) attrs.nonce = String(value);
|
|
1114
|
-
}
|
|
1115
|
-
const children = t.props.children;
|
|
1116
|
-
ops.push(["a", identity, t.tag, attrs, children == null ? null : String(children)]);
|
|
1117
|
-
}
|
|
1118
|
-
}
|
|
1119
|
-
return ops.length ? ops : null;
|
|
1120
|
-
}
|
|
1121
|
-
function normalizeNonce(nonce) {
|
|
1122
|
-
if (nonce == null) return undefined;
|
|
1123
|
-
if (typeof nonce === "string") {
|
|
1124
|
-
const attr = nonce ? ` nonce="${escape(nonce, true)}"` : "";
|
|
1125
|
-
return {
|
|
1126
|
-
script: nonce,
|
|
1127
|
-
style: nonce,
|
|
1128
|
-
scriptAttr: attr,
|
|
1129
|
-
styleAttr: attr
|
|
1130
|
-
};
|
|
1131
|
-
}
|
|
1132
|
-
const script = nonce.script;
|
|
1133
|
-
const style = nonce.style;
|
|
1134
|
-
if (!script && !style) return undefined;
|
|
1135
|
-
return {
|
|
1136
|
-
script,
|
|
1137
|
-
style,
|
|
1138
|
-
scriptAttr: typeof script === "string" && script ? ` nonce="${escape(script, true)}"` : "",
|
|
1139
|
-
styleAttr: typeof style === "string" && style ? ` nonce="${escape(style, true)}"` : ""
|
|
1140
|
-
};
|
|
1141
|
-
}
|
|
1142
|
-
function destinationNonce(nonce, destination) {
|
|
1143
|
-
if (nonce == null) return undefined;
|
|
1144
|
-
if (typeof nonce === "string") return nonce || undefined;
|
|
1145
|
-
const value = nonce[destination];
|
|
1146
|
-
return typeof value === "string" && value ? value : undefined;
|
|
1147
|
-
}
|
|
1148
|
-
function scriptNonce(nonce) {
|
|
1149
|
-
return destinationNonce(nonce, "script");
|
|
1150
|
-
}
|
|
1151
|
-
function styleNonce(nonce) {
|
|
1152
|
-
return destinationNonce(nonce, "style");
|
|
1153
|
-
}
|
|
1154
|
-
function hasNonceProp(props) {
|
|
1155
|
-
for (const name in props) if (name.length === 5 && asciiLowerCase(name) === "nonce" && props[name] != null) return true;
|
|
1156
|
-
return false;
|
|
1157
|
-
}
|
|
1158
|
-
function nonceDestination(tag, props) {
|
|
1159
|
-
if (tag === "script") return "script";
|
|
1160
|
-
if (tag === "style") return "style";
|
|
1161
|
-
if (tag !== "link") return null;
|
|
1162
|
-
const rel = props.rel;
|
|
1163
|
-
if (typeof rel !== "string") return null;
|
|
1164
|
-
const rels = asciiLowerCase(rel).split(/[\t\n\f\r ]+/);
|
|
1165
|
-
if (rels.includes("stylesheet")) return "style";
|
|
1166
|
-
const isModulePreload = rels.includes("modulepreload");
|
|
1167
|
-
if (!isModulePreload && !rels.includes("preload")) return null;
|
|
1168
|
-
const as = typeof props.as === "string" ? asciiLowerCase(props.as) : "";
|
|
1169
|
-
if (as === "style") return "style";
|
|
1170
|
-
if (as === "script") return "script";
|
|
1171
|
-
if (!isModulePreload) return null;
|
|
1172
|
-
switch (as) {
|
|
1173
|
-
case "fetch":
|
|
1174
|
-
case "font":
|
|
1175
|
-
case "image":
|
|
1176
|
-
case "json":
|
|
1177
|
-
case "text":
|
|
1178
|
-
case "track":
|
|
1179
|
-
return null;
|
|
1180
|
-
default:
|
|
1181
|
-
return "script";
|
|
1182
|
-
}
|
|
1183
|
-
}
|
|
1184
|
-
function nonceAttr(nonce, destination) {
|
|
1185
|
-
if (!nonce || !destination) return "";
|
|
1186
|
-
return destination === "script" ? nonce.scriptAttr : nonce.styleAttr;
|
|
1187
|
-
}
|
|
1188
|
-
function renderHeadAttrHtml(props) {
|
|
1189
|
-
let attrs = "";
|
|
1190
|
-
for (const name in props) {
|
|
1191
|
-
if (name === "children" || name === "ref" || name.slice(0, 2) === "on") continue;
|
|
1192
|
-
if (!HEAD_ATTR_NAME.test(name)) {
|
|
1193
|
-
console.warn(`useHead: ignoring invalid attribute name "${name}"`);
|
|
1194
|
-
continue;
|
|
1195
|
-
}
|
|
1196
|
-
const v = props[name];
|
|
1197
|
-
if (v == null || v === false) continue;
|
|
1198
|
-
attrs += v === true ? ` ${name}` : ` ${name}="${escape(String(v), true)}"`;
|
|
1199
|
-
}
|
|
1200
|
-
return attrs;
|
|
1201
|
-
}
|
|
1202
|
-
function headAttrRecord(props, skipRelHref) {
|
|
1203
|
-
let attrs = null;
|
|
1204
|
-
for (const name in props) {
|
|
1205
|
-
if (name === "children" || name === "ref" || name.slice(0, 2) === "on") continue;
|
|
1206
|
-
if ((name === "rel" || name === "href")) continue;
|
|
1207
|
-
if (!HEAD_ATTR_NAME.test(name)) continue;
|
|
1208
|
-
const v = props[name];
|
|
1209
|
-
if (v == null || v === false) continue;
|
|
1210
|
-
(attrs || (attrs = {}))[name] = v === true ? "" : String(v);
|
|
1211
|
-
}
|
|
1212
|
-
return attrs;
|
|
1213
|
-
}
|
|
1214
|
-
function renderHeadTagMarkup(tag, props, identity, nonce) {
|
|
1215
|
-
let attrs = renderHeadAttrHtml(props);
|
|
1216
|
-
if (identity != null) attrs += ` data-dh="${escape(identity, true)}"`;
|
|
1217
|
-
if (nonce && !hasNonceProp(props)) attrs += nonceAttr(nonce, nonceDestination(tag, props));
|
|
1218
|
-
if (tag === "meta" || tag === "link" || tag === "base") return `<${tag}${attrs}>`;
|
|
1219
|
-
let body = props.children == null ? "" : String(props.children);
|
|
1220
|
-
if (tag === "script") body = body.replace(/<\/(script)/gi, "<\\/$1");else if (tag === "style") body = escapeStyleContent(body);else body = escape(body);
|
|
1221
|
-
return `<${tag}${attrs}>${body}</${tag}>`;
|
|
1222
|
-
}
|
|
1223
|
-
function useHead(tags) {
|
|
1224
|
-
const ctx = solidJs.sharedConfig.context;
|
|
1225
|
-
if (!ctx || !ctx.registerHeadTags) {
|
|
1226
|
-
console.warn("useHead() called outside of a server render; registration ignored.");
|
|
1227
|
-
return;
|
|
1228
|
-
}
|
|
1229
|
-
ctx.registerHeadTags(tags);
|
|
1230
|
-
}
|
|
1231
|
-
const VOID_ELEMENTS = /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
|
|
1232
|
-
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,o.replaceWith(n.content),n.remove(),(_$HY.v=_$HY.v||{})[e]=1,_$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])}`;
|
|
1233
|
-
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)}`;
|
|
1234
|
-
function renderToString(code, options = {}) {
|
|
1235
|
-
const {
|
|
1236
|
-
renderId = "",
|
|
1237
|
-
noScripts,
|
|
1238
|
-
manifest,
|
|
1239
|
-
onHead
|
|
1240
|
-
} = options;
|
|
1241
|
-
const nonce = normalizeNonce(options.nonce);
|
|
1242
|
-
let scripts = "";
|
|
1243
|
-
const serializer = createHydrationSerializer({
|
|
1244
|
-
scopeId: renderId,
|
|
1245
|
-
plugins: options.plugins,
|
|
1246
|
-
onData(script) {
|
|
1247
|
-
if (noScripts) return;
|
|
1248
|
-
if (!scripts) {
|
|
1249
|
-
scripts = getLocalHeaderScript(renderId);
|
|
1250
|
-
}
|
|
1251
|
-
scripts += script + ";";
|
|
1252
|
-
},
|
|
1253
|
-
onError: options.onError
|
|
1254
|
-
});
|
|
1255
|
-
const tracking = createAssetTracking();
|
|
1256
|
-
const headRegistry = createHeadRegistry();
|
|
1257
|
-
solidJs.sharedConfig.context = {
|
|
1258
|
-
nonce: options.nonce,
|
|
1259
|
-
escape: escape,
|
|
1260
|
-
resolve: resolveSSRNode,
|
|
1261
|
-
ssr: ssr,
|
|
1262
|
-
registerHeadTags(tags) {
|
|
1263
|
-
registerHeadTags(headRegistry, solidJs.sharedConfig.context, tracking, null, nonce, tags);
|
|
1264
|
-
},
|
|
1265
|
-
serialize(id, p) {
|
|
1266
|
-
if (solidJs.sharedConfig.context.noHydrate) return;
|
|
1267
|
-
if (p != null && typeof p === "object" && (typeof p.then === "function" || typeof p[Symbol.asyncIterator] === "function")) {
|
|
1268
|
-
throw new Error("Cannot serialize async value in renderToString (id: " + id + "). " + "Use renderToStream for async data.");
|
|
1269
|
-
}
|
|
1270
|
-
serializer.write(id, p);
|
|
1271
|
-
},
|
|
1272
|
-
registerAsset(type, value) {
|
|
1273
|
-
if (type === "preload") {
|
|
1274
|
-
registerPreloadLink(tracking, headRegistry, value, nonce);
|
|
1275
|
-
return;
|
|
1276
|
-
}
|
|
1277
|
-
if (type === "inline-style") {
|
|
1278
|
-
tracking.registerInlineStyle(value);
|
|
1279
|
-
return;
|
|
1280
|
-
}
|
|
1281
|
-
if (tracking.currentBoundaryId && type === "style") {
|
|
1282
|
-
let styles = tracking.boundaryStyles.get(tracking.currentBoundaryId);
|
|
1283
|
-
if (!styles) {
|
|
1284
|
-
styles = new Set();
|
|
1285
|
-
tracking.boundaryStyles.set(tracking.currentBoundaryId, styles);
|
|
1286
|
-
}
|
|
1287
|
-
styles.add(value);
|
|
1288
|
-
}
|
|
1289
|
-
tracking.emittedAssets.add(value);
|
|
1290
|
-
}
|
|
1291
|
-
};
|
|
1292
|
-
applyAssetTracking(solidJs.sharedConfig.context, tracking, manifest, noScripts);
|
|
1293
|
-
registerEntryAssets(manifest);
|
|
1294
|
-
let html = solidJs.createRoot(d => {
|
|
1295
|
-
setTimeout(d);
|
|
1296
|
-
return resolveSSRSync(escape(code()));
|
|
1297
|
-
}, {
|
|
1298
|
-
id: renderId
|
|
1299
|
-
});
|
|
1300
|
-
serializeFragmentAssets("", tracking.boundaryModules, solidJs.sharedConfig.context, renderId);
|
|
1301
|
-
solidJs.sharedConfig.context.noHydrate = true;
|
|
1302
|
-
serializer.close();
|
|
1303
|
-
const head = renderShellHead(headRegistry, nonce, null, noScripts);
|
|
1304
|
-
return assembleDocument(resolveSSRSelectValues(html), tracking.emittedAssets, tracking.preloadLinks, tracking.inlineStyles, scripts.length ? scripts : "", nonce, head, onHead);
|
|
1305
|
-
}
|
|
1306
|
-
function renderToStream(code, options = {}) {
|
|
1307
|
-
let {
|
|
1308
|
-
onCompleteShell,
|
|
1309
|
-
onCompleteAll,
|
|
1310
|
-
renderId = "",
|
|
1311
|
-
noScripts,
|
|
1312
|
-
manifest,
|
|
1313
|
-
onHead
|
|
1314
|
-
} = options;
|
|
1315
|
-
const nonce = normalizeNonce(options.nonce);
|
|
1316
|
-
const requestEvent = peekRequestEvent();
|
|
1317
|
-
let dispose;
|
|
1318
|
-
let dead = false;
|
|
1319
|
-
const abandon = () => {
|
|
1320
|
-
if (dead) return;
|
|
1321
|
-
dead = true;
|
|
1322
|
-
completed = true;
|
|
1323
|
-
buffer = {
|
|
1324
|
-
write() {}
|
|
1325
|
-
};
|
|
1326
|
-
writable = {
|
|
1327
|
-
end() {}
|
|
1328
|
-
};
|
|
1329
|
-
if (dispose) {
|
|
1330
|
-
const d = dispose;
|
|
1331
|
-
dispose = () => {};
|
|
1332
|
-
d();
|
|
1333
|
-
}
|
|
1334
|
-
};
|
|
1335
|
-
const failRender = err => {
|
|
1336
|
-
try {
|
|
1337
|
-
options.onError ? options.onError(err) : console.error(err);
|
|
1338
|
-
} catch (_) {}
|
|
1339
|
-
abandon();
|
|
1340
|
-
};
|
|
1341
|
-
const coalesceWrites = (writeRaw, endRaw) => {
|
|
1342
|
-
let buf = "";
|
|
1343
|
-
let scheduled = false;
|
|
1344
|
-
const flush = () => {
|
|
1345
|
-
scheduled = false;
|
|
1346
|
-
if (!buf) return;
|
|
1347
|
-
const out = buf;
|
|
1348
|
-
buf = "";
|
|
1349
|
-
writeRaw(out);
|
|
1350
|
-
};
|
|
1351
|
-
return {
|
|
1352
|
-
write(payload) {
|
|
1353
|
-
buf += payload;
|
|
1354
|
-
if (buf.length >= 16384) return flush();
|
|
1355
|
-
if (!scheduled) {
|
|
1356
|
-
scheduled = true;
|
|
1357
|
-
deferFlush(flush);
|
|
1358
|
-
}
|
|
1359
|
-
},
|
|
1360
|
-
flush,
|
|
1361
|
-
end() {
|
|
1362
|
-
flush();
|
|
1363
|
-
endRaw();
|
|
1364
|
-
}
|
|
1365
|
-
};
|
|
1366
|
-
};
|
|
1367
|
-
const guardSink = w => ({
|
|
1368
|
-
write(payload) {
|
|
1369
|
-
if (dead) return;
|
|
1370
|
-
try {
|
|
1371
|
-
w.write(payload);
|
|
1372
|
-
} catch (_) {
|
|
1373
|
-
abandon();
|
|
1374
|
-
}
|
|
1375
|
-
},
|
|
1376
|
-
end() {
|
|
1377
|
-
if (dead) return;
|
|
1378
|
-
try {
|
|
1379
|
-
w.end();
|
|
1380
|
-
} catch (_) {
|
|
1381
|
-
abandon();
|
|
1382
|
-
}
|
|
1383
|
-
}
|
|
1384
|
-
});
|
|
1385
|
-
const blockingPromises = new Set();
|
|
1386
|
-
const canBatchStubs = !options.serializer && !options.sink;
|
|
1387
|
-
let stubBatch = null;
|
|
1388
|
-
const STUB_BATCH_KEY = "$B";
|
|
1389
|
-
const flushStubBatch = () => {
|
|
1390
|
-
if (!stubBatch) return;
|
|
1391
|
-
const batch = stubBatch;
|
|
1392
|
-
stubBatch = null;
|
|
1393
|
-
if (batch.size === 1) {
|
|
1394
|
-
const [id, p] = batch.entries().next().value;
|
|
1395
|
-
serializer.write(id, p);
|
|
1396
|
-
return;
|
|
1397
|
-
}
|
|
1398
|
-
const obj = {};
|
|
1399
|
-
for (const [id, p] of batch) obj[id] = p;
|
|
1400
|
-
serializer.write(STUB_BATCH_KEY, obj);
|
|
1401
|
-
pushTask(`(b=>{for(var k in b)_$HY.r[k]=b[k];delete _$HY.r["${STUB_BATCH_KEY}"]})(_$HY.r["${STUB_BATCH_KEY}"])`);
|
|
1402
|
-
};
|
|
1403
|
-
let headerEmitted = false;
|
|
1404
|
-
const pushTask = task => {
|
|
1405
|
-
if (noScripts) return;
|
|
1406
|
-
if (!headerEmitted) {
|
|
1407
|
-
headerEmitted = true;
|
|
1408
|
-
tasks += getLocalHeaderScript(renderId);
|
|
1409
|
-
}
|
|
1410
|
-
tasks += task + ";";
|
|
1411
|
-
if (!timer && firstFlushed) {
|
|
1412
|
-
timer = true;
|
|
1413
|
-
queue(() => queue(writeTasks));
|
|
1414
|
-
}
|
|
1415
|
-
};
|
|
1416
|
-
const onDone = () => {
|
|
1417
|
-
writeTasks();
|
|
1418
|
-
lastBlockingSize = blockingPromises.size;
|
|
1419
|
-
doShell();
|
|
1420
|
-
onCompleteAll && onCompleteAll({
|
|
1421
|
-
write(v) {
|
|
1422
|
-
!completed && buffer.write(v);
|
|
1423
|
-
}
|
|
1424
|
-
});
|
|
1425
|
-
writable && writable.end();
|
|
1426
|
-
completed = true;
|
|
1427
|
-
if (firstFlushed) dispose();
|
|
1428
|
-
};
|
|
1429
|
-
const sink = {
|
|
1430
|
-
data(payload) {
|
|
1431
|
-
pushTask(payload);
|
|
1432
|
-
},
|
|
1433
|
-
fragment(key, value, meta) {
|
|
1434
|
-
const deferActivation = !!meta.revealGroup;
|
|
1435
|
-
const styles = meta.styles;
|
|
1436
|
-
for (let i = 0; i < styles.inline.length; i++) {
|
|
1437
|
-
buffer.write(renderInlineStyle(styles.inline[i], nonce));
|
|
1438
|
-
}
|
|
1439
|
-
if (styles.links.length) {
|
|
1440
|
-
const styleAttr = nonceAttr(nonce, "style");
|
|
1441
|
-
emitTask(`$dfs("${key}",${styles.links.length},${deferActivation ? 1 : 0})`);
|
|
1442
|
-
writeTasks();
|
|
1443
|
-
for (const entry of styles.links) {
|
|
1444
|
-
buffer.write(typeof entry === "string" ? `<link rel="stylesheet" href="${entry}"${styleAttr} onload="$dfc('${key}')" onerror="$dfc('${key}')">` : `<link${entry.attrHtml}${styleAttr} onload="$dfc('${key}')" onerror="$dfc('${key}')">`);
|
|
1445
|
-
}
|
|
1446
|
-
buffer.write(`<template id="${key}">${value}</template>`);
|
|
1447
|
-
} else {
|
|
1448
|
-
buffer.write(`<template id="${key}">${value}</template>`);
|
|
1449
|
-
if (!deferActivation) {
|
|
1450
|
-
emitTask(`$df("${key}")`);
|
|
1451
|
-
}
|
|
1452
|
-
}
|
|
1453
|
-
},
|
|
1454
|
-
reveal(keys, meta) {
|
|
1455
|
-
emitTask(`${meta.fallback ? "$dflj" : "$dfj"}(${JSON.stringify(keys)})`);
|
|
1456
|
-
},
|
|
1457
|
-
asset(type, value) {
|
|
1458
|
-
if (type === "module") {
|
|
1459
|
-
buffer.write(`<link rel="modulepreload" href="${value}"${nonceAttr(nonce, "script")}>`);
|
|
1460
|
-
} else if (type === "preload") {
|
|
1461
|
-
buffer.write(`<link${value.attrHtml}>`);
|
|
1462
|
-
} else if (type === "inline-style") {
|
|
1463
|
-
buffer.write(renderInlineStyle(value, nonce));
|
|
1464
|
-
} else if (type === "head-tag") {
|
|
1465
|
-
buffer.write(value);
|
|
1466
|
-
}
|
|
1467
|
-
},
|
|
1468
|
-
shell(shellHtml, meta) {
|
|
1469
|
-
buffer.write(assembleDocument(shellHtml, meta.preloads, meta.preloadLinks, meta.inlineStyles, meta.tasks.length ? meta.tasks : "", nonce, meta.head, onHead));
|
|
1470
|
-
},
|
|
1471
|
-
...options.sink
|
|
1472
|
-
};
|
|
1473
|
-
const serializer = (options.serializer || createHydrationSerializer)({
|
|
1474
|
-
scopeId: options.renderId,
|
|
1475
|
-
plugins: options.plugins,
|
|
1476
|
-
onData: payload => sink.data(payload),
|
|
1477
|
-
onDone,
|
|
1478
|
-
onError: options.onError
|
|
1479
|
-
});
|
|
1480
|
-
let rootAssetsSerialized = false;
|
|
1481
|
-
const serializeRootAssets = () => {
|
|
1482
|
-
if (rootAssetsSerialized) return;
|
|
1483
|
-
rootAssetsSerialized = true;
|
|
1484
|
-
serializeFragmentAssets("", tracking.boundaryModules, context, renderId);
|
|
1485
|
-
};
|
|
1486
|
-
let holds = 0;
|
|
1487
|
-
const flushEnd = () => {
|
|
1488
|
-
if (!registry.size && !holds) {
|
|
1489
|
-
serializeRootAssets();
|
|
1490
|
-
queue(() => queue(() => {
|
|
1491
|
-
if (context.live.end) {
|
|
1492
|
-
const end = context.live.end;
|
|
1493
|
-
context.live.end = null;
|
|
1494
|
-
end();
|
|
1495
|
-
}
|
|
1496
|
-
flushStubBatch();
|
|
1497
|
-
serializer.flush();
|
|
1498
|
-
}));
|
|
1499
|
-
}
|
|
1500
|
-
};
|
|
1501
|
-
const registry = new Map();
|
|
1502
|
-
const pendingSerialized = new Map();
|
|
1503
|
-
const trackSerialized = (id, p) => {
|
|
1504
|
-
let settle;
|
|
1505
|
-
const raced = Promise.race([p, new Promise(r => settle = r)]);
|
|
1506
|
-
pendingSerialized.set(id, settle);
|
|
1507
|
-
const drop = () => pendingSerialized.delete(id);
|
|
1508
|
-
p.then(drop, drop);
|
|
1509
|
-
return raced;
|
|
1510
|
-
};
|
|
1511
|
-
const abandonSubtree = key => {
|
|
1512
|
-
for (const [k, entry] of registry) {
|
|
1513
|
-
if (k.length > key.length && k.startsWith(key)) {
|
|
1514
|
-
registry.delete(k);
|
|
1515
|
-
entry.resolve();
|
|
1516
|
-
}
|
|
1517
|
-
}
|
|
1518
|
-
for (const [id, settle] of pendingSerialized) {
|
|
1519
|
-
if (id.startsWith(key)) {
|
|
1520
|
-
pendingSerialized.delete(id);
|
|
1521
|
-
settle();
|
|
1522
|
-
}
|
|
1523
|
-
}
|
|
1524
|
-
};
|
|
1525
|
-
const writeTasks = () => {
|
|
1526
|
-
if (tasks.length && !completed && firstFlushed) {
|
|
1527
|
-
buffer.write(`<script${nonceAttr(nonce, "script")}>${tasks}</script>`);
|
|
1528
|
-
tasks = "";
|
|
1529
|
-
}
|
|
1530
|
-
timer = null;
|
|
1531
|
-
};
|
|
1532
|
-
let context;
|
|
1533
|
-
let writable;
|
|
1534
|
-
let tmp = "";
|
|
1535
|
-
let tasks = "";
|
|
1536
|
-
let firstFlushed = false;
|
|
1537
|
-
let completed = false;
|
|
1538
|
-
let shellCompleted = false;
|
|
1539
|
-
let scriptFlushed = false;
|
|
1540
|
-
let headStyles;
|
|
1541
|
-
const revealGroups = new Map();
|
|
1542
|
-
let timer = null;
|
|
1543
|
-
const emitTask = task => {
|
|
1544
|
-
pushTask(`${task}${!scriptFlushed ? ";" + REPLACE_SCRIPT : ""}`);
|
|
1545
|
-
scriptFlushed = true;
|
|
1546
|
-
};
|
|
1547
|
-
function resolveRevealKeys(groupOrKeys, release, consume) {
|
|
1548
|
-
if (Array.isArray(groupOrKeys)) return groupOrKeys.slice();
|
|
1549
|
-
let group = revealGroups.get(groupOrKeys);
|
|
1550
|
-
if (!group) {
|
|
1551
|
-
if (!release) return;
|
|
1552
|
-
group = {
|
|
1553
|
-
order: [],
|
|
1554
|
-
keys: new Set(),
|
|
1555
|
-
released: true
|
|
1556
|
-
};
|
|
1557
|
-
revealGroups.set(groupOrKeys, group);
|
|
1558
|
-
} else if (release) group.released = true;
|
|
1559
|
-
if (!group.order.length) return;
|
|
1560
|
-
const keys = group.order.slice();
|
|
1561
|
-
if (consume) revealGroups.delete(groupOrKeys);
|
|
1562
|
-
return keys;
|
|
1563
|
-
}
|
|
1564
|
-
let rootHoles = null;
|
|
1565
|
-
let nextHoleId = 0;
|
|
1566
|
-
let buffer = {
|
|
1567
|
-
write(payload) {
|
|
1568
|
-
tmp += payload;
|
|
1569
|
-
}
|
|
1570
|
-
};
|
|
1571
|
-
const tracking = createAssetTracking();
|
|
1572
|
-
const headRegistry = createHeadRegistry();
|
|
1573
|
-
let headScriptFlushed = false;
|
|
1574
|
-
const emitHeadOps = (key, ops) => {
|
|
1575
|
-
const payload = JSON.stringify(ops).replace(/</g, "\\u003C");
|
|
1576
|
-
emitTask(`${!headScriptFlushed ? HEAD_SCRIPT : ""}(_$HY.hp=_$HY.hp||{})[${JSON.stringify(key)}]=${payload}`);
|
|
1577
|
-
headScriptFlushed = true;
|
|
1578
|
-
};
|
|
1579
|
-
solidJs.sharedConfig.context = context = {
|
|
1580
|
-
async: true,
|
|
1581
|
-
nonce: options.nonce,
|
|
1582
|
-
live: {},
|
|
1583
|
-
registerHeadTags(tags) {
|
|
1584
|
-
registerHeadTags(headRegistry, context, tracking,
|
|
1585
|
-
(markup, gateEntry) => {
|
|
1586
|
-
if (!firstFlushed) {
|
|
1587
|
-
headRegistry.eagerHtml += markup;
|
|
1588
|
-
if (gateEntry) gateEntry.emitted = true;
|
|
1589
|
-
} else if (!gateEntry || !tracking.currentBoundaryId) {
|
|
1590
|
-
sink.asset("head-tag", markup);
|
|
1591
|
-
}
|
|
1592
|
-
}, nonce, tags);
|
|
1593
|
-
},
|
|
1594
|
-
registerAsset(type, value) {
|
|
1595
|
-
if (type === "preload") {
|
|
1596
|
-
const entry = registerPreloadLink(tracking, headRegistry, value, nonce);
|
|
1597
|
-
if (entry && firstFlushed) sink.asset("preload", entry);
|
|
1598
|
-
return;
|
|
1599
|
-
}
|
|
1600
|
-
if (type === "inline-style") {
|
|
1601
|
-
const entry = tracking.registerInlineStyle(value);
|
|
1602
|
-
if (firstFlushed && !tracking.currentBoundaryId && !entry.emitted) {
|
|
1603
|
-
entry.emitted = true;
|
|
1604
|
-
sink.asset("inline-style", entry);
|
|
1605
|
-
}
|
|
1606
|
-
return;
|
|
1607
|
-
}
|
|
1608
|
-
if (tracking.currentBoundaryId && type === "style") {
|
|
1609
|
-
let styles = tracking.boundaryStyles.get(tracking.currentBoundaryId);
|
|
1610
|
-
if (!styles) {
|
|
1611
|
-
styles = new Set();
|
|
1612
|
-
tracking.boundaryStyles.set(tracking.currentBoundaryId, styles);
|
|
1613
|
-
}
|
|
1614
|
-
styles.add(value);
|
|
1615
|
-
}
|
|
1616
|
-
if (!tracking.emittedAssets.has(value)) {
|
|
1617
|
-
tracking.emittedAssets.add(value);
|
|
1618
|
-
if (firstFlushed) sink.asset(type, value);
|
|
1619
|
-
}
|
|
1620
|
-
},
|
|
1621
|
-
block(p) {
|
|
1622
|
-
if (!firstFlushed) blockingPromises.add(p);
|
|
1623
|
-
},
|
|
1624
|
-
hold() {
|
|
1625
|
-
holds++;
|
|
1626
|
-
let released = false;
|
|
1627
|
-
return () => {
|
|
1628
|
-
if (released) return;
|
|
1629
|
-
released = true;
|
|
1630
|
-
holds--;
|
|
1631
|
-
if (!holds) queue(flushEnd);
|
|
1632
|
-
};
|
|
1633
|
-
},
|
|
1634
|
-
replace(id, payloadFn) {
|
|
1635
|
-
if (firstFlushed) return;
|
|
1636
|
-
const placeholder = `<!--!$${id}-->`;
|
|
1637
|
-
const first = html.indexOf(placeholder);
|
|
1638
|
-
if (first === -1) return;
|
|
1639
|
-
const last = html.indexOf(`<!--!$/${id}-->`, first + placeholder.length);
|
|
1640
|
-
html = html.slice(0, first) + resolveSSRSync(escape(payloadFn())) + html.slice(last + placeholder.length + 1);
|
|
1641
|
-
},
|
|
1642
|
-
serialize(id, p, deferStream) {
|
|
1643
|
-
if (solidJs.sharedConfig.context.noHydrate) return;
|
|
1644
|
-
if (p && typeof p === "object" && typeof p.then === "function") {
|
|
1645
|
-
if (!firstFlushed && deferStream) {
|
|
1646
|
-
blockingPromises.add(p);
|
|
1647
|
-
p.then(d => serializer.write(id, d)).catch(e => serializer.write(id, e));
|
|
1648
|
-
return;
|
|
1649
|
-
}
|
|
1650
|
-
p = trackSerialized(id, p);
|
|
1651
|
-
if (!firstFlushed && canBatchStubs && !shellCompleted) {
|
|
1652
|
-
(stubBatch ||= new Map()).set(id, p);
|
|
1653
|
-
return;
|
|
1654
|
-
}
|
|
1655
|
-
}
|
|
1656
|
-
serializer.write(id, p);
|
|
1657
|
-
},
|
|
1658
|
-
escape: escape,
|
|
1659
|
-
resolve: resolveSSRNode,
|
|
1660
|
-
ssr: ssr,
|
|
1661
|
-
registerFragment(key, options) {
|
|
1662
|
-
const revealGroup = options && options.revealGroup;
|
|
1663
|
-
if (revealGroup) {
|
|
1664
|
-
let group = revealGroups.get(revealGroup);
|
|
1665
|
-
if (!group) {
|
|
1666
|
-
group = {
|
|
1667
|
-
order: [],
|
|
1668
|
-
keys: new Set(),
|
|
1669
|
-
released: false
|
|
1670
|
-
};
|
|
1671
|
-
revealGroups.set(revealGroup, group);
|
|
1672
|
-
}
|
|
1673
|
-
if (!group.keys.has(key)) {
|
|
1674
|
-
group.keys.add(key);
|
|
1675
|
-
group.order.push(key);
|
|
1676
|
-
}
|
|
1677
|
-
if (group.released) {
|
|
1678
|
-
throw new Error("registerFragment() for reveal group '" + revealGroup + "' was called after revealFragments(). Ensure template payload is emitted before grouped reveal.");
|
|
1679
|
-
}
|
|
1680
|
-
}
|
|
1681
|
-
if (!registry.has(key)) {
|
|
1682
|
-
let resolve, reject;
|
|
1683
|
-
const p = new Promise((r, rej) => (resolve = r, reject = rej));
|
|
1684
|
-
registry.set(key, {
|
|
1685
|
-
resolve: err => queue(() => queue(() => {
|
|
1686
|
-
err ? reject(err) : resolve(true);
|
|
1687
|
-
queue(flushEnd);
|
|
1688
|
-
}))
|
|
1689
|
-
});
|
|
1690
|
-
if (canBatchStubs && !shellCompleted) (stubBatch ||= new Map()).set(key + "_fr", p);else serializer.write(key + "_fr", p);
|
|
1691
|
-
}
|
|
1692
|
-
return (value, error) => {
|
|
1693
|
-
if (registry.has(key)) {
|
|
1694
|
-
const item = registry.get(key);
|
|
1695
|
-
registry.delete(key);
|
|
1696
|
-
if (error) abandonSubtree(key);
|
|
1697
|
-
if (item.children) {
|
|
1698
|
-
for (const k in item.children) {
|
|
1699
|
-
value = replacePlaceholder(value, k, item.children[k]);
|
|
1700
|
-
}
|
|
1701
|
-
}
|
|
1702
|
-
const parentKey = waitForFragments(registry, key);
|
|
1703
|
-
if (parentKey) {
|
|
1704
|
-
const parent = registry.get(parentKey);
|
|
1705
|
-
parent.children ||= {};
|
|
1706
|
-
parent.children[key] = value !== undefined ? value : "";
|
|
1707
|
-
serializeFragmentAssets(key, tracking.boundaryModules, context);
|
|
1708
|
-
propagateBoundaryStyles(key, parentKey, tracking);
|
|
1709
|
-
adoptHeadBoundary(headRegistry, key, parentKey);
|
|
1710
|
-
item.resolve();
|
|
1711
|
-
return;
|
|
1712
|
-
}
|
|
1713
|
-
if (!completed) {
|
|
1714
|
-
if (error) dropHeadBoundary(headRegistry, key);
|
|
1715
|
-
if (!firstFlushed) {
|
|
1716
|
-
queue(() => html = replacePlaceholder(html, key, value !== undefined ? value : ""));
|
|
1717
|
-
serializeFragmentAssets(key, tracking.boundaryModules, context);
|
|
1718
|
-
item.resolve(error);
|
|
1719
|
-
} else {
|
|
1720
|
-
serializeFragmentAssets(key, tracking.boundaryModules, context);
|
|
1721
|
-
const styles = collectStreamStyles(key, tracking, headStyles);
|
|
1722
|
-
const headOps = error ? null : flushHeadFragment(headRegistry, key, nonce);
|
|
1723
|
-
if (headOps) emitHeadOps(key, headOps);
|
|
1724
|
-
sink.fragment(key, resolveSSRSelectValues(value !== undefined ? value : " "), {
|
|
1725
|
-
styles,
|
|
1726
|
-
revealGroup,
|
|
1727
|
-
error
|
|
1728
|
-
});
|
|
1729
|
-
item.resolve(error);
|
|
1730
|
-
}
|
|
1731
|
-
}
|
|
1732
|
-
}
|
|
1733
|
-
return firstFlushed;
|
|
1734
|
-
};
|
|
1735
|
-
},
|
|
1736
|
-
revealFragments(groupOrKeys) {
|
|
1737
|
-
const keys = resolveRevealKeys(groupOrKeys, true, true);
|
|
1738
|
-
if (!keys) return;
|
|
1739
|
-
sink.reveal(keys, {
|
|
1740
|
-
fallback: false
|
|
1741
|
-
});
|
|
1742
|
-
},
|
|
1743
|
-
revealFallbacks(groupOrKeys) {
|
|
1744
|
-
const keys = resolveRevealKeys(groupOrKeys, false, false);
|
|
1745
|
-
if (!keys) return;
|
|
1746
|
-
sink.reveal(keys, {
|
|
1747
|
-
fallback: true
|
|
1748
|
-
});
|
|
1749
|
-
}
|
|
1750
|
-
};
|
|
1751
|
-
applyAssetTracking(context, tracking, manifest, noScripts);
|
|
1752
|
-
context.failRender = failRender;
|
|
1753
|
-
registerEntryAssets(manifest);
|
|
1754
|
-
let html = solidJs.createRoot(d => {
|
|
1755
|
-
dispose = d;
|
|
1756
|
-
const res = resolveSSRNode(escape(code()));
|
|
1757
|
-
if (!res.h.length) return res.t[0];
|
|
1758
|
-
rootHoles = [];
|
|
1759
|
-
let out = res.t[0];
|
|
1760
|
-
for (let i = 0; i < res.h.length; i++) {
|
|
1761
|
-
const id = nextHoleId++;
|
|
1762
|
-
rootHoles.push({
|
|
1763
|
-
id,
|
|
1764
|
-
fn: res.h[i]
|
|
1765
|
-
});
|
|
1766
|
-
out += `<!--rh${id}-->` + res.t[i + 1];
|
|
1767
|
-
}
|
|
1768
|
-
for (const p of res.p) blockingPromises.add(p);
|
|
1769
|
-
return out;
|
|
1770
|
-
}, {
|
|
1771
|
-
id: renderId
|
|
1772
|
-
});
|
|
1773
|
-
function resolveRootHoles() {
|
|
1774
|
-
if (!rootHoles) return true;
|
|
1775
|
-
const pending = [];
|
|
1776
|
-
for (const {
|
|
1777
|
-
id,
|
|
1778
|
-
fn
|
|
1779
|
-
} of rootHoles) {
|
|
1780
|
-
const marker = `<!--rh${id}-->`;
|
|
1781
|
-
const res = resolveSSRNode(fn);
|
|
1782
|
-
if (!res.h.length) {
|
|
1783
|
-
html = html.replace(marker, res.t[0]);
|
|
1784
|
-
} else {
|
|
1785
|
-
let out = res.t[0];
|
|
1786
|
-
for (let j = 0; j < res.h.length; j++) {
|
|
1787
|
-
const newId = nextHoleId++;
|
|
1788
|
-
pending.push({
|
|
1789
|
-
id: newId,
|
|
1790
|
-
fn: res.h[j]
|
|
1791
|
-
});
|
|
1792
|
-
out += `<!--rh${newId}-->` + res.t[j + 1];
|
|
1793
|
-
}
|
|
1794
|
-
html = html.replace(marker, out);
|
|
1795
|
-
for (const p of res.p) blockingPromises.add(p);
|
|
1796
|
-
}
|
|
1797
|
-
}
|
|
1798
|
-
if (pending.length) {
|
|
1799
|
-
rootHoles = pending;
|
|
1800
|
-
return false;
|
|
1801
|
-
}
|
|
1802
|
-
rootHoles = null;
|
|
1803
|
-
return true;
|
|
1804
|
-
}
|
|
1805
|
-
function doShell() {
|
|
1806
|
-
if (shellCompleted) return;
|
|
1807
|
-
solidJs.sharedConfig.context = context;
|
|
1808
|
-
if (blockingPromises.size !== lastBlockingSize) return;
|
|
1809
|
-
if (!resolveRootHoles()) return;
|
|
1810
|
-
if (blockingPromises.size !== lastBlockingSize) return;
|
|
1811
|
-
if (!headShellReady(headRegistry, p => blockingPromises.add(p))) return;
|
|
1812
|
-
headStyles = new Set();
|
|
1813
|
-
for (const url of tracking.emittedAssets) {
|
|
1814
|
-
if (isCssUrl(url)) headStyles.add(url);
|
|
1815
|
-
}
|
|
1816
|
-
serializeRootAssets();
|
|
1817
|
-
flushStubBatch();
|
|
1818
|
-
const head = renderShellHead(headRegistry, nonce, k => registry.has(k), noScripts);
|
|
1819
|
-
sink.shell(resolveSSRSelectValues(html), {
|
|
1820
|
-
preloads: tracking.emittedAssets,
|
|
1821
|
-
preloadLinks: tracking.preloadLinks,
|
|
1822
|
-
inlineStyles: tracking.inlineStyles,
|
|
1823
|
-
tasks,
|
|
1824
|
-
head
|
|
1825
|
-
});
|
|
1826
|
-
tasks = "";
|
|
1827
|
-
onCompleteShell && onCompleteShell({
|
|
1828
|
-
write(v) {
|
|
1829
|
-
!completed && buffer.write(v);
|
|
1830
|
-
}
|
|
1831
|
-
});
|
|
1832
|
-
shellCompleted = true;
|
|
1833
|
-
}
|
|
1834
|
-
const MIN_DRAIN_TURNS = 8;
|
|
1835
|
-
let lastBlockingSize = -1;
|
|
1836
|
-
let lastRegistrySize = -1;
|
|
1837
|
-
let drainTurn = 0;
|
|
1838
|
-
const scheduleFlush = (fn, awaited) => {
|
|
1839
|
-
const attempt = () => {
|
|
1840
|
-
flushStubBatch();
|
|
1841
|
-
if (registry.size !== lastRegistrySize || drainTurn++ < MIN_DRAIN_TURNS) {
|
|
1842
|
-
if (registry.size !== lastRegistrySize) drainTurn = 0;
|
|
1843
|
-
lastRegistrySize = registry.size;
|
|
1844
|
-
queue(attempt);
|
|
1845
|
-
return;
|
|
1846
|
-
}
|
|
1847
|
-
fn();
|
|
1848
|
-
};
|
|
1849
|
-
const progressed = awaited !== lastBlockingSize;
|
|
1850
|
-
lastBlockingSize = awaited;
|
|
1851
|
-
lastRegistrySize = -1;
|
|
1852
|
-
drainTurn = 0;
|
|
1853
|
-
progressed ? queue(attempt) : setTimeout(attempt);
|
|
1854
|
-
};
|
|
1855
|
-
let cachedReadable;
|
|
1856
|
-
let consumer;
|
|
1857
|
-
const claimConsumer = name => {
|
|
1858
|
-
if (consumer && consumer !== name) {
|
|
1859
|
-
throw new Error(`renderToStream result was already consumed via \`${consumer}\`; cannot also consume it via \`${name}\`. Use exactly one of \`pipe\`, \`pipeTo\`, or \`readable\`.`);
|
|
1860
|
-
}
|
|
1861
|
-
consumer = name;
|
|
1862
|
-
};
|
|
1863
|
-
const pipeToImpl = w => {
|
|
1864
|
-
let resolve;
|
|
1865
|
-
const p = new Promise(r => resolve = r);
|
|
1866
|
-
function flush() {
|
|
1867
|
-
allSettled(blockingPromises).then(awaited => {
|
|
1868
|
-
scheduleFlush(() => {
|
|
1869
|
-
if (dead) return resolve();
|
|
1870
|
-
try {
|
|
1871
|
-
doShell();
|
|
1872
|
-
} catch (err) {
|
|
1873
|
-
failRender(err);
|
|
1874
|
-
return resolve();
|
|
1875
|
-
}
|
|
1876
|
-
if (!shellCompleted) return flush();
|
|
1877
|
-
const encoder = new TextEncoder();
|
|
1878
|
-
const writer = w.getWriter();
|
|
1879
|
-
let pendingWrites = Promise.resolve();
|
|
1880
|
-
let ended = false;
|
|
1881
|
-
const failed = () => {
|
|
1882
|
-
if (!ended) {
|
|
1883
|
-
abandon();
|
|
1884
|
-
resolve();
|
|
1885
|
-
}
|
|
1886
|
-
};
|
|
1887
|
-
writer.closed && writer.closed.catch(failed);
|
|
1888
|
-
buffer = writable = coalesceWrites(payload => {
|
|
1889
|
-
pendingWrites = pendingWrites.then(() => writer.write(encoder.encode(payload))).catch(failed);
|
|
1890
|
-
}, () => {
|
|
1891
|
-
pendingWrites.then(() => {
|
|
1892
|
-
ended = true;
|
|
1893
|
-
writer.releaseLock();
|
|
1894
|
-
w.close().catch(() => {});
|
|
1895
|
-
resolve();
|
|
1896
|
-
});
|
|
1897
|
-
});
|
|
1898
|
-
buffer.write(tmp);
|
|
1899
|
-
buffer.flush();
|
|
1900
|
-
firstFlushed = true;
|
|
1901
|
-
if (completed) {
|
|
1902
|
-
dispose();
|
|
1903
|
-
writable.end();
|
|
1904
|
-
} else flushEnd();
|
|
1905
|
-
}, awaited);
|
|
1906
|
-
});
|
|
1907
|
-
}
|
|
1908
|
-
flush();
|
|
1909
|
-
return p;
|
|
1910
|
-
};
|
|
1911
|
-
return {
|
|
1912
|
-
then(onFulfilled, onRejected) {
|
|
1913
|
-
const freezeHead = () => {
|
|
1914
|
-
if (requestEvent && requestEvent.response) commitResponseStub(requestEvent.response);
|
|
1915
|
-
};
|
|
1916
|
-
const p = new Promise(resolve => {
|
|
1917
|
-
function complete() {
|
|
1918
|
-
freezeHead();
|
|
1919
|
-
dispose();
|
|
1920
|
-
resolve(tmp);
|
|
1921
|
-
}
|
|
1922
|
-
if (onCompleteAll) {
|
|
1923
|
-
let ogComplete = onCompleteAll;
|
|
1924
|
-
onCompleteAll = options => {
|
|
1925
|
-
ogComplete(options);
|
|
1926
|
-
complete();
|
|
1927
|
-
};
|
|
1928
|
-
} else onCompleteAll = complete;
|
|
1929
|
-
function flush() {
|
|
1930
|
-
allSettled(blockingPromises).then(awaited => {
|
|
1931
|
-
scheduleFlush(() => {
|
|
1932
|
-
try {
|
|
1933
|
-
if (blockingPromises.size !== lastBlockingSize || !resolveRootHoles() || blockingPromises.size !== lastBlockingSize || !headShellReady(headRegistry, p => blockingPromises.add(p))) return flush();
|
|
1934
|
-
} catch (err) {
|
|
1935
|
-
failRender(err);
|
|
1936
|
-
return resolve(tmp);
|
|
1937
|
-
}
|
|
1938
|
-
queue(flushEnd);
|
|
1939
|
-
}, awaited);
|
|
1940
|
-
});
|
|
1941
|
-
}
|
|
1942
|
-
flush();
|
|
1943
|
-
});
|
|
1944
|
-
return p.then(onFulfilled, onRejected);
|
|
1945
|
-
},
|
|
1946
|
-
pipe(w) {
|
|
1947
|
-
claimConsumer("pipe");
|
|
1948
|
-
function flush() {
|
|
1949
|
-
allSettled(blockingPromises).then(awaited => {
|
|
1950
|
-
scheduleFlush(() => {
|
|
1951
|
-
if (dead) return;
|
|
1952
|
-
try {
|
|
1953
|
-
doShell();
|
|
1954
|
-
} catch (err) {
|
|
1955
|
-
failRender(err);
|
|
1956
|
-
try {
|
|
1957
|
-
w.end();
|
|
1958
|
-
} catch (_) {}
|
|
1959
|
-
return;
|
|
1960
|
-
}
|
|
1961
|
-
if (!shellCompleted) return flush();
|
|
1962
|
-
const sink = guardSink(w);
|
|
1963
|
-
buffer = writable = coalesceWrites(sink.write, sink.end);
|
|
1964
|
-
buffer.write(tmp);
|
|
1965
|
-
buffer.flush();
|
|
1966
|
-
firstFlushed = true;
|
|
1967
|
-
if (completed) {
|
|
1968
|
-
dispose();
|
|
1969
|
-
writable.end();
|
|
1970
|
-
} else flushEnd();
|
|
1971
|
-
}, awaited);
|
|
1972
|
-
});
|
|
1973
|
-
}
|
|
1974
|
-
flush();
|
|
1975
|
-
},
|
|
1976
|
-
pipeTo(w) {
|
|
1977
|
-
claimConsumer("pipeTo");
|
|
1978
|
-
return pipeToImpl(w);
|
|
1979
|
-
},
|
|
1980
|
-
get readable() {
|
|
1981
|
-
claimConsumer("readable");
|
|
1982
|
-
if (!cachedReadable) {
|
|
1983
|
-
const t = new TransformStream();
|
|
1984
|
-
pipeToImpl(t.writable);
|
|
1985
|
-
cachedReadable = t.readable;
|
|
1986
|
-
}
|
|
1987
|
-
return cachedReadable;
|
|
1988
|
-
}
|
|
1989
|
-
};
|
|
1990
|
-
}
|
|
1991
|
-
function HydrationScript(props) {
|
|
1992
|
-
const nonce = scriptNonce(solidJs.sharedConfig.context && solidJs.sharedConfig.context.nonce);
|
|
1993
|
-
return ssr(generateHydrationScript({
|
|
1994
|
-
nonce,
|
|
1995
|
-
...props
|
|
1996
|
-
}));
|
|
1997
|
-
}
|
|
1998
|
-
function ssrGroup(fn, n) {
|
|
1999
|
-
fn.$g = n;
|
|
2000
|
-
return fn;
|
|
2001
|
-
}
|
|
2002
|
-
function buildAsyncWrap(err, node) {
|
|
2003
|
-
const p = solidJs.ssrHandleError(err);
|
|
2004
|
-
if (!p) return null;
|
|
2005
|
-
if (node.$rw) return {
|
|
2006
|
-
fn: node,
|
|
2007
|
-
p
|
|
2008
|
-
};
|
|
2009
|
-
const owner = solidJs.getOwner();
|
|
2010
|
-
const live = solidJs.sharedConfig.context && solidJs.sharedConfig.context.liveHoles;
|
|
2011
|
-
const suppress = node.$lhSuppress || live && (live.suppressed || live.sweeping);
|
|
2012
|
-
if (!owner) {
|
|
2013
|
-
if (suppress) node.$lhSuppress = true;
|
|
2014
|
-
return {
|
|
2015
|
-
fn: node,
|
|
2016
|
-
p
|
|
2017
|
-
};
|
|
2018
|
-
}
|
|
2019
|
-
const fn = () => solidJs.runWithOwner(owner, node);
|
|
2020
|
-
fn.$rw = true;
|
|
2021
|
-
if (suppress) fn.$lhSuppress = true;
|
|
2022
|
-
if (node.$lhSkip) fn.$lhSkip = true;
|
|
2023
|
-
if (node.$lhBinding) fn.$lhBinding = node.$lhBinding;
|
|
2024
|
-
return {
|
|
2025
|
-
fn,
|
|
2026
|
-
p
|
|
2027
|
-
};
|
|
2028
|
-
}
|
|
2029
|
-
function ssrFirstGroupHit(hole) {
|
|
2030
|
-
try {
|
|
2031
|
-
return hole();
|
|
2032
|
-
} catch (err) {
|
|
2033
|
-
return buildAsyncWrap(err, hole);
|
|
2034
|
-
}
|
|
2035
|
-
}
|
|
2036
|
-
function tryResolveFunctionHole(hole) {
|
|
2037
|
-
let value;
|
|
2038
|
-
try {
|
|
2039
|
-
value = hole();
|
|
2040
|
-
} catch (err) {
|
|
2041
|
-
return buildAsyncWrap(err, hole) || "";
|
|
2042
|
-
}
|
|
2043
|
-
const t = typeof value;
|
|
2044
|
-
if (t === "string") return value;
|
|
2045
|
-
if (t === "number") return "" + value;
|
|
2046
|
-
if (value == null || t === "boolean") return "";
|
|
2047
|
-
return tryResolveString(value);
|
|
2048
|
-
}
|
|
2049
|
-
function mergeTemplateInto(result, node) {
|
|
2050
|
-
result.t[result.t.length - 1] += node.t[0];
|
|
2051
|
-
if (node.t.length > 1) {
|
|
2052
|
-
result.t.push(...node.t.slice(1));
|
|
2053
|
-
result.h.push(...node.h);
|
|
2054
|
-
result.p.push(...node.p);
|
|
2055
|
-
}
|
|
2056
|
-
}
|
|
2057
|
-
function appendResolvedNode(result, node) {
|
|
2058
|
-
if (node.fn !== undefined) {
|
|
2059
|
-
result.h.push(node.fn);
|
|
2060
|
-
result.p.push(node.p);
|
|
2061
|
-
result.t.push("");
|
|
2062
|
-
} else if (node.merge !== undefined) mergeTemplateInto(result, node.merge);else resolveSSRNode(node.bail, result);
|
|
2063
|
-
}
|
|
2064
|
-
let _lastGroupFn = null;
|
|
2065
|
-
let _lastGroupArr = null;
|
|
2066
|
-
let _lastGroupErr = null;
|
|
2067
|
-
function ssrGroupSlot(fn, idx) {
|
|
2068
|
-
return () => {
|
|
2069
|
-
if (idx > 0 && _lastGroupFn === fn) {
|
|
2070
|
-
if (_lastGroupArr !== null) return _lastGroupArr[idx];
|
|
2071
|
-
throw _lastGroupErr;
|
|
2072
|
-
}
|
|
2073
|
-
_lastGroupFn = fn;
|
|
2074
|
-
_lastGroupArr = null;
|
|
2075
|
-
_lastGroupErr = null;
|
|
2076
|
-
try {
|
|
2077
|
-
_lastGroupArr = fn();
|
|
2078
|
-
return _lastGroupArr[idx];
|
|
2079
|
-
} catch (err) {
|
|
2080
|
-
_lastGroupErr = err;
|
|
2081
|
-
throw err;
|
|
2082
|
-
}
|
|
2083
|
-
};
|
|
2084
|
-
}
|
|
2085
|
-
const holePositionCache = new WeakMap();
|
|
2086
|
-
function holeContentPositions(t) {
|
|
2087
|
-
let cached = holePositionCache.get(t);
|
|
2088
|
-
if (cached) return cached;
|
|
2089
|
-
const pos = [];
|
|
2090
|
-
const openOff = [];
|
|
2091
|
-
const closeOff = [];
|
|
2092
|
-
let inTag = false;
|
|
2093
|
-
let quote = "";
|
|
2094
|
-
let curOpen = null;
|
|
2095
|
-
let scanningName = false;
|
|
2096
|
-
for (let i = 0; i < t.length; i++) {
|
|
2097
|
-
const seg = t[i];
|
|
2098
|
-
let close = -1;
|
|
2099
|
-
const openAtStart = inTag;
|
|
2100
|
-
let reopened = false;
|
|
2101
|
-
for (let j = 0; j < seg.length; j++) {
|
|
2102
|
-
const ch = seg[j];
|
|
2103
|
-
if (quote) {
|
|
2104
|
-
if (ch === quote) quote = "";
|
|
2105
|
-
} else if (inTag) {
|
|
2106
|
-
if (scanningName && (ch === " " || ch === "\t" || ch === "\n" || ch === ">" || ch === "/")) {
|
|
2107
|
-
scanningName = false;
|
|
2108
|
-
curOpen = {
|
|
2109
|
-
seg: i,
|
|
2110
|
-
off: j
|
|
2111
|
-
};
|
|
2112
|
-
}
|
|
2113
|
-
if (ch === '"' || ch === "'") quote = ch;else if (ch === ">") {
|
|
2114
|
-
inTag = false;
|
|
2115
|
-
if (openAtStart && !reopened && close === -1) close = j;
|
|
2116
|
-
curOpen = null;
|
|
2117
|
-
}
|
|
2118
|
-
} else if (ch === "<") {
|
|
2119
|
-
inTag = true;
|
|
2120
|
-
scanningName = true;
|
|
2121
|
-
reopened = true;
|
|
2122
|
-
curOpen = null;
|
|
2123
|
-
}
|
|
2124
|
-
}
|
|
2125
|
-
if (inTag && scanningName) {
|
|
2126
|
-
scanningName = false;
|
|
2127
|
-
curOpen = {
|
|
2128
|
-
seg: i,
|
|
2129
|
-
off: seg.length
|
|
2130
|
-
};
|
|
2131
|
-
}
|
|
2132
|
-
closeOff.push(close);
|
|
2133
|
-
openOff.push(inTag && curOpen && curOpen.seg === i ? curOpen.off : -1);
|
|
2134
|
-
if (i < t.length - 1) pos.push(!inTag);
|
|
2135
|
-
}
|
|
2136
|
-
cached = {
|
|
2137
|
-
pos,
|
|
2138
|
-
openOff,
|
|
2139
|
-
closeOff
|
|
2140
|
-
};
|
|
2141
|
-
holePositionCache.set(t, cached);
|
|
2142
|
-
return cached;
|
|
2143
|
-
}
|
|
2144
|
-
function createLiveHoles(sink, scoped) {
|
|
2145
|
-
let nextId = 0;
|
|
2146
|
-
const stamp = typeof solidJs.creationStamp === "function" ? solidJs.creationStamp : () => 0;
|
|
2147
|
-
const inScope = scoped && typeof solidJs.inServerComponentScope === "function" ? solidJs.inServerComponentScope : null;
|
|
2148
|
-
const stripMarkers = html => html.replace(/<!--lh:\/?\d+-->/g, "");
|
|
2149
|
-
const swept = (owner, ctx, fn) => {
|
|
2150
|
-
const prev = solidJs.sharedConfig.context;
|
|
2151
|
-
solidJs.sharedConfig.context = ctx;
|
|
2152
|
-
try {
|
|
2153
|
-
return owner ? solidJs.runWithOwner(owner, fn) : fn();
|
|
2154
|
-
} finally {
|
|
2155
|
-
solidJs.sharedConfig.context = prev;
|
|
2156
|
-
}
|
|
2157
|
-
};
|
|
2158
|
-
function resolveHoleValue(hole) {
|
|
2159
|
-
const result = {
|
|
2160
|
-
t: [""],
|
|
2161
|
-
h: [],
|
|
2162
|
-
p: []
|
|
2163
|
-
};
|
|
2164
|
-
try {
|
|
2165
|
-
resolveSSRNode(hole(), result);
|
|
2166
|
-
} catch (err) {
|
|
2167
|
-
const wrap = buildAsyncWrap(err, hole);
|
|
2168
|
-
if (!wrap) throw err;
|
|
2169
|
-
result.h.push(wrap.fn);
|
|
2170
|
-
result.p.push(wrap.p);
|
|
2171
|
-
result.t.push("");
|
|
2172
|
-
}
|
|
2173
|
-
return result;
|
|
2174
|
-
}
|
|
2175
|
-
function closeChildren(b) {
|
|
2176
|
-
for (const c of b.children) {
|
|
2177
|
-
c.closed = true;
|
|
2178
|
-
if (c.key) sink.closeBinding(c.key);
|
|
2179
|
-
closeChildren(c);
|
|
2180
|
-
}
|
|
2181
|
-
b.children.length = 0;
|
|
2182
|
-
}
|
|
2183
|
-
const engine = {
|
|
2184
|
-
suppressed: 0,
|
|
2185
|
-
sweeping: false,
|
|
2186
|
-
parent: null,
|
|
2187
|
-
recordStamp: 0,
|
|
2188
|
-
gateHit: false,
|
|
2189
|
-
content(hole) {
|
|
2190
|
-
if (hole.$lhSuppress) {
|
|
2191
|
-
const r = {
|
|
2192
|
-
t: [""],
|
|
2193
|
-
h: [],
|
|
2194
|
-
p: []
|
|
2195
|
-
};
|
|
2196
|
-
engine.suppressed++;
|
|
2197
|
-
try {
|
|
2198
|
-
try {
|
|
2199
|
-
resolveSSRNode(hole(), r);
|
|
2200
|
-
} catch (err) {
|
|
2201
|
-
const wrap = buildAsyncWrap(err, hole);
|
|
2202
|
-
if (wrap) {
|
|
2203
|
-
r.h.push(wrap.fn);
|
|
2204
|
-
r.p.push(wrap.p);
|
|
2205
|
-
r.t.push("");
|
|
2206
|
-
}
|
|
2207
|
-
}
|
|
2208
|
-
} finally {
|
|
2209
|
-
engine.suppressed--;
|
|
2210
|
-
}
|
|
2211
|
-
const b = hole.$lhBinding;
|
|
2212
|
-
if (b && !b.closed && !r.h.length && !engine.sweeping) {
|
|
2213
|
-
b.last = stripMarkers(r.t[0]);
|
|
2214
|
-
}
|
|
2215
|
-
return r.h.length ? r : r.t[0];
|
|
2216
|
-
}
|
|
2217
|
-
if (engine.suppressed || engine.sweeping) return null;
|
|
2218
|
-
if (hole.$lhSkip) return null;
|
|
2219
|
-
if (inScope && !inScope()) return null;
|
|
2220
|
-
const recordsBefore = engine.recordStamp;
|
|
2221
|
-
const ownersBefore = stamp();
|
|
2222
|
-
const owner = solidJs.getOwner();
|
|
2223
|
-
const holeCtx = solidJs.sharedConfig.context;
|
|
2224
|
-
const b = {
|
|
2225
|
-
key: null,
|
|
2226
|
-
children: [],
|
|
2227
|
-
last: null,
|
|
2228
|
-
closed: false,
|
|
2229
|
-
sweep() {
|
|
2230
|
-
if (b.closed) return;
|
|
2231
|
-
const prevSweeping = engine.sweeping;
|
|
2232
|
-
engine.sweeping = true;
|
|
2233
|
-
engine.gateHit = false;
|
|
2234
|
-
const sweepOwnersBefore = stamp();
|
|
2235
|
-
let res;
|
|
2236
|
-
try {
|
|
2237
|
-
res = swept(owner, holeCtx, () => resolveHoleValue(hole));
|
|
2238
|
-
} catch (err) {
|
|
2239
|
-
b.closed = true;
|
|
2240
|
-
sink.closeBinding(b.key);
|
|
2241
|
-
sink.error(b.key, String(err && err.message || err));
|
|
2242
|
-
return;
|
|
2243
|
-
} finally {
|
|
2244
|
-
engine.sweeping = prevSweeping;
|
|
2245
|
-
}
|
|
2246
|
-
if (engine.gateHit || stamp() !== sweepOwnersBefore) {
|
|
2247
|
-
b.closed = true;
|
|
2248
|
-
sink.closeBinding(b.key);
|
|
2249
|
-
return;
|
|
2250
|
-
}
|
|
2251
|
-
if (res.h.length) return;
|
|
2252
|
-
const html = res.t[0];
|
|
2253
|
-
if (b.last === null || html === b.last) return;
|
|
2254
|
-
b.last = html;
|
|
2255
|
-
closeChildren(b);
|
|
2256
|
-
sink.hole(b.key, html);
|
|
2257
|
-
}
|
|
2258
|
-
};
|
|
2259
|
-
if (engine.parent) engine.parent.children.push(b);
|
|
2260
|
-
const prevParent = engine.parent;
|
|
2261
|
-
engine.parent = b;
|
|
2262
|
-
let value;
|
|
2263
|
-
let escalated = null;
|
|
2264
|
-
try {
|
|
2265
|
-
value = hole();
|
|
2266
|
-
} catch (err) {
|
|
2267
|
-
const wrap = buildAsyncWrap(err, hole);
|
|
2268
|
-
if (!wrap) {
|
|
2269
|
-
engine.parent = prevParent;
|
|
2270
|
-
closeChildren(b);
|
|
2271
|
-
return "";
|
|
2272
|
-
}
|
|
2273
|
-
escalated = wrap;
|
|
2274
|
-
}
|
|
2275
|
-
if (!escalated && (typeof value === "function" && value.$lhSkip || value !== null && typeof value === "object" && value.$slot)) {
|
|
2276
|
-
engine.parent = prevParent;
|
|
2277
|
-
const r = {
|
|
2278
|
-
t: [""],
|
|
2279
|
-
h: [],
|
|
2280
|
-
p: []
|
|
2281
|
-
};
|
|
2282
|
-
engine.suppressed++;
|
|
2283
|
-
try {
|
|
2284
|
-
resolveSSRNode(value, r);
|
|
2285
|
-
} finally {
|
|
2286
|
-
engine.suppressed--;
|
|
2287
|
-
}
|
|
2288
|
-
return r.h.length ? r : r.t[0];
|
|
2289
|
-
}
|
|
2290
|
-
let res;
|
|
2291
|
-
if (escalated) {
|
|
2292
|
-
closeChildren(b);
|
|
2293
|
-
escalated.fn.$lhSuppress = true;
|
|
2294
|
-
escalated.fn.$lhBinding = b;
|
|
2295
|
-
res = {
|
|
2296
|
-
t: ["", ""],
|
|
2297
|
-
h: [escalated.fn],
|
|
2298
|
-
p: [escalated.p]
|
|
2299
|
-
};
|
|
2300
|
-
} else {
|
|
2301
|
-
res = {
|
|
2302
|
-
t: [""],
|
|
2303
|
-
h: [],
|
|
2304
|
-
p: []
|
|
2305
|
-
};
|
|
2306
|
-
try {
|
|
2307
|
-
resolveSSRNode(value, res);
|
|
2308
|
-
} catch (_) {
|
|
2309
|
-
engine.parent = prevParent;
|
|
2310
|
-
closeChildren(b);
|
|
2311
|
-
return "";
|
|
2312
|
-
}
|
|
2313
|
-
}
|
|
2314
|
-
engine.parent = prevParent;
|
|
2315
|
-
if (engine.recordStamp !== recordsBefore || stamp() !== ownersBefore) {
|
|
2316
|
-
return res.h.length ? res : res.t[0];
|
|
2317
|
-
}
|
|
2318
|
-
const id = nextId++;
|
|
2319
|
-
const key = b.key = "lh:" + id;
|
|
2320
|
-
const open = `<!--lh:${id}-->`;
|
|
2321
|
-
const close = `<!--lh:/${id}-->`;
|
|
2322
|
-
if (!res.h.length) {
|
|
2323
|
-
b.last = stripMarkers(res.t[0]);
|
|
2324
|
-
sink.openBinding(key, b);
|
|
2325
|
-
return open + res.t[0] + close;
|
|
2326
|
-
}
|
|
2327
|
-
const t = res.t.slice();
|
|
2328
|
-
t[0] = open + t[0];
|
|
2329
|
-
t[t.length - 1] += close;
|
|
2330
|
-
sink.openBinding(key, b);
|
|
2331
|
-
return {
|
|
2332
|
-
t,
|
|
2333
|
-
h: res.h,
|
|
2334
|
-
p: res.p
|
|
2335
|
-
};
|
|
2336
|
-
},
|
|
2337
|
-
mint() {
|
|
2338
|
-
return nextId++;
|
|
2339
|
-
},
|
|
2340
|
-
active() {
|
|
2341
|
-
return !inScope || inScope();
|
|
2342
|
-
},
|
|
2343
|
-
attr(cap) {
|
|
2344
|
-
const owner = solidJs.getOwner();
|
|
2345
|
-
const holeCtx = solidJs.sharedConfig.context;
|
|
2346
|
-
const b = {
|
|
2347
|
-
key: "lha:" + cap.id,
|
|
2348
|
-
children: [],
|
|
2349
|
-
last: cap.base,
|
|
2350
|
-
closed: false,
|
|
2351
|
-
sweep() {
|
|
2352
|
-
if (b.closed) return;
|
|
2353
|
-
const prevSweeping = engine.sweeping;
|
|
2354
|
-
engine.sweeping = true;
|
|
2355
|
-
engine.gateHit = false;
|
|
2356
|
-
const sweepOwnersBefore = stamp();
|
|
2357
|
-
let html = "";
|
|
2358
|
-
try {
|
|
2359
|
-
let group = null;
|
|
2360
|
-
let groupVal = null;
|
|
2361
|
-
const run = () => {
|
|
2362
|
-
for (const part of cap.parts) {
|
|
2363
|
-
if (typeof part === "string") {
|
|
2364
|
-
html += part;
|
|
2365
|
-
continue;
|
|
2366
|
-
}
|
|
2367
|
-
let v;
|
|
2368
|
-
if (part.g) {
|
|
2369
|
-
if (group !== part.g) {
|
|
2370
|
-
group = part.g;
|
|
2371
|
-
groupVal = part.g();
|
|
2372
|
-
}
|
|
2373
|
-
v = groupVal[part.i];
|
|
2374
|
-
} else {
|
|
2375
|
-
v = part.f();
|
|
2376
|
-
}
|
|
2377
|
-
const vt = typeof v;
|
|
2378
|
-
if (vt === "string" || vt === "number") html += v;
|
|
2379
|
-
}
|
|
2380
|
-
};
|
|
2381
|
-
swept(owner, holeCtx, run);
|
|
2382
|
-
} catch (err) {
|
|
2383
|
-
if (solidJs.ssrHandleError(err, true)) return;
|
|
2384
|
-
b.closed = true;
|
|
2385
|
-
sink.closeBinding(b.key);
|
|
2386
|
-
sink.error("lha:" + cap.id, String(err && err.message || err));
|
|
2387
|
-
return;
|
|
2388
|
-
} finally {
|
|
2389
|
-
engine.sweeping = prevSweeping;
|
|
2390
|
-
}
|
|
2391
|
-
if (engine.gateHit || stamp() !== sweepOwnersBefore) {
|
|
2392
|
-
b.closed = true;
|
|
2393
|
-
sink.closeBinding(b.key);
|
|
2394
|
-
return;
|
|
2395
|
-
}
|
|
2396
|
-
if (html === b.last) return;
|
|
2397
|
-
const before = attrNames(b.last);
|
|
2398
|
-
const after = attrNames(html);
|
|
2399
|
-
const removed = before.filter(n => !after.includes(n));
|
|
2400
|
-
b.last = html;
|
|
2401
|
-
sink.attr(String(cap.id), html, removed);
|
|
2402
|
-
}
|
|
2403
|
-
};
|
|
2404
|
-
sink.openBinding(b.key, b);
|
|
2405
|
-
}
|
|
2406
|
-
};
|
|
2407
|
-
return engine;
|
|
2408
|
-
}
|
|
2409
|
-
function attrNames(text) {
|
|
2410
|
-
const names = [];
|
|
2411
|
-
const re = /(?:^|\s)([^\s=/>"']+)(?:="[^"]*")?/g;
|
|
2412
|
-
let m;
|
|
2413
|
-
while (m = re.exec(text)) names.push(m[1]);
|
|
2414
|
-
return names;
|
|
2415
|
-
}
|
|
2416
|
-
function ssr(t) {
|
|
2417
|
-
const len = arguments.length;
|
|
2418
|
-
if (len === 1) return {
|
|
2419
|
-
t
|
|
2420
|
-
};
|
|
2421
|
-
let s = t[0];
|
|
2422
|
-
let result = null;
|
|
2423
|
-
let lastGroup = null;
|
|
2424
|
-
let lastGroupVal = null;
|
|
2425
|
-
let lastGroupIdx = 0;
|
|
2426
|
-
const live = solidJs.sharedConfig.context && solidJs.sharedConfig.context.liveHoles;
|
|
2427
|
-
const hp = live ? holeContentPositions(t) : null;
|
|
2428
|
-
let lastOpen = null;
|
|
2429
|
-
let cap = null;
|
|
2430
|
-
if (live && hp.openOff[0] >= 0) lastOpen = {
|
|
2431
|
-
r: null,
|
|
2432
|
-
seg: -1,
|
|
2433
|
-
off: hp.openOff[0]
|
|
2434
|
-
};
|
|
2435
|
-
const captureStart = () => {
|
|
2436
|
-
if (cap) return true;
|
|
2437
|
-
if (!lastOpen || live.suppressed || live.sweeping || !live.active()) return false;
|
|
2438
|
-
if (lastOpen.r !== result || result !== null && lastOpen.seg !== result.t.length - 1) {
|
|
2439
|
-
return false;
|
|
2440
|
-
}
|
|
2441
|
-
const id = live.mint();
|
|
2442
|
-
const inject = ` data-lha="${id}"`;
|
|
2443
|
-
let prefix;
|
|
2444
|
-
if (result === null) {
|
|
2445
|
-
s = s.slice(0, lastOpen.off) + inject + s.slice(lastOpen.off);
|
|
2446
|
-
prefix = s.slice(lastOpen.off + inject.length);
|
|
2447
|
-
} else {
|
|
2448
|
-
const seg = result.t[lastOpen.seg];
|
|
2449
|
-
result.t[lastOpen.seg] = seg.slice(0, lastOpen.off) + inject + seg.slice(lastOpen.off);
|
|
2450
|
-
prefix = result.t[lastOpen.seg].slice(lastOpen.off + inject.length);
|
|
2451
|
-
}
|
|
2452
|
-
cap = {
|
|
2453
|
-
id,
|
|
2454
|
-
parts: [prefix],
|
|
2455
|
-
base: prefix
|
|
2456
|
-
};
|
|
2457
|
-
return true;
|
|
2458
|
-
};
|
|
2459
|
-
for (let i = 1; i < len; i++) {
|
|
2460
|
-
const hole = arguments[i];
|
|
2461
|
-
const ht = typeof hole;
|
|
2462
|
-
if (ht === "string") {
|
|
2463
|
-
if (result === null) s += hole;else result.t[result.t.length - 1] += hole;
|
|
2464
|
-
if (cap) {
|
|
2465
|
-
cap.parts.push(hole);
|
|
2466
|
-
cap.base += hole;
|
|
2467
|
-
}
|
|
2468
|
-
} else if (ht === "number") {
|
|
2469
|
-
if (result === null) s += hole;else result.t[result.t.length - 1] += hole;
|
|
2470
|
-
if (cap) {
|
|
2471
|
-
cap.parts.push("" + hole);
|
|
2472
|
-
cap.base += hole;
|
|
2473
|
-
}
|
|
2474
|
-
} else if (hole == null || ht === "boolean") ; else if (ht === "function" && hole.$g) {
|
|
2475
|
-
let value;
|
|
2476
|
-
let hasValue = false;
|
|
2477
|
-
if (lastGroup !== hole) {
|
|
2478
|
-
const r = ssrFirstGroupHit(hole);
|
|
2479
|
-
if (r !== null) {
|
|
2480
|
-
lastGroup = hole;
|
|
2481
|
-
lastGroupVal = r;
|
|
2482
|
-
lastGroupIdx = 0;
|
|
2483
|
-
if (!Array.isArray(r) && result === null) {
|
|
2484
|
-
result = {
|
|
2485
|
-
t: [s],
|
|
2486
|
-
h: [],
|
|
2487
|
-
p: []
|
|
2488
|
-
};
|
|
2489
|
-
s = "";
|
|
2490
|
-
}
|
|
2491
|
-
}
|
|
2492
|
-
}
|
|
2493
|
-
if (lastGroup === hole) {
|
|
2494
|
-
if (Array.isArray(lastGroupVal)) {
|
|
2495
|
-
value = lastGroupVal[lastGroupIdx++];
|
|
2496
|
-
hasValue = true;
|
|
2497
|
-
if (live && !hp.pos[i - 1] && captureStart()) {
|
|
2498
|
-
cap.parts.push({
|
|
2499
|
-
g: hole,
|
|
2500
|
-
i: lastGroupIdx - 1
|
|
2501
|
-
});
|
|
2502
|
-
}
|
|
2503
|
-
} else {
|
|
2504
|
-
cap = null;
|
|
2505
|
-
result.h.push(ssrGroupSlot(lastGroupVal.fn, lastGroupIdx++));
|
|
2506
|
-
result.p.push(lastGroupVal.p);
|
|
2507
|
-
result.t.push("");
|
|
2508
|
-
}
|
|
2509
|
-
}
|
|
2510
|
-
if (hasValue) {
|
|
2511
|
-
const vt = typeof value;
|
|
2512
|
-
if (vt === "string" || vt === "number") {
|
|
2513
|
-
if (result === null) s += value;else result.t[result.t.length - 1] += value;
|
|
2514
|
-
if (cap && !hp.pos[i - 1]) cap.base += value;
|
|
2515
|
-
} else if (value == null || vt === "boolean") ; else if (result !== null) {
|
|
2516
|
-
resolveSSRNode(value, result);
|
|
2517
|
-
} else {
|
|
2518
|
-
const rs = tryResolveString(value);
|
|
2519
|
-
if (typeof rs === "string") {
|
|
2520
|
-
s += rs;
|
|
2521
|
-
} else {
|
|
2522
|
-
result = {
|
|
2523
|
-
t: [s],
|
|
2524
|
-
h: [],
|
|
2525
|
-
p: []
|
|
2526
|
-
};
|
|
2527
|
-
s = "";
|
|
2528
|
-
if (rs.merge !== undefined) mergeTemplateInto(result, rs.merge);else resolveSSRNode(rs.bail, result);
|
|
2529
|
-
}
|
|
2530
|
-
}
|
|
2531
|
-
}
|
|
2532
|
-
} else if (ht === "function") {
|
|
2533
|
-
let liveNode = null;
|
|
2534
|
-
if (live && hp.pos[i - 1] && (liveNode = live.content(hole)) !== null) {
|
|
2535
|
-
if (typeof liveNode === "string") {
|
|
2536
|
-
if (result === null) s += liveNode;else result.t[result.t.length - 1] += liveNode;
|
|
2537
|
-
} else {
|
|
2538
|
-
if (result === null) {
|
|
2539
|
-
result = {
|
|
2540
|
-
t: [s],
|
|
2541
|
-
h: [],
|
|
2542
|
-
p: []
|
|
2543
|
-
};
|
|
2544
|
-
s = "";
|
|
2545
|
-
}
|
|
2546
|
-
resolveSSRNode(liveNode, result);
|
|
2547
|
-
}
|
|
2548
|
-
} else if (result !== null) {
|
|
2549
|
-
const inTag = live && !hp.pos[i - 1];
|
|
2550
|
-
const capturing = inTag && captureStart();
|
|
2551
|
-
const li = capturing ? result.t.length - 1 : 0;
|
|
2552
|
-
const before = capturing ? result.t[li].length : 0;
|
|
2553
|
-
if (live) live.suppressed++;
|
|
2554
|
-
try {
|
|
2555
|
-
resolveSSRNode(hole, result);
|
|
2556
|
-
} finally {
|
|
2557
|
-
if (live) live.suppressed--;
|
|
2558
|
-
}
|
|
2559
|
-
if (capturing) {
|
|
2560
|
-
if (result.t.length - 1 === li) {
|
|
2561
|
-
cap.base += result.t[li].slice(before);
|
|
2562
|
-
cap.parts.push({
|
|
2563
|
-
f: hole
|
|
2564
|
-
});
|
|
2565
|
-
} else {
|
|
2566
|
-
cap = null;
|
|
2567
|
-
}
|
|
2568
|
-
}
|
|
2569
|
-
} else {
|
|
2570
|
-
const capturing = live && !hp.pos[i - 1] && captureStart();
|
|
2571
|
-
const r = tryResolveFunctionHole(hole);
|
|
2572
|
-
if (typeof r === "string") {
|
|
2573
|
-
s += r;
|
|
2574
|
-
if (capturing) {
|
|
2575
|
-
cap.base += r;
|
|
2576
|
-
cap.parts.push({
|
|
2577
|
-
f: hole
|
|
2578
|
-
});
|
|
2579
|
-
}
|
|
2580
|
-
} else {
|
|
2581
|
-
if (capturing) cap = null;
|
|
2582
|
-
result = {
|
|
2583
|
-
t: [s],
|
|
2584
|
-
h: [],
|
|
2585
|
-
p: []
|
|
2586
|
-
};
|
|
2587
|
-
s = "";
|
|
2588
|
-
appendResolvedNode(result, r);
|
|
2589
|
-
}
|
|
2590
|
-
}
|
|
2591
|
-
} else if (result !== null) {
|
|
2592
|
-
resolveSSRNode(hole, result);
|
|
2593
|
-
} else {
|
|
2594
|
-
const r = tryResolveString(hole);
|
|
2595
|
-
if (typeof r === "string") {
|
|
2596
|
-
s += r;
|
|
2597
|
-
} else {
|
|
2598
|
-
result = {
|
|
2599
|
-
t: [s],
|
|
2600
|
-
h: [],
|
|
2601
|
-
p: []
|
|
2602
|
-
};
|
|
2603
|
-
s = "";
|
|
2604
|
-
appendResolvedNode(result, r);
|
|
2605
|
-
}
|
|
2606
|
-
}
|
|
2607
|
-
const next = t[i];
|
|
2608
|
-
if (live) {
|
|
2609
|
-
if (cap) {
|
|
2610
|
-
const co = hp.closeOff[i];
|
|
2611
|
-
if (co >= 0) {
|
|
2612
|
-
const tail = next.slice(0, co);
|
|
2613
|
-
cap.parts.push(tail);
|
|
2614
|
-
cap.base += tail;
|
|
2615
|
-
live.attr(cap);
|
|
2616
|
-
cap = null;
|
|
2617
|
-
} else {
|
|
2618
|
-
cap.parts.push(next);
|
|
2619
|
-
cap.base += next;
|
|
2620
|
-
}
|
|
2621
|
-
}
|
|
2622
|
-
if (hp.openOff[i] >= 0) {
|
|
2623
|
-
lastOpen = result === null ? {
|
|
2624
|
-
r: null,
|
|
2625
|
-
seg: -1,
|
|
2626
|
-
off: s.length + hp.openOff[i]
|
|
2627
|
-
} : {
|
|
2628
|
-
r: result,
|
|
2629
|
-
seg: result.t.length - 1,
|
|
2630
|
-
off: result.t[result.t.length - 1].length + hp.openOff[i]
|
|
2631
|
-
};
|
|
2632
|
-
}
|
|
2633
|
-
}
|
|
2634
|
-
if (result === null) s += next;else result.t[result.t.length - 1] += next;
|
|
2635
|
-
}
|
|
2636
|
-
if (result === null) return {
|
|
2637
|
-
t: s
|
|
2638
|
-
};
|
|
2639
|
-
return result;
|
|
2640
|
-
}
|
|
2641
|
-
function ssrClassName(value) {
|
|
2642
|
-
if (typeof value === "number") return "" + value;
|
|
2643
|
-
if (!value) return "";
|
|
2644
|
-
if (typeof value === "string") return escape(value, true);
|
|
2645
|
-
value = classListToObject(value);
|
|
2646
|
-
let classKeys = Object.keys(value),
|
|
2647
|
-
result = "";
|
|
2648
|
-
for (let i = 0, len = classKeys.length; i < len; i++) {
|
|
2649
|
-
const key = classKeys[i],
|
|
2650
|
-
classValue = !!value[key];
|
|
2651
|
-
if (!key || key === "undefined" || !classValue) continue;
|
|
2652
|
-
i && (result += " ");
|
|
2653
|
-
result += escape(key, true);
|
|
2654
|
-
}
|
|
2655
|
-
return result;
|
|
2656
|
-
}
|
|
2657
|
-
function ssrStyle(value) {
|
|
2658
|
-
if (!value) return "";
|
|
2659
|
-
if (typeof value === "string") return escape(value, true);
|
|
2660
|
-
let result = "";
|
|
2661
|
-
const k = Object.keys(value);
|
|
2662
|
-
for (let i = 0; i < k.length; i++) {
|
|
2663
|
-
const s = escape(k[i], true);
|
|
2664
|
-
const v = value[k[i]];
|
|
2665
|
-
if (v != undefined) {
|
|
2666
|
-
if (i) result += ";";
|
|
2667
|
-
const r = escape(v, true);
|
|
2668
|
-
if (r != undefined && r !== "undefined") {
|
|
2669
|
-
result += `${s}:${r}`;
|
|
2670
|
-
}
|
|
2671
|
-
}
|
|
2672
|
-
}
|
|
2673
|
-
return result;
|
|
2674
|
-
}
|
|
2675
|
-
function ssrStyleProperty(name, value) {
|
|
2676
|
-
return value != null ? name + value : "";
|
|
2677
|
-
}
|
|
2678
|
-
function ssrElement(tag, props, children, needsId) {
|
|
2679
|
-
const hk = needsId ? ssrHydrationKey() : "";
|
|
2680
|
-
if (typeof props === "function") props = props();
|
|
2681
|
-
if (props == null) props = {};
|
|
2682
|
-
const skipChildren = VOID_ELEMENTS.test(tag);
|
|
2683
|
-
const keys = Object.keys(props);
|
|
2684
|
-
let result = `<${tag}${hk} `;
|
|
2685
|
-
for (let i = 0; i < keys.length; i++) {
|
|
2686
|
-
const prop = keys[i];
|
|
2687
|
-
const value = props[prop];
|
|
2688
|
-
if (tag === "textarea" && (prop === "value" || prop === "defaultValue")) {
|
|
2689
|
-
if (value !== null) children = escape(value);
|
|
2690
|
-
continue;
|
|
2691
|
-
}
|
|
2692
|
-
if (ChildProperties.has(prop)) {
|
|
2693
|
-
if (children === undefined && !skipChildren) children = tag === "script" || tag === "style" || prop === "innerHTML" ? props[prop] : escape(props[prop]);
|
|
2694
|
-
continue;
|
|
2695
|
-
}
|
|
2696
|
-
if (prop === "style") {
|
|
2697
|
-
result += `style="${ssrStyle(value)}"`;
|
|
2698
|
-
} else if (prop === "class") {
|
|
2699
|
-
result += `class="${ssrClassName(value)}"`;
|
|
2700
|
-
} else if (value == undefined || prop === "ref" || prop.slice(0, 2) === "on" || prop.slice(0, 5) === "prop:") {
|
|
2701
|
-
if (typeof value === "function" && value[CLAIM_PROP] !== undefined && (prop === "ref" || prop.slice(0, 2) === "on")) {
|
|
2702
|
-
console.warn(`A spread on a server-rendered <${tag}> carries \`${prop}\` from client props — ` + `spreads don't participate in behavior claims, so this drops. ` + `Write the position out: \`${prop}={props.${String(value[CLAIM_PROP])}}\`.`);
|
|
2703
|
-
}
|
|
2704
|
-
continue;
|
|
2705
|
-
} else if (typeof value === "boolean") {
|
|
2706
|
-
if (!value) continue;
|
|
2707
|
-
result += escape(prop);
|
|
2708
|
-
} else {
|
|
2709
|
-
result += value === "" ? escape(prop) : `${escape(prop)}="${escape(value, true)}"`;
|
|
2710
|
-
}
|
|
2711
|
-
if (i !== keys.length - 1) result += " ";
|
|
2712
|
-
}
|
|
2713
|
-
if (skipChildren) return {
|
|
2714
|
-
t: result + "/>"
|
|
2715
|
-
};
|
|
2716
|
-
if (typeof children === "function") children = children();
|
|
2717
|
-
return ssr([result + ">", `</${tag}>`], resolveSSRNode(children, undefined, true));
|
|
2718
|
-
}
|
|
2719
|
-
function ssrAttribute(key, value) {
|
|
2720
|
-
return value == null || value === false ? "" : value === true ? ` ${key}` : ` ${key}="${value}"`;
|
|
2721
|
-
}
|
|
2722
|
-
function ssrHydrationKey() {
|
|
2723
|
-
const hk = getHydrationKey();
|
|
2724
|
-
return hk ? ` _hk=${hk}` : "";
|
|
2725
|
-
}
|
|
2726
|
-
const CLAIM_PROP = /*#__PURE__*/Symbol.for("solid.claim-prop");
|
|
2727
|
-
const CLAIMS_STREAM = 1;
|
|
2728
|
-
const CLAIMS_DOCUMENT = 2;
|
|
2729
|
-
const CLAIM_UNSAFE = /[^A-Za-z0-9_.!~*'()-]/g;
|
|
2730
|
-
function encodeClaimKey(key) {
|
|
2731
|
-
return String(key).replace(CLAIM_UNSAFE, c => encodeURIComponent(c));
|
|
2732
|
-
}
|
|
2733
|
-
function ssrClaim(map) {
|
|
2734
|
-
const mode = solidJs.sharedConfig.context && solidJs.sharedConfig.context.claims;
|
|
2735
|
-
if (!mode || mode === CLAIMS_DOCUMENT && !(typeof solidJs.inServerComponentScope === "function" && solidJs.inServerComponentScope())) {
|
|
2736
|
-
return "";
|
|
2737
|
-
}
|
|
2738
|
-
let out = "";
|
|
2739
|
-
for (const pos in map) {
|
|
2740
|
-
const value = map[pos];
|
|
2741
|
-
const list = Array.isArray(value) ? value : [value];
|
|
2742
|
-
for (const fn of list) {
|
|
2743
|
-
const prop = typeof fn === "function" && fn[CLAIM_PROP] || undefined;
|
|
2744
|
-
if (prop === undefined) {
|
|
2745
|
-
{
|
|
2746
|
-
console.warn(`A \`${pos}\` position on a server-rendered element received a server-local ` + `${typeof fn} — this handler can never run. Pass the function through the ` + `server component's props from the client (compose on the client before ` + `passing), or bind a mutation to \`action=\`.`);
|
|
2747
|
-
}
|
|
2748
|
-
continue;
|
|
2749
|
-
}
|
|
2750
|
-
out += `${out ? "," : ""}${pos}=${encodeClaimKey(prop)}`;
|
|
2751
|
-
}
|
|
2752
|
-
}
|
|
2753
|
-
return out ? ` _bnd="${out}"` : "";
|
|
2754
|
-
}
|
|
2755
|
-
function decodeSSREntities(s) {
|
|
2756
|
-
return s.indexOf("&") < 0 ? s : s.replace(/"/g, '"').replace(/</g, "<").replace(/&/g, "&");
|
|
2757
|
-
}
|
|
2758
|
-
const SELECT_VALUE_ATTR = /\svalue(?:="([^"]*)")?(?=[\s>]|$)/;
|
|
2759
|
-
function tagEnd(html, i) {
|
|
2760
|
-
for (let j = i + 1; j < html.length; j++) {
|
|
2761
|
-
const c = html.charCodeAt(j);
|
|
2762
|
-
if (c === 34) {
|
|
2763
|
-
j = html.indexOf('"', j + 1);
|
|
2764
|
-
if (j < 0) return -1;
|
|
2765
|
-
} else if (c === 62) return j;
|
|
2766
|
-
}
|
|
2767
|
-
return -1;
|
|
2768
|
-
}
|
|
2769
|
-
function optionText(html, from) {
|
|
2770
|
-
let t = "";
|
|
2771
|
-
let i = from;
|
|
2772
|
-
for (;;) {
|
|
2773
|
-
const lt = html.indexOf("<", i);
|
|
2774
|
-
if (lt < 0) return t + html.slice(i);
|
|
2775
|
-
t += html.slice(i, lt);
|
|
2776
|
-
if (!html.startsWith("<!--", lt)) return t;
|
|
2777
|
-
const ce = html.indexOf("-->", lt);
|
|
2778
|
-
if (ce < 0) return t;
|
|
2779
|
-
i = ce + 3;
|
|
2780
|
-
}
|
|
2781
|
-
}
|
|
2782
|
-
function tagIs(html, i, name) {
|
|
2783
|
-
if (!html.startsWith(name, i + 1)) return false;
|
|
2784
|
-
const c = html.charCodeAt(i + 1 + name.length);
|
|
2785
|
-
return c === 32 || c === 62 || c === 9 || c === 10 || c === 13;
|
|
2786
|
-
}
|
|
2787
|
-
let selectValuesActive = false;
|
|
2788
|
-
function ssrSelectValues() {
|
|
2789
|
-
selectValuesActive = true;
|
|
2790
|
-
}
|
|
2791
|
-
function resolveSSRSelectValues(html) {
|
|
2792
|
-
if (!selectValuesActive) return html;
|
|
2793
|
-
let cand = html.indexOf("<select");
|
|
2794
|
-
if (cand < 0) return html;
|
|
2795
|
-
let out = "";
|
|
2796
|
-
let idx = 0;
|
|
2797
|
-
while (cand >= 0) {
|
|
2798
|
-
if (!tagIs(html, cand, "select")) {
|
|
2799
|
-
cand = html.indexOf("<select", cand + 7);
|
|
2800
|
-
continue;
|
|
2801
|
-
}
|
|
2802
|
-
const e0 = tagEnd(html, cand);
|
|
2803
|
-
if (e0 < 0) break;
|
|
2804
|
-
const open = html.slice(cand, e0 + 1);
|
|
2805
|
-
const m = SELECT_VALUE_ATTR.exec(open);
|
|
2806
|
-
if (!m) {
|
|
2807
|
-
cand = html.indexOf("<select", e0 + 1);
|
|
2808
|
-
continue;
|
|
2809
|
-
}
|
|
2810
|
-
const bound = decodeSSREntities(m[1] ?? "");
|
|
2811
|
-
const sel = {
|
|
2812
|
-
values: /\smultiple(?=[\s>=])/.test(open) ? bound.split(",") : [bound],
|
|
2813
|
-
strip: cand + m.index,
|
|
2814
|
-
stripEnd: cand + m.index + m[0].length,
|
|
2815
|
-
body: e0 + 1,
|
|
2816
|
-
marks: [],
|
|
2817
|
-
defaulted: false
|
|
2818
|
-
};
|
|
2819
|
-
let committed = false;
|
|
2820
|
-
let i = html.indexOf("<", e0 + 1);
|
|
2821
|
-
while (i >= 0) {
|
|
2822
|
-
let e;
|
|
2823
|
-
if (html.charCodeAt(i + 1) === 33) {
|
|
2824
|
-
e = html.charCodeAt(i + 2) === 45 ? html.indexOf("-->", i) : html.indexOf(">", i);
|
|
2825
|
-
if (e < 0) break;
|
|
2826
|
-
if (html.charCodeAt(i + 2) === 45) e += 2;
|
|
2827
|
-
} else {
|
|
2828
|
-
e = tagEnd(html, i);
|
|
2829
|
-
if (e < 0) break;
|
|
2830
|
-
if (html.startsWith("</select>", i)) {
|
|
2831
|
-
out += html.slice(idx, sel.strip) + html.slice(sel.stripEnd, sel.body);
|
|
2832
|
-
let seg = sel.body;
|
|
2833
|
-
if (!sel.defaulted) {
|
|
2834
|
-
for (let k = 0; k < sel.marks.length; k++) {
|
|
2835
|
-
out += html.slice(seg, sel.marks[k]) + " selected";
|
|
2836
|
-
seg = sel.marks[k];
|
|
2837
|
-
}
|
|
2838
|
-
}
|
|
2839
|
-
out += html.slice(seg, i);
|
|
2840
|
-
idx = i;
|
|
2841
|
-
committed = true;
|
|
2842
|
-
break;
|
|
2843
|
-
} else if (tagIs(html, i, "option")) {
|
|
2844
|
-
const attrs = html.slice(i + 7, e);
|
|
2845
|
-
if (/\sselected(?=[\s=]|$)/.test(attrs)) sel.defaulted = true;else {
|
|
2846
|
-
const vm = SELECT_VALUE_ATTR.exec(attrs);
|
|
2847
|
-
const value = vm ? decodeSSREntities(vm[1] ?? "") : decodeSSREntities(optionText(html, e + 1)).replace(/\s+/g, " ").trim();
|
|
2848
|
-
if (sel.values.includes(value)) sel.marks.push(e);
|
|
2849
|
-
}
|
|
2850
|
-
}
|
|
2851
|
-
}
|
|
2852
|
-
i = html.indexOf("<", e + 1);
|
|
2853
|
-
}
|
|
2854
|
-
if (!committed) break;
|
|
2855
|
-
cand = html.indexOf("<select", idx);
|
|
2856
|
-
}
|
|
2857
|
-
if (idx === 0) return html;
|
|
2858
|
-
return out + html.slice(idx);
|
|
2859
|
-
}
|
|
2860
|
-
function escape(s, attr) {
|
|
2861
|
-
const t = typeof s;
|
|
2862
|
-
if (t !== "string") {
|
|
2863
|
-
if (!attr && Array.isArray(s)) {
|
|
2864
|
-
const joined = tryJoinPlainSSRArray(s);
|
|
2865
|
-
if (joined !== undefined) return joined;
|
|
2866
|
-
s = s.slice();
|
|
2867
|
-
for (let i = 0; i < s.length; i++) s[i] = escape(s[i]);
|
|
2868
|
-
return s;
|
|
2869
|
-
}
|
|
2870
|
-
if (attr) {
|
|
2871
|
-
if (s == null || t === "boolean" || t === "number") return s;
|
|
2872
|
-
return escape(String(s), attr);
|
|
2873
|
-
}
|
|
2874
|
-
return s;
|
|
2875
|
-
}
|
|
2876
|
-
const i = s.search(attr ? ESCAPE_ATTR : ESCAPE_CONTENT);
|
|
2877
|
-
if (i < 0) return s;
|
|
2878
|
-
return escapeSlow(s, attr, i);
|
|
2879
|
-
}
|
|
2880
|
-
const ESCAPE_CONTENT = /[&<]/;
|
|
2881
|
-
const ESCAPE_ATTR = /[&"<]/;
|
|
2882
|
-
function escapeSlow(s, attr, start) {
|
|
2883
|
-
if (attr) return escapeAttrSlow(s, start);
|
|
2884
|
-
const c0 = s.charCodeAt(start);
|
|
2885
|
-
let iDelim = c0 === 60 ? start : s.indexOf("<", start);
|
|
2886
|
-
let iAmp = c0 === 38 ? start : s.indexOf("&", start);
|
|
2887
|
-
let left = 0,
|
|
2888
|
-
out = "";
|
|
2889
|
-
while (iDelim >= 0 && iAmp >= 0) {
|
|
2890
|
-
if (iDelim < iAmp) {
|
|
2891
|
-
if (left < iDelim) out += s.substring(left, iDelim);
|
|
2892
|
-
out += "<";
|
|
2893
|
-
left = iDelim + 1;
|
|
2894
|
-
iDelim = s.indexOf("<", left);
|
|
2895
|
-
} else {
|
|
2896
|
-
if (left < iAmp) out += s.substring(left, iAmp);
|
|
2897
|
-
out += "&";
|
|
2898
|
-
left = iAmp + 1;
|
|
2899
|
-
iAmp = s.indexOf("&", left);
|
|
2900
|
-
}
|
|
2901
|
-
}
|
|
2902
|
-
if (iDelim >= 0) {
|
|
2903
|
-
do {
|
|
2904
|
-
if (left < iDelim) out += s.substring(left, iDelim);
|
|
2905
|
-
out += "<";
|
|
2906
|
-
left = iDelim + 1;
|
|
2907
|
-
iDelim = s.indexOf("<", left);
|
|
2908
|
-
} while (iDelim >= 0);
|
|
2909
|
-
} else while (iAmp >= 0) {
|
|
2910
|
-
if (left < iAmp) out += s.substring(left, iAmp);
|
|
2911
|
-
out += "&";
|
|
2912
|
-
left = iAmp + 1;
|
|
2913
|
-
iAmp = s.indexOf("&", left);
|
|
2914
|
-
}
|
|
2915
|
-
return left < s.length ? out + s.substring(left) : out;
|
|
2916
|
-
}
|
|
2917
|
-
function escapeAttrSlow(s, start) {
|
|
2918
|
-
const c0 = s.charCodeAt(start);
|
|
2919
|
-
let iQuot = c0 === 34 ? start : s.indexOf('"', start);
|
|
2920
|
-
let iAmp = c0 === 38 ? start : s.indexOf("&", start);
|
|
2921
|
-
let iLt = c0 === 60 ? start : s.indexOf("<", start);
|
|
2922
|
-
let left = 0,
|
|
2923
|
-
out = "";
|
|
2924
|
-
for (;;) {
|
|
2925
|
-
let i = -1,
|
|
2926
|
-
ent;
|
|
2927
|
-
if (iQuot >= 0) {
|
|
2928
|
-
i = iQuot;
|
|
2929
|
-
ent = """;
|
|
2930
|
-
}
|
|
2931
|
-
if (iAmp >= 0 && (i < 0 || iAmp < i)) {
|
|
2932
|
-
i = iAmp;
|
|
2933
|
-
ent = "&";
|
|
2934
|
-
}
|
|
2935
|
-
if (iLt >= 0 && (i < 0 || iLt < i)) {
|
|
2936
|
-
i = iLt;
|
|
2937
|
-
ent = "<";
|
|
2938
|
-
}
|
|
2939
|
-
if (i < 0) break;
|
|
2940
|
-
if (left < i) out += s.substring(left, i);
|
|
2941
|
-
out += ent;
|
|
2942
|
-
left = i + 1;
|
|
2943
|
-
if (i === iQuot) iQuot = s.indexOf('"', left);else if (i === iAmp) iAmp = s.indexOf("&", left);else iLt = s.indexOf("<", left);
|
|
2944
|
-
}
|
|
2945
|
-
return left < s.length ? out + s.substring(left) : out;
|
|
2946
|
-
}
|
|
2947
|
-
function tryJoinPlainSSRArray(nodes) {
|
|
2948
|
-
if (nodes.length === 0) return undefined;
|
|
2949
|
-
let out = "";
|
|
2950
|
-
for (let i = 0, len = nodes.length; i < len; i++) {
|
|
2951
|
-
const node = nodes[i];
|
|
2952
|
-
if (node == null || typeof node !== "object" || node.h || typeof node.t !== "string") {
|
|
2953
|
-
return undefined;
|
|
2954
|
-
}
|
|
2955
|
-
out += node.t;
|
|
2956
|
-
}
|
|
2957
|
-
return out;
|
|
2958
|
-
}
|
|
2959
|
-
function getHydrationKey() {
|
|
2960
|
-
const hydrate = solidJs.sharedConfig.context;
|
|
2961
|
-
return hydrate && solidJs.sharedConfig.getNextContextId();
|
|
2962
|
-
}
|
|
2963
|
-
function applyRef(r, element) {
|
|
2964
|
-
Array.isArray(r) ? r.flat(Infinity).forEach(f => f && f(element)) : r(element);
|
|
2965
|
-
}
|
|
2966
|
-
function generateHydrationScript({
|
|
2967
|
-
eventNames = ["click", "input"],
|
|
2968
|
-
nonce
|
|
2969
|
-
} = {}) {
|
|
2970
|
-
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:{},fe(){}});</script><!--xs-->`;
|
|
2971
|
-
}
|
|
2972
|
-
function queue(fn) {
|
|
2973
|
-
return Promise.resolve().then(fn);
|
|
2974
|
-
}
|
|
2975
|
-
const deferFlush = typeof setImmediate === "function" ? setImmediate : fn => setTimeout(fn, 0);
|
|
2976
|
-
function allSettled(promises) {
|
|
2977
|
-
let size = promises.size;
|
|
2978
|
-
return Promise.allSettled(promises).then(() => {
|
|
2979
|
-
if (promises.size !== size) return allSettled(promises);
|
|
2980
|
-
return size;
|
|
2981
|
-
});
|
|
2982
|
-
}
|
|
2983
|
-
function assembleDocument(html, emittedAssets, preloadLinks, inlineStyles, scripts, nonce, headTags, onHead) {
|
|
2984
|
-
const scriptTag = scripts ? `<script${nonceAttr(nonce, "script")}>${scripts}</script>` : "";
|
|
2985
|
-
const title = headTags ? headTags.title : null;
|
|
2986
|
-
let headTagsHtml = headTags ? headTags.html : "";
|
|
2987
|
-
const headPrelude = headTags ? headTags.prelude : "";
|
|
2988
|
-
if (!onHead && title == null && !headTagsHtml && !headPrelude && !(emittedAssets && emittedAssets.size) && !preloadLinks && !(inlineStyles && inlineStyles.size)) {
|
|
2989
|
-
if (!scriptTag) return html;
|
|
2990
|
-
const xs = html.indexOf("<!--xs-->");
|
|
2991
|
-
return xs === -1 ? html + scriptTag : html.slice(0, xs) + scriptTag + html.slice(xs);
|
|
2992
|
-
}
|
|
2993
|
-
if (headPrelude) {
|
|
2994
|
-
const open = html.match(/<head(?:\s[^>]*)?>/);
|
|
2995
|
-
if (open) {
|
|
2996
|
-
const at = open.index + open[0].length;
|
|
2997
|
-
html = html.slice(0, at) + headPrelude + html.slice(at);
|
|
2998
|
-
}
|
|
2999
|
-
}
|
|
3000
|
-
let headIdx = html.indexOf("</head>");
|
|
3001
|
-
if (headIdx === -1) {
|
|
3002
|
-
if (onHead) {
|
|
3003
|
-
let titleHtml = "";
|
|
3004
|
-
if (title != null) {
|
|
3005
|
-
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>`;
|
|
3006
|
-
}
|
|
3007
|
-
onHead(headPrelude + headTagsHtml + titleHtml + renderHeadAssets(emittedAssets, preloadLinks, inlineStyles, nonce));
|
|
3008
|
-
}
|
|
3009
|
-
if (!scriptTag) return html;
|
|
3010
|
-
const xs = html.indexOf("<!--xs-->");
|
|
3011
|
-
return xs === -1 ? html + scriptTag : html.slice(0, xs) + scriptTag + html.slice(xs);
|
|
3012
|
-
}
|
|
3013
|
-
if (title != null) {
|
|
3014
|
-
const winner = escape(title);
|
|
3015
|
-
const open = html.match(/<head(?:\s[^>]*)?>/);
|
|
3016
|
-
const from = open ? open.index + open[0].length : 0;
|
|
3017
|
-
const m = /<title(\s[^>]*)?>([\s\S]*?)<\/title>/.exec(html.slice(from, headIdx));
|
|
3018
|
-
if (m) {
|
|
3019
|
-
const at = from + m.index;
|
|
3020
|
-
const stash = m[2].replace(/"/g, """);
|
|
3021
|
-
html = html.slice(0, at) + `<title${m[1] || ""} data-dh="title" data-dhf="${stash}">${winner}</title>` + html.slice(at + m[0].length);
|
|
3022
|
-
headIdx = html.indexOf("</head>");
|
|
3023
|
-
} else {
|
|
3024
|
-
headTagsHtml = `<title data-dh="title">${winner}</title>` + headTagsHtml;
|
|
3025
|
-
}
|
|
3026
|
-
}
|
|
3027
|
-
const head = headTagsHtml + renderHeadAssets(emittedAssets, preloadLinks, inlineStyles, nonce);
|
|
3028
|
-
if (!scriptTag) return html.slice(0, headIdx) + head + html.slice(headIdx);
|
|
3029
|
-
const xsIdx = html.indexOf("<!--xs-->");
|
|
3030
|
-
if (xsIdx === -1) return html.slice(0, headIdx) + head + html.slice(headIdx) + scriptTag;
|
|
3031
|
-
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);
|
|
3032
|
-
}
|
|
3033
|
-
function renderHeadAssets(emittedAssets, preloadLinks, inlineStyles, nonce) {
|
|
3034
|
-
let head = "";
|
|
3035
|
-
const styleAttr = nonceAttr(nonce, "style");
|
|
3036
|
-
const scriptAttr = nonceAttr(nonce, "script");
|
|
3037
|
-
if (emittedAssets && emittedAssets.size) {
|
|
3038
|
-
for (const url of emittedAssets) {
|
|
3039
|
-
head += isCssUrl(url) ? `<link rel="stylesheet" href="${url}"${styleAttr}>` : `<link rel="modulepreload" href="${url}"${scriptAttr}>`;
|
|
3040
|
-
}
|
|
3041
|
-
}
|
|
3042
|
-
if (preloadLinks) {
|
|
3043
|
-
for (const entry of preloadLinks) head += `<link${entry.attrHtml}>`;
|
|
3044
|
-
}
|
|
3045
|
-
if (inlineStyles && inlineStyles.size) {
|
|
3046
|
-
for (const entry of inlineStyles.values()) {
|
|
3047
|
-
if (entry.emitted) continue;
|
|
3048
|
-
entry.emitted = true;
|
|
3049
|
-
head += renderInlineStyle(entry, nonce);
|
|
3050
|
-
}
|
|
3051
|
-
}
|
|
3052
|
-
return head;
|
|
3053
|
-
}
|
|
3054
|
-
function serializeFragmentAssets(key, boundaryModules, context, name = key) {
|
|
3055
|
-
const map = boundaryModules.get(key);
|
|
3056
|
-
if (!map || !Object.keys(map).length) return;
|
|
3057
|
-
context.serialize(name + "_assets", {
|
|
3058
|
-
...map
|
|
3059
|
-
});
|
|
3060
|
-
}
|
|
3061
|
-
function propagateBoundaryStyles(childKey, parentKey, tracking) {
|
|
3062
|
-
const childStyles = tracking.getBoundaryStyles(childKey);
|
|
3063
|
-
if (!childStyles) return;
|
|
3064
|
-
let parentStyles = tracking.boundaryStyles.get(parentKey);
|
|
3065
|
-
if (!parentStyles) {
|
|
3066
|
-
parentStyles = new Set();
|
|
3067
|
-
tracking.boundaryStyles.set(parentKey, parentStyles);
|
|
3068
|
-
}
|
|
3069
|
-
for (const url of childStyles) {
|
|
3070
|
-
parentStyles.add(url);
|
|
3071
|
-
}
|
|
3072
|
-
}
|
|
3073
|
-
function collectStreamStyles(key, tracking, headStyles) {
|
|
3074
|
-
const styles = tracking.getBoundaryStyles(key);
|
|
3075
|
-
const links = [];
|
|
3076
|
-
const inline = [];
|
|
3077
|
-
if (!styles) return {
|
|
3078
|
-
links,
|
|
3079
|
-
inline
|
|
3080
|
-
};
|
|
3081
|
-
for (const entry of styles) {
|
|
3082
|
-
if (typeof entry === "string") {
|
|
3083
|
-
if (!headStyles || !headStyles.has(entry)) links.push(entry);
|
|
3084
|
-
} else if (entry.emitted) {
|
|
3085
|
-
continue;
|
|
3086
|
-
} else if (entry.attrHtml !== undefined) {
|
|
3087
|
-
entry.emitted = true;
|
|
3088
|
-
links.push(entry);
|
|
3089
|
-
} else {
|
|
3090
|
-
entry.emitted = true;
|
|
3091
|
-
inline.push(entry);
|
|
3092
|
-
}
|
|
3093
|
-
}
|
|
3094
|
-
return {
|
|
3095
|
-
links,
|
|
3096
|
-
inline
|
|
3097
|
-
};
|
|
3098
|
-
}
|
|
3099
|
-
function escapeStyleContent(content) {
|
|
3100
|
-
return content.replace(/<\/(style)/gi, "<\\/$1");
|
|
3101
|
-
}
|
|
3102
|
-
function renderInlineStyle(entry, nonce) {
|
|
3103
|
-
let attrs = "";
|
|
3104
|
-
let hasNonce = false;
|
|
3105
|
-
if (entry.attrs) {
|
|
3106
|
-
for (const name in entry.attrs) {
|
|
3107
|
-
if (name.length === 5 && asciiLowerCase(name) === "nonce") hasNonce = true;
|
|
3108
|
-
attrs += ` ${name}="${escape(String(entry.attrs[name]), true)}"`;
|
|
3109
|
-
}
|
|
3110
|
-
}
|
|
3111
|
-
const nonceHtml = hasNonce ? "" : nonceAttr(nonce, "style");
|
|
3112
|
-
return `<style${nonceHtml} data-asset="${escape(entry.id, true)}"${attrs}>${escapeStyleContent(entry.content)}</style>`;
|
|
3113
|
-
}
|
|
3114
|
-
function waitForFragments(registry, key) {
|
|
3115
|
-
for (const k of [...registry.keys()].reverse()) {
|
|
3116
|
-
if (key.startsWith(k)) return k;
|
|
3117
|
-
}
|
|
3118
|
-
return false;
|
|
3119
|
-
}
|
|
3120
|
-
function replacePlaceholder(html, key, value) {
|
|
3121
|
-
const marker = `<template id="pl-${key}">`;
|
|
3122
|
-
const close = `<!--pl-${key}-->`;
|
|
3123
|
-
const first = html.indexOf(marker);
|
|
3124
|
-
if (first === -1) return html;
|
|
3125
|
-
const last = html.indexOf(close, first + marker.length);
|
|
3126
|
-
return html.slice(0, first) + value + html.slice(last + close.length);
|
|
3127
|
-
}
|
|
3128
|
-
function classListToObject(classList) {
|
|
3129
|
-
if (Array.isArray(classList)) {
|
|
3130
|
-
const result = {};
|
|
3131
|
-
flattenClassList(classList, result);
|
|
3132
|
-
return result;
|
|
3133
|
-
}
|
|
3134
|
-
return classList;
|
|
3135
|
-
}
|
|
3136
|
-
function flattenClassList(list, result) {
|
|
3137
|
-
for (let i = 0, len = list.length; i < len; i++) {
|
|
3138
|
-
const item = list[i];
|
|
3139
|
-
if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);
|
|
3140
|
-
else if (typeof item !== "boolean" && (item || item === 0)) result[item] = true;
|
|
3141
|
-
}
|
|
3142
|
-
}
|
|
3143
|
-
function tryResolveString(node) {
|
|
3144
|
-
const t = typeof node;
|
|
3145
|
-
if (t === "string") return node;
|
|
3146
|
-
if (t === "number") return "" + node;
|
|
3147
|
-
if (node == null || t === "boolean") return "";
|
|
3148
|
-
if (t === "object") {
|
|
3149
|
-
if (Array.isArray(node)) {
|
|
3150
|
-
const joined = tryJoinPlainSSRArray(node);
|
|
3151
|
-
if (joined !== undefined) return joined;
|
|
3152
|
-
let s = "";
|
|
3153
|
-
let prevNonObj = false;
|
|
3154
|
-
for (let i = 0, len = node.length; i < len; i++) {
|
|
3155
|
-
const item = node[i];
|
|
3156
|
-
const itemNonObj = item !== null && typeof item !== "object";
|
|
3157
|
-
if (prevNonObj && itemNonObj) s += "<!--!$-->";
|
|
3158
|
-
prevNonObj = itemNonObj;
|
|
3159
|
-
const r = tryResolveString(item);
|
|
3160
|
-
if (typeof r !== "string") return {
|
|
3161
|
-
bail: node
|
|
3162
|
-
};
|
|
3163
|
-
s += r;
|
|
3164
|
-
}
|
|
3165
|
-
return s;
|
|
3166
|
-
}
|
|
3167
|
-
if (node.h && node.h.length > 0) return {
|
|
3168
|
-
merge: node
|
|
3169
|
-
};
|
|
3170
|
-
if (node.t === undefined) {
|
|
3171
|
-
console.warn(`Unrecognized value. Skipped inserting`, node);
|
|
3172
|
-
return "";
|
|
3173
|
-
}
|
|
3174
|
-
return Array.isArray(node.t) ? node.t[0] : node.t;
|
|
3175
|
-
}
|
|
3176
|
-
if (t === "function") {
|
|
3177
|
-
let v;
|
|
3178
|
-
try {
|
|
3179
|
-
v = node();
|
|
3180
|
-
} catch (err) {
|
|
3181
|
-
return buildAsyncWrap(err, node) || "";
|
|
3182
|
-
}
|
|
3183
|
-
return tryResolveString(v);
|
|
3184
|
-
}
|
|
3185
|
-
return "";
|
|
3186
|
-
}
|
|
3187
|
-
function resolveSSRNode(node, result = {
|
|
3188
|
-
t: [""],
|
|
3189
|
-
h: [],
|
|
3190
|
-
p: []
|
|
3191
|
-
}, top) {
|
|
3192
|
-
const t = typeof node;
|
|
3193
|
-
if (t === "string" || t === "number") {
|
|
3194
|
-
result.t[result.t.length - 1] += node;
|
|
3195
|
-
} else if (node == null || t === "boolean") ; else if (Array.isArray(node)) {
|
|
3196
|
-
const slotLive = node.$slot && solidJs.sharedConfig.context && solidJs.sharedConfig.context.liveHoles;
|
|
3197
|
-
if (slotLive) slotLive.suppressed++;
|
|
3198
|
-
try {
|
|
3199
|
-
let prevNonObj = false;
|
|
3200
|
-
for (let i = 0, len = node.length; i < len; i++) {
|
|
3201
|
-
const item = node[i];
|
|
3202
|
-
const itemNonObj = item !== null && typeof item !== "object";
|
|
3203
|
-
if (!top && prevNonObj && itemNonObj) result.t[result.t.length - 1] += `<!--!$-->`;
|
|
3204
|
-
prevNonObj = itemNonObj;
|
|
3205
|
-
resolveSSRNode(item, result);
|
|
3206
|
-
}
|
|
3207
|
-
} finally {
|
|
3208
|
-
if (slotLive) slotLive.suppressed--;
|
|
3209
|
-
}
|
|
3210
|
-
} else if (t === "object") {
|
|
3211
|
-
if (node.h) {
|
|
3212
|
-
result.t[result.t.length - 1] += node.t[0];
|
|
3213
|
-
if (node.t.length > 1) {
|
|
3214
|
-
result.t.push(...node.t.slice(1));
|
|
3215
|
-
result.h.push(...node.h);
|
|
3216
|
-
result.p.push(...node.p);
|
|
3217
|
-
}
|
|
3218
|
-
} else if (node.t !== undefined) {
|
|
3219
|
-
result.t[result.t.length - 1] += node.t;
|
|
3220
|
-
} else console.warn(`Unrecognized value. Skipped inserting`, node);
|
|
3221
|
-
} else if (t === "function") {
|
|
3222
|
-
const live = solidJs.sharedConfig.context && solidJs.sharedConfig.context.liveHoles;
|
|
3223
|
-
let liveNode = null;
|
|
3224
|
-
if (live && (liveNode = live.content(node)) !== null) {
|
|
3225
|
-
if (typeof liveNode === "string") result.t[result.t.length - 1] += liveNode;else resolveSSRNode(liveNode, result);
|
|
3226
|
-
} else {
|
|
3227
|
-
try {
|
|
3228
|
-
resolveSSRNode(node(), result);
|
|
3229
|
-
} catch (err) {
|
|
3230
|
-
const wrap = buildAsyncWrap(err, node);
|
|
3231
|
-
if (wrap) {
|
|
3232
|
-
result.h.push(wrap.fn);
|
|
3233
|
-
result.p.push(wrap.p);
|
|
3234
|
-
result.t.push("");
|
|
3235
|
-
}
|
|
3236
|
-
}
|
|
3237
|
-
}
|
|
3238
|
-
}
|
|
3239
|
-
return result;
|
|
3240
|
-
}
|
|
3241
|
-
function resolveSSRSync(node) {
|
|
3242
|
-
const res = resolveSSRNode(node);
|
|
3243
|
-
if (!res.h.length) return res.t[0];
|
|
3244
|
-
throw new Error("This value cannot be rendered synchronously. Are you missing a boundary?");
|
|
3245
|
-
}
|
|
3246
|
-
const RequestContext = Symbol.for("solid.RequestContext");
|
|
3247
|
-
function getRequestEvent() {
|
|
3248
|
-
return globalThis[RequestContext] ? globalThis[RequestContext].getStore() || solidJs.sharedConfig.context && solidJs.sharedConfig.context.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.") : undefined;
|
|
3249
|
-
}
|
|
3250
|
-
function peekRequestEvent() {
|
|
3251
|
-
const store = globalThis[RequestContext];
|
|
3252
|
-
return store ? store.getStore() : undefined;
|
|
3253
|
-
}
|
|
3254
|
-
function createResponseStub() {
|
|
3255
|
-
return {
|
|
3256
|
-
status: undefined,
|
|
3257
|
-
statusText: undefined,
|
|
3258
|
-
headers: new Headers(),
|
|
3259
|
-
committed: false
|
|
3260
|
-
};
|
|
3261
|
-
}
|
|
3262
|
-
function createRequestEvent(request, init) {
|
|
3263
|
-
return {
|
|
3264
|
-
request,
|
|
3265
|
-
locals: {},
|
|
3266
|
-
response: createResponseStub(),
|
|
3267
|
-
...init
|
|
3268
|
-
};
|
|
3269
|
-
}
|
|
3270
|
-
function reportLostHeaderWrite(method, name) {
|
|
3271
|
-
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).";
|
|
3272
|
-
throw new Error(message);
|
|
3273
|
-
}
|
|
3274
|
-
function commitResponseStub(stub, {
|
|
3275
|
-
allowLateLocation = false
|
|
3276
|
-
} = {}) {
|
|
3277
|
-
if (!stub || stub.committed) return stub;
|
|
3278
|
-
stub.committed = true;
|
|
3279
|
-
const headers = stub.headers;
|
|
3280
|
-
if (!headers || typeof headers.set !== "function") return stub;
|
|
3281
|
-
for (const method of ["set", "append", "delete"]) {
|
|
3282
|
-
const original = headers[method].bind(headers);
|
|
3283
|
-
headers[method] = function (name, ...rest) {
|
|
3284
|
-
if (allowLateLocation && method === "set" && String(name).toLowerCase() === "location") {
|
|
3285
|
-
return original(name, ...rest);
|
|
3286
|
-
}
|
|
3287
|
-
reportLostHeaderWrite(method, name);
|
|
3288
|
-
};
|
|
3289
|
-
}
|
|
3290
|
-
return stub;
|
|
3291
|
-
}
|
|
3292
|
-
const validRedirectStatuses = /*#__PURE__*/new Set([301, 302, 303, 307, 308]);
|
|
3293
|
-
function getExpectedRedirectStatus(response) {
|
|
3294
|
-
if (response.status && validRedirectStatuses.has(response.status)) return response.status;
|
|
3295
|
-
return 302;
|
|
3296
|
-
}
|
|
3297
|
-
function mergeStubHeaders(target, stub) {
|
|
3298
|
-
if (!stub) return target;
|
|
3299
|
-
stub.headers.forEach((value, key) => {
|
|
3300
|
-
if (key !== "set-cookie") target.set(key, value);
|
|
3301
|
-
});
|
|
3302
|
-
const setCookies = stub.headers.getSetCookie ? stub.headers.getSetCookie() : [];
|
|
3303
|
-
for (const cookie of setCookies) target.append("set-cookie", cookie);
|
|
3304
|
-
return target;
|
|
3305
|
-
}
|
|
3306
|
-
function copyInitHeaders(init) {
|
|
3307
|
-
if (!init || !init.getSetCookie) return new Headers(init);
|
|
3308
|
-
const headers = new Headers();
|
|
3309
|
-
init.forEach((value, key) => {
|
|
3310
|
-
if (key !== "set-cookie") headers.append(key, value);
|
|
3311
|
-
});
|
|
3312
|
-
for (const cookie of init.getSetCookie()) headers.append("Set-Cookie", cookie);
|
|
3313
|
-
return headers;
|
|
3314
|
-
}
|
|
3315
|
-
const STUB_GAP_FILL_EXCLUDED = /*#__PURE__*/new Set([ERROR_HEADER, BODY_FORMAT_HEADER, SINGLE_FLIGHT_HEADER, REVALIDATE_HEADER, REDIRECT_HEADER, "Location",
|
|
3316
|
-
...COMPOSED_BODY_FRAMING].map(header => header.toLowerCase()));
|
|
3317
|
-
function fillsStubGap(key, headers, response) {
|
|
3318
|
-
if (key === "set-cookie" || STUB_GAP_FILL_EXCLUDED.has(key)) return false;
|
|
3319
|
-
if (response.body === null && (key === "content-type" || key === "content-length")) return false;
|
|
3320
|
-
return !headers.has(key);
|
|
3321
|
-
}
|
|
3322
|
-
function commitEventResponse(response, event = getRequestEvent()) {
|
|
3323
|
-
const stub = event && event.response;
|
|
3324
|
-
if (!stub || !stub.headers || stub.committed) return response;
|
|
3325
|
-
const cookies = stub.headers.getSetCookie ? stub.headers.getSetCookie() : [];
|
|
3326
|
-
commitResponseStub(stub);
|
|
3327
|
-
let hasGaps = false;
|
|
3328
|
-
stub.headers.forEach((value, key) => {
|
|
3329
|
-
if (fillsStubGap(key, response.headers, response)) hasGaps = true;
|
|
3330
|
-
});
|
|
3331
|
-
if (!cookies.length && !hasGaps) return response;
|
|
3332
|
-
const headers = copyInitHeaders(response.headers);
|
|
3333
|
-
for (const cookie of cookies) headers.append("Set-Cookie", cookie);
|
|
3334
|
-
stub.headers.forEach((value, key) => {
|
|
3335
|
-
if (fillsStubGap(key, headers, response)) headers.set(key, value);
|
|
3336
|
-
});
|
|
3337
|
-
return new Response(response.body, {
|
|
3338
|
-
status: response.status,
|
|
3339
|
-
statusText: response.statusText,
|
|
3340
|
-
headers
|
|
3341
|
-
});
|
|
3342
|
-
}
|
|
3343
|
-
function deriveHead(stub, responseInit = {}) {
|
|
3344
|
-
const headers = mergeStubHeaders(copyInitHeaders(responseInit.headers), stub);
|
|
3345
|
-
for (const header of COMPOSED_BODY_FRAMING) headers.delete(header);
|
|
3346
|
-
const status = stub && stub.status || responseInit.status || 200;
|
|
3347
|
-
const statusText = stub && stub.statusText || responseInit.statusText || undefined;
|
|
3348
|
-
return {
|
|
3349
|
-
status,
|
|
3350
|
-
statusText,
|
|
3351
|
-
headers
|
|
3352
|
-
};
|
|
3353
|
-
}
|
|
3354
|
-
function createSSRResponse(result, event, options = {}) {
|
|
3355
|
-
const stub = event && event.response;
|
|
3356
|
-
const {
|
|
3357
|
-
responseInit,
|
|
3358
|
-
transformChunk
|
|
3359
|
-
} = options;
|
|
3360
|
-
const nonce = normalizeNonce(options.nonce);
|
|
3361
|
-
if (typeof result === "string") {
|
|
3362
|
-
if (stub) commitResponseStub(stub);
|
|
3363
|
-
const head = deriveHead(stub, responseInit);
|
|
3364
|
-
if (stub && stub.headers.get("Location")) {
|
|
3365
|
-
return new Response(null, {
|
|
3366
|
-
status: getExpectedRedirectStatus(stub),
|
|
3367
|
-
headers: head.headers
|
|
3368
|
-
});
|
|
3369
|
-
}
|
|
3370
|
-
if (!head.headers.has("content-type")) {
|
|
3371
|
-
head.headers.set("content-type", "text/html; charset=utf-8");
|
|
3372
|
-
}
|
|
3373
|
-
return new Response(transformChunk ? transformChunk(result) : result, {
|
|
3374
|
-
status: head.status,
|
|
3375
|
-
statusText: head.statusText,
|
|
3376
|
-
headers: head.headers
|
|
3377
|
-
});
|
|
3378
|
-
}
|
|
3379
|
-
const encoder = new TextEncoder();
|
|
3380
|
-
return new Promise(resolve => {
|
|
3381
|
-
let controller;
|
|
3382
|
-
let closed = false;
|
|
3383
|
-
let flushed = false;
|
|
3384
|
-
const enqueue = value => {
|
|
3385
|
-
if (closed || !controller) return;
|
|
3386
|
-
try {
|
|
3387
|
-
controller.enqueue(encoder.encode(value));
|
|
3388
|
-
} catch {
|
|
3389
|
-
closed = true;
|
|
3390
|
-
}
|
|
3391
|
-
};
|
|
3392
|
-
result.pipe({
|
|
3393
|
-
write(chunk) {
|
|
3394
|
-
if (!flushed) {
|
|
3395
|
-
flushed = true;
|
|
3396
|
-
if (stub) commitResponseStub(stub, {
|
|
3397
|
-
allowLateLocation: true
|
|
3398
|
-
});
|
|
3399
|
-
const head = deriveHead(stub, responseInit);
|
|
3400
|
-
if (stub && stub.headers.get("Location")) {
|
|
3401
|
-
closed = true;
|
|
3402
|
-
resolve(new Response(null, {
|
|
3403
|
-
status: getExpectedRedirectStatus(stub),
|
|
3404
|
-
headers: head.headers
|
|
3405
|
-
}));
|
|
3406
|
-
return;
|
|
3407
|
-
}
|
|
3408
|
-
if (!head.headers.has("content-type")) {
|
|
3409
|
-
head.headers.set("content-type", "text/html; charset=utf-8");
|
|
3410
|
-
}
|
|
3411
|
-
resolve(new Response(new ReadableStream({
|
|
3412
|
-
start(c) {
|
|
3413
|
-
controller = c;
|
|
3414
|
-
},
|
|
3415
|
-
cancel() {
|
|
3416
|
-
closed = true;
|
|
3417
|
-
}
|
|
3418
|
-
}), {
|
|
3419
|
-
status: head.status,
|
|
3420
|
-
statusText: head.statusText,
|
|
3421
|
-
headers: head.headers
|
|
3422
|
-
}));
|
|
3423
|
-
}
|
|
3424
|
-
enqueue(transformChunk ? transformChunk(chunk) : chunk);
|
|
3425
|
-
},
|
|
3426
|
-
end() {
|
|
3427
|
-
if (closed || !controller) return;
|
|
3428
|
-
const location = stub && stub.headers.get("Location");
|
|
3429
|
-
if (location && isHttpNavigationTarget(location)) {
|
|
3430
|
-
const attr = nonceAttr(nonce, "script");
|
|
3431
|
-
enqueue(`<script${attr}>window.location=${JSON.stringify(location).replace(/</g, "\\u003c")}</script>`);
|
|
3432
|
-
}
|
|
3433
|
-
closed = true;
|
|
3434
|
-
try {
|
|
3435
|
-
controller.close();
|
|
3436
|
-
} catch {}
|
|
3437
|
-
}
|
|
3438
|
-
});
|
|
3439
|
-
});
|
|
3440
|
-
}
|
|
3441
|
-
function composeMiddleware(middlewares) {
|
|
3442
|
-
return function run(request, next) {
|
|
3443
|
-
let index = -1;
|
|
3444
|
-
function dispatch(i, req) {
|
|
3445
|
-
if (i <= index) return Promise.reject(new Error("next() called multiple times"));
|
|
3446
|
-
index = i;
|
|
3447
|
-
if (i === middlewares.length) return Promise.resolve(next(req));
|
|
3448
|
-
return Promise.resolve(middlewares[i](req, override => dispatch(i + 1, override || req)));
|
|
3449
|
-
}
|
|
3450
|
-
return dispatch(0, request);
|
|
3451
|
-
};
|
|
3452
|
-
}
|
|
3453
|
-
function registerElementClaim() {
|
|
3454
|
-
return noopCleanup;
|
|
3455
|
-
}
|
|
3456
|
-
function noopCleanup() {}
|
|
3457
|
-
function claimElement(node) {
|
|
3458
|
-
return node;
|
|
3459
|
-
}
|
|
3460
|
-
function claimElementTree(root) {
|
|
3461
|
-
return root;
|
|
3462
|
-
}
|
|
3463
|
-
function notSup() {
|
|
3464
|
-
throw new Error("Client-only API called on the server side. Run client-only code in onMount, or conditionally run client-only component with <Show>.");
|
|
3465
|
-
}
|
|
3466
|
-
|
|
3467
|
-
setContainerTraceResolver(solidJs.getProjectionTrace);
|
|
3468
|
-
const isServer = true;
|
|
3469
|
-
const isDev = true;
|
|
3470
|
-
function dynamic(source, options) {
|
|
3471
|
-
const cached = solidJs.createMemo(source, {
|
|
3472
|
-
serialize: false
|
|
3473
|
-
});
|
|
3474
|
-
const deferStream = !!options?.deferStream;
|
|
3475
|
-
return props => {
|
|
3476
|
-
const ctx = solidJs.sharedConfig.context;
|
|
3477
|
-
let gated = !deferStream || !ctx?.async;
|
|
3478
|
-
return solidJs.createMemo(() => {
|
|
3479
|
-
let c;
|
|
3480
|
-
try {
|
|
3481
|
-
c = cached();
|
|
3482
|
-
} catch (err) {
|
|
3483
|
-
if (!gated && err instanceof solidJs.NotReadyError) {
|
|
3484
|
-
gated = true;
|
|
3485
|
-
ctx.block(Promise.resolve(err.source).then(() => {}, () => {}));
|
|
3486
|
-
}
|
|
3487
|
-
throw err;
|
|
3488
|
-
}
|
|
3489
|
-
if (c) {
|
|
3490
|
-
if (typeof c === "function") return c(props);
|
|
3491
|
-
if (typeof c === "string") {
|
|
3492
|
-
return ssrElement(c, props, undefined, true);
|
|
3493
|
-
}
|
|
3494
|
-
}
|
|
3495
|
-
}, {
|
|
3496
|
-
sync: true
|
|
3497
|
-
});
|
|
3498
|
-
};
|
|
3499
|
-
}
|
|
3500
|
-
function Dynamic(props) {
|
|
3501
|
-
const Comp = dynamic(() => props.component);
|
|
3502
|
-
return solidJs.createComponent(Comp, solidJs.omit(props, "component"));
|
|
3503
|
-
}
|
|
3504
|
-
function Portal(props) {
|
|
3505
|
-
const o = solidJs.getOwner();
|
|
3506
|
-
if (o?.id != null) solidJs.getNextChildId(o);
|
|
3507
|
-
return undefined;
|
|
3508
|
-
}
|
|
3509
|
-
function registerClientOnlyPreload(moduleUrl) {
|
|
3510
|
-
const ctx = solidJs.sharedConfig.context;
|
|
3511
|
-
if (!ctx?.registerAsset || !ctx.resolveAssets) return;
|
|
3512
|
-
const registerAsset = ctx.registerAsset;
|
|
3513
|
-
const resolve = ctx.resolveAssets;
|
|
3514
|
-
const apply = assets => {
|
|
3515
|
-
if (!assets) return;
|
|
3516
|
-
for (let i = 0; i < assets.css.length; i++) {
|
|
3517
|
-
const css = assets.css[i];
|
|
3518
|
-
if (typeof css === "string") registerAsset("style", css);else registerAsset("inline-style", css);
|
|
3519
|
-
}
|
|
3520
|
-
if (assets.preloads) {
|
|
3521
|
-
for (let i = 0; i < assets.preloads.length; i++) {
|
|
3522
|
-
registerAsset("preload", assets.preloads[i]);
|
|
3523
|
-
}
|
|
3524
|
-
}
|
|
3525
|
-
for (let i = 0; i < assets.js.length; i++) registerAsset("module", assets.js[i]);
|
|
3526
|
-
};
|
|
3527
|
-
const assets = resolve(moduleUrl);
|
|
3528
|
-
if (assets && typeof assets.then === "function") {
|
|
3529
|
-
const boundary = ctx._currentBoundaryId;
|
|
3530
|
-
assets.then(resolved => {
|
|
3531
|
-
const current = ctx._currentBoundaryId;
|
|
3532
|
-
ctx._currentBoundaryId = boundary;
|
|
3533
|
-
try {
|
|
3534
|
-
apply(resolved);
|
|
3535
|
-
} finally {
|
|
3536
|
-
ctx._currentBoundaryId = current;
|
|
3537
|
-
}
|
|
3538
|
-
},
|
|
3539
|
-
() => {});
|
|
3540
|
-
} else {
|
|
3541
|
-
apply(assets);
|
|
3542
|
-
}
|
|
3543
|
-
}
|
|
3544
|
-
function clientOnly(_fn, _options = {}, moduleUrl) {
|
|
3545
|
-
return props => {
|
|
3546
|
-
if (moduleUrl) registerClientOnlyPreload(moduleUrl);
|
|
3547
|
-
return solidJs.createMemo(() => props.fallback);
|
|
3548
|
-
};
|
|
3549
|
-
}
|
|
3550
|
-
const statusLedgers = /* @__PURE__ */new WeakMap();
|
|
3551
|
-
const headerLedgers = /* @__PURE__ */new WeakMap();
|
|
3552
|
-
function httpStatus(code, text) {
|
|
3553
|
-
const event = getRequestEvent();
|
|
3554
|
-
const response = event && event.response;
|
|
3555
|
-
if (response && !response.committed) {
|
|
3556
|
-
let ledger = statusLedgers.get(response);
|
|
3557
|
-
if (!ledger) {
|
|
3558
|
-
ledger = {
|
|
3559
|
-
base: {
|
|
3560
|
-
status: response.status,
|
|
3561
|
-
statusText: response.statusText
|
|
3562
|
-
},
|
|
3563
|
-
live: []
|
|
3564
|
-
};
|
|
3565
|
-
statusLedgers.set(response, ledger);
|
|
3566
|
-
}
|
|
3567
|
-
const declaration = {
|
|
3568
|
-
status: code,
|
|
3569
|
-
statusText: text
|
|
3570
|
-
};
|
|
3571
|
-
ledger.live.push(declaration);
|
|
3572
|
-
response.status = code;
|
|
3573
|
-
response.statusText = text;
|
|
3574
|
-
solidJs.onCleanup(() => {
|
|
3575
|
-
if (response.committed) return;
|
|
3576
|
-
const index = ledger.live.indexOf(declaration);
|
|
3577
|
-
if (index < 0) return;
|
|
3578
|
-
ledger.live.splice(index, 1);
|
|
3579
|
-
const effective = ledger.live.length ? ledger.live[ledger.live.length - 1] : ledger.base;
|
|
3580
|
-
response.status = effective.status;
|
|
3581
|
-
response.statusText = effective.statusText;
|
|
3582
|
-
if (!ledger.live.length) statusLedgers.delete(response);
|
|
3583
|
-
});
|
|
3584
|
-
}
|
|
3585
|
-
}
|
|
3586
|
-
function httpHeader(name, value, options) {
|
|
3587
|
-
const event = getRequestEvent();
|
|
3588
|
-
const response = event && event.response;
|
|
3589
|
-
if (response && !response.committed) {
|
|
3590
|
-
const headers = response.headers;
|
|
3591
|
-
const key = name.toLowerCase();
|
|
3592
|
-
const setCookie = key === "set-cookie";
|
|
3593
|
-
let ledgers = headerLedgers.get(response);
|
|
3594
|
-
if (!ledgers) headerLedgers.set(response, ledgers = new Map());
|
|
3595
|
-
let ledger = ledgers.get(key);
|
|
3596
|
-
if (!ledger) {
|
|
3597
|
-
ledger = {
|
|
3598
|
-
base: setCookie ? headers.getSetCookie() : headers.get(name),
|
|
3599
|
-
live: []
|
|
3600
|
-
};
|
|
3601
|
-
ledgers.set(key, ledger);
|
|
3602
|
-
}
|
|
3603
|
-
const declaration = {
|
|
3604
|
-
value,
|
|
3605
|
-
append: !!(options && options.append)
|
|
3606
|
-
};
|
|
3607
|
-
ledger.live.push(declaration);
|
|
3608
|
-
if (declaration.append) headers.append(name, value);else headers.set(name, value);
|
|
3609
|
-
solidJs.onCleanup(() => {
|
|
3610
|
-
if (response.committed) return;
|
|
3611
|
-
const index = ledger.live.indexOf(declaration);
|
|
3612
|
-
if (index < 0) return;
|
|
3613
|
-
ledger.live.splice(index, 1);
|
|
3614
|
-
headers.delete(name);
|
|
3615
|
-
if (setCookie) {
|
|
3616
|
-
for (const cookie of ledger.base) headers.append(name, cookie);
|
|
3617
|
-
} else if (ledger.base !== null) {
|
|
3618
|
-
headers.set(name, ledger.base);
|
|
3619
|
-
}
|
|
3620
|
-
for (const d of ledger.live) {
|
|
3621
|
-
if (d.append) headers.append(name, d.value);else headers.set(name, d.value);
|
|
3622
|
-
}
|
|
3623
|
-
if (!ledger.live.length) ledgers.delete(key);
|
|
3624
|
-
});
|
|
3625
|
-
}
|
|
3626
|
-
}
|
|
3627
|
-
|
|
3628
|
-
Object.defineProperty(exports, "Errored", {
|
|
3629
|
-
enumerable: true,
|
|
3630
|
-
get: function () { return solidJs.Errored; }
|
|
3631
|
-
});
|
|
3632
|
-
Object.defineProperty(exports, "For", {
|
|
3633
|
-
enumerable: true,
|
|
3634
|
-
get: function () { return solidJs.For; }
|
|
3635
|
-
});
|
|
3636
|
-
Object.defineProperty(exports, "Hydration", {
|
|
3637
|
-
enumerable: true,
|
|
3638
|
-
get: function () { return solidJs.Hydration; }
|
|
3639
|
-
});
|
|
3640
|
-
Object.defineProperty(exports, "Loading", {
|
|
3641
|
-
enumerable: true,
|
|
3642
|
-
get: function () { return solidJs.Loading; }
|
|
3643
|
-
});
|
|
3644
|
-
Object.defineProperty(exports, "Match", {
|
|
3645
|
-
enumerable: true,
|
|
3646
|
-
get: function () { return solidJs.Match; }
|
|
3647
|
-
});
|
|
3648
|
-
Object.defineProperty(exports, "NoHydration", {
|
|
3649
|
-
enumerable: true,
|
|
3650
|
-
get: function () { return solidJs.NoHydration; }
|
|
3651
|
-
});
|
|
3652
|
-
Object.defineProperty(exports, "Repeat", {
|
|
3653
|
-
enumerable: true,
|
|
3654
|
-
get: function () { return solidJs.Repeat; }
|
|
3655
|
-
});
|
|
3656
|
-
Object.defineProperty(exports, "Reveal", {
|
|
3657
|
-
enumerable: true,
|
|
3658
|
-
get: function () { return solidJs.Reveal; }
|
|
3659
|
-
});
|
|
3660
|
-
Object.defineProperty(exports, "Show", {
|
|
3661
|
-
enumerable: true,
|
|
3662
|
-
get: function () { return solidJs.Show; }
|
|
3663
|
-
});
|
|
3664
|
-
Object.defineProperty(exports, "Switch", {
|
|
3665
|
-
enumerable: true,
|
|
3666
|
-
get: function () { return solidJs.Switch; }
|
|
3667
|
-
});
|
|
3668
|
-
Object.defineProperty(exports, "createComponent", {
|
|
3669
|
-
enumerable: true,
|
|
3670
|
-
get: function () { return solidJs.createComponent; }
|
|
3671
|
-
});
|
|
3672
|
-
Object.defineProperty(exports, "getOwner", {
|
|
3673
|
-
enumerable: true,
|
|
3674
|
-
get: function () { return solidJs.getOwner; }
|
|
3675
|
-
});
|
|
3676
|
-
Object.defineProperty(exports, "mergeProps", {
|
|
3677
|
-
enumerable: true,
|
|
3678
|
-
get: function () { return solidJs.merge; }
|
|
3679
|
-
});
|
|
3680
|
-
Object.defineProperty(exports, "scope", {
|
|
3681
|
-
enumerable: true,
|
|
3682
|
-
get: function () { return solidJs.ssrScope; }
|
|
3683
|
-
});
|
|
3684
|
-
Object.defineProperty(exports, "sharedConfig", {
|
|
3685
|
-
enumerable: true,
|
|
3686
|
-
get: function () { return solidJs.sharedConfig; }
|
|
3687
|
-
});
|
|
3688
|
-
Object.defineProperty(exports, "untrack", {
|
|
3689
|
-
enumerable: true,
|
|
3690
|
-
get: function () { return solidJs.untrack; }
|
|
3691
|
-
});
|
|
3692
|
-
exports.CLAIMS_DOCUMENT = CLAIMS_DOCUMENT;
|
|
3693
|
-
exports.CLAIMS_STREAM = CLAIMS_STREAM;
|
|
3694
|
-
exports.CLAIM_PROP = CLAIM_PROP;
|
|
3695
|
-
exports.ChildProperties = ChildProperties;
|
|
3696
|
-
exports.DOMElements = DOMElements;
|
|
3697
|
-
exports.DOMWithState = DOMWithState;
|
|
3698
|
-
exports.DelegatedEvents = DelegatedEvents;
|
|
3699
|
-
exports.Dynamic = Dynamic;
|
|
3700
|
-
exports.HREF = HREF;
|
|
3701
|
-
exports.HydrationScript = HydrationScript;
|
|
3702
|
-
exports.MathMLElements = MathMLElements;
|
|
3703
|
-
exports.NULL_BODY_STATUSES = NULL_BODY_STATUSES;
|
|
3704
|
-
exports.Namespaces = Namespaces;
|
|
3705
|
-
exports.Portal = Portal;
|
|
3706
|
-
exports.RESPONSE_HEADER_VALUE_LIMIT = RESPONSE_HEADER_VALUE_LIMIT;
|
|
3707
|
-
exports.REVALIDATE_HEADER = REVALIDATE_HEADER;
|
|
3708
|
-
exports.RawTextElements = RawTextElements;
|
|
3709
|
-
exports.RequestContext = RequestContext;
|
|
3710
|
-
exports.ResponseEnvelope = ResponseEnvelope;
|
|
3711
|
-
exports.SAFE_ERROR = SAFE_ERROR;
|
|
3712
|
-
exports.SVGElements = SVGElements;
|
|
3713
|
-
exports.VoidElements = VoidElements;
|
|
3714
|
-
exports.acquireAsset = notSup;
|
|
3715
|
-
exports.addEvent = notSup;
|
|
3716
|
-
exports.applyRef = applyRef;
|
|
3717
|
-
exports.assign = notSup;
|
|
3718
|
-
exports.claimElement = claimElement;
|
|
3719
|
-
exports.claimElementTree = claimElementTree;
|
|
3720
|
-
exports.className = notSup;
|
|
3721
|
-
exports.clearFlashCookie = clearFlashCookie;
|
|
3722
|
-
exports.clientOnly = clientOnly;
|
|
3723
|
-
exports.commitEventResponse = commitEventResponse;
|
|
3724
|
-
exports.commitResponseStub = commitResponseStub;
|
|
3725
|
-
exports.composeMiddleware = composeMiddleware;
|
|
3726
|
-
exports.createLiveHoles = createLiveHoles;
|
|
3727
|
-
exports.createRequestEvent = createRequestEvent;
|
|
3728
|
-
exports.createResponseStub = createResponseStub;
|
|
3729
|
-
exports.createSSRResponse = createSSRResponse;
|
|
3730
|
-
exports.delegateEvents = notSup;
|
|
3731
|
-
exports.dynamic = dynamic;
|
|
3732
|
-
exports.dynamicProperty = notSup;
|
|
3733
|
-
exports.effect = effect;
|
|
3734
|
-
exports.escape = escape;
|
|
3735
|
-
exports.generateHydrationScript = generateHydrationScript;
|
|
3736
|
-
exports.getDelegatedRoot = notSup;
|
|
3737
|
-
exports.getExpectedRedirectStatus = getExpectedRedirectStatus;
|
|
3738
|
-
exports.getHydrationKey = getHydrationKey;
|
|
3739
|
-
exports.getNextElement = notSup;
|
|
3740
|
-
exports.getNextMarker = notSup;
|
|
3741
|
-
exports.getNextMatch = notSup;
|
|
3742
|
-
exports.getRequestEvent = getRequestEvent;
|
|
3743
|
-
exports.getServerFunctionMetadata = getServerFunctionMetadata;
|
|
3744
|
-
exports.getServerFunctionRPC = getServerFunctionRPC;
|
|
3745
|
-
exports.hasFlashCookie = hasFlashCookie;
|
|
3746
|
-
exports.httpHeader = httpHeader;
|
|
3747
|
-
exports.httpStatus = httpStatus;
|
|
3748
|
-
exports.hydrate = notSup;
|
|
3749
|
-
exports.insert = notSup;
|
|
3750
|
-
exports.isDev = isDev;
|
|
3751
|
-
exports.isHref = isHref;
|
|
3752
|
-
exports.isResponseEnvelope = isResponseEnvelope;
|
|
3753
|
-
exports.isSafeError = isSafeError;
|
|
3754
|
-
exports.isServer = isServer;
|
|
3755
|
-
exports.isServerFunction = isServerFunction;
|
|
3756
|
-
exports.markSafeError = markSafeError;
|
|
3757
|
-
exports.memo = memo;
|
|
3758
|
-
exports.parseCookieHeader = parseCookieHeader;
|
|
3759
|
-
exports.redirect = redirect;
|
|
3760
|
-
exports.ref = notSup;
|
|
3761
|
-
exports.registerDelegatedContainer = notSup;
|
|
3762
|
-
exports.registerDelegatedRoot = notSup;
|
|
3763
|
-
exports.registerElementClaim = registerElementClaim;
|
|
3764
|
-
exports.reload = reload;
|
|
3765
|
-
exports.render = notSup;
|
|
3766
|
-
exports.renderToStream = renderToStream;
|
|
3767
|
-
exports.renderToString = renderToString;
|
|
3768
|
-
exports.resolveSSRNode = resolveSSRNode;
|
|
3769
|
-
exports.resolveSSRSelectValues = resolveSSRSelectValues;
|
|
3770
|
-
exports.respond = respond;
|
|
3771
|
-
exports.runHydrationEvents = notSup;
|
|
3772
|
-
exports.scriptNonce = scriptNonce;
|
|
3773
|
-
exports.serializeCookie = serializeCookie;
|
|
3774
|
-
exports.setAttribute = notSup;
|
|
3775
|
-
exports.setAttributeNS = notSup;
|
|
3776
|
-
exports.setProperty = notSup;
|
|
3777
|
-
exports.setStyleProperty = notSup;
|
|
3778
|
-
exports.spread = notSup;
|
|
3779
|
-
exports.ssr = ssr;
|
|
3780
|
-
exports.ssrAttribute = ssrAttribute;
|
|
3781
|
-
exports.ssrClaim = ssrClaim;
|
|
3782
|
-
exports.ssrClassName = ssrClassName;
|
|
3783
|
-
exports.ssrElement = ssrElement;
|
|
3784
|
-
exports.ssrGroup = ssrGroup;
|
|
3785
|
-
exports.ssrHydrationKey = ssrHydrationKey;
|
|
3786
|
-
exports.ssrSelectValues = ssrSelectValues;
|
|
3787
|
-
exports.ssrStyle = ssrStyle;
|
|
3788
|
-
exports.ssrStyleProperty = ssrStyleProperty;
|
|
3789
|
-
exports.style = notSup;
|
|
3790
|
-
exports.styleNonce = styleNonce;
|
|
3791
|
-
exports.template = notSup;
|
|
3792
|
-
exports.unregisterDelegatedContainer = notSup;
|
|
3793
|
-
exports.unregisterDelegatedRoot = notSup;
|
|
3794
|
-
exports.useHead = useHead;
|