filecat 5.27.0 → 5.28.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 (30) hide show
  1. package/build/dist/325.3a92e5a6791538c31dd6.js +2 -0
  2. package/build/dist/377.65ff457f5420ec3272ae.js +2 -0
  3. package/build/dist/584.d402a562c450dd79b543.js +2 -0
  4. package/build/dist/661.d169e2fe7193a840d43a.js +2 -0
  5. package/build/dist/{943.2e4dfca621e7247c128a.js → 943.9863616bde0933a9e753.js} +2 -2
  6. package/build/dist/index.html +1 -1
  7. package/build/dist/main.62df8ada67c2ef224c57.js +2 -0
  8. package/build/main.js +1 -1
  9. package/build/main.js.LICENSE.txt +0 -62
  10. package/build/threads.work.filecat.js +1 -1
  11. package/build/threads.work.filecat.js.LICENSE.txt +0 -64
  12. package/env +0 -1
  13. package/package.json +3 -4
  14. package/shell/build.js +1 -1
  15. package/shell/config/base.webpack.config.js +2 -1
  16. package/shell/config/webpack.exe.config.js +1 -1
  17. package/shell/config/webpack.npm.config.js +2 -7
  18. package/shell/pkg.ts +2 -1
  19. package/build/dist/325.a25f77ff05194a4aa3e8.js +0 -2
  20. package/build/dist/377.e95dc9f0f41f82493798.js +0 -2
  21. package/build/dist/584.6bd6b1d0bd5a110f2be9.js +0 -2
  22. package/build/dist/661.f71bb2fcdb45c0333f07.js +0 -2
  23. package/build/dist/main.d109c148d370f2f46c4b.js +0 -2
  24. package/build/watch.js +0 -87
  25. /package/build/dist/{325.a25f77ff05194a4aa3e8.js.LICENSE.txt → 325.3a92e5a6791538c31dd6.js.LICENSE.txt} +0 -0
  26. /package/build/dist/{377.e95dc9f0f41f82493798.js.LICENSE.txt → 377.65ff457f5420ec3272ae.js.LICENSE.txt} +0 -0
  27. /package/build/dist/{584.6bd6b1d0bd5a110f2be9.js.LICENSE.txt → 584.d402a562c450dd79b543.js.LICENSE.txt} +0 -0
  28. /package/build/dist/{661.f71bb2fcdb45c0333f07.js.LICENSE.txt → 661.d169e2fe7193a840d43a.js.LICENSE.txt} +0 -0
  29. /package/build/dist/{943.2e4dfca621e7247c128a.js.LICENSE.txt → 943.9863616bde0933a9e753.js.LICENSE.txt} +0 -0
  30. /package/build/dist/{main.d109c148d370f2f46c4b.js.LICENSE.txt → main.62df8ada67c2ef224c57.js.LICENSE.txt} +0 -0
package/build/watch.js DELETED
@@ -1,87 +0,0 @@
1
- const { fork } = require('child_process');
2
- const readline = require('readline');
3
- const path = require('path');
4
-
5
- let child = null;
6
-
7
- // 判断是否包含 dev
8
- const argv = process.argv;
9
- const isDev = argv.includes('dev');
10
-
11
- // 子进程入口
12
- const childScript = path.resolve(__dirname, isDev ? 'server.ts' : 'main.js');
13
- const childArgs = argv.slice(2); // 传递给子进程的参数
14
-
15
- let last = 0
16
- let running = false;
17
- function startServer() {
18
- if(running === true && Date.now() - last <= 3000) {
19
- // 最少3秒重启一次
20
- console.log(`${last} server started`);
21
- return;
22
- }
23
- last = Date.now();
24
- running = true;
25
- console.log('🚀 启动子进程...', (new Date()).toLocaleString());
26
-
27
- if (isDev) {
28
- // dev 模式下 fork ts 文件,使用 ts-node/register
29
- child = fork(childScript, [...childArgs,'--watch','true'], {
30
- stdio: ['inherit', 'inherit', 'inherit', 'ipc'], // 输出 + 消息通道
31
- execArgv: ['-r', 'ts-node/register'],
32
- env: { ...process.env }
33
- });
34
- } else {
35
- // 生产模式 fork js 文件
36
- child = fork(childScript, childArgs, {
37
- stdio: ['inherit', 'inherit', 'inherit', 'ipc'],
38
- env: { ...process.env }
39
- });
40
- }
41
-
42
- // 监听子进程发来的消息
43
- child.on('message', (msg) => {
44
- if (msg === 'restart') {
45
- console.log('♻️ 子进程请求重启...');
46
- restartServer();
47
- }
48
- });
49
-
50
- // 子进程退出事件
51
- child.on('exit', (code, signal) => {
52
- console.log(`⚠️ 子进程退出:code=${code}, signal=${signal}`);
53
- restartServer();
54
- });
55
- }
56
-
57
- function restartServer() {
58
- running = false;
59
- if (child) {
60
- console.log('♻️ 正在重启子进程...');
61
- child.kill('SIGTERM'); // 发送信号让子进程优雅退出
62
- setTimeout(() => startServer(), 500); // 延迟重启,给端口释放时间
63
- } else {
64
- startServer();
65
- }
66
- }
67
-
68
- // 启动子进程
69
- startServer();
70
-
71
- // 监听键盘输入
72
- readline.emitKeypressEvents(process.stdin);
73
- if (process.stdin.isTTY) process.stdin.setRawMode(true);
74
-
75
- process.stdin.on('keypress', (str, key) => {
76
- // Ctrl + R 重启
77
- if (key.ctrl && key.name === 'r') {
78
- restartServer();
79
- }
80
-
81
- // Ctrl + C 退出
82
- if (key.ctrl && key.name === 'c') {
83
- console.log('\n🛑 主进程退出');
84
- if (child) child.kill('SIGTERM');
85
- process.exit(0);
86
- }
87
- });