svelte-effect-runtime 1.6.1 → 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.
- package/.dist/chunks/client-BeOE81fW.js +577 -0
- package/.dist/chunks/client-BeOE81fW.js.map +1 -0
- package/.dist/chunks/descriptors-CU2g4U_i.js +36 -0
- package/.dist/chunks/descriptors-CU2g4U_i.js.map +1 -0
- package/.dist/chunks/dispatcher-BSg2-ttN.js +339 -0
- package/.dist/chunks/dispatcher-BSg2-ttN.js.map +1 -0
- package/.dist/chunks/preprocess-BZyUYWY7.js +430 -0
- package/.dist/chunks/preprocess-BZyUYWY7.js.map +1 -0
- package/.dist/chunks/transform-BtlxgJrg.js +836 -0
- package/.dist/chunks/transform-BtlxgJrg.js.map +1 -0
- package/.dist/detect.d.ts +34 -0
- package/.dist/detect.js +56 -0
- package/.dist/detect.js.map +1 -0
- package/.dist/dispatcher/deps.d.ts +14 -0
- package/.dist/dispatcher/fibers.d.ts +52 -0
- package/.dist/dispatcher/index.d.ts +138 -0
- package/.dist/dispatcher/types.d.ts +63 -0
- package/.dist/dispatcher.d.ts +2 -0
- package/.dist/dispatcher.js +2 -0
- package/.dist/error.d.ts +77 -0
- package/.dist/generators.d.ts +16 -0
- package/.dist/internal/descriptors.d.ts +17 -0
- package/.dist/internal/generators.d.ts +6 -0
- package/.dist/internal/generators.js +5 -0
- package/.dist/internal/remote-client.d.ts +6 -0
- package/.dist/internal/remote-client.js +2 -0
- package/.dist/internal/remote-server.d.ts +6 -0
- package/.dist/internal/remote-server.js +2 -0
- package/.dist/markup/promise.d.ts +15 -0
- package/.dist/markup/promise.js +26 -0
- package/.dist/markup/promise.js.map +1 -0
- package/.dist/markup/run.d.ts +12 -0
- package/.dist/markup/run.js +21 -0
- package/.dist/markup/run.js.map +1 -0
- package/.dist/markup/transform/apply.d.ts +6 -0
- package/.dist/markup/transform/classify.d.ts +15 -0
- package/.dist/markup/transform/constants.d.ts +5 -0
- package/.dist/markup/transform/emit.d.ts +12 -0
- package/.dist/markup/transform/expressions.d.ts +39 -0
- package/.dist/markup/transform/index.d.ts +19 -0
- package/.dist/markup/transform/scan.d.ts +8 -0
- package/.dist/markup/transform/types.d.ts +64 -0
- package/.dist/markup/transform.d.ts +1 -0
- package/.dist/markup/transform.js +2 -0
- package/.dist/markup/value.d.ts +20 -0
- package/.dist/markup/value.js +32 -0
- package/.dist/markup/value.js.map +1 -0
- package/.dist/mod.d.ts +186 -0
- package/.dist/mod.js +190 -0
- package/.dist/mod.js.map +1 -0
- package/.dist/preprocess/ast.d.ts +51 -0
- package/.dist/preprocess/imports.d.ts +22 -0
- package/.dist/preprocess/index.d.ts +21 -0
- package/.dist/preprocess/lower.d.ts +12 -0
- package/.dist/preprocess/runtime-block.d.ts +8 -0
- package/.dist/preprocess/source.d.ts +29 -0
- package/.dist/preprocess/types.d.ts +70 -0
- package/.dist/preprocess.d.ts +2 -0
- package/.dist/preprocess.js +3 -0
- package/.dist/remote/client/command.d.ts +17 -0
- package/.dist/remote/client/effect.d.ts +15 -0
- package/.dist/remote/client/failures.d.ts +57 -0
- package/.dist/remote/client/form-data.d.ts +8 -0
- package/.dist/remote/client/form-enhance.d.ts +9 -0
- package/.dist/remote/client/form-transport.d.ts +20 -0
- package/.dist/remote/client/form.d.ts +21 -0
- package/.dist/remote/client/index.d.ts +4 -0
- package/.dist/remote/client/query-result.d.ts +14 -0
- package/.dist/remote/client/query.d.ts +57 -0
- package/.dist/remote/client/responses.d.ts +28 -0
- package/.dist/remote/client/types.d.ts +83 -0
- package/.dist/remote/client/utils.d.ts +11 -0
- package/.dist/remote/client.d.ts +2 -0
- package/.dist/remote/client.js +2 -0
- package/.dist/remote/server.d.ts +66 -0
- package/.dist/remote/server.js +104 -0
- package/.dist/remote/server.js.map +1 -0
- package/.dist/remote/shared.d.ts +202 -0
- package/.dist/remote/shared.js +161 -0
- package/.dist/remote/shared.js.map +1 -0
- package/.dist/runtime/preprocess.d.ts +38 -0
- package/.dist/runtime/preprocess.js +54 -0
- package/.dist/runtime/preprocess.js.map +1 -0
- package/.dist/server/effects.d.ts +49 -0
- package/.dist/server/factories.d.ts +97 -0
- package/.dist/server/index.d.ts +3 -0
- package/.dist/server/invalid.d.ts +9 -0
- package/.dist/server/runtime.d.ts +66 -0
- package/.dist/server/schema.d.ts +42 -0
- package/.dist/server/types.d.ts +271 -0
- package/.dist/server/wrappers.d.ts +45 -0
- package/.dist/server.d.ts +2 -0
- package/.dist/server.js +527 -0
- package/.dist/server.js.map +1 -0
- package/.dist/vite.d.ts +42 -0
- package/.dist/vite.js +118 -0
- package/.dist/vite.js.map +1 -0
- package/README.md +2 -0
- package/package.json +66 -101
- package/dist/chunks/client-vV6UAwoP.js +0 -199
- package/dist/chunks/client-vV6UAwoP.js.map +0 -1
- package/dist/chunks/effect-compat-BhW0YPIs.js +0 -103
- package/dist/chunks/effect-compat-BhW0YPIs.js.map +0 -1
- package/dist/chunks/effect-zCli5qgO.js +0 -51
- package/dist/chunks/effect-zCli5qgO.js.map +0 -1
- package/dist/chunks/magic-string.es-BnGH-5YR.js +0 -1013
- package/dist/chunks/magic-string.es-BnGH-5YR.js.map +0 -1
- package/dist/chunks/markup-D4zJP7U1.js +0 -13383
- package/dist/chunks/markup-D4zJP7U1.js.map +0 -1
- package/dist/chunks/preprocess-DIC5iR0_.js +0 -49
- package/dist/chunks/preprocess-DIC5iR0_.js.map +0 -1
- package/dist/chunks/server-Dea1CJuY.js +0 -704
- package/dist/chunks/server-Dea1CJuY.js.map +0 -1
- package/dist/chunks/v3-D0c0MKPf.js +0 -1
- package/dist/chunks/v4-MMhHmzIG.js +0 -1
- package/dist/chunks/vite-Bm2RdiT3.js +0 -152
- package/dist/chunks/vite-Bm2RdiT3.js.map +0 -1
- package/dist/client.d.ts +0 -1
- package/dist/client.js +0 -2
- package/dist/effect.d.ts +0 -1
- package/dist/effect.js +0 -2
- package/dist/internal/app-server-shim.d.ts +0 -8
- package/dist/internal/effect-compat.d.ts +0 -21
- package/dist/internal/markup.d.ts +0 -11
- package/dist/internal/markup.js +0 -2
- package/dist/internal/remote-client.d.ts +0 -36
- package/dist/internal/remote-client.js +0 -527
- package/dist/internal/remote-client.js.map +0 -1
- package/dist/internal/remote-shared.d.ts +0 -186
- package/dist/internal/remote-shared.js +0 -122
- package/dist/internal/remote-shared.js.map +0 -1
- package/dist/internal/transform.d.ts +0 -18
- package/dist/internal/transform.js +0 -418
- package/dist/internal/transform.js.map +0 -1
- package/dist/language-server.d.ts +0 -9
- package/dist/language-server.js +0 -4
- package/dist/mod.d.ts +0 -22
- package/dist/mod.js +0 -3
- package/dist/preprocess.d.ts +0 -29
- package/dist/preprocess.js +0 -20
- package/dist/preprocess.js.map +0 -1
- package/dist/root-node.d.ts +0 -1
- package/dist/root-node.js +0 -63
- package/dist/root-node.js.map +0 -1
- package/dist/server.d.ts +0 -81
- package/dist/server.js +0 -85
- package/dist/server.js.map +0 -1
- package/dist/v3/client.d.ts +0 -117
- package/dist/v3/effect.d.ts +0 -17
- package/dist/v3/mod.d.ts +0 -27
- package/dist/v3/preprocess.d.ts +0 -28
- package/dist/v3/root-node.d.ts +0 -59
- package/dist/v3/server.d.ts +0 -297
- package/dist/v3/vite.d.ts +0 -46
- package/dist/v4/client.d.ts +0 -2
- package/dist/v4/effect.d.ts +0 -24
- package/dist/v4/effect.js +0 -19
- package/dist/v4/effect.js.map +0 -1
- package/dist/v4/mod.d.ts +0 -27
- package/dist/v4/mod.js +0 -3
- package/dist/v4/preprocess.d.ts +0 -34
- package/dist/v4/preprocess.js +0 -32
- package/dist/v4/preprocess.js.map +0 -1
- package/dist/v4/root-node.d.ts +0 -59
- package/dist/v4/root-node.js +0 -4
- package/dist/v4/server.d.ts +0 -340
- package/dist/v4/server.js +0 -71
- package/dist/v4/server.js.map +0 -1
- package/dist/v4/vite.d.ts +0 -34
- package/dist/v4/vite.js +0 -31
- package/dist/v4/vite.js.map +0 -1
- package/dist/vite.d.ts +0 -31
- package/dist/vite.js +0 -24
- package/dist/vite.js.map +0 -1
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { Cause, Context, Effect, Exit, Option, Schema, SchemaAST } from "effect";
|
|
2
|
-
//#region internal/effect-compat.ts
|
|
3
|
-
function make_context_key(key) {
|
|
4
|
-
const context_namespace = Context;
|
|
5
|
-
if (typeof context_namespace.Service === "function") return context_namespace.Service(key);
|
|
6
|
-
if (typeof context_namespace.GenericTag === "function") return context_namespace.GenericTag(key);
|
|
7
|
-
throw new Error("No compatible Effect context key constructor was found.");
|
|
8
|
-
}
|
|
9
|
-
function to_standard_schema_v1(schema) {
|
|
10
|
-
const schema_namespace = Schema;
|
|
11
|
-
const factory = schema_namespace.toStandardSchemaV1 ?? schema_namespace.standardSchemaV1;
|
|
12
|
-
if (!factory) throw new Error("No compatible standard schema adapter was found in effect/Schema.");
|
|
13
|
-
return factory(schema);
|
|
14
|
-
}
|
|
15
|
-
function create_async_effect(register) {
|
|
16
|
-
const effect_namespace = Effect;
|
|
17
|
-
if (typeof effect_namespace.callback === "function") return effect_namespace.callback((resume, _signal) => register(resume));
|
|
18
|
-
if (typeof effect_namespace.async === "function") return effect_namespace.async(register);
|
|
19
|
-
throw new Error("No compatible async Effect constructor was found.");
|
|
20
|
-
}
|
|
21
|
-
function get_cause_failure(cause) {
|
|
22
|
-
const cause_namespace = Cause;
|
|
23
|
-
if (typeof cause_namespace.failureOption === "function") {
|
|
24
|
-
const failure = cause_namespace.failureOption(cause);
|
|
25
|
-
return Option.isSome(failure) ? failure.value : void 0;
|
|
26
|
-
}
|
|
27
|
-
const fail_reason = get_fail_reason_from_cause(cause, cause_namespace.isFailReason);
|
|
28
|
-
if (fail_reason) return fail_reason.error;
|
|
29
|
-
if (typeof cause_namespace.findFail === "function") {
|
|
30
|
-
const match = extract_success_value(cause_namespace.findFail(cause));
|
|
31
|
-
if (is_fail_reason_like(match)) return match.error;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
function exit_has_interrupts(exit) {
|
|
35
|
-
const exit_namespace = Exit;
|
|
36
|
-
if (typeof exit_namespace.hasInterrupts === "function") return exit_namespace.hasInterrupts(exit);
|
|
37
|
-
if (typeof exit_namespace.isInterrupted === "function") return exit_namespace.isInterrupted(exit);
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
function get_effect_schema_field_names(schema) {
|
|
41
|
-
if (schema.fields && typeof schema.fields === "object") return Object.keys(schema.fields);
|
|
42
|
-
const get_property_signatures = Reflect.get(SchemaAST, "getPropertySignatures");
|
|
43
|
-
if (schema.ast && typeof get_property_signatures === "function") return get_property_signatures(schema.ast).map((property_signature) => property_signature.name).filter((name) => typeof name === "string");
|
|
44
|
-
const is_objects_ast = Reflect.get(SchemaAST, "isObjects");
|
|
45
|
-
if (schema.ast && typeof is_objects_ast === "function" && is_objects_ast(schema.ast) && Array.isArray(schema.ast.propertySignatures)) return schema.ast.propertySignatures.map((property_signature) => property_signature.name).filter((name) => typeof name === "string");
|
|
46
|
-
return [];
|
|
47
|
-
}
|
|
48
|
-
function to_transportable_data(value, seen = /* @__PURE__ */ new WeakMap()) {
|
|
49
|
-
if (value === null || value === void 0 || typeof value !== "object") return value;
|
|
50
|
-
if (seen.has(value)) return seen.get(value);
|
|
51
|
-
if (value instanceof Date || value instanceof RegExp || value instanceof URL || value instanceof URLSearchParams || value instanceof ArrayBuffer || ArrayBuffer.isView(value)) return value;
|
|
52
|
-
if (value instanceof Map) {
|
|
53
|
-
const normalized = /* @__PURE__ */ new Map();
|
|
54
|
-
seen.set(value, normalized);
|
|
55
|
-
for (const [key, entry] of value.entries()) normalized.set(to_transportable_data(key, seen), to_transportable_data(entry, seen));
|
|
56
|
-
return normalized;
|
|
57
|
-
}
|
|
58
|
-
if (value instanceof Set) {
|
|
59
|
-
const normalized = /* @__PURE__ */ new Set();
|
|
60
|
-
seen.set(value, normalized);
|
|
61
|
-
for (const entry of value.values()) normalized.add(to_transportable_data(entry, seen));
|
|
62
|
-
return normalized;
|
|
63
|
-
}
|
|
64
|
-
if (Array.isArray(value)) {
|
|
65
|
-
const normalized = [];
|
|
66
|
-
seen.set(value, normalized);
|
|
67
|
-
for (const entry of value) normalized.push(to_transportable_data(entry, seen));
|
|
68
|
-
return normalized;
|
|
69
|
-
}
|
|
70
|
-
const normalized = {};
|
|
71
|
-
seen.set(value, normalized);
|
|
72
|
-
const property_names = new Set(Object.keys(value));
|
|
73
|
-
if (value instanceof Error) {
|
|
74
|
-
property_names.add("name");
|
|
75
|
-
property_names.add("message");
|
|
76
|
-
if ("stack" in value) property_names.add("stack");
|
|
77
|
-
if ("cause" in value) property_names.add("cause");
|
|
78
|
-
}
|
|
79
|
-
for (const property_name of property_names) {
|
|
80
|
-
const property_value = Reflect.get(value, property_name);
|
|
81
|
-
if (property_value === void 0) continue;
|
|
82
|
-
normalized[property_name] = to_transportable_data(property_value, seen);
|
|
83
|
-
}
|
|
84
|
-
return normalized;
|
|
85
|
-
}
|
|
86
|
-
function get_fail_reason_from_cause(cause, is_fail_reason) {
|
|
87
|
-
if (!Array.isArray(cause.reasons)) return;
|
|
88
|
-
const match = cause.reasons.find((reason) => is_fail_reason ? is_fail_reason(reason) : is_fail_reason_like(reason));
|
|
89
|
-
return is_fail_reason_like(match) ? match : void 0;
|
|
90
|
-
}
|
|
91
|
-
function extract_success_value(result) {
|
|
92
|
-
if (!result || typeof result !== "object") return;
|
|
93
|
-
if ("_tag" in result && result._tag === "Success" && "value" in result) return result.value;
|
|
94
|
-
if ("_tag" in result && result._tag === "Right" && "right" in result) return result.right;
|
|
95
|
-
if ("value" in result) return result.value;
|
|
96
|
-
}
|
|
97
|
-
function is_fail_reason_like(value) {
|
|
98
|
-
return Boolean(value && typeof value === "object" && "error" in value);
|
|
99
|
-
}
|
|
100
|
-
//#endregion
|
|
101
|
-
export { make_context_key as a, get_effect_schema_field_names as i, exit_has_interrupts as n, to_standard_schema_v1 as o, get_cause_failure as r, to_transportable_data as s, create_async_effect as t };
|
|
102
|
-
|
|
103
|
-
//# sourceMappingURL=effect-compat-BhW0YPIs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"effect-compat-BhW0YPIs.js","names":[],"sources":["../../../modules/svelte-effect-runtime/internal/effect-compat.ts"],"sourcesContent":["import {\n Cause,\n Context,\n Effect,\n Exit,\n Option,\n Schema,\n SchemaAST,\n} from \"effect\";\n\nexport interface EffectContextKey<Identifier, Service> {\n readonly Identifier: Identifier;\n readonly Service: Service;\n readonly key: string;\n}\n\nexport interface EffectSchemaLike {\n readonly Encoded?: unknown;\n readonly Type?: unknown;\n readonly ast?: unknown;\n readonly fields?: Record<string, unknown>;\n}\n\ntype EffectResume<A, E, R> = (\n effect: Effect.Effect<A, E, R>,\n) => void;\n\ntype EffectCallbackFactory = <A, E = never, R = never>(\n register: (\n resume: EffectResume<A, E, R>,\n signal: AbortSignal,\n ) => void | Effect.Effect<void, never, R>,\n) => Effect.Effect<A, E, R>;\n\ntype EffectAsyncFactory = <A, E = never, R = never>(\n register: (\n resume: EffectResume<A, E, R>,\n ) => void | Effect.Effect<void, never, R>,\n) => Effect.Effect<A, E, R>;\n\ntype CauseLike = {\n readonly reasons?: ReadonlyArray<unknown>;\n};\n\ntype FailReasonLike<ErrorType = unknown> = {\n readonly error: ErrorType;\n};\n\ntype StandardSchemaFactory = (\n schema: EffectSchemaLike,\n) => unknown;\n\nexport function make_context_key<Identifier, Service = Identifier>(\n key: string,\n): EffectContextKey<Identifier, Service> {\n const context_namespace = Context as {\n GenericTag?: <I, S = I>(key: string) => EffectContextKey<I, S>;\n Service?: <I, S = I>(key: string) => EffectContextKey<I, S>;\n };\n\n if (typeof context_namespace.Service === \"function\") {\n return context_namespace.Service<Identifier, Service>(key);\n }\n\n if (typeof context_namespace.GenericTag === \"function\") {\n return context_namespace.GenericTag<Identifier, Service>(key);\n }\n\n throw new Error(\"No compatible Effect context key constructor was found.\");\n}\n\nexport function to_standard_schema_v1(\n schema: EffectSchemaLike,\n): unknown {\n const schema_namespace = Schema as unknown as {\n standardSchemaV1?: StandardSchemaFactory;\n toStandardSchemaV1?: StandardSchemaFactory;\n };\n const factory = schema_namespace.toStandardSchemaV1 ??\n schema_namespace.standardSchemaV1;\n\n if (!factory) {\n throw new Error(\n \"No compatible standard schema adapter was found in effect/Schema.\",\n );\n }\n\n return factory(schema);\n}\n\nexport function create_async_effect<A, E = never, R = never>(\n register: (\n resume: EffectResume<A, E, R>,\n ) => void | Effect.Effect<void, never, R>,\n): Effect.Effect<A, E, R> {\n const effect_namespace = Effect as unknown as {\n readonly callback?: EffectCallbackFactory;\n readonly async?: EffectAsyncFactory;\n };\n\n if (typeof effect_namespace.callback === \"function\") {\n return effect_namespace.callback((resume, _signal) => register(resume));\n }\n\n if (typeof effect_namespace.async === \"function\") {\n return effect_namespace.async(register);\n }\n\n throw new Error(\"No compatible async Effect constructor was found.\");\n}\n\nexport function get_cause_failure<ErrorType>(\n cause: unknown,\n): ErrorType | undefined {\n const cause_namespace = Cause as {\n failureOption?: (cause: unknown) => Option.Option<ErrorType>;\n findFail?: (cause: unknown) => unknown;\n isFailReason?: (reason: unknown) => reason is FailReasonLike<ErrorType>;\n };\n\n if (typeof cause_namespace.failureOption === \"function\") {\n const failure = cause_namespace.failureOption(cause);\n return Option.isSome(failure) ? failure.value : undefined;\n }\n\n const fail_reason = get_fail_reason_from_cause(\n cause as CauseLike,\n cause_namespace.isFailReason,\n );\n\n if (fail_reason) {\n return fail_reason.error as ErrorType;\n }\n\n if (typeof cause_namespace.findFail === \"function\") {\n const result = cause_namespace.findFail(cause);\n const match = extract_success_value(result);\n\n if (is_fail_reason_like(match)) {\n return match.error as ErrorType;\n }\n }\n\n return undefined;\n}\n\nexport function exit_has_interrupts<A, E>(\n exit: Exit.Exit<A, E>,\n): boolean {\n const exit_namespace = Exit as unknown as {\n readonly hasInterrupts?: (exit: Exit.Exit<A, E>) => boolean;\n readonly isInterrupted?: (exit: Exit.Exit<A, E>) => boolean;\n };\n\n if (typeof exit_namespace.hasInterrupts === \"function\") {\n return exit_namespace.hasInterrupts(exit);\n }\n\n if (typeof exit_namespace.isInterrupted === \"function\") {\n return exit_namespace.isInterrupted(exit);\n }\n\n return false;\n}\n\nexport function get_effect_schema_field_names(\n schema: EffectSchemaLike,\n): ReadonlyArray<string> {\n if (schema.fields && typeof schema.fields === \"object\") {\n return Object.keys(schema.fields);\n }\n\n const get_property_signatures = Reflect.get(\n SchemaAST as object,\n \"getPropertySignatures\",\n ) as\n | ((ast: unknown) => ReadonlyArray<{ readonly name: unknown }>)\n | undefined;\n\n if (schema.ast && typeof get_property_signatures === \"function\") {\n return get_property_signatures(schema.ast)\n .map((property_signature) => property_signature.name)\n .filter((name): name is string => typeof name === \"string\");\n }\n\n const is_objects_ast = Reflect.get(\n SchemaAST as object,\n \"isObjects\",\n ) as ((ast: unknown) => boolean) | undefined;\n\n if (\n schema.ast &&\n typeof is_objects_ast === \"function\" &&\n is_objects_ast(schema.ast) &&\n Array.isArray(\n (schema.ast as { readonly propertySignatures?: unknown })\n .propertySignatures,\n )\n ) {\n return (\n schema.ast as {\n readonly propertySignatures: ReadonlyArray<{ readonly name: unknown }>;\n }\n ).propertySignatures\n .map((property_signature) => property_signature.name)\n .filter((name): name is string => typeof name === \"string\");\n }\n\n return [];\n}\n\nexport function to_transportable_data(\n value: unknown,\n seen = new WeakMap<object, unknown>(),\n): unknown {\n if (value === null || value === undefined || typeof value !== \"object\") {\n return value;\n }\n\n if (seen.has(value)) {\n return seen.get(value);\n }\n\n if (\n value instanceof Date ||\n value instanceof RegExp ||\n value instanceof URL ||\n value instanceof URLSearchParams ||\n value instanceof ArrayBuffer ||\n ArrayBuffer.isView(value)\n ) {\n return value;\n }\n\n if (value instanceof Map) {\n const normalized = new Map<unknown, unknown>();\n seen.set(value, normalized);\n\n for (const [key, entry] of value.entries()) {\n normalized.set(\n to_transportable_data(key, seen),\n to_transportable_data(entry, seen),\n );\n }\n\n return normalized;\n }\n\n if (value instanceof Set) {\n const normalized = new Set<unknown>();\n seen.set(value, normalized);\n\n for (const entry of value.values()) {\n normalized.add(to_transportable_data(entry, seen));\n }\n\n return normalized;\n }\n\n if (Array.isArray(value)) {\n const normalized: Array<unknown> = [];\n seen.set(value, normalized);\n\n for (const entry of value) {\n normalized.push(to_transportable_data(entry, seen));\n }\n\n return normalized;\n }\n\n const normalized: Record<string, unknown> = {};\n seen.set(value, normalized);\n\n const property_names = new Set<string>(Object.keys(value));\n\n if (value instanceof Error) {\n property_names.add(\"name\");\n property_names.add(\"message\");\n\n if (\"stack\" in value) {\n property_names.add(\"stack\");\n }\n\n if (\"cause\" in value) {\n property_names.add(\"cause\");\n }\n }\n\n for (const property_name of property_names) {\n const property_value = Reflect.get(value, property_name);\n\n if (property_value === undefined) {\n continue;\n }\n\n normalized[property_name] = to_transportable_data(property_value, seen);\n }\n\n return normalized;\n}\n\nfunction get_fail_reason_from_cause<ErrorType>(\n cause: CauseLike,\n is_fail_reason?: (reason: unknown) => reason is FailReasonLike<ErrorType>,\n): FailReasonLike<ErrorType> | undefined {\n if (!Array.isArray(cause.reasons)) {\n return undefined;\n }\n\n const match = cause.reasons.find((reason) =>\n is_fail_reason ? is_fail_reason(reason) : is_fail_reason_like(reason)\n );\n\n return is_fail_reason_like(match)\n ? match as FailReasonLike<ErrorType>\n : undefined;\n}\n\nfunction extract_success_value(result: unknown): unknown {\n if (!result || typeof result !== \"object\") {\n return undefined;\n }\n\n if (\n \"_tag\" in result &&\n (result as { readonly _tag?: unknown })._tag === \"Success\" &&\n \"value\" in result\n ) {\n return (result as { readonly value?: unknown }).value;\n }\n\n if (\n \"_tag\" in result &&\n (result as { readonly _tag?: unknown })._tag === \"Right\" &&\n \"right\" in result\n ) {\n return (result as { readonly right?: unknown }).right;\n }\n\n if (\"value\" in result) {\n return (result as { readonly value?: unknown }).value;\n }\n\n return undefined;\n}\n\nfunction is_fail_reason_like(value: unknown): value is FailReasonLike {\n return Boolean(\n value &&\n typeof value === \"object\" &&\n \"error\" in value,\n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1
|
-
import { t as effect_preprocess } from "./preprocess-DIC5iR0_.js";
|
|
2
|
-
import { n as sveltekit_effect_runtime } from "./vite-Bm2RdiT3.js";
|
|
3
|
-
import { preprocess } from "svelte/compiler";
|
|
4
|
-
//#region v3/effect.ts
|
|
5
|
-
/**
|
|
6
|
-
* High-level Vite integration for `svelte-effect-runtime`.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* import { effect } from "svelte-effect-runtime";
|
|
11
|
-
*
|
|
12
|
-
* export default {
|
|
13
|
-
* plugins: [effect()],
|
|
14
|
-
* };
|
|
15
|
-
* ```
|
|
16
|
-
*
|
|
17
|
-
* @module
|
|
18
|
-
*/
|
|
19
|
-
function create_effect_svelte_transform(options = {}) {
|
|
20
|
-
const preprocessor = effect_preprocess(options);
|
|
21
|
-
return {
|
|
22
|
-
name: "svelte-effect-runtime-transform",
|
|
23
|
-
enforce: "pre",
|
|
24
|
-
async transform(code, id, _options) {
|
|
25
|
-
const filename = id.split("?", 1)[0];
|
|
26
|
-
if (!filename.endsWith(".svelte")) return null;
|
|
27
|
-
const transformed = await preprocess(code, preprocessor, { filename });
|
|
28
|
-
if (transformed.code === code) return null;
|
|
29
|
-
return {
|
|
30
|
-
code: transformed.code,
|
|
31
|
-
...transformed.map ? { map: transformed.map } : {}
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Convenience Vite plugin that enables `<script effect>` transforms and wires
|
|
38
|
-
* SvelteKit remote functions to the Effect-aware client adapters.
|
|
39
|
-
*
|
|
40
|
-
* Use this in `vite.config.ts` instead of composing lower-level runtime
|
|
41
|
-
* plugins yourself.
|
|
42
|
-
*
|
|
43
|
-
* @see https://ser.barekey.dev/
|
|
44
|
-
*/
|
|
45
|
-
function effect(options = {}) {
|
|
46
|
-
return [create_effect_svelte_transform(options.effect), sveltekit_effect_runtime({ remoteModuleId: options.remoteModuleId })];
|
|
47
|
-
}
|
|
48
|
-
//#endregion
|
|
49
|
-
export { effect as t };
|
|
50
|
-
|
|
51
|
-
//# sourceMappingURL=effect-zCli5qgO.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"effect-zCli5qgO.js","names":[],"sources":["../../../modules/svelte-effect-runtime/v3/effect.ts"],"sourcesContent":["/**\n * High-level Vite integration for `svelte-effect-runtime`.\n *\n * @example\n * ```ts\n * import { effect } from \"svelte-effect-runtime\";\n *\n * export default {\n * plugins: [effect()],\n * };\n * ```\n *\n * @module\n */\nimport { preprocess } from \"svelte/compiler\";\nimport type { Plugin, PluginOption } from \"vite\";\nimport {\n effect_preprocess,\n type EffectPreprocessOptions,\n} from \"$/v3/preprocess.ts\";\nimport { sveltekit_effect_runtime } from \"$/v3/vite.ts\";\n\n/** Options for the high-level {@link effect} Vite plugin. */\nexport interface EffectPluginOptions {\n effect?: EffectPreprocessOptions;\n remoteModuleId?: string;\n}\n\nfunction create_effect_svelte_transform(\n options: EffectPreprocessOptions = {},\n): Plugin {\n const preprocessor = effect_preprocess(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\n/**\n * Convenience Vite plugin that enables `<script effect>` transforms and wires\n * SvelteKit remote functions to the Effect-aware client adapters.\n *\n * Use this in `vite.config.ts` instead of composing lower-level runtime\n * plugins yourself.\n *\n * @see https://ser.barekey.dev/\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 sveltekit_effect_runtime({\n remoteModuleId: options.remoteModuleId,\n }),\n ];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA4BA,SAAS,+BACP,UAAmC,EAAE,EAC7B;CACR,MAAM,eAAe,kBAAkB,QAAQ;AAE/C,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;;;;;;;;;;;AAYH,SAAgB,OACd,UAA+B,EAAE,EACjB;AAGhB,QAAO,CAFkB,+BAA+B,QAAQ,OAAO,EAIrE,yBAAyB,EACvB,gBAAgB,QAAQ,gBACzB,CAAC,CACH"}
|