Skip to content

Commit

Permalink
fix: restore plugin loader
Browse files Browse the repository at this point in the history
  • Loading branch information
juanpicado committed Apr 14, 2018
1 parent 98ebd9a commit 3c1c3ca
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/lib/plugin-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ function tryLoad(path: string) {
}
}

function mergeConfig(appConfig, pluginConfig) {
return _.merge(appConfig, pluginConfig);
}

function isValid(plugin) {
return (_.isFunction(plugin) || _.isFunction(plugin.default));
}
Expand Down Expand Up @@ -74,9 +78,8 @@ function loadPlugin(config: Config, pluginConfigs: any, params: any, sanityCheck
logger.logger.error({content: pluginId}, '@{content} doesn\'t look like a valid plugin');
throw Error('"' + pluginId + '" doesn\'t look like a valid plugin');
}
const pluginConfiguration = pluginConfigs[pluginId];
/* eslint new-cap:off */
plugin = isES6(plugin) ? new plugin.default(pluginConfiguration, params) : plugin(pluginConfiguration, params);
plugin = isES6(plugin) ? new plugin.default(mergeConfig(config, pluginConfigs[pluginId]), params) : plugin(pluginConfigs[pluginId], params);
/* eslint new-cap:off */

if (plugin === null || !sanityCheck(plugin)) {
Expand Down

0 comments on commit 3c1c3ca

Please sign in to comment.