@vltpkg/cli-js 1.0.0-rc.31 → 1.0.0-rc.33

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 (85) hide show
  1. package/{access-I7Q5S4HE.js → access-VP3KSJ2M.js} +23 -12
  2. package/{bugs-45YPQ2T5.js → bugs-4ZQXJA4F.js} +19 -17
  3. package/{build-ICCKNOZT.js → build-P74RVUUP.js} +13 -9
  4. package/{cache-U44GAPOY.js → cache-J4J3ZWXP.js} +19 -14
  5. package/cache-unzip-src-unzip.js +434 -428
  6. package/{chunk-Q3DNNTPG.js → chunk-2PLIV3N3.js} +113 -34
  7. package/{chunk-BCS77CZK.js → chunk-4RZDJQ5U.js} +42 -61
  8. package/{chunk-X5R27Q65.js → chunk-4SSFBFB5.js} +123 -92
  9. package/{chunk-QZ6G5VRS.js → chunk-5COWONUB.js} +5 -5
  10. package/{chunk-TLCNALWV.js → chunk-7KI6XHXZ.js} +68 -7
  11. package/{chunk-R44FR7BY.js → chunk-7NHXV6AH.js} +439 -433
  12. package/{chunk-FBTBHRPG.js → chunk-7TNSW6W3.js} +1 -1
  13. package/{chunk-UUE6D7ZK.js → chunk-BAUMCTQK.js} +694 -440
  14. package/{chunk-FXDRM4ZO.js → chunk-CLVRCGOZ.js} +247 -235
  15. package/{chunk-YCQTLBWF.js → chunk-CNSTFT7U.js} +1 -1
  16. package/{chunk-BCG46IIG.js → chunk-DJYKQWV2.js} +7 -7
  17. package/chunk-E74WGW5C.js +49 -0
  18. package/chunk-EAWRHC27.js +75 -0
  19. package/{chunk-IYO5QKUW.js → chunk-EFWPI6IY.js} +1 -1
  20. package/{chunk-JVCMIUEP.js → chunk-EQ633HIM.js} +14 -13
  21. package/{chunk-U6ONVNUF.js → chunk-F2FKLPZD.js} +7 -7
  22. package/chunk-FAG776ZD.js +137 -0
  23. package/{chunk-HQ4US6G3.js → chunk-FWKQ7YDF.js} +1049 -980
  24. package/{chunk-OMHPDQOQ.js → chunk-GTICKXWZ.js} +11 -8
  25. package/{chunk-SZPDTJMF.js → chunk-ICJRCXSG.js} +31 -27
  26. package/{chunk-YHLRGHF7.js → chunk-JEE4B4FL.js} +3 -3
  27. package/{chunk-5XHNL6N6.js → chunk-JLGPPV6Z.js} +62 -12
  28. package/{chunk-U5KA63OT.js → chunk-JZQAUAHT.js} +1 -1
  29. package/{chunk-C2X7PVDF.js → chunk-MT76WHSM.js} +1 -1
  30. package/{chunk-EXHIB5H4.js → chunk-OTNMX4EK.js} +3 -3
  31. package/{chunk-2V4AQPBR.js → chunk-PMCAQG5J.js} +85 -46
  32. package/{chunk-PHJXJ53A.js → chunk-PW6S6AIO.js} +15 -11
  33. package/{chunk-NLFBANVO.js → chunk-SSN4CYZF.js} +18 -2
  34. package/chunk-UBLFPJHV.js +40 -0
  35. package/{chunk-Y7QHAJJQ.js → chunk-VGWEB64T.js} +3164 -2822
  36. package/{chunk-LRPTCGTW.js → chunk-XA47WS4N.js} +11 -15
  37. package/{chunk-QHBKZE6U.js → chunk-XIJFEV6U.js} +3 -3
  38. package/{ci-5CK3JONP.js → ci-GIDCFAZF.js} +14 -10
  39. package/cli-package.json +6 -2
  40. package/{config-MUVNKIGE.js → config-LIQMIMTF.js} +15 -13
  41. package/{config-4TAZ2WKY.js → config-NBO3COMM.js} +13 -11
  42. package/{create-GLJ454QZ.js → create-K2S3J62I.js} +24 -19
  43. package/{deprecate-WBRB2ACU.js → deprecate-4PJKNFXN.js} +22 -14
  44. package/{devtools-6NFQDW4L.js → devtools-HGLF4KAO.js} +82 -28
  45. package/{dist-tag-CQJW5BXA.js → dist-tag-TA6LWT2V.js} +16 -9
  46. package/{docs-DEGETERR.js → docs-ZCMIKQAN.js} +19 -17
  47. package/{exec-MP4CE2QF.js → exec-XVF4KCRJ.js} +24 -19
  48. package/{exec-cache-O5OTIYVM.js → exec-cache-2IWJNBFB.js} +22 -17
  49. package/{exec-local-S3253EEU.js → exec-local-FNFTQYFP.js} +17 -14
  50. package/{help-3ELBHB5T.js → help-ZDRILKVQ.js} +5 -4
  51. package/{init-VAPZRSOP.js → init-VMYJE5Q3.js} +12 -10
  52. package/{install-WI2XDPTF.js → install-ZHMWN27D.js} +27 -12
  53. package/{list-EDGJ5OZS.js → list-BPFKWXCR.js} +20 -15
  54. package/{login-2QU5SPGP.js → login-DQL5A4NT.js} +23 -9
  55. package/{logout-DVW3KZKJ.js → logout-Q74VRDSN.js} +19 -8
  56. package/{pack-FVQFCACM.js → pack-GLURO5KY.js} +17 -13
  57. package/package.json +8 -1
  58. package/{ping-5NKJAV3C.js → ping-PPEYPKZD.js} +17 -10
  59. package/{pkg-A6UAZWJJ.js → pkg-UTEKJ5CB.js} +13 -11
  60. package/{profile-OZYH6GL2.js → profile-5QFRWC2L.js} +16 -8
  61. package/{publish-7BC7UGRG.js → publish-5VDI3JXX.js} +23 -16
  62. package/{query-4ADVFHJD.js → query-I6DZ7TF2.js} +20 -15
  63. package/registry-ZVO3VAHY.js +117 -0
  64. package/registry-client-package.json +6 -2
  65. package/registry-client-src-revalidate.js +1233 -975
  66. package/{repo-NQCC2SV5.js → repo-SB3C7MZZ.js} +19 -17
  67. package/{reporter-MSQWYN76.js → reporter-2XBYWAVU.js} +3 -2
  68. package/{run-L647KHX5.js → run-U6CW5Q56.js} +17 -14
  69. package/{run-exec-6ACC3NDU.js → run-exec-RFB572AL.js} +19 -14
  70. package/security-archive-src-update-expired.js +16 -11
  71. package/setup-BFKUYGJB.js +181 -0
  72. package/{src-7GDXNZM6.js → src-ZWBXAZOV.js} +25 -17
  73. package/{token-MW32RFPW.js → token-M5HPJJJQ.js} +23 -10
  74. package/{uninstall-D3ZT544Q.js → uninstall-UUBTM4ZQ.js} +15 -11
  75. package/{unpublish-JB274OID.js → unpublish-WDSRB6DV.js} +17 -9
  76. package/{update-FILF2X56.js → update-J4BEFJRC.js} +14 -10
  77. package/{version-TMUOHL5P.js → version-ZVG66SKC.js} +12 -10
  78. package/{view-XHDLAT6W.js → view-WFK75G74.js} +19 -15
  79. package/vlr.js +1 -1
  80. package/vlrx.js +1 -1
  81. package/vlt.js +1 -1
  82. package/vlx.js +1 -1
  83. package/vlxl.js +1 -1
  84. package/{whoami-XH64UEWS.js → whoami-TCSDOBU2.js} +19 -8
  85. package/chunk-6SHB5AGY.js +0 -73
@@ -12,7 +12,7 @@ var require = _vlt_createRequire(import.meta.filename);
12
12
  import {
13
13
  promiseSpawn,
14
14
  which
15
- } from "./chunk-R44FR7BY.js";
15
+ } from "./chunk-7NHXV6AH.js";
16
16
 
17
17
  // ../../src/url-open/src/index.ts
18
18
  import { release } from "node:os";
@@ -12,22 +12,22 @@ var require = _vlt_createRequire(import.meta.filename);
12
12
  import {
13
13
  findCmdShimIfExists,
14
14
  install
15
- } from "./chunk-Y7QHAJJQ.js";
15
+ } from "./chunk-VGWEB64T.js";
16
16
  import {
17
17
  PackageInfoClient
18
- } from "./chunk-X5R27Q65.js";
18
+ } from "./chunk-4SSFBFB5.js";
19
19
  import {
20
20
  PathScurry
21
- } from "./chunk-SZPDTJMF.js";
22
- import {
23
- Spec2 as Spec
24
- } from "./chunk-PHJXJ53A.js";
21
+ } from "./chunk-ICJRCXSG.js";
25
22
  import {
26
23
  walkUp
27
24
  } from "./chunk-HTOTG4TS.js";
25
+ import {
26
+ Spec2 as Spec
27
+ } from "./chunk-PW6S6AIO.js";
28
28
  import {
29
29
  parseScope
30
- } from "./chunk-Q3DNNTPG.js";
30
+ } from "./chunk-2PLIV3N3.js";
31
31
  import {
32
32
  XDG
33
33
  } from "./chunk-XNLSTHDK.js";
@@ -0,0 +1,49 @@
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
+
13
+ // ../../node_modules/.vlt/~npm~package-json-from-dist@1.0.1/node_modules/package-json-from-dist/dist/esm/index.js
14
+ import { readFileSync } from "node:fs";
15
+ import { dirname, resolve, sep } from "node:path";
16
+ import { fileURLToPath } from "node:url";
17
+ var NM = `${sep}node_modules${sep}`;
18
+ var STORE = `.store${sep}`;
19
+ var PKG = `${sep}package${sep}`;
20
+ var DIST = `${sep}dist${sep}`;
21
+ var findPackageJson = (from, pathFromSrc = "../package.json") => {
22
+ const f = typeof from === "object" || from.startsWith("file://") ? fileURLToPath(from) : from;
23
+ const __dirname = dirname(f);
24
+ const nms = __dirname.lastIndexOf(NM);
25
+ if (nms !== -1) {
26
+ const nm = __dirname.substring(0, nms + NM.length);
27
+ const pkgDir = __dirname.substring(nms + NM.length);
28
+ if (pkgDir.startsWith(STORE)) {
29
+ const pkg = pkgDir.indexOf(PKG, STORE.length);
30
+ if (pkg) {
31
+ return resolve(nm, pkgDir.substring(0, pkg + PKG.length), "package.json");
32
+ }
33
+ }
34
+ const pkgName = pkgDir.startsWith("@") ? pkgDir.split(sep, 2).join(sep) : String(pkgDir.split(sep)[0]);
35
+ return resolve(nm, pkgName, "package.json");
36
+ } else {
37
+ const d = __dirname.lastIndexOf(DIST);
38
+ if (d !== -1) {
39
+ return resolve(__dirname.substring(0, d), "package.json");
40
+ } else {
41
+ return resolve(__dirname, pathFromSrc);
42
+ }
43
+ }
44
+ };
45
+ var loadPackageJson = (from, pathFromSrc = "../package.json") => JSON.parse(readFileSync(findPackageJson(from, pathFromSrc), "utf8"));
46
+
47
+ export {
48
+ loadPackageJson
49
+ };
@@ -0,0 +1,75 @@
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-VP3KSJ2M.js"),
22
+ "./commands/bugs.ts": () => import("./bugs-4ZQXJA4F.js"),
23
+ "./commands/build.ts": () => import("./build-P74RVUUP.js"),
24
+ "./commands/cache.ts": () => import("./cache-J4J3ZWXP.js"),
25
+ "./commands/ci.ts": () => import("./ci-GIDCFAZF.js"),
26
+ "./commands/config.ts": () => import("./config-LIQMIMTF.js"),
27
+ "./commands/create.ts": () => import("./create-K2S3J62I.js"),
28
+ "./commands/deprecate.ts": () => import("./deprecate-4PJKNFXN.js"),
29
+ "./commands/dist-tag.ts": () => import("./dist-tag-TA6LWT2V.js"),
30
+ "./commands/docs.ts": () => import("./docs-ZCMIKQAN.js"),
31
+ "./commands/exec-cache.ts": () => import("./exec-cache-2IWJNBFB.js"),
32
+ "./commands/exec-local.ts": () => import("./exec-local-FNFTQYFP.js"),
33
+ "./commands/exec.ts": () => import("./exec-XVF4KCRJ.js"),
34
+ "./commands/help.ts": () => import("./help-ZDRILKVQ.js"),
35
+ "./commands/init.ts": () => import("./init-VMYJE5Q3.js"),
36
+ "./commands/install.ts": () => import("./install-ZHMWN27D.js"),
37
+ "./commands/install/reporter.ts": () => import("./reporter-2XBYWAVU.js"),
38
+ "./commands/list.ts": () => import("./list-BPFKWXCR.js"),
39
+ "./commands/login.ts": () => import("./login-DQL5A4NT.js"),
40
+ "./commands/logout.ts": () => import("./logout-Q74VRDSN.js"),
41
+ "./commands/pack.ts": () => import("./pack-GLURO5KY.js"),
42
+ "./commands/ping.ts": () => import("./ping-PPEYPKZD.js"),
43
+ "./commands/pkg.ts": () => import("./pkg-UTEKJ5CB.js"),
44
+ "./commands/profile.ts": () => import("./profile-5QFRWC2L.js"),
45
+ "./commands/publish.ts": () => import("./publish-5VDI3JXX.js"),
46
+ "./commands/query.ts": () => import("./query-I6DZ7TF2.js"),
47
+ "./commands/registry.ts": () => import("./registry-ZVO3VAHY.js"),
48
+ "./commands/repo.ts": () => import("./repo-SB3C7MZZ.js"),
49
+ "./commands/run-exec.ts": () => import("./run-exec-RFB572AL.js"),
50
+ "./commands/run.ts": () => import("./run-U6CW5Q56.js"),
51
+ "./commands/setup.ts": () => import("./setup-BFKUYGJB.js"),
52
+ "./commands/token.ts": () => import("./token-M5HPJJJQ.js"),
53
+ "./commands/uninstall.ts": () => import("./uninstall-UUBTM4ZQ.js"),
54
+ "./commands/unpublish.ts": () => import("./unpublish-WDSRB6DV.js"),
55
+ "./commands/update.ts": () => import("./update-J4BEFJRC.js"),
56
+ "./commands/version.ts": () => import("./version-ZVG66SKC.js"),
57
+ "./commands/view.ts": () => import("./view-WFK75G74.js"),
58
+ "./commands/whoami.ts": () => import("./whoami-TCSDOBU2.js")
59
+ });
60
+
61
+ // ../../src/cli-sdk/src/load-command.ts
62
+ var loadCommand = async (command) => {
63
+ try {
64
+ return await globImport_commands_ts(`./commands/${command}.ts`);
65
+ } catch (e) {
66
+ throw error("Could not load command", {
67
+ found: command,
68
+ cause: e
69
+ });
70
+ }
71
+ };
72
+
73
+ export {
74
+ loadCommand
75
+ };
@@ -12,7 +12,7 @@ var require = _vlt_createRequire(import.meta.filename);
12
12
  import {
13
13
  isError,
14
14
  isObject
15
- } from "./chunk-Q3DNNTPG.js";
15
+ } from "./chunk-2PLIV3N3.js";
16
16
 
17
17
  // ../../src/output/src/error.ts
18
18
  var parseError = (err) => {
@@ -10,20 +10,20 @@ globalThis.clearInterval = _vlt_clearInterval;
10
10
  import {createRequire as _vlt_createRequire} from "node:module";
11
11
  var require = _vlt_createRequire(import.meta.filename);
12
12
  import {
13
- It,
14
- Zn,
13
+ Ct,
14
+ Qn,
15
15
  require_lib
16
- } from "./chunk-HQ4US6G3.js";
16
+ } from "./chunk-FWKQ7YDF.js";
17
17
  import {
18
18
  minimatch
19
- } from "./chunk-SZPDTJMF.js";
20
- import {
21
- Spec2 as Spec
22
- } from "./chunk-PHJXJ53A.js";
19
+ } from "./chunk-ICJRCXSG.js";
23
20
  import {
24
21
  parse,
25
22
  stringify
26
23
  } from "./chunk-HTOTG4TS.js";
24
+ import {
25
+ Spec2 as Spec
26
+ } from "./chunk-PW6S6AIO.js";
27
27
  import {
28
28
  error
29
29
  } from "./chunk-WZWDS3W4.js";
@@ -32,9 +32,9 @@ import {
32
32
  __toESM
33
33
  } from "./chunk-PZLD7RTK.js";
34
34
 
35
- // ../../node_modules/.vlt/~npm~ignore@7.0.5/node_modules/ignore/index.js
35
+ // ../../node_modules/.vlt/~npm~ignore@7.0.6/node_modules/ignore/index.js
36
36
  var require_ignore = __commonJS({
37
- "../../node_modules/.vlt/~npm~ignore@7.0.5/node_modules/ignore/index.js"(exports, module) {
37
+ "../../node_modules/.vlt/~npm~ignore@7.0.6/node_modules/ignore/index.js"(exports, module) {
38
38
  function makeArray(subject) {
39
39
  return Array.isArray(subject) ? subject : [subject];
40
40
  }
@@ -65,6 +65,7 @@ var require_ignore = __commonJS({
65
65
  REGEX_REGEXP_RANGE,
66
66
  (match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0) ? match : EMPTY
67
67
  );
68
+ var negateRange = (range) => range.startsWith("!") || range.startsWith("\\^") ? `^${range.slice(range[0] === "!" ? 1 : 2)}` : range;
68
69
  var cleanRangeBackSlash = (slashes) => {
69
70
  const { length } = slashes;
70
71
  return slashes.slice(0, length - length % 2);
@@ -142,7 +143,7 @@ var require_ignore = __commonJS({
142
143
  // > "**/foo/bar" matches file or directory "bar" anywhere that is directly
143
144
  // > under directory "foo".
144
145
  // Notice that the '*'s have been replaced as '\\*'
145
- /^\^*\\\*\\\*\\\//,
146
+ /^\^*(?:\\\*\\\*\\\/)+/,
146
147
  // '**/foo' <-> 'foo'
147
148
  () => "^(?:.*\\/)?"
148
149
  ],
@@ -197,7 +198,7 @@ var require_ignore = __commonJS({
197
198
  // > can be used to match one of the characters in a range.
198
199
  // `\` is escaped by step 3
199
200
  /(\\)?\[([^\]/]*?)(\\*)($|\])/g,
200
- (match, leadEscape, range, endEscape, close) => leadEscape === ESCAPE ? `\\[${range}${cleanRangeBackSlash(endEscape)}${close}` : close === "]" ? endEscape.length % 2 === 0 ? `[${sanitizeRange(range)}${endEscape}]` : "[]" : "[]"
201
+ (match, leadEscape, range, endEscape, close) => leadEscape === ESCAPE ? `\\[${range}${cleanRangeBackSlash(endEscape)}${close}` : close === "]" ? endEscape.length % 2 === 0 ? `[${negateRange(sanitizeRange(range))}${endEscape}]` : "[]" : "[]"
201
202
  ],
202
203
  // ending
203
204
  [
@@ -727,7 +728,7 @@ var packTarball = async (manifest, dir, config) => {
727
728
  try {
728
729
  config.options.packageJson.write(packDir, processedManifest);
729
730
  const packFilter = buildPackFilter(manifest, packDir);
730
- const tarballData = await Zn(
731
+ const tarballData = await Qn(
731
732
  {
732
733
  cwd: packDir,
733
734
  gzip: true,
@@ -740,7 +741,7 @@ var packTarball = async (manifest, dir, config) => {
740
741
  let unpackedSize = 0;
741
742
  const files = [];
742
743
  await new Promise((resolve, reject) => {
743
- const stream = It({
744
+ const stream = Ct({
744
745
  onentry: (entry) => {
745
746
  if (entry.type === "File") {
746
747
  unpackedSize += entry.size;
@@ -13,13 +13,13 @@ import {
13
13
  asDepID,
14
14
  baseDepID,
15
15
  splitDepID
16
- } from "./chunk-C2X7PVDF.js";
16
+ } from "./chunk-MT76WHSM.js";
17
17
  import {
18
- L
19
- } from "./chunk-R44FR7BY.js";
18
+ I
19
+ } from "./chunk-7NHXV6AH.js";
20
20
  import {
21
21
  loadPackageJson
22
- } from "./chunk-2V4AQPBR.js";
22
+ } from "./chunk-E74WGW5C.js";
23
23
  import {
24
24
  XDG
25
25
  } from "./chunk-XNLSTHDK.js";
@@ -33,7 +33,7 @@ import { spawn } from "node:child_process";
33
33
  import { mkdirSync } from "node:fs";
34
34
  import { dirname } from "node:path";
35
35
 
36
- // ../../node_modules/.vlt/~npm~is-network-error@1.3.1/node_modules/is-network-error/index.js
36
+ // ../../node_modules/.vlt/~npm~is-network-error@1.3.2/node_modules/is-network-error/index.js
37
37
  var objectToString = Object.prototype.toString;
38
38
  var isError = (value) => objectToString.call(value) === "[object Error]";
39
39
  var errorMessages = /* @__PURE__ */ new Set([
@@ -60,7 +60,7 @@ function isNetworkError(error2) {
60
60
  return false;
61
61
  }
62
62
  const { message, stack } = error2;
63
- if (message === "Load failed") {
63
+ if (message === "Load failed" || message.startsWith("Load failed (") && message.endsWith(")")) {
64
64
  return stack === void 0 || "__sentry_captured__" in error2;
65
65
  }
66
66
  if (message.startsWith("error sending request for url")) {
@@ -265,7 +265,7 @@ var { version } = loadPackageJson(
265
265
  import.meta.filename,
266
266
  "cli-package.json"
267
267
  );
268
- var SecurityArchive = class _SecurityArchive extends L {
268
+ var SecurityArchive = class _SecurityArchive extends I {
269
269
  #expired = /* @__PURE__ */ new Set();
270
270
  #path;
271
271
  #retries;
@@ -0,0 +1,137 @@
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
+ defaultRegistries
14
+ } from "./chunk-PW6S6AIO.js";
15
+ import {
16
+ error
17
+ } from "./chunk-WZWDS3W4.js";
18
+
19
+ // ../../src/cli-sdk/src/select-registry.ts
20
+ import { createInterface } from "node:readline/promises";
21
+ var selectRegistry = async (candidates, {
22
+ defaultAlias,
23
+ input = process.stdin,
24
+ output = process.stdout
25
+ } = {}) => {
26
+ const defaultIndex = Math.max(
27
+ candidates.findIndex((c) => c.alias === defaultAlias),
28
+ 0
29
+ );
30
+ const fallback = candidates[defaultIndex] ?? candidates[0];
31
+ if (!fallback) {
32
+ throw error("No registries to select from", { code: "ECONFIG" });
33
+ }
34
+ const rl = createInterface({ input, output });
35
+ try {
36
+ output.write("Multiple registries are configured. Select one:\n");
37
+ for (const [i, c] of candidates.entries()) {
38
+ const marker = i === defaultIndex ? " (default)" : "";
39
+ output.write(` ${i + 1}) ${c.alias} -> ${c.url}${marker}
40
+ `);
41
+ }
42
+ const answer = (await rl.question(`Registry [${defaultIndex + 1}]: `)).trim();
43
+ if (!answer) return fallback.url;
44
+ const choice = Number(answer);
45
+ const picked = candidates[choice - 1];
46
+ if (!Number.isInteger(choice) || !picked) {
47
+ throw error("Invalid registry selection", {
48
+ found: answer,
49
+ validOptions: candidates.map((_, i) => String(i + 1)),
50
+ code: "EUSAGE"
51
+ });
52
+ }
53
+ return picked.url;
54
+ } finally {
55
+ rl.close();
56
+ }
57
+ };
58
+
59
+ // ../../src/cli-sdk/src/require-registry.ts
60
+ var missingRegistryError = () => error(
61
+ [
62
+ "Missing registry configuration.",
63
+ "",
64
+ "vlt has no default registry. Run `vlt setup` to get configured.",
65
+ "",
66
+ "See https://docs.vlt.sh/cli for other ways to set a registry."
67
+ ].join("\n"),
68
+ { code: "ECONFIG" }
69
+ );
70
+ var ambiguousRegistryError = (candidates) => error(
71
+ [
72
+ "Multiple registries are configured; specify which one to use.",
73
+ "",
74
+ "Run `vlt registry <alias> <command>` with one of:",
75
+ ...candidates.map((c) => ` ${c.alias} -> ${c.url}`)
76
+ ].join("\n"),
77
+ {
78
+ code: "ECONFIG",
79
+ validOptions: candidates.map((c) => c.alias)
80
+ }
81
+ );
82
+ var resolveRegistryAlias = (conf, alias) => {
83
+ const url = conf.options.registries[alias];
84
+ if (!url) {
85
+ throw error(`Unknown registry alias: ${alias}`, {
86
+ code: "ECONFIG",
87
+ found: alias,
88
+ validOptions: Object.keys(conf.options.registries)
89
+ });
90
+ }
91
+ return url;
92
+ };
93
+ var gatherCandidates = (conf) => {
94
+ const builtins = defaultRegistries;
95
+ return Object.entries(conf.options.registries).filter(([alias, url]) => builtins[alias] !== url).map(([alias, url]) => ({ alias, url }));
96
+ };
97
+ var hasConfiguredRegistry = (conf) => !!conf.options.registry || gatherCandidates(conf).length > 0;
98
+ var requireRegistry = (conf, alias) => {
99
+ if (alias !== void 0) return resolveRegistryAlias(conf, alias);
100
+ const { registry } = conf.options;
101
+ if (registry) return registry;
102
+ const candidates = gatherCandidates(conf);
103
+ const [first, second] = candidates;
104
+ if (!first) throw missingRegistryError();
105
+ if (!second) return first.url;
106
+ const defaultUrl = conf.options.registries[conf.options["default-registry-alias"]];
107
+ if (defaultUrl) return defaultUrl;
108
+ throw ambiguousRegistryError(candidates);
109
+ };
110
+ var resolveRegistry = async (conf, {
111
+ alias,
112
+ interactive = process.stdin.isTTY,
113
+ input,
114
+ output
115
+ } = {}) => {
116
+ if (alias !== void 0) return resolveRegistryAlias(conf, alias);
117
+ const { registry } = conf.options;
118
+ if (registry) return registry;
119
+ const candidates = gatherCandidates(conf);
120
+ const [first, second] = candidates;
121
+ if (!first) throw missingRegistryError();
122
+ if (!second) return first.url;
123
+ const defaultAlias = conf.options["default-registry-alias"];
124
+ if (interactive) {
125
+ return selectRegistry(candidates, { defaultAlias, input, output });
126
+ }
127
+ const defaultUrl = conf.options.registries[defaultAlias];
128
+ if (defaultUrl) return defaultUrl;
129
+ throw ambiguousRegistryError(candidates);
130
+ };
131
+
132
+ export {
133
+ missingRegistryError,
134
+ hasConfiguredRegistry,
135
+ requireRegistry,
136
+ resolveRegistry
137
+ };