import { Plugin, PluginDescriptor } from './types'; /** * A callback function type that is invoked when a plugin changes. * * @callback PluginChangeCallback * @param {string} pluginId - The unique identifier of the plugin that has changed. */ type PluginChangeCallback = (plugin: string) => void; interface LoadPluginOptions { dependingPlugin?: string; processManifestOnly?: boolean; viaGetPlugin?: boolean; reinitialise?: boolean; } interface GetPluginOptions { reinitialise?: boolean; } export declare const loadCorePlugin: (pluginDescriptor: PluginDescriptor) => Promise; /** * The `PluginManager` class is responsible for managing plugins in the application. * It provides methods to add, load, start, and get plugins. */ export declare class PluginManager { protected static instance: PluginManager; private registry; /** * A map of pluginID (dependency) to a collection of pluginIDs (dependent or providing extension to the dependency) * Whenever a plugin is loaded we will need to check this map to see if there's plugin(s) waiting for the loaded plugin if so, * those will need to be loaded first. */ private awaitingDependency; private listeners; protected constructor(); static getInstance(): PluginManager; /** * Add an array of plugin definitions to the registry * @param plugins - an array of plugin definitions */ addPluginDefinitions(plugins: PluginDescriptor[]): Promise; /** * Add a plugin definition to the registry * @param pluginDescriptor - a plugin definition */ addPlugin(pluginDescriptor: PluginDescriptor): Promise; /** * Load a plugin by name * @param pluginName - the name of the plugin to load * @param dependingPlugin - the name of the plugin that depends on the plugin to load * @param forceReload - whether to force a reload of the plugin if it is already loaded */ protected loadPlugin(pluginName: string, options?: LoadPluginOptions): Promise; loadRemotePluginModule(url: string, name: string, bundleFile: string, moduleName: string): Promise; protected startPlugin(plugin: Plugin, dependingPlugin?: Plugin): Promise; /** * Get a plugin by name * * @param pluginName * @returns the plugin instance. If the plugin is not loaded, it will be loaded. */ getPlugin(pluginName: string, options?: GetPluginOptions): Promise; clear(): void; getNumberOfPlugins(): number; getPluginIds(): string[]; /** * Registers a listener for plugin change events. * * @param pluginIds - An array of plugin IDs to listen for changes. * @param callback - A callback function to be invoked when any of the specified plugins change. * @returns A function to unsubscribe the listener. */ registerPluginChangeListener(pluginIds: string[], callback: PluginChangeCallback): () => void; /** * Unregisters a plugin change listener. * * This method removes the specified listener from the list of registered listeners * if it is currently registered. * * @param listener - The plugin listener to unregister. */ private unregisterPluginChangeListener; /** * Notifies all registered listeners that a plugin has changed. * * This method iterates over all listeners and invokes their callback * if the listener is interested in the specified plugin. * * @param plugin - The plugin that has changed. */ private notifyPluginChanged; getAwaitingPluginsFor(pluginId: string): string[]; } export {};