@vltpkg/cli-sdk 0.0.0-9 → 1.0.0-rc.10

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 (157) hide show
  1. package/dist/esm/commands/bugs.d.ts +18 -0
  2. package/dist/esm/commands/bugs.d.ts.map +1 -0
  3. package/dist/esm/commands/bugs.js +164 -0
  4. package/dist/esm/commands/bugs.js.map +1 -0
  5. package/dist/esm/commands/build.d.ts +25 -0
  6. package/dist/esm/commands/build.d.ts.map +1 -0
  7. package/dist/esm/commands/build.js +102 -0
  8. package/dist/esm/commands/build.js.map +1 -0
  9. package/dist/esm/commands/cache.d.ts +18 -0
  10. package/dist/esm/commands/cache.d.ts.map +1 -1
  11. package/dist/esm/commands/cache.js +48 -2
  12. package/dist/esm/commands/cache.js.map +1 -1
  13. package/dist/esm/commands/ci.d.ts +11 -0
  14. package/dist/esm/commands/ci.d.ts.map +1 -0
  15. package/dist/esm/commands/ci.js +32 -0
  16. package/dist/esm/commands/ci.js.map +1 -0
  17. package/dist/esm/commands/config.d.ts +3 -2
  18. package/dist/esm/commands/config.d.ts.map +1 -1
  19. package/dist/esm/commands/config.js +372 -101
  20. package/dist/esm/commands/config.js.map +1 -1
  21. package/dist/esm/commands/docs.d.ts +18 -0
  22. package/dist/esm/commands/docs.d.ts.map +1 -0
  23. package/dist/esm/commands/docs.js +154 -0
  24. package/dist/esm/commands/docs.js.map +1 -0
  25. package/dist/esm/commands/exec-cache.d.ts +49 -0
  26. package/dist/esm/commands/exec-cache.d.ts.map +1 -0
  27. package/dist/esm/commands/exec-cache.js +146 -0
  28. package/dist/esm/commands/exec-cache.js.map +1 -0
  29. package/dist/esm/commands/exec-local.d.ts +1 -0
  30. package/dist/esm/commands/exec-local.d.ts.map +1 -1
  31. package/dist/esm/commands/exec-local.js +2 -0
  32. package/dist/esm/commands/exec-local.js.map +1 -1
  33. package/dist/esm/commands/exec.d.ts +6 -1
  34. package/dist/esm/commands/exec.d.ts.map +1 -1
  35. package/dist/esm/commands/exec.js +79 -5
  36. package/dist/esm/commands/exec.js.map +1 -1
  37. package/dist/esm/commands/help.d.ts +1 -1
  38. package/dist/esm/commands/help.d.ts.map +1 -1
  39. package/dist/esm/commands/help.js +32 -3
  40. package/dist/esm/commands/help.js.map +1 -1
  41. package/dist/esm/commands/init.d.ts +3 -3
  42. package/dist/esm/commands/init.d.ts.map +1 -1
  43. package/dist/esm/commands/init.js +95 -9
  44. package/dist/esm/commands/init.js.map +1 -1
  45. package/dist/esm/commands/install/reporter.d.ts +3 -2
  46. package/dist/esm/commands/install/reporter.d.ts.map +1 -1
  47. package/dist/esm/commands/install/reporter.js +42 -15
  48. package/dist/esm/commands/install/reporter.js.map +1 -1
  49. package/dist/esm/commands/install.d.ts +21 -3
  50. package/dist/esm/commands/install.d.ts.map +1 -1
  51. package/dist/esm/commands/install.js +29 -4
  52. package/dist/esm/commands/install.js.map +1 -1
  53. package/dist/esm/commands/list.d.ts +2 -2
  54. package/dist/esm/commands/list.d.ts.map +1 -1
  55. package/dist/esm/commands/list.js +149 -49
  56. package/dist/esm/commands/list.js.map +1 -1
  57. package/dist/esm/commands/pack.d.ts +32 -0
  58. package/dist/esm/commands/pack.d.ts.map +1 -0
  59. package/dist/esm/commands/pack.js +147 -0
  60. package/dist/esm/commands/pack.js.map +1 -0
  61. package/dist/esm/commands/pkg.d.ts +1 -2
  62. package/dist/esm/commands/pkg.d.ts.map +1 -1
  63. package/dist/esm/commands/pkg.js +123 -38
  64. package/dist/esm/commands/pkg.js.map +1 -1
  65. package/dist/esm/commands/publish.d.ts +22 -0
  66. package/dist/esm/commands/publish.d.ts.map +1 -0
  67. package/dist/esm/commands/publish.js +245 -0
  68. package/dist/esm/commands/publish.js.map +1 -0
  69. package/dist/esm/commands/query.d.ts +2 -3
  70. package/dist/esm/commands/query.d.ts.map +1 -1
  71. package/dist/esm/commands/query.js +132 -38
  72. package/dist/esm/commands/query.js.map +1 -1
  73. package/dist/esm/commands/run-exec.d.ts +1 -0
  74. package/dist/esm/commands/run-exec.d.ts.map +1 -1
  75. package/dist/esm/commands/run-exec.js +1 -0
  76. package/dist/esm/commands/run-exec.js.map +1 -1
  77. package/dist/esm/commands/run.d.ts +1 -0
  78. package/dist/esm/commands/run.d.ts.map +1 -1
  79. package/dist/esm/commands/run.js +13 -16
  80. package/dist/esm/commands/run.js.map +1 -1
  81. package/dist/esm/commands/serve.d.ts +14 -0
  82. package/dist/esm/commands/serve.d.ts.map +1 -0
  83. package/dist/esm/commands/serve.js +103 -0
  84. package/dist/esm/commands/serve.js.map +1 -0
  85. package/dist/esm/commands/uninstall.d.ts +8 -2
  86. package/dist/esm/commands/uninstall.d.ts.map +1 -1
  87. package/dist/esm/commands/uninstall.js +10 -5
  88. package/dist/esm/commands/uninstall.js.map +1 -1
  89. package/dist/esm/commands/update.d.ts +14 -0
  90. package/dist/esm/commands/update.d.ts.map +1 -0
  91. package/dist/esm/commands/update.js +41 -0
  92. package/dist/esm/commands/update.js.map +1 -0
  93. package/dist/esm/commands/version.d.ts +26 -0
  94. package/dist/esm/commands/version.d.ts.map +1 -0
  95. package/dist/esm/commands/version.js +226 -0
  96. package/dist/esm/commands/version.js.map +1 -0
  97. package/dist/esm/config/definition.d.ts +119 -15
  98. package/dist/esm/config/definition.d.ts.map +1 -1
  99. package/dist/esm/config/definition.js +186 -37
  100. package/dist/esm/config/definition.js.map +1 -1
  101. package/dist/esm/config/index.d.ts +41 -37
  102. package/dist/esm/config/index.d.ts.map +1 -1
  103. package/dist/esm/config/index.js +109 -172
  104. package/dist/esm/config/index.js.map +1 -1
  105. package/dist/esm/config/merge.d.ts +3 -1
  106. package/dist/esm/config/merge.d.ts.map +1 -1
  107. package/dist/esm/config/merge.js +11 -6
  108. package/dist/esm/config/merge.js.map +1 -1
  109. package/dist/esm/custom-help.d.ts +9 -0
  110. package/dist/esm/custom-help.d.ts.map +1 -0
  111. package/dist/esm/custom-help.js +400 -0
  112. package/dist/esm/custom-help.js.map +1 -0
  113. package/dist/esm/exec-command.d.ts +33 -14
  114. package/dist/esm/exec-command.d.ts.map +1 -1
  115. package/dist/esm/exec-command.js +213 -64
  116. package/dist/esm/exec-command.js.map +1 -1
  117. package/dist/esm/index.d.ts +1 -14
  118. package/dist/esm/index.d.ts.map +1 -1
  119. package/dist/esm/index.js +45 -19
  120. package/dist/esm/index.js.map +1 -1
  121. package/dist/esm/load-command.d.ts +16 -0
  122. package/dist/esm/load-command.d.ts.map +1 -0
  123. package/dist/esm/load-command.js +21 -0
  124. package/dist/esm/load-command.js.map +1 -0
  125. package/dist/esm/output.d.ts +6 -11
  126. package/dist/esm/output.d.ts.map +1 -1
  127. package/dist/esm/output.js +64 -27
  128. package/dist/esm/output.js.map +1 -1
  129. package/dist/esm/pack-tarball.d.ts +22 -0
  130. package/dist/esm/pack-tarball.d.ts.map +1 -0
  131. package/dist/esm/pack-tarball.js +249 -0
  132. package/dist/esm/pack-tarball.js.map +1 -0
  133. package/dist/esm/parse-add-remove-args.d.ts +9 -2
  134. package/dist/esm/parse-add-remove-args.d.ts.map +1 -1
  135. package/dist/esm/parse-add-remove-args.js +43 -10
  136. package/dist/esm/parse-add-remove-args.js.map +1 -1
  137. package/dist/esm/print-err.d.ts +9 -2
  138. package/dist/esm/print-err.d.ts.map +1 -1
  139. package/dist/esm/print-err.js +130 -46
  140. package/dist/esm/print-err.js.map +1 -1
  141. package/dist/esm/query-host-contexts.d.ts +16 -0
  142. package/dist/esm/query-host-contexts.d.ts.map +1 -0
  143. package/dist/esm/query-host-contexts.js +135 -0
  144. package/dist/esm/query-host-contexts.js.map +1 -0
  145. package/dist/esm/start-gui.d.ts +1 -0
  146. package/dist/esm/start-gui.d.ts.map +1 -1
  147. package/dist/esm/start-gui.js +28 -8
  148. package/dist/esm/start-gui.js.map +1 -1
  149. package/dist/esm/view.d.ts +2 -3
  150. package/dist/esm/view.d.ts.map +1 -1
  151. package/dist/esm/view.js +1 -1
  152. package/dist/esm/view.js.map +1 -1
  153. package/package.json +55 -41
  154. package/dist/esm/commands/gui.d.ts +0 -6
  155. package/dist/esm/commands/gui.d.ts.map +0 -1
  156. package/dist/esm/commands/gui.js +0 -13
  157. package/dist/esm/commands/gui.js.map +0 -1
@@ -0,0 +1,18 @@
1
+ import type { CommandFn, CommandUsage } from '../index.ts';
2
+ export declare const usage: CommandUsage;
3
+ type CommandResultSingle = {
4
+ url: string;
5
+ name: string;
6
+ };
7
+ type CommandResultMultiple = {
8
+ url: string;
9
+ name: string;
10
+ }[];
11
+ export type CommandResult = CommandResultSingle | CommandResultMultiple;
12
+ export declare const views: {
13
+ readonly human: (r: CommandResult) => string;
14
+ readonly json: (r: CommandResult) => CommandResult;
15
+ };
16
+ export declare const command: CommandFn<CommandResult>;
17
+ export {};
18
+ //# sourceMappingURL=bugs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bugs.d.ts","sourceRoot":"","sources":["../../../src/commands/bugs.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAQ1D,eAAO,MAAM,KAAK,EAAE,YA2BhB,CAAA;AAEJ,KAAK,mBAAmB,GAAG;IACzB,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,KAAK,qBAAqB,GAAG;IAC3B,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;CACb,EAAE,CAAA;AAEH,MAAM,MAAM,aAAa,GACrB,mBAAmB,GACnB,qBAAqB,CAAA;AAEzB,eAAO,MAAM,KAAK;;;CAUuB,CAAA;AAkDzC,eAAO,MAAM,OAAO,EAAE,SAAS,CAAC,aAAa,CA4F5C,CAAA"}
@@ -0,0 +1,164 @@
1
+ import { error } from '@vltpkg/error-cause';
2
+ import { PackageInfoClient } from '@vltpkg/package-info';
3
+ import { Spec } from '@vltpkg/spec';
4
+ import { urlOpen } from '@vltpkg/url-open';
5
+ import { actual } from '@vltpkg/graph';
6
+ import { Query } from '@vltpkg/query';
7
+ import { SecurityArchive } from '@vltpkg/security-archive';
8
+ import { createHostContextsMap } from "../query-host-contexts.js";
9
+ import { commandUsage } from "../config/usage.js";
10
+ import hostedGitInfo from 'hosted-git-info';
11
+ const { fromUrl: hostedGitInfoFromUrl } = hostedGitInfo;
12
+ export const usage = () => commandUsage({
13
+ command: 'bugs',
14
+ usage: ['[<spec>]', '[--target=<query>]'],
15
+ description: `Open bug tracker for a package in a web browser.
16
+ Reads bug tracker information from package.json or fetches
17
+ manifest data for the specified package.`,
18
+ options: {
19
+ target: {
20
+ value: '<query>',
21
+ description: 'Query selector to filter packages using DSS syntax.',
22
+ },
23
+ },
24
+ examples: {
25
+ '': {
26
+ description: 'Open bugs for the current package (reads local package.json)',
27
+ },
28
+ 'abbrev@2.0.0': {
29
+ description: 'Open bugs for a specific package version',
30
+ },
31
+ '--target=":root > *"': {
32
+ description: 'List bug tracker URLs for all direct dependencies',
33
+ },
34
+ },
35
+ });
36
+ export const views = {
37
+ human: r => {
38
+ if (Array.isArray(r)) {
39
+ let msg = 'Multiple package bug trackers found:\n';
40
+ msg += r.map(item => `• ${item.name}: ${item.url}`).join('\n');
41
+ return msg;
42
+ }
43
+ return '';
44
+ },
45
+ json: r => r,
46
+ };
47
+ const getUrlFromManifest = (manifest) => {
48
+ const { name, bugs, repository } = manifest;
49
+ if (!name) {
50
+ throw error('No package name found');
51
+ }
52
+ let url;
53
+ // Check bugs field first
54
+ if (bugs) {
55
+ if (typeof bugs === 'string') {
56
+ url = bugs;
57
+ }
58
+ else if (typeof bugs === 'object') {
59
+ if ('url' in bugs && bugs.url) {
60
+ url = bugs.url;
61
+ }
62
+ else if ('email' in bugs && bugs.email) {
63
+ url = `mailto:${bugs.email}`;
64
+ }
65
+ }
66
+ }
67
+ // Try repository if no bugs field
68
+ if (!url && repository) {
69
+ const repoUrl = typeof repository === 'string' ? repository
70
+ : typeof repository === 'object' && 'url' in repository ?
71
+ repository.url
72
+ : /* c8 ignore next */ undefined;
73
+ if (repoUrl) {
74
+ const info = hostedGitInfoFromUrl(repoUrl.replace(/^git\+/, ''));
75
+ if (info?.bugs && typeof info.bugs === 'function') {
76
+ url = info.bugs();
77
+ }
78
+ }
79
+ }
80
+ // Fallback to vlt.io package page
81
+ if (!url) {
82
+ url = `https://vlt.io/explore/npm/${name}/overview`;
83
+ }
84
+ return url;
85
+ };
86
+ export const command = async (conf) => {
87
+ const { projectRoot, packageJson } = conf.options;
88
+ const targetOption = conf.get('target');
89
+ // Handle --target query
90
+ if (targetOption) {
91
+ const mainManifest = packageJson.maybeRead(projectRoot);
92
+ if (!mainManifest) {
93
+ throw error('No package.json found in project root', {
94
+ path: projectRoot,
95
+ });
96
+ }
97
+ const graph = actual.load({
98
+ ...conf.options,
99
+ mainManifest,
100
+ monorepo: conf.options.monorepo,
101
+ loadManifests: true,
102
+ });
103
+ const securityArchive = Query.hasSecuritySelectors(targetOption) ?
104
+ await SecurityArchive.start({
105
+ nodes: [...graph.nodes.values()],
106
+ })
107
+ : undefined;
108
+ const hostContexts = await createHostContextsMap(conf);
109
+ const query = new Query({
110
+ nodes: new Set(graph.nodes.values()),
111
+ edges: graph.edges,
112
+ importers: graph.importers,
113
+ securityArchive,
114
+ hostContexts,
115
+ });
116
+ const { nodes } = await query.search(targetOption, {
117
+ signal: new AbortController().signal,
118
+ });
119
+ const results = [];
120
+ for (const node of nodes) {
121
+ if (!node.manifest)
122
+ continue;
123
+ const url = getUrlFromManifest(node.manifest);
124
+ results.push({
125
+ url,
126
+ name: node.name /* c8 ignore next */ ?? '(unknown)',
127
+ });
128
+ }
129
+ if (results.length === 0) {
130
+ throw error('No packages found matching target query', {
131
+ found: targetOption,
132
+ });
133
+ }
134
+ // If single result, open it
135
+ if (results.length === 1) {
136
+ const result = results[0];
137
+ /* c8 ignore next 3 */
138
+ if (!result) {
139
+ throw error('Unexpected empty result');
140
+ }
141
+ await urlOpen(result.url);
142
+ return result;
143
+ }
144
+ // Multiple results, return the list
145
+ return results;
146
+ }
147
+ // read the package spec from a positional argument or local package.json
148
+ const specArg = conf.positionals[0];
149
+ const manifest = conf.positionals.length === 0 ? packageJson.read(projectRoot)
150
+ : specArg ?
151
+ await new PackageInfoClient(conf.options).manifest(Spec.parseArgs(specArg, conf.options))
152
+ : /* c8 ignore next */ packageJson.read(projectRoot);
153
+ const url = getUrlFromManifest(manifest);
154
+ const { name } = manifest;
155
+ /* c8 ignore start - getUrlFromManifest already validates name */
156
+ if (!name) {
157
+ throw error('No package name found');
158
+ }
159
+ /* c8 ignore stop */
160
+ // Open the URL
161
+ await urlOpen(url);
162
+ return { url, name };
163
+ };
164
+ //# sourceMappingURL=bugs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bugs.js","sourceRoot":"","sources":["../../../src/commands/bugs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAA;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAIjD,OAAO,aAAa,MAAM,iBAAiB,CAAA;AAC3C,MAAM,EAAE,OAAO,EAAE,oBAAoB,EAAE,GAAG,aAEzC,CAAA;AAED,MAAM,CAAC,MAAM,KAAK,GAAiB,GAAG,EAAE,CACtC,YAAY,CAAC;IACX,OAAO,EAAE,MAAM;IACf,KAAK,EAAE,CAAC,UAAU,EAAE,oBAAoB,CAAC;IACz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B,iEAAiE;IACjE,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,KAAK,CAAC,uBAAuB,CAAC,CAAA;IACtC,CAAC;IACD,oBAAoB;IACpB,eAAe;IACf,MAAM,OAAO,CAAC,GAAG,CAAC,CAAA;IAElB,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,CAAA;AACtB,CAAC,CAAA","sourcesContent":["import { error } from '@vltpkg/error-cause'\nimport { PackageInfoClient } from '@vltpkg/package-info'\nimport { Spec } from '@vltpkg/spec'\nimport { urlOpen } from '@vltpkg/url-open'\nimport { actual } from '@vltpkg/graph'\nimport { Query } from '@vltpkg/query'\nimport { SecurityArchive } from '@vltpkg/security-archive'\nimport { createHostContextsMap } from '../query-host-contexts.ts'\nimport { commandUsage } from '../config/usage.ts'\nimport type { CommandFn, CommandUsage } from '../index.ts'\nimport type { Views } from '../view.ts'\nimport type { Manifest, NormalizedManifest } from '@vltpkg/types'\nimport hostedGitInfo from 'hosted-git-info'\nconst { fromUrl: hostedGitInfoFromUrl } = hostedGitInfo as {\n fromUrl: (url: string) => { bugs?: () => string } | null\n}\n\nexport const usage: CommandUsage = () =>\n commandUsage({\n command: 'bugs',\n usage: ['[<spec>]', '[--target=<query>]'],\n description: `Open bug tracker for a package in a web browser.\n Reads bug tracker information from package.json or fetches\n manifest data for the specified package.`,\n options: {\n target: {\n value: '<query>',\n description:\n 'Query selector to filter packages using DSS syntax.',\n },\n },\n examples: {\n '': {\n description:\n 'Open bugs for the current package (reads local package.json)',\n },\n 'abbrev@2.0.0': {\n description: 'Open bugs for a specific package version',\n },\n '--target=\":root > *\"': {\n description:\n 'List bug tracker URLs for all direct dependencies',\n },\n },\n })\n\ntype CommandResultSingle = {\n url: string\n name: string\n}\n\ntype CommandResultMultiple = {\n url: string\n name: string\n}[]\n\nexport type CommandResult =\n | CommandResultSingle\n | CommandResultMultiple\n\nexport const views = {\n human: r => {\n if (Array.isArray(r)) {\n let msg = 'Multiple package bug trackers found:\\n'\n msg += r.map(item => `• ${item.name}: ${item.url}`).join('\\n')\n return msg\n }\n return ''\n },\n json: r => r,\n} as const satisfies Views<CommandResult>\n\nconst getUrlFromManifest = (\n manifest: Manifest | NormalizedManifest,\n): string => {\n const { name, bugs, repository } = manifest\n\n if (!name) {\n throw error('No package name found')\n }\n\n let url: string | undefined\n\n // Check bugs field first\n if (bugs) {\n if (typeof bugs === 'string') {\n url = bugs\n } else if (typeof bugs === 'object') {\n if ('url' in bugs && bugs.url) {\n url = bugs.url\n } else if ('email' in bugs && bugs.email) {\n url = `mailto:${bugs.email}`\n }\n }\n }\n\n // Try repository if no bugs field\n if (!url && repository) {\n const repoUrl =\n typeof repository === 'string' ? repository\n : typeof repository === 'object' && 'url' in repository ?\n repository.url\n : /* c8 ignore next */ undefined\n\n if (repoUrl) {\n const info = hostedGitInfoFromUrl(repoUrl.replace(/^git\\+/, ''))\n if (info?.bugs && typeof info.bugs === 'function') {\n url = info.bugs()\n }\n }\n }\n\n // Fallback to vlt.io package page\n if (!url) {\n url = `https://vlt.io/explore/npm/${name}/overview`\n }\n\n return url\n}\n\nexport const command: CommandFn<CommandResult> = async conf => {\n const { projectRoot, packageJson } = conf.options\n const targetOption = conf.get('target')\n\n // Handle --target query\n if (targetOption) {\n const mainManifest = packageJson.maybeRead(projectRoot)\n if (!mainManifest) {\n throw error('No package.json found in project root', {\n path: projectRoot,\n })\n }\n\n const graph = actual.load({\n ...conf.options,\n mainManifest,\n monorepo: conf.options.monorepo,\n loadManifests: true,\n })\n\n const securityArchive =\n Query.hasSecuritySelectors(targetOption) ?\n await SecurityArchive.start({\n nodes: [...graph.nodes.values()],\n })\n : undefined\n\n const hostContexts = await createHostContextsMap(conf)\n const query = new Query({\n nodes: new Set(graph.nodes.values()),\n edges: graph.edges,\n importers: graph.importers,\n securityArchive,\n hostContexts,\n })\n\n const { nodes } = await query.search(targetOption, {\n signal: new AbortController().signal,\n })\n\n const results: CommandResultMultiple = []\n for (const node of nodes) {\n if (!node.manifest) continue\n const url = getUrlFromManifest(node.manifest)\n results.push({\n url,\n name: node.name /* c8 ignore next */ ?? '(unknown)',\n })\n }\n\n if (results.length === 0) {\n throw error('No packages found matching target query', {\n found: targetOption,\n })\n }\n\n // If single result, open it\n if (results.length === 1) {\n const result = results[0]\n /* c8 ignore next 3 */\n if (!result) {\n throw error('Unexpected empty result')\n }\n await urlOpen(result.url)\n return result\n }\n\n // Multiple results, return the list\n return results\n }\n\n // read the package spec from a positional argument or local package.json\n const specArg = conf.positionals[0]\n const manifest =\n conf.positionals.length === 0 ? packageJson.read(projectRoot)\n : specArg ?\n await new PackageInfoClient(conf.options).manifest(\n Spec.parseArgs(specArg, conf.options),\n )\n : /* c8 ignore next */ packageJson.read(projectRoot)\n\n const url = getUrlFromManifest(manifest)\n const { name } = manifest\n /* c8 ignore start - getUrlFromManifest already validates name */\n if (!name) {\n throw error('No package name found')\n }\n /* c8 ignore stop */\n // Open the URL\n await urlOpen(url)\n\n return { url, name }\n}\n"]}
@@ -0,0 +1,25 @@
1
+ import type { BuildResult } from '@vltpkg/graph';
2
+ import type { CommandFn, CommandUsage } from '../index.ts';
3
+ export declare const views: {
4
+ readonly human: (result: BuildResult) => string;
5
+ readonly json: (result: BuildResult) => {
6
+ success: {
7
+ id: import("@vltpkg/dep-id").DepID;
8
+ name: string;
9
+ version: string | undefined;
10
+ }[];
11
+ failure: {
12
+ id: import("@vltpkg/dep-id").DepID;
13
+ name: string;
14
+ version: string | undefined;
15
+ }[];
16
+ message: string;
17
+ };
18
+ };
19
+ export declare const usage: CommandUsage;
20
+ /**
21
+ * Build command implementation. Runs any required "postinstall"
22
+ * lifecycle scripts and binary linking.
23
+ */
24
+ export declare const command: CommandFn<BuildResult>;
25
+ //# sourceMappingURL=build.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/commands/build.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAQ,MAAM,eAAe,CAAA;AAGtD,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAI1D,eAAO,MAAM,KAAK;6BACA,WAAW,KAAG,MAAM;4BAqBrB,WAAW;;;;;;;;;;;;;CAqBW,CAAA;AAEvC,eAAO,MAAM,KAAK,EAAE,YAsBhB,CAAA;AAWJ;;;GAGG;AACH,eAAO,MAAM,OAAO,EAAE,SAAS,CAAC,WAAW,CAqC1C,CAAA"}
@@ -0,0 +1,102 @@
1
+ import { build } from '@vltpkg/graph';
2
+ import { error } from '@vltpkg/error-cause';
3
+ import { commandUsage } from "../config/usage.js";
4
+ import { isErrorWithCause } from '@vltpkg/types';
5
+ export const views = {
6
+ human: (result) => {
7
+ const successCount = result.success.length;
8
+ const failureCount = result.failure.length;
9
+ const messages = [];
10
+ if (successCount > 0) {
11
+ messages.push(`🔨 Built ${successCount} package${successCount === 1 ? '' : 's'} successfully.`);
12
+ }
13
+ else {
14
+ messages.push('📦 All packages are already built.');
15
+ }
16
+ if (failureCount > 0) {
17
+ messages.push(`🔎 ${failureCount} optional package${ /* c8 ignore next */failureCount === 1 ? '' : 's'} failed to build.`);
18
+ }
19
+ return messages.join('\n');
20
+ },
21
+ json: (result) => {
22
+ const successList = result.success.map(node => ({
23
+ id: node.id,
24
+ name: node.name,
25
+ version: node.version,
26
+ }));
27
+ const failureList = result.failure.map(node => ({
28
+ id: node.id,
29
+ name: node.name,
30
+ version: node.version,
31
+ }));
32
+ return {
33
+ success: successList,
34
+ failure: failureList,
35
+ message: successList.length > 0 ?
36
+ `Built ${successList.length} package${successList.length === 1 ? '' : 's'}.`
37
+ : 'No packages needed building.',
38
+ };
39
+ },
40
+ };
41
+ export const usage = () => commandUsage({
42
+ command: 'build',
43
+ usage: ['[query]', '[--target=<query>]'],
44
+ description: `Build the project based on the current dependency graph.
45
+
46
+ This command processes the installed packages in node_modules and runs
47
+ any necessary build steps, such as lifecycle scripts and binary linking.
48
+
49
+ The build process is idempotent and will only perform work that is
50
+ actually needed based on the current state of the dependency graph.
51
+
52
+ Use --target option or provide a query as a positional argument to filter
53
+ packages using DSS query language syntax, otherwise it will target
54
+ all packages with scripts (:scripts) by default.`,
55
+ options: {
56
+ target: {
57
+ value: '<query>',
58
+ description: 'Query selector to filter packages using DSS syntax.',
59
+ },
60
+ },
61
+ });
62
+ const isGraphRunError = (error) => typeof error === 'object' &&
63
+ error !== null &&
64
+ 'code' in error &&
65
+ error.code === 'GRAPHRUN_TRAVERSAL' &&
66
+ 'node' in error;
67
+ /**
68
+ * Build command implementation. Runs any required "postinstall"
69
+ * lifecycle scripts and binary linking.
70
+ */
71
+ export const command = async (conf) => {
72
+ const { options, projectRoot } = conf;
73
+ try {
74
+ // Get target from option or first positional, default to all scripts
75
+ const targetOption = conf.get('target');
76
+ const targetPositional = conf.positionals[0];
77
+ const target = targetOption ||
78
+ targetPositional ||
79
+ ':scripts:not(:built):not(:malware)';
80
+ // Run the build process using the graph build function
81
+ const result = await build({
82
+ ...options,
83
+ projectRoot,
84
+ packageJson: options.packageJson,
85
+ monorepo: options.monorepo,
86
+ scurry: options.scurry,
87
+ target,
88
+ });
89
+ return result;
90
+ }
91
+ catch (cause) {
92
+ const graphRunError = isErrorWithCause(cause) && isGraphRunError(cause.cause) ?
93
+ cause.cause
94
+ : undefined;
95
+ if (graphRunError?.code === 'GRAPHRUN_TRAVERSAL') {
96
+ throw error('Build failed:\n Failed to build package: ' +
97
+ `${graphRunError.node.name}@${graphRunError.node.version}`, { cause });
98
+ }
99
+ throw error('Build failed', { cause });
100
+ }
101
+ };
102
+ //# sourceMappingURL=build.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.js","sourceRoot":"","sources":["../../../src/commands/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAErC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAG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C,CAAA;QAEtC,uDAAuD;QACvD,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC;YACzB,GAAG,OAAO;YACV,WAAW;YACX,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,MAAM;SACP,CAAC,CAAA;QAEF,OAAO,MAAM,CAAA;IACf,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,aAAa,GACjB,gBAAgB,CAAC,KAAK,CAAC,IAAI,eAAe,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;YACvD,KAAK,CAAC,KAAK;YACb,CAAC,CAAC,SAAS,CAAA;QACb,IAAI,aAAa,EAAE,IAAI,KAAK,oBAAoB,EAAE,CAAC;YACjD,MAAM,KAAK,CACT,4CAA4C;gBAC1C,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,IAAI,aAAa,CAAC,IAAI,CAAC,OAAO,EAAE,EAC5D,EAAE,KAAK,EAAE,CACV,CAAA;QACH,CAAC;QACD,MAAM,KAAK,CAAC,cAAc,EAAE,EAAE,KAAK,EAAE,CAAC,CAAA;IACxC,CAAC;AACH,CAAC,CAAA","sourcesContent":["import { build } from '@vltpkg/graph'\nimport type { BuildResult, Node } from '@vltpkg/graph'\nimport { error } from '@vltpkg/error-cause'\nimport { commandUsage } from '../config/usage.ts'\nimport type { CommandFn, CommandUsage } from '../index.ts'\nimport type { Views } from '../view.ts'\nimport { isErrorWithCause } from '@vltpkg/types'\n\nexport const views = {\n human: (result: BuildResult): string => {\n const successCount = result.success.length\n const failureCount = result.failure.length\n const messages: string[] = []\n\n if (successCount > 0) {\n messages.push(\n `🔨 Built ${successCount} package${successCount === 1 ? '' : 's'} successfully.`,\n )\n } else {\n messages.push('📦 All packages are already built.')\n }\n\n if (failureCount > 0) {\n messages.push(\n `🔎 ${failureCount} optional package${/* c8 ignore next */ failureCount === 1 ? '' : 's'} failed to build.`,\n )\n }\n\n return messages.join('\\n')\n },\n json: (result: BuildResult) => {\n const successList = result.success.map(node => ({\n id: node.id,\n name: node.name,\n version: node.version,\n }))\n const failureList = result.failure.map(node => ({\n id: node.id,\n name: node.name,\n version: node.version,\n }))\n\n return {\n success: successList,\n failure: failureList,\n message:\n successList.length > 0 ?\n `Built ${successList.length} package${successList.length === 1 ? '' : 's'}.`\n : 'No packages needed building.',\n }\n },\n} as const satisfies Views<BuildResult>\n\nexport const usage: CommandUsage = () =>\n commandUsage({\n command: 'build',\n usage: ['[query]', '[--target=<query>]'],\n description: `Build the project based on the current dependency graph.\n\n This command processes the installed packages in node_modules and runs\n any necessary build steps, such as lifecycle scripts and binary linking.\n \n The build process is idempotent and will only perform work that is\n actually needed based on the current state of the dependency graph.\n \n Use --target option or provide a query as a positional argument to filter\n packages using DSS query language syntax, otherwise it will target\n all packages with scripts (:scripts) by default.`,\n options: {\n target: {\n value: '<query>',\n description:\n 'Query selector to filter packages using DSS syntax.',\n },\n },\n })\n\nconst isGraphRunError = (\n error: unknown,\n): error is Error & { code: string; node: Node } =>\n typeof error === 'object' &&\n error !== null &&\n 'code' in error &&\n error.code === 'GRAPHRUN_TRAVERSAL' &&\n 'node' in error\n\n/**\n * Build command implementation. Runs any required \"postinstall\"\n * lifecycle scripts and binary linking.\n */\nexport const command: CommandFn<BuildResult> = async conf => {\n const { options, projectRoot } = conf\n\n try {\n // Get target from option or first positional, default to all scripts\n const targetOption = conf.get('target')\n const targetPositional = conf.positionals[0]\n const target =\n targetOption ||\n targetPositional ||\n ':scripts:not(:built):not(:malware)'\n\n // Run the build process using the graph build function\n const result = await build({\n ...options,\n projectRoot,\n packageJson: options.packageJson,\n monorepo: options.monorepo,\n scurry: options.scurry,\n target,\n })\n\n return result\n } catch (cause) {\n const graphRunError =\n isErrorWithCause(cause) && isGraphRunError(cause.cause) ?\n cause.cause\n : undefined\n if (graphRunError?.code === 'GRAPHRUN_TRAVERSAL') {\n throw error(\n 'Build failed:\\n Failed to build package: ' +\n `${graphRunError.node.name}@${graphRunError.node.version}`,\n { cause },\n )\n }\n throw error('Build failed', { cause })\n }\n}\n"]}
@@ -23,6 +23,10 @@ declare const usageDef: {
23
23
  readonly usage: "[<key>...]";
24
24
  readonly description: "Show cache entries. If no keys are provided, then a list of\n available keys will be printed. If one or more keys are\n provided, then details will be shown for the specified\n items.";
25
25
  };
26
+ readonly info: {
27
+ readonly usage: "<key>";
28
+ readonly description: "Print metadata details for the specified cache key to\n stderr, and the response body to stdout.";
29
+ };
26
30
  readonly clean: {
27
31
  readonly usage: "[<key>...]";
28
32
  readonly description: "Purge expired cache entries. If one or more keys are\n provided, then only those cache entries will be\n considered.";
@@ -40,6 +44,20 @@ declare const usageDef: {
40
44
  readonly description: "Delete the entire cache folder to make vlt slower.";
41
45
  };
42
46
  };
47
+ readonly examples: {
48
+ readonly 'vlt cache ls https://registry.npmjs.org/typescript': {
49
+ readonly description: "Show cache metadata for a given registry URL";
50
+ };
51
+ readonly 'vlt cache add eslint@latest': {
52
+ readonly description: "Add a given package specifier to the cache by fetching\n its resolved value.";
53
+ };
54
+ readonly 'vlt cache info https://registry.npmjs.org/eslint/-/eslint-9.25.1.tgz > eslint.tgz': {
55
+ readonly description: "Print the cache metadata to stderr, and write the tarball\n on stdout, redirecting to a file.";
56
+ };
57
+ readonly 'vlt cache delete-before 2025-01-01': {
58
+ readonly description: "Delete all entries created before Jan 1, 2025";
59
+ };
60
+ };
43
61
  };
44
62
  export declare const usage: CommandUsage;
45
63
  export declare const command: CommandFn<void | CacheMap>;
@@ -1 +1 @@
1
- {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../src/commands/cache.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAIpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAGtD,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AA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M,CAAC,OAAO,QAAQ,CAAC,CAAC,aAAa,CAAC,CAAA;AAGrE,qBAAa,SAAU,SAAQ,SAAS;gBAC1B,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,YAAY;IAIpD,MAAM,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE;CAG1B;AAED,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,IAAI,GAAG,QAAQ,CAExC,CAAA;AAED,QAAA,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoE6B,CAAA;AAE3C,eAAO,MAAM,KAAK,EAAE,YAA2C,CAAA;AAE/D,eAAO,MAAM,OAAO,EAAE,SAAS,CAAC,IAAI,GAAG,QAAQ,CAgC9C,CAAA"}
@@ -4,7 +4,7 @@ import { Spec } from '@vltpkg/spec';
4
4
  import { mkdir, rm } from 'node:fs/promises';
5
5
  import prettyBytes from 'pretty-bytes';
6
6
  import { commandUsage } from "../config/usage.js";
7
- import { stdout } from "../output.js";
7
+ import { stderr, stdout } from "../output.js";
8
8
  import { ViewClass } from "../view.js";
9
9
  let view;
10
10
  export class CacheView extends ViewClass {
@@ -36,6 +36,11 @@ const usageDef = {
36
36
  provided, then details will be shown for the specified
37
37
  items.`,
38
38
  },
39
+ info: {
40
+ usage: '<key>',
41
+ description: `Print metadata details for the specified cache key to
42
+ stderr, and the response body to stdout.`,
43
+ },
39
44
  clean: {
40
45
  usage: '[<key>...]',
41
46
  description: `Purge expired cache entries. If one or more keys are
@@ -58,6 +63,22 @@ const usageDef = {
58
63
  description: `Delete the entire cache folder to make vlt slower.`,
59
64
  },
60
65
  },
66
+ examples: {
67
+ 'vlt cache ls https://registry.npmjs.org/typescript': {
68
+ description: `Show cache metadata for a given registry URL`,
69
+ },
70
+ 'vlt cache add eslint@latest': {
71
+ description: `Add a given package specifier to the cache by fetching
72
+ its resolved value.`,
73
+ },
74
+ 'vlt cache info https://registry.npmjs.org/eslint/-/eslint-9.25.1.tgz > eslint.tgz': {
75
+ description: `Print the cache metadata to stderr, and write the tarball
76
+ on stdout, redirecting to a file.`,
77
+ },
78
+ 'vlt cache delete-before 2025-01-01': {
79
+ description: 'Delete all entries created before Jan 1, 2025',
80
+ },
81
+ },
61
82
  };
62
83
  export const usage = () => commandUsage(usageDef);
63
84
  export const command = async (conf) => {
@@ -65,6 +86,8 @@ export const command = async (conf) => {
65
86
  switch (sub) {
66
87
  case 'ls':
67
88
  return ls(conf, args, view);
89
+ case 'info':
90
+ return info(conf, args, view);
68
91
  case 'add':
69
92
  return add(conf, args, view);
70
93
  case 'clean':
@@ -79,7 +102,7 @@ export const command = async (conf) => {
79
102
  throw error('Unrecognized cache command', {
80
103
  code: 'EUSAGE',
81
104
  found: sub,
82
- validOptions: ['ls', 'add', 'clean'],
105
+ validOptions: Object.keys(usageDef.subcommands),
83
106
  });
84
107
  }
85
108
  }
@@ -93,6 +116,28 @@ const ls = async (conf, keys, view) => keys.length ?
93
116
  view?.stdout(key.includes(' ') ? JSON.stringify(key) : key);
94
117
  return true;
95
118
  });
119
+ const info = async (conf, keys, view) => {
120
+ const [key] = keys;
121
+ if (keys.length !== 1 || !key) {
122
+ throw error('Must provide exactly one cache key', {
123
+ code: 'EUSAGE',
124
+ });
125
+ }
126
+ await fetchKeys(conf, [key], (entry, key) => {
127
+ stderr(
128
+ /* c8 ignore next */
129
+ key.includes(' ') ? JSON.stringify(key) : key, entry);
130
+ if (entry.isJSON) {
131
+ stdout(JSON.stringify(entry.body, null, 2));
132
+ /* c8 ignore start - annoying to test, corrupts TAP output */
133
+ }
134
+ else {
135
+ process.stdout.write(entry.body);
136
+ }
137
+ /* c8 ignore stop */
138
+ return true;
139
+ }, view);
140
+ };
96
141
  const fetchAll = async (conf, test) => {
97
142
  const rc = conf.options.packageInfo.registryClient;
98
143
  const { cache } = rc;
@@ -201,6 +246,7 @@ const add = async (conf, specs, view) => {
201
246
  ...conf.options,
202
247
  integrity,
203
248
  staleWhileRevalidate: false,
249
+ query: undefined,
204
250
  });
205
251
  view?.stdout('+', spec, r.resolved);
206
252
  });
@@ -1 +1 @@
1
- {"version":3,"file":"cache.js","sourceRoot":"","sources":["../../../src/commands/cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,WAAW,MAAM,cAAc,CAAA;AAGtC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAErC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAStC,IAAI,IAAe,CAAA;AACnB,MAAM,OAAO,SAAU,SAAQ,SAAS;IACtC,YAAY,OAAoB,EAAE,IAAkB;QAClD,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;QACpB,IAAI,GAAG,IAAI,CAAA;IACb,CAAC;IACD,MAAM,CAAC,GAAG,IAAe;QACvB,MAAM,CAAC,GAAG,IAAI,CAAC,CAAA;IACjB,CAAC;CACF;AAED,MAAM,CAAC,MAAM,KAAK,GAA2B;IAC3C,KAAK,EAAE,SAAS;CACjB,CAAA;AAED,MAAM,QAAQ,GAAG;IACf,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE,mBAAmB;IAC1B,WAAW,EAAE,6BAA6B;IAE1C,WAAW,EAAE;QACX,GAAG,EAAE;YACH,KAAK,EAAE,oCAAoC;YAC3C,WAAW,EAAE;gCACa;SAC3B;QAED,EAAE,EAAE;YACF,KAAK,EAAE,YAAY;YACnB,WAAW,EAAE;;;2BAGQ;SACtB;QAED,KAAK,EAAE;YACL,KAAK,EAAE,YAAY;YACnB,WAAW,EAAE;;gCAEa;SAC3B;QAED,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AC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAA;QACrC,CAAC,CAAC,CAAA;QAEJ,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAClB,CAAC;IAED,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;AAC7B,CAAC,CAAA","sourcesContent":["import { error } from '@vltpkg/error-cause'\nimport { CacheEntry } from '@vltpkg/registry-client'\nimport { Spec } from '@vltpkg/spec'\nimport { mkdir, rm } from 'node:fs/promises'\nimport prettyBytes from 'pretty-bytes'\nimport type { LoadedConfig } from '../config/index.ts'\nimport type { CommandUsageDefinition } from '../config/usage.ts'\nimport { commandUsage } from '../config/usage.ts'\nimport type { CommandFn, CommandUsage } from '../index.ts'\nimport { stdout } from '../output.ts'\nimport type { ViewOptions, Views } from '../view.ts'\nimport { ViewClass } from '../view.ts'\n\nexport type CacheMap = Record<\n string,\n ReturnType<CacheEntry['toJSON']>\n>\n\nexport type CacheSubcommands = keyof (typeof usageDef)['subcommands']\n\nlet view: CacheView\nexport class CacheView extends ViewClass {\n constructor(options: ViewOptions, conf: LoadedConfig) {\n super(options, conf)\n view = this\n }\n stdout(...args: unknown[]) {\n stdout(...args)\n }\n}\n\nexport const views: Views<void | CacheMap> = {\n human: CacheView,\n}\n\nconst usageDef = {\n command: 'cache',\n usage: '<command> [flags]',\n description: 'Work with vlt cache folders',\n\n subcommands: {\n add: {\n usage: '<package-spec> [<package-spec>...]',\n description: `Resolve the referenced package identifiers and ensure they\n are cached.`,\n },\n\n ls: {\n usage: '[<key>...]',\n description: `Show cache entries. If no keys are provided, then a list of\n available keys will be printed. If one or more keys are\n provided, then details will be shown for the specified\n items.`,\n },\n\n clean: {\n usage: '[<key>...]',\n description: `Purge expired cache entries. If one or more keys are\n provided, then only those cache entries will be\n considered.`,\n },\n\n delete: {\n usage: '<key> [<key>...]',\n description: `Purge items explicitly, whether expired or not. If one or\n more keys are provided, then only those cache entries will\n be considered.`,\n },\n\n 'delete-before': {\n usage: '<date>',\n description: `Purge all cache items from before a given date. Date can be\n provided in any format that JavaScript can parse.`,\n },\n\n 'delete-all': {\n usage: '',\n description: `Delete the entire cache folder to make vlt slower.`,\n },\n },\n} as const satisfies CommandUsageDefinition\n\nexport const usage: CommandUsage = () => commandUsage(usageDef)\n\nexport const command: CommandFn<void | CacheMap> = async conf => {\n const [sub, ...args] = conf.positionals\n switch (sub) {\n case 'ls':\n return ls(conf, args, view)\n\n case 'add':\n return add(conf, args, view)\n\n case 'clean':\n return clean(conf, args, view)\n\n case 'delete':\n return deleteKeys(conf, args, view)\n\n case 'delete-before':\n return deleteBefore(conf, args, view)\n\n case 'delete-all':\n return deleteAll(conf, args, view)\n\n default: {\n throw error('Unrecognized cache command', {\n code: 'EUSAGE',\n found: sub,\n validOptions: ['ls', 'add', 'clean'],\n })\n }\n }\n}\n\nconst ls = async (\n conf: LoadedConfig,\n keys: string[],\n view?: CacheView,\n): Promise<CacheMap> =>\n keys.length ?\n await fetchKeys(\n conf,\n keys,\n (entry: CacheEntry, key: string) => {\n view?.stdout(\n key.includes(' ') ? JSON.stringify(key) : key,\n entry,\n )\n return true\n },\n view,\n )\n : await fetchAll(conf, (_, key) => {\n view?.stdout(key.includes(' ') ? JSON.stringify(key) : key)\n return true\n })\n\nconst fetchAll = async (\n conf: LoadedConfig,\n test: (entry: CacheEntry, key: string, val: Buffer) => boolean,\n) => {\n const rc = conf.options.packageInfo.registryClient\n const { cache } = rc\n const map: CacheMap = {}\n for await (const [key, val] of cache) {\n const entry = CacheEntry.decode(val)\n if (!test(entry, key, val)) continue\n map[key] = entry.toJSON()\n }\n return map\n}\n\nconst fetchKeys = async (\n conf: LoadedConfig,\n keys: string[],\n test: (entry: CacheEntry, key: string, buf: Buffer) => boolean,\n view?: CacheView,\n) => {\n const rc = conf.options.packageInfo.registryClient\n const { cache } = rc\n const map: CacheMap = {}\n const results: [string, Buffer | undefined][] = await Promise.all(\n keys.map(async key => {\n return [key, await cache.fetch(key)]\n }),\n )\n for (const [key, val] of results) {\n if (!val) {\n view?.stdout('Not found:', key)\n } else {\n const entry = CacheEntry.decode(val)\n if (!test(entry, key, val)) continue\n map[key] = entry.toJSON()\n }\n }\n\n return map\n}\n\nconst deleteEntries = async (\n conf: LoadedConfig,\n keys: string[],\n test: (entry: CacheEntry) => boolean,\n view?: CacheView,\n) => {\n const rc = conf.options.packageInfo.registryClient\n const { cache } = rc\n\n let count = 0\n let size = 0\n const testAction = (\n entry: CacheEntry,\n key: string,\n val: Buffer,\n ) => {\n if (!test(entry)) {\n return false\n }\n count++\n const s = val.byteLength + key.length\n cache.delete(key, true, entry.integrity)\n const k = key.includes(' ') ? JSON.stringify(key) : key\n view?.stdout('-', k, s)\n size += s\n return true\n }\n\n const map = await (keys.length ?\n fetchKeys(conf, keys, testAction, view)\n : fetchAll(conf, testAction))\n\n const pb = prettyBytes(size, { binary: true })\n\n const s = count === 1 ? '' : 's'\n await cache.promise()\n view?.stdout(`Removed ${count} item${s} totalling ${pb}`)\n return map\n}\n\nconst clean = async (\n conf: LoadedConfig,\n keys: string[],\n view?: CacheView,\n) => deleteEntries(conf, keys, entry => !entry.valid, view)\n\nconst deleteBefore = async (\n conf: LoadedConfig,\n args: string[],\n view?: CacheView,\n) => {\n if (!args.length) {\n throw error('Must provide a date to delete before', {\n code: 'EUSAGE',\n })\n }\n const now = new Date()\n const before = new Date(args.join(' '))\n if (before >= now) {\n throw error('Cannot delete cache entries from the future', {\n code: 'EUSAGE',\n found: before,\n })\n }\n return deleteEntries(\n conf,\n [],\n entry => !!entry.date && entry.date < before,\n view,\n )\n}\n\nconst deleteKeys = async (\n conf: LoadedConfig,\n keys: string[],\n view?: CacheView,\n) => {\n if (!keys.length) {\n throw error('Must provide cache keys to delete', {\n code: 'EUSAGE',\n })\n }\n return deleteEntries(conf, keys, () => true, view)\n}\n\nconst deleteAll = async (\n conf: LoadedConfig,\n _: string[],\n view?: CacheView,\n) => {\n const { cache } = conf.options.packageInfo.registryClient\n await rm(cache.path(), { recursive: true, force: true })\n await mkdir(cache.path(), { recursive: true })\n view?.stdout('Deleted all cache entries.')\n}\n\nconst add = async (\n conf: LoadedConfig,\n specs: string[],\n view?: CacheView,\n) => {\n if (!specs.length) {\n throw error('Must provide specs to add to the cache', {\n code: 'EUSAGE',\n })\n }\n const { packageInfo } = conf.options\n const promises: Promise<void>[] = []\n\n for (const spec of specs) {\n const p = packageInfo\n .resolve(Spec.parseArgs(spec, conf.options), {\n staleWhileRevalidate: false,\n })\n .then(async r => {\n const { resolved, integrity } = r\n await packageInfo.registryClient.request(resolved, {\n ...conf.options,\n integrity,\n staleWhileRevalidate: false,\n })\n view?.stdout('+', spec, r.resolved)\n })\n\n promises.push(p)\n }\n\n await Promise.all(promises)\n}\n"]}
1
+ {"version":3,"file":"cache.js","sourceRoot":"","sources":["../../../src/commands/cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,WAAW,MAAM,cAAc,CAAA;AAGtC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAStC,IAAI,IAAe,CAAA;AACnB,MAAM,OAAO,SAAU,SAAQ,SAAS;IACtC,YAAY,OAAoB,EAAE,IAAkB;QAClD,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;QACpB,IAAI,GAAG,IAAI,CAAA;IACb,CAAC;IACD,MAAM,CAAC,GAAG,IAAe;QACvB,MAAM,CAAC,GAAG,IAAI,CAAC,CAAA;IACjB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,GAAoB,EAAE,CAAA;IAEpC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,CAAC,GAAG,WAAW;aAClB,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE;YAC3C,oBAAoB,EAAE,KAAK;SAC5B,CAAC;aACD,IAAI,CAAC,KAAK,EAAC,CAAC,EAAC,EAAE;YACd,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,CAAC,CAAA;YACjC,MAAM,WAAW,CAAC,cAAc,CAAC,OAAO,CAAC,QAAQ,EAAE;gBACjD,GAAG,IAAI,CAAC,OAAO;gBACf,SAAS;gBACT,oBAAoB,EAAE,KAAK;gBAC3B,KAAK,EAAE,SAAS;aACjB,CAAC,CAAA;YACF,IAAI,EAAE,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAA;QACrC,CAAC,CAAC,CAAA;QAEJ,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAClB,CAAC;IAED,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;AAC7B,CAAC,CAAA","sourcesContent":["import { error } from '@vltpkg/error-cause'\nimport { CacheEntry } from '@vltpkg/registry-client'\nimport { Spec } from '@vltpkg/spec'\nimport { mkdir, rm } from 'node:fs/promises'\nimport prettyBytes from 'pretty-bytes'\nimport type { LoadedConfig } from '../config/index.ts'\nimport type { CommandUsageDefinition } from '../config/usage.ts'\nimport { commandUsage } from '../config/usage.ts'\nimport type { CommandFn, CommandUsage } from '../index.ts'\nimport { stderr, stdout } from '../output.ts'\nimport type { ViewOptions, Views } from '../view.ts'\nimport { ViewClass } from '../view.ts'\n\nexport type CacheMap = Record<\n string,\n ReturnType<CacheEntry['toJSON']>\n>\n\nexport type CacheSubcommands = keyof (typeof usageDef)['subcommands']\n\nlet view: CacheView\nexport class CacheView extends ViewClass {\n constructor(options: ViewOptions, conf: LoadedConfig) {\n super(options, conf)\n view = this\n }\n stdout(...args: unknown[]) {\n stdout(...args)\n }\n}\n\nexport const views: Views<void | CacheMap> = {\n human: CacheView,\n}\n\nconst usageDef = {\n command: 'cache',\n usage: '<command> [flags]',\n description: 'Work with vlt cache folders',\n\n subcommands: {\n add: {\n usage: '<package-spec> [<package-spec>...]',\n description: `Resolve the referenced package identifiers and ensure they\n are cached.`,\n },\n\n ls: {\n usage: '[<key>...]',\n description: `Show cache entries. If no keys are provided, then a list of\n available keys will be printed. If one or more keys are\n provided, then details will be shown for the specified\n items.`,\n },\n\n info: {\n usage: '<key>',\n description: `Print metadata details for the specified cache key to\n stderr, and the response body to stdout.`,\n },\n\n clean: {\n usage: '[<key>...]',\n description: `Purge expired cache entries. If one or more keys are\n provided, then only those cache entries will be\n considered.`,\n },\n\n delete: {\n usage: '<key> [<key>...]',\n description: `Purge items explicitly, whether expired or not. If one or\n more keys are provided, then only those cache entries will\n be considered.`,\n },\n\n 'delete-before': {\n usage: '<date>',\n description: `Purge all cache items from before a given date. Date can be\n provided in any format that JavaScript can parse.`,\n },\n\n 'delete-all': {\n usage: '',\n description: `Delete the entire cache folder to make vlt slower.`,\n },\n },\n examples: {\n 'vlt cache ls https://registry.npmjs.org/typescript': {\n description: `Show cache metadata for a given registry URL`,\n },\n 'vlt cache add eslint@latest': {\n description: `Add a given package specifier to the cache by fetching\n its resolved value.`,\n },\n 'vlt cache info https://registry.npmjs.org/eslint/-/eslint-9.25.1.tgz > eslint.tgz':\n {\n description: `Print the cache metadata to stderr, and write the tarball\n on stdout, redirecting to a file.`,\n },\n 'vlt cache delete-before 2025-01-01': {\n description: 'Delete all entries created before Jan 1, 2025',\n },\n },\n} as const satisfies CommandUsageDefinition\n\nexport const usage: CommandUsage = () => commandUsage(usageDef)\n\nexport const command: CommandFn<void | CacheMap> = async conf => {\n const [sub, ...args] = conf.positionals\n switch (sub) {\n case 'ls':\n return ls(conf, args, view)\n\n case 'info':\n return info(conf, args, view)\n\n case 'add':\n return add(conf, args, view)\n\n case 'clean':\n return clean(conf, args, view)\n\n case 'delete':\n return deleteKeys(conf, args, view)\n\n case 'delete-before':\n return deleteBefore(conf, args, view)\n\n case 'delete-all':\n return deleteAll(conf, args, view)\n\n default: {\n throw error('Unrecognized cache command', {\n code: 'EUSAGE',\n found: sub,\n validOptions: Object.keys(usageDef.subcommands),\n })\n }\n }\n}\n\nconst ls = async (\n conf: LoadedConfig,\n keys: string[],\n view?: CacheView,\n): Promise<CacheMap> =>\n keys.length ?\n await fetchKeys(\n conf,\n keys,\n (entry: CacheEntry, key: string) => {\n view?.stdout(\n key.includes(' ') ? JSON.stringify(key) : key,\n entry,\n )\n return true\n },\n view,\n )\n : await fetchAll(conf, (_, key) => {\n view?.stdout(key.includes(' ') ? JSON.stringify(key) : key)\n return true\n })\n\nconst info = async (\n conf: LoadedConfig,\n keys: string[],\n view?: CacheView,\n): Promise<void> => {\n const [key] = keys\n if (keys.length !== 1 || !key) {\n throw error('Must provide exactly one cache key', {\n code: 'EUSAGE',\n })\n }\n await fetchKeys(\n conf,\n [key],\n (entry: CacheEntry, key: string) => {\n stderr(\n /* c8 ignore next */\n key.includes(' ') ? JSON.stringify(key) : key,\n entry,\n )\n if (entry.isJSON) {\n stdout(JSON.stringify(entry.body, null, 2))\n /* c8 ignore start - annoying to test, corrupts TAP output */\n } else {\n process.stdout.write(entry.body as Buffer)\n }\n /* c8 ignore stop */\n return true\n },\n view,\n )\n}\n\nconst fetchAll = async (\n conf: LoadedConfig,\n test: (entry: CacheEntry, key: string, val: Buffer) => boolean,\n) => {\n const rc = conf.options.packageInfo.registryClient\n const { cache } = rc\n const map: CacheMap = {}\n for await (const [key, val] of cache) {\n const entry = CacheEntry.decode(val)\n if (!test(entry, key, val)) continue\n map[key] = entry.toJSON()\n }\n return map\n}\n\nconst fetchKeys = async (\n conf: LoadedConfig,\n keys: string[],\n test: (entry: CacheEntry, key: string, buf: Buffer) => boolean,\n view?: CacheView,\n) => {\n const rc = conf.options.packageInfo.registryClient\n const { cache } = rc\n const map: CacheMap = {}\n const results: [string, Buffer | undefined][] = await Promise.all(\n keys.map(async key => {\n return [key, await cache.fetch(key)]\n }),\n )\n for (const [key, val] of results) {\n if (!val) {\n view?.stdout('Not found:', key)\n } else {\n const entry = CacheEntry.decode(val)\n if (!test(entry, key, val)) continue\n map[key] = entry.toJSON()\n }\n }\n\n return map\n}\n\nconst deleteEntries = async (\n conf: LoadedConfig,\n keys: string[],\n test: (entry: CacheEntry) => boolean,\n view?: CacheView,\n) => {\n const rc = conf.options.packageInfo.registryClient\n const { cache } = rc\n\n let count = 0\n let size = 0\n const testAction = (\n entry: CacheEntry,\n key: string,\n val: Buffer,\n ) => {\n if (!test(entry)) {\n return false\n }\n count++\n const s = val.byteLength + key.length\n cache.delete(key, true, entry.integrity)\n const k = key.includes(' ') ? JSON.stringify(key) : key\n view?.stdout('-', k, s)\n size += s\n return true\n }\n\n const map = await (keys.length ?\n fetchKeys(conf, keys, testAction, view)\n : fetchAll(conf, testAction))\n\n const pb = prettyBytes(size, { binary: true })\n\n const s = count === 1 ? '' : 's'\n await cache.promise()\n view?.stdout(`Removed ${count} item${s} totalling ${pb}`)\n return map\n}\n\nconst clean = async (\n conf: LoadedConfig,\n keys: string[],\n view?: CacheView,\n) => deleteEntries(conf, keys, entry => !entry.valid, view)\n\nconst deleteBefore = async (\n conf: LoadedConfig,\n args: string[],\n view?: CacheView,\n) => {\n if (!args.length) {\n throw error('Must provide a date to delete before', {\n code: 'EUSAGE',\n })\n }\n const now = new Date()\n const before = new Date(args.join(' '))\n if (before >= now) {\n throw error('Cannot delete cache entries from the future', {\n code: 'EUSAGE',\n found: before,\n })\n }\n return deleteEntries(\n conf,\n [],\n entry => !!entry.date && entry.date < before,\n view,\n )\n}\n\nconst deleteKeys = async (\n conf: LoadedConfig,\n keys: string[],\n view?: CacheView,\n) => {\n if (!keys.length) {\n throw error('Must provide cache keys to delete', {\n code: 'EUSAGE',\n })\n }\n return deleteEntries(conf, keys, () => true, view)\n}\n\nconst deleteAll = async (\n conf: LoadedConfig,\n _: string[],\n view?: CacheView,\n) => {\n const { cache } = conf.options.packageInfo.registryClient\n await rm(cache.path(), { recursive: true, force: true })\n await mkdir(cache.path(), { recursive: true })\n view?.stdout('Deleted all cache entries.')\n}\n\nconst add = async (\n conf: LoadedConfig,\n specs: string[],\n view?: CacheView,\n) => {\n if (!specs.length) {\n throw error('Must provide specs to add to the cache', {\n code: 'EUSAGE',\n })\n }\n const { packageInfo } = conf.options\n const promises: Promise<void>[] = []\n\n for (const spec of specs) {\n const p = packageInfo\n .resolve(Spec.parseArgs(spec, conf.options), {\n staleWhileRevalidate: false,\n })\n .then(async r => {\n const { resolved, integrity } = r\n await packageInfo.registryClient.request(resolved, {\n ...conf.options,\n integrity,\n staleWhileRevalidate: false,\n query: undefined,\n })\n view?.stdout('+', spec, r.resolved)\n })\n\n promises.push(p)\n }\n\n await Promise.all(promises)\n}\n"]}
@@ -0,0 +1,11 @@
1
+ import { InstallReporter } from './install/reporter.ts';
2
+ import type { CommandFn, CommandUsage } from '../index.ts';
3
+ import type { InstallResult } from './install.ts';
4
+ export type CIResult = Omit<InstallResult, 'buildQueue'>;
5
+ export declare const usage: CommandUsage;
6
+ export declare const views: {
7
+ readonly json: (i: CIResult) => import("@vltpkg/graph").LockfileData;
8
+ readonly human: typeof InstallReporter;
9
+ };
10
+ export declare const command: CommandFn<CIResult>;
11
+ //# sourceMappingURL=ci.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ci.d.ts","sourceRoot":"","sources":["../../../src/commands/ci.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAEjD,MAAM,MAAM,QAAQ,GAAG,IAAI,CAAC,aAAa,EAAE,YAAY,CAAC,CAAA;AAExD,eAAO,MAAM,KAAK,EAAE,YAWhB,CAAA;AAEJ,eAAO,MAAM,KAAK;;;CAGkB,CAAA;AAEpC,eAAO,MAAM,OAAO,EAAE,SAAS,CAAC,QAAQ,CAavC,CAAA"}
@@ -0,0 +1,32 @@
1
+ import { install } from '@vltpkg/graph';
2
+ import { commandUsage } from "../config/usage.js";
3
+ import { InstallReporter } from "./install/reporter.js";
4
+ export const usage = () => commandUsage({
5
+ command: 'ci',
6
+ usage: '',
7
+ description: `Clean install from lockfile. Deletes node_modules and installs
8
+ dependencies exactly as specified in vlt-lock.json. This is
9
+ similar to running 'vlt install --expect-lockfile' but performs
10
+ a clean install by removing node_modules first.`,
11
+ examples: {
12
+ '': { description: 'Clean install from lockfile' },
13
+ },
14
+ });
15
+ export const views = {
16
+ json: i => i.graph.toJSON(),
17
+ human: InstallReporter,
18
+ };
19
+ export const command = async (conf) => {
20
+ const ciOptions = {
21
+ ...conf.options,
22
+ // allow all scripts by default on ci (unless user specifies a filter)
23
+ allowScripts: conf.get('allow-scripts') ?? '*',
24
+ expectLockfile: true,
25
+ frozenLockfile: true,
26
+ cleanInstall: true,
27
+ lockfileOnly: conf.options['lockfile-only'],
28
+ };
29
+ const { graph } = await install(ciOptions);
30
+ return { graph };
31
+ };
32
+ //# sourceMappingURL=ci.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ci.js","sourceRoot":"","sources":["../../../src/commands/ci.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAOvD,MAAM,CAAC,MAAM,KAAK,GAAiB,GAAG,EAAE,CACtC,YAAY,CAAC;IACX,OAAO,EAAE,IAAI;IACb,KAAK,EAAE,EAAE;IACT,WAAW,EAAE;;;kEAGiD;IAC9D,QAAQ,EAAE;QACR,EAAE,EAAE,EAAE,WAAW,EAAE,6BAA6B,EAAE;KACnD;CACF,CAAC,CAAA;AAEJ,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE;IAC3B,KAAK,EAAE,eAAe;CACY,CAAA;AAEpC,MAAM,CAAC,MAAM,OAAO,GAAwB,KAAK,EAAC,IAAI,EAAC,EAAE;IACvD,MAAM,SAAS,GAAG;QAChB,GAAG,IAAI,CAAC,OAAO;QACf,sEAAsE;QACtE,YAAY,EAAE,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,GAAG;QAC9C,cAAc,EAAE,IAAI;QACpB,cAAc,EAAE,IAAI;QACpB,YAAY,EAAE,IAAI;QAClB,YAAY,EAAE,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC;KAC5C,CAAA;IAED,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,OAAO,CAAC,SAAS,CAAC,CAAA;IAC1C,OAAO,EAAE,KAAK,EAAE,CAAA;AAClB,CAAC,CAAA","sourcesContent":["import { install } from '@vltpkg/graph'\nimport { commandUsage } from '../config/usage.ts'\nimport { InstallReporter } from './install/reporter.ts'\nimport type { CommandFn, CommandUsage } from '../index.ts'\nimport type { Views } from '../view.ts'\nimport type { InstallResult } from './install.ts'\n\nexport type CIResult = Omit<InstallResult, 'buildQueue'>\n\nexport const usage: CommandUsage = () =>\n commandUsage({\n command: 'ci',\n usage: '',\n description: `Clean install from lockfile. Deletes node_modules and installs \n dependencies exactly as specified in vlt-lock.json. This is \n similar to running 'vlt install --expect-lockfile' but performs \n a clean install by removing node_modules first.`,\n examples: {\n '': { description: 'Clean install from lockfile' },\n },\n })\n\nexport const views = {\n json: i => i.graph.toJSON(),\n human: InstallReporter,\n} as const satisfies Views<CIResult>\n\nexport const command: CommandFn<CIResult> = async conf => {\n const ciOptions = {\n ...conf.options,\n // allow all scripts by default on ci (unless user specifies a filter)\n allowScripts: conf.get('allow-scripts') ?? '*',\n expectLockfile: true,\n frozenLockfile: true,\n cleanInstall: true,\n lockfileOnly: conf.options['lockfile-only'],\n }\n\n const { graph } = await install(ciOptions)\n return { graph }\n}\n"]}