routup 0.12.0 → 0.13.1

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.
Files changed (66) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +11 -10
  3. package/dist/handler/index.d.ts +1 -1
  4. package/dist/handler/utils.d.ts +2 -2
  5. package/dist/handler/utils.d.ts.map +1 -1
  6. package/dist/index.cjs +579 -0
  7. package/dist/index.cjs.map +1 -0
  8. package/dist/index.d.ts +8 -8
  9. package/dist/index.mjs +561 -0
  10. package/dist/index.mjs.map +1 -0
  11. package/dist/layer/index.d.ts +3 -3
  12. package/dist/layer/module.d.ts +15 -15
  13. package/dist/layer/module.d.ts.map +1 -1
  14. package/dist/layer/type.d.ts +6 -6
  15. package/dist/layer/type.d.ts.map +1 -1
  16. package/dist/layer/utils.d.ts +2 -2
  17. package/dist/layer/utils.d.ts.map +1 -1
  18. package/dist/path/index.d.ts +2 -2
  19. package/dist/path/matcher.d.ts +12 -12
  20. package/dist/path/matcher.d.ts.map +1 -1
  21. package/dist/path/type.d.ts +6 -6
  22. package/dist/path/type.d.ts.map +1 -1
  23. package/dist/route/index.d.ts +3 -3
  24. package/dist/route/module.d.ts +28 -26
  25. package/dist/route/module.d.ts.map +1 -1
  26. package/dist/route/type.d.ts +6 -6
  27. package/dist/route/type.d.ts.map +1 -1
  28. package/dist/route/utils.d.ts +2 -2
  29. package/dist/route/utils.d.ts.map +1 -1
  30. package/dist/router/index.d.ts +2 -2
  31. package/dist/router/module.d.ts +71 -70
  32. package/dist/router/module.d.ts.map +1 -1
  33. package/dist/router/type.d.ts +24 -24
  34. package/dist/router/type.d.ts.map +1 -1
  35. package/dist/type.d.ts +13 -13
  36. package/dist/utils/index.d.ts +4 -4
  37. package/dist/utils/is-instance.d.ts +1 -1
  38. package/dist/utils/path.d.ts +2 -2
  39. package/dist/utils/path.d.ts.map +1 -1
  40. package/dist/utils/promise.d.ts +1 -1
  41. package/dist/utils/request.d.ts +2 -2
  42. package/dist/utils/request.d.ts.map +1 -1
  43. package/package.json +17 -8
  44. package/dist/handler/index.js +0 -21
  45. package/dist/handler/utils.js +0 -29
  46. package/dist/index.js +0 -28
  47. package/dist/layer/index.js +0 -23
  48. package/dist/layer/module.js +0 -74
  49. package/dist/layer/type.js +0 -9
  50. package/dist/layer/utils.js +0 -17
  51. package/dist/path/index.js +0 -22
  52. package/dist/path/matcher.js +0 -74
  53. package/dist/path/type.js +0 -9
  54. package/dist/route/index.js +0 -23
  55. package/dist/route/module.js +0 -135
  56. package/dist/route/type.js +0 -9
  57. package/dist/route/utils.js +0 -17
  58. package/dist/router/index.js +0 -22
  59. package/dist/router/module.js +0 -294
  60. package/dist/router/type.js +0 -9
  61. package/dist/type.js +0 -9
  62. package/dist/utils/index.js +0 -24
  63. package/dist/utils/is-instance.js +0 -16
  64. package/dist/utils/path.js +0 -16
  65. package/dist/utils/promise.js +0 -19
  66. package/dist/utils/request.js +0 -33
@@ -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 type { Request, Response } from '@routup/core';
2
+ import { PathMatcher } from '../path';
3
+ import type { DispatcherMeta } from '../type';
4
+ import type { 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
@@ -1 +1 @@
1
- {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/layer/module.ts"],"names":[],"mappings":"AAQA,OAAO,EACG,OAAO,EAAE,QAAQ,EAC1B,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EACH,cAAc,EACjB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,qBAAa,KAAK;IACd,QAAQ,CAAC,aAAa,SAAuB;IAE7C,SAAS,CAAC,EAAE,EAAG,gBAAgB,CAAC;IAEhC,SAAS,CAAC,WAAW,EAAG,WAAW,CAAC;gBAKhC,OAAO,EAAE,YAAY,EACrB,EAAE,EAAE,gBAAgB;IAQxB,OAAO;IAMP,QAAQ,CACJ,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,gBAAgB,GACtB,IAAI;IAER,QAAQ,CACJ,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,gBAAgB,EACtB,GAAG,EAAE,KAAK,GACV,IAAI;IA6DR,SAAS,CAAC,IAAI,EAAE,MAAM,GAAI,OAAO;IAIjC,IAAI,CAAC,IAAI,EAAE,MAAM;CAGpB"}
1
+ {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/layer/module.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAQ,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAG5D,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,KAAK,EACR,cAAc,EACjB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAE3C,qBAAa,KAAK;IACd,QAAQ,CAAC,aAAa,SAAuB;IAE7C,SAAS,CAAC,EAAE,EAAG,gBAAgB,CAAC;IAEhC,SAAS,CAAC,WAAW,EAAG,WAAW,CAAC;gBAKhC,OAAO,EAAE,YAAY,EACrB,EAAE,EAAE,gBAAgB;IAQxB,OAAO;IAMP,QAAQ,CACJ,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,gBAAgB,GACtB,IAAI;IAER,QAAQ,CACJ,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,gBAAgB,EACtB,GAAG,EAAE,KAAK,GACV,IAAI;IA6DR,SAAS,CAAC,IAAI,EAAE,MAAM,GAAI,OAAO;IAIjC,IAAI,CAAC,IAAI,EAAE,MAAM;CAGpB"}
@@ -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 type { PathMatcherOptions } from '../path';
2
+ import type { Path } from '../type';
3
+ export type LayerOptions = {
4
+ path: Path;
5
+ pathMatcher: PathMatcherOptions;
6
+ };
7
7
  //# sourceMappingURL=type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/layer/type.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,MAAM,MAAM,YAAY,GAAG;IACvB,IAAI,EAAE,IAAI,CAAC;IAEX,WAAW,EAAE,kBAAkB,CAAA;CAClC,CAAC"}
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/layer/type.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpC,MAAM,MAAM,YAAY,GAAG;IACvB,IAAI,EAAE,IAAI,CAAC;IAEX,WAAW,EAAE,kBAAkB,CAAA;CAClC,CAAC"}
@@ -1,3 +1,3 @@
1
- import { Layer } from './module';
2
- export declare function isLayerInstance(input: unknown): input is Layer;
1
+ import type { Layer } from './module';
2
+ export declare function isLayerInstance(input: unknown): input is Layer;
3
3
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/layer/utils.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAI,KAAK,IAAI,KAAK,CAE/D"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/layer/utils.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEtC,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAI,KAAK,IAAI,KAAK,CAE/D"}
@@ -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
@@ -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 type { Key } from 'path-to-regexp';
2
+ import type { Path } from '../type';
3
+ import type { 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
@@ -1 +1 @@
1
- {"version":3,"file":"matcher.d.ts","sourceRoot":"","sources":["../../src/path/matcher.ts"],"names":[],"mappings":"AAOA,OAAO,EACH,GAAG,EACN,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAWnE,qBAAa,WAAW;IACpB,IAAI,EAAE,IAAI,CAAC;IAEX,MAAM,EAAG,MAAM,CAAC;IAEhB,UAAU,EAAG,GAAG,EAAE,CAAM;IAExB,aAAa,EAAE,kBAAkB,CAAC;gBAEtB,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,kBAAkB;IAWpD,IAAI,CAAC,IAAI,EAAE,MAAM;IASjB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAI,qBAAqB,GAAG,SAAS;CA2CzD"}
1
+ {"version":3,"file":"matcher.d.ts","sourceRoot":"","sources":["../../src/path/matcher.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,KAAK,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAWxE,qBAAa,WAAW;IACpB,IAAI,EAAE,IAAI,CAAC;IAEX,MAAM,EAAG,MAAM,CAAC;IAEhB,UAAU,EAAG,GAAG,EAAE,CAAM;IAExB,aAAa,EAAE,kBAAkB,CAAC;gBAEtB,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,kBAAkB;IAWpD,IAAI,CAAC,IAAI,EAAE,MAAM;IASjB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAI,qBAAqB,GAAG,SAAS;CA2CzD"}
@@ -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 type { 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
@@ -1 +1 @@
1
- {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/path/type.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAErE,MAAM,MAAM,kBAAkB,GAAG,qBAAqB,GAAG,YAAY,CAAC;AAEtE,MAAM,MAAM,qBAAqB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAC9B,CAAC"}
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/path/type.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAE1E,MAAM,MAAM,kBAAkB,GAAG,qBAAqB,GAAG,YAAY,CAAC;AAEtE,MAAM,MAAM,qBAAqB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAC9B,CAAC"}
@@ -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
@@ -1,27 +1,29 @@
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 type { Handler, Next, Request, Response } from '@routup/core';
2
+ import { Method } from '@routup/core';
3
+ import { Layer } from '../layer';
4
+ import type { PathMatcherOptions } from '../path';
5
+ import { PathMatcher } from '../path';
6
+ import type { DispatcherMeta, Path } from '../type';
7
+ import type { RouteOptions } from './type';
8
+ export declare class Route {
9
+ readonly '@instanceof': symbol;
10
+ path: Path;
11
+ protected pathMatcher: PathMatcher;
12
+ protected pathMatcherOptions: PathMatcherOptions;
13
+ protected layers: Record<string, Layer[]>;
14
+ constructor(options: RouteOptions);
15
+ matchPath(path: string): boolean;
16
+ matchMethod(method: string): boolean;
17
+ getMethods(): string[];
18
+ dispatch(req: Request, res: Response, meta: DispatcherMeta, done: Next): void;
19
+ register(method: `${Method}`, ...handlers: Handler[]): void;
20
+ get(...handlers: Handler[]): void;
21
+ post(...handlers: Handler[]): void;
22
+ put(...handlers: Handler[]): void;
23
+ patch(...handlers: Handler[]): void;
24
+ delete(...handlers: Handler[]): void;
25
+ head(...handlers: Handler[]): void;
26
+ options(...handlers: Handler[]): void;
27
+ private isStrictPath;
28
+ }
27
29
  //# sourceMappingURL=module.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/route/module.ts"],"names":[],"mappings":"AAQA,OAAO,EACH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAC3C,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EACH,cAAc,EACd,IAAI,EACP,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,qBAAa,KAAK;IACd,QAAQ,CAAC,aAAa,SAAuB;IAEtC,IAAI,EAAG,IAAI,CAAC;IAEnB,SAAS,CAAC,WAAW,EAAG,WAAW,CAAC;IAEpC,SAAS,CAAC,kBAAkB,EAAG,kBAAkB,CAAC;IAElD,SAAS,CAAC,MAAM,EAAG,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,CAAM;gBAIpC,OAAO,EAAE,YAAY;IAajC,SAAS,CAAC,IAAI,EAAE,MAAM,GAAI,OAAO;IAIjC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAI,OAAO;IAerC,UAAU,IAAK,MAAM,EAAE;IAevB,QAAQ,CACJ,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,IAAI,GACV,IAAI;IAiER,QAAQ,CAAC,MAAM,EAAE,GAAG,MAAM,E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AAO;IAIjC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAI,OAAO;IAerC,UAAU,IAAK,MAAM,EAAE;IAevB,QAAQ,CACJ,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,IAAI,GACV,IAAI;IAiER,QAAQ,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,QAAQ,EAAE,OAAO,EAAE;IAgBpD,GAAG,CAAC,GAAG,QAAQ,EAAE,OAAO,EAAE;IAI1B,IAAI,CAAC,GAAG,QAAQ,EAAE,OAAO,EAAE;IAI3B,GAAG,CAAC,GAAG,QAAQ,EAAE,OAAO,EAAE;IAI1B,KAAK,CAAC,GAAG,QAAQ,EAAE,OAAO,EAAE;IAI5B,MAAM,CAAC,GAAG,QAAQ,EAAE,OAAO,EAAE;IAI7B,IAAI,CAAC,GAAG,QAAQ,EAAE,OAAO,EAAE;IAI3B,OAAO,CAAC,GAAG,QAAQ,EAAE,OAAO,EAAE;IAM9B,OAAO,CAAC,YAAY;CAIvB"}
@@ -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 type { ParseOptions, TokensToRegexpOptions } from 'path-to-regexp';
2
+ import type { Path } from '../type';
3
+ export type RouteOptions = {
4
+ path: Path;
5
+ pathMatcher: TokensToRegexpOptions & ParseOptions;
6
+ };
7
7
  //# sourceMappingURL=type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/route/type.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,MAAM,MAAM,YAAY,GAAG;IACvB,IAAI,EAAE,IAAI,CAAC;IAEX,WAAW,EAAE,qBAAqB,GAAG,YAAY,CAAA;CACpD,CAAC"}
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/route/type.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAC1E,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpC,MAAM,MAAM,YAAY,GAAG;IACvB,IAAI,EAAE,IAAI,CAAC;IAEX,WAAW,EAAE,qBAAqB,GAAG,YAAY,CAAA;CACpD,CAAC"}
@@ -1,3 +1,3 @@
1
- import { Route } from './module';
2
- export declare function isRouteInstance(input: unknown): input is Route;
1
+ import type { Route } from './module';
2
+ export declare function isRouteInstance(input: unknown): input is Route;
3
3
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/route/utils.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAI,KAAK,IAAI,KAAK,CAE/D"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/route/utils.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEtC,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAI,KAAK,IAAI,KAAK,CAE/D"}
@@ -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
@@ -1,71 +1,72 @@
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 type { RequestListener } from 'node:http';
3
+ import type { ErrorHandler, Handler, Next, Request, Response } from '@routup/core';
4
+ import type { PathMatcherOptions } from '../path';
5
+ import { PathMatcher } from '../path';
6
+ import { Layer } from '../layer';
7
+ import { Route } from '../route';
8
+ import type { DispatcherMeta, Path } from '../type';
9
+ import type { RouterOptions } from './type';
10
+ export declare function isRouterInstance(input: unknown): input is Router;
11
+ export declare class Router {
12
+ readonly '@instanceof': symbol;
13
+ /**
14
+ * Array of mounted layers, routes & routers.
15
+ *
16
+ * @protected
17
+ */
18
+ protected stack: (Router | Route | Layer)[];
19
+ /**
20
+ * Mount path of instance
21
+ *
22
+ * @protected
23
+ */
24
+ protected path: Path | undefined;
25
+ /**
26
+ * Path matcher for the current mount path.
27
+ *
28
+ * @protected
29
+ */
30
+ protected pathMatcher: PathMatcher | undefined;
31
+ /**
32
+ * Path matcher options.
33
+ *
34
+ * @protected
35
+ */
36
+ protected pathMatcherOptions: PathMatcherOptions;
37
+ /**
38
+ * Is this the root instance?
39
+ *
40
+ * @protected
41
+ */
42
+ protected isRoot: boolean | undefined;
43
+ /**
44
+ * Timeout before the router decides to abort the request.
45
+ *
46
+ * @protected
47
+ */
48
+ protected timeout: number | undefined;
49
+ constructor(ctx?: RouterOptions);
50
+ setPathMatcherOptions(input: PathMatcherOptions): void;
51
+ setPath(value: Path): void;
52
+ createListener(): RequestListener;
53
+ listen(port: number): import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>;
54
+ matchPath(path: string): boolean;
55
+ dispatch(req: Request, res: Response, meta?: DispatcherMeta, done?: Next): void;
56
+ dispatchAsync(req: Request, res: Response): Promise<void>;
57
+ route(path: Path): Route;
58
+ delete(path: Path, ...handlers: Handler[]): this;
59
+ get(path: Path, ...handlers: Handler[]): this;
60
+ post(path: Path, ...handlers: Handler[]): this;
61
+ put(path: Path, ...handlers: Handler[]): this;
62
+ patch(path: Path, ...handlers: Handler[]): this;
63
+ head(path: Path, ...handlers: Handler[]): this;
64
+ options(path: Path, ...handlers: Handler[]): this;
65
+ use(router: Router): this;
66
+ use(handler: Handler): this;
67
+ use(handler: ErrorHandler): this;
68
+ use(path: Path, router: Router): this;
69
+ use(path: Path, handler: Handler): this;
70
+ use(path: Path, handler: ErrorHandler): this;
71
+ }
71
72
  //# 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,MAAM,CAAC;AAErD,OAAO,EACH,YAAY,EACZ,OAAO,EAGP,IAAI,EACJ,OAAO,EACP,QAAQ,EAMX,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAO1D,OAAO,EAAE,KAAK,EAAmB,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,KAAK,EAAmB,MAAM,UAAU,CAAC;AAClD,OAAO,EACH,cAAc,EACd,IAAI,EACP,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAI,KAAK,IAAI,MAAM,CAEjE;AAED,qBAAa,MAAM;IACf,QAAQ,CAAC,aAAa,SAAwB;IAE9C;;;;OAIG;IACH,SAAS,CAAC,KAAK,EAAG,CAAC,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC,EAAE,CAAM;IAElD;;;;OAIG;IACH,SAAS,CAAC,IAAI,EAAG,IAAI,GAAG,SAAS,CAAC;IAElC;;;;OAIG;IACH,SAAS,CAAC,WAAW,EAAG,WAAW,GAAG,SAAS,CAAC;IAEhD;;;;OAIG;IACH,SAAS,CAAC,kBAAkB,EAAG,kBAAkB,CAAC;IAElD;;;;OAIG;IACH,SAAS,CAAC,MAAM,EAAG,OAAO,GAAG,SAAS,CAAC;IAEvC;;;;OAIG;IACH,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;gBA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AAG,CAAC,MAAM,EAAE,MAAM,GAAI,IAAI;IAE1B,GAAG,CAAC,OAAO,EAAE,OAAO,GAAI,IAAI;IAE5B,GAAG,CAAC,OAAO,EAAE,YAAY,GAAI,IAAI;IAEjC,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAI,IAAI;IAEtC,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,GAAI,IAAI;IAExC,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,GAAI,IAAI;CAuChD"}
@@ -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 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
+ };
25
25
  //# sourceMappingURL=type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/router/type.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,MAAM,MAAM,aAAa,GAAG;IACxB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,IAAI,CAAC;IAEZ;;;;OAIG;IACH,WAAW,CAAC,EAAE,kBAAkB,CAAA;IAEhC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC"}
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/router/type.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpC,MAAM,MAAM,aAAa,GAAG;IACxB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,IAAI,CAAC;IAEZ;;;;OAIG;IACH,WAAW,CAAC,EAAE,kBAAkB,CAAA;IAEhC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC"}
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
@@ -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
@@ -1,3 +1,3 @@
1
- import { Path } from '../type';
2
- export declare function isPath(input: unknown): input is Path;
1
+ import type { Path } from '../type';
2
+ export declare function isPath(input: unknown): input is Path;
3
3
  //# sourceMappingURL=path.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../src/utils/path.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAI,KAAK,IAAI,IAAI,CAErD"}
1
+ {"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../src/utils/path.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpC,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAI,KAAK,IAAI,IAAI,CAErD"}
@@ -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
@@ -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 type { Next, Response } from '@routup/core';
2
+ export declare function createRequestTimeout(res: Response, timeout: number, done?: Next): void;
3
3
  //# sourceMappingURL=request.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/utils/request.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAG9C,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,IAAI,QAuB/E"}
1
+ {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/utils/request.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAGnD,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,IAAI,QAuB/E"}
package/package.json CHANGED
@@ -1,15 +1,24 @@
1
1
  {
2
2
  "name": "routup",
3
- "version": "0.12.0",
3
+ "version": "0.13.1",
4
4
  "description": "Routup is a minimalistic http based routing framework.",
5
- "main": "dist/index.js",
6
- "typings": "dist/index.d.ts",
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": "npx swc ./src -d dist --config-file ../../.swcrc.json",
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",
@@ -44,14 +53,14 @@
44
53
  "@routup/core": ">=0.6.0 <1.0.0"
45
54
  },
46
55
  "dependencies": {
47
- "@ebec/http": "^0.1.0",
56
+ "@ebec/http": "^0.2.2",
48
57
  "path-to-regexp": "^6.2.1",
49
- "smob": "^0.0.7"
58
+ "smob": "^0.1.0"
50
59
  },
51
60
  "devDependencies": {
52
- "@routup/core": "^0.6.0",
61
+ "@routup/core": "^0.7.1",
53
62
  "@types/supertest": "^2.0.12",
54
63
  "supertest": "^6.3.3"
55
64
  },
56
- "gitHead": "9b1e92db85376e9d8bd24fe0b30531b1932a6a26"
65
+ "gitHead": "37a5962f64df5d5bc8c83926be8411360634052d"
57
66
  }
@@ -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
- }