Add support for ES6 plugins

This commit is contained in:
emizzle 2018-10-19 11:21:04 +11:00 committed by Pascal Precht
parent 2d19d12e39
commit 7e75b1eee7
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
1 changed files with 5 additions and 1 deletions

View File

@ -77,13 +77,17 @@ Plugin.prototype.hasContext = function(context) {
Plugin.prototype.loadPlugin = function() {
if (!this.isContextValid()) {
this.logger.warn(__('Plugin {{name}} can only be loaded in the context of "{{contextes}}"', {name: this.name, contextes: this.acceptedContext.join(', ')}));
this.logger.warn(__('Plugin {{name}} can only be loaded in the context of "{{contexts}}"', {name: this.name, contexts: this.acceptedContext.join(', ')}));
return false;
}
this.loaded = true;
if (this.shouldInterceptLogs) {
this.setUpLogger();
}
if (typeof this.pluginModule === 'object' && typeof this.pluginModule.default === 'function' && this.pluginModule.__esModule){
this.pluginModule = this.pluginModule.default;
return new this.pluginModule(this);
}
(this.pluginModule.call(this, this));
};