CreateConfigPlugins<TPluginContext> plugin.ts
Declarations #
5 declarations
CreateConfigPlugins #
Plugin #
Plugin<TPluginContext> Gro Plugins enable custom behavior during gro dev and gro build.
In contrast, Adapters use the results of gro build to produce final artifacts.
generics
TPluginContext
name
stringsetup
(ctx: TPluginContext) => void | Promise<void>adapt
(ctx: TPluginContext) => void | Promise<void>teardown
(ctx: TPluginContext) => void | Promise<void>PluginContext #
PluginContext<TArgs> generics
TArgs
objectinheritance
TaskContext<TArgs>
dev
booleanwatch
booleanPlugins #
See Plugins.create for a usage example.
generics
TPluginContext
ctx
type TPluginContext
instances
type Array<Plugin<TPluginContext>>
constructor
type new <TPluginContext extends PluginContext>(ctx: TPluginContext, instances: Plugin<PluginContext<object>>[]): Plugins<TPluginContext>
ctx
TPluginContextinstances
Plugin<PluginContext<object>>[]create
type <TPluginContext extends PluginContext>(ctx: TPluginContext): Promise<Plugins<TPluginContext>>
ctx
TPluginContextPromise<Plugins<TPluginContext>>setup
type (): Promise<void>
Promise<void>adapt
type (): Promise<void>
Promise<void>teardown
type (): Promise<void>
Promise<void>replace_plugin #
(plugins: Plugin<PluginContext<object>>[], new_plugin: Plugin<PluginContext<object>>, name?: string): Plugin<PluginContext<object>>[] Replaces a plugin by name in plugins without mutating the param.
Throws if the plugin name cannot be found.
plugins
- accepts the same types as the return value of CreateConfigPlugins
Plugin<PluginContext<object>>[]new_plugin
Plugin<PluginContext<object>>name
-
stringnew_plugin.namereturns
Plugin<PluginContext<object>>[] plugins with new_plugin at the index of the plugin with name