mm_machine 2.2.0 → 2.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/item.js +20 -1
- package/package.json +1 -1
package/item.js
CHANGED
|
@@ -331,13 +331,23 @@ Item.prototype._setMainMethod = function (module, name) {
|
|
|
331
331
|
}
|
|
332
332
|
};
|
|
333
333
|
|
|
334
|
+
/**
|
|
335
|
+
* 获取配置文件作用域
|
|
336
|
+
* @param {object} file 文件对象
|
|
337
|
+
* @returns {string} 配置文件作用域
|
|
338
|
+
*/
|
|
339
|
+
Item.prototype._getScope = function (file) {
|
|
340
|
+
return file.replace(/\\/g, '/').between('app/', '/');
|
|
341
|
+
};
|
|
342
|
+
|
|
334
343
|
/**
|
|
335
344
|
* 新建配置文件
|
|
336
345
|
* @param {string} file 目标文件路径
|
|
337
346
|
*/
|
|
338
347
|
Item.prototype.newConfig = function (file) {
|
|
339
348
|
if (!this.config.name) {
|
|
340
|
-
this.config.name =
|
|
349
|
+
this.config.name = this._getName(file);
|
|
350
|
+
this.config.scope = this._getScope(file);
|
|
341
351
|
}
|
|
342
352
|
this._createConfigFile(file, this.config, this.dir_base);
|
|
343
353
|
};
|
|
@@ -541,6 +551,15 @@ Item.prototype._removeArrayItem = function (file, config, name) {
|
|
|
541
551
|
return null;
|
|
542
552
|
};
|
|
543
553
|
|
|
554
|
+
/**
|
|
555
|
+
* 获取配置文件名称
|
|
556
|
+
* @param {object} file 文件对象
|
|
557
|
+
* @returns {string} 配置文件名称
|
|
558
|
+
*/
|
|
559
|
+
Item.prototype._getName = function (file) {
|
|
560
|
+
return file.dirname().basename();
|
|
561
|
+
};
|
|
562
|
+
|
|
544
563
|
/**
|
|
545
564
|
* 载入配置
|
|
546
565
|
* @param {object | string} config_data 配置对象或配置路径
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mm_machine",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.1",
|
|
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": {
|