plugin-tls 4.6.0 → 4.7.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-3jPWAW92.js → createTierModeOptionsPluginHost-D-fKYlcA.js} +202 -188
- package/dist/createTierModeOptionsPluginHost-DyDtXKNW.cjs +1 -0
- 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 +10 -10
- package/dist/index.cjs +1 -1
- package/dist/index.js +146 -120
- package/dist/plugin-manager/ExtendManager.d.ts +15 -5
- package/dist/plugin-manager/ExtendManager.d.ts.map +1 -1
- package/dist/plugin-manager/PluginExtendManager.d.ts +20 -5
- package/dist/plugin-manager/PluginExtendManager.d.ts.map +1 -1
- package/dist/plugin-manager/PluginManager.d.ts +20 -6
- package/dist/plugin-manager/PluginManager.d.ts.map +1 -1
- package/dist/plugin-manager/index.d.ts +1 -0
- package/dist/plugin-manager/index.d.ts.map +1 -1
- package/dist/plugin-manager/type.d.ts +2 -0
- package/dist/plugin-manager/type.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/createTierModeOptionsPluginHost-GosxwlJk.cjs +0 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Destroyable as O } from "@gby/destroyable";
|
|
2
|
-
import { serialCallFuns as
|
|
3
|
-
import { m as a, a as
|
|
4
|
-
import { M as
|
|
5
|
-
|
|
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-D-fKYlcA.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-D-fKYlcA.js";
|
|
5
|
+
import { waitAsyncable as g } from "type-tls";
|
|
6
|
+
function C(s, e) {
|
|
6
7
|
return e;
|
|
7
8
|
}
|
|
8
9
|
function b(s) {
|
|
@@ -10,23 +11,30 @@ function b(s) {
|
|
|
10
11
|
return t;
|
|
11
12
|
};
|
|
12
13
|
}
|
|
13
|
-
function
|
|
14
|
+
function D(s, e) {
|
|
14
15
|
return a(s.prototype, e), e;
|
|
15
16
|
}
|
|
16
|
-
function
|
|
17
|
+
function v(s) {
|
|
17
18
|
return function(t) {
|
|
18
19
|
return a(s.prototype, t), t;
|
|
19
20
|
};
|
|
20
21
|
}
|
|
21
|
-
function
|
|
22
|
+
function H(s, e) {
|
|
22
23
|
return a(s.prototype, e), s;
|
|
23
24
|
}
|
|
24
|
-
function
|
|
25
|
+
function j(s) {
|
|
25
26
|
return function(t) {
|
|
26
27
|
return a(s.prototype, t), s;
|
|
27
28
|
};
|
|
28
29
|
}
|
|
29
30
|
class I extends O {
|
|
31
|
+
/**
|
|
32
|
+
* 父级插件管理者
|
|
33
|
+
*
|
|
34
|
+
* @remarks
|
|
35
|
+
* 当子类创建了子类插件管理者时,为了能让父类插件管理者的插件生效,需要将父类插件管理者设置为其 parent
|
|
36
|
+
*/
|
|
37
|
+
parent;
|
|
30
38
|
/**
|
|
31
39
|
* 插件的宿主
|
|
32
40
|
*/
|
|
@@ -38,8 +46,8 @@ class I extends O {
|
|
|
38
46
|
/**
|
|
39
47
|
* @param host - 插件的宿主
|
|
40
48
|
*/
|
|
41
|
-
constructor(e) {
|
|
42
|
-
super(), e && (this.host = e);
|
|
49
|
+
constructor(e, t) {
|
|
50
|
+
super(), this.parent = t, e && (this.host = e);
|
|
43
51
|
}
|
|
44
52
|
destroyThis() {
|
|
45
53
|
return this.plugins.clear(), this.host = null, super.destroyThis();
|
|
@@ -50,7 +58,16 @@ class I extends O {
|
|
|
50
58
|
* @returns 是否注册了插件
|
|
51
59
|
*/
|
|
52
60
|
hasUsed(e) {
|
|
53
|
-
return this.plugins.has(e);
|
|
61
|
+
return this.parent?.hasUsed(e) || this.plugins.has(e);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* 获取插件 或 扩展 的 use 的返回值
|
|
65
|
+
* @param plugin
|
|
66
|
+
* @returns
|
|
67
|
+
*/
|
|
68
|
+
getUseReturn(e) {
|
|
69
|
+
const { parent: t } = this;
|
|
70
|
+
return t?.hasUsed(e) ? t.getUseReturn(e) : this.plugins.get(e);
|
|
54
71
|
}
|
|
55
72
|
/**
|
|
56
73
|
* 使用插件、注册插件
|
|
@@ -58,10 +75,9 @@ class I extends O {
|
|
|
58
75
|
* @param args - 传递给插件的选项
|
|
59
76
|
*/
|
|
60
77
|
use(e, ...t) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
return n.set(e, r), r;
|
|
78
|
+
if (this.hasUsed(e)) return this.getUseReturn(e);
|
|
79
|
+
const n = e.onUse(this.host, ...t);
|
|
80
|
+
return this.plugins.set(e, n), n;
|
|
65
81
|
}
|
|
66
82
|
/**
|
|
67
83
|
* 插件宿主实例的注册插件的方法
|
|
@@ -72,7 +88,7 @@ class I extends O {
|
|
|
72
88
|
*/
|
|
73
89
|
instUse(e, t, ...n) {
|
|
74
90
|
const { plugins: r } = this;
|
|
75
|
-
if (
|
|
91
|
+
if (this.hasUsed(t)) return this.getUseReturn(t);
|
|
76
92
|
const i = this.use(t, ...n);
|
|
77
93
|
return t.onCreate?.(e), i;
|
|
78
94
|
}
|
|
@@ -85,10 +101,10 @@ class I extends O {
|
|
|
85
101
|
* @param hostInst - 插件宿主的新实例
|
|
86
102
|
*/
|
|
87
103
|
onCreate(e, ...t) {
|
|
88
|
-
const n = [];
|
|
89
|
-
for (const [
|
|
90
|
-
|
|
91
|
-
return g(n, void 0, [e, ...t]);
|
|
104
|
+
const n = this.parent?.onCreate(e, ...t), r = [];
|
|
105
|
+
for (const [i] of this.plugins)
|
|
106
|
+
i.onCreate && r.push(i.onCreate.bind(i));
|
|
107
|
+
return g(n, () => c(r, void 0, [e, ...t]));
|
|
92
108
|
}
|
|
93
109
|
/**
|
|
94
110
|
* 插件宿主创建实例时调用
|
|
@@ -99,10 +115,10 @@ class I extends O {
|
|
|
99
115
|
* @param args - 初始化宿主实例时的参数
|
|
100
116
|
*/
|
|
101
117
|
onInit(e, ...t) {
|
|
102
|
-
const n = [];
|
|
103
|
-
for (const [
|
|
104
|
-
|
|
105
|
-
return g(n, void 0, [e, ...t]);
|
|
118
|
+
const n = this.parent?.onInit(e, ...t), r = [];
|
|
119
|
+
for (const [i] of this.plugins)
|
|
120
|
+
i.onInit && r.push(i.onInit.bind(i));
|
|
121
|
+
return g(n, () => c(r, void 0, [e, ...t]));
|
|
106
122
|
}
|
|
107
123
|
/**
|
|
108
124
|
* 插件宿主被销毁时调用
|
|
@@ -113,12 +129,21 @@ class I extends O {
|
|
|
113
129
|
*/
|
|
114
130
|
onDestroy(e) {
|
|
115
131
|
const t = [];
|
|
116
|
-
for (const [
|
|
117
|
-
|
|
118
|
-
|
|
132
|
+
for (const [i] of this.plugins)
|
|
133
|
+
i.onDestroy && t.push(i.onDestroy.bind(i));
|
|
134
|
+
t.reverse();
|
|
135
|
+
const n = c(t, void 0, [e]), { parent: r } = this;
|
|
136
|
+
return r ? g(n, () => r.onDestroy(e)) : n;
|
|
119
137
|
}
|
|
120
138
|
}
|
|
121
|
-
class
|
|
139
|
+
class R extends O {
|
|
140
|
+
/**
|
|
141
|
+
* 父级插件管理者
|
|
142
|
+
*
|
|
143
|
+
* @remarks
|
|
144
|
+
* 当子类创建了子类插件管理者时,为了能让父类插件管理者的插件生效,需要将父类插件管理者设置为其 parent
|
|
145
|
+
*/
|
|
146
|
+
parent;
|
|
122
147
|
/**
|
|
123
148
|
* 插件的宿主
|
|
124
149
|
*/
|
|
@@ -129,9 +154,10 @@ class H extends O {
|
|
|
129
154
|
plugins = /* @__PURE__ */ new Set();
|
|
130
155
|
/**
|
|
131
156
|
* @param host - 插件的宿主
|
|
157
|
+
* @param parent - 父级插件管理者
|
|
132
158
|
*/
|
|
133
|
-
constructor(e) {
|
|
134
|
-
super(), e && (this.host = e);
|
|
159
|
+
constructor(e, t) {
|
|
160
|
+
super(), this.parent = t, e && (this.host = e);
|
|
135
161
|
}
|
|
136
162
|
destroyThis() {
|
|
137
163
|
return this.plugins.clear(), this.host = null, super.destroyThis();
|
|
@@ -142,7 +168,7 @@ class H extends O {
|
|
|
142
168
|
* @returns 是否注册了插件
|
|
143
169
|
*/
|
|
144
170
|
hasUsed(e) {
|
|
145
|
-
return this.plugins.has(e);
|
|
171
|
+
return this.parent?.hasUsed(e) || this.plugins.has(e);
|
|
146
172
|
}
|
|
147
173
|
/**
|
|
148
174
|
* 使用插件、注册插件
|
|
@@ -150,8 +176,7 @@ class H extends O {
|
|
|
150
176
|
* @returns 返回插件对象本身
|
|
151
177
|
*/
|
|
152
178
|
use(e) {
|
|
153
|
-
|
|
154
|
-
return t.has(e) || (m(this.host.prototype, e), t.add(e)), e;
|
|
179
|
+
return this.hasUsed(e) || (y(this.host.prototype, e), this.plugins.add(e)), e;
|
|
155
180
|
}
|
|
156
181
|
/**
|
|
157
182
|
* 插件宿主实例的注册插件的方法
|
|
@@ -161,8 +186,7 @@ class H extends O {
|
|
|
161
186
|
* @param hostInst - 插件宿主的新实例
|
|
162
187
|
*/
|
|
163
188
|
instUse(e, t, ...n) {
|
|
164
|
-
|
|
165
|
-
return r.has(t) || (this.use(t), t.onCreate?.call(e, e, ...n)), t;
|
|
189
|
+
return this.hasUsed(t) || (this.use(t), t.onCreate?.call(e, e, ...n)), t;
|
|
166
190
|
}
|
|
167
191
|
/**
|
|
168
192
|
* 插件宿主创建实例时调用
|
|
@@ -173,10 +197,10 @@ class H extends O {
|
|
|
173
197
|
* @param hostInst - 插件宿主的新实例
|
|
174
198
|
*/
|
|
175
199
|
onCreate(e, ...t) {
|
|
176
|
-
const n = [];
|
|
177
|
-
for (const
|
|
178
|
-
|
|
179
|
-
return g(n, e, [e, ...t]);
|
|
200
|
+
const n = this.parent?.onCreate(e, ...t), r = [];
|
|
201
|
+
for (const i of this.plugins)
|
|
202
|
+
i.onCreate && r.push(i.onCreate);
|
|
203
|
+
return g(n, () => c(r, e, [e, ...t]));
|
|
180
204
|
}
|
|
181
205
|
/**
|
|
182
206
|
* 插件宿主创建实例时调用
|
|
@@ -187,10 +211,10 @@ class H extends O {
|
|
|
187
211
|
* @param args - 初始化宿主实例时的参数
|
|
188
212
|
*/
|
|
189
213
|
onInit(e, ...t) {
|
|
190
|
-
const n = [];
|
|
191
|
-
for (const
|
|
192
|
-
|
|
193
|
-
return g(n, e, [e, ...t]);
|
|
214
|
+
const n = this.parent?.onInit(e, ...t), r = [];
|
|
215
|
+
for (const i of this.plugins)
|
|
216
|
+
i.onInit && r.push(i.onInit);
|
|
217
|
+
return g(n, () => c(r, e, [e, ...t]));
|
|
194
218
|
}
|
|
195
219
|
/**
|
|
196
220
|
* 插件宿主被销毁时调用
|
|
@@ -201,12 +225,14 @@ class H extends O {
|
|
|
201
225
|
*/
|
|
202
226
|
onDestroy(e) {
|
|
203
227
|
const t = [];
|
|
204
|
-
for (const
|
|
205
|
-
|
|
206
|
-
|
|
228
|
+
for (const i of this.plugins)
|
|
229
|
+
i.onDestroy && t.push(i.onDestroy);
|
|
230
|
+
t.reverse();
|
|
231
|
+
const n = c(t, e, [e]), { parent: r } = this;
|
|
232
|
+
return r ? g(n, () => r.onDestroy(e)) : n;
|
|
207
233
|
}
|
|
208
234
|
}
|
|
209
|
-
function
|
|
235
|
+
function m(s, e) {
|
|
210
236
|
const t = [{ target: s, props: e }];
|
|
211
237
|
let n;
|
|
212
238
|
for (; n = t.shift(); ) {
|
|
@@ -221,32 +247,32 @@ function M(s, e) {
|
|
|
221
247
|
}
|
|
222
248
|
return s;
|
|
223
249
|
}
|
|
224
|
-
function
|
|
250
|
+
function x(s, e) {
|
|
225
251
|
const t = {}, n = [{ target: s, props: e, targetProps: t }];
|
|
226
252
|
let r;
|
|
227
253
|
for (; r = n.shift(); ) {
|
|
228
254
|
const { target: i, props: p, targetProps: o } = r;
|
|
229
|
-
for (const [
|
|
230
|
-
if (
|
|
231
|
-
n.push({ target: i[
|
|
255
|
+
for (const [h, l] of Object.entries(p)) {
|
|
256
|
+
if (l != null && typeof l == "object" && (!l.constructor || l.constructor === Object)) {
|
|
257
|
+
n.push({ target: i[h], props: l, targetProps: o[h] = {} });
|
|
232
258
|
continue;
|
|
233
259
|
}
|
|
234
|
-
o[
|
|
260
|
+
o[h] = i[h];
|
|
235
261
|
}
|
|
236
262
|
}
|
|
237
263
|
return t;
|
|
238
264
|
}
|
|
239
|
-
function
|
|
240
|
-
const t =
|
|
265
|
+
function k(s, e) {
|
|
266
|
+
const t = x(s, e);
|
|
241
267
|
function n() {
|
|
242
|
-
|
|
268
|
+
m(s, e);
|
|
243
269
|
}
|
|
244
270
|
function r() {
|
|
245
|
-
|
|
271
|
+
m(s, t);
|
|
246
272
|
}
|
|
247
273
|
return { set: n, unset: r };
|
|
248
274
|
}
|
|
249
|
-
function
|
|
275
|
+
function B(s, e) {
|
|
250
276
|
const t = e ?? "defaultOptions", n = `_${t}`;
|
|
251
277
|
return function(i) {
|
|
252
278
|
const p = u(i, {
|
|
@@ -267,7 +293,7 @@ function k(s, e) {
|
|
|
267
293
|
});
|
|
268
294
|
};
|
|
269
295
|
}
|
|
270
|
-
function
|
|
296
|
+
function N(s, e, t) {
|
|
271
297
|
const n = `_${e}`;
|
|
272
298
|
return u(s.prototype, {
|
|
273
299
|
/**
|
|
@@ -278,7 +304,7 @@ function B(s, e, t) {
|
|
|
278
304
|
}
|
|
279
305
|
}), t;
|
|
280
306
|
}
|
|
281
|
-
function
|
|
307
|
+
function V(s, e, t) {
|
|
282
308
|
const n = u(s, {
|
|
283
309
|
/**
|
|
284
310
|
* 全局级别的默认选项
|
|
@@ -303,7 +329,7 @@ function N(s, e, t) {
|
|
|
303
329
|
}
|
|
304
330
|
}), s;
|
|
305
331
|
}
|
|
306
|
-
const
|
|
332
|
+
const q = {
|
|
307
333
|
onUse(s, e, t) {
|
|
308
334
|
const n = e ?? P;
|
|
309
335
|
a(s, {
|
|
@@ -336,19 +362,19 @@ const V = {
|
|
|
336
362
|
onCreate(s, e) {
|
|
337
363
|
s.modeOptions.setOption(e);
|
|
338
364
|
}
|
|
339
|
-
},
|
|
365
|
+
}, F = {
|
|
340
366
|
onUse(s, e, t) {
|
|
341
367
|
a(s, {
|
|
342
368
|
/**
|
|
343
369
|
* 全局级别的默认选项
|
|
344
370
|
*/
|
|
345
|
-
defaultOptions: new
|
|
371
|
+
defaultOptions: new f(e, t)
|
|
346
372
|
}), a(s.prototype, {
|
|
347
373
|
/**
|
|
348
374
|
* 实例级的默认选项
|
|
349
375
|
*/
|
|
350
376
|
get defaultOptions() {
|
|
351
|
-
return this._defaultOptions || (this._defaultOptions = new
|
|
377
|
+
return this._defaultOptions || (this._defaultOptions = new f(void 0, s.defaultOptions));
|
|
352
378
|
}
|
|
353
379
|
});
|
|
354
380
|
},
|
|
@@ -356,23 +382,23 @@ const V = {
|
|
|
356
382
|
s.defaultOptions.option = e;
|
|
357
383
|
}
|
|
358
384
|
};
|
|
359
|
-
function
|
|
385
|
+
function A(s, e) {
|
|
360
386
|
const t = u(s, {
|
|
361
387
|
/**
|
|
362
388
|
* 全局级别的默认选项
|
|
363
389
|
*/
|
|
364
|
-
defaultOptions: new
|
|
390
|
+
defaultOptions: new f(e)
|
|
365
391
|
});
|
|
366
392
|
return u(t.prototype, {
|
|
367
393
|
/**
|
|
368
394
|
* 实例级的默认选项
|
|
369
395
|
*/
|
|
370
396
|
get defaultOptions() {
|
|
371
|
-
return this._defaultOptions || (this._defaultOptions = new
|
|
397
|
+
return this._defaultOptions || (this._defaultOptions = new f(void 0, this.constructor.defaultOptions));
|
|
372
398
|
}
|
|
373
399
|
}), s;
|
|
374
400
|
}
|
|
375
|
-
function
|
|
401
|
+
function T(s) {
|
|
376
402
|
const e = u(s, {
|
|
377
403
|
/**
|
|
378
404
|
* 是否使用独立的插件管理器
|
|
@@ -383,7 +409,7 @@ function x(s) {
|
|
|
383
409
|
* PluginHost 的插件管理器
|
|
384
410
|
*/
|
|
385
411
|
get pluginManager() {
|
|
386
|
-
return (!this._pluginManager || this.isolatedPluginManager && !this.hasOwnProperty("_pluginManager")) && (this._pluginManager = new
|
|
412
|
+
return (!this._pluginManager || this.isolatedPluginManager && !this.hasOwnProperty("_pluginManager")) && (this._pluginManager = new M(this, this._pluginManager)), this._pluginManager;
|
|
387
413
|
},
|
|
388
414
|
// _pluginManager: PluginManager<HOST,Plugin>;
|
|
389
415
|
/**
|
|
@@ -446,7 +472,7 @@ function x(s) {
|
|
|
446
472
|
}), s;
|
|
447
473
|
}
|
|
448
474
|
function S(s) {
|
|
449
|
-
const e =
|
|
475
|
+
const e = T(s);
|
|
450
476
|
return new Proxy(e, {
|
|
451
477
|
construct: function(t, n, r) {
|
|
452
478
|
const i = new t(...n);
|
|
@@ -465,9 +491,9 @@ function z(s) {
|
|
|
465
491
|
* 插件管理器
|
|
466
492
|
*/
|
|
467
493
|
static get pluginManager() {
|
|
468
|
-
return this.isolatedPluginManager && !this.hasOwnProperty("_pluginManager") && (this._pluginManager = new
|
|
494
|
+
return this.isolatedPluginManager && !this.hasOwnProperty("_pluginManager") && (this._pluginManager = new M(this, this._pluginManager)), this._pluginManager;
|
|
469
495
|
}
|
|
470
|
-
static _pluginManager = new
|
|
496
|
+
static _pluginManager = new M(this);
|
|
471
497
|
/**
|
|
472
498
|
* 插件管理器 {@link PluginHostExtends.pluginManager}
|
|
473
499
|
*/
|
|
@@ -537,61 +563,61 @@ function z(s) {
|
|
|
537
563
|
};
|
|
538
564
|
}
|
|
539
565
|
export {
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
566
|
+
R as ExtendManager,
|
|
567
|
+
J as ModeOptions,
|
|
568
|
+
M as PluginExtendManager,
|
|
569
|
+
Q as PluginHost,
|
|
544
570
|
I as PluginManager,
|
|
545
571
|
d as TierModeOptions,
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
572
|
+
X as TierModeOptionsPluginHost,
|
|
573
|
+
f as TierOptions,
|
|
574
|
+
Y as TierOptionsPluginHost,
|
|
575
|
+
B as addDefaultOptions,
|
|
576
|
+
N as addInstOptions,
|
|
577
|
+
T as becomePluginHost,
|
|
552
578
|
z as becomePluginHost_Extends,
|
|
553
579
|
S as becomePluginHost_Proxy,
|
|
554
|
-
|
|
555
|
-
|
|
580
|
+
V as becomeTierModeOptionsHost,
|
|
581
|
+
A as becomeTierOptionsHost,
|
|
556
582
|
P as commonModeName,
|
|
557
583
|
b as createDefineExtend,
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
584
|
+
Z as createDefineIExtend,
|
|
585
|
+
L as createDefineMixin,
|
|
586
|
+
j as createExtendTarget,
|
|
587
|
+
K as createIExtendTarget,
|
|
588
|
+
tt as createMixinTarget,
|
|
589
|
+
et as createPluginHost,
|
|
590
|
+
k as createPropertySetter,
|
|
591
|
+
v as createTargetExtend,
|
|
592
|
+
nt as createTargetIExtend,
|
|
593
|
+
st as createTargetMixin,
|
|
594
|
+
rt as createTierModeOptionsPluginHost,
|
|
595
|
+
it as createTierOptionsPluginHost,
|
|
596
|
+
C as defineExtend,
|
|
597
|
+
ot as defineIExtend,
|
|
598
|
+
ut as defineMixin,
|
|
599
|
+
at as extendMark,
|
|
600
|
+
H as extendTarget,
|
|
601
|
+
pt as getPropertyValue,
|
|
602
|
+
ct as getPropertyValueByPath,
|
|
603
|
+
x as getTargetProperties,
|
|
604
|
+
gt as iextendTarget,
|
|
605
|
+
lt as isPlugin,
|
|
606
|
+
m as mergeProperties,
|
|
581
607
|
a as mixin,
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
608
|
+
ht as mixinByOmit,
|
|
609
|
+
dt as mixinByPick,
|
|
610
|
+
y as mixinIExtend,
|
|
585
611
|
u as mixinTarget,
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
612
|
+
ft as parsePropertyPath,
|
|
613
|
+
Mt as pickHostExtendMembers,
|
|
614
|
+
mt as setPropertyValue,
|
|
615
|
+
Ot as setPropertyValueByPath,
|
|
616
|
+
D as targetExtend,
|
|
617
|
+
yt as targetIExtend,
|
|
618
|
+
Pt as targetMixin,
|
|
619
|
+
xt as tierModeOptionsDecorator,
|
|
620
|
+
q as tierModeOptionsPlugin,
|
|
621
|
+
Tt as tierOptionsDecorator,
|
|
622
|
+
F as tierOptionsPlugin
|
|
597
623
|
};
|
|
@@ -1,15 +1,24 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AbstractConstructor } from "type-tls";
|
|
2
2
|
import { Destroyable } from "@gby/destroyable";
|
|
3
3
|
import type { IExtend, AnyIExtend } from "./IExtend";
|
|
4
4
|
import type { ExtendOptions } from "./extend";
|
|
5
|
+
import type { AsyncableArray } from "./type";
|
|
5
6
|
/**
|
|
6
7
|
* 插件管理者
|
|
7
8
|
*
|
|
8
9
|
* @remarks
|
|
9
10
|
* 负责管理插件的注册、应用 等
|
|
11
|
+
* 支持插件的级联(通过 parent):当子类创建了子类插件管理者时,为了能让父类插件管理者的插件生效,需要将父类插件管理者设置为其 parent
|
|
10
12
|
*
|
|
11
13
|
*/
|
|
12
14
|
export declare class ExtendManager<HostClass extends AbstractConstructor> extends Destroyable {
|
|
15
|
+
/**
|
|
16
|
+
* 父级插件管理者
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* 当子类创建了子类插件管理者时,为了能让父类插件管理者的插件生效,需要将父类插件管理者设置为其 parent
|
|
20
|
+
*/
|
|
21
|
+
parent?: ExtendManager<HostClass> | null;
|
|
13
22
|
/**
|
|
14
23
|
* 插件的宿主
|
|
15
24
|
*/
|
|
@@ -20,8 +29,9 @@ export declare class ExtendManager<HostClass extends AbstractConstructor> extend
|
|
|
20
29
|
readonly plugins: Set<IExtend<HostClass>>;
|
|
21
30
|
/**
|
|
22
31
|
* @param host - 插件的宿主
|
|
32
|
+
* @param parent - 父级插件管理者
|
|
23
33
|
*/
|
|
24
|
-
constructor(host?: HostClass);
|
|
34
|
+
constructor(host?: HostClass, parent?: ExtendManager<HostClass> | null);
|
|
25
35
|
destroyThis(): any;
|
|
26
36
|
/**
|
|
27
37
|
* 是否注册了插件
|
|
@@ -51,7 +61,7 @@ export declare class ExtendManager<HostClass extends AbstractConstructor> extend
|
|
|
51
61
|
* 如果插件的 created 方法返回 Promise,则会等待 Promise resolve
|
|
52
62
|
* @param hostInst - 插件宿主的新实例
|
|
53
63
|
*/
|
|
54
|
-
onCreate(hostInst: InstanceType<HostClass>, ...args: ConstructorParameters<HostClass>):
|
|
64
|
+
onCreate(hostInst: InstanceType<HostClass>, ...args: ConstructorParameters<HostClass>): AsyncableArray;
|
|
55
65
|
/**
|
|
56
66
|
* 插件宿主创建实例时调用
|
|
57
67
|
*
|
|
@@ -60,7 +70,7 @@ export declare class ExtendManager<HostClass extends AbstractConstructor> extend
|
|
|
60
70
|
* @param hostInst - 插件宿主的新实例
|
|
61
71
|
* @param args - 初始化宿主实例时的参数
|
|
62
72
|
*/
|
|
63
|
-
onInit(hostInst: InstanceType<HostClass>, ...args: any):
|
|
73
|
+
onInit(hostInst: InstanceType<HostClass>, ...args: any): AsyncableArray;
|
|
64
74
|
/**
|
|
65
75
|
* 插件宿主被销毁时调用
|
|
66
76
|
*
|
|
@@ -68,6 +78,6 @@ export declare class ExtendManager<HostClass extends AbstractConstructor> extend
|
|
|
68
78
|
* 会调用每个插件的 {@link IExtend.onDestroy} 方法
|
|
69
79
|
* @param hostInst - 被销毁的插件实例
|
|
70
80
|
*/
|
|
71
|
-
onDestroy(hostInst: InstanceType<HostClass>):
|
|
81
|
+
onDestroy(hostInst: InstanceType<HostClass>): AsyncableArray;
|
|
72
82
|
}
|
|
73
83
|
//# sourceMappingURL=ExtendManager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExtendManager.d.ts","sourceRoot":"","sources":["../../src/plugin-manager/ExtendManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"ExtendManager.d.ts","sourceRoot":"","sources":["../../src/plugin-manager/ExtendManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG/C,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAE7C;;;;;;;GAOG;AACH,qBAAa,aAAa,CAAC,SAAS,SAAS,mBAAmB,CAAE,SAAQ,WAAW;IAEjF;;;;;OAKG;IACH,MAAM,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;IAEzC;;OAEG;IACH,IAAI,EAAG,SAAS,CAAC;IAEjB;;OAEG;IACH,QAAQ,CAAC,OAAO,0BAAiC;IAIjD;;;OAGG;gBACS,IAAI,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,GAAG,IAAI;IAQ7D,WAAW;IAMpB;;;;OAIG;IACH,OAAO,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO;IAI7B;;;;OAIG;IACH,GAAG,CAAC,CAAC,SAAS,UAAU,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC;IAO5E;;;;;;OAMG;IACH,OAAO,CAAC,CAAC,SAAS,UAAU,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,YAAY,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,SAAS,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,qBAAqB,CAAC,SAAS,CAAC,GAAG,CAAC;IAO9J;;;;;;;OAOG;IACH,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC,SAAS,CAAC,EAAE,GAAG,IAAI,EAAE,qBAAqB,CAAC,SAAS,CAAC,GAAG,cAAc;IActG;;;;;;;OAOG;IACH,MAAM,CAAC,QAAQ,EAAE,YAAY,CAAC,SAAS,CAAC,EAAE,GAAG,IAAI,EAAE,GAAG,GAAE,cAAc;IAatE;;;;;;OAMG;IACH,SAAS,CAAC,QAAQ,EAAE,YAAY,CAAC,SAAS,CAAC,GAAE,cAAc;CAe9D"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type AbstractConstructor, type ClassType } from "type-tls";
|
|
2
2
|
import { Destroyable } from "@gby/destroyable";
|
|
3
3
|
import type { IExtend, AnyIExtend } from "./IExtend";
|
|
4
4
|
import type { AnyIPlugin, IPlugin, PluginUseArgs, PluginUseReturn } from "./IPlugin";
|
|
5
5
|
import type { ExtendOptions } from "./extend";
|
|
6
|
+
import type { AsyncableArray } from "./type";
|
|
6
7
|
/**
|
|
7
8
|
* 用于标识是扩展的标记
|
|
8
9
|
*/
|
|
@@ -13,9 +14,17 @@ export declare const extendMark: unique symbol;
|
|
|
13
14
|
* @remarks
|
|
14
15
|
* 负责管理插件 和 扩展的注册、应用 等
|
|
15
16
|
* 相当于 PluginManager + ExtendManager
|
|
17
|
+
* 支持插件的级联(通过 parent):当子类创建了子类插件管理者时,为了能让父类插件管理者的插件生效,需要将父类插件管理者设置为其 parent
|
|
16
18
|
*
|
|
17
19
|
*/
|
|
18
20
|
export declare class PluginExtendManager<Host, HostClass extends AbstractConstructor<Host> = ClassType<Host>> extends Destroyable {
|
|
21
|
+
/**
|
|
22
|
+
* 父级插件管理者
|
|
23
|
+
*
|
|
24
|
+
* @remarks
|
|
25
|
+
* 当子类创建了子类插件管理者时,为了能让父类插件管理者的插件生效,需要将父类插件管理者设置为其 parent
|
|
26
|
+
*/
|
|
27
|
+
parent?: PluginExtendManager<Host, HostClass> | null;
|
|
19
28
|
/**
|
|
20
29
|
* 插件的宿主
|
|
21
30
|
*/
|
|
@@ -27,7 +36,7 @@ export declare class PluginExtendManager<Host, HostClass extends AbstractConstru
|
|
|
27
36
|
/**
|
|
28
37
|
* @param host - 插件的宿主
|
|
29
38
|
*/
|
|
30
|
-
constructor(host?: HostClass);
|
|
39
|
+
constructor(host?: HostClass, parent?: PluginExtendManager<Host, HostClass> | null);
|
|
31
40
|
destroyThis(): any;
|
|
32
41
|
/**
|
|
33
42
|
* 是否注册了插件 或 扩展
|
|
@@ -35,6 +44,12 @@ export declare class PluginExtendManager<Host, HostClass extends AbstractConstru
|
|
|
35
44
|
* @returns 是否注册了插件 或 扩展
|
|
36
45
|
*/
|
|
37
46
|
hasUsed(plugin: any): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* 获取插件 或 扩展 的 use 的返回值
|
|
49
|
+
* @param plugin
|
|
50
|
+
* @returns
|
|
51
|
+
*/
|
|
52
|
+
getUseReturn(plugin: any): any;
|
|
38
53
|
/**
|
|
39
54
|
* 判断一个对象是否是插件
|
|
40
55
|
* @param target
|
|
@@ -77,7 +92,7 @@ export declare class PluginExtendManager<Host, HostClass extends AbstractConstru
|
|
|
77
92
|
* 如果插件的 created 方法返回 Promise,则会等待 Promise resolve
|
|
78
93
|
* @param hostInst - 插件宿主的新实例
|
|
79
94
|
*/
|
|
80
|
-
onCreate(hostInst: Host, ...args: any):
|
|
95
|
+
onCreate(hostInst: Host, ...args: any): AsyncableArray;
|
|
81
96
|
/**
|
|
82
97
|
* 插件宿主创建实例时调用
|
|
83
98
|
*
|
|
@@ -86,7 +101,7 @@ export declare class PluginExtendManager<Host, HostClass extends AbstractConstru
|
|
|
86
101
|
* @param hostInst - 插件宿主的新实例
|
|
87
102
|
* @param args - 初始化宿主实例时的参数
|
|
88
103
|
*/
|
|
89
|
-
onInit(hostInst: Host, ...args: any):
|
|
104
|
+
onInit(hostInst: Host, ...args: any): AsyncableArray;
|
|
90
105
|
/**
|
|
91
106
|
* 插件宿主被销毁时调用
|
|
92
107
|
*
|
|
@@ -94,6 +109,6 @@ export declare class PluginExtendManager<Host, HostClass extends AbstractConstru
|
|
|
94
109
|
* 会调用每个插件的 {@link IPlugin.onDestroy} 方法
|
|
95
110
|
* @param hostInst - 被销毁的插件实例
|
|
96
111
|
*/
|
|
97
|
-
onDestroy(hostInst: Host):
|
|
112
|
+
onDestroy(hostInst: Host): AsyncableArray;
|
|
98
113
|
}
|
|
99
114
|
//# sourceMappingURL=PluginExtendManager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginExtendManager.d.ts","sourceRoot":"","sources":["../../src/plugin-manager/PluginExtendManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"PluginExtendManager.d.ts","sourceRoot":"","sources":["../../src/plugin-manager/PluginExtendManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,mBAAmB,EAAE,KAAK,SAAS,EAAiB,MAAM,UAAU,CAAC;AACrG,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG/C,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAErD,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACrF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAG7C;;GAEG;AACH,eAAO,MAAM,UAAU,eAAmB,CAAC;AAG3C;;;;;;;;GAQG;AACH,qBAAa,mBAAmB,CAAC,IAAI,EAAC,SAAS,SAAS,mBAAmB,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,CAAE,SAAQ,WAAW;IAEpH;;;;;OAKG;IACH,MAAM,CAAC,EAAE,mBAAmB,CAAC,IAAI,EAAC,SAAS,CAAC,GAAG,IAAI,CAAC;IAEpD;;OAEG;IACH,IAAI,EAAG,SAAS,CAAC;IAEjB;;OAEG;IACH,QAAQ,CAAC,OAAO,0DAA6D;IAG7E;;OAEG;gBACS,IAAI,CAAC,EAAE,SAAS,EAAC,MAAM,CAAC,EAAE,mBAAmB,CAAC,IAAI,EAAC,SAAS,CAAC,GAAG,IAAI;IAQvE,WAAW;IAMpB;;;;OAIG;IACH,OAAO,CAAC,MAAM,EAAE,GAAG,GAAE,OAAO;IAK5B;;;;OAIG;IACH,YAAY,CAAC,MAAM,EAAE,GAAG,GAAE,GAAG;IAS7B;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,IAAI,OAAO,CAAC,IAAI,EAAC,SAAS,CAAC;IAOxD;;;;OAIG;IACH,SAAS,CAAC,CAAC,SAAS,UAAU,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,aAAa,CAAC,SAAS,EAAE,CAAC,CAAC,GAAE,CAAC;IAO9E;;;;;;OAMG;IACH,aAAa,CAAC,CAAC,SAAS,UAAU,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,YAAY,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,aAAa,CAAC,SAAS,EAAE,CAAC,CAAC,EAAG,GAAG,IAAI,EAAC,qBAAqB,CAAC,SAAS,CAAC,GAAE,CAAC;IAOhK;;;;OAIG;IACH,SAAS,CAAC,CAAC,SAAS,UAAU,CAAC,IAAI,EAAC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC,EAAC,GAAG,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC;IAOxG;;;;;;OAMG;IACH,aAAa,CAAC,CAAC,SAAS,UAAU,CAAC,IAAI,EAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC;IAShI;;;;;;;OAOG;IACH,QAAQ,CAAC,QAAQ,EAAE,IAAI,EAAG,GAAG,IAAI,EAAC,GAAG,GAAE,cAAc;IAarD;;;;;;;OAOG;IACH,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAC,GAAG,IAAI,EAAC,GAAG,GAAE,cAAc;IAajD;;;;;;OAMG;IACH,SAAS,CAAC,QAAQ,EAAE,IAAI,GAAE,cAAc;CAgB3C"}
|