Skip to content
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

Closed
wants to merge 4 commits into from
Closed

babel-preset-env && babel@next #242

wants to merge 4 commits into from

Conversation

chr33s
Copy link

@chr33s chr33s commented Aug 17, 2017

Switch from babel-preset-es2015 to support babel-preset-env and provides support for
babel@next

index.js Outdated
var babel = require("babel-core");
var util = require("util");

var canCompile = require("babel-cli/lib/babel/util").isCompilableExtension;
Copy link
Member

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);
Copy link
Member

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);
Copy link
Member

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;
Copy link
Member

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?

@pioug pioug mentioned this pull request Sep 22, 2017
@chr33s
Copy link
Author

chr33s commented Sep 27, 2017

thanks for the feedback, recent commit should address your concerns.

@hzoo
Copy link
Member

hzoo commented Apr 6, 2018

Sorry for the super long delay 😅, going to go with #255 instead! Thanks again.

@hzoo hzoo closed this Apr 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants