plugin.ts

Declarations
#

5 declarations

view source

CreateConfigPlugins
#

Plugin
#

plugin.ts view source

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

constraint PluginContext

name

type string

setup

type (ctx: TPluginContext) => void | Promise<void>

adapt

type (ctx: TPluginContext) => void | Promise<void>

teardown

type (ctx: TPluginContext) => void | Promise<void>

PluginContext
#

plugin.ts view source

PluginContext<TArgs>

generics

TArgs

default object

inheritance

extends:
  • TaskContext<TArgs>

dev

type boolean

watch

type boolean

Plugins
#

plugin.ts view source

See Plugins.create for a usage example.

generics

TPluginContext

constraint PluginContext

ctx

type TPluginContext

readonly

instances

type Array<Plugin<TPluginContext>>

readonly

constructor

type new <TPluginContext extends PluginContext>(ctx: TPluginContext, instances: Plugin<PluginContext<object>>[]): Plugins<TPluginContext>

ctx
type TPluginContext
instances
type Plugin<PluginContext<object>>[]

create

type <TPluginContext extends PluginContext>(ctx: TPluginContext): Promise<Plugins<TPluginContext>>

static
ctx
type TPluginContext
returns Promise<Plugins<TPluginContext>>

setup

type (): Promise<void>

returns Promise<void>

adapt

type (): Promise<void>

returns Promise<void>

teardown

type (): Promise<void>

returns Promise<void>

replace_plugin
#

plugin.ts view source

(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

type Plugin<PluginContext<object>>[]

new_plugin

type Plugin<PluginContext<object>>

name

-

type string
default new_plugin.name

returns

Plugin<PluginContext<object>>[]

plugins with new_plugin at the index of the plugin with name

Imported by
#