@vltpkg/cli-js 1.3.2 → 1.3.4

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 (76) hide show
  1. package/{access-M5BOAKLX.js → access-AY2CIGVN.js} +4 -4
  2. package/{bugs-QZ5NURDC.js → bugs-6PTC6V7S.js} +12 -12
  3. package/{build-CEAMZG7H.js → build-R6OJNJDU.js} +6 -6
  4. package/{cache-ILCET6EY.js → cache-NVLCCVWQ.js} +6 -6
  5. package/{chunk-NAVFU65Z.js → chunk-4XTUCYBW.js} +1 -1
  6. package/{chunk-MC6CESRA.js → chunk-AFUXQ3P4.js} +1 -1
  7. package/{chunk-4FHGRT4J.js → chunk-B5AKQ5TS.js} +3 -3
  8. package/{chunk-CU752KW7.js → chunk-BCANUHR3.js} +1 -1
  9. package/{chunk-EJFGJ543.js → chunk-BFR3XHEM.js} +3 -3
  10. package/{chunk-HBB2ECAT.js → chunk-CYN4ADWK.js} +2 -2
  11. package/{chunk-USLE2NXK.js → chunk-D4KNFORN.js} +1 -1
  12. package/{chunk-4QYSZZZQ.js → chunk-DK6HGJCF.js} +4 -4
  13. package/chunk-DM2XRLCS.js +75 -0
  14. package/{chunk-O63K3ZP6.js → chunk-GCLZEI3R.js} +173 -50
  15. package/{chunk-BUKZHMMK.js → chunk-INEKXXUQ.js} +1 -0
  16. package/{chunk-I6QGYSB4.js → chunk-LHIDMYN2.js} +1 -1
  17. package/{chunk-4WQ76RJD.js → chunk-MVD5AUNS.js} +1 -1
  18. package/{chunk-E53Z7AF6.js → chunk-MWAWPY3P.js} +3 -3
  19. package/chunk-OFHNSAQ5.js +2155 -0
  20. package/{chunk-2UW4UIVL.js → chunk-QEWKCTQY.js} +4 -4
  21. package/{chunk-IIXKXSLE.js → chunk-QGFDMXDH.js} +313 -171
  22. package/{chunk-QX6KMBTX.js → chunk-QZIC3WVP.js} +3 -3
  23. package/{chunk-ZWKI5OSF.js → chunk-SRWDPPLX.js} +0 -1377
  24. package/{chunk-ZMRJRQDK.js → chunk-TL5SYXSC.js} +292 -45
  25. package/{chunk-CSZTT7QN.js → chunk-TOKUDCSW.js} +2 -2
  26. package/{chunk-3NWCWTIU.js → chunk-WXRS5PRL.js} +1 -1
  27. package/{chunk-ENSGPOLR.js → chunk-XU5WNX4S.js} +3 -1
  28. package/{ci-4AI6XHRE.js → ci-FEZ6B33S.js} +7 -7
  29. package/cli-package.json +1 -1
  30. package/{config-PJVA5HZQ.js → config-EV5S74AA.js} +5 -5
  31. package/{config-UHPA5FHX.js → config-VVPVV36W.js} +6 -6
  32. package/{create-NQNFYWOC.js → create-VGCARZLU.js} +13 -13
  33. package/{deprecate-35D4AZFD.js → deprecate-3E27QREJ.js} +7 -7
  34. package/{dist-tag-W3AJECYB.js → dist-tag-ZIDIGEIM.js} +4 -4
  35. package/{docs-OFRPTPOG.js → docs-GESU73FF.js} +12 -12
  36. package/{exec-UTWGYF3B.js → exec-3SE4PRXY.js} +13 -13
  37. package/{exec-cache-VLPJMK7E.js → exec-cache-7QOIKCYP.js} +11 -11
  38. package/{exec-local-JKBHBKJZ.js → exec-local-EVAI6IYM.js} +10 -10
  39. package/{help-YRQQVODA.js → help-H54DUW2F.js} +4 -4
  40. package/{init-2QZ5TITF.js → init-JOAMKEKV.js} +7 -7
  41. package/{install-QBVAEHTO.js → install-WHOVSLKH.js} +12 -12
  42. package/{list-P4UQWDX7.js → list-7X2RIDA4.js} +12 -12
  43. package/{login-6KPWMFG4.js → login-P5NRTQDS.js} +8 -8
  44. package/{logout-KCYMUY6H.js → logout-5PCTGCJZ.js} +4 -4
  45. package/{pack-WQLFLOE2.js → pack-MLOVKXJZ.js} +9 -9
  46. package/package.json +1 -1
  47. package/{ping-GYFPW4F5.js → ping-6D6EEICV.js} +4 -4
  48. package/{pkg-KVQ6QMQH.js → pkg-HC6N3DDH.js} +8 -8
  49. package/{profile-APD6X27T.js → profile-C3MNVMAE.js} +4 -4
  50. package/{publish-EYKECRD3.js → publish-3KUMQXKT.js} +12 -12
  51. package/{query-3N5D2ZZW.js → query-HNBW2ZGX.js} +12 -12
  52. package/{registry-MXAA4HVJ.js → registry-PY2L5ZWC.js} +2 -2
  53. package/registry-client-src-revalidate.js +173 -50
  54. package/{repo-6B5W7Q2C.js → repo-VWEPCUXK.js} +12 -12
  55. package/{reporter-ZEDO2YIG.js → reporter-UUDMEN4E.js} +6 -6
  56. package/{run-INZMUBF2.js → run-OFW4MPAV.js} +10 -10
  57. package/{run-exec-RVYS73II.js → run-exec-ACGX23HX.js} +10 -10
  58. package/security-archive-src-update-expired.js +1 -1
  59. package/{setup-Q7JD6XJV.js → setup-5C56O3S3.js} +10 -10
  60. package/{src-EJSVFFXB.js → src-3MEJQYBG.js} +21 -7
  61. package/{src-3UQFZRM3.js → src-LH2HZ6FT.js} +2 -2
  62. package/{src-527GIT4Y.js → src-SI5YMOJI.js} +9 -9
  63. package/{token-5HFD3COV.js → token-RPQP6BV5.js} +4 -4
  64. package/{uninstall-4R7Z2FD7.js → uninstall-HDUNLNAD.js} +8 -8
  65. package/{unpublish-RBRQE53F.js → unpublish-SB647KPY.js} +4 -4
  66. package/{update-7LXJAEJN.js → update-PAIZPQPH.js} +11 -11
  67. package/{version-UHRS2KJX.js → version-5O2P2ROI.js} +7 -7
  68. package/{view-BNQKJF5L.js → view-3YVL4M7Z.js} +7 -7
  69. package/vlr.js +1 -1
  70. package/vlrx.js +1 -1
  71. package/vlt.js +1 -1
  72. package/vlx.js +1 -1
  73. package/vlxl.js +1 -1
  74. package/{whoami-GYAT6NWM.js → whoami-KFXNKZOX.js} +4 -4
  75. package/chunk-KH3ERNCA.js +0 -783
  76. package/chunk-TGOC27YZ.js +0 -75
@@ -14,17 +14,17 @@ import {
14
14
  } from "./chunk-J4NHRZX6.js";
15
15
  import {
16
16
  commandUsage
17
- } from "./chunk-I6QGYSB4.js";
17
+ } from "./chunk-LHIDMYN2.js";
18
18
  import "./chunk-64VFL4WI.js";
19
- import "./chunk-ENSGPOLR.js";
19
+ import "./chunk-XU5WNX4S.js";
20
20
  import {
21
21
  RegistryClient
22
- } from "./chunk-O63K3ZP6.js";
22
+ } from "./chunk-GCLZEI3R.js";
23
23
  import "./chunk-APMYKJI2.js";
24
24
  import {
25
25
  assertOk
26
26
  } from "./chunk-PBBULTAG.js";
27
- import "./chunk-3NWCWTIU.js";
27
+ import "./chunk-WXRS5PRL.js";
28
28
  import "./chunk-U7TEQCBN.js";
29
29
  import "./chunk-XNLSTHDK.js";
30
30
  import "./chunk-PDWPFR5T.js";
@@ -11,20 +11,20 @@ import {createRequire as _vlt_createRequire} from "node:module";
11
11
  var require = _vlt_createRequire(import.meta.filename);
12
12
  import {
13
13
  packTarball
14
- } from "./chunk-KH3ERNCA.js";
14
+ } from "./chunk-OFHNSAQ5.js";
15
15
  import {
16
16
  createHostContextsMap
17
- } from "./chunk-EJFGJ543.js";
17
+ } from "./chunk-BFR3XHEM.js";
18
18
  import {
19
19
  prettyBytes
20
20
  } from "./chunk-XA47WS4N.js";
21
21
  import {
22
22
  stderr
23
- } from "./chunk-CSZTT7QN.js";
24
- import "./chunk-CU752KW7.js";
23
+ } from "./chunk-TOKUDCSW.js";
24
+ import "./chunk-BCANUHR3.js";
25
25
  import "./chunk-G2YT2GWF.js";
26
26
  import "./chunk-CRGWLUGC.js";
27
- import "./chunk-ZWKI5OSF.js";
27
+ import "./chunk-SRWDPPLX.js";
28
28
  import "./chunk-WGDTG44V.js";
29
29
  import {
30
30
  resolveRegistry
@@ -33,30 +33,30 @@ import {
33
33
  Query,
34
34
  actual,
35
35
  run
36
- } from "./chunk-IIXKXSLE.js";
37
- import "./chunk-4WQ76RJD.js";
36
+ } from "./chunk-QGFDMXDH.js";
37
+ import "./chunk-MVD5AUNS.js";
38
38
  import {
39
39
  commandUsage
40
- } from "./chunk-I6QGYSB4.js";
40
+ } from "./chunk-LHIDMYN2.js";
41
41
  import {
42
42
  minimatch
43
- } from "./chunk-BUKZHMMK.js";
43
+ } from "./chunk-INEKXXUQ.js";
44
44
  import "./chunk-4KCU2KZL.js";
45
45
  import "./chunk-JIQBZ2UT.js";
46
46
  import "./chunk-64VFL4WI.js";
47
- import "./chunk-ENSGPOLR.js";
47
+ import "./chunk-XU5WNX4S.js";
48
48
  import "./chunk-HTOTG4TS.js";
49
49
  import {
50
50
  RegistryClient,
51
51
  oidc,
52
52
  registryBase
53
- } from "./chunk-O63K3ZP6.js";
53
+ } from "./chunk-GCLZEI3R.js";
54
54
  import "./chunk-APMYKJI2.js";
55
55
  import {
56
56
  assertOk,
57
57
  requestError
58
58
  } from "./chunk-PBBULTAG.js";
59
- import "./chunk-3NWCWTIU.js";
59
+ import "./chunk-WXRS5PRL.js";
60
60
  import "./chunk-U7TEQCBN.js";
61
61
  import "./chunk-XNLSTHDK.js";
62
62
  import "./chunk-PDWPFR5T.js";
@@ -12,19 +12,19 @@ var require = _vlt_createRequire(import.meta.filename);
12
12
  import {
13
13
  MermaidImageView,
14
14
  createGetAuthHeader
15
- } from "./chunk-4QYSZZZQ.js";
15
+ } from "./chunk-DK6HGJCF.js";
16
16
  import {
17
17
  createDiffFilesProvider
18
18
  } from "./chunk-RIYFGX27.js";
19
- import "./chunk-MC6CESRA.js";
19
+ import "./chunk-AFUXQ3P4.js";
20
20
  import {
21
21
  assertVltInstalled,
22
22
  createHostContextsMap
23
- } from "./chunk-EJFGJ543.js";
23
+ } from "./chunk-BFR3XHEM.js";
24
24
  import {
25
25
  stdout
26
- } from "./chunk-CSZTT7QN.js";
27
- import "./chunk-CU752KW7.js";
26
+ } from "./chunk-TOKUDCSW.js";
27
+ import "./chunk-BCANUHR3.js";
28
28
  import "./chunk-G2YT2GWF.js";
29
29
  import "./chunk-CRGWLUGC.js";
30
30
  import "./chunk-WGDTG44V.js";
@@ -37,23 +37,23 @@ import {
37
37
  humanReadableOutput,
38
38
  jsonOutput,
39
39
  mermaidOutput
40
- } from "./chunk-IIXKXSLE.js";
40
+ } from "./chunk-QGFDMXDH.js";
41
41
  import {
42
42
  SecurityArchive
43
- } from "./chunk-4WQ76RJD.js";
43
+ } from "./chunk-MVD5AUNS.js";
44
44
  import {
45
45
  commandUsage
46
- } from "./chunk-I6QGYSB4.js";
47
- import "./chunk-BUKZHMMK.js";
46
+ } from "./chunk-LHIDMYN2.js";
47
+ import "./chunk-INEKXXUQ.js";
48
48
  import "./chunk-4KCU2KZL.js";
49
49
  import "./chunk-JIQBZ2UT.js";
50
50
  import "./chunk-64VFL4WI.js";
51
- import "./chunk-ENSGPOLR.js";
51
+ import "./chunk-XU5WNX4S.js";
52
52
  import "./chunk-HTOTG4TS.js";
53
- import "./chunk-O63K3ZP6.js";
53
+ import "./chunk-GCLZEI3R.js";
54
54
  import "./chunk-APMYKJI2.js";
55
55
  import "./chunk-PBBULTAG.js";
56
- import "./chunk-3NWCWTIU.js";
56
+ import "./chunk-WXRS5PRL.js";
57
57
  import "./chunk-U7TEQCBN.js";
58
58
  import "./chunk-XNLSTHDK.js";
59
59
  import "./chunk-PDWPFR5T.js";
@@ -14,11 +14,11 @@ import {
14
14
  } from "./chunk-J4NHRZX6.js";
15
15
  import {
16
16
  commandUsage
17
- } from "./chunk-I6QGYSB4.js";
17
+ } from "./chunk-LHIDMYN2.js";
18
18
  import "./chunk-64VFL4WI.js";
19
19
  import {
20
20
  getCommand
21
- } from "./chunk-ENSGPOLR.js";
21
+ } from "./chunk-XU5WNX4S.js";
22
22
  import "./chunk-XNLSTHDK.js";
23
23
  import "./chunk-BP3PQ67D.js";
24
24
  import {
@@ -7852,7 +7852,7 @@ var require_client_h2 = __commonJS({
7852
7852
  "../../node_modules/.vlt/~npm~undici@7.29.0/node_modules/undici/lib/dispatcher/client-h2.js"(exports, module3) {
7853
7853
  "use strict";
7854
7854
  var assert = __require("node:assert");
7855
- var { pipeline } = __require("node:stream");
7855
+ var { pipeline: pipeline2 } = __require("node:stream");
7856
7856
  var util = require_util();
7857
7857
  var {
7858
7858
  RequestContentLengthMismatchError,
@@ -8485,7 +8485,7 @@ var require_client_h2 = __commonJS({
8485
8485
  }
8486
8486
  function writeStream(abort, socket, expectsPayload, h2stream, body, client, request2, contentLength) {
8487
8487
  assert(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined");
8488
- const pipe = pipeline(
8488
+ const pipe = pipeline2(
8489
8489
  body,
8490
8490
  h2stream,
8491
8491
  (err) => {
@@ -12312,7 +12312,7 @@ var require_api_pipeline = __commonJS({
12312
12312
  util.destroy(ret, err);
12313
12313
  }
12314
12314
  };
12315
- function pipeline(opts, handler) {
12315
+ function pipeline2(opts, handler) {
12316
12316
  try {
12317
12317
  const pipelineHandler = new PipelineHandler(opts, handler);
12318
12318
  this.dispatch({ ...opts, body: pipelineHandler.req }, pipelineHandler);
@@ -12321,7 +12321,7 @@ var require_api_pipeline = __commonJS({
12321
12321
  return new PassThrough().destroy(err);
12322
12322
  }
12323
12323
  }
12324
- module3.exports = pipeline;
12324
+ module3.exports = pipeline2;
12325
12325
  }
12326
12326
  });
12327
12327
 
@@ -17553,13 +17553,13 @@ var require_cache2 = __commonJS({
17553
17553
  var require_decompress = __commonJS({
17554
17554
  "../../node_modules/.vlt/~npm~undici@7.29.0/node_modules/undici/lib/interceptor/decompress.js"(exports, module3) {
17555
17555
  "use strict";
17556
- var { createInflate, createGunzip, createBrotliDecompress, createZstdDecompress } = __require("node:zlib");
17557
- var { pipeline } = __require("node:stream");
17556
+ var { createInflate, createGunzip: createGunzip2, createBrotliDecompress, createZstdDecompress } = __require("node:zlib");
17557
+ var { pipeline: pipeline2 } = __require("node:stream");
17558
17558
  var DecoratorHandler = require_decorator_handler();
17559
17559
  var { runtimeFeatures } = require_runtime_features();
17560
17560
  var supportedEncodings = {
17561
- gzip: createGunzip,
17562
- "x-gzip": createGunzip,
17561
+ gzip: createGunzip2,
17562
+ "x-gzip": createGunzip2,
17563
17563
  br: createBrotliDecompress,
17564
17564
  deflate: createInflate,
17565
17565
  compress: createInflate,
@@ -17663,7 +17663,7 @@ var require_decompress = __commonJS({
17663
17663
  #setupMultipleDecompressors(controller) {
17664
17664
  const lastDecompressor = this.#decompressors[this.#decompressors.length - 1];
17665
17665
  this.#setupDecompressorEvents(lastDecompressor, controller);
17666
- pipeline(this.#decompressors, (err) => {
17666
+ pipeline2(this.#decompressors, (err) => {
17667
17667
  if (err) {
17668
17668
  super.onResponseError(controller, err);
17669
17669
  return;
@@ -20408,7 +20408,7 @@ var require_fetch = __commonJS({
20408
20408
  subresourceSet
20409
20409
  } = require_constants3();
20410
20410
  var EE = __require("node:events");
20411
- var { Readable, pipeline, finished, isErrored, isReadable } = __require("node:stream");
20411
+ var { Readable, pipeline: pipeline2, finished, isErrored, isReadable } = __require("node:stream");
20412
20412
  var { addAbortListener, bufferToLowerCasedHeaderName } = require_util();
20413
20413
  var { dataURLProcessor, serializeAMimeType, minimizeSupportedMimeType } = require_data_url();
20414
20414
  var { getGlobalDispatcher } = require_global2();
@@ -21399,7 +21399,7 @@ var require_fetch = __commonJS({
21399
21399
  status,
21400
21400
  statusText: statusText2,
21401
21401
  headersList,
21402
- body: decoders.length ? pipeline(this.body, ...decoders, (err) => {
21402
+ body: decoders.length ? pipeline2(this.body, ...decoders, (err) => {
21403
21403
  if (err) {
21404
21404
  this.onError(err);
21405
21405
  }
@@ -25100,7 +25100,7 @@ ${value}`;
25100
25100
  var require_eventsource = __commonJS({
25101
25101
  "../../node_modules/.vlt/~npm~undici@7.29.0/node_modules/undici/lib/web/eventsource/eventsource.js"(exports, module3) {
25102
25102
  "use strict";
25103
- var { pipeline } = __require("node:stream");
25103
+ var { pipeline: pipeline2 } = __require("node:stream");
25104
25104
  var { fetching } = require_fetch();
25105
25105
  var { makeRequest } = require_request2();
25106
25106
  var { webidl } = require_webidl();
@@ -25258,7 +25258,7 @@ var require_eventsource = __commonJS({
25258
25258
  ));
25259
25259
  }
25260
25260
  });
25261
- pipeline(
25261
+ pipeline2(
25262
25262
  response.body.stream,
25263
25263
  eventSourceStream,
25264
25264
  (error2) => {
@@ -32460,13 +32460,15 @@ import { randomUUID } from "node:crypto";
32460
32460
  import { closeSync, openSync, readFileSync as readFileSync2, readSync } from "node:fs";
32461
32461
  import { availableParallelism } from "node:os";
32462
32462
  import { dirname as dirname3, resolve as resolve10 } from "node:path";
32463
+ import { pipeline } from "node:stream";
32463
32464
  import { setTimeout as setTimeout3 } from "node:timers/promises";
32465
+ import { createGunzip } from "node:zlib";
32464
32466
 
32465
32467
  // ../../src/user-agent/package.json
32466
32468
  var package_default = {
32467
32469
  name: "@vltpkg/user-agent",
32468
32470
  description: "The User-Agent string that vlt sends with every outbound request",
32469
- version: "1.3.2",
32471
+ version: "1.3.4",
32470
32472
  repository: {
32471
32473
  type: "git",
32472
32474
  url: "git+https://github.com/vltpkg/vltpkg.git",
@@ -33021,7 +33023,9 @@ var CacheEntry = class _CacheEntry {
33021
33023
  * Note that this will *usually* not be true if the value is coming out of
33022
33024
  * the cache, because cache entries not exploded into the global store are
33023
33025
  * un-gzipped in place. It should _only_ be called for artifacts that come
33024
- * from an actual http response.
33026
+ * from an actual http response, whatever its encoding: an identity body
33027
+ * is hashed as it came, a gzipped one before anything un-gzips it in
33028
+ * memory.
33025
33029
  *
33026
33030
  * Returns true if anything was actually verified.
33027
33031
  */
@@ -33061,11 +33065,26 @@ var CacheEntry = class _CacheEntry {
33061
33065
  }
33062
33066
  return computed;
33063
33067
  }
33068
+ #hash(body = this._body) {
33069
+ const hash2 = createHash2("sha512");
33070
+ hash2.update(body);
33071
+ return `sha512-${hash2.digest("base64")}`;
33072
+ }
33073
+ /**
33074
+ * The hash of the body un-gzipped, or of the body itself if it is not
33075
+ * gzipped, without un-gzipping the entry. Bounded like {@link unzip},
33076
+ * and throws like it on a body that will not un-gzip.
33077
+ *
33078
+ * Never the hash to record for an artifact, which is the hash of its
33079
+ * bytes as served. It pins the same content, though, and is what a
33080
+ * body hashed after something un-gzipped it was pinned with.
33081
+ */
33082
+ unzippedIntegrity() {
33083
+ return this.#hash(this.isGzip ? this.#gunzip() : this._body);
33084
+ }
33064
33085
  get integrityActual() {
33065
33086
  if (this.#integrityActual) return this.#integrityActual;
33066
- const hash2 = createHash2("sha512");
33067
- hash2.update(this._body);
33068
- const i2 = `sha512-${hash2.digest("base64")}`;
33087
+ const i2 = this.#hash();
33069
33088
  this.integrityActual = i2;
33070
33089
  return i2;
33071
33090
  }
@@ -33112,6 +33131,12 @@ var CacheEntry = class _CacheEntry {
33112
33131
  */
33113
33132
  setHeader(h, value) {
33114
33133
  this.#headers = setRawHeader(this.#headers, h, value);
33134
+ if (h.toLowerCase() === "date") {
33135
+ this.#date = void 0;
33136
+ this.#valid = void 0;
33137
+ this.#validUntil = void 0;
33138
+ this.#staleUntil = void 0;
33139
+ }
33115
33140
  }
33116
33141
  /**
33117
33142
  * Remove a header, if present
@@ -33147,13 +33172,40 @@ var CacheEntry = class _CacheEntry {
33147
33172
  const ct2 = this.getHeaderString("content-type");
33148
33173
  if (ct2) return this.#isJSON = /\bjson\b/.test(ct2);
33149
33174
  if (!this._body.length) return false;
33175
+ const wire = !this.#fromCache && !this.#integrityActual && this.isGzip ? this.#hash() : void 0;
33150
33176
  this.unzip();
33151
33177
  const buf = this._body;
33152
33178
  if (!buf.length) return false;
33153
33179
  this.#isJSON = buf[0] === 123;
33154
33180
  if (this.#isJSON) this.setHeader("content-type", "text/json");
33181
+ else if (wire) this.integrityActual = wire;
33155
33182
  return this.#isJSON;
33156
33183
  }
33184
+ /**
33185
+ * Label a 200 network body that is not json and came with no
33186
+ * content-type `application/octet-stream`, the way the json sniff
33187
+ * labels json `text/json`.
33188
+ *
33189
+ * The label says the hash the entry is stored under is the hash of
33190
+ * its bytes as served, checked or recorded by
33191
+ * `RegistryClient.request()`. So it is applied only where that is
33192
+ * known, right before such an entry is stored, and never by the
33193
+ * sniff: an entry with no content-type read back from the cache is
33194
+ * not known to be one.
33195
+ *
33196
+ * A decoded entry, an error body, an empty body, json, and a body
33197
+ * served with a content-type are left as they are. Not an error body
33198
+ * or an empty one: a content-type that is not json makes an entry
33199
+ * immutable (see {@link valid}), which neither was when served with
33200
+ * none, and no artifact is empty. The length is checked after the
33201
+ * sniff, which un-gzips a body with no content-type.
33202
+ */
33203
+ labelArtifact() {
33204
+ if (this.#fromCache || this.#statusCode !== 200 || this.isJSON || this.getHeaderString("content-type") || !this.#bodyLength) {
33205
+ return;
33206
+ }
33207
+ this.setHeader("content-type", "application/octet-stream");
33208
+ }
33157
33209
  #isGzip;
33158
33210
  get isGzip() {
33159
33211
  if (this.#isGzip !== void 0) return this.#isGzip;
@@ -33170,6 +33222,24 @@ var CacheEntry = class _CacheEntry {
33170
33222
  }
33171
33223
  return this.#isGzip;
33172
33224
  }
33225
+ // the body un-gzipped, for a body known to be gzipped
33226
+ #gunzip() {
33227
+ if (this._body.length === 0)
33228
+ throw error("Invalid buffer, cant unzip");
33229
+ const max = Math.min(
33230
+ maxUnpackedBytes,
33231
+ this._body.length * MAX_DECOMPRESSION_RATIO
33232
+ );
33233
+ try {
33234
+ return gunzipSync(this._body, { maxOutputLength: max });
33235
+ } catch (er) {
33236
+ throw er.code === "ERR_BUFFER_TOO_LARGE" ? error("cache entry exceeds maximum unpacked size", {
33237
+ found: this._body.length,
33238
+ max,
33239
+ cause: er
33240
+ }) : er;
33241
+ }
33242
+ }
33173
33243
  /**
33174
33244
  * Un-gzip encode the body.
33175
33245
  * Returns true if it was previously gzip (so something was done), otherwise
@@ -33177,22 +33247,7 @@ var CacheEntry = class _CacheEntry {
33177
33247
  */
33178
33248
  unzip() {
33179
33249
  if (this.isGzip) {
33180
- if (this._body.length === 0)
33181
- throw error("Invalid buffer, cant unzip");
33182
- const max = Math.min(
33183
- maxUnpackedBytes,
33184
- this._body.length * MAX_DECOMPRESSION_RATIO
33185
- );
33186
- let b;
33187
- try {
33188
- b = gunzipSync(this._body, { maxOutputLength: max });
33189
- } catch (er) {
33190
- throw er.code === "ERR_BUFFER_TOO_LARGE" ? error("cache entry exceeds maximum unpacked size", {
33191
- found: this._body.length,
33192
- max,
33193
- cause: er
33194
- }) : er;
33195
- }
33250
+ const b = this.#gunzip();
33196
33251
  this.setHeader("content-encoding", "identity");
33197
33252
  const u8 = new Uint8Array(b.buffer, b.byteOffset, b.byteLength);
33198
33253
  this.#body = u8;
@@ -34202,6 +34257,65 @@ var RegistryClient = class {
34202
34257
  integrity
34203
34258
  );
34204
34259
  }
34260
+ /**
34261
+ * Make a request and hand back the response body as it arrives, instead of
34262
+ * buffering it into a {@link CacheEntry}. For a body a caller acts on line
34263
+ * by line — the NDJSON the batch endpoints stream — waiting for the last
34264
+ * byte is the difference between using the first record now and using it
34265
+ * once the server has finished computing the last one.
34266
+ *
34267
+ * The body is gunzipped here when the registry compressed it, so a caller
34268
+ * always reads what the server serialized. Nothing is cached and nothing is
34269
+ * retried: a caller that loses the stream falls back to the requests it was
34270
+ * avoiding.
34271
+ */
34272
+ async requestStream(url, options = {}) {
34273
+ const u2 = typeof url === "string" ? new URL(url) : url;
34274
+ const o = {
34275
+ ...options,
34276
+ method: options.method ?? "GET",
34277
+ path: u2.pathname.replace(/\/+$/, "") + u2.search,
34278
+ origin: u2.origin,
34279
+ headers: addHeader(
34280
+ addHeader(
34281
+ addHeader(
34282
+ options.headers,
34283
+ "accept-encoding",
34284
+ "gzip;q=1.0, identity;q=0.5"
34285
+ ),
34286
+ "user-agent",
34287
+ userAgent
34288
+ ),
34289
+ "npm-session",
34290
+ this.#session
34291
+ )
34292
+ };
34293
+ o.headers = addHeader(
34294
+ o.headers,
34295
+ "authorization",
34296
+ await getTokenByURL(String(u2), this.identity)
34297
+ );
34298
+ logRequest(url, "start", { method: o.method });
34299
+ const requestStart = Date.now();
34300
+ const response = await this.agent.request(
34301
+ o
34302
+ );
34303
+ logRequest(url, "complete", {
34304
+ method: o.method,
34305
+ statusCode: response.statusCode,
34306
+ durationMs: Date.now() - requestStart
34307
+ });
34308
+ const encoding = response.headers["content-encoding"];
34309
+ const gzipped = typeof encoding === "string" && /\bgzip\b/.test(encoding);
34310
+ let body = response.body;
34311
+ if (gzipped) {
34312
+ const gunzip = createGunzip();
34313
+ pipeline(response.body, gunzip, () => {
34314
+ });
34315
+ body = gunzip;
34316
+ }
34317
+ return { statusCode: response.statusCode, body };
34318
+ }
34205
34319
  async request(url, options = {}) {
34206
34320
  const u2 = typeof url === "string" ? new URL(url) : url;
34207
34321
  const {
@@ -34215,12 +34329,20 @@ var RegistryClient = class {
34215
34329
  } = options;
34216
34330
  const { trustIntegrity, verifyDigest } = options;
34217
34331
  const m2 = isCacheableMethod(method) ? method : void 0;
34218
- const { useCache = !!m2 } = options;
34332
+ const { useCache = !!m2, readCache = true } = options;
34219
34333
  signal?.throwIfAborted();
34220
34334
  const key = cacheKey(method, u2);
34221
- const buffer = useCache ? await this.cache.fetch(key, { context: { integrity } }) : void 0;
34335
+ const buffer = useCache && readCache ? await this.cache.fetch(key, { context: { integrity } }) : void 0;
34222
34336
  const entry = buffer ? this.#decodeCached(buffer) : void 0;
34223
- if (entry?.valid && !forceRevalidate) {
34337
+ if (entry?.valid && forceRevalidate !== true) {
34338
+ if (forceRevalidate === "background" && m2) {
34339
+ register2(
34340
+ dirname3(this.cache.path()),
34341
+ m2,
34342
+ url,
34343
+ getHeader(options.headers, "accept")
34344
+ );
34345
+ }
34224
34346
  logRequest(url, "cache", { method });
34225
34347
  return entry;
34226
34348
  }
@@ -34305,26 +34427,26 @@ var RegistryClient = class {
34305
34427
  durationMs: Date.now() - requestStart
34306
34428
  }
34307
34429
  );
34308
- if (!trustIntegrity && !result.fromCache) {
34309
- result.deleteHeader("integrity");
34310
- if (result.statusCode === 200) result.checkIntegrity({ url });
34430
+ if (!trustIntegrity && !result.fromCache && result.statusCode === 200) {
34431
+ result.checkIntegrity({ url });
34311
34432
  }
34312
34433
  if (verifyDigest && !integrity && !result.fromCache && result.statusCode === 200) {
34313
34434
  result.checkDigest(verifyDigest === "required", { url });
34314
34435
  }
34315
34436
  const clobbersCachedEntry = forceRevalidate && !!entry && result.statusCode !== 200;
34316
34437
  if (useCache && !clobbersCachedEntry) {
34317
- const integrity2 = result.integrity ?? (result.statusCode === 200 && !result.isJSON ? result.integrityActual : void 0);
34318
- const buffer2 = result.encode();
34319
- this.cache.set(
34320
- key,
34321
- Buffer.from(
34322
- buffer2.buffer,
34323
- buffer2.byteOffset,
34324
- buffer2.byteLength
34325
- ),
34326
- { integrity: integrity2 }
34438
+ const artifact = !result.fromCache && result.statusCode === 200 && !result.isJSON;
34439
+ const integrity2 = result.integrity ?? (artifact ? result.integrityActual : void 0);
34440
+ if (artifact) result.labelArtifact();
34441
+ const encoded = result.encode();
34442
+ const stored = Buffer.from(
34443
+ encoded.buffer,
34444
+ encoded.byteOffset,
34445
+ encoded.byteLength
34327
34446
  );
34447
+ this.cache.set(key, stored, { integrity: integrity2 });
34448
+ if (result === entry && entry.isJSON)
34449
+ this.#decoded.set(stored, entry);
34328
34450
  }
34329
34451
  return result;
34330
34452
  }
@@ -34357,6 +34479,7 @@ var RegistryClient = class {
34357
34479
  contentLength
34358
34480
  }
34359
34481
  );
34482
+ if (!trustIntegrity) result.deleteHeader("integrity");
34360
34483
  if (isRedirect(result)) {
34361
34484
  response.body.resume();
34362
34485
  const [nextURL, nextOptions] = redirect(options, result, url);
@@ -14,41 +14,41 @@ import {
14
14
  } from "./chunk-CLVRCGOZ.js";
15
15
  import {
16
16
  openUrl
17
- } from "./chunk-MC6CESRA.js";
17
+ } from "./chunk-AFUXQ3P4.js";
18
18
  import {
19
19
  createHostContextsMap
20
- } from "./chunk-EJFGJ543.js";
21
- import "./chunk-CSZTT7QN.js";
22
- import "./chunk-CU752KW7.js";
20
+ } from "./chunk-BFR3XHEM.js";
21
+ import "./chunk-TOKUDCSW.js";
22
+ import "./chunk-BCANUHR3.js";
23
23
  import "./chunk-G2YT2GWF.js";
24
24
  import "./chunk-CRGWLUGC.js";
25
25
  import {
26
26
  PackageInfoClient
27
- } from "./chunk-ZMRJRQDK.js";
28
- import "./chunk-ZWKI5OSF.js";
27
+ } from "./chunk-TL5SYXSC.js";
28
+ import "./chunk-SRWDPPLX.js";
29
29
  import "./chunk-WGDTG44V.js";
30
30
  import "./chunk-J4NHRZX6.js";
31
31
  import {
32
32
  Query,
33
33
  actual
34
- } from "./chunk-IIXKXSLE.js";
34
+ } from "./chunk-QGFDMXDH.js";
35
35
  import {
36
36
  SecurityArchive
37
- } from "./chunk-4WQ76RJD.js";
37
+ } from "./chunk-MVD5AUNS.js";
38
38
  import {
39
39
  commandUsage
40
- } from "./chunk-I6QGYSB4.js";
41
- import "./chunk-BUKZHMMK.js";
40
+ } from "./chunk-LHIDMYN2.js";
41
+ import "./chunk-INEKXXUQ.js";
42
42
  import "./chunk-4KCU2KZL.js";
43
43
  import "./chunk-JIQBZ2UT.js";
44
44
  import {
45
45
  Spec
46
46
  } from "./chunk-64VFL4WI.js";
47
- import "./chunk-ENSGPOLR.js";
47
+ import "./chunk-XU5WNX4S.js";
48
48
  import "./chunk-HTOTG4TS.js";
49
49
  import "./chunk-APMYKJI2.js";
50
50
  import "./chunk-PBBULTAG.js";
51
- import "./chunk-3NWCWTIU.js";
51
+ import "./chunk-WXRS5PRL.js";
52
52
  import "./chunk-U7TEQCBN.js";
53
53
  import "./chunk-XNLSTHDK.js";
54
54
  import "./chunk-PDWPFR5T.js";
@@ -11,24 +11,24 @@ import {createRequire as _vlt_createRequire} from "node:module";
11
11
  var require = _vlt_createRequire(import.meta.filename);
12
12
  import {
13
13
  persistedEntries
14
- } from "./chunk-HBB2ECAT.js";
14
+ } from "./chunk-CYN4ADWK.js";
15
15
  import {
16
16
  require_emoji_regex
17
17
  } from "./chunk-VTEFO2FT.js";
18
- import "./chunk-4FHGRT4J.js";
19
- import "./chunk-ZMRJRQDK.js";
20
- import "./chunk-ZWKI5OSF.js";
18
+ import "./chunk-B5AKQ5TS.js";
19
+ import "./chunk-TL5SYXSC.js";
20
+ import "./chunk-SRWDPPLX.js";
21
21
  import {
22
22
  source_default
23
23
  } from "./chunk-WGDTG44V.js";
24
24
  import "./chunk-J4NHRZX6.js";
25
- import "./chunk-BUKZHMMK.js";
25
+ import "./chunk-INEKXXUQ.js";
26
26
  import {
27
27
  ViewClass
28
28
  } from "./chunk-4KCU2KZL.js";
29
29
  import "./chunk-JIQBZ2UT.js";
30
30
  import "./chunk-64VFL4WI.js";
31
- import "./chunk-ENSGPOLR.js";
31
+ import "./chunk-XU5WNX4S.js";
32
32
  import "./chunk-HTOTG4TS.js";
33
33
  import "./chunk-PBBULTAG.js";
34
34
  import {
@@ -12,11 +12,11 @@ var require = _vlt_createRequire(import.meta.filename);
12
12
  import {
13
13
  ExecCommand,
14
14
  views
15
- } from "./chunk-2UW4UIVL.js";
15
+ } from "./chunk-QEWKCTQY.js";
16
16
  import "./chunk-RIYFGX27.js";
17
- import "./chunk-EJFGJ543.js";
18
- import "./chunk-CSZTT7QN.js";
19
- import "./chunk-CU752KW7.js";
17
+ import "./chunk-BFR3XHEM.js";
18
+ import "./chunk-TOKUDCSW.js";
19
+ import "./chunk-BCANUHR3.js";
20
20
  import "./chunk-G2YT2GWF.js";
21
21
  import "./chunk-CRGWLUGC.js";
22
22
  import "./chunk-VTEFO2FT.js";
@@ -25,18 +25,18 @@ import "./chunk-J4NHRZX6.js";
25
25
  import {
26
26
  run,
27
27
  runFG
28
- } from "./chunk-IIXKXSLE.js";
29
- import "./chunk-4WQ76RJD.js";
28
+ } from "./chunk-QGFDMXDH.js";
29
+ import "./chunk-MVD5AUNS.js";
30
30
  import {
31
31
  commandUsage
32
- } from "./chunk-I6QGYSB4.js";
33
- import "./chunk-BUKZHMMK.js";
32
+ } from "./chunk-LHIDMYN2.js";
33
+ import "./chunk-INEKXXUQ.js";
34
34
  import "./chunk-4KCU2KZL.js";
35
35
  import "./chunk-JIQBZ2UT.js";
36
36
  import "./chunk-64VFL4WI.js";
37
- import "./chunk-ENSGPOLR.js";
37
+ import "./chunk-XU5WNX4S.js";
38
38
  import "./chunk-HTOTG4TS.js";
39
- import "./chunk-3NWCWTIU.js";
39
+ import "./chunk-WXRS5PRL.js";
40
40
  import "./chunk-U7TEQCBN.js";
41
41
  import "./chunk-XNLSTHDK.js";
42
42
  import "./chunk-PDWPFR5T.js";