@solidjs/signals 2.0.0-rc.7 → 2.0.0-rc.9
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 +6357 -0
- package/dist/dev.attribution.js +2485 -0
- package/dist/dev.js +2851 -7027
- package/dist/observe/affects.js +129 -0
- package/dist/observe/attribution.js +7 -0
- package/dist/observe/boundaries.js +641 -0
- package/dist/observe/core/action.js +177 -0
- package/dist/observe/core/async.js +846 -0
- package/dist/observe/core/attribution-costs.js +66 -0
- package/dist/observe/core/attribution-feedback.js +282 -0
- package/dist/observe/core/attribution-hooks.js +82 -0
- package/dist/observe/core/attribution-queries.js +28 -0
- package/dist/observe/core/attribution.js +2095 -0
- package/dist/observe/core/constants.js +248 -0
- package/dist/{types-cjs/core/context.d.cts → observe/core/context.js} +37 -12
- package/dist/observe/core/core.js +1789 -0
- package/dist/observe/core/dev.js +293 -0
- package/dist/observe/core/effect.js +195 -0
- package/dist/observe/core/error-hooks.js +71 -0
- package/dist/observe/core/error.js +80 -0
- package/dist/observe/core/external.js +98 -0
- package/dist/observe/core/graph.js +155 -0
- package/dist/observe/core/heap.js +147 -0
- package/dist/observe/core/invariants.js +45 -0
- package/dist/observe/core/lanes.js +205 -0
- package/dist/observe/core/optimistic.js +585 -0
- package/dist/observe/core/owner.js +322 -0
- package/dist/observe/core/scheduler.js +1428 -0
- package/dist/observe/core/verdict.js +669 -0
- package/dist/observe/index.js +59 -0
- package/dist/observe/map.js +484 -0
- package/dist/{types-cjs/signals.d.cts → observe/signals.js} +311 -317
- package/dist/observe/store/index.js +40 -0
- package/dist/observe/store/next/optimistic.js +660 -0
- package/dist/observe/store/next/projection.js +255 -0
- package/dist/observe/store/next/reconcile.js +375 -0
- package/dist/observe/store/next/store.js +2327 -0
- package/dist/observe/store/next/target.js +51 -0
- package/dist/observe/store/store.js +325 -0
- package/dist/observe/store/storePath.js +103 -0
- package/dist/observe/store/utils.js +1023 -0
- package/dist/prod/attribution.js +41 -0
- package/dist/prod/boundaries.js +128 -76
- package/dist/prod/core/action.js +65 -37
- package/dist/prod/core/async.js +324 -172
- package/dist/prod/core/constants.js +57 -1
- package/dist/prod/core/context.js +3 -3
- package/dist/prod/core/core.js +1003 -364
- package/dist/prod/core/dev.js +17 -1
- package/dist/prod/core/effect.js +76 -42
- package/dist/prod/core/error-hooks.js +71 -0
- package/dist/prod/core/external.js +4 -4
- package/dist/prod/core/graph.js +37 -37
- package/dist/prod/core/heap.js +61 -56
- package/dist/prod/core/lanes.js +107 -63
- package/dist/prod/core/optimistic.js +374 -93
- package/dist/prod/core/owner.js +62 -46
- package/dist/prod/core/scheduler.js +653 -286
- package/dist/prod/core/verdict.js +245 -127
- package/dist/prod/index.js +15 -5
- package/dist/prod/map.js +292 -141
- package/dist/prod/signals.js +29 -16
- package/dist/prod/store/next/optimistic.js +77 -55
- package/dist/prod/store/next/projection.js +31 -20
- package/dist/prod/store/next/reconcile.js +87 -84
- package/dist/prod/store/next/store.js +718 -401
- package/dist/prod/store/next/target.js +32 -10
- package/dist/prod/store/store.js +12 -14
- package/dist/prod/store/utils.js +950 -130
- package/dist/types/attribution.d.ts +20 -0
- package/dist/types/attribution.prod.d.ts +22 -0
- package/dist/types/boundaries.d.ts +10 -1
- package/dist/types/core/action.d.ts +12 -5
- package/dist/types/core/async.d.ts +1 -1
- package/dist/types/core/attribution-costs.d.ts +35 -0
- package/dist/types/core/attribution-feedback.d.ts +133 -0
- package/dist/types/core/attribution-hooks.d.ts +147 -9
- package/dist/types/core/attribution-queries.d.ts +10 -0
- package/dist/types/core/attribution.d.ts +216 -182
- package/dist/types/core/constants.d.ts +56 -0
- package/dist/types/core/core.d.ts +190 -2
- package/dist/types/core/dev.d.ts +246 -28
- package/dist/types/core/effect.d.ts +8 -1
- package/dist/types/core/error-hooks.d.ts +71 -0
- package/dist/types/core/index.d.ts +4 -1
- package/dist/types/core/invariants.d.ts +4 -0
- package/dist/types/core/lanes.d.ts +39 -5
- package/dist/types/core/scheduler.d.ts +153 -0
- package/dist/types/core/types.d.ts +32 -9
- package/dist/types/index.d.ts +10 -3
- package/dist/types/map.d.ts +2 -0
- package/dist/types/signals.d.ts +8 -0
- package/dist/types/store/index.d.ts +2 -0
- package/dist/types/store/next/optimistic.d.ts +1 -1
- package/dist/types/store/next/store.d.ts +11 -5
- package/dist/types/store/next/target.d.ts +37 -10
- package/dist/types/store/utils.d.ts +178 -0
- package/package.json +21 -17
- package/dist/node.cjs +0 -10541
- package/dist/node.dev.cjs +0 -13724
- package/dist/types-cjs/affects.d.cts +0 -47
- package/dist/types-cjs/boundaries.d.cts +0 -175
- package/dist/types-cjs/core/action.d.cts +0 -64
- package/dist/types-cjs/core/async.d.cts +0 -23
- package/dist/types-cjs/core/attribution-hooks.d.cts +0 -127
- package/dist/types-cjs/core/attribution.d.cts +0 -495
- package/dist/types-cjs/core/constants.d.cts +0 -159
- package/dist/types-cjs/core/core.d.cts +0 -185
- package/dist/types-cjs/core/dev.d.cts +0 -136
- package/dist/types-cjs/core/effect.d.cts +0 -30
- package/dist/types-cjs/core/error.d.cts +0 -56
- package/dist/types-cjs/core/external.d.cts +0 -15
- package/dist/types-cjs/core/graph.d.cts +0 -28
- package/dist/types-cjs/core/heap.d.cts +0 -24
- package/dist/types-cjs/core/index.d.cts +0 -13
- package/dist/types-cjs/core/invariants.d.cts +0 -59
- package/dist/types-cjs/core/lanes.d.cts +0 -54
- package/dist/types-cjs/core/optimistic.d.cts +0 -6
- package/dist/types-cjs/core/owner.d.cts +0 -124
- package/dist/types-cjs/core/scheduler.d.cts +0 -236
- package/dist/types-cjs/core/types.d.cts +0 -204
- package/dist/types-cjs/core/verdict.d.cts +0 -2
- package/dist/types-cjs/index.d.cts +0 -10
- package/dist/types-cjs/map.d.cts +0 -69
- package/dist/types-cjs/package.json +0 -3
- package/dist/types-cjs/store/index.d.cts +0 -18
- package/dist/types-cjs/store/next/optimistic.d.cts +0 -25
- package/dist/types-cjs/store/next/projection.d.cts +0 -8
- package/dist/types-cjs/store/next/reconcile.d.cts +0 -10
- package/dist/types-cjs/store/next/store.d.cts +0 -121
- package/dist/types-cjs/store/next/target.d.cts +0 -166
- package/dist/types-cjs/store/store.d.cts +0 -143
- package/dist/types-cjs/store/storePath.d.cts +0 -58
- package/dist/types-cjs/store/utils.d.cts +0 -74
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
import { type OptimisticLane } from "./lanes.cjs";
|
|
2
|
-
import type { Computed, FirewallSignal, NodeExtension, NodeOptions, Owner, Signal } from "./types.cjs";
|
|
3
|
-
export declare const PRIMITIVE_IN_FORBIDDEN_SCOPE_MESSAGE = "[PRIMITIVE_IN_FORBIDDEN_SCOPE] Cannot create reactive primitives inside createTrackedEffect or owner-backed onSettled";
|
|
4
|
-
export declare const REACTIVE_WRITE_IN_OWNED_SCOPE_SIGNAL_MESSAGE: string;
|
|
5
|
-
export declare const REACTIVE_WRITE_IN_OWNED_SCOPE_REFRESH_MESSAGE: string;
|
|
6
|
-
export declare let tracking: boolean;
|
|
7
|
-
/** @internal verdict-module glue */
|
|
8
|
-
export declare function setPendingCheckActive(v: boolean): void;
|
|
9
|
-
/** @internal verdict-module glue */
|
|
10
|
-
export declare function setLatestReadActive(v: boolean): void;
|
|
11
|
-
/** @internal verdict-module glue */
|
|
12
|
-
export declare function setContextInternal(v: Owner | null): void;
|
|
13
|
-
export declare let stale: boolean;
|
|
14
|
-
export declare let pendingCheckActive: boolean;
|
|
15
|
-
export declare let latestReadActive: boolean;
|
|
16
|
-
export declare let context: Owner | null;
|
|
17
|
-
export declare let currentOptimisticLane: OptimisticLane | null;
|
|
18
|
-
export declare let snapshotCaptureActive: boolean;
|
|
19
|
-
export declare let snapshotSources: Set<any> | null;
|
|
20
|
-
export declare function setSnapshotCapture(active: boolean): void;
|
|
21
|
-
export declare function markSnapshotScope(owner: Owner): void;
|
|
22
|
-
export declare function releaseSnapshotScope(owner: Owner): void;
|
|
23
|
-
export declare function clearSnapshots(): void;
|
|
24
|
-
export declare function recompute(el: Computed<any>, create?: boolean): void;
|
|
25
|
-
export declare function computed<T>(fn: (prev?: T) => T | PromiseLike<T> | AsyncIterable<T>): Computed<T>;
|
|
26
|
-
export declare function computed<T>(fn: (prev: T) => T | PromiseLike<T> | AsyncIterable<T>, options?: NodeOptions<T>): Computed<T>;
|
|
27
|
-
/** Lazily allocate a node's cold extension (ONE shape for signals and
|
|
28
|
-
* computeds — `_x` access stays monomorphic). Installers write through
|
|
29
|
-
* this; hot paths read `el._x?._field` gated by the _config presence bits.
|
|
30
|
-
* Never call ext() just to store a field's default. */
|
|
31
|
-
export declare function ext(el: {
|
|
32
|
-
_x: NodeExtension | null;
|
|
33
|
-
}): NodeExtension;
|
|
34
|
-
/**
|
|
35
|
-
* Build an Effect node with all effect-specific fields baked into a single object literal,
|
|
36
|
-
* so V8 sees the full hidden class shape at construction time. Effects always run in lazy
|
|
37
|
-
* mode (recompute is called explicitly by `effect()`), so we hardcode the lazy bits and skip
|
|
38
|
-
* the auto-dispose CONFIG bit (effect() previously cleared it post-construction).
|
|
39
|
-
*/
|
|
40
|
-
export declare function createEffectNode<T>(fn: (prev?: T) => T, effectFn: (val: T, prev: T | undefined) => void | (() => void), errorFn: ((err: unknown, cleanup: () => void) => void | (() => void)) | undefined, type: number, options: NodeOptions<T> | undefined): any;
|
|
41
|
-
/**
|
|
42
|
-
* The shared status notifier for effect nodes, installed once by effect.ts
|
|
43
|
-
* at module evaluation (`this`-dispatched — one function serves every
|
|
44
|
-
* effect, so nodes never store it). Boundary computeds keep their own
|
|
45
|
-
* per-node channel on `_x._notifyStatus`, which takes precedence.
|
|
46
|
-
*/
|
|
47
|
-
export declare let effectStatusNotify: ((this: any, status?: number, error?: any) => void) | null;
|
|
48
|
-
export declare function setEffectStatusNotify(fn: NonNullable<typeof effectStatusNotify>): void;
|
|
49
|
-
/** Resolve a node's status notifier: an own `_x` channel (boundaries) wins;
|
|
50
|
-
* effect nodes (`_type` — EFFECT_PURE is 0, and only effect literals carry
|
|
51
|
-
* the field) fall back to the shared notifier. Presence doubles as the
|
|
52
|
-
* "display consumer" membership test in the status walks, exactly as the
|
|
53
|
-
* per-node field did when every effect carried one. */
|
|
54
|
-
export declare function statusNotifierOf(el: any): ((this: any, status?: number, error?: any) => void) | undefined;
|
|
55
|
-
export declare function signal<T>(v: T, options?: NodeOptions<T>): Signal<T>;
|
|
56
|
-
export declare function signal<T>(v: T, options?: NodeOptions<T>, firewall?: Computed<any>): FirewallSignal<T>;
|
|
57
|
-
/** The shared slot-node unobserved handler — a live binding read directly by
|
|
58
|
-
* the sweep sites (no wrapper frame, no null check: a CONFIG_SLOT_NODE node
|
|
59
|
-
* existing implies the store module loaded and registered the hook). */
|
|
60
|
-
export declare let slotUnobservedHook: (node: Signal<any>) => void;
|
|
61
|
-
/** Install the shared slot-node unobserved handler (store module, once). */
|
|
62
|
-
export declare function setSlotUnobserved(fn: (node: Signal<any>) => void): void;
|
|
63
|
-
export declare function slotSignal<T>(v: T, equals: (a: T, b: T) => boolean, host: object, key: PropertyKey, acc: boolean, firewall?: Computed<unknown> | null): Signal<T>;
|
|
64
|
-
export declare function optimisticSignal<T>(v: T, options?: NodeOptions<T>): Signal<T>;
|
|
65
|
-
export declare function optimisticComputed<T>(fn: (prev?: T) => T | PromiseLike<T> | AsyncIterable<T>, options?: NodeOptions<T>): Computed<T>;
|
|
66
|
-
export declare function isEqual<T>(a: T, b: T): boolean;
|
|
67
|
-
/**
|
|
68
|
-
* When set to a component name string, any reactive read that is not inside a nested tracking
|
|
69
|
-
* scope will log a dev-mode warning. Managed automatically by `untrack(fn, strictReadLabel)`.
|
|
70
|
-
*/
|
|
71
|
-
export declare let strictRead: string | false;
|
|
72
|
-
export declare function setStrictRead(v: string | false): string | false;
|
|
73
|
-
/**
|
|
74
|
-
* Runs `fn` outside of any reactive tracking — reads inside `fn` will not
|
|
75
|
-
* subscribe the current scope. Returns whatever `fn` returns.
|
|
76
|
-
*
|
|
77
|
-
* Use `untrack` inside a memo or effect when you need to read a signal once
|
|
78
|
-
* without making the surrounding computation depend on its future changes.
|
|
79
|
-
*
|
|
80
|
-
* Pass a `strictReadLabel` string to enable a dev-mode warning: any reactive
|
|
81
|
-
* read inside `fn` that isn't inside a nested tracking scope will log a
|
|
82
|
-
* warning naming the label.
|
|
83
|
-
*
|
|
84
|
-
* @example
|
|
85
|
-
* ```ts
|
|
86
|
-
* createEffect(
|
|
87
|
-
* () => trigger(), // tracks `trigger` only
|
|
88
|
-
* () => {
|
|
89
|
-
* const snapshot = untrack(() => state); // read once, untracked
|
|
90
|
-
* log(snapshot);
|
|
91
|
-
* }
|
|
92
|
-
* );
|
|
93
|
-
* ```
|
|
94
|
-
*/
|
|
95
|
-
export declare function untrack<T>(fn: () => T, strictReadLabel?: string | false): T;
|
|
96
|
-
/**
|
|
97
|
-
* Bring a computed to a readable state: lazy/disposed nodes are (re)computed;
|
|
98
|
-
* an isPending() probe (`refresh`) additionally pulls the node fully up to
|
|
99
|
-
* date so its status flags reflect the current graph.
|
|
100
|
-
*/
|
|
101
|
-
export declare function prepareComputed(comp: Computed<unknown>, refresh: boolean): void;
|
|
102
|
-
/**
|
|
103
|
-
* Sentinel returned by readNodeFast when the plain-signal fast path does not
|
|
104
|
-
* apply and the caller must fall back to the full read().
|
|
105
|
-
*/
|
|
106
|
-
export declare const READ_SLOW: unique symbol;
|
|
107
|
-
/**
|
|
108
|
-
* read()'s plain-signal fast path as a standalone entry for hot callers
|
|
109
|
-
* (store traps). Safe to substitute for read() only because the bail
|
|
110
|
-
* conditions mirror read()'s prelude and fast-path guard exactly: the
|
|
111
|
-
* latestRead and pendingCheck windows run side-effectful hooks before the
|
|
112
|
-
* fast path, `_fn` nodes need prepareComputed, and firewall / override /
|
|
113
|
-
* snapshot / transition / lane / dev-strictRead state all take the full
|
|
114
|
-
* resolution. Anything slow returns READ_SLOW; the caller then calls read().
|
|
115
|
-
*/
|
|
116
|
-
/**
|
|
117
|
-
* Wake only authoritative-view readers (until() predicates) subscribed to `el`.
|
|
118
|
-
* The A17-silent ack paths — an authoritative arrival equal to the active
|
|
119
|
-
* override — use this so the predicate re-evaluates without re-firing
|
|
120
|
-
* ordinary subscribers whose visible (override) value did not change.
|
|
121
|
-
* Pay-for-use: reached through GlobalQueue._notifyAuthoritativeObservers,
|
|
122
|
-
* installed at first until() call — apps that never use until() shake it.
|
|
123
|
-
*/
|
|
124
|
-
export declare function notifyAuthoritativeObservers(el: Signal<any> | Computed<any>): void;
|
|
125
|
-
/** Installs the authoritative-reader wakeup hook. Idempotent; called by every
|
|
126
|
-
* creator of a CONFIG_AUTHORITATIVE_READ computation — until() and refresh() —
|
|
127
|
-
* before its first read (same late-binding contract as the optimistic engine;
|
|
128
|
-
* the gating bit is only ever set by such a read, so the `!` call sites are
|
|
129
|
-
* safe once every setter installs, #3303). */
|
|
130
|
-
export declare function installAuthoritativeRead(): void;
|
|
131
|
-
export declare function readNodeFast<T>(el: Signal<T>): T | typeof READ_SLOW;
|
|
132
|
-
export declare function read<T>(el: Signal<T> | Computed<T>): T;
|
|
133
|
-
/**
|
|
134
|
-
* Store-rewrite setter guard: the rewrite parks writes in a pending backing
|
|
135
|
-
* (no setSignal at write time), so the owned-scope write protection must
|
|
136
|
-
* fire at the setter entry instead. Mirrors setSignal's guard condition
|
|
137
|
-
* minus the node-specific exemptions (ownedWrite/firewall), which don't
|
|
138
|
-
* apply to plain store setters.
|
|
139
|
-
*/
|
|
140
|
-
export declare function devGuardStoreSetterWrite(): void;
|
|
141
|
-
export declare function setSignal<T>(el: Signal<T> | Computed<T>, v: T | ((prev: T) => T)): T;
|
|
142
|
-
/**
|
|
143
|
-
* Suppresses automatic recomputation of `el` until the scheduler drains. Used
|
|
144
|
-
* when a manual write should win over dependency changes queued in the same
|
|
145
|
-
* tick. The MANUAL_WRITE flag is cleared by the pending-node drain; projection
|
|
146
|
-
* computeds don't commit values, but they still need the same end-of-tick
|
|
147
|
-
* cleanup point.
|
|
148
|
-
*/
|
|
149
|
-
export declare function suppressComputedRecompute(el: Computed<unknown>): void;
|
|
150
|
-
/**
|
|
151
|
-
* User-facing setter for the memo form of `createSignal(fn)`. Behaves like
|
|
152
|
-
* `setSignal`, but also cancels any pending recompute of the memo so the
|
|
153
|
-
* manual value wins over a value that would otherwise be produced by an
|
|
154
|
-
* upstream change in the same tick.
|
|
155
|
-
*/
|
|
156
|
-
export declare function setMemo<T>(el: Computed<T>, v: T | ((prev: T) => T)): T;
|
|
157
|
-
/**
|
|
158
|
-
* Executes `fn` with the given `owner` set as the current owner. Any reactive
|
|
159
|
-
* primitives (`createSignal`, `createMemo`, `createEffect`, `onCleanup`,
|
|
160
|
-
* `cleanup`, etc.) created inside `fn` are attached to that owner, so they
|
|
161
|
-
* are disposed when the owner is disposed.
|
|
162
|
-
*
|
|
163
|
-
* The classic pattern: capture the current owner with `getOwner()` inside a
|
|
164
|
-
* component, then re-enter it from a callback (event handler, async resolve,
|
|
165
|
-
* setTimeout) so disposables created in the callback get cleaned up with the
|
|
166
|
-
* component.
|
|
167
|
-
*
|
|
168
|
-
* @example
|
|
169
|
-
* ```ts
|
|
170
|
-
* function delayed<T>(ms: number, fn: () => T) {
|
|
171
|
-
* const owner = getOwner();
|
|
172
|
-
* setTimeout(() => runWithOwner(owner, fn), ms);
|
|
173
|
-
* }
|
|
174
|
-
* ```
|
|
175
|
-
*/
|
|
176
|
-
export declare function runWithOwner<T>(owner: Owner | null, fn: () => T): T;
|
|
177
|
-
export declare function staleValues<T>(fn: () => T, set?: boolean): T;
|
|
178
|
-
/**
|
|
179
|
-
* Core marking half of `refresh()` (the public wrapper lives in signals.ts —
|
|
180
|
-
* it validates the target, marks through here, then builds the quiescence
|
|
181
|
-
* promise on the resolve()/until() effect machinery). Flags the node's next
|
|
182
|
-
* recompute as a quiet re-ask and schedules it; no-ops for non-derived or
|
|
183
|
-
* disposed targets and for same-tick manual writes.
|
|
184
|
-
*/
|
|
185
|
-
export declare function markRefresh(node: Computed<any>): void;
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { type Attribution } from "./attribution.cjs";
|
|
2
|
-
import type { Computed, Link, Owner, Signal } from "./types.cjs";
|
|
3
|
-
export interface DevHooks {
|
|
4
|
-
onOwner?: (owner: Owner) => void;
|
|
5
|
-
onGraph?: (value: any, owner: Owner | null) => void;
|
|
6
|
-
onUpdate?: () => void;
|
|
7
|
-
onStoreNodeUpdate?: (state: any, property: PropertyKey, value: any, prev: any) => void;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* `info` is the advisory tier: a structural fact worth surfacing that is not
|
|
11
|
-
* presumptively a bug (e.g. a 2-deep sequential fetch chain, which may be an
|
|
12
|
-
* intrinsic data dependency). Budget/assertion consumers should treat only
|
|
13
|
-
* `warn`/`error` as failures unless they opt in to `info`.
|
|
14
|
-
*/
|
|
15
|
-
export type DiagnosticSeverity = "info" | "warn" | "error";
|
|
16
|
-
export type DiagnosticCode = "STRICT_READ_UNTRACKED" | "PENDING_ASYNC_UNTRACKED_READ" | "PENDING_ASYNC_FORBIDDEN_SCOPE" | "REACTIVE_WRITE_IN_OWNED_SCOPE" | "ACTION_CALLED_IN_OWNED_SCOPE" | "RUN_WITH_DISPOSED_OWNER" | "NO_OWNER_CLEANUP" | "CLEANUP_IN_FORBIDDEN_SCOPE" | "SETTLED_CLEANUP_UNOWNED" | "SETTLE_WALK_UNINITIALIZED_SOURCE" | "FLUSH_IN_EFFECT_CALLBACK" | "PRIMITIVE_IN_FORBIDDEN_SCOPE" | "NO_OWNER_EFFECT" | "NO_OWNER_BOUNDARY" | "ASYNC_OUTSIDE_LOADING_BOUNDARY" | "INVALID_REFRESH_TARGET" | "INVALID_AFFECTS_TARGET" | "MISSING_EFFECT_FN" | "SYNC_NODE_RECEIVED_ASYNC" | "REACTIVITY_HALTED" | "INVARIANT_VIOLATION" | "HUGE_FAN_OUT" | "HUGE_FAN_IN" | "HOT_SCOPE_RERUNS" | "HOT_SCOPE_TIME" | "WIDE_SCOPE_DEPS" | "UNSTABLE_MEMO_OUTPUT" | "WIDE_WRITE" | "ASYNC_WATERFALL" | "HOT_SCOPE_FANOUT" | "SILENT_HOLD" | "LONG_HOLD" | "EFFECT_WRITES_OWN_SOURCE" | "EFFECT_RELAY_TEAR" | "IMMUTABLE_UPDATE_IN_STORE" | "UNSTABLE_LIST_IDENTITY";
|
|
17
|
-
export type DiagnosticKind = "strict-read" | "async" | "write" | "lifecycle" | "owner" | "error" | "perf" | "graph"
|
|
18
|
-
/** Perceived responsiveness: the runtime behaved correctly but the user saw no feedback. */
|
|
19
|
-
| "responsiveness";
|
|
20
|
-
/** First warning when a node's live edge count reaches this size. */
|
|
21
|
-
export declare const GRAPH_SIZE_WARN_AT = 2000;
|
|
22
|
-
/** Repeat the warning at this interval after the first. */
|
|
23
|
-
export declare const GRAPH_SIZE_WARN_EVERY = 500;
|
|
24
|
-
export interface DiagnosticEvent {
|
|
25
|
-
sequence: number;
|
|
26
|
-
code: DiagnosticCode;
|
|
27
|
-
kind: DiagnosticKind;
|
|
28
|
-
severity: DiagnosticSeverity;
|
|
29
|
-
message: string;
|
|
30
|
-
ownerId?: string;
|
|
31
|
-
ownerName?: string;
|
|
32
|
-
nodeName?: string;
|
|
33
|
-
/**
|
|
34
|
-
* Root-first chain of named owners enclosing the subject of the event —
|
|
35
|
-
* component roots as `<Name>`, computations by their `name` option (or
|
|
36
|
-
* the `effect`/`computed` default) — e.g. `["<App>", "<TodoRow>", "effect"]`.
|
|
37
|
-
* Unnamed owners (plain roots) are skipped. Absent when the subject has no
|
|
38
|
-
* named owner at all (a top-level scope, or an unowned primitive — which
|
|
39
|
-
* is usually the finding itself).
|
|
40
|
-
*/
|
|
41
|
-
ownerPath?: string[];
|
|
42
|
-
data?: Record<string, unknown>;
|
|
43
|
-
}
|
|
44
|
-
export type DiagnosticListener = (event: DiagnosticEvent) => void;
|
|
45
|
-
export interface DiagnosticCapture {
|
|
46
|
-
readonly events: readonly DiagnosticEvent[];
|
|
47
|
-
clear(): void;
|
|
48
|
-
stop(): DiagnosticEvent[];
|
|
49
|
-
}
|
|
50
|
-
export interface Diagnostics {
|
|
51
|
-
subscribe(listener: DiagnosticListener): () => void;
|
|
52
|
-
capture(): DiagnosticCapture;
|
|
53
|
-
/**
|
|
54
|
-
* Registers a console footer appended to the first console report of
|
|
55
|
-
* each diagnostic code — a discovery pointer to deeper guidance (e.g.
|
|
56
|
-
* solid-js registers its shipped repair skill). Reported events carry
|
|
57
|
-
* it as trailing lines of the same console entry; events that surface as
|
|
58
|
-
* a thrown error instead get it as a follow-up line. Returning undefined
|
|
59
|
-
* for an event suppresses the footer. Passing undefined unregisters and
|
|
60
|
-
* resets the once-per-code memory.
|
|
61
|
-
*/
|
|
62
|
-
setConsoleFooter(footer: ((event: DiagnosticEvent) => string | undefined) | undefined): void;
|
|
63
|
-
}
|
|
64
|
-
export interface Dev {
|
|
65
|
-
hooks: DevHooks;
|
|
66
|
-
diagnostics: Diagnostics;
|
|
67
|
-
/** "Why did this run" re-run attribution — see attribution.ts. */
|
|
68
|
-
attribution: Attribution;
|
|
69
|
-
getChildren: typeof getChildren;
|
|
70
|
-
getSignals: typeof getSignals;
|
|
71
|
-
getParent: typeof getParent;
|
|
72
|
-
getSources: typeof getSources;
|
|
73
|
-
getObservers: typeof getObservers;
|
|
74
|
-
}
|
|
75
|
-
export declare const DEV: Dev;
|
|
76
|
-
/**
|
|
77
|
-
* Dev-mode internal consistency check. A failure means the reactive system
|
|
78
|
-
* contradicted itself (not that user code misbehaved) — see
|
|
79
|
-
* INTERNALS-ASYNC-STATE.md for the invariant catalog. Throws under __TEST__
|
|
80
|
-
* so the suite (and fuzzing) treats any violation as a hard failure; logs in
|
|
81
|
-
* dev builds so user apps degrade instead of crashing.
|
|
82
|
-
*/
|
|
83
|
-
export declare function assertInvariant(condition: boolean, name: string, message: string): void;
|
|
84
|
-
/** Anything a diagnostic can be about: an owner (root, computed, effect) or a signal. */
|
|
85
|
-
export type DiagnosticSubject = Owner | Signal<any> | Computed<any>;
|
|
86
|
-
/**
|
|
87
|
-
* Root-first names of the owners enclosing `subject` (inclusive when the
|
|
88
|
-
* subject is itself a named owner). Signals hop to their registering owner
|
|
89
|
-
* (`_owner`, set by registerGraph). Unnamed owners are skipped so the path
|
|
90
|
-
* reads as the component tree plus the scope: `<App> › <TodoRow> › effect`.
|
|
91
|
-
*/
|
|
92
|
-
export declare function ownerPath(subject: DiagnosticSubject | null | undefined): string[] | undefined;
|
|
93
|
-
/**
|
|
94
|
-
* Records a diagnostic on the structured channel (listeners, captures) and
|
|
95
|
-
* returns the entry. `subject` locates it: the current reactive `context` by
|
|
96
|
-
* default (right for the synchronous rule checks — they fire inside the
|
|
97
|
-
* scope that misbehaved); pass the node for scheduler-time findings whose
|
|
98
|
-
* ambient context is the flush, or `null` for events that have no location
|
|
99
|
-
* by nature. Console output is a separate step — see `reportDiagnostic`.
|
|
100
|
-
*/
|
|
101
|
-
export declare function emitDiagnostic(event: Omit<DiagnosticEvent, "sequence" | "ownerPath">, subject?: DiagnosticSubject | null | undefined): DiagnosticEvent;
|
|
102
|
-
/**
|
|
103
|
-
* The console face of a diagnostic — ONE entry per finding: the message, the
|
|
104
|
-
* owner path (`in <App> › <TodoRow> › effect`) so a human can locate it, the
|
|
105
|
-
* once-per-code footer as trailing lines, and — when the subject is a
|
|
106
|
-
* binding effect the rendering runtime tagged — the element it writes, as a
|
|
107
|
-
* second console argument (hover highlights it, click jumps to Elements).
|
|
108
|
-
* Severity picks the console method. Call sites report the entry
|
|
109
|
-
* `emitDiagnostic` returned so the structured and console channels never
|
|
110
|
-
* disagree.
|
|
111
|
-
*/
|
|
112
|
-
export declare function reportDiagnostic(entry: DiagnosticEvent): void;
|
|
113
|
-
/**
|
|
114
|
-
* Shared strict-read diagnostics for core read() and the store proxy traps.
|
|
115
|
-
* Single source for the message text — the #2897 safeguard parity between
|
|
116
|
-
* memos and stores is exactly these firing identically from both paths.
|
|
117
|
-
*/
|
|
118
|
-
export declare function throwPendingUntrackedRead(strictReadLabel: string, fields?: Partial<Omit<DiagnosticEvent, "sequence" | "data" | "ownerPath">>): never;
|
|
119
|
-
export declare function warnStrictReadUntracked(strictReadLabel: string, fields?: Partial<Omit<DiagnosticEvent, "sequence" | "ownerPath">>): void;
|
|
120
|
-
export declare function registerGraph(value: any, owner: Owner | null): void;
|
|
121
|
-
export declare function clearSignals(node: Owner): void;
|
|
122
|
-
export declare function getChildren(owner: Owner): Owner[];
|
|
123
|
-
export declare function getSignals(owner: Owner): any[];
|
|
124
|
-
export declare function getParent(owner: Owner): Owner | null;
|
|
125
|
-
export declare function getSources(computation: Computed<any>): (Signal<any> | Computed<any>)[];
|
|
126
|
-
export declare function getObservers(node: Signal<any> | Computed<any>): Computed<any>[];
|
|
127
|
-
/**
|
|
128
|
-
* DEV-only: bump live edge counts after a new graph link and warn when a
|
|
129
|
-
* node grows an unusually large fan-out (many subscribers on one source) or
|
|
130
|
-
* fan-in (many sources on one computation). Repeat-reads that `link()`
|
|
131
|
-
* dedupes never reach here. Always-on in dev — unlike the opt-in attribution
|
|
132
|
-
* engine, a graph-size pathology should surface without asking.
|
|
133
|
-
*/
|
|
134
|
-
export declare function noteGraphLink(dep: Signal<any> | Computed<any>, sub: Computed<any>): void;
|
|
135
|
-
/** DEV-only: drop live edge counts when a link is removed. */
|
|
136
|
-
export declare function unnoteGraphLink(link: Link): void;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { Computed, NodeOptions, Owner } from "./types.cjs";
|
|
2
|
-
export interface Effect<T> extends Computed<T>, Owner {
|
|
3
|
-
_effectFn: (val: T, prev: T | undefined) => void | (() => void);
|
|
4
|
-
_errorFn?: (err: unknown, cleanup: () => void) => void;
|
|
5
|
-
_modified: boolean;
|
|
6
|
-
_prevValue: T | undefined;
|
|
7
|
-
_type: number;
|
|
8
|
-
_boundRunEffect?: () => void;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Effects are the leaf nodes of our reactive graph. When their sources change, they are
|
|
12
|
-
* automatically added to the queue of effects to re-execute, which will cause them to fetch their
|
|
13
|
-
* sources and recompute
|
|
14
|
-
*/
|
|
15
|
-
export declare function effect<T>(compute: (prev: T | undefined) => T, effect: (val: T, prev: T | undefined) => void | (() => void), error?: (err: unknown, cleanup: () => void) => void | (() => void), options?: NodeOptions<any> & {
|
|
16
|
-
user?: boolean;
|
|
17
|
-
defer?: boolean;
|
|
18
|
-
schedule?: boolean;
|
|
19
|
-
}): void;
|
|
20
|
-
export interface TrackedEffect extends Computed<void> {
|
|
21
|
-
_modified: boolean;
|
|
22
|
-
_type: number;
|
|
23
|
-
_run: () => void;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Internal tracked effect - bypasses heap, goes directly to effect queue.
|
|
27
|
-
* Runs as a leaf owner: child primitives and onCleanup are forbidden (__DEV__ throws).
|
|
28
|
-
* Uses stale reads.
|
|
29
|
-
*/
|
|
30
|
-
export declare function trackedEffect(fn: () => void | (() => void), options?: NodeOptions<any>): void;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Thrown by a tracked read whose value is currently pending (an async memo /
|
|
3
|
-
* `createSignal(asyncFn)` / projection / store derivation that hasn't settled
|
|
4
|
-
* yet). Surfacing through the reactive graph is what suspends the consumer
|
|
5
|
-
* scope — the nearest enclosing `<Loading>` boundary catches the throw and
|
|
6
|
-
* renders its fallback until the source resolves.
|
|
7
|
-
*
|
|
8
|
-
* App code rarely catches this directly; `<Loading>` is the canonical
|
|
9
|
-
* handler. The error type is exposed for advanced cases — e.g. interop layers
|
|
10
|
-
* that bridge Solid's pending-throw protocol to a different async strategy,
|
|
11
|
-
* or tests that want to assert on the suspension shape.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```ts
|
|
15
|
-
* // Advanced: distinguish "not ready yet" from a real error in custom
|
|
16
|
-
* // boundary plumbing. App code should rely on `<Loading>` / `<Errored>`.
|
|
17
|
-
* try {
|
|
18
|
-
* const value = readReactiveSource();
|
|
19
|
-
* } catch (err) {
|
|
20
|
-
* if (err instanceof NotReadyError) throw err; // re-throw to suspend
|
|
21
|
-
* reportError(err);
|
|
22
|
-
* }
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
export declare class NotReadyError extends Error {
|
|
26
|
-
/**
|
|
27
|
-
* Tags a visibility-only notification on the affects() boundary channel:
|
|
28
|
-
* boundaries update display state from it, but the root queue never
|
|
29
|
-
* registers a reporter — marks are invisible to completion accounting by
|
|
30
|
-
* construction.
|
|
31
|
-
*/
|
|
32
|
-
_markVisual?: boolean;
|
|
33
|
-
source: any;
|
|
34
|
-
constructor(source: any);
|
|
35
|
-
}
|
|
36
|
-
export declare class StatusError extends Error {
|
|
37
|
-
source: any;
|
|
38
|
-
constructor(source: any, original: any);
|
|
39
|
-
}
|
|
40
|
-
/** Return the user's error from an internal status wrapper. */
|
|
41
|
-
export declare function unwrapStatusError(error: unknown): unknown;
|
|
42
|
-
/**
|
|
43
|
-
* Rejection value of `until(fn, { timeout })` when the predicate does not turn
|
|
44
|
-
* truthy within the window. Inside an `action()`, the rejection is thrown back
|
|
45
|
-
* in at the `yield` point — catchable there, or the action fails and its
|
|
46
|
-
* optimistic state reverts.
|
|
47
|
-
*/
|
|
48
|
-
export declare class TimeoutError extends Error {
|
|
49
|
-
constructor(message?: string);
|
|
50
|
-
}
|
|
51
|
-
export declare class NoOwnerError extends Error {
|
|
52
|
-
constructor();
|
|
53
|
-
}
|
|
54
|
-
export declare class ContextNotFoundError extends Error {
|
|
55
|
-
constructor();
|
|
56
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export type ExternalSourceFactory = (fn: (prev: any) => any, trigger: () => void) => ExternalSource;
|
|
2
|
-
export interface ExternalSource {
|
|
3
|
-
track: (prev: any) => any;
|
|
4
|
-
dispose: () => void;
|
|
5
|
-
}
|
|
6
|
-
export interface ExternalSourceConfig {
|
|
7
|
-
factory: ExternalSourceFactory;
|
|
8
|
-
untrack?: <T>(fn: () => T) => T;
|
|
9
|
-
}
|
|
10
|
-
export declare let externalSourceConfig: {
|
|
11
|
-
factory: ExternalSourceFactory;
|
|
12
|
-
untrack: <T>(fn: () => T) => T;
|
|
13
|
-
} | null;
|
|
14
|
-
export declare function enableExternalSource(config: ExternalSourceConfig): void;
|
|
15
|
-
export declare function _resetExternalSourceConfig(): void;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { Computed, Link, Signal } from "./types.cjs";
|
|
2
|
-
export declare function unlinkSubs(link: Link): Link | null;
|
|
3
|
-
export declare function trimStaleDeps(el: Computed<any>): void;
|
|
4
|
-
export declare function clearDeps(el: Computed<unknown>): void;
|
|
5
|
-
export declare function unobserved(el: Computed<unknown>): void;
|
|
6
|
-
/**
|
|
7
|
-
* Deferred dormancy for never-observed auto-dispose computeds (#3078).
|
|
8
|
-
*
|
|
9
|
-
* An untracked top-level read of a subscriber-less observation-lifecycle memo
|
|
10
|
-
* used to call unobserved() inline at the end of read(). That kept the leak
|
|
11
|
-
* closed (the compute links the memo into its deps' sub lists — without a
|
|
12
|
-
* teardown point a never-observed memo is retained by its sources forever;
|
|
13
|
-
* upstream alien-signals has exactly this retention), but it made reads
|
|
14
|
-
* destructive: each read disposed the node, the next read revived it with a
|
|
15
|
-
* full recompute in whatever ambient transition/lane context happened to be
|
|
16
|
-
* current, so consecutive reads could return different answers with no write
|
|
17
|
-
* in between.
|
|
18
|
-
*
|
|
19
|
-
* Instead, reads queue the node here and the scheduler sweeps at the top of
|
|
20
|
-
* the next flush (before runHeap, so a same-tick dirtying is reclaimed
|
|
21
|
-
* instead of recomputed). Reads become idempotent within a tick (the node
|
|
22
|
-
* stays alive and serves its cache, uniform with observed memos) while
|
|
23
|
-
* reclamation still happens within one microtask — the enqueue site arms
|
|
24
|
-
* schedule(), so a flush is guaranteed even when no other work is queued.
|
|
25
|
-
*/
|
|
26
|
-
export declare const dormantNodes: Set<Computed<unknown>>;
|
|
27
|
-
export declare function sweepDormant(): void;
|
|
28
|
-
export declare function link(dep: Signal<any> | Computed<any>, sub: Computed<any>, pendingObserver?: boolean): void;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { Computed } from "./types.cjs";
|
|
2
|
-
/** The queue a node belongs to, picked from its own zombie flag. */
|
|
3
|
-
export declare function queueFor(n: Computed<any>): Heap;
|
|
4
|
-
/**
|
|
5
|
-
* Schedule one subscriber to re-run on the next flush: inserted into its own
|
|
6
|
-
* (zombie-flag-routed) heap with the `_min` cursor pulled down. Tracked
|
|
7
|
-
* effects ride the heap too — the heap visit is their (empty) compute phase,
|
|
8
|
-
* which hands the callback to the user queue once the pass has committed
|
|
9
|
-
* (see GlobalQueue._update, #3291).
|
|
10
|
-
*/
|
|
11
|
-
export declare function enqueueSub(node: Computed<any>): void;
|
|
12
|
-
export interface Heap {
|
|
13
|
-
_heap: (Computed<unknown> | undefined)[];
|
|
14
|
-
_marked: boolean;
|
|
15
|
-
_min: number;
|
|
16
|
-
_max: number;
|
|
17
|
-
}
|
|
18
|
-
export declare function increaseHeapSize(n: number, heap: Heap): void;
|
|
19
|
-
export declare function insertIntoHeap(n: Computed<any>, heap: Heap): void;
|
|
20
|
-
export declare function insertIntoHeapHeight(n: Computed<unknown>, heap: Heap): void;
|
|
21
|
-
export declare function deleteFromHeap(n: Computed<unknown>, heap: Heap): void;
|
|
22
|
-
export declare function markHeap(heap: Heap): void;
|
|
23
|
-
export declare function markNode(el: Computed<unknown>, newState?: number): void;
|
|
24
|
-
export declare function runHeap(heap: Heap, recompute: (el: Computed<unknown>) => void): void;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export { ContextNotFoundError, NoOwnerError, NotReadyError, TimeoutError } from "./error.cjs";
|
|
2
|
-
export { isEqual, untrack, runWithOwner, computed, signal, read, setSignal, setMemo, suppressComputedRecompute, optimisticSignal, optimisticComputed, installAuthoritativeRead, markRefresh, staleValues, setSnapshotCapture, markSnapshotScope, releaseSnapshotScope, clearSnapshots } from "./core.cjs";
|
|
3
|
-
export { enableExternalSource, _resetExternalSourceConfig, type ExternalSourceFactory, type ExternalSource, type ExternalSourceConfig } from "./external.cjs";
|
|
4
|
-
export { createOwner, createRoot, dispose, getNextChildId, getObserver, getOwner, isDisposed, cleanup, peekNextChildId } from "./owner.cjs";
|
|
5
|
-
export { createContext, getContext, setContext, type Context, type ContextRecord } from "./context.cjs";
|
|
6
|
-
export { handleAsync } from "./async.cjs";
|
|
7
|
-
export { isPending, latest } from "./verdict.cjs";
|
|
8
|
-
export type { Computed, Disposable, FirewallSignal, Link, Owner, Root, Signal, NodeOptions } from "./types.cjs";
|
|
9
|
-
export { effect, trackedEffect, type Effect, type TrackedEffect } from "./effect.cjs";
|
|
10
|
-
export { action } from "./action.cjs";
|
|
11
|
-
export { flush, Queue, GlobalQueue, enforceLoadingBoundary, resetErrorHalt, type IQueue, type QueueCallback } from "./scheduler.cjs";
|
|
12
|
-
export { DEV, type Dev, type DevHooks, type DiagnosticCapture, type DiagnosticCode, type DiagnosticEvent, type DiagnosticKind, type Diagnostics, type DiagnosticSeverity } from "./dev.cjs";
|
|
13
|
-
export * from "./constants.cjs";
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import type { OptimisticLane } from "./lanes.cjs";
|
|
2
|
-
import type { Computed, Signal } from "./types.cjs";
|
|
3
|
-
/**
|
|
4
|
-
* Test-mode invariant checks for the async/transition/lane machinery.
|
|
5
|
-
* Catalog and rationale: packages/signals/docs/INTERNALS-ASYNC-STATE.md.
|
|
6
|
-
*
|
|
7
|
-
* These are implementation self-consistency checks, not semantic rules: a
|
|
8
|
-
* violation means the reactive system contradicted itself.
|
|
9
|
-
*
|
|
10
|
-
* They are gated on `__TEST__` (not just `__DEV__`): the per-write Set
|
|
11
|
-
* tracking and per-flush quiescence sweep are too expensive for shipped dev
|
|
12
|
-
* builds and for benchmarks (they showed up as a 5-21% hit across the
|
|
13
|
-
* CodSpeed suite when they ran under `__DEV__`). Call sites stay `__DEV__`
|
|
14
|
-
* guarded so production tree-shakes the calls; each entry point here
|
|
15
|
-
* early-returns unless `__TEST__` is set, so dev builds pay only a no-op
|
|
16
|
-
* call. The test suite (vitest run) defines `__TEST__: true`; benchmark mode
|
|
17
|
-
* defines `__TEST__: false`.
|
|
18
|
-
*/
|
|
19
|
-
type AnyNode = Signal<any> | Computed<any>;
|
|
20
|
-
/** Wired by core.ts at module init to avoid import cycles. */
|
|
21
|
-
export declare const InvariantHooks: {
|
|
22
|
-
pendingProbeActive: (() => boolean) | null;
|
|
23
|
-
/** Fresh oracle for what an isPending companion SHOULD read right now. */
|
|
24
|
-
computePendingState: ((node: AnyNode) => boolean) | null;
|
|
25
|
-
};
|
|
26
|
-
export declare function devTrackHeldPending(node: AnyNode): void;
|
|
27
|
-
export declare function devTrackCompanionOwner(node: AnyNode): void;
|
|
28
|
-
export declare function devTrackOptimistic(node: AnyNode): void;
|
|
29
|
-
export declare function devTrackAffects(node: AnyNode): void;
|
|
30
|
-
/**
|
|
31
|
-
* Open/close the sanctioned registration window. Call sites are `__DEV__`
|
|
32
|
-
* guarded (no prod cost); the code inside the window must not throw.
|
|
33
|
-
*/
|
|
34
|
-
export declare function beginAsyncReporterWrites(): void;
|
|
35
|
-
export declare function endAsyncReporterWrites(): void;
|
|
36
|
-
export declare function createAsyncReporters(): Map<Computed<any>, Set<Computed<any>>>;
|
|
37
|
-
/**
|
|
38
|
-
* INV-2: a node with an *active* override must be registered for reversion in
|
|
39
|
-
* the queue's or a transition's `_optimisticNodes`. An unregistered active
|
|
40
|
-
* override would survive transition completion forever. Runs at the end of
|
|
41
|
-
* every flush (not just quiescence — the invariant holds mid-transition).
|
|
42
|
-
* (There is no revert-target requirement: authoritative values commit
|
|
43
|
-
* silently into `_value` under the override mask — A17 — so reverting is
|
|
44
|
-
* just dropping the override.)
|
|
45
|
-
*/
|
|
46
|
-
export declare function devCheckActiveOverrides(isRegisteredForRevert: (node: AnyNode) => boolean): void;
|
|
47
|
-
/** INV-1: an isPending() probe must never leak past its own call. */
|
|
48
|
-
export declare function devCheckFlushStart(): void;
|
|
49
|
-
/** INV-5: a merged lane's work moved to its root on merge and must stay empty. */
|
|
50
|
-
export declare function devCheckMergedLaneEmpty(lane: OptimisticLane): void;
|
|
51
|
-
export declare function devCensusCompanions(isQueuedForCommit?: (node: AnyNode) => boolean): void;
|
|
52
|
-
/**
|
|
53
|
-
* Quiescence checks. Run only when the system is fully drained: nothing
|
|
54
|
-
* scheduled, no active/stashed transitions, no live lanes. At that point no
|
|
55
|
-
* transition-scoped state may survive, and the lazily-created companions must
|
|
56
|
-
* agree with a fresh computation of their owner's state.
|
|
57
|
-
*/
|
|
58
|
-
export declare function devCheckQuiescent(isQueuedForCommit: (node: AnyNode) => boolean): void;
|
|
59
|
-
export {};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { type QueueCallback, type Transition } from "./scheduler.cjs";
|
|
2
|
-
import type { Computed, Signal } from "./types.cjs";
|
|
3
|
-
/**
|
|
4
|
-
* OptimisticLane represents the context for a single optimistic write.
|
|
5
|
-
* Each optimistic signal creates its own lane. Lanes merge when their
|
|
6
|
-
* dependency graphs overlap.
|
|
7
|
-
*/
|
|
8
|
-
export interface OptimisticLane {
|
|
9
|
-
_source: Signal<any>;
|
|
10
|
-
_pendingAsync: Set<Computed<any>>;
|
|
11
|
-
_effectQueues: [QueueCallback[], QueueCallback[]];
|
|
12
|
-
_mergedInto: OptimisticLane | null;
|
|
13
|
-
_transition: Transition | null;
|
|
14
|
-
_parentLane: OptimisticLane | null;
|
|
15
|
-
}
|
|
16
|
-
export declare const signalLanes: WeakMap<Signal<any>, OptimisticLane>;
|
|
17
|
-
export declare const activeLanes: Set<OptimisticLane>;
|
|
18
|
-
/**
|
|
19
|
-
* Get an existing lane for a signal or create a new one.
|
|
20
|
-
* Reuses lane for multiple writes to the same signal.
|
|
21
|
-
*/
|
|
22
|
-
export declare function getOrCreateLane(signal: Signal<any>): OptimisticLane;
|
|
23
|
-
/**
|
|
24
|
-
* Union-find: find the root lane.
|
|
25
|
-
*/
|
|
26
|
-
export declare function findLane(lane: OptimisticLane): OptimisticLane;
|
|
27
|
-
/**
|
|
28
|
-
* Is the lane held? `_pendingAsync` records the async the lane OWNS (derived
|
|
29
|
-
* under it); the transaction's reporter map records the async a render effect
|
|
30
|
-
* OBSERVED pending with no boundary taking it (INV-3, the one registration
|
|
31
|
-
* site). A hold needs both — the same rule the transaction itself uses, so a
|
|
32
|
-
* memo nobody renders, or one a fallback-showing boundary caught, cannot tear
|
|
33
|
-
* a frame and holds nothing (#3289). An orphan lane has no observation record
|
|
34
|
-
* and never holds.
|
|
35
|
-
*/
|
|
36
|
-
export declare function laneHeld(lane: OptimisticLane): boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Merge two lanes when their dependency graphs overlap.
|
|
39
|
-
*/
|
|
40
|
-
export declare function mergeLanes(lane1: OptimisticLane, lane2: OptimisticLane): OptimisticLane;
|
|
41
|
-
/**
|
|
42
|
-
* Resolve a node's lane: follow union-find chain, verify active, clear if stale.
|
|
43
|
-
*/
|
|
44
|
-
export declare function resolveLane(el: Signal<any> | Computed<any>): OptimisticLane | undefined;
|
|
45
|
-
export declare function resolveTransition(el: Signal<any> | Computed<any>): Transition | null | undefined;
|
|
46
|
-
/**
|
|
47
|
-
* Check if a node has an active optimistic override.
|
|
48
|
-
*/
|
|
49
|
-
export declare function hasActiveOverride(el: Signal<any> | Computed<any>): boolean;
|
|
50
|
-
/**
|
|
51
|
-
* Assign or merge a lane onto a node. At convergence points (node already has
|
|
52
|
-
* a different active lane), merge unless the node has an active override.
|
|
53
|
-
*/
|
|
54
|
-
export declare function assignOrMergeLane(el: Signal<any> | Computed<any>, sourceLane: OptimisticLane): void;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Installs the engine's hooks. Idempotent; called by every module that can
|
|
3
|
-
* create optimistic state (verdict.ts at module top level, createOptimistic
|
|
4
|
-
* and createOptimisticStore at first call) BEFORE any optimistic node exists.
|
|
5
|
-
*/
|
|
6
|
-
export declare function installOptimisticEngine(): void;
|