Add getRegisteredPlugins, plugin manager panel in test app
This commit is contained in:
18
dist/PluginRegistry.js
vendored
18
dist/PluginRegistry.js
vendored
@@ -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
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user