Patch, corrected
A patch is a fix for behaviour that was never intended, not a promise of backward compatibility (which is practically impossible to guarantee). The definition is amended so a fix stays a fix.
Specification · 1.0.0
Semantic Versions is an open specification for how version
numbers are
assigned, incremented, grouped, compared and matched.
A
spiritual successor to Semantic
Versioning 2.0.0-rc.1.
npm:react@1.2.3-beta.4+build.7
# source:name @ major.minor.patch-prerelease+build
Why a new spec
Semantic Versioning 2.0.0 is more than a decade old, has not meaningfully changed in that time, and has no realistic path to a 3.0. The way we ship software has moved on. JavaScript avoided the first circle of dependency hell only because tooling quietly bolted sets, ranges and comparators onto a spec that never defined them. We have since landed in a deeper circle, where package managers read the same version differently and resolve to different graphs.
A specification is a language, and it is only as good as the definitions it contains. Software changes over time and sometimes breaks; that is natural, and necessary for growth. A versioning spec exists to codify the signals that communicate change, so it should codify the ones we actually use.
What changed
A patch is a fix for behaviour that was never intended, not a promise of backward compatibility (which is practically impossible to guarantee). The definition is amended so a fix stays a fix.
2.0.0-rc.2 turned builds into inert "build metadata," making every build of a version equivalent. Two artifacts with different hashes or architectures are distinct software, so builds order again.
Precedence alone can't describe a collection of versions. This spec defines ordered, unordered, normal, prerelease and build sets: the vocabulary you need to manage more than one version at a time.
Comparators (>=1.2.7), comparator sets, hyphen ranges, x-ranges, tilde and caret. The grammar tools already ship, defined so they desugar to primitive comparators in one deterministic way.
~>)The pessimistic operator, borrowed from the Ruby world, is defined explicitly rather than left to each tool's imagination.
Backus–Naur grammars for versions, ranges and comparators, plus a parser you can read, so anyone can build a compliant library.
The full ruleset: versions, sets, ranges, comparators and precedence.
Test what matches what against the range grammar, entirely in your browser.
Formal Backus–Naur forms, ready to build a library from.
How builds were introduced, and how a later change made them meaningless.
Pinning a resolved subgraph inside a source-qualified version, built on this spec.
A verifiable content digest carried in the version: npm:react@18.2.0+sha512.…
Status of this document
Semantic Versions 1.0.0 is a release candidate. Its definitions are intended to be
scrutinized, tested and refined; a reference parser (semantic-versions)
tracks the specification, and the work is being stewarded toward an open standards
body. Corrections and proposals are welcome
in the repository.