routup 1.0.2 → 2.0.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 +92 -8
- package/dist/dispatcher/adapters/index.d.ts +3 -0
- package/dist/dispatcher/adapters/node/index.d.ts +1 -0
- package/dist/dispatcher/adapters/node/module.d.ts +6 -0
- package/dist/dispatcher/adapters/raw/module.d.ts +4 -0
- package/dist/dispatcher/adapters/raw/type.d.ts +18 -0
- package/dist/dispatcher/adapters/web/index.d.ts +2 -0
- package/dist/dispatcher/adapters/web/module.d.ts +5 -0
- package/dist/dispatcher/adapters/web/type.d.ts +3 -0
- package/dist/dispatcher/index.d.ts +3 -0
- package/dist/dispatcher/type.d.ts +30 -0
- package/dist/dispatcher/utils.d.ts +4 -0
- package/dist/error.d.ts +1 -0
- package/dist/index.cjs +1075 -538
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -5
- package/dist/index.mjs +1054 -509
- package/dist/index.mjs.map +1 -1
- package/dist/layer/module.d.ts +5 -4
- package/dist/layer/type.d.ts +1 -2
- package/dist/layer/utils.d.ts +1 -1
- package/dist/path/index.d.ts +1 -0
- package/dist/path/matcher.d.ts +1 -2
- package/dist/path/type.d.ts +1 -0
- package/dist/path/utils.d.ts +2 -0
- package/dist/{helpers/request → request/helpers}/body.d.ts +1 -1
- package/dist/{helpers/request → request/helpers}/cache.d.ts +1 -1
- package/dist/{helpers/request → request/helpers}/cookie.d.ts +1 -1
- package/dist/{helpers/request → request/helpers}/env.d.ts +1 -1
- package/dist/{helpers/request → request/helpers}/header-accept-charset.d.ts +1 -1
- package/dist/{helpers/request → request/helpers}/header-accept-language.d.ts +1 -1
- package/dist/{helpers/request → request/helpers}/header-accept.d.ts +1 -1
- package/dist/{helpers/request → request/helpers}/header-content-type.d.ts +1 -1
- package/dist/{helpers/request → request/helpers}/header.d.ts +1 -1
- package/dist/{helpers/request → request/helpers}/hostname.d.ts +1 -1
- package/dist/{helpers/request → request/helpers}/index.d.ts +1 -0
- package/dist/{helpers/request → request/helpers}/ip.d.ts +1 -1
- package/dist/{helpers/request → request/helpers}/mount-path.d.ts +1 -1
- package/dist/{helpers/request → request/helpers}/negotiator.d.ts +1 -1
- package/dist/{helpers/request → request/helpers}/params.d.ts +1 -1
- package/dist/{helpers/request → request/helpers}/path.d.ts +1 -1
- package/dist/{helpers/request → request/helpers}/protocol.d.ts +1 -1
- package/dist/{helpers/request → request/helpers}/query.d.ts +1 -1
- package/dist/request/helpers/router.d.ts +3 -0
- package/dist/request/index.d.ts +3 -0
- package/dist/request/module.d.ts +4 -0
- package/dist/request/types.d.ts +9 -0
- package/dist/{helpers/response → response/helpers}/cache.d.ts +1 -1
- package/dist/response/helpers/gone.d.ts +2 -0
- package/dist/{helpers/response → response/helpers}/header-attachment.d.ts +1 -1
- package/dist/{helpers/response → response/helpers}/header-content-type.d.ts +1 -1
- package/dist/{helpers/response → response/helpers}/header.d.ts +1 -1
- package/dist/{helpers/response → response/helpers}/index.d.ts +3 -0
- package/dist/{helpers/response → response/helpers}/send-accepted.d.ts +2 -2
- package/dist/{helpers/response → response/helpers}/send-created.d.ts +2 -2
- package/dist/response/helpers/send-file.d.ts +17 -0
- package/dist/{helpers/response → response/helpers}/send-format.d.ts +1 -1
- package/dist/response/helpers/send-redirect.d.ts +2 -0
- package/dist/response/helpers/send-stream.d.ts +2 -0
- package/dist/response/helpers/send-web-blob.d.ts +2 -0
- package/dist/response/helpers/send-web-response.d.ts +2 -0
- package/dist/response/helpers/send.d.ts +2 -0
- package/dist/response/helpers/utils.d.ts +2 -0
- package/dist/response/index.d.ts +2 -0
- package/dist/response/module.d.ts +2 -0
- package/dist/route/module.d.ts +6 -5
- package/dist/route/type.d.ts +1 -1
- package/dist/route/utils.d.ts +1 -1
- package/dist/router/index.d.ts +0 -1
- package/dist/router/module.d.ts +13 -32
- package/dist/router/utils.d.ts +1 -0
- package/dist/router-options/index.d.ts +2 -0
- package/dist/router-options/module.d.ts +4 -0
- package/dist/router-options/transform.d.ts +2 -0
- package/dist/router-options/type.d.ts +50 -0
- package/dist/types.d.ts +19 -0
- package/dist/utils/cookie.d.ts +1 -0
- package/dist/utils/etag/module.d.ts +4 -3
- package/dist/utils/etag/type.d.ts +1 -1
- package/dist/utils/header.d.ts +3 -0
- package/dist/utils/index.d.ts +4 -1
- package/dist/utils/path.d.ts +5 -2
- package/dist/utils/stream.d.ts +8 -0
- package/dist/utils/web.d.ts +3 -0
- package/package.json +17 -16
- package/dist/config/module.d.ts +0 -8
- package/dist/config/type.d.ts +0 -34
- package/dist/handler/index.d.ts +0 -1
- package/dist/handler/utils.d.ts +0 -2
- package/dist/helpers/index.d.ts +0 -2
- package/dist/helpers/response/send-file.d.ts +0 -9
- package/dist/helpers/response/send-redirect.d.ts +0 -2
- package/dist/helpers/response/send-stream.d.ts +0 -4
- package/dist/helpers/response/send.d.ts +0 -2
- package/dist/helpers/response/utils.d.ts +0 -3
- package/dist/router/type.d.ts +0 -24
- package/dist/type.d.ts +0 -24
- package/dist/utils/request.d.ts +0 -2
- /package/dist/{config → dispatcher/adapters/raw}/index.d.ts +0 -0
- /package/dist/{helpers/request → request/helpers}/header-accept-encoding.d.ts +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "routup",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Routup is a minimalistic http based routing framework.",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./package.json": "./package.json",
|
|
@@ -50,35 +50,36 @@
|
|
|
50
50
|
},
|
|
51
51
|
"homepage": "https://github.com/routup/routup#readme",
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"
|
|
54
|
-
"continu": "^1.3.2",
|
|
53
|
+
"buffer": "^6.0.3",
|
|
55
54
|
"mime-explorer": "^1.0.0",
|
|
56
55
|
"negotiator": "^0.6.3",
|
|
57
56
|
"path-to-regexp": "^6.2.1",
|
|
58
57
|
"proxy-addr": "^2.0.7",
|
|
58
|
+
"readable-stream": "^4.4.2",
|
|
59
59
|
"smob": "^1.4.0",
|
|
60
|
-
"
|
|
60
|
+
"uncrypto": "^0.1.3"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@rollup/plugin-commonjs": "^25.0.
|
|
64
|
-
"@rollup/plugin-node-resolve": "^15.1
|
|
65
|
-
"@swc/core": "^1.3.
|
|
66
|
-
"@swc/jest": "^0.2.
|
|
67
|
-
"@tada5hi/commitlint-config": "^1.1.
|
|
68
|
-
"@tada5hi/eslint-config-typescript": "^1.2.
|
|
63
|
+
"@rollup/plugin-commonjs": "^25.0.4",
|
|
64
|
+
"@rollup/plugin-node-resolve": "^15.2.1",
|
|
65
|
+
"@swc/core": "^1.3.84",
|
|
66
|
+
"@swc/jest": "^0.2.29",
|
|
67
|
+
"@tada5hi/commitlint-config": "^1.1.1",
|
|
68
|
+
"@tada5hi/eslint-config-typescript": "^1.2.3",
|
|
69
69
|
"@tada5hi/semantic-release": "^0.2.0",
|
|
70
70
|
"@tada5hi/tsconfig": "^0.5.0",
|
|
71
|
-
"@types/jest": "^29.5.
|
|
71
|
+
"@types/jest": "^29.5.4",
|
|
72
72
|
"@types/negotiator": "^0.6.1",
|
|
73
|
-
"@types/node": "^20.
|
|
73
|
+
"@types/node": "^20.6.0",
|
|
74
74
|
"@types/proxy-addr": "^2.0.0",
|
|
75
|
+
"@types/readable-stream": "^4.0.2",
|
|
75
76
|
"@types/supertest": "^2.0.12",
|
|
76
77
|
"cross-env": "^7.0.3",
|
|
77
|
-
"jest": "^29.
|
|
78
|
+
"jest": "^29.7.0",
|
|
78
79
|
"rimraf": "^5.0.1",
|
|
79
|
-
"rollup": "^3.
|
|
80
|
-
"semantic-release": "^21.
|
|
80
|
+
"rollup": "^3.29.1",
|
|
81
|
+
"semantic-release": "^21.1.1",
|
|
81
82
|
"supertest": "^6.3.3",
|
|
82
|
-
"typescript": "5.
|
|
83
|
+
"typescript": "5.2.2"
|
|
83
84
|
}
|
|
84
85
|
}
|
package/dist/config/module.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { FlattenObject } from 'continu';
|
|
2
|
-
import { Continu } from 'continu';
|
|
3
|
-
import type { Options, OptionsInput } from './type';
|
|
4
|
-
export declare function buildConfig(): Continu<Options, OptionsInput>;
|
|
5
|
-
export declare function useConfig(): Continu<Options, OptionsInput>;
|
|
6
|
-
export declare function setConfig(config: Continu<Options, OptionsInput>): void;
|
|
7
|
-
export declare function setConfigOption<K extends keyof FlattenObject<OptionsInput>>(key: K, value: FlattenObject<OptionsInput>[K]): Options;
|
|
8
|
-
export declare function getConfigOption(key: keyof FlattenObject<OptionsInput>): string | number | import("../utils").EtagFn | import("../utils").TrustProxyFn;
|
package/dist/config/type.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { EtagFn, EtagInput } from '../utils/etag/type';
|
|
2
|
-
import type { TrustProxyFn, TrustProxyInput } from '../utils/trust-proxy';
|
|
3
|
-
export type Options = {
|
|
4
|
-
/**
|
|
5
|
-
* default: production
|
|
6
|
-
*/
|
|
7
|
-
env: string;
|
|
8
|
-
/**
|
|
9
|
-
* default: () => true
|
|
10
|
-
*/
|
|
11
|
-
etag: EtagFn;
|
|
12
|
-
/**
|
|
13
|
-
* default: 2
|
|
14
|
-
*/
|
|
15
|
-
subdomainOffset: number;
|
|
16
|
-
/**
|
|
17
|
-
* default: () => false
|
|
18
|
-
*/
|
|
19
|
-
trustProxy: TrustProxyFn;
|
|
20
|
-
/**
|
|
21
|
-
* default: 0
|
|
22
|
-
*/
|
|
23
|
-
proxyIpMax: number;
|
|
24
|
-
};
|
|
25
|
-
export type OptionsInput = {
|
|
26
|
-
/**
|
|
27
|
-
* default: true
|
|
28
|
-
*/
|
|
29
|
-
etag?: EtagInput;
|
|
30
|
-
/**
|
|
31
|
-
* default: false
|
|
32
|
-
*/
|
|
33
|
-
trustProxy?: TrustProxyInput;
|
|
34
|
-
} & Partial<Omit<Options, 'etag' | 'trustProxy'>>;
|
package/dist/handler/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './utils';
|
package/dist/handler/utils.d.ts
DELETED
package/dist/helpers/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import type { Stats } from 'node:fs';
|
|
3
|
-
import type { Response } from '../../type';
|
|
4
|
-
export type SendFileOptions = {
|
|
5
|
-
stats?: Stats;
|
|
6
|
-
filePath: string;
|
|
7
|
-
attachment?: boolean;
|
|
8
|
-
};
|
|
9
|
-
export declare function sendFile(res: Response, filePath: string | SendFileOptions, fn?: CallableFunction): void;
|
package/dist/router/type.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { PathMatcherOptions } from '../path';
|
|
2
|
-
import type { Path } from '../type';
|
|
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
|
-
* Path matcher options.
|
|
13
|
-
*
|
|
14
|
-
* @default: {end: false, sensitive: true}
|
|
15
|
-
*/
|
|
16
|
-
pathMatcher?: PathMatcherOptions;
|
|
17
|
-
/**
|
|
18
|
-
* Milliseconds (ms) until the request should be canceled.
|
|
19
|
-
*
|
|
20
|
-
* @type number
|
|
21
|
-
* @default undefined
|
|
22
|
-
*/
|
|
23
|
-
timeout?: number;
|
|
24
|
-
};
|
package/dist/type.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
3
|
-
export interface Response extends ServerResponse {
|
|
4
|
-
}
|
|
5
|
-
export interface Request extends IncomingMessage {
|
|
6
|
-
}
|
|
7
|
-
export type Next = (err?: Error) => void;
|
|
8
|
-
export type Handler = (req: Request, res: Response, next: Next) => unknown;
|
|
9
|
-
export type ErrorHandler = (err: Error, req: Request, res: Response, next: Next) => unknown;
|
|
10
|
-
export type Path = string | RegExp;
|
|
11
|
-
export type DispatcherMeta = {
|
|
12
|
-
/**
|
|
13
|
-
* Params collected on path.
|
|
14
|
-
*/
|
|
15
|
-
params?: Record<string, any>;
|
|
16
|
-
/**
|
|
17
|
-
* Path to check for the current instance.
|
|
18
|
-
*/
|
|
19
|
-
path?: string;
|
|
20
|
-
/**
|
|
21
|
-
* The relative path on which the router is hung.
|
|
22
|
-
*/
|
|
23
|
-
mountPath?: string;
|
|
24
|
-
};
|
package/dist/utils/request.d.ts
DELETED
|
File without changes
|
|
File without changes
|