node-karin 1.0.12 → 1.1.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # 更新日志
2
2
 
3
+ ## [1.1.0](https://github.com/KarinJS/Karin/compare/core-v1.0.12...core-v1.1.0) (2025-01-16)
4
+
5
+
6
+ ### ✨ Features
7
+
8
+ * 中间件 ([baa34b3](https://github.com/KarinJS/Karin/commit/baa34b35681f665a556a3beb596eb418733840e0))
9
+
10
+
11
+ ### 🐛 Bug Fixes
12
+
13
+ * scripts ([ac0be5f](https://github.com/KarinJS/Karin/commit/ac0be5f047f8be9da565f2ed1d77dc687a5619ad))
14
+ * types ([5fda871](https://github.com/KarinJS/Karin/commit/5fda871ec5fece444914214822e833ad7b8afef8))
15
+ * update TypeScript configuration and enhance console API for file handling ([b5d8d45](https://github.com/KarinJS/Karin/commit/b5d8d453182e67b5880c21d06c634a350eb9b2df))
16
+
17
+
18
+ ### 🎫 Chores
19
+
20
+ * update configuration files and enhance CLI commands ([c01a8db](https://github.com/KarinJS/Karin/commit/c01a8dbc58ecaf308e6dde26c59be901efbab1a6))
21
+
3
22
  ## [1.0.12](https://github.com/KarinJS/Karin/compare/core-v1.0.11...core-v1.0.12) (2025-01-16)
4
23
 
5
24
 
@@ -103,18 +103,29 @@ var pm2 = {
103
103
  stop,
104
104
  restart
105
105
  };
106
+ var isDev = false;
106
107
  var dir = process.env.INIT_CWD || process.cwd();
107
108
  var pkgDir = url.fileURLToPath(new url.URL("../..", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))));
109
+ var isPluginDev = () => {
110
+ const pkg = fs2__default.default.readFileSync(path2__default.default.join(dir, "package.json"), "utf-8");
111
+ const data = JSON.parse(pkg);
112
+ if (data == null ? undefined : data.karin) return true;
113
+ if (fs2__default.default.existsSync(path2__default.default.join(dir, "src"))) return true;
114
+ if (fs2__default.default.existsSync(path2__default.default.join(dir, "tsconfig.json"))) return true;
115
+ if (fs2__default.default.existsSync(path2__default.default.join(dir, ".prettierrc"))) return true;
116
+ if (fs2__default.default.existsSync(path2__default.default.join(dir, "eslint.config.mjs"))) return true;
117
+ return false;
118
+ };
108
119
  var createDir = () => {
109
120
  const list = [
110
- path2__default.default.join(dir, "plugins", "karin-plugin-example"),
111
121
  path2__default.default.join(dir, "@karinjs", "logs"),
112
122
  path2__default.default.join(dir, "@karinjs", "config"),
113
123
  path2__default.default.join(dir, "@karinjs", "data"),
124
+ path2__default.default.join(dir, "@karinjs", "resource"),
114
125
  path2__default.default.join(dir, "@karinjs", "temp", "console"),
115
- path2__default.default.join(dir, "@karinjs", "temp", "html"),
116
- path2__default.default.join(dir, "@karinjs", "resource")
126
+ path2__default.default.join(dir, "@karinjs", "temp", "html")
117
127
  ];
128
+ isDev && list.push(path2__default.default.join(dir, "plugins", "karin-plugin-example"));
118
129
  list.forEach((item) => {
119
130
  if (!fs2__default.default.existsSync(item)) fs2__default.default.mkdirSync(item, { recursive: true });
120
131
  });
@@ -174,7 +185,10 @@ var createOrUpdateNpmrc = (dir2) => {
174
185
  var createOrUpdateEnv = (dir2) => {
175
186
  const generateRandomKey = () => {
176
187
  const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
177
- return Array.from({ length: 6 }, () => chars.charAt(Math.floor(Math.random() * chars.length))).join("");
188
+ return Array.from(
189
+ { length: 6 },
190
+ () => chars.charAt(Math.floor(Math.random() * chars.length))
191
+ ).join("");
178
192
  };
179
193
  const envData = [
180
194
  "# \u662F\u5426\u542F\u7528HTTP",
@@ -234,8 +248,8 @@ var createWorkspace = (dir2) => {
234
248
  fs2__default.default.writeFileSync(workspace, content);
235
249
  };
236
250
  var createOtherFile = async () => {
237
- createPnpmFile(dir);
238
- createWorkspace(dir);
251
+ isDev && createPnpmFile(dir);
252
+ isDev && createWorkspace(dir);
239
253
  if (!shouldSkipNpmrc()) {
240
254
  createOrUpdateNpmrc(dir);
241
255
  }
@@ -265,14 +279,7 @@ var modifyPackageJson = () => {
265
279
  data.type = "module";
266
280
  if (!data.scripts) data.scripts = {};
267
281
  data.scripts.karin = "karin";
268
- const list = [
269
- "app",
270
- "start",
271
- "pm2",
272
- "stop",
273
- "rs",
274
- "log"
275
- ];
282
+ const list = ["app", "start", "pm2", "stop", "rs", "log"];
276
283
  list.forEach((v) => {
277
284
  data.scripts[v] = `karin ${v}`;
278
285
  });
@@ -280,6 +287,7 @@ var modifyPackageJson = () => {
280
287
  return data;
281
288
  };
282
289
  var init = async () => {
290
+ isDev = isPluginDev();
283
291
  createDir();
284
292
  await createOtherFile();
285
293
  createConfig();
@@ -323,53 +331,6 @@ var start2 = async (env) => {
323
331
  });
324
332
  child.on("exit", (code) => process.exit(code));
325
333
  };
326
- var dev = async (env) => {
327
- loadEnv(env);
328
- const index = "../root.js";
329
- process.env.NODE_ENV = "development";
330
- const { karinMain } = await import(index);
331
- await import(url.pathToFileURL(karinMain).toString());
332
- };
333
- var tsStart = async (env) => {
334
- loadEnv(env);
335
- process.env.RUNTIME = "tsx";
336
- process.env.NODE_ENV = "development";
337
- const index = "../root.js";
338
- const { karinMain } = await import(index);
339
- const child = child_process.spawn("npx", ["tsx", karinMain], {
340
- stdio: "inherit",
341
- shell: true
342
- });
343
- child.on("exit", (code) => process.exit(code ?? 0));
344
- };
345
- var tsWatch = async (options) => {
346
- loadEnv(options.env);
347
- process.env.NODE_ENV = "development";
348
- const index = "../root.js";
349
- const { karinMain } = await import(index);
350
- const args = ["tsx", "watch"];
351
- if (options.include) {
352
- options.include.split(",").forEach((pattern) => {
353
- args.push("--include", pattern.trim());
354
- });
355
- }
356
- if (options.exclude) {
357
- options.exclude.split(",").forEach((pattern) => {
358
- args.push("--exclude", pattern.trim());
359
- });
360
- }
361
- if (!options.clearScreen) {
362
- args.push("--clear-screen=false");
363
- }
364
- args.push(karinMain);
365
- process.env.RUNTIME = "tsx";
366
- process.env.TSX_WATCH = "true";
367
- const child = child_process.spawn("npx", args, {
368
- stdio: "inherit",
369
- shell: true
370
- });
371
- child.on("exit", (code) => process.exit(code ?? 0));
372
- };
373
334
  var checkGitInstalled = async () => {
374
335
  try {
375
336
  const { status } = await exec("git --version");
@@ -502,25 +463,11 @@ commander.program.command("rs").description("\u91CD\u542Fpm2\u670D\u52A1").actio
502
463
  commander.program.command("log").description("\u67E5\u770B\u65E5\u5FD7").action(pm2.log);
503
464
  commander.program.command("up").description("\u66F4\u65B0\u63D2\u4EF6").action(updateAll);
504
465
  commander.program.command("init").description("\u521D\u59CB\u5316\u9879\u76EE").action(init);
505
- addEnvOption(commander.program.command(".").description("\u524D\u53F0\u542F\u52A8")).action((options) => start2(options.env));
506
- addEnvOption(commander.program.command("app").description("\u524D\u53F0\u542F\u52A8")).action((options) => start2(options.env));
507
- addEnvOption(commander.program.command("start").description("\u524D\u53F0\u542F\u52A8")).action((options) => start2(options.env));
508
- addEnvOption(commander.program.command("dev").description("JavaScript\u5F00\u53D1\u6A21\u5F0F")).action((options) => dev(options.env));
509
- addEnvOption(
510
- commander.program.command("ts").description("TypeScript\u5F00\u53D1\u6A21\u5F0F").addHelpText("after", `
511
- \u793A\u4F8B:
512
- $ karin ts # \u4F7F\u7528\u9ED8\u8BA4 .env \u6587\u4EF6\u542F\u52A8
513
- $ karin ts -e .env.dev # \u4F7F\u7528\u6307\u5B9A\u7684\u73AF\u5883\u53D8\u91CF\u6587\u4EF6\u542F\u52A8
514
- $ karin ts -e .env.dev,.env.local # \u4F7F\u7528\u591A\u4E2A\u73AF\u5883\u53D8\u91CF\u6587\u4EF6\u542F\u52A8
515
- `)
516
- ).action((options) => tsStart(options.env));
517
- addEnvOption(
518
- commander.program.command("watch").description("TypeScript\u76D1\u89C6\u6A21\u5F0F").option("--include <patterns>", "\u6DFB\u52A0\u8981\u76D1\u89C6\u7684\u6587\u4EF6/\u76EE\u5F55\uFF0C\u591A\u4E2A\u7528\u9017\u53F7\u5206\u9694").option("--exclude <patterns>", "\u6392\u9664\u8981\u76D1\u89C6\u7684\u6587\u4EF6/\u76EE\u5F55\uFF0C\u591A\u4E2A\u7528\u9017\u53F7\u5206\u9694").option("--clear-screen", "\u91CD\u65B0\u8FD0\u884C\u65F6\u662F\u5426\u6E05\u5C4F", true).addHelpText("after", `
519
- \u793A\u4F8B:
520
- $ karin watch # \u9ED8\u8BA4\u76D1\u89C6\u6A21\u5F0F
521
- $ karin watch --include src # \u76D1\u89C6 src \u76EE\u5F55
522
- $ karin watch --exclude node_modules,dist # \u6392\u9664\u6307\u5B9A\u76EE\u5F55
523
- $ karin watch --no-clear-screen # \u7981\u7528\u6E05\u5C4F
524
- `)
525
- ).action((options) => tsWatch(options));
466
+ addEnvOption(commander.program.command(".").description("\u524D\u53F0\u542F\u52A8")).action(
467
+ (options) => start2(options.env)
468
+ );
469
+ addEnvOption(commander.program.command("app").description("\u524D\u53F0\u542F\u52A8")).action(
470
+ (options) => start2(options.env)
471
+ );
472
+ addEnvOption(commander.program.command("start").description("\u524D\u53F0\u542F\u52A8"));
526
473
  commander.program.parse(process.argv);
package/dist/cli/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import fs2 from 'node:fs';
3
- import { fileURLToPath, URL as URL$1, pathToFileURL } from 'node:url';
3
+ import { fileURLToPath, URL as URL$1 } from 'node:url';
4
4
  import path2, { join } from 'node:path';
5
5
  import { fork, spawn, execSync as execSync$1, exec as exec$1 } from 'node:child_process';
6
6
  import dotenv from 'dotenv';
@@ -94,18 +94,29 @@ var pm2 = {
94
94
  stop,
95
95
  restart
96
96
  };
97
+ var isDev = false;
97
98
  var dir = process.env.INIT_CWD || process.cwd();
98
99
  var pkgDir = fileURLToPath(new URL$1("../..", import.meta.url));
100
+ var isPluginDev = () => {
101
+ const pkg = fs2.readFileSync(path2.join(dir, "package.json"), "utf-8");
102
+ const data = JSON.parse(pkg);
103
+ if (data == null ? undefined : data.karin) return true;
104
+ if (fs2.existsSync(path2.join(dir, "src"))) return true;
105
+ if (fs2.existsSync(path2.join(dir, "tsconfig.json"))) return true;
106
+ if (fs2.existsSync(path2.join(dir, ".prettierrc"))) return true;
107
+ if (fs2.existsSync(path2.join(dir, "eslint.config.mjs"))) return true;
108
+ return false;
109
+ };
99
110
  var createDir = () => {
100
111
  const list = [
101
- path2.join(dir, "plugins", "karin-plugin-example"),
102
112
  path2.join(dir, "@karinjs", "logs"),
103
113
  path2.join(dir, "@karinjs", "config"),
104
114
  path2.join(dir, "@karinjs", "data"),
115
+ path2.join(dir, "@karinjs", "resource"),
105
116
  path2.join(dir, "@karinjs", "temp", "console"),
106
- path2.join(dir, "@karinjs", "temp", "html"),
107
- path2.join(dir, "@karinjs", "resource")
117
+ path2.join(dir, "@karinjs", "temp", "html")
108
118
  ];
119
+ isDev && list.push(path2.join(dir, "plugins", "karin-plugin-example"));
109
120
  list.forEach((item) => {
110
121
  if (!fs2.existsSync(item)) fs2.mkdirSync(item, { recursive: true });
111
122
  });
@@ -165,7 +176,10 @@ var createOrUpdateNpmrc = (dir2) => {
165
176
  var createOrUpdateEnv = (dir2) => {
166
177
  const generateRandomKey = () => {
167
178
  const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
168
- return Array.from({ length: 6 }, () => chars.charAt(Math.floor(Math.random() * chars.length))).join("");
179
+ return Array.from(
180
+ { length: 6 },
181
+ () => chars.charAt(Math.floor(Math.random() * chars.length))
182
+ ).join("");
169
183
  };
170
184
  const envData = [
171
185
  "# \u662F\u5426\u542F\u7528HTTP",
@@ -225,8 +239,8 @@ var createWorkspace = (dir2) => {
225
239
  fs2.writeFileSync(workspace, content);
226
240
  };
227
241
  var createOtherFile = async () => {
228
- createPnpmFile(dir);
229
- createWorkspace(dir);
242
+ isDev && createPnpmFile(dir);
243
+ isDev && createWorkspace(dir);
230
244
  if (!shouldSkipNpmrc()) {
231
245
  createOrUpdateNpmrc(dir);
232
246
  }
@@ -256,14 +270,7 @@ var modifyPackageJson = () => {
256
270
  data.type = "module";
257
271
  if (!data.scripts) data.scripts = {};
258
272
  data.scripts.karin = "karin";
259
- const list = [
260
- "app",
261
- "start",
262
- "pm2",
263
- "stop",
264
- "rs",
265
- "log"
266
- ];
273
+ const list = ["app", "start", "pm2", "stop", "rs", "log"];
267
274
  list.forEach((v) => {
268
275
  data.scripts[v] = `karin ${v}`;
269
276
  });
@@ -271,6 +278,7 @@ var modifyPackageJson = () => {
271
278
  return data;
272
279
  };
273
280
  var init = async () => {
281
+ isDev = isPluginDev();
274
282
  createDir();
275
283
  await createOtherFile();
276
284
  createConfig();
@@ -314,53 +322,6 @@ var start2 = async (env) => {
314
322
  });
315
323
  child.on("exit", (code) => process.exit(code));
316
324
  };
317
- var dev = async (env) => {
318
- loadEnv(env);
319
- const index = "../root.js";
320
- process.env.NODE_ENV = "development";
321
- const { karinMain } = await import(index);
322
- await import(pathToFileURL(karinMain).toString());
323
- };
324
- var tsStart = async (env) => {
325
- loadEnv(env);
326
- process.env.RUNTIME = "tsx";
327
- process.env.NODE_ENV = "development";
328
- const index = "../root.js";
329
- const { karinMain } = await import(index);
330
- const child = spawn("npx", ["tsx", karinMain], {
331
- stdio: "inherit",
332
- shell: true
333
- });
334
- child.on("exit", (code) => process.exit(code ?? 0));
335
- };
336
- var tsWatch = async (options) => {
337
- loadEnv(options.env);
338
- process.env.NODE_ENV = "development";
339
- const index = "../root.js";
340
- const { karinMain } = await import(index);
341
- const args = ["tsx", "watch"];
342
- if (options.include) {
343
- options.include.split(",").forEach((pattern) => {
344
- args.push("--include", pattern.trim());
345
- });
346
- }
347
- if (options.exclude) {
348
- options.exclude.split(",").forEach((pattern) => {
349
- args.push("--exclude", pattern.trim());
350
- });
351
- }
352
- if (!options.clearScreen) {
353
- args.push("--clear-screen=false");
354
- }
355
- args.push(karinMain);
356
- process.env.RUNTIME = "tsx";
357
- process.env.TSX_WATCH = "true";
358
- const child = spawn("npx", args, {
359
- stdio: "inherit",
360
- shell: true
361
- });
362
- child.on("exit", (code) => process.exit(code ?? 0));
363
- };
364
325
  var checkGitInstalled = async () => {
365
326
  try {
366
327
  const { status } = await exec("git --version");
@@ -493,25 +454,11 @@ program.command("rs").description("\u91CD\u542Fpm2\u670D\u52A1").action(pm2.rest
493
454
  program.command("log").description("\u67E5\u770B\u65E5\u5FD7").action(pm2.log);
494
455
  program.command("up").description("\u66F4\u65B0\u63D2\u4EF6").action(updateAll);
495
456
  program.command("init").description("\u521D\u59CB\u5316\u9879\u76EE").action(init);
496
- addEnvOption(program.command(".").description("\u524D\u53F0\u542F\u52A8")).action((options) => start2(options.env));
497
- addEnvOption(program.command("app").description("\u524D\u53F0\u542F\u52A8")).action((options) => start2(options.env));
498
- addEnvOption(program.command("start").description("\u524D\u53F0\u542F\u52A8")).action((options) => start2(options.env));
499
- addEnvOption(program.command("dev").description("JavaScript\u5F00\u53D1\u6A21\u5F0F")).action((options) => dev(options.env));
500
- addEnvOption(
501
- program.command("ts").description("TypeScript\u5F00\u53D1\u6A21\u5F0F").addHelpText("after", `
502
- \u793A\u4F8B:
503
- $ karin ts # \u4F7F\u7528\u9ED8\u8BA4 .env \u6587\u4EF6\u542F\u52A8
504
- $ karin ts -e .env.dev # \u4F7F\u7528\u6307\u5B9A\u7684\u73AF\u5883\u53D8\u91CF\u6587\u4EF6\u542F\u52A8
505
- $ karin ts -e .env.dev,.env.local # \u4F7F\u7528\u591A\u4E2A\u73AF\u5883\u53D8\u91CF\u6587\u4EF6\u542F\u52A8
506
- `)
507
- ).action((options) => tsStart(options.env));
508
- addEnvOption(
509
- program.command("watch").description("TypeScript\u76D1\u89C6\u6A21\u5F0F").option("--include <patterns>", "\u6DFB\u52A0\u8981\u76D1\u89C6\u7684\u6587\u4EF6/\u76EE\u5F55\uFF0C\u591A\u4E2A\u7528\u9017\u53F7\u5206\u9694").option("--exclude <patterns>", "\u6392\u9664\u8981\u76D1\u89C6\u7684\u6587\u4EF6/\u76EE\u5F55\uFF0C\u591A\u4E2A\u7528\u9017\u53F7\u5206\u9694").option("--clear-screen", "\u91CD\u65B0\u8FD0\u884C\u65F6\u662F\u5426\u6E05\u5C4F", true).addHelpText("after", `
510
- \u793A\u4F8B:
511
- $ karin watch # \u9ED8\u8BA4\u76D1\u89C6\u6A21\u5F0F
512
- $ karin watch --include src # \u76D1\u89C6 src \u76EE\u5F55
513
- $ karin watch --exclude node_modules,dist # \u6392\u9664\u6307\u5B9A\u76EE\u5F55
514
- $ karin watch --no-clear-screen # \u7981\u7528\u6E05\u5C4F
515
- `)
516
- ).action((options) => tsWatch(options));
457
+ addEnvOption(program.command(".").description("\u524D\u53F0\u542F\u52A8")).action(
458
+ (options) => start2(options.env)
459
+ );
460
+ addEnvOption(program.command("app").description("\u524D\u53F0\u542F\u52A8")).action(
461
+ (options) => start2(options.env)
462
+ );
463
+ addEnvOption(program.command("start").description("\u524D\u53F0\u542F\u52A8"));
517
464
  program.parse(process.argv);
package/dist/index.d.ts CHANGED
@@ -8073,11 +8073,14 @@ declare namespace fs {
8073
8073
  }
8074
8074
 
8075
8075
  type index$3_CacheEntry<T = any> = CacheEntry<T>;
8076
+ declare const index$3_EVENT_COUNT: typeof EVENT_COUNT;
8076
8077
  type index$3_Parser = Parser;
8077
8078
  type index$3_PkgData = PkgData;
8079
+ declare const index$3_RECV_MSG: typeof RECV_MSG;
8078
8080
  type index$3_RequireFunction = RequireFunction;
8079
8081
  type index$3_RequireFunctionSync = RequireFunctionSync;
8080
8082
  type index$3_RequireOptions = RequireOptions;
8083
+ declare const index$3_SEND_MSG: typeof SEND_MSG;
8081
8084
  type index$3_Watch<T> = Watch<T>;
8082
8085
  declare const index$3_Watch: typeof Watch;
8083
8086
  type index$3_Watcher<T> = Watcher<T>;
@@ -8145,7 +8148,7 @@ declare const index$3_writeJson: typeof writeJson;
8145
8148
  declare const index$3_writeJsonSync: typeof writeJsonSync;
8146
8149
  declare const index$3_yaml: typeof yaml;
8147
8150
  declare namespace index$3 {
8148
- export { type index$3_CacheEntry as CacheEntry, type index$3_Parser as Parser, type index$3_PkgData as PkgData, type index$3_RequireFunction as RequireFunction, type index$3_RequireFunctionSync as RequireFunctionSync, type index$3_RequireOptions as RequireOptions, index$3_Watch as Watch, index$3_Watcher as Watcher, type index$3_YamlComment as YamlComment, index$3_YamlEditor as YamlEditor, type index$3_YamlValue as YamlValue, index$3_absPath as absPath, index$3_applyComments as applyComments, index$3_base64 as base64, index$3_buffer as buffer, index$3_clearRequire as clearRequire, index$3_clearRequireFile as clearRequireFile, index$3_comment as comment, index$3_copyConfig as copyConfig, index$3_copyConfigSync as copyConfigSync, index$3_copyFiles as copyFiles, index$3_copyFilesSync as copyFilesSync, index$3_createPluginDir as createPluginDir, index$3_downFile as downFile, index$3_existToMkdir as existToMkdir, index$3_existToMkdirSync as existToMkdirSync, index$3_exists as exists, index$3_existsSync as existsSync, fs as file, index$3_filesByExt as filesByExt, index$3_getFiles as getFiles, index$3_getPluginInfo as getPluginInfo, index$3_getRelPath as getRelPath, index$3_isDir as isDir, index$3_isDirSync as isDirSync, index$3_isFile as isFile, index$3_isFileSync as isFileSync, index$3_isPlugin as isPlugin, index$3_isStatic as isStatic, index$3_isSubPath as isSubPath, json$1 as json, index$3_key as key, index$3_lock as lock, index$3_lockMethod as lockMethod, index$3_lockProp as lockProp, index$3_log as log, index$3_logs as logs, index$3_mkdir as mkdir, index$3_mkdirSync as mkdirSync, index$3_parseChangelog as parseChangelog, index$3_pkgRoot as pkgRoot, index$3_randomStr as randomStr, index$3_range as range, index$3_read as read, index$3_readFile as readFile, index$3_readJson as readJson, index$3_readJsonSync as readJsonSync, index$3_requireFile as requireFile, index$3_requireFileSync as requireFileSync, index$3_rmSync as rmSync, index$3_save as save, index$3_sep as sep, index$3_splitPath as splitPath, index$3_stream as stream, index$3_urlToPath as urlToPath, index$3_watch as watch, index$3_watchAndMerge as watchAndMerge, index$3_write as write, index$3_writeJson as writeJson, index$3_writeJsonSync as writeJsonSync, index$3_yaml as yaml };
8151
+ export { type index$3_CacheEntry as CacheEntry, index$3_EVENT_COUNT as EVENT_COUNT, type index$3_Parser as Parser, type index$3_PkgData as PkgData, index$3_RECV_MSG as RECV_MSG, type index$3_RequireFunction as RequireFunction, type index$3_RequireFunctionSync as RequireFunctionSync, type index$3_RequireOptions as RequireOptions, index$3_SEND_MSG as SEND_MSG, index$3_Watch as Watch, index$3_Watcher as Watcher, type index$3_YamlComment as YamlComment, index$3_YamlEditor as YamlEditor, type index$3_YamlValue as YamlValue, index$3_absPath as absPath, index$3_applyComments as applyComments, index$3_base64 as base64, index$3_buffer as buffer, index$3_clearRequire as clearRequire, index$3_clearRequireFile as clearRequireFile, index$3_comment as comment, index$3_copyConfig as copyConfig, index$3_copyConfigSync as copyConfigSync, index$3_copyFiles as copyFiles, index$3_copyFilesSync as copyFilesSync, index$3_createPluginDir as createPluginDir, index$3_downFile as downFile, index$3_existToMkdir as existToMkdir, index$3_existToMkdirSync as existToMkdirSync, index$3_exists as exists, index$3_existsSync as existsSync, fs as file, index$3_filesByExt as filesByExt, index$3_getFiles as getFiles, index$3_getPluginInfo as getPluginInfo, index$3_getRelPath as getRelPath, index$3_isDir as isDir, index$3_isDirSync as isDirSync, index$3_isFile as isFile, index$3_isFileSync as isFileSync, index$3_isPlugin as isPlugin, index$3_isStatic as isStatic, index$3_isSubPath as isSubPath, json$1 as json, index$3_key as key, index$3_lock as lock, index$3_lockMethod as lockMethod, index$3_lockProp as lockProp, index$3_log as log, index$3_logs as logs, index$3_mkdir as mkdir, index$3_mkdirSync as mkdirSync, index$3_parseChangelog as parseChangelog, index$3_pkgRoot as pkgRoot, index$3_randomStr as randomStr, index$3_range as range, index$3_read as read, index$3_readFile as readFile, index$3_readJson as readJson, index$3_readJsonSync as readJsonSync, index$3_requireFile as requireFile, index$3_requireFileSync as requireFileSync, index$3_rmSync as rmSync, index$3_save as save, index$3_sep as sep, index$3_splitPath as splitPath, index$3_stream as stream, index$3_urlToPath as urlToPath, index$3_watch as watch, index$3_watchAndMerge as watchAndMerge, index$3_write as write, index$3_writeJson as writeJson, index$3_writeJsonSync as writeJsonSync, index$3_yaml as yaml };
8149
8152
  }
8150
8153
 
8151
8154
  /**
@@ -9822,4 +9825,4 @@ declare const renderTpl: (options: Omit<Options, "name"> & {
9822
9825
  name?: string;
9823
9826
  };
9824
9827
 
9825
- export { type Accept, type AccountInfo, type Adapter, AdapterBase, type AdapterCommunication, AdapterConsole, type AdapterInfo, AdapterOneBot, type AdapterOptions, type AdapterPlatform, type AdapterProtocol, type AdapterStandard, type AdapterType, type Adapters, type AllPluginMethods, type AnonymousSegment, type Apps, type AtElement, type AtSegment, type BaseContact, BaseEvent, type BaseEventOptions, type BaseEventType, type BasketballElement, Bot, type BoundingBox, type BubbleFaceElement, type Button, type ButtonElement, type Cache, type CacheEntry, type CmdFnc, type Command, type CommandClass, type Config, type Contact, type ContactElement, type ContactSegment, type Count, type CreateGroupFolderResponse, type CustomMusicElement, type CustomMusicSegment, type CustomNodeElement, type CustomNodeSegments, type DiceElement, type DiceSegment, type DirectContact, DirectMessage, type DirectMessageOptions, type DirectNodeElement, type DirectNodeSegment, type DirectSender, type DownloadFileOptions, type DownloadFileResponse, type ElementTypes, type Elements, type Event, type EventParent, type EventToSubEvent, type ExecOptions, type ExecReturn, type ExecType, type FaceElement, type FaceSegment, type FileList, type FileListMap, type FileSegment, type FileToUrlHandler, type FileToUrlResult, type ForwardOptions, type ForwardSegment, type FriendContact, FriendDecreaseNotice, type FriendDecreaseOptions, FriendIncreaseNotice, type FriendIncreaseOptions, FriendMessage, type FriendMessageOptions, type FriendNoticeEventMap, type FriendRequestEventMap, type FriendSender, type GetAtAllCountResponse, type GetBot, type GetGroupFileListResponse, type GetGroupFileSystemInfoResponse, type GetGroupHighlightsResponse, type GetGroupInfo, type GetGroupMemberInfo, type GetGroupMuteListResponse, type GetMsg, type GetPluginReturn, type GetPluginType, type GiftElement, type GoToOptions, GroupAdminChangedNotice, type GroupAdminChangedOptions, GroupApplyRequest, type GroupApplyRequestOptions, GroupCardChangedNotice, type GroupCardChangedOptions, type GroupContact, GroupFileUploadedNotice, type GroupFileUploadedOptions, GroupHlightsChangedNotice, type GroupHlightsChangedOptions, GroupHonorChangedNotice, type GroupHonorChangedOptions, type GroupInfo, GroupInviteRequest, type GroupInviteRequestOptions, GroupLuckKingNotice, type GroupLuckKingOptions, GroupMemberBanNotice, type GroupMemberBanOptions, GroupMemberDecreaseNotice, type GroupMemberDecreaseOptions, GroupMemberIncreaseNotice, type GroupMemberIncreaseOptions, type GroupMemberInfo, GroupMemberTitleUpdatedNotice, type GroupMemberUniqueTitleChangedOptions, GroupMessage, type GroupMessageOptions, GroupMessageReactionNotice, type GroupMessageReactionOptions, GroupNotice, type GroupNoticeEventMap, GroupPokeNotice, type GroupPokeOptions, GroupRecallNotice, type GroupRecallOptions, type GroupRequestEventMap, type GroupSender, GroupSignInNotice, type GroupSignInOptions, type GroupTempContact, GroupTempMessage, type GroupTempMessageOptions, type GroupTempSender, GroupWholeBanNotice, type GroupWholeBanOptions, type Groups, type GuildContact, GuildMessage, type GuildMessageOptions, type GuildSender, type Handler, type HandlerType, type HonorInfoList, type ImageElement, type ImageSegment, type JsonElement, type JsonSegment, type KarinButton, type KeyboardElement, type LocationElement, type LocationSegment, type Log, type Logger, type LoggerExpand, type LoggerLevel, type LoggerOptions, type LongMsgElement, type MarkdownElement, type MarkdownTplElement, type MarketFaceElement, type Message$2 as Message, MessageBase, type MessageEventMap, type MessageEventSub, type MessageOptions, type MessageResponse, type MetaEventBase, type MusicElement, type MusicPlatform, type MusicSegment, type NodeElement, type Notice, type NoticeAndRequest, NoticeBase, type NoticeEventMap, type NoticeEventSub, type NoticeOptions, type OB11AllEvent, OB11ApiAction, type OB11ApiParams, type OB11ApiRequest, OB11Event, type OB11EventBase, type OB11FriendSender, type OB11GroupMessage, type OB11GroupSender, type OB11GroupTempMessage, type OB11Message, OB11MessageSubType, OB11MessageType, type OB11Meta, type OB11NodeSegment, type OB11Notice, type OB11NoticeBaseType, OB11NoticeType, type OB11PrivateMessage, type OB11Request, type OB11RequestBaseType, OB11RequestType, type OB11Segment, type OB11SegmentBase, type OB11SegmentType, OB11Sex, type OB11serInfo, type OneBot11FriendAdd, type OneBot11FriendRecall, type OneBot11FriendRequest, type OneBot11GroupAdmin, type OneBot11GroupBan, type OneBot11GroupCard, type OneBot11GroupDecrease, type OneBot11GroupEssence, type OneBot11GroupIncrease, type OneBot11GroupMessageReaction, type OneBot11GroupMessageReactionLagrange, type OneBot11GroupRecall, type OneBot11GroupRequest, type OneBot11GroupUpload, type OneBot11Heartbeat, type OneBot11Honor, type OneBot11Lifecycle, type OneBot11LuckyKing, type OneBot11Poke, type Options, type PM2, type Package, type Parser, type PasmsgElement, type Permission, type PkgData, type PkgInfo, Plugin, type PluginFile, type PluginFncTypes, type PluginOptions, type PluginRule, type Point, type PokeSegment, PrivateApplyRequest, type PrivateApplyRequestOptions, PrivateFileUploadedNotice, type PrivateFileUploadedOptions, PrivatePokeNotice, type PrivatePokeOptions, PrivateRecallNotice, type PrivateRecallOptions, type Privates, type PuppeteerLifeCycleEvent, type QQBotButton, type QQButtonTextType, type QQGroupFileInfo, type QQGroupFolderInfo, type QQGroupHonorInfo, type RawElement, type ReadyMusicElement, ReceiveLikeNotice, type ReceiveLikeOptions, type RecordElement, type RecordSegment, type Redis, type Render, type RenderResult, Renderer, type Renders, type Reply, type ReplyElement, type ReplySegment, type Request, RequestBase, type RequestEventMap, type RequestEventSub, type RequestOptions, type RequireFunction, type RequireFunctionSync, type RequireOptions, type Role, type RpsElement, type RpsSegment, type Scene, type ScreenshotClip, type ScreenshotOptions, type Segment, type SendElement, type SendForwardMessageResponse, type SendMessage, type SendMsgResults, type Sender, type SenderBase, type SenderGroup, type Sex, type ShakeSegment, type ShareElement, type ShareSegment, type SrcReply, type Task, type TextElement, type TextSegment, type UnregisterBot, type UserInfo, type VideoElement, type VideoSegment, type WaitForOptions, Watch, Watcher, type WeatherElement, type XmlElement, type XmlSegment, type YamlComment, YamlEditor, type YamlValue, absPath, adapter, app, applyComments, base64, buffer, buttonHandle, callRender, changelog, checkGitPluginUpdate, checkPkgUpdate, clearRequire, clearRequireFile, comment, index$1 as common, index as config, contact, contactDirect, contactFriend, contactGroup, contactGroupTemp, contactGuild, copyConfig, copyConfigSync, copyFiles, copyFilesSync, createLogger, createPluginDir, createRawMessage, karin as default, downFile, errorToString, exec, existToMkdir, existToMkdirSync, exists, existsSync, ffmpeg, ffplay, ffprobe, fs as file, fileToUrl, fileToUrlHandlerKey, filesByExt, formatTime$1 as formatTime, index$3 as fs, getAllBot, getAllBotID, getAllBotList, getBot, getBotCount, getCommit, getFiles, getHash, getPid, getPkgVersion, getPluginInfo, getRelPath, getRemotePkgVersion, getRender, getRenderCount, getRenderList, getRequestIp, getTime, handler$1 as handler, importModule, isClass, isDir, isDirSync, isDocker, isFile, isFileSync, isIPv4Loop, isIPv6Loop, isLinux, isLocalRequest, isLoopback, isMac, isPlugin, isRoot, isStatic, isSubPath, isWin, json$1 as json, karin, karinToQQBot, key, level, listen, lock, lockMethod, lockProp, log, logger, logs, makeForward, makeMessage, type messageType, mkdir, mkdirSync, parseChangelog, pkgRoot, qqbotToKarin, randomStr, range, read, readFile, readJson, readJsonSync, redis$1 as redis, registerBot, registerRender, render, renderHtml, renderMultiHtml, renderTpl, requireFile, requireFileSync, restart, restartDirect, rmSync, save, type screenshot, segment, sendMsg, sender, senderDirect, senderFriend, senderGroup, senderGroupTemp, senderGuild, sep, server, splitPath, stream, stringifyError, index$2 as system, unregisterBot, unregisterRender, updateAllGitPlugin, updateAllPkg, updateGitPlugin, updatePkg, uptime$1 as uptime, urlToPath, watch, watchAndMerge, write, writeJson, writeJsonSync, wss, yaml };
9828
+ export { type Accept, type AccountInfo, type Adapter, AdapterBase, type AdapterCommunication, AdapterConsole, type AdapterInfo, AdapterOneBot, type AdapterOptions, type AdapterPlatform, type AdapterProtocol, type AdapterStandard, type AdapterType, type Adapters, type AllPluginMethods, type AnonymousSegment, type Apps, type AtElement, type AtSegment, type BaseContact, BaseEvent, type BaseEventOptions, type BaseEventType, type BasketballElement, Bot, type BoundingBox, type BubbleFaceElement, type Button, type ButtonElement, type Cache, type CacheEntry, type CmdFnc, type Command, type CommandClass, type Config, type Contact, type ContactElement, type ContactSegment, type Count, type CreateGroupFolderResponse, type CustomMusicElement, type CustomMusicSegment, type CustomNodeElement, type CustomNodeSegments, type DiceElement, type DiceSegment, type DirectContact, DirectMessage, type DirectMessageOptions, type DirectNodeElement, type DirectNodeSegment, type DirectSender, type DownloadFileOptions, type DownloadFileResponse, EVENT_COUNT, type ElementTypes, type Elements, type Event, type EventParent, type EventToSubEvent, type ExecOptions, type ExecReturn, type ExecType, type FaceElement, type FaceSegment, type FileList, type FileListMap, type FileSegment, type FileToUrlHandler, type FileToUrlResult, type ForwardOptions, type ForwardSegment, type FriendContact, FriendDecreaseNotice, type FriendDecreaseOptions, FriendIncreaseNotice, type FriendIncreaseOptions, FriendMessage, type FriendMessageOptions, type FriendNoticeEventMap, type FriendRequestEventMap, type FriendSender, type GetAtAllCountResponse, type GetBot, type GetGroupFileListResponse, type GetGroupFileSystemInfoResponse, type GetGroupHighlightsResponse, type GetGroupInfo, type GetGroupMemberInfo, type GetGroupMuteListResponse, type GetMsg, type GetPluginReturn, type GetPluginType, type GiftElement, type GoToOptions, GroupAdminChangedNotice, type GroupAdminChangedOptions, GroupApplyRequest, type GroupApplyRequestOptions, GroupCardChangedNotice, type GroupCardChangedOptions, type GroupContact, GroupFileUploadedNotice, type GroupFileUploadedOptions, GroupHlightsChangedNotice, type GroupHlightsChangedOptions, GroupHonorChangedNotice, type GroupHonorChangedOptions, type GroupInfo, GroupInviteRequest, type GroupInviteRequestOptions, GroupLuckKingNotice, type GroupLuckKingOptions, GroupMemberBanNotice, type GroupMemberBanOptions, GroupMemberDecreaseNotice, type GroupMemberDecreaseOptions, GroupMemberIncreaseNotice, type GroupMemberIncreaseOptions, type GroupMemberInfo, GroupMemberTitleUpdatedNotice, type GroupMemberUniqueTitleChangedOptions, GroupMessage, type GroupMessageOptions, GroupMessageReactionNotice, type GroupMessageReactionOptions, GroupNotice, type GroupNoticeEventMap, GroupPokeNotice, type GroupPokeOptions, GroupRecallNotice, type GroupRecallOptions, type GroupRequestEventMap, type GroupSender, GroupSignInNotice, type GroupSignInOptions, type GroupTempContact, GroupTempMessage, type GroupTempMessageOptions, type GroupTempSender, GroupWholeBanNotice, type GroupWholeBanOptions, type Groups, type GuildContact, GuildMessage, type GuildMessageOptions, type GuildSender, type Handler, type HandlerType, type HonorInfoList, type ImageElement, type ImageSegment, type JsonElement, type JsonSegment, type KarinButton, type KeyboardElement, type LocationElement, type LocationSegment, type Log, type Logger, type LoggerExpand, type LoggerLevel, type LoggerOptions, type LongMsgElement, type MarkdownElement, type MarkdownTplElement, type MarketFaceElement, type Message$2 as Message, MessageBase, type MessageEventMap, type MessageEventSub, type MessageOptions, type MessageResponse, type MetaEventBase, type MusicElement, type MusicPlatform, type MusicSegment, type NodeElement, type Notice, type NoticeAndRequest, NoticeBase, type NoticeEventMap, type NoticeEventSub, type NoticeOptions, type OB11AllEvent, OB11ApiAction, type OB11ApiParams, type OB11ApiRequest, OB11Event, type OB11EventBase, type OB11FriendSender, type OB11GroupMessage, type OB11GroupSender, type OB11GroupTempMessage, type OB11Message, OB11MessageSubType, OB11MessageType, type OB11Meta, type OB11NodeSegment, type OB11Notice, type OB11NoticeBaseType, OB11NoticeType, type OB11PrivateMessage, type OB11Request, type OB11RequestBaseType, OB11RequestType, type OB11Segment, type OB11SegmentBase, type OB11SegmentType, OB11Sex, type OB11serInfo, type OneBot11FriendAdd, type OneBot11FriendRecall, type OneBot11FriendRequest, type OneBot11GroupAdmin, type OneBot11GroupBan, type OneBot11GroupCard, type OneBot11GroupDecrease, type OneBot11GroupEssence, type OneBot11GroupIncrease, type OneBot11GroupMessageReaction, type OneBot11GroupMessageReactionLagrange, type OneBot11GroupRecall, type OneBot11GroupRequest, type OneBot11GroupUpload, type OneBot11Heartbeat, type OneBot11Honor, type OneBot11Lifecycle, type OneBot11LuckyKing, type OneBot11Poke, type Options, type PM2, type Package, type Parser, type PasmsgElement, type Permission, type PkgData, type PkgInfo, Plugin, type PluginFile, type PluginFncTypes, type PluginOptions, type PluginRule, type Point, type PokeSegment, PrivateApplyRequest, type PrivateApplyRequestOptions, PrivateFileUploadedNotice, type PrivateFileUploadedOptions, PrivatePokeNotice, type PrivatePokeOptions, PrivateRecallNotice, type PrivateRecallOptions, type Privates, type PuppeteerLifeCycleEvent, type QQBotButton, type QQButtonTextType, type QQGroupFileInfo, type QQGroupFolderInfo, type QQGroupHonorInfo, RECV_MSG, type RawElement, type ReadyMusicElement, ReceiveLikeNotice, type ReceiveLikeOptions, type RecordElement, type RecordSegment, type Redis, type Render, type RenderResult, Renderer, type Renders, type Reply, type ReplyElement, type ReplySegment, type Request, RequestBase, type RequestEventMap, type RequestEventSub, type RequestOptions, type RequireFunction, type RequireFunctionSync, type RequireOptions, type Role, type RpsElement, type RpsSegment, SEND_MSG, type Scene, type ScreenshotClip, type ScreenshotOptions, type Segment, type SendElement, type SendForwardMessageResponse, type SendMessage, type SendMsgResults, type Sender, type SenderBase, type SenderGroup, type Sex, type ShakeSegment, type ShareElement, type ShareSegment, type SrcReply, type Task, type TextElement, type TextSegment, type UnregisterBot, type UserInfo, type VideoElement, type VideoSegment, type WaitForOptions, Watch, Watcher, type WeatherElement, type XmlElement, type XmlSegment, type YamlComment, YamlEditor, type YamlValue, absPath, adapter, app, applyComments, base64, buffer, buttonHandle, callRender, changelog, checkGitPluginUpdate, checkPkgUpdate, clearRequire, clearRequireFile, comment, index$1 as common, index as config, contact, contactDirect, contactFriend, contactGroup, contactGroupTemp, contactGuild, copyConfig, copyConfigSync, copyFiles, copyFilesSync, createLogger, createPluginDir, createRawMessage, karin as default, downFile, errorToString, exec, existToMkdir, existToMkdirSync, exists, existsSync, ffmpeg, ffplay, ffprobe, fs as file, fileToUrl, fileToUrlHandlerKey, filesByExt, formatTime$1 as formatTime, index$3 as fs, getAllBot, getAllBotID, getAllBotList, getBot, getBotCount, getCommit, getFiles, getHash, getPid, getPkgVersion, getPluginInfo, getRelPath, getRemotePkgVersion, getRender, getRenderCount, getRenderList, getRequestIp, getTime, handler$1 as handler, importModule, isClass, isDir, isDirSync, isDocker, isFile, isFileSync, isIPv4Loop, isIPv6Loop, isLinux, isLocalRequest, isLoopback, isMac, isPlugin, isRoot, isStatic, isSubPath, isWin, json$1 as json, karin, karinToQQBot, key, level, listen, lock, lockMethod, lockProp, log, logger, logs, makeForward, makeMessage, type messageType, mkdir, mkdirSync, parseChangelog, pkgRoot, qqbotToKarin, randomStr, range, read, readFile, readJson, readJsonSync, redis$1 as redis, registerBot, registerRender, render, renderHtml, renderMultiHtml, renderTpl, requireFile, requireFileSync, restart, restartDirect, rmSync, save, type screenshot, segment, sendMsg, sender, senderDirect, senderFriend, senderGroup, senderGroupTemp, senderGuild, sep, server, splitPath, stream, stringifyError, index$2 as system, unregisterBot, unregisterRender, updateAllGitPlugin, updateAllPkg, updateGitPlugin, updatePkg, uptime$1 as uptime, urlToPath, watch, watchAndMerge, write, writeJson, writeJsonSync, wss, yaml };
package/dist/index.js CHANGED
@@ -888,7 +888,7 @@ var init_init = __esm({
888
888
  });
889
889
 
890
890
  // src/core/internal/listeners.ts
891
- import { EventEmitter } from "events";
891
+ import { EventEmitter } from "node:events";
892
892
  var TypedListeners, listeners;
893
893
  var init_listeners = __esm({
894
894
  "src/core/internal/listeners.ts"() {
@@ -2946,7 +2946,6 @@ var init_mock = __esm({
2946
2946
  this.#zset = {};
2947
2947
  this.#pf = {};
2948
2948
  this.#bit = {};
2949
- process.once("exit", () => this.#level.close());
2950
2949
  }
2951
2950
  async init() {
2952
2951
  existToMkdirSync(redisLevelPath);
@@ -4366,37 +4365,36 @@ var init_router = __esm({
4366
4365
  }
4367
4366
  });
4368
4367
 
4369
- // src/server/auth/index.ts
4370
- var auth;
4371
- var init_auth = __esm({
4372
- async "src/server/auth/index.ts"() {
4368
+ // src/server/utils/response.ts
4369
+ var createResponse, createSuccessResponse, createNotFoundResponse, createServerErrorResponse, createBadRequestResponse, createPayloadTooLargeResponse, createForbiddenResponse;
4370
+ var init_response = __esm({
4371
+ "src/server/utils/response.ts"() {
4373
4372
  "use strict";
4374
4373
  init_esm_shims();
4375
- await init_config2();
4376
- auth = {
4377
- /**
4378
- * get请求鉴权
4379
- * @description 支持请求头中携带`Authorization`字段
4380
- * @description 支持请求参数中携带`token`字段
4381
- */
4382
- getAuth: (req) => {
4383
- var _a, _b;
4384
- const token = ((_a = req == null ? void 0 : req.headers) == null ? void 0 : _a.authorization) || ((_b = req == null ? void 0 : req.query) == null ? void 0 : _b.token);
4385
- if (!token) return false;
4386
- const value = authKey();
4387
- return token === `Bearer ${value}` || token === value;
4388
- },
4389
- /**
4390
- * post请求鉴权
4391
- * @description 仅支持请求头中携带`Authorization`字段
4392
- */
4393
- postAuth: (req) => {
4394
- var _a;
4395
- const token = (_a = req == null ? void 0 : req.headers) == null ? void 0 : _a.authorization;
4396
- if (!token) return false;
4397
- const value = authKey();
4398
- return token === `Bearer ${value}` || token === value;
4399
- }
4374
+ createResponse = (res, code, data, message = "") => {
4375
+ res.status(code).json({
4376
+ code,
4377
+ data,
4378
+ message
4379
+ });
4380
+ };
4381
+ createSuccessResponse = (res, data, message = "\u6210\u529F") => {
4382
+ return createResponse(res, 200 /* OK */, data, message);
4383
+ };
4384
+ createNotFoundResponse = (res, message = "\u672A\u627E\u5230") => {
4385
+ return createResponse(res, 404 /* NotFound */, null, message);
4386
+ };
4387
+ createServerErrorResponse = (res, message = "\u670D\u52A1\u5668\u9519\u8BEF") => {
4388
+ return createResponse(res, 500 /* InternalServerError */, null, message);
4389
+ };
4390
+ createBadRequestResponse = (res, message = "\u53C2\u6570\u9519\u8BEF") => {
4391
+ return createResponse(res, 400 /* BadRequest */, null, message);
4392
+ };
4393
+ createPayloadTooLargeResponse = (res, message = "\u8BF7\u6C42\u4F53\u8FC7\u5927") => {
4394
+ return createResponse(res, 413 /* PayloadTooLarge */, null, message);
4395
+ };
4396
+ createForbiddenResponse = (res, message = "\u7981\u6B62\u8BBF\u95EE") => {
4397
+ return createResponse(res, 403 /* Forbidden */, null, message);
4400
4398
  };
4401
4399
  }
4402
4400
  });
@@ -4404,18 +4402,14 @@ var init_auth = __esm({
4404
4402
  // src/server/api/exit.ts
4405
4403
  var exitRouter;
4406
4404
  var init_exit = __esm({
4407
- async "src/server/api/exit.ts"() {
4405
+ "src/server/api/exit.ts"() {
4408
4406
  "use strict";
4409
4407
  init_esm_shims();
4410
4408
  init_router();
4411
- await init_auth();
4412
- exitRouter = async (req, res) => {
4413
- if (!auth.getAuth(req)) {
4414
- res.status(401).json({ message: "\u65E0\u6548\u7684token" });
4415
- return;
4416
- }
4409
+ init_response();
4410
+ exitRouter = async (_req, res) => {
4417
4411
  logger.mark("\u6536\u5230\u9000\u51FA\u8BF7\u6C42\uFF0C\u6B63\u5728\u9000\u51FA...");
4418
- res.json({ message: "\u9000\u51FA\u6210\u529F" });
4412
+ createSuccessResponse(res, null, "\u9000\u51FA\u6210\u529F");
4419
4413
  const { processExit: processExit2 } = await Promise.resolve().then(() => (init_process(), process_exports));
4420
4414
  await processExit2(0);
4421
4415
  };
@@ -4426,21 +4420,21 @@ var init_exit = __esm({
4426
4420
  // src/server/api/ping.ts
4427
4421
  var pingRouter, statusRouter;
4428
4422
  var init_ping = __esm({
4429
- async "src/server/api/ping.ts"() {
4423
+ "src/server/api/ping.ts"() {
4430
4424
  "use strict";
4431
4425
  init_esm_shims();
4432
- await init_auth();
4426
+ init_response();
4433
4427
  init_router();
4434
- pingRouter = (req, res) => {
4435
- res.send({
4436
- ping: "pong"
4437
- });
4428
+ pingRouter = (_req, res) => {
4429
+ createSuccessResponse(
4430
+ res,
4431
+ {
4432
+ ping: "pong"
4433
+ },
4434
+ "\u6210\u529F"
4435
+ );
4438
4436
  };
4439
- statusRouter = (req, res) => {
4440
- if (!auth.getAuth(req)) {
4441
- res.status(401).json({ message: "\u65E0\u6548\u7684token" });
4442
- return;
4443
- }
4437
+ statusRouter = (_req, res) => {
4444
4438
  const data = {
4445
4439
  name: "karin",
4446
4440
  pid: process.pid,
@@ -4451,43 +4445,89 @@ var init_ping = __esm({
4451
4445
  karin_lang: process.env.RUNTIME === "tsx" ? "ts" : "js",
4452
4446
  karin_runtime: process.env.RUNTIME
4453
4447
  };
4454
- res.status(200).json(data);
4448
+ createSuccessResponse(res, data, "\u6210\u529F");
4455
4449
  };
4456
4450
  router.get("/ping", pingRouter);
4457
4451
  router.get("/status", statusRouter);
4458
4452
  }
4459
4453
  });
4460
4454
 
4461
- // src/server/api/web/router.ts
4462
- import express from "express";
4463
- import { Router as Router2 } from "express";
4464
- var router2;
4465
- var init_router2 = __esm({
4466
- "src/server/api/web/router.ts"() {
4455
+ // src/server/auth/index.ts
4456
+ var auth;
4457
+ var init_auth = __esm({
4458
+ async "src/server/auth/index.ts"() {
4459
+ "use strict";
4460
+ init_esm_shims();
4461
+ await init_config2();
4462
+ auth = {
4463
+ /**
4464
+ * get请求鉴权
4465
+ * @description 支持请求头中携带`Authorization`字段
4466
+ * @description 支持请求参数中携带`token`字段
4467
+ */
4468
+ getAuth: (req) => {
4469
+ var _a, _b;
4470
+ const token = ((_a = req == null ? void 0 : req.headers) == null ? void 0 : _a.authorization) || ((_b = req == null ? void 0 : req.query) == null ? void 0 : _b.token);
4471
+ if (!token) return false;
4472
+ const value = authKey();
4473
+ return token === `Bearer ${value}` || token === value;
4474
+ },
4475
+ /**
4476
+ * post请求鉴权
4477
+ * @description 仅支持请求头中携带`Authorization`字段
4478
+ */
4479
+ postAuth: (req) => {
4480
+ var _a;
4481
+ const token = (_a = req == null ? void 0 : req.headers) == null ? void 0 : _a.authorization;
4482
+ if (!token) return false;
4483
+ const value = authKey();
4484
+ return token === `Bearer ${value}` || token === value;
4485
+ }
4486
+ };
4487
+ }
4488
+ });
4489
+
4490
+ // src/server/middleware.ts
4491
+ var authMiddleware;
4492
+ var init_middleware = __esm({
4493
+ async "src/server/middleware.ts"() {
4467
4494
  "use strict";
4468
4495
  init_esm_shims();
4469
- router2 = Router2();
4470
- router2.use(express.json());
4496
+ await init_auth();
4497
+ authMiddleware = async (req, res, next) => {
4498
+ if (req.path.startsWith("/api")) {
4499
+ if (req.path === "/api/v1/ping" || req.path.startsWith("/api/v1/console")) {
4500
+ next();
4501
+ return;
4502
+ }
4503
+ if (!auth.getAuth(req)) {
4504
+ res.status(401).json({ message: "\u65E0\u6548\u7684token" });
4505
+ return;
4506
+ }
4507
+ }
4508
+ next();
4509
+ };
4471
4510
  }
4472
4511
  });
4473
4512
 
4474
4513
  // src/server/app.ts
4475
4514
  import path12 from "node:path";
4476
- import express2 from "express";
4515
+ import express from "express";
4477
4516
  import { createServer } from "node:http";
4478
4517
  var app, server, listen;
4479
4518
  var init_app = __esm({
4480
- "src/server/app.ts"() {
4519
+ async "src/server/app.ts"() {
4481
4520
  "use strict";
4482
4521
  init_esm_shims();
4483
4522
  init_router();
4484
- init_router2();
4485
4523
  init_internal();
4486
- app = express2();
4524
+ await init_middleware();
4525
+ app = express();
4487
4526
  server = createServer(app);
4488
- app.use("/web", express2.static(path12.join(process.cwd(), "web")));
4489
- app.use("/api/web", router2);
4490
- app.use("/v1", router);
4527
+ app.use(authMiddleware);
4528
+ app.use("/web", express.static(path12.join(process.cwd(), "web")));
4529
+ app.use("/web/*", express.static(path12.join(process.cwd(), "web")));
4530
+ app.use("/api/v1", router);
4491
4531
  listen = (port2, host2) => {
4492
4532
  server.listen(port2, host2, () => {
4493
4533
  logger.info(`[server] express \u5DF2\u542F\u52A8 \u6B63\u5728\u76D1\u542C: http://${host2}:${port2}`);
@@ -4502,15 +4542,13 @@ var init_app = __esm({
4502
4542
 
4503
4543
  // src/server/api/root.ts
4504
4544
  var init_root2 = __esm({
4505
- "src/server/api/root.ts"() {
4545
+ async "src/server/api/root.ts"() {
4506
4546
  "use strict";
4507
4547
  init_esm_shims();
4508
- init_app();
4509
- app.get("/", (req, res) => {
4510
- res.send({
4511
- code: 200,
4512
- msg: "\u96EA\u9701\u94F6\u5986\u7D20\uFF0C\u6854\u9AD8\u6620\u743C\u679D\u3002"
4513
- });
4548
+ await init_app();
4549
+ init_response();
4550
+ app.get("/", (_req, res) => {
4551
+ createSuccessResponse(res, null, "\u96EA\u9701\u94F6\u5986\u7D20\uFF0C\u6854\u9AD8\u6620\u743C\u679D\u3002");
4514
4552
  });
4515
4553
  }
4516
4554
  });
@@ -4572,9 +4610,9 @@ var init_ip = __esm({
4572
4610
  });
4573
4611
 
4574
4612
  // src/server/api/console.ts
4575
- import fs15 from "node:fs";
4613
+ import { promises as fs15 } from "node:fs";
4576
4614
  import path13 from "node:path";
4577
- var consoleRouter;
4615
+ var ALLOWED_TYPES, MAX_FILE_SIZE, consoleRouter;
4578
4616
  var init_console = __esm({
4579
4617
  async "src/server/api/console.ts"() {
4580
4618
  "use strict";
@@ -4583,60 +4621,72 @@ var init_console = __esm({
4583
4621
  init_root();
4584
4622
  await init_adapter();
4585
4623
  init_ip();
4624
+ init_response();
4625
+ ALLOWED_TYPES = {
4626
+ ".png": "image/png",
4627
+ ".jpg": "image/jpeg",
4628
+ ".jpeg": "image/jpeg",
4629
+ ".gif": "image/gif",
4630
+ ".mp3": "audio/mpeg",
4631
+ ".mp4": "video/mp4",
4632
+ ".wav": "audio/wav",
4633
+ ".webp": "image/webp",
4634
+ ".json": "application/json",
4635
+ ".txt": "text/plain",
4636
+ ".html": "text/html",
4637
+ ".css": "text/css"
4638
+ };
4639
+ MAX_FILE_SIZE = 1024 * 1024 * 1024;
4586
4640
  consoleRouter = async (req, res) => {
4587
- const cfg = adapter();
4588
- let name = req.path.split("/").pop();
4589
- if (!name) {
4590
- res.status(400).json({ error: "\u65E0\u6548\u7684\u8BF7\u6C42", message: "\u6587\u4EF6\u540D\u4E0D\u80FD\u4E3A\u7A7A" });
4591
- return;
4592
- }
4593
- name = decodeURIComponent(name);
4594
- if (name.includes("..")) {
4595
- res.status(403).json({ error: "\u7981\u6B62\u8BBF\u95EE", message: "\u975E\u6CD5\u8BF7\u6C42" });
4596
- return;
4597
- }
4598
- const isLocal = await isLocalRequest(req);
4599
- if (cfg.console.isLocal) {
4600
- if (!isLocal) {
4601
- res.status(403).json({ error: "\u7981\u6B62\u8BBF\u95EE", message: "\u65E0\u6548\u7684\u8BF7\u6C42" });
4602
- return;
4641
+ try {
4642
+ const cfg = adapter();
4643
+ let url = decodeURIComponent(req.path).replace(/\/+/g, "/").replace(/^\/+|\/+$/g, "");
4644
+ url = url.split("/").pop() || "";
4645
+ if (!url) {
4646
+ return createBadRequestResponse(res, "\u6587\u4EF6\u540D\u4E0D\u80FD\u4E3A\u7A7A");
4603
4647
  }
4604
- } else {
4605
- if (!cfg.console.token) {
4606
- res.status(500).json({ error: "\u914D\u7F6E\u9519\u8BEF", message: "\u7F3A\u5C11 token \u914D\u7F6E" });
4607
- return;
4648
+ if (url.includes("..") || url.includes("~") || !url.match(/^[a-zA-Z0-9-_.]+$/)) {
4649
+ return createForbiddenResponse(res, "\u975E\u6CD5\u8BF7\u6C42");
4608
4650
  }
4609
- const token = req.query.token;
4610
- if (!token || token !== cfg.console.token) {
4611
- res.status(403).json({ error: "\u7981\u6B62\u8BBF\u95EE", message: "\u65E0\u6548\u7684 token" });
4612
- return;
4651
+ const ext = path13.extname(url).toLowerCase();
4652
+ if (!ALLOWED_TYPES[ext]) {
4653
+ return createBadRequestResponse(res, "\u4E0D\u652F\u6301\u7684\u6587\u4EF6\u7C7B\u578B");
4613
4654
  }
4655
+ const isLocal = await isLocalRequest(req);
4656
+ if (cfg.console.isLocal) {
4657
+ if (!isLocal) {
4658
+ return createForbiddenResponse(res, "\u975E\u6CD5\u8BF7\u6C42");
4659
+ }
4660
+ } else {
4661
+ if (!cfg.console.token) {
4662
+ return createServerErrorResponse(res, "\u7F3A\u5C11 token \u914D\u7F6E");
4663
+ }
4664
+ const token = req.query.token;
4665
+ if (!token || token !== cfg.console.token) {
4666
+ return createForbiddenResponse(res, "\u65E0\u6548\u7684 token");
4667
+ }
4668
+ }
4669
+ const file = path13.join(consolePath, url);
4670
+ try {
4671
+ if (!file.startsWith(consolePath)) {
4672
+ return createForbiddenResponse(res, "\u975E\u6CD5\u8BF7\u6C42");
4673
+ }
4674
+ const stats = await fs15.stat(file);
4675
+ if (stats.size > MAX_FILE_SIZE) {
4676
+ return createPayloadTooLargeResponse(res, "\u6587\u4EF6\u8FC7\u5927");
4677
+ }
4678
+ } catch {
4679
+ return createNotFoundResponse(res, "\u6587\u4EF6\u4E0D\u5B58\u5728");
4680
+ }
4681
+ const data = await fs15.readFile(file);
4682
+ res.setHeader("Content-Type", ALLOWED_TYPES[ext]);
4683
+ res.setHeader("Content-Length", data.length);
4684
+ res.setHeader("X-Content-Type-Options", "nosniff");
4685
+ res.send(data);
4686
+ } catch (error) {
4687
+ console.error("Console router error:", error);
4688
+ return createServerErrorResponse(res, "\u670D\u52A1\u5668\u9519\u8BEF");
4614
4689
  }
4615
- const file = path13.join(consolePath, name);
4616
- if (!fs15.existsSync(file)) {
4617
- res.status(404).json({ error: "\u6587\u4EF6\u4E0D\u5B58\u5728", message: "\u6587\u4EF6\u4E0D\u5B58\u5728" });
4618
- return;
4619
- }
4620
- const data = fs15.readFileSync(file);
4621
- if (!data) {
4622
- res.status(500).json({ error: "\u5185\u90E8\u9519\u8BEF", message: "\u8BFB\u53D6\u5931\u8D25" });
4623
- return;
4624
- }
4625
- const ext = path13.extname(name).toLowerCase();
4626
- switch (ext) {
4627
- case ".png":
4628
- res.setHeader("Content-Type", "image/png");
4629
- break;
4630
- case ".mp3":
4631
- res.setHeader("Content-Type", "audio/mpeg");
4632
- break;
4633
- case ".mp4":
4634
- res.setHeader("Content-Type", "video/mp4");
4635
- break;
4636
- default:
4637
- res.setHeader("Content-Type", "application/octet-stream");
4638
- }
4639
- res.send(data);
4640
4690
  };
4641
4691
  router.get("/console/*", consoleRouter);
4642
4692
  }
@@ -4693,61 +4743,30 @@ var init_restart = __esm({
4693
4743
  // src/server/api/restart.ts
4694
4744
  var restartRouter;
4695
4745
  var init_restart2 = __esm({
4696
- async "src/server/api/restart.ts"() {
4746
+ "src/server/api/restart.ts"() {
4697
4747
  "use strict";
4698
4748
  init_esm_shims();
4699
4749
  init_router();
4700
- await init_auth();
4701
4750
  init_restart();
4702
- restartRouter = async (req, res) => {
4703
- if (!auth.getAuth(req)) {
4704
- res.status(401).json({ message: "\u65E0\u6548\u7684token" });
4705
- return;
4706
- }
4707
- res.status(200).end();
4751
+ init_response();
4752
+ restartRouter = async (_req, res) => {
4753
+ createSuccessResponse(res, null, "\u6307\u4EE4\u53D1\u9001\u6210\u529F");
4708
4754
  restartDirect();
4709
4755
  };
4710
4756
  router.get("/restart", restartRouter);
4711
4757
  }
4712
4758
  });
4713
4759
 
4714
- // src/server/api/web/login.ts
4715
- var loginRouter;
4716
- var init_login = __esm({
4717
- async "src/server/api/web/login.ts"() {
4718
- "use strict";
4719
- init_esm_shims();
4720
- init_router2();
4721
- await init_auth();
4722
- loginRouter = async (req, res) => {
4723
- if (!auth.getAuth(req)) {
4724
- res.status(401).json({ message: "\u65E0\u6548\u7684token" });
4725
- return;
4726
- }
4727
- res.json({ message: "\u767B\u5F55\u6210\u529F" });
4728
- };
4729
- router2.get("/login", loginRouter);
4730
- }
4731
- });
4732
-
4733
- // src/server/api/web/file.ts
4760
+ // src/server/api/file.ts
4734
4761
  var list2, nameMap, fileRouter, setFileRouter, getFileRouter;
4735
4762
  var init_file2 = __esm({
4736
- async "src/server/api/web/file.ts"() {
4763
+ async "src/server/api/file.ts"() {
4737
4764
  "use strict";
4738
4765
  init_esm_shims();
4739
- init_router2();
4740
- await init_auth();
4766
+ init_router();
4741
4767
  await init_config();
4742
- list2 = [
4743
- "adapter",
4744
- "config",
4745
- "groups",
4746
- "pm2",
4747
- "privates",
4748
- "redis",
4749
- "render"
4750
- ];
4768
+ init_response();
4769
+ list2 = ["adapter", "config", "groups", "pm2", "privates", "redis", "render"];
4751
4770
  nameMap = {
4752
4771
  adapter: "\u9002\u914D\u5668\u914D\u7F6E",
4753
4772
  config: "\u57FA\u672C\u914D\u7F6E",
@@ -4757,16 +4776,12 @@ var init_file2 = __esm({
4757
4776
  redis: "redis\u914D\u7F6E",
4758
4777
  render: "\u6E32\u67D3\u5668\u914D\u7F6E"
4759
4778
  };
4760
- fileRouter = async (req, res) => {
4761
- if (!auth.getAuth(req)) {
4762
- res.status(401).json({ message: "\u65E0\u6548\u7684token" });
4763
- return;
4764
- }
4779
+ fileRouter = async (_req, res) => {
4765
4780
  const files = list2.map((name) => ({
4766
4781
  name,
4767
4782
  title: nameMap[name]
4768
4783
  }));
4769
- res.json(files);
4784
+ createSuccessResponse(res, files);
4770
4785
  };
4771
4786
  setFileRouter = async (req, res) => {
4772
4787
  const { name, data } = req.body;
@@ -4775,29 +4790,34 @@ var init_file2 = __esm({
4775
4790
  return;
4776
4791
  }
4777
4792
  setYaml(name, data);
4778
- res.json({ message: "\u8BBE\u7F6E\u6210\u529F" });
4793
+ createSuccessResponse(res, null, "\u8BBE\u7F6E\u6210\u529F");
4779
4794
  };
4780
4795
  getFileRouter = async (req, res) => {
4781
4796
  const { name } = req.body;
4782
4797
  if (!name || !list2.includes(name)) {
4783
4798
  res.status(400).json({ message: "\u53C2\u6570\u9519\u8BEF" });
4784
- return;
4799
+ return createSuccessResponse(res, null, "\u83B7\u53D6\u6210\u529F");
4785
4800
  }
4786
- res.json(getYaml(name, "user"));
4801
+ createSuccessResponse(res, getYaml(name, "user"), "\u83B7\u53D6\u6210\u529F");
4787
4802
  };
4788
- router2.get("/file", fileRouter);
4789
- router2.post("/set_file", setFileRouter);
4790
- router2.post("/get_file", getFileRouter);
4803
+ router.get("/file", fileRouter);
4804
+ router.post("/set_file", setFileRouter);
4805
+ router.post("/get_file", getFileRouter);
4791
4806
  }
4792
4807
  });
4793
4808
 
4794
- // src/server/api/web/index.ts
4795
- var init_web = __esm({
4796
- async "src/server/api/web/index.ts"() {
4809
+ // src/server/api/login.ts
4810
+ var loginRouter;
4811
+ var init_login = __esm({
4812
+ "src/server/api/login.ts"() {
4797
4813
  "use strict";
4798
4814
  init_esm_shims();
4799
- await init_login();
4800
- await init_file2();
4815
+ init_response();
4816
+ init_router();
4817
+ loginRouter = async (_req, res) => {
4818
+ createSuccessResponse(res, null, "\u767B\u5F55\u6210\u529F");
4819
+ };
4820
+ router.get("/login", loginRouter);
4801
4821
  }
4802
4822
  });
4803
4823
 
@@ -4806,12 +4826,13 @@ var init_api = __esm({
4806
4826
  async "src/server/api/index.ts"() {
4807
4827
  "use strict";
4808
4828
  init_esm_shims();
4809
- await init_exit();
4810
- await init_ping();
4811
- init_root2();
4829
+ init_exit();
4830
+ init_ping();
4831
+ await init_root2();
4812
4832
  await init_console();
4813
- await init_restart2();
4814
- await init_web();
4833
+ init_restart2();
4834
+ await init_file2();
4835
+ init_login();
4815
4836
  }
4816
4837
  });
4817
4838
 
@@ -4819,10 +4840,10 @@ var init_api = __esm({
4819
4840
  import { WebSocketServer } from "ws";
4820
4841
  var wss;
4821
4842
  var init_ws = __esm({
4822
- "src/server/ws.ts"() {
4843
+ async "src/server/ws.ts"() {
4823
4844
  "use strict";
4824
4845
  init_esm_shims();
4825
- init_app();
4846
+ await init_app();
4826
4847
  init_internal();
4827
4848
  wss = new WebSocketServer({ server });
4828
4849
  wss.on("error", (error) => {
@@ -9205,14 +9226,13 @@ init_root();
9205
9226
  import fs from "node:fs";
9206
9227
  import chalk2 from "chalk";
9207
9228
  import log4js from "log4js";
9208
- if (!fs.existsSync(logsPath)) fs.mkdirSync(logsPath);
9229
+ if (!fs.existsSync(logsPath))
9230
+ fs.mkdirSync(logsPath, {
9231
+ recursive: true
9232
+ });
9209
9233
  var initLogger = (options = {}) => {
9210
9234
  if (options.config) return log4js.configure(options.config);
9211
- const {
9212
- level: level2 = "info",
9213
- daysToKeep = 14,
9214
- maxLogSize = 0
9215
- } = options.log4jsCfg || {};
9235
+ const { level: level2 = "info", daysToKeep = 14, maxLogSize = 0 } = options.log4jsCfg || {};
9216
9236
  const config2 = {
9217
9237
  appenders: {
9218
9238
  console: {
@@ -9753,6 +9773,9 @@ init_convert();
9753
9773
  // src/utils/fs/index.ts
9754
9774
  var fs_exports2 = {};
9755
9775
  __export(fs_exports2, {
9776
+ EVENT_COUNT: () => EVENT_COUNT,
9777
+ RECV_MSG: () => RECV_MSG,
9778
+ SEND_MSG: () => SEND_MSG,
9756
9779
  Watch: () => Watch,
9757
9780
  Watcher: () => Watcher,
9758
9781
  YamlEditor: () => YamlEditor,
@@ -9953,6 +9976,7 @@ init_key();
9953
9976
 
9954
9977
  // src/utils/fs/index.ts
9955
9978
  init_require();
9979
+ init_key();
9956
9980
 
9957
9981
  // src/utils/system/index.ts
9958
9982
  var system_exports = {};
@@ -12701,6 +12725,7 @@ export {
12701
12725
  BaseEvent,
12702
12726
  Bot,
12703
12727
  DirectMessage,
12728
+ EVENT_COUNT,
12704
12729
  FriendDecreaseNotice,
12705
12730
  FriendIncreaseNotice,
12706
12731
  FriendMessage,
@@ -12739,9 +12764,11 @@ export {
12739
12764
  PrivateFileUploadedNotice,
12740
12765
  PrivatePokeNotice,
12741
12766
  PrivateRecallNotice,
12767
+ RECV_MSG,
12742
12768
  ReceiveLikeNotice,
12743
12769
  Renderer,
12744
12770
  RequestBase,
12771
+ SEND_MSG,
12745
12772
  Watch,
12746
12773
  Watcher,
12747
12774
  YamlEditor,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-karin",
3
- "version": "1.0.12",
3
+ "version": "1.1.0",
4
4
  "description": "Lightweight, efficient, concise, and stable robot framework.",
5
5
  "keywords": [
6
6
  "node",
@@ -45,15 +45,15 @@
45
45
  "plugins/**"
46
46
  ],
47
47
  "scripts": {
48
- ".": "node lib/index.js",
49
- "app": "node lib/index.js",
48
+ ".": "node dist/index.js",
49
+ "app": "node dist/index.js",
50
50
  "build": "tsc --noEmit && tsup --config tsup.config.ts",
51
51
  "build:cli": "tsup --tsconfig tsconfig.cli.json --config tsup.cli.ts",
52
52
  "build:dev": "pnpm build && node cli/build.js -dev",
53
53
  "build:module": "tsup --tsconfig tsconfig.module.json --config tsup.modules.ts && node cli/module.js",
54
54
  "build:prod": "pnpm build:module && pnpm build:cli && pnpm build && node cli/build.js",
55
55
  "cli": "node dist/cli/index.cjs",
56
- "debug": "node lib/index.js --debug",
56
+ "debug": "node dist/index.js --debug",
57
57
  "dev": "tsx src/index.ts",
58
58
  "dev:cli": "tsx exports/cli/index.ts",
59
59
  "dev:w": "tsx watch --include \"./src/**/*.ts\" src/index.ts",