@mokup/server 1.1.0 → 1.1.2
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 +9 -0
- package/README.zh-CN.md +9 -0
- package/dist/connect.cjs +25 -0
- package/dist/connect.d.cts +8 -0
- package/dist/connect.d.mts +8 -0
- package/dist/connect.d.ts +8 -0
- package/dist/connect.mjs +23 -0
- package/dist/express.cjs +11 -0
- package/dist/express.d.cts +7 -0
- package/dist/express.d.mts +7 -0
- package/dist/express.d.ts +7 -0
- package/dist/express.mjs +9 -0
- package/dist/fastify.cjs +39 -0
- package/dist/fastify.d.cts +18 -0
- package/dist/fastify.d.mts +18 -0
- package/dist/fastify.d.ts +18 -0
- package/dist/fastify.mjs +37 -0
- package/dist/fetch-server.cjs +1507 -0
- package/dist/fetch-server.d.cts +54 -0
- package/dist/fetch-server.d.mts +54 -0
- package/dist/fetch-server.d.ts +54 -0
- package/dist/fetch-server.mjs +1500 -0
- package/dist/fetch.cjs +26 -0
- package/dist/fetch.d.cts +6 -0
- package/dist/fetch.d.mts +6 -0
- package/dist/fetch.d.ts +6 -0
- package/dist/fetch.mjs +24 -0
- package/dist/hono.cjs +27 -0
- package/dist/hono.d.cts +21 -0
- package/dist/hono.d.mts +21 -0
- package/dist/hono.d.ts +21 -0
- package/dist/hono.mjs +25 -0
- package/dist/index.cjs +5 -1593
- package/dist/index.d.cts +3 -134
- package/dist/index.d.mts +3 -134
- package/dist/index.d.ts +3 -134
- package/dist/index.mjs +4 -1585
- package/dist/koa.cjs +38 -0
- package/dist/koa.d.cts +18 -0
- package/dist/koa.d.mts +18 -0
- package/dist/koa.d.ts +18 -0
- package/dist/koa.mjs +36 -0
- package/dist/node.cjs +26 -0
- package/dist/node.d.cts +12 -0
- package/dist/node.d.mts +12 -0
- package/dist/node.d.ts +12 -0
- package/dist/node.mjs +19 -0
- package/dist/shared/{server.BdTl0qJd.cjs → server.3GcmR3Ev.cjs} +2 -23
- package/dist/shared/{server.DNITwCtQ.d.cts → server.B82hrXoo.d.cts} +2 -2
- package/dist/shared/{server.DNITwCtQ.d.mts → server.B82hrXoo.d.mts} +2 -2
- package/dist/shared/{server.DNITwCtQ.d.ts → server.B82hrXoo.d.ts} +2 -2
- package/dist/shared/server.Cb2eiCU2.d.cts +17 -0
- package/dist/shared/server.Cb2eiCU2.d.mts +17 -0
- package/dist/shared/server.Cb2eiCU2.d.ts +17 -0
- package/dist/shared/{server.Dje1y79O.mjs → server.tZ4R8aB2.mjs} +1 -23
- package/dist/worker-node.cjs +74 -0
- package/dist/worker-node.d.cts +12 -0
- package/dist/worker-node.d.mts +12 -0
- package/dist/worker-node.d.ts +12 -0
- package/dist/worker-node.mjs +72 -0
- package/dist/worker.cjs +6 -2
- package/dist/worker.d.cts +2 -2
- package/dist/worker.d.mts +2 -2
- package/dist/worker.d.ts +2 -2
- package/dist/worker.mjs +6 -2
- package/package.json +44 -4
package/dist/index.d.cts
CHANGED
|
@@ -1,135 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
|
|
1
|
+
export { createFetchHandler } from './fetch.cjs';
|
|
2
|
+
export { F as FetchHandler, S as ServerOptions, W as WorkerBundle, a as WorkerInput } from './shared/server.B82hrXoo.cjs';
|
|
3
|
+
export { createMokupWorker } from './worker.cjs';
|
|
4
4
|
export { Manifest, ManifestRoute, ModuleMap, RuntimeOptions } from '@mokup/runtime';
|
|
5
|
-
import { Context, MiddlewareHandler } from '@mokup/shared/hono';
|
|
6
|
-
|
|
7
|
-
interface ReadableStreamLike {
|
|
8
|
-
on: (event: string, listener: (...args: unknown[]) => void) => void;
|
|
9
|
-
}
|
|
10
|
-
interface NodeRequestLike extends ReadableStreamLike {
|
|
11
|
-
method?: string;
|
|
12
|
-
url?: string;
|
|
13
|
-
originalUrl?: string;
|
|
14
|
-
headers?: Record<string, string | string[] | undefined>;
|
|
15
|
-
body?: unknown;
|
|
16
|
-
}
|
|
17
|
-
interface NodeResponseLike {
|
|
18
|
-
statusCode?: number;
|
|
19
|
-
setHeader: (name: string, value: string) => void;
|
|
20
|
-
end: (data?: string | Uint8Array | ArrayBuffer | null) => void;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
type NextFunction = (error?: unknown) => void;
|
|
24
|
-
declare function createConnectMiddleware(options: ServerOptions): (req: NodeRequestLike, res: NodeResponseLike, next: NextFunction) => Promise<void>;
|
|
25
|
-
|
|
26
|
-
declare function createExpressMiddleware(options: ServerOptions): (req: NodeRequestLike, res: NodeResponseLike, next: (error?: unknown) => void) => Promise<void>;
|
|
27
|
-
|
|
28
|
-
interface FastifyRequestLike extends NodeRequestLike {
|
|
29
|
-
raw?: NodeRequestLike;
|
|
30
|
-
}
|
|
31
|
-
interface FastifyReplyLike {
|
|
32
|
-
status: (code: number) => FastifyReplyLike;
|
|
33
|
-
header: (name: string, value: string) => FastifyReplyLike;
|
|
34
|
-
send: (payload?: unknown) => void;
|
|
35
|
-
}
|
|
36
|
-
interface FastifyInstanceLike {
|
|
37
|
-
addHook: (name: 'onRequest' | 'preHandler', handler: (request: FastifyRequestLike, reply: FastifyReplyLike) => Promise<void> | void) => void;
|
|
38
|
-
}
|
|
39
|
-
declare function createFastifyPlugin(options: ServerOptions): (instance: FastifyInstanceLike) => Promise<void>;
|
|
40
|
-
|
|
41
|
-
declare function createFetchHandler(options: ServerOptions): FetchHandler;
|
|
42
|
-
|
|
43
|
-
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD';
|
|
44
|
-
type RequestHandler = (context: Context) => Response | Promise<Response> | unknown;
|
|
45
|
-
type RouteResponse = unknown | RequestHandler;
|
|
46
|
-
interface ResolvedMiddleware {
|
|
47
|
-
handle: MiddlewareHandler;
|
|
48
|
-
source: string;
|
|
49
|
-
index: number;
|
|
50
|
-
}
|
|
51
|
-
interface ResolvedRoute {
|
|
52
|
-
file: string;
|
|
53
|
-
template: string;
|
|
54
|
-
method: HttpMethod;
|
|
55
|
-
tokens: RouteToken[];
|
|
56
|
-
score: number[];
|
|
57
|
-
handler: RouteResponse;
|
|
58
|
-
middlewares?: ResolvedMiddleware[];
|
|
59
|
-
status?: number;
|
|
60
|
-
headers?: Record<string, string>;
|
|
61
|
-
delay?: number;
|
|
62
|
-
ruleIndex?: number;
|
|
63
|
-
}
|
|
64
|
-
type RouteTable = ResolvedRoute[];
|
|
65
|
-
|
|
66
|
-
type DirInput = string | string[] | ((root: string) => string | string[]) | undefined;
|
|
67
|
-
|
|
68
|
-
interface FetchServerOptions {
|
|
69
|
-
dir?: DirInput;
|
|
70
|
-
prefix?: string;
|
|
71
|
-
include?: RegExp | RegExp[];
|
|
72
|
-
exclude?: RegExp | RegExp[];
|
|
73
|
-
ignorePrefix?: string | string[];
|
|
74
|
-
watch?: boolean;
|
|
75
|
-
log?: boolean;
|
|
76
|
-
playground?: boolean | {
|
|
77
|
-
path?: string;
|
|
78
|
-
enabled?: boolean;
|
|
79
|
-
};
|
|
80
|
-
host?: string;
|
|
81
|
-
port?: number;
|
|
82
|
-
root?: string;
|
|
83
|
-
}
|
|
84
|
-
type FetchServerOptionsInput = FetchServerOptions | FetchServerOptions[];
|
|
85
|
-
|
|
86
|
-
interface FetchServer {
|
|
87
|
-
fetch: (request: Request) => Promise<Response>;
|
|
88
|
-
refresh: () => Promise<void>;
|
|
89
|
-
getRoutes: () => RouteTable;
|
|
90
|
-
injectWebSocket?: (server: NodeWebSocketServer) => void;
|
|
91
|
-
close?: () => Promise<void>;
|
|
92
|
-
}
|
|
93
|
-
interface NodeWebSocketServer {
|
|
94
|
-
on: (event: string, listener: (...args: unknown[]) => void) => void;
|
|
95
|
-
}
|
|
96
|
-
declare function createFetchServer(options?: FetchServerOptionsInput): Promise<FetchServer>;
|
|
97
|
-
|
|
98
|
-
interface HonoContextLike {
|
|
99
|
-
req: {
|
|
100
|
-
raw: Request;
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
type HonoNext = () => Promise<Response | void>;
|
|
104
|
-
type HonoMiddleware = (context: HonoContextLike, next: HonoNext) => Promise<Response | void>;
|
|
105
|
-
interface HonoRouteLike {
|
|
106
|
-
basePath: string;
|
|
107
|
-
path: string;
|
|
108
|
-
method: string;
|
|
109
|
-
handler: HonoMiddleware;
|
|
110
|
-
}
|
|
111
|
-
declare function createHonoMiddleware(options: ServerOptions): HonoMiddleware & {
|
|
112
|
-
routes: HonoRouteLike[];
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
interface KoaContextLike {
|
|
116
|
-
req: NodeRequestLike;
|
|
117
|
-
request?: {
|
|
118
|
-
body?: unknown;
|
|
119
|
-
headers?: Record<string, string | string[] | undefined>;
|
|
120
|
-
};
|
|
121
|
-
status?: number;
|
|
122
|
-
body?: unknown;
|
|
123
|
-
set: (header: Record<string, string>) => void;
|
|
124
|
-
}
|
|
125
|
-
type KoaNext = () => Promise<unknown>;
|
|
126
|
-
declare function createKoaMiddleware(options: ServerOptions): (ctx: KoaContextLike, next: KoaNext) => Promise<void>;
|
|
127
|
-
|
|
128
|
-
interface FetchWorker {
|
|
129
|
-
fetch: (request: Request) => Promise<Response>;
|
|
130
|
-
}
|
|
131
|
-
declare function createMokupWorker(input: string): Promise<FetchWorker>;
|
|
132
|
-
declare function createMokupWorker(input: Exclude<WorkerInput, string>): FetchWorker;
|
|
133
|
-
|
|
134
|
-
export { FetchHandler, ServerOptions, WorkerInput, createConnectMiddleware, createExpressMiddleware, createFastifyPlugin, createFetchHandler, createFetchServer, createHonoMiddleware, createKoaMiddleware, createMokupWorker };
|
|
135
|
-
export type { FetchServer, FetchServerOptions, FetchServerOptionsInput };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,135 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
|
|
1
|
+
export { createFetchHandler } from './fetch.mjs';
|
|
2
|
+
export { F as FetchHandler, S as ServerOptions, W as WorkerBundle, a as WorkerInput } from './shared/server.B82hrXoo.mjs';
|
|
3
|
+
export { createMokupWorker } from './worker.mjs';
|
|
4
4
|
export { Manifest, ManifestRoute, ModuleMap, RuntimeOptions } from '@mokup/runtime';
|
|
5
|
-
import { Context, MiddlewareHandler } from '@mokup/shared/hono';
|
|
6
|
-
|
|
7
|
-
interface ReadableStreamLike {
|
|
8
|
-
on: (event: string, listener: (...args: unknown[]) => void) => void;
|
|
9
|
-
}
|
|
10
|
-
interface NodeRequestLike extends ReadableStreamLike {
|
|
11
|
-
method?: string;
|
|
12
|
-
url?: string;
|
|
13
|
-
originalUrl?: string;
|
|
14
|
-
headers?: Record<string, string | string[] | undefined>;
|
|
15
|
-
body?: unknown;
|
|
16
|
-
}
|
|
17
|
-
interface NodeResponseLike {
|
|
18
|
-
statusCode?: number;
|
|
19
|
-
setHeader: (name: string, value: string) => void;
|
|
20
|
-
end: (data?: string | Uint8Array | ArrayBuffer | null) => void;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
type NextFunction = (error?: unknown) => void;
|
|
24
|
-
declare function createConnectMiddleware(options: ServerOptions): (req: NodeRequestLike, res: NodeResponseLike, next: NextFunction) => Promise<void>;
|
|
25
|
-
|
|
26
|
-
declare function createExpressMiddleware(options: ServerOptions): (req: NodeRequestLike, res: NodeResponseLike, next: (error?: unknown) => void) => Promise<void>;
|
|
27
|
-
|
|
28
|
-
interface FastifyRequestLike extends NodeRequestLike {
|
|
29
|
-
raw?: NodeRequestLike;
|
|
30
|
-
}
|
|
31
|
-
interface FastifyReplyLike {
|
|
32
|
-
status: (code: number) => FastifyReplyLike;
|
|
33
|
-
header: (name: string, value: string) => FastifyReplyLike;
|
|
34
|
-
send: (payload?: unknown) => void;
|
|
35
|
-
}
|
|
36
|
-
interface FastifyInstanceLike {
|
|
37
|
-
addHook: (name: 'onRequest' | 'preHandler', handler: (request: FastifyRequestLike, reply: FastifyReplyLike) => Promise<void> | void) => void;
|
|
38
|
-
}
|
|
39
|
-
declare function createFastifyPlugin(options: ServerOptions): (instance: FastifyInstanceLike) => Promise<void>;
|
|
40
|
-
|
|
41
|
-
declare function createFetchHandler(options: ServerOptions): FetchHandler;
|
|
42
|
-
|
|
43
|
-
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD';
|
|
44
|
-
type RequestHandler = (context: Context) => Response | Promise<Response> | unknown;
|
|
45
|
-
type RouteResponse = unknown | RequestHandler;
|
|
46
|
-
interface ResolvedMiddleware {
|
|
47
|
-
handle: MiddlewareHandler;
|
|
48
|
-
source: string;
|
|
49
|
-
index: number;
|
|
50
|
-
}
|
|
51
|
-
interface ResolvedRoute {
|
|
52
|
-
file: string;
|
|
53
|
-
template: string;
|
|
54
|
-
method: HttpMethod;
|
|
55
|
-
tokens: RouteToken[];
|
|
56
|
-
score: number[];
|
|
57
|
-
handler: RouteResponse;
|
|
58
|
-
middlewares?: ResolvedMiddleware[];
|
|
59
|
-
status?: number;
|
|
60
|
-
headers?: Record<string, string>;
|
|
61
|
-
delay?: number;
|
|
62
|
-
ruleIndex?: number;
|
|
63
|
-
}
|
|
64
|
-
type RouteTable = ResolvedRoute[];
|
|
65
|
-
|
|
66
|
-
type DirInput = string | string[] | ((root: string) => string | string[]) | undefined;
|
|
67
|
-
|
|
68
|
-
interface FetchServerOptions {
|
|
69
|
-
dir?: DirInput;
|
|
70
|
-
prefix?: string;
|
|
71
|
-
include?: RegExp | RegExp[];
|
|
72
|
-
exclude?: RegExp | RegExp[];
|
|
73
|
-
ignorePrefix?: string | string[];
|
|
74
|
-
watch?: boolean;
|
|
75
|
-
log?: boolean;
|
|
76
|
-
playground?: boolean | {
|
|
77
|
-
path?: string;
|
|
78
|
-
enabled?: boolean;
|
|
79
|
-
};
|
|
80
|
-
host?: string;
|
|
81
|
-
port?: number;
|
|
82
|
-
root?: string;
|
|
83
|
-
}
|
|
84
|
-
type FetchServerOptionsInput = FetchServerOptions | FetchServerOptions[];
|
|
85
|
-
|
|
86
|
-
interface FetchServer {
|
|
87
|
-
fetch: (request: Request) => Promise<Response>;
|
|
88
|
-
refresh: () => Promise<void>;
|
|
89
|
-
getRoutes: () => RouteTable;
|
|
90
|
-
injectWebSocket?: (server: NodeWebSocketServer) => void;
|
|
91
|
-
close?: () => Promise<void>;
|
|
92
|
-
}
|
|
93
|
-
interface NodeWebSocketServer {
|
|
94
|
-
on: (event: string, listener: (...args: unknown[]) => void) => void;
|
|
95
|
-
}
|
|
96
|
-
declare function createFetchServer(options?: FetchServerOptionsInput): Promise<FetchServer>;
|
|
97
|
-
|
|
98
|
-
interface HonoContextLike {
|
|
99
|
-
req: {
|
|
100
|
-
raw: Request;
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
type HonoNext = () => Promise<Response | void>;
|
|
104
|
-
type HonoMiddleware = (context: HonoContextLike, next: HonoNext) => Promise<Response | void>;
|
|
105
|
-
interface HonoRouteLike {
|
|
106
|
-
basePath: string;
|
|
107
|
-
path: string;
|
|
108
|
-
method: string;
|
|
109
|
-
handler: HonoMiddleware;
|
|
110
|
-
}
|
|
111
|
-
declare function createHonoMiddleware(options: ServerOptions): HonoMiddleware & {
|
|
112
|
-
routes: HonoRouteLike[];
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
interface KoaContextLike {
|
|
116
|
-
req: NodeRequestLike;
|
|
117
|
-
request?: {
|
|
118
|
-
body?: unknown;
|
|
119
|
-
headers?: Record<string, string | string[] | undefined>;
|
|
120
|
-
};
|
|
121
|
-
status?: number;
|
|
122
|
-
body?: unknown;
|
|
123
|
-
set: (header: Record<string, string>) => void;
|
|
124
|
-
}
|
|
125
|
-
type KoaNext = () => Promise<unknown>;
|
|
126
|
-
declare function createKoaMiddleware(options: ServerOptions): (ctx: KoaContextLike, next: KoaNext) => Promise<void>;
|
|
127
|
-
|
|
128
|
-
interface FetchWorker {
|
|
129
|
-
fetch: (request: Request) => Promise<Response>;
|
|
130
|
-
}
|
|
131
|
-
declare function createMokupWorker(input: string): Promise<FetchWorker>;
|
|
132
|
-
declare function createMokupWorker(input: Exclude<WorkerInput, string>): FetchWorker;
|
|
133
|
-
|
|
134
|
-
export { FetchHandler, ServerOptions, WorkerInput, createConnectMiddleware, createExpressMiddleware, createFastifyPlugin, createFetchHandler, createFetchServer, createHonoMiddleware, createKoaMiddleware, createMokupWorker };
|
|
135
|
-
export type { FetchServer, FetchServerOptions, FetchServerOptionsInput };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,135 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
|
|
1
|
+
export { createFetchHandler } from './fetch.js';
|
|
2
|
+
export { F as FetchHandler, S as ServerOptions, W as WorkerBundle, a as WorkerInput } from './shared/server.B82hrXoo.js';
|
|
3
|
+
export { createMokupWorker } from './worker.js';
|
|
4
4
|
export { Manifest, ManifestRoute, ModuleMap, RuntimeOptions } from '@mokup/runtime';
|
|
5
|
-
import { Context, MiddlewareHandler } from '@mokup/shared/hono';
|
|
6
|
-
|
|
7
|
-
interface ReadableStreamLike {
|
|
8
|
-
on: (event: string, listener: (...args: unknown[]) => void) => void;
|
|
9
|
-
}
|
|
10
|
-
interface NodeRequestLike extends ReadableStreamLike {
|
|
11
|
-
method?: string;
|
|
12
|
-
url?: string;
|
|
13
|
-
originalUrl?: string;
|
|
14
|
-
headers?: Record<string, string | string[] | undefined>;
|
|
15
|
-
body?: unknown;
|
|
16
|
-
}
|
|
17
|
-
interface NodeResponseLike {
|
|
18
|
-
statusCode?: number;
|
|
19
|
-
setHeader: (name: string, value: string) => void;
|
|
20
|
-
end: (data?: string | Uint8Array | ArrayBuffer | null) => void;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
type NextFunction = (error?: unknown) => void;
|
|
24
|
-
declare function createConnectMiddleware(options: ServerOptions): (req: NodeRequestLike, res: NodeResponseLike, next: NextFunction) => Promise<void>;
|
|
25
|
-
|
|
26
|
-
declare function createExpressMiddleware(options: ServerOptions): (req: NodeRequestLike, res: NodeResponseLike, next: (error?: unknown) => void) => Promise<void>;
|
|
27
|
-
|
|
28
|
-
interface FastifyRequestLike extends NodeRequestLike {
|
|
29
|
-
raw?: NodeRequestLike;
|
|
30
|
-
}
|
|
31
|
-
interface FastifyReplyLike {
|
|
32
|
-
status: (code: number) => FastifyReplyLike;
|
|
33
|
-
header: (name: string, value: string) => FastifyReplyLike;
|
|
34
|
-
send: (payload?: unknown) => void;
|
|
35
|
-
}
|
|
36
|
-
interface FastifyInstanceLike {
|
|
37
|
-
addHook: (name: 'onRequest' | 'preHandler', handler: (request: FastifyRequestLike, reply: FastifyReplyLike) => Promise<void> | void) => void;
|
|
38
|
-
}
|
|
39
|
-
declare function createFastifyPlugin(options: ServerOptions): (instance: FastifyInstanceLike) => Promise<void>;
|
|
40
|
-
|
|
41
|
-
declare function createFetchHandler(options: ServerOptions): FetchHandler;
|
|
42
|
-
|
|
43
|
-
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD';
|
|
44
|
-
type RequestHandler = (context: Context) => Response | Promise<Response> | unknown;
|
|
45
|
-
type RouteResponse = unknown | RequestHandler;
|
|
46
|
-
interface ResolvedMiddleware {
|
|
47
|
-
handle: MiddlewareHandler;
|
|
48
|
-
source: string;
|
|
49
|
-
index: number;
|
|
50
|
-
}
|
|
51
|
-
interface ResolvedRoute {
|
|
52
|
-
file: string;
|
|
53
|
-
template: string;
|
|
54
|
-
method: HttpMethod;
|
|
55
|
-
tokens: RouteToken[];
|
|
56
|
-
score: number[];
|
|
57
|
-
handler: RouteResponse;
|
|
58
|
-
middlewares?: ResolvedMiddleware[];
|
|
59
|
-
status?: number;
|
|
60
|
-
headers?: Record<string, string>;
|
|
61
|
-
delay?: number;
|
|
62
|
-
ruleIndex?: number;
|
|
63
|
-
}
|
|
64
|
-
type RouteTable = ResolvedRoute[];
|
|
65
|
-
|
|
66
|
-
type DirInput = string | string[] | ((root: string) => string | string[]) | undefined;
|
|
67
|
-
|
|
68
|
-
interface FetchServerOptions {
|
|
69
|
-
dir?: DirInput;
|
|
70
|
-
prefix?: string;
|
|
71
|
-
include?: RegExp | RegExp[];
|
|
72
|
-
exclude?: RegExp | RegExp[];
|
|
73
|
-
ignorePrefix?: string | string[];
|
|
74
|
-
watch?: boolean;
|
|
75
|
-
log?: boolean;
|
|
76
|
-
playground?: boolean | {
|
|
77
|
-
path?: string;
|
|
78
|
-
enabled?: boolean;
|
|
79
|
-
};
|
|
80
|
-
host?: string;
|
|
81
|
-
port?: number;
|
|
82
|
-
root?: string;
|
|
83
|
-
}
|
|
84
|
-
type FetchServerOptionsInput = FetchServerOptions | FetchServerOptions[];
|
|
85
|
-
|
|
86
|
-
interface FetchServer {
|
|
87
|
-
fetch: (request: Request) => Promise<Response>;
|
|
88
|
-
refresh: () => Promise<void>;
|
|
89
|
-
getRoutes: () => RouteTable;
|
|
90
|
-
injectWebSocket?: (server: NodeWebSocketServer) => void;
|
|
91
|
-
close?: () => Promise<void>;
|
|
92
|
-
}
|
|
93
|
-
interface NodeWebSocketServer {
|
|
94
|
-
on: (event: string, listener: (...args: unknown[]) => void) => void;
|
|
95
|
-
}
|
|
96
|
-
declare function createFetchServer(options?: FetchServerOptionsInput): Promise<FetchServer>;
|
|
97
|
-
|
|
98
|
-
interface HonoContextLike {
|
|
99
|
-
req: {
|
|
100
|
-
raw: Request;
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
type HonoNext = () => Promise<Response | void>;
|
|
104
|
-
type HonoMiddleware = (context: HonoContextLike, next: HonoNext) => Promise<Response | void>;
|
|
105
|
-
interface HonoRouteLike {
|
|
106
|
-
basePath: string;
|
|
107
|
-
path: string;
|
|
108
|
-
method: string;
|
|
109
|
-
handler: HonoMiddleware;
|
|
110
|
-
}
|
|
111
|
-
declare function createHonoMiddleware(options: ServerOptions): HonoMiddleware & {
|
|
112
|
-
routes: HonoRouteLike[];
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
interface KoaContextLike {
|
|
116
|
-
req: NodeRequestLike;
|
|
117
|
-
request?: {
|
|
118
|
-
body?: unknown;
|
|
119
|
-
headers?: Record<string, string | string[] | undefined>;
|
|
120
|
-
};
|
|
121
|
-
status?: number;
|
|
122
|
-
body?: unknown;
|
|
123
|
-
set: (header: Record<string, string>) => void;
|
|
124
|
-
}
|
|
125
|
-
type KoaNext = () => Promise<unknown>;
|
|
126
|
-
declare function createKoaMiddleware(options: ServerOptions): (ctx: KoaContextLike, next: KoaNext) => Promise<void>;
|
|
127
|
-
|
|
128
|
-
interface FetchWorker {
|
|
129
|
-
fetch: (request: Request) => Promise<Response>;
|
|
130
|
-
}
|
|
131
|
-
declare function createMokupWorker(input: string): Promise<FetchWorker>;
|
|
132
|
-
declare function createMokupWorker(input: Exclude<WorkerInput, string>): FetchWorker;
|
|
133
|
-
|
|
134
|
-
export { FetchHandler, ServerOptions, WorkerInput, createConnectMiddleware, createExpressMiddleware, createFastifyPlugin, createFetchHandler, createFetchServer, createHonoMiddleware, createKoaMiddleware, createMokupWorker };
|
|
135
|
-
export type { FetchServer, FetchServerOptions, FetchServerOptionsInput };
|