remove user transformers
This commit is contained in:
@@ -29,21 +29,10 @@ File.declarations = [
|
||||
];
|
||||
|
||||
File.normaliseOptions = function (opts) {
|
||||
opts = opts || {};
|
||||
|
||||
_.each(opts.transformers, function (transformer, i) {
|
||||
if (!(transformer instanceof Transformer)) {
|
||||
throw new TypeError("opts.transformers[" + i + "] isn't an instance of Transformer");
|
||||
}
|
||||
});
|
||||
|
||||
opts = _.cloneDeep(opts, function (value) {
|
||||
return value instanceof Transformer ? value : undefined;
|
||||
});
|
||||
opts = _.cloneDeep(opts || {});
|
||||
|
||||
_.defaults(opts, {
|
||||
experimental: false,
|
||||
transformers: [],
|
||||
playground: false,
|
||||
whitespace: true,
|
||||
blacklist: [],
|
||||
@@ -113,7 +102,7 @@ File.prototype.getModuleFormatter = function (type) {
|
||||
}
|
||||
|
||||
if (!ModuleFormatter) {
|
||||
throw new ReferenceError("unknown module formatter type " + type);
|
||||
throw new ReferenceError("Unknown module formatter type " + JSON.stringify(type));
|
||||
}
|
||||
|
||||
return new ModuleFormatter(this);
|
||||
@@ -192,25 +181,9 @@ File.prototype.transform = function (ast) {
|
||||
|
||||
var self = this;
|
||||
|
||||
var runUserTransformers = function (end) {
|
||||
_.each(self.opts.transformers, function (transformer) {
|
||||
if (transformer.opts.end) {
|
||||
if (!end) return;
|
||||
} else if (end) {
|
||||
return;
|
||||
}
|
||||
|
||||
transformer.transform(self);
|
||||
});
|
||||
};
|
||||
|
||||
runUserTransformers();
|
||||
|
||||
_.each(transform.transformers, function (transformer) {
|
||||
transformer.transform(self);
|
||||
});
|
||||
|
||||
runUserTransformers(true);
|
||||
};
|
||||
|
||||
File.prototype.generate = function () {
|
||||
|
||||
Reference in New Issue
Block a user