@solidjs/signals 2.0.0-rc.5 → 2.0.0-rc.6

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.
@@ -34,6 +34,16 @@ export interface StoreNextFamily {
34
34
  * landing under an active override. Dead members prune lazily at each
35
35
  * landing (retainingTransition). */
36
36
  rt?: Set<any>;
37
+ /** Flight-owned transaction (#3146): declared when a truth-flight
38
+ * registers (the ask's transaction — created by the flight's own pending
39
+ * throw when none was ambient, the causing write's when one was), renewed
40
+ * per settle event once the previous reveal committed. Bare optimistic
41
+ * writes and landings route into it BY DECLARATION; the transitionBlocked
42
+ * store-half checks it for ownership instead of reconstructing it from
43
+ * `_optimisticStores` membership. null = no flight declared one (sync
44
+ * derive, or a loading-window flight — the loading rail is
45
+ * transaction-invisible, #2933). */
46
+ ft?: any;
37
47
  /** Normalized row-key fn (same resolution as the projection channels:
38
48
  * `options.key`, "id" default, null = unkeyed). The staged-landing walk
39
49
  * reads it: key-matched rows keep their proxy identity across a fold. */
@@ -36,6 +36,17 @@ export interface AttributionHooks {
36
36
  write(el: Signal<any> | Computed<any>, prev: unknown, value: unknown): void;
37
37
  /** refresh() invalidated this node (self-invalidation, no dep changed). */
38
38
  refreshed(el: Computed<any>): void;
39
+ /**
40
+ * A new async flight entered the system (`_inFlight` was just assigned
41
+ * during a recompute of `el`). Always fired inside the owning recompute —
42
+ * both call paths (core's recompute and the projection self-registration)
43
+ * run within one — so the engine can read the current frame stack to link
44
+ * the flight to the change that caused it (waterfall chaining). `flight`
45
+ * is the registered thenable/iterable itself: the engine keys a first-seen
46
+ * origin registry on its identity, so shared and preloader-marked promises
47
+ * carry their true start time instead of the moment the graph saw them.
48
+ */
49
+ flightStart(el: Computed<any>, flight: object): void;
39
50
  /** An async landing is about to apply its value (before any branch). */
40
51
  asyncStart(el: Computed<any>): void;
41
52
  /**
@@ -143,6 +143,24 @@ export interface AttributionOptions {
143
143
  * disables.
144
144
  */
145
145
  wideWrites?: number | false;
146
+ /**
147
+ * Async-waterfall warning: emit a diagnostic when an async flight that
148
+ * could only start after an upstream flight resolved (its recompute's
149
+ * cause chain reaches the upstream's async landing, and its origin
150
+ * post-dates that landing) forms a sequential chain of 2+ flights, each
151
+ * of which took at least `minFlightMs` (default 50ms). The duration gate
152
+ * is one safety valve for what the graph cannot see: a settled
153
+ * preload/cache hit resolves fast and never warns. In-flight preloads are
154
+ * absolved by origin: `markFlight()` stamps (and first-seen identity)
155
+ * prove work predated the upstream landing — parallel, not sequential.
156
+ * Chains of 2 emit at `info` severity, structured channel only (a
157
+ * dependent fetch is sometimes intrinsic, and unmarked external preloads
158
+ * are invisible); 3+ escalate to `warn` with console output. `false`
159
+ * disables.
160
+ */
161
+ waterfalls?: {
162
+ minFlightMs: number;
163
+ } | false;
146
164
  }
147
165
  export interface ScopeCost {
148
166
  name: string;
@@ -186,6 +204,36 @@ export interface Attribution {
186
204
  scopes: ScopeCost[];
187
205
  writes: WriteCost[];
188
206
  };
207
+ /**
208
+ * Every graph-provable sequential flight chain observed since enable()
209
+ * (ring-buffered like history()). Facts, not verdicts: chains are recorded
210
+ * regardless of the duration gate — the ASYNC_WATERFALL diagnostic is the
211
+ * thresholded view of the same data.
212
+ */
213
+ waterfalls(): readonly WaterfallRecord[];
214
+ /**
215
+ * Cooperative preload declaration: stamp a flight object (promise or async
216
+ * iterable) with its true kickoff time BEFORE the reactive graph sees it.
217
+ * A route preloader or query cache calls this on the promise it hands out
218
+ * (on the WRAPPER it mints, with the original kickoff time — wrapping
219
+ * defeats identity tracking otherwise); any dependent that later awaits it
220
+ * is then judged against the real start — work already in the air when its
221
+ * upstream landed is parallel, never a waterfall link. Callable while
222
+ * attribution is disabled (marks made at navigation time must survive a
223
+ * later enable()). Dev-only, like the whole DEV surface.
224
+ */
225
+ markFlight(flight: object, startedAt?: number): void;
189
226
  format: typeof formatRerun;
190
227
  }
228
+ /** One landed flight: its node name, wall duration, and upstream chain. */
229
+ export interface FlightLink {
230
+ name: string;
231
+ ms: number;
232
+ }
233
+ export interface WaterfallRecord {
234
+ /** Sequential flights, oldest first, ending at the flight that landed. */
235
+ chain: FlightLink[];
236
+ /** Summed wall time of the chain — the serialized cost. */
237
+ sequentialMs: number;
238
+ }
191
239
  export declare const attribution: Attribution;
@@ -6,8 +6,14 @@ export interface DevHooks {
6
6
  onUpdate?: () => void;
7
7
  onStoreNodeUpdate?: (state: any, property: PropertyKey, value: any, prev: any) => void;
8
8
  }
9
- export type DiagnosticSeverity = "warn" | "error";
10
- 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" | "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";
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";
11
17
  export type DiagnosticKind = "strict-read" | "async" | "write" | "lifecycle" | "owner" | "error" | "perf" | "graph";
12
18
  /** First warning when a node's live edge count reaches this size. */
13
19
  export declare const GRAPH_SIZE_WARN_AT = 2000;
@@ -209,6 +209,11 @@ export declare const globalQueue: GlobalQueue;
209
209
  */
210
210
  export declare function flush(): void;
211
211
  export declare function flush<T>(fn: () => T): T;
212
+ /** A fresh, unentered transaction (#3146): the optimistic store's truth
213
+ * flight DECLARES an owned transaction instead of relying on whatever the
214
+ * ambient adoption machinery stamped on its firewall. Activate it with
215
+ * initTransition; it is a plain batch until then. */
216
+ export declare function createTransition(): Transition;
212
217
  export declare function currentTransition(transition: Transition): Transition;
213
218
  export declare function setActiveTransition(transition: Transition | null): void;
214
219
  export declare function runInTransition<T>(transition: Transition, fn: () => T): T;
@@ -365,17 +365,6 @@ export declare function createMemo<T>(compute: ComputeFunction<undefined | NoInf
365
365
  * @description https://docs.solidjs.com/reference/basic-reactivity/create-effect
366
366
  */
367
367
  export declare function createEffect<T>(compute: ComputeFunction<undefined | NoInfer<T>, T>, effectFn: EffectFunction<NoInfer<T>, T> | EffectBundle<NoInfer<T>, T>, options?: EffectOptions): void;
368
- /**
369
- * @deprecated `createEffect(compute)` (single argument) is no longer supported.
370
- * Pass a separate effect function as the second argument:
371
- * `createEffect(compute, effect)`. See [MISSING_EFFECT_FN].
372
- *
373
- * - For a side effect that reacts to changes, split the work:
374
- * `createEffect(() => signal(), value => doWork(value))`.
375
- * - For a derived value, use `createMemo(() => signal())`.
376
- * - For a one-shot side effect at construction time, just call the function.
377
- */
378
- export declare function createEffect<T>(compute: ComputeFunction<undefined | NoInfer<T>, T>): never;
379
368
  /**
380
369
  * Creates a reactive computation that runs during the render phase as DOM elements
381
370
  * are created and updated but not necessarily connected.
@@ -34,6 +34,16 @@ export interface StoreNextFamily {
34
34
  * landing under an active override. Dead members prune lazily at each
35
35
  * landing (retainingTransition). */
36
36
  rt?: Set<any>;
37
+ /** Flight-owned transaction (#3146): declared when a truth-flight
38
+ * registers (the ask's transaction — created by the flight's own pending
39
+ * throw when none was ambient, the causing write's when one was), renewed
40
+ * per settle event once the previous reveal committed. Bare optimistic
41
+ * writes and landings route into it BY DECLARATION; the transitionBlocked
42
+ * store-half checks it for ownership instead of reconstructing it from
43
+ * `_optimisticStores` membership. null = no flight declared one (sync
44
+ * derive, or a loading-window flight — the loading rail is
45
+ * transaction-invisible, #2933). */
46
+ ft?: any;
37
47
  /** Normalized row-key fn (same resolution as the projection channels:
38
48
  * `options.key`, "id" default, null = unkeyed). The staged-landing walk
39
49
  * reads it: key-matched rows keep their proxy identity across a fold. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidjs/signals",
3
- "version": "2.0.0-rc.5",
3
+ "version": "2.0.0-rc.6",
4
4
  "description": "Solid's reactive primitives: signals, memos, effects, stores, and async-aware computations.",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",