plugin-tls 5.2.0 → 5.3.0
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/{createTierModeOptionsPluginHost-D2REw5Vz.cjs → createTierModeOptionsPluginHost-C-if5dn9.cjs} +1 -1
- package/dist/{createTierModeOptionsPluginHost-Bvne8SqN.js → createTierModeOptionsPluginHost-DWMl3oQA.js} +4 -4
- package/dist/index-node.cjs +1 -1
- package/dist/index-node.js +3 -3
- package/dist/index-web.cjs +1 -1
- package/dist/index-web.js +7 -7
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
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 N(i,t){return t}function v(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(this,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(),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(this,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(),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(),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(),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=v;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=N;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;
|
|
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(),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(),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(),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(),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;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Destroyable as x, createDestroyableSubClass as T } from "@gby/destroyable";
|
|
2
2
|
import { deepmergeInto as f, deepmerge as _ } from "deepmerge-ts";
|
|
3
3
|
import { waitAsyncable as g } from "type-tls";
|
|
4
|
-
import { omitMembers as D, removeUndefined as
|
|
4
|
+
import { omitMembers as D, removeUndefined as v, pickMembers as E, serialCallFuns as O } from "com-tools";
|
|
5
5
|
function l(s, ...t) {
|
|
6
6
|
for (const e of t) {
|
|
7
7
|
const n = Object.getOwnPropertyDescriptors(e);
|
|
@@ -15,7 +15,7 @@ function S(s, t, e) {
|
|
|
15
15
|
}
|
|
16
16
|
function R(s, t, e) {
|
|
17
17
|
let n = Object.getOwnPropertyDescriptors(t);
|
|
18
|
-
return e ? Object.defineProperties(s, E(
|
|
18
|
+
return e ? Object.defineProperties(s, v(E(n, e))) : Object.defineProperties(s, n), s;
|
|
19
19
|
}
|
|
20
20
|
function A(s, t) {
|
|
21
21
|
return t;
|
|
@@ -739,7 +739,7 @@ class st extends w {
|
|
|
739
739
|
* 全局级别的默认选项
|
|
740
740
|
*/
|
|
741
741
|
static get defaultOptions() {
|
|
742
|
-
return this.isolatedOptions && !this.hasOwnProperty("_defaultOptions") && (this._defaultOptions = new a(
|
|
742
|
+
return this.isolatedOptions && !this.hasOwnProperty("_defaultOptions") && (this._defaultOptions = new a(void 0, this._defaultOptions)), this._defaultOptions;
|
|
743
743
|
}
|
|
744
744
|
static _defaultOptions = new a();
|
|
745
745
|
/**
|
|
@@ -850,7 +850,7 @@ function ot(s) {
|
|
|
850
850
|
* 全局级别的默认选项
|
|
851
851
|
*/
|
|
852
852
|
static get defaultOptions() {
|
|
853
|
-
return this.isolatedOptions && !this.hasOwnProperty("_defaultOptions") && (this._defaultOptions = new a(
|
|
853
|
+
return this.isolatedOptions && !this.hasOwnProperty("_defaultOptions") && (this._defaultOptions = new a(void 0, this._defaultOptions)), this._defaultOptions;
|
|
854
854
|
}
|
|
855
855
|
static _defaultOptions = new a();
|
|
856
856
|
/**
|
package/dist/index-node.cjs
CHANGED
|
@@ -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-
|
|
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-C-if5dn9.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(),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(),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;
|
package/dist/index-node.js
CHANGED
|
@@ -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-
|
|
5
|
-
import { f as P, g as D, p as T, q as E } from "./createTierModeOptionsPluginHost-
|
|
4
|
+
import { P as a, T as n, c as r, d as o } from "./createTierModeOptionsPluginHost-DWMl3oQA.js";
|
|
5
|
+
import { f as P, g as D, p as T, q as E } from "./createTierModeOptionsPluginHost-DWMl3oQA.js";
|
|
6
6
|
var p = class extends h {
|
|
7
7
|
refCount = 0;
|
|
8
8
|
get isDestroyed() {
|
|
@@ -195,7 +195,7 @@ class _ extends u {
|
|
|
195
195
|
* 全局级别的默认选项
|
|
196
196
|
*/
|
|
197
197
|
static get defaultOptions() {
|
|
198
|
-
return this.isolatedOptions && !this.hasOwnProperty("_defaultOptions") && (this._defaultOptions = new o(
|
|
198
|
+
return this.isolatedOptions && !this.hasOwnProperty("_defaultOptions") && (this._defaultOptions = new o(void 0, this._defaultOptions)), this._defaultOptions;
|
|
199
199
|
}
|
|
200
200
|
static _defaultOptions = new o();
|
|
201
201
|
/**
|
package/dist/index-web.cjs
CHANGED
|
@@ -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-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./Destroyable-mrBsNabq-IFFuYfKS.cjs"),p=require("com-tools"),i=require("./createTierModeOptionsPluginHost-C-if5dn9.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 r=n?.times;if(r){const o=typeof s=="function"?s:s?.handleEvent;if(o)return this.multipleListen(t,o,r)}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 r=0;const o=new AbortController,l=o.signal;return super.addEventListener(t,d=>{++r>=n&&o.abort(),s.call(this,d)},{signal:l}),function(){o.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(),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(),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-
|
|
4
|
-
import { f as P, g as D, p as b, q as x } from "./createTierModeOptionsPluginHost-
|
|
3
|
+
import { P as d, T as a, c as u, d as l } from "./createTierModeOptionsPluginHost-DWMl3oQA.js";
|
|
4
|
+
import { f as P, g as D, p as b, q as x } from "./createTierModeOptionsPluginHost-DWMl3oQA.js";
|
|
5
5
|
if (!globalThis.CustomEvent) {
|
|
6
6
|
class s extends Event {
|
|
7
7
|
detail;
|
|
@@ -222,7 +222,7 @@ class h extends O {
|
|
|
222
222
|
return t instanceof Promise ? t.finally(() => super.destroyThis()) : super.destroyThis();
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
|
-
class
|
|
225
|
+
class v extends h {
|
|
226
226
|
/**
|
|
227
227
|
* 是否使用独立的选项
|
|
228
228
|
* @defaultValue false
|
|
@@ -255,7 +255,7 @@ class M extends h {
|
|
|
255
255
|
super(), this.modeOptions.setOption(t);
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
|
-
class
|
|
258
|
+
class M extends h {
|
|
259
259
|
/**
|
|
260
260
|
* 是否使用独立的选项
|
|
261
261
|
* @defaultValue false
|
|
@@ -265,7 +265,7 @@ class v extends h {
|
|
|
265
265
|
* 全局级别的默认选项
|
|
266
266
|
*/
|
|
267
267
|
static get defaultOptions() {
|
|
268
|
-
return this.isolatedOptions && !this.hasOwnProperty("_defaultOptions") && (this._defaultOptions = new l(
|
|
268
|
+
return this.isolatedOptions && !this.hasOwnProperty("_defaultOptions") && (this._defaultOptions = new l(void 0, this._defaultOptions)), this._defaultOptions;
|
|
269
269
|
}
|
|
270
270
|
static _defaultOptions = new l();
|
|
271
271
|
/**
|
|
@@ -282,9 +282,9 @@ class v extends h {
|
|
|
282
282
|
export {
|
|
283
283
|
h as PluginHostEventTarget,
|
|
284
284
|
P as TierModeOptionsPluginHost,
|
|
285
|
-
|
|
285
|
+
v as TierModeOptionsPluginHostEventTarget,
|
|
286
286
|
D as TierOptionsPluginHost,
|
|
287
|
-
|
|
287
|
+
M as TierOptionsPluginHostEventTarget,
|
|
288
288
|
u as commonModeName,
|
|
289
289
|
b as createTierModeOptionsPluginHost,
|
|
290
290
|
x as createTierOptionsPluginHost
|
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-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("@gby/destroyable"),p=require("com-tools"),n=require("./createTierModeOptionsPluginHost-C-if5dn9.cjs"),g=require("type-tls");function m(r,t){return t}function M(r){return function(e){return e}}function O(r,t){return n.mixin(r.prototype,t),t}function P(r){return function(e){return n.mixin(r.prototype,e),e}}function y(r,t){return n.mixin(r.prototype,t),r}function T(r){return function(e){return n.mixin(r.prototype,e),r}}class E extends h.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)}use(t,...e){if(this.hasUsed(t))return this.getUseReturn(t);const i=t.onUse(this.host,...e);return this.plugins.set(t,i),i}instUse(t,e,...i){const{plugins:s}=this;if(this.hasUsed(e))return this.getUseReturn(e);const o=this.use(e,...i);return e.onCreate?.(t),o}onCreate(t,...e){const i=this.parent?.onCreate(t,...e),s=[];for(const[o]of this.plugins)o.onCreate&&s.push(o.onCreate.bind(o));return g.waitAsyncable(i,()=>p.serialCallFuns(s,void 0,[t,...e]))}onInit(t,...e){const i=this.parent?.onInit(t,...e),s=[];for(const[o]of this.plugins)o.onInit&&s.push(o.onInit.bind(o));return g.waitAsyncable(i,()=>p.serialCallFuns(s,void 0,[t,...e]))}onDestroy(t){const e=[];for(const[o]of this.plugins)o.onDestroy&&e.push(o.onDestroy.bind(o));e.reverse();const i=p.serialCallFuns(e,void 0,[t]),{parent:s}=this;return s?g.waitAsyncable(i,()=>s.onDestroy(t)):i}}class b extends h.Destroyable{parent;host;plugins=new Set;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)}use(t){return this.hasUsed(t)||(n.mixinIExtend(this.host.prototype,t),this.plugins.add(t)),t}instUse(t,e,...i){return this.hasUsed(e)||(this.use(e),e.onCreate?.call(t,t,...i)),e}onCreate(t,...e){const i=this.parent?.onCreate(t,...e),s=[];for(const o of this.plugins)o.onCreate&&s.push(o.onCreate);return g.waitAsyncable(i,()=>p.serialCallFuns(s,t,[t,...e]))}onInit(t,...e){const i=this.parent?.onInit(t,...e),s=[];for(const o of this.plugins)o.onInit&&s.push(o.onInit);return g.waitAsyncable(i,()=>p.serialCallFuns(s,t,[t,...e]))}onDestroy(t){const e=[];for(const o of this.plugins)o.onDestroy&&e.push(o.onDestroy);e.reverse();const i=p.serialCallFuns(e,t,[t]),{parent:s}=this;return s?g.waitAsyncable(i,()=>s.onDestroy(t)):i}}function d(r,t){const e=[{target:r,props:t}];let i;for(;i=e.shift();){const{target:s,props:o}=i;for(const[u,a]of Object.entries(o)){if(a!=null&&typeof a=="object"&&(!a.constructor||a.constructor===Object)){e.push({target:s[u],props:a});continue}s[u]=a}}return r}function f(r,t){const e={},i=[{target:r,props:t,targetProps:e}];let s;for(;s=i.shift();){const{target:o,props:u,targetProps:a}=s;for(const[c,l]of Object.entries(u)){if(l!=null&&typeof l=="object"&&(!l.constructor||l.constructor===Object)){i.push({target:o[c],props:l,targetProps:a[c]={}});continue}a[c]=o[c]}}return e}function w(r,t){const e=f(r,t);function i(){d(r,t)}function s(){d(r,e)}return{set:i,unset:s}}function U(r,t){const e=t??"defaultOptions",i=`_${e}`;return function(o){const u=n.mixinTarget(o,{get[e](){return r}});n.mixinTarget(u.prototype,{get[e](){return this[i]||(this[i]=structuredClone(u.defaultOptions))}})}}function C(r,t,e){const i=`_${t}`;return n.mixinTarget(r.prototype,{get[t](){return this[i]||(this[i]=structuredClone(r[t]))}}),e}function D(r,t,e){const i=n.mixinTarget(r,{modeOptions:new n.TierModeOptions(t,e)});return n.mixinTarget(i.prototype,{get modeOptions(){return this._modeOptions||(this._modeOptions=new n.TierModeOptions(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}}),r}const _={onUse(r,t,e){const i=t??n.commonModeName;n.mixin(r,{modeOptions:new n.TierModeOptions(i,void 0,e)}),n.mixin(r.prototype,{get modeOptions(){const s=this,o=r;return s._modeOptions||(s._modeOptions=new n.TierModeOptions(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(r,t){r.modeOptions.setOption(t)}},H={onUse(r,t,e){n.mixin(r,{defaultOptions:new n.TierOptions(t,e)}),n.mixin(r.prototype,{get defaultOptions(){return this._defaultOptions||(this._defaultOptions=new n.TierOptions(void 0,r.defaultOptions))}})},onCreate(r,t){r.defaultOptions.option=t}};function I(r,t){const e=n.mixinTarget(r,{defaultOptions:new n.TierOptions(t)});return n.mixinTarget(e.prototype,{get defaultOptions(){return this._defaultOptions||(this._defaultOptions=new n.TierOptions(void 0,this.constructor.defaultOptions))}}),r}function x(r){const t=n.mixinTarget(r,{isolatedPluginManager:!1,get pluginManager(){return(!this._pluginManager||this.isolatedPluginManager&&!this.hasOwnProperty("_pluginManager"))&&(this._pluginManager=new n.PluginExtendManager(this,this._pluginManager)),this._pluginManager},usePlugin(e,...i){return this.pluginManager.usePlugin(e,...i)},useExtend(e){return this.pluginManager.useExtend(e)},hasUsed(e){return this.pluginManager.hasUsed(e)}});return n.mixinTarget(t.prototype,{get pluginManager(){return this.constructor.pluginManager},usePlugin(e,...i){return this.pluginManager.instUsePlugin(this,e,...i)},useExtend(e,...i){return this.pluginManager.instUseExtend(this,e,...i)},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()}}),r}function v(r){const t=x(r);return new Proxy(t,{construct:function(e,i,s){const o=new e(...i);return t.pluginManager.onCreate(this,...i),o}})}function j(r){return class extends r{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(e,...i){return this.pluginManager.usePlugin(e,...i)}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,...i){return this.pluginManager.instUsePlugin(this,e,...i)}useExtend(e,...i){return this.pluginManager.instUseExtend(this,e,...i)}init(...e){if(super.init){const i=super.init(...e);if(i instanceof Promise)return i.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}}}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=b;exports.PluginManager=E;exports.addDefaultOptions=U;exports.addInstOptions=C;exports.becomePluginHost=x;exports.becomePluginHost_Extends=j;exports.becomePluginHost_Proxy=v;exports.becomeTierModeOptionsHost=D;exports.becomeTierOptionsHost=I;exports.createDefineExtend=M;exports.createExtendTarget=T;exports.createPropertySetter=w;exports.createTargetExtend=P;exports.defineExtend=m;exports.extendTarget=y;exports.getTargetProperties=f;exports.mergeProperties=d;exports.targetExtend=O;exports.tierModeOptionsPlugin=_;exports.tierOptionsPlugin=H;
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Destroyable as O } from "@gby/destroyable";
|
|
2
2
|
import { serialCallFuns as c } from "com-tools";
|
|
3
|
-
import { m as a, a as y, b as u, T as d, c as P, d as f, P as M } from "./createTierModeOptionsPluginHost-
|
|
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 rt, q as it, r as ot, s as ut, t as at, u as pt, v as ct, w as gt, x as lt, y as ht, z as dt, A as ft, B as Mt, C as mt, D as Ot, E as yt, F as Pt, G as xt, H as Tt } from "./createTierModeOptionsPluginHost-
|
|
3
|
+
import { m as a, a as y, b as u, T as d, c as P, d as f, P as M } from "./createTierModeOptionsPluginHost-DWMl3oQA.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 rt, q as it, r as ot, s as ut, t as at, u as pt, v as ct, w as gt, x as lt, y as ht, z as dt, A as ft, B as Mt, C as mt, D as Ot, E as yt, F as Pt, G as xt, H as Tt } from "./createTierModeOptionsPluginHost-DWMl3oQA.js";
|
|
5
5
|
import { waitAsyncable as g } from "type-tls";
|
|
6
6
|
function C(s, e) {
|
|
7
7
|
return e;
|