@vltpkg/cli-sdk 1.0.0-rc.3 → 1.0.0-rc.31

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 (210) hide show
  1. package/dist/commands/access.d.ts +22 -0
  2. package/dist/commands/access.js +246 -0
  3. package/dist/commands/bugs.d.ts +17 -0
  4. package/dist/commands/bugs.js +163 -0
  5. package/dist/{esm/commands → commands}/build.d.ts +0 -1
  6. package/dist/{esm/commands → commands}/build.js +0 -1
  7. package/dist/{esm/commands → commands}/cache.d.ts +0 -1
  8. package/dist/{esm/commands → commands}/cache.js +0 -1
  9. package/dist/{esm/commands → commands}/ci.d.ts +0 -1
  10. package/dist/{esm/commands → commands}/ci.js +11 -3
  11. package/dist/{esm/commands → commands}/config.d.ts +0 -1
  12. package/dist/{esm/commands → commands}/config.js +6 -1
  13. package/dist/commands/create.d.ts +8 -0
  14. package/dist/commands/create.js +102 -0
  15. package/dist/commands/deprecate.d.ts +13 -0
  16. package/dist/commands/deprecate.js +139 -0
  17. package/dist/commands/dist-tag.d.ts +21 -0
  18. package/dist/commands/dist-tag.js +177 -0
  19. package/dist/{esm/commands → commands}/docs.d.ts +0 -1
  20. package/dist/{esm/commands → commands}/docs.js +2 -3
  21. package/dist/{esm/commands → commands}/exec-cache.d.ts +0 -1
  22. package/dist/{esm/commands → commands}/exec-cache.js +0 -1
  23. package/dist/{esm/commands → commands}/exec-local.d.ts +0 -1
  24. package/dist/{esm/commands → commands}/exec-local.js +23 -1
  25. package/dist/{esm/commands → commands}/exec.d.ts +0 -1
  26. package/dist/{esm/commands → commands}/exec.js +84 -10
  27. package/dist/{esm/commands → commands}/help.d.ts +0 -1
  28. package/dist/{esm/commands → commands}/help.js +5 -1
  29. package/dist/{esm/commands → commands}/init.d.ts +0 -1
  30. package/dist/{esm/commands → commands}/init.js +31 -10
  31. package/dist/{esm/commands → commands}/install/reporter.d.ts +0 -1
  32. package/dist/{esm/commands → commands}/install/reporter.js +0 -1
  33. package/dist/{esm/commands → commands}/install.d.ts +21 -3
  34. package/dist/commands/install.js +140 -0
  35. package/dist/{esm/commands → commands}/list.d.ts +4 -2
  36. package/dist/{esm/commands → commands}/list.js +8 -10
  37. package/dist/{esm/commands → commands}/login.d.ts +0 -1
  38. package/dist/{esm/commands → commands}/login.js +10 -1
  39. package/dist/{esm/commands/token.d.ts → commands/logout.d.ts} +0 -1
  40. package/dist/{esm/commands → commands}/logout.js +10 -1
  41. package/dist/{esm/commands → commands}/pack.d.ts +0 -1
  42. package/dist/{esm/commands → commands}/pack.js +90 -32
  43. package/dist/commands/ping.d.ts +17 -0
  44. package/dist/commands/ping.js +114 -0
  45. package/dist/{esm/commands → commands}/pkg.d.ts +0 -1
  46. package/dist/{esm/commands → commands}/pkg.js +27 -1
  47. package/dist/commands/profile.d.ts +13 -0
  48. package/dist/commands/profile.js +104 -0
  49. package/dist/{esm/commands → commands}/publish.d.ts +1 -2
  50. package/dist/{esm/commands → commands}/publish.js +63 -12
  51. package/dist/{esm/commands → commands}/query.d.ts +4 -2
  52. package/dist/{esm/commands → commands}/query.js +12 -10
  53. package/dist/commands/repo.d.ts +17 -0
  54. package/dist/commands/repo.js +157 -0
  55. package/dist/{esm/commands → commands}/run-exec.d.ts +0 -1
  56. package/dist/commands/run-exec.js +40 -0
  57. package/dist/{esm/commands → commands}/run.d.ts +0 -1
  58. package/dist/{esm/commands → commands}/run.js +27 -1
  59. package/dist/commands/token.d.ts +31 -0
  60. package/dist/commands/token.js +186 -0
  61. package/dist/{esm/commands → commands}/uninstall.d.ts +0 -1
  62. package/dist/{esm/commands → commands}/uninstall.js +16 -3
  63. package/dist/commands/unpublish.d.ts +15 -0
  64. package/dist/commands/unpublish.js +200 -0
  65. package/dist/{esm/commands → commands}/update.d.ts +0 -1
  66. package/dist/{esm/commands → commands}/update.js +6 -1
  67. package/dist/{esm/commands → commands}/version.d.ts +0 -1
  68. package/dist/{esm/commands → commands}/version.js +27 -1
  69. package/dist/commands/view.d.ts +22 -0
  70. package/dist/commands/view.js +334 -0
  71. package/dist/{esm/commands → commands}/whoami.d.ts +0 -1
  72. package/dist/{esm/commands → commands}/whoami.js +10 -1
  73. package/dist/{esm/config → config}/definition.d.ts +39 -19
  74. package/dist/{esm/config → config}/definition.js +74 -39
  75. package/dist/{esm/config → config}/index.d.ts +0 -1
  76. package/dist/{esm/config → config}/index.js +37 -2
  77. package/dist/{esm/config → config}/merge.d.ts +0 -1
  78. package/dist/{esm/config → config}/merge.js +0 -1
  79. package/dist/{esm/config → config}/usage.d.ts +0 -1
  80. package/dist/{esm/config → config}/usage.js +0 -1
  81. package/dist/{esm/custom-help.d.ts → custom-help.d.ts} +0 -1
  82. package/dist/{esm/custom-help.js → custom-help.js} +35 -9
  83. package/dist/{esm/exec-command.d.ts → exec-command.d.ts} +0 -1
  84. package/dist/{esm/exec-command.js → exec-command.js} +14 -8
  85. package/dist/{esm/index.d.ts → index.d.ts} +0 -1
  86. package/dist/{esm/index.js → index.js} +1 -2
  87. package/dist/{esm/load-command.d.ts → load-command.d.ts} +0 -1
  88. package/dist/{esm/load-command.js → load-command.js} +0 -1
  89. package/dist/mermaid-image-view.d.ts +18 -0
  90. package/dist/mermaid-image-view.js +36 -0
  91. package/dist/{esm/output.d.ts → output.d.ts} +2 -2
  92. package/dist/{esm/output.js → output.js} +55 -2
  93. package/dist/{esm/pack-tarball.d.ts → pack-tarball.d.ts} +15 -1
  94. package/dist/{esm/pack-tarball.js → pack-tarball.js} +133 -91
  95. package/dist/{esm/parse-add-remove-args.d.ts → parse-add-remove-args.d.ts} +9 -3
  96. package/dist/{esm/parse-add-remove-args.js → parse-add-remove-args.js} +43 -11
  97. package/dist/{esm/print-err.d.ts → print-err.d.ts} +0 -1
  98. package/dist/{esm/print-err.js → print-err.js} +18 -3
  99. package/dist/query-diff-files.d.ts +17 -0
  100. package/dist/query-diff-files.js +63 -0
  101. package/dist/{esm/query-host-contexts.d.ts → query-host-contexts.d.ts} +0 -1
  102. package/dist/{esm/query-host-contexts.js → query-host-contexts.js} +8 -7
  103. package/dist/{esm/read-password.d.ts → read-password.d.ts} +0 -1
  104. package/dist/{esm/read-password.js → read-password.js} +0 -1
  105. package/dist/read-project-folders.d.ts +17 -0
  106. package/dist/read-project-folders.js +100 -0
  107. package/dist/reload-config.d.ts +2 -0
  108. package/dist/reload-config.js +11 -0
  109. package/dist/render-mermaid.d.ts +22 -0
  110. package/dist/render-mermaid.js +68 -0
  111. package/dist/telemetry.d.ts +58 -0
  112. package/dist/telemetry.js +170 -0
  113. package/dist/{esm/view.d.ts → view.d.ts} +0 -1
  114. package/dist/{esm/view.js → view.js} +1 -2
  115. package/package.json +69 -83
  116. package/dist/esm/commands/build.d.ts.map +0 -1
  117. package/dist/esm/commands/build.js.map +0 -1
  118. package/dist/esm/commands/cache.d.ts.map +0 -1
  119. package/dist/esm/commands/cache.js.map +0 -1
  120. package/dist/esm/commands/ci.d.ts.map +0 -1
  121. package/dist/esm/commands/ci.js.map +0 -1
  122. package/dist/esm/commands/config.d.ts.map +0 -1
  123. package/dist/esm/commands/config.js.map +0 -1
  124. package/dist/esm/commands/docs.d.ts.map +0 -1
  125. package/dist/esm/commands/docs.js.map +0 -1
  126. package/dist/esm/commands/exec-cache.d.ts.map +0 -1
  127. package/dist/esm/commands/exec-cache.js.map +0 -1
  128. package/dist/esm/commands/exec-local.d.ts.map +0 -1
  129. package/dist/esm/commands/exec-local.js.map +0 -1
  130. package/dist/esm/commands/exec.d.ts.map +0 -1
  131. package/dist/esm/commands/exec.js.map +0 -1
  132. package/dist/esm/commands/help.d.ts.map +0 -1
  133. package/dist/esm/commands/help.js.map +0 -1
  134. package/dist/esm/commands/init.d.ts.map +0 -1
  135. package/dist/esm/commands/init.js.map +0 -1
  136. package/dist/esm/commands/install/reporter.d.ts.map +0 -1
  137. package/dist/esm/commands/install/reporter.js.map +0 -1
  138. package/dist/esm/commands/install.d.ts.map +0 -1
  139. package/dist/esm/commands/install.js +0 -45
  140. package/dist/esm/commands/install.js.map +0 -1
  141. package/dist/esm/commands/list.d.ts.map +0 -1
  142. package/dist/esm/commands/list.js.map +0 -1
  143. package/dist/esm/commands/login.d.ts.map +0 -1
  144. package/dist/esm/commands/login.js.map +0 -1
  145. package/dist/esm/commands/logout.d.ts +0 -4
  146. package/dist/esm/commands/logout.d.ts.map +0 -1
  147. package/dist/esm/commands/logout.js.map +0 -1
  148. package/dist/esm/commands/pack.d.ts.map +0 -1
  149. package/dist/esm/commands/pack.js.map +0 -1
  150. package/dist/esm/commands/pkg.d.ts.map +0 -1
  151. package/dist/esm/commands/pkg.js.map +0 -1
  152. package/dist/esm/commands/publish.d.ts.map +0 -1
  153. package/dist/esm/commands/publish.js.map +0 -1
  154. package/dist/esm/commands/query.d.ts.map +0 -1
  155. package/dist/esm/commands/query.js.map +0 -1
  156. package/dist/esm/commands/run-exec.d.ts.map +0 -1
  157. package/dist/esm/commands/run-exec.js +0 -14
  158. package/dist/esm/commands/run-exec.js.map +0 -1
  159. package/dist/esm/commands/run.d.ts.map +0 -1
  160. package/dist/esm/commands/run.js.map +0 -1
  161. package/dist/esm/commands/serve.d.ts +0 -14
  162. package/dist/esm/commands/serve.d.ts.map +0 -1
  163. package/dist/esm/commands/serve.js +0 -103
  164. package/dist/esm/commands/serve.js.map +0 -1
  165. package/dist/esm/commands/token.d.ts.map +0 -1
  166. package/dist/esm/commands/token.js +0 -30
  167. package/dist/esm/commands/token.js.map +0 -1
  168. package/dist/esm/commands/uninstall.d.ts.map +0 -1
  169. package/dist/esm/commands/uninstall.js.map +0 -1
  170. package/dist/esm/commands/update.d.ts.map +0 -1
  171. package/dist/esm/commands/update.js.map +0 -1
  172. package/dist/esm/commands/version.d.ts.map +0 -1
  173. package/dist/esm/commands/version.js.map +0 -1
  174. package/dist/esm/commands/whoami.d.ts.map +0 -1
  175. package/dist/esm/commands/whoami.js.map +0 -1
  176. package/dist/esm/config/definition.d.ts.map +0 -1
  177. package/dist/esm/config/definition.js.map +0 -1
  178. package/dist/esm/config/index.d.ts.map +0 -1
  179. package/dist/esm/config/index.js.map +0 -1
  180. package/dist/esm/config/merge.d.ts.map +0 -1
  181. package/dist/esm/config/merge.js.map +0 -1
  182. package/dist/esm/config/usage.d.ts.map +0 -1
  183. package/dist/esm/config/usage.js.map +0 -1
  184. package/dist/esm/custom-help.d.ts.map +0 -1
  185. package/dist/esm/custom-help.js.map +0 -1
  186. package/dist/esm/exec-command.d.ts.map +0 -1
  187. package/dist/esm/exec-command.js.map +0 -1
  188. package/dist/esm/index.d.ts.map +0 -1
  189. package/dist/esm/index.js.map +0 -1
  190. package/dist/esm/load-command.d.ts.map +0 -1
  191. package/dist/esm/load-command.js.map +0 -1
  192. package/dist/esm/output.d.ts.map +0 -1
  193. package/dist/esm/output.js.map +0 -1
  194. package/dist/esm/pack-tarball.d.ts.map +0 -1
  195. package/dist/esm/pack-tarball.js.map +0 -1
  196. package/dist/esm/package.json +0 -3
  197. package/dist/esm/parse-add-remove-args.d.ts.map +0 -1
  198. package/dist/esm/parse-add-remove-args.js.map +0 -1
  199. package/dist/esm/print-err.d.ts.map +0 -1
  200. package/dist/esm/print-err.js.map +0 -1
  201. package/dist/esm/query-host-contexts.d.ts.map +0 -1
  202. package/dist/esm/query-host-contexts.js.map +0 -1
  203. package/dist/esm/read-password.d.ts.map +0 -1
  204. package/dist/esm/read-password.js.map +0 -1
  205. package/dist/esm/start-gui.d.ts +0 -10
  206. package/dist/esm/start-gui.d.ts.map +0 -1
  207. package/dist/esm/start-gui.js +0 -60
  208. package/dist/esm/start-gui.js.map +0 -1
  209. package/dist/esm/view.d.ts.map +0 -1
  210. package/dist/esm/view.js.map +0 -1
@@ -15,10 +15,15 @@ export const defaultEditor = () => process.env.EDITOR ||
15
15
  `${process.env.SYSTEMROOT}\\notepad.exe`
16
16
  : 'vi');
17
17
  const canonicalCommands = {
18
+ access: 'access',
19
+ bugs: 'bugs',
18
20
  build: 'build',
19
21
  cache: 'cache',
20
22
  ci: 'ci',
21
23
  config: 'config',
24
+ create: 'create',
25
+ deprecate: 'deprecate',
26
+ 'dist-tag': 'dist-tag',
22
27
  docs: 'docs',
23
28
  exec: 'exec',
24
29
  'exec-local': 'exec-local',
@@ -30,17 +35,21 @@ const canonicalCommands = {
30
35
  list: 'list',
31
36
  ls: 'ls',
32
37
  pack: 'pack',
38
+ ping: 'ping',
33
39
  pkg: 'pkg',
40
+ profile: 'profile',
34
41
  publish: 'publish',
35
42
  query: 'query',
43
+ repo: 'repo',
36
44
  'run-exec': 'run-exec',
37
45
  run: 'run',
38
- serve: 'serve',
39
46
  token: 'token',
40
47
  uninstall: 'uninstall',
48
+ unpublish: 'unpublish',
41
49
  update: 'update',
42
50
  'exec-cache': 'exec-cache',
43
51
  version: 'version',
52
+ view: 'view',
44
53
  whoami: 'whoami',
45
54
  };
46
55
  const aliases = {
@@ -55,12 +64,13 @@ const aliases = {
55
64
  r: 'run',
56
65
  'run-script': 'run',
57
66
  rx: 'run-exec',
58
- s: 'serve',
59
67
  x: 'exec',
60
68
  xl: 'exec-local',
61
69
  h: 'help',
62
70
  '?': 'help',
71
+ info: 'view',
63
72
  ls: 'list',
73
+ show: 'view',
64
74
  xc: 'exec-cache',
65
75
  };
66
76
  /**
@@ -93,34 +103,21 @@ export const recordFields = [
93
103
  'git-hosts',
94
104
  'registries',
95
105
  'git-host-archives',
96
- 'scope-registries',
106
+ 'scoped-registries',
97
107
  'jsr-registries',
98
108
  ];
99
109
  export const isRecordField = (s) => recordFields.includes(s);
100
- const stopParsingCommands = [
101
- 'run',
102
- 'run-exec',
103
- 'exec-local',
104
- 'exec',
105
- ];
106
- let stopParsing = undefined;
107
110
  const j = jack({
108
111
  envPrefix: 'VLT',
109
112
  allowPositionals: true,
110
113
  usage: `vlt [<options>] [<cmd> [<args> ...]]`,
111
- stopAtPositionalTest: arg => {
112
- if (stopParsing)
113
- return true;
114
- const a = arg;
115
- // we stop parsing AFTER the thing, so you can do
116
- // vlt run --vlt --configs scriptName --args --for --script
117
- // or
118
- // vlt exec --vlt --configs command --args --for --command
119
- if (stopParsingCommands.includes(commands[a])) {
120
- stopParsing = true;
121
- }
122
- return false;
123
- },
114
+ // vlt options can appear on either side of the command/script
115
+ // name. To forward an argument (especially a flag-like one) to
116
+ // the underlying bin/script without vlt interpreting it, place
117
+ // it after a `--` terminator, e.g.:
118
+ // vlt run scriptName --vlt-flag -- --script-flag --more
119
+ // Node's `parseArgs` natively treats everything following `--`
120
+ // as positional, so no special-casing is needed here.
124
121
  })
125
122
  .heading('vlt')
126
123
  .description(`More documentation available at <https://docs.vlt.sh>`)
@@ -190,12 +187,12 @@ export const definition = j
190
187
  mapping in most cases.
191
188
  `,
192
189
  },
193
- 'scope-registries': {
190
+ 'scoped-registries': {
194
191
  hint: '@scope=url',
195
192
  description: `Map package name scopes to registry URLs.
196
193
 
197
194
  For example,
198
- \`--scope-registries @acme=https://registry.acme/\`
195
+ \`--scoped-registries @acme=https://registry.acme/\`
199
196
  would tell vlt to fetch any packages named
200
197
  \`@acme/...\` from the \`https://registry.acme/\`
201
198
  registry.
@@ -288,6 +285,11 @@ export const definition = j
288
285
  packages based on their \`cpu\` value.`,
289
286
  default: process.arch,
290
287
  },
288
+ libc: {
289
+ description: `Override the libc family to use as the selector when choosing
290
+ packages based on their \`libc\` value (e.g. glibc, musl).
291
+ By default, this is auto-detected on Linux systems.`,
292
+ },
291
293
  'node-version': {
292
294
  hint: 'version',
293
295
  description: `Node version to use when choosing packages based on
@@ -380,7 +382,6 @@ export const definition = j
380
382
  supported.`,
381
383
  },
382
384
  'workspace-group': {
383
- short: 'g',
384
385
  description: `Specify named workspace group names to load and operate on
385
386
  when doing recursive operations on workspaces.`,
386
387
  },
@@ -492,6 +493,28 @@ export const definition = j
492
493
  vlt will interpret the first argument as the package, and
493
494
  attempt to run the default executable.`,
494
495
  },
496
+ })
497
+ .opt({
498
+ call: {
499
+ hint: 'cmd',
500
+ description: `When running \`vlt exec\`, provide an arbitrary command
501
+ string to execute after installing and adding any specified
502
+ package bins to the PATH.
503
+
504
+ If a package is specified (via positionals or
505
+ \`--package\`), it will be installed and its executables
506
+ added to the PATH before the \`--call\` command runs.
507
+
508
+ The command string is executed via the configured
509
+ \`script-shell\`, or the \`SHELL\` environment variable,
510
+ falling back to \`/bin/sh\` on Unix or \`cmd.exe\` on
511
+ Windows. On Unix, the shell is invoked with \`-c\`; on
512
+ Windows with \`/c\`.
513
+
514
+ Example:
515
+ \`vlt exec create-react-app --call="echo $PWD"\`
516
+ \`vlt exec --call="echo $PWD" --scope=":workspace"\``,
517
+ },
495
518
  })
496
519
  .opt({
497
520
  view: {
@@ -506,11 +529,14 @@ export const definition = j
506
529
  consumption.
507
530
  - json: Parseable JSON output for machines.
508
531
  - inspect: Output results with \`util.inspect\`.
509
- - gui: Start a local web server and opens a browser to
510
- explore the results. (Only relevant for certain
511
- commands.)
512
532
  - mermaid: Output mermaid diagramming syntax. (Only
513
533
  relevant for certain commands.)
534
+ - svg: Render the dependency graph as an SVG image and
535
+ open it. (Only relevant for certain commands.)
536
+ - png: Render the dependency graph as a PNG image and
537
+ open it. (Only relevant for certain commands.)
538
+ - count: Output the number of dependency relationships in
539
+ the result set.
514
540
  - silent: Suppress all output to stdout.
515
541
 
516
542
  If the requested view format is not supported for the
@@ -521,7 +547,9 @@ export const definition = j
521
547
  'human',
522
548
  'json',
523
549
  'mermaid',
524
- 'gui',
550
+ 'svg',
551
+ 'png',
552
+ 'count',
525
553
  'inspect',
526
554
  'silent',
527
555
  ],
@@ -575,6 +603,10 @@ export const definition = j
575
603
  'dry-run': {
576
604
  description: 'Run command without making any changes',
577
605
  },
606
+ force: {
607
+ short: 'f',
608
+ description: 'Force potentially dangerous operations, such as unpublishing an entire package.',
609
+ },
578
610
  'expect-lockfile': {
579
611
  description: 'Fail if lockfile is missing or out of date. Used by ci command to enforce lockfile integrity.',
580
612
  },
@@ -602,7 +634,6 @@ export const definition = j
602
634
  access: {
603
635
  description: 'Set the access level of the package',
604
636
  validOptions: ['public', 'restricted'],
605
- default: 'public',
606
637
  },
607
638
  })
608
639
  .opt({
@@ -614,13 +645,18 @@ export const definition = j
614
645
  description: `Directory to use for pack and publish operations instead of the current directory.
615
646
  The directory must exist and nothing will be copied to it.`,
616
647
  },
617
- port: {
618
- hint: 'number',
619
- description: `Port for the browser-based UI server when using vlt serve command (default: 8000).`,
620
- },
621
- 'registry-port': {
622
- hint: 'number',
623
- description: `Port for the VSR registry when using vlt serve command (default: 1337).`,
648
+ })
649
+ .flag({
650
+ telemetry: {
651
+ description: `Enable anonymous usage telemetry.
652
+
653
+ vlt collects anonymized usage data to help improve
654
+ the tool. No personally identifiable information is
655
+ ever sent.
656
+
657
+ Set \`--no-telemetry\` or \`VLT_TELEMETRY=0\` or
658
+ \`DO_NOT_TRACK=1\` to opt out.`,
659
+ default: true,
624
660
  },
625
661
  })
626
662
  .flag({
@@ -654,4 +690,3 @@ export const getSortedCliOptions = () => {
654
690
  });
655
691
  };
656
692
  export const getSortedKeys = () => Object.keys(definition.toJSON()).sort((a, b) => a.localeCompare(b));
657
- //# sourceMappingURL=definition.js.map
@@ -216,4 +216,3 @@ export type ParsedConfig = Config & {
216
216
  * A fully loaded {@link Config} object
217
217
  */
218
218
  export type LoadedConfig = ParsedConfig;
219
- //# sourceMappingURL=index.d.ts.map
@@ -24,6 +24,7 @@ import { error } from '@vltpkg/error-cause';
24
24
  import { PackageInfoClient } from '@vltpkg/package-info';
25
25
  import { PackageJson } from '@vltpkg/package-json';
26
26
  import { resetCaches } from '@vltpkg/dep-id';
27
+ import { getOptions } from '@vltpkg/spec';
27
28
  import { assertRecordStringString, assertRecordStringT, isRecordStringString, } from '@vltpkg/types';
28
29
  import { find, load, reload, save } from '@vltpkg/vlt-json';
29
30
  import { Monorepo } from '@vltpkg/workspaces';
@@ -128,6 +129,10 @@ export class Config {
128
129
  catalogs: load('catalogs', o => assertRecordStringT(o, isRecordStringString, 'Record<string, Record<string, string>>')),
129
130
  };
130
131
  const options = Object.assign(asRecords, extras);
132
+ // Ensure spec-related options (registries, jsr-registries, git hosts, etc.)
133
+ // are always filled with defaults. Some downstream libraries (eg. @vltpkg/dep-id)
134
+ // expect these defaults to be present even when the user didn't configure them.
135
+ Object.assign(options, getOptions(options));
131
136
  this.#options = Object.assign(options, {
132
137
  packageInfo: new PackageInfoClient(options),
133
138
  [kCustomInspect]() {
@@ -226,6 +231,7 @@ export class Config {
226
231
  * If the config value is not set at all, an empty object is returned.
227
232
  */
228
233
  getRecord(k) {
234
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
229
235
  const pairs = this.get(k);
230
236
  if (!pairs)
231
237
  return {};
@@ -281,10 +287,40 @@ export class Config {
281
287
  });
282
288
  }
283
289
  const { command, ...values } = recordsToPairs(c);
290
+ // Validate registries keys don't contain reserved ~ character
291
+ const registries = c.registries;
292
+ if (registries && typeof registries === 'object') {
293
+ const registriesObj = Array.isArray(registries) ?
294
+ reducePairs(registries)
295
+ : registries;
296
+ for (const key of Object.keys(registriesObj)) {
297
+ if (key === '' || key.includes('~')) {
298
+ throw error('Reserved character found in registries name', {
299
+ path: file,
300
+ found: key,
301
+ });
302
+ }
303
+ }
304
+ }
284
305
  if (command) {
285
306
  for (const [c, opts] of Object.entries(command)) {
286
307
  const cmd = getCommand(c);
287
- if (cmd) {
308
+ if (cmd && opts && typeof opts === 'object') {
309
+ // Validate registries in command-specific config
310
+ const cmdRegistries = opts.registries;
311
+ if (cmdRegistries && typeof cmdRegistries === 'object') {
312
+ const cmdRegistriesObj = Array.isArray(cmdRegistries) ?
313
+ reducePairs(cmdRegistries)
314
+ : cmdRegistries;
315
+ for (const key of Object.keys(cmdRegistriesObj)) {
316
+ if (key === '' || key.includes('~')) {
317
+ throw error('Reserved character found in registries name', {
318
+ path: file,
319
+ found: key,
320
+ });
321
+ }
322
+ }
323
+ }
288
324
  this.commandValues[cmd] = merge(this.commandValues[cmd] ?? {}, opts);
289
325
  }
290
326
  }
@@ -451,4 +487,3 @@ export class Config {
451
487
  }
452
488
  }
453
489
  const isParsed = (c) => !!(c.values && c.positionals && c.command);
454
- //# sourceMappingURL=index.js.map
@@ -1,4 +1,3 @@
1
1
  type MergeableObject = Record<string, unknown>;
2
2
  export declare const merge: <T extends MergeableObject>(base: T, add: T) => T;
3
3
  export {};
4
- //# sourceMappingURL=merge.d.ts.map
@@ -25,4 +25,3 @@ export const merge = (base, add) => Object.fromEntries(Object.entries(base)
25
25
  .concat(
26
26
  // already merged together if existing, so just get new additions
27
27
  Object.entries(add).filter(([k]) => base[k] === undefined)));
28
- //# sourceMappingURL=merge.js.map
@@ -16,4 +16,3 @@ export type CommandUsageDefinition = {
16
16
  }>;
17
17
  };
18
18
  export declare const commandUsage: ({ command, usage, description, subcommands, examples, options, }: CommandUsageDefinition) => ReturnType<CommandUsage>;
19
- //# sourceMappingURL=usage.d.ts.map
@@ -37,4 +37,3 @@ export const commandUsage = ({ command, usage, description, subcommands, example
37
37
  }
38
38
  return j;
39
39
  };
40
- //# sourceMappingURL=usage.js.map
@@ -6,4 +6,3 @@ export declare const generateDefaultHelp: (colors?: boolean) => string;
6
6
  * Generates the full help output with all commands when --all flag is used
7
7
  */
8
8
  export declare const generateFullHelp: (colors?: boolean) => string;
9
- //# sourceMappingURL=custom-help.d.ts.map
@@ -44,6 +44,13 @@ const makeStyler = (colors) => {
44
44
  };
45
45
  // Single source of truth for all commands with metadata
46
46
  const allCommands = [
47
+ {
48
+ name: 'bugs',
49
+ aliases: [],
50
+ args: '[<spec>]',
51
+ desc: 'Open the bug tracker for a package',
52
+ showByDefault: false,
53
+ },
47
54
  {
48
55
  name: 'build',
49
56
  aliases: ['b'],
@@ -73,6 +80,13 @@ const allCommands = [
73
80
  desc: 'Get or set configuration',
74
81
  showByDefault: false,
75
82
  },
83
+ {
84
+ name: 'create',
85
+ aliases: [],
86
+ args: '<initializer> [args...]',
87
+ desc: 'Create a new project from a template',
88
+ showByDefault: false,
89
+ },
76
90
  {
77
91
  name: 'docs',
78
92
  aliases: [],
@@ -153,6 +167,13 @@ const allCommands = [
153
167
  desc: 'Create a tarball from a package',
154
168
  showByDefault: false,
155
169
  },
170
+ {
171
+ name: 'ping',
172
+ aliases: [],
173
+ args: '[<registry-alias>]',
174
+ desc: 'Ping configured registries',
175
+ showByDefault: false,
176
+ },
156
177
  {
157
178
  name: 'pkg',
158
179
  aliases: ['p'],
@@ -177,6 +198,13 @@ const allCommands = [
177
198
  showByDefault: true,
178
199
  defaultOrder: 3,
179
200
  },
201
+ {
202
+ name: 'repo',
203
+ aliases: [],
204
+ args: '[<spec>]',
205
+ desc: 'Open the repository page for a package',
206
+ showByDefault: false,
207
+ },
180
208
  {
181
209
  name: 'run',
182
210
  aliases: ['r'],
@@ -192,14 +220,6 @@ const allCommands = [
192
220
  desc: 'Run a script &/or fallback to executing a binary',
193
221
  showByDefault: false,
194
222
  },
195
- {
196
- name: 'serve',
197
- aliases: ['s'],
198
- args: '',
199
- desc: 'Start a local package registry server',
200
- showByDefault: true,
201
- defaultOrder: 9,
202
- },
203
223
  {
204
224
  name: 'token',
205
225
  aliases: [],
@@ -214,6 +234,13 @@ const allCommands = [
214
234
  desc: 'Remove dependencies',
215
235
  showByDefault: false,
216
236
  },
237
+ {
238
+ name: 'unpublish',
239
+ aliases: [],
240
+ args: '<pkg>[@<version>]',
241
+ desc: 'Remove a package from the registry',
242
+ showByDefault: false,
243
+ },
217
244
  {
218
245
  name: 'update',
219
246
  aliases: ['u'],
@@ -397,4 +424,3 @@ Get support: https://${s('bold', 'vlt.community')}
397
424
 
398
425
  ${s('dim', `Run \`vlt help <command>\` for detailed information about a specific command.`)}`;
399
426
  };
400
- //# sourceMappingURL=custom-help.js.map
@@ -50,4 +50,3 @@ export declare class ExecCommand<B extends RunnerBG, F extends RunnerFG> {
50
50
  }[];
51
51
  }
52
52
  export {};
53
- //# sourceMappingURL=exec-command.d.ts.map
@@ -5,6 +5,7 @@
5
5
  import { error } from '@vltpkg/error-cause';
6
6
  import { isErrorWithCause } from '@vltpkg/types';
7
7
  import { Query } from '@vltpkg/query';
8
+ import { createDiffFilesProvider } from "./query-diff-files.js";
8
9
  import { actual } from '@vltpkg/graph';
9
10
  import { isRunResult } from '@vltpkg/run';
10
11
  import { Monorepo } from '@vltpkg/workspaces';
@@ -72,11 +73,11 @@ export class ExecCommand {
72
73
  this.conf = conf;
73
74
  this.bg = bg;
74
75
  this.fg = fg;
75
- this.view = this.validViewValues.get(conf.values.view) ?? 'human';
76
76
  const { projectRoot, positionals: [arg0, ...args], } = conf;
77
77
  this.arg0 = arg0;
78
78
  this.args = args;
79
79
  this.projectRoot = projectRoot;
80
+ this.view = this.validViewValues.get(conf.values.view) ?? 'human';
80
81
  }
81
82
  #targetCount() {
82
83
  if (this.#nodes)
@@ -114,6 +115,7 @@ export class ExecCommand {
114
115
  /* c8 ignore stop */
115
116
  securityArchive: undefined,
116
117
  hostContexts,
118
+ diffFiles: createDiffFilesProvider(this.projectRoot),
117
119
  });
118
120
  const { nodes } = await query.search(queryString, {
119
121
  signal: new AbortController().signal,
@@ -195,10 +197,6 @@ export class ExecCommand {
195
197
  }
196
198
  const results = {};
197
199
  for (const [path, result] of resultMap) {
198
- if (result.status === 0 && result.signal === null) {
199
- result.stdout = '';
200
- result.stderr = '';
201
- }
202
200
  results[path] = result;
203
201
  }
204
202
  return results;
@@ -208,6 +206,12 @@ export class ExecCommand {
208
206
  if (this.view !== 'human')
209
207
  return;
210
208
  if (result.status === 0 && result.signal === null) {
209
+ /* c8 ignore start */
210
+ if (result.stderr)
211
+ stderr(ansiToAnsi(result.stderr));
212
+ if (result.stdout)
213
+ stdout(ansiToAnsi(result.stdout));
214
+ /* c8 ignore stop */
211
215
  stdout(path, 'ok');
212
216
  }
213
217
  else {
@@ -241,8 +245,10 @@ export class ExecCommand {
241
245
  assert(first, error('no nodes found'));
242
246
  return resolve(this.projectRoot, first);
243
247
  }
244
- return (this.#monorepo?.values().next().value?.fullpath ??
245
- this.projectRoot);
248
+ // When no workspace/monorepo targeting is specified, use the current
249
+ // working directory. This matches npx behavior and is required for
250
+ // tools like node-gyp that must run in the correct directory.
251
+ return (this.#monorepo?.values().next().value?.fullpath ?? process.cwd());
246
252
  }
247
253
  fgArg() {
248
254
  const cwd = this.getCwd();
@@ -255,6 +261,7 @@ export class ExecCommand {
255
261
  arg0,
256
262
  args: this.args,
257
263
  env: this.env,
264
+ ignoreMissing: this.conf.get('if-present') ?? this.#defaultIgnoreMissing,
258
265
  projectRoot: this.projectRoot,
259
266
  packageJson: this.conf.options.packageJson,
260
267
  'script-shell': this.arg0 ? this.conf.get('script-shell') : false,
@@ -305,4 +312,3 @@ export class ExecCommand {
305
312
  return targets;
306
313
  }
307
314
  }
308
- //# sourceMappingURL=exec-command.js.map
@@ -1,4 +1,3 @@
1
1
  export type { Command, CommandFn, CommandUsage, } from './load-command.ts';
2
2
  declare const run: () => Promise<void>;
3
3
  export default run;
4
- //# sourceMappingURL=index.d.ts.map
@@ -67,7 +67,6 @@ const run = async () => {
67
67
  return process.exit(process.exitCode || 1);
68
68
  }
69
69
  const command = await loadCommand(vlt.command);
70
- await outputCommand(command, vlt, { start });
70
+ await outputCommand(command, vlt, { start, vltVersion: version });
71
71
  };
72
72
  export default run;
73
- //# sourceMappingURL=index.js.map
@@ -13,4 +13,3 @@ export type Command<T> = {
13
13
  views: Views<T>;
14
14
  };
15
15
  export declare const loadCommand: <T>(command: Commands[keyof Commands] | undefined) => Promise<Command<T>>;
16
- //# sourceMappingURL=load-command.d.ts.map
@@ -18,4 +18,3 @@ export const loadCommand = async (command) => {
18
18
  });
19
19
  }
20
20
  };
21
- //# sourceMappingURL=load-command.js.map
@@ -0,0 +1,18 @@
1
+ import { ViewClass } from './view.ts';
2
+ import type { OutputFormat } from './render-mermaid.ts';
3
+ import type { MermaidOutputGraph } from '@vltpkg/graph';
4
+ /**
5
+ * A ViewClass that renders mermaid output as SVG or PNG
6
+ * (saved to a temp file and opened).
7
+ *
8
+ * Uses `beautiful-mermaid` for SVG rendering and
9
+ * `@resvg/resvg-wasm` for PNG conversion — no external
10
+ * process spawning.
11
+ */
12
+ export declare class MermaidImageView extends ViewClass<MermaidOutputGraph> {
13
+ format: OutputFormat;
14
+ constructor(...args: ConstructorParameters<typeof ViewClass<MermaidOutputGraph>>);
15
+ done(result: MermaidOutputGraph, _opts: {
16
+ time: number;
17
+ }): Promise<void>;
18
+ }
@@ -0,0 +1,36 @@
1
+ import { mermaidOutput } from '@vltpkg/graph';
2
+ import { urlOpen } from '@vltpkg/url-open';
3
+ import { stderr } from "./output.js";
4
+ import { ViewClass } from "./view.js";
5
+ /**
6
+ * A ViewClass that renders mermaid output as SVG or PNG
7
+ * (saved to a temp file and opened).
8
+ *
9
+ * Uses `beautiful-mermaid` for SVG rendering and
10
+ * `@resvg/resvg-wasm` for PNG conversion — no external
11
+ * process spawning.
12
+ */
13
+ export class MermaidImageView extends ViewClass {
14
+ format;
15
+ constructor(...args) {
16
+ super(...args);
17
+ this.format = this.config.values.view;
18
+ }
19
+ async done(result, _opts) {
20
+ const mermaidText = mermaidOutput(result);
21
+ // Dynamic import to avoid loading render-mermaid eagerly
22
+ const { renderMermaidToFile, renderMermaidToPng } = await import("./render-mermaid.js");
23
+ if (this.format === 'png') {
24
+ stderr(`Generating PNG image...`);
25
+ const filePath = await renderMermaidToPng(mermaidText);
26
+ stderr(`Image saved to: ${filePath}`);
27
+ await urlOpen(filePath);
28
+ }
29
+ else {
30
+ stderr(`Generating SVG image...`);
31
+ const filePath = await renderMermaidToFile(mermaidText);
32
+ stderr(`Image saved to: ${filePath}`);
33
+ await urlOpen(filePath);
34
+ }
35
+ }
36
+ }
@@ -14,8 +14,8 @@ export type OnDone<T> = (result: T) => Promise<unknown>;
14
14
  * the user-requested view, or the default if the user requested a view
15
15
  * that is not defined for this command.
16
16
  */
17
- export declare const outputCommand: <T>(cliCommand: Command<T>, conf: LoadedConfig, { start }?: {
17
+ export declare const outputCommand: <T>(cliCommand: Command<T>, conf: LoadedConfig, { start, vltVersion }?: {
18
18
  start: number;
19
+ vltVersion?: string;
19
20
  }) => Promise<void>;
20
21
  export {};
21
- //# sourceMappingURL=output.d.ts.map