UNPKG

4.24 kBTypeScriptView Raw
1// re-exports for index file
2
3// functions for working with versions
4import semverParse = require("./functions/parse");
5import semverValid = require("./functions/valid");
6import semverClean = require("./functions/clean");
7import semverInc = require("./functions/inc");
8import semverDiff = require("./functions/diff");
9import semverMajor = require("./functions/major");
10import semverMinor = require("./functions/minor");
11import semverPatch = require("./functions/patch");
12import semverPrerelease = require("./functions/prerelease");
13import semverCompare = require("./functions/compare");
14import semverRcompare = require("./functions/rcompare");
15import semverCompareLoose = require("./functions/compare-loose");
16import semverCompareBuild = require("./functions/compare-build");
17import semverSort = require("./functions/sort");
18import semverRsort = require("./functions/rsort");
19
20export {
21 semverClean as clean,
22 semverCompare as compare,
23 semverCompareBuild as compareBuild,
24 semverCompareLoose as compareLoose,
25 semverDiff as diff,
26 semverInc as inc,
27 semverMajor as major,
28 semverMinor as minor,
29 semverParse as parse,
30 semverPatch as patch,
31 semverPrerelease as prerelease,
32 semverRcompare as rcompare,
33 semverRsort as rsort,
34 semverSort as sort,
35 semverValid as valid,
36};
37
38// low-level comparators between versions
39import semverGt = require("./functions/gt");
40import semverLt = require("./functions/lt");
41import semverEq = require("./functions/eq");
42import semverNeq = require("./functions/neq");
43import semverGte = require("./functions/gte");
44import semverLte = require("./functions/lte");
45import semverCmp = require("./functions/cmp");
46import semverCoerce = require("./functions/coerce");
47
48export {
49 semverCmp as cmp,
50 semverCoerce as coerce,
51 semverEq as eq,
52 semverGt as gt,
53 semverGte as gte,
54 semverLt as lt,
55 semverLte as lte,
56 semverNeq as neq,
57};
58
59// working with ranges
60import semverSatisfies = require("./functions/satisfies");
61import semverMaxSatisfying = require("./ranges/max-satisfying");
62import semverMinSatisfying = require("./ranges/min-satisfying");
63import semverToComparators = require("./ranges/to-comparators");
64import semverMinVersion = require("./ranges/min-version");
65import semverValidRange = require("./ranges/valid");
66import semverOutside = require("./ranges/outside");
67import semverGtr = require("./ranges/gtr");
68import semverLtr = require("./ranges/ltr");
69import semverIntersects = require("./ranges/intersects");
70import simplify = require("./ranges/simplify");
71import rangeSubset = require("./ranges/subset");
72
73export {
74 rangeSubset as subset,
75 semverGtr as gtr,
76 semverIntersects as intersects,
77 semverLtr as ltr,
78 semverMaxSatisfying as maxSatisfying,
79 semverMinSatisfying as minSatisfying,
80 semverMinVersion as minVersion,
81 semverOutside as outside,
82 semverSatisfies as satisfies,
83 semverToComparators as toComparators,
84 semverValidRange as validRange,
85 simplify as simplifyRange,
86};
87
88// classes
89import SemVer = require("./classes/semver");
90import Range = require("./classes/range");
91import Comparator = require("./classes/comparator");
92
93export { Comparator, Range, SemVer };
94
95// internals
96import identifiers = require("./internals/identifiers");
97export import compareIdentifiers = identifiers.compareIdentifiers;
98export import rcompareIdentifiers = identifiers.rcompareIdentifiers;
99
100export const SEMVER_SPEC_VERSION: "2.0.0";
101
102export const RELEASE_TYPES: ReleaseType[];
103
104export type ReleaseType = "major" | "premajor" | "minor" | "preminor" | "patch" | "prepatch" | "prerelease";
105
106export interface Options {
107 loose?: boolean | undefined;
108}
109
110export interface RangeOptions extends Options {
111 includePrerelease?: boolean | undefined;
112}
113export interface CoerceOptions extends Options {
114 includePrerelease?: boolean | undefined;
115 /**
116 * Used by `coerce()` to coerce from right to left.
117 *
118 * @default false
119 *
120 * @example
121 * coerce('1.2.3.4', { rtl: true });
122 * // => SemVer { version: '2.3.4', ... }
123 *
124 * @since 6.2.0
125 */
126 rtl?: boolean | undefined;
127}
128
129export type Operator = "===" | "!==" | "" | "=" | "==" | "!=" | ">" | ">=" | "<" | "<=";