plugin-tls 3.6.0 → 4.0.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/Destroyable-BqvuD4gL-Cmk1ocqj.cjs +1 -0
- package/dist/Destroyable-BqvuD4gL-D50ZO9eN.js +129 -0
- package/dist/createTierModeOptionsPluginHost-C3kmxB00.cjs +1 -0
- package/dist/createTierModeOptionsPluginHost-CeND_z6P.js +852 -0
- package/dist/index-node.cjs +1 -1
- package/dist/index-node.d.ts +0 -1
- package/dist/index-node.d.ts.map +1 -1
- package/dist/index-node.js +254 -56
- package/dist/index-web.cjs +1 -1
- package/dist/index-web.d.ts +0 -1
- package/dist/index-web.d.ts.map +1 -1
- package/dist/index-web.js +324 -56
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +4 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +628 -60
- package/dist/options/index-node.d.ts +0 -1
- package/dist/options/index-node.d.ts.map +1 -1
- package/dist/options/index-web.d.ts +0 -1
- package/dist/options/index-web.d.ts.map +1 -1
- package/dist/options/{index-com.d.ts → index.d.ts} +1 -1
- package/dist/options/index.d.ts.map +1 -0
- package/dist/options/plugins/tier-mode-options/type.d.ts +1 -1
- package/dist/options/plugins/tier-mode-options/type.d.ts.map +1 -1
- package/dist/options/plugins/tier-options/type.d.ts +1 -1
- package/dist/options/plugins/tier-options/type.d.ts.map +1 -1
- package/dist/plugin-host/PluginHostEventEmitter.d.ts +2 -2
- package/dist/plugin-host/PluginHostEventEmitter.d.ts.map +1 -1
- package/dist/plugin-host/PluginHostEventTarget.d.ts +1 -1
- package/dist/plugin-host/PluginHostEventTarget.d.ts.map +1 -1
- package/dist/plugin-host/index-node.d.ts +0 -1
- package/dist/plugin-host/index-node.d.ts.map +1 -1
- package/dist/plugin-host/index-web.d.ts +0 -1
- package/dist/plugin-host/index-web.d.ts.map +1 -1
- package/dist/plugin-host/{index-com.d.ts → index.d.ts} +1 -1
- package/dist/plugin-host/index.d.ts.map +1 -0
- package/package.json +2 -2
- package/dist/TierOptionsPluginHostEventEmitter-BjGVIRN6.cjs +0 -1
- package/dist/TierOptionsPluginHostEventEmitter-DXTNpSmS.js +0 -131
- package/dist/TierOptionsPluginHostEventTarget-Bok_zzQ1.js +0 -131
- package/dist/TierOptionsPluginHostEventTarget-DqfVEP_L.cjs +0 -1
- package/dist/decorator-Culqv4k6.js +0 -1454
- package/dist/decorator-Wf_x4qDo.cjs +0 -1
- package/dist/options/index-com.d.ts.map +0 -1
- package/dist/plugin-host/index-com.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,62 +1,630 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { Destroyable as M } from "@gby/destroyable";
|
|
2
|
+
import { omitMembers as m, removeUndefined as P, pickMembers as y, serialCallFuns as c } from "com-tools";
|
|
3
|
+
import { m as x, T as d, c as w, a as f, P as h } from "./createTierModeOptionsPluginHost-CeND_z6P.js";
|
|
4
|
+
import { M as et, b as nt, d as st, e as rt, f as it, g as ot, h as ut, i as at, j as pt, k as ct, l as gt, p as lt, n as dt, s as ft, o as ht, t as Ot, q as Mt } from "./createTierModeOptionsPluginHost-CeND_z6P.js";
|
|
5
|
+
function o(n, ...e) {
|
|
6
|
+
for (const t of e) {
|
|
7
|
+
const s = Object.getOwnPropertyDescriptors(t);
|
|
8
|
+
Object.defineProperties(n, s);
|
|
9
|
+
}
|
|
10
|
+
return n;
|
|
11
|
+
}
|
|
12
|
+
function C(n, e, t) {
|
|
13
|
+
let s = Object.getOwnPropertyDescriptors(e);
|
|
14
|
+
return t && m(s, t), Object.defineProperties(n, s), n;
|
|
15
|
+
}
|
|
16
|
+
function U(n, e, t) {
|
|
17
|
+
let s = Object.getOwnPropertyDescriptors(e);
|
|
18
|
+
return t ? Object.defineProperties(n, P(y(s, t))) : Object.defineProperties(n, s), n;
|
|
19
|
+
}
|
|
20
|
+
function j(n, e) {
|
|
21
|
+
return e;
|
|
22
|
+
}
|
|
23
|
+
function v() {
|
|
24
|
+
return function(e) {
|
|
25
|
+
return e;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function H(n, e) {
|
|
29
|
+
return o(n, e), e;
|
|
30
|
+
}
|
|
31
|
+
function I(n) {
|
|
32
|
+
return function(t) {
|
|
33
|
+
return o(n, t), t;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function a(n, e) {
|
|
37
|
+
return o(n, e), n;
|
|
38
|
+
}
|
|
39
|
+
function k(n) {
|
|
40
|
+
return function(t) {
|
|
41
|
+
return o(n, t), n;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function B(n, e) {
|
|
45
|
+
return e;
|
|
46
|
+
}
|
|
47
|
+
function N() {
|
|
48
|
+
return function(e) {
|
|
49
|
+
return e;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function V(n, e) {
|
|
53
|
+
return o(n.prototype, e), e;
|
|
54
|
+
}
|
|
55
|
+
function q(n) {
|
|
56
|
+
return function(t) {
|
|
57
|
+
return o(n.prototype, t), t;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function F(n, e) {
|
|
61
|
+
return o(n.prototype, e), n;
|
|
62
|
+
}
|
|
63
|
+
function S(n) {
|
|
64
|
+
return function(t) {
|
|
65
|
+
return o(n.prototype, t), n;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
class $ extends M {
|
|
69
|
+
/**
|
|
70
|
+
* 插件的宿主
|
|
71
|
+
*/
|
|
72
|
+
host;
|
|
73
|
+
/**
|
|
74
|
+
* 所有注册的插件
|
|
75
|
+
*/
|
|
76
|
+
plugins = /* @__PURE__ */ new Map();
|
|
77
|
+
/**
|
|
78
|
+
* @param host - 插件的宿主
|
|
79
|
+
*/
|
|
80
|
+
constructor(e) {
|
|
81
|
+
super(), e && (this.host = e);
|
|
82
|
+
}
|
|
83
|
+
destroyThis() {
|
|
84
|
+
return this.plugins.clear(), this.host = null, super.destroyThis();
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* 是否注册了插件
|
|
88
|
+
* @param plugin - 插件
|
|
89
|
+
* @returns 是否注册了插件
|
|
90
|
+
*/
|
|
91
|
+
hasUsed(e) {
|
|
92
|
+
return this.plugins.has(e);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* 使用插件、注册插件
|
|
96
|
+
* @param plugin - 插件
|
|
97
|
+
* @param args - 传递给插件的选项
|
|
98
|
+
*/
|
|
99
|
+
use(e, ...t) {
|
|
100
|
+
const { plugins: s } = this;
|
|
101
|
+
if (s.has(e)) return s.get(e);
|
|
102
|
+
const r = e.onUse(this.host, ...t);
|
|
103
|
+
return s.set(e, r), r;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* 插件宿主实例的注册插件的方法
|
|
107
|
+
*
|
|
108
|
+
* @remarks
|
|
109
|
+
* 会调用每个插件的 {@link IPlugin.use } 方法
|
|
110
|
+
* @param hostInst - 插件宿主的新实例
|
|
111
|
+
*/
|
|
112
|
+
instUse(e, t, ...s) {
|
|
113
|
+
const { plugins: r } = this;
|
|
114
|
+
if (r.has(t)) return r.get(t);
|
|
115
|
+
const i = this.use(t, ...s);
|
|
116
|
+
return t.onCreate?.(e), i;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* 插件宿主创建实例时调用
|
|
120
|
+
*
|
|
121
|
+
* @remarks
|
|
122
|
+
* 会调用每个插件的 {@link IPlugin.onCreate} 方法
|
|
123
|
+
* 如果插件的 created 方法返回 Promise,则会等待 Promise resolve
|
|
124
|
+
* @param hostInst - 插件宿主的新实例
|
|
125
|
+
*/
|
|
126
|
+
onCreate(e, ...t) {
|
|
127
|
+
const s = [];
|
|
128
|
+
for (const [r] of this.plugins)
|
|
129
|
+
r.onCreate && s.push(r.onCreate.bind(r));
|
|
130
|
+
return c(s, void 0, [e, ...t]);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* 插件宿主创建实例时调用
|
|
134
|
+
*
|
|
135
|
+
* @remarks
|
|
136
|
+
* 会调用每个插件的 {@link IPlugin.onCreate } 方法
|
|
137
|
+
* @param hostInst - 插件宿主的新实例
|
|
138
|
+
* @param args - 初始化宿主实例时的参数
|
|
139
|
+
*/
|
|
140
|
+
onInit(e, ...t) {
|
|
141
|
+
const s = [];
|
|
142
|
+
for (const [r] of this.plugins)
|
|
143
|
+
r.onInit && s.push(r.onInit.bind(r));
|
|
144
|
+
return c(s, void 0, [e, ...t]);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* 插件宿主被销毁时调用
|
|
148
|
+
*
|
|
149
|
+
* @remarks
|
|
150
|
+
* 会调用每个插件的 {@link IPlugin.onDestroy} 方法
|
|
151
|
+
* @param hostInst - 被销毁的插件实例
|
|
152
|
+
*/
|
|
153
|
+
onDestroy(e) {
|
|
154
|
+
const t = [];
|
|
155
|
+
for (const [s] of this.plugins)
|
|
156
|
+
s.onDestroy && t.push(s.onDestroy.bind(s));
|
|
157
|
+
return t.reverse(), c(t, void 0, [e]);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
class W extends M {
|
|
161
|
+
/**
|
|
162
|
+
* 插件的宿主
|
|
163
|
+
*/
|
|
164
|
+
host;
|
|
165
|
+
/**
|
|
166
|
+
* 所有注册的插件
|
|
167
|
+
*/
|
|
168
|
+
plugins = /* @__PURE__ */ new Set();
|
|
169
|
+
/**
|
|
170
|
+
* @param host - 插件的宿主
|
|
171
|
+
*/
|
|
172
|
+
constructor(e) {
|
|
173
|
+
super(), e && (this.host = e);
|
|
174
|
+
}
|
|
175
|
+
destroyThis() {
|
|
176
|
+
return this.plugins.clear(), this.host = null, super.destroyThis();
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* 是否注册了插件
|
|
180
|
+
* @param plugin - 插件
|
|
181
|
+
* @returns 是否注册了插件
|
|
182
|
+
*/
|
|
183
|
+
hasUsed(e) {
|
|
184
|
+
return this.plugins.has(e);
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* 使用插件、注册插件
|
|
188
|
+
* @param plugin - 插件
|
|
189
|
+
* @returns 返回插件对象本身
|
|
190
|
+
*/
|
|
191
|
+
use(e) {
|
|
192
|
+
const { plugins: t } = this;
|
|
193
|
+
return t.has(e) || (x(this.host.prototype, e), t.add(e)), e;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* 插件宿主实例的注册插件的方法
|
|
197
|
+
*
|
|
198
|
+
* @remarks
|
|
199
|
+
* 会调用每个插件的 {@link IExtend.use } 方法
|
|
200
|
+
* @param hostInst - 插件宿主的新实例
|
|
201
|
+
*/
|
|
202
|
+
instUse(e, t, ...s) {
|
|
203
|
+
const { plugins: r } = this;
|
|
204
|
+
return r.has(t) || (this.use(t), t.onCreate?.call(e, e, ...s)), t;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* 插件宿主创建实例时调用
|
|
208
|
+
*
|
|
209
|
+
* @remarks
|
|
210
|
+
* 会调用每个插件的 {@link IExtend.onCreate} 方法
|
|
211
|
+
* 如果插件的 created 方法返回 Promise,则会等待 Promise resolve
|
|
212
|
+
* @param hostInst - 插件宿主的新实例
|
|
213
|
+
*/
|
|
214
|
+
onCreate(e, ...t) {
|
|
215
|
+
const s = [];
|
|
216
|
+
for (const r of this.plugins)
|
|
217
|
+
r.onCreate && s.push(r.onCreate);
|
|
218
|
+
return c(s, e, [e, ...t]);
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* 插件宿主创建实例时调用
|
|
222
|
+
*
|
|
223
|
+
* @remarks
|
|
224
|
+
* 会调用每个插件的 {@link IExtend.onCreate } 方法
|
|
225
|
+
* @param hostInst - 插件宿主的新实例
|
|
226
|
+
* @param args - 初始化宿主实例时的参数
|
|
227
|
+
*/
|
|
228
|
+
onInit(e, ...t) {
|
|
229
|
+
const s = [];
|
|
230
|
+
for (const r of this.plugins)
|
|
231
|
+
r.onInit && s.push(r.onInit);
|
|
232
|
+
return c(s, e, [e, ...t]);
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* 插件宿主被销毁时调用
|
|
236
|
+
*
|
|
237
|
+
* @remarks
|
|
238
|
+
* 会调用每个插件的 {@link IExtend.onDestroy} 方法
|
|
239
|
+
* @param hostInst - 被销毁的插件实例
|
|
240
|
+
*/
|
|
241
|
+
onDestroy(e) {
|
|
242
|
+
const t = [];
|
|
243
|
+
for (const s of this.plugins)
|
|
244
|
+
s.onDestroy && t.push(s.onDestroy);
|
|
245
|
+
return t.reverse(), c(t, e, [e]);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
function O(n, e) {
|
|
249
|
+
const t = [{ target: n, props: e }];
|
|
250
|
+
let s;
|
|
251
|
+
for (; s = t.shift(); ) {
|
|
252
|
+
const { target: r, props: i } = s;
|
|
253
|
+
for (const [p, u] of Object.entries(i)) {
|
|
254
|
+
if (u != null && typeof u == "object" && (!u.constructor || u.constructor === Object)) {
|
|
255
|
+
t.push({ target: r[p], props: u });
|
|
256
|
+
continue;
|
|
257
|
+
}
|
|
258
|
+
r[p] = u;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
return n;
|
|
262
|
+
}
|
|
263
|
+
function b(n, e) {
|
|
264
|
+
const t = {}, s = [{ target: n, props: e, targetProps: t }];
|
|
265
|
+
let r;
|
|
266
|
+
for (; r = s.shift(); ) {
|
|
267
|
+
const { target: i, props: p, targetProps: u } = r;
|
|
268
|
+
for (const [l, g] of Object.entries(p)) {
|
|
269
|
+
if (g != null && typeof g == "object" && (!g.constructor || g.constructor === Object)) {
|
|
270
|
+
s.push({ target: i[l], props: g, targetProps: u[l] = {} });
|
|
271
|
+
continue;
|
|
272
|
+
}
|
|
273
|
+
u[l] = i[l];
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
return t;
|
|
277
|
+
}
|
|
278
|
+
function z(n, e) {
|
|
279
|
+
const t = b(n, e);
|
|
280
|
+
function s() {
|
|
281
|
+
O(n, e);
|
|
282
|
+
}
|
|
283
|
+
function r() {
|
|
284
|
+
O(n, t);
|
|
285
|
+
}
|
|
286
|
+
return { set: s, unset: r };
|
|
287
|
+
}
|
|
288
|
+
function A(n, e) {
|
|
289
|
+
const t = e ?? "defaultOptions", s = `_${t}`;
|
|
290
|
+
return function(i) {
|
|
291
|
+
const p = a(i, {
|
|
292
|
+
/**
|
|
293
|
+
* 全局级别的默认选项
|
|
294
|
+
*/
|
|
295
|
+
get [t]() {
|
|
296
|
+
return n;
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
a(p.prototype, {
|
|
300
|
+
/**
|
|
301
|
+
* 实例级的默认选项
|
|
302
|
+
*/
|
|
303
|
+
get [t]() {
|
|
304
|
+
return this[s] || (this[s] = structuredClone(p.defaultOptions));
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
function G(n, e, t) {
|
|
310
|
+
const s = `_${e}`;
|
|
311
|
+
return a(n.prototype, {
|
|
312
|
+
/**
|
|
313
|
+
* 实例级的默认选项
|
|
314
|
+
*/
|
|
315
|
+
get [e]() {
|
|
316
|
+
return this[s] || (this[s] = structuredClone(n[e]));
|
|
317
|
+
}
|
|
318
|
+
}), t;
|
|
319
|
+
}
|
|
320
|
+
function J(n, e, t) {
|
|
321
|
+
const s = a(n, {
|
|
322
|
+
/**
|
|
323
|
+
* 全局级别的默认选项
|
|
324
|
+
*/
|
|
325
|
+
modeOptions: new d(e, t)
|
|
326
|
+
});
|
|
327
|
+
return a(s.prototype, {
|
|
328
|
+
/**
|
|
329
|
+
* 实例级的默认选项
|
|
330
|
+
*/
|
|
331
|
+
get modeOptions() {
|
|
332
|
+
return this._modeOptions || (this._modeOptions = new d(e, void 0, this.constructor.modeOptions));
|
|
333
|
+
},
|
|
334
|
+
get mode() {
|
|
335
|
+
return this.modeOptions.mode;
|
|
336
|
+
},
|
|
337
|
+
set mode(r) {
|
|
338
|
+
this.modeOptions.mode = r;
|
|
339
|
+
},
|
|
340
|
+
get options() {
|
|
341
|
+
return this.modeOptions.fullOption;
|
|
342
|
+
}
|
|
343
|
+
}), n;
|
|
344
|
+
}
|
|
345
|
+
const Q = {
|
|
346
|
+
onUse(n, e, t) {
|
|
347
|
+
const s = e ?? w;
|
|
348
|
+
o(n, {
|
|
349
|
+
modeOptions: new d(
|
|
350
|
+
s,
|
|
351
|
+
void 0,
|
|
352
|
+
t
|
|
353
|
+
)
|
|
354
|
+
}), o(n.prototype, {
|
|
355
|
+
get modeOptions() {
|
|
356
|
+
const r = this, i = n;
|
|
357
|
+
return r._modeOptions || (r._modeOptions = new d(
|
|
358
|
+
i.modeOptions.mode,
|
|
359
|
+
void 0,
|
|
360
|
+
i.modeOptions
|
|
361
|
+
));
|
|
362
|
+
},
|
|
363
|
+
get mode() {
|
|
364
|
+
return this.modeOptions.mode;
|
|
365
|
+
},
|
|
366
|
+
set mode(r) {
|
|
367
|
+
const i = this;
|
|
368
|
+
i.modeOptions.mode = r;
|
|
369
|
+
},
|
|
370
|
+
get options() {
|
|
371
|
+
return this.modeOptions.plainFullOption;
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
},
|
|
375
|
+
onCreate(n, e) {
|
|
376
|
+
n.modeOptions.setOption(e);
|
|
377
|
+
}
|
|
378
|
+
}, R = {
|
|
379
|
+
onUse(n, e, t) {
|
|
380
|
+
o(n, {
|
|
381
|
+
/**
|
|
382
|
+
* 全局级别的默认选项
|
|
383
|
+
*/
|
|
384
|
+
defaultOptions: new f(e, t)
|
|
385
|
+
}), o(n.prototype, {
|
|
386
|
+
/**
|
|
387
|
+
* 实例级的默认选项
|
|
388
|
+
*/
|
|
389
|
+
get defaultOptions() {
|
|
390
|
+
return this._defaultOptions || (this._defaultOptions = new f(void 0, n.defaultOptions));
|
|
391
|
+
}
|
|
392
|
+
});
|
|
393
|
+
},
|
|
394
|
+
onCreate(n, e) {
|
|
395
|
+
n.defaultOptions.option = e;
|
|
396
|
+
}
|
|
397
|
+
};
|
|
398
|
+
function X(n, e) {
|
|
399
|
+
const t = a(n, {
|
|
400
|
+
/**
|
|
401
|
+
* 全局级别的默认选项
|
|
402
|
+
*/
|
|
403
|
+
defaultOptions: new f(e)
|
|
404
|
+
});
|
|
405
|
+
return a(t.prototype, {
|
|
406
|
+
/**
|
|
407
|
+
* 实例级的默认选项
|
|
408
|
+
*/
|
|
409
|
+
get defaultOptions() {
|
|
410
|
+
return this._defaultOptions || (this._defaultOptions = new f(void 0, this.constructor.defaultOptions));
|
|
411
|
+
}
|
|
412
|
+
}), n;
|
|
413
|
+
}
|
|
414
|
+
function T(n) {
|
|
415
|
+
const e = a(n, {
|
|
416
|
+
/**
|
|
417
|
+
* 是否使用独立的插件管理器
|
|
418
|
+
* @defaultValue false
|
|
419
|
+
*/
|
|
420
|
+
isolatedPluginManager: !1,
|
|
421
|
+
/**
|
|
422
|
+
* PluginHost 的插件管理器
|
|
423
|
+
*/
|
|
424
|
+
get pluginManager() {
|
|
425
|
+
return (!this._pluginManager || this.isolatedPluginManager && !this.hasOwnProperty("_pluginManager")) && (this._pluginManager = new h(this)), this._pluginManager;
|
|
426
|
+
},
|
|
427
|
+
// _pluginManager: PluginManager<HOST,Plugin>;
|
|
428
|
+
/**
|
|
429
|
+
* {@inheritDoc PluginExtendManager.usePlugin}
|
|
430
|
+
*/
|
|
431
|
+
usePlugin(t, ...s) {
|
|
432
|
+
return this.pluginManager.usePlugin(t, ...s);
|
|
433
|
+
},
|
|
434
|
+
/**
|
|
435
|
+
* {@inheritDoc PluginExtendManager.useExtend}
|
|
436
|
+
*/
|
|
437
|
+
useExtend(t) {
|
|
438
|
+
return this.pluginManager.useExtend(t);
|
|
439
|
+
},
|
|
440
|
+
/**
|
|
441
|
+
* 是否注册了插件 或 扩展
|
|
442
|
+
* @param plugin - 插件 或 扩展
|
|
443
|
+
* @returns 是否注册了插件 或 扩展
|
|
444
|
+
*/
|
|
445
|
+
hasUsed(t) {
|
|
446
|
+
return this.pluginManager.hasUsed(t);
|
|
447
|
+
}
|
|
448
|
+
});
|
|
449
|
+
return a(e.prototype, {
|
|
450
|
+
/**
|
|
451
|
+
* 插件管理器
|
|
452
|
+
*/
|
|
453
|
+
get pluginManager() {
|
|
454
|
+
return this.constructor.pluginManager;
|
|
455
|
+
},
|
|
456
|
+
/**
|
|
457
|
+
* 实例的注册插件的方法
|
|
458
|
+
* @param plugin
|
|
459
|
+
* @param options
|
|
460
|
+
* @returns
|
|
461
|
+
*/
|
|
462
|
+
usePlugin(t, ...s) {
|
|
463
|
+
return this.pluginManager.instUsePlugin(this, t, ...s);
|
|
464
|
+
},
|
|
465
|
+
/**
|
|
466
|
+
* {@inheritDoc PluginExtendManager.useExtend}
|
|
467
|
+
*/
|
|
468
|
+
useExtend(t, ...s) {
|
|
469
|
+
return this.pluginManager.instUseExtend(this, t, ...s);
|
|
470
|
+
},
|
|
471
|
+
/**
|
|
472
|
+
* 初始化实例
|
|
473
|
+
* @param args
|
|
474
|
+
*/
|
|
475
|
+
async init(...t) {
|
|
476
|
+
return super.init && await super.init(...t), this.pluginManager.onInit(this, ...t);
|
|
477
|
+
},
|
|
478
|
+
/**
|
|
479
|
+
* 销毁实例
|
|
480
|
+
* @returns
|
|
481
|
+
*/
|
|
482
|
+
async destroy() {
|
|
483
|
+
if (await this.pluginManager.onDestroy(this), super.destroy) return super.destroy();
|
|
484
|
+
}
|
|
485
|
+
}), n;
|
|
486
|
+
}
|
|
487
|
+
function Y(n) {
|
|
488
|
+
const e = T(n);
|
|
489
|
+
return new Proxy(e, {
|
|
490
|
+
construct: function(t, s, r) {
|
|
491
|
+
const i = new t(...s);
|
|
492
|
+
return e.pluginManager.onCreate(this, ...s), i;
|
|
493
|
+
}
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
function L(n) {
|
|
497
|
+
return class extends n {
|
|
498
|
+
/**
|
|
499
|
+
* 是否使用独立的插件管理器
|
|
500
|
+
* @defaultValue false
|
|
501
|
+
*/
|
|
502
|
+
static isolatedPluginManager = !1;
|
|
503
|
+
/**
|
|
504
|
+
* 插件管理器
|
|
505
|
+
*/
|
|
506
|
+
static get pluginManager() {
|
|
507
|
+
return this.isolatedPluginManager && !this.hasOwnProperty("_pluginManager") && (this._pluginManager = new h(this)), this._pluginManager;
|
|
508
|
+
}
|
|
509
|
+
static _pluginManager = new h(this);
|
|
510
|
+
/**
|
|
511
|
+
* 插件管理器 {@link PluginHostExtends.pluginManager}
|
|
512
|
+
*/
|
|
513
|
+
get pluginManager() {
|
|
514
|
+
return this.constructor.pluginManager;
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* {@inheritDoc PluginExtendManager.usePlugin}
|
|
518
|
+
*/
|
|
519
|
+
static usePlugin(t, ...s) {
|
|
520
|
+
return this.pluginManager.usePlugin(t, ...s);
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* {@inheritDoc PluginExtendManager.useExtend}
|
|
524
|
+
*/
|
|
525
|
+
static useExtend(t) {
|
|
526
|
+
return this.pluginManager.useExtend(t);
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* 是否注册了插件 或 扩展
|
|
530
|
+
* @param plugin - 插件 或 扩展
|
|
531
|
+
* @returns 是否注册了插件 或 扩展
|
|
532
|
+
*/
|
|
533
|
+
static hasUsed(t) {
|
|
534
|
+
return this.pluginManager.hasUsed(t);
|
|
535
|
+
}
|
|
536
|
+
constructor(...t) {
|
|
537
|
+
super(...t), this.pluginManager.onCreate(this, ...t);
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* 实例的注册插件的方法
|
|
541
|
+
* @param plugin
|
|
542
|
+
* @param args
|
|
543
|
+
* @returns
|
|
544
|
+
*/
|
|
545
|
+
usePlugin(t, ...s) {
|
|
546
|
+
return this.pluginManager.instUsePlugin(this, t, ...s);
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* {@inheritDoc PluginExtendManager.useExtend}
|
|
550
|
+
*/
|
|
551
|
+
useExtend(t, ...s) {
|
|
552
|
+
return this.pluginManager.instUseExtend(this, t, ...s);
|
|
553
|
+
}
|
|
554
|
+
/**
|
|
555
|
+
* 初始化实例
|
|
556
|
+
* @remarks
|
|
557
|
+
* 会调用 {@link PluginExtendManager.onInit}
|
|
558
|
+
* @param args
|
|
559
|
+
*/
|
|
560
|
+
init(...t) {
|
|
561
|
+
if (super.init) {
|
|
562
|
+
const s = super.init(...t);
|
|
563
|
+
if (s instanceof Promise)
|
|
564
|
+
return s.then(() => this.pluginManager.onInit(this, ...t));
|
|
565
|
+
}
|
|
566
|
+
return this.pluginManager.onInit(this, ...t);
|
|
567
|
+
}
|
|
568
|
+
/**
|
|
569
|
+
* 销毁实例
|
|
570
|
+
* @returns
|
|
571
|
+
*/
|
|
572
|
+
destroy() {
|
|
573
|
+
const t = this.pluginManager.onDestroy(this);
|
|
574
|
+
return super.destroy ? t instanceof Promise ? t.finally(() => super.destroy()) : super.destroy() : t;
|
|
575
|
+
}
|
|
576
|
+
};
|
|
577
|
+
}
|
|
4
578
|
export {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
R as targetExtend,
|
|
57
|
-
U as targetMixin,
|
|
58
|
-
W as tierModeOptionsDecorator,
|
|
59
|
-
X as tierModeOptionsPlugin,
|
|
60
|
-
Y as tierOptionsDecorator,
|
|
61
|
-
Z as tierOptionsPlugin
|
|
579
|
+
W as ExtendManager,
|
|
580
|
+
et as ModeOptions,
|
|
581
|
+
h as PluginExtendManager,
|
|
582
|
+
nt as PluginHost,
|
|
583
|
+
$ as PluginManager,
|
|
584
|
+
d as TierModeOptions,
|
|
585
|
+
st as TierModeOptionsPluginHost,
|
|
586
|
+
f as TierOptions,
|
|
587
|
+
rt as TierOptionsPluginHost,
|
|
588
|
+
A as addDefaultOptions,
|
|
589
|
+
G as addInstOptions,
|
|
590
|
+
T as becomePluginHost,
|
|
591
|
+
L as becomePluginHost_Extends,
|
|
592
|
+
Y as becomePluginHost_Proxy,
|
|
593
|
+
J as becomeTierModeOptionsHost,
|
|
594
|
+
X as becomeTierOptionsHost,
|
|
595
|
+
w as commonModeName,
|
|
596
|
+
N as createDefineExtend,
|
|
597
|
+
v as createDefineMixin,
|
|
598
|
+
S as createExtendTarget,
|
|
599
|
+
k as createMixinTarget,
|
|
600
|
+
it as createPluginHost,
|
|
601
|
+
z as createPropertySetter,
|
|
602
|
+
q as createTargetExtend,
|
|
603
|
+
I as createTargetMixin,
|
|
604
|
+
ot as createTierModeOptionsPluginHost,
|
|
605
|
+
ut as createTierOptionsPluginHost,
|
|
606
|
+
B as defineExtend,
|
|
607
|
+
j as defineMixin,
|
|
608
|
+
at as extendMark,
|
|
609
|
+
F as extendTarget,
|
|
610
|
+
pt as getPropertyValue,
|
|
611
|
+
ct as getPropertyValueByPath,
|
|
612
|
+
b as getTargetProperties,
|
|
613
|
+
gt as isPlugin,
|
|
614
|
+
O as mergeProperties,
|
|
615
|
+
o as mixin,
|
|
616
|
+
C as mixinByOmit,
|
|
617
|
+
U as mixinByPick,
|
|
618
|
+
x as mixinIExtend,
|
|
619
|
+
a as mixinTarget,
|
|
620
|
+
lt as parsePropertyPath,
|
|
621
|
+
dt as pickHostExtendMembers,
|
|
622
|
+
ft as setPropertyValue,
|
|
623
|
+
ht as setPropertyValueByPath,
|
|
624
|
+
V as targetExtend,
|
|
625
|
+
H as targetMixin,
|
|
626
|
+
Ot as tierModeOptionsDecorator,
|
|
627
|
+
Q as tierModeOptionsPlugin,
|
|
628
|
+
Mt as tierOptionsDecorator,
|
|
629
|
+
R as tierOptionsPlugin
|
|
62
630
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-node.d.ts","sourceRoot":"","sources":["../../src/options/index-node.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index-node.d.ts","sourceRoot":"","sources":["../../src/options/index-node.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-web.d.ts","sourceRoot":"","sources":["../../src/options/index-web.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index-web.d.ts","sourceRoot":"","sources":["../../src/options/index-web.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAA"}
|