@vltpkg/cli-js 1.1.0 → 1.2.0
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-GLWBGQLN.js → access-FTHPFPUJ.js} +8 -8
- package/{bugs-OCQYFWFE.js → bugs-QS6HQUO2.js} +17 -17
- package/{build-CPWGNTCM.js → build-H27SXMAS.js} +11 -11
- package/{cache-SL7DQMY2.js → cache-IB4HMFDT.js} +143 -14
- package/cache-unzip-src-unzip.js +2934 -164
- package/{chunk-TXTK2PKN.js → chunk-3CUFJPBK.js} +1 -1
- package/{chunk-CBASIDQH.js → chunk-55DYW2MP.js} +1 -1
- package/{chunk-J2XWQVDK.js → chunk-5BD4QGW2.js} +25 -7
- package/{chunk-WE2TQN32.js → chunk-5PP77V44.js} +2 -2
- package/{chunk-CTQSUNNE.js → chunk-5YB6UIC3.js} +247 -37
- package/{chunk-CEHPRPGQ.js → chunk-6A3XS52F.js} +33 -0
- package/{chunk-X2AWQGYG.js → chunk-6G7MTZGS.js} +6 -6
- package/{chunk-YKCGWKUE.js → chunk-7KFMQ3BR.js} +16 -8
- package/{chunk-47M7IZ5P.js → chunk-B2FK2HHL.js} +88 -60
- package/{chunk-ZDQJWRCU.js → chunk-FOJCK57G.js} +9 -13
- package/{chunk-S6Y57MUS.js → chunk-FSZF2RSQ.js} +4 -4
- package/{chunk-VFBCWAOC.js → chunk-G5BSQ6DP.js} +7 -0
- package/{chunk-XKVU23NC.js → chunk-G5NJ7CYI.js} +1 -1
- package/{chunk-HYCYL4RX.js → chunk-GUATFMMU.js} +37 -5
- package/chunk-JTUZP2OD.js +91 -0
- package/{chunk-2IMBYPYC.js → chunk-LD4BQJBG.js} +4 -4
- package/{chunk-BUXPKRYB.js → chunk-LEGPLJWK.js} +5 -5
- package/{chunk-CF5EGH4W.js → chunk-LKQ5R4VX.js} +4 -4
- package/{chunk-JSQUYHU7.js → chunk-NJZSCUD4.js} +3 -3
- package/{chunk-2PWSMJD7.js → chunk-O44Z6MAV.js} +1 -1
- package/{chunk-GJGQTRAT.js → chunk-OE6VHHN4.js} +220 -141
- package/{src-MOKZQTH2.js → chunk-QA6RE2GS.js} +249 -28
- package/chunk-SPRVRSEL.js +75 -0
- package/{chunk-YOE3VZFX.js → chunk-SYGF27W7.js} +2 -2
- package/{chunk-TNEMFBP5.js → chunk-UNWQVOLY.js} +14 -12
- package/{chunk-SNOBGFNM.js → chunk-UQUIO7LW.js} +47 -6
- package/{chunk-TUXWDPCQ.js → chunk-VHHLO5L6.js} +1 -1
- package/{chunk-6LEMBT22.js → chunk-YFNQ6HZ3.js} +3 -3
- package/{chunk-GDJ7JT2R.js → chunk-YTT3UHUB.js} +1 -1
- package/{ci-O2RSLTBX.js → ci-XJBYXFFJ.js} +10 -10
- package/cli-package.json +2 -1
- package/{config-ZPH7V77F.js → config-4Y46SH5K.js} +8 -8
- package/{config-ZBIF32GS.js → config-H2Q4ABSS.js} +12 -12
- package/{create-2JX4RV5U.js → create-LUYL2QI4.js} +18 -18
- package/{deprecate-XJLP2TUW.js → deprecate-5ANCI2L6.js} +13 -13
- package/{dist-tag-F6ZFWGQU.js → dist-tag-SD2CRWIL.js} +8 -8
- package/{docs-IJCZZ4V6.js → docs-B6LVNWTP.js} +17 -17
- package/{exec-IWSS2LUA.js → exec-CJ5KQA72.js} +18 -18
- package/{exec-cache-AG77OOEE.js → exec-cache-EE7DAOW2.js} +16 -16
- package/{exec-local-QXPWC4QG.js → exec-local-HT3VBN6S.js} +15 -15
- package/{help-TGNDNWLP.js → help-GZ44WYDS.js} +4 -5
- package/{init-WU7BRPKR.js → init-HVXRXFVY.js} +10 -10
- package/{install-74XKB5N7.js → install-E2C7EE6P.js} +16 -16
- package/{list-TOEC6Q3A.js → list-V4V6SHJP.js} +18 -18
- package/{login-WJYMAFSL.js → login-VRFV7MCE.js} +12 -12
- package/{logout-MTRQWI3L.js → logout-SU75R7BN.js} +8 -8
- package/{pack-FFWGLSNC.js → pack-IVGKUXTL.js} +11 -11
- package/package.json +1 -1
- package/{ping-DWUVTCJB.js → ping-WB222SDT.js} +8 -8
- package/{pkg-KNZW5FIA.js → pkg-LAAFNONA.js} +11 -11
- package/{profile-6W2ABNXL.js → profile-P3AVHRDI.js} +8 -8
- package/{publish-HGNUONU3.js → publish-IUNB3KH5.js} +17 -17
- package/{query-FSCYPETX.js → query-XCN55INS.js} +18 -18
- package/{registry-YTJZ3AQD.js → registry-QQLWJHJI.js} +5 -5
- package/registry-client-src-revalidate.js +5971 -5817
- package/{repo-OVIKYYWA.js → repo-BQDWUCX5.js} +17 -17
- package/{reporter-ZW7OMRZT.js → reporter-5BVUNWQ6.js} +13 -13
- package/{run-UPV3RPQJ.js → run-QT7DX243.js} +15 -15
- package/{run-exec-YJSMWMMP.js → run-exec-XYUI7GLN.js} +15 -15
- package/security-archive-src-update-expired.js +97 -63
- package/{setup-7DPMAPUY.js → setup-CXDJXRAG.js} +40 -22
- package/{src-XJT4IJSV.js → src-2BUT4WYP.js} +10 -7
- package/src-OKMGXMAD.js +212 -0
- package/{src-BNCFK4FH.js → src-UBAERP25.js} +16 -17
- package/{token-GA73ER5V.js → token-CBOK6DMT.js} +8 -8
- package/{uninstall-E3VKSC3B.js → uninstall-27VP46KJ.js} +12 -12
- package/{unpublish-Q6MQHBPQ.js → unpublish-F4637OQX.js} +8 -8
- package/{update-4CC44TR5.js → update-NGWLJJ22.js} +15 -15
- package/{version-CRZBXNDG.js → version-WPD2KNVC.js} +13 -13
- package/{view-ILUULGSO.js → view-YKFTRRPD.js} +11 -11
- 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-Z4TSLYTR.js → whoami-I5Q6RTAP.js} +8 -8
- package/chunk-A75UYRJC.js +0 -75
- package/chunk-E74WGW5C.js +0 -49
- package/registry-client-package.json +0 -80
|
@@ -14,24 +14,28 @@ import {
|
|
|
14
14
|
} from "./chunk-APMYKJI2.js";
|
|
15
15
|
import {
|
|
16
16
|
assertOk,
|
|
17
|
-
registryErrorMessage
|
|
18
|
-
|
|
17
|
+
registryErrorMessage,
|
|
18
|
+
storeRoot,
|
|
19
|
+
tokenRefusal
|
|
20
|
+
} from "./chunk-UQUIO7LW.js";
|
|
19
21
|
import {
|
|
20
|
-
|
|
21
|
-
} from "./chunk-
|
|
22
|
+
userAgent
|
|
23
|
+
} from "./chunk-JTUZP2OD.js";
|
|
22
24
|
import {
|
|
23
25
|
I,
|
|
24
26
|
logRequest
|
|
25
27
|
} from "./chunk-U7TEQCBN.js";
|
|
26
|
-
import {
|
|
27
|
-
asError
|
|
28
|
-
} from "./chunk-VFBCWAOC.js";
|
|
29
28
|
import {
|
|
30
29
|
XDG
|
|
31
30
|
} from "./chunk-XNLSTHDK.js";
|
|
32
31
|
import {
|
|
33
32
|
rimraf
|
|
34
33
|
} from "./chunk-BHJT53TP.js";
|
|
34
|
+
import {
|
|
35
|
+
asError,
|
|
36
|
+
integrityHex,
|
|
37
|
+
integrityRE
|
|
38
|
+
} from "./chunk-G5BSQ6DP.js";
|
|
35
39
|
import {
|
|
36
40
|
error
|
|
37
41
|
} from "./chunk-WZWDS3W4.js";
|
|
@@ -936,33 +940,33 @@ var require_tree = __commonJS({
|
|
|
936
940
|
throw new TypeError("Unreachable");
|
|
937
941
|
}
|
|
938
942
|
let index = 0;
|
|
939
|
-
let
|
|
943
|
+
let node = this;
|
|
940
944
|
while (true) {
|
|
941
945
|
const code = key.charCodeAt(index);
|
|
942
946
|
if (code > 127) {
|
|
943
947
|
throw new TypeError("key must be ascii string");
|
|
944
948
|
}
|
|
945
|
-
if (
|
|
949
|
+
if (node.code === code) {
|
|
946
950
|
if (length === ++index) {
|
|
947
|
-
|
|
951
|
+
node.value = value;
|
|
948
952
|
break;
|
|
949
|
-
} else if (
|
|
950
|
-
|
|
953
|
+
} else if (node.middle !== null) {
|
|
954
|
+
node = node.middle;
|
|
951
955
|
} else {
|
|
952
|
-
|
|
956
|
+
node.middle = new _TstNode(key, value, index);
|
|
953
957
|
break;
|
|
954
958
|
}
|
|
955
|
-
} else if (
|
|
956
|
-
if (
|
|
957
|
-
|
|
959
|
+
} else if (node.code < code) {
|
|
960
|
+
if (node.left !== null) {
|
|
961
|
+
node = node.left;
|
|
958
962
|
} else {
|
|
959
|
-
|
|
963
|
+
node.left = new _TstNode(key, value, index);
|
|
960
964
|
break;
|
|
961
965
|
}
|
|
962
|
-
} else if (
|
|
963
|
-
|
|
966
|
+
} else if (node.right !== null) {
|
|
967
|
+
node = node.right;
|
|
964
968
|
} else {
|
|
965
|
-
|
|
969
|
+
node.right = new _TstNode(key, value, index);
|
|
966
970
|
break;
|
|
967
971
|
}
|
|
968
972
|
}
|
|
@@ -974,21 +978,21 @@ var require_tree = __commonJS({
|
|
|
974
978
|
search(key) {
|
|
975
979
|
const keylength = key.length;
|
|
976
980
|
let index = 0;
|
|
977
|
-
let
|
|
978
|
-
while (
|
|
981
|
+
let node = this;
|
|
982
|
+
while (node !== null && index < keylength) {
|
|
979
983
|
let code = key[index];
|
|
980
984
|
if (code <= 90 && code >= 65) {
|
|
981
985
|
code |= 32;
|
|
982
986
|
}
|
|
983
|
-
while (
|
|
984
|
-
if (code ===
|
|
987
|
+
while (node !== null) {
|
|
988
|
+
if (code === node.code) {
|
|
985
989
|
if (keylength === ++index) {
|
|
986
|
-
return
|
|
990
|
+
return node;
|
|
987
991
|
}
|
|
988
|
-
|
|
992
|
+
node = node.middle;
|
|
989
993
|
break;
|
|
990
994
|
}
|
|
991
|
-
|
|
995
|
+
node = node.code < code ? node.left : node.right;
|
|
992
996
|
}
|
|
993
997
|
}
|
|
994
998
|
return null;
|
|
@@ -1930,14 +1934,14 @@ var require_diagnostics = __commonJS({
|
|
|
1930
1934
|
"undici:client:beforeConnect",
|
|
1931
1935
|
(evt) => {
|
|
1932
1936
|
const {
|
|
1933
|
-
connectParams: { version
|
|
1937
|
+
connectParams: { version, protocol, port, host }
|
|
1934
1938
|
} = evt;
|
|
1935
1939
|
debugLog(
|
|
1936
1940
|
"connecting to %s%s using %s%s",
|
|
1937
1941
|
host,
|
|
1938
1942
|
port ? `:${port}` : "",
|
|
1939
1943
|
protocol,
|
|
1940
|
-
|
|
1944
|
+
version
|
|
1941
1945
|
);
|
|
1942
1946
|
}
|
|
1943
1947
|
);
|
|
@@ -1945,14 +1949,14 @@ var require_diagnostics = __commonJS({
|
|
|
1945
1949
|
"undici:client:connected",
|
|
1946
1950
|
(evt) => {
|
|
1947
1951
|
const {
|
|
1948
|
-
connectParams: { version
|
|
1952
|
+
connectParams: { version, protocol, port, host }
|
|
1949
1953
|
} = evt;
|
|
1950
1954
|
debugLog(
|
|
1951
1955
|
"connected to %s%s using %s%s",
|
|
1952
1956
|
host,
|
|
1953
1957
|
port ? `:${port}` : "",
|
|
1954
1958
|
protocol,
|
|
1955
|
-
|
|
1959
|
+
version
|
|
1956
1960
|
);
|
|
1957
1961
|
}
|
|
1958
1962
|
);
|
|
@@ -1960,7 +1964,7 @@ var require_diagnostics = __commonJS({
|
|
|
1960
1964
|
"undici:client:connectError",
|
|
1961
1965
|
(evt) => {
|
|
1962
1966
|
const {
|
|
1963
|
-
connectParams: { version
|
|
1967
|
+
connectParams: { version, protocol, port, host },
|
|
1964
1968
|
error: error2
|
|
1965
1969
|
} = evt;
|
|
1966
1970
|
debugLog(
|
|
@@ -1968,7 +1972,7 @@ var require_diagnostics = __commonJS({
|
|
|
1968
1972
|
host,
|
|
1969
1973
|
port ? `:${port}` : "",
|
|
1970
1974
|
protocol,
|
|
1971
|
-
|
|
1975
|
+
version,
|
|
1972
1976
|
error2.message
|
|
1973
1977
|
);
|
|
1974
1978
|
}
|
|
@@ -10155,10 +10159,10 @@ var require_socks5_client = __commonJS({
|
|
|
10155
10159
|
if (this.buffer.length < 2) {
|
|
10156
10160
|
return;
|
|
10157
10161
|
}
|
|
10158
|
-
const
|
|
10162
|
+
const version = this.buffer[0];
|
|
10159
10163
|
const method = this.buffer[1];
|
|
10160
|
-
if (
|
|
10161
|
-
throw new Socks5ProxyError(`Invalid SOCKS version: ${
|
|
10164
|
+
if (version !== SOCKS_VERSION) {
|
|
10165
|
+
throw new Socks5ProxyError(`Invalid SOCKS version: ${version}`, "UND_ERR_SOCKS5_VERSION");
|
|
10162
10166
|
}
|
|
10163
10167
|
if (method === AUTH_METHODS.NO_ACCEPTABLE) {
|
|
10164
10168
|
throw new Socks5ProxyError("No acceptable authentication method", "UND_ERR_SOCKS5_AUTH_REJECTED");
|
|
@@ -10203,10 +10207,10 @@ var require_socks5_client = __commonJS({
|
|
|
10203
10207
|
if (this.buffer.length < 2) {
|
|
10204
10208
|
return;
|
|
10205
10209
|
}
|
|
10206
|
-
const
|
|
10210
|
+
const version = this.buffer[0];
|
|
10207
10211
|
const status = this.buffer[1];
|
|
10208
|
-
if (
|
|
10209
|
-
throw new Socks5ProxyError(`Invalid auth sub-negotiation version: ${
|
|
10212
|
+
if (version !== 1) {
|
|
10213
|
+
throw new Socks5ProxyError(`Invalid auth sub-negotiation version: ${version}`, "UND_ERR_SOCKS5_AUTH_VERSION");
|
|
10210
10214
|
}
|
|
10211
10215
|
if (status !== 0) {
|
|
10212
10216
|
throw new Socks5ProxyError("Authentication failed", "UND_ERR_SOCKS5_AUTH_FAILED");
|
|
@@ -10253,11 +10257,11 @@ var require_socks5_client = __commonJS({
|
|
|
10253
10257
|
if (this.buffer.length < 4) {
|
|
10254
10258
|
return;
|
|
10255
10259
|
}
|
|
10256
|
-
const
|
|
10260
|
+
const version = this.buffer[0];
|
|
10257
10261
|
const reply = this.buffer[1];
|
|
10258
10262
|
const addressType = this.buffer[3];
|
|
10259
|
-
if (
|
|
10260
|
-
throw new Socks5ProxyError(`Invalid SOCKS version in reply: ${
|
|
10263
|
+
if (version !== SOCKS_VERSION) {
|
|
10264
|
+
throw new Socks5ProxyError(`Invalid SOCKS version in reply: ${version}`, "UND_ERR_SOCKS5_REPLY_VERSION");
|
|
10261
10265
|
}
|
|
10262
10266
|
let responseLength = 4;
|
|
10263
10267
|
if (addressType === ADDRESS_TYPES.IPV4) {
|
|
@@ -23910,24 +23914,24 @@ var require_sender = __commonJS({
|
|
|
23910
23914
|
this.#socket.write(createFrame(item, hint), cb);
|
|
23911
23915
|
}
|
|
23912
23916
|
} else {
|
|
23913
|
-
const
|
|
23917
|
+
const node2 = {
|
|
23914
23918
|
promise: null,
|
|
23915
23919
|
callback: cb,
|
|
23916
23920
|
frame: createFrame(item, hint)
|
|
23917
23921
|
};
|
|
23918
|
-
this.#queue.push(
|
|
23922
|
+
this.#queue.push(node2);
|
|
23919
23923
|
}
|
|
23920
23924
|
return;
|
|
23921
23925
|
}
|
|
23922
|
-
const
|
|
23926
|
+
const node = {
|
|
23923
23927
|
promise: item.arrayBuffer().then((ab) => {
|
|
23924
|
-
|
|
23925
|
-
|
|
23928
|
+
node.promise = null;
|
|
23929
|
+
node.frame = createFrame(ab, hint);
|
|
23926
23930
|
}),
|
|
23927
23931
|
callback: cb,
|
|
23928
23932
|
frame: null
|
|
23929
23933
|
};
|
|
23930
|
-
this.#queue.push(
|
|
23934
|
+
this.#queue.push(node);
|
|
23931
23935
|
if (!this.#running) {
|
|
23932
23936
|
this.#run();
|
|
23933
23937
|
}
|
|
@@ -23936,12 +23940,12 @@ var require_sender = __commonJS({
|
|
|
23936
23940
|
this.#running = true;
|
|
23937
23941
|
const queue = this.#queue;
|
|
23938
23942
|
while (!queue.isEmpty()) {
|
|
23939
|
-
const
|
|
23940
|
-
if (
|
|
23941
|
-
await
|
|
23943
|
+
const node = queue.shift();
|
|
23944
|
+
if (node.promise !== null) {
|
|
23945
|
+
await node.promise;
|
|
23942
23946
|
}
|
|
23943
|
-
this.#socket.write(
|
|
23944
|
-
|
|
23947
|
+
this.#socket.write(node.frame, node.callback);
|
|
23948
|
+
node.callback = node.frame = null;
|
|
23945
23949
|
}
|
|
23946
23950
|
this.#running = false;
|
|
23947
23951
|
}
|
|
@@ -25805,6 +25809,7 @@ var Cache = class _Cache extends I {
|
|
|
25805
25809
|
#pending = /* @__PURE__ */ new Set();
|
|
25806
25810
|
onDiskWrite;
|
|
25807
25811
|
onDiskDelete;
|
|
25812
|
+
store;
|
|
25808
25813
|
/**
|
|
25809
25814
|
* A list of the actions currently happening in the background
|
|
25810
25815
|
*/
|
|
@@ -25823,6 +25828,7 @@ var Cache = class _Cache extends I {
|
|
|
25823
25828
|
onDiskWrite,
|
|
25824
25829
|
onDiskDelete,
|
|
25825
25830
|
path,
|
|
25831
|
+
store,
|
|
25826
25832
|
fetchMethod: _,
|
|
25827
25833
|
sizeCalculation = options.maxSize || options.maxEntrySize ? (v, k) => v.length + k.length : void 0,
|
|
25828
25834
|
...lruOpts
|
|
@@ -25846,6 +25852,7 @@ var Cache = class _Cache extends I {
|
|
|
25846
25852
|
});
|
|
25847
25853
|
this.onDiskWrite = onDiskWrite;
|
|
25848
25854
|
this.onDiskDelete = onDiskDelete;
|
|
25855
|
+
this.store = store;
|
|
25849
25856
|
this.#path = path;
|
|
25850
25857
|
}
|
|
25851
25858
|
/**
|
|
@@ -25971,16 +25978,14 @@ var Cache = class _Cache extends I {
|
|
|
25971
25978
|
*/
|
|
25972
25979
|
integrityPath(integrity) {
|
|
25973
25980
|
if (!integrity) return void 0;
|
|
25974
|
-
const
|
|
25975
|
-
|
|
25976
|
-
if (!hash2) {
|
|
25981
|
+
const hex = integrityHex(integrity);
|
|
25982
|
+
if (!hex) {
|
|
25977
25983
|
throw error("invalid integrity value", {
|
|
25978
25984
|
found: integrity,
|
|
25979
|
-
wanted:
|
|
25985
|
+
wanted: integrityRE
|
|
25980
25986
|
});
|
|
25981
25987
|
}
|
|
25982
|
-
|
|
25983
|
-
return resolve(this.#path, base);
|
|
25988
|
+
return resolve(this.#path, hex);
|
|
25984
25989
|
}
|
|
25985
25990
|
/**
|
|
25986
25991
|
* Read synchronously from the fs cache storage if not already
|
|
@@ -26007,13 +26012,20 @@ var Cache = class _Cache extends I {
|
|
|
26007
26012
|
}
|
|
26008
26013
|
/* c8 ignore stop */
|
|
26009
26014
|
/**
|
|
26010
|
-
* Delete path and path + '.key'
|
|
26015
|
+
* Delete path and path + '.key', and with an integrity, its
|
|
26016
|
+
* integrity link and global store entry
|
|
26011
26017
|
*/
|
|
26012
26018
|
async #diskDelete(path, integrity) {
|
|
26013
|
-
const intPath = this.#maybeIntegrityPath(integrity);
|
|
26014
26019
|
const paths = [path, path + ".key"];
|
|
26015
|
-
|
|
26016
|
-
|
|
26020
|
+
const hex = integrityHex(integrity);
|
|
26021
|
+
if (hex) paths.push(resolve(this.#path, hex));
|
|
26022
|
+
const deleted = await rimraf(paths);
|
|
26023
|
+
if (hex && this.store) {
|
|
26024
|
+
const entry = resolve(this.store, hex);
|
|
26025
|
+
await rimraf(entry);
|
|
26026
|
+
await rimraf([entry + ".json", entry + ".copied"]);
|
|
26027
|
+
}
|
|
26028
|
+
return deleted;
|
|
26017
26029
|
}
|
|
26018
26030
|
#maybeIntegrityPath(i) {
|
|
26019
26031
|
try {
|
|
@@ -26090,9 +26102,10 @@ var __CODE_SPLIT_SCRIPT_NAME = resolve2(import.meta.dirname, "cache-unzip-src-un
|
|
|
26090
26102
|
var isDeno = globalThis.Deno != void 0;
|
|
26091
26103
|
var didProcessBeforeExitHook = false;
|
|
26092
26104
|
var registered = /* @__PURE__ */ new Map();
|
|
26093
|
-
var register = (path, key) => {
|
|
26094
|
-
const r = registered.get(path) ?? /* @__PURE__ */ new
|
|
26095
|
-
r.
|
|
26105
|
+
var register = (path, key, store, integrity) => {
|
|
26106
|
+
const r = registered.get(path) ?? { keys: /* @__PURE__ */ new Map() };
|
|
26107
|
+
r.keys.set(key, integrity ?? r.keys.get(key));
|
|
26108
|
+
r.store ??= store;
|
|
26096
26109
|
registered.set(path, r);
|
|
26097
26110
|
if (!didProcessBeforeExitHook) {
|
|
26098
26111
|
didProcessBeforeExitHook = true;
|
|
@@ -26101,8 +26114,8 @@ var register = (path, key) => {
|
|
|
26101
26114
|
};
|
|
26102
26115
|
var handleBeforeExit = () => {
|
|
26103
26116
|
const compileCacheDir = module.getCompileCacheDir();
|
|
26104
|
-
for (const [path,
|
|
26105
|
-
if (!
|
|
26117
|
+
for (const [path, { keys, store }] of registered) {
|
|
26118
|
+
if (!keys.size) return;
|
|
26106
26119
|
const env = { ...process.env };
|
|
26107
26120
|
if (compileCacheDir) env.NODE_COMPILE_CACHE ??= compileCacheDir;
|
|
26108
26121
|
const args = [];
|
|
@@ -26114,30 +26127,33 @@ var handleBeforeExit = () => {
|
|
|
26114
26127
|
);
|
|
26115
26128
|
}
|
|
26116
26129
|
args.push(__CODE_SPLIT_SCRIPT_NAME, path);
|
|
26130
|
+
if (store) args.push(store);
|
|
26117
26131
|
registered.delete(path);
|
|
26118
|
-
const
|
|
26132
|
+
const proc2 = spawn(process.execPath, args, {
|
|
26119
26133
|
detached,
|
|
26120
26134
|
stdio: ["pipe", "ignore", "ignore"],
|
|
26121
26135
|
env
|
|
26122
26136
|
});
|
|
26123
|
-
for (const key of
|
|
26124
|
-
|
|
26137
|
+
for (const [key, integrity] of keys) {
|
|
26138
|
+
proc2.stdin.write(
|
|
26139
|
+
integrity ? `${key} ${integrity}\0` : `${key}\0`
|
|
26140
|
+
);
|
|
26125
26141
|
}
|
|
26126
|
-
|
|
26142
|
+
proc2.stdin.end();
|
|
26127
26143
|
if (detached) {
|
|
26128
|
-
|
|
26144
|
+
proc2.unref();
|
|
26129
26145
|
}
|
|
26130
26146
|
}
|
|
26131
26147
|
};
|
|
26132
26148
|
|
|
26133
26149
|
// ../../src/registry-client/src/index.ts
|
|
26150
|
+
var import_undici3 = __toESM(require_undici(), 1);
|
|
26134
26151
|
import { randomUUID } from "node:crypto";
|
|
26135
26152
|
import { readFileSync as readFileSync2 } from "node:fs";
|
|
26136
26153
|
import { STATUS_CODES } from "node:http";
|
|
26137
26154
|
import { availableParallelism } from "node:os";
|
|
26138
26155
|
import { dirname as dirname3, resolve as resolve4 } from "node:path";
|
|
26139
26156
|
import { setTimeout as setTimeout2 } from "node:timers/promises";
|
|
26140
|
-
var import_undici3 = __toESM(require_undici(), 1);
|
|
26141
26157
|
|
|
26142
26158
|
// ../../src/registry-client/src/is-iterable.ts
|
|
26143
26159
|
var isIterable = (o) => !!o && typeof o === "object" && Symbol.iterator in o;
|
|
@@ -26145,27 +26161,23 @@ var isIterable = (o) => !!o && typeof o === "object" && Symbol.iterator in o;
|
|
|
26145
26161
|
// ../../src/registry-client/src/delete-header.ts
|
|
26146
26162
|
var deleteHeader = (headers, key) => {
|
|
26147
26163
|
if (!headers) return {};
|
|
26164
|
+
const lk = key.toLowerCase();
|
|
26148
26165
|
if (Array.isArray(headers)) {
|
|
26149
26166
|
if (!headers.length) return headers;
|
|
26150
|
-
|
|
26151
|
-
|
|
26152
|
-
|
|
26153
|
-
);
|
|
26154
|
-
if (
|
|
26155
|
-
|
|
26156
|
-
const h = headers;
|
|
26157
|
-
for (let i = 0; i < h.length; i += 2) {
|
|
26158
|
-
if (h[i]?.toLowerCase() === key.toLowerCase()) {
|
|
26159
|
-
headers.splice(i, 2);
|
|
26160
|
-
break;
|
|
26161
|
-
}
|
|
26162
|
-
}
|
|
26167
|
+
const step = Array.isArray(headers[0]) ? 1 : 2;
|
|
26168
|
+
for (let i = 0; i < headers.length; ) {
|
|
26169
|
+
const h = headers[i];
|
|
26170
|
+
const k = Array.isArray(h) ? h[0] : h;
|
|
26171
|
+
if (k.toLowerCase() === lk) headers.splice(i, step);
|
|
26172
|
+
else i += step;
|
|
26163
26173
|
}
|
|
26164
26174
|
return headers;
|
|
26165
26175
|
} else if (isIterable(headers)) {
|
|
26166
26176
|
return deleteHeader([...headers], key);
|
|
26167
26177
|
} else {
|
|
26168
|
-
|
|
26178
|
+
for (const k of Object.keys(headers)) {
|
|
26179
|
+
if (k.toLowerCase() === lk) delete headers[k];
|
|
26180
|
+
}
|
|
26169
26181
|
return headers;
|
|
26170
26182
|
}
|
|
26171
26183
|
};
|
|
@@ -26343,18 +26355,11 @@ var getTokenByURL = async (requestUrl, identity) => {
|
|
|
26343
26355
|
for (const k of await kc.keys()) {
|
|
26344
26356
|
candidates.push(k);
|
|
26345
26357
|
}
|
|
26346
|
-
|
|
26347
|
-
|
|
26348
|
-
|
|
26349
|
-
if (
|
|
26350
|
-
bestKey = candidate;
|
|
26351
|
-
bestLen = candidate.length;
|
|
26352
|
-
}
|
|
26353
|
-
}
|
|
26354
|
-
if (bestKey) {
|
|
26355
|
-
return getToken(bestKey, identity);
|
|
26358
|
+
const matches = candidates.filter((c) => normalized === c || normalized.startsWith(c + "/")).sort((a, b) => b.length - a.length);
|
|
26359
|
+
for (const key of matches) {
|
|
26360
|
+
const tok = await getToken(key, identity);
|
|
26361
|
+
if (tok) return tok;
|
|
26356
26362
|
}
|
|
26357
|
-
return getToken(requestUrl, identity);
|
|
26358
26363
|
};
|
|
26359
26364
|
|
|
26360
26365
|
// ../../src/registry-client/src/cache-entry.ts
|
|
@@ -26641,8 +26646,9 @@ var CacheEntry = class _CacheEntry {
|
|
|
26641
26646
|
* This method **will throw** if the integrity values do not match.
|
|
26642
26647
|
*
|
|
26643
26648
|
* Note that this will *usually* not be true if the value is coming out of
|
|
26644
|
-
* the cache, because
|
|
26645
|
-
* _only_ be called for artifacts that come
|
|
26649
|
+
* the cache, because cache entries not exploded into the global store are
|
|
26650
|
+
* un-gzipped in place. It should _only_ be called for artifacts that come
|
|
26651
|
+
* from an actual http response.
|
|
26646
26652
|
*
|
|
26647
26653
|
* Returns true if anything was actually verified.
|
|
26648
26654
|
*/
|
|
@@ -26659,6 +26665,29 @@ var CacheEntry = class _CacheEntry {
|
|
|
26659
26665
|
}
|
|
26660
26666
|
return true;
|
|
26661
26667
|
}
|
|
26668
|
+
/**
|
|
26669
|
+
* Check the body against the RFC 9530 digest the server sent with it,
|
|
26670
|
+
* for a response that had no expected integrity. A registry that omits
|
|
26671
|
+
* `dist.integrity` labels every tarball, so a missing digest fails when
|
|
26672
|
+
* `required`. Like {@link checkIntegrity}, only for an actual http
|
|
26673
|
+
* response: cached bodies are un-gzipped in place.
|
|
26674
|
+
*
|
|
26675
|
+
* **Will throw** on a mismatch. Returns the hash of the body.
|
|
26676
|
+
*/
|
|
26677
|
+
checkDigest(required, context = {}) {
|
|
26678
|
+
const computed = this.integrityActual;
|
|
26679
|
+
const { digest } = this;
|
|
26680
|
+
if (digest ? digest !== computed : required) {
|
|
26681
|
+
throw error("Integrity check failure", {
|
|
26682
|
+
code: "EINTEGRITY",
|
|
26683
|
+
response: this,
|
|
26684
|
+
wanted: digest,
|
|
26685
|
+
found: computed,
|
|
26686
|
+
...context
|
|
26687
|
+
});
|
|
26688
|
+
}
|
|
26689
|
+
return computed;
|
|
26690
|
+
}
|
|
26662
26691
|
get integrityActual() {
|
|
26663
26692
|
if (this.#integrityActual) return this.#integrityActual;
|
|
26664
26693
|
const hash2 = createHash2("sha512");
|
|
@@ -26680,6 +26709,16 @@ var CacheEntry = class _CacheEntry {
|
|
|
26680
26709
|
get integrity() {
|
|
26681
26710
|
return this.#integrity;
|
|
26682
26711
|
}
|
|
26712
|
+
/**
|
|
26713
|
+
* The sha-512 member of an RFC 9530 `Repr-Digest` (or `Content-Digest`)
|
|
26714
|
+
* response header, as an SRI string. A registry that serves packuments
|
|
26715
|
+
* without `dist.integrity` labels each tarball this way instead.
|
|
26716
|
+
*/
|
|
26717
|
+
get digest() {
|
|
26718
|
+
const value = this.getHeaderString("repr-digest") ?? this.getHeaderString("content-digest");
|
|
26719
|
+
const m = value && /(?:^|,)\s*sha-512=:([A-Za-z0-9+/]{86}==):/.exec(value);
|
|
26720
|
+
return m ? `sha512-${m[1]}` : void 0;
|
|
26721
|
+
}
|
|
26683
26722
|
/**
|
|
26684
26723
|
* Give it a key, and it'll return the buffer of that header value
|
|
26685
26724
|
*/
|
|
@@ -26701,6 +26740,19 @@ var CacheEntry = class _CacheEntry {
|
|
|
26701
26740
|
setHeader(h, value) {
|
|
26702
26741
|
this.#headers = setRawHeader(this.#headers, h, value);
|
|
26703
26742
|
}
|
|
26743
|
+
/**
|
|
26744
|
+
* Remove a header, if present
|
|
26745
|
+
*/
|
|
26746
|
+
deleteHeader(h) {
|
|
26747
|
+
const key = h.toLowerCase();
|
|
26748
|
+
for (let i = 0; i < this.#headers.length; i += 2) {
|
|
26749
|
+
const k = this.#headers[i];
|
|
26750
|
+
if (k && getDecodedValue(k).toLowerCase() === key) {
|
|
26751
|
+
this.#headers.splice(i, 2);
|
|
26752
|
+
return;
|
|
26753
|
+
}
|
|
26754
|
+
}
|
|
26755
|
+
}
|
|
26704
26756
|
/**
|
|
26705
26757
|
* Return the body of the entry as a Buffer
|
|
26706
26758
|
*/
|
|
@@ -26880,6 +26932,16 @@ var CacheEntry = class _CacheEntry {
|
|
|
26880
26932
|
const gzipBytes = buffer.subarray(headSize, headSize + 2);
|
|
26881
26933
|
return gzipBytes[0] === 31 && gzipBytes[1] === 139;
|
|
26882
26934
|
}
|
|
26935
|
+
/**
|
|
26936
|
+
* Head-only check for a 200 non-JSON body with an integrity header,
|
|
26937
|
+
* i.e. a tarball the global store can be built from.
|
|
26938
|
+
*/
|
|
26939
|
+
static isTarballEntry(buffer) {
|
|
26940
|
+
const parsed = _CacheEntry.#parseHead(buffer);
|
|
26941
|
+
if (parsed?.statusCode !== 200 || !parsed.integrity) return false;
|
|
26942
|
+
const ct = getRawHeader(parsed.headers, "content-type");
|
|
26943
|
+
return !ct || !/\bjson\b/.test(getDecodedValue(ct));
|
|
26944
|
+
}
|
|
26883
26945
|
/**
|
|
26884
26946
|
* Encode status + headers (no body) as they appear at the start of
|
|
26885
26947
|
* an on-disk cache file.
|
|
@@ -26994,32 +27056,21 @@ var handleBeforeExit2 = () => {
|
|
|
26994
27056
|
args.push(__CODE_SPLIT_SCRIPT_NAME2, path);
|
|
26995
27057
|
registered2.delete(path);
|
|
26996
27058
|
const detached = !(isDeno2 && process.platform === "win32");
|
|
26997
|
-
const
|
|
27059
|
+
const proc2 = spawn2(process.execPath, args, {
|
|
26998
27060
|
detached,
|
|
26999
27061
|
stdio: ["pipe", "ignore", "ignore"],
|
|
27000
27062
|
env
|
|
27001
27063
|
});
|
|
27002
27064
|
for (const key of r) {
|
|
27003
|
-
|
|
27065
|
+
proc2.stdin.write(`${key}\0`);
|
|
27004
27066
|
}
|
|
27005
|
-
|
|
27067
|
+
proc2.stdin.end();
|
|
27006
27068
|
if (detached) {
|
|
27007
|
-
|
|
27069
|
+
proc2.unref();
|
|
27008
27070
|
}
|
|
27009
27071
|
}
|
|
27010
27072
|
};
|
|
27011
27073
|
|
|
27012
|
-
// ../../src/registry-client/src/env.ts
|
|
27013
|
-
import proc from "node:process";
|
|
27014
|
-
var { Deno, Bun } = globalThis;
|
|
27015
|
-
var isObj = (v) => typeof v === "object" && !!v;
|
|
27016
|
-
var isDeno3 = isObj(Deno);
|
|
27017
|
-
var isBun = !isDeno3 && isObj(Bun);
|
|
27018
|
-
var isNode = !isDeno3 && !isBun && "node" in proc.versions;
|
|
27019
|
-
var bun = isBun ? proc.versions.bun : void 0;
|
|
27020
|
-
var deno = isDeno3 ? proc.versions.deno : void 0;
|
|
27021
|
-
var node = isNode ? proc.versions.node : void 0;
|
|
27022
|
-
|
|
27023
27074
|
// ../../src/registry-client/src/get-header.ts
|
|
27024
27075
|
var isIterable2 = (o) => !!o && typeof o === "object" && Symbol.iterator in o;
|
|
27025
27076
|
var getHeader = (headers, key) => {
|
|
@@ -27137,6 +27188,10 @@ var otplease = async (client, options, response) => {
|
|
|
27137
27188
|
});
|
|
27138
27189
|
}
|
|
27139
27190
|
if (wwwAuth.has("bearer")) {
|
|
27191
|
+
const text2 = await responseBodyText(response).catch(() => "");
|
|
27192
|
+
if (tokenRefusal({ statusCode: 401, text: () => text2 })) {
|
|
27193
|
+
return { bodyConsumed: text2 };
|
|
27194
|
+
}
|
|
27140
27195
|
throw error(
|
|
27141
27196
|
"Missing or invalid authentication token. Run `vlt login` or `vlt token add` to authenticate.",
|
|
27142
27197
|
{
|
|
@@ -27169,8 +27224,8 @@ var otplease = async (client, options, response) => {
|
|
|
27169
27224
|
|
|
27170
27225
|
// ../../src/registry-client/src/proxy.ts
|
|
27171
27226
|
var import_undici = __toESM(require_undici(), 1);
|
|
27172
|
-
import
|
|
27173
|
-
var hasProxyEnv = () => !!(
|
|
27227
|
+
import proc from "node:process";
|
|
27228
|
+
var hasProxyEnv = () => !!(proc.env.http_proxy ?? proc.env.HTTP_PROXY) || !!(proc.env.https_proxy ?? proc.env.HTTPS_PROXY);
|
|
27174
27229
|
var getDispatcher = (options) => hasProxyEnv() ? new import_undici.EnvHttpProxyAgent(options) : new import_undici.Agent(options);
|
|
27175
27230
|
|
|
27176
27231
|
// ../../src/registry-client/src/redirect.ts
|
|
@@ -27203,6 +27258,12 @@ var redirect = (options, response, from) => {
|
|
|
27203
27258
|
};
|
|
27204
27259
|
delete nextOptions.path;
|
|
27205
27260
|
redirections.add(String(nextURL));
|
|
27261
|
+
if (nextURL.origin !== from.origin) {
|
|
27262
|
+
nextOptions.headers = deleteHeader(
|
|
27263
|
+
nextOptions.headers,
|
|
27264
|
+
"authorization"
|
|
27265
|
+
);
|
|
27266
|
+
}
|
|
27206
27267
|
switch (response.statusCode) {
|
|
27207
27268
|
case 303: {
|
|
27208
27269
|
nextOptions.method = "GET";
|
|
@@ -27420,12 +27481,6 @@ var exchangeToken = async (idToken, packageName, registry) => {
|
|
|
27420
27481
|
var log3 = (msg) => console.error(msg);
|
|
27421
27482
|
var isCacheableMethod = (m) => m === "GET" || m === "HEAD";
|
|
27422
27483
|
var cacheKey = (method, url) => `${method !== "GET" ? method + " " : ""}${url}`;
|
|
27423
|
-
var { version } = loadPackageJson(
|
|
27424
|
-
import.meta.filename,
|
|
27425
|
-
"registry-client-package.json"
|
|
27426
|
-
);
|
|
27427
|
-
var nua = globalThis.navigator?.userAgent ?? (bun ? `Bun/${bun}` : deno ? `Deno/${deno}` : node ? `Node.js/${node}` : "(unknown platform)");
|
|
27428
|
-
var userAgent = `@vltpkg/registry-client/${version} ${nua}`;
|
|
27429
27484
|
var agentOptions = {
|
|
27430
27485
|
bodyTimeout: 6e5,
|
|
27431
27486
|
headersTimeout: 6e5,
|
|
@@ -27471,12 +27526,14 @@ var RegistryClient = class {
|
|
|
27471
27526
|
this.identity = identity;
|
|
27472
27527
|
this.staleWhileRevalidateFactor = staleWhileRevalidateFactor;
|
|
27473
27528
|
const path = resolve4(cache, "registry-client");
|
|
27529
|
+
const store = options.storeRoot ?? storeRoot(cache);
|
|
27474
27530
|
this.cache = new Cache({
|
|
27475
27531
|
path,
|
|
27532
|
+
store,
|
|
27476
27533
|
maxSize: parseCacheMaxSize(process.env.VLT_CACHE_MAX_SIZE),
|
|
27477
27534
|
onDiskWrite(_path, key, data) {
|
|
27478
|
-
if (CacheEntry.isGzipEntry(data)) {
|
|
27479
|
-
register(path, key);
|
|
27535
|
+
if (CacheEntry.isGzipEntry(data) || CacheEntry.isTarballEntry(data)) {
|
|
27536
|
+
register(path, key, store);
|
|
27480
27537
|
}
|
|
27481
27538
|
}
|
|
27482
27539
|
});
|
|
@@ -27750,12 +27807,32 @@ var RegistryClient = class {
|
|
|
27750
27807
|
if (entry.statusCode !== 200 || !entry.valid || entry.isJSON) {
|
|
27751
27808
|
continue;
|
|
27752
27809
|
}
|
|
27753
|
-
return {
|
|
27810
|
+
return {
|
|
27811
|
+
path,
|
|
27812
|
+
key,
|
|
27813
|
+
body: entry.buffer(),
|
|
27814
|
+
integrity: entry.integrity,
|
|
27815
|
+
gzip: CacheEntry.isGzipEntry(buf)
|
|
27816
|
+
};
|
|
27754
27817
|
}
|
|
27755
27818
|
} catch {
|
|
27756
27819
|
}
|
|
27757
27820
|
return void 0;
|
|
27758
27821
|
}
|
|
27822
|
+
/**
|
|
27823
|
+
* Queue the cached tarball at `key` (a {@link CachedBody} key) for the
|
|
27824
|
+
* background child: exploded into the global store when that is on,
|
|
27825
|
+
* else un-gzipped. `integrity` finds it when only the integrity path
|
|
27826
|
+
* holds it.
|
|
27827
|
+
*/
|
|
27828
|
+
queueForStore(key, integrity) {
|
|
27829
|
+
register(
|
|
27830
|
+
this.cache.path(),
|
|
27831
|
+
key,
|
|
27832
|
+
this.cache.store,
|
|
27833
|
+
integrity
|
|
27834
|
+
);
|
|
27835
|
+
}
|
|
27759
27836
|
async request(url, options = {}) {
|
|
27760
27837
|
const u = typeof url === "string" ? new URL(url) : url;
|
|
27761
27838
|
const {
|
|
@@ -27767,7 +27844,7 @@ var RegistryClient = class {
|
|
|
27767
27844
|
staleWhileRevalidate = true,
|
|
27768
27845
|
forceRevalidate = false
|
|
27769
27846
|
} = options;
|
|
27770
|
-
|
|
27847
|
+
const { trustIntegrity, verifyDigest } = options;
|
|
27771
27848
|
const m = isCacheableMethod(method) ? method : void 0;
|
|
27772
27849
|
const { useCache = !!m } = options;
|
|
27773
27850
|
signal?.throwIfAborted();
|
|
@@ -27792,6 +27869,7 @@ var RegistryClient = class {
|
|
|
27792
27869
|
logRequest(url, "start", { method });
|
|
27793
27870
|
const requestStart = Date.now();
|
|
27794
27871
|
setCacheHeaders(options, entry);
|
|
27872
|
+
const redirected = redirections.size > 0;
|
|
27795
27873
|
redirections.add(String(url));
|
|
27796
27874
|
options.path = u.pathname.replace(/\/+$/, "") + u.search;
|
|
27797
27875
|
options.origin = u.origin;
|
|
@@ -27819,11 +27897,13 @@ var RegistryClient = class {
|
|
|
27819
27897
|
);
|
|
27820
27898
|
}
|
|
27821
27899
|
options.method = options.method ?? "GET";
|
|
27822
|
-
options.headers
|
|
27823
|
-
options.headers
|
|
27824
|
-
|
|
27825
|
-
|
|
27826
|
-
|
|
27900
|
+
if (!redirected || !getHeader(options.headers, "authorization")) {
|
|
27901
|
+
options.headers = addHeader(
|
|
27902
|
+
options.headers,
|
|
27903
|
+
"authorization",
|
|
27904
|
+
await getTokenByURL(String(u), this.identity)
|
|
27905
|
+
);
|
|
27906
|
+
}
|
|
27827
27907
|
let response = null;
|
|
27828
27908
|
try {
|
|
27829
27909
|
response = await this.agent.request(
|
|
@@ -27856,14 +27936,16 @@ var RegistryClient = class {
|
|
|
27856
27936
|
durationMs: Date.now() - requestStart
|
|
27857
27937
|
}
|
|
27858
27938
|
);
|
|
27859
|
-
if (result.
|
|
27860
|
-
|
|
27939
|
+
if (!trustIntegrity && !result.fromCache) {
|
|
27940
|
+
result.deleteHeader("integrity");
|
|
27941
|
+
if (result.isGzip) result.checkIntegrity({ url });
|
|
27861
27942
|
}
|
|
27862
|
-
if (result.
|
|
27863
|
-
result.
|
|
27943
|
+
if (verifyDigest && !integrity && !result.fromCache && result.statusCode === 200) {
|
|
27944
|
+
result.checkDigest(verifyDigest === "required", { url });
|
|
27864
27945
|
}
|
|
27865
27946
|
const clobbersCachedEntry = forceRevalidate && !!entry && result.statusCode !== 200;
|
|
27866
27947
|
if (useCache && !clobbersCachedEntry) {
|
|
27948
|
+
const integrity2 = result.integrity ?? (result.statusCode === 200 && !result.isJSON ? result.integrityActual : void 0);
|
|
27867
27949
|
const buffer2 = result.encode();
|
|
27868
27950
|
this.cache.set(
|
|
27869
27951
|
key,
|
|
@@ -27872,9 +27954,7 @@ var RegistryClient = class {
|
|
|
27872
27954
|
buffer2.byteOffset,
|
|
27873
27955
|
buffer2.byteLength
|
|
27874
27956
|
),
|
|
27875
|
-
{
|
|
27876
|
-
integrity: result.integrity
|
|
27877
|
-
}
|
|
27957
|
+
{ integrity: integrity2 }
|
|
27878
27958
|
);
|
|
27879
27959
|
}
|
|
27880
27960
|
return result;
|
|
@@ -27943,7 +28023,6 @@ export {
|
|
|
27943
28023
|
oidc,
|
|
27944
28024
|
isCacheableMethod,
|
|
27945
28025
|
cacheKey,
|
|
27946
|
-
userAgent,
|
|
27947
28026
|
RegistryClient
|
|
27948
28027
|
};
|
|
27949
28028
|
/*! Bundled license information:
|