signalium 2.4.0 → 3.0.1

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.
Files changed (131) hide show
  1. package/CHANGELOG.md +201 -0
  2. package/dist/cjs/development/component-shared-Cug2Y5YZ.js +33 -0
  3. package/dist/cjs/development/component-shared-Cug2Y5YZ.js.map +1 -0
  4. package/dist/cjs/development/{debug-ouT0N0E4.js → debug-C46WDxhL.js} +47 -195
  5. package/dist/cjs/development/debug-C46WDxhL.js.map +1 -0
  6. package/dist/cjs/development/debug.js +1 -1
  7. package/dist/cjs/development/index.js +3 -2
  8. package/dist/cjs/development/index.js.map +1 -1
  9. package/dist/cjs/development/react/index.js +255 -87
  10. package/dist/cjs/development/react/index.js.map +1 -1
  11. package/dist/cjs/development/react/index.server.js +14 -0
  12. package/dist/cjs/development/react/index.server.js.map +1 -0
  13. package/dist/cjs/development/react/server.js +37 -0
  14. package/dist/cjs/development/react/server.js.map +1 -0
  15. package/dist/cjs/development/{snapshot-BPJ-qw6l.js → snapshot-BfP4w3lC.js} +17 -7
  16. package/dist/cjs/development/snapshot-BfP4w3lC.js.map +1 -0
  17. package/dist/cjs/development/transform/index.js +5 -1
  18. package/dist/cjs/development/transform/index.js.map +1 -1
  19. package/dist/cjs/development/utils.js +6 -6
  20. package/dist/cjs/development/utils.js.map +1 -1
  21. package/dist/cjs/production/component-shared-D0J85PUi.js +33 -0
  22. package/dist/cjs/production/component-shared-D0J85PUi.js.map +1 -0
  23. package/dist/cjs/production/{contexts-DtQMtXO7.js → contexts-CM3QLfV8.js} +47 -198
  24. package/dist/cjs/production/contexts-CM3QLfV8.js.map +1 -0
  25. package/dist/cjs/production/debug.js +1 -1
  26. package/dist/cjs/production/index.js +3 -2
  27. package/dist/cjs/production/index.js.map +1 -1
  28. package/dist/cjs/production/react/index.js +241 -89
  29. package/dist/cjs/production/react/index.js.map +1 -1
  30. package/dist/cjs/production/react/index.server.js +14 -0
  31. package/dist/cjs/production/react/index.server.js.map +1 -0
  32. package/dist/cjs/production/react/server.js +37 -0
  33. package/dist/cjs/production/react/server.js.map +1 -0
  34. package/dist/cjs/production/{snapshot-Dw62eSpw.js → snapshot-DnzyLNij.js} +17 -7
  35. package/dist/cjs/production/snapshot-DnzyLNij.js.map +1 -0
  36. package/dist/cjs/production/transform/index.js +5 -1
  37. package/dist/cjs/production/transform/index.js.map +1 -1
  38. package/dist/cjs/production/utils.js +6 -6
  39. package/dist/cjs/production/utils.js.map +1 -1
  40. package/dist/esm/development/component-shared-CLSmdnGU.js +34 -0
  41. package/dist/esm/development/component-shared-CLSmdnGU.js.map +1 -0
  42. package/dist/esm/development/{debug-DaK9qsbI.js → debug-BTLbgTPK.js} +79 -227
  43. package/dist/esm/development/debug-BTLbgTPK.js.map +1 -0
  44. package/dist/esm/development/debug.js +9 -9
  45. package/dist/esm/development/index.js +14 -13
  46. package/dist/esm/development/react/index.js +229 -77
  47. package/dist/esm/development/react/index.js.map +1 -1
  48. package/dist/esm/development/react/index.server.js +14 -0
  49. package/dist/esm/development/react/index.server.js.map +1 -0
  50. package/dist/esm/development/react/server.js +20 -0
  51. package/dist/esm/development/react/server.js.map +1 -0
  52. package/dist/esm/development/{snapshot-D8ZJEbwO.js → snapshot-DbLBnoC8.js} +17 -7
  53. package/dist/esm/development/snapshot-DbLBnoC8.js.map +1 -0
  54. package/dist/esm/development/transform/index.js +5 -1
  55. package/dist/esm/development/transform/index.js.map +1 -1
  56. package/dist/esm/development/utils.js +11 -11
  57. package/dist/esm/development/utils.js.map +1 -1
  58. package/dist/esm/index.d.ts +2 -2
  59. package/dist/esm/index.d.ts.map +1 -1
  60. package/dist/esm/internals/async.d.ts +3 -3
  61. package/dist/esm/internals/async.d.ts.map +1 -1
  62. package/dist/esm/internals/contexts.d.ts +10 -6
  63. package/dist/esm/internals/contexts.d.ts.map +1 -1
  64. package/dist/esm/internals/core-api.d.ts +2 -2
  65. package/dist/esm/internals/core-api.d.ts.map +1 -1
  66. package/dist/esm/internals/get.d.ts.map +1 -1
  67. package/dist/esm/internals/reactive.d.ts +3 -9
  68. package/dist/esm/internals/reactive.d.ts.map +1 -1
  69. package/dist/esm/internals/scheduling.d.ts +0 -2
  70. package/dist/esm/internals/scheduling.d.ts.map +1 -1
  71. package/dist/esm/internals/utils/snapshot.d.ts +6 -1
  72. package/dist/esm/internals/utils/snapshot.d.ts.map +1 -1
  73. package/dist/esm/internals/watch.d.ts +3 -4
  74. package/dist/esm/internals/watch.d.ts.map +1 -1
  75. package/dist/esm/production/component-shared-Dva0S5e3.js +34 -0
  76. package/dist/esm/production/component-shared-Dva0S5e3.js.map +1 -0
  77. package/dist/esm/production/{contexts-US_h2nBi.js → contexts-FxCndlvf.js} +71 -222
  78. package/dist/esm/production/contexts-FxCndlvf.js.map +1 -0
  79. package/dist/esm/production/debug.js +1 -1
  80. package/dist/esm/production/index.js +14 -13
  81. package/dist/esm/production/react/index.js +216 -80
  82. package/dist/esm/production/react/index.js.map +1 -1
  83. package/dist/esm/production/react/index.server.js +14 -0
  84. package/dist/esm/production/react/index.server.js.map +1 -0
  85. package/dist/esm/production/react/server.js +20 -0
  86. package/dist/esm/production/react/server.js.map +1 -0
  87. package/dist/esm/production/{snapshot-CfJGJCvW.js → snapshot-DzqbjLXg.js} +17 -7
  88. package/dist/esm/production/snapshot-DzqbjLXg.js.map +1 -0
  89. package/dist/esm/production/transform/index.js +5 -1
  90. package/dist/esm/production/transform/index.js.map +1 -1
  91. package/dist/esm/production/utils.js +11 -11
  92. package/dist/esm/production/utils.js.map +1 -1
  93. package/dist/esm/react/async-component.d.ts +42 -0
  94. package/dist/esm/react/async-component.d.ts.map +1 -0
  95. package/dist/esm/react/component-server.d.ts +4 -0
  96. package/dist/esm/react/component-server.d.ts.map +1 -0
  97. package/dist/esm/react/component-shared.d.ts +21 -0
  98. package/dist/esm/react/component-shared.d.ts.map +1 -0
  99. package/dist/esm/react/component.d.ts +5 -1
  100. package/dist/esm/react/component.d.ts.map +1 -1
  101. package/dist/esm/react/index.d.ts +3 -4
  102. package/dist/esm/react/index.d.ts.map +1 -1
  103. package/dist/esm/react/index.server.d.ts +8 -0
  104. package/dist/esm/react/index.server.d.ts.map +1 -0
  105. package/dist/esm/react/pause-signals-context.d.ts +18 -0
  106. package/dist/esm/react/pause-signals-context.d.ts.map +1 -0
  107. package/dist/esm/react/server.d.ts +12 -0
  108. package/dist/esm/react/server.d.ts.map +1 -0
  109. package/dist/esm/react/use-reactive.d.ts +34 -7
  110. package/dist/esm/react/use-reactive.d.ts.map +1 -1
  111. package/dist/esm/transform/async.d.ts.map +1 -1
  112. package/dist/esm/transform/callback.d.ts.map +1 -1
  113. package/dist/esm/transform/use-reactive.d.ts.map +1 -1
  114. package/dist/esm/types.d.ts +33 -10
  115. package/dist/esm/types.d.ts.map +1 -1
  116. package/dist/esm/utils.d.ts +2 -2
  117. package/dist/esm/utils.d.ts.map +1 -1
  118. package/package.json +35 -4
  119. package/react-server.js +15 -0
  120. package/dist/cjs/development/debug-ouT0N0E4.js.map +0 -1
  121. package/dist/cjs/development/snapshot-BPJ-qw6l.js.map +0 -1
  122. package/dist/cjs/production/contexts-DtQMtXO7.js.map +0 -1
  123. package/dist/cjs/production/snapshot-Dw62eSpw.js.map +0 -1
  124. package/dist/esm/development/debug-DaK9qsbI.js.map +0 -1
  125. package/dist/esm/development/snapshot-D8ZJEbwO.js.map +0 -1
  126. package/dist/esm/internals/weakref.d.ts +0 -3
  127. package/dist/esm/internals/weakref.d.ts.map +0 -1
  128. package/dist/esm/production/contexts-US_h2nBi.js.map +0 -1
  129. package/dist/esm/production/snapshot-CfJGJCvW.js.map +0 -1
  130. package/dist/esm/react/suspend-signals-context.d.ts +0 -3
  131. package/dist/esm/react/suspend-signals-context.d.ts.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,206 @@
1
1
  # signalium
2
2
 
3
+ ## 3.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - d4658b4: Fix `registerCustomSnapshot` to apply to subclasses of the registered class. Previously, a handler registered on a base class was only invoked for direct instances of that class — subclass instances bypassed it because the resolver did an exact-prototype lookup. Custom snapshot registrations now use a non-enumerable symbol on the class prototype, so JS prototype lookup naturally walks the chain and subclasses inherit their ancestor's handler. Subclasses can still override by registering their own handler. The public API is unchanged.
8
+
9
+ ## 3.0.0
10
+
11
+ ### Major Changes
12
+
13
+ - 97a1d00: Add async component support with Suspense + RSC/SSR integration.
14
+
15
+ - `component(async (props) => { await ... })` on the client: the Signalium Babel preset
16
+ rewrites the async body to a generator, and a synchronous replay driver throws pending
17
+ thenables for `<Suspense>` while re-injecting settled values on replay. Reactive reads
18
+ inside the component participate in the signal graph like any other `compute`.
19
+ - New `signalium/react` `react-server` export condition: in RSC bundles, `component()`
20
+ returns a real `async function` (for generator authoring) or a thin sync wrapper, with
21
+ no React hook imports — safe for the server module graph.
22
+ - New `signalium/react/server` entry exposing `setupRscRequestScope()`, which installs a
23
+ per-request `SignalScope` via `React.cache` so server-side `reactive()` / `task()` /
24
+ `relay()` don't leak across requests.
25
+ - New core API `setRequestScopeGetter(get)` that frameworks/tests can use to supply a
26
+ per-request scope; consulted by `getCurrentScope` after `CURRENT_SCOPE` and the current
27
+ consumer's scope.
28
+ - Babel async transform now tracks `component` imported from `signalium/react` alongside
29
+ `reactive` / `reactiveMethod` / `relay` / `task`, so `component(async ...)` is rewritten
30
+ to a generator without extra configuration.
31
+
32
+ Breaking: `react` peer dependency is now `>=19.0.0` (required for `React.cache` and
33
+ React 19's thenable handling in `<Suspense>`).
34
+
35
+ - 9fa0d88: `ReactivePromise<T>` is now the discriminated union by default.
36
+
37
+ The exported `ReactivePromise<T>` _type_ is now
38
+ `PendingReactivePromise<T> | ReadyReactivePromise<T>` — the same shape that was
39
+ previously named `DiscriminatedReactivePromise<T>`. This means `if (p.isReady)`
40
+ narrows `p.value` to `T` (no `| undefined`) directly, with no extra type
41
+ gymnastics.
42
+
43
+ The exported `ReactivePromise` _value_ (the class for `instanceof`, `new`, and
44
+ the static methods `all` / `race` / `any` / `allSettled` / `resolve` / `reject`
45
+ / `withResolvers`, plus the identifier emitted by the Babel preset's promise
46
+ methods transform) is unchanged at runtime. It's now typed as a constructor
47
+ interface (the same pattern lib.es5.d.ts uses for the global `Promise`), so:
48
+
49
+ - `new ReactivePromise<T>()` returns `ReactivePromise<T>` (the union)
50
+ - `value instanceof ReactivePromise` narrows to the union
51
+ - `ReactivePromise.resolve(x)`, `.all([...])`, etc. return the union
52
+
53
+ ### Breaking changes
54
+
55
+ - `DiscriminatedReactivePromise<T>` is removed. Replace every reference with
56
+ `ReactivePromise<T>`. The two types are now identical, so the migration is a
57
+ rename.
58
+ - The previous wide `ReactivePromise<T>` interface (with `value: T | undefined`
59
+ and `isReady: boolean`) is no longer exported. If you had code that explicitly
60
+ asked for that wide shape, switch to discriminating on `isReady` (or accept
61
+ `PendingReactivePromise<T>` / `ReadyReactivePromise<T>` directly).
62
+
63
+ ### Why
64
+
65
+ The previous split between a non-discriminated `ReactivePromise<T>` (the class
66
+ instance type) and a separate `DiscriminatedReactivePromise<T>` union (what
67
+ `useReactive`, `relay()`, async `reactive()`, etc. actually returned) was a
68
+ frequent source of confusion. The names suggested they were different shapes
69
+ when in practice users almost always wanted the discriminated form. Merging
70
+ them removes a footgun and matches the runtime behavior.
71
+
72
+ - 46facb0: `useReactive` is now thunk-only and deep-by-default.
73
+
74
+ ### New API surface
75
+
76
+ - `useReactive(() => expr)` — deep-by-default. Returns a structurally-shared
77
+ snapshot of the reactive value, so referential equality at the React boundary
78
+ Just Works (memoized children keep the same props when unchanged subtrees are
79
+ re-read). This is the behavior of the old `useReactiveDeep`.
80
+ - `useReactiveShallow(() => expr)` — new named export. Minimal wrapper:
81
+ returns the reactive value by reference without any structural cloning or
82
+ `ReactivePromise` entanglement. Re-renders only when the underlying
83
+ `ReactiveSignal` itself re-runs (e.g. the thunk produces a new reference).
84
+ Use it when you need to preserve class identity on a synchronously-changing
85
+ value. If you need promise state transitions at the React boundary, use
86
+ `useReactive` — its structural snapshot reads the promise's flags and
87
+ automatically re-renders on each transition.
88
+ - `useReactiveDeep(() => expr)` — kept as a deprecated alias that forwards to
89
+ `useReactive` and logs a one-time `console.warn` in dev. Will be removed in
90
+ the next major.
91
+
92
+ ### Breaking changes
93
+
94
+ - The non-thunk overloads are removed:
95
+ - `useReactive(signal)` → `useReactive(() => signal.value)`
96
+ - `useReactive(promise)` → `useReactive(() => promise)` for a plain
97
+ snapshot that updates on every promise state transition.
98
+ - `useReactive(reactiveFn, arg1, arg2)` → `useReactive(() => reactiveFn(arg1, arg2))`
99
+ - `useReactiveDeep(reactiveFn, arg1)` → `useReactive(() => reactiveFn(arg1))`
100
+ - Calling `useReactive` / `useReactiveShallow` / `useReactiveDeep` inside a
101
+ reactive function (e.g. inside `reactive(...)` or a `component()` render
102
+ body) now throws in dev (the guard is tree-shaken from production builds).
103
+ These hooks are the bridge from plain React components into the signal
104
+ graph — inside reactive code you should call your signals and
105
+ `reactive()`-returned functions directly, since the surrounding compute
106
+ already participates in the graph. This replaces the previous behavior of
107
+ silently forking and invoking the thunk.
108
+ - The internal `addListener` on `ReactiveSignal` no longer schedules an
109
+ initial pull when the signal is registered as a suspended listener. This
110
+ fixes a case where a component mounted inside a suspended provider would
111
+ render twice on mount.
112
+
113
+ ### Recommended migration
114
+
115
+ 1. Land this version and enable (or keep) the Signalium Babel preset. The
116
+ preset wraps thunks in `useCallback(fn, [captures])` so identity stays
117
+ stable across renders and the same `ReactiveSignal` is reused.
118
+ 2. Rewrite `useReactive(signal)` / `useReactive(fn, ...args)` call sites as
119
+ thunks. A safe blanket replacement is `useReactive(() => oldArg)` /
120
+ `useReactive(() => oldFn(...oldArgs))`.
121
+ 3. If you were relying on `ReactivePromise` class identity (e.g. `instanceof`
122
+ checks or passing through `React.memo` by reference), switch those sites to
123
+ `useReactiveShallow`.
124
+ 4. Rename `useReactiveDeep` call sites to `useReactive` at your leisure — they
125
+ behave identically but the old name will be removed in the next major.
126
+
127
+ ### Philosophy
128
+
129
+ `useReactive` is the bridge from plain React components into the signal graph.
130
+ Every call site is a hook, so there's per-render bookkeeping overhead. Prefer
131
+ `component(fn)` (from `signalium/react`) for components that are meaningfully
132
+ reactive — the whole render body becomes one `ReactiveSignal`'s `compute`,
133
+ which avoids the hook overhead entirely.
134
+
135
+ - 5031ce1: Switch to native `WeakRef` for scope-cached signals, remove suspension from the core graph, and introduce `PauseSignalsProvider`.
136
+
137
+ ### Native WeakRef GC
138
+
139
+ `SignalScope` now stores signals as `WeakRef` entries instead of strong references with manual GC sweeps. Signals stay alive as long as something holds a strong reference (the `deps` chain, a React component closure, a local variable, etc.). When nothing references a signal, the JS garbage collector reclaims it naturally.
140
+
141
+ Removed:
142
+
143
+ - The `WeakRef` polyfill (`weakref.ts`) — environments without native `WeakRef` are no longer supported.
144
+ - The manual GC sweep system (`markForGc`, `removeFromGc`, `sweepGc`, `gcCandidates`, `scheduleGcSweep`, `scheduleIdleCallback`).
145
+ - `reset()` on `ReactiveSignal` — signals are no longer eagerly torn down on unwatch. Their value and dep graph are preserved for reuse if re-watched before GC collects them.
146
+
147
+ ### Suspension removed from core
148
+
149
+ The core signal graph has zero suspension concepts. Removed:
150
+
151
+ - `suspendCount` field and `_isSuspended` getter on `ReactiveSignal`
152
+ - `setSuspended()` method and `isSuspendedListener` flag
153
+ - `watchSuspendedSignal`, `unwatchSuspendedSignal`, `suspendSignal`, `resumeSignal`
154
+ - The `parentIsSuspended` parameter on `watchSignal` / `unwatchSignal`
155
+ - The `isSuspending` branch in `deactivateSignal`
156
+
157
+ ### `PauseSignalsProvider` (replaces `SuspendSignalsProvider`)
158
+
159
+ `SuspendSignalsProvider` is replaced by `PauseSignalsProvider` to avoid confusion with React Suspense.
160
+
161
+ `PauseSignalsProvider` uses a stable `PauseSignalsManager` context (not a changing boolean), so toggling the `value` prop does not re-render descendants. React hooks register their signals during render; the manager calls `watchSignal` / `unwatchSignal` directly to pause and resume the signal graph. Signals mounted inside an already-paused provider skip activation entirely.
162
+
163
+ ### Breaking changes
164
+
165
+ - `SuspendSignalsProvider` → `PauseSignalsProvider`
166
+ - `useSignalsSuspended()` is removed from the public API.
167
+ - `setSuspended()` is removed from the `Watcher` interface.
168
+ - Environments without native `WeakRef` are no longer supported.
169
+
170
+ ### Minor Changes
171
+
172
+ - 500514d: Remove the implicit `console.error('[signalium] Unhandled async error...')`
173
+ that fired whenever a `ReactivePromise` (including `relay()` and `task()`)
174
+ transitioned to a rejected state.
175
+
176
+ The log was misleading in practice: it ran synchronously inside `_setError`,
177
+ before any reactive consumer or async `component()` had a chance to react. So
178
+ it printed "Unhandled" for rejections that were in fact handled — declaratively
179
+ via `isRejected` / `error` reads, by `await` in an async `component()` (which
180
+ re-throws into a React error boundary), or by an explicit `.catch()` on the
181
+ `ReactivePromise` surface. There's no general definition of "handled" in a
182
+ reactive graph, so any single heuristic was going to mislabel some path.
183
+
184
+ Rejected `ReactivePromise`s are now silent at the library layer. Existing
185
+ ways to observe a rejection are unchanged:
186
+
187
+ - Read `isRejected` / `error` on the `ReactivePromise` (or its
188
+ `useReactive` snapshot) and branch in your reactive code.
189
+ - `await` / `yield` the `ReactivePromise` from an async `component()`; the
190
+ replay driver throws `error` into the nearest React error boundary on
191
+ rejection (and throws a thenable for `<Suspense>` while pending).
192
+ - `.catch()` / `.then(null, fn)` on the `ReactivePromise` — it still
193
+ implements the `Promise` surface.
194
+
195
+ A first-class global hook for unhandled reactive rejections is intentionally
196
+ deferred: defining "handled" in a way that doesn't mislabel the cases above
197
+ needs more design and isn't required for v3.
198
+
199
+ If you were relying on the log for debugging, attach your own logging in a
200
+ declarative branch (e.g. inside a `reactive()` that reads `isRejected` /
201
+ `error`) or rethrow from an async `component()` so the error reaches a React
202
+ error boundary.
203
+
3
204
  ## 2.4.0
4
205
 
5
206
  ### Minor Changes
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ const debug = require("./debug-C46WDxhL.js");
3
+ function isGeneratorFunction(fn) {
4
+ return typeof fn === "function" && fn.constructor?.name === "GeneratorFunction";
5
+ }
6
+ function isAsyncFunctionWithoutTransform(fn) {
7
+ return typeof fn === "function" && fn.constructor?.name === "AsyncFunction";
8
+ }
9
+ function createServerAsyncComponentWrapper(fn) {
10
+ return async function(props) {
11
+ const scope = debug.getCurrentScope();
12
+ const owned = debug.createReactiveSignal({ compute: () => null, equals: () => true, isRelay: false, tracer: void 0 }, [], void 0, scope);
13
+ return debug.generatorResultToPromiseWithConsumer(fn(props), owned);
14
+ };
15
+ }
16
+ function createServerSyncComponentWrapper(fn) {
17
+ return function(props) {
18
+ const scope = debug.getCurrentScope();
19
+ const owned = debug.createReactiveSignal({ compute: () => null, equals: () => true, isRelay: false, tracer: void 0 }, [], void 0, scope);
20
+ const prevConsumer = debug.getCurrentConsumer();
21
+ try {
22
+ debug.setCurrentConsumer(owned);
23
+ return fn(props);
24
+ } finally {
25
+ debug.setCurrentConsumer(prevConsumer);
26
+ }
27
+ };
28
+ }
29
+ exports.createServerAsyncComponentWrapper = createServerAsyncComponentWrapper;
30
+ exports.createServerSyncComponentWrapper = createServerSyncComponentWrapper;
31
+ exports.isAsyncFunctionWithoutTransform = isAsyncFunctionWithoutTransform;
32
+ exports.isGeneratorFunction = isGeneratorFunction;
33
+ //# sourceMappingURL=component-shared-Cug2Y5YZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component-shared-Cug2Y5YZ.js","sources":["../../../.tsc-out/react/component-shared.js"],"sourcesContent":["import { getCurrentConsumer, setCurrentConsumer } from '../internals/consumer.js';\nimport { getCurrentScope } from '../internals/contexts.js';\nimport { createReactiveSignal } from '../internals/reactive.js';\nimport { generatorResultToPromiseWithConsumer } from '../internals/generators.js';\nexport function isGeneratorFunction(fn) {\n return (typeof fn === 'function' && fn.constructor?.name === 'GeneratorFunction');\n}\nexport function isAsyncFunctionWithoutTransform(fn) {\n return typeof fn === 'function' && fn.constructor?.name === 'AsyncFunction';\n}\n/**\n * Wrap a Babel-transformed async generator in a real `async function` that drives it\n * with {@link generatorResultToPromiseWithConsumer}. Used on the server (RSC + SSR)\n * where hooks-based Suspense replay is not appropriate.\n */\nexport function createServerAsyncComponentWrapper(fn) {\n return async function (props) {\n const scope = getCurrentScope();\n const owned = createReactiveSignal({ compute: () => null, equals: () => true, isRelay: false, tracer: undefined }, [], undefined, scope);\n return generatorResultToPromiseWithConsumer(fn(props), owned);\n };\n}\n/**\n * Wrap a sync render function with consumer/scope tracking. Used by the server\n * `component()` for non-generator definitions.\n */\nexport function createServerSyncComponentWrapper(fn) {\n return function (props) {\n const scope = getCurrentScope();\n const owned = createReactiveSignal({ compute: () => null, equals: () => true, isRelay: false, tracer: undefined }, [], undefined, scope);\n const prevConsumer = getCurrentConsumer();\n try {\n setCurrentConsumer(owned);\n return fn(props);\n }\n finally {\n setCurrentConsumer(prevConsumer);\n }\n };\n}\n"],"names":["getCurrentScope","createReactiveSignal","generatorResultToPromiseWithConsumer","getCurrentConsumer","setCurrentConsumer"],"mappings":";;AAIO,SAAS,oBAAoB,IAAI;AACpC,SAAQ,OAAO,OAAO,cAAc,GAAG,aAAa,SAAS;AACjE;AACO,SAAS,gCAAgC,IAAI;AAChD,SAAO,OAAO,OAAO,cAAc,GAAG,aAAa,SAAS;AAChE;AAMO,SAAS,kCAAkC,IAAI;AAClD,SAAO,eAAgB,OAAO;AAC1B,UAAM,QAAQA,MAAAA,gBAAe;AAC7B,UAAM,QAAQC,MAAAA,qBAAqB,EAAE,SAAS,MAAM,MAAM,QAAQ,MAAM,MAAM,SAAS,OAAO,QAAQ,OAAS,GAAI,CAAA,GAAI,QAAW,KAAK;AACvI,WAAOC,2CAAqC,GAAG,KAAK,GAAG,KAAK;AAAA,EAChE;AACJ;AAKO,SAAS,iCAAiC,IAAI;AACjD,SAAO,SAAU,OAAO;AACpB,UAAM,QAAQF,MAAAA,gBAAe;AAC7B,UAAM,QAAQC,MAAAA,qBAAqB,EAAE,SAAS,MAAM,MAAM,QAAQ,MAAM,MAAM,SAAS,OAAO,QAAQ,OAAS,GAAI,CAAA,GAAI,QAAW,KAAK;AACvI,UAAM,eAAeE,MAAAA,mBAAkB;AACvC,QAAI;AACAC,YAAAA,mBAAmB,KAAK;AACxB,aAAO,GAAG,KAAK;AAAA,IACnB,UACR;AACYA,YAAAA,mBAAmB,YAAY;AAAA,IACnC;AAAA,EACJ;AACJ;;;;;"}