function $parcel$export(e, n, v, s) { Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true}); } $parcel$export(module.exports, "Version", () => $7491059d3a8d9eaa$export$2e2bcd8739ae039); $parcel$export(module.exports, "VersionReq", () => $5e4ee6efe2050195$export$2e2bcd8739ae039); $parcel$export(module.exports, "Comparator", () => $5e4ee6efe2050195$export$d65d8a753c16d7cb); //! A parser and evaluator for Cargo's flavor of Semantic Versioning. //! //! Semantic Versioning (see ) is a guideline for how //! version numbers are assigned and incremented. It is widely followed within //! the Cargo/crates.io ecosystem for Rust. //! //!
//! //! # Example //! //! ``` //! use semver::{BuildMetadata, Prerelease, Version, VersionReq}; //! //! fn main() { //! let req = VersionReq::parse(">=1.2.3, <1.8.0").unwrap(); //! //! // Check whether this requirement matches version 1.2.3-alpha.1 (no) //! let version = Version { //! major: 1, //! minor: 2, //! patch: 3, //! pre: Prerelease::new("alpha.1").unwrap(), //! build: BuildMetadata::EMPTY, //! }; //! assert!(!req.matches(&version)); //! //! // Check whether it matches 1.3.0 (yes it does) //! let version = Version::parse("1.3.0").unwrap(); //! assert!(req.matches(&version)); //! } //! ``` //! //!

//! //! # Scope of this crate //! //! Besides Cargo, several other package ecosystems and package managers for //! other languages also use SemVer: RubyGems/Bundler for Ruby, npm for //! JavaScript, Composer for PHP, CocoaPods for Objective-C... //! //! The `semver` crate is specifically intended to implement Cargo's //! interpretation of Semantic Versioning. //! //! Where the various tools differ in their interpretation or implementation of //! the spec, this crate follows the implementation choices made by Cargo. If //! you are operating on version numbers from some other package ecosystem, you //! will want to use a different semver library which is appropriate to that //! ecosystem. //! //! The extent of Cargo's SemVer support is documented in the *[Specifying //! Dependencies]* chapter of the Cargo reference. //! //! [Specifying Dependencies]: https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html // pub(crate) enum ErrorKind { // UnexpectedEnd(Position), // UnexpectedChar(Position, char), // UnexpectedCharAfter(Position, char), // ExpectedCommaFound(Position, char), // LeadingZero(Position), // Overflow(Position), // EmptySegment(Position), // IllegalCharacter(Position), // WildcardNotTheOnlyComparator(char), // UnexpectedAfterWildcard, // ExcessiveComparators, // } let $6c7590f398b00fb4$export$13807d9ee5a34a42; (function(Position) { Position["Major"] = "major version number"; Position["Minor"] = "minor version number"; Position["Patch"] = "patch version number"; Position["Pre"] = "pre-release identifier"; Position["Build"] = "build metadata"; })($6c7590f398b00fb4$export$13807d9ee5a34a42 || ($6c7590f398b00fb4$export$13807d9ee5a34a42 = {})); class $6c7590f398b00fb4$export$dfe51817e485aa7f extends Error { constructor(pos){ const message = `unexpected end of input while parsing ${pos}`; super(message); this.name = "UnexpectedEndError"; this.pos = pos; } } class $6c7590f398b00fb4$export$847ca5855b398a32 extends Error { constructor(pos, char){ const message = `unexpected character ${$6c7590f398b00fb4$var$quoted(char)} while parsing ${pos}`; super(message); this.name = "UnexpectedChar"; this.pos = pos; this.char = char; } } class $6c7590f398b00fb4$export$e578fef1af88498c extends Error { constructor(pos, char){ const message = `unexpected character ${$6c7590f398b00fb4$var$quoted(char)} after ${pos}`; super(message); this.name = "UnexpectedCharAfterError"; this.pos = pos; this.char = char; } } class $6c7590f398b00fb4$export$71028edb9ccacccb extends Error { constructor(pos, char){ const message = `expected comma after ${pos}, found ${$6c7590f398b00fb4$var$quoted(char)}`; super(message); this.name = "ExpectedCommaFoundError"; this.pos = pos; this.char = char; } } class $6c7590f398b00fb4$export$2059433264444ee4 extends Error { constructor(pos){ const message = `invalid leading zero in ${pos}`; super(message); this.name = "LeadingZeroError"; this.pos = pos; } } class $6c7590f398b00fb4$export$a9e6eeb22c7a9b30 extends Error { constructor(pos){ const message = `empty identifier segment in ${pos}`; super(message); this.name = "EmptySegmentError"; this.pos = pos; } } class $6c7590f398b00fb4$export$4de61106e517bcca extends Error { constructor(char){ const message = `wildcard req (${char}) must be the only comparator in the version req`; super(message); this.name = "WildcardNotTheOnlyComparatorError"; this.char = char; } } class $6c7590f398b00fb4$export$8b818e37e99fb16 extends Error { constructor(){ const message = `unexpected character after wildcard in version req`; super(message); this.name = "UnexpectedAfterWildcardError"; } } class $6c7590f398b00fb4$export$514ca6013f6e5c09 extends Error { constructor(){ const message = `excessive number of version comparators`; super(message); this.name = "ExcessiveComparatorsError"; } } function $6c7590f398b00fb4$var$quoted(text) { return text === "\0" ? "'\\0'" : `'${text}'`; } function $d38ddd247dfd773e$export$d6100eeab699a28a(v) { let output = `${v.major}.${v.minor}.${v.patch}`; if (v.pre) output += `-${v.pre}`; if (v.build) output += `+${v.build}`; return output; } function $d38ddd247dfd773e$export$761697451b63c8b9(r) { if (r.comparators.length === 0) return "*"; return r.comparators.map((c)=>$d38ddd247dfd773e$export$30c849d3a1409d26(c)).join(", "); } function $d38ddd247dfd773e$export$30c849d3a1409d26(c) { const op = c.op === "Exact" ? "=" : c.op === "Greater" ? ">" : c.op === "GreaterEq" ? ">=" : c.op === "Less" ? "<" : c.op === "LessEq" ? "<=" : c.op === "Tilde" ? "~" : c.op === "Caret" ? "^" : ""; let output = `${op}${c.major}`; if (c.minor !== null) { output += `.${c.minor}`; if (c.patch !== null) { output += `.${c.patch}`; if (c.pre) output += `-${c.pre}`; } else if (c.op == "Wildcard") output += ".*"; } else if (c.op == "Wildcard") output += ".*"; return output; } function $eeae81bc62dc1a09$export$c3e16f1b0680fa05(a, b) { if (a === "" && b === "") return 0; if (a === "") return 1; if (b === "") return -1; const aParts = a.split("."); const bParts = b.split("."); for(let i = 0; i < aParts.length; i++){ const aPart = aParts[i]; const bPart = bParts[i]; // Spec: "A larger set of pre-release fields has a higher // precedence than a smaller set, if all of the preceding // identifiers are equal." if (!bPart) return 1; const aAllDigits = /^\d$/.test(aPart); const bAllDigits = /^\d$/.test(bPart); if (aAllDigits && !bAllDigits) return -1; if (!aAllDigits && bAllDigits) return 1; if (aAllDigits && bAllDigits) { const aLen = aPart.length; const bLen = bPart.length; if (aLen > bLen) return 1; if (aLen < bLen) return -1; } const stringOrder = aPart.localeCompare(bPart); if (stringOrder !== 0) return stringOrder; } if (aParts.length < bParts.length) return -1; else return 0; } function $eeae81bc62dc1a09$export$dac2088976fb7050(a, b) { if (a === "" && b === "") return 0; if (a === "") return 1; if (b === "") return -1; const aParts = a.split("."); const bParts = b.split("."); for(let i = 0; i < aParts.length; i++){ const aPart = aParts[i]; const bPart = bParts[i]; // Spec: "A larger set of pre-release fields has a higher // precedence than a smaller set, if all of the preceding // identifiers are equal." if (!bPart) return 1; const aAllDigits = /^\d$/.test(aPart); const bAllDigits = /^\d$/.test(bPart); if (aAllDigits && !bAllDigits) return -1; if (!aAllDigits && bAllDigits) return 1; if (aAllDigits && bAllDigits) { const aTrimmed = aPart.replace(/^0+/, ""); const bTrimmed = bPart.replace(/^0+/, ""); const aTrimmedLen = aTrimmed.length; const bTrimmedLen = bTrimmed.length; if (aTrimmedLen > bTrimmedLen) return 1; if (aTrimmedLen < bTrimmedLen) return -1; const stringOrder = aTrimmed.localeCompare(bTrimmed); if (stringOrder !== 0) return stringOrder; const aLen = aPart.length; const bLen = bPart.length; if (aLen > bLen) return 1; if (aLen < bLen) return -1; } const stringOrder = aPart.localeCompare(bPart); if (stringOrder !== 0) return stringOrder; } if (aParts.length < bParts.length) return -1; else return 0; } function $988cf136fcabf3a3$export$336a5777f1ed8e9b(req, ver) { for (const cmp of req.comparators){ if (!$988cf136fcabf3a3$var$matches_impl(cmp, ver)) return false; } if (!ver.pre) return true; // If a version has a prerelease tag (for example, 1.2.3-alpha.3) then it // will only be allowed to satisfy req if at least one comparator with the // same major.minor.patch also has a prerelease tag. for (const cmp of req.comparators){ if ($988cf136fcabf3a3$var$pre_is_compatible(cmp, ver)) return true; } return false; } function $988cf136fcabf3a3$export$f0938a04d5c27569(cmp, ver) { return $988cf136fcabf3a3$var$matches_impl(cmp, ver) && (ver.pre === "" || $988cf136fcabf3a3$var$pre_is_compatible(cmp, ver)); } function $988cf136fcabf3a3$var$matches_impl(cmp, ver) { return cmp.op === "Exact" || cmp.op === "Wildcard" ? $988cf136fcabf3a3$var$matches_exact(cmp, ver) : cmp.op === "Greater" ? $988cf136fcabf3a3$var$matches_greater(cmp, ver) : cmp.op === "GreaterEq" ? $988cf136fcabf3a3$var$matches_exact(cmp, ver) || $988cf136fcabf3a3$var$matches_greater(cmp, ver) : cmp.op === "Less" ? $988cf136fcabf3a3$var$matches_less(cmp, ver) : cmp.op === "LessEq" ? $988cf136fcabf3a3$var$matches_exact(cmp, ver) || $988cf136fcabf3a3$var$matches_less(cmp, ver) : cmp.op === "Tilde" ? $988cf136fcabf3a3$var$matches_tilde(cmp, ver) : cmp.op === "Caret" ? $988cf136fcabf3a3$var$matches_caret(cmp, ver) : false; } function $988cf136fcabf3a3$var$matches_exact(cmp, ver) { if (ver.major !== cmp.major) return false; if (cmp.minor !== null) { if (ver.minor !== cmp.minor) return false; } if (cmp.patch !== null) { if (ver.patch !== cmp.patch) return false; } return (0, $eeae81bc62dc1a09$export$c3e16f1b0680fa05)(ver.pre, cmp.pre) === 0; } function $988cf136fcabf3a3$var$matches_greater(cmp, ver) { if (ver.major !== cmp.major) return ver.major > cmp.major; if (cmp.minor === null) return false; if (ver.minor !== cmp.minor) return ver.minor > cmp.minor; if (cmp.patch === null) return false; if (ver.patch !== cmp.patch) return ver.patch > cmp.patch; return (0, $eeae81bc62dc1a09$export$c3e16f1b0680fa05)(ver.pre, cmp.pre) > 0; } function $988cf136fcabf3a3$var$matches_less(cmp, ver) { if (ver.major !== cmp.major) return ver.major < cmp.major; if (cmp.minor === null) return false; if (ver.minor !== cmp.minor) return ver.minor < cmp.minor; if (cmp.patch === null) return false; if (ver.patch !== cmp.patch) return ver.patch < cmp.patch; return (0, $eeae81bc62dc1a09$export$c3e16f1b0680fa05)(ver.pre, cmp.pre) < 0; } function $988cf136fcabf3a3$var$matches_tilde(cmp, ver) { if (ver.major !== cmp.major) return false; if (cmp.minor !== null && ver.minor !== cmp.minor) return false; if (cmp.patch !== null && ver.patch !== cmp.patch) return ver.patch > cmp.patch; return (0, $eeae81bc62dc1a09$export$c3e16f1b0680fa05)(ver.pre, cmp.pre) >= 0; } function $988cf136fcabf3a3$var$matches_caret(cmp, ver) { if (ver.major !== cmp.major) return false; if (cmp.minor === null) return true; if (cmp.patch === null) { if (cmp.major > 0) return ver.minor >= cmp.minor; else return ver.minor === cmp.minor; } if (cmp.major > 0) { if (ver.minor !== cmp.minor) return ver.minor > cmp.minor; else if (ver.patch !== cmp.patch) return ver.patch > cmp.patch; } else if (cmp.minor > 0) { if (ver.minor !== cmp.minor) return false; else if (ver.patch !== cmp.patch) return ver.patch > cmp.patch; } else if (ver.minor !== cmp.minor || ver.patch != cmp.patch) return false; return (0, $eeae81bc62dc1a09$export$c3e16f1b0680fa05)(ver.pre, cmp.pre) >= 0; } function $988cf136fcabf3a3$var$pre_is_compatible(cmp, ver) { return cmp.major === ver.major && cmp.minor === ver.minor && cmp.patch === ver.patch && cmp.pre !== ""; } class $5e4ee6efe2050195$export$2e2bcd8739ae039 { /** * A `VersionReq` with no constraint on the version numbers it matches. * Equivalent to `VersionReq::parse("*").unwrap()`. * * In terms of comparators this is equivalent to `>=0.0.0`. * * Counterintuitively a `*` VersionReq does not match every possible * version number. In particular, in order for *any* `VersionReq` to match * a pre-release version, the `VersionReq` must contain at least one * `Comparator` that has an explicit major, minor, and patch version * identical to the pre-release being matched, and that has a nonempty * pre-release component. Since `*` is not written with an explicit major, * minor, and patch version, and does not contain a nonempty pre-release * component, it does not match any pre-release versions. */ static STAR = new $5e4ee6efe2050195$export$2e2bcd8739ae039([]); constructor(comparators){ this.comparators = comparators; } /** * Create `VersionReq` by parsing from string representation. * * # Errors * * Possible reasons for the parse to fail include: * * - `>a.b` — unexpected characters in the partial version. * * - `@1.0.0` — unrecognized comparison operator. * * - `^1.0.0, ` — unexpected end of input. * * - `>=1.0 <2.0` — missing comma between comparators. * * - `*.*` — unsupported wildcard syntax. */ static parse(text) { return (0, $5e471daa26bff96a$export$bdf9ed29192f5aa8)(text); } toString() { return (0, $d38ddd247dfd773e$export$761697451b63c8b9)(this); } /** * Evaluate whether the given `Version` satisfies the version requirement. */ matches(version) { return (0, $988cf136fcabf3a3$export$336a5777f1ed8e9b)(this, version); } } class $5e4ee6efe2050195$export$d65d8a753c16d7cb { constructor(op, major, minor = null, patch = null, pre = ""){ this.op = op; this.major = major; this.minor = minor; this.patch = patch; this.pre = pre; } static parse(text) { return (0, $5e471daa26bff96a$export$8ce4b650eccb2ff5)(text); } toString() { return (0, $d38ddd247dfd773e$export$30c849d3a1409d26)(this); } matches(version) { return (0, $988cf136fcabf3a3$export$f0938a04d5c27569)(this, version); } } function $5e471daa26bff96a$export$a917901ae87f6d9(text) { let major, minor, patch; [major, text] = $5e471daa26bff96a$var$numeric_identifier(text, (0, $6c7590f398b00fb4$export$13807d9ee5a34a42).Major); text = $5e471daa26bff96a$var$dot(text, (0, $6c7590f398b00fb4$export$13807d9ee5a34a42).Major); [minor, text] = $5e471daa26bff96a$var$numeric_identifier(text, (0, $6c7590f398b00fb4$export$13807d9ee5a34a42).Minor); text = $5e471daa26bff96a$var$dot(text, (0, $6c7590f398b00fb4$export$13807d9ee5a34a42).Minor); [patch, text] = $5e471daa26bff96a$var$numeric_identifier(text, (0, $6c7590f398b00fb4$export$13807d9ee5a34a42).Patch); if (text === "") return new (0, $7491059d3a8d9eaa$export$2e2bcd8739ae039)(major, minor, patch); let pre = ""; if (text[0] === "-") { [pre, text] = $5e471daa26bff96a$var$identifier(text.slice(1), (0, $6c7590f398b00fb4$export$13807d9ee5a34a42).Pre); if (pre === "") throw new (0, $6c7590f398b00fb4$export$a9e6eeb22c7a9b30)((0, $6c7590f398b00fb4$export$13807d9ee5a34a42).Pre); } let build = ""; if (text[0] === "+") { [build, text] = $5e471daa26bff96a$var$identifier(text.slice(1), (0, $6c7590f398b00fb4$export$13807d9ee5a34a42).Build); if (build === "") throw new (0, $6c7590f398b00fb4$export$a9e6eeb22c7a9b30)((0, $6c7590f398b00fb4$export$13807d9ee5a34a42).Build); } if (text !== "") { let pos; if (build) pos = (0, $6c7590f398b00fb4$export$13807d9ee5a34a42).Build; else if (pre) pos = (0, $6c7590f398b00fb4$export$13807d9ee5a34a42).Pre; else pos = (0, $6c7590f398b00fb4$export$13807d9ee5a34a42).Patch; throw new (0, $6c7590f398b00fb4$export$e578fef1af88498c)(pos, text[0]); } return new (0, $7491059d3a8d9eaa$export$2e2bcd8739ae039)(major, minor, patch, pre, build); } function $5e471daa26bff96a$export$bdf9ed29192f5aa8(text) { text = text.replace(/^ +/, ""); const wc = $5e471daa26bff96a$var$wildcard(text); if (wc) { const rest = wc[1].replace(/^ +/, ""); if (rest === "") return (0, $5e4ee6efe2050195$export$2e2bcd8739ae039).STAR; else if (rest[0] === ",") throw new (0, $6c7590f398b00fb4$export$4de61106e517bcca)(wc[0]); else throw new (0, $6c7590f398b00fb4$export$8b818e37e99fb16)(); } const depth = 0; const comparators = []; $5e471daa26bff96a$var$version_req(text, comparators, depth); return new (0, $5e4ee6efe2050195$export$2e2bcd8739ae039)(comparators); } function $5e471daa26bff96a$export$8ce4b650eccb2ff5(text) { text = text.replace(/^ +/, ""); const [comp, pos, rest] = $5e471daa26bff96a$var$comparator(text); if (rest !== "") throw new (0, $6c7590f398b00fb4$export$e578fef1af88498c)(pos, rest[0]); return comp; } function $5e471daa26bff96a$var$numeric_identifier(input, pos) { const ZERO = "0".charCodeAt(0); const NINE = "9".charCodeAt(0); let len = 0; let value = 0; let digit; while(digit = input.charCodeAt(len)){ if (digit < ZERO || digit > NINE) break; if (value == 0 && len > 0) throw new (0, $6c7590f398b00fb4$export$2059433264444ee4)(pos); value = value * 10 + (digit - ZERO); len += 1; } if (len > 0) return [ value, input.slice(len) ]; else if (input !== "") throw new (0, $6c7590f398b00fb4$export$847ca5855b398a32)(pos, input.slice(len, len + 1)); else throw new (0, $6c7590f398b00fb4$export$dfe51817e485aa7f)(pos); } function $5e471daa26bff96a$var$wildcard(input) { const next = input[0]; return next === "*" || next === "x" || next === "X" ? [ next, input.slice(1) ] : null; } function $5e471daa26bff96a$var$dot(input, pos) { const next = input[0]; if (next === ".") return input.slice(1); else if (next === undefined) throw new (0, $6c7590f398b00fb4$export$dfe51817e485aa7f)(pos); else throw new (0, $6c7590f398b00fb4$export$e578fef1af88498c)(pos, next); } function $5e471daa26bff96a$var$identifier(input, pos) { let accumulated_len = 0; let segment_len = 0; let segment_has_nondigit = false; // eslint-disable-next-line no-constant-condition while(true){ const char = input.charCodeAt(accumulated_len + segment_len); if (char >= "A".charCodeAt(0) && char <= "Z".charCodeAt(0) || char >= "a".charCodeAt(0) && char <= "z".charCodeAt(0) || char === "-".charCodeAt(0)) { segment_len += 1; segment_has_nondigit = true; } else if (char >= "0".charCodeAt(0) && char <= "9".charCodeAt(0)) segment_len += 1; else { if (segment_len == 0) { if (accumulated_len === 0 && char !== ".".charCodeAt(0)) return [ "", input ]; else throw new (0, $6c7590f398b00fb4$export$a9e6eeb22c7a9b30)(pos); } if (pos == (0, $6c7590f398b00fb4$export$13807d9ee5a34a42).Pre && segment_len > 1 && !segment_has_nondigit && input[accumulated_len] === "0") throw new (0, $6c7590f398b00fb4$export$2059433264444ee4)(pos); accumulated_len += segment_len; if (char === ".".charCodeAt(0)) { accumulated_len += 1; segment_len = 0; segment_has_nondigit = false; } else return [ input.slice(0, accumulated_len), input.slice(accumulated_len) ]; } } } function $5e471daa26bff96a$var$op_(input) { const ch1 = input[0]; const ch2 = input[1]; if (ch1 === "=") return [ "Exact", input.slice(1) ]; else if (ch1 === ">") { if (ch2 === "=") return [ "GreaterEq", input.slice(2) ]; else return [ "Greater", input.slice(1) ]; } else if (ch1 === "<") { if (ch2 === "=") return [ "LessEq", input.slice(2) ]; else return [ "Less", input.slice(1) ]; } else if (ch1 === "~") return [ "Tilde", input.slice(1) ]; else if (ch1 === "^") return [ "Caret", input.slice(1) ]; else return [ "Caret", input ]; } function $5e471daa26bff96a$var$comparator(input) { let [op, text] = $5e471daa26bff96a$var$op_(input); const isDefaultOp = input.length == text.length; text = text.replace(/^ +/, ""); let major; let pos = (0, $6c7590f398b00fb4$export$13807d9ee5a34a42).Major; // eslint-disable-next-line prefer-const [major, text] = $5e471daa26bff96a$var$numeric_identifier(text, pos); let hasWildcard = false; let minor = null; if (text[0] === ".") { text = text.slice(1); pos = (0, $6c7590f398b00fb4$export$13807d9ee5a34a42).Minor; const wc = $5e471daa26bff96a$var$wildcard(text); if (wc) { hasWildcard = true; if (isDefaultOp) op = "Wildcard"; text = wc[1]; } else [minor, text] = $5e471daa26bff96a$var$numeric_identifier(text, pos); } let patch = null; if (text[0] === ".") { text = text.slice(1); pos = (0, $6c7590f398b00fb4$export$13807d9ee5a34a42).Patch; const wc = $5e471daa26bff96a$var$wildcard(text); if (wc) { if (isDefaultOp) op = "Wildcard"; text = wc[1]; } else if (hasWildcard) throw new (0, $6c7590f398b00fb4$export$8b818e37e99fb16)(); else [patch, text] = $5e471daa26bff96a$var$numeric_identifier(text, pos); } let pre = ""; if (patch !== null && text[0] === "-") { pos = (0, $6c7590f398b00fb4$export$13807d9ee5a34a42).Pre; text = text.slice(1); [pre, text] = $5e471daa26bff96a$var$identifier(text, pos); if (pre === "") throw new (0, $6c7590f398b00fb4$export$a9e6eeb22c7a9b30)(pos); } let build = ""; if (patch !== null && text[0] === "+") { pos = (0, $6c7590f398b00fb4$export$13807d9ee5a34a42).Build; text = text.slice(1); [build, text] = $5e471daa26bff96a$var$identifier(text, pos); if (build === "") throw new (0, $6c7590f398b00fb4$export$a9e6eeb22c7a9b30)(pos); } text = text.replace(/^ +/, ""); const comparator = new (0, $5e4ee6efe2050195$export$d65d8a753c16d7cb)(op, major, minor, patch, pre); return [ comparator, pos, text ]; } function $5e471daa26bff96a$var$version_req(input, out, depth) { let comp, pos, text; try { [comp, pos, text] = $5e471daa26bff96a$var$comparator(input); } catch (error) { const wc = $5e471daa26bff96a$var$wildcard(input); if (wc) { const rest = wc[1].replace(/^ +/, ""); if (rest === "" || rest[0] === ",") throw new (0, $6c7590f398b00fb4$export$4de61106e517bcca)(wc[0]); } throw error; } if (text === "") { out.push(comp); return depth + 1; } if (text[0] !== ",") { const unexpected = text[0]; throw new (0, $6c7590f398b00fb4$export$71028edb9ccacccb)(pos, unexpected); } text = text.replace(/^, */, ""); const MAX_COMPARATORS = 32; if (depth + 1 == MAX_COMPARATORS) throw new (0, $6c7590f398b00fb4$export$514ca6013f6e5c09)(); out.push(comp); return $5e471daa26bff96a$var$version_req(text, out, depth + 1); } class $7491059d3a8d9eaa$export$2e2bcd8739ae039 { constructor(major, minor, patch, pre = "", build = ""){ this.major = major; this.minor = minor; this.patch = patch; this.pre = pre; this.build = build; } /** * Create `Version` by parsing from string representation. * * # Errors * * Possible reasons for the parse to fail include: * * - `1.0` — too few numeric components. A SemVer version must have * exactly three. If you are looking at something that has fewer than * three numbers in it, it's possible it is a `VersionReq` instead (with * an implicit default `^` comparison operator). * * - `1.0.01` — a numeric component has a leading zero. * * - `1.0.unknown` — unexpected character in one of the components. * * - `1.0.0-` or `1.0.0+` — the pre-release or build metadata are * indicated present but empty. * * - `1.0.0-alpha_123` — pre-release or build metadata have something * outside the allowed characters, which are `0-9`, `A-Z`, `a-z`, `-`, * and `.` (dot). * * - `23456789999999999999.0.0` — overflow of a u64. */ static parse(text) { return (0, $5e471daa26bff96a$export$a917901ae87f6d9)(text); } toString() { return (0, $d38ddd247dfd773e$export$d6100eeab699a28a)(this); } compare(other) { if (this.major > other.major) return 1; if (this.major < other.major) return -1; if (this.minor > other.minor) return 1; if (this.minor < other.minor) return -1; if (this.patch > other.patch) return 1; if (this.patch < other.patch) return -1; const preCompare = (0, $eeae81bc62dc1a09$export$c3e16f1b0680fa05)(this.pre, other.pre); if (preCompare !== 0) return preCompare; return (0, $eeae81bc62dc1a09$export$dac2088976fb7050)(this.build, other.build); } eq(other) { return this.compare(other) === 0; } lt(other) { return this.compare(other) < 0; } lte(other) { return this.compare(other) <= 0; } gt(other) { return this.compare(other) > 0; } gte(other) { return this.compare(other) >= 0; } } // //# sourceMappingURL=semver.cjs.map