MCPcopy Create free account
hub / github.com/esengine/esengine / loadEnabledPlugins

Function loadEnabledPlugins

packages/runtime-core/src/PluginLoader.ts:366–391  ·  view source on GitHub ↗
(
    config: ProjectPluginConfig,
    packageInfoMap: Record<string, PluginPackageInfo>
)

Source from the content-addressed store, hash-verified

364 * @en Load enabled plugins (simplified API)
365 */
366export async function loadEnabledPlugins(
367 config: ProjectPluginConfig,
368 packageInfoMap: Record<string, PluginPackageInfo>
369): Promise<void> {
370 const plugins: PluginLoadConfig[] = [];
371
372 for (const [id, cfg] of Object.entries(config.plugins)) {
373 if (!cfg.enabled) continue;
374 const info = packageInfoMap[id];
375 if (!info) {
376 logger.warn(`No package info for ${id}`);
377 continue;
378 }
379
380 plugins.push({
381 packageId: id,
382 enabled: true,
383 sourceType: 'npm',
384 exportName: info.pluginExport,
385 dependencies: info.dependencies
386 });
387 }
388
389 const loader = new PluginLoader({ plugins });
390 await loader.loadAll();
391}
392
393/**
394 * @zh 注册静态插件

Callers

nothing calls this directly

Calls 4

loadAllMethod · 0.95
entriesMethod · 0.80
pushMethod · 0.65
warnMethod · 0.45

Tested by

no test coverage detected