routup 4.0.2 → 5.0.0-beta.0
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 +87 -134
- package/dist/bun.cjs +66 -0
- package/dist/bun.cjs.map +1 -0
- package/dist/bun.d.cts +8 -0
- package/dist/bun.d.mts +8 -0
- package/dist/bun.mjs +13 -0
- package/dist/bun.mjs.map +1 -0
- package/dist/cloudflare.cjs +66 -0
- package/dist/cloudflare.cjs.map +1 -0
- package/dist/cloudflare.d.cts +8 -0
- package/dist/cloudflare.d.mts +8 -0
- package/dist/cloudflare.mjs +13 -0
- package/dist/cloudflare.mjs.map +1 -0
- package/dist/deno.cjs +66 -0
- package/dist/deno.cjs.map +1 -0
- package/dist/deno.d.cts +8 -0
- package/dist/deno.d.mts +8 -0
- package/dist/deno.mjs +13 -0
- package/dist/deno.mjs.map +1 -0
- package/dist/generic.cjs +66 -0
- package/dist/generic.cjs.map +1 -0
- package/dist/generic.d.cts +8 -0
- package/dist/generic.d.mts +8 -0
- package/dist/generic.mjs +13 -0
- package/dist/generic.mjs.map +1 -0
- package/dist/index-9K5FcIb3.d.cts +786 -0
- package/dist/index-B6F5CzQy.d.mts +786 -0
- package/dist/node.cjs +70 -0
- package/dist/node.cjs.map +1 -0
- package/dist/node.d.cts +11 -0
- package/dist/node.d.mts +11 -0
- package/dist/node.mjs +16 -0
- package/dist/node.mjs.map +1 -0
- package/dist/service-worker.cjs +66 -0
- package/dist/service-worker.cjs.map +1 -0
- package/dist/service-worker.d.cts +10 -0
- package/dist/service-worker.d.mts +10 -0
- package/dist/service-worker.mjs +13 -0
- package/dist/service-worker.mjs.map +1 -0
- package/dist/src-C789deGE.mjs +1599 -0
- package/dist/src-C789deGE.mjs.map +1 -0
- package/dist/src-Ca2_b8P0.cjs +1939 -0
- package/dist/src-Ca2_b8P0.cjs.map +1 -0
- package/package.json +76 -36
- package/dist/adapters/index.d.ts +0 -3
- package/dist/adapters/node/index.d.ts +0 -1
- package/dist/adapters/node/module.d.ts +0 -6
- package/dist/adapters/raw/header.d.ts +0 -3
- package/dist/adapters/raw/index.d.ts +0 -3
- package/dist/adapters/raw/module.d.ts +0 -4
- package/dist/adapters/raw/type.d.ts +0 -18
- package/dist/adapters/web/index.d.ts +0 -2
- package/dist/adapters/web/module.d.ts +0 -4
- package/dist/adapters/web/type.d.ts +0 -3
- package/dist/constants.d.ts +0 -42
- package/dist/dispatcher/event/dispatch.d.ts +0 -4
- package/dist/dispatcher/event/error.d.ts +0 -5
- package/dist/dispatcher/event/index.d.ts +0 -5
- package/dist/dispatcher/event/is.d.ts +0 -3
- package/dist/dispatcher/event/module.d.ts +0 -56
- package/dist/dispatcher/event/types.d.ts +0 -9
- package/dist/dispatcher/index.d.ts +0 -2
- package/dist/dispatcher/type.d.ts +0 -4
- package/dist/error/create.d.ts +0 -11
- package/dist/error/index.d.ts +0 -3
- package/dist/error/is.d.ts +0 -2
- package/dist/error/module.d.ts +0 -3
- package/dist/handler/constants.d.ts +0 -5
- package/dist/handler/core/define.d.ts +0 -4
- package/dist/handler/core/index.d.ts +0 -2
- package/dist/handler/core/types.d.ts +0 -10
- package/dist/handler/error/define.d.ts +0 -4
- package/dist/handler/error/index.d.ts +0 -2
- package/dist/handler/error/types.d.ts +0 -11
- package/dist/handler/index.d.ts +0 -7
- package/dist/handler/is.d.ts +0 -4
- package/dist/handler/module.d.ts +0 -23
- package/dist/handler/types-base.d.ts +0 -10
- package/dist/handler/types.d.ts +0 -4
- package/dist/hook/constants.d.ts +0 -8
- package/dist/hook/index.d.ts +0 -3
- package/dist/hook/module.d.ts +0 -19
- package/dist/hook/types.d.ts +0 -5
- package/dist/index.cjs +0 -2314
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.ts +0 -11
- package/dist/index.mjs +0 -2235
- package/dist/index.mjs.map +0 -1
- package/dist/path/index.d.ts +0 -3
- package/dist/path/matcher.d.ts +0 -11
- package/dist/path/type.d.ts +0 -7
- package/dist/path/utils.d.ts +0 -2
- package/dist/plugin/index.d.ts +0 -2
- package/dist/plugin/is.d.ts +0 -2
- package/dist/plugin/types.d.ts +0 -23
- package/dist/request/helpers/cache.d.ts +0 -2
- package/dist/request/helpers/env.d.ts +0 -6
- package/dist/request/helpers/header-accept-charset.d.ts +0 -3
- package/dist/request/helpers/header-accept-encoding.d.ts +0 -3
- package/dist/request/helpers/header-accept-language.d.ts +0 -3
- package/dist/request/helpers/header-accept.d.ts +0 -3
- package/dist/request/helpers/header-content-type.d.ts +0 -2
- package/dist/request/helpers/header.d.ts +0 -4
- package/dist/request/helpers/hostname.d.ts +0 -7
- package/dist/request/helpers/http2.d.ts +0 -2
- package/dist/request/helpers/index.d.ts +0 -17
- package/dist/request/helpers/ip.d.ts +0 -7
- package/dist/request/helpers/mount-path.d.ts +0 -3
- package/dist/request/helpers/negotiator.d.ts +0 -3
- package/dist/request/helpers/params.d.ts +0 -5
- package/dist/request/helpers/path.d.ts +0 -2
- package/dist/request/helpers/protocol.d.ts +0 -8
- package/dist/request/helpers/router.d.ts +0 -3
- package/dist/request/index.d.ts +0 -3
- package/dist/request/module.d.ts +0 -3
- package/dist/request/types.d.ts +0 -12
- package/dist/response/helpers/cache.d.ts +0 -7
- package/dist/response/helpers/event-stream/factory.d.ts +0 -3
- package/dist/response/helpers/event-stream/index.d.ts +0 -2
- package/dist/response/helpers/event-stream/module.d.ts +0 -17
- package/dist/response/helpers/event-stream/types.d.ts +0 -24
- package/dist/response/helpers/event-stream/utils.d.ts +0 -2
- package/dist/response/helpers/gone.d.ts +0 -3
- package/dist/response/helpers/header-attachment.d.ts +0 -2
- package/dist/response/helpers/header-content-type.d.ts +0 -2
- package/dist/response/helpers/header.d.ts +0 -4
- package/dist/response/helpers/index.d.ts +0 -16
- package/dist/response/helpers/send-accepted.d.ts +0 -2
- package/dist/response/helpers/send-created.d.ts +0 -2
- package/dist/response/helpers/send-file.d.ts +0 -17
- package/dist/response/helpers/send-format.d.ts +0 -7
- package/dist/response/helpers/send-redirect.d.ts +0 -2
- package/dist/response/helpers/send-stream.d.ts +0 -3
- package/dist/response/helpers/send-web-blob.d.ts +0 -3
- package/dist/response/helpers/send-web-response.d.ts +0 -3
- package/dist/response/helpers/send.d.ts +0 -2
- package/dist/response/helpers/utils.d.ts +0 -2
- package/dist/response/index.d.ts +0 -3
- package/dist/response/module.d.ts +0 -3
- package/dist/response/types.d.ts +0 -3
- package/dist/router/constants.d.ts +0 -9
- package/dist/router/index.d.ts +0 -1
- package/dist/router/module.d.ts +0 -89
- package/dist/router/types.d.ts +0 -7
- package/dist/router/utils.d.ts +0 -3
- package/dist/router-options/index.d.ts +0 -2
- package/dist/router-options/module.d.ts +0 -4
- package/dist/router-options/transform.d.ts +0 -2
- package/dist/router-options/type.d.ts +0 -41
- package/dist/types.d.ts +0 -9
- package/dist/utils/cookie.d.ts +0 -1
- package/dist/utils/etag/index.d.ts +0 -3
- package/dist/utils/etag/module.d.ts +0 -11
- package/dist/utils/etag/type.d.ts +0 -15
- package/dist/utils/etag/utils.d.ts +0 -2
- package/dist/utils/index.d.ts +0 -13
- package/dist/utils/is-instance.d.ts +0 -1
- package/dist/utils/method.d.ts +0 -3
- package/dist/utils/mime.d.ts +0 -2
- package/dist/utils/next.d.ts +0 -2
- package/dist/utils/object.d.ts +0 -3
- package/dist/utils/path.d.ts +0 -5
- package/dist/utils/promise.d.ts +0 -1
- package/dist/utils/stream.d.ts +0 -6
- package/dist/utils/trust-proxy/index.d.ts +0 -2
- package/dist/utils/trust-proxy/module.d.ts +0 -2
- package/dist/utils/trust-proxy/type.d.ts +0 -2
- package/dist/utils/url.d.ts +0 -7
- package/dist/utils/web.d.ts +0 -3
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export * from './cache';
|
|
2
|
-
export * from './env';
|
|
3
|
-
export * from './header';
|
|
4
|
-
export * from './header-accept';
|
|
5
|
-
export * from './header-accept-charset';
|
|
6
|
-
export * from './header-accept-encoding';
|
|
7
|
-
export * from './header-accept-language';
|
|
8
|
-
export * from './header-content-type';
|
|
9
|
-
export * from './hostname';
|
|
10
|
-
export * from './http2';
|
|
11
|
-
export * from './ip';
|
|
12
|
-
export * from './mount-path';
|
|
13
|
-
export * from './negotiator';
|
|
14
|
-
export * from './params';
|
|
15
|
-
export * from './path';
|
|
16
|
-
export * from './protocol';
|
|
17
|
-
export * from './router';
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { Request } from '../types';
|
|
2
|
-
export declare function useRequestParams(req: Request): Record<string, any>;
|
|
3
|
-
export declare function useRequestParam(req: Request, key: string): any;
|
|
4
|
-
export declare function setRequestParams(req: Request, data: Record<string, any>): void;
|
|
5
|
-
export declare function setRequestParam(req: Request, key: string, value: any): void;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { TrustProxyInput } from '../../utils';
|
|
2
|
-
import type { Request } from '../types';
|
|
3
|
-
type RequestProtocolOptions = {
|
|
4
|
-
trustProxy?: TrustProxyInput;
|
|
5
|
-
default?: string;
|
|
6
|
-
};
|
|
7
|
-
export declare function getRequestProtocol(req: Request, options?: RequestProtocolOptions): string;
|
|
8
|
-
export {};
|
package/dist/request/index.d.ts
DELETED
package/dist/request/module.d.ts
DELETED
package/dist/request/types.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { IncomingMessage } from 'node:http';
|
|
2
|
-
import type { NodeReadableStream, WebReadableStream } from '../types';
|
|
3
|
-
export type RequestBody = null | Iterable<any> | AsyncIterable<any> | NodeReadableStream | WebReadableStream;
|
|
4
|
-
export type RequestHeaders = Record<string, string | string[]>;
|
|
5
|
-
export type RequestCreateContext = {
|
|
6
|
-
body?: RequestBody;
|
|
7
|
-
headers?: RequestHeaders;
|
|
8
|
-
method?: string;
|
|
9
|
-
url?: string;
|
|
10
|
-
};
|
|
11
|
-
export interface Request extends IncomingMessage {
|
|
12
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { Response } from '../types';
|
|
2
|
-
export type ResponseCacheHeadersOptions = {
|
|
3
|
-
maxAge?: number;
|
|
4
|
-
modifiedTime?: string | Date;
|
|
5
|
-
cacheControls?: string[];
|
|
6
|
-
};
|
|
7
|
-
export declare function setResponseCacheHeaders(res: Response, options?: ResponseCacheHeadersOptions): void;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { PassThrough } from 'readable-stream';
|
|
2
|
-
import type { Response } from '../../types';
|
|
3
|
-
import type { EventStreamListener, EventStreamMessage } from './types';
|
|
4
|
-
export declare class EventStream {
|
|
5
|
-
protected response: Response;
|
|
6
|
-
protected passThrough: PassThrough;
|
|
7
|
-
protected flushed: boolean;
|
|
8
|
-
protected eventHandlers: Record<string, EventStreamListener[]>;
|
|
9
|
-
constructor(response: Response);
|
|
10
|
-
protected open(): void;
|
|
11
|
-
write(message: EventStreamMessage): void;
|
|
12
|
-
write(message: string): void;
|
|
13
|
-
end(): void;
|
|
14
|
-
on(event: 'close', listener: EventStreamListener): void;
|
|
15
|
-
on(event: 'error', listener: EventStreamListener): void;
|
|
16
|
-
protected emit(event: string, ...args: any[]): void;
|
|
17
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#event_stream_format
|
|
3
|
-
*/
|
|
4
|
-
export type EventStreamMessage = {
|
|
5
|
-
/**
|
|
6
|
-
* The event ID to set the EventSource object's last event ID value.
|
|
7
|
-
*/
|
|
8
|
-
id?: string;
|
|
9
|
-
/**
|
|
10
|
-
* The reconnection time.
|
|
11
|
-
* If the connection to the server is lost, the browser will wait for the specified time before attempting to reconnect.
|
|
12
|
-
* This must be an integer, specifying the reconnection time in milliseconds.
|
|
13
|
-
*/
|
|
14
|
-
retry?: number;
|
|
15
|
-
/**
|
|
16
|
-
* The data field for the message.
|
|
17
|
-
*/
|
|
18
|
-
data: string;
|
|
19
|
-
/**
|
|
20
|
-
* A string identifying the type of event described.
|
|
21
|
-
*/
|
|
22
|
-
event?: string;
|
|
23
|
-
};
|
|
24
|
-
export type EventStreamListener<T = any> = (err: Error | null, data: T) => void | Promise<void>;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { OutgoingHttpHeader } from 'node:http';
|
|
2
|
-
import type { Response } from '../types';
|
|
3
|
-
export declare function appendResponseHeader(res: Response, name: string, value: OutgoingHttpHeader): void;
|
|
4
|
-
export declare function appendResponseHeaderDirective(res: Response, name: string, value: OutgoingHttpHeader): void;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export * from './cache';
|
|
2
|
-
export * from './event-stream';
|
|
3
|
-
export * from './gone';
|
|
4
|
-
export * from './header';
|
|
5
|
-
export * from './header-attachment';
|
|
6
|
-
export * from './header-content-type';
|
|
7
|
-
export * from './send';
|
|
8
|
-
export * from './send-accepted';
|
|
9
|
-
export * from './send-created';
|
|
10
|
-
export * from './send-file';
|
|
11
|
-
export * from './send-format';
|
|
12
|
-
export * from './send-redirect';
|
|
13
|
-
export * from './send-stream';
|
|
14
|
-
export * from './send-web-response';
|
|
15
|
-
export * from './send-web-blob';
|
|
16
|
-
export * from './utils';
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { Response } from '../types';
|
|
2
|
-
export type SendFileContentOptions = {
|
|
3
|
-
end?: number;
|
|
4
|
-
start?: number;
|
|
5
|
-
};
|
|
6
|
-
export type SendFileStats = {
|
|
7
|
-
size?: number;
|
|
8
|
-
mtime?: Date | number | string;
|
|
9
|
-
name?: string;
|
|
10
|
-
};
|
|
11
|
-
export type SendFileOptions = {
|
|
12
|
-
stats: () => Promise<SendFileStats> | SendFileStats;
|
|
13
|
-
content: (options: SendFileContentOptions) => Promise<unknown> | unknown;
|
|
14
|
-
attachment?: boolean;
|
|
15
|
-
name?: string;
|
|
16
|
-
};
|
|
17
|
-
export declare function sendFile(res: Response, options: SendFileOptions, next?: (err?: Error) => Promise<unknown> | unknown): Promise<unknown>;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { NodeReadableStream, WebReadableStream } from '../../types';
|
|
2
|
-
import type { Response } from '../types';
|
|
3
|
-
export declare function sendStream(res: Response, stream: NodeReadableStream | WebReadableStream, next?: (err?: Error) => Promise<unknown> | unknown): Promise<unknown>;
|
package/dist/response/index.d.ts
DELETED
package/dist/response/types.d.ts
DELETED
package/dist/router/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './module';
|
package/dist/router/module.d.ts
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { MethodName } from '../constants';
|
|
2
|
-
import type { DispatchEvent, Dispatcher } from '../dispatcher';
|
|
3
|
-
import type { HandlerConfig } from '../handler';
|
|
4
|
-
import { Handler } from '../handler';
|
|
5
|
-
import type { HookDefaultListener, HookErrorListener, HookListener, HookUnsubscribeFn } from '../hook';
|
|
6
|
-
import { HookManager, HookName } from '../hook';
|
|
7
|
-
import type { Path } from '../path';
|
|
8
|
-
import { PathMatcher } from '../path';
|
|
9
|
-
import type { Plugin, PluginInstallContext } from '../plugin';
|
|
10
|
-
import type { RouterOptionsInput } from '../router-options';
|
|
11
|
-
import type { RouterPipelineContext } from './types';
|
|
12
|
-
export declare class Router implements Dispatcher {
|
|
13
|
-
readonly '@instanceof': symbol;
|
|
14
|
-
/**
|
|
15
|
-
* An identifier for the router instance.
|
|
16
|
-
*/
|
|
17
|
-
readonly id: number;
|
|
18
|
-
/**
|
|
19
|
-
* A label for the router instance.
|
|
20
|
-
*/
|
|
21
|
-
readonly name?: string;
|
|
22
|
-
/**
|
|
23
|
-
* Array of mounted layers, routes & routers.
|
|
24
|
-
*
|
|
25
|
-
* @protected
|
|
26
|
-
*/
|
|
27
|
-
protected stack: (Router | Handler)[];
|
|
28
|
-
/**
|
|
29
|
-
* Path matcher for the current mount path.
|
|
30
|
-
*
|
|
31
|
-
* @protected
|
|
32
|
-
*/
|
|
33
|
-
protected pathMatcher: PathMatcher | undefined;
|
|
34
|
-
/**
|
|
35
|
-
* A hook manager.
|
|
36
|
-
*
|
|
37
|
-
* @protected
|
|
38
|
-
*/
|
|
39
|
-
protected hookManager: HookManager;
|
|
40
|
-
constructor(options?: RouterOptionsInput);
|
|
41
|
-
matchPath(path: string): boolean;
|
|
42
|
-
setPath(value?: Path): void;
|
|
43
|
-
protected executePipelineStep(context: RouterPipelineContext): Promise<void>;
|
|
44
|
-
protected executePipelineStepStart(context: RouterPipelineContext): Promise<void>;
|
|
45
|
-
protected executePipelineStepLookup(context: RouterPipelineContext): Promise<void>;
|
|
46
|
-
protected executePipelineStepChildBefore(context: RouterPipelineContext): Promise<void>;
|
|
47
|
-
protected executePipelineStepChildAfter(context: RouterPipelineContext): Promise<void>;
|
|
48
|
-
protected executePipelineStepChildDispatch(context: RouterPipelineContext): Promise<void>;
|
|
49
|
-
protected executePipelineStepFinish(context: RouterPipelineContext): Promise<void>;
|
|
50
|
-
dispatch(event: DispatchEvent): Promise<void>;
|
|
51
|
-
delete(...handlers: (Handler | HandlerConfig)[]): this;
|
|
52
|
-
delete(path: Path, ...handlers: (Handler | HandlerConfig)[]): this;
|
|
53
|
-
get(...handlers: (Handler | HandlerConfig)[]): this;
|
|
54
|
-
get(path: Path, ...handlers: (Handler | HandlerConfig)[]): this;
|
|
55
|
-
post(...handlers: (Handler | HandlerConfig)[]): this;
|
|
56
|
-
post(path: Path, ...handlers: (Handler | HandlerConfig)[]): this;
|
|
57
|
-
put(...handlers: (Handler | HandlerConfig)[]): this;
|
|
58
|
-
put(path: Path, ...handlers: (Handler | HandlerConfig)[]): this;
|
|
59
|
-
patch(...handlers: (Handler | HandlerConfig)[]): this;
|
|
60
|
-
patch(path: Path, ...handlers: (Handler | HandlerConfig)[]): this;
|
|
61
|
-
head(...handlers: (Handler | HandlerConfig)[]): this;
|
|
62
|
-
head(path: Path, ...handlers: (Handler | HandlerConfig)[]): this;
|
|
63
|
-
options(...handlers: (Handler | HandlerConfig)[]): this;
|
|
64
|
-
options(path: Path, ...handlers: (Handler | HandlerConfig)[]): this;
|
|
65
|
-
protected useForMethod(method: MethodName, ...input: (Path | Handler | HandlerConfig)[]): void;
|
|
66
|
-
use(router: Router): this;
|
|
67
|
-
use(handler: Handler | HandlerConfig): this;
|
|
68
|
-
use(plugin: Plugin): this;
|
|
69
|
-
use(path: Path, router: Router): this;
|
|
70
|
-
use(path: Path, handler: Handler | HandlerConfig): this;
|
|
71
|
-
use(path: Path, plugin: Plugin): this;
|
|
72
|
-
protected install(plugin: Plugin, context?: PluginInstallContext): this;
|
|
73
|
-
/**
|
|
74
|
-
* Add a hook listener.
|
|
75
|
-
*
|
|
76
|
-
* @param name
|
|
77
|
-
* @param fn
|
|
78
|
-
*/
|
|
79
|
-
on(name: `${HookName.DISPATCH_START}` | `${HookName.DISPATCH_END}` | `${HookName.CHILD_DISPATCH_BEFORE}` | `${HookName.CHILD_DISPATCH_AFTER}`, fn: HookDefaultListener): HookUnsubscribeFn;
|
|
80
|
-
on(name: `${HookName.CHILD_MATCH}`, fn: HookErrorListener): HookUnsubscribeFn;
|
|
81
|
-
on(name: `${HookName.ERROR}`, fn: HookErrorListener): HookUnsubscribeFn;
|
|
82
|
-
/**
|
|
83
|
-
* Remove single or all hook listeners.
|
|
84
|
-
*
|
|
85
|
-
* @param name
|
|
86
|
-
*/
|
|
87
|
-
off(name: `${HookName}`): this;
|
|
88
|
-
off(name: `${HookName}`, fn: HookListener): this;
|
|
89
|
-
}
|
package/dist/router/types.d.ts
DELETED
package/dist/router/utils.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { RouterOptions } from './type';
|
|
2
|
-
export declare function setRouterOptions(id: number, input: Partial<RouterOptions>): void;
|
|
3
|
-
export declare function unsetRouterOptions(id: number): void;
|
|
4
|
-
export declare function findRouterOption<K extends keyof RouterOptions>(key: K, path?: number[]): RouterOptions[K];
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { Path } from '../path';
|
|
2
|
-
import type { EtagFn, EtagInput, TrustProxyFn, TrustProxyInput } from '../utils';
|
|
3
|
-
export type RouterOptions = {
|
|
4
|
-
/**
|
|
5
|
-
* The path the router is mounted on.
|
|
6
|
-
*
|
|
7
|
-
* @type string
|
|
8
|
-
* @default '/'
|
|
9
|
-
*/
|
|
10
|
-
path?: Path;
|
|
11
|
-
/**
|
|
12
|
-
* Name of the router.
|
|
13
|
-
*/
|
|
14
|
-
name?: string;
|
|
15
|
-
/**
|
|
16
|
-
* default: 2
|
|
17
|
-
*/
|
|
18
|
-
subdomainOffset: number;
|
|
19
|
-
/**
|
|
20
|
-
* default: 0
|
|
21
|
-
*/
|
|
22
|
-
proxyIpMax: number;
|
|
23
|
-
/**
|
|
24
|
-
* default: () => true
|
|
25
|
-
*/
|
|
26
|
-
etag: EtagFn;
|
|
27
|
-
/**
|
|
28
|
-
* default: () => false
|
|
29
|
-
*/
|
|
30
|
-
trustProxy: TrustProxyFn;
|
|
31
|
-
};
|
|
32
|
-
export type RouterOptionsInput = Omit<Partial<RouterOptions>, 'etag' | 'trustProxy'> & {
|
|
33
|
-
/**
|
|
34
|
-
* default: true
|
|
35
|
-
*/
|
|
36
|
-
etag?: EtagInput;
|
|
37
|
-
/**
|
|
38
|
-
* default: false
|
|
39
|
-
*/
|
|
40
|
-
trustProxy?: TrustProxyInput;
|
|
41
|
-
};
|
package/dist/types.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Readable as NodeReadable } from 'node:stream';
|
|
2
|
-
import type { Readable } from 'readable-stream';
|
|
3
|
-
import type { ReadableStream } from 'stream/web';
|
|
4
|
-
export type NodeReadableStream = NodeReadable | Readable;
|
|
5
|
-
export type WebReadableStream = globalThis.ReadableStream | ReadableStream;
|
|
6
|
-
export type WebResponse = globalThis.Response;
|
|
7
|
-
export type WebRequest = globalThis.Request;
|
|
8
|
-
export type WebBlob = globalThis.Blob;
|
|
9
|
-
export type Next = (err?: Error) => void;
|
package/dist/utils/cookie.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function splitCookiesString(input?: string | string[]): string[];
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Buffer } from 'buffer';
|
|
2
|
-
import { type Stats } from 'node:fs';
|
|
3
|
-
import type { EtagOptions } from './type';
|
|
4
|
-
/**
|
|
5
|
-
* Generate an ETag.
|
|
6
|
-
*/
|
|
7
|
-
export declare function generateETag(input: string | Buffer | Stats): Promise<string>;
|
|
8
|
-
/**
|
|
9
|
-
* Create a simple ETag.
|
|
10
|
-
*/
|
|
11
|
-
export declare function createEtag(input: string | Buffer | Stats, options?: EtagOptions): Promise<string>;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export type EtagOptions = {
|
|
2
|
-
/**
|
|
3
|
-
* Create a weak ETag?
|
|
4
|
-
* Output is prefixed with: /W
|
|
5
|
-
*/
|
|
6
|
-
weak?: boolean;
|
|
7
|
-
/**
|
|
8
|
-
* Threshold of bytes from which an etag is generated.
|
|
9
|
-
*
|
|
10
|
-
* default: undefined
|
|
11
|
-
*/
|
|
12
|
-
threshold?: number;
|
|
13
|
-
};
|
|
14
|
-
export type EtagFn = (body: any, encoding?: BufferEncoding, size?: number) => Promise<string | undefined>;
|
|
15
|
-
export type EtagInput = boolean | EtagOptions | EtagFn;
|
package/dist/utils/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export * from './cookie';
|
|
2
|
-
export * from './etag';
|
|
3
|
-
export * from './trust-proxy';
|
|
4
|
-
export * from './is-instance';
|
|
5
|
-
export * from './mime';
|
|
6
|
-
export * from './method';
|
|
7
|
-
export * from './next';
|
|
8
|
-
export * from './object';
|
|
9
|
-
export * from './path';
|
|
10
|
-
export * from './promise';
|
|
11
|
-
export * from './stream';
|
|
12
|
-
export * from './url';
|
|
13
|
-
export * from './web';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isInstance(input: unknown, sym: symbol): boolean;
|
package/dist/utils/method.d.ts
DELETED
package/dist/utils/mime.d.ts
DELETED
package/dist/utils/next.d.ts
DELETED
package/dist/utils/object.d.ts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export declare function isObject(item: unknown): item is Record<string, any>;
|
|
2
|
-
export declare function setProperty(record: Record<PropertyKey, any>, property: PropertyKey, value: any): void;
|
|
3
|
-
export declare function getProperty<T = any>(req: Record<PropertyKey, any>, property: PropertyKey): T;
|
package/dist/utils/path.d.ts
DELETED
package/dist/utils/promise.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isPromise(p: unknown): p is Promise<unknown>;
|
package/dist/utils/stream.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { ReadableStream as WebReadableStream } from 'stream/web';
|
|
2
|
-
import type { Readable as NodeReadable } from 'node:stream';
|
|
3
|
-
import type { Readable } from 'readable-stream';
|
|
4
|
-
export declare function isNodeStream(input: unknown): input is NodeReadable | Readable;
|
|
5
|
-
export declare function isWebStream(input: unknown): input is ReadableStream | WebReadableStream;
|
|
6
|
-
export declare function isStream(data: any): data is NodeReadable | Readable | ReadableStream | WebReadableStream;
|
package/dist/utils/url.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export declare function hasTrailingSlash(input?: string, queryParams?: boolean): boolean;
|
|
2
|
-
export declare function withoutTrailingSlash(input?: string, queryParams?: boolean): string;
|
|
3
|
-
export declare function withTrailingSlash(input?: string, queryParams?: boolean): string;
|
|
4
|
-
export declare function hasLeadingSlash(input?: string): boolean;
|
|
5
|
-
export declare function withoutLeadingSlash(input?: string): string;
|
|
6
|
-
export declare function withLeadingSlash(input?: string): string;
|
|
7
|
-
export declare function cleanDoubleSlashes(input?: string): string;
|
package/dist/utils/web.d.ts
DELETED