Skip to content

refactor: replace semver with verkit#18145

Open
sxzz wants to merge 2 commits into
babel:mainfrom
sxzz:codex/replace-semver-with-verkit
Open

refactor: replace semver with verkit#18145
sxzz wants to merge 2 commits into
babel:mainfrom
sxzz:codex/replace-semver-with-verkit

Conversation

@sxzz

@sxzz sxzz commented Jul 19, 2026

Copy link
Copy Markdown
Contributor
Q A
Fixed Issues? N/A
Patch: Bug Fix? No
Major: Breaking Change? No
Minor: New Feature? No
Tests Added + Pass? Existing tests pass
Documentation PR Link N/A
Any Dependency Changes? Replaces semver with verkit
License MIT

Summary

This PR replaces Babel's direct usage of semver with verkit.

verkit provides:

  • pure ESM with zero runtime dependencies;
  • first-class TypeScript declarations;
  • functional, tree-shakeable named exports;
  • smaller bundles and faster operations in its upstream benchmarks.

The migration also removes @types/semver and Babel's ESLint workaround for semver's CommonJS exports. Existing version, range, coercion, and prerelease behavior is preserved.

Motivation

node-semver does not appear to have an active ESM migration plan. The related request in semver/semver#1123 was closed as not planned. A direct dual-format ESM proposal in npm/node-semver#844 was also closed; maintainers noted that ESM is on their radar but is not currently being worked on. npm/node-semver#712

That said, verkit is still young and currently at v0.2.0. There is no urgency to adopt it—the Babel community may prefer to observe its stability and adoption before merging this change.

Validation

  • yarn lint
  • 17 focused test suites and 878 tests passed
  • Development build
  • @babel/standalone build

@sxzz sxzz changed the title Replace semver with verkit refactor: replace semver with verkit Jul 19, 2026
@sxzz sxzz changed the title refactor: replace semver with verkit refactor: replace semver with verkit Jul 19, 2026
@babel-bot

babel-bot commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator

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

@pkg-pr-new

pkg-pr-new Bot commented Jul 19, 2026

Copy link
Copy Markdown

Open in StackBlitz

commit: ea793ac

@nicolo-ribaudo

nicolo-ribaudo commented Jul 20, 2026

Copy link
Copy Markdown
Member

Thanks -- for what is worth at some point I was even considering vendoring Deno's @jsr/semver since that supports ESM. I need to look into verkit more, but this seems promising.

Who does currently use it?

@liuxingbaoyu

Copy link
Copy Markdown
Member

I am slightly in favor of this.
Because semver is split into many small files, loading it on my local machine takes 25ms–45ms.

sxzz commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

Since verkit was only released recently, it does not have many users yet. Nuxt and npmx have already migrated to it. I have also opened several migration PRs, although they have not been merged yet; they are tracked in e18e/ecosystem-issues#277.

@sxzz
sxzz marked this pull request as ready for review July 21, 2026 16:37
@sxzz
sxzz force-pushed the codex/replace-semver-with-verkit branch from fefb6c2 to 059d7a9 Compare July 21, 2026 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants