@maiyunnet/kebab 2.0.15 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/README.md +1 -5
  2. package/index.d.ts +1 -1
  3. package/index.js +16 -18
  4. package/lib/buffer.js +7 -20
  5. package/lib/captcha.js +6 -44
  6. package/lib/consistent.js +8 -51
  7. package/lib/core.d.ts +4 -4
  8. package/lib/core.js +70 -132
  9. package/lib/crypto.js +43 -99
  10. package/lib/db.d.ts +5 -5
  11. package/lib/db.js +31 -68
  12. package/lib/dns.d.ts +1 -1
  13. package/lib/dns.js +12 -50
  14. package/lib/fs.js +26 -81
  15. package/lib/jwt.d.ts +3 -3
  16. package/lib/jwt.js +9 -50
  17. package/lib/kv.d.ts +4 -4
  18. package/lib/kv.js +31 -69
  19. package/lib/lan.js +4 -41
  20. package/lib/net/cacert.pem +78 -2
  21. package/lib/net/formdata.js +5 -42
  22. package/lib/net/request.d.ts +2 -2
  23. package/lib/net/request.js +3 -42
  24. package/lib/net/response.d.ts +1 -1
  25. package/lib/net/response.js +1 -5
  26. package/lib/net.d.ts +5 -5
  27. package/lib/net.js +24 -73
  28. package/lib/s3.d.ts +1 -1
  29. package/lib/s3.js +23 -62
  30. package/lib/scan.d.ts +3 -3
  31. package/lib/scan.js +10 -50
  32. package/lib/session.d.ts +3 -3
  33. package/lib/session.js +9 -46
  34. package/lib/sql.d.ts +2 -2
  35. package/lib/sql.js +9 -50
  36. package/lib/ssh/sftp.js +5 -46
  37. package/lib/ssh/shell.js +2 -39
  38. package/lib/ssh.d.ts +2 -2
  39. package/lib/ssh.js +5 -43
  40. package/lib/text.d.ts +1 -1
  41. package/lib/text.js +40 -104
  42. package/lib/time.d.ts +1 -1
  43. package/lib/time.js +10 -50
  44. package/lib/turnstile.d.ts +1 -1
  45. package/lib/turnstile.js +6 -43
  46. package/lib/ws.d.ts +10 -2
  47. package/lib/ws.js +70 -53
  48. package/lib/zip.d.ts +1 -1
  49. package/lib/zip.js +10 -57
  50. package/lib/zlib.js +24 -89
  51. package/main.js +6 -44
  52. package/package.json +9 -8
  53. package/sys/child.js +10 -45
  54. package/sys/cmd.js +8 -43
  55. package/sys/ctr.d.ts +5 -5
  56. package/sys/ctr.js +11 -49
  57. package/sys/master.js +11 -46
  58. package/sys/mod.d.ts +9 -5
  59. package/sys/mod.js +28 -214
  60. package/sys/route.d.ts +2 -2
  61. package/sys/route.js +26 -64
  62. package/types/index.d.ts +1 -0
  63. package/www/example/ctr/main.d.ts +1 -1
  64. package/www/example/ctr/main.js +2 -38
  65. package/www/example/ctr/middle.d.ts +2 -2
  66. package/www/example/ctr/middle.js +2 -38
  67. package/www/example/ctr/test.d.ts +2 -2
  68. package/www/example/ctr/test.js +65 -72
  69. package/www/example/mod/test.d.ts +2 -2
  70. package/www/example/mod/test.js +4 -42
  71. package/www/example/mod/testdata.d.ts +1 -1
  72. package/www/example/mod/testdata.js +3 -8
  73. package/www/example/ws/mproxy.d.ts +1 -1
  74. package/www/example/ws/mproxy.js +6 -41
  75. package/www/example/ws/rproxy.d.ts +1 -1
  76. package/www/example/ws/rproxy.js +5 -40
  77. package/www/example/ws/rsocket.d.ts +4 -0
  78. package/www/example/ws/rsocket.js +12 -0
  79. package/www/example/ws/test.d.ts +6 -1
  80. package/www/example/ws/test.js +13 -42
  81. package/eslint.config.js +0 -22
package/lib/zlib.js CHANGED
@@ -1,106 +1,49 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.createGzip = createGzip;
37
- exports.createGunzip = createGunzip;
38
- exports.createDeflate = createDeflate;
39
- exports.createInflate = createInflate;
40
- exports.createBrotliCompress = createBrotliCompress;
41
- exports.createBrotliDecompress = createBrotliDecompress;
42
- exports.createCompress = createCompress;
43
- exports.createDecompress = createDecompress;
44
- exports.gzip = gzip;
45
- exports.gunzip = gunzip;
46
- exports.deflate = deflate;
47
- exports.inflate = inflate;
48
- exports.brotliCompress = brotliCompress;
49
- exports.brotliDecompress = brotliDecompress;
50
- exports.compress = compress;
51
- exports.decompress = decompress;
52
1
  /**
53
2
  * Project: Kebab, User: JianSuoQiYue
54
3
  * Date: 2019-4-9 16:00:55
55
4
  * Last: 2020-03-20 14:45:47, 2022-09-13 13:43:32
56
5
  */
57
- const zlib = __importStar(require("zlib"));
6
+ import * as zlib from 'zlib';
58
7
  /**
59
8
  * --- 创建 Gzip 对象 ---
60
9
  * @param options 选项
61
10
  */
62
- function createGzip(options = {}) {
63
- if (!options.level) {
64
- options.level = 7;
65
- }
11
+ export function createGzip(options = {}) {
12
+ options.level ??= 7;
66
13
  return zlib.createGzip(options);
67
14
  }
68
15
  /**
69
16
  * --- 创建 Gzip 解压对象 ---
70
17
  */
71
- function createGunzip() {
18
+ export function createGunzip() {
72
19
  return zlib.createGunzip();
73
20
  }
74
21
  /**
75
22
  * --- 创建 Deflate 对象 ---
76
23
  * @param options 选项
77
24
  */
78
- function createDeflate(options = {}) {
79
- if (!options.level) {
80
- options.level = 7;
81
- }
25
+ export function createDeflate(options = {}) {
26
+ options.level ??= 7;
82
27
  return zlib.createDeflate(options);
83
28
  }
84
29
  /**
85
30
  * --- 创建 Deflate 解压对象 ---
86
31
  */
87
- function createInflate() {
32
+ export function createInflate() {
88
33
  return zlib.createInflate();
89
34
  }
90
35
  /**
91
36
  * --- 创建 Brotli 压缩对象 ---
92
37
  * @param options 选项
93
38
  */
94
- function createBrotliCompress(options = {}) {
95
- if (!options.level) {
96
- options.level = 7;
97
- }
39
+ export function createBrotliCompress(options = {}) {
40
+ options.level ??= 7;
98
41
  return zlib.createBrotliCompress(options);
99
42
  }
100
43
  /**
101
44
  * --- 创建 Brotli 解压对象 ---
102
45
  */
103
- function createBrotliDecompress() {
46
+ export function createBrotliDecompress() {
104
47
  return zlib.createBrotliDecompress();
105
48
  }
106
49
  /**
@@ -108,10 +51,8 @@ function createBrotliDecompress() {
108
51
  * @param types 用 , 间隔的字符串,如 gzip,deflate
109
52
  * @param options 选项
110
53
  */
111
- function createCompress(types, options = {}) {
112
- if (!options.level) {
113
- options.level = 7;
114
- }
54
+ export function createCompress(types, options = {}) {
55
+ options.level ??= 7;
115
56
  const type = getTypeByTypes(types);
116
57
  if (!type) {
117
58
  return null;
@@ -143,7 +84,7 @@ function createCompress(types, options = {}) {
143
84
  * @param types 用 , 间隔的字符串,如 gzip,deflate
144
85
  * @param options 选项
145
86
  */
146
- function createDecompress(types) {
87
+ export function createDecompress(types) {
147
88
  const type = getTypeByTypes(types);
148
89
  if (!type) {
149
90
  return null;
@@ -175,10 +116,8 @@ function createDecompress(types) {
175
116
  * @param buffer 段
176
117
  * @param options 选项
177
118
  */
178
- function gzip(buffer, options = {}) {
179
- if (!options.level) {
180
- options.level = 7;
181
- }
119
+ export function gzip(buffer, options = {}) {
120
+ options.level ??= 7;
182
121
  return new Promise(function (resolve) {
183
122
  zlib.gzip(buffer, options, function (error, result) {
184
123
  if (error) {
@@ -194,7 +133,7 @@ function gzip(buffer, options = {}) {
194
133
  * Gzip 解压一段
195
134
  * @param buffer 段
196
135
  */
197
- function gunzip(buffer) {
136
+ export function gunzip(buffer) {
198
137
  return new Promise(function (resolve) {
199
138
  zlib.gunzip(buffer, function (error, result) {
200
139
  if (error) {
@@ -211,10 +150,8 @@ function gunzip(buffer) {
211
150
  * @param buffer 段
212
151
  * @param options 选项
213
152
  */
214
- function deflate(buffer, options = {}) {
215
- if (!options.level) {
216
- options.level = 7;
217
- }
153
+ export function deflate(buffer, options = {}) {
154
+ options.level ??= 7;
218
155
  return new Promise(function (resolve) {
219
156
  zlib.deflate(buffer, options, function (error, result) {
220
157
  if (error) {
@@ -230,7 +167,7 @@ function deflate(buffer, options = {}) {
230
167
  * Deflate 解压一段
231
168
  * @param buffer 段
232
169
  */
233
- function inflate(buffer) {
170
+ export function inflate(buffer) {
234
171
  return new Promise(function (resolve) {
235
172
  zlib.inflate(buffer, function (error, result) {
236
173
  if (error) {
@@ -247,10 +184,8 @@ function inflate(buffer) {
247
184
  * @param buffer 段
248
185
  * @param options 选项
249
186
  */
250
- function brotliCompress(buffer, options = {}) {
251
- if (!options.level) {
252
- options.level = 7;
253
- }
187
+ export function brotliCompress(buffer, options = {}) {
188
+ options.level ??= 7;
254
189
  return new Promise(function (resolve) {
255
190
  zlib.brotliCompress(buffer, options, function (error, result) {
256
191
  if (error) {
@@ -266,7 +201,7 @@ function brotliCompress(buffer, options = {}) {
266
201
  * Brotli 解压一段
267
202
  * @param buffer 段
268
203
  */
269
- function brotliDecompress(buffer) {
204
+ export function brotliDecompress(buffer) {
270
205
  return new Promise(function (resolve) {
271
206
  zlib.brotliDecompress(buffer, function (error, result) {
272
207
  if (error) {
@@ -284,7 +219,7 @@ function brotliDecompress(buffer) {
284
219
  * @param buffer 段
285
220
  * @param options 选项
286
221
  */
287
- async function compress(types, buffer, options) {
222
+ export async function compress(types, buffer, options) {
288
223
  if (!buffer) {
289
224
  return null;
290
225
  }
@@ -320,7 +255,7 @@ async function compress(types, buffer, options) {
320
255
  * @param types 用,间隔的字符串,如 gzip,deflate
321
256
  * @param buffer 段
322
257
  */
323
- async function decompress(types, buffer) {
258
+ export async function decompress(types, buffer) {
324
259
  if (!buffer) {
325
260
  return null;
326
261
  }
package/main.js CHANGED
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  /* eslint-disable @typescript-eslint/no-floating-promises */
3
2
  /**
4
3
  * Project: Kebab, User: JianSuoQiYue
@@ -6,58 +5,21 @@
6
5
  * Last: 2020-3-6 22:19:37, 2022-3-30 01:01:22, 2022-9-27 16:11:40, 2025-6-13 12:56:18
7
6
  */
8
7
  // git config core.ignorecase false
9
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- var desc = Object.getOwnPropertyDescriptor(m, k);
12
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
- desc = { enumerable: true, get: function() { return m[k]; } };
14
- }
15
- Object.defineProperty(o, k2, desc);
16
- }) : (function(o, m, k, k2) {
17
- if (k2 === undefined) k2 = k;
18
- o[k2] = m[k];
19
- }));
20
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
- Object.defineProperty(o, "default", { enumerable: true, value: v });
22
- }) : function(o, v) {
23
- o["default"] = v;
24
- });
25
- var __importStar = (this && this.__importStar) || (function () {
26
- var ownKeys = function(o) {
27
- ownKeys = Object.getOwnPropertyNames || function (o) {
28
- var ar = [];
29
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
30
- return ar;
31
- };
32
- return ownKeys(o);
33
- };
34
- return function (mod) {
35
- if (mod && mod.__esModule) return mod;
36
- var result = {};
37
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
38
- __setModuleDefault(result, mod);
39
- return result;
40
- };
41
- })();
42
- var __importDefault = (this && this.__importDefault) || function (mod) {
43
- return (mod && mod.__esModule) ? mod : { "default": mod };
44
- };
45
- Object.defineProperty(exports, "__esModule", { value: true });
46
- const cluster_1 = __importDefault(require("cluster"));
8
+ import cluster from 'cluster';
47
9
  // --- 虽然框架本身不用,但是业务侧会用到,所以这个库不能删 ---
48
- require("ts-alias-loader");
10
+ import 'ts-alias-loader';
49
11
  // --- 初始化 ---
50
12
  // --- 一定要分别隔离加载 Master 和 Child 代码,防止执行串了 ---
51
- if (cluster_1.default.isPrimary) {
13
+ if (cluster.isPrimary) {
52
14
  if (process.argv.length > 2) {
53
15
  // --- 传入的命令方式启动,则执行 RPC 相关命令 ---
54
- Promise.resolve().then(() => __importStar(require('./sys/cmd')));
16
+ import('./sys/cmd.js');
55
17
  }
56
18
  else {
57
19
  // --- 正常启动 ---
58
- Promise.resolve().then(() => __importStar(require('./sys/master')));
20
+ import('./sys/master.js');
59
21
  }
60
22
  }
61
23
  else {
62
- Promise.resolve().then(() => __importStar(require('./sys/child')));
24
+ import('./sys/child.js');
63
25
  }
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@maiyunnet/kebab",
3
- "version": "2.0.15",
3
+ "version": "3.0.0",
4
4
  "description": "Simple, easy-to-use, and fully-featured Node.js framework that is ready-to-use out of the box.",
5
+ "type": "module",
5
6
  "keywords": [
6
7
  "kebab",
7
8
  "node",
@@ -14,8 +15,8 @@
14
15
  "kebab": "./bin/kebab.js"
15
16
  },
16
17
  "dependencies": {
17
- "@aws-sdk/client-s3": "^3.844.0",
18
- "@aws-sdk/lib-storage": "^3.844.0",
18
+ "@aws-sdk/client-s3": "^3.888.0",
19
+ "@aws-sdk/lib-storage": "^3.888.0",
19
20
  "@litert/http-client": "^1.1.2",
20
21
  "@litert/mime": "^0.1.3",
21
22
  "@litert/redis": "^3.0.5",
@@ -23,17 +24,17 @@
23
24
  "@types/ssh2": "^1.15.5",
24
25
  "ejs": "^3.1.10",
25
26
  "jszip": "^3.10.1",
26
- "mysql2": "^3.14.1",
27
- "ssh2": "^1.16.0",
27
+ "mysql2": "^3.14.5",
28
+ "ssh2": "^1.17.0",
28
29
  "svg-captcha": "^1.4.0",
29
- "tencentcloud-sdk-nodejs": "^4.1.74",
30
+ "tencentcloud-sdk-nodejs": "^4.1.116",
30
31
  "ts-alias-loader": "^0.1.5"
31
32
  },
32
33
  "devDependencies": {
33
34
  "@litert/eslint-plugin-rules": "^0.3.1",
34
35
  "@types/ejs": "^3.1.5",
35
- "@types/node": "^24.0.12",
36
+ "@types/node": "^24.5.0",
36
37
  "tsc-alias": "^1.8.16",
37
- "typescript": "^5.8.3"
38
+ "typescript": "^5.9.2"
38
39
  }
39
40
  }
package/sys/child.js CHANGED
@@ -1,55 +1,20 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
1
  /**
37
2
  * Project: Kebab, User: JianSuoQiYue
38
3
  * Date: 2019-5-3 23:54
39
4
  * Last: 2020-3-31 15:01:07, 2020-4-9 22:28:50, 2022-07-22 14:19:46, 2022-9-29 22:11:07, 2023-5-1 18:26:57, 2024-1-12 13:32:00, 2024-3-4 16:49:19
40
5
  */
41
- const http2 = __importStar(require("http2"));
42
- const tls = __importStar(require("tls"));
43
- const http = __importStar(require("http"));
44
- const crypto = __importStar(require("crypto"));
6
+ import * as http2 from 'http2';
7
+ import * as tls from 'tls';
8
+ import * as http from 'http';
9
+ import * as crypto from 'crypto';
45
10
  // --- 库和定义 ---
46
- const fs = __importStar(require("~/lib/fs"));
47
- const lCore = __importStar(require("~/lib/core"));
48
- const lText = __importStar(require("~/lib/text"));
49
- const sCtr = __importStar(require("~/sys/ctr"));
50
- const kebab = __importStar(require("~/index"));
11
+ import * as fs from '../lib/fs.js';
12
+ import * as lCore from '../lib/core.js';
13
+ import * as lText from '../lib/text.js';
14
+ import * as sCtr from '../sys/ctr.js';
15
+ import * as kebab from '../index.js';
51
16
  // --- 初始化 ---
52
- const sRoute = __importStar(require("~/sys/route"));
17
+ import * as sRoute from '../sys/route.js';
53
18
  /** --- 10 秒往主线程发送一次心跳的 Timer --- */
54
19
  const hbTimer = setInterval(function () {
55
20
  if (!process.connected || !process.send) {
package/sys/cmd.js CHANGED
@@ -1,50 +1,15 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
1
  /**
37
2
  * Project: Kebab, User: JianSuoQiYue
38
3
  * Date: 2020-3-7 23:51:15
39
4
  * Last: 2020-3-7 23:51:18, 2022-07-22 14:14:09, 2022-9-27 14:52:19, 2023-5-23 21:42:46, 2024-7-2 15:12:28
40
5
  */
41
- const http = __importStar(require("http"));
42
- const lFs = __importStar(require("~/lib/fs"));
43
- const lText = __importStar(require("~/lib/text"));
44
- const lTime = __importStar(require("~/lib/time"));
45
- const lCore = __importStar(require("~/lib/core"));
46
- const lCrypto = __importStar(require("~/lib/crypto"));
47
- const kebab = __importStar(require("~/index"));
6
+ import * as http from 'http';
7
+ import * as lFs from '../lib/fs.js';
8
+ import * as lText from '../lib/text.js';
9
+ import * as lTime from '../lib/time.js';
10
+ import * as lCore from '../lib/core.js';
11
+ import * as lCrypto from '../lib/crypto.js';
12
+ import * as kebab from '../index.js';
48
13
  /** --- 解析命令 --- */
49
14
  const cmds = process.argv.slice(2);
50
15
  /** --- 批量创建目录 --- */
@@ -229,7 +194,7 @@ async function run() {
229
194
  return;
230
195
  }
231
196
  // --- 载入独立文件入口 ---
232
- Promise.resolve(`${'../ind/' + cmds[1] + '/index'}`).then(s => __importStar(require(s))).catch((e) => {
197
+ import('../ind/' + cmds[1] + '/index.js').catch((e) => {
233
198
  lCore.display('CMD ERROR', 'E', e);
234
199
  });
235
200
  }
package/sys/ctr.d.ts CHANGED
@@ -5,11 +5,11 @@
5
5
  */
6
6
  import * as http from 'http';
7
7
  import * as http2 from 'http2';
8
- import * as session from '../lib/session';
9
- import * as db from '../lib/db';
10
- import * as kv from '../lib/kv';
11
- import * as lWs from '../lib/ws';
12
- import * as types from '../types';
8
+ import * as session from '../lib/session.js';
9
+ import * as db from '../lib/db.js';
10
+ import * as kv from '../lib/kv.js';
11
+ import * as lWs from '../lib/ws.js';
12
+ import * as types from '../types/index.js';
13
13
  /**
14
14
  * --- 清除已经加载的 data 与语言包文件缓存 ---
15
15
  */
package/sys/ctr.js CHANGED
@@ -1,47 +1,10 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.Ctr = void 0;
37
- exports.clearLocaleData = clearLocaleData;
38
- const ejs = __importStar(require("ejs"));
39
- const lCore = __importStar(require("../lib/core"));
40
- const fs = __importStar(require("../lib/fs"));
41
- const crypto = __importStar(require("../lib/crypto"));
42
- const session = __importStar(require("../lib/session"));
43
- const text = __importStar(require("../lib/text"));
44
- const sRoute = __importStar(require("../sys/route"));
1
+ import * as ejs from 'ejs';
2
+ import * as lCore from '../lib/core.js';
3
+ import * as fs from '../lib/fs.js';
4
+ import * as crypto from '../lib/crypto.js';
5
+ import * as session from '../lib/session.js';
6
+ import * as text from '../lib/text.js';
7
+ import * as sRoute from '../sys/route.js';
45
8
  /** --- 已加载的 DATA 数据缓存(不是语言包)-- */
46
9
  let loadedData = {};
47
10
  /** --- 已加载的语言文件列表 --- */
@@ -51,12 +14,12 @@ let localeData = {};
51
14
  /**
52
15
  * --- 清除已经加载的 data 与语言包文件缓存 ---
53
16
  */
54
- function clearLocaleData() {
17
+ export function clearLocaleData() {
55
18
  loadedData = {};
56
19
  localeFiles = [];
57
20
  localeData = {};
58
21
  }
59
- class Ctr {
22
+ export class Ctr {
60
23
  constructor(config, req, res) {
61
24
  /** --- 路由参数序列数组 --- */
62
25
  this._param = [];
@@ -147,9 +110,9 @@ class Ctr {
147
110
  if (!this._waitInfo.asyncTask.count) {
148
111
  this._waitInfo.asyncTask.resolve();
149
112
  }
150
- })().catch(async (e) => {
113
+ })().catch(e => {
151
114
  lCore.display('[ERROR][CTR][ASYNCTASK]', e);
152
- await lCore.log(this, '(ctr.asyncTask)' + text.stringifyJson(e.stack).slice(1, -1), '-error');
115
+ lCore.log(this, '[CTR][_asyncTask] ' + text.stringifyJson(e.stack).slice(1, -1), '-error');
153
116
  --this._waitInfo.asyncTask.count;
154
117
  if (!this._waitInfo.asyncTask.count) {
155
118
  this._waitInfo.asyncTask.resolve();
@@ -782,4 +745,3 @@ class Ctr {
782
745
  return true;
783
746
  }
784
747
  }
785
- exports.Ctr = Ctr;
package/sys/master.js CHANGED
@@ -1,55 +1,20 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
1
  /**
37
2
  * Project: Kebab, User: JianSuoQiYue
38
3
  * Date: 2019-5-2 21:03:42
39
4
  * Last: 2020-3-7 10:33:17, 2022-07-22 13:40:10, 2022-09-06 22:40:58, 2024-2-7 01:44:59, 2024-7-2 15:17:09, 2025-6-13 13:06:43
40
5
  */
41
- const os = __importStar(require("os"));
42
- const cluster = __importStar(require("cluster"));
43
- const http = __importStar(require("http"));
6
+ import * as os from 'os';
7
+ import * as cluster from 'cluster';
8
+ import * as http from 'http';
44
9
  // --- 库和定义 ---
45
- const kebab = __importStar(require("~/index"));
46
- const sRoute = __importStar(require("~/sys/route"));
47
- const lCore = __importStar(require("~/lib/core"));
48
- const lFs = __importStar(require("~/lib/fs"));
49
- const lText = __importStar(require("~/lib/text"));
50
- const lCrypto = __importStar(require("~/lib/crypto"));
51
- const lTime = __importStar(require("~/lib/time"));
52
- const lZip = __importStar(require("~/lib/zip"));
10
+ import * as kebab from '../index.js';
11
+ import * as sRoute from '../sys/route.js';
12
+ import * as lCore from '../lib/core.js';
13
+ import * as lFs from '../lib/fs.js';
14
+ import * as lText from '../lib/text.js';
15
+ import * as lCrypto from '../lib/crypto.js';
16
+ import * as lTime from '../lib/time.js';
17
+ import * as lZip from '../lib/zip.js';
53
18
  /** --- 当前运行中的子进程列表 --- */
54
19
  const workerList = {};
55
20
  /**
package/sys/mod.d.ts CHANGED
@@ -3,10 +3,14 @@
3
3
  * Date: 2019-6-4 21:35
4
4
  * Last: 2020-4-14 13:33:51, 2022-07-23 16:01:34, 2022-09-06 22:59:26, 2023-5-24 19:11:37, 2023-6-13 21:47:58, 2023-7-10 18:54:03, 2023-8-23 17:03:16, 2023-12-11 15:21:22, 2023-12-20 23:12:03, 2024-3-8 16:05:29, 2024-3-20 19:58:15, 2024-8-11 21:14:54, 2024-10-5 14:00:22, 2024-12-14 19:58:34
5
5
  */
6
- import * as lSql from '~/lib/sql';
7
- import * as lDb from '~/lib/db';
8
- import * as sCtr from '~/sys/ctr';
9
- import * as types from '~/types';
6
+ import * as lSql from '../lib/sql.js';
7
+ import * as lDb from '../lib/db.js';
8
+ import * as sCtr from '../sys/ctr.js';
9
+ import * as types from '../types/index.js';
10
+ /** --- 只获取变量 --- */
11
+ type TOnlyProperties<T> = {
12
+ [K in keyof T as T[K] extends (...args: any[]) => any ? never : K]: T[K];
13
+ };
10
14
  /** --- 条数列表 --- */
11
15
  declare class Rows<T extends Mod> implements types.Rows<T> {
12
16
  private readonly _items;
@@ -450,7 +454,7 @@ export default class Mod {
450
454
  /**
451
455
  * --- 获取值对象 ---
452
456
  */
453
- toArray(): Record<string, any>;
457
+ toArray<TC extends abstract new (...args: any) => any>(): TOnlyProperties<InstanceType<TC>> & Record<string, any>;
454
458
  /**
455
459
  * --- 获取当前设置要提交的数据 ---
456
460
  */