svelte-effect-runtime 3.4.11 → 4.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 (147) hide show
  1. package/.dist/chunks/client-BrZka6DW.js +530 -0
  2. package/.dist/chunks/client-BrZka6DW.js.map +1 -0
  3. package/.dist/chunks/compiler-COVzgLYo.js +412 -0
  4. package/.dist/chunks/compiler-COVzgLYo.js.map +1 -0
  5. package/.dist/chunks/descriptors-B4otDlm1.js +216 -0
  6. package/.dist/chunks/descriptors-B4otDlm1.js.map +1 -0
  7. package/.dist/chunks/diagnostics-BDrky-Di.js +359 -0
  8. package/.dist/chunks/diagnostics-BDrky-Di.js.map +1 -0
  9. package/.dist/chunks/dispatcher-BA0PLQhA.js +16 -0
  10. package/.dist/chunks/dispatcher-BA0PLQhA.js.map +1 -0
  11. package/.dist/chunks/{dispatcher-pHH4JcFR.js → dispatcher-_x0MQZBS.js} +84 -258
  12. package/.dist/chunks/dispatcher-_x0MQZBS.js.map +1 -0
  13. package/.dist/chunks/{errors-Dcf0MVbq.js → errors-CLsbGjIa.js} +57 -106
  14. package/.dist/chunks/errors-CLsbGjIa.js.map +1 -0
  15. package/.dist/chunks/live-BundLSoY.js +146 -0
  16. package/.dist/chunks/live-BundLSoY.js.map +1 -0
  17. package/.dist/chunks/live-CHK0RrZu.js +10 -0
  18. package/.dist/chunks/live-CHK0RrZu.js.map +1 -0
  19. package/.dist/chunks/{remote-client-Bj1pZXgq.js → remote-client-mkQAfP1G.js} +30 -24
  20. package/.dist/chunks/remote-client-mkQAfP1G.js.map +1 -0
  21. package/.dist/chunks/{runtime-ekkMQ-wL.js → runtime-HDTlEnzp.js} +3 -27
  22. package/.dist/chunks/runtime-HDTlEnzp.js.map +1 -0
  23. package/.dist/chunks/server-BNrA1I-u.js +144 -0
  24. package/.dist/chunks/server-BNrA1I-u.js.map +1 -0
  25. package/.dist/chunks/source-scan-9pZxnfct.js +1059 -0
  26. package/.dist/chunks/source-scan-9pZxnfct.js.map +1 -0
  27. package/.dist/chunks/{transform-CtQDGS9c.js → transform-BXyYUAez.js} +308 -484
  28. package/.dist/chunks/transform-BXyYUAez.js.map +1 -0
  29. package/.dist/compiler/markup-identifiers.d.ts +2 -0
  30. package/.dist/compiler/remote-client.d.ts +6 -0
  31. package/.dist/compiler/source-scan.d.ts +101 -0
  32. package/.dist/compiler/sveltekit-remote-bridge.d.ts +3 -0
  33. package/.dist/{vite.d.ts → compiler.d.ts} +7 -1
  34. package/.dist/{vite.js → compiler.js} +1 -1
  35. package/.dist/detect.d.ts +0 -31
  36. package/.dist/detect.js +0 -39
  37. package/.dist/detect.js.map +1 -1
  38. package/.dist/diagnostics.d.ts +0 -16
  39. package/.dist/dispatcher/deps.d.ts +3 -14
  40. package/.dist/dispatcher/fibers.d.ts +5 -46
  41. package/.dist/dispatcher/index.d.ts +1 -143
  42. package/.dist/dispatcher/types.d.ts +0 -151
  43. package/.dist/dispatcher.js +1 -1
  44. package/.dist/errors.d.ts +44 -86
  45. package/.dist/generated/dispatcher.d.ts +0 -50
  46. package/.dist/generators.d.ts +3 -12
  47. package/.dist/internal/descriptors.d.ts +0 -16
  48. package/.dist/internal/generators.js +25 -3
  49. package/.dist/internal/generators.js.map +1 -0
  50. package/.dist/internal/live.d.ts +9 -0
  51. package/.dist/internal/remote-client.js +2 -2
  52. package/.dist/internal/remote-server.js +2 -2
  53. package/.dist/internal/schema.d.ts +13 -0
  54. package/.dist/live.d.ts +106 -0
  55. package/.dist/markup/event-attributes.d.ts +5 -28
  56. package/.dist/markup/promise.d.ts +1 -23
  57. package/.dist/markup/promise.js +2 -18
  58. package/.dist/markup/promise.js.map +1 -1
  59. package/.dist/markup/run.d.ts +1 -10
  60. package/.dist/markup/run.js +2 -11
  61. package/.dist/markup/run.js.map +1 -1
  62. package/.dist/markup/transform/apply.d.ts +4 -4
  63. package/.dist/markup/transform/classify.d.ts +2 -11
  64. package/.dist/markup/transform/constants.d.ts +2 -1
  65. package/.dist/markup/transform/effect-bindings.d.ts +2 -26
  66. package/.dist/markup/transform/effect-callbacks.d.ts +0 -20
  67. package/.dist/markup/transform/emit.d.ts +2 -11
  68. package/.dist/markup/transform/expressions.d.ts +0 -35
  69. package/.dist/markup/transform/scan.d.ts +3 -22
  70. package/.dist/markup/transform/types.d.ts +2 -129
  71. package/.dist/markup/transform.js +1 -1
  72. package/.dist/markup/value.d.ts +1 -18
  73. package/.dist/markup/value.js +2 -19
  74. package/.dist/markup/value.js.map +1 -1
  75. package/.dist/mod.d.ts +6 -8
  76. package/.dist/mod.js +5 -4
  77. package/.dist/mod.js.map +1 -1
  78. package/.dist/remote/cause-codec.d.ts +19 -0
  79. package/.dist/remote/client/command.d.ts +3 -17
  80. package/.dist/remote/client/form-data.d.ts +0 -7
  81. package/.dist/remote/client/form-enhance.d.ts +0 -7
  82. package/.dist/remote/client/form-transport.d.ts +15 -18
  83. package/.dist/remote/client/form.d.ts +9 -20
  84. package/.dist/remote/client/index.d.ts +2 -1
  85. package/.dist/remote/client/prerender.d.ts +6 -0
  86. package/.dist/remote/client/query-result.d.ts +2 -14
  87. package/.dist/remote/client/query.d.ts +9 -59
  88. package/.dist/remote/client/responses.d.ts +3 -27
  89. package/.dist/remote/client/types.d.ts +26 -101
  90. package/.dist/remote/client/utils.d.ts +0 -8
  91. package/.dist/remote/client.d.ts +2 -2
  92. package/.dist/remote/client.js +2 -2
  93. package/.dist/remote/effect.d.ts +6 -0
  94. package/.dist/remote/failures.d.ts +4 -0
  95. package/.dist/remote/query-update.d.ts +2 -0
  96. package/.dist/remote/resource.d.ts +25 -0
  97. package/.dist/remote/server.d.ts +5 -60
  98. package/.dist/remote/server.js +2 -179
  99. package/.dist/remote/shared.d.ts +6 -145
  100. package/.dist/remote/shared.js +6 -127
  101. package/.dist/remote/shared.js.map +1 -1
  102. package/.dist/runtime/transform.js +83 -87
  103. package/.dist/runtime/transform.js.map +1 -1
  104. package/.dist/script-transform/ast.d.ts +0 -46
  105. package/.dist/script-transform/imports.d.ts +2 -38
  106. package/.dist/script-transform/lower.d.ts +0 -9
  107. package/.dist/script-transform/runes.d.ts +0 -10
  108. package/.dist/script-transform/runtime-block.d.ts +0 -17
  109. package/.dist/script-transform/source.d.ts +0 -24
  110. package/.dist/script-transform/types.d.ts +9 -126
  111. package/.dist/server/effects.d.ts +8 -57
  112. package/.dist/server/factories.d.ts +7 -7
  113. package/.dist/server/handler.d.ts +37 -0
  114. package/.dist/server/index.d.ts +4 -1
  115. package/.dist/server/invalid.d.ts +0 -7
  116. package/.dist/server/live-snapshot.d.ts +5 -0
  117. package/.dist/server/remote-handler-context.d.ts +5 -0
  118. package/.dist/server/runtime.d.ts +6 -24
  119. package/.dist/server/schema.d.ts +2 -40
  120. package/.dist/server/transport.d.ts +2 -0
  121. package/.dist/server/types.d.ts +88 -71
  122. package/.dist/server/wrappers.d.ts +4 -41
  123. package/.dist/server.d.ts +2 -2
  124. package/.dist/server.js +255 -279
  125. package/.dist/server.js.map +1 -1
  126. package/.dist/yieldable.d.ts +7 -0
  127. package/README.md +1 -1
  128. package/package.json +5 -5
  129. package/.dist/chunks/client-CsVu54pU.js +0 -627
  130. package/.dist/chunks/client-CsVu54pU.js.map +0 -1
  131. package/.dist/chunks/descriptors-cOe9uRJz.js +0 -36
  132. package/.dist/chunks/descriptors-cOe9uRJz.js.map +0 -1
  133. package/.dist/chunks/dispatcher-LtvFKYUp.js +0 -47
  134. package/.dist/chunks/dispatcher-LtvFKYUp.js.map +0 -1
  135. package/.dist/chunks/dispatcher-pHH4JcFR.js.map +0 -1
  136. package/.dist/chunks/errors-Dcf0MVbq.js.map +0 -1
  137. package/.dist/chunks/event-attributes-gHzP2ycp.js +0 -39
  138. package/.dist/chunks/event-attributes-gHzP2ycp.js.map +0 -1
  139. package/.dist/chunks/remote-client-Bj1pZXgq.js.map +0 -1
  140. package/.dist/chunks/runtime-ekkMQ-wL.js.map +0 -1
  141. package/.dist/chunks/transform-CtQDGS9c.js.map +0 -1
  142. package/.dist/chunks/vite-WGlbSnso.js +0 -486
  143. package/.dist/chunks/vite-WGlbSnso.js.map +0 -1
  144. package/.dist/remote/client/effect.d.ts +0 -29
  145. package/.dist/remote/client/failures.d.ts +0 -42
  146. package/.dist/remote/server.js.map +0 -1
  147. package/.dist/vite/remote-client.d.ts +0 -24
package/.dist/errors.d.ts CHANGED
@@ -11,24 +11,10 @@
11
11
  * @since 2.4.0
12
12
  * @param message - Technical diagnostic message describing the failed runtime
13
13
  * invariant.
14
- * @returns A runtime-authored Error instance.
15
14
  */
16
15
  export declare class RuntimeError extends Error {
17
16
  constructor(message: string);
18
17
  }
19
- /**
20
- * Formats a runtime-owned error message with a stable screaming-case code.
21
- *
22
- * @example
23
- * ```ts
24
- * throw new Error(make_error_message("DISPATCHER_DISPOSED", "Dispatcher has been disposed"));
25
- * ```
26
- *
27
- * @since 2.0.0
28
- * @param code - Stable screaming-case identifier for the error category.
29
- * @param message - Human-readable error message without the leading code.
30
- * @returns The complete error message prefixed with the stable code.
31
- */
32
18
  export declare function make_error_message(code: string, message: string): string;
33
19
  /**
34
20
  * Base error class for all preprocessor errors emitted during script and
@@ -43,7 +29,6 @@ export declare function make_error_message(code: string, message: string): strin
43
29
  * @since 2.0.0
44
30
  * @param message - Technical diagnostic message for the transform failure.
45
31
  * @param filename - Source filename that triggered the transform failure.
46
- * @returns A preprocessor Error instance with source file context.
47
32
  */
48
33
  export declare class PreprocessError extends RuntimeError {
49
34
  /**
@@ -54,30 +39,6 @@ export declare class PreprocessError extends RuntimeError {
54
39
  readonly filename: string;
55
40
  constructor(message: string, filename: string);
56
41
  }
57
- /**
58
- * Retained for compatibility when callers need a structured representation of
59
- * possible Vite plugin ordering conflicts.
60
- *
61
- * @example
62
- * ```ts
63
- * throw new VitePreTransformPluginConflictError(["wuchale"]);
64
- * ```
65
- *
66
- * @since 2.4.0
67
- * @param plugin_names - Names of Vite plugins that declare pre-transform
68
- * priority and may parse raw component files before SER lowers them.
69
- * @returns A runtime-authored Error describing the possible plugin ordering
70
- * conflict.
71
- */
72
- export declare class VitePreTransformPluginConflictError extends RuntimeError {
73
- /**
74
- * Names of conflicting Vite plugins.
75
- *
76
- * @since 2.4.0
77
- */
78
- readonly plugin_names: readonly string[];
79
- constructor(plugin_names: readonly string[]);
80
- }
81
42
  /**
82
43
  * Thrown when a statement mixes JavaScript `await` with Effect `yield*` work
83
44
  * that must be lowered into an `Effect.gen` program.
@@ -91,7 +52,6 @@ export declare class VitePreTransformPluginConflictError extends RuntimeError {
91
52
  * @param filename - Source filename containing the unsupported statement.
92
53
  * @param statement_text - Full source text for the statement containing
93
54
  * mixed async work.
94
- * @returns A preprocessor Error instance with statement context.
95
55
  */
96
56
  export declare class AwaitInEffectWorkError extends PreprocessError {
97
57
  /**
@@ -116,7 +76,6 @@ export declare class AwaitInEffectWorkError extends PreprocessError {
116
76
  * Effect work.
117
77
  * @param expression_text - Full source text for the rune expression.
118
78
  * @param filename - Source filename containing the unsupported rune.
119
- * @returns A preprocessor Error instance with rune source context.
120
79
  */
121
80
  export declare class AsyncEffectInSyncRuneError extends PreprocessError {
122
81
  /**
@@ -149,7 +108,6 @@ export declare class AsyncEffectInSyncRuneError extends PreprocessError {
149
108
  * @param filename - Source filename containing the invalid event handler.
150
109
  * @param expression_text - Event handler expression that contains the nested
151
110
  * unsupported async Effect work.
152
- * @returns A preprocessor Error instance with event expression context.
153
111
  */
154
112
  export declare class AsyncEffectInEventCallbackError extends PreprocessError {
155
113
  /**
@@ -175,7 +133,6 @@ export declare class AsyncEffectInEventCallbackError extends PreprocessError {
175
133
  * invalid event handler callback was found.
176
134
  * @param expression_text - Original event handler callback text that contained
177
135
  * `yield*` and should be rewritten as a direct event Effect expression.
178
- * @returns A preprocessor Error instance with event callback context.
179
136
  */
180
137
  export declare class YieldStarInEventCallbackError extends PreprocessError {
181
138
  /**
@@ -201,7 +158,6 @@ export declare class YieldStarInEventCallbackError extends PreprocessError {
201
158
  * @since 2.4.2
202
159
  * @param filename - Source filename containing the unsupported markup.
203
160
  * @param expression_text - The unsupported markup expression text.
204
- * @returns A preprocessor Error instance with markup source context.
205
161
  */
206
162
  export declare class UnsupportedMarkupEffectPositionError extends PreprocessError {
207
163
  /**
@@ -222,7 +178,6 @@ export declare class UnsupportedMarkupEffectPositionError extends PreprocessErro
222
178
  * ```
223
179
  *
224
180
  * @since 2.4.0
225
- * @returns An Error describing missing request context.
226
181
  */
227
182
  export declare class RequestEventUnavailableError extends RuntimeError {
228
183
  constructor();
@@ -236,7 +191,6 @@ export declare class RequestEventUnavailableError extends RuntimeError {
236
191
  * ```
237
192
  *
238
193
  * @since 2.4.0
239
- * @returns An Error describing the invalid Query overload usage.
240
194
  */
241
195
  export declare class UncheckedQueryHandlerMissingError extends RuntimeError {
242
196
  constructor();
@@ -250,7 +204,6 @@ export declare class UncheckedQueryHandlerMissingError extends RuntimeError {
250
204
  * ```
251
205
  *
252
206
  * @since 2.4.0
253
- * @returns An Error describing the invalid batch Query overload usage.
254
207
  */
255
208
  export declare class BatchQueryHandlerMissingError extends RuntimeError {
256
209
  constructor();
@@ -264,7 +217,6 @@ export declare class BatchQueryHandlerMissingError extends RuntimeError {
264
217
  * ```
265
218
  *
266
219
  * @since 2.4.0
267
- * @returns An Error describing the invalid live Query overload usage.
268
220
  */
269
221
  export declare class UncheckedLiveQueryHandlerMissingError extends RuntimeError {
270
222
  constructor();
@@ -278,7 +230,6 @@ export declare class UncheckedLiveQueryHandlerMissingError extends RuntimeError
278
230
  * ```
279
231
  *
280
232
  * @since 2.4.0
281
- * @returns An Error describing the invalid Command overload usage.
282
233
  */
283
234
  export declare class UncheckedCommandHandlerMissingError extends RuntimeError {
284
235
  constructor();
@@ -292,7 +243,6 @@ export declare class UncheckedCommandHandlerMissingError extends RuntimeError {
292
243
  * ```
293
244
  *
294
245
  * @since 2.4.0
295
- * @returns An Error describing the invalid Form overload usage.
296
246
  */
297
247
  export declare class UncheckedFormHandlerMissingError extends RuntimeError {
298
248
  constructor();
@@ -306,7 +256,6 @@ export declare class UncheckedFormHandlerMissingError extends RuntimeError {
306
256
  * ```
307
257
  *
308
258
  * @since 2.4.0
309
- * @returns An Error describing the invalid Prerender overload usage.
310
259
  */
311
260
  export declare class UncheckedPrerenderHandlerMissingError extends RuntimeError {
312
261
  constructor();
@@ -320,11 +269,46 @@ export declare class UncheckedPrerenderHandlerMissingError extends RuntimeError
320
269
  * ```
321
270
  *
322
271
  * @since 2.4.0
323
- * @returns An Error describing the expected live query return protocol.
324
272
  */
325
273
  export declare class InvalidLiveQueryReturnError extends RuntimeError {
326
274
  constructor();
327
275
  }
276
+ /**
277
+ * Thrown when generated component code yields a Stream that completes before
278
+ * producing a value.
279
+ *
280
+ * @example
281
+ * ```ts
282
+ * throw new EmptyStreamYieldError();
283
+ * ```
284
+ *
285
+ * @since 3.4.8
286
+ */
287
+ export declare class EmptyStreamYieldError extends RuntimeError {
288
+ constructor();
289
+ }
290
+ /**
291
+ * Thrown when generated component code receives a value that cannot be yielded
292
+ * through the SER runtime.
293
+ *
294
+ * @example
295
+ * ```ts
296
+ * throw new InvalidYieldableError(null);
297
+ * ```
298
+ *
299
+ * @since 4.0.0
300
+ * @param value - Runtime value that was expected to be an Effect, generator, or
301
+ * Stream.
302
+ */
303
+ export declare class InvalidYieldableError extends RuntimeError {
304
+ /**
305
+ * Runtime value rejected by the generated yield boundary.
306
+ *
307
+ * @since 4.0.0
308
+ */
309
+ readonly value: unknown;
310
+ constructor(value: unknown);
311
+ }
328
312
  /**
329
313
  * Thrown when a dispatcher operation is requested after disposal.
330
314
  *
@@ -334,7 +318,6 @@ export declare class InvalidLiveQueryReturnError extends RuntimeError {
334
318
  * ```
335
319
  *
336
320
  * @since 2.4.0
337
- * @returns An Error describing an invalid dispatcher lifecycle transition.
338
321
  */
339
322
  export declare class DispatcherDisposedError extends RuntimeError {
340
323
  constructor();
@@ -350,7 +333,6 @@ export declare class DispatcherDisposedError extends RuntimeError {
350
333
  *
351
334
  * @since 3.4.0
352
335
  * @param runtime_name - Public runtime API that was initialized more than once.
353
- * @returns An Error describing the invalid runtime lifecycle transition.
354
336
  */
355
337
  export declare class RuntimeAlreadyInitializedError extends RuntimeError {
356
338
  constructor(runtime_name: string);
@@ -364,11 +346,18 @@ export declare class RuntimeAlreadyInitializedError extends RuntimeError {
364
346
  * ```
365
347
  *
366
348
  * @since 2.4.0
367
- * @returns An Error describing an invalid query adapter input.
368
349
  */
369
350
  export declare class InvalidQueryFactoryError extends RuntimeError {
370
351
  constructor();
371
352
  }
353
+ /**
354
+ * Thrown when a generated or native remote prerender export is not callable.
355
+ *
356
+ * @since 4.0.0
357
+ */
358
+ export declare class InvalidPrerenderFactoryError extends RuntimeError {
359
+ constructor();
360
+ }
372
361
  /**
373
362
  * Thrown when a generated or native remote live query export is not callable.
374
363
  *
@@ -378,7 +367,6 @@ export declare class InvalidQueryFactoryError extends RuntimeError {
378
367
  * ```
379
368
  *
380
369
  * @since 2.4.0
381
- * @returns An Error describing an invalid live query adapter input.
382
370
  */
383
371
  export declare class InvalidLiveQueryFactoryError extends RuntimeError {
384
372
  constructor();
@@ -392,7 +380,6 @@ export declare class InvalidLiveQueryFactoryError extends RuntimeError {
392
380
  * ```
393
381
  *
394
382
  * @since 2.4.0
395
- * @returns An Error describing an invalid command adapter input.
396
383
  */
397
384
  export declare class InvalidCommandFactoryError extends RuntimeError {
398
385
  constructor();
@@ -406,7 +393,6 @@ export declare class InvalidCommandFactoryError extends RuntimeError {
406
393
  * ```
407
394
  *
408
395
  * @since 2.4.0
409
- * @returns An Error describing missing form transport metadata.
410
396
  */
411
397
  export declare class RemoteFormEndpointMissingError extends RuntimeError {
412
398
  constructor();
@@ -422,7 +408,6 @@ export declare class RemoteFormEndpointMissingError extends RuntimeError {
422
408
  *
423
409
  * @since 2.4.0
424
410
  * @param envelope - Raw response envelope returned by the remote form endpoint.
425
- * @returns An Error describing malformed form response data.
426
411
  */
427
412
  export declare class InvalidRemoteFormResponseError extends RuntimeError {
428
413
  /**
@@ -444,7 +429,6 @@ export declare class InvalidRemoteFormResponseError extends RuntimeError {
444
429
  *
445
430
  * @since 2.4.0
446
431
  * @param envelope - Raw response envelope returned by the remote form endpoint.
447
- * @returns An Error describing unsupported form response data.
448
432
  */
449
433
  export declare class UnsupportedRemoteFormResponseError extends RuntimeError {
450
434
  /**
@@ -465,7 +449,6 @@ export declare class UnsupportedRemoteFormResponseError extends RuntimeError {
465
449
  *
466
450
  * @since 2.4.0
467
451
  * @param raw - Raw serialized remote failure payload that failed decoding.
468
- * @returns An Error describing a malformed remote failure payload.
469
452
  */
470
453
  export declare class RemoteErrorDecodeError extends RuntimeError {
471
454
  /**
@@ -486,7 +469,6 @@ export declare class RemoteErrorDecodeError extends RuntimeError {
486
469
  *
487
470
  * @since 2.4.0
488
471
  * @param export_name - Name of the server-only root export that was invoked.
489
- * @returns An Error describing a missing server rewrite.
490
472
  */
491
473
  export declare class ServerOnlyImportError extends RuntimeError {
492
474
  /**
@@ -507,7 +489,6 @@ export declare class ServerOnlyImportError extends RuntimeError {
507
489
  *
508
490
  * @since 2.4.0
509
491
  * @param export_name - Name of the `$app/server` export that was invoked.
510
- * @returns An Error describing an unavailable SvelteKit virtual module export.
511
492
  */
512
493
  export declare class SvelteKitServerExportUnavailableError extends RuntimeError {
513
494
  /**
@@ -529,7 +510,6 @@ export declare class SvelteKitServerExportUnavailableError extends RuntimeError
529
510
  *
530
511
  * @since 2.4.0
531
512
  * @param helper_name - SER helper name that triggered the context failure.
532
- * @returns An Error describing the required `.remote.ts` placement.
533
513
  */
534
514
  export declare class RemoteHelperContextError extends RuntimeError {
535
515
  /**
@@ -550,7 +530,6 @@ export declare class RemoteHelperContextError extends RuntimeError {
550
530
  *
551
531
  * @since 2.4.0
552
532
  * @param value - Non-Error value thrown while creating a remote helper.
553
- * @returns An Error preserving the remote helper failure value.
554
533
  */
555
534
  export declare class RemoteHelperError extends RuntimeError {
556
535
  /**
@@ -561,24 +540,3 @@ export declare class RemoteHelperError extends RuntimeError {
561
540
  readonly value: unknown;
562
541
  constructor(value: unknown);
563
542
  }
564
- /**
565
- * Thrown when a non-Error value must be normalized into an Error instance.
566
- *
567
- * @example
568
- * ```ts
569
- * throw new UnknownRuntimeError("raw failure");
570
- * ```
571
- *
572
- * @since 2.4.0
573
- * @param value - Non-Error value that needs Error normalization.
574
- * @returns An Error preserving the string representation of an unknown value.
575
- */
576
- export declare class UnknownRuntimeError extends RuntimeError {
577
- /**
578
- * Non-Error value that was normalized.
579
- *
580
- * @since 2.4.0
581
- */
582
- readonly value: unknown;
583
- constructor(value: unknown);
584
- }
@@ -1,60 +1,10 @@
1
1
  import type { Dispatcher as RuntimeDispatcher, DispatcherEvent, MarkupPromiseEvent, MarkupRunEvent, MarkupValueEvent } from "../dispatcher.js";
2
2
  export { Code } from "../dispatcher.js";
3
3
  export type { DispatcherEvent, MarkupPromiseEvent, MarkupPromiseOptions, MarkupRunEvent, MarkupValueEvent, } from "../dispatcher.js";
4
- /**
5
- * Facade used by transform-generated component code to dispatch runtime
6
- * events through the current client or server dispatcher.
7
- *
8
- * @example
9
- * ```ts
10
- * const value = Dispatcher.emit({
11
- * type: Code.Markup.Value,
12
- * id: "Component.svelte:1:2",
13
- * deps: [],
14
- * fallback: undefined,
15
- * fn: function* () {
16
- * return yield* Effect.succeed(1);
17
- * },
18
- * });
19
- * ```
20
- *
21
- * @since 3.3.0
22
- * @internal
23
- */
24
4
  export declare class Dispatcher {
25
- /**
26
- * Emits a transform-generated dispatcher event.
27
- *
28
- * @example
29
- * ```ts
30
- * const promise = Dispatcher.emit({
31
- * type: Code.Markup.Promise,
32
- * id: "Component.svelte:1:2",
33
- * deps: [],
34
- * fn: function* () {
35
- * return yield* Effect.succeed(1);
36
- * },
37
- * });
38
- * ```
39
- *
40
- * @since 3.3.0
41
- * @param event - Generated event describing the dispatcher operation to run.
42
- * @returns The result produced by the active dispatcher.
43
- */
44
5
  static emit<A, F>(event: MarkupValueEvent<A, F>): A | F;
45
6
  static emit<A>(event: MarkupPromiseEvent<A>): Promise<A>;
46
7
  static emit<A>(event: MarkupRunEvent<A>): Promise<A>;
47
8
  static emit<A, F>(event: DispatcherEvent<A, F>): A | F | Promise<A>;
48
9
  }
49
- /**
50
- * Returns the dispatcher appropriate for generated component code.
51
- *
52
- * @example
53
- * ```ts
54
- * const dispatcher = get_dispatcher();
55
- * ```
56
- *
57
- * @since 3.0.1
58
- * @returns The server dispatcher during SSR, otherwise the client dispatcher.
59
- */
60
10
  export declare function get_dispatcher(): RuntimeDispatcher;
@@ -1,17 +1,8 @@
1
- /**
2
- * Barrel module for transform-generated imports. Exports everything the
3
- * transform needs to emit into generated code. Users never import this
4
- * module directly.
5
- *
6
- * Note: `Effect` is NOT re-exported. The script transform emits
7
- * `import { Effect } from "effect"` directly. `onMount` is NOT re-exported
8
- * either — it comes from `"svelte"` directly.
9
- *
10
- * @since 2.0.0
11
- * @internal
12
- */
1
+ /** Generated-code ABI for imports emitted by the Svelte transforms. */
13
2
  export { Code, Dispatcher, get_dispatcher } from "./generated/dispatcher.js";
3
+ export { ToEffect } from "./yieldable.js";
14
4
  export type { DispatcherEvent, MarkupPromiseEvent, MarkupPromiseOptions, MarkupRunEvent, MarkupValueEvent, } from "./generated/dispatcher.js";
5
+ export type { YieldSuccess } from "./yieldable.js";
15
6
  export { value } from "./markup/value.js";
16
7
  export { promise } from "./markup/promise.js";
17
8
  export { run } from "./markup/run.js";
@@ -1,17 +1 @@
1
- /**
2
- * Copies own property descriptors from a native helper to a wrapper while
3
- * skipping function metadata and any caller-specific keys.
4
- *
5
- * @example
6
- * ```ts
7
- * copy_property_descriptors(native_remote, wrapped_remote);
8
- * ```
9
- *
10
- * @since 2.0.0
11
- * @param source - Source object or function whose descriptors should be
12
- * mirrored.
13
- * @param target - Wrapper object or function that receives copied descriptors.
14
- * @param exclude - Additional property keys that should not be copied.
15
- * @returns Nothing.
16
- */
17
1
  export declare function copy_property_descriptors(source: unknown, target: object, exclude?: ReadonlySet<PropertyKey>): void;
@@ -1,6 +1,28 @@
1
- import { i as Code } from "../chunks/dispatcher-pHH4JcFR.js";
2
- import { n as get_dispatcher, t as Dispatcher } from "../chunks/dispatcher-LtvFKYUp.js";
1
+ import { o as EmptyStreamYieldError, p as InvalidYieldableError } from "../chunks/errors-CLsbGjIa.js";
2
+ import { i as Code } from "../chunks/dispatcher-_x0MQZBS.js";
3
+ import { t as RemoteLiveYield } from "../chunks/live-CHK0RrZu.js";
4
+ import { n as get_dispatcher, t as Dispatcher } from "../chunks/dispatcher-BA0PLQhA.js";
3
5
  import { value } from "../markup/value.js";
4
6
  import { promise } from "../markup/promise.js";
5
7
  import { run } from "../markup/run.js";
6
- export { Code, Dispatcher, get_dispatcher, promise, run, value };
8
+ import { Effect, Option, Stream } from "effect";
9
+ //#region src/yieldable.ts
10
+ function ToEffect(value) {
11
+ if (Stream.isStream(value)) {
12
+ const Head = Stream.runHead(value);
13
+ return Effect.provideService(Head, RemoteLiveYield, true).pipe(Effect.flatMap((option) => {
14
+ if (Option.isSome(option)) return Effect.succeed(option.value);
15
+ return Effect.fail(new EmptyStreamYieldError());
16
+ }));
17
+ }
18
+ if (is_generator_result(value)) return Effect.gen(() => value);
19
+ if (Effect.isEffect(value)) return value;
20
+ return Effect.fail(new InvalidYieldableError(value));
21
+ }
22
+ function is_generator_result(value) {
23
+ return typeof value === "object" && value !== null && typeof value.next === "function";
24
+ }
25
+ //#endregion
26
+ export { Code, Dispatcher, ToEffect, get_dispatcher, promise, run, value };
27
+
28
+ //# sourceMappingURL=generators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generators.js","names":[],"sources":["../../../modules/svelte-effect-runtime/src/yieldable.ts"],"sourcesContent":["import { EmptyStreamYieldError, InvalidYieldableError } from \"$/errors.ts\";\nimport { RemoteLiveYield } from \"$/internal/live.ts\";\nimport { Effect, Option, Stream } from \"effect\";\n\nexport type Yieldable<A = unknown, E = unknown, R = unknown> =\n\t| Effect.Effect<A, E, R>\n\t| Effect.gen.Return<A, E, R>\n\t| Stream.Stream<A, E, R>;\n\nexport type YieldSuccess<Value> =\n\tValue extends Stream.Stream<infer A, unknown, unknown>\n\t\t? A\n\t\t: Value extends Effect.Effect<infer A, unknown, unknown>\n\t\t\t? A\n\t\t\t: Value extends Effect.gen.Return<infer A, unknown, unknown>\n\t\t\t\t? A\n\t\t\t\t: never;\n\n/** Normalizes generated Effect and generator values at the transform ABI boundary. */\nexport function ToEffect<A, E, R>(\n\tvalue: Effect.Effect<A, E, R> | Effect.gen.Return<A, E, R>,\n): Effect.Effect<A, E, R>;\nexport function ToEffect<A, E, R>(\n\tvalue: Stream.Stream<A, E, R>,\n): Effect.Effect<A, E | EmptyStreamYieldError, R>;\nexport function ToEffect<A, E, R>(\n\tvalue: Yieldable<A, E, R>,\n): Effect.Effect<A, E | EmptyStreamYieldError, R> {\n\tif (Stream.isStream(value)) {\n\t\tconst Head = Stream.runHead(value);\n\t\tconst ResolveHead = Effect.provideService(Head, RemoteLiveYield, true);\n\n\t\treturn ResolveHead.pipe(\n\t\t\tEffect.flatMap((option) => {\n\t\t\t\tif (Option.isSome(option)) {\n\t\t\t\t\treturn Effect.succeed(option.value);\n\t\t\t\t}\n\n\t\t\t\treturn Effect.fail(new EmptyStreamYieldError());\n\t\t\t}),\n\t\t);\n\t}\n\n\tif (is_generator_result<A, E, R>(value)) {\n\t\treturn Effect.gen(() => value) as Effect.Effect<A, E, R>;\n\t}\n\n\tif (Effect.isEffect(value)) {\n\t\treturn value;\n\t}\n\n\treturn Effect.fail(new InvalidYieldableError(value));\n}\n\nfunction is_generator_result<A, E, R>(value: unknown): value is Effect.gen.Return<A, E, R> {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\ttypeof (value as { next?: unknown }).next === \"function\"\n\t);\n}\n"],"mappings":";;;;;;;;;AAyBA,SAAgB,SACf,OACiD;CACjD,IAAI,OAAO,SAAS,KAAK,GAAG;EAC3B,MAAM,OAAO,OAAO,QAAQ,KAAK;EAGjC,OAFoB,OAAO,eAAe,MAAM,iBAAiB,IAEhD,CAAC,CAAC,KAClB,OAAO,SAAS,WAAW;GAC1B,IAAI,OAAO,OAAO,MAAM,GACvB,OAAO,OAAO,QAAQ,OAAO,KAAK;GAGnC,OAAO,OAAO,KAAK,IAAI,sBAAsB,CAAC;EAC/C,CAAC,CACF;CACD;CAEA,IAAI,oBAA6B,KAAK,GACrC,OAAO,OAAO,UAAU,KAAK;CAG9B,IAAI,OAAO,SAAS,KAAK,GACxB,OAAO;CAGR,OAAO,OAAO,KAAK,IAAI,sBAAsB,KAAK,CAAC;AACpD;AAEA,SAAS,oBAA6B,OAAqD;CAC1F,OACC,OAAO,UAAU,YACjB,UAAU,QACV,OAAQ,MAA6B,SAAS;AAEhD"}
@@ -0,0 +1,9 @@
1
+ import { Context } from "effect";
2
+ /** Brands remote live streams without relying on class identity. */
3
+ export declare const remote_live_stream: unique symbol;
4
+ /** Selects the cached-first live source while generated yields resolve. */
5
+ export declare const RemoteLiveYield: Context.Reference<boolean>;
6
+ /** Internal carrier that identifies a remote live Stream. */
7
+ export type RemoteLiveStreamCarrier = {
8
+ readonly [remote_live_stream]?: true;
9
+ };
@@ -1,2 +1,2 @@
1
- import { i as create_remote_command_adapter, n as create_remote_query_adapter, r as create_remote_form_adapter, t as create_remote_live_query_adapter } from "../chunks/client-CsVu54pU.js";
2
- export { create_remote_command_adapter, create_remote_form_adapter, create_remote_live_query_adapter, create_remote_query_adapter };
1
+ import { a as create_remote_command_adapter, i as create_remote_form_adapter, n as create_remote_query_adapter, r as create_remote_prerender_adapter, t as create_remote_live_query_adapter } from "../chunks/client-BrZka6DW.js";
2
+ export { create_remote_command_adapter, create_remote_form_adapter, create_remote_live_query_adapter, create_remote_prerender_adapter, create_remote_query_adapter };
@@ -1,2 +1,2 @@
1
- import { encode_remote_failure, normalize_remote_helper_error, run_remote_effect, throw_form_error } from "../remote/server.js";
2
- export { encode_remote_failure, normalize_remote_helper_error, run_remote_effect, throw_form_error };
1
+ import { a as encode_remote_failure, i as throw_remote_cause, n as run_remote_effect, r as throw_form_error, t as normalize_remote_helper_error } from "../chunks/server-BNrA1I-u.js";
2
+ export { encode_remote_failure, normalize_remote_helper_error, run_remote_effect, throw_form_error, throw_remote_cause };
@@ -0,0 +1,13 @@
1
+ import { Schema } from "effect";
2
+ export type StandardSchema = {
3
+ readonly "~standard": {
4
+ readonly types?: {
5
+ readonly input: unknown;
6
+ readonly output: unknown;
7
+ };
8
+ readonly validate: (input: unknown) => unknown;
9
+ };
10
+ };
11
+ export declare function is_standard_schema(value: unknown): value is StandardSchema;
12
+ export declare function is_effect_schema(value: unknown): value is Schema.Schema<unknown>;
13
+ export declare function normalize_validator(value: unknown): unknown;
@@ -0,0 +1,106 @@
1
+ import { remote_live_stream } from "./internal/live.js";
2
+ import type { RemoteFailure } from "./remote/shared.js";
3
+ import { Effect, Stream } from "effect";
4
+ declare const live_operator: unique symbol;
5
+ type RemoteLivePipe<A, E> = {
6
+ (): RemoteLiveStream<A, E>;
7
+ (ab: LiveFactory["status"]): Stream.Stream<LiveStatus, never, never>;
8
+ (ab: LiveFactory["reconnect"]): Effect.Effect<void, RemoteFailure<E>, never>;
9
+ <B>(ab: LiveFactory["status"], bc: (_: Stream.Stream<LiveStatus, never, never>) => B): B;
10
+ <B>(ab: LiveFactory["reconnect"], bc: (_: Effect.Effect<void, RemoteFailure<E>, never>) => B): B;
11
+ <B, C>(ab: LiveFactory["status"], bc: (_: Stream.Stream<LiveStatus, never, never>) => B, cd: (_: B) => C): C;
12
+ <B, C>(ab: LiveFactory["reconnect"], bc: (_: Effect.Effect<void, RemoteFailure<E>, never>) => B, cd: (_: B) => C): C;
13
+ <B>(ab: (_: Stream.Stream<A, RemoteFailure<E>, never>) => Stream.Stream<B, RemoteFailure<E>, never>): RemoteLiveStream<B, E>;
14
+ <B>(ab: (_: Stream.Stream<A, RemoteFailure<E>, never>) => B): B;
15
+ <B, C>(ab: (_: Stream.Stream<A, RemoteFailure<E>, never>) => B, bc: (_: B) => C): C;
16
+ <B, C, D>(ab: (_: Stream.Stream<A, RemoteFailure<E>, never>) => B, bc: (_: B) => C, cd: (_: C) => D): D;
17
+ };
18
+ /**
19
+ * Stream returned by `Query.live` remote functions.
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * const Time = GetTime();
24
+ * const Label = Time.pipe(Stream.map((time) => time.toISOString()));
25
+ * ```
26
+ *
27
+ * @since 3.4.8
28
+ */
29
+ export type RemoteLiveStream<A, E = never> = Omit<Stream.Stream<A, RemoteFailure<E>, never>, "pipe"> & {
30
+ readonly [remote_live_stream]: true;
31
+ readonly pipe: RemoteLivePipe<A, E>;
32
+ };
33
+ /**
34
+ * Transport state exposed separately from the data stream.
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * const Status = GetTime().pipe(Live.status);
39
+ * ```
40
+ *
41
+ * @since 3.4.8
42
+ */
43
+ export type LiveStatus = {
44
+ readonly _tag: "Idle";
45
+ } | {
46
+ readonly _tag: "Connecting";
47
+ } | {
48
+ readonly _tag: "Open";
49
+ } | {
50
+ readonly _tag: "Failed";
51
+ readonly cause: unknown;
52
+ } | {
53
+ readonly _tag: "Closed";
54
+ };
55
+ /**
56
+ * Public live stream control helpers.
57
+ *
58
+ * @example
59
+ * ```ts
60
+ * yield* GetNotifications().pipe(Live.reconnect);
61
+ * ```
62
+ *
63
+ * @since 3.4.8
64
+ */
65
+ export interface LiveFactory {
66
+ readonly status: {
67
+ readonly [live_operator]: true;
68
+ /**
69
+ * Creates a stream of transport status updates for a remote live stream.
70
+ *
71
+ * @example
72
+ * ```ts
73
+ * const Status = GetTime().pipe(Live.status);
74
+ * ```
75
+ *
76
+ * @param stream - Remote live stream whose transport status should be read.
77
+ * @returns A stream of transport status snapshots.
78
+ */
79
+ <A, E>(stream: RemoteLiveStream<A, E>): Stream.Stream<LiveStatus, never, never>;
80
+ };
81
+ readonly reconnect: {
82
+ readonly [live_operator]: true;
83
+ /**
84
+ * Reconnects the transport behind a remote live stream.
85
+ *
86
+ * @example
87
+ * ```ts
88
+ * yield* GetNotifications().pipe(Live.reconnect);
89
+ * ```
90
+ *
91
+ * @param stream - Remote live stream whose transport should reconnect.
92
+ * @returns An Effect that completes after the reconnect request is sent.
93
+ */
94
+ <A, E>(stream: RemoteLiveStream<A, E>): Effect.Effect<void, RemoteFailure<E>, never>;
95
+ };
96
+ }
97
+ export declare function make_remote_live_stream<A, ErrorType = never>(resource: unknown, on_error: (error: unknown) => RemoteFailure<ErrorType>, encode_snapshot?: (value: unknown) => string): RemoteLiveStream<A, ErrorType>;
98
+ export declare function make_failed_remote_live_stream<A, ErrorType = never>(error: unknown, on_error: (error: unknown) => RemoteFailure<ErrorType>): RemoteLiveStream<A, ErrorType>;
99
+ /**
100
+ * Remote live transport helpers.
101
+ *
102
+ * @since 3.4.8
103
+ */
104
+ export declare const Live: LiveFactory;
105
+ export declare function get_native_remote_live_resource(value: unknown): unknown | undefined;
106
+ export {};
@@ -1,29 +1,6 @@
1
- /**
2
- * Checks whether a Svelte attribute name should be treated as an event handler
3
- * boundary for markup effect lowering.
4
- *
5
- * @example
6
- * ```ts
7
- * is_event_attribute_name("onChange");
8
- * ```
9
- *
10
- * @since 3.4.11
11
- * @param name - Attribute name read from Svelte source or the parsed AST.
12
- * @returns Whether the attribute is an event-like Svelte handler attribute.
13
- */
14
- export declare function is_event_attribute_name(name: string): boolean;
15
- /**
16
- * Normalizes an event-like attribute name to Svelte's lowercase DOM event
17
- * spelling while keeping the legacy directive prefix intact.
18
- *
19
- * @example
20
- * ```ts
21
- * normalize_event_attribute_name("onChange");
22
- * ```
23
- *
24
- * @since 3.4.11
25
- * @param name - Event-like attribute name read from Svelte source or the
26
- * parsed AST.
27
- * @returns Lowercase event attribute spelling for DOM-facing Svelte nodes.
28
- */
1
+ export declare function is_svelte_event_attribute(attribute: {
2
+ type: string;
3
+ name?: string;
4
+ value?: unknown;
5
+ }): boolean;
29
6
  export declare function normalize_event_attribute_name(name: string): string;