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/run.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_8c494dcd2493} from"node:path"
5
- import {pathToFileURL as pathToFileURL_8c494dcd2493} from"node:url"
6
- import {createRequire as createRequire_8c494dcd2493} from"node:module"
4
+ import {resolve as resolve_81ab2bdaaa67} from"node:path"
5
+ import {pathToFileURL as pathToFileURL_81ab2bdaaa67} from"node:url"
6
+ import {createRequire as createRequire_81ab2bdaaa67} from"node:module"
7
7
  var global = globalThis
8
- var __bundleDirname_8c494dcd2493 = resolve_8c494dcd2493(import.meta.dirname, "..")
9
- var __bundleFilename_8c494dcd2493 = resolve_8c494dcd2493(__bundleDirname_8c494dcd2493, "run.js")
10
- var __bundleUrl_8c494dcd2493 = pathToFileURL_8c494dcd2493(__bundleFilename_8c494dcd2493).toString()
11
- var require = createRequire_8c494dcd2493(__bundleFilename_8c494dcd2493)
8
+ var __bundleDirname_81ab2bdaaa67 = resolve_81ab2bdaaa67(import.meta.dirname, "..")
9
+ var __bundleFilename_81ab2bdaaa67 = resolve_81ab2bdaaa67(__bundleDirname_81ab2bdaaa67, "run.js")
10
+ var __bundleUrl_81ab2bdaaa67 = pathToFileURL_81ab2bdaaa67(__bundleFilename_81ab2bdaaa67).toString()
11
+ var require = createRequire_81ab2bdaaa67(__bundleFilename_81ab2bdaaa67)
12
12
  var __create = Object.create;
13
13
  var __defProp = Object.defineProperty;
14
14
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1980,15 +1980,17 @@ var Comparator = class {
1980
1980
  });
1981
1981
  const comps = [];
1982
1982
  let followingOperator = false;
1983
+ let l = 0;
1983
1984
  for (const c of rawComps) {
1984
1985
  if (c === "")
1985
1986
  continue;
1986
1987
  if (!followingOperator) {
1987
1988
  followingOperator = isOperator(c);
1988
1989
  comps.push(c);
1990
+ l++;
1989
1991
  continue;
1990
1992
  }
1991
- comps[comps.length - 1] += c;
1993
+ comps[l - 1] += c;
1992
1994
  followingOperator = false;
1993
1995
  }
1994
1996
  if (hyphen) {
@@ -2021,8 +2023,7 @@ var Comparator = class {
2021
2023
  const [M, m = 0, p = 0, pr = z, build] = this.#parseX(raw);
2022
2024
  return M === void 0 ? this.#getComparatorAny() : [">=", new Version(raw, M, m, p, pr, build)];
2023
2025
  }
2024
- // exclusive min.
2025
- // Note, if not a full version, then
2026
+ // exclusive min
2026
2027
  #xExclusiveMin(raw) {
2027
2028
  const parsed = this.#parseX(raw);
2028
2029
  if (isFullVersion(parsed)) {
@@ -2047,22 +2048,13 @@ var Comparator = class {
2047
2048
  }
2048
2049
  #xInclusiveMax(raw) {
2049
2050
  const parsed = this.#parseX(raw);
2050
- if (isFullVersion(parsed)) {
2051
- return ["<=", new Version(raw, ...parsed)];
2052
- }
2053
- if (isXPatch(parsed)) {
2054
- return [
2055
- "<",
2056
- new Version(raw, parsed[MAJOR], parsed[MINOR] + 1, 0, "0", void 0)
2057
- ];
2058
- }
2059
- if (isXMinor(parsed)) {
2060
- return [
2061
- "<",
2062
- new Version(raw, parsed[MAJOR] + 1, 0, 0, "0", void 0)
2063
- ];
2064
- }
2065
- return this.#getComparatorAny();
2051
+ return isFullVersion(parsed) ? ["<=", new Version(raw, ...parsed)] : isXPatch(parsed) ? [
2052
+ "<",
2053
+ new Version(raw, parsed[MAJOR], parsed[MINOR] + 1, 0, "0", void 0)
2054
+ ] : isXMinor(parsed) ? [
2055
+ "<",
2056
+ new Version(raw, parsed[MAJOR] + 1, 0, 0, "0", void 0)
2057
+ ] : this.#getComparatorAny();
2066
2058
  }
2067
2059
  #xExclusiveMax(raw) {
2068
2060
  const z = this.includePrerelease ? "0" : void 0;
@@ -2074,85 +2066,80 @@ var Comparator = class {
2074
2066
  }
2075
2067
  return ["<", new Version(raw, M, m, p, pr, build)];
2076
2068
  }
2077
- // pull the relevant values out of an X-range or version
2078
- // return the fields for creating a Version object.
2079
- // only call once operator is stripped off
2080
- #parseX(raw) {
2081
- let [M, m, p] = fastSplit(raw, ".", 3);
2082
- let prune = 0;
2083
- while (M && preJunk.has(M.charAt(prune)))
2084
- prune++;
2085
- if (M !== void 0 && prune !== 0)
2086
- M = M.substring(prune);
2087
- if (isX(M) || !M) {
2088
- assertMissing(m, raw, "major");
2089
- assertMissing(p, raw, "major");
2090
- if (m === "" || p === "") {
2091
- throw invalidComp(raw, `(Did you mean '*'?)`);
2092
- }
2093
- return [];
2069
+ #validXM(raw, m, p) {
2070
+ assertMissing(m, raw, "major");
2071
+ assertMissing(p, raw, "major");
2072
+ if (m === "" || p === "") {
2073
+ throw invalidComp(raw, `(Did you mean '*'?)`);
2094
2074
  }
2095
- if (isX(m) || !m) {
2096
- assertMissing(p, raw, "major");
2097
- if (m === "" || p === "") {
2098
- throw invalidComp(raw, `(Did you mean '${M}'?)`);
2099
- }
2100
- return [assertNumber(M, raw, "major")];
2075
+ return [];
2076
+ }
2077
+ #validXm(raw, M, m, p) {
2078
+ assertMissing(p, raw, "major");
2079
+ if (m === "" || p === "") {
2080
+ throw invalidComp(raw, `(Did you mean '${M}'?)`);
2101
2081
  }
2102
- if (isX(p) || !p) {
2103
- if (p === "") {
2104
- throw invalidComp(raw, `(Did you mean '${M}.${m}'?)`);
2105
- }
2106
- return [
2107
- assertNumber(M, raw, "major"),
2108
- assertNumber(m, raw, "minor")
2109
- ];
2082
+ return [assertNumber(M, raw, "major")];
2083
+ }
2084
+ #validXp(raw, M, m, p) {
2085
+ if (p === "") {
2086
+ throw invalidComp(raw, `(Did you mean '${M}.${m}'?)`);
2110
2087
  }
2111
- const hy = p.indexOf("-");
2112
- const pl = p.indexOf("+");
2113
- if (pl === -1 && hy === -1) {
2114
- return [
2115
- assertNumber(M, raw, "major"),
2116
- assertNumber(m, raw, "minor"),
2117
- assertNumber(p, raw, "patch")
2118
- ];
2088
+ return [
2089
+ assertNumber(M, raw, "major"),
2090
+ assertNumber(m, raw, "minor")
2091
+ ];
2092
+ }
2093
+ #validTuple(raw, M, m, p) {
2094
+ return [
2095
+ assertNumber(M, raw, "major"),
2096
+ assertNumber(m, raw, "minor"),
2097
+ assertNumber(p, raw, "patch")
2098
+ ];
2099
+ }
2100
+ #validXbuild(raw, M, m, p, pl) {
2101
+ const patch = p.substring(0, pl);
2102
+ const build = p.substring(pl + 1);
2103
+ if (!patch) {
2104
+ throw invalidComp(raw, "cannot specify build without patch");
2119
2105
  }
2120
- if (hy === -1) {
2121
- const [patch2, build2] = fastSplit(p, "+", 2);
2122
- if (!patch2) {
2123
- throw invalidComp(raw, "cannot specify build without patch");
2124
- }
2125
- if (!build2) {
2126
- throw invalidComp(raw, `encountered '+', but no build value`);
2127
- }
2128
- return [
2129
- assertNumber(M, raw, "major"),
2130
- assertNumber(m, raw, "minor"),
2131
- assertNumber(patch2, raw, "patch"),
2132
- void 0,
2133
- build2
2134
- ];
2106
+ if (!build) {
2107
+ throw invalidComp(raw, `encountered '+', but no build value`);
2135
2108
  }
2136
- if (pl === -1) {
2137
- const [patch2, pr2] = fastSplit(p, "-", 2);
2138
- if (!patch2) {
2109
+ return [
2110
+ assertNumber(M, raw, "major"),
2111
+ assertNumber(m, raw, "minor"),
2112
+ assertNumber(patch, raw, "patch"),
2113
+ void 0,
2114
+ build
2115
+ ];
2116
+ }
2117
+ #validXpr(raw, M, m, p, hy) {
2118
+ {
2119
+ const patch = p.substring(0, hy);
2120
+ const pr = p.substring(hy + 1);
2121
+ if (!patch) {
2139
2122
  throw invalidComp(raw, "cannot specify prerelease without patch");
2140
2123
  }
2141
- if (!pr2) {
2124
+ if (!pr) {
2142
2125
  throw invalidComp(raw, `encountered '-', but no prerelease value`);
2143
2126
  }
2144
2127
  return [
2145
2128
  assertNumber(M, raw, "major"),
2146
2129
  assertNumber(m, raw, "minor"),
2147
- assertNumber(patch2, raw, "patch"),
2148
- pr2
2130
+ assertNumber(patch, raw, "patch"),
2131
+ pr,
2132
+ void 0
2149
2133
  ];
2150
2134
  }
2151
- const [patch, trailers = ""] = fastSplit(p, "-", 2);
2135
+ }
2136
+ #validXprbuild(raw, M, m, p, hy, pl) {
2137
+ const patch = p.substring(0, hy);
2138
+ const pr = p.substring(hy + 1, pl);
2139
+ const build = p.substring(pl + 1);
2152
2140
  if (!patch) {
2153
2141
  throw invalidComp(raw, "cannot specify prerelease without patch");
2154
2142
  }
2155
- const [pr, build] = fastSplit(trailers, "+", 2);
2156
2143
  if (!pr) {
2157
2144
  throw invalidComp(raw, `encountered '-', but no prerelease value`);
2158
2145
  }
@@ -2167,12 +2154,45 @@ var Comparator = class {
2167
2154
  build
2168
2155
  ];
2169
2156
  }
2157
+ // pull the relevant values out of an X-range or version
2158
+ // return the fields for creating a Version object.
2159
+ // only call once operator is stripped off
2160
+ #parseX(raw) {
2161
+ let [M, m, p] = fastSplit(raw, ".", 3);
2162
+ let prune = 0;
2163
+ while (M && preJunk.has(M.charAt(prune)))
2164
+ prune++;
2165
+ if (M !== void 0 && prune !== 0)
2166
+ M = M.substring(prune);
2167
+ if (!M || isX(M))
2168
+ return this.#validXM(raw, m, p);
2169
+ if (!m || isX(m))
2170
+ return this.#validXm(raw, M, m, p);
2171
+ if (!p || isX(p))
2172
+ return this.#validXp(raw, M, m, p);
2173
+ const hy = p.indexOf("-");
2174
+ const pl = p.indexOf("+");
2175
+ if (pl === -1 && hy === -1)
2176
+ return this.#validTuple(raw, M, m, p);
2177
+ if (pl === -1)
2178
+ return this.#validXpr(raw, M, m, p, hy);
2179
+ if (hy === -1)
2180
+ return this.#validXbuild(raw, M, m, p, pl);
2181
+ return this.#validXprbuild(raw, M, m, p, hy, pl);
2182
+ }
2170
2183
  #parseHyphenRange(min, max) {
2171
2184
  const minv = this.#xInclusiveMin(min);
2172
2185
  const maxv = this.#xInclusiveMax(max);
2173
2186
  const minAny = isAny(minv);
2174
2187
  const maxAny = isAny(maxv);
2175
- return minAny && maxAny ? this.tuples.push(this.#getComparatorAny()) : maxAny ? this.tuples.push(minv) : minAny ? this.tuples.push(maxv) : this.tuples.push(minv, maxv);
2188
+ if (minAny && maxAny)
2189
+ this.tuples.push(this.#getComparatorAny());
2190
+ else if (minAny)
2191
+ this.tuples.push(maxv);
2192
+ else if (maxAny)
2193
+ this.tuples.push(minv);
2194
+ else
2195
+ this.tuples.push(minv, maxv);
2176
2196
  }
2177
2197
  #parse(comp) {
2178
2198
  const first = comp.charAt(0);
@@ -2188,7 +2208,7 @@ var Comparator = class {
2188
2208
  return this.tuples.push(this.#xInclusiveMin(v2));
2189
2209
  case "<=":
2190
2210
  assertVersion(v2, comp);
2191
- return this.tuples.push(this.#xInclusiveMax(comp.substring(2)));
2211
+ return this.tuples.push(this.#xInclusiveMax(v2));
2192
2212
  }
2193
2213
  switch (first) {
2194
2214
  case "~":
@@ -2199,10 +2219,10 @@ var Comparator = class {
2199
2219
  return this.#parseCaret(v1);
2200
2220
  case ">":
2201
2221
  assertVersion(v1, comp);
2202
- return this.tuples.push(this.#xExclusiveMin(comp.substring(1)));
2222
+ return this.tuples.push(this.#xExclusiveMin(v1));
2203
2223
  case "<":
2204
2224
  assertVersion(v1, comp);
2205
- return this.tuples.push(this.#xExclusiveMax(comp.substring(1)));
2225
+ return this.tuples.push(this.#xExclusiveMax(v1));
2206
2226
  }
2207
2227
  return this.#parseEq(comp);
2208
2228
  }
@@ -2256,12 +2276,16 @@ var Comparator = class {
2256
2276
  #parseEq(comp) {
2257
2277
  const parsed = this.#parseX(comp);
2258
2278
  const z = this.includePrerelease ? "0" : void 0;
2259
- if (isXMajor(parsed)) {
2260
- this.tuples.push(this.#getComparatorAny());
2261
- } else if (isFullVersion(parsed)) {
2279
+ if (isFullVersion(parsed)) {
2262
2280
  this.tuples.push(["", new Version(comp, ...parsed)]);
2281
+ } else if (isXMajor(parsed)) {
2282
+ this.tuples.push(this.#getComparatorAny());
2263
2283
  } else if (isXMinor(parsed)) {
2264
- this.tuples.push([">=", new Version(comp, parsed[MAJOR], 0, 0, z, void 0)], [
2284
+ this.tuples.push([
2285
+ ">=",
2286
+ new Version(comp, parsed[MAJOR], 0, 0, z, void 0)
2287
+ ]);
2288
+ this.tuples.push([
2265
2289
  "<",
2266
2290
  new Version(comp, parsed[MAJOR] + 1, 0, 0, "0", void 0)
2267
2291
  ]);
@@ -2359,13 +2383,26 @@ var Range = class {
2359
2383
  constructor(range, includePrerelease = false) {
2360
2384
  this.raw = range;
2361
2385
  this.includePrerelease = includePrerelease;
2362
- fastSplit(range, "||", -1, (part) => this.set.push(new Comparator(part, this.includePrerelease)));
2363
- this.isAny = this.set.some((c) => c.isAny);
2364
- const cmp = this.set[0];
2365
- this.isSingle = this.set.length === 1 && !!cmp && Array.isArray(cmp.tuples) && cmp.tuples.length === 1 && Array.isArray(cmp.tuples[0]) && cmp.tuples[0][0] === "";
2366
- if (this.isSingle) {
2367
- this.#toString = String(cmp);
2368
- }
2386
+ this.isAny = false;
2387
+ let isFirst = true;
2388
+ this.isSingle = false;
2389
+ fastSplit(range, "||", -1, (part) => {
2390
+ if (this.isAny)
2391
+ return;
2392
+ const cmp = new Comparator(part, this.includePrerelease);
2393
+ if (cmp.isAny) {
2394
+ this.set = [cmp];
2395
+ this.isAny = true;
2396
+ return;
2397
+ }
2398
+ this.set.push(cmp);
2399
+ if (!isFirst)
2400
+ this.isSingle = false;
2401
+ else if (Array.isArray(cmp.tuples) && cmp.tuples.length === 1 && Array.isArray(cmp.tuples[0]) && cmp.tuples[0][0] === "") {
2402
+ this.isSingle = true;
2403
+ }
2404
+ isFirst = false;
2405
+ });
2369
2406
  }
2370
2407
  /**
2371
2408
  * test a {@link Version} against the range
@@ -2377,6 +2414,10 @@ var Range = class {
2377
2414
  toString() {
2378
2415
  if (this.#toString)
2379
2416
  return this.#toString;
2417
+ if (this.isSingle) {
2418
+ this.#toString = String(this.set[0]);
2419
+ return this.#toString;
2420
+ }
2380
2421
  this.#toString = this.set.map((c) => String(c)).join(" || ");
2381
2422
  return this.#toString;
2382
2423
  }