@vltpkg/cli-js 1.3.5 → 1.3.7

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.
Files changed (84) hide show
  1. package/{access-X2ZZH2BV.js → access-4W6PMOGC.js} +8 -8
  2. package/{bugs-SF56YATZ.js → bugs-FJHQFPZF.js} +17 -17
  3. package/{build-RRJ645SV.js → build-SPWU3NOH.js} +9 -9
  4. package/{cache-NETXHYQU.js → cache-SBNEPOMQ.js} +13 -13
  5. package/{chunk-QJHTK7ML.js → chunk-2M2O6A4R.js} +4 -4
  6. package/{chunk-7DHDJ5XY.js → chunk-3D3IB4YN.js} +7 -7
  7. package/chunk-3U6QWN62.js +45 -0
  8. package/{chunk-LHB4CVEH.js → chunk-5ZCDGBVU.js} +11 -1
  9. package/{chunk-PBBULTAG.js → chunk-6D54UN4T.js} +1 -1
  10. package/{chunk-ZZFFMXI2.js → chunk-7BHHCB5C.js} +13 -7
  11. package/{chunk-J4NHRZX6.js → chunk-A2TSRXZD.js} +1 -1
  12. package/chunk-A6FAI65V.js +76 -0
  13. package/{chunk-INEKXXUQ.js → chunk-CB65DPZ2.js} +211 -200
  14. package/{chunk-OFHNSAQ5.js → chunk-EL4GVZK5.js} +2 -2
  15. package/chunk-F5D3DVC5.js +21 -0
  16. package/{chunk-B2CTWVQM.js → chunk-FKZ5I53D.js} +3 -3
  17. package/{chunk-64VFL4WI.js → chunk-GZ5MYMBT.js} +1 -1
  18. package/{chunk-X2WYIUFQ.js → chunk-H77JYU7F.js} +1 -1
  19. package/{chunk-I2DZC2J3.js → chunk-I7SCSGUO.js} +5 -5
  20. package/{chunk-BP3PQ67D.js → chunk-IBGFQR23.js} +16 -0
  21. package/{chunk-CRGWLUGC.js → chunk-IHXJVKAE.js} +1 -1
  22. package/{chunk-BCANUHR3.js → chunk-KMOOTBHM.js} +5 -1
  23. package/{chunk-EGWLQVDZ.js → chunk-KOFQTETH.js} +3 -10
  24. package/{chunk-35OBZITS.js → chunk-L3K2ZAOO.js} +6 -6
  25. package/{chunk-AFUXQ3P4.js → chunk-OWMR2EDW.js} +1 -1
  26. package/{chunk-XUGOPOLF.js → chunk-OWUICQFY.js} +3 -3
  27. package/{chunk-2B5STVCP.js → chunk-QVPNKMUU.js} +3 -3
  28. package/{chunk-PBHCZOUY.js → chunk-QYS5MGGM.js} +5 -5
  29. package/{chunk-XU5WNX4S.js → chunk-SE2FSMBR.js} +1 -0
  30. package/{chunk-75F2WCA5.js → chunk-SPWJ3X5Y.js} +4 -4
  31. package/{chunk-JIQBZ2UT.js → chunk-SV4WK3KX.js} +2 -2
  32. package/{chunk-LHIDMYN2.js → chunk-TLY4VGMH.js} +1 -1
  33. package/{chunk-ADDCQBGR.js → chunk-VBDNOU76.js} +1 -1
  34. package/{chunk-GO5X2SSV.js → chunk-W2ZO5RZL.js} +3 -3
  35. package/{chunk-TOKUDCSW.js → chunk-XDSZO74H.js} +6 -6
  36. package/{ci-YX56QIMV.js → ci-76TAJGF5.js} +10 -10
  37. package/cli-package.json +3 -1
  38. package/{config-HO7N7FPS.js → config-3UQXAYAA.js} +8 -8
  39. package/{config-SHRCBOCI.js → config-AFIHF54I.js} +10 -10
  40. package/{create-LO6BUYPU.js → create-5ADQTH6K.js} +18 -18
  41. package/{deprecate-CUMWWMAF.js → deprecate-RTQVLJDZ.js} +11 -11
  42. package/{dist-tag-DJJDBPTJ.js → dist-tag-V4DRDHWA.js} +8 -8
  43. package/{docs-KDCDJRO5.js → docs-RRULRTKQ.js} +17 -17
  44. package/{exec-KF4ANRPM.js → exec-NXQUCX3I.js} +18 -18
  45. package/{exec-cache-GBLLYU5O.js → exec-cache-KVZJHFZD.js} +16 -16
  46. package/{exec-local-VCP4KR6K.js → exec-local-53B5IRKG.js} +15 -15
  47. package/{help-MV53HEUI.js → help-EN4XUTMS.js} +4 -4
  48. package/{init-N3BM2FKC.js → init-4L6CQMIL.js} +10 -10
  49. package/{install-DDYIRJWL.js → install-MHWLYW3X.js} +16 -16
  50. package/{list-VTCG6GBS.js → list-XZRF7TBW.js} +21 -19
  51. package/{login-MCX6LCP5.js → login-6GRRY4H7.js} +12 -12
  52. package/{logout-FPNGIQDZ.js → logout-KI2AOYRT.js} +8 -8
  53. package/outdated-TWUPFRCD.js +531 -0
  54. package/{pack-KCVLNNVZ.js → pack-2ZQLDYFD.js} +11 -11
  55. package/package.json +1 -1
  56. package/{ping-MXTB7GFE.js → ping-ZOTGLOKY.js} +8 -8
  57. package/{pkg-QDEHGO34.js → pkg-HRNOTFXB.js} +11 -11
  58. package/{profile-GQUM6NRG.js → profile-5V3FFDMG.js} +8 -8
  59. package/{publish-UEL4KXDZ.js → publish-7ZXEMWTW.js} +17 -17
  60. package/{query-MJTEJIZW.js → query-62UDNMGR.js} +21 -19
  61. package/{registry-PY2L5ZWC.js → registry-MQJJCWJY.js} +5 -5
  62. package/registry-client-src-revalidate.js +1 -1
  63. package/{repo-XDMXV744.js → repo-HDUGP5PH.js} +17 -17
  64. package/{reporter-K3D4AJBF.js → reporter-TGBPLNR5.js} +10 -10
  65. package/{run-MKEP7YKW.js → run-6NRDZD4T.js} +15 -15
  66. package/{run-exec-Q7JNLVVV.js → run-exec-I4IIXTLW.js} +15 -15
  67. package/security-archive-src-update-expired.js +1 -1
  68. package/{setup-DYQY6DIX.js → setup-UVXEFUUJ.js} +15 -15
  69. package/{src-ODLA6WPY.js → src-6CJEMSVB.js} +4 -4
  70. package/{src-3MEJQYBG.js → src-GP7VLT7P.js} +2 -2
  71. package/{src-BZJHOEYT.js → src-QEJ6WZQ7.js} +14 -14
  72. package/{token-RUBMQURU.js → token-WTN27E7A.js} +8 -8
  73. package/{uninstall-3NJXWOKS.js → uninstall-ZJOKXIVQ.js} +12 -12
  74. package/{unpublish-3ETADFWK.js → unpublish-LMUGR7GI.js} +8 -8
  75. package/{update-L6ETRX6Q.js → update-WVWMRUYY.js} +15 -15
  76. package/{version-RHWAFXPK.js → version-OJTRHNKV.js} +10 -10
  77. package/{view-ABHAULFH.js → view-6Q5B7ZYN.js} +14 -38
  78. package/vlr.js +2 -2
  79. package/vlrx.js +2 -2
  80. package/vlt.js +2 -2
  81. package/vlx.js +2 -2
  82. package/vlxl.js +2 -2
  83. package/{whoami-YDR7Q4VT.js → whoami-SPF34TV6.js} +8 -8
  84. package/chunk-EWZQGHYC.js +0 -75
@@ -0,0 +1,531 @@
1
+ var global = globalThis;
2
+ import {Buffer} from "node:buffer";
3
+ import {setTimeout as _vlt_setTimeout,clearTimeout as _vlt_clearTimeout,setImmediate as _vlt_setImmediate,clearImmediate as _vlt_clearImmediate,setInterval as _vlt_setInterval,clearInterval as _vlt_clearInterval} from "node:timers";
4
+ globalThis.setTimeout = _vlt_setTimeout;
5
+ globalThis.clearTimeout = _vlt_clearTimeout;
6
+ globalThis.setImmediate = _vlt_setImmediate;
7
+ globalThis.clearImmediate = _vlt_clearImmediate;
8
+ globalThis.setInterval = _vlt_setInterval;
9
+ globalThis.clearInterval = _vlt_clearInterval;
10
+ import {createRequire as _vlt_createRequire} from "node:module";
11
+ var require = _vlt_createRequire(import.meta.filename);
12
+ import {
13
+ createStubNode
14
+ } from "./chunk-3U6QWN62.js";
15
+ import {
16
+ createGetAuthHeader
17
+ } from "./chunk-F5D3DVC5.js";
18
+ import {
19
+ assertVltInstalled,
20
+ createHostContextsMap
21
+ } from "./chunk-FKZ5I53D.js";
22
+ import {
23
+ PackageInfoClient
24
+ } from "./chunk-3D3IB4YN.js";
25
+ import "./chunk-SRWDPPLX.js";
26
+ import {
27
+ Edge,
28
+ GraphModifier,
29
+ Query,
30
+ actual
31
+ } from "./chunk-7BHHCB5C.js";
32
+ import {
33
+ SecurityArchive
34
+ } from "./chunk-OWUICQFY.js";
35
+ import {
36
+ commandUsage
37
+ } from "./chunk-TLY4VGMH.js";
38
+ import {
39
+ pickManifest
40
+ } from "./chunk-CB65DPZ2.js";
41
+ import "./chunk-SV4WK3KX.js";
42
+ import "./chunk-GZ5MYMBT.js";
43
+ import "./chunk-SE2FSMBR.js";
44
+ import "./chunk-HTOTG4TS.js";
45
+ import "./chunk-QVPNKMUU.js";
46
+ import "./chunk-APMYKJI2.js";
47
+ import "./chunk-6D54UN4T.js";
48
+ import "./chunk-VBDNOU76.js";
49
+ import "./chunk-U7TEQCBN.js";
50
+ import "./chunk-XNLSTHDK.js";
51
+ import "./chunk-PDWPFR5T.js";
52
+ import "./chunk-Y5PA7DVK.js";
53
+ import {
54
+ gt,
55
+ parse,
56
+ rsort,
57
+ satisfies,
58
+ stable
59
+ } from "./chunk-IBGFQR23.js";
60
+ import "./chunk-WZWDS3W4.js";
61
+ import "./chunk-PZLD7RTK.js";
62
+
63
+ // ../../src/cli-sdk/src/commands/outdated.ts
64
+ var needsRegistry = true;
65
+ var usage = () => commandUsage({
66
+ command: "outdated",
67
+ usage: [
68
+ "",
69
+ "[package-names...]",
70
+ "[--target=<query>] [--workspace=<path>]",
71
+ "[--view=human | json | count]"
72
+ ],
73
+ description: `List dependencies that have newer versions available, and
74
+ what is keeping them from being upgraded.
75
+
76
+ For every registry dependency, compare the installed version
77
+ against the highest version that satisfies the declared range
78
+ (wanted) and against the registry's \`latest\` dist-tag (latest).
79
+ Only dependencies that are missing or behind on either count are
80
+ reported.
81
+
82
+ Each report goes beyond the version numbers:
83
+
84
+ - the size of the jump (major, minor, patch)
85
+ - whether the installed version is deprecated
86
+ - security scores and alerts for the installed, wanted and latest
87
+ versions, so an upgrade that fixes a vulnerability or one that
88
+ introduces a flagged version stands out
89
+ - other dependents whose ranges hold the package back
90
+ - engine and peer dependency requirements of the latest version
91
+ that this project does not meet
92
+ - the command that performs the upgrade
93
+
94
+ By default the direct dependencies of the project root and its
95
+ workspaces are checked; --workspace and --workspace-group narrow
96
+ that to the given workspaces. The --target option accepts a DSS
97
+ query selector instead, which can reach any dependency in the
98
+ graph. Package names given as positional arguments filter either
99
+ selection.
100
+
101
+ The installed versions come from the graph built by
102
+ \`vlt install\`, so the project must be installed by vlt first.
103
+ Dependencies that do not resolve against a registry (git, file,
104
+ remote tarball or workspace specs) are not checked. Catalog specs
105
+ are checked against the range the catalog resolves them to.`,
106
+ examples: {
107
+ "": {
108
+ description: "Report outdated direct dependencies of the project and all its workspaces"
109
+ },
110
+ "react react-dom": {
111
+ description: `Only check the dependencies named 'react' and 'react-dom'`
112
+ },
113
+ "--workspace=packages/app": {
114
+ description: "Only check the dependencies of a single workspace"
115
+ },
116
+ '--target="*"': {
117
+ description: "Check every dependency in the graph, transitive ones included"
118
+ },
119
+ '--target=":root > *:dev"': {
120
+ description: "Only check the dev dependencies of the project root"
121
+ },
122
+ '--target="*:vuln"': {
123
+ description: "Only check dependencies with known vulnerabilities"
124
+ },
125
+ "--view=json": {
126
+ description: "Print the report as JSON"
127
+ }
128
+ },
129
+ options: {
130
+ target: {
131
+ value: "<query>",
132
+ description: "DSS query selector choosing the dependencies to check, in place of the direct dependencies of the selected importers."
133
+ },
134
+ workspace: {
135
+ value: "<path>",
136
+ description: "Limit the report to the dependencies of the given workspace(s)."
137
+ },
138
+ "workspace-group": {
139
+ value: "<name>",
140
+ description: "Limit the report to the dependencies of the workspaces in the given group(s)."
141
+ },
142
+ view: {
143
+ value: "[human | json | count]",
144
+ description: "Output format. Defaults to human-readable or json if no tty. Count outputs the number of outdated dependencies."
145
+ }
146
+ }
147
+ });
148
+ var plural = (n, word) => `${n} ${word}${n === 1 ? "" : "s"}`;
149
+ var missingVersion = (version) => version ?? "missing";
150
+ var formatTable = (columns) => {
151
+ const lines = [];
152
+ for (const { title, cells } of columns) {
153
+ const width = Math.max(title.length, ...cells.map((c) => c.length));
154
+ const column = [title, ...cells].map((cell) => cell.padEnd(width));
155
+ column.forEach((cell, i) => {
156
+ const line = lines[i];
157
+ lines[i] = line === void 0 ? cell : `${line} ${cell}`;
158
+ });
159
+ }
160
+ return lines.map((line) => line.trimEnd()).join("\n");
161
+ };
162
+ var alertsNotIn = (alerts, other) => alerts.filter((a) => !other.some((o) => o.key === a.key));
163
+ var serious = (alerts) => alerts.filter(
164
+ (a) => a.severity === "high" || a.severity === "critical"
165
+ );
166
+ var explain = (entry) => {
167
+ const parts = [];
168
+ if (entry.kind !== "missing") parts.push(entry.kind);
169
+ if (entry.deprecated !== void 0) parts.push("deprecated");
170
+ const { current } = entry.security ?? {};
171
+ if (current) {
172
+ const targets = [
173
+ ["wanted", entry.inRange ? entry.security?.wanted : void 0],
174
+ ["latest", entry.security?.latest]
175
+ ];
176
+ for (const [label, target] of targets) {
177
+ if (!target) continue;
178
+ const fixed = alertsNotIn(
179
+ serious(current.alerts),
180
+ target.alerts
181
+ ).length;
182
+ const added = alertsNotIn(
183
+ serious(target.alerts),
184
+ current.alerts
185
+ ).length;
186
+ if (fixed) {
187
+ parts.push(`${label} fixes ${plural(fixed, "serious alert")}`);
188
+ }
189
+ if (added) {
190
+ parts.push(`${label} adds ${plural(added, "serious alert")}`);
191
+ }
192
+ if (current.score - target.score >= 10) {
193
+ parts.push(
194
+ `${label} score ${target.score} (from ${current.score})`
195
+ );
196
+ }
197
+ }
198
+ }
199
+ if (entry.heldBy?.length) {
200
+ parts.push(
201
+ `held by ${entry.heldBy.map((h) => h.dependent).join(", ")}`
202
+ );
203
+ }
204
+ if (entry.requires?.node) {
205
+ parts.push(`latest needs node ${entry.requires.node}`);
206
+ }
207
+ if (entry.requires?.peers) {
208
+ const peers = Object.entries(entry.requires.peers).map(([name, range]) => `${name}@${range}`).join(", ");
209
+ parts.push(`latest needs ${peers}`);
210
+ }
211
+ return parts.join(", ");
212
+ };
213
+ var suggestActions = (result) => {
214
+ const lines = [];
215
+ const updates = result.filter((e) => e.inRange).length;
216
+ if (updates) {
217
+ lines.push(
218
+ `Run \`vlt update\` to pick up ${plural(updates, "in-range update")}.`
219
+ );
220
+ }
221
+ const installs = /* @__PURE__ */ new Map();
222
+ for (const { action } of result) {
223
+ if (!action?.startsWith("vlt install ")) continue;
224
+ const [spec = "", ...flags] = action.slice("vlt install ".length).split(" ");
225
+ const key = flags.join(" ");
226
+ const specs = installs.get(key) ?? [];
227
+ specs.push(spec);
228
+ installs.set(key, specs);
229
+ }
230
+ for (const [flags, specs] of installs) {
231
+ const args = [...specs, ...flags ? [flags] : []].join(" ");
232
+ lines.push(`Run \`vlt install ${args}\` to move to latest.`);
233
+ }
234
+ for (const { action } of result) {
235
+ if (action && !action.startsWith("vlt ")) {
236
+ lines.push(
237
+ `${action.charAt(0).toUpperCase()}${action.slice(1)}.`
238
+ );
239
+ }
240
+ }
241
+ return lines;
242
+ };
243
+ var views = {
244
+ json: (result) => result,
245
+ count: (result) => result.length,
246
+ human: (result) => {
247
+ if (result.length === 0) {
248
+ return "All dependencies are up to date.";
249
+ }
250
+ const columns = [
251
+ { title: "Package", cells: result.map((e) => e.name) },
252
+ {
253
+ title: "Current",
254
+ cells: result.map((e) => missingVersion(e.current))
255
+ },
256
+ {
257
+ title: "Wanted",
258
+ cells: result.map((e) => missingVersion(e.wanted))
259
+ },
260
+ {
261
+ title: "Latest",
262
+ cells: result.map((e) => missingVersion(e.latest))
263
+ },
264
+ { title: "Type", cells: result.map((e) => e.type) }
265
+ ];
266
+ if (new Set(result.map((e) => e.dependent)).size > 1) {
267
+ columns.push({
268
+ title: "Dependent",
269
+ cells: result.map((e) => e.dependent)
270
+ });
271
+ }
272
+ columns.push({ title: "Why", cells: result.map(explain) });
273
+ const actions = suggestActions(result);
274
+ return [
275
+ formatTable(columns),
276
+ ...actions.length ? ["", ...actions] : []
277
+ ].join("\n");
278
+ }
279
+ };
280
+ var latestVersion = (packument) => {
281
+ const tagged = packument["dist-tags"].latest;
282
+ if (tagged) return tagged;
283
+ const [highest] = rsort(stable(Object.keys(packument.versions)));
284
+ return highest;
285
+ };
286
+ var gapKind = (current, target) => {
287
+ const c = parse(current);
288
+ const t = parse(target);
289
+ if (!c || !t) return "patch";
290
+ if (t.major > c.major) return "major";
291
+ if (t.minor > c.minor) return "minor";
292
+ if (t.patch > c.patch) return "patch";
293
+ return "prerelease";
294
+ };
295
+ var dependentName = (node) => node.importer ? node.name : `${node.name}@${node.version}`;
296
+ var heldBy = (edge, latest) => {
297
+ const holders = [];
298
+ for (const other of edge.to?.edgesIn ?? []) {
299
+ if (other === edge || other.from.importer) continue;
300
+ const { range } = other.spec.final;
301
+ if (range && !satisfies(latest, range)) {
302
+ holders.push({
303
+ dependent: dependentName(other.from),
304
+ spec: other.spec.bareSpec
305
+ });
306
+ }
307
+ }
308
+ return holders;
309
+ };
310
+ var unmetRequirements = (edge, latest, nodeVersion) => {
311
+ const requires = {};
312
+ const engine = latest.engines?.node;
313
+ if (engine && !satisfies(nodeVersion, engine))
314
+ requires.node = engine;
315
+ const peers = {};
316
+ for (const [peer, range] of Object.entries(
317
+ latest.peerDependencies ?? {}
318
+ )) {
319
+ const installed = edge.from.edgesOut.get(peer)?.to?.version;
320
+ if (installed && !satisfies(installed, range)) peers[peer] = range;
321
+ }
322
+ if (Object.keys(peers).length) requires.peers = peers;
323
+ return requires.node || requires.peers ? requires : void 0;
324
+ };
325
+ var installSpec = (edge, range) => {
326
+ const { bareSpec, final } = edge.spec;
327
+ const prefix = bareSpec.slice(
328
+ 0,
329
+ bareSpec.length - final.bareSpec.length
330
+ );
331
+ return `${edge.name}@${prefix}${range}`;
332
+ };
333
+ var saveFlags = {
334
+ prod: "",
335
+ dev: " --save-dev",
336
+ optional: " --save-optional",
337
+ peer: " --save-peer",
338
+ peerOptional: " --save-peer"
339
+ };
340
+ var actionFor = (edge, entry, { savePrefix }) => {
341
+ if (!edge.from.importer) return void 0;
342
+ if (!entry.current) return "vlt install";
343
+ const { latest } = entry;
344
+ const { range } = edge.spec.final;
345
+ if (latest && gt(latest, entry.current) && range) {
346
+ if (satisfies(latest, range)) return "vlt update";
347
+ const newRange = `${savePrefix}${latest}`;
348
+ if (edge.spec.type === "catalog") {
349
+ return `set the catalog entry for ${edge.name} in vlt.json to ${newRange}`;
350
+ }
351
+ const workspace = edge.from.mainImporter ? "" : ` --workspace=${edge.from.location.replace(/^\.\//, "")}`;
352
+ return `vlt install ${installSpec(edge, newRange)}${saveFlags[edge.type]}${workspace}`;
353
+ }
354
+ return "vlt update";
355
+ };
356
+ var buildEntry = (edge, packument, options) => {
357
+ const current = edge.to?.version;
358
+ const wanted = pickManifest(
359
+ packument,
360
+ edge.spec,
361
+ options.pick
362
+ )?.version;
363
+ const latest = latestVersion(packument);
364
+ const wantedAhead = !!wanted && (!current || gt(wanted, current));
365
+ const latestAhead = !!latest && (!current || gt(latest, current));
366
+ if (current && !wantedAhead && !latestAhead) return void 0;
367
+ const entry = {
368
+ name: edge.name,
369
+ spec: edge.spec.bareSpec,
370
+ type: edge.type,
371
+ current,
372
+ wanted,
373
+ latest,
374
+ dependent: dependentName(edge.from),
375
+ location: edge.from.location,
376
+ kind: !current ? "missing" : latestAhead ? gapKind(current, latest) : gapKind(current, String(wanted)),
377
+ inRange: wantedAhead
378
+ };
379
+ const deprecated = current ? packument.versions[current]?.deprecated : void 0;
380
+ if (deprecated) entry.deprecated = deprecated;
381
+ if (latestAhead) {
382
+ const holders = heldBy(edge, latest);
383
+ if (holders.length) entry.heldBy = holders;
384
+ const manifest = packument.versions[latest];
385
+ const requires = manifest && unmetRequirements(edge, manifest, options.nodeVersion);
386
+ if (requires) entry.requires = requires;
387
+ }
388
+ const action = actionFor(edge, entry, options);
389
+ if (action) entry.action = action;
390
+ return entry;
391
+ };
392
+ var selectImporters = (conf, graph) => {
393
+ const { monorepo } = conf.options;
394
+ const selected = "workspace" in conf.values || "workspace-group" in conf.values;
395
+ if (monorepo && selected) {
396
+ const importers = [];
397
+ for (const workspace of monorepo.filter(conf.values)) {
398
+ const node = graph.nodes.get(workspace.id);
399
+ if (node) importers.push(node);
400
+ }
401
+ return importers;
402
+ }
403
+ return [...graph.importers];
404
+ };
405
+ var selectEdges = async (conf, graph, archive) => {
406
+ const target = conf.get("target");
407
+ if (!target) {
408
+ return selectImporters(conf, graph).flatMap((importer) => [
409
+ ...importer.edgesOut.values()
410
+ ]);
411
+ }
412
+ const query = new Query({
413
+ nodes: new Set(graph.nodes.values()),
414
+ edges: graph.edges,
415
+ importers: graph.importers,
416
+ securityArchive: archive,
417
+ hostContexts: await createHostContextsMap(conf),
418
+ getAuthHeader: createGetAuthHeader(conf)
419
+ });
420
+ const { edges } = await query.search(target, {
421
+ signal: new AbortController().signal
422
+ });
423
+ return edges.filter((edge) => edge instanceof Edge);
424
+ };
425
+ var startArchive = async (nodes) => {
426
+ try {
427
+ return await SecurityArchive.start({ nodes });
428
+ } catch {
429
+ return void 0;
430
+ }
431
+ };
432
+ var securityOf = (archive, id) => {
433
+ const report = archive.get(id);
434
+ if (!report) return void 0;
435
+ return {
436
+ score: Math.round(report.score.overall * 100),
437
+ alerts: report.alerts
438
+ };
439
+ };
440
+ var command = async (conf) => {
441
+ const { projectRoot, packageJson, monorepo } = conf.options;
442
+ assertVltInstalled(projectRoot, "outdated");
443
+ const mainManifest = packageJson.read(projectRoot);
444
+ const graph = actual.load({
445
+ ...conf.options,
446
+ mainManifest,
447
+ modifiers: GraphModifier.maybeLoad(conf.options),
448
+ monorepo,
449
+ loadManifests: true
450
+ });
451
+ let archive = conf.get("target") ? await startArchive([...graph.nodes.values()]) : void 0;
452
+ const names = new Set(conf.positionals);
453
+ const edges = (await selectEdges(conf, graph, archive)).filter(
454
+ (edge) => (names.size === 0 || names.has(edge.name)) && edge.spec.final.type === "registry"
455
+ );
456
+ const pic = new PackageInfoClient(conf.options);
457
+ const packuments = /* @__PURE__ */ new Map();
458
+ const fetchPackument = (edge) => {
459
+ const { registry, name } = edge.spec.final;
460
+ const key = `${String(registry)}:${name}`;
461
+ let p = packuments.get(key);
462
+ if (!p) {
463
+ p = pic.packument(edge.spec);
464
+ packuments.set(key, p);
465
+ }
466
+ return p;
467
+ };
468
+ const options = {
469
+ nodeVersion: conf.options["node-version"],
470
+ savePrefix: conf.options["save-exact"] ? "" : conf.options["save-prefix"],
471
+ pick: conf.options
472
+ };
473
+ const found = [];
474
+ for (const edge of edges) {
475
+ const entry = buildEntry(
476
+ edge,
477
+ await fetchPackument(edge),
478
+ options
479
+ );
480
+ if (entry) found.push({ edge, entry });
481
+ }
482
+ const stub = (edge, version) => createStubNode(
483
+ edge.spec,
484
+ edge.spec.final.name,
485
+ version,
486
+ conf.options
487
+ );
488
+ const securityNodes = /* @__PURE__ */ new Map();
489
+ const candidates = [];
490
+ for (const { edge, entry } of found) {
491
+ const ids = {};
492
+ if (edge.to) {
493
+ ids.current = edge.to.id;
494
+ securityNodes.set(edge.to.id, edge.to);
495
+ }
496
+ for (const which of ["wanted", "latest"]) {
497
+ const version = entry[which];
498
+ if (!version) continue;
499
+ const node = stub(edge, version);
500
+ ids[which] = node.id;
501
+ securityNodes.set(node.id, node);
502
+ }
503
+ candidates.push({ entry, ids });
504
+ }
505
+ const nodes = [...securityNodes.values()];
506
+ if (archive) {
507
+ await archive.refresh({ nodes }).catch(() => {
508
+ archive = void 0;
509
+ });
510
+ } else if (nodes.length) {
511
+ archive = await startArchive(nodes);
512
+ }
513
+ if (archive) {
514
+ for (const { entry, ids } of candidates) {
515
+ const security = {};
516
+ for (const which of ["current", "wanted", "latest"]) {
517
+ const id = ids[which];
518
+ const report = id && securityOf(archive, id);
519
+ if (report) security[which] = report;
520
+ }
521
+ if (Object.keys(security).length) entry.security = security;
522
+ }
523
+ }
524
+ return found.map(({ entry }) => entry);
525
+ };
526
+ export {
527
+ command,
528
+ needsRegistry,
529
+ usage,
530
+ views
531
+ };
@@ -11,10 +11,10 @@ import {createRequire as _vlt_createRequire} from "node:module";
11
11
  var require = _vlt_createRequire(import.meta.filename);
12
12
  import {
13
13
  packTarball
14
- } from "./chunk-OFHNSAQ5.js";
14
+ } from "./chunk-EL4GVZK5.js";
15
15
  import {
16
16
  createHostContextsMap
17
- } from "./chunk-B2CTWVQM.js";
17
+ } from "./chunk-FKZ5I53D.js";
18
18
  import {
19
19
  prettyBytes
20
20
  } from "./chunk-XA47WS4N.js";
@@ -23,24 +23,24 @@ import {
23
23
  Query,
24
24
  actual,
25
25
  run
26
- } from "./chunk-ZZFFMXI2.js";
27
- import "./chunk-XUGOPOLF.js";
26
+ } from "./chunk-7BHHCB5C.js";
27
+ import "./chunk-OWUICQFY.js";
28
28
  import {
29
29
  commandUsage
30
- } from "./chunk-LHIDMYN2.js";
30
+ } from "./chunk-TLY4VGMH.js";
31
31
  import {
32
32
  minimatch
33
- } from "./chunk-INEKXXUQ.js";
34
- import "./chunk-JIQBZ2UT.js";
35
- import "./chunk-64VFL4WI.js";
36
- import "./chunk-XU5WNX4S.js";
33
+ } from "./chunk-CB65DPZ2.js";
34
+ import "./chunk-SV4WK3KX.js";
35
+ import "./chunk-GZ5MYMBT.js";
36
+ import "./chunk-SE2FSMBR.js";
37
37
  import "./chunk-HTOTG4TS.js";
38
- import "./chunk-ADDCQBGR.js";
38
+ import "./chunk-VBDNOU76.js";
39
39
  import "./chunk-U7TEQCBN.js";
40
40
  import "./chunk-XNLSTHDK.js";
41
41
  import "./chunk-PDWPFR5T.js";
42
42
  import "./chunk-Y5PA7DVK.js";
43
- import "./chunk-BP3PQ67D.js";
43
+ import "./chunk-IBGFQR23.js";
44
44
  import {
45
45
  error
46
46
  } from "./chunk-WZWDS3W4.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vltpkg/cli-js",
3
3
  "description": "The vlt CLI",
4
- "version": "1.3.5",
4
+ "version": "1.3.7",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/vltpkg/vltpkg.git",
@@ -11,23 +11,23 @@ import {createRequire as _vlt_createRequire} from "node:module";
11
11
  var require = _vlt_createRequire(import.meta.filename);
12
12
  import {
13
13
  requireRegistry
14
- } from "./chunk-J4NHRZX6.js";
14
+ } from "./chunk-A2TSRXZD.js";
15
15
  import {
16
16
  commandUsage
17
- } from "./chunk-LHIDMYN2.js";
18
- import "./chunk-64VFL4WI.js";
19
- import "./chunk-XU5WNX4S.js";
17
+ } from "./chunk-TLY4VGMH.js";
18
+ import "./chunk-GZ5MYMBT.js";
19
+ import "./chunk-SE2FSMBR.js";
20
20
  import {
21
21
  RegistryClient
22
- } from "./chunk-2B5STVCP.js";
22
+ } from "./chunk-QVPNKMUU.js";
23
23
  import "./chunk-APMYKJI2.js";
24
- import "./chunk-PBBULTAG.js";
25
- import "./chunk-ADDCQBGR.js";
24
+ import "./chunk-6D54UN4T.js";
25
+ import "./chunk-VBDNOU76.js";
26
26
  import "./chunk-U7TEQCBN.js";
27
27
  import "./chunk-XNLSTHDK.js";
28
28
  import "./chunk-PDWPFR5T.js";
29
29
  import "./chunk-Y5PA7DVK.js";
30
- import "./chunk-BP3PQ67D.js";
30
+ import "./chunk-IBGFQR23.js";
31
31
  import {
32
32
  error
33
33
  } from "./chunk-WZWDS3W4.js";
@@ -11,7 +11,7 @@ import {createRequire as _vlt_createRequire} from "node:module";
11
11
  var require = _vlt_createRequire(import.meta.filename);
12
12
  import {
13
13
  views
14
- } from "./chunk-GO5X2SSV.js";
14
+ } from "./chunk-W2ZO5RZL.js";
15
15
  import {
16
16
  del,
17
17
  get,
@@ -19,33 +19,33 @@ import {
19
19
  } from "./chunk-DBANBIL2.js";
20
20
  import {
21
21
  createHostContextsMap
22
- } from "./chunk-B2CTWVQM.js";
22
+ } from "./chunk-FKZ5I53D.js";
23
23
  import {
24
24
  GraphModifier,
25
25
  Query,
26
26
  VIRTUAL_ROOT_ID,
27
27
  actual,
28
28
  init
29
- } from "./chunk-ZZFFMXI2.js";
29
+ } from "./chunk-7BHHCB5C.js";
30
30
  import {
31
31
  SecurityArchive
32
- } from "./chunk-XUGOPOLF.js";
32
+ } from "./chunk-OWUICQFY.js";
33
33
  import {
34
34
  commandUsage
35
- } from "./chunk-LHIDMYN2.js";
35
+ } from "./chunk-TLY4VGMH.js";
36
36
  import {
37
37
  minimatch
38
- } from "./chunk-INEKXXUQ.js";
39
- import "./chunk-JIQBZ2UT.js";
40
- import "./chunk-64VFL4WI.js";
41
- import "./chunk-XU5WNX4S.js";
38
+ } from "./chunk-CB65DPZ2.js";
39
+ import "./chunk-SV4WK3KX.js";
40
+ import "./chunk-GZ5MYMBT.js";
41
+ import "./chunk-SE2FSMBR.js";
42
42
  import "./chunk-HTOTG4TS.js";
43
- import "./chunk-ADDCQBGR.js";
43
+ import "./chunk-VBDNOU76.js";
44
44
  import "./chunk-U7TEQCBN.js";
45
45
  import "./chunk-XNLSTHDK.js";
46
46
  import "./chunk-PDWPFR5T.js";
47
47
  import "./chunk-Y5PA7DVK.js";
48
- import "./chunk-BP3PQ67D.js";
48
+ import "./chunk-IBGFQR23.js";
49
49
  import {
50
50
  error
51
51
  } from "./chunk-WZWDS3W4.js";