start moving more transformers to packages and finish import of plugins from babel-plugins

This commit is contained in:
Sebastian McKenzie
2015-09-01 08:37:37 +01:00
parent 9f9d9cd84b
commit 1ea835f42f
255 changed files with 3785 additions and 1265 deletions

View File

@@ -0,0 +1,22 @@
export default function ({ types: t }) {
return {
metadata: {
group: "builtin-pre"
},
visitor: {
MemberExpression() {
if (this.matchesPattern("process.env.NODE_ENV")) {
this.replaceWith(t.valueToNode(process.env.NODE_ENV));
if (this.parentPath.isBinaryExpression()) {
var evaluated = this.parentPath.evaluate();
if (evaluated.confident) {
this.parentPath.replaceWith(t.valueToNode(evaluated.value));
}
}
}
}
}
};
}