Add getRegisteredPlugins, plugin manager panel in test app

This commit is contained in:
2026-04-18 20:24:54 +10:00
parent 93dbef6a59
commit c6d3d4cbe5
7 changed files with 247 additions and 5 deletions

View File

@@ -302,6 +302,24 @@ export class PluginRegistry {
getPluginExports(pluginId) {
return this.plugins.get(pluginId)?.plugin.exports;
}
/**
* Returns metadata for all currently registered plugins.
* Useful for displaying a plugin directory / manager UI.
*/
getRegisteredPlugins() {
return Array.from(this.plugins.entries()).map(([id, { plugin }]) => ({
id,
name: plugin.name ?? id,
version: plugin.version ?? '—',
commandCount: [...this.commands.values()].filter(c => c.pluginId === id).length,
interceptorCount: this.beforeSendInterceptors.filter(i => i.pluginId === id).length +
this.receiveInterceptors.filter(i => i.pluginId === id).length,
themeCount: [...this.themes.values()].filter(t => t.pluginId === id).length,
hasSettings: (this.settingsSchemas.get(id)?.constructor === Object
? Object.keys(this.settingsSchemas.get(id)).length > 0
: !!this.settingsSchemas.get(id)),
}));
}
// ---------------------------------------------------------------------------
// Hot reload
// ---------------------------------------------------------------------------