Fast, zero-dependency SemVer for ESM and TypeScript, with functional, tree-shakeable APIs.
- β 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
SemVerandSemVerRangerecords. - β‘ 23.8% smaller for full CDN imports.
- πͺΆ 60.3% smaller with common bundled imports.
- π‘οΈ Immutable collection operations.
npm add verkitimport {
coerce,
increment,
normalize,
normalizeFull,
parse,
truncate,
} from 'verkit'
const version = parse('1.2.3-rc.1+sha.abc')
const coerced = coerce('release 42.6.7.9', { rtl: true })
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'
coerced?.major // 6Version APIs accept strings or mutable SemVer objects returned by parse or
coerce.
normalizeFull keeps build metadata; normalized, incremented, and truncated
versions omit it.
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.
import {
findMaxSatisfying,
normalizeRange,
parseRange,
satisfies,
} from 'verkit'
const range = parseRange('^1.2.3')
normalizeRange(range) // '>=1.2.3 <2.0.0-0'
satisfies('1.5.0', range) // true
findMaxSatisfying(['1.2.3', '1.5.0', '2.0.0'], range) // '1.5.0'Range APIs accept strings or mutable SemVerRange objects. They support
comparators, unions, hyphens, wildcards, tilde, caret, loose parsing, and
prereleases.
Range options are fixed when a SemVerRange is created. APIs that receive a
parsed range use its stored options and do not accept another options argument:
const prereleases = parseRange('1.x', { includePrerelease: true })
satisfies('1.0.0-rc.1', prereleases) // trueTo use different options, pass the original range string again or create another parsed range.
See the API reference.
parse, parseComparator, and parseRange throw detailed TypeErrors. Their
tryParse* wrappers return null; other safe transforms and predicates keep
their documented null/false behavior.
Only renamed or reshaped node-semver APIs are listed; same-named functions
such as clean, coerce, compare, and satisfies are omitted.
| node-semver | verkit |
|---|---|
SemVer |
parse |
parse |
tryParse |
valid |
normalize |
inc, diff |
increment, difference |
major, minor, patch, prerelease |
getMajor, getMinor, getPatch, getPrerelease |
rcompare, compareLoose, cmp |
compareReversed, compare with { loose: true }, compareWithOperator |
eq, neq, gt, gte, lt, lte |
isEqual, isNotEqual, isGreater, isGreaterOrEqual, isLess, isLessOrEqual |
rsort |
sortReversed |
rcompareIdentifiers |
compareIdentifiersReversed |
Comparator |
SemVerComparator, parseComparator, tryParseComparator |
| Comparator formatting, test, and intersection | normalizeComparator, satisfiesComparator, comparatorsIntersect |
Range |
parseRange |
toComparators, validRange |
rangeToComparators, normalizeRange |
maxSatisfying, minSatisfying, minVersion |
findMaxSatisfying, findMinSatisfying, findMinimumForRange |
outside, gtr, ltr |
isOutsideRange, isGreaterThanRange, isLessThanRange |
intersects, subset |
rangesIntersect, isRangeSubset |
RELEASE_TYPES |
INCREMENT_TYPES (also includes release) |
valid returns a normalized string | null in node-semver, so its equivalent
is normalize. Use isValid when you only need a boolean.
Use options objects such as { loose: true } and { identifier, identifierBase }.
Range options belong to the string-parsing step; parsed SemVerRange objects
already contain them.
verkit follows node-semver semantics with four user-visible differences:
- Array helpers never mutate their inputs.
- Parsed
SemVerRangeobjects retain their parse-time options. node-semver helpers may reparse aRangefromrawusing call-site options. - verkit is ESM-only, with no CommonJS, CLI, or
NODE_DEBUG=semveroutput. - Error text, stack traces, and supported runtimes may differ.
Full package imports, minified with Rolldown:
| Package | Minified | gzip | Brotli |
|---|---|---|---|
| verkit | 18,754 B | 5,874 B | 5,341 B |
| semver | 24,603 B | 7,356 B | 6,703 B |
| verkit reduction | 23.8% | 20.1% | 20.3% |
Common validation, range, comparison, increment, and coercion imports, tree-shaken and minified with Rolldown:
| Package | Minified | gzip | Brotli |
|---|---|---|---|
| verkit | 9,834 B | 3,361 B | 3,086 B |
| semver | 24,754 B | 7,427 B | 6,764 B |
| verkit reduction | 60.3% | 54.7% | 54.4% |
Run pnpm test:size to reproduce the comparison.
Measured on a MacBook Pro with an Apple M1 Max and 32 GB RAM. Higher is better.
| Operation | verkit ops/s | semver ops/s | Faster |
|---|---|---|---|
| Parse and normalize | 1.89M | 1.59M | verkit 1.19Γ |
| Compare | 1.58M | 1.03M | verkit 1.53Γ |
| Compare parsed versions | 11.70M | 5.44M | verkit 2.15Γ |
| Increment | 1.79M | 1.00M | verkit 1.79Γ |
| Coerce | 1.40M | 1.06M | verkit 1.32Γ |
| Satisfy uncached ranges | 81.7K | 56.3K | verkit 1.45Γ |
| Satisfy pre-parsed inputs | 5.34M | 2.05M | verkit 2.60Γ |
Range benchmarks either cycle through 1,001 inputs to avoid cache hits or parse once and reuse the resulting objects.
Run runtime benchmarks with pnpm bench.
MIT Β© 2026-PRESENT Kevin Deng.
Parts of the implementation and test fixtures are derived from node-semver under the ISC license; see THIRD_PARTY_NOTICES.md.