verkit 是一个快速、零依赖的 SemVer 库,专为 ESM 和 TypeScript 设计,提供函数式、可摇树优化的 API。

Stars

100

7 天增长

+13

Fork 数

1

开放 Issue

1

开源协议

MIT

最近更新

2026-07-28

AI 仓库情报摘要
FR-AI / ANALYSIS

为什么值得关注

它在所有测试操作中都比 node-semver 更快,且包体积最多减少 60%,非常适合现代 JavaScript 项目。

适合谁使用

  • ESM 和 TypeScript 开发者
  • npm 包维护者
  • 构建单体仓库工具的开发者
  • 追求性能的 JavaScript 工程师

典型使用场景

  • 在包管理器或 CLI 工具中解析、比较和递增语义化版本
  • 在依赖解析器中验证和满足版本范围
  • 在 CI/CD 脚本中从混合输入中强制转换版本字符串
  • 在 Node.js/Deno/Bun 应用中构建不可变或可变的 SemVer 操作

项目优势

  • 零运行时依赖
  • 根据基准测试,常见操作比 node-semver 快最多 2.26 倍
  • CDN 包体积减小 26%,树摇优化后减小 60%
  • 一流的 TypeScript 声明,纯 ESM 支持

使用前须知

  • 仅支持 ESM,不提供 CommonJS 或 CLI 支持,可能限制与旧版 Node.js 或 CJS 环境的兼容性
  • 需要从 node-semver 迁移,涉及多个 API 重命名和行为差异
  • 不支持 NODE_DEBUG 输出以及 node-semver 的所有错误信息

README 快速开始

verkit

[![Open on npmx][npmx-version-src]][npmx-href] [![npm downloads][npmx-downloads-src]][npmx-href] [![Unit Test][unit-test-src]][unit-test-href]

Fast, zero-dependency SemVer for ESM and TypeScript, with functional, tree-shakeable APIs.

Features

  • ✅ Complete SemVer version and range toolkit.
  • 🚀 Faster than [node-semver] across tested operations.
  • 📦 Pure ESM with zero runtime dependencies.
  • 💙 First-class TypeScript declarations.
  • 🌳 Functional, tree-shakeable named exports.
  • 🔁 Mutable SemVer and SemVerRange records.
  • ⚡ 26.0% smaller for full CDN imports.
  • 🪶 60.1% smaller with common bundled imports.
  • 🛡️ Immutable collection operations.

Install

npm add verkit

Versions

import {
  coerce,
  increment,
  normalize,
  normalizeFull,
  parse,
  truncate,
} from 'verkit'

const version = parse('1.2.3-rc.1+sha.abc')
version.patch = 4

normalizeFull(version) // '1.2.4-rc.1+sha.abc'
normalize(version) // '1.2.4-rc.1'
increment(version, 'minor') // '1.3.0'
truncate(version, 'patch') // '1.2.4'
coerce('release 42.6.7.9', { rtl: true }) // '6.7.9'

Version APIs accept strings or mutable SemVer objects returned by parse. normalizeFull keeps build metadata; normalized, incremented, and truncated versions omit it.

Comparison

import { compare, compareBuild, sortReversed } from 'verkit'

compare('1.0.0+one', '1.0.0+two') // 0
compareBuild('1.0.0+one', '1.0.0+two') // -1
sortReversed(['1.0.0', '2.0.0']) // ['2.0.0', '1.0.0']

compare ignores build metadata; compareBuild uses it as a tie-breaker.

Ranges

import {
  findMaxSatisfying,
  normalizeRange,
  parseRange,
  satisfies,
} from 'verkit'

const range = parseRange('^1.2.3')

normalizeRange(range) // '>=1.2.3 
  
    
  


## License

[MIT](./LICENSE) © 2026-PRESENT [Kevin Deng](https://github.com/sxzz).

Parts of the implementation and test fixtures are derived from [node-semver]
under the ISC license; see [THIRD_PARTY_NOTICES.md](./THIRD_PARTY_NOTICES.md).



[npmx-version-src]: https://npmx.dev/api/registry/badge/version/verkit
[npmx-downloads-src]: https://npmx.dev/api/registry/badge/downloads-month/verkit
[npmx-href]: https://npmx.dev/verkit
[node-semver]: https://github.com/npm/node-semver
[unit-test-src]: https://github.com/sxzz/verkit/actions/workflows/unit-test.yml/badge.svg
[unit-test-href]: https://github.com/sxzz/ver

项目描述

Fast, zero-dependency SemVer for ESM and TypeScript, with functional, tree-shakeable APIs.

相关仓库与替代方案

根据分类、Topic 和编程语言匹配的相似项目。

MADEVAL
精选
MADEVAL GitHub avatar

ReadSightJS

A zero-dependency Node.js library that measures text readability across 86 languages using 17 different formulas, including language-specific coefficients and TeX hyphenation for syllable counting.

AI 与机器学习大语言模型
25
TanStack
精选
TanStack GitHub avatar

router

TanStack Router is a type-safe, data-driven React router with built-in caching, prefetching, and nested layouts, while TanStack Start extends it into a full-stack SSR framework.

Web 开发前端框架
14,861
makecindy
精选
makecindy GitHub avatar

cindy

Cindy is an open-source AI agent that runs locally on your machine, integrates multiple AI harnesses and models, and provides memory, skills, and automation to perform real work in your projects and apps.

AI 与机器学习大语言模型
958