@vltpkg/cli-js 1.3.8 → 1.5.0

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.
Files changed (99) hide show
  1. package/{access-WLKANIOE.js → access-QPX4QXV4.js} +13 -12
  2. package/{bugs-5Q3QSTWP.js → bugs-TLOECXEM.js} +28 -25
  3. package/{build-XSFR63AW.js → build-IQOS3LKO.js} +28 -19
  4. package/{cache-UVPK5J5A.js → cache-O5IBYYSB.js} +35 -23
  5. package/cache-unzip-src-unzip.js +56 -12
  6. package/{chunk-NWHKSRO3.js → chunk-2U4PVHP4.js} +5270 -10837
  7. package/{chunk-5KOLUYXH.js → chunk-35EG6T3J.js} +61 -15
  8. package/{chunk-PJJCFMLW.js → chunk-3S3W7QEM.js} +7 -5
  9. package/chunk-43EJ4Q42.js +57 -0
  10. package/{chunk-IHXJVKAE.js → chunk-4TSHLSRK.js} +2 -1
  11. package/chunk-4UH3KMTD.js +6444 -0
  12. package/{chunk-6D54UN4T.js → chunk-5KW6AOTT.js} +1 -1
  13. package/chunk-6IF3RJND.js +81 -0
  14. package/{chunk-IBGFQR23.js → chunk-6LZM3I4Q.js} +56 -11
  15. package/{chunk-FIUUAQGC.js → chunk-6W5XMVIZ.js} +29 -22
  16. package/{chunk-OWMR2EDW.js → chunk-7UWRR6EE.js} +2 -2
  17. package/{chunk-WHLYMMI2.js → chunk-ARE7FKDG.js} +6 -4
  18. package/chunk-B6RIGNEO.js +626 -0
  19. package/{chunk-CB65DPZ2.js → chunk-C6ZVVEFV.js} +239 -1190
  20. package/{chunk-SE2FSMBR.js → chunk-CMLDLZZ3.js} +73 -11
  21. package/{chunk-6P5CFJR7.js → chunk-CS6AYPY5.js} +6 -6
  22. package/{chunk-TLY4VGMH.js → chunk-CW56EJIL.js} +1 -1
  23. package/{chunk-SV4WK3KX.js → chunk-F7NPYSI2.js} +3 -2
  24. package/{chunk-6BQKR2FM.js → chunk-G3FZ2ZJK.js} +1 -1
  25. package/chunk-GUP55DM6.js +59 -0
  26. package/chunk-HOF7LEIC.js +24 -0
  27. package/chunk-IFEZ6BFV.js +1111 -0
  28. package/{chunk-3U6QWN62.js → chunk-IJUVVD7E.js} +1 -1
  29. package/{chunk-H77JYU7F.js → chunk-ISAMD2FE.js} +12 -3
  30. package/{chunk-WKA5UYNA.js → chunk-LH7J5BDU.js} +5 -5
  31. package/{chunk-GZ5MYMBT.js → chunk-LUVDMEW4.js} +1 -1
  32. package/{chunk-OAP2ROTL.js → chunk-MYX4JCIJ.js} +1 -1
  33. package/{chunk-APMYKJI2.js → chunk-QNHBAGXQ.js} +1 -1
  34. package/{chunk-XCDLOQZZ.js → chunk-SMXXFQPI.js} +80 -29
  35. package/chunk-SUU2WETN.js +268 -0
  36. package/chunk-T2VBCUF5.js +77 -0
  37. package/{chunk-EL4GVZK5.js → chunk-T5EP7QEF.js} +2 -2
  38. package/{chunk-A2TSRXZD.js → chunk-UZ6ICZE3.js} +1 -1
  39. package/{chunk-DL3H4EMY.js → chunk-VR7NRWAD.js} +29 -20
  40. package/chunk-W4T5CGCO.js +52 -0
  41. package/{chunk-XDSZO74H.js → chunk-WHWPAYZY.js} +118 -20
  42. package/{chunk-KMOOTBHM.js → chunk-X6JKMIOU.js} +5 -1
  43. package/{chunk-43HNQWPQ.js → chunk-XCQCYB6G.js} +78 -13
  44. package/{chunk-IUL6MPP6.js → chunk-XCSNI6AO.js} +4 -4
  45. package/{chunk-BGA3WB7H.js → chunk-XD5KUDXX.js} +7 -7
  46. package/{chunk-QNDM4DVO.js → chunk-Z5D5KODU.js} +1 -1
  47. package/{ci-EDRETPUF.js → ci-ESVUMOZO.js} +31 -13
  48. package/cli-package.json +1 -1
  49. package/{config-MVNXGEOQ.js → config-TMB2X6DW.js} +12 -9
  50. package/{config-OKBXU7TU.js → config-ZVVLFKR7.js} +16 -13
  51. package/{create-R7BXYJSU.js → create-BLTNKSBQ.js} +28 -25
  52. package/{deprecate-YSUKBKQM.js → deprecate-VA6PGHYL.js} +17 -15
  53. package/{dist-tag-MIGYSR4F.js → dist-tag-OYJREFO2.js} +13 -12
  54. package/{docs-4WVIN75H.js → docs-6OC3OQNM.js} +28 -25
  55. package/{exec-IXHDQLAM.js → exec-AZPGFVRY.js} +28 -25
  56. package/{exec-cache-EA7GHIK7.js → exec-cache-D75UY2WI.js} +24 -22
  57. package/{exec-local-GM4LH56M.js → exec-local-E2JKB4X4.js} +22 -19
  58. package/{help-TCXGBICU.js → help-UPW77X5N.js} +5 -5
  59. package/{init-MWZDWQHM.js → init-SNO6QL7C.js} +14 -11
  60. package/{install-HPI5HU3C.js → install-TEJM2YVX.js} +165 -26
  61. package/{list-2CX6REPJ.js → list-NHCC2RNB.js} +33 -27
  62. package/{login-RAY23CVG.js → login-XNZXCGFD.js} +19 -16
  63. package/{logout-ICB5OMGY.js → logout-YCM7O36Q.js} +13 -12
  64. package/{outdated-FYHPXRMT.js → outdated-4LA7N63W.js} +26 -22
  65. package/{pack-E5MNPQXK.js → pack-RC4CZSWF.js} +25 -18
  66. package/package.json +1 -1
  67. package/{ping-REQ2KSAR.js → ping-RLVAZGDL.js} +13 -12
  68. package/{pkg-YB4GSRII.js → pkg-FED5C6TP.js} +23 -14
  69. package/{profile-GKBW6GRI.js → profile-DJZNLQPG.js} +13 -12
  70. package/{publish-4ZQJYYLF.js → publish-54AMVMTQ.js} +61 -45
  71. package/{query-SKXBF3MJ.js → query-ZQLMSJ7O.js} +35 -29
  72. package/{registry-MQJJCWJY.js → registry-6HKQYSZX.js} +7 -7
  73. package/registry-client-src-revalidate.js +110 -20
  74. package/{repo-ACPTZI2C.js → repo-ITA4BLZ4.js} +28 -25
  75. package/{reporter-4KK2JNGO.js → reporter-UYVR2WMB.js} +73 -14
  76. package/{run-YW3ITX2A.js → run-TP2HTJRN.js} +22 -19
  77. package/{run-exec-7VQX3OFG.js → run-exec-UGCC53DV.js} +22 -19
  78. package/security-archive-src-update-expired.js +88 -28
  79. package/{setup-PLEKCMXN.js → setup-XPAM5U3Z.js} +23 -21
  80. package/skills-LR6GXW3X.js +413 -0
  81. package/skills-YD2TB2VD.js +495 -0
  82. package/{src-XQ7KVUVN.js → src-34D4DOOH.js} +37 -27
  83. package/{src-PXDFMQ6W.js → src-H6DFCAPH.js} +9 -8
  84. package/{src-GP7VLT7P.js → src-LHDC4NJO.js} +58 -9
  85. package/{token-GB7RPE5J.js → token-OF63PFTQ.js} +13 -12
  86. package/{uninstall-RLCECX37.js → uninstall-B54FQ5KQ.js} +20 -15
  87. package/{unpublish-3ZXEAVHF.js → unpublish-CSHIGMDQ.js} +31 -16
  88. package/{update-VDZP6EZN.js → update-HS4VJ5ZG.js} +51 -25
  89. package/{version-MRELJPOK.js → version-L7S3DHUS.js} +24 -14
  90. package/{view-LCXMTGCJ.js → view-NWKKWFVA.js} +17 -15
  91. package/vlr.js +1 -1
  92. package/vlrx.js +1 -1
  93. package/vlt.js +1 -1
  94. package/vlx.js +1 -1
  95. package/vlxl.js +1 -1
  96. package/{whoami-PNRDBS45.js → whoami-65K35VGW.js} +13 -12
  97. package/chunk-4JAZZRKR.js +0 -76
  98. package/chunk-G2YT2GWF.js +0 -120
  99. package/chunk-U7TEQCBN.js +0 -880
@@ -11,7 +11,7 @@ import {createRequire as _vlt_createRequire} from "node:module";
11
11
  var require = _vlt_createRequire(import.meta.filename);
12
12
  import {
13
13
  getId
14
- } from "./chunk-SV4WK3KX.js";
14
+ } from "./chunk-F7NPYSI2.js";
15
15
 
16
16
  // ../../src/cli-sdk/src/stub-node.ts
17
17
  var createStubNode = (spec, name, version, options) => ({
@@ -16,7 +16,7 @@ import {
16
16
  import {
17
17
  isManifest,
18
18
  normalizeBinPaths
19
- } from "./chunk-IBGFQR23.js";
19
+ } from "./chunk-6LZM3I4Q.js";
20
20
  import {
21
21
  error
22
22
  } from "./chunk-WZWDS3W4.js";
@@ -1034,7 +1034,8 @@ import {
1034
1034
  openSync,
1035
1035
  readdirSync,
1036
1036
  readFileSync as readFileSync3,
1037
- statSync as statSync2
1037
+ statSync as statSync2,
1038
+ utimesSync
1038
1039
  } from "node:fs";
1039
1040
  import { join as join2, relative as relative2 } from "node:path";
1040
1041
  import { isDeepStrictEqual } from "node:util";
@@ -1057,9 +1058,15 @@ var storeEntryNames = (root) => {
1057
1058
  };
1058
1059
  var storeCopiedPath = (storeEntry) => storeEntry + ".copied";
1059
1060
  var markStoreEntryCopied = (storeEntry) => {
1061
+ const marker = storeCopiedPath(storeEntry);
1060
1062
  try {
1061
- closeSync(openSync(storeCopiedPath(storeEntry), "wx"));
1063
+ const now = /* @__PURE__ */ new Date();
1064
+ utimesSync(marker, now, now);
1062
1065
  } catch {
1066
+ try {
1067
+ closeSync(openSync(marker, "a"));
1068
+ } catch {
1069
+ }
1063
1070
  }
1064
1071
  };
1065
1072
  var removeStoreEntry = (storeEntry) => {
@@ -1068,6 +1075,7 @@ var removeStoreEntry = (storeEntry) => {
1068
1075
  rimrafSync(storeCopiedPath(storeEntry));
1069
1076
  };
1070
1077
  var storeEntryTime = (storeEntry) => (statSync2(storeIndexPath(storeEntry), noThrow) ?? statSync2(storeEntry, noThrow))?.mtimeMs ?? 0;
1078
+ var storeEntryLastCopied = (storeEntry) => statSync2(storeCopiedPath(storeEntry), noThrow)?.mtimeMs ?? storeEntryTime(storeEntry);
1071
1079
  var storeEntryCopied = (storeEntry, index = readStoreIndex(storeEntry)) => !!index && (index.scripts || !!lstatSync2(storeCopiedPath(storeEntry), noThrow)) && !!lstatSync2(storeEntry, noThrow)?.isDirectory();
1072
1080
  var storeEntryLinked = (storeEntry, index = readStoreIndex(storeEntry)) => !!index?.files.some(
1073
1081
  ([p]) => (lstatSync2(join2(storeEntry, p), noThrow)?.nlink ?? 1) > 1
@@ -1144,6 +1152,7 @@ export {
1144
1152
  markStoreEntryCopied,
1145
1153
  removeStoreEntry,
1146
1154
  storeEntryTime,
1155
+ storeEntryLastCopied,
1147
1156
  storeEntryCopied,
1148
1157
  storeEntryLinked,
1149
1158
  verifyStoreEntry
@@ -11,13 +11,13 @@ import {createRequire as _vlt_createRequire} from "node:module";
11
11
  var require = _vlt_createRequire(import.meta.filename);
12
12
  import {
13
13
  openUrl
14
- } from "./chunk-OWMR2EDW.js";
15
- import {
16
- stderr
17
- } from "./chunk-XDSZO74H.js";
14
+ } from "./chunk-7UWRR6EE.js";
18
15
  import {
19
16
  mermaidOutput
20
- } from "./chunk-NWHKSRO3.js";
17
+ } from "./chunk-4UH3KMTD.js";
18
+ import {
19
+ stderr
20
+ } from "./chunk-WHWPAYZY.js";
21
21
  import {
22
22
  ViewClass
23
23
  } from "./chunk-4KCU2KZL.js";
@@ -12,7 +12,7 @@ var require = _vlt_createRequire(import.meta.filename);
12
12
  import {
13
13
  Spec,
14
14
  kCustomInspect
15
- } from "./chunk-IBGFQR23.js";
15
+ } from "./chunk-6LZM3I4Q.js";
16
16
 
17
17
  // ../../src/spec/src/index.ts
18
18
  import { homedir } from "node:os";
@@ -34,7 +34,7 @@ var run = async (command) => {
34
34
  if (command) {
35
35
  process.argv.splice(2, 0, command);
36
36
  }
37
- const vlt = await import("./src-XQ7KVUVN.js");
37
+ const vlt = await import("./src-34D4DOOH.js");
38
38
  await vlt.default();
39
39
  };
40
40
 
@@ -12,7 +12,7 @@ var require = _vlt_createRequire(import.meta.filename);
12
12
  import {
13
13
  promiseSpawn,
14
14
  which
15
- } from "./chunk-U7TEQCBN.js";
15
+ } from "./chunk-SUU2WETN.js";
16
16
 
17
17
  // ../../src/url-open/src/index.ts
18
18
  import { release } from "node:os";
@@ -13,19 +13,19 @@ import {
13
13
  asDepID,
14
14
  baseDepID,
15
15
  splitDepID
16
- } from "./chunk-SV4WK3KX.js";
16
+ } from "./chunk-F7NPYSI2.js";
17
17
  import {
18
18
  userAgent
19
- } from "./chunk-6BQKR2FM.js";
19
+ } from "./chunk-G3FZ2ZJK.js";
20
20
  import {
21
21
  I
22
- } from "./chunk-U7TEQCBN.js";
22
+ } from "./chunk-B6RIGNEO.js";
23
23
  import {
24
24
  XDG
25
25
  } from "./chunk-XNLSTHDK.js";
26
26
  import {
27
27
  defaultRegistryName
28
- } from "./chunk-IBGFQR23.js";
28
+ } from "./chunk-6LZM3I4Q.js";
29
29
  import {
30
30
  error
31
31
  } from "./chunk-WZWDS3W4.js";
@@ -245,6 +245,27 @@ var asPackageReportData = (o) => {
245
245
  }
246
246
  return o;
247
247
  };
248
+ var getItemScore = (data) => {
249
+ if (data._type || !data.score) return void 0;
250
+ const {
251
+ license,
252
+ maintenance,
253
+ quality,
254
+ supplyChain,
255
+ vulnerability
256
+ } = data.score;
257
+ const scoreComponents = [
258
+ license,
259
+ maintenance,
260
+ quality,
261
+ supplyChain,
262
+ vulnerability
263
+ ];
264
+ const overall = Number(
265
+ (scoreComponents.reduce((sum, score) => sum + score, 0) / scoreComponents.length).toFixed(2)
266
+ );
267
+ return { ...data.score, overall };
268
+ };
248
269
 
249
270
  // ../../src/security-archive/src/update-expired.ts
250
271
  import { resolve } from "node:path";
@@ -270,10 +291,15 @@ var usesNpmRegistry = (node) => {
270
291
  // ../../src/security-archive/src/index.ts
271
292
  var SOCKET_API_V0_URL = "https://api.socket.dev/v0/purl?alerts=true";
272
293
  var SOCKET_PUBLIC_API_TOKEN = "sktsec_t_--RAN5U4ivauy4w37-6aoKyYPDt5ZbaT5JBVMqiwKo_api";
294
+ var asTimeout = (raw) => {
295
+ const n = Number(raw);
296
+ return Number.isInteger(n) && n > 0 && n <= 2147483647 ? n : void 0;
297
+ };
273
298
  var SecurityArchive = class _SecurityArchive extends I {
274
299
  #expired = /* @__PURE__ */ new Set();
275
300
  #path;
276
301
  #retries;
302
+ #timeout;
277
303
  #nodesByName = /* @__PURE__ */ new Map();
278
304
  #nodesByID = /* @__PURE__ */ new Map();
279
305
  /**
@@ -281,6 +307,10 @@ var SecurityArchive = class _SecurityArchive extends I {
281
307
  * for all public registry packages from the initial list of nodes.
282
308
  */
283
309
  ok = false;
310
+ /**
311
+ * True if the last refresh() timed out waiting for the remote API.
312
+ */
313
+ timedOut = false;
284
314
  /**
285
315
  * Creates a new security archive instance and starts the refresh process.
286
316
  */
@@ -301,6 +331,12 @@ var SecurityArchive = class _SecurityArchive extends I {
301
331
  static get defaultTtl() {
302
332
  return 1e3 * 60 * 60 * 3;
303
333
  }
334
+ /**
335
+ * By default, remote requests time out after 30 seconds.
336
+ */
337
+ static get defaultTimeout() {
338
+ return 3e4;
339
+ }
304
340
  constructor(options = {}) {
305
341
  super({
306
342
  max: _SecurityArchive.defaultMax,
@@ -310,6 +346,7 @@ var SecurityArchive = class _SecurityArchive extends I {
310
346
  });
311
347
  this.#path = options.path ?? new XDG("vlt").cache("security-archive.db");
312
348
  this.#retries = options.retries ?? 3;
349
+ this.#timeout = asTimeout(options.timeout) ?? asTimeout(process.env.VLT_SECURITY_ARCHIVE_TIMEOUT) ?? _SecurityArchive.defaultTimeout;
313
350
  }
314
351
  /**
315
352
  * Get the report data for a node, keyed by its base {@link DepID}.
@@ -412,6 +449,7 @@ var SecurityArchive = class _SecurityArchive extends I {
412
449
  const payload = {
413
450
  dbPath: this.#path,
414
451
  retries: this.#retries,
452
+ timeout: this.#timeout,
415
453
  ttl: _SecurityArchive.defaultTtl,
416
454
  expired
417
455
  };
@@ -453,7 +491,7 @@ var SecurityArchive = class _SecurityArchive extends I {
453
491
  * Fetches security information from the socket.dev API.
454
492
  * Returns a string of NDJSON data.
455
493
  */
456
- async #retrieveRemoteData(queue) {
494
+ async #retrieveRemoteData(queue, signal) {
457
495
  const req = await fetch(SOCKET_API_V0_URL, {
458
496
  method: "POST",
459
497
  headers: {
@@ -462,7 +500,8 @@ var SecurityArchive = class _SecurityArchive extends I {
462
500
  },
463
501
  body: JSON.stringify({
464
502
  components: Array.from(queue)
465
- })
503
+ }),
504
+ signal
466
505
  });
467
506
  if (req.status === 404) {
468
507
  throw new AbortError("Missing API");
@@ -473,6 +512,25 @@ var SecurityArchive = class _SecurityArchive extends I {
473
512
  const str = await req.text();
474
513
  return str.trim() + "\n";
475
514
  }
515
+ /**
516
+ * Fetches remote data within the configured timeout, retries included.
517
+ * Returns `undefined` on timeout so that queued packages stay unscanned.
518
+ */
519
+ async #fetchRemoteData(queue) {
520
+ const signal = AbortSignal.timeout(this.#timeout);
521
+ try {
522
+ return await pRetry(
523
+ () => this.#retrieveRemoteData(queue, signal),
524
+ { retries: this.#retries, signal }
525
+ );
526
+ } catch (err) {
527
+ if (!signal.aborted) throw err;
528
+ this.timedOut = true;
529
+ console.warn(
530
+ `security-archive: timed out after ${this.#timeout}ms fetching security data; ${queue.size} package(s) left unscanned (use :scanned to exclude them). Set VLT_SECURITY_ARCHIVE_TIMEOUT=<ms> to wait longer.`
531
+ );
532
+ }
533
+ }
476
534
  /**
477
535
  * Parses and load NDJSON data into the in-memory cache.
478
536
  * Returns a set of dep ids that were successfully loaded.
@@ -483,31 +541,23 @@ var SecurityArchive = class _SecurityArchive extends I {
483
541
  for (const line of json) {
484
542
  if (!line.trim()) continue;
485
543
  const data = JSON.parse(line + "}");
544
+ if (data._type) continue;
486
545
  const scope = data.namespace ? `${data.namespace}/` : "";
487
546
  const name = `${scope}${data.name}`;
488
- const node = this.#retrieveNodeByNameVersion(name, data.version);
547
+ const node = this.#retrieveNodeByNameVersion(
548
+ name,
549
+ String(data.version)
550
+ );
489
551
  if (node) {
552
+ const score = getItemScore(data);
553
+ if (!score) continue;
490
554
  const normalizedId = baseDepID(node.id);
491
- fetchedDepIDs.add(baseDepID(node.id));
492
- const scoreComponents = [
493
- data.score.license,
494
- data.score.maintenance,
495
- data.score.quality,
496
- data.score.supplyChain,
497
- data.score.vulnerability
498
- ];
499
- const newAverageScore = Number(
500
- (scoreComponents.reduce((sum, score) => sum + score, 0) / scoreComponents.length).toFixed(2)
501
- );
502
- const scoreWithNewAverage = {
503
- ...data.score,
504
- overall: newAverageScore
505
- };
555
+ fetchedDepIDs.add(normalizedId);
506
556
  this.set(
507
557
  normalizedId,
508
558
  asPackageReportData({
509
559
  ...data,
510
- score: scoreWithNewAverage
560
+ score
511
561
  })
512
562
  );
513
563
  } else {
@@ -565,6 +615,7 @@ var SecurityArchive = class _SecurityArchive extends I {
565
615
  */
566
616
  async refresh({ nodes }) {
567
617
  this.clear();
618
+ this.timedOut = false;
568
619
  const db = this.#openDatabase();
569
620
  this.#nodesByName.clear();
570
621
  this.#nodesByID.clear();
@@ -578,12 +629,11 @@ var SecurityArchive = class _SecurityArchive extends I {
578
629
  this.#loadItemsFromDatabase(db, nodes);
579
630
  const queue = this.#queueUpRequiredPackages();
580
631
  if (queue.size > 0) {
581
- const res = await pRetry(
582
- () => this.#retrieveRemoteData(queue),
583
- { retries: this.#retries }
584
- );
585
- const ids = this.#loadFromNDJSON(res);
586
- this.#storeNewItemsToDatabase(db, ids);
632
+ const res = await this.#fetchRemoteData(queue);
633
+ if (res !== void 0) {
634
+ const ids = this.#loadFromNDJSON(res);
635
+ this.#storeNewItemsToDatabase(db, ids);
636
+ }
587
637
  }
588
638
  this.#validateReportData();
589
639
  } finally {
@@ -613,5 +663,6 @@ var SecurityArchive = class _SecurityArchive extends I {
613
663
  export {
614
664
  AbortError,
615
665
  pRetry,
666
+ usesNpmRegistry,
616
667
  SecurityArchive
617
668
  };
@@ -0,0 +1,268 @@
1
+ var global = globalThis;
2
+ import {Buffer} from "node:buffer";
3
+ import {setTimeout as _vlt_setTimeout,clearTimeout as _vlt_clearTimeout,setImmediate as _vlt_setImmediate,clearImmediate as _vlt_clearImmediate,setInterval as _vlt_setInterval,clearInterval as _vlt_clearInterval} from "node:timers";
4
+ globalThis.setTimeout = _vlt_setTimeout;
5
+ globalThis.clearTimeout = _vlt_clearTimeout;
6
+ globalThis.setImmediate = _vlt_setImmediate;
7
+ globalThis.clearImmediate = _vlt_clearImmediate;
8
+ globalThis.setInterval = _vlt_setInterval;
9
+ globalThis.clearInterval = _vlt_clearInterval;
10
+ import {createRequire as _vlt_createRequire} from "node:module";
11
+ var require = _vlt_createRequire(import.meta.filename);
12
+ import {
13
+ error
14
+ } from "./chunk-WZWDS3W4.js";
15
+
16
+ // ../../src/promise-spawn/src/index.ts
17
+ import { spawn } from "node:child_process";
18
+ var isPipe = (stdio = "pipe", fd) => stdio === "pipe" || stdio === "overlapped" || stdio === null ? true : Array.isArray(stdio) ? isPipe(stdio[fd], fd) : false;
19
+ function stdioResult(stdout, stderr, o) {
20
+ return {
21
+ stdout: !isPipe(o.stdio, 1) ? null : o.stdioString !== false ? Buffer.concat(stdout).toString().trim() : Buffer.concat(stdout),
22
+ stderr: !isPipe(o.stdio, 2) ? null : o.stdioString !== false ? Buffer.concat(stderr).toString().trim() : Buffer.concat(stderr)
23
+ };
24
+ }
25
+ var SpawnPromise = class extends Promise {
26
+ [Symbol.toStringTag] = "SpawnPromise";
27
+ /** The spawned process this promise references */
28
+ process;
29
+ /** Expose the child process stdin, if available */
30
+ stdin;
31
+ /**
32
+ * Set static `Symbol.species` back to the base Promise class so that
33
+ * v8 doesn't get confused by the changed constructor signature.
34
+ */
35
+ static get [Symbol.species]() {
36
+ return Promise;
37
+ }
38
+ constructor(command, args, opts, extra = {}) {
39
+ let proc;
40
+ super((res, rej) => {
41
+ proc = spawn(command, args, opts);
42
+ const stdout = [];
43
+ const stderr = [];
44
+ const reject = (er, status, signal) => {
45
+ const stdio = stdioResult(stdout, stderr, opts);
46
+ const errorResult = {
47
+ command,
48
+ args,
49
+ stdout: stdio.stdout,
50
+ stderr: stdio.stderr,
51
+ cwd: opts.cwd?.toString() ?? process.cwd()
52
+ };
53
+ if (er !== void 0) {
54
+ errorResult.cause = er;
55
+ }
56
+ if (status !== void 0) {
57
+ errorResult.status = status;
58
+ }
59
+ if (signal !== void 0) {
60
+ errorResult.signal = signal;
61
+ }
62
+ Object.assign(errorResult, extra);
63
+ rej(error("command failed", errorResult));
64
+ };
65
+ const resolve = (status, signal) => {
66
+ const stdio = stdioResult(stdout, stderr, opts);
67
+ const successResult = {
68
+ command,
69
+ args,
70
+ status,
71
+ signal,
72
+ stdout: stdio.stdout,
73
+ stderr: stdio.stderr,
74
+ cwd: opts.cwd?.toString() ?? process.cwd()
75
+ };
76
+ Object.assign(successResult, extra);
77
+ res(successResult);
78
+ };
79
+ proc.on("error", reject);
80
+ proc.stdout?.on("data", (c) => stdout.push(c)).on("error", reject);
81
+ proc.stderr?.on("data", (c) => stderr.push(c)).on("error", reject);
82
+ proc.on("close", (status, signal) => {
83
+ if ((status || signal) && !opts.acceptFail) {
84
+ reject(void 0, status, signal);
85
+ } else {
86
+ resolve(status, signal);
87
+ }
88
+ });
89
+ });
90
+ this.process = proc;
91
+ this.stdin = proc.stdin;
92
+ }
93
+ };
94
+ function promiseSpawn(command, args, opts = {}, extra = {}) {
95
+ return new SpawnPromise(command, args, opts, extra);
96
+ }
97
+
98
+ // ../../node_modules/.vlt/~npm~isexe@3.1.5/node_modules/isexe/dist/esm/index.min.js
99
+ import { statSync as w } from "node:fs";
100
+ import { stat as S } from "node:fs/promises";
101
+ import { statSync as k } from "node:fs";
102
+ import { stat as I } from "node:fs/promises";
103
+ import { delimiter as _ } from "node:path";
104
+ var y = Object.defineProperty;
105
+ var u = (t, r) => {
106
+ for (var e in r) y(t, e, { get: r[e], enumerable: true });
107
+ };
108
+ var i = {};
109
+ u(i, { isexe: () => C, sync: () => A });
110
+ var C = async (t, r = {}) => {
111
+ let { ignoreErrors: e = false } = r;
112
+ try {
113
+ return d(await S(t), r);
114
+ } catch (s) {
115
+ let o = s;
116
+ if (e || o.code === "EACCES") return false;
117
+ throw o;
118
+ }
119
+ };
120
+ var A = (t, r = {}) => {
121
+ let { ignoreErrors: e = false } = r;
122
+ try {
123
+ return d(w(t), r);
124
+ } catch (s) {
125
+ let o = s;
126
+ if (e || o.code === "EACCES") return false;
127
+ throw o;
128
+ }
129
+ };
130
+ var d = (t, r) => t.isFile() && T(t, r);
131
+ var T = (t, r) => {
132
+ let e = r.uid ?? process.getuid?.(), s = r.groups ?? process.getgroups?.() ?? [], o = r.gid ?? process.getgid?.() ?? s[0];
133
+ if (e === void 0 || o === void 0) throw new Error("cannot get uid or gid");
134
+ let c = /* @__PURE__ */ new Set([o, ...s]), n = t.mode, l = t.uid, E = t.gid, f = parseInt("100", 8), p = parseInt("010", 8), x = parseInt("001", 8), h = f | p;
135
+ return !!(n & x || n & p && c.has(E) || n & f && l === e || n & h && e === 0);
136
+ };
137
+ var a = {};
138
+ u(a, { isexe: () => F, sync: () => L });
139
+ var F = async (t, r = {}) => {
140
+ let { ignoreErrors: e = false } = r;
141
+ try {
142
+ return m(await I(t), t, r);
143
+ } catch (s) {
144
+ let o = s;
145
+ if (e || o.code === "EACCES") return false;
146
+ throw o;
147
+ }
148
+ };
149
+ var L = (t, r = {}) => {
150
+ let { ignoreErrors: e = false } = r;
151
+ try {
152
+ return m(k(t), t, r);
153
+ } catch (s) {
154
+ let o = s;
155
+ if (e || o.code === "EACCES") return false;
156
+ throw o;
157
+ }
158
+ };
159
+ var P = (t, r) => {
160
+ let { pathExt: e = process.env.PATHEXT || "" } = r, s = e.split(_);
161
+ if (s.indexOf("") !== -1) return true;
162
+ for (let o of s) {
163
+ let c = o.toLowerCase(), n = t.substring(t.length - c.length).toLowerCase();
164
+ if (c && n === c) return true;
165
+ }
166
+ return false;
167
+ };
168
+ var m = (t, r, e) => t.isFile() && P(r, e);
169
+ var v = process.env._ISEXE_TEST_PLATFORM_ || process.platform;
170
+ var g = v === "win32" ? a : i;
171
+ var R = g.isexe;
172
+ var U = g.sync;
173
+
174
+ // ../../src/which/src/index.ts
175
+ import { delimiter, join, sep } from "node:path";
176
+ var isWindows = process.platform === "win32";
177
+ var rSlash = sep === "/" ? /\// : /[\\/]/;
178
+ var rRel = new RegExp(`^\\.${rSlash.source}`);
179
+ var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
180
+ var getPathInfo = (cmd, {
181
+ path: optPath = process.env.PATH,
182
+ pathExt: optPathExt = process.env.PATHEXT,
183
+ delimiter: optDelimiter = delimiter
184
+ }) => {
185
+ const pathEnv = cmd.match(rSlash) ? [""] : [
186
+ // windows always checks the cwd first
187
+ /* c8 ignore next - platform-specific */
188
+ ...isWindows ? [process.cwd()] : [],
189
+ ...(optPath ?? /* c8 ignore next - very unusual */
190
+ "").split(
191
+ optDelimiter
192
+ )
193
+ ];
194
+ if (isWindows) {
195
+ const pathExtExe = optPathExt || [".EXE", ".CMD", ".BAT", ".COM"].join(optDelimiter);
196
+ const pathExt = pathExtExe.split(optDelimiter).flatMap((item) => [item, item.toLowerCase()]);
197
+ if (cmd.includes(".") && pathExt[0] !== "") {
198
+ pathExt.unshift("");
199
+ }
200
+ return { pathEnv, pathExt, pathExtExe };
201
+ }
202
+ return { pathEnv, pathExt: [""] };
203
+ };
204
+ var getPathPart = (raw, cmd) => {
205
+ const pathPart = /^".*"$/.test(raw) ? raw.slice(1, -1) : raw;
206
+ const prefix = !pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : "";
207
+ return prefix + join(pathPart, cmd);
208
+ };
209
+ async function which(cmd, opt = {}) {
210
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
211
+ const found = [];
212
+ for (const envPart of pathEnv) {
213
+ const p = getPathPart(envPart, cmd);
214
+ for (const ext of pathExt) {
215
+ const withExt = p + ext;
216
+ const is = await R(withExt, {
217
+ pathExt: pathExtExe,
218
+ ignoreErrors: true
219
+ });
220
+ if (is) {
221
+ if (!opt.all) {
222
+ return withExt;
223
+ }
224
+ found.push(withExt);
225
+ }
226
+ }
227
+ }
228
+ if (opt.all && found.length) {
229
+ return found;
230
+ }
231
+ if (opt.nothrow) {
232
+ return null;
233
+ }
234
+ throw getNotFoundError(cmd);
235
+ }
236
+ function whichSync(cmd, opt = {}) {
237
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
238
+ const found = [];
239
+ for (const pathEnvPart of pathEnv) {
240
+ const p = getPathPart(pathEnvPart, cmd);
241
+ for (const ext of pathExt) {
242
+ const withExt = p + ext;
243
+ const is = U(withExt, {
244
+ pathExt: pathExtExe,
245
+ ignoreErrors: true
246
+ });
247
+ if (is) {
248
+ if (!opt.all) {
249
+ return withExt;
250
+ }
251
+ found.push(withExt);
252
+ }
253
+ }
254
+ }
255
+ if (opt.all && found.length) {
256
+ return found;
257
+ }
258
+ if (opt.nothrow) {
259
+ return null;
260
+ }
261
+ throw getNotFoundError(cmd);
262
+ }
263
+
264
+ export {
265
+ promiseSpawn,
266
+ which,
267
+ whichSync
268
+ };
@@ -0,0 +1,77 @@
1
+ var global = globalThis;
2
+ import {Buffer} from "node:buffer";
3
+ import {setTimeout as _vlt_setTimeout,clearTimeout as _vlt_clearTimeout,setImmediate as _vlt_setImmediate,clearImmediate as _vlt_clearImmediate,setInterval as _vlt_setInterval,clearInterval as _vlt_clearInterval} from "node:timers";
4
+ globalThis.setTimeout = _vlt_setTimeout;
5
+ globalThis.clearTimeout = _vlt_clearTimeout;
6
+ globalThis.setImmediate = _vlt_setImmediate;
7
+ globalThis.clearImmediate = _vlt_clearImmediate;
8
+ globalThis.setInterval = _vlt_setInterval;
9
+ globalThis.clearInterval = _vlt_clearInterval;
10
+ import {createRequire as _vlt_createRequire} from "node:module";
11
+ var require = _vlt_createRequire(import.meta.filename);
12
+ import {
13
+ error
14
+ } from "./chunk-WZWDS3W4.js";
15
+ import {
16
+ __glob
17
+ } from "./chunk-PZLD7RTK.js";
18
+
19
+ // import("./commands/**/*.ts") in ../../src/cli-sdk/src/load-command.ts
20
+ var globImport_commands_ts = __glob({
21
+ "./commands/access.ts": () => import("./access-QPX4QXV4.js"),
22
+ "./commands/bugs.ts": () => import("./bugs-TLOECXEM.js"),
23
+ "./commands/build.ts": () => import("./build-IQOS3LKO.js"),
24
+ "./commands/cache.ts": () => import("./cache-O5IBYYSB.js"),
25
+ "./commands/ci.ts": () => import("./ci-ESVUMOZO.js"),
26
+ "./commands/config.ts": () => import("./config-ZVVLFKR7.js"),
27
+ "./commands/create.ts": () => import("./create-BLTNKSBQ.js"),
28
+ "./commands/deprecate.ts": () => import("./deprecate-VA6PGHYL.js"),
29
+ "./commands/dist-tag.ts": () => import("./dist-tag-OYJREFO2.js"),
30
+ "./commands/docs.ts": () => import("./docs-6OC3OQNM.js"),
31
+ "./commands/exec-cache.ts": () => import("./exec-cache-D75UY2WI.js"),
32
+ "./commands/exec-local.ts": () => import("./exec-local-E2JKB4X4.js"),
33
+ "./commands/exec.ts": () => import("./exec-AZPGFVRY.js"),
34
+ "./commands/help.ts": () => import("./help-UPW77X5N.js"),
35
+ "./commands/init.ts": () => import("./init-SNO6QL7C.js"),
36
+ "./commands/install.ts": () => import("./install-TEJM2YVX.js"),
37
+ "./commands/install/reporter.ts": () => import("./reporter-UYVR2WMB.js"),
38
+ "./commands/list.ts": () => import("./list-NHCC2RNB.js"),
39
+ "./commands/login.ts": () => import("./login-XNZXCGFD.js"),
40
+ "./commands/logout.ts": () => import("./logout-YCM7O36Q.js"),
41
+ "./commands/outdated.ts": () => import("./outdated-4LA7N63W.js"),
42
+ "./commands/pack.ts": () => import("./pack-RC4CZSWF.js"),
43
+ "./commands/ping.ts": () => import("./ping-RLVAZGDL.js"),
44
+ "./commands/pkg.ts": () => import("./pkg-FED5C6TP.js"),
45
+ "./commands/profile.ts": () => import("./profile-DJZNLQPG.js"),
46
+ "./commands/publish.ts": () => import("./publish-54AMVMTQ.js"),
47
+ "./commands/query.ts": () => import("./query-ZQLMSJ7O.js"),
48
+ "./commands/registry.ts": () => import("./registry-6HKQYSZX.js"),
49
+ "./commands/repo.ts": () => import("./repo-ITA4BLZ4.js"),
50
+ "./commands/run-exec.ts": () => import("./run-exec-UGCC53DV.js"),
51
+ "./commands/run.ts": () => import("./run-TP2HTJRN.js"),
52
+ "./commands/setup.ts": () => import("./setup-XPAM5U3Z.js"),
53
+ "./commands/skills.ts": () => import("./skills-LR6GXW3X.js"),
54
+ "./commands/token.ts": () => import("./token-OF63PFTQ.js"),
55
+ "./commands/uninstall.ts": () => import("./uninstall-B54FQ5KQ.js"),
56
+ "./commands/unpublish.ts": () => import("./unpublish-CSHIGMDQ.js"),
57
+ "./commands/update.ts": () => import("./update-HS4VJ5ZG.js"),
58
+ "./commands/version.ts": () => import("./version-L7S3DHUS.js"),
59
+ "./commands/view.ts": () => import("./view-NWKKWFVA.js"),
60
+ "./commands/whoami.ts": () => import("./whoami-65K35VGW.js")
61
+ });
62
+
63
+ // ../../src/cli-sdk/src/load-command.ts
64
+ var loadCommand = async (command) => {
65
+ try {
66
+ return await globImport_commands_ts(`./commands/${command}.ts`);
67
+ } catch (e) {
68
+ throw error("Could not load command", {
69
+ found: command,
70
+ cause: e
71
+ });
72
+ }
73
+ };
74
+
75
+ export {
76
+ loadCommand
77
+ };
@@ -15,10 +15,10 @@ import {
15
15
  } from "./chunk-SRWDPPLX.js";
16
16
  import {
17
17
  minimatch
18
- } from "./chunk-CB65DPZ2.js";
18
+ } from "./chunk-C6ZVVEFV.js";
19
19
  import {
20
20
  Spec
21
- } from "./chunk-GZ5MYMBT.js";
21
+ } from "./chunk-LUVDMEW4.js";
22
22
  import {
23
23
  parse,
24
24
  stringify