mm_config 2.2.5 → 2.2.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.
- package/index.js +22 -31
- package/package.json +5 -5
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require('mm_expand');
|
|
1
|
+
const { Base } = require('mm_expand');
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* 配置字典(私有)
|
|
@@ -10,7 +10,25 @@ const dict = {};
|
|
|
10
10
|
* 配置类
|
|
11
11
|
* @class
|
|
12
12
|
*/
|
|
13
|
-
class Config {
|
|
13
|
+
class Config extends Base {
|
|
14
|
+
/**
|
|
15
|
+
* 配置选项
|
|
16
|
+
* @type {object}
|
|
17
|
+
*/
|
|
18
|
+
static config = {
|
|
19
|
+
debounce_time: 0, // 默认不防抖
|
|
20
|
+
pretty: true,
|
|
21
|
+
format: 'json',
|
|
22
|
+
file: ''
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* 预设选项
|
|
26
|
+
* @type {object}
|
|
27
|
+
*/
|
|
28
|
+
static options = {
|
|
29
|
+
|
|
30
|
+
};
|
|
31
|
+
|
|
14
32
|
/**
|
|
15
33
|
* 创建配置实例
|
|
16
34
|
* @param {object} config - 配置选项
|
|
@@ -21,41 +39,14 @@ class Config {
|
|
|
21
39
|
* @param {object} options - 选项
|
|
22
40
|
*/
|
|
23
41
|
constructor(config, options = {}) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
pretty: true,
|
|
27
|
-
format: 'json',
|
|
28
|
-
file: ''
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
this.options = options || {};
|
|
42
|
+
super(config);
|
|
43
|
+
this.options = { ...Config.options, ...options };
|
|
32
44
|
this._conn = null;
|
|
33
45
|
this._timer = null;
|
|
34
46
|
this._promise = Promise.resolve();
|
|
35
|
-
this._logger = $.log || console;
|
|
36
|
-
// 设置配置
|
|
37
|
-
this.setConfig(config);
|
|
38
47
|
}
|
|
39
48
|
}
|
|
40
49
|
|
|
41
|
-
/**
|
|
42
|
-
* 日志输出
|
|
43
|
-
* @param {string} level - 日志级别(debug/info/warn/error)
|
|
44
|
-
* @param {string} message - 日志消息
|
|
45
|
-
* @param {...*} args - 可选参数
|
|
46
|
-
*/
|
|
47
|
-
Config.prototype.log = function (level, message, ...args) {
|
|
48
|
-
this._logger[level](`[${this.constructor.name}] ${message}`, ...args);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* 设置配置
|
|
53
|
-
* @param {object} config - 配置对象
|
|
54
|
-
*/
|
|
55
|
-
Config.prototype.setConfig = function (config) {
|
|
56
|
-
$.push(this.config, config);
|
|
57
|
-
};
|
|
58
|
-
|
|
59
50
|
/**
|
|
60
51
|
* 设置配置
|
|
61
52
|
* @param {object} options - 配置对象
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mm_config",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.7",
|
|
4
4
|
"description": "Super Meimei Configuration Synchronizer - Automatically sync configuration changes to JSON files",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
"LICENSE"
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"mm_expand": "^2.0.
|
|
43
|
+
"mm_expand": "^2.0.7"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"eslint": "^
|
|
47
|
-
"eslint-plugin-jsdoc": "^62.
|
|
48
|
-
"mm_eslint": "^1.
|
|
46
|
+
"eslint": "^10.2.0",
|
|
47
|
+
"eslint-plugin-jsdoc": "^62.9.0",
|
|
48
|
+
"mm_eslint": "^1.7.1"
|
|
49
49
|
}
|
|
50
50
|
}
|