fix PluginManager

This commit is contained in:
Sebastian McKenzie
2015-04-29 01:13:23 +01:00
parent 0fc958e0fc
commit 7043119346
2 changed files with 5 additions and 3 deletions

View File

@@ -219,7 +219,7 @@ export default class File {
// init plugins!
var beforePlugins = [];
var afterPlugins = [];
var pluginManager = new PluginManager(this.transformers, beforePlugins, afterPlugins);
var pluginManager = new PluginManager(this, this.transformers, beforePlugins, afterPlugins);
for (var i = 0; i < file.opts.plugins.length; i++) {
pluginManager.add(file.opts.plugins[i]);
}

View File

@@ -1,4 +1,5 @@
import * as messages from "../../messages";
import * as util from "../../util";
export default class PluginManager {
static memoisedPlugins = [];
@@ -17,8 +18,9 @@ export default class PluginManager {
return transformer;
}
constructor(transformers, before, after) {
constructor(file, transformers, before, after) {
this.transformers = transformers;
this.file = file;
this.before = before;
this.after = after;
}
@@ -90,7 +92,7 @@ export default class PluginManager {
this.validate(plugin);
// build!
var pass = this.transformers[key] = plugin.buildPass(this);
var pass = this.transformers[plugin.key] = plugin.buildPass(this.file);
if (pass.canTransform()) {
var stack = position === "before" ? this.before : this.after;
stack.push(pass);