mm_machine 2.8.7 → 2.8.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +9 -6
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -187,9 +187,10 @@ Manager.prototype.getList = function () {
|
|
|
187
187
|
for (let i = 0; i < this.infos.length; i++) {
|
|
188
188
|
let info = this.infos[i];
|
|
189
189
|
let mod = this.getMod(info.name);
|
|
190
|
-
if (mod) {
|
|
191
|
-
|
|
190
|
+
if (!mod) {
|
|
191
|
+
continue;
|
|
192
192
|
}
|
|
193
|
+
mod.config.state = info.state;
|
|
193
194
|
list.push(mod);
|
|
194
195
|
}
|
|
195
196
|
return list;
|
|
@@ -638,20 +639,22 @@ Manager.prototype._syncFromFile = async function (snapshot) {
|
|
|
638
639
|
var old_dirs = snapshot.mods_map || {};
|
|
639
640
|
var old = this._buildSet(old_dirs);
|
|
640
641
|
|
|
641
|
-
//
|
|
642
|
+
// 扫描目录,对所有文件重新注册(含快照已有模块,补全热更新监听和脚本加载)
|
|
642
643
|
for (var dir in old_dirs) {
|
|
643
644
|
var current = await this._findFiles(dir);
|
|
644
645
|
for (var fi = 0; fi < current.length; fi++) {
|
|
645
646
|
var f = current[fi];
|
|
646
|
-
|
|
647
|
-
this.registerMod(f);
|
|
648
|
-
}
|
|
647
|
+
this.registerMod(f);
|
|
649
648
|
old[f] = false;
|
|
650
649
|
}
|
|
651
650
|
}
|
|
652
651
|
|
|
653
652
|
// 移除已删除的模块
|
|
654
653
|
await this._removeStale(old);
|
|
654
|
+
// 加载所有模块脚本(lazy_load时不阻塞但后台仍加载)
|
|
655
|
+
if (!this.config.lazy_load) {
|
|
656
|
+
await this.loadScripts();
|
|
657
|
+
}
|
|
655
658
|
this.updateInfo();
|
|
656
659
|
await this._saveSnapshotDirs(Object.keys(old_dirs));
|
|
657
660
|
// this.log('info', '快照同步完成');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mm_machine",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.9",
|
|
4
4
|
"description": "A flexible Node.js plugin mechanism system for dynamic loading, management and execution of modules. Supports hot reload, lifecycle management, and modern JavaScript features.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"eslint": "^10.6.0",
|
|
43
|
-
"eslint-plugin-jsdoc": "^63.0.
|
|
43
|
+
"eslint-plugin-jsdoc": "^63.0.12",
|
|
44
44
|
"mm_eslint": "^1.7.5"
|
|
45
45
|
}
|
|
46
46
|
}
|