solid-js 1.8.10 → 1.8.11
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.js +307 -544
- package/dist/server.js +75 -170
- package/dist/solid.js +265 -471
- package/h/dist/h.js +8 -34
- package/h/jsx-runtime/dist/jsx.js +1 -1
- package/h/jsx-runtime/types/index.d.ts +8 -11
- package/h/types/hyperscript.d.ts +11 -11
- package/html/dist/html.js +94 -216
- package/html/types/lit.d.ts +33 -47
- package/package.json +1 -1
- package/store/dist/dev.js +42 -117
- package/store/dist/server.js +8 -19
- package/store/dist/store.js +39 -108
- package/store/types/index.d.ts +7 -21
- package/store/types/modifiers.d.ts +3 -6
- package/store/types/mutable.d.ts +2 -5
- package/store/types/server.d.ts +4 -12
- package/store/types/store.d.ts +61 -218
- package/types/index.d.ts +10 -75
- package/types/reactive/array.d.ts +4 -12
- package/types/reactive/observable.d.ts +17 -25
- package/types/reactive/scheduler.d.ts +6 -9
- package/types/reactive/signal.d.ts +142 -233
- package/types/render/Suspense.d.ts +5 -5
- package/types/render/component.d.ts +33 -64
- package/types/render/flow.d.ts +31 -43
- package/types/render/hydration.d.ts +13 -13
- package/types/server/index.d.ts +2 -57
- package/types/server/reactive.d.ts +42 -73
- package/types/server/rendering.d.ts +96 -167
- package/universal/dist/dev.js +12 -28
- package/universal/dist/universal.js +12 -28
- package/universal/types/index.d.ts +1 -3
- package/universal/types/universal.d.ts +1 -0
- package/web/dist/dev.cjs +3 -3
- package/web/dist/dev.js +84 -623
- package/web/dist/server.js +97 -203
- package/web/dist/storage.js +3 -3
- package/web/dist/web.cjs +3 -3
- package/web/dist/web.js +83 -617
- package/web/types/client.d.ts +2 -2
- package/web/types/core.d.ts +1 -10
- package/web/types/index.d.ts +10 -27
- package/web/types/server-mock.d.ts +32 -47
package/web/dist/server.js
CHANGED
|
@@ -1,86 +1,31 @@
|
|
|
1
|
-
import { sharedConfig, createRoot, splitProps } from
|
|
2
|
-
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Index,
|
|
6
|
-
Match,
|
|
7
|
-
Show,
|
|
8
|
-
Suspense,
|
|
9
|
-
SuspenseList,
|
|
10
|
-
Switch,
|
|
11
|
-
createComponent,
|
|
12
|
-
mergeProps
|
|
13
|
-
} from "solid-js";
|
|
14
|
-
import { Feature, Serializer, getCrossReferenceHeader } from "seroval";
|
|
15
|
-
import {
|
|
16
|
-
CustomEventPlugin,
|
|
17
|
-
DOMExceptionPlugin,
|
|
18
|
-
EventPlugin,
|
|
19
|
-
FormDataPlugin,
|
|
20
|
-
HeadersPlugin,
|
|
21
|
-
ReadableStreamPlugin,
|
|
22
|
-
RequestPlugin,
|
|
23
|
-
ResponsePlugin,
|
|
24
|
-
URLSearchParamsPlugin,
|
|
25
|
-
URLPlugin
|
|
26
|
-
} from "seroval-plugins/web";
|
|
1
|
+
import { sharedConfig, createRoot, splitProps } from 'solid-js';
|
|
2
|
+
export { ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, createComponent, mergeProps } from 'solid-js';
|
|
3
|
+
import { Feature, Serializer, getCrossReferenceHeader } from 'seroval';
|
|
4
|
+
import { CustomEventPlugin, DOMExceptionPlugin, EventPlugin, FormDataPlugin, HeadersPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLSearchParamsPlugin, URLPlugin } from 'seroval-plugins/web';
|
|
27
5
|
|
|
28
|
-
const booleans = [
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"autoplay",
|
|
33
|
-
"checked",
|
|
34
|
-
"controls",
|
|
35
|
-
"default",
|
|
36
|
-
"disabled",
|
|
37
|
-
"formnovalidate",
|
|
38
|
-
"hidden",
|
|
39
|
-
"indeterminate",
|
|
40
|
-
"inert",
|
|
41
|
-
"ismap",
|
|
42
|
-
"loop",
|
|
43
|
-
"multiple",
|
|
44
|
-
"muted",
|
|
45
|
-
"nomodule",
|
|
46
|
-
"novalidate",
|
|
47
|
-
"open",
|
|
48
|
-
"playsinline",
|
|
49
|
-
"readonly",
|
|
50
|
-
"required",
|
|
51
|
-
"reversed",
|
|
52
|
-
"seamless",
|
|
53
|
-
"selected"
|
|
54
|
-
];
|
|
55
|
-
const BooleanAttributes = /*#__PURE__*/ new Set(booleans);
|
|
56
|
-
const ChildProperties = /*#__PURE__*/ new Set([
|
|
57
|
-
"innerHTML",
|
|
58
|
-
"textContent",
|
|
59
|
-
"innerText",
|
|
60
|
-
"children"
|
|
61
|
-
]);
|
|
62
|
-
const Aliases = /*#__PURE__*/ Object.assign(Object.create(null), {
|
|
6
|
+
const booleans = ["allowfullscreen", "async", "autofocus", "autoplay", "checked", "controls", "default", "disabled", "formnovalidate", "hidden", "indeterminate", "inert", "ismap", "loop", "multiple", "muted", "nomodule", "novalidate", "open", "playsinline", "readonly", "required", "reversed", "seamless", "selected"];
|
|
7
|
+
const BooleanAttributes = /*#__PURE__*/new Set(booleans);
|
|
8
|
+
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
9
|
+
const Aliases = /*#__PURE__*/Object.assign(Object.create(null), {
|
|
63
10
|
className: "class",
|
|
64
11
|
htmlFor: "for"
|
|
65
12
|
});
|
|
66
13
|
|
|
67
|
-
const ES2017FLAG = Feature.AggregateError
|
|
68
|
-
|
|
69
|
-
|
|
14
|
+
const ES2017FLAG = Feature.AggregateError
|
|
15
|
+
| Feature.BigInt
|
|
16
|
+
| Feature.BigIntTypedArray;
|
|
17
|
+
const GLOBAL_IDENTIFIER = '_$HY.r';
|
|
18
|
+
function createSerializer({
|
|
19
|
+
onData,
|
|
20
|
+
onDone,
|
|
21
|
+
scopeId,
|
|
22
|
+
onError
|
|
23
|
+
}) {
|
|
70
24
|
return new Serializer({
|
|
71
25
|
scopeId,
|
|
72
26
|
plugins: [
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
EventPlugin,
|
|
76
|
-
FormDataPlugin,
|
|
77
|
-
HeadersPlugin,
|
|
78
|
-
ReadableStreamPlugin,
|
|
79
|
-
RequestPlugin,
|
|
80
|
-
ResponsePlugin,
|
|
81
|
-
URLSearchParamsPlugin,
|
|
82
|
-
URLPlugin
|
|
83
|
-
],
|
|
27
|
+
CustomEventPlugin, DOMExceptionPlugin, EventPlugin,
|
|
28
|
+
FormDataPlugin, HeadersPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLSearchParamsPlugin, URLPlugin],
|
|
84
29
|
globalIdentifier: GLOBAL_IDENTIFIER,
|
|
85
30
|
disabledFeatures: ES2017FLAG,
|
|
86
31
|
onData,
|
|
@@ -89,14 +34,15 @@ function createSerializer({ onData, onDone, scopeId, onError }) {
|
|
|
89
34
|
});
|
|
90
35
|
}
|
|
91
36
|
function getLocalHeaderScript(id) {
|
|
92
|
-
return getCrossReferenceHeader(id) +
|
|
37
|
+
return getCrossReferenceHeader(id) + ';';
|
|
93
38
|
}
|
|
94
39
|
|
|
95
|
-
const VOID_ELEMENTS =
|
|
96
|
-
/^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
|
|
40
|
+
const VOID_ELEMENTS = /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
|
|
97
41
|
const REPLACE_SCRIPT = `function $df(e,n,o,t){if(n=document.getElementById(e),o=document.getElementById("pl-"+e)){for(;o&&8!==o.nodeType&&o.nodeValue!=="pl-"+e;)t=o.nextSibling,o.remove(),o=t;_$HY.done?o.remove():o.replaceWith(n.content)}n.remove(),_$HY.fe(e)}`;
|
|
98
42
|
function renderToString(code, options = {}) {
|
|
99
|
-
const {
|
|
43
|
+
const {
|
|
44
|
+
renderId
|
|
45
|
+
} = options;
|
|
100
46
|
let scripts = "";
|
|
101
47
|
const serializer = createSerializer({
|
|
102
48
|
scopeId: renderId,
|
|
@@ -134,7 +80,9 @@ function renderToString(code, options = {}) {
|
|
|
134
80
|
return html;
|
|
135
81
|
}
|
|
136
82
|
function renderToStringAsync(code, options = {}) {
|
|
137
|
-
const {
|
|
83
|
+
const {
|
|
84
|
+
timeoutMs = 30000
|
|
85
|
+
} = options;
|
|
138
86
|
let timeoutHandle;
|
|
139
87
|
const timeout = new Promise((_, reject) => {
|
|
140
88
|
timeoutHandle = setTimeout(() => reject("renderToString timed out"), timeoutMs);
|
|
@@ -145,7 +93,13 @@ function renderToStringAsync(code, options = {}) {
|
|
|
145
93
|
});
|
|
146
94
|
}
|
|
147
95
|
function renderToStream(code, options = {}) {
|
|
148
|
-
let {
|
|
96
|
+
let {
|
|
97
|
+
nonce,
|
|
98
|
+
onCompleteShell,
|
|
99
|
+
onCompleteAll,
|
|
100
|
+
renderId,
|
|
101
|
+
noScripts
|
|
102
|
+
} = options;
|
|
149
103
|
let dispose;
|
|
150
104
|
const blockingPromises = [];
|
|
151
105
|
const pushTask = task => {
|
|
@@ -161,12 +115,11 @@ function renderToStream(code, options = {}) {
|
|
|
161
115
|
const onDone = () => {
|
|
162
116
|
writeTasks();
|
|
163
117
|
doShell();
|
|
164
|
-
onCompleteAll &&
|
|
165
|
-
|
|
166
|
-
write(v)
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
});
|
|
118
|
+
onCompleteAll && onCompleteAll({
|
|
119
|
+
write(v) {
|
|
120
|
+
!completed && buffer.write(v);
|
|
121
|
+
}
|
|
122
|
+
});
|
|
170
123
|
writable && writable.end();
|
|
171
124
|
completed = true;
|
|
172
125
|
if (firstFlushed) dispose();
|
|
@@ -223,23 +176,17 @@ function renderToStream(code, options = {}) {
|
|
|
223
176
|
const first = html.indexOf(placeholder);
|
|
224
177
|
if (first === -1) return;
|
|
225
178
|
const last = html.indexOf(`<!--!$/${id}-->`, first + placeholder.length);
|
|
226
|
-
html = html.replace(
|
|
227
|
-
html.slice(first, last + placeholder.length + 1),
|
|
228
|
-
resolveSSRNode(payloadFn())
|
|
229
|
-
);
|
|
179
|
+
html = html.replace(html.slice(first, last + placeholder.length + 1), resolveSSRNode(payloadFn()));
|
|
230
180
|
},
|
|
231
181
|
serialize(id, p, wait) {
|
|
232
182
|
const serverOnly = sharedConfig.context.noHydrate;
|
|
233
183
|
if (!firstFlushed && wait && typeof p === "object" && "then" in p) {
|
|
234
184
|
blockingPromises.push(p);
|
|
235
|
-
!serverOnly &&
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
.catch(e => {
|
|
241
|
-
serializer.write(id, e);
|
|
242
|
-
});
|
|
185
|
+
!serverOnly && p.then(d => {
|
|
186
|
+
serializer.write(id, d);
|
|
187
|
+
}).catch(e => {
|
|
188
|
+
serializer.write(id, e);
|
|
189
|
+
});
|
|
243
190
|
} else if (!serverOnly) serializer.write(id, p);
|
|
244
191
|
},
|
|
245
192
|
roots: 0,
|
|
@@ -249,7 +196,7 @@ function renderToStream(code, options = {}) {
|
|
|
249
196
|
registerFragment(key) {
|
|
250
197
|
if (!registry.has(key)) {
|
|
251
198
|
let resolve, reject;
|
|
252
|
-
const p = new Promise((r, rej) => (
|
|
199
|
+
const p = new Promise((r, rej) => (resolve = r, reject = rej));
|
|
253
200
|
registry.set(key, {
|
|
254
201
|
resolve: v => queue(() => queue(() => resolve(v))),
|
|
255
202
|
reject: e => queue(() => queue(() => reject(e)))
|
|
@@ -258,7 +205,10 @@ function renderToStream(code, options = {}) {
|
|
|
258
205
|
}
|
|
259
206
|
return (value, error) => {
|
|
260
207
|
if (registry.has(key)) {
|
|
261
|
-
const {
|
|
208
|
+
const {
|
|
209
|
+
resolve,
|
|
210
|
+
reject
|
|
211
|
+
} = registry.get(key);
|
|
262
212
|
registry.delete(key);
|
|
263
213
|
if (waitForFragments(registry, key)) {
|
|
264
214
|
resolve(true);
|
|
@@ -266,7 +216,7 @@ function renderToStream(code, options = {}) {
|
|
|
266
216
|
}
|
|
267
217
|
if ((value !== undefined || error) && !completed) {
|
|
268
218
|
if (!firstFlushed) {
|
|
269
|
-
queue(() =>
|
|
219
|
+
queue(() => html = replacePlaceholder(html, key, value !== undefined ? value : ""));
|
|
270
220
|
error ? reject(error) : resolve(true);
|
|
271
221
|
} else {
|
|
272
222
|
buffer.write(`<template id="${key}">${value !== undefined ? value : " "}</template>`);
|
|
@@ -293,12 +243,11 @@ function renderToStream(code, options = {}) {
|
|
|
293
243
|
if (tasks.length) html = injectScripts(html, tasks, nonce);
|
|
294
244
|
buffer.write(html);
|
|
295
245
|
tasks = "";
|
|
296
|
-
onCompleteShell &&
|
|
297
|
-
|
|
298
|
-
write(v)
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
});
|
|
246
|
+
onCompleteShell && onCompleteShell({
|
|
247
|
+
write(v) {
|
|
248
|
+
!completed && buffer.write(v);
|
|
249
|
+
}
|
|
250
|
+
});
|
|
302
251
|
shellCompleted = true;
|
|
303
252
|
}
|
|
304
253
|
return {
|
|
@@ -333,7 +282,7 @@ function renderToStream(code, options = {}) {
|
|
|
333
282
|
pipeTo(w) {
|
|
334
283
|
return allSettled(blockingPromises).then(() => {
|
|
335
284
|
let resolve;
|
|
336
|
-
const p = new Promise(r =>
|
|
285
|
+
const p = new Promise(r => resolve = r);
|
|
337
286
|
setTimeout(() => {
|
|
338
287
|
doShell();
|
|
339
288
|
const encoder = new TextEncoder();
|
|
@@ -363,13 +312,13 @@ function renderToStream(code, options = {}) {
|
|
|
363
312
|
};
|
|
364
313
|
}
|
|
365
314
|
function HydrationScript(props) {
|
|
366
|
-
const {
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
);
|
|
315
|
+
const {
|
|
316
|
+
nonce
|
|
317
|
+
} = sharedConfig.context;
|
|
318
|
+
return ssr(generateHydrationScript({
|
|
319
|
+
nonce,
|
|
320
|
+
...props
|
|
321
|
+
}));
|
|
373
322
|
}
|
|
374
323
|
function ssr(t, ...nodes) {
|
|
375
324
|
if (nodes.length) {
|
|
@@ -414,8 +363,7 @@ function ssrStyle(value) {
|
|
|
414
363
|
return result;
|
|
415
364
|
}
|
|
416
365
|
function ssrElement(tag, props, children, needsId) {
|
|
417
|
-
if (props == null) props = {};
|
|
418
|
-
else if (typeof props === "function") props = props();
|
|
366
|
+
if (props == null) props = {};else if (typeof props === "function") props = props();
|
|
419
367
|
const skipChildren = VOID_ELEMENTS.test(tag);
|
|
420
368
|
const keys = Object.keys(props);
|
|
421
369
|
let result = `<${tag}${needsId ? ssrHydrationKey() : ""} `;
|
|
@@ -423,8 +371,7 @@ function ssrElement(tag, props, children, needsId) {
|
|
|
423
371
|
for (let i = 0; i < keys.length; i++) {
|
|
424
372
|
const prop = keys[i];
|
|
425
373
|
if (ChildProperties.has(prop)) {
|
|
426
|
-
if (children === undefined && !skipChildren)
|
|
427
|
-
children = prop === "innerHTML" ? props[prop] : escape(props[prop]);
|
|
374
|
+
if (children === undefined && !skipChildren) children = prop === "innerHTML" ? props[prop] : escape(props[prop]);
|
|
428
375
|
continue;
|
|
429
376
|
}
|
|
430
377
|
const value = props[prop];
|
|
@@ -433,14 +380,10 @@ function ssrElement(tag, props, children, needsId) {
|
|
|
433
380
|
} else if (prop === "class" || prop === "className" || prop === "classList") {
|
|
434
381
|
if (classResolved) continue;
|
|
435
382
|
let n;
|
|
436
|
-
result += `class="${
|
|
437
|
-
escape(((n = props.class) ? n + " " : "") + ((n = props.className) ? n + " " : ""), true) +
|
|
438
|
-
ssrClassList(props.classList)
|
|
439
|
-
}"`;
|
|
383
|
+
result += `class="${escape(((n = props.class) ? n + " " : "") + ((n = props.className) ? n + " " : ""), true) + ssrClassList(props.classList)}"`;
|
|
440
384
|
classResolved = true;
|
|
441
385
|
} else if (BooleanAttributes.has(prop)) {
|
|
442
|
-
if (value) result += prop;
|
|
443
|
-
else continue;
|
|
386
|
+
if (value) result += prop;else continue;
|
|
444
387
|
} else if (value == undefined || prop === "ref" || prop.slice(0, 2) === "on") {
|
|
445
388
|
continue;
|
|
446
389
|
} else {
|
|
@@ -448,17 +391,16 @@ function ssrElement(tag, props, children, needsId) {
|
|
|
448
391
|
}
|
|
449
392
|
if (i !== keys.length - 1) result += " ";
|
|
450
393
|
}
|
|
451
|
-
if (skipChildren)
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
};
|
|
394
|
+
if (skipChildren) return {
|
|
395
|
+
t: result + "/>"
|
|
396
|
+
};
|
|
455
397
|
if (typeof children === "function") children = children();
|
|
456
398
|
return {
|
|
457
399
|
t: result + `>${resolveSSRNode(children, true)}</${tag}>`
|
|
458
400
|
};
|
|
459
401
|
}
|
|
460
402
|
function ssrAttribute(key, value, isBoolean) {
|
|
461
|
-
return isBoolean ?
|
|
403
|
+
return isBoolean ? value ? " " + key : "" : value != null ? ` ${key}="${value}"` : "";
|
|
462
404
|
}
|
|
463
405
|
function ssrHydrationKey() {
|
|
464
406
|
const hk = getHydrationKey();
|
|
@@ -502,13 +444,12 @@ function escape(s, attr) {
|
|
|
502
444
|
left = iDelim + 1;
|
|
503
445
|
iDelim = s.indexOf(delim, left);
|
|
504
446
|
} while (iDelim >= 0);
|
|
505
|
-
} else
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
}
|
|
447
|
+
} else while (iAmp >= 0) {
|
|
448
|
+
if (left < iAmp) out += s.substring(left, iAmp);
|
|
449
|
+
out += "&";
|
|
450
|
+
left = iAmp + 1;
|
|
451
|
+
iAmp = s.indexOf("&", left);
|
|
452
|
+
}
|
|
512
453
|
return left < s.length ? out + s.substring(left) : out;
|
|
513
454
|
}
|
|
514
455
|
function resolveSSRNode(node, top) {
|
|
@@ -520,7 +461,7 @@ function resolveSSRNode(node, top) {
|
|
|
520
461
|
let mapped = "";
|
|
521
462
|
for (let i = 0, len = node.length; i < len; i++) {
|
|
522
463
|
if (!top && typeof prev !== "object" && typeof node[i] !== "object") mapped += `<!--!$-->`;
|
|
523
|
-
mapped += resolveSSRNode(
|
|
464
|
+
mapped += resolveSSRNode(prev = node[i]);
|
|
524
465
|
}
|
|
525
466
|
return mapped;
|
|
526
467
|
}
|
|
@@ -541,12 +482,11 @@ function getAssets() {
|
|
|
541
482
|
for (let i = 0, len = assets.length; i < len; i++) out += assets[i]();
|
|
542
483
|
return out;
|
|
543
484
|
}
|
|
544
|
-
function generateHydrationScript({
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
)}"].forEach((o=>document.addEventListener(o,(o=>{let a=o.composedPath&&o.composedPath()[0]||o.target,s=t(a);s&&!e.completed.has(s)&&e.events.push([s,o])}))))})(_$HY={events:[],completed:new WeakSet,r:{},fe(){}});</script><!--xs-->`;
|
|
485
|
+
function generateHydrationScript({
|
|
486
|
+
eventNames = ["click", "input"],
|
|
487
|
+
nonce
|
|
488
|
+
} = {}) {
|
|
489
|
+
return `<script${nonce ? ` nonce="${nonce}"` : ""}>window._$HY||(e=>{let t=e=>e&&e.hasAttribute&&(e.hasAttribute("data-hk")?e:t(e.host&&e.host.nodeType?e.host:e.parentNode));["${eventNames.join('", "')}"].forEach((o=>document.addEventListener(o,(o=>{let a=o.composedPath&&o.composedPath()[0]||o.target,s=t(a);s&&!e.completed.has(s)&&e.events.push([s,o])}))))})(_$HY={events:[],completed:new WeakSet,r:{},fe(){}});</script><!--xs-->`;
|
|
550
490
|
}
|
|
551
491
|
function Hydration(props) {
|
|
552
492
|
if (!sharedConfig.context.noHydrate) return props.children;
|
|
@@ -605,20 +545,16 @@ function replacePlaceholder(html, key, value) {
|
|
|
605
545
|
}
|
|
606
546
|
const RequestContext = Symbol();
|
|
607
547
|
function getRequestEvent() {
|
|
608
|
-
return globalThis[RequestContext]
|
|
609
|
-
? globalThis[RequestContext].getStore() ||
|
|
610
|
-
(sharedConfig.context && sharedConfig.context.event) ||
|
|
611
|
-
console.log(
|
|
612
|
-
"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."
|
|
613
|
-
)
|
|
614
|
-
: undefined;
|
|
548
|
+
return globalThis[RequestContext] ? globalThis[RequestContext].getStore() || sharedConfig.context && sharedConfig.context.event || console.log("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;
|
|
615
549
|
}
|
|
616
550
|
function Assets(props) {
|
|
617
551
|
useAssets(() => props.children);
|
|
618
552
|
}
|
|
619
553
|
function pipeToNodeWritable(code, writable, options = {}) {
|
|
620
554
|
if (options.onReady) {
|
|
621
|
-
options.onCompleteShell = ({
|
|
555
|
+
options.onCompleteShell = ({
|
|
556
|
+
write
|
|
557
|
+
}) => {
|
|
622
558
|
options.onReady({
|
|
623
559
|
write,
|
|
624
560
|
startWriting() {
|
|
@@ -632,7 +568,9 @@ function pipeToNodeWritable(code, writable, options = {}) {
|
|
|
632
568
|
}
|
|
633
569
|
function pipeToWritable(code, writable, options = {}) {
|
|
634
570
|
if (options.onReady) {
|
|
635
|
-
options.onCompleteShell = ({
|
|
571
|
+
options.onCompleteShell = ({
|
|
572
|
+
write
|
|
573
|
+
}) => {
|
|
636
574
|
options.onReady({
|
|
637
575
|
write,
|
|
638
576
|
startWriting() {
|
|
@@ -662,19 +600,11 @@ function ssrSpread(props, isSVG, skipChildren) {
|
|
|
662
600
|
} else if (prop === "class" || prop === "className" || prop === "classList") {
|
|
663
601
|
if (classResolved) continue;
|
|
664
602
|
let n;
|
|
665
|
-
result += `class="${(n = props.class) ? n + " " : ""}${
|
|
666
|
-
(n = props.className) ? n + " " : ""
|
|
667
|
-
}${ssrClassList(props.classList)}"`;
|
|
603
|
+
result += `class="${(n = props.class) ? n + " " : ""}${(n = props.className) ? n + " " : ""}${ssrClassList(props.classList)}"`;
|
|
668
604
|
classResolved = true;
|
|
669
605
|
} else if (BooleanAttributes.has(prop)) {
|
|
670
|
-
if (value) result += prop;
|
|
671
|
-
|
|
672
|
-
} else if (
|
|
673
|
-
value == undefined ||
|
|
674
|
-
prop === "ref" ||
|
|
675
|
-
prop.slice(0, 2) === "on" ||
|
|
676
|
-
prop.slice(0, 5) === "prop:"
|
|
677
|
-
) {
|
|
606
|
+
if (value) result += prop;else continue;
|
|
607
|
+
} else if (value == undefined || prop === "ref" || prop.slice(0, 2) === "on" || prop.slice(0, 5) === "prop:") {
|
|
678
608
|
continue;
|
|
679
609
|
} else {
|
|
680
610
|
if (prop.slice(0, 5) === "attr:") prop = prop.slice(5);
|
|
@@ -698,8 +628,7 @@ function Dynamic(props) {
|
|
|
698
628
|
const comp = p.component,
|
|
699
629
|
t = typeof comp;
|
|
700
630
|
if (comp) {
|
|
701
|
-
if (t === "function") return comp(others);
|
|
702
|
-
else if (t === "string") {
|
|
631
|
+
if (t === "function") return comp(others);else if (t === "string") {
|
|
703
632
|
return ssrElement(comp, others, undefined, true);
|
|
704
633
|
}
|
|
705
634
|
}
|
|
@@ -708,39 +637,4 @@ function Portal(props) {
|
|
|
708
637
|
return "";
|
|
709
638
|
}
|
|
710
639
|
|
|
711
|
-
export {
|
|
712
|
-
Assets,
|
|
713
|
-
Dynamic,
|
|
714
|
-
Hydration,
|
|
715
|
-
HydrationScript,
|
|
716
|
-
NoHydration,
|
|
717
|
-
Portal,
|
|
718
|
-
RequestContext,
|
|
719
|
-
addEventListener,
|
|
720
|
-
delegateEvents,
|
|
721
|
-
escape,
|
|
722
|
-
generateHydrationScript,
|
|
723
|
-
getAssets,
|
|
724
|
-
getHydrationKey,
|
|
725
|
-
getRequestEvent,
|
|
726
|
-
hydrate,
|
|
727
|
-
insert,
|
|
728
|
-
isDev,
|
|
729
|
-
isServer,
|
|
730
|
-
pipeToNodeWritable,
|
|
731
|
-
pipeToWritable,
|
|
732
|
-
render,
|
|
733
|
-
renderToStream,
|
|
734
|
-
renderToString,
|
|
735
|
-
renderToStringAsync,
|
|
736
|
-
resolveSSRNode,
|
|
737
|
-
spread,
|
|
738
|
-
ssr,
|
|
739
|
-
ssrAttribute,
|
|
740
|
-
ssrClassList,
|
|
741
|
-
ssrElement,
|
|
742
|
-
ssrHydrationKey,
|
|
743
|
-
ssrSpread,
|
|
744
|
-
ssrStyle,
|
|
745
|
-
useAssets
|
|
746
|
-
};
|
|
640
|
+
export { Assets, Dynamic, Hydration, HydrationScript, NoHydration, Portal, RequestContext, addEventListener, delegateEvents, escape, generateHydrationScript, getAssets, getHydrationKey, getRequestEvent, hydrate, insert, isDev, isServer, pipeToNodeWritable, pipeToWritable, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrSpread, ssrStyle, useAssets };
|
package/web/dist/storage.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { AsyncLocalStorage } from
|
|
2
|
-
import { isServer, RequestContext } from
|
|
1
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
|
+
import { isServer, RequestContext } from 'solid-js/web';
|
|
3
3
|
|
|
4
4
|
function provideRequestEvent(init, cb) {
|
|
5
5
|
if (!isServer) throw new Error("Attempting to use server context in non-server build");
|
|
6
|
-
const ctx =
|
|
6
|
+
const ctx = globalThis[RequestContext] = globalThis[RequestContext] || new AsyncLocalStorage();
|
|
7
7
|
return ctx.run(init, cb);
|
|
8
8
|
}
|
|
9
9
|
|
package/web/dist/web.cjs
CHANGED
|
@@ -333,7 +333,7 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
|
333
333
|
let isCE, isProp, isChildProp, propAlias, forceProp;
|
|
334
334
|
if (prop === "style") return style(node, value, prev);
|
|
335
335
|
if (prop === "classList") return classList(node, value, prev);
|
|
336
|
-
if (value === prev
|
|
336
|
+
if (value === prev) return prev;
|
|
337
337
|
if (prop === "ref") {
|
|
338
338
|
if (!skipRef) value(node);
|
|
339
339
|
} else if (prop.slice(0, 3) === "on:") {
|
|
@@ -416,7 +416,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
416
416
|
if (multi) {
|
|
417
417
|
let node = current[0];
|
|
418
418
|
if (node && node.nodeType === 3) {
|
|
419
|
-
node.data = value;
|
|
419
|
+
node.data !== value && (node.data = value);
|
|
420
420
|
} else node = document.createTextNode(value);
|
|
421
421
|
current = cleanChildren(parent, current, marker, node);
|
|
422
422
|
} else {
|
|
@@ -534,7 +534,7 @@ function NoHydration(props) {
|
|
|
534
534
|
function Hydration(props) {
|
|
535
535
|
return props.children;
|
|
536
536
|
}
|
|
537
|
-
|
|
537
|
+
const voidFn = () => undefined;
|
|
538
538
|
const RequestContext = Symbol();
|
|
539
539
|
function innerHTML(parent, content) {
|
|
540
540
|
!solidJs.sharedConfig.context && (parent.innerHTML = content);
|