delegate to babel-cli/babel-core if it's available #1244

This commit is contained in:
Sebastian McKenzie
2015-04-14 07:53:29 -07:00
parent b51411f090
commit dd84b554e6
2 changed files with 16 additions and 1 deletions

16
index.js Normal file
View File

@@ -0,0 +1,16 @@
var path = require("path"
);
var isCli = module.parent.filename.indexOf(path.sep + "babel" + path.sep) >= 0;
if (!isCli && module.parent.filename !== __filename) {
try {
module.exports = require("babel/node_modules/babel-core");
return;
} catch (err) {
if (err.code !== "MODULE_NOT_FOUND") {
throw err;
}
}
}
module.exports = require("./lib/babel/api/node.js");