]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/man/man7/semver.7
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / man / man7 / semver.7
1 .TH "SEMVER" "7" "October 2016" "" ""
2 .SH "NAME"
3 \fBsemver\fR \- The semantic versioner for npm
4 .SH Usage
5 .P
6 .RS 2
7 .nf
8 $ npm install semver
9
10 semver\.valid('1\.2\.3') // '1\.2\.3'
11 semver\.valid('a\.b\.c') // null
12 semver\.clean('  =v1\.2\.3   ') // '1\.2\.3'
13 semver\.satisfies('1\.2\.3', '1\.x || >=2\.5\.0 || 5\.0\.0 \- 7\.2\.3') // true
14 semver\.gt('1\.2\.3', '9\.8\.7') // false
15 semver\.lt('1\.2\.3', '9\.8\.7') // true
16 .fi
17 .RE
18 .P
19 As a command\-line utility:
20 .P
21 .RS 2
22 .nf
23 $ semver \-h
24
25 Usage: semver <version> [<version> [\.\.\.]] [\-r <range> | \-i <inc> | \-\-preid <identifier> | \-l | \-rv]
26 Test if version(s) satisfy the supplied range(s), and sort them\.
27
28 Multiple versions or ranges may be supplied, unless increment
29 option is specified\.  In that case, only a single version may
30 be used, and it is incremented by the specified level
31
32 Program exits successfully if any valid version satisfies
33 all supplied ranges, and prints all satisfying versions\.
34
35 If no versions are valid, or ranges are not satisfied,
36 then exits failure\.
37
38 Versions are printed in ascending order, so supplying
39 multiple versions to the utility will just sort them\.
40 .fi
41 .RE
42 .SH Versions
43 .P
44 A "version" is described by the \fBv2\.0\.0\fP specification found at
45 http://semver\.org/\|\.
46 .P
47 A leading \fB"="\fP or \fB"v"\fP character is stripped off and ignored\.
48 .SH Ranges
49 .P
50 A \fBversion range\fP is a set of \fBcomparators\fP which specify versions
51 that satisfy the range\.
52 .P
53 A \fBcomparator\fP is composed of an \fBoperator\fP and a \fBversion\fP\|\.  The set
54 of primitive \fBoperators\fP is:
55 .RS 0
56 .IP \(bu 2
57 \fB<\fP Less than
58 .IP \(bu 2
59 \fB<=\fP Less than or equal to
60 .IP \(bu 2
61 \fB>\fP Greater than
62 .IP \(bu 2
63 \fB>=\fP Greater than or equal to
64 .IP \(bu 2
65 \fB=\fP Equal\.  If no operator is specified, then equality is assumed,
66 so this operator is optional, but MAY be included\.
67
68 .RE
69 .P
70 For example, the comparator \fB>=1\.2\.7\fP would match the versions
71 \fB1\.2\.7\fP, \fB1\.2\.8\fP, \fB2\.5\.3\fP, and \fB1\.3\.9\fP, but not the versions \fB1\.2\.6\fP
72 or \fB1\.1\.0\fP\|\.
73 .P
74 Comparators can be joined by whitespace to form a \fBcomparator set\fP,
75 which is satisfied by the \fBintersection\fR of all of the comparators
76 it includes\.
77 .P
78 A range is composed of one or more comparator sets, joined by \fB||\fP\|\.  A
79 version matches a range if and only if every comparator in at least
80 one of the \fB||\fP\-separated comparator sets is satisfied by the version\.
81 .P
82 For example, the range \fB>=1\.2\.7 <1\.3\.0\fP would match the versions
83 \fB1\.2\.7\fP, \fB1\.2\.8\fP, and \fB1\.2\.99\fP, but not the versions \fB1\.2\.6\fP, \fB1\.3\.0\fP,
84 or \fB1\.1\.0\fP\|\.
85 .P
86 The range \fB1\.2\.7 || >=1\.2\.9 <2\.0\.0\fP would match the versions \fB1\.2\.7\fP,
87 \fB1\.2\.9\fP, and \fB1\.4\.6\fP, but not the versions \fB1\.2\.8\fP or \fB2\.0\.0\fP\|\.
88 .SS Prerelease Tags
89 .P
90 If a version has a prerelease tag (for example, \fB1\.2\.3\-alpha\.3\fP) then
91 it will only be allowed to satisfy comparator sets if at least one
92 comparator with the same \fB[major, minor, patch]\fP tuple also has a
93 prerelease tag\.
94 .P
95 For example, the range \fB>1\.2\.3\-alpha\.3\fP would be allowed to match the
96 version \fB1\.2\.3\-alpha\.7\fP, but it would \fInot\fR be satisfied by
97 \fB3\.4\.5\-alpha\.9\fP, even though \fB3\.4\.5\-alpha\.9\fP is technically "greater
98 than" \fB1\.2\.3\-alpha\.3\fP according to the SemVer sort rules\.  The version
99 range only accepts prerelease tags on the \fB1\.2\.3\fP version\.  The
100 version \fB3\.4\.5\fP \fIwould\fR satisfy the range, because it does not have a
101 prerelease flag, and \fB3\.4\.5\fP is greater than \fB1\.2\.3\-alpha\.7\fP\|\.
102 .P
103 The purpose for this behavior is twofold\.  First, prerelease versions
104 frequently are updated very quickly, and contain many breaking changes
105 that are (by the author's design) not yet fit for public consumption\.
106 Therefore, by default, they are excluded from range matching
107 semantics\.
108 .P
109 Second, a user who has opted into using a prerelease version has
110 clearly indicated the intent to use \fIthat specific\fR set of
111 alpha/beta/rc versions\.  By including a prerelease tag in the range,
112 the user is indicating that they are aware of the risk\.  However, it
113 is still not appropriate to assume that they have opted into taking a
114 similar risk on the \fInext\fR set of prerelease versions\.
115 .SS Prerelease Identifiers
116 .P
117 The method \fB\|\.inc\fP takes an additional \fBidentifier\fP string argument that
118 will append the value of the string as a prerelease identifier:
119 .P
120 .RS 2
121 .nf
122 > semver\.inc('1\.2\.3', 'prerelease', 'beta')
123 \|'1\.2\.4\-beta\.0'
124 .fi
125 .RE
126 .P
127 command\-line example:
128 .P
129 .RS 2
130 .nf
131 $ semver 1\.2\.3 \-i prerelease \-\-preid beta
132 1\.2\.4\-beta\.0
133 .fi
134 .RE
135 .P
136 Which then can be used to increment further:
137 .P
138 .RS 2
139 .nf
140 $ semver 1\.2\.4\-beta\.0 \-i prerelease
141 1\.2\.4\-beta\.1
142 .fi
143 .RE
144 .SS Advanced Range Syntax
145 .P
146 Advanced range syntax desugars to primitive comparators in
147 deterministic ways\.
148 .P
149 Advanced ranges may be combined in the same way as primitive
150 comparators using white space or \fB||\fP\|\.
151 .SS Hyphen Ranges \fBX\.Y\.Z \- A\.B\.C\fP
152 .P
153 Specifies an inclusive set\.
154 .RS 0
155 .IP \(bu 2
156 \fB1\.2\.3 \- 2\.3\.4\fP := \fB>=1\.2\.3 <=2\.3\.4\fP
157
158 .RE
159 .P
160 If a partial version is provided as the first version in the inclusive
161 range, then the missing pieces are replaced with zeroes\.
162 .RS 0
163 .IP \(bu 2
164 \fB1\.2 \- 2\.3\.4\fP := \fB>=1\.2\.0 <=2\.3\.4\fP
165
166 .RE
167 .P
168 If a partial version is provided as the second version in the
169 inclusive range, then all versions that start with the supplied parts
170 of the tuple are accepted, but nothing that would be greater than the
171 provided tuple parts\.
172 .RS 0
173 .IP \(bu 2
174 \fB1\.2\.3 \- 2\.3\fP := \fB>=1\.2\.3 <2\.4\.0\fP
175 .IP \(bu 2
176 \fB1\.2\.3 \- 2\fP := \fB>=1\.2\.3 <3\.0\.0\fP
177
178 .RE
179 .SS X\-Ranges \fB1\.2\.x\fP \fB1\.X\fP \fB1\.2\.*\fP \fB*\fP
180 .P
181 Any of \fBX\fP, \fBx\fP, or \fB*\fP may be used to "stand in" for one of the
182 numeric values in the \fB[major, minor, patch]\fP tuple\.
183 .RS 0
184 .IP \(bu 2
185 \fB*\fP := \fB>=0\.0\.0\fP (Any version satisfies)
186 .IP \(bu 2
187 \fB1\.x\fP := \fB>=1\.0\.0 <2\.0\.0\fP (Matching major version)
188 .IP \(bu 2
189 \fB1\.2\.x\fP := \fB>=1\.2\.0 <1\.3\.0\fP (Matching major and minor versions)
190
191 .RE
192 .P
193 A partial version range is treated as an X\-Range, so the special
194 character is in fact optional\.
195 .RS 0
196 .IP \(bu 2
197 \fB""\fP (empty string) := \fB*\fP := \fB>=0\.0\.0\fP
198 .IP \(bu 2
199 \fB1\fP := \fB1\.x\.x\fP := \fB>=1\.0\.0 <2\.0\.0\fP
200 .IP \(bu 2
201 \fB1\.2\fP := \fB1\.2\.x\fP := \fB>=1\.2\.0 <1\.3\.0\fP
202
203 .RE
204 .SS Tilde Ranges \fB~1\.2\.3\fP \fB~1\.2\fP \fB~1\fP
205 .P
206 Allows patch\-level changes if a minor version is specified on the
207 comparator\.  Allows minor\-level changes if not\.
208 .RS 0
209 .IP \(bu 2
210 \fB~1\.2\.3\fP := \fB>=1\.2\.3 <1\.(2+1)\.0\fP := \fB>=1\.2\.3 <1\.3\.0\fP
211 .IP \(bu 2
212 \fB~1\.2\fP := \fB>=1\.2\.0 <1\.(2+1)\.0\fP := \fB>=1\.2\.0 <1\.3\.0\fP (Same as \fB1\.2\.x\fP)
213 .IP \(bu 2
214 \fB~1\fP := \fB>=1\.0\.0 <(1+1)\.0\.0\fP := \fB>=1\.0\.0 <2\.0\.0\fP (Same as \fB1\.x\fP)
215 .IP \(bu 2
216 \fB~0\.2\.3\fP := \fB>=0\.2\.3 <0\.(2+1)\.0\fP := \fB>=0\.2\.3 <0\.3\.0\fP
217 .IP \(bu 2
218 \fB~0\.2\fP := \fB>=0\.2\.0 <0\.(2+1)\.0\fP := \fB>=0\.2\.0 <0\.3\.0\fP (Same as \fB0\.2\.x\fP)
219 .IP \(bu 2
220 \fB~0\fP := \fB>=0\.0\.0 <(0+1)\.0\.0\fP := \fB>=0\.0\.0 <1\.0\.0\fP (Same as \fB0\.x\fP)
221 .IP \(bu 2
222 \fB~1\.2\.3\-beta\.2\fP := \fB>=1\.2\.3\-beta\.2 <1\.3\.0\fP Note that prereleases in
223 the \fB1\.2\.3\fP version will be allowed, if they are greater than or
224 equal to \fBbeta\.2\fP\|\.  So, \fB1\.2\.3\-beta\.4\fP would be allowed, but
225 \fB1\.2\.4\-beta\.2\fP would not, because it is a prerelease of a
226 different \fB[major, minor, patch]\fP tuple\.
227
228 .RE
229 .SS Caret Ranges \fB^1\.2\.3\fP \fB^0\.2\.5\fP \fB^0\.0\.4\fP
230 .P
231 Allows changes that do not modify the left\-most non\-zero digit in the
232 \fB[major, minor, patch]\fP tuple\.  In other words, this allows patch and
233 minor updates for versions \fB1\.0\.0\fP and above, patch updates for
234 versions \fB0\.X >=0\.1\.0\fP, and \fIno\fR updates for versions \fB0\.0\.X\fP\|\.
235 .P
236 Many authors treat a \fB0\.x\fP version as if the \fBx\fP were the major
237 "breaking\-change" indicator\.
238 .P
239 Caret ranges are ideal when an author may make breaking changes
240 between \fB0\.2\.4\fP and \fB0\.3\.0\fP releases, which is a common practice\.
241 However, it presumes that there will \fInot\fR be breaking changes between
242 \fB0\.2\.4\fP and \fB0\.2\.5\fP\|\.  It allows for changes that are presumed to be
243 additive (but non\-breaking), according to commonly observed practices\.
244 .RS 0
245 .IP \(bu 2
246 \fB^1\.2\.3\fP := \fB>=1\.2\.3 <2\.0\.0\fP
247 .IP \(bu 2
248 \fB^0\.2\.3\fP := \fB>=0\.2\.3 <0\.3\.0\fP
249 .IP \(bu 2
250 \fB^0\.0\.3\fP := \fB>=0\.0\.3 <0\.0\.4\fP
251 .IP \(bu 2
252 \fB^1\.2\.3\-beta\.2\fP := \fB>=1\.2\.3\-beta\.2 <2\.0\.0\fP Note that prereleases in
253 the \fB1\.2\.3\fP version will be allowed, if they are greater than or
254 equal to \fBbeta\.2\fP\|\.  So, \fB1\.2\.3\-beta\.4\fP would be allowed, but
255 \fB1\.2\.4\-beta\.2\fP would not, because it is a prerelease of a
256 different \fB[major, minor, patch]\fP tuple\.
257 .IP \(bu 2
258 \fB^0\.0\.3\-beta\fP := \fB>=0\.0\.3\-beta <0\.0\.4\fP  Note that prereleases in the
259 \fB0\.0\.3\fP version \fIonly\fR will be allowed, if they are greater than or
260 equal to \fBbeta\fP\|\.  So, \fB0\.0\.3\-pr\.2\fP would be allowed\.
261
262 .RE
263 .P
264 When parsing caret ranges, a missing \fBpatch\fP value desugars to the
265 number \fB0\fP, but will allow flexibility within that value, even if the
266 major and minor versions are both \fB0\fP\|\.
267 .RS 0
268 .IP \(bu 2
269 \fB^1\.2\.x\fP := \fB>=1\.2\.0 <2\.0\.0\fP
270 .IP \(bu 2
271 \fB^0\.0\.x\fP := \fB>=0\.0\.0 <0\.1\.0\fP
272 .IP \(bu 2
273 \fB^0\.0\fP := \fB>=0\.0\.0 <0\.1\.0\fP
274
275 .RE
276 .P
277 A missing \fBminor\fP and \fBpatch\fP values will desugar to zero, but also
278 allow flexibility within those values, even if the major version is
279 zero\.
280 .RS 0
281 .IP \(bu 2
282 \fB^1\.x\fP := \fB>=1\.0\.0 <2\.0\.0\fP
283 .IP \(bu 2
284 \fB^0\.x\fP := \fB>=0\.0\.0 <1\.0\.0\fP
285
286 .RE
287 .SS Range Grammar
288 .P
289 Putting all this together, here is a Backus\-Naur grammar for ranges,
290 for the benefit of parser authors:
291 .P
292 .RS 2
293 .nf
294 range\-set  ::= range ( logical\-or range ) *
295 logical\-or ::= ( ' ' ) * '||' ( ' ' ) *
296 range      ::= hyphen | simple ( ' ' simple ) * | ''
297 hyphen     ::= partial ' \- ' partial
298 simple     ::= primitive | partial | tilde | caret
299 primitive  ::= ( '<' | '>' | '>=' | '<=' | '=' | ) partial
300 partial    ::= xr ( '\.' xr ( '\.' xr qualifier ? )? )?
301 xr         ::= 'x' | 'X' | '*' | nr
302 nr         ::= '0' | ['1'\-'9']['0'\-'9']+
303 tilde      ::= '~' partial
304 caret      ::= '^' partial
305 qualifier  ::= ( '\-' pre )? ( '+' build )?
306 pre        ::= parts
307 build      ::= parts
308 parts      ::= part ( '\.' part ) *
309 part       ::= nr | [\-0\-9A\-Za\-z]+
310 .fi
311 .RE
312 .SH Functions
313 .P
314 All methods and classes take a final \fBloose\fP boolean argument that, if
315 true, will be more forgiving about not\-quite\-valid semver strings\.
316 The resulting output will always be 100% strict, of course\.
317 .P
318 Strict\-mode Comparators and Ranges will be strict about the SemVer
319 strings that they parse\.
320 .RS 0
321 .IP \(bu 2
322 \fBvalid(v)\fP: Return the parsed version, or null if it's not valid\.
323 .IP \(bu 2
324 \fBinc(v, release)\fP: Return the version incremented by the release
325 type (\fBmajor\fP,   \fBpremajor\fP, \fBminor\fP, \fBpreminor\fP, \fBpatch\fP,
326 \fBprepatch\fP, or \fBprerelease\fP), or null if it's not valid
327 .RS 0
328 .IP \(bu 2
329 \fBpremajor\fP in one call will bump the version up to the next major
330 version and down to a prerelease of that major version\.
331 \fBpreminor\fP, and \fBprepatch\fP work the same way\.
332 .IP \(bu 2
333 If called from a non\-prerelease version, the \fBprerelease\fP will work the
334 same as \fBprepatch\fP\|\. It increments the patch version, then makes a
335 prerelease\. If the input version is already a prerelease it simply
336 increments it\.
337
338 .RE
339 .IP \(bu 2
340 \fBmajor(v)\fP: Return the major version number\.
341 .IP \(bu 2
342 \fBminor(v)\fP: Return the minor version number\.
343 .IP \(bu 2
344 \fBpatch(v)\fP: Return the patch version number\.
345
346 .RE
347 .SS Comparison
348 .RS 0
349 .IP \(bu 2
350 \fBgt(v1, v2)\fP: \fBv1 > v2\fP
351 .IP \(bu 2
352 \fBgte(v1, v2)\fP: \fBv1 >= v2\fP
353 .IP \(bu 2
354 \fBlt(v1, v2)\fP: \fBv1 < v2\fP
355 .IP \(bu 2
356 \fBlte(v1, v2)\fP: \fBv1 <= v2\fP
357 .IP \(bu 2
358 \fBeq(v1, v2)\fP: \fBv1 == v2\fP This is true if they're logically equivalent,
359 even if they're not the exact same string\.  You already know how to
360 compare strings\.
361 .IP \(bu 2
362 \fBneq(v1, v2)\fP: \fBv1 != v2\fP The opposite of \fBeq\fP\|\.
363 .IP \(bu 2
364 \fBcmp(v1, comparator, v2)\fP: Pass in a comparison string, and it'll call
365 the corresponding function above\.  \fB"==="\fP and \fB"!=="\fP do simple
366 string comparison, but are included for completeness\.  Throws if an
367 invalid comparison string is provided\.
368 .IP \(bu 2
369 \fBcompare(v1, v2)\fP: Return \fB0\fP if \fBv1 == v2\fP, or \fB1\fP if \fBv1\fP is greater, or \fB\-1\fP if
370 \fBv2\fP is greater\.  Sorts in ascending order if passed to \fBArray\.sort()\fP\|\.
371 .IP \(bu 2
372 \fBrcompare(v1, v2)\fP: The reverse of compare\.  Sorts an array of versions
373 in descending order when passed to \fBArray\.sort()\fP\|\.
374 .IP \(bu 2
375 \fBdiff(v1, v2)\fP: Returns difference between two versions by the release type
376 (\fBmajor\fP, \fBpremajor\fP, \fBminor\fP, \fBpreminor\fP, \fBpatch\fP, \fBprepatch\fP, or \fBprerelease\fP),
377 or null if the versions are the same\.
378
379 .RE
380 .SS Ranges
381 .RS 0
382 .IP \(bu 2
383 \fBvalidRange(range)\fP: Return the valid range or null if it's not valid
384 .IP \(bu 2
385 \fBsatisfies(version, range)\fP: Return true if the version satisfies the
386 range\.
387 .IP \(bu 2
388 \fBmaxSatisfying(versions, range)\fP: Return the highest version in the list
389 that satisfies the range, or \fBnull\fP if none of them do\.
390 .IP \(bu 2
391 \fBgtr(version, range)\fP: Return \fBtrue\fP if version is greater than all the
392 versions possible in the range\.
393 .IP \(bu 2
394 \fBltr(version, range)\fP: Return \fBtrue\fP if version is less than all the
395 versions possible in the range\.
396 .IP \(bu 2
397 \fBoutside(version, range, hilo)\fP: Return true if the version is outside
398 the bounds of the range in either the high or low direction\.  The
399 \fBhilo\fP argument must be either the string \fB\|'>'\fP or \fB\|'<'\fP\|\.  (This is
400 the function called by \fBgtr\fP and \fBltr\fP\|\.)
401
402 .RE
403 .P
404 Note that, since ranges may be non\-contiguous, a version might not be
405 greater than a range, less than a range, \fIor\fR satisfy a range!  For
406 example, the range \fB1\.2 <1\.2\.9 || >2\.0\.0\fP would have a hole from \fB1\.2\.9\fP
407 until \fB2\.0\.0\fP, so the version \fB1\.2\.10\fP would not be greater than the
408 range (because \fB2\.0\.1\fP satisfies, which is higher), nor less than the
409 range (since \fB1\.2\.8\fP satisfies, which is lower), and it also does not
410 satisfy the range\.
411 .P
412 If you want to know if a version satisfies or does not satisfy a
413 range, use the \fBsatisfies(version, range)\fP function\.
414