MCPcopy Index your code
hub / github.com/alibaba/lowcode-engine / Plugins

Class Plugins

packages/shell/src/api/plugins.ts:16–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14
15const innerPluginsSymbol = Symbol('plugin');
16export class Plugins implements IPublicApiPlugins {
17 private readonly [innerPluginsSymbol]: ILowCodePluginManager;
18 get [pluginsSymbol](): ILowCodePluginManager {
19 if (this.workspaceMode) {
20 return this[innerPluginsSymbol];
21 }
22 const workspace = globalContext.get('workspace');
23 if (workspace.isActive) {
24 return workspace.window.innerPlugins;
25 }
26
27 return this[innerPluginsSymbol];
28 }
29
30 constructor(plugins: ILowCodePluginManager, public workspaceMode: boolean = false) {
31 this[innerPluginsSymbol] = plugins;
32 }
33
34 async register(
35 pluginModel: IPublicTypePlugin,
36 options?: any,
37 registerOptions?: IPublicTypePluginRegisterOptions,
38 ): Promise<void> {
39 await this[pluginsSymbol].register(pluginModel, options, registerOptions);
40 }
41
42 async init(registerOptions: any) {
43 await this[pluginsSymbol].init(registerOptions);
44 }
45
46 getPluginPreference(
47 pluginName: string,
48 ): Record<string, IPublicTypePreferenceValueType> | null | undefined {
49 return this[pluginsSymbol].getPluginPreference(pluginName);
50 }
51
52 get(pluginName: string): IPublicModelPluginInstance | null {
53 const instance = this[pluginsSymbol].get(pluginName);
54 if (instance) {
55 return new ShellPluginInstance(instance);
56 }
57
58 return null;
59 }
60
61 getAll() {
62 return this[pluginsSymbol].getAll()?.map((d) => new ShellPluginInstance(d));
63 }
64
65 has(pluginName: string) {
66 return this[pluginsSymbol].has(pluginName);
67 }
68
69 async delete(pluginName: string) {
70 return await this[pluginsSymbol].delete(pluginName);
71 }
72
73 toProxy() {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…