routup 0.12.0 → 0.13.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 +11 -10
- package/dist/handler/index.d.ts +1 -1
- package/dist/handler/utils.d.ts +2 -2
- package/dist/index.cjs +580 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +8 -8
- package/dist/index.mjs +562 -0
- package/dist/index.mjs.map +1 -0
- package/dist/layer/index.d.ts +3 -3
- package/dist/layer/module.d.ts +15 -15
- package/dist/layer/type.d.ts +6 -6
- package/dist/layer/utils.d.ts +2 -2
- package/dist/path/index.d.ts +2 -2
- package/dist/path/matcher.d.ts +12 -12
- package/dist/path/type.d.ts +6 -6
- package/dist/route/index.d.ts +3 -3
- package/dist/route/module.d.ts +26 -26
- package/dist/route/type.d.ts +6 -6
- package/dist/route/utils.d.ts +2 -2
- package/dist/router/index.d.ts +2 -2
- package/dist/router/module.d.ts +70 -70
- package/dist/router/module.d.ts.map +1 -1
- package/dist/router/type.d.ts +24 -24
- package/dist/type.d.ts +13 -13
- package/dist/utils/index.d.ts +4 -4
- package/dist/utils/is-instance.d.ts +1 -1
- package/dist/utils/path.d.ts +2 -2
- package/dist/utils/promise.d.ts +1 -1
- package/dist/utils/request.d.ts +2 -2
- package/package.json +15 -6
- package/dist/handler/index.js +0 -21
- package/dist/handler/utils.js +0 -29
- package/dist/index.js +0 -28
- package/dist/layer/index.js +0 -23
- package/dist/layer/module.js +0 -74
- package/dist/layer/type.js +0 -9
- package/dist/layer/utils.js +0 -17
- package/dist/path/index.js +0 -22
- package/dist/path/matcher.js +0 -74
- package/dist/path/type.js +0 -9
- package/dist/route/index.js +0 -23
- package/dist/route/module.js +0 -135
- package/dist/route/type.js +0 -9
- package/dist/route/utils.js +0 -17
- package/dist/router/index.js +0 -22
- package/dist/router/module.js +0 -294
- package/dist/router/type.js +0 -9
- package/dist/type.js +0 -9
- package/dist/utils/index.js +0 -24
- package/dist/utils/is-instance.js +0 -16
- package/dist/utils/path.js +0 -16
- package/dist/utils/promise.js +0 -19
- package/dist/utils/request.js +0 -33
package/dist/layer/module.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { Request, Response } from '@routup/core';
|
|
2
|
-
import { PathMatcher } from '../path';
|
|
3
|
-
import { DispatcherMeta } from '../type';
|
|
4
|
-
import { LayerOptions } from './type';
|
|
5
|
-
export declare class Layer {
|
|
6
|
-
readonly '@instanceof': symbol;
|
|
7
|
-
protected fn: CallableFunction;
|
|
8
|
-
protected pathMatcher: PathMatcher;
|
|
9
|
-
constructor(options: LayerOptions, fn: CallableFunction);
|
|
10
|
-
isError(): boolean;
|
|
11
|
-
dispatch(req: Request, res: Response, meta: DispatcherMeta, next: CallableFunction): void;
|
|
12
|
-
dispatch(req: Request, res: Response, meta: DispatcherMeta, next: CallableFunction, err: Error): void;
|
|
13
|
-
matchPath(path: string): boolean;
|
|
14
|
-
exec(path: string): import("../path").PathMatcherExecResult | undefined;
|
|
15
|
-
}
|
|
1
|
+
import { Request, Response } from '@routup/core';
|
|
2
|
+
import { PathMatcher } from '../path';
|
|
3
|
+
import { DispatcherMeta } from '../type';
|
|
4
|
+
import { LayerOptions } from './type';
|
|
5
|
+
export declare class Layer {
|
|
6
|
+
readonly '@instanceof': symbol;
|
|
7
|
+
protected fn: CallableFunction;
|
|
8
|
+
protected pathMatcher: PathMatcher;
|
|
9
|
+
constructor(options: LayerOptions, fn: CallableFunction);
|
|
10
|
+
isError(): boolean;
|
|
11
|
+
dispatch(req: Request, res: Response, meta: DispatcherMeta, next: CallableFunction): void;
|
|
12
|
+
dispatch(req: Request, res: Response, meta: DispatcherMeta, next: CallableFunction, err: Error): void;
|
|
13
|
+
matchPath(path: string): boolean;
|
|
14
|
+
exec(path: string): import("../path").PathMatcherExecResult | undefined;
|
|
15
|
+
}
|
|
16
16
|
//# sourceMappingURL=module.d.ts.map
|
package/dist/layer/type.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { PathMatcherOptions } from '../path';
|
|
2
|
-
import { Path } from '../type';
|
|
3
|
-
export type LayerOptions = {
|
|
4
|
-
path: Path;
|
|
5
|
-
pathMatcher: PathMatcherOptions;
|
|
6
|
-
};
|
|
1
|
+
import { PathMatcherOptions } from '../path';
|
|
2
|
+
import { Path } from '../type';
|
|
3
|
+
export type LayerOptions = {
|
|
4
|
+
path: Path;
|
|
5
|
+
pathMatcher: PathMatcherOptions;
|
|
6
|
+
};
|
|
7
7
|
//# sourceMappingURL=type.d.ts.map
|
package/dist/layer/utils.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Layer } from './module';
|
|
2
|
-
export declare function isLayerInstance(input: unknown): input is Layer;
|
|
1
|
+
import { Layer } from './module';
|
|
2
|
+
export declare function isLayerInstance(input: unknown): input is Layer;
|
|
3
3
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/path/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './matcher';
|
|
2
|
-
export * from './type';
|
|
1
|
+
export * from './matcher';
|
|
2
|
+
export * from './type';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/path/matcher.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { Key } from 'path-to-regexp';
|
|
2
|
-
import { Path } from '../type';
|
|
3
|
-
import { PathMatcherExecResult, PathMatcherOptions } from './type';
|
|
4
|
-
export declare class PathMatcher {
|
|
5
|
-
path: Path;
|
|
6
|
-
regexp: RegExp;
|
|
7
|
-
regexpKeys: Key[];
|
|
8
|
-
regexpOptions: PathMatcherOptions;
|
|
9
|
-
constructor(path: Path, options?: PathMatcherOptions);
|
|
10
|
-
test(path: string): boolean;
|
|
11
|
-
exec(path: string): PathMatcherExecResult | undefined;
|
|
12
|
-
}
|
|
1
|
+
import { Key } from 'path-to-regexp';
|
|
2
|
+
import { Path } from '../type';
|
|
3
|
+
import { PathMatcherExecResult, PathMatcherOptions } from './type';
|
|
4
|
+
export declare class PathMatcher {
|
|
5
|
+
path: Path;
|
|
6
|
+
regexp: RegExp;
|
|
7
|
+
regexpKeys: Key[];
|
|
8
|
+
regexpOptions: PathMatcherOptions;
|
|
9
|
+
constructor(path: Path, options?: PathMatcherOptions);
|
|
10
|
+
test(path: string): boolean;
|
|
11
|
+
exec(path: string): PathMatcherExecResult | undefined;
|
|
12
|
+
}
|
|
13
13
|
//# sourceMappingURL=matcher.d.ts.map
|
package/dist/path/type.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ParseOptions, TokensToRegexpOptions } from 'path-to-regexp';
|
|
2
|
-
export type PathMatcherOptions = TokensToRegexpOptions & ParseOptions;
|
|
3
|
-
export type PathMatcherExecResult = {
|
|
4
|
-
path: string;
|
|
5
|
-
params: Record<string, any>;
|
|
6
|
-
};
|
|
1
|
+
import { ParseOptions, TokensToRegexpOptions } from 'path-to-regexp';
|
|
2
|
+
export type PathMatcherOptions = TokensToRegexpOptions & ParseOptions;
|
|
3
|
+
export type PathMatcherExecResult = {
|
|
4
|
+
path: string;
|
|
5
|
+
params: Record<string, any>;
|
|
6
|
+
};
|
|
7
7
|
//# sourceMappingURL=type.d.ts.map
|
package/dist/route/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './module';
|
|
2
|
-
export * from './type';
|
|
3
|
-
export * from './utils';
|
|
1
|
+
export * from './module';
|
|
2
|
+
export * from './type';
|
|
3
|
+
export * from './utils';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/route/module.d.ts
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { Handler, Method, Next, Request, Response } from '@routup/core';
|
|
2
|
-
import { Layer } from '../layer';
|
|
3
|
-
import { PathMatcher, PathMatcherOptions } from '../path';
|
|
4
|
-
import { DispatcherMeta, Path } from '../type';
|
|
5
|
-
import { RouteOptions } from './type';
|
|
6
|
-
export declare class Route {
|
|
7
|
-
readonly '@instanceof': symbol;
|
|
8
|
-
path: Path;
|
|
9
|
-
protected pathMatcher: PathMatcher;
|
|
10
|
-
protected pathMatcherOptions: PathMatcherOptions;
|
|
11
|
-
protected layers: Record<string, Layer[]>;
|
|
12
|
-
constructor(options: RouteOptions);
|
|
13
|
-
matchPath(path: string): boolean;
|
|
14
|
-
matchMethod(method: string): boolean;
|
|
15
|
-
getMethods(): string[];
|
|
16
|
-
dispatch(req: Request, res: Response, meta: DispatcherMeta, done: Next): void;
|
|
17
|
-
register(method: `${Method}`, ...handlers: Handler[]): void;
|
|
18
|
-
get(...handlers: Handler[]): void;
|
|
19
|
-
post(...handlers: Handler[]): void;
|
|
20
|
-
put(...handlers: Handler[]): void;
|
|
21
|
-
patch(...handlers: Handler[]): void;
|
|
22
|
-
delete(...handlers: Handler[]): void;
|
|
23
|
-
head(...handlers: Handler[]): void;
|
|
24
|
-
options(...handlers: Handler[]): void;
|
|
25
|
-
private isStrictPath;
|
|
26
|
-
}
|
|
1
|
+
import { Handler, Method, Next, Request, Response } from '@routup/core';
|
|
2
|
+
import { Layer } from '../layer';
|
|
3
|
+
import { PathMatcher, PathMatcherOptions } from '../path';
|
|
4
|
+
import { DispatcherMeta, Path } from '../type';
|
|
5
|
+
import { RouteOptions } from './type';
|
|
6
|
+
export declare class Route {
|
|
7
|
+
readonly '@instanceof': symbol;
|
|
8
|
+
path: Path;
|
|
9
|
+
protected pathMatcher: PathMatcher;
|
|
10
|
+
protected pathMatcherOptions: PathMatcherOptions;
|
|
11
|
+
protected layers: Record<string, Layer[]>;
|
|
12
|
+
constructor(options: RouteOptions);
|
|
13
|
+
matchPath(path: string): boolean;
|
|
14
|
+
matchMethod(method: string): boolean;
|
|
15
|
+
getMethods(): string[];
|
|
16
|
+
dispatch(req: Request, res: Response, meta: DispatcherMeta, done: Next): void;
|
|
17
|
+
register(method: `${Method}`, ...handlers: Handler[]): void;
|
|
18
|
+
get(...handlers: Handler[]): void;
|
|
19
|
+
post(...handlers: Handler[]): void;
|
|
20
|
+
put(...handlers: Handler[]): void;
|
|
21
|
+
patch(...handlers: Handler[]): void;
|
|
22
|
+
delete(...handlers: Handler[]): void;
|
|
23
|
+
head(...handlers: Handler[]): void;
|
|
24
|
+
options(...handlers: Handler[]): void;
|
|
25
|
+
private isStrictPath;
|
|
26
|
+
}
|
|
27
27
|
//# sourceMappingURL=module.d.ts.map
|
package/dist/route/type.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ParseOptions, TokensToRegexpOptions } from 'path-to-regexp';
|
|
2
|
-
import { Path } from '../type';
|
|
3
|
-
export type RouteOptions = {
|
|
4
|
-
path: Path;
|
|
5
|
-
pathMatcher: TokensToRegexpOptions & ParseOptions;
|
|
6
|
-
};
|
|
1
|
+
import { ParseOptions, TokensToRegexpOptions } from 'path-to-regexp';
|
|
2
|
+
import { Path } from '../type';
|
|
3
|
+
export type RouteOptions = {
|
|
4
|
+
path: Path;
|
|
5
|
+
pathMatcher: TokensToRegexpOptions & ParseOptions;
|
|
6
|
+
};
|
|
7
7
|
//# sourceMappingURL=type.d.ts.map
|
package/dist/route/utils.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Route } from './module';
|
|
2
|
-
export declare function isRouteInstance(input: unknown): input is Route;
|
|
1
|
+
import { Route } from './module';
|
|
2
|
+
export declare function isRouteInstance(input: unknown): input is Route;
|
|
3
3
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/router/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './module';
|
|
2
|
-
export * from './type';
|
|
1
|
+
export * from './module';
|
|
2
|
+
export * from './type';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/router/module.d.ts
CHANGED
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { RequestListener } from 'http';
|
|
3
|
-
import { ErrorHandler, Handler, Next, Request, Response } from '@routup/core';
|
|
4
|
-
import { PathMatcher, PathMatcherOptions } from '../path';
|
|
5
|
-
import { Layer } from '../layer';
|
|
6
|
-
import { Route } from '../route';
|
|
7
|
-
import { DispatcherMeta, Path } from '../type';
|
|
8
|
-
import { RouterOptions } from './type';
|
|
9
|
-
export declare function isRouterInstance(input: unknown): input is Router;
|
|
10
|
-
export declare class Router {
|
|
11
|
-
readonly '@instanceof': symbol;
|
|
12
|
-
/**
|
|
13
|
-
* Array of mounted layers, routes & routers.
|
|
14
|
-
*
|
|
15
|
-
* @protected
|
|
16
|
-
*/
|
|
17
|
-
protected stack: (Router | Route | Layer)[];
|
|
18
|
-
/**
|
|
19
|
-
* Mount path of instance
|
|
20
|
-
*
|
|
21
|
-
* @protected
|
|
22
|
-
*/
|
|
23
|
-
protected path: Path | undefined;
|
|
24
|
-
/**
|
|
25
|
-
* Path matcher for the current mount path.
|
|
26
|
-
*
|
|
27
|
-
* @protected
|
|
28
|
-
*/
|
|
29
|
-
protected pathMatcher: PathMatcher | undefined;
|
|
30
|
-
/**
|
|
31
|
-
* Path matcher options.
|
|
32
|
-
*
|
|
33
|
-
* @protected
|
|
34
|
-
*/
|
|
35
|
-
protected pathMatcherOptions: PathMatcherOptions;
|
|
36
|
-
/**
|
|
37
|
-
* Is this the root instance?
|
|
38
|
-
*
|
|
39
|
-
* @protected
|
|
40
|
-
*/
|
|
41
|
-
protected isRoot: boolean | undefined;
|
|
42
|
-
/**
|
|
43
|
-
* Timeout before the router decides to abort the request.
|
|
44
|
-
*
|
|
45
|
-
* @protected
|
|
46
|
-
*/
|
|
47
|
-
protected timeout: number | undefined;
|
|
48
|
-
constructor(ctx?: RouterOptions);
|
|
49
|
-
setPathMatcherOptions(input: PathMatcherOptions): void;
|
|
50
|
-
setPath(value: Path): void;
|
|
51
|
-
createListener(): RequestListener;
|
|
52
|
-
listen(port: number): import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>;
|
|
53
|
-
matchPath(path: string): boolean;
|
|
54
|
-
dispatch(req: Request, res: Response, meta?: DispatcherMeta, done?: Next): void;
|
|
55
|
-
dispatchAsync(req: Request, res: Response): Promise<void>;
|
|
56
|
-
route(path: Path): Route;
|
|
57
|
-
delete(path: Path, ...handlers: Handler[]): this;
|
|
58
|
-
get(path: Path, ...handlers: Handler[]): this;
|
|
59
|
-
post(path: Path, ...handlers: Handler[]): this;
|
|
60
|
-
put(path: Path, ...handlers: Handler[]): this;
|
|
61
|
-
patch(path: Path, ...handlers: Handler[]): this;
|
|
62
|
-
head(path: Path, ...handlers: Handler[]): this;
|
|
63
|
-
options(path: Path, ...handlers: Handler[]): this;
|
|
64
|
-
use(router: Router): this;
|
|
65
|
-
use(handler: Handler): this;
|
|
66
|
-
use(handler: ErrorHandler): this;
|
|
67
|
-
use(path: Path, router: Router): this;
|
|
68
|
-
use(path: Path, handler: Handler): this;
|
|
69
|
-
use(path: Path, handler: ErrorHandler): this;
|
|
70
|
-
}
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { RequestListener } from 'node:http';
|
|
3
|
+
import { ErrorHandler, Handler, Next, Request, Response } from '@routup/core';
|
|
4
|
+
import { PathMatcher, PathMatcherOptions } from '../path';
|
|
5
|
+
import { Layer } from '../layer';
|
|
6
|
+
import { Route } from '../route';
|
|
7
|
+
import { DispatcherMeta, Path } from '../type';
|
|
8
|
+
import { RouterOptions } from './type';
|
|
9
|
+
export declare function isRouterInstance(input: unknown): input is Router;
|
|
10
|
+
export declare class Router {
|
|
11
|
+
readonly '@instanceof': symbol;
|
|
12
|
+
/**
|
|
13
|
+
* Array of mounted layers, routes & routers.
|
|
14
|
+
*
|
|
15
|
+
* @protected
|
|
16
|
+
*/
|
|
17
|
+
protected stack: (Router | Route | Layer)[];
|
|
18
|
+
/**
|
|
19
|
+
* Mount path of instance
|
|
20
|
+
*
|
|
21
|
+
* @protected
|
|
22
|
+
*/
|
|
23
|
+
protected path: Path | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Path matcher for the current mount path.
|
|
26
|
+
*
|
|
27
|
+
* @protected
|
|
28
|
+
*/
|
|
29
|
+
protected pathMatcher: PathMatcher | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Path matcher options.
|
|
32
|
+
*
|
|
33
|
+
* @protected
|
|
34
|
+
*/
|
|
35
|
+
protected pathMatcherOptions: PathMatcherOptions;
|
|
36
|
+
/**
|
|
37
|
+
* Is this the root instance?
|
|
38
|
+
*
|
|
39
|
+
* @protected
|
|
40
|
+
*/
|
|
41
|
+
protected isRoot: boolean | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Timeout before the router decides to abort the request.
|
|
44
|
+
*
|
|
45
|
+
* @protected
|
|
46
|
+
*/
|
|
47
|
+
protected timeout: number | undefined;
|
|
48
|
+
constructor(ctx?: RouterOptions);
|
|
49
|
+
setPathMatcherOptions(input: PathMatcherOptions): void;
|
|
50
|
+
setPath(value: Path): void;
|
|
51
|
+
createListener(): RequestListener;
|
|
52
|
+
listen(port: number): import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>;
|
|
53
|
+
matchPath(path: string): boolean;
|
|
54
|
+
dispatch(req: Request, res: Response, meta?: DispatcherMeta, done?: Next): void;
|
|
55
|
+
dispatchAsync(req: Request, res: Response): Promise<void>;
|
|
56
|
+
route(path: Path): Route;
|
|
57
|
+
delete(path: Path, ...handlers: Handler[]): this;
|
|
58
|
+
get(path: Path, ...handlers: Handler[]): this;
|
|
59
|
+
post(path: Path, ...handlers: Handler[]): this;
|
|
60
|
+
put(path: Path, ...handlers: Handler[]): this;
|
|
61
|
+
patch(path: Path, ...handlers: Handler[]): this;
|
|
62
|
+
head(path: Path, ...handlers: Handler[]): this;
|
|
63
|
+
options(path: Path, ...handlers: Handler[]): this;
|
|
64
|
+
use(router: Router): this;
|
|
65
|
+
use(handler: Handler): this;
|
|
66
|
+
use(handler: ErrorHandler): this;
|
|
67
|
+
use(path: Path, router: Router): this;
|
|
68
|
+
use(path: Path, handler: Handler): this;
|
|
69
|
+
use(path: Path, handler: ErrorHandler): this;
|
|
70
|
+
}
|
|
71
71
|
//# sourceMappingURL=module.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/router/module.ts"],"names":[],"mappings":";AAWA,OAAO,EAAE,eAAe,EAAgB,MAAM,
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/router/module.ts"],"names":[],"mappings":"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"}
|
package/dist/router/type.d.ts
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { PathMatcherOptions } from '../path';
|
|
2
|
-
import { 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
|
-
};
|
|
1
|
+
import { PathMatcherOptions } from '../path';
|
|
2
|
+
import { 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
|
+
};
|
|
25
25
|
//# sourceMappingURL=type.d.ts.map
|
package/dist/type.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export type ObjectLiteral = Record<string, any>;
|
|
2
|
-
export type Path = string | RegExp;
|
|
3
|
-
export type DispatcherMeta = {
|
|
4
|
-
/**
|
|
5
|
-
* Params collected on path.
|
|
6
|
-
*/
|
|
7
|
-
params?: Record<string, any>;
|
|
8
|
-
/**
|
|
9
|
-
* Path to check for the current instance.
|
|
10
|
-
*/
|
|
11
|
-
path?: string;
|
|
12
|
-
mountPath?: string;
|
|
13
|
-
};
|
|
1
|
+
export type ObjectLiteral = Record<string, any>;
|
|
2
|
+
export type Path = string | RegExp;
|
|
3
|
+
export type DispatcherMeta = {
|
|
4
|
+
/**
|
|
5
|
+
* Params collected on path.
|
|
6
|
+
*/
|
|
7
|
+
params?: Record<string, any>;
|
|
8
|
+
/**
|
|
9
|
+
* Path to check for the current instance.
|
|
10
|
+
*/
|
|
11
|
+
path?: string;
|
|
12
|
+
mountPath?: string;
|
|
13
|
+
};
|
|
14
14
|
//# sourceMappingURL=type.d.ts.map
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './is-instance';
|
|
2
|
-
export * from './path';
|
|
3
|
-
export * from './promise';
|
|
4
|
-
export * from './request';
|
|
1
|
+
export * from './is-instance';
|
|
2
|
+
export * from './path';
|
|
3
|
+
export * from './promise';
|
|
4
|
+
export * from './request';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function isInstance(input: unknown, name: string): boolean;
|
|
1
|
+
export declare function isInstance(input: unknown, name: string): boolean;
|
|
2
2
|
//# sourceMappingURL=is-instance.d.ts.map
|
package/dist/utils/path.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Path } from '../type';
|
|
2
|
-
export declare function isPath(input: unknown): input is Path;
|
|
1
|
+
import { Path } from '../type';
|
|
2
|
+
export declare function isPath(input: unknown): input is Path;
|
|
3
3
|
//# sourceMappingURL=path.d.ts.map
|
package/dist/utils/promise.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function isPromise(p: unknown): p is Promise<unknown>;
|
|
1
|
+
export declare function isPromise(p: unknown): p is Promise<unknown>;
|
|
2
2
|
//# sourceMappingURL=promise.d.ts.map
|
package/dist/utils/request.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Next, Response } from '@routup/core';
|
|
2
|
-
export declare function createRequestTimeout(res: Response, timeout: number, done?: Next): void;
|
|
1
|
+
import { Next, Response } from '@routup/core';
|
|
2
|
+
export declare function createRequestTimeout(res: Response, timeout: number, done?: Next): void;
|
|
3
3
|
//# sourceMappingURL=request.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "routup",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Routup is a minimalistic http based routing framework.",
|
|
5
|
-
"
|
|
6
|
-
|
|
5
|
+
"exports": {
|
|
6
|
+
"./package.json": "./package.json",
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"import": "./dist/index.mjs",
|
|
10
|
+
"require": "./dist/index.cjs"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"main": "./dist/index.cjs",
|
|
14
|
+
"module": "./dist/index.mjs",
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
7
16
|
"files": [
|
|
8
17
|
"dist/"
|
|
9
18
|
],
|
|
10
19
|
"scripts": {
|
|
11
20
|
"build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json",
|
|
12
|
-
"build:js": "
|
|
21
|
+
"build:js": "rollup -c",
|
|
13
22
|
"build": "rimraf ./dist && cross-env NODE_ENV=production npm run build:js && npm run build:types",
|
|
14
23
|
"test": "cross-env NODE_ENV=test jest --config ./test/jest.config.js",
|
|
15
24
|
"test:coverage": "cross-env NODE_ENV=test jest --config ./test/jest.config.js --coverage",
|
|
@@ -49,9 +58,9 @@
|
|
|
49
58
|
"smob": "^0.0.7"
|
|
50
59
|
},
|
|
51
60
|
"devDependencies": {
|
|
52
|
-
"@routup/core": "^0.
|
|
61
|
+
"@routup/core": "^0.7.0",
|
|
53
62
|
"@types/supertest": "^2.0.12",
|
|
54
63
|
"supertest": "^6.3.3"
|
|
55
64
|
},
|
|
56
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "47afe964634e822705d3a22d59b5910bcf9bb1d0"
|
|
57
66
|
}
|
package/dist/handler/index.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2022.
|
|
3
|
-
* Author Peter Placzek (tada5hi)
|
|
4
|
-
* For the full copyright and license information,
|
|
5
|
-
* view the LICENSE file that was distributed with this source code.
|
|
6
|
-
*/ "use strict";
|
|
7
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
_exportStar(require("./utils"), exports);
|
|
11
|
-
function _exportStar(from, to) {
|
|
12
|
-
Object.keys(from).forEach(function(k) {
|
|
13
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function() {
|
|
16
|
-
return from[k];
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
return from;
|
|
21
|
-
}
|
package/dist/handler/utils.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2022-2022.
|
|
3
|
-
* Author Peter Placzek (tada5hi)
|
|
4
|
-
* For the full copyright and license information,
|
|
5
|
-
* view the LICENSE file that was distributed with this source code.
|
|
6
|
-
*/ "use strict";
|
|
7
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
Object.defineProperty(exports, "processHandlerExecutionOutput", {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: ()=>processHandlerExecutionOutput
|
|
13
|
-
});
|
|
14
|
-
const _core = require("@routup/core");
|
|
15
|
-
const _utils = require("../utils");
|
|
16
|
-
function processHandlerExecutionOutput(res, next, output) {
|
|
17
|
-
if ((0, _utils.isPromise)(output)) {
|
|
18
|
-
output.then((r)=>{
|
|
19
|
-
if (typeof r !== 'undefined') {
|
|
20
|
-
(0, _core.send)(res, r);
|
|
21
|
-
}
|
|
22
|
-
return r;
|
|
23
|
-
}).catch(next);
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
if (typeof output !== 'undefined') {
|
|
27
|
-
(0, _core.send)(res, output);
|
|
28
|
-
}
|
|
29
|
-
}
|
package/dist/index.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2022.
|
|
3
|
-
* Author Peter Placzek (tada5hi)
|
|
4
|
-
* For the full copyright and license information,
|
|
5
|
-
* view the LICENSE file that was distributed with this source code.
|
|
6
|
-
*/ "use strict";
|
|
7
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
_exportStar(require("./handler"), exports);
|
|
11
|
-
_exportStar(require("./layer"), exports);
|
|
12
|
-
_exportStar(require("./path"), exports);
|
|
13
|
-
_exportStar(require("./route"), exports);
|
|
14
|
-
_exportStar(require("./router"), exports);
|
|
15
|
-
_exportStar(require("./type"), exports);
|
|
16
|
-
_exportStar(require("./utils"), exports);
|
|
17
|
-
_exportStar(require("@routup/core"), exports);
|
|
18
|
-
function _exportStar(from, to) {
|
|
19
|
-
Object.keys(from).forEach(function(k) {
|
|
20
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
get: function() {
|
|
23
|
-
return from[k];
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
return from;
|
|
28
|
-
}
|
package/dist/layer/index.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2022.
|
|
3
|
-
* Author Peter Placzek (tada5hi)
|
|
4
|
-
* For the full copyright and license information,
|
|
5
|
-
* view the LICENSE file that was distributed with this source code.
|
|
6
|
-
*/ "use strict";
|
|
7
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
_exportStar(require("./module"), exports);
|
|
11
|
-
_exportStar(require("./type"), exports);
|
|
12
|
-
_exportStar(require("./utils"), exports);
|
|
13
|
-
function _exportStar(from, to) {
|
|
14
|
-
Object.keys(from).forEach(function(k) {
|
|
15
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
|
|
16
|
-
enumerable: true,
|
|
17
|
-
get: function() {
|
|
18
|
-
return from[k];
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
return from;
|
|
23
|
-
}
|