New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
babel-preset-env && babel@next #242
Conversation
index.js
Outdated
var babel = require("babel-core"); | ||
var util = require("util"); | ||
|
||
var canCompile = require("babel-cli/lib/babel/util").isCompilableExtension; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a public API, you can't just reach in and grab a random file from a package, this could break at any time. babel-core
exposes .DEFAULT_EXTENSIONS
so you should use that.
index.js
Outdated
var canCompile = require("babel-cli/lib/babel/util").isCompilableExtension; | ||
function arrayify(val, mapFn) { | ||
if (!val) return []; | ||
if (typeof val === "boolean") return arrayify([val], mapFn); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there actually a time when someone would pass a boolean to browserify? The function was deleted because it's gross.
index.js
Outdated
function arrayify(val, mapFn) { | ||
if (!val) return []; | ||
if (typeof val === "boolean") return arrayify([val], mapFn); | ||
if (typeof val === "string") return arrayify(list(val), mapFn); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You haven't copied over list
at all, and this might as well just be val = val.split(',');
index.js
Outdated
@@ -37,7 +51,7 @@ Babelify.prototype._flush = function (callback) { | |||
|
|||
Babelify.configure = function (opts) { | |||
opts = assign({}, opts); | |||
var extensions = opts.extensions ? babel.util.arrayify(opts.extensions) : null; | |||
var extensions = opts.extensions ? arrayify(opts.extensions) : null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we know if there is a case where this is strictly necessary? It would be much easier to just enforce that people pass the option as an array in the first place. If the CLI is the concern, are there places where browserify won't convert it from a comma list to an array for us?
thanks for the feedback, recent commit should address your concerns. |
Sorry for the super long delay 😅, going to go with #255 instead! Thanks again. |
Switch from babel-preset-es2015 to support babel-preset-env and provides support for
babel@next