@vltpkg/semver 1.0.0-rc.2 → 1.0.0-rc.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +35 -46
- package/dist/esm/comparator.d.ts +0 -76
- package/dist/esm/comparator.d.ts.map +0 -1
- package/dist/esm/comparator.js +0 -514
- package/dist/esm/comparator.js.map +0 -1
- package/dist/esm/index.d.ts +0 -204
- package/dist/esm/index.d.ts.map +0 -1
- package/dist/esm/index.js +0 -458
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/package.json +0 -3
- package/dist/esm/range.d.ts +0 -35
- package/dist/esm/range.d.ts.map +0 -1
- package/dist/esm/range.js +0 -102
- package/dist/esm/range.js.map +0 -1
- package/dist/esm/version.d.ts +0 -132
- package/dist/esm/version.d.ts.map +0 -1
- package/dist/esm/version.js +0 -367
- package/dist/esm/version.js.map +0 -1
package/dist/esm/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAGtC,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAEjD,cAAc,iBAAiB,CAAA;AAC/B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAE5B,kEAAkE;AAClE,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,OAAyB,EAAE,EAAE;IACjD,IAAI,OAAO,YAAY,OAAO;QAAE,OAAO,OAAO,CAAA;IAC9C,IAAI,CAAC;QACH,OAAO,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;IAC/B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAA;IAClB,CAAC;AACH,CAAC,CAAA;AAED,iEAAiE;AACjE,MAAM,CAAC,MAAM,UAA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CAAA;IACb,CAAC;IAED,4DAA4D;IAC5D,IAAI,UAAU,IAAI,UAAU,EAAE,CAAC;QAC7B,IAAI,EAAE,CAAC,UAAU,EAAE,UAAU,CAAC;YAAE,OAAO,KAAK,CAAA;QAC5C,IACE,EAAE,CAAC,UAAU,EAAE,UAAU,CAAC;YAC1B,CAAC,CAAC,cAAc,IAAI,cAAc,CAAC;YAEnC,OAAO,KAAK,CAAA;IAChB,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC,CAAA","sourcesContent":["import { Range } from './range.ts'\nimport { Version } from './version.ts'\nimport type { Comparator, OVTuple } from './comparator.ts'\nimport type { IncrementType } from './version.ts'\nimport { syntaxError } from '@vltpkg/error-cause'\n\nexport * from './comparator.ts'\nexport * from './range.ts'\nexport * from './version.ts'\n\n/** Return the parsed version string, or `undefined` if invalid */\nexport const parse = (version: Version | string) => {\n if (version instanceof Version) return version\n try {\n return Version.parse(version)\n } catch {\n return undefined\n }\n}\n\n/** Return the parsed version range, or `undefined` if invalid */\nexport const parseRange = (\n range: Range | string,\n includePrerelease = false,\n) => {\n if (typeof range === 'object') {\n if (range.includePrerelease === includePrerelease) return range\n range = range.raw\n }\n try {\n return new Range(range, includePrerelease)\n } catch {\n return undefined\n }\n}\n\n/**\n * return true if the version is valid\n *\n * Note: do not use this if you intend to immediately parse the version if it's\n * valid. Just use {@link parse}, and guard the possible undefined value, or\n * use `Version.parse(..)` to throw on invalid values.\n */\nexport const valid = (version: Version | string) => !!parse(version)\n\n/**\n * return true if the range is valid\n *\n * Note: do not use this if you intend to immediately parse the range if it's\n * valid. Just use {@link parseRange}, and guard the possible undefined value,\n * or use `new Range(..)` to throw on invalid values.\n */\nexport const validRange = (range: Range | string) =>\n !!parseRange(range)\n\n/**\n * Return true if the version satisfies the range.\n */\nexport const satisfies = (\n version: Version | string,\n range: Range | string,\n includePrerelease = false,\n) => {\n if (typeof version === 'string') {\n const parsed = parse(version)\n if (!parsed) return false\n version = parsed\n }\n if (typeof range === 'string') {\n const parsed = parseRange(range, includePrerelease)\n if (!parsed) return false\n range = parsed\n }\n return version.satisfies(range)\n}\n\n/**\n * Increment the specified part of the version, and return the resulting\n * object. If a Version object is provided, it will be modified in-place.\n *\n * See {@link Version.inc} for full description.\n */\nexport const inc = (\n version: Version | string,\n part: IncrementType,\n prereleaseIdentifier?: string,\n) =>\n (typeof version === 'string' ?\n Version.parse(version)\n : version\n ).inc(part, prereleaseIdentifier)\n\n/**\n * The method used by {@link sort}, exported for passing directly to\n * `Array.sort`.\n *\n * Usage:\n *\n * ```ts\n * import { sortMethod } from '@vltpkg/semver'\n * const versions = ['1.2.3', '5.2.3', '2.3.4']\n * console.log(versions.sort(sortMethod))\n * // ['1.2.3', '2.3.4', '5.2.3']\n * ```\n */\nexport const sortMethod = (\n a: Version | string,\n b: Version | string,\n) => {\n const pa = parse(a)\n const pb = parse(b)\n /* c8 ignore start - nondeterministic */\n if (!pa && !pb) return String(a).localeCompare(String(b), 'en')\n if (!pa) return 1\n if (!pb) return -1\n /* c8 ignore stop */\n return pa.compare(pb)\n}\n\n/**\n * Sort an array of version strings or objects in ascending SemVer precedence\n * order (ie, lowest versions first).\n *\n * Invalid version strings are sorted to the end of the array in ascending\n * alphabetical order.\n *\n * Note: when using this method, the list is cloned prior to sorting, to\n * prevent surprising mutation. To sort the list in place, see\n * {@link sortMethod}.\n */\nexport const sort = <T extends Version | string = Version | string>(\n list: T[],\n): T[] => list.slice().sort(sortMethod)\n\n/**\n * Sort an array of version strings or objects in descending SemVer\n * precedence order (ie, highest versions first).\n *\n * Invalid version strings are sorted to the end of the array in ascending\n * alphabetical order.\n *\n * Note: when using this method, the list is cloned prior to sorting, to\n * prevent surprising mutation. To sort the list in place, see\n * {@link rsortMethod}.\n */\nexport const rsort = <T extends Version | string = Version | string>(\n list: T[],\n): T[] => list.slice().sort(rsortMethod)\n\n/**\n * The method used by {@link rsort}, exported for passing directly to\n * `Array.sort`.\n *\n * Usage:\n *\n * ```ts\n * import { rsortMethod } from '@vltpkg/semver'\n * const versions = ['1.2.3', '5.2.3', '2.3.4']\n * console.log(versions.sort(rsortMethod))\n * // ['5.2.3', '2.3.4', '1.2.3']\n * ```\n */\nexport const rsortMethod = (\n a: Version | string,\n b: Version | string,\n) => {\n const pa = parse(a)\n const pb = parse(b)\n /* c8 ignore start - nondeterministic */\n if (!pa && !pb) return String(a).localeCompare(String(b), 'en')\n if (!pa) return 1\n if (!pb) return -1\n /* c8 ignore stop */\n return pa.rcompare(pb)\n}\n\n/**\n * Method used by {@link filter}, for use in `Array.filter` directly.\n *\n * Usage:\n *\n * ```ts\n * import { filterMethod } from '@vltpkg/semver'\n * const versions = ['1.2.3', '5.2.3', '2.3.4']\n * console.log(versions.filter(filterMethod('>=2.x')))\n * // ['5.2.3', '2.3.4']\n * ```\n */\nexport const filterMethod = (\n range: Range | string,\n includePrerelease = false,\n): ((version: Version | string) => boolean) => {\n const r = parseRange(range, includePrerelease)\n return !r ?\n () => false\n : version => satisfies(version, r, r.includePrerelease)\n}\n\n/**\n * Filter a list of versions to find all that match a given range.\n */\nexport const filter = <T extends Version | string = Version | string>(\n list: T[],\n range: Range | string,\n includePrerelease = false,\n): T[] => list.filter(filterMethod(range, includePrerelease))\n\n/**\n * Find the highest-precedence match for a range within a list of versions\n *\n * Returns `undefined` if no match was found.\n */\nexport const highest = (\n list: (Version | string)[],\n range: Range | string,\n includePrerelease = false,\n): Version | undefined => {\n const r = parseRange(range, includePrerelease)\n if (!r) return undefined\n let max: Version | undefined = undefined\n for (const v of list) {\n const version = parse(v)\n if (!version) continue\n if (!version.satisfies(r)) continue\n if (!max) max = version\n else if (version.greaterThan(max)) max = version\n }\n return max\n}\n\n/**\n * Faster form of {@link highest}, for use when the list is sorted\n * in precedence order (lower-precedence versions first).\n *\n * Note: This stops at the first match, and will produce incorrect results\n * when the list is not properly sorted!\n */\nexport const sortedHighest = (\n list: (Version | string)[],\n range: Range | string,\n includePrerelease = false,\n): Version | undefined => {\n const r = parseRange(range, includePrerelease)\n if (!r) return undefined\n for (let i = list.length - 1; i >= 0; i--) {\n const v = list[i]\n /* c8 ignore next */\n if (!v) continue\n const version = parse(v)\n if (!version) continue\n if (!version.satisfies(r)) continue\n return version\n }\n}\n\n/**\n * Faster form of {@link highest}, for use when the list is sorted\n * in reverse precedence order (higher-precedence versions first).\n *\n * Note: This stops at the first match, and will produce incorrect results\n * when the list is not properly sorted!\n */\nexport const rsortedHighest = (\n list: (Version | string)[],\n range: Range | string,\n includePrerelease = false,\n): Version | undefined => {\n const r = parseRange(range, includePrerelease)\n if (!r) return undefined\n for (const v of list) {\n const version = parse(v)\n if (!version) continue\n if (!version.satisfies(r)) continue\n return version\n }\n}\n\n/**\n * Find the lowest-precedence match for a range within a list of versions\n *\n * Returns `undefined` if no match was found.\n */\nexport const lowest = (\n list: (Version | string)[],\n range: Range | string,\n includePrerelease = false,\n): Version | undefined => {\n const r = parseRange(range, includePrerelease)\n if (!r) return undefined\n let min: Version | undefined = undefined\n for (const v of list) {\n const version = parse(v)\n if (!version) continue\n if (!version.satisfies(r)) continue\n if (!min) min = version\n else if (version.lessThan(min)) min = version\n }\n return min\n}\n\n/**\n * Faster form of {@link lowest}, for use when the list is sorted\n * in precedence order (lower-precedence versions first).\n *\n * Note: This stops at the first match, and will produce incorrect results\n * when the list is not properly sorted!\n */\nexport const sortedLowest = (\n list: (Version | string)[],\n range: Range | string,\n includePrerelease = false,\n): Version | undefined =>\n rsortedHighest(list, range, includePrerelease)\n\n/**\n * Faster form of {@link lowest}, for use when the list is sorted\n * in reverse precedence order (higher-precedence versions first).\n *\n * Note: This stops at the first match, and will produce incorrect results\n * when the list is not properly sorted!\n */\nexport const rsortedLowest = (\n list: (Version | string)[],\n range: Range | string,\n includePrerelease = false,\n): Version | undefined =>\n sortedHighest(list, range, includePrerelease)\n\n/**\n * Same as {@link sortMethod}, but throws if either version is not valid.\n * 1 if versionA is higher precedence than versionB\n * -1 if versionA is lower precedence than versionB\n * 0 if they have equal precedence\n */\nexport const compare = (\n versionA: Version | string,\n versionB: Version | string,\n) => {\n const a = parse(versionA)\n if (!a) {\n throw syntaxError('invalid version', { found: versionA })\n }\n const b = parse(versionB)\n if (!b) {\n throw syntaxError('invalid version', { found: versionB })\n }\n return a.compare(b)\n}\n\n/**\n * Inverse of {@link compare}\n *\n * Same as {@link rsortMethod}, but throws if either version is not valid.\n *\n * -1 if versionA is higher precedence than versionB\n * 1 if versionA is lower precedence than versionB\n * 0 if they have equal precedence\n */\nexport const rcompare = (\n versionA: Version | string,\n versionB: Version | string,\n) => compare(versionB, versionA)\n\n/** true if versionA is > versionB. throws on invalid values */\nexport const gt = (\n versionA: Version | string,\n versionB: Version | string,\n) => compare(versionA, versionB) > 0\n/** true if versionA is >= versionB. throws on invalid values */\nexport const gte = (\n versionA: Version | string,\n versionB: Version | string,\n) => compare(versionA, versionB) >= 0\n/** true if versionA is < versionB. throws on invalid values */\nexport const lt = (\n versionA: Version | string,\n versionB: Version | string,\n) => compare(versionA, versionB) < 0\n/** true if versionA is <= versionB. throws on invalid values */\nexport const lte = (\n versionA: Version | string,\n versionB: Version | string,\n) => compare(versionA, versionB) <= 0\n/** true if versionA is not equal to versionB. throws on invalid values */\nexport const neq = (\n versionA: Version | string,\n versionB: Version | string,\n) => compare(versionA, versionB) !== 0\n/** true if versionA is equal to versionB. throws on invalid values */\nexport const eq = (\n versionA: Version | string,\n versionB: Version | string,\n) => compare(versionA, versionB) === 0\n\n/** extract the major version number, or undefined if invalid */\nexport const major = (version: Version | string) =>\n parse(version)?.major\n/** extract the minor version number, or undefined if invalid */\nexport const minor = (version: Version | string) =>\n parse(version)?.minor\n/** extract the patch version number, or undefined if invalid */\nexport const patch = (version: Version | string) =>\n parse(version)?.patch\n/**\n * extract the list of prerelease identifiers, or undefined if the version\n * is invalid. If no prerelease identifiers are present, returns `[]`.\n */\nexport const prerelease = (version: Version | string) => {\n const p = parse(version)\n if (!p) return undefined\n return p.prerelease ?? []\n}\n/**\n * extract the list of build identifiers, or undefined if the version\n * is invalid. If no build identifiers are present, returns `[]`.\n */\nexport const build = (version: Version | string) => {\n const p = parse(version)\n if (!p) return undefined\n return p.build ?? []\n}\n\n/** return all versions that do not have any prerelease identifiers */\nexport const stable = <T extends Version | string = Version | string>(\n versions: T[],\n): T[] =>\n versions.filter(v => {\n const p = parse(v)\n if (!p) return false\n return !p.prerelease?.length\n })\n\n/**\n * Return true if the range r1 intersects any of the ranges r2\n * r1 and r2 are either Range objects or range strings.\n * Returns true if any version would satisfy both ranges.\n */\nexport const intersects = (\n r1: Range | string,\n r2: Range | string,\n includePrerelease?: boolean,\n) => {\n const range1 =\n typeof r1 === 'string' ? parseRange(r1, includePrerelease) : r1\n const range2 =\n typeof r2 === 'string' ? parseRange(r2, includePrerelease) : r2\n\n if (!range1 || !range2) return false\n\n // If either range is 'any', they intersect\n if (range1.isAny || range2.isAny) return true\n\n // Check if any set from range1 intersects with any set from range2\n return range1.set.some(set1 =>\n range2.set.some(set2 => intersectComparators(set1, set2)),\n )\n}\n\n/**\n * Check if two comparators can be satisfied simultaneously\n */\nconst intersectComparators = (\n comp1: Comparator,\n comp2: Comparator,\n): boolean => {\n // Collect all tuples from both comparators\n const tuples1 = comp1.tuples.filter((t): t is OVTuple =>\n Array.isArray(t),\n )\n const tuples2 = comp2.tuples.filter((t): t is OVTuple =>\n Array.isArray(t),\n )\n\n // Check if there's a satisfiable combination\n return satisfiableRange(tuples1.concat(tuples2))\n}\n\n/**\n * Check if a set of operator-version tuples represents a satisfiable range\n * This is a simplified implementation that handles the most common cases\n */\nconst satisfiableRange = (tuples: OVTuple[]): boolean => {\n // Find bounds\n let lowerBound: Version | null = null\n let lowerInclusive = false\n let upperBound: Version | null = null\n let upperInclusive = false\n let hasExact: Version | null = null\n\n for (const [op, ver] of tuples) {\n switch (op) {\n case '':\n // Exact match - if we already have a different exact match, no intersection\n if (hasExact && !eq(hasExact, ver)) return false\n hasExact = ver\n break\n\n case '>=':\n /* c8 ignore start */\n if (\n !lowerBound ||\n gt(ver, lowerBound) ||\n (eq(ver, lowerBound) && !lowerInclusive)\n ) {\n lowerBound = ver\n lowerInclusive = true\n }\n /* c8 ignore stop */\n break\n\n case '>':\n if (!lowerBound || gt(ver, lowerBound)) {\n lowerBound = ver\n lowerInclusive = false\n }\n break\n\n case '<=':\n if (!upperBound || lt(ver, upperBound)) {\n upperBound = ver\n upperInclusive = true\n }\n break\n\n case '<':\n /* c8 ignore start */\n if (\n !upperBound ||\n lt(ver, upperBound) ||\n eq(ver, upperBound)\n ) {\n upperBound = ver\n upperInclusive = false\n }\n /* c8 ignore stop */\n break\n }\n }\n\n // If we have an exact match, check if it's within bounds\n if (hasExact) {\n if (lowerBound) {\n if (\n lowerInclusive ?\n lt(hasExact, lowerBound)\n : lte(hasExact, lowerBound)\n ) {\n return false\n }\n }\n if (upperBound) {\n if (\n upperInclusive ?\n gt(hasExact, upperBound)\n : gte(hasExact, upperBound)\n ) {\n return false\n }\n }\n return true\n }\n\n // Check if lower bound is less than or equal to upper bound\n if (lowerBound && upperBound) {\n if (gt(lowerBound, upperBound)) return false\n if (\n eq(lowerBound, upperBound) &&\n !(lowerInclusive && upperInclusive)\n )\n return false\n }\n\n return true\n}\n"]}
|
package/dist/esm/package.json
DELETED
package/dist/esm/range.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Comparator } from './comparator.ts';
|
|
2
|
-
import type { Version } from './version.ts';
|
|
3
|
-
export declare const isRange: (range: unknown) => range is Range;
|
|
4
|
-
/**
|
|
5
|
-
* A representation of a semver range, used to test versions.
|
|
6
|
-
*
|
|
7
|
-
* Includes a set of comparators representing the `||`-separated
|
|
8
|
-
* sections of the range string
|
|
9
|
-
*/
|
|
10
|
-
export declare class Range {
|
|
11
|
-
#private;
|
|
12
|
-
/** raw string used to create this Range */
|
|
13
|
-
raw: string;
|
|
14
|
-
/** true if the range is `*` */
|
|
15
|
-
isAny: boolean;
|
|
16
|
-
/** true if the range is a single semver version */
|
|
17
|
-
isSingle: boolean;
|
|
18
|
-
/** true if the range cannot match anything */
|
|
19
|
-
/**
|
|
20
|
-
* set of {@link Comparator} objects representing the `||`-separated sections
|
|
21
|
-
* of the range. If at least one of these matches, then the version is a
|
|
22
|
-
* match.
|
|
23
|
-
*/
|
|
24
|
-
set: Comparator[];
|
|
25
|
-
/** true if all prerelease versions should be included */
|
|
26
|
-
includePrerelease: boolean;
|
|
27
|
-
constructor(range: string, includePrerelease?: boolean);
|
|
28
|
-
/**
|
|
29
|
-
* test a {@link Version} against the range
|
|
30
|
-
*/
|
|
31
|
-
test(v: Version): boolean;
|
|
32
|
-
/** return the simplified canonical form of this range */
|
|
33
|
-
toString(): string;
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=range.d.ts.map
|
package/dist/esm/range.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"range.d.ts","sourceRoot":"","sources":["../../src/range.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAG3C,eAAO,MAAM,OAAO,UAAW,OAAO,KAAG,KAAK,IAAI,KAWjD,CAAA;AAED;;;;;GAKG;AACH,qBAAa,KAAK;;IAChB,2CAA2C;IAC3C,GAAG,EAAE,MAAM,CAAA;IAEX,+BAA+B;IAC/B,KAAK,EAAE,OAAO,CAAA;IAEd,mDAAmD;IACnD,QAAQ,EAAE,OAAO,CAAA;IAEjB,8CAA8C;IAE9C;;;;OAIG;IACH,GAAG,EAAE,UAAU,EAAE,CAAK;IAEtB,yDAAyD;IACzD,iBAAiB,EAAE,OAAO,CAAA;gBAKd,KAAK,EAAE,MAAM,EAAE,iBAAiB,UAAQ;IA+CpD;;OAEG;IACH,IAAI,CAAC,CAAC,EAAE,OAAO;IAIf,yDAAyD;IACzD,QAAQ;CAST"}
|
package/dist/esm/range.js
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { fastSplit } from '@vltpkg/fast-split';
|
|
2
|
-
import { Comparator } from "./comparator.js";
|
|
3
|
-
import { asError } from '@vltpkg/types';
|
|
4
|
-
export const isRange = (range) => {
|
|
5
|
-
return (range instanceof Range ||
|
|
6
|
-
(typeof range === 'object' &&
|
|
7
|
-
range !== null &&
|
|
8
|
-
'raw' in range &&
|
|
9
|
-
typeof range.raw === 'string' &&
|
|
10
|
-
'set' in range &&
|
|
11
|
-
Array.isArray(range.set) &&
|
|
12
|
-
range.set.every(c => c instanceof Comparator)));
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* A representation of a semver range, used to test versions.
|
|
16
|
-
*
|
|
17
|
-
* Includes a set of comparators representing the `||`-separated
|
|
18
|
-
* sections of the range string
|
|
19
|
-
*/
|
|
20
|
-
export class Range {
|
|
21
|
-
/** raw string used to create this Range */
|
|
22
|
-
raw;
|
|
23
|
-
/** true if the range is `*` */
|
|
24
|
-
isAny;
|
|
25
|
-
/** true if the range is a single semver version */
|
|
26
|
-
isSingle;
|
|
27
|
-
/** true if the range cannot match anything */
|
|
28
|
-
/**
|
|
29
|
-
* set of {@link Comparator} objects representing the `||`-separated sections
|
|
30
|
-
* of the range. If at least one of these matches, then the version is a
|
|
31
|
-
* match.
|
|
32
|
-
*/
|
|
33
|
-
set = [];
|
|
34
|
-
/** true if all prerelease versions should be included */
|
|
35
|
-
includePrerelease;
|
|
36
|
-
/** cached toString */
|
|
37
|
-
#toString;
|
|
38
|
-
constructor(range, includePrerelease = false) {
|
|
39
|
-
this.raw = range;
|
|
40
|
-
this.includePrerelease = includePrerelease;
|
|
41
|
-
this.isAny = false;
|
|
42
|
-
let isFirst = true;
|
|
43
|
-
this.isSingle = false;
|
|
44
|
-
const comparatorErrors = [];
|
|
45
|
-
fastSplit(range, '||', -1, part => {
|
|
46
|
-
if (this.isAny)
|
|
47
|
-
return;
|
|
48
|
-
const cmp = this.#maybeComparator(part, this.includePrerelease);
|
|
49
|
-
if (cmp instanceof Error) {
|
|
50
|
-
comparatorErrors.push(cmp);
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
if (cmp.isAny) {
|
|
54
|
-
this.set = [cmp];
|
|
55
|
-
this.isAny = true;
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
this.set.push(cmp);
|
|
59
|
-
if (!isFirst)
|
|
60
|
-
this.isSingle = false;
|
|
61
|
-
else if (Array.isArray(cmp.tuples) &&
|
|
62
|
-
cmp.tuples.length === 1 &&
|
|
63
|
-
Array.isArray(cmp.tuples[0]) &&
|
|
64
|
-
cmp.tuples[0][0] === '') {
|
|
65
|
-
this.isSingle = true;
|
|
66
|
-
}
|
|
67
|
-
isFirst = false;
|
|
68
|
-
});
|
|
69
|
-
if (!this.set.length && comparatorErrors.length) {
|
|
70
|
-
if (comparatorErrors.length === 1 && comparatorErrors[0]) {
|
|
71
|
-
throw comparatorErrors[0];
|
|
72
|
-
}
|
|
73
|
-
throw new AggregateError(comparatorErrors);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
#maybeComparator(part, includePrerelease) {
|
|
77
|
-
try {
|
|
78
|
-
return new Comparator(part, includePrerelease);
|
|
79
|
-
}
|
|
80
|
-
catch (er) {
|
|
81
|
-
return asError(er);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* test a {@link Version} against the range
|
|
86
|
-
*/
|
|
87
|
-
test(v) {
|
|
88
|
-
return this.set.some(c => c.test(v));
|
|
89
|
-
}
|
|
90
|
-
/** return the simplified canonical form of this range */
|
|
91
|
-
toString() {
|
|
92
|
-
if (this.#toString)
|
|
93
|
-
return this.#toString;
|
|
94
|
-
if (this.isSingle) {
|
|
95
|
-
this.#toString = String(this.set[0]);
|
|
96
|
-
return this.#toString;
|
|
97
|
-
}
|
|
98
|
-
this.#toString = this.set.map(c => String(c)).join(' || ');
|
|
99
|
-
return this.#toString;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
//# sourceMappingURL=range.js.map
|
package/dist/esm/range.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"range.js","sourceRoot":"","sources":["../../src/range.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,KAAc,EAAkB,EAAE;IACxD,OAAO,CACL,KAAK,YAAY,KAAK;QACtB,CAAC,OAAO,KAAK,KAAK,QAAQ;YACxB,KAAK,KAAK,IAAI;YACd,KAAK,IAAI,KAAK;YACd,OAAO,KAAK,CAAC,GAAG,KAAK,QAAQ;YAC7B,KAAK,IAAI,KAAK;YACd,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC;YACxB,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,YAAY,UAAU,CAAC,CAAC,CACjD,CAAA;AACH,CAAC,CAAA;AAED;;;;;GAKG;AACH,MAAM,OAAO,KAAK;IAChB,2CAA2C;IAC3C,GAAG,CAAQ;IAEX,+BAA+B;IAC/B,KAAK,CAAS;IAEd,mDAAmD;IACnD,QAAQ,CAAS;IAEjB,8CAA8C;IAE9C;;;;OAIG;IACH,GAAG,GAAiB,EAAE,CAAA;IAEtB,yDAAyD;IACzD,iBAAiB,CAAS;IAE1B,sBAAsB;IACtB,SAAS,CAAS;IAElB,YAAY,KAAa,EAAE,iBAAiB,GAAG,KAAK;QAClD,IAAI,CAAC,GAAG,GAAG,KAAK,CAAA;QAChB,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAA;QAC1C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,OAAO,GAAG,IAAI,CAAA;QAClB,IAAI,CAAC,QAAQ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,CAAC;gBACzD,MAAM,gBAAgB,CAAC,CAAC,CAAC,CAAA;YAC3B,CAAC;YACD,MAAM,IAAI,cAAc,CAAC,gBAAgB,CAAC,CAAA;QAC5C,CAAC;IACH,CAAC;IAED,gBAAgB,CAAC,IAAY,EAAE,iBAA0B;QACvD,IAAI,CAAC;YACH,OAAO,IAAI,UAAU,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAA;QAChD,CAAC;QAAC,OAAO,EAAE,EAAE,CAAC;YACZ,OAAO,OAAO,CAAC,EAAE,CAAC,CAAA;QACpB,CAAC;IACH,CAAC;IAED;;OAEG;IACH,IAAI,CAAC,CAAU;QACb,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;IACtC,CAAC;IAED,yDAAyD;IACzD,QAAQ;QACN,IAAI,IAAI,CAAC,SAAS;YAAE,OAAO,IAAI,CAAC,SAAS,CAAA;QACzC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;YACpC,OAAO,IAAI,CAAC,SAAS,CAAA;QACvB,CAAC;QACD,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAC1D,OAAO,IAAI,CAAC,SAAS,CAAA;IACvB,CAAC;CACF","sourcesContent":["import { fastSplit } from '@vltpkg/fast-split'\nimport { Comparator } from './comparator.ts'\nimport type { Version } from './version.ts'\nimport { asError } from '@vltpkg/types'\n\nexport const isRange = (range: unknown): range is Range => {\n return (\n range instanceof Range ||\n (typeof range === 'object' &&\n range !== null &&\n 'raw' in range &&\n typeof range.raw === 'string' &&\n 'set' in range &&\n Array.isArray(range.set) &&\n range.set.every(c => c instanceof Comparator))\n )\n}\n\n/**\n * A representation of a semver range, used to test versions.\n *\n * Includes a set of comparators representing the `||`-separated\n * sections of the range string\n */\nexport class Range {\n /** raw string used to create this Range */\n raw: string\n\n /** true if the range is `*` */\n isAny: boolean\n\n /** true if the range is a single semver version */\n isSingle: boolean\n\n /** true if the range cannot match anything */\n\n /**\n * set of {@link Comparator} objects representing the `||`-separated sections\n * of the range. If at least one of these matches, then the version is a\n * match.\n */\n set: Comparator[] = []\n\n /** true if all prerelease versions should be included */\n includePrerelease: boolean\n\n /** cached toString */\n #toString?: string\n\n constructor(range: string, includePrerelease = false) {\n this.raw = range\n this.includePrerelease = includePrerelease\n this.isAny = false\n let isFirst = true\n this.isSingle = false\n const comparatorErrors: Error[] = []\n fastSplit(range, '||', -1, part => {\n if (this.isAny) return\n const cmp = this.#maybeComparator(part, this.includePrerelease)\n if (cmp instanceof Error) {\n comparatorErrors.push(cmp)\n return\n }\n if (cmp.isAny) {\n this.set = [cmp]\n this.isAny = true\n return\n }\n this.set.push(cmp)\n if (!isFirst) this.isSingle = false\n else if (\n Array.isArray(cmp.tuples) &&\n cmp.tuples.length === 1 &&\n Array.isArray(cmp.tuples[0]) &&\n cmp.tuples[0][0] === ''\n ) {\n this.isSingle = true\n }\n isFirst = false\n })\n if (!this.set.length && comparatorErrors.length) {\n if (comparatorErrors.length === 1 && comparatorErrors[0]) {\n throw comparatorErrors[0]\n }\n throw new AggregateError(comparatorErrors)\n }\n }\n\n #maybeComparator(part: string, includePrerelease: boolean) {\n try {\n return new Comparator(part, includePrerelease)\n } catch (er) {\n return asError(er)\n }\n }\n\n /**\n * test a {@link Version} against the range\n */\n test(v: Version) {\n return this.set.some(c => c.test(v))\n }\n\n /** return the simplified canonical form of this range */\n toString() {\n if (this.#toString) return this.#toString\n if (this.isSingle) {\n this.#toString = String(this.set[0])\n return this.#toString\n }\n this.#toString = this.set.map(c => String(c)).join(' || ')\n return this.#toString\n }\n}\n"]}
|
package/dist/esm/version.d.ts
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import type { Range } from './range.ts';
|
|
2
|
-
/**
|
|
3
|
-
* Values of valid increment types.
|
|
4
|
-
*/
|
|
5
|
-
export declare const versionIncrements: readonly ["major", "minor", "patch", "pre", "premajor", "preminor", "prepatch", "prerelease"];
|
|
6
|
-
/**
|
|
7
|
-
* Types of incrementing supported by {@link Version#inc}
|
|
8
|
-
*/
|
|
9
|
-
export type IncrementType = (typeof versionIncrements)[number];
|
|
10
|
-
/**
|
|
11
|
-
* A parsed object representation of a SemVer version string
|
|
12
|
-
*
|
|
13
|
-
* This is a bit less forgiving than node-semver, in that prerelease versions
|
|
14
|
-
* MUST start with '-'. Otherwise, the allowed syntax is identical.
|
|
15
|
-
*/
|
|
16
|
-
export declare class Version {
|
|
17
|
-
/** raw string provided to create this Version */
|
|
18
|
-
raw: string;
|
|
19
|
-
/** major version number */
|
|
20
|
-
major: number;
|
|
21
|
-
/** minor version number */
|
|
22
|
-
minor: number;
|
|
23
|
-
/** patch version number */
|
|
24
|
-
patch: number;
|
|
25
|
-
/**
|
|
26
|
-
* List of `'.'`-separated strings and numbers indicating that this
|
|
27
|
-
* version is a prerelease.
|
|
28
|
-
*
|
|
29
|
-
* This is undefined if the version does not have a prerelease section.
|
|
30
|
-
*/
|
|
31
|
-
prerelease?: (number | string)[];
|
|
32
|
-
/**
|
|
33
|
-
* List of `'.'`-separated strings in the `build` section.
|
|
34
|
-
*
|
|
35
|
-
* This is undefined if the version does not have a build.
|
|
36
|
-
*/
|
|
37
|
-
build?: string[];
|
|
38
|
-
/** Canonical strict form of this version */
|
|
39
|
-
toString(): string;
|
|
40
|
-
/** Generate a `Version` object from a SemVer string */
|
|
41
|
-
static parse(version: string): Version;
|
|
42
|
-
constructor(version: string, major: number, minor: number, patch: number, prerelease: string | undefined, build: string | undefined);
|
|
43
|
-
/**
|
|
44
|
-
* Return 1 if this is > the provided version, -1 if we're less, or 0 if
|
|
45
|
-
* they are equal.
|
|
46
|
-
*
|
|
47
|
-
* No special handling for prerelease versions, this is just a precedence
|
|
48
|
-
* comparison.
|
|
49
|
-
*
|
|
50
|
-
* This can be used to sort a list of versions by precedence:
|
|
51
|
-
*
|
|
52
|
-
* ```ts
|
|
53
|
-
* const versions: Version[] = getVersionsSomehow()
|
|
54
|
-
* const sorted = versions.sort((a, b) => a.compare(b))
|
|
55
|
-
* ```
|
|
56
|
-
*/
|
|
57
|
-
compare(v: Version): -1 | 0 | 1;
|
|
58
|
-
/**
|
|
59
|
-
* The inverse of compare, for sorting version lists in reverse order
|
|
60
|
-
*/
|
|
61
|
-
rcompare(v: Version): number;
|
|
62
|
-
/** true if this version is > the argument */
|
|
63
|
-
greaterThan(v: Version): boolean;
|
|
64
|
-
/** true if this version is >= the argument */
|
|
65
|
-
greaterThanEqual(v: Version): boolean;
|
|
66
|
-
/** true if this version is < the argument */
|
|
67
|
-
lessThan(v: Version): boolean;
|
|
68
|
-
/** true if this version is <= the argument */
|
|
69
|
-
lessThanEqual(v: Version): boolean;
|
|
70
|
-
/** true if these two versions have equal SemVer precedence */
|
|
71
|
-
equals(v: Version): boolean;
|
|
72
|
-
/** just compare the M.m.p parts of the version */
|
|
73
|
-
tupleEquals(v: Version): boolean;
|
|
74
|
-
/** true if this version satisfies the range */
|
|
75
|
-
satisfies(r: Range): boolean;
|
|
76
|
-
/**
|
|
77
|
-
* Increment the version in place, in the manner specified.
|
|
78
|
-
*
|
|
79
|
-
* Part behaviors:
|
|
80
|
-
*
|
|
81
|
-
* - `'major'` If the version is a `M.0.0-...` version with a prerelease, then
|
|
82
|
-
* simply drop the prerelease. Otherwise, set the minor and patch to 0, and
|
|
83
|
-
* increment the major. So `1.0.0-beta` becomes `1.0.0`, and `1.2.3` becomes
|
|
84
|
-
* `2.0.0`
|
|
85
|
-
*
|
|
86
|
-
* - `'minor'` If the version is a `M.m.0-...` version with a prerelease, then
|
|
87
|
-
* simply drop the prerelease. Otherwise, set the patch to 0, and increment the
|
|
88
|
-
* minor. So `1.2.0-beta` becomes `1.2.0`, and `1.2.3` becomes `1.3.0`.
|
|
89
|
-
*
|
|
90
|
-
* - `'patch'` If the version has a prerelease, then simply drop the
|
|
91
|
-
* prerelease. Otherwise, increment the patch value. So `1.2.3-beta` becomes
|
|
92
|
-
* `1.2.3` and `1.2.3` becomes `1.2.4`.
|
|
93
|
-
*
|
|
94
|
-
* - `'premajor'` Set the patch and minor versions to `0`, increment the major
|
|
95
|
-
* version, and add a prerelease, using the optional identifier.
|
|
96
|
-
*
|
|
97
|
-
* - `'preminor'` Set the patch version to `0`, increment the minor version,
|
|
98
|
-
* and add a prerelease, using the optional identifier.
|
|
99
|
-
*
|
|
100
|
-
* - `'prepatch'` If a prerelease is already present, increment the patch
|
|
101
|
-
* version, otherwise leave it untouched, and add a prerelease, using the
|
|
102
|
-
* optional identifier.
|
|
103
|
-
*
|
|
104
|
-
* - `'prerelease'` If a prerelease version is present, then behave the same as
|
|
105
|
-
* `'prepatch'`. Otherwise, add a prerelease, using the optional identifier.
|
|
106
|
-
*
|
|
107
|
-
* - `'pre'` This is mostly for use by the other prerelease incrementers.
|
|
108
|
-
*
|
|
109
|
-
* - If a prerelease identifier is provided:
|
|
110
|
-
*
|
|
111
|
-
* Update that named portion of the prerelease. For example,
|
|
112
|
-
* `inc('1.2.3-beta.4', 'pre', 'beta')` would result in `1.2.3-beta.5`.
|
|
113
|
-
*
|
|
114
|
-
* If there is no prerelease identifier by that name, then replace the
|
|
115
|
-
* prerelease with `[name]`. So `inc('1.2.3-alpha.4', 'pre', 'beta')`
|
|
116
|
-
* would result in `1.2.3-beta`.
|
|
117
|
-
*
|
|
118
|
-
* If the prerelease identifer is present, but has no numeric value
|
|
119
|
-
* following it, then add `0`. So `inc('1.2.3-beta', 'pre', 'beta')`
|
|
120
|
-
* would result in `1.2.3-beta.0`.
|
|
121
|
-
*
|
|
122
|
-
* - If no prerelease identifier is provided:
|
|
123
|
-
*
|
|
124
|
-
* If there is no current prerelease, then set the prerelease to `0`. So,
|
|
125
|
-
* `inc('1.2.3', 'pre')` becomes `1.2.3-0`.
|
|
126
|
-
*
|
|
127
|
-
* If the last item in the prerelease is numeric, then increment it. So,
|
|
128
|
-
* `inc('1.2.3-beta.3', 'pre')` becomes `1.2.3-beta.4`.
|
|
129
|
-
*/
|
|
130
|
-
inc(part: IncrementType, prereleaseIdentifier?: string): this;
|
|
131
|
-
}
|
|
132
|
-
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AA2CvC;;GAEG;AACH,eAAO,MAAM,iBAAiB,+FASpB,CAAA;AAEV;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAA;AAE9D;;;;;GAKG;AACH,qBAAa,OAAO;IAClB,iDAAiD;IACjD,GAAG,EAAE,MAAM,CAAA;IAEX,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAA;IACb,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb;;;;;OAKG;IACH,UAAU,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;IAChC;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAEhB,4CAA4C;IAC5C,QAAQ;IAMR,uDAAuD;IACvD,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM;gBA2C1B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,KAAK,EAAE,MAAM,GAAG,SAAS;IA+B3B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