MCPcopy
hub / github.com/alibaba/lowcode-engine / LowCodePluginRuntime

Class LowCodePluginRuntime

packages/designer/src/plugin/plugin.ts:12–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10import { invariant } from '../utils';
11
12export class LowCodePluginRuntime implements ILowCodePluginRuntime {
13 config: IPublicTypePluginConfig;
14
15 logger: Logger;
16
17 private manager: ILowCodePluginManager;
18
19 private _inited: boolean;
20
21 private pluginName: string;
22
23 meta: IPublicTypePluginMeta;
24
25 /**
26 * 标识插件状态,是否被 disabled
27 */
28 private _disabled: boolean;
29
30 constructor(
31 pluginName: string,
32 manager: ILowCodePluginManager,
33 config: IPublicTypePluginConfig,
34 meta: IPublicTypePluginMeta,
35 ) {
36 this.manager = manager;
37 this.config = config;
38 this.pluginName = pluginName;
39 this.meta = meta;
40 this.logger = getLogger({ level: 'warn', bizName: `plugin:${pluginName}` });
41 }
42
43 get name() {
44 return this.pluginName;
45 }
46
47 get dep() {
48 if (typeof this.meta.dependencies === 'string') {
49 return [this.meta.dependencies];
50 }
51 // compat legacy way to declare dependencies
52 const legacyDepValue = (this.config as any).dep;
53 if (typeof legacyDepValue === 'string') {
54 return [legacyDepValue];
55 }
56 return this.meta.dependencies || legacyDepValue || [];
57 }
58
59 get disabled() {
60 return this._disabled;
61 }
62
63 isInited() {
64 return this._inited;
65 }
66
67 async init(forceInit?: boolean) {
68 if (this._inited && !forceInit) return;
69 this.logger.log('method init called');

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…