sevok 0.0.2 → 0.0.3
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/bun.d.mts +1 -1
- package/dist/cli.d.mts +2 -2
- package/dist/cli.mjs +3 -3
- package/dist/{core-CmUugTW7.mjs → core-Cb5IXDeA.mjs} +37 -15
- package/dist/{core-BGp2ZR_k.d.mts → core-D6CtUiKb.d.mts} +115 -30
- package/dist/deno.d.mts +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/log.d.mts +2 -2
- package/dist/node.d.mts +1 -1
- package/dist/static.d.mts +2 -2
- package/dist/stream.d.mts +1 -1
- package/package.json +4 -1
package/dist/bun.d.mts
CHANGED
package/dist/cli.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b as ServerHandlerFunction, f as RuntimeAdapter } from "./core-D6CtUiKb.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/cli.d.ts
|
|
4
4
|
declare const defaultExts: string[];
|
|
@@ -15,7 +15,7 @@ type LoadedServerEntry = {
|
|
|
15
15
|
* - `module.default.fetch`
|
|
16
16
|
* - or a default-exported function with fewer than two parameters
|
|
17
17
|
*/
|
|
18
|
-
fetch?:
|
|
18
|
+
fetch?: ServerHandlerFunction;
|
|
19
19
|
/**
|
|
20
20
|
* The normalized loaded module.
|
|
21
21
|
*
|
package/dist/cli.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { u as loadServerAdapter } from "./core-
|
|
1
|
+
import { u as loadServerAdapter } from "./core-Cb5IXDeA.mjs";
|
|
2
2
|
import { t as _color_default } from "./_color-B42q-MpL.mjs";
|
|
3
3
|
import { existsSync, statSync } from "node:fs";
|
|
4
4
|
import { parseArgs } from "node:util";
|
|
@@ -9,7 +9,7 @@ import { dirname, relative, resolve } from "node:path";
|
|
|
9
9
|
//#region src/_meta.ts
|
|
10
10
|
const pkgMeta = {
|
|
11
11
|
name: "sevok",
|
|
12
|
-
version: "0.0.
|
|
12
|
+
version: "0.0.3",
|
|
13
13
|
description: "Composable Server Primitives Across Runtimes"
|
|
14
14
|
};
|
|
15
15
|
//#endregion
|
|
@@ -371,7 +371,7 @@ async function cliServe(cliOpts) {
|
|
|
371
371
|
entry: cliOpts.entry,
|
|
372
372
|
dir: cliOpts.dir
|
|
373
373
|
});
|
|
374
|
-
const { serve } = await import("./core-
|
|
374
|
+
const { serve } = await import("./core-Cb5IXDeA.mjs").then((n) => n.o);
|
|
375
375
|
const { serveStatic } = await import("./static.mjs");
|
|
376
376
|
const { log } = await import("./log.mjs");
|
|
377
377
|
const staticDir = resolve(cliOpts.dir || (loaded.url ? dirname(fileURLToPath(loaded.url)) : "."), cliOpts.static || "public");
|
|
@@ -250,21 +250,21 @@ function createWaitUntil() {
|
|
|
250
250
|
* Normalize handlers so middleware runners can treat function and object forms
|
|
251
251
|
* uniformly.
|
|
252
252
|
*
|
|
253
|
-
* A bare handler becomes `{
|
|
253
|
+
* A bare handler becomes `{ handle }`, while object handlers are returned
|
|
254
254
|
* unchanged.
|
|
255
255
|
*/
|
|
256
256
|
function toServerHandlerObject(handler) {
|
|
257
|
-
if (typeof handler === "function") return {
|
|
257
|
+
if (typeof handler === "function") return { handle: handler };
|
|
258
258
|
return handler;
|
|
259
259
|
}
|
|
260
260
|
/**
|
|
261
261
|
* Type guard to check if a value conforms to the `ServerHandlerObject` shape.
|
|
262
262
|
*
|
|
263
|
-
* This is used to distinguish between a bare `
|
|
263
|
+
* This is used to distinguish between a bare `ServerHandlerFunction` and an
|
|
264
264
|
* object wrapper that may also carry per-route middleware.
|
|
265
265
|
*/
|
|
266
266
|
function isServerHandlerObject(value) {
|
|
267
|
-
return value != null && !Array.isArray(value) && typeof value === "object" && "
|
|
267
|
+
return value != null && !Array.isArray(value) && typeof value === "object" && "handle" in value && typeof value.handle === "function";
|
|
268
268
|
}
|
|
269
269
|
/**
|
|
270
270
|
* Execute middleware in sequence and then hand off to the terminal handler.
|
|
@@ -278,23 +278,30 @@ function isServerHandlerObject(value) {
|
|
|
278
278
|
* If the terminal handler is a `ServerHandlerObject`, its own `middleware`
|
|
279
279
|
* array is executed after the outer middleware chain completes.
|
|
280
280
|
*/
|
|
281
|
-
function runMiddleware(context, middleware, terminal) {
|
|
281
|
+
function runMiddleware({ context, middleware, terminal, resolve }) {
|
|
282
282
|
let index = -1;
|
|
283
283
|
const dispatch = async (context, i) => {
|
|
284
284
|
if (i <= index) throw new Error("next() called multiple times");
|
|
285
285
|
index = i;
|
|
286
286
|
if (context.request.signal.aborted) throw context.request.signal.reason;
|
|
287
|
-
const
|
|
288
|
-
if (
|
|
289
|
-
const { middleware,
|
|
290
|
-
if (middleware?.length) return runMiddleware(
|
|
291
|
-
|
|
287
|
+
const entry = middleware[i];
|
|
288
|
+
if (entry == null) {
|
|
289
|
+
const { middleware, handle } = toServerHandlerObject(terminal);
|
|
290
|
+
if (middleware?.length) return runMiddleware({
|
|
291
|
+
context,
|
|
292
|
+
middleware,
|
|
293
|
+
terminal: handle,
|
|
294
|
+
resolve
|
|
295
|
+
});
|
|
296
|
+
return await raceRequestAbort(Promise.resolve(handle(context)), context.request);
|
|
292
297
|
}
|
|
293
298
|
let nextPromise;
|
|
294
299
|
let next = (nextContext) => {
|
|
295
300
|
nextPromise = dispatch(nextContext, i + 1);
|
|
296
301
|
return nextPromise;
|
|
297
302
|
};
|
|
303
|
+
const fn = typeof entry === "function" ? entry : resolve?.(entry);
|
|
304
|
+
if (!fn) return next(context);
|
|
298
305
|
let response = await raceRequestAbort(Promise.resolve(fn(context, next)), context.request);
|
|
299
306
|
if (response instanceof Response) return response;
|
|
300
307
|
if (nextPromise != null) return nextPromise;
|
|
@@ -424,7 +431,7 @@ function unstable_match(tree, input) {
|
|
|
424
431
|
};
|
|
425
432
|
}
|
|
426
433
|
/**
|
|
427
|
-
* Turn a precompiled route tree into a `
|
|
434
|
+
* Turn a precompiled route tree into a `ServerHandlerFunction`.
|
|
428
435
|
*
|
|
429
436
|
* Pathname matches are resolved using Bun-style precedence. When a pathname
|
|
430
437
|
* matches but the method does not, the returned handler responds with `405`
|
|
@@ -438,9 +445,13 @@ function unstable_convertRoutesToHandler({ input, fallback, runRouteMiddleware }
|
|
|
438
445
|
if (route) {
|
|
439
446
|
context = context.with({ params: route.params });
|
|
440
447
|
if (typeof route.handler === "function") return route.handler(context);
|
|
441
|
-
if (!route.handler.middleware?.length) return route.handler.
|
|
448
|
+
if (!route.handler.middleware?.length) return route.handler.handle(context);
|
|
442
449
|
if (!runRouteMiddleware) throw new Error("Route handler middleware requires `runRouteMiddleware`.");
|
|
443
|
-
return runRouteMiddleware(
|
|
450
|
+
return runRouteMiddleware({
|
|
451
|
+
context,
|
|
452
|
+
middleware: route.handler.middleware,
|
|
453
|
+
terminal: route.handler.handle
|
|
454
|
+
});
|
|
444
455
|
}
|
|
445
456
|
if (result.all.length > 0) {
|
|
446
457
|
const allow = /* @__PURE__ */ new Set();
|
|
@@ -626,6 +637,9 @@ var Server = class extends EventDispatcher {
|
|
|
626
637
|
}
|
|
627
638
|
/**
|
|
628
639
|
* Invoke the composed request pipeline directly.
|
|
640
|
+
*
|
|
641
|
+
* If runtime adapter initialization is still in flight, this waits for the
|
|
642
|
+
* adapter setup to finish before dispatching the request.
|
|
629
643
|
*/
|
|
630
644
|
handle(context) {
|
|
631
645
|
if (this.#adapterPromise) return this.#adapterPromise.then(() => this.#kernel(context));
|
|
@@ -712,6 +726,10 @@ function wrapFetch(server) {
|
|
|
712
726
|
const fetchHandler = server.options.fetch;
|
|
713
727
|
const routes = server.options.routes;
|
|
714
728
|
const middleware = server.options.middleware || [];
|
|
729
|
+
const callMiddleware = (options) => runMiddleware({
|
|
730
|
+
...options,
|
|
731
|
+
resolve: server.options.middlewareResolver
|
|
732
|
+
});
|
|
715
733
|
let handler;
|
|
716
734
|
if (!routes) {
|
|
717
735
|
if (!fetchHandler) throw new Error("Server requires either `routes` or `fetch`.");
|
|
@@ -723,10 +741,14 @@ function wrapFetch(server) {
|
|
|
723
741
|
handler = unstable_convertRoutesToHandler({
|
|
724
742
|
input: unstable_buildRouteTree(routes),
|
|
725
743
|
fallback: fetchHandler,
|
|
726
|
-
runRouteMiddleware:
|
|
744
|
+
runRouteMiddleware: callMiddleware
|
|
727
745
|
});
|
|
728
746
|
}
|
|
729
|
-
return middleware.length === 0 ? handler : (context) =>
|
|
747
|
+
return middleware.length === 0 ? handler : (context) => callMiddleware({
|
|
748
|
+
context,
|
|
749
|
+
middleware,
|
|
750
|
+
terminal: handler
|
|
751
|
+
});
|
|
730
752
|
}
|
|
731
753
|
//#endregion
|
|
732
754
|
export { unstable_match as _, ServerServeEvent as a, createWaitUntil as c, raceRequestAbort as d, runMiddleware as f, unstable_convertRoutesToHandler as g, unstable_buildRouteTree as h, ServerErrorEvent as i, isServerHandlerObject as l, toServerHandlerObject as m, Server as n, core_exports as o, serve as p, ServerCloseEvent as r, createContextKey as s, InvocationContext as t, loadServerAdapter as u, wrapFetch as v };
|
|
@@ -15,9 +15,39 @@ type HTTPMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTION
|
|
|
15
15
|
*
|
|
16
16
|
* Receives an `InvocationContext` containing the request and invocation state.
|
|
17
17
|
* Runtime adapters, middleware, and higher-level helpers all eventually resolve down to a
|
|
18
|
-
* `
|
|
18
|
+
* `ServerHandlerFunction`.
|
|
19
19
|
*/
|
|
20
|
-
type
|
|
20
|
+
type ServerHandlerFunction = (context: InvocationContext) => MaybePromise<Response>;
|
|
21
|
+
/**
|
|
22
|
+
* Object form of a handler.
|
|
23
|
+
*
|
|
24
|
+
* This makes it possible to attach middleware at the leaf of a middleware
|
|
25
|
+
* chain, which is useful for composing route handlers or feature modules.
|
|
26
|
+
*/
|
|
27
|
+
type ServerHandlerObject = {
|
|
28
|
+
/**
|
|
29
|
+
* Additional middleware to apply immediately before `handle`.
|
|
30
|
+
*/
|
|
31
|
+
middleware?: ServerMiddleware[];
|
|
32
|
+
/**
|
|
33
|
+
* Final request handler invoked after middleware has run.
|
|
34
|
+
*/
|
|
35
|
+
handle: ServerHandlerFunction;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* A request handler in either function or object form.
|
|
39
|
+
*
|
|
40
|
+
* This lets higher-level APIs accept a bare handler function for simple cases
|
|
41
|
+
* or a handler object when route-local middleware needs to be attached.
|
|
42
|
+
*/
|
|
43
|
+
type ServerHandler = ServerHandlerFunction | ServerHandlerObject;
|
|
44
|
+
/**
|
|
45
|
+
* Per-method handlers for a single route path.
|
|
46
|
+
*
|
|
47
|
+
* This is the route-table branch used when the same pathname needs distinct
|
|
48
|
+
* handlers for different HTTP methods.
|
|
49
|
+
*/
|
|
50
|
+
type ServerMethodHandlers = Partial<Record<HTTPMethod, ServerHandler>>;
|
|
21
51
|
/**
|
|
22
52
|
* Error handler for failures raised during request handling.
|
|
23
53
|
*
|
|
@@ -31,23 +61,51 @@ type ErrorHandler = (error: unknown) => MaybePromise<Response>;
|
|
|
31
61
|
* `next` keeps the same handler signature so middleware can replace the request
|
|
32
62
|
* object before passing control downstream.
|
|
33
63
|
*/
|
|
34
|
-
type
|
|
64
|
+
type ServerMiddlewareFunction = (context: InvocationContext, next: ServerHandlerFunction) => MaybePromise<Response>;
|
|
35
65
|
/**
|
|
36
|
-
*
|
|
66
|
+
* A named middleware reference resolved at execution time.
|
|
37
67
|
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
68
|
+
* Use this when middleware registration and middleware lookup need to be
|
|
69
|
+
* decoupled, for example when an application maintains its own middleware
|
|
70
|
+
* registry.
|
|
71
|
+
*
|
|
72
|
+
* Consumers can extend `ServerMiddlewareNameMap` with module augmentation to
|
|
73
|
+
* surface application-specific named middleware entries in the type system.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```ts
|
|
77
|
+
* declare module "sevok" {
|
|
78
|
+
* interface ServerMiddlewareNameMap {
|
|
79
|
+
* auth: true;
|
|
80
|
+
* cache: true;
|
|
81
|
+
* }
|
|
82
|
+
* }
|
|
83
|
+
* ```
|
|
40
84
|
*/
|
|
41
|
-
type
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
85
|
+
type ServerMiddlewareName = keyof ServerMiddlewareNameMap | (string & {});
|
|
86
|
+
/**
|
|
87
|
+
* Augmentation hook for adding application-specific named middleware entries.
|
|
88
|
+
*
|
|
89
|
+
* Consumers can extend this interface with module augmentation so known
|
|
90
|
+
* middleware names appear in `ServerMiddlewareName`.
|
|
91
|
+
*/
|
|
92
|
+
interface ServerMiddlewareNameMap {}
|
|
93
|
+
/**
|
|
94
|
+
* A middleware entry accepted by server and handler middleware arrays.
|
|
95
|
+
*
|
|
96
|
+
* Entries can be either executable middleware functions or named references
|
|
97
|
+
* resolved through `ServerMiddlewareResolver`.
|
|
98
|
+
*/
|
|
99
|
+
type ServerMiddleware = ServerMiddlewareFunction | ServerMiddlewareName;
|
|
100
|
+
/**
|
|
101
|
+
* Resolve a named middleware entry into an executable middleware function.
|
|
102
|
+
*
|
|
103
|
+
* Returning `undefined` indicates that the name could not be resolved. The
|
|
104
|
+
* middleware runner intentionally treats unresolved names as skipped entries and
|
|
105
|
+
* continues the chain. Consumers that require fail-fast behavior should throw
|
|
106
|
+
* from their resolver instead of returning `undefined`.
|
|
107
|
+
*/
|
|
108
|
+
type ServerMiddlewareResolver = (name: ServerMiddlewareName) => ServerMiddlewareFunction | undefined;
|
|
51
109
|
/**
|
|
52
110
|
* Route-table shorthand keyed by pathname.
|
|
53
111
|
*
|
|
@@ -55,7 +113,7 @@ type ServerHandlerObject = {
|
|
|
55
113
|
* middleware, or a method map when the same path needs different handlers for
|
|
56
114
|
* different HTTP verbs.
|
|
57
115
|
*/
|
|
58
|
-
type ServerRoutes<TPath extends string = string> = { [Path in TPath]: ServerHandler |
|
|
116
|
+
type ServerRoutes<TPath extends string = string> = { [Path in TPath]: ServerHandler | ServerMethodHandlers };
|
|
59
117
|
/**
|
|
60
118
|
* A type-safe key for storing and retrieving values from
|
|
61
119
|
* {@link InvocationContext}.
|
|
@@ -197,17 +255,29 @@ declare function createWaitUntil(): WaitUntil;
|
|
|
197
255
|
* Normalize handlers so middleware runners can treat function and object forms
|
|
198
256
|
* uniformly.
|
|
199
257
|
*
|
|
200
|
-
* A bare handler becomes `{
|
|
258
|
+
* A bare handler becomes `{ handle }`, while object handlers are returned
|
|
201
259
|
* unchanged.
|
|
202
260
|
*/
|
|
203
|
-
declare function toServerHandlerObject(handler: ServerHandler
|
|
261
|
+
declare function toServerHandlerObject(handler: ServerHandler): ServerHandlerObject;
|
|
204
262
|
/**
|
|
205
263
|
* Type guard to check if a value conforms to the `ServerHandlerObject` shape.
|
|
206
264
|
*
|
|
207
|
-
* This is used to distinguish between a bare `
|
|
265
|
+
* This is used to distinguish between a bare `ServerHandlerFunction` and an
|
|
208
266
|
* object wrapper that may also carry per-route middleware.
|
|
209
267
|
*/
|
|
210
268
|
declare function isServerHandlerObject(value: unknown): value is ServerHandlerObject;
|
|
269
|
+
/**
|
|
270
|
+
* Input for running a middleware chain against a terminal handler.
|
|
271
|
+
*
|
|
272
|
+
* `resolve` is only needed when the middleware array may contain named
|
|
273
|
+
* middleware entries instead of executable middleware functions.
|
|
274
|
+
*/
|
|
275
|
+
type RunMiddlewareOptions = {
|
|
276
|
+
context: InvocationContext;
|
|
277
|
+
middleware: ServerMiddleware[];
|
|
278
|
+
terminal: ServerHandler;
|
|
279
|
+
resolve?: ServerMiddlewareResolver;
|
|
280
|
+
};
|
|
211
281
|
/**
|
|
212
282
|
* Execute middleware in sequence and then hand off to the terminal handler.
|
|
213
283
|
*
|
|
@@ -220,12 +290,17 @@ declare function isServerHandlerObject(value: unknown): value is ServerHandlerOb
|
|
|
220
290
|
* If the terminal handler is a `ServerHandlerObject`, its own `middleware`
|
|
221
291
|
* array is executed after the outer middleware chain completes.
|
|
222
292
|
*/
|
|
223
|
-
declare function runMiddleware(
|
|
293
|
+
declare function runMiddleware({
|
|
294
|
+
context,
|
|
295
|
+
middleware,
|
|
296
|
+
terminal,
|
|
297
|
+
resolve
|
|
298
|
+
}: RunMiddlewareOptions): Promise<Response>;
|
|
224
299
|
type RouteInput = Request | URL | string | {
|
|
225
300
|
url: string | URL;
|
|
226
301
|
method?: HTTPMethod;
|
|
227
302
|
};
|
|
228
|
-
type RouteValue = ServerHandler |
|
|
303
|
+
type RouteValue = ServerHandler | ServerMethodHandlers;
|
|
229
304
|
type CompiledRoute = {
|
|
230
305
|
path: string;
|
|
231
306
|
route: RouteValue;
|
|
@@ -257,7 +332,7 @@ type RouteCandidate = {
|
|
|
257
332
|
* method.
|
|
258
333
|
*/
|
|
259
334
|
type UnstableRouteMatch = RouteCandidate & {
|
|
260
|
-
handler: ServerHandler
|
|
335
|
+
handler: ServerHandler;
|
|
261
336
|
method?: HTTPMethod;
|
|
262
337
|
};
|
|
263
338
|
/**
|
|
@@ -286,11 +361,11 @@ declare function unstable_buildRouteTree(routes: ServerRoutes): RouteTree;
|
|
|
286
361
|
declare function unstable_match(tree: RouteTree, input: RouteInput): UnstableRouteMatchResult;
|
|
287
362
|
type UnstableConvertRoutesToHandlerOptions = {
|
|
288
363
|
input: RouteTree;
|
|
289
|
-
fallback?:
|
|
290
|
-
runRouteMiddleware?: (
|
|
364
|
+
fallback?: ServerHandlerFunction;
|
|
365
|
+
runRouteMiddleware?: (options: Omit<RunMiddlewareOptions, "resolve">) => Promise<Response>;
|
|
291
366
|
};
|
|
292
367
|
/**
|
|
293
|
-
* Turn a precompiled route tree into a `
|
|
368
|
+
* Turn a precompiled route tree into a `ServerHandlerFunction`.
|
|
294
369
|
*
|
|
295
370
|
* Pathname matches are resolved using Bun-style precedence. When a pathname
|
|
296
371
|
* matches but the method does not, the returned handler responds with `405`
|
|
@@ -301,7 +376,7 @@ declare function unstable_convertRoutesToHandler({
|
|
|
301
376
|
input,
|
|
302
377
|
fallback,
|
|
303
378
|
runRouteMiddleware
|
|
304
|
-
}: UnstableConvertRoutesToHandlerOptions):
|
|
379
|
+
}: UnstableConvertRoutesToHandlerOptions): ServerHandlerFunction;
|
|
305
380
|
/**
|
|
306
381
|
* Host capabilities required by middleware and helpers that need filesystem or
|
|
307
382
|
* compression support.
|
|
@@ -450,7 +525,7 @@ interface ServerOptions {
|
|
|
450
525
|
* route table. When `routes` is omitted, this acts as the primary request
|
|
451
526
|
* handler.
|
|
452
527
|
*/
|
|
453
|
-
fetch?:
|
|
528
|
+
fetch?: ServerHandlerFunction;
|
|
454
529
|
/**
|
|
455
530
|
* Handle errors raised while processing requests.
|
|
456
531
|
*
|
|
@@ -463,6 +538,13 @@ interface ServerOptions {
|
|
|
463
538
|
* Middleware is executed in the order provided.
|
|
464
539
|
*/
|
|
465
540
|
middleware: ServerMiddleware[];
|
|
541
|
+
/**
|
|
542
|
+
* Resolve named middleware entries at request execution time.
|
|
543
|
+
*
|
|
544
|
+
* When omitted, named middleware entries are skipped. Throw from the resolver
|
|
545
|
+
* if unresolved names should fail the request instead.
|
|
546
|
+
*/
|
|
547
|
+
middlewareResolver?: ServerMiddlewareResolver;
|
|
466
548
|
/**
|
|
467
549
|
* If set to `true`, server will not start listening automatically.
|
|
468
550
|
*/
|
|
@@ -629,6 +711,9 @@ declare class Server extends EventDispatcher<ServerEventMap> {
|
|
|
629
711
|
createContext(request: Request, params?: Readonly<Record<string, string>>): InvocationContext;
|
|
630
712
|
/**
|
|
631
713
|
* Invoke the composed request pipeline directly.
|
|
714
|
+
*
|
|
715
|
+
* If runtime adapter initialization is still in flight, this waits for the
|
|
716
|
+
* adapter setup to finish before dispatching the request.
|
|
632
717
|
*/
|
|
633
718
|
handle(context: InvocationContext): MaybePromise<Response>;
|
|
634
719
|
/**
|
|
@@ -660,6 +745,6 @@ declare class Server extends EventDispatcher<ServerEventMap> {
|
|
|
660
745
|
* Compose fetch handler, middleware, and optional error handling into the
|
|
661
746
|
* single request kernel used by `Server`.
|
|
662
747
|
*/
|
|
663
|
-
declare function wrapFetch(server: Server):
|
|
748
|
+
declare function wrapFetch(server: Server): ServerHandlerFunction;
|
|
664
749
|
//#endregion
|
|
665
|
-
export {
|
|
750
|
+
export { ServerPlugin as A, createWaitUntil as B, ServerMethodHandlers as C, ServerMiddlewareNameMap as D, ServerMiddlewareName as E, UnstableRouteMatch as F, serve as G, loadServerAdapter as H, UnstableRouteMatchResult as I, unstable_convertRoutesToHandler as J, toServerHandlerObject as K, WaitUntil as L, ServerServeEvent as M, TLSOptions as N, ServerMiddlewareResolver as O, UnstableConvertRoutesToHandlerOptions as P, WaitUntilFunction as R, ServerInit as S, ServerMiddlewareFunction as T, raceRequestAbort as U, isServerHandlerObject as V, runMiddleware as W, wrapFetch as X, unstable_match as Y, ServerEventMap as _, InvocationContext as a, ServerHandlerFunction as b, InvocationContextValue as c, RunMiddlewareOptions as d, RuntimeAdapter as f, ServerErrorEvent as g, ServerCloseEvent as h, HTTPMethod as i, ServerRoutes as j, ServerOptions as k, MaybePromise as l, Server as m, DenoServerOptions as n, InvocationContextInit as o, RuntimeCapabilities as p, unstable_buildRouteTree as q, ErrorHandler as r, InvocationContextKey as s, BunServerOptions as t, NodeServerOptions as u, ServerEventMapCustom as v, ServerMiddleware as w, ServerHandlerObject as x, ServerHandler as y, createContextKey as z };
|
package/dist/deno.d.mts
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
export { BunServerOptions, DenoServerOptions, ErrorHandler, HTTPMethod, InvocationContext, InvocationContextInit, InvocationContextKey, InvocationContextValue, MaybePromise, NodeServerOptions, RuntimeAdapter, RuntimeCapabilities, Server, ServerCloseEvent, ServerErrorEvent, ServerEventMap, ServerEventMapCustom, ServerHandler, ServerHandlerObject, ServerInit, ServerMiddleware, ServerOptions, ServerPlugin, ServerRoutes, ServerServeEvent, TLSOptions, UnstableConvertRoutesToHandlerOptions, UnstableRouteMatch, UnstableRouteMatchResult, WaitUntil, WaitUntilFunction, createContextKey, createWaitUntil, isServerHandlerObject, loadServerAdapter, raceRequestAbort, runMiddleware, serve, toServerHandlerObject, unstable_buildRouteTree, unstable_convertRoutesToHandler, unstable_match, wrapFetch };
|
|
1
|
+
import { A as ServerPlugin, B as createWaitUntil, C as ServerMethodHandlers, D as ServerMiddlewareNameMap, E as ServerMiddlewareName, F as UnstableRouteMatch, G as serve, H as loadServerAdapter, I as UnstableRouteMatchResult, J as unstable_convertRoutesToHandler, K as toServerHandlerObject, L as WaitUntil, M as ServerServeEvent, N as TLSOptions, O as ServerMiddlewareResolver, P as UnstableConvertRoutesToHandlerOptions, R as WaitUntilFunction, S as ServerInit, T as ServerMiddlewareFunction, U as raceRequestAbort, V as isServerHandlerObject, W as runMiddleware, X as wrapFetch, Y as unstable_match, _ as ServerEventMap, a as InvocationContext, b as ServerHandlerFunction, c as InvocationContextValue, d as RunMiddlewareOptions, f as RuntimeAdapter, g as ServerErrorEvent, h as ServerCloseEvent, i as HTTPMethod, j as ServerRoutes, k as ServerOptions, l as MaybePromise, m as Server, n as DenoServerOptions, o as InvocationContextInit, p as RuntimeCapabilities, q as unstable_buildRouteTree, r as ErrorHandler, s as InvocationContextKey, t as BunServerOptions, u as NodeServerOptions, v as ServerEventMapCustom, w as ServerMiddleware, x as ServerHandlerObject, y as ServerHandler, z as createContextKey } from "./core-D6CtUiKb.mjs";
|
|
2
|
+
export { BunServerOptions, DenoServerOptions, ErrorHandler, HTTPMethod, InvocationContext, InvocationContextInit, InvocationContextKey, InvocationContextValue, MaybePromise, NodeServerOptions, RunMiddlewareOptions, RuntimeAdapter, RuntimeCapabilities, Server, ServerCloseEvent, ServerErrorEvent, ServerEventMap, ServerEventMapCustom, ServerHandler, ServerHandlerFunction, ServerHandlerObject, ServerInit, ServerMethodHandlers, ServerMiddleware, ServerMiddlewareFunction, ServerMiddlewareName, ServerMiddlewareNameMap, ServerMiddlewareResolver, ServerOptions, ServerPlugin, ServerRoutes, ServerServeEvent, TLSOptions, UnstableConvertRoutesToHandlerOptions, UnstableRouteMatch, UnstableRouteMatchResult, WaitUntil, WaitUntilFunction, createContextKey, createWaitUntil, isServerHandlerObject, loadServerAdapter, raceRequestAbort, runMiddleware, serve, toServerHandlerObject, unstable_buildRouteTree, unstable_convertRoutesToHandler, unstable_match, wrapFetch };
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as unstable_match, a as ServerServeEvent, c as createWaitUntil, d as raceRequestAbort, f as runMiddleware, g as unstable_convertRoutesToHandler, h as unstable_buildRouteTree, i as ServerErrorEvent, l as isServerHandlerObject, m as toServerHandlerObject, n as Server, p as serve, r as ServerCloseEvent, s as createContextKey, t as InvocationContext, u as loadServerAdapter, v as wrapFetch } from "./core-
|
|
1
|
+
import { _ as unstable_match, a as ServerServeEvent, c as createWaitUntil, d as raceRequestAbort, f as runMiddleware, g as unstable_convertRoutesToHandler, h as unstable_buildRouteTree, i as ServerErrorEvent, l as isServerHandlerObject, m as toServerHandlerObject, n as Server, p as serve, r as ServerCloseEvent, s as createContextKey, t as InvocationContext, u as loadServerAdapter, v as wrapFetch } from "./core-Cb5IXDeA.mjs";
|
|
2
2
|
export { InvocationContext, Server, ServerCloseEvent, ServerErrorEvent, ServerServeEvent, createContextKey, createWaitUntil, isServerHandlerObject, loadServerAdapter, raceRequestAbort, runMiddleware, serve, toServerHandlerObject, unstable_buildRouteTree, unstable_convertRoutesToHandler, unstable_match, wrapFetch };
|
package/dist/log.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { T as ServerMiddlewareFunction } from "./core-D6CtUiKb.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/log.d.ts
|
|
4
4
|
/**
|
|
@@ -22,6 +22,6 @@ interface LogOptions {}
|
|
|
22
22
|
* Each completed request prints timestamp, method, url, status code, and total
|
|
23
23
|
* response time using simple terminal colors.
|
|
24
24
|
*/
|
|
25
|
-
declare const log: (_options?: LogOptions) =>
|
|
25
|
+
declare const log: (_options?: LogOptions) => ServerMiddlewareFunction;
|
|
26
26
|
//#endregion
|
|
27
27
|
export { LogOptions, log };
|
package/dist/node.d.mts
CHANGED
package/dist/static.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { T as ServerMiddlewareFunction, l as MaybePromise } from "./core-D6CtUiKb.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/static.d.ts
|
|
4
4
|
/**
|
|
@@ -30,6 +30,6 @@ interface ServeStaticOptions {
|
|
|
30
30
|
* - extensionless paths try `name.html` and `name/index.html`
|
|
31
31
|
* - explicit extensions are used as-is
|
|
32
32
|
*/
|
|
33
|
-
declare function serveStatic(options: ServeStaticOptions):
|
|
33
|
+
declare function serveStatic(options: ServeStaticOptions): ServerMiddlewareFunction;
|
|
34
34
|
//#endregion
|
|
35
35
|
export { ServeStaticOptions, serveStatic };
|
package/dist/stream.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { R as WaitUntilFunction, f as RuntimeAdapter, m as Server, p as RuntimeCapabilities } from "./core-D6CtUiKb.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/stream.d.ts
|
|
4
4
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sevok",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Composable Server Primitives Across Runtimes",
|
|
5
5
|
"homepage": "https://sevok.pages.dev",
|
|
6
6
|
"license": "MIT",
|
|
@@ -58,6 +58,9 @@
|
|
|
58
58
|
"@types/bun": "^1.3.10",
|
|
59
59
|
"@types/deno": "^2.5.0"
|
|
60
60
|
},
|
|
61
|
+
"resolutions": {
|
|
62
|
+
"sevok": "link:."
|
|
63
|
+
},
|
|
61
64
|
"bin": {
|
|
62
65
|
"sevok": "./bin/sevok.mjs"
|
|
63
66
|
},
|