routup 3.0.0-alpha.3 → 3.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.
@@ -1,16 +1,11 @@
1
1
  import type { Path } from '../path';
2
2
  import type { Router } from '../router';
3
- export type PluginOptions = Record<string | symbol, any>;
4
3
  export type PluginInstallFn = (router: Router) => any;
5
4
  export type Plugin = {
6
5
  /**
7
6
  * The name of the plugin.
8
7
  */
9
8
  name: string;
10
- /**
11
- * The supported routup (semver) version.
12
- */
13
- version?: string;
14
9
  /**
15
10
  * The installation function called on registration.
16
11
  */
@@ -1,3 +1,4 @@
1
+ import { MethodName } from '../constants';
1
2
  import type { Dispatcher, DispatcherEvent, DispatcherMeta } from '../dispatcher';
2
3
  import type { Handler } from '../handler';
3
4
  import { Layer } from '../layer';
@@ -31,25 +32,26 @@ export declare class Router implements Dispatcher {
31
32
  setPath(value?: Path): void;
32
33
  matchPath(path: string): boolean;
33
34
  dispatch(event: DispatcherEvent, meta: DispatcherMeta): Promise<boolean>;
34
- delete(handler: Handler): this;
35
- delete(path: Path, handler: Handler): this;
36
- get(handler: Handler): this;
37
- get(path: Path, handler: Handler): this;
38
- post(handler: Handler): this;
39
- post(path: Path, handler: Handler): this;
40
- put(handler: Handler): this;
41
- put(path: Path, handler: Handler): this;
42
- patch(handler: Handler): this;
43
- patch(path: Path, handler: Handler): this;
44
- head(handler: Handler): this;
45
- head(path: Path, handler: Handler): this;
46
- options(handler: Handler): this;
47
- options(path: Path, handler: Handler): this;
35
+ delete(...handlers: Handler[]): this;
36
+ delete(path: Path, ...handlers: Handler[]): this;
37
+ get(...handlers: Handler[]): this;
38
+ get(path: Path, ...handlers: Handler[]): this;
39
+ post(...handlers: Handler[]): this;
40
+ post(path: Path, ...handlers: Handler[]): this;
41
+ put(...handlers: Handler[]): this;
42
+ put(path: Path, ...handlers: Handler[]): this;
43
+ patch(...handlers: Handler[]): this;
44
+ patch(path: Path, ...handlers: Handler[]): this;
45
+ head(...handlers: Handler[]): this;
46
+ head(path: Path, ...handlers: Handler[]): this;
47
+ options(...handlers: Handler[]): this;
48
+ options(path: Path, ...handlers: Handler[]): this;
49
+ protected useForMethod(method: `${MethodName}`, ...input: (Path | Handler)[]): void;
48
50
  use(router: Router): this;
49
51
  use(handler: Handler): this;
50
52
  use(plugin: Plugin): this;
51
53
  use(path: Path, router: Router): this;
52
54
  use(path: Path, handler: Handler): this;
53
55
  use(path: Path, plugin: Plugin): this;
54
- install(plugin: Plugin, context?: PluginInstallContext): this;
56
+ protected install(plugin: Plugin, context?: PluginInstallContext): this;
55
57
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "routup",
3
- "version": "3.0.0-alpha.3",
3
+ "version": "3.0.0",
4
4
  "description": "Routup is a minimalistic http based routing framework.",
5
5
  "exports": {
6
6
  "./package.json": "./package.json",
@@ -50,7 +50,7 @@
50
50
  },
51
51
  "homepage": "https://github.com/routup/routup#readme",
52
52
  "dependencies": {
53
- "@ebec/http": "^2.2.1",
53
+ "@ebec/http": "^2.2.2",
54
54
  "buffer": "^6.0.3",
55
55
  "mime-explorer": "^1.0.0",
56
56
  "negotiator": "^0.6.3",
@@ -63,7 +63,7 @@
63
63
  "devDependencies": {
64
64
  "@rollup/plugin-commonjs": "^25.0.4",
65
65
  "@rollup/plugin-node-resolve": "^15.2.1",
66
- "@swc/core": "^1.3.90",
66
+ "@swc/core": "^1.3.91",
67
67
  "@swc/jest": "^0.2.29",
68
68
  "@tada5hi/commitlint-config": "^1.1.2",
69
69
  "@tada5hi/eslint-config-typescript": "^1.2.5",
@@ -71,10 +71,10 @@
71
71
  "@tada5hi/tsconfig": "^0.5.0",
72
72
  "@types/jest": "^29.5.5",
73
73
  "@types/negotiator": "^0.6.1",
74
- "@types/node": "^20.7.1",
74
+ "@types/node": "^20.8.2",
75
75
  "@types/proxy-addr": "^2.0.1",
76
76
  "@types/readable-stream": "^4.0.3",
77
- "@types/supertest": "^2.0.13",
77
+ "@types/supertest": "^2.0.14",
78
78
  "cross-env": "^7.0.3",
79
79
  "jest": "^29.7.0",
80
80
  "rimraf": "^5.0.5",