@solidjs/web 2.0.0-rc.4 → 2.0.0-rc.6
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 +163 -36
- package/dist/dev.js +161 -37
- package/dist/server.cjs +178 -37
- package/dist/server.js +177 -38
- package/dist/web.cjs +143 -36
- package/dist/web.js +141 -37
- package/frames/dist/client.cjs +41 -8
- package/frames/dist/client.dev.cjs +41 -8
- package/frames/dist/client.dev.js +41 -8
- package/frames/dist/client.js +41 -8
- package/frames/dist/server.cjs +497 -44
- package/frames/dist/server.js +497 -44
- package/package.json +2 -2
- package/serialization/dist/decode.cjs +4 -2
- package/serialization/dist/decode.js +4 -2
- package/serialization/dist/serialization.cjs +12 -8
- package/serialization/dist/serialization.js +12 -8
- package/serialization/types/index.d.ts +7 -0
- package/serialization/types/serializer-decode.d.ts +14 -1
- package/serialization/types/serializer.d.ts +7 -0
- package/serialization/types-cjs/index.d.cts +7 -0
- package/serialization/types-cjs/serializer-decode.d.cts +14 -1
- package/serialization/types-cjs/serializer.d.cts +7 -0
- package/server-functions/dist/client.cjs +164 -35
- package/server-functions/dist/client.js +161 -36
- package/server-functions/dist/server.cjs +899 -136
- package/server-functions/dist/server.dev.cjs +919 -136
- package/server-functions/dist/server.dev.js +915 -137
- package/server-functions/dist/server.js +895 -137
- package/types/client.d.ts +2 -1
- package/types/constants.d.ts +3 -1
- package/types/cookies.d.ts +6 -14
- package/types/frames/frame-client.d.ts +4 -0
- package/types/frames/serializer-decode.d.ts +14 -1
- package/types/frames/serializer.d.ts +7 -0
- package/types/jsx.d.ts +11 -16
- package/types/response.d.ts +11 -0
- package/types/serializer-decode.d.ts +14 -1
- package/types/serializer.d.ts +7 -0
- package/types/server-functions/client.d.ts +22 -2
- package/types/server-functions/flash.d.ts +9 -0
- package/types/server-functions/server.d.ts +131 -11
- package/types/server-functions/shared.d.ts +77 -14
- package/types/server-mock.d.ts +17 -2
- package/types/server.d.ts +16 -2
- package/types-cjs/client.d.cts +2 -1
- package/types-cjs/constants.d.cts +3 -1
- package/types-cjs/cookies.d.cts +6 -14
- package/types-cjs/frames/frame-client.d.cts +4 -0
- package/types-cjs/frames/serializer-decode.d.cts +14 -1
- package/types-cjs/frames/serializer.d.cts +7 -0
- package/types-cjs/jsx.d.cts +11 -16
- package/types-cjs/response.d.cts +11 -0
- package/types-cjs/serializer-decode.d.cts +14 -1
- package/types-cjs/serializer.d.cts +7 -0
- package/types-cjs/server-functions/client.d.cts +22 -2
- package/types-cjs/server-functions/flash.d.cts +9 -0
- package/types-cjs/server-functions/server.d.cts +131 -11
- package/types-cjs/server-functions/shared.d.cts +77 -14
- package/types-cjs/server-mock.d.cts +17 -2
- package/types-cjs/server.d.cts +16 -2
package/dist/web.cjs
CHANGED
|
@@ -49,6 +49,7 @@ const Namespaces = {
|
|
|
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
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"]);
|
|
52
53
|
|
|
53
54
|
const transparentOptions = {
|
|
54
55
|
transparent: true,
|
|
@@ -215,7 +216,8 @@ function resourceIdentity(tag, props) {
|
|
|
215
216
|
let id = "res:" + tag + ":" + (props.rel || "") + ":" + (props.href || props.src || "");
|
|
216
217
|
for (let i = 0; i < RESOURCE_QUALIFIERS.length; i++) {
|
|
217
218
|
const q = RESOURCE_QUALIFIERS[i];
|
|
218
|
-
|
|
219
|
+
const value = props[q];
|
|
220
|
+
if (value != null) id += ":" + q + "=" + (value === true ? "" : value);
|
|
219
221
|
}
|
|
220
222
|
return id;
|
|
221
223
|
}
|
|
@@ -294,6 +296,7 @@ function serializeCookie(name, value, options = {}) {
|
|
|
294
296
|
if (options.expires) cookie += `; Expires=${options.expires.toUTCString()}`;
|
|
295
297
|
if (options.httpOnly) cookie += "; HttpOnly";
|
|
296
298
|
if (options.secure) cookie += "; Secure";
|
|
299
|
+
if (options.partitioned) cookie += "; Partitioned";
|
|
297
300
|
if (options.sameSite) {
|
|
298
301
|
const sameSite = options.sameSite.toLowerCase();
|
|
299
302
|
cookie += `; SameSite=${sameSite === "none" ? "None" : sameSite === "strict" ? "Strict" : "Lax"}`;
|
|
@@ -338,6 +341,8 @@ function installListDriver(driver) {
|
|
|
338
341
|
exports.listDriver = driver;
|
|
339
342
|
}
|
|
340
343
|
const $$EVENT_OWNER = "_$SOLID_EVENT_OWNER";
|
|
344
|
+
const $$EVENT_TUPLE = Symbol();
|
|
345
|
+
const hasOwn = Object.prototype.hasOwnProperty;
|
|
341
346
|
const INNER_OWNED = {};
|
|
342
347
|
const delegatedEvents = new Set();
|
|
343
348
|
const delegatedContainers = new Map();
|
|
@@ -455,7 +460,8 @@ function findOwner(target, state) {
|
|
|
455
460
|
}
|
|
456
461
|
function setProperty(node, name, value) {
|
|
457
462
|
if (isHydrating(node)) return;
|
|
458
|
-
|
|
463
|
+
const nodeName = node.nodeName;
|
|
464
|
+
if (name === "value" && nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else if ((name === "value" || name === "defaultValue") && (nodeName === "INPUT" || nodeName === "TEXTAREA")) node[name] = value ?? "";else node[name] = value;
|
|
459
465
|
}
|
|
460
466
|
let claimHandlers = null;
|
|
461
467
|
const CLAIM_SEAM = Symbol.for("solid.element-claims");
|
|
@@ -489,7 +495,17 @@ function claimElement(node) {
|
|
|
489
495
|
}
|
|
490
496
|
function setAttribute(node, name, value) {
|
|
491
497
|
if (isHydrating(node)) return;
|
|
492
|
-
|
|
498
|
+
const selectMultiple = name === "multiple" && node.localName === "select";
|
|
499
|
+
if (value == null || value === false) node.removeAttribute(name);else {
|
|
500
|
+
node.setAttribute(name, value === true ? "" : value);
|
|
501
|
+
if (selectMultiple && !node._$multiple) {
|
|
502
|
+
const options = node.options;
|
|
503
|
+
for (let i = 0; i < options.length; i++) {
|
|
504
|
+
if (options[i].defaultSelected) options[i].selected = true;
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
if (selectMultiple) node._$multiple = true;
|
|
493
509
|
if (claimHandlers !== null && (name === "href" || name === "action")) claimElement(node);
|
|
494
510
|
}
|
|
495
511
|
function setAttributeNS(node, namespace, name, value) {
|
|
@@ -497,22 +513,32 @@ function setAttributeNS(node, namespace, name, value) {
|
|
|
497
513
|
if (value == null || value === false) node.removeAttributeNS(namespace, name.indexOf(":") > -1 ? name.split(":").pop() : name);else node.setAttributeNS(namespace, name, value === true ? "" : value);
|
|
498
514
|
}
|
|
499
515
|
function className(node, value, prev) {
|
|
500
|
-
if (
|
|
516
|
+
if (typeof value === "number") value = "" + value;
|
|
517
|
+
if (typeof prev === "number") prev = "" + prev;
|
|
518
|
+
if (isHydrating(node)) {
|
|
519
|
+
node._$classes = value && typeof value === "object" ? classListToObject(value) : undefined;
|
|
520
|
+
return;
|
|
521
|
+
}
|
|
501
522
|
if (value == null || value === false) {
|
|
502
|
-
prev
|
|
523
|
+
if (prev || node._$classes) {
|
|
524
|
+
node.removeAttribute("class");
|
|
525
|
+
node._$classes = undefined;
|
|
526
|
+
}
|
|
503
527
|
return;
|
|
504
528
|
}
|
|
505
529
|
if (typeof value === "string") {
|
|
530
|
+
node._$classes = undefined;
|
|
506
531
|
value !== prev && node.setAttribute("class", value);
|
|
507
532
|
return;
|
|
508
533
|
}
|
|
534
|
+
let applied;
|
|
509
535
|
if (typeof prev === "string") {
|
|
510
|
-
|
|
536
|
+
applied = {};
|
|
511
537
|
node.removeAttribute("class");
|
|
512
|
-
} else
|
|
538
|
+
} else applied = node._$classes || classListToObject(prev || {});
|
|
513
539
|
value = classListToObject(value);
|
|
514
|
-
const classKeys = Object.keys(value
|
|
515
|
-
const prevKeys = Object.keys(
|
|
540
|
+
const classKeys = Object.keys(value);
|
|
541
|
+
const prevKeys = Object.keys(applied);
|
|
516
542
|
let i, len;
|
|
517
543
|
for (i = 0, len = prevKeys.length; i < len; i++) {
|
|
518
544
|
const key = prevKeys[i];
|
|
@@ -522,22 +548,34 @@ function className(node, value, prev) {
|
|
|
522
548
|
for (i = 0, len = classKeys.length; i < len; i++) {
|
|
523
549
|
const key = classKeys[i],
|
|
524
550
|
classValue = !!value[key];
|
|
525
|
-
if (!key || key === "undefined" ||
|
|
551
|
+
if (!key || key === "undefined" || applied[key] === classValue || !classValue) continue;
|
|
526
552
|
node.classList.add(key);
|
|
527
553
|
}
|
|
554
|
+
node._$classes = value;
|
|
528
555
|
}
|
|
529
556
|
function addEvent(node, name, handler, delegate) {
|
|
530
557
|
if (delegate) {
|
|
558
|
+
const key = `$$${name}`;
|
|
559
|
+
let data;
|
|
531
560
|
if (Array.isArray(handler)) {
|
|
532
|
-
|
|
533
|
-
node[
|
|
534
|
-
} else node[
|
|
535
|
-
|
|
561
|
+
data = handler[1];
|
|
562
|
+
node[key] = handler[0];
|
|
563
|
+
} else node[key] = handler;
|
|
564
|
+
node[`${key}Data`] = data;
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
567
|
+
if (Array.isArray(handler)) {
|
|
536
568
|
const handlerFn = handler[0];
|
|
537
|
-
|
|
538
|
-
|
|
569
|
+
const listener = e => handlerFn.call(node, handler[1], e);
|
|
570
|
+
listener[$$EVENT_TUPLE] = handler;
|
|
571
|
+
node.addEventListener(name, listener);
|
|
572
|
+
return listener;
|
|
573
|
+
}
|
|
574
|
+
node.addEventListener(name, handler, typeof handler !== "function" && handler);
|
|
575
|
+
return handler;
|
|
539
576
|
}
|
|
540
577
|
function style(node, value, prev) {
|
|
578
|
+
if (isHydrating(node)) return;
|
|
541
579
|
if (!value) {
|
|
542
580
|
if (prev || node._$styles) {
|
|
543
581
|
setAttribute(node, "style");
|
|
@@ -562,12 +600,13 @@ function style(node, value, prev) {
|
|
|
562
600
|
}
|
|
563
601
|
let v, s;
|
|
564
602
|
for (s in applied) {
|
|
565
|
-
if (value[s] == null) {
|
|
603
|
+
if (!hasOwn.call(value, s) || value[s] == null) {
|
|
566
604
|
nodeStyle.removeProperty(s);
|
|
567
605
|
delete applied[s];
|
|
568
606
|
}
|
|
569
607
|
}
|
|
570
608
|
for (s in value) {
|
|
609
|
+
if (!hasOwn.call(value, s)) continue;
|
|
571
610
|
v = value[s];
|
|
572
611
|
if (v != null && v !== applied[s]) {
|
|
573
612
|
nodeStyle.setProperty(s, v);
|
|
@@ -576,20 +615,28 @@ function style(node, value, prev) {
|
|
|
576
615
|
}
|
|
577
616
|
}
|
|
578
617
|
function setStyleProperty(node, name, value) {
|
|
618
|
+
if (isHydrating(node)) return;
|
|
579
619
|
value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
|
|
580
620
|
}
|
|
581
621
|
function spread(node, props = {}, skipChildren) {
|
|
582
622
|
const prevProps = {};
|
|
583
|
-
|
|
623
|
+
const get = typeof props === "function" ? props : () => props;
|
|
624
|
+
if (!skipChildren) insert(node, () => {
|
|
625
|
+
const source = get();
|
|
626
|
+
return hasOwn.call(source, "children") ? source.children : undefined;
|
|
627
|
+
});
|
|
584
628
|
effect(() => {
|
|
585
|
-
const
|
|
629
|
+
const source = get();
|
|
630
|
+
const r = hasOwn.call(source, "ref") && source.ref;
|
|
586
631
|
(typeof r === "function" || Array.isArray(r)) && ref(() => r, node);
|
|
587
632
|
}, () => {});
|
|
588
633
|
effect(() => {
|
|
634
|
+
const source = get();
|
|
589
635
|
const newProps = {};
|
|
590
|
-
for (const prop in
|
|
636
|
+
for (const prop in source) {
|
|
637
|
+
if (!hasOwn.call(source, prop)) continue;
|
|
591
638
|
if (prop === "children" || prop === "ref") continue;
|
|
592
|
-
newProps[prop] =
|
|
639
|
+
newProps[prop] = source[prop];
|
|
593
640
|
}
|
|
594
641
|
return newProps;
|
|
595
642
|
}, props => assign(node, props, true, prevProps, true));
|
|
@@ -619,6 +666,19 @@ function scope(fn) {
|
|
|
619
666
|
const SCOPE_OPTIONS = {
|
|
620
667
|
scope: true
|
|
621
668
|
};
|
|
669
|
+
let insertionParent = null;
|
|
670
|
+
function getInsertionParent() {
|
|
671
|
+
return insertionParent;
|
|
672
|
+
}
|
|
673
|
+
function withInsertionParent(parent, fn) {
|
|
674
|
+
const prev = insertionParent;
|
|
675
|
+
insertionParent = parent;
|
|
676
|
+
try {
|
|
677
|
+
return fn();
|
|
678
|
+
} finally {
|
|
679
|
+
insertionParent = prev;
|
|
680
|
+
}
|
|
681
|
+
}
|
|
622
682
|
let hydrationRt = null;
|
|
623
683
|
function installHydrationRuntime() {
|
|
624
684
|
hydrationRt = {
|
|
@@ -686,7 +746,7 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
686
746
|
if (exports.listDriver(parent, accessor, marker, () => solidJs.runWithOwner(owner, () => insert(parent, () => listAccessor(), marker, marker !== undefined ? [] : undefined, options)))) return;
|
|
687
747
|
}
|
|
688
748
|
if (typeof accessor !== "function") {
|
|
689
|
-
accessor = normalize(accessor, initial, multi, true);
|
|
749
|
+
accessor = withInsertionParent(parent, () => normalize(accessor, initial, multi, true));
|
|
690
750
|
if (typeof accessor !== "function") {
|
|
691
751
|
insertExpression(parent, accessor, initial, marker);
|
|
692
752
|
host && tagHost(accessor, host);
|
|
@@ -701,9 +761,9 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
701
761
|
let current = initial;
|
|
702
762
|
effect(prev => {
|
|
703
763
|
if (hydrationRt !== null) current = hydrationRt.reclaimRegion(current, parent, marker);
|
|
704
|
-
const value = normalize(accessor(), current, multi, true);
|
|
764
|
+
const value = withInsertionParent(parent, () => normalize(accessor(), current, multi, true));
|
|
705
765
|
if (typeof value !== "function") return value;
|
|
706
|
-
effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
|
|
766
|
+
effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), withInsertionParent(parent, () => normalize(value, current, multi))), inner => {
|
|
707
767
|
current = insertExpression(parent, inner, current, marker);
|
|
708
768
|
host && tagHost(current, host);
|
|
709
769
|
}, prev !== undefined && !(options && options.schedule) ? {
|
|
@@ -1363,7 +1423,8 @@ function classListToObject(classList) {
|
|
|
1363
1423
|
function flattenClassList(list, result) {
|
|
1364
1424
|
for (let i = 0, len = list.length; i < len; i++) {
|
|
1365
1425
|
const item = list[i];
|
|
1366
|
-
if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);
|
|
1426
|
+
if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);
|
|
1427
|
+
else if (typeof item !== "boolean" && (item || item === 0)) result[item] = true;
|
|
1367
1428
|
}
|
|
1368
1429
|
}
|
|
1369
1430
|
function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
@@ -1379,12 +1440,13 @@ function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
|
1379
1440
|
const name = prop.slice(2).toLowerCase();
|
|
1380
1441
|
const delegate = DelegatedEvents.has(name);
|
|
1381
1442
|
if (!delegate && prev) {
|
|
1382
|
-
|
|
1383
|
-
node.removeEventListener(name,
|
|
1443
|
+
if (Array.isArray(value) && typeof prev === "function" && prev[$$EVENT_TUPLE] === value) return prev;
|
|
1444
|
+
node.removeEventListener(name, prev, typeof prev !== "function" && prev);
|
|
1384
1445
|
}
|
|
1385
1446
|
if (delegate || value) {
|
|
1386
|
-
addEvent(node, name, value, delegate);
|
|
1447
|
+
const attached = addEvent(node, name, value, delegate);
|
|
1387
1448
|
delegate && delegateEvents([name]);
|
|
1449
|
+
if (!delegate) return attached;
|
|
1388
1450
|
}
|
|
1389
1451
|
} else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
|
|
1390
1452
|
if (hasNamespace) prop = prop.slice(5);else if (isHydrating(node)) return value;
|
|
@@ -1424,7 +1486,7 @@ function eventHandler(e, container, state) {
|
|
|
1424
1486
|
}
|
|
1425
1487
|
if (handler && !node.disabled) {
|
|
1426
1488
|
const data = node[`${key}Data`];
|
|
1427
|
-
data !== undefined ? handler.call(node, data, e) : handler.call(node, e);
|
|
1489
|
+
data !== undefined ? handler.call(node, data, e) : typeof handler === "function" ? handler.call(node, e) : handler.handleEvent(e);
|
|
1428
1490
|
if (e.cancelBubble) return;
|
|
1429
1491
|
}
|
|
1430
1492
|
node.host && typeof node.host !== "string" && !node.host._$host && node.contains(e.target) && retarget(node.host);
|
|
@@ -1544,7 +1606,7 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
1544
1606
|
const item = value[i],
|
|
1545
1607
|
prev = current && current[i],
|
|
1546
1608
|
t = typeof item;
|
|
1547
|
-
if ((t === "string" || t === "number") && prev && prev.nodeType === 3) value[i] = prev;
|
|
1609
|
+
if ((t === "string" || t === "number") && prev && prev.nodeType === 3 && isHydrating(prev)) value[i] = prev;
|
|
1548
1610
|
}
|
|
1549
1611
|
}
|
|
1550
1612
|
return value;
|
|
@@ -2016,6 +2078,7 @@ function isSafeError(value) {
|
|
|
2016
2078
|
return !!(value && (typeof value === "object" || typeof value === "function") && value[SAFE_ERROR]);
|
|
2017
2079
|
}
|
|
2018
2080
|
const REVALIDATE_HEADER = "X-Revalidate";
|
|
2081
|
+
const RESPONSE_HEADER_VALUE_LIMIT = 4096;
|
|
2019
2082
|
function initWithRevalidate(init = {}) {
|
|
2020
2083
|
const resolved = typeof init === "number" ? {
|
|
2021
2084
|
status: init
|
|
@@ -2036,7 +2099,13 @@ function initWithRevalidate(init = {}) {
|
|
|
2036
2099
|
} else {
|
|
2037
2100
|
headers = new Headers(responseInit.headers);
|
|
2038
2101
|
}
|
|
2039
|
-
revalidate !== undefined
|
|
2102
|
+
if (revalidate !== undefined) {
|
|
2103
|
+
const keys = revalidate.toString();
|
|
2104
|
+
if (keys.length > RESPONSE_HEADER_VALUE_LIMIT) {
|
|
2105
|
+
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.`);
|
|
2106
|
+
}
|
|
2107
|
+
headers.set(REVALIDATE_HEADER, keys);
|
|
2108
|
+
}
|
|
2040
2109
|
return {
|
|
2041
2110
|
responseInit,
|
|
2042
2111
|
headers
|
|
@@ -2054,7 +2123,12 @@ function redirect(url, init = 302) {
|
|
|
2054
2123
|
responseInit.status = 302;
|
|
2055
2124
|
}
|
|
2056
2125
|
const target = typeof url === "string" ? url : url[HREF];
|
|
2057
|
-
|
|
2126
|
+
const location = typeof target === "string" ? target : String(url);
|
|
2127
|
+
const encoded = location.replace(/[^\x00-\x7f]/gu, encodeURIComponent);
|
|
2128
|
+
if (encoded.length > RESPONSE_HEADER_VALUE_LIMIT) {
|
|
2129
|
+
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.`);
|
|
2130
|
+
}
|
|
2131
|
+
headers.set("Location", encoded);
|
|
2058
2132
|
return new Response(null, {
|
|
2059
2133
|
...responseInit,
|
|
2060
2134
|
headers
|
|
@@ -2070,11 +2144,19 @@ function reload(init = {}) {
|
|
|
2070
2144
|
headers
|
|
2071
2145
|
});
|
|
2072
2146
|
}
|
|
2147
|
+
const NULL_BODY_STATUSES = new Set([204, 205, 304]);
|
|
2073
2148
|
function respond(value, init = {}) {
|
|
2074
2149
|
const {
|
|
2075
2150
|
responseInit,
|
|
2076
2151
|
headers
|
|
2077
2152
|
} = initWithRevalidate(init);
|
|
2153
|
+
for (const header of COMPOSED_BODY_FRAMING) headers.delete(header);
|
|
2154
|
+
if (NULL_BODY_STATUSES.has(responseInit.status)) {
|
|
2155
|
+
return new ResponseEnvelope(new Response(null, {
|
|
2156
|
+
...responseInit,
|
|
2157
|
+
headers
|
|
2158
|
+
}), value);
|
|
2159
|
+
}
|
|
2078
2160
|
headers.set("Content-Type", "application/json");
|
|
2079
2161
|
return new ResponseEnvelope(new Response(JSON.stringify(value), {
|
|
2080
2162
|
...responseInit,
|
|
@@ -2181,9 +2263,24 @@ function dynamic(source) {
|
|
|
2181
2263
|
return solidJs.untrack(() => component(props));
|
|
2182
2264
|
}
|
|
2183
2265
|
case "string":
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2266
|
+
{
|
|
2267
|
+
if (solidJs.sharedConfig.hydrating) {
|
|
2268
|
+
const el = getNextElement();
|
|
2269
|
+
spread(el, props);
|
|
2270
|
+
return el;
|
|
2271
|
+
}
|
|
2272
|
+
const owner = solidJs.getOwner();
|
|
2273
|
+
let el;
|
|
2274
|
+
return () => {
|
|
2275
|
+
if (!el) {
|
|
2276
|
+
solidJs.runWithOwner(owner, () => {
|
|
2277
|
+
el = createElement(component, solidJs.untrack(() => props.is));
|
|
2278
|
+
spread(el, props);
|
|
2279
|
+
});
|
|
2280
|
+
}
|
|
2281
|
+
return el;
|
|
2282
|
+
};
|
|
2283
|
+
}
|
|
2187
2284
|
}
|
|
2188
2285
|
});
|
|
2189
2286
|
};
|
|
@@ -2192,8 +2289,15 @@ function Dynamic(props) {
|
|
|
2192
2289
|
const Comp = dynamic(() => props.component);
|
|
2193
2290
|
return solidJs.createComponent(Comp, solidJs.omit(props, "component"));
|
|
2194
2291
|
}
|
|
2292
|
+
const AmbiguousSVGElements = /*#__PURE__*/new Set(["a", "script", "style", "title"]);
|
|
2195
2293
|
function createElement(tagName, is = undefined) {
|
|
2196
|
-
|
|
2294
|
+
if (SVGElements.has(tagName)) return document.createElementNS(Namespaces.svg, tagName);
|
|
2295
|
+
if (MathMLElements.has(tagName)) return document.createElementNS(Namespaces.mathml, tagName);
|
|
2296
|
+
if (AmbiguousSVGElements.has(tagName)) {
|
|
2297
|
+
const parent = getInsertionParent();
|
|
2298
|
+
if (parent && parent.namespaceURI === Namespaces.svg && parent.localName !== "foreignObject") return document.createElementNS(Namespaces.svg, tagName);
|
|
2299
|
+
}
|
|
2300
|
+
return document.createElement(tagName, {
|
|
2197
2301
|
is
|
|
2198
2302
|
});
|
|
2199
2303
|
}
|
|
@@ -2289,8 +2393,10 @@ exports.Dynamic = Dynamic;
|
|
|
2289
2393
|
exports.HREF = HREF;
|
|
2290
2394
|
exports.HydrationScript = HydrationScript;
|
|
2291
2395
|
exports.MathMLElements = MathMLElements;
|
|
2396
|
+
exports.NULL_BODY_STATUSES = NULL_BODY_STATUSES;
|
|
2292
2397
|
exports.Namespaces = Namespaces;
|
|
2293
2398
|
exports.Portal = Portal;
|
|
2399
|
+
exports.RESPONSE_HEADER_VALUE_LIMIT = RESPONSE_HEADER_VALUE_LIMIT;
|
|
2294
2400
|
exports.REVALIDATE_HEADER = REVALIDATE_HEADER;
|
|
2295
2401
|
exports.RawTextElements = RawTextElements;
|
|
2296
2402
|
exports.RequestContext = RequestContext;
|
|
@@ -2323,6 +2429,7 @@ exports.getDelegatedRoot = getDelegatedRoot;
|
|
|
2323
2429
|
exports.getExpectedRedirectStatus = getExpectedRedirectStatus;
|
|
2324
2430
|
exports.getFirstChild = getFirstChild;
|
|
2325
2431
|
exports.getHydrationKey = getHydrationKey;
|
|
2432
|
+
exports.getInsertionParent = getInsertionParent;
|
|
2326
2433
|
exports.getNextElement = getNextElement;
|
|
2327
2434
|
exports.getNextMarker = getNextMarker;
|
|
2328
2435
|
exports.getNextMatch = getNextMatch;
|