@webiny/plugins 6.3.0 → 6.4.0-beta.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/AsyncPluginsContainer.js +28 -27
- package/AsyncPluginsContainer.js.map +1 -1
- package/Plugin.js +7 -8
- package/Plugin.js.map +1 -1
- package/PluginsContainer.js +67 -91
- package/PluginsContainer.js.map +1 -1
- package/index.js +3 -3
- package/index.js.map +1 -1
- package/package.json +4 -4
- package/types.js +0 -2
- package/types.js.map +0 -1
package/AsyncPluginsContainer.js
CHANGED
|
@@ -1,33 +1,34 @@
|
|
|
1
1
|
import { PluginsContainer } from "./types.js";
|
|
2
|
-
const isPluginLoader = value
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
constructor(plugins) {
|
|
7
|
-
this.plugins = plugins instanceof PluginsContainer ? plugins.all() : plugins;
|
|
8
|
-
}
|
|
9
|
-
async init() {
|
|
10
|
-
if (this.pluginsContainer) {
|
|
11
|
-
return this.pluginsContainer;
|
|
2
|
+
const isPluginLoader = (value)=>"function" == typeof value;
|
|
3
|
+
class AsyncPluginsContainer {
|
|
4
|
+
constructor(plugins){
|
|
5
|
+
this.plugins = plugins instanceof PluginsContainer ? plugins.all() : plugins;
|
|
12
6
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
7
|
+
async init() {
|
|
8
|
+
if (this.pluginsContainer) return this.pluginsContainer;
|
|
9
|
+
const plugins = await this.traverseAndLoadPlugins(this.plugins);
|
|
10
|
+
this.pluginsContainer = new PluginsContainer(plugins);
|
|
11
|
+
return this.pluginsContainer;
|
|
12
|
+
}
|
|
13
|
+
async traverseAndLoadPlugins(plugins) {
|
|
14
|
+
if (!Array.isArray(plugins)) return [
|
|
15
|
+
plugins
|
|
16
|
+
];
|
|
17
|
+
return plugins.reduce((acc, item)=>acc.then(async (plugins)=>{
|
|
18
|
+
if (isPluginLoader(item)) {
|
|
19
|
+
const lazyPlugins = await item();
|
|
20
|
+
return [
|
|
21
|
+
...plugins,
|
|
22
|
+
...await this.traverseAndLoadPlugins(lazyPlugins)
|
|
23
|
+
];
|
|
24
|
+
}
|
|
25
|
+
return [
|
|
26
|
+
...plugins,
|
|
27
|
+
...await this.traverseAndLoadPlugins(item)
|
|
28
|
+
];
|
|
29
|
+
}), Promise.resolve([]));
|
|
20
30
|
}
|
|
21
|
-
return plugins.reduce((acc, item) => {
|
|
22
|
-
return acc.then(async plugins => {
|
|
23
|
-
if (isPluginLoader(item)) {
|
|
24
|
-
const lazyPlugins = await item();
|
|
25
|
-
return [...plugins, ...(await this.traverseAndLoadPlugins(lazyPlugins))];
|
|
26
|
-
}
|
|
27
|
-
return [...plugins, ...(await this.traverseAndLoadPlugins(item))];
|
|
28
|
-
});
|
|
29
|
-
}, Promise.resolve([]));
|
|
30
|
-
}
|
|
31
31
|
}
|
|
32
|
+
export { AsyncPluginsContainer };
|
|
32
33
|
|
|
33
34
|
//# sourceMappingURL=AsyncPluginsContainer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"AsyncPluginsContainer.js","sources":["../src/AsyncPluginsContainer.ts"],"sourcesContent":["import type { Plugin, PluginCollection, PluginFactory } from \"~/types.js\";\nimport { PluginsContainer } from \"~/types.js\";\n\nconst isPluginLoader = (value: unknown): value is PluginFactory => {\n return typeof value === \"function\";\n};\n\nexport class AsyncPluginsContainer {\n private readonly plugins: PluginCollection;\n private pluginsContainer: PluginsContainer | undefined;\n\n constructor(plugins: PluginCollection | PluginsContainer) {\n this.plugins = plugins instanceof PluginsContainer ? plugins.all() : plugins;\n }\n\n async init() {\n if (this.pluginsContainer) {\n return this.pluginsContainer;\n }\n\n const plugins = await this.traverseAndLoadPlugins(this.plugins);\n this.pluginsContainer = new PluginsContainer(plugins);\n\n return this.pluginsContainer;\n }\n\n private async traverseAndLoadPlugins(plugins: Plugin | PluginCollection): Promise<Plugin[]> {\n if (!Array.isArray(plugins)) {\n return [plugins];\n }\n\n return plugins.reduce<Promise<Plugin[]>>((acc, item) => {\n return acc.then(async plugins => {\n if (isPluginLoader(item)) {\n const lazyPlugins = await item();\n return [...plugins, ...(await this.traverseAndLoadPlugins(lazyPlugins))];\n }\n\n return [...plugins, ...(await this.traverseAndLoadPlugins(item))];\n });\n }, Promise.resolve([]));\n }\n}\n"],"names":["isPluginLoader","value","AsyncPluginsContainer","plugins","PluginsContainer","Array","acc","item","lazyPlugins","Promise"],"mappings":";AAGA,MAAMA,iBAAiB,CAACC,QACb,AAAiB,cAAjB,OAAOA;AAGX,MAAMC;IAIT,YAAYC,OAA4C,CAAE;QACtD,IAAI,CAAC,OAAO,GAAGA,mBAAmBC,mBAAmBD,QAAQ,GAAG,KAAKA;IACzE;IAEA,MAAM,OAAO;QACT,IAAI,IAAI,CAAC,gBAAgB,EACrB,OAAO,IAAI,CAAC,gBAAgB;QAGhC,MAAMA,UAAU,MAAM,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,OAAO;QAC9D,IAAI,CAAC,gBAAgB,GAAG,IAAIC,iBAAiBD;QAE7C,OAAO,IAAI,CAAC,gBAAgB;IAChC;IAEA,MAAc,uBAAuBA,OAAkC,EAAqB;QACxF,IAAI,CAACE,MAAM,OAAO,CAACF,UACf,OAAO;YAACA;SAAQ;QAGpB,OAAOA,QAAQ,MAAM,CAAoB,CAACG,KAAKC,OACpCD,IAAI,IAAI,CAAC,OAAMH;gBAClB,IAAIH,eAAeO,OAAO;oBACtB,MAAMC,cAAc,MAAMD;oBAC1B,OAAO;2BAAIJ;2BAAa,MAAM,IAAI,CAAC,sBAAsB,CAACK;qBAAc;gBAC5E;gBAEA,OAAO;uBAAIL;uBAAa,MAAM,IAAI,CAAC,sBAAsB,CAACI;iBAAO;YACrE,IACDE,QAAQ,OAAO,CAAC,EAAE;IACzB;AACJ"}
|
package/Plugin.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
class Plugin {
|
|
2
|
+
constructor(){
|
|
3
|
+
if (!this.constructor.type) throw Error(`Missing "type" definition in "${this.constructor.name}"!`);
|
|
4
|
+
}
|
|
5
|
+
get type() {
|
|
6
|
+
return this.constructor.type;
|
|
5
7
|
}
|
|
6
|
-
}
|
|
7
|
-
get type() {
|
|
8
|
-
return this.constructor.type;
|
|
9
|
-
}
|
|
10
8
|
}
|
|
9
|
+
export { Plugin };
|
|
11
10
|
|
|
12
11
|
//# sourceMappingURL=Plugin.js.map
|
package/Plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"Plugin.js","sources":["../src/Plugin.ts"],"sourcesContent":["export abstract class Plugin {\n public static readonly type: string;\n public name?: string;\n\n constructor() {\n if (!(this.constructor as typeof Plugin).type) {\n throw Error(`Missing \"type\" definition in \"${this.constructor.name}\"!`);\n }\n }\n\n get type() {\n return (this.constructor as typeof Plugin).type;\n }\n}\n"],"names":["Plugin","Error"],"mappings":"AAAO,MAAeA;IAIlB,aAAc;QACV,IAAI,CAAE,IAAI,CAAC,WAAW,CAAmB,IAAI,EACzC,MAAMC,MAAM,CAAC,8BAA8B,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;IAE9E;IAEA,IAAI,OAAO;QACP,OAAQ,IAAI,CAAC,WAAW,CAAmB,IAAI;IACnD;AACJ"}
|
package/PluginsContainer.js
CHANGED
|
@@ -1,106 +1,82 @@
|
|
|
1
1
|
import uniqid from "uniqid";
|
|
2
|
-
const isOptionsObject = item
|
|
3
|
-
const normalizeArgs = args
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return [args, options];
|
|
2
|
+
const isOptionsObject = (item)=>item && !Array.isArray(item) && !item.type && !item.name;
|
|
3
|
+
const normalizeArgs = (args)=>{
|
|
4
|
+
let options = {};
|
|
5
|
+
if (isOptionsObject(args[args.length - 1])) [options] = args.splice(-1, 1);
|
|
6
|
+
return [
|
|
7
|
+
args,
|
|
8
|
+
options
|
|
9
|
+
];
|
|
11
10
|
};
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
const PluginsContainer_assign = (plugins, options, target)=>{
|
|
12
|
+
for (const plugin of plugins){
|
|
13
|
+
if (Array.isArray(plugin)) {
|
|
14
|
+
PluginsContainer_assign(plugin, options, target);
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
if ("object" != typeof plugin) throw new Error(`Could not register plugin. Expected an object, but got ${typeof plugin}.`);
|
|
18
|
+
if (!plugin.type) {
|
|
19
|
+
let name = "";
|
|
20
|
+
if (plugin.name) name = ` "${plugin.name}"`;
|
|
21
|
+
throw new Error(`Could not register plugin${name}. Missing "type" definition.`);
|
|
22
|
+
}
|
|
23
|
+
let name = plugin._name || plugin.name;
|
|
24
|
+
if (!name) plugin.name = name = uniqid(plugin.type + "-");
|
|
25
|
+
if (!options.skipExisting || !target[name]) {
|
|
26
|
+
target[name] = plugin;
|
|
27
|
+
plugin.init && plugin.init();
|
|
28
|
+
}
|
|
17
29
|
}
|
|
18
|
-
|
|
19
|
-
|
|
30
|
+
};
|
|
31
|
+
class PluginsContainer {
|
|
32
|
+
constructor(...args){
|
|
33
|
+
this.plugins = {};
|
|
34
|
+
this._byTypeCache = {};
|
|
35
|
+
this.register(...args);
|
|
20
36
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
name = ` "${plugin.name}"`;
|
|
25
|
-
}
|
|
26
|
-
throw new Error(`Could not register plugin${name}. Missing "type" definition.`);
|
|
37
|
+
byName(name) {
|
|
38
|
+
if (!name) return null;
|
|
39
|
+
return this.plugins[name];
|
|
27
40
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
41
|
+
byType(type) {
|
|
42
|
+
if (this._byTypeCache[type]) return Array.from(this._byTypeCache[type]);
|
|
43
|
+
const plugins = this.findByType(type);
|
|
44
|
+
this._byTypeCache[type] = plugins;
|
|
45
|
+
return Array.from(plugins);
|
|
31
46
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
plugin.init && plugin.init();
|
|
47
|
+
atLeastOneByType(type) {
|
|
48
|
+
const list = this.byType(type);
|
|
49
|
+
if (0 === list.length) throw new Error(`There are no plugins by type "${type}".`);
|
|
50
|
+
return list;
|
|
37
51
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
52
|
+
oneByType(type) {
|
|
53
|
+
const list = this.atLeastOneByType(type);
|
|
54
|
+
if (list.length > 1) throw new Error(`There is a requirement for plugin of type "${type}" to be only one registered.`);
|
|
55
|
+
return list[0];
|
|
56
|
+
}
|
|
57
|
+
merge(input) {
|
|
58
|
+
if (input instanceof PluginsContainer) return void this.register(...input.all());
|
|
59
|
+
this.register(input);
|
|
60
|
+
}
|
|
61
|
+
mergeByType(container, type) {
|
|
62
|
+
this.register(...container.byType(type));
|
|
49
63
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
*/
|
|
53
|
-
return this.plugins[name];
|
|
54
|
-
}
|
|
55
|
-
byType(type) {
|
|
56
|
-
if (this._byTypeCache[type]) {
|
|
57
|
-
return Array.from(this._byTypeCache[type]);
|
|
64
|
+
all() {
|
|
65
|
+
return Object.values(this.plugins);
|
|
58
66
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
atLeastOneByType(type) {
|
|
64
|
-
const list = this.byType(type);
|
|
65
|
-
if (list.length === 0) {
|
|
66
|
-
throw new Error(`There are no plugins by type "${type}".`);
|
|
67
|
+
register(...args) {
|
|
68
|
+
this._byTypeCache = {};
|
|
69
|
+
const [plugins, options] = normalizeArgs(args);
|
|
70
|
+
PluginsContainer_assign(plugins, options, this.plugins);
|
|
67
71
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
const list = this.atLeastOneByType(type);
|
|
72
|
-
if (list.length > 1) {
|
|
73
|
-
throw new Error(`There is a requirement for plugin of type "${type}" to be only one registered.`);
|
|
72
|
+
unregister(name) {
|
|
73
|
+
this._byTypeCache = {};
|
|
74
|
+
delete this.plugins[name];
|
|
74
75
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
merge(input) {
|
|
78
|
-
if (input instanceof PluginsContainer) {
|
|
79
|
-
this.register(...input.all());
|
|
80
|
-
return;
|
|
76
|
+
findByType(type) {
|
|
77
|
+
return Object.values(this.plugins).filter((pl)=>pl.type === type);
|
|
81
78
|
}
|
|
82
|
-
this.register(input);
|
|
83
|
-
}
|
|
84
|
-
mergeByType(container, type) {
|
|
85
|
-
this.register(...container.byType(type));
|
|
86
|
-
}
|
|
87
|
-
all() {
|
|
88
|
-
return Object.values(this.plugins);
|
|
89
|
-
}
|
|
90
|
-
register(...args) {
|
|
91
|
-
// reset the cache when adding new plugins
|
|
92
|
-
this._byTypeCache = {};
|
|
93
|
-
const [plugins, options] = normalizeArgs(args);
|
|
94
|
-
assign(plugins, options, this.plugins);
|
|
95
|
-
}
|
|
96
|
-
unregister(name) {
|
|
97
|
-
// reset the cache when removing a plugin
|
|
98
|
-
this._byTypeCache = {};
|
|
99
|
-
delete this.plugins[name];
|
|
100
|
-
}
|
|
101
|
-
findByType(type) {
|
|
102
|
-
return Object.values(this.plugins).filter(pl => pl.type === type);
|
|
103
|
-
}
|
|
104
79
|
}
|
|
80
|
+
export { PluginsContainer };
|
|
105
81
|
|
|
106
82
|
//# sourceMappingURL=PluginsContainer.js.map
|
package/PluginsContainer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"PluginsContainer.js","sources":["../src/PluginsContainer.ts"],"sourcesContent":["import type { Plugin, PluginCollection } from \"./types.js\";\nimport uniqid from \"uniqid\";\n\nexport type WithName<T extends Plugin> = T & { name: string };\n\nconst isOptionsObject = (item?: any) => item && !Array.isArray(item) && !item.type && !item.name;\nconst normalizeArgs = (args: any[]): [Plugin[], any] => {\n let options = {};\n\n // Check if last item in the plugins array is actually an options object.\n if (isOptionsObject(args[args.length - 1])) {\n [options] = args.splice(-1, 1);\n }\n\n return [args, options];\n};\n\nconst assign = (\n plugins: Plugin[] | Plugin[][],\n options: any,\n target: Record<string, any>\n): void => {\n for (const plugin of plugins) {\n if (Array.isArray(plugin)) {\n assign(plugin, options, target);\n continue;\n }\n\n if (typeof plugin !== \"object\") {\n throw new Error(\n `Could not register plugin. Expected an object, but got ${typeof plugin}.`\n );\n }\n\n if (!plugin.type) {\n let name = \"\";\n if (plugin.name) {\n name = ` \"${plugin.name}\"`;\n }\n throw new Error(`Could not register plugin${name}. Missing \"type\" definition.`);\n }\n\n let name = plugin._name || plugin.name;\n if (!name) {\n plugin.name = name = uniqid(plugin.type + \"-\");\n }\n\n // If skip existing was set to true, and a plugin with the same name was already registered, skip registration.\n if (!options.skipExisting || !target[name]) {\n target[name] = plugin;\n plugin.init && plugin.init();\n }\n }\n};\n\nexport class PluginsContainer {\n private plugins: Record<string, Plugin> = {};\n private _byTypeCache: Record<string, WithName<Plugin>[]> = {};\n\n constructor(...args: PluginCollection) {\n this.register(...args);\n }\n\n public byName<T extends Plugin>(name: T[\"name\"]) {\n if (!name) {\n return null;\n }\n /**\n * We can safely cast name as string, we know it is so.\n */\n return this.plugins[name as string] as WithName<T>;\n }\n\n public byType<T extends Plugin>(type: T[\"type\"]) {\n if (this._byTypeCache[type]) {\n return Array.from(this._byTypeCache[type]) as WithName<T>[];\n }\n const plugins = this.findByType<T>(type);\n this._byTypeCache[type] = plugins;\n return Array.from(plugins);\n }\n\n public atLeastOneByType<T extends Plugin>(type: T[\"type\"]) {\n const list = this.byType<T>(type);\n if (list.length === 0) {\n throw new Error(`There are no plugins by type \"${type}\".`);\n }\n return list;\n }\n\n public oneByType<T extends Plugin>(type: T[\"type\"]) {\n const list = this.atLeastOneByType<T>(type);\n if (list.length > 1) {\n throw new Error(\n `There is a requirement for plugin of type \"${type}\" to be only one registered.`\n );\n }\n return list[0];\n }\n\n public merge(input: PluginsContainer | PluginCollection): void {\n if (input instanceof PluginsContainer) {\n this.register(...input.all());\n return;\n }\n this.register(input);\n }\n\n public mergeByType(container: PluginsContainer, type: string): void {\n this.register(...container.byType(type));\n }\n\n public all<T extends Plugin>(): T[] {\n return Object.values(this.plugins) as T[];\n }\n\n public register(...args: any): void {\n // reset the cache when adding new plugins\n this._byTypeCache = {};\n const [plugins, options] = normalizeArgs(args);\n assign(plugins, options, this.plugins);\n }\n\n public unregister(name: string): void {\n // reset the cache when removing a plugin\n this._byTypeCache = {};\n delete this.plugins[name];\n }\n\n private findByType<T extends Plugin>(type: T[\"type\"]) {\n return Object.values(this.plugins).filter(\n (pl): pl is T => pl.type === type\n ) as WithName<T>[];\n }\n}\n"],"names":["isOptionsObject","item","Array","normalizeArgs","args","options","assign","plugins","target","plugin","Error","name","uniqid","PluginsContainer","type","list","input","container","Object","pl"],"mappings":"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"}
|
package/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PluginsContainer } from "./PluginsContainer.js";
|
|
2
|
-
import { AsyncPluginsContainer } from "./AsyncPluginsContainer.js";
|
|
3
|
-
import { Plugin } from "./Plugin.js";
|
|
4
2
|
const plugins = new PluginsContainer();
|
|
5
|
-
export {
|
|
3
|
+
export { AsyncPluginsContainer } from "./AsyncPluginsContainer.js";
|
|
4
|
+
export { Plugin } from "./Plugin.js";
|
|
5
|
+
export { PluginsContainer, plugins };
|
|
6
6
|
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { PluginsContainer } from \"./PluginsContainer.js\";\nimport { AsyncPluginsContainer } from \"./AsyncPluginsContainer.js\";\nimport { Plugin } from \"./Plugin.js\";\n\nconst plugins = new PluginsContainer();\n\nexport { Plugin, PluginsContainer, plugins, AsyncPluginsContainer };\n"],"names":["plugins","PluginsContainer"],"mappings":";AAIA,MAAMA,UAAU,IAAIC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/plugins",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.4.0-beta.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.js",
|
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@types/uniqid": "5.3.4",
|
|
24
|
-
"@webiny/build-tools": "6.
|
|
24
|
+
"@webiny/build-tools": "6.4.0-beta.0",
|
|
25
25
|
"rimraf": "6.1.3",
|
|
26
26
|
"typescript": "6.0.3",
|
|
27
|
-
"vitest": "4.1.
|
|
27
|
+
"vitest": "4.1.6"
|
|
28
28
|
},
|
|
29
29
|
"publishConfig": {
|
|
30
30
|
"access": "public",
|
|
31
31
|
"directory": "dist"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "a545d7529828af07d08d49c3da1bcb967483b9ce"
|
|
34
34
|
}
|
package/types.js
CHANGED
package/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["PluginsContainer"],"sources":["types.ts"],"sourcesContent":["export { PluginsContainer } from \"./PluginsContainer.js\";\n\nexport type Plugin<T = Record<string, any>> = {\n type: string;\n name?: string;\n init?: () => void;\n [key: string]: any;\n} & T;\n\nexport type PluginCollection = (Plugin | PluginFactory | PluginCollection)[];\n\nexport type PluginFactory = () => Promise<Plugin | PluginCollection>;\n"],"mappings":"AAAA,SAASA,gBAAgB","ignoreList":[]}
|