solid-js 1.3.0-rc.2 → 1.3.0-rc.3
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 +13 -2
- package/dist/dev.js +13 -3
- package/dist/server.cjs +2 -0
- package/dist/server.js +2 -1
- package/dist/solid.cjs +7 -1
- package/dist/solid.js +7 -2
- package/package.json +2 -2
- package/types/index.d.ts +1 -1
- package/types/reactive/signal.d.ts +2 -1
- package/types/server/index.d.ts +1 -1
- package/types/server/reactive.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/dist/dev.cjs
CHANGED
|
@@ -131,6 +131,7 @@ function nextHydrateContext() {
|
|
|
131
131
|
|
|
132
132
|
const equalFn = (a, b) => a === b;
|
|
133
133
|
const $PROXY = Symbol("solid-proxy");
|
|
134
|
+
const $DEVCOMP = Symbol('solid-dev-component');
|
|
134
135
|
const signalOptions = {
|
|
135
136
|
equals: equalFn
|
|
136
137
|
};
|
|
@@ -465,7 +466,7 @@ function runWithOwner(o, fn) {
|
|
|
465
466
|
const prev = Owner;
|
|
466
467
|
Owner = o;
|
|
467
468
|
try {
|
|
468
|
-
return fn
|
|
469
|
+
return runUpdates(fn, true);
|
|
469
470
|
} finally {
|
|
470
471
|
Owner = prev;
|
|
471
472
|
}
|
|
@@ -478,7 +479,11 @@ function startTransition(fn) {
|
|
|
478
479
|
fn();
|
|
479
480
|
return Transition.done;
|
|
480
481
|
}
|
|
482
|
+
const l = Listener;
|
|
483
|
+
const o = Owner;
|
|
481
484
|
return Promise.resolve().then(() => {
|
|
485
|
+
Listener = l;
|
|
486
|
+
Owner = o;
|
|
482
487
|
let t;
|
|
483
488
|
if (Scheduler || SuspenseContext) {
|
|
484
489
|
t = Transition || (Transition = {
|
|
@@ -504,7 +509,12 @@ function resumeEffects(e) {
|
|
|
504
509
|
e.length = 0;
|
|
505
510
|
}
|
|
506
511
|
function devComponent(Comp, props) {
|
|
507
|
-
const c = createComputation(() => untrack(() =>
|
|
512
|
+
const c = createComputation(() => untrack(() => {
|
|
513
|
+
Object.assign(Comp, {
|
|
514
|
+
[$DEVCOMP]: true
|
|
515
|
+
});
|
|
516
|
+
return Comp(props);
|
|
517
|
+
}), undefined, true);
|
|
508
518
|
c.pending = NOTPENDING;
|
|
509
519
|
c.observers = null;
|
|
510
520
|
c.observerSlots = null;
|
|
@@ -1559,6 +1569,7 @@ if (globalThis) {
|
|
|
1559
1569
|
if (!globalThis.Solid$$) globalThis.Solid$$ = true;else console.warn("You appear to have multiple instances of Solid. This can lead to unexpected behavior.");
|
|
1560
1570
|
}
|
|
1561
1571
|
|
|
1572
|
+
exports.$DEVCOMP = $DEVCOMP;
|
|
1562
1573
|
exports.$PROXY = $PROXY;
|
|
1563
1574
|
exports.ErrorBoundary = ErrorBoundary;
|
|
1564
1575
|
exports.For = For;
|
package/dist/dev.js
CHANGED
|
@@ -127,6 +127,7 @@ function nextHydrateContext() {
|
|
|
127
127
|
|
|
128
128
|
const equalFn = (a, b) => a === b;
|
|
129
129
|
const $PROXY = Symbol("solid-proxy");
|
|
130
|
+
const $DEVCOMP = Symbol('solid-dev-component');
|
|
130
131
|
const signalOptions = {
|
|
131
132
|
equals: equalFn
|
|
132
133
|
};
|
|
@@ -461,7 +462,7 @@ function runWithOwner(o, fn) {
|
|
|
461
462
|
const prev = Owner;
|
|
462
463
|
Owner = o;
|
|
463
464
|
try {
|
|
464
|
-
return fn
|
|
465
|
+
return runUpdates(fn, true);
|
|
465
466
|
} finally {
|
|
466
467
|
Owner = prev;
|
|
467
468
|
}
|
|
@@ -474,7 +475,11 @@ function startTransition(fn) {
|
|
|
474
475
|
fn();
|
|
475
476
|
return Transition.done;
|
|
476
477
|
}
|
|
478
|
+
const l = Listener;
|
|
479
|
+
const o = Owner;
|
|
477
480
|
return Promise.resolve().then(() => {
|
|
481
|
+
Listener = l;
|
|
482
|
+
Owner = o;
|
|
478
483
|
let t;
|
|
479
484
|
if (Scheduler || SuspenseContext) {
|
|
480
485
|
t = Transition || (Transition = {
|
|
@@ -500,7 +505,12 @@ function resumeEffects(e) {
|
|
|
500
505
|
e.length = 0;
|
|
501
506
|
}
|
|
502
507
|
function devComponent(Comp, props) {
|
|
503
|
-
const c = createComputation(() => untrack(() =>
|
|
508
|
+
const c = createComputation(() => untrack(() => {
|
|
509
|
+
Object.assign(Comp, {
|
|
510
|
+
[$DEVCOMP]: true
|
|
511
|
+
});
|
|
512
|
+
return Comp(props);
|
|
513
|
+
}), undefined, true);
|
|
504
514
|
c.pending = NOTPENDING;
|
|
505
515
|
c.observers = null;
|
|
506
516
|
c.observerSlots = null;
|
|
@@ -1555,4 +1565,4 @@ if (globalThis) {
|
|
|
1555
1565
|
if (!globalThis.Solid$$) globalThis.Solid$$ = true;else console.warn("You appear to have multiple instances of Solid. This can lead to unexpected behavior.");
|
|
1556
1566
|
}
|
|
1557
1567
|
|
|
1558
|
-
export { $PROXY, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, batch, cancelCallback, children, createComponent, createComputed, createContext, createDeferred, createEffect, createMemo, createRenderEffect, createResource, createRoot, createSelector, createSignal, createUniqueId, enableExternalSource, enableHydration, enableScheduling, equalFn, from, getListener, getOwner, indexArray, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, refetchResources, requestCallback, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };
|
|
1568
|
+
export { $DEVCOMP, $PROXY, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, batch, cancelCallback, children, createComponent, createComputed, createContext, createDeferred, createEffect, createMemo, createRenderEffect, createResource, createRoot, createSelector, createSignal, createUniqueId, enableExternalSource, enableHydration, enableScheduling, equalFn, from, getListener, getOwner, indexArray, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, refetchResources, requestCallback, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };
|
package/dist/server.cjs
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const equalFn = (a, b) => a === b;
|
|
6
6
|
const $PROXY = Symbol("solid-proxy");
|
|
7
|
+
const $DEVCOMP = Symbol('solid-dev-component');
|
|
7
8
|
const DEV = {};
|
|
8
9
|
const ERROR = Symbol("error");
|
|
9
10
|
const UNOWNED = {
|
|
@@ -509,6 +510,7 @@ function Suspense(props) {
|
|
|
509
510
|
return props.fallback;
|
|
510
511
|
}
|
|
511
512
|
|
|
513
|
+
exports.$DEVCOMP = $DEVCOMP;
|
|
512
514
|
exports.$PROXY = $PROXY;
|
|
513
515
|
exports.DEV = DEV;
|
|
514
516
|
exports.ErrorBoundary = ErrorBoundary;
|
package/dist/server.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const equalFn = (a, b) => a === b;
|
|
2
2
|
const $PROXY = Symbol("solid-proxy");
|
|
3
|
+
const $DEVCOMP = Symbol('solid-dev-component');
|
|
3
4
|
const DEV = {};
|
|
4
5
|
const ERROR = Symbol("error");
|
|
5
6
|
const UNOWNED = {
|
|
@@ -505,4 +506,4 @@ function Suspense(props) {
|
|
|
505
506
|
return props.fallback;
|
|
506
507
|
}
|
|
507
508
|
|
|
508
|
-
export { $PROXY, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, batch, children, createComponent, createComputed, createContext, createDeferred, createEffect, createMemo, createRenderEffect, createResource, createRoot, createSelector, createSignal, createUniqueId, enableExternalSource, enableHydration, enableScheduling, equalFn, from, getListener, getOwner, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, requestCallback, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };
|
|
509
|
+
export { $DEVCOMP, $PROXY, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, batch, children, createComponent, createComputed, createContext, createDeferred, createEffect, createMemo, createRenderEffect, createResource, createRoot, createSelector, createSignal, createUniqueId, enableExternalSource, enableHydration, enableScheduling, equalFn, from, getListener, getOwner, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, requestCallback, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };
|
package/dist/solid.cjs
CHANGED
|
@@ -131,6 +131,7 @@ function nextHydrateContext() {
|
|
|
131
131
|
|
|
132
132
|
const equalFn = (a, b) => a === b;
|
|
133
133
|
const $PROXY = Symbol("solid-proxy");
|
|
134
|
+
const $DEVCOMP = Symbol('solid-dev-component');
|
|
134
135
|
const signalOptions = {
|
|
135
136
|
equals: equalFn
|
|
136
137
|
};
|
|
@@ -462,7 +463,7 @@ function runWithOwner(o, fn) {
|
|
|
462
463
|
const prev = Owner;
|
|
463
464
|
Owner = o;
|
|
464
465
|
try {
|
|
465
|
-
return fn
|
|
466
|
+
return runUpdates(fn, true);
|
|
466
467
|
} finally {
|
|
467
468
|
Owner = prev;
|
|
468
469
|
}
|
|
@@ -475,7 +476,11 @@ function startTransition(fn) {
|
|
|
475
476
|
fn();
|
|
476
477
|
return Transition.done;
|
|
477
478
|
}
|
|
479
|
+
const l = Listener;
|
|
480
|
+
const o = Owner;
|
|
478
481
|
return Promise.resolve().then(() => {
|
|
482
|
+
Listener = l;
|
|
483
|
+
Owner = o;
|
|
479
484
|
let t;
|
|
480
485
|
if (Scheduler || SuspenseContext) {
|
|
481
486
|
t = Transition || (Transition = {
|
|
@@ -1472,6 +1477,7 @@ function Suspense(props) {
|
|
|
1472
1477
|
|
|
1473
1478
|
let DEV;
|
|
1474
1479
|
|
|
1480
|
+
exports.$DEVCOMP = $DEVCOMP;
|
|
1475
1481
|
exports.$PROXY = $PROXY;
|
|
1476
1482
|
exports.DEV = DEV;
|
|
1477
1483
|
exports.ErrorBoundary = ErrorBoundary;
|
package/dist/solid.js
CHANGED
|
@@ -127,6 +127,7 @@ function nextHydrateContext() {
|
|
|
127
127
|
|
|
128
128
|
const equalFn = (a, b) => a === b;
|
|
129
129
|
const $PROXY = Symbol("solid-proxy");
|
|
130
|
+
const $DEVCOMP = Symbol('solid-dev-component');
|
|
130
131
|
const signalOptions = {
|
|
131
132
|
equals: equalFn
|
|
132
133
|
};
|
|
@@ -458,7 +459,7 @@ function runWithOwner(o, fn) {
|
|
|
458
459
|
const prev = Owner;
|
|
459
460
|
Owner = o;
|
|
460
461
|
try {
|
|
461
|
-
return fn
|
|
462
|
+
return runUpdates(fn, true);
|
|
462
463
|
} finally {
|
|
463
464
|
Owner = prev;
|
|
464
465
|
}
|
|
@@ -471,7 +472,11 @@ function startTransition(fn) {
|
|
|
471
472
|
fn();
|
|
472
473
|
return Transition.done;
|
|
473
474
|
}
|
|
475
|
+
const l = Listener;
|
|
476
|
+
const o = Owner;
|
|
474
477
|
return Promise.resolve().then(() => {
|
|
478
|
+
Listener = l;
|
|
479
|
+
Owner = o;
|
|
475
480
|
let t;
|
|
476
481
|
if (Scheduler || SuspenseContext) {
|
|
477
482
|
t = Transition || (Transition = {
|
|
@@ -1468,4 +1473,4 @@ function Suspense(props) {
|
|
|
1468
1473
|
|
|
1469
1474
|
let DEV;
|
|
1470
1475
|
|
|
1471
|
-
export { $PROXY, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, batch, cancelCallback, children, createComponent, createComputed, createContext, createDeferred, createEffect, createMemo, createRenderEffect, createResource, createRoot, createSelector, createSignal, createUniqueId, enableExternalSource, enableHydration, enableScheduling, equalFn, from, getListener, getOwner, indexArray, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, refetchResources, requestCallback, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };
|
|
1476
|
+
export { $DEVCOMP, $PROXY, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, batch, cancelCallback, children, createComponent, createComputed, createContext, createDeferred, createEffect, createMemo, createRenderEffect, createResource, createRoot, createSelector, createSignal, createUniqueId, enableExternalSource, enableHydration, enableScheduling, equalFn, from, getListener, getOwner, indexArray, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, refetchResources, requestCallback, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "solid-js",
|
|
3
3
|
"description": "A declarative JavaScript library for building user interfaces.",
|
|
4
|
-
"version": "1.3.0-rc.
|
|
4
|
+
"version": "1.3.0-rc.3",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://solidjs.com",
|
|
@@ -144,5 +144,5 @@
|
|
|
144
144
|
"compiler",
|
|
145
145
|
"performance"
|
|
146
146
|
],
|
|
147
|
-
"gitHead": "
|
|
147
|
+
"gitHead": "24a44a798dc517a578ac4881af594990a1faadc8"
|
|
148
148
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { createRoot, createSignal, createEffect, createRenderEffect, createComputed, createDeferred, createSelector, createMemo, createResource, onMount, onCleanup, onError, untrack, batch, on, enableScheduling, enableExternalSource, startTransition, useTransition, refetchResources, createContext, useContext, children, getListener, getOwner, runWithOwner, equalFn, $PROXY } from "./reactive/signal";
|
|
1
|
+
export { createRoot, createSignal, createEffect, createRenderEffect, createComputed, createDeferred, createSelector, createMemo, createResource, onMount, onCleanup, onError, untrack, batch, on, enableScheduling, enableExternalSource, startTransition, useTransition, refetchResources, createContext, useContext, children, getListener, getOwner, runWithOwner, equalFn, $DEVCOMP, $PROXY } from "./reactive/signal";
|
|
2
2
|
export type { Accessor, Setter, Resource, ResourceReturn, ResourceFetcher, ResourceFetcherInfo, Context, ReturnTypes } from "./reactive/signal";
|
|
3
3
|
export * from "./reactive/observable";
|
|
4
4
|
export * from "./reactive/scheduler";
|
|
@@ -2,6 +2,7 @@ import { requestCallback } from "./scheduler";
|
|
|
2
2
|
import type { JSX } from "../jsx";
|
|
3
3
|
export declare const equalFn: <T>(a: T, b: T) => boolean;
|
|
4
4
|
export declare const $PROXY: unique symbol;
|
|
5
|
+
export declare const $DEVCOMP: unique symbol;
|
|
5
6
|
export declare const NOTPENDING: {};
|
|
6
7
|
export declare var Owner: Owner | null;
|
|
7
8
|
export declare let Transition: TransitionState | null;
|
|
@@ -356,7 +357,7 @@ export declare function onCleanup(fn: () => void): () => void;
|
|
|
356
357
|
export declare function onError(fn: (err: any) => void): void;
|
|
357
358
|
export declare function getListener(): Computation<any, any> | null;
|
|
358
359
|
export declare function getOwner(): Owner | null;
|
|
359
|
-
export declare function runWithOwner(o: Owner, fn: () => any):
|
|
360
|
+
export declare function runWithOwner(o: Owner, fn: () => any): void;
|
|
360
361
|
export declare function enableScheduling(scheduler?: typeof requestCallback): void;
|
|
361
362
|
/**
|
|
362
363
|
* ```typescript
|
package/types/server/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { createRoot, createSignal, createComputed, createRenderEffect, createEffect, createDeferred, createSelector, createMemo, getListener, onMount, onCleanup, onError, untrack, batch, on, children, createContext, useContext, getOwner, runWithOwner, equalFn, requestCallback, mapArray, observable, from, $PROXY, DEV, enableExternalSource } from "./reactive";
|
|
1
|
+
export { createRoot, createSignal, createComputed, createRenderEffect, createEffect, createDeferred, createSelector, createMemo, getListener, onMount, onCleanup, onError, untrack, batch, on, children, createContext, useContext, getOwner, runWithOwner, equalFn, requestCallback, mapArray, observable, from, $PROXY, $DEVCOMP, DEV, enableExternalSource } from "./reactive";
|
|
2
2
|
export { mergeProps, splitProps, createComponent, For, Index, Show, Switch, Match, ErrorBoundary, Suspense, SuspenseList, createResource, enableScheduling, enableHydration, startTransition, useTransition, createUniqueId, lazy, sharedConfig } from "./rendering";
|
|
3
3
|
export type { Component, Resource } from "./rendering";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Accessor, Setter } from "../reactive/signal";
|
|
2
2
|
export declare const equalFn: <T>(a: T, b: T) => boolean;
|
|
3
3
|
export declare const $PROXY: unique symbol;
|
|
4
|
+
export declare const $DEVCOMP: unique symbol;
|
|
4
5
|
export declare const DEV: {};
|
|
5
6
|
export declare let Owner: Owner | null;
|
|
6
7
|
interface Owner {
|
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;
|