@vltpkg/cli-js 1.3.3 → 1.3.5

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-KMBBQIIT.js → access-X2ZZH2BV.js} +4 -4
  2. package/{bugs-CABZX76X.js → bugs-SF56YATZ.js} +12 -12
  3. package/{build-WNHKYA4E.js → build-RRJ645SV.js} +6 -6
  4. package/{cache-KKT4GIYD.js → cache-NETXHYQU.js} +6 -6
  5. package/{chunk-SH24EMXO.js → chunk-2B5STVCP.js} +150 -40
  6. package/{chunk-GZWJAGBL.js → chunk-35OBZITS.js} +3 -3
  7. package/{chunk-ROCFQPP2.js → chunk-75F2WCA5.js} +2 -2
  8. package/{chunk-MOL2DUEQ.js → chunk-7DHDJ5XY.js} +368 -51
  9. package/{chunk-YU2W5UPG.js → chunk-ADDCQBGR.js} +1 -1
  10. package/{chunk-MC6CESRA.js → chunk-AFUXQ3P4.js} +1 -1
  11. package/{chunk-LY5FNWRY.js → chunk-B2CTWVQM.js} +3 -3
  12. package/{chunk-CU752KW7.js → chunk-BCANUHR3.js} +1 -1
  13. package/{chunk-GA4LA6B2.js → chunk-EGWLQVDZ.js} +4 -4
  14. package/chunk-EWZQGHYC.js +75 -0
  15. package/{chunk-HCMAX6Q5.js → chunk-GO5X2SSV.js} +3 -3
  16. package/{chunk-TJBBYDUN.js → chunk-I2DZC2J3.js} +4 -4
  17. package/{chunk-BUKZHMMK.js → chunk-INEKXXUQ.js} +1 -0
  18. package/{chunk-QBXGMTDE.js → chunk-LHB4CVEH.js} +1 -1
  19. package/{chunk-I6QGYSB4.js → chunk-LHIDMYN2.js} +1 -1
  20. package/chunk-OFHNSAQ5.js +2155 -0
  21. package/{chunk-ZBJRZXSU.js → chunk-PBHCZOUY.js} +3 -3
  22. package/{chunk-3IDIPSH7.js → chunk-QJHTK7ML.js} +1 -1
  23. package/{chunk-ZWKI5OSF.js → chunk-SRWDPPLX.js} +0 -1377
  24. package/{chunk-CSZTT7QN.js → chunk-TOKUDCSW.js} +2 -2
  25. package/{chunk-ENSGPOLR.js → chunk-XU5WNX4S.js} +3 -1
  26. package/{chunk-DCFLXO2M.js → chunk-XUGOPOLF.js} +1 -1
  27. package/{chunk-ZRRNOLEG.js → chunk-ZZFFMXI2.js} +214 -105
  28. package/{ci-BGVGC5RF.js → ci-YX56QIMV.js} +7 -7
  29. package/cli-package.json +1 -1
  30. package/{config-AWX2VEKL.js → config-HO7N7FPS.js} +5 -5
  31. package/{config-FIKZ4VWG.js → config-SHRCBOCI.js} +6 -6
  32. package/{create-CHTG7KO3.js → create-LO6BUYPU.js} +13 -13
  33. package/{deprecate-W7KQ62HF.js → deprecate-CUMWWMAF.js} +7 -7
  34. package/{dist-tag-66CC6HT7.js → dist-tag-DJJDBPTJ.js} +4 -4
  35. package/{docs-HW4U5TGD.js → docs-KDCDJRO5.js} +12 -12
  36. package/{exec-BVVNAGFI.js → exec-KF4ANRPM.js} +13 -13
  37. package/{exec-cache-L3ONPM5C.js → exec-cache-GBLLYU5O.js} +11 -11
  38. package/{exec-local-NR3RYQDQ.js → exec-local-VCP4KR6K.js} +10 -10
  39. package/{help-5YL6SUAN.js → help-MV53HEUI.js} +4 -4
  40. package/{init-RI2WVCGL.js → init-N3BM2FKC.js} +7 -7
  41. package/{install-OWAI4EOW.js → install-DDYIRJWL.js} +12 -12
  42. package/{list-4ZFX7ANG.js → list-VTCG6GBS.js} +12 -12
  43. package/{login-6TL3EE6Q.js → login-MCX6LCP5.js} +8 -8
  44. package/{logout-VQWHVHBE.js → logout-FPNGIQDZ.js} +4 -4
  45. package/{pack-Q5IRRAMU.js → pack-KCVLNNVZ.js} +9 -9
  46. package/package.json +1 -1
  47. package/{ping-2WV3V7GB.js → ping-MXTB7GFE.js} +4 -4
  48. package/{pkg-RXB6BRS5.js → pkg-QDEHGO34.js} +8 -8
  49. package/{profile-GNGWS5H2.js → profile-GQUM6NRG.js} +4 -4
  50. package/{publish-PI74W4GH.js → publish-UEL4KXDZ.js} +12 -12
  51. package/{query-NESDWXGE.js → query-MJTEJIZW.js} +12 -12
  52. package/{registry-MXAA4HVJ.js → registry-PY2L5ZWC.js} +2 -2
  53. package/registry-client-src-revalidate.js +150 -40
  54. package/{repo-PPBN3SKP.js → repo-XDMXV744.js} +12 -12
  55. package/{reporter-XBHCUW7W.js → reporter-K3D4AJBF.js} +6 -6
  56. package/{run-7GTWIFMV.js → run-MKEP7YKW.js} +10 -10
  57. package/{run-exec-VLSH5SOB.js → run-exec-Q7JNLVVV.js} +10 -10
  58. package/security-archive-src-update-expired.js +1 -1
  59. package/{setup-6O7RFGU2.js → setup-DYQY6DIX.js} +10 -10
  60. package/{src-EJSVFFXB.js → src-3MEJQYBG.js} +21 -7
  61. package/{src-6E7KCC7J.js → src-BZJHOEYT.js} +9 -9
  62. package/{src-U4MCZFJT.js → src-ODLA6WPY.js} +2 -2
  63. package/{token-NZ4HODXE.js → token-RUBMQURU.js} +4 -4
  64. package/{uninstall-KBZ6PJBG.js → uninstall-3NJXWOKS.js} +8 -8
  65. package/{unpublish-JBWSIBRX.js → unpublish-3ETADFWK.js} +4 -4
  66. package/{update-X4EC6MPP.js → update-L6ETRX6Q.js} +11 -11
  67. package/{version-QEHPAFAE.js → version-RHWAFXPK.js} +7 -7
  68. package/{view-WGGZTYAT.js → view-ABHAULFH.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-RYNXOULV.js → whoami-YDR7Q4VT.js} +4 -4
  75. package/chunk-7JK53T6G.js +0 -75
  76. package/chunk-KH3ERNCA.js +0 -783
@@ -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-SH24EMXO.js";
22
+ } from "./chunk-2B5STVCP.js";
23
23
  import "./chunk-APMYKJI2.js";
24
24
  import {
25
25
  assertOk
26
26
  } from "./chunk-PBBULTAG.js";
27
- import "./chunk-YU2W5UPG.js";
27
+ import "./chunk-ADDCQBGR.js";
28
28
  import "./chunk-U7TEQCBN.js";
29
29
  import "./chunk-XNLSTHDK.js";
30
30
  import "./chunk-PDWPFR5T.js";
@@ -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-LY5FNWRY.js";
21
- import "./chunk-CSZTT7QN.js";
22
- import "./chunk-CU752KW7.js";
20
+ } from "./chunk-B2CTWVQM.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-MOL2DUEQ.js";
28
- import "./chunk-ZWKI5OSF.js";
27
+ } from "./chunk-7DHDJ5XY.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-ZRRNOLEG.js";
34
+ } from "./chunk-ZZFFMXI2.js";
35
35
  import {
36
36
  SecurityArchive
37
- } from "./chunk-DCFLXO2M.js";
37
+ } from "./chunk-XUGOPOLF.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-YU2W5UPG.js";
51
+ import "./chunk-ADDCQBGR.js";
52
52
  import "./chunk-U7TEQCBN.js";
53
53
  import "./chunk-XNLSTHDK.js";
54
54
  import "./chunk-PDWPFR5T.js";
@@ -11,17 +11,17 @@ import {createRequire as _vlt_createRequire} from "node:module";
11
11
  var require = _vlt_createRequire(import.meta.filename);
12
12
  import {
13
13
  build
14
- } from "./chunk-ZRRNOLEG.js";
15
- import "./chunk-DCFLXO2M.js";
14
+ } from "./chunk-ZZFFMXI2.js";
15
+ import "./chunk-XUGOPOLF.js";
16
16
  import {
17
17
  commandUsage
18
- } from "./chunk-I6QGYSB4.js";
19
- import "./chunk-BUKZHMMK.js";
18
+ } from "./chunk-LHIDMYN2.js";
19
+ import "./chunk-INEKXXUQ.js";
20
20
  import "./chunk-JIQBZ2UT.js";
21
21
  import "./chunk-64VFL4WI.js";
22
- import "./chunk-ENSGPOLR.js";
22
+ import "./chunk-XU5WNX4S.js";
23
23
  import "./chunk-HTOTG4TS.js";
24
- import "./chunk-YU2W5UPG.js";
24
+ import "./chunk-ADDCQBGR.js";
25
25
  import "./chunk-U7TEQCBN.js";
26
26
  import "./chunk-XNLSTHDK.js";
27
27
  import "./chunk-PDWPFR5T.js";
@@ -15,15 +15,15 @@ import {
15
15
  import {
16
16
  stderr,
17
17
  stdout
18
- } from "./chunk-CSZTT7QN.js";
19
- import "./chunk-CU752KW7.js";
18
+ } from "./chunk-TOKUDCSW.js";
19
+ import "./chunk-BCANUHR3.js";
20
20
  import "./chunk-G2YT2GWF.js";
21
21
  import "./chunk-CRGWLUGC.js";
22
22
  import "./chunk-WGDTG44V.js";
23
23
  import "./chunk-J4NHRZX6.js";
24
24
  import {
25
25
  commandUsage
26
- } from "./chunk-I6QGYSB4.js";
26
+ } from "./chunk-LHIDMYN2.js";
27
27
  import {
28
28
  ViewClass
29
29
  } from "./chunk-4KCU2KZL.js";
@@ -31,15 +31,15 @@ import "./chunk-JIQBZ2UT.js";
31
31
  import {
32
32
  Spec
33
33
  } from "./chunk-64VFL4WI.js";
34
- import "./chunk-ENSGPOLR.js";
34
+ import "./chunk-XU5WNX4S.js";
35
35
  import {
36
36
  CacheEntry
37
- } from "./chunk-SH24EMXO.js";
37
+ } from "./chunk-2B5STVCP.js";
38
38
  import "./chunk-APMYKJI2.js";
39
39
  import {
40
40
  assertOk
41
41
  } from "./chunk-PBBULTAG.js";
42
- import "./chunk-YU2W5UPG.js";
42
+ import "./chunk-ADDCQBGR.js";
43
43
  import "./chunk-U7TEQCBN.js";
44
44
  import "./chunk-XNLSTHDK.js";
45
45
  import {
@@ -21,7 +21,7 @@ import {
21
21
  } from "./chunk-PBBULTAG.js";
22
22
  import {
23
23
  userAgent
24
- } from "./chunk-YU2W5UPG.js";
24
+ } from "./chunk-ADDCQBGR.js";
25
25
  import {
26
26
  I,
27
27
  logRequest
@@ -7857,7 +7857,7 @@ var require_client_h2 = __commonJS({
7857
7857
  "../../node_modules/.vlt/~npm~undici@7.29.0/node_modules/undici/lib/dispatcher/client-h2.js"(exports, module3) {
7858
7858
  "use strict";
7859
7859
  var assert = __require("node:assert");
7860
- var { pipeline } = __require("node:stream");
7860
+ var { pipeline: pipeline2 } = __require("node:stream");
7861
7861
  var util = require_util();
7862
7862
  var {
7863
7863
  RequestContentLengthMismatchError,
@@ -8490,7 +8490,7 @@ var require_client_h2 = __commonJS({
8490
8490
  }
8491
8491
  function writeStream(abort, socket, expectsPayload, h2stream, body, client, request2, contentLength) {
8492
8492
  assert(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined");
8493
- const pipe = pipeline(
8493
+ const pipe = pipeline2(
8494
8494
  body,
8495
8495
  h2stream,
8496
8496
  (err) => {
@@ -12317,7 +12317,7 @@ var require_api_pipeline = __commonJS({
12317
12317
  util.destroy(ret, err);
12318
12318
  }
12319
12319
  };
12320
- function pipeline(opts, handler) {
12320
+ function pipeline2(opts, handler) {
12321
12321
  try {
12322
12322
  const pipelineHandler = new PipelineHandler(opts, handler);
12323
12323
  this.dispatch({ ...opts, body: pipelineHandler.req }, pipelineHandler);
@@ -12326,7 +12326,7 @@ var require_api_pipeline = __commonJS({
12326
12326
  return new PassThrough().destroy(err);
12327
12327
  }
12328
12328
  }
12329
- module3.exports = pipeline;
12329
+ module3.exports = pipeline2;
12330
12330
  }
12331
12331
  });
12332
12332
 
@@ -17558,13 +17558,13 @@ var require_cache2 = __commonJS({
17558
17558
  var require_decompress = __commonJS({
17559
17559
  "../../node_modules/.vlt/~npm~undici@7.29.0/node_modules/undici/lib/interceptor/decompress.js"(exports, module3) {
17560
17560
  "use strict";
17561
- var { createInflate, createGunzip, createBrotliDecompress, createZstdDecompress } = __require("node:zlib");
17562
- var { pipeline } = __require("node:stream");
17561
+ var { createInflate, createGunzip: createGunzip2, createBrotliDecompress, createZstdDecompress } = __require("node:zlib");
17562
+ var { pipeline: pipeline2 } = __require("node:stream");
17563
17563
  var DecoratorHandler = require_decorator_handler();
17564
17564
  var { runtimeFeatures } = require_runtime_features();
17565
17565
  var supportedEncodings = {
17566
- gzip: createGunzip,
17567
- "x-gzip": createGunzip,
17566
+ gzip: createGunzip2,
17567
+ "x-gzip": createGunzip2,
17568
17568
  br: createBrotliDecompress,
17569
17569
  deflate: createInflate,
17570
17570
  compress: createInflate,
@@ -17668,7 +17668,7 @@ var require_decompress = __commonJS({
17668
17668
  #setupMultipleDecompressors(controller) {
17669
17669
  const lastDecompressor = this.#decompressors[this.#decompressors.length - 1];
17670
17670
  this.#setupDecompressorEvents(lastDecompressor, controller);
17671
- pipeline(this.#decompressors, (err) => {
17671
+ pipeline2(this.#decompressors, (err) => {
17672
17672
  if (err) {
17673
17673
  super.onResponseError(controller, err);
17674
17674
  return;
@@ -20413,7 +20413,7 @@ var require_fetch = __commonJS({
20413
20413
  subresourceSet
20414
20414
  } = require_constants3();
20415
20415
  var EE = __require("node:events");
20416
- var { Readable, pipeline, finished, isErrored, isReadable } = __require("node:stream");
20416
+ var { Readable, pipeline: pipeline2, finished, isErrored, isReadable } = __require("node:stream");
20417
20417
  var { addAbortListener, bufferToLowerCasedHeaderName } = require_util();
20418
20418
  var { dataURLProcessor, serializeAMimeType, minimizeSupportedMimeType } = require_data_url();
20419
20419
  var { getGlobalDispatcher } = require_global2();
@@ -21404,7 +21404,7 @@ var require_fetch = __commonJS({
21404
21404
  status,
21405
21405
  statusText: statusText2,
21406
21406
  headersList,
21407
- body: decoders.length ? pipeline(this.body, ...decoders, (err) => {
21407
+ body: decoders.length ? pipeline2(this.body, ...decoders, (err) => {
21408
21408
  if (err) {
21409
21409
  this.onError(err);
21410
21410
  }
@@ -25105,7 +25105,7 @@ ${value}`;
25105
25105
  var require_eventsource = __commonJS({
25106
25106
  "../../node_modules/.vlt/~npm~undici@7.29.0/node_modules/undici/lib/web/eventsource/eventsource.js"(exports, module3) {
25107
25107
  "use strict";
25108
- var { pipeline } = __require("node:stream");
25108
+ var { pipeline: pipeline2 } = __require("node:stream");
25109
25109
  var { fetching } = require_fetch();
25110
25110
  var { makeRequest } = require_request2();
25111
25111
  var { webidl } = require_webidl();
@@ -25263,7 +25263,7 @@ var require_eventsource = __commonJS({
25263
25263
  ));
25264
25264
  }
25265
25265
  });
25266
- pipeline(
25266
+ pipeline2(
25267
25267
  response.body.stream,
25268
25268
  eventSourceStream,
25269
25269
  (error2) => {
@@ -26153,7 +26153,9 @@ import { randomUUID } from "node:crypto";
26153
26153
  import { closeSync, openSync, readFileSync as readFileSync2, readSync } from "node:fs";
26154
26154
  import { availableParallelism } from "node:os";
26155
26155
  import { dirname as dirname3, resolve as resolve4 } from "node:path";
26156
+ import { pipeline } from "node:stream";
26156
26157
  import { setTimeout as setTimeout2 } from "node:timers/promises";
26158
+ import { createGunzip } from "node:zlib";
26157
26159
 
26158
26160
  // ../../src/registry-client/src/is-iterable.ts
26159
26161
  var isIterable = (o) => !!o && typeof o === "object" && Symbol.iterator in o;
@@ -26648,7 +26650,9 @@ var CacheEntry = class _CacheEntry {
26648
26650
  * Note that this will *usually* not be true if the value is coming out of
26649
26651
  * the cache, because cache entries not exploded into the global store are
26650
26652
  * un-gzipped in place. It should _only_ be called for artifacts that come
26651
- * from an actual http response.
26653
+ * from an actual http response, whatever its encoding: an identity body
26654
+ * is hashed as it came, a gzipped one before anything un-gzips it in
26655
+ * memory.
26652
26656
  *
26653
26657
  * Returns true if anything was actually verified.
26654
26658
  */
@@ -26688,11 +26692,26 @@ var CacheEntry = class _CacheEntry {
26688
26692
  }
26689
26693
  return computed;
26690
26694
  }
26695
+ #hash(body = this._body) {
26696
+ const hash2 = createHash2("sha512");
26697
+ hash2.update(body);
26698
+ return `sha512-${hash2.digest("base64")}`;
26699
+ }
26700
+ /**
26701
+ * The hash of the body un-gzipped, or of the body itself if it is not
26702
+ * gzipped, without un-gzipping the entry. Bounded like {@link unzip},
26703
+ * and throws like it on a body that will not un-gzip.
26704
+ *
26705
+ * Never the hash to record for an artifact, which is the hash of its
26706
+ * bytes as served. It pins the same content, though, and is what a
26707
+ * body hashed after something un-gzipped it was pinned with.
26708
+ */
26709
+ unzippedIntegrity() {
26710
+ return this.#hash(this.isGzip ? this.#gunzip() : this._body);
26711
+ }
26691
26712
  get integrityActual() {
26692
26713
  if (this.#integrityActual) return this.#integrityActual;
26693
- const hash2 = createHash2("sha512");
26694
- hash2.update(this._body);
26695
- const i = `sha512-${hash2.digest("base64")}`;
26714
+ const i = this.#hash();
26696
26715
  this.integrityActual = i;
26697
26716
  return i;
26698
26717
  }
@@ -26780,13 +26799,40 @@ var CacheEntry = class _CacheEntry {
26780
26799
  const ct = this.getHeaderString("content-type");
26781
26800
  if (ct) return this.#isJSON = /\bjson\b/.test(ct);
26782
26801
  if (!this._body.length) return false;
26802
+ const wire = !this.#fromCache && !this.#integrityActual && this.isGzip ? this.#hash() : void 0;
26783
26803
  this.unzip();
26784
26804
  const buf = this._body;
26785
26805
  if (!buf.length) return false;
26786
26806
  this.#isJSON = buf[0] === 123;
26787
26807
  if (this.#isJSON) this.setHeader("content-type", "text/json");
26808
+ else if (wire) this.integrityActual = wire;
26788
26809
  return this.#isJSON;
26789
26810
  }
26811
+ /**
26812
+ * Label a 200 network body that is not json and came with no
26813
+ * content-type `application/octet-stream`, the way the json sniff
26814
+ * labels json `text/json`.
26815
+ *
26816
+ * The label says the hash the entry is stored under is the hash of
26817
+ * its bytes as served, checked or recorded by
26818
+ * `RegistryClient.request()`. So it is applied only where that is
26819
+ * known, right before such an entry is stored, and never by the
26820
+ * sniff: an entry with no content-type read back from the cache is
26821
+ * not known to be one.
26822
+ *
26823
+ * A decoded entry, an error body, an empty body, json, and a body
26824
+ * served with a content-type are left as they are. Not an error body
26825
+ * or an empty one: a content-type that is not json makes an entry
26826
+ * immutable (see {@link valid}), which neither was when served with
26827
+ * none, and no artifact is empty. The length is checked after the
26828
+ * sniff, which un-gzips a body with no content-type.
26829
+ */
26830
+ labelArtifact() {
26831
+ if (this.#fromCache || this.#statusCode !== 200 || this.isJSON || this.getHeaderString("content-type") || !this.#bodyLength) {
26832
+ return;
26833
+ }
26834
+ this.setHeader("content-type", "application/octet-stream");
26835
+ }
26790
26836
  #isGzip;
26791
26837
  get isGzip() {
26792
26838
  if (this.#isGzip !== void 0) return this.#isGzip;
@@ -26803,6 +26849,24 @@ var CacheEntry = class _CacheEntry {
26803
26849
  }
26804
26850
  return this.#isGzip;
26805
26851
  }
26852
+ // the body un-gzipped, for a body known to be gzipped
26853
+ #gunzip() {
26854
+ if (this._body.length === 0)
26855
+ throw error("Invalid buffer, cant unzip");
26856
+ const max = Math.min(
26857
+ maxUnpackedBytes,
26858
+ this._body.length * MAX_DECOMPRESSION_RATIO
26859
+ );
26860
+ try {
26861
+ return gunzipSync(this._body, { maxOutputLength: max });
26862
+ } catch (er) {
26863
+ throw er.code === "ERR_BUFFER_TOO_LARGE" ? error("cache entry exceeds maximum unpacked size", {
26864
+ found: this._body.length,
26865
+ max,
26866
+ cause: er
26867
+ }) : er;
26868
+ }
26869
+ }
26806
26870
  /**
26807
26871
  * Un-gzip encode the body.
26808
26872
  * Returns true if it was previously gzip (so something was done), otherwise
@@ -26810,22 +26874,7 @@ var CacheEntry = class _CacheEntry {
26810
26874
  */
26811
26875
  unzip() {
26812
26876
  if (this.isGzip) {
26813
- if (this._body.length === 0)
26814
- throw error("Invalid buffer, cant unzip");
26815
- const max = Math.min(
26816
- maxUnpackedBytes,
26817
- this._body.length * MAX_DECOMPRESSION_RATIO
26818
- );
26819
- let b;
26820
- try {
26821
- b = gunzipSync(this._body, { maxOutputLength: max });
26822
- } catch (er) {
26823
- throw er.code === "ERR_BUFFER_TOO_LARGE" ? error("cache entry exceeds maximum unpacked size", {
26824
- found: this._body.length,
26825
- max,
26826
- cause: er
26827
- }) : er;
26828
- }
26877
+ const b = this.#gunzip();
26829
26878
  this.setHeader("content-encoding", "identity");
26830
26879
  const u8 = new Uint8Array(b.buffer, b.byteOffset, b.byteLength);
26831
26880
  this.#body = u8;
@@ -27886,6 +27935,65 @@ var RegistryClient = class {
27886
27935
  integrity
27887
27936
  );
27888
27937
  }
27938
+ /**
27939
+ * Make a request and hand back the response body as it arrives, instead of
27940
+ * buffering it into a {@link CacheEntry}. For a body a caller acts on line
27941
+ * by line — the NDJSON the batch endpoints stream — waiting for the last
27942
+ * byte is the difference between using the first record now and using it
27943
+ * once the server has finished computing the last one.
27944
+ *
27945
+ * The body is gunzipped here when the registry compressed it, so a caller
27946
+ * always reads what the server serialized. Nothing is cached and nothing is
27947
+ * retried: a caller that loses the stream falls back to the requests it was
27948
+ * avoiding.
27949
+ */
27950
+ async requestStream(url, options = {}) {
27951
+ const u = typeof url === "string" ? new URL(url) : url;
27952
+ const o = {
27953
+ ...options,
27954
+ method: options.method ?? "GET",
27955
+ path: u.pathname.replace(/\/+$/, "") + u.search,
27956
+ origin: u.origin,
27957
+ headers: addHeader(
27958
+ addHeader(
27959
+ addHeader(
27960
+ options.headers,
27961
+ "accept-encoding",
27962
+ "gzip;q=1.0, identity;q=0.5"
27963
+ ),
27964
+ "user-agent",
27965
+ userAgent
27966
+ ),
27967
+ "npm-session",
27968
+ this.#session
27969
+ )
27970
+ };
27971
+ o.headers = addHeader(
27972
+ o.headers,
27973
+ "authorization",
27974
+ await getTokenByURL(String(u), this.identity)
27975
+ );
27976
+ logRequest(url, "start", { method: o.method });
27977
+ const requestStart = Date.now();
27978
+ const response = await this.agent.request(
27979
+ o
27980
+ );
27981
+ logRequest(url, "complete", {
27982
+ method: o.method,
27983
+ statusCode: response.statusCode,
27984
+ durationMs: Date.now() - requestStart
27985
+ });
27986
+ const encoding = response.headers["content-encoding"];
27987
+ const gzipped = typeof encoding === "string" && /\bgzip\b/.test(encoding);
27988
+ let body = response.body;
27989
+ if (gzipped) {
27990
+ const gunzip = createGunzip();
27991
+ pipeline(response.body, gunzip, () => {
27992
+ });
27993
+ body = gunzip;
27994
+ }
27995
+ return { statusCode: response.statusCode, body };
27996
+ }
27889
27997
  async request(url, options = {}) {
27890
27998
  const u = typeof url === "string" ? new URL(url) : url;
27891
27999
  const {
@@ -27899,10 +28007,10 @@ var RegistryClient = class {
27899
28007
  } = options;
27900
28008
  const { trustIntegrity, verifyDigest } = options;
27901
28009
  const m = isCacheableMethod(method) ? method : void 0;
27902
- const { useCache = !!m } = options;
28010
+ const { useCache = !!m, readCache = true } = options;
27903
28011
  signal?.throwIfAborted();
27904
28012
  const key = cacheKey(method, u);
27905
- const buffer = useCache ? await this.cache.fetch(key, { context: { integrity } }) : void 0;
28013
+ const buffer = useCache && readCache ? await this.cache.fetch(key, { context: { integrity } }) : void 0;
27906
28014
  const entry = buffer ? this.#decodeCached(buffer) : void 0;
27907
28015
  if (entry?.valid && forceRevalidate !== true) {
27908
28016
  if (forceRevalidate === "background" && m) {
@@ -27997,16 +28105,17 @@ var RegistryClient = class {
27997
28105
  durationMs: Date.now() - requestStart
27998
28106
  }
27999
28107
  );
28000
- if (!trustIntegrity && !result.fromCache) {
28001
- result.deleteHeader("integrity");
28002
- if (result.statusCode === 200) result.checkIntegrity({ url });
28108
+ if (!trustIntegrity && !result.fromCache && result.statusCode === 200) {
28109
+ result.checkIntegrity({ url });
28003
28110
  }
28004
28111
  if (verifyDigest && !integrity && !result.fromCache && result.statusCode === 200) {
28005
28112
  result.checkDigest(verifyDigest === "required", { url });
28006
28113
  }
28007
28114
  const clobbersCachedEntry = forceRevalidate && !!entry && result.statusCode !== 200;
28008
28115
  if (useCache && !clobbersCachedEntry) {
28009
- const integrity2 = result.integrity ?? (result.statusCode === 200 && !result.isJSON ? result.integrityActual : void 0);
28116
+ const artifact = !result.fromCache && result.statusCode === 200 && !result.isJSON;
28117
+ const integrity2 = result.integrity ?? (artifact ? result.integrityActual : void 0);
28118
+ if (artifact) result.labelArtifact();
28010
28119
  const encoded = result.encode();
28011
28120
  const stored = Buffer.from(
28012
28121
  encoded.buffer,
@@ -28048,6 +28157,7 @@ var RegistryClient = class {
28048
28157
  contentLength
28049
28158
  }
28050
28159
  );
28160
+ if (!trustIntegrity) result.deleteHeader("integrity");
28051
28161
  if (isRedirect(result)) {
28052
28162
  response.body.resume();
28053
28163
  const [nextURL, nextOptions] = redirect(options, result, url);
@@ -11,12 +11,12 @@ 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-MOL2DUEQ.js";
14
+ } from "./chunk-7DHDJ5XY.js";
15
15
  import {
16
16
  Monorepo,
17
17
  PackageJson,
18
18
  PathScurry
19
- } from "./chunk-BUKZHMMK.js";
19
+ } from "./chunk-INEKXXUQ.js";
20
20
  import {
21
21
  resetCaches
22
22
  } from "./chunk-JIQBZ2UT.js";
@@ -28,7 +28,7 @@ import {
28
28
  isRecordField,
29
29
  recordFields,
30
30
  storeLinkers
31
- } from "./chunk-ENSGPOLR.js";
31
+ } from "./chunk-XU5WNX4S.js";
32
32
  import {
33
33
  find,
34
34
  load,
@@ -15,14 +15,14 @@ import {
15
15
  pairsToRecords,
16
16
  registrySelectionFields,
17
17
  registrySelectors
18
- } from "./chunk-GZWJAGBL.js";
18
+ } from "./chunk-35OBZITS.js";
19
19
  import {
20
20
  normalizeRegistryURL
21
21
  } from "./chunk-J4NHRZX6.js";
22
22
  import {
23
23
  getCommand,
24
24
  isRecordField
25
- } from "./chunk-ENSGPOLR.js";
25
+ } from "./chunk-XU5WNX4S.js";
26
26
  import {
27
27
  find
28
28
  } from "./chunk-HTOTG4TS.js";