@vltpkg/cli-sdk 0.0.0-2

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 (136) hide show
  1. package/LICENSE +15 -0
  2. package/README.md +20 -0
  3. package/dist/esm/commands/config.d.ts +5 -0
  4. package/dist/esm/commands/config.d.ts.map +1 -0
  5. package/dist/esm/commands/config.js +153 -0
  6. package/dist/esm/commands/config.js.map +1 -0
  7. package/dist/esm/commands/exec.d.ts +5 -0
  8. package/dist/esm/commands/exec.d.ts.map +1 -0
  9. package/dist/esm/commands/exec.js +22 -0
  10. package/dist/esm/commands/exec.js.map +1 -0
  11. package/dist/esm/commands/gui.d.ts +6 -0
  12. package/dist/esm/commands/gui.d.ts.map +1 -0
  13. package/dist/esm/commands/gui.js +14 -0
  14. package/dist/esm/commands/gui.js.map +1 -0
  15. package/dist/esm/commands/help.d.ts +4 -0
  16. package/dist/esm/commands/help.d.ts.map +1 -0
  17. package/dist/esm/commands/help.js +10 -0
  18. package/dist/esm/commands/help.js.map +1 -0
  19. package/dist/esm/commands/init.d.ts +9 -0
  20. package/dist/esm/commands/init.d.ts.map +1 -0
  21. package/dist/esm/commands/init.js +25 -0
  22. package/dist/esm/commands/init.js.map +1 -0
  23. package/dist/esm/commands/install/reporter.d.ts +10 -0
  24. package/dist/esm/commands/install/reporter.d.ts.map +1 -0
  25. package/dist/esm/commands/install/reporter.js +66 -0
  26. package/dist/esm/commands/install/reporter.js.map +1 -0
  27. package/dist/esm/commands/install-exec.d.ts +4 -0
  28. package/dist/esm/commands/install-exec.d.ts.map +1 -0
  29. package/dist/esm/commands/install-exec.js +13 -0
  30. package/dist/esm/commands/install-exec.js.map +1 -0
  31. package/dist/esm/commands/install.d.ts +7 -0
  32. package/dist/esm/commands/install.d.ts.map +1 -0
  33. package/dist/esm/commands/install.js +21 -0
  34. package/dist/esm/commands/install.js.map +1 -0
  35. package/dist/esm/commands/list.d.ts +15 -0
  36. package/dist/esm/commands/list.d.ts.map +1 -0
  37. package/dist/esm/commands/list.js +91 -0
  38. package/dist/esm/commands/list.js.map +1 -0
  39. package/dist/esm/commands/login.d.ts +4 -0
  40. package/dist/esm/commands/login.d.ts.map +1 -0
  41. package/dist/esm/commands/login.js +13 -0
  42. package/dist/esm/commands/login.js.map +1 -0
  43. package/dist/esm/commands/logout.d.ts +4 -0
  44. package/dist/esm/commands/logout.d.ts.map +1 -0
  45. package/dist/esm/commands/logout.js +13 -0
  46. package/dist/esm/commands/logout.js.map +1 -0
  47. package/dist/esm/commands/pkg.d.ts +8 -0
  48. package/dist/esm/commands/pkg.d.ts.map +1 -0
  49. package/dist/esm/commands/pkg.js +121 -0
  50. package/dist/esm/commands/pkg.js.map +1 -0
  51. package/dist/esm/commands/query.d.ts +16 -0
  52. package/dist/esm/commands/query.d.ts.map +1 -0
  53. package/dist/esm/commands/query.js +75 -0
  54. package/dist/esm/commands/query.js.map +1 -0
  55. package/dist/esm/commands/run-exec.d.ts +5 -0
  56. package/dist/esm/commands/run-exec.d.ts.map +1 -0
  57. package/dist/esm/commands/run-exec.js +13 -0
  58. package/dist/esm/commands/run-exec.js.map +1 -0
  59. package/dist/esm/commands/run.d.ts +5 -0
  60. package/dist/esm/commands/run.d.ts.map +1 -0
  61. package/dist/esm/commands/run.js +39 -0
  62. package/dist/esm/commands/run.js.map +1 -0
  63. package/dist/esm/commands/token.d.ts +4 -0
  64. package/dist/esm/commands/token.d.ts.map +1 -0
  65. package/dist/esm/commands/token.js +30 -0
  66. package/dist/esm/commands/token.js.map +1 -0
  67. package/dist/esm/commands/uninstall.d.ts +4 -0
  68. package/dist/esm/commands/uninstall.d.ts.map +1 -0
  69. package/dist/esm/commands/uninstall.js +15 -0
  70. package/dist/esm/commands/uninstall.js.map +1 -0
  71. package/dist/esm/commands/whoami.d.ts +11 -0
  72. package/dist/esm/commands/whoami.d.ts.map +1 -0
  73. package/dist/esm/commands/whoami.js +19 -0
  74. package/dist/esm/commands/whoami.js.map +1 -0
  75. package/dist/esm/config/definition.d.ts +286 -0
  76. package/dist/esm/config/definition.d.ts.map +1 -0
  77. package/dist/esm/config/definition.js +475 -0
  78. package/dist/esm/config/definition.js.map +1 -0
  79. package/dist/esm/config/index.d.ts +213 -0
  80. package/dist/esm/config/index.d.ts.map +1 -0
  81. package/dist/esm/config/index.js +504 -0
  82. package/dist/esm/config/index.js.map +1 -0
  83. package/dist/esm/config/merge.d.ts +2 -0
  84. package/dist/esm/config/merge.d.ts.map +1 -0
  85. package/dist/esm/config/merge.js +23 -0
  86. package/dist/esm/config/merge.js.map +1 -0
  87. package/dist/esm/config/usage.d.ts +18 -0
  88. package/dist/esm/config/usage.d.ts.map +1 -0
  89. package/dist/esm/config/usage.js +40 -0
  90. package/dist/esm/config/usage.js.map +1 -0
  91. package/dist/esm/exec-command.d.ts +34 -0
  92. package/dist/esm/exec-command.d.ts.map +1 -0
  93. package/dist/esm/exec-command.js +159 -0
  94. package/dist/esm/exec-command.js.map +1 -0
  95. package/dist/esm/ignored-homedir-folder-names.d.ts +7 -0
  96. package/dist/esm/ignored-homedir-folder-names.d.ts.map +1 -0
  97. package/dist/esm/ignored-homedir-folder-names.js +35 -0
  98. package/dist/esm/ignored-homedir-folder-names.js.map +1 -0
  99. package/dist/esm/index.d.ts +17 -0
  100. package/dist/esm/index.d.ts.map +1 -0
  101. package/dist/esm/index.js +47 -0
  102. package/dist/esm/index.js.map +1 -0
  103. package/dist/esm/output.d.ts +25 -0
  104. package/dist/esm/output.d.ts.map +1 -0
  105. package/dist/esm/output.js +86 -0
  106. package/dist/esm/output.js.map +1 -0
  107. package/dist/esm/package.json +3 -0
  108. package/dist/esm/parse-add-remove-args.d.ts +22 -0
  109. package/dist/esm/parse-add-remove-args.d.ts.map +1 -0
  110. package/dist/esm/parse-add-remove-args.js +71 -0
  111. package/dist/esm/parse-add-remove-args.js.map +1 -0
  112. package/dist/esm/print-err.d.ts +3 -0
  113. package/dist/esm/print-err.d.ts.map +1 -0
  114. package/dist/esm/print-err.js +47 -0
  115. package/dist/esm/print-err.js.map +1 -0
  116. package/dist/esm/project-info.d.ts +32 -0
  117. package/dist/esm/project-info.d.ts.map +1 -0
  118. package/dist/esm/project-info.js +90 -0
  119. package/dist/esm/project-info.js.map +1 -0
  120. package/dist/esm/read-password.d.ts +8 -0
  121. package/dist/esm/read-password.d.ts.map +1 -0
  122. package/dist/esm/read-password.js +33 -0
  123. package/dist/esm/read-password.js.map +1 -0
  124. package/dist/esm/read-project-folders.d.ts +27 -0
  125. package/dist/esm/read-project-folders.d.ts.map +1 -0
  126. package/dist/esm/read-project-folders.js +66 -0
  127. package/dist/esm/read-project-folders.js.map +1 -0
  128. package/dist/esm/start-gui.d.ts +36 -0
  129. package/dist/esm/start-gui.d.ts.map +1 -0
  130. package/dist/esm/start-gui.js +357 -0
  131. package/dist/esm/start-gui.js.map +1 -0
  132. package/dist/esm/view.d.ts +31 -0
  133. package/dist/esm/view.d.ts.map +1 -0
  134. package/dist/esm/view.js +31 -0
  135. package/dist/esm/view.js.map +1 -0
  136. package/package.json +107 -0
@@ -0,0 +1,91 @@
1
+ import { actual, humanReadableOutput, jsonOutput, mermaidOutput, } from '@vltpkg/graph';
2
+ import { Query } from '@vltpkg/query';
3
+ import { commandUsage } from "../config/usage.js";
4
+ import { startGUI } from "../start-gui.js";
5
+ export const usage = () => commandUsage({
6
+ command: 'ls',
7
+ usage: ['', '<query> --view=[human | json | mermaid | gui]'],
8
+ description: `List installed dependencies matching the provided query.
9
+ Defaults to listing direct dependencies of a project and
10
+ any configured workspace.`,
11
+ examples: {
12
+ '': {
13
+ description: 'List direct dependencies of the current project / workspace',
14
+ },
15
+ '*': {
16
+ description: 'List all dependencies for the current project / workspace',
17
+ },
18
+ 'foo bar baz': {
19
+ description: `List all dependencies named 'foo', 'bar', or 'baz'`,
20
+ },
21
+ [`'[name="@scoped/package"] > *'`]: {
22
+ description: 'Lists direct dependencies of a specific package',
23
+ },
24
+ [`'*.workspace > *.peer'`]: {
25
+ description: 'List all peer dependencies of all workspaces',
26
+ },
27
+ },
28
+ options: {
29
+ view: {
30
+ value: '[human | json | mermaid | gui]',
31
+ description: 'Output format. Defaults to human-readable or json if no tty.',
32
+ },
33
+ },
34
+ });
35
+ export const views = {
36
+ json: jsonOutput,
37
+ mermaid: mermaidOutput,
38
+ human: humanReadableOutput,
39
+ gui: async ({ queryString }, _, conf) => {
40
+ await startGUI({
41
+ conf,
42
+ startingRoute: '/explore?query=' + encodeURIComponent(queryString),
43
+ });
44
+ },
45
+ };
46
+ export const command = async (conf) => {
47
+ const monorepo = conf.options.monorepo;
48
+ const mainManifest = conf.options.packageJson.read(conf.options.projectRoot);
49
+ const graph = actual.load({
50
+ ...conf.options,
51
+ mainManifest,
52
+ monorepo,
53
+ loadManifests: true,
54
+ });
55
+ const queryString = conf.positionals
56
+ .map(k => (/^[@\w-]/.test(k) ? `#${k.replace(/\//, '\\/')}` : k))
57
+ .join(', ');
58
+ const query = new Query({ graph, specOptions: conf.options });
59
+ const projectQueryString = ':project, :project > *';
60
+ const selectImporters = [];
61
+ const importers = new Set();
62
+ if (monorepo) {
63
+ for (const workspace of monorepo.filter(conf.values)) {
64
+ const w = graph.nodes.get(workspace.id);
65
+ if (w) {
66
+ importers.add(w);
67
+ selectImporters.push(`[name="${w.name}"]`);
68
+ selectImporters.push(`[name="${w.name}"] > *`);
69
+ }
70
+ }
71
+ }
72
+ if (importers.size === 0) {
73
+ for (const importer of graph.importers) {
74
+ importers.add(importer);
75
+ }
76
+ }
77
+ const selectImportersQueryString = selectImporters.join(', ');
78
+ const defaultQueryString = (selectImporters.length &&
79
+ selectImporters.length < graph.importers.size) ?
80
+ selectImportersQueryString
81
+ : projectQueryString;
82
+ const { edges, nodes } = await query.search(queryString || defaultQueryString);
83
+ return {
84
+ importers,
85
+ edges,
86
+ nodes,
87
+ queryString: queryString || defaultQueryString,
88
+ highlightSelection: !!queryString,
89
+ };
90
+ };
91
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
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I,CAAC,CAAA;gBAC1C,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAA;YAChD,CAAC;QACH,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,MAAM,0BAA0B,GAAG,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC7D,MAAM,kBAAkB,GACtB,CACE,eAAe,CAAC,MAAM;QACtB,eAAe,CAAC,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,IAAI,CAC9C,CAAC,CAAC;QACD,0BAA0B;QAC5B,CAAC,CAAC,kBAAkB,CAAA;IAEtB,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,MAAM,KAAK,CAAC,MAAM,CACzC,WAAW,IAAI,kBAAkB,CAClC,CAAA;IAED,OAAO;QACL,SAAS;QACT,KAAK;QACL,KAAK;QACL,WAAW,EAAE,WAAW,IAAI,kBAAkB;QAC9C,kBAAkB,EAAE,CAAC,CAAC,WAAW;KAClC,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: 'ls',\n usage: ['', '<query> --view=[human | json | mermaid | gui]'],\n description: `List installed dependencies matching the provided query.\n Defaults to listing direct dependencies of a project and\n any configured workspace.`,\n examples: {\n '': {\n description:\n 'List direct dependencies of the current project / workspace',\n },\n '*': {\n description:\n 'List all dependencies for the current project / workspace',\n },\n 'foo bar baz': {\n description: `List all dependencies named 'foo', 'bar', or 'baz'`,\n },\n [`'[name=\"@scoped/package\"] > *'`]: {\n description:\n 'Lists direct dependencies of a specific package',\n },\n [`'*.workspace > *.peer'`]: {\n description: 'List all peer dependencies of all workspaces',\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\nexport type ListResult = 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<ListResult>\n\nexport const command: CommandFn<ListResult> = 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 queryString = conf.positionals\n .map(k => (/^[@\\w-]/.test(k) ? `#${k.replace(/\\//, '\\\\/')}` : k))\n .join(', ')\n const query = new Query({ graph, specOptions: conf.options })\n const projectQueryString = ':project, :project > *'\n const selectImporters: string[] = []\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) {\n importers.add(w)\n selectImporters.push(`[name=\"${w.name}\"]`)\n selectImporters.push(`[name=\"${w.name}\"] > *`)\n }\n }\n }\n if (importers.size === 0) {\n for (const importer of graph.importers) {\n importers.add(importer)\n }\n }\n\n const selectImportersQueryString = selectImporters.join(', ')\n const defaultQueryString =\n (\n selectImporters.length &&\n selectImporters.length < graph.importers.size\n ) ?\n selectImportersQueryString\n : projectQueryString\n\n const { edges, nodes } = await query.search(\n queryString || defaultQueryString,\n )\n\n return {\n importers,\n edges,\n nodes,\n queryString: queryString || defaultQueryString,\n highlightSelection: !!queryString,\n }\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import type { CommandFn, CommandUsage } from '../index.ts';
2
+ export declare const usage: CommandUsage;
3
+ export declare const command: CommandFn<void>;
4
+ //# sourceMappingURL=login.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/commands/login.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1D,eAAO,MAAM,KAAK,EAAE,YAMhB,CAAA;AAEJ,eAAO,MAAM,OAAO,EAAE,SAAS,CAAC,IAAI,CAGnC,CAAA"}
@@ -0,0 +1,13 @@
1
+ import { RegistryClient } from '@vltpkg/registry-client';
2
+ import { commandUsage } from "../config/usage.js";
3
+ export const usage = () => commandUsage({
4
+ command: 'login',
5
+ usage: [''],
6
+ description: `Authenticate against a registry, and store the token in
7
+ the appropriate config file for later use.`,
8
+ });
9
+ export const command = async (conf) => {
10
+ const rc = new RegistryClient(conf.options);
11
+ await rc.login(conf.options.registry);
12
+ };
13
+ //# sourceMappingURL=login.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login.js","sourceRoot":"","sources":["../../../src/commands/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAGjD,MAAM,CAAC,MAAM,KAAK,GAAiB,GAAG,EAAE,CACtC,YAAY,CAAC;IACX,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,WAAW,EAAE;6DAC4C;CAC1D,CAAC,CAAA;AAEJ,MAAM,CAAC,MAAM,OAAO,GAAoB,KAAK,EAAC,IAAI,EAAC,EAAE;IACnD,MAAM,EAAE,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAC3C,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;AACvC,CAAC,CAAA","sourcesContent":["import { RegistryClient } from '@vltpkg/registry-client'\nimport { commandUsage } from '../config/usage.ts'\nimport type { CommandFn, CommandUsage } from '../index.ts'\n\nexport const usage: CommandUsage = () =>\n commandUsage({\n command: 'login',\n usage: [''],\n description: `Authenticate against a registry, and store the token in\n the appropriate config file for later use.`,\n })\n\nexport const command: CommandFn<void> = async conf => {\n const rc = new RegistryClient(conf.options)\n await rc.login(conf.options.registry)\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import type { CommandFn, CommandUsage } from '../index.ts';
2
+ export declare const usage: CommandUsage;
3
+ export declare const command: CommandFn<void>;
4
+ //# sourceMappingURL=logout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../../src/commands/logout.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1D,eAAO,MAAM,KAAK,EAAE,YAMhB,CAAA;AAEJ,eAAO,MAAM,OAAO,EAAE,SAAS,CAAC,IAAI,CAGnC,CAAA"}
@@ -0,0 +1,13 @@
1
+ import { RegistryClient } from '@vltpkg/registry-client';
2
+ import { commandUsage } from "../config/usage.js";
3
+ export const usage = () => commandUsage({
4
+ command: 'logout',
5
+ usage: [''],
6
+ description: `Log out of the default registry, deleting the token from
7
+ the local keychain, as well as destroying it on the server.`,
8
+ });
9
+ export const command = async (conf) => {
10
+ const rc = new RegistryClient(conf.options);
11
+ await rc.logout(conf.options.registry);
12
+ };
13
+ //# sourceMappingURL=logout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logout.js","sourceRoot":"","sources":["../../../src/commands/logout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAGjD,MAAM,CAAC,MAAM,KAAK,GAAiB,GAAG,EAAE,CACtC,YAAY,CAAC;IACX,OAAO,EAAE,QAAQ;IACjB,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,WAAW,EAAE;8EAC6D;CAC3E,CAAC,CAAA;AAEJ,MAAM,CAAC,MAAM,OAAO,GAAoB,KAAK,EAAC,IAAI,EAAC,EAAE;IACnD,MAAM,EAAE,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAC3C,MAAM,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;AACxC,CAAC,CAAA","sourcesContent":["import { RegistryClient } from '@vltpkg/registry-client'\nimport { commandUsage } from '../config/usage.ts'\nimport type { CommandFn, CommandUsage } from '../index.ts'\n\nexport const usage: CommandUsage = () =>\n commandUsage({\n command: 'logout',\n usage: [''],\n description: `Log out of the default registry, deleting the token from\n the local keychain, as well as destroying it on the server.`,\n })\n\nexport const command: CommandFn<void> = async conf => {\n const rc = new RegistryClient(conf.options)\n await rc.logout(conf.options.registry)\n}\n"]}
@@ -0,0 +1,8 @@
1
+ import type { CommandFn, CommandUsage } from '../index.ts';
2
+ import type { ViewFn, Views } from '../view.ts';
3
+ export declare const views: Views & {
4
+ human: ViewFn;
5
+ };
6
+ export declare const usage: CommandUsage;
7
+ export declare const command: CommandFn;
8
+ //# sourceMappingURL=pkg.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pkg.d.ts","sourceRoot":"","sources":["../../../src/commands/pkg.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG1D,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAG/C,eAAO,MAAM,KAAK,EAAE,KAAK,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAa1C,CAAA;AAED,eAAO,MAAM,KAAK,EAAE,YAoChB,CAAA;AAEJ,eAAO,MAAM,OAAO,EAAE,SA6BrB,CAAA"}
@@ -0,0 +1,121 @@
1
+ import * as dotProp from '@vltpkg/dot-prop';
2
+ import { error } from '@vltpkg/error-cause';
3
+ import assert from 'assert';
4
+ import { commandUsage } from "../config/usage.js";
5
+ import { init } from '@vltpkg/init';
6
+ import { views as initViews } from "./init.js";
7
+ export const views = {
8
+ human: (results, options, config) => {
9
+ // `vlt pkg init` is an alias for `vlt init`
10
+ // use the same output handling
11
+ if (config.positionals[0] === 'init') {
12
+ return initViews.human(results, options, config);
13
+ }
14
+ return results;
15
+ },
16
+ };
17
+ export const usage = () => commandUsage({
18
+ command: 'pkg',
19
+ usage: '[<command>] [<args>]',
20
+ description: 'Get or manipulate package.json values',
21
+ subcommands: {
22
+ get: {
23
+ usage: '[<key>]',
24
+ description: 'Get a single value',
25
+ },
26
+ init: {
27
+ usage: '',
28
+ description: 'Initialize a new package.json file in the current directory',
29
+ },
30
+ pick: {
31
+ usage: '[<key> [<key> ...]]',
32
+ description: 'Get multiple values or the entire package',
33
+ },
34
+ set: {
35
+ usage: '<key>=<value> [<key>=<value> ...]',
36
+ description: 'Set one or more key value pairs',
37
+ },
38
+ delete: {
39
+ usage: '<key> [<key> ...]',
40
+ description: 'Delete one or more keys from the package',
41
+ },
42
+ },
43
+ examples: {
44
+ 'set "array[1].key=value"': {
45
+ description: 'Set a value on an object inside an array',
46
+ },
47
+ 'set "array[]=value"': {
48
+ description: 'Append a value to an array',
49
+ },
50
+ },
51
+ });
52
+ export const command = async (conf) => {
53
+ const [sub, ...args] = conf.positionals;
54
+ if (sub === 'init') {
55
+ return await init({ cwd: process.cwd() });
56
+ }
57
+ const pkg = conf.options.packageJson;
58
+ const mani = pkg.read(conf.projectRoot);
59
+ switch (sub) {
60
+ case 'get':
61
+ return get(mani, args);
62
+ case 'pick':
63
+ return pick(mani, args);
64
+ case 'set':
65
+ return set(conf, mani, pkg, args);
66
+ case 'rm':
67
+ case 'remove':
68
+ case 'unset':
69
+ case 'delete':
70
+ return rm(conf, mani, pkg, args);
71
+ default: {
72
+ throw error('Unrecognized pkg command', {
73
+ code: 'EUSAGE',
74
+ found: sub,
75
+ validOptions: ['get', 'set', 'rm'],
76
+ });
77
+ }
78
+ }
79
+ };
80
+ const get = (mani, args) => {
81
+ const noArg = () => error('get requires not more than 1 argument. use `pick` to get more than 1.', { code: 'EUSAGE' }, noArg);
82
+ if (args.length !== 1) {
83
+ if (args.length > 1) {
84
+ throw noArg();
85
+ }
86
+ return pick(mani, args);
87
+ }
88
+ assert(args[0], noArg());
89
+ return dotProp.get(mani, args[0]);
90
+ };
91
+ const pick = (mani, args) => {
92
+ return args.length ?
93
+ args.reduce((acc, key) => dotProp.set(acc, key, dotProp.get(mani, key)), {})
94
+ : mani;
95
+ };
96
+ const set = (conf, mani, pkg, args) => {
97
+ if (args.length < 1) {
98
+ throw error('set requires arguments', { code: 'EUSAGE' });
99
+ }
100
+ const res = args.reduce((acc, p) => {
101
+ const index = p.indexOf('=');
102
+ if (index === -1) {
103
+ throw error('set arguments must contain `=`', {
104
+ code: 'EUSAGE',
105
+ });
106
+ }
107
+ return dotProp.set(acc, p.substring(0, index), p.substring(index + 1));
108
+ }, mani);
109
+ pkg.write(conf.projectRoot, res);
110
+ };
111
+ const rm = (conf, mani, pkg, args) => {
112
+ if (args.length < 1) {
113
+ throw error('rm requires arguments', { code: 'EUSAGE' });
114
+ }
115
+ const res = args.reduce((acc, key) => {
116
+ dotProp.del(acc, key);
117
+ return acc;
118
+ }, mani);
119
+ pkg.write(conf.projectRoot, res);
120
+ };
121
+ //# sourceMappingURL=pkg.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pkg.js","sourceRoot":"","sources":["../../../src/commands/pkg.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,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C5B,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;YACjB,MAAM,KAAK,CAAC,gCAAgC,EAAE;gBAC5C,IAAI,EAAE,QAAQ;aACf,CAAC,CAAA;QACJ,CAAC;QACD,OAAO,OAAO,CAAC,GAAG,CAChB,GAAG,EACH,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,EACrB,CAAC,CAAC,SAAS,CAAC,KAAK,GAAG,CAAC,CAAC,CACvB,CAAA;IACH,CAAC,EAAE,IAAI,CAAC,CAAA;IAER,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC,CAAA;AAClC,CAAC,CAAA;AAED,MAAM,EAAE,GAAG,CACT,IAAkB,EAClB,IAAc,EACd,GAAgB,EAChB,IAAc,EACd,EAAE;IACF,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpB,MAAM,KAAK,CAAC,uBAAuB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAA;IAC1D,CAAC;IAED,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QACnC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;QACrB,OAAO,GAAG,CAAA;IACZ,CAAC,EAAE,IAAI,CAAC,CAAA;IAER,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC,CAAA;AAClC,CAAC,CAAA","sourcesContent":["import * as dotProp from '@vltpkg/dot-prop'\nimport { error } from '@vltpkg/error-cause'\nimport type { PackageJson } from '@vltpkg/package-json'\nimport type { Manifest } from '@vltpkg/types'\nimport assert from 'assert'\nimport type { LoadedConfig } from '../config/index.ts'\nimport { commandUsage } from '../config/usage.ts'\nimport type { CommandFn, CommandUsage } from '../index.ts'\nimport { init } from '@vltpkg/init'\nimport type { InitFileResults } from '@vltpkg/init'\nimport type { ViewFn, Views } from '../view.ts'\nimport { views as initViews } from './init.ts'\n\nexport const views: Views & { human: ViewFn } = {\n human: (results, options, config) => {\n // `vlt pkg init` is an alias for `vlt init`\n // use the same output handling\n if (config.positionals[0] === 'init') {\n return initViews.human(\n results as InitFileResults,\n options,\n config,\n )\n }\n return results\n },\n}\n\nexport const usage: CommandUsage = () =>\n commandUsage({\n command: 'pkg',\n usage: '[<command>] [<args>]',\n description: 'Get or manipulate package.json values',\n subcommands: {\n get: {\n usage: '[<key>]',\n description: 'Get a single value',\n },\n init: {\n usage: '',\n description:\n 'Initialize a new package.json file in the current directory',\n },\n pick: {\n usage: '[<key> [<key> ...]]',\n description: 'Get multiple values or the entire package',\n },\n set: {\n usage: '<key>=<value> [<key>=<value> ...]',\n description: 'Set one or more key value pairs',\n },\n delete: {\n usage: '<key> [<key> ...]',\n description: 'Delete one or more keys from the package',\n },\n },\n examples: {\n 'set \"array[1].key=value\"': {\n description: 'Set a value on an object inside an array',\n },\n 'set \"array[]=value\"': {\n description: 'Append a value to an array',\n },\n },\n })\n\nexport const command: CommandFn = async conf => {\n const [sub, ...args] = conf.positionals\n if (sub === 'init') {\n return await init({ cwd: process.cwd() })\n }\n\n const pkg = conf.options.packageJson\n const mani = pkg.read(conf.projectRoot)\n\n switch (sub) {\n case 'get':\n return get(mani, args)\n case 'pick':\n return pick(mani, args)\n case 'set':\n return set(conf, mani, pkg, args)\n case 'rm':\n case 'remove':\n case 'unset':\n case 'delete':\n return rm(conf, mani, pkg, args)\n default: {\n throw error('Unrecognized pkg command', {\n code: 'EUSAGE',\n found: sub,\n validOptions: ['get', 'set', 'rm'],\n })\n }\n }\n}\n\nconst get = (mani: Manifest, args: string[]) => {\n const noArg = () =>\n error(\n 'get requires not more than 1 argument. use `pick` to get more than 1.',\n { code: 'EUSAGE' },\n noArg,\n )\n if (args.length !== 1) {\n if (args.length > 1) {\n throw noArg()\n }\n return pick(mani, args)\n }\n assert(args[0], noArg())\n return dotProp.get(mani, args[0])\n}\n\nconst pick = (mani: Manifest, args: string[]) => {\n return args.length ?\n args.reduce(\n (acc, key) => dotProp.set(acc, key, dotProp.get(mani, key)),\n {},\n )\n : mani\n}\n\nconst set = (\n conf: LoadedConfig,\n mani: Manifest,\n pkg: PackageJson,\n args: string[],\n) => {\n if (args.length < 1) {\n throw error('set requires arguments', { code: 'EUSAGE' })\n }\n\n const res = args.reduce((acc, p) => {\n const index = p.indexOf('=')\n if (index === -1) {\n throw error('set arguments must contain `=`', {\n code: 'EUSAGE',\n })\n }\n return dotProp.set(\n acc,\n p.substring(0, index),\n p.substring(index + 1),\n )\n }, mani)\n\n pkg.write(conf.projectRoot, res)\n}\n\nconst rm = (\n conf: LoadedConfig,\n mani: Manifest,\n pkg: PackageJson,\n args: string[],\n) => {\n if (args.length < 1) {\n throw error('rm requires arguments', { code: 'EUSAGE' })\n }\n\n const res = args.reduce((acc, key) => {\n dotProp.del(acc, key)\n return acc\n }, mani)\n\n pkg.write(conf.projectRoot, res)\n}\n"]}
@@ -0,0 +1,16 @@
1
+ import { humanReadableOutput, jsonOutput, mermaidOutput } from '@vltpkg/graph';
2
+ import type { HumanReadableOutputGraph, JSONOutputGraph, MermaidOutputGraph } from '@vltpkg/graph';
3
+ import type { CommandFn, CommandUsage } from '../index.ts';
4
+ export declare const usage: CommandUsage;
5
+ type QueryResult = JSONOutputGraph & MermaidOutputGraph & HumanReadableOutputGraph & {
6
+ queryString: string;
7
+ };
8
+ export declare const views: {
9
+ readonly json: typeof jsonOutput;
10
+ readonly mermaid: typeof mermaidOutput;
11
+ readonly human: typeof humanReadableOutput;
12
+ readonly gui: ({ queryString }: QueryResult, _: import("../view.ts").ViewOptions, conf: import("../config/index.ts").LoadedConfig) => Promise<void>;
13
+ };
14
+ export declare const command: CommandFn<QueryResult>;
15
+ export {};
16
+ //# sourceMappingURL=query.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../src/commands/query.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,mBAAmB,EACnB,UAAU,EACV,aAAa,EACd,MAAM,eAAe,CAAA;AACtB,OAAO,KAAK,EACV,wBAAwB,EACxB,eAAe,EACf,kBAAkB,EAEnB,MAAM,eAAe,CAAA;AAGtB,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAI1D,eAAO,MAAM,KAAK,EAAE,YA6BhB,CAAA;AAEJ,KAAK,WAAW,GAAG,eAAe,GAChC,kBAAkB,GAClB,wBAAwB,GAAG;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,CAAA;AAEpD,eAAO,MAAM,KAAK;;;;;CAWqB,CAAA;AAEvC,eAAO,MAAM,OAAO,EAAE,SAAS,CAAC,WAAW,CAuC1C,CAAA"}
@@ -0,0 +1,75 @@
1
+ import { actual, humanReadableOutput, jsonOutput, mermaidOutput, } from '@vltpkg/graph';
2
+ import { Query } from '@vltpkg/query';
3
+ import { commandUsage } from "../config/usage.js";
4
+ import { startGUI } from "../start-gui.js";
5
+ export const usage = () => commandUsage({
6
+ command: 'query',
7
+ usage: ['', '<query> --view=[human | json | mermaid | gui]'],
8
+ description: 'List installed dependencies matching the provided query.',
9
+ examples: {
10
+ [`'#foo'`]: {
11
+ description: 'Query packages with the name "foo"',
12
+ },
13
+ [`'*.workspace > *.peer'`]: {
14
+ description: 'Query all peer dependencies of workspaces',
15
+ },
16
+ [`':project > *:attr(scripts, [build])'`]: {
17
+ description: 'Query all direct project dependencies with a "build" script',
18
+ },
19
+ [`'[name^="@vltpkg"]'`]: {
20
+ description: 'Query packages with names starting with "@vltpkg"',
21
+ },
22
+ },
23
+ options: {
24
+ view: {
25
+ value: '[human | json | mermaid | gui]',
26
+ description: 'Output format. Defaults to human-readable or json if no tty.',
27
+ },
28
+ },
29
+ });
30
+ export const views = {
31
+ json: jsonOutput,
32
+ mermaid: mermaidOutput,
33
+ human: humanReadableOutput,
34
+ gui: async ({ queryString }, _, conf) => {
35
+ await startGUI({
36
+ conf,
37
+ startingRoute: '/explore?query=' + encodeURIComponent(queryString),
38
+ });
39
+ },
40
+ };
41
+ export const command = async (conf) => {
42
+ const monorepo = conf.options.monorepo;
43
+ const mainManifest = conf.options.packageJson.read(conf.options.projectRoot);
44
+ const graph = actual.load({
45
+ ...conf.options,
46
+ mainManifest,
47
+ monorepo,
48
+ loadManifests: true,
49
+ });
50
+ 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);
54
+ 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);
60
+ }
61
+ }
62
+ if (importers.size === 0) {
63
+ for (const importer of graph.importers) {
64
+ importers.add(importer);
65
+ }
66
+ }
67
+ return {
68
+ importers,
69
+ edges,
70
+ nodes,
71
+ highlightSelection: !!queryString,
72
+ queryString: queryString || defaultQueryString,
73
+ };
74
+ };
75
+ //# sourceMappingURL=query.js.map
@@ -0,0 +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,CAAC,QAAQ,CAAC,EAAE;YACV,WAAW,EAAE,o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,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"]}
@@ -0,0 +1,5 @@
1
+ import type { ExecResult } from '../exec-command.ts';
2
+ import type { CommandFn, CommandUsage } from '../index.ts';
3
+ export declare const usage: CommandUsage;
4
+ export declare const command: CommandFn<ExecResult>;
5
+ //# sourceMappingURL=run-exec.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,13 @@
1
+ import { runExec, runExecFG } from '@vltpkg/run';
2
+ import { commandUsage } from "../config/usage.js";
3
+ import { ExecCommand } from "../exec-command.js";
4
+ export const usage = () => commandUsage({
5
+ command: 'run-exec',
6
+ usage: '[command ...]',
7
+ description: `If the first argument is a defined script in package.json, then this is
8
+ equivalent to \`vlt run\`.
9
+
10
+ If not, then this is equivalent to \`vlt exec\`.`,
11
+ });
12
+ export const command = async (conf) => await new ExecCommand(conf, runExec, runExecFG).run();
13
+ //# sourceMappingURL=run-exec.js.map
@@ -0,0 +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"]}
@@ -0,0 +1,5 @@
1
+ import type { ExecResult } from '../exec-command.ts';
2
+ import type { CommandFn, CommandUsage } from '../index.ts';
3
+ export declare const usage: CommandUsage;
4
+ export declare const command: CommandFn<ExecResult>;
5
+ //# sourceMappingURL=run.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,39 @@
1
+ import { PackageJson } from '@vltpkg/package-json';
2
+ import { run, runFG } from '@vltpkg/run';
3
+ import { commandUsage } from "../config/usage.js";
4
+ import { ExecCommand } from "../exec-command.js";
5
+ import { stdout } from "../output.js";
6
+ export const usage = () => commandUsage({
7
+ command: 'run',
8
+ usage: '<script> [args ...]',
9
+ description: `Run a script defined in 'package.json', passing along any extra
10
+ arguments. Note that vlt config values must be specified *before*
11
+ the script name, because everything after that is handed off to
12
+ the script process.`,
13
+ });
14
+ class RunCommand extends ExecCommand {
15
+ constructor(conf) {
16
+ super(conf, run, runFG);
17
+ }
18
+ defaultArg0() {
19
+ // 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;
26
+ }
27
+ 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);
35
+ }
36
+ }
37
+ }
38
+ export const command = async (conf) => await new RunCommand(conf).run();
39
+ //# sourceMappingURL=run.js.map
@@ -0,0 +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,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,WAAW;QACT,+DAA+D;QAC/D,MAAM,EAAE,GAAG,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAA;QAC/C,MAAM,GAAG,GAAG,EAAE,EAAE,QAAQ,IAAI,IAAI,CAAC,WAAW,CAAA;QAC5C,MAAM,WAAW,GACf,IAAI,CAAC,QAAQ,EAAE,WAAW,IAAI,IAAI,WAAW,EAAE,CAAA;QACjD,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QAClC,MAAM,CAAC,oBAAoB,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;QAC1C,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,WAAW;QACT,MAAM,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAA;QACvB,sCAAsC;QACtC,IAAI,CAAC,CAAC;YAAE,OAAM;QAEd,MAAM,CAAC,oBAAoB,CAAC,CAAA;QAC5B,KAAK,MAAM,CAAC,EAAE,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,CACnC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,OAAO,CAC1B,EAAE,CAAC;YACF,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QAC1B,CAAC;IACH,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 { 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"]}
@@ -0,0 +1,4 @@
1
+ import type { CommandFn, CommandUsage } from '../index.ts';
2
+ export declare const usage: CommandUsage;
3
+ export declare const command: CommandFn<void>;
4
+ //# sourceMappingURL=token.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../../src/commands/token.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1D,eAAO,MAAM,KAAK,EAAE,YAKhB,CAAA;AAEJ,eAAO,MAAM,OAAO,EAAE,SAAS,CAAC,IAAI,CAyBnC,CAAA"}
@@ -0,0 +1,30 @@
1
+ import { error } from '@vltpkg/error-cause';
2
+ import { deleteToken, setToken } from '@vltpkg/registry-client';
3
+ import { commandUsage } from "../config/usage.js";
4
+ import { readPassword } from "../read-password.js";
5
+ export const usage = () => commandUsage({
6
+ command: 'token',
7
+ usage: ['add', 'rm'],
8
+ description: `Explicitly add or remove tokens in the vlt keychain`,
9
+ });
10
+ export const command = async (conf) => {
11
+ const reg = new URL(conf.options.registry).origin;
12
+ switch (conf.positionals[0]) {
13
+ case 'add': {
14
+ await setToken(reg, `Bearer ${await readPassword('Paste bearer token: ')}`, conf.options.identity);
15
+ break;
16
+ }
17
+ case 'rm': {
18
+ await deleteToken(reg, conf.options.identity);
19
+ break;
20
+ }
21
+ default: {
22
+ throw error('Invalid token subcommand', {
23
+ found: conf.positionals[0],
24
+ validOptions: ['add', 'rm'],
25
+ code: 'EUSAGE',
26
+ });
27
+ }
28
+ }
29
+ };
30
+ //# sourceMappingURL=token.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token.js","sourceRoot":"","sources":["../../../src/commands/token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAGlD,MAAM,CAAC,MAAM,KAAK,GAAiB,GAAG,EAAE,CACtC,YAAY,CAAC;IACX,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC;IACpB,WAAW,EAAE,qDAAqD;CACnE,CAAC,CAAA;AAEJ,MAAM,CAAC,MAAM,OAAO,GAAoB,KAAK,EAAC,IAAI,EAAC,EAAE;IACnD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAA;IACjD,QAAQ,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5B,KAAK,KAAK,CAAC,CAAC,CAAC;YACX,MAAM,QAAQ,CACZ,GAAG,EACH,UAAU,MAAM,YAAY,CAAC,sBAAsB,CAAC,EAAE,EACtD,IAAI,CAAC,OAAO,CAAC,QAAQ,CACtB,CAAA;YACD,MAAK;QACP,CAAC;QAED,KAAK,IAAI,CAAC,CAAC,CAAC;YACV,MAAM,WAAW,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;YAC7C,MAAK;QACP,CAAC;QAED,OAAO,CAAC,CAAC,CAAC;YACR,MAAM,KAAK,CAAC,0BAA0B,EAAE;gBACtC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;gBAC1B,YAAY,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC;gBAC3B,IAAI,EAAE,QAAQ;aACf,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;AACH,CAAC,CAAA","sourcesContent":["import { error } from '@vltpkg/error-cause'\nimport { deleteToken, setToken } from '@vltpkg/registry-client'\nimport { commandUsage } from '../config/usage.ts'\nimport { readPassword } from '../read-password.ts'\nimport type { CommandFn, CommandUsage } from '../index.ts'\n\nexport const usage: CommandUsage = () =>\n commandUsage({\n command: 'token',\n usage: ['add', 'rm'],\n description: `Explicitly add or remove tokens in the vlt keychain`,\n })\n\nexport const command: CommandFn<void> = async conf => {\n const reg = new URL(conf.options.registry).origin\n switch (conf.positionals[0]) {\n case 'add': {\n await setToken(\n reg,\n `Bearer ${await readPassword('Paste bearer token: ')}`,\n conf.options.identity,\n )\n break\n }\n\n case 'rm': {\n await deleteToken(reg, conf.options.identity)\n break\n }\n\n default: {\n throw error('Invalid token subcommand', {\n found: conf.positionals[0],\n validOptions: ['add', 'rm'],\n code: 'EUSAGE',\n })\n }\n }\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import type { CommandFn, CommandUsage } from '../index.ts';
2
+ export declare const usage: CommandUsage;
3
+ export declare const command: CommandFn<void>;
4
+ //# sourceMappingURL=uninstall.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,15 @@
1
+ import { uninstall } from '@vltpkg/graph';
2
+ import { commandUsage } from "../config/usage.js";
3
+ import { parseRemoveArgs } from "../parse-add-remove-args.js";
4
+ export const usage = () => commandUsage({
5
+ command: 'uninstall',
6
+ usage: '[package ...]',
7
+ description: `The opposite of \`vlt install\`. Removes deps and updates
8
+ vlt-lock.json and package.json appropriately.`,
9
+ });
10
+ export const command = async (conf) => {
11
+ const monorepo = conf.options.monorepo;
12
+ const { remove } = parseRemoveArgs(conf, monorepo);
13
+ await uninstall(conf.options, remove);
14
+ };
15
+ //# sourceMappingURL=uninstall.js.map
@@ -0,0 +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"]}
@@ -0,0 +1,11 @@
1
+ import type { JSONField } from '@vltpkg/types';
2
+ import type { CommandFn, CommandUsage } from '../index.ts';
3
+ import type { Views } from '../view.ts';
4
+ export declare const usage: CommandUsage;
5
+ type CommandResult = {
6
+ username?: JSONField;
7
+ };
8
+ export declare const views: Views<CommandResult>;
9
+ export declare const command: CommandFn<CommandResult>;
10
+ export {};
11
+ //# sourceMappingURL=whoami.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"whoami.d.ts","sourceRoot":"","sources":["../../../src/commands/whoami.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE9C,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAEvC,eAAO,MAAM,KAAK,EAAE,YAMhB,CAAA;AAEJ,KAAK,aAAa,GAAG;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB,CAAA;AAED,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,aAAa,CAGtC,CAAA;AAED,eAAO,MAAM,OAAO,EAAE,SAAS,CAAC,aAAa,CAQ5C,CAAA"}