@slicemachine/adapter-next 0.3.85-beta.2 → 0.3.85
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/dist/_node_modules/lru-cache/index.cjs +267 -0
- package/dist/_node_modules/lru-cache/index.cjs.map +1 -0
- package/dist/_node_modules/lru-cache/index.js +267 -0
- package/dist/_node_modules/lru-cache/index.js.map +1 -0
- package/dist/_node_modules/yallist/iterator.cjs +18 -0
- package/dist/_node_modules/yallist/iterator.cjs.map +1 -0
- package/dist/_node_modules/yallist/iterator.js +18 -0
- package/dist/_node_modules/yallist/iterator.js.map +1 -0
- package/dist/_node_modules/yallist/yallist.cjs +367 -0
- package/dist/_node_modules/yallist/yallist.cjs.map +1 -0
- package/dist/_node_modules/yallist/yallist.js +367 -0
- package/dist/_node_modules/yallist/yallist.js.map +1 -0
- package/dist/_virtual/_commonjsHelpers.cjs +7 -0
- package/dist/_virtual/_commonjsHelpers.cjs.map +1 -0
- package/dist/_virtual/_commonjsHelpers.js +7 -0
- package/dist/_virtual/_commonjsHelpers.js.map +1 -0
- package/dist/_virtual/re.cjs +5 -0
- package/dist/_virtual/re.cjs.map +1 -0
- package/dist/_virtual/re.js +5 -0
- package/dist/_virtual/re.js.map +1 -0
- package/dist/hooks/project-init.cjs +5 -1
- package/dist/hooks/project-init.cjs.map +1 -1
- package/dist/hooks/project-init.js +5 -1
- package/dist/hooks/project-init.js.map +1 -1
- package/dist/lib/getNextJSVersion.cjs +34 -0
- package/dist/lib/getNextJSVersion.cjs.map +1 -0
- package/dist/lib/getNextJSVersion.d.ts +1 -0
- package/dist/lib/getNextJSVersion.js +12 -0
- package/dist/lib/getNextJSVersion.js.map +1 -0
- package/dist/lib/requireResolve.cjs +16 -0
- package/dist/lib/requireResolve.cjs.map +1 -0
- package/dist/lib/requireResolve.d.ts +10 -0
- package/dist/lib/requireResolve.js +16 -0
- package/dist/lib/requireResolve.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/classes/comparator.cjs +122 -0
- package/dist/packages/adapter-next/_node_modules/semver/classes/comparator.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/classes/comparator.js +122 -0
- package/dist/packages/adapter-next/_node_modules/semver/classes/comparator.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/classes/range.cjs +373 -0
- package/dist/packages/adapter-next/_node_modules/semver/classes/range.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/classes/range.js +373 -0
- package/dist/packages/adapter-next/_node_modules/semver/classes/range.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/classes/semver.cjs +243 -0
- package/dist/packages/adapter-next/_node_modules/semver/classes/semver.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/classes/semver.js +243 -0
- package/dist/packages/adapter-next/_node_modules/semver/classes/semver.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/clean.cjs +11 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/clean.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/clean.js +11 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/clean.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/cmp.cjs +53 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/cmp.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/cmp.js +53 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/cmp.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/coerce.cjs +40 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/coerce.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/coerce.js +40 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/coerce.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/compare-build.cjs +12 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/compare-build.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/compare-build.js +12 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/compare-build.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/compare-loose.cjs +8 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/compare-loose.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/compare-loose.js +8 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/compare-loose.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/compare.cjs +8 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/compare.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/compare.js +8 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/compare.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/diff.cjs +39 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/diff.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/diff.js +39 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/diff.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/eq.cjs +8 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/eq.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/eq.js +8 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/eq.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/gt.cjs +8 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/gt.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/gt.js +8 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/gt.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/gte.cjs +8 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/gte.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/gte.js +8 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/gte.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/inc.cjs +22 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/inc.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/inc.js +22 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/inc.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/lt.cjs +8 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/lt.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/lt.js +8 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/lt.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/lte.cjs +8 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/lte.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/lte.js +8 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/lte.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/major.cjs +8 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/major.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/major.js +8 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/major.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/minor.cjs +8 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/minor.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/minor.js +8 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/minor.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/neq.cjs +8 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/neq.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/neq.js +8 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/neq.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/parse.cjs +20 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/parse.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/parse.js +20 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/parse.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/patch.cjs +8 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/patch.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/patch.js +8 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/patch.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/prerelease.cjs +11 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/prerelease.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/prerelease.js +11 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/prerelease.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/rcompare.cjs +8 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/rcompare.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/rcompare.js +8 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/rcompare.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/rsort.cjs +8 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/rsort.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/rsort.js +8 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/rsort.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/satisfies.cjs +15 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/satisfies.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/satisfies.js +15 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/satisfies.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/sort.cjs +8 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/sort.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/sort.js +8 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/sort.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/valid.cjs +11 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/valid.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/valid.js +11 -0
- package/dist/packages/adapter-next/_node_modules/semver/functions/valid.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/index.cjs +134 -0
- package/dist/packages/adapter-next/_node_modules/semver/index.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/index.js +135 -0
- package/dist/packages/adapter-next/_node_modules/semver/index.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/internal/constants.cjs +27 -0
- package/dist/packages/adapter-next/_node_modules/semver/internal/constants.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/internal/constants.js +27 -0
- package/dist/packages/adapter-next/_node_modules/semver/internal/constants.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/internal/debug.cjs +7 -0
- package/dist/packages/adapter-next/_node_modules/semver/internal/debug.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/internal/debug.js +7 -0
- package/dist/packages/adapter-next/_node_modules/semver/internal/debug.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/internal/identifiers.cjs +19 -0
- package/dist/packages/adapter-next/_node_modules/semver/internal/identifiers.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/internal/identifiers.js +19 -0
- package/dist/packages/adapter-next/_node_modules/semver/internal/identifiers.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/internal/parse-options.cjs +16 -0
- package/dist/packages/adapter-next/_node_modules/semver/internal/parse-options.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/internal/parse-options.js +16 -0
- package/dist/packages/adapter-next/_node_modules/semver/internal/parse-options.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/internal/re.cjs +67 -0
- package/dist/packages/adapter-next/_node_modules/semver/internal/re.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/internal/re.js +67 -0
- package/dist/packages/adapter-next/_node_modules/semver/internal/re.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/gtr.cjs +8 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/gtr.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/gtr.js +8 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/gtr.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/intersects.cjs +12 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/intersects.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/intersects.js +12 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/intersects.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/ltr.cjs +8 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/ltr.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/ltr.js +8 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/ltr.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/max-satisfying.cjs +28 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/max-satisfying.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/max-satisfying.js +28 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/max-satisfying.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/min-satisfying.cjs +28 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/min-satisfying.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/min-satisfying.js +28 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/min-satisfying.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/min-version.cjs +57 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/min-version.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/min-version.js +57 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/min-version.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/outside.cjs +74 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/outside.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/outside.js +74 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/outside.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/simplify.cjs +49 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/simplify.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/simplify.js +49 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/simplify.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/subset.cjs +163 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/subset.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/subset.js +163 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/subset.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/to-comparators.cjs +8 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/to-comparators.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/to-comparators.js +8 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/to-comparators.js.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/valid.cjs +14 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/valid.cjs.map +1 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/valid.js +14 -0
- package/dist/packages/adapter-next/_node_modules/semver/ranges/valid.js.map +1 -0
- package/dist/plugin.cjs +1 -1
- package/dist/plugin.js +1 -1
- package/package.json +7 -8
- package/src/hooks/project-init.ts +6 -1
- package/src/lib/getNextJSVersion.ts +16 -0
- package/src/lib/requireResolve.ts +30 -0
- /package/dist/{package.json.cjs → packages/adapter-next/package.json.cjs} +0 -0
- /package/dist/{package.json.cjs.map → packages/adapter-next/package.json.cjs.map} +0 -0
- /package/dist/{package.json.js → packages/adapter-next/package.json.js} +0 -0
- /package/dist/{package.json.js.map → packages/adapter-next/package.json.js.map} +0 -0
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
import { l as lruCache } from './../../../../../_node_modules/lru-cache/index.js';
|
|
2
|
+
import { p as parseOptions_1 } from "../internal/parse-options.js";
|
|
3
|
+
import { __require as requireComparator } from "./comparator.js";
|
|
4
|
+
import { d as debug_1 } from "../internal/debug.js";
|
|
5
|
+
import { s as semver } from "./semver.js";
|
|
6
|
+
import { r as reExports } from "../internal/re.js";
|
|
7
|
+
import { c as constants } from "../internal/constants.js";
|
|
8
|
+
var range;
|
|
9
|
+
var hasRequiredRange;
|
|
10
|
+
function requireRange() {
|
|
11
|
+
if (hasRequiredRange) return range;
|
|
12
|
+
hasRequiredRange = 1;
|
|
13
|
+
class Range {
|
|
14
|
+
constructor(range2, options) {
|
|
15
|
+
options = parseOptions(options);
|
|
16
|
+
if (range2 instanceof Range) {
|
|
17
|
+
if (range2.loose === !!options.loose && range2.includePrerelease === !!options.includePrerelease) {
|
|
18
|
+
return range2;
|
|
19
|
+
} else {
|
|
20
|
+
return new Range(range2.raw, options);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
if (range2 instanceof Comparator) {
|
|
24
|
+
this.raw = range2.value;
|
|
25
|
+
this.set = [[range2]];
|
|
26
|
+
this.format();
|
|
27
|
+
return this;
|
|
28
|
+
}
|
|
29
|
+
this.options = options;
|
|
30
|
+
this.loose = !!options.loose;
|
|
31
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
32
|
+
this.raw = range2;
|
|
33
|
+
this.set = range2.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
|
|
34
|
+
if (!this.set.length) {
|
|
35
|
+
throw new TypeError(`Invalid SemVer Range: ${range2}`);
|
|
36
|
+
}
|
|
37
|
+
if (this.set.length > 1) {
|
|
38
|
+
const first = this.set[0];
|
|
39
|
+
this.set = this.set.filter((c) => !isNullSet(c[0]));
|
|
40
|
+
if (this.set.length === 0) {
|
|
41
|
+
this.set = [first];
|
|
42
|
+
} else if (this.set.length > 1) {
|
|
43
|
+
for (const c of this.set) {
|
|
44
|
+
if (c.length === 1 && isAny(c[0])) {
|
|
45
|
+
this.set = [c];
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
this.format();
|
|
52
|
+
}
|
|
53
|
+
format() {
|
|
54
|
+
this.range = this.set.map((comps) => {
|
|
55
|
+
return comps.join(" ").trim();
|
|
56
|
+
}).join("||").trim();
|
|
57
|
+
return this.range;
|
|
58
|
+
}
|
|
59
|
+
toString() {
|
|
60
|
+
return this.range;
|
|
61
|
+
}
|
|
62
|
+
parseRange(range2) {
|
|
63
|
+
range2 = range2.trim();
|
|
64
|
+
const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
|
|
65
|
+
const memoKey = memoOpts + ":" + range2;
|
|
66
|
+
const cached = cache.get(memoKey);
|
|
67
|
+
if (cached) {
|
|
68
|
+
return cached;
|
|
69
|
+
}
|
|
70
|
+
const loose = this.options.loose;
|
|
71
|
+
const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
|
|
72
|
+
range2 = range2.replace(hr, hyphenReplace(this.options.includePrerelease));
|
|
73
|
+
debug("hyphen replace", range2);
|
|
74
|
+
range2 = range2.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
|
|
75
|
+
debug("comparator trim", range2);
|
|
76
|
+
range2 = range2.replace(re[t.TILDETRIM], tildeTrimReplace);
|
|
77
|
+
range2 = range2.replace(re[t.CARETTRIM], caretTrimReplace);
|
|
78
|
+
range2 = range2.split(/\s+/).join(" ");
|
|
79
|
+
let rangeList = range2.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
|
|
80
|
+
if (loose) {
|
|
81
|
+
rangeList = rangeList.filter((comp) => {
|
|
82
|
+
debug("loose invalid filter", comp, this.options);
|
|
83
|
+
return !!comp.match(re[t.COMPARATORLOOSE]);
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
debug("range list", rangeList);
|
|
87
|
+
const rangeMap = /* @__PURE__ */ new Map();
|
|
88
|
+
const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
|
|
89
|
+
for (const comp of comparators) {
|
|
90
|
+
if (isNullSet(comp)) {
|
|
91
|
+
return [comp];
|
|
92
|
+
}
|
|
93
|
+
rangeMap.set(comp.value, comp);
|
|
94
|
+
}
|
|
95
|
+
if (rangeMap.size > 1 && rangeMap.has("")) {
|
|
96
|
+
rangeMap.delete("");
|
|
97
|
+
}
|
|
98
|
+
const result = [...rangeMap.values()];
|
|
99
|
+
cache.set(memoKey, result);
|
|
100
|
+
return result;
|
|
101
|
+
}
|
|
102
|
+
intersects(range2, options) {
|
|
103
|
+
if (!(range2 instanceof Range)) {
|
|
104
|
+
throw new TypeError("a Range is required");
|
|
105
|
+
}
|
|
106
|
+
return this.set.some((thisComparators) => {
|
|
107
|
+
return isSatisfiable(thisComparators, options) && range2.set.some((rangeComparators) => {
|
|
108
|
+
return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
|
|
109
|
+
return rangeComparators.every((rangeComparator) => {
|
|
110
|
+
return thisComparator.intersects(rangeComparator, options);
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
// if ANY of the sets match ALL of its comparators, then pass
|
|
117
|
+
test(version) {
|
|
118
|
+
if (!version) {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
if (typeof version === "string") {
|
|
122
|
+
try {
|
|
123
|
+
version = new SemVer(version, this.options);
|
|
124
|
+
} catch (er) {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
for (let i = 0; i < this.set.length; i++) {
|
|
129
|
+
if (testSet(this.set[i], version, this.options)) {
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
range = Range;
|
|
137
|
+
const LRU = lruCache;
|
|
138
|
+
const cache = new LRU({ max: 1e3 });
|
|
139
|
+
const parseOptions = parseOptions_1;
|
|
140
|
+
const Comparator = requireComparator();
|
|
141
|
+
const debug = debug_1;
|
|
142
|
+
const SemVer = semver;
|
|
143
|
+
const {
|
|
144
|
+
re,
|
|
145
|
+
t,
|
|
146
|
+
comparatorTrimReplace,
|
|
147
|
+
tildeTrimReplace,
|
|
148
|
+
caretTrimReplace
|
|
149
|
+
} = reExports;
|
|
150
|
+
const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = constants;
|
|
151
|
+
const isNullSet = (c) => c.value === "<0.0.0-0";
|
|
152
|
+
const isAny = (c) => c.value === "";
|
|
153
|
+
const isSatisfiable = (comparators, options) => {
|
|
154
|
+
let result = true;
|
|
155
|
+
const remainingComparators = comparators.slice();
|
|
156
|
+
let testComparator = remainingComparators.pop();
|
|
157
|
+
while (result && remainingComparators.length) {
|
|
158
|
+
result = remainingComparators.every((otherComparator) => {
|
|
159
|
+
return testComparator.intersects(otherComparator, options);
|
|
160
|
+
});
|
|
161
|
+
testComparator = remainingComparators.pop();
|
|
162
|
+
}
|
|
163
|
+
return result;
|
|
164
|
+
};
|
|
165
|
+
const parseComparator = (comp, options) => {
|
|
166
|
+
debug("comp", comp, options);
|
|
167
|
+
comp = replaceCarets(comp, options);
|
|
168
|
+
debug("caret", comp);
|
|
169
|
+
comp = replaceTildes(comp, options);
|
|
170
|
+
debug("tildes", comp);
|
|
171
|
+
comp = replaceXRanges(comp, options);
|
|
172
|
+
debug("xrange", comp);
|
|
173
|
+
comp = replaceStars(comp, options);
|
|
174
|
+
debug("stars", comp);
|
|
175
|
+
return comp;
|
|
176
|
+
};
|
|
177
|
+
const isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
|
|
178
|
+
const replaceTildes = (comp, options) => comp.trim().split(/\s+/).map((c) => {
|
|
179
|
+
return replaceTilde(c, options);
|
|
180
|
+
}).join(" ");
|
|
181
|
+
const replaceTilde = (comp, options) => {
|
|
182
|
+
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
|
|
183
|
+
return comp.replace(r, (_, M, m, p, pr) => {
|
|
184
|
+
debug("tilde", comp, _, M, m, p, pr);
|
|
185
|
+
let ret;
|
|
186
|
+
if (isX(M)) {
|
|
187
|
+
ret = "";
|
|
188
|
+
} else if (isX(m)) {
|
|
189
|
+
ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
|
|
190
|
+
} else if (isX(p)) {
|
|
191
|
+
ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
|
|
192
|
+
} else if (pr) {
|
|
193
|
+
debug("replaceTilde pr", pr);
|
|
194
|
+
ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
195
|
+
} else {
|
|
196
|
+
ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
|
|
197
|
+
}
|
|
198
|
+
debug("tilde return", ret);
|
|
199
|
+
return ret;
|
|
200
|
+
});
|
|
201
|
+
};
|
|
202
|
+
const replaceCarets = (comp, options) => comp.trim().split(/\s+/).map((c) => {
|
|
203
|
+
return replaceCaret(c, options);
|
|
204
|
+
}).join(" ");
|
|
205
|
+
const replaceCaret = (comp, options) => {
|
|
206
|
+
debug("caret", comp, options);
|
|
207
|
+
const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
|
|
208
|
+
const z = options.includePrerelease ? "-0" : "";
|
|
209
|
+
return comp.replace(r, (_, M, m, p, pr) => {
|
|
210
|
+
debug("caret", comp, _, M, m, p, pr);
|
|
211
|
+
let ret;
|
|
212
|
+
if (isX(M)) {
|
|
213
|
+
ret = "";
|
|
214
|
+
} else if (isX(m)) {
|
|
215
|
+
ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
|
|
216
|
+
} else if (isX(p)) {
|
|
217
|
+
if (M === "0") {
|
|
218
|
+
ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
|
|
219
|
+
} else {
|
|
220
|
+
ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
|
|
221
|
+
}
|
|
222
|
+
} else if (pr) {
|
|
223
|
+
debug("replaceCaret pr", pr);
|
|
224
|
+
if (M === "0") {
|
|
225
|
+
if (m === "0") {
|
|
226
|
+
ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
|
|
227
|
+
} else {
|
|
228
|
+
ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
229
|
+
}
|
|
230
|
+
} else {
|
|
231
|
+
ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
|
|
232
|
+
}
|
|
233
|
+
} else {
|
|
234
|
+
debug("no pr");
|
|
235
|
+
if (M === "0") {
|
|
236
|
+
if (m === "0") {
|
|
237
|
+
ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;
|
|
238
|
+
} else {
|
|
239
|
+
ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`;
|
|
240
|
+
}
|
|
241
|
+
} else {
|
|
242
|
+
ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
debug("caret return", ret);
|
|
246
|
+
return ret;
|
|
247
|
+
});
|
|
248
|
+
};
|
|
249
|
+
const replaceXRanges = (comp, options) => {
|
|
250
|
+
debug("replaceXRanges", comp, options);
|
|
251
|
+
return comp.split(/\s+/).map((c) => {
|
|
252
|
+
return replaceXRange(c, options);
|
|
253
|
+
}).join(" ");
|
|
254
|
+
};
|
|
255
|
+
const replaceXRange = (comp, options) => {
|
|
256
|
+
comp = comp.trim();
|
|
257
|
+
const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
|
|
258
|
+
return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
|
|
259
|
+
debug("xRange", comp, ret, gtlt, M, m, p, pr);
|
|
260
|
+
const xM = isX(M);
|
|
261
|
+
const xm = xM || isX(m);
|
|
262
|
+
const xp = xm || isX(p);
|
|
263
|
+
const anyX = xp;
|
|
264
|
+
if (gtlt === "=" && anyX) {
|
|
265
|
+
gtlt = "";
|
|
266
|
+
}
|
|
267
|
+
pr = options.includePrerelease ? "-0" : "";
|
|
268
|
+
if (xM) {
|
|
269
|
+
if (gtlt === ">" || gtlt === "<") {
|
|
270
|
+
ret = "<0.0.0-0";
|
|
271
|
+
} else {
|
|
272
|
+
ret = "*";
|
|
273
|
+
}
|
|
274
|
+
} else if (gtlt && anyX) {
|
|
275
|
+
if (xm) {
|
|
276
|
+
m = 0;
|
|
277
|
+
}
|
|
278
|
+
p = 0;
|
|
279
|
+
if (gtlt === ">") {
|
|
280
|
+
gtlt = ">=";
|
|
281
|
+
if (xm) {
|
|
282
|
+
M = +M + 1;
|
|
283
|
+
m = 0;
|
|
284
|
+
p = 0;
|
|
285
|
+
} else {
|
|
286
|
+
m = +m + 1;
|
|
287
|
+
p = 0;
|
|
288
|
+
}
|
|
289
|
+
} else if (gtlt === "<=") {
|
|
290
|
+
gtlt = "<";
|
|
291
|
+
if (xm) {
|
|
292
|
+
M = +M + 1;
|
|
293
|
+
} else {
|
|
294
|
+
m = +m + 1;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
if (gtlt === "<") {
|
|
298
|
+
pr = "-0";
|
|
299
|
+
}
|
|
300
|
+
ret = `${gtlt + M}.${m}.${p}${pr}`;
|
|
301
|
+
} else if (xm) {
|
|
302
|
+
ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
|
|
303
|
+
} else if (xp) {
|
|
304
|
+
ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
|
|
305
|
+
}
|
|
306
|
+
debug("xRange return", ret);
|
|
307
|
+
return ret;
|
|
308
|
+
});
|
|
309
|
+
};
|
|
310
|
+
const replaceStars = (comp, options) => {
|
|
311
|
+
debug("replaceStars", comp, options);
|
|
312
|
+
return comp.trim().replace(re[t.STAR], "");
|
|
313
|
+
};
|
|
314
|
+
const replaceGTE0 = (comp, options) => {
|
|
315
|
+
debug("replaceGTE0", comp, options);
|
|
316
|
+
return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
|
|
317
|
+
};
|
|
318
|
+
const hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr, tb) => {
|
|
319
|
+
if (isX(fM)) {
|
|
320
|
+
from = "";
|
|
321
|
+
} else if (isX(fm)) {
|
|
322
|
+
from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
|
|
323
|
+
} else if (isX(fp)) {
|
|
324
|
+
from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
|
|
325
|
+
} else if (fpr) {
|
|
326
|
+
from = `>=${from}`;
|
|
327
|
+
} else {
|
|
328
|
+
from = `>=${from}${incPr ? "-0" : ""}`;
|
|
329
|
+
}
|
|
330
|
+
if (isX(tM)) {
|
|
331
|
+
to = "";
|
|
332
|
+
} else if (isX(tm)) {
|
|
333
|
+
to = `<${+tM + 1}.0.0-0`;
|
|
334
|
+
} else if (isX(tp)) {
|
|
335
|
+
to = `<${tM}.${+tm + 1}.0-0`;
|
|
336
|
+
} else if (tpr) {
|
|
337
|
+
to = `<=${tM}.${tm}.${tp}-${tpr}`;
|
|
338
|
+
} else if (incPr) {
|
|
339
|
+
to = `<${tM}.${tm}.${+tp + 1}-0`;
|
|
340
|
+
} else {
|
|
341
|
+
to = `<=${to}`;
|
|
342
|
+
}
|
|
343
|
+
return `${from} ${to}`.trim();
|
|
344
|
+
};
|
|
345
|
+
const testSet = (set, version, options) => {
|
|
346
|
+
for (let i = 0; i < set.length; i++) {
|
|
347
|
+
if (!set[i].test(version)) {
|
|
348
|
+
return false;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
if (version.prerelease.length && !options.includePrerelease) {
|
|
352
|
+
for (let i = 0; i < set.length; i++) {
|
|
353
|
+
debug(set[i].semver);
|
|
354
|
+
if (set[i].semver === Comparator.ANY) {
|
|
355
|
+
continue;
|
|
356
|
+
}
|
|
357
|
+
if (set[i].semver.prerelease.length > 0) {
|
|
358
|
+
const allowed = set[i].semver;
|
|
359
|
+
if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
|
|
360
|
+
return true;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
return false;
|
|
365
|
+
}
|
|
366
|
+
return true;
|
|
367
|
+
};
|
|
368
|
+
return range;
|
|
369
|
+
}
|
|
370
|
+
export {
|
|
371
|
+
requireRange as __require
|
|
372
|
+
};
|
|
373
|
+
//# sourceMappingURL=range.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"range.js","sources":["../../../../../../node_modules/semver/classes/range.js"],"sourcesContent":["// hoisted class for cyclic dependency\nclass Range {\n constructor (range, options) {\n options = parseOptions(options)\n\n if (range instanceof Range) {\n if (\n range.loose === !!options.loose &&\n range.includePrerelease === !!options.includePrerelease\n ) {\n return range\n } else {\n return new Range(range.raw, options)\n }\n }\n\n if (range instanceof Comparator) {\n // just put it in the set and return\n this.raw = range.value\n this.set = [[range]]\n this.format()\n return this\n }\n\n this.options = options\n this.loose = !!options.loose\n this.includePrerelease = !!options.includePrerelease\n\n // First, split based on boolean or ||\n this.raw = range\n this.set = range\n .split('||')\n // map the range to a 2d array of comparators\n .map(r => this.parseRange(r.trim()))\n // throw out any comparator lists that are empty\n // this generally means that it was not a valid range, which is allowed\n // in loose mode, but will still throw if the WHOLE range is invalid.\n .filter(c => c.length)\n\n if (!this.set.length) {\n throw new TypeError(`Invalid SemVer Range: ${range}`)\n }\n\n // if we have any that are not the null set, throw out null sets.\n if (this.set.length > 1) {\n // keep the first one, in case they're all null sets\n const first = this.set[0]\n this.set = this.set.filter(c => !isNullSet(c[0]))\n if (this.set.length === 0) {\n this.set = [first]\n } else if (this.set.length > 1) {\n // if we have any that are *, then the range is just *\n for (const c of this.set) {\n if (c.length === 1 && isAny(c[0])) {\n this.set = [c]\n break\n }\n }\n }\n }\n\n this.format()\n }\n\n format () {\n this.range = this.set\n .map((comps) => {\n return comps.join(' ').trim()\n })\n .join('||')\n .trim()\n return this.range\n }\n\n toString () {\n return this.range\n }\n\n parseRange (range) {\n range = range.trim()\n\n // memoize range parsing for performance.\n // this is a very hot path, and fully deterministic.\n const memoOpts =\n (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) |\n (this.options.loose && FLAG_LOOSE)\n const memoKey = memoOpts + ':' + range\n const cached = cache.get(memoKey)\n if (cached) {\n return cached\n }\n\n const loose = this.options.loose\n // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`\n const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]\n range = range.replace(hr, hyphenReplace(this.options.includePrerelease))\n debug('hyphen replace', range)\n // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`\n range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace)\n debug('comparator trim', range)\n\n // `~ 1.2.3` => `~1.2.3`\n range = range.replace(re[t.TILDETRIM], tildeTrimReplace)\n\n // `^ 1.2.3` => `^1.2.3`\n range = range.replace(re[t.CARETTRIM], caretTrimReplace)\n\n // normalize spaces\n range = range.split(/\\s+/).join(' ')\n\n // At this point, the range is completely trimmed and\n // ready to be split into comparators.\n\n let rangeList = range\n .split(' ')\n .map(comp => parseComparator(comp, this.options))\n .join(' ')\n .split(/\\s+/)\n // >=0.0.0 is equivalent to *\n .map(comp => replaceGTE0(comp, this.options))\n\n if (loose) {\n // in loose mode, throw out any that are not valid comparators\n rangeList = rangeList.filter(comp => {\n debug('loose invalid filter', comp, this.options)\n return !!comp.match(re[t.COMPARATORLOOSE])\n })\n }\n debug('range list', rangeList)\n\n // if any comparators are the null set, then replace with JUST null set\n // if more than one comparator, remove any * comparators\n // also, don't include the same comparator more than once\n const rangeMap = new Map()\n const comparators = rangeList.map(comp => new Comparator(comp, this.options))\n for (const comp of comparators) {\n if (isNullSet(comp)) {\n return [comp]\n }\n rangeMap.set(comp.value, comp)\n }\n if (rangeMap.size > 1 && rangeMap.has('')) {\n rangeMap.delete('')\n }\n\n const result = [...rangeMap.values()]\n cache.set(memoKey, result)\n return result\n }\n\n intersects (range, options) {\n if (!(range instanceof Range)) {\n throw new TypeError('a Range is required')\n }\n\n return this.set.some((thisComparators) => {\n return (\n isSatisfiable(thisComparators, options) &&\n range.set.some((rangeComparators) => {\n return (\n isSatisfiable(rangeComparators, options) &&\n thisComparators.every((thisComparator) => {\n return rangeComparators.every((rangeComparator) => {\n return thisComparator.intersects(rangeComparator, options)\n })\n })\n )\n })\n )\n })\n }\n\n // if ANY of the sets match ALL of its comparators, then pass\n test (version) {\n if (!version) {\n return false\n }\n\n if (typeof version === 'string') {\n try {\n version = new SemVer(version, this.options)\n } catch (er) {\n return false\n }\n }\n\n for (let i = 0; i < this.set.length; i++) {\n if (testSet(this.set[i], version, this.options)) {\n return true\n }\n }\n return false\n }\n}\n\nmodule.exports = Range\n\nconst LRU = require('lru-cache')\nconst cache = new LRU({ max: 1000 })\n\nconst parseOptions = require('../internal/parse-options')\nconst Comparator = require('./comparator')\nconst debug = require('../internal/debug')\nconst SemVer = require('./semver')\nconst {\n re,\n t,\n comparatorTrimReplace,\n tildeTrimReplace,\n caretTrimReplace,\n} = require('../internal/re')\nconst { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require('../internal/constants')\n\nconst isNullSet = c => c.value === '<0.0.0-0'\nconst isAny = c => c.value === ''\n\n// take a set of comparators and determine whether there\n// exists a version which can satisfy it\nconst isSatisfiable = (comparators, options) => {\n let result = true\n const remainingComparators = comparators.slice()\n let testComparator = remainingComparators.pop()\n\n while (result && remainingComparators.length) {\n result = remainingComparators.every((otherComparator) => {\n return testComparator.intersects(otherComparator, options)\n })\n\n testComparator = remainingComparators.pop()\n }\n\n return result\n}\n\n// comprised of xranges, tildes, stars, and gtlt's at this point.\n// already replaced the hyphen ranges\n// turn into a set of JUST comparators.\nconst parseComparator = (comp, options) => {\n debug('comp', comp, options)\n comp = replaceCarets(comp, options)\n debug('caret', comp)\n comp = replaceTildes(comp, options)\n debug('tildes', comp)\n comp = replaceXRanges(comp, options)\n debug('xrange', comp)\n comp = replaceStars(comp, options)\n debug('stars', comp)\n return comp\n}\n\nconst isX = id => !id || id.toLowerCase() === 'x' || id === '*'\n\n// ~, ~> --> * (any, kinda silly)\n// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0\n// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0\n// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0\n// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0\n// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0\n// ~0.0.1 --> >=0.0.1 <0.1.0-0\nconst replaceTildes = (comp, options) =>\n comp.trim().split(/\\s+/).map((c) => {\n return replaceTilde(c, options)\n }).join(' ')\n\nconst replaceTilde = (comp, options) => {\n const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]\n return comp.replace(r, (_, M, m, p, pr) => {\n debug('tilde', comp, _, M, m, p, pr)\n let ret\n\n if (isX(M)) {\n ret = ''\n } else if (isX(m)) {\n ret = `>=${M}.0.0 <${+M + 1}.0.0-0`\n } else if (isX(p)) {\n // ~1.2 == >=1.2.0 <1.3.0-0\n ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`\n } else if (pr) {\n debug('replaceTilde pr', pr)\n ret = `>=${M}.${m}.${p}-${pr\n } <${M}.${+m + 1}.0-0`\n } else {\n // ~1.2.3 == >=1.2.3 <1.3.0-0\n ret = `>=${M}.${m}.${p\n } <${M}.${+m + 1}.0-0`\n }\n\n debug('tilde return', ret)\n return ret\n })\n}\n\n// ^ --> * (any, kinda silly)\n// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0\n// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0\n// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0\n// ^1.2.3 --> >=1.2.3 <2.0.0-0\n// ^1.2.0 --> >=1.2.0 <2.0.0-0\n// ^0.0.1 --> >=0.0.1 <0.0.2-0\n// ^0.1.0 --> >=0.1.0 <0.2.0-0\nconst replaceCarets = (comp, options) =>\n comp.trim().split(/\\s+/).map((c) => {\n return replaceCaret(c, options)\n }).join(' ')\n\nconst replaceCaret = (comp, options) => {\n debug('caret', comp, options)\n const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]\n const z = options.includePrerelease ? '-0' : ''\n return comp.replace(r, (_, M, m, p, pr) => {\n debug('caret', comp, _, M, m, p, pr)\n let ret\n\n if (isX(M)) {\n ret = ''\n } else if (isX(m)) {\n ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`\n } else if (isX(p)) {\n if (M === '0') {\n ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`\n } else {\n ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`\n }\n } else if (pr) {\n debug('replaceCaret pr', pr)\n if (M === '0') {\n if (m === '0') {\n ret = `>=${M}.${m}.${p}-${pr\n } <${M}.${m}.${+p + 1}-0`\n } else {\n ret = `>=${M}.${m}.${p}-${pr\n } <${M}.${+m + 1}.0-0`\n }\n } else {\n ret = `>=${M}.${m}.${p}-${pr\n } <${+M + 1}.0.0-0`\n }\n } else {\n debug('no pr')\n if (M === '0') {\n if (m === '0') {\n ret = `>=${M}.${m}.${p\n }${z} <${M}.${m}.${+p + 1}-0`\n } else {\n ret = `>=${M}.${m}.${p\n }${z} <${M}.${+m + 1}.0-0`\n }\n } else {\n ret = `>=${M}.${m}.${p\n } <${+M + 1}.0.0-0`\n }\n }\n\n debug('caret return', ret)\n return ret\n })\n}\n\nconst replaceXRanges = (comp, options) => {\n debug('replaceXRanges', comp, options)\n return comp.split(/\\s+/).map((c) => {\n return replaceXRange(c, options)\n }).join(' ')\n}\n\nconst replaceXRange = (comp, options) => {\n comp = comp.trim()\n const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]\n return comp.replace(r, (ret, gtlt, M, m, p, pr) => {\n debug('xRange', comp, ret, gtlt, M, m, p, pr)\n const xM = isX(M)\n const xm = xM || isX(m)\n const xp = xm || isX(p)\n const anyX = xp\n\n if (gtlt === '=' && anyX) {\n gtlt = ''\n }\n\n // if we're including prereleases in the match, then we need\n // to fix this to -0, the lowest possible prerelease value\n pr = options.includePrerelease ? '-0' : ''\n\n if (xM) {\n if (gtlt === '>' || gtlt === '<') {\n // nothing is allowed\n ret = '<0.0.0-0'\n } else {\n // nothing is forbidden\n ret = '*'\n }\n } else if (gtlt && anyX) {\n // we know patch is an x, because we have any x at all.\n // replace X with 0\n if (xm) {\n m = 0\n }\n p = 0\n\n if (gtlt === '>') {\n // >1 => >=2.0.0\n // >1.2 => >=1.3.0\n gtlt = '>='\n if (xm) {\n M = +M + 1\n m = 0\n p = 0\n } else {\n m = +m + 1\n p = 0\n }\n } else if (gtlt === '<=') {\n // <=0.7.x is actually <0.8.0, since any 0.7.x should\n // pass. Similarly, <=7.x is actually <8.0.0, etc.\n gtlt = '<'\n if (xm) {\n M = +M + 1\n } else {\n m = +m + 1\n }\n }\n\n if (gtlt === '<') {\n pr = '-0'\n }\n\n ret = `${gtlt + M}.${m}.${p}${pr}`\n } else if (xm) {\n ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`\n } else if (xp) {\n ret = `>=${M}.${m}.0${pr\n } <${M}.${+m + 1}.0-0`\n }\n\n debug('xRange return', ret)\n\n return ret\n })\n}\n\n// Because * is AND-ed with everything else in the comparator,\n// and '' means \"any version\", just remove the *s entirely.\nconst replaceStars = (comp, options) => {\n debug('replaceStars', comp, options)\n // Looseness is ignored here. star is always as loose as it gets!\n return comp.trim().replace(re[t.STAR], '')\n}\n\nconst replaceGTE0 = (comp, options) => {\n debug('replaceGTE0', comp, options)\n return comp.trim()\n .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '')\n}\n\n// This function is passed to string.replace(re[t.HYPHENRANGE])\n// M, m, patch, prerelease, build\n// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5\n// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do\n// 1.2 - 3.4 => >=1.2.0 <3.5.0-0\nconst hyphenReplace = incPr => ($0,\n from, fM, fm, fp, fpr, fb,\n to, tM, tm, tp, tpr, tb) => {\n if (isX(fM)) {\n from = ''\n } else if (isX(fm)) {\n from = `>=${fM}.0.0${incPr ? '-0' : ''}`\n } else if (isX(fp)) {\n from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`\n } else if (fpr) {\n from = `>=${from}`\n } else {\n from = `>=${from}${incPr ? '-0' : ''}`\n }\n\n if (isX(tM)) {\n to = ''\n } else if (isX(tm)) {\n to = `<${+tM + 1}.0.0-0`\n } else if (isX(tp)) {\n to = `<${tM}.${+tm + 1}.0-0`\n } else if (tpr) {\n to = `<=${tM}.${tm}.${tp}-${tpr}`\n } else if (incPr) {\n to = `<${tM}.${tm}.${+tp + 1}-0`\n } else {\n to = `<=${to}`\n }\n\n return (`${from} ${to}`).trim()\n}\n\nconst testSet = (set, version, options) => {\n for (let i = 0; i < set.length; i++) {\n if (!set[i].test(version)) {\n return false\n }\n }\n\n if (version.prerelease.length && !options.includePrerelease) {\n // Find the set of versions that are allowed to have prereleases\n // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0\n // That should allow `1.2.3-pr.2` to pass.\n // However, `1.2.4-alpha.notready` should NOT be allowed,\n // even though it's within the range set by the comparators.\n for (let i = 0; i < set.length; i++) {\n debug(set[i].semver)\n if (set[i].semver === Comparator.ANY) {\n continue\n }\n\n if (set[i].semver.prerelease.length > 0) {\n const allowed = set[i].semver\n if (allowed.major === version.major &&\n allowed.minor === version.minor &&\n allowed.patch === version.patch) {\n return true\n }\n }\n }\n\n // Version has a -pre, but it's not one of the ones we like.\n return false\n }\n\n return true\n}\n"],"names":["range","require$$0","require$$1","require$$2","require$$3","require$$4","require$$5","require$$6"],"mappings":";;;;;;;;;;;;EACA,MAAM,MAAM;AAAA,IACV,YAAaA,QAAO,SAAS;AAC3B,gBAAU,aAAa,OAAO;AAE9B,UAAIA,kBAAiB,OAAO;AAC1B,YACEA,OAAM,UAAU,CAAC,CAAC,QAAQ,SAC1BA,OAAM,sBAAsB,CAAC,CAAC,QAAQ,mBACtC;AACA,iBAAOA;AAAA,QACf,OAAa;AACL,iBAAO,IAAI,MAAMA,OAAM,KAAK,OAAO;AAAA,QAC3C;AAAA,MACA;AAEI,UAAIA,kBAAiB,YAAY;AAE/B,aAAK,MAAMA,OAAM;AACjB,aAAK,MAAM,CAAC,CAACA,MAAK,CAAC;AACnB,aAAK,OAAM;AACX,eAAO;AAAA,MACb;AAEI,WAAK,UAAU;AACf,WAAK,QAAQ,CAAC,CAAC,QAAQ;AACvB,WAAK,oBAAoB,CAAC,CAAC,QAAQ;AAGnC,WAAK,MAAMA;AACX,WAAK,MAAMA,OACR,MAAM,IAAI,EAEV,IAAI,OAAK,KAAK,WAAW,EAAE,KAAI,CAAE,CAAC,EAIlC,OAAO,OAAK,EAAE,MAAM;AAEvB,UAAI,CAAC,KAAK,IAAI,QAAQ;AACpB,cAAM,IAAI,UAAU,yBAAyBA,MAAK,EAAE;AAAA,MAC1D;AAGI,UAAI,KAAK,IAAI,SAAS,GAAG;AAEvB,cAAM,QAAQ,KAAK,IAAI,CAAC;AACxB,aAAK,MAAM,KAAK,IAAI,OAAO,OAAK,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;AAChD,YAAI,KAAK,IAAI,WAAW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AQ,KAAK;AACnC,cAAM,IAAI,CAAC,EAAE,MAAM;AACnB,YAAI,IAAI,CAAC,EAAE,WAAW,WAAW,KAAK;AACpC;AAAA,QACR;AAEM,YAAI,IAAI,CAAC,EAAE,OAAO,WAAW,SAAS,GAAG;AACvC,gBAAM,UAAU,IAAI,CAAC,EAAE;AACvB,cAAI,QAAQ,UAAU,QAAQ,SAC1B,QAAQ,UAAU,QAAQ,SAC1B,QAAQ,UAAU,QAAQ,OAAO;AACnC,mBAAO;AAAA,UACjB;AAAA,QACA;AAAA,MACA;AAGI,aAAO;AAAA,IACX;AAEE,WAAO;AAAA,EACT;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const debug$1 = require("../internal/debug.cjs");
|
|
4
|
+
const constants = require("../internal/constants.cjs");
|
|
5
|
+
const re$1 = require("../internal/re.cjs");
|
|
6
|
+
const parseOptions$1 = require("../internal/parse-options.cjs");
|
|
7
|
+
const identifiers = require("../internal/identifiers.cjs");
|
|
8
|
+
const debug = debug$1.debug_1;
|
|
9
|
+
const { MAX_LENGTH, MAX_SAFE_INTEGER } = constants.constants;
|
|
10
|
+
const { re, t } = re$1.reExports;
|
|
11
|
+
const parseOptions = parseOptions$1.parseOptions_1;
|
|
12
|
+
const { compareIdentifiers } = identifiers.identifiers;
|
|
13
|
+
class SemVer {
|
|
14
|
+
constructor(version, options) {
|
|
15
|
+
options = parseOptions(options);
|
|
16
|
+
if (version instanceof SemVer) {
|
|
17
|
+
if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {
|
|
18
|
+
return version;
|
|
19
|
+
} else {
|
|
20
|
+
version = version.version;
|
|
21
|
+
}
|
|
22
|
+
} else if (typeof version !== "string") {
|
|
23
|
+
throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
|
|
24
|
+
}
|
|
25
|
+
if (version.length > MAX_LENGTH) {
|
|
26
|
+
throw new TypeError(
|
|
27
|
+
`version is longer than ${MAX_LENGTH} characters`
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
debug("SemVer", version, options);
|
|
31
|
+
this.options = options;
|
|
32
|
+
this.loose = !!options.loose;
|
|
33
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
34
|
+
const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
|
|
35
|
+
if (!m) {
|
|
36
|
+
throw new TypeError(`Invalid Version: ${version}`);
|
|
37
|
+
}
|
|
38
|
+
this.raw = version;
|
|
39
|
+
this.major = +m[1];
|
|
40
|
+
this.minor = +m[2];
|
|
41
|
+
this.patch = +m[3];
|
|
42
|
+
if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
|
|
43
|
+
throw new TypeError("Invalid major version");
|
|
44
|
+
}
|
|
45
|
+
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
|
|
46
|
+
throw new TypeError("Invalid minor version");
|
|
47
|
+
}
|
|
48
|
+
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
|
|
49
|
+
throw new TypeError("Invalid patch version");
|
|
50
|
+
}
|
|
51
|
+
if (!m[4]) {
|
|
52
|
+
this.prerelease = [];
|
|
53
|
+
} else {
|
|
54
|
+
this.prerelease = m[4].split(".").map((id) => {
|
|
55
|
+
if (/^[0-9]+$/.test(id)) {
|
|
56
|
+
const num = +id;
|
|
57
|
+
if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
|
58
|
+
return num;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return id;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
this.build = m[5] ? m[5].split(".") : [];
|
|
65
|
+
this.format();
|
|
66
|
+
}
|
|
67
|
+
format() {
|
|
68
|
+
this.version = `${this.major}.${this.minor}.${this.patch}`;
|
|
69
|
+
if (this.prerelease.length) {
|
|
70
|
+
this.version += `-${this.prerelease.join(".")}`;
|
|
71
|
+
}
|
|
72
|
+
return this.version;
|
|
73
|
+
}
|
|
74
|
+
toString() {
|
|
75
|
+
return this.version;
|
|
76
|
+
}
|
|
77
|
+
compare(other) {
|
|
78
|
+
debug("SemVer.compare", this.version, this.options, other);
|
|
79
|
+
if (!(other instanceof SemVer)) {
|
|
80
|
+
if (typeof other === "string" && other === this.version) {
|
|
81
|
+
return 0;
|
|
82
|
+
}
|
|
83
|
+
other = new SemVer(other, this.options);
|
|
84
|
+
}
|
|
85
|
+
if (other.version === this.version) {
|
|
86
|
+
return 0;
|
|
87
|
+
}
|
|
88
|
+
return this.compareMain(other) || this.comparePre(other);
|
|
89
|
+
}
|
|
90
|
+
compareMain(other) {
|
|
91
|
+
if (!(other instanceof SemVer)) {
|
|
92
|
+
other = new SemVer(other, this.options);
|
|
93
|
+
}
|
|
94
|
+
return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
|
|
95
|
+
}
|
|
96
|
+
comparePre(other) {
|
|
97
|
+
if (!(other instanceof SemVer)) {
|
|
98
|
+
other = new SemVer(other, this.options);
|
|
99
|
+
}
|
|
100
|
+
if (this.prerelease.length && !other.prerelease.length) {
|
|
101
|
+
return -1;
|
|
102
|
+
} else if (!this.prerelease.length && other.prerelease.length) {
|
|
103
|
+
return 1;
|
|
104
|
+
} else if (!this.prerelease.length && !other.prerelease.length) {
|
|
105
|
+
return 0;
|
|
106
|
+
}
|
|
107
|
+
let i = 0;
|
|
108
|
+
do {
|
|
109
|
+
const a = this.prerelease[i];
|
|
110
|
+
const b = other.prerelease[i];
|
|
111
|
+
debug("prerelease compare", i, a, b);
|
|
112
|
+
if (a === void 0 && b === void 0) {
|
|
113
|
+
return 0;
|
|
114
|
+
} else if (b === void 0) {
|
|
115
|
+
return 1;
|
|
116
|
+
} else if (a === void 0) {
|
|
117
|
+
return -1;
|
|
118
|
+
} else if (a === b) {
|
|
119
|
+
continue;
|
|
120
|
+
} else {
|
|
121
|
+
return compareIdentifiers(a, b);
|
|
122
|
+
}
|
|
123
|
+
} while (++i);
|
|
124
|
+
}
|
|
125
|
+
compareBuild(other) {
|
|
126
|
+
if (!(other instanceof SemVer)) {
|
|
127
|
+
other = new SemVer(other, this.options);
|
|
128
|
+
}
|
|
129
|
+
let i = 0;
|
|
130
|
+
do {
|
|
131
|
+
const a = this.build[i];
|
|
132
|
+
const b = other.build[i];
|
|
133
|
+
debug("prerelease compare", i, a, b);
|
|
134
|
+
if (a === void 0 && b === void 0) {
|
|
135
|
+
return 0;
|
|
136
|
+
} else if (b === void 0) {
|
|
137
|
+
return 1;
|
|
138
|
+
} else if (a === void 0) {
|
|
139
|
+
return -1;
|
|
140
|
+
} else if (a === b) {
|
|
141
|
+
continue;
|
|
142
|
+
} else {
|
|
143
|
+
return compareIdentifiers(a, b);
|
|
144
|
+
}
|
|
145
|
+
} while (++i);
|
|
146
|
+
}
|
|
147
|
+
// preminor will bump the version up to the next minor release, and immediately
|
|
148
|
+
// down to pre-release. premajor and prepatch work the same way.
|
|
149
|
+
inc(release, identifier, identifierBase) {
|
|
150
|
+
switch (release) {
|
|
151
|
+
case "premajor":
|
|
152
|
+
this.prerelease.length = 0;
|
|
153
|
+
this.patch = 0;
|
|
154
|
+
this.minor = 0;
|
|
155
|
+
this.major++;
|
|
156
|
+
this.inc("pre", identifier, identifierBase);
|
|
157
|
+
break;
|
|
158
|
+
case "preminor":
|
|
159
|
+
this.prerelease.length = 0;
|
|
160
|
+
this.patch = 0;
|
|
161
|
+
this.minor++;
|
|
162
|
+
this.inc("pre", identifier, identifierBase);
|
|
163
|
+
break;
|
|
164
|
+
case "prepatch":
|
|
165
|
+
this.prerelease.length = 0;
|
|
166
|
+
this.inc("patch", identifier, identifierBase);
|
|
167
|
+
this.inc("pre", identifier, identifierBase);
|
|
168
|
+
break;
|
|
169
|
+
case "prerelease":
|
|
170
|
+
if (this.prerelease.length === 0) {
|
|
171
|
+
this.inc("patch", identifier, identifierBase);
|
|
172
|
+
}
|
|
173
|
+
this.inc("pre", identifier, identifierBase);
|
|
174
|
+
break;
|
|
175
|
+
case "major":
|
|
176
|
+
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
|
|
177
|
+
this.major++;
|
|
178
|
+
}
|
|
179
|
+
this.minor = 0;
|
|
180
|
+
this.patch = 0;
|
|
181
|
+
this.prerelease = [];
|
|
182
|
+
break;
|
|
183
|
+
case "minor":
|
|
184
|
+
if (this.patch !== 0 || this.prerelease.length === 0) {
|
|
185
|
+
this.minor++;
|
|
186
|
+
}
|
|
187
|
+
this.patch = 0;
|
|
188
|
+
this.prerelease = [];
|
|
189
|
+
break;
|
|
190
|
+
case "patch":
|
|
191
|
+
if (this.prerelease.length === 0) {
|
|
192
|
+
this.patch++;
|
|
193
|
+
}
|
|
194
|
+
this.prerelease = [];
|
|
195
|
+
break;
|
|
196
|
+
case "pre": {
|
|
197
|
+
const base = Number(identifierBase) ? 1 : 0;
|
|
198
|
+
if (!identifier && identifierBase === false) {
|
|
199
|
+
throw new Error("invalid increment argument: identifier is empty");
|
|
200
|
+
}
|
|
201
|
+
if (this.prerelease.length === 0) {
|
|
202
|
+
this.prerelease = [base];
|
|
203
|
+
} else {
|
|
204
|
+
let i = this.prerelease.length;
|
|
205
|
+
while (--i >= 0) {
|
|
206
|
+
if (typeof this.prerelease[i] === "number") {
|
|
207
|
+
this.prerelease[i]++;
|
|
208
|
+
i = -2;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
if (i === -1) {
|
|
212
|
+
if (identifier === this.prerelease.join(".") && identifierBase === false) {
|
|
213
|
+
throw new Error("invalid increment argument: identifier already exists");
|
|
214
|
+
}
|
|
215
|
+
this.prerelease.push(base);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
if (identifier) {
|
|
219
|
+
let prerelease = [identifier, base];
|
|
220
|
+
if (identifierBase === false) {
|
|
221
|
+
prerelease = [identifier];
|
|
222
|
+
}
|
|
223
|
+
if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
|
|
224
|
+
if (isNaN(this.prerelease[1])) {
|
|
225
|
+
this.prerelease = prerelease;
|
|
226
|
+
}
|
|
227
|
+
} else {
|
|
228
|
+
this.prerelease = prerelease;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
233
|
+
default:
|
|
234
|
+
throw new Error(`invalid increment argument: ${release}`);
|
|
235
|
+
}
|
|
236
|
+
this.format();
|
|
237
|
+
this.raw = this.version;
|
|
238
|
+
return this;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
var semver = SemVer;
|
|
242
|
+
exports.semver = semver;
|
|
243
|
+
//# sourceMappingURL=semver.cjs.map
|