Skip to content

Backport some PRs to 7.x#17948

Merged
nicolo-ribaudo merged 8 commits into
babel:7.xfrom
nicolo-ribaudo:7.x-backports
Apr 30, 2026
Merged

Backport some PRs to 7.x#17948
nicolo-ribaudo merged 8 commits into
babel:7.xfrom
nicolo-ribaudo:7.x-backports

Conversation

@nicolo-ribaudo
Copy link
Copy Markdown
Member

@nicolo-ribaudo nicolo-ribaudo commented Apr 24, 2026

Q                       A
Fixed Issues? Fixes #1, Fixes #2
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

Update compat data (#17686)

Load async Wasm and JSON imports in parallel (#17818)

Added back the export mentioned in #17818 (comment)

Improve trailing comma comment handling (#17782)

I cherry-picked myself, but then asked Claude to analyze the differences in the `output.json` files introduced by that PR

Only two of the five new fixture output.json files differ from the original Babel 8 commit, and both are expected Babel 7 AST differences — not bugs.

1. typescript/TSEnumBody-trailing-comma/output.json ✅ correct

  • Original (Babel 8): TSEnumDeclaration.body = TSEnumBody { members: [...] }
  • Cherry-pick (Babel 7): TSEnumDeclaration.members = [...] (flat, no TSEnumBody wrapper)

Babel 7 has no TSEnumBody node — members live directly on TSEnumDeclaration. The trailing comments still land on the correct TSEnumMember, which is the point of the fix. This works because your conflict resolution in comments.ts:209-215 added a case "TSEnumDeclaration" arm that routes to node.members! when !BABEL_8_BREAKING, where the upstream commit removed that arm entirely.

2. typescript/TSTypeParameterDeclaration-trailing-comma/output.json ✅ correct

  • Original (Babel 8): TSTypeParameter.name = { type: "Identifier", name: "T", ... }
  • Cherry-pick (Babel 7): TSTypeParameter.name = "T" (string)

In Babel 7, TSTypeParameter.name is a plain string, not an Identifier node. The trailingComments and the extra.trailingComma: 20 are attached to TSTypeParameter exactly as in the original — so the fix behavior is preserved.

3. TSInterfaceBody-trailing-comma, new-expression-no-argument, new-expression-trailing-comma ✅ byte-identical

No AST shape differences between Babel 7 and Babel 8 for these nodes.

Code changes

  • schema.json and comments.ts additions match the original commit exactly (NewExpression, TSTypeParameterDeclaration, TSInterfaceBody arms + PartialApplicationPluginOptions). The only extra piece is the TSEnumDeclaration compat arm required for Babel 7, which is correct.
  • All 16,761 parser tests pass.

Add bugfix plugin for Safari array rest destructuring bug (#17788)

Moved the new preset-env tests from bugfixes-babel-8 to bugfixes-babel-7, and manually enabled the bugfixes option.

Replace npmjs.com links with npmx.dev (#17847)

Prefer t.buildUndefinedNode (#17884) (Removed due to incompatibility with @babel/core < 7.23)

Fix thread synchronization issues in @babel/register (#17915)

fix(decorators): replace super within all removed static elements (#17931)

Added minNodeVersion to 3 tests that fail on Node.js 16 for unknown reasons (#17948 (comment))


For these PRs it would make sense to backport them but they have too many conflicts for it to be worth it (mostly, parser PRs):

  • Disallow super call after new (#17871)
  • parser: flow parser small fixes (#17865)
  • TS parser small fixes (#17888)
  • polish(parser): improve ImportExpression error recovery (#17902)
  • Uninstall sms in register revert (#17941)

@babel-bot
Copy link
Copy Markdown
Collaborator

babel-bot commented Apr 24, 2026

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

@nicolo-ribaudo nicolo-ribaudo force-pushed the 7.x-backports branch 2 times, most recently from 110681c to 96ce0d5 Compare April 24, 2026 13:33
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 24, 2026

Open in StackBlitz

commit: 9a35e6c

@JLHwung
Copy link
Copy Markdown
Contributor

JLHwung commented Apr 24, 2026

It seems that the Node.js 16 CI error is an engine bug as it appears in the classes suite rather than the classes-to-es2015 suite, and the Node.js 18 and above all passes it. I think it is acceptable to the add minNodeVersion: "18.0.0" to that test in the Babel 7 branch.

@nicolo-ribaudo nicolo-ribaudo force-pushed the 7.x-backports branch 2 times, most recently from d55dfbf to f9bfbd5 Compare April 24, 2026 16:04
nicolo-ribaudo added a commit to nicolo-ribaudo/babel that referenced this pull request Apr 24, 2026
@JLHwung
Copy link
Copy Markdown
Contributor

JLHwung commented Apr 29, 2026

I interactively rebased this PR, previously the lint job was failing because there are dirty changes in the compat-data, the root cause is that this change https://github.com/babel/babel/blame/2255b1f6fd2cd95812ebbc0f6d1bf73db8ed89f8/packages/babel-compat-data/scripts/data/plugin-features.mjs#L120 was previously not included in the #17788 backport commit.

I also removed the last debug commit nicolo-ribaudo@3f26f5c which changes the lint job chunk size as the CI failure is not related.

@JLHwung JLHwung marked this pull request as ready for review April 29, 2026 21:42
@JLHwung JLHwung requested a review from liuxingbaoyu April 29, 2026 21:43
@JLHwung
Copy link
Copy Markdown
Contributor

JLHwung commented Apr 29, 2026

The previous Babel 7 Test262 artifact have been expired, we may increase the expiry period for Babel 7 as well. Given that the Babel 8's test262 test is passing, I think it is okay to ship the backports to Babel 7.

@liuxingbaoyu
Copy link
Copy Markdown
Member

Will t.buildUndefinedNode cause incompatibility with older versions of @babel/core?

@JLHwung
Copy link
Copy Markdown
Contributor

JLHwung commented Apr 30, 2026

Will t.buildUndefinedNode cause incompatibility with older versions of @babel/core?

Good catch, yes I don't think #17884 should be backported. I am surprised that the Babel old version e2e test is passing.

I have now removed the #17884 backport.

@nicolo-ribaudo
Copy link
Copy Markdown
Member Author

Merging :)

@nicolo-ribaudo nicolo-ribaudo merged commit 9bc522a into babel:7.x Apr 30, 2026
72 of 74 checks passed
@nicolo-ribaudo nicolo-ribaudo deleted the 7.x-backports branch April 30, 2026 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants