@solidjs/web 2.0.0-beta.18 → 2.0.0-beta.19
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/dev.cjs +112 -36
- package/dist/dev.js +107 -37
- package/dist/server.cjs +68 -4
- package/dist/server.js +64 -5
- package/dist/web.cjs +112 -36
- package/dist/web.js +107 -37
- package/package.json +81 -7
- package/serialization/types/index.d.ts +52 -10
- package/serialization/types-cjs/index.d.cts +52 -10
- package/server-functions/dist/client.cjs +370 -0
- package/server-functions/dist/client.js +363 -0
- package/server-functions/dist/server.cjs +542 -0
- package/server-functions/dist/server.js +531 -0
- package/server-functions/package.json +30 -0
- package/storage/types/index.d.ts +26 -0
- package/storage/types-cjs/index.d.cts +26 -0
- package/types/index.d.ts +1 -0
- package/types/response.d.ts +93 -0
- package/types/serializer.d.ts +52 -10
- package/types/server-functions/client.d.ts +63 -0
- package/types/server-functions/server.d.ts +188 -0
- package/types/server-functions/shared.d.ts +171 -0
- package/types/server.d.ts +18 -0
- package/types-cjs/index.d.cts +1 -0
- package/types-cjs/response.d.cts +93 -0
- package/types-cjs/serializer.d.cts +52 -10
- package/types-cjs/server-functions/client.d.cts +63 -0
- package/types-cjs/server-functions/server.d.cts +188 -0
- package/types-cjs/server-functions/shared.d.cts +171 -0
- package/types-cjs/server.d.cts +18 -0
package/dist/dev.cjs
CHANGED
|
@@ -48,9 +48,7 @@ const Namespaces = {
|
|
|
48
48
|
};
|
|
49
49
|
const VoidElements = /*#__PURE__*/new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]);
|
|
50
50
|
const RawTextElements = /*#__PURE__*/new Set(["style", "script", "noscript", "template", "textarea", "title"]);
|
|
51
|
-
const DOMElements = /*#__PURE__*/new Set(
|
|
52
|
-
"webview",
|
|
53
|
-
"isindex", "listing", "multicol", "nextid", "noindex", "search"]);
|
|
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(","));
|
|
54
52
|
|
|
55
53
|
const transparentOptions = {
|
|
56
54
|
transparent: true,
|
|
@@ -415,6 +413,44 @@ function scope(fn) {
|
|
|
415
413
|
const SCOPE_OPTIONS = {
|
|
416
414
|
scope: true
|
|
417
415
|
};
|
|
416
|
+
let hydrationRt = null;
|
|
417
|
+
function installHydrationRuntime() {
|
|
418
|
+
hydrationRt = {
|
|
419
|
+
claimInitial(parent, multi, initial) {
|
|
420
|
+
if (isHydrating(parent)) {
|
|
421
|
+
if (!multi && initial === undefined && parent) initial = [...parent.childNodes];
|
|
422
|
+
if (Array.isArray(initial)) stripTextSeparators(initial);
|
|
423
|
+
}
|
|
424
|
+
return initial;
|
|
425
|
+
},
|
|
426
|
+
reclaimRegion(current, parent, marker) {
|
|
427
|
+
if (!solidJs.sharedConfig.hydrating || !current || !parent.isConnected) return current;
|
|
428
|
+
const first = Array.isArray(current) ? current[0] : current;
|
|
429
|
+
if (!first || !first.nodeType || first.isConnected) return current;
|
|
430
|
+
let nodes;
|
|
431
|
+
if (marker) {
|
|
432
|
+
nodes = [];
|
|
433
|
+
let node = marker.previousSibling,
|
|
434
|
+
depth = 0;
|
|
435
|
+
while (node) {
|
|
436
|
+
if (node.nodeType === 8) {
|
|
437
|
+
const v = node.nodeValue;
|
|
438
|
+
if (v === "/") depth++;else if (v === "$") {
|
|
439
|
+
if (depth === 0) break;
|
|
440
|
+
depth--;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
nodes.unshift(node);
|
|
444
|
+
node = node.previousSibling;
|
|
445
|
+
}
|
|
446
|
+
} else nodes = [...parent.childNodes];
|
|
447
|
+
return stripTextSeparators(nodes);
|
|
448
|
+
},
|
|
449
|
+
dedupEvent(e) {
|
|
450
|
+
return !!(solidJs.sharedConfig.registry && solidJs.sharedConfig.events && solidJs.sharedConfig.events.find(([el, ev]) => ev === e));
|
|
451
|
+
}
|
|
452
|
+
};
|
|
453
|
+
}
|
|
418
454
|
function stripTextSeparators(nodes) {
|
|
419
455
|
let j = 0;
|
|
420
456
|
for (let i = 0; i < nodes.length; i++) {
|
|
@@ -427,10 +463,7 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
427
463
|
const multi = marker !== undefined;
|
|
428
464
|
const host = options && options.host;
|
|
429
465
|
if (multi && !initial) initial = [];
|
|
430
|
-
if (
|
|
431
|
-
if (!multi && initial === undefined && parent) initial = [...parent.childNodes];
|
|
432
|
-
if (Array.isArray(initial)) stripTextSeparators(initial);
|
|
433
|
-
}
|
|
466
|
+
if (hydrationRt !== null) initial = hydrationRt.claimInitial(parent, multi, initial);
|
|
434
467
|
if (typeof accessor !== "function") {
|
|
435
468
|
accessor = normalize(accessor, initial, multi, true);
|
|
436
469
|
if (typeof accessor !== "function") {
|
|
@@ -445,34 +478,11 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
445
478
|
initial = [placeholder];
|
|
446
479
|
}
|
|
447
480
|
let current = initial;
|
|
448
|
-
function reclaimSwappedRegion() {
|
|
449
|
-
if (!solidJs.sharedConfig.hydrating || !current || !parent.isConnected) return;
|
|
450
|
-
const first = Array.isArray(current) ? current[0] : current;
|
|
451
|
-
if (!first || !first.nodeType || first.isConnected) return;
|
|
452
|
-
let nodes;
|
|
453
|
-
if (marker) {
|
|
454
|
-
nodes = [];
|
|
455
|
-
let node = marker.previousSibling,
|
|
456
|
-
depth = 0;
|
|
457
|
-
while (node) {
|
|
458
|
-
if (node.nodeType === 8) {
|
|
459
|
-
const v = node.nodeValue;
|
|
460
|
-
if (v === "/") depth++;else if (v === "$") {
|
|
461
|
-
if (depth === 0) break;
|
|
462
|
-
depth--;
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
nodes.unshift(node);
|
|
466
|
-
node = node.previousSibling;
|
|
467
|
-
}
|
|
468
|
-
} else nodes = [...parent.childNodes];
|
|
469
|
-
current = stripTextSeparators(nodes);
|
|
470
|
-
}
|
|
471
481
|
effect(prev => {
|
|
472
|
-
|
|
482
|
+
if (hydrationRt !== null) current = hydrationRt.reclaimRegion(current, parent, marker);
|
|
473
483
|
const value = normalize(accessor(), current, multi, true);
|
|
474
484
|
if (typeof value !== "function") return value;
|
|
475
|
-
effect(() => (
|
|
485
|
+
effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
|
|
476
486
|
insertExpression(parent, inner, current, marker);
|
|
477
487
|
current = inner;
|
|
478
488
|
host && tagHost(current, host);
|
|
@@ -624,6 +634,7 @@ function loadModuleAssets(mapping) {
|
|
|
624
634
|
return pending.length ? Promise.all(pending).then(() => {}) : undefined;
|
|
625
635
|
}
|
|
626
636
|
function hydrate$1(code, element, options = {}) {
|
|
637
|
+
installHydrationRuntime();
|
|
627
638
|
if (globalThis._$HY.done) return render$1(code, element, [...element.childNodes], options);
|
|
628
639
|
options.renderId ||= "";
|
|
629
640
|
if (!globalThis._$HY.modules) globalThis._$HY.modules = {};
|
|
@@ -883,9 +894,7 @@ function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
|
883
894
|
return value;
|
|
884
895
|
}
|
|
885
896
|
function eventHandler(e, container, state) {
|
|
886
|
-
if (
|
|
887
|
-
if (solidJs.sharedConfig.events.find(([el, ev]) => ev === e)) return;
|
|
888
|
-
}
|
|
897
|
+
if (hydrationRt !== null && hydrationRt.dedupEvent(e)) return;
|
|
889
898
|
const prev = e[$$EVENT_OWNER];
|
|
890
899
|
let resumeNode;
|
|
891
900
|
if (prev) {
|
|
@@ -950,7 +959,7 @@ function eventHandler(e, container, state) {
|
|
|
950
959
|
retarget(oriTarget);
|
|
951
960
|
}
|
|
952
961
|
function insertExpression(parent, value, current, marker) {
|
|
953
|
-
if (isHydrating(parent)) return;
|
|
962
|
+
if (hydrationRt !== null && isHydrating(parent)) return;
|
|
954
963
|
if (value === current) return;
|
|
955
964
|
const t = typeof value,
|
|
956
965
|
multi = marker !== undefined;
|
|
@@ -1103,6 +1112,67 @@ function ssrHydrationKey() {}
|
|
|
1103
1112
|
function resolveSSRNode(node) {}
|
|
1104
1113
|
function escape(html) {}
|
|
1105
1114
|
|
|
1115
|
+
const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
|
|
1116
|
+
class ResponseEnvelope {
|
|
1117
|
+
constructor(response, value) {
|
|
1118
|
+
this.response = response;
|
|
1119
|
+
this.value = value;
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
ResponseEnvelope.prototype[ENVELOPE] = true;
|
|
1123
|
+
function isResponseEnvelope(value) {
|
|
1124
|
+
return !!(value && typeof value === "object" && value[ENVELOPE]);
|
|
1125
|
+
}
|
|
1126
|
+
function initWithRevalidate(init) {
|
|
1127
|
+
const {
|
|
1128
|
+
revalidate,
|
|
1129
|
+
...responseInit
|
|
1130
|
+
} = init;
|
|
1131
|
+
const headers = new Headers(responseInit.headers);
|
|
1132
|
+
revalidate !== undefined && headers.set("X-Revalidate", revalidate.toString());
|
|
1133
|
+
return {
|
|
1134
|
+
responseInit,
|
|
1135
|
+
headers
|
|
1136
|
+
};
|
|
1137
|
+
}
|
|
1138
|
+
function redirect(url, init = 302) {
|
|
1139
|
+
const {
|
|
1140
|
+
responseInit,
|
|
1141
|
+
headers
|
|
1142
|
+
} = initWithRevalidate(typeof init === "number" ? {
|
|
1143
|
+
status: init
|
|
1144
|
+
} : init);
|
|
1145
|
+
if (responseInit.status === undefined) {
|
|
1146
|
+
responseInit.status = 302;
|
|
1147
|
+
}
|
|
1148
|
+
headers.set("Location", url);
|
|
1149
|
+
return new Response(null, {
|
|
1150
|
+
...responseInit,
|
|
1151
|
+
headers
|
|
1152
|
+
});
|
|
1153
|
+
}
|
|
1154
|
+
function reload(init = {}) {
|
|
1155
|
+
const {
|
|
1156
|
+
responseInit,
|
|
1157
|
+
headers
|
|
1158
|
+
} = initWithRevalidate(init);
|
|
1159
|
+
return new Response(null, {
|
|
1160
|
+
...responseInit,
|
|
1161
|
+
headers
|
|
1162
|
+
});
|
|
1163
|
+
}
|
|
1164
|
+
function respond(value, init = {}) {
|
|
1165
|
+
const {
|
|
1166
|
+
responseInit,
|
|
1167
|
+
headers
|
|
1168
|
+
} = initWithRevalidate(init);
|
|
1169
|
+
headers.set("Content-Type", "application/json");
|
|
1170
|
+
return new ResponseEnvelope(new Response(JSON.stringify(value), {
|
|
1171
|
+
...responseInit,
|
|
1172
|
+
headers
|
|
1173
|
+
}), value);
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1106
1176
|
const mergeProps = solidJs.merge;
|
|
1107
1177
|
const isServer = false;
|
|
1108
1178
|
const isDev = true;
|
|
@@ -1270,6 +1340,7 @@ exports.Namespaces = Namespaces;
|
|
|
1270
1340
|
exports.Portal = Portal;
|
|
1271
1341
|
exports.RawTextElements = RawTextElements;
|
|
1272
1342
|
exports.RequestContext = RequestContext;
|
|
1343
|
+
exports.ResponseEnvelope = ResponseEnvelope;
|
|
1273
1344
|
exports.SVGElements = SVGElements;
|
|
1274
1345
|
exports.VoidElements = VoidElements;
|
|
1275
1346
|
exports.acquireAsset = acquireAsset;
|
|
@@ -1294,18 +1365,23 @@ exports.getNextSibling = getNextSibling;
|
|
|
1294
1365
|
exports.getRequestEvent = voidFn;
|
|
1295
1366
|
exports.hydrate = hydrate;
|
|
1296
1367
|
exports.insert = insert;
|
|
1368
|
+
exports.installHydrationRuntime = installHydrationRuntime;
|
|
1297
1369
|
exports.isDev = isDev;
|
|
1370
|
+
exports.isResponseEnvelope = isResponseEnvelope;
|
|
1298
1371
|
exports.isServer = isServer;
|
|
1299
1372
|
exports.memo = memo;
|
|
1300
1373
|
exports.mergeProps = mergeProps;
|
|
1374
|
+
exports.redirect = redirect;
|
|
1301
1375
|
exports.ref = ref;
|
|
1302
1376
|
exports.registerDelegatedContainer = registerDelegatedContainer;
|
|
1303
1377
|
exports.registerDelegatedRoot = registerDelegatedRoot;
|
|
1378
|
+
exports.reload = reload;
|
|
1304
1379
|
exports.render = render;
|
|
1305
1380
|
exports.renderToStream = renderToStream;
|
|
1306
1381
|
exports.renderToString = renderToString;
|
|
1307
1382
|
exports.renderToStringAsync = renderToStringAsync;
|
|
1308
1383
|
exports.resolveSSRNode = resolveSSRNode;
|
|
1384
|
+
exports.respond = respond;
|
|
1309
1385
|
exports.runHydrationEvents = runHydrationEvents;
|
|
1310
1386
|
exports.scope = scope;
|
|
1311
1387
|
exports.setAttribute = setAttribute;
|
package/dist/dev.js
CHANGED
|
@@ -47,9 +47,7 @@ const Namespaces = {
|
|
|
47
47
|
};
|
|
48
48
|
const VoidElements = /*#__PURE__*/new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]);
|
|
49
49
|
const RawTextElements = /*#__PURE__*/new Set(["style", "script", "noscript", "template", "textarea", "title"]);
|
|
50
|
-
const DOMElements = /*#__PURE__*/new Set(
|
|
51
|
-
"webview",
|
|
52
|
-
"isindex", "listing", "multicol", "nextid", "noindex", "search"]);
|
|
50
|
+
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(","));
|
|
53
51
|
|
|
54
52
|
const transparentOptions = {
|
|
55
53
|
transparent: true,
|
|
@@ -414,6 +412,44 @@ function scope(fn) {
|
|
|
414
412
|
const SCOPE_OPTIONS = {
|
|
415
413
|
scope: true
|
|
416
414
|
};
|
|
415
|
+
let hydrationRt = null;
|
|
416
|
+
function installHydrationRuntime() {
|
|
417
|
+
hydrationRt = {
|
|
418
|
+
claimInitial(parent, multi, initial) {
|
|
419
|
+
if (isHydrating(parent)) {
|
|
420
|
+
if (!multi && initial === undefined && parent) initial = [...parent.childNodes];
|
|
421
|
+
if (Array.isArray(initial)) stripTextSeparators(initial);
|
|
422
|
+
}
|
|
423
|
+
return initial;
|
|
424
|
+
},
|
|
425
|
+
reclaimRegion(current, parent, marker) {
|
|
426
|
+
if (!sharedConfig.hydrating || !current || !parent.isConnected) return current;
|
|
427
|
+
const first = Array.isArray(current) ? current[0] : current;
|
|
428
|
+
if (!first || !first.nodeType || first.isConnected) return current;
|
|
429
|
+
let nodes;
|
|
430
|
+
if (marker) {
|
|
431
|
+
nodes = [];
|
|
432
|
+
let node = marker.previousSibling,
|
|
433
|
+
depth = 0;
|
|
434
|
+
while (node) {
|
|
435
|
+
if (node.nodeType === 8) {
|
|
436
|
+
const v = node.nodeValue;
|
|
437
|
+
if (v === "/") depth++;else if (v === "$") {
|
|
438
|
+
if (depth === 0) break;
|
|
439
|
+
depth--;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
nodes.unshift(node);
|
|
443
|
+
node = node.previousSibling;
|
|
444
|
+
}
|
|
445
|
+
} else nodes = [...parent.childNodes];
|
|
446
|
+
return stripTextSeparators(nodes);
|
|
447
|
+
},
|
|
448
|
+
dedupEvent(e) {
|
|
449
|
+
return !!(sharedConfig.registry && sharedConfig.events && sharedConfig.events.find(([el, ev]) => ev === e));
|
|
450
|
+
}
|
|
451
|
+
};
|
|
452
|
+
}
|
|
417
453
|
function stripTextSeparators(nodes) {
|
|
418
454
|
let j = 0;
|
|
419
455
|
for (let i = 0; i < nodes.length; i++) {
|
|
@@ -426,10 +462,7 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
426
462
|
const multi = marker !== undefined;
|
|
427
463
|
const host = options && options.host;
|
|
428
464
|
if (multi && !initial) initial = [];
|
|
429
|
-
if (
|
|
430
|
-
if (!multi && initial === undefined && parent) initial = [...parent.childNodes];
|
|
431
|
-
if (Array.isArray(initial)) stripTextSeparators(initial);
|
|
432
|
-
}
|
|
465
|
+
if (hydrationRt !== null) initial = hydrationRt.claimInitial(parent, multi, initial);
|
|
433
466
|
if (typeof accessor !== "function") {
|
|
434
467
|
accessor = normalize(accessor, initial, multi, true);
|
|
435
468
|
if (typeof accessor !== "function") {
|
|
@@ -444,34 +477,11 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
444
477
|
initial = [placeholder];
|
|
445
478
|
}
|
|
446
479
|
let current = initial;
|
|
447
|
-
function reclaimSwappedRegion() {
|
|
448
|
-
if (!sharedConfig.hydrating || !current || !parent.isConnected) return;
|
|
449
|
-
const first = Array.isArray(current) ? current[0] : current;
|
|
450
|
-
if (!first || !first.nodeType || first.isConnected) return;
|
|
451
|
-
let nodes;
|
|
452
|
-
if (marker) {
|
|
453
|
-
nodes = [];
|
|
454
|
-
let node = marker.previousSibling,
|
|
455
|
-
depth = 0;
|
|
456
|
-
while (node) {
|
|
457
|
-
if (node.nodeType === 8) {
|
|
458
|
-
const v = node.nodeValue;
|
|
459
|
-
if (v === "/") depth++;else if (v === "$") {
|
|
460
|
-
if (depth === 0) break;
|
|
461
|
-
depth--;
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
nodes.unshift(node);
|
|
465
|
-
node = node.previousSibling;
|
|
466
|
-
}
|
|
467
|
-
} else nodes = [...parent.childNodes];
|
|
468
|
-
current = stripTextSeparators(nodes);
|
|
469
|
-
}
|
|
470
480
|
effect(prev => {
|
|
471
|
-
|
|
481
|
+
if (hydrationRt !== null) current = hydrationRt.reclaimRegion(current, parent, marker);
|
|
472
482
|
const value = normalize(accessor(), current, multi, true);
|
|
473
483
|
if (typeof value !== "function") return value;
|
|
474
|
-
effect(() => (
|
|
484
|
+
effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
|
|
475
485
|
insertExpression(parent, inner, current, marker);
|
|
476
486
|
current = inner;
|
|
477
487
|
host && tagHost(current, host);
|
|
@@ -623,6 +633,7 @@ function loadModuleAssets(mapping) {
|
|
|
623
633
|
return pending.length ? Promise.all(pending).then(() => {}) : undefined;
|
|
624
634
|
}
|
|
625
635
|
function hydrate$1(code, element, options = {}) {
|
|
636
|
+
installHydrationRuntime();
|
|
626
637
|
if (globalThis._$HY.done) return render$1(code, element, [...element.childNodes], options);
|
|
627
638
|
options.renderId ||= "";
|
|
628
639
|
if (!globalThis._$HY.modules) globalThis._$HY.modules = {};
|
|
@@ -882,9 +893,7 @@ function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
|
882
893
|
return value;
|
|
883
894
|
}
|
|
884
895
|
function eventHandler(e, container, state) {
|
|
885
|
-
if (
|
|
886
|
-
if (sharedConfig.events.find(([el, ev]) => ev === e)) return;
|
|
887
|
-
}
|
|
896
|
+
if (hydrationRt !== null && hydrationRt.dedupEvent(e)) return;
|
|
888
897
|
const prev = e[$$EVENT_OWNER];
|
|
889
898
|
let resumeNode;
|
|
890
899
|
if (prev) {
|
|
@@ -949,7 +958,7 @@ function eventHandler(e, container, state) {
|
|
|
949
958
|
retarget(oriTarget);
|
|
950
959
|
}
|
|
951
960
|
function insertExpression(parent, value, current, marker) {
|
|
952
|
-
if (isHydrating(parent)) return;
|
|
961
|
+
if (hydrationRt !== null && isHydrating(parent)) return;
|
|
953
962
|
if (value === current) return;
|
|
954
963
|
const t = typeof value,
|
|
955
964
|
multi = marker !== undefined;
|
|
@@ -1102,6 +1111,67 @@ function ssrHydrationKey() {}
|
|
|
1102
1111
|
function resolveSSRNode(node) {}
|
|
1103
1112
|
function escape(html) {}
|
|
1104
1113
|
|
|
1114
|
+
const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
|
|
1115
|
+
class ResponseEnvelope {
|
|
1116
|
+
constructor(response, value) {
|
|
1117
|
+
this.response = response;
|
|
1118
|
+
this.value = value;
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
ResponseEnvelope.prototype[ENVELOPE] = true;
|
|
1122
|
+
function isResponseEnvelope(value) {
|
|
1123
|
+
return !!(value && typeof value === "object" && value[ENVELOPE]);
|
|
1124
|
+
}
|
|
1125
|
+
function initWithRevalidate(init) {
|
|
1126
|
+
const {
|
|
1127
|
+
revalidate,
|
|
1128
|
+
...responseInit
|
|
1129
|
+
} = init;
|
|
1130
|
+
const headers = new Headers(responseInit.headers);
|
|
1131
|
+
revalidate !== undefined && headers.set("X-Revalidate", revalidate.toString());
|
|
1132
|
+
return {
|
|
1133
|
+
responseInit,
|
|
1134
|
+
headers
|
|
1135
|
+
};
|
|
1136
|
+
}
|
|
1137
|
+
function redirect(url, init = 302) {
|
|
1138
|
+
const {
|
|
1139
|
+
responseInit,
|
|
1140
|
+
headers
|
|
1141
|
+
} = initWithRevalidate(typeof init === "number" ? {
|
|
1142
|
+
status: init
|
|
1143
|
+
} : init);
|
|
1144
|
+
if (responseInit.status === undefined) {
|
|
1145
|
+
responseInit.status = 302;
|
|
1146
|
+
}
|
|
1147
|
+
headers.set("Location", url);
|
|
1148
|
+
return new Response(null, {
|
|
1149
|
+
...responseInit,
|
|
1150
|
+
headers
|
|
1151
|
+
});
|
|
1152
|
+
}
|
|
1153
|
+
function reload(init = {}) {
|
|
1154
|
+
const {
|
|
1155
|
+
responseInit,
|
|
1156
|
+
headers
|
|
1157
|
+
} = initWithRevalidate(init);
|
|
1158
|
+
return new Response(null, {
|
|
1159
|
+
...responseInit,
|
|
1160
|
+
headers
|
|
1161
|
+
});
|
|
1162
|
+
}
|
|
1163
|
+
function respond(value, init = {}) {
|
|
1164
|
+
const {
|
|
1165
|
+
responseInit,
|
|
1166
|
+
headers
|
|
1167
|
+
} = initWithRevalidate(init);
|
|
1168
|
+
headers.set("Content-Type", "application/json");
|
|
1169
|
+
return new ResponseEnvelope(new Response(JSON.stringify(value), {
|
|
1170
|
+
...responseInit,
|
|
1171
|
+
headers
|
|
1172
|
+
}), value);
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1105
1175
|
const mergeProps = merge;
|
|
1106
1176
|
const isServer = false;
|
|
1107
1177
|
const isDev = true;
|
|
@@ -1205,4 +1275,4 @@ function createElement(tagName, is = undefined) {
|
|
|
1205
1275
|
});
|
|
1206
1276
|
}
|
|
1207
1277
|
|
|
1208
|
-
export { voidFn as Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, voidFn as HydrationScript, MathMLElements, Namespaces, Portal, RawTextElements, RequestContext, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, className, delegateEvents, dynamic, dynamicProperty, effect, escape, voidFn as generateHydrationScript, voidFn as getAssets, getDelegatedRoot, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, voidFn as getRequestEvent, hydrate, insert, isDev, isServer, memo, mergeProps, ref, registerDelegatedContainer, registerDelegatedRoot, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, scope, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrStyle, style, template, unregisterDelegatedContainer, unregisterDelegatedRoot, voidFn as useAssets };
|
|
1278
|
+
export { voidFn as Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, voidFn as HydrationScript, MathMLElements, Namespaces, Portal, RawTextElements, RequestContext, ResponseEnvelope, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, className, delegateEvents, dynamic, dynamicProperty, effect, escape, voidFn as generateHydrationScript, voidFn as getAssets, getDelegatedRoot, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, voidFn as getRequestEvent, hydrate, insert, installHydrationRuntime, isDev, isResponseEnvelope, isServer, memo, mergeProps, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, reload, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, respond, runHydrationEvents, scope, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrStyle, style, template, unregisterDelegatedContainer, unregisterDelegatedRoot, voidFn as useAssets };
|
package/dist/server.cjs
CHANGED
|
@@ -48,9 +48,7 @@ const Namespaces = {
|
|
|
48
48
|
};
|
|
49
49
|
const VoidElements = /*#__PURE__*/new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]);
|
|
50
50
|
const RawTextElements = /*#__PURE__*/new Set(["style", "script", "noscript", "template", "textarea", "title"]);
|
|
51
|
-
const DOMElements = /*#__PURE__*/new Set(
|
|
52
|
-
"webview",
|
|
53
|
-
"isindex", "listing", "multicol", "nextid", "noindex", "search"]);
|
|
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(","));
|
|
54
52
|
|
|
55
53
|
const transparentOptions = {
|
|
56
54
|
transparent: true,
|
|
@@ -1267,7 +1265,7 @@ function resolveSSRSync(node) {
|
|
|
1267
1265
|
if (!res.h.length) return res.t[0];
|
|
1268
1266
|
throw new Error("This value cannot be rendered synchronously. Are you missing a boundary?");
|
|
1269
1267
|
}
|
|
1270
|
-
const RequestContext = Symbol();
|
|
1268
|
+
const RequestContext = Symbol.for("solid.RequestContext");
|
|
1271
1269
|
function getRequestEvent() {
|
|
1272
1270
|
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;
|
|
1273
1271
|
}
|
|
@@ -1278,6 +1276,67 @@ function notSup() {
|
|
|
1278
1276
|
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>.");
|
|
1279
1277
|
}
|
|
1280
1278
|
|
|
1279
|
+
const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
|
|
1280
|
+
class ResponseEnvelope {
|
|
1281
|
+
constructor(response, value) {
|
|
1282
|
+
this.response = response;
|
|
1283
|
+
this.value = value;
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
ResponseEnvelope.prototype[ENVELOPE] = true;
|
|
1287
|
+
function isResponseEnvelope(value) {
|
|
1288
|
+
return !!(value && typeof value === "object" && value[ENVELOPE]);
|
|
1289
|
+
}
|
|
1290
|
+
function initWithRevalidate(init) {
|
|
1291
|
+
const {
|
|
1292
|
+
revalidate,
|
|
1293
|
+
...responseInit
|
|
1294
|
+
} = init;
|
|
1295
|
+
const headers = new Headers(responseInit.headers);
|
|
1296
|
+
revalidate !== undefined && headers.set("X-Revalidate", revalidate.toString());
|
|
1297
|
+
return {
|
|
1298
|
+
responseInit,
|
|
1299
|
+
headers
|
|
1300
|
+
};
|
|
1301
|
+
}
|
|
1302
|
+
function redirect(url, init = 302) {
|
|
1303
|
+
const {
|
|
1304
|
+
responseInit,
|
|
1305
|
+
headers
|
|
1306
|
+
} = initWithRevalidate(typeof init === "number" ? {
|
|
1307
|
+
status: init
|
|
1308
|
+
} : init);
|
|
1309
|
+
if (responseInit.status === undefined) {
|
|
1310
|
+
responseInit.status = 302;
|
|
1311
|
+
}
|
|
1312
|
+
headers.set("Location", url);
|
|
1313
|
+
return new Response(null, {
|
|
1314
|
+
...responseInit,
|
|
1315
|
+
headers
|
|
1316
|
+
});
|
|
1317
|
+
}
|
|
1318
|
+
function reload(init = {}) {
|
|
1319
|
+
const {
|
|
1320
|
+
responseInit,
|
|
1321
|
+
headers
|
|
1322
|
+
} = initWithRevalidate(init);
|
|
1323
|
+
return new Response(null, {
|
|
1324
|
+
...responseInit,
|
|
1325
|
+
headers
|
|
1326
|
+
});
|
|
1327
|
+
}
|
|
1328
|
+
function respond(value, init = {}) {
|
|
1329
|
+
const {
|
|
1330
|
+
responseInit,
|
|
1331
|
+
headers
|
|
1332
|
+
} = initWithRevalidate(init);
|
|
1333
|
+
headers.set("Content-Type", "application/json");
|
|
1334
|
+
return new ResponseEnvelope(new Response(JSON.stringify(value), {
|
|
1335
|
+
...responseInit,
|
|
1336
|
+
headers
|
|
1337
|
+
}), value);
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1281
1340
|
const isServer = true;
|
|
1282
1341
|
const isDev = false;
|
|
1283
1342
|
function dynamic(source) {
|
|
@@ -1401,6 +1460,7 @@ exports.Namespaces = Namespaces;
|
|
|
1401
1460
|
exports.Portal = Portal;
|
|
1402
1461
|
exports.RawTextElements = RawTextElements;
|
|
1403
1462
|
exports.RequestContext = RequestContext;
|
|
1463
|
+
exports.ResponseEnvelope = ResponseEnvelope;
|
|
1404
1464
|
exports.SVGElements = SVGElements;
|
|
1405
1465
|
exports.VoidElements = VoidElements;
|
|
1406
1466
|
exports.acquireAsset = notSup;
|
|
@@ -1424,15 +1484,19 @@ exports.getRequestEvent = getRequestEvent;
|
|
|
1424
1484
|
exports.hydrate = notSup;
|
|
1425
1485
|
exports.insert = notSup;
|
|
1426
1486
|
exports.isDev = isDev;
|
|
1487
|
+
exports.isResponseEnvelope = isResponseEnvelope;
|
|
1427
1488
|
exports.isServer = isServer;
|
|
1428
1489
|
exports.memo = memo;
|
|
1490
|
+
exports.redirect = redirect;
|
|
1429
1491
|
exports.ref = notSup;
|
|
1430
1492
|
exports.registerDelegatedContainer = notSup;
|
|
1431
1493
|
exports.registerDelegatedRoot = notSup;
|
|
1494
|
+
exports.reload = reload;
|
|
1432
1495
|
exports.render = notSup;
|
|
1433
1496
|
exports.renderToStream = renderToStream;
|
|
1434
1497
|
exports.renderToString = renderToString;
|
|
1435
1498
|
exports.renderToStringAsync = renderToStringAsync;
|
|
1499
|
+
exports.respond = respond;
|
|
1436
1500
|
exports.runHydrationEvents = notSup;
|
|
1437
1501
|
exports.setAttribute = notSup;
|
|
1438
1502
|
exports.setAttributeNS = notSup;
|