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/vlr.js CHANGED
@@ -2,14 +2,14 @@
2
2
  import process from"node:process"
3
3
  import {Buffer} from"node:buffer"
4
4
  import {setImmediate, clearImmediate} from"node:timers"
5
- import {resolve as resolve_3f2409553897} from"node:path"
6
- import {pathToFileURL as pathToFileURL_3f2409553897} from"node:url"
7
- import {createRequire as createRequire_3f2409553897} from"node:module"
5
+ import {resolve as resolve_5bac1f4933da} from"node:path"
6
+ import {pathToFileURL as pathToFileURL_5bac1f4933da} from"node:url"
7
+ import {createRequire as createRequire_5bac1f4933da} from"node:module"
8
8
  var global = globalThis
9
- var __bundleDirname_3f2409553897 = resolve_3f2409553897(import.meta.dirname, "")
10
- var __bundleFilename_3f2409553897 = resolve_3f2409553897(__bundleDirname_3f2409553897, "vlr.js")
11
- var __bundleUrl_3f2409553897 = pathToFileURL_3f2409553897(__bundleFilename_3f2409553897).toString()
12
- var require = createRequire_3f2409553897(__bundleFilename_3f2409553897)
9
+ var __bundleDirname_5bac1f4933da = resolve_5bac1f4933da(import.meta.dirname, "")
10
+ var __bundleFilename_5bac1f4933da = resolve_5bac1f4933da(__bundleDirname_5bac1f4933da, "vlr.js")
11
+ var __bundleUrl_5bac1f4933da = pathToFileURL_5bac1f4933da(__bundleFilename_5bac1f4933da).toString()
12
+ var require = createRequire_5bac1f4933da(__bundleFilename_5bac1f4933da)
13
13
  var __create = Object.create;
14
14
  var __defProp = Object.defineProperty;
15
15
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -59,6 +59,204 @@ var init_esm = __esm({
59
59
  }
60
60
  });
61
61
 
62
+ // ../../src/types/dist/esm/index.js
63
+ var maybeRecordStringString, isRecordStringString, isRecordStringT, maybePeerDependenciesMetaSet, maybeBoolean, isPeerDependenciesMetaValue, maybeString, maybeDist, isManifest, asManifest;
64
+ var init_esm2 = __esm({
65
+ "../../src/types/dist/esm/index.js"() {
66
+ "use strict";
67
+ init_esm();
68
+ maybeRecordStringString = (o) => o === void 0 || isRecordStringString(o);
69
+ isRecordStringString = (o) => isRecordStringT(o, (s) => typeof s === "string");
70
+ isRecordStringT = (o, check) => !!o && typeof o === "object" && Object.entries(o).every(([k, v]) => typeof k === "string" && check(v));
71
+ maybePeerDependenciesMetaSet = (o) => o === void 0 || isRecordStringT(o, (v) => isPeerDependenciesMetaValue(v));
72
+ maybeBoolean = (o) => o === void 0 || typeof o === "boolean";
73
+ isPeerDependenciesMetaValue = (o) => !!o && typeof o === "object" && maybeBoolean(o.optional);
74
+ maybeString = (a) => a === void 0 || typeof a === "string";
75
+ maybeDist = (a) => a === void 0 || !!a && typeof a === "object" && maybeString(a.tarball);
76
+ isManifest = (m) => !!m && typeof m === "object" && !Array.isArray(m) && maybeString(m.name) && maybeString(m.version) && maybeRecordStringString(m.dependencies) && maybeRecordStringString(m.devDependencies) && maybeRecordStringString(m.optionalDependencies) && maybeRecordStringString(m.peerDependencies) && maybeRecordStringString(m.acceptDependencies) && maybePeerDependenciesMetaSet(m.peerDependenciesMeta) && maybeDist(m.dist);
77
+ asManifest = (m, from) => {
78
+ if (!isManifest(m)) {
79
+ throw error("invalid manifest", { found: m }, from ?? asManifest);
80
+ }
81
+ return m;
82
+ };
83
+ }
84
+ });
85
+
86
+ // ../../node_modules/.pnpm/polite-json@5.0.0/node_modules/polite-json/dist/esm/index.js
87
+ var hexify, parseError, JSONParseError, kIndent, kNewline, formatRE, emptyRE, parse, stripBOM, stringify;
88
+ var init_esm3 = __esm({
89
+ "../../node_modules/.pnpm/polite-json@5.0.0/node_modules/polite-json/dist/esm/index.js"() {
90
+ hexify = (s) => Array.from(s).map((c) => "0x" + c.charCodeAt(0).toString(16).toUpperCase().padStart(2, "0")).join("");
91
+ parseError = (e, txt, context) => {
92
+ if (!txt) {
93
+ return {
94
+ message: e.message + " while parsing empty string",
95
+ position: 0
96
+ };
97
+ }
98
+ const badToken = e.message.match(/^Unexpected (?:token (.*?))?/i);
99
+ const atPos = e.message.match(/at positions? (\d+)/);
100
+ const errIdx = /^Unexpected end of JSON|Unterminated string in JSON/i.test(e.message) ? txt.length - 1 : atPos && atPos[1] ? +atPos[1] : /is not valid JSON$/.test(e.message) ? 0 : null;
101
+ const msg = badToken && badToken[1] ? e.message.replace(/^Unexpected token ./, `Unexpected token ${JSON.stringify(badToken[1])} (${hexify(badToken[1])})`) : e.message;
102
+ if (errIdx !== null && errIdx !== void 0) {
103
+ const start = errIdx <= context ? 0 : errIdx - context;
104
+ const end = errIdx + context >= txt.length ? txt.length : errIdx + context;
105
+ const slice = (start === 0 ? "" : "...") + txt.slice(start, end) + (end === txt.length ? "" : "...");
106
+ const near = txt === slice ? "" : "near ";
107
+ return {
108
+ message: msg + ` while parsing ${near}${JSON.stringify(slice)}`,
109
+ position: errIdx
110
+ };
111
+ } else {
112
+ return {
113
+ message: msg + ` while parsing '${txt.slice(0, context * 2)}'`,
114
+ position: 0
115
+ };
116
+ }
117
+ };
118
+ JSONParseError = class extends SyntaxError {
119
+ code;
120
+ cause;
121
+ position;
122
+ constructor(er, txt, context = 20, caller) {
123
+ const { message, position } = parseError(er, txt, context);
124
+ super(message);
125
+ this.cause = er;
126
+ this.position = position;
127
+ this.code = "EJSONPARSE";
128
+ Error.captureStackTrace(this, caller || this.constructor);
129
+ }
130
+ get name() {
131
+ return this.constructor.name;
132
+ }
133
+ set name(_) {
134
+ }
135
+ get [Symbol.toStringTag]() {
136
+ return this.constructor.name;
137
+ }
138
+ };
139
+ kIndent = Symbol.for("indent");
140
+ kNewline = Symbol.for("newline");
141
+ formatRE = /^\s*[{\[]((?:\r?\n)+)([\s\t]*)/;
142
+ emptyRE = /^(?:\{\}|\[\])((?:\r?\n)+)?$/;
143
+ parse = (txt, reviver, context) => {
144
+ const parseText = stripBOM(String(txt));
145
+ if (!reviver)
146
+ reviver = void 0;
147
+ context = context || 20;
148
+ try {
149
+ const [, newline = "\n", indent2 = " "] = parseText.match(emptyRE) || parseText.match(formatRE) || [, "", ""];
150
+ const result = JSON.parse(parseText, reviver);
151
+ if (result && typeof result === "object") {
152
+ result[kNewline] = newline;
153
+ result[kIndent] = indent2;
154
+ }
155
+ return result;
156
+ } catch (e) {
157
+ if (typeof txt !== "string" && !Buffer.isBuffer(txt)) {
158
+ const isEmptyArray = Array.isArray(txt) && txt.length === 0;
159
+ throw Object.assign(new TypeError(`Cannot parse ${isEmptyArray ? "an empty array" : String(txt)}`), {
160
+ code: "EJSONPARSE",
161
+ systemError: e
162
+ });
163
+ }
164
+ throw new JSONParseError(e, parseText, context, parse);
165
+ }
166
+ };
167
+ stripBOM = (txt) => String(txt).replace(/^\uFEFF/, "");
168
+ stringify = (obj, replacer, indent2) => {
169
+ const space = indent2 === void 0 ? obj[kIndent] : indent2;
170
+ const res = (
171
+ /* c8 ignore start */
172
+ typeof replacer === "function" ? JSON.stringify(obj, replacer, space) : JSON.stringify(obj, replacer, space)
173
+ );
174
+ const nl = obj[kNewline] || "\n";
175
+ return space ? (nl === "\n" ? res : res.split("\n").join(nl)) + nl : res;
176
+ };
177
+ }
178
+ });
179
+
180
+ // ../../src/package-json/dist/esm/index.js
181
+ import { readFileSync, writeFileSync } from "node:fs";
182
+ import { resolve } from "node:path";
183
+ var PackageJson;
184
+ var init_esm4 = __esm({
185
+ "../../src/package-json/dist/esm/index.js"() {
186
+ "use strict";
187
+ init_esm();
188
+ init_esm2();
189
+ init_esm3();
190
+ PackageJson = class {
191
+ /**
192
+ * cache of `package.json` loads
193
+ */
194
+ #cache = /* @__PURE__ */ new Map();
195
+ /**
196
+ * cache of `package.json` paths by manifest
197
+ */
198
+ #pathCache = /* @__PURE__ */ new Map();
199
+ /**
200
+ * cache of load errors
201
+ */
202
+ #errCache = /* @__PURE__ */ new Map();
203
+ /**
204
+ * Reads and parses contents of a `package.json` file at a directory `dir`.
205
+ * `reload` will optionally skip reading from the cache when set to `true`.
206
+ */
207
+ read(dir, { reload } = {}) {
208
+ const cachedPackageJson = !reload && this.#cache.get(dir);
209
+ if (cachedPackageJson) {
210
+ return cachedPackageJson;
211
+ }
212
+ const filename = resolve(dir, "package.json");
213
+ const fail = (err) => error("Could not read package.json file", err, this.read);
214
+ const cachedError = !reload && this.#errCache.get(dir);
215
+ if (cachedError) {
216
+ throw fail(cachedError);
217
+ }
218
+ try {
219
+ const res = asManifest(parse(readFileSync(filename, { encoding: "utf8" })));
220
+ this.#cache.set(dir, res);
221
+ this.#pathCache.set(res, dir);
222
+ return res;
223
+ } catch (err) {
224
+ const ec = {
225
+ path: filename,
226
+ cause: err
227
+ };
228
+ this.#errCache.set(dir, ec);
229
+ throw fail(ec);
230
+ }
231
+ }
232
+ write(dir, manifest) {
233
+ const filename = resolve(dir, "package.json");
234
+ try {
235
+ writeFileSync(filename, stringify(manifest));
236
+ this.#cache.set(dir, manifest);
237
+ this.#pathCache.set(manifest, dir);
238
+ } catch (err) {
239
+ this.#cache.delete(dir);
240
+ this.#pathCache.delete(manifest);
241
+ throw error("Could not write package.json file", {
242
+ path: filename,
243
+ cause: err
244
+ }, this.write);
245
+ }
246
+ }
247
+ save(manifest) {
248
+ const dir = this.#pathCache.get(manifest);
249
+ if (!dir) {
250
+ throw error("Could not save manifest", {
251
+ manifest
252
+ }, this.save);
253
+ }
254
+ this.write(dir, manifest);
255
+ }
256
+ };
257
+ }
258
+ });
259
+
62
260
  // ../../src/fast-split/dist/esm/index.js
63
261
  function fastSplit(str, delim, limit = -1, onPart) {
64
262
  let i = 0;
@@ -76,7 +274,7 @@ function fastSplit(str, delim, limit = -1, onPart) {
76
274
  }
77
275
  return parts;
78
276
  }
79
- var init_esm2 = __esm({
277
+ var init_esm5 = __esm({
80
278
  "../../src/fast-split/dist/esm/index.js"() {
81
279
  "use strict";
82
280
  }
@@ -88,7 +286,7 @@ var init_version = __esm({
88
286
  "../../src/semver/dist/esm/version.js"() {
89
287
  "use strict";
90
288
  init_esm();
91
- init_esm2();
289
+ init_esm5();
92
290
  maybeNumber = (s) => {
93
291
  if (!/^[0-9]+$/.test(s))
94
292
  return s;
@@ -377,7 +575,7 @@ var init_comparator = __esm({
377
575
  "../../src/semver/dist/esm/comparator.js"() {
378
576
  "use strict";
379
577
  init_esm();
380
- init_esm2();
578
+ init_esm5();
381
579
  init_version();
382
580
  isOperator = (o) => !!o && (o === ">" || o === "<" || o === ">=" || o === "<=" || o === "" || o === "~" || o === "^" || o === "~>");
383
581
  preJunk = new Set("=v ");
@@ -460,15 +658,17 @@ var init_comparator = __esm({
460
658
  });
461
659
  const comps = [];
462
660
  let followingOperator = false;
661
+ let l = 0;
463
662
  for (const c of rawComps) {
464
663
  if (c === "")
465
664
  continue;
466
665
  if (!followingOperator) {
467
666
  followingOperator = isOperator(c);
468
667
  comps.push(c);
668
+ l++;
469
669
  continue;
470
670
  }
471
- comps[comps.length - 1] += c;
671
+ comps[l - 1] += c;
472
672
  followingOperator = false;
473
673
  }
474
674
  if (hyphen) {
@@ -501,8 +701,7 @@ var init_comparator = __esm({
501
701
  const [M, m = 0, p = 0, pr = z, build] = this.#parseX(raw);
502
702
  return M === void 0 ? this.#getComparatorAny() : [">=", new Version(raw, M, m, p, pr, build)];
503
703
  }
504
- // exclusive min.
505
- // Note, if not a full version, then
704
+ // exclusive min
506
705
  #xExclusiveMin(raw) {
507
706
  const parsed = this.#parseX(raw);
508
707
  if (isFullVersion(parsed)) {
@@ -527,22 +726,13 @@ var init_comparator = __esm({
527
726
  }
528
727
  #xInclusiveMax(raw) {
529
728
  const parsed = this.#parseX(raw);
530
- if (isFullVersion(parsed)) {
531
- return ["<=", new Version(raw, ...parsed)];
532
- }
533
- if (isXPatch(parsed)) {
534
- return [
535
- "<",
536
- new Version(raw, parsed[MAJOR], parsed[MINOR] + 1, 0, "0", void 0)
537
- ];
538
- }
539
- if (isXMinor(parsed)) {
540
- return [
541
- "<",
542
- new Version(raw, parsed[MAJOR] + 1, 0, 0, "0", void 0)
543
- ];
544
- }
545
- return this.#getComparatorAny();
729
+ return isFullVersion(parsed) ? ["<=", new Version(raw, ...parsed)] : isXPatch(parsed) ? [
730
+ "<",
731
+ new Version(raw, parsed[MAJOR], parsed[MINOR] + 1, 0, "0", void 0)
732
+ ] : isXMinor(parsed) ? [
733
+ "<",
734
+ new Version(raw, parsed[MAJOR] + 1, 0, 0, "0", void 0)
735
+ ] : this.#getComparatorAny();
546
736
  }
547
737
  #xExclusiveMax(raw) {
548
738
  const z = this.includePrerelease ? "0" : void 0;
@@ -554,85 +744,80 @@ var init_comparator = __esm({
554
744
  }
555
745
  return ["<", new Version(raw, M, m, p, pr, build)];
556
746
  }
557
- // pull the relevant values out of an X-range or version
558
- // return the fields for creating a Version object.
559
- // only call once operator is stripped off
560
- #parseX(raw) {
561
- let [M, m, p] = fastSplit(raw, ".", 3);
562
- let prune = 0;
563
- while (M && preJunk.has(M.charAt(prune)))
564
- prune++;
565
- if (M !== void 0 && prune !== 0)
566
- M = M.substring(prune);
567
- if (isX(M) || !M) {
568
- assertMissing(m, raw, "major");
569
- assertMissing(p, raw, "major");
570
- if (m === "" || p === "") {
571
- throw invalidComp(raw, `(Did you mean '*'?)`);
572
- }
573
- return [];
747
+ #validXM(raw, m, p) {
748
+ assertMissing(m, raw, "major");
749
+ assertMissing(p, raw, "major");
750
+ if (m === "" || p === "") {
751
+ throw invalidComp(raw, `(Did you mean '*'?)`);
574
752
  }
575
- if (isX(m) || !m) {
576
- assertMissing(p, raw, "major");
577
- if (m === "" || p === "") {
578
- throw invalidComp(raw, `(Did you mean '${M}'?)`);
579
- }
580
- return [assertNumber(M, raw, "major")];
753
+ return [];
754
+ }
755
+ #validXm(raw, M, m, p) {
756
+ assertMissing(p, raw, "major");
757
+ if (m === "" || p === "") {
758
+ throw invalidComp(raw, `(Did you mean '${M}'?)`);
581
759
  }
582
- if (isX(p) || !p) {
583
- if (p === "") {
584
- throw invalidComp(raw, `(Did you mean '${M}.${m}'?)`);
585
- }
586
- return [
587
- assertNumber(M, raw, "major"),
588
- assertNumber(m, raw, "minor")
589
- ];
760
+ return [assertNumber(M, raw, "major")];
761
+ }
762
+ #validXp(raw, M, m, p) {
763
+ if (p === "") {
764
+ throw invalidComp(raw, `(Did you mean '${M}.${m}'?)`);
590
765
  }
591
- const hy = p.indexOf("-");
592
- const pl = p.indexOf("+");
593
- if (pl === -1 && hy === -1) {
594
- return [
595
- assertNumber(M, raw, "major"),
596
- assertNumber(m, raw, "minor"),
597
- assertNumber(p, raw, "patch")
598
- ];
766
+ return [
767
+ assertNumber(M, raw, "major"),
768
+ assertNumber(m, raw, "minor")
769
+ ];
770
+ }
771
+ #validTuple(raw, M, m, p) {
772
+ return [
773
+ assertNumber(M, raw, "major"),
774
+ assertNumber(m, raw, "minor"),
775
+ assertNumber(p, raw, "patch")
776
+ ];
777
+ }
778
+ #validXbuild(raw, M, m, p, pl) {
779
+ const patch = p.substring(0, pl);
780
+ const build = p.substring(pl + 1);
781
+ if (!patch) {
782
+ throw invalidComp(raw, "cannot specify build without patch");
599
783
  }
600
- if (hy === -1) {
601
- const [patch2, build2] = fastSplit(p, "+", 2);
602
- if (!patch2) {
603
- throw invalidComp(raw, "cannot specify build without patch");
604
- }
605
- if (!build2) {
606
- throw invalidComp(raw, `encountered '+', but no build value`);
607
- }
608
- return [
609
- assertNumber(M, raw, "major"),
610
- assertNumber(m, raw, "minor"),
611
- assertNumber(patch2, raw, "patch"),
612
- void 0,
613
- build2
614
- ];
784
+ if (!build) {
785
+ throw invalidComp(raw, `encountered '+', but no build value`);
615
786
  }
616
- if (pl === -1) {
617
- const [patch2, pr2] = fastSplit(p, "-", 2);
618
- if (!patch2) {
787
+ return [
788
+ assertNumber(M, raw, "major"),
789
+ assertNumber(m, raw, "minor"),
790
+ assertNumber(patch, raw, "patch"),
791
+ void 0,
792
+ build
793
+ ];
794
+ }
795
+ #validXpr(raw, M, m, p, hy) {
796
+ {
797
+ const patch = p.substring(0, hy);
798
+ const pr = p.substring(hy + 1);
799
+ if (!patch) {
619
800
  throw invalidComp(raw, "cannot specify prerelease without patch");
620
801
  }
621
- if (!pr2) {
802
+ if (!pr) {
622
803
  throw invalidComp(raw, `encountered '-', but no prerelease value`);
623
804
  }
624
805
  return [
625
806
  assertNumber(M, raw, "major"),
626
807
  assertNumber(m, raw, "minor"),
627
- assertNumber(patch2, raw, "patch"),
628
- pr2
808
+ assertNumber(patch, raw, "patch"),
809
+ pr,
810
+ void 0
629
811
  ];
630
812
  }
631
- const [patch, trailers = ""] = fastSplit(p, "-", 2);
813
+ }
814
+ #validXprbuild(raw, M, m, p, hy, pl) {
815
+ const patch = p.substring(0, hy);
816
+ const pr = p.substring(hy + 1, pl);
817
+ const build = p.substring(pl + 1);
632
818
  if (!patch) {
633
819
  throw invalidComp(raw, "cannot specify prerelease without patch");
634
820
  }
635
- const [pr, build] = fastSplit(trailers, "+", 2);
636
821
  if (!pr) {
637
822
  throw invalidComp(raw, `encountered '-', but no prerelease value`);
638
823
  }
@@ -647,12 +832,45 @@ var init_comparator = __esm({
647
832
  build
648
833
  ];
649
834
  }
835
+ // pull the relevant values out of an X-range or version
836
+ // return the fields for creating a Version object.
837
+ // only call once operator is stripped off
838
+ #parseX(raw) {
839
+ let [M, m, p] = fastSplit(raw, ".", 3);
840
+ let prune = 0;
841
+ while (M && preJunk.has(M.charAt(prune)))
842
+ prune++;
843
+ if (M !== void 0 && prune !== 0)
844
+ M = M.substring(prune);
845
+ if (!M || isX(M))
846
+ return this.#validXM(raw, m, p);
847
+ if (!m || isX(m))
848
+ return this.#validXm(raw, M, m, p);
849
+ if (!p || isX(p))
850
+ return this.#validXp(raw, M, m, p);
851
+ const hy = p.indexOf("-");
852
+ const pl = p.indexOf("+");
853
+ if (pl === -1 && hy === -1)
854
+ return this.#validTuple(raw, M, m, p);
855
+ if (pl === -1)
856
+ return this.#validXpr(raw, M, m, p, hy);
857
+ if (hy === -1)
858
+ return this.#validXbuild(raw, M, m, p, pl);
859
+ return this.#validXprbuild(raw, M, m, p, hy, pl);
860
+ }
650
861
  #parseHyphenRange(min, max) {
651
862
  const minv = this.#xInclusiveMin(min);
652
863
  const maxv = this.#xInclusiveMax(max);
653
864
  const minAny = isAny(minv);
654
865
  const maxAny = isAny(maxv);
655
- return minAny && maxAny ? this.tuples.push(this.#getComparatorAny()) : maxAny ? this.tuples.push(minv) : minAny ? this.tuples.push(maxv) : this.tuples.push(minv, maxv);
866
+ if (minAny && maxAny)
867
+ this.tuples.push(this.#getComparatorAny());
868
+ else if (minAny)
869
+ this.tuples.push(maxv);
870
+ else if (maxAny)
871
+ this.tuples.push(minv);
872
+ else
873
+ this.tuples.push(minv, maxv);
656
874
  }
657
875
  #parse(comp) {
658
876
  const first = comp.charAt(0);
@@ -668,7 +886,7 @@ var init_comparator = __esm({
668
886
  return this.tuples.push(this.#xInclusiveMin(v2));
669
887
  case "<=":
670
888
  assertVersion(v2, comp);
671
- return this.tuples.push(this.#xInclusiveMax(comp.substring(2)));
889
+ return this.tuples.push(this.#xInclusiveMax(v2));
672
890
  }
673
891
  switch (first) {
674
892
  case "~":
@@ -679,10 +897,10 @@ var init_comparator = __esm({
679
897
  return this.#parseCaret(v1);
680
898
  case ">":
681
899
  assertVersion(v1, comp);
682
- return this.tuples.push(this.#xExclusiveMin(comp.substring(1)));
900
+ return this.tuples.push(this.#xExclusiveMin(v1));
683
901
  case "<":
684
902
  assertVersion(v1, comp);
685
- return this.tuples.push(this.#xExclusiveMax(comp.substring(1)));
903
+ return this.tuples.push(this.#xExclusiveMax(v1));
686
904
  }
687
905
  return this.#parseEq(comp);
688
906
  }
@@ -736,12 +954,16 @@ var init_comparator = __esm({
736
954
  #parseEq(comp) {
737
955
  const parsed = this.#parseX(comp);
738
956
  const z = this.includePrerelease ? "0" : void 0;
739
- if (isXMajor(parsed)) {
740
- this.tuples.push(this.#getComparatorAny());
741
- } else if (isFullVersion(parsed)) {
957
+ if (isFullVersion(parsed)) {
742
958
  this.tuples.push(["", new Version(comp, ...parsed)]);
959
+ } else if (isXMajor(parsed)) {
960
+ this.tuples.push(this.#getComparatorAny());
743
961
  } else if (isXMinor(parsed)) {
744
- this.tuples.push([">=", new Version(comp, parsed[MAJOR], 0, 0, z, void 0)], [
962
+ this.tuples.push([
963
+ ">=",
964
+ new Version(comp, parsed[MAJOR], 0, 0, z, void 0)
965
+ ]);
966
+ this.tuples.push([
745
967
  "<",
746
968
  new Version(comp, parsed[MAJOR] + 1, 0, 0, "0", void 0)
747
969
  ]);
@@ -824,7 +1046,7 @@ var Range;
824
1046
  var init_range = __esm({
825
1047
  "../../src/semver/dist/esm/range.js"() {
826
1048
  "use strict";
827
- init_esm2();
1049
+ init_esm5();
828
1050
  init_comparator();
829
1051
  Range = class {
830
1052
  /** raw string used to create this Range */
@@ -847,13 +1069,26 @@ var init_range = __esm({
847
1069
  constructor(range, includePrerelease = false) {
848
1070
  this.raw = range;
849
1071
  this.includePrerelease = includePrerelease;
850
- fastSplit(range, "||", -1, (part) => this.set.push(new Comparator(part, this.includePrerelease)));
851
- this.isAny = this.set.some((c) => c.isAny);
852
- const cmp = this.set[0];
853
- this.isSingle = this.set.length === 1 && !!cmp && Array.isArray(cmp.tuples) && cmp.tuples.length === 1 && Array.isArray(cmp.tuples[0]) && cmp.tuples[0][0] === "";
854
- if (this.isSingle) {
855
- this.#toString = String(cmp);
856
- }
1072
+ this.isAny = false;
1073
+ let isFirst = true;
1074
+ this.isSingle = false;
1075
+ fastSplit(range, "||", -1, (part) => {
1076
+ if (this.isAny)
1077
+ return;
1078
+ const cmp = new Comparator(part, this.includePrerelease);
1079
+ if (cmp.isAny) {
1080
+ this.set = [cmp];
1081
+ this.isAny = true;
1082
+ return;
1083
+ }
1084
+ this.set.push(cmp);
1085
+ if (!isFirst)
1086
+ this.isSingle = false;
1087
+ else if (Array.isArray(cmp.tuples) && cmp.tuples.length === 1 && Array.isArray(cmp.tuples[0]) && cmp.tuples[0][0] === "") {
1088
+ this.isSingle = true;
1089
+ }
1090
+ isFirst = false;
1091
+ });
857
1092
  }
858
1093
  /**
859
1094
  * test a {@link Version} against the range
@@ -865,6 +1100,10 @@ var init_range = __esm({
865
1100
  toString() {
866
1101
  if (this.#toString)
867
1102
  return this.#toString;
1103
+ if (this.isSingle) {
1104
+ this.#toString = String(this.set[0]);
1105
+ return this.#toString;
1106
+ }
868
1107
  this.#toString = this.set.map((c) => String(c)).join(" || ");
869
1108
  return this.#toString;
870
1109
  }
@@ -874,7 +1113,7 @@ var init_range = __esm({
874
1113
 
875
1114
  // ../../src/semver/dist/esm/index.js
876
1115
  var parseRange;
877
- var init_esm3 = __esm({
1116
+ var init_esm6 = __esm({
878
1117
  "../../src/semver/dist/esm/index.js"() {
879
1118
  "use strict";
880
1119
  init_range();
@@ -907,14 +1146,14 @@ var init_types = __esm({
907
1146
 
908
1147
  // ../../src/spec/dist/esm/index.js
909
1148
  import { homedir } from "node:os";
910
- import { isAbsolute, join, resolve, win32 as winPath } from "node:path";
1149
+ import { isAbsolute, join, resolve as resolve2, win32 as winPath } from "node:path";
911
1150
  import { inspect } from "node:util";
912
1151
  var _a, kCustomInspect, defaultRegistry, defaultRegistries, defaultGitHosts, defaultGitHostArchives, gitHostWebsites, getOptions, startsWithSpecIdentifier, findFirstAt, findGitIdentifier, findFileIdentifier, Spec, normalizeFile;
913
- var init_esm4 = __esm({
1152
+ var init_esm7 = __esm({
914
1153
  "../../src/spec/dist/esm/index.js"() {
915
1154
  "use strict";
916
1155
  init_esm();
917
- init_esm3();
1156
+ init_esm6();
918
1157
  init_types();
919
1158
  kCustomInspect = Symbol.for("nodejs.util.inspect.custom");
920
1159
  defaultRegistry = "https://registry.npmjs.org/";
@@ -1363,11 +1602,11 @@ var init_esm4 = __esm({
1363
1602
  throw error(`invalid file: specifier. '~username' not supported`, { spec });
1364
1603
  }
1365
1604
  if (a === "~") {
1366
- return [resolve(homedir(), rest.substring(2)), `file:${rest}`];
1605
+ return [resolve2(homedir(), rest.substring(2)), `file:${rest}`];
1367
1606
  }
1368
1607
  if (a === "/" && b === "~") {
1369
1608
  return [
1370
- resolve(homedir(), rest.substring(3)),
1609
+ resolve2(homedir(), rest.substring(3)),
1371
1610
  `file:${rest.substring(1)}`
1372
1611
  ];
1373
1612
  }
@@ -1410,11 +1649,11 @@ var init_esm4 = __esm({
1410
1649
 
1411
1650
  // ../../src/dep-id/dist/esm/index.js
1412
1651
  var delimiter, depIDRegExp, joinDepIDTuple, encode;
1413
- var init_esm5 = __esm({
1652
+ var init_esm8 = __esm({
1414
1653
  "../../src/dep-id/dist/esm/index.js"() {
1415
1654
  "use strict";
1416
1655
  init_esm();
1417
- init_esm4();
1656
+ init_esm7();
1418
1657
  delimiter = "\xB7";
1419
1658
  depIDRegExp = new RegExp(`^((git)?${delimiter}[^${delimiter}]*${delimiter}[^${delimiter}]*(${delimiter}[^${delimiter}]*)?$|^(file|remote|workspace)${delimiter}[^${delimiter}]*)(${delimiter}[^${delimiter}]*)?$`);
1420
1659
  joinDepIDTuple = (list) => {
@@ -1433,204 +1672,6 @@ var init_esm5 = __esm({
1433
1672
  }
1434
1673
  });
1435
1674
 
1436
- // ../../src/types/dist/esm/index.js
1437
- var maybeRecordStringString, isRecordStringString, isRecordStringT, maybePeerDependenciesMetaSet, maybeBoolean, isPeerDependenciesMetaValue, maybeString, maybeDist, isManifest, asManifest;
1438
- var init_esm6 = __esm({
1439
- "../../src/types/dist/esm/index.js"() {
1440
- "use strict";
1441
- init_esm();
1442
- maybeRecordStringString = (o) => o === void 0 || isRecordStringString(o);
1443
- isRecordStringString = (o) => isRecordStringT(o, (s) => typeof s === "string");
1444
- isRecordStringT = (o, check) => !!o && typeof o === "object" && Object.entries(o).every(([k, v]) => typeof k === "string" && check(v));
1445
- maybePeerDependenciesMetaSet = (o) => o === void 0 || isRecordStringT(o, (v) => isPeerDependenciesMetaValue(v));
1446
- maybeBoolean = (o) => o === void 0 || typeof o === "boolean";
1447
- isPeerDependenciesMetaValue = (o) => !!o && typeof o === "object" && maybeBoolean(o.optional);
1448
- maybeString = (a) => a === void 0 || typeof a === "string";
1449
- maybeDist = (a) => a === void 0 || !!a && typeof a === "object" && maybeString(a.tarball);
1450
- isManifest = (m) => !!m && typeof m === "object" && !Array.isArray(m) && maybeString(m.name) && maybeString(m.version) && maybeRecordStringString(m.dependencies) && maybeRecordStringString(m.devDependencies) && maybeRecordStringString(m.optionalDependencies) && maybeRecordStringString(m.peerDependencies) && maybeRecordStringString(m.acceptDependencies) && maybePeerDependenciesMetaSet(m.peerDependenciesMeta) && maybeDist(m.dist);
1451
- asManifest = (m, from) => {
1452
- if (!isManifest(m)) {
1453
- throw error("invalid manifest", { found: m }, from ?? asManifest);
1454
- }
1455
- return m;
1456
- };
1457
- }
1458
- });
1459
-
1460
- // ../../node_modules/.pnpm/polite-json@5.0.0/node_modules/polite-json/dist/esm/index.js
1461
- var hexify, parseError, JSONParseError, kIndent, kNewline, formatRE, emptyRE, parse, stripBOM, stringify;
1462
- var init_esm7 = __esm({
1463
- "../../node_modules/.pnpm/polite-json@5.0.0/node_modules/polite-json/dist/esm/index.js"() {
1464
- hexify = (s) => Array.from(s).map((c) => "0x" + c.charCodeAt(0).toString(16).toUpperCase().padStart(2, "0")).join("");
1465
- parseError = (e, txt, context) => {
1466
- if (!txt) {
1467
- return {
1468
- message: e.message + " while parsing empty string",
1469
- position: 0
1470
- };
1471
- }
1472
- const badToken = e.message.match(/^Unexpected (?:token (.*?))?/i);
1473
- const atPos = e.message.match(/at positions? (\d+)/);
1474
- const errIdx = /^Unexpected end of JSON|Unterminated string in JSON/i.test(e.message) ? txt.length - 1 : atPos && atPos[1] ? +atPos[1] : /is not valid JSON$/.test(e.message) ? 0 : null;
1475
- const msg = badToken && badToken[1] ? e.message.replace(/^Unexpected token ./, `Unexpected token ${JSON.stringify(badToken[1])} (${hexify(badToken[1])})`) : e.message;
1476
- if (errIdx !== null && errIdx !== void 0) {
1477
- const start = errIdx <= context ? 0 : errIdx - context;
1478
- const end = errIdx + context >= txt.length ? txt.length : errIdx + context;
1479
- const slice = (start === 0 ? "" : "...") + txt.slice(start, end) + (end === txt.length ? "" : "...");
1480
- const near = txt === slice ? "" : "near ";
1481
- return {
1482
- message: msg + ` while parsing ${near}${JSON.stringify(slice)}`,
1483
- position: errIdx
1484
- };
1485
- } else {
1486
- return {
1487
- message: msg + ` while parsing '${txt.slice(0, context * 2)}'`,
1488
- position: 0
1489
- };
1490
- }
1491
- };
1492
- JSONParseError = class extends SyntaxError {
1493
- code;
1494
- cause;
1495
- position;
1496
- constructor(er, txt, context = 20, caller) {
1497
- const { message, position } = parseError(er, txt, context);
1498
- super(message);
1499
- this.cause = er;
1500
- this.position = position;
1501
- this.code = "EJSONPARSE";
1502
- Error.captureStackTrace(this, caller || this.constructor);
1503
- }
1504
- get name() {
1505
- return this.constructor.name;
1506
- }
1507
- set name(_) {
1508
- }
1509
- get [Symbol.toStringTag]() {
1510
- return this.constructor.name;
1511
- }
1512
- };
1513
- kIndent = Symbol.for("indent");
1514
- kNewline = Symbol.for("newline");
1515
- formatRE = /^\s*[{\[]((?:\r?\n)+)([\s\t]*)/;
1516
- emptyRE = /^(?:\{\}|\[\])((?:\r?\n)+)?$/;
1517
- parse = (txt, reviver, context) => {
1518
- const parseText = stripBOM(String(txt));
1519
- if (!reviver)
1520
- reviver = void 0;
1521
- context = context || 20;
1522
- try {
1523
- const [, newline = "\n", indent2 = " "] = parseText.match(emptyRE) || parseText.match(formatRE) || [, "", ""];
1524
- const result = JSON.parse(parseText, reviver);
1525
- if (result && typeof result === "object") {
1526
- result[kNewline] = newline;
1527
- result[kIndent] = indent2;
1528
- }
1529
- return result;
1530
- } catch (e) {
1531
- if (typeof txt !== "string" && !Buffer.isBuffer(txt)) {
1532
- const isEmptyArray = Array.isArray(txt) && txt.length === 0;
1533
- throw Object.assign(new TypeError(`Cannot parse ${isEmptyArray ? "an empty array" : String(txt)}`), {
1534
- code: "EJSONPARSE",
1535
- systemError: e
1536
- });
1537
- }
1538
- throw new JSONParseError(e, parseText, context, parse);
1539
- }
1540
- };
1541
- stripBOM = (txt) => String(txt).replace(/^\uFEFF/, "");
1542
- stringify = (obj, replacer, indent2) => {
1543
- const space = indent2 === void 0 ? obj[kIndent] : indent2;
1544
- const res = (
1545
- /* c8 ignore start */
1546
- typeof replacer === "function" ? JSON.stringify(obj, replacer, space) : JSON.stringify(obj, replacer, space)
1547
- );
1548
- const nl = obj[kNewline] || "\n";
1549
- return space ? (nl === "\n" ? res : res.split("\n").join(nl)) + nl : res;
1550
- };
1551
- }
1552
- });
1553
-
1554
- // ../../src/package-json/dist/esm/index.js
1555
- import { readFileSync, writeFileSync } from "node:fs";
1556
- import { resolve as resolve2 } from "node:path";
1557
- var PackageJson;
1558
- var init_esm8 = __esm({
1559
- "../../src/package-json/dist/esm/index.js"() {
1560
- "use strict";
1561
- init_esm();
1562
- init_esm6();
1563
- init_esm7();
1564
- PackageJson = class {
1565
- /**
1566
- * cache of `package.json` loads
1567
- */
1568
- #cache = /* @__PURE__ */ new Map();
1569
- /**
1570
- * cache of `package.json` paths by manifest
1571
- */
1572
- #pathCache = /* @__PURE__ */ new Map();
1573
- /**
1574
- * cache of load errors
1575
- */
1576
- #errCache = /* @__PURE__ */ new Map();
1577
- /**
1578
- * Reads and parses contents of a `package.json` file at a directory `dir`.
1579
- * `reload` will optionally skip reading from the cache when set to `true`.
1580
- */
1581
- read(dir, { reload } = {}) {
1582
- const cachedPackageJson = !reload && this.#cache.get(dir);
1583
- if (cachedPackageJson) {
1584
- return cachedPackageJson;
1585
- }
1586
- const filename = resolve2(dir, "package.json");
1587
- const fail = (err) => error("Could not read package.json file", err, this.read);
1588
- const cachedError = !reload && this.#errCache.get(dir);
1589
- if (cachedError) {
1590
- throw fail(cachedError);
1591
- }
1592
- try {
1593
- const res = asManifest(parse(readFileSync(filename, { encoding: "utf8" })));
1594
- this.#cache.set(dir, res);
1595
- this.#pathCache.set(res, dir);
1596
- return res;
1597
- } catch (err) {
1598
- const ec = {
1599
- path: filename,
1600
- cause: err
1601
- };
1602
- this.#errCache.set(dir, ec);
1603
- throw fail(ec);
1604
- }
1605
- }
1606
- write(dir, manifest) {
1607
- const filename = resolve2(dir, "package.json");
1608
- try {
1609
- writeFileSync(filename, stringify(manifest));
1610
- this.#cache.set(dir, manifest);
1611
- this.#pathCache.set(manifest, dir);
1612
- } catch (err) {
1613
- this.#cache.delete(dir);
1614
- this.#pathCache.delete(manifest);
1615
- throw error("Could not write package.json file", {
1616
- path: filename,
1617
- cause: err
1618
- }, this.write);
1619
- }
1620
- }
1621
- save(manifest) {
1622
- const dir = this.#pathCache.get(manifest);
1623
- if (!dir) {
1624
- throw error("Could not save manifest", {
1625
- manifest
1626
- }, this.save);
1627
- }
1628
- this.write(dir, manifest);
1629
- }
1630
- };
1631
- }
1632
- });
1633
-
1634
1675
  // ../../node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.js
1635
1676
  var require_balanced_match = __commonJS({
1636
1677
  "../../node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.js"(exports, module) {
@@ -8593,13 +8634,13 @@ var asWSConfig, assertWSConfig, Monorepo, workspaceCache, Workspace;
8593
8634
  var init_esm15 = __esm({
8594
8635
  "../../src/workspaces/dist/esm/index.js"() {
8595
8636
  "use strict";
8596
- init_esm5();
8597
- init_esm();
8598
8637
  init_esm8();
8638
+ init_esm();
8639
+ init_esm4();
8599
8640
  init_esm13();
8600
8641
  init_esm14();
8601
8642
  init_esm12();
8602
- init_esm7();
8643
+ init_esm3();
8603
8644
  init_esm9();
8604
8645
  asWSConfig = (conf, path3) => {
8605
8646
  assertWSConfig(conf, path3);
@@ -10768,7 +10809,10 @@ var init_definition = __esm({
10768
10809
  config: "config",
10769
10810
  ix: "install-exec",
10770
10811
  "install-exec": "install-exec",
10771
- pkg: "pkg"
10812
+ pkg: "pkg",
10813
+ list: "list",
10814
+ ls: "list",
10815
+ query: "query"
10772
10816
  };
10773
10817
  getCommand = (s) => s && s in commands ? commands[s] : void 0;
10774
10818
  xdg = new XDG("vlt");
@@ -11086,6 +11130,12 @@ var init_definition = __esm({
11086
11130
  provided, then vlt will interpret the first argument as
11087
11131
  the package, and attempt to run the default executable.`
11088
11132
  }
11133
+ }).opt({
11134
+ view: {
11135
+ hint: "output",
11136
+ description: `Configures the output format for ls & query commands.`,
11137
+ validOptions: ["human", "json", "mermaid"]
11138
+ }
11089
11139
  }).flag({
11090
11140
  "save-dev": {
11091
11141
  short: "D",
@@ -11674,8 +11724,11 @@ var init_config = __esm({
11674
11724
  "../../src/vlt/dist/esm/config/index.js"() {
11675
11725
  "use strict";
11676
11726
  init_esm();
11727
+ init_esm4();
11728
+ init_esm15();
11677
11729
  init_esm16();
11678
- init_esm7();
11730
+ init_esm12();
11731
+ init_esm3();
11679
11732
  init_esm17();
11680
11733
  init_definition();
11681
11734
  init_merge();
@@ -11704,7 +11757,7 @@ var init_config = __esm({
11704
11757
  ]));
11705
11758
  };
11706
11759
  recordsToPairs = (obj) => {
11707
- return Object.fromEntries(Object.entries(obj).map(([k, v]) => [
11760
+ return Object.fromEntries(Object.entries(obj).filter(([k]) => !(k === "scurry" || k === "packageJson" || k === "monorepo" || k === "projectRoot")).map(([k, v]) => [
11708
11761
  k,
11709
11762
  k === "command" && v && typeof v === "object" ? recordsToPairs(v) : !v || typeof v !== "object" || Array.isArray(v) || !isRecordField(k) ? v : Object.entries(v).map(([k2, v2]) => `${k2}=${v2}`)
11710
11763
  ]));
@@ -11735,7 +11788,17 @@ var init_config = __esm({
11735
11788
  get options() {
11736
11789
  if (this.#options)
11737
11790
  return this.#options;
11738
- this.#options = Object.assign(pairsToRecords(this.parse().values), { projectRoot: this.projectRoot });
11791
+ const scurry = new PathScurry(this.projectRoot);
11792
+ const packageJson = new PackageJson();
11793
+ this.#options = Object.assign(pairsToRecords(this.parse().values), {
11794
+ projectRoot: this.projectRoot,
11795
+ scurry,
11796
+ packageJson,
11797
+ monorepo: Monorepo.maybeLoad(this.projectRoot, {
11798
+ scurry,
11799
+ packageJson
11800
+ })
11801
+ });
11739
11802
  return this.#options;
11740
11803
  }
11741
11804
  // memoized options() getter value
@@ -11963,9 +12026,9 @@ var init_config = __esm({
11963
12026
  if (!backup) {
11964
12027
  writeFileSync2(file, "{\n\n}\n");
11965
12028
  }
11966
- await edit(file);
11967
12029
  let valid = false;
11968
12030
  try {
12031
+ await edit(file);
11969
12032
  const res = parse(readFileSync3(file, "utf8"));
11970
12033
  if (!res || typeof res !== "object" || Array.isArray(res)) {
11971
12034
  throw error("Invalid configuration, expected object", {
@@ -12081,15 +12144,12 @@ var loadCommand, run, esm_default;
12081
12144
  var init_esm19 = __esm({
12082
12145
  "../../src/vlt/dist/esm/index.js"() {
12083
12146
  "use strict";
12084
- init_esm15();
12085
- init_config();
12086
- init_esm12();
12087
- init_esm8();
12088
12147
  init_esm();
12148
+ init_config();
12089
12149
  loadCommand = async (command) => {
12090
12150
  try {
12091
- const __commandPath_a618b8cafab3 = `./commands/${command}.js`;
12092
- return await import(__commandPath_a618b8cafab3);
12151
+ const __commandPath_868a7d7f9104 = `./commands/${command}.js`;
12152
+ return await import(__commandPath_868a7d7f9104);
12093
12153
  } catch (e) {
12094
12154
  throw error("Command not implemented", {
12095
12155
  found: command,
@@ -12100,26 +12160,19 @@ var init_esm19 = __esm({
12100
12160
  run = async () => {
12101
12161
  const vlt = await Config.load(process.cwd(), process.argv);
12102
12162
  const cwd = process.cwd();
12103
- const packageJson = new PackageJson();
12104
- const scurry = new PathScurry(vlt.projectRoot);
12105
- const monorepo = Monorepo.maybeLoad(vlt.projectRoot, {
12106
- packageJson,
12107
- scurry
12108
- });
12163
+ const { monorepo } = vlt.options;
12109
12164
  if (vlt.get("workspace") === void 0) {
12110
12165
  const ws = monorepo?.get(cwd);
12111
- if (ws)
12166
+ if (ws) {
12112
12167
  vlt.values.workspace = [ws.path];
12168
+ vlt.options.workspace = [ws.path];
12169
+ }
12113
12170
  }
12114
12171
  const { command, usage } = await loadCommand(vlt.command);
12115
12172
  if (vlt.get("help")) {
12116
12173
  console.log(typeof usage === "function" ? await usage() : usage);
12117
12174
  } else {
12118
- await command(vlt, {
12119
- monorepo,
12120
- packageJson,
12121
- scurry
12122
- });
12175
+ await command(vlt, vlt.options);
12123
12176
  }
12124
12177
  };
12125
12178
  esm_default = run;