@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.
- package/{access-M5BOAKLX.js → access-AY2CIGVN.js} +4 -4
- package/{bugs-QZ5NURDC.js → bugs-6PTC6V7S.js} +12 -12
- package/{build-CEAMZG7H.js → build-R6OJNJDU.js} +6 -6
- package/{cache-ILCET6EY.js → cache-NVLCCVWQ.js} +6 -6
- package/{chunk-NAVFU65Z.js → chunk-4XTUCYBW.js} +1 -1
- package/{chunk-MC6CESRA.js → chunk-AFUXQ3P4.js} +1 -1
- package/{chunk-4FHGRT4J.js → chunk-B5AKQ5TS.js} +3 -3
- package/{chunk-CU752KW7.js → chunk-BCANUHR3.js} +1 -1
- package/{chunk-EJFGJ543.js → chunk-BFR3XHEM.js} +3 -3
- package/{chunk-HBB2ECAT.js → chunk-CYN4ADWK.js} +2 -2
- package/{chunk-USLE2NXK.js → chunk-D4KNFORN.js} +1 -1
- package/{chunk-4QYSZZZQ.js → chunk-DK6HGJCF.js} +4 -4
- package/chunk-DM2XRLCS.js +75 -0
- package/{chunk-O63K3ZP6.js → chunk-GCLZEI3R.js} +173 -50
- package/{chunk-BUKZHMMK.js → chunk-INEKXXUQ.js} +1 -0
- package/{chunk-I6QGYSB4.js → chunk-LHIDMYN2.js} +1 -1
- package/{chunk-4WQ76RJD.js → chunk-MVD5AUNS.js} +1 -1
- package/{chunk-E53Z7AF6.js → chunk-MWAWPY3P.js} +3 -3
- package/chunk-OFHNSAQ5.js +2155 -0
- package/{chunk-2UW4UIVL.js → chunk-QEWKCTQY.js} +4 -4
- package/{chunk-IIXKXSLE.js → chunk-QGFDMXDH.js} +313 -171
- package/{chunk-QX6KMBTX.js → chunk-QZIC3WVP.js} +3 -3
- package/{chunk-ZWKI5OSF.js → chunk-SRWDPPLX.js} +0 -1377
- package/{chunk-ZMRJRQDK.js → chunk-TL5SYXSC.js} +292 -45
- package/{chunk-CSZTT7QN.js → chunk-TOKUDCSW.js} +2 -2
- package/{chunk-3NWCWTIU.js → chunk-WXRS5PRL.js} +1 -1
- package/{chunk-ENSGPOLR.js → chunk-XU5WNX4S.js} +3 -1
- package/{ci-4AI6XHRE.js → ci-FEZ6B33S.js} +7 -7
- package/cli-package.json +1 -1
- package/{config-PJVA5HZQ.js → config-EV5S74AA.js} +5 -5
- package/{config-UHPA5FHX.js → config-VVPVV36W.js} +6 -6
- package/{create-NQNFYWOC.js → create-VGCARZLU.js} +13 -13
- package/{deprecate-35D4AZFD.js → deprecate-3E27QREJ.js} +7 -7
- package/{dist-tag-W3AJECYB.js → dist-tag-ZIDIGEIM.js} +4 -4
- package/{docs-OFRPTPOG.js → docs-GESU73FF.js} +12 -12
- package/{exec-UTWGYF3B.js → exec-3SE4PRXY.js} +13 -13
- package/{exec-cache-VLPJMK7E.js → exec-cache-7QOIKCYP.js} +11 -11
- package/{exec-local-JKBHBKJZ.js → exec-local-EVAI6IYM.js} +10 -10
- package/{help-YRQQVODA.js → help-H54DUW2F.js} +4 -4
- package/{init-2QZ5TITF.js → init-JOAMKEKV.js} +7 -7
- package/{install-QBVAEHTO.js → install-WHOVSLKH.js} +12 -12
- package/{list-P4UQWDX7.js → list-7X2RIDA4.js} +12 -12
- package/{login-6KPWMFG4.js → login-P5NRTQDS.js} +8 -8
- package/{logout-KCYMUY6H.js → logout-5PCTGCJZ.js} +4 -4
- package/{pack-WQLFLOE2.js → pack-MLOVKXJZ.js} +9 -9
- package/package.json +1 -1
- package/{ping-GYFPW4F5.js → ping-6D6EEICV.js} +4 -4
- package/{pkg-KVQ6QMQH.js → pkg-HC6N3DDH.js} +8 -8
- package/{profile-APD6X27T.js → profile-C3MNVMAE.js} +4 -4
- package/{publish-EYKECRD3.js → publish-3KUMQXKT.js} +12 -12
- package/{query-3N5D2ZZW.js → query-HNBW2ZGX.js} +12 -12
- package/{registry-MXAA4HVJ.js → registry-PY2L5ZWC.js} +2 -2
- package/registry-client-src-revalidate.js +173 -50
- package/{repo-6B5W7Q2C.js → repo-VWEPCUXK.js} +12 -12
- package/{reporter-ZEDO2YIG.js → reporter-UUDMEN4E.js} +6 -6
- package/{run-INZMUBF2.js → run-OFW4MPAV.js} +10 -10
- package/{run-exec-RVYS73II.js → run-exec-ACGX23HX.js} +10 -10
- package/security-archive-src-update-expired.js +1 -1
- package/{setup-Q7JD6XJV.js → setup-5C56O3S3.js} +10 -10
- package/{src-EJSVFFXB.js → src-3MEJQYBG.js} +21 -7
- package/{src-3UQFZRM3.js → src-LH2HZ6FT.js} +2 -2
- package/{src-527GIT4Y.js → src-SI5YMOJI.js} +9 -9
- package/{token-5HFD3COV.js → token-RPQP6BV5.js} +4 -4
- package/{uninstall-4R7Z2FD7.js → uninstall-HDUNLNAD.js} +8 -8
- package/{unpublish-RBRQE53F.js → unpublish-SB647KPY.js} +4 -4
- package/{update-7LXJAEJN.js → update-PAIZPQPH.js} +11 -11
- package/{version-UHRS2KJX.js → version-5O2P2ROI.js} +7 -7
- package/{view-BNQKJF5L.js → view-3YVL4M7Z.js} +7 -7
- package/vlr.js +1 -1
- package/vlrx.js +1 -1
- package/vlt.js +1 -1
- package/vlx.js +1 -1
- package/vlxl.js +1 -1
- package/{whoami-GYAT6NWM.js → whoami-KFXNKZOX.js} +4 -4
- package/chunk-KH3ERNCA.js +0 -783
- package/chunk-TGOC27YZ.js +0 -75
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
} from "./chunk-PBBULTAG.js";
|
|
22
22
|
import {
|
|
23
23
|
userAgent
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-WXRS5PRL.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 =
|
|
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
|
|
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 =
|
|
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:
|
|
17567
|
-
"x-gzip":
|
|
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
|
-
|
|
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 ?
|
|
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
|
-
|
|
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
|
|
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
|
}
|
|
@@ -26739,6 +26758,12 @@ var CacheEntry = class _CacheEntry {
|
|
|
26739
26758
|
*/
|
|
26740
26759
|
setHeader(h, value) {
|
|
26741
26760
|
this.#headers = setRawHeader(this.#headers, h, value);
|
|
26761
|
+
if (h.toLowerCase() === "date") {
|
|
26762
|
+
this.#date = void 0;
|
|
26763
|
+
this.#valid = void 0;
|
|
26764
|
+
this.#validUntil = void 0;
|
|
26765
|
+
this.#staleUntil = void 0;
|
|
26766
|
+
}
|
|
26742
26767
|
}
|
|
26743
26768
|
/**
|
|
26744
26769
|
* Remove a header, if present
|
|
@@ -26774,13 +26799,40 @@ var CacheEntry = class _CacheEntry {
|
|
|
26774
26799
|
const ct = this.getHeaderString("content-type");
|
|
26775
26800
|
if (ct) return this.#isJSON = /\bjson\b/.test(ct);
|
|
26776
26801
|
if (!this._body.length) return false;
|
|
26802
|
+
const wire = !this.#fromCache && !this.#integrityActual && this.isGzip ? this.#hash() : void 0;
|
|
26777
26803
|
this.unzip();
|
|
26778
26804
|
const buf = this._body;
|
|
26779
26805
|
if (!buf.length) return false;
|
|
26780
26806
|
this.#isJSON = buf[0] === 123;
|
|
26781
26807
|
if (this.#isJSON) this.setHeader("content-type", "text/json");
|
|
26808
|
+
else if (wire) this.integrityActual = wire;
|
|
26782
26809
|
return this.#isJSON;
|
|
26783
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
|
+
}
|
|
26784
26836
|
#isGzip;
|
|
26785
26837
|
get isGzip() {
|
|
26786
26838
|
if (this.#isGzip !== void 0) return this.#isGzip;
|
|
@@ -26797,6 +26849,24 @@ var CacheEntry = class _CacheEntry {
|
|
|
26797
26849
|
}
|
|
26798
26850
|
return this.#isGzip;
|
|
26799
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
|
+
}
|
|
26800
26870
|
/**
|
|
26801
26871
|
* Un-gzip encode the body.
|
|
26802
26872
|
* Returns true if it was previously gzip (so something was done), otherwise
|
|
@@ -26804,22 +26874,7 @@ var CacheEntry = class _CacheEntry {
|
|
|
26804
26874
|
*/
|
|
26805
26875
|
unzip() {
|
|
26806
26876
|
if (this.isGzip) {
|
|
26807
|
-
|
|
26808
|
-
throw error("Invalid buffer, cant unzip");
|
|
26809
|
-
const max = Math.min(
|
|
26810
|
-
maxUnpackedBytes,
|
|
26811
|
-
this._body.length * MAX_DECOMPRESSION_RATIO
|
|
26812
|
-
);
|
|
26813
|
-
let b;
|
|
26814
|
-
try {
|
|
26815
|
-
b = gunzipSync(this._body, { maxOutputLength: max });
|
|
26816
|
-
} catch (er) {
|
|
26817
|
-
throw er.code === "ERR_BUFFER_TOO_LARGE" ? error("cache entry exceeds maximum unpacked size", {
|
|
26818
|
-
found: this._body.length,
|
|
26819
|
-
max,
|
|
26820
|
-
cause: er
|
|
26821
|
-
}) : er;
|
|
26822
|
-
}
|
|
26877
|
+
const b = this.#gunzip();
|
|
26823
26878
|
this.setHeader("content-encoding", "identity");
|
|
26824
26879
|
const u8 = new Uint8Array(b.buffer, b.byteOffset, b.byteLength);
|
|
26825
26880
|
this.#body = u8;
|
|
@@ -27880,6 +27935,65 @@ var RegistryClient = class {
|
|
|
27880
27935
|
integrity
|
|
27881
27936
|
);
|
|
27882
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
|
+
}
|
|
27883
27997
|
async request(url, options = {}) {
|
|
27884
27998
|
const u = typeof url === "string" ? new URL(url) : url;
|
|
27885
27999
|
const {
|
|
@@ -27893,12 +28007,20 @@ var RegistryClient = class {
|
|
|
27893
28007
|
} = options;
|
|
27894
28008
|
const { trustIntegrity, verifyDigest } = options;
|
|
27895
28009
|
const m = isCacheableMethod(method) ? method : void 0;
|
|
27896
|
-
const { useCache = !!m } = options;
|
|
28010
|
+
const { useCache = !!m, readCache = true } = options;
|
|
27897
28011
|
signal?.throwIfAborted();
|
|
27898
28012
|
const key = cacheKey(method, u);
|
|
27899
|
-
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;
|
|
27900
28014
|
const entry = buffer ? this.#decodeCached(buffer) : void 0;
|
|
27901
|
-
if (entry?.valid &&
|
|
28015
|
+
if (entry?.valid && forceRevalidate !== true) {
|
|
28016
|
+
if (forceRevalidate === "background" && m) {
|
|
28017
|
+
register2(
|
|
28018
|
+
dirname3(this.cache.path()),
|
|
28019
|
+
m,
|
|
28020
|
+
url,
|
|
28021
|
+
getHeader(options.headers, "accept")
|
|
28022
|
+
);
|
|
28023
|
+
}
|
|
27902
28024
|
logRequest(url, "cache", { method });
|
|
27903
28025
|
return entry;
|
|
27904
28026
|
}
|
|
@@ -27983,26 +28105,26 @@ var RegistryClient = class {
|
|
|
27983
28105
|
durationMs: Date.now() - requestStart
|
|
27984
28106
|
}
|
|
27985
28107
|
);
|
|
27986
|
-
if (!trustIntegrity && !result.fromCache) {
|
|
27987
|
-
result.
|
|
27988
|
-
if (result.statusCode === 200) result.checkIntegrity({ url });
|
|
28108
|
+
if (!trustIntegrity && !result.fromCache && result.statusCode === 200) {
|
|
28109
|
+
result.checkIntegrity({ url });
|
|
27989
28110
|
}
|
|
27990
28111
|
if (verifyDigest && !integrity && !result.fromCache && result.statusCode === 200) {
|
|
27991
28112
|
result.checkDigest(verifyDigest === "required", { url });
|
|
27992
28113
|
}
|
|
27993
28114
|
const clobbersCachedEntry = forceRevalidate && !!entry && result.statusCode !== 200;
|
|
27994
28115
|
if (useCache && !clobbersCachedEntry) {
|
|
27995
|
-
const
|
|
27996
|
-
const
|
|
27997
|
-
|
|
27998
|
-
|
|
27999
|
-
|
|
28000
|
-
|
|
28001
|
-
|
|
28002
|
-
|
|
28003
|
-
),
|
|
28004
|
-
{ integrity: integrity2 }
|
|
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();
|
|
28119
|
+
const encoded = result.encode();
|
|
28120
|
+
const stored = Buffer.from(
|
|
28121
|
+
encoded.buffer,
|
|
28122
|
+
encoded.byteOffset,
|
|
28123
|
+
encoded.byteLength
|
|
28005
28124
|
);
|
|
28125
|
+
this.cache.set(key, stored, { integrity: integrity2 });
|
|
28126
|
+
if (result === entry && entry.isJSON)
|
|
28127
|
+
this.#decoded.set(stored, entry);
|
|
28006
28128
|
}
|
|
28007
28129
|
return result;
|
|
28008
28130
|
}
|
|
@@ -28035,6 +28157,7 @@ var RegistryClient = class {
|
|
|
28035
28157
|
contentLength
|
|
28036
28158
|
}
|
|
28037
28159
|
);
|
|
28160
|
+
if (!trustIntegrity) result.deleteHeader("integrity");
|
|
28038
28161
|
if (isRedirect(result)) {
|
|
28039
28162
|
response.body.resume();
|
|
28040
28163
|
const [nextURL, nextOptions] = redirect(options, result, url);
|
|
@@ -12,16 +12,16 @@ var require = _vlt_createRequire(import.meta.filename);
|
|
|
12
12
|
import {
|
|
13
13
|
init,
|
|
14
14
|
install
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-QGFDMXDH.js";
|
|
16
16
|
import {
|
|
17
17
|
commandUsage
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-LHIDMYN2.js";
|
|
19
19
|
import {
|
|
20
20
|
assertWSConfig,
|
|
21
21
|
minimatch,
|
|
22
22
|
resolveWSConfig,
|
|
23
23
|
splitNegatedPatterns
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-INEKXXUQ.js";
|
|
25
25
|
import {
|
|
26
26
|
load,
|
|
27
27
|
save
|