mm_machine 2.5.3 → 2.5.5

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 (4) hide show
  1. package/drive.js +16 -4
  2. package/index.js +1 -1
  3. package/mod.js +1 -1
  4. package/package.json +4 -4
package/drive.js CHANGED
@@ -194,6 +194,18 @@ Drive.prototype._getScriptTpl = function () {
194
194
  async _init() {
195
195
  this.log('debug', \`初始化!\`);
196
196
  },
197
+ /**
198
+ * 启动
199
+ */
200
+ async _start() {
201
+ this.log('debug', \`启动!\`);
202
+ },
203
+ /**
204
+ * 停止
205
+ */
206
+ async _stop() {
207
+ this.log('debug', \`停止!\`);
208
+ },
197
209
  /**
198
210
  * 销毁
199
211
  */
@@ -467,13 +479,13 @@ Drive.prototype._getConfigTpl = function () {
467
479
  // 模块名称,必填
468
480
  "name": "\${name}",
469
481
  // 模块标题,可选,默认"示例标题"
470
- "title": "\${title || "示例标题"}",
482
+ "title": "\${title || '示例标题'}",
471
483
  // 模块描述,可选,默认"示例描述"
472
- "description": "\${description || "示例描述"}",
484
+ "description": "\${description || '示例描述'}",
473
485
  // 主脚本文件路径,可选,默认"./index.js"
474
- "main": "\${main || "./index.js"}",
486
+ "main": "\${main || './index.js'}",
475
487
  // 模块作用域,可选,默认"server"
476
- "scope": "\${scope || "server"}",
488
+ "scope": "\${scope || 'server'}",
477
489
  // 模块状态,可选,默认1
478
490
  "state": \${state || 1},
479
491
  // 模块排序,可选,默认100
package/index.js CHANGED
@@ -487,7 +487,7 @@ Manager.prototype.updateAfter = function () {
487
487
  Manager.prototype.update = async function (dir, clear = true) {
488
488
  if (clear) {
489
489
  // 初始化方法
490
- this.mods = {};
490
+ $.clear(this.mods);
491
491
  }
492
492
 
493
493
  // 查找所有json文件
package/mod.js CHANGED
@@ -105,7 +105,7 @@ Mod.prototype.isLoaded = function () {
105
105
  * @param {...any} params 日志参数
106
106
  */
107
107
  Mod.prototype.log = function (level, message, ...params) {
108
- this.getLogger()[level](`[${this.constructor.name}] [${this.config.name}] ${message}`, ...params);
108
+ this.getLogger()[level](`[${this.constructor.name}.${this.config.name}] ${message}`, ...params);
109
109
  };
110
110
 
111
111
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_machine",
3
- "version": "2.5.3",
3
+ "version": "2.5.5",
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": {
@@ -34,9 +34,9 @@
34
34
  ],
35
35
  "dependencies": {
36
36
  "@prettier/sync": "^0.6.1",
37
- "mm_config": "^2.3.0",
38
- "mm_hot_reload": "^1.3.0",
39
- "mm_tpl": "^2.4.9"
37
+ "mm_config": "^2.3.1",
38
+ "mm_hot_reload": "^1.3.1",
39
+ "mm_tpl": "^2.5.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "eslint": "^10.2.0",