koatty 3.11.7 → 3.11.9

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/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
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.11.9](https://github.com/thinkkoa/koatty/compare/v3.11.8...v3.11.9) (2025-01-14)
6
+
7
+ ### [3.11.8](https://github.com/thinkkoa/koatty/compare/v3.11.7...v3.11.8) (2025-01-14)
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * 调整app.env定义逻辑 ([eb4ae59](https://github.com/thinkkoa/koatty/commit/eb4ae5983831543e93eabac52c272f0dad2fb907))
13
+ * enable debug mode and update dependencies ([651f1c8](https://github.com/thinkkoa/koatty/commit/651f1c85c85fcd166ee8f0c07d445baf4ffd662a))
14
+
5
15
  ### [3.11.7](https://github.com/thinkkoa/koatty/compare/v3.11.6...v3.11.7) (2024-12-06)
6
16
 
7
17
 
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * @Author: richen
3
- * @Date: 2024-12-06 09:38:35
3
+ * @Date: 2025-01-14 16:20:30
4
4
  * @License: BSD (3-Clause)
5
5
  * @Copyright (c) - <richenlin(at)gmail.com>
6
6
  * @HomePage: https://koatty.org/
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * @Author: richen
3
- * @Date: 2024-12-06 09:38:17
3
+ * @Date: 2025-01-14 16:20:07
4
4
  * @License: BSD (3-Clause)
5
5
  * @Copyright (c) - <richenlin(at)gmail.com>
6
6
  * @HomePage: https://koatty.org/
@@ -11,8 +11,8 @@ var koatty_config = require('koatty_config');
11
11
  var koatty_container = require('koatty_container');
12
12
  var koatty_core = require('koatty_core');
13
13
  var koatty_exception = require('koatty_exception');
14
- var koatty_router = require('koatty_router');
15
14
  var koatty_lib = require('koatty_lib');
15
+ var koatty_router = require('koatty_router');
16
16
  var koatty_logger = require('koatty_logger');
17
17
  var koatty_loader = require('koatty_loader');
18
18
  var koatty_serve = require('koatty_serve');
@@ -37,6 +37,11 @@ function _interopNamespaceDefault(e) {
37
37
 
38
38
  var path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
39
39
 
40
+ var version = "3.11.9";
41
+ var engines = {
42
+ node: ">12.0.0"
43
+ };
44
+
40
45
  /*
41
46
  * @Description: framework logger
42
47
  * @Usage:
@@ -72,63 +77,17 @@ function SetLogger(app, config) {
72
77
  }
73
78
  }
74
79
 
75
- var version = "3.11.7";
76
- var engines = {
77
- node: ">12.0.0"
78
- };
79
-
80
80
  /*
81
- * @Description: framework runtime checker
81
+ * @Description: framework helper
82
82
  * @Usage:
83
83
  * @Author: richen
84
84
  * @Date: 2023-12-09 21:56:32
85
- * @LastEditTime: 2023-12-09 23:01:22
85
+ * @LastEditTime: 2025-01-14 16:14:10
86
86
  * @License: BSD (3-Clause)
87
87
  * @Copyright (c): <richenlin(at)gmail.com>
88
88
  */
89
89
  const KOATTY_VERSION = version;
90
90
  const ENGINES_VERSION = engines.node.slice(1) || '12.0.0';
91
- /**
92
- * check node version
93
- * @return {void} []
94
- */
95
- function checkRuntime() {
96
- let nodeEngines = ENGINES_VERSION;
97
- nodeEngines = nodeEngines.slice(0, nodeEngines.lastIndexOf('.'));
98
- let nodeVersion = process.version;
99
- if (nodeVersion[0] === 'v') {
100
- nodeVersion = nodeVersion.slice(1);
101
- }
102
- nodeVersion = nodeVersion.slice(0, nodeVersion.lastIndexOf('.'));
103
- if (koatty_lib.Helper.toNumber(nodeEngines) > koatty_lib.Helper.toNumber(nodeVersion)) {
104
- Logger.Error(`Koatty need node version > ${nodeEngines}, current version is ${nodeVersion}, please upgrade it.`);
105
- process.exit(-1);
106
- }
107
- }
108
- /**
109
- * unittest running environment detection
110
- * only support jest
111
- * @returns {boolean}
112
- */
113
- const checkUTRuntime = () => {
114
- let isUTRuntime = false;
115
- // UT运行环境判断,暂时先只判断jest
116
- const argv = JSON.stringify(process.argv[1]);
117
- if (argv.indexOf('jest') > -1) {
118
- isUTRuntime = true;
119
- }
120
- return isUTRuntime;
121
- };
122
-
123
- /*
124
- * @Description: framework helper
125
- * @Usage:
126
- * @Author: richen
127
- * @Date: 2023-12-09 21:56:32
128
- * @LastEditTime: 2024-01-16 01:20:17
129
- * @License: BSD (3-Clause)
130
- * @Copyright (c): <richenlin(at)gmail.com>
131
- */
132
91
  /**
133
92
  * Check class file
134
93
  * name should be always the same as class name
@@ -165,6 +124,37 @@ function checkClass(fileName, xpath, target, exSet) {
165
124
  exSet.add(fileName);
166
125
  return;
167
126
  }
127
+ /**
128
+ * check node version
129
+ * @return {void} []
130
+ */
131
+ function checkRuntime() {
132
+ let nodeEngines = ENGINES_VERSION;
133
+ nodeEngines = nodeEngines.slice(0, nodeEngines.lastIndexOf('.'));
134
+ let nodeVersion = process.version;
135
+ if (nodeVersion[0] === 'v') {
136
+ nodeVersion = nodeVersion.slice(1);
137
+ }
138
+ nodeVersion = nodeVersion.slice(0, nodeVersion.lastIndexOf('.'));
139
+ if (koatty_lib.Helper.toNumber(nodeEngines) > koatty_lib.Helper.toNumber(nodeVersion)) {
140
+ Logger.Error(`Koatty need node version > ${nodeEngines}, current version is ${nodeVersion}, please upgrade it.`);
141
+ process.exit(-1);
142
+ }
143
+ }
144
+ /**
145
+ * unittest running environment detection
146
+ * only support jest
147
+ * @returns {boolean}
148
+ */
149
+ const checkUTRuntime = () => {
150
+ let isUTRuntime = false;
151
+ // UT运行环境判断,暂时先只判断jest
152
+ const argv = JSON.stringify(process.argv[1]);
153
+ if (argv.indexOf('jest') > -1) {
154
+ isUTRuntime = true;
155
+ }
156
+ return isUTRuntime;
157
+ };
168
158
 
169
159
  /*
170
160
  * @Description: framework constants
@@ -192,7 +182,7 @@ https://github.com/koatty
192
182
  * @Usage:
193
183
  * @Author: richen
194
184
  * @Date: 2023-12-09 22:55:49
195
- * @LastEditTime: 2024-11-29 18:20:23
185
+ * @LastEditTime: 2025-01-14 16:12:59
196
186
  * @License: BSD (3-Clause)
197
187
  * @Copyright (c): <richenlin(at)gmail.com>
198
188
  */
@@ -216,25 +206,10 @@ class Loader {
216
206
  * @memberof Loader
217
207
  */
218
208
  static initialize(app) {
219
- var _a, _b;
220
- const env = ((_a = process.execArgv) !== null && _a !== void 0 ? _a : []).join(",");
221
- if (env.indexOf('ts-node') > -1 || env.indexOf('--debug') > -1) {
222
- app.appDebug = true;
223
- }
224
- // app.env
225
- app.env = process.env.KOATTY_ENV || process.env.NODE_ENV;
226
- if ((env.indexOf('--production') > -1) || (((_b = app.env) !== null && _b !== void 0 ? _b : '').indexOf('pro') > -1)) {
227
- app.appDebug = false;
228
- }
229
- if (app.appDebug) {
230
- app.env = 'development';
231
- process.env.NODE_ENV = 'development';
232
- process.env.APP_DEBUG = 'true';
209
+ if (app.env == 'development') {
233
210
  Logger.setLevel("debug");
234
211
  }
235
212
  else {
236
- app.env = 'production';
237
- process.env.NODE_ENV = 'production';
238
213
  Logger.setLevel("info");
239
214
  }
240
215
  // define path
@@ -401,7 +376,10 @@ class Loader {
401
376
  }
402
377
  }
403
378
  /**
404
- * LoadAllComponents
379
+ * @description: Load all components
380
+ * @param {KoattyApplication} app
381
+ * @param {any} target
382
+ * @return {*}
405
383
  */
406
384
  static async LoadAllComponents(app, target) {
407
385
  var _a;
@@ -629,7 +607,7 @@ class Loader {
629
607
  * @Usage:
630
608
  * @Author: richen
631
609
  * @Date: 2021-12-09 21:56:32
632
- * @LastEditTime: 2024-11-29 18:13:06
610
+ * @LastEditTime: 2025-01-14 16:11:21
633
611
  * @License: BSD (3-Clause)
634
612
  * @Copyright (c): <richenlin(at)gmail.com>
635
613
  */
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * @Author: richen
3
- * @Date: 2024-12-06 09:38:17
3
+ * @Date: 2025-01-14 16:20:07
4
4
  * @License: BSD (3-Clause)
5
5
  * @Copyright (c) - <richenlin(at)gmail.com>
6
6
  * @HomePage: https://koatty.org/
@@ -12,15 +12,20 @@ export * from 'koatty_container';
12
12
  import { AppEventArr, implementsMiddlewareInterface, implementsControllerInterface, implementsServiceInterface, implementsPluginInterface, implementsAspectInterface, Koatty } from 'koatty_core';
13
13
  export * from 'koatty_core';
14
14
  export * from 'koatty_exception';
15
- import { NewRouter } from 'koatty_router';
16
- export * from 'koatty_router';
17
15
  import { Helper } from 'koatty_lib';
18
16
  export { Helper } from 'koatty_lib';
17
+ import { NewRouter } from 'koatty_router';
18
+ export * from 'koatty_router';
19
19
  import { DefaultLogger } from 'koatty_logger';
20
20
  import { Load } from 'koatty_loader';
21
21
  import { NewServe } from 'koatty_serve';
22
22
  import * as path from 'path';
23
23
 
24
+ var version = "3.11.9";
25
+ var engines = {
26
+ node: ">12.0.0"
27
+ };
28
+
24
29
  /*
25
30
  * @Description: framework logger
26
31
  * @Usage:
@@ -56,63 +61,17 @@ function SetLogger(app, config) {
56
61
  }
57
62
  }
58
63
 
59
- var version = "3.11.7";
60
- var engines = {
61
- node: ">12.0.0"
62
- };
63
-
64
64
  /*
65
- * @Description: framework runtime checker
65
+ * @Description: framework helper
66
66
  * @Usage:
67
67
  * @Author: richen
68
68
  * @Date: 2023-12-09 21:56:32
69
- * @LastEditTime: 2023-12-09 23:01:22
69
+ * @LastEditTime: 2025-01-14 16:14:10
70
70
  * @License: BSD (3-Clause)
71
71
  * @Copyright (c): <richenlin(at)gmail.com>
72
72
  */
73
73
  const KOATTY_VERSION = version;
74
74
  const ENGINES_VERSION = engines.node.slice(1) || '12.0.0';
75
- /**
76
- * check node version
77
- * @return {void} []
78
- */
79
- function checkRuntime() {
80
- let nodeEngines = ENGINES_VERSION;
81
- nodeEngines = nodeEngines.slice(0, nodeEngines.lastIndexOf('.'));
82
- let nodeVersion = process.version;
83
- if (nodeVersion[0] === 'v') {
84
- nodeVersion = nodeVersion.slice(1);
85
- }
86
- nodeVersion = nodeVersion.slice(0, nodeVersion.lastIndexOf('.'));
87
- if (Helper.toNumber(nodeEngines) > Helper.toNumber(nodeVersion)) {
88
- Logger.Error(`Koatty need node version > ${nodeEngines}, current version is ${nodeVersion}, please upgrade it.`);
89
- process.exit(-1);
90
- }
91
- }
92
- /**
93
- * unittest running environment detection
94
- * only support jest
95
- * @returns {boolean}
96
- */
97
- const checkUTRuntime = () => {
98
- let isUTRuntime = false;
99
- // UT运行环境判断,暂时先只判断jest
100
- const argv = JSON.stringify(process.argv[1]);
101
- if (argv.indexOf('jest') > -1) {
102
- isUTRuntime = true;
103
- }
104
- return isUTRuntime;
105
- };
106
-
107
- /*
108
- * @Description: framework helper
109
- * @Usage:
110
- * @Author: richen
111
- * @Date: 2023-12-09 21:56:32
112
- * @LastEditTime: 2024-01-16 01:20:17
113
- * @License: BSD (3-Clause)
114
- * @Copyright (c): <richenlin(at)gmail.com>
115
- */
116
75
  /**
117
76
  * Check class file
118
77
  * name should be always the same as class name
@@ -149,6 +108,37 @@ function checkClass(fileName, xpath, target, exSet) {
149
108
  exSet.add(fileName);
150
109
  return;
151
110
  }
111
+ /**
112
+ * check node version
113
+ * @return {void} []
114
+ */
115
+ function checkRuntime() {
116
+ let nodeEngines = ENGINES_VERSION;
117
+ nodeEngines = nodeEngines.slice(0, nodeEngines.lastIndexOf('.'));
118
+ let nodeVersion = process.version;
119
+ if (nodeVersion[0] === 'v') {
120
+ nodeVersion = nodeVersion.slice(1);
121
+ }
122
+ nodeVersion = nodeVersion.slice(0, nodeVersion.lastIndexOf('.'));
123
+ if (Helper.toNumber(nodeEngines) > Helper.toNumber(nodeVersion)) {
124
+ Logger.Error(`Koatty need node version > ${nodeEngines}, current version is ${nodeVersion}, please upgrade it.`);
125
+ process.exit(-1);
126
+ }
127
+ }
128
+ /**
129
+ * unittest running environment detection
130
+ * only support jest
131
+ * @returns {boolean}
132
+ */
133
+ const checkUTRuntime = () => {
134
+ let isUTRuntime = false;
135
+ // UT运行环境判断,暂时先只判断jest
136
+ const argv = JSON.stringify(process.argv[1]);
137
+ if (argv.indexOf('jest') > -1) {
138
+ isUTRuntime = true;
139
+ }
140
+ return isUTRuntime;
141
+ };
152
142
 
153
143
  /*
154
144
  * @Description: framework constants
@@ -176,7 +166,7 @@ https://github.com/koatty
176
166
  * @Usage:
177
167
  * @Author: richen
178
168
  * @Date: 2023-12-09 22:55:49
179
- * @LastEditTime: 2024-11-29 18:20:23
169
+ * @LastEditTime: 2025-01-14 16:12:59
180
170
  * @License: BSD (3-Clause)
181
171
  * @Copyright (c): <richenlin(at)gmail.com>
182
172
  */
@@ -200,25 +190,10 @@ class Loader {
200
190
  * @memberof Loader
201
191
  */
202
192
  static initialize(app) {
203
- var _a, _b;
204
- const env = ((_a = process.execArgv) !== null && _a !== void 0 ? _a : []).join(",");
205
- if (env.indexOf('ts-node') > -1 || env.indexOf('--debug') > -1) {
206
- app.appDebug = true;
207
- }
208
- // app.env
209
- app.env = process.env.KOATTY_ENV || process.env.NODE_ENV;
210
- if ((env.indexOf('--production') > -1) || (((_b = app.env) !== null && _b !== void 0 ? _b : '').indexOf('pro') > -1)) {
211
- app.appDebug = false;
212
- }
213
- if (app.appDebug) {
214
- app.env = 'development';
215
- process.env.NODE_ENV = 'development';
216
- process.env.APP_DEBUG = 'true';
193
+ if (app.env == 'development') {
217
194
  Logger.setLevel("debug");
218
195
  }
219
196
  else {
220
- app.env = 'production';
221
- process.env.NODE_ENV = 'production';
222
197
  Logger.setLevel("info");
223
198
  }
224
199
  // define path
@@ -385,7 +360,10 @@ class Loader {
385
360
  }
386
361
  }
387
362
  /**
388
- * LoadAllComponents
363
+ * @description: Load all components
364
+ * @param {KoattyApplication} app
365
+ * @param {any} target
366
+ * @return {*}
389
367
  */
390
368
  static async LoadAllComponents(app, target) {
391
369
  var _a;
@@ -613,7 +591,7 @@ class Loader {
613
591
  * @Usage:
614
592
  * @Author: richen
615
593
  * @Date: 2021-12-09 21:56:32
616
- * @LastEditTime: 2024-11-29 18:13:06
594
+ * @LastEditTime: 2025-01-14 16:11:21
617
595
  * @License: BSD (3-Clause)
618
596
  * @Copyright (c): <richenlin(at)gmail.com>
619
597
  */
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koatty",
3
- "version": "3.11.7",
3
+ "version": "3.11.9",
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",
@@ -67,6 +67,7 @@
67
67
  "@types/lodash": "^4.x.x",
68
68
  "@types/node": "^22.x.x",
69
69
  "@types/on-finished": "^2.x.x",
70
+ "@types/supertest": "^6.x.x",
70
71
  "@types/ws": "^8.x.x",
71
72
  "@typescript-eslint/eslint-plugin": "^8.x.x",
72
73
  "@typescript-eslint/parser": "^8.x.x",
@@ -93,7 +94,7 @@
93
94
  "koa": "~2.15.3",
94
95
  "koatty_config": "~1.2.0",
95
96
  "koatty_container": "~1.9.4",
96
- "koatty_core": "~1.11.0",
97
+ "koatty_core": "~1.11.5",
97
98
  "koatty_exception": "~1.5.3",
98
99
  "koatty_lib": "~1.4.0",
99
100
  "koatty_loader": "~1.1.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koatty",
3
- "version": "3.11.7",
3
+ "version": "3.11.9",
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",
@@ -67,6 +67,7 @@
67
67
  "@types/lodash": "^4.x.x",
68
68
  "@types/node": "^22.x.x",
69
69
  "@types/on-finished": "^2.x.x",
70
+ "@types/supertest": "^6.x.x",
70
71
  "@types/ws": "^8.x.x",
71
72
  "@typescript-eslint/eslint-plugin": "^8.x.x",
72
73
  "@typescript-eslint/parser": "^8.x.x",
@@ -93,7 +94,7 @@
93
94
  "koa": "~2.15.3",
94
95
  "koatty_config": "~1.2.0",
95
96
  "koatty_container": "~1.9.4",
96
- "koatty_core": "~1.11.0",
97
+ "koatty_core": "~1.11.5",
97
98
  "koatty_exception": "~1.5.3",
98
99
  "koatty_lib": "~1.4.0",
99
100
  "koatty_loader": "~1.1.0",