svelte-effect-runtime 1.6.2 → 2.0.0-beta.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 (174) hide show
  1. package/.dist/chunks/client-BeOE81fW.js +577 -0
  2. package/.dist/chunks/client-BeOE81fW.js.map +1 -0
  3. package/.dist/chunks/descriptors-CU2g4U_i.js +36 -0
  4. package/.dist/chunks/descriptors-CU2g4U_i.js.map +1 -0
  5. package/.dist/chunks/dispatcher-BSg2-ttN.js +339 -0
  6. package/.dist/chunks/dispatcher-BSg2-ttN.js.map +1 -0
  7. package/.dist/chunks/preprocess-BZyUYWY7.js +430 -0
  8. package/.dist/chunks/preprocess-BZyUYWY7.js.map +1 -0
  9. package/.dist/chunks/transform-BtlxgJrg.js +836 -0
  10. package/.dist/chunks/transform-BtlxgJrg.js.map +1 -0
  11. package/.dist/detect.d.ts +34 -0
  12. package/.dist/detect.js +56 -0
  13. package/.dist/detect.js.map +1 -0
  14. package/.dist/dispatcher/deps.d.ts +14 -0
  15. package/.dist/dispatcher/fibers.d.ts +52 -0
  16. package/.dist/dispatcher/index.d.ts +138 -0
  17. package/.dist/dispatcher/types.d.ts +63 -0
  18. package/.dist/dispatcher.d.ts +2 -0
  19. package/.dist/dispatcher.js +2 -0
  20. package/.dist/error.d.ts +77 -0
  21. package/.dist/generators.d.ts +16 -0
  22. package/.dist/internal/descriptors.d.ts +17 -0
  23. package/.dist/internal/generators.d.ts +6 -0
  24. package/.dist/internal/generators.js +5 -0
  25. package/.dist/internal/remote-client.d.ts +6 -0
  26. package/.dist/internal/remote-client.js +2 -0
  27. package/.dist/internal/remote-server.d.ts +6 -0
  28. package/.dist/internal/remote-server.js +2 -0
  29. package/.dist/markup/promise.d.ts +15 -0
  30. package/.dist/markup/promise.js +26 -0
  31. package/.dist/markup/promise.js.map +1 -0
  32. package/.dist/markup/run.d.ts +12 -0
  33. package/.dist/markup/run.js +21 -0
  34. package/.dist/markup/run.js.map +1 -0
  35. package/.dist/markup/transform/apply.d.ts +6 -0
  36. package/.dist/markup/transform/classify.d.ts +15 -0
  37. package/.dist/markup/transform/constants.d.ts +5 -0
  38. package/.dist/markup/transform/emit.d.ts +12 -0
  39. package/.dist/markup/transform/expressions.d.ts +39 -0
  40. package/.dist/markup/transform/index.d.ts +19 -0
  41. package/.dist/markup/transform/scan.d.ts +8 -0
  42. package/.dist/markup/transform/types.d.ts +64 -0
  43. package/.dist/markup/transform.d.ts +1 -0
  44. package/.dist/markup/transform.js +2 -0
  45. package/.dist/markup/value.d.ts +20 -0
  46. package/.dist/markup/value.js +32 -0
  47. package/.dist/markup/value.js.map +1 -0
  48. package/.dist/mod.d.ts +186 -0
  49. package/.dist/mod.js +190 -0
  50. package/.dist/mod.js.map +1 -0
  51. package/.dist/preprocess/ast.d.ts +51 -0
  52. package/.dist/preprocess/imports.d.ts +22 -0
  53. package/.dist/preprocess/index.d.ts +21 -0
  54. package/.dist/preprocess/lower.d.ts +12 -0
  55. package/.dist/preprocess/runtime-block.d.ts +8 -0
  56. package/.dist/preprocess/source.d.ts +29 -0
  57. package/.dist/preprocess/types.d.ts +70 -0
  58. package/.dist/preprocess.d.ts +2 -0
  59. package/.dist/preprocess.js +3 -0
  60. package/.dist/remote/client/command.d.ts +17 -0
  61. package/.dist/remote/client/effect.d.ts +15 -0
  62. package/.dist/remote/client/failures.d.ts +57 -0
  63. package/.dist/remote/client/form-data.d.ts +8 -0
  64. package/.dist/remote/client/form-enhance.d.ts +9 -0
  65. package/.dist/remote/client/form-transport.d.ts +20 -0
  66. package/.dist/remote/client/form.d.ts +21 -0
  67. package/.dist/remote/client/index.d.ts +4 -0
  68. package/.dist/remote/client/query-result.d.ts +14 -0
  69. package/.dist/remote/client/query.d.ts +57 -0
  70. package/.dist/remote/client/responses.d.ts +28 -0
  71. package/.dist/remote/client/types.d.ts +83 -0
  72. package/.dist/remote/client/utils.d.ts +11 -0
  73. package/.dist/remote/client.d.ts +2 -0
  74. package/.dist/remote/client.js +2 -0
  75. package/.dist/remote/server.d.ts +66 -0
  76. package/.dist/remote/server.js +104 -0
  77. package/.dist/remote/server.js.map +1 -0
  78. package/.dist/remote/shared.d.ts +202 -0
  79. package/.dist/remote/shared.js +161 -0
  80. package/.dist/remote/shared.js.map +1 -0
  81. package/.dist/runtime/preprocess.d.ts +38 -0
  82. package/.dist/runtime/preprocess.js +54 -0
  83. package/.dist/runtime/preprocess.js.map +1 -0
  84. package/.dist/server/effects.d.ts +49 -0
  85. package/.dist/server/factories.d.ts +97 -0
  86. package/.dist/server/index.d.ts +3 -0
  87. package/.dist/server/invalid.d.ts +9 -0
  88. package/.dist/server/runtime.d.ts +66 -0
  89. package/.dist/server/schema.d.ts +42 -0
  90. package/.dist/server/types.d.ts +271 -0
  91. package/.dist/server/wrappers.d.ts +45 -0
  92. package/.dist/server.d.ts +2 -0
  93. package/.dist/server.js +527 -0
  94. package/.dist/server.js.map +1 -0
  95. package/.dist/vite.d.ts +42 -0
  96. package/.dist/vite.js +118 -0
  97. package/.dist/vite.js.map +1 -0
  98. package/README.md +2 -0
  99. package/package.json +66 -101
  100. package/dist/chunks/client-vV6UAwoP.js +0 -199
  101. package/dist/chunks/client-vV6UAwoP.js.map +0 -1
  102. package/dist/chunks/effect-Crj3S8Cg.js +0 -51
  103. package/dist/chunks/effect-Crj3S8Cg.js.map +0 -1
  104. package/dist/chunks/effect-compat-BhW0YPIs.js +0 -103
  105. package/dist/chunks/effect-compat-BhW0YPIs.js.map +0 -1
  106. package/dist/chunks/magic-string.es-BnGH-5YR.js +0 -1013
  107. package/dist/chunks/magic-string.es-BnGH-5YR.js.map +0 -1
  108. package/dist/chunks/markup-CkPUZIJt.js +0 -13390
  109. package/dist/chunks/markup-CkPUZIJt.js.map +0 -1
  110. package/dist/chunks/preprocess-BFePqOC6.js +0 -49
  111. package/dist/chunks/preprocess-BFePqOC6.js.map +0 -1
  112. package/dist/chunks/server-Dea1CJuY.js +0 -704
  113. package/dist/chunks/server-Dea1CJuY.js.map +0 -1
  114. package/dist/chunks/v3-D0c0MKPf.js +0 -1
  115. package/dist/chunks/v4-MMhHmzIG.js +0 -1
  116. package/dist/chunks/vite-BlUTKv2u.js +0 -152
  117. package/dist/chunks/vite-BlUTKv2u.js.map +0 -1
  118. package/dist/client.d.ts +0 -1
  119. package/dist/client.js +0 -2
  120. package/dist/effect.d.ts +0 -1
  121. package/dist/effect.js +0 -2
  122. package/dist/internal/app-server-shim.d.ts +0 -8
  123. package/dist/internal/effect-compat.d.ts +0 -21
  124. package/dist/internal/markup.d.ts +0 -11
  125. package/dist/internal/markup.js +0 -2
  126. package/dist/internal/remote-client.d.ts +0 -36
  127. package/dist/internal/remote-client.js +0 -527
  128. package/dist/internal/remote-client.js.map +0 -1
  129. package/dist/internal/remote-shared.d.ts +0 -186
  130. package/dist/internal/remote-shared.js +0 -122
  131. package/dist/internal/remote-shared.js.map +0 -1
  132. package/dist/internal/transform.d.ts +0 -18
  133. package/dist/internal/transform.js +0 -418
  134. package/dist/internal/transform.js.map +0 -1
  135. package/dist/language-server.d.ts +0 -9
  136. package/dist/language-server.js +0 -4
  137. package/dist/mod.d.ts +0 -22
  138. package/dist/mod.js +0 -3
  139. package/dist/preprocess.d.ts +0 -29
  140. package/dist/preprocess.js +0 -20
  141. package/dist/preprocess.js.map +0 -1
  142. package/dist/root-node.d.ts +0 -1
  143. package/dist/root-node.js +0 -63
  144. package/dist/root-node.js.map +0 -1
  145. package/dist/server.d.ts +0 -81
  146. package/dist/server.js +0 -85
  147. package/dist/server.js.map +0 -1
  148. package/dist/v3/client.d.ts +0 -117
  149. package/dist/v3/effect.d.ts +0 -17
  150. package/dist/v3/mod.d.ts +0 -27
  151. package/dist/v3/preprocess.d.ts +0 -28
  152. package/dist/v3/root-node.d.ts +0 -59
  153. package/dist/v3/server.d.ts +0 -297
  154. package/dist/v3/vite.d.ts +0 -46
  155. package/dist/v4/client.d.ts +0 -2
  156. package/dist/v4/effect.d.ts +0 -24
  157. package/dist/v4/effect.js +0 -19
  158. package/dist/v4/effect.js.map +0 -1
  159. package/dist/v4/mod.d.ts +0 -27
  160. package/dist/v4/mod.js +0 -3
  161. package/dist/v4/preprocess.d.ts +0 -34
  162. package/dist/v4/preprocess.js +0 -32
  163. package/dist/v4/preprocess.js.map +0 -1
  164. package/dist/v4/root-node.d.ts +0 -59
  165. package/dist/v4/root-node.js +0 -4
  166. package/dist/v4/server.d.ts +0 -340
  167. package/dist/v4/server.js +0 -71
  168. package/dist/v4/server.js.map +0 -1
  169. package/dist/v4/vite.d.ts +0 -34
  170. package/dist/v4/vite.js +0 -31
  171. package/dist/v4/vite.js.map +0 -1
  172. package/dist/vite.d.ts +0 -31
  173. package/dist/vite.js +0 -24
  174. package/dist/vite.js.map +0 -1
@@ -1,297 +0,0 @@
1
- import type { RemoteForm as SvelteKitRemoteForm, RemoteFormInput as SvelteKitRemoteFormInput } from "@sveltejs/kit";
2
- import { getRequestEvent as get_native_request_event } from "$app/server";
3
- import { Effect, Layer, ManagedRuntime, Schema } from "effect";
4
- import type { Context } from "effect";
5
- import { type FormError } from "../internal/remote-shared.js";
6
- type EffectSchema = Schema.Schema.Any;
7
- /**
8
- * Single entry in a {@link Transport} table. Describes how to encode a value
9
- * of type `T` to a wire payload and decode it back.
10
- *
11
- * @see https://ser.barekey.dev/content/reference/transport
12
- */
13
- export interface Transporter<T = unknown, U = {
14
- value: unknown;
15
- }> {
16
- /** Restore the original value from the wire payload. */
17
- decode: (data: U) => T;
18
- /**
19
- * Encode the value to a wire payload, or return `false` when this transporter
20
- * does not apply to the supplied value.
21
- */
22
- encode: (value: T) => false | U;
23
- }
24
- /**
25
- * Named collection of {@link Transporter}s, passed to devalue so custom types
26
- * survive the client/server round-trip.
27
- *
28
- * @see https://ser.barekey.dev/content/reference/transport
29
- */
30
- export type Transport = Record<string, Transporter>;
31
- /** Alias for SvelteKit's native remote-form input shape. */
32
- export type RemoteFormInput = SvelteKitRemoteFormInput;
33
- /** SvelteKit's native `query` function signature, re-exported for typing. */
34
- export type RemoteQueryFunction<Input, Output> = (arg: OptionalArgument<Input>) => Promise<Output>;
35
- /** SvelteKit's native `command` shape, re-exported for typing. */
36
- export type RemoteCommand<Input, Output> = ((arg: OptionalArgument<Input>) => Promise<Output> & {
37
- updates(...updates: Array<unknown>): Promise<Output>;
38
- }) & {
39
- readonly pending: number;
40
- };
41
- /** SvelteKit's native `prerender` function signature, re-exported for typing. */
42
- export type RemotePrerenderFunction<Input, Output> = (arg: OptionalArgument<Input>) => Promise<Output>;
43
- /** SvelteKit's native `form` shape, re-exported for typing. */
44
- export type RemoteForm<Input extends RemoteFormInput | void, Output> = SvelteKitRemoteForm<Input, Output>;
45
- type RuntimeOperator = (self: Layer.Layer<unknown, unknown, unknown>) => Layer.Layer<unknown, unknown, unknown>;
46
- type RuntimeSeedLayer<Requirements> = Layer.Layer<Requirements, never, Requirements>;
47
- type ProvidedBy<Op> = Op extends (self: RuntimeSeedLayer<infer Requirements>) => Layer.Layer<unknown, unknown, infer Incoming> ? Exclude<Requirements, Incoming> : never;
48
- type ProvidedByAll<Ops extends ReadonlyArray<RuntimeOperator>> = Ops extends readonly [infer Head, ...infer Tail] ? ProvidedBy<Head> | ProvidedByAll<Extract<Tail, ReadonlyArray<RuntimeOperator>>> : never;
49
- type ApplyOperator<Seed, Op> = Op extends (self: Seed) => infer Out ? Out : never;
50
- type ApplyOperators<Seed, Ops extends ReadonlyArray<RuntimeOperator>> = Ops extends readonly [infer Head, ...infer Tail] ? ApplyOperators<ApplyOperator<Seed, Head>, Extract<Tail, ReadonlyArray<RuntimeOperator>>> : Seed;
51
- type FinalRuntimeLayer<Ops extends ReadonlyArray<RuntimeOperator>> = ApplyOperators<RuntimeSeedLayer<ProvidedByAll<Ops>>, Ops> extends infer Out ? Out extends Layer.Layer<unknown, unknown, infer Incoming> ? [Incoming] extends [never] ? Out : never : never : never;
52
- type OptionalArgument<Input> = undefined extends Input ? Input | void : Input;
53
- type SchemaInput<SchemaType extends EffectSchema> = Schema.Schema.Encoded<SchemaType>;
54
- type SchemaOutput<SchemaType extends EffectSchema> = Schema.Schema.Type<SchemaType>;
55
- type FieldHelpers<FormShape, SchemaType> = FormShape extends Record<string, unknown> ? {
56
- [Key in keyof FormShape as Key extends string ? Key : never]: (message: string) => Effect.Effect<never, FormError<SchemaType>, never>;
57
- } : Record<PropertyKey, never>;
58
- /**
59
- * Proxy passed into `Form` handlers for reporting validation issues. Call
60
- * `invalid.form(message)` for a top-level issue, or `invalid.<field>(message)`
61
- * to attach the issue to a specific field declared in the schema.
62
- *
63
- * @see https://ser.barekey.dev/content/remote-functions/form
64
- */
65
- export type Invalid<SchemaType = unknown> = {
66
- /** Attach a top-level form issue with the supplied message. */
67
- form: (message: string) => Effect.Effect<never, FormError<SchemaType>, never>;
68
- } & FieldHelpers<SchemaType extends EffectSchema ? SchemaOutput<SchemaType> : unknown, SchemaType>;
69
- /**
70
- * Shape of an Effect-returning remote `query`. Callable with the validated
71
- * input; exposes the underlying SvelteKit function via `native`.
72
- *
73
- * @see https://ser.barekey.dev/content/remote-functions/query
74
- */
75
- export type EffectQueryFunction<Input, Output, Error = never> = ((arg: OptionalArgument<Input>) => Effect.Effect<Output, import("../internal/remote-shared.js").RemoteFailure<Error>, never>) & {
76
- /** Underlying SvelteKit `query` function, for fallback direct usage. */
77
- native: RemoteQueryFunction<Input, Output>;
78
- };
79
- /**
80
- * Shape of an Effect-returning remote `command`. Callable with the validated
81
- * input; exposes the underlying SvelteKit command via `native` and tracks
82
- * in-flight submissions through `pending`.
83
- *
84
- * @see https://ser.barekey.dev/content/remote-functions/command
85
- */
86
- export type EffectCommand<Input, Output, Error = never> = ((arg: OptionalArgument<Input>) => Effect.Effect<Output, import("../internal/remote-shared.js").RemoteFailure<Error>, never>) & {
87
- /** Underlying SvelteKit `command` function, for fallback direct usage. */
88
- native: RemoteCommand<Input, Output>;
89
- /** Count of currently in-flight invocations of this command. */
90
- readonly pending: number;
91
- };
92
- /**
93
- * Shape of an Effect-returning remote `prerender` function. Callable with the
94
- * validated input; exposes the underlying SvelteKit function via `native`.
95
- *
96
- * @see https://ser.barekey.dev/content/remote-functions/prerender
97
- */
98
- export type EffectPrerenderFunction<Input, Output, Error = never> = ((arg: OptionalArgument<Input>) => Effect.Effect<Output, import("../internal/remote-shared.js").RemoteFailure<Error>, never>) & {
99
- /** Underlying SvelteKit `prerender` function, for fallback direct usage. */
100
- native: RemotePrerenderFunction<Input, Output>;
101
- };
102
- /**
103
- * Shape of an Effect-returning remote `form`. Usable anywhere the native
104
- * SvelteKit form is, with Effect-aware overrides for the surfaces that
105
- * SvelteKit exposes as Promises:
106
- *
107
- * - `submit(data)` runs the form program as an Effect.
108
- * - `enhance(callback)` callback receives an Effect-returning `submit`
109
- * thunk and may itself return an Effect.
110
- * - `validate(options?)` returns an Effect instead of a Promise.
111
- * - `for(id)` recursively returns an `EffectForm`.
112
- *
113
- * @see https://ser.barekey.dev/content/remote-functions/form
114
- */
115
- export type EffectForm<Input extends RemoteFormInput | void, Output, Error = never> = Omit<RemoteForm<Input, Output>, "enhance" | "validate" | "for"> & {
116
- /** Underlying SvelteKit `form` object, for fallback direct usage. */
117
- native: RemoteForm<Input, Output>;
118
- /** Submit the form programmatically and receive the result as an Effect. */
119
- submit(data: OptionalArgument<Input>): Effect.Effect<Output, import("../internal/remote-shared.js").RemoteFailure<Error>, never>;
120
- /**
121
- * Effect-aware version of SvelteKit's `enhance`. The callback receives
122
- * `submit` as a thunk returning an Effect, and may return an Effect
123
- * (which the runtime will run for you) or `void`.
124
- */
125
- enhance(callback: (args: {
126
- readonly form: HTMLFormElement;
127
- readonly data: Input;
128
- readonly submit: () => Effect.Effect<void, import("../internal/remote-shared.js").RemoteFailure<Error>, never>;
129
- }) => Effect.Effect<unknown, unknown, never> | void): {
130
- method: "POST";
131
- action: string;
132
- [attachment: symbol]: (node: HTMLFormElement) => void;
133
- };
134
- /** Effect-returning version of SvelteKit's `validate`. */
135
- validate(options?: {
136
- readonly includeUntouched?: boolean;
137
- readonly preflightOnly?: boolean;
138
- }): Effect.Effect<void, import("../internal/remote-shared.js").RemoteFailure<Error>, never>;
139
- /** Clone the form binding for a specific value - mirrors `RemoteForm.for`. */
140
- for: RemoteForm<Input, Output>["for"] extends (...args: infer Args) => unknown ? (...args: Args) => EffectForm<Input, Output, Error> : never;
141
- };
142
- /**
143
- * Type of the SvelteKit `RequestEvent` exposed through the {@link RequestEvent}
144
- * Effect service.
145
- */
146
- export type RequestEventService = ReturnType<typeof get_native_request_event>;
147
- /**
148
- * Effect `Context.Tag` for the current SvelteKit `RequestEvent`.
149
- *
150
- * Remote functions can `yield* RequestEvent` to access cookies, headers, and
151
- * route state for the active request.
152
- *
153
- * @see https://ser.barekey.dev/content/runtimes/server
154
- */
155
- export declare const RequestEvent: Context.Tag<RequestEventService, RequestEventService>;
156
- interface ServerRuntimeSeed {
157
- pipe(): Layer.Layer<never>;
158
- pipe<const Ops extends readonly [RuntimeOperator, ...Array<RuntimeOperator>]>(...ops: Ops): FinalRuntimeLayer<Ops>;
159
- make(): void;
160
- make<const Ops extends readonly [RuntimeOperator, ...Array<RuntimeOperator>]>(...ops: Ops): void;
161
- }
162
- type ServerManagedRuntime = ManagedRuntime.ManagedRuntime<unknown, unknown>;
163
- /**
164
- * Server-side runtime builder used to provide long-lived Effect services to
165
- * remote functions.
166
- *
167
- * @see https://ser.barekey.dev/content/reference/server-runtime
168
- */
169
- export declare const ServerRuntime: ServerRuntimeSeed;
170
- /**
171
- * Resolve the active server runtime, lazily creating a default empty runtime
172
- * when no explicit one has been registered.
173
- *
174
- * Emitted by generated server-side remote wrappers - users should never
175
- * import this directly.
176
- *
177
- * @internal Internal - do not use.
178
- * @see https://ser.barekey.dev/content/reference/server-runtime
179
- */
180
- export declare function get_server_runtime_or_throw(): ServerManagedRuntime;
181
- /**
182
- * Remap low-level request-store crashes into a clearer setup error when remote
183
- * helpers are evaluated outside SvelteKit's remote-function runtime.
184
- *
185
- * @internal Internal - do not use.
186
- */
187
- export declare function normalize_remote_helper_error(error: unknown): unknown;
188
- /**
189
- * Build a devalue transport table from Effect schemas so remote payloads can
190
- * round-trip custom data across the client/server boundary.
191
- *
192
- * @see https://ser.barekey.dev/content/reference/transport
193
- */
194
- export declare function create_effect_transport<const Schemas extends Record<string, EffectSchema>>(schemas: Schemas): Transport;
195
- /**
196
- * Overload set for the {@link Query} factory. Supports no-arg, `"unchecked"`,
197
- * and Effect.Schema-validated definitions, plus `Query.batch(...)`.
198
- *
199
- * @see https://ser.barekey.dev/content/remote-functions/query
200
- */
201
- export interface EffectQueryFactory {
202
- /** Define a void-input query. */
203
- <Output, ErrorType, Requirements>(fn: () => Effect.Effect<Output, ErrorType, Requirements>): EffectQueryFunction<void, Output, ErrorType>;
204
- /** Define a query that bypasses schema validation. */
205
- <Input, Output, ErrorType, Requirements>(validate: "unchecked", fn: (arg: Input) => Effect.Effect<Output, ErrorType, Requirements>): EffectQueryFunction<Input, Output, ErrorType>;
206
- /** Define a query whose input is validated by an Effect.Schema. */
207
- <SchemaType extends EffectSchema, Output, ErrorType, Requirements>(validate: SchemaType, fn: (arg: SchemaOutput<SchemaType>) => Effect.Effect<Output, ErrorType, Requirements>): EffectQueryFunction<SchemaInput<SchemaType>, Output, ErrorType>;
208
- /** Define a batched query - mirrors SvelteKit's `query.batch`. */
209
- batch: typeof query_batch_factory;
210
- }
211
- type RemotePrerenderInputsGenerator<Input> = (event: RequestEventService) => AsyncIterable<Input> | Iterable<Input>;
212
- declare function query_batch_factory(validate_or_fn: unknown, maybe_fn?: unknown): unknown;
213
- /**
214
- * Define a read-only remote function that returns an `Effect` on the client.
215
- *
216
- * @see https://ser.barekey.dev/content/remote-functions/query
217
- */
218
- export declare const Query: EffectQueryFactory;
219
- /**
220
- * Overload set for the {@link Command} factory. Supports no-arg,
221
- * `"unchecked"`, and Effect.Schema-validated definitions.
222
- *
223
- * @see https://ser.barekey.dev/content/remote-functions/command
224
- */
225
- export interface EffectCommandFactory {
226
- /** Define a void-input command. */
227
- <Output, ErrorType, Requirements>(fn: () => Effect.Effect<Output, ErrorType, Requirements>): EffectCommand<void, Output, ErrorType>;
228
- /** Define a command that bypasses schema validation. */
229
- <Input, Output, ErrorType, Requirements>(validate: "unchecked", fn: (arg: Input) => Effect.Effect<Output, ErrorType, Requirements>): EffectCommand<Input, Output, ErrorType>;
230
- /** Define a command whose input is validated by an Effect.Schema. */
231
- <SchemaType extends EffectSchema, Output, ErrorType, Requirements>(validate: SchemaType, fn: (arg: SchemaOutput<SchemaType>) => Effect.Effect<Output, ErrorType, Requirements>): EffectCommand<SchemaInput<SchemaType>, Output, ErrorType>;
232
- }
233
- /**
234
- * Define a write-oriented remote function that returns an `Effect` on the
235
- * client.
236
- *
237
- * @see https://ser.barekey.dev/content/remote-functions/command
238
- */
239
- export declare const Command: EffectCommandFactory;
240
- /**
241
- * Overload set for the {@link Form} factory. Supports no-arg, `"unchecked"`,
242
- * and Effect.Schema-validated form handlers.
243
- *
244
- * @see https://ser.barekey.dev/content/remote-functions/form
245
- */
246
- export interface EffectFormFactory {
247
- /** Define a form handler with no input data. */
248
- <Output, ErrorType, Requirements>(fn: () => Effect.Effect<Output, ErrorType, Requirements>): EffectForm<void, Output, ErrorType>;
249
- /** Define a form handler that bypasses schema validation. */
250
- <Input extends RemoteFormInput, Output, ErrorType, Requirements>(validate: "unchecked", fn: (args: {
251
- data: Input;
252
- invalid: Invalid;
253
- }) => Effect.Effect<Output, ErrorType | FormError, Requirements>): EffectForm<Input, Output, ErrorType>;
254
- /** Define a form handler whose submitted data is validated by a schema. */
255
- <SchemaType extends EffectSchema, Output, ErrorType, Requirements>(validate: SchemaType, fn: (args: {
256
- data: SchemaOutput<SchemaType>;
257
- invalid: Invalid<SchemaType>;
258
- }) => Effect.Effect<Output, ErrorType | FormError<SchemaType>, Requirements>): EffectForm<SchemaInput<SchemaType> & RemoteFormInput, Output, ErrorType>;
259
- }
260
- /**
261
- * Define a remote form handler that maps submitted data into an Effect
262
- * program.
263
- *
264
- * @see https://ser.barekey.dev/content/remote-functions/form
265
- */
266
- export declare const Form: EffectFormFactory;
267
- /**
268
- * Overload set for the {@link Prerender} factory. Accepts the same three
269
- * validation flavours as the other factories, plus a SvelteKit `options` bag
270
- * with `inputs` / `dynamic` flags.
271
- *
272
- * @see https://ser.barekey.dev/content/remote-functions/prerender
273
- */
274
- export interface EffectPrerenderFactory {
275
- /** Define a void-input prerender function. */
276
- <Output, ErrorType, Requirements>(fn: () => Effect.Effect<Output, ErrorType, Requirements>, options?: {
277
- inputs?: RemotePrerenderInputsGenerator<void>;
278
- dynamic?: boolean;
279
- }): EffectPrerenderFunction<void, Output, ErrorType>;
280
- /** Define a prerender function that bypasses schema validation. */
281
- <Input, Output, ErrorType, Requirements>(validate: "unchecked", fn: (arg: Input) => Effect.Effect<Output, ErrorType, Requirements>, options?: {
282
- inputs?: RemotePrerenderInputsGenerator<Input>;
283
- dynamic?: boolean;
284
- }): EffectPrerenderFunction<Input, Output, ErrorType>;
285
- /** Define a prerender function whose input is validated by a schema. */
286
- <SchemaType extends EffectSchema, Output, ErrorType, Requirements>(validate: SchemaType, fn: (arg: SchemaOutput<SchemaType>) => Effect.Effect<Output, ErrorType, Requirements>, options?: {
287
- inputs?: RemotePrerenderInputsGenerator<SchemaInput<SchemaType>>;
288
- dynamic?: boolean;
289
- }): EffectPrerenderFunction<SchemaInput<SchemaType>, Output, ErrorType>;
290
- }
291
- /**
292
- * Define a prerenderable remote function backed by an Effect program.
293
- *
294
- * @see https://ser.barekey.dev/content/remote-functions/prerender
295
- */
296
- export declare const Prerender: EffectPrerenderFactory;
297
- export {};
package/dist/v3/vite.d.ts DELETED
@@ -1,46 +0,0 @@
1
- /**
2
- * Low-level Vite integration entrypoints for `svelte-effect-runtime`.
3
- *
4
- * @example
5
- * ```ts
6
- * import { svelte_effect_runtime } from "svelte-effect-runtime/vite";
7
- *
8
- * export default {
9
- * plugins: [svelte_effect_runtime()],
10
- * };
11
- * ```
12
- *
13
- * @module
14
- */
15
- import { type Options as SveltePluginOptions } from "@sveltejs/vite-plugin-svelte";
16
- import type { Plugin } from "vite";
17
- import { type EffectPreprocessOptions } from "./preprocess.js";
18
- /** Options for the plain Vite + Svelte preprocess wrapper. */
19
- export interface SvelteEffectRuntimeOptions {
20
- effect?: EffectPreprocessOptions;
21
- svelte?: SveltePluginOptions;
22
- }
23
- /** Options for the SvelteKit remote-function adapter plugin. */
24
- export interface SveltekitEffectRuntimeOptions {
25
- /**
26
- * Override the client-side module SvelteKit uses for generated `.remote.ts`
27
- * imports so remote calls default to Effect-returning adapters.
28
- */
29
- remoteModuleId?: string;
30
- }
31
- /**
32
- * Low-level Vite plugin wrapper for non-SvelteKit builds that only need the
33
- * Svelte preprocessor integration.
34
- *
35
- * @see https://ser.barekey.dev/content/reference/tooling
36
- */
37
- export declare function svelte_effect_runtime(options?: SvelteEffectRuntimeOptions): Plugin[];
38
- /**
39
- * Low-level Vite plugin that swaps SvelteKit's generated remote client module
40
- * for the Effect-aware adapters used by `effect()`.
41
- *
42
- * Prefer `effect()` unless you are assembling a custom Vite plugin stack.
43
- *
44
- * @see https://ser.barekey.dev/content/reference/tooling
45
- */
46
- export declare function sveltekit_effect_runtime(options?: SveltekitEffectRuntimeOptions): Plugin;
@@ -1,2 +0,0 @@
1
- export type { ClientRuntimeService, EffectRuntime, FormError, FormIssue, RemoteDomainError, RemoteFailure, RemoteHttpError, RemoteTransportError, RemoteValidationError, } from "../v3/client.js";
2
- export { ClientRuntime, get_effect_runtime_or_throw, run_component_effect, run_inline_effect, to_effect, to_native, } from "../v3/client.js";
@@ -1,24 +0,0 @@
1
- /**
2
- * v4-targeted high-level Vite integration for `svelte-effect-runtime`.
3
- *
4
- * @example
5
- * ```ts
6
- * import { effect } from "svelte-effect-runtime/v4";
7
- *
8
- * export default {
9
- * plugins: [effect()],
10
- * };
11
- * ```
12
- *
13
- * @module
14
- */
15
- import type { PluginOption } from "vite";
16
- import { type EffectPluginOptions } from "../v3/effect.js";
17
- export type { EffectPluginOptions } from "../v3/effect.js";
18
- /**
19
- * v4-flavoured convenience Vite plugin that enables `<script effect>`
20
- * transforms and Effect-aware remote function adapters.
21
- *
22
- * @see https://ser.barekey.dev/
23
- */
24
- export declare function effect(options?: EffectPluginOptions): PluginOption[];
package/dist/v4/effect.js DELETED
@@ -1,19 +0,0 @@
1
- import { t as effect$1 } from "../chunks/effect-Crj3S8Cg.js";
2
- import { with_v4_effect_preprocess_options } from "./preprocess.js";
3
- //#region v4/effect.ts
4
- /**
5
- * v4-flavoured convenience Vite plugin that enables `<script effect>`
6
- * transforms and Effect-aware remote function adapters.
7
- *
8
- * @see https://ser.barekey.dev/
9
- */
10
- function effect(options = {}) {
11
- return effect$1({
12
- ...options,
13
- effect: with_v4_effect_preprocess_options(options.effect)
14
- });
15
- }
16
- //#endregion
17
- export { effect };
18
-
19
- //# sourceMappingURL=effect.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"effect.js","names":["create_effect_plugin"],"sources":["../../../modules/svelte-effect-runtime/v4/effect.ts"],"sourcesContent":["/**\n * v4-targeted high-level Vite integration for `svelte-effect-runtime`.\n *\n * @example\n * ```ts\n * import { effect } from \"svelte-effect-runtime/v4\";\n *\n * export default {\n * plugins: [effect()],\n * };\n * ```\n *\n * @module\n */\nimport type { PluginOption } from \"vite\";\nimport {\n effect as create_effect_plugin,\n type EffectPluginOptions,\n} from \"$/v3/effect.ts\";\nimport { with_v4_effect_preprocess_options } from \"$/v4/preprocess.ts\";\n\nexport type { EffectPluginOptions } from \"$/v3/effect.ts\";\n\n/**\n * v4-flavoured convenience Vite plugin that enables `<script effect>`\n * transforms and Effect-aware remote function adapters.\n *\n * @see https://ser.barekey.dev/\n */\nexport function effect(\n options: EffectPluginOptions = {},\n): PluginOption[] {\n return create_effect_plugin({\n ...options,\n effect: with_v4_effect_preprocess_options(options.effect),\n });\n}\n"],"mappings":";;;;;;;;;AA6BA,SAAgB,OACd,UAA+B,EAAE,EACjB;AAChB,QAAOA,SAAqB;EAC1B,GAAG;EACH,QAAQ,kCAAkC,QAAQ,OAAO;EAC1D,CAAC"}
package/dist/v4/mod.d.ts DELETED
@@ -1,27 +0,0 @@
1
- /**
2
- * v4 public entrypoint for `svelte-effect-runtime`.
3
- *
4
- * Targets Effect v4 (beta) while sharing the underlying client helpers with
5
- * v3. Importing from `svelte-effect-runtime/v4` opts into the v4 preprocess /
6
- * Vite pipeline and the v4-flavoured server helpers exposed through the
7
- * `/v4/_server` subpath.
8
- *
9
- * @example
10
- * ```ts
11
- * import {
12
- * ClientRuntime,
13
- * run_component_effect,
14
- * } from "svelte-effect-runtime/v4";
15
- * import { Effect } from "effect";
16
- *
17
- * const runtime = ClientRuntime.make();
18
- * run_component_effect(runtime, Effect.log("hi from v4"));
19
- * ```
20
- *
21
- * @see https://ser.barekey.dev/
22
- *
23
- * @module
24
- */
25
- export type { EffectPreprocessOptions } from "./preprocess.js";
26
- export type { ClientRuntimeService, EffectRuntime, FormError, FormIssue, RemoteDomainError, RemoteFailure, RemoteHttpError, RemoteTransportError, RemoteValidationError, } from "./client.js";
27
- export { ClientRuntime, get_effect_runtime_or_throw, run_component_effect, run_inline_effect, to_effect, to_native, } from "./client.js";
package/dist/v4/mod.js DELETED
@@ -1,3 +0,0 @@
1
- import { a as run_component_effect, c as to_native, o as run_inline_effect, r as get_effect_runtime_or_throw, s as to_effect, t as ClientRuntime } from "../chunks/client-vV6UAwoP.js";
2
- import "../chunks/v4-MMhHmzIG.js";
3
- export { ClientRuntime, get_effect_runtime_or_throw, run_component_effect, run_inline_effect, to_effect, to_native };
@@ -1,34 +0,0 @@
1
- /**
2
- * v4-specific preprocess entrypoints and helpers.
3
- *
4
- * @example
5
- * ```ts
6
- * import { effect_preprocess } from "svelte-effect-runtime/v4/preprocess";
7
- *
8
- * const preprocess = effect_preprocess();
9
- * ```
10
- *
11
- * @module
12
- */
13
- import type { PreprocessorGroup } from "svelte/compiler";
14
- import { type EffectPreprocessOptions } from "../v3/preprocess.js";
15
- export type { EffectPreprocessOptions } from "../v3/preprocess.js";
16
- export declare const V4_RUNTIME_MODULE_ID = "svelte-effect-runtime/v4";
17
- /**
18
- * Apply the default v4 runtime module id to a preprocess options bag.
19
- *
20
- * @internal Internal — do not use.
21
- */
22
- export declare function with_v4_effect_preprocess_options(options?: EffectPreprocessOptions): EffectPreprocessOptions;
23
- /**
24
- * Low-level Svelte preprocessor for the v4 runtime entry.
25
- *
26
- * Advanced entry point used by tooling and custom build setups.
27
- *
28
- * @see https://ser.barekey.dev/content/reference/preprocess
29
- */
30
- export declare function effect_preprocess(options?: EffectPreprocessOptions): PreprocessorGroup;
31
- /**
32
- * Backwards-compatible camelCase alias retained for older downstream imports.
33
- */
34
- export declare const effectPreprocess: typeof effect_preprocess;
@@ -1,32 +0,0 @@
1
- import { t as effect_preprocess$1 } from "../chunks/preprocess-BFePqOC6.js";
2
- //#region v4/preprocess.ts
3
- const V4_RUNTIME_MODULE_ID = "svelte-effect-runtime/v4";
4
- /**
5
- * Apply the default v4 runtime module id to a preprocess options bag.
6
- *
7
- * @internal Internal — do not use.
8
- */
9
- function with_v4_effect_preprocess_options(options = {}) {
10
- return {
11
- ...options,
12
- runtimeModuleId: options.runtimeModuleId ?? "svelte-effect-runtime/v4"
13
- };
14
- }
15
- /**
16
- * Low-level Svelte preprocessor for the v4 runtime entry.
17
- *
18
- * Advanced entry point used by tooling and custom build setups.
19
- *
20
- * @see https://ser.barekey.dev/content/reference/preprocess
21
- */
22
- function effect_preprocess(options = {}) {
23
- return effect_preprocess$1(with_v4_effect_preprocess_options(options));
24
- }
25
- /**
26
- * Backwards-compatible camelCase alias retained for older downstream imports.
27
- */
28
- const effectPreprocess = effect_preprocess;
29
- //#endregion
30
- export { V4_RUNTIME_MODULE_ID, effectPreprocess, effect_preprocess, with_v4_effect_preprocess_options };
31
-
32
- //# sourceMappingURL=preprocess.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"preprocess.js","names":["create_effect_preprocess"],"sources":["../../../modules/svelte-effect-runtime/v4/preprocess.ts"],"sourcesContent":["/**\n * v4-specific preprocess entrypoints and helpers.\n *\n * @example\n * ```ts\n * import { effect_preprocess } from \"svelte-effect-runtime/v4/preprocess\";\n *\n * const preprocess = effect_preprocess();\n * ```\n *\n * @module\n */\nimport type { PreprocessorGroup } from \"svelte/compiler\";\nimport {\n effect_preprocess as create_effect_preprocess,\n type EffectPreprocessOptions,\n} from \"$/v3/preprocess.ts\";\n\nexport type { EffectPreprocessOptions } from \"$/v3/preprocess.ts\";\n\nexport const V4_RUNTIME_MODULE_ID = \"svelte-effect-runtime/v4\";\n\n/**\n * Apply the default v4 runtime module id to a preprocess options bag.\n *\n * @internal Internal — do not use.\n */\nexport function with_v4_effect_preprocess_options(\n options: EffectPreprocessOptions = {},\n): EffectPreprocessOptions {\n return {\n ...options,\n runtimeModuleId: options.runtimeModuleId ?? V4_RUNTIME_MODULE_ID,\n };\n}\n\n/**\n * Low-level Svelte preprocessor for the v4 runtime entry.\n *\n * Advanced entry point used by tooling and custom build setups.\n *\n * @see https://ser.barekey.dev/content/reference/preprocess\n */\nexport function effect_preprocess(\n options: EffectPreprocessOptions = {},\n): PreprocessorGroup {\n return create_effect_preprocess(with_v4_effect_preprocess_options(options));\n}\n\n/**\n * Backwards-compatible camelCase alias retained for older downstream imports.\n */\nexport const effectPreprocess = effect_preprocess;\n"],"mappings":";;AAoBA,MAAa,uBAAuB;;;;;;AAOpC,SAAgB,kCACd,UAAmC,EAAE,EACZ;AACzB,QAAO;EACL,GAAG;EACH,iBAAiB,QAAQ,mBAAA;EAC1B;;;;;;;;;AAUH,SAAgB,kBACd,UAAmC,EAAE,EAClB;AACnB,QAAOA,oBAAyB,kCAAkC,QAAQ,CAAC;;;;;AAM7E,MAAa,mBAAmB"}
@@ -1,59 +0,0 @@
1
- import type * as Server_module from "./server.js";
2
- export * from "./mod.js";
3
- export type * from "./server.js";
4
- export type { EffectPluginOptions } from "./effect.js";
5
- export { effect } from "./effect.js";
6
- /**
7
- * Define a read-only remote function that returns an `Effect` on the client.
8
- *
9
- * @see https://ser.barekey.dev/content/remote-functions/query
10
- */
11
- export declare const Query: typeof Server_module.Query;
12
- /**
13
- * Define a write-oriented remote function that returns an `Effect` on the
14
- * client.
15
- *
16
- * @see https://ser.barekey.dev/content/remote-functions/command
17
- */
18
- export declare const Command: typeof Server_module.Command;
19
- /**
20
- * Define a remote form handler that maps submitted data into an Effect
21
- * program.
22
- *
23
- * @see https://ser.barekey.dev/content/remote-functions/form
24
- */
25
- export declare const Form: typeof Server_module.Form;
26
- /**
27
- * Define a prerenderable remote function backed by an Effect program.
28
- *
29
- * @see https://ser.barekey.dev/content/remote-functions/prerender
30
- */
31
- export declare const Prerender: typeof Server_module.Prerender;
32
- /**
33
- * Effect `Context.Tag` for the current SvelteKit `RequestEvent`.
34
- *
35
- * @see https://ser.barekey.dev/content/runtimes/server
36
- */
37
- export declare const RequestEvent: typeof Server_module.RequestEvent;
38
- /**
39
- * Server-side runtime builder used to provide long-lived Effect services to
40
- * remote functions.
41
- *
42
- * @see https://ser.barekey.dev/content/reference/server-runtime
43
- */
44
- export declare const ServerRuntime: typeof Server_module.ServerRuntime;
45
- /**
46
- * Build a devalue transport table from Effect schemas so remote payloads can
47
- * round-trip custom data across the client/server boundary.
48
- *
49
- * @see https://ser.barekey.dev/content/reference/transport
50
- */
51
- export declare const create_effect_transport: typeof Server_module.create_effect_transport;
52
- /**
53
- * Resolve the active server runtime, lazily creating a default empty runtime
54
- * when no explicit one has been registered.
55
- *
56
- * @internal Internal - do not use.
57
- * @see https://ser.barekey.dev/content/reference/server-runtime
58
- */
59
- export declare const get_server_runtime_or_throw: typeof Server_module.get_server_runtime_or_throw;
@@ -1,4 +0,0 @@
1
- import { a as run_component_effect, c as to_native, o as run_inline_effect, r as get_effect_runtime_or_throw, s as to_effect, t as ClientRuntime } from "../chunks/client-vV6UAwoP.js";
2
- import "../chunks/v4-MMhHmzIG.js";
3
- import { effect } from "./effect.js";
4
- export { ClientRuntime, effect, get_effect_runtime_or_throw, run_component_effect, run_inline_effect, to_effect, to_native };