Bail internal transforms if there're no transforms to run

Reviewed By: sam-swarr

Differential Revision: D2810474

fb-gh-sync-id: d5ba48922c91c3dbacfccb0d087cc1deac14fa1c
This commit is contained in:
Martín Bigio 2016-01-06 20:03:30 -08:00 committed by facebook-github-bot-8
parent b75c939d59
commit 7bb60449bd
1 changed files with 9 additions and 1 deletions

View File

@ -15,6 +15,14 @@ var Transforms = require('../transforms');
// transforms should be run after the external ones to ensure that they run on // transforms should be run after the external ones to ensure that they run on
// Javascript code // Javascript code
function internalTransforms(sourceCode, filename, options) { function internalTransforms(sourceCode, filename, options) {
var plugins = Transforms.getAll(options);
if (plugins.length === 0) {
return {
code: sourceCode,
filename: filename,
};
}
var result = babel.transform(sourceCode, { var result = babel.transform(sourceCode, {
retainLines: true, retainLines: true,
compact: true, compact: true,
@ -22,7 +30,7 @@ function internalTransforms(sourceCode, filename, options) {
filename: filename, filename: filename,
sourceFileName: filename, sourceFileName: filename,
sourceMaps: false, sourceMaps: false,
plugins: Transforms.getAll(options) plugins: plugins,
}); });
return { return {