mm_config 2.1.9 → 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/index.js +8 -9
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -117,7 +117,7 @@ Config.prototype.saveAsync = async function () {
|
|
|
117
117
|
* @returns {Proxy} 配置对象的代理实例
|
|
118
118
|
*/
|
|
119
119
|
Config.prototype.getProxy = function () {
|
|
120
|
-
|
|
120
|
+
let self = this;
|
|
121
121
|
|
|
122
122
|
return new Proxy(this.options, {
|
|
123
123
|
set(obj, prop, val) {
|
|
@@ -161,7 +161,7 @@ Config.prototype.getProxy = function () {
|
|
|
161
161
|
* @returns {Proxy} 异步配置对象的代理实例
|
|
162
162
|
*/
|
|
163
163
|
Config.prototype.getAsyncProxy = function () {
|
|
164
|
-
|
|
164
|
+
let self = this;
|
|
165
165
|
|
|
166
166
|
return new Proxy(this.options, {
|
|
167
167
|
set(obj, prop, val) {
|
|
@@ -263,7 +263,7 @@ Config.prototype.keys = async function () {
|
|
|
263
263
|
if (this._conn) {
|
|
264
264
|
keys = await this._conn.keys();
|
|
265
265
|
}
|
|
266
|
-
|
|
266
|
+
let local_keys = Object.keys(this.options);
|
|
267
267
|
keys = keys.concat(local_keys);
|
|
268
268
|
return keys;
|
|
269
269
|
};
|
|
@@ -286,12 +286,12 @@ Config.prototype.destroy = function () {
|
|
|
286
286
|
* @returns {Proxy} 配置代理对象
|
|
287
287
|
*/
|
|
288
288
|
function create(file, options = {}, config = {}) {
|
|
289
|
-
|
|
289
|
+
let f = file.fullname();
|
|
290
290
|
// 检查是否已存在配置
|
|
291
291
|
if (dict[f]) {
|
|
292
292
|
return dict[f].getProxy();
|
|
293
293
|
}
|
|
294
|
-
|
|
294
|
+
let cfg = new Config({ file: f, ...config }, options);
|
|
295
295
|
cfg.saveSync(); // 确保文件存在
|
|
296
296
|
// 注册配置字典
|
|
297
297
|
dict[f] = cfg;
|
|
@@ -306,13 +306,12 @@ function create(file, options = {}, config = {}) {
|
|
|
306
306
|
* @returns {Promise<Proxy>} 异步配置代理对象
|
|
307
307
|
*/
|
|
308
308
|
async function createAsync(file, options = {}, config = {}) {
|
|
309
|
-
|
|
309
|
+
let f = file.fullname();
|
|
310
310
|
// 检查是否已存在配置
|
|
311
311
|
if (dict[f]) {
|
|
312
|
-
this.log('warn', `Config for file ${f} already exists.`);
|
|
313
312
|
return dict[f].getAsyncProxy();
|
|
314
313
|
}
|
|
315
|
-
|
|
314
|
+
let cfg = new Config({ file: f, ...config }, options);
|
|
316
315
|
await cfg.saveAsync(); // 确保文件存在
|
|
317
316
|
// 注册配置字典
|
|
318
317
|
dict[f] = cfg;
|
|
@@ -326,7 +325,7 @@ async function createAsync(file, options = {}, config = {}) {
|
|
|
326
325
|
*/
|
|
327
326
|
function clear(file) {
|
|
328
327
|
if (!file) return clearAll();
|
|
329
|
-
|
|
328
|
+
let f = file.fullname();
|
|
330
329
|
if (dict[f]) {
|
|
331
330
|
delete dict[f];
|
|
332
331
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mm_config",
|
|
3
|
-
"version": "2.1
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"description": "Super Meimei Configuration Synchronizer - Automatically sync configuration changes to JSON files",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"eslint": "^9.39.2",
|
|
47
|
-
"eslint-plugin-jsdoc": "^
|
|
48
|
-
"mm_eslint": "^1.
|
|
47
|
+
"eslint-plugin-jsdoc": "^62.5.0",
|
|
48
|
+
"mm_eslint": "^1.6.3"
|
|
49
49
|
}
|
|
50
50
|
}
|