@vltpkg/cli-js 1.0.10 → 1.1.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.
Files changed (77) hide show
  1. package/{access-4RPC3X5N.js → access-GLWBGQLN.js} +41 -10
  2. package/{bugs-K6QLQLL4.js → bugs-OCQYFWFE.js} +18 -18
  3. package/{build-VD4L5IED.js → build-CPWGNTCM.js} +7 -8
  4. package/{cache-Q6FUUEQF.js → cache-SL7DQMY2.js} +20 -14
  5. package/chunk-2IMBYPYC.js +190 -0
  6. package/{chunk-5JFRXIK2.js → chunk-2PWSMJD7.js} +20 -1
  7. package/{chunk-FUCQ7ARR.js → chunk-47M7IZ5P.js} +26 -22
  8. package/{chunk-WAYVHANF.js → chunk-6LEMBT22.js} +30 -5
  9. package/chunk-A75UYRJC.js +75 -0
  10. package/{chunk-HAYXR3MW.js → chunk-APMYKJI2.js} +1 -1
  11. package/{chunk-B5IILBX7.js → chunk-BUXPKRYB.js} +4 -4
  12. package/{chunk-5HPGL5WS.js → chunk-CBASIDQH.js} +1 -1
  13. package/{chunk-MNK55XSE.js → chunk-CEHPRPGQ.js} +21 -0
  14. package/{chunk-BSPUKIWY.js → chunk-CF5EGH4W.js} +12 -2
  15. package/{chunk-P5S2TFCF.js → chunk-CTQSUNNE.js} +14 -10
  16. package/{chunk-NWLS3VOQ.js → chunk-GJGQTRAT.js} +154 -26
  17. package/{chunk-5HBKYSTX.js → chunk-HYCYL4RX.js} +1 -1
  18. package/{chunk-NA732FNL.js → chunk-J2XWQVDK.js} +98 -6
  19. package/{chunk-DAS7TVRN.js → chunk-JSQUYHU7.js} +5 -5
  20. package/{chunk-XUP35M5Q.js → chunk-S6Y57MUS.js} +4 -4
  21. package/chunk-SNOBGFNM.js +129 -0
  22. package/{chunk-VL7RJVNN.js → chunk-TNEMFBP5.js} +20 -11
  23. package/{chunk-3564IL5W.js → chunk-TUXWDPCQ.js} +1 -1
  24. package/{chunk-ZNCVQQDT.js → chunk-TXTK2PKN.js} +2 -2
  25. package/{chunk-LPIBYUMT.js → chunk-U7TEQCBN.js} +27 -1
  26. package/{chunk-XFI4THXZ.js → chunk-WE2TQN32.js} +1 -1
  27. package/{chunk-USTJECVS.js → chunk-X2AWQGYG.js} +1 -1
  28. package/{chunk-TYRKIWGF.js → chunk-YKCGWKUE.js} +3 -3
  29. package/{chunk-2YJ5MESP.js → chunk-ZDQJWRCU.js} +1 -1
  30. package/{ci-G4PJWJQE.js → ci-O2RSLTBX.js} +9 -10
  31. package/cli-package.json +1 -1
  32. package/{config-WTIWWXRD.js → config-ZBIF32GS.js} +11 -11
  33. package/{config-66ARNESN.js → config-ZPH7V77F.js} +8 -6
  34. package/{create-DF6RQTHC.js → create-2JX4RV5U.js} +17 -17
  35. package/{deprecate-2KTC2HKH.js → deprecate-XJLP2TUW.js} +21 -18
  36. package/{dist-tag-QKJQIOGN.js → dist-tag-F6ZFWGQU.js} +23 -25
  37. package/{docs-YSWJTGYX.js → docs-IJCZZ4V6.js} +18 -18
  38. package/{exec-5XIMPSBI.js → exec-IWSS2LUA.js} +17 -17
  39. package/{exec-cache-OGX7WR5P.js → exec-cache-AG77OOEE.js} +15 -15
  40. package/{exec-local-SB7EPYED.js → exec-local-QXPWC4QG.js} +13 -14
  41. package/{help-GMCQHGVN.js → help-TGNDNWLP.js} +4 -4
  42. package/{init-KXIIWHBA.js → init-WU7BRPKR.js} +7 -8
  43. package/{install-ODTEMAMS.js → install-74XKB5N7.js} +37 -14
  44. package/{list-QS4FLJSU.js → list-TOEC6Q3A.js} +41 -29
  45. package/{login-6TGYRY43.js → login-WJYMAFSL.js} +11 -11
  46. package/{logout-GOAB7KHJ.js → logout-MTRQWI3L.js} +7 -7
  47. package/{pack-PJDH6PKP.js → pack-FFWGLSNC.js} +11 -12
  48. package/package.json +1 -1
  49. package/{ping-ANBW2IRW.js → ping-DWUVTCJB.js} +7 -7
  50. package/{pkg-GZWUXU65.js → pkg-KNZW5FIA.js} +10 -11
  51. package/{profile-BLY74CMB.js → profile-6W2ABNXL.js} +20 -7
  52. package/{publish-W2KOTNMB.js → publish-HGNUONU3.js} +33 -75
  53. package/{query-3PUMU5ON.js → query-FSCYPETX.js} +35 -23
  54. package/{registry-ONSDWNPV.js → registry-YTJZ3AQD.js} +3 -3
  55. package/registry-client-package.json +6 -1
  56. package/registry-client-src-revalidate.js +230 -39
  57. package/{repo-LZ6STH4C.js → repo-OVIKYYWA.js} +18 -18
  58. package/{reporter-SDMDYYMJ.js → reporter-ZW7OMRZT.js} +23 -1
  59. package/{run-JMIBADHE.js → run-UPV3RPQJ.js} +13 -14
  60. package/{run-exec-JEKM2O53.js → run-exec-YJSMWMMP.js} +13 -14
  61. package/{setup-BTBU3NAI.js → setup-7DPMAPUY.js} +20 -19
  62. package/{src-23VBKASP.js → src-BNCFK4FH.js} +15 -15
  63. package/{src-J4BAYOBO.js → src-XJT4IJSV.js} +11 -4
  64. package/{token-PUJ7QN6D.js → token-GA73ER5V.js} +8 -8
  65. package/{uninstall-OTISP2T7.js → uninstall-E3VKSC3B.js} +11 -11
  66. package/{unpublish-X75EEQAN.js → unpublish-Q6MQHBPQ.js} +43 -40
  67. package/{update-CKXX5POE.js → update-4CC44TR5.js} +34 -12
  68. package/{version-24B2X7M7.js → version-CRZBXNDG.js} +9 -10
  69. package/{view-Q7MAQ6R3.js → view-ILUULGSO.js} +9 -9
  70. package/vlr.js +1 -1
  71. package/vlrx.js +1 -1
  72. package/vlt.js +1 -1
  73. package/vlx.js +1 -1
  74. package/vlxl.js +1 -1
  75. package/{whoami-S6CQZFE3.js → whoami-Z4TSLYTR.js} +28 -12
  76. package/chunk-UBLFPJHV.js +0 -40
  77. package/chunk-Y3QEV76Q.js +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-5JFRXIK2.js";
14
+ } from "./chunk-2PWSMJD7.js";
15
15
  import {
16
16
  commandUsage
17
- } from "./chunk-5HPGL5WS.js";
17
+ } from "./chunk-CBASIDQH.js";
18
18
  import "./chunk-XKVU23NC.js";
19
- import "./chunk-MNK55XSE.js";
19
+ import "./chunk-CEHPRPGQ.js";
20
20
  import {
21
21
  RegistryClient
22
- } from "./chunk-NWLS3VOQ.js";
23
- import "./chunk-HAYXR3MW.js";
22
+ } from "./chunk-GJGQTRAT.js";
23
+ import "./chunk-APMYKJI2.js";
24
+ import {
25
+ assertOk
26
+ } from "./chunk-SNOBGFNM.js";
24
27
  import "./chunk-E74WGW5C.js";
25
- import "./chunk-LPIBYUMT.js";
26
- import "./chunk-UBLFPJHV.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-ZNCVQQDT.js";
17
+ } from "./chunk-TXTK2PKN.js";
18
18
  import {
19
19
  createHostContextsMap
20
- } from "./chunk-WAYVHANF.js";
20
+ } from "./chunk-6LEMBT22.js";
21
+ import "./chunk-TNEMFBP5.js";
22
+ import "./chunk-HYCYL4RX.js";
23
+ import "./chunk-G2YT2GWF.js";
24
+ import "./chunk-GDJ7JT2R.js";
21
25
  import {
22
26
  PackageInfoClient
23
- } from "./chunk-P5S2TFCF.js";
27
+ } from "./chunk-CTQSUNNE.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-FUCQ7ARR.js";
34
+ } from "./chunk-47M7IZ5P.js";
35
35
  import {
36
36
  SecurityArchive
37
- } from "./chunk-2YJ5MESP.js";
38
- import "./chunk-USTJECVS.js";
39
- import "./chunk-YOE3VZFX.js";
37
+ } from "./chunk-ZDQJWRCU.js";
40
38
  import {
41
39
  commandUsage
42
- } from "./chunk-5HPGL5WS.js";
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-MNK55XSE.js";
47
- import "./chunk-4KCU2KZL.js";
47
+ import "./chunk-CEHPRPGQ.js";
48
48
  import "./chunk-HTOTG4TS.js";
49
- import "./chunk-HAYXR3MW.js";
49
+ import "./chunk-APMYKJI2.js";
50
+ import "./chunk-SNOBGFNM.js";
50
51
  import "./chunk-E74WGW5C.js";
51
- import "./chunk-LPIBYUMT.js";
52
- import "./chunk-UBLFPJHV.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-FUCQ7ARR.js";
15
- import "./chunk-2YJ5MESP.js";
16
- import "./chunk-USTJECVS.js";
17
- import "./chunk-YOE3VZFX.js";
14
+ } from "./chunk-47M7IZ5P.js";
15
+ import "./chunk-ZDQJWRCU.js";
18
16
  import {
19
17
  commandUsage
20
- } from "./chunk-5HPGL5WS.js";
18
+ } from "./chunk-CBASIDQH.js";
19
+ import "./chunk-X2AWQGYG.js";
20
+ import "./chunk-YOE3VZFX.js";
21
21
  import "./chunk-XKVU23NC.js";
22
- import "./chunk-MNK55XSE.js";
22
+ import "./chunk-CEHPRPGQ.js";
23
23
  import "./chunk-HTOTG4TS.js";
24
24
  import "./chunk-E74WGW5C.js";
25
- import "./chunk-LPIBYUMT.js";
26
- import "./chunk-UBLFPJHV.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-VL7RJVNN.js";
19
- import "./chunk-5HBKYSTX.js";
18
+ } from "./chunk-TNEMFBP5.js";
19
+ import "./chunk-HYCYL4RX.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-YOE3VZFX.js";
23
+ import "./chunk-2PWSMJD7.js";
25
24
  import {
26
25
  commandUsage
27
- } from "./chunk-5HPGL5WS.js";
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-NWLS3VOQ.js";
38
- import "./chunk-HAYXR3MW.js";
37
+ } from "./chunk-GJGQTRAT.js";
38
+ import "./chunk-APMYKJI2.js";
39
+ import {
40
+ assertOk
41
+ } from "./chunk-SNOBGFNM.js";
39
42
  import "./chunk-E74WGW5C.js";
40
- import "./chunk-LPIBYUMT.js";
41
- import "./chunk-UBLFPJHV.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);
@@ -0,0 +1,190 @@
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
+ assertRegistryKeys,
14
+ configWriteTarget,
15
+ pairsToRecords,
16
+ registrySelectionFields,
17
+ registrySelectors
18
+ } from "./chunk-J2XWQVDK.js";
19
+ import {
20
+ normalizeRegistryURL
21
+ } from "./chunk-2PWSMJD7.js";
22
+ import {
23
+ getCommand,
24
+ isRecordField
25
+ } from "./chunk-CEHPRPGQ.js";
26
+ import {
27
+ find
28
+ } from "./chunk-HTOTG4TS.js";
29
+ import {
30
+ defaultGitHostArchives,
31
+ defaultGitHosts,
32
+ defaultJsrRegistries,
33
+ defaultRegistries,
34
+ defaultRegistryName,
35
+ isObject
36
+ } from "./chunk-VFBCWAOC.js";
37
+ import {
38
+ error
39
+ } from "./chunk-WZWDS3W4.js";
40
+
41
+ // ../../src/cli-sdk/src/persist-spec-config.ts
42
+ var specConfigFields = [
43
+ "registry",
44
+ "registries",
45
+ "default-registry-alias",
46
+ "scoped-registries",
47
+ "jsr-registries",
48
+ "git-hosts",
49
+ "git-host-archives"
50
+ ];
51
+ var builtins = {
52
+ registries: defaultRegistries,
53
+ "jsr-registries": defaultJsrRegistries,
54
+ "git-hosts": defaultGitHosts,
55
+ "git-host-archives": defaultGitHostArchives
56
+ };
57
+ var urlFields = /* @__PURE__ */ new Set([
58
+ "registry",
59
+ "registries",
60
+ "scoped-registries",
61
+ "jsr-registries"
62
+ ]);
63
+ var norm = (field, v) => urlFields.has(field) ? normalizeRegistryURL(v) : v;
64
+ var redact = (value) => {
65
+ if (!URL.canParse(value)) return value;
66
+ const url = new URL(value);
67
+ if (!url.username && !url.password) return value;
68
+ url.username = "";
69
+ url.password = "";
70
+ return url.href.replace("://", "://***@");
71
+ };
72
+ var fromLayer = (layer, field, key) => {
73
+ const v = layer?.[field];
74
+ const r = key === void 0 ? v : v && typeof v === "object" ? v[key] : void 0;
75
+ return typeof r === "string" ? r : void 0;
76
+ };
77
+ var isNulled = (layer, field, key) => {
78
+ const v = layer?.[field];
79
+ return key === void 0 ? v === null : isObject(v) && v[key] === null;
80
+ };
81
+ var conflictError = (field, key, current, wanted, file, block) => {
82
+ const name = (block ? `command.${block}.` : "") + (key === void 0 ? field : `${field}.${key}`);
83
+ const cur = redact(current);
84
+ const flag = key === void 0 ? `--${field}=${cur}` : `--${field} ${key}=${cur}`;
85
+ return error(
86
+ [
87
+ `${name} is already set to ${cur} in ${file}.`,
88
+ "",
89
+ `Pass \`${flag}\`${key === void 0 ? "" : ", use another name,"} or run`,
90
+ block ? "`vlt config edit` to change it first." : `\`vlt config set ${name}=${redact(wanted)}\` first.`
91
+ ].join("\n"),
92
+ { code: "ECONFIG", found: wanted, wanted: current }
93
+ );
94
+ };
95
+ var ownsSelection = (layer) => registrySelectionFields.some((f) => f in (layer ?? {}));
96
+ var planSpecConfigPersist = (conf) => {
97
+ if (!conf.get("save-config")) return void 0;
98
+ const explicit = pairsToRecords(conf.explicit);
99
+ if (!specConfigFields.some((f) => f in explicit)) return void 0;
100
+ const which = configWriteTarget(conf, "project");
101
+ const target = conf.layers[which];
102
+ const other = conf.layers[which === "project" ? "user" : "project"];
103
+ const otherSelectors = which === "user" || !ownsSelection(target);
104
+ const blocks = target?.command ?? {};
105
+ const blockName = Object.keys(blocks).filter((n) => getCommand(n) === conf.command).at(-1);
106
+ const block = blockName ? blocks[blockName] : void 0;
107
+ const staged = {};
108
+ for (const field of specConfigFields) {
109
+ const v = explicit[field];
110
+ if (v === void 0) continue;
111
+ const entries2 = isRecordField(field) ? Object.entries(v) : [[void 0, v]];
112
+ for (const [key, raw] of entries2) {
113
+ if (key === "") {
114
+ throw error(`${field} has an entry with no name.`, {
115
+ code: "ECONFIG",
116
+ found: `=${raw}`,
117
+ wanted: `<name>=${raw}`
118
+ });
119
+ }
120
+ if (key !== void 0 && field === "registries") {
121
+ assertRegistryKeys({ [key]: raw }, `--${field}`);
122
+ }
123
+ if (key !== void 0 && !raw) {
124
+ throw error(`${field}.${key} has no value.`, {
125
+ code: "ECONFIG",
126
+ found: key,
127
+ wanted: `${key}=<value>`
128
+ });
129
+ }
130
+ if (!raw) continue;
131
+ const value = norm(field, raw);
132
+ const inBlock = fromLayer(block, field, key);
133
+ if (inBlock !== void 0) {
134
+ if (norm(field, inBlock) === value) continue;
135
+ throw conflictError(
136
+ field,
137
+ key,
138
+ inBlock,
139
+ value,
140
+ find(which),
141
+ blockName
142
+ );
143
+ }
144
+ const toBlock = key !== void 0 && isObject(block?.[field]) ? blockName : void 0;
145
+ const current = toBlock === void 0 ? fromLayer(target, field, key) : void 0;
146
+ if (current !== void 0) {
147
+ if (norm(field, current) === value) continue;
148
+ throw conflictError(field, key, current, value, find(which));
149
+ }
150
+ const inOther = toBlock !== void 0 || isNulled(target, field, key) || key === void 0 && !otherSelectors ? void 0 : fromLayer(other, field, key);
151
+ const builtin = key !== void 0 ? builtins[field]?.[key] : field === "default-registry-alias" ? defaultRegistryName : void 0;
152
+ const inEffect = inOther ?? builtin;
153
+ if (inEffect !== void 0 && norm(field, inEffect) === value) {
154
+ continue;
155
+ }
156
+ let dest = staged;
157
+ if (toBlock !== void 0) {
158
+ const cmds = staged.command ??= {};
159
+ dest = cmds[toBlock] ??= {};
160
+ }
161
+ if (key === void 0) dest[field] = value;
162
+ else {
163
+ const rec = dest[field] ??= {};
164
+ rec[key] = value;
165
+ }
166
+ }
167
+ }
168
+ if (!Object.keys(staged).length) return void 0;
169
+ const { user } = conf.layers;
170
+ if (which === "project" && ownsSelection(staged) && !ownsSelection(target)) {
171
+ for (const f of registrySelectors) {
172
+ const v = fromLayer(user, f);
173
+ if (v !== void 0 && !(f in staged)) staged[f] = v;
174
+ }
175
+ const alias = staged["default-registry-alias"];
176
+ const url = alias && fromLayer(user, "registries", alias);
177
+ const regs = staged.registries ?? {};
178
+ if (url && !(alias in regs)) {
179
+ staged.registries = { ...regs, [alias]: url };
180
+ }
181
+ }
182
+ return { which, values: staged };
183
+ };
184
+ var entries = (path, v) => isObject(v) ? Object.entries(v).flatMap(([k, x]) => entries(`${path}.${k}`, x)) : [`${path}=${redact(String(v))}`];
185
+ var persistedEntries = (values) => Object.entries(values).flatMap(([f, v]) => entries(f, v));
186
+
187
+ export {
188
+ planSpecConfigPersist,
189
+ persistedEntries
190
+ };
@@ -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,
@@ -13,14 +13,14 @@ import {
13
13
  AbortError,
14
14
  SecurityArchive,
15
15
  pRetry
16
- } from "./chunk-2YJ5MESP.js";
16
+ } from "./chunk-ZDQJWRCU.js";
17
17
  import {
18
18
  Monorepo,
19
19
  PackageJson,
20
20
  getUser,
21
21
  minimatch,
22
22
  platformCheck
23
- } from "./chunk-USTJECVS.js";
23
+ } from "./chunk-X2AWQGYG.js";
24
24
  import {
25
25
  asDepID,
26
26
  baseDepID,
@@ -44,11 +44,9 @@ import {
44
44
  walkUp
45
45
  } from "./chunk-HTOTG4TS.js";
46
46
  import {
47
+ graphStep,
47
48
  promiseSpawn
48
- } from "./chunk-LPIBYUMT.js";
49
- import {
50
- graphStep
51
- } from "./chunk-UBLFPJHV.js";
49
+ } from "./chunk-U7TEQCBN.js";
52
50
  import {
53
51
  Spec,
54
52
  Version,
@@ -5388,7 +5386,7 @@ var runImpl = async (options, execImpl, empty2) => {
5388
5386
  ...execArgs
5389
5387
  } = options;
5390
5388
  const pjPath = resolve2(options.cwd, "package.json");
5391
- const untrustworthy = !!(manifest?.gypfile && arg0 === "install" && manifest.scripts?.install === "node-gyp rebuild");
5389
+ const untrustworthy = !!manifest && (manifest.gypfile === true && arg0 === "install" && manifest.scripts?.install === "node-gyp rebuild" || manifest.hasInstallScript === true && !manifest.scripts);
5392
5390
  const pj = (untrustworthy ? void 0 : manifest) ?? packageJson.read(options.cwd);
5393
5391
  const { scripts: scripts2 } = pj;
5394
5392
  const command = scripts2?.[arg0] ?? // npm's implicit install behavior: "If there is a binding.gyp file in the
@@ -7479,6 +7477,7 @@ var score = async (state) => {
7479
7477
  var nodeNeedsBuild = (node) => {
7480
7478
  const { manifest } = node;
7481
7479
  if (!manifest) return false;
7480
+ if (manifest.hasInstallScript) return true;
7482
7481
  const { scripts: scripts2 = {} } = manifest;
7483
7482
  const runInstall = !!(scripts2.install || scripts2.preinstall || scripts2.postinstall);
7484
7483
  if (runInstall) return true;
@@ -10485,7 +10484,7 @@ var load4 = (options) => {
10485
10484
  );
10486
10485
  }
10487
10486
  modifiers?.rollbackActiveEntries();
10488
- if (scurry.cwd.resolve("node_modules").lstatSync()?.isDirectory()) {
10487
+ if (scurry.cwd.resolve("node_modules/.vlt").lstatSync()?.isDirectory()) {
10489
10488
  saveHidden({
10490
10489
  ...options,
10491
10490
  graph
@@ -10569,6 +10568,9 @@ var makeExecutable = async (path2) => {
10569
10568
  await chmod2(path2, execMode);
10570
10569
  };
10571
10570
 
10571
+ // ../../src/graph/src/reify/scripts-manifest.ts
10572
+ var scriptsManifest = (manifest, dir, packageJson) => manifest.hasInstallScript && !manifest.scripts ? packageJson.read(dir) : manifest;
10573
+
10572
10574
  // ../../src/graph/src/reify/build.ts
10573
10575
  var build = async (diff2, packageJson, scurry, allowScriptsNodes) => {
10574
10576
  const graph = diff2.to;
@@ -10608,8 +10610,9 @@ var build = async (diff2, packageJson, scurry, allowScriptsNodes) => {
10608
10610
  return res;
10609
10611
  };
10610
10612
  var visit = async (packageJson, scurry, node, signal, _path) => {
10611
- node.manifest ??= packageJson.read(node.resolvedLocation(scurry));
10612
- const { manifest } = node;
10613
+ const dir = node.resolvedLocation(scurry);
10614
+ node.manifest ??= packageJson.read(dir);
10615
+ const manifest = scriptsManifest(node.manifest, dir, packageJson);
10613
10616
  const { scripts: scripts2 = {} } = manifest;
10614
10617
  const {
10615
10618
  install: install2,
@@ -10832,10 +10835,12 @@ var build2 = async (options) => {
10832
10835
  scurry,
10833
10836
  targetFilteredNodes
10834
10837
  );
10835
- saveHidden({
10836
- ...options,
10837
- graph: actualGraph
10838
- });
10838
+ if (scurry.lstatSync(scurry.resolve(projectRoot, "node_modules/.vlt"))?.isDirectory()) {
10839
+ saveHidden({
10840
+ ...options,
10841
+ graph: actualGraph
10842
+ });
10843
+ }
10839
10844
  return buildResult;
10840
10845
  };
10841
10846
 
@@ -14455,14 +14460,13 @@ var deleteEdges = (diff2, scurry, remover) => {
14455
14460
  import { join as join3 } from "node:path";
14456
14461
  var nodeNeedsBuild2 = (node, scurry, packageJson) => {
14457
14462
  if (node.built) return false;
14458
- let manifest = node.manifest;
14459
- if (!manifest) {
14460
- try {
14461
- manifest = packageJson.read(node.resolvedLocation(scurry));
14462
- node.manifest = manifest;
14463
- } catch {
14464
- return false;
14465
- }
14463
+ let manifest;
14464
+ try {
14465
+ const dir = node.resolvedLocation(scurry);
14466
+ node.manifest ??= packageJson.read(dir);
14467
+ manifest = scriptsManifest(node.manifest, dir, packageJson);
14468
+ } catch {
14469
+ return false;
14466
14470
  }
14467
14471
  const { scripts: scripts2 = {} } = manifest;
14468
14472
  const runInstall = !!(scripts2.install || scripts2.preinstall || scripts2.postinstall);