-
_initPlugins()
-
Init plugin instance async
-
addModuleType(key, modulesPath, globPattern, ignore)
-
Add a plugin module types
Parameters:
Name |
Type |
Default |
Description |
key |
string
|
|
Module type key |
modulesPath |
string
|
|
Relative path for modules directory |
globPattern |
string
|
**/*.js
|
Glob pattern, default is **\/*.js |
ignore |
string
|
null
|
Ignore glob pattern or Array of glob pattern |
-
<async> addPlugin(name)
-
Add a plugin in the plugins.json config file
Return true if the plugin was added or false
Parameters:
Name |
Type |
Description |
name |
string
|
Plugin name |
Returns:
-
Type
-
boolean
-
<async> disablePlugin(name)
-
Disable a plugin in the plugins.json config file
Return true if the plugin was enabled or false
Parameters:
Name |
Type |
Description |
name |
string
|
Plugin name |
Returns:
-
Type
-
boolean
-
<async> enablePlugin(name)
-
Enable a plugin in the plugins.json config file
Return true if the plugin was enabled or false
Parameters:
Name |
Type |
Description |
name |
string
|
Plugin name |
Returns:
-
Type
-
boolean
-
getFilePath(filePath)
-
Return absolute path of a plugin file
Parameters:
Name |
Type |
Description |
filePath |
string
|
Plugin file path like "plugin-name:path-to-file" |
Returns:
Absolute file path
-
Type
-
string
-
getModuleType(type)
-
Return a module type definition
Parameters:
Name |
Type |
Description |
type |
string
|
Module type |
Returns:
-
Type
-
ModuleType
-
getPlugin(name)
-
Return a plugin instance by name
Parameters:
Name |
Type |
Description |
name |
string
|
Plugin name |
Returns:
-
Type
-
Plugin
-
getSortedPlugins(plugins)
-
Return an array of plugin names sorted by dependencies
Parameters:
Name |
Type |
Default |
Description |
plugins |
Array
|
null
|
Plugin name, if is not set use all plugin register |
Returns:
-
Type
-
Array
-
<async> importModules(type, import_)
-
Import files inside a directory of each plugins
Parameters:
Name |
Type |
Default |
Description |
type |
string
|
|
Module type key |
import_ |
boolean
|
true
|
Flag to import or not modules |
Returns:
-
Type
-
Array
-
<async> init()
-
Init plugin manager
Get the enabled plugins from the config and load them
Returns:
-
Type
-
Promise.<void>
-
<async> loadPlugin(name, pluginsLoadConfig)
-
Import plugin main file
Parameters:
Name |
Type |
Description |
name |
String
|
Plugin name |
pluginsLoadConfig |
object
|
Plugins config object (plugins.json) |
Returns:
-
Type
-
Promise.<Object>
-
<async> loadPlugins(pluginsLoadConfig)
-
Load plugins config and package.json and create plugin instances
Parameters:
Name |
Type |
Description |
pluginsLoadConfig |
object
|
Plugins config object (plugins.json) |
Returns:
-
Type
-
Promise.<Object>
-
<async> readFile(filePath, encoding)
-
Return content of a plugin file
Parameters:
Name |
Type |
Default |
Description |
filePath |
string
|
|
Plugin file path like "plugin-name:path-to-file" |
encoding |
string
|
utf8
|
Read file encoding: https://nodejs.org/api/fs.html#fs_fs_readfile_path_options_callback |
Returns:
-
Type
-
Promise.<(string|Buffer)>
-
<async> readFiles(globPattern)
-
Read plugin files from a glob pattern
Parameters:
Name |
Type |
Description |
globPattern |
string
|
Glob patter |
Returns:
-
Type
-
Array.<File>
-
<async> removePlugin(name)
-
Remove a plugin from the plugins.json config file
Return true if the plugin was removed or false
Parameters:
Name |
Type |
Description |
name |
string
|
Plugin name |
Returns:
-
Type
-
boolean