import { SigilPlugin, SigilPluginConstructor } from './misc'; import { SigilMiddleware, SigilMiddlewareCallback } from './misc/sigil-middleware'; import { default as SigilCore } from './sigil-core'; import { MaybePromise, SigilOptions } from './types'; /** * Plugin system extension of the Sigil core. * Manages plugin retrieval and middleware registration. * * @template T type of Sigil runtime options. */ export default class SigilPluginSystem> extends SigilCore { /** * Constructs the SigilPluginSystem with optional configuration. * * @param options partial SigilOptions for core initialization. */ constructor(options?: T); /** * Retrieves a registered plugin instance by its constructor. * Logs an error if the plugin has not been loaded. * * @param plugin plugin constructor to retrieve. * @returns plugin instance, or undefined if not loaded. */ plugin

(plugin: SigilPluginConstructor

): P; /** * Checks if a specific plugin is registered within the system. * * @param {SigilPluginConstructor} plugin constructor of the plugin to check. * @return {boolean} true if the plugin is registered, otherwise false. */ hasPlugin

(plugin: SigilPluginConstructor

): boolean; /** * Executes a callback with the plugin instance if it exists. * Returns null if the plugin is not registered. * * @param plugin plugin constructor to use. * @param callback function to execute with the plugin. * @returns result of the callback or null. */ withPlugin

(plugin: SigilPluginConstructor

, callback: (plugin: P) => R): MaybePromise; /** * Adds global middleware to the Sigil framework. * Generates a unique ID for the middleware and logs its registration. * Returns a SigilMiddleware instance that can be used to unregister. * * @param callback the middleware function to register. * @returns SigilMiddleware object for managing the middleware lifecycle. */ addMiddleware(callback: SigilMiddlewareCallback): SigilMiddleware; }