{"_id":"verkit@0.5.0","bugs":{"url":"https://github.com/sxzz/verkit/issues"},"dist":{"shasum":"8b7617dda9ad2edb7851c6a4ff5f3ca428482401","tarball":"http://registry-npm.ywwl.com/verkit/download/verkit-0.5.0.tgz","integrity":"sha512-u4J1hr6Y+C/hit34GwL3eIcUf3wngT8TlYUjK7tk0jxydKLAq3sYvifjdTDA6U3KCKRcQCQDGf/srjxfZF3l7g==","fileCount":21,"unpackedSize":78664,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/verkit@0.5.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDBz4j+D5bczQszbF94D251PyCCrbiZ/F0rJwcDWIL7awIgcCxyO41f4GKSi5pBUofzIgebz9lTXNAgVILGU19tGWw="}],"size":18157,"noattachment":false,"key":"/verkit/-/verkit-0.5.0.tgz"},"name":"verkit","type":"module","author":"Kevin Deng <sxzz@sxzz.moe>","engines":{"node":">=18.12.0"},"exports":{".":"./dist/index.js","./range":"./dist/range.js","./version":"./dist/version.js","./comparator":"./dist/comparator.js","./package.json":"./package.json"},"funding":"https://github.com/sponsors/sxzz","license":"MIT","scripts":{"dev":"tsdown --watch","lint":"eslint --cache .","test":"vitest","bench":"vitest bench --run --experimental.viteModuleRunner=false","build":"tsdown","format":"prettier --cache --write .","release":"bumpp","lint:fix":"pnpm run lint --fix","test:size":"vitest run tests/bundle-size.test.ts","typecheck":"tsc --noEmit"},"version":"0.5.0","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:f3d9f7c3-71d0-4884-b7aa-ae5ace0e0283"},"approver":{"name":"sxzz","email":"npm@sxzz.moe"}},"homepage":"https://github.com/sxzz/verkit#readme","keywords":["semver","semantic-versioning","version","range","esm","typescript","functional","immutable"],"prettier":"@sxzz/prettier-config","devEngines":{"packageManager":{"name":"pnpm","onFail":"download","version":"12.4.2"}},"repository":{"url":"git+https://github.com/sxzz/verkit.git","type":"git"},"description":"Fast, zero-dependency SemVer for ESM and TypeScript, with functional, tree-shakeable APIs.","directories":{},"maintainers":[{"name":"sxzz","email":"npm@sxzz.moe"}],"sideEffects":false,"publishConfig":{"access":"public"},"devDependencies":{"bumpp":"^12.3.0","eslint":"^10.10.0","semver":"^7.8.5","tsdown":"^0.23.0","vitest":"5.0.1","prettier":"^3.9.8","rolldown":"^1.2.9","typescript":"~6.0.3","@types/node":"^26.6.1","@types/semver":"^7.8.0","tsdown-preset-sxzz":"^0.7.1","@sxzz/eslint-config":"^8.6.0","@vitest/coverage-v8":"^5.0.1","@sxzz/prettier-config":"^2.3.3","@typescript/native-preview":"npm:typescript@7.0.2"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/verkit_0.5.0_1789753949833_0.7244187064182308"},"_hasShrinkwrap":false,"readme":"# verkit\n\n[![Open on npmx][npmx-version-src]][npmx-href]\n[![npm downloads][npmx-downloads-src]][npmx-href]\n[![Unit Test][unit-test-src]][unit-test-href]\n[![Codecov][codecov-src]][codecov-href]\n\nFast, zero-dependency SemVer for ESM and TypeScript, with functional,\ntree-shakeable APIs.\n\n## Features\n\n- ✅ Complete SemVer version and range toolkit.\n- 🚀 Faster than [node-semver] across tested operations.\n- 📦 Pure ESM with zero runtime dependencies.\n- 💙 First-class TypeScript declarations.\n- 🌳 Functional, tree-shakeable named exports.\n- 🔁 Mutable `SemVer` and `SemVerRange` records.\n- ⚡ 26.0% smaller for full CDN imports.\n- 🪶 61.4% smaller with common bundled imports.\n- 🛡️ Immutable collection operations.\n\n## Install\n\n```bash\nnpm add verkit\n```\n\n## Versions\n\n```ts\nimport {\n  coerce,\n  increment,\n  normalize,\n  normalizeFull,\n  parse,\n  truncate,\n} from 'verkit'\n\nconst version = parse('1.2.3-rc.1+sha.abc')\nconst coerced = coerce('release 42.6.7.9', { rtl: true })\nversion.patch = 4\n\nnormalizeFull(version) // '1.2.4-rc.1+sha.abc'\nnormalize(version) // '1.2.4-rc.1'\nincrement(version, 'minor') // '1.3.0'\ntruncate(version, 'patch') // '1.2.4'\ncoerced?.major // 6\n```\n\nVersion APIs accept strings or mutable `SemVer` objects returned by `parse` or\n`coerce`.\n`normalizeFull` keeps build metadata; normalized, incremented, and truncated\nversions omit it.\n\n## Comparison\n\n```ts\nimport { compare, compareBuild, isGreaterThan, sortReversed } from 'verkit'\n\ncompare('1.0.0+one', '1.0.0+two') // 0\ncompareBuild('1.0.0+one', '1.0.0+two') // -1\nisGreaterThan('2.0.0', '1.0.0') // true\nsortReversed(['1.0.0', '2.0.0']) // ['2.0.0', '1.0.0']\n```\n\n`compare` ignores build metadata; `compareBuild` uses it as a tie-breaker.\n\n## Ranges\n\n```ts\nimport {\n  findMaxSatisfying,\n  normalizeRange,\n  parseRange,\n  satisfies,\n} from 'verkit'\n\nconst range = parseRange('^1.2.3')\n\nnormalizeRange(range) // '>=1.2.3 <2.0.0-0'\nsatisfies('1.5.0', range) // true\nfindMaxSatisfying(['1.2.3', '1.5.0', '2.0.0'], range) // '1.5.0'\n```\n\nRange APIs accept strings or mutable `SemVerRange` objects. They support\ncomparators, unions, hyphens, wildcards, tilde, caret, loose parsing, and\nprereleases.\n\nRange options are fixed when a `SemVerRange` is created. APIs that receive a\nparsed range use its stored options and do not accept another options argument:\n\n```ts\nconst prereleases = parseRange('1.x', { includePrerelease: true })\n\nsatisfies('1.0.0-rc.1', prereleases) // true\n```\n\nTo use different options, pass the original range string again or create\nanother parsed range.\n\n## API\n\nSee the [API reference](https://npmx.dev/package-docs/verkit).\n\n## Invalid input behavior\n\n`parse`, `parseComparator`, and `parseRange` throw detailed `TypeError`s. Their\n`tryParse*` wrappers return `null`; other safe transforms and predicates keep\ntheir documented `null`/`false` behavior.\n\n## Migrating from node-semver\n\nOnly renamed or reshaped [node-semver] APIs are listed; same-named functions\nsuch as `clean`, `coerce`, `compare`, and `satisfies` are omitted.\n\n| node-semver                                    | verkit                                                                                              |\n| ---------------------------------------------- | --------------------------------------------------------------------------------------------------- |\n| `SemVer`                                       | `parse`                                                                                             |\n| `parse`                                        | `tryParse`                                                                                          |\n| `valid`                                        | `normalize`                                                                                         |\n| `inc`, `diff`                                  | `increment`, `difference`                                                                           |\n| `major`, `minor`, `patch`, `prerelease`        | `getMajor`, `getMinor`, `getPatch`, `getPrerelease`                                                 |\n| `rcompare`, `compareLoose`, `cmp`              | `compareReversed`, `compare` with `{ loose: true }`, `compareWithOperator`                          |\n| `eq`, `neq`, `gt`, `gte`, `lt`, `lte`          | `isEqual`, `isNotEqual`, `isGreaterThan`, `isGreaterThanOrEqual`, `isLessThan`, `isLessThanOrEqual` |\n| `rsort`                                        | `sortReversed`                                                                                      |\n| `rcompareIdentifiers`                          | `compareIdentifiersReversed`                                                                        |\n| `Comparator`                                   | `SemVerComparator`, `parseComparator`, `tryParseComparator`                                         |\n| Comparator formatting, test, and intersection  | `normalizeComparator`, `satisfiesComparator`, `comparatorsIntersect`                                |\n| `Range`                                        | `parseRange`                                                                                        |\n| `toComparators`, `validRange`                  | `rangeToComparators`, `normalizeRange`                                                              |\n| `maxSatisfying`, `minSatisfying`, `minVersion` | `findMaxSatisfying`, `findMinSatisfying`, `findMinimumForRange`                                     |\n| `outside`, `gtr`, `ltr`                        | `isOutsideRange`, `isGreaterThanRange`, `isLessThanRange`                                           |\n| `intersects`, `subset`                         | `rangesIntersect`, `isRangeSubset`                                                                  |\n| `RELEASE_TYPES`                                | `INCREMENT_TYPES` (also includes `release`)                                                         |\n\n`valid` returns a normalized `string | null` in node-semver, so its equivalent\nis `normalize`. Use `isValid` when you only need a boolean.\n\nUse options objects such as `{ loose: true }` and `{ identifier, identifierBase }`.\nRange options belong to the string-parsing step; parsed `SemVerRange` objects\nalready contain them.\n\n## Differences from node-semver\n\nverkit follows [node-semver] semantics with four user-visible differences:\n\n- Array helpers never mutate their inputs.\n- Parsed `SemVerRange` objects retain their parse-time options. node-semver\n  helpers may reparse a `Range` from `raw` using call-site options.\n- verkit is ESM-only, with no CommonJS, CLI, or `NODE_DEBUG=semver` output.\n- Error text, stack traces, and supported runtimes may differ.\n\n## Bundle size\n\nFull package imports, minified with Rolldown:\n\n| Package               | Minified |    gzip |  Brotli |\n| --------------------- | -------: | ------: | ------: |\n| verkit                | 18,820 B | 5,914 B | 5,375 B |\n| [semver][node-semver] | 24,424 B | 7,427 B | 6,765 B |\n| verkit reduction      |    26.0% |   20.4% |   20.5% |\n\nCommon validation, range, comparison, increment, and coercion imports,\ntree-shaken and minified with Rolldown:\n\n| Package               | Minified |    gzip |  Brotli |\n| --------------------- | -------: | ------: | ------: |\n| verkit                |  9,872 B | 3,401 B | 3,121 B |\n| [semver][node-semver] | 25,577 B | 7,500 B | 6,835 B |\n| verkit reduction      |    61.4% |   54.7% |   54.3% |\n\nRun `pnpm test:size` to reproduce the comparison.\n\n## Benchmarks\n\nMeasured on a MacBook Pro with an Apple M1 Max and 32 GB RAM. Higher is\nbetter.\n\n| Operation                 | verkit ops/s | semver ops/s | Faster       |\n| ------------------------- | -----------: | -----------: | ------------ |\n| Parse and normalize       |        3.67M |        3.26M | verkit 1.13× |\n| Compare                   |        3.09M |        2.36M | verkit 1.31× |\n| Compare parsed versions   |       40.59M |       28.62M | verkit 1.42× |\n| Increment                 |        3.38M |        2.03M | verkit 1.66× |\n| Coerce                    |        2.77M |        2.32M | verkit 1.19× |\n| Satisfy uncached ranges   |       148.5K |       122.3K | verkit 1.21× |\n| Satisfy pre-parsed inputs |       22.91M |        7.20M | verkit 3.18× |\n\nRange benchmarks either cycle through 1,001 inputs to avoid cache hits or\nparse once and reuse the resulting objects.\n\nRun runtime benchmarks with `pnpm bench`.\n\n## Sponsors\n\n<p align=\"center\">\n  <a href=\"https://cdn.jsdelivr.net/gh/sxzz/sponsors/sponsors.svg\">\n    <img src=\"https://cdn.jsdelivr.net/gh/sxzz/sponsors/sponsors.svg\" alt=\"Sponsors\" />\n  </a>\n</p>\n\n## License\n\n[MIT](./LICENSE) © 2026-PRESENT [Kevin Deng](https://github.com/sxzz).\n\nParts of the implementation and test fixtures are derived from [node-semver]\nunder the ISC license; see [THIRD_PARTY_NOTICES.md](./THIRD_PARTY_NOTICES.md).\n\n<!-- Badges -->\n\n[npmx-version-src]: https://npmx.dev/api/registry/badge/version/verkit\n[npmx-downloads-src]: https://npmx.dev/api/registry/badge/downloads-month/verkit\n[npmx-href]: https://npmx.dev/verkit\n[node-semver]: https://github.com/npm/node-semver\n[unit-test-src]: https://github.com/sxzz/verkit/actions/workflows/unit-test.yml/badge.svg\n[unit-test-href]: https://github.com/sxzz/verkit/actions/workflows/unit-test.yml\n[codecov-src]: https://codecov.io/gh/sxzz/verkit/graph/badge.svg?token=hBBtxizmt9\n[codecov-href]: https://codecov.io/gh/sxzz/verkit\n","publish_time":1789753949936,"_cnpm_publish_time":1789753949936,"dist-tags":{"latest":"0.5.0"}}