@thomasfosterau/effect-sveltekit 0.8.0 → 0.9.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/README.md +12 -3
- package/dist/Hooks.d.ts +0 -1
- package/dist/Hooks.js +1 -2
- package/dist/Navigation.d.ts +0 -1
- package/dist/Navigation.js +1 -2
- package/dist/Remote.d.ts +0 -1
- package/dist/Remote.js +1 -2
- package/dist/State.d.ts +0 -1
- package/dist/State.js +1 -2
- package/dist/_virtual/_rolldown/runtime.js +1 -2
- package/dist/adapter/assets.d.ts +0 -2
- package/dist/adapter/assets.js +1 -2
- package/dist/adapter/handler.d.ts +0 -2
- package/dist/adapter/handler.js +1 -2
- package/dist/adapter/index.d.ts +0 -2
- package/dist/adapter/index.js +1 -2
- package/dist/adapter/serve.d.ts +0 -2
- package/dist/adapter/serve.js +1 -2
- package/dist/api-client.d.ts +0 -2
- package/dist/api-client.js +1 -2
- package/dist/app-runtime.d.ts +0 -2
- package/dist/app-runtime.js +1 -2
- package/dist/client/Hooks.d.ts +0 -1
- package/dist/client/Hooks.js +1 -2
- package/dist/client.d.ts +9 -7
- package/dist/client.js +8 -7
- package/dist/config.d.ts +0 -2
- package/dist/config.js +1 -2
- package/dist/errors.d.ts +0 -1
- package/dist/errors.js +1 -2
- package/dist/forms.d.ts +0 -1
- package/dist/forms.js +1 -2
- package/dist/internal/app-state.d.ts +0 -2
- package/dist/internal/app-state.js +3 -3
- package/dist/internal/app-state.js.map +1 -1
- package/dist/internal/auto.d.ts +0 -2
- package/dist/internal/auto.js +1 -2
- package/dist/internal/default-runtime.js +1 -2
- package/dist/internal/enhance.d.ts +0 -2
- package/dist/internal/enhance.js +1 -2
- package/dist/internal/error.d.ts +0 -2
- package/dist/internal/error.js +1 -2
- package/dist/internal/navigation-events.js +1 -2
- package/dist/internal/remote-run.d.ts +0 -2
- package/dist/internal/remote-run.js +1 -2
- package/dist/internal/remote-validators.js +1 -2
- package/dist/internal/route-params.d.ts +0 -2
- package/dist/internal/sse.js +1 -2
- package/dist/internal/stream-callback.js +17 -0
- package/dist/internal/stream-callback.js.map +1 -0
- package/dist/internal/watch.svelte.js +1 -2
- package/dist/kit.d.ts +0 -2
- package/dist/kit.js +1 -2
- package/dist/realtime.d.ts +0 -1
- package/dist/realtime.js +4 -4
- package/dist/realtime.js.map +1 -1
- package/dist/remote-functions.d.ts +0 -2
- package/dist/remote-functions.js +1 -2
- package/dist/remote-reactive.d.ts +0 -2
- package/dist/remote-reactive.js +1 -2
- package/dist/request-parse.d.ts +0 -2
- package/dist/request-parse.js +1 -2
- package/dist/request-runtime.d.ts +0 -2
- package/dist/request-runtime.js +1 -2
- package/dist/request-services.d.ts +0 -2
- package/dist/request-services.js +1 -2
- package/dist/response-headers.d.ts +0 -2
- package/dist/response-headers.js +1 -2
- package/dist/runtime.d.ts +0 -2
- package/dist/runtime.js +1 -2
- package/dist/server/Endpoint.d.ts +0 -1
- package/dist/server/Endpoint.js +1 -2
- package/dist/server/Hooks.d.ts +0 -1
- package/dist/server/Hooks.js +1 -2
- package/dist/server.d.ts +0 -2
- package/dist/server.js +1 -2
- package/dist/streamed-load.d.ts +0 -2
- package/dist/streamed-load.js +1 -2
- package/dist/testing.d.ts +0 -2
- package/dist/testing.js +1 -2
- package/dist/transport.d.ts +0 -2
- package/dist/transport.js +1 -2
- package/dist/universal.d.ts +0 -2
- package/dist/universal.js +1 -2
- package/dist/vite.d.ts +0 -2
- package/dist/vite.js +1 -2
- package/package.json +9 -9
package/dist/server/Hooks.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { defaultServerRuntime } from "../internal/default-runtime.js";
|
|
3
3
|
import "effect/Effect";
|
|
4
|
-
|
|
4
|
+
// src/server/Hooks.ts
|
|
5
5
|
var Hooks_exports = /* @__PURE__ */ __exportAll({
|
|
6
6
|
handle: () => handle,
|
|
7
7
|
handleError: () => handleError,
|
|
@@ -102,7 +102,6 @@ function handleError(fn) {
|
|
|
102
102
|
function init(effect) {
|
|
103
103
|
return defaultServerRuntime().init(effect);
|
|
104
104
|
}
|
|
105
|
-
//#endregion
|
|
106
105
|
export { Hooks_exports, handle, handleError, handleFetch, init };
|
|
107
106
|
|
|
108
107
|
//# sourceMappingURL=Hooks.js.map
|
package/dist/server.d.ts
CHANGED
|
@@ -15,7 +15,6 @@ import { KitActionFailure, KitError, KitErrorTranslator, KitRedirect, KitTransla
|
|
|
15
15
|
import { errors_d_exports } from "./errors.js";
|
|
16
16
|
import * as Effect from "effect/Effect";
|
|
17
17
|
import { Action, Actions, RequestEvent, ServerLoad } from "@sveltejs/kit";
|
|
18
|
-
//#region src/server.d.ts
|
|
19
18
|
/**
|
|
20
19
|
* Wraps an Effect-based function to work as a SvelteKit server load function.
|
|
21
20
|
* The effect has access to platform services (HttpClient, the RequestEvent, etc.)
|
|
@@ -111,6 +110,5 @@ export declare function actions<Params extends SvelteRouteParams = SvelteRoutePa
|
|
|
111
110
|
export declare function endpoint<Params extends SvelteRouteParams = SvelteRouteParams, RouteId extends string | null = any>(fn: (event: RequestEvent<Params, RouteId>) => Effect.Effect<Response, unknown, SvelteKitServices>, options?: {
|
|
112
111
|
exposeErrors?: boolean;
|
|
113
112
|
}): (event: RequestEvent<Params, RouteId>) => Promise<Response>;
|
|
114
|
-
//#endregion
|
|
115
113
|
export { type AdapterEndpointOptions, Endpoint_d_exports as Endpoint, type ErrorTranslator, errors_d_exports as Errors, type FromLayerPerRequestOptions, Hooks_d_exports as Hooks, KitActionFailure, KitError, type KitErrorBody, type KitErrorTranslator, KitRedirect, type KitTranslatorCase, ParseError, type ParseIssue, RemoteFunction, RemoteFunctionUsageError, RequestRuntime, type RequestRuntimeProvider, type RequestRuntimeRunners, ResponseHeaders, type RuntimeAdapter, type RuntimeAdapterOptions, type RequestRuntime$1 as ScopedRequestRuntime, type ServerRuntime, type ServerRuntimeOptions, SvelteKit, SvelteKitCookies, type SvelteKitCookiesInterface, SvelteKitLocals, SvelteKitRequestEvent, SvelteKitResponseHeaders, type SvelteKitResponseHeadersInterface, SvelteKitRuntime, type SvelteKitServices, decodeFormData, decodeJson, decodeParams, decodeSearchParams, defer, makeRuntimeAdapter, makeServerRuntime, requestServicesLayer, runWithSvelteKitRuntime, sveltekitConfig, sveltekitConfigProvider };
|
|
116
114
|
//# sourceMappingURL=server.d.ts.map
|
package/dist/server.js
CHANGED
|
@@ -17,7 +17,7 @@ import * as Exit from "effect/Exit";
|
|
|
17
17
|
import { isHttpError, isRedirect } from "@sveltejs/kit";
|
|
18
18
|
import * as Cause from "effect/Cause";
|
|
19
19
|
import * as Console from "effect/Console";
|
|
20
|
-
|
|
20
|
+
// src/server.ts
|
|
21
21
|
/**
|
|
22
22
|
* Wraps an Effect-based function to work as a SvelteKit server load function.
|
|
23
23
|
* The effect has access to platform services (HttpClient, the RequestEvent, etc.)
|
|
@@ -132,7 +132,6 @@ function endpoint(fn, options) {
|
|
|
132
132
|
});
|
|
133
133
|
};
|
|
134
134
|
}
|
|
135
|
-
//#endregion
|
|
136
135
|
export { Endpoint_exports as Endpoint, errors_exports as Errors, Hooks_exports as Hooks, KitActionFailure, KitError, KitRedirect, ParseError, RemoteFunction, RemoteFunctionUsageError, RequestRuntime, ResponseHeaders, SvelteKit, SvelteKitCookies, SvelteKitLocals, SvelteKitRequestEvent, SvelteKitResponseHeaders, SvelteKitRuntime, action, actions, decodeFormData, decodeJson, decodeParams, decodeSearchParams, defer, endpoint, makeRuntimeAdapter, makeServerRuntime, requestServicesLayer, runWithSvelteKitRuntime, serverLoad, sveltekitConfig, sveltekitConfigProvider };
|
|
137
136
|
|
|
138
137
|
//# sourceMappingURL=server.js.map
|
package/dist/streamed-load.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as Effect from "effect/Effect";
|
|
2
|
-
//#region src/streamed-load.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Capture the current service context and run `effect` in the background,
|
|
5
4
|
* returning the `Promise` immediately so SvelteKit can stream the result.
|
|
@@ -17,5 +16,4 @@ import * as Effect from "effect/Effect";
|
|
|
17
16
|
* ```
|
|
18
17
|
*/
|
|
19
18
|
export declare const defer: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<Promise<A>, never, R>;
|
|
20
|
-
//#endregion
|
|
21
19
|
//# sourceMappingURL=streamed-load.d.ts.map
|
package/dist/streamed-load.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as Effect from "effect/Effect";
|
|
2
|
-
|
|
2
|
+
// src/streamed-load.ts
|
|
3
3
|
/**
|
|
4
4
|
* Helpers for SvelteKit's streamed (deferred-promise) `serverLoad` data.
|
|
5
5
|
*
|
|
@@ -68,7 +68,6 @@ import * as Effect from "effect/Effect";
|
|
|
68
68
|
* ```
|
|
69
69
|
*/
|
|
70
70
|
const defer = (effect) => Effect.map(Effect.context(), (ctx) => Effect.runPromiseWith(ctx)(effect));
|
|
71
|
-
//#endregion
|
|
72
71
|
export { defer };
|
|
73
72
|
|
|
74
73
|
//# sourceMappingURL=streamed-load.js.map
|
package/dist/testing.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { FormErrorMapper, RunHelpers } from "./internal/remote-run.js";
|
|
|
3
3
|
import * as Effect from "effect/Effect";
|
|
4
4
|
import * as Layer from "effect/Layer";
|
|
5
5
|
import { RequestEvent } from "@sveltejs/kit";
|
|
6
|
-
//#region src/testing.d.ts
|
|
7
6
|
/** Options for {@link TestRequestEvent}. */
|
|
8
7
|
export interface TestRequestEventOptions {
|
|
9
8
|
/**
|
|
@@ -170,6 +169,5 @@ export declare const runEndpoint: <R>(fn: (event: RequestEvent) => Effect.Effect
|
|
|
170
169
|
* ```
|
|
171
170
|
*/
|
|
172
171
|
export declare const runRemote: <R = never>(event: RequestEvent, opts?: RunRemoteOptions<R>) => RunHelpers;
|
|
173
|
-
//#endregion
|
|
174
172
|
export type { FormErrorMapper, RunHelpers };
|
|
175
173
|
//# sourceMappingURL=testing.d.ts.map
|
package/dist/testing.js
CHANGED
|
@@ -6,7 +6,7 @@ import * as Layer from "effect/Layer";
|
|
|
6
6
|
import * as Rec from "effect/Record";
|
|
7
7
|
import * as Arr from "effect/Array";
|
|
8
8
|
import * as Option from "effect/Option";
|
|
9
|
-
|
|
9
|
+
// src/testing.ts
|
|
10
10
|
/**
|
|
11
11
|
* In-memory Cookies implementation for use in {@link TestRequestEvent}: an
|
|
12
12
|
* ordered list, so `getAll()` returns cookies in the order they were first set
|
|
@@ -167,7 +167,6 @@ const runRemote = (event, opts) => {
|
|
|
167
167
|
const provider = RequestRuntime.fromLayer(layer);
|
|
168
168
|
return makeRunHelpers(() => ({ runExit: (effect) => provider.run(event).runPromiseExit(effect) }), translate, opts?.formError);
|
|
169
169
|
};
|
|
170
|
-
//#endregion
|
|
171
170
|
export { TestRequestEvent, runAction, runEndpoint, runRemote, runServerLoad };
|
|
172
171
|
|
|
173
172
|
//# sourceMappingURL=testing.js.map
|
package/dist/transport.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as Schema from "effect/Schema";
|
|
2
2
|
import { Transport, Transporter } from "@sveltejs/kit/hooks";
|
|
3
|
-
//#region src/transport.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Builds a SvelteKit {@link Transporter} from an Effect {@link Schema.Codec}.
|
|
6
5
|
*
|
|
@@ -55,5 +54,4 @@ export type TransportEntry = Schema.Codec<any, any> | Transporter<any, any>;
|
|
|
55
54
|
* labels (they only need to be stable between server and client).
|
|
56
55
|
*/
|
|
57
56
|
export declare const transport: (entries: Record<string, TransportEntry>) => Transport;
|
|
58
|
-
//#endregion
|
|
59
57
|
//# sourceMappingURL=transport.d.ts.map
|
package/dist/transport.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Rec from "effect/Record";
|
|
2
2
|
import * as Schema from "effect/Schema";
|
|
3
|
-
|
|
3
|
+
// src/transport.ts
|
|
4
4
|
/**
|
|
5
5
|
* Builds a SvelteKit {@link Transporter} from an Effect {@link Schema.Codec}.
|
|
6
6
|
*
|
|
@@ -55,7 +55,6 @@ const markerTransporter = (options) => {
|
|
|
55
55
|
* labels (they only need to be stable between server and client).
|
|
56
56
|
*/
|
|
57
57
|
const transport = (entries) => Rec.map(entries, (entry) => Schema.isSchema(entry) ? transporter(entry) : entry);
|
|
58
|
-
//#endregion
|
|
59
58
|
export { markerTransporter, transport, transporter };
|
|
60
59
|
|
|
61
60
|
//# sourceMappingURL=transport.js.map
|
package/dist/universal.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { UniversalRuntime, makeUniversalRuntime } from "./app-runtime.js";
|
|
|
3
3
|
import * as Effect from "effect/Effect";
|
|
4
4
|
import * as HttpClient from "effect/http/HttpClient";
|
|
5
5
|
import { Load } from "@sveltejs/kit";
|
|
6
|
-
//#region src/universal.d.ts
|
|
7
6
|
/**
|
|
8
7
|
* Wraps an Effect-based function to work as a SvelteKit universal load function.
|
|
9
8
|
*
|
|
@@ -30,6 +29,5 @@ import { Load } from "@sveltejs/kit";
|
|
|
30
29
|
* ```
|
|
31
30
|
*/
|
|
32
31
|
export declare function load<Params extends SvelteRouteParams = SvelteRouteParams, InputData extends Record<string, unknown> | null = any, ParentData extends Record<string, unknown> = any, OutputData extends Record<string, unknown> | void = any, RouteId extends string | null = any>(fn: (event: Parameters<Load<Params, InputData, ParentData, OutputData, RouteId>>[0]) => Effect.Effect<OutputData, unknown, HttpClient.HttpClient>): Load<Params, InputData, ParentData, OutputData, RouteId>;
|
|
33
|
-
//#endregion
|
|
34
32
|
export { type UniversalRuntime, makeUniversalRuntime };
|
|
35
33
|
//# sourceMappingURL=universal.d.ts.map
|
package/dist/universal.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { makeUniversalRuntime } from "./app-runtime.js";
|
|
2
2
|
import { defaultUniversalRuntime } from "./internal/default-runtime.js";
|
|
3
3
|
import "effect/Effect";
|
|
4
|
-
|
|
4
|
+
// src/universal.ts
|
|
5
5
|
/**
|
|
6
6
|
* Wraps an Effect-based function to work as a SvelteKit universal load function.
|
|
7
7
|
*
|
|
@@ -30,7 +30,6 @@ import "effect/Effect";
|
|
|
30
30
|
function load(fn) {
|
|
31
31
|
return defaultUniversalRuntime().load(fn);
|
|
32
32
|
}
|
|
33
|
-
//#endregion
|
|
34
33
|
export { load, makeUniversalRuntime };
|
|
35
34
|
|
|
36
35
|
//# sourceMappingURL=universal.js.map
|
package/dist/vite.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Plugin } from "vite";
|
|
2
|
-
//#region src/vite.d.ts
|
|
3
2
|
/** The SvelteKit route and hook file kinds `effectKit()` can rewrite. */
|
|
4
3
|
export type EffectKitFileKind = "pageServer" | "page" | "layoutServer" | "layout" | "server" | "hooks" | "hooksServer" | "hooksClient";
|
|
5
4
|
/** Options for {@link effectKit}. */
|
|
@@ -38,6 +37,5 @@ export interface EffectKitPluginOptions {
|
|
|
38
37
|
* function-shaped export.
|
|
39
38
|
*/
|
|
40
39
|
export declare function effectKit(options?: EffectKitPluginOptions): Plugin;
|
|
41
|
-
//#endregion
|
|
42
40
|
export { effectKit as default };
|
|
43
41
|
//# sourceMappingURL=vite.d.ts.map
|
package/dist/vite.js
CHANGED
|
@@ -3,7 +3,7 @@ import * as Result from "effect/Result";
|
|
|
3
3
|
import * as Arr from "effect/Array";
|
|
4
4
|
import * as Option from "effect/Option";
|
|
5
5
|
import MagicString from "magic-string";
|
|
6
|
-
|
|
6
|
+
// src/vite.ts
|
|
7
7
|
/**
|
|
8
8
|
* Vite plugin that lets you write SvelteKit route exports as Effects (or
|
|
9
9
|
* functions returning Effects) without manually wrapping them.
|
|
@@ -235,7 +235,6 @@ function effectKit(options = {}) {
|
|
|
235
235
|
}
|
|
236
236
|
};
|
|
237
237
|
}
|
|
238
|
-
//#endregion
|
|
239
238
|
export { effectKit as default, effectKit };
|
|
240
239
|
|
|
241
240
|
//# sourceMappingURL=vite.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thomasfosterau/effect-sveltekit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "Effect integration for SvelteKit: load/action/endpoint wrappers, remote functions, an effectKit() Vite plugin, and an Effect HTTP deployment adapter",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"effect",
|
|
@@ -74,20 +74,20 @@
|
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
76
|
"@standard-schema/spec": "^1.1.0",
|
|
77
|
-
"@thomasfosterau/effect-svelte": "^0.6.
|
|
78
|
-
"magic-string": "^1.4.
|
|
77
|
+
"@thomasfosterau/effect-svelte": "^0.6.1",
|
|
78
|
+
"magic-string": "^1.4.5"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"@effect/platform-node": "4.0.5",
|
|
82
|
-
"@sveltejs/kit": "^3.1.
|
|
83
|
-
"svelte": "^5.57.
|
|
84
|
-
"svelte-check": "^4.7.
|
|
82
|
+
"@sveltejs/kit": "^3.1.1",
|
|
83
|
+
"svelte": "^5.57.3",
|
|
84
|
+
"svelte-check": "^4.7.8",
|
|
85
85
|
"typescript": "npm:@typescript/typescript6@6.0.2"
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|
|
88
|
-
"@effect/platform-node": "
|
|
89
|
-
"@sveltejs/kit": "^3.1.
|
|
90
|
-
"effect": "
|
|
88
|
+
"@effect/platform-node": "^4.0.0",
|
|
89
|
+
"@sveltejs/kit": "^3.1.1",
|
|
90
|
+
"effect": "^4.0.0",
|
|
91
91
|
"svelte": "^5.40.0",
|
|
92
92
|
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0"
|
|
93
93
|
},
|