plugin-tls 5.4.0 → 5.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.
@@ -0,0 +1 @@
1
+ "use strict";const M=require("@gby/destroyable"),b=require("deepmerge-ts"),O=require("type-tls"),h=require("com-tools");function a(i,...e){for(const t of e){const n=Object.getOwnPropertyDescriptors(t);Object.defineProperties(i,n)}return i}function V(i,e,t){let n=Object.getOwnPropertyDescriptors(e);return t&&h.omitMembers(n,t),Object.defineProperties(i,n),i}function v(i,e,t){let n=Object.getOwnPropertyDescriptors(e);return t?Object.defineProperties(i,h.removeUndefined(h.pickMembers(n,t))):Object.defineProperties(i,n),i}function N(i,e){return e}function H(i){return function(t){return t}}function k(i,e){return a(i,e),e}function C(i){return function(t){return a(i,t),t}}function S(i,e){return a(i,e),i}function j(i){return function(t){return a(i,t),i}}const T=["onCreate","onInit","onDestroy"];function A(i){const e={...i};for(const t of T)typeof e[t]=="function"&&delete e[t];return e}function U(i,e){let t=Object.getOwnPropertyDescriptors(e);for(const n of T)typeof e[n]=="function"&&delete t[n];return Object.defineProperties(i,t),i}function B(i,e){return e}function R(i){return function(t){return t}}function q(i,e){return a(i.prototype,e),e}function z(i){return function(t){return a(i.prototype,t),t}}function K(i,e){return a(i.prototype,e),i}function $(i){return function(t){return a(i.prototype,t),i}}function w(i){return i&&typeof i.onUse=="function"}const c=Symbol("extend");class g extends M.Destroyable{parent;host;plugins=new Map;constructor(e,t){super(),this.parent=t,e&&(this.host=e)}destroyThis(){return this.plugins.clear(),this.host=null,super.destroyThis()}hasUsed(e){return this.parent?.hasUsed(e)||this.plugins.has(e)}getUseReturn(e){const{parent:t}=this;return t?.hasUsed(e)?t.getUseReturn(e):this.plugins.get(e)}isPlugin(e){return this.hasUsed(e)?this.getUseReturn(e)!==c:w(e)}useExtend(e){return this.hasUsed(e)||(U(this.host.prototype,e),this.plugins.set(e,c)),e}instUseExtend(e,t,...n){return this.hasUsed(t)||(this.useExtend(t),t.onCreate?.call(e,e,...n)),t}usePlugin(e,...t){if(this.hasUsed(e))return this.getUseReturn(e);const n=e.onUse(this.host,...t);return this.plugins.set(e,n),n}instUsePlugin(e,t,...n){if(this.hasUsed(t))return this.getUseReturn(t);const s=this.usePlugin(t,...n);return t.onCreate?.(e),s}onCreate(e,...t){const n=this.parent?.onCreate(e,...t),s=[];for(const[r,o]of this.plugins)if(r.onCreate){const d=o===c?r.onCreate:r.onCreate.bind(r);s.push(d)}return O.waitAsyncable(n,()=>h.serialCallFuns(s,e,[e,...t]))}onInit(e,...t){const n=this.parent?.onInit(e,...t),s=[];for(const[r,o]of this.plugins)if(r.onInit){const d=o===c?r.onInit:r.onInit.bind(r);s.push(d)}return O.waitAsyncable(n,()=>h.serialCallFuns(s,e,[e,...t]))}onDestroy(e){const t=[];for(const[r,o]of this.plugins)if(r.onDestroy){const d=o===c?r.onDestroy:r.onDestroy.bind(r);t.push(d)}t.reverse();const n=h.serialCallFuns(t,e,[e]),{parent:s}=this;return s?O.waitAsyncable(n,()=>s.onDestroy(e)):n}}const F=b.deepmergeIntoCustom({mergeArrays:!1,mergeSets:!1}),D=b.deepmergeCustom({mergeArrays:!1,mergeSets:!1});function x(i){const e=i.split(".");return e[0]===""&&e.shift(),e}function f(i,e){for(const t of e)if(i=i[t],i==null)return;return i}function L(i,e){return f(i,x(e))}function y(i,e,t){const n=e.pop(),s=e.length;let r=0;for(;r<s;){const o=i[e[r]];if(o==null)break;i=o,r++}e=e.slice(r);for(const o of e)i=i[o]={};return i[n]=t,i}function G(i,e,t){return y(i,x(e),t)}const m={UndefinedAndNull:function(e){return e==null},Undefined:function(e){return e===void 0},Null:function(e){return e===null}};class E{static deepmergeInto=F;static deepmerge=D;get deepmergeInto(){return this.constructor.deepmergeInto}get deepmerge(){return this.constructor.deepmerge}freezeMember=!0;fullOption=new Proxy(this,{get:function(e,t,n){const s=e.plainFullOption[t];return e.freezeMember?Object.freeze(s):s},set:function(e,t,n,s){return e.setMember(t,n,!1),!0},has:function(e,t){return t in e.plainFullOption},getOwnPropertyDescriptor:function(e,t){return Object.getOwnPropertyDescriptor(e.plainFullOption,t)},ownKeys:function(e){return Reflect.ownKeys(e.plainFullOption)},deleteProperty:function(e,t){return e.setMember(t,void 0),!0},defineProperty:function(e,t,n){return Object.defineProperty(e.option,t,n),!0}});setOption(e,t){const n=t?this.deepmergeInto(this.option,e):Object.assign(this.option,e);return this.updateFullOption(),n}get undefinedValue(){return this._undefinedValue}set undefinedValue(e){this._undefinedValue=e,this.isUndefined=m[e]||m.UndefinedAndNull}_undefinedValue="UndefinedAndNull";isUndefined=m.UndefinedAndNull;getMember(e){return this.option[e]}setMember(e,t,n){const s=this.option;if(t===void 0)delete s[e];else{const r=s[e];n&&r&&typeof r=="object"?this.deepmergeInto(r,t):s[e]=t}this.updateFullOption()}getValue(e){return f(this.option,e)}setValue(e,t,n){const s=this.option;let r;n&&(r=f(s,e))&&typeof r=="object"?this.deepmergeInto(r,t):y(this.option,e,t),this.updateFullOption()}}class u extends E{constructor(e,t){super(),e&&(this.option=e),t&&(this.extends=t)}get extends(){return this._extends}set extends(e){this._extends=e,this.updateFullOption()}_extends=null;option={};get plainFullOption(){let e=this._plainFullOption;if(e)return e;const{extends:t,option:n}=this;if(e=n,t){const s=t.plainFullOption;e=this.deepmerge(s,n)}return this._plainFullOption=e}_plainFullOption=null;updateFullOption(){this._plainFullOption=null}getMember(e){const t=this.option[e];if(!this.isUndefined(t))return t;const n=this.extends;if(n)return n.getMember(e)}getValue(e){const t=super.getValue(e);if(!this.isUndefined(t))return t;const n=this.extends;if(n)return n.getValue(e)}}function J(i,e){const{name:t}=e,n=`_${t}`;return{get:function(){return this[n]||(this[n]=new u(void 0,this.constructor[t]))}}}class I extends E{constructor(e,t){super(),t&&this.setModeOption(e,t),this.mode=e}modes={};get mode(){return this._mode||(this.mode=this.modeNames[0])}set mode(e){this._mode=e,this.hasMode(e)||this.setModeOption(e,{}),this.updateFullOption()}_mode;get modeNames(){return this._modeNames||(this._modeNames=this.getModeNames())}_modeNames=null;getModeNames(){return Object.keys(this.modes)}hasMode(e){return!!this.modes[e]}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(e){return this.modes[e].option}getFullModeOption(e){return this.modes[e]?.plainFullOption}setModeOption(e,t,n,s){const{modes:r}=this,o=r[e]||(r[e]=new u);if(o.setOption(t,n),s){const d=r[s];d&&(o.extends=d)}return this.updateFullOption(),o}}class l extends I{constructor(e,t,n){super(e,t),n&&(this.extends=n)}get extends(){return this._extends}set extends(e){this._extends=e,this.updateFullOption()}_extends=null;getFullModeOption(e){const{modes:t,extends:n}=this,s=t[e]?.plainFullOption;if(n){const r=n.getFullModeOption(e);return s?this.deepmerge(r,s):r}return s}getModeNames(){const{modes:e,extends:t}=this,n=Object.keys(e);if(!t)return n;const s=t.getModeNames();return[...new Set([...n,...s])]}hasModeOnTier(e){if(this.hasMode(e))return!0;const t=this.extends;return t?t.hasModeOnTier(e):!1}get optionManager(){return this.getModeOptionManager(this.mode)}getModeOptionManager(e){const t=this.modes[e];return t||(this.extends?.getModeOptionManager(e)?this.setModeOption(e,{}):null)}getMember(e){const t=this.optionManager.getMember(e);if(!this.isUndefined(t))return t;const n=this.extends;if(n)return n.getMember(e)}getValue(e){const t=this.optionManager.getValue(e);if(!this.isUndefined(t))return t;const n=this.extends;if(n)return n.getValue(e)}}function Q(i,e){const{name:t}=e,n=`_${t}`;return{get:function(){return this[n]||(this[n]=new l(this.constructor[t].mode,void 0,this.constructor[t]))}}}class P extends M.Destroyable{static isolatedPluginManager=!1;static get pluginManager(){return this.isolatedPluginManager&&!this.hasOwnProperty("_pluginManager")&&(this._pluginManager=new g(this,this._pluginManager)),this._pluginManager}static _pluginManager=new g(this);get pluginManager(){return this.constructor.pluginManager}static usePlugin(e,...t){return this.pluginManager.usePlugin(e,...t)}static useExtend(e){return this.pluginManager.useExtend(e)}static hasUsed(e){return this.pluginManager.hasUsed(e)}usePlugin(e,...t){return this.pluginManager.instUsePlugin(this,e,...t)}useExtend(e,...t){return this.pluginManager.instUseExtend(this,e,...t)}init(...e){return this.pluginManager.onInit(this,...e)}destroyThis(){const e=this.pluginManager.onDestroy(this);return e instanceof Promise?e.finally(()=>super.destroyThis()):super.destroyThis()}}class W extends P{static isolatedOptions=!1;static get defaultOptions(){return this.isolatedOptions&&!this.hasOwnProperty("_defaultOptions")&&(this._defaultOptions=new u(void 0,this._defaultOptions)),this._defaultOptions}static _defaultOptions=new u;get defaultOptions(){return this._defaultOptions||(this._defaultOptions=new u(void 0,this.constructor.defaultOptions))}_defaultOptions;constructor(e){super(),e&&(this.defaultOptions.option=e)}}function _(i){const e=M.createDestroyableSubClass(i);return class extends e{static isolatedPluginManager=!1;static get pluginManager(){return this.isolatedPluginManager&&!this.hasOwnProperty("_pluginManager")&&(this._pluginManager=new g(this,this._pluginManager)),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 X(i){const e=_(i);return class extends e{static isolatedOptions=!1;static get defaultOptions(){return this.isolatedOptions&&!this.hasOwnProperty("_defaultOptions")&&(this._defaultOptions=new u(void 0,this._defaultOptions)),this._defaultOptions}static _defaultOptions=new u;get defaultOptions(){return this._defaultOptions||(this._defaultOptions=new u(void 0,this.constructor.defaultOptions))}_defaultOptions;constructor(n){super(),n&&(this.defaultOptions.option=n)}}}const p="common";class Y extends P{static isolatedOptions=!1;static get modeOptions(){return this.isolatedOptions&&!this.hasOwnProperty("_modeOptions")&&(this._modeOptions=new l(p,null,this._modeOptions)),this._modeOptions}static _modeOptions=new l(p);get modeOptions(){return this._modeOptions||(this._modeOptions=new l(p,void 0,this.constructor.modeOptions))}_modeOptions;get mode(){return this.modeOptions.mode}set mode(e){this.modeOptions.mode=e}get options(){return this.modeOptions.plainFullOption}constructor(e){super(),e&&this.modeOptions.setOption(e)}}function Z(i){const e=_(i);return class extends e{static isolatedOptions=!1;static get modeOptions(){return this.isolatedOptions&&!this.hasOwnProperty("_modeOptions")&&(this._modeOptions=new l(p,null,this._modeOptions)),this._modeOptions}static _modeOptions=new l(p);get modeOptions(){return this._modeOptions||(this._modeOptions=new l(p,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(),n&&this.modeOptions.setOption(n)}}}exports.ModeOptions=I;exports.PluginExtendManager=g;exports.PluginHost=P;exports.TierModeOptions=l;exports.TierModeOptionsPluginHost=Y;exports.TierOptions=u;exports.TierOptionsPluginHost=W;exports.commonModeName=p;exports.createDefineIExtend=R;exports.createDefineMixin=H;exports.createIExtendTarget=$;exports.createMixinTarget=j;exports.createPluginHost=_;exports.createTargetIExtend=z;exports.createTargetMixin=C;exports.createTierModeOptionsPluginHost=Z;exports.createTierOptionsPluginHost=X;exports.deepmerge=D;exports.deepmergeInto=F;exports.defineIExtend=B;exports.defineMixin=N;exports.extendMark=c;exports.getPropertyValue=f;exports.getPropertyValueByPath=L;exports.iextendTarget=K;exports.isPlugin=w;exports.mixin=a;exports.mixinByOmit=V;exports.mixinByPick=v;exports.mixinIExtend=U;exports.mixinTarget=S;exports.parsePropertyPath=x;exports.pickHostExtendMembers=A;exports.setPropertyValue=y;exports.setPropertyValueByPath=G;exports.targetIExtend=q;exports.targetMixin=k;exports.tierModeOptionsDecorator=Q;exports.tierOptionsDecorator=J;
@@ -1,88 +1,88 @@
1
- import { Destroyable as x, createDestroyableSubClass as T } from "@gby/destroyable";
2
- import { deepmergeInto as f, deepmerge as _ } from "deepmerge-ts";
3
- import { waitAsyncable as g } from "type-tls";
4
- import { omitMembers as D, removeUndefined as v, pickMembers as E, serialCallFuns as O } from "com-tools";
5
- function l(s, ...t) {
1
+ import { Destroyable as M, createDestroyableSubClass as w } from "@gby/destroyable";
2
+ import { deepmergeCustom as F, deepmergeIntoCustom as T } from "deepmerge-ts";
3
+ import { waitAsyncable as f } from "type-tls";
4
+ import { omitMembers as D, removeUndefined as v, pickMembers as E, serialCallFuns as g } from "com-tools";
5
+ function d(s, ...t) {
6
6
  for (const e of t) {
7
7
  const n = Object.getOwnPropertyDescriptors(e);
8
8
  Object.defineProperties(s, n);
9
9
  }
10
10
  return s;
11
11
  }
12
- function S(s, t, e) {
12
+ function R(s, t, e) {
13
13
  let n = Object.getOwnPropertyDescriptors(t);
14
14
  return e && D(n, e), Object.defineProperties(s, n), s;
15
15
  }
16
- function R(s, t, e) {
16
+ function B(s, t, e) {
17
17
  let n = Object.getOwnPropertyDescriptors(t);
18
18
  return e ? Object.defineProperties(s, v(E(n, e))) : Object.defineProperties(s, n), s;
19
19
  }
20
- function A(s, t) {
20
+ function z(s, t) {
21
21
  return t;
22
22
  }
23
- function B(s) {
23
+ function K(s) {
24
24
  return function(e) {
25
25
  return e;
26
26
  };
27
27
  }
28
- function z(s, t) {
29
- return l(s, t), t;
28
+ function $(s, t) {
29
+ return d(s, t), t;
30
30
  }
31
- function K(s) {
31
+ function q(s) {
32
32
  return function(e) {
33
- return l(s, e), e;
33
+ return d(s, e), e;
34
34
  };
35
35
  }
36
- function $(s, t) {
37
- return l(s, t), s;
36
+ function G(s, t) {
37
+ return d(s, t), s;
38
38
  }
39
- function q(s) {
39
+ function J(s) {
40
40
  return function(e) {
41
- return l(s, e), s;
41
+ return d(s, e), s;
42
42
  };
43
43
  }
44
- const y = ["onCreate", "onInit", "onDestroy"];
45
- function G(s) {
44
+ const x = ["onCreate", "onInit", "onDestroy"];
45
+ function L(s) {
46
46
  const t = { ...s };
47
- for (const e of y)
47
+ for (const e of x)
48
48
  typeof t[e] == "function" && delete t[e];
49
49
  return t;
50
50
  }
51
51
  function N(s, t) {
52
52
  let e = Object.getOwnPropertyDescriptors(t);
53
- for (const n of y)
53
+ for (const n of x)
54
54
  typeof t[n] == "function" && delete e[n];
55
55
  return Object.defineProperties(s, e), s;
56
56
  }
57
- function L(s, t) {
57
+ function Q(s, t) {
58
58
  return t;
59
59
  }
60
- function J(s) {
60
+ function W(s) {
61
61
  return function(e) {
62
62
  return e;
63
63
  };
64
64
  }
65
- function Q(s, t) {
66
- return l(s.prototype, t), t;
65
+ function X(s, t) {
66
+ return d(s.prototype, t), t;
67
67
  }
68
- function W(s) {
68
+ function Y(s) {
69
69
  return function(e) {
70
- return l(s.prototype, e), e;
70
+ return d(s.prototype, e), e;
71
71
  };
72
72
  }
73
- function X(s, t) {
74
- return l(s.prototype, t), s;
73
+ function Z(s, t) {
74
+ return d(s.prototype, t), s;
75
75
  }
76
- function Y(s) {
76
+ function tt(s) {
77
77
  return function(e) {
78
- return l(s.prototype, e), s;
78
+ return d(s.prototype, e), s;
79
79
  };
80
80
  }
81
81
  function V(s) {
82
82
  return s && typeof s.onUse == "function";
83
83
  }
84
84
  const c = /* @__PURE__ */ Symbol("extend");
85
- class h extends x {
85
+ class h extends M {
86
86
  /**
87
87
  * 父级插件管理者
88
88
  *
@@ -187,7 +187,7 @@ class h extends x {
187
187
  const u = o === c ? r.onCreate : r.onCreate.bind(r);
188
188
  i.push(u);
189
189
  }
190
- return g(n, () => O(i, t, [t, ...e]));
190
+ return f(n, () => g(i, t, [t, ...e]));
191
191
  }
192
192
  /**
193
193
  * 插件宿主创建实例时调用
@@ -204,7 +204,7 @@ class h extends x {
204
204
  const u = o === c ? r.onInit : r.onInit.bind(r);
205
205
  i.push(u);
206
206
  }
207
- return g(n, () => O(i, t, [t, ...e]));
207
+ return f(n, () => g(i, t, [t, ...e]));
208
208
  }
209
209
  /**
210
210
  * 插件宿主被销毁时调用
@@ -221,23 +221,24 @@ class h extends x {
221
221
  e.push(u);
222
222
  }
223
223
  e.reverse();
224
- const n = O(e, t, [t]), { parent: i } = this;
225
- return i ? g(n, () => i.onDestroy(t)) : n;
224
+ const n = g(e, t, [t]), { parent: i } = this;
225
+ return i ? f(n, () => i.onDestroy(t)) : n;
226
226
  }
227
227
  }
228
- function P(s) {
228
+ const I = T({ mergeArrays: !1, mergeSets: !1 }), C = F({ mergeArrays: !1, mergeSets: !1 });
229
+ function _(s) {
229
230
  const t = s.split(".");
230
231
  return t[0] === "" && t.shift(), t;
231
232
  }
232
- function M(s, t) {
233
+ function m(s, t) {
233
234
  for (const e of t)
234
235
  if (s = s[e], s == null) return;
235
236
  return s;
236
237
  }
237
- function Z(s, t) {
238
- return M(s, P(t));
238
+ function et(s, t) {
239
+ return m(s, _(t));
239
240
  }
240
- function b(s, t, e) {
241
+ function y(s, t, e) {
241
242
  const n = t.pop(), i = t.length;
242
243
  let r = 0;
243
244
  for (; r < i; ) {
@@ -250,10 +251,10 @@ function b(s, t, e) {
250
251
  s = s[o] = {};
251
252
  return s[n] = e, s;
252
253
  }
253
- function tt(s, t, e) {
254
- return b(s, P(t), e);
254
+ function nt(s, t, e) {
255
+ return y(s, _(t), e);
255
256
  }
256
- const m = {
257
+ const O = {
257
258
  UndefinedAndNull: function(t) {
258
259
  return t == null;
259
260
  },
@@ -264,7 +265,27 @@ const m = {
264
265
  return t === null;
265
266
  }
266
267
  };
267
- class U {
268
+ class P {
269
+ /**
270
+ * 深度合并到目标对象
271
+ */
272
+ static deepmergeInto = I;
273
+ /**
274
+ * 深度合并
275
+ */
276
+ static deepmerge = C;
277
+ /**
278
+ * 深度合并到目标对象
279
+ */
280
+ get deepmergeInto() {
281
+ return this.constructor.deepmergeInto;
282
+ }
283
+ /**
284
+ * 深度合并
285
+ */
286
+ get deepmerge() {
287
+ return this.constructor.deepmerge;
288
+ }
268
289
  /**
269
290
  * 是否要冻结 fullOption 的成员
270
291
  * @remarks
@@ -316,7 +337,7 @@ class U {
316
337
  * @param deep - 是否要进行深度合并
317
338
  */
318
339
  setOption(t, e) {
319
- const n = e ? f(this.option, t) : Object.assign(this.option, t);
340
+ const n = e ? this.deepmergeInto(this.option, t) : Object.assign(this.option, t);
320
341
  return this.updateFullOption(), n;
321
342
  }
322
343
  /**
@@ -326,13 +347,13 @@ class U {
326
347
  return this._undefinedValue;
327
348
  }
328
349
  set undefinedValue(t) {
329
- this._undefinedValue = t, this.isUndefined = m[t] || m.UndefinedAndNull;
350
+ this._undefinedValue = t, this.isUndefined = O[t] || O.UndefinedAndNull;
330
351
  }
331
352
  _undefinedValue = "UndefinedAndNull";
332
353
  /**
333
354
  * 未定义值的判断函数
334
355
  */
335
- isUndefined = m.UndefinedAndNull;
356
+ isUndefined = O.UndefinedAndNull;
336
357
  /**
337
358
  * 获取选项成员
338
359
  * @param key
@@ -353,7 +374,7 @@ class U {
353
374
  delete i[t];
354
375
  else {
355
376
  const r = i[t];
356
- n && r && typeof r == "object" ? f(r, e) : i[t] = e;
377
+ n && r && typeof r == "object" ? this.deepmergeInto(r, e) : i[t] = e;
357
378
  }
358
379
  this.updateFullOption();
359
380
  }
@@ -363,7 +384,7 @@ class U {
363
384
  * @returns
364
385
  */
365
386
  getValue(t) {
366
- return M(this.option, t);
387
+ return m(this.option, t);
367
388
  }
368
389
  /**
369
390
  * 设置属性路径对应的值
@@ -375,10 +396,10 @@ class U {
375
396
  setValue(t, e, n) {
376
397
  const i = this.option;
377
398
  let r;
378
- n && (r = M(i, t)) && typeof r == "object" ? f(r, e) : b(this.option, t, e), this.updateFullOption();
399
+ n && (r = m(i, t)) && typeof r == "object" ? this.deepmergeInto(r, e) : y(this.option, t, e), this.updateFullOption();
379
400
  }
380
401
  }
381
- class a extends U {
402
+ class a extends P {
382
403
  constructor(t, e) {
383
404
  super(), t && (this.option = t), e && (this.extends = e);
384
405
  }
@@ -407,7 +428,7 @@ class a extends U {
407
428
  const { extends: e, option: n } = this;
408
429
  if (t = n, e) {
409
430
  const i = e.plainFullOption;
410
- t = _(i, n);
431
+ t = this.deepmerge(i, n);
411
432
  }
412
433
  return this._plainFullOption = t;
413
434
  }
@@ -443,7 +464,7 @@ class a extends U {
443
464
  return n.getValue(t);
444
465
  }
445
466
  }
446
- function et(s, t) {
467
+ function st(s, t) {
447
468
  const { name: e } = t, n = `_${e}`;
448
469
  return {
449
470
  get: function() {
@@ -451,7 +472,7 @@ function et(s, t) {
451
472
  }
452
473
  };
453
474
  }
454
- class k extends U {
475
+ class k extends P {
455
476
  constructor(t, e) {
456
477
  super(), e && this.setModeOption(t, e), this.mode = t;
457
478
  }
@@ -549,7 +570,7 @@ class k extends U {
549
570
  return this.updateFullOption(), o;
550
571
  }
551
572
  }
552
- class d extends k {
573
+ class l extends k {
553
574
  constructor(t, e, n) {
554
575
  super(t, e), n && (this.extends = n);
555
576
  }
@@ -574,7 +595,7 @@ class d extends k {
574
595
  const { modes: e, extends: n } = this, i = e[t]?.plainFullOption;
575
596
  if (n) {
576
597
  const r = n.getFullModeOption(t);
577
- return i ? _(r, i) : r;
598
+ return i ? this.deepmerge(r, i) : r;
578
599
  }
579
600
  return i;
580
601
  }
@@ -638,15 +659,15 @@ class d extends k {
638
659
  return n.getValue(t);
639
660
  }
640
661
  }
641
- function nt(s, t) {
662
+ function it(s, t) {
642
663
  const { name: e } = t, n = `_${e}`;
643
664
  return {
644
665
  get: function() {
645
- return this[n] || (this[n] = new d(this.constructor[e].mode, void 0, this.constructor[e]));
666
+ return this[n] || (this[n] = new l(this.constructor[e].mode, void 0, this.constructor[e]));
646
667
  }
647
668
  };
648
669
  }
649
- class w extends x {
670
+ class b extends M {
650
671
  /**
651
672
  * 是否使用独立的插件管理器
652
673
  * @defaultValue false
@@ -729,7 +750,7 @@ class w extends x {
729
750
  return t instanceof Promise ? t.finally(() => super.destroyThis()) : super.destroyThis();
730
751
  }
731
752
  }
732
- class st extends w {
753
+ class rt extends b {
733
754
  /**
734
755
  * 是否使用独立的选项
735
756
  * @defaultValue false
@@ -753,8 +774,8 @@ class st extends w {
753
774
  super(), t && (this.defaultOptions.option = t);
754
775
  }
755
776
  }
756
- function F(s) {
757
- const t = T(s);
777
+ function U(s) {
778
+ const t = w(s);
758
779
  return class extends t {
759
780
  /**
760
781
  * 是否使用独立的插件管理器
@@ -838,8 +859,8 @@ function F(s) {
838
859
  }
839
860
  };
840
861
  }
841
- function ot(s) {
842
- const t = F(s);
862
+ function at(s) {
863
+ const t = U(s);
843
864
  return class extends t {
844
865
  /**
845
866
  * 是否使用独立的选项
@@ -866,7 +887,7 @@ function ot(s) {
866
887
  };
867
888
  }
868
889
  const p = "common";
869
- class ut extends w {
890
+ class dt extends b {
870
891
  /**
871
892
  * 是否使用独立的选项
872
893
  * @defaultValue false
@@ -876,14 +897,14 @@ class ut extends w {
876
897
  * 全局级别的默认选项
877
898
  */
878
899
  static get modeOptions() {
879
- return this.isolatedOptions && !this.hasOwnProperty("_modeOptions") && (this._modeOptions = new d(p, null, this._modeOptions)), this._modeOptions;
900
+ return this.isolatedOptions && !this.hasOwnProperty("_modeOptions") && (this._modeOptions = new l(p, null, this._modeOptions)), this._modeOptions;
880
901
  }
881
- static _modeOptions = new d(p);
902
+ static _modeOptions = new l(p);
882
903
  /**
883
904
  * 实例级的默认选项
884
905
  */
885
906
  get modeOptions() {
886
- return this._modeOptions || (this._modeOptions = new d(p, void 0, this.constructor.modeOptions));
907
+ return this._modeOptions || (this._modeOptions = new l(p, void 0, this.constructor.modeOptions));
887
908
  }
888
909
  _modeOptions;
889
910
  get mode() {
@@ -899,8 +920,8 @@ class ut extends w {
899
920
  super(), t && this.modeOptions.setOption(t);
900
921
  }
901
922
  }
902
- function lt(s) {
903
- const t = F(s);
923
+ function pt(s) {
924
+ const t = U(s);
904
925
  return class extends t {
905
926
  /**
906
927
  * 是否使用独立的选项
@@ -911,14 +932,14 @@ function lt(s) {
911
932
  * 全局级别的默认选项
912
933
  */
913
934
  static get modeOptions() {
914
- return this.isolatedOptions && !this.hasOwnProperty("_modeOptions") && (this._modeOptions = new d(p, null, this._modeOptions)), this._modeOptions;
935
+ return this.isolatedOptions && !this.hasOwnProperty("_modeOptions") && (this._modeOptions = new l(p, null, this._modeOptions)), this._modeOptions;
915
936
  }
916
- static _modeOptions = new d(p);
937
+ static _modeOptions = new l(p);
917
938
  /**
918
939
  * 实例级的默认选项
919
940
  */
920
941
  get modeOptions() {
921
- return this._modeOptions || (this._modeOptions = new d(p, void 0, this.constructor.modeOptions));
942
+ return this._modeOptions || (this._modeOptions = new l(p, void 0, this.constructor.modeOptions));
922
943
  }
923
944
  _modeOptions;
924
945
  get mode() {
@@ -936,41 +957,43 @@ function lt(s) {
936
957
  };
937
958
  }
938
959
  export {
939
- P as A,
940
- G as B,
941
- b as C,
942
- tt as D,
943
- Q as E,
944
- z as F,
945
- nt as G,
946
- et as H,
960
+ R as A,
961
+ B,
962
+ _ as C,
963
+ L as D,
964
+ y as E,
965
+ nt as F,
966
+ X as G,
967
+ $ as H,
968
+ it as I,
969
+ st as J,
947
970
  k as M,
948
971
  h as P,
949
- d as T,
972
+ l as T,
950
973
  N as a,
951
- $ as b,
974
+ G as b,
952
975
  p as c,
953
976
  a as d,
954
- w as e,
955
- ut as f,
956
- st as g,
957
- J as h,
958
- B as i,
959
- Y as j,
960
- q as k,
961
- F as l,
962
- l as m,
963
- W as n,
964
- K as o,
965
- lt as p,
966
- ot as q,
967
- L as r,
968
- A as s,
969
- c as t,
970
- M as u,
971
- Z as v,
972
- X as w,
973
- V as x,
974
- S as y,
975
- R as z
977
+ b as e,
978
+ dt as f,
979
+ rt as g,
980
+ W as h,
981
+ K as i,
982
+ tt as j,
983
+ J as k,
984
+ U as l,
985
+ d as m,
986
+ Y as n,
987
+ q as o,
988
+ pt as p,
989
+ at as q,
990
+ C as r,
991
+ I as s,
992
+ Q as t,
993
+ z as u,
994
+ c as v,
995
+ m as w,
996
+ et as x,
997
+ Z as y,
998
+ V as z
976
999
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./Destroyable-mrBsNabq-IFFuYfKS.cjs"),u=require("com-tools"),a=require("node:events"),s=require("./createTierModeOptionsPluginHost-CmgnR5Ur.cjs");var d=class extends a.EventEmitter{refCount=0;get isDestroyed(){return this._isDestroyed}_isDestroyed=!1;get canDestroy(){return!this.isDestroyed&&this.refCount<=0}_destroyers=[];disposeFun(e){return this._destroyers.push(e),e}cancelDisposeFun(e){let t=this._destroyers.indexOf(e);return this._destroyers.splice(t,1),e}disposeObj(e,t){let i=t?function(){return e.destroySync()}:function(){return e.destroy()};return this.disposeFun(i),e.__destroyable_destroyer=i,e}cancelDisposeObj(e){let t=e.__destroyable_destroyer;return t&&this.cancelDisposeFun(t),e}dispose(e,t){return typeof e=="function"?this.disposeFun(e):this.disposeObj(e,t)}cancelDispose(e){return typeof e=="function"?this.cancelDisposeFun(e):this.cancelDisposeObj(e)}destroyThis(){}destroySync(){if(!this.canDestroy)return this.isDestroyed;let e=this._destroyers.length;for(;--e>=0;){let t=this._destroyers[e];try{t()}catch(i){console.error("销毁函数在同步销毁时出错",this,t,i)}}this._destroyers.length=0;try{this.destroyThis()}catch(t){console.error("destroyThis 在异步销毁时出错",this,t)}return n.a(this),!0}destroy(){if(!this.canDestroy)return this.isDestroyed;let e=this._destroyers.toReversed();e.push(this.destroyThis),this._destroyers.length=0;let t=u.serialCallAllFuns(e,this,null,(i,r)=>{console.error("销毁函数在串行销毁时出错",this,r,i)});return t instanceof Promise?t.then(()=>(n.a(this),!0)):(n.a(this),!0)}};class o extends d{static isolatedPluginManager=!1;static get pluginManager(){return this.isolatedPluginManager&&!this.hasOwnProperty("_pluginManager")&&(this._pluginManager=new s.PluginExtendManager(this,this._pluginManager)),this._pluginManager}static _pluginManager=new s.PluginExtendManager(this);get pluginManager(){return this.constructor.pluginManager}static usePlugin(t,...i){return this.pluginManager.usePlugin(t,...i)}static useExtend(t){return this.pluginManager.useExtend(t)}static hasUsed(t){return this.pluginManager.hasUsed(t)}usePlugin(t,...i){return this.pluginManager.instUsePlugin(this,t,...i)}useExtend(t,...i){return this.pluginManager.instUseExtend(this,t,...i)}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 l extends o{static isolatedOptions=!1;static get modeOptions(){return this.isolatedOptions&&!this.hasOwnProperty("_modeOptions")&&(this._modeOptions=new s.TierModeOptions(s.commonModeName,null,this._modeOptions)),this._modeOptions}static _modeOptions=new s.TierModeOptions(s.commonModeName);get modeOptions(){return this._modeOptions||(this._modeOptions=new s.TierModeOptions(s.commonModeName,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(),t&&this.modeOptions.setOption(t)}}class p extends o{static isolatedOptions=!1;static get defaultOptions(){return this.isolatedOptions&&!this.hasOwnProperty("_defaultOptions")&&(this._defaultOptions=new s.TierOptions(void 0,this._defaultOptions)),this._defaultOptions}static _defaultOptions=new s.TierOptions;get defaultOptions(){return this._defaultOptions||(this._defaultOptions=new s.TierOptions(void 0,this.constructor.defaultOptions))}_defaultOptions;constructor(t){super(),t&&(this.defaultOptions.option=t)}}exports.TierModeOptionsPluginHost=s.TierModeOptionsPluginHost;exports.TierOptionsPluginHost=s.TierOptionsPluginHost;exports.commonModeName=s.commonModeName;exports.createTierModeOptionsPluginHost=s.createTierModeOptionsPluginHost;exports.createTierOptionsPluginHost=s.createTierOptionsPluginHost;exports.PluginHostEventEmitter=o;exports.TierModeOptionsPluginHostEventEmitter=l;exports.TierOptionsPluginHostEventEmitter=p;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./Destroyable-mrBsNabq-IFFuYfKS.cjs"),u=require("com-tools"),a=require("node:events"),s=require("./createTierModeOptionsPluginHost-B8wx-Fm2.cjs");var d=class extends a.EventEmitter{refCount=0;get isDestroyed(){return this._isDestroyed}_isDestroyed=!1;get canDestroy(){return!this.isDestroyed&&this.refCount<=0}_destroyers=[];disposeFun(e){return this._destroyers.push(e),e}cancelDisposeFun(e){let t=this._destroyers.indexOf(e);return this._destroyers.splice(t,1),e}disposeObj(e,t){let i=t?function(){return e.destroySync()}:function(){return e.destroy()};return this.disposeFun(i),e.__destroyable_destroyer=i,e}cancelDisposeObj(e){let t=e.__destroyable_destroyer;return t&&this.cancelDisposeFun(t),e}dispose(e,t){return typeof e=="function"?this.disposeFun(e):this.disposeObj(e,t)}cancelDispose(e){return typeof e=="function"?this.cancelDisposeFun(e):this.cancelDisposeObj(e)}destroyThis(){}destroySync(){if(!this.canDestroy)return this.isDestroyed;let e=this._destroyers.length;for(;--e>=0;){let t=this._destroyers[e];try{t()}catch(i){console.error("销毁函数在同步销毁时出错",this,t,i)}}this._destroyers.length=0;try{this.destroyThis()}catch(t){console.error("destroyThis 在异步销毁时出错",this,t)}return n.a(this),!0}destroy(){if(!this.canDestroy)return this.isDestroyed;let e=this._destroyers.toReversed();e.push(this.destroyThis),this._destroyers.length=0;let t=u.serialCallAllFuns(e,this,null,(i,r)=>{console.error("销毁函数在串行销毁时出错",this,r,i)});return t instanceof Promise?t.then(()=>(n.a(this),!0)):(n.a(this),!0)}};class o extends d{static isolatedPluginManager=!1;static get pluginManager(){return this.isolatedPluginManager&&!this.hasOwnProperty("_pluginManager")&&(this._pluginManager=new s.PluginExtendManager(this,this._pluginManager)),this._pluginManager}static _pluginManager=new s.PluginExtendManager(this);get pluginManager(){return this.constructor.pluginManager}static usePlugin(t,...i){return this.pluginManager.usePlugin(t,...i)}static useExtend(t){return this.pluginManager.useExtend(t)}static hasUsed(t){return this.pluginManager.hasUsed(t)}usePlugin(t,...i){return this.pluginManager.instUsePlugin(this,t,...i)}useExtend(t,...i){return this.pluginManager.instUseExtend(this,t,...i)}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 l extends o{static isolatedOptions=!1;static get modeOptions(){return this.isolatedOptions&&!this.hasOwnProperty("_modeOptions")&&(this._modeOptions=new s.TierModeOptions(s.commonModeName,null,this._modeOptions)),this._modeOptions}static _modeOptions=new s.TierModeOptions(s.commonModeName);get modeOptions(){return this._modeOptions||(this._modeOptions=new s.TierModeOptions(s.commonModeName,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(),t&&this.modeOptions.setOption(t)}}class p extends o{static isolatedOptions=!1;static get defaultOptions(){return this.isolatedOptions&&!this.hasOwnProperty("_defaultOptions")&&(this._defaultOptions=new s.TierOptions(void 0,this._defaultOptions)),this._defaultOptions}static _defaultOptions=new s.TierOptions;get defaultOptions(){return this._defaultOptions||(this._defaultOptions=new s.TierOptions(void 0,this.constructor.defaultOptions))}_defaultOptions;constructor(t){super(),t&&(this.defaultOptions.option=t)}}exports.TierModeOptionsPluginHost=s.TierModeOptionsPluginHost;exports.TierOptionsPluginHost=s.TierOptionsPluginHost;exports.commonModeName=s.commonModeName;exports.createTierModeOptionsPluginHost=s.createTierModeOptionsPluginHost;exports.createTierOptionsPluginHost=s.createTierOptionsPluginHost;exports.PluginHostEventEmitter=o;exports.TierModeOptionsPluginHostEventEmitter=l;exports.TierOptionsPluginHostEventEmitter=p;
@@ -1,8 +1,8 @@
1
1
  import { a as i } from "./Destroyable-mrBsNabq-D6TYs3Zn.js";
2
2
  import { serialCallAllFuns as l } from "com-tools";
3
3
  import { EventEmitter as h } from "node:events";
4
- import { P as a, T as n, c as r, d as o } from "./createTierModeOptionsPluginHost-BSmyPyZ6.js";
5
- import { f as P, g as D, p as T, q as E } from "./createTierModeOptionsPluginHost-BSmyPyZ6.js";
4
+ import { P as a, T as n, c as r, d as o } from "./createTierModeOptionsPluginHost-Ctr7S9XZ.js";
5
+ import { f as P, g as D, p as T, q as E } from "./createTierModeOptionsPluginHost-Ctr7S9XZ.js";
6
6
  var p = class extends h {
7
7
  refCount = 0;
8
8
  get isDestroyed() {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./Destroyable-mrBsNabq-IFFuYfKS.cjs"),p=require("com-tools"),i=require("./createTierModeOptionsPluginHost-CmgnR5Ur.cjs");if(!globalThis.CustomEvent){class e extends Event{detail;constructor(s,n){super(s,n),this.detail=n?.detail}}globalThis.CustomEvent=e}class h extends EventTarget{addEventListener(t,s,n){const o=n?.times;if(o){const r=typeof s=="function"?s:s?.handleEvent;if(r)return this.multipleListen(t,r,o)}return super.addEventListener(t,s,n),()=>{this.removeEventListener(t,s,n)}}dispatchEvent(t,s){const n=t instanceof Event?t:new CustomEvent(t,{detail:s,bubbles:!1,cancelable:!0,composed:!1});return super.dispatchEvent(n)}onceListen(t,s,n){return this.addEventListener(t,s,{...n,once:!0})}multipleListen(t,s,n){let o=0;const r=new AbortController,l=r.signal;return super.addEventListener(t,d=>{++o>=n&&r.abort(),s.call(this,d)},{signal:l}),function(){r.abort()}}}var c=class extends h{refCount=0;get isDestroyed(){return this._isDestroyed}_isDestroyed=!1;get canDestroy(){return!this.isDestroyed&&this.refCount<=0}_destroyers=[];disposeFun(e){return this._destroyers.push(e),e}cancelDisposeFun(e){let t=this._destroyers.indexOf(e);return this._destroyers.splice(t,1),e}disposeObj(e,t){let s=t?function(){return e.destroySync()}:function(){return e.destroy()};return this.disposeFun(s),e.__destroyable_destroyer=s,e}cancelDisposeObj(e){let t=e.__destroyable_destroyer;return t&&this.cancelDisposeFun(t),e}dispose(e,t){return typeof e=="function"?this.disposeFun(e):this.disposeObj(e,t)}cancelDispose(e){return typeof e=="function"?this.cancelDisposeFun(e):this.cancelDisposeObj(e)}destroyThis(){}destroySync(){if(!this.canDestroy)return this.isDestroyed;let e=this._destroyers.length;for(;--e>=0;){let t=this._destroyers[e];try{t()}catch(s){console.error("销毁函数在同步销毁时出错",this,t,s)}}this._destroyers.length=0;try{this.destroyThis()}catch(t){console.error("destroyThis 在异步销毁时出错",this,t)}return a.a(this),!0}destroy(){if(!this.canDestroy)return this.isDestroyed;let e=this._destroyers.toReversed();e.push(this.destroyThis),this._destroyers.length=0;let t=p.serialCallAllFuns(e,this,null,(s,n)=>{console.error("销毁函数在串行销毁时出错",this,n,s)});return t instanceof Promise?t.then(()=>(a.a(this),!0)):(a.a(this),!0)}};class u extends c{static isolatedPluginManager=!1;static get pluginManager(){return this.isolatedPluginManager&&!this.hasOwnProperty("_pluginManager")&&(this._pluginManager=new i.PluginExtendManager(this,this._pluginManager)),this._pluginManager}static _pluginManager=new i.PluginExtendManager(this);get pluginManager(){return this.constructor.pluginManager}static usePlugin(t,...s){return this.pluginManager.usePlugin(t,...s)}static useExtend(t){return this.pluginManager.useExtend(t)}static hasUsed(t){return this.pluginManager.hasUsed(t)}usePlugin(t,...s){return this.pluginManager.instUsePlugin(this,t,...s)}useExtend(t,...s){return this.pluginManager.instUseExtend(this,t,...s)}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 g extends u{static isolatedOptions=!1;static get modeOptions(){return this.isolatedOptions&&!this.hasOwnProperty("_modeOptions")&&(this._modeOptions=new i.TierModeOptions(i.commonModeName,null,this._modeOptions)),this._modeOptions}static _modeOptions=new i.TierModeOptions(i.commonModeName);get modeOptions(){return this._modeOptions||(this._modeOptions=new i.TierModeOptions(i.commonModeName,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(),t&&this.modeOptions.setOption(t)}}class O extends u{static isolatedOptions=!1;static get defaultOptions(){return this.isolatedOptions&&!this.hasOwnProperty("_defaultOptions")&&(this._defaultOptions=new i.TierOptions(void 0,this._defaultOptions)),this._defaultOptions}static _defaultOptions=new i.TierOptions;get defaultOptions(){return this._defaultOptions||(this._defaultOptions=new i.TierOptions(void 0,this.constructor.defaultOptions))}_defaultOptions;constructor(t){super(),t&&(this.defaultOptions.option=t)}}exports.TierModeOptionsPluginHost=i.TierModeOptionsPluginHost;exports.TierOptionsPluginHost=i.TierOptionsPluginHost;exports.commonModeName=i.commonModeName;exports.createTierModeOptionsPluginHost=i.createTierModeOptionsPluginHost;exports.createTierOptionsPluginHost=i.createTierOptionsPluginHost;exports.PluginHostEventTarget=u;exports.TierModeOptionsPluginHostEventTarget=g;exports.TierOptionsPluginHostEventTarget=O;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./Destroyable-mrBsNabq-IFFuYfKS.cjs"),p=require("com-tools"),i=require("./createTierModeOptionsPluginHost-B8wx-Fm2.cjs");if(!globalThis.CustomEvent){class e extends Event{detail;constructor(s,n){super(s,n),this.detail=n?.detail}}globalThis.CustomEvent=e}class h extends EventTarget{addEventListener(t,s,n){const o=n?.times;if(o){const r=typeof s=="function"?s:s?.handleEvent;if(r)return this.multipleListen(t,r,o)}return super.addEventListener(t,s,n),()=>{this.removeEventListener(t,s,n)}}dispatchEvent(t,s){const n=t instanceof Event?t:new CustomEvent(t,{detail:s,bubbles:!1,cancelable:!0,composed:!1});return super.dispatchEvent(n)}onceListen(t,s,n){return this.addEventListener(t,s,{...n,once:!0})}multipleListen(t,s,n){let o=0;const r=new AbortController,l=r.signal;return super.addEventListener(t,d=>{++o>=n&&r.abort(),s.call(this,d)},{signal:l}),function(){r.abort()}}}var c=class extends h{refCount=0;get isDestroyed(){return this._isDestroyed}_isDestroyed=!1;get canDestroy(){return!this.isDestroyed&&this.refCount<=0}_destroyers=[];disposeFun(e){return this._destroyers.push(e),e}cancelDisposeFun(e){let t=this._destroyers.indexOf(e);return this._destroyers.splice(t,1),e}disposeObj(e,t){let s=t?function(){return e.destroySync()}:function(){return e.destroy()};return this.disposeFun(s),e.__destroyable_destroyer=s,e}cancelDisposeObj(e){let t=e.__destroyable_destroyer;return t&&this.cancelDisposeFun(t),e}dispose(e,t){return typeof e=="function"?this.disposeFun(e):this.disposeObj(e,t)}cancelDispose(e){return typeof e=="function"?this.cancelDisposeFun(e):this.cancelDisposeObj(e)}destroyThis(){}destroySync(){if(!this.canDestroy)return this.isDestroyed;let e=this._destroyers.length;for(;--e>=0;){let t=this._destroyers[e];try{t()}catch(s){console.error("销毁函数在同步销毁时出错",this,t,s)}}this._destroyers.length=0;try{this.destroyThis()}catch(t){console.error("destroyThis 在异步销毁时出错",this,t)}return a.a(this),!0}destroy(){if(!this.canDestroy)return this.isDestroyed;let e=this._destroyers.toReversed();e.push(this.destroyThis),this._destroyers.length=0;let t=p.serialCallAllFuns(e,this,null,(s,n)=>{console.error("销毁函数在串行销毁时出错",this,n,s)});return t instanceof Promise?t.then(()=>(a.a(this),!0)):(a.a(this),!0)}};class u extends c{static isolatedPluginManager=!1;static get pluginManager(){return this.isolatedPluginManager&&!this.hasOwnProperty("_pluginManager")&&(this._pluginManager=new i.PluginExtendManager(this,this._pluginManager)),this._pluginManager}static _pluginManager=new i.PluginExtendManager(this);get pluginManager(){return this.constructor.pluginManager}static usePlugin(t,...s){return this.pluginManager.usePlugin(t,...s)}static useExtend(t){return this.pluginManager.useExtend(t)}static hasUsed(t){return this.pluginManager.hasUsed(t)}usePlugin(t,...s){return this.pluginManager.instUsePlugin(this,t,...s)}useExtend(t,...s){return this.pluginManager.instUseExtend(this,t,...s)}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 g extends u{static isolatedOptions=!1;static get modeOptions(){return this.isolatedOptions&&!this.hasOwnProperty("_modeOptions")&&(this._modeOptions=new i.TierModeOptions(i.commonModeName,null,this._modeOptions)),this._modeOptions}static _modeOptions=new i.TierModeOptions(i.commonModeName);get modeOptions(){return this._modeOptions||(this._modeOptions=new i.TierModeOptions(i.commonModeName,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(),t&&this.modeOptions.setOption(t)}}class O extends u{static isolatedOptions=!1;static get defaultOptions(){return this.isolatedOptions&&!this.hasOwnProperty("_defaultOptions")&&(this._defaultOptions=new i.TierOptions(void 0,this._defaultOptions)),this._defaultOptions}static _defaultOptions=new i.TierOptions;get defaultOptions(){return this._defaultOptions||(this._defaultOptions=new i.TierOptions(void 0,this.constructor.defaultOptions))}_defaultOptions;constructor(t){super(),t&&(this.defaultOptions.option=t)}}exports.TierModeOptionsPluginHost=i.TierModeOptionsPluginHost;exports.TierOptionsPluginHost=i.TierOptionsPluginHost;exports.commonModeName=i.commonModeName;exports.createTierModeOptionsPluginHost=i.createTierModeOptionsPluginHost;exports.createTierOptionsPluginHost=i.createTierOptionsPluginHost;exports.PluginHostEventTarget=u;exports.TierModeOptionsPluginHostEventTarget=g;exports.TierOptionsPluginHostEventTarget=O;
package/dist/index-web.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { a as o } from "./Destroyable-mrBsNabq-D6TYs3Zn.js";
2
2
  import { serialCallAllFuns as g } from "com-tools";
3
- import { P as d, T as a, c as u, d as l } from "./createTierModeOptionsPluginHost-BSmyPyZ6.js";
4
- import { f as P, g as D, p as b, q as x } from "./createTierModeOptionsPluginHost-BSmyPyZ6.js";
3
+ import { P as d, T as a, c as u, d as l } from "./createTierModeOptionsPluginHost-Ctr7S9XZ.js";
4
+ import { f as P, g as D, p as b, q as x } from "./createTierModeOptionsPluginHost-Ctr7S9XZ.js";
5
5
  if (!globalThis.CustomEvent) {
6
6
  class e extends Event {
7
7
  detail;
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("@gby/destroyable"),p=require("com-tools"),n=require("./createTierModeOptionsPluginHost-CmgnR5Ur.cjs"),l=require("type-tls");function m(s,e){return e}function x(s){return function(t){return t}}function M(s,e){return n.mixin(s.prototype,e),e}function P(s){return function(t){return n.mixin(s.prototype,t),t}}function y(s,e){return n.mixin(s.prototype,e),s}function T(s){return function(t){return n.mixin(s.prototype,t),s}}class E extends h.Destroyable{parent;host;plugins=new Map;constructor(e,t){super(),this.parent=t,e&&(this.host=e)}destroyThis(){return this.plugins.clear(),this.host=null,super.destroyThis()}hasUsed(e){return this.parent?.hasUsed(e)||this.plugins.has(e)}getUseReturn(e){const{parent:t}=this;return t?.hasUsed(e)?t.getUseReturn(e):this.plugins.get(e)}use(e,...t){if(this.hasUsed(e))return this.getUseReturn(e);const i=e.onUse(this.host,...t);return this.plugins.set(e,i),i}instUse(e,t,...i){const{plugins:r}=this;if(this.hasUsed(t))return this.getUseReturn(t);const o=this.use(t,...i);return t.onCreate?.(e),o}onCreate(e,...t){const i=this.parent?.onCreate(e,...t),r=[];for(const[o]of this.plugins)o.onCreate&&r.push(o.onCreate.bind(o));return l.waitAsyncable(i,()=>p.serialCallFuns(r,void 0,[e,...t]))}onInit(e,...t){const i=this.parent?.onInit(e,...t),r=[];for(const[o]of this.plugins)o.onInit&&r.push(o.onInit.bind(o));return l.waitAsyncable(i,()=>p.serialCallFuns(r,void 0,[e,...t]))}onDestroy(e){const t=[];for(const[o]of this.plugins)o.onDestroy&&t.push(o.onDestroy.bind(o));t.reverse();const i=p.serialCallFuns(t,void 0,[e]),{parent:r}=this;return r?l.waitAsyncable(i,()=>r.onDestroy(e)):i}}class _ extends h.Destroyable{parent;host;plugins=new Set;constructor(e,t){super(),this.parent=t,e&&(this.host=e)}destroyThis(){return this.plugins.clear(),this.host=null,super.destroyThis()}hasUsed(e){return this.parent?.hasUsed(e)||this.plugins.has(e)}use(e){return this.hasUsed(e)||(n.mixinIExtend(this.host.prototype,e),this.plugins.add(e)),e}instUse(e,t,...i){return this.hasUsed(t)||(this.use(t),t.onCreate?.call(e,e,...i)),t}onCreate(e,...t){const i=this.parent?.onCreate(e,...t),r=[];for(const o of this.plugins)o.onCreate&&r.push(o.onCreate);return l.waitAsyncable(i,()=>p.serialCallFuns(r,e,[e,...t]))}onInit(e,...t){const i=this.parent?.onInit(e,...t),r=[];for(const o of this.plugins)o.onInit&&r.push(o.onInit);return l.waitAsyncable(i,()=>p.serialCallFuns(r,e,[e,...t]))}onDestroy(e){const t=[];for(const o of this.plugins)o.onDestroy&&t.push(o.onDestroy);t.reverse();const i=p.serialCallFuns(t,e,[e]),{parent:r}=this;return r?l.waitAsyncable(i,()=>r.onDestroy(e)):i}}function c(s,e){const t=[{target:s,props:e}];let i;for(;i=t.shift();){const{target:r,props:o}=i;for(const[u,a]of Object.entries(o)){if(a!=null&&typeof a=="object"&&(!a.constructor||a.constructor===Object)){t.push({target:r[u],props:a});continue}r[u]=a}}return s}function f(s,e){const t={},i=[{target:s,props:e,targetProps:t}];let r;for(;r=i.shift();){const{target:o,props:u,targetProps:a}=r;for(const[g,d]of Object.entries(u)){if(d!=null&&typeof d=="object"&&(!d.constructor||d.constructor===Object)){i.push({target:o[g],props:d,targetProps:a[g]={}});continue}a[g]=o[g]}}return t}function w(s,e){const t=f(s,e);function i(){c(s,e)}function r(){c(s,t)}return{set:i,unset:r}}function b(s,e){const t=e??"defaultOptions",i=`_${t}`;return function(o){const u=n.mixinTarget(o,{get[t](){return s}});n.mixinTarget(u.prototype,{get[t](){return this[i]||(this[i]=structuredClone(u.defaultOptions))}})}}function U(s,e,t){const i=`_${e}`;return n.mixinTarget(s.prototype,{get[e](){return this[i]||(this[i]=structuredClone(s[e]))}}),t}function C(s,e,t){const i=n.mixinTarget(s,{isolatedOptions:!1,get modeOptions(){return this.isolatedOptions&&!this.hasOwnProperty("_modeOptions")&&(this._modeOptions=new n.TierModeOptions(e,null,this._modeOptions)),this._modeOptions},_modeOptions:new n.TierModeOptions(e,t)});return n.mixinTarget(i.prototype,{get modeOptions(){return this._modeOptions||(this._modeOptions=new n.TierModeOptions(e,void 0,this.constructor.modeOptions))},get mode(){return this.modeOptions.mode},set mode(r){this.modeOptions.mode=r},get options(){return this.modeOptions.fullOption}}),s}const D={onUse(s,e,t){const i=e??n.commonModeName;n.mixin(s,{isolatedOptions:!1,get modeOptions(){return this.isolatedOptions&&!this.hasOwnProperty("_modeOptions")&&(this._modeOptions=new n.TierModeOptions(i,null,this._modeOptions)),this._modeOptions},_modeOptions:new n.TierModeOptions(i,void 0,t)}),n.mixin(s.prototype,{get modeOptions(){const r=this,o=s;return r._modeOptions||(r._modeOptions=new n.TierModeOptions(o.modeOptions.mode,void 0,o.modeOptions))},get mode(){return this.modeOptions.mode},set mode(r){const o=this;o.modeOptions.mode=r},get options(){return this.modeOptions.plainFullOption}})},onCreate(s,e){e&&s.modeOptions.setOption(e)}},H={onUse(s,e,t){n.mixin(s,{isolatedOptions:!1,get defaultOptions(){return this.isolatedOptions&&!this.hasOwnProperty("_defaultOptions")&&(this._defaultOptions=new n.TierOptions(void 0,this._defaultOptions)),this._defaultOptions},_defaultOptions:new n.TierOptions(e,t)}),n.mixin(s.prototype,{get defaultOptions(){return this._defaultOptions||(this._defaultOptions=new n.TierOptions(void 0,s.defaultOptions))}})},onCreate(s,e){e&&(s.defaultOptions.option=e)}};function v(s,e,t){const i=n.mixinTarget(s,{isolatedOptions:!1,get defaultOptions(){return this.isolatedOptions&&!this.hasOwnProperty("_defaultOptions")&&(this._defaultOptions=new n.TierOptions(void 0,this._defaultOptions)),this._defaultOptions},_defaultOptions:new n.TierOptions(e,t)});return n.mixinTarget(i.prototype,{get defaultOptions(){return this._defaultOptions||(this._defaultOptions=new n.TierOptions(void 0,this.constructor.defaultOptions))}}),s}function O(s){const e=n.mixinTarget(s,{isolatedPluginManager:!1,get pluginManager(){return(!this._pluginManager||this.isolatedPluginManager&&!this.hasOwnProperty("_pluginManager"))&&(this._pluginManager=new n.PluginExtendManager(this,this._pluginManager)),this._pluginManager},usePlugin(t,...i){return this.pluginManager.usePlugin(t,...i)},useExtend(t){return this.pluginManager.useExtend(t)},hasUsed(t){return this.pluginManager.hasUsed(t)}});return n.mixinTarget(e.prototype,{get pluginManager(){return this.constructor.pluginManager},usePlugin(t,...i){return this.pluginManager.instUsePlugin(this,t,...i)},useExtend(t,...i){return this.pluginManager.instUseExtend(this,t,...i)},async init(...t){return super.init&&await super.init(...t),this.pluginManager.onInit(this,...t)},async destroy(){if(await this.pluginManager.onDestroy(this),super.destroy)return super.destroy()}}),s}function I(s){const e=O(s);return new Proxy(e,{construct:function(t,i,r){const o=new t(...i);return e.pluginManager.onCreate(this,...i),o}})}function j(s){return class extends s{static isolatedPluginManager=!1;static get pluginManager(){return this.isolatedPluginManager&&!this.hasOwnProperty("_pluginManager")&&(this._pluginManager=new n.PluginExtendManager(this,this._pluginManager)),this._pluginManager}static _pluginManager=new n.PluginExtendManager(this);get pluginManager(){return this.constructor.pluginManager}static usePlugin(t,...i){return this.pluginManager.usePlugin(t,...i)}static useExtend(t){return this.pluginManager.useExtend(t)}static hasUsed(t){return this.pluginManager.hasUsed(t)}constructor(...t){super(...t),this.pluginManager.onCreate(this,...t)}usePlugin(t,...i){return this.pluginManager.instUsePlugin(this,t,...i)}useExtend(t,...i){return this.pluginManager.instUseExtend(this,t,...i)}init(...t){if(super.init){const i=super.init(...t);if(i instanceof Promise)return i.then(()=>this.pluginManager.onInit(this,...t))}return this.pluginManager.onInit(this,...t)}destroy(){const t=this.pluginManager.onDestroy(this);return super.destroy?t instanceof Promise?t.finally(()=>super.destroy()):super.destroy():t}}}exports.ModeOptions=n.ModeOptions;exports.PluginExtendManager=n.PluginExtendManager;exports.PluginHost=n.PluginHost;exports.TierModeOptions=n.TierModeOptions;exports.TierModeOptionsPluginHost=n.TierModeOptionsPluginHost;exports.TierOptions=n.TierOptions;exports.TierOptionsPluginHost=n.TierOptionsPluginHost;exports.commonModeName=n.commonModeName;exports.createDefineIExtend=n.createDefineIExtend;exports.createDefineMixin=n.createDefineMixin;exports.createIExtendTarget=n.createIExtendTarget;exports.createMixinTarget=n.createMixinTarget;exports.createPluginHost=n.createPluginHost;exports.createTargetIExtend=n.createTargetIExtend;exports.createTargetMixin=n.createTargetMixin;exports.createTierModeOptionsPluginHost=n.createTierModeOptionsPluginHost;exports.createTierOptionsPluginHost=n.createTierOptionsPluginHost;exports.defineIExtend=n.defineIExtend;exports.defineMixin=n.defineMixin;exports.extendMark=n.extendMark;exports.getPropertyValue=n.getPropertyValue;exports.getPropertyValueByPath=n.getPropertyValueByPath;exports.iextendTarget=n.iextendTarget;exports.isPlugin=n.isPlugin;exports.mixin=n.mixin;exports.mixinByOmit=n.mixinByOmit;exports.mixinByPick=n.mixinByPick;exports.mixinIExtend=n.mixinIExtend;exports.mixinTarget=n.mixinTarget;exports.parsePropertyPath=n.parsePropertyPath;exports.pickHostExtendMembers=n.pickHostExtendMembers;exports.setPropertyValue=n.setPropertyValue;exports.setPropertyValueByPath=n.setPropertyValueByPath;exports.targetIExtend=n.targetIExtend;exports.targetMixin=n.targetMixin;exports.tierModeOptionsDecorator=n.tierModeOptionsDecorator;exports.tierOptionsDecorator=n.tierOptionsDecorator;exports.ExtendManager=_;exports.PluginManager=E;exports.addDefaultOptions=b;exports.addInstOptions=U;exports.becomePluginHost=O;exports.becomePluginHost_Extends=j;exports.becomePluginHost_Proxy=I;exports.becomeTierModeOptionsHost=C;exports.becomeTierOptionsHost=v;exports.createDefineExtend=x;exports.createExtendTarget=T;exports.createPropertySetter=w;exports.createTargetExtend=P;exports.defineExtend=m;exports.extendTarget=y;exports.getTargetProperties=f;exports.mergeProperties=c;exports.targetExtend=M;exports.tierModeOptionsPlugin=D;exports.tierOptionsPlugin=H;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("@gby/destroyable"),p=require("com-tools"),n=require("./createTierModeOptionsPluginHost-B8wx-Fm2.cjs"),d=require("type-tls");function m(s,e){return e}function x(s){return function(t){return t}}function M(s,e){return n.mixin(s.prototype,e),e}function P(s){return function(t){return n.mixin(s.prototype,t),t}}function y(s,e){return n.mixin(s.prototype,e),s}function T(s){return function(t){return n.mixin(s.prototype,t),s}}class E extends h.Destroyable{parent;host;plugins=new Map;constructor(e,t){super(),this.parent=t,e&&(this.host=e)}destroyThis(){return this.plugins.clear(),this.host=null,super.destroyThis()}hasUsed(e){return this.parent?.hasUsed(e)||this.plugins.has(e)}getUseReturn(e){const{parent:t}=this;return t?.hasUsed(e)?t.getUseReturn(e):this.plugins.get(e)}use(e,...t){if(this.hasUsed(e))return this.getUseReturn(e);const i=e.onUse(this.host,...t);return this.plugins.set(e,i),i}instUse(e,t,...i){const{plugins:r}=this;if(this.hasUsed(t))return this.getUseReturn(t);const o=this.use(t,...i);return t.onCreate?.(e),o}onCreate(e,...t){const i=this.parent?.onCreate(e,...t),r=[];for(const[o]of this.plugins)o.onCreate&&r.push(o.onCreate.bind(o));return d.waitAsyncable(i,()=>p.serialCallFuns(r,void 0,[e,...t]))}onInit(e,...t){const i=this.parent?.onInit(e,...t),r=[];for(const[o]of this.plugins)o.onInit&&r.push(o.onInit.bind(o));return d.waitAsyncable(i,()=>p.serialCallFuns(r,void 0,[e,...t]))}onDestroy(e){const t=[];for(const[o]of this.plugins)o.onDestroy&&t.push(o.onDestroy.bind(o));t.reverse();const i=p.serialCallFuns(t,void 0,[e]),{parent:r}=this;return r?d.waitAsyncable(i,()=>r.onDestroy(e)):i}}class _ extends h.Destroyable{parent;host;plugins=new Set;constructor(e,t){super(),this.parent=t,e&&(this.host=e)}destroyThis(){return this.plugins.clear(),this.host=null,super.destroyThis()}hasUsed(e){return this.parent?.hasUsed(e)||this.plugins.has(e)}use(e){return this.hasUsed(e)||(n.mixinIExtend(this.host.prototype,e),this.plugins.add(e)),e}instUse(e,t,...i){return this.hasUsed(t)||(this.use(t),t.onCreate?.call(e,e,...i)),t}onCreate(e,...t){const i=this.parent?.onCreate(e,...t),r=[];for(const o of this.plugins)o.onCreate&&r.push(o.onCreate);return d.waitAsyncable(i,()=>p.serialCallFuns(r,e,[e,...t]))}onInit(e,...t){const i=this.parent?.onInit(e,...t),r=[];for(const o of this.plugins)o.onInit&&r.push(o.onInit);return d.waitAsyncable(i,()=>p.serialCallFuns(r,e,[e,...t]))}onDestroy(e){const t=[];for(const o of this.plugins)o.onDestroy&&t.push(o.onDestroy);t.reverse();const i=p.serialCallFuns(t,e,[e]),{parent:r}=this;return r?d.waitAsyncable(i,()=>r.onDestroy(e)):i}}function c(s,e){const t=[{target:s,props:e}];let i;for(;i=t.shift();){const{target:r,props:o}=i;for(const[u,a]of Object.entries(o)){if(a!=null&&typeof a=="object"&&(!a.constructor||a.constructor===Object)){t.push({target:r[u],props:a});continue}r[u]=a}}return s}function f(s,e){const t={},i=[{target:s,props:e,targetProps:t}];let r;for(;r=i.shift();){const{target:o,props:u,targetProps:a}=r;for(const[g,l]of Object.entries(u)){if(l!=null&&typeof l=="object"&&(!l.constructor||l.constructor===Object)){i.push({target:o[g],props:l,targetProps:a[g]={}});continue}a[g]=o[g]}}return t}function w(s,e){const t=f(s,e);function i(){c(s,e)}function r(){c(s,t)}return{set:i,unset:r}}function b(s,e){const t=e??"defaultOptions",i=`_${t}`;return function(o){const u=n.mixinTarget(o,{get[t](){return s}});n.mixinTarget(u.prototype,{get[t](){return this[i]||(this[i]=structuredClone(u.defaultOptions))}})}}function U(s,e,t){const i=`_${e}`;return n.mixinTarget(s.prototype,{get[e](){return this[i]||(this[i]=structuredClone(s[e]))}}),t}function C(s,e,t){const i=n.mixinTarget(s,{isolatedOptions:!1,get modeOptions(){return this.isolatedOptions&&!this.hasOwnProperty("_modeOptions")&&(this._modeOptions=new n.TierModeOptions(e,null,this._modeOptions)),this._modeOptions},_modeOptions:new n.TierModeOptions(e,t)});return n.mixinTarget(i.prototype,{get modeOptions(){return this._modeOptions||(this._modeOptions=new n.TierModeOptions(e,void 0,this.constructor.modeOptions))},get mode(){return this.modeOptions.mode},set mode(r){this.modeOptions.mode=r},get options(){return this.modeOptions.fullOption}}),s}const D={onUse(s,e,t){const i=e??n.commonModeName;n.mixin(s,{isolatedOptions:!1,get modeOptions(){return this.isolatedOptions&&!this.hasOwnProperty("_modeOptions")&&(this._modeOptions=new n.TierModeOptions(i,null,this._modeOptions)),this._modeOptions},_modeOptions:new n.TierModeOptions(i,void 0,t)}),n.mixin(s.prototype,{get modeOptions(){const r=this,o=s;return r._modeOptions||(r._modeOptions=new n.TierModeOptions(o.modeOptions.mode,void 0,o.modeOptions))},get mode(){return this.modeOptions.mode},set mode(r){const o=this;o.modeOptions.mode=r},get options(){return this.modeOptions.plainFullOption}})},onCreate(s,e){e&&s.modeOptions.setOption(e)}},H={onUse(s,e,t){n.mixin(s,{isolatedOptions:!1,get defaultOptions(){return this.isolatedOptions&&!this.hasOwnProperty("_defaultOptions")&&(this._defaultOptions=new n.TierOptions(void 0,this._defaultOptions)),this._defaultOptions},_defaultOptions:new n.TierOptions(e,t)}),n.mixin(s.prototype,{get defaultOptions(){return this._defaultOptions||(this._defaultOptions=new n.TierOptions(void 0,s.defaultOptions))}})},onCreate(s,e){e&&(s.defaultOptions.option=e)}};function I(s,e,t){const i=n.mixinTarget(s,{isolatedOptions:!1,get defaultOptions(){return this.isolatedOptions&&!this.hasOwnProperty("_defaultOptions")&&(this._defaultOptions=new n.TierOptions(void 0,this._defaultOptions)),this._defaultOptions},_defaultOptions:new n.TierOptions(e,t)});return n.mixinTarget(i.prototype,{get defaultOptions(){return this._defaultOptions||(this._defaultOptions=new n.TierOptions(void 0,this.constructor.defaultOptions))}}),s}function O(s){const e=n.mixinTarget(s,{isolatedPluginManager:!1,get pluginManager(){return(!this._pluginManager||this.isolatedPluginManager&&!this.hasOwnProperty("_pluginManager"))&&(this._pluginManager=new n.PluginExtendManager(this,this._pluginManager)),this._pluginManager},usePlugin(t,...i){return this.pluginManager.usePlugin(t,...i)},useExtend(t){return this.pluginManager.useExtend(t)},hasUsed(t){return this.pluginManager.hasUsed(t)}});return n.mixinTarget(e.prototype,{get pluginManager(){return this.constructor.pluginManager},usePlugin(t,...i){return this.pluginManager.instUsePlugin(this,t,...i)},useExtend(t,...i){return this.pluginManager.instUseExtend(this,t,...i)},async init(...t){return super.init&&await super.init(...t),this.pluginManager.onInit(this,...t)},async destroy(){if(await this.pluginManager.onDestroy(this),super.destroy)return super.destroy()}}),s}function v(s){const e=O(s);return new Proxy(e,{construct:function(t,i,r){const o=new t(...i);return e.pluginManager.onCreate(this,...i),o}})}function j(s){return class extends s{static isolatedPluginManager=!1;static get pluginManager(){return this.isolatedPluginManager&&!this.hasOwnProperty("_pluginManager")&&(this._pluginManager=new n.PluginExtendManager(this,this._pluginManager)),this._pluginManager}static _pluginManager=new n.PluginExtendManager(this);get pluginManager(){return this.constructor.pluginManager}static usePlugin(t,...i){return this.pluginManager.usePlugin(t,...i)}static useExtend(t){return this.pluginManager.useExtend(t)}static hasUsed(t){return this.pluginManager.hasUsed(t)}constructor(...t){super(...t),this.pluginManager.onCreate(this,...t)}usePlugin(t,...i){return this.pluginManager.instUsePlugin(this,t,...i)}useExtend(t,...i){return this.pluginManager.instUseExtend(this,t,...i)}init(...t){if(super.init){const i=super.init(...t);if(i instanceof Promise)return i.then(()=>this.pluginManager.onInit(this,...t))}return this.pluginManager.onInit(this,...t)}destroy(){const t=this.pluginManager.onDestroy(this);return super.destroy?t instanceof Promise?t.finally(()=>super.destroy()):super.destroy():t}}}exports.ModeOptions=n.ModeOptions;exports.PluginExtendManager=n.PluginExtendManager;exports.PluginHost=n.PluginHost;exports.TierModeOptions=n.TierModeOptions;exports.TierModeOptionsPluginHost=n.TierModeOptionsPluginHost;exports.TierOptions=n.TierOptions;exports.TierOptionsPluginHost=n.TierOptionsPluginHost;exports.commonModeName=n.commonModeName;exports.createDefineIExtend=n.createDefineIExtend;exports.createDefineMixin=n.createDefineMixin;exports.createIExtendTarget=n.createIExtendTarget;exports.createMixinTarget=n.createMixinTarget;exports.createPluginHost=n.createPluginHost;exports.createTargetIExtend=n.createTargetIExtend;exports.createTargetMixin=n.createTargetMixin;exports.createTierModeOptionsPluginHost=n.createTierModeOptionsPluginHost;exports.createTierOptionsPluginHost=n.createTierOptionsPluginHost;exports.deepmerge=n.deepmerge;exports.deepmergeInto=n.deepmergeInto;exports.defineIExtend=n.defineIExtend;exports.defineMixin=n.defineMixin;exports.extendMark=n.extendMark;exports.getPropertyValue=n.getPropertyValue;exports.getPropertyValueByPath=n.getPropertyValueByPath;exports.iextendTarget=n.iextendTarget;exports.isPlugin=n.isPlugin;exports.mixin=n.mixin;exports.mixinByOmit=n.mixinByOmit;exports.mixinByPick=n.mixinByPick;exports.mixinIExtend=n.mixinIExtend;exports.mixinTarget=n.mixinTarget;exports.parsePropertyPath=n.parsePropertyPath;exports.pickHostExtendMembers=n.pickHostExtendMembers;exports.setPropertyValue=n.setPropertyValue;exports.setPropertyValueByPath=n.setPropertyValueByPath;exports.targetIExtend=n.targetIExtend;exports.targetMixin=n.targetMixin;exports.tierModeOptionsDecorator=n.tierModeOptionsDecorator;exports.tierOptionsDecorator=n.tierOptionsDecorator;exports.ExtendManager=_;exports.PluginManager=E;exports.addDefaultOptions=b;exports.addInstOptions=U;exports.becomePluginHost=O;exports.becomePluginHost_Extends=j;exports.becomePluginHost_Proxy=v;exports.becomeTierModeOptionsHost=C;exports.becomeTierOptionsHost=I;exports.createDefineExtend=x;exports.createExtendTarget=T;exports.createPropertySetter=w;exports.createTargetExtend=P;exports.defineExtend=m;exports.extendTarget=y;exports.getTargetProperties=f;exports.mergeProperties=c;exports.targetExtend=M;exports.tierModeOptionsPlugin=D;exports.tierOptionsPlugin=H;
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Destroyable as M } from "@gby/destroyable";
2
2
  import { serialCallFuns as d } from "com-tools";
3
- import { m as u, a as y, b as a, T as l, c as P, d as h, P as O } from "./createTierModeOptionsPluginHost-BSmyPyZ6.js";
4
- import { M as J, e as Q, f as X, g as Y, h as Z, i as L, j as K, k as tt, l as et, n as nt, o as st, p as it, q as rt, r as ot, s as at, t as ut, u as pt, v as dt, w as lt, x as ht, y as gt, z as ct, A as ft, B as Ot, C as mt, D as Mt, E as yt, F as Pt, G as xt, H as _t } from "./createTierModeOptionsPluginHost-BSmyPyZ6.js";
3
+ import { m as u, a as y, b as a, T as l, c as P, d as h, P as O } from "./createTierModeOptionsPluginHost-Ctr7S9XZ.js";
4
+ import { M as W, e as Q, f as X, g as Y, h as Z, i as L, j as K, k as tt, l as et, n as nt, o as st, p as it, q as rt, r as ot, s as at, t as ut, u as pt, v as dt, w as lt, x as ht, y as gt, z as ct, A as ft, B as Ot, C as mt, D as Mt, E as yt, F as Pt, G as xt, H as _t, I as wt, J as Tt } from "./createTierModeOptionsPluginHost-Ctr7S9XZ.js";
5
5
  import { waitAsyncable as g } from "type-tls";
6
6
  function C(s, e) {
7
7
  return e;
@@ -22,12 +22,12 @@ function v(s) {
22
22
  function H(s, e) {
23
23
  return u(s.prototype, e), s;
24
24
  }
25
- function j(s) {
25
+ function I(s) {
26
26
  return function(t) {
27
27
  return u(s.prototype, t), s;
28
28
  };
29
29
  }
30
- class I extends M {
30
+ class j extends M {
31
31
  /**
32
32
  * 父级插件管理者
33
33
  *
@@ -595,10 +595,10 @@ function z(s) {
595
595
  }
596
596
  export {
597
597
  R as ExtendManager,
598
- J as ModeOptions,
598
+ W as ModeOptions,
599
599
  O as PluginExtendManager,
600
600
  Q as PluginHost,
601
- I as PluginManager,
601
+ j as PluginManager,
602
602
  l as TierModeOptions,
603
603
  X as TierModeOptionsPluginHost,
604
604
  h as TierOptions,
@@ -614,7 +614,7 @@ export {
614
614
  b as createDefineExtend,
615
615
  Z as createDefineIExtend,
616
616
  L as createDefineMixin,
617
- j as createExtendTarget,
617
+ I as createExtendTarget,
618
618
  K as createIExtendTarget,
619
619
  tt as createMixinTarget,
620
620
  et as createPluginHost,
@@ -624,31 +624,33 @@ export {
624
624
  st as createTargetMixin,
625
625
  it as createTierModeOptionsPluginHost,
626
626
  rt as createTierOptionsPluginHost,
627
+ ot as deepmerge,
628
+ at as deepmergeInto,
627
629
  C as defineExtend,
628
- ot as defineIExtend,
629
- at as defineMixin,
630
- ut as extendMark,
630
+ ut as defineIExtend,
631
+ pt as defineMixin,
632
+ dt as extendMark,
631
633
  H as extendTarget,
632
- pt as getPropertyValue,
633
- dt as getPropertyValueByPath,
634
+ lt as getPropertyValue,
635
+ ht as getPropertyValueByPath,
634
636
  x as getTargetProperties,
635
- lt as iextendTarget,
636
- ht as isPlugin,
637
+ gt as iextendTarget,
638
+ ct as isPlugin,
637
639
  m as mergeProperties,
638
640
  u as mixin,
639
- gt as mixinByOmit,
640
- ct as mixinByPick,
641
+ ft as mixinByOmit,
642
+ Ot as mixinByPick,
641
643
  y as mixinIExtend,
642
644
  a as mixinTarget,
643
- ft as parsePropertyPath,
644
- Ot as pickHostExtendMembers,
645
- mt as setPropertyValue,
646
- Mt as setPropertyValueByPath,
645
+ mt as parsePropertyPath,
646
+ Mt as pickHostExtendMembers,
647
+ yt as setPropertyValue,
648
+ Pt as setPropertyValueByPath,
647
649
  D as targetExtend,
648
- yt as targetIExtend,
649
- Pt as targetMixin,
650
- xt as tierModeOptionsDecorator,
650
+ xt as targetIExtend,
651
+ _t as targetMixin,
652
+ wt as tierModeOptionsDecorator,
651
653
  q as tierModeOptionsPlugin,
652
- _t as tierOptionsDecorator,
654
+ Tt as tierOptionsDecorator,
653
655
  F as tierOptionsPlugin
654
656
  };
@@ -29,6 +29,42 @@ export declare const isUndefinedMap: {
29
29
  * 选项管理器
30
30
  */
31
31
  export declare abstract class OptionsManager<Option extends {} = any> {
32
+ /**
33
+ * 深度合并到目标对象
34
+ */
35
+ static deepmergeInto: <Target extends object, Ts extends readonly unknown[]>(target: Target, ...objects: Ts) => void;
36
+ /**
37
+ * 深度合并
38
+ */
39
+ static deepmerge: <Ts extends readonly unknown[]>(...objects: Ts) => import("deepmerge-ts").DeepMergeHKT<Ts, Readonly<{
40
+ DeepMergeRecordsURI: "DeepMergeRecordsDefaultURI";
41
+ DeepMergeArraysURI: "DeepMergeArraysDefaultURI";
42
+ DeepMergeSetsURI: "DeepMergeSetsDefaultURI";
43
+ DeepMergeMapsURI: "DeepMergeMapsDefaultURI";
44
+ DeepMergeOthersURI: "DeepMergeLeafURI";
45
+ DeepMergeFilterValuesURI: "DeepMergeFilterValuesDefaultURI";
46
+ }>, Readonly<{
47
+ key: PropertyKey;
48
+ parents: ReadonlyArray<Readonly<Record<PropertyKey, unknown>>>;
49
+ }>>;
50
+ /**
51
+ * 深度合并到目标对象
52
+ */
53
+ get deepmergeInto(): <Target extends object, Ts extends readonly unknown[]>(target: Target, ...objects: Ts) => void;
54
+ /**
55
+ * 深度合并
56
+ */
57
+ get deepmerge(): <Ts extends readonly unknown[]>(...objects: Ts) => import("deepmerge-ts").DeepMergeHKT<Ts, Readonly<{
58
+ DeepMergeRecordsURI: "DeepMergeRecordsDefaultURI";
59
+ DeepMergeArraysURI: "DeepMergeArraysDefaultURI";
60
+ DeepMergeSetsURI: "DeepMergeSetsDefaultURI";
61
+ DeepMergeMapsURI: "DeepMergeMapsDefaultURI";
62
+ DeepMergeOthersURI: "DeepMergeLeafURI";
63
+ DeepMergeFilterValuesURI: "DeepMergeFilterValuesDefaultURI";
64
+ }>, Readonly<{
65
+ key: PropertyKey;
66
+ parents: ReadonlyArray<Readonly<Record<PropertyKey, unknown>>>;
67
+ }>>;
32
68
  /**
33
69
  * 选项
34
70
  */
@@ -63,7 +99,7 @@ export declare abstract class OptionsManager<Option extends {} = any> {
63
99
  * @param option
64
100
  * @param deep - 是否要进行深度合并
65
101
  */
66
- setOption(option: Option, deep?: boolean): void | Option;
102
+ setOption(option: Partial<Option>, deep?: boolean): void | (Option & Partial<Option>);
67
103
  /**
68
104
  * 未定义值的类型
69
105
  */
@@ -1 +1 @@
1
- {"version":3,"file":"OptionsManager.d.ts","sourceRoot":"","sources":["../../../src/options/options-manager/OptionsManager.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,oBAAY,oBAAoB;IAC5B;;OAEG;IACH,gBAAgB,qBAAqB;IACrC;;OAEG;IACH,SAAS,cAAc;IACvB;;OAEG;IACH,IAAI,SAAS;CAEhB;AAED;;GAEG;AACH,eAAO,MAAM,cAAc;8BACuB,GAAG;uBAGV,GAAG;kBAGR,GAAG;CAGxC,CAAA;AAID;;GAEG;AACH,8BAAsB,cAAc,CAAC,MAAM,SAAS,EAAE,GAAG,GAAG;IAGxD;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB;;;;OAIG;IACH,YAAY,UAAQ;IAEpB;;;;;OAKG;IACH,UAAU,EAiCO,MAAM,CAAC;IAGxB;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IAE1C;;OAEG;IACH,QAAQ,CAAC,gBAAgB,IAAI,IAAI;IAEjC;;;;;;OAMG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO;IAQxC;;OAEG;IACH,IAAI,cAAc,yBAEjB;IACD,IAAI,cAAc,CAAC,KAAK,sBAAA,EAGvB;IAED,SAAS,CAAC,eAAe,uBAAyC;IAElE;;OAEG;IACH,WAAW,UApHmC,GAAG,aAoHH;IAG9C;;;;OAIG;IACH,SAAS,CAAC,GAAG,SAAS,MAAM,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,GAAG,IAAI;IAI7E;;;;;OAKG;IACH,SAAS,CAAC,GAAG,SAAS,MAAM,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,EAAE,IAAI,CAAC,EAAE,OAAO;IAiBxF;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,GAAG;IAIjC;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,OAAO;CAW1D"}
1
+ {"version":3,"file":"OptionsManager.d.ts","sourceRoot":"","sources":["../../../src/options/options-manager/OptionsManager.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,oBAAY,oBAAoB;IAC5B;;OAEG;IACH,gBAAgB,qBAAqB;IACrC;;OAEG;IACH,SAAS,cAAc;IACvB;;OAEG;IACH,IAAI,SAAS;CAEhB;AAED;;GAEG;AACH,eAAO,MAAM,cAAc;8BACuB,GAAG;uBAGV,GAAG;kBAGR,GAAG;CAGxC,CAAA;AAID;;GAEG;AACH,8BAAsB,cAAc,CAAC,MAAM,SAAS,EAAE,GAAG,GAAG;IAExD;;OAEG;IACH,MAAM,CAAE,aAAa,iGAAiB;IACtC;;OAEG;IACH,MAAM,CAAE,SAAS;;;;;;;;;;QAAa;IAG9B;;OAEG;IACH,IAAI,aAAa,mGAEhB;IACD;;OAEG;IACH,IAAI,SAAS;;;;;;;;;;QAEZ;IAED;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB;;;;OAIG;IACH,YAAY,UAAQ;IAEpB;;;;;OAKG;IACH,UAAU,EAiCO,MAAM,CAAC;IAGxB;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IAE1C;;OAEG;IACH,QAAQ,CAAC,gBAAgB,IAAI,IAAI;IAEjC;;;;;;OAMG;IACH,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,EAAE,OAAO;IAQjD;;OAEG;IACH,IAAI,cAAc,yBAEjB;IACD,IAAI,cAAc,CAAC,KAAK,sBAAA,EAGvB;IAED,SAAS,CAAC,eAAe,uBAAyC;IAElE;;OAEG;IACH,WAAW,UA1ImC,GAAG,aA0IH;IAG9C;;;;OAIG;IACH,SAAS,CAAC,GAAG,SAAS,MAAM,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,GAAG,IAAI;IAI7E;;;;;OAKG;IACH,SAAS,CAAC,GAAG,SAAS,MAAM,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,EAAE,IAAI,CAAC,EAAE,OAAO;IAiBxF;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,GAAG;IAIjC;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,OAAO;CAW1D"}
@@ -1 +1 @@
1
- {"version":3,"file":"TierModeOptions.d.ts","sourceRoot":"","sources":["../../../src/options/options-manager/TierModeOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,eAAe,CAAA;AAI9C;;;;GAIG;AACH,qBAAa,eAAe,CAAC,IAAI,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,MAAM,SAAS,EAAE,GAAG,GAAG,CAAE,SAAQ,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC;gBAE9G,IAAI,EAAE,IAAI;gBACV,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,MAAM,GAAC,IAAI,EAAC,MAAM,CAAC,EAAC,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,GAAC,IAAI;IAQxF;;OAEG;IACH,IAAI,OAAO,yCAEV;IACD,IAAI,OAAO,CAAC,KAAK,sCAAA,EAGhB;IACD,SAAS,CAAC,QAAQ,EAAC,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,GAAC,IAAI,CAAQ;IAG7D;;;;;;OAMG;IACM,iBAAiB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAC,IAAI;IAanD;;;OAGG;IACM,YAAY,IAAG,IAAI,EAAE;IAU9B;;;;OAIG;IACH,aAAa,CAAC,IAAI,EAAC,MAAM,GAAG,MAAM,GAAE,OAAO;IAM3C;;OAEG;IACH,IAAa,aAAa,IAAG,WAAW,CAAC,MAAM,CAAC,CAE/C;IACD;;;;OAIG;IACH,oBAAoB,CAAC,IAAI,EAAC,IAAI,GAAE,WAAW,CAAC,MAAM,CAAC,GAAC,IAAI;IAQxD;;;;OAIG;IACM,SAAS,CAAC,GAAG,SAAS,MAAM,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,GAAG,IAAI;IAWtF;;;;OAIG;IACM,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,GAAG;CAW7C;AAMD;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAC,KAAK,EAC/C,KAAK,EAAE,4BAA4B,CAAC,IAAI,EAAC,KAAK,CAAC,EAC/C,OAAO,EAAC,6BAA6B,CAAC,IAAI,EAAC,KAAK,CAAC,GACjD,4BAA4B,CAAC,IAAI,EAAC,KAAK,CAAC,CAS3C"}
1
+ {"version":3,"file":"TierModeOptions.d.ts","sourceRoot":"","sources":["../../../src/options/options-manager/TierModeOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,eAAe,CAAA;AAG9C;;;;GAIG;AACH,qBAAa,eAAe,CAAC,IAAI,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,MAAM,SAAS,EAAE,GAAG,GAAG,CAAE,SAAQ,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC;gBAE9G,IAAI,EAAE,IAAI;gBACV,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,MAAM,GAAC,IAAI,EAAC,MAAM,CAAC,EAAC,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,GAAC,IAAI;IAQxF;;OAEG;IACH,IAAI,OAAO,yCAEV;IACD,IAAI,OAAO,CAAC,KAAK,sCAAA,EAGhB;IACD,SAAS,CAAC,QAAQ,EAAC,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,GAAC,IAAI,CAAQ;IAG7D;;;;;;OAMG;IACM,iBAAiB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAC,IAAI;IAanD;;;OAGG;IACM,YAAY,IAAG,IAAI,EAAE;IAU9B;;;;OAIG;IACH,aAAa,CAAC,IAAI,EAAC,MAAM,GAAG,MAAM,GAAE,OAAO;IAM3C;;OAEG;IACH,IAAa,aAAa,IAAG,WAAW,CAAC,MAAM,CAAC,CAE/C;IACD;;;;OAIG;IACH,oBAAoB,CAAC,IAAI,EAAC,IAAI,GAAE,WAAW,CAAC,MAAM,CAAC,GAAC,IAAI;IAQxD;;;;OAIG;IACM,SAAS,CAAC,GAAG,SAAS,MAAM,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,GAAG,IAAI;IAWtF;;;;OAIG;IACM,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,GAAG;CAW7C;AAMD;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAC,KAAK,EAC/C,KAAK,EAAE,4BAA4B,CAAC,IAAI,EAAC,KAAK,CAAC,EAC/C,OAAO,EAAC,6BAA6B,CAAC,IAAI,EAAC,KAAK,CAAC,GACjD,4BAA4B,CAAC,IAAI,EAAC,KAAK,CAAC,CAS3C"}
@@ -1,3 +1,25 @@
1
+ /**
2
+ * 深度合并到目标对象
3
+ * @remarks
4
+ * 数组不合并,直接替换
5
+ */
6
+ export declare const deepmergeInto: <Target extends object, Ts extends readonly unknown[]>(target: Target, ...objects: Ts) => void;
7
+ /**
8
+ * 深度合并
9
+ * @remarks
10
+ * 数组不合并,直接替换
11
+ */
12
+ export declare const deepmerge: <Ts extends readonly unknown[]>(...objects: Ts) => import("deepmerge-ts").DeepMergeHKT<Ts, Readonly<{
13
+ DeepMergeRecordsURI: "DeepMergeRecordsDefaultURI";
14
+ DeepMergeArraysURI: "DeepMergeArraysDefaultURI";
15
+ DeepMergeSetsURI: "DeepMergeSetsDefaultURI";
16
+ DeepMergeMapsURI: "DeepMergeMapsDefaultURI";
17
+ DeepMergeOthersURI: "DeepMergeLeafURI";
18
+ DeepMergeFilterValuesURI: "DeepMergeFilterValuesDefaultURI";
19
+ }>, Readonly<{
20
+ key: PropertyKey;
21
+ parents: ReadonlyArray<Readonly<Record<PropertyKey, unknown>>>;
22
+ }>>;
1
23
  /**
2
24
  * 解析属性路径为属性列表
3
25
  * @param propPath
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/options/options-manager/tools.ts"],"names":[],"mappings":"AACA;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAC,MAAM,YAMhD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAC,KAAK,EAAC,MAAM,EAAE,OAMvD;AAGD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,GAAG,EAAC,QAAQ,EAAC,MAAM,OAE9D;AAKD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAC,KAAK,EAAC,MAAM,EAAE,EAAC,KAAK,EAAC,GAAG,OAoBjE;AAMD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,GAAG,EAAC,QAAQ,EAAC,MAAM,EAAC,KAAK,EAAC,GAAG,OAExE"}
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/options/options-manager/tools.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,aAAa,gGAA+D,CAAC;AAI1F;;;;GAIG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;GAA4D,CAAC;AAKnF;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAC,MAAM,YAMhD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAC,KAAK,EAAC,MAAM,EAAE,OAMvD;AAGD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,GAAG,EAAC,QAAQ,EAAC,MAAM,OAE9D;AAKD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAC,KAAK,EAAC,MAAM,EAAE,EAAC,KAAK,EAAC,GAAG,OAoBjE;AAMD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,GAAG,EAAC,QAAQ,EAAC,MAAM,EAAC,KAAK,EAAC,GAAG,OAExE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plugin-tls",
3
- "version": "5.4.0",
3
+ "version": "5.5.1",
4
4
  "description": "plugin-tls 是插件系统相应的工具,可快速地让任何模块具备插件机制",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -1 +0,0 @@
1
- "use strict";const x=require("@gby/destroyable"),f=require("deepmerge-ts"),m=require("type-tls"),h=require("com-tools");function a(i,...t){for(const e of t){const n=Object.getOwnPropertyDescriptors(e);Object.defineProperties(i,n)}return i}function E(i,t,e){let n=Object.getOwnPropertyDescriptors(t);return e&&h.omitMembers(n,e),Object.defineProperties(i,n),i}function V(i,t,e){let n=Object.getOwnPropertyDescriptors(t);return e?Object.defineProperties(i,h.removeUndefined(h.pickMembers(n,e))):Object.defineProperties(i,n),i}function v(i,t){return t}function N(i){return function(e){return e}}function H(i,t){return a(i,t),t}function I(i){return function(e){return a(i,e),e}}function k(i,t){return a(i,t),i}function C(i){return function(e){return a(i,e),i}}const T=["onCreate","onInit","onDestroy"];function j(i){const t={...i};for(const e of T)typeof t[e]=="function"&&delete t[e];return t}function U(i,t){let e=Object.getOwnPropertyDescriptors(t);for(const n of T)typeof t[n]=="function"&&delete e[n];return Object.defineProperties(i,e),i}function S(i,t){return t}function B(i){return function(e){return e}}function R(i,t){return a(i.prototype,t),t}function A(i){return function(e){return a(i.prototype,e),e}}function q(i,t){return a(i.prototype,t),i}function z(i){return function(e){return a(i.prototype,e),i}}function w(i){return i&&typeof i.onUse=="function"}const c=Symbol("extend");class g extends x.Destroyable{parent;host;plugins=new Map;constructor(t,e){super(),this.parent=e,t&&(this.host=t)}destroyThis(){return this.plugins.clear(),this.host=null,super.destroyThis()}hasUsed(t){return this.parent?.hasUsed(t)||this.plugins.has(t)}getUseReturn(t){const{parent:e}=this;return e?.hasUsed(t)?e.getUseReturn(t):this.plugins.get(t)}isPlugin(t){return this.hasUsed(t)?this.getUseReturn(t)!==c:w(t)}useExtend(t){return this.hasUsed(t)||(U(this.host.prototype,t),this.plugins.set(t,c)),t}instUseExtend(t,e,...n){return this.hasUsed(e)||(this.useExtend(e),e.onCreate?.call(t,t,...n)),e}usePlugin(t,...e){if(this.hasUsed(t))return this.getUseReturn(t);const n=t.onUse(this.host,...e);return this.plugins.set(t,n),n}instUsePlugin(t,e,...n){if(this.hasUsed(e))return this.getUseReturn(e);const s=this.usePlugin(e,...n);return e.onCreate?.(t),s}onCreate(t,...e){const n=this.parent?.onCreate(t,...e),s=[];for(const[r,o]of this.plugins)if(r.onCreate){const l=o===c?r.onCreate:r.onCreate.bind(r);s.push(l)}return m.waitAsyncable(n,()=>h.serialCallFuns(s,t,[t,...e]))}onInit(t,...e){const n=this.parent?.onInit(t,...e),s=[];for(const[r,o]of this.plugins)if(r.onInit){const l=o===c?r.onInit:r.onInit.bind(r);s.push(l)}return m.waitAsyncable(n,()=>h.serialCallFuns(s,t,[t,...e]))}onDestroy(t){const e=[];for(const[r,o]of this.plugins)if(r.onDestroy){const l=o===c?r.onDestroy:r.onDestroy.bind(r);e.push(l)}e.reverse();const n=h.serialCallFuns(e,t,[t]),{parent:s}=this;return s?m.waitAsyncable(n,()=>s.onDestroy(t)):n}}function y(i){const t=i.split(".");return t[0]===""&&t.shift(),t}function O(i,t){for(const e of t)if(i=i[e],i==null)return;return i}function K(i,t){return O(i,y(t))}function P(i,t,e){const n=t.pop(),s=t.length;let r=0;for(;r<s;){const o=i[t[r]];if(o==null)break;i=o,r++}t=t.slice(r);for(const o of t)i=i[o]={};return i[n]=e,i}function $(i,t,e){return P(i,y(t),e)}const M={UndefinedAndNull:function(t){return t==null},Undefined:function(t){return t===void 0},Null:function(t){return t===null}};class F{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?f.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=M[t]||M.UndefinedAndNull}_undefinedValue="UndefinedAndNull";isUndefined=M.UndefinedAndNull;getMember(t){return this.option[t]}setMember(t,e,n){const s=this.option;if(e===void 0)delete s[t];else{const r=s[t];n&&r&&typeof r=="object"?f.deepmergeInto(r,e):s[t]=e}this.updateFullOption()}getValue(t){return O(this.option,t)}setValue(t,e,n){const s=this.option;let r;n&&(r=O(s,t))&&typeof r=="object"?f.deepmergeInto(r,e):P(this.option,t,e),this.updateFullOption()}}class u extends F{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=f.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 L(i,t){const{name:e}=t,n=`_${e}`;return{get:function(){return this[n]||(this[n]=new u(void 0,this.constructor[e]))}}}class D extends F{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:r}=this,o=r[t]||(r[t]=new u);if(o.setOption(e,n),s){const l=r[s];l&&(o.extends=l)}return this.updateFullOption(),o}}class d extends D{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 r=n.getFullModeOption(t);return s?f.deepmerge(r,s):r}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 G(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 _ extends x.Destroyable{static isolatedPluginManager=!1;static get pluginManager(){return this.isolatedPluginManager&&!this.hasOwnProperty("_pluginManager")&&(this._pluginManager=new g(this,this._pluginManager)),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 J extends _{static isolatedOptions=!1;static get defaultOptions(){return this.isolatedOptions&&!this.hasOwnProperty("_defaultOptions")&&(this._defaultOptions=new u(void 0,this._defaultOptions)),this._defaultOptions}static _defaultOptions=new u;get defaultOptions(){return this._defaultOptions||(this._defaultOptions=new u(void 0,this.constructor.defaultOptions))}_defaultOptions;constructor(t){super(),t&&(this.defaultOptions.option=t)}}function b(i){const t=x.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)),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 Q(i){const t=b(i);return class extends t{static isolatedOptions=!1;static get defaultOptions(){return this.isolatedOptions&&!this.hasOwnProperty("_defaultOptions")&&(this._defaultOptions=new u(void 0,this._defaultOptions)),this._defaultOptions}static _defaultOptions=new u;get defaultOptions(){return this._defaultOptions||(this._defaultOptions=new u(void 0,this.constructor.defaultOptions))}_defaultOptions;constructor(n){super(),n&&(this.defaultOptions.option=n)}}}const p="common";class W extends _{static isolatedOptions=!1;static get modeOptions(){return this.isolatedOptions&&!this.hasOwnProperty("_modeOptions")&&(this._modeOptions=new d(p,null,this._modeOptions)),this._modeOptions}static _modeOptions=new d(p);get modeOptions(){return this._modeOptions||(this._modeOptions=new d(p,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(),t&&this.modeOptions.setOption(t)}}function X(i){const t=b(i);return class extends t{static isolatedOptions=!1;static get modeOptions(){return this.isolatedOptions&&!this.hasOwnProperty("_modeOptions")&&(this._modeOptions=new d(p,null,this._modeOptions)),this._modeOptions}static _modeOptions=new d(p);get modeOptions(){return this._modeOptions||(this._modeOptions=new d(p,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(),n&&this.modeOptions.setOption(n)}}}exports.ModeOptions=D;exports.PluginExtendManager=g;exports.PluginHost=_;exports.TierModeOptions=d;exports.TierModeOptionsPluginHost=W;exports.TierOptions=u;exports.TierOptionsPluginHost=J;exports.commonModeName=p;exports.createDefineIExtend=B;exports.createDefineMixin=N;exports.createIExtendTarget=z;exports.createMixinTarget=C;exports.createPluginHost=b;exports.createTargetIExtend=A;exports.createTargetMixin=I;exports.createTierModeOptionsPluginHost=X;exports.createTierOptionsPluginHost=Q;exports.defineIExtend=S;exports.defineMixin=v;exports.extendMark=c;exports.getPropertyValue=O;exports.getPropertyValueByPath=K;exports.iextendTarget=q;exports.isPlugin=w;exports.mixin=a;exports.mixinByOmit=E;exports.mixinByPick=V;exports.mixinIExtend=U;exports.mixinTarget=k;exports.parsePropertyPath=y;exports.pickHostExtendMembers=j;exports.setPropertyValue=P;exports.setPropertyValueByPath=$;exports.targetIExtend=R;exports.targetMixin=H;exports.tierModeOptionsDecorator=G;exports.tierOptionsDecorator=L;