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

Use Babel 6 #6828

Merged
merged 16 commits into from Mar 13, 2017
Merged

Use Babel 6 #6828

merged 16 commits into from Mar 13, 2017

Conversation

rwjblue
Copy link
Member

@rwjblue rwjblue commented Mar 6, 2017

This is the starting point for using babel@6 in ember-cli itself and apps. This mostly includes various fallback paths that we have provided that ensure "things are transpiled", without much guarantee about actual transpilation content.

It also paves the way for allowing the usage of ember-cli-babel@6 by providing this.options.babel as needed based on ember-cli-babel version in use.

Utilizes the new project.targets to provide custom transpilation configuration based on project targets.


Fixes #5015.

package.json Outdated
"bower-config": "^1.3.0",
"bower-endpoint-parser": "0.2.2",
"broccoli-babel-transpiler": "^5.6.2",
"broccoli-babel-transpiler": "6.0.0-alpha.3",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the primary "merge blocker". Need to release as something > .alpha to land (IMO).

module.exports = {
browsers: [
'ie 9',
'last 1 Chrome versions',
Copy link
Contributor

@cibernox cibernox Mar 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is totally outside the scope but here we go:
This matrix is the actual matrix of browsers in which ember itself is tested. I believe that probably safari 9 should be added to ember's test matrix. Arguably today iOS9 is far more relevant than ie9 & 10 combined.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No argument there. In this PR I'm just taking advantage of the new targets, so I refactored to a separate util to avoid duplication.

@@ -0,0 +1,17 @@
'use strict';
const presetEnv = require('babel-preset-env').default;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the babel-preset-env live here or can it be part ember-cli-babel?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea is that ember-cli-babel is "just" transpiling with the provided config options. I am not really opposed to flip flopping if folks feel strongly...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was good advice, moved this logic to ember-cli-babel (in emberjs/ember-cli-babel@78b0342).

@homu
Copy link
Contributor

homu commented Mar 8, 2017

☔ The latest upstream changes (presumably 6eccb8f) made this pull request unmergeable. Please resolve the merge conflicts.

@homu
Copy link
Contributor

homu commented Mar 10, 2017

☔ The latest upstream changes (presumably #6835) made this pull request unmergeable. Please resolve the merge conflicts.

plugins: [
// this sucks, but :goodnews: once a new version of babel@6 is released
// we can remove this in favor of `babel-plugin-transform-es2015-modules-amd`
[require('rwjblue-custom-babel-6-amd-modules-no-interop'), { loose: true, noIterop: true }],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clearly not ideal, but seems ok so that we aren't blocked hard on a release...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @hzoo

@rwjblue rwjblue changed the title [WIP] Use Babel 6 internally. Use Babel 6 Mar 12, 2017
@rwjblue
Copy link
Member Author

rwjblue commented Mar 12, 2017

Things that are done:

  • update the app blueprint to use ember-cli-babel@6 (alpha for now)
  • change all fallback paths to only process modules (this was the only guarantee anyways)
  • ensure the default babel options are populated based on ember-cli-babel version
  • ensure ember-cli-babel@6 can be used with ember-cli@2.11.1 and ember-cli@2.12 (likely older though I haven't tested yet)
  • ensure ember-cli-htmlbars-inline-precompiler@0.4.0-beta.1 (babel@6 version) is working properly in conjunction with ember-cli@2.11 and ember-cli@2.12
  • published custom build of babel@6 (from babel's master branch) that includes the changes needed to emit modules that can interop between babel@5 and babel@6

This is ready to start reviewing (code wise), I'm still working through a couple test failures ATM though...

* Updates ember-cli itself to use babel@6.
* Removes usages of `options.babel` for internal babel version.
* Removes `_pruneBabelOptions` method.
* Use private internal babel options for methods using ember-cli
  shipped babel transpiler.
* Provide babel options based upon ember-cli-babel version (for
  babel@5 give babel@5 style options, for babel@6 give babel@6
  style options).

Provide `this.options.babel` based on
* Remove usage of `babel-preset-env`.
* Change all "fallback" processing to handle **only** modules.
When using ember-cli-babel@5 use babel@5 options, when using
ember-cli-babel@6 no defaults are needed.
Fixes an issue with using babel@6 options when transpiling with
babel@5.
plugins: [
// this sucks, but :goodnews: once a new version of babel@6 is released
// we can remove this in favor of `babel-plugin-transform-es2015-modules-amd`
[require('rwjblue-custom-babel-6-amd-modules-no-interop'), { loose: true, noIterop: true }],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @hzoo

@rwjblue rwjblue mentioned this pull request Mar 12, 2017
17 tasks
The RFC has landed, and ember-cli-babel has been updated to take
advantage of it. Having real use cases was the blocker to enabling
the feature flag and removing it.
babel@6.24 includes the required interop changes.
@rwjblue
Copy link
Member Author

rwjblue commented Mar 13, 2017

@homu r+

@homu
Copy link
Contributor

homu commented Mar 13, 2017

📌 Commit e2a6db2 has been approved by rwjblue

@homu
Copy link
Contributor

homu commented Mar 13, 2017

⚡ Test exempted - status

@homu homu merged commit e2a6db2 into master Mar 13, 2017
homu added a commit that referenced this pull request Mar 13, 2017
Use Babel 6

This is the starting point for using babel@6 in ember-cli itself and apps. This mostly includes various fallback paths that we have provided that ensure "things are transpiled", without much guarantee about actual transpilation content.

It also paves the way for allowing the usage of ember-cli-babel@6 by providing `this.options.babel` as needed based on ember-cli-babel version in use.

Utilizes the new `project.targets` to provide custom transpilation configuration based on project targets.

---

- [ ] Release final stable version of ember-cli-babel@6 (emberjs/ember-cli-babel#115)
- [ ] Release final stable version of ember-cli-htmlbars-inline-precompile for babel@6 support

Fixes #5015.
@rwjblue rwjblue deleted the babel-6-internally branch March 13, 2017 15:39
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

4 participants