@vltpkg/cli-js 1.0.10 → 1.1.1
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-4RPC3X5N.js → access-YYMAAPHV.js} +42 -11
- package/{bugs-K6QLQLL4.js → bugs-RK5JBPSC.js} +19 -19
- package/{build-VD4L5IED.js → build-DVJSYCNF.js} +8 -9
- package/{cache-Q6FUUEQF.js → cache-JKQNGZ7L.js} +21 -15
- package/{chunk-5JFRXIK2.js → chunk-2PWSMJD7.js} +20 -1
- package/{chunk-5HBKYSTX.js → chunk-34TE4HZS.js} +36 -4
- package/{chunk-WAYVHANF.js → chunk-3LUM7NX5.js} +30 -5
- package/{chunk-NA732FNL.js → chunk-6FT6K5YN.js} +98 -6
- package/{chunk-HAYXR3MW.js → chunk-APMYKJI2.js} +1 -1
- package/{chunk-ZNCVQQDT.js → chunk-BWEH7DHQ.js} +2 -2
- package/{chunk-5HPGL5WS.js → chunk-CBASIDQH.js} +1 -1
- package/{chunk-MNK55XSE.js → chunk-CEHPRPGQ.js} +21 -0
- package/{chunk-2YJ5MESP.js → chunk-DF5K4CYR.js} +6 -10
- package/{chunk-DAS7TVRN.js → chunk-DR4Z63B6.js} +5 -5
- package/{chunk-NWLS3VOQ.js → chunk-DS7YMIHP.js} +239 -131
- package/{chunk-XUP35M5Q.js → chunk-GDT6KI4I.js} +4 -4
- package/{chunk-FUCQ7ARR.js → chunk-JZJWASXL.js} +36 -25
- package/{chunk-B5IILBX7.js → chunk-KDF7PEBY.js} +4 -4
- package/{chunk-P5S2TFCF.js → chunk-LN2A74PF.js} +14 -10
- package/{chunk-VL7RJVNN.js → chunk-LR42WTKN.js} +20 -11
- package/chunk-MZA6N2TA.js +190 -0
- package/{chunk-3564IL5W.js → chunk-QQYTPGIL.js} +1 -1
- package/chunk-SNOBGFNM.js +129 -0
- package/{chunk-LPIBYUMT.js → chunk-U7TEQCBN.js} +27 -1
- package/{chunk-TYRKIWGF.js → chunk-V4YCZZHY.js} +3 -3
- package/chunk-WD74RJXW.js +75 -0
- package/{chunk-XFI4THXZ.js → chunk-WE2TQN32.js} +1 -1
- package/{chunk-USTJECVS.js → chunk-X2AWQGYG.js} +1 -1
- package/{chunk-BSPUKIWY.js → chunk-XIF734VO.js} +12 -2
- package/chunk-YBVTY6ZW.js +91 -0
- package/{ci-G4PJWJQE.js → ci-WVYVR4XK.js} +10 -11
- package/cli-package.json +1 -1
- package/{config-WTIWWXRD.js → config-2MFZVP2N.js} +11 -11
- package/{config-66ARNESN.js → config-VYOTYBGS.js} +8 -6
- package/{create-DF6RQTHC.js → create-OJPLHBRR.js} +18 -18
- package/{deprecate-2KTC2HKH.js → deprecate-V4PKGFF7.js} +22 -19
- package/{dist-tag-QKJQIOGN.js → dist-tag-DNLV4VDE.js} +24 -26
- package/{docs-YSWJTGYX.js → docs-LXHDCGL5.js} +19 -19
- package/{exec-5XIMPSBI.js → exec-P32YSP44.js} +18 -18
- package/{exec-cache-OGX7WR5P.js → exec-cache-JZ5PDTOY.js} +16 -16
- package/{exec-local-SB7EPYED.js → exec-local-HHA464H4.js} +14 -15
- package/{help-GMCQHGVN.js → help-GVTTOYUL.js} +4 -5
- package/{init-KXIIWHBA.js → init-RENGG74N.js} +8 -9
- package/{install-ODTEMAMS.js → install-V6VXOBH2.js} +38 -15
- package/{list-QS4FLJSU.js → list-7N7Y5OXB.js} +42 -30
- package/{login-6TGYRY43.js → login-D2QSAUJC.js} +12 -12
- package/{logout-GOAB7KHJ.js → logout-QPOYBQNF.js} +8 -8
- package/{pack-PJDH6PKP.js → pack-4YYGXP3A.js} +12 -13
- package/package.json +1 -1
- package/{ping-ANBW2IRW.js → ping-QYRIZONU.js} +8 -8
- package/{pkg-GZWUXU65.js → pkg-WQTNABKT.js} +11 -12
- package/{profile-BLY74CMB.js → profile-PRI7WXK7.js} +21 -8
- package/{publish-W2KOTNMB.js → publish-PSBYJQS7.js} +33 -75
- package/{query-3PUMU5ON.js → query-UFYLQW4N.js} +36 -24
- package/{registry-ONSDWNPV.js → registry-YTJZ3AQD.js} +3 -3
- package/registry-client-src-revalidate.js +426 -217
- package/{repo-LZ6STH4C.js → repo-4S6ETFXX.js} +19 -19
- package/{reporter-SDMDYYMJ.js → reporter-GLWYHI2Y.js} +23 -1
- package/{run-JMIBADHE.js → run-OU7NUB7A.js} +14 -15
- package/{run-exec-JEKM2O53.js → run-exec-QPBY7ULE.js} +14 -15
- package/security-archive-src-update-expired.js +97 -63
- package/{setup-BTBU3NAI.js → setup-23QXG473.js} +43 -24
- package/{src-J4BAYOBO.js → src-3GN7TDNH.js} +14 -6
- package/{src-23VBKASP.js → src-575IYJOL.js} +17 -18
- package/{token-PUJ7QN6D.js → token-FCIA3RGD.js} +9 -9
- package/{uninstall-OTISP2T7.js → uninstall-BQVZVKB5.js} +12 -12
- package/{unpublish-X75EEQAN.js → unpublish-YGJ5HEYF.js} +43 -40
- package/{update-CKXX5POE.js → update-WCGV66JK.js} +35 -13
- package/{version-24B2X7M7.js → version-7EA3UQG7.js} +10 -11
- package/{view-Q7MAQ6R3.js → view-5FWIENVE.js} +10 -10
- 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-S6CQZFE3.js → whoami-O4ZTBIC4.js} +29 -13
- package/chunk-E74WGW5C.js +0 -49
- package/chunk-UBLFPJHV.js +0 -40
- package/chunk-Y3QEV76Q.js +0 -75
- package/registry-client-package.json +0 -75
|
@@ -11,19 +11,21 @@ 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-2PWSMJD7.js";
|
|
15
15
|
import {
|
|
16
16
|
commandUsage
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-CBASIDQH.js";
|
|
18
18
|
import "./chunk-XKVU23NC.js";
|
|
19
|
-
import "./chunk-
|
|
19
|
+
import "./chunk-CEHPRPGQ.js";
|
|
20
20
|
import {
|
|
21
21
|
RegistryClient
|
|
22
|
-
} from "./chunk-
|
|
23
|
-
import "./chunk-
|
|
24
|
-
import
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
} from "./chunk-DS7YMIHP.js";
|
|
23
|
+
import "./chunk-APMYKJI2.js";
|
|
24
|
+
import {
|
|
25
|
+
assertOk
|
|
26
|
+
} from "./chunk-SNOBGFNM.js";
|
|
27
|
+
import "./chunk-YBVTY6ZW.js";
|
|
28
|
+
import "./chunk-U7TEQCBN.js";
|
|
27
29
|
import "./chunk-VFBCWAOC.js";
|
|
28
30
|
import "./chunk-XNLSTHDK.js";
|
|
29
31
|
import "./chunk-BHJT53TP.js";
|
|
@@ -116,6 +118,7 @@ var command = async (conf) => {
|
|
|
116
118
|
}
|
|
117
119
|
};
|
|
118
120
|
var encodePkgName = (name) => name.startsWith("@") ? `@${encodeURIComponent(name.slice(1))}` : encodeURIComponent(name);
|
|
121
|
+
var accessAdvice = (what) => (statusCode) => statusCode === 401 ? "Run `vlt login` and try again." : statusCode === 403 ? `This account cannot ${what}. Run \`vlt whoami\` to see who you are logged in as.` : statusCode === 404 ? "Not found. Check the name, and that this account has access to it." : void 0;
|
|
119
122
|
var listPackages = async (conf, args) => {
|
|
120
123
|
const [keyword, entity] = args;
|
|
121
124
|
if (keyword !== "packages") {
|
|
@@ -132,6 +135,11 @@ var listPackages = async (conf, args) => {
|
|
|
132
135
|
registryUrl
|
|
133
136
|
);
|
|
134
137
|
const response = await rc.request(url, { useCache: false });
|
|
138
|
+
assertOk(response, {
|
|
139
|
+
message: "Failed to list packages",
|
|
140
|
+
url,
|
|
141
|
+
advice: accessAdvice("list packages for this scope")
|
|
142
|
+
});
|
|
135
143
|
const data = response.json();
|
|
136
144
|
return { packages: data };
|
|
137
145
|
};
|
|
@@ -155,6 +163,11 @@ var getStatus = async (conf, args) => {
|
|
|
155
163
|
registryUrl
|
|
156
164
|
);
|
|
157
165
|
const response = await rc.request(url, { useCache: false });
|
|
166
|
+
assertOk(response, {
|
|
167
|
+
message: "Failed to get package access status",
|
|
168
|
+
url,
|
|
169
|
+
advice: accessAdvice("read access for this package")
|
|
170
|
+
});
|
|
158
171
|
const data = response.json();
|
|
159
172
|
return { package: pkg, access: data.access };
|
|
160
173
|
};
|
|
@@ -185,13 +198,19 @@ var setStatus = async (conf, args) => {
|
|
|
185
198
|
`-/package/${encodePkgName(pkg)}/access`,
|
|
186
199
|
registryUrl
|
|
187
200
|
);
|
|
188
|
-
await rc.request(url, {
|
|
201
|
+
const response = await rc.request(url, {
|
|
189
202
|
method: "PUT",
|
|
190
203
|
headers: { "content-type": "application/json" },
|
|
191
204
|
body: JSON.stringify({ access: accessLevel }),
|
|
192
205
|
otp: conf.options.otp,
|
|
193
206
|
useCache: false
|
|
194
207
|
});
|
|
208
|
+
assertOk(response, {
|
|
209
|
+
message: "Failed to set package access status",
|
|
210
|
+
url,
|
|
211
|
+
method: "PUT",
|
|
212
|
+
advice: accessAdvice("change access for this package")
|
|
213
|
+
});
|
|
195
214
|
return { package: pkg, access: accessLevel };
|
|
196
215
|
};
|
|
197
216
|
var grant = async (conf, args) => {
|
|
@@ -223,7 +242,7 @@ var grant = async (conf, args) => {
|
|
|
223
242
|
`-/team/${encodeURIComponent(scope)}/${encodeURIComponent(team)}/package`,
|
|
224
243
|
registryUrl
|
|
225
244
|
);
|
|
226
|
-
await rc.request(url, {
|
|
245
|
+
const response = await rc.request(url, {
|
|
227
246
|
method: "PUT",
|
|
228
247
|
headers: { "content-type": "application/json" },
|
|
229
248
|
body: JSON.stringify({
|
|
@@ -233,6 +252,12 @@ var grant = async (conf, args) => {
|
|
|
233
252
|
otp: conf.options.otp,
|
|
234
253
|
useCache: false
|
|
235
254
|
});
|
|
255
|
+
assertOk(response, {
|
|
256
|
+
message: "Failed to grant team access",
|
|
257
|
+
url,
|
|
258
|
+
method: "PUT",
|
|
259
|
+
advice: accessAdvice("grant access for this team")
|
|
260
|
+
});
|
|
236
261
|
return {
|
|
237
262
|
granted: {
|
|
238
263
|
team: `${scope}:${team}`,
|
|
@@ -262,13 +287,19 @@ var revoke = async (conf, args) => {
|
|
|
262
287
|
`-/team/${encodeURIComponent(scope)}/${encodeURIComponent(team)}/package`,
|
|
263
288
|
registryUrl
|
|
264
289
|
);
|
|
265
|
-
await rc.request(url, {
|
|
290
|
+
const response = await rc.request(url, {
|
|
266
291
|
method: "DELETE",
|
|
267
292
|
headers: { "content-type": "application/json" },
|
|
268
293
|
body: JSON.stringify({ package: pkgName }),
|
|
269
294
|
otp: conf.options.otp,
|
|
270
295
|
useCache: false
|
|
271
296
|
});
|
|
297
|
+
assertOk(response, {
|
|
298
|
+
message: "Failed to revoke team access",
|
|
299
|
+
url,
|
|
300
|
+
method: "DELETE",
|
|
301
|
+
advice: accessAdvice("revoke access for this team")
|
|
302
|
+
});
|
|
272
303
|
return {
|
|
273
304
|
revoked: {
|
|
274
305
|
team: `${scope}:${team}`
|
|
@@ -14,42 +14,42 @@ import {
|
|
|
14
14
|
} from "./chunk-CLVRCGOZ.js";
|
|
15
15
|
import {
|
|
16
16
|
openUrl
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-BWEH7DHQ.js";
|
|
18
18
|
import {
|
|
19
19
|
createHostContextsMap
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-3LUM7NX5.js";
|
|
21
|
+
import "./chunk-LR42WTKN.js";
|
|
22
|
+
import "./chunk-34TE4HZS.js";
|
|
23
|
+
import "./chunk-G2YT2GWF.js";
|
|
24
|
+
import "./chunk-GDJ7JT2R.js";
|
|
21
25
|
import {
|
|
22
26
|
PackageInfoClient
|
|
23
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-LN2A74PF.js";
|
|
24
28
|
import "./chunk-ZWKI5OSF.js";
|
|
25
|
-
import "./chunk-VL7RJVNN.js";
|
|
26
|
-
import "./chunk-5HBKYSTX.js";
|
|
27
|
-
import "./chunk-G2YT2GWF.js";
|
|
28
|
-
import "./chunk-GDJ7JT2R.js";
|
|
29
|
-
import "./chunk-5JFRXIK2.js";
|
|
30
29
|
import "./chunk-WGDTG44V.js";
|
|
30
|
+
import "./chunk-2PWSMJD7.js";
|
|
31
31
|
import {
|
|
32
32
|
Query,
|
|
33
33
|
actual
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-JZJWASXL.js";
|
|
35
35
|
import {
|
|
36
36
|
SecurityArchive
|
|
37
|
-
} from "./chunk-
|
|
38
|
-
import "./chunk-USTJECVS.js";
|
|
39
|
-
import "./chunk-YOE3VZFX.js";
|
|
37
|
+
} from "./chunk-DF5K4CYR.js";
|
|
40
38
|
import {
|
|
41
39
|
commandUsage
|
|
42
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-CBASIDQH.js";
|
|
41
|
+
import "./chunk-X2AWQGYG.js";
|
|
42
|
+
import "./chunk-4KCU2KZL.js";
|
|
43
|
+
import "./chunk-YOE3VZFX.js";
|
|
43
44
|
import {
|
|
44
45
|
Spec
|
|
45
46
|
} from "./chunk-XKVU23NC.js";
|
|
46
|
-
import "./chunk-
|
|
47
|
-
import "./chunk-4KCU2KZL.js";
|
|
47
|
+
import "./chunk-CEHPRPGQ.js";
|
|
48
48
|
import "./chunk-HTOTG4TS.js";
|
|
49
|
-
import "./chunk-
|
|
50
|
-
import "./chunk-
|
|
51
|
-
import "./chunk-
|
|
52
|
-
import "./chunk-
|
|
49
|
+
import "./chunk-APMYKJI2.js";
|
|
50
|
+
import "./chunk-SNOBGFNM.js";
|
|
51
|
+
import "./chunk-YBVTY6ZW.js";
|
|
52
|
+
import "./chunk-U7TEQCBN.js";
|
|
53
53
|
import "./chunk-VFBCWAOC.js";
|
|
54
54
|
import "./chunk-XNLSTHDK.js";
|
|
55
55
|
import "./chunk-BHJT53TP.js";
|
|
@@ -11,19 +11,18 @@ 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-
|
|
16
|
-
import "./chunk-USTJECVS.js";
|
|
17
|
-
import "./chunk-YOE3VZFX.js";
|
|
14
|
+
} from "./chunk-JZJWASXL.js";
|
|
15
|
+
import "./chunk-DF5K4CYR.js";
|
|
18
16
|
import {
|
|
19
17
|
commandUsage
|
|
20
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-CBASIDQH.js";
|
|
19
|
+
import "./chunk-X2AWQGYG.js";
|
|
20
|
+
import "./chunk-YOE3VZFX.js";
|
|
21
21
|
import "./chunk-XKVU23NC.js";
|
|
22
|
-
import "./chunk-
|
|
22
|
+
import "./chunk-CEHPRPGQ.js";
|
|
23
23
|
import "./chunk-HTOTG4TS.js";
|
|
24
|
-
import "./chunk-
|
|
25
|
-
import "./chunk-
|
|
26
|
-
import "./chunk-UBLFPJHV.js";
|
|
24
|
+
import "./chunk-YBVTY6ZW.js";
|
|
25
|
+
import "./chunk-U7TEQCBN.js";
|
|
27
26
|
import {
|
|
28
27
|
isErrorWithCause
|
|
29
28
|
} from "./chunk-VFBCWAOC.js";
|
|
@@ -15,30 +15,32 @@ import {
|
|
|
15
15
|
import {
|
|
16
16
|
stderr,
|
|
17
17
|
stdout
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import "./chunk-
|
|
18
|
+
} from "./chunk-LR42WTKN.js";
|
|
19
|
+
import "./chunk-34TE4HZS.js";
|
|
20
20
|
import "./chunk-G2YT2GWF.js";
|
|
21
21
|
import "./chunk-GDJ7JT2R.js";
|
|
22
|
-
import "./chunk-5JFRXIK2.js";
|
|
23
22
|
import "./chunk-WGDTG44V.js";
|
|
24
|
-
import "./chunk-
|
|
23
|
+
import "./chunk-2PWSMJD7.js";
|
|
25
24
|
import {
|
|
26
25
|
commandUsage
|
|
27
|
-
} from "./chunk-
|
|
28
|
-
import {
|
|
29
|
-
Spec
|
|
30
|
-
} from "./chunk-XKVU23NC.js";
|
|
31
|
-
import "./chunk-MNK55XSE.js";
|
|
26
|
+
} from "./chunk-CBASIDQH.js";
|
|
32
27
|
import {
|
|
33
28
|
ViewClass
|
|
34
29
|
} from "./chunk-4KCU2KZL.js";
|
|
30
|
+
import "./chunk-YOE3VZFX.js";
|
|
31
|
+
import {
|
|
32
|
+
Spec
|
|
33
|
+
} from "./chunk-XKVU23NC.js";
|
|
34
|
+
import "./chunk-CEHPRPGQ.js";
|
|
35
35
|
import {
|
|
36
36
|
CacheEntry
|
|
37
|
-
} from "./chunk-
|
|
38
|
-
import "./chunk-
|
|
39
|
-
import
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
} from "./chunk-DS7YMIHP.js";
|
|
38
|
+
import "./chunk-APMYKJI2.js";
|
|
39
|
+
import {
|
|
40
|
+
assertOk
|
|
41
|
+
} from "./chunk-SNOBGFNM.js";
|
|
42
|
+
import "./chunk-YBVTY6ZW.js";
|
|
43
|
+
import "./chunk-U7TEQCBN.js";
|
|
42
44
|
import "./chunk-VFBCWAOC.js";
|
|
43
45
|
import "./chunk-XNLSTHDK.js";
|
|
44
46
|
import "./chunk-BHJT53TP.js";
|
|
@@ -297,12 +299,16 @@ var add = async (conf, specs, view2) => {
|
|
|
297
299
|
staleWhileRevalidate: false
|
|
298
300
|
}).then(async (r) => {
|
|
299
301
|
const { resolved, integrity } = r;
|
|
300
|
-
await (await packageInfo.getRegistryClient()).request(resolved, {
|
|
302
|
+
const response = await (await packageInfo.getRegistryClient()).request(resolved, {
|
|
301
303
|
...conf.options,
|
|
302
304
|
integrity,
|
|
303
305
|
staleWhileRevalidate: false,
|
|
304
306
|
query: void 0
|
|
305
307
|
});
|
|
308
|
+
assertOk(response, {
|
|
309
|
+
message: `Failed to cache ${spec}`,
|
|
310
|
+
url: resolved
|
|
311
|
+
});
|
|
306
312
|
view2?.stdout("+", spec, r.resolved);
|
|
307
313
|
});
|
|
308
314
|
promises.push(p);
|
|
@@ -11,7 +11,9 @@ import {createRequire as _vlt_createRequire} from "node:module";
|
|
|
11
11
|
var require = _vlt_createRequire(import.meta.filename);
|
|
12
12
|
import {
|
|
13
13
|
defaultRegistries,
|
|
14
|
-
defaultRegistryName
|
|
14
|
+
defaultRegistryName,
|
|
15
|
+
isErrorWithCause,
|
|
16
|
+
isObject
|
|
15
17
|
} from "./chunk-VFBCWAOC.js";
|
|
16
18
|
import {
|
|
17
19
|
error
|
|
@@ -68,6 +70,21 @@ var missingRegistryError = () => error(
|
|
|
68
70
|
].join("\n"),
|
|
69
71
|
{ code: "ECONFIG" }
|
|
70
72
|
);
|
|
73
|
+
var normalizeRegistryURL = (url) => url.replace(/\/*$/, "/");
|
|
74
|
+
var unknownSpecPrefixError = (prefix, spec, validOptions) => error(
|
|
75
|
+
[
|
|
76
|
+
`Unknown spec prefix "${prefix}:" in "${spec}".`,
|
|
77
|
+
"",
|
|
78
|
+
`Define it with \`--registries ${prefix}=<url>\` or`,
|
|
79
|
+
`\`--git-hosts ${prefix}=<template>\` (add \`--save-config\` to keep`,
|
|
80
|
+
`it in vlt.json), or run \`vlt config set registries.${prefix}=<url>\`.`
|
|
81
|
+
].join("\n"),
|
|
82
|
+
{ code: "ECONFIG", found: `${prefix}:`, validOptions }
|
|
83
|
+
);
|
|
84
|
+
var asUnknownSpecPrefix = (er) => {
|
|
85
|
+
const { found, spec, validOptions } = isErrorWithCause(er) && isObject(er.cause) ? er.cause : {};
|
|
86
|
+
return typeof found === "string" && /^[^:]+:$/.test(found) && typeof spec === "string" && er.message.startsWith("Protocol ") ? unknownSpecPrefixError(found.slice(0, -1), spec, validOptions) : er;
|
|
87
|
+
};
|
|
71
88
|
var missingNpmRegistryError = (alias = defaultRegistryName) => error(
|
|
72
89
|
[
|
|
73
90
|
`Missing ${alias} registry configuration.`,
|
|
@@ -144,6 +161,8 @@ var resolveRegistry = async (conf, {
|
|
|
144
161
|
|
|
145
162
|
export {
|
|
146
163
|
missingRegistryError,
|
|
164
|
+
normalizeRegistryURL,
|
|
165
|
+
asUnknownSpecPrefix,
|
|
147
166
|
missingNpmRegistryError,
|
|
148
167
|
hasConfiguredRegistry,
|
|
149
168
|
hasNpmRegistry,
|
|
@@ -14,10 +14,41 @@ import {
|
|
|
14
14
|
} from "./chunk-WGDTG44V.js";
|
|
15
15
|
import {
|
|
16
16
|
commandAliases
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
} from "
|
|
17
|
+
} from "./chunk-CEHPRPGQ.js";
|
|
18
|
+
|
|
19
|
+
// ../../node_modules/.vlt/~npm~package-json-from-dist@1.0.1/node_modules/package-json-from-dist/dist/esm/index.js
|
|
20
|
+
import { readFileSync } from "node:fs";
|
|
21
|
+
import { dirname, resolve, sep } from "node:path";
|
|
22
|
+
import { fileURLToPath } from "node:url";
|
|
23
|
+
var NM = `${sep}node_modules${sep}`;
|
|
24
|
+
var STORE = `.store${sep}`;
|
|
25
|
+
var PKG = `${sep}package${sep}`;
|
|
26
|
+
var DIST = `${sep}dist${sep}`;
|
|
27
|
+
var findPackageJson = (from, pathFromSrc = "../package.json") => {
|
|
28
|
+
const f = typeof from === "object" || from.startsWith("file://") ? fileURLToPath(from) : from;
|
|
29
|
+
const __dirname = dirname(f);
|
|
30
|
+
const nms = __dirname.lastIndexOf(NM);
|
|
31
|
+
if (nms !== -1) {
|
|
32
|
+
const nm = __dirname.substring(0, nms + NM.length);
|
|
33
|
+
const pkgDir = __dirname.substring(nms + NM.length);
|
|
34
|
+
if (pkgDir.startsWith(STORE)) {
|
|
35
|
+
const pkg = pkgDir.indexOf(PKG, STORE.length);
|
|
36
|
+
if (pkg) {
|
|
37
|
+
return resolve(nm, pkgDir.substring(0, pkg + PKG.length), "package.json");
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const pkgName = pkgDir.startsWith("@") ? pkgDir.split(sep, 2).join(sep) : String(pkgDir.split(sep)[0]);
|
|
41
|
+
return resolve(nm, pkgName, "package.json");
|
|
42
|
+
} else {
|
|
43
|
+
const d = __dirname.lastIndexOf(DIST);
|
|
44
|
+
if (d !== -1) {
|
|
45
|
+
return resolve(__dirname.substring(0, d), "package.json");
|
|
46
|
+
} else {
|
|
47
|
+
return resolve(__dirname, pathFromSrc);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
var loadPackageJson = (from, pathFromSrc = "../package.json") => JSON.parse(readFileSync(findPackageJson(from, pathFromSrc), "utf8"));
|
|
21
52
|
|
|
22
53
|
// ../../src/cli-sdk/src/custom-help.ts
|
|
23
54
|
var { version } = loadPackageJson(
|
|
@@ -368,6 +399,7 @@ ${s("dim", `Run \`vlt help <command>\` for detailed information about a specific
|
|
|
368
399
|
};
|
|
369
400
|
|
|
370
401
|
export {
|
|
402
|
+
loadPackageJson,
|
|
371
403
|
generateDefaultHelp,
|
|
372
404
|
generateFullHelp
|
|
373
405
|
};
|
|
@@ -13,14 +13,39 @@ import {
|
|
|
13
13
|
actual,
|
|
14
14
|
callLimit,
|
|
15
15
|
createVirtualRoot
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-JZJWASXL.js";
|
|
17
17
|
import {
|
|
18
18
|
SecurityArchive
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-DF5K4CYR.js";
|
|
20
20
|
import {
|
|
21
21
|
error
|
|
22
22
|
} from "./chunk-WZWDS3W4.js";
|
|
23
23
|
|
|
24
|
+
// ../../src/cli-sdk/src/is-vlt-installed.ts
|
|
25
|
+
import { lstatSync } from "node:fs";
|
|
26
|
+
import { resolve } from "node:path";
|
|
27
|
+
var lstat = (path) => {
|
|
28
|
+
try {
|
|
29
|
+
return lstatSync(path, { throwIfNoEntry: false });
|
|
30
|
+
} catch {
|
|
31
|
+
return void 0;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
var isDir = (path) => !!lstat(path)?.isDirectory();
|
|
35
|
+
var isFile = (path) => !!lstat(path)?.isFile();
|
|
36
|
+
var isVltInstalled = (projectRoot) => isDir(resolve(projectRoot, "node_modules/.vlt")) || isFile(resolve(projectRoot, "node_modules/.vlt-lock.json"));
|
|
37
|
+
var assertVltInstalled = (projectRoot, command) => {
|
|
38
|
+
if (isVltInstalled(projectRoot)) return;
|
|
39
|
+
const nodeModules = resolve(projectRoot, "node_modules");
|
|
40
|
+
const hint = isDir(nodeModules) ? `run \`vlt install\` to rebuild it before running \`vlt ${command}\`` : `run \`vlt install\` before running \`vlt ${command}\``;
|
|
41
|
+
throw error(`No vlt install found in ${nodeModules}
|
|
42
|
+
|
|
43
|
+
${hint}`, {
|
|
44
|
+
code: "EQUERY",
|
|
45
|
+
path: nodeModules
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
|
|
24
49
|
// ../../src/cli-sdk/src/query-host-contexts.ts
|
|
25
50
|
import { homedir as homedir2 } from "node:os";
|
|
26
51
|
import { parse, posix } from "node:path";
|
|
@@ -115,7 +140,7 @@ var reloadConfig = async (folder) => {
|
|
|
115
140
|
unload("project");
|
|
116
141
|
} catch {
|
|
117
142
|
}
|
|
118
|
-
const { Config } = await import("./config-
|
|
143
|
+
const { Config } = await import("./config-VYOTYBGS.js");
|
|
119
144
|
return Config.load(folder, process.argv, true);
|
|
120
145
|
};
|
|
121
146
|
|
|
@@ -126,7 +151,6 @@ try {
|
|
|
126
151
|
} catch {
|
|
127
152
|
}
|
|
128
153
|
var home2 = foundHome ?? posix.dirname(posix.format(parse(process.cwd())));
|
|
129
|
-
var isVltInstalled = (folder) => !!folder.resolve("node_modules/.vlt").lstatSync()?.isDirectory() || !!folder.resolve("node_modules/.vlt-lock.json").lstatSync()?.isFile();
|
|
130
154
|
var getPossibleProjectKeys = (folder, scurry) => {
|
|
131
155
|
const relativePath = posix.relative(
|
|
132
156
|
scurry.cwd.fullpathPosix(),
|
|
@@ -196,7 +220,7 @@ var createHostContextsMap = async (conf) => {
|
|
|
196
220
|
for (const folder of projectFolders) {
|
|
197
221
|
try {
|
|
198
222
|
const config = await reloadConfig(folder.fullpath());
|
|
199
|
-
if (!isVltInstalled(folder)) {
|
|
223
|
+
if (!isVltInstalled(folder.fullpath())) {
|
|
200
224
|
continue;
|
|
201
225
|
}
|
|
202
226
|
const graph = actual.load({
|
|
@@ -234,5 +258,6 @@ var createHostContextsMap = async (conf) => {
|
|
|
234
258
|
};
|
|
235
259
|
|
|
236
260
|
export {
|
|
261
|
+
assertVltInstalled,
|
|
237
262
|
createHostContextsMap
|
|
238
263
|
};
|
|
@@ -11,12 +11,12 @@ import {createRequire as _vlt_createRequire} from "node:module";
|
|
|
11
11
|
var require = _vlt_createRequire(import.meta.filename);
|
|
12
12
|
import {
|
|
13
13
|
PackageInfoClient
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-LN2A74PF.js";
|
|
15
15
|
import {
|
|
16
16
|
Monorepo,
|
|
17
17
|
PackageJson,
|
|
18
18
|
PathScurry
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-X2AWQGYG.js";
|
|
20
20
|
import {
|
|
21
21
|
resetCaches
|
|
22
22
|
} from "./chunk-YOE3VZFX.js";
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
getCommand,
|
|
28
28
|
isRecordField,
|
|
29
29
|
recordFields
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-CEHPRPGQ.js";
|
|
31
31
|
import {
|
|
32
32
|
find,
|
|
33
33
|
load,
|
|
@@ -38,6 +38,7 @@ import {
|
|
|
38
38
|
assertRecordStringString,
|
|
39
39
|
assertRecordStringT,
|
|
40
40
|
getOptions,
|
|
41
|
+
isObject,
|
|
41
42
|
isRecordStringString
|
|
42
43
|
} from "./chunk-VFBCWAOC.js";
|
|
43
44
|
import {
|
|
@@ -150,6 +151,7 @@ var assertRegistryKeys = (registries, file) => {
|
|
|
150
151
|
for (const key of Object.keys(obj)) {
|
|
151
152
|
if (key === "" || key.includes("~")) {
|
|
152
153
|
throw error("Reserved character found in registries name", {
|
|
154
|
+
code: "ECONFIG",
|
|
153
155
|
path: file,
|
|
154
156
|
found: key
|
|
155
157
|
});
|
|
@@ -190,6 +192,26 @@ var recordsToPairs = (obj) => {
|
|
|
190
192
|
);
|
|
191
193
|
};
|
|
192
194
|
var kRecord = /* @__PURE__ */ Symbol("parsed key=value record");
|
|
195
|
+
var envKey = (k) => `VLT_${k.replace(/[^a-zA-Z0-9]+/g, "_").toUpperCase()}`;
|
|
196
|
+
var kParentEnv = "__VLT_INTERNAL_EXPLICIT";
|
|
197
|
+
var parentEnv = () => {
|
|
198
|
+
try {
|
|
199
|
+
const p = JSON.parse(process.env[kParentEnv] ?? "");
|
|
200
|
+
return isObject(p) && isObject(p.explicit) && Object.entries(p.explicit).every(
|
|
201
|
+
([k, v]) => isRecordField(k) ? Array.isArray(v) && v.every((x) => typeof x === "string") : !isObject(v)
|
|
202
|
+
) && isRecordStringString(p.env) ? p : void 0;
|
|
203
|
+
} catch {
|
|
204
|
+
return void 0;
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
var dedupePairs = (pairs) => [
|
|
208
|
+
...new Map(
|
|
209
|
+
pairs.map((p) => {
|
|
210
|
+
const eq = p.indexOf("=");
|
|
211
|
+
return [eq === -1 ? p : p.substring(0, eq), p];
|
|
212
|
+
})
|
|
213
|
+
).values()
|
|
214
|
+
];
|
|
193
215
|
var Config = class _Config {
|
|
194
216
|
/**
|
|
195
217
|
* The {@link https://npmjs.com/jackspeak | JackSpeak} object
|
|
@@ -308,17 +330,56 @@ var Config = class _Config {
|
|
|
308
330
|
parse(args = process.argv) {
|
|
309
331
|
if (isParsed(this)) return this;
|
|
310
332
|
this.#originalArgs = [...args];
|
|
333
|
+
const envKeys = Object.keys(defaultValues).filter(
|
|
334
|
+
(k) => process.env[envKey(k)] !== void 0
|
|
335
|
+
);
|
|
336
|
+
const parent = parentEnv();
|
|
337
|
+
const fileValues = this.#defaults();
|
|
311
338
|
this.jack.loadEnvDefaults();
|
|
339
|
+
const envValues = this.#defaults();
|
|
312
340
|
const p = this.jack.parseRaw(args);
|
|
341
|
+
const cliKeys = Object.keys(p.values);
|
|
313
342
|
const fallback = getCommand(p.values["fallback-command"]);
|
|
314
343
|
this.command = getCommand(p.positionals[0]);
|
|
315
344
|
const cmdOrFallback = this.command ?? fallback;
|
|
316
345
|
const cmdSpecific = cmdOrFallback && this.commandValues[cmdOrFallback];
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
}
|
|
346
|
+
const cmdPairs = cmdSpecific ? recordsToPairs(cmdSpecific) : {};
|
|
347
|
+
if (cmdSpecific) this.jack.setConfigValues(cmdPairs);
|
|
320
348
|
this.jack.applyDefaults(p);
|
|
349
|
+
const values = p.values;
|
|
350
|
+
const explicit = {};
|
|
351
|
+
for (const k of /* @__PURE__ */ new Set([...envKeys, ...cliKeys])) {
|
|
352
|
+
const cli = cliKeys.includes(k) ? values[k] : void 0;
|
|
353
|
+
const env = this.#explicitEnv(k, envValues[k], parent);
|
|
354
|
+
if (isRecordField(k)) {
|
|
355
|
+
const pairs = [
|
|
356
|
+
...env ?? [],
|
|
357
|
+
...cli ?? []
|
|
358
|
+
];
|
|
359
|
+
if (pairs.length) explicit[k] = dedupePairs(pairs);
|
|
360
|
+
} else if (cli !== void 0) explicit[k] = cli;
|
|
361
|
+
else if (env !== void 0 && !(k in cmdPairs))
|
|
362
|
+
explicit[k] = env;
|
|
363
|
+
}
|
|
364
|
+
this.explicit = explicit;
|
|
365
|
+
for (const k of recordFields) {
|
|
366
|
+
const env = envKeys.includes(k) ? envValues[k] : [];
|
|
367
|
+
const cli = cliKeys.includes(k) ? values[k] : [];
|
|
368
|
+
const pairs = [...env, ...cli];
|
|
369
|
+
if (!pairs.length) continue;
|
|
370
|
+
const base = (k in cmdPairs ? cmdPairs[k] : fileValues[k]) ?? [];
|
|
371
|
+
values[k] = dedupePairs([...base, ...pairs]);
|
|
372
|
+
}
|
|
321
373
|
this.jack.writeEnv(p);
|
|
374
|
+
process.env[kParentEnv] = JSON.stringify({
|
|
375
|
+
explicit,
|
|
376
|
+
env: Object.fromEntries(
|
|
377
|
+
Object.keys(defaultValues).flatMap((k) => {
|
|
378
|
+
const v = process.env[envKey(k)];
|
|
379
|
+
return v === void 0 ? [] : [[envKey(k), v]];
|
|
380
|
+
})
|
|
381
|
+
)
|
|
382
|
+
});
|
|
322
383
|
if (this.command) p.positionals.shift();
|
|
323
384
|
else this.command = getCommand(p.values["fallback-command"]);
|
|
324
385
|
Object.assign(this, p);
|
|
@@ -328,6 +389,35 @@ var Config = class _Config {
|
|
|
328
389
|
if (!isParsed(this)) throw error("failed to parse config");
|
|
329
390
|
return this;
|
|
330
391
|
}
|
|
392
|
+
/**
|
|
393
|
+
* Values set on the command line or via `VLT_*` env for this run.
|
|
394
|
+
* Record fields hold only those `key=value` pairs, not the ones from
|
|
395
|
+
* config files.
|
|
396
|
+
*
|
|
397
|
+
* `VLT_*` env left as a parent vlt process wrote it only counts for
|
|
398
|
+
* what was explicit in that parent.
|
|
399
|
+
*/
|
|
400
|
+
explicit = {};
|
|
401
|
+
// a field's explicit env value: all of it at the top level, the new
|
|
402
|
+
// pairs (or changed scalar) when inherited from a parent vlt. once a
|
|
403
|
+
// script changes a record var, the parent's explicit pairs are dropped.
|
|
404
|
+
#explicitEnv(k, value, parent) {
|
|
405
|
+
const cur = process.env[envKey(k)];
|
|
406
|
+
if (cur === void 0) return void 0;
|
|
407
|
+
const written = parent?.env[envKey(k)];
|
|
408
|
+
if (cur === written) return parent?.explicit[k];
|
|
409
|
+
if (!isRecordField(k) || written === void 0) return value;
|
|
410
|
+
const old = new Set(written.split("\n"));
|
|
411
|
+
return value.filter((p) => !old.has(p));
|
|
412
|
+
}
|
|
413
|
+
// the current jack defaults, ie config file (+ env, once loaded) values
|
|
414
|
+
#defaults() {
|
|
415
|
+
const d = { values: {}, positionals: [] };
|
|
416
|
+
this.jack.applyDefaults(
|
|
417
|
+
d
|
|
418
|
+
);
|
|
419
|
+
return d.values;
|
|
420
|
+
}
|
|
331
421
|
/**
|
|
332
422
|
* Get a `key=value` list option value as an object.
|
|
333
423
|
*
|
|
@@ -605,8 +695,10 @@ var configWriteTarget = (conf, fallback) => {
|
|
|
605
695
|
};
|
|
606
696
|
|
|
607
697
|
export {
|
|
698
|
+
registrySelectors,
|
|
608
699
|
registrySelectionFields,
|
|
609
700
|
kCustomInspect,
|
|
701
|
+
assertRegistryKeys,
|
|
610
702
|
pairsToRecords,
|
|
611
703
|
recordsToPairs,
|
|
612
704
|
Config,
|
|
@@ -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
|
stderr
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-LR42WTKN.js";
|
|
15
15
|
import {
|
|
16
16
|
urlOpen
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-APMYKJI2.js";
|
|
18
18
|
|
|
19
19
|
// ../../src/cli-sdk/src/open-url.ts
|
|
20
20
|
var openUrl = async (url) => {
|