Skip to content

Conversation

@JLHwung
Copy link
Contributor

@JLHwung JLHwung commented Oct 24, 2022

Q                       A
Fixed Issues? Clean up Babel 8 todo comments
Patch: Bug Fix?
Major: Breaking Change? Yes
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link babel/website#2765
Any Dependency Changes?
License MIT

This PR should be reviewed by commits. It cleanups some Babel 8 todo comments. This PR also unifies current slightly different Babel 8 todo comments to TODO(Babel 8).

@babel-bot
Copy link
Collaborator

babel-bot commented Oct 24, 2022

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/54241/

@JLHwung JLHwung force-pushed the babel-8-misc-changes branch from 16fd76f to eb7eed7 Compare November 11, 2022 16:41
Comment on lines -261 to +259
node-version: "14.17" # Node.js 14.17 is the first LTS supported by Babel 8
node-version: latest
check-latest: true
Copy link
Member

@liuxingbaoyu liuxingbaoyu Nov 11, 2022

Choose a reason for hiding this comment

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

I'm worried this will cause some issues to go undetected.

Not related to this PR: Do we have a minimum node version requirement for the repository (build and development)

Copy link
Contributor Author

@JLHwung JLHwung Nov 11, 2022

Choose a reason for hiding this comment

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

Do we have a minimum node version requirement for the repository (build and development)

Currently no. Personally I build / develop on latest Node and upgrade my environment every week. I believe using latest node is important:

  • If any node update breaks our build pipeline, we can always fallback to an older version temporarily. (IIRC in the past this scenario only happened in major upgrade)
  • Pinning node version will deprive us the benefit of latest build tools, e.g. Jest / Yarn will drop unmaintained node versions

Copy link
Member

Choose a reason for hiding this comment

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

Makes sense. I also currently always keep the latest major version.

module.exports = require("./data/native-modules.json");
module.exports = process.env.BABEL_8_BREAKING
? require("./data/native-modules-next.json")
: require("./data/native-modules.json");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The flag here will ship to end users because we didn't run Babel on these CJS proxies.

Copy link
Member

Choose a reason for hiding this comment

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

Can we do this using rollup?

- name: Extract artifacts
run: tar -xf babel-artifact.tar; rm babel-artifact.tar
- name: Generate runtime helpers
run: make build-plugin-transform-runtime-dist
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change should have been included in #15165.

@JLHwung JLHwung mentioned this pull request Nov 11, 2022
@JLHwung JLHwung force-pushed the babel-8-misc-changes branch from e0896ba to 2f6ca5d Compare November 12, 2022 17:22
@liuxingbaoyu
Copy link
Member

babel/babel.config.js

Lines 125 to 128 in 5f19f62

case "test":
targets = { node: "current" };
needsPolyfillsForOldNode = true;
break;

I seem to have had this problem. Because it will use the current node version of the build.

@JLHwung JLHwung force-pushed the babel-8-misc-changes branch from 657c59e to e29b216 Compare November 13, 2022 16:27
make -j build-standalone-ci
env:
BABEL_ENV: test
BABEL_ENV: test-legacy
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The test-legacy was introduced when we upgraded to Jest 25 which dropped Node.js 6. So we build on latest Node but targeted to a legacy Node version. However, in the Babel 8 situation, Node.js 14 is not a legacy version but a minimum supported one.

Maybe we can merge test-legacy with test, and then we differentiate node target by the CI environment variable. So that if a contributor runs yarn jest, he/she is testing against a build targeted to latest Node, which almost involves no transforms. If CI runs yarn jest, it is testing against the production build.

@JLHwung JLHwung marked this pull request as ready for review November 14, 2022 16:51
@JLHwung
Copy link
Contributor Author

JLHwung commented Mar 6, 2023

@nicolo-ribaudo Thanks for rebasing!

Copy link
Member

@nicolo-ribaudo nicolo-ribaudo left a comment

Choose a reason for hiding this comment

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

These two comments are about the same topic, and if you want I can work on them (since I have a fresh copy of this branch, just rebased)

newData = defineLegacyPluginAliases(newData);
if (!process.env.BABEL_8_BREAKING) {
newData = defineLegacyPluginAliases(newData);
}
Copy link
Member

Choose a reason for hiding this comment

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

I dislike how this causes us to ship both Babel 7 and Babel 8 data to our users, as well as we then need to keep the flag in the CJS proxies (like packages/babel-compat-data/plugin-bugfixes.js)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree. I think it is fine to keep -next.json in the git repo but we can skip them during publish. As for Babel 8 resolving, maybe we can add yarn condition on the exports of @babel/compa-data and redirect ./plugins.json to ./plugins-next.json.

const currentData = fs.readFileSync(dataPath, "utf8");

// Compare as JSON strings to also check keys ordering
if (currentData !== stringified) {
Copy link
Member

Choose a reason for hiding this comment

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

Since the Babel 7 data is a superset of the Babel 8 data (thus the Babel 8 build would also work with the Babel 7 data), can we instead only generate the Babel 8 file when process.env.BABEL_8_BREAKING && process.env.IS_PUBLISH, and skip this check in that case?

@@ -0,0 +1 @@
EXECUTOR TIMEOUT
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This file should be removed.

(For some reasons this test keeps failing on my local environment and I must accidentally checkout them out)

Copy link
Member

Choose a reason for hiding this comment

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

It also keeps failing on my local environment, it's possible I checked it out while rebasing. I spent one hours trying to understand what was wrong with my local env, I'm "happy" that it's not just me 😅

@JLHwung
Copy link
Contributor Author

JLHwung commented Mar 6, 2023

@nicolo-ribaudo Thank you! Yeah you can work on this branch and feel free to overhaul anything.

@nicolo-ribaudo
Copy link
Member

nicolo-ribaudo commented Mar 7, 2023

#15473 is necessary to fix the preset-env stdout difference between Babel 7 and Babel 8 (I rebased this PR on top of that one).

@nicolo-ribaudo nicolo-ribaudo merged commit 0a1cfc0 into babel:main Apr 5, 2023
@nicolo-ribaudo nicolo-ribaudo deleted the babel-8-misc-changes branch April 5, 2023 11:47
JLHwung added a commit to JLHwung/babel-website that referenced this pull request Apr 14, 2023
JLHwung added a commit to JLHwung/babel-website that referenced this pull request May 5, 2023
JLHwung added a commit to JLHwung/babel-website that referenced this pull request May 10, 2023
JLHwung added a commit to JLHwung/babel-website that referenced this pull request May 10, 2023
JLHwung added a commit to JLHwung/babel-website that referenced this pull request May 30, 2023
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Jul 6, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 6, 2023
@JLHwung JLHwung added PR: Breaking Change 💥 A type of pull request used for our changelog categories for next major release and removed babel 8 labels Aug 9, 2023
@JLHwung JLHwung added this to the v8.0.0 milestone Aug 9, 2023
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: Breaking Change 💥 A type of pull request used for our changelog categories for next major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants