koatty 3.7.4 → 3.7.7
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/.vscode/launch.json +2 -1
- package/CHANGELOG.md +9 -0
- package/README.md +13 -18
- package/dist/README.md +13 -18
- package/dist/index.d.ts +1 -3
- package/dist/index.js +44 -66
- package/dist/index.mjs +39 -55
- package/dist/package.json +27 -28
- package/package.json +27 -28
package/.vscode/launch.json
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
{
|
5
5
|
"type": "node",
|
6
6
|
"request": "launch",
|
7
|
-
"name": "Koatty
|
7
|
+
"name": "Koatty Demo Program",
|
8
8
|
"args": [
|
9
9
|
"${workspaceRoot}/demo/src/App.ts"
|
10
10
|
],
|
@@ -16,6 +16,7 @@
|
|
16
16
|
"env": {
|
17
17
|
"NODE_ENV": "development"
|
18
18
|
},
|
19
|
+
"outputCapture": "std",
|
19
20
|
"sourceMaps": true,
|
20
21
|
"cwd": "${workspaceRoot}",
|
21
22
|
"protocol": "inspector",
|
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,15 @@
|
|
2
2
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
4
4
|
|
5
|
+
### [3.7.7](https://github.com/thinkkoa/koatty/compare/v3.7.6...v3.7.7) (2023-02-15)
|
6
|
+
|
7
|
+
|
8
|
+
### Bug Fixes
|
9
|
+
|
10
|
+
* rebuild logger ([42cdb96](https://github.com/thinkkoa/koatty/commit/42cdb964c2e0a41a93b1a895084c92c016cbad24))
|
11
|
+
|
12
|
+
### [3.7.6](https://github.com/thinkkoa/koatty/compare/v3.7.4...v3.7.6) (2023-01-13)
|
13
|
+
|
5
14
|
### [3.7.4](https://github.com/thinkkoa/koatty/compare/v3.7.3...v3.7.4) (2022-11-18)
|
6
15
|
|
7
16
|
|
package/README.md
CHANGED
@@ -19,7 +19,7 @@ Use Typescript's decorator implement IOC and AOP.
|
|
19
19
|
[koatty_doc_CN](https://koatty.org/) (In progress💪)
|
20
20
|
|
21
21
|
|
22
|
-
## Installation
|
22
|
+
## Installation CLI tools
|
23
23
|
|
24
24
|
```shell
|
25
25
|
npm i -g koatty_cli
|
@@ -30,36 +30,31 @@ npm i -g koatty_cli
|
|
30
30
|
### 1.Create Project
|
31
31
|
|
32
32
|
```shell
|
33
|
-
|
34
|
-
|
35
|
-
cd ./projectName
|
36
|
-
|
37
|
-
yarn install
|
33
|
+
kt new projectName
|
38
34
|
|
39
35
|
npm start
|
40
36
|
```
|
41
37
|
|
42
|
-
### 2.
|
43
|
-
```shell
|
44
|
-
koatty controller test
|
38
|
+
### 2. Install deps
|
45
39
|
|
46
40
|
```
|
41
|
+
cd ./projectName
|
47
42
|
|
48
|
-
|
49
|
-
|
50
|
-
```shell
|
51
|
-
koatty service test
|
52
|
-
|
43
|
+
npm i
|
53
44
|
```
|
54
45
|
|
55
|
-
###
|
46
|
+
### 3. Start up
|
56
47
|
|
57
|
-
```
|
58
|
-
|
48
|
+
```
|
49
|
+
npm run dev
|
59
50
|
|
51
|
+
// or
|
52
|
+
npm start
|
60
53
|
```
|
61
54
|
|
62
|
-
|
55
|
+
## Code style
|
56
|
+
|
57
|
+
default Controller:
|
63
58
|
|
64
59
|
```javascript
|
65
60
|
import { Controller, BaseController, Autowired, GetMapping, RequestBody, PathVariable,
|
package/dist/README.md
CHANGED
@@ -19,7 +19,7 @@ Use Typescript's decorator implement IOC and AOP.
|
|
19
19
|
[koatty_doc_CN](https://koatty.org/) (In progress💪)
|
20
20
|
|
21
21
|
|
22
|
-
## Installation
|
22
|
+
## Installation CLI tools
|
23
23
|
|
24
24
|
```shell
|
25
25
|
npm i -g koatty_cli
|
@@ -30,36 +30,31 @@ npm i -g koatty_cli
|
|
30
30
|
### 1.Create Project
|
31
31
|
|
32
32
|
```shell
|
33
|
-
|
34
|
-
|
35
|
-
cd ./projectName
|
36
|
-
|
37
|
-
yarn install
|
33
|
+
kt new projectName
|
38
34
|
|
39
35
|
npm start
|
40
36
|
```
|
41
37
|
|
42
|
-
### 2.
|
43
|
-
```shell
|
44
|
-
koatty controller test
|
38
|
+
### 2. Install deps
|
45
39
|
|
46
40
|
```
|
41
|
+
cd ./projectName
|
47
42
|
|
48
|
-
|
49
|
-
|
50
|
-
```shell
|
51
|
-
koatty service test
|
52
|
-
|
43
|
+
npm i
|
53
44
|
```
|
54
45
|
|
55
|
-
###
|
46
|
+
### 3. Start up
|
56
47
|
|
57
|
-
```
|
58
|
-
|
48
|
+
```
|
49
|
+
npm run dev
|
59
50
|
|
51
|
+
// or
|
52
|
+
npm start
|
60
53
|
```
|
61
54
|
|
62
|
-
|
55
|
+
## Code style
|
56
|
+
|
57
|
+
default Controller:
|
63
58
|
|
64
59
|
```javascript
|
65
60
|
import { Controller, BaseController, Autowired, GetMapping, RequestBody, PathVariable,
|
package/dist/index.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/*!
|
2
2
|
* @Author: richen
|
3
|
-
* @Date:
|
3
|
+
* @Date: 2023-02-15 18:28:27
|
4
4
|
* @License: BSD (3-Clause)
|
5
5
|
* @Copyright (c) - <richenlin(at)gmail.com>
|
6
6
|
* @HomePage: https://koatty.org/
|
@@ -181,8 +181,6 @@ export { Helper }
|
|
181
181
|
export declare interface IController {
|
182
182
|
readonly app: Koatty;
|
183
183
|
readonly ctx: KoattyContext;
|
184
|
-
__before?: () => Promise<any>;
|
185
|
-
__after?: () => Promise<any>;
|
186
184
|
}
|
187
185
|
|
188
186
|
/**
|
package/dist/index.js
CHANGED
@@ -1,14 +1,12 @@
|
|
1
1
|
/*!
|
2
2
|
* @Author: richen
|
3
|
-
* @Date:
|
3
|
+
* @Date: 2023-02-15 18:28:04
|
4
4
|
* @License: BSD (3-Clause)
|
5
5
|
* @Copyright (c) - <richenlin(at)gmail.com>
|
6
6
|
* @HomePage: https://koatty.org/
|
7
7
|
*/
|
8
8
|
'use strict';
|
9
9
|
|
10
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
11
|
-
|
12
10
|
require('reflect-metadata');
|
13
11
|
var fs = require('fs');
|
14
12
|
var koatty_core = require('koatty_core');
|
@@ -24,10 +22,7 @@ var koatty_lib = require('koatty_lib');
|
|
24
22
|
var koatty_trace = require('koatty_trace');
|
25
23
|
var koatty_payload = require('koatty_payload');
|
26
24
|
|
27
|
-
function
|
28
|
-
|
29
|
-
function _interopNamespace(e) {
|
30
|
-
if (e && e.__esModule) return e;
|
25
|
+
function _interopNamespaceDefault(e) {
|
31
26
|
var n = Object.create(null);
|
32
27
|
if (e) {
|
33
28
|
Object.keys(e).forEach(function (k) {
|
@@ -40,12 +35,11 @@ function _interopNamespace(e) {
|
|
40
35
|
}
|
41
36
|
});
|
42
37
|
}
|
43
|
-
n
|
38
|
+
n.default = e;
|
44
39
|
return Object.freeze(n);
|
45
40
|
}
|
46
41
|
|
47
|
-
var
|
48
|
-
var path__namespace = /*#__PURE__*/_interopNamespace(path);
|
42
|
+
var path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
|
49
43
|
|
50
44
|
/**
|
51
45
|
* @ author: richen
|
@@ -61,25 +55,19 @@ const Logger = koatty_logger.DefaultLogger;
|
|
61
55
|
* @export
|
62
56
|
* @param {{
|
63
57
|
* logLevel?: LogLevelType;
|
64
|
-
* logConsole?: boolean;
|
65
|
-
* logFile?: boolean;
|
66
|
-
* logFileLevel?: LogLevelType;
|
67
58
|
* logFilePath?: string;
|
59
|
+
* sensFields?: string[];
|
68
60
|
* }} config
|
69
61
|
*/
|
70
62
|
function SetLogger(app, config) {
|
71
|
-
if (config.logLevel
|
63
|
+
if (config.logLevel) {
|
72
64
|
koatty_logger.DefaultLogger.setLevel(config.logLevel);
|
73
65
|
}
|
74
|
-
if (config.
|
75
|
-
koatty_logger.DefaultLogger.setLogConsole(config.logConsole);
|
76
|
-
}
|
77
|
-
if (config.logFile !== undefined && !app.silent) {
|
78
|
-
koatty_logger.DefaultLogger.setLogFile(config.logFile);
|
66
|
+
if (config.logFilePath && !app.silent) {
|
79
67
|
koatty_logger.DefaultLogger.setLogFilePath(config.logFilePath);
|
80
68
|
}
|
81
|
-
if (config.
|
82
|
-
koatty_logger.DefaultLogger.
|
69
|
+
if (config.sensFields) {
|
70
|
+
koatty_logger.DefaultLogger.setSensFields(config.sensFields);
|
83
71
|
}
|
84
72
|
}
|
85
73
|
|
@@ -296,12 +284,12 @@ class Loader {
|
|
296
284
|
app.env = 'development';
|
297
285
|
process.env.NODE_ENV = 'development';
|
298
286
|
process.env.APP_DEBUG = 'true';
|
299
|
-
Logger.setLevel("
|
287
|
+
Logger.setLevel("debug");
|
300
288
|
}
|
301
289
|
else {
|
302
290
|
app.env = 'production';
|
303
291
|
process.env.NODE_ENV = 'production';
|
304
|
-
Logger.setLevel("
|
292
|
+
Logger.setLevel("info");
|
305
293
|
}
|
306
294
|
// define path
|
307
295
|
const rootPath = app.rootPath || process.cwd();
|
@@ -397,29 +385,20 @@ class Loader {
|
|
397
385
|
//Logger
|
398
386
|
if (configs.config) {
|
399
387
|
const opt = configs.config;
|
400
|
-
let logLevel = "
|
388
|
+
let logLevel = "debug", logFilePath = "", sensFields = [];
|
401
389
|
if (app.env === "production") {
|
402
|
-
logLevel = "
|
403
|
-
logFileLevel = "WARN";
|
404
|
-
logConsole = false;
|
405
|
-
logFile = true;
|
390
|
+
logLevel = "info";
|
406
391
|
}
|
407
392
|
if (opt.logs_level) {
|
408
|
-
logLevel = opt.logs_level;
|
409
|
-
}
|
410
|
-
if (opt.logs_write_level) {
|
411
|
-
logFileLevel = opt.logs_write_level;
|
412
|
-
}
|
413
|
-
if (opt.logs_write !== undefined) {
|
414
|
-
logFile = !!opt.logs_write;
|
415
|
-
}
|
416
|
-
if (opt.logs_console !== undefined) {
|
417
|
-
logConsole = !!opt.logs_console;
|
393
|
+
logLevel = (opt.logs_level).toLowerCase();
|
418
394
|
}
|
419
395
|
if (opt.logs_path) {
|
420
396
|
logFilePath = opt.logs_path;
|
421
397
|
}
|
422
|
-
|
398
|
+
if (opt.sens_fields) {
|
399
|
+
sensFields = opt.sens_fields;
|
400
|
+
}
|
401
|
+
SetLogger(app, { logLevel, logFilePath, sensFields });
|
423
402
|
}
|
424
403
|
}
|
425
404
|
/**
|
@@ -628,7 +607,7 @@ class Loader {
|
|
628
607
|
}
|
629
608
|
}
|
630
609
|
|
631
|
-
var version = "3.7.
|
610
|
+
var version = "3.7.7";
|
632
611
|
var engines = {
|
633
612
|
node: ">12.0.0"
|
634
613
|
};
|
@@ -701,11 +680,10 @@ const executeBootstrap = async function (target, bootFunc, isInitiative = false)
|
|
701
680
|
// unittest does not print startup logs
|
702
681
|
if (isUTRuntime) {
|
703
682
|
app.silent = true;
|
704
|
-
Logger.
|
705
|
-
Logger.setLogFile(false);
|
683
|
+
Logger.enable(false);
|
706
684
|
}
|
707
685
|
try {
|
708
|
-
!app.silent &&
|
686
|
+
!app.silent && Logger.Log("Koatty", LOGO);
|
709
687
|
if (!(app instanceof koatty_core.Koatty)) {
|
710
688
|
throw new Error(`class ${target.name} does not inherit from Koatty`);
|
711
689
|
}
|
@@ -715,47 +693,47 @@ const executeBootstrap = async function (target, bootFunc, isInitiative = false)
|
|
715
693
|
Loader.initialize(app);
|
716
694
|
// exec bootFunc
|
717
695
|
if (koatty_lib.Helper.isFunction(bootFunc)) {
|
718
|
-
Logger.Log('
|
696
|
+
Logger.Log('Koatty', '', 'Execute bootFunc ...');
|
719
697
|
await bootFunc(app);
|
720
698
|
}
|
721
699
|
// Set IOCContainer.app
|
722
700
|
koatty_container.IOCContainer.setApp(app);
|
723
|
-
Logger.Log('
|
701
|
+
Logger.Log('Koatty', '', 'ComponentScan ...');
|
724
702
|
// Check all bean
|
725
703
|
Loader.CheckAllComponents(app, target);
|
726
704
|
// Load configuration
|
727
|
-
Logger.Log('
|
705
|
+
Logger.Log('Koatty', '', 'Load Configurations ...');
|
728
706
|
// configuration metadata
|
729
707
|
const configurationMetas = Loader.GetConfigurationMetas(app, target);
|
730
708
|
Loader.LoadConfigs(app, configurationMetas);
|
731
709
|
// Load Plugin
|
732
|
-
Logger.Log('
|
710
|
+
Logger.Log('Koatty', '', 'Load Plugins ...');
|
733
711
|
await Loader.LoadPlugins(app);
|
734
712
|
// app.emit("appBoot");
|
735
713
|
await asyncEvent(app, 'appBoot');
|
736
714
|
// Load App ready hooks
|
737
715
|
Loader.LoadAppReadyHooks(app, target);
|
738
716
|
// Load Middleware
|
739
|
-
Logger.Log('
|
717
|
+
Logger.Log('Koatty', '', 'Load Middlewares ...');
|
740
718
|
await Loader.LoadMiddlewares(app);
|
741
719
|
// Load Components
|
742
|
-
Logger.Log('
|
720
|
+
Logger.Log('Koatty', '', 'Load Components ...');
|
743
721
|
Loader.LoadComponents(app);
|
744
722
|
// Load Services
|
745
|
-
Logger.Log('
|
723
|
+
Logger.Log('Koatty', '', 'Load Services ...');
|
746
724
|
Loader.LoadServices(app);
|
747
725
|
// Load Controllers
|
748
|
-
Logger.Log('
|
726
|
+
Logger.Log('Koatty', '', 'Load Controllers ...');
|
749
727
|
const controllers = Loader.LoadControllers(app);
|
750
728
|
// Create Server
|
751
729
|
app.server = newServe(app);
|
752
730
|
// Create router
|
753
731
|
app.router = newRouter(app);
|
754
732
|
// Load Routers
|
755
|
-
Logger.Log('
|
733
|
+
Logger.Log('Koatty', '', 'Load Routers ...');
|
756
734
|
app.router.LoadRouter(controllers);
|
757
735
|
// Emit app ready event
|
758
|
-
Logger.Log('
|
736
|
+
Logger.Log('Koatty', '', 'Emit App Ready ...');
|
759
737
|
await asyncEvent(app, 'appReady');
|
760
738
|
if (!isUTRuntime) {
|
761
739
|
app.listen(app.server, listenCallback(app));
|
@@ -790,22 +768,22 @@ const listenCallback = (app) => {
|
|
790
768
|
return function () {
|
791
769
|
const options = app.server.options;
|
792
770
|
// Emit app started event
|
793
|
-
Logger.Log('
|
771
|
+
Logger.Log('Koatty', '', 'Emit App Start ...');
|
794
772
|
asyncEvent(app, 'appStart');
|
795
|
-
Logger.Log('
|
796
|
-
Logger.Log("
|
797
|
-
Logger.Log("
|
798
|
-
Logger.Log("
|
799
|
-
Logger.Log('
|
800
|
-
Logger.Log("
|
801
|
-
Logger.Log("
|
773
|
+
Logger.Log('Koatty', '', '====================================');
|
774
|
+
Logger.Log("Koatty", "", `Nodejs Version: ${process.version}`);
|
775
|
+
Logger.Log("Koatty", "", `Koatty Version: v${app.version}`);
|
776
|
+
Logger.Log("Koatty", "", `App Environment: ${app.env}`);
|
777
|
+
Logger.Log('Koatty', '', `Server Protocol: ${(options.protocol).toUpperCase()}`);
|
778
|
+
Logger.Log("Koatty", "", `Server running at ${options.protocol === "http2" ? "https" : options.protocol}://${options.hostname || '127.0.0.1'}:${options.port}/`);
|
779
|
+
Logger.Log("Koatty", "", "====================================");
|
802
780
|
// binding event "appStop"
|
803
|
-
Logger.Log('
|
781
|
+
Logger.Log('Koatty', '', 'Bind App Stop event ...');
|
804
782
|
koatty_serve.BindProcessEvent(app, 'appStop');
|
805
|
-
// Set Logger
|
806
|
-
Loader.SetLogger(app);
|
807
783
|
// tslint:disable-next-line: no-unused-expression
|
808
784
|
app.appDebug && Logger.Warn(`Running in debug mode.`);
|
785
|
+
// Set Logger
|
786
|
+
Loader.SetLogger(app);
|
809
787
|
};
|
810
788
|
};
|
811
789
|
/**
|
@@ -832,8 +810,8 @@ const newServe = function (app) {
|
|
832
810
|
if (pm.has(options.protocol)) {
|
833
811
|
const keyFile = app.config("key_file") ?? "";
|
834
812
|
const crtFile = app.config("crt_file") ?? "";
|
835
|
-
options.ext.key =
|
836
|
-
options.ext.cert =
|
813
|
+
options.ext.key = fs.readFileSync(keyFile).toString();
|
814
|
+
options.ext.cert = fs.readFileSync(crtFile).toString();
|
837
815
|
}
|
838
816
|
if (options.protocol === "https" || options.protocol === "http2") {
|
839
817
|
options.port = options.port == 80 ? 443 : options.port;
|
package/dist/index.mjs
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/*!
|
2
2
|
* @Author: richen
|
3
|
-
* @Date:
|
3
|
+
* @Date: 2023-02-15 18:28:04
|
4
4
|
* @License: BSD (3-Clause)
|
5
5
|
* @Copyright (c) - <richenlin(at)gmail.com>
|
6
6
|
* @HomePage: https://koatty.org/
|
@@ -41,25 +41,19 @@ const Logger = DefaultLogger;
|
|
41
41
|
* @export
|
42
42
|
* @param {{
|
43
43
|
* logLevel?: LogLevelType;
|
44
|
-
* logConsole?: boolean;
|
45
|
-
* logFile?: boolean;
|
46
|
-
* logFileLevel?: LogLevelType;
|
47
44
|
* logFilePath?: string;
|
45
|
+
* sensFields?: string[];
|
48
46
|
* }} config
|
49
47
|
*/
|
50
48
|
function SetLogger(app, config) {
|
51
|
-
if (config.logLevel
|
49
|
+
if (config.logLevel) {
|
52
50
|
DefaultLogger.setLevel(config.logLevel);
|
53
51
|
}
|
54
|
-
if (config.
|
55
|
-
DefaultLogger.setLogConsole(config.logConsole);
|
56
|
-
}
|
57
|
-
if (config.logFile !== undefined && !app.silent) {
|
58
|
-
DefaultLogger.setLogFile(config.logFile);
|
52
|
+
if (config.logFilePath && !app.silent) {
|
59
53
|
DefaultLogger.setLogFilePath(config.logFilePath);
|
60
54
|
}
|
61
|
-
if (config.
|
62
|
-
DefaultLogger.
|
55
|
+
if (config.sensFields) {
|
56
|
+
DefaultLogger.setSensFields(config.sensFields);
|
63
57
|
}
|
64
58
|
}
|
65
59
|
|
@@ -276,12 +270,12 @@ class Loader {
|
|
276
270
|
app.env = 'development';
|
277
271
|
process.env.NODE_ENV = 'development';
|
278
272
|
process.env.APP_DEBUG = 'true';
|
279
|
-
Logger.setLevel("
|
273
|
+
Logger.setLevel("debug");
|
280
274
|
}
|
281
275
|
else {
|
282
276
|
app.env = 'production';
|
283
277
|
process.env.NODE_ENV = 'production';
|
284
|
-
Logger.setLevel("
|
278
|
+
Logger.setLevel("info");
|
285
279
|
}
|
286
280
|
// define path
|
287
281
|
const rootPath = app.rootPath || process.cwd();
|
@@ -377,29 +371,20 @@ class Loader {
|
|
377
371
|
//Logger
|
378
372
|
if (configs.config) {
|
379
373
|
const opt = configs.config;
|
380
|
-
let logLevel = "
|
374
|
+
let logLevel = "debug", logFilePath = "", sensFields = [];
|
381
375
|
if (app.env === "production") {
|
382
|
-
logLevel = "
|
383
|
-
logFileLevel = "WARN";
|
384
|
-
logConsole = false;
|
385
|
-
logFile = true;
|
376
|
+
logLevel = "info";
|
386
377
|
}
|
387
378
|
if (opt.logs_level) {
|
388
|
-
logLevel = opt.logs_level;
|
389
|
-
}
|
390
|
-
if (opt.logs_write_level) {
|
391
|
-
logFileLevel = opt.logs_write_level;
|
392
|
-
}
|
393
|
-
if (opt.logs_write !== undefined) {
|
394
|
-
logFile = !!opt.logs_write;
|
395
|
-
}
|
396
|
-
if (opt.logs_console !== undefined) {
|
397
|
-
logConsole = !!opt.logs_console;
|
379
|
+
logLevel = (opt.logs_level).toLowerCase();
|
398
380
|
}
|
399
381
|
if (opt.logs_path) {
|
400
382
|
logFilePath = opt.logs_path;
|
401
383
|
}
|
402
|
-
|
384
|
+
if (opt.sens_fields) {
|
385
|
+
sensFields = opt.sens_fields;
|
386
|
+
}
|
387
|
+
SetLogger(app, { logLevel, logFilePath, sensFields });
|
403
388
|
}
|
404
389
|
}
|
405
390
|
/**
|
@@ -608,7 +593,7 @@ class Loader {
|
|
608
593
|
}
|
609
594
|
}
|
610
595
|
|
611
|
-
var version = "3.7.
|
596
|
+
var version = "3.7.7";
|
612
597
|
var engines = {
|
613
598
|
node: ">12.0.0"
|
614
599
|
};
|
@@ -681,11 +666,10 @@ const executeBootstrap = async function (target, bootFunc, isInitiative = false)
|
|
681
666
|
// unittest does not print startup logs
|
682
667
|
if (isUTRuntime) {
|
683
668
|
app.silent = true;
|
684
|
-
Logger.
|
685
|
-
Logger.setLogFile(false);
|
669
|
+
Logger.enable(false);
|
686
670
|
}
|
687
671
|
try {
|
688
|
-
!app.silent &&
|
672
|
+
!app.silent && Logger.Log("Koatty", LOGO);
|
689
673
|
if (!(app instanceof Koatty)) {
|
690
674
|
throw new Error(`class ${target.name} does not inherit from Koatty`);
|
691
675
|
}
|
@@ -695,47 +679,47 @@ const executeBootstrap = async function (target, bootFunc, isInitiative = false)
|
|
695
679
|
Loader.initialize(app);
|
696
680
|
// exec bootFunc
|
697
681
|
if (Helper.isFunction(bootFunc)) {
|
698
|
-
Logger.Log('
|
682
|
+
Logger.Log('Koatty', '', 'Execute bootFunc ...');
|
699
683
|
await bootFunc(app);
|
700
684
|
}
|
701
685
|
// Set IOCContainer.app
|
702
686
|
IOCContainer.setApp(app);
|
703
|
-
Logger.Log('
|
687
|
+
Logger.Log('Koatty', '', 'ComponentScan ...');
|
704
688
|
// Check all bean
|
705
689
|
Loader.CheckAllComponents(app, target);
|
706
690
|
// Load configuration
|
707
|
-
Logger.Log('
|
691
|
+
Logger.Log('Koatty', '', 'Load Configurations ...');
|
708
692
|
// configuration metadata
|
709
693
|
const configurationMetas = Loader.GetConfigurationMetas(app, target);
|
710
694
|
Loader.LoadConfigs(app, configurationMetas);
|
711
695
|
// Load Plugin
|
712
|
-
Logger.Log('
|
696
|
+
Logger.Log('Koatty', '', 'Load Plugins ...');
|
713
697
|
await Loader.LoadPlugins(app);
|
714
698
|
// app.emit("appBoot");
|
715
699
|
await asyncEvent(app, 'appBoot');
|
716
700
|
// Load App ready hooks
|
717
701
|
Loader.LoadAppReadyHooks(app, target);
|
718
702
|
// Load Middleware
|
719
|
-
Logger.Log('
|
703
|
+
Logger.Log('Koatty', '', 'Load Middlewares ...');
|
720
704
|
await Loader.LoadMiddlewares(app);
|
721
705
|
// Load Components
|
722
|
-
Logger.Log('
|
706
|
+
Logger.Log('Koatty', '', 'Load Components ...');
|
723
707
|
Loader.LoadComponents(app);
|
724
708
|
// Load Services
|
725
|
-
Logger.Log('
|
709
|
+
Logger.Log('Koatty', '', 'Load Services ...');
|
726
710
|
Loader.LoadServices(app);
|
727
711
|
// Load Controllers
|
728
|
-
Logger.Log('
|
712
|
+
Logger.Log('Koatty', '', 'Load Controllers ...');
|
729
713
|
const controllers = Loader.LoadControllers(app);
|
730
714
|
// Create Server
|
731
715
|
app.server = newServe(app);
|
732
716
|
// Create router
|
733
717
|
app.router = newRouter(app);
|
734
718
|
// Load Routers
|
735
|
-
Logger.Log('
|
719
|
+
Logger.Log('Koatty', '', 'Load Routers ...');
|
736
720
|
app.router.LoadRouter(controllers);
|
737
721
|
// Emit app ready event
|
738
|
-
Logger.Log('
|
722
|
+
Logger.Log('Koatty', '', 'Emit App Ready ...');
|
739
723
|
await asyncEvent(app, 'appReady');
|
740
724
|
if (!isUTRuntime) {
|
741
725
|
app.listen(app.server, listenCallback(app));
|
@@ -770,22 +754,22 @@ const listenCallback = (app) => {
|
|
770
754
|
return function () {
|
771
755
|
const options = app.server.options;
|
772
756
|
// Emit app started event
|
773
|
-
Logger.Log('
|
757
|
+
Logger.Log('Koatty', '', 'Emit App Start ...');
|
774
758
|
asyncEvent(app, 'appStart');
|
775
|
-
Logger.Log('
|
776
|
-
Logger.Log("
|
777
|
-
Logger.Log("
|
778
|
-
Logger.Log("
|
779
|
-
Logger.Log('
|
780
|
-
Logger.Log("
|
781
|
-
Logger.Log("
|
759
|
+
Logger.Log('Koatty', '', '====================================');
|
760
|
+
Logger.Log("Koatty", "", `Nodejs Version: ${process.version}`);
|
761
|
+
Logger.Log("Koatty", "", `Koatty Version: v${app.version}`);
|
762
|
+
Logger.Log("Koatty", "", `App Environment: ${app.env}`);
|
763
|
+
Logger.Log('Koatty', '', `Server Protocol: ${(options.protocol).toUpperCase()}`);
|
764
|
+
Logger.Log("Koatty", "", `Server running at ${options.protocol === "http2" ? "https" : options.protocol}://${options.hostname || '127.0.0.1'}:${options.port}/`);
|
765
|
+
Logger.Log("Koatty", "", "====================================");
|
782
766
|
// binding event "appStop"
|
783
|
-
Logger.Log('
|
767
|
+
Logger.Log('Koatty', '', 'Bind App Stop event ...');
|
784
768
|
BindProcessEvent(app, 'appStop');
|
785
|
-
// Set Logger
|
786
|
-
Loader.SetLogger(app);
|
787
769
|
// tslint:disable-next-line: no-unused-expression
|
788
770
|
app.appDebug && Logger.Warn(`Running in debug mode.`);
|
771
|
+
// Set Logger
|
772
|
+
Loader.SetLogger(app);
|
789
773
|
};
|
790
774
|
};
|
791
775
|
/**
|
package/dist/package.json
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
{
|
2
2
|
"name": "koatty",
|
3
|
-
"version": "3.7.
|
3
|
+
"version": "3.7.7",
|
4
4
|
"description": "Koa2 + Typescript = koatty. Use Typescript's decorator implement auto injection.",
|
5
5
|
"scripts": {
|
6
6
|
"build": "npm run build:js && npm run build:dts && npm run build:doc && npm run build:cp",
|
7
7
|
"build:cp": "node scripts/postBuild && copyfiles package.json LICENSE README.md dist/",
|
8
|
-
"build:js": "del-cli --force dist && npx rollup -c .rollup.config.js",
|
8
|
+
"build:js": "del-cli --force dist && npx rollup --bundleConfigAsCjs -c .rollup.config.js",
|
9
9
|
"build:doc": "del-cli --force docs/api && npx api-documenter markdown --input temp --output docs/api",
|
10
10
|
"build:dts": "del-cli --force temp && npx tsc && npx api-extractor run --local --verbose",
|
11
11
|
"eslint": "eslint --ext .ts,.js ./",
|
12
12
|
"prepublishOnly": "npm test && npm run build",
|
13
13
|
"prerelease": "npm test && npm run build",
|
14
|
-
"
|
14
|
+
"pub": "git push --follow-tags origin && npm publish",
|
15
15
|
"release": "standard-version",
|
16
16
|
"release:pre": "npm run release -- --prerelease",
|
17
17
|
"release:major": "npm run release -- --release-as major",
|
@@ -55,11 +55,11 @@
|
|
55
55
|
"@commitlint/config-conventional": "^17.x.x",
|
56
56
|
"@microsoft/api-documenter": "^7.x.x",
|
57
57
|
"@microsoft/api-extractor": "^7.x.x",
|
58
|
-
"@rollup/plugin-json": "^
|
59
|
-
"@types/jest": "^
|
58
|
+
"@rollup/plugin-json": "^6.x.x",
|
59
|
+
"@types/jest": "^29.x.x",
|
60
60
|
"@types/koa": "^2.x.x",
|
61
|
-
"@types/koa__router": "^
|
62
|
-
"@types/node": "^
|
61
|
+
"@types/koa__router": "^12.x.x",
|
62
|
+
"@types/node": "^18.x.x",
|
63
63
|
"@types/ws": "^8.x.x",
|
64
64
|
"@typescript-eslint/eslint-plugin": "^5.x.x",
|
65
65
|
"@typescript-eslint/parser": "^5.x.x",
|
@@ -67,34 +67,33 @@
|
|
67
67
|
"copyfiles": "^2.x.x",
|
68
68
|
"del-cli": "^4.x.x",
|
69
69
|
"eslint": "^8.x.x",
|
70
|
-
"eslint-plugin-jest": "^
|
70
|
+
"eslint-plugin-jest": "^27.x.x",
|
71
71
|
"husky": "^4.x.x",
|
72
|
-
"jest": "^
|
72
|
+
"jest": "^29.x.x",
|
73
73
|
"jest-html-reporters": "^3.x.x",
|
74
|
-
"
|
75
|
-
"rollup": "^2.x.x",
|
74
|
+
"rollup": "^3.x.x",
|
76
75
|
"rollup-plugin-typescript2": "^0.x.x",
|
77
76
|
"standard-version": "^9.x.x",
|
78
|
-
"ts-jest": "^
|
77
|
+
"ts-jest": "^29.x.x",
|
79
78
|
"ts-node": "^10.x.x",
|
80
79
|
"typescript": "^4.x.x"
|
81
80
|
},
|
82
81
|
"dependencies": {
|
83
|
-
"koa": "2.
|
84
|
-
"koatty_config": "1.1.
|
85
|
-
"koatty_container": "1.7.
|
86
|
-
"koatty_core": "1.6.
|
87
|
-
"koatty_exception": "1.2.
|
88
|
-
"koatty_lib": "1.
|
89
|
-
"koatty_loader": "1.0
|
90
|
-
"koatty_logger": "
|
91
|
-
"koatty_payload": "1.
|
92
|
-
"koatty_proto": "^1.1.
|
93
|
-
"koatty_router": "1.8.
|
94
|
-
"koatty_serve": "1.5.
|
95
|
-
"koatty_trace": "1.7.
|
96
|
-
"koatty_validation": "1.2.
|
97
|
-
"reflect-metadata": "0.1.13",
|
98
|
-
"tslib": "2.4.1"
|
82
|
+
"koa": "^2.14.1",
|
83
|
+
"koatty_config": "^1.1.6",
|
84
|
+
"koatty_container": "^1.7.14",
|
85
|
+
"koatty_core": "^1.6.12",
|
86
|
+
"koatty_exception": "^1.2.8",
|
87
|
+
"koatty_lib": "^1.3.0",
|
88
|
+
"koatty_loader": "^1.1.0",
|
89
|
+
"koatty_logger": "^2.0.4",
|
90
|
+
"koatty_payload": "^1.4.0",
|
91
|
+
"koatty_proto": "^1.1.10",
|
92
|
+
"koatty_router": "^1.8.4",
|
93
|
+
"koatty_serve": "^1.5.5",
|
94
|
+
"koatty_trace": "^1.7.2",
|
95
|
+
"koatty_validation": "^1.2.6",
|
96
|
+
"reflect-metadata": "^0.1.13",
|
97
|
+
"tslib": "^2.4.1"
|
99
98
|
}
|
100
99
|
}
|
package/package.json
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
{
|
2
2
|
"name": "koatty",
|
3
|
-
"version": "3.7.
|
3
|
+
"version": "3.7.7",
|
4
4
|
"description": "Koa2 + Typescript = koatty. Use Typescript's decorator implement auto injection.",
|
5
5
|
"scripts": {
|
6
6
|
"build": "npm run build:js && npm run build:dts && npm run build:doc && npm run build:cp",
|
7
7
|
"build:cp": "node scripts/postBuild && copyfiles package.json LICENSE README.md dist/",
|
8
|
-
"build:js": "del-cli --force dist && npx rollup -c .rollup.config.js",
|
8
|
+
"build:js": "del-cli --force dist && npx rollup --bundleConfigAsCjs -c .rollup.config.js",
|
9
9
|
"build:doc": "del-cli --force docs/api && npx api-documenter markdown --input temp --output docs/api",
|
10
10
|
"build:dts": "del-cli --force temp && npx tsc && npx api-extractor run --local --verbose",
|
11
11
|
"eslint": "eslint --ext .ts,.js ./",
|
12
12
|
"prepublishOnly": "npm test && npm run build",
|
13
13
|
"prerelease": "npm test && npm run build",
|
14
|
-
"
|
14
|
+
"pub": "git push --follow-tags origin && npm publish",
|
15
15
|
"release": "standard-version",
|
16
16
|
"release:pre": "npm run release -- --prerelease",
|
17
17
|
"release:major": "npm run release -- --release-as major",
|
@@ -55,11 +55,11 @@
|
|
55
55
|
"@commitlint/config-conventional": "^17.x.x",
|
56
56
|
"@microsoft/api-documenter": "^7.x.x",
|
57
57
|
"@microsoft/api-extractor": "^7.x.x",
|
58
|
-
"@rollup/plugin-json": "^
|
59
|
-
"@types/jest": "^
|
58
|
+
"@rollup/plugin-json": "^6.x.x",
|
59
|
+
"@types/jest": "^29.x.x",
|
60
60
|
"@types/koa": "^2.x.x",
|
61
|
-
"@types/koa__router": "^
|
62
|
-
"@types/node": "^
|
61
|
+
"@types/koa__router": "^12.x.x",
|
62
|
+
"@types/node": "^18.x.x",
|
63
63
|
"@types/ws": "^8.x.x",
|
64
64
|
"@typescript-eslint/eslint-plugin": "^5.x.x",
|
65
65
|
"@typescript-eslint/parser": "^5.x.x",
|
@@ -67,34 +67,33 @@
|
|
67
67
|
"copyfiles": "^2.x.x",
|
68
68
|
"del-cli": "^4.x.x",
|
69
69
|
"eslint": "^8.x.x",
|
70
|
-
"eslint-plugin-jest": "^
|
70
|
+
"eslint-plugin-jest": "^27.x.x",
|
71
71
|
"husky": "^4.x.x",
|
72
|
-
"jest": "^
|
72
|
+
"jest": "^29.x.x",
|
73
73
|
"jest-html-reporters": "^3.x.x",
|
74
|
-
"
|
75
|
-
"rollup": "^2.x.x",
|
74
|
+
"rollup": "^3.x.x",
|
76
75
|
"rollup-plugin-typescript2": "^0.x.x",
|
77
76
|
"standard-version": "^9.x.x",
|
78
|
-
"ts-jest": "^
|
77
|
+
"ts-jest": "^29.x.x",
|
79
78
|
"ts-node": "^10.x.x",
|
80
79
|
"typescript": "^4.x.x"
|
81
80
|
},
|
82
81
|
"dependencies": {
|
83
|
-
"koa": "2.
|
84
|
-
"koatty_config": "1.1.
|
85
|
-
"koatty_container": "1.7.
|
86
|
-
"koatty_core": "1.6.
|
87
|
-
"koatty_exception": "1.2.
|
88
|
-
"koatty_lib": "1.
|
89
|
-
"koatty_loader": "1.0
|
90
|
-
"koatty_logger": "
|
91
|
-
"koatty_payload": "1.
|
92
|
-
"koatty_proto": "^1.1.
|
93
|
-
"koatty_router": "1.8.
|
94
|
-
"koatty_serve": "1.5.
|
95
|
-
"koatty_trace": "1.7.
|
96
|
-
"koatty_validation": "1.2.
|
97
|
-
"reflect-metadata": "0.1.13",
|
98
|
-
"tslib": "2.4.1"
|
82
|
+
"koa": "^2.14.1",
|
83
|
+
"koatty_config": "^1.1.6",
|
84
|
+
"koatty_container": "^1.7.14",
|
85
|
+
"koatty_core": "^1.6.12",
|
86
|
+
"koatty_exception": "^1.2.8",
|
87
|
+
"koatty_lib": "^1.3.0",
|
88
|
+
"koatty_loader": "^1.1.0",
|
89
|
+
"koatty_logger": "^2.0.4",
|
90
|
+
"koatty_payload": "^1.4.0",
|
91
|
+
"koatty_proto": "^1.1.10",
|
92
|
+
"koatty_router": "^1.8.4",
|
93
|
+
"koatty_serve": "^1.5.5",
|
94
|
+
"koatty_trace": "^1.7.2",
|
95
|
+
"koatty_validation": "^1.2.6",
|
96
|
+
"reflect-metadata": "^0.1.13",
|
97
|
+
"tslib": "^2.4.1"
|
99
98
|
}
|
100
99
|
}
|