@visulima/vis 1.0.0-alpha.10 → 1.0.0-alpha.11

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 (120) hide show
  1. package/CHANGELOG.md +95 -42
  2. package/LICENSE.md +213 -0
  3. package/README.md +8 -4
  4. package/dist/bin.js +9 -1
  5. package/dist/config/index.d.ts +1818 -0
  6. package/dist/config/index.js +2 -0
  7. package/dist/generate/index.d.ts +1 -1
  8. package/dist/generate/index.js +3 -1
  9. package/dist/packem_chunks/applyDefaults.js +336 -0
  10. package/dist/packem_chunks/bin.js +9554 -64
  11. package/dist/packem_chunks/doctor-probe.js +112 -0
  12. package/dist/packem_chunks/fix.js +229 -48
  13. package/dist/packem_chunks/handler.js +99 -1
  14. package/dist/packem_chunks/handler10.js +53 -1
  15. package/dist/packem_chunks/handler11.js +32 -1
  16. package/dist/packem_chunks/handler12.js +100 -2
  17. package/dist/packem_chunks/handler13.js +25 -1
  18. package/dist/packem_chunks/handler14.js +916 -5
  19. package/dist/packem_chunks/handler15.js +206 -1
  20. package/dist/packem_chunks/handler16.js +122 -18
  21. package/dist/packem_chunks/handler17.js +13 -1
  22. package/dist/packem_chunks/handler18.js +106 -1
  23. package/dist/packem_chunks/handler19.js +19 -1
  24. package/dist/packem_chunks/handler2.js +75 -1
  25. package/dist/packem_chunks/handler20.js +29 -1
  26. package/dist/packem_chunks/handler21.js +222 -1
  27. package/dist/packem_chunks/handler22.js +237 -5
  28. package/dist/packem_chunks/handler23.js +101 -1
  29. package/dist/packem_chunks/handler24.js +110 -1
  30. package/dist/packem_chunks/handler25.js +402 -5
  31. package/dist/packem_chunks/handler26.js +13 -1
  32. package/dist/packem_chunks/handler27.js +63 -3
  33. package/dist/packem_chunks/handler28.js +34 -1
  34. package/dist/packem_chunks/handler29.js +458 -7
  35. package/dist/packem_chunks/handler3.js +95 -2
  36. package/dist/packem_chunks/handler30.js +168 -21
  37. package/dist/packem_chunks/handler31.js +530 -3
  38. package/dist/packem_chunks/handler32.js +214 -2
  39. package/dist/packem_chunks/handler33.js +119 -24
  40. package/dist/packem_chunks/handler34.js +630 -2
  41. package/dist/packem_chunks/handler35.js +283 -19
  42. package/dist/packem_chunks/handler36.js +521 -407
  43. package/dist/packem_chunks/handler37.js +762 -22
  44. package/dist/packem_chunks/handler38.js +989 -22
  45. package/dist/packem_chunks/handler39.js +574 -22
  46. package/dist/packem_chunks/handler4.js +90 -4
  47. package/dist/packem_chunks/handler40.js +1685 -3
  48. package/dist/packem_chunks/handler41.js +1088 -10
  49. package/dist/packem_chunks/handler42.js +785 -141
  50. package/dist/packem_chunks/handler43.js +2658 -42
  51. package/dist/packem_chunks/handler44.js +3886 -3
  52. package/dist/packem_chunks/handler45.js +2568 -21
  53. package/dist/packem_chunks/handler46.js +3769 -0
  54. package/dist/packem_chunks/handler47.js +1491 -0
  55. package/dist/packem_chunks/handler5.js +174 -2
  56. package/dist/packem_chunks/handler6.js +95 -13
  57. package/dist/packem_chunks/handler7.js +115 -8
  58. package/dist/packem_chunks/handler8.js +12 -1
  59. package/dist/packem_chunks/handler9.js +29 -1
  60. package/dist/packem_chunks/heal-accept.js +522 -0
  61. package/dist/packem_chunks/heal.js +673 -0
  62. package/dist/packem_chunks/index.js +873 -7
  63. package/dist/packem_chunks/loader.js +23 -1
  64. package/dist/packem_shared/VisUpdateApp-D-Yz_wvg.js +1316 -0
  65. package/dist/packem_shared/_commonjsHelpers-BqLXS_qQ.js +5 -0
  66. package/dist/packem_shared/ai-analysis-CHeB1joD.js +367 -0
  67. package/dist/packem_shared/ai-cache-Be_jexe4.js +142 -0
  68. package/dist/packem_shared/ai-fix-B9iQVcD2.js +379 -0
  69. package/dist/packem_shared/cache-directory-2qvs4goY.js +98 -0
  70. package/dist/packem_shared/catalog-BJTtyi-O.js +1371 -0
  71. package/dist/packem_shared/dependency-scan-A0KSklpG.js +188 -0
  72. package/dist/packem_shared/docker-2iZzc280.js +181 -0
  73. package/dist/packem_shared/failure-log-Cz3Z4SKL.js +100 -0
  74. package/dist/packem_shared/flakiness-goTxXuCX.js +180 -0
  75. package/dist/packem_shared/otel-DCvqCTz_.js +158 -0
  76. package/dist/packem_shared/otelPlugin-DFaLDvJf.js +3 -0
  77. package/dist/packem_shared/registry-CbqXI0rc.js +272 -0
  78. package/dist/packem_shared/run-summary-utils-PVMl4aIh.js +130 -0
  79. package/dist/packem_shared/runtime-check-Cobi3p6l.js +127 -0
  80. package/dist/packem_shared/selectors-SM69TfqC.js +194 -0
  81. package/dist/packem_shared/symbols-Ta7g2nU-.js +14 -0
  82. package/dist/packem_shared/toolchain-BdZd9eBi.js +975 -0
  83. package/dist/packem_shared/typosquats-C-bCh3PX.js +1210 -0
  84. package/dist/packem_shared/use-measured-height-CNP0vT4M.js +20 -0
  85. package/dist/packem_shared/utils-CthVdBPS.js +40 -0
  86. package/dist/packem_shared/xxh3-Ck8mXNg1.js +239 -0
  87. package/index.js +727 -555
  88. package/package.json +35 -17
  89. package/schemas/project.schema.json +8 -10
  90. package/schemas/vis-config.schema.json +132 -8
  91. package/skills/vis/SKILL.md +96 -0
  92. package/templates/buildkite-ci/.buildkite/pipeline.yml.tera +85 -0
  93. package/templates/buildkite-ci/template.yml +20 -0
  94. package/dist/errors/index.d.ts +0 -26
  95. package/dist/errors/index.js +0 -1
  96. package/dist/packem_chunks/config.js +0 -2
  97. package/dist/packem_shared/VisConfigCycleError-CAYNC7d-.js +0 -1
  98. package/dist/packem_shared/VisConfigError-B5LP1zRf.js +0 -1
  99. package/dist/packem_shared/VisConfigLoadError-CeqBSd2Z.js +0 -2
  100. package/dist/packem_shared/VisConfigNotFoundError-DZ9KC527.js +0 -5
  101. package/dist/packem_shared/VisUpdateApp-D-L4_-Iu.js +0 -1
  102. package/dist/packem_shared/_commonjsHelpers-D6W6KoPK.js +0 -1
  103. package/dist/packem_shared/ai-analysis-CGuy7dfE.js +0 -67
  104. package/dist/packem_shared/ai-cache-Bynt6Y9x.js +0 -1
  105. package/dist/packem_shared/cache-directory-D72ZEag2.js +0 -1
  106. package/dist/packem_shared/catalog-BVPerCwG.js +0 -12
  107. package/dist/packem_shared/dependency-scan-Du0tBu64.js +0 -2
  108. package/dist/packem_shared/docker-BcfqH4Av.js +0 -2
  109. package/dist/packem_shared/failure-log-DqYen0LC.js +0 -2
  110. package/dist/packem_shared/flakiness-DSIHZGBT.js +0 -1
  111. package/dist/packem_shared/run-summary-utils-C24Aaf9E.js +0 -1
  112. package/dist/packem_shared/runtime-check-CGHal8SO.js +0 -1
  113. package/dist/packem_shared/selectors-CfH9ZY08.js +0 -3
  114. package/dist/packem_shared/symbols-CQmER5MT.js +0 -1
  115. package/dist/packem_shared/target-merge-DNa-6eWu.js +0 -1
  116. package/dist/packem_shared/toolchain-DQfTQY8E.js +0 -5
  117. package/dist/packem_shared/typosquats-DOR8izpX.js +0 -1
  118. package/dist/packem_shared/use-measured-height-DjYgUOKk.js +0 -1
  119. package/dist/packem_shared/utils-DrNg0XTR.js +0 -1
  120. package/dist/packem_shared/xxh3-DrAUNq4n.js +0 -1
@@ -1 +1,110 @@
1
- var b=Object.defineProperty;var j=(t,e)=>b(t,"name",{value:e,configurable:!0});import{createTaskGraph as v}from"@visulima/task-runner";import{r as y,s as E}from"./bin.js";var T=Object.defineProperty,w=j((t,e)=>T(t,"name",{value:e,configurable:!0}),"h");const O=w((t,e)=>{const s=new Map;for(const[i,r]of Object.entries(t.dependencies))for(const f of r){const c=s.get(f)??[];c.push(i),s.set(f,c)}if(!t.tasks[e])return;const a=new Set([e]),o=[{node:e,path:[e]}];for(;o.length>0;){const i=o.shift();if(t.roots.includes(i.node))return i.path;for(const r of s.get(i.node)??[])a.has(r)||(a.add(r),o.push({node:r,path:[r,...i.path]}))}return[e]},"findShortestPathToRoot"),x=w((t,e)=>{const s=[];for(const[a,o]of Object.entries(t.dependencies))o.includes(e)&&s.push(a);return s.sort()},"collectParents"),I=w(async({argument:t,logger:e,visConfig:s,workspaceRoot:a})=>{if(!a)throw new Error("Could not determine workspace root.");const o=t[0];if(!o)throw new Error("No task ID specified. Usage: vis task-why <project>:<target>");if(!o.includes(":"))throw new Error(`Invalid task ID "${o}" — expected format "project:target".`);const{packageJsons:i,workspace:r}=y(a,s),f=E(a,r,i),[c,k]=o.split(":",2),$=r.projects[c];if(!$)throw new Error(`Unknown project "${c}".`);if(!$.targets?.[k])throw new Error(`Project "${c}" has no target "${k}".`);const m=Object.entries(r.projects).flatMap(([n,u])=>Object.keys(u.targets??{}).map(h=>({id:`${n}:${h}`,outputs:[],overrides:{},target:{project:n,target:h}}))),p=v(m,{projectGraph:f,workspace:r});if(!p.tasks[o])throw new Error(`Task "${o}" is not reachable in the graph.`);const d=O(p,o),g=x(p,o);if(e.info(""),e.info(`Why ${o}?`),e.info(""),d&&d.length>1){e.info("Shortest path from a root to this task:");for(const[n,u]of d.entries()){const h=n===0?" ":`${" ".repeat(n+1)}└─ `;e.info(`${h}${u}`)}e.info("")}else e.info(" This task is itself a root — nothing upstream depends on it."),e.info("");if(g.length>0){e.info(`Directly depended on by ${g.length} task(s):`);for(const n of g)e.info(` - ${n}`);e.info("")}const l=p.dependencies[o]??[];if(l.length>0){e.info(`This task depends on ${l.length} task(s):`);for(const n of[...l].sort())e.info(` - ${n}`);e.info("")}},"execute");export{I as default};
1
+ import { createTaskGraph } from '@visulima/task-runner';
2
+ import { d as discoverWorkspace, b as buildProjectGraph } from './bin.js';
3
+
4
+ const findShortestPathToRoot = (graph, target) => {
5
+ const reverse = /* @__PURE__ */ new Map();
6
+ for (const [parent, deps] of Object.entries(graph.dependencies)) {
7
+ for (const dep of deps) {
8
+ const list = reverse.get(dep) ?? [];
9
+ list.push(parent);
10
+ reverse.set(dep, list);
11
+ }
12
+ }
13
+ if (!graph.tasks[target]) {
14
+ return void 0;
15
+ }
16
+ const visited = /* @__PURE__ */ new Set([target]);
17
+ const queue = [{ node: target, path: [target] }];
18
+ while (queue.length > 0) {
19
+ const current = queue.shift();
20
+ if (graph.roots.includes(current.node)) {
21
+ return current.path;
22
+ }
23
+ for (const parent of reverse.get(current.node) ?? []) {
24
+ if (visited.has(parent)) {
25
+ continue;
26
+ }
27
+ visited.add(parent);
28
+ queue.push({ node: parent, path: [parent, ...current.path] });
29
+ }
30
+ }
31
+ return [target];
32
+ };
33
+ const collectParents = (graph, target) => {
34
+ const parents = [];
35
+ for (const [parent, deps] of Object.entries(graph.dependencies)) {
36
+ if (deps.includes(target)) {
37
+ parents.push(parent);
38
+ }
39
+ }
40
+ return parents.sort();
41
+ };
42
+ const execute = async ({ argument, logger, visConfig, workspaceRoot: wsRoot }) => {
43
+ if (!wsRoot) {
44
+ throw new Error("Could not determine workspace root.");
45
+ }
46
+ const taskId = argument[0];
47
+ if (!taskId) {
48
+ throw new Error("No task ID specified. Usage: vis task-why <project>:<target>");
49
+ }
50
+ if (!taskId.includes(":")) {
51
+ throw new Error(`Invalid task ID "${taskId}" — expected format "project:target".`);
52
+ }
53
+ const { packageJsons, workspace } = discoverWorkspace(wsRoot, visConfig);
54
+ const projectGraph = buildProjectGraph(wsRoot, workspace, packageJsons);
55
+ const [projectName, targetName] = taskId.split(":", 2);
56
+ const project = workspace.projects[projectName];
57
+ if (!project) {
58
+ throw new Error(`Unknown project "${projectName}".`);
59
+ }
60
+ if (!project.targets?.[targetName]) {
61
+ throw new Error(`Project "${projectName}" has no target "${targetName}".`);
62
+ }
63
+ const allInitialTasks = Object.entries(workspace.projects).flatMap(
64
+ ([name, proj]) => Object.keys(proj.targets ?? {}).map((t) => {
65
+ return {
66
+ id: `${name}:${t}`,
67
+ outputs: [],
68
+ overrides: {},
69
+ target: { project: name, target: t }
70
+ };
71
+ })
72
+ );
73
+ const graph = createTaskGraph(allInitialTasks, { projectGraph, workspace });
74
+ if (!graph.tasks[taskId]) {
75
+ throw new Error(`Task "${taskId}" is not reachable in the graph.`);
76
+ }
77
+ const path = findShortestPathToRoot(graph, taskId);
78
+ const parents = collectParents(graph, taskId);
79
+ logger.info("");
80
+ logger.info(`Why ${taskId}?`);
81
+ logger.info("");
82
+ if (path && path.length > 1) {
83
+ logger.info("Shortest path from a root to this task:");
84
+ for (const [index, node] of path.entries()) {
85
+ const prefix = index === 0 ? " " : `${" ".repeat(index + 1)}└─ `;
86
+ logger.info(`${prefix}${node}`);
87
+ }
88
+ logger.info("");
89
+ } else {
90
+ logger.info(" This task is itself a root — nothing upstream depends on it.");
91
+ logger.info("");
92
+ }
93
+ if (parents.length > 0) {
94
+ logger.info(`Directly depended on by ${parents.length} task(s):`);
95
+ for (const parent of parents) {
96
+ logger.info(` - ${parent}`);
97
+ }
98
+ logger.info("");
99
+ }
100
+ const directDeps = graph.dependencies[taskId] ?? [];
101
+ if (directDeps.length > 0) {
102
+ logger.info(`This task depends on ${directDeps.length} task(s):`);
103
+ for (const dep of [...directDeps].sort()) {
104
+ logger.info(` - ${dep}`);
105
+ }
106
+ logger.info("");
107
+ }
108
+ };
109
+
110
+ export { execute as default };
@@ -1,5 +1,402 @@
1
- var P=Object.defineProperty;var v=(e,n)=>P(e,"name",{value:n,configurable:!0});import{createRequire as R}from"node:module";import{green as S,red as W,yellow as A,dim as d}from"@visulima/colorize";import{join as N}from"@visulima/path";import{p as o}from"./bin.js";import{S as w,g as C,w as j,b as B,p as q,f as k,a as M,c as H,u as y,d as K,e as O,h as D}from"../packem_shared/toolchain-DQfTQY8E.js";const I=R(import.meta.url),$=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,b=v(e=>{if(typeof $<"u"&&$.versions&&$.versions.node){const[n,i]=$.versions.node.split(".").map(Number);if(n>22||n===22&&i>=3||n===20&&i>=16)return $.getBuiltinModule(e)}return I(e)},"__cjs_getBuiltinModule"),{spawnSync:U}=b("node:child_process"),{writeFileSync:F}=b("node:fs");var L=Object.defineProperty,f=v((e,n)=>L(e,"name",{value:n,configurable:!0}),"d");const x=["bun","deno","go","node","npm","pnpm","python","ruby","rust","yarn"],G=f(e=>x.includes(e),"isKnownTool"),p=f(e=>e?S("✓"):W("✗"),"icon"),T=A("⚠"),J=f(e=>{if(e.installed){const n=e.version?` v${e.version}`:"",i=e.configFiles.length>0?` (${e.configFiles.join(", ")})`:"";return`${p(!0)} ${e.name}${n}${i}`}return`${T} ${e.name} — referenced by ${e.configFiles.join(", ")} but not installed`},"renderManagerLine"),z=f(e=>{if(e.matches)return"";const{manager:n}=e;return n.name==="none"?d("→ (no manager)"):n.name==="self-activate"?"":n.installed?d(`→ ${n.name}`):d(`→ ${n.name} (missing)`)},"renderToolManager"),Q=f(e=>e.matches?p(!0):e.actual?T:p(!1),"toolIcon"),V=f(e=>{if(o.info(""),o.info(d("── Toolchain ───────────────────────")),e.detected.length===0)o.info(` ${p(!1)} No version manager detected`),o.notice(` Install one of: ${w.join(", ")}`);else for(const n of e.detected)o.info(` ${J(n)}`);if(o.info(""),e.tools.length===0){o.info(` ${d("No tool pins found — add engines.node, .nvmrc, or a manager config file.")}`);return}o.info(d("── Tools ───────────────────────────"));for(const n of e.tools){const i=`${n.expected.tool} ${n.expected.version}`,s=n.actual?`actual ${n.actual}`:"not installed",t=n.matches?"":d(` [${n.expected.source}]`),r=z(n),u=r===""?"":` ${r}`;o.info(` ${Q(n)} ${i} — ${s}${t}${u}`),n.manager.note&&o.notice(` ${n.manager.note}`)}},"printStatus"),X=f((e,n,i)=>{const s=C(e,n);if(i.json){process.stdout.write(`${JSON.stringify({detected:s.detected.map(r=>({binPath:r.binPath??null,configFiles:r.configFiles,installed:r.installed,name:r.name,version:r.version??null})),tools:s.tools.map(r=>({actual:r.actual??null,expected:r.expected.version,manager:r.manager.name,managerInstalled:r.manager.installed,matches:r.matches,note:r.manager.note??null,source:r.expected.source,tool:r.expected.tool}))},void 0,2)}
2
- `);return}V(s);const t=s.tools.filter(r=>!r.matches);t.length>0&&(o.info(""),o.notice(" Run `vis toolchain install` to install pinned versions.")),i.exitCode&&t.length>0&&(process.exitCode=1)},"executeStatus"),Y=f(e=>{const n=new Map;for(const i of e){const s=n.get(i.manager.name);s?s.push(i):n.set(i.manager.name,[i])}return n},"groupByManager"),_=f((e,n,i)=>U(e,n,{cwd:i,stdio:"inherit"}).status??1,"runInvocation"),Z=f((e,n,i)=>{const s=C(e,n),t=s.tools.filter(c=>!c.matches);if(t.length===0){o.success("Everything already matches — nothing to install.");return}const r=t.some(c=>c.manager.name!=="self-activate"&&c.manager.name!=="none");if(s.detected.length===0&&r){o.error(`No version manager detected. Install one of: ${w.join(", ")}.`),process.exitCode=1;return}const u=Y(t);let l=!1,g=0;for(const[c,m]of u){if(c==="self-activate"){for(const{expected:a}of m){if(a.source==="packageManager")o.info(`${d("$")} (${a.tool} will self-activate from packageManager on next invocation)`);else if(o.info(`${d("$")} Writing packageManager=${a.tool}@${a.version}`),i.dryRun)l=!0;else try{j(e,a),l=!0}catch(h){o.error(h.message),g=1}o.notice(` ${a.tool} ${a.version} — no install needed`)}continue}if(c==="none"){for(const{expected:a}of m)o.warn(`Cannot install ${a.tool} ${a.version} — no manager can handle it.`);g=1;continue}if(!s.detected.find(a=>a.name===c)?.installed){o.error(`${c} is referenced but not on PATH — install it first, then rerun \`vis toolchain install\`.`),g=1;continue}const E=m.map(a=>B(c,a.expected)).filter(Boolean);for(const a of E){if(!a)continue;if(a.bin==="nvm"&&a.args.length===0){o.error("nvm is a shell function — run `nvm install` in your shell, then rerun `vis toolchain install`."),a.hint&&o.notice(` ${a.hint}`),g=1;continue}if(o.info(`${d("$")} ${a.bin} ${a.args.join(" ")}`),a.hint&&o.notice(` ${a.hint}`),i.dryRun){l=!0;continue}const h=_(a.bin,a.args,e);if(l=!0,h!==0){g=h;break}}}if(g!==0){process.exitCode=g;return}l&&o.success("Toolchain installed.")},"executeInstall"),ee=f((e,n,i,s)=>{if(!i)throw new Error("Usage: vis toolchain use <tool>@<version> (e.g. vis toolchain use node@22.13.0)");const t=q(i);if(!t)throw new Error(`Could not parse "${i}". Expected "<tool>@<version>" where <tool> is one of ${x.join(", ")}.`);const r=k(e),u=M(t,r,n);if(u.name==="none"){o.error(`No manager can pin ${t.tool}. Install one of: ${w.join(", ")}.`),process.exitCode=1;return}if(!u.installed){o.error(`The best manager for ${t.tool} (${u.name}) is not on PATH. ${u.note??""}`),process.exitCode=1;return}const l=H(u.name,t);if(!l){o.error(`${u.name} cannot pin ${t.tool}. Use a different manager, or set \`toolchain.tools.${t.tool}\` in vis.config.ts.`),process.exitCode=1;return}if(u.name==="self-activate"){if(o.info(`${d("→")} Writing packageManager field to package.json...`),s.dryRun){o.notice(` Would set packageManager: "${t.tool}@${t.version}"`);return}try{const c=j(e,t);if(!c){o.error(`Refusing to pin non-package-manager tool ${t.tool} via the packageManager field.`),process.exitCode=1;return}if(o.success(`Set packageManager: "${c}" — ${t.tool} will activate this version on next invocation.`),s.engines!==!1){const m=y(e,t);m&&o.success(`Updated package.json engines.${t.tool} → ${m}.`)}}catch(c){o.error(c.message),process.exitCode=1}return}if(l.args.length===0&&u.name==="nvm"&&t.tool==="node"){const c=N(e,".nvmrc");if(o.info(`${d("→")} Writing ${c}...`),s.dryRun){o.notice(` Would write ${t.version} to .nvmrc`);return}try{F(c,`${t.version}
3
- `)}catch(m){o.error(`Failed to write .nvmrc: ${m.message}`),process.exitCode=1;return}o.success(`Wrote ${t.version} to .nvmrc.`),o.notice(" nvm is a shell function — run `nvm use` to activate it in this shell.");return}if(l.args.length===0){o.error(`${u.name} cannot pin ${t.tool} from a subprocess. ${l.configChange?.hint??""}`),l.configChange&&o.notice(` Edit ${l.configChange.file} by hand and rerun \`vis toolchain status\` to verify.`),process.exitCode=1;return}if(o.info(`${d("$")} ${l.bin} ${l.args.join(" ")}`),l.configChange&&o.notice(` Will update ${l.configChange.file} — ${l.configChange.hint}`),s.dryRun)return;const g=_(l.bin,l.args,e);if(g!==0){process.exitCode=g;return}if(o.success(`Pinned ${t.tool} to ${t.version}.`),s.engines!==!1)try{const c=y(e,t);c&&o.success(`Updated package.json engines.${t.tool} → ${c}.`)}catch(c){o.warn(`Could not update engines.${t.tool}: ${c.message}`)}},"executeUse"),ne=f((e,n,i)=>{if(!i)throw new Error("Usage: vis toolchain which <tool> (e.g. vis toolchain which node)");const s=i.toLowerCase();if(!G(s))throw new Error(`Unknown tool "${i}". Known: ${x.join(", ")}.`);const t=k(e),r=M({source:"vis.config.ts",tool:s,version:"*"},t,n),u=r.installed&&r.name!=="self-activate"&&r.name!=="none"?t.find(g=>g.name===r.name):void 0,l=u?K(u,s):O(s);if(!l){o.error(`${i} not found in PATH${u?` or via ${u.name}`:""}.`),process.exitCode=1;return}process.stdout.write(`${l}
4
- `)},"executeWhich"),oe=f((e,n)=>{const i=D(e,n);process.stdout.write(`${i.name}
5
- `)},"executeDetect"),le=f(async({argument:e,options:n,visConfig:i,workspaceRoot:s})=>{if(!s)throw new Error("Could not determine workspace root. Run inside a monorepo.");const t=e[0]??"status",r=i?.toolchain;switch(t){case"detect":{oe(s,r);return}case"install":{Z(s,r,n);return}case"status":{X(s,r,n);return}case"use":{ee(s,r,e[1],n);return}case"which":{ne(s,r,e[1]);return}default:throw new Error(`Unknown toolchain action "${t}". Known: status, detect, install, use, which.`)}},"execute");export{le as default};
1
+ import { createRequire as __cjs_createRequire } from "node:module";
2
+
3
+ const __cjs_require = __cjs_createRequire(import.meta.url);
4
+
5
+ const __cjs_getProcess = typeof globalThis !== "undefined" && typeof globalThis.process !== "undefined" ? globalThis.process : process;
6
+
7
+ const __cjs_getBuiltinModule = (module) => {
8
+ // Check if we're in Node.js and version supports getBuiltinModule
9
+ if (typeof __cjs_getProcess !== "undefined" && __cjs_getProcess.versions && __cjs_getProcess.versions.node) {
10
+ const [major, minor] = __cjs_getProcess.versions.node.split(".").map(Number);
11
+ // Node.js 20.16.0+ and 22.3.0+
12
+ if (major > 22 || (major === 22 && minor >= 3) || (major === 20 && minor >= 16)) {
13
+ return __cjs_getProcess.getBuiltinModule(module);
14
+ }
15
+ }
16
+ // Fallback to createRequire
17
+ return __cjs_require(module);
18
+ };
19
+
20
+ const {
21
+ spawnSync
22
+ } = __cjs_getBuiltinModule("node:child_process");
23
+ const {
24
+ writeFileSync
25
+ } = __cjs_getBuiltinModule("node:fs");
26
+ import { dim, green, red, yellow } from '@visulima/colorize';
27
+ import { join } from '@visulima/path';
28
+ import { p as pail } from './bin.js';
29
+ import { f as findInstalledManagers, a as resolveManagerFor, b as resolveToolBinary, c as findOnPathByAlias, p as parseUseArgument, S as SUPPORTED_MANAGERS, d as buildUseInvocation, w as writePackageManagerField, u as updateEnginesField, g as getToolchainStatus, e as buildInstallInvocation, h as pickPrimaryManager } from '../packem_shared/toolchain-BdZd9eBi.js';
30
+
31
+ const KNOWN_TOOLS = ["bun", "deno", "go", "node", "npm", "pnpm", "python", "ruby", "rust", "yarn"];
32
+ const isKnownTool = (value) => KNOWN_TOOLS.includes(value);
33
+ const icon = (ok) => ok ? green("✓") : red("✗");
34
+ const warnIcon = yellow("⚠");
35
+ const renderManagerLine = (manager) => {
36
+ if (manager.installed) {
37
+ const ver = manager.version ? ` v${manager.version}` : "";
38
+ const cfg = manager.configFiles.length > 0 ? ` (${manager.configFiles.join(", ")})` : "";
39
+ return `${icon(true)} ${manager.name}${ver}${cfg}`;
40
+ }
41
+ return `${warnIcon} ${manager.name} — referenced by ${manager.configFiles.join(", ")} but not installed`;
42
+ };
43
+ const renderToolManager = (tool) => {
44
+ if (tool.matches) {
45
+ return "";
46
+ }
47
+ const { manager } = tool;
48
+ if (manager.name === "none") {
49
+ return dim("→ (no manager)");
50
+ }
51
+ if (manager.name === "self-activate") {
52
+ return "";
53
+ }
54
+ return manager.installed ? dim(`→ ${manager.name}`) : dim(`→ ${manager.name} (missing)`);
55
+ };
56
+ const toolIcon = (tool) => {
57
+ if (tool.matches) {
58
+ return icon(true);
59
+ }
60
+ return tool.actual ? warnIcon : icon(false);
61
+ };
62
+ const printStatus = (status) => {
63
+ pail.info("");
64
+ pail.info(dim("── Toolchain ───────────────────────"));
65
+ if (status.detected.length === 0) {
66
+ pail.info(` ${icon(false)} No version manager detected`);
67
+ pail.notice(` Install one of: ${SUPPORTED_MANAGERS.join(", ")}`);
68
+ } else {
69
+ for (const manager of status.detected) {
70
+ pail.info(` ${renderManagerLine(manager)}`);
71
+ }
72
+ }
73
+ pail.info("");
74
+ if (status.tools.length === 0) {
75
+ pail.info(` ${dim("No tool pins found — add engines.node, .nvmrc, or a manager config file.")}`);
76
+ return;
77
+ }
78
+ pail.info(dim("── Tools ───────────────────────────"));
79
+ for (const tool of status.tools) {
80
+ const expected = `${tool.expected.tool} ${tool.expected.version}`;
81
+ const actualText = tool.actual ? `actual ${tool.actual}` : "not installed";
82
+ const source = tool.matches ? "" : dim(` [${tool.expected.source}]`);
83
+ const managerText = renderToolManager(tool);
84
+ const suffix = managerText === "" ? "" : ` ${managerText}`;
85
+ pail.info(` ${toolIcon(tool)} ${expected} — ${actualText}${source}${suffix}`);
86
+ if (tool.manager.note) {
87
+ pail.notice(` ${tool.manager.note}`);
88
+ }
89
+ }
90
+ };
91
+ const executeStatus = (workspaceRoot, toolchainConfig, options) => {
92
+ const status = getToolchainStatus(workspaceRoot, toolchainConfig);
93
+ if (options.json) {
94
+ process.stdout.write(
95
+ `${JSON.stringify(
96
+ {
97
+ detected: status.detected.map((m) => {
98
+ return {
99
+ binPath: m.binPath ?? null,
100
+ configFiles: m.configFiles,
101
+ installed: m.installed,
102
+ name: m.name,
103
+ version: m.version ?? null
104
+ };
105
+ }),
106
+ tools: status.tools.map((t) => {
107
+ return {
108
+ actual: t.actual ?? null,
109
+ expected: t.expected.version,
110
+ manager: t.manager.name,
111
+ managerInstalled: t.manager.installed,
112
+ matches: t.matches,
113
+ note: t.manager.note ?? null,
114
+ source: t.expected.source,
115
+ tool: t.expected.tool
116
+ };
117
+ })
118
+ },
119
+ void 0,
120
+ 2
121
+ )}
122
+ `
123
+ );
124
+ return;
125
+ }
126
+ printStatus(status);
127
+ const mismatches = status.tools.filter((t) => !t.matches);
128
+ if (mismatches.length > 0) {
129
+ pail.info("");
130
+ pail.notice(" Run `vis toolchain install` to install pinned versions.");
131
+ }
132
+ if (options.exitCode && mismatches.length > 0) {
133
+ process.exitCode = 1;
134
+ }
135
+ };
136
+ const groupByManager = (tools) => {
137
+ const groups = /* @__PURE__ */ new Map();
138
+ for (const tool of tools) {
139
+ const bucket = groups.get(tool.manager.name);
140
+ if (bucket) {
141
+ bucket.push(tool);
142
+ } else {
143
+ groups.set(tool.manager.name, [tool]);
144
+ }
145
+ }
146
+ return groups;
147
+ };
148
+ const runInvocation = (bin, args, cwd) => {
149
+ const result = spawnSync(bin, args, { cwd, stdio: "inherit" });
150
+ return result.status ?? 1;
151
+ };
152
+ const executeInstall = (workspaceRoot, toolchainConfig, options) => {
153
+ const status = getToolchainStatus(workspaceRoot, toolchainConfig);
154
+ const mismatches = status.tools.filter((t) => !t.matches);
155
+ if (mismatches.length === 0) {
156
+ pail.success("Everything already matches — nothing to install.");
157
+ return;
158
+ }
159
+ const needsRealManager = mismatches.some((m) => m.manager.name !== "self-activate" && m.manager.name !== "none");
160
+ if (status.detected.length === 0 && needsRealManager) {
161
+ pail.error(`No version manager detected. Install one of: ${SUPPORTED_MANAGERS.join(", ")}.`);
162
+ process.exitCode = 1;
163
+ return;
164
+ }
165
+ const groups = groupByManager(mismatches);
166
+ let ranAnything = false;
167
+ let exitCode = 0;
168
+ for (const [managerName, tools] of groups) {
169
+ if (managerName === "self-activate") {
170
+ for (const { expected } of tools) {
171
+ if (expected.source === "packageManager") {
172
+ pail.info(`${dim("$")} (${expected.tool} will self-activate from packageManager on next invocation)`);
173
+ } else {
174
+ pail.info(`${dim("$")} Writing packageManager=${expected.tool}@${expected.version}`);
175
+ if (options.dryRun) {
176
+ ranAnything = true;
177
+ } else {
178
+ try {
179
+ writePackageManagerField(workspaceRoot, expected);
180
+ ranAnything = true;
181
+ } catch (error) {
182
+ pail.error(error.message);
183
+ exitCode = 1;
184
+ }
185
+ }
186
+ }
187
+ pail.notice(` ${expected.tool} ${expected.version} — no install needed`);
188
+ }
189
+ continue;
190
+ }
191
+ if (managerName === "none") {
192
+ for (const { expected } of tools) {
193
+ pail.warn(`Cannot install ${expected.tool} ${expected.version} — no manager can handle it.`);
194
+ }
195
+ exitCode = 1;
196
+ continue;
197
+ }
198
+ const manager = status.detected.find((d) => d.name === managerName);
199
+ if (!manager?.installed) {
200
+ pail.error(`${managerName} is referenced but not on PATH — install it first, then rerun \`vis toolchain install\`.`);
201
+ exitCode = 1;
202
+ continue;
203
+ }
204
+ const invocations = tools.map((t) => buildInstallInvocation(managerName, t.expected)).filter(Boolean);
205
+ for (const invocation of invocations) {
206
+ if (!invocation) {
207
+ continue;
208
+ }
209
+ if (invocation.bin === "nvm" && invocation.args.length === 0) {
210
+ pail.error("nvm is a shell function — run `nvm install` in your shell, then rerun `vis toolchain install`.");
211
+ if (invocation.hint) {
212
+ pail.notice(` ${invocation.hint}`);
213
+ }
214
+ exitCode = 1;
215
+ continue;
216
+ }
217
+ pail.info(`${dim("$")} ${invocation.bin} ${invocation.args.join(" ")}`);
218
+ if (invocation.hint) {
219
+ pail.notice(` ${invocation.hint}`);
220
+ }
221
+ if (options.dryRun) {
222
+ ranAnything = true;
223
+ continue;
224
+ }
225
+ const status_ = runInvocation(invocation.bin, invocation.args, workspaceRoot);
226
+ ranAnything = true;
227
+ if (status_ !== 0) {
228
+ exitCode = status_;
229
+ break;
230
+ }
231
+ }
232
+ }
233
+ if (exitCode !== 0) {
234
+ process.exitCode = exitCode;
235
+ return;
236
+ }
237
+ if (ranAnything) {
238
+ pail.success("Toolchain installed.");
239
+ }
240
+ };
241
+ const executeUse = (workspaceRoot, toolchainConfig, rawSpec, options) => {
242
+ if (!rawSpec) {
243
+ throw new Error("Usage: vis toolchain use <tool>@<version> (e.g. vis toolchain use node@22.13.0)");
244
+ }
245
+ const spec = parseUseArgument(rawSpec);
246
+ if (!spec) {
247
+ throw new Error(`Could not parse "${rawSpec}". Expected "<tool>@<version>" where <tool> is one of ${KNOWN_TOOLS.join(", ")}.`);
248
+ }
249
+ const detected = findInstalledManagers(workspaceRoot);
250
+ const manager = resolveManagerFor(spec, detected, toolchainConfig);
251
+ if (manager.name === "none") {
252
+ pail.error(`No manager can pin ${spec.tool}. Install one of: ${SUPPORTED_MANAGERS.join(", ")}.`);
253
+ process.exitCode = 1;
254
+ return;
255
+ }
256
+ if (!manager.installed) {
257
+ pail.error(`The best manager for ${spec.tool} (${manager.name}) is not on PATH. ${manager.note ?? ""}`);
258
+ process.exitCode = 1;
259
+ return;
260
+ }
261
+ const invocation = buildUseInvocation(manager.name, spec);
262
+ if (!invocation) {
263
+ pail.error(`${manager.name} cannot pin ${spec.tool}. Use a different manager, or set \`toolchain.tools.${spec.tool}\` in vis.config.ts.`);
264
+ process.exitCode = 1;
265
+ return;
266
+ }
267
+ if (manager.name === "self-activate") {
268
+ pail.info(`${dim("→")} Writing packageManager field to package.json...`);
269
+ if (options.dryRun) {
270
+ pail.notice(` Would set packageManager: "${spec.tool}@${spec.version}"`);
271
+ return;
272
+ }
273
+ try {
274
+ const written = writePackageManagerField(workspaceRoot, spec);
275
+ if (!written) {
276
+ pail.error(`Refusing to pin non-package-manager tool ${spec.tool} via the packageManager field.`);
277
+ process.exitCode = 1;
278
+ return;
279
+ }
280
+ pail.success(`Set packageManager: "${written}" — ${spec.tool} will activate this version on next invocation.`);
281
+ if (options.engines !== false) {
282
+ const updated = updateEnginesField(workspaceRoot, spec);
283
+ if (updated) {
284
+ pail.success(`Updated package.json engines.${spec.tool} → ${updated}.`);
285
+ }
286
+ }
287
+ } catch (error) {
288
+ pail.error(error.message);
289
+ process.exitCode = 1;
290
+ }
291
+ return;
292
+ }
293
+ if (invocation.args.length === 0 && manager.name === "nvm" && spec.tool === "node") {
294
+ const nvmrcPath = join(workspaceRoot, ".nvmrc");
295
+ pail.info(`${dim("→")} Writing ${nvmrcPath}...`);
296
+ if (options.dryRun) {
297
+ pail.notice(` Would write ${spec.version} to .nvmrc`);
298
+ return;
299
+ }
300
+ try {
301
+ writeFileSync(nvmrcPath, `${spec.version}
302
+ `);
303
+ } catch (error) {
304
+ pail.error(`Failed to write .nvmrc: ${error.message}`);
305
+ process.exitCode = 1;
306
+ return;
307
+ }
308
+ pail.success(`Wrote ${spec.version} to .nvmrc.`);
309
+ pail.notice(" nvm is a shell function — run `nvm use` to activate it in this shell.");
310
+ return;
311
+ }
312
+ if (invocation.args.length === 0) {
313
+ pail.error(`${manager.name} cannot pin ${spec.tool} from a subprocess. ${invocation.configChange?.hint ?? ""}`);
314
+ if (invocation.configChange) {
315
+ pail.notice(` Edit ${invocation.configChange.file} by hand and rerun \`vis toolchain status\` to verify.`);
316
+ }
317
+ process.exitCode = 1;
318
+ return;
319
+ }
320
+ pail.info(`${dim("$")} ${invocation.bin} ${invocation.args.join(" ")}`);
321
+ if (invocation.configChange) {
322
+ pail.notice(` Will update ${invocation.configChange.file} — ${invocation.configChange.hint}`);
323
+ }
324
+ if (options.dryRun) {
325
+ return;
326
+ }
327
+ const status_ = runInvocation(invocation.bin, invocation.args, workspaceRoot);
328
+ if (status_ !== 0) {
329
+ process.exitCode = status_;
330
+ return;
331
+ }
332
+ pail.success(`Pinned ${spec.tool} to ${spec.version}.`);
333
+ if (options.engines !== false) {
334
+ try {
335
+ const updated = updateEnginesField(workspaceRoot, spec);
336
+ if (updated) {
337
+ pail.success(`Updated package.json engines.${spec.tool} → ${updated}.`);
338
+ }
339
+ } catch (error) {
340
+ pail.warn(`Could not update engines.${spec.tool}: ${error.message}`);
341
+ }
342
+ }
343
+ };
344
+ const executeWhich = (workspaceRoot, toolchainConfig, rawTool) => {
345
+ if (!rawTool) {
346
+ throw new Error("Usage: vis toolchain which <tool> (e.g. vis toolchain which node)");
347
+ }
348
+ const normalized = rawTool.toLowerCase();
349
+ if (!isKnownTool(normalized)) {
350
+ throw new Error(`Unknown tool "${rawTool}". Known: ${KNOWN_TOOLS.join(", ")}.`);
351
+ }
352
+ const detected = findInstalledManagers(workspaceRoot);
353
+ const resolved = resolveManagerFor({ source: "vis.config.ts", tool: normalized, version: "*" }, detected, toolchainConfig);
354
+ const manager = resolved.installed && resolved.name !== "self-activate" && resolved.name !== "none" ? detected.find((d) => d.name === resolved.name) : void 0;
355
+ const binary = manager ? resolveToolBinary(manager, normalized) : findOnPathByAlias(normalized);
356
+ if (!binary) {
357
+ pail.error(`${rawTool} not found in PATH${manager ? ` or via ${manager.name}` : ""}.`);
358
+ process.exitCode = 1;
359
+ return;
360
+ }
361
+ process.stdout.write(`${binary}
362
+ `);
363
+ };
364
+ const executeDetect = (workspaceRoot, toolchainConfig) => {
365
+ const primary = pickPrimaryManager(workspaceRoot, toolchainConfig);
366
+ process.stdout.write(`${primary.name}
367
+ `);
368
+ };
369
+ const execute = async ({ argument, options, visConfig, workspaceRoot: wsRoot }) => {
370
+ if (!wsRoot) {
371
+ throw new Error("Could not determine workspace root. Run inside a monorepo.");
372
+ }
373
+ const action = argument[0] ?? "status";
374
+ const toolchainConfig = visConfig?.toolchain;
375
+ switch (action) {
376
+ case "detect": {
377
+ executeDetect(wsRoot, toolchainConfig);
378
+ return;
379
+ }
380
+ case "install": {
381
+ executeInstall(wsRoot, toolchainConfig, options);
382
+ return;
383
+ }
384
+ case "status": {
385
+ executeStatus(wsRoot, toolchainConfig, options);
386
+ return;
387
+ }
388
+ case "use": {
389
+ executeUse(wsRoot, toolchainConfig, argument[1], options);
390
+ return;
391
+ }
392
+ case "which": {
393
+ executeWhich(wsRoot, toolchainConfig, argument[1]);
394
+ return;
395
+ }
396
+ default: {
397
+ throw new Error(`Unknown toolchain action "${action}". Known: status, detect, install, use, which.`);
398
+ }
399
+ }
400
+ };
401
+
402
+ export { execute as default };
@@ -1 +1,13 @@
1
- var f=Object.defineProperty;var s=(e,o)=>f(e,"name",{value:o,configurable:!0});import{J as p,h as u}from"./bin.js";var d=Object.defineProperty,g=s((e,o)=>d(e,"name",{value:o,configurable:!0}),"c");const x=g(async({argument:e,logger:o,options:c,visConfig:n,workspaceRoot:t})=>{const i=e||[],a=t??process.cwd(),l=p(a,{configBackend:n?.install?.backend}),r=u(l,i,c.recursive||!1,a,o);r!==0&&(process.exitCode=r)},"execute");export{x as default};
1
+ import { r as resolveInstaller, B as runUnlink } from './bin.js';
2
+
3
+ const execute = async ({ argument, logger, options, visConfig, workspaceRoot: wsRoot }) => {
4
+ const packages = argument || [];
5
+ const cwd = wsRoot ?? process.cwd();
6
+ const pm = resolveInstaller(cwd, { configBackend: visConfig?.install?.backend });
7
+ const code = runUnlink(pm, packages, options.recursive || false, cwd, logger);
8
+ if (code !== 0) {
9
+ process.exitCode = code;
10
+ }
11
+ };
12
+
13
+ export { execute as default };
@@ -1,3 +1,63 @@
1
- var a=Object.defineProperty;var s=(n,e)=>a(n,"name",{value:e,configurable:!0});import{createRequire as f}from"node:module";import{m as v}from"./bin.js";const d=f(import.meta.url),t=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,l=s(n=>{if(typeof t<"u"&&t.versions&&t.versions.node){const[e,r]=t.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return t.getBuiltinModule(n)}return d(n)},"__cjs_getBuiltinModule"),{execSync:p,spawnSync:m}=l("node:child_process");var g=Object.defineProperty,y=s((n,e)=>g(n,"name",{value:e,configurable:!0}),"r");const w=y(async({argument:n,logger:e,options:r})=>{const c=n?.[0];e.info("info: checking for updates...");const o=v.version;let i;try{const u=p("npm view @visulima/vis version",{encoding:"utf8"}).trim();i=c??u}catch{throw new Error("Failed to query npm registry. Check your network connection.")}if(o===i&&!r.force){e.info(`
2
- ✓ Already up to date (${o})`);return}if(r.check){o===i?e.info(`✓ Already up to date (${o})`):e.info(`info: found @visulima/vis@${i} (current: ${o})`);return}if(e.info(`info: found @visulima/vis@${i} (current: ${o})`),e.info("info: installing..."),m("npm",["install","-g",`@visulima/vis@${i}`],{encoding:"utf8",stdio:"inherit"}).status!==0)throw new Error("Failed to update. Try running with sudo or fix npm permissions.");e.info(`
3
- Updated @visulima/vis from ${o} → ${i}`)},"execute");export{w as default};
1
+ import { createRequire as __cjs_createRequire } from "node:module";
2
+
3
+ const __cjs_require = __cjs_createRequire(import.meta.url);
4
+
5
+ const __cjs_getProcess = typeof globalThis !== "undefined" && typeof globalThis.process !== "undefined" ? globalThis.process : process;
6
+
7
+ const __cjs_getBuiltinModule = (module) => {
8
+ // Check if we're in Node.js and version supports getBuiltinModule
9
+ if (typeof __cjs_getProcess !== "undefined" && __cjs_getProcess.versions && __cjs_getProcess.versions.node) {
10
+ const [major, minor] = __cjs_getProcess.versions.node.split(".").map(Number);
11
+ // Node.js 20.16.0+ and 22.3.0+
12
+ if (major > 22 || (major === 22 && minor >= 3) || (major === 20 && minor >= 16)) {
13
+ return __cjs_getProcess.getBuiltinModule(module);
14
+ }
15
+ }
16
+ // Fallback to createRequire
17
+ return __cjs_require(module);
18
+ };
19
+
20
+ const {
21
+ execSync,
22
+ spawnSync
23
+ } = __cjs_getBuiltinModule("node:child_process");
24
+ import { C as pkg } from './bin.js';
25
+
26
+ const execute = async ({ argument, logger, options }) => {
27
+ const targetVersion = argument?.[0];
28
+ logger.info("info: checking for updates...");
29
+ const currentVersion = pkg.version;
30
+ let latestVersion;
31
+ try {
32
+ const result2 = execSync("npm view @visulima/vis version", { encoding: "utf8" }).trim();
33
+ latestVersion = targetVersion ?? result2;
34
+ } catch {
35
+ throw new Error("Failed to query npm registry. Check your network connection.");
36
+ }
37
+ if (currentVersion === latestVersion && !options.force) {
38
+ logger.info(`
39
+ ✓ Already up to date (${currentVersion})`);
40
+ return;
41
+ }
42
+ if (options.check) {
43
+ if (currentVersion === latestVersion) {
44
+ logger.info(`✓ Already up to date (${currentVersion})`);
45
+ } else {
46
+ logger.info(`info: found @visulima/vis@${latestVersion} (current: ${currentVersion})`);
47
+ }
48
+ return;
49
+ }
50
+ logger.info(`info: found @visulima/vis@${latestVersion} (current: ${currentVersion})`);
51
+ logger.info("info: installing...");
52
+ const result = spawnSync("npm", ["install", "-g", `@visulima/vis@${latestVersion}`], {
53
+ encoding: "utf8",
54
+ stdio: "inherit"
55
+ });
56
+ if (result.status !== 0) {
57
+ throw new Error("Failed to update. Try running with sudo or fix npm permissions.");
58
+ }
59
+ logger.info(`
60
+ ✓ Updated @visulima/vis from ${currentVersion} → ${latestVersion}`);
61
+ };
62
+
63
+ export { execute as default };
@@ -1 +1,34 @@
1
- var p=Object.defineProperty;var t=(o,a)=>p(o,"name",{value:a,configurable:!0});import{J as f,i as d}from"./bin.js";import{o as g}from"../packem_shared/utils-DrNg0XTR.js";var v=Object.defineProperty,u=t((o,a)=>v(o,"name",{value:a,configurable:!0}),"c");const k=u(async({argument:o,logger:a,options:e,visConfig:n,workspaceRoot:i})=>{const s=o;if(!s||s.length===0)throw new Error("No packages specified. Usage: vis why <package...>");const l=i??process.cwd(),c=f(l,{configBackend:n?.install?.backend}),r=d(c,{depth:e.depth===void 0?void 0:Number(e.depth),dev:e.dev||!1,filter:g(e.filter),global:e.global||!1,json:e.json||!1,long:e.long||!1,noOptional:e.noOptional||!1,packages:s,parseable:e.parseable||!1,prod:e.prod||!1,recursive:e.recursive||!1},l,a);r!==0&&r!==1&&(process.exitCode=r)},"execute");export{k as default};
1
+ import { r as resolveInstaller, E as runWhy } from './bin.js';
2
+ import { t as toStringArray } from '../packem_shared/utils-CthVdBPS.js';
3
+
4
+ const execute = async ({ argument, logger, options, visConfig, workspaceRoot: wsRoot }) => {
5
+ const packages = argument;
6
+ if (!packages || packages.length === 0) {
7
+ throw new Error("No packages specified. Usage: vis why <package...>");
8
+ }
9
+ const cwd = wsRoot ?? process.cwd();
10
+ const pm = resolveInstaller(cwd, { configBackend: visConfig?.install?.backend });
11
+ const code = runWhy(
12
+ pm,
13
+ {
14
+ depth: options.depth === void 0 ? void 0 : Number(options.depth),
15
+ dev: options.dev || false,
16
+ filter: toStringArray(options.filter),
17
+ global: options.global || false,
18
+ json: options.json || false,
19
+ long: options.long || false,
20
+ noOptional: options.noOptional || false,
21
+ packages,
22
+ parseable: options.parseable || false,
23
+ prod: options.prod || false,
24
+ recursive: options.recursive || false
25
+ },
26
+ cwd,
27
+ logger
28
+ );
29
+ if (code !== 0 && code !== 1) {
30
+ process.exitCode = code;
31
+ }
32
+ };
33
+
34
+ export { execute as default };