Skip to main content

Registry <Plugin, Tool>

Hierarchy

Index

Constructors

constructor

  • new Registry<Plugin, Tool>(projectName: string, typeName: string, options: RegistryOptions<Plugin>): Registry<Plugin, Tool>
  • Type parameters

Other

readonlydebug

debug: Debugger

readonlyoptions

options: Readonly<Required<RegistryOptions<Plugin>>>

Validated and configured options.

readonlypluralName

pluralName: string

readonlyprojectName

projectName: string

readonlysingularName

singularName: string

Events

readonlyonAfterRegister

onAfterRegister: Event<[Plugin], string> = ...

Called after a plugin is registered.

readonlyonAfterUnregister

onAfterUnregister: Event<[Plugin], string> = ...

Called after a plugin is unregistered.

readonlyonBeforeRegister

onBeforeRegister: Event<[Plugin], string> = ...

Called before a plugin is registered and the startup life-cycle.

readonlyonBeforeUnregister

onBeforeUnregister: Event<[Plugin], string> = ...

Called before a plugin is unregistered and the shutdown life-cycle.

readonlyonLoad

onLoad: Event<[string, object], string> = ...

Called after a plugin is loaded but before it’s registered.

Methods

blueprint

configure

  • Set an options object by merging the new partial and existing options with the defined blueprint, while running all validation checks. Freeze and return the options object.

    object.configure({ name: 'Boost' });

    object.configure((prevOptions) => ({
    nestedObject: {
    ...prevOptions.nestedObject,
    some: 'value',
    },
    }));

formatModuleName

  • formatModuleName(name: string, scoped?: boolean): string
  • Format a name into a fully qualified and compatible Node/npm module name, with the tool and type names being used as scopes and prefixes.

get

  • get<T>(name: string): T
  • Return a single registered plugin by module name. If the plugin cannot be found, an error will be thrown.


    Type parameters

getAll

  • getAll(): Plugin[]
  • Return all registered plugins.

getMany

  • getMany(names: string[]): Plugin[]
  • Return multiple registered plugins by module name.

isRegistered

  • isRegistered(name: string): boolean
  • Return true if a plugin has been registered.

load

  • load(source: string | Plugin, params?: object, options?: RegisterOptions<Tool>): Promise<Plugin>
  • Load and register a single plugin by name, or with an explicit instance.

loadMany

  • Load and register multiple plugins based on a list of settings.

register

  • register(name: string, plugin: Plugin, tool?: undefined | Tool, options?: RegisterOptions<Tool>): Promise<Plugin>
  • Register a plugin and trigger startup with the provided tool.

unregister

  • unregister(name: string, tool?: Tool): Promise<Plugin>
  • Unregister a plugin by name and trigger shutdown process.