-
Notifications
You must be signed in to change notification settings - Fork 29
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
feat: update babel to 7 #67
Conversation
If I understand it correctly, this makes newer versions of Node able to build Atom; I think babel 7 has fixes for use with more-recent Node versions.
|
Yes. Check my comment here: atom#21091 (comment) |
I did not notice that we have babel-spec too 😄. I guess I need to update that as well. |
Async to generator plugin is not working nicely. I am going to remove it. I also will use our atomic babel preset instead of this whole thing. That is easier to maintain. |
NPM's git installer acts weird. Why it can't install some of the packages?! |
FWIW, I believe it clones the git dependency, tries to install the dependency in a temp folder (if there is a And as far as I can tell, this causes bizarre errors unique to the CI environment. I can't reproduce the failures locally e.g. when setting apm to be a git dependency. Have to wonder why it's this complicated for git dependencies, but I supposethe publishing process usually strips oackage-lock.json and similar files... Which isn't the case in a bare git repo? But I would assume package-lock.json would be ingored... 🤷 |
Not sure if this will help, but try with npm >= 6.14.2. Their dependency https://github.com/npm/cli/blob/latest/CHANGELOG.md#6142-2020-03-03 |
This line is causing issues: I can fix this. We just need to name export it or remove that |
1062c89
to
4b1334c
Compare
Oh wow! Most of the tests have passed! 🎉 The problem was I just need to fix the rest: ##[error] The 'core-render-process for D:/a/1/s/spec/babel-spec.coffee.' test step finished with a non-zero exit code
You can run the test again using:
D:/a/1/s/out/Atom Dev x64/atom-dev.exe --resource-path D:\a\1\s --test D:/a/1/s/spec/babel-spec.coffee
##[error] The 'core-render-process for D:/a/1/s/spec/compile-cache-spec.coffee.' test step finished with a non-zero exit code
You can run the test again using: These tests should actually be updated themselves. |
So the problem is that the bundled code cannot find the babel plugins. I am not sure what is happening inside assar when electron-link bundles it. I will switch to babel-preset-atomic and will require it explicitly. Previously babel-core had all the deps Atom needed for transpiling. But know babel uses separate plugins. So using babel-preset-atomic we can get the same effect. |
Including babel dependencies in the snapshot fails. I wonder if we can declare the babel dependencies as external. |
c23b9fe
to
8ff9db9
Compare
I tried 4 different bundlers for bundling babel: https://github.com/atom-ide-community/babel-preset-atomic/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-desc All of them fail. We need to find a way to declare babel as external, but let Atom call it during normal loading. |
This comment was marked as resolved.
This comment was marked as resolved.
This basically works fine now! 🎉 |
It seems that the find-and-replace package needs some updating. |
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 ready! 🎉 I am going to merge this tomorrow.
Copied from atom#21623:
Description of the Change
This upgrades babel 5 to babel 7. It targets Electron 11, so we now run modern JavaScript! 🎉
This PR is the result of two years of effort and trying.
I had to fix electron-link so:
I developed two plugins specifically for Atom to support its special situation:
See the full list of plugins that babel-preset-atomic has in this package.json.
import/export
) are strict by default. However, this breaks some of the Atom packages because they do non-strict things in ES modules. So, I developed this plugin to remove 'use strict' when the triggers are used. I have baked a feature in this plugin that allows removing 'use strict' selectively by adding 'not strict' directive. Ultimately, we should add this 'not strict' to any file that uses JS loosely in ES modules. An example of this isspec/update-process-env-spec.js
There are two move plugins included for backward compatibility:
babel-add-module-exports: this plugin circumvents the fact that ES modules export default by "default" keyword. This means we need to call
require().default
to consume them. This plugin works in combination with transform-not-strict to addmodule.exports=
to the packages that export default things that should have been named exports. For the packages' root, I already made another PR that adds support for both cases, but we cannot patch require for the packages' internal requires as we only have access to the root.@babel/plugin-transform-reserved-words that allows the uses of the old banned keywords such as
package
ordebugger
.Fixed the loose usage of JavaScript in the following packages:
Benefits
This PR has several benefits:
"use babel"
.Previous attempts
#67
atom#20965
Release Notes