@vltpkg/cli-sdk 0.0.0-2 → 0.0.0-20

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 (153) hide show
  1. package/README.md +3 -0
  2. package/dist/esm/commands/cache.d.ts +65 -0
  3. package/dist/esm/commands/cache.d.ts.map +1 -0
  4. package/dist/esm/commands/cache.js +257 -0
  5. package/dist/esm/commands/cache.js.map +1 -0
  6. package/dist/esm/commands/ci.d.ts +10 -0
  7. package/dist/esm/commands/ci.d.ts.map +1 -0
  8. package/dist/esm/commands/ci.js +29 -0
  9. package/dist/esm/commands/ci.js.map +1 -0
  10. package/dist/esm/commands/config.d.ts.map +1 -1
  11. package/dist/esm/commands/config.js +2 -52
  12. package/dist/esm/commands/config.js.map +1 -1
  13. package/dist/esm/commands/exec-cache.d.ts +49 -0
  14. package/dist/esm/commands/exec-cache.d.ts.map +1 -0
  15. package/dist/esm/commands/exec-cache.js +134 -0
  16. package/dist/esm/commands/exec-cache.js.map +1 -0
  17. package/dist/esm/commands/exec-local.d.ts +6 -0
  18. package/dist/esm/commands/exec-local.d.ts.map +1 -0
  19. package/dist/esm/commands/exec-local.js +24 -0
  20. package/dist/esm/commands/exec-local.js.map +1 -0
  21. package/dist/esm/commands/exec.d.ts +4 -0
  22. package/dist/esm/commands/exec.d.ts.map +1 -1
  23. package/dist/esm/commands/exec.js +69 -10
  24. package/dist/esm/commands/exec.js.map +1 -1
  25. package/dist/esm/commands/gui.d.ts.map +1 -1
  26. package/dist/esm/commands/gui.js +1 -2
  27. package/dist/esm/commands/gui.js.map +1 -1
  28. package/dist/esm/commands/help.d.ts +1 -1
  29. package/dist/esm/commands/help.d.ts.map +1 -1
  30. package/dist/esm/commands/help.js +25 -3
  31. package/dist/esm/commands/help.js.map +1 -1
  32. package/dist/esm/commands/init.d.ts +4 -5
  33. package/dist/esm/commands/init.d.ts.map +1 -1
  34. package/dist/esm/commands/init.js +95 -9
  35. package/dist/esm/commands/init.js.map +1 -1
  36. package/dist/esm/commands/install/reporter.d.ts.map +1 -1
  37. package/dist/esm/commands/install/reporter.js +2 -1
  38. package/dist/esm/commands/install/reporter.js.map +1 -1
  39. package/dist/esm/commands/install.d.ts +5 -2
  40. package/dist/esm/commands/install.d.ts.map +1 -1
  41. package/dist/esm/commands/install.js +7 -1
  42. package/dist/esm/commands/install.js.map +1 -1
  43. package/dist/esm/commands/list.d.ts +2 -2
  44. package/dist/esm/commands/list.d.ts.map +1 -1
  45. package/dist/esm/commands/list.js +108 -31
  46. package/dist/esm/commands/list.js.map +1 -1
  47. package/dist/esm/commands/pack.d.ts +20 -0
  48. package/dist/esm/commands/pack.d.ts.map +1 -0
  49. package/dist/esm/commands/pack.js +81 -0
  50. package/dist/esm/commands/pack.js.map +1 -0
  51. package/dist/esm/commands/pkg.d.ts +2 -3
  52. package/dist/esm/commands/pkg.d.ts.map +1 -1
  53. package/dist/esm/commands/pkg.js +136 -34
  54. package/dist/esm/commands/pkg.js.map +1 -1
  55. package/dist/esm/commands/publish.d.ts +21 -0
  56. package/dist/esm/commands/publish.d.ts.map +1 -0
  57. package/dist/esm/commands/publish.js +169 -0
  58. package/dist/esm/commands/publish.js.map +1 -0
  59. package/dist/esm/commands/query.d.ts +2 -2
  60. package/dist/esm/commands/query.d.ts.map +1 -1
  61. package/dist/esm/commands/query.js +134 -21
  62. package/dist/esm/commands/query.js.map +1 -1
  63. package/dist/esm/commands/run-exec.d.ts +1 -0
  64. package/dist/esm/commands/run-exec.d.ts.map +1 -1
  65. package/dist/esm/commands/run-exec.js +1 -0
  66. package/dist/esm/commands/run-exec.js.map +1 -1
  67. package/dist/esm/commands/run.d.ts +1 -0
  68. package/dist/esm/commands/run.d.ts.map +1 -1
  69. package/dist/esm/commands/run.js +13 -16
  70. package/dist/esm/commands/run.js.map +1 -1
  71. package/dist/esm/commands/uninstall.d.ts +7 -1
  72. package/dist/esm/commands/uninstall.d.ts.map +1 -1
  73. package/dist/esm/commands/uninstall.js +7 -1
  74. package/dist/esm/commands/uninstall.js.map +1 -1
  75. package/dist/esm/commands/update.d.ts +10 -0
  76. package/dist/esm/commands/update.d.ts.map +1 -0
  77. package/dist/esm/commands/update.js +25 -0
  78. package/dist/esm/commands/update.js.map +1 -0
  79. package/dist/esm/commands/version.d.ts +22 -0
  80. package/dist/esm/commands/version.d.ts.map +1 -0
  81. package/dist/esm/commands/version.js +151 -0
  82. package/dist/esm/commands/version.js.map +1 -0
  83. package/dist/esm/commands/whoami.d.ts +4 -2
  84. package/dist/esm/commands/whoami.d.ts.map +1 -1
  85. package/dist/esm/commands/whoami.js +1 -1
  86. package/dist/esm/commands/whoami.js.map +1 -1
  87. package/dist/esm/config/definition.d.ts +85 -7
  88. package/dist/esm/config/definition.d.ts.map +1 -1
  89. package/dist/esm/config/definition.js +152 -23
  90. package/dist/esm/config/definition.js.map +1 -1
  91. package/dist/esm/config/index.d.ts +46 -40
  92. package/dist/esm/config/index.d.ts.map +1 -1
  93. package/dist/esm/config/index.js +124 -176
  94. package/dist/esm/config/index.js.map +1 -1
  95. package/dist/esm/config/merge.d.ts +3 -1
  96. package/dist/esm/config/merge.d.ts.map +1 -1
  97. package/dist/esm/config/merge.js +11 -6
  98. package/dist/esm/config/merge.js.map +1 -1
  99. package/dist/esm/config/usage.d.ts +3 -2
  100. package/dist/esm/config/usage.d.ts.map +1 -1
  101. package/dist/esm/config/usage.js.map +1 -1
  102. package/dist/esm/exec-command.d.ts +32 -14
  103. package/dist/esm/exec-command.d.ts.map +1 -1
  104. package/dist/esm/exec-command.js +195 -63
  105. package/dist/esm/exec-command.js.map +1 -1
  106. package/dist/esm/index.d.ts +1 -14
  107. package/dist/esm/index.d.ts.map +1 -1
  108. package/dist/esm/index.js +46 -20
  109. package/dist/esm/index.js.map +1 -1
  110. package/dist/esm/load-command.d.ts +16 -0
  111. package/dist/esm/load-command.d.ts.map +1 -0
  112. package/dist/esm/load-command.js +21 -0
  113. package/dist/esm/load-command.js.map +1 -0
  114. package/dist/esm/output.d.ts +6 -10
  115. package/dist/esm/output.d.ts.map +1 -1
  116. package/dist/esm/output.js +62 -32
  117. package/dist/esm/output.js.map +1 -1
  118. package/dist/esm/pack-tarball.d.ts +22 -0
  119. package/dist/esm/pack-tarball.d.ts.map +1 -0
  120. package/dist/esm/pack-tarball.js +247 -0
  121. package/dist/esm/pack-tarball.js.map +1 -0
  122. package/dist/esm/parse-add-remove-args.d.ts +1 -1
  123. package/dist/esm/parse-add-remove-args.d.ts.map +1 -1
  124. package/dist/esm/parse-add-remove-args.js +1 -1
  125. package/dist/esm/parse-add-remove-args.js.map +1 -1
  126. package/dist/esm/print-err.d.ts +12 -1
  127. package/dist/esm/print-err.d.ts.map +1 -1
  128. package/dist/esm/print-err.js +157 -26
  129. package/dist/esm/print-err.js.map +1 -1
  130. package/dist/esm/start-gui.d.ts +7 -33
  131. package/dist/esm/start-gui.d.ts.map +1 -1
  132. package/dist/esm/start-gui.js +33 -347
  133. package/dist/esm/start-gui.js.map +1 -1
  134. package/dist/esm/view.d.ts +2 -3
  135. package/dist/esm/view.d.ts.map +1 -1
  136. package/dist/esm/view.js.map +1 -1
  137. package/package.json +69 -44
  138. package/dist/esm/commands/install-exec.d.ts +0 -4
  139. package/dist/esm/commands/install-exec.d.ts.map +0 -1
  140. package/dist/esm/commands/install-exec.js +0 -13
  141. package/dist/esm/commands/install-exec.js.map +0 -1
  142. package/dist/esm/ignored-homedir-folder-names.d.ts +0 -7
  143. package/dist/esm/ignored-homedir-folder-names.d.ts.map +0 -1
  144. package/dist/esm/ignored-homedir-folder-names.js +0 -35
  145. package/dist/esm/ignored-homedir-folder-names.js.map +0 -1
  146. package/dist/esm/project-info.d.ts +0 -32
  147. package/dist/esm/project-info.d.ts.map +0 -1
  148. package/dist/esm/project-info.js +0 -90
  149. package/dist/esm/project-info.js.map +0 -1
  150. package/dist/esm/read-project-folders.d.ts +0 -27
  151. package/dist/esm/read-project-folders.d.ts.map +0 -1
  152. package/dist/esm/read-project-folders.js +0 -66
  153. package/dist/esm/read-project-folders.js.map +0 -1
@@ -1,16 +1,37 @@
1
- import { actual, humanReadableOutput, jsonOutput, mermaidOutput, } from '@vltpkg/graph';
1
+ import { actual, asNode, humanReadableOutput, jsonOutput, mermaidOutput, GraphModifier, } from '@vltpkg/graph';
2
+ import { error } from '@vltpkg/error-cause';
3
+ import LZString from 'lz-string';
2
4
  import { Query } from '@vltpkg/query';
5
+ import { SecurityArchive } from '@vltpkg/security-archive';
3
6
  import { commandUsage } from "../config/usage.js";
4
7
  import { startGUI } from "../start-gui.js";
5
8
  export const usage = () => commandUsage({
6
9
  command: 'query',
7
- usage: ['', '<query> --view=[human | json | mermaid | gui]'],
8
- description: 'List installed dependencies matching the provided query.',
10
+ usage: [
11
+ '',
12
+ '<query> --view=<human | json | mermaid | gui>',
13
+ '<query> --expect-results=<comparison string>',
14
+ '--target=<query> --view=<human | json | mermaid | gui>',
15
+ ],
16
+ description: `List installed dependencies matching the provided query.
17
+
18
+ The vlt Dependency Selector Syntax is a CSS-like query language that
19
+ allows you to filter installed dependencies using a variety of metadata
20
+ in the form of CSS-like attributes, pseudo selectors & combinators.
21
+
22
+ The --scope and --target options accepts DSS query selectors to filter
23
+ packages. Using --scope, you can specify which packages to treat as the
24
+ top-level items in the output graph. The --target option can be used as
25
+ an alternative to positional arguments, it allows you to filter what
26
+ dependencies to include in the output. Using both options allows you to
27
+ render subgraphs of the dependency graph.
28
+
29
+ Defaults to listing all dependencies of the project root and workspaces.`,
9
30
  examples: {
10
31
  [`'#foo'`]: {
11
- description: 'Query packages with the name "foo"',
32
+ description: 'Query dependencies declared as "foo"',
12
33
  },
13
- [`'*.workspace > *.peer'`]: {
34
+ [`'*:workspace > *:peer'`]: {
14
35
  description: 'Query all peer dependencies of workspaces',
15
36
  },
16
37
  [`':project > *:attr(scripts, [build])'`]: {
@@ -19,56 +40,148 @@ export const usage = () => commandUsage({
19
40
  [`'[name^="@vltpkg"]'`]: {
20
41
  description: 'Query packages with names starting with "@vltpkg"',
21
42
  },
43
+ [`'*:license(copyleft) --expect-results=0'`]: {
44
+ description: 'Errors if a copyleft licensed package is found',
45
+ },
46
+ '--scope=":root > #dependency-name"': {
47
+ description: 'Defines a direct dependency as the output top-level scope',
48
+ },
49
+ [`'--target="*"'`]: {
50
+ description: 'Query all dependencies using the target option',
51
+ },
52
+ [`'--target=":workspace > *:peer"'`]: {
53
+ description: 'Query all peer dependencies of workspaces using target option',
54
+ },
22
55
  },
23
56
  options: {
57
+ 'expect-results': {
58
+ value: '[number | string]',
59
+ description: 'Sets an expected number of resulting items. Errors if the number of resulting items does not match the set value. Accepts a specific numeric value or a string value starting with either ">", "<", ">=" or "<=" followed by a numeric value to be compared.',
60
+ },
61
+ scope: {
62
+ value: '<query>',
63
+ description: 'Query selector to select top-level packages using the DSS query language syntax.',
64
+ },
65
+ target: {
66
+ value: '<query>',
67
+ description: 'Query selector to filter packages using DSS syntax.',
68
+ },
24
69
  view: {
25
70
  value: '[human | json | mermaid | gui]',
26
71
  description: 'Output format. Defaults to human-readable or json if no tty.',
27
72
  },
28
73
  },
29
74
  });
75
+ const validateExpectedResult = (conf, edges) => {
76
+ const expectResults = conf.values['expect-results'];
77
+ if (expectResults?.startsWith('>=')) {
78
+ return edges.length >= parseInt(expectResults.slice(2).trim(), 10);
79
+ }
80
+ else if (expectResults?.startsWith('<=')) {
81
+ return edges.length <= parseInt(expectResults.slice(2).trim(), 10);
82
+ }
83
+ else if (expectResults?.startsWith('>')) {
84
+ return edges.length > parseInt(expectResults.slice(1).trim(), 10);
85
+ }
86
+ else if (expectResults?.startsWith('<')) {
87
+ return edges.length < parseInt(expectResults.slice(1).trim(), 10);
88
+ }
89
+ else if (expectResults) {
90
+ return edges.length === parseInt(expectResults.trim(), 10);
91
+ }
92
+ return true;
93
+ };
30
94
  export const views = {
31
95
  json: jsonOutput,
32
96
  mermaid: mermaidOutput,
33
97
  human: humanReadableOutput,
34
98
  gui: async ({ queryString }, _, conf) => {
35
- await startGUI({
36
- conf,
37
- startingRoute: '/explore?query=' + encodeURIComponent(queryString),
38
- });
99
+ await startGUI(conf, `/explore/${LZString.compressToEncodedURIComponent(queryString)}/overview`);
39
100
  },
40
101
  };
41
102
  export const command = async (conf) => {
103
+ const modifiers = GraphModifier.maybeLoad(conf.options);
42
104
  const monorepo = conf.options.monorepo;
43
105
  const mainManifest = conf.options.packageJson.read(conf.options.projectRoot);
44
106
  const graph = actual.load({
45
107
  ...conf.options,
46
108
  mainManifest,
109
+ modifiers,
47
110
  monorepo,
48
111
  loadManifests: true,
49
112
  });
50
113
  const defaultQueryString = '*';
51
- const queryString = conf.positionals[0];
52
- const query = new Query({ graph, specOptions: conf.options });
53
- const { edges, nodes } = await query.search(queryString || defaultQueryString);
114
+ const positionalQueryString = conf.positionals[0];
115
+ const targetQueryString = conf.get('target');
116
+ const queryString = targetQueryString || positionalQueryString;
117
+ const securityArchive = await SecurityArchive.start({
118
+ graph,
119
+ specOptions: conf.options,
120
+ });
121
+ const query = new Query({
122
+ graph,
123
+ specOptions: conf.options,
124
+ securityArchive,
125
+ });
54
126
  const importers = new Set();
55
- if (monorepo) {
56
- for (const workspace of monorepo.filter(conf.values)) {
57
- const w = graph.nodes.get(workspace.id);
58
- if (w)
59
- importers.add(w);
127
+ const scopeIDs = [];
128
+ // Handle --scope option to add scope nodes as importers
129
+ const scopeQueryString = conf.get('scope');
130
+ let scopeNodes;
131
+ if (scopeQueryString) {
132
+ // Run scope query to get all matching nodes
133
+ const scopeQuery = new Query({
134
+ graph,
135
+ specOptions: conf.options,
136
+ securityArchive,
137
+ });
138
+ const { nodes } = await scopeQuery.search(scopeQueryString, {
139
+ signal: new AbortController().signal,
140
+ });
141
+ scopeNodes = nodes;
142
+ }
143
+ if (scopeQueryString && scopeNodes) {
144
+ // Add all scope nodes to importers Set (treat them as top-level items)
145
+ for (const queryNode of scopeNodes) {
146
+ importers.add(asNode(queryNode));
60
147
  }
61
148
  }
62
- if (importers.size === 0) {
63
- for (const importer of graph.importers) {
64
- importers.add(importer);
149
+ else {
150
+ // if in a workspace environment, select only the specified
151
+ // workspaces as top-level items
152
+ if (monorepo) {
153
+ for (const workspace of monorepo.filter(conf.values)) {
154
+ const w = graph.nodes.get(workspace.id);
155
+ if (w) {
156
+ importers.add(w);
157
+ scopeIDs.push(workspace.id);
158
+ }
159
+ }
160
+ }
161
+ // if no top-level item was set then by default
162
+ // we just set all importers as top-level items
163
+ if (importers.size === 0) {
164
+ for (const importer of graph.importers) {
165
+ importers.add(importer);
166
+ }
65
167
  }
66
168
  }
169
+ // retrieve the selected nodes and edges
170
+ const { edges, nodes } = await query.search(queryString || defaultQueryString, {
171
+ signal: new AbortController().signal,
172
+ scopeIDs: scopeIDs.length > 0 ? scopeIDs : undefined,
173
+ });
174
+ if (!validateExpectedResult(conf, edges)) {
175
+ throw error('Unexpected number of items', {
176
+ found: edges.length,
177
+ wanted: conf.values['expect-results'],
178
+ });
179
+ }
67
180
  return {
68
181
  importers,
69
182
  edges,
70
183
  nodes,
71
- highlightSelection: !!queryString,
184
+ highlightSelection: !!(targetQueryString || positionalQueryString),
72
185
  queryString: queryString || defaultQueryString,
73
186
  };
74
187
  };
@@ -1 +1 @@
1
- {"version":3,"file":"query.js","sourceRoot":"","sources":["../../../src/commands/query.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,mBAAmB,EACnB,UAAU,EACV,aAAa,GACd,MAAM,eAAe,CAAA;AAOtB,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAG1C,MAAM,CAAC,MAAM,KAAK,GAAiB,GAAG,EAAE,CACtC,YAAY,CAAC;IACX,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE,CAAC,EAAE,EAAE,+CAA+C,CAAC;IAC5D,WAAW,EACT,0DAA0D;IAC5D,QAAQ,EAAE;QACR,CA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EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAA;IAC7D,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,MAAM,KAAK,CAAC,MAAM,CACzC,WAAW,IAAI,kBAAkB,CAClC,CAAA;IAED,MAAM,SAAS,GAAG,IAAI,GAAG,EAAQ,CAAA;IACjC,IAAI,QAAQ,EAAE,CAAC;QACb,KAAK,MAAM,SAAS,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;YACrD,MAAM,CAAC,GAAqB,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;YACzD,IAAI,CAAC;gBAAE,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;QACzB,CAAC;IACH,CAAC;IACD,IAAI,SAAS,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;QACzB,KAAK,MAAM,QAAQ,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;YACvC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;QACzB,CAAC;IACH,CAAC;IAED,OAAO;QACL,SAAS;QACT,KAAK;QACL,KAAK;QACL,kBAAkB,EAAE,CAAC,CAAC,WAAW;QACjC,WAAW,EAAE,WAAW,IAAI,kBAAkB;KAC/C,CAAA;AACH,CAAC,CAAA","sourcesContent":["import {\n actual,\n humanReadableOutput,\n jsonOutput,\n mermaidOutput,\n} from '@vltpkg/graph'\nimport type {\n HumanReadableOutputGraph,\n JSONOutputGraph,\n MermaidOutputGraph,\n Node,\n} from '@vltpkg/graph'\nimport { Query } from '@vltpkg/query'\nimport { commandUsage } from '../config/usage.ts'\nimport type { CommandFn, CommandUsage } from '../index.ts'\nimport { startGUI } from '../start-gui.ts'\nimport type { Views } from '../view.ts'\n\nexport const usage: CommandUsage = () =>\n commandUsage({\n command: 'query',\n usage: ['', '<query> --view=[human | json | mermaid | gui]'],\n description:\n 'List installed dependencies matching the provided query.',\n examples: {\n [`'#foo'`]: {\n description: 'Query packages with the name \"foo\"',\n },\n [`'*.workspace > *.peer'`]: {\n description: 'Query all peer dependencies of workspaces',\n },\n [`':project > *:attr(scripts, [build])'`]: {\n description:\n 'Query all direct project dependencies with a \"build\" script',\n },\n [`'[name^=\"@vltpkg\"]'`]: {\n description:\n 'Query packages with names starting with \"@vltpkg\"',\n },\n },\n options: {\n view: {\n value: '[human | json | mermaid | gui]',\n description:\n 'Output format. Defaults to human-readable or json if no tty.',\n },\n },\n })\n\ntype QueryResult = JSONOutputGraph &\n MermaidOutputGraph &\n HumanReadableOutputGraph & { queryString: string }\n\nexport const views = {\n json: jsonOutput,\n mermaid: mermaidOutput,\n human: humanReadableOutput,\n gui: async ({ queryString }, _, conf) => {\n await startGUI({\n conf,\n startingRoute:\n '/explore?query=' + encodeURIComponent(queryString),\n })\n },\n} as const satisfies Views<QueryResult>\n\nexport const command: CommandFn<QueryResult> = async conf => {\n const monorepo = conf.options.monorepo\n const mainManifest = conf.options.packageJson.read(\n conf.options.projectRoot,\n )\n const graph = actual.load({\n ...conf.options,\n mainManifest,\n monorepo,\n loadManifests: true,\n })\n\n const defaultQueryString = '*'\n const queryString = conf.positionals[0]\n const query = new Query({ graph, specOptions: conf.options })\n const { edges, nodes } = await query.search(\n queryString || defaultQueryString,\n )\n\n const importers = new Set<Node>()\n if (monorepo) {\n for (const workspace of monorepo.filter(conf.values)) {\n const w: Node | undefined = graph.nodes.get(workspace.id)\n if (w) importers.add(w)\n }\n }\n if (importers.size === 0) {\n for (const importer of graph.importers) {\n importers.add(importer)\n }\n }\n\n return {\n importers,\n edges,\n nodes,\n highlightSelection: !!queryString,\n queryString: queryString || defaultQueryString,\n }\n}\n"]}
1
+ {"version":3,"file":"query.js","sourceRoot":"","sources":["../../../src/commands/query.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,MAAM,EACN,MAAM,EACN,mBAAmB,EACnB,UAAU,EACV,aAAa,EACb,aAA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YACH,CAAC;QACH,CAAC;QACD,+CAA+C;QAC/C,+CAA+C;QAC/C,IAAI,SAAS,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;YACzB,KAAK,MAAM,QAAQ,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;gBACvC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;YACzB,CAAC;QACH,CAAC;IACH,CAAC;IAED,wCAAwC;IACxC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,MAAM,KAAK,CAAC,MAAM,CACzC,WAAW,IAAI,kBAAkB,EACjC;QACE,MAAM,EAAE,IAAI,eAAe,EAAE,CAAC,MAAM;QACpC,QAAQ,EAAE,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS;KACrD,CACF,CAAA;IAED,IAAI,CAAC,sBAAsB,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC;QACzC,MAAM,KAAK,CAAC,4BAA4B,EAAE;YACxC,KAAK,EAAE,KAAK,CAAC,MAAM;YACnB,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC;SACtC,CAAC,CAAA;IACJ,CAAC;IAED,OAAO;QACL,SAAS;QACT,KAAK;QACL,KAAK;QACL,kBAAkB,EAAE,CAAC,CAAC,CACpB,iBAAiB,IAAI,qBAAqB,CAC3C;QACD,WAAW,EAAE,WAAW,IAAI,kBAAkB;KAC/C,CAAA;AACH,CAAC,CAAA","sourcesContent":["import type {\n EdgeLike,\n HumanReadableOutputGraph,\n JSONOutputGraph,\n MermaidOutputGraph,\n Node,\n} from '@vltpkg/graph'\nimport {\n actual,\n asNode,\n humanReadableOutput,\n jsonOutput,\n mermaidOutput,\n GraphModifier,\n} from '@vltpkg/graph'\nimport { error } from '@vltpkg/error-cause'\nimport LZString from 'lz-string'\nimport { Query } from '@vltpkg/query'\nimport { SecurityArchive } from '@vltpkg/security-archive'\nimport type { DepID } from '@vltpkg/dep-id'\nimport { commandUsage } from '../config/usage.ts'\nimport type { CommandFn, CommandUsage } from '../index.ts'\nimport { startGUI } from '../start-gui.ts'\nimport type { Views } from '../view.ts'\nimport type { LoadedConfig } from '../config/index.ts'\n\nexport const usage: CommandUsage = () =>\n commandUsage({\n command: 'query',\n usage: [\n '',\n '<query> --view=<human | json | mermaid | gui>',\n '<query> --expect-results=<comparison string>',\n '--target=<query> --view=<human | json | mermaid | gui>',\n ],\n description: `List installed dependencies matching the provided query.\n\n The vlt Dependency Selector Syntax is a CSS-like query language that\n allows you to filter installed dependencies using a variety of metadata\n in the form of CSS-like attributes, pseudo selectors & combinators.\n\n The --scope and --target options accepts DSS query selectors to filter\n packages. Using --scope, you can specify which packages to treat as the\n top-level items in the output graph. The --target option can be used as\n an alternative to positional arguments, it allows you to filter what\n dependencies to include in the output. Using both options allows you to\n render subgraphs of the dependency graph.\n\n Defaults to listing all dependencies of the project root and workspaces.`,\n\n examples: {\n [`'#foo'`]: {\n description: 'Query dependencies declared as \"foo\"',\n },\n [`'*:workspace > *:peer'`]: {\n description: 'Query all peer dependencies of workspaces',\n },\n [`':project > *:attr(scripts, [build])'`]: {\n description:\n 'Query all direct project dependencies with a \"build\" script',\n },\n [`'[name^=\"@vltpkg\"]'`]: {\n description:\n 'Query packages with names starting with \"@vltpkg\"',\n },\n [`'*:license(copyleft) --expect-results=0'`]: {\n description: 'Errors if a copyleft licensed package is found',\n },\n '--scope=\":root > #dependency-name\"': {\n description:\n 'Defines a direct dependency as the output top-level scope',\n },\n [`'--target=\"*\"'`]: {\n description: 'Query all dependencies using the target option',\n },\n [`'--target=\":workspace > *:peer\"'`]: {\n description:\n 'Query all peer dependencies of workspaces using target option',\n },\n },\n options: {\n 'expect-results': {\n value: '[number | string]',\n description:\n 'Sets an expected number of resulting items. Errors if the number of resulting items does not match the set value. Accepts a specific numeric value or a string value starting with either \">\", \"<\", \">=\" or \"<=\" followed by a numeric value to be compared.',\n },\n scope: {\n value: '<query>',\n description:\n 'Query selector to select top-level packages using the DSS query language syntax.',\n },\n target: {\n value: '<query>',\n description:\n 'Query selector to filter packages using DSS syntax.',\n },\n view: {\n value: '[human | json | mermaid | gui]',\n description:\n 'Output format. Defaults to human-readable or json if no tty.',\n },\n },\n })\n\ntype QueryResult = JSONOutputGraph &\n MermaidOutputGraph &\n HumanReadableOutputGraph & { queryString: string }\n\nconst validateExpectedResult = (\n conf: LoadedConfig,\n edges: EdgeLike[],\n): boolean => {\n const expectResults = conf.values['expect-results']\n if (expectResults?.startsWith('>=')) {\n return edges.length >= parseInt(expectResults.slice(2).trim(), 10)\n } else if (expectResults?.startsWith('<=')) {\n return edges.length <= parseInt(expectResults.slice(2).trim(), 10)\n } else if (expectResults?.startsWith('>')) {\n return edges.length > parseInt(expectResults.slice(1).trim(), 10)\n } else if (expectResults?.startsWith('<')) {\n return edges.length < parseInt(expectResults.slice(1).trim(), 10)\n } else if (expectResults) {\n return edges.length === parseInt(expectResults.trim(), 10)\n }\n return true\n}\n\nexport const views = {\n json: jsonOutput,\n mermaid: mermaidOutput,\n human: humanReadableOutput,\n gui: async ({ queryString }, _, conf) => {\n await startGUI(\n conf,\n `/explore/${LZString.compressToEncodedURIComponent(queryString)}/overview`,\n )\n },\n} as const satisfies Views<QueryResult>\n\nexport const command: CommandFn<QueryResult> = async conf => {\n const modifiers = GraphModifier.maybeLoad(conf.options)\n const monorepo = conf.options.monorepo\n const mainManifest = conf.options.packageJson.read(\n conf.options.projectRoot,\n )\n const graph = actual.load({\n ...conf.options,\n mainManifest,\n modifiers,\n monorepo,\n loadManifests: true,\n })\n\n const defaultQueryString = '*'\n const positionalQueryString = conf.positionals[0]\n const targetQueryString = conf.get('target')\n const queryString = targetQueryString || positionalQueryString\n const securityArchive = await SecurityArchive.start({\n graph,\n specOptions: conf.options,\n })\n const query = new Query({\n graph,\n specOptions: conf.options,\n securityArchive,\n })\n\n const importers = new Set<Node>()\n const scopeIDs: DepID[] = []\n\n // Handle --scope option to add scope nodes as importers\n const scopeQueryString = conf.get('scope')\n let scopeNodes\n if (scopeQueryString) {\n // Run scope query to get all matching nodes\n const scopeQuery = new Query({\n graph,\n specOptions: conf.options,\n securityArchive,\n })\n const { nodes } = await scopeQuery.search(scopeQueryString, {\n signal: new AbortController().signal,\n })\n scopeNodes = nodes\n }\n\n if (scopeQueryString && scopeNodes) {\n // Add all scope nodes to importers Set (treat them as top-level items)\n for (const queryNode of scopeNodes) {\n importers.add(asNode(queryNode))\n }\n } else {\n // if in a workspace environment, select only the specified\n // workspaces as top-level items\n if (monorepo) {\n for (const workspace of monorepo.filter(conf.values)) {\n const w: Node | undefined = graph.nodes.get(workspace.id)\n if (w) {\n importers.add(w)\n scopeIDs.push(workspace.id)\n }\n }\n }\n // if no top-level item was set then by default\n // we just set all importers as top-level items\n if (importers.size === 0) {\n for (const importer of graph.importers) {\n importers.add(importer)\n }\n }\n }\n\n // retrieve the selected nodes and edges\n const { edges, nodes } = await query.search(\n queryString || defaultQueryString,\n {\n signal: new AbortController().signal,\n scopeIDs: scopeIDs.length > 0 ? scopeIDs : undefined,\n },\n )\n\n if (!validateExpectedResult(conf, edges)) {\n throw error('Unexpected number of items', {\n found: edges.length,\n wanted: conf.values['expect-results'],\n })\n }\n\n return {\n importers,\n edges,\n nodes,\n highlightSelection: !!(\n targetQueryString || positionalQueryString\n ),\n queryString: queryString || defaultQueryString,\n }\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  import type { ExecResult } from '../exec-command.ts';
2
2
  import type { CommandFn, CommandUsage } from '../index.ts';
3
+ export { views } from '../exec-command.ts';
3
4
  export declare const usage: CommandUsage;
4
5
  export declare const command: CommandFn<ExecResult>;
5
6
  //# sourceMappingURL=run-exec.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"run-exec.d.ts","sourceRoot":"","sources":["../../../src/commands/run-exec.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1D,eAAO,MAAM,KAAK,EAAE,YAQhB,CAAA;AAEJ,eAAO,MAAM,OAAO,EAAE,SAAS,CAAC,UAAU,CACa,CAAA"}
1
+ {"version":3,"file":"run-exec.d.ts","sourceRoot":"","sources":["../../../src/commands/run-exec.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAEpD,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAE1C,eAAO,MAAM,KAAK,EAAE,YAQhB,CAAA;AAEJ,eAAO,MAAM,OAAO,EAAE,SAAS,CAAC,UAAU,CACa,CAAA"}
@@ -1,6 +1,7 @@
1
1
  import { runExec, runExecFG } from '@vltpkg/run';
2
2
  import { commandUsage } from "../config/usage.js";
3
3
  import { ExecCommand } from "../exec-command.js";
4
+ export { views } from "../exec-command.js";
4
5
  export const usage = () => commandUsage({
5
6
  command: 'run-exec',
6
7
  usage: '[command ...]',
@@ -1 +1 @@
1
- {"version":3,"file":"run-exec.js","sourceRoot":"","sources":["../../../src/commands/run-exec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAIhD,MAAM,CAAC,MAAM,KAAK,GAAiB,GAAG,EAAE,CACtC,YAAY,CAAC;IACX,OAAO,EAAE,UAAU;IACnB,KAAK,EAAE,eAAe;IACtB,WAAW,EAAE;;;mEAGkD;CAChE,CAAC,CAAA;AAEJ,MAAM,CAAC,MAAM,OAAO,GAA0B,KAAK,EAAC,IAAI,EAAC,EAAE,CACzD,MAAM,IAAI,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC,GAAG,EAAE,CAAA","sourcesContent":["import { runExec, runExecFG } from '@vltpkg/run'\nimport { commandUsage } from '../config/usage.ts'\nimport { ExecCommand } from '../exec-command.ts'\nimport type { ExecResult } from '../exec-command.ts'\nimport type { CommandFn, CommandUsage } from '../index.ts'\n\nexport const usage: CommandUsage = () =>\n commandUsage({\n command: 'run-exec',\n usage: '[command ...]',\n description: `If the first argument is a defined script in package.json, then this is\n equivalent to \\`vlt run\\`.\n\n If not, then this is equivalent to \\`vlt exec\\`.`,\n })\n\nexport const command: CommandFn<ExecResult> = async conf =>\n await new ExecCommand(conf, runExec, runExecFG).run()\n"]}
1
+ {"version":3,"file":"run-exec.js","sourceRoot":"","sources":["../../../src/commands/run-exec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAEhD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAE1C,MAAM,CAAC,MAAM,KAAK,GAAiB,GAAG,EAAE,CACtC,YAAY,CAAC;IACX,OAAO,EAAE,UAAU;IACnB,KAAK,EAAE,eAAe;IACtB,WAAW,EAAE;;;mEAGkD;CAChE,CAAC,CAAA;AAEJ,MAAM,CAAC,MAAM,OAAO,GAA0B,KAAK,EAAC,IAAI,EAAC,EAAE,CACzD,MAAM,IAAI,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC,GAAG,EAAE,CAAA","sourcesContent":["import { runExec, runExecFG } from '@vltpkg/run'\nimport { commandUsage } from '../config/usage.ts'\nimport type { ExecResult } from '../exec-command.ts'\nimport { ExecCommand } from '../exec-command.ts'\nimport type { CommandFn, CommandUsage } from '../index.ts'\nexport { views } from '../exec-command.ts'\n\nexport const usage: CommandUsage = () =>\n commandUsage({\n command: 'run-exec',\n usage: '[command ...]',\n description: `If the first argument is a defined script in package.json, then this is\n equivalent to \\`vlt run\\`.\n\n If not, then this is equivalent to \\`vlt exec\\`.`,\n })\n\nexport const command: CommandFn<ExecResult> = async conf =>\n await new ExecCommand(conf, runExec, runExecFG).run()\n"]}
@@ -1,5 +1,6 @@
1
1
  import type { ExecResult } from '../exec-command.ts';
2
2
  import type { CommandFn, CommandUsage } from '../index.ts';
3
+ export { views } from '../exec-command.ts';
3
4
  export declare const usage: CommandUsage;
4
5
  export declare const command: CommandFn<ExecResult>;
5
6
  //# sourceMappingURL=run.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/commands/run.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG1D,eAAO,MAAM,KAAK,EAAE,YAQhB,CAAA;AAgCJ,eAAO,MAAM,OAAO,EAAE,SAAS,CAAC,UAAU,CACR,CAAA"}
1
+ {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/commands/run.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,UAAU,EAGX,MAAM,oBAAoB,CAAA;AAE3B,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1D,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAE1C,eAAO,MAAM,KAAK,EAAE,YAQhB,CAAA;AA2BJ,eAAO,MAAM,OAAO,EAAE,SAAS,CAAC,UAAU,CACR,CAAA"}
@@ -1,8 +1,7 @@
1
- import { PackageJson } from '@vltpkg/package-json';
2
1
  import { run, runFG } from '@vltpkg/run';
3
2
  import { commandUsage } from "../config/usage.js";
4
3
  import { ExecCommand } from "../exec-command.js";
5
- import { stdout } from "../output.js";
4
+ export { views } from "../exec-command.js";
6
5
  export const usage = () => commandUsage({
7
6
  command: 'run',
8
7
  usage: '<script> [args ...]',
@@ -15,24 +14,22 @@ class RunCommand extends ExecCommand {
15
14
  constructor(conf) {
16
15
  super(conf, run, runFG);
17
16
  }
18
- defaultArg0() {
17
+ // do not provide the interactive shell arg, just do nothing
18
+ // so that it falls back up to the noArgsSingle() method
19
+ defaultArg0() { }
20
+ noArgsSingle() {
19
21
  // called when there's no arg0, with a single workspace or root
20
- const ws = this.monorepo?.values().next().value;
21
- const cwd = ws?.fullpath ?? this.projectRoot;
22
- const packageJson = this.monorepo?.packageJson ?? new PackageJson();
23
- const mani = packageJson.read(cwd);
24
- stdout('Scripts available:', mani.scripts);
25
- return undefined;
22
+ const cwd = this.getCwd();
23
+ const { scripts = {} } = this.conf.options.packageJson.read(cwd);
24
+ return scripts;
26
25
  }
27
26
  noArgsMulti() {
28
- const m = this.monorepo;
29
- /* c8 ignore next - already guarded */
30
- if (!m)
31
- return;
32
- stdout('Scripts available:');
33
- for (const [ws, scripts] of m.runSync(ws => ws.manifest.scripts)) {
34
- stdout(ws.path, scripts);
27
+ const scripts = {};
28
+ for (const { label, manifest } of this.getTargets()) {
29
+ if (manifest.scripts)
30
+ scripts[label] = manifest.scripts;
35
31
  }
32
+ return scripts;
36
33
  }
37
34
  }
38
35
  export const command = async (conf) => await new RunCommand(conf).run();
@@ -1 +1 @@
1
- {"version":3,"file":"run.js","sourceRoot":"","sources":["../../../src/commands/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAExC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAGhD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAErC,MAAM,CAAC,MAAM,KAAK,GAAiB,GAAG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PackageJson } from '@vltpkg/package-json'\nimport { run, runFG } from '@vltpkg/run'\nimport type { LoadedConfig } from '../config/index.ts'\nimport { commandUsage } from '../config/usage.ts'\nimport { ExecCommand } from '../exec-command.ts'\nimport type { ExecResult } from '../exec-command.ts'\nimport type { CommandFn, CommandUsage } from '../index.ts'\nimport { stdout } from '../output.ts'\n\nexport const usage: CommandUsage = () =>\n commandUsage({\n command: 'run',\n usage: '<script> [args ...]',\n description: `Run a script defined in 'package.json', passing along any extra\n arguments. Note that vlt config values must be specified *before*\n the script name, because everything after that is handed off to\n the script process.`,\n })\n\nclass RunCommand extends ExecCommand<typeof run, typeof runFG> {\n constructor(conf: LoadedConfig) {\n super(conf, run, runFG)\n }\n\n defaultArg0(): string | undefined {\n // called when there's no arg0, with a single workspace or root\n const ws = this.monorepo?.values().next().value\n const cwd = ws?.fullpath ?? this.projectRoot\n const packageJson =\n this.monorepo?.packageJson ?? new PackageJson()\n const mani = packageJson.read(cwd)\n stdout('Scripts available:', mani.scripts)\n return undefined\n }\n\n noArgsMulti(): void {\n const m = this.monorepo\n /* c8 ignore next - already guarded */\n if (!m) return\n\n stdout('Scripts available:')\n for (const [ws, scripts] of m.runSync(\n ws => ws.manifest.scripts,\n )) {\n stdout(ws.path, scripts)\n }\n }\n}\n\nexport const command: CommandFn<ExecResult> = async conf =>\n await new RunCommand(conf).run()\n"]}
1
+ {"version":3,"file":"run.js","sourceRoot":"","sources":["../../../src/commands/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAExC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAMjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAGhD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAE1C,MAAM,CAAC,MAAM,KAAK,GAAiB,GAAG,EAAE,CACtC,YAAY,CAAC;IACX,OAAO,EAAE,KAAK;IACd,KAAK,EAAE,qBAAqB;IAC5B,WAAW,EAAE;;;sCAGqB;CACnC,CAAC,CAAA;AAEJ,MAAM,UAAW,SAAQ,WAAqC;IAC5D,YAAY,IAAkB;QAC5B,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAA;IACzB,CAAC;IAED,4DAA4D;IAC5D,wDAAwD;IACxD,WAAW,KAAe,CAAC;IAE3B,YAAY;QACV,+DAA+D;QAC/D,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,CAAA;QACzB,MAAM,EAAE,OAAO,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QAChE,OAAO,OAAO,CAAA;IAChB,CAAC;IAED,WAAW;QACT,MAAM,OAAO,GAAmB,EAAE,CAAA;QAClC,KAAK,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,IAAI,CAAC,UAAU,EAAE,EAAE,CAAC;YACpD,IAAI,QAAQ,CAAC,OAAO;gBAAE,OAAO,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAA;QACzD,CAAC;QACD,OAAO,OAAO,CAAA;IAChB,CAAC;CACF;AAED,MAAM,CAAC,MAAM,OAAO,GAA0B,KAAK,EAAC,IAAI,EAAC,EAAE,CACzD,MAAM,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,CAAA","sourcesContent":["import { run, runFG } from '@vltpkg/run'\nimport type { LoadedConfig } from '../config/index.ts'\nimport { commandUsage } from '../config/usage.ts'\nimport type {\n ExecResult,\n MultiScriptSet,\n ScriptSet,\n} from '../exec-command.ts'\nimport { ExecCommand } from '../exec-command.ts'\nimport type { CommandFn, CommandUsage } from '../index.ts'\n\nexport { views } from '../exec-command.ts'\n\nexport const usage: CommandUsage = () =>\n commandUsage({\n command: 'run',\n usage: '<script> [args ...]',\n description: `Run a script defined in 'package.json', passing along any extra\n arguments. Note that vlt config values must be specified *before*\n the script name, because everything after that is handed off to\n the script process.`,\n })\n\nclass RunCommand extends ExecCommand<typeof run, typeof runFG> {\n constructor(conf: LoadedConfig) {\n super(conf, run, runFG)\n }\n\n // do not provide the interactive shell arg, just do nothing\n // so that it falls back up to the noArgsSingle() method\n defaultArg0(): undefined {}\n\n noArgsSingle(): ScriptSet {\n // called when there's no arg0, with a single workspace or root\n const cwd = this.getCwd()\n const { scripts = {} } = this.conf.options.packageJson.read(cwd)\n return scripts\n }\n\n noArgsMulti(): MultiScriptSet {\n const scripts: MultiScriptSet = {}\n for (const { label, manifest } of this.getTargets()) {\n if (manifest.scripts) scripts[label] = manifest.scripts\n }\n return scripts\n }\n}\n\nexport const command: CommandFn<ExecResult> = async conf =>\n await new RunCommand(conf).run()\n"]}
@@ -1,4 +1,10 @@
1
+ import type { Graph } from '@vltpkg/graph';
1
2
  import type { CommandFn, CommandUsage } from '../index.ts';
3
+ import { InstallReporter } from './install/reporter.ts';
2
4
  export declare const usage: CommandUsage;
3
- export declare const command: CommandFn<void>;
5
+ export declare const views: {
6
+ readonly json: (g: Graph) => import("@vltpkg/graph").LockfileData;
7
+ readonly human: typeof InstallReporter;
8
+ };
9
+ export declare const command: CommandFn<Graph>;
4
10
  //# sourceMappingURL=uninstall.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"uninstall.d.ts","sourceRoot":"","sources":["../../../src/commands/uninstall.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG1D,eAAO,MAAM,KAAK,EAAE,YAMhB,CAAA;AAEJ,eAAO,MAAM,OAAO,EAAE,SAAS,CAAC,IAAI,CAInC,CAAA"}
1
+ {"version":3,"file":"uninstall.d.ts","sourceRoot":"","sources":["../../../src/commands/uninstall.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAE1C,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAGvD,eAAO,MAAM,KAAK,EAAE,YAMhB,CAAA;AAEJ,eAAO,MAAM,KAAK;;;CAGe,CAAA;AAEjC,eAAO,MAAM,OAAO,EAAE,SAAS,CAAC,KAAK,CAKpC,CAAA"}
@@ -1,15 +1,21 @@
1
1
  import { uninstall } from '@vltpkg/graph';
2
2
  import { commandUsage } from "../config/usage.js";
3
3
  import { parseRemoveArgs } from "../parse-add-remove-args.js";
4
+ import { InstallReporter } from "./install/reporter.js";
4
5
  export const usage = () => commandUsage({
5
6
  command: 'uninstall',
6
7
  usage: '[package ...]',
7
8
  description: `The opposite of \`vlt install\`. Removes deps and updates
8
9
  vlt-lock.json and package.json appropriately.`,
9
10
  });
11
+ export const views = {
12
+ json: g => g.toJSON(),
13
+ human: InstallReporter,
14
+ };
10
15
  export const command = async (conf) => {
11
16
  const monorepo = conf.options.monorepo;
12
17
  const { remove } = parseRemoveArgs(conf, monorepo);
13
- await uninstall(conf.options, remove);
18
+ const { graph } = await uninstall(conf.options, remove);
19
+ return graph;
14
20
  };
15
21
  //# sourceMappingURL=uninstall.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"uninstall.js","sourceRoot":"","sources":["../../../src/commands/uninstall.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAE7D,MAAM,CAAC,MAAM,KAAK,GAAiB,GAAG,EAAE,CACtC,YAAY,CAAC;IACX,OAAO,EAAE,WAAW;IACpB,KAAK,EAAE,eAAe;IACtB,WAAW,EAAE;gEAC+C;CAC7D,CAAC,CAAA;AAEJ,MAAM,CAAC,MAAM,OAAO,GAAoB,KAAK,EAAC,IAAI,EAAC,EAAE;IACnD,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAA;IACtC,MAAM,EAAE,MAAM,EAAE,GAAG,eAAe,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;IAClD,MAAM,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;AACvC,CAAC,CAAA","sourcesContent":["import { uninstall } from '@vltpkg/graph'\nimport { commandUsage } from '../config/usage.ts'\nimport type { CommandFn, CommandUsage } from '../index.ts'\nimport { parseRemoveArgs } from '../parse-add-remove-args.ts'\n\nexport const usage: CommandUsage = () =>\n commandUsage({\n command: 'uninstall',\n usage: '[package ...]',\n description: `The opposite of \\`vlt install\\`. Removes deps and updates\n vlt-lock.json and package.json appropriately.`,\n })\n\nexport const command: CommandFn<void> = async conf => {\n const monorepo = conf.options.monorepo\n const { remove } = parseRemoveArgs(conf, monorepo)\n await uninstall(conf.options, remove)\n}\n"]}
1
+ {"version":3,"file":"uninstall.js","sourceRoot":"","sources":["../../../src/commands/uninstall.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAGvD,MAAM,CAAC,MAAM,KAAK,GAAiB,GAAG,EAAE,CACtC,YAAY,CAAC;IACX,OAAO,EAAE,WAAW;IACpB,KAAK,EAAE,eAAe;IACtB,WAAW,EAAE;gEAC+C;CAC7D,CAAC,CAAA;AAEJ,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE;IACrB,KAAK,EAAE,eAAe;CACS,CAAA;AAEjC,MAAM,CAAC,MAAM,OAAO,GAAqB,KAAK,EAAC,IAAI,EAAC,EAAE;IACpD,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAA;IACtC,MAAM,EAAE,MAAM,EAAE,GAAG,eAAe,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;IAClD,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;IACvD,OAAO,KAAK,CAAA;AACd,CAAC,CAAA","sourcesContent":["import { uninstall } from '@vltpkg/graph'\nimport type { Graph } from '@vltpkg/graph'\nimport { commandUsage } from '../config/usage.ts'\nimport type { CommandFn, CommandUsage } from '../index.ts'\nimport { parseRemoveArgs } from '../parse-add-remove-args.ts'\nimport { InstallReporter } from './install/reporter.ts'\nimport type { Views } from '../view.ts'\n\nexport const usage: CommandUsage = () =>\n commandUsage({\n command: 'uninstall',\n usage: '[package ...]',\n description: `The opposite of \\`vlt install\\`. Removes deps and updates\n vlt-lock.json and package.json appropriately.`,\n })\n\nexport const views = {\n json: g => g.toJSON(),\n human: InstallReporter,\n} as const satisfies Views<Graph>\n\nexport const command: CommandFn<Graph> = async conf => {\n const monorepo = conf.options.monorepo\n const { remove } = parseRemoveArgs(conf, monorepo)\n const { graph } = await uninstall(conf.options, remove)\n return graph\n}\n"]}
@@ -0,0 +1,10 @@
1
+ import type { Graph } from '@vltpkg/graph';
2
+ import type { CommandFn, CommandUsage } from '../index.ts';
3
+ import { InstallReporter } from './install/reporter.ts';
4
+ export declare const usage: CommandUsage;
5
+ export declare const views: {
6
+ readonly json: (g: Graph) => import("@vltpkg/graph").LockfileData;
7
+ readonly human: typeof InstallReporter;
8
+ };
9
+ export declare const command: CommandFn<Graph>;
10
+ //# sourceMappingURL=update.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/commands/update.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAE1C,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAGvD,eAAO,MAAM,KAAK,EAAE,YAMhB,CAAA;AAEJ,eAAO,MAAM,KAAK;;;CAGe,CAAA;AAEjC,eAAO,MAAM,OAAO,EAAE,SAAS,CAAC,KAAK,CAUpC,CAAA"}
@@ -0,0 +1,25 @@
1
+ import { update } from '@vltpkg/graph';
2
+ import { error } from '@vltpkg/error-cause';
3
+ import { commandUsage } from "../config/usage.js";
4
+ import { InstallReporter } from "./install/reporter.js";
5
+ export const usage = () => commandUsage({
6
+ command: 'update',
7
+ usage: '',
8
+ description: `Update dependencies to their latest in-range versions.
9
+ Discards the lockfile and resolves dependencies from scratch.`,
10
+ });
11
+ export const views = {
12
+ json: g => g.toJSON(),
13
+ human: InstallReporter,
14
+ };
15
+ export const command = async (conf) => {
16
+ // Throw error if any arguments are provided
17
+ if (conf.positionals.length > 0) {
18
+ throw error('Arguments are not yet supported for vlt update', {
19
+ code: 'EUSAGE',
20
+ });
21
+ }
22
+ const { graph } = await update(conf.options);
23
+ return graph;
24
+ };
25
+ //# sourceMappingURL=update.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/commands/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAE3C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAGvD,MAAM,CAAC,MAAM,KAAK,GAAiB,GAAG,EAAE,CACtC,YAAY,CAAC;IACX,OAAO,EAAE,QAAQ;IACjB,KAAK,EAAE,EAAE;IACT,WAAW,EAAE;gFAC+D;CAC7E,CAAC,CAAA;AAEJ,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE;IACrB,KAAK,EAAE,eAAe;CACS,CAAA;AAEjC,MAAM,CAAC,MAAM,OAAO,GAAqB,KAAK,EAAC,IAAI,EAAC,EAAE;IACpD,4CAA4C;IAC5C,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAChC,MAAM,KAAK,CAAC,gDAAgD,EAAE;YAC5D,IAAI,EAAE,QAAQ;SACf,CAAC,CAAA;IACJ,CAAC;IAED,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAC5C,OAAO,KAAK,CAAA;AACd,CAAC,CAAA","sourcesContent":["import { update } from '@vltpkg/graph'\nimport { error } from '@vltpkg/error-cause'\nimport type { Graph } from '@vltpkg/graph'\nimport { commandUsage } from '../config/usage.ts'\nimport type { CommandFn, CommandUsage } from '../index.ts'\nimport { InstallReporter } from './install/reporter.ts'\nimport type { Views } from '../view.ts'\n\nexport const usage: CommandUsage = () =>\n commandUsage({\n command: 'update',\n usage: '',\n description: `Update dependencies to their latest in-range versions.\n Discards the lockfile and resolves dependencies from scratch.`,\n })\n\nexport const views = {\n json: g => g.toJSON(),\n human: InstallReporter,\n} as const satisfies Views<Graph>\n\nexport const command: CommandFn<Graph> = async conf => {\n // Throw error if any arguments are provided\n if (conf.positionals.length > 0) {\n throw error('Arguments are not yet supported for vlt update', {\n code: 'EUSAGE',\n })\n }\n\n const { graph } = await update(conf.options)\n return graph\n}\n"]}
@@ -0,0 +1,22 @@
1
+ import type { CommandFn, CommandUsage } from '../index.ts';
2
+ export type VersionOptions = {
3
+ prereleaseId?: string;
4
+ commit?: boolean;
5
+ tag?: boolean;
6
+ message?: string;
7
+ tagMessage?: string;
8
+ };
9
+ export type VersionResult = {
10
+ oldVersion: string;
11
+ newVersion: string;
12
+ dir: string;
13
+ committed?: string[];
14
+ tag?: string;
15
+ };
16
+ export declare const usage: CommandUsage;
17
+ export declare const views: {
18
+ readonly json: (result: VersionResult) => VersionResult;
19
+ readonly human: (result: VersionResult) => string;
20
+ };
21
+ export declare const command: CommandFn<VersionResult>;
22
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/commands/version.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAM1D,MAAM,MAAM,cAAc,GAAG;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,GAAG,EAAE,MAAM,CAAA;IACX,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;IACpB,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,CAAA;AAoKD,eAAO,MAAM,KAAK,EAAE,YAanB,CAAA;AAED,eAAO,MAAM,KAAK;;;CAYuB,CAAA;AAEzC,eAAO,MAAM,OAAO,EAAE,SAAS,CAAC,aAAa,CAG5C,CAAA"}