@vltpkg/cli-js 1.3.6 → 1.3.8
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-SFEGWG3Y.js → access-WLKANIOE.js} +8 -8
- package/{bugs-X2JHO4WZ.js → bugs-5Q3QSTWP.js} +17 -17
- package/{build-BK4ITRPX.js → build-XSFR63AW.js} +9 -9
- package/{cache-JRW72UJE.js → cache-UVPK5J5A.js} +13 -13
- package/chunk-3U6QWN62.js +45 -0
- package/{chunk-2XDF3JBH.js → chunk-43HNQWPQ.js} +6 -6
- package/chunk-4JAZZRKR.js +76 -0
- package/{chunk-F6ZN6TTL.js → chunk-5KOLUYXH.js} +61 -11
- package/{chunk-TY2UJ3SA.js → chunk-6BQKR2FM.js} +1 -1
- package/{chunk-PBBULTAG.js → chunk-6D54UN4T.js} +1 -1
- package/{chunk-FOSDT7YU.js → chunk-6P5CFJR7.js} +4 -4
- package/{chunk-J4NHRZX6.js → chunk-A2TSRXZD.js} +1 -1
- package/{chunk-IXAHSTBN.js → chunk-BGA3WB7H.js} +86 -10
- package/{chunk-GDYDW277.js → chunk-CB65DPZ2.js} +195 -195
- package/{chunk-VI7V6OCC.js → chunk-DL3H4EMY.js} +46 -19
- package/{chunk-O2B5SLP7.js → chunk-EL4GVZK5.js} +2 -2
- package/{chunk-HD6TAM7A.js → chunk-FIUUAQGC.js} +5 -5
- package/{chunk-64VFL4WI.js → chunk-GZ5MYMBT.js} +1 -1
- package/{chunk-X2WYIUFQ.js → chunk-H77JYU7F.js} +1 -1
- package/{chunk-BP3PQ67D.js → chunk-IBGFQR23.js} +16 -0
- package/{chunk-CRGWLUGC.js → chunk-IHXJVKAE.js} +1 -1
- package/{chunk-2XFFMF6G.js → chunk-IUL6MPP6.js} +4 -4
- package/{chunk-BCANUHR3.js → chunk-KMOOTBHM.js} +5 -1
- package/{chunk-WGSYVB4F.js → chunk-NWHKSRO3.js} +268 -21
- package/{chunk-JELA46YR.js → chunk-OAP2ROTL.js} +1 -1
- package/{chunk-AFUXQ3P4.js → chunk-OWMR2EDW.js} +1 -1
- package/{chunk-RAE3LNUK.js → chunk-PJJCFMLW.js} +3 -3
- package/chunk-QNDM4DVO.js +25 -0
- package/{chunk-XU5WNX4S.js → chunk-SE2FSMBR.js} +1 -0
- package/{chunk-JIQBZ2UT.js → chunk-SV4WK3KX.js} +2 -2
- package/{chunk-LHIDMYN2.js → chunk-TLY4VGMH.js} +1 -1
- package/{chunk-WS7BNE5S.js → chunk-WHLYMMI2.js} +3 -3
- package/{chunk-LFCZGP2L.js → chunk-WKA5UYNA.js} +3 -10
- package/{chunk-2XD7RUKI.js → chunk-XCDLOQZZ.js} +3 -3
- package/{chunk-TOKUDCSW.js → chunk-XDSZO74H.js} +6 -6
- package/{ci-6GQ3GMJK.js → ci-EDRETPUF.js} +10 -10
- package/cli-package.json +3 -1
- package/{config-6VRNS5F3.js → config-MVNXGEOQ.js} +8 -8
- package/{config-5VN6JXGK.js → config-OKBXU7TU.js} +10 -10
- package/{create-K7ROUCVJ.js → create-R7BXYJSU.js} +18 -18
- package/{deprecate-WRSZJ2WG.js → deprecate-YSUKBKQM.js} +11 -11
- package/{dist-tag-NSTCFNON.js → dist-tag-MIGYSR4F.js} +8 -8
- package/{docs-E2PATRJS.js → docs-4WVIN75H.js} +17 -17
- package/{exec-SV4RXF2E.js → exec-IXHDQLAM.js} +26 -18
- package/{exec-cache-K4LBRSRD.js → exec-cache-EA7GHIK7.js} +16 -16
- package/{exec-local-RT27P325.js → exec-local-GM4LH56M.js} +15 -15
- package/{help-XXKA42B7.js → help-TCXGBICU.js} +4 -4
- package/{init-IYCFQJPW.js → init-MWZDWQHM.js} +10 -10
- package/{install-RRCUQ34D.js → install-HPI5HU3C.js} +16 -16
- package/{list-WFYB66G7.js → list-2CX6REPJ.js} +21 -19
- package/{login-K6HTWO4J.js → login-RAY23CVG.js} +12 -12
- package/{logout-F6EI7WST.js → logout-ICB5OMGY.js} +8 -8
- package/outdated-FYHPXRMT.js +533 -0
- package/{pack-FX24JZR4.js → pack-E5MNPQXK.js} +11 -11
- package/package.json +1 -1
- package/{ping-6QRL622S.js → ping-REQ2KSAR.js} +8 -8
- package/{pkg-FPWX4VUE.js → pkg-YB4GSRII.js} +11 -11
- package/{profile-WAI5BGPU.js → profile-GKBW6GRI.js} +8 -8
- package/{publish-GI7T7TE2.js → publish-4ZQJYYLF.js} +17 -17
- package/{query-GC2DGBWT.js → query-SKXBF3MJ.js} +21 -19
- package/{registry-PY2L5ZWC.js → registry-MQJJCWJY.js} +5 -5
- package/registry-client-src-revalidate.js +58 -9
- package/{repo-CFXNFSY7.js → repo-ACPTZI2C.js} +17 -17
- package/{reporter-5QKWEQNH.js → reporter-4KK2JNGO.js} +10 -10
- package/{run-VFHTHV5N.js → run-YW3ITX2A.js} +15 -15
- package/{run-exec-OJEIP3WL.js → run-exec-7VQX3OFG.js} +15 -15
- package/security-archive-src-update-expired.js +1 -1
- package/{setup-CCM2QAVA.js → setup-PLEKCMXN.js} +15 -15
- package/{src-3MEJQYBG.js → src-GP7VLT7P.js} +2 -2
- package/{src-LLE3Q5NY.js → src-PXDFMQ6W.js} +6 -4
- package/{src-54SW7RQE.js → src-XQ7KVUVN.js} +14 -14
- package/{token-P5N54F4D.js → token-GB7RPE5J.js} +8 -8
- package/{uninstall-QJA3X4GY.js → uninstall-RLCECX37.js} +12 -12
- package/{unpublish-IAB6LNVC.js → unpublish-3ZXEAVHF.js} +8 -8
- package/{update-VZEF6QRY.js → update-VDZP6EZN.js} +25 -16
- package/{version-A6FPEDV5.js → version-MRELJPOK.js} +10 -10
- package/{view-SA6QU2NW.js → view-LCXMTGCJ.js} +76 -52
- 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-YDNKCWU7.js → whoami-PNRDBS45.js} +8 -8
- package/chunk-MXRSLXAC.js +0 -75
|
@@ -0,0 +1,533 @@
|
|
|
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-QNDM4DVO.js";
|
|
18
|
+
import {
|
|
19
|
+
assertVltInstalled,
|
|
20
|
+
createHostContextsMap
|
|
21
|
+
} from "./chunk-WHLYMMI2.js";
|
|
22
|
+
import {
|
|
23
|
+
PackageInfoClient
|
|
24
|
+
} from "./chunk-DL3H4EMY.js";
|
|
25
|
+
import "./chunk-SRWDPPLX.js";
|
|
26
|
+
import {
|
|
27
|
+
Edge,
|
|
28
|
+
GraphModifier,
|
|
29
|
+
Query,
|
|
30
|
+
actual
|
|
31
|
+
} from "./chunk-NWHKSRO3.js";
|
|
32
|
+
import {
|
|
33
|
+
SecurityArchive
|
|
34
|
+
} from "./chunk-XCDLOQZZ.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-5KOLUYXH.js";
|
|
46
|
+
import "./chunk-APMYKJI2.js";
|
|
47
|
+
import "./chunk-6D54UN4T.js";
|
|
48
|
+
import "./chunk-6BQKR2FM.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
|
+
const edits = /* @__PURE__ */ new Set();
|
|
223
|
+
for (const { action } of result) {
|
|
224
|
+
if (!action) continue;
|
|
225
|
+
if (action.startsWith("vlt install ")) {
|
|
226
|
+
const [spec = "", ...flags] = action.slice("vlt install ".length).split(" ");
|
|
227
|
+
const key = flags.join(" ");
|
|
228
|
+
const specs = installs.get(key) ?? /* @__PURE__ */ new Set();
|
|
229
|
+
specs.add(spec);
|
|
230
|
+
installs.set(key, specs);
|
|
231
|
+
} else if (!action.startsWith("vlt ")) {
|
|
232
|
+
edits.add(
|
|
233
|
+
`${action.charAt(0).toUpperCase()}${action.slice(1)}.`
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
for (const [flags, specs] of installs) {
|
|
238
|
+
const args = [...specs, ...flags ? [flags] : []].join(" ");
|
|
239
|
+
lines.push(`Run \`vlt install ${args}\` to move to latest.`);
|
|
240
|
+
}
|
|
241
|
+
lines.push(...edits);
|
|
242
|
+
return lines;
|
|
243
|
+
};
|
|
244
|
+
var views = {
|
|
245
|
+
json: (result) => result,
|
|
246
|
+
count: (result) => result.length,
|
|
247
|
+
human: (result) => {
|
|
248
|
+
if (result.length === 0) {
|
|
249
|
+
return "All dependencies are up to date.";
|
|
250
|
+
}
|
|
251
|
+
const columns = [
|
|
252
|
+
{ title: "Package", cells: result.map((e) => e.name) },
|
|
253
|
+
{
|
|
254
|
+
title: "Current",
|
|
255
|
+
cells: result.map((e) => missingVersion(e.current))
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
title: "Wanted",
|
|
259
|
+
cells: result.map((e) => missingVersion(e.wanted))
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
title: "Latest",
|
|
263
|
+
cells: result.map((e) => missingVersion(e.latest))
|
|
264
|
+
},
|
|
265
|
+
{ title: "Type", cells: result.map((e) => e.type) }
|
|
266
|
+
];
|
|
267
|
+
if (new Set(result.map((e) => e.dependent)).size > 1) {
|
|
268
|
+
columns.push({
|
|
269
|
+
title: "Dependent",
|
|
270
|
+
cells: result.map((e) => e.dependent)
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
columns.push({ title: "Why", cells: result.map(explain) });
|
|
274
|
+
const actions = suggestActions(result);
|
|
275
|
+
return [
|
|
276
|
+
formatTable(columns),
|
|
277
|
+
...actions.length ? ["", ...actions] : []
|
|
278
|
+
].join("\n");
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
var latestVersion = (packument) => {
|
|
282
|
+
const tagged = packument["dist-tags"].latest;
|
|
283
|
+
if (tagged) return tagged;
|
|
284
|
+
const [highest] = rsort(stable(Object.keys(packument.versions)));
|
|
285
|
+
return highest;
|
|
286
|
+
};
|
|
287
|
+
var gapKind = (current, target) => {
|
|
288
|
+
const c = parse(current);
|
|
289
|
+
const t = parse(target);
|
|
290
|
+
if (!c || !t) return "patch";
|
|
291
|
+
if (t.major > c.major) return "major";
|
|
292
|
+
if (t.minor > c.minor) return "minor";
|
|
293
|
+
if (t.patch > c.patch) return "patch";
|
|
294
|
+
return "prerelease";
|
|
295
|
+
};
|
|
296
|
+
var dependentName = (node) => node.importer ? node.name : `${node.name}@${node.version}`;
|
|
297
|
+
var heldBy = (edge, latest) => {
|
|
298
|
+
const holders = [];
|
|
299
|
+
for (const other of edge.to?.edgesIn ?? []) {
|
|
300
|
+
if (other === edge || other.from.importer) continue;
|
|
301
|
+
const { range } = other.spec.final;
|
|
302
|
+
if (range && !satisfies(latest, range)) {
|
|
303
|
+
holders.push({
|
|
304
|
+
dependent: dependentName(other.from),
|
|
305
|
+
spec: other.spec.bareSpec
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
return holders;
|
|
310
|
+
};
|
|
311
|
+
var unmetRequirements = (edge, latest, nodeVersion) => {
|
|
312
|
+
const requires = {};
|
|
313
|
+
const engine = latest.engines?.node;
|
|
314
|
+
if (engine && !satisfies(nodeVersion, engine))
|
|
315
|
+
requires.node = engine;
|
|
316
|
+
const peers = {};
|
|
317
|
+
for (const [peer, range] of Object.entries(
|
|
318
|
+
latest.peerDependencies ?? {}
|
|
319
|
+
)) {
|
|
320
|
+
const installed = edge.from.edgesOut.get(peer)?.to?.version;
|
|
321
|
+
if (installed && !satisfies(installed, range)) peers[peer] = range;
|
|
322
|
+
}
|
|
323
|
+
if (Object.keys(peers).length) requires.peers = peers;
|
|
324
|
+
return requires.node || requires.peers ? requires : void 0;
|
|
325
|
+
};
|
|
326
|
+
var installSpec = (edge, range) => {
|
|
327
|
+
const { bareSpec, final } = edge.spec;
|
|
328
|
+
const prefix = bareSpec.slice(
|
|
329
|
+
0,
|
|
330
|
+
bareSpec.length - final.bareSpec.length
|
|
331
|
+
);
|
|
332
|
+
return `${edge.name}@${prefix}${range}`;
|
|
333
|
+
};
|
|
334
|
+
var saveFlags = {
|
|
335
|
+
prod: "",
|
|
336
|
+
dev: " --save-dev",
|
|
337
|
+
optional: " --save-optional",
|
|
338
|
+
peer: " --save-peer",
|
|
339
|
+
peerOptional: " --save-peer"
|
|
340
|
+
};
|
|
341
|
+
var actionFor = (edge, entry, { savePrefix }) => {
|
|
342
|
+
if (!edge.from.importer) return void 0;
|
|
343
|
+
if (!entry.current) return "vlt install";
|
|
344
|
+
const { latest } = entry;
|
|
345
|
+
const { range } = edge.spec.final;
|
|
346
|
+
if (latest && gt(latest, entry.current) && range) {
|
|
347
|
+
if (satisfies(latest, range)) return "vlt update";
|
|
348
|
+
const newRange = `${savePrefix}${latest}`;
|
|
349
|
+
if (edge.spec.type === "catalog") {
|
|
350
|
+
const catalog = edge.spec.catalog ? `"${edge.spec.catalog}" catalog` : "catalog";
|
|
351
|
+
return `set the ${catalog} entry for ${edge.name} in vlt.json to ${newRange}`;
|
|
352
|
+
}
|
|
353
|
+
const workspace = edge.from.mainImporter ? "" : ` --workspace=${edge.from.location.replace(/^\.\//, "")}`;
|
|
354
|
+
return `vlt install ${installSpec(edge, newRange)}${saveFlags[edge.type]}${workspace}`;
|
|
355
|
+
}
|
|
356
|
+
return "vlt update";
|
|
357
|
+
};
|
|
358
|
+
var buildEntry = (edge, packument, options) => {
|
|
359
|
+
const current = edge.to?.version;
|
|
360
|
+
const wanted = pickManifest(
|
|
361
|
+
packument,
|
|
362
|
+
edge.spec,
|
|
363
|
+
options.pick
|
|
364
|
+
)?.version;
|
|
365
|
+
const latest = latestVersion(packument);
|
|
366
|
+
const wantedAhead = !!wanted && (!current || gt(wanted, current));
|
|
367
|
+
const latestAhead = !!latest && (!current || gt(latest, current));
|
|
368
|
+
if (current && !wantedAhead && !latestAhead) return void 0;
|
|
369
|
+
const entry = {
|
|
370
|
+
name: edge.name,
|
|
371
|
+
spec: edge.spec.bareSpec,
|
|
372
|
+
type: edge.type,
|
|
373
|
+
current,
|
|
374
|
+
wanted,
|
|
375
|
+
latest,
|
|
376
|
+
dependent: dependentName(edge.from),
|
|
377
|
+
location: edge.from.location,
|
|
378
|
+
kind: !current ? "missing" : latestAhead ? gapKind(current, latest) : gapKind(current, String(wanted)),
|
|
379
|
+
inRange: wantedAhead
|
|
380
|
+
};
|
|
381
|
+
const deprecated = current ? packument.versions[current]?.deprecated : void 0;
|
|
382
|
+
if (deprecated) entry.deprecated = deprecated;
|
|
383
|
+
if (latestAhead) {
|
|
384
|
+
const holders = heldBy(edge, latest);
|
|
385
|
+
if (holders.length) entry.heldBy = holders;
|
|
386
|
+
const manifest = packument.versions[latest];
|
|
387
|
+
const requires = manifest && unmetRequirements(edge, manifest, options.nodeVersion);
|
|
388
|
+
if (requires) entry.requires = requires;
|
|
389
|
+
}
|
|
390
|
+
const action = actionFor(edge, entry, options);
|
|
391
|
+
if (action) entry.action = action;
|
|
392
|
+
return entry;
|
|
393
|
+
};
|
|
394
|
+
var selectImporters = (conf, graph) => {
|
|
395
|
+
const { monorepo } = conf.options;
|
|
396
|
+
const selected = "workspace" in conf.values || "workspace-group" in conf.values;
|
|
397
|
+
if (monorepo && selected) {
|
|
398
|
+
const importers = [];
|
|
399
|
+
for (const workspace of monorepo.filter(conf.values)) {
|
|
400
|
+
const node = graph.nodes.get(workspace.id);
|
|
401
|
+
if (node) importers.push(node);
|
|
402
|
+
}
|
|
403
|
+
return importers;
|
|
404
|
+
}
|
|
405
|
+
return [...graph.importers];
|
|
406
|
+
};
|
|
407
|
+
var selectEdges = async (conf, graph, archive) => {
|
|
408
|
+
const target = conf.get("target");
|
|
409
|
+
if (!target) {
|
|
410
|
+
return selectImporters(conf, graph).flatMap((importer) => [
|
|
411
|
+
...importer.edgesOut.values()
|
|
412
|
+
]);
|
|
413
|
+
}
|
|
414
|
+
const query = new Query({
|
|
415
|
+
nodes: new Set(graph.nodes.values()),
|
|
416
|
+
edges: graph.edges,
|
|
417
|
+
importers: graph.importers,
|
|
418
|
+
securityArchive: archive,
|
|
419
|
+
hostContexts: await createHostContextsMap(conf),
|
|
420
|
+
getAuthHeader: createGetAuthHeader(conf)
|
|
421
|
+
});
|
|
422
|
+
const { edges } = await query.search(target, {
|
|
423
|
+
signal: new AbortController().signal
|
|
424
|
+
});
|
|
425
|
+
return edges.filter((edge) => edge instanceof Edge);
|
|
426
|
+
};
|
|
427
|
+
var startArchive = async (nodes) => {
|
|
428
|
+
try {
|
|
429
|
+
return await SecurityArchive.start({ nodes });
|
|
430
|
+
} catch {
|
|
431
|
+
return void 0;
|
|
432
|
+
}
|
|
433
|
+
};
|
|
434
|
+
var securityOf = (archive, id) => {
|
|
435
|
+
const report = archive.get(id);
|
|
436
|
+
if (!report) return void 0;
|
|
437
|
+
return {
|
|
438
|
+
score: Math.round(report.score.overall * 100),
|
|
439
|
+
alerts: report.alerts
|
|
440
|
+
};
|
|
441
|
+
};
|
|
442
|
+
var command = async (conf) => {
|
|
443
|
+
const { projectRoot, packageJson, monorepo } = conf.options;
|
|
444
|
+
assertVltInstalled(projectRoot, "outdated");
|
|
445
|
+
const mainManifest = packageJson.read(projectRoot);
|
|
446
|
+
const graph = actual.load({
|
|
447
|
+
...conf.options,
|
|
448
|
+
mainManifest,
|
|
449
|
+
modifiers: GraphModifier.maybeLoad(conf.options),
|
|
450
|
+
monorepo,
|
|
451
|
+
loadManifests: true
|
|
452
|
+
});
|
|
453
|
+
let archive = conf.get("target") ? await startArchive([...graph.nodes.values()]) : void 0;
|
|
454
|
+
const names = new Set(conf.positionals);
|
|
455
|
+
const edges = (await selectEdges(conf, graph, archive)).filter(
|
|
456
|
+
(edge) => (names.size === 0 || names.has(edge.name)) && edge.spec.final.type === "registry"
|
|
457
|
+
);
|
|
458
|
+
const pic = new PackageInfoClient(conf.options);
|
|
459
|
+
const packuments = /* @__PURE__ */ new Map();
|
|
460
|
+
const fetchPackument = (edge) => {
|
|
461
|
+
const { registry, name } = edge.spec.final;
|
|
462
|
+
const key = `${String(registry)}:${name}`;
|
|
463
|
+
let p = packuments.get(key);
|
|
464
|
+
if (!p) {
|
|
465
|
+
p = pic.packument(edge.spec);
|
|
466
|
+
packuments.set(key, p);
|
|
467
|
+
}
|
|
468
|
+
return p;
|
|
469
|
+
};
|
|
470
|
+
const options = {
|
|
471
|
+
nodeVersion: conf.options["node-version"],
|
|
472
|
+
savePrefix: conf.options["save-exact"] ? "" : conf.options["save-prefix"],
|
|
473
|
+
pick: conf.options
|
|
474
|
+
};
|
|
475
|
+
const found = [];
|
|
476
|
+
for (const edge of edges) {
|
|
477
|
+
const entry = buildEntry(
|
|
478
|
+
edge,
|
|
479
|
+
await fetchPackument(edge),
|
|
480
|
+
options
|
|
481
|
+
);
|
|
482
|
+
if (entry) found.push({ edge, entry });
|
|
483
|
+
}
|
|
484
|
+
const stub = (edge, version) => createStubNode(
|
|
485
|
+
edge.spec,
|
|
486
|
+
edge.spec.final.name,
|
|
487
|
+
version,
|
|
488
|
+
conf.options
|
|
489
|
+
);
|
|
490
|
+
const securityNodes = /* @__PURE__ */ new Map();
|
|
491
|
+
const candidates = [];
|
|
492
|
+
for (const { edge, entry } of found) {
|
|
493
|
+
const ids = {};
|
|
494
|
+
if (edge.to) {
|
|
495
|
+
ids.current = edge.to.id;
|
|
496
|
+
securityNodes.set(edge.to.id, edge.to);
|
|
497
|
+
}
|
|
498
|
+
for (const which of ["wanted", "latest"]) {
|
|
499
|
+
const version = entry[which];
|
|
500
|
+
if (!version) continue;
|
|
501
|
+
const node = stub(edge, version);
|
|
502
|
+
ids[which] = node.id;
|
|
503
|
+
securityNodes.set(node.id, node);
|
|
504
|
+
}
|
|
505
|
+
candidates.push({ entry, ids });
|
|
506
|
+
}
|
|
507
|
+
const nodes = [...securityNodes.values()];
|
|
508
|
+
if (archive) {
|
|
509
|
+
await archive.refresh({ nodes }).catch(() => {
|
|
510
|
+
archive = void 0;
|
|
511
|
+
});
|
|
512
|
+
} else if (nodes.length) {
|
|
513
|
+
archive = await startArchive(nodes);
|
|
514
|
+
}
|
|
515
|
+
if (archive) {
|
|
516
|
+
for (const { entry, ids } of candidates) {
|
|
517
|
+
const security = {};
|
|
518
|
+
for (const which of ["current", "wanted", "latest"]) {
|
|
519
|
+
const id = ids[which];
|
|
520
|
+
const report = id && securityOf(archive, id);
|
|
521
|
+
if (report) security[which] = report;
|
|
522
|
+
}
|
|
523
|
+
if (Object.keys(security).length) entry.security = security;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
return found.map(({ entry }) => entry);
|
|
527
|
+
};
|
|
528
|
+
export {
|
|
529
|
+
command,
|
|
530
|
+
needsRegistry,
|
|
531
|
+
usage,
|
|
532
|
+
views
|
|
533
|
+
};
|
|
@@ -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-
|
|
14
|
+
} from "./chunk-EL4GVZK5.js";
|
|
15
15
|
import {
|
|
16
16
|
createHostContextsMap
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-WHLYMMI2.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-
|
|
27
|
-
import "./chunk-
|
|
26
|
+
} from "./chunk-NWHKSRO3.js";
|
|
27
|
+
import "./chunk-XCDLOQZZ.js";
|
|
28
28
|
import {
|
|
29
29
|
commandUsage
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-TLY4VGMH.js";
|
|
31
31
|
import {
|
|
32
32
|
minimatch
|
|
33
|
-
} from "./chunk-
|
|
34
|
-
import "./chunk-
|
|
35
|
-
import "./chunk-
|
|
36
|
-
import "./chunk-
|
|
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-
|
|
38
|
+
import "./chunk-6BQKR2FM.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-
|
|
43
|
+
import "./chunk-IBGFQR23.js";
|
|
44
44
|
import {
|
|
45
45
|
error
|
|
46
46
|
} from "./chunk-WZWDS3W4.js";
|
package/package.json
CHANGED
|
@@ -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-
|
|
14
|
+
} from "./chunk-A2TSRXZD.js";
|
|
15
15
|
import {
|
|
16
16
|
commandUsage
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
17
|
+
} from "./chunk-TLY4VGMH.js";
|
|
18
|
+
import "./chunk-GZ5MYMBT.js";
|
|
19
|
+
import "./chunk-SE2FSMBR.js";
|
|
20
20
|
import {
|
|
21
21
|
RegistryClient
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-5KOLUYXH.js";
|
|
23
23
|
import "./chunk-APMYKJI2.js";
|
|
24
|
-
import "./chunk-
|
|
25
|
-
import "./chunk-
|
|
24
|
+
import "./chunk-6D54UN4T.js";
|
|
25
|
+
import "./chunk-6BQKR2FM.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-
|
|
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-
|
|
14
|
+
} from "./chunk-PJJCFMLW.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-
|
|
22
|
+
} from "./chunk-WHLYMMI2.js";
|
|
23
23
|
import {
|
|
24
24
|
GraphModifier,
|
|
25
25
|
Query,
|
|
26
26
|
VIRTUAL_ROOT_ID,
|
|
27
27
|
actual,
|
|
28
28
|
init
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-NWHKSRO3.js";
|
|
30
30
|
import {
|
|
31
31
|
SecurityArchive
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-XCDLOQZZ.js";
|
|
33
33
|
import {
|
|
34
34
|
commandUsage
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-TLY4VGMH.js";
|
|
36
36
|
import {
|
|
37
37
|
minimatch
|
|
38
|
-
} from "./chunk-
|
|
39
|
-
import "./chunk-
|
|
40
|
-
import "./chunk-
|
|
41
|
-
import "./chunk-
|
|
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-
|
|
43
|
+
import "./chunk-6BQKR2FM.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-
|
|
48
|
+
import "./chunk-IBGFQR23.js";
|
|
49
49
|
import {
|
|
50
50
|
error
|
|
51
51
|
} from "./chunk-WZWDS3W4.js";
|