Issue 1:
Input Code

const tryCatchWrapper = (target) => async (...targetArgs) => {
try {
return target(...targetArgs);
} catch (e) {
throw errorObj({_error: e.message});
}
};

Babel Configuration (.babelrc, package.json, cli command)

babeljs.io standard config

Expected Behavior

"use strict";

function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }

var tryCatchWrapper = function tryCatchWrapper(target) {
return function () {
var _ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee() {
for (var _len = arguments.length, targetArgs = Array(_len), _key = 0; _key < _len; _key++) {
targetArgs[_key] = arguments[_key];
}

return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.prev = 0;

targetArgs;
return _context.abrupt("return", target.apply(undefined, targetArgs));

case 5:
_context.prev = 5;
_context.t0 = _context["catch"](0);
throw errorObj({ _error: _context.t0.message });

case 8:
case "end":
return _context.stop();
}
}
}, _callee, undefined, [[0, 5]]);
}));

return function () {
return _ref.apply(this, arguments);
};
}();
};

Current Behavior

"use strict";

var _arguments = arguments;

function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }

var tryCatchWrapper = function tryCatchWrapper(target) {
return function () {
var _ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee() {
var _args = _arguments;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.prev = 0;
return _context.abrupt("return", target.apply(undefined, _args));

case 4:
_context.prev = 4;
_context.t0 = _context["catch"](0);
throw errorObj({ _error: _context.t0.message });

case 7:
case "end":
return _context.stop();
}
}
}, _callee, undefined, [[0, 4]]);
}));

return function () {
return _ref.apply(this, arguments);
};
}();
};

Possible Solution

Reference the destructured args:

const tryCatchWrapper = (target) => async (...targetArgs) => {
try {
targetArgs; // do this!
return target(...targetArgs);
} catch (e) {
throw errorObj({_error: e.message});
}
};

Context

Made a try/catch wrapper for calling stripe. it bugs out! But then when i put a console.log in there, it works fine, which makes it extra confusing.

A call might look like this:

stripe.invoices.retrieveUpcoming = tryCatchWrapper(stripe.invoices.retrieveUpcoming.bind(stripe.invoices));

Your Environment

babeljs.io

Issue 2:
Bug Report

The preset seems to think that Android does not support anything and enables every plugin because of "android": "67" support. Chrome for Android should support most features in that version.

I set up an example repository with basic configuration and debug enabled. Output after npm install/yarn install and npm run demo/yarn run demo is:

> babel-preset-env-demo@1.0.0 demo /home/tom/p/babel-preset-env-demo
> babel index.js

@babel/preset-env: `DEBUG` option

Using targets:
{
"android": "67",
"chrome": "66",
"edge": "17",
"firefox": "60",
"ios": "11",
"safari": "11.1"
}

Using modules transform: commonjs

Using plugins:
transform-template-literals { "android":"67" }
transform-literals { "android":"67" }
transform-function-name { "android":"67", "edge":"17" }
transform-arrow-functions { "android":"67" }
transform-block-scoped-functions { "android":"67" }
transform-classes { "android":"67" }
transform-object-super { "android":"67" }
transform-shorthand-properties { "android":"67" }
transform-duplicate-keys { "android":"67" }
transform-computed-properties { "android":"67" }
transform-for-of { "android":"67" }
transform-sticky-regex { "android":"67" }
transform-dotall-regex { "android":"67", "edge":"17", "firefox":"60", "ios":"11" }
transform-unicode-regex { "android":"67" }
transform-spread { "android":"67" }
transform-parameters { "android":"67" }
transform-destructuring { "android":"67", "edge":"17" }
transform-block-scoping { "android":"67" }
transform-typeof-symbol { "android":"67" }
transform-new-target { "android":"67" }
transform-regenerator { "android":"67" }
transform-exponentiation-operator { "android":"67" }
transform-async-to-generator { "android":"67" }
proposal-async-generator-functions { "android":"67", "edge":"17", "ios":"11", "safari":"11.1" }
proposal-object-rest-spread { "android":"67", "edge":"17", "ios":"11" }
proposal-unicode-property-regex { "android":"67", "edge":"17", "firefox":"60", "ios":"11" }

Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
"use strict";

I would expect the Android browser to support most if not all of these. I guess there is a mapping from Android to the equivalent Chrome versions missing at some point (compat-table, caniuse, browserslist?) and I recall having used Babel 7 previously without this behavior. I imagine some third-party library update to be responsible.

babel.config.js

module.exports = {
presets: [
[
'@babel/env',
{
debug: true,
},
],
],
}

I am not sure if the feature sets of Android x and Chrome x are equivalent starting with some version of if there are numbering and feature differences to account for, but probably either compat-table or preset-env should have some mapping., most likely for all versions of Android >4.4.

Environment

Babel version(s): 7.0.0-beta.54; downgrading to beta.31 did not help.

Node/npm version: Node v10.7.0

OS: Debian GNU/Linux

How you are using Babel: cli and loader