solid-js 1.3.0-rc.1 → 1.3.0
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 +64 -35
- package/dist/dev.js +63 -36
- package/dist/server.cjs +13 -3
- package/dist/server.js +11 -4
- package/dist/solid.cjs +58 -34
- package/dist/solid.js +57 -35
- package/package.json +2 -2
- package/types/index.d.ts +1 -1
- package/types/jsx.d.ts +1 -0
- package/types/reactive/signal.d.ts +27 -7
- package/types/server/index.d.ts +2 -2
- package/types/server/reactive.d.ts +2 -0
- package/types/server/rendering.d.ts +1 -0
- package/web/dist/dev.cjs +12 -36
- package/web/dist/server.cjs +24 -36
- package/web/dist/server.js +14 -6
- package/web/dist/web.cjs +12 -36
package/web/dist/dev.cjs
CHANGED
|
@@ -551,75 +551,51 @@ function Dynamic(props) {
|
|
|
551
551
|
|
|
552
552
|
Object.defineProperty(exports, 'ErrorBoundary', {
|
|
553
553
|
enumerable: true,
|
|
554
|
-
get: function () {
|
|
555
|
-
return solidJs.ErrorBoundary;
|
|
556
|
-
}
|
|
554
|
+
get: function () { return solidJs.ErrorBoundary; }
|
|
557
555
|
});
|
|
558
556
|
Object.defineProperty(exports, 'For', {
|
|
559
557
|
enumerable: true,
|
|
560
|
-
get: function () {
|
|
561
|
-
return solidJs.For;
|
|
562
|
-
}
|
|
558
|
+
get: function () { return solidJs.For; }
|
|
563
559
|
});
|
|
564
560
|
Object.defineProperty(exports, 'Index', {
|
|
565
561
|
enumerable: true,
|
|
566
|
-
get: function () {
|
|
567
|
-
return solidJs.Index;
|
|
568
|
-
}
|
|
562
|
+
get: function () { return solidJs.Index; }
|
|
569
563
|
});
|
|
570
564
|
Object.defineProperty(exports, 'Match', {
|
|
571
565
|
enumerable: true,
|
|
572
|
-
get: function () {
|
|
573
|
-
return solidJs.Match;
|
|
574
|
-
}
|
|
566
|
+
get: function () { return solidJs.Match; }
|
|
575
567
|
});
|
|
576
568
|
Object.defineProperty(exports, 'Show', {
|
|
577
569
|
enumerable: true,
|
|
578
|
-
get: function () {
|
|
579
|
-
return solidJs.Show;
|
|
580
|
-
}
|
|
570
|
+
get: function () { return solidJs.Show; }
|
|
581
571
|
});
|
|
582
572
|
Object.defineProperty(exports, 'Suspense', {
|
|
583
573
|
enumerable: true,
|
|
584
|
-
get: function () {
|
|
585
|
-
return solidJs.Suspense;
|
|
586
|
-
}
|
|
574
|
+
get: function () { return solidJs.Suspense; }
|
|
587
575
|
});
|
|
588
576
|
Object.defineProperty(exports, 'SuspenseList', {
|
|
589
577
|
enumerable: true,
|
|
590
|
-
get: function () {
|
|
591
|
-
return solidJs.SuspenseList;
|
|
592
|
-
}
|
|
578
|
+
get: function () { return solidJs.SuspenseList; }
|
|
593
579
|
});
|
|
594
580
|
Object.defineProperty(exports, 'Switch', {
|
|
595
581
|
enumerable: true,
|
|
596
|
-
get: function () {
|
|
597
|
-
return solidJs.Switch;
|
|
598
|
-
}
|
|
582
|
+
get: function () { return solidJs.Switch; }
|
|
599
583
|
});
|
|
600
584
|
Object.defineProperty(exports, 'createComponent', {
|
|
601
585
|
enumerable: true,
|
|
602
|
-
get: function () {
|
|
603
|
-
return solidJs.createComponent;
|
|
604
|
-
}
|
|
586
|
+
get: function () { return solidJs.createComponent; }
|
|
605
587
|
});
|
|
606
588
|
Object.defineProperty(exports, 'effect', {
|
|
607
589
|
enumerable: true,
|
|
608
|
-
get: function () {
|
|
609
|
-
return solidJs.createRenderEffect;
|
|
610
|
-
}
|
|
590
|
+
get: function () { return solidJs.createRenderEffect; }
|
|
611
591
|
});
|
|
612
592
|
Object.defineProperty(exports, 'getOwner', {
|
|
613
593
|
enumerable: true,
|
|
614
|
-
get: function () {
|
|
615
|
-
return solidJs.getOwner;
|
|
616
|
-
}
|
|
594
|
+
get: function () { return solidJs.getOwner; }
|
|
617
595
|
});
|
|
618
596
|
Object.defineProperty(exports, 'mergeProps', {
|
|
619
597
|
enumerable: true,
|
|
620
|
-
get: function () {
|
|
621
|
-
return solidJs.mergeProps;
|
|
622
|
-
}
|
|
598
|
+
get: function () { return solidJs.mergeProps; }
|
|
623
599
|
});
|
|
624
600
|
exports.Aliases = Aliases;
|
|
625
601
|
exports.Assets = Assets;
|
package/web/dist/server.cjs
CHANGED
|
@@ -258,6 +258,7 @@ function renderToStringAsync(code, options = {}) {
|
|
|
258
258
|
renderId,
|
|
259
259
|
timeoutMs = 30000
|
|
260
260
|
} = options;
|
|
261
|
+
const dedupe = new WeakMap();
|
|
261
262
|
const context = solidJs.sharedConfig.context = {
|
|
262
263
|
id: renderId || "",
|
|
263
264
|
count: 0,
|
|
@@ -268,8 +269,8 @@ function renderToStringAsync(code, options = {}) {
|
|
|
268
269
|
nonce,
|
|
269
270
|
writeResource(id, p, error) {
|
|
270
271
|
if (error) return scripts += `_$HY.set("${id}", ${serializeError(p)});`;
|
|
271
|
-
if (!p || typeof p !== "object" || !("then" in p)) return scripts +=
|
|
272
|
-
p.then(d => scripts +=
|
|
272
|
+
if (!p || typeof p !== "object" || !("then" in p)) return scripts += serializeSet(dedupe, id, p);
|
|
273
|
+
p.then(d => scripts += serializeSet(dedupe, id, d)).catch(() => scripts += `_$HY.set("${id}", {});`);
|
|
273
274
|
}
|
|
274
275
|
};
|
|
275
276
|
const timeout = new Promise((_, reject) => setTimeout(() => reject("renderToString timed out"), timeoutMs));
|
|
@@ -318,6 +319,7 @@ function renderToStream(code, options = {}) {
|
|
|
318
319
|
const tmp = [];
|
|
319
320
|
const tasks = [];
|
|
320
321
|
const registry = new Map();
|
|
322
|
+
const dedupe = new WeakMap();
|
|
321
323
|
const checkEnd = () => {
|
|
322
324
|
if (!registry.size && !completed) {
|
|
323
325
|
onCompleteAll && onCompleteAll(result);
|
|
@@ -356,11 +358,11 @@ function renderToStream(code, options = {}) {
|
|
|
356
358
|
scheduled = true;
|
|
357
359
|
}
|
|
358
360
|
if (error) return tasks.push(`_$HY.set("${id}", ${serializeError(p)})`);
|
|
359
|
-
if (!p || typeof p !== "object" || !("then" in p)) return tasks.push(
|
|
361
|
+
if (!p || typeof p !== "object" || !("then" in p)) return tasks.push(serializeSet(dedupe, id, p));
|
|
360
362
|
tasks.push(`_$HY.init("${id}")`);
|
|
361
363
|
p.then(d => {
|
|
362
|
-
!completed && buffer.write(`<script${nonce ? ` nonce="${nonce}"` : ""}
|
|
363
|
-
}).catch(
|
|
364
|
+
!completed && buffer.write(`<script${nonce ? ` nonce="${nonce}"` : ""}>${serializeSet(dedupe, id, d)}</script>`);
|
|
365
|
+
}).catch(() => {
|
|
364
366
|
!completed && buffer.write(`<script${nonce ? ` nonce="${nonce}"` : ""}>_$HY.set("${id}", {})</script>`);
|
|
365
367
|
});
|
|
366
368
|
},
|
|
@@ -574,7 +576,7 @@ function generateHydrationScript({
|
|
|
574
576
|
eventNames = ["click", "input"],
|
|
575
577
|
nonce
|
|
576
578
|
}) {
|
|
577
|
-
return `<script${nonce ? ` nonce="${nonce}"` : ""}>
|
|
579
|
+
return `<script${nonce ? ` nonce="${nonce}"` : ""}>var e,t;e=window._$HY||(_$HY={events:[],completed:new WeakSet,r:{}}),t=e=>e&&e.hasAttribute&&(e.hasAttribute("data-hk")?e:t(e.host&&e.host instanceof Node?e.host:e.parentNode)),["${eventNames.join('","')}"].forEach((o=>document.addEventListener(o,(o=>{let s=o.composedPath&&o.composedPath()[0]||o.target,a=t(s);a&&!e.completed.has(a)&&e.events.push([a,o])})))),e.init=(t,o)=>{e.r[t]=[new Promise(((e,t)=>o=e)),o]},e.set=(t,o,s)=>{(s=e.r[t])&&s[1](o),e.r[t]=[o]},e.unset=t=>{delete e.r[t]},e.load=(t,o)=>{if(o=e.r[t])return o[0]};</script><!xs>`;
|
|
578
580
|
}
|
|
579
581
|
function injectAssets(assets, html) {
|
|
580
582
|
for (let i = 0; i < assets.length; i++) {
|
|
@@ -602,6 +604,12 @@ function waitForFragments(registry, key) {
|
|
|
602
604
|
}
|
|
603
605
|
return false;
|
|
604
606
|
}
|
|
607
|
+
function serializeSet(registry, key, value) {
|
|
608
|
+
const exist = registry.get(value);
|
|
609
|
+
if (exist) return `_$HY.set("${key}", _$HY.r["${exist}"][0]);`;
|
|
610
|
+
registry.set(value, key);
|
|
611
|
+
return `_$HY.set("${key}", ${devalue(value)});`;
|
|
612
|
+
}
|
|
605
613
|
function pipeToNodeWritable(code, writable, options = {}) {
|
|
606
614
|
if (options.onReady) {
|
|
607
615
|
options.onCompleteShell = () => {
|
|
@@ -648,63 +656,43 @@ function Portal(props) {
|
|
|
648
656
|
|
|
649
657
|
Object.defineProperty(exports, 'ErrorBoundary', {
|
|
650
658
|
enumerable: true,
|
|
651
|
-
get: function () {
|
|
652
|
-
return solidJs.ErrorBoundary;
|
|
653
|
-
}
|
|
659
|
+
get: function () { return solidJs.ErrorBoundary; }
|
|
654
660
|
});
|
|
655
661
|
Object.defineProperty(exports, 'For', {
|
|
656
662
|
enumerable: true,
|
|
657
|
-
get: function () {
|
|
658
|
-
return solidJs.For;
|
|
659
|
-
}
|
|
663
|
+
get: function () { return solidJs.For; }
|
|
660
664
|
});
|
|
661
665
|
Object.defineProperty(exports, 'Index', {
|
|
662
666
|
enumerable: true,
|
|
663
|
-
get: function () {
|
|
664
|
-
return solidJs.Index;
|
|
665
|
-
}
|
|
667
|
+
get: function () { return solidJs.Index; }
|
|
666
668
|
});
|
|
667
669
|
Object.defineProperty(exports, 'Match', {
|
|
668
670
|
enumerable: true,
|
|
669
|
-
get: function () {
|
|
670
|
-
return solidJs.Match;
|
|
671
|
-
}
|
|
671
|
+
get: function () { return solidJs.Match; }
|
|
672
672
|
});
|
|
673
673
|
Object.defineProperty(exports, 'Show', {
|
|
674
674
|
enumerable: true,
|
|
675
|
-
get: function () {
|
|
676
|
-
return solidJs.Show;
|
|
677
|
-
}
|
|
675
|
+
get: function () { return solidJs.Show; }
|
|
678
676
|
});
|
|
679
677
|
Object.defineProperty(exports, 'Suspense', {
|
|
680
678
|
enumerable: true,
|
|
681
|
-
get: function () {
|
|
682
|
-
return solidJs.Suspense;
|
|
683
|
-
}
|
|
679
|
+
get: function () { return solidJs.Suspense; }
|
|
684
680
|
});
|
|
685
681
|
Object.defineProperty(exports, 'SuspenseList', {
|
|
686
682
|
enumerable: true,
|
|
687
|
-
get: function () {
|
|
688
|
-
return solidJs.SuspenseList;
|
|
689
|
-
}
|
|
683
|
+
get: function () { return solidJs.SuspenseList; }
|
|
690
684
|
});
|
|
691
685
|
Object.defineProperty(exports, 'Switch', {
|
|
692
686
|
enumerable: true,
|
|
693
|
-
get: function () {
|
|
694
|
-
return solidJs.Switch;
|
|
695
|
-
}
|
|
687
|
+
get: function () { return solidJs.Switch; }
|
|
696
688
|
});
|
|
697
689
|
Object.defineProperty(exports, 'createComponent', {
|
|
698
690
|
enumerable: true,
|
|
699
|
-
get: function () {
|
|
700
|
-
return solidJs.createComponent;
|
|
701
|
-
}
|
|
691
|
+
get: function () { return solidJs.createComponent; }
|
|
702
692
|
});
|
|
703
693
|
Object.defineProperty(exports, 'mergeProps', {
|
|
704
694
|
enumerable: true,
|
|
705
|
-
get: function () {
|
|
706
|
-
return solidJs.mergeProps;
|
|
707
|
-
}
|
|
695
|
+
get: function () { return solidJs.mergeProps; }
|
|
708
696
|
});
|
|
709
697
|
exports.Assets = Assets;
|
|
710
698
|
exports.Dynamic = Dynamic;
|
package/web/dist/server.js
CHANGED
|
@@ -255,6 +255,7 @@ function renderToStringAsync(code, options = {}) {
|
|
|
255
255
|
renderId,
|
|
256
256
|
timeoutMs = 30000
|
|
257
257
|
} = options;
|
|
258
|
+
const dedupe = new WeakMap();
|
|
258
259
|
const context = sharedConfig.context = {
|
|
259
260
|
id: renderId || "",
|
|
260
261
|
count: 0,
|
|
@@ -265,8 +266,8 @@ function renderToStringAsync(code, options = {}) {
|
|
|
265
266
|
nonce,
|
|
266
267
|
writeResource(id, p, error) {
|
|
267
268
|
if (error) return scripts += `_$HY.set("${id}", ${serializeError(p)});`;
|
|
268
|
-
if (!p || typeof p !== "object" || !("then" in p)) return scripts +=
|
|
269
|
-
p.then(d => scripts +=
|
|
269
|
+
if (!p || typeof p !== "object" || !("then" in p)) return scripts += serializeSet(dedupe, id, p);
|
|
270
|
+
p.then(d => scripts += serializeSet(dedupe, id, d)).catch(() => scripts += `_$HY.set("${id}", {});`);
|
|
270
271
|
}
|
|
271
272
|
};
|
|
272
273
|
const timeout = new Promise((_, reject) => setTimeout(() => reject("renderToString timed out"), timeoutMs));
|
|
@@ -315,6 +316,7 @@ function renderToStream(code, options = {}) {
|
|
|
315
316
|
const tmp = [];
|
|
316
317
|
const tasks = [];
|
|
317
318
|
const registry = new Map();
|
|
319
|
+
const dedupe = new WeakMap();
|
|
318
320
|
const checkEnd = () => {
|
|
319
321
|
if (!registry.size && !completed) {
|
|
320
322
|
onCompleteAll && onCompleteAll(result);
|
|
@@ -353,11 +355,11 @@ function renderToStream(code, options = {}) {
|
|
|
353
355
|
scheduled = true;
|
|
354
356
|
}
|
|
355
357
|
if (error) return tasks.push(`_$HY.set("${id}", ${serializeError(p)})`);
|
|
356
|
-
if (!p || typeof p !== "object" || !("then" in p)) return tasks.push(
|
|
358
|
+
if (!p || typeof p !== "object" || !("then" in p)) return tasks.push(serializeSet(dedupe, id, p));
|
|
357
359
|
tasks.push(`_$HY.init("${id}")`);
|
|
358
360
|
p.then(d => {
|
|
359
|
-
!completed && buffer.write(`<script${nonce ? ` nonce="${nonce}"` : ""}
|
|
360
|
-
}).catch(
|
|
361
|
+
!completed && buffer.write(`<script${nonce ? ` nonce="${nonce}"` : ""}>${serializeSet(dedupe, id, d)}</script>`);
|
|
362
|
+
}).catch(() => {
|
|
361
363
|
!completed && buffer.write(`<script${nonce ? ` nonce="${nonce}"` : ""}>_$HY.set("${id}", {})</script>`);
|
|
362
364
|
});
|
|
363
365
|
},
|
|
@@ -571,7 +573,7 @@ function generateHydrationScript({
|
|
|
571
573
|
eventNames = ["click", "input"],
|
|
572
574
|
nonce
|
|
573
575
|
}) {
|
|
574
|
-
return `<script${nonce ? ` nonce="${nonce}"` : ""}>
|
|
576
|
+
return `<script${nonce ? ` nonce="${nonce}"` : ""}>var e,t;e=window._$HY||(_$HY={events:[],completed:new WeakSet,r:{}}),t=e=>e&&e.hasAttribute&&(e.hasAttribute("data-hk")?e:t(e.host&&e.host instanceof Node?e.host:e.parentNode)),["${eventNames.join('","')}"].forEach((o=>document.addEventListener(o,(o=>{let s=o.composedPath&&o.composedPath()[0]||o.target,a=t(s);a&&!e.completed.has(a)&&e.events.push([a,o])})))),e.init=(t,o)=>{e.r[t]=[new Promise(((e,t)=>o=e)),o]},e.set=(t,o,s)=>{(s=e.r[t])&&s[1](o),e.r[t]=[o]},e.unset=t=>{delete e.r[t]},e.load=(t,o)=>{if(o=e.r[t])return o[0]};</script><!xs>`;
|
|
575
577
|
}
|
|
576
578
|
function injectAssets(assets, html) {
|
|
577
579
|
for (let i = 0; i < assets.length; i++) {
|
|
@@ -599,6 +601,12 @@ function waitForFragments(registry, key) {
|
|
|
599
601
|
}
|
|
600
602
|
return false;
|
|
601
603
|
}
|
|
604
|
+
function serializeSet(registry, key, value) {
|
|
605
|
+
const exist = registry.get(value);
|
|
606
|
+
if (exist) return `_$HY.set("${key}", _$HY.r["${exist}"][0]);`;
|
|
607
|
+
registry.set(value, key);
|
|
608
|
+
return `_$HY.set("${key}", ${devalue(value)});`;
|
|
609
|
+
}
|
|
602
610
|
function pipeToNodeWritable(code, writable, options = {}) {
|
|
603
611
|
if (options.onReady) {
|
|
604
612
|
options.onCompleteShell = () => {
|
package/web/dist/web.cjs
CHANGED
|
@@ -550,75 +550,51 @@ function Dynamic(props) {
|
|
|
550
550
|
|
|
551
551
|
Object.defineProperty(exports, 'ErrorBoundary', {
|
|
552
552
|
enumerable: true,
|
|
553
|
-
get: function () {
|
|
554
|
-
return solidJs.ErrorBoundary;
|
|
555
|
-
}
|
|
553
|
+
get: function () { return solidJs.ErrorBoundary; }
|
|
556
554
|
});
|
|
557
555
|
Object.defineProperty(exports, 'For', {
|
|
558
556
|
enumerable: true,
|
|
559
|
-
get: function () {
|
|
560
|
-
return solidJs.For;
|
|
561
|
-
}
|
|
557
|
+
get: function () { return solidJs.For; }
|
|
562
558
|
});
|
|
563
559
|
Object.defineProperty(exports, 'Index', {
|
|
564
560
|
enumerable: true,
|
|
565
|
-
get: function () {
|
|
566
|
-
return solidJs.Index;
|
|
567
|
-
}
|
|
561
|
+
get: function () { return solidJs.Index; }
|
|
568
562
|
});
|
|
569
563
|
Object.defineProperty(exports, 'Match', {
|
|
570
564
|
enumerable: true,
|
|
571
|
-
get: function () {
|
|
572
|
-
return solidJs.Match;
|
|
573
|
-
}
|
|
565
|
+
get: function () { return solidJs.Match; }
|
|
574
566
|
});
|
|
575
567
|
Object.defineProperty(exports, 'Show', {
|
|
576
568
|
enumerable: true,
|
|
577
|
-
get: function () {
|
|
578
|
-
return solidJs.Show;
|
|
579
|
-
}
|
|
569
|
+
get: function () { return solidJs.Show; }
|
|
580
570
|
});
|
|
581
571
|
Object.defineProperty(exports, 'Suspense', {
|
|
582
572
|
enumerable: true,
|
|
583
|
-
get: function () {
|
|
584
|
-
return solidJs.Suspense;
|
|
585
|
-
}
|
|
573
|
+
get: function () { return solidJs.Suspense; }
|
|
586
574
|
});
|
|
587
575
|
Object.defineProperty(exports, 'SuspenseList', {
|
|
588
576
|
enumerable: true,
|
|
589
|
-
get: function () {
|
|
590
|
-
return solidJs.SuspenseList;
|
|
591
|
-
}
|
|
577
|
+
get: function () { return solidJs.SuspenseList; }
|
|
592
578
|
});
|
|
593
579
|
Object.defineProperty(exports, 'Switch', {
|
|
594
580
|
enumerable: true,
|
|
595
|
-
get: function () {
|
|
596
|
-
return solidJs.Switch;
|
|
597
|
-
}
|
|
581
|
+
get: function () { return solidJs.Switch; }
|
|
598
582
|
});
|
|
599
583
|
Object.defineProperty(exports, 'createComponent', {
|
|
600
584
|
enumerable: true,
|
|
601
|
-
get: function () {
|
|
602
|
-
return solidJs.createComponent;
|
|
603
|
-
}
|
|
585
|
+
get: function () { return solidJs.createComponent; }
|
|
604
586
|
});
|
|
605
587
|
Object.defineProperty(exports, 'effect', {
|
|
606
588
|
enumerable: true,
|
|
607
|
-
get: function () {
|
|
608
|
-
return solidJs.createRenderEffect;
|
|
609
|
-
}
|
|
589
|
+
get: function () { return solidJs.createRenderEffect; }
|
|
610
590
|
});
|
|
611
591
|
Object.defineProperty(exports, 'getOwner', {
|
|
612
592
|
enumerable: true,
|
|
613
|
-
get: function () {
|
|
614
|
-
return solidJs.getOwner;
|
|
615
|
-
}
|
|
593
|
+
get: function () { return solidJs.getOwner; }
|
|
616
594
|
});
|
|
617
595
|
Object.defineProperty(exports, 'mergeProps', {
|
|
618
596
|
enumerable: true,
|
|
619
|
-
get: function () {
|
|
620
|
-
return solidJs.mergeProps;
|
|
621
|
-
}
|
|
597
|
+
get: function () { return solidJs.mergeProps; }
|
|
622
598
|
});
|
|
623
599
|
exports.Aliases = Aliases;
|
|
624
600
|
exports.Assets = Assets;
|