@eggjs/core 6.4.1 → 6.6.0-beta.10

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 (87) hide show
  1. package/README.md +23 -27
  2. package/dist/base_context_class.d.ts +21 -0
  3. package/dist/base_context_class.js +40 -0
  4. package/dist/egg.d.ts +248 -0
  5. package/dist/egg.js +358 -0
  6. package/dist/index.d.ts +12 -0
  7. package/dist/index.js +12 -0
  8. package/dist/lifecycle.d.ts +84 -0
  9. package/dist/lifecycle.js +280 -0
  10. package/dist/loader/context_loader.d.ts +39 -0
  11. package/dist/loader/context_loader.js +79 -0
  12. package/dist/loader/egg_loader.d.ts +374 -0
  13. package/dist/loader/egg_loader.js +1184 -0
  14. package/dist/loader/file_loader.d.ts +105 -0
  15. package/dist/loader/file_loader.js +198 -0
  16. package/dist/singleton.d.ts +33 -0
  17. package/dist/singleton.js +107 -0
  18. package/{src/types.ts → dist/types.d.ts} +7 -7
  19. package/dist/utils/index.d.ts +19 -0
  20. package/dist/utils/index.js +103 -0
  21. package/dist/utils/sequencify.d.ts +16 -0
  22. package/dist/utils/sequencify.js +46 -0
  23. package/dist/utils/timing.d.ts +24 -0
  24. package/dist/utils/timing.js +85 -0
  25. package/package.json +39 -65
  26. package/dist/commonjs/base_context_class.d.ts +0 -16
  27. package/dist/commonjs/base_context_class.js +0 -41
  28. package/dist/commonjs/egg.d.ts +0 -247
  29. package/dist/commonjs/egg.js +0 -401
  30. package/dist/commonjs/index.d.ts +0 -12
  31. package/dist/commonjs/index.js +0 -32
  32. package/dist/commonjs/lifecycle.d.ts +0 -78
  33. package/dist/commonjs/lifecycle.js +0 -312
  34. package/dist/commonjs/loader/context_loader.d.ts +0 -35
  35. package/dist/commonjs/loader/context_loader.js +0 -110
  36. package/dist/commonjs/loader/egg_loader.d.ts +0 -369
  37. package/dist/commonjs/loader/egg_loader.js +0 -1543
  38. package/dist/commonjs/loader/file_loader.d.ts +0 -100
  39. package/dist/commonjs/loader/file_loader.js +0 -262
  40. package/dist/commonjs/package.json +0 -3
  41. package/dist/commonjs/singleton.d.ts +0 -29
  42. package/dist/commonjs/singleton.js +0 -125
  43. package/dist/commonjs/types.d.ts +0 -53
  44. package/dist/commonjs/types.js +0 -3
  45. package/dist/commonjs/utils/index.d.ts +0 -17
  46. package/dist/commonjs/utils/index.js +0 -117
  47. package/dist/commonjs/utils/sequencify.d.ts +0 -13
  48. package/dist/commonjs/utils/sequencify.js +0 -59
  49. package/dist/commonjs/utils/timing.d.ts +0 -21
  50. package/dist/commonjs/utils/timing.js +0 -100
  51. package/dist/esm/base_context_class.d.ts +0 -16
  52. package/dist/esm/base_context_class.js +0 -37
  53. package/dist/esm/egg.d.ts +0 -247
  54. package/dist/esm/egg.js +0 -388
  55. package/dist/esm/index.d.ts +0 -12
  56. package/dist/esm/index.js +0 -12
  57. package/dist/esm/lifecycle.d.ts +0 -78
  58. package/dist/esm/lifecycle.js +0 -305
  59. package/dist/esm/loader/context_loader.d.ts +0 -35
  60. package/dist/esm/loader/context_loader.js +0 -102
  61. package/dist/esm/loader/egg_loader.d.ts +0 -369
  62. package/dist/esm/loader/egg_loader.js +0 -1536
  63. package/dist/esm/loader/file_loader.d.ts +0 -100
  64. package/dist/esm/loader/file_loader.js +0 -255
  65. package/dist/esm/package.json +0 -3
  66. package/dist/esm/singleton.d.ts +0 -29
  67. package/dist/esm/singleton.js +0 -118
  68. package/dist/esm/types.d.ts +0 -53
  69. package/dist/esm/types.js +0 -2
  70. package/dist/esm/utils/index.d.ts +0 -17
  71. package/dist/esm/utils/index.js +0 -112
  72. package/dist/esm/utils/sequencify.d.ts +0 -13
  73. package/dist/esm/utils/sequencify.js +0 -56
  74. package/dist/esm/utils/timing.d.ts +0 -21
  75. package/dist/esm/utils/timing.js +0 -93
  76. package/dist/package.json +0 -4
  77. package/src/base_context_class.ts +0 -39
  78. package/src/egg.ts +0 -517
  79. package/src/index.ts +0 -14
  80. package/src/lifecycle.ts +0 -399
  81. package/src/loader/context_loader.ts +0 -121
  82. package/src/loader/egg_loader.ts +0 -1722
  83. package/src/loader/file_loader.ts +0 -308
  84. package/src/singleton.ts +0 -149
  85. package/src/utils/index.ts +0 -125
  86. package/src/utils/sequencify.ts +0 -70
  87. package/src/utils/timing.ts +0 -114
package/README.md CHANGED
@@ -1,16 +1,12 @@
1
1
  # @eggjs/core
2
2
 
3
3
  [![NPM version][npm-image]][npm-url]
4
- [![Node.js CI](https://github.com/eggjs/core/actions/workflows/nodejs.yml/badge.svg)](https://github.com/eggjs/core/actions/workflows/nodejs.yml)
5
- [![Test coverage][codecov-image]][codecov-url]
6
4
  [![Known Vulnerabilities][snyk-image]][snyk-url]
7
5
  [![npm download][download-image]][download-url]
8
6
  [![Node.js Version](https://img.shields.io/node/v/@eggjs/core.svg?style=flat)](https://nodejs.org/en/download/)
9
7
 
10
8
  [npm-image]: https://img.shields.io/npm/v/@eggjs/core.svg?style=flat-square
11
9
  [npm-url]: https://npmjs.org/package/@eggjs/core
12
- [codecov-image]: https://codecov.io/github/eggjs/core/coverage.svg?branch=master
13
- [codecov-url]: https://codecov.io/github/eggjs/core?branch=master
14
10
  [snyk-image]: https://snyk.io/test/npm/@eggjs/core/badge.svg?style=flat-square
15
11
  [snyk-url]: https://snyk.io/test/npm/@eggjs/core
16
12
  [download-image]: https://img.shields.io/npm/dm/@eggjs/core.svg?style=flat-square
@@ -62,7 +58,7 @@ Then you can start with code below
62
58
  import { EggCore as Application } from '@eggjs/core';
63
59
 
64
60
  const app = new Application({
65
- baseDir: '/path/to/app'
61
+ baseDir: '/path/to/app',
66
62
  });
67
63
  app.ready(() => {
68
64
  app.listen(3000);
@@ -140,13 +136,13 @@ Load app/service
140
136
  Retrieve application environment variable values via `serverEnv`.
141
137
  You can access directly by calling `this.serverEnv` after instantiation.
142
138
 
143
- serverEnv | description
144
- --- | ---
145
- default | default environment
146
- test | system integration testing environment
147
- prod | production environment
148
- local | local environment on your own computer
149
- unittest | unit test environment
139
+ | serverEnv | description |
140
+ | --------- | -------------------------------------- |
141
+ | default | default environment |
142
+ | test | system integration testing environment |
143
+ | prod | production environment |
144
+ | local | local environment on your own computer |
145
+ | unittest | unit test environment |
150
146
 
151
147
  #### getEggPaths()
152
148
 
@@ -163,7 +159,7 @@ This function will get add loadUnits follow the order:
163
159
  2. framework
164
160
  3. app
165
161
 
166
- loadUnit has a path and a type. Type must be one of those values: *app*, *framework*, *plugin*.
162
+ loadUnit has a path and a type. Type must be one of those values: _app_, _framework_, _plugin_.
167
163
 
168
164
  ```js
169
165
  {
@@ -174,7 +170,7 @@ loadUnit has a path and a type. Type must be one of those values: *app*, *framew
174
170
 
175
171
  #### getAppname()
176
172
 
177
- To get application name from *package.json*
173
+ To get application name from _package.json_
178
174
 
179
175
  #### appInfo
180
176
 
@@ -228,18 +224,18 @@ await this.loadExtend('application', app);
228
224
 
229
225
  ### LoaderOptions
230
226
 
231
- Param | Type | Description
232
- -------------- | -------------- | ------------------------
233
- directory | `String/Array` | directories to be loaded
234
- target | `Object` | attach the target object from loaded files
235
- match | `String/Array` | match the files when load, default to `**/*.js`(if process.env.EGG_TYPESCRIPT was true, default to `[ '**/*.(js|ts)', '!**/*.d.ts' ]`)
236
- ignore | `String/Array` | ignore the files when load
237
- initializer | `Function` | custom file exports, receive two parameters, first is the inject object(if not js file, will be content buffer), second is an `options` object that contain `path`
238
- caseStyle | `String/Function` | set property's case when converting a filepath to property list.
239
- override | `Boolean` | determine whether override the property when get the same name
240
- call | `Boolean` | determine whether invoke when exports is function
241
- inject | `Object` | an object that be the argument when invoke the function
242
- filter | `Function` | a function that filter the exports which can be loaded
227
+ | Param | Type | Description |
228
+ | ----------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------- |
229
+ | directory | `String/Array` | directories to be loaded |
230
+ | target | `Object` | attach the target object from loaded files |
231
+ | match | `String/Array` | match the files when load, default to `**/*.js`(if process.env.EGG\*TYPESCRIPT was true, default to `[ '\*\*/\_.(js | ts)', '!\*_/_.d.ts' ]`) |
232
+ | ignore | `String/Array` | ignore the files when load |
233
+ | initializer | `Function` | custom file exports, receive two parameters, first is the inject object(if not js file, will be content buffer), second is an `options` object that contain `path` |
234
+ | caseStyle | `String/Function` | set property's case when converting a filepath to property list. |
235
+ | override | `Boolean` | determine whether override the property when get the same name |
236
+ | call | `Boolean` | determine whether invoke when exports is function |
237
+ | inject | `Object` | an object that be the argument when invoke the function |
238
+ | filter | `Function` | a function that filter the exports which can be loaded |
243
239
 
244
240
  ## Timing
245
241
 
@@ -285,7 +281,7 @@ Please open an issue [here](https://github.com/eggjs/egg/issues).
285
281
 
286
282
  ## Contributors
287
283
 
288
- [![Contributors](https://contrib.rocks/image?repo=eggjs/core)](https://github.com/eggjs/core/graphs/contributors)
284
+ [![Contributors](https://contrib.rocks/image?repo=eggjs/egg)](https://github.com/eggjs/egg/graphs/contributors)
289
285
 
290
286
  Made with [contributors-img](https://contrib.rocks).
291
287
 
@@ -0,0 +1,21 @@
1
+ import { Context, EggCore } from "./egg.js";
2
+
3
+ //#region src/base_context_class.d.ts
4
+
5
+ /**
6
+ * BaseContextClass is a base class that can be extended,
7
+ * it's instantiated in context level,
8
+ * {@link Helper}, {@link Service} is extending it.
9
+ */
10
+ declare class BaseContextClass {
11
+ ctx: Context;
12
+ app: EggCore;
13
+ config: Record<string, any>;
14
+ service: BaseContextClass;
15
+ /**
16
+ * @since 1.0.0
17
+ */
18
+ constructor(ctx: Context);
19
+ }
20
+ //#endregion
21
+ export { BaseContextClass };
@@ -0,0 +1,40 @@
1
+ //#region src/base_context_class.ts
2
+ /**
3
+ * BaseContextClass is a base class that can be extended,
4
+ * it's instantiated in context level,
5
+ * {@link Helper}, {@link Service} is extending it.
6
+ */
7
+ var BaseContextClass = class {
8
+ ctx;
9
+ app;
10
+ config;
11
+ service;
12
+ /**
13
+ * @since 1.0.0
14
+ */
15
+ constructor(ctx) {
16
+ /**
17
+ * @member {Context} BaseContextClass#ctx
18
+ * @since 1.0.0
19
+ */
20
+ this.ctx = ctx;
21
+ /**
22
+ * @member {Application} BaseContextClass#app
23
+ * @since 1.0.0
24
+ */
25
+ this.app = ctx.app;
26
+ /**
27
+ * @member {Config} BaseContextClass#config
28
+ * @since 1.0.0
29
+ */
30
+ this.config = ctx.app.config;
31
+ /**
32
+ * @member {Service} BaseContextClass#service
33
+ * @since 1.0.0
34
+ */
35
+ this.service = ctx.service;
36
+ }
37
+ };
38
+
39
+ //#endregion
40
+ export { BaseContextClass };
package/dist/egg.d.ts ADDED
@@ -0,0 +1,248 @@
1
+ import { Fun } from "./utils/index.js";
2
+ import { EggAppConfig, EggPluginInfo } from "./types.js";
3
+ import { BaseContextClass } from "./base_context_class.js";
4
+ import { Timing } from "./utils/timing.js";
5
+ import { Lifecycle } from "./lifecycle.js";
6
+ import { EggLoader } from "./loader/egg_loader.js";
7
+ import { SingletonCreateMethod } from "./singleton.js";
8
+ import { Application as KoaApplication, Context as KoaContext, MiddlewareFunc as KoaMiddlewareFunc, Next, Request as KoaRequest, Response as KoaResponse } from "@eggjs/koa";
9
+ import { EggConsoleLogger, Logger } from "egg-logger";
10
+ import { EggRouter as Router, RegisterOptions, ResourcesController } from "@eggjs/router";
11
+ import { ReadyFunctionArg } from "get-ready";
12
+
13
+ //#region src/egg.d.ts
14
+ declare const EGG_LOADER: unique symbol;
15
+ interface EggCoreOptions {
16
+ baseDir: string;
17
+ type: 'application' | 'agent';
18
+ plugins?: any;
19
+ serverScope?: string;
20
+ env?: string;
21
+ }
22
+ type EggCoreInitOptions = Partial<EggCoreOptions>;
23
+ declare class Request$1 extends KoaRequest {
24
+ app: EggCore;
25
+ response: Response$1;
26
+ }
27
+ declare class Response$1 extends KoaResponse {
28
+ app: EggCore;
29
+ request: Request$1;
30
+ }
31
+ declare class Context$1 extends KoaContext {
32
+ app: EggCore;
33
+ request: Request$1;
34
+ response: Response$1;
35
+ service: BaseContextClass;
36
+ /**
37
+ * Returns map of URL parameters for given `path` and `paramNames`.
38
+ * @example
39
+ * ##### ctx.params.id {string}
40
+ *
41
+ * `GET /api/users/1` => `'1'`
42
+ *
43
+ * ##### ctx.params.per_page {string}
44
+ *
45
+ * The number of every page, `GET /api/users?per_page=20` => `20`
46
+ */
47
+ params?: Record<string, string>;
48
+ /**
49
+ * Returns array of router regexp url path captures.
50
+ */
51
+ captures?: string[];
52
+ /**
53
+ * Returns the name of the matched router.
54
+ */
55
+ routerName?: string;
56
+ /**
57
+ * Returns the path of the matched router.
58
+ */
59
+ routerPath?: string | RegExp;
60
+ }
61
+ type MiddlewareFunc<T extends KoaContext = Context$1> = KoaMiddlewareFunc<T>;
62
+ declare class EggCore extends KoaApplication {
63
+ #private;
64
+ options: EggCoreOptions;
65
+ timing: Timing;
66
+ console: EggConsoleLogger;
67
+ BaseContextClass: typeof BaseContextClass;
68
+ Controller: typeof BaseContextClass;
69
+ Service: typeof BaseContextClass;
70
+ Helper?: typeof BaseContextClass;
71
+ lifecycle: Lifecycle;
72
+ loader: EggLoader;
73
+ /** auto inject on loadService() */
74
+ readonly serviceClasses: Record<string, any>;
75
+ /** auto inject on loadController() */
76
+ readonly controller: Record<string, any>;
77
+ /** auto inject on loadMiddleware() */
78
+ readonly middlewares: Record<string, (opt: unknown, app: EggCore) => MiddlewareFunc>;
79
+ /**
80
+ * @class
81
+ * @param {Object} options - options
82
+ * @param {String} [options.baseDir] - the directory of application
83
+ * @param {String} [options.type] - whether it's running in app worker or agent worker
84
+ * @param {Object} [options.plugins] - custom plugins
85
+ * @since 1.0.0
86
+ */
87
+ constructor(options?: EggCoreInitOptions);
88
+ get logger(): Logger;
89
+ get coreLogger(): Logger;
90
+ /**
91
+ * create a singleton instance
92
+ * @param {String} name - unique name for singleton
93
+ * @param {Function|AsyncFunction} create - method will be invoked when singleton instance create
94
+ */
95
+ addSingleton(name: string, create: SingletonCreateMethod): void;
96
+ /**
97
+ * override koa's app.use, support generator function
98
+ * @since 1.0.0
99
+ */
100
+ use<T extends KoaContext = Context$1>(fn: MiddlewareFunc<T>): this;
101
+ /**
102
+ * Whether `application` or `agent`
103
+ * @member {String}
104
+ * @since 1.0.0
105
+ */
106
+ get type(): "application" | "agent";
107
+ /**
108
+ * The current directory of application
109
+ * @member {String}
110
+ * @see {@link AppInfo#baseDir}
111
+ * @since 1.0.0
112
+ */
113
+ get baseDir(): string;
114
+ /**
115
+ * Alias to {@link https://npmjs.com/package/depd}
116
+ * @member {Function}
117
+ * @since 1.0.0
118
+ */
119
+ get deprecate(): (message: string) => void;
120
+ /**
121
+ * The name of application
122
+ * @member {String}
123
+ * @see {@link AppInfo#name}
124
+ * @since 1.0.0
125
+ */
126
+ get name(): any;
127
+ /**
128
+ * Retrieve enabled plugins
129
+ * @member {Object}
130
+ * @since 1.0.0
131
+ */
132
+ get plugins(): Record<string, EggPluginInfo>;
133
+ /**
134
+ * The configuration of application
135
+ * @member {Config}
136
+ * @since 1.0.0
137
+ */
138
+ get config(): EggAppConfig;
139
+ /**
140
+ * Execute scope after loaded and before app start.
141
+ *
142
+ * Notice:
143
+ * This method is now NOT recommended and regarded as a deprecated one,
144
+ * For plugin development, we should use `didLoad` instead.
145
+ * For application development, we should use `willReady` instead.
146
+ *
147
+ * @see https://eggjs.org/en/advanced/loader.html#beforestart
148
+ *
149
+ * @param {Function} scope function will execute before app start
150
+ * @param {string} [name] scope name, default is empty string
151
+ */
152
+ beforeStart(scope: Fun, name?: string): void;
153
+ /**
154
+ * register an callback function that will be invoked when application is ready.
155
+ * @see https://github.com/node-modules/get-ready
156
+ * @since 1.0.0
157
+ * @example
158
+ * const app = new Application(...);
159
+ * app.ready(err => {
160
+ * if (err) throw err;
161
+ * console.log('done');
162
+ * });
163
+ */
164
+ ready(): Promise<void>;
165
+ ready(flagOrFunction: ReadyFunctionArg): void;
166
+ /**
167
+ * If a client starts asynchronously, you can register `readyCallback`,
168
+ * then the application will wait for the callback to ready
169
+ *
170
+ * It will log when the callback is not invoked after 10s
171
+ *
172
+ * Recommend to use {@link EggCore#beforeStart}
173
+ * @since 1.0.0
174
+ *
175
+ * @param {String} name - readyCallback task name
176
+ * @param {object} opts -
177
+ * - {Number} [timeout=10000] - emit `ready_timeout` when it doesn't finish but reach the timeout
178
+ * - {Boolean} [isWeakDep=false] - whether it's a weak dependency
179
+ * @returns {Function} - a callback
180
+ * @example
181
+ * const done = app.readyCallback('mysql');
182
+ * mysql.ready(done);
183
+ */
184
+ readyCallback(name: string, opts: object): (...args: unknown[]) => void;
185
+ /**
186
+ * Register a function that will be called when app close.
187
+ *
188
+ * Notice:
189
+ * This method is now NOT recommended directly used,
190
+ * Developers SHOULDN'T use app.beforeClose directly now,
191
+ * but in the form of class to implement beforeClose instead.
192
+ *
193
+ * @see https://eggjs.org/en/advanced/loader.html#beforeclose
194
+ *
195
+ * @param {Function} fn - the function that can be generator function or async function.
196
+ */
197
+ beforeClose(fn: Fun, name?: string): void;
198
+ /**
199
+ * Close all, it will close
200
+ * - callbacks registered by beforeClose
201
+ * - emit `close` event
202
+ * - remove add listeners
203
+ *
204
+ * If error is thrown when it's closing, the promise will reject.
205
+ * It will also reject after following call.
206
+ * @returns {Promise} promise
207
+ * @since 1.0.0
208
+ */
209
+ close(): Promise<void>;
210
+ /**
211
+ * get router
212
+ * @member {Router} EggCore#router
213
+ * @since 1.0.0
214
+ */
215
+ get router(): Router;
216
+ /**
217
+ * Alias to {@link Router#url}
218
+ * @param {String} name - Router name
219
+ * @param {Object} params - more parameters
220
+ * @returns {String} url
221
+ */
222
+ url(name: string, params?: Parameters<Router['url']>[1]): string;
223
+ head(path: string | RegExp | (string | RegExp)[], ...middlewares: (MiddlewareFunc | string)[]): EggCore;
224
+ head(name: string, path: string | RegExp | (string | RegExp)[], ...middlewares: (MiddlewareFunc | string)[]): EggCore;
225
+ get(path: string | RegExp | (string | RegExp)[], ...middlewares: (MiddlewareFunc | string)[]): EggCore;
226
+ get(name: string, path: string | RegExp | (string | RegExp)[], ...middlewares: (MiddlewareFunc | string)[]): EggCore;
227
+ put(path: string | RegExp | (string | RegExp)[], ...middlewares: (MiddlewareFunc | string)[]): EggCore;
228
+ put(name: string, path: string | RegExp | (string | RegExp)[], ...middlewares: (MiddlewareFunc | string)[]): EggCore;
229
+ patch(path: string | RegExp | (string | RegExp)[], ...middlewares: (MiddlewareFunc | string)[]): EggCore;
230
+ patch(name: string, path: string | RegExp | (string | RegExp)[], ...middlewares: (MiddlewareFunc | string)[]): EggCore;
231
+ post(path: string | RegExp | (string | RegExp)[], ...middlewares: (MiddlewareFunc | string)[]): EggCore;
232
+ post(name: string, path: string | RegExp | (string | RegExp)[], ...middlewares: (MiddlewareFunc | string)[]): EggCore;
233
+ delete(path: string | RegExp | (string | RegExp)[], ...middlewares: (MiddlewareFunc | string)[]): EggCore;
234
+ delete(name: string, path: string | RegExp | (string | RegExp)[], ...middlewares: (MiddlewareFunc | string)[]): EggCore;
235
+ del(path: string | RegExp | (string | RegExp)[], ...middlewares: (MiddlewareFunc | string)[]): EggCore;
236
+ del(name: string, path: string | RegExp | (string | RegExp)[], ...middlewares: (MiddlewareFunc | string)[]): EggCore;
237
+ all(path: string | RegExp | (string | RegExp)[], ...middlewares: (MiddlewareFunc | string)[]): EggCore;
238
+ all(name: string, path: string | RegExp | (string | RegExp)[], ...middlewares: (MiddlewareFunc | string)[]): EggCore;
239
+ resources(prefix: string, controller: string | ResourcesController): EggCore;
240
+ resources(prefix: string, middleware: MiddlewareFunc, controller: string | ResourcesController): EggCore;
241
+ resources(name: string, prefix: string, controller: string | ResourcesController): EggCore;
242
+ resources(name: string, prefix: string, middleware: MiddlewareFunc, controller: string | ResourcesController): EggCore;
243
+ redirect(source: string, destination: string, status?: number): this;
244
+ register(path: string | RegExp | (string | RegExp)[], methods: string[], middleware: MiddlewareFunc | MiddlewareFunc[], opts?: RegisterOptions): this;
245
+ get [EGG_LOADER](): typeof EggLoader;
246
+ }
247
+ //#endregion
248
+ export { Context$1 as Context, EGG_LOADER, EggCore, EggCoreInitOptions, EggCoreOptions, KoaApplication, KoaContext, type KoaMiddlewareFunc, KoaRequest, KoaResponse, MiddlewareFunc, type Next, Request$1 as Request, Response$1 as Response, Router };