svelte-effect-runtime 1.2.4 → 1.3.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.
- package/dist/chunks/client-DkW4e4dD.js +199 -0
- package/dist/chunks/client-DkW4e4dD.js.map +1 -0
- package/dist/chunks/effect-CL8GJs8A.js +51 -0
- package/dist/chunks/effect-CL8GJs8A.js.map +1 -0
- package/dist/chunks/effect-compat-BhW0YPIs.js +103 -0
- package/dist/chunks/effect-compat-BhW0YPIs.js.map +1 -0
- package/dist/chunks/{magic-string.es-5gRBdMgP.js → magic-string.es-BnGH-5YR.js} +1 -1
- package/dist/chunks/{magic-string.es-5gRBdMgP.js.map → magic-string.es-BnGH-5YR.js.map} +1 -1
- package/dist/chunks/{markup-Ccw42uCl.js → markup-BpSHnnYD.js} +4 -4
- package/dist/chunks/{markup-Ccw42uCl.js.map → markup-BpSHnnYD.js.map} +1 -1
- package/dist/chunks/preprocess-CtLrnJcK.js +44 -0
- package/dist/chunks/preprocess-CtLrnJcK.js.map +1 -0
- package/dist/chunks/server-DR-6LMdP.js +629 -0
- package/dist/chunks/server-DR-6LMdP.js.map +1 -0
- package/dist/chunks/v3-p8V3Drpp.js +1 -0
- package/dist/chunks/v4-DIhYCbb_.js +1 -0
- package/dist/chunks/vite-DqjXRZd4.js +143 -0
- package/dist/chunks/vite-DqjXRZd4.js.map +1 -0
- package/dist/client.d.ts +1 -64
- package/dist/client.js +2 -170
- package/dist/effect.d.ts +1 -7
- package/dist/effect.js +1 -27
- package/dist/internal/effect-compat.d.ts +21 -0
- package/dist/internal/markup.d.ts +1 -1
- package/dist/internal/markup.js +1 -1
- package/dist/internal/remote-client.js +30 -6
- package/dist/internal/remote-client.js.map +1 -1
- package/dist/internal/transform.d.ts +1 -1
- package/dist/internal/transform.js +3 -4
- package/dist/internal/transform.js.map +1 -1
- package/dist/language-server.d.ts +9 -3
- package/dist/language-server.js +3 -3
- package/dist/mod.d.ts +1 -6
- package/dist/mod.js +3 -5
- package/dist/preprocess.d.ts +23 -6
- package/dist/preprocess.js +10 -31
- package/dist/preprocess.js.map +1 -1
- package/dist/root-node.d.ts +1 -14
- package/dist/root-node.js +63 -8
- package/dist/root-node.js.map +1 -0
- package/dist/server.d.ts +56 -129
- package/dist/server.js +44 -508
- package/dist/server.js.map +1 -1
- package/dist/v3/client.d.ts +93 -0
- package/dist/v3/effect.d.ts +17 -0
- package/dist/v3/mod.d.ts +3 -0
- package/dist/v3/preprocess.d.ts +28 -0
- package/dist/v3/root-node.d.ts +59 -0
- package/dist/v3/server.d.ts +167 -0
- package/dist/v3/vite.d.ts +46 -0
- package/dist/v4/client.d.ts +2 -0
- package/dist/v4/effect.d.ts +24 -0
- package/dist/v4/effect.js +19 -0
- package/dist/v4/effect.js.map +1 -0
- package/dist/v4/mod.d.ts +3 -0
- package/dist/v4/mod.js +3 -0
- package/dist/v4/preprocess.d.ts +30 -0
- package/dist/v4/preprocess.js +28 -0
- package/dist/v4/preprocess.js.map +1 -0
- package/dist/v4/root-node.d.ts +59 -0
- package/dist/v4/root-node.js +4 -0
- package/dist/v4/server.d.ts +124 -0
- package/dist/v4/server.js +22 -0
- package/dist/v4/server.js.map +1 -0
- package/dist/v4/vite.d.ts +34 -0
- package/dist/v4/vite.js +31 -0
- package/dist/v4/vite.js.map +1 -0
- package/dist/vite.d.ts +30 -15
- package/dist/vite.js +18 -101
- package/dist/vite.js.map +1 -1
- package/package.json +46 -3
- package/dist/client.js.map +0 -1
- package/dist/effect.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelte-effect-runtime",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Client-side Effect runtime support for Svelte <script> blocks.",
|
|
5
5
|
"license": "BSD-3-Clause",
|
|
6
6
|
"type": "module",
|
|
@@ -21,10 +21,52 @@
|
|
|
21
21
|
"node": "./dist/root-node.js",
|
|
22
22
|
"default": "./dist/mod.js"
|
|
23
23
|
},
|
|
24
|
+
"./v3": {
|
|
25
|
+
"types": "./dist/root-node.d.ts",
|
|
26
|
+
"node": "./dist/root-node.js",
|
|
27
|
+
"default": "./dist/mod.js"
|
|
28
|
+
},
|
|
29
|
+
"./v4": {
|
|
30
|
+
"types": "./dist/v4/root-node.d.ts",
|
|
31
|
+
"node": "./dist/v4/root-node.js",
|
|
32
|
+
"default": "./dist/v4/mod.js"
|
|
33
|
+
},
|
|
34
|
+
"./preprocess": {
|
|
35
|
+
"types": "./dist/preprocess.d.ts",
|
|
36
|
+
"default": "./dist/preprocess.js"
|
|
37
|
+
},
|
|
38
|
+
"./v3/preprocess": {
|
|
39
|
+
"types": "./dist/preprocess.d.ts",
|
|
40
|
+
"default": "./dist/preprocess.js"
|
|
41
|
+
},
|
|
42
|
+
"./vite": {
|
|
43
|
+
"types": "./dist/vite.d.ts",
|
|
44
|
+
"default": "./dist/vite.js"
|
|
45
|
+
},
|
|
46
|
+
"./v3/vite": {
|
|
47
|
+
"types": "./dist/vite.d.ts",
|
|
48
|
+
"default": "./dist/vite.js"
|
|
49
|
+
},
|
|
50
|
+
"./v4/preprocess": {
|
|
51
|
+
"types": "./dist/v4/preprocess.d.ts",
|
|
52
|
+
"default": "./dist/v4/preprocess.js"
|
|
53
|
+
},
|
|
54
|
+
"./v4/vite": {
|
|
55
|
+
"types": "./dist/v4/vite.d.ts",
|
|
56
|
+
"default": "./dist/v4/vite.js"
|
|
57
|
+
},
|
|
24
58
|
"./_server": {
|
|
25
59
|
"types": "./dist/server.d.ts",
|
|
26
60
|
"default": "./dist/server.js"
|
|
27
61
|
},
|
|
62
|
+
"./v3/_server": {
|
|
63
|
+
"types": "./dist/server.d.ts",
|
|
64
|
+
"default": "./dist/server.js"
|
|
65
|
+
},
|
|
66
|
+
"./v4/_server": {
|
|
67
|
+
"types": "./dist/v4/server.d.ts",
|
|
68
|
+
"default": "./dist/v4/server.js"
|
|
69
|
+
},
|
|
28
70
|
"./language-server": {
|
|
29
71
|
"types": "./dist/language-server.d.ts",
|
|
30
72
|
"default": "./dist/language-server.js"
|
|
@@ -35,12 +77,13 @@
|
|
|
35
77
|
"build:npm": "npm run build",
|
|
36
78
|
"check": "deno task check",
|
|
37
79
|
"clean": "deno task clean",
|
|
80
|
+
"smoke:v4": "deno task smoke:v4",
|
|
38
81
|
"test": "deno task test"
|
|
39
82
|
},
|
|
40
83
|
"peerDependencies": {
|
|
41
84
|
"@sveltejs/kit": "^2.0.0",
|
|
42
|
-
"@sveltejs/vite-plugin-svelte": "^6.0.0",
|
|
43
|
-
"effect": "^3.0.0",
|
|
85
|
+
"@sveltejs/vite-plugin-svelte": "^6.0.0 || ^7.0.0",
|
|
86
|
+
"effect": "^3.0.0 || >=4.0.0-beta.0 <5",
|
|
44
87
|
"svelte": "^5.0.0",
|
|
45
88
|
"vite": "^7.0.0 || ^8.0.0"
|
|
46
89
|
},
|
package/dist/client.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","names":[],"sources":["../../modules/svelte-effect-runtime/client.ts"],"sourcesContent":["import * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as ManagedRuntime from \"effect/ManagedRuntime\";\nimport * as Cause from \"effect/Cause\";\nimport * as Exit from \"effect/Exit\";\nimport { getContext, hasContext, onDestroy, setContext } from \"svelte\";\nimport {\n create_remote_domain_error,\n create_remote_http_error,\n create_remote_transport_error,\n create_remote_validation_error,\n is_serialized_remote_failure_envelope,\n REMOTE_ERROR_DECODER,\n type RemoteFailure,\n} from \"./internal/remote-shared.ts\";\n\nconst EFFECT_RUNTIME_CONTEXT = Symbol.for(\"svelte-effect-runtime/runtime\");\nlet current_client_runtime: EffectRuntime<unknown> | null = null;\n\nexport interface ProvideEffectRuntimeOptions {\n disposeOnDestroy?: boolean;\n}\n\nexport interface ImportMetaLike {\n hot?: {\n dispose(callback: () => void): void;\n };\n}\n\nexport interface EffectRuntime<R = unknown> {\n runCallback<A, E, R2>(\n effect: Effect.Effect<A, E, R2>,\n options?: {\n onExit?: (exit: Exit.Exit<A, E>) => void;\n },\n ): () => void;\n runPromise<A, E, R2>(effect: Effect.Effect<A, E, R2>): Promise<A>;\n dispose(): Promise<void>;\n}\n\nexport type {\n FormError,\n FormIssue,\n RemoteDomainError,\n RemoteFailure,\n RemoteHttpError,\n RemoteTransportError,\n RemoteValidationError,\n} from \"./internal/remote-shared.ts\";\n\nexport interface ClientRuntimeService extends EffectRuntime<unknown> {}\n\nexport const ClientRuntimeTag: Context.Tag<\n ClientRuntimeService,\n ClientRuntimeService\n> = Context.GenericTag<ClientRuntimeService>(\n \"svelte-effect-runtime/ClientRuntime\",\n);\n\ntype RuntimeSeedLayer<R> = Layer.Layer<R, never, R>;\n\nfunction runtimeSeed<R>(): RuntimeSeedLayer<R> {\n return Layer.effectContext(Effect.context<R>());\n}\n\ntype RuntimeOperator = (\n self: Layer.Layer<unknown, unknown, unknown>,\n) => Layer.Layer<unknown, unknown, unknown>;\n\ntype ProvidedBy<Op> = Op extends\n (self: RuntimeSeedLayer<infer R>) => Layer.Layer<unknown, unknown, infer RIn>\n ? Exclude<R, RIn>\n : never;\n\ntype ProvidedByAll<Ops extends ReadonlyArray<RuntimeOperator>> = Ops extends\n readonly [infer Head, ...infer Tail] ?\n | ProvidedBy<Head>\n | ProvidedByAll<Extract<Tail, ReadonlyArray<RuntimeOperator>>>\n : never;\n\ntype ApplyOperator<Seed, Op> = Op extends (self: Seed) => infer Out ? Out\n : never;\n\ntype ApplyOperators<\n Seed,\n Ops extends ReadonlyArray<RuntimeOperator>,\n> = Ops extends readonly [infer Head, ...infer Tail] ? ApplyOperators<\n ApplyOperator<Seed, Head>,\n Extract<Tail, ReadonlyArray<RuntimeOperator>>\n >\n : Seed;\n\ntype FinalRuntimeLayer<Ops extends ReadonlyArray<RuntimeOperator>> =\n ApplyOperators<RuntimeSeedLayer<ProvidedByAll<Ops>>, Ops> extends infer Out\n ? Out extends Layer.Layer<unknown, unknown, infer RIn>\n ? [RIn] extends [never] ? Out\n : never\n : never\n : never;\n\ninterface ClientRuntimeSeed {\n pipe(): Layer.Layer<never>;\n pipe<const Ops extends readonly [RuntimeOperator, ...Array<RuntimeOperator>]>(\n ...ops: Ops\n ): FinalRuntimeLayer<Ops>;\n make(): ManagedRuntime.ManagedRuntime<never, never>;\n make<const Ops extends readonly [RuntimeOperator, ...Array<RuntimeOperator>]>(\n ...ops: Ops\n ): ManagedRuntimeFromOps<Ops>;\n}\n\ntype ManagedRuntimeFromOps<Ops extends ReadonlyArray<RuntimeOperator>> =\n ManagedRuntime.ManagedRuntime<\n Layer.Layer.Success<FinalRuntimeLayer<Ops>>,\n Layer.Layer.Error<FinalRuntimeLayer<Ops>>\n >;\n\nfunction pipeClientRuntime(): Layer.Layer<never>;\nfunction pipeClientRuntime<\n const Ops extends readonly [RuntimeOperator, ...Array<RuntimeOperator>],\n>(...ops: Ops): FinalRuntimeLayer<Ops>;\nfunction pipeClientRuntime(\n ...ops: Array<RuntimeOperator>\n): Layer.Layer<never, unknown, unknown> {\n if (ops.length === 0) {\n return Layer.empty;\n }\n\n return ops.reduce<Layer.Layer<unknown, unknown, unknown>>(\n (layer, op) => op(layer),\n runtimeSeed<unknown>(),\n ) as Layer.Layer<never, unknown, unknown>;\n}\n\nfunction makeClientRuntime(): ManagedRuntime.ManagedRuntime<never, never>;\nfunction makeClientRuntime<\n const Ops extends readonly [RuntimeOperator, ...Array<RuntimeOperator>],\n>(...ops: Ops): ManagedRuntimeFromOps<Ops>;\nfunction makeClientRuntime(\n ...ops: [] | [RuntimeOperator, ...Array<RuntimeOperator>]\n): ManagedRuntime.ManagedRuntime<never, unknown> {\n const layer = ops.length === 0 ? pipeClientRuntime() : pipeClientRuntime(\n ...(ops as [RuntimeOperator, ...Array<RuntimeOperator>]),\n );\n\n const runtime = track_client_runtime(ManagedRuntime.make(\n layer as unknown as Layer.Layer<unknown, unknown, never>,\n ));\n\n void current_client_runtime?.dispose().catch(() => undefined);\n current_client_runtime = runtime;\n\n if (is_component_context_available()) {\n return provideEffectRuntime(runtime, { disposeOnDestroy: true });\n }\n\n return runtime;\n}\n\n/**\n * A pass-through layer representing the dependency graph you want to include\n * in the client ManagedRuntime. Users can compose this directly:\n *\n * ManagedRuntime.make(\n * ClientRuntime.pipe(\n * Layer.provide(MyApi.Live),\n * Layer.provide(Logger.Live),\n * ),\n * )\n */\nexport const ClientRuntime: ClientRuntimeSeed = {\n pipe: pipeClientRuntime,\n make: makeClientRuntime,\n};\n\nexport function provideEffectRuntime<T extends EffectRuntime>(\n runtime: T,\n options: ProvideEffectRuntimeOptions = {},\n): T {\n current_client_runtime = track_client_runtime(runtime);\n setContext(EFFECT_RUNTIME_CONTEXT, runtime);\n\n if (options.disposeOnDestroy) {\n onDestroy(() => {\n void runtime.dispose();\n });\n }\n\n return runtime;\n}\n\nexport function getEffectRuntimeOrThrow<\n T extends EffectRuntime = EffectRuntime<never>,\n>(): T {\n if (has_runtime_context()) {\n return getContext<T>(EFFECT_RUNTIME_CONTEXT);\n }\n\n if (current_client_runtime !== null) {\n return current_client_runtime as T;\n }\n\n // No runtime registered — lazily create a default one with an empty layer.\n // This makes `ClientRuntime.make()` in `hooks.client.ts` optional for apps\n // that don't need to provide custom dependencies. A later explicit call to\n // `ClientRuntime.make(...)` will dispose this default and replace it.\n const default_runtime = track_client_runtime(\n ManagedRuntime.make(\n Layer.empty as unknown as Layer.Layer<unknown, unknown, never>,\n ),\n );\n current_client_runtime = default_runtime;\n return default_runtime as unknown as T;\n}\n\nexport function runComponentEffect<A, E, R>(\n runtime: EffectRuntime<R>,\n program: Effect.Effect<A, E, R>,\n): () => void {\n let disposed = false;\n\n const cancel = runtime.runCallback(program, {\n onExit(exit) {\n if (Exit.isFailure(exit) && !Exit.isInterrupted(exit)) {\n queueMicrotask(() => {\n throw Cause.squash(exit.cause);\n });\n }\n },\n });\n\n return () => {\n if (disposed) {\n return;\n }\n\n disposed = true;\n cancel();\n };\n}\n\nexport function runInlineEffect<A, E, R>(\n runtime: EffectRuntime<R>,\n program: Effect.Effect<A, E, R>,\n): Promise<A> {\n console.log(\"[svelte-effect-runtime][client]\", \"runInlineEffect:start\");\n return runtime.runPromise(program).catch((error) => {\n console.error(\"[svelte-effect-runtime][client]\", \"runInlineEffect:error\", {\n error,\n });\n queueMicrotask(() => {\n throw error;\n });\n\n throw error;\n });\n}\n\nexport function registerHotDispose(\n meta: ImportMetaLike,\n cleanup: () => void,\n): void {\n meta.hot?.dispose(cleanup);\n}\n\nfunction has_runtime_context(): boolean {\n try {\n return hasContext(EFFECT_RUNTIME_CONTEXT);\n } catch {\n return false;\n }\n}\n\nfunction is_component_context_available(): boolean {\n try {\n void hasContext(EFFECT_RUNTIME_CONTEXT);\n return true;\n } catch {\n return false;\n }\n}\n\nfunction track_client_runtime<T extends EffectRuntime>(runtime: T): T {\n const tracked_runtime = runtime as T & { __ser_tracked__?: true };\n\n if (tracked_runtime.__ser_tracked__ === true) {\n return tracked_runtime;\n }\n\n const dispose = runtime.dispose.bind(runtime);\n tracked_runtime.__ser_tracked__ = true;\n runtime.dispose = (() => {\n if (current_client_runtime === tracked_runtime) {\n current_client_runtime = null;\n }\n\n return dispose();\n }) as typeof runtime.dispose;\n\n return tracked_runtime;\n}\n\nfunction is_redirect_like(value: unknown): boolean {\n return Boolean(\n value &&\n typeof value === \"object\" &&\n typeof (value as { location?: unknown }).location === \"string\" &&\n typeof (value as { status?: unknown }).status === \"number\",\n );\n}\n\ntype Decode_remote_payload = <ErrorType = unknown>(\n encoded: string,\n) => ErrorType;\n\nfunction is_http_error_like(\n value: unknown,\n): value is {\n readonly body?: unknown;\n readonly status?: number;\n} {\n return Boolean(\n value &&\n typeof value === \"object\" &&\n typeof (value as { status?: unknown }).status === \"number\",\n );\n}\n\nfunction get_error_status(value: unknown): number {\n return is_http_error_like(value) ? value.status ?? 500 : 500;\n}\n\nfunction get_remote_error_decoder(\n value: unknown,\n): Decode_remote_payload | undefined {\n if (\n value &&\n (typeof value === \"object\" || typeof value === \"function\") &&\n REMOTE_ERROR_DECODER in value\n ) {\n return (value as { [REMOTE_ERROR_DECODER]: Decode_remote_payload })[\n REMOTE_ERROR_DECODER\n ];\n }\n}\n\nfunction decode_remote_error<ErrorType>(\n error: unknown,\n decode_payload?: Decode_remote_payload,\n): RemoteFailure<ErrorType> {\n if (is_http_error_like(error)) {\n const body = error.body;\n\n if (is_serialized_remote_failure_envelope(body) && decode_payload) {\n try {\n return create_remote_domain_error<ErrorType>(\n decode_payload<ErrorType>(body.encoded),\n get_error_status(error),\n );\n } catch (cause) {\n return create_remote_transport_error(cause, body);\n }\n }\n\n if (get_error_status(error) === 400) {\n return create_remote_validation_error([], {\n body,\n status: 400,\n });\n }\n\n return create_remote_http_error(error, {\n body,\n status: get_error_status(error),\n });\n }\n\n return create_remote_http_error(error);\n}\n\nfunction create_remote_effect_from_promise<Success, ErrorType = never>(\n create_promise: () => PromiseLike<Success>,\n decode_error: (error: unknown) => RemoteFailure<ErrorType> = (error) =>\n create_remote_http_error(error),\n): Effect.Effect<Success, RemoteFailure<ErrorType>, never> {\n return Effect.async<Success, RemoteFailure<ErrorType>>((resume) => {\n void Promise.resolve()\n .then(create_promise)\n .then(\n (value) => resume(Effect.succeed(value)),\n (error) => {\n if (is_redirect_like(error)) {\n resume(Effect.die(error));\n return;\n }\n\n resume(Effect.fail(decode_error(error)));\n },\n );\n });\n}\n\ntype AnyCallable = (...args: Array<unknown>) => unknown;\n\nexport function to_effect<Success, ErrorType = never>(\n promise_like: PromiseLike<Success>,\n): Effect.Effect<Success, RemoteFailure<ErrorType>, never>;\nexport function to_effect<\n Args extends Array<unknown>,\n Success,\n ErrorType = never,\n>(\n fn: (...args: Args) => PromiseLike<Success>,\n): (...args: Args) => Effect.Effect<Success, RemoteFailure<ErrorType>, never>;\nexport function to_effect<Success, ErrorType = never>(\n value: PromiseLike<Success> | AnyCallable,\n): Effect.Effect<Success, RemoteFailure<ErrorType>, never> | AnyCallable {\n const decode_payload = get_remote_error_decoder(value);\n\n if (typeof value === \"function\") {\n return ((...args: Array<unknown>) =>\n create_remote_effect_from_promise(\n () => Promise.resolve((value as AnyCallable)(...args)),\n (error) => decode_remote_error<ErrorType>(error, decode_payload),\n )) as AnyCallable;\n }\n\n return create_remote_effect_from_promise(\n () => value,\n (error) => decode_remote_error<ErrorType>(error, decode_payload),\n );\n}\n\nexport function to_native<Value>(\n value: Value,\n): Value extends { native: infer Native } ? Native\n : Value;\nexport function to_native(value: unknown): unknown {\n let current = value;\n const seen = new Set<unknown>();\n\n while (\n current &&\n (typeof current === \"object\" || typeof current === \"function\") &&\n \"native\" in current\n ) {\n if (seen.has(current)) {\n break;\n }\n\n seen.add(current);\n current = (current as { native: unknown }).native;\n }\n\n return current;\n}\n\nexport { create_remote_effect_from_promise, is_redirect_like };\n"],"mappings":";;;;;;;;;AAiBA,MAAM,yBAAyB,OAAO,IAAI,gCAAgC;AAC1E,IAAI,yBAAwD;AAmC5D,MAAa,mBAGT,QAAQ,WACV,sCACD;AAID,SAAS,cAAsC;AAC7C,QAAO,MAAM,cAAc,OAAO,SAAY,CAAC;;AA2DjD,SAAS,kBACP,GAAG,KACmC;AACtC,KAAI,IAAI,WAAW,EACjB,QAAO,MAAM;AAGf,QAAO,IAAI,QACR,OAAO,OAAO,GAAG,MAAM,EACxB,aAAsB,CACvB;;AAOH,SAAS,kBACP,GAAG,KAC4C;CAC/C,MAAM,QAAQ,IAAI,WAAW,IAAI,mBAAmB,GAAG,kBACrD,GAAI,IACL;CAED,MAAM,UAAU,qBAAqB,eAAe,KAClD,MACD,CAAC;AAEG,yBAAwB,SAAS,CAAC,YAAY,KAAA,EAAU;AAC7D,0BAAyB;AAEzB,KAAI,gCAAgC,CAClC,QAAO,qBAAqB,SAAS,EAAE,kBAAkB,MAAM,CAAC;AAGlE,QAAO;;;;;;;;;;;;;AAcT,MAAa,gBAAmC;CAC9C,MAAM;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OAAO,KAAK,aAAa,MAAM,CAAC,CAAC;IAE3C;GACH;;AAeJ,SAAgB,UACd,OACuE;CACvE,MAAM,iBAAiB,yBAAyB,MAAM;AAEtD,KAAI,OAAO,UAAU,WACnB,UAAS,GAAG,SACV,wCACQ,QAAQ,QAAS,MAAsB,GAAG,KAAK,CAAC,GACrD,UAAU,oBAA+B,OAAO,eAAe,CACjE;AAGL,QAAO,wCACC,QACL,UAAU,oBAA+B,OAAO,eAAe,CACjE;;AAOH,SAAgB,UAAU,OAAyB;CACjD,IAAI,UAAU;CACd,MAAM,uBAAO,IAAI,KAAc;AAE/B,QACE,YACC,OAAO,YAAY,YAAY,OAAO,YAAY,eACnD,YAAY,SACZ;AACA,MAAI,KAAK,IAAI,QAAQ,CACnB;AAGF,OAAK,IAAI,QAAQ;AACjB,YAAW,QAAgC;;AAG7C,QAAO"}
|
package/dist/effect.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"effect.js","names":[],"sources":["../../modules/svelte-effect-runtime/effect.ts"],"sourcesContent":["import { preprocess } from \"svelte/compiler\";\nimport type { Plugin, PluginOption } from \"vite\";\nimport {\n effectPreprocess,\n type EffectPreprocessOptions,\n} from \"./preprocess.ts\";\nimport { sveltekitEffectRuntime } from \"./vite.ts\";\n\nexport interface EffectPluginOptions {\n effect?: EffectPreprocessOptions;\n remoteModuleId?: string;\n}\n\nfunction create_effect_svelte_transform(\n options: EffectPreprocessOptions = {},\n): Plugin {\n const preprocessor = effectPreprocess(options);\n\n return {\n name: \"svelte-effect-runtime-transform\",\n enforce: \"pre\",\n async transform(code, id, _options) {\n const filename = id.split(\"?\", 1)[0];\n if (!filename.endsWith(\".svelte\")) {\n return null;\n }\n\n const transformed = await preprocess(code, preprocessor, { filename });\n if (transformed.code === code) {\n return null;\n }\n\n return {\n code: transformed.code,\n ...(transformed.map ? { map: transformed.map as never } : {}),\n };\n },\n };\n}\n\nexport function effect(\n options: EffectPluginOptions = {},\n): PluginOption[] {\n const transform_plugin = create_effect_svelte_transform(options.effect);\n\n return [\n transform_plugin,\n sveltekitEffectRuntime({\n remoteModuleId: options.remoteModuleId,\n }),\n ];\n}\n"],"mappings":";;;;AAaA,SAAS,+BACP,UAAmC,EAAE,EAC7B;CACR,MAAM,eAAe,iBAAiB,QAAQ;AAE9C,QAAO;EACL,MAAM;EACN,SAAS;EACT,MAAM,UAAU,MAAM,IAAI,UAAU;GAClC,MAAM,WAAW,GAAG,MAAM,KAAK,EAAE,CAAC;AAClC,OAAI,CAAC,SAAS,SAAS,UAAU,CAC/B,QAAO;GAGT,MAAM,cAAc,MAAM,WAAW,MAAM,cAAc,EAAE,UAAU,CAAC;AACtE,OAAI,YAAY,SAAS,KACvB,QAAO;AAGT,UAAO;IACL,MAAM,YAAY;IAClB,GAAI,YAAY,MAAM,EAAE,KAAK,YAAY,KAAc,GAAG,EAAE;IAC7D;;EAEJ;;AAGH,SAAgB,OACd,UAA+B,EAAE,EACjB;AAGhB,QAAO,CAFkB,+BAA+B,QAAQ,OAAO,EAIrE,uBAAuB,EACrB,gBAAgB,QAAQ,gBACzB,CAAC,CACH"}
|