Skip to content

Added non-deprecated registerHooks entrypoints - #1072

Merged
LongYinan (Brooooooklyn) merged 1 commit into
swc-project:masterfrom
PatrickShaw:patrickshaw/registerHooks
Aug 14, 2026
Merged

Added non-deprecated registerHooks entrypoints#1072
LongYinan (Brooooooklyn) merged 1 commit into
swc-project:masterfrom
PatrickShaw:patrickshaw/registerHooks

Conversation

@PatrickShaw

Copy link
Copy Markdown
Contributor

This directly addreses #1071

/esm-register uses register which is deprecated. See: https://nodejs.org/api/module.html#moduleregisterspecifier-parenturl-options

This PR adds /esm-register-next which adds registerHooks.

You'll see that I also added /esm-next. This is because the existing /esm entrypoint is async and registerHooks is explicitly a synchronous API.

I've added it as an explicit separate entrypoint just in case it has knock-on effects that I'm not aware of.

@CLAassistant

CLAassistant commented Aug 14, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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.

Heads up: The majority of this code is just taken from esm.mts.

@PatrickShaw

Copy link
Copy Markdown
Contributor Author

I've considered just doing a straight copy+paste of esm.mts and then replacing the async APIs with sync ones.
Happy to do so if people prefer that to avoid any chance of breaking the existing /esm-register and /esm entrypoints.

Just let me know if this is desired :)

@Brooooooklyn
LongYinan (Brooooooklyn) merged commit 32a8b73 into swc-project:master Aug 14, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants