srvx-nightly 0.12.4 → 0.12.5
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/types.d.mts +253 -20
- package/dist/adapters/aws-lambda.d.mts +6 -7
- package/dist/adapters/bun.d.mts +2 -3
- package/dist/adapters/cloudflare.d.mts +2 -3
- package/dist/adapters/deno.d.mts +2 -2
- package/dist/adapters/deno.mjs +1 -1
- package/dist/adapters/node.d.mts +2 -2
- package/dist/adapters/service-worker.d.mts +2 -2
- package/dist/cli.mjs +1 -1
- package/dist/types.d.mts +2 -2
- package/package.json +1 -1
package/dist/_chunks/types.d.mts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import * as NodeHttp from "node:http";
|
|
2
2
|
import * as NodeHttps from "node:https";
|
|
3
3
|
import * as NodeHttp2 from "node:http2";
|
|
4
|
-
import * as AWS from "aws-lambda";
|
|
5
4
|
import * as NodeNet from "node:net";
|
|
6
|
-
import * as Bun from "bun";
|
|
7
|
-
import * as CF from "@cloudflare/workers-types";
|
|
8
5
|
/**
|
|
9
6
|
* Controls whether `X-Forwarded-*` headers (proto, host, for, and the HTTP/2
|
|
10
7
|
* `:scheme` pseudo-header) are trusted when deriving request metadata.
|
|
@@ -24,9 +21,239 @@ import * as CF from "@cloudflare/workers-types";
|
|
|
24
21
|
* - `string[]`: trust only hops whose address is in the allowlist.
|
|
25
22
|
*/
|
|
26
23
|
type TrustProxyOption = boolean | "loopback" | string[];
|
|
24
|
+
/**
|
|
25
|
+
* Options forwarded to `Bun.serve()`.
|
|
26
|
+
*
|
|
27
|
+
* @docs https://bun.sh/docs/api/http
|
|
28
|
+
*/
|
|
29
|
+
interface BunServeOptions {
|
|
30
|
+
port?: string | number;
|
|
31
|
+
hostname?: string;
|
|
32
|
+
unix?: string;
|
|
33
|
+
reusePort?: boolean;
|
|
34
|
+
idleTimeout?: number;
|
|
35
|
+
maxRequestBodySize?: number;
|
|
36
|
+
error?: (error: any) => any;
|
|
37
|
+
tls?: any;
|
|
38
|
+
/** Any other option supported by the running Bun version. */
|
|
39
|
+
[key: string]: any;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Server instance returned by `Bun.serve()` (`Bun.Server`).
|
|
43
|
+
*/
|
|
44
|
+
interface BunHttpServer {
|
|
45
|
+
readonly url: URL;
|
|
46
|
+
readonly port?: number;
|
|
47
|
+
readonly hostname?: string;
|
|
48
|
+
readonly development?: boolean;
|
|
49
|
+
readonly pendingRequests?: number;
|
|
50
|
+
readonly pendingWebSockets?: number;
|
|
51
|
+
requestIP(request: Request): {
|
|
52
|
+
address: string;
|
|
53
|
+
family: "IPv4" | "IPv6";
|
|
54
|
+
port: number;
|
|
55
|
+
} | null;
|
|
56
|
+
timeout(request: Request, seconds: number): void;
|
|
57
|
+
/** Upgrade an incoming request to a WebSocket connection. */
|
|
58
|
+
upgrade(request: Request, options?: {
|
|
59
|
+
headers?: HeadersInit;
|
|
60
|
+
data?: any;
|
|
61
|
+
}): boolean;
|
|
62
|
+
/** Publish a message to every client subscribed to `topic`. */
|
|
63
|
+
publish(topic: string, data: string | ArrayBufferView | ArrayBuffer | SharedArrayBuffer, compress?: boolean): number;
|
|
64
|
+
subscriberCount(topic: string): number;
|
|
65
|
+
reload(options: any): void;
|
|
66
|
+
stop(closeActiveConnections?: boolean): Promise<void>;
|
|
67
|
+
ref(): void;
|
|
68
|
+
unref(): void;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Options forwarded to `Deno.serve()`.
|
|
72
|
+
*
|
|
73
|
+
* @docs https://docs.deno.com/api/deno/~/Deno.serve
|
|
74
|
+
*/
|
|
75
|
+
interface DenoServeOptions {
|
|
76
|
+
port?: number;
|
|
77
|
+
hostname?: string;
|
|
78
|
+
reusePort?: boolean;
|
|
79
|
+
signal?: AbortSignal;
|
|
80
|
+
key?: string;
|
|
81
|
+
cert?: string;
|
|
82
|
+
passphrase?: string;
|
|
83
|
+
onError?: (error: unknown) => Response | Promise<Response>;
|
|
84
|
+
onListen?: (localAddr: {
|
|
85
|
+
hostname: string;
|
|
86
|
+
port: number;
|
|
87
|
+
}) => void;
|
|
88
|
+
/** Any other option supported by the running Deno version. */
|
|
89
|
+
[key: string]: any;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Server instance returned by `Deno.serve()` (`Deno.HttpServer`).
|
|
93
|
+
*/
|
|
94
|
+
interface DenoHttpServer {
|
|
95
|
+
readonly finished: Promise<void>;
|
|
96
|
+
readonly addr?: {
|
|
97
|
+
hostname?: string;
|
|
98
|
+
port?: number;
|
|
99
|
+
transport?: string;
|
|
100
|
+
};
|
|
101
|
+
shutdown(): Promise<void>;
|
|
102
|
+
ref(): void;
|
|
103
|
+
unref(): void;
|
|
104
|
+
[Symbol.asyncDispose](): PromiseLike<void>;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Second argument Deno passes to the fetch handler (`Deno.ServeHandlerInfo`).
|
|
108
|
+
*/
|
|
109
|
+
interface DenoServeHandlerInfo {
|
|
110
|
+
readonly remoteAddr: {
|
|
111
|
+
hostname: string;
|
|
112
|
+
port: number;
|
|
113
|
+
transport?: string;
|
|
114
|
+
};
|
|
115
|
+
readonly completed?: Promise<void>;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Cloudflare Workers execution context (`ExecutionContext`).
|
|
119
|
+
*/
|
|
120
|
+
interface CloudflareExecutionContext {
|
|
121
|
+
waitUntil(promise: Promise<any>): void;
|
|
122
|
+
passThroughOnException(): void;
|
|
123
|
+
props?: any;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Cloudflare Workers environment bindings.
|
|
127
|
+
*
|
|
128
|
+
* Augment this interface to type your own bindings:
|
|
129
|
+
*
|
|
130
|
+
* ```ts
|
|
131
|
+
* declare module "srvx" {
|
|
132
|
+
* interface CloudflareEnv {
|
|
133
|
+
* MY_KV: KVNamespace;
|
|
134
|
+
* }
|
|
135
|
+
* }
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
interface CloudflareEnv {
|
|
139
|
+
[key: string]: unknown;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* AWS Lambda invocation context (`aws-lambda`'s `Context`).
|
|
143
|
+
*/
|
|
144
|
+
interface AWSLambdaContext {
|
|
145
|
+
callbackWaitsForEmptyEventLoop: boolean;
|
|
146
|
+
functionName: string;
|
|
147
|
+
functionVersion: string;
|
|
148
|
+
invokedFunctionArn: string;
|
|
149
|
+
memoryLimitInMB: string;
|
|
150
|
+
awsRequestId: string;
|
|
151
|
+
logGroupName: string;
|
|
152
|
+
logStreamName: string;
|
|
153
|
+
identity?: any;
|
|
154
|
+
clientContext?: any;
|
|
155
|
+
getRemainingTimeInMillis(): number;
|
|
156
|
+
done(error?: Error, result?: any): void;
|
|
157
|
+
fail(error: Error | string): void;
|
|
158
|
+
succeed(messageOrObject: any): void;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* API Gateway REST API (v1) proxy event (`APIGatewayProxyEvent`).
|
|
162
|
+
*/
|
|
163
|
+
interface AWSLambdaProxyEvent {
|
|
164
|
+
httpMethod: string;
|
|
165
|
+
path: string;
|
|
166
|
+
resource?: string;
|
|
167
|
+
headers: Record<string, string | undefined>;
|
|
168
|
+
multiValueHeaders?: Record<string, string[] | undefined>;
|
|
169
|
+
queryStringParameters?: Record<string, string | undefined> | null;
|
|
170
|
+
multiValueQueryStringParameters?: Record<string, string[] | undefined> | null;
|
|
171
|
+
pathParameters?: Record<string, string | undefined> | null;
|
|
172
|
+
stageVariables?: Record<string, string | undefined> | null;
|
|
173
|
+
body: string | null;
|
|
174
|
+
isBase64Encoded: boolean;
|
|
175
|
+
requestContext: {
|
|
176
|
+
accountId?: string;
|
|
177
|
+
apiId?: string;
|
|
178
|
+
authorizer?: any;
|
|
179
|
+
domainName?: string;
|
|
180
|
+
httpMethod?: string;
|
|
181
|
+
identity?: {
|
|
182
|
+
sourceIp?: string;
|
|
183
|
+
};
|
|
184
|
+
path?: string;
|
|
185
|
+
protocol?: string;
|
|
186
|
+
requestId?: string;
|
|
187
|
+
requestTimeEpoch?: number;
|
|
188
|
+
resourcePath?: string;
|
|
189
|
+
stage?: string;
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* API Gateway HTTP API (v2) proxy event (`APIGatewayProxyEventV2`).
|
|
194
|
+
*/
|
|
195
|
+
interface AWSLambdaProxyEventV2 {
|
|
196
|
+
version: string;
|
|
197
|
+
routeKey?: string;
|
|
198
|
+
rawPath: string;
|
|
199
|
+
rawQueryString: string;
|
|
200
|
+
cookies?: string[];
|
|
201
|
+
headers: Record<string, string | undefined>;
|
|
202
|
+
queryStringParameters?: Record<string, string | undefined>;
|
|
203
|
+
pathParameters?: Record<string, string | undefined>;
|
|
204
|
+
stageVariables?: Record<string, string | undefined>;
|
|
205
|
+
body?: string;
|
|
206
|
+
isBase64Encoded: boolean;
|
|
207
|
+
requestContext: {
|
|
208
|
+
accountId?: string;
|
|
209
|
+
apiId?: string;
|
|
210
|
+
authorizer?: any;
|
|
211
|
+
domainName?: string;
|
|
212
|
+
domainPrefix?: string;
|
|
213
|
+
requestId?: string;
|
|
214
|
+
routeKey?: string;
|
|
215
|
+
stage?: string;
|
|
216
|
+
time?: string;
|
|
217
|
+
timeEpoch?: number;
|
|
218
|
+
http?: {
|
|
219
|
+
method: string;
|
|
220
|
+
path?: string;
|
|
221
|
+
protocol?: string;
|
|
222
|
+
sourceIp?: string;
|
|
223
|
+
userAgent?: string;
|
|
224
|
+
};
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* API Gateway REST API (v1) proxy result (`APIGatewayProxyResult`).
|
|
229
|
+
*/
|
|
230
|
+
interface AWSLambdaProxyResult {
|
|
231
|
+
statusCode: number;
|
|
232
|
+
headers?: Record<string, string | number | boolean>;
|
|
233
|
+
multiValueHeaders?: Record<string, Array<string | number | boolean>>;
|
|
234
|
+
body: string;
|
|
235
|
+
isBase64Encoded?: boolean;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* API Gateway HTTP API (v2) proxy result (`APIGatewayProxyResultV2`).
|
|
239
|
+
*/
|
|
240
|
+
type AWSLambdaProxyResultV2 = string | {
|
|
241
|
+
statusCode?: number;
|
|
242
|
+
headers?: Record<string, string | number | boolean>;
|
|
243
|
+
body?: string;
|
|
244
|
+
isBase64Encoded?: boolean;
|
|
245
|
+
cookies?: string[];
|
|
246
|
+
};
|
|
247
|
+
/**
|
|
248
|
+
* Service worker `fetch` event (`FetchEvent`).
|
|
249
|
+
*/
|
|
250
|
+
interface ServiceWorkerFetchEvent {
|
|
251
|
+
readonly request: Request;
|
|
252
|
+
readonly clientId?: string;
|
|
253
|
+
respondWith(response: Response | Promise<Response>): void;
|
|
254
|
+
waitUntil(promise: Promise<any>): void;
|
|
255
|
+
}
|
|
27
256
|
type MaybePromise<T> = T | Promise<T>;
|
|
28
|
-
type IsAny<T> = Equal<T, any> extends true ? true : false;
|
|
29
|
-
type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? true : false;
|
|
30
257
|
/**
|
|
31
258
|
* Faster URL constructor with lazy access to pathname and search params (For Node, Deno, and Bun).
|
|
32
259
|
*/
|
|
@@ -187,13 +414,13 @@ interface ServerOptions {
|
|
|
187
414
|
*
|
|
188
415
|
* @docs https://bun.sh/docs/api/http
|
|
189
416
|
*/
|
|
190
|
-
bun?:
|
|
417
|
+
bun?: BunServeOptions;
|
|
191
418
|
/**
|
|
192
419
|
* Deno server options
|
|
193
420
|
*
|
|
194
421
|
* @docs https://docs.deno.com/api/deno/~/Deno.serve
|
|
195
422
|
*/
|
|
196
|
-
deno?:
|
|
423
|
+
deno?: DenoServeOptions;
|
|
197
424
|
/**
|
|
198
425
|
* Service worker options
|
|
199
426
|
*/
|
|
@@ -235,13 +462,13 @@ interface Server<Handler = ServerHandler> {
|
|
|
235
462
|
* Bun context.
|
|
236
463
|
*/
|
|
237
464
|
readonly bun?: {
|
|
238
|
-
server?:
|
|
465
|
+
server?: BunHttpServer;
|
|
239
466
|
};
|
|
240
467
|
/**
|
|
241
468
|
* Deno context.
|
|
242
469
|
*/
|
|
243
470
|
readonly deno?: {
|
|
244
|
-
server?:
|
|
471
|
+
server?: DenoHttpServer;
|
|
245
472
|
};
|
|
246
473
|
/**
|
|
247
474
|
* Server fetch handler
|
|
@@ -285,27 +512,27 @@ interface ServerRuntimeContext {
|
|
|
285
512
|
* Underlying Deno server request info.
|
|
286
513
|
*/
|
|
287
514
|
deno?: {
|
|
288
|
-
info:
|
|
515
|
+
info: DenoServeHandlerInfo;
|
|
289
516
|
};
|
|
290
517
|
/**
|
|
291
518
|
* Underlying Bun server request context.
|
|
292
519
|
*/
|
|
293
520
|
bun?: {
|
|
294
|
-
server:
|
|
521
|
+
server: BunHttpServer;
|
|
295
522
|
};
|
|
296
523
|
/**
|
|
297
524
|
* Underlying Cloudflare request context.
|
|
298
525
|
*/
|
|
299
526
|
cloudflare?: {
|
|
300
|
-
context:
|
|
301
|
-
env:
|
|
527
|
+
context: CloudflareExecutionContext;
|
|
528
|
+
env: CloudflareEnv;
|
|
302
529
|
};
|
|
303
530
|
awsLambda?: {
|
|
304
|
-
context:
|
|
305
|
-
event:
|
|
531
|
+
context: AWSLambdaContext;
|
|
532
|
+
event: AWSLambdaProxyEvent | AWSLambdaProxyEventV2;
|
|
306
533
|
};
|
|
307
534
|
serviceWorker?: {
|
|
308
|
-
event:
|
|
535
|
+
event: ServiceWorkerFetchEvent;
|
|
309
536
|
};
|
|
310
537
|
netlify?: {
|
|
311
538
|
context: any;
|
|
@@ -353,8 +580,8 @@ interface ServerRequest extends Request {
|
|
|
353
580
|
}
|
|
354
581
|
type FetchHandler = (request: Request) => Response | Promise<Response>;
|
|
355
582
|
type ErrorHandler = (error: unknown) => Response | Promise<Response>;
|
|
356
|
-
type BunFetchHandler = (request: Request, server?:
|
|
357
|
-
type DenoFetchHandler = (request: Request, info?:
|
|
583
|
+
type BunFetchHandler = (request: Request, server?: BunHttpServer) => Response | Promise<Response>;
|
|
584
|
+
type DenoFetchHandler = (request: Request, info?: DenoServeHandlerInfo) => Response | Promise<Response>;
|
|
358
585
|
type NodeServerRequest = NodeHttp.IncomingMessage | NodeHttp2.Http2ServerRequest;
|
|
359
586
|
type NodeServerResponse = NodeHttp.ServerResponse | NodeHttp2.Http2ServerResponse;
|
|
360
587
|
type NodeHttp1Handler = (req: NodeHttp.IncomingMessage, res: NodeHttp.ServerResponse) => void | Promise<void>;
|
|
@@ -363,5 +590,11 @@ type NodeHttpHandler = NodeHttp1Handler | NodeHttp2Handler;
|
|
|
363
590
|
type NodeHTTP1Middleware = (req: NodeHttp.IncomingMessage, res: NodeHttp.ServerResponse, next: (error?: Error) => void) => unknown | Promise<unknown>;
|
|
364
591
|
type NodeHTTP2Middleware = (req: NodeHttp2.Http2ServerRequest, res: NodeHttp2.Http2ServerResponse, next: (error?: Error) => void) => unknown | Promise<unknown>;
|
|
365
592
|
type NodeHTTPMiddleware = NodeHTTP1Middleware | NodeHTTP2Middleware;
|
|
366
|
-
type CloudflareFetchHandler =
|
|
367
|
-
|
|
593
|
+
type CloudflareFetchHandler = (request: Request, env: CloudflareEnv, context: CloudflareExecutionContext) => Response | Promise<Response>;
|
|
594
|
+
/**
|
|
595
|
+
* Body accepted by the runtime `Response` constructor (`BodyInit`).
|
|
596
|
+
*
|
|
597
|
+
* Derived from the ambient `Response` so that it does not require `lib: ["dom"]`.
|
|
598
|
+
*/
|
|
599
|
+
type ResponseBody = NonNullable<ConstructorParameters<typeof globalThis.Response>[0]>;
|
|
600
|
+
export { AWSLambdaContext, AWSLambdaProxyEvent, AWSLambdaProxyEventV2, AWSLambdaProxyResult, AWSLambdaProxyResultV2, BunFetchHandler, BunHttpServer, BunServeOptions, CloudflareEnv, CloudflareExecutionContext, CloudflareFetchHandler, DenoFetchHandler, DenoHttpServer, DenoServeHandlerInfo, DenoServeOptions, ErrorHandler, FastResponse, FastURL, FetchHandler, NodeHTTP1Middleware, NodeHTTP2Middleware, NodeHTTPMiddleware, NodeHttp1Handler, NodeHttp2Handler, NodeHttpHandler, NodeServerRequest, NodeServerResponse, ResponseBody, Server, ServerHandler, ServerMiddleware, ServerOptions, ServerPlugin, ServerRequest, ServerRequestContext, ServerRuntimeContext, ServiceWorkerFetchEvent, TrustProxyOption, serve };
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { FetchHandler, ServerOptions, TrustProxyOption } from "../_chunks/types.mjs";
|
|
2
|
-
import * as AWS from "aws-lambda";
|
|
1
|
+
import { AWSLambdaContext, AWSLambdaProxyEvent, AWSLambdaProxyEventV2, AWSLambdaProxyResult, AWSLambdaProxyResultV2, FetchHandler, ServerOptions, TrustProxyOption } from "../_chunks/types.mjs";
|
|
3
2
|
type AWSLambdaResponseStream = NodeJS.WritableStream & {
|
|
4
3
|
setContentType(contentType: string): void;
|
|
5
4
|
};
|
|
6
5
|
type MaybePromise<T> = T | Promise<T>;
|
|
7
|
-
type AwsLambdaEvent =
|
|
8
|
-
type AWSLambdaHandler = (event: AwsLambdaEvent, context:
|
|
9
|
-
type AWSLambdaStreamingHandler = (event: AwsLambdaEvent, responseStream: AWSLambdaResponseStream, context:
|
|
6
|
+
type AwsLambdaEvent = AWSLambdaProxyEvent | AWSLambdaProxyEventV2;
|
|
7
|
+
type AWSLambdaHandler = (event: AwsLambdaEvent, context: AWSLambdaContext) => MaybePromise<AWSLambdaProxyResult | AWSLambdaProxyResultV2>;
|
|
8
|
+
type AWSLambdaStreamingHandler = (event: AwsLambdaEvent, responseStream: AWSLambdaResponseStream, context: AWSLambdaContext) => MaybePromise<void>;
|
|
10
9
|
declare function toLambdaHandler(options: ServerOptions): AWSLambdaHandler;
|
|
11
|
-
declare function handleLambdaEvent(fetchHandler: FetchHandler, event: AwsLambdaEvent, context:
|
|
12
|
-
declare function handleLambdaEventWithStream(fetchHandler: FetchHandler, event: AwsLambdaEvent, responseStream: AWSLambdaResponseStream, context:
|
|
10
|
+
declare function handleLambdaEvent(fetchHandler: FetchHandler, event: AwsLambdaEvent, context: AWSLambdaContext, trustProxy?: TrustProxyOption): Promise<AWSLambdaProxyResult | AWSLambdaProxyResultV2>;
|
|
11
|
+
declare function handleLambdaEventWithStream(fetchHandler: FetchHandler, event: AwsLambdaEvent, responseStream: AWSLambdaResponseStream, context: AWSLambdaContext, trustProxy?: TrustProxyOption): Promise<void>;
|
|
13
12
|
declare function invokeLambdaHandler(handler: AWSLambdaHandler, request: Request): Promise<Response>;
|
|
14
13
|
export { AWSLambdaHandler, type AWSLambdaResponseStream, AWSLambdaStreamingHandler, AwsLambdaEvent, handleLambdaEvent, handleLambdaEventWithStream, invokeLambdaHandler, toLambdaHandler };
|
package/dist/adapters/bun.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { BunFetchHandler, Server, ServerOptions } from "../_chunks/types.mjs";
|
|
1
|
+
import { BunFetchHandler, BunServeOptions, Server, ServerOptions } from "../_chunks/types.mjs";
|
|
2
2
|
import { FastURL } from "../_chunks/_url.mjs";
|
|
3
|
-
import * as bun from "bun";
|
|
4
3
|
declare const FastResponse: typeof globalThis.Response;
|
|
5
4
|
declare function serve(options: ServerOptions): BunServer;
|
|
6
5
|
declare class BunServer implements Server<BunFetchHandler> {
|
|
@@ -8,7 +7,7 @@ declare class BunServer implements Server<BunFetchHandler> {
|
|
|
8
7
|
readonly runtime = "bun";
|
|
9
8
|
readonly options: Server["options"];
|
|
10
9
|
readonly bun: Server["bun"];
|
|
11
|
-
readonly serveOptions:
|
|
10
|
+
readonly serveOptions: BunServeOptions | undefined;
|
|
12
11
|
readonly fetch: BunFetchHandler;
|
|
13
12
|
readonly waitUntil?: Server["waitUntil"];
|
|
14
13
|
constructor(options: ServerOptions);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Server, ServerOptions } from "../_chunks/types.mjs";
|
|
2
|
-
import * as CF from "@cloudflare/workers-types";
|
|
1
|
+
import { CloudflareFetchHandler, Server, ServerOptions } from "../_chunks/types.mjs";
|
|
3
2
|
declare const FastURL: typeof globalThis.URL;
|
|
4
3
|
declare const FastResponse: typeof globalThis.Response;
|
|
5
|
-
declare function serve(options: ServerOptions): Server<
|
|
4
|
+
declare function serve(options: ServerOptions): Server<CloudflareFetchHandler>;
|
|
6
5
|
export { FastResponse, FastURL, serve };
|
package/dist/adapters/deno.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DenoFetchHandler, Server, ServerOptions } from "../_chunks/types.mjs";
|
|
1
|
+
import { DenoFetchHandler, DenoServeOptions, Server, ServerOptions } from "../_chunks/types.mjs";
|
|
2
2
|
import { FastURL } from "../_chunks/_url.mjs";
|
|
3
3
|
declare const FastResponse: typeof globalThis.Response;
|
|
4
4
|
declare function serve(options: ServerOptions): DenoServer;
|
|
@@ -7,7 +7,7 @@ declare class DenoServer implements Server<DenoFetchHandler> {
|
|
|
7
7
|
readonly runtime = "deno";
|
|
8
8
|
readonly options: Server["options"];
|
|
9
9
|
readonly deno: Server["deno"];
|
|
10
|
-
readonly serveOptions:
|
|
10
|
+
readonly serveOptions: DenoServeOptions | undefined;
|
|
11
11
|
readonly fetch: DenoFetchHandler;
|
|
12
12
|
readonly waitUntil?: Server["waitUntil"];
|
|
13
13
|
constructor(options: ServerOptions);
|
package/dist/adapters/deno.mjs
CHANGED
package/dist/adapters/node.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FetchHandler, NodeHttpHandler, NodeServerRequest, NodeServerResponse, Server, ServerOptions, ServerRequest, TrustProxyOption } from "../_chunks/types.mjs";
|
|
1
|
+
import { FetchHandler, NodeHttpHandler, NodeServerRequest, NodeServerResponse, ResponseBody, Server, ServerOptions, ServerRequest, TrustProxyOption } from "../_chunks/types.mjs";
|
|
2
2
|
import { FastURL } from "../_chunks/_url.mjs";
|
|
3
3
|
import { Readable } from "node:stream";
|
|
4
4
|
type NodeRequestContext = {
|
|
@@ -40,7 +40,7 @@ interface PreparedNodeResponse {
|
|
|
40
40
|
* It is faster because in most cases it doesn't create a full Response instance.
|
|
41
41
|
*/
|
|
42
42
|
declare const NodeResponse: {
|
|
43
|
-
new (body?:
|
|
43
|
+
new (body?: ResponseBody | null, init?: ResponseInit): globalThis.Response & {
|
|
44
44
|
_toNodeResponse: () => PreparedNodeResponse;
|
|
45
45
|
};
|
|
46
46
|
json(data: unknown, init?: ResponseInit): globalThis.Response & {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Server, ServerOptions, ServerRequest } from "../_chunks/types.mjs";
|
|
1
|
+
import { Server, ServerOptions, ServerRequest, ServiceWorkerFetchEvent } from "../_chunks/types.mjs";
|
|
2
2
|
declare const FastURL: typeof globalThis.URL;
|
|
3
3
|
declare const FastResponse: typeof globalThis.Response;
|
|
4
|
-
type ServiceWorkerHandler = (request: ServerRequest, event:
|
|
4
|
+
type ServiceWorkerHandler = (request: ServerRequest, event: ServiceWorkerFetchEvent) => Response | Promise<Response>;
|
|
5
5
|
declare function serve(options: ServerOptions): Server<ServiceWorkerHandler>;
|
|
6
6
|
export { FastResponse, FastURL, ServiceWorkerHandler, serve };
|
package/dist/cli.mjs
CHANGED
package/dist/types.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { BunFetchHandler, CloudflareFetchHandler, DenoFetchHandler, ErrorHandler, FastResponse, FastURL, FetchHandler, NodeHTTP1Middleware, NodeHTTP2Middleware, NodeHTTPMiddleware, NodeHttp1Handler, NodeHttp2Handler, NodeHttpHandler, NodeServerRequest, NodeServerResponse, Server, ServerHandler, ServerMiddleware, ServerOptions, ServerPlugin, ServerRequest, ServerRequestContext, ServerRuntimeContext, TrustProxyOption, serve } from "./_chunks/types.mjs";
|
|
2
|
-
export { BunFetchHandler, CloudflareFetchHandler, DenoFetchHandler, ErrorHandler, FastResponse, FastURL, FetchHandler, NodeHTTP1Middleware, NodeHTTP2Middleware, NodeHTTPMiddleware, NodeHttp1Handler, NodeHttp2Handler, NodeHttpHandler, NodeServerRequest, NodeServerResponse, Server, ServerHandler, ServerMiddleware, ServerOptions, ServerPlugin, ServerRequest, ServerRequestContext, ServerRuntimeContext, type TrustProxyOption, serve };
|
|
1
|
+
import { AWSLambdaContext, AWSLambdaProxyEvent, AWSLambdaProxyEventV2, AWSLambdaProxyResult, AWSLambdaProxyResultV2, BunFetchHandler, BunHttpServer, BunServeOptions, CloudflareEnv, CloudflareExecutionContext, CloudflareFetchHandler, DenoFetchHandler, DenoHttpServer, DenoServeHandlerInfo, DenoServeOptions, ErrorHandler, FastResponse, FastURL, FetchHandler, NodeHTTP1Middleware, NodeHTTP2Middleware, NodeHTTPMiddleware, NodeHttp1Handler, NodeHttp2Handler, NodeHttpHandler, NodeServerRequest, NodeServerResponse, ResponseBody, Server, ServerHandler, ServerMiddleware, ServerOptions, ServerPlugin, ServerRequest, ServerRequestContext, ServerRuntimeContext, ServiceWorkerFetchEvent, TrustProxyOption, serve } from "./_chunks/types.mjs";
|
|
2
|
+
export { type AWSLambdaContext, type AWSLambdaProxyEvent, type AWSLambdaProxyEventV2, type AWSLambdaProxyResult, type AWSLambdaProxyResultV2, BunFetchHandler, type BunHttpServer, type BunServeOptions, type CloudflareEnv, type CloudflareExecutionContext, CloudflareFetchHandler, DenoFetchHandler, type DenoHttpServer, type DenoServeHandlerInfo, type DenoServeOptions, ErrorHandler, FastResponse, FastURL, FetchHandler, NodeHTTP1Middleware, NodeHTTP2Middleware, NodeHTTPMiddleware, NodeHttp1Handler, NodeHttp2Handler, NodeHttpHandler, NodeServerRequest, NodeServerResponse, ResponseBody, Server, ServerHandler, ServerMiddleware, ServerOptions, ServerPlugin, ServerRequest, ServerRequestContext, ServerRuntimeContext, type ServiceWorkerFetchEvent, type TrustProxyOption, serve };
|