.
, , ||. Hyphen Ranges X.Y.Z - A.B.C
.
1.2.3 - 2.3.4 := >=1.2.3 <=2.3.4
, .
1.2 - 2.3.4 := >=1.2.0 <=2.3.4
, , , , .
1.2.3 - 2.3 := >=1.2.3 <2.4.0
1.2.3 - 2 := >=1.2.3 <3.0.0
X-Ranges 1.2.x 1.X 1.2. * *
X, x * "" [major, minor, patch].
* := >=0.0.0 (Any version satisfies)
1.x := >=1.0.0 <2.0.0 (Matching major version)
1.2.x := >=1.2.0 <1.3.0 (Matching major and minor versions)
X-Range, .
"" (empty string) := * := >=0.0.0
1 := 1.x.x := >=1.0.0 <2.0.0
1.2 := 1.2.x := >=1.2.0 <1.3.0
~ 1.2.3 ~ 1.2 ~ 1
, . , .
~1.2.3 := >=1.2.3 <1.(2+1).0 := >=1.2.3 <1.3.0
~1.2 := >=1.2.0 <1.(2+1).0 := >=1.2.0 <1.3.0 (Same as 1.2.x)
~1 := >=1.0.0 <(1+1).0.0 := >=1.0.0 <2.0.0 (Same as 1.x)
~0.2.3 := >=0.2.3 <0.(2+1).0 := >=0.2.3 <0.3.0
~0.2 := >=0.2.0 <0.(2+1).0 := >=0.2.0 <0.3.0 (Same as 0.2.x)
~0 := >=0.0.0 <(0+1).0.0 := >=0.0.0 <1.0.0 (Same as 0.x)
~1.2.3-beta.2 := >=1.2.3-beta.2 <1.3.0 Note that prereleases in the 1.2.3 version will be allowed, if they are greater than or equal
2. , 1.2.3-beta.4, 1.2.4-2 , [, , ] .
^ 1.2.3 ^ 0.2.5 ^ 0.0.4
, [, , ] . , 1.0.0 , 0.X >= 0.1.0 0.0.X.
0.x, "break-change".
Caret , 0,2,4 0,3 , . , , 0.2.4 0.2.5. , ( ), .
^1.2.3 := >=1.2.3 <2.0.0
^0.2.3 := >=0.2.3 <0.3.0
^0.0.3 := >=0.0.3 <0.0.4
^1.2.3-beta.2 := >=1.2.3-beta.2 <2.0.0 Note that prereleases in the 1.2.3 version will be allowed, if they are greater than or equal
2. , 1.2.3-beta.4, 1.2.4-2 , [, , ] . ^ 0.0.3-beta: = >= 0.0.3-beta < 0.0.4 , 0.0.3 , -. , 0.0.3-pr.2.
0, , 0.
^1.2.x := >=1.2.0 <2.0.0
^0.0.x := >=0.0.0 <0.1.0
^0.0 := >=0.0.0 <0.1.0
- , , .
^1.x := >=1.0.0 <2.0.0
^0.x := >=0.0.0 <1.0.0