@vltpkg/cli-js 1.0.4 → 1.0.6
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-RYNHM3DJ.js → access-CMN3GDV4.js} +4 -4
- package/{bugs-ZHOC4U52.js → bugs-MEP373JU.js} +8 -8
- package/{build-HTM6Z7OQ.js → build-TKUT6V2P.js} +6 -6
- package/{cache-74GIE5TO.js → cache-3VLQ7CWL.js} +7 -7
- package/cache-unzip-src-unzip.js +3 -1
- package/{chunk-AIQ7Z62O.js → chunk-34VLICEH.js} +3 -3
- package/{chunk-OR5LSCSK.js → chunk-3NGV7EC6.js} +26 -15
- package/{chunk-OCJDISSI.js → chunk-3OPNZI6G.js} +2 -2
- package/{chunk-JOEHZSS7.js → chunk-4LBWNGU6.js} +2 -2
- package/{chunk-T4GYDWUJ.js → chunk-5JFRXIK2.js} +17 -2
- package/{chunk-RB6SUM6U.js → chunk-AHTQ5ADD.js} +5 -5
- package/{chunk-E737X73P.js → chunk-AL42Z2D3.js} +12 -5
- package/{chunk-WNDUKE42.js → chunk-ED2DDTQT.js} +2 -2
- package/{chunk-GXWZ5T4W.js → chunk-EJUKA3HX.js} +1 -1
- package/{chunk-AMDP7LYB.js → chunk-FBHWUWBW.js} +2 -2
- package/{chunk-R55OHZ2R.js → chunk-G7BEW32U.js} +5 -5
- package/{chunk-VB3IWNHX.js → chunk-GDJ7JT2R.js} +1 -1
- package/{chunk-MZIM7X37.js → chunk-LQGUEFV6.js} +3 -3
- package/{chunk-AK3RSABL.js → chunk-O7OUBUZ3.js} +5 -5
- package/{chunk-2CLRMD5A.js → chunk-PND2URIT.js} +163 -113
- package/{chunk-YRKCPGWZ.js → chunk-QWTGTFHN.js} +2 -2
- package/{chunk-PDLEQEZ3.js → chunk-SVBEF5PK.js} +3 -3
- package/{chunk-IITIX4ID.js → chunk-VFBCWAOC.js} +37 -1
- package/chunk-VWCDSE2C.js +75 -0
- package/{chunk-XU5SMHXP.js → chunk-XKVU23NC.js} +1 -1
- package/{chunk-A2EWSQPE.js → chunk-XVA4ZRW5.js} +4 -4
- package/{ci-XT7IAX2Y.js → ci-ODHEBQNE.js} +9 -7
- package/cli-package.json +1 -1
- package/{config-B2LF4SJ7.js → config-35TJIXFF.js} +7 -7
- package/{config-SRLA2XPZ.js → config-5HCRQACM.js} +6 -6
- package/{create-VKNML6FC.js → create-5BESMSRT.js} +13 -13
- package/{deprecate-IM4HEDIP.js → deprecate-6YTC2E2E.js} +8 -8
- package/{devtools-66MVSNF5.js → devtools-OKXASR4F.js} +29 -29
- package/{dist-tag-EKVJAQ66.js → dist-tag-HHCPJPJL.js} +4 -4
- package/{docs-4DHMAMOU.js → docs-M7KRVAON.js} +8 -8
- package/{exec-7C74Z3WB.js → exec-H664T76F.js} +15 -13
- package/{exec-cache-QTUCQWSA.js → exec-cache-EQUYR4PE.js} +11 -11
- package/{exec-local-ZCNI2JHK.js → exec-local-OUOXFTQ6.js} +11 -11
- package/{help-IKRPBT2R.js → help-F4DM2AQP.js} +1 -1
- package/{init-PCQ4YK7R.js → init-7D5MFAP5.js} +7 -7
- package/{install-OAQ4K3XX.js → install-OZBDTEAY.js} +10 -8
- package/{list-WYBKBCZU.js → list-DRQS77GZ.js} +11 -11
- package/{login-TTRCQ43Z.js → login-JAWRM634.js} +4 -4
- package/{logout-3J77F4OO.js → logout-3ACX34HP.js} +4 -4
- package/{pack-ZLFGYGVZ.js → pack-XUEMZORZ.js} +8 -8
- package/package.json +1 -1
- package/{ping-IRLV5C4D.js → ping-FQGTZ5FI.js} +4 -4
- package/{pkg-EKOQ4XKM.js → pkg-D4OYJPRA.js} +8 -8
- package/{profile-7UBKGJBP.js → profile-UNVFHARP.js} +4 -4
- package/{publish-2ODYT4R2.js → publish-FSZSNKBN.js} +21 -11
- package/{query-ADSAKEK4.js → query-QHCEICAY.js} +11 -11
- package/{registry-CZPFR3OF.js → registry-43SSGAPE.js} +3 -3
- package/registry-client-package.json +1 -1
- package/registry-client-src-revalidate.js +438 -385
- package/{repo-3THXRT64.js → repo-KHFU55BU.js} +8 -8
- package/{reporter-6BFJCFVZ.js → reporter-Y3LUXPQS.js} +76 -76
- package/{run-2QLSVP6M.js → run-4GHCV2NW.js} +11 -11
- package/{run-exec-VYD2Q4BD.js → run-exec-N2B7XW7Y.js} +11 -11
- package/security-archive-src-update-expired.js +37 -1
- package/{setup-TDX5NXUN.js → setup-3PSRN42W.js} +7 -7
- package/{src-AVMBIRBC.js → src-2Q2V6EI2.js} +11 -11
- package/{src-SWL4UPPI.js → src-D7FPRPSM.js} +4 -2
- package/{src-X66SVM5T.js → src-U4EBFPPT.js} +8 -5
- package/{token-3RDRZ4AO.js → token-3RNS2EZO.js} +4 -4
- package/{uninstall-CNAFZTLA.js → uninstall-RBT3ENOD.js} +10 -8
- package/{unpublish-7YHQQYZG.js → unpublish-AS7IBBGN.js} +6 -6
- package/{update-3W27EZWN.js → update-6CBZZ5PN.js} +9 -7
- package/{version-K37LT6GZ.js → version-PW4DD2HC.js} +7 -7
- package/{view-ZVAYKUL2.js → view-LRZPRP7J.js} +6 -6
- 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-IOUW56D6.js → whoami-EASZYMSY.js} +4 -4
- package/chunk-SKQHW56B.js +0 -75
|
@@ -2744,9 +2744,9 @@ var require_dispatcher_base = __commonJS({
|
|
|
2744
2744
|
}
|
|
2745
2745
|
close(callback) {
|
|
2746
2746
|
if (callback === void 0) {
|
|
2747
|
-
return new Promise((
|
|
2747
|
+
return new Promise((resolve11, reject) => {
|
|
2748
2748
|
this.close((err, data) => {
|
|
2749
|
-
return err ? reject(err) :
|
|
2749
|
+
return err ? reject(err) : resolve11(data);
|
|
2750
2750
|
});
|
|
2751
2751
|
});
|
|
2752
2752
|
}
|
|
@@ -2784,9 +2784,9 @@ var require_dispatcher_base = __commonJS({
|
|
|
2784
2784
|
err = null;
|
|
2785
2785
|
}
|
|
2786
2786
|
if (callback === void 0) {
|
|
2787
|
-
return new Promise((
|
|
2787
|
+
return new Promise((resolve11, reject) => {
|
|
2788
2788
|
this.destroy(err, (err2, data) => {
|
|
2789
|
-
return err2 ? reject(err2) :
|
|
2789
|
+
return err2 ? reject(err2) : resolve11(data);
|
|
2790
2790
|
});
|
|
2791
2791
|
});
|
|
2792
2792
|
}
|
|
@@ -6283,8 +6283,8 @@ var require_promise = __commonJS({
|
|
|
6283
6283
|
function createDeferredPromise() {
|
|
6284
6284
|
let res;
|
|
6285
6285
|
let rej;
|
|
6286
|
-
const promise = new Promise((
|
|
6287
|
-
res =
|
|
6286
|
+
const promise = new Promise((resolve11, reject) => {
|
|
6287
|
+
res = resolve11;
|
|
6288
6288
|
rej = reject;
|
|
6289
6289
|
});
|
|
6290
6290
|
return { promise, resolve: res, reject: rej };
|
|
@@ -7688,12 +7688,12 @@ upgrade: ${upgrade}\r
|
|
|
7688
7688
|
cb();
|
|
7689
7689
|
}
|
|
7690
7690
|
}
|
|
7691
|
-
const waitForDrain = () => new Promise((
|
|
7691
|
+
const waitForDrain = () => new Promise((resolve11, reject) => {
|
|
7692
7692
|
assert(callback === null);
|
|
7693
7693
|
if (socket[kError]) {
|
|
7694
7694
|
reject(socket[kError]);
|
|
7695
7695
|
} else {
|
|
7696
|
-
callback =
|
|
7696
|
+
callback = resolve11;
|
|
7697
7697
|
}
|
|
7698
7698
|
});
|
|
7699
7699
|
socket.on("close", onDrain).on("drain", onDrain);
|
|
@@ -8538,12 +8538,12 @@ var require_client_h2 = __commonJS({
|
|
|
8538
8538
|
cb();
|
|
8539
8539
|
}
|
|
8540
8540
|
}
|
|
8541
|
-
const waitForDrain = () => new Promise((
|
|
8541
|
+
const waitForDrain = () => new Promise((resolve11, reject) => {
|
|
8542
8542
|
assert(callback === null);
|
|
8543
8543
|
if (socket[kError]) {
|
|
8544
8544
|
reject(socket[kError]);
|
|
8545
8545
|
} else {
|
|
8546
|
-
callback =
|
|
8546
|
+
callback = resolve11;
|
|
8547
8547
|
}
|
|
8548
8548
|
});
|
|
8549
8549
|
h2stream.on("close", onDrain).on("drain", onDrain);
|
|
@@ -8859,16 +8859,16 @@ var require_client = __commonJS({
|
|
|
8859
8859
|
return this[kNeedDrain] < 2;
|
|
8860
8860
|
}
|
|
8861
8861
|
[kClose]() {
|
|
8862
|
-
return new Promise((
|
|
8862
|
+
return new Promise((resolve11) => {
|
|
8863
8863
|
if (this[kSize]) {
|
|
8864
|
-
this[kClosedResolve] =
|
|
8864
|
+
this[kClosedResolve] = resolve11;
|
|
8865
8865
|
} else {
|
|
8866
|
-
|
|
8866
|
+
resolve11(null);
|
|
8867
8867
|
}
|
|
8868
8868
|
});
|
|
8869
8869
|
}
|
|
8870
8870
|
[kDestroy](err) {
|
|
8871
|
-
return new Promise((
|
|
8871
|
+
return new Promise((resolve11) => {
|
|
8872
8872
|
const requests = this[kQueue].splice(this[kPendingIdx]);
|
|
8873
8873
|
for (let i2 = 0; i2 < requests.length; i2++) {
|
|
8874
8874
|
const request2 = requests[i2];
|
|
@@ -8879,7 +8879,7 @@ var require_client = __commonJS({
|
|
|
8879
8879
|
this[kClosedResolve]();
|
|
8880
8880
|
this[kClosedResolve] = null;
|
|
8881
8881
|
}
|
|
8882
|
-
|
|
8882
|
+
resolve11(null);
|
|
8883
8883
|
};
|
|
8884
8884
|
if (this[kHTTPContext]) {
|
|
8885
8885
|
this[kHTTPContext].destroy(err, callback);
|
|
@@ -9284,8 +9284,8 @@ var require_pool_base = __commonJS({
|
|
|
9284
9284
|
}
|
|
9285
9285
|
return Promise.all(closeAll);
|
|
9286
9286
|
} else {
|
|
9287
|
-
return new Promise((
|
|
9288
|
-
this[kClosedResolve] =
|
|
9287
|
+
return new Promise((resolve11) => {
|
|
9288
|
+
this[kClosedResolve] = resolve11;
|
|
9289
9289
|
});
|
|
9290
9290
|
}
|
|
9291
9291
|
}
|
|
@@ -10402,7 +10402,7 @@ var require_socks5_proxy_agent = __commonJS({
|
|
|
10402
10402
|
const proxyHost = this[kProxyUrl].hostname;
|
|
10403
10403
|
const proxyPort = parseInt(this[kProxyUrl].port) || 1080;
|
|
10404
10404
|
debug2("creating SOCKS5 connection to", proxyHost, proxyPort);
|
|
10405
|
-
const socket = await new Promise((
|
|
10405
|
+
const socket = await new Promise((resolve11, reject) => {
|
|
10406
10406
|
this[kConnector]({
|
|
10407
10407
|
hostname: proxyHost,
|
|
10408
10408
|
host: proxyHost,
|
|
@@ -10412,7 +10412,7 @@ var require_socks5_proxy_agent = __commonJS({
|
|
|
10412
10412
|
if (err) {
|
|
10413
10413
|
reject(err);
|
|
10414
10414
|
} else {
|
|
10415
|
-
|
|
10415
|
+
resolve11(socket2);
|
|
10416
10416
|
}
|
|
10417
10417
|
});
|
|
10418
10418
|
});
|
|
@@ -10422,14 +10422,14 @@ var require_socks5_proxy_agent = __commonJS({
|
|
|
10422
10422
|
socket.destroy();
|
|
10423
10423
|
});
|
|
10424
10424
|
await socks5Client.handshake();
|
|
10425
|
-
await new Promise((
|
|
10425
|
+
await new Promise((resolve11, reject) => {
|
|
10426
10426
|
const timeout = setTimeout(() => {
|
|
10427
10427
|
reject(new Error("SOCKS5 authentication timeout"));
|
|
10428
10428
|
}, 5e3);
|
|
10429
10429
|
const onAuthenticated = () => {
|
|
10430
10430
|
clearTimeout(timeout);
|
|
10431
10431
|
socks5Client.removeListener("error", onError);
|
|
10432
|
-
|
|
10432
|
+
resolve11();
|
|
10433
10433
|
};
|
|
10434
10434
|
const onError = (err) => {
|
|
10435
10435
|
clearTimeout(timeout);
|
|
@@ -10438,14 +10438,14 @@ var require_socks5_proxy_agent = __commonJS({
|
|
|
10438
10438
|
};
|
|
10439
10439
|
if (socks5Client.state === STATES.AUTHENTICATED) {
|
|
10440
10440
|
clearTimeout(timeout);
|
|
10441
|
-
|
|
10441
|
+
resolve11();
|
|
10442
10442
|
} else {
|
|
10443
10443
|
socks5Client.once("authenticated", onAuthenticated);
|
|
10444
10444
|
socks5Client.once("error", onError);
|
|
10445
10445
|
}
|
|
10446
10446
|
});
|
|
10447
10447
|
await socks5Client.connect(targetHost, targetPort);
|
|
10448
|
-
await new Promise((
|
|
10448
|
+
await new Promise((resolve11, reject) => {
|
|
10449
10449
|
const timeout = setTimeout(() => {
|
|
10450
10450
|
reject(new Error("SOCKS5 connection timeout"));
|
|
10451
10451
|
}, 5e3);
|
|
@@ -10453,7 +10453,7 @@ var require_socks5_proxy_agent = __commonJS({
|
|
|
10453
10453
|
debug2("SOCKS5 tunnel established to", targetHost, targetPort, "via", info);
|
|
10454
10454
|
clearTimeout(timeout);
|
|
10455
10455
|
socks5Client.removeListener("error", onError);
|
|
10456
|
-
|
|
10456
|
+
resolve11();
|
|
10457
10457
|
};
|
|
10458
10458
|
const onError = (err) => {
|
|
10459
10459
|
clearTimeout(timeout);
|
|
@@ -10496,8 +10496,8 @@ var require_socks5_proxy_agent = __commonJS({
|
|
|
10496
10496
|
socket,
|
|
10497
10497
|
servername: this[kRequestTls]?.servername || targetHost
|
|
10498
10498
|
});
|
|
10499
|
-
await new Promise((
|
|
10500
|
-
finalSocket.once("secureConnect",
|
|
10499
|
+
await new Promise((resolve11, reject) => {
|
|
10500
|
+
finalSocket.once("secureConnect", resolve11);
|
|
10501
10501
|
finalSocket.once("error", reject);
|
|
10502
10502
|
});
|
|
10503
10503
|
}
|
|
@@ -11553,7 +11553,7 @@ var require_readable = __commonJS({
|
|
|
11553
11553
|
if (this._readableState.closeEmitted) {
|
|
11554
11554
|
return Promise.resolve(null);
|
|
11555
11555
|
}
|
|
11556
|
-
return new Promise((
|
|
11556
|
+
return new Promise((resolve11, reject) => {
|
|
11557
11557
|
if (this[kContentLength] && this[kContentLength] > limit || this[kBytesRead] > limit) {
|
|
11558
11558
|
this.destroy(new AbortError());
|
|
11559
11559
|
}
|
|
@@ -11567,11 +11567,11 @@ var require_readable = __commonJS({
|
|
|
11567
11567
|
if (signal.aborted) {
|
|
11568
11568
|
reject(signal.reason ?? new AbortError());
|
|
11569
11569
|
} else {
|
|
11570
|
-
|
|
11570
|
+
resolve11(null);
|
|
11571
11571
|
}
|
|
11572
11572
|
});
|
|
11573
11573
|
} else {
|
|
11574
|
-
this.on("close",
|
|
11574
|
+
this.on("close", resolve11);
|
|
11575
11575
|
}
|
|
11576
11576
|
this.on("error", noop).on("data", () => {
|
|
11577
11577
|
if (this[kBytesRead] > limit) {
|
|
@@ -11599,7 +11599,7 @@ var require_readable = __commonJS({
|
|
|
11599
11599
|
}
|
|
11600
11600
|
function consume(stream, type) {
|
|
11601
11601
|
assert(!stream[kConsume]);
|
|
11602
|
-
return new Promise((
|
|
11602
|
+
return new Promise((resolve11, reject) => {
|
|
11603
11603
|
if (isUnusable(stream)) {
|
|
11604
11604
|
const rState = stream._readableState;
|
|
11605
11605
|
if (rState.destroyed && rState.closeEmitted === false) {
|
|
@@ -11614,7 +11614,7 @@ var require_readable = __commonJS({
|
|
|
11614
11614
|
stream[kConsume] = {
|
|
11615
11615
|
type,
|
|
11616
11616
|
stream,
|
|
11617
|
-
resolve:
|
|
11617
|
+
resolve: resolve11,
|
|
11618
11618
|
reject,
|
|
11619
11619
|
length: 0,
|
|
11620
11620
|
body: []
|
|
@@ -11688,18 +11688,18 @@ var require_readable = __commonJS({
|
|
|
11688
11688
|
return buffer;
|
|
11689
11689
|
}
|
|
11690
11690
|
function consumeEnd(consume2, encoding) {
|
|
11691
|
-
const { type, body, resolve:
|
|
11691
|
+
const { type, body, resolve: resolve11, stream, length } = consume2;
|
|
11692
11692
|
try {
|
|
11693
11693
|
if (type === "text") {
|
|
11694
|
-
|
|
11694
|
+
resolve11(chunksDecode(body, length, encoding));
|
|
11695
11695
|
} else if (type === "json") {
|
|
11696
|
-
|
|
11696
|
+
resolve11(JSON.parse(chunksDecode(body, length, encoding)));
|
|
11697
11697
|
} else if (type === "arrayBuffer") {
|
|
11698
|
-
|
|
11698
|
+
resolve11(chunksConcat(body, length).buffer);
|
|
11699
11699
|
} else if (type === "blob") {
|
|
11700
|
-
|
|
11700
|
+
resolve11(new Blob(body, { type: stream[kContentType] }));
|
|
11701
11701
|
} else if (type === "bytes") {
|
|
11702
|
-
|
|
11702
|
+
resolve11(chunksConcat(body, length));
|
|
11703
11703
|
}
|
|
11704
11704
|
consumeFinish(consume2);
|
|
11705
11705
|
} catch (err) {
|
|
@@ -11889,9 +11889,9 @@ var require_api_request = __commonJS({
|
|
|
11889
11889
|
};
|
|
11890
11890
|
function request2(opts, callback) {
|
|
11891
11891
|
if (callback === void 0) {
|
|
11892
|
-
return new Promise((
|
|
11892
|
+
return new Promise((resolve11, reject) => {
|
|
11893
11893
|
request2.call(this, opts, (err, data) => {
|
|
11894
|
-
return err ? reject(err) :
|
|
11894
|
+
return err ? reject(err) : resolve11(data);
|
|
11895
11895
|
});
|
|
11896
11896
|
});
|
|
11897
11897
|
}
|
|
@@ -12103,9 +12103,9 @@ var require_api_stream = __commonJS({
|
|
|
12103
12103
|
};
|
|
12104
12104
|
function stream(opts, factory, callback) {
|
|
12105
12105
|
if (callback === void 0) {
|
|
12106
|
-
return new Promise((
|
|
12106
|
+
return new Promise((resolve11, reject) => {
|
|
12107
12107
|
stream.call(this, opts, factory, (err, data) => {
|
|
12108
|
-
return err ? reject(err) :
|
|
12108
|
+
return err ? reject(err) : resolve11(data);
|
|
12109
12109
|
});
|
|
12110
12110
|
});
|
|
12111
12111
|
}
|
|
@@ -12393,9 +12393,9 @@ var require_api_upgrade = __commonJS({
|
|
|
12393
12393
|
};
|
|
12394
12394
|
function upgrade(opts, callback) {
|
|
12395
12395
|
if (callback === void 0) {
|
|
12396
|
-
return new Promise((
|
|
12396
|
+
return new Promise((resolve11, reject) => {
|
|
12397
12397
|
upgrade.call(this, opts, (err, data) => {
|
|
12398
|
-
return err ? reject(err) :
|
|
12398
|
+
return err ? reject(err) : resolve11(data);
|
|
12399
12399
|
});
|
|
12400
12400
|
});
|
|
12401
12401
|
}
|
|
@@ -12488,9 +12488,9 @@ var require_api_connect = __commonJS({
|
|
|
12488
12488
|
};
|
|
12489
12489
|
function connect(opts, callback) {
|
|
12490
12490
|
if (callback === void 0) {
|
|
12491
|
-
return new Promise((
|
|
12491
|
+
return new Promise((resolve11, reject) => {
|
|
12492
12492
|
connect.call(this, opts, (err, data) => {
|
|
12493
|
-
return err ? reject(err) :
|
|
12493
|
+
return err ? reject(err) : resolve11(data);
|
|
12494
12494
|
});
|
|
12495
12495
|
});
|
|
12496
12496
|
}
|
|
@@ -13763,8 +13763,8 @@ var require_snapshot_utils = __commonJS({
|
|
|
13763
13763
|
var require_snapshot_recorder = __commonJS({
|
|
13764
13764
|
"../../node_modules/.vlt/~npm~undici@7.29.0/node_modules/undici/lib/mock/snapshot-recorder.js"(exports, module3) {
|
|
13765
13765
|
"use strict";
|
|
13766
|
-
var { writeFile: writeFile3, readFile:
|
|
13767
|
-
var { dirname: dirname5, resolve:
|
|
13766
|
+
var { writeFile: writeFile3, readFile: readFile4, mkdir: mkdir3 } = __require("node:fs/promises");
|
|
13767
|
+
var { dirname: dirname5, resolve: resolve11 } = __require("node:path");
|
|
13768
13768
|
var { setTimeout: setTimeout4, clearTimeout: clearTimeout2 } = __require("node:timers");
|
|
13769
13769
|
var { InvalidArgumentError, UndiciError } = require_errors();
|
|
13770
13770
|
var { hashId, isUrlExcludedFactory, normalizeHeaders, createHeaderFilters } = require_snapshot_utils();
|
|
@@ -13965,7 +13965,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
13965
13965
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
13966
13966
|
}
|
|
13967
13967
|
try {
|
|
13968
|
-
const data = await
|
|
13968
|
+
const data = await readFile4(resolve11(path2), "utf8");
|
|
13969
13969
|
const parsed = JSON.parse(data);
|
|
13970
13970
|
if (Array.isArray(parsed)) {
|
|
13971
13971
|
this.#snapshots.clear();
|
|
@@ -13994,7 +13994,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
13994
13994
|
if (!path2) {
|
|
13995
13995
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
13996
13996
|
}
|
|
13997
|
-
const resolvedPath =
|
|
13997
|
+
const resolvedPath = resolve11(path2);
|
|
13998
13998
|
await mkdir3(dirname5(resolvedPath), { recursive: true });
|
|
13999
13999
|
const data = Array.from(this.#snapshots.entries()).map(([hash2, snapshot]) => ({
|
|
14000
14000
|
hash: hash2,
|
|
@@ -15799,18 +15799,18 @@ var require_cache = __commonJS({
|
|
|
15799
15799
|
}
|
|
15800
15800
|
}
|
|
15801
15801
|
}
|
|
15802
|
-
function makeDeduplicationKey(
|
|
15802
|
+
function makeDeduplicationKey(cacheKey2, excludeHeaders) {
|
|
15803
15803
|
const headers = {};
|
|
15804
|
-
if (
|
|
15805
|
-
const sortedHeaders = Object.keys(
|
|
15804
|
+
if (cacheKey2.headers) {
|
|
15805
|
+
const sortedHeaders = Object.keys(cacheKey2.headers).sort();
|
|
15806
15806
|
for (const header of sortedHeaders) {
|
|
15807
15807
|
if (excludeHeaders?.has(header.toLowerCase())) {
|
|
15808
15808
|
continue;
|
|
15809
15809
|
}
|
|
15810
|
-
headers[header] =
|
|
15810
|
+
headers[header] = cacheKey2.headers[header];
|
|
15811
15811
|
}
|
|
15812
15812
|
}
|
|
15813
|
-
return JSON.stringify([
|
|
15813
|
+
return JSON.stringify([cacheKey2.origin, cacheKey2.method, cacheKey2.path, headers]);
|
|
15814
15814
|
}
|
|
15815
15815
|
module3.exports = {
|
|
15816
15816
|
makeCacheKey,
|
|
@@ -16384,7 +16384,7 @@ var require_cache_handler = __commonJS({
|
|
|
16384
16384
|
}
|
|
16385
16385
|
}
|
|
16386
16386
|
}
|
|
16387
|
-
function getSameOriginPath(
|
|
16387
|
+
function getSameOriginPath(cacheKey2, location) {
|
|
16388
16388
|
if (typeof location !== "string") {
|
|
16389
16389
|
return void 0;
|
|
16390
16390
|
}
|
|
@@ -16392,8 +16392,8 @@ var require_cache_handler = __commonJS({
|
|
|
16392
16392
|
let requestUrl;
|
|
16393
16393
|
let locationUrl;
|
|
16394
16394
|
try {
|
|
16395
|
-
originUrl = new URL(
|
|
16396
|
-
requestUrl = new URL(
|
|
16395
|
+
originUrl = new URL(cacheKey2.origin);
|
|
16396
|
+
requestUrl = new URL(cacheKey2.path, originUrl);
|
|
16397
16397
|
locationUrl = new URL(location, requestUrl);
|
|
16398
16398
|
} catch {
|
|
16399
16399
|
return void 0;
|
|
@@ -16403,38 +16403,38 @@ var require_cache_handler = __commonJS({
|
|
|
16403
16403
|
}
|
|
16404
16404
|
return locationUrl.pathname + locationUrl.search;
|
|
16405
16405
|
}
|
|
16406
|
-
function deleteCachedUri(store,
|
|
16406
|
+
function deleteCachedUri(store, cacheKey2, path2) {
|
|
16407
16407
|
deleteCachedValue(store, {
|
|
16408
|
-
...
|
|
16408
|
+
...cacheKey2,
|
|
16409
16409
|
path: path2
|
|
16410
16410
|
});
|
|
16411
16411
|
for (let i2 = 0; i2 < util.safeHTTPMethods.length; i2++) {
|
|
16412
16412
|
const method = util.safeHTTPMethods[i2];
|
|
16413
|
-
if (method !==
|
|
16413
|
+
if (method !== cacheKey2.method) {
|
|
16414
16414
|
deleteCachedValue(store, {
|
|
16415
|
-
...
|
|
16415
|
+
...cacheKey2,
|
|
16416
16416
|
method,
|
|
16417
16417
|
path: path2
|
|
16418
16418
|
});
|
|
16419
16419
|
}
|
|
16420
16420
|
}
|
|
16421
16421
|
}
|
|
16422
|
-
function deleteLocationTargets(store,
|
|
16422
|
+
function deleteLocationTargets(store, cacheKey2, headerValue) {
|
|
16423
16423
|
if (headerValue === void 0) {
|
|
16424
16424
|
return;
|
|
16425
16425
|
}
|
|
16426
16426
|
const values = Array.isArray(headerValue) ? headerValue : [headerValue];
|
|
16427
16427
|
for (let i2 = 0; i2 < values.length; i2++) {
|
|
16428
|
-
const path2 = getSameOriginPath(
|
|
16428
|
+
const path2 = getSameOriginPath(cacheKey2, values[i2]);
|
|
16429
16429
|
if (path2 !== void 0) {
|
|
16430
|
-
deleteCachedUri(store,
|
|
16430
|
+
deleteCachedUri(store, cacheKey2, path2);
|
|
16431
16431
|
}
|
|
16432
16432
|
}
|
|
16433
16433
|
}
|
|
16434
|
-
function invalidateUnsafeRequest(store,
|
|
16435
|
-
deleteCachedUri(store,
|
|
16436
|
-
deleteLocationTargets(store,
|
|
16437
|
-
deleteLocationTargets(store,
|
|
16434
|
+
function invalidateUnsafeRequest(store, cacheKey2, resHeaders) {
|
|
16435
|
+
deleteCachedUri(store, cacheKey2, cacheKey2.path);
|
|
16436
|
+
deleteLocationTargets(store, cacheKey2, resHeaders.location);
|
|
16437
|
+
deleteLocationTargets(store, cacheKey2, resHeaders["content-location"]);
|
|
16438
16438
|
}
|
|
16439
16439
|
var CacheHandler = class {
|
|
16440
16440
|
/**
|
|
@@ -16466,11 +16466,11 @@ var require_cache_handler = __commonJS({
|
|
|
16466
16466
|
* @param {import('../../types/cache-interceptor.d.ts').default.CacheKey} cacheKey
|
|
16467
16467
|
* @param {import('../../types/dispatcher.d.ts').default.DispatchHandler} handler
|
|
16468
16468
|
*/
|
|
16469
|
-
constructor({ store, type, cacheByDefault },
|
|
16469
|
+
constructor({ store, type, cacheByDefault }, cacheKey2, handler) {
|
|
16470
16470
|
this.#store = store;
|
|
16471
16471
|
this.#cacheType = type;
|
|
16472
16472
|
this.#cacheByDefault = cacheByDefault;
|
|
16473
|
-
this.#cacheKey =
|
|
16473
|
+
this.#cacheKey = cacheKey2;
|
|
16474
16474
|
this.#handler = handler;
|
|
16475
16475
|
}
|
|
16476
16476
|
onRequestStart(controller, context) {
|
|
@@ -16659,15 +16659,15 @@ var require_cache_handler = __commonJS({
|
|
|
16659
16659
|
this.#handler.onResponseError?.(controller, err);
|
|
16660
16660
|
}
|
|
16661
16661
|
};
|
|
16662
|
-
function deleteCachedValue(store,
|
|
16662
|
+
function deleteCachedValue(store, cacheKey2) {
|
|
16663
16663
|
try {
|
|
16664
|
-
store.delete(
|
|
16664
|
+
store.delete(cacheKey2)?.catch?.(noop);
|
|
16665
16665
|
} catch {
|
|
16666
16666
|
}
|
|
16667
16667
|
}
|
|
16668
|
-
function deleteCachedValueIfNotModified(statusCode, store,
|
|
16668
|
+
function deleteCachedValueIfNotModified(statusCode, store, cacheKey2) {
|
|
16669
16669
|
if (statusCode === 304) {
|
|
16670
|
-
deleteCachedValue(store,
|
|
16670
|
+
deleteCachedValue(store, cacheKey2);
|
|
16671
16671
|
}
|
|
16672
16672
|
}
|
|
16673
16673
|
function revalidationResponseDisallowsCachedReuse(cacheType, resHeaders, cacheControlDirectives) {
|
|
@@ -17230,9 +17230,9 @@ var require_cache2 = __commonJS({
|
|
|
17230
17230
|
function revalidationResponseUpdatesCacheControl(headers) {
|
|
17231
17231
|
return headers["cache-control"] !== void 0;
|
|
17232
17232
|
}
|
|
17233
|
-
function deleteCachedValue(store,
|
|
17233
|
+
function deleteCachedValue(store, cacheKey2) {
|
|
17234
17234
|
try {
|
|
17235
|
-
store.delete(
|
|
17235
|
+
store.delete(cacheKey2)?.catch?.(nop);
|
|
17236
17236
|
} catch {
|
|
17237
17237
|
}
|
|
17238
17238
|
}
|
|
@@ -17284,7 +17284,7 @@ var require_cache2 = __commonJS({
|
|
|
17284
17284
|
const staleWhileRevalidateExpiry = result.staleAt + staleWhileRevalidate * 1e3;
|
|
17285
17285
|
return now <= staleWhileRevalidateExpiry;
|
|
17286
17286
|
}
|
|
17287
|
-
function handleUncachedResponse(dispatch, globalOpts,
|
|
17287
|
+
function handleUncachedResponse(dispatch, globalOpts, cacheKey2, handler, opts, reqCacheControl) {
|
|
17288
17288
|
if (reqCacheControl?.["only-if-cached"]) {
|
|
17289
17289
|
let aborted = false;
|
|
17290
17290
|
try {
|
|
@@ -17312,7 +17312,7 @@ var require_cache2 = __commonJS({
|
|
|
17312
17312
|
}
|
|
17313
17313
|
return true;
|
|
17314
17314
|
}
|
|
17315
|
-
return dispatch(opts, new CacheHandler(globalOpts,
|
|
17315
|
+
return dispatch(opts, new CacheHandler(globalOpts, cacheKey2, handler));
|
|
17316
17316
|
}
|
|
17317
17317
|
function sendCachedValue(handler, opts, result, age, context, isStale2) {
|
|
17318
17318
|
const stream = util.isStream(result.body) ? result.body : Readable.from(result.body ?? []);
|
|
@@ -17368,13 +17368,13 @@ var require_cache2 = __commonJS({
|
|
|
17368
17368
|
});
|
|
17369
17369
|
}
|
|
17370
17370
|
}
|
|
17371
|
-
function handleResult(dispatch, globalOpts,
|
|
17371
|
+
function handleResult(dispatch, globalOpts, cacheKey2, handler, opts, reqCacheControl, result) {
|
|
17372
17372
|
if (!result) {
|
|
17373
|
-
return handleUncachedResponse(dispatch, globalOpts,
|
|
17373
|
+
return handleUncachedResponse(dispatch, globalOpts, cacheKey2, handler, opts, reqCacheControl);
|
|
17374
17374
|
}
|
|
17375
17375
|
const now = Date.now();
|
|
17376
17376
|
if (now > result.deleteAt) {
|
|
17377
|
-
return dispatch(opts, new CacheHandler(globalOpts,
|
|
17377
|
+
return dispatch(opts, new CacheHandler(globalOpts, cacheKey2, handler));
|
|
17378
17378
|
}
|
|
17379
17379
|
const age = Math.round((now - result.cachedAt) / 1e3);
|
|
17380
17380
|
const requestMaxAgeExpired = reqCacheControl?.["max-age"] !== void 0 && age >= reqCacheControl["max-age"];
|
|
@@ -17382,7 +17382,7 @@ var require_cache2 = __commonJS({
|
|
|
17382
17382
|
const revalidate = requestMaxAgeExpired || needsRevalidation(result, reqCacheControl, opts);
|
|
17383
17383
|
if (stale || revalidate) {
|
|
17384
17384
|
if (util.isStream(opts.body) && util.bodyLength(opts.body) !== 0) {
|
|
17385
|
-
return dispatch(opts, new CacheHandler(globalOpts,
|
|
17385
|
+
return dispatch(opts, new CacheHandler(globalOpts, cacheKey2, handler));
|
|
17386
17386
|
}
|
|
17387
17387
|
if (!revalidate && withinStaleWhileRevalidateWindow(result, globalOpts.type)) {
|
|
17388
17388
|
sendCachedValue(handler, opts, result, age, null, true);
|
|
@@ -17393,7 +17393,7 @@ var require_cache2 = __commonJS({
|
|
|
17393
17393
|
...opts,
|
|
17394
17394
|
headers: headers2
|
|
17395
17395
|
},
|
|
17396
|
-
new CacheHandler(globalOpts,
|
|
17396
|
+
new CacheHandler(globalOpts, cacheKey2, {
|
|
17397
17397
|
// Silent handler that just updates the cache
|
|
17398
17398
|
onRequestStart() {
|
|
17399
17399
|
},
|
|
@@ -17433,11 +17433,11 @@ var require_cache2 = __commonJS({
|
|
|
17433
17433
|
if (util.isStream(result.body)) {
|
|
17434
17434
|
result.body.on("error", nop).destroy();
|
|
17435
17435
|
}
|
|
17436
|
-
deleteCachedValue(globalOpts.store,
|
|
17437
|
-
return dispatch(opts, new CacheHandler(globalOpts,
|
|
17436
|
+
deleteCachedValue(globalOpts.store, cacheKey2);
|
|
17437
|
+
return dispatch(opts, new CacheHandler(globalOpts, cacheKey2, handler));
|
|
17438
17438
|
}
|
|
17439
17439
|
if (revalidationResponseUpdatesCacheControl(headers2)) {
|
|
17440
|
-
deleteCachedValue(globalOpts.store,
|
|
17440
|
+
deleteCachedValue(globalOpts.store, cacheKey2);
|
|
17441
17441
|
}
|
|
17442
17442
|
}
|
|
17443
17443
|
sendCachedValue(handler, opts, result, age, context, stale);
|
|
@@ -17445,7 +17445,7 @@ var require_cache2 = __commonJS({
|
|
|
17445
17445
|
result.body.on("error", nop).destroy();
|
|
17446
17446
|
}
|
|
17447
17447
|
},
|
|
17448
|
-
new CacheHandler(globalOpts,
|
|
17448
|
+
new CacheHandler(globalOpts, cacheKey2, handler),
|
|
17449
17449
|
withinStaleIfErrorThreshold
|
|
17450
17450
|
)
|
|
17451
17451
|
);
|
|
@@ -17520,13 +17520,13 @@ var require_cache2 = __commonJS({
|
|
|
17520
17520
|
if (reqCacheControl?.["no-store"]) {
|
|
17521
17521
|
return dispatch(opts2, handler);
|
|
17522
17522
|
}
|
|
17523
|
-
const
|
|
17524
|
-
const result = store.get(
|
|
17523
|
+
const cacheKey2 = makeCacheKey(opts2);
|
|
17524
|
+
const result = store.get(cacheKey2);
|
|
17525
17525
|
if (result && typeof result.then === "function") {
|
|
17526
17526
|
return result.then((result2) => handleResult(
|
|
17527
17527
|
dispatch,
|
|
17528
17528
|
globalOpts,
|
|
17529
|
-
|
|
17529
|
+
cacheKey2,
|
|
17530
17530
|
handler,
|
|
17531
17531
|
opts2,
|
|
17532
17532
|
reqCacheControl,
|
|
@@ -17536,7 +17536,7 @@ var require_cache2 = __commonJS({
|
|
|
17536
17536
|
return handleResult(
|
|
17537
17537
|
dispatch,
|
|
17538
17538
|
globalOpts,
|
|
17539
|
-
|
|
17539
|
+
cacheKey2,
|
|
17540
17540
|
handler,
|
|
17541
17541
|
opts2,
|
|
17542
17542
|
reqCacheControl,
|
|
@@ -18177,8 +18177,8 @@ var require_deduplicate = __commonJS({
|
|
|
18177
18177
|
}
|
|
18178
18178
|
}
|
|
18179
18179
|
}
|
|
18180
|
-
const
|
|
18181
|
-
const dedupeKey = makeDeduplicationKey(
|
|
18180
|
+
const cacheKey2 = makeCacheKey(opts2);
|
|
18181
|
+
const dedupeKey = makeDeduplicationKey(cacheKey2, excludeHeaderNamesSet);
|
|
18182
18182
|
const pendingHandler = pendingRequests.get(dedupeKey);
|
|
18183
18183
|
if (pendingHandler) {
|
|
18184
18184
|
if (pendingHandler.addWaitingHandler(handler)) {
|
|
@@ -21307,7 +21307,7 @@ var require_fetch = __commonJS({
|
|
|
21307
21307
|
const agent = fetchParams.controller.dispatcher;
|
|
21308
21308
|
const path2 = url.pathname + url.search;
|
|
21309
21309
|
const hasTrailingQuestionMark = url.search.length === 0 && url.href[url.href.length - url.hash.length - 1] === "?";
|
|
21310
|
-
return new Promise((
|
|
21310
|
+
return new Promise((resolve11, reject) => agent.dispatch(
|
|
21311
21311
|
{
|
|
21312
21312
|
path: hasTrailingQuestionMark ? `${path2}?` : path2,
|
|
21313
21313
|
origin: url.origin,
|
|
@@ -21395,7 +21395,7 @@ var require_fetch = __commonJS({
|
|
|
21395
21395
|
}
|
|
21396
21396
|
}
|
|
21397
21397
|
const onError = this.onError.bind(this);
|
|
21398
|
-
|
|
21398
|
+
resolve11({
|
|
21399
21399
|
status,
|
|
21400
21400
|
statusText,
|
|
21401
21401
|
headersList,
|
|
@@ -21448,7 +21448,7 @@ var require_fetch = __commonJS({
|
|
|
21448
21448
|
headersList.append(headerName, String(value), true);
|
|
21449
21449
|
}
|
|
21450
21450
|
}
|
|
21451
|
-
|
|
21451
|
+
resolve11({
|
|
21452
21452
|
status,
|
|
21453
21453
|
statusText: STATUS_CODES[status],
|
|
21454
21454
|
headersList,
|
|
@@ -21472,7 +21472,7 @@ var require_fetch = __commonJS({
|
|
|
21472
21472
|
headersList.append(nameStr, value.toString("latin1"), true);
|
|
21473
21473
|
}
|
|
21474
21474
|
}
|
|
21475
|
-
|
|
21475
|
+
resolve11({
|
|
21476
21476
|
status,
|
|
21477
21477
|
statusText: STATUS_CODES[status],
|
|
21478
21478
|
headersList,
|
|
@@ -25779,7 +25779,8 @@ var require_dist = __commonJS({
|
|
|
25779
25779
|
});
|
|
25780
25780
|
|
|
25781
25781
|
// ../../src/registry-client/src/revalidate.ts
|
|
25782
|
-
import {
|
|
25782
|
+
import { setPriority } from "node:os";
|
|
25783
|
+
import { pathToFileURL } from "node:url";
|
|
25783
25784
|
|
|
25784
25785
|
// ../../src/error-cause/src/index.ts
|
|
25785
25786
|
var { captureStackTrace } = Error;
|
|
@@ -30085,7 +30086,9 @@ var Cache = class _Cache extends I {
|
|
|
30085
30086
|
return this.#diskRead(k4, v3, opts.context?.integrity);
|
|
30086
30087
|
},
|
|
30087
30088
|
allowStaleOnFetchRejection: true,
|
|
30088
|
-
|
|
30089
|
+
// Eviction aborts in-flight fetch() placeholders. Resolving those
|
|
30090
|
+
// as undefined is treated as a cache miss and re-downloads tarballs.
|
|
30091
|
+
ignoreFetchAbort: true,
|
|
30089
30092
|
allowStale: true,
|
|
30090
30093
|
noDeleteOnStaleGet: true
|
|
30091
30094
|
});
|
|
@@ -30328,176 +30331,8 @@ import { spawn } from "node:child_process";
|
|
|
30328
30331
|
import module from "node:module";
|
|
30329
30332
|
|
|
30330
30333
|
// ../../src/cache-unzip/src/unzip.ts
|
|
30331
|
-
import {
|
|
30332
|
-
|
|
30333
|
-
var __CODE_SPLIT_SCRIPT_NAME = import.meta.filename;
|
|
30334
|
-
var MAX_DECOMPRESSION_RATIO = 1e3;
|
|
30335
|
-
var defaultMaxUnpackedBytes = 2 * 1024 * 1024 * 1024;
|
|
30336
|
-
var parseMaxUnpackedBytes = (raw) => {
|
|
30337
|
-
const n7 = Number(raw);
|
|
30338
|
-
return Number.isFinite(n7) && n7 >= 1 ? Math.floor(n7) : defaultMaxUnpackedBytes;
|
|
30339
|
-
};
|
|
30340
|
-
var maxUnpackedBytes = parseMaxUnpackedBytes(
|
|
30341
|
-
process.env.VLT_TAR_MAX_UNPACKED_BYTES
|
|
30342
|
-
);
|
|
30343
|
-
var isMain = (path2) => path2 === __CODE_SPLIT_SCRIPT_NAME || path2 === pathToFileURL(__CODE_SPLIT_SCRIPT_NAME).toString();
|
|
30344
|
-
var main = async (path2, input = process.stdin) => {
|
|
30345
|
-
if (!path2) {
|
|
30346
|
-
return false;
|
|
30347
|
-
}
|
|
30348
|
-
const keys = await new Promise((res) => {
|
|
30349
|
-
const chunks = [];
|
|
30350
|
-
let chunkLen = 0;
|
|
30351
|
-
input.on("data", (chunk) => {
|
|
30352
|
-
chunks.push(chunk);
|
|
30353
|
-
chunkLen += chunk.length;
|
|
30354
|
-
});
|
|
30355
|
-
input.on("end", () => {
|
|
30356
|
-
res(
|
|
30357
|
-
Buffer.concat(chunks, chunkLen).toString().split("\0").filter((i2) => !!i2)
|
|
30358
|
-
);
|
|
30359
|
-
});
|
|
30360
|
-
});
|
|
30361
|
-
if (!keys.length) {
|
|
30362
|
-
return false;
|
|
30363
|
-
}
|
|
30364
|
-
const cache = new Cache({ path: path2 });
|
|
30365
|
-
const readSize2 = (buf, offset) => {
|
|
30366
|
-
const a2 = buf[offset];
|
|
30367
|
-
const b = buf[offset + 1];
|
|
30368
|
-
const c = buf[offset + 2];
|
|
30369
|
-
const d4 = buf[offset + 3];
|
|
30370
|
-
if (a2 === void 0 || b === void 0 || c === void 0 || d4 === void 0) {
|
|
30371
|
-
throw error("Invalid buffer, not long enough to readSize", {
|
|
30372
|
-
found: buf,
|
|
30373
|
-
offset
|
|
30374
|
-
});
|
|
30375
|
-
}
|
|
30376
|
-
return a2 << 24 | b << 16 | c << 8 | d4;
|
|
30377
|
-
};
|
|
30378
|
-
const results = await Promise.all(
|
|
30379
|
-
keys.map(async (key) => {
|
|
30380
|
-
const buffer = await cache.fetch(key);
|
|
30381
|
-
if (!buffer || buffer.length < 4) return null;
|
|
30382
|
-
const headSizeOriginal = readSize2(buffer, 0);
|
|
30383
|
-
const body = buffer.subarray(headSizeOriginal);
|
|
30384
|
-
if (body[0] === 31 && body[1] === 139) {
|
|
30385
|
-
let unz;
|
|
30386
|
-
try {
|
|
30387
|
-
unz = gunzipSync(body, {
|
|
30388
|
-
maxOutputLength: Math.min(
|
|
30389
|
-
maxUnpackedBytes,
|
|
30390
|
-
body.length * MAX_DECOMPRESSION_RATIO
|
|
30391
|
-
)
|
|
30392
|
-
});
|
|
30393
|
-
} catch (er) {
|
|
30394
|
-
if (er.code !== "ERR_BUFFER_TOO_LARGE") {
|
|
30395
|
-
throw er;
|
|
30396
|
-
}
|
|
30397
|
-
return null;
|
|
30398
|
-
}
|
|
30399
|
-
const headersBuffer = buffer.subarray(7, headSizeOriginal);
|
|
30400
|
-
const headers = [];
|
|
30401
|
-
let i2 = 0;
|
|
30402
|
-
let sawEncoding = false;
|
|
30403
|
-
let isEncoding = false;
|
|
30404
|
-
let isContentLength = false;
|
|
30405
|
-
let isIntegrity = false;
|
|
30406
|
-
let integrity = void 0;
|
|
30407
|
-
while (i2 < headersBuffer.length - 4) {
|
|
30408
|
-
const size = readSize2(headersBuffer, i2);
|
|
30409
|
-
const h = headersBuffer.subarray(i2 + 4, i2 + size);
|
|
30410
|
-
if (isEncoding) {
|
|
30411
|
-
isEncoding = false;
|
|
30412
|
-
headers.push(Buffer.from("identity"));
|
|
30413
|
-
} else if (isContentLength) {
|
|
30414
|
-
isContentLength = false;
|
|
30415
|
-
i2 += size;
|
|
30416
|
-
continue;
|
|
30417
|
-
} else if (isIntegrity) {
|
|
30418
|
-
isIntegrity = false;
|
|
30419
|
-
integrity = h.toString();
|
|
30420
|
-
headers.push(h);
|
|
30421
|
-
} else {
|
|
30422
|
-
if (headers.length % 2 === 0) {
|
|
30423
|
-
if (h.toString().toLowerCase() === "content-length") {
|
|
30424
|
-
isContentLength = true;
|
|
30425
|
-
i2 += size;
|
|
30426
|
-
continue;
|
|
30427
|
-
}
|
|
30428
|
-
if (!sawEncoding && h.toString().toLowerCase() === "content-encoding") {
|
|
30429
|
-
sawEncoding = true;
|
|
30430
|
-
isEncoding = true;
|
|
30431
|
-
} else if (!integrity && h.toString().toLowerCase() === "integrity") {
|
|
30432
|
-
isIntegrity = true;
|
|
30433
|
-
}
|
|
30434
|
-
}
|
|
30435
|
-
headers.push(h);
|
|
30436
|
-
}
|
|
30437
|
-
i2 += size;
|
|
30438
|
-
}
|
|
30439
|
-
if (!sawEncoding) {
|
|
30440
|
-
headers.push(
|
|
30441
|
-
Buffer.from("content-encoding"),
|
|
30442
|
-
Buffer.from("identity")
|
|
30443
|
-
);
|
|
30444
|
-
}
|
|
30445
|
-
headers.push(
|
|
30446
|
-
Buffer.from("content-length"),
|
|
30447
|
-
Buffer.from(String(unz.byteLength))
|
|
30448
|
-
);
|
|
30449
|
-
const sb = buffer.subarray(4, 7);
|
|
30450
|
-
const chunks = [sb];
|
|
30451
|
-
let headLength = sb.byteLength + 4;
|
|
30452
|
-
for (const h of headers) {
|
|
30453
|
-
const hlBuf2 = Buffer.allocUnsafe(4);
|
|
30454
|
-
const hl = h.byteLength + 4;
|
|
30455
|
-
headLength += hl;
|
|
30456
|
-
hlBuf2.set(
|
|
30457
|
-
[
|
|
30458
|
-
hl >> 24 & 255,
|
|
30459
|
-
hl >> 16 & 255,
|
|
30460
|
-
hl >> 8 & 255,
|
|
30461
|
-
hl & 255
|
|
30462
|
-
],
|
|
30463
|
-
0
|
|
30464
|
-
);
|
|
30465
|
-
chunks.push(hlBuf2, h);
|
|
30466
|
-
}
|
|
30467
|
-
const hlBuf = Buffer.allocUnsafe(4);
|
|
30468
|
-
hlBuf.set(
|
|
30469
|
-
[
|
|
30470
|
-
headLength >> 24 & 255,
|
|
30471
|
-
headLength >> 16 & 255,
|
|
30472
|
-
headLength >> 8 & 255,
|
|
30473
|
-
headLength & 255
|
|
30474
|
-
],
|
|
30475
|
-
0
|
|
30476
|
-
);
|
|
30477
|
-
chunks.unshift(hlBuf);
|
|
30478
|
-
chunks.push(unz);
|
|
30479
|
-
cache.set(
|
|
30480
|
-
key,
|
|
30481
|
-
Buffer.concat(chunks, headLength + unz.length),
|
|
30482
|
-
{
|
|
30483
|
-
integrity
|
|
30484
|
-
}
|
|
30485
|
-
);
|
|
30486
|
-
}
|
|
30487
|
-
return true;
|
|
30488
|
-
})
|
|
30489
|
-
);
|
|
30490
|
-
await cache.promise();
|
|
30491
|
-
return results.some(Boolean);
|
|
30492
|
-
};
|
|
30493
|
-
if (isMain(process.argv[1])) {
|
|
30494
|
-
process.title = "vlt-cache-unzip";
|
|
30495
|
-
const path2 = process.argv.length === 2 ? void 0 : process.argv.at(-1);
|
|
30496
|
-
const res = await main(path2, process.stdin);
|
|
30497
|
-
if (!res) {
|
|
30498
|
-
process.exit(1);
|
|
30499
|
-
}
|
|
30500
|
-
}
|
|
30334
|
+
import { resolve as resolve7 } from "node:path";
|
|
30335
|
+
var __CODE_SPLIT_SCRIPT_NAME = resolve7(import.meta.dirname, "cache-unzip-src-unzip.js");
|
|
30501
30336
|
|
|
30502
30337
|
// ../../src/cache-unzip/src/index.ts
|
|
30503
30338
|
var isDeno = globalThis.Deno != void 0;
|
|
@@ -30629,8 +30464,8 @@ var Version = class _Version {
|
|
|
30629
30464
|
}
|
|
30630
30465
|
const parsed = re2.full.exec(version2);
|
|
30631
30466
|
if (!parsed) {
|
|
30632
|
-
const
|
|
30633
|
-
if (!
|
|
30467
|
+
const main2 = re2.main.exec(version2);
|
|
30468
|
+
if (!main2) {
|
|
30634
30469
|
throw invalidVersion(
|
|
30635
30470
|
version2,
|
|
30636
30471
|
"no Major.minor.patch tuple present"
|
|
@@ -31604,13 +31439,31 @@ var getOptions = (options) => ({
|
|
|
31604
31439
|
...options["git-host-archives"]
|
|
31605
31440
|
} : defaultGitHostArchives
|
|
31606
31441
|
});
|
|
31442
|
+
var protocolRE = /^([a-zA-Z][a-zA-Z0-9+-]+):/;
|
|
31443
|
+
var builtinProtocols = /* @__PURE__ */ new Set([
|
|
31444
|
+
"catalog",
|
|
31445
|
+
"workspace",
|
|
31446
|
+
"registry",
|
|
31447
|
+
"file",
|
|
31448
|
+
"http",
|
|
31449
|
+
"https",
|
|
31450
|
+
"git",
|
|
31451
|
+
"git+ssh",
|
|
31452
|
+
"git+http",
|
|
31453
|
+
"git+https",
|
|
31454
|
+
"git+file"
|
|
31455
|
+
]);
|
|
31456
|
+
var unknownProtocol = (str, options) => {
|
|
31457
|
+
const p = protocolRE.exec(str)?.[1];
|
|
31458
|
+
return p === void 0 || builtinProtocols.has(p) || p === options["default-registry-alias"] || options.registries[p] !== void 0 || options["git-hosts"][p] !== void 0 || options["jsr-registries"][p] !== void 0 ? void 0 : p;
|
|
31459
|
+
};
|
|
31607
31460
|
var startsWithSpecIdentifier = (spec, options) => spec.startsWith("/") || spec.startsWith("./") || spec.startsWith("../") || spec.startsWith("file:") || spec.startsWith("http:") || spec.startsWith("https:") || spec.startsWith("workspace:") || spec.startsWith("catalog:") || spec.startsWith("git@") || spec.startsWith("git://") || spec.startsWith("git+ssh://") || spec.startsWith("git+http://") || spec.startsWith("git+https://") || spec.startsWith("git+file://") || spec.startsWith("git@github.com") || spec.startsWith("registry:") || spec.startsWith("npm:") || spec.startsWith("jsr:") || spec.startsWith("gh:") || // anything that starts with a known git host key, or a
|
|
31608
31461
|
// custom registered registry protocol e.g: `github:`, `custom:`
|
|
31609
31462
|
[
|
|
31610
31463
|
...Object.keys(options["git-hosts"]),
|
|
31611
31464
|
...Object.keys(options.registries),
|
|
31612
31465
|
...Object.keys(options["jsr-registries"])
|
|
31613
|
-
].some((key) => spec.startsWith(`${key}:`));
|
|
31466
|
+
].some((key) => spec.startsWith(`${key}:`)) || unknownProtocol(spec, options) !== void 0;
|
|
31614
31467
|
var findFirstAt = (spec, hasScope) => spec.indexOf("@", hasScope ? 1 : 0);
|
|
31615
31468
|
var findGitIdentifier = (spec) => spec.indexOf("#") > 2;
|
|
31616
31469
|
var findFileIdentifier = (spec) => spec.includes("/");
|
|
@@ -31719,6 +31572,7 @@ var Spec = class _Spec {
|
|
|
31719
31572
|
assertPathSafeName(this.name, this.spec);
|
|
31720
31573
|
} else {
|
|
31721
31574
|
this.spec = spec;
|
|
31575
|
+
this.#assertKnownProtocol(spec);
|
|
31722
31576
|
if (!spec.startsWith("git@") && startsWithSpecIdentifier(spec, this.options) && spec.includes(":") && [
|
|
31723
31577
|
...Object.keys(this.options.registries),
|
|
31724
31578
|
...Object.keys(defaultRegistries)
|
|
@@ -31904,6 +31758,7 @@ var Spec = class _Spec {
|
|
|
31904
31758
|
this.spec = `${this.name}@${this.bareSpec}`;
|
|
31905
31759
|
return;
|
|
31906
31760
|
}
|
|
31761
|
+
this.#assertKnownProtocol(this.bareSpec);
|
|
31907
31762
|
if (!this.bareSpec.startsWith("./") && !this.bareSpec.startsWith("../") && this.options["git-hosts"].github) {
|
|
31908
31763
|
const hash2 = this.bareSpec.indexOf("#");
|
|
31909
31764
|
const up = hash2 === -1 ? this.bareSpec : this.bareSpec.substring(0, hash2);
|
|
@@ -32051,6 +31906,22 @@ var Spec = class _Spec {
|
|
|
32051
31906
|
this.spec = this.name + "@" + this.bareSpec;
|
|
32052
31907
|
return this.subspec;
|
|
32053
31908
|
}
|
|
31909
|
+
#assertKnownProtocol(str) {
|
|
31910
|
+
const proto = unknownProtocol(str, this.options);
|
|
31911
|
+
if (proto === void 0) return;
|
|
31912
|
+
throw this.#error(`Protocol ${proto}: is not defined`, {
|
|
31913
|
+
found: `${proto}:`,
|
|
31914
|
+
validOptions: [
|
|
31915
|
+
.../* @__PURE__ */ new Set([
|
|
31916
|
+
...builtinProtocols,
|
|
31917
|
+
this.options["default-registry-alias"],
|
|
31918
|
+
...Object.keys(this.options.registries),
|
|
31919
|
+
...Object.keys(this.options["git-hosts"]),
|
|
31920
|
+
...Object.keys(this.options["jsr-registries"])
|
|
31921
|
+
])
|
|
31922
|
+
].map((p) => `${p}:`)
|
|
31923
|
+
});
|
|
31924
|
+
}
|
|
32054
31925
|
#error(message, extra = {}) {
|
|
32055
31926
|
return error(message, { spec: this.spec, ...extra }, this.#error);
|
|
32056
31927
|
}
|
|
@@ -32270,7 +32141,7 @@ var SpawnPromise = class extends Promise {
|
|
|
32270
32141
|
Object.assign(errorResult, extra);
|
|
32271
32142
|
rej(error("command failed", errorResult));
|
|
32272
32143
|
};
|
|
32273
|
-
const
|
|
32144
|
+
const resolve11 = (status, signal) => {
|
|
32274
32145
|
const stdio = stdioResult(stdout, stderr, opts);
|
|
32275
32146
|
const successResult = {
|
|
32276
32147
|
command,
|
|
@@ -32291,7 +32162,7 @@ var SpawnPromise = class extends Promise {
|
|
|
32291
32162
|
if ((status || signal) && !opts.acceptFail) {
|
|
32292
32163
|
reject(void 0, status, signal);
|
|
32293
32164
|
} else {
|
|
32294
|
-
|
|
32165
|
+
resolve11(status, signal);
|
|
32295
32166
|
}
|
|
32296
32167
|
});
|
|
32297
32168
|
});
|
|
@@ -32477,9 +32348,9 @@ var urlOpen = async (url, { signal } = {}) => {
|
|
|
32477
32348
|
|
|
32478
32349
|
// ../../src/xdg/src/index.ts
|
|
32479
32350
|
import { homedir, tmpdir as tmpdir2 } from "node:os";
|
|
32480
|
-
import { resolve as
|
|
32351
|
+
import { resolve as resolve8 } from "node:path";
|
|
32481
32352
|
var root = homedir();
|
|
32482
|
-
var path = (p) =>
|
|
32353
|
+
var path = (p) => resolve8(root, p);
|
|
32483
32354
|
var defaults = process.platform === "darwin" ? (which2) => {
|
|
32484
32355
|
switch (which2) {
|
|
32485
32356
|
case "config":
|
|
@@ -32491,7 +32362,7 @@ var defaults = process.platform === "darwin" ? (which2) => {
|
|
|
32491
32362
|
case "state":
|
|
32492
32363
|
return path("Library/State");
|
|
32493
32364
|
case "runtime":
|
|
32494
|
-
return
|
|
32365
|
+
return resolve8(
|
|
32495
32366
|
tmpdir2(),
|
|
32496
32367
|
/* c8 ignore next */
|
|
32497
32368
|
String(process.getuid?.() ?? ""),
|
|
@@ -32503,15 +32374,15 @@ var defaults = process.platform === "darwin" ? (which2) => {
|
|
|
32503
32374
|
const lad = process.env.LOCALAPPDATA ?? path("AppData/Local");
|
|
32504
32375
|
switch (which2) {
|
|
32505
32376
|
case "config":
|
|
32506
|
-
return
|
|
32377
|
+
return resolve8(ad, "xdg.config");
|
|
32507
32378
|
case "cache":
|
|
32508
|
-
return
|
|
32379
|
+
return resolve8(lad, "xdg.cache");
|
|
32509
32380
|
case "data":
|
|
32510
|
-
return
|
|
32381
|
+
return resolve8(ad, "xdg.data");
|
|
32511
32382
|
case "state":
|
|
32512
|
-
return
|
|
32383
|
+
return resolve8(lad, "xdg.state");
|
|
32513
32384
|
case "runtime":
|
|
32514
|
-
return
|
|
32385
|
+
return resolve8(tmpdir2(), "xdg.run");
|
|
32515
32386
|
}
|
|
32516
32387
|
} : (which2) => {
|
|
32517
32388
|
switch (which2) {
|
|
@@ -32524,7 +32395,7 @@ var defaults = process.platform === "darwin" ? (which2) => {
|
|
|
32524
32395
|
case "state":
|
|
32525
32396
|
return path(".local/state");
|
|
32526
32397
|
case "runtime":
|
|
32527
|
-
return
|
|
32398
|
+
return resolve8(
|
|
32528
32399
|
tmpdir2(),
|
|
32529
32400
|
/* c8 ignore next */
|
|
32530
32401
|
String(process.getuid?.() ?? ""),
|
|
@@ -32552,31 +32423,31 @@ var XDG = class {
|
|
|
32552
32423
|
this.name = name;
|
|
32553
32424
|
}
|
|
32554
32425
|
config(p = "") {
|
|
32555
|
-
return
|
|
32426
|
+
return resolve8(this.base.config, this.name, p);
|
|
32556
32427
|
}
|
|
32557
32428
|
cache(p = "") {
|
|
32558
|
-
return
|
|
32429
|
+
return resolve8(this.base.cache, this.name, p);
|
|
32559
32430
|
}
|
|
32560
32431
|
data(p = "") {
|
|
32561
|
-
return
|
|
32432
|
+
return resolve8(this.base.data, this.name, p);
|
|
32562
32433
|
}
|
|
32563
32434
|
state(p = "") {
|
|
32564
|
-
return
|
|
32435
|
+
return resolve8(this.base.state, this.name, p);
|
|
32565
32436
|
}
|
|
32566
32437
|
runtime(p = "") {
|
|
32567
|
-
return
|
|
32438
|
+
return resolve8(this.base.runtime, this.name, p);
|
|
32568
32439
|
}
|
|
32569
32440
|
};
|
|
32570
32441
|
|
|
32571
32442
|
// ../../src/registry-client/src/index.ts
|
|
32572
32443
|
import { randomUUID } from "node:crypto";
|
|
32573
32444
|
import { availableParallelism } from "node:os";
|
|
32574
|
-
import { dirname as dirname4, resolve as
|
|
32445
|
+
import { dirname as dirname4, resolve as resolve10 } from "node:path";
|
|
32575
32446
|
import { setTimeout as setTimeout3 } from "node:timers/promises";
|
|
32576
32447
|
|
|
32577
32448
|
// ../../node_modules/.vlt/~npm~package-json-from-dist@1.0.1/node_modules/package-json-from-dist/dist/esm/index.js
|
|
32578
32449
|
import { readFileSync as readFileSync2 } from "node:fs";
|
|
32579
|
-
import { dirname as dirname2, resolve as
|
|
32450
|
+
import { dirname as dirname2, resolve as resolve9, sep as sep2 } from "node:path";
|
|
32580
32451
|
import { fileURLToPath } from "node:url";
|
|
32581
32452
|
var NM = `${sep2}node_modules${sep2}`;
|
|
32582
32453
|
var STORE = `.store${sep2}`;
|
|
@@ -32592,17 +32463,17 @@ var findPackageJson = (from, pathFromSrc = "../package.json") => {
|
|
|
32592
32463
|
if (pkgDir.startsWith(STORE)) {
|
|
32593
32464
|
const pkg = pkgDir.indexOf(PKG, STORE.length);
|
|
32594
32465
|
if (pkg) {
|
|
32595
|
-
return
|
|
32466
|
+
return resolve9(nm, pkgDir.substring(0, pkg + PKG.length), "package.json");
|
|
32596
32467
|
}
|
|
32597
32468
|
}
|
|
32598
32469
|
const pkgName = pkgDir.startsWith("@") ? pkgDir.split(sep2, 2).join(sep2) : String(pkgDir.split(sep2)[0]);
|
|
32599
|
-
return
|
|
32470
|
+
return resolve9(nm, pkgName, "package.json");
|
|
32600
32471
|
} else {
|
|
32601
32472
|
const d4 = __dirname.lastIndexOf(DIST);
|
|
32602
32473
|
if (d4 !== -1) {
|
|
32603
|
-
return
|
|
32474
|
+
return resolve9(__dirname.substring(0, d4), "package.json");
|
|
32604
32475
|
} else {
|
|
32605
|
-
return
|
|
32476
|
+
return resolve9(__dirname, pathFromSrc);
|
|
32606
32477
|
}
|
|
32607
32478
|
}
|
|
32608
32479
|
};
|
|
@@ -32826,7 +32697,7 @@ var getTokenByURL = async (requestUrl, identity) => {
|
|
|
32826
32697
|
var import_cache_control_parser = __toESM(require_dist(), 1);
|
|
32827
32698
|
import { createHash as createHash2 } from "node:crypto";
|
|
32828
32699
|
import { inspect as inspect2 } from "node:util";
|
|
32829
|
-
import { gunzipSync
|
|
32700
|
+
import { gunzipSync } from "node:zlib";
|
|
32830
32701
|
|
|
32831
32702
|
// ../../src/registry-client/src/string-encoding.ts
|
|
32832
32703
|
var decoder = new TextDecoder();
|
|
@@ -32872,13 +32743,13 @@ var setRawHeader = (headers, key, value) => {
|
|
|
32872
32743
|
};
|
|
32873
32744
|
|
|
32874
32745
|
// ../../src/registry-client/src/cache-entry.ts
|
|
32875
|
-
var
|
|
32876
|
-
var
|
|
32877
|
-
var
|
|
32746
|
+
var MAX_DECOMPRESSION_RATIO = 1e3;
|
|
32747
|
+
var defaultMaxUnpackedBytes = 2 * 1024 * 1024 * 1024;
|
|
32748
|
+
var parseMaxUnpackedBytes = (raw) => {
|
|
32878
32749
|
const n7 = Number(raw);
|
|
32879
|
-
return Number.isFinite(n7) && n7 >= 1 ? Math.floor(n7) :
|
|
32750
|
+
return Number.isFinite(n7) && n7 >= 1 ? Math.floor(n7) : defaultMaxUnpackedBytes;
|
|
32880
32751
|
};
|
|
32881
|
-
var
|
|
32752
|
+
var maxUnpackedBytes = parseMaxUnpackedBytes(
|
|
32882
32753
|
process.env.VLT_TAR_MAX_UNPACKED_BYTES
|
|
32883
32754
|
);
|
|
32884
32755
|
var readSize = (buf, offset) => {
|
|
@@ -32915,6 +32786,7 @@ var CacheEntry = class _CacheEntry {
|
|
|
32915
32786
|
#trustIntegrity;
|
|
32916
32787
|
#staleWhileRevalidateFactor;
|
|
32917
32788
|
#fromCache = false;
|
|
32789
|
+
#headSize;
|
|
32918
32790
|
constructor(statusCode, headers, {
|
|
32919
32791
|
body,
|
|
32920
32792
|
integrity,
|
|
@@ -33057,6 +32929,13 @@ var CacheEntry = class _CacheEntry {
|
|
|
33057
32929
|
get fromCache() {
|
|
33058
32930
|
return this.#fromCache;
|
|
33059
32931
|
}
|
|
32932
|
+
/**
|
|
32933
|
+
* Byte length of the encoded head (4-byte length prefix + status +
|
|
32934
|
+
* headers). Set when decoded from cache or after `encodeHead()`.
|
|
32935
|
+
*/
|
|
32936
|
+
get headSize() {
|
|
32937
|
+
return this.#headSize;
|
|
32938
|
+
}
|
|
33060
32939
|
get statusCode() {
|
|
33061
32940
|
return this.#statusCode;
|
|
33062
32941
|
}
|
|
@@ -33199,12 +33078,12 @@ var CacheEntry = class _CacheEntry {
|
|
|
33199
33078
|
if (this._body.length === 0)
|
|
33200
33079
|
throw error("Invalid buffer, cant unzip");
|
|
33201
33080
|
const max = Math.min(
|
|
33202
|
-
|
|
33203
|
-
this._body.length *
|
|
33081
|
+
maxUnpackedBytes,
|
|
33082
|
+
this._body.length * MAX_DECOMPRESSION_RATIO
|
|
33204
33083
|
);
|
|
33205
33084
|
let b;
|
|
33206
33085
|
try {
|
|
33207
|
-
b =
|
|
33086
|
+
b = gunzipSync(this._body, { maxOutputLength: max });
|
|
33208
33087
|
} catch (er) {
|
|
33209
33088
|
throw er.code === "ERR_BUFFER_TOO_LARGE" ? error("cache entry exceeds maximum unpacked size", {
|
|
33210
33089
|
found: this._body.length,
|
|
@@ -33241,19 +33120,10 @@ var CacheEntry = class _CacheEntry {
|
|
|
33241
33120
|
this.#json = obj;
|
|
33242
33121
|
return obj;
|
|
33243
33122
|
}
|
|
33244
|
-
|
|
33245
|
-
|
|
33246
|
-
* and this static method will decode it into a CacheEntry representing
|
|
33247
|
-
* the cached response.
|
|
33248
|
-
*/
|
|
33249
|
-
static decode(buffer) {
|
|
33250
|
-
if (buffer.length < 4) {
|
|
33251
|
-
return emptyCacheEntry;
|
|
33252
|
-
}
|
|
33123
|
+
static #parseHead(buffer) {
|
|
33124
|
+
if (buffer.length < 4) return void 0;
|
|
33253
33125
|
const headSize = readSize(buffer, 0);
|
|
33254
|
-
if (buffer.length < headSize)
|
|
33255
|
-
return emptyCacheEntry;
|
|
33256
|
-
}
|
|
33126
|
+
if (buffer.length < headSize) return void 0;
|
|
33257
33127
|
const statusCode = Number(getDecodedValue(buffer.subarray(4, 7)));
|
|
33258
33128
|
const headersBuffer = buffer.subarray(7, headSize);
|
|
33259
33129
|
const headers = [];
|
|
@@ -33272,22 +33142,51 @@ var CacheEntry = class _CacheEntry {
|
|
|
33272
33142
|
headers.push(val);
|
|
33273
33143
|
i2 += size;
|
|
33274
33144
|
}
|
|
33275
|
-
|
|
33145
|
+
return { statusCode, headers, integrity, headSize };
|
|
33146
|
+
}
|
|
33147
|
+
/**
|
|
33148
|
+
* Decode only the status/headers from an encoded cache buffer.
|
|
33149
|
+
* The body is not read; `headSize` records how many bytes the head
|
|
33150
|
+
* occupies so a later `encodeHead()` can be patched in place.
|
|
33151
|
+
*/
|
|
33152
|
+
static decodeHead(buffer) {
|
|
33153
|
+
const parsed = _CacheEntry.#parseHead(buffer);
|
|
33154
|
+
if (!parsed) return emptyCacheEntry;
|
|
33155
|
+
const c = new _CacheEntry(parsed.statusCode, parsed.headers, {
|
|
33156
|
+
body: new Uint8Array(0),
|
|
33157
|
+
integrity: parsed.integrity,
|
|
33158
|
+
trustIntegrity: true
|
|
33159
|
+
});
|
|
33160
|
+
c.#fromCache = true;
|
|
33161
|
+
c.#headSize = parsed.headSize;
|
|
33162
|
+
return c;
|
|
33163
|
+
}
|
|
33164
|
+
/**
|
|
33165
|
+
* Pass the contents of a @vltpkg/cache.Cache object as a buffer,
|
|
33166
|
+
* and this static method will decode it into a CacheEntry representing
|
|
33167
|
+
* the cached response.
|
|
33168
|
+
*/
|
|
33169
|
+
static decode(buffer, options = {}) {
|
|
33170
|
+
const parsed = _CacheEntry.#parseHead(buffer);
|
|
33171
|
+
if (!parsed) return emptyCacheEntry;
|
|
33172
|
+
const body = buffer.subarray(parsed.headSize);
|
|
33276
33173
|
const c = new _CacheEntry(
|
|
33277
|
-
statusCode,
|
|
33174
|
+
parsed.statusCode,
|
|
33278
33175
|
setRawHeader(
|
|
33279
|
-
headers,
|
|
33176
|
+
parsed.headers,
|
|
33280
33177
|
"content-length",
|
|
33281
33178
|
String(body.byteLength)
|
|
33282
33179
|
),
|
|
33283
33180
|
{
|
|
33284
33181
|
body,
|
|
33285
|
-
integrity,
|
|
33182
|
+
integrity: parsed.integrity,
|
|
33286
33183
|
trustIntegrity: true,
|
|
33287
|
-
contentLength: body.byteLength
|
|
33184
|
+
contentLength: body.byteLength,
|
|
33185
|
+
...options
|
|
33288
33186
|
}
|
|
33289
33187
|
);
|
|
33290
33188
|
c.#fromCache = true;
|
|
33189
|
+
c.#headSize = parsed.headSize;
|
|
33291
33190
|
try {
|
|
33292
33191
|
if (c.isJSON) {
|
|
33293
33192
|
c.unzip();
|
|
@@ -33305,42 +33204,49 @@ var CacheEntry = class _CacheEntry {
|
|
|
33305
33204
|
return gzipBytes[0] === 31 && gzipBytes[1] === 139;
|
|
33306
33205
|
}
|
|
33307
33206
|
/**
|
|
33308
|
-
* Encode
|
|
33207
|
+
* Encode status + headers (no body) as they appear at the start of
|
|
33208
|
+
* an on-disk cache file.
|
|
33309
33209
|
*/
|
|
33310
|
-
|
|
33311
|
-
if (this.isJSON) this.json();
|
|
33210
|
+
encodeHead() {
|
|
33312
33211
|
const statusStr = String(this.#statusCode);
|
|
33313
33212
|
const statusBytes = getEncondedValue(statusStr);
|
|
33314
33213
|
let headLength = 4 + statusBytes.byteLength;
|
|
33315
33214
|
for (const h of this.#headers) headLength += 4 + h.byteLength;
|
|
33316
|
-
const
|
|
33317
|
-
|
|
33318
|
-
|
|
33319
|
-
|
|
33320
|
-
|
|
33321
|
-
const headerChunks = [];
|
|
33322
|
-
for (const h of this.#headers) {
|
|
33323
|
-
const l = headLenBytes.byteLength + h.byteLength;
|
|
33324
|
-
const lb = new Uint8Array(4);
|
|
33325
|
-
lb[0] = l >> 24 & 255;
|
|
33326
|
-
lb[1] = l >> 16 & 255;
|
|
33327
|
-
lb[2] = l >> 8 & 255;
|
|
33328
|
-
lb[3] = l & 255;
|
|
33329
|
-
headerChunks.push(lb, h);
|
|
33330
|
-
}
|
|
33331
|
-
const total = headLenBytes.byteLength + statusBytes.byteLength + headerChunks.reduce((n7, b) => n7 + b.byteLength, 0) + this._body.byteLength;
|
|
33332
|
-
const outBuffer = new ArrayBuffer(total);
|
|
33333
|
-
const out = Buffer.from(outBuffer, 0, total);
|
|
33215
|
+
const out = Buffer.from(
|
|
33216
|
+
new ArrayBuffer(headLength),
|
|
33217
|
+
0,
|
|
33218
|
+
headLength
|
|
33219
|
+
);
|
|
33334
33220
|
let off = 0;
|
|
33335
|
-
out
|
|
33336
|
-
off
|
|
33221
|
+
out[off++] = headLength >> 24 & 255;
|
|
33222
|
+
out[off++] = headLength >> 16 & 255;
|
|
33223
|
+
out[off++] = headLength >> 8 & 255;
|
|
33224
|
+
out[off++] = headLength & 255;
|
|
33337
33225
|
out.set(statusBytes, off);
|
|
33338
33226
|
off += statusBytes.byteLength;
|
|
33339
|
-
for (const
|
|
33340
|
-
|
|
33341
|
-
off
|
|
33342
|
-
|
|
33343
|
-
|
|
33227
|
+
for (const h of this.#headers) {
|
|
33228
|
+
const l = 4 + h.byteLength;
|
|
33229
|
+
out[off++] = l >> 24 & 255;
|
|
33230
|
+
out[off++] = l >> 16 & 255;
|
|
33231
|
+
out[off++] = l >> 8 & 255;
|
|
33232
|
+
out[off++] = l & 255;
|
|
33233
|
+
out.set(h, off);
|
|
33234
|
+
off += h.byteLength;
|
|
33235
|
+
}
|
|
33236
|
+
this.#headSize = headLength;
|
|
33237
|
+
return out;
|
|
33238
|
+
}
|
|
33239
|
+
/**
|
|
33240
|
+
* Encode the entry as a single Buffer for writing to the cache
|
|
33241
|
+
*/
|
|
33242
|
+
encode() {
|
|
33243
|
+
if (this.isJSON) this.json();
|
|
33244
|
+
const head = this.encodeHead();
|
|
33245
|
+
const body = this._body;
|
|
33246
|
+
const total = head.byteLength + body.byteLength;
|
|
33247
|
+
const out = Buffer.from(new ArrayBuffer(total), 0, total);
|
|
33248
|
+
out.set(head, 0);
|
|
33249
|
+
out.set(body, head.byteLength);
|
|
33344
33250
|
return out;
|
|
33345
33251
|
}
|
|
33346
33252
|
};
|
|
@@ -33392,7 +33298,7 @@ var register2 = (path2, method, url) => {
|
|
|
33392
33298
|
var handleBeforeExit2 = () => {
|
|
33393
33299
|
const compileCacheDir = module2.getCompileCacheDir();
|
|
33394
33300
|
for (const [path2, r] of registered2) {
|
|
33395
|
-
if (!r.size)
|
|
33301
|
+
if (!r.size) continue;
|
|
33396
33302
|
const env = { ...process.env };
|
|
33397
33303
|
if (compileCacheDir) env.NODE_COMPILE_CACHE ??= compileCacheDir;
|
|
33398
33304
|
const args = [];
|
|
@@ -33451,7 +33357,7 @@ var getWebAuthChallenge = (o) => {
|
|
|
33451
33357
|
|
|
33452
33358
|
// ../../src/registry-client/src/otplease.ts
|
|
33453
33359
|
import { createInterface } from "node:readline/promises";
|
|
33454
|
-
import { gunzipSync as
|
|
33360
|
+
import { gunzipSync as gunzipSync2 } from "node:zlib";
|
|
33455
33361
|
var log2 = (msg) => console.error(msg);
|
|
33456
33362
|
var question = async (text) => {
|
|
33457
33363
|
const rl = createInterface({
|
|
@@ -33468,7 +33374,7 @@ var responseBodyText = async (response) => {
|
|
|
33468
33374
|
response.headers["content-encoding"] ?? ""
|
|
33469
33375
|
);
|
|
33470
33376
|
if (/\bgzip\b/i.test(contentEncoding)) {
|
|
33471
|
-
return
|
|
33377
|
+
return gunzipSync2(await response.body.arrayBuffer()).toString();
|
|
33472
33378
|
}
|
|
33473
33379
|
return await response.body.text();
|
|
33474
33380
|
};
|
|
@@ -33609,11 +33515,38 @@ var setCacheHeaders = (options, entry) => {
|
|
|
33609
33515
|
// ../../src/registry-client/src/token-response.ts
|
|
33610
33516
|
var getTokenResponse = (b) => !!b && typeof b === "object" && "token" in b && typeof b.token === "string" && b.token ? { token: b.token } : void 0;
|
|
33611
33517
|
|
|
33518
|
+
// ../../src/registry-client/src/response.ts
|
|
33519
|
+
var collectHeaders = (response) => {
|
|
33520
|
+
const h = [];
|
|
33521
|
+
for (const [key, value] of Object.entries(response.headers)) {
|
|
33522
|
+
if (Array.isArray(value)) {
|
|
33523
|
+
h.push(
|
|
33524
|
+
getEncondedValue(key),
|
|
33525
|
+
getEncondedValue(value.join(", "))
|
|
33526
|
+
);
|
|
33527
|
+
} else if (typeof value === "string") {
|
|
33528
|
+
h.push(getEncondedValue(key), getEncondedValue(value));
|
|
33529
|
+
}
|
|
33530
|
+
}
|
|
33531
|
+
return h;
|
|
33532
|
+
};
|
|
33533
|
+
var readBody = async (response, entry) => {
|
|
33534
|
+
response.body.on(
|
|
33535
|
+
"data",
|
|
33536
|
+
(chunk) => entry.addBody(chunk)
|
|
33537
|
+
);
|
|
33538
|
+
return await new Promise((res, rej) => {
|
|
33539
|
+
response.body.on("error", rej);
|
|
33540
|
+
response.body.on("end", () => res(entry));
|
|
33541
|
+
});
|
|
33542
|
+
};
|
|
33543
|
+
|
|
33612
33544
|
// ../../src/registry-client/src/oidc.ts
|
|
33613
33545
|
var import_undici2 = __toESM(require_undici(), 1);
|
|
33614
33546
|
|
|
33615
33547
|
// ../../src/registry-client/src/index.ts
|
|
33616
33548
|
var isCacheableMethod = (m2) => m2 === "GET" || m2 === "HEAD";
|
|
33549
|
+
var cacheKey = (method, url) => `${method !== "GET" ? method + " " : ""}${url}`;
|
|
33617
33550
|
var { version } = loadPackageJson(
|
|
33618
33551
|
import.meta.filename,
|
|
33619
33552
|
"registry-client-package.json"
|
|
@@ -33664,7 +33597,7 @@ var RegistryClient = class {
|
|
|
33664
33597
|
} = options;
|
|
33665
33598
|
this.identity = identity;
|
|
33666
33599
|
this.staleWhileRevalidateFactor = staleWhileRevalidateFactor;
|
|
33667
|
-
const path2 =
|
|
33600
|
+
const path2 = resolve10(cache, "registry-client");
|
|
33668
33601
|
this.cache = new Cache({
|
|
33669
33602
|
path: path2,
|
|
33670
33603
|
maxSize: parseCacheMaxSize(process.env.VLT_CACHE_MAX_SIZE),
|
|
@@ -33784,7 +33717,9 @@ var RegistryClient = class {
|
|
|
33784
33717
|
#decodeCached(buffer) {
|
|
33785
33718
|
const hit = this.#decoded.get(buffer);
|
|
33786
33719
|
if (hit) return hit;
|
|
33787
|
-
const entry = CacheEntry.decode(buffer
|
|
33720
|
+
const entry = CacheEntry.decode(buffer, {
|
|
33721
|
+
"stale-while-revalidate-factor": this.staleWhileRevalidateFactor
|
|
33722
|
+
});
|
|
33788
33723
|
if (!entry.statusCode) return void 0;
|
|
33789
33724
|
if (entry.isJSON) {
|
|
33790
33725
|
try {
|
|
@@ -33832,7 +33767,7 @@ var RegistryClient = class {
|
|
|
33832
33767
|
const m2 = isCacheableMethod(method) ? method : void 0;
|
|
33833
33768
|
const { useCache = !!m2 } = options;
|
|
33834
33769
|
signal?.throwIfAborted();
|
|
33835
|
-
const key =
|
|
33770
|
+
const key = cacheKey(method, u2);
|
|
33836
33771
|
const buffer = useCache ? await this.cache.fetch(key, { context: { integrity } }) : void 0;
|
|
33837
33772
|
const entry = buffer ? this.#decodeCached(buffer) : void 0;
|
|
33838
33773
|
if (entry?.valid) {
|
|
@@ -33941,17 +33876,7 @@ var RegistryClient = class {
|
|
|
33941
33876
|
consumedBody = otpResult.bodyConsumed;
|
|
33942
33877
|
}
|
|
33943
33878
|
}
|
|
33944
|
-
const h =
|
|
33945
|
-
for (const [key, value] of Object.entries(response.headers)) {
|
|
33946
|
-
if (Array.isArray(value)) {
|
|
33947
|
-
h.push(
|
|
33948
|
-
getEncondedValue(key),
|
|
33949
|
-
getEncondedValue(value.join(", "))
|
|
33950
|
-
);
|
|
33951
|
-
} else if (typeof value === "string") {
|
|
33952
|
-
h.push(getEncondedValue(key), getEncondedValue(value));
|
|
33953
|
-
}
|
|
33954
|
-
}
|
|
33879
|
+
const h = collectHeaders(response);
|
|
33955
33880
|
const { integrity, trustIntegrity } = options;
|
|
33956
33881
|
const contentLength = consumedBody !== void 0 ? consumedBody.length : response.headers["content-length"] ? Number(response.headers["content-length"]) : (
|
|
33957
33882
|
/* c8 ignore next */
|
|
@@ -33982,21 +33907,148 @@ var RegistryClient = class {
|
|
|
33982
33907
|
}
|
|
33983
33908
|
return result;
|
|
33984
33909
|
}
|
|
33985
|
-
response
|
|
33986
|
-
|
|
33987
|
-
|
|
33988
|
-
|
|
33989
|
-
|
|
33990
|
-
|
|
33991
|
-
|
|
33992
|
-
|
|
33910
|
+
return await readBody(response, result);
|
|
33911
|
+
}
|
|
33912
|
+
};
|
|
33913
|
+
|
|
33914
|
+
// ../../src/registry-client/src/revalidate-entry.ts
|
|
33915
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
33916
|
+
import { open, readFile as readFile3 } from "node:fs/promises";
|
|
33917
|
+
var patchDateFallback = async (rc, file, key, head) => {
|
|
33918
|
+
const date = head.getHeaderString("date");
|
|
33919
|
+
if (!date) return;
|
|
33920
|
+
const full = await readFile3(file);
|
|
33921
|
+
const fullEntry = CacheEntry.decode(full);
|
|
33922
|
+
if (!fullEntry.statusCode) return;
|
|
33923
|
+
fullEntry.setHeader("date", date);
|
|
33924
|
+
const buf = fullEntry.encode();
|
|
33925
|
+
rc.cache.set(
|
|
33926
|
+
key,
|
|
33927
|
+
Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength),
|
|
33928
|
+
{ integrity: fullEntry.integrity }
|
|
33929
|
+
);
|
|
33930
|
+
};
|
|
33931
|
+
var readHead = async (fh) => {
|
|
33932
|
+
const sizeBuf = Buffer.alloc(4);
|
|
33933
|
+
const { bytesRead } = await fh.read(sizeBuf, 0, 4, 0);
|
|
33934
|
+
if (bytesRead < 4) return;
|
|
33935
|
+
const headSize = sizeBuf.readUInt32BE(0);
|
|
33936
|
+
if (headSize < 7) return;
|
|
33937
|
+
const headBuf = Buffer.alloc(headSize);
|
|
33938
|
+
sizeBuf.copy(headBuf, 0, 0, 4);
|
|
33939
|
+
const { bytesRead: n7 } = await fh.read(headBuf, 4, headSize - 4, 4);
|
|
33940
|
+
if (n7 < headSize - 4) return;
|
|
33941
|
+
const entry = CacheEntry.decodeHead(headBuf);
|
|
33942
|
+
return entry.statusCode ? entry : void 0;
|
|
33943
|
+
};
|
|
33944
|
+
var revalidateEntry = async (rc, method, url) => {
|
|
33945
|
+
try {
|
|
33946
|
+
const u2 = typeof url === "string" ? new URL(url) : url;
|
|
33947
|
+
const key = cacheKey(method, u2);
|
|
33948
|
+
const file = rc.cache.path(key);
|
|
33949
|
+
let fh;
|
|
33950
|
+
try {
|
|
33951
|
+
fh = await open(file, "r+");
|
|
33952
|
+
const entry = await readHead(fh);
|
|
33953
|
+
if (!entry) return;
|
|
33954
|
+
const origHeadSize = entry.headSize;
|
|
33955
|
+
const options = {
|
|
33956
|
+
method,
|
|
33957
|
+
origin: u2.origin
|
|
33958
|
+
};
|
|
33959
|
+
options.path = u2.pathname.replace(/\/+$/, "") + u2.search;
|
|
33960
|
+
options.headers = addHeader(
|
|
33961
|
+
addHeader(
|
|
33962
|
+
addHeader(
|
|
33963
|
+
options.headers,
|
|
33964
|
+
"accept-encoding",
|
|
33965
|
+
"gzip;q=1.0, identity;q=0.5"
|
|
33966
|
+
),
|
|
33967
|
+
"user-agent",
|
|
33968
|
+
userAgent
|
|
33969
|
+
),
|
|
33970
|
+
"npm-session",
|
|
33971
|
+
randomUUID2()
|
|
33972
|
+
);
|
|
33973
|
+
setCacheHeaders(options, entry);
|
|
33974
|
+
options.headers = addHeader(
|
|
33975
|
+
options.headers,
|
|
33976
|
+
"authorization",
|
|
33977
|
+
await getTokenByURL(String(u2), rc.identity)
|
|
33978
|
+
);
|
|
33979
|
+
const response = await rc.agent.request(
|
|
33980
|
+
options
|
|
33981
|
+
);
|
|
33982
|
+
if (handleCacheHitResponse(response, entry)) {
|
|
33983
|
+
const newHead = entry.encodeHead();
|
|
33984
|
+
if (newHead.byteLength === origHeadSize) {
|
|
33985
|
+
await fh.write(newHead, 0, newHead.byteLength, 0);
|
|
33986
|
+
return;
|
|
33987
|
+
}
|
|
33988
|
+
await fh.close();
|
|
33989
|
+
fh = void 0;
|
|
33990
|
+
await patchDateFallback(rc, file, key, entry);
|
|
33991
|
+
return;
|
|
33992
|
+
}
|
|
33993
|
+
if (response.statusCode === 200 && method === "GET") {
|
|
33994
|
+
const result = new CacheEntry(
|
|
33995
|
+
response.statusCode,
|
|
33996
|
+
collectHeaders(response),
|
|
33997
|
+
{
|
|
33998
|
+
"stale-while-revalidate-factor": rc.staleWhileRevalidateFactor,
|
|
33999
|
+
contentLength: response.headers["content-length"] ? Number(response.headers["content-length"]) : void 0
|
|
34000
|
+
}
|
|
34001
|
+
);
|
|
34002
|
+
await readBody(response, result);
|
|
34003
|
+
result.unzip();
|
|
34004
|
+
const buf = result.encode();
|
|
34005
|
+
rc.cache.set(
|
|
34006
|
+
key,
|
|
34007
|
+
Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength),
|
|
34008
|
+
{ integrity: result.integrity }
|
|
34009
|
+
);
|
|
34010
|
+
return;
|
|
34011
|
+
}
|
|
34012
|
+
const status = response.statusCode;
|
|
34013
|
+
if (status === 301 || status === 302 || status === 303 || status === 307 || status === 308) {
|
|
34014
|
+
response.body.resume();
|
|
34015
|
+
await fh.close();
|
|
34016
|
+
fh = void 0;
|
|
34017
|
+
await rc.request(u2, { method, staleWhileRevalidate: false });
|
|
34018
|
+
return;
|
|
34019
|
+
}
|
|
34020
|
+
response.body.resume();
|
|
34021
|
+
} finally {
|
|
34022
|
+
await fh?.close();
|
|
34023
|
+
}
|
|
34024
|
+
} catch {
|
|
33993
34025
|
}
|
|
33994
34026
|
};
|
|
33995
34027
|
|
|
33996
34028
|
// ../../src/registry-client/src/revalidate.ts
|
|
33997
34029
|
var __CODE_SPLIT_SCRIPT_NAME2 = import.meta.filename;
|
|
33998
|
-
var
|
|
33999
|
-
var
|
|
34030
|
+
var isMain = (path2) => path2 === __CODE_SPLIT_SCRIPT_NAME2 || path2 === pathToFileURL(__CODE_SPLIT_SCRIPT_NAME2).toString();
|
|
34031
|
+
var defaultConcurrency = 6;
|
|
34032
|
+
var revalidateConcurrency = (raw) => {
|
|
34033
|
+
const n7 = Number(raw);
|
|
34034
|
+
return Number.isFinite(n7) && n7 >= 1 ? Math.min(32, Math.floor(n7)) : defaultConcurrency;
|
|
34035
|
+
};
|
|
34036
|
+
var runPool = async (reqs, concurrency, fn) => {
|
|
34037
|
+
let next = 0;
|
|
34038
|
+
const n7 = Math.min(concurrency, reqs.length);
|
|
34039
|
+
await Promise.all(
|
|
34040
|
+
Array.from({ length: n7 }, async () => {
|
|
34041
|
+
for (; ; ) {
|
|
34042
|
+
const i2 = next++;
|
|
34043
|
+
if (i2 >= reqs.length) return;
|
|
34044
|
+
const req = reqs[i2];
|
|
34045
|
+
if (req === void 0) return;
|
|
34046
|
+
await fn(req[0], req[1]);
|
|
34047
|
+
}
|
|
34048
|
+
})
|
|
34049
|
+
);
|
|
34050
|
+
};
|
|
34051
|
+
var main = async (cache, input = process.stdin) => {
|
|
34000
34052
|
if (!cache) {
|
|
34001
34053
|
return false;
|
|
34002
34054
|
}
|
|
@@ -34023,27 +34075,28 @@ var main2 = async (cache, input = process.stdin) => {
|
|
|
34023
34075
|
return false;
|
|
34024
34076
|
}
|
|
34025
34077
|
const rc = new RegistryClient({ cache });
|
|
34026
|
-
await
|
|
34027
|
-
reqs
|
|
34028
|
-
|
|
34029
|
-
|
|
34030
|
-
staleWhileRevalidate: false
|
|
34031
|
-
});
|
|
34032
|
-
})
|
|
34078
|
+
await runPool(
|
|
34079
|
+
reqs,
|
|
34080
|
+
revalidateConcurrency(process.env.VLT_REVALIDATE_CONCURRENCY),
|
|
34081
|
+
(method, url) => revalidateEntry(rc, method, url)
|
|
34033
34082
|
);
|
|
34034
34083
|
return true;
|
|
34035
34084
|
};
|
|
34036
|
-
if (
|
|
34085
|
+
if (isMain(process.argv[1])) {
|
|
34037
34086
|
process.title = "vlt-cache-revalidate";
|
|
34087
|
+
try {
|
|
34088
|
+
setPriority(19);
|
|
34089
|
+
} catch {
|
|
34090
|
+
}
|
|
34038
34091
|
const cacheFolder = process.argv.length === 2 ? void 0 : process.argv.at(-1);
|
|
34039
|
-
const res = await
|
|
34092
|
+
const res = await main(cacheFolder, process.stdin);
|
|
34040
34093
|
if (!res) {
|
|
34041
34094
|
process.exit(1);
|
|
34042
34095
|
}
|
|
34043
34096
|
}
|
|
34044
34097
|
export {
|
|
34045
34098
|
__CODE_SPLIT_SCRIPT_NAME2 as __CODE_SPLIT_SCRIPT_NAME,
|
|
34046
|
-
|
|
34099
|
+
main
|
|
34047
34100
|
};
|
|
34048
34101
|
/*! Bundled license information:
|
|
34049
34102
|
|