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

Make buildExportAll generate pure ES5 code. #3391

Merged
merged 1 commit into from
Mar 3, 2016

Conversation

benjamn
Copy link
Contributor

@benjamn benjamn commented Mar 2, 2016

The untransformed let keyword causes problems for older parsers. I understand using let instead of var ensures each getter function has its own binding for the KEY variable, but the same can be accomplished (with less code) using a .forEach callback function, and this way there's no need to worry about generating a unique name for the key variable.

The untransformed `let` keyword causes problems for older parsers. I
understand using `let` instead of `var` ensures each getter function has
its own binding for the KEY variable, but the same can be accomplished
(with less code) using a `.forEach` callback function, and this way
there's no need to worry about generating a unique name for the `key`
variable.
@loganfsmyth
Copy link
Member

I appreciate the effort, but as long as you have the block scoping transform enabled, it'll pretty much do this conversion for you automatically. We had a little regression between 6.6.0. and 6.6.3 that caused that to fail, but it is fixed now. I'm not sure what we'd gain by doing this.

@codecov-io
Copy link

Current coverage is 85.21%

Merging #3391 into master will decrease coverage by -0.34% as of 9acd33b

@@            master   #3391   diff @@
======================================
  Files          217     217       
  Stmts        15873   15873       
  Branches      3410    3410       
  Methods          0       0       
======================================
- Hit          13580   13526    -54
- Partial        670     723    +53
- Missed        1623    1624     +1

Review entire Coverage Diff as of 9acd33b

Powered by Codecov. Updated on successful CI builds.

@benjamn
Copy link
Contributor Author

benjamn commented Mar 2, 2016

Thanks, I'll try upgrading.

As to what would be gained, it's less code and fewer new variables… but then again shouldn't buildExportAll be a babel-runtime helper anyway?

benjamn pushed a commit to meteor/babel-preset-meteor that referenced this pull request Mar 2, 2016
@benjamn
Copy link
Contributor Author

benjamn commented Mar 2, 2016

Update: I'm finding that let still occurs in the generated code even with the block scoping transform enabled, though other transforms may be interfering somehow, since it does work when I pare the plugins down to just transform-es2015-modules-commonjs and transform-es2015-block-scoping.

I can try to get to the bottom of what's going on with my preset, but I worry you're going to have more regressions of this kind. Why not make this helper more robust?

@amasad
Copy link
Member

amasad commented Mar 2, 2016

I think we didn't do a great job on plugin composability in babel 6 so +1 for making them as robust and standalone as possible.

@hzoo hzoo added the PR: Internal 🏠 A type of pull request used for our changelog categories label Mar 2, 2016
@hzoo hzoo added this to the 6.6.x milestone Mar 2, 2016
@hzoo
Copy link
Member

hzoo commented Mar 2, 2016

I'm ok with doing this but we definetely need to figure out why it's not working when other transforms are included.

amasad added a commit that referenced this pull request Mar 3, 2016
Make buildExportAll generate pure ES5 code.
@amasad amasad merged commit 3744aef into babel:master Mar 3, 2016
benjamn pushed a commit to meteor/babel-preset-meteor that referenced this pull request Mar 8, 2016
benjamn pushed a commit to meteor/babel that referenced this pull request Mar 8, 2016
benjamn pushed a commit to meteor/meteor that referenced this pull request Mar 8, 2016
@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Oct 7, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Internal 🏠 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants