plugin-tls 3.4.0 → 3.5.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/dist/index.js +194 -177
- package/dist/index.umd.cjs +1 -1
- package/dist/plugin-manager/ExtendManager.d.ts.map +1 -1
- package/dist/plugin-manager/IExtend.d.ts +10 -0
- package/dist/plugin-manager/IExtend.d.ts.map +1 -1
- package/dist/plugin-manager/PluginExtendManager.d.ts.map +1 -1
- package/dist/plugin-manager/mixin.d.ts +16 -0
- package/dist/plugin-manager/mixin.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,72 +1,86 @@
|
|
|
1
|
-
import { Destroyable as M, DestroyableEventEmitter as
|
|
2
|
-
import { serialCallFuns as g } from "com-tools";
|
|
3
|
-
import { deepmergeInto as
|
|
4
|
-
function
|
|
1
|
+
import { Destroyable as M, DestroyableEventEmitter as H, DestroyableEventTarget as V, createDestroyableSubClass as j } from "@gby/destroyable";
|
|
2
|
+
import { omitMembers as k, removeUndefined as I, pickMembers as S, serialCallFuns as g } from "com-tools";
|
|
3
|
+
import { deepmergeInto as y, deepmerge as w } from "deepmerge-ts";
|
|
4
|
+
function p(s, ...t) {
|
|
5
5
|
for (const e of t) {
|
|
6
6
|
const n = Object.getOwnPropertyDescriptors(e);
|
|
7
7
|
Object.defineProperties(s, n);
|
|
8
8
|
}
|
|
9
9
|
return s;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function W(s, t, e) {
|
|
12
|
+
let n = Object.getOwnPropertyDescriptors(t);
|
|
13
|
+
return e && k(n, e), Object.defineProperties(s, n), s;
|
|
14
|
+
}
|
|
15
|
+
function G(s, t, e) {
|
|
16
|
+
let n = Object.getOwnPropertyDescriptors(t);
|
|
17
|
+
return e ? Object.defineProperties(s, I(S(n, e))) : Object.defineProperties(s, n), s;
|
|
18
|
+
}
|
|
19
|
+
function J(s, t) {
|
|
12
20
|
return t;
|
|
13
21
|
}
|
|
14
|
-
function
|
|
22
|
+
function L() {
|
|
15
23
|
return function(t) {
|
|
16
24
|
return t;
|
|
17
25
|
};
|
|
18
26
|
}
|
|
19
|
-
function
|
|
20
|
-
return
|
|
27
|
+
function Q(s, t) {
|
|
28
|
+
return p(s, t), t;
|
|
21
29
|
}
|
|
22
|
-
function
|
|
30
|
+
function X(s) {
|
|
23
31
|
return function(e) {
|
|
24
|
-
return
|
|
32
|
+
return p(s, e), e;
|
|
25
33
|
};
|
|
26
34
|
}
|
|
27
|
-
function
|
|
28
|
-
return
|
|
35
|
+
function c(s, t) {
|
|
36
|
+
return p(s, t), s;
|
|
29
37
|
}
|
|
30
|
-
function
|
|
38
|
+
function Y(s) {
|
|
31
39
|
return function(e) {
|
|
32
|
-
return
|
|
40
|
+
return p(s, e), s;
|
|
33
41
|
};
|
|
34
42
|
}
|
|
35
|
-
function
|
|
43
|
+
function Z(s, t) {
|
|
36
44
|
return t;
|
|
37
45
|
}
|
|
38
|
-
function
|
|
46
|
+
function tt() {
|
|
39
47
|
return function(t) {
|
|
40
48
|
return t;
|
|
41
49
|
};
|
|
42
50
|
}
|
|
43
|
-
function
|
|
44
|
-
return
|
|
51
|
+
function et(s, t) {
|
|
52
|
+
return p(s.prototype, t), t;
|
|
45
53
|
}
|
|
46
|
-
function
|
|
54
|
+
function nt(s) {
|
|
47
55
|
return function(e) {
|
|
48
|
-
return
|
|
56
|
+
return p(s.prototype, e), e;
|
|
49
57
|
};
|
|
50
58
|
}
|
|
51
|
-
function
|
|
52
|
-
return
|
|
59
|
+
function st(s, t) {
|
|
60
|
+
return p(s.prototype, t), s;
|
|
53
61
|
}
|
|
54
|
-
function
|
|
62
|
+
function it(s) {
|
|
55
63
|
return function(e) {
|
|
56
|
-
return
|
|
64
|
+
return p(s.prototype, e), s;
|
|
57
65
|
};
|
|
58
66
|
}
|
|
59
|
-
const
|
|
60
|
-
function
|
|
67
|
+
const b = ["onCreate", "onInit", "onDestroy"];
|
|
68
|
+
function rt(s) {
|
|
61
69
|
const t = { ...s };
|
|
62
|
-
for (const e of
|
|
70
|
+
for (const e of b)
|
|
63
71
|
typeof t[e] == "function" && delete t[e];
|
|
64
72
|
return t;
|
|
65
73
|
}
|
|
66
|
-
function
|
|
74
|
+
function T(s, t) {
|
|
75
|
+
let e = Object.getOwnPropertyDescriptors(t);
|
|
76
|
+
for (const n of b)
|
|
77
|
+
typeof t[n] == "function" && delete e[n];
|
|
78
|
+
return Object.defineProperties(s, e), s;
|
|
79
|
+
}
|
|
80
|
+
function A(s) {
|
|
67
81
|
return s && typeof s.onUse == "function";
|
|
68
82
|
}
|
|
69
|
-
class
|
|
83
|
+
class ot extends M {
|
|
70
84
|
/**
|
|
71
85
|
* 插件的宿主
|
|
72
86
|
*/
|
|
@@ -158,7 +172,7 @@ class tt extends M {
|
|
|
158
172
|
return e.reverse(), g(e, void 0, [t]);
|
|
159
173
|
}
|
|
160
174
|
}
|
|
161
|
-
class
|
|
175
|
+
class ut extends M {
|
|
162
176
|
/**
|
|
163
177
|
* 插件的宿主
|
|
164
178
|
*/
|
|
@@ -191,7 +205,7 @@ class et extends M {
|
|
|
191
205
|
*/
|
|
192
206
|
use(t) {
|
|
193
207
|
const { plugins: e } = this;
|
|
194
|
-
return e.has(t) || (
|
|
208
|
+
return e.has(t) || (T(this.host.prototype, t), e.add(t)), t;
|
|
195
209
|
}
|
|
196
210
|
/**
|
|
197
211
|
* 插件宿主实例的注册插件的方法
|
|
@@ -280,7 +294,7 @@ class d extends M {
|
|
|
280
294
|
*/
|
|
281
295
|
isPlugin(t) {
|
|
282
296
|
const { plugins: e } = this;
|
|
283
|
-
return e.has(t) ? e.get(t) !== O :
|
|
297
|
+
return e.has(t) ? e.get(t) !== O : A(t);
|
|
284
298
|
}
|
|
285
299
|
/**
|
|
286
300
|
* 使用插件、注册插件
|
|
@@ -289,7 +303,7 @@ class d extends M {
|
|
|
289
303
|
*/
|
|
290
304
|
useExtend(t) {
|
|
291
305
|
const { plugins: e } = this;
|
|
292
|
-
return e.has(t) ? e.get(t) : (
|
|
306
|
+
return e.has(t) ? e.get(t) : (T(this.host.prototype, t), e.set(t, O), t);
|
|
293
307
|
}
|
|
294
308
|
/**
|
|
295
309
|
* 插件宿主实例的注册插件的方法
|
|
@@ -377,10 +391,10 @@ class d extends M {
|
|
|
377
391
|
return e.reverse(), g(e, t, [t]);
|
|
378
392
|
}
|
|
379
393
|
}
|
|
380
|
-
function
|
|
394
|
+
function at(s, t) {
|
|
381
395
|
const e = t ?? "defaultOptions", n = `_${e}`;
|
|
382
396
|
return function(r) {
|
|
383
|
-
const o =
|
|
397
|
+
const o = c(r, {
|
|
384
398
|
/**
|
|
385
399
|
* 全局级别的默认选项
|
|
386
400
|
*/
|
|
@@ -388,7 +402,7 @@ function nt(s, t) {
|
|
|
388
402
|
return s;
|
|
389
403
|
}
|
|
390
404
|
});
|
|
391
|
-
|
|
405
|
+
c(o.prototype, {
|
|
392
406
|
/**
|
|
393
407
|
* 实例级的默认选项
|
|
394
408
|
*/
|
|
@@ -398,9 +412,9 @@ function nt(s, t) {
|
|
|
398
412
|
});
|
|
399
413
|
};
|
|
400
414
|
}
|
|
401
|
-
function
|
|
415
|
+
function lt(s, t, e) {
|
|
402
416
|
const n = `_${t}`;
|
|
403
|
-
return
|
|
417
|
+
return c(s.prototype, {
|
|
404
418
|
/**
|
|
405
419
|
* 实例级的默认选项
|
|
406
420
|
*/
|
|
@@ -413,13 +427,13 @@ function E(s) {
|
|
|
413
427
|
const t = s.split(".");
|
|
414
428
|
return t[0] === "" && t.shift(), t;
|
|
415
429
|
}
|
|
416
|
-
function
|
|
430
|
+
function x(s, t) {
|
|
417
431
|
for (const e of t)
|
|
418
432
|
if (s = s[e], s == null) return;
|
|
419
433
|
return s;
|
|
420
434
|
}
|
|
421
|
-
function
|
|
422
|
-
return
|
|
435
|
+
function pt(s, t) {
|
|
436
|
+
return x(s, E(t));
|
|
423
437
|
}
|
|
424
438
|
function U(s, t, e) {
|
|
425
439
|
const n = t.pop(), i = t.length;
|
|
@@ -434,10 +448,10 @@ function U(s, t, e) {
|
|
|
434
448
|
s = s[o] = {};
|
|
435
449
|
return s[n] = e, s;
|
|
436
450
|
}
|
|
437
|
-
function
|
|
451
|
+
function dt(s, t, e) {
|
|
438
452
|
return U(s, E(t), e);
|
|
439
453
|
}
|
|
440
|
-
const
|
|
454
|
+
const P = {
|
|
441
455
|
UndefinedAndNull: function(t) {
|
|
442
456
|
return t == null;
|
|
443
457
|
},
|
|
@@ -448,7 +462,7 @@ const x = {
|
|
|
448
462
|
return t === null;
|
|
449
463
|
}
|
|
450
464
|
};
|
|
451
|
-
class
|
|
465
|
+
class v {
|
|
452
466
|
/**
|
|
453
467
|
* 是否要冻结 fullOption 的成员
|
|
454
468
|
* @remarks
|
|
@@ -500,7 +514,7 @@ class b {
|
|
|
500
514
|
* @param deep - 是否要进行深度合并
|
|
501
515
|
*/
|
|
502
516
|
setOption(t, e) {
|
|
503
|
-
const n = e ?
|
|
517
|
+
const n = e ? y(this.option, t) : Object.assign(this.option, t);
|
|
504
518
|
return this.updateFullOption(), n;
|
|
505
519
|
}
|
|
506
520
|
/**
|
|
@@ -510,13 +524,13 @@ class b {
|
|
|
510
524
|
return this._undefinedValue;
|
|
511
525
|
}
|
|
512
526
|
set undefinedValue(t) {
|
|
513
|
-
this._undefinedValue = t, this.isUndefined =
|
|
527
|
+
this._undefinedValue = t, this.isUndefined = P[t] || P.UndefinedAndNull;
|
|
514
528
|
}
|
|
515
529
|
_undefinedValue = "UndefinedAndNull";
|
|
516
530
|
/**
|
|
517
531
|
* 未定义值的判断函数
|
|
518
532
|
*/
|
|
519
|
-
isUndefined =
|
|
533
|
+
isUndefined = P.UndefinedAndNull;
|
|
520
534
|
/**
|
|
521
535
|
* 获取选项成员
|
|
522
536
|
* @param key
|
|
@@ -537,7 +551,7 @@ class b {
|
|
|
537
551
|
delete i[t];
|
|
538
552
|
else {
|
|
539
553
|
const r = i[t];
|
|
540
|
-
n && r && typeof r == "object" ?
|
|
554
|
+
n && r && typeof r == "object" ? y(r, e) : i[t] = e;
|
|
541
555
|
}
|
|
542
556
|
this.updateFullOption();
|
|
543
557
|
}
|
|
@@ -547,7 +561,7 @@ class b {
|
|
|
547
561
|
* @returns
|
|
548
562
|
*/
|
|
549
563
|
getValue(t) {
|
|
550
|
-
return
|
|
564
|
+
return x(this.option, t);
|
|
551
565
|
}
|
|
552
566
|
/**
|
|
553
567
|
* 设置属性路径对应的值
|
|
@@ -559,10 +573,10 @@ class b {
|
|
|
559
573
|
setValue(t, e, n) {
|
|
560
574
|
const i = this.option;
|
|
561
575
|
let r;
|
|
562
|
-
n && (r =
|
|
576
|
+
n && (r = x(i, t)) && typeof r == "object" ? y(r, e) : U(this.option, t, e), this.updateFullOption();
|
|
563
577
|
}
|
|
564
578
|
}
|
|
565
|
-
class
|
|
579
|
+
class u extends v {
|
|
566
580
|
constructor(t, e) {
|
|
567
581
|
super(), t && (this.option = t), e && (this.extends = e);
|
|
568
582
|
}
|
|
@@ -627,15 +641,15 @@ class a extends b {
|
|
|
627
641
|
return n.getValue(t);
|
|
628
642
|
}
|
|
629
643
|
}
|
|
630
|
-
function
|
|
644
|
+
function gt(s, t) {
|
|
631
645
|
const { name: e } = t, n = `_${e}`;
|
|
632
646
|
return {
|
|
633
647
|
get: function() {
|
|
634
|
-
return this[n] || (this[n] = new
|
|
648
|
+
return this[n] || (this[n] = new u(void 0, this.constructor[e]));
|
|
635
649
|
}
|
|
636
650
|
};
|
|
637
651
|
}
|
|
638
|
-
class
|
|
652
|
+
class B extends v {
|
|
639
653
|
constructor(t, e) {
|
|
640
654
|
super(), e && this.setModeOption(t, e), this.mode = t;
|
|
641
655
|
}
|
|
@@ -725,15 +739,15 @@ class S extends b {
|
|
|
725
739
|
* @param extend - 继承哪个模式
|
|
726
740
|
*/
|
|
727
741
|
setModeOption(t, e, n, i) {
|
|
728
|
-
const { modes: r } = this, o = r[t] || (r[t] = new
|
|
742
|
+
const { modes: r } = this, o = r[t] || (r[t] = new u());
|
|
729
743
|
if (o.setOption(e, n), i) {
|
|
730
|
-
const
|
|
731
|
-
|
|
744
|
+
const l = r[i];
|
|
745
|
+
l && (o.extends = l);
|
|
732
746
|
}
|
|
733
747
|
return this.updateFullOption(), o;
|
|
734
748
|
}
|
|
735
749
|
}
|
|
736
|
-
class
|
|
750
|
+
class a extends B {
|
|
737
751
|
constructor(t, e, n) {
|
|
738
752
|
super(t, e), n && (this.extends = n);
|
|
739
753
|
}
|
|
@@ -822,15 +836,15 @@ class l extends S {
|
|
|
822
836
|
return n.getValue(t);
|
|
823
837
|
}
|
|
824
838
|
}
|
|
825
|
-
function
|
|
839
|
+
function ct(s, t) {
|
|
826
840
|
const { name: e } = t, n = `_${e}`;
|
|
827
841
|
return {
|
|
828
842
|
get: function() {
|
|
829
|
-
return this[n] || (this[n] = new
|
|
843
|
+
return this[n] || (this[n] = new a(this.constructor[e].mode, void 0, this.constructor[e]));
|
|
830
844
|
}
|
|
831
845
|
};
|
|
832
846
|
}
|
|
833
|
-
class
|
|
847
|
+
class D extends M {
|
|
834
848
|
/**
|
|
835
849
|
* 是否使用独立的插件管理器
|
|
836
850
|
* @defaultValue false
|
|
@@ -913,7 +927,7 @@ class v extends M {
|
|
|
913
927
|
return t instanceof Promise ? t.finally(() => super.destroyThis()) : super.destroyThis();
|
|
914
928
|
}
|
|
915
929
|
}
|
|
916
|
-
class F extends
|
|
930
|
+
class F extends H {
|
|
917
931
|
/**
|
|
918
932
|
* 是否使用独立的插件管理器
|
|
919
933
|
* @defaultValue false
|
|
@@ -996,7 +1010,7 @@ class F extends N {
|
|
|
996
1010
|
return t instanceof Promise ? t.finally(() => super.destroyThis()) : super.destroyThis();
|
|
997
1011
|
}
|
|
998
1012
|
}
|
|
999
|
-
class
|
|
1013
|
+
class C extends V {
|
|
1000
1014
|
/**
|
|
1001
1015
|
* 是否使用独立的插件管理器
|
|
1002
1016
|
* @defaultValue false
|
|
@@ -1079,8 +1093,8 @@ class D extends H {
|
|
|
1079
1093
|
return t instanceof Promise ? t.finally(() => super.destroyThis()) : super.destroyThis();
|
|
1080
1094
|
}
|
|
1081
1095
|
}
|
|
1082
|
-
function
|
|
1083
|
-
const t =
|
|
1096
|
+
function N(s) {
|
|
1097
|
+
const t = j(s);
|
|
1084
1098
|
return class extends t {
|
|
1085
1099
|
/**
|
|
1086
1100
|
* 是否使用独立的插件管理器
|
|
@@ -1164,8 +1178,8 @@ function C(s) {
|
|
|
1164
1178
|
}
|
|
1165
1179
|
};
|
|
1166
1180
|
}
|
|
1167
|
-
function
|
|
1168
|
-
const t =
|
|
1181
|
+
function $(s) {
|
|
1182
|
+
const t = c(s, {
|
|
1169
1183
|
/**
|
|
1170
1184
|
* 是否使用独立的插件管理器
|
|
1171
1185
|
* @defaultValue false
|
|
@@ -1199,7 +1213,7 @@ function j(s) {
|
|
|
1199
1213
|
return this.pluginManager.hasUsed(e);
|
|
1200
1214
|
}
|
|
1201
1215
|
});
|
|
1202
|
-
return
|
|
1216
|
+
return c(t.prototype, {
|
|
1203
1217
|
/**
|
|
1204
1218
|
* 插件管理器
|
|
1205
1219
|
*/
|
|
@@ -1237,8 +1251,8 @@ function j(s) {
|
|
|
1237
1251
|
}
|
|
1238
1252
|
}), s;
|
|
1239
1253
|
}
|
|
1240
|
-
function
|
|
1241
|
-
const t =
|
|
1254
|
+
function ft(s) {
|
|
1255
|
+
const t = $(s);
|
|
1242
1256
|
return new Proxy(t, {
|
|
1243
1257
|
construct: function(e, n, i) {
|
|
1244
1258
|
const r = new e(...n);
|
|
@@ -1246,7 +1260,7 @@ function lt(s) {
|
|
|
1246
1260
|
}
|
|
1247
1261
|
});
|
|
1248
1262
|
}
|
|
1249
|
-
function
|
|
1263
|
+
function mt(s) {
|
|
1250
1264
|
return class extends s {
|
|
1251
1265
|
/**
|
|
1252
1266
|
* 是否使用独立的插件管理器
|
|
@@ -1328,66 +1342,66 @@ function dt(s) {
|
|
|
1328
1342
|
}
|
|
1329
1343
|
};
|
|
1330
1344
|
}
|
|
1331
|
-
class
|
|
1345
|
+
class Mt extends D {
|
|
1332
1346
|
/**
|
|
1333
1347
|
* 全局级别的默认选项
|
|
1334
1348
|
*/
|
|
1335
|
-
static defaultOptions = new
|
|
1349
|
+
static defaultOptions = new u();
|
|
1336
1350
|
/**
|
|
1337
1351
|
* 实例级的默认选项
|
|
1338
1352
|
*/
|
|
1339
1353
|
get defaultOptions() {
|
|
1340
|
-
return this._defaultOptions || (this._defaultOptions = new
|
|
1354
|
+
return this._defaultOptions || (this._defaultOptions = new u(void 0, this.constructor.defaultOptions));
|
|
1341
1355
|
}
|
|
1342
1356
|
_defaultOptions;
|
|
1343
1357
|
constructor(t) {
|
|
1344
1358
|
super(), this.defaultOptions.option = t;
|
|
1345
1359
|
}
|
|
1346
1360
|
}
|
|
1347
|
-
class
|
|
1361
|
+
class yt extends F {
|
|
1348
1362
|
/**
|
|
1349
1363
|
* 全局级别的默认选项
|
|
1350
1364
|
*/
|
|
1351
|
-
static defaultOptions = new
|
|
1365
|
+
static defaultOptions = new u();
|
|
1352
1366
|
/**
|
|
1353
1367
|
* 实例级的默认选项
|
|
1354
1368
|
*/
|
|
1355
1369
|
get defaultOptions() {
|
|
1356
|
-
return this._defaultOptions || (this._defaultOptions = new
|
|
1370
|
+
return this._defaultOptions || (this._defaultOptions = new u(void 0, this.constructor.defaultOptions));
|
|
1357
1371
|
}
|
|
1358
1372
|
_defaultOptions;
|
|
1359
1373
|
constructor(t) {
|
|
1360
1374
|
super(), this.defaultOptions.option = t;
|
|
1361
1375
|
}
|
|
1362
1376
|
}
|
|
1363
|
-
class
|
|
1377
|
+
class Pt extends C {
|
|
1364
1378
|
/**
|
|
1365
1379
|
* 全局级别的默认选项
|
|
1366
1380
|
*/
|
|
1367
|
-
static defaultOptions = new
|
|
1381
|
+
static defaultOptions = new u();
|
|
1368
1382
|
/**
|
|
1369
1383
|
* 实例级的默认选项
|
|
1370
1384
|
*/
|
|
1371
1385
|
get defaultOptions() {
|
|
1372
|
-
return this._defaultOptions || (this._defaultOptions = new
|
|
1386
|
+
return this._defaultOptions || (this._defaultOptions = new u(void 0, this.constructor.defaultOptions));
|
|
1373
1387
|
}
|
|
1374
1388
|
_defaultOptions;
|
|
1375
1389
|
constructor(t) {
|
|
1376
1390
|
super(), this.defaultOptions.option = t;
|
|
1377
1391
|
}
|
|
1378
1392
|
}
|
|
1379
|
-
function
|
|
1380
|
-
const t =
|
|
1393
|
+
function _t(s) {
|
|
1394
|
+
const t = N(s);
|
|
1381
1395
|
return class extends t {
|
|
1382
1396
|
/**
|
|
1383
1397
|
* 全局级别的默认选项
|
|
1384
1398
|
*/
|
|
1385
|
-
static defaultOptions = new
|
|
1399
|
+
static defaultOptions = new u();
|
|
1386
1400
|
/**
|
|
1387
1401
|
* 实例级的默认选项
|
|
1388
1402
|
*/
|
|
1389
1403
|
get defaultOptions() {
|
|
1390
|
-
return this._defaultOptions || (this._defaultOptions = new
|
|
1404
|
+
return this._defaultOptions || (this._defaultOptions = new u(void 0, this.constructor.defaultOptions));
|
|
1391
1405
|
}
|
|
1392
1406
|
_defaultOptions;
|
|
1393
1407
|
constructor(n) {
|
|
@@ -1395,17 +1409,17 @@ function Ot(s) {
|
|
|
1395
1409
|
}
|
|
1396
1410
|
};
|
|
1397
1411
|
}
|
|
1398
|
-
const
|
|
1399
|
-
class
|
|
1412
|
+
const h = "common";
|
|
1413
|
+
class wt extends D {
|
|
1400
1414
|
/**
|
|
1401
1415
|
* 全局级别的默认选项
|
|
1402
1416
|
*/
|
|
1403
|
-
static modeOptions = new
|
|
1417
|
+
static modeOptions = new a(h);
|
|
1404
1418
|
/**
|
|
1405
1419
|
* 实例级的默认选项
|
|
1406
1420
|
*/
|
|
1407
1421
|
get modeOptions() {
|
|
1408
|
-
return this._modeOptions || (this._modeOptions = new
|
|
1422
|
+
return this._modeOptions || (this._modeOptions = new a(h, void 0, this.constructor.modeOptions));
|
|
1409
1423
|
}
|
|
1410
1424
|
_modeOptions;
|
|
1411
1425
|
get mode() {
|
|
@@ -1421,16 +1435,16 @@ class mt extends v {
|
|
|
1421
1435
|
super(), this.modeOptions.setOption(t);
|
|
1422
1436
|
}
|
|
1423
1437
|
}
|
|
1424
|
-
class
|
|
1438
|
+
class bt extends F {
|
|
1425
1439
|
/**
|
|
1426
1440
|
* 全局级别的默认选项
|
|
1427
1441
|
*/
|
|
1428
|
-
static modeOptions = new
|
|
1442
|
+
static modeOptions = new a(h);
|
|
1429
1443
|
/**
|
|
1430
1444
|
* 实例级的默认选项
|
|
1431
1445
|
*/
|
|
1432
1446
|
get modeOptions() {
|
|
1433
|
-
return this._modeOptions || (this._modeOptions = new
|
|
1447
|
+
return this._modeOptions || (this._modeOptions = new a(h, void 0, this.constructor.modeOptions));
|
|
1434
1448
|
}
|
|
1435
1449
|
_modeOptions;
|
|
1436
1450
|
get mode() {
|
|
@@ -1446,16 +1460,16 @@ class Mt extends F {
|
|
|
1446
1460
|
super(), this.modeOptions.setOption(t);
|
|
1447
1461
|
}
|
|
1448
1462
|
}
|
|
1449
|
-
class
|
|
1463
|
+
class Tt extends C {
|
|
1450
1464
|
/**
|
|
1451
1465
|
* 全局级别的默认选项
|
|
1452
1466
|
*/
|
|
1453
|
-
static modeOptions = new
|
|
1467
|
+
static modeOptions = new a(h);
|
|
1454
1468
|
/**
|
|
1455
1469
|
* 实例级的默认选项
|
|
1456
1470
|
*/
|
|
1457
1471
|
get modeOptions() {
|
|
1458
|
-
return this._modeOptions || (this._modeOptions = new
|
|
1472
|
+
return this._modeOptions || (this._modeOptions = new a(h, void 0, this.constructor.modeOptions));
|
|
1459
1473
|
}
|
|
1460
1474
|
_modeOptions;
|
|
1461
1475
|
get mode() {
|
|
@@ -1471,18 +1485,18 @@ class Pt extends D {
|
|
|
1471
1485
|
super(), this.modeOptions.setOption(t);
|
|
1472
1486
|
}
|
|
1473
1487
|
}
|
|
1474
|
-
function
|
|
1475
|
-
const t =
|
|
1488
|
+
function Ut(s) {
|
|
1489
|
+
const t = N(s);
|
|
1476
1490
|
return class extends t {
|
|
1477
1491
|
/**
|
|
1478
1492
|
* 全局级别的默认选项
|
|
1479
1493
|
*/
|
|
1480
|
-
static modeOptions = new
|
|
1494
|
+
static modeOptions = new a(h);
|
|
1481
1495
|
/**
|
|
1482
1496
|
* 实例级的默认选项
|
|
1483
1497
|
*/
|
|
1484
1498
|
get modeOptions() {
|
|
1485
|
-
return this._modeOptions || (this._modeOptions = new
|
|
1499
|
+
return this._modeOptions || (this._modeOptions = new a(h, void 0, this.constructor.modeOptions));
|
|
1486
1500
|
}
|
|
1487
1501
|
_modeOptions;
|
|
1488
1502
|
get mode() {
|
|
@@ -1499,19 +1513,19 @@ function yt(s) {
|
|
|
1499
1513
|
}
|
|
1500
1514
|
};
|
|
1501
1515
|
}
|
|
1502
|
-
function
|
|
1503
|
-
const n =
|
|
1516
|
+
function vt(s, t, e) {
|
|
1517
|
+
const n = c(s, {
|
|
1504
1518
|
/**
|
|
1505
1519
|
* 全局级别的默认选项
|
|
1506
1520
|
*/
|
|
1507
|
-
modeOptions: new
|
|
1521
|
+
modeOptions: new a(t, e)
|
|
1508
1522
|
});
|
|
1509
|
-
return
|
|
1523
|
+
return c(n.prototype, {
|
|
1510
1524
|
/**
|
|
1511
1525
|
* 实例级的默认选项
|
|
1512
1526
|
*/
|
|
1513
1527
|
get modeOptions() {
|
|
1514
|
-
return this._modeOptions || (this._modeOptions = new
|
|
1528
|
+
return this._modeOptions || (this._modeOptions = new a(t, void 0, this.constructor.modeOptions));
|
|
1515
1529
|
},
|
|
1516
1530
|
get mode() {
|
|
1517
1531
|
return this.modeOptions.mode;
|
|
@@ -1524,19 +1538,19 @@ function _t(s, t, e) {
|
|
|
1524
1538
|
}
|
|
1525
1539
|
}), s;
|
|
1526
1540
|
}
|
|
1527
|
-
const
|
|
1541
|
+
const Dt = {
|
|
1528
1542
|
onUse(s, t, e) {
|
|
1529
|
-
const n = t ??
|
|
1530
|
-
|
|
1531
|
-
modeOptions: new
|
|
1543
|
+
const n = t ?? h;
|
|
1544
|
+
p(s, {
|
|
1545
|
+
modeOptions: new a(
|
|
1532
1546
|
n,
|
|
1533
1547
|
void 0,
|
|
1534
1548
|
e
|
|
1535
1549
|
)
|
|
1536
|
-
}),
|
|
1550
|
+
}), p(s.prototype, {
|
|
1537
1551
|
get modeOptions() {
|
|
1538
1552
|
const i = this, r = s;
|
|
1539
|
-
return i._modeOptions || (i._modeOptions = new
|
|
1553
|
+
return i._modeOptions || (i._modeOptions = new a(
|
|
1540
1554
|
r.modeOptions.mode,
|
|
1541
1555
|
void 0,
|
|
1542
1556
|
r.modeOptions
|
|
@@ -1557,19 +1571,19 @@ const wt = {
|
|
|
1557
1571
|
onCreate(s, t) {
|
|
1558
1572
|
s.modeOptions.setOption(t);
|
|
1559
1573
|
}
|
|
1560
|
-
},
|
|
1574
|
+
}, Ft = {
|
|
1561
1575
|
onUse(s, t, e) {
|
|
1562
|
-
|
|
1576
|
+
p(s, {
|
|
1563
1577
|
/**
|
|
1564
1578
|
* 全局级别的默认选项
|
|
1565
1579
|
*/
|
|
1566
|
-
defaultOptions: new
|
|
1567
|
-
}),
|
|
1580
|
+
defaultOptions: new u(t, e)
|
|
1581
|
+
}), p(s.prototype, {
|
|
1568
1582
|
/**
|
|
1569
1583
|
* 实例级的默认选项
|
|
1570
1584
|
*/
|
|
1571
1585
|
get defaultOptions() {
|
|
1572
|
-
return this._defaultOptions || (this._defaultOptions = new
|
|
1586
|
+
return this._defaultOptions || (this._defaultOptions = new u(void 0, s.defaultOptions));
|
|
1573
1587
|
}
|
|
1574
1588
|
});
|
|
1575
1589
|
},
|
|
@@ -1577,19 +1591,19 @@ const wt = {
|
|
|
1577
1591
|
s.defaultOptions.option = t;
|
|
1578
1592
|
}
|
|
1579
1593
|
};
|
|
1580
|
-
function
|
|
1581
|
-
const e =
|
|
1594
|
+
function Ct(s, t) {
|
|
1595
|
+
const e = c(s, {
|
|
1582
1596
|
/**
|
|
1583
1597
|
* 全局级别的默认选项
|
|
1584
1598
|
*/
|
|
1585
|
-
defaultOptions: new
|
|
1599
|
+
defaultOptions: new u(t)
|
|
1586
1600
|
});
|
|
1587
|
-
return
|
|
1601
|
+
return c(e.prototype, {
|
|
1588
1602
|
/**
|
|
1589
1603
|
* 实例级的默认选项
|
|
1590
1604
|
*/
|
|
1591
1605
|
get defaultOptions() {
|
|
1592
|
-
return this._defaultOptions || (this._defaultOptions = new
|
|
1606
|
+
return this._defaultOptions || (this._defaultOptions = new u(void 0, this.constructor.defaultOptions));
|
|
1593
1607
|
}
|
|
1594
1608
|
}), s;
|
|
1595
1609
|
}
|
|
@@ -1598,33 +1612,33 @@ function _(s, t) {
|
|
|
1598
1612
|
let n;
|
|
1599
1613
|
for (; n = e.shift(); ) {
|
|
1600
1614
|
const { target: i, props: r } = n;
|
|
1601
|
-
for (const [o,
|
|
1602
|
-
if (
|
|
1603
|
-
e.push({ target: i[o], props:
|
|
1615
|
+
for (const [o, l] of Object.entries(r)) {
|
|
1616
|
+
if (l != null && typeof l == "object" && (!l.constructor || l.constructor === Object)) {
|
|
1617
|
+
e.push({ target: i[o], props: l });
|
|
1604
1618
|
continue;
|
|
1605
1619
|
}
|
|
1606
|
-
i[o] =
|
|
1620
|
+
i[o] = l;
|
|
1607
1621
|
}
|
|
1608
1622
|
}
|
|
1609
1623
|
return s;
|
|
1610
1624
|
}
|
|
1611
|
-
function
|
|
1625
|
+
function z(s, t) {
|
|
1612
1626
|
const e = {}, n = [{ target: s, props: t, targetProps: e }];
|
|
1613
1627
|
let i;
|
|
1614
1628
|
for (; i = n.shift(); ) {
|
|
1615
|
-
const { target: r, props: o, targetProps:
|
|
1629
|
+
const { target: r, props: o, targetProps: l } = i;
|
|
1616
1630
|
for (const [m, f] of Object.entries(o)) {
|
|
1617
1631
|
if (f != null && typeof f == "object" && (!f.constructor || f.constructor === Object)) {
|
|
1618
|
-
n.push({ target: r[m], props: f, targetProps:
|
|
1632
|
+
n.push({ target: r[m], props: f, targetProps: l[m] = {} });
|
|
1619
1633
|
continue;
|
|
1620
1634
|
}
|
|
1621
|
-
|
|
1635
|
+
l[m] = r[m];
|
|
1622
1636
|
}
|
|
1623
1637
|
}
|
|
1624
1638
|
return e;
|
|
1625
1639
|
}
|
|
1626
|
-
function
|
|
1627
|
-
const e =
|
|
1640
|
+
function Nt(s, t) {
|
|
1641
|
+
const e = z(s, t);
|
|
1628
1642
|
function n() {
|
|
1629
1643
|
_(s, t);
|
|
1630
1644
|
}
|
|
@@ -1634,58 +1648,61 @@ function Ut(s, t) {
|
|
|
1634
1648
|
return { set: n, unset: i };
|
|
1635
1649
|
}
|
|
1636
1650
|
export {
|
|
1637
|
-
|
|
1638
|
-
|
|
1651
|
+
ut as ExtendManager,
|
|
1652
|
+
B as ModeOptions,
|
|
1639
1653
|
d as PluginExtendManager,
|
|
1640
|
-
|
|
1654
|
+
D as PluginHost,
|
|
1641
1655
|
F as PluginHostEventEmitter,
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1656
|
+
C as PluginHostEventTarget,
|
|
1657
|
+
ot as PluginManager,
|
|
1658
|
+
a as TierModeOptions,
|
|
1659
|
+
wt as TierModeOptionsPluginHost,
|
|
1660
|
+
bt as TierModeOptionsPluginHostEventEmitter,
|
|
1661
|
+
Tt as TierModeOptionsPluginHostEventTarget,
|
|
1662
|
+
u as TierOptions,
|
|
1663
|
+
Mt as TierOptionsPluginHost,
|
|
1664
|
+
yt as TierOptionsPluginHostEventEmitter,
|
|
1665
|
+
Pt as TierOptionsPluginHostEventTarget,
|
|
1666
|
+
at as addDefaultOptions,
|
|
1667
|
+
lt as addInstOptions,
|
|
1668
|
+
$ as becomePluginHost,
|
|
1669
|
+
mt as becomePluginHost_Extends,
|
|
1670
|
+
ft as becomePluginHost_Proxy,
|
|
1671
|
+
vt as becomeTierModeOptionsHost,
|
|
1672
|
+
Ct as becomeTierOptionsHost,
|
|
1673
|
+
h as commonModeName,
|
|
1674
|
+
tt as createDefineExtend,
|
|
1675
|
+
L as createDefineMixin,
|
|
1676
|
+
it as createExtendTarget,
|
|
1677
|
+
Y as createMixinTarget,
|
|
1678
|
+
N as createPluginHost,
|
|
1679
|
+
Nt as createPropertySetter,
|
|
1680
|
+
nt as createTargetExtend,
|
|
1681
|
+
X as createTargetMixin,
|
|
1682
|
+
Ut as createTierModeOptionsPluginHost,
|
|
1683
|
+
_t as createTierOptionsPluginHost,
|
|
1684
|
+
Z as defineExtend,
|
|
1685
|
+
J as defineMixin,
|
|
1672
1686
|
O as extendMark,
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1687
|
+
st as extendTarget,
|
|
1688
|
+
x as getPropertyValue,
|
|
1689
|
+
pt as getPropertyValueByPath,
|
|
1690
|
+
z as getTargetProperties,
|
|
1691
|
+
A as isPlugin,
|
|
1678
1692
|
_ as mergeProperties,
|
|
1679
|
-
|
|
1680
|
-
|
|
1693
|
+
p as mixin,
|
|
1694
|
+
W as mixinByOmit,
|
|
1695
|
+
G as mixinByPick,
|
|
1696
|
+
T as mixinIExtend,
|
|
1697
|
+
c as mixinTarget,
|
|
1681
1698
|
E as parsePropertyPath,
|
|
1682
|
-
|
|
1699
|
+
rt as pickHostExtendMembers,
|
|
1683
1700
|
U as setPropertyValue,
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1701
|
+
dt as setPropertyValueByPath,
|
|
1702
|
+
et as targetExtend,
|
|
1703
|
+
Q as targetMixin,
|
|
1704
|
+
ct as tierModeOptionsDecorator,
|
|
1705
|
+
Dt as tierModeOptionsPlugin,
|
|
1706
|
+
gt as tierOptionsDecorator,
|
|
1707
|
+
Ft as tierOptionsPlugin
|
|
1691
1708
|
};
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(r,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("@gby/destroyable"),require("com-tools"),require("deepmerge-ts")):typeof define=="function"&&define.amd?define(["exports","@gby/destroyable","com-tools","deepmerge-ts"],c):(r=typeof globalThis<"u"?globalThis:r||self,c(r.PluginTls={},r.destroyable,r.comTools,r.deepmergeTs))})(this,(function(r,c,O,m){"use strict";function a(i,...t){for(const e of t){const n=Object.getOwnPropertyDescriptors(e);Object.defineProperties(i,n)}return i}function I(i,t){return t}function S(){return function(t){return t}}function j(i,t){return a(i,t),t}function q(i){return function(e){return a(i,e),e}}function h(i,t){return a(i,t),i}function A(i){return function(e){return a(i,e),i}}function B(i,t){return t}function $(){return function(t){return t}}function z(i,t){return a(i.prototype,t),t}function K(i){return function(e){return a(i.prototype,e),e}}function R(i,t){return a(i.prototype,t),i}function W(i){return function(e){return a(i.prototype,e),i}}const G=["onCreate","onInit","onDestroy"];function E(i){const t={...i};for(const e of G)typeof t[e]=="function"&&delete t[e];return t}function H(i){return i&&typeof i.onUse=="function"}class J extends c.Destroyable{host;plugins=new Map;constructor(t){super(),t&&(this.host=t)}destroyThis(){return this.plugins.clear(),this.host=null,super.destroyThis()}hasUsed(t){return this.plugins.has(t)}use(t,...e){const{plugins:n}=this;if(n.has(t))return n.get(t);const s=t.onUse(this.host,...e);return n.set(t,s),s}instUse(t,e,...n){const{plugins:s}=this;if(s.has(e))return s.get(e);const o=this.use(e,...n);return e.onCreate?.(t),o}onCreate(t,...e){const n=[];for(const[s]of this.plugins)s.onCreate&&n.push(s.onCreate.bind(s));return O.serialCallFuns(n,void 0,[t,...e])}onInit(t,...e){const n=[];for(const[s]of this.plugins)s.onInit&&n.push(s.onInit.bind(s));return O.serialCallFuns(n,void 0,[t,...e])}onDestroy(t){const e=[];for(const[n]of this.plugins)n.onDestroy&&e.push(n.onDestroy.bind(n));return e.reverse(),O.serialCallFuns(e,void 0,[t])}}class L extends c.Destroyable{host;plugins=new Set;constructor(t){super(),t&&(this.host=t)}destroyThis(){return this.plugins.clear(),this.host=null,super.destroyThis()}hasUsed(t){return this.plugins.has(t)}use(t){const{plugins:e}=this;return e.has(t)||(a(this.host.prototype,E(t)),e.add(t)),t}instUse(t,e,...n){const{plugins:s}=this;return s.has(e)||(this.use(e),e.onCreate?.call(t,t,...n)),e}onCreate(t,...e){const n=[];for(const s of this.plugins)s.onCreate&&n.push(s.onCreate);return O.serialCallFuns(n,t,[t,...e])}onInit(t,...e){const n=[];for(const s of this.plugins)s.onInit&&n.push(s.onInit);return O.serialCallFuns(n,t,[t,...e])}onDestroy(t){const e=[];for(const n of this.plugins)n.onDestroy&&e.push(n.onDestroy);return e.reverse(),O.serialCallFuns(e,t,[t])}}const M=Symbol("extend");class p extends c.Destroyable{host;plugins=new Map;constructor(t){super(),t&&(this.host=t)}destroyThis(){return this.plugins.clear(),this.host=null,super.destroyThis()}hasUsed(t){return this.plugins.has(t)}isPlugin(t){const{plugins:e}=this;return e.has(t)?e.get(t)!==M:H(t)}useExtend(t){const{plugins:e}=this;return e.has(t)?e.get(t):(a(this.host.prototype,E(t)),e.set(t,M),t)}instUseExtend(t,e,...n){const{plugins:s}=this;return s.has(e)?s.get(e):(this.useExtend(e),e.onCreate?.call(t,t,...n),e)}usePlugin(t,...e){const{plugins:n}=this;if(n.has(t))return n.get(t);const s=t.onUse(this.host,...e);return n.set(t,s),s}instUsePlugin(t,e,...n){const{plugins:s}=this;if(s.has(e))return s.get(e);const o=this.usePlugin(e,...n);return e.onCreate?.(t),o}onCreate(t,...e){const n=[];for(const[s,o]of this.plugins)if(s.onCreate){const u=o===M?s.onCreate:s.onCreate.bind(s);n.push(u)}return O.serialCallFuns(n,t,[t,...e])}onInit(t,...e){const n=[];for(const[s,o]of this.plugins)if(s.onInit){const u=o===M?s.onInit:s.onInit.bind(s);n.push(u)}return O.serialCallFuns(n,t,[t,...e])}onDestroy(t){const e=[];for(const[n,s]of this.plugins)if(n.onDestroy){const o=s===M?n.onDestroy:n.onDestroy.bind(n);e.push(o)}return e.reverse(),O.serialCallFuns(e,t,[t])}}function Q(i,t){const e=t??"defaultOptions",n=`_${e}`;return function(o){const u=h(o,{get[e](){return i}});h(u.prototype,{get[e](){return this[n]||(this[n]=structuredClone(u.defaultOptions))}})}}function X(i,t,e){const n=`_${t}`;return h(i.prototype,{get[t](){return this[n]||(this[n]=structuredClone(i[t]))}}),e}function T(i){const t=i.split(".");return t[0]===""&&t.shift(),t}function y(i,t){for(const e of t)if(i=i[e],i==null)return;return i}function Y(i,t){return y(i,T(t))}function x(i,t,e){const n=t.pop(),s=t.length;let o=0;for(;o<s;){const u=i[t[o]];if(u==null)break;i=u,o++}t=t.slice(o);for(const u of t)i=i[u]={};return i[n]=e,i}function Z(i,t,e){return x(i,T(t),e)}const w={UndefinedAndNull:function(t){return t==null},Undefined:function(t){return t===void 0},Null:function(t){return t===null}};class C{freezeMember=!0;fullOption=new Proxy(this,{get:function(t,e,n){const s=t.plainFullOption[e];return t.freezeMember?Object.freeze(s):s},set:function(t,e,n,s){return t.setMember(e,n,!1),!0},has:function(t,e){return e in t.plainFullOption},getOwnPropertyDescriptor:function(t,e){return Object.getOwnPropertyDescriptor(t.plainFullOption,e)},ownKeys:function(t){return Reflect.ownKeys(t.plainFullOption)},deleteProperty:function(t,e){return t.setMember(e,void 0),!0},defineProperty:function(t,e,n){return Object.defineProperty(t.option,e,n),!0}});setOption(t,e){const n=e?m.deepmergeInto(this.option,t):Object.assign(this.option,t);return this.updateFullOption(),n}get undefinedValue(){return this._undefinedValue}set undefinedValue(t){this._undefinedValue=t,this.isUndefined=w[t]||w.UndefinedAndNull}_undefinedValue="UndefinedAndNull";isUndefined=w.UndefinedAndNull;getMember(t){return this.option[t]}setMember(t,e,n){const s=this.option;if(e===void 0)delete s[t];else{const o=s[t];n&&o&&typeof o=="object"?m.deepmergeInto(o,e):s[t]=e}this.updateFullOption()}getValue(t){return y(this.option,t)}setValue(t,e,n){const s=this.option;let o;n&&(o=y(s,t))&&typeof o=="object"?m.deepmergeInto(o,e):x(this.option,t,e),this.updateFullOption()}}class l extends C{constructor(t,e){super(),t&&(this.option=t),e&&(this.extends=e)}get extends(){return this._extends}set extends(t){this._extends=t,this.updateFullOption()}_extends=null;option={};get plainFullOption(){let t=this._plainFullOption;if(t)return t;const{extends:e,option:n}=this;if(t=n,e){const s=e.plainFullOption;t=m.deepmerge(s,n)}return this._plainFullOption=t}_plainFullOption=null;updateFullOption(){this._plainFullOption=null}getMember(t){const e=this.option[t];if(!this.isUndefined(e))return e;const n=this.extends;if(n)return n.getMember(t)}getValue(t){const e=super.getValue(t);if(!this.isUndefined(e))return e;const n=this.extends;if(n)return n.getValue(t)}}function tt(i,t){const{name:e}=t,n=`_${e}`;return{get:function(){return this[n]||(this[n]=new l(void 0,this.constructor[e]))}}}class N extends C{constructor(t,e){super(),e&&this.setModeOption(t,e),this.mode=t}modes={};get mode(){return this._mode||(this.mode=this.modeNames[0])}set mode(t){this._mode=t,this.hasMode(t)||this.setModeOption(t,{}),this.updateFullOption()}_mode;get modeNames(){return this._modeNames||(this._modeNames=this.getModeNames())}_modeNames=null;getModeNames(){return Object.keys(this.modes)}hasMode(t){return!!this.modes[t]}get optionManager(){return this.modes[this.mode]}get option(){return this.optionManager.option}get plainFullOption(){return this._plainFullOption??(this._plainFullOption=this.getFullModeOption(this.mode))}_plainFullOption=null;updateFullOption(){this._plainFullOption=null,this._modeNames=null}getModeOption(t){return this.modes[t].option}getFullModeOption(t){return this.modes[t]?.plainFullOption}setModeOption(t,e,n,s){const{modes:o}=this,u=o[t]||(o[t]=new l);if(u.setOption(e,n),s){const g=o[s];g&&(u.extends=g)}return this.updateFullOption(),u}}class d extends N{constructor(t,e,n){super(t,e),n&&(this.extends=n)}get extends(){return this._extends}set extends(t){this._extends=t,this.updateFullOption()}_extends=null;getFullModeOption(t){const{modes:e,extends:n}=this,s=e[t]?.plainFullOption;if(n){const o=n.getFullModeOption(t);return s?m.deepmerge(o,s):o}return s}getModeNames(){const{modes:t,extends:e}=this,n=Object.keys(t);if(!e)return n;const s=e.getModeNames();return[...new Set([...n,...s])]}hasModeOnTier(t){if(this.hasMode(t))return!0;const e=this.extends;return e?e.hasModeOnTier(t):!1}get optionManager(){return this.getModeOptionManager(this.mode)}getModeOptionManager(t){const e=this.modes[t];return e||(this.extends?.getModeOptionManager(t)?this.setModeOption(t,{}):null)}getMember(t){const e=this.optionManager.getMember(t);if(!this.isUndefined(e))return e;const n=this.extends;if(n)return n.getMember(t)}getValue(t){const e=this.optionManager.getValue(t);if(!this.isUndefined(e))return e;const n=this.extends;if(n)return n.getValue(t)}}function et(i,t){const{name:e}=t,n=`_${e}`;return{get:function(){return this[n]||(this[n]=new d(this.constructor[e].mode,void 0,this.constructor[e]))}}}class b extends c.Destroyable{static isolatedPluginManager=!1;static get pluginManager(){return this.isolatedPluginManager&&!this.hasOwnProperty("_pluginManager")&&(this._pluginManager=new p(this)),this._pluginManager}static _pluginManager=new p(this);get pluginManager(){return this.constructor.pluginManager}static usePlugin(t,...e){return this.pluginManager.usePlugin(t,...e)}static useExtend(t){return this.pluginManager.useExtend(t)}static hasUsed(t){return this.pluginManager.hasUsed(t)}usePlugin(t,...e){return this.pluginManager.instUsePlugin(this,t,...e)}useExtend(t,...e){return this.pluginManager.instUseExtend(this,t,...e)}init(...t){return this.pluginManager.onInit(this,...t)}destroyThis(){const t=this.pluginManager.onDestroy(this);return t instanceof Promise?t.finally(()=>super.destroyThis()):super.destroyThis()}}class U extends c.DestroyableEventEmitter{static isolatedPluginManager=!1;static get pluginManager(){return this.isolatedPluginManager&&!this.hasOwnProperty("_pluginManager")&&(this._pluginManager=new p(this)),this._pluginManager}static _pluginManager=new p(this);get pluginManager(){return this.constructor.pluginManager}static usePlugin(t,...e){return this.pluginManager.usePlugin(t,...e)}static useExtend(t){return this.pluginManager.useExtend(t)}static hasUsed(t){return this.pluginManager.hasUsed(t)}usePlugin(t,...e){return this.pluginManager.instUsePlugin(this,t,...e)}useExtend(t,...e){return this.pluginManager.instUseExtend(this,t,...e)}init(...t){return this.pluginManager.onInit(this,...t)}destroyThis(){const t=this.pluginManager.onDestroy(this);return t instanceof Promise?t.finally(()=>super.destroyThis()):super.destroyThis()}}class v extends c.DestroyableEventTarget{static isolatedPluginManager=!1;static get pluginManager(){return this.isolatedPluginManager&&!this.hasOwnProperty("_pluginManager")&&(this._pluginManager=new p(this)),this._pluginManager}static _pluginManager=new p(this);get pluginManager(){return this.constructor.pluginManager}static usePlugin(t,...e){return this.pluginManager.usePlugin(t,...e)}static useExtend(t){return this.pluginManager.useExtend(t)}static hasUsed(t){return this.pluginManager.hasUsed(t)}usePlugin(t,...e){return this.pluginManager.instUsePlugin(this,t,...e)}useExtend(t,...e){return this.pluginManager.instUseExtend(this,t,...e)}init(...t){return this.pluginManager.onInit(this,...t)}destroyThis(){const t=this.pluginManager.onDestroy(this);return t instanceof Promise?t.finally(()=>super.destroyThis()):super.destroyThis()}}function F(i){const t=c.createDestroyableSubClass(i);return class extends t{static isolatedPluginManager=!1;static get pluginManager(){return this.isolatedPluginManager&&!this.hasOwnProperty("_pluginManager")&&(this._pluginManager=new p(this)),this._pluginManager}static _pluginManager=new p(this);get pluginManager(){return this.constructor.pluginManager}static usePlugin(n,...s){return this.pluginManager.usePlugin(n,...s)}static useExtend(n){return this.pluginManager.useExtend(n)}static hasUsed(n){return this.pluginManager.hasUsed(n)}usePlugin(n,...s){return this.pluginManager.instUsePlugin(this,n,...s)}useExtend(n,...s){return this.pluginManager.instUseExtend(this,n,...s)}init(...n){return this.pluginManager.onInit(this,...n)}destroyThis(){const n=this.pluginManager.onDestroy(this);return n instanceof Promise?n.finally(()=>super.destroyThis()):super.destroyThis()}}}function V(i){const t=h(i,{isolatedPluginManager:!1,get pluginManager(){return(!this._pluginManager||this.isolatedPluginManager&&!this.hasOwnProperty("_pluginManager"))&&(this._pluginManager=new p(this)),this._pluginManager},usePlugin(e,...n){return this.pluginManager.usePlugin(e,...n)},useExtend(e){return this.pluginManager.useExtend(e)},hasUsed(e){return this.pluginManager.hasUsed(e)}});return h(t.prototype,{get pluginManager(){return this.constructor.pluginManager},usePlugin(e,...n){return this.pluginManager.instUsePlugin(this,e,...n)},useExtend(e,...n){return this.pluginManager.instUseExtend(this,e,...n)},async init(...e){return super.init&&await super.init(...e),this.pluginManager.onInit(this,...e)},async destroy(){if(await this.pluginManager.onDestroy(this),super.destroy)return super.destroy()}}),i}function nt(i){const t=V(i);return new Proxy(t,{construct:function(e,n,s){const o=new e(...n);return t.pluginManager.onCreate(this,...n),o}})}function it(i){return class extends i{static isolatedPluginManager=!1;static get pluginManager(){return this.isolatedPluginManager&&!this.hasOwnProperty("_pluginManager")&&(this._pluginManager=new p(this)),this._pluginManager}static _pluginManager=new p(this);get pluginManager(){return this.constructor.pluginManager}static usePlugin(e,...n){return this.pluginManager.usePlugin(e,...n)}static useExtend(e){return this.pluginManager.useExtend(e)}static hasUsed(e){return this.pluginManager.hasUsed(e)}constructor(...e){super(...e),this.pluginManager.onCreate(this,...e)}usePlugin(e,...n){return this.pluginManager.instUsePlugin(this,e,...n)}useExtend(e,...n){return this.pluginManager.instUseExtend(this,e,...n)}init(...e){if(super.init){const n=super.init(...e);if(n instanceof Promise)return n.then(()=>this.pluginManager.onInit(this,...e))}return this.pluginManager.onInit(this,...e)}destroy(){const e=this.pluginManager.onDestroy(this);return super.destroy?e instanceof Promise?e.finally(()=>super.destroy()):super.destroy():e}}}class st extends b{static defaultOptions=new l;get defaultOptions(){return this._defaultOptions||(this._defaultOptions=new l(void 0,this.constructor.defaultOptions))}_defaultOptions;constructor(t){super(),this.defaultOptions.option=t}}class rt extends U{static defaultOptions=new l;get defaultOptions(){return this._defaultOptions||(this._defaultOptions=new l(void 0,this.constructor.defaultOptions))}_defaultOptions;constructor(t){super(),this.defaultOptions.option=t}}class ot extends v{static defaultOptions=new l;get defaultOptions(){return this._defaultOptions||(this._defaultOptions=new l(void 0,this.constructor.defaultOptions))}_defaultOptions;constructor(t){super(),this.defaultOptions.option=t}}function ut(i){const t=F(i);return class extends t{static defaultOptions=new l;get defaultOptions(){return this._defaultOptions||(this._defaultOptions=new l(void 0,this.constructor.defaultOptions))}_defaultOptions;constructor(n){super(),this.defaultOptions.option=n}}}const f="common";class at extends b{static modeOptions=new d(f);get modeOptions(){return this._modeOptions||(this._modeOptions=new d(f,void 0,this.constructor.modeOptions))}_modeOptions;get mode(){return this.modeOptions.mode}set mode(t){this.modeOptions.mode=t}get options(){return this.modeOptions.plainFullOption}constructor(t){super(),this.modeOptions.setOption(t)}}class lt extends U{static modeOptions=new d(f);get modeOptions(){return this._modeOptions||(this._modeOptions=new d(f,void 0,this.constructor.modeOptions))}_modeOptions;get mode(){return this.modeOptions.mode}set mode(t){this.modeOptions.mode=t}get options(){return this.modeOptions.plainFullOption}constructor(t){super(),this.modeOptions.setOption(t)}}class dt extends v{static modeOptions=new d(f);get modeOptions(){return this._modeOptions||(this._modeOptions=new d(f,void 0,this.constructor.modeOptions))}_modeOptions;get mode(){return this.modeOptions.mode}set mode(t){this.modeOptions.mode=t}get options(){return this.modeOptions.plainFullOption}constructor(t){super(),this.modeOptions.setOption(t)}}function pt(i){const t=F(i);return class extends t{static modeOptions=new d(f);get modeOptions(){return this._modeOptions||(this._modeOptions=new d(f,void 0,this.constructor.modeOptions))}_modeOptions;get mode(){return this.modeOptions.mode}set mode(n){this.modeOptions.mode=n}get options(){return this.modeOptions.plainFullOption}constructor(n){super(),this.modeOptions.setOption(n)}}}function gt(i,t,e){const n=h(i,{modeOptions:new d(t,e)});return h(n.prototype,{get modeOptions(){return this._modeOptions||(this._modeOptions=new d(t,void 0,this.constructor.modeOptions))},get mode(){return this.modeOptions.mode},set mode(s){this.modeOptions.mode=s},get options(){return this.modeOptions.fullOption}}),i}const ct={onUse(i,t,e){const n=t??f;a(i,{modeOptions:new d(n,void 0,e)}),a(i.prototype,{get modeOptions(){const s=this,o=i;return s._modeOptions||(s._modeOptions=new d(o.modeOptions.mode,void 0,o.modeOptions))},get mode(){return this.modeOptions.mode},set mode(s){const o=this;o.modeOptions.mode=s},get options(){return this.modeOptions.plainFullOption}})},onCreate(i,t){i.modeOptions.setOption(t)}},ht={onUse(i,t,e){a(i,{defaultOptions:new l(t,e)}),a(i.prototype,{get defaultOptions(){return this._defaultOptions||(this._defaultOptions=new l(void 0,i.defaultOptions))}})},onCreate(i,t){i.defaultOptions.option=t}};function ft(i,t){const e=h(i,{defaultOptions:new l(t)});return h(e.prototype,{get defaultOptions(){return this._defaultOptions||(this._defaultOptions=new l(void 0,this.constructor.defaultOptions))}}),i}function D(i,t){const e=[{target:i,props:t}];let n;for(;n=e.shift();){const{target:s,props:o}=n;for(const[u,g]of Object.entries(o)){if(g!=null&&typeof g=="object"&&(!g.constructor||g.constructor===Object)){e.push({target:s[u],props:g});continue}s[u]=g}}return i}function k(i,t){const e={},n=[{target:i,props:t,targetProps:e}];let s;for(;s=n.shift();){const{target:o,props:u,targetProps:g}=s;for(const[_,P]of Object.entries(u)){if(P!=null&&typeof P=="object"&&(!P.constructor||P.constructor===Object)){n.push({target:o[_],props:P,targetProps:g[_]={}});continue}g[_]=o[_]}}return e}function Ot(i,t){const e=k(i,t);function n(){D(i,t)}function s(){D(i,e)}return{set:n,unset:s}}r.ExtendManager=L,r.ModeOptions=N,r.PluginExtendManager=p,r.PluginHost=b,r.PluginHostEventEmitter=U,r.PluginHostEventTarget=v,r.PluginManager=J,r.TierModeOptions=d,r.TierModeOptionsPluginHost=at,r.TierModeOptionsPluginHostEventEmitter=lt,r.TierModeOptionsPluginHostEventTarget=dt,r.TierOptions=l,r.TierOptionsPluginHost=st,r.TierOptionsPluginHostEventEmitter=rt,r.TierOptionsPluginHostEventTarget=ot,r.addDefaultOptions=Q,r.addInstOptions=X,r.becomePluginHost=V,r.becomePluginHost_Extends=it,r.becomePluginHost_Proxy=nt,r.becomeTierModeOptionsHost=gt,r.becomeTierOptionsHost=ft,r.commonModeName=f,r.createDefineExtend=$,r.createDefineMixin=S,r.createExtendTarget=W,r.createMixinTarget=A,r.createPluginHost=F,r.createPropertySetter=Ot,r.createTargetExtend=K,r.createTargetMixin=q,r.createTierModeOptionsPluginHost=pt,r.createTierOptionsPluginHost=ut,r.defineExtend=B,r.defineMixin=I,r.extendMark=M,r.extendTarget=R,r.getPropertyValue=y,r.getPropertyValueByPath=Y,r.getTargetProperties=k,r.isPlugin=H,r.mergeProperties=D,r.mixin=a,r.mixinTarget=h,r.parsePropertyPath=T,r.pickHostExtendMembers=E,r.setPropertyValue=x,r.setPropertyValueByPath=Z,r.targetExtend=z,r.targetMixin=j,r.tierModeOptionsDecorator=et,r.tierModeOptionsPlugin=ct,r.tierOptionsDecorator=tt,r.tierOptionsPlugin=ht,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function(r,h){typeof exports=="object"&&typeof module<"u"?h(exports,require("@gby/destroyable"),require("com-tools"),require("deepmerge-ts")):typeof define=="function"&&define.amd?define(["exports","@gby/destroyable","com-tools","deepmerge-ts"],h):(r=typeof globalThis<"u"?globalThis:r||self,h(r.PluginTls={},r.destroyable,r.comTools,r.deepmergeTs))})(this,(function(r,h,p,m){"use strict";function d(i,...t){for(const e of t){const n=Object.getOwnPropertyDescriptors(e);Object.defineProperties(i,n)}return i}function I(i,t,e){let n=Object.getOwnPropertyDescriptors(t);return e&&p.omitMembers(n,e),Object.defineProperties(i,n),i}function S(i,t,e){let n=Object.getOwnPropertyDescriptors(t);return e?Object.defineProperties(i,p.removeUndefined(p.pickMembers(n,e))):Object.defineProperties(i,n),i}function B(i,t){return t}function q(){return function(t){return t}}function A(i,t){return d(i,t),t}function $(i){return function(e){return d(i,e),e}}function f(i,t){return d(i,t),i}function z(i){return function(e){return d(i,e),i}}function K(i,t){return t}function R(){return function(t){return t}}function W(i,t){return d(i.prototype,t),t}function G(i){return function(e){return d(i.prototype,e),e}}function J(i,t){return d(i.prototype,t),i}function L(i){return function(e){return d(i.prototype,e),i}}const H=["onCreate","onInit","onDestroy"];function Q(i){const t={...i};for(const e of H)typeof t[e]=="function"&&delete t[e];return t}function x(i,t){let e=Object.getOwnPropertyDescriptors(t);for(const n of H)typeof t[n]=="function"&&delete e[n];return Object.defineProperties(i,e),i}function C(i){return i&&typeof i.onUse=="function"}class X extends h.Destroyable{host;plugins=new Map;constructor(t){super(),t&&(this.host=t)}destroyThis(){return this.plugins.clear(),this.host=null,super.destroyThis()}hasUsed(t){return this.plugins.has(t)}use(t,...e){const{plugins:n}=this;if(n.has(t))return n.get(t);const s=t.onUse(this.host,...e);return n.set(t,s),s}instUse(t,e,...n){const{plugins:s}=this;if(s.has(e))return s.get(e);const o=this.use(e,...n);return e.onCreate?.(t),o}onCreate(t,...e){const n=[];for(const[s]of this.plugins)s.onCreate&&n.push(s.onCreate.bind(s));return p.serialCallFuns(n,void 0,[t,...e])}onInit(t,...e){const n=[];for(const[s]of this.plugins)s.onInit&&n.push(s.onInit.bind(s));return p.serialCallFuns(n,void 0,[t,...e])}onDestroy(t){const e=[];for(const[n]of this.plugins)n.onDestroy&&e.push(n.onDestroy.bind(n));return e.reverse(),p.serialCallFuns(e,void 0,[t])}}class Y extends h.Destroyable{host;plugins=new Set;constructor(t){super(),t&&(this.host=t)}destroyThis(){return this.plugins.clear(),this.host=null,super.destroyThis()}hasUsed(t){return this.plugins.has(t)}use(t){const{plugins:e}=this;return e.has(t)||(x(this.host.prototype,t),e.add(t)),t}instUse(t,e,...n){const{plugins:s}=this;return s.has(e)||(this.use(e),e.onCreate?.call(t,t,...n)),e}onCreate(t,...e){const n=[];for(const s of this.plugins)s.onCreate&&n.push(s.onCreate);return p.serialCallFuns(n,t,[t,...e])}onInit(t,...e){const n=[];for(const s of this.plugins)s.onInit&&n.push(s.onInit);return p.serialCallFuns(n,t,[t,...e])}onDestroy(t){const e=[];for(const n of this.plugins)n.onDestroy&&e.push(n.onDestroy);return e.reverse(),p.serialCallFuns(e,t,[t])}}const M=Symbol("extend");class g extends h.Destroyable{host;plugins=new Map;constructor(t){super(),t&&(this.host=t)}destroyThis(){return this.plugins.clear(),this.host=null,super.destroyThis()}hasUsed(t){return this.plugins.has(t)}isPlugin(t){const{plugins:e}=this;return e.has(t)?e.get(t)!==M:C(t)}useExtend(t){const{plugins:e}=this;return e.has(t)?e.get(t):(x(this.host.prototype,t),e.set(t,M),t)}instUseExtend(t,e,...n){const{plugins:s}=this;return s.has(e)?s.get(e):(this.useExtend(e),e.onCreate?.call(t,t,...n),e)}usePlugin(t,...e){const{plugins:n}=this;if(n.has(t))return n.get(t);const s=t.onUse(this.host,...e);return n.set(t,s),s}instUsePlugin(t,e,...n){const{plugins:s}=this;if(s.has(e))return s.get(e);const o=this.usePlugin(e,...n);return e.onCreate?.(t),o}onCreate(t,...e){const n=[];for(const[s,o]of this.plugins)if(s.onCreate){const u=o===M?s.onCreate:s.onCreate.bind(s);n.push(u)}return p.serialCallFuns(n,t,[t,...e])}onInit(t,...e){const n=[];for(const[s,o]of this.plugins)if(s.onInit){const u=o===M?s.onInit:s.onInit.bind(s);n.push(u)}return p.serialCallFuns(n,t,[t,...e])}onDestroy(t){const e=[];for(const[n,s]of this.plugins)if(n.onDestroy){const o=s===M?n.onDestroy:n.onDestroy.bind(n);e.push(o)}return e.reverse(),p.serialCallFuns(e,t,[t])}}function Z(i,t){const e=t??"defaultOptions",n=`_${e}`;return function(o){const u=f(o,{get[e](){return i}});f(u.prototype,{get[e](){return this[n]||(this[n]=structuredClone(u.defaultOptions))}})}}function tt(i,t,e){const n=`_${t}`;return f(i.prototype,{get[t](){return this[n]||(this[n]=structuredClone(i[t]))}}),e}function E(i){const t=i.split(".");return t[0]===""&&t.shift(),t}function y(i,t){for(const e of t)if(i=i[e],i==null)return;return i}function et(i,t){return y(i,E(t))}function w(i,t,e){const n=t.pop(),s=t.length;let o=0;for(;o<s;){const u=i[t[o]];if(u==null)break;i=u,o++}t=t.slice(o);for(const u of t)i=i[u]={};return i[n]=e,i}function nt(i,t,e){return w(i,E(t),e)}const T={UndefinedAndNull:function(t){return t==null},Undefined:function(t){return t===void 0},Null:function(t){return t===null}};class N{freezeMember=!0;fullOption=new Proxy(this,{get:function(t,e,n){const s=t.plainFullOption[e];return t.freezeMember?Object.freeze(s):s},set:function(t,e,n,s){return t.setMember(e,n,!1),!0},has:function(t,e){return e in t.plainFullOption},getOwnPropertyDescriptor:function(t,e){return Object.getOwnPropertyDescriptor(t.plainFullOption,e)},ownKeys:function(t){return Reflect.ownKeys(t.plainFullOption)},deleteProperty:function(t,e){return t.setMember(e,void 0),!0},defineProperty:function(t,e,n){return Object.defineProperty(t.option,e,n),!0}});setOption(t,e){const n=e?m.deepmergeInto(this.option,t):Object.assign(this.option,t);return this.updateFullOption(),n}get undefinedValue(){return this._undefinedValue}set undefinedValue(t){this._undefinedValue=t,this.isUndefined=T[t]||T.UndefinedAndNull}_undefinedValue="UndefinedAndNull";isUndefined=T.UndefinedAndNull;getMember(t){return this.option[t]}setMember(t,e,n){const s=this.option;if(e===void 0)delete s[t];else{const o=s[t];n&&o&&typeof o=="object"?m.deepmergeInto(o,e):s[t]=e}this.updateFullOption()}getValue(t){return y(this.option,t)}setValue(t,e,n){const s=this.option;let o;n&&(o=y(s,t))&&typeof o=="object"?m.deepmergeInto(o,e):w(this.option,t,e),this.updateFullOption()}}class a extends N{constructor(t,e){super(),t&&(this.option=t),e&&(this.extends=e)}get extends(){return this._extends}set extends(t){this._extends=t,this.updateFullOption()}_extends=null;option={};get plainFullOption(){let t=this._plainFullOption;if(t)return t;const{extends:e,option:n}=this;if(t=n,e){const s=e.plainFullOption;t=m.deepmerge(s,n)}return this._plainFullOption=t}_plainFullOption=null;updateFullOption(){this._plainFullOption=null}getMember(t){const e=this.option[t];if(!this.isUndefined(e))return e;const n=this.extends;if(n)return n.getMember(t)}getValue(t){const e=super.getValue(t);if(!this.isUndefined(e))return e;const n=this.extends;if(n)return n.getValue(t)}}function it(i,t){const{name:e}=t,n=`_${e}`;return{get:function(){return this[n]||(this[n]=new a(void 0,this.constructor[e]))}}}class V extends N{constructor(t,e){super(),e&&this.setModeOption(t,e),this.mode=t}modes={};get mode(){return this._mode||(this.mode=this.modeNames[0])}set mode(t){this._mode=t,this.hasMode(t)||this.setModeOption(t,{}),this.updateFullOption()}_mode;get modeNames(){return this._modeNames||(this._modeNames=this.getModeNames())}_modeNames=null;getModeNames(){return Object.keys(this.modes)}hasMode(t){return!!this.modes[t]}get optionManager(){return this.modes[this.mode]}get option(){return this.optionManager.option}get plainFullOption(){return this._plainFullOption??(this._plainFullOption=this.getFullModeOption(this.mode))}_plainFullOption=null;updateFullOption(){this._plainFullOption=null,this._modeNames=null}getModeOption(t){return this.modes[t].option}getFullModeOption(t){return this.modes[t]?.plainFullOption}setModeOption(t,e,n,s){const{modes:o}=this,u=o[t]||(o[t]=new a);if(u.setOption(e,n),s){const c=o[s];c&&(u.extends=c)}return this.updateFullOption(),u}}class l extends V{constructor(t,e,n){super(t,e),n&&(this.extends=n)}get extends(){return this._extends}set extends(t){this._extends=t,this.updateFullOption()}_extends=null;getFullModeOption(t){const{modes:e,extends:n}=this,s=e[t]?.plainFullOption;if(n){const o=n.getFullModeOption(t);return s?m.deepmerge(o,s):o}return s}getModeNames(){const{modes:t,extends:e}=this,n=Object.keys(t);if(!e)return n;const s=e.getModeNames();return[...new Set([...n,...s])]}hasModeOnTier(t){if(this.hasMode(t))return!0;const e=this.extends;return e?e.hasModeOnTier(t):!1}get optionManager(){return this.getModeOptionManager(this.mode)}getModeOptionManager(t){const e=this.modes[t];return e||(this.extends?.getModeOptionManager(t)?this.setModeOption(t,{}):null)}getMember(t){const e=this.optionManager.getMember(t);if(!this.isUndefined(e))return e;const n=this.extends;if(n)return n.getMember(t)}getValue(t){const e=this.optionManager.getValue(t);if(!this.isUndefined(e))return e;const n=this.extends;if(n)return n.getValue(t)}}function st(i,t){const{name:e}=t,n=`_${e}`;return{get:function(){return this[n]||(this[n]=new l(this.constructor[e].mode,void 0,this.constructor[e]))}}}class b extends h.Destroyable{static isolatedPluginManager=!1;static get pluginManager(){return this.isolatedPluginManager&&!this.hasOwnProperty("_pluginManager")&&(this._pluginManager=new g(this)),this._pluginManager}static _pluginManager=new g(this);get pluginManager(){return this.constructor.pluginManager}static usePlugin(t,...e){return this.pluginManager.usePlugin(t,...e)}static useExtend(t){return this.pluginManager.useExtend(t)}static hasUsed(t){return this.pluginManager.hasUsed(t)}usePlugin(t,...e){return this.pluginManager.instUsePlugin(this,t,...e)}useExtend(t,...e){return this.pluginManager.instUseExtend(this,t,...e)}init(...t){return this.pluginManager.onInit(this,...t)}destroyThis(){const t=this.pluginManager.onDestroy(this);return t instanceof Promise?t.finally(()=>super.destroyThis()):super.destroyThis()}}class U extends h.DestroyableEventEmitter{static isolatedPluginManager=!1;static get pluginManager(){return this.isolatedPluginManager&&!this.hasOwnProperty("_pluginManager")&&(this._pluginManager=new g(this)),this._pluginManager}static _pluginManager=new g(this);get pluginManager(){return this.constructor.pluginManager}static usePlugin(t,...e){return this.pluginManager.usePlugin(t,...e)}static useExtend(t){return this.pluginManager.useExtend(t)}static hasUsed(t){return this.pluginManager.hasUsed(t)}usePlugin(t,...e){return this.pluginManager.instUsePlugin(this,t,...e)}useExtend(t,...e){return this.pluginManager.instUseExtend(this,t,...e)}init(...t){return this.pluginManager.onInit(this,...t)}destroyThis(){const t=this.pluginManager.onDestroy(this);return t instanceof Promise?t.finally(()=>super.destroyThis()):super.destroyThis()}}class v extends h.DestroyableEventTarget{static isolatedPluginManager=!1;static get pluginManager(){return this.isolatedPluginManager&&!this.hasOwnProperty("_pluginManager")&&(this._pluginManager=new g(this)),this._pluginManager}static _pluginManager=new g(this);get pluginManager(){return this.constructor.pluginManager}static usePlugin(t,...e){return this.pluginManager.usePlugin(t,...e)}static useExtend(t){return this.pluginManager.useExtend(t)}static hasUsed(t){return this.pluginManager.hasUsed(t)}usePlugin(t,...e){return this.pluginManager.instUsePlugin(this,t,...e)}useExtend(t,...e){return this.pluginManager.instUseExtend(this,t,...e)}init(...t){return this.pluginManager.onInit(this,...t)}destroyThis(){const t=this.pluginManager.onDestroy(this);return t instanceof Promise?t.finally(()=>super.destroyThis()):super.destroyThis()}}function D(i){const t=h.createDestroyableSubClass(i);return class extends t{static isolatedPluginManager=!1;static get pluginManager(){return this.isolatedPluginManager&&!this.hasOwnProperty("_pluginManager")&&(this._pluginManager=new g(this)),this._pluginManager}static _pluginManager=new g(this);get pluginManager(){return this.constructor.pluginManager}static usePlugin(n,...s){return this.pluginManager.usePlugin(n,...s)}static useExtend(n){return this.pluginManager.useExtend(n)}static hasUsed(n){return this.pluginManager.hasUsed(n)}usePlugin(n,...s){return this.pluginManager.instUsePlugin(this,n,...s)}useExtend(n,...s){return this.pluginManager.instUseExtend(this,n,...s)}init(...n){return this.pluginManager.onInit(this,...n)}destroyThis(){const n=this.pluginManager.onDestroy(this);return n instanceof Promise?n.finally(()=>super.destroyThis()):super.destroyThis()}}}function j(i){const t=f(i,{isolatedPluginManager:!1,get pluginManager(){return(!this._pluginManager||this.isolatedPluginManager&&!this.hasOwnProperty("_pluginManager"))&&(this._pluginManager=new g(this)),this._pluginManager},usePlugin(e,...n){return this.pluginManager.usePlugin(e,...n)},useExtend(e){return this.pluginManager.useExtend(e)},hasUsed(e){return this.pluginManager.hasUsed(e)}});return f(t.prototype,{get pluginManager(){return this.constructor.pluginManager},usePlugin(e,...n){return this.pluginManager.instUsePlugin(this,e,...n)},useExtend(e,...n){return this.pluginManager.instUseExtend(this,e,...n)},async init(...e){return super.init&&await super.init(...e),this.pluginManager.onInit(this,...e)},async destroy(){if(await this.pluginManager.onDestroy(this),super.destroy)return super.destroy()}}),i}function rt(i){const t=j(i);return new Proxy(t,{construct:function(e,n,s){const o=new e(...n);return t.pluginManager.onCreate(this,...n),o}})}function ot(i){return class extends i{static isolatedPluginManager=!1;static get pluginManager(){return this.isolatedPluginManager&&!this.hasOwnProperty("_pluginManager")&&(this._pluginManager=new g(this)),this._pluginManager}static _pluginManager=new g(this);get pluginManager(){return this.constructor.pluginManager}static usePlugin(e,...n){return this.pluginManager.usePlugin(e,...n)}static useExtend(e){return this.pluginManager.useExtend(e)}static hasUsed(e){return this.pluginManager.hasUsed(e)}constructor(...e){super(...e),this.pluginManager.onCreate(this,...e)}usePlugin(e,...n){return this.pluginManager.instUsePlugin(this,e,...n)}useExtend(e,...n){return this.pluginManager.instUseExtend(this,e,...n)}init(...e){if(super.init){const n=super.init(...e);if(n instanceof Promise)return n.then(()=>this.pluginManager.onInit(this,...e))}return this.pluginManager.onInit(this,...e)}destroy(){const e=this.pluginManager.onDestroy(this);return super.destroy?e instanceof Promise?e.finally(()=>super.destroy()):super.destroy():e}}}class ut extends b{static defaultOptions=new a;get defaultOptions(){return this._defaultOptions||(this._defaultOptions=new a(void 0,this.constructor.defaultOptions))}_defaultOptions;constructor(t){super(),this.defaultOptions.option=t}}class at extends U{static defaultOptions=new a;get defaultOptions(){return this._defaultOptions||(this._defaultOptions=new a(void 0,this.constructor.defaultOptions))}_defaultOptions;constructor(t){super(),this.defaultOptions.option=t}}class lt extends v{static defaultOptions=new a;get defaultOptions(){return this._defaultOptions||(this._defaultOptions=new a(void 0,this.constructor.defaultOptions))}_defaultOptions;constructor(t){super(),this.defaultOptions.option=t}}function dt(i){const t=D(i);return class extends t{static defaultOptions=new a;get defaultOptions(){return this._defaultOptions||(this._defaultOptions=new a(void 0,this.constructor.defaultOptions))}_defaultOptions;constructor(n){super(),this.defaultOptions.option=n}}}const O="common";class pt extends b{static modeOptions=new l(O);get modeOptions(){return this._modeOptions||(this._modeOptions=new l(O,void 0,this.constructor.modeOptions))}_modeOptions;get mode(){return this.modeOptions.mode}set mode(t){this.modeOptions.mode=t}get options(){return this.modeOptions.plainFullOption}constructor(t){super(),this.modeOptions.setOption(t)}}class gt extends U{static modeOptions=new l(O);get modeOptions(){return this._modeOptions||(this._modeOptions=new l(O,void 0,this.constructor.modeOptions))}_modeOptions;get mode(){return this.modeOptions.mode}set mode(t){this.modeOptions.mode=t}get options(){return this.modeOptions.plainFullOption}constructor(t){super(),this.modeOptions.setOption(t)}}class ct extends v{static modeOptions=new l(O);get modeOptions(){return this._modeOptions||(this._modeOptions=new l(O,void 0,this.constructor.modeOptions))}_modeOptions;get mode(){return this.modeOptions.mode}set mode(t){this.modeOptions.mode=t}get options(){return this.modeOptions.plainFullOption}constructor(t){super(),this.modeOptions.setOption(t)}}function ht(i){const t=D(i);return class extends t{static modeOptions=new l(O);get modeOptions(){return this._modeOptions||(this._modeOptions=new l(O,void 0,this.constructor.modeOptions))}_modeOptions;get mode(){return this.modeOptions.mode}set mode(n){this.modeOptions.mode=n}get options(){return this.modeOptions.plainFullOption}constructor(n){super(),this.modeOptions.setOption(n)}}}function ft(i,t,e){const n=f(i,{modeOptions:new l(t,e)});return f(n.prototype,{get modeOptions(){return this._modeOptions||(this._modeOptions=new l(t,void 0,this.constructor.modeOptions))},get mode(){return this.modeOptions.mode},set mode(s){this.modeOptions.mode=s},get options(){return this.modeOptions.fullOption}}),i}const Ot={onUse(i,t,e){const n=t??O;d(i,{modeOptions:new l(n,void 0,e)}),d(i.prototype,{get modeOptions(){const s=this,o=i;return s._modeOptions||(s._modeOptions=new l(o.modeOptions.mode,void 0,o.modeOptions))},get mode(){return this.modeOptions.mode},set mode(s){const o=this;o.modeOptions.mode=s},get options(){return this.modeOptions.plainFullOption}})},onCreate(i,t){i.modeOptions.setOption(t)}},Mt={onUse(i,t,e){d(i,{defaultOptions:new a(t,e)}),d(i.prototype,{get defaultOptions(){return this._defaultOptions||(this._defaultOptions=new a(void 0,i.defaultOptions))}})},onCreate(i,t){i.defaultOptions.option=t}};function mt(i,t){const e=f(i,{defaultOptions:new a(t)});return f(e.prototype,{get defaultOptions(){return this._defaultOptions||(this._defaultOptions=new a(void 0,this.constructor.defaultOptions))}}),i}function F(i,t){const e=[{target:i,props:t}];let n;for(;n=e.shift();){const{target:s,props:o}=n;for(const[u,c]of Object.entries(o)){if(c!=null&&typeof c=="object"&&(!c.constructor||c.constructor===Object)){e.push({target:s[u],props:c});continue}s[u]=c}}return i}function k(i,t){const e={},n=[{target:i,props:t,targetProps:e}];let s;for(;s=n.shift();){const{target:o,props:u,targetProps:c}=s;for(const[_,P]of Object.entries(u)){if(P!=null&&typeof P=="object"&&(!P.constructor||P.constructor===Object)){n.push({target:o[_],props:P,targetProps:c[_]={}});continue}c[_]=o[_]}}return e}function Pt(i,t){const e=k(i,t);function n(){F(i,t)}function s(){F(i,e)}return{set:n,unset:s}}r.ExtendManager=Y,r.ModeOptions=V,r.PluginExtendManager=g,r.PluginHost=b,r.PluginHostEventEmitter=U,r.PluginHostEventTarget=v,r.PluginManager=X,r.TierModeOptions=l,r.TierModeOptionsPluginHost=pt,r.TierModeOptionsPluginHostEventEmitter=gt,r.TierModeOptionsPluginHostEventTarget=ct,r.TierOptions=a,r.TierOptionsPluginHost=ut,r.TierOptionsPluginHostEventEmitter=at,r.TierOptionsPluginHostEventTarget=lt,r.addDefaultOptions=Z,r.addInstOptions=tt,r.becomePluginHost=j,r.becomePluginHost_Extends=ot,r.becomePluginHost_Proxy=rt,r.becomeTierModeOptionsHost=ft,r.becomeTierOptionsHost=mt,r.commonModeName=O,r.createDefineExtend=R,r.createDefineMixin=q,r.createExtendTarget=L,r.createMixinTarget=z,r.createPluginHost=D,r.createPropertySetter=Pt,r.createTargetExtend=G,r.createTargetMixin=$,r.createTierModeOptionsPluginHost=ht,r.createTierOptionsPluginHost=dt,r.defineExtend=K,r.defineMixin=B,r.extendMark=M,r.extendTarget=J,r.getPropertyValue=y,r.getPropertyValueByPath=et,r.getTargetProperties=k,r.isPlugin=C,r.mergeProperties=F,r.mixin=d,r.mixinByOmit=I,r.mixinByPick=S,r.mixinIExtend=x,r.mixinTarget=f,r.parsePropertyPath=E,r.pickHostExtendMembers=Q,r.setPropertyValue=w,r.setPropertyValueByPath=nt,r.targetExtend=W,r.targetMixin=A,r.tierModeOptionsDecorator=st,r.tierModeOptionsPlugin=Ot,r.tierOptionsDecorator=it,r.tierOptionsPlugin=Mt,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExtendManager.d.ts","sourceRoot":"","sources":["../../src/plugin-manager/ExtendManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,
|
|
1
|
+
{"version":3,"file":"ExtendManager.d.ts","sourceRoot":"","sources":["../../src/plugin-manager/ExtendManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,UAAU,EAAgB,MAAM,WAAW,CAAC;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAG9C;;;;;;GAMG;AACH,qBAAa,aAAa,CAAC,SAAS,SAAS,mBAAmB,CAAE,SAAQ,WAAW;IAEjF;;OAEG;IACH,IAAI,EAAG,SAAS,CAAC;IAEjB;;OAEG;IACH,QAAQ,CAAC,OAAO,0BAAiC;IAIjD;;OAEG;gBACS,IAAI,CAAC,EAAE,SAAS;IAOnB,WAAW;IAMpB;;;;OAIG;IACH,OAAO,CAAC,MAAM,EAAE,GAAG;IAInB;;;;OAIG;IACH,GAAG,CAAC,CAAC,SAAS,UAAU,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,SAAS,EAAE,CAAC,CAAC,GAAE,CAAC;IAQ3E;;;;;;OAMG;IACH,OAAO,CAAC,CAAC,SAAS,UAAU,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,YAAY,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,SAAS,EAAE,CAAC,CAAC,EAAG,GAAG,IAAI,EAAC,qBAAqB,CAAC,SAAS,CAAC,GAAE,CAAC;IAQ7J;;;;;;;OAOG;IACH,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC,SAAS,CAAC,EAAG,GAAG,IAAI,EAAC,qBAAqB,CAAC,SAAS,CAAC;IAWrF;;;;;;;OAOG;IACH,MAAM,CAAC,QAAQ,EAAE,YAAY,CAAC,SAAS,CAAC,EAAC,GAAG,IAAI,EAAC,GAAG;IAWpD;;;;;;OAMG;IACH,SAAS,CAAC,QAAQ,EAAE,YAAY,CAAC,SAAS,CAAC;CAY9C"}
|
|
@@ -45,6 +45,16 @@ export type IExtendHostMembers<E> = Omit<E, keyof IExtend<any>>;
|
|
|
45
45
|
* @returns
|
|
46
46
|
*/
|
|
47
47
|
export declare function pickHostExtendMembers<Ext>(extendOptions: Ext): IExtendHostMembers<Ext>;
|
|
48
|
+
/**
|
|
49
|
+
* 将 IExtend 类型的扩展对象混合进 目标 target 中
|
|
50
|
+
* @remarks
|
|
51
|
+
* 该方法 与 mixin 的区别是:
|
|
52
|
+
* - 该方法会自动排除 IExtend 类型的生命周期方法,但是如果与 IExtend 类型的生命周期同名的成员的值不是函数类型,并不会被排除
|
|
53
|
+
* @param target - 扩展的目标
|
|
54
|
+
* @param ext - 扩展对象
|
|
55
|
+
* @returns 返回扩展后的 target 对象
|
|
56
|
+
*/
|
|
57
|
+
export declare function mixinIExtend<T, E>(target: T, ext: E): T & IExtendHostMembers<E>;
|
|
48
58
|
/**
|
|
49
59
|
* 定义被 IExtend 扩展后的类的类型
|
|
50
60
|
* @remarks
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IExtend.d.ts","sourceRoot":"","sources":["../../src/plugin-manager/IExtend.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"IExtend.d.ts","sourceRoot":"","sources":["../../src/plugin-manager/IExtend.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C;;;;;;GAMG;AACH,MAAM,WAAW,OAAO,CAAC,SAAS,SAAS,mBAAmB;IAC5D;;;OAGG;IACH,QAAQ,CAAC,CAAC,IAAI,EAAE,YAAY,CAAC,SAAS,CAAC,EAAE,GAAG,IAAI,EAAE,qBAAqB,CAAC,SAAS,CAAC,GAAG,GAAG,CAAC;IAEzF;;;;OAIG;IACH,MAAM,CAAC,CAAC,IAAI,EAAE,YAAY,CAAC,SAAS,CAAC,EAAE,GAAG,IAAI,EAAE,GAAG,GAAG,GAAG,CAAC;IAE1D;;;OAGG;IACH,SAAS,CAAC,CAAC,IAAI,EAAE,YAAY,CAAC,SAAS,CAAC,GAAG,GAAG,CAAC;CAChD;AAID;;;;GAIG;AACH,MAAM,WAAW,UAAU,CAAC,SAAS,SAAS,mBAAmB,CAAE,SAAQ,OAAO,CAAC,SAAS,CAAC;IAC3F,CAAC,GAAG,EAAE,WAAW,GAAG,GAAG,CAAC;CACzB;AAQD;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;AAGhE;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,aAAa,EAAE,GAAG,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAUtF;AAMD;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAW/E;AAUD;;;;;;;GAOG;AACH,MAAM,MAAM,YAAY,CAAC,SAAS,SAAS,mBAAmB,EAAE,GAAG,IAAI,WAAW,CAAC,SAAS,EAAE,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginExtendManager.d.ts","sourceRoot":"","sources":["../../src/plugin-manager/PluginExtendManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,UAAU,
|
|
1
|
+
{"version":3,"file":"PluginExtendManager.d.ts","sourceRoot":"","sources":["../../src/plugin-manager/PluginExtendManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,UAAU,EAAgB,MAAM,WAAW,CAAC;AACxE,OAAO,EAAY,KAAK,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AAC7F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAG9C;;GAEG;AACH,eAAO,MAAM,UAAU,eAAmB,CAAC;AAG3C;;;;;;;GAOG;AACH,qBAAa,mBAAmB,CAAC,IAAI,EAAC,SAAS,SAAS,mBAAmB,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,CAAE,SAAQ,WAAW;IAEpH;;OAEG;IACH,IAAI,EAAG,SAAS,CAAC;IAEjB;;OAEG;IACH,QAAQ,CAAC,OAAO,0DAA6D;IAG7E;;OAEG;gBACS,IAAI,CAAC,EAAE,SAAS;IAOnB,WAAW;IAMpB;;;;OAIG;IACH,OAAO,CAAC,MAAM,EAAE,GAAG;IAKnB;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,IAAI,OAAO,CAAC,IAAI,EAAC,SAAS,CAAC;IAQxD;;;;OAIG;IACH,SAAS,CAAC,CAAC,SAAS,UAAU,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,aAAa,CAAC,SAAS,EAAE,CAAC,CAAC,GAAE,CAAC;IAQ9E;;;;;;OAMG;IACH,aAAa,CAAC,CAAC,SAAS,UAAU,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,YAAY,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,aAAa,CAAC,SAAS,EAAE,CAAC,CAAC,EAAG,GAAG,IAAI,EAAC,qBAAqB,CAAC,SAAS,CAAC,GAAE,CAAC;IAQhK;;;;OAIG;IACH,SAAS,CAAC,CAAC,SAAS,OAAO,CAAC,IAAI,EAAC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC,EAAC,GAAG,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC;IAQrG;;;;;;OAMG;IACH,aAAa,CAAC,CAAC,SAAS,OAAO,CAAC,IAAI,EAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC;IAU7H;;;;;;;OAOG;IACH,QAAQ,CAAC,QAAQ,EAAE,IAAI,EAAG,GAAG,IAAI,EAAC,GAAG;IAYrC;;;;;;;OAOG;IACH,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAC,GAAG,IAAI,EAAC,GAAG;IAYjC;;;;;;OAMG;IACH,SAAS,CAAC,QAAQ,EAAE,IAAI;CAa3B"}
|
|
@@ -31,6 +31,22 @@ export declare function mixin<T, S1, S2, S3, S4>(target: T, source1: S1, source2
|
|
|
31
31
|
* @returns 混入后的 target
|
|
32
32
|
*/
|
|
33
33
|
export declare function mixin(target: any, ...sources: any[]): any;
|
|
34
|
+
/**
|
|
35
|
+
* 混合对象,省略指定的属性
|
|
36
|
+
* @param target - 目标对象,所有 源对象 的属性都要被混入进到 目标对象中
|
|
37
|
+
* @param source - 源对象,所有 源对象 的属性都要被混入进到 目标对象中
|
|
38
|
+
* @param omitProps - 要省略的属性,这些属性不会被混入到 目标对象中
|
|
39
|
+
* @returns 混入后的 target
|
|
40
|
+
*/
|
|
41
|
+
export declare function mixinByOmit<T, S, Prop extends PropertyKey>(target: T, source: S, omitProps?: Iterable<Prop> | null): T & Omit<S, Prop>;
|
|
42
|
+
/**
|
|
43
|
+
* 混合对象,只包含指定的属性
|
|
44
|
+
* @param target - 目标对象,所有 源对象 的属性都要被混入进到 目标对象中
|
|
45
|
+
* @param source - 源对象,所有 源对象 的属性都要被混入进到 目标对象中
|
|
46
|
+
* @param pickProps - 要包含的属性,只有这些属性才会被混入到 目标对象中
|
|
47
|
+
* @returns 混入后的 target
|
|
48
|
+
*/
|
|
49
|
+
export declare function mixinByPick<T, S, Prop extends keyof S>(target: T, source: S, pickProps?: Iterable<Prop> | null): T & Pick<S, Prop>;
|
|
34
50
|
/**
|
|
35
51
|
* 用于混合对象的选项类型
|
|
36
52
|
* @remarks
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mixin.d.ts","sourceRoot":"","sources":["../../src/plugin-manager/mixin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mixin.d.ts","sourceRoot":"","sources":["../../src/plugin-manager/mixin.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACzD;;;GAGG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC;AACnF;;;GAGG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AACzG;;;GAGG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAC/H;;;;;;;;;;;GAWG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC;AAU3D;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,SAAS,WAAW,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAKtI;AAGD;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,SAAS,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CASlI;AAID;;;;;;;GAOG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AAMrD;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,CAE1F;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,MACL,CAAC,EAAE,OAAO,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,KAAG,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,CAG9E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,CAGtF;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,IAChB,CAAC,EAAE,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,KAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAI5E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAG5F;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,IAChB,CAAC,EAAE,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,KAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAIhF;AAKD;;GAEG;AACH,MAAM,MAAM,4BAA4B,CAAC,CAAC,SAAS,KAAK,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG,EAAE,QAAQ,SAAS,GAAG,EAAE,IAAI,KAAK,GAAG,IAAI,EAAE,QAAQ,KAAK,YAAY,CAAC,CAAC,CAAC,CAAC;AAEnJ;;GAEG;AACH,MAAM,MAAM,wBAAwB,CAAC,CAAC,SAAS,KAAK,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG,EAAE,SAAS,IAAI,KAAK,GAAG,IAAI,EAAE,qBAAqB,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "plugin-tls",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.1",
|
|
4
4
|
"description": "plugin-tls 是插件系统相应的工具,可快速地让任何模块具备插件机制",
|
|
5
5
|
"main": "./dist/index.umd.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"vite-node": "latest"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@gby/destroyable": "^3.
|
|
56
|
-
"com-tools": "^2.
|
|
55
|
+
"@gby/destroyable": "^3.7.0",
|
|
56
|
+
"com-tools": "^2.22.1",
|
|
57
57
|
"deepmerge-ts": "^7.1.5",
|
|
58
58
|
"type-tls": "^3.11.0"
|
|
59
59
|
},
|