{"id":26223607,"url":"https://github.com/tomchen/semver-ts","last_synced_at":"2026-05-07T04:34:15.948Z","repository":{"id":281727672,"uuid":"946224898","full_name":"tomchen/semver-ts","owner":"tomchen","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-10T21:13:36.000Z","size":69,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-10T21:24:26.394Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://semver.tomchen.org/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tomchen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-10T20:07:23.000Z","updated_at":"2025-03-10T21:13:40.000Z","dependencies_parsed_at":"2025-03-10T21:24:30.327Z","dependency_job_id":"ecf62306-c2eb-4b8c-be24-cd2f6d81ac6f","html_url":"https://github.com/tomchen/semver-ts","commit_stats":null,"previous_names":["tomchen/semver-ts"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomchen%2Fsemver-ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomchen%2Fsemver-ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomchen%2Fsemver-ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomchen%2Fsemver-ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomchen","download_url":"https://codeload.github.com/tomchen/semver-ts/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243265911,"owners_count":20263630,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-12T17:39:30.976Z","updated_at":"2025-10-13T08:32:33.360Z","avatar_url":"https://github.com/tomchen.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://semver.tomchen.org/\" target=\"_blank\"\u003e\n    \u003cimg width=\"120\" src=\"https://raw.githubusercontent.com/tomchen/semver-ts/main/semver-ts.svg\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003eSemVer TS\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\u003cstrong\u003eSemVer\u003c/strong\u003e (Semantic Versioning) JavaScript library's\u003cbr /\u003e\n\u003cstrong\u003eT\u003c/strong\u003eype\u003cstrong\u003eS\u003c/strong\u003ecript\u003cbr /\u003e\n\u003cstrong\u003eT\u003c/strong\u003eree-\u003cstrong\u003eS\u003c/strong\u003ehakable\u003cbr /\u003e\n\u003cstrong\u003eT\u003c/strong\u003einy \u003cstrong\u003eS\u003c/strong\u003eize\u003cbr /\u003e\n\u003cstrong\u003eT\u003c/strong\u003eurbo \u003cstrong\u003eS\u003c/strong\u003epeed\u003csup\u003e[1]\u003c/sup\u003e\u003cbr /\u003e\nVersion\u003c/p\u003e\n\nA fork and drop-in replacement of npm's official [semver](https://www.npmjs.com/package/semver) library, it has all 26 functions of the original library (except `satisfies`)\u003csup\u003e[2]\u003c/sup\u003e, with the same implementation and the same API, passes all the original's tests\u003csup\u003e[3]\u003c/sup\u003e, but:\n\n- It is more lightweight and perfectly treeshakable with ES modules\u003csup\u003e[4]\u003c/sup\u003e\n  - It removed SemVer class and uses a purely functional approach\u003csup\u003e[5]\u003c/sup\u003e\n- It is written in TypeScript, has correct types\u003csup\u003e[6]\u003c/sup\u003e and is well-commented and -documented\u003csup\u003e[7]\u003c/sup\u003e.\n\n## Usage\n\nInstallation:\n\n```\nnpm install semver-ts\n```\n\nIn your ES module (recommanded instead of CommonJS) JavaScript/TypeScript code:\n\n```js\nimport { compare } from \"semver-ts\"\ncompare(\"1.0.0\", \"1.0.3\")\n```\n\nOr directly in HTML (not tree-shakable, obviously):\n\n```html\n\u003cscript src=\"https://unpkg.com/semver-ts/dist/index.global.js\"\u003e\u003c/script\u003e\n\u003cscript\u003esemver.compare(\"1.0.0\", \"1.0.3\")\u003c/script\u003e\n```\n\nDocumentation: [https://semver.tomchen.org/](https://semver.tomchen.org/)\n\n## Size comparison\n\nES module treeshaked and minified (with terser) bundle size comparison:\n\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003cth\u003eCode\u003c/th\u003e\n    \u003cth\u003eMinified\u003c/th\u003e\n    \u003cth\u003eGzipped\u003c/th\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003cpre\u003eimport { compare } from \"semver-ts\"\ncompare(\"1.0.0\", \"1.0.3\")\u003c/pre\u003e\u003c/td\u003e\n    \u003ctd\u003e2.00 KB\u003c/td\u003e\n    \u003ctd\u003e914 bytes\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003cpre\u003eimport compare from \"semver/functions/compare\"\ncompare(\"1.0.0\", \"1.0.3\")\u003c/pre\u003e\u003c/td\u003e\n    \u003ctd\u003e8.95 KB\u003c/td\u003e\n    \u003ctd\u003e2.80 KB\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003cpre\u003eimport { compare } from \"semver\"\ncompare(\"1.0.0\", \"1.0.3\")\u003c/pre\u003e\u003c/td\u003e\n    \u003ctd\u003e25.9 KB\u003c/td\u003e\n    \u003ctd\u003e7.55 KB\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n## Notes\n\n[1] Turbo Speed: OK, the current version faithfully uses the original implementation so it's not really that fast, but it should be slightly faster than the original due to the fact that it removes the class-based structure and uses a purely functional approach\n\n[2] All 'semver/functions/*', except for 'semver/functions/satisfies' which is intended to be included in the future. List of functions: `clean`, `cmp`, `coerce`, `compare`, `compareBuild`, `compareCore`, `compareIdentifiers`, `compareLoose`, `diff`, `eq`, `gt`, `gte`, `inc`, `incThrow`, `lt`, `lte`, `major`, `minor`, `neq`, `parse`, `patch`, `prerelease`, `rcompare`, `rsort`, `sort`, `valid`\n\n[3] Faithfully uses the same implementation code, same function signatures (even the same weird overload of `inc()`) (only replacing SemVer class by an object containing parsed semver information), and passed all the tests in the original library (semver v7.7.1 (2025-02-03))\n\n[4] Not tree-shakable with CommonJS exports. The support for `const a = require(\"semver/a\")` CommonJS treeshakability could be done but will increase the size of the ESM bundle. So, just use the modern ES modules\n\n[5] Currently, class is not tree-shakable with any bundler, and with either ES modules or CommonJS exports. Therefore, despite the [effort](https://github.com/npm/node-semver/issues/291) to make the original semver tree-shakable, user's bundling output may still contain a lot of unused code, mainly from the SemVer class\n\n[6] Some functions in @types/semver, such as `inc()`, do not seem to have correct types\n\n[7] You can hover over a function to see very detailed information including examples in VS Code thanks to the comments. The documentation webpages are automatically generated from the comments with TypeDoc.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomchen%2Fsemver-ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomchen%2Fsemver-ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomchen%2Fsemver-ts/lists"}