@vltpkg/cli-sdk 0.0.0-8 → 0.0.0-9

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 (72) hide show
  1. package/dist/esm/commands/cache.d.ts +47 -0
  2. package/dist/esm/commands/cache.d.ts.map +1 -0
  3. package/dist/esm/commands/cache.js +211 -0
  4. package/dist/esm/commands/cache.js.map +1 -0
  5. package/dist/esm/commands/exec-local.d.ts +5 -0
  6. package/dist/esm/commands/exec-local.d.ts.map +1 -0
  7. package/dist/esm/commands/exec-local.js +22 -0
  8. package/dist/esm/commands/exec-local.js.map +1 -0
  9. package/dist/esm/commands/exec.d.ts +1 -2
  10. package/dist/esm/commands/exec.d.ts.map +1 -1
  11. package/dist/esm/commands/exec.js +6 -15
  12. package/dist/esm/commands/exec.js.map +1 -1
  13. package/dist/esm/commands/init.d.ts +2 -3
  14. package/dist/esm/commands/init.d.ts.map +1 -1
  15. package/dist/esm/commands/init.js.map +1 -1
  16. package/dist/esm/commands/install/reporter.d.ts.map +1 -1
  17. package/dist/esm/commands/install/reporter.js +2 -1
  18. package/dist/esm/commands/install/reporter.js.map +1 -1
  19. package/dist/esm/commands/install.d.ts +5 -2
  20. package/dist/esm/commands/install.d.ts.map +1 -1
  21. package/dist/esm/commands/install.js.map +1 -1
  22. package/dist/esm/commands/list.js +1 -1
  23. package/dist/esm/commands/list.js.map +1 -1
  24. package/dist/esm/commands/pkg.d.ts +3 -3
  25. package/dist/esm/commands/pkg.d.ts.map +1 -1
  26. package/dist/esm/commands/pkg.js.map +1 -1
  27. package/dist/esm/commands/query.d.ts +2 -1
  28. package/dist/esm/commands/query.d.ts.map +1 -1
  29. package/dist/esm/commands/query.js +38 -1
  30. package/dist/esm/commands/query.js.map +1 -1
  31. package/dist/esm/commands/uninstall.d.ts +5 -2
  32. package/dist/esm/commands/uninstall.d.ts.map +1 -1
  33. package/dist/esm/commands/uninstall.js.map +1 -1
  34. package/dist/esm/commands/whoami.d.ts +4 -2
  35. package/dist/esm/commands/whoami.d.ts.map +1 -1
  36. package/dist/esm/commands/whoami.js +1 -1
  37. package/dist/esm/commands/whoami.js.map +1 -1
  38. package/dist/esm/config/definition.d.ts +11 -2
  39. package/dist/esm/config/definition.d.ts.map +1 -1
  40. package/dist/esm/config/definition.js +22 -7
  41. package/dist/esm/config/definition.js.map +1 -1
  42. package/dist/esm/config/index.d.ts +1 -0
  43. package/dist/esm/config/index.d.ts.map +1 -1
  44. package/dist/esm/config/index.js +7 -0
  45. package/dist/esm/config/index.js.map +1 -1
  46. package/dist/esm/config/usage.d.ts +3 -2
  47. package/dist/esm/config/usage.d.ts.map +1 -1
  48. package/dist/esm/config/usage.js.map +1 -1
  49. package/dist/esm/exec-command.js +2 -2
  50. package/dist/esm/exec-command.js.map +1 -1
  51. package/dist/esm/index.js +2 -2
  52. package/dist/esm/index.js.map +1 -1
  53. package/dist/esm/output.d.ts +2 -1
  54. package/dist/esm/output.d.ts.map +1 -1
  55. package/dist/esm/output.js +20 -19
  56. package/dist/esm/output.js.map +1 -1
  57. package/dist/esm/parse-add-remove-args.d.ts +1 -1
  58. package/dist/esm/parse-add-remove-args.d.ts.map +1 -1
  59. package/dist/esm/parse-add-remove-args.js +1 -1
  60. package/dist/esm/parse-add-remove-args.js.map +1 -1
  61. package/dist/esm/print-err.d.ts +5 -1
  62. package/dist/esm/print-err.d.ts.map +1 -1
  63. package/dist/esm/print-err.js +68 -21
  64. package/dist/esm/print-err.js.map +1 -1
  65. package/dist/esm/view.d.ts +1 -1
  66. package/dist/esm/view.d.ts.map +1 -1
  67. package/dist/esm/view.js.map +1 -1
  68. package/package.json +22 -20
  69. package/dist/esm/commands/install-exec.d.ts +0 -4
  70. package/dist/esm/commands/install-exec.d.ts.map +0 -1
  71. package/dist/esm/commands/install-exec.js +0 -13
  72. package/dist/esm/commands/install-exec.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"pkg.js","sourceRoot":"","sources":["../../../src/commands/pk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AAC,OAAO,CAAC,GAAG,CAAC,CAAA;QAC5B,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 'node: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"]}
1
+ {"version":3,"file":"pkg.js","sourceRoot":"","sources":["../../../src/commands/pkg.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAG3C,OAAO,MAAM,MAAM,aAAa,CAAA;AAEhC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAGnC,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,WAAW,CAAA;AAE9C,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,KAAK,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;QAClC,4CAA4C;QAC5C,+BAA+B;QAC/B,IAAI,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE,CAAC;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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 'node: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 { Views } from '../view.ts'\nimport { views as initViews } from './init.ts'\n\nexport const views = {\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} as const satisfies Views\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"]}
@@ -1,6 +1,7 @@
1
1
  import type { HumanReadableOutputGraph, JSONOutputGraph, MermaidOutputGraph } from '@vltpkg/graph';
2
2
  import { humanReadableOutput, jsonOutput, mermaidOutput } from '@vltpkg/graph';
3
3
  import type { CommandFn, CommandUsage } from '../index.ts';
4
+ import type { LoadedConfig } from '../config/index.js';
4
5
  export declare const usage: CommandUsage;
5
6
  type QueryResult = JSONOutputGraph & MermaidOutputGraph & HumanReadableOutputGraph & {
6
7
  queryString: string;
@@ -9,7 +10,7 @@ export declare const views: {
9
10
  readonly json: typeof jsonOutput;
10
11
  readonly mermaid: typeof mermaidOutput;
11
12
  readonly human: typeof humanReadableOutput;
12
- readonly gui: ({ queryString }: QueryResult, _: import("../view.ts").ViewOptions, conf: import("../config/index.ts").LoadedConfig) => Promise<void>;
13
+ readonly gui: ({ queryString }: QueryResult, _: import("../view.ts").ViewOptions, conf: LoadedConfig) => Promise<void>;
13
14
  };
14
15
  export declare const command: CommandFn<QueryResult>;
15
16
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../src/commands/query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,eAAe,EACf,kBAAkB,EAEnB,MAAM,eAAe,CAAA;AACtB,OAAO,EAEL,mBAAmB,EACnB,UAAU,EACV,aAAa,EACd,MAAM,eAAe,CAAA;AAItB,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;;;;;CAUqB,CAAA;AAEvC,eAAO,MAAM,OAAO,EAAE,SAAS,CAAC,WAAW,CAmD1C,CAAA"}
1
+ {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../src/commands/query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,wBAAwB,EACxB,eAAe,EACf,kBAAkB,EAEnB,MAAM,eAAe,CAAA;AACtB,OAAO,EAEL,mBAAmB,EACnB,UAAU,EACV,aAAa,EACd,MAAM,eAAe,CAAA;AAKtB,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD,eAAO,MAAM,KAAK,EAAE,YAyChB,CAAA;AAEJ,KAAK,WAAW,GAAG,eAAe,GAChC,kBAAkB,GAClB,wBAAwB,GAAG;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,CAAA;AAqBpD,eAAO,MAAM,KAAK;;;;;CAUqB,CAAA;AAEvC,eAAO,MAAM,OAAO,EAAE,SAAS,CAAC,WAAW,CA0D1C,CAAA"}
@@ -1,11 +1,16 @@
1
1
  import { actual, humanReadableOutput, jsonOutput, mermaidOutput, } from '@vltpkg/graph';
2
+ import { error } from '@vltpkg/error-cause';
2
3
  import { Query } from '@vltpkg/query';
3
4
  import { SecurityArchive } from '@vltpkg/security-archive';
4
5
  import { commandUsage } from "../config/usage.js";
5
6
  import { startGUI } from "../start-gui.js";
6
7
  export const usage = () => commandUsage({
7
8
  command: 'query',
8
- usage: ['', '<query> --view=[human | json | mermaid | gui]'],
9
+ usage: [
10
+ '',
11
+ '<query> --view=<human | json | mermaid | gui>',
12
+ '<query> --expect-results=<comparison string>',
13
+ ],
9
14
  description: 'List installed dependencies matching the provided query.',
10
15
  examples: {
11
16
  [`'#foo'`]: {
@@ -20,14 +25,40 @@ export const usage = () => commandUsage({
20
25
  [`'[name^="@vltpkg"]'`]: {
21
26
  description: 'Query packages with names starting with "@vltpkg"',
22
27
  },
28
+ [`'*:license(copyleft) --expect-results=0'`]: {
29
+ description: 'Errors if a copyleft licensed package is found',
30
+ },
23
31
  },
24
32
  options: {
33
+ 'expect-results': {
34
+ value: '[number | string]',
35
+ description: 'Sets an expected number of resulting items. Errors if the number of resulting items does not match the set value. Accepts a specific numeric value or a string value starting with either ">", "<", ">=" or "<=" followed by a numeric value to be compared.',
36
+ },
25
37
  view: {
26
38
  value: '[human | json | mermaid | gui]',
27
39
  description: 'Output format. Defaults to human-readable or json if no tty.',
28
40
  },
29
41
  },
30
42
  });
43
+ const validateExpectedResult = (conf, edges) => {
44
+ const expectResults = conf.values['expect-results'];
45
+ if (expectResults?.startsWith('>=')) {
46
+ return edges.length >= parseInt(expectResults.slice(2).trim(), 10);
47
+ }
48
+ else if (expectResults?.startsWith('<=')) {
49
+ return edges.length <= parseInt(expectResults.slice(2).trim(), 10);
50
+ }
51
+ else if (expectResults?.startsWith('>')) {
52
+ return edges.length > parseInt(expectResults.slice(1).trim(), 10);
53
+ }
54
+ else if (expectResults?.startsWith('<')) {
55
+ return edges.length < parseInt(expectResults.slice(1).trim(), 10);
56
+ }
57
+ else if (expectResults) {
58
+ return edges.length === parseInt(expectResults.trim(), 10);
59
+ }
60
+ return true;
61
+ };
31
62
  export const views = {
32
63
  json: jsonOutput,
33
64
  mermaid: mermaidOutput,
@@ -72,6 +103,12 @@ export const command = async (conf) => {
72
103
  importers.add(importer);
73
104
  }
74
105
  }
106
+ if (!validateExpectedResult(conf, edges)) {
107
+ throw error('Unexpected number of items', {
108
+ found: edges.length,
109
+ wanted: conf.values['expect-results'],
110
+ });
111
+ }
75
112
  return {
76
113
  importers,
77
114
  edges,
@@ -1 +1 @@
1
- {"version":3,"file":"query.js","sourceRoot":"","sources":["../../../src/commands/query.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,MAAM,EACN,mBAAmB,EACnB,UAAU,EACV,aAAa,GACd,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,KAAK,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AAC,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 type {\n HumanReadableOutputGraph,\n JSONOutputGraph,\n MermaidOutputGraph,\n Node,\n} from '@vltpkg/graph'\nimport {\n actual,\n humanReadableOutput,\n jsonOutput,\n mermaidOutput,\n} from '@vltpkg/graph'\nimport { Query } from '@vltpkg/query'\nimport { SecurityArchive } from '@vltpkg/security-archive'\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 '/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 securityArchive =\n queryString && Query.hasSecuritySelectors(queryString) ?\n await SecurityArchive.start({\n graph,\n specOptions: conf.options,\n })\n : undefined\n const query = new Query({\n graph,\n specOptions: conf.options,\n securityArchive,\n })\n\n const { edges, nodes } = await query.search(\n queryString || defaultQueryString,\n )\n\n const importers = new Set<Node>()\n if (monorepo) {\n for (const workspace of monorepo.filter(conf.values)) {\n const w: Node | undefined = graph.nodes.get(workspace.id)\n if (w) importers.add(w)\n }\n }\n if (importers.size === 0) {\n for (const importer of graph.importers) {\n importers.add(importer)\n }\n }\n\n return {\n importers,\n edges,\n nodes,\n highlightSelection: !!queryString,\n queryString: queryString || defaultQueryString,\n }\n}\n"]}
1
+ {"version":3,"file":"query.js","sourceRoot":"","sources":["../../../src/commands/query.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,MAAM,EACN,mBAAmB,EACnB,UAAU,EACV,aAAa,GACd,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAI1C,MAAM,CAAC,MAAM,KAAK,GAAiB,GAAG,EAAE,CACtC,YAAY,CAAC;IACX,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE;QACL,EAAE;QACF,+CAA+C;QAC/C,8CAA8C;KAC/C;IACD,WAAW,EACT,0DAA0D;IAC5D,QAAQ,EAAE;QACR,CAAC,QAAQ,CAAC,EAAE;YACV,WAAW,EAAE,oCAAoC;SAClD;QACD,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KAC/C,CAAA;AACH,CAAC,CAAA","sourcesContent":["import type {\n EdgeLike,\n HumanReadableOutputGraph,\n JSONOutputGraph,\n MermaidOutputGraph,\n Node,\n} from '@vltpkg/graph'\nimport {\n actual,\n humanReadableOutput,\n jsonOutput,\n mermaidOutput,\n} from '@vltpkg/graph'\nimport { error } from '@vltpkg/error-cause'\nimport { Query } from '@vltpkg/query'\nimport { SecurityArchive } from '@vltpkg/security-archive'\nimport { commandUsage } from '../config/usage.ts'\nimport type { CommandFn, CommandUsage } from '../index.ts'\nimport { startGUI } from '../start-gui.ts'\nimport type { Views } from '../view.ts'\nimport type { LoadedConfig } from '../config/index.js'\n\nexport const usage: CommandUsage = () =>\n commandUsage({\n command: 'query',\n usage: [\n '',\n '<query> --view=<human | json | mermaid | gui>',\n '<query> --expect-results=<comparison string>',\n ],\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 [`'*:license(copyleft) --expect-results=0'`]: {\n description: 'Errors if a copyleft licensed package is found',\n },\n },\n options: {\n 'expect-results': {\n value: '[number | string]',\n description:\n 'Sets an expected number of resulting items. Errors if the number of resulting items does not match the set value. Accepts a specific numeric value or a string value starting with either \">\", \"<\", \">=\" or \"<=\" followed by a numeric value to be compared.',\n },\n view: {\n value: '[human | json | mermaid | gui]',\n description:\n 'Output format. Defaults to human-readable or json if no tty.',\n },\n },\n })\n\ntype QueryResult = JSONOutputGraph &\n MermaidOutputGraph &\n HumanReadableOutputGraph & { queryString: string }\n\nconst validateExpectedResult = (\n conf: LoadedConfig,\n edges: EdgeLike[],\n): boolean => {\n const expectResults = conf.values['expect-results']\n if (expectResults?.startsWith('>=')) {\n return edges.length >= parseInt(expectResults.slice(2).trim(), 10)\n } else if (expectResults?.startsWith('<=')) {\n return edges.length <= parseInt(expectResults.slice(2).trim(), 10)\n } else if (expectResults?.startsWith('>')) {\n return edges.length > parseInt(expectResults.slice(1).trim(), 10)\n } else if (expectResults?.startsWith('<')) {\n return edges.length < parseInt(expectResults.slice(1).trim(), 10)\n } else if (expectResults) {\n return edges.length === parseInt(expectResults.trim(), 10)\n }\n return true\n}\n\nexport const views = {\n json: jsonOutput,\n mermaid: mermaidOutput,\n human: humanReadableOutput,\n gui: async ({ queryString }, _, conf) => {\n await startGUI(\n conf,\n '/explore?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 securityArchive =\n queryString && Query.hasSecuritySelectors(queryString) ?\n await SecurityArchive.start({\n graph,\n specOptions: conf.options,\n })\n : undefined\n const query = new Query({\n graph,\n specOptions: conf.options,\n securityArchive,\n })\n\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 if (!validateExpectedResult(conf, edges)) {\n throw error('Unexpected number of items', {\n found: edges.length,\n wanted: conf.values['expect-results'],\n })\n }\n\n return {\n importers,\n edges,\n nodes,\n highlightSelection: !!queryString,\n queryString: queryString || defaultQueryString,\n }\n}\n"]}
@@ -1,7 +1,10 @@
1
1
  import type { Graph } from '@vltpkg/graph';
2
2
  import type { CommandFn, CommandUsage } from '../index.ts';
3
- import type { Views } from '../view.ts';
3
+ import { InstallReporter } from './install/reporter.ts';
4
4
  export declare const usage: CommandUsage;
5
- export declare const views: Views<Graph>;
5
+ export declare const views: {
6
+ readonly json: (g: Graph) => import("@vltpkg/graph").LockfileData;
7
+ readonly human: typeof InstallReporter;
8
+ };
6
9
  export declare const command: CommandFn<Graph>;
7
10
  //# sourceMappingURL=uninstall.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"uninstall.d.ts","sourceRoot":"","sources":["../../../src/commands/uninstall.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAE1C,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG1D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAEvC,eAAO,MAAM,KAAK,EAAE,YAMhB,CAAA;AAEJ,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,KAAK,CAG9B,CAAA;AAED,eAAO,MAAM,OAAO,EAAE,SAAS,CAAC,KAAK,CAKpC,CAAA"}
1
+ {"version":3,"file":"uninstall.d.ts","sourceRoot":"","sources":["../../../src/commands/uninstall.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAE1C,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAGvD,eAAO,MAAM,KAAK,EAAE,YAMhB,CAAA;AAEJ,eAAO,MAAM,KAAK;;;CAGe,CAAA;AAEjC,eAAO,MAAM,OAAO,EAAE,SAAS,CAAC,KAAK,CAKpC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"uninstall.js","sourceRoot":"","sources":["../../../src/commands/uninstall.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAGvD,MAAM,CAAC,MAAM,KAAK,GAAiB,GAAG,EAAE,CACtC,YAAY,CAAC;IACX,OAAO,EAAE,WAAW;IACpB,KAAK,EAAE,eAAe;IACtB,WAAW,EAAE;gEAC+C;CAC7D,CAAC,CAAA;AAEJ,MAAM,CAAC,MAAM,KAAK,GAAiB;IACjC,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE;IACrB,KAAK,EAAE,eAAe;CACvB,CAAA;AAED,MAAM,CAAC,MAAM,OAAO,GAAqB,KAAK,EAAC,IAAI,EAAC,EAAE;IACpD,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAA;IACtC,MAAM,EAAE,MAAM,EAAE,GAAG,eAAe,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;IAClD,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;IACvD,OAAO,KAAK,CAAA;AACd,CAAC,CAAA","sourcesContent":["import { uninstall } from '@vltpkg/graph'\nimport type { Graph } from '@vltpkg/graph'\nimport { commandUsage } from '../config/usage.ts'\nimport type { CommandFn, CommandUsage } from '../index.ts'\nimport { parseRemoveArgs } from '../parse-add-remove-args.ts'\nimport { InstallReporter } from './install/reporter.ts'\nimport type { Views } from '../view.ts'\n\nexport const usage: CommandUsage = () =>\n commandUsage({\n command: 'uninstall',\n usage: '[package ...]',\n description: `The opposite of \\`vlt install\\`. Removes deps and updates\n vlt-lock.json and package.json appropriately.`,\n })\n\nexport const views: Views<Graph> = {\n json: g => g.toJSON(),\n human: InstallReporter,\n}\n\nexport const command: CommandFn<Graph> = async conf => {\n const monorepo = conf.options.monorepo\n const { remove } = parseRemoveArgs(conf, monorepo)\n const { graph } = await uninstall(conf.options, remove)\n return graph\n}\n"]}
1
+ {"version":3,"file":"uninstall.js","sourceRoot":"","sources":["../../../src/commands/uninstall.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAGvD,MAAM,CAAC,MAAM,KAAK,GAAiB,GAAG,EAAE,CACtC,YAAY,CAAC;IACX,OAAO,EAAE,WAAW;IACpB,KAAK,EAAE,eAAe;IACtB,WAAW,EAAE;gEAC+C;CAC7D,CAAC,CAAA;AAEJ,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE;IACrB,KAAK,EAAE,eAAe;CACS,CAAA;AAEjC,MAAM,CAAC,MAAM,OAAO,GAAqB,KAAK,EAAC,IAAI,EAAC,EAAE;IACpD,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAA;IACtC,MAAM,EAAE,MAAM,EAAE,GAAG,eAAe,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;IAClD,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;IACvD,OAAO,KAAK,CAAA;AACd,CAAC,CAAA","sourcesContent":["import { uninstall } from '@vltpkg/graph'\nimport type { Graph } from '@vltpkg/graph'\nimport { commandUsage } from '../config/usage.ts'\nimport type { CommandFn, CommandUsage } from '../index.ts'\nimport { parseRemoveArgs } from '../parse-add-remove-args.ts'\nimport { InstallReporter } from './install/reporter.ts'\nimport type { Views } from '../view.ts'\n\nexport const usage: CommandUsage = () =>\n commandUsage({\n command: 'uninstall',\n usage: '[package ...]',\n description: `The opposite of \\`vlt install\\`. Removes deps and updates\n vlt-lock.json and package.json appropriately.`,\n })\n\nexport const views = {\n json: g => g.toJSON(),\n human: InstallReporter,\n} as const satisfies Views<Graph>\n\nexport const command: CommandFn<Graph> = async conf => {\n const monorepo = conf.options.monorepo\n const { remove } = parseRemoveArgs(conf, monorepo)\n const { graph } = await uninstall(conf.options, remove)\n return graph\n}\n"]}
@@ -1,11 +1,13 @@
1
1
  import type { JSONField } from '@vltpkg/types';
2
2
  import type { CommandFn, CommandUsage } from '../index.ts';
3
- import type { Views } from '../view.ts';
4
3
  export declare const usage: CommandUsage;
5
4
  type CommandResult = {
6
5
  username?: JSONField;
7
6
  };
8
- export declare const views: Views<CommandResult>;
7
+ export declare const views: {
8
+ readonly human: (r: CommandResult) => JSONField;
9
+ readonly json: (r: CommandResult) => CommandResult;
10
+ };
9
11
  export declare const command: CommandFn<CommandResult>;
10
12
  export {};
11
13
  //# sourceMappingURL=whoami.d.ts.map
@@ -1 +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"}
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;AAG1D,eAAO,MAAM,KAAK,EAAE,YAMhB,CAAA;AAEJ,KAAK,aAAa,GAAG;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB,CAAA;AAED,eAAO,MAAM,KAAK;;;CAGuB,CAAA;AAEzC,eAAO,MAAM,OAAO,EAAE,SAAS,CAAC,aAAa,CAQ5C,CAAA"}
@@ -12,7 +12,7 @@ export const views = {
12
12
  };
13
13
  export const command = async (conf) => {
14
14
  const rc = new RegistryClient(conf.options);
15
- const response = await rc.request(new URL('-/whoami', conf.options.registry), { cache: false });
15
+ const response = await rc.request(new URL('-/whoami', conf.options.registry), { useCache: false });
16
16
  const { username } = response.json();
17
17
  return { username };
18
18
  };
@@ -1 +1 @@
1
- {"version":3,"file":"whoami.js","sourceRoot":"","sources":["../../../src/commands/whoami.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAIjD,MAAM,CAAC,MAAM,KAAK,GAAiB,GAAG,EAAE,CACtC,YAAY,CAAC;IACX,OAAO,EAAE,QAAQ;IACjB,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,WAAW,EAAE;+CAC8B;CAC5C,CAAC,CAAA;AAMJ,MAAM,CAAC,MAAM,KAAK,GAAyB;IACzC,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ;IACtB,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;CACb,CAAA;AAED,MAAM,CAAC,MAAM,OAAO,GAA6B,KAAK,EAAC,IAAI,EAAC,EAAE;IAC5D,MAAM,EAAE,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAC3C,MAAM,QAAQ,GAAG,MAAM,EAAE,CAAC,OAAO,CAC/B,IAAI,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAC1C,EAAE,KAAK,EAAE,KAAK,EAAE,CACjB,CAAA;IACD,MAAM,EAAE,QAAQ,EAAE,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAA;IACpC,OAAO,EAAE,QAAQ,EAAE,CAAA;AACrB,CAAC,CAAA","sourcesContent":["import { RegistryClient } from '@vltpkg/registry-client'\nimport type { JSONField } from '@vltpkg/types'\nimport { commandUsage } from '../config/usage.ts'\nimport type { CommandFn, CommandUsage } from '../index.ts'\nimport type { Views } from '../view.ts'\n\nexport const usage: CommandUsage = () =>\n commandUsage({\n command: 'whoami',\n usage: [''],\n description: `Look up the username for the currently active token,\n when logged into a registry.`,\n })\n\ntype CommandResult = {\n username?: JSONField\n}\n\nexport const views: Views<CommandResult> = {\n human: r => r.username,\n json: r => r,\n}\n\nexport const command: CommandFn<CommandResult> = async conf => {\n const rc = new RegistryClient(conf.options)\n const response = await rc.request(\n new URL('-/whoami', conf.options.registry),\n { cache: false },\n )\n const { username } = response.json()\n return { username }\n}\n"]}
1
+ {"version":3,"file":"whoami.js","sourceRoot":"","sources":["../../../src/commands/whoami.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAIjD,MAAM,CAAC,MAAM,KAAK,GAAiB,GAAG,EAAE,CACtC,YAAY,CAAC;IACX,OAAO,EAAE,QAAQ;IACjB,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,WAAW,EAAE;+CAC8B;CAC5C,CAAC,CAAA;AAMJ,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ;IACtB,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;CAC2B,CAAA;AAEzC,MAAM,CAAC,MAAM,OAAO,GAA6B,KAAK,EAAC,IAAI,EAAC,EAAE;IAC5D,MAAM,EAAE,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAC3C,MAAM,QAAQ,GAAG,MAAM,EAAE,CAAC,OAAO,CAC/B,IAAI,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAC1C,EAAE,QAAQ,EAAE,KAAK,EAAE,CACpB,CAAA;IACD,MAAM,EAAE,QAAQ,EAAE,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAA;IACpC,OAAO,EAAE,QAAQ,EAAE,CAAA;AACrB,CAAC,CAAA","sourcesContent":["import { RegistryClient } from '@vltpkg/registry-client'\nimport type { JSONField } from '@vltpkg/types'\nimport { commandUsage } from '../config/usage.ts'\nimport type { CommandFn, CommandUsage } from '../index.ts'\nimport type { Views } from '../view.ts'\n\nexport const usage: CommandUsage = () =>\n commandUsage({\n command: 'whoami',\n usage: [''],\n description: `Look up the username for the currently active token,\n when logged into a registry.`,\n })\n\ntype CommandResult = {\n username?: JSONField\n}\n\nexport const views = {\n human: r => r.username,\n json: r => r,\n} as const satisfies Views<CommandResult>\n\nexport const command: CommandFn<CommandResult> = async conf => {\n const rc = new RegistryClient(conf.options)\n const response = await rc.request(\n new URL('-/whoami', conf.options.registry),\n { useCache: false },\n )\n const { username } = response.json()\n return { username }\n}\n"]}
@@ -11,17 +11,18 @@ export declare const commands: {
11
11
  readonly 'run-script': "run";
12
12
  readonly rx: "run-exec";
13
13
  readonly x: "exec";
14
+ readonly xl: "exec-local";
14
15
  readonly h: "help";
15
16
  readonly '?': "help";
16
17
  readonly conf: "config";
17
- readonly ix: "install-exec";
18
18
  readonly ls: "list";
19
+ readonly cache: "cache";
19
20
  readonly config: "config";
20
21
  readonly exec: "exec";
22
+ readonly 'exec-local': "exec-local";
21
23
  readonly gui: "gui";
22
24
  readonly help: "help";
23
25
  readonly init: "init";
24
- readonly 'install-exec': "install-exec";
25
26
  readonly install: "install";
26
27
  readonly login: "login";
27
28
  readonly logout: "logout";
@@ -288,5 +289,13 @@ export declare const definition: import("jackspeak").Jack<{
288
289
  };
289
290
  } & {
290
291
  help: import("jackspeak").ConfigOption<"boolean", false, undefined>;
292
+ } & {
293
+ 'expect-results': {
294
+ hint: string;
295
+ validate: (v: unknown) => boolean;
296
+ description: string;
297
+ };
298
+ } & {
299
+ 'expect-results': import("jackspeak").ConfigOption<"string", false, readonly string[] | undefined>;
291
300
  }>;
292
301
  //# sourceMappingURL=definition.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../../src/config/definition.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW,QAA0C,CAAA;AAuClE;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGX,CAAA;AAEV;;GAEG;AACH,eAAO,MAAM,cAAc,uBAW1B,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAA;AAEtC,eAAO,MAAM,UAAU,OACjB,MAAM,KACT,QAAQ,CAAC,MAAM,QAAQ,CAAC,GAAG,SACkC,CAAA;AAKhE;;GAEG;AACH,eAAO,MAAM,YAAY,+EAKf,CAAA;AAEV,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAA;AAEvD,eAAO,MAAM,aAAa,MAAO,MAAM,KAAG,CAAC,IAAI,WACN,CAAA;AAwCzC,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAwNH,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyMvB,CAAA"}
1
+ {"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../../src/config/definition.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW,QAA0C,CAAA;AAwClE;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGX,CAAA;AAEV;;GAEG;AACH,eAAO,MAAM,cAAc,uBAW1B,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAA;AAEtC,eAAO,MAAM,UAAU,OACjB,MAAM,KACT,QAAQ,CAAC,MAAM,QAAQ,CAAC,GAAG,SACkC,CAAA;AAKhE;;GAEG;AACH,eAAO,MAAM,YAAY,+EAKf,CAAA;AAEV,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAA;AAEvD,eAAO,MAAM,aAAa,MAAO,MAAM,KAAG,CAAC,IAAI,WACN,CAAA;AAwCzC,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAwNH,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBA8MP,OAAO;;;;;EAWvB,CAAA"}
@@ -2,12 +2,13 @@ import { XDG } from '@vltpkg/xdg';
2
2
  import { jack } from 'jackspeak';
3
3
  export const defaultView = process.stdout.isTTY ? 'human' : 'json';
4
4
  const canonicalCommands = {
5
+ cache: 'cache',
5
6
  config: 'config',
6
7
  exec: 'exec',
8
+ 'exec-local': 'exec-local',
7
9
  gui: 'gui',
8
10
  help: 'help',
9
11
  init: 'init',
10
- 'install-exec': 'install-exec',
11
12
  install: 'install',
12
13
  login: 'login',
13
14
  logout: 'logout',
@@ -30,10 +31,10 @@ const aliases = {
30
31
  'run-script': 'run',
31
32
  rx: 'run-exec',
32
33
  x: 'exec',
34
+ xl: 'exec-local',
33
35
  h: 'help',
34
36
  '?': 'help',
35
37
  conf: 'config',
36
- ix: 'install-exec',
37
38
  ls: 'list',
38
39
  };
39
40
  /**
@@ -72,8 +73,8 @@ export const isRecordField = (s) => recordFields.includes(s);
72
73
  const stopParsingCommands = [
73
74
  'run',
74
75
  'run-exec',
76
+ 'exec-local',
75
77
  'exec',
76
- 'install-exec',
77
78
  ];
78
79
  let stopParsing = undefined;
79
80
  const j = jack({
@@ -411,10 +412,10 @@ export const definition = j
411
412
  .opt({
412
413
  package: {
413
414
  hint: 'p',
414
- description: `When running \`vlt install-exec\`, this allows you to
415
- explicitly set the package to search for bins. If not
416
- provided, then vlt will interpret the first argument as
417
- the package, and attempt to run the default executable.`,
415
+ description: `When running \`vlt exec\`, this allows you to explicitly
416
+ set the package to search for bins. If not provided, then
417
+ vlt will interpret the first argument as the package, and
418
+ attempt to run the default executable.`,
418
419
  },
419
420
  })
420
421
  .opt({
@@ -490,5 +491,19 @@ export const definition = j
490
491
  short: 'h',
491
492
  description: 'Print helpful information',
492
493
  },
494
+ })
495
+ .opt({
496
+ 'expect-results': {
497
+ hint: 'value',
498
+ validate: (v) => typeof v === 'string' && /^([<>]=?)?[0-9]+$/.test(v),
499
+ description: `When running \`vlt query\`, this option allows you to
500
+ set a expected number of resulting items.
501
+
502
+ Accepted values are numbers and strings.
503
+
504
+ Strings starting with \`>\`, \`<\`, \`>=\` or \`<=\`
505
+ followed by a number can be used to check if the result
506
+ is greater than or less than a specific number.`,
507
+ },
493
508
  });
494
509
  //# sourceMappingURL=definition.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"definition.js","sourceRoot":"","sources":["../../../src/config/definition.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C,CAAA","sourcesContent":["import { XDG } from '@vltpkg/xdg'\nimport { jack } from 'jackspeak'\n\nexport const defaultView = process.stdout.isTTY ? 'human' : 'json'\n\nconst canonicalCommands = {\n config: 'config',\n exec: 'exec',\n gui: 'gui',\n help: 'help',\n init: 'init',\n 'install-exec': 'install-exec',\n install: 'install',\n login: 'login',\n logout: 'logout',\n list: 'list',\n ls: 'ls',\n pkg: 'pkg',\n query: 'query',\n 'run-exec': 'run-exec',\n run: 'run',\n token: 'token',\n uninstall: 'uninstall',\n whoami: 'whoami',\n} as const\n\nconst aliases = {\n i: 'install',\n add: 'install',\n rm: 'uninstall',\n u: 'uninstall',\n r: 'run',\n 'run-script': 'run',\n rx: 'run-exec',\n x: 'exec',\n h: 'help',\n '?': 'help',\n conf: 'config',\n ix: 'install-exec',\n ls: 'list',\n} as const\n\n/**\n * Command aliases mapped to their canonical names\n */\nexport const commands = {\n ...canonicalCommands,\n ...aliases,\n} as const\n\n/**\n * Canonical command names mapped to an array of its aliases\n */\nexport const commandAliases = Object.entries(aliases).reduce(\n (acc, [alias, canonical]) => {\n const commandAliases = acc.get(canonical)\n if (commandAliases) {\n commandAliases.push(alias)\n } else {\n acc.set(canonical, [alias])\n }\n return acc\n },\n new Map<string, string[]>(),\n)\n\nexport type Commands = typeof commands\n\nexport const getCommand = (\n s?: string,\n): Commands[keyof Commands] | undefined =>\n s && s in commands ? commands[s as keyof Commands] : undefined\n\nconst xdg = new XDG('vlt')\nconst cacheDir = xdg.cache()\n\n/**\n * Fields that are parsed as a set of key=value pairs\n */\nexport const recordFields = [\n 'git-hosts',\n 'registries',\n 'git-host-archives',\n 'scope-registries',\n] as const\n\nexport type RecordField = (typeof recordFields)[number]\n\nexport const isRecordField = (s: string): s is RecordField =>\n recordFields.includes(s as RecordField)\n\nconst stopParsingCommands: Commands[keyof Commands][] = [\n 'run',\n 'run-exec',\n 'exec',\n 'install-exec',\n]\n\nlet stopParsing: boolean | undefined = undefined\n\nconst j = jack({\n envPrefix: 'VLT',\n allowPositionals: true,\n usage: `vlt [<options>] [<cmd> [<args> ...]]`,\n stopAtPositionalTest: arg => {\n if (stopParsing) return true\n const a = arg as keyof Commands\n // we stop parsing AFTER the thing, so you can do\n // vlt run --vlt --configs scriptName --args --for --script\n // or\n // vlt exec --vlt --configs command --args --for --command\n if (stopParsingCommands.includes(commands[a])) {\n stopParsing = true\n }\n return false\n },\n})\n .heading('vlt')\n .description(\n `More documentation available at <https://docs.vlt.sh>`,\n )\n .heading('Subcommands')\n\nj.description(Object.keys(canonicalCommands).join(', '), {\n pre: true,\n}).description(\n 'Run `vlt <cmd> --help` for more information about a specific command',\n)\n\nexport const definition = j\n /**\n * Definition of all configuration values used by vlt.\n */\n .heading('Configuration')\n .description(\n `If a \\`vlt.json\\` file is present in the root of the current project,\n then that will be used as a source of configuration information.\n\n Next, the \\`vlt.json\\` file in the XDG specified config directory\n will be checked, and loaded for any fields not set in the local project.\n\n Object type values will be merged together. Set a field to \\`null\\` in\n the JSON configuration to explicitly remove it.\n\n Command-specific fields may be set in a nested \\`command\\` object that\n overrides any options defined at the top level.\n `,\n )\n\n .flag({\n color: {\n short: 'c',\n description: 'Use colors (Default for TTY)',\n },\n 'no-color': {\n short: 'C',\n description: 'Do not use colors (Default for non-TTY)',\n },\n })\n\n .opt({\n registry: {\n hint: 'url',\n default: 'https://registry.npmjs.org/',\n description: `Sets the registry for fetching packages, when no registry\n is explicitly set on a specifier.\n\n For example, \\`express@latest\\` will be resolved by looking\n up the metadata from this registry.\n\n Note that alias specifiers starting with \\`npm:\\` will\n still map to \\`https://registry.npmjs.org/\\` if this is\n changed, unless the a new mapping is created via the\n \\`--registries\\` option.\n `,\n },\n })\n\n .optList({\n registries: {\n hint: 'name=url',\n description: `Specify named registry hosts by their prefix. To set the\n default registry used for non-namespaced specifiers,\n use the \\`--registry\\` option.\n\n Prefixes can be used as a package alias. For example:\n\n \\`\\`\\`\n vlt --registries loc=http://reg.local install foo@loc:foo@1.x\n \\`\\`\\`\n\n By default, the public npm registry is registered to the\n \\`npm:\\` prefix. It is not recommended to change this\n mapping in most cases.\n `,\n },\n\n 'scope-registries': {\n hint: '@scope=url',\n description: `Map package name scopes to registry URLs.\n\n For example,\n \\`--scope-registries @acme=https://registry.acme/\\`\n would tell vlt to fetch any packages named\n \\`@acme/...\\` from the \\`https://registry.acme/\\`\n registry.\n\n Note: this way of specifying registries is more ambiguous,\n compared with using the \\`--registries\\` field and explicit\n prefixes, because instead of failing when the configuration\n is absent, it will instead attempt to fetch from the\n default registry.\n\n By comparison, using\n \\`--registries acme=https://registry.acme/\\` and then\n specifying dependencies such as \\`\"foo\": \"acme:foo@1.x\"\\`\n means that regardless of the name, the package will be\n fetched from the explicitly named registry, or fail if\n no registry is defined with that name.\n\n However, custom registry aliases are not supported by other\n package managers.`,\n },\n\n 'git-hosts': {\n hint: `name=template`,\n short: 'G',\n description: `Map a shorthand name to a git remote URL template.\n\n The \\`template\\` may contain placeholders, which will be\n swapped with the relevant values.\n\n \\`$1\\`, \\`$2\\`, etc. are replaced with the appropriate\n n-th path portion. For example, \\`github:user/project\\`\n would replace the \\`$1\\` in the template with \\`user\\`,\n and \\`$2\\` with \\`project\\`.`,\n },\n\n 'git-host-archives': {\n hint: `name=template`,\n short: 'A',\n description: `Similar to the \\`--git-host <name>=<template>\\` option,\n this option can define a template string that will be\n expanded to provide the URL to download a pre-built\n tarball of the git repository.\n\n In addition to the n-th path portion expansions performed\n by \\`--git-host\\`, this field will also expand the\n string \\`$committish\\` in the template, replacing it with\n the resolved git committish value to be fetched.`,\n },\n })\n\n .opt({\n cache: {\n hint: 'path',\n description: `\n Location of the vlt on-disk cache. Defaults to the platform-specific\n directory recommended by the XDG specification.\n `,\n default: cacheDir,\n },\n tag: {\n description: `Default \\`dist-tag\\` to install`,\n default: 'latest',\n },\n before: {\n hint: 'date',\n description: `Do not install any packages published after this date`,\n },\n os: {\n description: `The operating system to use as the selector when choosing\n packages based on their \\`os\\` value.`,\n default: process.platform,\n },\n arch: {\n description: `CPU architecture to use as the selector when choosing\n packages based on their \\`cpu\\` value.`,\n default: process.arch,\n },\n 'node-version': {\n hint: 'version',\n description: `Node version to use when choosing packages based on\n their \\`engines.node\\` value.`,\n default: process.version,\n },\n })\n\n .flag({\n 'git-shallow': {\n description: `Set to force \\`--depth=1\\` on all git clone actions.\n When set explicitly to false with --no-git-shallow,\n then \\`--depth=1\\` will not be used.\n\n When not set explicitly, \\`--depth=1\\` will be used for\n git hosts known to support this behavior.`,\n },\n })\n .num({\n 'fetch-retries': {\n hint: 'n',\n description: `Number of retries to perform when encountering network\n errors or likely-transient errors from git hosts.`,\n default: 3,\n },\n 'fetch-retry-factor': {\n hint: 'n',\n description: `The exponential backoff factor to use when retrying\n requests due to network issues.`,\n default: 2,\n },\n 'fetch-retry-mintimeout': {\n hint: 'n',\n description: `Number of milliseconds before starting first retry`,\n default: 0,\n },\n 'fetch-retry-maxtimeout': {\n hint: 'n',\n description: `Maximum number of milliseconds between two retries`,\n default: 30_000,\n },\n 'stale-while-revalidate-factor': {\n hint: 'n',\n default: 60,\n description: `If the server does not serve a \\`stale-while-revalidate\\`\n value in the \\`cache-control\\` header, then this multiplier\n is applied to the \\`max-age\\` or \\`s-maxage\\` values.\n\n By default, this is \\`60\\`, so for example a response that\n is cacheable for 5 minutes will allow a stale response\n while revalidating for up to 5 hours.\n\n If the server *does* provide a \\`stale-while-revalidate\\`\n value, then that is always used.\n\n Set to 0 to prevent any \\`stale-while-revalidate\\` behavior\n unless explicitly allowed by the server's \\`cache-control\\`\n header.\n `,\n },\n })\n\n .opt({\n identity: {\n short: 'i',\n validate: (v: unknown) =>\n typeof v === 'string' && /^[a-z0-9]*$/.test(v),\n hint: 'name',\n default: '',\n description: `Provide a string to define an identity for storing auth\n information when logging into registries.\n\n Authentication tokens will be stored in the XDG data\n directory, in \\`vlt/auth/$\\{identity}/keychain.json\\`.\n\n If no identity is provided, then the default \\`''\\` will\n be used, storing the file at \\`vlt/auth/keychain.json\\`.\n\n May only contain lowercase alphanumeric characters.\n `,\n },\n })\n\n .optList({\n workspace: {\n hint: 'ws',\n short: 'w',\n description: `Set to limit the spaces being worked on when working on\n workspaces.\n\n Can be paths or glob patterns matching paths.\n\n Specifying workspaces by package.json name is not\n supported.`,\n },\n 'workspace-group': {\n short: 'g',\n description: `Specify named workspace group names to load and operate on\n when doing recursive operations on workspaces.`,\n },\n })\n\n .flag({\n recursive: {\n short: 'r',\n description: `Run an operation across multiple workspaces.\n\n No effect when used in non-monorepo projects.\n\n Implied by setting --workspace or --workspace-group. If\n not set, then the action is run on the project root.`,\n },\n\n bail: {\n short: 'b',\n description: `When running scripts across multiple workspaces, stop\n on the first failure.`,\n default: true,\n },\n\n 'no-bail': {\n short: 'B',\n description: `When running scripts across multiple workspaces, continue\n on failure, running the script for all workspaces.`,\n },\n })\n\n .opt({\n config: {\n hint: 'user | project',\n description: `Specify whether to operate on user-level or project-level\n configuration files when running \\`vlt config\\` commands.`,\n validOptions: ['user', 'project'] as const,\n default: 'project',\n },\n\n editor: {\n hint: 'program',\n description: `The blocking editor to use for \\`vlt config edit\\` and\n any other cases where a file should be opened for\n editing.\n\n Defaults to the \\`EDITOR\\` or \\`VISUAL\\` env if set, or\n \\`notepad.exe\\` on Windows, or \\`vi\\` elsewhere.`,\n default:\n process.env.EDITOR ||\n process.env.VISUAL ||\n (process.platform === 'win32' ?\n `${process.env.SYSTEMROOT}\\\\notepad.exe`\n : 'vi'),\n },\n\n 'script-shell': {\n hint: 'program',\n description: `The shell to use when executing \\`package.json#scripts\\`\n (either as lifecycle scripts or explicitly with\n \\`vlt run\\`) and \\`vlt exec\\`.\n\n If not set, defaults to \\`/bin/sh\\` on POSIX systems,\n and \\`cmd.exe\\` on Windows.\n\n When no argument is provided to \\`vlt exec\\`, the \\`SHELL\\`\n environment variable takes precedence if set.`,\n },\n\n 'fallback-command': {\n hint: 'command',\n description: `The command to run when the first argument doesn't\n match any known commands.\n\n For pnpm-style behavior, set this to 'run-exec'. e.g:\n \\`\\`\\`\n vlt config set fallback-command=run-exec\n \\`\\`\\``,\n default: 'help',\n validOptions: Object.keys(canonicalCommands),\n },\n })\n\n .opt({\n package: {\n hint: 'p',\n description: `When running \\`vlt install-exec\\`, this allows you to\n explicitly set the package to search for bins. If not\n provided, then vlt will interpret the first argument as\n the package, and attempt to run the default executable.`,\n },\n })\n\n .opt({\n view: {\n hint: 'output',\n default: defaultView,\n description: `Configures the output format for commands.\n\n Defaults to \\`human\\` if stdout is a TTY, or \\`json\\`\n if it is not.\n\n - human: Maximally ergonomic output reporting for human\n consumption.\n - json: Parseable JSON output for machines.\n - inspect: Output results with \\`util.inspect\\`.\n - gui: Start a local web server and opens a browser to\n explore the results. (Only relevant for certain\n commands.)\n - mermaid: Output mermaid diagramming syntax. (Only\n relevant for certain commands.)\n\n If the requested view format is not supported for the\n current command, or if no option is provided, then it\n will fall back to the default.\n `,\n validOptions: [\n 'human',\n 'json',\n 'mermaid',\n 'gui',\n 'inspect',\n ] as const,\n },\n })\n\n .optList({\n 'dashboard-root': {\n hint: 'path',\n description: `The root directory to use for the dashboard GUI.\n If not set, the user home directory is used.`,\n },\n })\n\n .flag({\n 'save-dev': {\n short: 'D',\n description: `Save installed packages to a package.json file as\n devDependencies`,\n },\n 'save-optional': {\n short: 'O',\n description: `Save installed packages to a package.json file as\n optionalDependencies`,\n },\n 'save-peer': {\n description: `Save installed packages to a package.json file as\n peerDependencies`,\n },\n 'save-prod': {\n short: 'P',\n description: `Save installed packages into dependencies specifically.\n This is useful if a package already exists in\n devDependencies or optionalDependencies, but you want to\n move it to be a non-optional production dependency.`,\n },\n })\n\n .flag({\n version: {\n short: 'v',\n description: 'Print the version',\n },\n })\n\n .flag({\n help: {\n short: 'h',\n description: 'Print helpful information',\n },\n })\n"]}
1
+ {"version":3,"file":"definition.js","sourceRoot":"","sources":["../../../src/config/definition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,EAAE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AAO;QACb,QAAQ,EAAE,CAAC,CAAU,EAAE,EAAE,CACvB,OAAO,CAAC,KAAK,QAAQ,IAAI,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC;QACtD,WAAW,EAAE;;;;;;;oEAOiD;KAC/D;CACF,CAAC,CAAA","sourcesContent":["import { XDG } from '@vltpkg/xdg'\nimport { jack } from 'jackspeak'\n\nexport const defaultView = process.stdout.isTTY ? 'human' : 'json'\n\nconst canonicalCommands = {\n cache: 'cache',\n config: 'config',\n exec: 'exec',\n 'exec-local': 'exec-local',\n gui: 'gui',\n help: 'help',\n init: 'init',\n install: 'install',\n login: 'login',\n logout: 'logout',\n list: 'list',\n ls: 'ls',\n pkg: 'pkg',\n query: 'query',\n 'run-exec': 'run-exec',\n run: 'run',\n token: 'token',\n uninstall: 'uninstall',\n whoami: 'whoami',\n} as const\n\nconst aliases = {\n i: 'install',\n add: 'install',\n rm: 'uninstall',\n u: 'uninstall',\n r: 'run',\n 'run-script': 'run',\n rx: 'run-exec',\n x: 'exec',\n xl: 'exec-local',\n h: 'help',\n '?': 'help',\n conf: 'config',\n ls: 'list',\n} as const\n\n/**\n * Command aliases mapped to their canonical names\n */\nexport const commands = {\n ...canonicalCommands,\n ...aliases,\n} as const\n\n/**\n * Canonical command names mapped to an array of its aliases\n */\nexport const commandAliases = Object.entries(aliases).reduce(\n (acc, [alias, canonical]) => {\n const commandAliases = acc.get(canonical)\n if (commandAliases) {\n commandAliases.push(alias)\n } else {\n acc.set(canonical, [alias])\n }\n return acc\n },\n new Map<string, string[]>(),\n)\n\nexport type Commands = typeof commands\n\nexport const getCommand = (\n s?: string,\n): Commands[keyof Commands] | undefined =>\n s && s in commands ? commands[s as keyof Commands] : undefined\n\nconst xdg = new XDG('vlt')\nconst cacheDir = xdg.cache()\n\n/**\n * Fields that are parsed as a set of key=value pairs\n */\nexport const recordFields = [\n 'git-hosts',\n 'registries',\n 'git-host-archives',\n 'scope-registries',\n] as const\n\nexport type RecordField = (typeof recordFields)[number]\n\nexport const isRecordField = (s: string): s is RecordField =>\n recordFields.includes(s as RecordField)\n\nconst stopParsingCommands: Commands[keyof Commands][] = [\n 'run',\n 'run-exec',\n 'exec-local',\n 'exec',\n]\n\nlet stopParsing: boolean | undefined = undefined\n\nconst j = jack({\n envPrefix: 'VLT',\n allowPositionals: true,\n usage: `vlt [<options>] [<cmd> [<args> ...]]`,\n stopAtPositionalTest: arg => {\n if (stopParsing) return true\n const a = arg as keyof Commands\n // we stop parsing AFTER the thing, so you can do\n // vlt run --vlt --configs scriptName --args --for --script\n // or\n // vlt exec --vlt --configs command --args --for --command\n if (stopParsingCommands.includes(commands[a])) {\n stopParsing = true\n }\n return false\n },\n})\n .heading('vlt')\n .description(\n `More documentation available at <https://docs.vlt.sh>`,\n )\n .heading('Subcommands')\n\nj.description(Object.keys(canonicalCommands).join(', '), {\n pre: true,\n}).description(\n 'Run `vlt <cmd> --help` for more information about a specific command',\n)\n\nexport const definition = j\n /**\n * Definition of all configuration values used by vlt.\n */\n .heading('Configuration')\n .description(\n `If a \\`vlt.json\\` file is present in the root of the current project,\n then that will be used as a source of configuration information.\n\n Next, the \\`vlt.json\\` file in the XDG specified config directory\n will be checked, and loaded for any fields not set in the local project.\n\n Object type values will be merged together. Set a field to \\`null\\` in\n the JSON configuration to explicitly remove it.\n\n Command-specific fields may be set in a nested \\`command\\` object that\n overrides any options defined at the top level.\n `,\n )\n\n .flag({\n color: {\n short: 'c',\n description: 'Use colors (Default for TTY)',\n },\n 'no-color': {\n short: 'C',\n description: 'Do not use colors (Default for non-TTY)',\n },\n })\n\n .opt({\n registry: {\n hint: 'url',\n default: 'https://registry.npmjs.org/',\n description: `Sets the registry for fetching packages, when no registry\n is explicitly set on a specifier.\n\n For example, \\`express@latest\\` will be resolved by looking\n up the metadata from this registry.\n\n Note that alias specifiers starting with \\`npm:\\` will\n still map to \\`https://registry.npmjs.org/\\` if this is\n changed, unless the a new mapping is created via the\n \\`--registries\\` option.\n `,\n },\n })\n\n .optList({\n registries: {\n hint: 'name=url',\n description: `Specify named registry hosts by their prefix. To set the\n default registry used for non-namespaced specifiers,\n use the \\`--registry\\` option.\n\n Prefixes can be used as a package alias. For example:\n\n \\`\\`\\`\n vlt --registries loc=http://reg.local install foo@loc:foo@1.x\n \\`\\`\\`\n\n By default, the public npm registry is registered to the\n \\`npm:\\` prefix. It is not recommended to change this\n mapping in most cases.\n `,\n },\n\n 'scope-registries': {\n hint: '@scope=url',\n description: `Map package name scopes to registry URLs.\n\n For example,\n \\`--scope-registries @acme=https://registry.acme/\\`\n would tell vlt to fetch any packages named\n \\`@acme/...\\` from the \\`https://registry.acme/\\`\n registry.\n\n Note: this way of specifying registries is more ambiguous,\n compared with using the \\`--registries\\` field and explicit\n prefixes, because instead of failing when the configuration\n is absent, it will instead attempt to fetch from the\n default registry.\n\n By comparison, using\n \\`--registries acme=https://registry.acme/\\` and then\n specifying dependencies such as \\`\"foo\": \"acme:foo@1.x\"\\`\n means that regardless of the name, the package will be\n fetched from the explicitly named registry, or fail if\n no registry is defined with that name.\n\n However, custom registry aliases are not supported by other\n package managers.`,\n },\n\n 'git-hosts': {\n hint: `name=template`,\n short: 'G',\n description: `Map a shorthand name to a git remote URL template.\n\n The \\`template\\` may contain placeholders, which will be\n swapped with the relevant values.\n\n \\`$1\\`, \\`$2\\`, etc. are replaced with the appropriate\n n-th path portion. For example, \\`github:user/project\\`\n would replace the \\`$1\\` in the template with \\`user\\`,\n and \\`$2\\` with \\`project\\`.`,\n },\n\n 'git-host-archives': {\n hint: `name=template`,\n short: 'A',\n description: `Similar to the \\`--git-host <name>=<template>\\` option,\n this option can define a template string that will be\n expanded to provide the URL to download a pre-built\n tarball of the git repository.\n\n In addition to the n-th path portion expansions performed\n by \\`--git-host\\`, this field will also expand the\n string \\`$committish\\` in the template, replacing it with\n the resolved git committish value to be fetched.`,\n },\n })\n\n .opt({\n cache: {\n hint: 'path',\n description: `\n Location of the vlt on-disk cache. Defaults to the platform-specific\n directory recommended by the XDG specification.\n `,\n default: cacheDir,\n },\n tag: {\n description: `Default \\`dist-tag\\` to install`,\n default: 'latest',\n },\n before: {\n hint: 'date',\n description: `Do not install any packages published after this date`,\n },\n os: {\n description: `The operating system to use as the selector when choosing\n packages based on their \\`os\\` value.`,\n default: process.platform,\n },\n arch: {\n description: `CPU architecture to use as the selector when choosing\n packages based on their \\`cpu\\` value.`,\n default: process.arch,\n },\n 'node-version': {\n hint: 'version',\n description: `Node version to use when choosing packages based on\n their \\`engines.node\\` value.`,\n default: process.version,\n },\n })\n\n .flag({\n 'git-shallow': {\n description: `Set to force \\`--depth=1\\` on all git clone actions.\n When set explicitly to false with --no-git-shallow,\n then \\`--depth=1\\` will not be used.\n\n When not set explicitly, \\`--depth=1\\` will be used for\n git hosts known to support this behavior.`,\n },\n })\n .num({\n 'fetch-retries': {\n hint: 'n',\n description: `Number of retries to perform when encountering network\n errors or likely-transient errors from git hosts.`,\n default: 3,\n },\n 'fetch-retry-factor': {\n hint: 'n',\n description: `The exponential backoff factor to use when retrying\n requests due to network issues.`,\n default: 2,\n },\n 'fetch-retry-mintimeout': {\n hint: 'n',\n description: `Number of milliseconds before starting first retry`,\n default: 0,\n },\n 'fetch-retry-maxtimeout': {\n hint: 'n',\n description: `Maximum number of milliseconds between two retries`,\n default: 30_000,\n },\n 'stale-while-revalidate-factor': {\n hint: 'n',\n default: 60,\n description: `If the server does not serve a \\`stale-while-revalidate\\`\n value in the \\`cache-control\\` header, then this multiplier\n is applied to the \\`max-age\\` or \\`s-maxage\\` values.\n\n By default, this is \\`60\\`, so for example a response that\n is cacheable for 5 minutes will allow a stale response\n while revalidating for up to 5 hours.\n\n If the server *does* provide a \\`stale-while-revalidate\\`\n value, then that is always used.\n\n Set to 0 to prevent any \\`stale-while-revalidate\\` behavior\n unless explicitly allowed by the server's \\`cache-control\\`\n header.\n `,\n },\n })\n\n .opt({\n identity: {\n short: 'i',\n validate: (v: unknown) =>\n typeof v === 'string' && /^[a-z0-9]*$/.test(v),\n hint: 'name',\n default: '',\n description: `Provide a string to define an identity for storing auth\n information when logging into registries.\n\n Authentication tokens will be stored in the XDG data\n directory, in \\`vlt/auth/$\\{identity}/keychain.json\\`.\n\n If no identity is provided, then the default \\`''\\` will\n be used, storing the file at \\`vlt/auth/keychain.json\\`.\n\n May only contain lowercase alphanumeric characters.\n `,\n },\n })\n\n .optList({\n workspace: {\n hint: 'ws',\n short: 'w',\n description: `Set to limit the spaces being worked on when working on\n workspaces.\n\n Can be paths or glob patterns matching paths.\n\n Specifying workspaces by package.json name is not\n supported.`,\n },\n 'workspace-group': {\n short: 'g',\n description: `Specify named workspace group names to load and operate on\n when doing recursive operations on workspaces.`,\n },\n })\n\n .flag({\n recursive: {\n short: 'r',\n description: `Run an operation across multiple workspaces.\n\n No effect when used in non-monorepo projects.\n\n Implied by setting --workspace or --workspace-group. If\n not set, then the action is run on the project root.`,\n },\n\n bail: {\n short: 'b',\n description: `When running scripts across multiple workspaces, stop\n on the first failure.`,\n default: true,\n },\n\n 'no-bail': {\n short: 'B',\n description: `When running scripts across multiple workspaces, continue\n on failure, running the script for all workspaces.`,\n },\n })\n\n .opt({\n config: {\n hint: 'user | project',\n description: `Specify whether to operate on user-level or project-level\n configuration files when running \\`vlt config\\` commands.`,\n validOptions: ['user', 'project'] as const,\n default: 'project',\n },\n\n editor: {\n hint: 'program',\n description: `The blocking editor to use for \\`vlt config edit\\` and\n any other cases where a file should be opened for\n editing.\n\n Defaults to the \\`EDITOR\\` or \\`VISUAL\\` env if set, or\n \\`notepad.exe\\` on Windows, or \\`vi\\` elsewhere.`,\n default:\n process.env.EDITOR ||\n process.env.VISUAL ||\n (process.platform === 'win32' ?\n `${process.env.SYSTEMROOT}\\\\notepad.exe`\n : 'vi'),\n },\n\n 'script-shell': {\n hint: 'program',\n description: `The shell to use when executing \\`package.json#scripts\\`\n (either as lifecycle scripts or explicitly with\n \\`vlt run\\`) and \\`vlt exec\\`.\n\n If not set, defaults to \\`/bin/sh\\` on POSIX systems,\n and \\`cmd.exe\\` on Windows.\n\n When no argument is provided to \\`vlt exec\\`, the \\`SHELL\\`\n environment variable takes precedence if set.`,\n },\n\n 'fallback-command': {\n hint: 'command',\n description: `The command to run when the first argument doesn't\n match any known commands.\n\n For pnpm-style behavior, set this to 'run-exec'. e.g:\n \\`\\`\\`\n vlt config set fallback-command=run-exec\n \\`\\`\\``,\n default: 'help',\n validOptions: Object.keys(canonicalCommands),\n },\n })\n\n .opt({\n package: {\n hint: 'p',\n description: `When running \\`vlt exec\\`, this allows you to explicitly\n set the package to search for bins. If not provided, then\n vlt will interpret the first argument as the package, and\n attempt to run the default executable.`,\n },\n })\n\n .opt({\n view: {\n hint: 'output',\n default: defaultView,\n description: `Configures the output format for commands.\n\n Defaults to \\`human\\` if stdout is a TTY, or \\`json\\`\n if it is not.\n\n - human: Maximally ergonomic output reporting for human\n consumption.\n - json: Parseable JSON output for machines.\n - inspect: Output results with \\`util.inspect\\`.\n - gui: Start a local web server and opens a browser to\n explore the results. (Only relevant for certain\n commands.)\n - mermaid: Output mermaid diagramming syntax. (Only\n relevant for certain commands.)\n\n If the requested view format is not supported for the\n current command, or if no option is provided, then it\n will fall back to the default.\n `,\n validOptions: [\n 'human',\n 'json',\n 'mermaid',\n 'gui',\n 'inspect',\n ] as const,\n },\n })\n\n .optList({\n 'dashboard-root': {\n hint: 'path',\n description: `The root directory to use for the dashboard GUI.\n If not set, the user home directory is used.`,\n },\n })\n\n .flag({\n 'save-dev': {\n short: 'D',\n description: `Save installed packages to a package.json file as\n devDependencies`,\n },\n 'save-optional': {\n short: 'O',\n description: `Save installed packages to a package.json file as\n optionalDependencies`,\n },\n 'save-peer': {\n description: `Save installed packages to a package.json file as\n peerDependencies`,\n },\n 'save-prod': {\n short: 'P',\n description: `Save installed packages into dependencies specifically.\n This is useful if a package already exists in\n devDependencies or optionalDependencies, but you want to\n move it to be a non-optional production dependency.`,\n },\n })\n\n .flag({\n version: {\n short: 'v',\n description: 'Print the version',\n },\n })\n\n .flag({\n help: {\n short: 'h',\n description: 'Print helpful information',\n },\n })\n\n .opt({\n 'expect-results': {\n hint: 'value',\n validate: (v: unknown) =>\n typeof v === 'string' && /^([<>]=?)?[0-9]+$/.test(v),\n description: `When running \\`vlt query\\`, this option allows you to\n set a expected number of resulting items.\n\n Accepted values are numbers and strings.\n\n Strings starting with \\`>\\`, \\`<\\`, \\`>=\\` or \\`<=\\`\n followed by a number can be used to check if the result\n is greater than or less than a specific number.`,\n },\n })\n"]}
@@ -29,6 +29,7 @@ import { kIndent, kNewline } from 'polite-json';
29
29
  import type { Commands, RecordField } from './definition.ts';
30
30
  import { commands, definition, isRecordField, recordFields } from './definition.ts';
31
31
  export { commands, definition, isRecordField, recordFields, type Commands, };
32
+ export declare const kCustomInspect: unique symbol;
32
33
  export type RecordPairs = Record<string, unknown>;
33
34
  export type RecordString = Record<string, string>;
34
35
  export type ConfigFiles = Record<string, ConfigFileData>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/config/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAI7C,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAG7D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAExC,OAAO,EAGL,OAAO,EACP,QAAQ,EACT,MAAM,aAAa,CAAA;AAEpB,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC5D,OAAO,EACL,QAAQ,EACR,UAAU,EAEV,aAAa,EACb,YAAY,EACb,MAAM,iBAAiB,CAAA;AAExB,OAAO,EACL,QAAQ,EACR,UAAU,EACV,a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
  import { commands, definition, getCommand, isRecordField, recordFields, } from "./definition.js";
36
36
  import { merge } from "./merge.js";
37
37
  export { commands, definition, isRecordField, recordFields, };
38
+ export const kCustomInspect = Symbol.for('nodejs.util.inspect.custom');
38
39
  // turn a set of pairs into a Record object.
39
40
  // if a kv pair doesn't have a = character, set to `''`
40
41
  const reducePairs = (pairs) => {
@@ -130,6 +131,12 @@ export class Config {
130
131
  const options = Object.assign(asRecords, extras);
131
132
  this.#options = Object.assign(options, {
132
133
  packageInfo: new PackageInfoClient(options),
134
+ [kCustomInspect]() {
135
+ return Object.fromEntries(Object.entries(options).filter(([k]) => k !== 'monorepo' &&
136
+ k !== 'scurry' &&
137
+ k !== 'packageJson' &&
138
+ k !== 'packageInfo'));
139
+ },
133
140
  });
134
141
  return this.#options;
135
142
  }