Constructor
new Registry(options)
Initialize a Registry instance.
Parameters:
Name | Type | Description |
---|---|---|
options |
Object | Options object |
- Source:
Methods
del(name) → {Plugin}
Remove a plugin from the registry.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | Name of the plugin |
- Source:
Returns:
- Type
- Plugin
filter(predicate) → {PluginCollection}
Query the registry for plugins matching a predicate
Parameters:
Name | Type | Description |
---|---|---|
predicate |
Object | function | Description or function for matching plugins |
- Source:
Returns:
- Type
- PluginCollection
Examples
registry.filter({ enabled: true })
registry.filter(plugin => !!plugin.name.match(regexp))
get(name) → {Plugin}
Retrieve a plugin from the registry.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | name of the plugin |
- Source:
Returns:
- Type
- Plugin
glob()
Search the configured directories for plugin index files.
- Source:
initialize()
Iterate over prioritized plugins and invoke initializer methods.
- Source:
plugin(name, metadata) → {Plugin}
Register or retrieve a plugin from the injector with a name and metadata object.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | Plugin name |
metadata |
Object | Plugin metadata |
- Source:
Returns:
- Type
- Plugin
prioritize()
Given a list of plugins with dependencies, sort the list such that all dependencies can be met by iterating over the list.
- Source:
require()
Load plugins to the registry without initializing them.
- Source:
resolve()
Resolves and validates dependencies and dependents of all plugins.
- Source:
satisfy()
Given a list of plugins without dependencies and a list of plugins with dependencies, return a list of plugins such that no plugins appear before their dependencies.
- Source:
set(name, plugin) → {Plugin}
Set a plugin on the registry.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | Name of the plugin |
plugin |
Plugin | Name of the plugin |
- Source:
Returns:
- Type
- Plugin