Skip to content

[Babel 8] Extract babel-build-external-helpers#17746

Merged
nicolo-ribaudo merged 11 commits intobabel:mainfrom
JLHwung:extract-babel-external-helpers-cli
Jan 30, 2026
Merged

[Babel 8] Extract babel-build-external-helpers#17746
nicolo-ribaudo merged 11 commits intobabel:mainfrom
JLHwung:extract-babel-external-helpers-cli

Conversation

@JLHwung
Copy link
Contributor

@JLHwung JLHwung commented Jan 28, 2026

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

In this PR we extract build-external-helpers from babel-cli.

We also add an allowlist option and deprecate the whitelist option. The new external-helpers-cli will also check the required option values for --allowlist and --output-type.

@JLHwung JLHwung added PR: Breaking Change 💥 A type of pull request used for our changelog categories for next major release pkg: cli PR: Needs Docs labels Jan 28, 2026
@@ -0,0 +1,3 @@
import { runParallel } from "../helpers/runner.js";

runParallel(parseInt(import.meta.url.split("/").pop().split(".")[0]), 2);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We chose 2 test runners as there aren't many tests in the external-helpers-cli.

@babel-bot
Copy link
Collaborator

babel-bot commented Jan 28, 2026

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

@JLHwung JLHwung force-pushed the extract-babel-external-helpers-cli branch from 28862d9 to d239104 Compare January 28, 2026 21:26
@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 28, 2026

Open in StackBlitz

commit: d5e8e3e

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.

Can we call it @babel/generate-external-helpers, so that people can run it as npx @babel/generate-external-helpers -l foo,bar, which reads nice?

program.option(
"-w, --whitelist <whitelist>",
"Deprecated: use --allowlist instead",
collect,
Copy link
Member

Choose a reason for hiding this comment

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

Let's just throw instead of only showing a deprecation message. People are migrating to a new package anyway, they can change the option name while doing it.

@JLHwung
Copy link
Contributor Author

JLHwung commented Jan 29, 2026

Can we call it @babel/generate-external-helpers, so that people can run it as npx @babel/generate-external-helpers -l foo,bar, which reads nice?

The underlying @babel/core exported API is buildExternalHelpers, maybe we can stick with the @babel/build-external-helpers name, to be consistent with the API?

@JLHwung JLHwung changed the title [Babel 8] Extract babel-external-helpers-cli [Babel 8] Extract babel-build-external-helpers Jan 29, 2026
@JLHwung JLHwung force-pushed the extract-babel-external-helpers-cli branch from 7079a6a to f90afd8 Compare January 29, 2026 18:27
@nicolo-ribaudo
Copy link
Member

Could you rebase on top of main (with #17751), to make sure that CI fails?

@nicolo-ribaudo nicolo-ribaudo added this to the v7.29.0 milestone Jan 29, 2026
@JLHwung JLHwung force-pushed the extract-babel-external-helpers-cli branch from f90afd8 to d5e8e3e Compare January 29, 2026 20:04
@nicolo-ribaudo
Copy link
Member

Perfect, it detects the new package. I'd say that in cases like this we run the command to create the package right before merging the PR.

@nicolo-ribaudo
Copy link
Member

Package created, the local script worked perfectly :)

@nicolo-ribaudo
Copy link
Member

For some reason it wasn't enough to re-run the "ensure npm packages exist" job to make it pass, I had to rerun everything.

@nicolo-ribaudo nicolo-ribaudo merged commit a58e0b2 into babel:main Jan 30, 2026
186 of 189 checks passed
@nicolo-ribaudo nicolo-ribaudo deleted the extract-babel-external-helpers-cli branch January 30, 2026 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: cli 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