Skip to content

Build: Ensure make build will build Babel parser typings#17808

Merged
JLHwung merged 10 commits intobabel:mainfrom
JLHwung:improve-make-watch-files
Feb 23, 2026
Merged

Build: Ensure make build will build Babel parser typings#17808
JLHwung merged 10 commits intobabel:mainfrom
JLHwung:improve-make-watch-files

Conversation

@JLHwung
Copy link
Copy Markdown
Contributor

@JLHwung JLHwung commented Feb 18, 2026

Q                       A
Fixed Issues? make build does not build Babel parser typings packages/babel-parser/typings/babel-parser.d.ts.
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

Currently, the file packages/babel-parser/typings/babel-parser.d.ts can only be built by make prepublish-prepare-dts. This is very confusing as contributors are not supposed to run a prepublish task in order to properly update a source file.

The current banner of the Babel parser typing file mentions that

Run `yarn gulp bundle-dts` to re-generate it." 

This tip is not quite helpful as it should have been, as the dts files may be also outdated, which can only be updated by tsc.

In this PR we create a new makefile task for the babel-parser typings. This task will also be invoked from make build or make build-bundle. Hopefully we will be much less annoyed by the babel-parser typing update error thrown from the CI.

Aside: Now that Gulpfile.mts has been renamed to Gulpfile.ts recently, the ts-node/register was invoked by the interpret that Gulp uses to support various config file format, I have removed the ts hooks so that we can unleash the native TS support.

@JLHwung JLHwung added the PR: Internal (next major) 🏠 A type of pull request used for our changelog categories for next major release label Feb 18, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Feb 18, 2026

Open in StackBlitz

commit: 91f9460

@JLHwung JLHwung force-pushed the improve-make-watch-files branch from 7aa3549 to bfbf076 Compare February 19, 2026 01:44
@babel-bot
Copy link
Copy Markdown
Collaborator

babel-bot commented Feb 19, 2026

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

@JLHwung JLHwung force-pushed the improve-make-watch-files branch from bfbf076 to c1acae0 Compare February 20, 2026 14:50
@JLHwung JLHwung requested a review from liuxingbaoyu February 20, 2026 21:09
target["build-no-bundle"] = function () {
target["clean"]();
target["clean-lib"]();
target["bundle-babel-parser-dts"]();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Will a type error interrupt the build?
I'm a little worried that this will slow down build-no-bundle.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, if there is a typing error within Babel parser, the build will stop, because the typings.d.ts can not be built.

The tsc probably has its own cache, if cache is hit, this step will take around 1 second on my machine.

If we use GNU make, we can easily parallelize bundle-babel-parser-dts and gulp build dev, but that ship has long sailed...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Perhaps in the future we can also generate the parser's dts into lib, just like other dts.

Copy link
Copy Markdown
Member

@liuxingbaoyu liuxingbaoyu left a comment

Choose a reason for hiding this comment

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

Let's give it a try!

@JLHwung JLHwung merged commit 6c32f76 into babel:main Feb 23, 2026
55 checks passed
@JLHwung JLHwung deleted the improve-make-watch-files branch February 23, 2026 16:53
@nicolo-ribaudo nicolo-ribaudo added the PR: Internal 🏠 A type of pull request used for our changelog categories label Mar 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: Internal 🏠 A type of pull request used for our changelog categories PR: Internal (next major) 🏠 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