mm_machine 2.8.8 → 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.
Files changed (2) hide show
  1. package/index.js +6 -4
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -639,20 +639,22 @@ Manager.prototype._syncFromFile = async function (snapshot) {
639
639
  var old_dirs = snapshot.mods_map || {};
640
640
  var old = this._buildSet(old_dirs);
641
641
 
642
- // 扫描目录并注册新模块
642
+ // 扫描目录,对所有文件重新注册(含快照已有模块,补全热更新监听和脚本加载)
643
643
  for (var dir in old_dirs) {
644
644
  var current = await this._findFiles(dir);
645
645
  for (var fi = 0; fi < current.length; fi++) {
646
646
  var f = current[fi];
647
- if (!old[f]) {
648
- this.registerMod(f);
649
- }
647
+ this.registerMod(f);
650
648
  old[f] = false;
651
649
  }
652
650
  }
653
651
 
654
652
  // 移除已删除的模块
655
653
  await this._removeStale(old);
654
+ // 加载所有模块脚本(lazy_load时不阻塞但后台仍加载)
655
+ if (!this.config.lazy_load) {
656
+ await this.loadScripts();
657
+ }
656
658
  this.updateInfo();
657
659
  await this._saveSnapshotDirs(Object.keys(old_dirs));
658
660
  // this.log('info', '快照同步完成');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_machine",
3
- "version": "2.8.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": {