Skip to content

refactor: replace semver with verkit#180

Merged
antfu merged 1 commit into
antfu:mainfrom
sxzz:agent/replace-semver-with-verkit
Jul 21, 2026
Merged

refactor: replace semver with verkit#180
antfu merged 1 commit into
antfu:mainfrom
sxzz:agent/replace-semver-with-verkit

Conversation

@sxzz

@sxzz sxzz commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • replace direct semver and @types/semver usage with verkit across the inspector and tools packages
  • migrate comparison, range, prerelease, and validation calls to verkit's functional named exports
  • keep verkit external in published Node.js output by declaring it as a runtime dependency, and update the pnpm catalog and lockfile
  • add focused coverage for prerelease versions, invalid input, range parsing, and version comparisons

Motivation

verkit is a pure ESM, zero-dependency SemVer implementation with first-class TypeScript declarations and functional, tree-shakeable named exports. This fits the repository's ESM and TypeScript architecture, avoids CommonJS interop for direct version operations, and removes the need for @types/semver.

Compatibility

  • preserves stable and prerelease comparison behavior, invalid-input handling, range unions, and latest-major filtering
  • preserves the repository's Node.js support: verkit supports Node.js 18.12 and later, while this repository requires Node.js 22.19 or later
  • keeps verkit as an external runtime dependency rather than inlining it into the published CLI and tools library
  • verifies the built packages on Node.js 22.19 and Node.js 24

Validation

  • CI=true pnpm install --lockfile-only --offline --frozen-lockfile
  • pnpm lint
  • pnpm typecheck
  • pnpm build
  • pnpm vitest run packages/node-modules-inspector/src/app/utils/semver.test.ts packages/node-modules-inspector/src/shared/semver.test.ts packages/node-modules-inspector/src/shared/reports/maintainers.test.ts packages/node-modules-tools/src/utils/filter.test.ts
  • pnpm exec publint packages/node-modules-inspector
  • pnpm exec publint packages/node-modules-tools
  • built-artifact smoke tests on Node.js 22.19 and Node.js 24
  • git diff --check

Known test failure

  • pnpm test --run passes 86 of 87 tests; test/module-type.test.ts expects h3 to be dual-format, but the hoisted h3@2 resolved by the test is ESM-only. The focused migration tests all pass.

Related

@pkg-pr-new

pkg-pr-new Bot commented Jul 20, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/node-modules-inspector@180
npm i https://pkg.pr.new/node-modules-tools@180

commit: 8cd0869

@sxzz
sxzz marked this pull request as ready for review July 20, 2026 05:52
@antfu
antfu merged commit c532485 into antfu:main Jul 21, 2026
10 checks passed
@sxzz
sxzz deleted the agent/replace-semver-with-verkit branch July 21, 2026 05:00
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.

2 participants