koatty 3.7.3 → 3.7.6

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.
@@ -4,7 +4,7 @@
4
4
  {
5
5
  "type": "node",
6
6
  "request": "launch",
7
- "name": "Koatty Test Program",
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,17 @@
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.6](https://github.com/thinkkoa/koatty/compare/v3.7.4...v3.7.6) (2023-01-13)
6
+
7
+ ### [3.7.4](https://github.com/thinkkoa/koatty/compare/v3.7.3...v3.7.4) (2022-11-18)
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * prod模式log打印不全 ([bf3c81b](https://github.com/thinkkoa/koatty/commit/bf3c81b1851630eacc36558a7fc7cf444dce9c91))
13
+ * wrong words ([024a1fa](https://github.com/thinkkoa/koatty/commit/024a1fa0ff7e8a327ecb6e482b36e450e63dcc4b))
14
+ * 更新logo ([4e5554e](https://github.com/thinkkoa/koatty/commit/4e5554e13404cba81c3585bcac3dd017abbf8267))
15
+
5
16
  ### [3.7.3](https://github.com/thinkkoa/koatty/compare/v3.7.2...v3.7.3) (2022-11-16)
6
17
 
7
18
 
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * @Author: richen
3
- * @Date: 2022-11-16 17:45:16
3
+ * @Date: 2023-01-13 16:41:31
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
- __befor?: () => 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: 2022-11-16 17:44:54
3
+ * @Date: 2023-01-13 16:41:15
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 _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
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["default"] = e;
38
+ n.default = e;
44
39
  return Object.freeze(n);
45
40
  }
46
41
 
47
- var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
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 !== undefined) {
63
+ if (config.logLevel) {
72
64
  koatty_logger.DefaultLogger.setLevel(config.logLevel);
73
65
  }
74
- if (config.logConsole !== undefined && !app.silent) {
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.logFileLevel !== undefined) {
82
- koatty_logger.DefaultLogger.setLogFileLevel(config.logFileLevel);
69
+ if (config.sensFields) {
70
+ koatty_logger.DefaultLogger.setSensFields(config.sensFields);
83
71
  }
84
72
  }
85
73
 
@@ -168,12 +156,11 @@ const APP_READY_HOOK = "APP_READY_HOOK";
168
156
  // tslint:disable: no-irregular-whitespace
169
157
  const LOGO = `
170
158
 
171
- ██  ██  ██████  █████  ████████ ████████ ██  ██ 
172
- ██  ██  ██    ██ ██   ██    ██       ██     ██  ██  
173
- █████   ██  ██ ███████  ██  ██   ████  
174
- ██  ██  ██  ██ ██   ██  ██  ██   ██  
175
- ██  ██  ██████  ██  ██  ██  ██  ██ 
176
- https://github.com/koatty
159
+ ┬┌─┌─┐┌─┐┌┬┐┌┬┐┬ ┬
160
+ ├┴┐│ │├─┤ │ │ └┬┘
161
+ ┴ ┴└─┘┴ ┴ ┴ ┴ ┴
162
+ -------------------------------------------
163
+ https://github.com/koatty
177
164
  `;
178
165
 
179
166
  /**
@@ -297,12 +284,12 @@ class Loader {
297
284
  app.env = 'development';
298
285
  process.env.NODE_ENV = 'development';
299
286
  process.env.APP_DEBUG = 'true';
300
- Logger.setLevel("DEBUG");
287
+ Logger.setLevel("debug");
301
288
  }
302
289
  else {
303
290
  app.env = 'production';
304
291
  process.env.NODE_ENV = 'production';
305
- Logger.setLevel("INFO");
292
+ Logger.setLevel("info");
306
293
  }
307
294
  // define path
308
295
  const rootPath = app.rootPath || process.cwd();
@@ -398,29 +385,20 @@ class Loader {
398
385
  //Logger
399
386
  if (configs.config) {
400
387
  const opt = configs.config;
401
- let logLevel = "DEBUG", logFileLevel = "INFO", logConsole = true, logFile = false, logFilePath = app.rootPath + "/logs";
388
+ let logLevel = "debug", logFilePath = "", sensFields = [];
402
389
  if (app.env === "production") {
403
- logLevel = "INFO";
404
- logFileLevel = "WARN";
405
- logConsole = false;
406
- logFile = true;
390
+ logLevel = "info";
407
391
  }
408
392
  if (opt.logs_level) {
409
- logLevel = opt.logs_level;
410
- }
411
- if (opt.logs_write_level) {
412
- logFileLevel = opt.logs_write_level;
413
- }
414
- if (opt.logs_write !== undefined) {
415
- logFile = !!opt.logs_write;
416
- }
417
- if (opt.logs_console !== undefined) {
418
- logConsole = !!opt.logs_console;
393
+ logLevel = (opt.logs_level).toLowerCase();
419
394
  }
420
395
  if (opt.logs_path) {
421
396
  logFilePath = opt.logs_path;
422
397
  }
423
- SetLogger(app, { logLevel, logConsole, logFile, logFileLevel, logFilePath });
398
+ if (opt.sens_fields) {
399
+ sensFields = opt.sens_fields;
400
+ }
401
+ SetLogger(app, { logLevel, logFilePath, sensFields });
424
402
  }
425
403
  }
426
404
  /**
@@ -629,7 +607,7 @@ class Loader {
629
607
  }
630
608
  }
631
609
 
632
- var version = "3.7.3";
610
+ var version = "3.7.6";
633
611
  var engines = {
634
612
  node: ">12.0.0"
635
613
  };
@@ -702,11 +680,10 @@ const executeBootstrap = async function (target, bootFunc, isInitiative = false)
702
680
  // unittest does not print startup logs
703
681
  if (isUTRuntime) {
704
682
  app.silent = true;
705
- Logger.setLogConsole(false);
706
- Logger.setLogFile(false);
683
+ Logger.enable(false);
707
684
  }
708
685
  try {
709
- !app.silent && console.log(LOGO);
686
+ !app.silent && Logger.Log("Koatty", LOGO);
710
687
  if (!(app instanceof koatty_core.Koatty)) {
711
688
  throw new Error(`class ${target.name} does not inherit from Koatty`);
712
689
  }
@@ -716,49 +693,47 @@ const executeBootstrap = async function (target, bootFunc, isInitiative = false)
716
693
  Loader.initialize(app);
717
694
  // exec bootFunc
718
695
  if (koatty_lib.Helper.isFunction(bootFunc)) {
719
- Logger.Log('think', '', 'Execute bootFunc ...');
696
+ Logger.Log('Koatty', '', 'Execute bootFunc ...');
720
697
  await bootFunc(app);
721
698
  }
722
699
  // Set IOCContainer.app
723
700
  koatty_container.IOCContainer.setApp(app);
724
- Logger.Log('think', '', 'ComponentScan ...');
701
+ Logger.Log('Koatty', '', 'ComponentScan ...');
725
702
  // Check all bean
726
703
  Loader.CheckAllComponents(app, target);
727
704
  // Load configuration
728
- Logger.Log('think', '', 'Load Configurations ...');
705
+ Logger.Log('Koatty', '', 'Load Configurations ...');
729
706
  // configuration metadata
730
707
  const configurationMetas = Loader.GetConfigurationMetas(app, target);
731
708
  Loader.LoadConfigs(app, configurationMetas);
732
709
  // Load Plugin
733
- Logger.Log('think', '', 'Load Plugins ...');
710
+ Logger.Log('Koatty', '', 'Load Plugins ...');
734
711
  await Loader.LoadPlugins(app);
735
- // Set Logger
736
- Loader.SetLogger(app);
737
712
  // app.emit("appBoot");
738
713
  await asyncEvent(app, 'appBoot');
739
714
  // Load App ready hooks
740
715
  Loader.LoadAppReadyHooks(app, target);
741
716
  // Load Middleware
742
- Logger.Log('think', '', 'Load Middlewares ...');
717
+ Logger.Log('Koatty', '', 'Load Middlewares ...');
743
718
  await Loader.LoadMiddlewares(app);
744
719
  // Load Components
745
- Logger.Log('think', '', 'Load Components ...');
720
+ Logger.Log('Koatty', '', 'Load Components ...');
746
721
  Loader.LoadComponents(app);
747
722
  // Load Services
748
- Logger.Log('think', '', 'Load Services ...');
723
+ Logger.Log('Koatty', '', 'Load Services ...');
749
724
  Loader.LoadServices(app);
750
725
  // Load Controllers
751
- Logger.Log('think', '', 'Load Controllers ...');
726
+ Logger.Log('Koatty', '', 'Load Controllers ...');
752
727
  const controllers = Loader.LoadControllers(app);
753
728
  // Create Server
754
729
  app.server = newServe(app);
755
730
  // Create router
756
731
  app.router = newRouter(app);
757
732
  // Load Routers
758
- Logger.Log('think', '', 'Load Routers ...');
733
+ Logger.Log('Koatty', '', 'Load Routers ...');
759
734
  app.router.LoadRouter(controllers);
760
735
  // Emit app ready event
761
- Logger.Log('think', '', 'Emit App Ready ...');
736
+ Logger.Log('Koatty', '', 'Emit App Ready ...');
762
737
  await asyncEvent(app, 'appReady');
763
738
  if (!isUTRuntime) {
764
739
  app.listen(app.server, listenCallback(app));
@@ -793,20 +768,22 @@ const listenCallback = (app) => {
793
768
  return function () {
794
769
  const options = app.server.options;
795
770
  // Emit app started event
796
- Logger.Log('think', '', 'Emit App Start ...');
771
+ Logger.Log('Koatty', '', 'Emit App Start ...');
797
772
  asyncEvent(app, 'appStart');
798
- Logger.Log('think', '', '====================================');
799
- Logger.Log("think", "", `Nodejs Version: ${process.version}`);
800
- Logger.Log("think", "", `Koatty Version: v${app.version}`);
801
- Logger.Log("think", "", `App Environment: ${app.env}`);
802
- Logger.Log('think', '', `Server Protocol: ${(options.protocol).toUpperCase()}`);
803
- Logger.Log("think", "", `Server running at ${options.protocol === "http2" ? "https" : options.protocol}://${options.hostname || '127.0.0.1'}:${options.port}/`);
804
- Logger.Log("think", "", "====================================");
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", "", "====================================");
805
780
  // binding event "appStop"
806
- Logger.Log('think', '', 'Bind App Stop event ...');
781
+ Logger.Log('Koatty', '', 'Bind App Stop event ...');
807
782
  koatty_serve.BindProcessEvent(app, 'appStop');
808
783
  // tslint:disable-next-line: no-unused-expression
809
784
  app.appDebug && Logger.Warn(`Running in debug mode.`);
785
+ // Set Logger
786
+ Loader.SetLogger(app);
810
787
  };
811
788
  };
812
789
  /**
@@ -833,8 +810,8 @@ const newServe = function (app) {
833
810
  if (pm.has(options.protocol)) {
834
811
  const keyFile = app.config("key_file") ?? "";
835
812
  const crtFile = app.config("crt_file") ?? "";
836
- options.ext.key = fs__default["default"].readFileSync(keyFile).toString();
837
- options.ext.cert = fs__default["default"].readFileSync(crtFile).toString();
813
+ options.ext.key = fs.readFileSync(keyFile).toString();
814
+ options.ext.cert = fs.readFileSync(crtFile).toString();
838
815
  }
839
816
  if (options.protocol === "https" || options.protocol === "http2") {
840
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: 2022-11-16 17:44:54
3
+ * @Date: 2023-01-13 16:41:15
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 !== undefined) {
49
+ if (config.logLevel) {
52
50
  DefaultLogger.setLevel(config.logLevel);
53
51
  }
54
- if (config.logConsole !== undefined && !app.silent) {
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.logFileLevel !== undefined) {
62
- DefaultLogger.setLogFileLevel(config.logFileLevel);
55
+ if (config.sensFields) {
56
+ DefaultLogger.setSensFields(config.sensFields);
63
57
  }
64
58
  }
65
59
 
@@ -148,12 +142,11 @@ const APP_READY_HOOK = "APP_READY_HOOK";
148
142
  // tslint:disable: no-irregular-whitespace
149
143
  const LOGO = `
150
144
 
151
- ██  ██  ██████  █████  ████████ ████████ ██  ██ 
152
- ██  ██  ██    ██ ██   ██    ██       ██     ██  ██  
153
- █████   ██  ██ ███████  ██  ██   ████  
154
- ██  ██  ██  ██ ██   ██  ██  ██   ██  
155
- ██  ██  ██████  ██  ██  ██  ██  ██ 
156
- https://github.com/koatty
145
+ ┬┌─┌─┐┌─┐┌┬┐┌┬┐┬ ┬
146
+ ├┴┐│ │├─┤ │ │ └┬┘
147
+ ┴ ┴└─┘┴ ┴ ┴ ┴ ┴
148
+ -------------------------------------------
149
+ https://github.com/koatty
157
150
  `;
158
151
 
159
152
  /**
@@ -277,12 +270,12 @@ class Loader {
277
270
  app.env = 'development';
278
271
  process.env.NODE_ENV = 'development';
279
272
  process.env.APP_DEBUG = 'true';
280
- Logger.setLevel("DEBUG");
273
+ Logger.setLevel("debug");
281
274
  }
282
275
  else {
283
276
  app.env = 'production';
284
277
  process.env.NODE_ENV = 'production';
285
- Logger.setLevel("INFO");
278
+ Logger.setLevel("info");
286
279
  }
287
280
  // define path
288
281
  const rootPath = app.rootPath || process.cwd();
@@ -378,29 +371,20 @@ class Loader {
378
371
  //Logger
379
372
  if (configs.config) {
380
373
  const opt = configs.config;
381
- let logLevel = "DEBUG", logFileLevel = "INFO", logConsole = true, logFile = false, logFilePath = app.rootPath + "/logs";
374
+ let logLevel = "debug", logFilePath = "", sensFields = [];
382
375
  if (app.env === "production") {
383
- logLevel = "INFO";
384
- logFileLevel = "WARN";
385
- logConsole = false;
386
- logFile = true;
376
+ logLevel = "info";
387
377
  }
388
378
  if (opt.logs_level) {
389
- logLevel = opt.logs_level;
390
- }
391
- if (opt.logs_write_level) {
392
- logFileLevel = opt.logs_write_level;
393
- }
394
- if (opt.logs_write !== undefined) {
395
- logFile = !!opt.logs_write;
396
- }
397
- if (opt.logs_console !== undefined) {
398
- logConsole = !!opt.logs_console;
379
+ logLevel = (opt.logs_level).toLowerCase();
399
380
  }
400
381
  if (opt.logs_path) {
401
382
  logFilePath = opt.logs_path;
402
383
  }
403
- SetLogger(app, { logLevel, logConsole, logFile, logFileLevel, logFilePath });
384
+ if (opt.sens_fields) {
385
+ sensFields = opt.sens_fields;
386
+ }
387
+ SetLogger(app, { logLevel, logFilePath, sensFields });
404
388
  }
405
389
  }
406
390
  /**
@@ -609,7 +593,7 @@ class Loader {
609
593
  }
610
594
  }
611
595
 
612
- var version = "3.7.3";
596
+ var version = "3.7.6";
613
597
  var engines = {
614
598
  node: ">12.0.0"
615
599
  };
@@ -682,11 +666,10 @@ const executeBootstrap = async function (target, bootFunc, isInitiative = false)
682
666
  // unittest does not print startup logs
683
667
  if (isUTRuntime) {
684
668
  app.silent = true;
685
- Logger.setLogConsole(false);
686
- Logger.setLogFile(false);
669
+ Logger.enable(false);
687
670
  }
688
671
  try {
689
- !app.silent && console.log(LOGO);
672
+ !app.silent && Logger.Log("Koatty", LOGO);
690
673
  if (!(app instanceof Koatty)) {
691
674
  throw new Error(`class ${target.name} does not inherit from Koatty`);
692
675
  }
@@ -696,49 +679,47 @@ const executeBootstrap = async function (target, bootFunc, isInitiative = false)
696
679
  Loader.initialize(app);
697
680
  // exec bootFunc
698
681
  if (Helper.isFunction(bootFunc)) {
699
- Logger.Log('think', '', 'Execute bootFunc ...');
682
+ Logger.Log('Koatty', '', 'Execute bootFunc ...');
700
683
  await bootFunc(app);
701
684
  }
702
685
  // Set IOCContainer.app
703
686
  IOCContainer.setApp(app);
704
- Logger.Log('think', '', 'ComponentScan ...');
687
+ Logger.Log('Koatty', '', 'ComponentScan ...');
705
688
  // Check all bean
706
689
  Loader.CheckAllComponents(app, target);
707
690
  // Load configuration
708
- Logger.Log('think', '', 'Load Configurations ...');
691
+ Logger.Log('Koatty', '', 'Load Configurations ...');
709
692
  // configuration metadata
710
693
  const configurationMetas = Loader.GetConfigurationMetas(app, target);
711
694
  Loader.LoadConfigs(app, configurationMetas);
712
695
  // Load Plugin
713
- Logger.Log('think', '', 'Load Plugins ...');
696
+ Logger.Log('Koatty', '', 'Load Plugins ...');
714
697
  await Loader.LoadPlugins(app);
715
- // Set Logger
716
- Loader.SetLogger(app);
717
698
  // app.emit("appBoot");
718
699
  await asyncEvent(app, 'appBoot');
719
700
  // Load App ready hooks
720
701
  Loader.LoadAppReadyHooks(app, target);
721
702
  // Load Middleware
722
- Logger.Log('think', '', 'Load Middlewares ...');
703
+ Logger.Log('Koatty', '', 'Load Middlewares ...');
723
704
  await Loader.LoadMiddlewares(app);
724
705
  // Load Components
725
- Logger.Log('think', '', 'Load Components ...');
706
+ Logger.Log('Koatty', '', 'Load Components ...');
726
707
  Loader.LoadComponents(app);
727
708
  // Load Services
728
- Logger.Log('think', '', 'Load Services ...');
709
+ Logger.Log('Koatty', '', 'Load Services ...');
729
710
  Loader.LoadServices(app);
730
711
  // Load Controllers
731
- Logger.Log('think', '', 'Load Controllers ...');
712
+ Logger.Log('Koatty', '', 'Load Controllers ...');
732
713
  const controllers = Loader.LoadControllers(app);
733
714
  // Create Server
734
715
  app.server = newServe(app);
735
716
  // Create router
736
717
  app.router = newRouter(app);
737
718
  // Load Routers
738
- Logger.Log('think', '', 'Load Routers ...');
719
+ Logger.Log('Koatty', '', 'Load Routers ...');
739
720
  app.router.LoadRouter(controllers);
740
721
  // Emit app ready event
741
- Logger.Log('think', '', 'Emit App Ready ...');
722
+ Logger.Log('Koatty', '', 'Emit App Ready ...');
742
723
  await asyncEvent(app, 'appReady');
743
724
  if (!isUTRuntime) {
744
725
  app.listen(app.server, listenCallback(app));
@@ -773,20 +754,22 @@ const listenCallback = (app) => {
773
754
  return function () {
774
755
  const options = app.server.options;
775
756
  // Emit app started event
776
- Logger.Log('think', '', 'Emit App Start ...');
757
+ Logger.Log('Koatty', '', 'Emit App Start ...');
777
758
  asyncEvent(app, 'appStart');
778
- Logger.Log('think', '', '====================================');
779
- Logger.Log("think", "", `Nodejs Version: ${process.version}`);
780
- Logger.Log("think", "", `Koatty Version: v${app.version}`);
781
- Logger.Log("think", "", `App Environment: ${app.env}`);
782
- Logger.Log('think', '', `Server Protocol: ${(options.protocol).toUpperCase()}`);
783
- Logger.Log("think", "", `Server running at ${options.protocol === "http2" ? "https" : options.protocol}://${options.hostname || '127.0.0.1'}:${options.port}/`);
784
- Logger.Log("think", "", "====================================");
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", "", "====================================");
785
766
  // binding event "appStop"
786
- Logger.Log('think', '', 'Bind App Stop event ...');
767
+ Logger.Log('Koatty', '', 'Bind App Stop event ...');
787
768
  BindProcessEvent(app, 'appStop');
788
769
  // tslint:disable-next-line: no-unused-expression
789
770
  app.appDebug && Logger.Warn(`Running in debug mode.`);
771
+ // Set Logger
772
+ Loader.SetLogger(app);
790
773
  };
791
774
  };
792
775
  /**
package/dist/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "koatty",
3
- "version": "3.7.3",
3
+ "version": "3.7.6",
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 ./",
@@ -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": "^4.x.x",
59
- "@types/jest": "^27.x.x",
58
+ "@rollup/plugin-json": "^6.x.x",
59
+ "@types/jest": "^29.x.x",
60
60
  "@types/koa": "^2.x.x",
61
- "@types/koa__router": "^8.x.x",
62
- "@types/node": "^16.x.x",
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,34 @@
67
67
  "copyfiles": "^2.x.x",
68
68
  "del-cli": "^4.x.x",
69
69
  "eslint": "^8.x.x",
70
- "eslint-plugin-jest": "^26.x.x",
70
+ "eslint-plugin-jest": "^27.x.x",
71
71
  "husky": "^4.x.x",
72
- "jest": "^28.x.x",
72
+ "jest": "^29.x.x",
73
73
  "jest-html-reporters": "^3.x.x",
74
- "koa-session": "^6.2.0",
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": "^28.x.x",
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.13.4",
84
- "koatty_config": "1.1.5",
85
- "koatty_container": "1.7.10",
86
- "koatty_core": "1.6.9",
87
- "koatty_exception": "1.2.7",
88
- "koatty_lib": "1.2.12",
89
- "koatty_loader": "1.0.3",
90
- "koatty_logger": "1.3.14",
91
- "koatty_payload": "1.3.18",
92
- "koatty_proto": "^1.1.9",
93
- "koatty_router": "1.8.0",
94
- "koatty_serve": "1.5.1",
95
- "koatty_trace": "1.7.0",
96
- "koatty_validation": "1.2.5",
97
- "reflect-metadata": "0.1.13",
98
- "tslib": "2.4.1"
82
+ "@koa/router": "^12.0.0",
83
+ "koa": "^2.13.4",
84
+ "koatty_config": "^1.1.6",
85
+ "koatty_container": "^1.7.14",
86
+ "koatty_core": "^1.6.12",
87
+ "koatty_exception": "^1.2.8",
88
+ "koatty_lib": "^1.3.0",
89
+ "koatty_loader": "^1.1.0",
90
+ "koatty_logger": "^2.0.4",
91
+ "koatty_payload": "^1.4.0",
92
+ "koatty_proto": "^1.1.10",
93
+ "koatty_router": "^1.8.2",
94
+ "koatty_serve": "^1.5.4",
95
+ "koatty_trace": "^1.7.2",
96
+ "koatty_validation": "^1.2.6",
97
+ "reflect-metadata": "^0.1.13",
98
+ "tslib": "^2.4.1"
99
99
  }
100
100
  }
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "koatty",
3
- "version": "3.7.3",
3
+ "version": "3.7.6",
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 ./",
@@ -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": "^4.x.x",
59
- "@types/jest": "^27.x.x",
58
+ "@rollup/plugin-json": "^6.x.x",
59
+ "@types/jest": "^29.x.x",
60
60
  "@types/koa": "^2.x.x",
61
- "@types/koa__router": "^8.x.x",
62
- "@types/node": "^16.x.x",
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,34 @@
67
67
  "copyfiles": "^2.x.x",
68
68
  "del-cli": "^4.x.x",
69
69
  "eslint": "^8.x.x",
70
- "eslint-plugin-jest": "^26.x.x",
70
+ "eslint-plugin-jest": "^27.x.x",
71
71
  "husky": "^4.x.x",
72
- "jest": "^28.x.x",
72
+ "jest": "^29.x.x",
73
73
  "jest-html-reporters": "^3.x.x",
74
- "koa-session": "^6.2.0",
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": "^28.x.x",
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.13.4",
84
- "koatty_config": "1.1.5",
85
- "koatty_container": "1.7.10",
86
- "koatty_core": "1.6.9",
87
- "koatty_exception": "1.2.7",
88
- "koatty_lib": "1.2.12",
89
- "koatty_loader": "1.0.3",
90
- "koatty_logger": "1.3.14",
91
- "koatty_payload": "1.3.18",
92
- "koatty_proto": "^1.1.9",
93
- "koatty_router": "1.8.0",
94
- "koatty_serve": "1.5.1",
95
- "koatty_trace": "1.7.0",
96
- "koatty_validation": "1.2.5",
97
- "reflect-metadata": "0.1.13",
98
- "tslib": "2.4.1"
82
+ "@koa/router": "^12.0.0",
83
+ "koa": "^2.13.4",
84
+ "koatty_config": "^1.1.6",
85
+ "koatty_container": "^1.7.14",
86
+ "koatty_core": "^1.6.12",
87
+ "koatty_exception": "^1.2.8",
88
+ "koatty_lib": "^1.3.0",
89
+ "koatty_loader": "^1.1.0",
90
+ "koatty_logger": "^2.0.4",
91
+ "koatty_payload": "^1.4.0",
92
+ "koatty_proto": "^1.1.10",
93
+ "koatty_router": "^1.8.2",
94
+ "koatty_serve": "^1.5.4",
95
+ "koatty_trace": "^1.7.2",
96
+ "koatty_validation": "^1.2.6",
97
+ "reflect-metadata": "^0.1.13",
98
+ "tslib": "^2.4.1"
99
99
  }
100
100
  }
@@ -0,0 +1,70 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var json = require('@rollup/plugin-json');
6
+ var typescript = require('rollup-plugin-typescript2');
7
+
8
+ /*
9
+ * @Description:
10
+ * @Usage:
11
+ * @Author: richen
12
+ * @Date: 2021-12-17 10:20:44
13
+ * @LastEditTime: 2022-05-27 11:50:23
14
+ */
15
+ // import babel from '@rollup/plugin-babel';
16
+
17
+ var _rollup_config = [
18
+ {
19
+ input: './src/index.ts',
20
+ output: [{
21
+ format: 'cjs',
22
+ file: './dist/index.js',
23
+ banner: require('./scripts/copyright')
24
+ }],
25
+ plugins: [
26
+ // babel({
27
+ // babelHelpers: "runtime",
28
+ // configFile: './babel.config.js',
29
+ // exclude: 'node_modules/**',
30
+ // }),
31
+ json(),
32
+ typescript({
33
+ tsconfigOverride: {
34
+ compilerOptions: {
35
+ declaration: false,
36
+ declarationMap: false,
37
+ module: "ESNext"
38
+ }
39
+ }
40
+ })
41
+ ]
42
+ },
43
+ {
44
+ input: './src/index.ts',
45
+ output: [{
46
+ format: 'es',
47
+ file: './dist/index.mjs',
48
+ banner: require('./scripts/copyright')
49
+ }],
50
+ plugins: [
51
+ // babel({
52
+ // babelHelpers: "runtime",
53
+ // configFile: './babel.config.js',
54
+ // exclude: 'node_modules/**',
55
+ // }),
56
+ json(),
57
+ typescript({
58
+ tsconfigOverride: {
59
+ compilerOptions: {
60
+ declaration: false,
61
+ declarationMap: false,
62
+ module: "ESNext"
63
+ }
64
+ }
65
+ })
66
+ ]
67
+ }
68
+ ];
69
+
70
+ exports.default = _rollup_config;