1+ /*---------------------------------------------------------------------------------------------
2+ * Copyright (c) Microsoft Corporation. All rights reserved.
3+ * Licensed under the MIT License. See License.txt in the project root for license information.
4+ *--------------------------------------------------------------------------------------------*/
5+
6+ declare module 'semver-umd' {
7+
8+ // Type definitions for semver 5.5
9+ // Project: https://github.com/npm/node-semver
10+ // Definitions by: Bart van der Schoor <https://github.com/Bartvds>
11+ // BendingBender <https://github.com/BendingBender>
12+ // Lucian Buzzo <https://github.com/LucianBuzzo>
13+ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/semver
14+
15+ export const SEMVER_SPEC_VERSION : "2.0.0" ;
16+
17+ export type ReleaseType = "major" | "premajor" | "minor" | "preminor" | "patch" | "prepatch" | "prerelease" ;
18+
19+ /**
20+ * Return the parsed version as a SemVer object, or null if it's not valid.
21+ */
22+ export function parse ( v : string | SemVer , loose ?: boolean ) : SemVer | null ;
23+ /**
24+ * Return the parsed version, or null if it's not valid.
25+ */
26+ export function valid ( v : string | SemVer , loose ?: boolean ) : string | null ;
27+ /**
28+ * Returns cleaned (removed leading/trailing whitespace, remove '=v' prefix) and parsed version, or null if version is invalid.
29+ */
30+ export function clean ( version : string , loose ?: boolean ) : string | null ;
31+ /**
32+ * Return the version incremented by the release type (major, minor, patch, or prerelease), or null if it's not valid.
33+ */
34+ export function inc ( v : string | SemVer , release : ReleaseType , loose ?: boolean , identifier ?: string ) : string | null ;
35+ /**
36+ * Return the major version number.
37+ */
38+ export function major ( v : string | SemVer , loose ?: boolean ) : number ;
39+ /**
40+ * Return the minor version number.
41+ */
42+ export function minor ( v : string | SemVer , loose ?: boolean ) : number ;
43+ /**
44+ * Return the patch version number.
45+ */
46+ export function patch ( v : string | SemVer , loose ?: boolean ) : number ;
47+ /**
48+ * Returns an array of prerelease components, or null if none exist.
49+ */
50+ export function prerelease ( v : string | SemVer , loose ?: boolean ) : string [ ] | null ;
51+
52+ // Comparison
53+ /**
54+ * v1 > v2
55+ */
56+ export function gt ( v1 : string | SemVer , v2 : string | SemVer , loose ?: boolean ) : boolean ;
57+ /**
58+ * v1 >= v2
59+ */
60+ export function gte ( v1 : string | SemVer , v2 : string | SemVer , loose ?: boolean ) : boolean ;
61+ /**
62+ * v1 < v2
63+ */
64+ export function lt ( v1 : string | SemVer , v2 : string | SemVer , loose ?: boolean ) : boolean ;
65+ /**
66+ * v1 <= v2
67+ */
68+ export function lte ( v1 : string | SemVer , v2 : string | SemVer , loose ?: boolean ) : boolean ;
69+ /**
70+ * v1 == v2 This is true if they're logically equivalent, even if they're not the exact same string. You already know how to compare strings.
71+ */
72+ export function eq ( v1 : string | SemVer , v2 : string | SemVer , loose ?: boolean ) : boolean ;
73+ /**
74+ * v1 != v2 The opposite of eq.
75+ */
76+ export function neq ( v1 : string | SemVer , v2 : string | SemVer , loose ?: boolean ) : boolean ;
77+
78+ /**
79+ * Pass in a comparison string, and it'll call the corresponding semver comparison function.
80+ * "===" and "!==" do simple string comparison, but are included for completeness.
81+ * Throws if an invalid comparison string is provided.
82+ */
83+ export function cmp ( v1 : string | SemVer , operator : Operator , v2 : string | SemVer , loose ?: boolean ) : boolean ;
84+ export type Operator = '===' | '!==' | '' | '=' | '==' | '!=' | '>' | '>=' | '<' | '<=' ;
85+
86+ /**
87+ * Return 0 if v1 == v2, or 1 if v1 is greater, or -1 if v2 is greater. Sorts in ascending order if passed to Array.sort().
88+ */
89+ export function compare ( v1 : string | SemVer , v2 : string | SemVer , loose ?: boolean ) : 1 | 0 | - 1 ;
90+ /**
91+ * The reverse of compare. Sorts an array of versions in descending order when passed to Array.sort().
92+ */
93+ export function rcompare ( v1 : string | SemVer , v2 : string | SemVer , loose ?: boolean ) : 1 | 0 | - 1 ;
94+
95+ /**
96+ * Compares two identifiers, must be numeric strings or truthy/falsy values. Sorts in ascending order if passed to Array.sort().
97+ */
98+ export function compareIdentifiers ( a : string | null , b : string | null ) : 1 | 0 | - 1 ;
99+ /**
100+ * The reverse of compareIdentifiers. Sorts in descending order when passed to Array.sort().
101+ */
102+ export function rcompareIdentifiers ( a : string | null , b : string | null ) : 1 | 0 | - 1 ;
103+
104+ /**
105+ * Sorts an array of semver entries in ascending order.
106+ */
107+ export function sort ( list : Array < string | SemVer > , loose ?: boolean ) : Array < string | SemVer > ;
108+ /**
109+ * Sorts an array of semver entries in descending order.
110+ */
111+ export function rsort ( list : Array < string | SemVer > , loose ?: boolean ) : Array < string | SemVer > ;
112+
113+ /**
114+ * Returns difference between two versions by the release type (major, premajor, minor, preminor, patch, prepatch, or prerelease), or null if the versions are the same.
115+ */
116+ export function diff ( v1 : string , v2 : string , loose ?: boolean ) : ReleaseType | null ;
117+
118+ // Ranges
119+ /**
120+ * Return the valid range or null if it's not valid
121+ */
122+ export function validRange ( range : string | Range , loose ?: boolean ) : string ;
123+ /**
124+ * Return true if the version satisfies the range.
125+ */
126+ export function satisfies ( version : string | SemVer , range : string | Range , loose ?: boolean ) : boolean ;
127+ /**
128+ * Return the highest version in the list that satisfies the range, or null if none of them do.
129+ */
130+ export function maxSatisfying ( versions : Array < string | SemVer > , range : string | Range , loose ?: boolean ) : string ;
131+ /**
132+ * Return the lowest version in the list that satisfies the range, or null if none of them do.
133+ */
134+ export function minSatisfying ( versions : Array < string | SemVer > , range : string , loose ?: boolean ) : string ;
135+ /**
136+ * Return true if version is greater than all the versions possible in the range.
137+ */
138+ export function gtr ( version : string | SemVer , range : string | Range , loose ?: boolean ) : boolean ;
139+ /**
140+ * Return true if version is less than all the versions possible in the range.
141+ */
142+ export function ltr ( version : string | SemVer , range : string | Range , loose ?: boolean ) : boolean ;
143+ /**
144+ * Return true if the version is outside the bounds of the range in either the high or low direction.
145+ * The hilo argument must be either the string '>' or '<'. (This is the function called by gtr and ltr.)
146+ */
147+ export function outside ( version : string | SemVer , range : string | Range , hilo : '>' | '<' , loose ?: boolean ) : boolean ;
148+ /**
149+ * Return true if any of the ranges comparators intersect
150+ */
151+ export function intersects ( range1 : string | Range , range2 : string | Range , loose ?: boolean ) : boolean ;
152+
153+ // Coercion
154+ /**
155+ * Coerces a string to semver if possible
156+ */
157+ export function coerce ( version : string | SemVer ) : SemVer | null ;
158+
159+ export class SemVer {
160+ constructor ( version : string | SemVer , loose ?: boolean ) ;
161+
162+ raw : string ;
163+ loose : boolean ;
164+ format ( ) : string ;
165+ inspect ( ) : string ;
166+
167+ major : number ;
168+ minor : number ;
169+ patch : number ;
170+ version : string ;
171+ build : string [ ] ;
172+ prerelease : string [ ] ;
173+
174+ compare ( other : string | SemVer ) : 1 | 0 | - 1 ;
175+ compareMain ( other : string | SemVer ) : 1 | 0 | - 1 ;
176+ comparePre ( other : string | SemVer ) : 1 | 0 | - 1 ;
177+ inc ( release : ReleaseType , identifier ?: string ) : SemVer ;
178+ }
179+
180+ export class Comparator {
181+ constructor ( comp : string | Comparator , loose ?: boolean ) ;
182+
183+ semver : SemVer ;
184+ operator : string ;
185+ value : boolean ;
186+ parse ( comp : string ) : void ;
187+ test ( version : string | SemVer ) : boolean ;
188+ intersects ( comp : Comparator , loose ?: boolean ) : boolean ;
189+ }
190+
191+ export class Range {
192+ constructor ( range : string | Range , loose ?: boolean ) ;
193+
194+ range : string ;
195+ raw : string ;
196+ loose : boolean ;
197+ format ( ) : string ;
198+ inspect ( ) : string ;
199+
200+ set : Comparator [ ] [ ] ;
201+ parseRange ( range : string ) : Comparator [ ] ;
202+ test ( version : string | SemVer ) : boolean ;
203+ intersects ( range : Range , loose ?: boolean ) : boolean ;
204+ }
205+
206+ }
0 commit comments