@solidjs/signals 2.0.0-rc.2 → 2.0.0-rc.20
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 +6505 -0
- package/dist/dev.attribution.js +3484 -0
- package/dist/dev.js +10227 -9508
- package/dist/observe/affects-marks.js +86 -0
- package/dist/observe/affects.js +112 -0
- package/dist/observe/attribution.js +7 -0
- package/dist/observe/boundaries.js +696 -0
- package/dist/observe/core/action.js +182 -0
- package/dist/observe/core/async.js +824 -0
- package/dist/observe/core/attribution-costs.js +66 -0
- package/dist/observe/core/attribution-feedback.js +280 -0
- package/dist/observe/core/attribution-hooks.js +83 -0
- package/dist/observe/core/attribution-queries.js +43 -0
- package/dist/observe/core/attribution.js +3079 -0
- package/dist/observe/core/constants.js +269 -0
- package/dist/observe/core/context.js +63 -0
- package/dist/observe/core/copies.js +10 -0
- package/dist/observe/core/core.js +1707 -0
- package/dist/observe/core/dev.js +394 -0
- package/dist/observe/core/effect.js +193 -0
- package/dist/observe/core/error-hooks.js +71 -0
- package/dist/observe/core/error.js +82 -0
- package/dist/observe/core/external.js +97 -0
- package/dist/observe/core/graph.js +162 -0
- package/dist/observe/core/heap.js +124 -0
- package/dist/observe/core/identities.js +62 -0
- package/dist/observe/core/invariants.js +12 -0
- package/dist/observe/core/lanes.js +972 -0
- package/dist/observe/core/owner.js +371 -0
- package/dist/observe/core/scheduler.js +1157 -0
- package/dist/observe/core/truth.js +47 -0
- package/dist/observe/core/verdict.js +470 -0
- package/dist/observe/deferred.js +186 -0
- package/dist/observe/flatten.js +79 -0
- package/dist/observe/from.js +248 -0
- package/dist/observe/index.js +71 -0
- package/dist/observe/map.js +593 -0
- package/dist/observe/reveal.js +212 -0
- package/dist/observe/signals.js +717 -0
- package/dist/observe/store/affects.js +142 -0
- package/dist/observe/store/edges.js +39 -0
- package/dist/observe/store/hooks.js +16 -0
- package/dist/observe/store/index.js +47 -0
- package/dist/observe/store/optimistic.js +713 -0
- package/dist/observe/store/projection.js +345 -0
- package/dist/observe/store/reconcile.js +281 -0
- package/dist/observe/store/store.js +2127 -0
- package/dist/observe/store/storePath.js +103 -0
- package/dist/observe/store/target.js +46 -0
- package/dist/observe/store/types.js +83 -0
- package/dist/observe/store/utils.js +1063 -0
- package/dist/prod/affects-marks.js +86 -0
- package/dist/prod/affects.js +98 -112
- package/dist/prod/attribution.js +45 -0
- package/dist/prod/boundaries.js +578 -468
- package/dist/prod/core/action.js +92 -59
- package/dist/prod/core/async.js +522 -336
- package/dist/prod/core/attribution-hooks.js +3 -0
- package/dist/prod/core/constants.js +168 -44
- package/dist/prod/core/context.js +12 -16
- package/dist/prod/core/copies.js +10 -0
- package/dist/prod/core/core.js +1345 -627
- package/dist/prod/core/dev.js +123 -1
- package/dist/prod/core/effect.js +113 -80
- package/dist/prod/core/error-hooks.js +71 -0
- package/dist/prod/core/error.js +18 -4
- package/dist/prod/core/external.js +6 -7
- package/dist/prod/core/graph.js +119 -72
- package/dist/prod/core/heap.js +85 -109
- package/dist/prod/core/identities.js +62 -0
- package/dist/prod/core/invariants.js +1 -32
- package/dist/prod/core/lanes.js +931 -132
- package/dist/prod/core/owner.js +192 -129
- package/dist/prod/core/scheduler.js +948 -642
- package/dist/prod/core/truth.js +47 -0
- package/dist/prod/core/verdict.js +409 -420
- package/dist/prod/deferred.js +184 -0
- package/dist/prod/flatten.js +77 -0
- package/dist/prod/from.js +248 -0
- package/dist/prod/index.js +40 -16
- package/dist/prod/map.js +481 -211
- package/dist/prod/reveal.js +212 -0
- package/dist/prod/signals.js +401 -84
- package/dist/prod/store/affects.js +142 -0
- package/dist/prod/store/edges.js +39 -0
- package/dist/prod/store/hooks.js +16 -0
- package/dist/prod/store/index.js +27 -18
- package/dist/prod/store/optimistic.js +707 -0
- package/dist/prod/store/projection.js +331 -0
- package/dist/prod/store/reconcile.js +281 -0
- package/dist/prod/store/store.js +1952 -267
- package/dist/prod/store/storePath.js +1 -1
- package/dist/prod/store/target.js +43 -0
- package/dist/prod/store/types.js +83 -0
- package/dist/prod/store/utils.js +997 -138
- package/dist/types/affects-marks.d.ts +14 -0
- package/dist/types/affects.d.ts +12 -30
- package/dist/types/attribution.d.ts +19 -0
- package/dist/types/attribution.prod.d.ts +22 -0
- package/dist/types/boundaries.d.ts +99 -124
- package/dist/types/carved.d.ts +1 -0
- package/dist/types/core/action.d.ts +23 -9
- package/dist/types/core/async.d.ts +34 -6
- 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 +307 -8
- package/dist/types/core/attribution-queries.d.ts +24 -0
- package/dist/types/core/attribution.d.ts +802 -72
- package/dist/types/core/constants.d.ts +195 -38
- package/dist/types/core/copies.d.ts +54 -0
- package/dist/types/core/core.d.ts +295 -65
- package/dist/types/core/dev.d.ts +509 -22
- package/dist/types/core/effect.d.ts +1 -1
- package/dist/types/core/error-hooks.d.ts +71 -0
- package/dist/types/core/error.d.ts +18 -1
- package/dist/types/core/graph.d.ts +40 -1
- package/dist/types/core/heap.d.ts +5 -5
- package/dist/types/core/identities.d.ts +17 -0
- package/dist/types/core/index.d.ts +11 -7
- package/dist/types/core/invariants.d.ts +1 -26
- package/dist/types/core/lanes.d.ts +74 -43
- package/dist/types/core/owner.d.ts +27 -9
- package/dist/types/core/scheduler.d.ts +353 -102
- package/dist/types/core/truth.d.ts +18 -0
- package/dist/types/core/types.d.ts +97 -71
- package/dist/types/core/verdict.d.ts +35 -0
- package/dist/types/deferred.d.ts +28 -0
- package/dist/types/flatten.d.ts +8 -0
- package/dist/types/from.d.ts +47 -0
- package/dist/types/index.d.ts +33 -7
- package/dist/types/map.d.ts +4 -2
- package/dist/types/reveal.d.ts +19 -0
- package/dist/types/signals.d.ts +196 -45
- package/dist/types/store/affects.d.ts +12 -0
- package/dist/types/store/edges.d.ts +9 -0
- package/dist/types/store/hooks.d.ts +62 -0
- package/dist/types/store/index.d.ts +42 -15
- package/dist/types/store/optimistic.d.ts +24 -45
- package/dist/types/store/projection.d.ts +17 -68
- package/dist/types/store/reconcile.d.ts +3 -46
- package/dist/types/store/store.d.ts +133 -136
- package/dist/types/store/storePath.d.ts +1 -1
- package/dist/types/store/target.d.ts +166 -0
- package/dist/types/store/types.d.ts +105 -0
- package/dist/types/store/utils.d.ts +188 -0
- package/package.json +31 -26
- package/dist/node.cjs +0 -8745
- package/dist/prod/core/optimistic.js +0 -265
- package/dist/prod/store/next/optimistic.js +0 -385
- package/dist/prod/store/next/projection.js +0 -172
- package/dist/prod/store/next/reconcile.js +0 -331
- package/dist/prod/store/next/store.js +0 -1499
- package/dist/prod/store/next/target.js +0 -20
- package/dist/types/core/optimistic.d.ts +0 -6
- package/dist/types/store/next/optimistic.d.ts +0 -20
- package/dist/types/store/next/projection.d.ts +0 -8
- package/dist/types/store/next/reconcile.d.ts +0 -3
- package/dist/types/store/next/store.d.ts +0 -77
- package/dist/types/store/next/target.d.ts +0 -117
- 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 -21
- package/dist/types-cjs/core/attribution-hooks.d.cts +0 -52
- package/dist/types-cjs/core/attribution.d.cts +0 -186
- package/dist/types-cjs/core/constants.d.cts +0 -97
- package/dist/types-cjs/core/context.d.cts +0 -36
- package/dist/types-cjs/core/core.d.cts +0 -163
- package/dist/types-cjs/core/dev.d.cts +0 -81
- package/dist/types-cjs/core/effect.d.cts +0 -30
- package/dist/types-cjs/core/error.d.cts +0 -47
- package/dist/types-cjs/core/external.d.cts +0 -15
- package/dist/types-cjs/core/graph.d.cts +0 -6
- package/dist/types-cjs/core/heap.d.cts +0 -22
- 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 -44
- 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 -180
- package/dist/types-cjs/core/types.d.cts +0 -192
- 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/signals.d.cts +0 -624
- package/dist/types-cjs/store/index.d.cts +0 -19
- package/dist/types-cjs/store/next/optimistic.d.cts +0 -20
- package/dist/types-cjs/store/next/projection.d.cts +0 -8
- package/dist/types-cjs/store/next/reconcile.d.cts +0 -3
- package/dist/types-cjs/store/next/store.d.cts +0 -77
- package/dist/types-cjs/store/next/target.d.cts +0 -117
- package/dist/types-cjs/store/optimistic.d.cts +0 -45
- package/dist/types-cjs/store/projection.d.cts +0 -70
- package/dist/types-cjs/store/reconcile.d.cts +0 -46
- package/dist/types-cjs/store/store.d.cts +0 -138
- package/dist/types-cjs/store/storePath.d.cts +0 -58
- package/dist/types-cjs/store/utils.d.cts +0 -74
package/dist/types/core/dev.d.ts
CHANGED
|
@@ -1,17 +1,34 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import type {
|
|
1
|
+
import { type InteractionRef, type NavigationRef } from "./attribution-hooks.js";
|
|
2
|
+
import type { ChangeOrigin, CreateEvent, EffectRunEvent, FallbackEvent, FlightEvent, FlushEvent, GraphEvent, HoldEvent, InteractionEvent, NavigationEvent, RerunEvent } from "./attribution.js";
|
|
3
|
+
import type { Computed, Owner, Signal } from "./types.js";
|
|
3
4
|
export interface DevHooks {
|
|
4
5
|
onOwner?: (owner: Owner) => void;
|
|
5
6
|
onGraph?: (value: any, owner: Owner | null) => void;
|
|
6
7
|
onUpdate?: () => void;
|
|
7
8
|
onStoreNodeUpdate?: (state: any, property: PropertyKey, value: any, prev: any) => void;
|
|
9
|
+
/** @internal Every node read (the frames client's identity-drift check; `setReadWatch`). */
|
|
10
|
+
onRead?: (node: object) => void;
|
|
8
11
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* `info` is the advisory tier: a structural fact worth surfacing that is not
|
|
14
|
+
* presumptively a bug (e.g. a 2-deep sequential fetch chain, which may be an
|
|
15
|
+
* intrinsic data dependency). Budget/assertion consumers should treat only
|
|
16
|
+
* `warn`/`error` as failures unless they opt in to `info`.
|
|
17
|
+
*/
|
|
18
|
+
export type DiagnosticSeverity = "info" | "warn" | "error";
|
|
19
|
+
export type DiagnosticCode = "STRICT_READ_UNTRACKED" | "PENDING_ASYNC_UNTRACKED_READ" | "PENDING_ASYNC_FORBIDDEN_SCOPE" | "REACTIVE_WRITE_IN_OWNED_SCOPE" | "ASYNC_STORE_SETTER" | "STORE_WRITE_OUTSIDE_SETTER" | "ACTION_CALLED_IN_OWNED_SCOPE" | "RUN_WITH_DISPOSED_OWNER" | "NO_OWNER_CLEANUP" | "CLEANUP_IN_FORBIDDEN_SCOPE" | "SETTLED_CLEANUP_UNOWNED" | "ON_FLUSH_IN_OWNED_SCOPE" | "SETTLE_WALK_UNINITIALIZED_SOURCE" | "FLUSH_IN_EFFECT_CALLBACK" | "PRIMITIVE_IN_FORBIDDEN_SCOPE" | "PRIMITIVE_IN_EFFECT_CALLBACK" | "NO_OWNER_EFFECT" | "NO_OWNER_BOUNDARY" | "ASYNC_OUTSIDE_LOADING_BOUNDARY" | "LOADING_ON_OUTSIDE_HOLD" | "LOADING_ON_ACCESSOR" | "INVALID_REFRESH_TARGET" | "INVALID_AFFECTS_TARGET" | "MISSING_EFFECT_FN" | "SYNC_NODE_RECEIVED_ASYNC" | "UNTRACKED_READ_AFTER_AWAIT" | "REACTIVITY_HALTED" | "INVARIANT_VIOLATION" | "HUGE_FAN_OUT" | "HUGE_FAN_IN" | "GRAPH_GROWTH" | "HOT_SCOPE_RERUNS" | "HOT_SCOPE_TIME" | "WIDE_SCOPE_DEPS" | "UNSTABLE_MEMO_OUTPUT" | "WASTED_RECOMPUTE" | "ASYNC_WATERFALL" | "HOT_SCOPE_FANOUT" | "SILENT_HOLD" | "LONG_HOLD" | "UNTRACKED_ASYNC_HANDLER" | "ABANDONED_FLIGHTS" | "FALLBACK_FLASH" | "STACKED_HOLDS" | "OPTIMISTIC_REVERTED" | "EFFECT_WRITES_OWN_SOURCE" | "EFFECT_RELAY_TEAR" | "IMMUTABLE_UPDATE_IN_STORE" | "UNSTABLE_LIST_IDENTITY" | "SSR_RENDER_ERROR_CONTAINED" | "SSR_SUBTREE_ABANDONED" | "SSR_STREAM_ABANDONED" | "SSR_CLIENT_CONTENT_MASKED" | "LATE_HEADER_WRITE" | "SERVER_ERROR_SANITIZED" | "SSR_BOUNDARY_WATERFALL" | "SSR_UNDECLARED_LIVE_SOURCE" | "SSR_LIVE_HOLE_LATCHED" | "SERVER_WRITE" | "REVEAL_IN_RENDER_TO_STRING" | "LAZY_ASSET_UNMAPPED" | "PRELOAD_DESCRIPTOR_INVALID" | "HEAD_TAG_INVALID" | "UNRECOGNIZED_INSERT_VALUE" | "UNSCOPED_HOLE_ALLOCATED_IDS" | "LOWERCASE_EVENT_ATTRIBUTE" | "UNCOMMITTED_INPUT_OVERWRITTEN" | "FRAME_MARKER_CORRUPTED" | "DYNAMIC_ASYNC_COMPONENT" | "ASYNC_MEMO_ELEMENT";
|
|
20
|
+
export type DiagnosticKind = "strict-read" | "async" | "write" | "lifecycle" | "owner" | "error" | "perf" | "graph"
|
|
21
|
+
/** Perceived responsiveness: the runtime behaved correctly but the user saw no feedback. */
|
|
22
|
+
| "responsiveness"
|
|
23
|
+
/** Server rendering: boundaries, fragments, the stream, the server-function wire. */
|
|
24
|
+
| "ssr"
|
|
25
|
+
/** The response head: `<head>` tags, preload descriptors, HTTP headers. */
|
|
26
|
+
| "head"
|
|
27
|
+
/** The renderer's insert and attribute positions: a value it has no rendering for, or one it renders other than intended. */
|
|
28
|
+
| "render";
|
|
29
|
+
/** First warning when a change reaches (or a pass tracks) this many edges. */
|
|
13
30
|
export declare const GRAPH_SIZE_WARN_AT = 2000;
|
|
14
|
-
/**
|
|
31
|
+
/** Re-warn once the count has grown by this much since the last warning. */
|
|
15
32
|
export declare const GRAPH_SIZE_WARN_EVERY = 500;
|
|
16
33
|
export interface DiagnosticEvent {
|
|
17
34
|
sequence: number;
|
|
@@ -22,9 +39,35 @@ export interface DiagnosticEvent {
|
|
|
22
39
|
ownerId?: string;
|
|
23
40
|
ownerName?: string;
|
|
24
41
|
nodeName?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Root-first chain of named owners enclosing the subject of the event —
|
|
44
|
+
* component roots as `<Name>`, computations by their `name` option (or
|
|
45
|
+
* the `effect`/`computed` default) — e.g. `["<App>", "<TodoRow>", "effect"]`.
|
|
46
|
+
* Unnamed owners (plain roots) are skipped. Absent when the subject has no
|
|
47
|
+
* named owner at all (a top-level scope, or an unowned primitive — which
|
|
48
|
+
* is usually the finding itself).
|
|
49
|
+
*/
|
|
50
|
+
ownerPath?: string[];
|
|
51
|
+
/**
|
|
52
|
+
* Source location of the innermost located node enclosing the subject
|
|
53
|
+
* (`file:line:col`, root-relative — the compiler's `sourceNames`
|
|
54
|
+
* `locations` kind): the subject's own `loc`, else the nearest owner's up
|
|
55
|
+
* the chain (a component root carries its JSX site). Absent when nothing
|
|
56
|
+
* on the chain was compiled with locations. A host event that sets it
|
|
57
|
+
* keeps it.
|
|
58
|
+
*/
|
|
59
|
+
loc?: string;
|
|
25
60
|
data?: Record<string, unknown>;
|
|
26
61
|
}
|
|
27
|
-
|
|
62
|
+
/**
|
|
63
|
+
* A findings listener. `subject` is the live node the event is about, when
|
|
64
|
+
* the emitter located one — passed BESIDE the serializable event, the way
|
|
65
|
+
* the records channel passes `live` — for an in-process consumer that goes
|
|
66
|
+
* from a finding to the scope (devtools, a console task lookup);
|
|
67
|
+
* `undefined` for an event with no location, or a host event whose owners
|
|
68
|
+
* are not signals' owners.
|
|
69
|
+
*/
|
|
70
|
+
export type DiagnosticListener = (event: DiagnosticEvent, subject: DiagnosticSubject | undefined) => void;
|
|
28
71
|
export interface DiagnosticCapture {
|
|
29
72
|
readonly events: readonly DiagnosticEvent[];
|
|
30
73
|
clear(): void;
|
|
@@ -33,18 +76,372 @@ export interface DiagnosticCapture {
|
|
|
33
76
|
export interface Diagnostics {
|
|
34
77
|
subscribe(listener: DiagnosticListener): () => void;
|
|
35
78
|
capture(): DiagnosticCapture;
|
|
79
|
+
/**
|
|
80
|
+
* Records an event on the channel from outside the reactive core — a host
|
|
81
|
+
* runtime reporting its own findings (hydration mismatches, server render
|
|
82
|
+
* faults) so consumers see one stream. `subject` locates it like the
|
|
83
|
+
* internal sites do; a host whose owners are not signals' owners passes
|
|
84
|
+
* `ownerPath` on the event instead and it is used as-is.
|
|
85
|
+
*/
|
|
86
|
+
emit(event: Omit<DiagnosticEvent, "sequence">, subject?: DiagnosticSubject | null): DiagnosticEvent;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* The core's side of attribution: the slot the engine installs into, and
|
|
90
|
+
* the interaction frame the rendering runtime opens around event dispatch.
|
|
91
|
+
* The engine itself — "why did this run", costs, holds, feedback — is
|
|
92
|
+
* `@solidjs/signals/attribution`, a separate entry so an observe build pays
|
|
93
|
+
* for it only when something imports it; enabling it is what installs.
|
|
94
|
+
*/
|
|
95
|
+
export interface AttributionSlot {
|
|
96
|
+
/**
|
|
97
|
+
* The installed engine, or `null` when none is enabled — the one fact a
|
|
98
|
+
* runtime reads off the slot (`solid-js` opens a `console.createTask` per
|
|
99
|
+
* component only while an engine is there to attribute to it). The
|
|
100
|
+
* object is the engine's hook table, opaque here: the hook contract is
|
|
101
|
+
* between the core and its engine, not public surface.
|
|
102
|
+
*/
|
|
103
|
+
readonly installed: object | null;
|
|
104
|
+
/**
|
|
105
|
+
* Run `fn` as a user interaction's handler: root writes inside stamp it as
|
|
106
|
+
* their origin, and actions/effects/flights it causes carry it. The web
|
|
107
|
+
* runtime wraps every event dispatch in this; custom renderers and test
|
|
108
|
+
* harnesses call it themselves. `fn()` when no engine is installed.
|
|
109
|
+
*/
|
|
110
|
+
withInteraction<T>(ref: InteractionRef, fn: () => T): T;
|
|
111
|
+
/**
|
|
112
|
+
* Run `fn` as a declared unit of work — a router's navigation, described
|
|
113
|
+
* by the parametrized route it matched: root writes inside are attributed
|
|
114
|
+
* to it (under the enclosing interaction, if any), so the hold behind the
|
|
115
|
+
* route's data, the re-runs and the verdicts carry the route's name. Any
|
|
116
|
+
* router calls this around its location write; nothing else is
|
|
117
|
+
* router-specific. `fn()` when no engine is installed.
|
|
118
|
+
*/
|
|
119
|
+
withOrigin<T>(ref: NavigationRef, fn: () => T): T;
|
|
120
|
+
/**
|
|
121
|
+
* The provenance a root write performed now would be stamped with — the
|
|
122
|
+
* interaction whose handler is running, the navigation or effect or action
|
|
123
|
+
* frame open, or inside a recompute the origin of the change that caused
|
|
124
|
+
* it — as the installed engine sees it; `undefined` with no engine, or when
|
|
125
|
+
* nothing is in effect (external). For a runtime recording a fact of its
|
|
126
|
+
* own beside the engine's records: `@solidjs/web` stamps its `"call"`
|
|
127
|
+
* record with this, so a server-function call joins the interaction or
|
|
128
|
+
* navigation it ran for by the identity of the object, not by time.
|
|
129
|
+
*/
|
|
130
|
+
currentOrigin(): ChangeOrigin | undefined;
|
|
131
|
+
/**
|
|
132
|
+
* Stamps a flight (a promise or async iterable a computation will await)
|
|
133
|
+
* with when its work really started, before anything reads it. A route
|
|
134
|
+
* preloader, query cache or `lazy()` calls this on what it hands out (on
|
|
135
|
+
* the wrapper it mints, with the original kickoff time), so a reader that
|
|
136
|
+
* meets it later is judged against the real start: work already running
|
|
137
|
+
* when the previous wait landed is parallel, not a waterfall link. The
|
|
138
|
+
* client engine's `ASYNC_WATERFALL` and the server's
|
|
139
|
+
* `SSR_BOUNDARY_WATERFALL` both read these stamps. Earliest wins. Works
|
|
140
|
+
* with no engine installed. `startedAt` is on the `performance.now()`
|
|
141
|
+
* clock and defaults to now.
|
|
142
|
+
*/
|
|
143
|
+
markFlight(flight: object, startedAt?: number): void;
|
|
144
|
+
/** The earliest start `markFlight` declared for `flight`, if any. */
|
|
145
|
+
flightOrigin(flight: object): number | undefined;
|
|
36
146
|
}
|
|
147
|
+
/**
|
|
148
|
+
* The records delivered on `OBSERVE.records`, by type — each entry
|
|
149
|
+
* `{ event, live }`: the serializable record and the live handle (the node
|
|
150
|
+
* that ran, a thrown error, a request) an in-process consumer may want
|
|
151
|
+
* beside it. This package declares the attribution engine's records here —
|
|
152
|
+
* the engine ships in this package, behind its own entry, and emits on the
|
|
153
|
+
* same channel as every runtime — and the runtimes that emit declare theirs
|
|
154
|
+
* by augmentation, so the union of record types is whatever loaded.
|
|
155
|
+
* `solid-js` augments THIS interface (its `"boundary"` and `"recovery"`
|
|
156
|
+
* records); the runtimes above it — `@solidjs/web`'s `"invocation"`,
|
|
157
|
+
* `"frame"` and `"call"`, a router's — augment `HostRecordTypes`, reached
|
|
158
|
+
* through the `solid-js` re-export, which this interface extends so the
|
|
159
|
+
* channel sees one catalogue.
|
|
160
|
+
*
|
|
161
|
+
* Two interfaces, one augmenter each, by design: TypeScript merges an
|
|
162
|
+
* augmentation into a re-exported interface by following the alias, and
|
|
163
|
+
* two augmentations reaching the same interface through DIFFERENT aliases
|
|
164
|
+
* (`"@solidjs/signals"` from solid-js, `"solid-js"` from web) merge
|
|
165
|
+
* order-dependently — one set is lost. So each layer augments an interface
|
|
166
|
+
* of its own, through one module name.
|
|
167
|
+
*
|
|
168
|
+
* The engine's records (`@solidjs/signals/attribution`; none is emitted
|
|
169
|
+
* until `attribution.enable()`): `live` is the computation the record is
|
|
170
|
+
* about where there is one — the node that ran for `rerun`, `create` and
|
|
171
|
+
* `effect`, the async node for `flight`, the boundary's subtree for
|
|
172
|
+
* `fallback` (when the boundary reported one), the first held root signal
|
|
173
|
+
* for `hold` (the subject the SILENT_HOLD finding names) — and `undefined`
|
|
174
|
+
* for the records with no single subject (`flush`, `interaction`,
|
|
175
|
+
* `navigation`, `graph`). The records are the same objects the engine's
|
|
176
|
+
* ring buffers hold (`attribution.history(type)`), delivered synchronously
|
|
177
|
+
* the moment each is complete — a re-run at recompute end, a hold, a
|
|
178
|
+
* navigation, an interaction when it settles, bottom-up — so a listener
|
|
179
|
+
* runs inside the engine and must not write signals. The timeline records
|
|
180
|
+
* (`create`, `effect`, `flush`, `flight`, `fallback`) and `graph` enter no
|
|
181
|
+
* ring buffer and are built only while `observed(type)`: subscribing is
|
|
182
|
+
* what turns them on. `rerun` is built while something wants it — a
|
|
183
|
+
* listener, an imported fold (`costs`/`feedback`) or the console log; the
|
|
184
|
+
* engine's own checks read the facts, not the record.
|
|
185
|
+
*/
|
|
186
|
+
export interface RecordTypes extends HostRecordTypes {
|
|
187
|
+
rerun: {
|
|
188
|
+
event: RerunEvent;
|
|
189
|
+
live: Computed<any>;
|
|
190
|
+
};
|
|
191
|
+
create: {
|
|
192
|
+
event: CreateEvent;
|
|
193
|
+
live: Computed<any>;
|
|
194
|
+
};
|
|
195
|
+
effect: {
|
|
196
|
+
event: EffectRunEvent;
|
|
197
|
+
live: Computed<any>;
|
|
198
|
+
};
|
|
199
|
+
flush: {
|
|
200
|
+
event: FlushEvent;
|
|
201
|
+
live: undefined;
|
|
202
|
+
};
|
|
203
|
+
flight: {
|
|
204
|
+
event: FlightEvent;
|
|
205
|
+
live: Computed<any>;
|
|
206
|
+
};
|
|
207
|
+
fallback: {
|
|
208
|
+
event: FallbackEvent;
|
|
209
|
+
live: Computed<any> | undefined;
|
|
210
|
+
};
|
|
211
|
+
interaction: {
|
|
212
|
+
event: InteractionEvent;
|
|
213
|
+
live: undefined;
|
|
214
|
+
};
|
|
215
|
+
hold: {
|
|
216
|
+
event: HoldEvent;
|
|
217
|
+
live: Signal<any>;
|
|
218
|
+
};
|
|
219
|
+
navigation: {
|
|
220
|
+
event: NavigationEvent;
|
|
221
|
+
live: undefined;
|
|
222
|
+
};
|
|
223
|
+
graph: {
|
|
224
|
+
event: GraphEvent;
|
|
225
|
+
live: undefined;
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
/** The record types host runtimes declare — see `RecordTypes`. */
|
|
229
|
+
export interface HostRecordTypes {
|
|
230
|
+
}
|
|
231
|
+
export type RecordType = keyof RecordTypes & string;
|
|
232
|
+
export type RecordEvent<K extends RecordType> = RecordTypes[K] extends {
|
|
233
|
+
event: infer E;
|
|
234
|
+
} ? E : never;
|
|
235
|
+
export type RecordLive<K extends RecordType> = RecordTypes[K] extends {
|
|
236
|
+
live: infer L;
|
|
237
|
+
} ? L : never;
|
|
238
|
+
export type RecordListener<K extends RecordType> = (event: RecordEvent<K>, live: RecordLive<K>) => void;
|
|
239
|
+
/**
|
|
240
|
+
* What a `Records.subscribe` asks of the emitter beyond the record itself.
|
|
241
|
+
*/
|
|
242
|
+
export interface RecordSubscribeOptions {
|
|
243
|
+
/**
|
|
244
|
+
* Ask for the record's BODIES: the live handles that cost the emitter
|
|
245
|
+
* something per record to take, and are taken only while a listener of
|
|
246
|
+
* the type has asked — so a consumer that reads ids, statuses and
|
|
247
|
+
* timings (an APM adapter, the performance tracks) never pays for what a
|
|
248
|
+
* body viewer (devtools' network panel) reads. Accepted for any type, the
|
|
249
|
+
* channel being generic; meaningful today for `"call"`, whose
|
|
250
|
+
* `live.request` (a reconstruction of the dispatched request) and
|
|
251
|
+
* `live.response` (an unread clone, a transient double-buffer of the
|
|
252
|
+
* payload) are taken only under it — without it, the transport's own
|
|
253
|
+
* objects. An emitter asks with `observed(type, "bodies")`.
|
|
254
|
+
*/
|
|
255
|
+
bodies?: boolean;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* The records channel — `OBSERVE.records`, on either platform: one place a
|
|
259
|
+
* consumer (an APM adapter's `init()`, devtools, the diagnostics harness)
|
|
260
|
+
* subscribes to the completed, serializable summaries of the things the
|
|
261
|
+
* runtimes did — a `<Loading>` boundary that waited on the server, a
|
|
262
|
+
* server-function execution or call, a frame stream produced or applied,
|
|
263
|
+
* and the attribution engine's: a re-run, a hold, an interaction — each
|
|
264
|
+
* delivered synchronously the moment it is complete, with its live handle
|
|
265
|
+
* passed BESIDE it. Any number of listeners; none can alter what it
|
|
266
|
+
* observes; one that throws is reported and the rest run. The engine's
|
|
267
|
+
* records are declared here and emitted only while the engine
|
|
268
|
+
* (`@solidjs/signals/attribution`, a separate entry the observe build pays
|
|
269
|
+
* for only when imported) is enabled; `observed(type)` is the one gate an
|
|
270
|
+
* emitter of either kind checks before building a record.
|
|
271
|
+
*
|
|
272
|
+
* The object is created once per PROCESS under a registered symbol, so a
|
|
273
|
+
* subscription made before the emitting runtime has loaded, or from a
|
|
274
|
+
* second bundled copy of the core, reaches the same listener set. Absent in
|
|
275
|
+
* prod with the rest of `OBSERVE`.
|
|
276
|
+
*/
|
|
277
|
+
export interface Records {
|
|
278
|
+
/**
|
|
279
|
+
* Deliver `type` records as they complete; returns the unsubscribe. The
|
|
280
|
+
* subscription is the channel's, not any emitter's: it outlives the
|
|
281
|
+
* attribution engine's `enable()`/`disable()` cycles and is dropped only
|
|
282
|
+
* by its own unsubscribe. `options` asks the emitter for more than the
|
|
283
|
+
* record — see `RecordSubscribeOptions`. One entry per listener function:
|
|
284
|
+
* its options are read at its first subscription to the type, a repeat
|
|
285
|
+
* subscription of the same function changes nothing, and either disposer
|
|
286
|
+
* removes it. What an emitter takes is decided once per record from the
|
|
287
|
+
* union of the type's subscribers, so a listener without `bodies` that
|
|
288
|
+
* shares a call with one that asked receives the same `live` — the clone.
|
|
289
|
+
*/
|
|
290
|
+
subscribe<K extends RecordType>(type: K, listener: RecordListener<K>, options?: RecordSubscribeOptions): () => void;
|
|
291
|
+
/**
|
|
292
|
+
* Whether anything is subscribed to `type` — an emitter's pre-check, so
|
|
293
|
+
* a record nobody will hear costs nothing to not build (no clock read).
|
|
294
|
+
*/
|
|
295
|
+
observed(type: RecordType): boolean;
|
|
296
|
+
/**
|
|
297
|
+
* Whether a listener of `type` asked for its bodies
|
|
298
|
+
* (`subscribe(type, listener, { bodies: true })`) — the emitter's
|
|
299
|
+
* pre-check for the live handles that cost something per record to take.
|
|
300
|
+
* `false` while every listener of the type is a plain one, and once the
|
|
301
|
+
* last body-wanting one unsubscribed.
|
|
302
|
+
*/
|
|
303
|
+
observed(type: RecordType, facet: "bodies"): boolean;
|
|
304
|
+
/**
|
|
305
|
+
* Delivers a completed record to `type`'s listeners, synchronously: how a
|
|
306
|
+
* runtime publishes. Snapshot semantics without a snapshot — the listener
|
|
307
|
+
* list is replaced, never mutated, on subscribe/unsubscribe — so a
|
|
308
|
+
* listener unsubscribing mid-delivery neither skips nor double-calls
|
|
309
|
+
* anyone this round, and delivery allocates nothing.
|
|
310
|
+
*/
|
|
311
|
+
emit<K extends RecordType>(type: K, event: RecordEvent<K>, live: RecordLive<K>): void;
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* The server runtime's observe surface — where a server-side consumer
|
|
315
|
+
* installs what only the server has: the trace-context provider slot.
|
|
316
|
+
* Declared EMPTY here and typed by the runtime that owns the surface:
|
|
317
|
+
* `solid-js`'s server entry augments this interface with `trace:
|
|
318
|
+
* ServerTrace`, an interface of its own that `@solidjs/web`'s server
|
|
319
|
+
* entries fill in (`provide`) — so the core never learns that shape and
|
|
320
|
+
* the consumer still finds it on the one `OBSERVE`. One augmenter per
|
|
321
|
+
* interface: see `RecordTypes` for why.
|
|
322
|
+
*
|
|
323
|
+
* The OBJECT behind it is not the core's either: the core has one artifact
|
|
324
|
+
* per tier for both platforms, and the client would carry it for nothing.
|
|
325
|
+
* `solid-js`'s server entry replaces this empty literal with the
|
|
326
|
+
* process-wide slot the moment it evaluates (see `serverSlots` in
|
|
327
|
+
* solid-js/src/server/observe.ts), so a consumer that imports only
|
|
328
|
+
* `solid-js` can provide before the web runtime that reads it has loaded,
|
|
329
|
+
* and from a second copy when a host bundles one. On the client this stays
|
|
330
|
+
* `{}`.
|
|
331
|
+
*/
|
|
332
|
+
export interface ServerObserve {
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* The observe tier: the structured channel and the attribution wiring —
|
|
336
|
+
* everything a production observability consumer needs, and nothing that
|
|
337
|
+
* assumes a developer at a console. Present in dev and observe builds
|
|
338
|
+
* (`__OBSERVE__`); `undefined` in prod.
|
|
339
|
+
*/
|
|
340
|
+
export interface Observe {
|
|
341
|
+
diagnostics: Diagnostics;
|
|
342
|
+
/** Completed records from the runtimes, by type — see `Records`. */
|
|
343
|
+
records: Records;
|
|
344
|
+
/** The attribution hook slot and interaction frame — see `AttributionSlot`. */
|
|
345
|
+
attribution: AttributionSlot;
|
|
346
|
+
/** The server runtime's surface — see `ServerObserve`. */
|
|
347
|
+
server: ServerObserve;
|
|
348
|
+
/**
|
|
349
|
+
* Marks `owner`'s subtree as the observer's own. A consumer that renders
|
|
350
|
+
* inside the app it watches — an APM adapter's panel, devtools — would
|
|
351
|
+
* otherwise see its own effects, stores and holds reported as findings about
|
|
352
|
+
* the app. Under an excluded owner: diagnostics whose subject sits in the
|
|
353
|
+
* subtree are neither delivered nor reported (the entry is still built, so
|
|
354
|
+
* a site that throws its message still throws), and the attribution engine
|
|
355
|
+
* records no runs for its computations. Mark the root as it is created
|
|
356
|
+
* (`createRoot(() => { OBSERVE.exclude(getOwner()!); … })`); the signals
|
|
357
|
+
* and stores created under it are excluded subjects wherever their writes
|
|
358
|
+
* come from (a click handler, an adapter callback), so writes need no
|
|
359
|
+
* `runWithOwner` — and must not use one: a write under an owner is a write
|
|
360
|
+
* in an owned scope (REACTIVE_WRITE_IN_OWNED_SCOPE). One mark per owner:
|
|
361
|
+
* a later `exclude` or `include` on the same owner replaces it, and
|
|
362
|
+
* `include` re-admits a subtree beneath it.
|
|
363
|
+
*/
|
|
364
|
+
exclude(owner: Owner): void;
|
|
365
|
+
/**
|
|
366
|
+
* Marks `owner`'s subtree as the app's again, beneath an excluded owner.
|
|
367
|
+
* The verdict for a subject is the NEAREST marked ancestor's (the subject
|
|
368
|
+
* itself included): an `include` under an `exclude` re-admits that
|
|
369
|
+
* subtree, an `exclude` under an `include` excludes it again, and the
|
|
370
|
+
* markers nest to any depth. For an observer that WRAPS the app it
|
|
371
|
+
* watches — a toolbar rendering `<DevToolbar><App/></DevToolbar>` — so
|
|
372
|
+
* the toolbar's own root is excluded and the app's root, created under
|
|
373
|
+
* it, is included back. Mark the root as it is created, as with
|
|
374
|
+
* `exclude`: the attribution engine caches each node's verdict the first
|
|
375
|
+
* time it asks and keeps it for the node's life, so a mark set after a
|
|
376
|
+
* node was judged does not reach it. Alone — with no excluded ancestor —
|
|
377
|
+
* an included owner is what it already was. One mark per owner: a later
|
|
378
|
+
* `exclude` or `include` on the same owner replaces it.
|
|
379
|
+
*/
|
|
380
|
+
include(owner: Owner): void;
|
|
381
|
+
/**
|
|
382
|
+
* Whether `subject` sits under an excluded owner (itself included) — the
|
|
383
|
+
* nearest marked ancestor on its owner chain answers, with the one mark
|
|
384
|
+
* (the latest `exclude`/`include`) that owner carries.
|
|
385
|
+
*/
|
|
386
|
+
isExcluded(subject: DiagnosticSubject | null | undefined): boolean;
|
|
387
|
+
/**
|
|
388
|
+
* Root-first names of the owners enclosing `subject` (inclusive when the
|
|
389
|
+
* subject is itself a named owner) — component roots as `<Name>`,
|
|
390
|
+
* computations by their `name` option — the labels every finding and
|
|
391
|
+
* record carries as `ownerPath` (`["<App>", "<TodoRow>", "label"]`), from
|
|
392
|
+
* the one walk that stamps them, so a consumer locating a live node it
|
|
393
|
+
* was handed (`live`, a diagnostic's `subject`) reads the same path.
|
|
394
|
+
* Signals hop to their registering owner; unnamed owners are skipped;
|
|
395
|
+
* `undefined` when nothing on the chain is named. Names exist only in the
|
|
396
|
+
* observing tiers, which is why the walk lives here and not on the prod
|
|
397
|
+
* surface.
|
|
398
|
+
*/
|
|
399
|
+
ownerPath(subject: DiagnosticSubject | null | undefined): string[] | undefined;
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* The dev tier: devtools hooks, graph traversal, and the console face of the
|
|
403
|
+
* diagnostics channel. Present only in dev builds (`__DEV__`).
|
|
404
|
+
*/
|
|
37
405
|
export interface Dev {
|
|
38
406
|
hooks: DevHooks;
|
|
39
|
-
diagnostics: Diagnostics;
|
|
40
|
-
/** "Why did this run" re-run attribution — see attribution.ts. */
|
|
41
|
-
attribution: Attribution;
|
|
42
407
|
getChildren: typeof getChildren;
|
|
43
408
|
getSignals: typeof getSignals;
|
|
44
409
|
getParent: typeof getParent;
|
|
45
410
|
getSources: typeof getSources;
|
|
46
411
|
getObservers: typeof getObservers;
|
|
412
|
+
/** Console face of an emitted event — see `reportDiagnostic`. */
|
|
413
|
+
report(entry: DiagnosticEvent): void;
|
|
414
|
+
/**
|
|
415
|
+
* The URL of `code`'s page in the docs — what the finding means and how
|
|
416
|
+
* to fix it, one page per code
|
|
417
|
+
* (`https://v2.solidjs.com/reference/solid-js/diagnostics/<slug>`, slug =
|
|
418
|
+
* the code lowercased with `-` for `_`). The one place the URL is built:
|
|
419
|
+
* the console footer prints it and the performance tracks' Insights link
|
|
420
|
+
* (`learnMoreUrl`) reads it, so both name the same page. Dev-tier: it is
|
|
421
|
+
* guidance for a developer, and a URL string on a retained object is a
|
|
422
|
+
* cost every observe build would pay.
|
|
423
|
+
*/
|
|
424
|
+
guideUrl(code: DiagnosticCode): string;
|
|
47
425
|
}
|
|
426
|
+
/**
|
|
427
|
+
* Registers the console footer appended to the first console report of
|
|
428
|
+
* each diagnostic code — a discovery pointer to deeper guidance. Reported
|
|
429
|
+
* events carry it as trailing lines of the same console entry; events that
|
|
430
|
+
* surface as a thrown error instead get it as a follow-up line. Returning
|
|
431
|
+
* undefined for an event suppresses the footer. Passing undefined
|
|
432
|
+
* unregisters and resets the once-per-code memory.
|
|
433
|
+
*
|
|
434
|
+
* @internal A seam for `solid-js`, which owns the repair skill the footer
|
|
435
|
+
* names and installs it from both of its entries; not part of `DEV`. No-op
|
|
436
|
+
* outside dev builds, where nothing reports to the console.
|
|
437
|
+
*/
|
|
438
|
+
export declare function setConsoleFooter(footer: ((event: DiagnosticEvent) => string | undefined) | undefined): void;
|
|
439
|
+
export declare const OBSERVE: Observe;
|
|
440
|
+
export declare function isExcluded(subject: DiagnosticSubject | null | undefined): boolean;
|
|
441
|
+
/** For engines that cache the verdict per node: is anything excluded at all? */
|
|
442
|
+
export declare function anyExcluded(): boolean;
|
|
443
|
+
/** Was `entry` built for an excluded subject? Once-per-key reporters must not spend their slot on it. */
|
|
444
|
+
export declare function isSuppressed(entry: DiagnosticEvent): boolean;
|
|
48
445
|
export declare const DEV: Dev;
|
|
49
446
|
/**
|
|
50
447
|
* Dev-mode internal consistency check. A failure means the reactive system
|
|
@@ -54,28 +451,118 @@ export declare const DEV: Dev;
|
|
|
54
451
|
* dev builds so user apps degrade instead of crashing.
|
|
55
452
|
*/
|
|
56
453
|
export declare function assertInvariant(condition: boolean, name: string, message: string): void;
|
|
57
|
-
|
|
454
|
+
/** Anything a diagnostic can be about: an owner (root, computed, effect) or a signal. */
|
|
455
|
+
export type DiagnosticSubject = Owner | Signal<any> | Computed<any>;
|
|
456
|
+
/**
|
|
457
|
+
* Root-first names of the owners enclosing `subject` (inclusive when the
|
|
458
|
+
* subject is itself a named owner). Signals hop to their registering owner
|
|
459
|
+
* (`_owner`, set by registerGraph). Unnamed owners are skipped so the path
|
|
460
|
+
* reads as the component tree plus the scope: `<App> › <TodoRow> › effect`.
|
|
461
|
+
* Public as `OBSERVE.ownerPath`; the core's own sites import it directly.
|
|
462
|
+
*/
|
|
463
|
+
export declare function ownerPath(subject: DiagnosticSubject | null | undefined): string[] | undefined;
|
|
464
|
+
/**
|
|
465
|
+
* Records a diagnostic on the structured channel (listeners, captures) and
|
|
466
|
+
* returns the entry. `subject` locates it: the current reactive `context` by
|
|
467
|
+
* default (right for the synchronous rule checks — they fire inside the
|
|
468
|
+
* scope that misbehaved); pass the node for scheduler-time findings whose
|
|
469
|
+
* ambient context is the flush, or `null` for events that have no location
|
|
470
|
+
* by nature. An `ownerPath` (or `loc`) already on the event wins over the
|
|
471
|
+
* subject walk (hosts whose owners are not signals' owners compute their
|
|
472
|
+
* own). Console output is a separate, dev-tier step — see `reportDiagnostic`.
|
|
473
|
+
*/
|
|
474
|
+
export declare function emitDiagnostic(event: Omit<DiagnosticEvent, "sequence">, subject?: DiagnosticSubject | null | undefined): DiagnosticEvent;
|
|
475
|
+
/**
|
|
476
|
+
* The locating lines of a console report: `\n in <App> › <TodoRow> › effect`
|
|
477
|
+
* (the owner path) and `\n at src/App.tsx:18:3` (see `locationLine`), each
|
|
478
|
+
* when the entry carries it; `""` when it carries neither. Shared by
|
|
479
|
+
* `reportDiagnostic` and the sites that print their own console entry (the
|
|
480
|
+
* halt, which logs its cause beside the message).
|
|
481
|
+
*/
|
|
482
|
+
export declare function locationLines(entry: DiagnosticEvent): string;
|
|
483
|
+
/**
|
|
484
|
+
* The console face of a diagnostic — ONE entry per finding: the message, the
|
|
485
|
+
* owner path (`in <App> › <TodoRow> › effect`) so a human can locate it, the
|
|
486
|
+
* source location (`at src/App.tsx:18:3` — see `locationLine`) when a node on
|
|
487
|
+
* the chain was compiled with one, the once-per-code footer as trailing
|
|
488
|
+
* lines, and — when the subject is a binding effect the rendering runtime
|
|
489
|
+
* tagged — the element it writes, as a second console argument (hover
|
|
490
|
+
* highlights it, click jumps to Elements).
|
|
491
|
+
* Severity picks the console method. Call sites report the entry
|
|
492
|
+
* `emitDiagnostic` returned so the structured and console channels never
|
|
493
|
+
* disagree. Dev-tier: in an observe build this is a no-op, so wiring paths
|
|
494
|
+
* that both emit and report (graph-size warnings) reach the channel only —
|
|
495
|
+
* production observability never writes to the console.
|
|
496
|
+
*/
|
|
497
|
+
export declare function reportDiagnostic(entry: DiagnosticEvent): void;
|
|
58
498
|
/**
|
|
59
499
|
* Shared strict-read diagnostics for core read() and the store proxy traps.
|
|
60
500
|
* Single source for the message text — the #2897 safeguard parity between
|
|
61
501
|
* memos and stores is exactly these firing identically from both paths.
|
|
62
502
|
*/
|
|
63
|
-
export declare function throwPendingUntrackedRead(strictReadLabel: string, fields?: Partial<Omit<DiagnosticEvent, "sequence" | "data">>): never;
|
|
64
|
-
export declare function warnStrictReadUntracked(strictReadLabel: string, fields?: Partial<Omit<DiagnosticEvent, "sequence">>): void;
|
|
503
|
+
export declare function throwPendingUntrackedRead(strictReadLabel: string, fields?: Partial<Omit<DiagnosticEvent, "sequence" | "data" | "ownerPath">>): never;
|
|
504
|
+
export declare function warnStrictReadUntracked(strictReadLabel: string, fields?: Partial<Omit<DiagnosticEvent, "sequence" | "ownerPath">>): void;
|
|
505
|
+
/**
|
|
506
|
+
* Observe-tier: stamp a signal with its creating owner so `ownerPath` can
|
|
507
|
+
* locate signal subjects. The per-owner `_signals` list and the devtools
|
|
508
|
+
* `onGraph` hook are dev-tier — the observe build pays one property write.
|
|
509
|
+
*/
|
|
65
510
|
export declare function registerGraph(value: any, owner: Owner | null): void;
|
|
66
511
|
export declare function clearSignals(node: Owner): void;
|
|
512
|
+
export declare function registerRoot(owner: Owner): void;
|
|
513
|
+
export declare function unregisterRoot(owner: Owner): void;
|
|
514
|
+
/**
|
|
515
|
+
* The live top-level roots, for a walk of the owner tree (the engine's
|
|
516
|
+
* `graphSize`): dead refs are dropped as they are met. Empty in prod.
|
|
517
|
+
*/
|
|
518
|
+
export declare function liveRootOwners(): Owner[];
|
|
67
519
|
export declare function getChildren(owner: Owner): Owner[];
|
|
68
520
|
export declare function getSignals(owner: Owner): any[];
|
|
69
521
|
export declare function getParent(owner: Owner): Owner | null;
|
|
70
522
|
export declare function getSources(computation: Computed<any>): (Signal<any> | Computed<any>)[];
|
|
71
523
|
export declare function getObservers(node: Signal<any> | Computed<any>): Computed<any>[];
|
|
72
524
|
/**
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
|
|
525
|
+
* The root invalidation a HUGE_FAN_OUT finding was priced on, when the
|
|
526
|
+
* attribution engine is the one reporting it: a signal/store write, a
|
|
527
|
+
* `refresh()`, or an async landing. The always-on core check counts the
|
|
528
|
+
* notify walk of any change and cannot tell — it reports no `write`.
|
|
529
|
+
*/
|
|
530
|
+
export type FanOutWrite = "write" | "refresh" | "async";
|
|
531
|
+
/**
|
|
532
|
+
* Observe-tier: a committed change on `node` is about to re-run `count`
|
|
533
|
+
* subscribers. Two reporters, one finding, one dedupe: the core counts the
|
|
534
|
+
* notify walk in `insertSubs` as it goes (fan-out costs exactly one local
|
|
535
|
+
* increment in a loop that already visits every edge, and nothing at link
|
|
536
|
+
* time) and fires from GRAPH_SIZE_WARN_AT up, always-on wherever the
|
|
537
|
+
* channel exists — a graph-size pathology should surface without asking.
|
|
538
|
+
* The attribution engine, while enabled, reports the same code from its
|
|
539
|
+
* lower `fanOut` threshold (default 250) on the root writes it stamps, with
|
|
540
|
+
* the write kind it knows, and hands over to the core at
|
|
541
|
+
* GRAPH_SIZE_WARN_AT so one change never carries two findings. Both fire on
|
|
542
|
+
* the write rather than the link: a fan-out that is never written costs
|
|
543
|
+
* nothing, and one that is re-runs every subscriber this flush. Once per
|
|
544
|
+
* node, re-warning only once the count has grown by GRAPH_SIZE_WARN_EVERY.
|
|
545
|
+
*/
|
|
546
|
+
export declare function noteFanOut(node: Signal<any> | Computed<any>, count: number, write?: FanOutWrite): void;
|
|
547
|
+
/**
|
|
548
|
+
* Observe-tier: a recompute pass of `node` tracked `count` distinct sources
|
|
549
|
+
* (its trimmed dep list, walked once at the end of the pass — see recompute;
|
|
550
|
+
* no per-link work, no pass bracket). Fires from GRAPH_SIZE_WARN_AT up.
|
|
551
|
+
*/
|
|
552
|
+
export declare function noteFanIn(node: Computed<any>, count: number): void;
|
|
553
|
+
/**
|
|
554
|
+
* Dev-only: attribute reads that run after an `await` inside an async compute.
|
|
555
|
+
* JS has no async context, so a native-promise flight is consumed by a uniquely
|
|
556
|
+
* named async function instead of `.then`; V8's async stack traces then carry a
|
|
557
|
+
* `__solidAsyncCompute_<id>` frame on every read in the compute's continuation.
|
|
558
|
+
* `await` on a native promise settles on the same tick as `.then`, so dev and
|
|
559
|
+
* prod timing match. Other thenables, and engines without async frames
|
|
560
|
+
* (Firefox, Safari), are left alone and never warn.
|
|
561
|
+
*/
|
|
562
|
+
export declare let asyncTailFlights: number;
|
|
563
|
+
export declare function watchAsyncTail<T>(el: Computed<T>, flight: PromiseLike<T>): PromiseLike<T>;
|
|
564
|
+
/**
|
|
565
|
+
* `dep` is the node a tracked read would have linked (undefined when a store key
|
|
566
|
+
* was never tracked); `holder`/`key` identify the read for once-only reporting.
|
|
78
567
|
*/
|
|
79
|
-
export declare function
|
|
80
|
-
/** DEV-only: drop live edge counts when a link is removed. */
|
|
81
|
-
export declare function unnoteGraphLink(link: Link): void;
|
|
568
|
+
export declare function checkPostAwaitRead(dep: object | undefined, holder: object, key: PropertyKey | undefined, nodeName: string | undefined, throwsPending: boolean): void;
|
|
@@ -5,7 +5,7 @@ export interface Effect<T> extends Computed<T>, Owner {
|
|
|
5
5
|
_modified: boolean;
|
|
6
6
|
_prevValue: T | undefined;
|
|
7
7
|
_type: number;
|
|
8
|
-
_boundRunEffect?: () => void;
|
|
8
|
+
_boundRunEffect?: (type: number) => void;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* Effects are the leaf nodes of our reactive graph. When their sources change, they are
|