import { PluginSystemContext } from "./createPluginSystemContext"; import { CreateScopeReturnType } from "./lib/HookSystem"; import { PluginOptions, PluginHookExtraArgs, PluginHooks } from "./types"; /** * Plugin definition. */ export type Plugin< TPluginOptions extends Record = Record, > = { /** * Information about the plugin. */ meta: { name: string; }; /** * Default options. */ defaultOptions?: TPluginOptions; /** * Plugin setup. */ setup: ( context: Omit, "actions"> & Pick< CreateScopeReturnType>, "hook" | "unhook" >, ) => void | Promise; }; /** * @internal */ export type LoadedPlugin = Plugin & { resolve: string | Plugin; options: TPluginOptions; }; export const definePlugin = < TPluginOptions extends PluginOptions = PluginOptions, >( plugin: Plugin, ): Plugin => plugin;