export type PluginServiceOPtions = { plugins?: IPlugin[]; presets?: IPreset[]; }; export type PluginContext = any> = { pluginName: string; ctx: Ctx; register(hook: IHook): void; registerMethod(name: K, fn?: IMethod, ReturnType>): void; } & PluginMethods & PluginService; export type PluginMethods = any> = { [k in Exclude]: IMethod, ReturnType>; }; export type IPlugin = any> = { name: string; config?: any; apply: (api: PluginContext, config?: any) => void; dispose?: (api: PluginContext) => void; }; export type IPreset = Omit & { apply: (api: PluginContext, config?: any) => ({ presets?: IPreset[]; plugins?: IPlugin[]; }); }; export type IHook = { name: T; order?: number; fn: (...args: any[]) => F; }; export declare enum HookType { create = "create", add = "add", modify = "modify", event = "event" } export type HookOpts = { name: T; type?: HookType; initalValue?: any; args?: any; sync?: boolean; }; export type IMethod = (...args: T extends Array ? T : [T]) => R; export type HookListType = Record; export declare class PluginService = any> { config?: PluginServiceOPtions; private hooks; private methods; private plugins; private extraPresets; private extraPlugins; context: Ctx; constructor(context: Ctx, config?: PluginServiceOPtions); initPresetsAndPlugins(config: PluginServiceOPtions): void; private resolvePresets; private resolvePlugins; private getApplyMethods; applyMethods>(name: K, ...args: Parameters extends Array ? Parameters : [Parameters]): ReturnType; private getPluginContext; private initPreset; private initPlugin; registerPlugin(plugin: IPlugin | IPreset): void; register(hook: IHook): void; registerMethod(name: string, fn?: IMethod): void; applyPlugins = Extract, T = HookList[K]>(inOpts: HookOpts | K): Promise extends never ? void : T>; uninstallPlugin(plugin: IPlugin | IPreset): void; dispose(): void; }