svelte-effect-runtime 3.0.1 → 3.1.0
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/chunks/{client-Cruhk6Oo.js → client-DRjQiULJ.js} +10 -9
- package/.dist/chunks/client-DRjQiULJ.js.map +1 -0
- package/.dist/chunks/{dispatcher-FCsx1Hlh.js → dispatcher-CLSN-Cxn.js} +3 -3
- package/.dist/chunks/{dispatcher-FCsx1Hlh.js.map → dispatcher-CLSN-Cxn.js.map} +1 -1
- package/.dist/chunks/{dispatcher-CgCdn6bj.js → dispatcher-CZvLODNK.js} +4 -3
- package/.dist/chunks/dispatcher-CZvLODNK.js.map +1 -0
- package/.dist/chunks/errors-DppSJ83S.js +692 -0
- package/.dist/chunks/errors-DppSJ83S.js.map +1 -0
- package/.dist/chunks/{runtime-Sl685BVb.js → runtime-BgCRz_rL.js} +4 -3
- package/.dist/chunks/runtime-BgCRz_rL.js.map +1 -0
- package/.dist/chunks/{transform-CebZMD6u.js → transform-B7_CCcvq.js} +16 -219
- package/.dist/chunks/transform-B7_CCcvq.js.map +1 -0
- package/.dist/dispatcher.js +1 -1
- package/.dist/errors.d.ts +544 -0
- package/.dist/internal/generators.js +1 -1
- package/.dist/internal/remote-client.js +1 -1
- package/.dist/markup/promise.d.ts +17 -3
- package/.dist/markup/promise.js +15 -4
- package/.dist/markup/promise.js.map +1 -1
- package/.dist/markup/run.js +1 -1
- package/.dist/markup/transform.js +1 -1
- package/.dist/markup/value.d.ts +3 -3
- package/.dist/markup/value.js +8 -4
- package/.dist/markup/value.js.map +1 -1
- package/.dist/mod.d.ts +1 -0
- package/.dist/mod.js +4 -3
- package/.dist/mod.js.map +1 -1
- package/.dist/remote/client.js +1 -1
- package/.dist/remote/server.js +3 -2
- package/.dist/remote/server.js.map +1 -1
- package/.dist/runtime/transform.js +2 -1
- package/.dist/runtime/transform.js.map +1 -1
- package/.dist/server.js +12 -11
- package/.dist/server.js.map +1 -1
- package/package.json +1 -1
- package/.dist/chunks/client-Cruhk6Oo.js.map +0 -1
- package/.dist/chunks/dispatcher-CgCdn6bj.js.map +0 -1
- package/.dist/chunks/runtime-Sl685BVb.js.map +0 -1
- package/.dist/chunks/transform-CebZMD6u.js.map +0 -1
- package/.dist/error.d.ts +0 -140
|
@@ -0,0 +1,544 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base class for runtime-authored errors. The class gives every local failure
|
|
3
|
+
* a stable JavaScript error name while preserving the technical message that
|
|
4
|
+
* reaches Vite, SvelteKit, and test output.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* throw new RuntimeError("Invariant violated.");
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* @since 2.4.0
|
|
12
|
+
* @param message - Technical diagnostic message describing the failed runtime
|
|
13
|
+
* invariant.
|
|
14
|
+
* @returns A runtime-authored Error instance.
|
|
15
|
+
*/
|
|
16
|
+
export declare class RuntimeError extends Error {
|
|
17
|
+
constructor(message: string);
|
|
18
|
+
}
|
|
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
|
+
export declare function make_error_message(code: string, message: string): string;
|
|
33
|
+
/**
|
|
34
|
+
* Base error class for all preprocessor errors emitted during script and
|
|
35
|
+
* markup transformation. Carries the source filename so error messages can
|
|
36
|
+
* reference the affected file.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* throw new PreprocessError("Component.svelte: invalid transform input.", "Component.svelte");
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @since 2.0.0
|
|
44
|
+
* @param message - Technical diagnostic message for the transform failure.
|
|
45
|
+
* @param filename - Source filename that triggered the transform failure.
|
|
46
|
+
* @returns A preprocessor Error instance with source file context.
|
|
47
|
+
*/
|
|
48
|
+
export declare class PreprocessError extends RuntimeError {
|
|
49
|
+
/**
|
|
50
|
+
* The source filename that triggered this error.
|
|
51
|
+
*
|
|
52
|
+
* @since 2.0.0
|
|
53
|
+
*/
|
|
54
|
+
readonly filename: string;
|
|
55
|
+
constructor(message: string, filename: string);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Thrown when a statement mixes JavaScript `await` with Effect `yield*` work
|
|
59
|
+
* that must be lowered into an `Effect.gen` program.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```ts
|
|
63
|
+
* throw new AwaitInEffectWorkError("Component.svelte", "const value = await load();");
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* @since 2.0.0
|
|
67
|
+
* @param filename - Source filename containing the unsupported statement.
|
|
68
|
+
* @param statement_text - Full source text for the statement containing
|
|
69
|
+
* mixed async work.
|
|
70
|
+
* @returns A preprocessor Error instance with statement context.
|
|
71
|
+
*/
|
|
72
|
+
export declare class AwaitInEffectWorkError extends PreprocessError {
|
|
73
|
+
/**
|
|
74
|
+
* The full text of the problematic statement containing mixed async work.
|
|
75
|
+
*
|
|
76
|
+
* @since 2.0.0
|
|
77
|
+
*/
|
|
78
|
+
readonly statement_text: string;
|
|
79
|
+
constructor(filename: string, statement_text: string);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Thrown when async Effect work appears inside a Svelte rune position that
|
|
83
|
+
* must stay synchronous.
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```ts
|
|
87
|
+
* throw new AsyncEffectInSyncRuneError("$derived", "$derived(yield* load())", "Component.svelte");
|
|
88
|
+
* ```
|
|
89
|
+
*
|
|
90
|
+
* @since 2.0.0
|
|
91
|
+
* @param rune_name - Name of the Svelte rune containing the unsupported async
|
|
92
|
+
* Effect work.
|
|
93
|
+
* @param expression_text - Full source text for the rune expression.
|
|
94
|
+
* @param filename - Source filename containing the unsupported rune.
|
|
95
|
+
* @returns A preprocessor Error instance with rune source context.
|
|
96
|
+
*/
|
|
97
|
+
export declare class AsyncEffectInSyncRuneError extends PreprocessError {
|
|
98
|
+
/**
|
|
99
|
+
* The name of the rune that contained async Effect work.
|
|
100
|
+
*
|
|
101
|
+
* @since 2.0.0
|
|
102
|
+
*/
|
|
103
|
+
readonly rune_name: string;
|
|
104
|
+
/**
|
|
105
|
+
* The full text of the expression that triggered the error.
|
|
106
|
+
*
|
|
107
|
+
* @since 2.0.0
|
|
108
|
+
*/
|
|
109
|
+
readonly expression_text: string;
|
|
110
|
+
constructor(rune_name: string, expression_text: string, filename: string);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Thrown when async Effect work appears inside a non-generator callback nested
|
|
114
|
+
* in a markup event handler.
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```ts
|
|
118
|
+
* throw new AsyncEffectInEventCallbackError(
|
|
119
|
+
* "Component.svelte",
|
|
120
|
+
* "Effect.try(() => yield* save())",
|
|
121
|
+
* );
|
|
122
|
+
* ```
|
|
123
|
+
*
|
|
124
|
+
* @since 2.0.0
|
|
125
|
+
* @param filename - Source filename containing the invalid event handler.
|
|
126
|
+
* @param expression_text - Event handler expression that contains the nested
|
|
127
|
+
* unsupported async Effect work.
|
|
128
|
+
* @returns A preprocessor Error instance with event expression context.
|
|
129
|
+
*/
|
|
130
|
+
export declare class AsyncEffectInEventCallbackError extends PreprocessError {
|
|
131
|
+
/**
|
|
132
|
+
* The full text of the problematic event handler body.
|
|
133
|
+
*
|
|
134
|
+
* @since 2.0.0
|
|
135
|
+
*/
|
|
136
|
+
readonly expression_text: string;
|
|
137
|
+
constructor(filename: string, expression_text: string);
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Thrown when an event handler callback contains the old raw `yield*`
|
|
141
|
+
* shorthand. Effectful event handlers must put `yield*` directly in the event
|
|
142
|
+
* attribute so the callback boundary is generated by the markup runtime.
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* ```ts
|
|
146
|
+
* throw new YieldStarInEventCallbackError("Component.svelte", "() => yield* save()");
|
|
147
|
+
* ```
|
|
148
|
+
*
|
|
149
|
+
* @since 2.0.0
|
|
150
|
+
* @param filename - Svelte component filename used to identify where the
|
|
151
|
+
* invalid event handler callback was found.
|
|
152
|
+
* @param expression_text - Original event handler callback text that contained
|
|
153
|
+
* `yield*` and should be rewritten as a direct event Effect expression.
|
|
154
|
+
* @returns A preprocessor Error instance with event callback context.
|
|
155
|
+
*/
|
|
156
|
+
export declare class YieldStarInEventCallbackError extends PreprocessError {
|
|
157
|
+
/**
|
|
158
|
+
* The full text of the problematic event handler callback.
|
|
159
|
+
*
|
|
160
|
+
* @since 2.0.0
|
|
161
|
+
*/
|
|
162
|
+
readonly expression_text: string;
|
|
163
|
+
constructor(filename: string, expression_text: string);
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Thrown when async Effect work appears in a markup position SER cannot lower
|
|
167
|
+
* safely.
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```ts
|
|
171
|
+
* throw new UnsupportedMarkupEffectPositionError(
|
|
172
|
+
* "Component.svelte",
|
|
173
|
+
* "value={yield* load()}",
|
|
174
|
+
* );
|
|
175
|
+
* ```
|
|
176
|
+
*
|
|
177
|
+
* @since 2.4.2
|
|
178
|
+
* @param filename - Source filename containing the unsupported markup.
|
|
179
|
+
* @param expression_text - The unsupported markup expression text.
|
|
180
|
+
* @returns A preprocessor Error instance with markup source context.
|
|
181
|
+
*/
|
|
182
|
+
export declare class UnsupportedMarkupEffectPositionError extends PreprocessError {
|
|
183
|
+
/**
|
|
184
|
+
* The unsupported markup expression text.
|
|
185
|
+
*
|
|
186
|
+
* @since 2.4.2
|
|
187
|
+
*/
|
|
188
|
+
readonly expression_text: string;
|
|
189
|
+
constructor(filename: string, expression_text: string);
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Thrown when the request-scoped SvelteKit event context is read outside a
|
|
193
|
+
* remote handler.
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* ```ts
|
|
197
|
+
* throw new RequestEventUnavailableError();
|
|
198
|
+
* ```
|
|
199
|
+
*
|
|
200
|
+
* @since 2.4.0
|
|
201
|
+
* @returns An Error describing missing request context.
|
|
202
|
+
*/
|
|
203
|
+
export declare class RequestEventUnavailableError extends RuntimeError {
|
|
204
|
+
constructor();
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Thrown when an unchecked Query declaration omits the handler.
|
|
208
|
+
*
|
|
209
|
+
* @example
|
|
210
|
+
* ```ts
|
|
211
|
+
* throw new UncheckedQueryHandlerMissingError();
|
|
212
|
+
* ```
|
|
213
|
+
*
|
|
214
|
+
* @since 2.4.0
|
|
215
|
+
* @returns An Error describing the invalid Query overload usage.
|
|
216
|
+
*/
|
|
217
|
+
export declare class UncheckedQueryHandlerMissingError extends RuntimeError {
|
|
218
|
+
constructor();
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Thrown when a batch Query declaration omits the batch handler.
|
|
222
|
+
*
|
|
223
|
+
* @example
|
|
224
|
+
* ```ts
|
|
225
|
+
* throw new BatchQueryHandlerMissingError();
|
|
226
|
+
* ```
|
|
227
|
+
*
|
|
228
|
+
* @since 2.4.0
|
|
229
|
+
* @returns An Error describing the invalid batch Query overload usage.
|
|
230
|
+
*/
|
|
231
|
+
export declare class BatchQueryHandlerMissingError extends RuntimeError {
|
|
232
|
+
constructor();
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Thrown when an unchecked live Query declaration omits the handler.
|
|
236
|
+
*
|
|
237
|
+
* @example
|
|
238
|
+
* ```ts
|
|
239
|
+
* throw new UncheckedLiveQueryHandlerMissingError();
|
|
240
|
+
* ```
|
|
241
|
+
*
|
|
242
|
+
* @since 2.4.0
|
|
243
|
+
* @returns An Error describing the invalid live Query overload usage.
|
|
244
|
+
*/
|
|
245
|
+
export declare class UncheckedLiveQueryHandlerMissingError extends RuntimeError {
|
|
246
|
+
constructor();
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Thrown when an unchecked Command declaration omits the handler.
|
|
250
|
+
*
|
|
251
|
+
* @example
|
|
252
|
+
* ```ts
|
|
253
|
+
* throw new UncheckedCommandHandlerMissingError();
|
|
254
|
+
* ```
|
|
255
|
+
*
|
|
256
|
+
* @since 2.4.0
|
|
257
|
+
* @returns An Error describing the invalid Command overload usage.
|
|
258
|
+
*/
|
|
259
|
+
export declare class UncheckedCommandHandlerMissingError extends RuntimeError {
|
|
260
|
+
constructor();
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Thrown when an unchecked Form declaration omits the handler.
|
|
264
|
+
*
|
|
265
|
+
* @example
|
|
266
|
+
* ```ts
|
|
267
|
+
* throw new UncheckedFormHandlerMissingError();
|
|
268
|
+
* ```
|
|
269
|
+
*
|
|
270
|
+
* @since 2.4.0
|
|
271
|
+
* @returns An Error describing the invalid Form overload usage.
|
|
272
|
+
*/
|
|
273
|
+
export declare class UncheckedFormHandlerMissingError extends RuntimeError {
|
|
274
|
+
constructor();
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Thrown when an unchecked Prerender declaration omits the handler.
|
|
278
|
+
*
|
|
279
|
+
* @example
|
|
280
|
+
* ```ts
|
|
281
|
+
* throw new UncheckedPrerenderHandlerMissingError();
|
|
282
|
+
* ```
|
|
283
|
+
*
|
|
284
|
+
* @since 2.4.0
|
|
285
|
+
* @returns An Error describing the invalid Prerender overload usage.
|
|
286
|
+
*/
|
|
287
|
+
export declare class UncheckedPrerenderHandlerMissingError extends RuntimeError {
|
|
288
|
+
constructor();
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Thrown when a live query handler resolves to a value that cannot be streamed.
|
|
292
|
+
*
|
|
293
|
+
* @example
|
|
294
|
+
* ```ts
|
|
295
|
+
* throw new InvalidLiveQueryReturnError();
|
|
296
|
+
* ```
|
|
297
|
+
*
|
|
298
|
+
* @since 2.4.0
|
|
299
|
+
* @returns An Error describing the expected live query return protocol.
|
|
300
|
+
*/
|
|
301
|
+
export declare class InvalidLiveQueryReturnError extends RuntimeError {
|
|
302
|
+
constructor();
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Thrown when a dispatcher operation is requested after disposal.
|
|
306
|
+
*
|
|
307
|
+
* @example
|
|
308
|
+
* ```ts
|
|
309
|
+
* throw new DispatcherDisposedError();
|
|
310
|
+
* ```
|
|
311
|
+
*
|
|
312
|
+
* @since 2.4.0
|
|
313
|
+
* @returns An Error describing an invalid dispatcher lifecycle transition.
|
|
314
|
+
*/
|
|
315
|
+
export declare class DispatcherDisposedError extends RuntimeError {
|
|
316
|
+
constructor();
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Thrown when a generated or native remote query export is not callable.
|
|
320
|
+
*
|
|
321
|
+
* @example
|
|
322
|
+
* ```ts
|
|
323
|
+
* throw new InvalidQueryFactoryError();
|
|
324
|
+
* ```
|
|
325
|
+
*
|
|
326
|
+
* @since 2.4.0
|
|
327
|
+
* @returns An Error describing an invalid query adapter input.
|
|
328
|
+
*/
|
|
329
|
+
export declare class InvalidQueryFactoryError extends RuntimeError {
|
|
330
|
+
constructor();
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Thrown when a generated or native remote live query export is not callable.
|
|
334
|
+
*
|
|
335
|
+
* @example
|
|
336
|
+
* ```ts
|
|
337
|
+
* throw new InvalidLiveQueryFactoryError();
|
|
338
|
+
* ```
|
|
339
|
+
*
|
|
340
|
+
* @since 2.4.0
|
|
341
|
+
* @returns An Error describing an invalid live query adapter input.
|
|
342
|
+
*/
|
|
343
|
+
export declare class InvalidLiveQueryFactoryError extends RuntimeError {
|
|
344
|
+
constructor();
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Thrown when a generated or native remote command export is not callable.
|
|
348
|
+
*
|
|
349
|
+
* @example
|
|
350
|
+
* ```ts
|
|
351
|
+
* throw new InvalidCommandFactoryError();
|
|
352
|
+
* ```
|
|
353
|
+
*
|
|
354
|
+
* @since 2.4.0
|
|
355
|
+
* @returns An Error describing an invalid command adapter input.
|
|
356
|
+
*/
|
|
357
|
+
export declare class InvalidCommandFactoryError extends RuntimeError {
|
|
358
|
+
constructor();
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Thrown when the client-side form adapter cannot derive a remote endpoint.
|
|
362
|
+
*
|
|
363
|
+
* @example
|
|
364
|
+
* ```ts
|
|
365
|
+
* throw new RemoteFormEndpointMissingError();
|
|
366
|
+
* ```
|
|
367
|
+
*
|
|
368
|
+
* @since 2.4.0
|
|
369
|
+
* @returns An Error describing missing form transport metadata.
|
|
370
|
+
*/
|
|
371
|
+
export declare class RemoteFormEndpointMissingError extends RuntimeError {
|
|
372
|
+
constructor();
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Thrown when a remote form response envelope is not an object with a response
|
|
376
|
+
* type.
|
|
377
|
+
*
|
|
378
|
+
* @example
|
|
379
|
+
* ```ts
|
|
380
|
+
* throw new InvalidRemoteFormResponseError(envelope);
|
|
381
|
+
* ```
|
|
382
|
+
*
|
|
383
|
+
* @since 2.4.0
|
|
384
|
+
* @param envelope - Raw response envelope returned by the remote form endpoint.
|
|
385
|
+
* @returns An Error describing malformed form response data.
|
|
386
|
+
*/
|
|
387
|
+
export declare class InvalidRemoteFormResponseError extends RuntimeError {
|
|
388
|
+
/**
|
|
389
|
+
* Raw response envelope returned by the remote form endpoint.
|
|
390
|
+
*
|
|
391
|
+
* @since 2.4.0
|
|
392
|
+
*/
|
|
393
|
+
readonly envelope: unknown;
|
|
394
|
+
constructor(envelope?: unknown);
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Thrown when a remote form response has a well-formed envelope but an
|
|
398
|
+
* unsupported response type or payload slot.
|
|
399
|
+
*
|
|
400
|
+
* @example
|
|
401
|
+
* ```ts
|
|
402
|
+
* throw new UnsupportedRemoteFormResponseError(envelope);
|
|
403
|
+
* ```
|
|
404
|
+
*
|
|
405
|
+
* @since 2.4.0
|
|
406
|
+
* @param envelope - Raw response envelope returned by the remote form endpoint.
|
|
407
|
+
* @returns An Error describing unsupported form response data.
|
|
408
|
+
*/
|
|
409
|
+
export declare class UnsupportedRemoteFormResponseError extends RuntimeError {
|
|
410
|
+
/**
|
|
411
|
+
* Raw response envelope returned by the remote form endpoint.
|
|
412
|
+
*
|
|
413
|
+
* @since 2.4.0
|
|
414
|
+
*/
|
|
415
|
+
readonly envelope: unknown;
|
|
416
|
+
constructor(envelope?: unknown);
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* Thrown when a serialized remote failure envelope cannot be decoded.
|
|
420
|
+
*
|
|
421
|
+
* @example
|
|
422
|
+
* ```ts
|
|
423
|
+
* throw new RemoteErrorDecodeError(raw);
|
|
424
|
+
* ```
|
|
425
|
+
*
|
|
426
|
+
* @since 2.4.0
|
|
427
|
+
* @param raw - Raw serialized remote failure payload that failed decoding.
|
|
428
|
+
* @returns An Error describing a malformed remote failure payload.
|
|
429
|
+
*/
|
|
430
|
+
export declare class RemoteErrorDecodeError extends RuntimeError {
|
|
431
|
+
/**
|
|
432
|
+
* Raw serialized remote failure payload that failed decoding.
|
|
433
|
+
*
|
|
434
|
+
* @since 2.4.0
|
|
435
|
+
*/
|
|
436
|
+
readonly raw: unknown;
|
|
437
|
+
constructor(raw?: unknown);
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Thrown when a root server-only helper is imported without Vite rewriting.
|
|
441
|
+
*
|
|
442
|
+
* @example
|
|
443
|
+
* ```ts
|
|
444
|
+
* throw new ServerOnlyImportError("Query");
|
|
445
|
+
* ```
|
|
446
|
+
*
|
|
447
|
+
* @since 2.4.0
|
|
448
|
+
* @param export_name - Name of the server-only root export that was invoked.
|
|
449
|
+
* @returns An Error describing a missing server rewrite.
|
|
450
|
+
*/
|
|
451
|
+
export declare class ServerOnlyImportError extends RuntimeError {
|
|
452
|
+
/**
|
|
453
|
+
* Name of the server-only root export that was invoked.
|
|
454
|
+
*
|
|
455
|
+
* @since 2.4.0
|
|
456
|
+
*/
|
|
457
|
+
readonly export_name: string;
|
|
458
|
+
constructor(export_name: string);
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Thrown when the publish-time `$app/server` shim executes outside SvelteKit.
|
|
462
|
+
*
|
|
463
|
+
* @example
|
|
464
|
+
* ```ts
|
|
465
|
+
* throw new SvelteKitServerExportUnavailableError("query");
|
|
466
|
+
* ```
|
|
467
|
+
*
|
|
468
|
+
* @since 2.4.0
|
|
469
|
+
* @param export_name - Name of the `$app/server` export that was invoked.
|
|
470
|
+
* @returns An Error describing an unavailable SvelteKit virtual module export.
|
|
471
|
+
*/
|
|
472
|
+
export declare class SvelteKitServerExportUnavailableError extends RuntimeError {
|
|
473
|
+
/**
|
|
474
|
+
* Name of the `$app/server` export that was invoked.
|
|
475
|
+
*
|
|
476
|
+
* @since 2.4.0
|
|
477
|
+
*/
|
|
478
|
+
readonly export_name: string;
|
|
479
|
+
constructor(export_name: string);
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* Thrown when a SvelteKit remote helper reports that it was called outside the
|
|
483
|
+
* route-scoped remote module context.
|
|
484
|
+
*
|
|
485
|
+
* @example
|
|
486
|
+
* ```ts
|
|
487
|
+
* throw new RemoteHelperContextError("Query");
|
|
488
|
+
* ```
|
|
489
|
+
*
|
|
490
|
+
* @since 2.4.0
|
|
491
|
+
* @param helper_name - SER helper name that triggered the context failure.
|
|
492
|
+
* @returns An Error describing the required `.remote.ts` placement.
|
|
493
|
+
*/
|
|
494
|
+
export declare class RemoteHelperContextError extends RuntimeError {
|
|
495
|
+
/**
|
|
496
|
+
* SER helper name that triggered the context failure.
|
|
497
|
+
*
|
|
498
|
+
* @since 2.4.0
|
|
499
|
+
*/
|
|
500
|
+
readonly helper_name: string;
|
|
501
|
+
constructor(helper_name: string);
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* Thrown when a SvelteKit remote helper normalizes a non-Error thrown value.
|
|
505
|
+
*
|
|
506
|
+
* @example
|
|
507
|
+
* ```ts
|
|
508
|
+
* throw new RemoteHelperError("raw failure");
|
|
509
|
+
* ```
|
|
510
|
+
*
|
|
511
|
+
* @since 2.4.0
|
|
512
|
+
* @param value - Non-Error value thrown while creating a remote helper.
|
|
513
|
+
* @returns An Error preserving the remote helper failure value.
|
|
514
|
+
*/
|
|
515
|
+
export declare class RemoteHelperError extends RuntimeError {
|
|
516
|
+
/**
|
|
517
|
+
* Non-Error value that was normalized.
|
|
518
|
+
*
|
|
519
|
+
* @since 2.4.0
|
|
520
|
+
*/
|
|
521
|
+
readonly value: unknown;
|
|
522
|
+
constructor(value: unknown);
|
|
523
|
+
}
|
|
524
|
+
/**
|
|
525
|
+
* Thrown when a non-Error value must be normalized into an Error instance.
|
|
526
|
+
*
|
|
527
|
+
* @example
|
|
528
|
+
* ```ts
|
|
529
|
+
* throw new UnknownRuntimeError("raw failure");
|
|
530
|
+
* ```
|
|
531
|
+
*
|
|
532
|
+
* @since 2.4.0
|
|
533
|
+
* @param value - Non-Error value that needs Error normalization.
|
|
534
|
+
* @returns An Error preserving the string representation of an unknown value.
|
|
535
|
+
*/
|
|
536
|
+
export declare class UnknownRuntimeError extends RuntimeError {
|
|
537
|
+
/**
|
|
538
|
+
* Non-Error value that was normalized.
|
|
539
|
+
*
|
|
540
|
+
* @since 2.4.0
|
|
541
|
+
*/
|
|
542
|
+
readonly value: unknown;
|
|
543
|
+
constructor(value: unknown);
|
|
544
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as get_dispatcher } from "../chunks/dispatcher-
|
|
1
|
+
import { t as get_dispatcher } from "../chunks/dispatcher-CLSN-Cxn.js";
|
|
2
2
|
import { value } from "../markup/value.js";
|
|
3
3
|
import { promise } from "../markup/promise.js";
|
|
4
4
|
import { run } from "../markup/run.js";
|
|
@@ -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-
|
|
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-DRjQiULJ.js";
|
|
2
2
|
export { create_remote_command_adapter, create_remote_form_adapter, create_remote_live_query_adapter, create_remote_query_adapter };
|
|
@@ -1,15 +1,29 @@
|
|
|
1
1
|
import type { Effect } from "effect";
|
|
2
|
+
/**
|
|
3
|
+
* Options for markup promise behavior during server rendering.
|
|
4
|
+
*
|
|
5
|
+
* @since 2.4.0
|
|
6
|
+
*/
|
|
7
|
+
interface MarkupPromiseOptions {
|
|
8
|
+
/** Keep the SSR promise pending so Svelte renders an await block fallback. */
|
|
9
|
+
ssr?: "pending";
|
|
10
|
+
}
|
|
2
11
|
/**
|
|
3
12
|
* Runtime helper emitted by the markup transform for
|
|
4
13
|
* `{#await yield* expr}` blocks. Delegates to the dispatcher's
|
|
5
|
-
* promise mechanism
|
|
6
|
-
*
|
|
14
|
+
* promise mechanism. During SSR it can return a fallback promise without
|
|
15
|
+
* starting the dispatcher.
|
|
7
16
|
*
|
|
8
17
|
* @since 2.0.0
|
|
9
18
|
* @param id - Stable identifier generated from the expression's source
|
|
10
19
|
* position, used for cache lookups.
|
|
11
20
|
* @param deps - Array of reactive dependencies.
|
|
12
21
|
* @param factory - Generator function that yields the effect to run.
|
|
22
|
+
* @param ssr_fallback - Value to resolve during SSR when the helper is used
|
|
23
|
+
* from an awaited expression outside a Svelte await block.
|
|
24
|
+
* @param options - Optional SSR behavior for contexts such as await blocks
|
|
25
|
+
* that should render pending UI.
|
|
13
26
|
* @returns A Promise that resolves with the effect's result.
|
|
14
27
|
*/
|
|
15
|
-
export declare function promise<A, E, R>(id: string, deps: readonly unknown[], factory: () => Effect.gen.Return<A, E, R
|
|
28
|
+
export declare function promise<A, E, R>(id: string, deps: readonly unknown[], factory: () => Effect.gen.Return<A, E, R>, ssr_fallback?: A, options?: MarkupPromiseOptions): Promise<A>;
|
|
29
|
+
export {};
|
package/.dist/markup/promise.js
CHANGED
|
@@ -1,25 +1,36 @@
|
|
|
1
|
-
import { t as get_dispatcher } from "../chunks/dispatcher-
|
|
1
|
+
import { t as get_dispatcher } from "../chunks/dispatcher-CLSN-Cxn.js";
|
|
2
2
|
//#region src/markup/promise.ts
|
|
3
3
|
/**
|
|
4
4
|
* Runtime helper emitted by the markup transform for
|
|
5
5
|
* `{#await yield* expr}` blocks. Delegates to the dispatcher's
|
|
6
|
-
* promise mechanism
|
|
7
|
-
*
|
|
6
|
+
* promise mechanism. During SSR it can return a fallback promise without
|
|
7
|
+
* starting the dispatcher.
|
|
8
8
|
*
|
|
9
9
|
* @since 2.0.0
|
|
10
10
|
* @param id - Stable identifier generated from the expression's source
|
|
11
11
|
* position, used for cache lookups.
|
|
12
12
|
* @param deps - Array of reactive dependencies.
|
|
13
13
|
* @param factory - Generator function that yields the effect to run.
|
|
14
|
+
* @param ssr_fallback - Value to resolve during SSR when the helper is used
|
|
15
|
+
* from an awaited expression outside a Svelte await block.
|
|
16
|
+
* @param options - Optional SSR behavior for contexts such as await blocks
|
|
17
|
+
* that should render pending UI.
|
|
14
18
|
* @returns A Promise that resolves with the effect's result.
|
|
15
19
|
*/
|
|
16
|
-
function promise(id, deps, factory) {
|
|
20
|
+
function promise(id, deps, factory, ssr_fallback, options) {
|
|
21
|
+
if (is_server_render()) {
|
|
22
|
+
if (options?.ssr === "pending") return new Promise(() => {});
|
|
23
|
+
if (arguments.length >= 4) return Promise.resolve(ssr_fallback);
|
|
24
|
+
}
|
|
17
25
|
return get_dispatcher().promise({
|
|
18
26
|
id,
|
|
19
27
|
deps,
|
|
20
28
|
factory
|
|
21
29
|
});
|
|
22
30
|
}
|
|
31
|
+
function is_server_render() {
|
|
32
|
+
return typeof document === "undefined";
|
|
33
|
+
}
|
|
23
34
|
//#endregion
|
|
24
35
|
export { promise };
|
|
25
36
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promise.js","names":[],"sources":["../../../modules/svelte-effect-runtime/src/markup/promise.ts"],"sourcesContent":["import { get_dispatcher } from \"$/generated/dispatcher.ts\";\nimport type { Effect } from \"effect\";\n\n/**\n * Runtime helper emitted by the markup transform for\n * `{#await yield* expr}` blocks. Delegates to the dispatcher's\n * promise mechanism
|
|
1
|
+
{"version":3,"file":"promise.js","names":[],"sources":["../../../modules/svelte-effect-runtime/src/markup/promise.ts"],"sourcesContent":["import { get_dispatcher } from \"$/generated/dispatcher.ts\";\nimport type { Effect } from \"effect\";\n\n/**\n * Options for markup promise behavior during server rendering.\n *\n * @since 2.4.0\n */\ninterface MarkupPromiseOptions {\n /** Keep the SSR promise pending so Svelte renders an await block fallback. */\n ssr?: \"pending\";\n}\n\n/**\n * Runtime helper emitted by the markup transform for\n * `{#await yield* expr}` blocks. Delegates to the dispatcher's\n * promise mechanism. During SSR it can return a fallback promise without\n * starting the dispatcher.\n *\n * @since 2.0.0\n * @param id - Stable identifier generated from the expression's source\n * position, used for cache lookups.\n * @param deps - Array of reactive dependencies.\n * @param factory - Generator function that yields the effect to run.\n * @param ssr_fallback - Value to resolve during SSR when the helper is used\n * from an awaited expression outside a Svelte await block.\n * @param options - Optional SSR behavior for contexts such as await blocks\n * that should render pending UI.\n * @returns A Promise that resolves with the effect's result.\n */\nexport function promise<A, E, R>(\n id: string,\n deps: readonly unknown[],\n factory: () => Effect.gen.Return<A, E, R>,\n ssr_fallback?: A,\n options?: MarkupPromiseOptions,\n): Promise<A> {\n if (is_server_render()) {\n if (options?.ssr === \"pending\") {\n return new Promise<A>(() => {});\n }\n\n if (arguments.length >= 4) {\n return Promise.resolve(ssr_fallback as A);\n }\n }\n\n return get_dispatcher().promise({ id, deps, factory });\n}\n\nfunction is_server_render(): boolean {\n return typeof document === \"undefined\";\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA8BA,SAAgB,QACd,IACA,MACA,SACA,cACA,SACY;CACZ,IAAI,iBAAiB,GAAG;EACtB,IAAI,SAAS,QAAQ,WACnB,OAAO,IAAI,cAAiB,CAAC,CAAC;EAGhC,IAAI,UAAU,UAAU,GACtB,OAAO,QAAQ,QAAQ,YAAiB;CAE5C;CAEA,OAAO,eAAe,EAAE,QAAQ;EAAE;EAAI;EAAM;CAAQ,CAAC;AACvD;AAEA,SAAS,mBAA4B;CACnC,OAAO,OAAO,aAAa;AAC7B"}
|
package/.dist/markup/run.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as transform_markup_effect } from "../chunks/transform-
|
|
1
|
+
import { t as transform_markup_effect } from "../chunks/transform-B7_CCcvq.js";
|
|
2
2
|
export { transform_markup_effect };
|
package/.dist/markup/value.d.ts
CHANGED
|
@@ -3,9 +3,9 @@ import type { Effect } from "effect";
|
|
|
3
3
|
* Runtime helper emitted by the markup transform for `{yield* expr}`
|
|
4
4
|
* expressions in Svelte templates. Delegates to the dispatcher's
|
|
5
5
|
* cached reactive value mechanism — returns the fallback synchronously,
|
|
6
|
-
* then the resolved value once the effect completes
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* then the resolved value once the effect completes in the browser. During
|
|
7
|
+
* SSR the client dispatcher is not touched, so browser-only layers cannot
|
|
8
|
+
* turn server rendering into a 500.
|
|
9
9
|
*
|
|
10
10
|
* @since 2.0.0
|
|
11
11
|
* @param id - Stable identifier generated from the expression's source
|