@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
|
@@ -11,25 +11,25 @@ import {createRequire as _vlt_createRequire} from "node:module";
|
|
|
11
11
|
var require = _vlt_createRequire(import.meta.filename);
|
|
12
12
|
import {
|
|
13
13
|
resolveRegistry
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-O44Z6MAV.js";
|
|
15
15
|
import {
|
|
16
16
|
commandUsage
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
17
|
+
} from "./chunk-55DYW2MP.js";
|
|
18
|
+
import "./chunk-G5NJ7CYI.js";
|
|
19
|
+
import "./chunk-6A3XS52F.js";
|
|
20
20
|
import {
|
|
21
21
|
RegistryClient
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-OE6VHHN4.js";
|
|
23
23
|
import "./chunk-APMYKJI2.js";
|
|
24
24
|
import {
|
|
25
25
|
assertOk
|
|
26
|
-
} from "./chunk-
|
|
27
|
-
import "./chunk-
|
|
26
|
+
} from "./chunk-UQUIO7LW.js";
|
|
27
|
+
import "./chunk-JTUZP2OD.js";
|
|
28
28
|
import "./chunk-U7TEQCBN.js";
|
|
29
|
-
import "./chunk-VFBCWAOC.js";
|
|
30
29
|
import "./chunk-XNLSTHDK.js";
|
|
31
30
|
import "./chunk-BHJT53TP.js";
|
|
32
31
|
import "./chunk-VE6CCH33.js";
|
|
32
|
+
import "./chunk-G5BSQ6DP.js";
|
|
33
33
|
import {
|
|
34
34
|
error
|
|
35
35
|
} from "./chunk-WZWDS3W4.js";
|
|
@@ -14,46 +14,46 @@ import {
|
|
|
14
14
|
} from "./chunk-CLVRCGOZ.js";
|
|
15
15
|
import {
|
|
16
16
|
openUrl
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-3CUFJPBK.js";
|
|
18
18
|
import {
|
|
19
19
|
createHostContextsMap
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-
|
|
20
|
+
} from "./chunk-YFNQ6HZ3.js";
|
|
21
|
+
import "./chunk-UNWQVOLY.js";
|
|
22
|
+
import "./chunk-GUATFMMU.js";
|
|
23
23
|
import "./chunk-G2YT2GWF.js";
|
|
24
|
-
import "./chunk-
|
|
24
|
+
import "./chunk-YTT3UHUB.js";
|
|
25
25
|
import {
|
|
26
26
|
PackageInfoClient
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-5YB6UIC3.js";
|
|
28
28
|
import "./chunk-ZWKI5OSF.js";
|
|
29
29
|
import "./chunk-WGDTG44V.js";
|
|
30
|
-
import "./chunk-
|
|
30
|
+
import "./chunk-O44Z6MAV.js";
|
|
31
31
|
import {
|
|
32
32
|
Query,
|
|
33
33
|
actual
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-B2FK2HHL.js";
|
|
35
35
|
import {
|
|
36
36
|
SecurityArchive
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-FOJCK57G.js";
|
|
38
38
|
import {
|
|
39
39
|
commandUsage
|
|
40
|
-
} from "./chunk-
|
|
41
|
-
import "./chunk-
|
|
40
|
+
} from "./chunk-55DYW2MP.js";
|
|
41
|
+
import "./chunk-6G7MTZGS.js";
|
|
42
42
|
import "./chunk-4KCU2KZL.js";
|
|
43
|
-
import "./chunk-
|
|
43
|
+
import "./chunk-SYGF27W7.js";
|
|
44
44
|
import {
|
|
45
45
|
Spec
|
|
46
|
-
} from "./chunk-
|
|
47
|
-
import "./chunk-
|
|
46
|
+
} from "./chunk-G5NJ7CYI.js";
|
|
47
|
+
import "./chunk-6A3XS52F.js";
|
|
48
48
|
import "./chunk-HTOTG4TS.js";
|
|
49
49
|
import "./chunk-APMYKJI2.js";
|
|
50
|
-
import "./chunk-
|
|
51
|
-
import "./chunk-
|
|
50
|
+
import "./chunk-UQUIO7LW.js";
|
|
51
|
+
import "./chunk-JTUZP2OD.js";
|
|
52
52
|
import "./chunk-U7TEQCBN.js";
|
|
53
|
-
import "./chunk-VFBCWAOC.js";
|
|
54
53
|
import "./chunk-XNLSTHDK.js";
|
|
55
54
|
import "./chunk-BHJT53TP.js";
|
|
56
55
|
import "./chunk-VE6CCH33.js";
|
|
56
|
+
import "./chunk-G5BSQ6DP.js";
|
|
57
57
|
import {
|
|
58
58
|
error
|
|
59
59
|
} from "./chunk-WZWDS3W4.js";
|
|
@@ -11,24 +11,24 @@ import {createRequire as _vlt_createRequire} from "node:module";
|
|
|
11
11
|
var require = _vlt_createRequire(import.meta.filename);
|
|
12
12
|
import {
|
|
13
13
|
build
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-B2FK2HHL.js";
|
|
15
|
+
import "./chunk-FOJCK57G.js";
|
|
16
16
|
import {
|
|
17
17
|
commandUsage
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-
|
|
18
|
+
} from "./chunk-55DYW2MP.js";
|
|
19
|
+
import "./chunk-6G7MTZGS.js";
|
|
20
|
+
import "./chunk-SYGF27W7.js";
|
|
21
|
+
import "./chunk-G5NJ7CYI.js";
|
|
22
|
+
import "./chunk-6A3XS52F.js";
|
|
23
23
|
import "./chunk-HTOTG4TS.js";
|
|
24
|
-
import "./chunk-
|
|
24
|
+
import "./chunk-JTUZP2OD.js";
|
|
25
25
|
import "./chunk-U7TEQCBN.js";
|
|
26
|
-
import {
|
|
27
|
-
isErrorWithCause
|
|
28
|
-
} from "./chunk-VFBCWAOC.js";
|
|
29
26
|
import "./chunk-XNLSTHDK.js";
|
|
30
27
|
import "./chunk-BHJT53TP.js";
|
|
31
28
|
import "./chunk-VE6CCH33.js";
|
|
29
|
+
import {
|
|
30
|
+
isErrorWithCause
|
|
31
|
+
} from "./chunk-G5BSQ6DP.js";
|
|
32
32
|
import {
|
|
33
33
|
error
|
|
34
34
|
} from "./chunk-WZWDS3W4.js";
|
|
@@ -15,43 +15,56 @@ import {
|
|
|
15
15
|
import {
|
|
16
16
|
stderr,
|
|
17
17
|
stdout
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import "./chunk-
|
|
18
|
+
} from "./chunk-UNWQVOLY.js";
|
|
19
|
+
import "./chunk-GUATFMMU.js";
|
|
20
20
|
import "./chunk-G2YT2GWF.js";
|
|
21
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-YTT3UHUB.js";
|
|
22
22
|
import "./chunk-WGDTG44V.js";
|
|
23
|
-
import "./chunk-
|
|
23
|
+
import "./chunk-O44Z6MAV.js";
|
|
24
24
|
import {
|
|
25
25
|
commandUsage
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-55DYW2MP.js";
|
|
27
27
|
import {
|
|
28
28
|
ViewClass
|
|
29
29
|
} from "./chunk-4KCU2KZL.js";
|
|
30
|
-
import "./chunk-
|
|
30
|
+
import "./chunk-SYGF27W7.js";
|
|
31
31
|
import {
|
|
32
32
|
Spec
|
|
33
|
-
} from "./chunk-
|
|
34
|
-
import "./chunk-
|
|
33
|
+
} from "./chunk-G5NJ7CYI.js";
|
|
34
|
+
import "./chunk-6A3XS52F.js";
|
|
35
35
|
import {
|
|
36
36
|
CacheEntry
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-OE6VHHN4.js";
|
|
38
38
|
import "./chunk-APMYKJI2.js";
|
|
39
39
|
import {
|
|
40
40
|
assertOk
|
|
41
|
-
} from "./chunk-
|
|
42
|
-
import "./chunk-
|
|
41
|
+
} from "./chunk-UQUIO7LW.js";
|
|
42
|
+
import "./chunk-JTUZP2OD.js";
|
|
43
43
|
import "./chunk-U7TEQCBN.js";
|
|
44
|
-
import "./chunk-VFBCWAOC.js";
|
|
45
44
|
import "./chunk-XNLSTHDK.js";
|
|
45
|
+
import {
|
|
46
|
+
readStoreIndex,
|
|
47
|
+
removeStoreEntry,
|
|
48
|
+
storeEntryCopied,
|
|
49
|
+
storeEntryLinked,
|
|
50
|
+
storeEntryNames,
|
|
51
|
+
storeEntryTime,
|
|
52
|
+
verifyStoreEntry
|
|
53
|
+
} from "./chunk-QA6RE2GS.js";
|
|
46
54
|
import "./chunk-BHJT53TP.js";
|
|
47
55
|
import "./chunk-VE6CCH33.js";
|
|
56
|
+
import {
|
|
57
|
+
integrityHex
|
|
58
|
+
} from "./chunk-G5BSQ6DP.js";
|
|
48
59
|
import {
|
|
49
60
|
error
|
|
50
61
|
} from "./chunk-WZWDS3W4.js";
|
|
51
62
|
import "./chunk-PZLD7RTK.js";
|
|
52
63
|
|
|
53
64
|
// ../../src/cli-sdk/src/commands/cache.ts
|
|
65
|
+
import { readFileSync } from "node:fs";
|
|
54
66
|
import { mkdir, rm } from "node:fs/promises";
|
|
67
|
+
import { resolve } from "node:path";
|
|
55
68
|
var view;
|
|
56
69
|
var CacheView = class extends ViewClass {
|
|
57
70
|
constructor(options, conf) {
|
|
@@ -101,12 +114,27 @@ var usageDef = {
|
|
|
101
114
|
},
|
|
102
115
|
"delete-before": {
|
|
103
116
|
usage: "<date>",
|
|
104
|
-
description: `Purge all cache items from before a given date
|
|
117
|
+
description: `Purge all cache items from before a given date, and
|
|
118
|
+
global store entries written before it. Date can be
|
|
105
119
|
provided in any format that JavaScript can parse.`
|
|
106
120
|
},
|
|
107
121
|
"delete-all": {
|
|
108
122
|
usage: "",
|
|
109
123
|
description: `Delete the entire cache folder to make vlt slower.`
|
|
124
|
+
},
|
|
125
|
+
verify: {
|
|
126
|
+
usage: ["<package-spec> [<package-spec>...]", "--all"],
|
|
127
|
+
description: `Check global store entries against their cached
|
|
128
|
+
tarballs (file list, contents, exec bits) and remove
|
|
129
|
+
any that differ or have no cached tarball, e.g. after
|
|
130
|
+
a file in \`node_modules\` was edited in place.`
|
|
131
|
+
},
|
|
132
|
+
"prune-store": {
|
|
133
|
+
usage: "",
|
|
134
|
+
description: `Remove global store entries that no \`node_modules\`
|
|
135
|
+
folder links to. Entries ever copied from (install
|
|
136
|
+
scripts, \`store-linker=copy\`, a cache on another
|
|
137
|
+
drive) stay: copies do not show use.`
|
|
110
138
|
}
|
|
111
139
|
},
|
|
112
140
|
examples: {
|
|
@@ -123,6 +151,14 @@ var usageDef = {
|
|
|
123
151
|
},
|
|
124
152
|
"vlt cache delete-before 2025-01-01": {
|
|
125
153
|
description: "Delete all entries created before Jan 1, 2025"
|
|
154
|
+
},
|
|
155
|
+
"verify --all": {
|
|
156
|
+
description: "Check every global store entry"
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
options: {
|
|
160
|
+
all: {
|
|
161
|
+
description: "With `verify`, check every global store entry."
|
|
126
162
|
}
|
|
127
163
|
}
|
|
128
164
|
};
|
|
@@ -145,6 +181,10 @@ var command = async (conf) => {
|
|
|
145
181
|
return deleteBefore(conf, args, view);
|
|
146
182
|
case "delete-all":
|
|
147
183
|
return deleteAll(conf, args, view);
|
|
184
|
+
case "verify":
|
|
185
|
+
return verify(conf, args, view);
|
|
186
|
+
case "prune-store":
|
|
187
|
+
return pruneStore(conf, args, view);
|
|
148
188
|
default: {
|
|
149
189
|
throw error("Unrecognized cache command", {
|
|
150
190
|
code: "EUSAGE",
|
|
@@ -265,12 +305,23 @@ var deleteBefore = async (conf, args, view2) => {
|
|
|
265
305
|
found: before
|
|
266
306
|
});
|
|
267
307
|
}
|
|
268
|
-
|
|
308
|
+
const map = await deleteEntries(
|
|
269
309
|
conf,
|
|
270
310
|
[],
|
|
271
311
|
(entry) => !!entry.date && entry.date < before,
|
|
272
312
|
view2
|
|
273
313
|
);
|
|
314
|
+
const { storeRoot } = conf.options;
|
|
315
|
+
let count = 0;
|
|
316
|
+
for (const hex of storeEntryNames(storeRoot)) {
|
|
317
|
+
const entry = resolve(storeRoot, hex);
|
|
318
|
+
if (storeEntryTime(entry) < before.getTime()) {
|
|
319
|
+
removeStoreEntry(entry);
|
|
320
|
+
count++;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
view2?.stdout(`Removed ${entries(count)}`);
|
|
324
|
+
return map;
|
|
274
325
|
};
|
|
275
326
|
var deleteKeys = async (conf, keys, view2) => {
|
|
276
327
|
if (!keys.length) {
|
|
@@ -283,9 +334,87 @@ var deleteKeys = async (conf, keys, view2) => {
|
|
|
283
334
|
var deleteAll = async (conf, _, view2) => {
|
|
284
335
|
const { cache } = await conf.options.packageInfo.getRegistryClient();
|
|
285
336
|
await rm(cache.path(), { recursive: true, force: true });
|
|
337
|
+
const rf = { recursive: true, force: true };
|
|
338
|
+
await rm(resolve(conf.options.cache, "store"), rf);
|
|
339
|
+
if (cache.store) await rm(cache.store, rf);
|
|
286
340
|
await mkdir(cache.path(), { recursive: true });
|
|
287
341
|
view2?.stdout("Deleted all cache entries.");
|
|
288
342
|
};
|
|
343
|
+
var entries = (n) => `${n} global store entr${n === 1 ? "y" : "ies"}`;
|
|
344
|
+
var entryLabel = (entry, hex) => {
|
|
345
|
+
const i = readStoreIndex(entry);
|
|
346
|
+
return i?.name && i.version ? `${i.name}@${i.version}` : hex;
|
|
347
|
+
};
|
|
348
|
+
var verify = async (conf, specs, view2) => {
|
|
349
|
+
const all = !!conf.values.all;
|
|
350
|
+
if (!specs.length && !all) {
|
|
351
|
+
throw error("Must provide specs to verify, or --all", {
|
|
352
|
+
code: "EUSAGE"
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
const { packageInfo, storeRoot } = conf.options;
|
|
356
|
+
const cachePath = (await packageInfo.getRegistryClient()).cache.path();
|
|
357
|
+
const present = new Set(storeEntryNames(storeRoot));
|
|
358
|
+
const checks = [];
|
|
359
|
+
const missing = [];
|
|
360
|
+
if (all) {
|
|
361
|
+
for (const hex of present) checks.push([hex, hex]);
|
|
362
|
+
} else {
|
|
363
|
+
for (const spec of specs) {
|
|
364
|
+
const { integrity } = await packageInfo.resolve(
|
|
365
|
+
Spec.parseArgs(spec, conf.options)
|
|
366
|
+
);
|
|
367
|
+
const hex = integrityHex(integrity);
|
|
368
|
+
if (hex && present.has(hex)) checks.push([spec, hex]);
|
|
369
|
+
else {
|
|
370
|
+
missing.push(spec);
|
|
371
|
+
view2?.stdout("Not in the global store:", spec);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
const removed = {};
|
|
376
|
+
for (const [key, hex] of checks) {
|
|
377
|
+
const entry = resolve(storeRoot, hex);
|
|
378
|
+
let tarball;
|
|
379
|
+
try {
|
|
380
|
+
tarball = CacheEntry.decode(
|
|
381
|
+
readFileSync(resolve(cachePath, hex))
|
|
382
|
+
).buffer();
|
|
383
|
+
} catch {
|
|
384
|
+
}
|
|
385
|
+
const reason = tarball ? verifyStoreEntry(entry, tarball) : "no cached tarball";
|
|
386
|
+
if (reason) {
|
|
387
|
+
const label = all ? entryLabel(entry, hex) : key;
|
|
388
|
+
removeStoreEntry(entry);
|
|
389
|
+
removed[key] = reason;
|
|
390
|
+
view2?.stdout("-", label, reason);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
const n = Object.keys(removed).length;
|
|
394
|
+
view2?.stdout(`Checked ${entries(checks.length)}, removed ${n}`);
|
|
395
|
+
return {
|
|
396
|
+
checked: checks.length,
|
|
397
|
+
removed,
|
|
398
|
+
...!all && { missing }
|
|
399
|
+
};
|
|
400
|
+
};
|
|
401
|
+
var pruneStore = async (conf, _, view2) => {
|
|
402
|
+
const { storeRoot } = conf.options;
|
|
403
|
+
const names = storeEntryNames(storeRoot);
|
|
404
|
+
const removed = {};
|
|
405
|
+
for (const hex of names) {
|
|
406
|
+
const entry = resolve(storeRoot, hex);
|
|
407
|
+
const index = readStoreIndex(entry);
|
|
408
|
+
if (storeEntryCopied(entry, index) || storeEntryLinked(entry, index)) {
|
|
409
|
+
continue;
|
|
410
|
+
}
|
|
411
|
+
removeStoreEntry(entry);
|
|
412
|
+
removed[hex] = "unused";
|
|
413
|
+
}
|
|
414
|
+
const n = Object.keys(removed).length;
|
|
415
|
+
view2?.stdout(`Removed ${n} of ${entries(names.length)}`);
|
|
416
|
+
return { checked: names.length, removed };
|
|
417
|
+
};
|
|
289
418
|
var add = async (conf, specs, view2) => {
|
|
290
419
|
if (!specs.length) {
|
|
291
420
|
throw error("Must provide specs to add to the cache", {
|