@solidjs/signals 2.0.0-rc.13 → 2.0.0-rc.15
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-shared.js +2059 -3768
- package/dist/dev.attribution.js +237 -101
- package/dist/dev.js +7466 -8497
- package/dist/observe/affects.js +128 -104
- package/dist/observe/boundaries.js +492 -665
- package/dist/observe/core/action.js +63 -66
- package/dist/observe/core/async.js +243 -379
- package/dist/observe/core/attribution-queries.js +1 -1
- package/dist/observe/core/attribution.js +394 -253
- package/dist/observe/core/constants.js +120 -187
- package/dist/observe/core/context.js +3 -3
- package/dist/observe/core/core.js +874 -1440
- package/dist/observe/core/dev.js +3 -3
- package/dist/observe/core/effect.js +73 -84
- package/dist/observe/core/external.js +5 -5
- package/dist/observe/core/graph.js +62 -71
- package/dist/observe/core/heap.js +75 -98
- package/dist/observe/core/invariants.js +1 -34
- package/dist/observe/core/lanes.js +750 -181
- package/dist/observe/core/owner.js +80 -101
- package/dist/observe/core/scheduler.js +719 -1356
- package/dist/observe/core/verdict.js +314 -621
- package/dist/observe/flatten.js +79 -0
- package/dist/observe/index.js +15 -13
- package/dist/observe/map.js +232 -235
- package/dist/observe/reveal.js +212 -0
- package/dist/observe/signals.js +144 -216
- package/dist/observe/store/affects.js +142 -0
- package/dist/observe/store/hooks.js +13 -0
- package/dist/observe/store/index.js +27 -24
- package/dist/observe/store/optimistic.js +571 -0
- package/dist/observe/store/projection.js +308 -0
- package/dist/observe/store/reconcile.js +259 -0
- package/dist/observe/store/store.js +1988 -277
- package/dist/observe/store/storePath.js +1 -1
- package/dist/{prod/store/next → observe/store}/target.js +17 -18
- package/dist/observe/store/types.js +73 -0
- package/dist/observe/store/utils.js +1 -13
- package/dist/prod/affects.js +130 -106
- package/dist/prod/boundaries.js +476 -654
- package/dist/prod/core/action.js +71 -74
- package/dist/prod/core/async.js +306 -444
- package/dist/prod/core/constants.js +117 -186
- package/dist/prod/core/context.js +3 -3
- package/dist/prod/core/core.js +888 -1462
- package/dist/prod/core/effect.js +88 -99
- package/dist/prod/core/external.js +5 -5
- package/dist/prod/core/graph.js +62 -71
- package/dist/prod/core/heap.js +75 -98
- package/dist/prod/core/invariants.js +1 -32
- package/dist/prod/core/lanes.js +712 -181
- package/dist/prod/core/owner.js +75 -96
- package/dist/prod/core/scheduler.js +686 -1335
- package/dist/prod/core/verdict.js +309 -621
- package/dist/prod/flatten.js +77 -0
- package/dist/prod/index.js +15 -13
- package/dist/prod/map.js +142 -145
- package/dist/prod/reveal.js +212 -0
- package/dist/prod/signals.js +155 -227
- package/dist/prod/store/affects.js +142 -0
- package/dist/prod/store/hooks.js +13 -0
- package/dist/prod/store/index.js +26 -19
- package/dist/prod/store/optimistic.js +566 -0
- package/dist/prod/store/projection.js +301 -0
- package/dist/prod/store/reconcile.js +259 -0
- package/dist/prod/store/store.js +1883 -272
- package/dist/prod/store/storePath.js +1 -1
- package/dist/{observe/store/next → prod/store}/target.js +13 -17
- package/dist/prod/store/types.js +73 -0
- package/dist/prod/store/utils.js +1 -11
- package/dist/types/affects.d.ts +11 -30
- package/dist/types/boundaries.d.ts +66 -176
- package/dist/types/carved.d.ts +1 -0
- package/dist/types/core/action.d.ts +5 -6
- package/dist/types/core/async.d.ts +10 -5
- package/dist/types/core/attribution-hooks.d.ts +20 -1
- package/dist/types/core/attribution.d.ts +26 -11
- package/dist/types/core/constants.d.ts +130 -180
- package/dist/types/core/core.d.ts +134 -264
- package/dist/types/core/dev.d.ts +2 -2
- package/dist/types/core/effect.d.ts +0 -7
- package/dist/types/core/graph.d.ts +7 -1
- package/dist/types/core/heap.d.ts +5 -7
- package/dist/types/core/index.d.ts +5 -5
- package/dist/types/core/invariants.d.ts +0 -29
- package/dist/types/core/lanes.d.ts +74 -86
- package/dist/types/core/owner.d.ts +3 -3
- package/dist/types/core/scheduler.d.ts +255 -331
- package/dist/types/core/types.d.ts +45 -85
- package/dist/types/core/verdict.d.ts +3 -0
- package/dist/types/flatten.d.ts +8 -0
- package/dist/types/index.d.ts +6 -4
- package/dist/types/reveal.d.ts +19 -0
- package/dist/types/signals.d.ts +35 -91
- package/dist/types/store/affects.d.ts +12 -0
- package/dist/types/store/hooks.d.ts +48 -0
- package/dist/types/store/index.d.ts +34 -15
- package/dist/types/store/optimistic.d.ts +23 -0
- package/dist/types/store/projection.d.ts +18 -0
- package/dist/types/store/reconcile.d.ts +3 -0
- package/dist/types/store/store.d.ts +132 -145
- package/dist/types/store/storePath.d.ts +1 -1
- package/dist/types/store/target.d.ts +151 -0
- package/dist/types/store/types.d.ts +84 -0
- package/package.json +1 -1
- package/dist/observe/core/optimistic.js +0 -669
- package/dist/observe/store/next/optimistic.js +0 -717
- package/dist/observe/store/next/projection.js +0 -266
- package/dist/observe/store/next/reconcile.js +0 -375
- package/dist/observe/store/next/store.js +0 -2608
- package/dist/prod/core/optimistic.js +0 -658
- package/dist/prod/store/next/optimistic.js +0 -710
- package/dist/prod/store/next/projection.js +0 -257
- package/dist/prod/store/next/reconcile.js +0 -373
- package/dist/prod/store/next/store.js +0 -2484
- package/dist/types/core/optimistic.d.ts +0 -6
- package/dist/types/store/next/optimistic.d.ts +0 -25
- package/dist/types/store/next/projection.d.ts +0 -27
- package/dist/types/store/next/reconcile.d.ts +0 -10
- package/dist/types/store/next/store.d.ts +0 -145
- package/dist/types/store/next/target.d.ts +0 -196
|
@@ -1,49 +1,44 @@
|
|
|
1
1
|
import "./core.js";
|
|
2
2
|
|
|
3
|
-
import { REACTIVE_IN_HEAP,
|
|
3
|
+
import { REACTIVE_IN_HEAP, REACTIVE_RECOMPUTING_DEPS, REACTIVE_CHECK, REACTIVE_DIRTY, REACTIVE_IN_HEAP_HEIGHT } from "./constants.js";
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
/** The queue a node belongs to, picked from its own zombie flag. */ function queueFor(e) {
|
|
8
|
-
return e.oe & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
9
|
-
}
|
|
5
|
+
import { dirtyQueue } from "./scheduler.js";
|
|
10
6
|
|
|
11
7
|
/**
|
|
12
|
-
* Schedule one subscriber to re-run on the next flush: inserted into
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
8
|
+
* Schedule one subscriber to re-run on the next flush: inserted into the
|
|
9
|
+
* dirty heap with the `_min` cursor pulled down. Tracked effects ride the
|
|
10
|
+
* heap too — the heap visit is their (empty) compute phase, which hands the
|
|
11
|
+
* callback to the user queue once the pass has committed (see
|
|
12
|
+
* GlobalQueue._update, #3291).
|
|
17
13
|
*/ function enqueueSub(e) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
insertIntoHeap(e, E);
|
|
14
|
+
if (dirtyQueue.ut > e.it) dirtyQueue.ut = e.it;
|
|
15
|
+
insertIntoHeap(e, dirtyQueue);
|
|
21
16
|
}
|
|
22
17
|
|
|
23
|
-
function actualInsertIntoHeap(e,
|
|
24
|
-
const
|
|
25
|
-
if (
|
|
26
|
-
const n = e.
|
|
27
|
-
const I =
|
|
28
|
-
if (I === undefined)
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
e.
|
|
32
|
-
I.
|
|
18
|
+
function actualInsertIntoHeap(e, t) {
|
|
19
|
+
const E = (e._parent?.Ht ? e._parent.gt?.it : e._parent?.it) ?? -1;
|
|
20
|
+
if (E >= e.it) e.it = E + 1;
|
|
21
|
+
const n = e.it;
|
|
22
|
+
const I = t.jt[n];
|
|
23
|
+
if (I === undefined) t.jt[n] = e; else {
|
|
24
|
+
const t = I.Rt;
|
|
25
|
+
t.Ot = e;
|
|
26
|
+
e.Rt = t;
|
|
27
|
+
I.Rt = e;
|
|
33
28
|
}
|
|
34
|
-
if (n >
|
|
29
|
+
if (n > t.Kt) t.Kt = n;
|
|
35
30
|
}
|
|
36
31
|
|
|
37
|
-
function insertIntoHeap(e,
|
|
38
|
-
let
|
|
32
|
+
function insertIntoHeap(e, t) {
|
|
33
|
+
let E = e.R;
|
|
39
34
|
// RECOMPUTING refusals are not always losses: a genuinely missed wake (a
|
|
40
35
|
// write to a link this pass already validated) is latched link-side in
|
|
41
36
|
// insertSubs as REACTIVE_MISSED_WAKE for recompute's tail (#3037).
|
|
42
|
-
if (
|
|
43
|
-
if (
|
|
44
|
-
e.
|
|
37
|
+
if (E & (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS)) return;
|
|
38
|
+
if (E & REACTIVE_CHECK) {
|
|
39
|
+
e.R = E & -4 | REACTIVE_DIRTY | REACTIVE_IN_HEAP;
|
|
45
40
|
} else {
|
|
46
|
-
e.
|
|
41
|
+
e.R = E | REACTIVE_IN_HEAP;
|
|
47
42
|
// An unmarked node entering an already-marked heap is marked on the
|
|
48
43
|
// spot, keeping the markHeap memo valid. `_marked` is only reset by
|
|
49
44
|
// runHeap, so a write between two mid-tick pulls (read-time markHeap +
|
|
@@ -54,94 +49,76 @@ function insertIntoHeap(e, E) {
|
|
|
54
49
|
// parked in the heap for a synchronous mount (each row writing a ref
|
|
55
50
|
// signal its effect subscribes to), mounting N rows was O(N²) (#3350).
|
|
56
51
|
// markNode's own guard skips an already-DIRTY node.
|
|
57
|
-
if (
|
|
52
|
+
if (t.N) markNode(e);
|
|
58
53
|
}
|
|
59
|
-
if (!(
|
|
54
|
+
if (!(E & REACTIVE_IN_HEAP_HEIGHT)) actualInsertIntoHeap(e, t);
|
|
60
55
|
}
|
|
61
56
|
|
|
62
|
-
function insertIntoHeapHeight(e,
|
|
63
|
-
let
|
|
64
|
-
if (
|
|
65
|
-
e.
|
|
66
|
-
actualInsertIntoHeap(e,
|
|
57
|
+
function insertIntoHeapHeight(e, t) {
|
|
58
|
+
let E = e.R;
|
|
59
|
+
if (E & (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS | REACTIVE_IN_HEAP_HEIGHT)) return;
|
|
60
|
+
e.R = E | REACTIVE_IN_HEAP_HEIGHT;
|
|
61
|
+
actualInsertIntoHeap(e, t);
|
|
67
62
|
}
|
|
68
63
|
|
|
69
|
-
function deleteFromHeap(e,
|
|
70
|
-
const
|
|
71
|
-
if (!(
|
|
72
|
-
e.
|
|
73
|
-
const n = e.
|
|
74
|
-
if (e.
|
|
75
|
-
const
|
|
76
|
-
const I =
|
|
77
|
-
const
|
|
78
|
-
if (e === I)
|
|
79
|
-
|
|
64
|
+
function deleteFromHeap(e, t) {
|
|
65
|
+
const E = e.R;
|
|
66
|
+
if (!(E & (REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT))) return;
|
|
67
|
+
e.R = E & -25;
|
|
68
|
+
const n = e.it;
|
|
69
|
+
if (e.Rt === e) t.jt[n] = undefined; else {
|
|
70
|
+
const E = e.Ot;
|
|
71
|
+
const I = t.jt[n];
|
|
72
|
+
const i = E ?? I;
|
|
73
|
+
if (e === I) t.jt[n] = E; else e.Rt.Ot = E;
|
|
74
|
+
i.Rt = e.Rt;
|
|
80
75
|
}
|
|
81
|
-
e.
|
|
82
|
-
e.
|
|
76
|
+
e.Rt = e;
|
|
77
|
+
e.Ot = undefined;
|
|
83
78
|
}
|
|
84
79
|
|
|
85
80
|
function markHeap(e) {
|
|
86
|
-
if (e.
|
|
87
|
-
e.
|
|
88
|
-
for (let
|
|
89
|
-
for (let
|
|
90
|
-
if (
|
|
81
|
+
if (e.N) return;
|
|
82
|
+
e.N = true;
|
|
83
|
+
for (let t = 0; t <= e.Kt; t++) {
|
|
84
|
+
for (let E = e.jt[t]; E !== undefined; E = E.Ot) {
|
|
85
|
+
if (E.R & REACTIVE_IN_HEAP) markNode(E);
|
|
91
86
|
}
|
|
92
87
|
}
|
|
93
88
|
}
|
|
94
89
|
|
|
95
|
-
function markNode(e,
|
|
96
|
-
const
|
|
97
|
-
if ((
|
|
98
|
-
e.
|
|
99
|
-
for (let
|
|
100
|
-
markNode(
|
|
101
|
-
}
|
|
102
|
-
// Firewall children (projection machinery only): gate the cold-extension
|
|
103
|
-
// deref on the config bit — markNode runs per sub edge per write, and an
|
|
104
|
-
// unconditional _x chase here taxed every propagation (diamond -22%).
|
|
105
|
-
if (e.C & CONFIG_FW_CHILDREN) {
|
|
106
|
-
for (let E = e.o.i; E !== null; E = E.ge) {
|
|
107
|
-
for (let e = E.u; e !== null; e = e.Pe) {
|
|
108
|
-
markNode(e.Ae, REACTIVE_CHECK);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
90
|
+
function markNode(e, t = REACTIVE_DIRTY) {
|
|
91
|
+
const E = e.R;
|
|
92
|
+
if ((E & (REACTIVE_CHECK | REACTIVE_DIRTY)) >= t) return;
|
|
93
|
+
e.R = E & -4 | t;
|
|
94
|
+
for (let t = e.t; t !== null; t = t.o) {
|
|
95
|
+
markNode(t.l, REACTIVE_CHECK);
|
|
111
96
|
}
|
|
112
97
|
}
|
|
113
98
|
|
|
114
|
-
function runHeap(e,
|
|
115
|
-
e.
|
|
116
|
-
for (e.
|
|
117
|
-
let
|
|
118
|
-
while (
|
|
119
|
-
if (
|
|
120
|
-
|
|
99
|
+
function runHeap(e, t) {
|
|
100
|
+
e.N = false;
|
|
101
|
+
for (e.ut = 0; e.ut <= e.Kt; e.ut++) {
|
|
102
|
+
let E = e.jt[e.ut];
|
|
103
|
+
while (E !== undefined) {
|
|
104
|
+
if (E.R & REACTIVE_IN_HEAP) t(E); else adjustHeight(E, e);
|
|
105
|
+
E = e.jt[e.ut];
|
|
121
106
|
}
|
|
122
107
|
}
|
|
123
|
-
e.
|
|
108
|
+
e.Kt = 0;
|
|
124
109
|
}
|
|
125
110
|
|
|
126
|
-
function adjustHeight(e,
|
|
127
|
-
deleteFromHeap(e,
|
|
128
|
-
let
|
|
129
|
-
for (let
|
|
130
|
-
const e =
|
|
131
|
-
|
|
132
|
-
if (n.Se && n.ft >= t) t = n.ft + 1;
|
|
111
|
+
function adjustHeight(e, t) {
|
|
112
|
+
deleteFromHeap(e, t);
|
|
113
|
+
let E = e.it;
|
|
114
|
+
for (let t = e.G; t; t = t._) {
|
|
115
|
+
const e = t.I;
|
|
116
|
+
if (e.ee && e.it >= E) E = e.it + 1;
|
|
133
117
|
}
|
|
134
|
-
if (e.
|
|
135
|
-
e.
|
|
136
|
-
for (let E = e.
|
|
137
|
-
// Route each subscriber by its own zombie flag, mirroring the
|
|
138
|
-
// post-recompute height-adjust path. Inserting into the running `heap`
|
|
139
|
-
// unconditionally can park a zombie in `dirtyQueue` (or a live node in
|
|
140
|
-
// `zombieQueue`), breaking the flag/queue invariant `deleteFromHeap`
|
|
141
|
-
// relies on — the same corruption class as #2759.
|
|
142
|
-
insertIntoHeapHeight(E.Ae, queueFor(E.Ae));
|
|
143
|
-
}
|
|
118
|
+
if (e.it !== E) {
|
|
119
|
+
e.it = E;
|
|
120
|
+
for (let E = e.t; E !== null; E = E.o) insertIntoHeapHeight(E.l, t);
|
|
144
121
|
}
|
|
145
122
|
}
|
|
146
123
|
|
|
147
|
-
export { deleteFromHeap, enqueueSub, insertIntoHeap, insertIntoHeapHeight, markHeap, markNode,
|
|
124
|
+
export { deleteFromHeap, enqueueSub, insertIntoHeap, insertIntoHeapHeight, markHeap, markNode, runHeap };
|
|
@@ -1,38 +1,5 @@
|
|
|
1
|
-
import "./core.js";
|
|
2
|
-
|
|
3
1
|
import "./dev.js";
|
|
4
2
|
|
|
5
|
-
/**
|
|
6
|
-
* INV-2: a node with an *active* override must be registered for reversion in
|
|
7
|
-
* the queue's or a transition's `_optimisticNodes`. An unregistered active
|
|
8
|
-
* override would survive transition completion forever. Runs at the end of
|
|
9
|
-
* every flush (not just quiescence — the invariant holds mid-transition).
|
|
10
|
-
* (There is no revert-target requirement: authoritative values commit
|
|
11
|
-
* silently into `_value` under the override mask — A17 — so reverting is
|
|
12
|
-
* just dropping the override.)
|
|
13
|
-
*/ function devCheckActiveOverrides(e) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/** INV-1: an isPending() probe must never leak past its own call. */ function devCheckFlushStart() {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Companion-vs-oracle census (#2838 pre-work). A NON-ASSERTING diff logger:
|
|
23
|
-
* at the end of every flush it compares each live companion's cached state
|
|
24
|
-
* against a fresh oracle and logs every distinct divergence fingerprint once
|
|
25
|
-
* (console, `[census]` prefix). Legit lane-scoped windows will show up too —
|
|
26
|
-
* the census exists to enumerate the full taxonomy of mid-flight divergence
|
|
27
|
-
* so the write-driven redesign knows every case it must produce, not to
|
|
28
|
-
* judge them. Enabled only when the COMPANION_CENSUS env var is set (in
|
|
29
|
-
* addition to `false`), so normal test runs pay one boolean check.
|
|
30
|
-
*/ typeof globalThis !== "undefined" && !!globalThis.process?.env?.COMPANION_CENSUS;
|
|
31
|
-
|
|
32
|
-
function devCensusCompanions(e) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
3
|
/**
|
|
37
4
|
* Quiescence checks. Run only when the system is fully drained: nothing
|
|
38
5
|
* scheduled, no active/stashed transitions, no live lanes. At that point no
|
|
@@ -42,4 +9,4 @@ function devCensusCompanions(e) {
|
|
|
42
9
|
return;
|
|
43
10
|
}
|
|
44
11
|
|
|
45
|
-
export {
|
|
12
|
+
export { devCheckQuiescent };
|