@vltpkg/cli-js 1.0.5 → 1.0.7

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 (64) hide show
  1. package/{access-AFFG4IBZ.js → access-OKO4MXDT.js} +3 -3
  2. package/{bugs-MCLLEJJP.js → bugs-J56QQ3CP.js} +4 -4
  3. package/{build-TKUT6V2P.js → build-CQ2E2XRO.js} +2 -2
  4. package/{cache-O464JQI4.js → cache-PPEXAQT7.js} +5 -5
  5. package/{chunk-YZPRRP7W.js → chunk-A4EKZ32F.js} +1 -1
  6. package/{chunk-4LBWNGU6.js → chunk-ADYHZTEI.js} +1 -1
  7. package/{chunk-YRLO236S.js → chunk-CHHGSDAP.js} +1 -1
  8. package/{chunk-FBHWUWBW.js → chunk-CIKUT62L.js} +1 -1
  9. package/{chunk-3NWTVANS.js → chunk-GVZRKITF.js} +164 -41
  10. package/{chunk-UCYLZSZ7.js → chunk-JLKFIX2H.js} +2 -2
  11. package/{chunk-R32BJAKT.js → chunk-JWWDJYSU.js} +23 -11
  12. package/chunk-NEFV2B5V.js +75 -0
  13. package/{chunk-AL42Z2D3.js → chunk-OUF2P2OD.js} +2 -2
  14. package/{chunk-LCDBW6IT.js → chunk-PTR5IGFQ.js} +1 -1
  15. package/{chunk-JFO2EQA5.js → chunk-RKXQ66T4.js} +1 -1
  16. package/{chunk-K55EFH4U.js → chunk-SVO3HI2G.js} +1 -1
  17. package/{chunk-WP6CYBPM.js → chunk-XISRK3R5.js} +21 -6
  18. package/{chunk-FEIPJIEN.js → chunk-YAIKXFLN.js} +1 -1
  19. package/{ci-GPZGE4SU.js → ci-WDQ4SQN6.js} +2 -2
  20. package/cli-package.json +1 -1
  21. package/{config-WDCFW5X7.js → config-JMARDHLW.js} +4 -4
  22. package/{config-YEEKT7WH.js → config-XY5CDGTD.js} +5 -3
  23. package/{create-TVVUUIUZ.js → create-C24ZGR6S.js} +8 -8
  24. package/{deprecate-AH4LOHMI.js → deprecate-HYHD5WQC.js} +5 -5
  25. package/{dist-tag-4R6YHSZ7.js → dist-tag-RPQ5LZWM.js} +3 -3
  26. package/{docs-7MHXAHGG.js → docs-UKQNAVM3.js} +4 -4
  27. package/{exec-FRQOPS5C.js → exec-FNZEVDGU.js} +8 -8
  28. package/{exec-cache-VYVXFKA2.js → exec-cache-GRHS57DV.js} +6 -6
  29. package/{exec-local-MXYOC2AY.js → exec-local-AHDW7CKQ.js} +6 -6
  30. package/{help-J5CYJ7BO.js → help-VDBXIWF3.js} +4 -4
  31. package/{init-7D5MFAP5.js → init-2ICZBLI2.js} +3 -3
  32. package/{install-T34U5HPS.js → install-IFSVVRU5.js} +2 -2
  33. package/{list-C2LX6EIY.js → list-RCAPA3OE.js} +6 -6
  34. package/{login-6JP7WTRM.js → login-T42R75OV.js} +21 -5
  35. package/{logout-JYOBUHP3.js → logout-PVR6J2AK.js} +3 -3
  36. package/{pack-ON6BK2AI.js → pack-HPLDE4RB.js} +3 -3
  37. package/package.json +1 -1
  38. package/{ping-GUNQJ53P.js → ping-N5U4XHUU.js} +3 -3
  39. package/{pkg-GIH3WMUK.js → pkg-VNKZX5JC.js} +4 -4
  40. package/{profile-IEIZFNOD.js → profile-N7UOXZ2X.js} +3 -3
  41. package/{publish-VTRA3MIS.js → publish-CRSF7NZP.js} +15 -5
  42. package/{query-KEXYDRHP.js → query-MEAXXYOE.js} +6 -6
  43. package/{registry-43SSGAPE.js → registry-BMWXMQS4.js} +2 -2
  44. package/registry-client-package.json +1 -1
  45. package/registry-client-src-revalidate.js +23 -11
  46. package/{repo-LI5FOP3N.js → repo-IRTGGLIC.js} +4 -4
  47. package/{run-LEWQVDWO.js → run-I6HWURSB.js} +6 -6
  48. package/{run-exec-CLCZ47NU.js → run-exec-BV3RUWQM.js} +6 -6
  49. package/{setup-MPG4UQPT.js → setup-U6DWTZBA.js} +44 -16
  50. package/{src-B4IYFLHG.js → src-44BBCHST.js} +1 -1
  51. package/{src-ARXB4NH5.js → src-SXMLUOLI.js} +7 -7
  52. package/{token-UD4AF4I7.js → token-CTUMLTQP.js} +3 -3
  53. package/{uninstall-MSKFXGAO.js → uninstall-UUFXE47B.js} +2 -2
  54. package/{unpublish-2RNLXZWP.js → unpublish-G4NALOC6.js} +5 -5
  55. package/{update-3HXQLP34.js → update-BGMQQNYE.js} +2 -2
  56. package/{version-RBLKW6BQ.js → version-QVFPFL6M.js} +3 -3
  57. package/{view-3XTRGRGJ.js → view-QFYMJVBE.js} +3 -3
  58. package/vlr.js +1 -1
  59. package/vlrx.js +1 -1
  60. package/vlt.js +1 -1
  61. package/vlx.js +1 -1
  62. package/vlxl.js +1 -1
  63. package/{whoami-WSXDPFSQ.js → whoami-5D4XUOSP.js} +3 -3
  64. package/chunk-ZBNPQDQ7.js +0 -75
@@ -14,12 +14,12 @@ import {
14
14
  } from "./chunk-5JFRXIK2.js";
15
15
  import {
16
16
  commandUsage
17
- } from "./chunk-LCDBW6IT.js";
17
+ } from "./chunk-PTR5IGFQ.js";
18
18
  import "./chunk-XKVU23NC.js";
19
- import "./chunk-WP6CYBPM.js";
19
+ import "./chunk-XISRK3R5.js";
20
20
  import {
21
21
  RegistryClient
22
- } from "./chunk-R32BJAKT.js";
22
+ } from "./chunk-JWWDJYSU.js";
23
23
  import "./chunk-HAYXR3MW.js";
24
24
  import "./chunk-E74WGW5C.js";
25
25
  import "./chunk-LPIBYUMT.js";
@@ -14,10 +14,10 @@ import {
14
14
  } from "./chunk-CLVRCGOZ.js";
15
15
  import {
16
16
  createHostContextsMap
17
- } from "./chunk-YRLO236S.js";
17
+ } from "./chunk-CHHGSDAP.js";
18
18
  import {
19
19
  PackageInfoClient
20
- } from "./chunk-YZPRRP7W.js";
20
+ } from "./chunk-A4EKZ32F.js";
21
21
  import "./chunk-ZWKI5OSF.js";
22
22
  import {
23
23
  Query,
@@ -30,11 +30,11 @@ import "./chunk-SVBEF5PK.js";
30
30
  import "./chunk-3OPNZI6G.js";
31
31
  import {
32
32
  commandUsage
33
- } from "./chunk-LCDBW6IT.js";
33
+ } from "./chunk-PTR5IGFQ.js";
34
34
  import {
35
35
  Spec
36
36
  } from "./chunk-XKVU23NC.js";
37
- import "./chunk-WP6CYBPM.js";
37
+ import "./chunk-XISRK3R5.js";
38
38
  import "./chunk-HTOTG4TS.js";
39
39
  import {
40
40
  urlOpen
@@ -17,9 +17,9 @@ import "./chunk-SVBEF5PK.js";
17
17
  import "./chunk-3OPNZI6G.js";
18
18
  import {
19
19
  commandUsage
20
- } from "./chunk-LCDBW6IT.js";
20
+ } from "./chunk-PTR5IGFQ.js";
21
21
  import "./chunk-XKVU23NC.js";
22
- import "./chunk-WP6CYBPM.js";
22
+ import "./chunk-XISRK3R5.js";
23
23
  import "./chunk-HTOTG4TS.js";
24
24
  import "./chunk-E74WGW5C.js";
25
25
  import "./chunk-LPIBYUMT.js";
@@ -15,8 +15,8 @@ import {
15
15
  import {
16
16
  stderr,
17
17
  stdout
18
- } from "./chunk-AL42Z2D3.js";
19
- import "./chunk-FEIPJIEN.js";
18
+ } from "./chunk-OUF2P2OD.js";
19
+ import "./chunk-YAIKXFLN.js";
20
20
  import "./chunk-G2YT2GWF.js";
21
21
  import "./chunk-GDJ7JT2R.js";
22
22
  import "./chunk-5JFRXIK2.js";
@@ -24,17 +24,17 @@ import "./chunk-WGDTG44V.js";
24
24
  import "./chunk-3OPNZI6G.js";
25
25
  import {
26
26
  commandUsage
27
- } from "./chunk-LCDBW6IT.js";
27
+ } from "./chunk-PTR5IGFQ.js";
28
28
  import {
29
29
  Spec
30
30
  } from "./chunk-XKVU23NC.js";
31
- import "./chunk-WP6CYBPM.js";
31
+ import "./chunk-XISRK3R5.js";
32
32
  import {
33
33
  ViewClass
34
34
  } from "./chunk-4KCU2KZL.js";
35
35
  import {
36
36
  CacheEntry
37
- } from "./chunk-R32BJAKT.js";
37
+ } from "./chunk-JWWDJYSU.js";
38
38
  import "./chunk-HAYXR3MW.js";
39
39
  import "./chunk-E74WGW5C.js";
40
40
  import "./chunk-LPIBYUMT.js";
@@ -111,7 +111,7 @@ var PackageInfoClient = class {
111
111
  #tarPoolPromise;
112
112
  async getRegistryClient() {
113
113
  if (this.#registryClient) return this.#registryClient;
114
- this.#registryClientPromise ??= import("./src-B4IYFLHG.js").then(({ RegistryClient }) => {
114
+ this.#registryClientPromise ??= import("./src-44BBCHST.js").then(({ RegistryClient }) => {
115
115
  this.#registryClient = new RegistryClient(this.options);
116
116
  return this.#registryClient;
117
117
  });
@@ -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
  stderr
14
- } from "./chunk-AL42Z2D3.js";
14
+ } from "./chunk-OUF2P2OD.js";
15
15
  import {
16
16
  mermaidOutput
17
17
  } from "./chunk-3NGV7EC6.js";
@@ -115,7 +115,7 @@ var reloadConfig = async (folder) => {
115
115
  unload("project");
116
116
  } catch {
117
117
  }
118
- const { Config } = await import("./config-YEEKT7WH.js");
118
+ const { Config } = await import("./config-XY5CDGTD.js");
119
119
  return Config.load(folder, process.argv, true);
120
120
  };
121
121
 
@@ -20,7 +20,7 @@ import {
20
20
  } from "./chunk-SVBEF5PK.js";
21
21
  import {
22
22
  commandUsage
23
- } from "./chunk-LCDBW6IT.js";
23
+ } from "./chunk-PTR5IGFQ.js";
24
24
  import {
25
25
  load,
26
26
  save
@@ -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
  PackageInfoClient
14
- } from "./chunk-YZPRRP7W.js";
14
+ } from "./chunk-A4EKZ32F.js";
15
15
  import {
16
16
  Monorepo,
17
17
  PackageJson,
@@ -22,11 +22,12 @@ import {
22
22
  } from "./chunk-3OPNZI6G.js";
23
23
  import {
24
24
  commands,
25
+ defaultValues,
25
26
  definition,
26
27
  getCommand,
27
28
  isRecordField,
28
29
  recordFields
29
- } from "./chunk-WP6CYBPM.js";
30
+ } from "./chunk-XISRK3R5.js";
30
31
  import {
31
32
  find,
32
33
  load,
@@ -63,6 +64,70 @@ var merge = (base, add) => Object.fromEntries(
63
64
  )
64
65
  );
65
66
 
67
+ // ../../src/cli-sdk/src/config/merge-layers.ts
68
+ var registrySelectors = [
69
+ "registry",
70
+ "default-registry-alias"
71
+ ];
72
+ var registrySelectionFields = [
73
+ "registry",
74
+ "registries",
75
+ "default-registry-alias"
76
+ ];
77
+ var isObj = (v) => !!v && typeof v === "object" && !Array.isArray(v);
78
+ var cloneValue = (v) => Array.isArray(v) ? v.map((x) => cloneValue(x)) : isObj(v) ? Object.fromEntries(
79
+ Object.entries(v).map(([k, x]) => [k, cloneValue(x)])
80
+ ) : v;
81
+ var cloneLayer = (data) => cloneValue(data);
82
+ var mergeRecord = (base, add) => {
83
+ const result = isObj(base) ? { ...base } : {};
84
+ for (const [k, v] of Object.entries(add)) {
85
+ if (v === null) delete result[k];
86
+ else result[k] = v;
87
+ }
88
+ return Object.keys(result).length ? result : void 0;
89
+ };
90
+ var mergeCommands = (base, add) => {
91
+ const result = isObj(base) ? { ...base } : {};
92
+ for (const [cmd, opts] of Object.entries(add)) {
93
+ if (opts === null) delete result[cmd];
94
+ else if (isObj(opts)) {
95
+ result[cmd] = mergeLayers([
96
+ isObj(result[cmd]) ? result[cmd] : void 0,
97
+ opts
98
+ ]);
99
+ }
100
+ }
101
+ return Object.keys(result).length ? result : void 0;
102
+ };
103
+ var mergeLayers = (layers) => {
104
+ const result = {};
105
+ for (const layer of layers) {
106
+ if (!isObj(layer)) continue;
107
+ for (const [k, v] of Object.entries(layer)) {
108
+ if (k === "command") {
109
+ const merged = isObj(v) ? mergeCommands(result.command, v) : void 0;
110
+ if (merged) result.command = merged;
111
+ else delete result.command;
112
+ } else if (v === null) {
113
+ delete result[k];
114
+ } else if (isRecordField(k) && isObj(v)) {
115
+ const merged = mergeRecord(result[k], v);
116
+ if (merged) result[k] = merged;
117
+ else delete result[k];
118
+ } else {
119
+ result[k] = v;
120
+ }
121
+ }
122
+ if (registrySelectionFields.some((f) => f in layer)) {
123
+ for (const f of registrySelectors) {
124
+ if (!(f in layer)) delete result[f];
125
+ }
126
+ }
127
+ }
128
+ return result;
129
+ };
130
+
66
131
  // ../../src/cli-sdk/src/config/index.ts
67
132
  var kCustomInspect = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
68
133
  var reducePairs = (pairs) => {
@@ -79,6 +144,18 @@ var reducePairs = (pairs) => {
79
144
  return record;
80
145
  };
81
146
  var isRecordFieldValue = (k, v) => Array.isArray(v) && recordFields.includes(k);
147
+ var assertRegistryKeys = (registries, file) => {
148
+ if (!registries || typeof registries !== "object") return;
149
+ const obj = Array.isArray(registries) ? reducePairs(registries) : registries;
150
+ for (const key of Object.keys(obj)) {
151
+ if (key === "" || key.includes("~")) {
152
+ throw error("Reserved character found in registries name", {
153
+ path: file,
154
+ found: key
155
+ });
156
+ }
157
+ }
158
+ };
82
159
  var pairsToRecords = (obj) => {
83
160
  return Object.fromEntries(
84
161
  Object.entries(obj).map(([k, v]) => [
@@ -99,7 +176,16 @@ var recordsToPairs = (obj) => {
99
176
  ([k]) => !(k === "scurry" || k === "packageJson" || k === "monorepo" || k === "projectRoot" || k === "packageInfo")
100
177
  ).map(([k, v]) => [
101
178
  k,
102
- 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}`)
179
+ k === "command" && v && typeof v === "object" ? (
180
+ // each command's own block gets converted too, mirroring
181
+ // pairsToRecords
182
+ Object.fromEntries(
183
+ Object.entries(v).map(([k2, v2]) => [
184
+ k2,
185
+ recordsToPairs(v2)
186
+ ])
187
+ )
188
+ ) : !v || typeof v !== "object" || Array.isArray(v) || !isRecordField(k) ? v : Object.entries(v).map(([k2, v2]) => `${k2}=${v2}`)
103
189
  ])
104
190
  );
105
191
  };
@@ -292,7 +378,12 @@ var Config = class _Config {
292
378
  async addConfigToFile(which, values) {
293
379
  return this.writeConfigFile(
294
380
  which,
295
- merge(await this.#maybeLoadConfigFile(which) ?? {}, values)
381
+ merge(
382
+ pairsToRecords(
383
+ await this.#maybeLoadConfigFile(which) ?? {}
384
+ ),
385
+ pairsToRecords(values)
386
+ )
296
387
  );
297
388
  }
298
389
  // called in this weird bound way so that it can be used by the
@@ -308,53 +399,79 @@ var Config = class _Config {
308
399
  wanted: "ConfigFileData"
309
400
  });
310
401
  }
311
- const { command, ...values } = recordsToPairs(c);
312
- const registries = c.registries;
313
- if (registries && typeof registries === "object") {
314
- const registriesObj = Array.isArray(registries) ? reducePairs(registries) : registries;
315
- for (const key of Object.keys(registriesObj)) {
316
- if (key === "" || key.includes("~")) {
317
- throw error("Reserved character found in registries name", {
318
- path: file,
319
- found: key
320
- });
402
+ const { command, ...values } = c;
403
+ assertRegistryKeys(values.registries, file);
404
+ if (command && typeof command === "object") {
405
+ for (const opts of Object.values(command)) {
406
+ if (opts && typeof opts === "object") {
407
+ assertRegistryKeys(opts.registries, file);
321
408
  }
322
409
  }
323
410
  }
324
- if (command) {
325
- for (const [c2, opts] of Object.entries(command)) {
326
- const cmd = getCommand(c2);
327
- if (cmd && opts && typeof opts === "object") {
328
- const cmdRegistries = opts.registries;
329
- if (cmdRegistries && typeof cmdRegistries === "object") {
330
- const cmdRegistriesObj = Array.isArray(cmdRegistries) ? reducePairs(cmdRegistries) : cmdRegistries;
331
- for (const key of Object.keys(cmdRegistriesObj)) {
332
- if (key === "" || key.includes("~")) {
333
- throw error(
334
- "Reserved character found in registries name",
335
- {
336
- path: file,
337
- found: key
338
- }
339
- );
340
- }
341
- }
342
- }
343
- this.commandValues[cmd] = merge(
344
- this.commandValues[cmd] ?? {},
345
- opts
346
- );
347
- }
411
+ const layer = cloneLayer(pairsToRecords(c));
412
+ const { command: _cmd, ...single } = mergeLayers([layer]);
413
+ try {
414
+ this.jack.validate(recordsToPairs(single));
415
+ } catch (er) {
416
+ if (er instanceof Error) {
417
+ const cause = typeof er.cause === "object" ? er.cause : {};
418
+ er.cause = { ...cause, path: file };
419
+ }
420
+ throw er;
421
+ }
422
+ this.#layers[file === find("user") ? "user" : "project"] = layer;
423
+ this.#applyLayers();
424
+ }
425
+ /**
426
+ * The raw config data from each `vlt.json` file, normalized to record
427
+ * form, before the layers are merged together. `undefined` for a layer
428
+ * with no file, or a file with no `config` field.
429
+ */
430
+ get layers() {
431
+ return this.#layers;
432
+ }
433
+ #layers = {};
434
+ /**
435
+ * Recompute the jack defaults and {@link Config#commandValues} from
436
+ * {@link Config#layers}.
437
+ *
438
+ * Everything is derived from `#layers`, and every known field is applied,
439
+ * so this is idempotent: re-reading a config file (which
440
+ * `addConfigToFile` and `deleteConfigKeys` both do) can't stack the user
441
+ * layer back on top of the project layer, and a field a layer stopped
442
+ * setting goes back to its definitional default.
443
+ */
444
+ #applyLayers() {
445
+ const { command, ...values } = mergeLayers([
446
+ this.#layers.user,
447
+ this.#layers.project
448
+ ]);
449
+ this.commandValues = {};
450
+ for (const [c, opts] of Object.entries(command ?? {})) {
451
+ const cmd = getCommand(c);
452
+ if (cmd && opts && typeof opts === "object") {
453
+ this.commandValues[cmd] = opts;
348
454
  }
349
455
  }
350
- this.jack.setConfigValues(values, file);
456
+ const pairs = recordsToPairs(values);
457
+ const applied = {};
458
+ for (const [field, dflt] of Object.entries(defaultValues)) {
459
+ applied[field] = field in pairs ? pairs[field] : dflt;
460
+ }
461
+ this.jack.setConfigValues(applied);
462
+ this.#options = void 0;
351
463
  }
352
464
  /**
353
465
  * if the file exists, parse and load it. returns object if data was
354
466
  * loaded, or undefined if not.
355
467
  */
356
468
  async #maybeLoadConfigFile(whichConfig) {
357
- return load("config", this.#validator, whichConfig);
469
+ const data = load("config", this.#validator, whichConfig);
470
+ if (data === void 0 && this.#layers[whichConfig] !== void 0) {
471
+ delete this.#layers[whichConfig];
472
+ this.#applyLayers();
473
+ }
474
+ return data;
358
475
  }
359
476
  /**
360
477
  * Deletes the specified config fields from the named file
@@ -482,10 +599,16 @@ var Config = class _Config {
482
599
  }
483
600
  };
484
601
  var isParsed = (c) => !!(c.values && c.positionals && c.command);
602
+ var configWriteTarget = (conf, fallback) => {
603
+ const which = conf.get("config");
604
+ return which === "user" || which === "project" ? which : fallback;
605
+ };
485
606
 
486
607
  export {
608
+ registrySelectionFields,
487
609
  kCustomInspect,
488
610
  pairsToRecords,
489
611
  recordsToPairs,
490
- Config
612
+ Config,
613
+ configWriteTarget
491
614
  };
@@ -14,12 +14,12 @@ import {
14
14
  } from "./chunk-RIYFGX27.js";
15
15
  import {
16
16
  createHostContextsMap
17
- } from "./chunk-YRLO236S.js";
17
+ } from "./chunk-CHHGSDAP.js";
18
18
  import {
19
19
  stderr,
20
20
  stdout,
21
21
  styleTextStdout
22
- } from "./chunk-AL42Z2D3.js";
22
+ } from "./chunk-OUF2P2OD.js";
23
23
  import {
24
24
  require_emoji_regex
25
25
  } from "./chunk-VTEFO2FT.js";
@@ -26826,7 +26826,7 @@ var CacheEntry = class _CacheEntry {
26826
26826
  * and this static method will decode it into a CacheEntry representing
26827
26827
  * the cached response.
26828
26828
  */
26829
- static decode(buffer) {
26829
+ static decode(buffer, options = {}) {
26830
26830
  const parsed = _CacheEntry.#parseHead(buffer);
26831
26831
  if (!parsed) return emptyCacheEntry;
26832
26832
  const body = buffer.subarray(parsed.headSize);
@@ -26841,7 +26841,8 @@ var CacheEntry = class _CacheEntry {
26841
26841
  body,
26842
26842
  integrity: parsed.integrity,
26843
26843
  trustIntegrity: true,
26844
- contentLength: body.byteLength
26844
+ contentLength: body.byteLength,
26845
+ ...options
26845
26846
  }
26846
26847
  );
26847
26848
  c.#fromCache = true;
@@ -26963,7 +26964,7 @@ var register2 = (path, method, url) => {
26963
26964
  var handleBeforeExit2 = () => {
26964
26965
  const compileCacheDir = module2.getCompileCacheDir();
26965
26966
  for (const [path, r] of registered2) {
26966
- if (!r.size) return;
26967
+ if (!r.size) continue;
26967
26968
  const env = { ...process.env };
26968
26969
  if (compileCacheDir) env.NODE_COMPILE_CACHE ??= compileCacheDir;
26969
26970
  const args = [];
@@ -27473,13 +27474,24 @@ var RegistryClient = class {
27473
27474
  await deleteToken(registry, this.identity);
27474
27475
  }
27475
27476
  /**
27476
- * Log into the registry specified
27477
+ * Log into the registry specified.
27478
+ *
27479
+ * When a list of registries is provided, the web login flow runs once
27480
+ * against the first of them, and the token it returns is saved for all
27481
+ * of them. This is for registries that share credentials -- like the
27482
+ * ones under a single vlt.io account -- where opening the browser once
27483
+ * per registry would just be asking for the same token again.
27477
27484
  *
27478
27485
  * Does not return the token or expose it, just saves to the auth keychain
27479
27486
  * and returns void if it worked. Otherwise, error is raised.
27480
27487
  */
27481
27488
  async login(registry) {
27482
- const webLoginURL = new URL("-/v1/login", registryBase(registry));
27489
+ const registries = Array.isArray(registry) ? registry : [registry];
27490
+ const [first] = registries;
27491
+ if (!first) {
27492
+ throw error("No registry provided to log in against");
27493
+ }
27494
+ const webLoginURL = new URL("-/v1/login", registryBase(first));
27483
27495
  const response = await this.request(webLoginURL, {
27484
27496
  method: "POST",
27485
27497
  useCache: false,
@@ -27493,11 +27505,9 @@ var RegistryClient = class {
27493
27505
  const challenge = getWebAuthChallenge(response.json());
27494
27506
  if (challenge) {
27495
27507
  const result = await this.webAuthOpener(challenge);
27496
- await setToken(
27497
- registry,
27498
- `Bearer ${result.token}`,
27499
- this.identity
27500
- );
27508
+ for (const reg of registries) {
27509
+ await setToken(reg, `Bearer ${result.token}`, this.identity);
27510
+ }
27501
27511
  return;
27502
27512
  }
27503
27513
  }
@@ -27527,7 +27537,9 @@ var RegistryClient = class {
27527
27537
  #decodeCached(buffer) {
27528
27538
  const hit = this.#decoded.get(buffer);
27529
27539
  if (hit) return hit;
27530
- const entry = CacheEntry.decode(buffer);
27540
+ const entry = CacheEntry.decode(buffer, {
27541
+ "stale-while-revalidate-factor": this.staleWhileRevalidateFactor
27542
+ });
27531
27543
  if (!entry.statusCode) return void 0;
27532
27544
  if (entry.isJSON) {
27533
27545
  try {
@@ -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-OKO4MXDT.js"),
22
+ "./commands/bugs.ts": () => import("./bugs-J56QQ3CP.js"),
23
+ "./commands/build.ts": () => import("./build-CQ2E2XRO.js"),
24
+ "./commands/cache.ts": () => import("./cache-PPEXAQT7.js"),
25
+ "./commands/ci.ts": () => import("./ci-WDQ4SQN6.js"),
26
+ "./commands/config.ts": () => import("./config-JMARDHLW.js"),
27
+ "./commands/create.ts": () => import("./create-C24ZGR6S.js"),
28
+ "./commands/deprecate.ts": () => import("./deprecate-HYHD5WQC.js"),
29
+ "./commands/dist-tag.ts": () => import("./dist-tag-RPQ5LZWM.js"),
30
+ "./commands/docs.ts": () => import("./docs-UKQNAVM3.js"),
31
+ "./commands/exec-cache.ts": () => import("./exec-cache-GRHS57DV.js"),
32
+ "./commands/exec-local.ts": () => import("./exec-local-AHDW7CKQ.js"),
33
+ "./commands/exec.ts": () => import("./exec-FNZEVDGU.js"),
34
+ "./commands/help.ts": () => import("./help-VDBXIWF3.js"),
35
+ "./commands/init.ts": () => import("./init-2ICZBLI2.js"),
36
+ "./commands/install.ts": () => import("./install-IFSVVRU5.js"),
37
+ "./commands/install/reporter.ts": () => import("./reporter-Y7RMSVN4.js"),
38
+ "./commands/list.ts": () => import("./list-RCAPA3OE.js"),
39
+ "./commands/login.ts": () => import("./login-T42R75OV.js"),
40
+ "./commands/logout.ts": () => import("./logout-PVR6J2AK.js"),
41
+ "./commands/pack.ts": () => import("./pack-HPLDE4RB.js"),
42
+ "./commands/ping.ts": () => import("./ping-N5U4XHUU.js"),
43
+ "./commands/pkg.ts": () => import("./pkg-VNKZX5JC.js"),
44
+ "./commands/profile.ts": () => import("./profile-N7UOXZ2X.js"),
45
+ "./commands/publish.ts": () => import("./publish-CRSF7NZP.js"),
46
+ "./commands/query.ts": () => import("./query-MEAXXYOE.js"),
47
+ "./commands/registry.ts": () => import("./registry-BMWXMQS4.js"),
48
+ "./commands/repo.ts": () => import("./repo-IRTGGLIC.js"),
49
+ "./commands/run-exec.ts": () => import("./run-exec-BV3RUWQM.js"),
50
+ "./commands/run.ts": () => import("./run-I6HWURSB.js"),
51
+ "./commands/setup.ts": () => import("./setup-U6DWTZBA.js"),
52
+ "./commands/token.ts": () => import("./token-CTUMLTQP.js"),
53
+ "./commands/uninstall.ts": () => import("./uninstall-UUFXE47B.js"),
54
+ "./commands/unpublish.ts": () => import("./unpublish-G4NALOC6.js"),
55
+ "./commands/update.ts": () => import("./update-BGMQQNYE.js"),
56
+ "./commands/version.ts": () => import("./version-QVFPFL6M.js"),
57
+ "./commands/view.ts": () => import("./view-QFYMJVBE.js"),
58
+ "./commands/whoami.ts": () => import("./whoami-5D4XUOSP.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
  generateDefaultHelp,
14
14
  generateFullHelp
15
- } from "./chunk-FEIPJIEN.js";
15
+ } from "./chunk-YAIKXFLN.js";
16
16
  import {
17
17
  flush,
18
18
  trackCommand,
@@ -33,7 +33,7 @@ import {
33
33
  } from "./chunk-3OPNZI6G.js";
34
34
  import {
35
35
  defaultView
36
- } from "./chunk-WP6CYBPM.js";
36
+ } from "./chunk-XISRK3R5.js";
37
37
  import {
38
38
  isLazyView,
39
39
  isViewClass,
@@ -12,7 +12,7 @@ var require = _vlt_createRequire(import.meta.filename);
12
12
  import {
13
13
  commandAliases,
14
14
  jack
15
- } from "./chunk-WP6CYBPM.js";
15
+ } from "./chunk-XISRK3R5.js";
16
16
 
17
17
  // ../../src/cli-sdk/src/config/usage.ts
18
18
  var toArr = (v) => Array.isArray(v) ? v : [v];
@@ -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-ARXB4NH5.js");
22
+ const vlt = await import("./src-SXMLUOLI.js");
23
23
  await vlt.default();
24
24
  };
25
25
 
@@ -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
  PackageInfoClient
14
- } from "./chunk-YZPRRP7W.js";
14
+ } from "./chunk-A4EKZ32F.js";
15
15
  import {
16
16
  findCmdShimIfExists,
17
17
  install