@maiyunnet/kebab 9.2.0 → 9.2.1
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/doc/kebab-rag.md +1 -1
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
- package/sys/master.js +23 -13
package/doc/kebab-rag.md
CHANGED
|
@@ -1360,7 +1360,7 @@ index/variables/VER.md
|
|
|
1360
1360
|
|
|
1361
1361
|
# Variable: VER
|
|
1362
1362
|
|
|
1363
|
-
> `const` **VER**: `"9.2.
|
|
1363
|
+
> `const` **VER**: `"9.2.1"` = `'9.2.1'`
|
|
1364
1364
|
|
|
1365
1365
|
Defined in: [index.ts:10](https://github.com/maiyunnet/kebab/blob/master/index.ts#L10)
|
|
1366
1366
|
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* --- 本文件用来定义每个目录实体地址的常量 ---
|
|
7
7
|
*/
|
|
8
8
|
/** --- 当前系统版本号 --- */
|
|
9
|
-
export const VER = '9.2.
|
|
9
|
+
export const VER = '9.2.1';
|
|
10
10
|
// --- 服务端用的路径 ---
|
|
11
11
|
const imu = decodeURIComponent(import.meta.url).replace('file://', '').replace(/^\/(\w:)/, '$1');
|
|
12
12
|
/** --- /xxx/xxx --- */
|
package/package.json
CHANGED
package/sys/master.js
CHANGED
|
@@ -546,19 +546,26 @@ function startFileWatcher() {
|
|
|
546
546
|
* --- 监听指定目录的文件变化 ---
|
|
547
547
|
* @param dir 要监听的目录路径
|
|
548
548
|
*/
|
|
549
|
-
const watchDir = (dir) => {
|
|
549
|
+
const watchDir = async (dir) => {
|
|
550
|
+
if (!await lFs.isDir(dir)) {
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
550
553
|
try {
|
|
551
|
-
fs.watch(dir, { 'recursive': true }, (eventType, filename) => {
|
|
554
|
+
const watcher = fs.watch(dir, { 'recursive': true }, (eventType, filename) => {
|
|
552
555
|
if (!filename) {
|
|
553
556
|
return;
|
|
554
557
|
}
|
|
558
|
+
const formatName = filename.replace(/\\/g, '/');
|
|
555
559
|
// --- 仅关注 .js 文件和 .json 配置文件的变更 ---
|
|
556
|
-
if (!
|
|
557
|
-
!
|
|
560
|
+
if (!formatName.endsWith('.js') &&
|
|
561
|
+
!formatName.endsWith('.json')) {
|
|
558
562
|
return;
|
|
559
563
|
}
|
|
560
|
-
// ---
|
|
561
|
-
if (
|
|
564
|
+
// --- 忽略日志目录、临时目录、git 目录和 node_modules ---
|
|
565
|
+
if (formatName.includes('log/') ||
|
|
566
|
+
formatName.includes('ftmp/') ||
|
|
567
|
+
formatName.includes('node_modules/') ||
|
|
568
|
+
formatName.includes('.git/')) {
|
|
562
569
|
return;
|
|
563
570
|
}
|
|
564
571
|
// --- 防抖:500ms 内多次变化只触发一次 ---
|
|
@@ -571,7 +578,7 @@ function startFileWatcher() {
|
|
|
571
578
|
return;
|
|
572
579
|
}
|
|
573
580
|
restarting = true;
|
|
574
|
-
lCore.display(`[HMR] File changed: ${
|
|
581
|
+
lCore.display(`[HMR] File changed: ${formatName}, reloading workers...`);
|
|
575
582
|
(async () => {
|
|
576
583
|
// --- 为所有子进程发送 stop 信息并重启 ---
|
|
577
584
|
for (const pid in workerList) {
|
|
@@ -589,20 +596,23 @@ function startFileWatcher() {
|
|
|
589
596
|
});
|
|
590
597
|
}, 500);
|
|
591
598
|
});
|
|
599
|
+
watcher.on('error', (err) => {
|
|
600
|
+
lCore.display(`[HMR] Watcher error on ${dir}:`, err);
|
|
601
|
+
});
|
|
592
602
|
lCore.display(`[HMR] Watching directory: ${dir}`);
|
|
593
603
|
}
|
|
594
|
-
catch {
|
|
595
|
-
lCore.display(`[HMR] Cannot watch directory: ${dir}
|
|
604
|
+
catch (err) {
|
|
605
|
+
lCore.display(`[HMR] Cannot watch directory: ${dir}`, err);
|
|
596
606
|
}
|
|
597
607
|
};
|
|
598
608
|
// --- 监听 www/ 目录(用户项目代码)---
|
|
599
|
-
watchDir(kebab.WWW_CWD);
|
|
609
|
+
watchDir(kebab.WWW_CWD).catch(() => { });
|
|
600
610
|
// --- 监听 ind/ 目录(独立任务代码)---
|
|
601
|
-
watchDir(kebab.IND_CWD);
|
|
611
|
+
watchDir(kebab.IND_CWD).catch(() => { });
|
|
602
612
|
// --- 监听 lib/ 目录(用户自定义库)---
|
|
603
|
-
watchDir(kebab.LIB_CWD);
|
|
613
|
+
watchDir(kebab.LIB_CWD).catch(() => { });
|
|
604
614
|
// --- 监听 mod/ 目录(用户模型)---
|
|
605
|
-
watchDir(kebab.MOD_CWD);
|
|
615
|
+
watchDir(kebab.MOD_CWD).catch(() => { });
|
|
606
616
|
}
|
|
607
617
|
run().catch(function (e) {
|
|
608
618
|
lCore.display('[master] ------ [Process fatal Error] ------');
|