@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
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
} from "./chunk-BJBFEQRR.js";
|
|
30
30
|
import {
|
|
31
31
|
asError
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-VFBCWAOC.js";
|
|
33
33
|
import {
|
|
34
34
|
error
|
|
35
35
|
} from "./chunk-WZWDS3W4.js";
|
|
@@ -15797,18 +15797,18 @@ var require_cache = __commonJS({
|
|
|
15797
15797
|
}
|
|
15798
15798
|
}
|
|
15799
15799
|
}
|
|
15800
|
-
function makeDeduplicationKey(
|
|
15800
|
+
function makeDeduplicationKey(cacheKey2, excludeHeaders) {
|
|
15801
15801
|
const headers = {};
|
|
15802
|
-
if (
|
|
15803
|
-
const sortedHeaders = Object.keys(
|
|
15802
|
+
if (cacheKey2.headers) {
|
|
15803
|
+
const sortedHeaders = Object.keys(cacheKey2.headers).sort();
|
|
15804
15804
|
for (const header of sortedHeaders) {
|
|
15805
15805
|
if (excludeHeaders?.has(header.toLowerCase())) {
|
|
15806
15806
|
continue;
|
|
15807
15807
|
}
|
|
15808
|
-
headers[header] =
|
|
15808
|
+
headers[header] = cacheKey2.headers[header];
|
|
15809
15809
|
}
|
|
15810
15810
|
}
|
|
15811
|
-
return JSON.stringify([
|
|
15811
|
+
return JSON.stringify([cacheKey2.origin, cacheKey2.method, cacheKey2.path, headers]);
|
|
15812
15812
|
}
|
|
15813
15813
|
module3.exports = {
|
|
15814
15814
|
makeCacheKey,
|
|
@@ -16382,7 +16382,7 @@ var require_cache_handler = __commonJS({
|
|
|
16382
16382
|
}
|
|
16383
16383
|
}
|
|
16384
16384
|
}
|
|
16385
|
-
function getSameOriginPath(
|
|
16385
|
+
function getSameOriginPath(cacheKey2, location) {
|
|
16386
16386
|
if (typeof location !== "string") {
|
|
16387
16387
|
return void 0;
|
|
16388
16388
|
}
|
|
@@ -16390,8 +16390,8 @@ var require_cache_handler = __commonJS({
|
|
|
16390
16390
|
let requestUrl;
|
|
16391
16391
|
let locationUrl;
|
|
16392
16392
|
try {
|
|
16393
|
-
originUrl = new URL(
|
|
16394
|
-
requestUrl = new URL(
|
|
16393
|
+
originUrl = new URL(cacheKey2.origin);
|
|
16394
|
+
requestUrl = new URL(cacheKey2.path, originUrl);
|
|
16395
16395
|
locationUrl = new URL(location, requestUrl);
|
|
16396
16396
|
} catch {
|
|
16397
16397
|
return void 0;
|
|
@@ -16401,38 +16401,38 @@ var require_cache_handler = __commonJS({
|
|
|
16401
16401
|
}
|
|
16402
16402
|
return locationUrl.pathname + locationUrl.search;
|
|
16403
16403
|
}
|
|
16404
|
-
function deleteCachedUri(store,
|
|
16404
|
+
function deleteCachedUri(store, cacheKey2, path) {
|
|
16405
16405
|
deleteCachedValue(store, {
|
|
16406
|
-
...
|
|
16406
|
+
...cacheKey2,
|
|
16407
16407
|
path
|
|
16408
16408
|
});
|
|
16409
16409
|
for (let i = 0; i < util.safeHTTPMethods.length; i++) {
|
|
16410
16410
|
const method = util.safeHTTPMethods[i];
|
|
16411
|
-
if (method !==
|
|
16411
|
+
if (method !== cacheKey2.method) {
|
|
16412
16412
|
deleteCachedValue(store, {
|
|
16413
|
-
...
|
|
16413
|
+
...cacheKey2,
|
|
16414
16414
|
method,
|
|
16415
16415
|
path
|
|
16416
16416
|
});
|
|
16417
16417
|
}
|
|
16418
16418
|
}
|
|
16419
16419
|
}
|
|
16420
|
-
function deleteLocationTargets(store,
|
|
16420
|
+
function deleteLocationTargets(store, cacheKey2, headerValue) {
|
|
16421
16421
|
if (headerValue === void 0) {
|
|
16422
16422
|
return;
|
|
16423
16423
|
}
|
|
16424
16424
|
const values = Array.isArray(headerValue) ? headerValue : [headerValue];
|
|
16425
16425
|
for (let i = 0; i < values.length; i++) {
|
|
16426
|
-
const path = getSameOriginPath(
|
|
16426
|
+
const path = getSameOriginPath(cacheKey2, values[i]);
|
|
16427
16427
|
if (path !== void 0) {
|
|
16428
|
-
deleteCachedUri(store,
|
|
16428
|
+
deleteCachedUri(store, cacheKey2, path);
|
|
16429
16429
|
}
|
|
16430
16430
|
}
|
|
16431
16431
|
}
|
|
16432
|
-
function invalidateUnsafeRequest(store,
|
|
16433
|
-
deleteCachedUri(store,
|
|
16434
|
-
deleteLocationTargets(store,
|
|
16435
|
-
deleteLocationTargets(store,
|
|
16432
|
+
function invalidateUnsafeRequest(store, cacheKey2, resHeaders) {
|
|
16433
|
+
deleteCachedUri(store, cacheKey2, cacheKey2.path);
|
|
16434
|
+
deleteLocationTargets(store, cacheKey2, resHeaders.location);
|
|
16435
|
+
deleteLocationTargets(store, cacheKey2, resHeaders["content-location"]);
|
|
16436
16436
|
}
|
|
16437
16437
|
var CacheHandler = class {
|
|
16438
16438
|
/**
|
|
@@ -16464,11 +16464,11 @@ var require_cache_handler = __commonJS({
|
|
|
16464
16464
|
* @param {import('../../types/cache-interceptor.d.ts').default.CacheKey} cacheKey
|
|
16465
16465
|
* @param {import('../../types/dispatcher.d.ts').default.DispatchHandler} handler
|
|
16466
16466
|
*/
|
|
16467
|
-
constructor({ store, type, cacheByDefault },
|
|
16467
|
+
constructor({ store, type, cacheByDefault }, cacheKey2, handler) {
|
|
16468
16468
|
this.#store = store;
|
|
16469
16469
|
this.#cacheType = type;
|
|
16470
16470
|
this.#cacheByDefault = cacheByDefault;
|
|
16471
|
-
this.#cacheKey =
|
|
16471
|
+
this.#cacheKey = cacheKey2;
|
|
16472
16472
|
this.#handler = handler;
|
|
16473
16473
|
}
|
|
16474
16474
|
onRequestStart(controller, context) {
|
|
@@ -16657,15 +16657,15 @@ var require_cache_handler = __commonJS({
|
|
|
16657
16657
|
this.#handler.onResponseError?.(controller, err);
|
|
16658
16658
|
}
|
|
16659
16659
|
};
|
|
16660
|
-
function deleteCachedValue(store,
|
|
16660
|
+
function deleteCachedValue(store, cacheKey2) {
|
|
16661
16661
|
try {
|
|
16662
|
-
store.delete(
|
|
16662
|
+
store.delete(cacheKey2)?.catch?.(noop);
|
|
16663
16663
|
} catch {
|
|
16664
16664
|
}
|
|
16665
16665
|
}
|
|
16666
|
-
function deleteCachedValueIfNotModified(statusCode, store,
|
|
16666
|
+
function deleteCachedValueIfNotModified(statusCode, store, cacheKey2) {
|
|
16667
16667
|
if (statusCode === 304) {
|
|
16668
|
-
deleteCachedValue(store,
|
|
16668
|
+
deleteCachedValue(store, cacheKey2);
|
|
16669
16669
|
}
|
|
16670
16670
|
}
|
|
16671
16671
|
function revalidationResponseDisallowsCachedReuse(cacheType, resHeaders, cacheControlDirectives) {
|
|
@@ -17228,9 +17228,9 @@ var require_cache2 = __commonJS({
|
|
|
17228
17228
|
function revalidationResponseUpdatesCacheControl(headers) {
|
|
17229
17229
|
return headers["cache-control"] !== void 0;
|
|
17230
17230
|
}
|
|
17231
|
-
function deleteCachedValue(store,
|
|
17231
|
+
function deleteCachedValue(store, cacheKey2) {
|
|
17232
17232
|
try {
|
|
17233
|
-
store.delete(
|
|
17233
|
+
store.delete(cacheKey2)?.catch?.(nop);
|
|
17234
17234
|
} catch {
|
|
17235
17235
|
}
|
|
17236
17236
|
}
|
|
@@ -17282,7 +17282,7 @@ var require_cache2 = __commonJS({
|
|
|
17282
17282
|
const staleWhileRevalidateExpiry = result.staleAt + staleWhileRevalidate * 1e3;
|
|
17283
17283
|
return now <= staleWhileRevalidateExpiry;
|
|
17284
17284
|
}
|
|
17285
|
-
function handleUncachedResponse(dispatch, globalOpts,
|
|
17285
|
+
function handleUncachedResponse(dispatch, globalOpts, cacheKey2, handler, opts, reqCacheControl) {
|
|
17286
17286
|
if (reqCacheControl?.["only-if-cached"]) {
|
|
17287
17287
|
let aborted = false;
|
|
17288
17288
|
try {
|
|
@@ -17310,7 +17310,7 @@ var require_cache2 = __commonJS({
|
|
|
17310
17310
|
}
|
|
17311
17311
|
return true;
|
|
17312
17312
|
}
|
|
17313
|
-
return dispatch(opts, new CacheHandler(globalOpts,
|
|
17313
|
+
return dispatch(opts, new CacheHandler(globalOpts, cacheKey2, handler));
|
|
17314
17314
|
}
|
|
17315
17315
|
function sendCachedValue(handler, opts, result, age, context, isStale2) {
|
|
17316
17316
|
const stream = util.isStream(result.body) ? result.body : Readable.from(result.body ?? []);
|
|
@@ -17366,13 +17366,13 @@ var require_cache2 = __commonJS({
|
|
|
17366
17366
|
});
|
|
17367
17367
|
}
|
|
17368
17368
|
}
|
|
17369
|
-
function handleResult(dispatch, globalOpts,
|
|
17369
|
+
function handleResult(dispatch, globalOpts, cacheKey2, handler, opts, reqCacheControl, result) {
|
|
17370
17370
|
if (!result) {
|
|
17371
|
-
return handleUncachedResponse(dispatch, globalOpts,
|
|
17371
|
+
return handleUncachedResponse(dispatch, globalOpts, cacheKey2, handler, opts, reqCacheControl);
|
|
17372
17372
|
}
|
|
17373
17373
|
const now = Date.now();
|
|
17374
17374
|
if (now > result.deleteAt) {
|
|
17375
|
-
return dispatch(opts, new CacheHandler(globalOpts,
|
|
17375
|
+
return dispatch(opts, new CacheHandler(globalOpts, cacheKey2, handler));
|
|
17376
17376
|
}
|
|
17377
17377
|
const age = Math.round((now - result.cachedAt) / 1e3);
|
|
17378
17378
|
const requestMaxAgeExpired = reqCacheControl?.["max-age"] !== void 0 && age >= reqCacheControl["max-age"];
|
|
@@ -17380,7 +17380,7 @@ var require_cache2 = __commonJS({
|
|
|
17380
17380
|
const revalidate = requestMaxAgeExpired || needsRevalidation(result, reqCacheControl, opts);
|
|
17381
17381
|
if (stale || revalidate) {
|
|
17382
17382
|
if (util.isStream(opts.body) && util.bodyLength(opts.body) !== 0) {
|
|
17383
|
-
return dispatch(opts, new CacheHandler(globalOpts,
|
|
17383
|
+
return dispatch(opts, new CacheHandler(globalOpts, cacheKey2, handler));
|
|
17384
17384
|
}
|
|
17385
17385
|
if (!revalidate && withinStaleWhileRevalidateWindow(result, globalOpts.type)) {
|
|
17386
17386
|
sendCachedValue(handler, opts, result, age, null, true);
|
|
@@ -17391,7 +17391,7 @@ var require_cache2 = __commonJS({
|
|
|
17391
17391
|
...opts,
|
|
17392
17392
|
headers: headers2
|
|
17393
17393
|
},
|
|
17394
|
-
new CacheHandler(globalOpts,
|
|
17394
|
+
new CacheHandler(globalOpts, cacheKey2, {
|
|
17395
17395
|
// Silent handler that just updates the cache
|
|
17396
17396
|
onRequestStart() {
|
|
17397
17397
|
},
|
|
@@ -17431,11 +17431,11 @@ var require_cache2 = __commonJS({
|
|
|
17431
17431
|
if (util.isStream(result.body)) {
|
|
17432
17432
|
result.body.on("error", nop).destroy();
|
|
17433
17433
|
}
|
|
17434
|
-
deleteCachedValue(globalOpts.store,
|
|
17435
|
-
return dispatch(opts, new CacheHandler(globalOpts,
|
|
17434
|
+
deleteCachedValue(globalOpts.store, cacheKey2);
|
|
17435
|
+
return dispatch(opts, new CacheHandler(globalOpts, cacheKey2, handler));
|
|
17436
17436
|
}
|
|
17437
17437
|
if (revalidationResponseUpdatesCacheControl(headers2)) {
|
|
17438
|
-
deleteCachedValue(globalOpts.store,
|
|
17438
|
+
deleteCachedValue(globalOpts.store, cacheKey2);
|
|
17439
17439
|
}
|
|
17440
17440
|
}
|
|
17441
17441
|
sendCachedValue(handler, opts, result, age, context, stale);
|
|
@@ -17443,7 +17443,7 @@ var require_cache2 = __commonJS({
|
|
|
17443
17443
|
result.body.on("error", nop).destroy();
|
|
17444
17444
|
}
|
|
17445
17445
|
},
|
|
17446
|
-
new CacheHandler(globalOpts,
|
|
17446
|
+
new CacheHandler(globalOpts, cacheKey2, handler),
|
|
17447
17447
|
withinStaleIfErrorThreshold
|
|
17448
17448
|
)
|
|
17449
17449
|
);
|
|
@@ -17518,13 +17518,13 @@ var require_cache2 = __commonJS({
|
|
|
17518
17518
|
if (reqCacheControl?.["no-store"]) {
|
|
17519
17519
|
return dispatch(opts2, handler);
|
|
17520
17520
|
}
|
|
17521
|
-
const
|
|
17522
|
-
const result = store.get(
|
|
17521
|
+
const cacheKey2 = makeCacheKey(opts2);
|
|
17522
|
+
const result = store.get(cacheKey2);
|
|
17523
17523
|
if (result && typeof result.then === "function") {
|
|
17524
17524
|
return result.then((result2) => handleResult(
|
|
17525
17525
|
dispatch,
|
|
17526
17526
|
globalOpts,
|
|
17527
|
-
|
|
17527
|
+
cacheKey2,
|
|
17528
17528
|
handler,
|
|
17529
17529
|
opts2,
|
|
17530
17530
|
reqCacheControl,
|
|
@@ -17534,7 +17534,7 @@ var require_cache2 = __commonJS({
|
|
|
17534
17534
|
return handleResult(
|
|
17535
17535
|
dispatch,
|
|
17536
17536
|
globalOpts,
|
|
17537
|
-
|
|
17537
|
+
cacheKey2,
|
|
17538
17538
|
handler,
|
|
17539
17539
|
opts2,
|
|
17540
17540
|
reqCacheControl,
|
|
@@ -18175,8 +18175,8 @@ var require_deduplicate = __commonJS({
|
|
|
18175
18175
|
}
|
|
18176
18176
|
}
|
|
18177
18177
|
}
|
|
18178
|
-
const
|
|
18179
|
-
const dedupeKey = makeDeduplicationKey(
|
|
18178
|
+
const cacheKey2 = makeCacheKey(opts2);
|
|
18179
|
+
const dedupeKey = makeDeduplicationKey(cacheKey2, excludeHeaderNamesSet);
|
|
18180
18180
|
const pendingHandler = pendingRequests.get(dedupeKey);
|
|
18181
18181
|
if (pendingHandler) {
|
|
18182
18182
|
if (pendingHandler.addWaitingHandler(handler)) {
|
|
@@ -25836,7 +25836,9 @@ var Cache = class _Cache extends I {
|
|
|
25836
25836
|
return this.#diskRead(k, v, opts.context?.integrity);
|
|
25837
25837
|
},
|
|
25838
25838
|
allowStaleOnFetchRejection: true,
|
|
25839
|
-
|
|
25839
|
+
// Eviction aborts in-flight fetch() placeholders. Resolving those
|
|
25840
|
+
// as undefined is treated as a cache miss and re-downloads tarballs.
|
|
25841
|
+
ignoreFetchAbort: true,
|
|
25840
25842
|
allowStale: true,
|
|
25841
25843
|
noDeleteOnStaleGet: true
|
|
25842
25844
|
});
|
|
@@ -26444,6 +26446,7 @@ var CacheEntry = class _CacheEntry {
|
|
|
26444
26446
|
#trustIntegrity;
|
|
26445
26447
|
#staleWhileRevalidateFactor;
|
|
26446
26448
|
#fromCache = false;
|
|
26449
|
+
#headSize;
|
|
26447
26450
|
constructor(statusCode, headers, {
|
|
26448
26451
|
body,
|
|
26449
26452
|
integrity,
|
|
@@ -26586,6 +26589,13 @@ var CacheEntry = class _CacheEntry {
|
|
|
26586
26589
|
get fromCache() {
|
|
26587
26590
|
return this.#fromCache;
|
|
26588
26591
|
}
|
|
26592
|
+
/**
|
|
26593
|
+
* Byte length of the encoded head (4-byte length prefix + status +
|
|
26594
|
+
* headers). Set when decoded from cache or after `encodeHead()`.
|
|
26595
|
+
*/
|
|
26596
|
+
get headSize() {
|
|
26597
|
+
return this.#headSize;
|
|
26598
|
+
}
|
|
26589
26599
|
get statusCode() {
|
|
26590
26600
|
return this.#statusCode;
|
|
26591
26601
|
}
|
|
@@ -26770,19 +26780,10 @@ var CacheEntry = class _CacheEntry {
|
|
|
26770
26780
|
this.#json = obj;
|
|
26771
26781
|
return obj;
|
|
26772
26782
|
}
|
|
26773
|
-
|
|
26774
|
-
|
|
26775
|
-
* and this static method will decode it into a CacheEntry representing
|
|
26776
|
-
* the cached response.
|
|
26777
|
-
*/
|
|
26778
|
-
static decode(buffer) {
|
|
26779
|
-
if (buffer.length < 4) {
|
|
26780
|
-
return emptyCacheEntry;
|
|
26781
|
-
}
|
|
26783
|
+
static #parseHead(buffer) {
|
|
26784
|
+
if (buffer.length < 4) return void 0;
|
|
26782
26785
|
const headSize = readSize(buffer, 0);
|
|
26783
|
-
if (buffer.length < headSize)
|
|
26784
|
-
return emptyCacheEntry;
|
|
26785
|
-
}
|
|
26786
|
+
if (buffer.length < headSize) return void 0;
|
|
26786
26787
|
const statusCode = Number(getDecodedValue(buffer.subarray(4, 7)));
|
|
26787
26788
|
const headersBuffer = buffer.subarray(7, headSize);
|
|
26788
26789
|
const headers = [];
|
|
@@ -26801,22 +26802,51 @@ var CacheEntry = class _CacheEntry {
|
|
|
26801
26802
|
headers.push(val);
|
|
26802
26803
|
i += size;
|
|
26803
26804
|
}
|
|
26804
|
-
|
|
26805
|
+
return { statusCode, headers, integrity, headSize };
|
|
26806
|
+
}
|
|
26807
|
+
/**
|
|
26808
|
+
* Decode only the status/headers from an encoded cache buffer.
|
|
26809
|
+
* The body is not read; `headSize` records how many bytes the head
|
|
26810
|
+
* occupies so a later `encodeHead()` can be patched in place.
|
|
26811
|
+
*/
|
|
26812
|
+
static decodeHead(buffer) {
|
|
26813
|
+
const parsed = _CacheEntry.#parseHead(buffer);
|
|
26814
|
+
if (!parsed) return emptyCacheEntry;
|
|
26815
|
+
const c = new _CacheEntry(parsed.statusCode, parsed.headers, {
|
|
26816
|
+
body: new Uint8Array(0),
|
|
26817
|
+
integrity: parsed.integrity,
|
|
26818
|
+
trustIntegrity: true
|
|
26819
|
+
});
|
|
26820
|
+
c.#fromCache = true;
|
|
26821
|
+
c.#headSize = parsed.headSize;
|
|
26822
|
+
return c;
|
|
26823
|
+
}
|
|
26824
|
+
/**
|
|
26825
|
+
* Pass the contents of a @vltpkg/cache.Cache object as a buffer,
|
|
26826
|
+
* and this static method will decode it into a CacheEntry representing
|
|
26827
|
+
* the cached response.
|
|
26828
|
+
*/
|
|
26829
|
+
static decode(buffer, options = {}) {
|
|
26830
|
+
const parsed = _CacheEntry.#parseHead(buffer);
|
|
26831
|
+
if (!parsed) return emptyCacheEntry;
|
|
26832
|
+
const body = buffer.subarray(parsed.headSize);
|
|
26805
26833
|
const c = new _CacheEntry(
|
|
26806
|
-
statusCode,
|
|
26834
|
+
parsed.statusCode,
|
|
26807
26835
|
setRawHeader(
|
|
26808
|
-
headers,
|
|
26836
|
+
parsed.headers,
|
|
26809
26837
|
"content-length",
|
|
26810
26838
|
String(body.byteLength)
|
|
26811
26839
|
),
|
|
26812
26840
|
{
|
|
26813
26841
|
body,
|
|
26814
|
-
integrity,
|
|
26842
|
+
integrity: parsed.integrity,
|
|
26815
26843
|
trustIntegrity: true,
|
|
26816
|
-
contentLength: body.byteLength
|
|
26844
|
+
contentLength: body.byteLength,
|
|
26845
|
+
...options
|
|
26817
26846
|
}
|
|
26818
26847
|
);
|
|
26819
26848
|
c.#fromCache = true;
|
|
26849
|
+
c.#headSize = parsed.headSize;
|
|
26820
26850
|
try {
|
|
26821
26851
|
if (c.isJSON) {
|
|
26822
26852
|
c.unzip();
|
|
@@ -26834,42 +26864,49 @@ var CacheEntry = class _CacheEntry {
|
|
|
26834
26864
|
return gzipBytes[0] === 31 && gzipBytes[1] === 139;
|
|
26835
26865
|
}
|
|
26836
26866
|
/**
|
|
26837
|
-
* Encode
|
|
26867
|
+
* Encode status + headers (no body) as they appear at the start of
|
|
26868
|
+
* an on-disk cache file.
|
|
26838
26869
|
*/
|
|
26839
|
-
|
|
26840
|
-
if (this.isJSON) this.json();
|
|
26870
|
+
encodeHead() {
|
|
26841
26871
|
const statusStr = String(this.#statusCode);
|
|
26842
26872
|
const statusBytes = getEncondedValue(statusStr);
|
|
26843
26873
|
let headLength = 4 + statusBytes.byteLength;
|
|
26844
26874
|
for (const h of this.#headers) headLength += 4 + h.byteLength;
|
|
26845
|
-
const
|
|
26846
|
-
|
|
26847
|
-
|
|
26848
|
-
|
|
26849
|
-
|
|
26850
|
-
const headerChunks = [];
|
|
26851
|
-
for (const h of this.#headers) {
|
|
26852
|
-
const l = headLenBytes.byteLength + h.byteLength;
|
|
26853
|
-
const lb = new Uint8Array(4);
|
|
26854
|
-
lb[0] = l >> 24 & 255;
|
|
26855
|
-
lb[1] = l >> 16 & 255;
|
|
26856
|
-
lb[2] = l >> 8 & 255;
|
|
26857
|
-
lb[3] = l & 255;
|
|
26858
|
-
headerChunks.push(lb, h);
|
|
26859
|
-
}
|
|
26860
|
-
const total = headLenBytes.byteLength + statusBytes.byteLength + headerChunks.reduce((n, b) => n + b.byteLength, 0) + this._body.byteLength;
|
|
26861
|
-
const outBuffer = new ArrayBuffer(total);
|
|
26862
|
-
const out = Buffer.from(outBuffer, 0, total);
|
|
26875
|
+
const out = Buffer.from(
|
|
26876
|
+
new ArrayBuffer(headLength),
|
|
26877
|
+
0,
|
|
26878
|
+
headLength
|
|
26879
|
+
);
|
|
26863
26880
|
let off = 0;
|
|
26864
|
-
out
|
|
26865
|
-
off
|
|
26881
|
+
out[off++] = headLength >> 24 & 255;
|
|
26882
|
+
out[off++] = headLength >> 16 & 255;
|
|
26883
|
+
out[off++] = headLength >> 8 & 255;
|
|
26884
|
+
out[off++] = headLength & 255;
|
|
26866
26885
|
out.set(statusBytes, off);
|
|
26867
26886
|
off += statusBytes.byteLength;
|
|
26868
|
-
for (const
|
|
26869
|
-
|
|
26870
|
-
off
|
|
26871
|
-
|
|
26872
|
-
|
|
26887
|
+
for (const h of this.#headers) {
|
|
26888
|
+
const l = 4 + h.byteLength;
|
|
26889
|
+
out[off++] = l >> 24 & 255;
|
|
26890
|
+
out[off++] = l >> 16 & 255;
|
|
26891
|
+
out[off++] = l >> 8 & 255;
|
|
26892
|
+
out[off++] = l & 255;
|
|
26893
|
+
out.set(h, off);
|
|
26894
|
+
off += h.byteLength;
|
|
26895
|
+
}
|
|
26896
|
+
this.#headSize = headLength;
|
|
26897
|
+
return out;
|
|
26898
|
+
}
|
|
26899
|
+
/**
|
|
26900
|
+
* Encode the entry as a single Buffer for writing to the cache
|
|
26901
|
+
*/
|
|
26902
|
+
encode() {
|
|
26903
|
+
if (this.isJSON) this.json();
|
|
26904
|
+
const head = this.encodeHead();
|
|
26905
|
+
const body = this._body;
|
|
26906
|
+
const total = head.byteLength + body.byteLength;
|
|
26907
|
+
const out = Buffer.from(new ArrayBuffer(total), 0, total);
|
|
26908
|
+
out.set(head, 0);
|
|
26909
|
+
out.set(body, head.byteLength);
|
|
26873
26910
|
return out;
|
|
26874
26911
|
}
|
|
26875
26912
|
};
|
|
@@ -26927,7 +26964,7 @@ var register2 = (path, method, url) => {
|
|
|
26927
26964
|
var handleBeforeExit2 = () => {
|
|
26928
26965
|
const compileCacheDir = module2.getCompileCacheDir();
|
|
26929
26966
|
for (const [path, r] of registered2) {
|
|
26930
|
-
if (!r.size)
|
|
26967
|
+
if (!r.size) continue;
|
|
26931
26968
|
const env = { ...process.env };
|
|
26932
26969
|
if (compileCacheDir) env.NODE_COMPILE_CACHE ??= compileCacheDir;
|
|
26933
26970
|
const args = [];
|
|
@@ -27144,6 +27181,32 @@ var setCacheHeaders = (options, entry) => {
|
|
|
27144
27181
|
// ../../src/registry-client/src/token-response.ts
|
|
27145
27182
|
var getTokenResponse = (b) => !!b && typeof b === "object" && "token" in b && typeof b.token === "string" && b.token ? { token: b.token } : void 0;
|
|
27146
27183
|
|
|
27184
|
+
// ../../src/registry-client/src/response.ts
|
|
27185
|
+
var collectHeaders = (response) => {
|
|
27186
|
+
const h = [];
|
|
27187
|
+
for (const [key, value] of Object.entries(response.headers)) {
|
|
27188
|
+
if (Array.isArray(value)) {
|
|
27189
|
+
h.push(
|
|
27190
|
+
getEncondedValue(key),
|
|
27191
|
+
getEncondedValue(value.join(", "))
|
|
27192
|
+
);
|
|
27193
|
+
} else if (typeof value === "string") {
|
|
27194
|
+
h.push(getEncondedValue(key), getEncondedValue(value));
|
|
27195
|
+
}
|
|
27196
|
+
}
|
|
27197
|
+
return h;
|
|
27198
|
+
};
|
|
27199
|
+
var readBody = async (response, entry) => {
|
|
27200
|
+
response.body.on(
|
|
27201
|
+
"data",
|
|
27202
|
+
(chunk) => entry.addBody(chunk)
|
|
27203
|
+
);
|
|
27204
|
+
return await new Promise((res, rej) => {
|
|
27205
|
+
response.body.on("error", rej);
|
|
27206
|
+
response.body.on("end", () => res(entry));
|
|
27207
|
+
});
|
|
27208
|
+
};
|
|
27209
|
+
|
|
27147
27210
|
// ../../src/registry-client/src/oidc.ts
|
|
27148
27211
|
var import_undici2 = __toESM(require_undici(), 1);
|
|
27149
27212
|
var log2 = (...args) => (
|
|
@@ -27294,6 +27357,7 @@ var exchangeToken = async (idToken, packageName, registry) => {
|
|
|
27294
27357
|
|
|
27295
27358
|
// ../../src/registry-client/src/index.ts
|
|
27296
27359
|
var isCacheableMethod = (m) => m === "GET" || m === "HEAD";
|
|
27360
|
+
var cacheKey = (method, url) => `${method !== "GET" ? method + " " : ""}${url}`;
|
|
27297
27361
|
var { version } = loadPackageJson(
|
|
27298
27362
|
import.meta.filename,
|
|
27299
27363
|
"registry-client-package.json"
|
|
@@ -27464,7 +27528,9 @@ var RegistryClient = class {
|
|
|
27464
27528
|
#decodeCached(buffer) {
|
|
27465
27529
|
const hit = this.#decoded.get(buffer);
|
|
27466
27530
|
if (hit) return hit;
|
|
27467
|
-
const entry = CacheEntry.decode(buffer
|
|
27531
|
+
const entry = CacheEntry.decode(buffer, {
|
|
27532
|
+
"stale-while-revalidate-factor": this.staleWhileRevalidateFactor
|
|
27533
|
+
});
|
|
27468
27534
|
if (!entry.statusCode) return void 0;
|
|
27469
27535
|
if (entry.isJSON) {
|
|
27470
27536
|
try {
|
|
@@ -27512,7 +27578,7 @@ var RegistryClient = class {
|
|
|
27512
27578
|
const m = isCacheableMethod(method) ? method : void 0;
|
|
27513
27579
|
const { useCache = !!m } = options;
|
|
27514
27580
|
signal?.throwIfAborted();
|
|
27515
|
-
const key =
|
|
27581
|
+
const key = cacheKey(method, u);
|
|
27516
27582
|
const buffer = useCache ? await this.cache.fetch(key, { context: { integrity } }) : void 0;
|
|
27517
27583
|
const entry = buffer ? this.#decodeCached(buffer) : void 0;
|
|
27518
27584
|
if (entry?.valid) {
|
|
@@ -27621,17 +27687,7 @@ var RegistryClient = class {
|
|
|
27621
27687
|
consumedBody = otpResult.bodyConsumed;
|
|
27622
27688
|
}
|
|
27623
27689
|
}
|
|
27624
|
-
const h =
|
|
27625
|
-
for (const [key, value] of Object.entries(response.headers)) {
|
|
27626
|
-
if (Array.isArray(value)) {
|
|
27627
|
-
h.push(
|
|
27628
|
-
getEncondedValue(key),
|
|
27629
|
-
getEncondedValue(value.join(", "))
|
|
27630
|
-
);
|
|
27631
|
-
} else if (typeof value === "string") {
|
|
27632
|
-
h.push(getEncondedValue(key), getEncondedValue(value));
|
|
27633
|
-
}
|
|
27634
|
-
}
|
|
27690
|
+
const h = collectHeaders(response);
|
|
27635
27691
|
const { integrity, trustIntegrity } = options;
|
|
27636
27692
|
const contentLength = consumedBody !== void 0 ? consumedBody.length : response.headers["content-length"] ? Number(response.headers["content-length"]) : (
|
|
27637
27693
|
/* c8 ignore next */
|
|
@@ -27662,14 +27718,7 @@ var RegistryClient = class {
|
|
|
27662
27718
|
}
|
|
27663
27719
|
return result;
|
|
27664
27720
|
}
|
|
27665
|
-
response
|
|
27666
|
-
"data",
|
|
27667
|
-
(chunk) => result.addBody(chunk)
|
|
27668
|
-
);
|
|
27669
|
-
return await new Promise((res, rej) => {
|
|
27670
|
-
response.body.on("error", rej);
|
|
27671
|
-
response.body.on("end", () => res(result));
|
|
27672
|
-
});
|
|
27721
|
+
return await readBody(response, result);
|
|
27673
27722
|
}
|
|
27674
27723
|
};
|
|
27675
27724
|
|
|
@@ -27689,6 +27738,7 @@ export {
|
|
|
27689
27738
|
CacheEntry,
|
|
27690
27739
|
oidc,
|
|
27691
27740
|
isCacheableMethod,
|
|
27741
|
+
cacheKey,
|
|
27692
27742
|
userAgent,
|
|
27693
27743
|
RegistryClient
|
|
27694
27744
|
};
|
|
@@ -16,10 +16,10 @@ import {
|
|
|
16
16
|
} from "./chunk-ZWKI5OSF.js";
|
|
17
17
|
import {
|
|
18
18
|
minimatch
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-SVBEF5PK.js";
|
|
20
20
|
import {
|
|
21
21
|
Spec
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-XKVU23NC.js";
|
|
23
23
|
import {
|
|
24
24
|
parse,
|
|
25
25
|
stringify
|
|
@@ -13,10 +13,10 @@ import {
|
|
|
13
13
|
graphRun,
|
|
14
14
|
graphRunSync,
|
|
15
15
|
joinDepIDTuple
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-3OPNZI6G.js";
|
|
17
17
|
import {
|
|
18
18
|
Spec
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-XKVU23NC.js";
|
|
20
20
|
import {
|
|
21
21
|
load,
|
|
22
22
|
parse as parse2,
|
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
normalizeManifest,
|
|
42
42
|
parse,
|
|
43
43
|
satisfies
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-VFBCWAOC.js";
|
|
45
45
|
import {
|
|
46
46
|
error
|
|
47
47
|
} from "./chunk-WZWDS3W4.js";
|
|
@@ -990,13 +990,31 @@ var getOptions = (options) => ({
|
|
|
990
990
|
...options["git-host-archives"]
|
|
991
991
|
} : defaultGitHostArchives
|
|
992
992
|
});
|
|
993
|
+
var protocolRE = /^([a-zA-Z][a-zA-Z0-9+-]+):/;
|
|
994
|
+
var builtinProtocols = /* @__PURE__ */ new Set([
|
|
995
|
+
"catalog",
|
|
996
|
+
"workspace",
|
|
997
|
+
"registry",
|
|
998
|
+
"file",
|
|
999
|
+
"http",
|
|
1000
|
+
"https",
|
|
1001
|
+
"git",
|
|
1002
|
+
"git+ssh",
|
|
1003
|
+
"git+http",
|
|
1004
|
+
"git+https",
|
|
1005
|
+
"git+file"
|
|
1006
|
+
]);
|
|
1007
|
+
var unknownProtocol = (str, options) => {
|
|
1008
|
+
const p = protocolRE.exec(str)?.[1];
|
|
1009
|
+
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;
|
|
1010
|
+
};
|
|
993
1011
|
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
|
|
994
1012
|
// custom registered registry protocol e.g: `github:`, `custom:`
|
|
995
1013
|
[
|
|
996
1014
|
...Object.keys(options["git-hosts"]),
|
|
997
1015
|
...Object.keys(options.registries),
|
|
998
1016
|
...Object.keys(options["jsr-registries"])
|
|
999
|
-
].some((key) => spec.startsWith(`${key}:`));
|
|
1017
|
+
].some((key) => spec.startsWith(`${key}:`)) || unknownProtocol(spec, options) !== void 0;
|
|
1000
1018
|
var findFirstAt = (spec, hasScope) => spec.indexOf("@", hasScope ? 1 : 0);
|
|
1001
1019
|
var findGitIdentifier = (spec) => spec.indexOf("#") > 2;
|
|
1002
1020
|
var findFileIdentifier = (spec) => spec.includes("/");
|
|
@@ -1117,6 +1135,7 @@ var Spec = class _Spec {
|
|
|
1117
1135
|
assertPathSafeName(this.name, this.spec);
|
|
1118
1136
|
} else {
|
|
1119
1137
|
this.spec = spec;
|
|
1138
|
+
this.#assertKnownProtocol(spec);
|
|
1120
1139
|
if (!spec.startsWith("git@") && startsWithSpecIdentifier(spec, this.options) && spec.includes(":") && [
|
|
1121
1140
|
...Object.keys(this.options.registries),
|
|
1122
1141
|
...Object.keys(defaultRegistries)
|
|
@@ -1302,6 +1321,7 @@ var Spec = class _Spec {
|
|
|
1302
1321
|
this.spec = `${this.name}@${this.bareSpec}`;
|
|
1303
1322
|
return;
|
|
1304
1323
|
}
|
|
1324
|
+
this.#assertKnownProtocol(this.bareSpec);
|
|
1305
1325
|
if (!this.bareSpec.startsWith("./") && !this.bareSpec.startsWith("../") && this.options["git-hosts"].github) {
|
|
1306
1326
|
const hash = this.bareSpec.indexOf("#");
|
|
1307
1327
|
const up = hash === -1 ? this.bareSpec : this.bareSpec.substring(0, hash);
|
|
@@ -1449,6 +1469,22 @@ var Spec = class _Spec {
|
|
|
1449
1469
|
this.spec = this.name + "@" + this.bareSpec;
|
|
1450
1470
|
return this.subspec;
|
|
1451
1471
|
}
|
|
1472
|
+
#assertKnownProtocol(str) {
|
|
1473
|
+
const proto = unknownProtocol(str, this.options);
|
|
1474
|
+
if (proto === void 0) return;
|
|
1475
|
+
throw this.#error(`Protocol ${proto}: is not defined`, {
|
|
1476
|
+
found: `${proto}:`,
|
|
1477
|
+
validOptions: [
|
|
1478
|
+
.../* @__PURE__ */ new Set([
|
|
1479
|
+
...builtinProtocols,
|
|
1480
|
+
this.options["default-registry-alias"],
|
|
1481
|
+
...Object.keys(this.options.registries),
|
|
1482
|
+
...Object.keys(this.options["git-hosts"]),
|
|
1483
|
+
...Object.keys(this.options["jsr-registries"])
|
|
1484
|
+
])
|
|
1485
|
+
].map((p) => `${p}:`)
|
|
1486
|
+
});
|
|
1487
|
+
}
|
|
1452
1488
|
#error(message, extra = {}) {
|
|
1453
1489
|
return error(message, { spec: this.spec, ...extra }, this.#error);
|
|
1454
1490
|
}
|