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.
@@ -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_cec0e35feb25} from"node:path"
5
- import {pathToFileURL as pathToFileURL_cec0e35feb25} from"node:url"
6
- import {createRequire as createRequire_cec0e35feb25} from"node:module"
4
+ import {resolve as resolve_3d0e31809e8b} from"node:path"
5
+ import {pathToFileURL as pathToFileURL_3d0e31809e8b} from"node:url"
6
+ import {createRequire as createRequire_3d0e31809e8b} from"node:module"
7
7
  var global = globalThis
8
- var __bundleDirname_cec0e35feb25 = resolve_cec0e35feb25(import.meta.dirname, "..")
9
- var __bundleFilename_cec0e35feb25 = resolve_cec0e35feb25(__bundleDirname_cec0e35feb25, "run-exec.js")
10
- var __bundleUrl_cec0e35feb25 = pathToFileURL_cec0e35feb25(__bundleFilename_cec0e35feb25).toString()
11
- var require = createRequire_cec0e35feb25(__bundleFilename_cec0e35feb25)
8
+ var __bundleDirname_3d0e31809e8b = resolve_3d0e31809e8b(import.meta.dirname, "..")
9
+ var __bundleFilename_3d0e31809e8b = resolve_3d0e31809e8b(__bundleDirname_3d0e31809e8b, "run-exec.js")
10
+ var __bundleUrl_3d0e31809e8b = pathToFileURL_3d0e31809e8b(__bundleFilename_3d0e31809e8b).toString()
11
+ var require = createRequire_3d0e31809e8b(__bundleFilename_3d0e31809e8b)
12
12
  var __create = Object.create;
13
13
  var __defProp = Object.defineProperty;
14
14
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1993,15 +1993,17 @@ var Comparator = class {
1993
1993
  });
1994
1994
  const comps = [];
1995
1995
  let followingOperator = false;
1996
+ let l = 0;
1996
1997
  for (const c of rawComps) {
1997
1998
  if (c === "")
1998
1999
  continue;
1999
2000
  if (!followingOperator) {
2000
2001
  followingOperator = isOperator(c);
2001
2002
  comps.push(c);
2003
+ l++;
2002
2004
  continue;
2003
2005
  }
2004
- comps[comps.length - 1] += c;
2006
+ comps[l - 1] += c;
2005
2007
  followingOperator = false;
2006
2008
  }
2007
2009
  if (hyphen) {
@@ -2034,8 +2036,7 @@ var Comparator = class {
2034
2036
  const [M, m = 0, p = 0, pr = z, build] = this.#parseX(raw);
2035
2037
  return M === void 0 ? this.#getComparatorAny() : [">=", new Version(raw, M, m, p, pr, build)];
2036
2038
  }
2037
- // exclusive min.
2038
- // Note, if not a full version, then
2039
+ // exclusive min
2039
2040
  #xExclusiveMin(raw) {
2040
2041
  const parsed = this.#parseX(raw);
2041
2042
  if (isFullVersion(parsed)) {
@@ -2060,22 +2061,13 @@ var Comparator = class {
2060
2061
  }
2061
2062
  #xInclusiveMax(raw) {
2062
2063
  const parsed = this.#parseX(raw);
2063
- if (isFullVersion(parsed)) {
2064
- return ["<=", new Version(raw, ...parsed)];
2065
- }
2066
- if (isXPatch(parsed)) {
2067
- return [
2068
- "<",
2069
- new Version(raw, parsed[MAJOR], parsed[MINOR] + 1, 0, "0", void 0)
2070
- ];
2071
- }
2072
- if (isXMinor(parsed)) {
2073
- return [
2074
- "<",
2075
- new Version(raw, parsed[MAJOR] + 1, 0, 0, "0", void 0)
2076
- ];
2077
- }
2078
- return this.#getComparatorAny();
2064
+ return isFullVersion(parsed) ? ["<=", new Version(raw, ...parsed)] : isXPatch(parsed) ? [
2065
+ "<",
2066
+ new Version(raw, parsed[MAJOR], parsed[MINOR] + 1, 0, "0", void 0)
2067
+ ] : isXMinor(parsed) ? [
2068
+ "<",
2069
+ new Version(raw, parsed[MAJOR] + 1, 0, 0, "0", void 0)
2070
+ ] : this.#getComparatorAny();
2079
2071
  }
2080
2072
  #xExclusiveMax(raw) {
2081
2073
  const z = this.includePrerelease ? "0" : void 0;
@@ -2087,85 +2079,80 @@ var Comparator = class {
2087
2079
  }
2088
2080
  return ["<", new Version(raw, M, m, p, pr, build)];
2089
2081
  }
2090
- // pull the relevant values out of an X-range or version
2091
- // return the fields for creating a Version object.
2092
- // only call once operator is stripped off
2093
- #parseX(raw) {
2094
- let [M, m, p] = fastSplit(raw, ".", 3);
2095
- let prune = 0;
2096
- while (M && preJunk.has(M.charAt(prune)))
2097
- prune++;
2098
- if (M !== void 0 && prune !== 0)
2099
- M = M.substring(prune);
2100
- if (isX(M) || !M) {
2101
- assertMissing(m, raw, "major");
2102
- assertMissing(p, raw, "major");
2103
- if (m === "" || p === "") {
2104
- throw invalidComp(raw, `(Did you mean '*'?)`);
2105
- }
2106
- return [];
2082
+ #validXM(raw, m, p) {
2083
+ assertMissing(m, raw, "major");
2084
+ assertMissing(p, raw, "major");
2085
+ if (m === "" || p === "") {
2086
+ throw invalidComp(raw, `(Did you mean '*'?)`);
2107
2087
  }
2108
- if (isX(m) || !m) {
2109
- assertMissing(p, raw, "major");
2110
- if (m === "" || p === "") {
2111
- throw invalidComp(raw, `(Did you mean '${M}'?)`);
2112
- }
2113
- return [assertNumber(M, raw, "major")];
2088
+ return [];
2089
+ }
2090
+ #validXm(raw, M, m, p) {
2091
+ assertMissing(p, raw, "major");
2092
+ if (m === "" || p === "") {
2093
+ throw invalidComp(raw, `(Did you mean '${M}'?)`);
2114
2094
  }
2115
- if (isX(p) || !p) {
2116
- if (p === "") {
2117
- throw invalidComp(raw, `(Did you mean '${M}.${m}'?)`);
2118
- }
2119
- return [
2120
- assertNumber(M, raw, "major"),
2121
- assertNumber(m, raw, "minor")
2122
- ];
2095
+ return [assertNumber(M, raw, "major")];
2096
+ }
2097
+ #validXp(raw, M, m, p) {
2098
+ if (p === "") {
2099
+ throw invalidComp(raw, `(Did you mean '${M}.${m}'?)`);
2123
2100
  }
2124
- const hy = p.indexOf("-");
2125
- const pl = p.indexOf("+");
2126
- if (pl === -1 && hy === -1) {
2127
- return [
2128
- assertNumber(M, raw, "major"),
2129
- assertNumber(m, raw, "minor"),
2130
- assertNumber(p, raw, "patch")
2131
- ];
2101
+ return [
2102
+ assertNumber(M, raw, "major"),
2103
+ assertNumber(m, raw, "minor")
2104
+ ];
2105
+ }
2106
+ #validTuple(raw, M, m, p) {
2107
+ return [
2108
+ assertNumber(M, raw, "major"),
2109
+ assertNumber(m, raw, "minor"),
2110
+ assertNumber(p, raw, "patch")
2111
+ ];
2112
+ }
2113
+ #validXbuild(raw, M, m, p, pl) {
2114
+ const patch = p.substring(0, pl);
2115
+ const build = p.substring(pl + 1);
2116
+ if (!patch) {
2117
+ throw invalidComp(raw, "cannot specify build without patch");
2132
2118
  }
2133
- if (hy === -1) {
2134
- const [patch2, build2] = fastSplit(p, "+", 2);
2135
- if (!patch2) {
2136
- throw invalidComp(raw, "cannot specify build without patch");
2137
- }
2138
- if (!build2) {
2139
- throw invalidComp(raw, `encountered '+', but no build value`);
2140
- }
2141
- return [
2142
- assertNumber(M, raw, "major"),
2143
- assertNumber(m, raw, "minor"),
2144
- assertNumber(patch2, raw, "patch"),
2145
- void 0,
2146
- build2
2147
- ];
2119
+ if (!build) {
2120
+ throw invalidComp(raw, `encountered '+', but no build value`);
2148
2121
  }
2149
- if (pl === -1) {
2150
- const [patch2, pr2] = fastSplit(p, "-", 2);
2151
- if (!patch2) {
2122
+ return [
2123
+ assertNumber(M, raw, "major"),
2124
+ assertNumber(m, raw, "minor"),
2125
+ assertNumber(patch, raw, "patch"),
2126
+ void 0,
2127
+ build
2128
+ ];
2129
+ }
2130
+ #validXpr(raw, M, m, p, hy) {
2131
+ {
2132
+ const patch = p.substring(0, hy);
2133
+ const pr = p.substring(hy + 1);
2134
+ if (!patch) {
2152
2135
  throw invalidComp(raw, "cannot specify prerelease without patch");
2153
2136
  }
2154
- if (!pr2) {
2137
+ if (!pr) {
2155
2138
  throw invalidComp(raw, `encountered '-', but no prerelease value`);
2156
2139
  }
2157
2140
  return [
2158
2141
  assertNumber(M, raw, "major"),
2159
2142
  assertNumber(m, raw, "minor"),
2160
- assertNumber(patch2, raw, "patch"),
2161
- pr2
2143
+ assertNumber(patch, raw, "patch"),
2144
+ pr,
2145
+ void 0
2162
2146
  ];
2163
2147
  }
2164
- const [patch, trailers = ""] = fastSplit(p, "-", 2);
2148
+ }
2149
+ #validXprbuild(raw, M, m, p, hy, pl) {
2150
+ const patch = p.substring(0, hy);
2151
+ const pr = p.substring(hy + 1, pl);
2152
+ const build = p.substring(pl + 1);
2165
2153
  if (!patch) {
2166
2154
  throw invalidComp(raw, "cannot specify prerelease without patch");
2167
2155
  }
2168
- const [pr, build] = fastSplit(trailers, "+", 2);
2169
2156
  if (!pr) {
2170
2157
  throw invalidComp(raw, `encountered '-', but no prerelease value`);
2171
2158
  }
@@ -2180,12 +2167,45 @@ var Comparator = class {
2180
2167
  build
2181
2168
  ];
2182
2169
  }
2170
+ // pull the relevant values out of an X-range or version
2171
+ // return the fields for creating a Version object.
2172
+ // only call once operator is stripped off
2173
+ #parseX(raw) {
2174
+ let [M, m, p] = fastSplit(raw, ".", 3);
2175
+ let prune = 0;
2176
+ while (M && preJunk.has(M.charAt(prune)))
2177
+ prune++;
2178
+ if (M !== void 0 && prune !== 0)
2179
+ M = M.substring(prune);
2180
+ if (!M || isX(M))
2181
+ return this.#validXM(raw, m, p);
2182
+ if (!m || isX(m))
2183
+ return this.#validXm(raw, M, m, p);
2184
+ if (!p || isX(p))
2185
+ return this.#validXp(raw, M, m, p);
2186
+ const hy = p.indexOf("-");
2187
+ const pl = p.indexOf("+");
2188
+ if (pl === -1 && hy === -1)
2189
+ return this.#validTuple(raw, M, m, p);
2190
+ if (pl === -1)
2191
+ return this.#validXpr(raw, M, m, p, hy);
2192
+ if (hy === -1)
2193
+ return this.#validXbuild(raw, M, m, p, pl);
2194
+ return this.#validXprbuild(raw, M, m, p, hy, pl);
2195
+ }
2183
2196
  #parseHyphenRange(min, max) {
2184
2197
  const minv = this.#xInclusiveMin(min);
2185
2198
  const maxv = this.#xInclusiveMax(max);
2186
2199
  const minAny = isAny(minv);
2187
2200
  const maxAny = isAny(maxv);
2188
- return minAny && maxAny ? this.tuples.push(this.#getComparatorAny()) : maxAny ? this.tuples.push(minv) : minAny ? this.tuples.push(maxv) : this.tuples.push(minv, maxv);
2201
+ if (minAny && maxAny)
2202
+ this.tuples.push(this.#getComparatorAny());
2203
+ else if (minAny)
2204
+ this.tuples.push(maxv);
2205
+ else if (maxAny)
2206
+ this.tuples.push(minv);
2207
+ else
2208
+ this.tuples.push(minv, maxv);
2189
2209
  }
2190
2210
  #parse(comp) {
2191
2211
  const first = comp.charAt(0);
@@ -2201,7 +2221,7 @@ var Comparator = class {
2201
2221
  return this.tuples.push(this.#xInclusiveMin(v2));
2202
2222
  case "<=":
2203
2223
  assertVersion(v2, comp);
2204
- return this.tuples.push(this.#xInclusiveMax(comp.substring(2)));
2224
+ return this.tuples.push(this.#xInclusiveMax(v2));
2205
2225
  }
2206
2226
  switch (first) {
2207
2227
  case "~":
@@ -2212,10 +2232,10 @@ var Comparator = class {
2212
2232
  return this.#parseCaret(v1);
2213
2233
  case ">":
2214
2234
  assertVersion(v1, comp);
2215
- return this.tuples.push(this.#xExclusiveMin(comp.substring(1)));
2235
+ return this.tuples.push(this.#xExclusiveMin(v1));
2216
2236
  case "<":
2217
2237
  assertVersion(v1, comp);
2218
- return this.tuples.push(this.#xExclusiveMax(comp.substring(1)));
2238
+ return this.tuples.push(this.#xExclusiveMax(v1));
2219
2239
  }
2220
2240
  return this.#parseEq(comp);
2221
2241
  }
@@ -2269,12 +2289,16 @@ var Comparator = class {
2269
2289
  #parseEq(comp) {
2270
2290
  const parsed = this.#parseX(comp);
2271
2291
  const z = this.includePrerelease ? "0" : void 0;
2272
- if (isXMajor(parsed)) {
2273
- this.tuples.push(this.#getComparatorAny());
2274
- } else if (isFullVersion(parsed)) {
2292
+ if (isFullVersion(parsed)) {
2275
2293
  this.tuples.push(["", new Version(comp, ...parsed)]);
2294
+ } else if (isXMajor(parsed)) {
2295
+ this.tuples.push(this.#getComparatorAny());
2276
2296
  } else if (isXMinor(parsed)) {
2277
- this.tuples.push([">=", new Version(comp, parsed[MAJOR], 0, 0, z, void 0)], [
2297
+ this.tuples.push([
2298
+ ">=",
2299
+ new Version(comp, parsed[MAJOR], 0, 0, z, void 0)
2300
+ ]);
2301
+ this.tuples.push([
2278
2302
  "<",
2279
2303
  new Version(comp, parsed[MAJOR] + 1, 0, 0, "0", void 0)
2280
2304
  ]);
@@ -2372,13 +2396,26 @@ var Range = class {
2372
2396
  constructor(range, includePrerelease = false) {
2373
2397
  this.raw = range;
2374
2398
  this.includePrerelease = includePrerelease;
2375
- fastSplit(range, "||", -1, (part) => this.set.push(new Comparator(part, this.includePrerelease)));
2376
- this.isAny = this.set.some((c) => c.isAny);
2377
- const cmp = this.set[0];
2378
- this.isSingle = this.set.length === 1 && !!cmp && Array.isArray(cmp.tuples) && cmp.tuples.length === 1 && Array.isArray(cmp.tuples[0]) && cmp.tuples[0][0] === "";
2379
- if (this.isSingle) {
2380
- this.#toString = String(cmp);
2381
- }
2399
+ this.isAny = false;
2400
+ let isFirst = true;
2401
+ this.isSingle = false;
2402
+ fastSplit(range, "||", -1, (part) => {
2403
+ if (this.isAny)
2404
+ return;
2405
+ const cmp = new Comparator(part, this.includePrerelease);
2406
+ if (cmp.isAny) {
2407
+ this.set = [cmp];
2408
+ this.isAny = true;
2409
+ return;
2410
+ }
2411
+ this.set.push(cmp);
2412
+ if (!isFirst)
2413
+ this.isSingle = false;
2414
+ else if (Array.isArray(cmp.tuples) && cmp.tuples.length === 1 && Array.isArray(cmp.tuples[0]) && cmp.tuples[0][0] === "") {
2415
+ this.isSingle = true;
2416
+ }
2417
+ isFirst = false;
2418
+ });
2382
2419
  }
2383
2420
  /**
2384
2421
  * test a {@link Version} against the range
@@ -2390,6 +2427,10 @@ var Range = class {
2390
2427
  toString() {
2391
2428
  if (this.#toString)
2392
2429
  return this.#toString;
2430
+ if (this.isSingle) {
2431
+ this.#toString = String(this.set[0]);
2432
+ return this.#toString;
2433
+ }
2393
2434
  this.#toString = this.set.map((c) => String(c)).join(" || ");
2394
2435
  return this.#toString;
2395
2436
  }