@vltpkg/cli-js 1.0.10 → 1.1.1

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 (80) hide show
  1. package/{access-4RPC3X5N.js → access-YYMAAPHV.js} +42 -11
  2. package/{bugs-K6QLQLL4.js → bugs-RK5JBPSC.js} +19 -19
  3. package/{build-VD4L5IED.js → build-DVJSYCNF.js} +8 -9
  4. package/{cache-Q6FUUEQF.js → cache-JKQNGZ7L.js} +21 -15
  5. package/{chunk-5JFRXIK2.js → chunk-2PWSMJD7.js} +20 -1
  6. package/{chunk-5HBKYSTX.js → chunk-34TE4HZS.js} +36 -4
  7. package/{chunk-WAYVHANF.js → chunk-3LUM7NX5.js} +30 -5
  8. package/{chunk-NA732FNL.js → chunk-6FT6K5YN.js} +98 -6
  9. package/{chunk-HAYXR3MW.js → chunk-APMYKJI2.js} +1 -1
  10. package/{chunk-ZNCVQQDT.js → chunk-BWEH7DHQ.js} +2 -2
  11. package/{chunk-5HPGL5WS.js → chunk-CBASIDQH.js} +1 -1
  12. package/{chunk-MNK55XSE.js → chunk-CEHPRPGQ.js} +21 -0
  13. package/{chunk-2YJ5MESP.js → chunk-DF5K4CYR.js} +6 -10
  14. package/{chunk-DAS7TVRN.js → chunk-DR4Z63B6.js} +5 -5
  15. package/{chunk-NWLS3VOQ.js → chunk-DS7YMIHP.js} +239 -131
  16. package/{chunk-XUP35M5Q.js → chunk-GDT6KI4I.js} +4 -4
  17. package/{chunk-FUCQ7ARR.js → chunk-JZJWASXL.js} +36 -25
  18. package/{chunk-B5IILBX7.js → chunk-KDF7PEBY.js} +4 -4
  19. package/{chunk-P5S2TFCF.js → chunk-LN2A74PF.js} +14 -10
  20. package/{chunk-VL7RJVNN.js → chunk-LR42WTKN.js} +20 -11
  21. package/chunk-MZA6N2TA.js +190 -0
  22. package/{chunk-3564IL5W.js → chunk-QQYTPGIL.js} +1 -1
  23. package/chunk-SNOBGFNM.js +129 -0
  24. package/{chunk-LPIBYUMT.js → chunk-U7TEQCBN.js} +27 -1
  25. package/{chunk-TYRKIWGF.js → chunk-V4YCZZHY.js} +3 -3
  26. package/chunk-WD74RJXW.js +75 -0
  27. package/{chunk-XFI4THXZ.js → chunk-WE2TQN32.js} +1 -1
  28. package/{chunk-USTJECVS.js → chunk-X2AWQGYG.js} +1 -1
  29. package/{chunk-BSPUKIWY.js → chunk-XIF734VO.js} +12 -2
  30. package/chunk-YBVTY6ZW.js +91 -0
  31. package/{ci-G4PJWJQE.js → ci-WVYVR4XK.js} +10 -11
  32. package/cli-package.json +1 -1
  33. package/{config-WTIWWXRD.js → config-2MFZVP2N.js} +11 -11
  34. package/{config-66ARNESN.js → config-VYOTYBGS.js} +8 -6
  35. package/{create-DF6RQTHC.js → create-OJPLHBRR.js} +18 -18
  36. package/{deprecate-2KTC2HKH.js → deprecate-V4PKGFF7.js} +22 -19
  37. package/{dist-tag-QKJQIOGN.js → dist-tag-DNLV4VDE.js} +24 -26
  38. package/{docs-YSWJTGYX.js → docs-LXHDCGL5.js} +19 -19
  39. package/{exec-5XIMPSBI.js → exec-P32YSP44.js} +18 -18
  40. package/{exec-cache-OGX7WR5P.js → exec-cache-JZ5PDTOY.js} +16 -16
  41. package/{exec-local-SB7EPYED.js → exec-local-HHA464H4.js} +14 -15
  42. package/{help-GMCQHGVN.js → help-GVTTOYUL.js} +4 -5
  43. package/{init-KXIIWHBA.js → init-RENGG74N.js} +8 -9
  44. package/{install-ODTEMAMS.js → install-V6VXOBH2.js} +38 -15
  45. package/{list-QS4FLJSU.js → list-7N7Y5OXB.js} +42 -30
  46. package/{login-6TGYRY43.js → login-D2QSAUJC.js} +12 -12
  47. package/{logout-GOAB7KHJ.js → logout-QPOYBQNF.js} +8 -8
  48. package/{pack-PJDH6PKP.js → pack-4YYGXP3A.js} +12 -13
  49. package/package.json +1 -1
  50. package/{ping-ANBW2IRW.js → ping-QYRIZONU.js} +8 -8
  51. package/{pkg-GZWUXU65.js → pkg-WQTNABKT.js} +11 -12
  52. package/{profile-BLY74CMB.js → profile-PRI7WXK7.js} +21 -8
  53. package/{publish-W2KOTNMB.js → publish-PSBYJQS7.js} +33 -75
  54. package/{query-3PUMU5ON.js → query-UFYLQW4N.js} +36 -24
  55. package/{registry-ONSDWNPV.js → registry-YTJZ3AQD.js} +3 -3
  56. package/registry-client-src-revalidate.js +426 -217
  57. package/{repo-LZ6STH4C.js → repo-4S6ETFXX.js} +19 -19
  58. package/{reporter-SDMDYYMJ.js → reporter-GLWYHI2Y.js} +23 -1
  59. package/{run-JMIBADHE.js → run-OU7NUB7A.js} +14 -15
  60. package/{run-exec-JEKM2O53.js → run-exec-QPBY7ULE.js} +14 -15
  61. package/security-archive-src-update-expired.js +97 -63
  62. package/{setup-BTBU3NAI.js → setup-23QXG473.js} +43 -24
  63. package/{src-J4BAYOBO.js → src-3GN7TDNH.js} +14 -6
  64. package/{src-23VBKASP.js → src-575IYJOL.js} +17 -18
  65. package/{token-PUJ7QN6D.js → token-FCIA3RGD.js} +9 -9
  66. package/{uninstall-OTISP2T7.js → uninstall-BQVZVKB5.js} +12 -12
  67. package/{unpublish-X75EEQAN.js → unpublish-YGJ5HEYF.js} +43 -40
  68. package/{update-CKXX5POE.js → update-WCGV66JK.js} +35 -13
  69. package/{version-24B2X7M7.js → version-7EA3UQG7.js} +10 -11
  70. package/{view-Q7MAQ6R3.js → view-5FWIENVE.js} +10 -10
  71. package/vlr.js +1 -1
  72. package/vlrx.js +1 -1
  73. package/vlt.js +1 -1
  74. package/vlx.js +1 -1
  75. package/vlxl.js +1 -1
  76. package/{whoami-S6CQZFE3.js → whoami-O4ZTBIC4.js} +29 -13
  77. package/chunk-E74WGW5C.js +0 -49
  78. package/chunk-UBLFPJHV.js +0 -40
  79. package/chunk-Y3QEV76Q.js +0 -75
  80. package/registry-client-package.json +0 -75
@@ -11,19 +11,19 @@ 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-ZNCVQQDT.js";
14
+ } from "./chunk-BWEH7DHQ.js";
15
15
  import {
16
16
  stderr
17
- } from "./chunk-VL7RJVNN.js";
17
+ } from "./chunk-LR42WTKN.js";
18
18
  import {
19
19
  mermaidOutput
20
- } from "./chunk-FUCQ7ARR.js";
20
+ } from "./chunk-JZJWASXL.js";
21
21
  import {
22
22
  ViewClass
23
23
  } from "./chunk-4KCU2KZL.js";
24
24
  import {
25
25
  getTokenByURL
26
- } from "./chunk-NWLS3VOQ.js";
26
+ } from "./chunk-DS7YMIHP.js";
27
27
 
28
28
  // ../../src/cli-sdk/src/query-auth.ts
29
29
  var createGetAuthHeader = (conf) => async (url) => getTokenByURL(url, conf.options.identity);
@@ -13,14 +13,14 @@ import {
13
13
  AbortError,
14
14
  SecurityArchive,
15
15
  pRetry
16
- } from "./chunk-2YJ5MESP.js";
16
+ } from "./chunk-DF5K4CYR.js";
17
17
  import {
18
18
  Monorepo,
19
19
  PackageJson,
20
20
  getUser,
21
21
  minimatch,
22
22
  platformCheck
23
- } from "./chunk-USTJECVS.js";
23
+ } from "./chunk-X2AWQGYG.js";
24
24
  import {
25
25
  asDepID,
26
26
  baseDepID,
@@ -44,11 +44,13 @@ import {
44
44
  walkUp
45
45
  } from "./chunk-HTOTG4TS.js";
46
46
  import {
47
- promiseSpawn
48
- } from "./chunk-LPIBYUMT.js";
47
+ userAgent,
48
+ userAgentHeaders
49
+ } from "./chunk-YBVTY6ZW.js";
49
50
  import {
50
- graphStep
51
- } from "./chunk-UBLFPJHV.js";
51
+ graphStep,
52
+ promiseSpawn
53
+ } from "./chunk-U7TEQCBN.js";
52
54
  import {
53
55
  Spec,
54
56
  Version,
@@ -5333,7 +5335,7 @@ function hasNodeGypBinding(cwd) {
5333
5335
  }
5334
5336
 
5335
5337
  // ../../src/run/src/index.ts
5336
- var npmConfigUserAgent = `vlt/${process.version.slice(1)} node/${process.version} ${process.platform} ${process.arch}`;
5338
+ var npmConfigUserAgent = userAgent;
5337
5339
  var dotBins = /* @__PURE__ */ new Map();
5338
5340
  var dirExists = (p) => {
5339
5341
  const cached = dotBins.get(p);
@@ -5388,7 +5390,7 @@ var runImpl = async (options, execImpl, empty2) => {
5388
5390
  ...execArgs
5389
5391
  } = options;
5390
5392
  const pjPath = resolve2(options.cwd, "package.json");
5391
- const untrustworthy = !!(manifest?.gypfile && arg0 === "install" && manifest.scripts?.install === "node-gyp rebuild");
5393
+ const untrustworthy = !!manifest && (manifest.gypfile === true && arg0 === "install" && manifest.scripts?.install === "node-gyp rebuild" || manifest.hasInstallScript === true && !manifest.scripts);
5392
5394
  const pj = (untrustworthy ? void 0 : manifest) ?? packageJson.read(options.cwd);
5393
5395
  const { scripts: scripts2 } = pj;
5394
5396
  const command = scripts2?.[arg0] ?? // npm's implicit install behavior: "If there is a binding.gyp file in the
@@ -6382,7 +6384,8 @@ var retrieveDistTags = async (node, signal) => {
6382
6384
  url.pathname = `/${node.name}`;
6383
6385
  const response = await fetch(String(url), {
6384
6386
  headers: {
6385
- Accept: "application/vnd.npm.install-v1+json"
6387
+ Accept: "application/vnd.npm.install-v1+json",
6388
+ ...userAgentHeaders
6386
6389
  },
6387
6390
  signal
6388
6391
  });
@@ -6847,7 +6850,8 @@ var retrieveRemoteVersions = async (node, signal, getAuthHeader) => {
6847
6850
  const base = spec2.registry.endsWith("/") ? spec2.registry : `${spec2.registry}/`;
6848
6851
  const url = new URL(node.name, base);
6849
6852
  const headers = {
6850
- Accept: "application/vnd.npm.install-v1+json"
6853
+ Accept: "application/vnd.npm.install-v1+json",
6854
+ ...userAgentHeaders
6851
6855
  };
6852
6856
  const auth = await getAuthHeader?.(String(url));
6853
6857
  if (auth) {
@@ -7155,6 +7159,7 @@ var retrieveRemoteDate = async (node, signal) => {
7155
7159
  const url = new URL(spec2.registry);
7156
7160
  url.pathname = `/${node.name}`;
7157
7161
  const response = await fetch(String(url), {
7162
+ headers: { ...userAgentHeaders },
7158
7163
  signal
7159
7164
  });
7160
7165
  if (response.status === 404) {
@@ -7479,6 +7484,7 @@ var score = async (state) => {
7479
7484
  var nodeNeedsBuild = (node) => {
7480
7485
  const { manifest } = node;
7481
7486
  if (!manifest) return false;
7487
+ if (manifest.hasInstallScript) return true;
7482
7488
  const { scripts: scripts2 = {} } = manifest;
7483
7489
  const runInstall = !!(scripts2.install || scripts2.preinstall || scripts2.postinstall);
7484
7490
  if (runInstall) return true;
@@ -10485,7 +10491,7 @@ var load4 = (options) => {
10485
10491
  );
10486
10492
  }
10487
10493
  modifiers?.rollbackActiveEntries();
10488
- if (scurry.cwd.resolve("node_modules").lstatSync()?.isDirectory()) {
10494
+ if (scurry.cwd.resolve("node_modules/.vlt").lstatSync()?.isDirectory()) {
10489
10495
  saveHidden({
10490
10496
  ...options,
10491
10497
  graph
@@ -10569,6 +10575,9 @@ var makeExecutable = async (path2) => {
10569
10575
  await chmod2(path2, execMode);
10570
10576
  };
10571
10577
 
10578
+ // ../../src/graph/src/reify/scripts-manifest.ts
10579
+ var scriptsManifest = (manifest, dir, packageJson) => manifest.hasInstallScript && !manifest.scripts ? packageJson.read(dir) : manifest;
10580
+
10572
10581
  // ../../src/graph/src/reify/build.ts
10573
10582
  var build = async (diff2, packageJson, scurry, allowScriptsNodes) => {
10574
10583
  const graph = diff2.to;
@@ -10608,8 +10617,9 @@ var build = async (diff2, packageJson, scurry, allowScriptsNodes) => {
10608
10617
  return res;
10609
10618
  };
10610
10619
  var visit = async (packageJson, scurry, node, signal, _path) => {
10611
- node.manifest ??= packageJson.read(node.resolvedLocation(scurry));
10612
- const { manifest } = node;
10620
+ const dir = node.resolvedLocation(scurry);
10621
+ node.manifest ??= packageJson.read(dir);
10622
+ const manifest = scriptsManifest(node.manifest, dir, packageJson);
10613
10623
  const { scripts: scripts2 = {} } = manifest;
10614
10624
  const {
10615
10625
  install: install2,
@@ -10832,10 +10842,12 @@ var build2 = async (options) => {
10832
10842
  scurry,
10833
10843
  targetFilteredNodes
10834
10844
  );
10835
- saveHidden({
10836
- ...options,
10837
- graph: actualGraph
10838
- });
10845
+ if (scurry.lstatSync(scurry.resolve(projectRoot, "node_modules/.vlt"))?.isDirectory()) {
10846
+ saveHidden({
10847
+ ...options,
10848
+ graph: actualGraph
10849
+ });
10850
+ }
10839
10851
  return buildResult;
10840
10852
  };
10841
10853
 
@@ -14455,14 +14467,13 @@ var deleteEdges = (diff2, scurry, remover) => {
14455
14467
  import { join as join3 } from "node:path";
14456
14468
  var nodeNeedsBuild2 = (node, scurry, packageJson) => {
14457
14469
  if (node.built) return false;
14458
- let manifest = node.manifest;
14459
- if (!manifest) {
14460
- try {
14461
- manifest = packageJson.read(node.resolvedLocation(scurry));
14462
- node.manifest = manifest;
14463
- } catch {
14464
- return false;
14465
- }
14470
+ let manifest;
14471
+ try {
14472
+ const dir = node.resolvedLocation(scurry);
14473
+ node.manifest ??= packageJson.read(dir);
14474
+ manifest = scriptsManifest(node.manifest, dir, packageJson);
14475
+ } catch {
14476
+ return false;
14466
14477
  }
14467
14478
  const { scripts: scripts2 = {} } = manifest;
14468
14479
  const runInstall = !!(scripts2.install || scripts2.preinstall || scripts2.postinstall);
@@ -14,12 +14,12 @@ import {
14
14
  } from "./chunk-RIYFGX27.js";
15
15
  import {
16
16
  createHostContextsMap
17
- } from "./chunk-WAYVHANF.js";
17
+ } from "./chunk-3LUM7NX5.js";
18
18
  import {
19
19
  stderr,
20
20
  stdout,
21
21
  styleTextStdout
22
- } from "./chunk-VL7RJVNN.js";
22
+ } from "./chunk-LR42WTKN.js";
23
23
  import {
24
24
  require_emoji_regex
25
25
  } from "./chunk-VTEFO2FT.js";
@@ -27,10 +27,10 @@ import {
27
27
  Query,
28
28
  actual,
29
29
  isRunResult
30
- } from "./chunk-FUCQ7ARR.js";
30
+ } from "./chunk-JZJWASXL.js";
31
31
  import {
32
32
  Monorepo
33
- } from "./chunk-USTJECVS.js";
33
+ } from "./chunk-X2AWQGYG.js";
34
34
  import {
35
35
  isErrorWithCause
36
36
  } from "./chunk-VFBCWAOC.js";
@@ -20,13 +20,16 @@ import {
20
20
  pickManifest,
21
21
  resolve,
22
22
  revs
23
- } from "./chunk-USTJECVS.js";
23
+ } from "./chunk-X2AWQGYG.js";
24
24
  import {
25
25
  Spec
26
26
  } from "./chunk-XKVU23NC.js";
27
+ import {
28
+ registryErrorMessage
29
+ } from "./chunk-SNOBGFNM.js";
27
30
  import {
28
31
  logRequest
29
- } from "./chunk-UBLFPJHV.js";
32
+ } from "./chunk-U7TEQCBN.js";
30
33
  import {
31
34
  asPackument
32
35
  } from "./chunk-VFBCWAOC.js";
@@ -83,6 +86,7 @@ var rename = platform !== "win32" ? fsRename : (async function(oldPath, newPath)
83
86
  var debug = debuglog("vlt");
84
87
  var xdg = new XDG("vlt");
85
88
  var delimiter = "~";
89
+ var PACKUMENT_ACCEPT = "application/vnd.vlt.packument-v1+json; q=1.0, application/json; q=0.8, */*; q=0.1";
86
90
  var manifestCacheMaxAge = 5 * 60 * 1e3;
87
91
  var noRegistryError = (spec) => error(
88
92
  'No registry configured to resolve this spec. Set "registry" in vlt.json, pass --registry, or run `vlt login --registry=<url>`. See https://docs.vlt.sh/cli',
@@ -119,7 +123,7 @@ var PackageInfoClient = class {
119
123
  #tarPoolPromise;
120
124
  async getRegistryClient() {
121
125
  if (this.#registryClient) return this.#registryClient;
122
- this.#registryClientPromise ??= import("./src-J4BAYOBO.js").then(({ RegistryClient }) => {
126
+ this.#registryClientPromise ??= import("./src-3GN7TDNH.js").then(({ RegistryClient }) => {
123
127
  this.#registryClient = new RegistryClient(this.options);
124
128
  return this.#registryClient;
125
129
  });
@@ -228,7 +232,7 @@ var PackageInfoClient = class {
228
232
  throw this.#resolveError(
229
233
  spec,
230
234
  options,
231
- `Registry returned HTTP ${response.statusCode} when fetching the tarball for ${spec}. The resolved version may have been unpublished, or the registry may be misconfigured or unreachable.`,
235
+ `${registryErrorMessage(response)} when fetching the tarball for ${spec}. The resolved version may have been unpublished, or the registry may be misconfigured or unreachable.`,
232
236
  {
233
237
  url: r.resolved,
234
238
  response
@@ -286,7 +290,7 @@ var PackageInfoClient = class {
286
290
  throw this.#resolveError(
287
291
  spec,
288
292
  options,
289
- "failed to fetch remote tarball",
293
+ `failed to fetch remote tarball: ${registryErrorMessage(response)}`,
290
294
  {
291
295
  url: r.resolved,
292
296
  response
@@ -462,7 +466,7 @@ var PackageInfoClient = class {
462
466
  throw this.#resolveError(
463
467
  spec,
464
468
  options,
465
- `Registry returned HTTP ${response.statusCode} when fetching the tarball for ${spec} at ${tarball}. The version may have been unpublished, or the registry may be misconfigured or unreachable.`,
469
+ `${registryErrorMessage(response)} when fetching the tarball for ${spec} at ${tarball}. The version may have been unpublished, or the registry may be misconfigured or unreachable.`,
466
470
  { response, url: tarball }
467
471
  );
468
472
  }
@@ -542,7 +546,7 @@ var PackageInfoClient = class {
542
546
  throw this.#resolveError(
543
547
  spec,
544
548
  options,
545
- "failed to fetch URL",
549
+ `failed to fetch URL: ${registryErrorMessage(response)}`,
546
550
  { response, url: remoteURL }
547
551
  );
548
552
  }
@@ -645,7 +649,7 @@ var PackageInfoClient = class {
645
649
  throw this.#resolveError(
646
650
  s,
647
651
  options,
648
- "failed to fetch URL",
652
+ `failed to fetch URL: ${registryErrorMessage(response)}`,
649
653
  { response, url: remoteURL }
650
654
  );
651
655
  }
@@ -755,7 +759,7 @@ var PackageInfoClient = class {
755
759
  }
756
760
  async #fetchPackument(spec, options, pakuURL, useCache) {
757
761
  const response = await (await this.getRegistryClient()).request(pakuURL, {
758
- headers: { accept: "application/json" },
762
+ headers: { accept: PACKUMENT_ACCEPT },
759
763
  ...useCache === false ? { useCache } : {},
760
764
  // costs a conditional GET per moving selector on an otherwise warm
761
765
  // cache, install included. 304s are cheap but not free; the
@@ -766,7 +770,7 @@ var PackageInfoClient = class {
766
770
  throw this.#resolveError(
767
771
  spec,
768
772
  options,
769
- "failed to fetch packument",
773
+ `failed to fetch packument: ${registryErrorMessage(response)}`,
770
774
  {
771
775
  url: pakuURL,
772
776
  response
@@ -12,7 +12,7 @@ var require = _vlt_createRequire(import.meta.filename);
12
12
  import {
13
13
  generateDefaultHelp,
14
14
  generateFullHelp
15
- } from "./chunk-5HBKYSTX.js";
15
+ } from "./chunk-34TE4HZS.js";
16
16
  import {
17
17
  flush,
18
18
  trackCommand,
@@ -26,22 +26,22 @@ import {
26
26
  hasNpmRegistry,
27
27
  missingNpmRegistryError,
28
28
  missingRegistryError
29
- } from "./chunk-5JFRXIK2.js";
29
+ } from "./chunk-2PWSMJD7.js";
30
+ import {
31
+ isLazyView,
32
+ isViewClass,
33
+ loadLazyView
34
+ } from "./chunk-4KCU2KZL.js";
30
35
  import {
31
36
  isGraphRunError,
32
37
  splitDepID
33
38
  } from "./chunk-YOE3VZFX.js";
34
39
  import {
35
40
  defaultView
36
- } from "./chunk-MNK55XSE.js";
37
- import {
38
- isLazyView,
39
- isViewClass,
40
- loadLazyView
41
- } from "./chunk-4KCU2KZL.js";
41
+ } from "./chunk-CEHPRPGQ.js";
42
42
  import {
43
43
  emitter
44
- } from "./chunk-UBLFPJHV.js";
44
+ } from "./chunk-U7TEQCBN.js";
45
45
  import {
46
46
  isErrorWithCause,
47
47
  isObject
@@ -215,15 +215,21 @@ var printCode = (err, usage, stderr2, format) => {
215
215
  return { file: true };
216
216
  }
217
217
  case "ENEEDAUTH": {
218
- const { url } = err.cause;
218
+ const { url, method, status } = err.cause;
219
219
  stderr2(`Authentication Error: ${err.message}`);
220
220
  if (url) {
221
221
  stderr2(indent(`URL: ${formatURL(url, format)}`));
222
222
  }
223
+ if (method) {
224
+ stderr2(indent(`Method: ${format(method)}`));
225
+ }
226
+ if (status) {
227
+ stderr2(indent(`Status: ${format(status)}`));
228
+ }
223
229
  return {};
224
230
  }
225
231
  case "EREQUEST": {
226
- const { url, method } = err.cause;
232
+ const { url, method, status } = err.cause;
227
233
  const { code, syscall } = err.cause.cause ?? {};
228
234
  stderr2(`Request Error: ${err.message}`);
229
235
  if (code) {
@@ -238,6 +244,9 @@ var printCode = (err, usage, stderr2, format) => {
238
244
  if (method) {
239
245
  stderr2(indent(`Method: ${format(method)}`));
240
246
  }
247
+ if (status) {
248
+ stderr2(indent(`Status: ${format(status)}`));
249
+ }
241
250
  return { file: true };
242
251
  }
243
252
  case "EQUERY": {
@@ -0,0 +1,190 @@
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
+ assertRegistryKeys,
14
+ configWriteTarget,
15
+ pairsToRecords,
16
+ registrySelectionFields,
17
+ registrySelectors
18
+ } from "./chunk-6FT6K5YN.js";
19
+ import {
20
+ normalizeRegistryURL
21
+ } from "./chunk-2PWSMJD7.js";
22
+ import {
23
+ getCommand,
24
+ isRecordField
25
+ } from "./chunk-CEHPRPGQ.js";
26
+ import {
27
+ find
28
+ } from "./chunk-HTOTG4TS.js";
29
+ import {
30
+ defaultGitHostArchives,
31
+ defaultGitHosts,
32
+ defaultJsrRegistries,
33
+ defaultRegistries,
34
+ defaultRegistryName,
35
+ isObject
36
+ } from "./chunk-VFBCWAOC.js";
37
+ import {
38
+ error
39
+ } from "./chunk-WZWDS3W4.js";
40
+
41
+ // ../../src/cli-sdk/src/persist-spec-config.ts
42
+ var specConfigFields = [
43
+ "registry",
44
+ "registries",
45
+ "default-registry-alias",
46
+ "scoped-registries",
47
+ "jsr-registries",
48
+ "git-hosts",
49
+ "git-host-archives"
50
+ ];
51
+ var builtins = {
52
+ registries: defaultRegistries,
53
+ "jsr-registries": defaultJsrRegistries,
54
+ "git-hosts": defaultGitHosts,
55
+ "git-host-archives": defaultGitHostArchives
56
+ };
57
+ var urlFields = /* @__PURE__ */ new Set([
58
+ "registry",
59
+ "registries",
60
+ "scoped-registries",
61
+ "jsr-registries"
62
+ ]);
63
+ var norm = (field, v) => urlFields.has(field) ? normalizeRegistryURL(v) : v;
64
+ var redact = (value) => {
65
+ if (!URL.canParse(value)) return value;
66
+ const url = new URL(value);
67
+ if (!url.username && !url.password) return value;
68
+ url.username = "";
69
+ url.password = "";
70
+ return url.href.replace("://", "://***@");
71
+ };
72
+ var fromLayer = (layer, field, key) => {
73
+ const v = layer?.[field];
74
+ const r = key === void 0 ? v : v && typeof v === "object" ? v[key] : void 0;
75
+ return typeof r === "string" ? r : void 0;
76
+ };
77
+ var isNulled = (layer, field, key) => {
78
+ const v = layer?.[field];
79
+ return key === void 0 ? v === null : isObject(v) && v[key] === null;
80
+ };
81
+ var conflictError = (field, key, current, wanted, file, block) => {
82
+ const name = (block ? `command.${block}.` : "") + (key === void 0 ? field : `${field}.${key}`);
83
+ const cur = redact(current);
84
+ const flag = key === void 0 ? `--${field}=${cur}` : `--${field} ${key}=${cur}`;
85
+ return error(
86
+ [
87
+ `${name} is already set to ${cur} in ${file}.`,
88
+ "",
89
+ `Pass \`${flag}\`${key === void 0 ? "" : ", use another name,"} or run`,
90
+ block ? "`vlt config edit` to change it first." : `\`vlt config set ${name}=${redact(wanted)}\` first.`
91
+ ].join("\n"),
92
+ { code: "ECONFIG", found: wanted, wanted: current }
93
+ );
94
+ };
95
+ var ownsSelection = (layer) => registrySelectionFields.some((f) => f in (layer ?? {}));
96
+ var planSpecConfigPersist = (conf) => {
97
+ if (!conf.get("save-config")) return void 0;
98
+ const explicit = pairsToRecords(conf.explicit);
99
+ if (!specConfigFields.some((f) => f in explicit)) return void 0;
100
+ const which = configWriteTarget(conf, "project");
101
+ const target = conf.layers[which];
102
+ const other = conf.layers[which === "project" ? "user" : "project"];
103
+ const otherSelectors = which === "user" || !ownsSelection(target);
104
+ const blocks = target?.command ?? {};
105
+ const blockName = Object.keys(blocks).filter((n) => getCommand(n) === conf.command).at(-1);
106
+ const block = blockName ? blocks[blockName] : void 0;
107
+ const staged = {};
108
+ for (const field of specConfigFields) {
109
+ const v = explicit[field];
110
+ if (v === void 0) continue;
111
+ const entries2 = isRecordField(field) ? Object.entries(v) : [[void 0, v]];
112
+ for (const [key, raw] of entries2) {
113
+ if (key === "") {
114
+ throw error(`${field} has an entry with no name.`, {
115
+ code: "ECONFIG",
116
+ found: `=${raw}`,
117
+ wanted: `<name>=${raw}`
118
+ });
119
+ }
120
+ if (key !== void 0 && field === "registries") {
121
+ assertRegistryKeys({ [key]: raw }, `--${field}`);
122
+ }
123
+ if (key !== void 0 && !raw) {
124
+ throw error(`${field}.${key} has no value.`, {
125
+ code: "ECONFIG",
126
+ found: key,
127
+ wanted: `${key}=<value>`
128
+ });
129
+ }
130
+ if (!raw) continue;
131
+ const value = norm(field, raw);
132
+ const inBlock = fromLayer(block, field, key);
133
+ if (inBlock !== void 0) {
134
+ if (norm(field, inBlock) === value) continue;
135
+ throw conflictError(
136
+ field,
137
+ key,
138
+ inBlock,
139
+ value,
140
+ find(which),
141
+ blockName
142
+ );
143
+ }
144
+ const toBlock = key !== void 0 && isObject(block?.[field]) ? blockName : void 0;
145
+ const current = toBlock === void 0 ? fromLayer(target, field, key) : void 0;
146
+ if (current !== void 0) {
147
+ if (norm(field, current) === value) continue;
148
+ throw conflictError(field, key, current, value, find(which));
149
+ }
150
+ const inOther = toBlock !== void 0 || isNulled(target, field, key) || key === void 0 && !otherSelectors ? void 0 : fromLayer(other, field, key);
151
+ const builtin = key !== void 0 ? builtins[field]?.[key] : field === "default-registry-alias" ? defaultRegistryName : void 0;
152
+ const inEffect = inOther ?? builtin;
153
+ if (inEffect !== void 0 && norm(field, inEffect) === value) {
154
+ continue;
155
+ }
156
+ let dest = staged;
157
+ if (toBlock !== void 0) {
158
+ const cmds = staged.command ??= {};
159
+ dest = cmds[toBlock] ??= {};
160
+ }
161
+ if (key === void 0) dest[field] = value;
162
+ else {
163
+ const rec = dest[field] ??= {};
164
+ rec[key] = value;
165
+ }
166
+ }
167
+ }
168
+ if (!Object.keys(staged).length) return void 0;
169
+ const { user } = conf.layers;
170
+ if (which === "project" && ownsSelection(staged) && !ownsSelection(target)) {
171
+ for (const f of registrySelectors) {
172
+ const v = fromLayer(user, f);
173
+ if (v !== void 0 && !(f in staged)) staged[f] = v;
174
+ }
175
+ const alias = staged["default-registry-alias"];
176
+ const url = alias && fromLayer(user, "registries", alias);
177
+ const regs = staged.registries ?? {};
178
+ if (url && !(alias in regs)) {
179
+ staged.registries = { ...regs, [alias]: url };
180
+ }
181
+ }
182
+ return { which, values: staged };
183
+ };
184
+ var entries = (path, v) => isObject(v) ? Object.entries(v).flatMap(([k, x]) => entries(`${path}.${k}`, x)) : [`${path}=${redact(String(v))}`];
185
+ var persistedEntries = (values) => Object.entries(values).flatMap(([f, v]) => entries(f, v));
186
+
187
+ export {
188
+ planSpecConfigPersist,
189
+ persistedEntries
190
+ };
@@ -19,7 +19,7 @@ var run = async (command) => {
19
19
  if (command) {
20
20
  process.argv.splice(2, 0, command);
21
21
  }
22
- const vlt = await import("./src-23VBKASP.js");
22
+ const vlt = await import("./src-575IYJOL.js");
23
23
  await vlt.default();
24
24
  };
25
25