vlt 0.0.0-0.1727821659739 → 0.0.0-0.1728676223960

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/commands/exec.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import process from"node:process"
2
2
  import {Buffer} from"node:buffer"
3
3
  import {setImmediate, clearImmediate} from"node:timers"
4
- import {resolve as resolve_57b2860c9b55} from"node:path"
5
- import {pathToFileURL as pathToFileURL_57b2860c9b55} from"node:url"
6
- import {createRequire as createRequire_57b2860c9b55} from"node:module"
4
+ import {resolve as resolve_d37a7373e648} from"node:path"
5
+ import {pathToFileURL as pathToFileURL_d37a7373e648} from"node:url"
6
+ import {createRequire as createRequire_d37a7373e648} from"node:module"
7
7
  var global = globalThis
8
- var __bundleDirname_57b2860c9b55 = resolve_57b2860c9b55(import.meta.dirname, "..")
9
- var __bundleFilename_57b2860c9b55 = resolve_57b2860c9b55(__bundleDirname_57b2860c9b55, "exec.js")
10
- var __bundleUrl_57b2860c9b55 = pathToFileURL_57b2860c9b55(__bundleFilename_57b2860c9b55).toString()
11
- var require = createRequire_57b2860c9b55(__bundleFilename_57b2860c9b55)
8
+ var __bundleDirname_d37a7373e648 = resolve_d37a7373e648(import.meta.dirname, "..")
9
+ var __bundleFilename_d37a7373e648 = resolve_d37a7373e648(__bundleDirname_d37a7373e648, "exec.js")
10
+ var __bundleUrl_d37a7373e648 = pathToFileURL_d37a7373e648(__bundleFilename_d37a7373e648).toString()
11
+ var require = createRequire_d37a7373e648(__bundleFilename_d37a7373e648)
12
12
  var __create = Object.create;
13
13
  var __defProp = Object.defineProperty;
14
14
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1899,15 +1899,17 @@ var Comparator = class {
1899
1899
  });
1900
1900
  const comps = [];
1901
1901
  let followingOperator = false;
1902
+ let l = 0;
1902
1903
  for (const c of rawComps) {
1903
1904
  if (c === "")
1904
1905
  continue;
1905
1906
  if (!followingOperator) {
1906
1907
  followingOperator = isOperator(c);
1907
1908
  comps.push(c);
1909
+ l++;
1908
1910
  continue;
1909
1911
  }
1910
- comps[comps.length - 1] += c;
1912
+ comps[l - 1] += c;
1911
1913
  followingOperator = false;
1912
1914
  }
1913
1915
  if (hyphen) {
@@ -1940,8 +1942,7 @@ var Comparator = class {
1940
1942
  const [M, m = 0, p = 0, pr = z, build] = this.#parseX(raw);
1941
1943
  return M === void 0 ? this.#getComparatorAny() : [">=", new Version(raw, M, m, p, pr, build)];
1942
1944
  }
1943
- // exclusive min.
1944
- // Note, if not a full version, then
1945
+ // exclusive min
1945
1946
  #xExclusiveMin(raw) {
1946
1947
  const parsed = this.#parseX(raw);
1947
1948
  if (isFullVersion(parsed)) {
@@ -1966,22 +1967,13 @@ var Comparator = class {
1966
1967
  }
1967
1968
  #xInclusiveMax(raw) {
1968
1969
  const parsed = this.#parseX(raw);
1969
- if (isFullVersion(parsed)) {
1970
- return ["<=", new Version(raw, ...parsed)];
1971
- }
1972
- if (isXPatch(parsed)) {
1973
- return [
1974
- "<",
1975
- new Version(raw, parsed[MAJOR], parsed[MINOR] + 1, 0, "0", void 0)
1976
- ];
1977
- }
1978
- if (isXMinor(parsed)) {
1979
- return [
1980
- "<",
1981
- new Version(raw, parsed[MAJOR] + 1, 0, 0, "0", void 0)
1982
- ];
1983
- }
1984
- return this.#getComparatorAny();
1970
+ return isFullVersion(parsed) ? ["<=", new Version(raw, ...parsed)] : isXPatch(parsed) ? [
1971
+ "<",
1972
+ new Version(raw, parsed[MAJOR], parsed[MINOR] + 1, 0, "0", void 0)
1973
+ ] : isXMinor(parsed) ? [
1974
+ "<",
1975
+ new Version(raw, parsed[MAJOR] + 1, 0, 0, "0", void 0)
1976
+ ] : this.#getComparatorAny();
1985
1977
  }
1986
1978
  #xExclusiveMax(raw) {
1987
1979
  const z = this.includePrerelease ? "0" : void 0;
@@ -1993,85 +1985,80 @@ var Comparator = class {
1993
1985
  }
1994
1986
  return ["<", new Version(raw, M, m, p, pr, build)];
1995
1987
  }
1996
- // pull the relevant values out of an X-range or version
1997
- // return the fields for creating a Version object.
1998
- // only call once operator is stripped off
1999
- #parseX(raw) {
2000
- let [M, m, p] = fastSplit(raw, ".", 3);
2001
- let prune = 0;
2002
- while (M && preJunk.has(M.charAt(prune)))
2003
- prune++;
2004
- if (M !== void 0 && prune !== 0)
2005
- M = M.substring(prune);
2006
- if (isX(M) || !M) {
2007
- assertMissing(m, raw, "major");
2008
- assertMissing(p, raw, "major");
2009
- if (m === "" || p === "") {
2010
- throw invalidComp(raw, `(Did you mean '*'?)`);
2011
- }
2012
- return [];
1988
+ #validXM(raw, m, p) {
1989
+ assertMissing(m, raw, "major");
1990
+ assertMissing(p, raw, "major");
1991
+ if (m === "" || p === "") {
1992
+ throw invalidComp(raw, `(Did you mean '*'?)`);
2013
1993
  }
2014
- if (isX(m) || !m) {
2015
- assertMissing(p, raw, "major");
2016
- if (m === "" || p === "") {
2017
- throw invalidComp(raw, `(Did you mean '${M}'?)`);
2018
- }
2019
- return [assertNumber(M, raw, "major")];
1994
+ return [];
1995
+ }
1996
+ #validXm(raw, M, m, p) {
1997
+ assertMissing(p, raw, "major");
1998
+ if (m === "" || p === "") {
1999
+ throw invalidComp(raw, `(Did you mean '${M}'?)`);
2020
2000
  }
2021
- if (isX(p) || !p) {
2022
- if (p === "") {
2023
- throw invalidComp(raw, `(Did you mean '${M}.${m}'?)`);
2024
- }
2025
- return [
2026
- assertNumber(M, raw, "major"),
2027
- assertNumber(m, raw, "minor")
2028
- ];
2001
+ return [assertNumber(M, raw, "major")];
2002
+ }
2003
+ #validXp(raw, M, m, p) {
2004
+ if (p === "") {
2005
+ throw invalidComp(raw, `(Did you mean '${M}.${m}'?)`);
2029
2006
  }
2030
- const hy = p.indexOf("-");
2031
- const pl = p.indexOf("+");
2032
- if (pl === -1 && hy === -1) {
2033
- return [
2034
- assertNumber(M, raw, "major"),
2035
- assertNumber(m, raw, "minor"),
2036
- assertNumber(p, raw, "patch")
2037
- ];
2007
+ return [
2008
+ assertNumber(M, raw, "major"),
2009
+ assertNumber(m, raw, "minor")
2010
+ ];
2011
+ }
2012
+ #validTuple(raw, M, m, p) {
2013
+ return [
2014
+ assertNumber(M, raw, "major"),
2015
+ assertNumber(m, raw, "minor"),
2016
+ assertNumber(p, raw, "patch")
2017
+ ];
2018
+ }
2019
+ #validXbuild(raw, M, m, p, pl) {
2020
+ const patch = p.substring(0, pl);
2021
+ const build = p.substring(pl + 1);
2022
+ if (!patch) {
2023
+ throw invalidComp(raw, "cannot specify build without patch");
2038
2024
  }
2039
- if (hy === -1) {
2040
- const [patch2, build2] = fastSplit(p, "+", 2);
2041
- if (!patch2) {
2042
- throw invalidComp(raw, "cannot specify build without patch");
2043
- }
2044
- if (!build2) {
2045
- throw invalidComp(raw, `encountered '+', but no build value`);
2046
- }
2047
- return [
2048
- assertNumber(M, raw, "major"),
2049
- assertNumber(m, raw, "minor"),
2050
- assertNumber(patch2, raw, "patch"),
2051
- void 0,
2052
- build2
2053
- ];
2025
+ if (!build) {
2026
+ throw invalidComp(raw, `encountered '+', but no build value`);
2054
2027
  }
2055
- if (pl === -1) {
2056
- const [patch2, pr2] = fastSplit(p, "-", 2);
2057
- if (!patch2) {
2028
+ return [
2029
+ assertNumber(M, raw, "major"),
2030
+ assertNumber(m, raw, "minor"),
2031
+ assertNumber(patch, raw, "patch"),
2032
+ void 0,
2033
+ build
2034
+ ];
2035
+ }
2036
+ #validXpr(raw, M, m, p, hy) {
2037
+ {
2038
+ const patch = p.substring(0, hy);
2039
+ const pr = p.substring(hy + 1);
2040
+ if (!patch) {
2058
2041
  throw invalidComp(raw, "cannot specify prerelease without patch");
2059
2042
  }
2060
- if (!pr2) {
2043
+ if (!pr) {
2061
2044
  throw invalidComp(raw, `encountered '-', but no prerelease value`);
2062
2045
  }
2063
2046
  return [
2064
2047
  assertNumber(M, raw, "major"),
2065
2048
  assertNumber(m, raw, "minor"),
2066
- assertNumber(patch2, raw, "patch"),
2067
- pr2
2049
+ assertNumber(patch, raw, "patch"),
2050
+ pr,
2051
+ void 0
2068
2052
  ];
2069
2053
  }
2070
- const [patch, trailers = ""] = fastSplit(p, "-", 2);
2054
+ }
2055
+ #validXprbuild(raw, M, m, p, hy, pl) {
2056
+ const patch = p.substring(0, hy);
2057
+ const pr = p.substring(hy + 1, pl);
2058
+ const build = p.substring(pl + 1);
2071
2059
  if (!patch) {
2072
2060
  throw invalidComp(raw, "cannot specify prerelease without patch");
2073
2061
  }
2074
- const [pr, build] = fastSplit(trailers, "+", 2);
2075
2062
  if (!pr) {
2076
2063
  throw invalidComp(raw, `encountered '-', but no prerelease value`);
2077
2064
  }
@@ -2086,12 +2073,45 @@ var Comparator = class {
2086
2073
  build
2087
2074
  ];
2088
2075
  }
2076
+ // pull the relevant values out of an X-range or version
2077
+ // return the fields for creating a Version object.
2078
+ // only call once operator is stripped off
2079
+ #parseX(raw) {
2080
+ let [M, m, p] = fastSplit(raw, ".", 3);
2081
+ let prune = 0;
2082
+ while (M && preJunk.has(M.charAt(prune)))
2083
+ prune++;
2084
+ if (M !== void 0 && prune !== 0)
2085
+ M = M.substring(prune);
2086
+ if (!M || isX(M))
2087
+ return this.#validXM(raw, m, p);
2088
+ if (!m || isX(m))
2089
+ return this.#validXm(raw, M, m, p);
2090
+ if (!p || isX(p))
2091
+ return this.#validXp(raw, M, m, p);
2092
+ const hy = p.indexOf("-");
2093
+ const pl = p.indexOf("+");
2094
+ if (pl === -1 && hy === -1)
2095
+ return this.#validTuple(raw, M, m, p);
2096
+ if (pl === -1)
2097
+ return this.#validXpr(raw, M, m, p, hy);
2098
+ if (hy === -1)
2099
+ return this.#validXbuild(raw, M, m, p, pl);
2100
+ return this.#validXprbuild(raw, M, m, p, hy, pl);
2101
+ }
2089
2102
  #parseHyphenRange(min, max) {
2090
2103
  const minv = this.#xInclusiveMin(min);
2091
2104
  const maxv = this.#xInclusiveMax(max);
2092
2105
  const minAny = isAny(minv);
2093
2106
  const maxAny = isAny(maxv);
2094
- return minAny && maxAny ? this.tuples.push(this.#getComparatorAny()) : maxAny ? this.tuples.push(minv) : minAny ? this.tuples.push(maxv) : this.tuples.push(minv, maxv);
2107
+ if (minAny && maxAny)
2108
+ this.tuples.push(this.#getComparatorAny());
2109
+ else if (minAny)
2110
+ this.tuples.push(maxv);
2111
+ else if (maxAny)
2112
+ this.tuples.push(minv);
2113
+ else
2114
+ this.tuples.push(minv, maxv);
2095
2115
  }
2096
2116
  #parse(comp) {
2097
2117
  const first = comp.charAt(0);
@@ -2107,7 +2127,7 @@ var Comparator = class {
2107
2127
  return this.tuples.push(this.#xInclusiveMin(v2));
2108
2128
  case "<=":
2109
2129
  assertVersion(v2, comp);
2110
- return this.tuples.push(this.#xInclusiveMax(comp.substring(2)));
2130
+ return this.tuples.push(this.#xInclusiveMax(v2));
2111
2131
  }
2112
2132
  switch (first) {
2113
2133
  case "~":
@@ -2118,10 +2138,10 @@ var Comparator = class {
2118
2138
  return this.#parseCaret(v1);
2119
2139
  case ">":
2120
2140
  assertVersion(v1, comp);
2121
- return this.tuples.push(this.#xExclusiveMin(comp.substring(1)));
2141
+ return this.tuples.push(this.#xExclusiveMin(v1));
2122
2142
  case "<":
2123
2143
  assertVersion(v1, comp);
2124
- return this.tuples.push(this.#xExclusiveMax(comp.substring(1)));
2144
+ return this.tuples.push(this.#xExclusiveMax(v1));
2125
2145
  }
2126
2146
  return this.#parseEq(comp);
2127
2147
  }
@@ -2175,12 +2195,16 @@ var Comparator = class {
2175
2195
  #parseEq(comp) {
2176
2196
  const parsed = this.#parseX(comp);
2177
2197
  const z = this.includePrerelease ? "0" : void 0;
2178
- if (isXMajor(parsed)) {
2179
- this.tuples.push(this.#getComparatorAny());
2180
- } else if (isFullVersion(parsed)) {
2198
+ if (isFullVersion(parsed)) {
2181
2199
  this.tuples.push(["", new Version(comp, ...parsed)]);
2200
+ } else if (isXMajor(parsed)) {
2201
+ this.tuples.push(this.#getComparatorAny());
2182
2202
  } else if (isXMinor(parsed)) {
2183
- this.tuples.push([">=", new Version(comp, parsed[MAJOR], 0, 0, z, void 0)], [
2203
+ this.tuples.push([
2204
+ ">=",
2205
+ new Version(comp, parsed[MAJOR], 0, 0, z, void 0)
2206
+ ]);
2207
+ this.tuples.push([
2184
2208
  "<",
2185
2209
  new Version(comp, parsed[MAJOR] + 1, 0, 0, "0", void 0)
2186
2210
  ]);
@@ -2278,13 +2302,26 @@ var Range = class {
2278
2302
  constructor(range, includePrerelease = false) {
2279
2303
  this.raw = range;
2280
2304
  this.includePrerelease = includePrerelease;
2281
- fastSplit(range, "||", -1, (part) => this.set.push(new Comparator(part, this.includePrerelease)));
2282
- this.isAny = this.set.some((c) => c.isAny);
2283
- const cmp = this.set[0];
2284
- this.isSingle = this.set.length === 1 && !!cmp && Array.isArray(cmp.tuples) && cmp.tuples.length === 1 && Array.isArray(cmp.tuples[0]) && cmp.tuples[0][0] === "";
2285
- if (this.isSingle) {
2286
- this.#toString = String(cmp);
2287
- }
2305
+ this.isAny = false;
2306
+ let isFirst = true;
2307
+ this.isSingle = false;
2308
+ fastSplit(range, "||", -1, (part) => {
2309
+ if (this.isAny)
2310
+ return;
2311
+ const cmp = new Comparator(part, this.includePrerelease);
2312
+ if (cmp.isAny) {
2313
+ this.set = [cmp];
2314
+ this.isAny = true;
2315
+ return;
2316
+ }
2317
+ this.set.push(cmp);
2318
+ if (!isFirst)
2319
+ this.isSingle = false;
2320
+ else if (Array.isArray(cmp.tuples) && cmp.tuples.length === 1 && Array.isArray(cmp.tuples[0]) && cmp.tuples[0][0] === "") {
2321
+ this.isSingle = true;
2322
+ }
2323
+ isFirst = false;
2324
+ });
2288
2325
  }
2289
2326
  /**
2290
2327
  * test a {@link Version} against the range
@@ -2296,6 +2333,10 @@ var Range = class {
2296
2333
  toString() {
2297
2334
  if (this.#toString)
2298
2335
  return this.#toString;
2336
+ if (this.isSingle) {
2337
+ this.#toString = String(this.set[0]);
2338
+ return this.#toString;
2339
+ }
2299
2340
  this.#toString = this.set.map((c) => String(c)).join(" || ");
2300
2341
  return this.#toString;
2301
2342
  }