mm_machine 2.1.6 → 2.1.7

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/item.js +11 -11
  2. package/package.json +1 -1
package/item.js CHANGED
@@ -61,7 +61,7 @@ class Item {
61
61
  // 描述, 用于描述该有什么用的
62
62
  description: '',
63
63
  // 文件路径, 当调用函数不存在时,会先从文件中加载
64
- func_file: './index.js',
64
+ main: './index.js',
65
65
  // 回调函数名 用于决定调用脚本的哪个函数
66
66
  func_name: '',
67
67
  // 排序
@@ -103,8 +103,8 @@ Item.prototype.log = function (level, message, ...args) {
103
103
  Item.prototype.setConfig = function (config) {
104
104
  if (!config) return;
105
105
 
106
- // 如果func_file改变,重置加载状态
107
- if (config.func_file !== this.config.func_file) {
106
+ // 如果main改变,重置加载状态
107
+ if (config.main !== this.config.main) {
108
108
  this.complete = false;
109
109
  }
110
110
 
@@ -161,9 +161,9 @@ Item.prototype._remove = function (module) {
161
161
  Item.prototype.unloadScript = function (file) {
162
162
  let target_file = file;
163
163
  if (!target_file) {
164
- const func_file = this.config.func_file;
165
- if (func_file) {
166
- target_file = func_file.fullname(this.dir);
164
+ const main = this.config.main;
165
+ if (main) {
166
+ target_file = main.fullname(this.dir);
167
167
  }
168
168
  }
169
169
 
@@ -231,10 +231,10 @@ Item.prototype.loadScript = function (file, name = '') {
231
231
  Item.prototype._getScriptFile = function (file) {
232
232
  if (file) return file;
233
233
 
234
- const func_file = this.config.func_file;
235
- if (!func_file) return null;
234
+ const main = this.config.main;
235
+ if (!main) return null;
236
236
 
237
- const target_file = func_file.fullname(this.dir);
237
+ const target_file = main.fullname(this.dir);
238
238
  if (!target_file.hasFile()) {
239
239
  this.newScript(target_file);
240
240
  }
@@ -378,8 +378,8 @@ Item.prototype._reloadIfNeeded = function () {
378
378
  * 删除目录
379
379
  */
380
380
  Item.prototype.delDir = function () {
381
- const func_file = this.config.func_file;
382
- if (func_file && $.dir && $.dir.del) {
381
+ const main = this.config.main;
382
+ if (main && $.dir && $.dir.del) {
383
383
  $.dir.del(this.dir);
384
384
  }
385
385
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_machine",
3
- "version": "2.1.6",
3
+ "version": "2.1.7",
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": {