Repository: babel/minify
Pull request #661 (2017-08-13 22:46:56)

Add exclude option for transform-remove-console plugin
An attempt to implement the extension requested in https://github.com/babel/minify/issues/598

Based on the unit tests I added, I believe this is working, however as this is my very first attempt at code within the babel ecosystem it is highly likely there are better ways to approach this. I welcome any and all feedback on how to improve this either functionally or idiomatically.

kball: Updated based on @j-f1's feedback

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0e99a92..d15af02 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,111 @@
+## babel-minify@0.2.0 (2017-08-14)
+
+### Highlights
+
++ [#124](https://github.com/babel/minify/issues/124): Babili has been renamed to `babel-minify`
++ New babel-minify CLI and Node API. [Docs](https://github.com/babel/minify/tree/master/packages/babel-minify)
+
+### Updated packages
+
+- babel-helper-evaluate-path@0.2.0
+- babel-helper-flip-expressions@0.2.0
+- babel-helper-is-void-0@0.2.0
+- babel-helper-mark-eval-scopes@0.2.0
+- babel-helper-remove-or-void@0.2.0
+- babel-helper-to-multiple-sequence-expressions@0.2.0
+- babel-minify@0.2.0
+- babel-plugin-minify-builtins@0.2.0
+- babel-plugin-minify-constant-folding@0.2.0
+- babel-plugin-minify-dead-code-elimination@0.2.0
+- babel-plugin-minify-flip-comparisons@0.2.0
+- babel-plugin-minify-guarded-expressions@0.2.0
+- babel-plugin-minify-infinity@0.2.0
+- babel-plugin-minify-mangle-names@0.2.0
+- babel-plugin-minify-numeric-literals@0.2.0
+- babel-plugin-minify-replace@0.2.0
+- babel-plugin-minify-simplify@0.2.0
+- babel-plugin-minify-type-constructors@0.2.0
+- babel-plugin-transform-inline-consecutive-adds@0.2.0
+- babel-plugin-transform-inline-environment-variables@0.2.0
+- babel-plugin-transform-member-expression-literals@6.8.5
+- babel-plugin-transform-merge-sibling-variables@6.8.6
+- babel-plugin-transform-minify-booleans@6.8.3
+- babel-plugin-transform-node-env-inline@0.2.0
+- babel-plugin-transform-property-literals@6.8.5
+- babel-plugin-transform-regexp-constructors@0.2.0
+- babel-plugin-transform-remove-console@6.8.5
+- babel-plugin-transform-remove-debugger@6.8.5
+- babel-plugin-transform-remove-undefined@0.2.0
+- babel-plugin-transform-simplify-comparison-operators@6.8.5
+- babel-plugin-transform-undefined-to-void@6.8.3
+- babel-preset-minify@0.2.0
+- gulp-babel-minify@0.2.0
+
+#### :boom: Breaking Change
+* [#654](https://github.com/babel/minify/pull/654) The rename. ([@boopathi](https://github.com/boopathi))
+* [#507](https://github.com/babel/minify/pull/507) Node API and CLI. ([@boopathi](https://github.com/boopathi))
+
+#### :rocket: New Feature
+
+* [#662](https://github.com/babel/minify/pull/662) Use evaluate helper in removeUndefined transform. ([@boopathi](https://github.com/boopathi))
+* [#658](https://github.com/babel/minify/pull/658) Make tdz optional in helper evaluate. ([@boopathi](https://github.com/boopathi))
+* [#616](https://github.com/babel/minify/pull/616) Convert simple arrow function body to expression. ([@ashsearle](https://github.com/ashsearle))
+
+#### :bug: Bug Fix
+* `babel-plugin-transform-remove-undefined`, `babel-preset-minify`
+  * [#662](https://github.com/babel/minify/pull/662) Use evaluate helper in removeUndefined transform. ([@boopathi](https://github.com/boopathi))
+* `babel-helper-to-multiple-sequence-expressions`, `babel-preset-minify`
+  * [#660](https://github.com/babel/minify/pull/660) Fix helper toMultipleSeqExpr with es2015. ([@boopathi](https://github.com/boopathi))
+* `babel-helper-evaluate-path`
+  * [#651](https://github.com/babel/minify/pull/651) Add deopt paths for let/const bindings in evaluate helper. ([@boopathi](https://github.com/boopathi))
+* `babel-helper-evaluate-path`, `babel-plugin-minify-builtins`, `babel-plugin-minify-dead-code-elimination`
+  * [#645](https://github.com/babel/minify/pull/645) Helper evaluate path. ([@boopathi](https://github.com/boopathi))
+* `babel-plugin-minify-dead-code-elimination`
+  * [#597](https://github.com/babel/minify/pull/597) [Closes [#574](https://github.com/babel/minify/issues/574)] deopt when binding is present in diff scope. ([@vigneshshanmugam](https://github.com/vigneshshanmugam))
+  * [#626](https://github.com/babel/minify/pull/626) Detect duplicate declaration during one-use replacement. ([@boopathi](https://github.com/boopathi))
+  * [#622](https://github.com/babel/minify/pull/622) [DCE] Fix removal of ArrayPattern. ([@boopathi](https://github.com/boopathi))
+  * [#602](https://github.com/babel/minify/pull/602) fix(minify-dead-code): Closes [#601](https://github.com/babel/minify/issues/601). ([@postspectacular](https://github.com/postspectacular))
+* `babel-plugin-minify-simplify`
+  * [#638](https://github.com/babel/minify/pull/638) Don't remove else with blockscoped decl. ([@boopathi](https://github.com/boopathi))
+  * [#623](https://github.com/babel/minify/pull/623) Fix block removal during early continue transform. ([@boopathi](https://github.com/boopathi))
+* `babel-plugin-transform-remove-undefined`, `babel-preset-babili`
+  * [#633](https://github.com/babel/minify/pull/633) binding voilations check during es2015 transform[Closes [#630](https://github.com/babel/minify/issues/630)]. ([@vigneshshanmugam](https://github.com/vigneshshanmugam))
+* `babel-plugin-minify-constant-folding`
+  * [#610](https://github.com/babel/minify/pull/610) Fix folding Array literals (Closes [#608](https://github.com/babel/minify/issues/608)) (Closes [#609](https://github.com/babel/minify/issues/609)). ([@boopathi](https://github.com/boopathi))
+
+#### :memo: Documentation
+* Other
+  * [#659](https://github.com/babel/minify/pull/659) Update benchmarks. ([@boopathi](https://github.com/boopathi))
+  * [#655](https://github.com/babel/minify/pull/655) Update Contributing.md. ([@boopathi](https://github.com/boopathi))
+* `babili`
+  * [#653](https://github.com/babel/minify/pull/653) Add docs for NodeAPI and CLI. ([@boopathi](https://github.com/boopathi))
+* `babel-helper-evaluate-path`
+  * [#649](https://github.com/babel/minify/pull/649) Add helper evaluate docs [skip ci]. ([@boopathi](https://github.com/boopathi))
+* `babel-plugin-minify-numeric-literals`
+  * [#639](https://github.com/babel/minify/pull/639) Update babel-plugin-minify-numeric-literals README. ([@benbrandt](https://github.com/benbrandt))
+
+#### :house: Internal
+* `babili`
+  * [#652](https://github.com/babel/minify/pull/652) test for nested options in node api. ([@vigneshshanmugam](https://github.com/vigneshshanmugam))
+* Other
+  * [#648](https://github.com/babel/minify/pull/648) Remove draft-js from smoktests dir. ([@boopathi](https://github.com/boopathi))
+  * [#643](https://github.com/babel/minify/pull/643) Use yarn workspaces. ([@boopathi](https://github.com/boopathi))
+  * [#631](https://github.com/babel/minify/pull/631) Add ISSUE_TEMPLATE and CODEOWNERS . ([@boopathi](https://github.com/boopathi))
+* `babel-helper-mark-eval-scopes`, `babel-plugin-minify-dead-code-elimination`, `babel-plugin-minify-mangle-names`
+  * [#625](https://github.com/babel/minify/pull/625) Support babel 7. ([@boopathi](https://github.com/boopathi))
+* `babel-plugin-minify-simplify`
+  * [#624](https://github.com/babel/minify/pull/624) Split simplify plugin to multiple files. ([@boopathi](https://github.com/boopathi))
+* Multiple packages
+  * [#606](https://github.com/babel/minify/pull/606) Refactor the test suite. ([@j-f1](https://github.com/j-f1))
+
+#### Committers: 6
+- Ash ([ashsearle](https://github.com/ashsearle))
+- Ben Brandt ([benbrandt](https://github.com/benbrandt))
+- Boopathi Rajaa ([boopathi](https://github.com/boopathi))
+- Jed Fox ([j-f1](https://github.com/j-f1))
+- Karsten Schmidt ([postspectacular](https://github.com/postspectacular))
+- Vignesh Shanmugam ([vigneshshanmugam](https://github.com/vigneshshanmugam))
+
 ## babili@0.1.4 (2017-06-20)
 
 > Just some various bug fixes!
diff --git a/packages/babel-helper-evaluate-path/package.json b/packages/babel-helper-evaluate-path/package.json
index 7e35c34..99beb6a 100644
--- a/packages/babel-helper-evaluate-path/package.json
+++ b/packages/babel-helper-evaluate-path/package.json
@@ -1,6 +1,6 @@
 {
   "name": "babel-helper-evaluate-path",
-  "version": "0.1.0",
+  "version": "0.2.0",
   "description": "path.evaluate wrapped in a try catch",
   "keywords": [
     "babel-minify",
@@ -11,7 +11,5 @@
   "license": "MIT",
   "author": "boopathi",
   "main": "lib/index.js",
-  "repository": "https://github.com/babel/minify/tree/master/packages/babel-helper-evaluate-path",
-  "dependencies": {},
-  "devDependencies": {}
+  "repository": "https://github.com/babel/minify/tree/master/packages/babel-helper-evaluate-path"
 }
diff --git a/packages/babel-helper-flip-expressions/package.json b/packages/babel-helper-flip-expressions/package.json
index 937a516..dd97780 100644
--- a/packages/babel-helper-flip-expressions/package.json
+++ b/packages/babel-helper-flip-expressions/package.json
@@ -1,6 +1,6 @@
 {
   "name": "babel-helper-flip-expressions",
-  "version": "0.1.2",
+  "version": "0.2.0",
   "description": "",
   "keywords": [
     "babel-plugin"
diff --git a/packages/babel-helper-is-void-0/package.json b/packages/babel-helper-is-void-0/package.json
index 5e6eaf6..6f45fb2 100644
--- a/packages/babel-helper-is-void-0/package.json
+++ b/packages/babel-helper-is-void-0/package.json
@@ -1,6 +1,6 @@
 {
   "name": "babel-helper-is-void-0",
-  "version": "0.1.1",
+  "version": "0.2.0",
   "description": "",
   "keywords": [
     "babel-plugin"
@@ -10,7 +10,5 @@
   "license": "MIT",
   "author": "amasad",
   "main": "lib/index.js",
-  "repository": "https://github.com/babel/minify/tree/master/packages/babel-helper-is-void-0",
-  "dependencies": {},
-  "devDependencies": {}
+  "repository": "https://github.com/babel/minify/tree/master/packages/babel-helper-is-void-0"
 }
diff --git a/packages/babel-helper-mark-eval-scopes/package.json b/packages/babel-helper-mark-eval-scopes/package.json
index fad8cf5..5f49190 100644
--- a/packages/babel-helper-mark-eval-scopes/package.json
+++ b/packages/babel-helper-mark-eval-scopes/package.json
@@ -1,6 +1,6 @@
 {
   "name": "babel-helper-mark-eval-scopes",
-  "version": "0.1.1",
+  "version": "0.2.0",
   "description": "Mark scopes for deopt which contain a direct eval call",
   "keywords": [
     "babel-minify",
@@ -11,7 +11,5 @@
   "license": "MIT",
   "author": "boopathi",
   "main": "lib/index.js",
-  "repository": "https://github.com/babel/minify/tree/master/packages/babel-helper-mark-eval-scopes",
-  "dependencies": {},
-  "devDependencies": {}
+  "repository": "https://github.com/babel/minify/tree/master/packages/babel-helper-mark-eval-scopes"
 }
diff --git a/packages/babel-helper-remove-or-void/package.json b/packages/babel-helper-remove-or-void/package.json
index 52f938b..c7c74e9 100644
--- a/packages/babel-helper-remove-or-void/package.json
+++ b/packages/babel-helper-remove-or-void/package.json
@@ -1,6 +1,6 @@
 {
   "name": "babel-helper-remove-or-void",
-  "version": "0.1.1",
+  "version": "0.2.0",
   "description": "",
   "keywords": [
     "babel-plugin"
@@ -10,7 +10,5 @@
   "license": "MIT",
   "author": "amasad",
   "main": "lib/index.js",
-  "repository": "https://github.com/babel/minify/tree/master/packages/babel-helper-remove-or-void",
-  "dependencies": {},
-  "devDependencies": {}
+  "repository": "https://github.com/babel/minify/tree/master/packages/babel-helper-remove-or-void"
 }
diff --git a/packages/babel-helper-to-multiple-sequence-expressions/package.json b/packages/babel-helper-to-multiple-sequence-expressions/package.json
index 10a2e8b..c7f6e6e 100644
--- a/packages/babel-helper-to-multiple-sequence-expressions/package.json
+++ b/packages/babel-helper-to-multiple-sequence-expressions/package.json
@@ -1,6 +1,6 @@
 {
   "name": "babel-helper-to-multiple-sequence-expressions",
-  "version": "0.1.1",
+  "version": "0.2.0",
   "description": "",
   "keywords": [
     "babel-plugin"
@@ -10,7 +10,5 @@
   "license": "MIT",
   "author": "amasad",
   "main": "lib/index.js",
-  "repository": "https://github.com/babel/minify/tree/master/packages/babel-helper-to-multiple-sequence-expressions",
-  "dependencies": {},
-  "devDependencies": {}
+  "repository": "https://github.com/babel/minify/tree/master/packages/babel-helper-to-multiple-sequence-expressions"
 }
diff --git a/packages/babel-helper-to-multiple-sequence-expressions/src/index.js b/packages/babel-helper-to-multiple-sequence-expressions/src/index.js
index c9281c2..8f43dc8 100644
--- a/packages/babel-helper-to-multiple-sequence-expressions/src/index.js
+++ b/packages/babel-helper-to-multiple-sequence-expressions/src/index.js
@@ -47,7 +47,7 @@ module.exports = function(t) {
         if (t.isExpression(node)) {
           exprs.push(node);
         } else if (t.isExpressionStatement(node)) {
-          exprs.push(node.expression);
+          if (node.expression) exprs.push(node.expression);
         } else if (t.isIfStatement(node)) {
           let consequent;
           if (node.consequent) {
diff --git a/packages/babel-minify/.npmignore b/packages/babel-minify/.npmignore
new file mode 100644
index 0000000..2225066
--- /dev/null
+++ b/packages/babel-minify/.npmignore
@@ -0,0 +1,4 @@
+src
+__tests__
+node_modules
+*.log
diff --git a/packages/babel-minify/README.md b/packages/babel-minify/README.md
index 6f0d703..abc9c5e 100644
--- a/packages/babel-minify/README.md
+++ b/packages/babel-minify/README.md
@@ -2,7 +2,7 @@
 
 Node API and CLI
 
-[`babel-minify`](/packages/babel-minify) [![npm](https://img.shields.io/npm/v/babel-minify.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-minify)
+[![npm](https://img.shields.io/npm/v/babel-minify.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-minify)
 
 Use `babel-minify` if you don't already use babel (as a preset) or want to run it standalone.
 
@@ -42,7 +42,7 @@ minify(input, minifyOptions, overrides)
 
 ### minifyOptions
 
-Refer [babel-preset-minify options](../babel-preset-minify#options)
+Refer [babel-preset-minify options](https://github.com/babel/minify/tree/master/packages/babel-preset-minify#options)
 
 ### overrides
 
@@ -61,7 +61,7 @@ minify input.js [options]
 
 For simple options, use `--optionName` in CLI
 
-Refer [preset's 1-1 options](../babel-preset-minify#1-1-mapping-with-plugin) for the list of options
+Refer [preset's 1-1 options](https://github.com/babel/minify/tree/master/packages/babel-preset-minify#1-1-mapping-with-plugin) for the list of options
 
 Example:
 
diff --git a/packages/babel-minify/package.json b/packages/babel-minify/package.json
index aefcb09..8b73e8f 100644
--- a/packages/babel-minify/package.json
+++ b/packages/babel-minify/package.json
@@ -1,6 +1,6 @@
 {
   "name": "babel-minify",
-  "version": "0.1.4",
+  "version": "0.2.0",
   "description": "✂️ An ES6+ aware minifier based on the Babel toolchain (beta)",
   "keywords": [
     "babel-minify",
@@ -19,7 +19,7 @@
   "repository": "https://github.com/babel/minify/tree/master/packages/babel-minify",
   "dependencies": {
     "babel-core": "^6.24.1",
-    "babel-preset-minify": "^0.1.4",
+    "babel-preset-minify": "^0.2.0",
     "fs-readdir-recursive": "^1.0.0",
     "mkdirp": "^0.5.1",
     "util.promisify": "^1.0.0",
diff --git a/packages/babel-minify/src/cli.js b/packages/babel-minify/src/cli.js
index cdc4b5e..275daa3 100644
--- a/packages/babel-minify/src/cli.js
+++ b/packages/babel-minify/src/cli.js
@@ -252,10 +252,12 @@ async function run(args) {
 
   const options = getMinifyOpts(argv);
 
-  if (!process.stdin.isTTY) {
-    return runStdin(argv, options);
-  } else if (argv._.length <= 0) {
-    return printHelpInfo({ exitCode: 1 });
+  if (argv._.length <= 0) {
+    if (!process.stdin.isTTY) {
+      return runStdin(argv, options);
+    } else {
+      return printHelpInfo({ exitCode: 1 });
+    }
   } else if (argv._.length === 1 && (await isFile(argv._[0]))) {
     return runFile(argv, options);
   } else {
diff --git a/packages/babel-plugin-minify-builtins/package.json b/packages/babel-plugin-minify-builtins/package.json
index 9cf99ba..d389eec 100644
--- a/packages/babel-plugin-minify-builtins/package.json
+++ b/packages/babel-plugin-minify-builtins/package.json
@@ -1,6 +1,6 @@
 {
   "name": "babel-plugin-minify-builtins",
-  "version": "0.1.3",
+  "version": "0.2.0",
   "description": "Minify Standard built-in Objects",
   "keywords": [
     "babel-plugin",
@@ -13,6 +13,6 @@
   "main": "lib/index.js",
   "repository": "https://github.com/babel/minify/tree/master/packages/babel-plugin-minify-builtins",
   "dependencies": {
-    "babel-helper-evaluate-path": "^0.1.0"
+    "babel-helper-evaluate-path": "^0.2.0"
   }
 }
diff --git a/packages/babel-plugin-minify-constant-folding/package.json b/packages/babel-plugin-minify-constant-folding/package.json
index 0fcbf0b..612fd57 100644
--- a/packages/babel-plugin-minify-constant-folding/package.json
+++ b/packages/babel-plugin-minify-constant-folding/package.json
@@ -1,6 +1,6 @@
 {
   "name": "babel-plugin-minify-constant-folding",
-  "version": "0.1.3",
+  "version": "0.2.0",
   "description": "",
   "keywords": [
     "babel-plugin"
@@ -12,6 +12,6 @@
   "main": "lib/index.js",
   "repository": "https://github.com/babel/minify/tree/master/packages/babel-plugin-minify-constant-folding",
   "dependencies": {
-    "babel-helper-evaluate-path": "^0.1.0"
+    "babel-helper-evaluate-path": "^0.2.0"
   }
 }
diff --git a/packages/babel-plugin-minify-constant-folding/src/index.js b/packages/babel-plugin-minify-constant-folding/src/index.js
index 729919d..8b15665 100644
--- a/packages/babel-plugin-minify-constant-folding/src/index.js
+++ b/packages/babel-plugin-minify-constant-folding/src/index.js
@@ -19,7 +19,7 @@ function getName(member) {
 }
 
 function swap(path, member, handlers, ...args) {
-  const key = getName(member);
+  const key = getName(member.node);
   if (key === undefined) return;
   let handler = handlers[key];
   if (
@@ -27,12 +27,12 @@ function swap(path, member, handlers, ...args) {
     !Object.hasOwnProperty.call(handlers, key)
   ) {
     if (typeof handlers[FALLBACK_HANDLER] === "function") {
-      handler = handlers[FALLBACK_HANDLER].bind(member.object, key);
+      handler = handlers[FALLBACK_HANDLER].bind(member.get("object"), key);
     } else {
       return false;
     }
   }
-  const replacement = handler.apply(member.object, args);
+  const replacement = handler.apply(member.get("object"), args);
   if (replacement) {
     path.replaceWith(replacement);
     return true;
@@ -168,18 +168,18 @@ module.exports = babel => {
       },
       CallExpression(path) {
         const { node } = path;
-        const { callee: member } = node;
+        const member = path.get("callee");
         if (t.isMemberExpression(member)) {
-          const helpers = replacements[member.object.type];
+          const helpers = replacements[member.node.object.type];
           if (!helpers || !helpers.calls) return;
           swap(path, member, helpers.calls, ...node.arguments);
         }
       },
       MemberExpression(path) {
-        const { node: member } = path;
-        const helpers = replacements[member.object.type];
+        const { node } = path;
+        const helpers = replacements[node.object.type];
         if (!helpers || !helpers.members) return;
-        swap(path, member, helpers.members);
+        swap(path, path, helpers.members);
       }
     }
   };
diff --git a/packages/babel-plugin-minify-constant-folding/src/replacements.js b/packages/babel-plugin-minify-constant-folding/src/replacements.js
index 0cbc591..ae52887 100644
--- a/packages/babel-plugin-minify-constant-folding/src/replacements.js
+++ b/packages/babel-plugin-minify-constant-folding/src/replacements.js
@@ -14,7 +14,7 @@ module.exports = ({ types: t }) => {
   function defaultZero(cb) {
     return function(i = t.numericLiteral(0), ...args) {
       if (t.isNumericLiteral(i)) {
-        return cb.call(this, this, i.value, ...args);
+        return cb.call(this.node, this.node, i.value, ...args);
       }
     };
   }
@@ -23,17 +23,17 @@ module.exports = ({ types: t }) => {
     ArrayExpression: {
       members: {
         length() {
-          if (this.elements.some(el => t.isSpreadElement(el))) {
+          if (this.node.elements.some(el => t.isSpreadElement(el))) {
             return;
           }
-          return t.numericLiteral(this.elements.length);
+          return t.numericLiteral(this.node.elements.length);
         },
         [FALLBACK_HANDLER](i) {
-          if (this.elements.some(el => t.isSpreadElement(el))) {
+          if (this.node.elements.some(el => t.isSpreadElement(el))) {
             return;
           }
           if (typeof i === "number" || i.match(/^\d+$/)) {
-            return this.elements[i] || undef;
+            return this.node.elements[i] || undef;
           }
         }
       },
@@ -41,39 +41,40 @@ module.exports = ({ types: t }) => {
         join(sep = t.stringLiteral(",")) {
           if (!t.isStringLiteral(sep)) return;
           let bad = false;
-          const str = this.elements
+          const str = this.get("elements")
             .map(el => {
-              if (!t.isLiteral(el)) {
+              const evaled = el.evaluate();
+              if (!evaled.confident) {
                 bad = true;
                 return;
               }
-              return el.value;
+              return evaled.value;
             })
             .join(sep.value);
           return bad ? undefined : t.stringLiteral(str);
         },
         push(...args) {
-          return t.numericLiteral(this.elements.length + args.length);
+          return t.numericLiteral(this.node.elements.length + args.length);
         },
         shift() {
-          if (this.elements.length === 0) {
+          if (this.node.elements.length === 0) {
             return undef;
           }
-          return t.numericLiteral(this.elements.length - 1);
+          return t.numericLiteral(this.node.elements.length - 1);
         },
         slice(start = t.numericLiteral(0), end) {
           if (!t.isNumericLiteral(start) || (end && !t.isNumericLiteral(end))) {
             return;
           }
           return t.arrayExpression(
-            this.elements.slice(start.value, end && end.value)
+            this.node.elements.slice(start.value, end && end.value)
           );
         },
         pop() {
-          return this.elements[this.elements.length - 1] || undef;
+          return this.node.elements[this.node.elements.length - 1] || undef;
         },
         reverse() {
-          return t.arrayExpression(this.elements.reverse());
+          return t.arrayExpression(this.node.elements.reverse());
         },
         splice(start, end, ...args) {
           if (!t.isNumericLiteral(start) || (end && !t.isNumericLiteral(end))) {
@@ -83,7 +84,7 @@ module.exports = ({ types: t }) => {
             args.unshift(end.value);
           }
           return t.arrayExpression(
-            this.elements.slice().splice(start.value, ...args)
+            this.node.elements.slice().splice(start.value, ...args)
           );
         }
       }
@@ -91,11 +92,11 @@ module.exports = ({ types: t }) => {
     StringLiteral: {
       members: {
         length() {
-          return t.numericLiteral(this.value.length);
+          return t.numericLiteral(this.node.value.length);
         },
         [FALLBACK_HANDLER](i) {
           if (typeof i === "number" || i.match(/^\d+$/)) {
-            const ch = this.value[i];
+            const ch = this.node.value[i];
             return ch ? t.stringLiteral(ch) : undef;
           }
         }
@@ -111,7 +112,7 @@ module.exports = ({ types: t }) => {
           }
           if (realSep !== null) {
             return t.arrayExpression(
-              this.value.split(realSep).map(str => t.stringLiteral(str))
+              this.node.value.split(realSep).map(str => t.stringLiteral(str))
             );
           }
         },
diff --git a/packages/babel-plugin-minify-dead-code-elimination/package.json b/packages/babel-plugin-minify-dead-code-elimination/package.json
index b423c33..0534106 100644
--- a/packages/babel-plugin-minify-dead-code-elimination/package.json
+++ b/packages/babel-plugin-minify-dead-code-elimination/package.json
@@ -1,6 +1,6 @@
 {
   "name": "babel-plugin-minify-dead-code-elimination",
-  "version": "0.1.7",
+  "version": "0.2.0",
   "description": "",
   "keywords": [
     "babel-plugin"
@@ -12,9 +12,9 @@
   "main": "lib/index.js",
   "repository": "https://github.com/babel/minify/tree/master/packages/babel-plugin-minify-dead-code-elimination",
   "dependencies": {
-    "babel-helper-evaluate-path": "^0.1.0",
-    "babel-helper-mark-eval-scopes": "^0.1.1",
-    "babel-helper-remove-or-void": "^0.1.1",
+    "babel-helper-evaluate-path": "^0.2.0",
+    "babel-helper-mark-eval-scopes": "^0.2.0",
+    "babel-helper-remove-or-void": "^0.2.0",
     "lodash.some": "^4.6.0"
   }
 }
diff --git a/packages/babel-plugin-minify-flip-comparisons/package.json b/packages/babel-plugin-minify-flip-comparisons/package.json
index e85d102..91f1f4a 100644
--- a/packages/babel-plugin-minify-flip-comparisons/package.json
+++ b/packages/babel-plugin-minify-flip-comparisons/package.json
@@ -1,6 +1,6 @@
 {
   "name": "babel-plugin-minify-flip-comparisons",
-  "version": "0.1.2",
+  "version": "0.2.0",
   "description": "",
   "keywords": [
     "babel-plugin"
@@ -12,6 +12,6 @@
   "main": "lib/index.js",
   "repository": "https://github.com/babel/minify/tree/master/packages/babel-plugin-minify-flip-comparisons",
   "dependencies": {
-    "babel-helper-is-void-0": "^0.1.1"
+    "babel-helper-is-void-0": "^0.2.0"
   }
 }
diff --git a/packages/babel-plugin-minify-guarded-expressions/package.json b/packages/babel-plugin-minify-guarded-expressions/package.json
index 93e7486..dfc037e 100644
--- a/packages/babel-plugin-minify-guarded-expressions/package.json
+++ b/packages/babel-plugin-minify-guarded-expressions/package.json
@@ -1,6 +1,6 @@
 {
   "name": "babel-plugin-minify-guarded-expressions",
-  "version": "0.1.2",
+  "version": "0.2.0",
   "description": "",
   "keywords": [
     "babel-plugin"
@@ -12,6 +12,6 @@
   "main": "lib/index.js",
   "repository": "https://github.com/babel/minify/tree/master/packages/babel-plugin-minify-guarded-expressions",
   "dependencies": {
-    "babel-helper-flip-expressions": "^0.1.2"
+    "babel-helper-flip-expressions": "^0.2.0"
   }
 }
diff --git a/packages/babel-plugin-minify-infinity/package.json b/packages/babel-plugin-minify-infinity/package.json
index 9a13a0f..46279d7 100644
--- a/packages/babel-plugin-minify-infinity/package.json
+++ b/packages/babel-plugin-minify-infinity/package.json
@@ -1,6 +1,6 @@
 {
   "name": "babel-plugin-minify-infinity",
-  "version": "0.1.2",
+  "version": "0.2.0",
   "description": "",
   "keywords": [
     "babel-plugin"
diff --git a/packages/babel-plugin-minify-mangle-names/package.json b/packages/babel-plugin-minify-mangle-names/package.json
index 2df14c8..e2642d9 100644
--- a/packages/babel-plugin-minify-mangle-names/package.json
+++ b/packages/babel-plugin-minify-mangle-names/package.json
@@ -1,6 +1,6 @@
 {
   "name": "babel-plugin-minify-mangle-names",
-  "version": "0.1.3",
+  "version": "0.2.0",
   "description": "",
   "keywords": [
     "babel-plugin"
@@ -12,6 +12,6 @@
   "main": "lib/index.js",
   "repository": "https://github.com/babel/minify/tree/master/packages/babel-plugin-minify-mangle-names",
   "dependencies": {
-    "babel-helper-mark-eval-scopes": "^0.1.1"
+    "babel-helper-mark-eval-scopes": "^0.2.0"
   }
 }
diff --git a/packages/babel-plugin-minify-numeric-literals/package.json b/packages/babel-plugin-minify-numeric-literals/package.json
index 1f13052..d85d986 100644
--- a/packages/babel-plugin-minify-numeric-literals/package.json
+++ b/packages/babel-plugin-minify-numeric-literals/package.json
@@ -1,6 +1,6 @@
 {
   "name": "babel-plugin-minify-numeric-literals",
-  "version": "0.1.1",
+  "version": "0.2.0",
   "description": "Shortens numeric literals using scientific notation",
   "keywords": [
     "babel-minify",
@@ -11,7 +11,5 @@
   "license": "MIT",
   "author": "kangax",
   "main": "lib/index.js",
-  "repository": "https://github.com/babel/minify/tree/master/packages/babel-plugin-minify-numeric-literals",
-  "dependencies": {},
-  "devDependencies": {}
+  "repository": "https://github.com/babel/minify/tree/master/packages/babel-plugin-minify-numeric-literals"
 }
diff --git a/packages/babel-plugin-minify-replace/package.json b/packages/babel-plugin-minify-replace/package.json
index 5fd6565..d319778 100644
--- a/packages/babel-plugin-minify-replace/package.json
+++ b/packages/babel-plugin-minify-replace/package.json
@@ -1,6 +1,6 @@
 {
   "name": "babel-plugin-minify-replace",
-  "version": "0.1.2",
+  "version": "0.2.0",
   "description": "",
   "keywords": [
     "babel-plugin"
diff --git a/packages/babel-plugin-minify-simplify/package.json b/packages/babel-plugin-minify-simplify/package.json
index 039d44e..e4a7e99 100644
--- a/packages/babel-plugin-minify-simplify/package.json
+++ b/packages/babel-plugin-minify-simplify/package.json
@@ -1,6 +1,6 @@
 {
   "name": "babel-plugin-minify-simplify",
-  "version": "0.1.2",
+  "version": "0.2.0",
   "description": "",
   "keywords": [
     "babel-plugin"
@@ -12,8 +12,8 @@
   "main": "lib/index.js",
   "repository": "https://github.com/babel/minify/tree/master/packages/babel-plugin-minify-simplify",
   "dependencies": {
-    "babel-helper-flip-expressions": "^0.1.2",
+    "babel-helper-flip-expressions": "^0.2.0",
     "babel-helper-is-nodes-equiv": "^0.0.1",
-    "babel-helper-to-multiple-sequence-expressions": "^0.1.1"
+    "babel-helper-to-multiple-sequence-expressions": "^0.2.0"
   }
 }
diff --git a/packages/babel-plugin-minify-type-constructors/package.json b/packages/babel-plugin-minify-type-constructors/package.json
index 5be1b84..5d88227 100644
--- a/packages/babel-plugin-minify-type-constructors/package.json
+++ b/packages/babel-plugin-minify-type-constructors/package.json
@@ -1,6 +1,6 @@
 {
   "name": "babel-plugin-minify-type-constructors",
-  "version": "0.1.2",
+  "version": "0.2.0",
   "description": "",
   "keywords": [
     "babel-plugin"
@@ -12,6 +12,6 @@
   "main": "lib/index.js",
   "repository": "https://github.com/babel/minify/tree/master/packages/babel-plugin-minify-type-constructors",
   "dependencies": {
-    "babel-helper-is-void-0": "^0.1.1"
+    "babel-helper-is-void-0": "^0.2.0"
   }
 }
diff --git a/packages/babel-plugin-transform-inline-consecutive-adds/package.json b/packages/babel-plugin-transform-inline-consecutive-adds/package.json
index 7b6819b..584be82 100644
--- a/packages/babel-plugin-transform-inline-consecutive-adds/package.json
+++ b/packages/babel-plugin-transform-inline-consecutive-adds/package.json
@@ -1,6 +1,6 @@
 {
   "name": "babel-plugin-transform-inline-consecutive-adds",
-  "version": "0.1.2",
+  "version": "0.2.0",
   "description": "This plugin inlines consecutive property assignments, array pushes, etc.",
   "keywords": [
     "babel-plugin"
diff --git a/packages/babel-plugin-transform-inline-environment-variables/package.json b/packages/babel-plugin-transform-inline-environment-variables/package.json
index 55531c9..4b112b0 100644
--- a/packages/babel-plugin-transform-inline-environment-variables/package.json
+++ b/packages/babel-plugin-transform-inline-environment-variables/package.json
@@ -1,6 +1,6 @@
 {
   "name": "babel-plugin-transform-inline-environment-variables",
-  "version": "0.1.1",
+  "version": "0.2.0",
   "description": "Inline environment variables.",
   "keywords": [
     "babel-plugin"
@@ -10,7 +10,5 @@
   "license": "MIT",
   "author": "amasad",
   "main": "lib/index.js",
-  "repository": "https://github.com/babel/minify/tree/master/packages/babel-plugin-transform-inline-environment-variables",
-  "dependencies": {},
-  "devDependencies": {}
+  "repository": "https://github.com/babel/minify/tree/master/packages/babel-plugin-transform-inline-environment-variables"
 }
diff --git a/packages/babel-plugin-transform-member-expression-literals/package.json b/packages/babel-plugin-transform-member-expression-literals/package.json
index c645111..6979228 100644
--- a/packages/babel-plugin-transform-member-expression-literals/package.json
+++ b/packages/babel-plugin-transform-member-expression-literals/package.json
@@ -1,6 +1,6 @@
 {
   "name": "babel-plugin-transform-member-expression-literals",
-  "version": "6.8.4",
+  "version": "6.8.5",
   "description": "Turn valid member expression property literals into plain identifiers",
   "keywords": [
     "babel-plugin"
diff --git a/packages/babel-plugin-transform-merge-sibling-variables/package.json b/packages/babel-plugin-transform-merge-sibling-variables/package.json
index df64a0f..83b1062 100644
--- a/packages/babel-plugin-transform-merge-sibling-variables/package.json
+++ b/packages/babel-plugin-transform-merge-sibling-variables/package.json
@@ -1,6 +1,6 @@
 {
   "name": "babel-plugin-transform-merge-sibling-variables",
-  "version": "6.8.5",
+  "version": "6.8.6",
   "description": "Merge sibling variables into one.",
   "keywords": [
     "babel-plugin"
diff --git a/packages/babel-plugin-transform-minify-booleans/package.json b/packages/babel-plugin-transform-minify-booleans/package.json
index 72f1d72..778fd7c 100644
--- a/packages/babel-plugin-transform-minify-booleans/package.json
+++ b/packages/babel-plugin-transform-minify-booleans/package.json
@@ -1,6 +1,6 @@
 {
   "name": "babel-plugin-transform-minify-booleans",
-  "version": "6.8.2",
+  "version": "6.8.3",
   "description": "Turn boolean literals into !0 for true and !1 for false.",
   "keywords": [
     "babel-plugin"
@@ -10,7 +10,5 @@
   "license": "MIT",
   "author": "amasad",
   "main": "lib/index.js",
-  "repository": "https://github.com/babel/minify/tree/master/packages/babel-plugin-transform-minify-booleans",
-  "dependencies": {},
-  "devDependencies": {}
+  "repository": "https://github.com/babel/minify/tree/master/packages/babel-plugin-transform-minify-booleans"
 }
diff --git a/packages/babel-plugin-transform-node-env-inline/package.json b/packages/babel-plugin-transform-node-env-inline/package.json
index 1e5bbba..980f9e9 100644
--- a/packages/babel-plugin-transform-node-env-inline/package.json
+++ b/packages/babel-plugin-transform-node-env-inline/package.json
@@ -1,6 +1,6 @@
 {
   "name": "babel-plugin-transform-node-env-inline",
-  "version": "0.1.1",
+  "version": "0.2.0",
   "description": "Inline the `NODE_ENV` environment variable and evaluate it if possible",
   "keywords": [
     "babel-plugin"
@@ -10,7 +10,5 @@
   "license": "MIT",
   "author": "amasad",
   "main": "lib/index.js",
-  "repository": "https://github.com/babel/minify/tree/master/packages/babel-plugin-transform-node-env-inline",
-  "dependencies": {},
-  "devDependencies": {}
+  "repository": "https://github.com/babel/minify/tree/master/packages/babel-plugin-transform-node-env-inline"
 }
diff --git a/packages/babel-plugin-transform-property-literals/package.json b/packages/babel-plugin-transform-property-literals/package.json
index b87c615..d76a2ea 100644
--- a/packages/babel-plugin-transform-property-literals/package.json
+++ b/packages/babel-plugin-transform-property-literals/package.json
@@ -1,6 +1,6 @@
 {
   "name": "babel-plugin-transform-property-literals",
-  "version": "6.8.4",
+  "version": "6.8.5",
   "description": "Turn valid property key literals to plain identifiers",
   "keywords": [
     "babel-plugin"
diff --git a/packages/babel-plugin-transform-regexp-constructors/package.json b/packages/babel-plugin-transform-regexp-constructors/package.json
index 6468eb8..6cb3921 100644
--- a/packages/babel-plugin-transform-regexp-constructors/package.json
+++ b/packages/babel-plugin-transform-regexp-constructors/package.json
@@ -1,6 +1,6 @@
 {
   "name": "babel-plugin-transform-regexp-constructors",
-  "version": "0.1.1",
+  "version": "0.2.0",
   "description": "This changes RegExp constructors into literals if the RegExp arguments are strings.",
   "keywords": [
     "babel-plugin"
@@ -10,7 +10,5 @@
   "license": "MIT",
   "author": "shinew",
   "main": "lib/index.js",
-  "repository": "https://github.com/babel/minify/tree/master/packages/babel-plugin-transform-regexp-constructors",
-  "dependencies": {},
-  "devDependencies": {}
+  "repository": "https://github.com/babel/minify/tree/master/packages/babel-plugin-transform-regexp-constructors"
 }
diff --git a/packages/babel-plugin-transform-remove-console/README.md b/packages/babel-plugin-transform-remove-console/README.md
index 0c1322d..e83975b 100644
--- a/packages/babel-plugin-transform-remove-console/README.md
+++ b/packages/babel-plugin-transform-remove-console/README.md
@@ -29,11 +29,19 @@ npm install babel-plugin-transform-remove-console
 **.babelrc**
 
 ```json
+// without options
 {
   "plugins": ["transform-remove-console"]
 }
 ```
 
+```json
+// with options
+{
+  "plugins": [ ["transform-remove-console", { "exclude": [ "error", "warn"] }] ]
+}
+```
+
 ### Via CLI
 
 ```sh
@@ -47,3 +55,7 @@ require("babel-core").transform("code", {
   plugins: ["transform-remove-console"]
 });
 ```
+
+## Options
+
++ `exclude` - An array of console methods to exclude from removal.
diff --git a/packages/babel-plugin-transform-remove-console/package.json b/packages/babel-plugin-transform-remove-console/package.json
index 2548d48..447d5c7 100644
--- a/packages/babel-plugin-transform-remove-console/package.json
+++ b/packages/babel-plugin-transform-remove-console/package.json
@@ -1,6 +1,6 @@
 {
   "name": "babel-plugin-transform-remove-console",
-  "version": "6.8.4",
+  "version": "6.8.5",
   "description": "Remove all console.* calls.",
   "keywords": [
     "babel-plugin"
diff --git a/packages/babel-plugin-transform-remove-console/src/index.js b/packages/babel-plugin-transform-remove-console/src/index.js
index 792356b..8e6bfb6 100644
--- a/packages/babel-plugin-transform-remove-console/src/index.js
+++ b/packages/babel-plugin-transform-remove-console/src/index.js
@@ -4,26 +4,29 @@ module.exports = function({ types: t }) {
   return {
     name: "transform-remove-console",
     visitor: {
-      CallExpression(path) {
+      CallExpression(path, state) {
         const callee = path.get("callee");
 
         if (!callee.isMemberExpression()) return;
 
-        if (isConsole(callee)) {
+        if (isIncludedConsole(callee, state.opts.exclude)) {
           // console.log()
           if (path.parentPath.isExpressionStatement()) {
             path.remove();
           } else {
             path.replaceWith(createVoid0());
           }
-        } else if (isConsoleBind(callee)) {
+        } else if (isIncludedConsoleBind(callee, state.opts.exclude)) {
           // console.log.bind()
           path.replaceWith(createNoop());
         }
       },
       MemberExpression: {
-        exit(path) {
-          if (isConsole(path) && !path.parentPath.isMemberExpression()) {
+        exit(path, state) {
+          if (
+            isIncludedConsole(path, state.opts.exclude) &&
+            !path.parentPath.isMemberExpression()
+          ) {
             if (
               path.parentPath.isAssignmentExpression() &&
               path.parentKey === "left"
@@ -47,11 +50,20 @@ module.exports = function({ types: t }) {
     );
   }
 
-  function isConsole(memberExpr) {
+  function isExcluded(property, excludeArray) {
+    return (
+      excludeArray && excludeArray.some(name => property.isIdentifier({ name }))
+    );
+  }
+
+  function isIncludedConsole(memberExpr, excludeArray) {
     const object = memberExpr.get("object");
+    const property = memberExpr.get("property");
+
+    if (isExcluded(property, excludeArray)) return false;
+
     if (isGlobalConsoleId(object)) return true;
 
-    const property = memberExpr.get("property");
     return (
       isGlobalConsoleId(object.get("object")) &&
       (property.isIdentifier({ name: "call" }) ||
@@ -59,10 +71,13 @@ module.exports = function({ types: t }) {
     );
   }
 
-  function isConsoleBind(memberExpr) {
+  function isIncludedConsoleBind(memberExpr, excludeArray) {
     const object = memberExpr.get("object");
+
+    if (!object.isMemberExpression()) return false;
+    if (isExcluded(object.get("property"), excludeArray)) return false;
+
     return (
-      object.isMemberExpression() &&
       isGlobalConsoleId(object.get("object")) &&
       memberExpr.get("property").isIdentifier({ name: "bind" })
     );
diff --git a/packages/babel-plugin-transform-remove-debugger/package.json b/packages/babel-plugin-transform-remove-debugger/package.json
index 28990ae..8394fab 100644
--- a/packages/babel-plugin-transform-remove-debugger/package.json
+++ b/packages/babel-plugin-transform-remove-debugger/package.json
@@ -1,6 +1,6 @@
 {
   "name": "babel-plugin-transform-remove-debugger",
-  "version": "6.8.4",
+  "version": "6.8.5",
   "description": "Remove debugger statements",
   "keywords": [
     "babel-plugin"
diff --git a/packages/babel-plugin-transform-remove-undefined/README.md b/packages/babel-plugin-transform-remove-undefined/README.md
index 6b48e23..32f7f5a 100644
--- a/packages/babel-plugin-transform-remove-undefined/README.md
+++ b/packages/babel-plugin-transform-remove-undefined/README.md
@@ -57,3 +57,7 @@ require("babel-core").transform("code", {
   plugins: ["babel-plugin-transform-remove-undefined"]
 });
 ```
+
+## Options
+
++ `tdz` - Detect usages before declaration/initialization in let/const(throws) and var(void 0)
diff --git a/packages/babel-plugin-transform-remove-undefined/package.json b/packages/babel-plugin-transform-remove-undefined/package.json
index cd720c4..1e1c8ca 100644
--- a/packages/babel-plugin-transform-remove-undefined/package.json
+++ b/packages/babel-plugin-transform-remove-undefined/package.json
@@ -1,6 +1,6 @@
 {
   "name": "babel-plugin-transform-remove-undefined",
-  "version": "0.1.2",
+  "version": "0.2.0",
   "description": "This removes rvals that are equivalent to undefined wherever possible",
   "keywords": [
     "babel-plugin"
@@ -10,5 +10,8 @@
   "license": "MIT",
   "author": "shinew",
   "main": "lib/index.js",
-  "repository": "https://github.com/babel/minify/tree/master/packages/babel-plugin-transform-remove-undefined"
+  "repository": "https://github.com/babel/minify/tree/master/packages/babel-plugin-transform-remove-undefined",
+  "dependencies": {
+    "babel-helper-evaluate-path": "^0.2.0"
+  }
 }
diff --git a/packages/babel-plugin-transform-remove-undefined/src/index.js b/packages/babel-plugin-transform-remove-undefined/src/index.js
index 5cfccd1..6cb210e 100644
--- a/packages/babel-plugin-transform-remove-undefined/src/index.js
+++ b/packages/babel-plugin-transform-remove-undefined/src/index.js
@@ -1,6 +1,11 @@
 "use strict";
 
-function isPureAndUndefined(rval, scope = { hasBinding: () => false }) {
+const evaluate = require("babel-helper-evaluate-path");
+
+function isPureAndUndefined(
+  rval,
+  { tdz, scope = { hasBinding: () => false } } = {}
+) {
   if (rval.isIdentifier() && rval.node.name === "undefined") {
     // deopt right away if undefined is a local binding
     if (scope.hasBinding(rval.node.name, true /* no globals */)) {
@@ -12,7 +17,7 @@ function isPureAndUndefined(rval, scope = { hasBinding: () => false }) {
   if (!rval.isPure()) {
     return false;
   }
-  const evaluation = rval.evaluate();
+  const evaluation = evaluate(rval, { tdz });
   return evaluation.confident === true && evaluation.value === undefined;
 }
 
@@ -96,12 +101,12 @@ module.exports = function() {
   return {
     name: "transform-remove-undefined",
     visitor: {
-      SequenceExpression(path) {
+      SequenceExpression(path, { opts: { tdz } = {} }) {
         const expressions = path.get("expressions");
 
         for (let i = 0; i < expressions.length; i++) {
           const expr = expressions[i];
-          if (!isPureAndUndefined(expr, path.scope)) continue;
+          if (!isPureAndUndefined(expr, { tdz, scope: path.scope })) continue;
 
           // last value
           if (i === expressions.length - 1) {
@@ -114,21 +119,26 @@ module.exports = function() {
         }
       },
 
-      ReturnStatement(path) {
+      ReturnStatement(path, { opts: { tdz } = {} }) {
         if (path.node.argument !== null) {
-          if (isPureAndUndefined(path.get("argument"), path.scope)) {
+          if (
+            isPureAndUndefined(path.get("argument"), {
+              tdz,
+              scope: path.scope
+            })
+          ) {
             path.node.argument = null;
           }
         }
       },
 
-      VariableDeclaration(path) {
+      VariableDeclaration(path, { opts: { tdz } = {} }) {
         switch (path.node.kind) {
           case "const":
             break;
           case "let":
             for (const declarator of path.get("declarations")) {
-              if (isPureAndUndefined(declarator.get("init"))) {
+              if (isPureAndUndefined(declarator.get("init"), { tdz })) {
                 declarator.node.init = null;
               }
             }
diff --git a/packages/babel-plugin-transform-simplify-comparison-operators/package.json b/packages/babel-plugin-transform-simplify-comparison-operators/package.json
index 77de337..283c820 100644
--- a/packages/babel-plugin-transform-simplify-comparison-operators/package.json
+++ b/packages/babel-plugin-transform-simplify-comparison-operators/package.json
@@ -1,6 +1,6 @@
 {
   "name": "babel-plugin-transform-simplify-comparison-operators",
-  "version": "6.8.4",
+  "version": "6.8.5",
   "description": "Convert === and !== to == and != if their types are inferred to be the same.",
   "keywords": [
     "babel-plugin"
diff --git a/packages/babel-plugin-transform-undefined-to-void/package.json b/packages/babel-plugin-transform-undefined-to-void/package.json
index 9b05c7f..c6d15d5 100644
--- a/packages/babel-plugin-transform-undefined-to-void/package.json
+++ b/packages/babel-plugin-transform-undefined-to-void/package.json
@@ -1,6 +1,6 @@
 {
   "name": "babel-plugin-transform-undefined-to-void",
-  "version": "6.8.2",
+  "version": "6.8.3",
   "description": "Replace references to `undefined` with `void 0`",
   "keywords": [
     "babel-plugin"
@@ -10,7 +10,5 @@
   "license": "MIT",
   "author": "amasad",
   "main": "lib/index.js",
-  "repository": "https://github.com/babel/minify/tree/master/packages/babel-plugin-transform-undefined-to-void",
-  "dependencies": {},
-  "devDependencies": {}
+  "repository": "https://github.com/babel/minify/tree/master/packages/babel-plugin-transform-undefined-to-void"
 }
diff --git a/packages/babel-preset-minify/README.md b/packages/babel-preset-minify/README.md
index 94eb91f..33de53a 100644
--- a/packages/babel-preset-minify/README.md
+++ b/packages/babel-preset-minify/README.md
@@ -100,7 +100,7 @@ OptionName          | Plugins
 ----------          | -------
 keepFnName          | Passed to [mangle][mangle] & [deadcode][deadcode]
 keepClassName       | Passed to [mangle][mangle] & [deadcode][deadcode]
-tdz                 | Passed to [builtIns][builtIns], [evaluate][evaluate] & [deadcode][deadcode]
+tdz                 | Passed to [builtIns][builtIns], [evaluate][evaluate], [deadcode][deadcode], [removeUndefined][removeUndefined]
 
 **Examples**
 
diff --git a/packages/babel-preset-minify/package.json b/packages/babel-preset-minify/package.json
index cb767f4..1904063 100644
--- a/packages/babel-preset-minify/package.json
+++ b/packages/babel-preset-minify/package.json
@@ -1,6 +1,6 @@
 {
   "name": "babel-preset-minify",
-  "version": "0.1.4",
+  "version": "0.2.0",
   "description": "",
   "keywords": [
     "babel-minify",
@@ -14,28 +14,28 @@
   "main": "lib/index.js",
   "repository": "https://github.com/babel/minify/tree/master/packages/babel-preset-minify",
   "dependencies": {
-    "babel-plugin-minify-builtins": "^0.1.3",
-    "babel-plugin-minify-constant-folding": "^0.1.3",
-    "babel-plugin-minify-dead-code-elimination": "^0.1.7",
-    "babel-plugin-minify-flip-comparisons": "^0.1.2",
-    "babel-plugin-minify-guarded-expressions": "^0.1.2",
-    "babel-plugin-minify-infinity": "^0.1.2",
-    "babel-plugin-minify-mangle-names": "^0.1.3",
-    "babel-plugin-minify-numeric-literals": "^0.1.1",
-    "babel-plugin-minify-replace": "^0.1.2",
-    "babel-plugin-minify-simplify": "^0.1.2",
-    "babel-plugin-minify-type-constructors": "^0.1.2",
-    "babel-plugin-transform-inline-consecutive-adds": "^0.1.2",
-    "babel-plugin-transform-member-expression-literals": "^6.8.4",
-    "babel-plugin-transform-merge-sibling-variables": "^6.8.5",
-    "babel-plugin-transform-minify-booleans": "^6.8.2",
-    "babel-plugin-transform-property-literals": "^6.8.4",
-    "babel-plugin-transform-regexp-constructors": "^0.1.1",
-    "babel-plugin-transform-remove-console": "^6.8.4",
-    "babel-plugin-transform-remove-debugger": "^6.8.4",
-    "babel-plugin-transform-remove-undefined": "^0.1.2",
-    "babel-plugin-transform-simplify-comparison-operators": "^6.8.4",
-    "babel-plugin-transform-undefined-to-void": "^6.8.2",
+    "babel-plugin-minify-builtins": "^0.2.0",
+    "babel-plugin-minify-constant-folding": "^0.2.0",
+    "babel-plugin-minify-dead-code-elimination": "^0.2.0",
+    "babel-plugin-minify-flip-comparisons": "^0.2.0",
+    "babel-plugin-minify-guarded-expressions": "^0.2.0",
+    "babel-plugin-minify-infinity": "^0.2.0",
+    "babel-plugin-minify-mangle-names": "^0.2.0",
+    "babel-plugin-minify-numeric-literals": "^0.2.0",
+    "babel-plugin-minify-replace": "^0.2.0",
+    "babel-plugin-minify-simplify": "^0.2.0",
+    "babel-plugin-minify-type-constructors": "^0.2.0",
+    "babel-plugin-transform-inline-consecutive-adds": "^0.2.0",
+    "babel-plugin-transform-member-expression-literals": "^6.8.5",
+    "babel-plugin-transform-merge-sibling-variables": "^6.8.6",
+    "babel-plugin-transform-minify-booleans": "^6.8.3",
+    "babel-plugin-transform-property-literals": "^6.8.5",
+    "babel-plugin-transform-regexp-constructors": "^0.2.0",
+    "babel-plugin-transform-remove-console": "^6.8.5",
+    "babel-plugin-transform-remove-debugger": "^6.8.5",
+    "babel-plugin-transform-remove-undefined": "^0.2.0",
+    "babel-plugin-transform-simplify-comparison-operators": "^6.8.5",
+    "babel-plugin-transform-undefined-to-void": "^6.8.3",
     "lodash.isplainobject": "^4.0.6"
   }
 }
diff --git a/packages/babel-preset-minify/src/index.js b/packages/babel-preset-minify/src/index.js
index f6d5963..2784a11 100644
--- a/packages/babel-preset-minify/src/index.js
+++ b/packages/babel-preset-minify/src/index.js
@@ -34,7 +34,7 @@ const PLUGINS = [
 const PROXIES = {
   keepFnName: ["mangle", "deadcode"],
   keepClassName: ["mangle", "deadcode"],
-  tdz: ["builtIns", "evaluate", "deadcode"]
+  tdz: ["builtIns", "evaluate", "deadcode", "removeUndefined"]
 };
 
 module.exports = preset;
diff --git a/packages/gulp-babel-minify/package.json b/packages/gulp-babel-minify/package.json
index 43a2eed..73aba43 100644
--- a/packages/gulp-babel-minify/package.json
+++ b/packages/gulp-babel-minify/package.json
@@ -1,6 +1,6 @@
 {
   "name": "gulp-babel-minify",
-  "version": "0.1.4",
+  "version": "0.2.0",
   "description": "Babel Minify plugin for Gulp",
   "keywords": [
     "babel-minify",
@@ -14,7 +14,7 @@
   "repository": "https://github.com/babel/minify/tree/master/packages/gulp-babel-minify",
   "dependencies": {
     "babel-core": "^6.25.0",
-    "babel-preset-minify": "^0.1.4",
+    "babel-preset-minify": "^0.2.0",
     "gulp-util": "^3.0.8",
     "through2": "^2.0.3",
     "vinyl-sourcemaps-apply": "^0.2.1"


Test patch:
diff --git a/packages/babel-plugin-minify-constant-folding/__tests__/constant-folding-test.js b/packages/babel-plugin-minify-constant-folding/__tests__/constant-folding-test.js
index 2cacfd7..7e7178b 100644
--- a/packages/babel-plugin-minify-constant-folding/__tests__/constant-folding-test.js
+++ b/packages/babel-plugin-minify-constant-folding/__tests__/constant-folding-test.js
@@ -103,6 +103,10 @@ describe("constant-folding-plugin", () => {
     [1, 2, 3].join();
     ["a", "b", "c"].join();
     ["a", "b", "c"].join("@");
+    [null, 1].join("/");
+    [/xyz/im, true].join("abc");
+    [\`a\${xyz}\`].join("1");
+    [\`a\`, \`c\`].join('b');
 
     [1, 2, 3].length;
     [1, 2, 3][1];
@@ -134,6 +138,10 @@ describe("constant-folding-plugin", () => {
     "1,2,3";
     "a,b,c";
     "a@b@c";
+    "/1";
+    [/xyz/im, true].join("abc");
+    [\`a\${xyz}\`].join("1");
+    "abc";
 
     3;
     2;
diff --git a/packages/babel-plugin-transform-remove-console/__tests__/remove-console-test.js b/packages/babel-plugin-transform-remove-console/__tests__/remove-console-test.js
index 7d08317..b3e237e 100644
--- a/packages/babel-plugin-transform-remove-console/__tests__/remove-console-test.js
+++ b/packages/babel-plugin-transform-remove-console/__tests__/remove-console-test.js
@@ -1,8 +1,7 @@
 jest.autoMockOff();
 
-const thePlugin = require("../../../utils/test-transform")(
-  require("../src/index")
-);
+const plugin = require("../src/index");
+const thePlugin = require("../../../utils/test-transform")(plugin);
 
 describe("remove-console-plugin", () => {
   thePlugin(
@@ -144,3 +143,51 @@ describe("remove-console-plugin", () => {
   `
   );
 });
+
+describe("remove-console-plugin with exclude argument", () => {
+  const options = {
+    plugins: [[plugin, { exclude: ["error", "info"] }]]
+  };
+
+  thePlugin(
+    "should not remove excluded options",
+    `
+    function foo() {
+      console.log("foo");
+      console.error("bar");
+      blah();
+      console.info("blah");
+    }
+  `,
+    `
+    function foo() {
+      console.error("bar");
+      blah();
+      console.info("blah");
+    }
+  `,
+    options
+  );
+  thePlugin(
+    "should not remove bound excluded options",
+    `
+    function foo() {
+      const a = console.log;
+      a();
+      const b = console.error.bind(console);
+      b("asdf");
+      blah();
+    }
+  `,
+    `
+    function foo() {
+      const a = function () {};
+      a();
+      const b = console.error.bind(console);
+      b("asdf");
+      blah();
+    }
+    `,
+    options
+  );
+});
diff --git a/packages/babel-preset-minify/__tests__/babili-es2015-tests.js b/packages/babel-preset-minify/__tests__/babili-es2015-tests.js
index 876aff5..49cc15e 100644
--- a/packages/babel-preset-minify/__tests__/babili-es2015-tests.js
+++ b/packages/babel-preset-minify/__tests__/babili-es2015-tests.js
@@ -26,4 +26,42 @@ describe("preset along with es2015", () => {
     cat = _obj.cat, _obj;
   `
   );
+
+  thePlugin(
+    "should fix simplify with es2015 - issue#632",
+    `
+      let obj, key;
+      if (1) ({k: key} = obj);
+      foo();
+    `,
+    `
+      "use strict";
+
+      var obj,
+          key = void 0;
+      key = obj.k, foo();
+    `
+  );
+
+  thePlugin(
+    "should fix issue#614",
+    `
+      function a() {
+        var c = 1
+        class B {}
+        return B
+      }
+    `,
+    `
+      "use strict";
+
+      function _classCallCheck(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function"); }
+
+      function a() {
+        return function a() {
+          _classCallCheck(this, a);
+        };
+      }
+    `
+  );
 });