@visulima/vis 1.0.0-alpha.14 → 1.0.0-alpha.15

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 (87) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/LICENSE.md +936 -1
  3. package/dist/bin.js +1 -1
  4. package/dist/config/index.js +1 -1
  5. package/dist/packem_chunks/applyDefaults.js +2 -2
  6. package/dist/packem_chunks/bin.js +314 -311
  7. package/dist/packem_chunks/fix.js +1 -1
  8. package/dist/packem_chunks/handler.js +1 -1
  9. package/dist/packem_chunks/handler10.js +1 -1
  10. package/dist/packem_chunks/handler12.js +5 -5
  11. package/dist/packem_chunks/handler14.js +3 -3
  12. package/dist/packem_chunks/handler15.js +1 -1
  13. package/dist/packem_chunks/handler18.js +1 -1
  14. package/dist/packem_chunks/handler19.js +1 -1
  15. package/dist/packem_chunks/handler2.js +1 -1
  16. package/dist/packem_chunks/handler20.js +1 -1
  17. package/dist/packem_chunks/handler22.js +1 -1
  18. package/dist/packem_chunks/handler23.js +1 -1
  19. package/dist/packem_chunks/handler24.js +1 -1
  20. package/dist/packem_chunks/handler25.js +1 -1
  21. package/dist/packem_chunks/handler26.js +1 -1
  22. package/dist/packem_chunks/handler27.js +2 -2
  23. package/dist/packem_chunks/handler28.js +7 -7
  24. package/dist/packem_chunks/handler3.js +1 -1
  25. package/dist/packem_chunks/handler30.js +10 -10
  26. package/dist/packem_chunks/handler31.js +1 -1
  27. package/dist/packem_chunks/handler32.js +1 -1
  28. package/dist/packem_chunks/handler33.js +21 -21
  29. package/dist/packem_chunks/handler34.js +2 -2
  30. package/dist/packem_chunks/handler35.js +3 -3
  31. package/dist/packem_chunks/handler36.js +20 -20
  32. package/dist/packem_chunks/handler37.js +1 -1
  33. package/dist/packem_chunks/handler38.js +2 -2
  34. package/dist/packem_chunks/handler39.js +10 -10
  35. package/dist/packem_chunks/handler40.js +5 -5
  36. package/dist/packem_chunks/handler41.js +10 -24
  37. package/dist/packem_chunks/handler42.js +24 -10
  38. package/dist/packem_chunks/handler43.js +5 -5
  39. package/dist/packem_chunks/handler44.js +5 -5
  40. package/dist/packem_chunks/handler45.js +3 -3
  41. package/dist/packem_chunks/handler46.js +11 -11
  42. package/dist/packem_chunks/handler47.js +15 -15
  43. package/dist/packem_chunks/handler48.js +6 -6
  44. package/dist/packem_chunks/handler5.js +1 -1
  45. package/dist/packem_chunks/handler6.js +1 -1
  46. package/dist/packem_chunks/handler7.js +1 -1
  47. package/dist/packem_chunks/heal-accept.js +1 -1
  48. package/dist/packem_chunks/heal.js +1 -1
  49. package/dist/packem_chunks/help-command.js +1 -1
  50. package/dist/packem_chunks/index.js +2 -2
  51. package/dist/packem_chunks/loader.js +1 -1
  52. package/dist/packem_chunks/tar.js +1 -1
  53. package/dist/packem_shared/{ai-analysis-Dzs_nUwM.js → ai-analysis-CGVjqwdc.js} +1 -1
  54. package/dist/packem_shared/ai-cache-BdPgSfg2.js +1 -0
  55. package/dist/packem_shared/{ai-fix-BmLM72GS.js → ai-fix-iHtGLkJS.js} +1 -1
  56. package/dist/packem_shared/cache-directory-DTfMSzT9.js +1 -0
  57. package/dist/packem_shared/dependency-scan-SQeRzrpJ.js +2 -0
  58. package/dist/packem_shared/docker-D5p9mRPU.js +2 -0
  59. package/dist/packem_shared/failure-log-CElcbnb9.js +2 -0
  60. package/dist/packem_shared/flakiness-C4t4_NoA.js +1 -0
  61. package/dist/packem_shared/{giget-BX2ixMoa.js → giget-CcEy_Elm.js} +2 -2
  62. package/dist/packem_shared/lockfile-B7JJzxnL.js +1 -0
  63. package/dist/packem_shared/otel-CO8UEfTa.js +17 -0
  64. package/dist/packem_shared/otelPlugin-DTynZDWh.js +1 -0
  65. package/dist/packem_shared/readTomlSync-1fKo0R52-DAKNI1Me.js +109 -0
  66. package/dist/packem_shared/registry-D04iOQ5H.js +2 -0
  67. package/dist/packem_shared/run-summary-utils-BPraMTcm.js +1 -0
  68. package/dist/packem_shared/{runtime-check-BaKni2y1.js → runtime-check-l4qFpo08.js} +1 -1
  69. package/dist/packem_shared/{selectors-BvtUXWGY.js → selectors-Sem2CTYA.js} +1 -1
  70. package/dist/packem_shared/{toolchain-B7sIiJxK.js → toolchain-BhZNts--.js} +3 -3
  71. package/dist/packem_shared/typosquats-Dr7VIL2B.js +1 -0
  72. package/dist/packem_shared/verify-C6NNOhTA.js +1 -0
  73. package/dist/packem_shared/{vis-update-app-DR8c4OfG.js → vis-update-app-DGiMc5kb.js} +1 -1
  74. package/package.json +10 -12
  75. package/dist/packem_shared/ai-cache-Dtvmbsru.js +0 -1
  76. package/dist/packem_shared/cache-directory-xASJia6M.js +0 -1
  77. package/dist/packem_shared/dependency-scan-DmwPKwLy.js +0 -2
  78. package/dist/packem_shared/docker-CA-scYu0.js +0 -2
  79. package/dist/packem_shared/failure-log-fD4DiFb1.js +0 -2
  80. package/dist/packem_shared/flakiness-BIg1rwvp.js +0 -1
  81. package/dist/packem_shared/index-OlP7U_t5.js +0 -6
  82. package/dist/packem_shared/lockfile-BXylopgH.js +0 -1
  83. package/dist/packem_shared/otelPlugin-y5hoCw4b.js +0 -1
  84. package/dist/packem_shared/registry-BHqKXiLb.js +0 -2
  85. package/dist/packem_shared/run-summary-utils-D39XBHWW.js +0 -1
  86. package/dist/packem_shared/typosquats-XkC1CnOa.js +0 -1
  87. package/dist/packem_shared/verify-BVTcVfoW.js +0 -1
@@ -1 +1 @@
1
- var d=Object.defineProperty;var f=(t,s)=>d(t,"name",{value:s,configurable:!0});import{isAccessibleSync as h,readFileSync as k,readJsonSync as v}from"@visulima/fs";import{M as m}from"./index-OlP7U_t5.js";var y=Object.defineProperty,g=f((t,s)=>y(t,"name",{value:s,configurable:!0}),"p");const M=g(t=>{for(const s of[".nvmrc",".node-version"]){const i=m(t,s);if(h(i))try{return k(i).trim().replace(/^v/,"")}catch{}}},"readNodeVersionFile"),l=g((t,s)=>{const i=t.split(/[.\-+]/).map(r=>Number.parseInt(r,10)||0),c=s.split(/[.\-+]/).map(r=>Number.parseInt(r,10)||0),e=Math.max(i.length,c.length);for(let r=0;r<e;r++){const n=i[r]??0,a=c[r]??0;if(n!==a)return n-a}return 0},"compareVersions"),$=g((t,s)=>{const i=s.trim();if(i===""||i==="*")return!0;const c=i.split(/\s+/).filter(Boolean);for(const e of c)if(e.startsWith(">=")){if(l(t,e.slice(2).trim())<0)return!1}else if(e.startsWith("<=")){if(l(t,e.slice(2).trim())>0)return!1}else if(e.startsWith(">")){if(l(t,e.slice(1).trim())<=0)return!1}else if(e.startsWith("<")){if(l(t,e.slice(1).trim())>=0)return!1}else if(/^\d/.test(e)){const r=t.split("."),n=e.split(".");for(const[a,o]of n.entries())if(o!==r[a])return!1}return!0},"satisfiesRange"),N=g(t=>{const s=[],i=m(t,"package.json");let c;try{c=v(i)}catch{return s}const e=process.versions.node;if(c.engines?.node){const n=c.engines.node;$(e,n)||s.push({actual:e,expected:n,kind:"node",message:`package.json engines.node requires ${n}, but the current Node.js is ${e}.`,severity:"error"})}const r=M(t);if(r){const[n,a]=r.split("."),[o,p]=e.split(".");(n!==o||a!==void 0&&a!==p)&&s.push({actual:e,expected:r,kind:"node",message:`.nvmrc pins Node ${r} but the current Node.js is ${e}. Run \`nvm use\` or switch runtimes.`,severity:"warning"})}if(c.packageManager){const[n,a]=c.packageManager.split("@"),o=(process.env.npm_config_user_agent??"").split(" ")[0]??"",[p,u]=o.split("/");p&&n&&p!==n?s.push({actual:p,expected:n,kind:"packageManager",message:`package.json packageManager pins ${c.packageManager} but the current invocation is ${o}. Install the correct package manager.`,severity:"error"}):u&&a&&u!==a&&s.push({actual:u,expected:a,kind:"packageManager",message:`package.json packageManager pins ${n}@${a} but the current invocation uses ${n}@${u}.`,severity:"warning"})}return s},"checkRuntimeVersions");export{N as c};
1
+ var d=Object.defineProperty;var f=(t,s)=>d(t,"name",{value:s,configurable:!0});import{M as m,i as h,$ as k,n as v}from"./otel-CO8UEfTa.js";var $=Object.defineProperty,g=f((t,s)=>$(t,"name",{value:s,configurable:!0}),"p");const M=g(t=>{for(const s of[".nvmrc",".node-version"]){const i=m(t,s);if(h(i))try{return k(i).trim().replace(/^v/,"")}catch{}}},"readNodeVersionFile"),l=g((t,s)=>{const i=t.split(/[.\-+]/).map(r=>Number.parseInt(r,10)||0),c=s.split(/[.\-+]/).map(r=>Number.parseInt(r,10)||0),e=Math.max(i.length,c.length);for(let r=0;r<e;r++){const n=i[r]??0,a=c[r]??0;if(n!==a)return n-a}return 0},"compareVersions"),b=g((t,s)=>{const i=s.trim();if(i===""||i==="*")return!0;const c=i.split(/\s+/).filter(Boolean);for(const e of c)if(e.startsWith(">=")){if(l(t,e.slice(2).trim())<0)return!1}else if(e.startsWith("<=")){if(l(t,e.slice(2).trim())>0)return!1}else if(e.startsWith(">")){if(l(t,e.slice(1).trim())<=0)return!1}else if(e.startsWith("<")){if(l(t,e.slice(1).trim())>=0)return!1}else if(/^\d/.test(e)){const r=t.split("."),n=e.split(".");for(const[a,o]of n.entries())if(o!==r[a])return!1}return!0},"satisfiesRange"),x=g(t=>{const s=[],i=m(t,"package.json");let c;try{c=v(i)}catch{return s}const e=process.versions.node;if(c.engines?.node){const n=c.engines.node;b(e,n)||s.push({actual:e,expected:n,kind:"node",message:`package.json engines.node requires ${n}, but the current Node.js is ${e}.`,severity:"error"})}const r=M(t);if(r){const[n,a]=r.split("."),[o,p]=e.split(".");(n!==o||a!==void 0&&a!==p)&&s.push({actual:e,expected:r,kind:"node",message:`.nvmrc pins Node ${r} but the current Node.js is ${e}. Run \`nvm use\` or switch runtimes.`,severity:"warning"})}if(c.packageManager){const[n,a]=c.packageManager.split("@"),o=(process.env.npm_config_user_agent??"").split(" ")[0]??"",[p,u]=o.split("/");p&&n&&p!==n?s.push({actual:p,expected:n,kind:"packageManager",message:`package.json packageManager pins ${c.packageManager} but the current invocation is ${o}. Install the correct package manager.`,severity:"error"}):u&&a&&u!==a&&s.push({actual:u,expected:a,kind:"packageManager",message:`package.json packageManager pins ${n}@${a} but the current invocation uses ${n}@${u}.`,severity:"warning"})}return s},"checkRuntimeVersions");export{x as c};
@@ -1,3 +1,3 @@
1
- var w=Object.defineProperty;var m=(e,t)=>w(e,"name",{value:t,configurable:!0});import{createRequire as v}from"node:module";import{z as b}from"./index-OlP7U_t5.js";const k=v(import.meta.url),j=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_=m(e=>{if(typeof j<"u"&&j.versions&&j.versions.node){const[t,r]=j.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return j.getBuiltinModule(e)}return k(e)},"__cjs_getBuiltinModule"),{createInterface:$}=_("node:readline");var T=Object.defineProperty,f=m((e,t)=>T(e,"name",{value:t,configurable:!0}),"g");const q=/^#([\w\-/]+):(.+)$/,x=/^([@\w\-/]+):(.+)$/,P=f(e=>{if(e==="")return;if(e.startsWith(":"))return{kind:"all",target:e.slice(1)};if(e.startsWith("~:"))return{kind:"closest",target:e.slice(2)};const t=q.exec(e);if(t?.[1]&&t[2])return{kind:"tag",tag:t[1],target:t[2]};const r=x.exec(e);return r?.[1]&&r[2]&&(r[1].startsWith("@")||r[1].includes("/")||r[1].includes("-"))?{kind:"project",projects:[r[1]],target:r[2]}:{kind:"all",target:e}},"parseTargetSelector"),N=f(async(e,t,r,a)=>{const s=P(e);if(!s)throw new Error(`Invalid target selector: "${e}"`);const c=Object.keys(t.projects);if(s.kind==="all")return{projects:c,target:s.target};if(s.kind==="project")return{projects:s.projects??[],target:s.target};if(s.kind==="tag"){const o=s.tag;return{projects:c.filter(i=>t.projects[i]?.tags?.includes(o)??!1),target:s.target}}const n=b(a,r)||".";let p,l=-1;for(const[o,i]of Object.entries(t.projects)){const u=i.root;u&&(n===u||n.startsWith(`${u}/`))&&u.length>l&&(l=u.length,p=o)}if(!p){if(process.stdout.isTTY){const o=$({input:process.stdin,output:process.stderr}),i=Object.keys(t.projects).sort();process.stderr.write(`No project found at ${n}. Pick one:
1
+ var w=Object.defineProperty;var m=(e,t)=>w(e,"name",{value:t,configurable:!0});import{createRequire as v}from"node:module";import{z as b}from"./otel-CO8UEfTa.js";const k=v(import.meta.url),j=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_=m(e=>{if(typeof j<"u"&&j.versions&&j.versions.node){const[t,r]=j.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return j.getBuiltinModule(e)}return k(e)},"__cjs_getBuiltinModule"),{createInterface:$}=_("node:readline");var T=Object.defineProperty,f=m((e,t)=>T(e,"name",{value:t,configurable:!0}),"g");const q=/^#([\w\-/]+):(.+)$/,x=/^([@\w\-/]+):(.+)$/,P=f(e=>{if(e==="")return;if(e.startsWith(":"))return{kind:"all",target:e.slice(1)};if(e.startsWith("~:"))return{kind:"closest",target:e.slice(2)};const t=q.exec(e);if(t?.[1]&&t[2])return{kind:"tag",tag:t[1],target:t[2]};const r=x.exec(e);return r?.[1]&&r[2]&&(r[1].startsWith("@")||r[1].includes("/")||r[1].includes("-"))?{kind:"project",projects:[r[1]],target:r[2]}:{kind:"all",target:e}},"parseTargetSelector"),N=f(async(e,t,r,a)=>{const s=P(e);if(!s)throw new Error(`Invalid target selector: "${e}"`);const c=Object.keys(t.projects);if(s.kind==="all")return{projects:c,target:s.target};if(s.kind==="project")return{projects:s.projects??[],target:s.target};if(s.kind==="tag"){const o=s.tag;return{projects:c.filter(i=>t.projects[i]?.tags?.includes(o)??!1),target:s.target}}const n=b(a,r)||".";let p,l=-1;for(const[o,i]of Object.entries(t.projects)){const u=i.root;u&&(n===u||n.startsWith(`${u}/`))&&u.length>l&&(l=u.length,p=o)}if(!p){if(process.stdout.isTTY){const o=$({input:process.stdin,output:process.stderr}),i=Object.keys(t.projects).sort();process.stderr.write(`No project found at ${n}. Pick one:
2
2
  `);for(const[d,h]of i.entries())process.stderr.write(` ${String(d+1)}) ${h}
3
3
  `);const u=await new Promise(d=>{o.question("> ",d)});o.close();const g=Number.parseInt(u,10)-1;if(g>=0&&g<i.length)return{projects:[i[g]],target:s.target}}throw new Error(`No project found at or above ${n} for selector "${e}".`)}return{projects:[p],target:s.target}},"resolveSelector"),E=/^(\w+)\s*(!?=)\s*(.+)$/,Q=f(e=>{const t=e.trim();if(t==="")return;const r=t.split("&&").map(o=>o.trim()),a=t.split("||").map(o=>o.trim()),s=r.length>1,c=a.length>1;if(s&&c)throw new Error("Query language does not support mixed && / || — split into multiple --query flags or simplify.");const n=c?a:r,p=c?"||":"&&",l=[];for(const o of n){const i=E.exec(o);if(!i)throw new Error(`Invalid query clause: "${o}". Expected <field>=<value> or <field>!=<value>.`);const[,u,g,d]=i;l.push({field:u,op:g==="!="?"!=":"=",value:d.trim().replaceAll(/^["']|["']$/g,"")})}return{clauses:l,op:p}},"parseQuery"),y=f((e,t,r)=>{const{field:a,op:s,value:c}=e,n=f(l=>{const o=l===c;return s==="="?o:!o},"test"),p=f(l=>{const o=(l??[]).includes(c);return s==="="?o:!o},"testList");switch(a){case"id":case"project":return n(t);case"language":return n(r.language);case"layer":return n(r.layer);case"projectType":case"type":return n(r.projectType);case"stack":return n(r.stack);case"tag":case"tags":return p(r.tags);default:return!1}},"matchClause"),O=f((e,t,r)=>{if(!r||r.trim()==="")return e;const a=Q(r);return a?e.filter(s=>{const c=t.projects[s];return c?a.op==="&&"?a.clauses.every(n=>y(n,s,c)):a.clauses.some(n=>y(n,s,c)):!1}):e},"filterProjectsByQuery");export{O as f,P as p,N as r};
@@ -1,5 +1,5 @@
1
- var N=Object.defineProperty;var x=(o,e)=>N(o,"name",{value:e,configurable:!0});import{createRequire as I}from"node:module";import{isAccessibleSync as d,readFileSync as k,readJsonSync as S}from"@visulima/fs";import{M as g,j as H,y as R}from"./index-OlP7U_t5.js";const B=I(import.meta.url),M=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,j=x(o=>{if(typeof M<"u"&&M.versions&&M.versions.node){const[e,n]=M.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return M.getBuiltinModule(o)}return B(o)},"__cjs_getBuiltinModule"),{execFileSync:w}=j("node:child_process"),{randomBytes:D}=j("node:crypto"),{writeFileSync:U,renameSync:q,unlinkSync:J}=j("node:fs");var z=Object.defineProperty,f=x((o,e)=>z(o,"name",{value:e,configurable:!0}),"f");const V=["proto","mise","fnm","volta","asdf","nvm","corepack"],Z={asdf:["bun","deno","go","node","npm","pnpm","python","ruby","rust","yarn"],corepack:["npm","pnpm","yarn"],fnm:["node"],mise:["bun","deno","go","node","npm","pnpm","python","ruby","rust","yarn"],nvm:["node"],proto:["bun","deno","go","node","npm","pnpm","python","ruby","rust","yarn"],volta:["node","npm","pnpm","yarn"]},X=["proto","mise","fnm","volta","asdf","nvm","corepack"],O={asdf:[".tool-versions"],corepack:[],fnm:[".nvmrc",".node-version"],mise:[".mise.toml",".config/mise.toml","mise.toml"],nvm:[".nvmrc"],proto:[".prototools"],volta:[]},$=new Map,y=f(o=>{const e=$.get(o);if(e!==void 0||$.has(o))return e;const n=process.env.PATH;if(!n){$.set(o,void 0);return}const t=process.platform==="win32"?["",...(process.env.PATHEXT??".COM;.EXE;.BAT;.CMD").split(";")]:[""];for(const r of n.split(H)){const i=r.replaceAll(/^["']|["']$/g,"").trim();if(i!=="")for(const l of t){const s=`${i}${R}${o}${l}`;if(d(s))return $.set(o,s),s}}$.set(o,void 0)},"isOnPath"),W=f((o,e=["--version"])=>{try{const n=w(o,e,{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:2e3}),t=/\d+\.\d+(?:\.\d+)?/.exec(n);return t?t[0]:n.trim()||void 0}catch{return}},"queryManagerVersion"),A=f((o,e)=>{const n=g(o,"package.json");if(!d(n))return[];try{const t=S(n)[e];if(e==="volta"&&typeof t=="object"&&t!==null&&Object.keys(t).length>0)return["package.json"];if(e==="packageManager"&&typeof t=="string"&&t.length>0)return["package.json"]}catch{}return[]},"pkgFieldConfigFiles"),G=f((o,e)=>o==="volta"?A(e,"volta"):o==="corepack"?A(e,"packageManager"):O[o].filter(n=>d(g(e,n))),"configFilesFor"),P=new Map,K=f(()=>{P.clear(),$.clear()},"clearToolchainCache"),_=f((o,e)=>{if(!e?.refresh){const i=P.get(o);if(i)return i}const n=[],t=!!y("pnpm")||!!y("yarn");for(const i of X){const l=i==="nvm"?void 0:y(i),s=i==="nvm"&&!!process.env.NVM_DIR,c=G(i,o),a=!!l||s;i==="corepack"&&!a&&(!(c.length>0)||t)||!a&&c.length===0||n.push({binPath:l,configFiles:c,installed:a,name:i,version:l?W(l):void 0})}const r=Object.freeze(n);return P.set(o,r),r},"findInstalledManagers"),be=f((o,e,n)=>{const t=n??_(o);return e?.preferredManager&&e.preferredManager!=="none"?t.find(r=>r.name===e.preferredManager)??{configFiles:[],installed:!1,name:e.preferredManager}:t.find(r=>r.installed&&r.configFiles.length>0)??t.find(r=>r.installed)??t.find(r=>r.configFiles.length>0)??{configFiles:[],installed:!1,name:"none"}},"pickPrimaryManager"),L=f((o,e)=>{for(const n of e){const t=g(o,n);if(d(t))try{const r=k(t).trim();if(r!=="")return{name:n,value:r.replace(/^v/,"")}}catch{}}},"readVersionFile"),Q=/^([a-z][\w-]*)\s*=\s*"?([^"\n#]+?)"?\s*(?:#.*)?$/i,Y=f(o=>{const e=g(o,".prototools");if(!d(e))return[];const n=k(e),t=[];let r=!1;for(const i of n.split(/\r?\n/)){const l=i.trim();if(l===""||l.startsWith("#"))continue;if(l.startsWith("[")){r=!0;continue}if(r)continue;const s=Q.exec(l);if(!s)continue;const[,c,a]=s,u=h(c);u&&t.push({source:".prototools",tool:u,version:a.trim()})}return t},"parsePrototools"),ee=/^\[tools\]\s*$/i,oe=/^([a-z][\w-]*)\s*=\s*"?([^"\n#]+?)"?\s*(?:#.*)?$/i,ne=f(o=>{for(const e of O.mise){const n=g(o,e);if(!d(n))continue;const t=[],r=k(n);let i=!1;for(const l of r.split(/\r?\n/)){const s=l.trim();if(s===""||s.startsWith("#"))continue;if(s.startsWith("[")){i=ee.test(s);continue}if(!i)continue;const c=oe.exec(s);if(!c)continue;const[,a,u]=c,m=h(a);m&&t.push({source:".mise.toml",tool:m,version:u.trim()})}if(t.length>0)return t}return[]},"parseMiseToml"),te=f(o=>{const e=g(o,".tool-versions");if(!d(e))return[];const n=k(e),t=[];for(const r of n.split(/\r?\n/)){const i=r.trim();if(i===""||i.startsWith("#"))continue;const l=i.split(/\s+/);if(l.length<2)continue;const[s,...c]=l,a=h(s);a&&c[0]&&t.push({source:".tool-versions",tool:a,version:c[0]})}return t},"parseToolVersions"),h=f(o=>{switch(o.toLowerCase()){case"bun":return"bun";case"deno":return"deno";case"go":case"golang":return"go";case"node":case"nodejs":return"node";case"npm":return"npm";case"pnpm":return"pnpm";case"python":case"python3":return"python";case"ruby":return"ruby";case"rust":case"rustc":return"rust";case"yarn":return"yarn";default:return}},"normalizeToolName"),re=f(o=>{const[e]=o.split("+",1),n=/^(pnpm|yarn|npm|bun)@(.+)$/.exec(e??"");if(!n)return;const t=h(n[1]);if(t)return{source:"packageManager",tool:t,version:n[2]}},"parsePackageManagerField"),se=f((o,e)=>{const n=new Map,t=f(s=>{n.set(s.tool,s)},"add"),r=g(o,"package.json");let i={};try{d(r)&&(i=S(r))}catch{}if(i.engines)for(const[s,c]of Object.entries(i.engines)){const a=h(s);a&&typeof c=="string"&&t({source:"engines",tool:a,version:c})}if(i.packageManager){const s=re(i.packageManager);s&&t(s)}if(i.volta)for(const[s,c]of Object.entries(i.volta)){const a=h(s);a&&typeof c=="string"&&t({source:"volta",tool:a,version:c})}const l=L(o,[".nvmrc",".node-version"]);l&&t({source:l.name===".nvmrc"?".nvmrc":".node-version",tool:"node",version:l.value});for(const s of te(o))t(s);for(const s of ne(o))t(s);for(const s of Y(o))t(s);if(e?.tools)for(const[s,c]of Object.entries(e.tools)){const a=h(s);a&&typeof c=="string"&&t({source:"vis.config.ts",tool:a,version:c})}return[...n.values()]},"parseExpectedTools"),F={bun:{args:["--version"],binaries:["bun"]},deno:{args:["--version"],binaries:["deno"]},go:{args:["version"],binaries:["go"]},node:{args:["--version"],binaries:["node"]},npm:{args:["--version"],binaries:["npm"]},pnpm:{args:["--version"],binaries:["pnpm"]},python:{args:["--version"],binaries:["python","python3"]},ruby:{args:["--version"],binaries:["ruby"]},rust:{args:["--version"],binaries:["rustc"]},yarn:{args:["--version"],binaries:["yarn"]}},ie=f(o=>{const e=F[o];for(const n of e.binaries){const t=y(n);if(t)return W(t,e.args)}if(o==="node")return process.versions.node},"queryToolVersion"),ae=f((o,e)=>{const n=e.trim();if(n===""||n==="*"||n==="latest")return!0;if(/^\d[\d.]*$/.test(n))return o===n||o.startsWith(`${n}.`);const t=f(s=>s.split(/[.\-+]/).map(c=>Number.parseInt(c,10)||0),"parse"),r=f((s,c)=>{const a=t(s),u=t(c),m=Math.max(a.length,u.length);for(let p=0;p<m;p++){const b=a[p]??0,v=u[p]??0;if(b!==v)return b-v}return 0},"compare"),i=f(s=>{for(const c of s)if(c.startsWith(">=")){if(r(o,c.slice(2).trim())<0)return!1}else if(c.startsWith("<=")){if(r(o,c.slice(2).trim())>0)return!1}else if(c.startsWith(">")){if(r(o,c.slice(1).trim())<=0)return!1}else if(c.startsWith("<")){if(r(o,c.slice(1).trim())>=0)return!1}else if(c.startsWith("^")||c.startsWith("~")){const a=c.slice(1).trim(),[u,m]=t(a),[p,b]=t(o);if(p!==u||c.startsWith("~")&&b!==m||r(o,a)<0)return!1}return!0},"matchesAll"),l=n.split("||").map(s=>s.trim().split(/\s+/).filter(Boolean)).filter(s=>s.length>0);return l.length===0?!0:l.some(s=>i(s))},"satisfies"),ce=f((o,e)=>{switch(o){case".mise.toml":return["mise"];case".node-version":case".nvmrc":return["fnm","nvm","volta","proto","mise","asdf"];case".prototools":return["proto"];case".tool-versions":return["asdf","mise"];case"packageManager":return e==="pnpm"||e==="yarn"?["self-activate","volta","proto","mise","corepack"]:e==="npm"?["volta","proto","mise","asdf","corepack"]:e==="bun"?["proto","mise","asdf"]:["volta","proto","mise"];case"volta":return["volta"];default:return["proto","mise","fnm","volta","asdf","nvm","corepack"]}},"preferenceFor"),le=f((o,e,n)=>{if(n?.preferredManager&&n.preferredManager!=="none"&&T(n.preferredManager,o.tool)){const r=e.find(i=>i.name===n.preferredManager);return r?{installed:r.installed,name:r.name}:{installed:!1,name:n.preferredManager,note:`${n.preferredManager} is the preferred manager but isn't on PATH`}}const t=ce(o.source,o.tool);for(const r of t){if(r==="self-activate"){if((o.tool==="pnpm"||o.tool==="yarn")&&y(o.tool))return{installed:!0,name:"self-activate",note:`${o.tool} will activate ${o.version} from the packageManager field on next invocation`};continue}if(T(r,o.tool)&&e.find(i=>i.name===r)?.installed)return{installed:!0,name:r}}for(const r of t)if(!(r==="self-activate"||!T(r,o.tool)))return{installed:!1,name:r,note:`${r} can install ${o.tool} — run \`vis toolchain install\` after adding it to PATH`};return{installed:!1,name:"none",note:"No manager knows how to install this tool"}},"resolveManagerFor"),T=f((o,e)=>o==="none"?!1:o==="self-activate"?e==="pnpm"||e==="yarn":Z[o].includes(e),"canHandle"),fe=f((o,e)=>{const n=_(o),t=se(o,e).map(r=>{const i=ie(r.tool),l=i!==void 0&&ae(i,r.version),s=le(r,n,e);return{actual:i,expected:r,manager:s,matches:l}});return{detected:n,tools:t}},"getToolchainStatus"),pe=f((o,e)=>{switch(o){case"asdf":return e?{args:["install",e.tool,e.version],bin:"asdf"}:void 0;case"corepack":return e?{args:["prepare",`${e.tool}@${e.version}`,"--activate"],bin:"corepack"}:{args:["prepare","--activate"],bin:"corepack",hint:"reads the packageManager field in package.json"};case"fnm":return e?.tool!=="node"?void 0:{args:["install",e.version],bin:"fnm"};case"mise":return e?{args:["install",`${e.tool}@${e.version}`],bin:"mise"}:void 0;case"none":return;case"nvm":return{args:[],bin:"nvm",hint:"nvm is a shell function — run `nvm install` / `nvm use` from your shell"};case"proto":return e?{args:["install",e.tool,e.version],bin:"proto"}:void 0;case"self-activate":return{args:[],bin:e?.tool??"pnpm",hint:`${e?.tool??"pnpm"} will self-activate on next invocation — no install needed`};case"volta":return e?{args:["install",`${e.tool}@${e.version}`],bin:"volta"}:{args:["install","node@lts"],bin:"volta",hint:"volta pins per-tool; specify <tool>@<version>"};default:{const n=o;throw new Error(`Unknown manager: ${n}`)}}},"buildInstallInvocation"),$e=f((o,e)=>{switch(o){case"asdf":return{args:["local",e.tool,e.version],bin:"asdf",configChange:{file:".tool-versions",hint:`Pins ${e.tool} ${e.version}`}};case"corepack":return e.tool!=="npm"&&e.tool!=="pnpm"&&e.tool!=="yarn"?void 0:{args:["use",`${e.tool}@${e.version}`],bin:"corepack",configChange:{file:"package.json",hint:`Writes packageManager: "${e.tool}@${e.version}"`}};case"fnm":return e.tool==="node"?{args:["use",e.version],bin:"fnm"}:void 0;case"mise":return{args:["use","--",`${e.tool}@${e.version}`],bin:"mise",configChange:{file:".mise.toml",hint:`Pins ${e.tool} ${e.version}`}};case"none":return;case"nvm":return e.tool==="node"?{args:[],bin:"nvm",configChange:{file:".nvmrc",hint:"Write version to .nvmrc manually (nvm doesn't persist)."}}:void 0;case"proto":return{args:["pin",e.tool,e.version],bin:"proto",configChange:{file:".prototools",hint:`Pins ${e.tool} ${e.version}`}};case"self-activate":return{args:[],bin:e.tool,configChange:{file:"package.json",hint:`Set packageManager: "${e.tool}@${e.version}" — ${e.tool} will self-activate on next invocation`}};case"volta":return{args:["pin",`${e.tool}@${e.version}`],bin:"volta",configChange:{file:"package.json",hint:`Writes volta.${e.tool}`}};default:{const n=o;throw new Error(`Unknown manager: ${n}`)}}},"buildUseInvocation"),ke=f(o=>{for(const e of F[o].binaries){const n=y(e);if(n)return n}},"findOnPathByAlias"),Me=f((o,e)=>{const n=F[e].binaries;if(o.installed&&o.binPath&&(o.name==="proto"||o.name==="mise"||o.name==="asdf"||o.name==="volta"||o.name==="fnm"))for(const t of n)try{const r=w(o.binPath,["which",t],{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:2e3}).trim();if(r)return r}catch{}for(const t of n){const r=y(t);if(r)return r}},"resolveToolBinary"),E=f((o,e)=>{const n=`${o}.${process.pid}.${D(6).toString("hex")}.tmp`;U(n,e);try{q(n,o)}catch(t){try{J(n)}catch{}throw t}},"atomicWrite"),ue=f((o,e)=>{if("packageManager"in o)return o.packageManager=e,o;const n={};let t=!1;for(const[r,i]of Object.entries(o))!t&&(r==="dependencies"||r==="devDependencies"||r==="peerDependencies"||r==="optionalDependencies")&&(n.packageManager=e,t=!0),n[r]=i;return t||(n.packageManager=e),n},"insertPackageManagerKey"),we=f((o,e)=>{if(e.tool!=="pnpm"&&e.tool!=="yarn"&&e.tool!=="npm"&&e.tool!=="bun")return;const n=g(o,"package.json");if(!d(n))throw new Error(`Cannot pin ${e.tool}: ${n} does not exist.`);const t=k(n),r=/\n([ \t]+)/.exec(t)?.[1]??" ";let i;try{i=JSON.parse(t)}catch(a){throw new Error(`${n} is not valid JSON — fix it before running \`vis toolchain use\`. Underlying error: ${a.message}`,{cause:a})}const l=`${e.tool}@${e.version}`,s=ue(i,l),c=t.endsWith(`
1
+ var N=Object.defineProperty;var x=(o,e)=>N(o,"name",{value:e,configurable:!0});import{createRequire as I}from"node:module";import{M as d,i as g,$ as k,n as O,j as J,y as R}from"./otel-CO8UEfTa.js";const B=I(import.meta.url),M=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,j=x(o=>{if(typeof M<"u"&&M.versions&&M.versions.node){const[e,n]=M.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return M.getBuiltinModule(o)}return B(o)},"__cjs_getBuiltinModule"),{execFileSync:w}=j("node:child_process"),{randomBytes:D}=j("node:crypto"),{writeFileSync:U,renameSync:q,unlinkSync:H}=j("node:fs");var z=Object.defineProperty,f=x((o,e)=>z(o,"name",{value:e,configurable:!0}),"f");const V=["proto","mise","fnm","volta","asdf","nvm","corepack"],Z={asdf:["bun","deno","go","node","npm","pnpm","python","ruby","rust","yarn"],corepack:["npm","pnpm","yarn"],fnm:["node"],mise:["bun","deno","go","node","npm","pnpm","python","ruby","rust","yarn"],nvm:["node"],proto:["bun","deno","go","node","npm","pnpm","python","ruby","rust","yarn"],volta:["node","npm","pnpm","yarn"]},X=["proto","mise","fnm","volta","asdf","nvm","corepack"],W={asdf:[".tool-versions"],corepack:[],fnm:[".nvmrc",".node-version"],mise:[".mise.toml",".config/mise.toml","mise.toml"],nvm:[".nvmrc"],proto:[".prototools"],volta:[]},b=new Map,y=f(o=>{const e=b.get(o);if(e!==void 0||b.has(o))return e;const n=process.env.PATH;if(!n){b.set(o,void 0);return}const t=process.platform==="win32"?["",...(process.env.PATHEXT??".COM;.EXE;.BAT;.CMD").split(";")]:[""];for(const r of n.split(J)){const i=r.replaceAll(/^["']|["']$/g,"").trim();if(i!=="")for(const l of t){const s=`${i}${R}${o}${l}`;if(g(s))return b.set(o,s),s}}b.set(o,void 0)},"isOnPath"),_=f((o,e=["--version"])=>{try{const n=w(o,e,{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:2e3}),t=/\d+\.\d+(?:\.\d+)?/.exec(n);return t?t[0]:n.trim()||void 0}catch{return}},"queryManagerVersion"),A=f((o,e)=>{const n=d(o,"package.json");if(!g(n))return[];try{const t=O(n)[e];if(e==="volta"&&typeof t=="object"&&t!==null&&Object.keys(t).length>0)return["package.json"];if(e==="packageManager"&&typeof t=="string"&&t.length>0)return["package.json"]}catch{}return[]},"pkgFieldConfigFiles"),G=f((o,e)=>o==="volta"?A(e,"volta"):o==="corepack"?A(e,"packageManager"):W[o].filter(n=>g(d(e,n))),"configFilesFor"),P=new Map,K=f(()=>{P.clear(),b.clear()},"clearToolchainCache"),S=f((o,e)=>{if(!e?.refresh){const i=P.get(o);if(i)return i}const n=[],t=!!y("pnpm")||!!y("yarn");for(const i of X){const l=i==="nvm"?void 0:y(i),s=i==="nvm"&&!!process.env.NVM_DIR,c=G(i,o),a=!!l||s;i==="corepack"&&!a&&(!(c.length>0)||t)||!a&&c.length===0||n.push({binPath:l,configFiles:c,installed:a,name:i,version:l?_(l):void 0})}const r=Object.freeze(n);return P.set(o,r),r},"findInstalledManagers"),ye=f((o,e,n)=>{const t=n??S(o);return e?.preferredManager&&e.preferredManager!=="none"?t.find(r=>r.name===e.preferredManager)??{configFiles:[],installed:!1,name:e.preferredManager}:t.find(r=>r.installed&&r.configFiles.length>0)??t.find(r=>r.installed)??t.find(r=>r.configFiles.length>0)??{configFiles:[],installed:!1,name:"none"}},"pickPrimaryManager"),L=f((o,e)=>{for(const n of e){const t=d(o,n);if(g(t))try{const r=k(t).trim();if(r!=="")return{name:n,value:r.replace(/^v/,"")}}catch{}}},"readVersionFile"),Q=/^([a-z][\w-]*)\s*=\s*"?([^"\n#]+?)"?\s*(?:#.*)?$/i,Y=f(o=>{const e=d(o,".prototools");if(!g(e))return[];const n=k(e),t=[];let r=!1;for(const i of n.split(/\r?\n/)){const l=i.trim();if(l===""||l.startsWith("#"))continue;if(l.startsWith("[")){r=!0;continue}if(r)continue;const s=Q.exec(l);if(!s)continue;const[,c,a]=s,u=h(c);u&&t.push({source:".prototools",tool:u,version:a.trim()})}return t},"parsePrototools"),ee=/^\[tools\]\s*$/i,oe=/^([a-z][\w-]*)\s*=\s*"?([^"\n#]+?)"?\s*(?:#.*)?$/i,ne=f(o=>{for(const e of W.mise){const n=d(o,e);if(!g(n))continue;const t=[],r=k(n);let i=!1;for(const l of r.split(/\r?\n/)){const s=l.trim();if(s===""||s.startsWith("#"))continue;if(s.startsWith("[")){i=ee.test(s);continue}if(!i)continue;const c=oe.exec(s);if(!c)continue;const[,a,u]=c,m=h(a);m&&t.push({source:".mise.toml",tool:m,version:u.trim()})}if(t.length>0)return t}return[]},"parseMiseToml"),te=f(o=>{const e=d(o,".tool-versions");if(!g(e))return[];const n=k(e),t=[];for(const r of n.split(/\r?\n/)){const i=r.trim();if(i===""||i.startsWith("#"))continue;const l=i.split(/\s+/);if(l.length<2)continue;const[s,...c]=l,a=h(s);a&&c[0]&&t.push({source:".tool-versions",tool:a,version:c[0]})}return t},"parseToolVersions"),h=f(o=>{switch(o.toLowerCase()){case"bun":return"bun";case"deno":return"deno";case"go":case"golang":return"go";case"node":case"nodejs":return"node";case"npm":return"npm";case"pnpm":return"pnpm";case"python":case"python3":return"python";case"ruby":return"ruby";case"rust":case"rustc":return"rust";case"yarn":return"yarn";default:return}},"normalizeToolName"),re=f(o=>{const[e]=o.split("+",1),n=/^(pnpm|yarn|npm|bun)@(.+)$/.exec(e??"");if(!n)return;const t=h(n[1]);if(t)return{source:"packageManager",tool:t,version:n[2]}},"parsePackageManagerField"),se=f((o,e)=>{const n=new Map,t=f(s=>{n.set(s.tool,s)},"add"),r=d(o,"package.json");let i={};try{g(r)&&(i=O(r))}catch{}if(i.engines)for(const[s,c]of Object.entries(i.engines)){const a=h(s);a&&typeof c=="string"&&t({source:"engines",tool:a,version:c})}if(i.packageManager){const s=re(i.packageManager);s&&t(s)}if(i.volta)for(const[s,c]of Object.entries(i.volta)){const a=h(s);a&&typeof c=="string"&&t({source:"volta",tool:a,version:c})}const l=L(o,[".nvmrc",".node-version"]);l&&t({source:l.name===".nvmrc"?".nvmrc":".node-version",tool:"node",version:l.value});for(const s of te(o))t(s);for(const s of ne(o))t(s);for(const s of Y(o))t(s);if(e?.tools)for(const[s,c]of Object.entries(e.tools)){const a=h(s);a&&typeof c=="string"&&t({source:"vis.config.ts",tool:a,version:c})}return[...n.values()]},"parseExpectedTools"),F={bun:{args:["--version"],binaries:["bun"]},deno:{args:["--version"],binaries:["deno"]},go:{args:["version"],binaries:["go"]},node:{args:["--version"],binaries:["node"]},npm:{args:["--version"],binaries:["npm"]},pnpm:{args:["--version"],binaries:["pnpm"]},python:{args:["--version"],binaries:["python","python3"]},ruby:{args:["--version"],binaries:["ruby"]},rust:{args:["--version"],binaries:["rustc"]},yarn:{args:["--version"],binaries:["yarn"]}},ie=f(o=>{const e=F[o];for(const n of e.binaries){const t=y(n);if(t)return _(t,e.args)}if(o==="node")return process.versions.node},"queryToolVersion"),ae=f((o,e)=>{const n=e.trim();if(n===""||n==="*"||n==="latest")return!0;if(/^\d[\d.]*$/.test(n))return o===n||o.startsWith(`${n}.`);const t=f(s=>s.split(/[.\-+]/).map(c=>Number.parseInt(c,10)||0),"parse"),r=f((s,c)=>{const a=t(s),u=t(c),m=Math.max(a.length,u.length);for(let p=0;p<m;p++){const $=a[p]??0,v=u[p]??0;if($!==v)return $-v}return 0},"compare"),i=f(s=>{for(const c of s)if(c.startsWith(">=")){if(r(o,c.slice(2).trim())<0)return!1}else if(c.startsWith("<=")){if(r(o,c.slice(2).trim())>0)return!1}else if(c.startsWith(">")){if(r(o,c.slice(1).trim())<=0)return!1}else if(c.startsWith("<")){if(r(o,c.slice(1).trim())>=0)return!1}else if(c.startsWith("^")||c.startsWith("~")){const a=c.slice(1).trim(),[u,m]=t(a),[p,$]=t(o);if(p!==u||c.startsWith("~")&&$!==m||r(o,a)<0)return!1}return!0},"matchesAll"),l=n.split("||").map(s=>s.trim().split(/\s+/).filter(Boolean)).filter(s=>s.length>0);return l.length===0?!0:l.some(s=>i(s))},"satisfies"),ce=f((o,e)=>{switch(o){case".mise.toml":return["mise"];case".node-version":case".nvmrc":return["fnm","nvm","volta","proto","mise","asdf"];case".prototools":return["proto"];case".tool-versions":return["asdf","mise"];case"packageManager":return e==="pnpm"||e==="yarn"?["self-activate","volta","proto","mise","corepack"]:e==="npm"?["volta","proto","mise","asdf","corepack"]:e==="bun"?["proto","mise","asdf"]:["volta","proto","mise"];case"volta":return["volta"];default:return["proto","mise","fnm","volta","asdf","nvm","corepack"]}},"preferenceFor"),le=f((o,e,n)=>{if(n?.preferredManager&&n.preferredManager!=="none"&&T(n.preferredManager,o.tool)){const r=e.find(i=>i.name===n.preferredManager);return r?{installed:r.installed,name:r.name}:{installed:!1,name:n.preferredManager,note:`${n.preferredManager} is the preferred manager but isn't on PATH`}}const t=ce(o.source,o.tool);for(const r of t){if(r==="self-activate"){if((o.tool==="pnpm"||o.tool==="yarn")&&y(o.tool))return{installed:!0,name:"self-activate",note:`${o.tool} will activate ${o.version} from the packageManager field on next invocation`};continue}if(T(r,o.tool)&&e.find(i=>i.name===r)?.installed)return{installed:!0,name:r}}for(const r of t)if(!(r==="self-activate"||!T(r,o.tool)))return{installed:!1,name:r,note:`${r} can install ${o.tool} — run \`vis toolchain install\` after adding it to PATH`};return{installed:!1,name:"none",note:"No manager knows how to install this tool"}},"resolveManagerFor"),T=f((o,e)=>o==="none"?!1:o==="self-activate"?e==="pnpm"||e==="yarn":Z[o].includes(e),"canHandle"),fe=f((o,e)=>{const n=S(o),t=se(o,e).map(r=>{const i=ie(r.tool),l=i!==void 0&&ae(i,r.version),s=le(r,n,e);return{actual:i,expected:r,manager:s,matches:l}});return{detected:n,tools:t}},"getToolchainStatus"),pe=f((o,e)=>{switch(o){case"asdf":return e?{args:["install",e.tool,e.version],bin:"asdf"}:void 0;case"corepack":return e?{args:["prepare",`${e.tool}@${e.version}`,"--activate"],bin:"corepack"}:{args:["prepare","--activate"],bin:"corepack",hint:"reads the packageManager field in package.json"};case"fnm":return e?.tool!=="node"?void 0:{args:["install",e.version],bin:"fnm"};case"mise":return e?{args:["install",`${e.tool}@${e.version}`],bin:"mise"}:void 0;case"none":return;case"nvm":return{args:[],bin:"nvm",hint:"nvm is a shell function — run `nvm install` / `nvm use` from your shell"};case"proto":return e?{args:["install",e.tool,e.version],bin:"proto"}:void 0;case"self-activate":return{args:[],bin:e?.tool??"pnpm",hint:`${e?.tool??"pnpm"} will self-activate on next invocation — no install needed`};case"volta":return e?{args:["install",`${e.tool}@${e.version}`],bin:"volta"}:{args:["install","node@lts"],bin:"volta",hint:"volta pins per-tool; specify <tool>@<version>"};default:{const n=o;throw new Error(`Unknown manager: ${n}`)}}},"buildInstallInvocation"),$e=f((o,e)=>{switch(o){case"asdf":return{args:["local",e.tool,e.version],bin:"asdf",configChange:{file:".tool-versions",hint:`Pins ${e.tool} ${e.version}`}};case"corepack":return e.tool!=="npm"&&e.tool!=="pnpm"&&e.tool!=="yarn"?void 0:{args:["use",`${e.tool}@${e.version}`],bin:"corepack",configChange:{file:"package.json",hint:`Writes packageManager: "${e.tool}@${e.version}"`}};case"fnm":return e.tool==="node"?{args:["use",e.version],bin:"fnm"}:void 0;case"mise":return{args:["use","--",`${e.tool}@${e.version}`],bin:"mise",configChange:{file:".mise.toml",hint:`Pins ${e.tool} ${e.version}`}};case"none":return;case"nvm":return e.tool==="node"?{args:[],bin:"nvm",configChange:{file:".nvmrc",hint:"Write version to .nvmrc manually (nvm doesn't persist)."}}:void 0;case"proto":return{args:["pin",e.tool,e.version],bin:"proto",configChange:{file:".prototools",hint:`Pins ${e.tool} ${e.version}`}};case"self-activate":return{args:[],bin:e.tool,configChange:{file:"package.json",hint:`Set packageManager: "${e.tool}@${e.version}" — ${e.tool} will self-activate on next invocation`}};case"volta":return{args:["pin",`${e.tool}@${e.version}`],bin:"volta",configChange:{file:"package.json",hint:`Writes volta.${e.tool}`}};default:{const n=o;throw new Error(`Unknown manager: ${n}`)}}},"buildUseInvocation"),be=f(o=>{for(const e of F[o].binaries){const n=y(e);if(n)return n}},"findOnPathByAlias"),ke=f((o,e)=>{const n=F[e].binaries;if(o.installed&&o.binPath&&(o.name==="proto"||o.name==="mise"||o.name==="asdf"||o.name==="volta"||o.name==="fnm"))for(const t of n)try{const r=w(o.binPath,["which",t],{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:2e3}).trim();if(r)return r}catch{}for(const t of n){const r=y(t);if(r)return r}},"resolveToolBinary"),E=f((o,e)=>{const n=`${o}.${process.pid}.${D(6).toString("hex")}.tmp`;U(n,e);try{q(n,o)}catch(t){try{H(n)}catch{}throw t}},"atomicWrite"),ue=f((o,e)=>{if("packageManager"in o)return o.packageManager=e,o;const n={};let t=!1;for(const[r,i]of Object.entries(o))!t&&(r==="dependencies"||r==="devDependencies"||r==="peerDependencies"||r==="optionalDependencies")&&(n.packageManager=e,t=!0),n[r]=i;return t||(n.packageManager=e),n},"insertPackageManagerKey"),Me=f((o,e)=>{if(e.tool!=="pnpm"&&e.tool!=="yarn"&&e.tool!=="npm"&&e.tool!=="bun")return;const n=d(o,"package.json");if(!g(n))throw new Error(`Cannot pin ${e.tool}: ${n} does not exist.`);const t=k(n),r=/\n([ \t]+)/.exec(t)?.[1]??" ";let i;try{i=JSON.parse(t)}catch(a){throw new Error(`${n} is not valid JSON — fix it before running \`vis toolchain use\`. Underlying error: ${a.message}`,{cause:a})}const l=`${e.tool}@${e.version}`,s=ue(i,l),c=t.endsWith(`
2
2
  `)?`
3
- `:"";return E(n,`${JSON.stringify(s,void 0,r)}${c}`),l},"writePackageManagerField"),xe=f((o,e)=>{const n=g(o,"package.json");if(!d(n))return;const t=k(n);let r;try{r=JSON.parse(t)}catch(s){throw new Error(`${n} is not valid JSON — fix it before running \`vis toolchain use\`. Underlying error: ${s.message}`,{cause:s})}if(r.engines?.[e.tool]===void 0||r.engines[e.tool]===e.version)return;r.engines[e.tool]=e.version;const i=/\n([ \t]+)/.exec(t)?.[1]??" ",l=t.endsWith(`
3
+ `:"";return E(n,`${JSON.stringify(s,void 0,r)}${c}`),l},"writePackageManagerField"),we=f((o,e)=>{const n=d(o,"package.json");if(!g(n))return;const t=k(n);let r;try{r=JSON.parse(t)}catch(s){throw new Error(`${n} is not valid JSON — fix it before running \`vis toolchain use\`. Underlying error: ${s.message}`,{cause:s})}if(r.engines?.[e.tool]===void 0||r.engines[e.tool]===e.version)return;r.engines[e.tool]=e.version;const i=/\n([ \t]+)/.exec(t)?.[1]??" ",l=t.endsWith(`
4
4
  `)?`
5
- `:"";return E(n,`${JSON.stringify(r,void 0,i)}${l}`),e.version},"updateEnginesField"),Te=f(o=>{const e=/^([a-z][\w-]*)@(.+)$/i.exec(o.trim());if(!e)return;const n=h(e[1]);if(n)return{source:"vis.config.ts",tool:n,version:e[2]}},"parseUseArgument"),de=f(async(o,e,n)=>{const t=fe(o,e),r=t.tools.filter(a=>!a.matches);if(r.length===0)return{attempted:[],failed:[],upToDate:!0};const i=t.detected.some(a=>a.installed);if(!(e?.autoInstall??i))return{attempted:[],failed:[],upToDate:!1};const l=[],s=[],c=new Map;for(const a of r){const u=c.get(a.manager.name);u?u.push(a):c.set(a.manager.name,[a])}for(const[a,u]of c){if(a==="self-activate"){for(const{expected:p}of u)n.info(`toolchain: ${p.tool} ${p.version} will self-activate on next ${p.tool} invocation`),l.push(p);continue}if(a==="none"){for(const{expected:p}of u)s.push({error:`no manager can install ${p.tool} — install one of ${V.join(", ")}`,spec:p});continue}if(!t.detected.find(p=>p.name===a)?.installed){for(const{expected:p}of u)s.push({error:`${a} is not on PATH`,spec:p});continue}const m=u.map(p=>({invocation:pe(a,p.expected),tool:p})).filter(p=>p.invocation!==void 0);for(const{invocation:p,tool:b}of m){const{expected:v}=b;if(p.bin==="nvm"&&p.args.length===0){n.warn(`toolchain: nvm requires a shell-side activation for ${v.tool} ${v.version}. Run \`nvm install\` / \`nvm use\` manually.`),s.push({error:"nvm requires shell-side activation",spec:v});continue}n.info(`toolchain: $ ${p.bin} ${p.args.join(" ")}`);try{w(p.bin,p.args,{cwd:o,stdio:"inherit"}),l.push(v),a==="fnm"&&ge(p.bin,n)}catch(C){s.push({error:C.message,spec:v});break}}}return K(),{attempted:l,failed:s,upToDate:!1}},"ensureToolchain"),Pe=f(async(o,e,n,t=!1)=>{if(t)return;const r=await de(o,e,n);for(const i of r.failed)n.warn(`toolchain: ${i.spec.tool} ${i.spec.version} — ${i.error}`)},"runToolchainPreflight"),ge=f((o,e)=>{const n=process.platform==="win32"?"powershell":"bash";try{const t=w(o,["env","--shell",n],{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:2e3});for(const r of t.split(/\r?\n/)){const i=r.trim();if(i==="")continue;const l=/^\$env:([A-Z_]\w*)\s*=\s*(.+)$/i.exec(i);if(l){const[,a,u]=l;process.env[a]=u.replaceAll(/^["']|["']$/g,"");continue}const s=/^set\s+"?([A-Z_]\w*)=(.*?)"?$/i.exec(i);if(s){const[,a,u]=s;process.env[a]=u;continue}const c=/^(?:export\s+)?([A-Z_]\w*)=(.+)$/i.exec(i);if(c){const[,a,u]=c;process.env[a]=u.replaceAll(/^["']|["']$/g,"")}}}catch(t){e.warn(`toolchain: could not activate fnm env (${t.message}). Subsequent tasks may use the previous Node version.`)}},"activateFnmEnv");export{V as S,le as a,pe as b,$e as c,Me as d,ke as e,_ as f,fe as g,be as h,Te as p,Pe as r,xe as u,we as w};
5
+ `:"";return E(n,`${JSON.stringify(r,void 0,i)}${l}`),e.version},"updateEnginesField"),xe=f(o=>{const e=/^([a-z][\w-]*)@(.+)$/i.exec(o.trim());if(!e)return;const n=h(e[1]);if(n)return{source:"vis.config.ts",tool:n,version:e[2]}},"parseUseArgument"),ge=f(async(o,e,n)=>{const t=fe(o,e),r=t.tools.filter(a=>!a.matches);if(r.length===0)return{attempted:[],failed:[],upToDate:!0};const i=t.detected.some(a=>a.installed);if(!(e?.autoInstall??i))return{attempted:[],failed:[],upToDate:!1};const l=[],s=[],c=new Map;for(const a of r){const u=c.get(a.manager.name);u?u.push(a):c.set(a.manager.name,[a])}for(const[a,u]of c){if(a==="self-activate"){for(const{expected:p}of u)n.info(`toolchain: ${p.tool} ${p.version} will self-activate on next ${p.tool} invocation`),l.push(p);continue}if(a==="none"){for(const{expected:p}of u)s.push({error:`no manager can install ${p.tool} — install one of ${V.join(", ")}`,spec:p});continue}if(!t.detected.find(p=>p.name===a)?.installed){for(const{expected:p}of u)s.push({error:`${a} is not on PATH`,spec:p});continue}const m=u.map(p=>({invocation:pe(a,p.expected),tool:p})).filter(p=>p.invocation!==void 0);for(const{invocation:p,tool:$}of m){const{expected:v}=$;if(p.bin==="nvm"&&p.args.length===0){n.warn(`toolchain: nvm requires a shell-side activation for ${v.tool} ${v.version}. Run \`nvm install\` / \`nvm use\` manually.`),s.push({error:"nvm requires shell-side activation",spec:v});continue}n.info(`toolchain: $ ${p.bin} ${p.args.join(" ")}`);try{w(p.bin,p.args,{cwd:o,stdio:"inherit"}),l.push(v),a==="fnm"&&de(p.bin,n)}catch(C){s.push({error:C.message,spec:v});break}}}return K(),{attempted:l,failed:s,upToDate:!1}},"ensureToolchain"),Te=f(async(o,e,n,t=!1)=>{if(t)return;const r=await ge(o,e,n);for(const i of r.failed)n.warn(`toolchain: ${i.spec.tool} ${i.spec.version} — ${i.error}`)},"runToolchainPreflight"),de=f((o,e)=>{const n=process.platform==="win32"?"powershell":"bash";try{const t=w(o,["env","--shell",n],{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:2e3});for(const r of t.split(/\r?\n/)){const i=r.trim();if(i==="")continue;const l=/^\$env:([A-Z_]\w*)\s*=\s*(.+)$/i.exec(i);if(l){const[,a,u]=l;process.env[a]=u.replaceAll(/^["']|["']$/g,"");continue}const s=/^set\s+"?([A-Z_]\w*)=(.*?)"?$/i.exec(i);if(s){const[,a,u]=s;process.env[a]=u;continue}const c=/^(?:export\s+)?([A-Z_]\w*)=(.+)$/i.exec(i);if(c){const[,a,u]=c;process.env[a]=u.replaceAll(/^["']|["']$/g,"")}}}catch(t){e.warn(`toolchain: could not activate fnm env (${t.message}). Subsequent tasks may use the previous Node version.`)}},"activateFnmEnv");export{V as S,le as a,pe as b,$e as c,ke as d,be as e,S as f,fe as g,ye as h,xe as p,Te as r,we as u,Me as w};
@@ -0,0 +1 @@
1
+ var q=Object.defineProperty;var l=(e,s)=>q(e,"name",{value:s,configurable:!0});import{createRequire as $}from"node:module";import{aE as M,p as i,d as b,e as k}from"../packem_chunks/bin.js";import{M as C,i as D,n as A}from"./otel-CO8UEfTa.js";const z=$(import.meta.url),m=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_=l(e=>{if(typeof m<"u"&&m.versions&&m.versions.node){const[s,r]=m.versions.node.split(".").map(Number);if(s>22||s===22&&r>=3||s===20&&r>=16)return m.getBuiltinModule(e)}return z(e)},"__cjs_getBuiltinModule"),{createInterface:T}=_("node:readline");var O=["aj","aju","av","avj","ejv","jav","jv"],F=["angula","angular-node","angularjs"],N=["auto-prefixer"],P=["aaxios","aios","axio","axioos","axios-node","axioss","axis","axiso","axois","axos","axxios"],B=["abel","babbel","babe","babel-js","babel-node","babl","bable","bbael","bebel"],R=["bcrpyt","bcrypt-node","brcypt","crypt","dcrypt"],S=["bcryptjs-node","dcryptjs"],W=["bunan","bunya","bunyan-node","buynan"],E=["cai","cha","chaijs","chal","chi","chia","hai"],L=["cahlk","calk","cchalk","ch4lk","cha1k","chaalk","chaik","chak","chakl","chalk-node","chalkk","challk","chhalk","chlak","chlk","halk","hcalk"],U=["cheero","cherio"],V=["c0lor","ccolor","clor","colo","coloor","color-js","colorjs","colorr","colr","coolor","coolr"],I=["ccolors","colors-node","colorss","colorz","colrs","coolors"],J=["c0mmander","ccommander","cmmander","cmomander","co-mmander","comamnder","comander","comm4nder","commaander","commader","commadner","commamder","command3r","commandder","commande","commandeer","commander-js","commanderr","commandr","commandre","commanedr","commaner","commannder","commender","commmander","commnader","commnder","coommander","ocmmander","ommander"],Y=["cor","corss","cos","cosr","cros","crs","ors"],G=["days"],H=["d3bug","dbeug","dbug","ddebug","debbug","debg","debgu","debu","debu9","debug-js","debug-node","debugg","debugjs","debuug","deebug","deubg","deug","ebug","edbug"],K=["dot-env","dotenv-node","dotenvjs","dotevn"],Q=["3lectron","eectron","eelctron","eelectron","el3ctron","elcetron","elctron","elecctron","elecron","elecrton","electon","electorn","electr0n","electrn","electrno","electro","electrom","electron-node","electronn","electroon","electrron","electtron","eleectron","eletcron","eletron","ellectron","lectron","leectron"],X=["asbuild","ebuild","esbuild-node","esbuildjs","ezbuild","sbuild"],Z=["aslint","elint","eslint-js","eslint-node","eslit","ezlint","slint"],ee=["eexpress","epress","epxress","experss","expess","exppress","expreess","expres","express-node","expressjs","expresss","exprress","exprses","exprss","exress","exrpess","exxpress","xepress","xpress"],oe=["astify"],se=["firebasejs"],re=["form1dable"],ae=["glb","glo","glob-js","globjs","gob","golb","lob"],te=["go","goot","gotjs","gott","gt","gto","ogt","ot","qot"],ne=["helmetjs","helnet"],ce=["homo","hon","hoo","hoon","ohno","ono"],ie=["inquire","inquirer-js","nquirer"],de=["iredis"],me=["ejst","est","jast","jes","jestjs","jestt","jet","jets","jst"],le=["imp","jim","jip","jmp"],pe=["ji","jio","jo","joii","jol","oi","oji"],ue=["jdom","jsdm","jsdo","jsdom-js","jsdon","jsom","sdom"],ve=["jsonwebtoken-js","jsonwebtoken-node"],he=["ka","kao","ko","koaa","koajs","koe","oa","oka"],je=["1odash","iodash","l0dash","ldash","ldoash","llodash","lo-dash","loadsh","loash","lobash","lod4sh","lodaash","lodah","lodahs","lodas","lodash-node","lodashh","lodassh","loddash","lodesh","lodsah","lodsh","loodash","odash","oldash"],be=["luca","luci","lucie"],ke=["luon","luxo","luxon-js"],ge=["imcromatch","mciromatch","micormatch","micrmoatch","micro-match","microamtch","micromacth","micromathc","micromtach","mircomatch"],fe=["minimath"],ye=["mcha","mmocha","moca","moch","mocha-js","moha","nocha","ocha"],xe=["m0ment","mment","mmoent","mmoment","moemnt","moent","mom3nt","momeent","momemt","momen","momen7","momennt","moment-js","momentjs","momentt","momet","mometn","momment","momnet","momnt","monent","mooment","oment","omment"],we=["mognoose","mogoose","mongoos","mongose","monqoose","moongoose"],qe=["moran","organ"],$e=["muler","multer-js","muter"],ze=["mysql"],_e=["ext","mext","n3xt","naxt","net","netx","nex","next-js","next-node","nextjs","nxt"],Te=["node-mailer","nodemailer-js"],Me=["nodemo","nodemonjs","nodmeon"],Ce=["oar","or","ora-node","ore","ra","roa"],De=["arcel","parce","parceljs"],Ae=["passport-js"],Oe=["phase","phaser-node"],Fe=["ino","pimo","pin","pino-node","pinojs","pio","pion"],Ne=["playright","playwright-js"],Pe=["postcss-js","postcss-node","potscss"],Be=["pettier","pprettier","pretier","prettierjs","prettierr","prtetier"],Re=["prima","prism","prisma-js","prismajs","prizma"],Se=["pupeteer"],We=["rada","rama","ramd","randa"],Ee=["eact","eract","r3act","raact","ract","raect","re4ct","reaact","reac","reac7","reacct","react-node","reactjs","reactt","reat","reatc","recat","rect","reeact","reect","rreact"],Le=["erdis","radis","rdis","redi","redis-js","redis-node","rediss","rediz","reds","reis","rredis"],Ue=["resen","rsend"],Ve=["ollup","rollup-js","rollup-node"],Ie=["ass","asss","sas","sass-node","sess","ssas","sss"],Je=["emver","seemver","semver-node","semvre","senver","sever"],Ye=["sequelize-js","sequelize-node"],Ge=["harp","shap","shar","sharp-js","sharpjs"],He=["stipe","strip","stripe-node","tripe"],Ke=["supabase-js"],Qe=["suelte","svelt3","svelte-js","sveltejs","velte"],Xe=["tailwindcss-js"],Ze=["auri","taui"],eo=["hree","htree","thee","there","three-js","three-node","tree"],oo=["stx","sx","ts","tsxx","ttsx","tx","txs","tzx"],so=["ttypescript","typecript","typescipt","typescript-node","typescriptjs","typescrit","typescritp"],ro=["udnerscore","undercore","underscoer","underscore-node","underscroe","undersocre","undesrcore"],ao=["uid","uud","uudi","uui","uuid-js","uuid-node","uuidjs","vuid"],to=["ite","vie","vit","vita","vite-node","vitee","vlte","vte"],no=["itest","uitest","vitestjs","vitezt","vittest","vtest"],co=["ue","uue","uve","ve","veu","vu","vu3","vua","vue-node","vuee","vuejs","vuue","vve","vvue"],io=["web-pack","weback","webpac","webpack-node","webpackjs","webpak","weebpack","wepack","wepback"],mo=["winson","winston-js","winstoon"],lo=["up","uyp","yp","yu","yupjs","yupp"],po=["od","zd","zdo","zo","zob","zod-js","zodjs"];const uo={ajv:O,angular:F,autoprefixer:N,"aws-sdk":["awssdk","ews-sdk"],axios:P,babel:B,bcrypt:R,bcryptjs:S,"body-parser":["body-paresr","body-parse","body-parser-js","body_parser"],bunyan:W,chai:E,chalk:L,cheerio:U,color:V,colors:I,commander:J,"cookie-parser":["cookie-parse","cookieparser"],cors:Y,"cross-env":["crossenv"],"date-fns":["data-fns","date-fn"],dayjs:G,debug:H,dotenv:K,electron:Q,esbuild:X,eslint:Z,express:ee,fastify:oe,firebase:se,formidable:re,glob:ae,got:te,helmet:ne,hono:ce,inquirer:ie,ioredis:de,jest:me,jimp:le,joi:pe,jsdom:ue,jsonwebtoken:ve,koa:he,lodash:je,lucia:be,luxon:ke,micromatch:ge,minimatch:fe,mocha:ye,moment:xe,mongoose:we,morgan:qe,multer:$e,mysql2:ze,next:_e,"node-fetch":["node-fecth","node-fethc","node.fetch"],nodemailer:Te,nodemon:Me,ora:Ce,parcel:De,passport:Ae,phaser:Oe,pino:Fe,playwright:Ne,postcss:Pe,prettier:Be,prisma:Re,puppeteer:Se,ramda:We,react:Ee,"react-dom":["eact-dom","eract-dom","r3act-dom","ract-dom","raect-dom","re4ct-dom","reaact-dom","reac-dom","reac7-dom","reacct-dom","react-bom","react-d0m","react-ddom","react-dm","react-dmo","react-do","react-domm","react-don","react-doom","react-odm","react-om","react.dom","reactdom","reactt-dom","reat-dom","reatc-dom","recat-dom","rect-dom","reeact-dom","rreact-dom"],redis:Le,resend:Ue,rollup:Ve,sass:Ie,semver:Je,sequelize:Ye,sharp:Ge,"socket.io":["ocket.io","oscket.io","scket.io","scoket.io","soccket.io","socekt.io","socet.io","sock3t.io","socke.io","socke7.io","sockeet.io","socket.1o","socket.i","socket.iio","socket.ioo","socket.lo","socket.o","socket.oi","sockett.io","sockket.io","sockt.io","sockte.io","sokcet.io","soket.io","soocket.io","ssocket.io"],stripe:He,supabase:Ke,svelte:Qe,tailwindcss:Xe,tauri:Ze,three:eo,"ts-node":["tts-node"],tsx:oo,typescript:so,underscore:ro,uuid:ao,vite:to,vitest:no,vue:co,webpack:io,winston:mo,yup:lo,zod:po};var v,g;function vo(){return g||(g=1,v={"@tanstack/start":["start-tanstack-app","tanstack","tanstack-app","tanstack-start"]}),v}l(vo,"requireTyposquatsManual");var ho=vo();const jo=M(ho);var bo=Object.defineProperty,n=l((e,s)=>bo(e,"name",{value:s,configurable:!0}),"c");const ko={a:["4","e"],b:["d"],d:["b"],e:["3","a"],g:["9","q"],i:["1","l"],l:["1","i"],m:["n"],n:["m"],o:["0"],s:["5","z"],t:["7"],u:["v"],v:["u"]},go=["app","cli","core","kit","lib","pkg","sdk"],fo=n(e=>{const s=new Set;if(e.length<3)return s;for(let o=0;o<e.length;o++){const a=e[o],t=a==="-"||a==="."||a==="_";if(t||s.add(e.slice(0,o)+e.slice(o+1)),t||s.add(e.slice(0,o)+a+e.slice(o)),o<e.length-1&&e[o]!==e[o+1]){const u=e[o+1]==="-"||e[o+1]==="."||e[o+1]==="_";if(!t&&!u){const d=[...e];[d[o],d[o+1]]=[d[o+1],d[o]],s.add(d.join(""))}}const c=e[o].toLowerCase(),j=ko[c];if(j)for(const u of j)s.add(e.slice(0,o)+u+e.slice(o+1))}const r=/[-._]/g;if(r.test(e))s.add(e.replaceAll(r,"")),s.add(e.replaceAll(r,"-")),s.add(e.replaceAll(r,".")),s.add(e.replaceAll(r,"_"));else if(e.length>5)for(let o=2;o<e.length-2;o++)s.add(`${e.slice(0,o)}-${e.slice(o)}`),s.add(`${e.slice(0,o)}.${e.slice(o)}`),s.add(`${e.slice(0,o)}_${e.slice(o)}`);if(e.startsWith("@")||(s.add(`${e}-js`),s.add(`${e}js`),s.add(`${e}-node`)),e.startsWith("@")){const o=e.indexOf("/");if(o>1&&o<e.length-1){const a=e.slice(1,o),t=e.slice(o+1);a.length>=3&&s.add(a);for(const c of["","-",".","_"])s.add(`${a}${c}${t}`),s.add(`${t}${c}${a}`);for(const c of go)s.add(`${a}-${c}`),s.add(`${t}-${a}-${c}`),s.add(`${c}-${a}-${t}`)}}return s.delete(e),s},"generateVariants");let h,p;const f=n(()=>{if(!h){const e={};for(const s of[uo,jo])for(const[r,o]of Object.entries(s)){const a=e[r]??(e[r]=[]);for(const t of o)a.includes(t)||a.push(t)}h=e}return h},"loadBlocklist"),yo=n(()=>{if(!p){p=new Map;for(const[e,s]of Object.entries(f()))for(const r of s)p.set(r,e)}return p},"getReverseLookup"),xo=n(e=>e.startsWith("@")?e.split("/")[1]??e:e,"bareName"),wo=n(e=>{const s=xo(e),r=yo().get(s);if(r)return{input:e,legitimate:r,method:"blocklist"};for(const o of Object.keys(f()))if(fo(o).has(s))return{input:e,legitimate:o,method:"heuristic"}},"checkTyposquat"),y=n((e,s)=>{const r=s?new Set(s):void 0,o=[];for(const a of e){if(r?.has(a))continue;const t=wo(a);t&&o.push(t)}return o},"checkTyposquats"),x=n((e,s)=>{i.warn(""),i.warn(b(`Possible typosquat${e.length===1?"":"s"} ${s}:`));for(const r of e){const o=r.method==="blocklist"?"known typosquat":"similar name";i.warn(` ${k("⚠")} ${b(r.input)} — did you mean ${k(r.legitimate)}? (${o})`)}i.warn("")},"printTyposquatWarnings"),w=n(async e=>{if(!process.stdin.isTTY){i.warn("Aborting: potential typosquat detected in non-interactive mode. Use --no-typosquat-check to skip.");return}const s=T({input:process.stdin,output:process.stdout}),r=await new Promise(o=>{s.question(e,a=>{o(a.trim().toLowerCase())})});return s.close(),r},"askConfirmation"),Do=n(async(e,s)=>{const r=y(e,s);if(r.length===0)return{ok:!0,packages:e};x(r,"detected");const o=await w(`Use suggested package${r.length===1?"":"s"} instead? [S]uggested / [y]es, keep original / [N]o, abort (default: N) `);if(o===void 0)return{ok:!1,packages:e};if(o==="s"||o==="suggested"){const a=new Map(r.map(t=>[t.input,t.legitimate]));return{ok:!0,packages:e.map(t=>a.get(t)??t)}}return o==="y"||o==="yes"?{ok:!0,packages:e}:{ok:!1,packages:e}},"runTyposquatCheck"),qo=/^(?:npm|pnpm|yarn):(.+?)(?:@.*)?$/,$o=n(e=>qo.exec(e)?.[1],"parseAliasTarget"),zo=n(e=>{if(!D(e))return[];const s=A(e),r={...s.dependencies,...s.devDependencies,...s.optionalDependencies,...s.peerDependencies},o=new Set;for(const[a,t]of Object.entries(r)){o.add(a);const c=$o(t);c&&o.add(c)}return[...o]},"readDepsFromPackageJson"),Ao=n(async(e,s)=>{const r=C(e,"package.json"),o=zo(r);if(o.length===0)return!0;const a=y(o,s);if(a.length===0)return!0;x(a,"in package.json dependencies"),i.warn("Fix the package name in package.json before proceeding.");const t=await w("Continue anyway? [y/N] ");return t==="y"||t==="yes"},"scanDepsForTyposquats");export{Do as r,Ao as s};
@@ -0,0 +1 @@
1
+ var u=Object.defineProperty;var g=(n,s)=>u(n,"name",{value:s,configurable:!0});import{createRequire as m}from"node:module";import{M as i,i as a,$ as f}from"./otel-CO8UEfTa.js";import{t as $}from"../packem_chunks/bin.js";const j=m(import.meta.url),k=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,b=g(n=>{if(typeof k<"u"&&k.versions&&k.versions.node){const[s,o]=k.versions.node.split(".").map(Number);if(s>22||s===22&&o>=3||s===20&&o>=16)return k.getBuiltinModule(n)}return j(n)},"__cjs_getBuiltinModule"),{readdirSync:v}=b("node:fs");var w=Object.defineProperty,l=g((n,s)=>w(n,"name",{value:s,configurable:!0}),"o");const _=[".husky/pre-commit",".vis-hooks/pre-commit",".git/hooks/pre-commit"],D=[".secretlintrc",".secretlintrc.json",".secretlintrc.js",".secretlintrc.mjs",".secretlintrc.cjs",".secretlintrc.yml",".secretlintrc.yaml"],S=[".syncpackrc",".syncpackrc.json",".syncpackrc.yaml",".syncpackrc.yml",".syncpackrc.cjs",".syncpackrc.js",".syncpackrc.mjs",".syncpackrc.ts","syncpack.config.cjs","syncpack.config.js","syncpack.config.mjs","syncpack.config.ts"],M=l(n=>{const s=i(n,"package.json");if(!a(s))return[];let o;try{o=JSON.parse(f(s))}catch{return[]}const e=[];if(o.scripts)for(const[t,c]of Object.entries(o.scripts))typeof c=="string"&&(/\bgitleaks\b/.test(c)&&e.push({detail:`Script "${t}" still invokes gitleaks: ${c}`,kind:"script",location:"package.json",tool:"gitleaks"}),/\bsecretlint\b/.test(c)&&e.push({detail:`Script "${t}" still invokes secretlint: ${c}`,kind:"script",location:"package.json",tool:"secretlint"}),/\bsyncpack\b/.test(c)&&e.push({detail:`Script "${t}" still invokes syncpack: ${c}`,kind:"script",location:"package.json",tool:"syncpack"}),/\bsherif\b/.test(c)&&e.push({detail:`Script "${t}" still invokes sherif: ${c}`,kind:"script",location:"package.json",tool:"sherif"}));if(o.devDependencies)for(const t of Object.keys(o.devDependencies))(t==="gitleaks"||t==="@gitleaks/cli")&&e.push({detail:`devDependency \`${t}\` is still installed`,kind:"devDep",location:"package.json",tool:"gitleaks"}),(t==="secretlint"||t.startsWith("@secretlint/"))&&e.push({detail:`devDependency \`${t}\` is still installed`,kind:"devDep",location:"package.json",tool:"secretlint"}),t==="syncpack"&&e.push({detail:`devDependency \`${t}\` is still installed`,kind:"devDep",location:"package.json",tool:"syncpack"}),t==="sherif"&&e.push({detail:`devDependency \`${t}\` is still installed`,kind:"devDep",location:"package.json",tool:"sherif"});return o.sherif&&e.push({detail:"`sherif` config block still present in package.json",kind:"config",location:"package.json",tool:"sherif"}),e},"scanPackageJson"),O=l(n=>{const s=[];for(const o of _){const e=i(n,o);if(!a(e))continue;const t=f(e);/\bgitleaks\b/.test(t)&&s.push({detail:"gitleaks invocation still present in hook",kind:"hook",location:o,tool:"gitleaks"}),/\bsecretlint\b/.test(t)&&s.push({detail:"secretlint invocation still present in hook",kind:"hook",location:o,tool:"secretlint"}),/\bsyncpack\b/.test(t)&&s.push({detail:"syncpack invocation still present in hook",kind:"hook",location:o,tool:"syncpack"}),/\bsherif\b/.test(t)&&s.push({detail:"sherif invocation still present in hook",kind:"hook",location:o,tool:"sherif"})}return s},"scanHooks"),C=l(n=>{const s=[];for(const o of D)a(i(n,o))&&s.push({detail:"secretlint config should be removed after migration",kind:"config",location:o,tool:"secretlint"});for(const o of S)a(i(n,o))&&s.push({detail:"syncpack config should be removed after migration",kind:"config",location:o,tool:"syncpack"});return s},"scanConfigs"),N=[".github/workflows",".gitlab-ci.yml",".circleci/config.yml",".woodpecker.yml",".drone.yml"],q=l(n=>{const s=[],o=l(e=>{const t=i(n,e);if(!a(t))return;const c=f(t);/\bsyncpack\b/.test(c)&&s.push({detail:"syncpack invocation still present in CI",kind:"ci",location:e,tool:"syncpack"}),/\bsherif\b/.test(c)&&s.push({detail:"sherif invocation still present in CI",kind:"ci",location:e,tool:"sherif"})},"scanFile");for(const e of N){const t=i(n,e);if(a(t)){if(e===".github/workflows"){try{for(const c of v(t))(c.endsWith(".yml")||c.endsWith(".yaml"))&&o(`.github/workflows/${c}`)}catch{}continue}o(e)}}return s},"scanCi"),I=l(n=>{const s=[],o=i(n,"pnpm-workspace.yaml");if(a(o)){let t;try{t=$(o)}catch{t=void 0}if(t&&typeof t=="object"){const c=t.catalog;c&&typeof c.syncpack=="string"&&s.push({detail:"`syncpack` still listed in pnpm-workspace.yaml#catalog",kind:"catalog",location:"pnpm-workspace.yaml",tool:"syncpack"});const r=t.catalogs;if(r&&typeof r=="object")for(const[d,p]of Object.entries(r))p&&typeof p.syncpack=="string"&&s.push({detail:`\`syncpack\` still listed in pnpm-workspace.yaml#catalogs.${d}`,kind:"catalog",location:"pnpm-workspace.yaml",tool:"syncpack"})}}const e=i(n,"package.json");if(a(e)){let t;try{t=JSON.parse(f(e))}catch{return s}const c=t.workspaces;if(c&&typeof c=="object"&&!Array.isArray(c)){const d=c.catalog;d&&typeof d.syncpack=="string"&&s.push({detail:"`syncpack` still listed in package.json#workspaces.catalog",kind:"catalog",location:"package.json",tool:"syncpack"});const p=c.catalogs;if(p&&typeof p=="object")for(const[h,y]of Object.entries(p))y&&typeof y.syncpack=="string"&&s.push({detail:`\`syncpack\` still listed in package.json#workspaces.catalogs.${h}`,kind:"catalog",location:"package.json",tool:"syncpack"})}const r=t.catalog;r&&typeof r.syncpack=="string"&&s.push({detail:"`syncpack` still listed in package.json#catalog",kind:"catalog",location:"package.json",tool:"syncpack"})}return s},"scanCatalogs"),J=l(n=>[...M(n),...O(n),...C(n),...q(n),...I(n)],"scanMigrationLeftovers"),B=l((n,s)=>{const o=J(n);if(o.length===0)return s.info("✓ No unmigrated gitleaks/secretlint/sherif/syncpack references found."),[];s.warn(`Found ${String(o.length)} unmigrated reference(s):`);for(const e of o)s.warn(` [${e.kind}] ${e.location} — ${e.detail}`);return o},"verifyMigration");export{J as s,B as v};
@@ -1 +1 @@
1
- var fe=Object.defineProperty;var T=(s,l)=>fe(s,"name",{value:l,configurable:!0});import{jsxs as t,jsx as r,Fragment as Z}from"react/jsx-runtime";import{useWindowSize as ae,Box as i,Spinner as me,Text as e,ScrollView as we,Tabs as ye,Tab as be,ScrollBar as Ce,useApp as ke,useInput as xe,Dialog as ee}from"@visulima/tui";import{useSyncExternalStore as Te,useState as L,useRef as W,useMemo as Se,useCallback as de,useEffect as ve}from"react";import{B as se,aA as he}from"../packem_chunks/bin.js";import{u as Ae}from"./use-measured-height-DjYgUOKk.js";var Re=Object.defineProperty,Ee=T((s,l)=>Re(s,"name",{value:l,configurable:!0}),"d$2");const tr=Ee(({current:s,total:l})=>{const{columns:h}=ae(),c=h||80,p=l>0?Math.min(1,s/l):0,a=`${String(Math.round(p*100)).padStart(3)}%`,y=`${String(s)}/${String(l)}`,b=Math.max(10,c-2-a.length-1),f=Math.round(b*p),m=b-f;return t(i,{flexDirection:"column",paddingX:1,children:[t(i,{children:[r(me,{type:"dots"}),r(e,{children:" Checking catalog dependencies "}),r(e,{dimColor:!0,children:y})]}),t(i,{children:[r(e,{color:"cyan",children:"━".repeat(f)}),r(e,{dimColor:!0,children:"─".repeat(m)}),t(e,{dimColor:!0,children:[" ",a]})]})]})},"CheckProgressApp");var Ie=Object.defineProperty,G=T((s,l)=>Ie(s,"name",{value:l,configurable:!0}),"r");const Q=G(s=>{const l=new Map;for(const h of s){const c=l.get(h.catalogName);c?c.push(h):l.set(h.catalogName,[h])}return l},"groupByCatalog"),_=G((s,l,h)=>{let c=s;if(l!=="all"&&(c=l==="security"?c.filter(p=>p.vulnerabilities&&p.vulnerabilities.length>0||p.socketReport&&p.socketReport.alerts.length>0):c.filter(p=>p.updateType===l)),h){const p=h.toLowerCase();c=c.filter(a=>a.packageName.toLowerCase().includes(p))}return c},"filterEntries");class lr{static{T(this,"UpdateStore")}static{G(this,"UpdateStore")}#e;#l=new Set;#t;#i=null;constructor(l,h=null){this.#t=l,h&&(this.#i=new Map(h.recommendations.map(c=>[c.package,c]))),this.#e={aiResult:h,allChecked:!0,applyProgress:null,checkedEntries:new Set(l.map(c=>c.packageName)),entries:l,error:null,filterActive:!1,filterText:"",filterType:"all",focusedPanel:"list",groupedByCatalog:Q(l),phase:"browsing",selectedIndex:0}}getSnapshot=G(()=>this.#e,"getSnapshot");subscribe=G(l=>(this.#l.add(l),()=>{this.#l.delete(l)}),"subscribe");getFilteredEntries(){return _(this.#t,this.#e.filterType,this.#e.filterText)}getRecommendation(l){return this.#i?.get(l)}getCheckedEntries(){return this.#t.filter(l=>this.#e.checkedEntries.has(l.packageName))}setSelectedIndex(l){const h=this.getFilteredEntries(),c=Math.max(0,Math.min(l,h.length-1));c!==this.#e.selectedIndex&&this.#r({...this.#e,selectedIndex:c})}setFocusedPanel(l){l!==this.#e.focusedPanel&&this.#r({...this.#e,focusedPanel:l})}setFilterType(l){if(l!==this.#e.filterType){const h=_(this.#t,l,this.#e.filterText);this.#r({...this.#e,entries:h,filterType:l,groupedByCatalog:Q(h),selectedIndex:0})}}setFilter(l){const h=_(this.#t,this.#e.filterType,l);this.#r({...this.#e,entries:h,filterText:l,groupedByCatalog:Q(h),selectedIndex:0})}setFilterActive(l){if(l!==this.#e.filterActive)if(l)this.#r({...this.#e,filterActive:!0});else{const h=_(this.#t,this.#e.filterType,"");this.#r({...this.#e,entries:h,filterActive:!1,filterText:"",groupedByCatalog:Q(h),selectedIndex:0})}}toggleCheck(l){const h=new Set(this.#e.checkedEntries);h.has(l)?h.delete(l):h.add(l),this.#r({...this.#e,allChecked:h.size===this.#t.length,checkedEntries:h})}checkAll(){this.#r({...this.#e,allChecked:!0,checkedEntries:new Set(this.#t.map(l=>l.packageName))})}uncheckAll(){this.#r({...this.#e,allChecked:!1,checkedEntries:new Set})}toggleAll(){this.#e.allChecked?this.uncheckAll():this.checkAll()}startApply(){const l=this.getCheckedEntries();this.#r({...this.#e,applyProgress:{current:0,total:l.length},phase:"applying"})}updateApplyProgress(l){this.#e.applyProgress&&this.#r({...this.#e,applyProgress:{...this.#e.applyProgress,current:l}})}markDone(){this.#r({...this.#e,phase:"done"})}setError(l){this.#r({...this.#e,error:l,phase:"error"})}#r(l){this.#e=l;for(const h of this.#l)try{h()}catch{}}}var De=Object.defineProperty,Be=T((s,l)=>De(s,"name",{value:l,configurable:!0}),"d");const Ne={major:"red",minor:"yellow",patch:"green"},Pe={CRITICAL:"red",HIGH:"red",LOW:"gray",MODERATE:"yellow",UNKNOWN:"gray"},Le={critical:"red",high:"red",low:"gray",medium:"yellow"},Me={critical:"red",high:"red",low:"green",medium:"yellow"},je={defer:"gray",review:"yellow",skip:"red",update:"green"},Fe=Be(({changelogUrl:s,entry:l,focused:h,recommendation:c,scrollRef:p})=>{const a=h?"white":"gray";if(!l)return r(i,{alignItems:"center",borderColor:"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,justifyContent:"center",children:r(e,{dimColor:!0,children:"No package selected"})});const y=Ne[l.updateType]??"white",b=l.vulnerabilities&&l.vulnerabilities.length>0,f=l.socketReport?.score.overall??0,m=l.socketReport?se(f):"gray";return t(i,{borderColor:a,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[r(i,{flexShrink:0,paddingTop:1,paddingX:2,children:r(e,{bold:!0,color:"white",children:l.packageName})}),t(we,{flexGrow:1,flexShrink:1,paddingX:2,ref:p,scrollbar:!0,scrollbarColor:"gray",scrollbarStyle:"block",children:[r(e,{}),t(i,{children:[r(i,{width:12,children:r(e,{dimColor:!0,children:"Current:"})}),r(e,{children:l.currentRange})]}),t(i,{children:[r(i,{width:12,children:r(e,{dimColor:!0,children:"Target:"})}),r(e,{children:l.newRange}),t(e,{bold:!0,color:y,children:[" ","(",l.updateType,")"]})]}),t(i,{children:[r(i,{width:12,children:r(e,{dimColor:!0,children:"Version:"})}),r(e,{children:l.targetVersion})]}),t(i,{children:[r(i,{width:12,children:r(e,{dimColor:!0,children:"Catalog:"})}),r(e,{children:l.catalogName})]}),l.acceptedRisk&&t(i,{flexDirection:"column",marginTop:1,children:[r(e,{color:"gray",children:"── "}),r(e,{bold:!0,color:"gray",children:"ACKNOWLEDGED RISK"}),t(i,{flexDirection:"column",paddingLeft:2,children:[t(i,{children:[r(e,{dimColor:!0,children:"Reason: "}),r(e,{children:l.acceptedRisk.reason})]}),t(i,{children:[r(e,{dimColor:!0,children:"Accepted: "}),r(e,{children:l.acceptedRisk.acceptedAt.slice(0,10)})]})]})]}),b&&t(i,{flexDirection:"column",marginTop:1,children:[r(e,{dimColor:!0,children:"── "}),r(e,{bold:!0,color:"red",children:"SECURITY"}),r(e,{}),l.vulnerabilities.map(o=>t(i,{flexDirection:"column",marginBottom:1,children:[t(i,{gap:1,children:[t(e,{bold:!0,color:Pe[o.severity]??"gray",children:["⚠"," ",o.severity]}),r(e,{bold:!0,children:o.id})]}),r(i,{paddingLeft:2,children:r(e,{children:o.summary})}),t(i,{gap:2,paddingLeft:2,children:[o.cvssScore!==void 0&&t(e,{dimColor:!0,children:["CVSS:",String(o.cvssScore)]}),o.fixedVersions.length>0&&t(e,{dimColor:!0,children:["Fixed in:",o.fixedVersions.join(", ")]})]})]},o.id))]}),l.socketReport&&t(i,{flexDirection:"column",marginTop:1,children:[r(e,{dimColor:!0,children:"── "}),r(e,{bold:!0,color:"cyan",children:"SOCKET.DEV"}),r(e,{}),t(i,{gap:2,children:[t(i,{children:[r(e,{dimColor:!0,children:"Overall: "}),t(e,{bold:!0,color:m,children:[String(Math.round(f*100)),"%"]})]}),t(i,{children:[r(e,{dimColor:!0,children:"Supply Chain: "}),t(e,{children:[String(Math.round(l.socketReport.score.supplyChain*100)),"%"]})]}),t(i,{children:[r(e,{dimColor:!0,children:"Quality: "}),t(e,{children:[String(Math.round(l.socketReport.score.quality*100)),"%"]})]})]}),t(i,{gap:2,children:[t(i,{children:[r(e,{dimColor:!0,children:"Maintenance: "}),t(e,{children:[String(Math.round(l.socketReport.score.maintenance*100)),"%"]})]}),t(i,{children:[r(e,{dimColor:!0,children:"Vulnerability: "}),t(e,{children:[String(Math.round(l.socketReport.score.vulnerability*100)),"%"]})]}),t(i,{children:[r(e,{dimColor:!0,children:"License: "}),t(e,{children:[l.socketReport.license||"unknown"," ","(",String(Math.round(l.socketReport.score.license*100)),"%)"]})]})]}),l.socketReport.alerts.length>0&&t(i,{flexDirection:"column",marginTop:1,children:[t(e,{bold:!0,color:"yellow",children:["⚠"," ",String(l.socketReport.alerts.length)," ","alert",l.socketReport.alerts.length===1?"":"s",":"]}),l.socketReport.alerts.map(o=>t(i,{gap:1,paddingLeft:2,children:[t(e,{bold:!0,color:Le[o.severity]??"gray",children:["[",o.severity.toUpperCase(),"]"]}),r(e,{children:o.type}),t(e,{dimColor:!0,children:["(",o.category,")"]})]},o.key))]})]}),c&&t(i,{flexDirection:"column",marginTop:1,children:[r(e,{dimColor:!0,children:"── "}),r(e,{bold:!0,color:"white",children:"AI ANALYSIS"}),r(e,{}),t(i,{gap:2,children:[t(i,{children:[r(e,{dimColor:!0,children:"Action: "}),r(e,{bold:!0,color:je[c.action]??"white",children:c.action})]}),t(i,{children:[r(e,{dimColor:!0,children:"Risk: "}),r(e,{bold:!0,color:Me[c.riskLevel]??"white",children:c.riskLevel})]}),t(i,{children:[r(e,{dimColor:!0,children:"Effort: "}),r(e,{bold:!0,children:c.effort})]})]}),c.reason&&r(i,{marginTop:1,paddingLeft:2,children:r(e,{children:c.reason})}),c.breakingChanges.length>0&&t(i,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[r(e,{bold:!0,color:"yellow",children:"Breaking changes:"}),c.breakingChanges.map((o,I)=>t(e,{children:[" ","•"," ",o]},String(I)))]})]}),s&&t(i,{flexDirection:"column",marginTop:1,children:[r(e,{dimColor:!0,children:"── "}),r(e,{bold:!0,color:"white",children:"CHANGELOG"}),r(i,{marginTop:1,paddingLeft:2,children:r(e,{color:"cyan",underline:!0,children:s})})]}),t(i,{flexDirection:"column",marginTop:1,children:[r(e,{dimColor:!0,children:"── "}),r(e,{bold:!0,color:"white",children:"LINKS"}),r(i,{flexDirection:"column",marginTop:1,paddingLeft:2,children:t(e,{color:"cyan",underline:!0,children:["https://npmx.dev/",l.packageName]})})]}),!c&&t(i,{flexDirection:"column",marginTop:1,children:[r(e,{dimColor:!0,children:"── "}),r(e,{bold:!0,color:"white",children:"GUIDANCE"}),t(i,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[l.updateType==="major"&&t(Z,{children:[t(e,{color:"red",children:["⚠"," ","Major update — likely contains breaking changes."]}),r(e,{dimColor:!0,children:" Review the changelog before updating."}),r(e,{dimColor:!0,children:" Use --changelog to fetch release URLs."})]}),l.updateType==="minor"&&t(Z,{children:[t(e,{color:"yellow",children:["ℹ"," ","Minor update — new features, backward compatible."]}),r(e,{dimColor:!0,children:" Generally safe to update."})]}),l.updateType==="patch"&&t(Z,{children:[t(e,{color:"green",children:["✓"," ","Patch update — bug fixes only."]}),r(e,{dimColor:!0,children:" Safe to update."})]}),!c&&r(e,{dimColor:!0,children:" Use --ai to get AI-powered analysis."})]})]})]})]})},"PackageDetailPanel");var $e=Object.defineProperty,re=T((s,l)=>$e(s,"name",{value:l,configurable:!0}),"f");const Oe={major:"red",minor:"yellow",patch:"green"},Ue=[{id:"all",label:"All"},{id:"major",label:"Major"},{id:"minor",label:"Minor"},{id:"patch",label:"Patch"},{id:"security",label:"Security"}],Ge=re(({checked:s,entry:l,isSelected:h})=>{const c=Oe[l.updateType]??"white",p=l.vulnerabilities&&l.vulnerabilities.length>0,a=l.socketReport&&l.socketReport.alerts.length>0,y=!!l.acceptedRisk,b=s?"☑":"☐",f=l.socketReport?`${String(Math.round(l.socketReport.score.overall*100))}%`:"",m=l.socketReport?se(l.socketReport.score.overall):"gray";return t(i,{flexShrink:0,height:1,children:[r(e,{children:h?">":" "}),t(e,{color:s?"white":"gray",children:[" ",b," "]}),p||a?r(e,{color:y?"gray":"red",children:y?"✓ ":"⚠ "}):r(e,{children:" "}),r(i,{flexGrow:1,children:t(e,{bold:h,inverse:h,wrap:"truncate",children:[l.packageName,y?" [ack]":""]})}),f&&t(e,{color:m,children:[" ",f]}),t(e,{dimColor:!0,children:[" ",l.currentRange]}),t(e,{dimColor:!0,children:[" ","→"," "]}),t(e,{children:[l.newRange," "]}),r(e,{bold:!0,color:c,children:l.updateType})]})},"PackageRow"),He=re(({count:s,name:l})=>t(i,{flexShrink:0,height:1,marginTop:1,children:[t(e,{dimColor:!0,children:["▼"," "]}),r(e,{bold:!0,color:"white",children:l.toUpperCase()}),t(e,{dimColor:!0,children:[" ","(",s,")"]})]}),"CatalogHeader"),Ve=re(({checkedEntries:s,entries:l,filterActive:h,filteredOutCount:c,filterText:p,filterType:a,focused:y,groupedByCatalog:b,isDryRun:f,onViewportHeightChange:m,scrollOffset:o,selectedIndex:I,totalCatalogEntries:D,totalChecked:v,totalEntries:H,viewportHeight:M})=>{const j=y?"white":"gray",{measuredHeight:w,ref:A}=Ae(M,m);let F=0,S=0,B=0,R=0;for(const g of l)g.updateType==="major"?F++:g.updateType==="minor"?S++:B++,(g.vulnerabilities&&g.vulnerabilities.length>0||g.socketReport&&g.socketReport.alerts.length>0)&&R++;const k=[];F>0&&k.push(`${F} major`),S>0&&k.push(`${S} minor`),B>0&&k.push(`${B} patch`),R>0&&k.push(`${R} vulnerable`);const N=k.length>0?` (${k.join(", ")})`:"";let x=0;for(const g of l)s.has(g.packageName)&&x++;const C=[];let V=0;for(const[g,E]of b){C.push(r(He,{count:E.length,name:g},`hdr-${g}`));for(const O of E){const P=V;C.push(r(Ge,{checked:s.has(O.packageName),entry:O,isSelected:P===I},O.packageName)),V++}}let $=0;for(const[,g]of b)$+=2+g.length;const q=$>w&&w>0;return t(i,{borderColor:j,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[t(i,{flexShrink:0,gap:1,paddingX:1,children:[r(e,{bold:!0,inverse:!0,children:" VIS "}),t(e,{wrap:"truncate",children:[H,v>0?`/${v}`:""," ","outdated",N,D>v?` · ${D-v} dupes`:""]}),!f&&x>0&&t(e,{dimColor:!0,children:[" ","—",x," ","selected"]})]}),r(i,{flexShrink:0,paddingX:1,paddingY:1,children:r(ye,{isFocused:y,keyMap:{next:[],previous:[],useNumbers:!1,useTab:!1},onChange:T(()=>{},"onChange"),showIndex:!1,value:a,children:Ue.map(({id:g,label:E})=>r(be,{name:g,children:E},g))})}),h&&t(i,{flexShrink:0,paddingX:1,children:[r(e,{bold:!0,color:"white",children:"/ "}),r(e,{children:p}),r(e,{inverse:!0,children:" "})]}),c>0&&r(i,{flexShrink:0,paddingX:1,children:t(e,{color:"yellow",children:["⚠"," ",c," ","package",c===1?"":"s"," ","filtered out by target constraint — press"," ",r(e,{bold:!0,color:"white",children:"f"})," ","to view"]})}),t(i,{flexDirection:"row",flexGrow:1,overflow:"hidden",ref:A,children:[r(i,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:r(i,{flexDirection:"column",marginTop:-o,children:C})}),q&&r(i,{flexShrink:0,marginLeft:1,marginRight:1,children:r(Ce,{contentHeight:$,placement:"inset",scrollOffset:o,style:"block",viewportHeight:w})})]},`list-${a}-${p}`)]})},"PackageListPanel");var qe=Object.defineProperty,Ke=T((s,l)=>qe(s,"name",{value:l,configurable:!0}),"K");const Xe=100,Ye=40,ze=10,We=[],ir=Ke(({autoExitSeconds:s=0,changelogUrls:l,checkedCount:h=0,filteredOutEntries:c=We,isDryRun:p,store:a,totalCatalogEntries:y=0})=>{const{exit:b}=ke(),{columns:f,rows:m}=ae(),o=Te(a.subscribe,a.getSnapshot),[I,D]=L(!1),[v,H]=L(!1),M=W(null),j=W(null),w=W(null),A=W(null),[F,S]=L(0),[B,R]=L(!1),[k,N]=L(!1),x=Se(()=>a.getFilteredEntries(),[o.entries,o.filterType,o.filterText]),C=x[o.selectedIndex]??null,V=C?a.getRecommendation(C.packageName):void 0,$=C&&l?l.get(C.packageName):void 0,q=de(n=>{let d=0,u=0;for(const[,Y]of o.groupedByCatalog){d+=2;for(let z=0;z<Y.length;z++){if(u===n)return d;d+=1,u++}}return d},[o.groupedByCatalog]),g=Math.max(1,m-8-(o.filterActive?1:0)),[E,O]=L(g),P=E>0?E:g,U=de(n=>{const d=q(n);S(u=>d>u+P-2?Math.max(0,d-P+2):d<u+1?Math.max(0,d-1):u)},[q,P]);if(ve(()=>{w.current?.scrollToTop()},[C?.packageName]),xe((n,d)=>{if(n==="c"&&d.ctrl){b();return}if(!k){if(v){d.escape||n==="f"||n==="q"?H(!1):d.downArrow||n==="j"?j.current?.scrollBy(1):(d.upArrow||n==="k")&&j.current?.scrollBy(-1);return}if(B){n==="u"||d.return?(R(!1),a.startApply(),b(a.getCheckedEntries())):d.escape||n==="q"?R(!1):d.downArrow||n==="j"?A.current?.scrollBy(1):d.upArrow||n==="k"?A.current?.scrollBy(-1):d.pageDown?A.current?.scrollBy(5):d.pageUp&&A.current?.scrollBy(-5);return}if(I){d.escape||n==="?"?D(!1):n==="q"?(D(!1),N(!0)):d.downArrow||n==="j"?M.current?.scrollBy(1):(d.upArrow||n==="k")&&M.current?.scrollBy(-1);return}if(n==="?"){D(!0);return}if(n==="q"){N(!0);return}if(d.tab){a.setFocusedPanel(o.focusedPanel==="list"?"detail":"list");return}if(o.focusedPanel==="list"&&(d.leftArrow||d.rightArrow)){const u=["all","major","minor","patch","security"],Y=u.indexOf(o.filterType),z=d.rightArrow?(Y+1)%u.length:(Y-1+u.length)%u.length;S(0),w.current?.scrollToTop(),a.setFilterType(u[z]);return}if(n==="f"&&c.length>0){H(u=>!u);return}if(o.filterActive){if(d.escape){a.setFilterActive(!1);return}if(d.return){a.setFilterActive(!1);return}if(d.backspace){S(0),a.setFilter(o.filterText.slice(0,-1));return}if(n&&!d.ctrl&&!d.meta){S(0),a.setFilter(o.filterText+n);return}return}if(o.focusedPanel==="list"){if(d.downArrow||n==="j"){const u=Math.min(o.selectedIndex+1,x.length-1);a.setSelectedIndex(u),U(u);return}if(d.upArrow||n==="k"){const u=Math.max(o.selectedIndex-1,0);a.setSelectedIndex(u),U(u);return}if(d.pageDown){const u=Math.min(o.selectedIndex+10,x.length-1);a.setSelectedIndex(u),U(u);return}if(d.pageUp){const u=Math.max(o.selectedIndex-10,0);a.setSelectedIndex(u),U(u);return}if(d.home){a.setSelectedIndex(0),S(0);return}if(d.end){const u=x.length-1;a.setSelectedIndex(u),U(u);return}if(n===" "||d.return){C&&a.toggleCheck(C.packageName);return}if(n==="a"){a.toggleAll();return}if(n==="/"){a.setFilterActive(!0);return}if(n==="u"&&!p&&o.checkedEntries.size>0){R(!0);return}if(d.rightArrow){a.setFocusedPanel("detail");return}return}if(o.focusedPanel==="detail"){if(d.escape||d.leftArrow){a.setFocusedPanel("list");return}if(d.downArrow||n==="j"){w.current?.scrollBy(1);return}if(d.upArrow||n==="k"){w.current?.scrollBy(-1);return}if(d.pageDown){w.current?.scrollBy(10);return}if(d.pageUp){w.current?.scrollBy(-10);return}if(d.home){w.current?.scrollToTop();return}d.end&&w.current?.scrollToBottom()}}},{isActive:!0}),f<Ye||m<ze)return r(i,{alignItems:"center",height:m,justifyContent:"center",width:f,children:t(e,{color:"yellow",children:["Terminal too small (",f,"x",m,")"]})});const ue=f>=Xe,K=[t(i,{gap:1,children:[r(e,{bold:!0,color:"white",children:"q"}),r(e,{dimColor:!0,children:"QUIT"})]},"q"),t(i,{gap:1,children:[r(e,{bold:!0,color:"white",children:"?"}),r(e,{dimColor:!0,children:"HELP"})]},"?"),t(i,{gap:1,children:[r(e,{bold:!0,color:"white",children:"↑↓"}),r(e,{dimColor:!0,children:"NAV"})]},"nav"),t(i,{gap:1,children:[r(e,{bold:!0,color:"white",children:"Space"}),r(e,{dimColor:!0,children:"CHECK"})]},"sp"),t(i,{gap:1,children:[r(e,{bold:!0,color:"white",children:"a"}),r(e,{dimColor:!0,children:"ALL"})]},"a")];!p&&o.checkedEntries.size>0&&K.push(t(i,{gap:1,children:[r(e,{bold:!0,color:"green",children:"u"}),r(e,{dimColor:!0,children:"APPLY"})]},"u")),c.length>0&&K.push(t(i,{gap:1,children:[r(e,{bold:!0,color:"yellow",children:"f"}),t(e,{dimColor:!0,children:["FILTERED (",c.length,")"]})]},"fo")),K.push(t(i,{gap:1,children:[r(e,{bold:!0,color:"white",children:"←→"}),r(e,{dimColor:!0,children:"FILTER"})]},"lr"),t(i,{gap:1,children:[r(e,{bold:!0,color:"white",children:"/"}),r(e,{dimColor:!0,children:"SEARCH"})]},"f"),t(i,{gap:1,children:[r(e,{bold:!0,color:"white",children:"Tab"}),r(e,{dimColor:!0,children:"PANEL"})]},"t"));const te=r(i,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,children:r(i,{flexWrap:"wrap",gap:2,paddingX:1,children:K})}),le=t(ee,{footer:t(e,{dimColor:!0,children:[r(e,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",r(e,{bold:!0,color:"white",children:"?"}),"/",r(e,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:M,title:"KEYBOARD SHORTCUTS",visible:I,width:52,children:[t(i,{flexDirection:"column",marginBottom:1,children:[t(i,{marginBottom:1,children:[r(e,{dimColor:!0,children:"── "}),r(e,{bold:!0,color:"white",children:"NAVIGATION"})]}),t(i,{children:[r(i,{width:24,children:t(e,{children:[t(e,{bold:!0,color:"white",children:[" ","↑","/k"]}),r(e,{dimColor:!0,children:" Move up"})]})}),t(e,{children:[t(e,{bold:!0,color:"white",children:[" ","↓","/j"]}),r(e,{dimColor:!0,children:" Move down"})]})]}),t(e,{children:[t(e,{bold:!0,color:"white",children:[" ","Tab"]}),r(e,{dimColor:!0,children:" Switch panel"})]}),t(e,{children:[t(e,{bold:!0,color:"white",children:[" ","→","/","←"]}),r(e,{dimColor:!0,children:" Focus detail/list"})]})]}),t(i,{flexDirection:"column",marginBottom:1,children:[t(i,{marginBottom:1,children:[r(e,{dimColor:!0,children:"── "}),r(e,{bold:!0,color:"white",children:"SELECTION"})]}),t(e,{children:[t(e,{bold:!0,color:"white",children:[" ","Space"]}),r(e,{dimColor:!0,children:" Toggle check on package"})]}),t(e,{children:[t(e,{bold:!0,color:"white",children:[" ","a"]}),r(e,{dimColor:!0,children:" Toggle check all"})]})]}),t(i,{flexDirection:"column",marginBottom:1,children:[t(i,{marginBottom:1,children:[r(e,{dimColor:!0,children:"── "}),r(e,{bold:!0,color:"white",children:"FILTERS"})]}),t(e,{children:[t(e,{bold:!0,color:"white",children:[" ","←→"]}),r(e,{dimColor:!0,children:" Switch filter tab"})]}),t(e,{children:[t(e,{bold:!0,color:"white",children:[" ","/"]}),r(e,{dimColor:!0,children:" Text filter"})]}),c.length>0&&t(e,{children:[t(e,{bold:!0,color:"white",children:[" ","f"]}),r(e,{dimColor:!0,children:" View filtered-out packages"})]})]}),t(i,{flexDirection:"column",children:[t(i,{marginBottom:1,children:[r(e,{dimColor:!0,children:"── "}),r(e,{bold:!0,color:"white",children:"ACTIONS"})]}),!p&&t(e,{children:[t(e,{bold:!0,color:"white",children:[" ","u"]}),r(e,{dimColor:!0,children:" Apply selected updates"})]}),t(e,{children:[t(e,{bold:!0,color:"white",children:[" ","q"]}),r(e,{dimColor:!0,children:" Quit"})]}),t(e,{children:[t(e,{bold:!0,color:"white",children:[" ","?"]}),r(e,{dimColor:!0,children:" Toggle help"})]})]})]}),X=a.getCheckedEntries(),J=X.filter(n=>n.updateType==="major").length,pe=t(i,{alignItems:"center",flexDirection:"column",children:[J>0&&r(i,{marginBottom:1,marginTop:1,children:t(e,{color:"yellow",children:["⚠"," ",J," ","major update",J===1?"":"s"," ","— review breaking changes"]})}),t(e,{dimColor:!0,children:["Press"," ",r(e,{bold:!0,color:"white",children:"u"})," ","or"," ",r(e,{bold:!0,color:"white",children:"Enter"})," ","to confirm,"," ",r(e,{bold:!0,color:"white",children:"Esc"})," ","to cancel"]})]}),ie=r(ee,{footer:pe,scrollRef:A,title:`Apply ${X.length} update${X.length===1?"":"s"}?`,visible:B,width:70,children:X.map(n=>t(i,{gap:1,children:[t(e,{children:[" ",n.packageName]}),t(e,{dimColor:!0,children:[n.currentRange," ","→"," ",n.newRange]}),r(e,{bold:!0,color:n.updateType==="major"?"red":n.updateType==="minor"?"yellow":"green",children:n.updateType})]},n.packageName))}),oe=c.length>0?r(ee,{footer:t(e,{dimColor:!0,children:[r(e,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",r(e,{bold:!0,color:"white",children:"f"}),"/",r(e,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:j,title:`${c.length} PACKAGE${c.length===1?"":"S"} FILTERED BY TARGET`,visible:v,width:70,children:t(i,{flexDirection:"column",children:[r(i,{marginBottom:1,children:t(e,{dimColor:!0,children:["These packages have newer versions available but are excluded by the current target constraint. Use"," ",r(e,{bold:!0,color:"white",children:"--target latest"})," ","to include them."]})}),c.map(n=>t(i,{gap:1,children:[t(e,{children:[" ",n.packageName]}),t(e,{dimColor:!0,children:[n.currentRange," ","→"," ",n.newRange]}),r(e,{bold:!0,color:n.updateType==="major"?"red":n.updateType==="minor"?"yellow":"green",children:n.updateType})]},n.packageName))]})}):null,ne=r(Ve,{checkedEntries:o.checkedEntries,entries:x,filterActive:o.filterActive,filteredOutCount:c.length,filterText:o.filterText,filterType:o.filterType,focused:o.focusedPanel==="list",groupedByCatalog:o.groupedByCatalog,isDryRun:p,onViewportHeightChange:O,scrollOffset:F,selectedIndex:o.selectedIndex,totalCatalogEntries:y,totalChecked:h,totalEntries:x.length,viewportHeight:P}),ce=r(Fe,{changelogUrl:$,entry:C,focused:o.focusedPanel==="detail",recommendation:V,scrollRef:w});if(ue){const n=Math.floor(f*.35);return t(i,{flexDirection:"column",height:m,width:f,children:[t(i,{flexDirection:"row",flexGrow:1,children:[r(i,{flexGrow:1,children:ne}),r(i,{width:n,children:ce})]}),te,ie,oe,r(he,{autoExitSeconds:s||3,onCancel:T(()=>{N(!1)},"onCancel"),visible:k}),le]})}const ge=Math.floor(m*.55);return t(i,{flexDirection:"column",height:m,width:f,children:[r(i,{height:ge,children:ne}),r(i,{flexGrow:1,children:ce}),te,ie,oe,r(he,{autoExitSeconds:s||3,onCancel:T(()=>{N(!1)},"onCancel"),visible:k}),le]})},"VisUpdateApp");export{ir as B,tr as T,lr as U};
1
+ var fe=Object.defineProperty;var T=(s,l)=>fe(s,"name",{value:l,configurable:!0});import{jsxs as t,jsx as r,Fragment as Z}from"react/jsx-runtime";import{useWindowSize as ae,Box as i,Spinner as me,Text as e,ScrollView as we,Tabs as ye,Tab as be,ScrollBar as Ce,useApp as ke,useInput as xe,Dialog as ee}from"@visulima/tui";import{useSyncExternalStore as Te,useState as L,useRef as W,useMemo as Se,useCallback as de,useEffect as ve}from"react";import{B as se,aG as he}from"../packem_chunks/bin.js";import{u as Ae}from"./use-measured-height-DjYgUOKk.js";var Re=Object.defineProperty,Ee=T((s,l)=>Re(s,"name",{value:l,configurable:!0}),"d$2");const tr=Ee(({current:s,total:l})=>{const{columns:h}=ae(),c=h||80,p=l>0?Math.min(1,s/l):0,a=`${String(Math.round(p*100)).padStart(3)}%`,y=`${String(s)}/${String(l)}`,b=Math.max(10,c-2-a.length-1),f=Math.round(b*p),m=b-f;return t(i,{flexDirection:"column",paddingX:1,children:[t(i,{children:[r(me,{type:"dots"}),r(e,{children:" Checking catalog dependencies "}),r(e,{dimColor:!0,children:y})]}),t(i,{children:[r(e,{color:"cyan",children:"━".repeat(f)}),r(e,{dimColor:!0,children:"─".repeat(m)}),t(e,{dimColor:!0,children:[" ",a]})]})]})},"CheckProgressApp");var Ie=Object.defineProperty,G=T((s,l)=>Ie(s,"name",{value:l,configurable:!0}),"r");const Q=G(s=>{const l=new Map;for(const h of s){const c=l.get(h.catalogName);c?c.push(h):l.set(h.catalogName,[h])}return l},"groupByCatalog"),_=G((s,l,h)=>{let c=s;if(l!=="all"&&(c=l==="security"?c.filter(p=>p.vulnerabilities&&p.vulnerabilities.length>0||p.socketReport&&p.socketReport.alerts.length>0):c.filter(p=>p.updateType===l)),h){const p=h.toLowerCase();c=c.filter(a=>a.packageName.toLowerCase().includes(p))}return c},"filterEntries");class lr{static{T(this,"UpdateStore")}static{G(this,"UpdateStore")}#e;#l=new Set;#t;#i=null;constructor(l,h=null){this.#t=l,h&&(this.#i=new Map(h.recommendations.map(c=>[c.package,c]))),this.#e={aiResult:h,allChecked:!0,applyProgress:null,checkedEntries:new Set(l.map(c=>c.packageName)),entries:l,error:null,filterActive:!1,filterText:"",filterType:"all",focusedPanel:"list",groupedByCatalog:Q(l),phase:"browsing",selectedIndex:0}}getSnapshot=G(()=>this.#e,"getSnapshot");subscribe=G(l=>(this.#l.add(l),()=>{this.#l.delete(l)}),"subscribe");getFilteredEntries(){return _(this.#t,this.#e.filterType,this.#e.filterText)}getRecommendation(l){return this.#i?.get(l)}getCheckedEntries(){return this.#t.filter(l=>this.#e.checkedEntries.has(l.packageName))}setSelectedIndex(l){const h=this.getFilteredEntries(),c=Math.max(0,Math.min(l,h.length-1));c!==this.#e.selectedIndex&&this.#r({...this.#e,selectedIndex:c})}setFocusedPanel(l){l!==this.#e.focusedPanel&&this.#r({...this.#e,focusedPanel:l})}setFilterType(l){if(l!==this.#e.filterType){const h=_(this.#t,l,this.#e.filterText);this.#r({...this.#e,entries:h,filterType:l,groupedByCatalog:Q(h),selectedIndex:0})}}setFilter(l){const h=_(this.#t,this.#e.filterType,l);this.#r({...this.#e,entries:h,filterText:l,groupedByCatalog:Q(h),selectedIndex:0})}setFilterActive(l){if(l!==this.#e.filterActive)if(l)this.#r({...this.#e,filterActive:!0});else{const h=_(this.#t,this.#e.filterType,"");this.#r({...this.#e,entries:h,filterActive:!1,filterText:"",groupedByCatalog:Q(h),selectedIndex:0})}}toggleCheck(l){const h=new Set(this.#e.checkedEntries);h.has(l)?h.delete(l):h.add(l),this.#r({...this.#e,allChecked:h.size===this.#t.length,checkedEntries:h})}checkAll(){this.#r({...this.#e,allChecked:!0,checkedEntries:new Set(this.#t.map(l=>l.packageName))})}uncheckAll(){this.#r({...this.#e,allChecked:!1,checkedEntries:new Set})}toggleAll(){this.#e.allChecked?this.uncheckAll():this.checkAll()}startApply(){const l=this.getCheckedEntries();this.#r({...this.#e,applyProgress:{current:0,total:l.length},phase:"applying"})}updateApplyProgress(l){this.#e.applyProgress&&this.#r({...this.#e,applyProgress:{...this.#e.applyProgress,current:l}})}markDone(){this.#r({...this.#e,phase:"done"})}setError(l){this.#r({...this.#e,error:l,phase:"error"})}#r(l){this.#e=l;for(const h of this.#l)try{h()}catch{}}}var De=Object.defineProperty,Be=T((s,l)=>De(s,"name",{value:l,configurable:!0}),"d");const Ne={major:"red",minor:"yellow",patch:"green"},Pe={CRITICAL:"red",HIGH:"red",LOW:"gray",MODERATE:"yellow",UNKNOWN:"gray"},Le={critical:"red",high:"red",low:"gray",medium:"yellow"},Me={critical:"red",high:"red",low:"green",medium:"yellow"},je={defer:"gray",review:"yellow",skip:"red",update:"green"},Fe=Be(({changelogUrl:s,entry:l,focused:h,recommendation:c,scrollRef:p})=>{const a=h?"white":"gray";if(!l)return r(i,{alignItems:"center",borderColor:"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,justifyContent:"center",children:r(e,{dimColor:!0,children:"No package selected"})});const y=Ne[l.updateType]??"white",b=l.vulnerabilities&&l.vulnerabilities.length>0,f=l.socketReport?.score.overall??0,m=l.socketReport?se(f):"gray";return t(i,{borderColor:a,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[r(i,{flexShrink:0,paddingTop:1,paddingX:2,children:r(e,{bold:!0,color:"white",children:l.packageName})}),t(we,{flexGrow:1,flexShrink:1,paddingX:2,ref:p,scrollbar:!0,scrollbarColor:"gray",scrollbarStyle:"block",children:[r(e,{}),t(i,{children:[r(i,{width:12,children:r(e,{dimColor:!0,children:"Current:"})}),r(e,{children:l.currentRange})]}),t(i,{children:[r(i,{width:12,children:r(e,{dimColor:!0,children:"Target:"})}),r(e,{children:l.newRange}),t(e,{bold:!0,color:y,children:[" ","(",l.updateType,")"]})]}),t(i,{children:[r(i,{width:12,children:r(e,{dimColor:!0,children:"Version:"})}),r(e,{children:l.targetVersion})]}),t(i,{children:[r(i,{width:12,children:r(e,{dimColor:!0,children:"Catalog:"})}),r(e,{children:l.catalogName})]}),l.acceptedRisk&&t(i,{flexDirection:"column",marginTop:1,children:[r(e,{color:"gray",children:"── "}),r(e,{bold:!0,color:"gray",children:"ACKNOWLEDGED RISK"}),t(i,{flexDirection:"column",paddingLeft:2,children:[t(i,{children:[r(e,{dimColor:!0,children:"Reason: "}),r(e,{children:l.acceptedRisk.reason})]}),t(i,{children:[r(e,{dimColor:!0,children:"Accepted: "}),r(e,{children:l.acceptedRisk.acceptedAt.slice(0,10)})]})]})]}),b&&t(i,{flexDirection:"column",marginTop:1,children:[r(e,{dimColor:!0,children:"── "}),r(e,{bold:!0,color:"red",children:"SECURITY"}),r(e,{}),l.vulnerabilities.map(o=>t(i,{flexDirection:"column",marginBottom:1,children:[t(i,{gap:1,children:[t(e,{bold:!0,color:Pe[o.severity]??"gray",children:["⚠"," ",o.severity]}),r(e,{bold:!0,children:o.id})]}),r(i,{paddingLeft:2,children:r(e,{children:o.summary})}),t(i,{gap:2,paddingLeft:2,children:[o.cvssScore!==void 0&&t(e,{dimColor:!0,children:["CVSS:",String(o.cvssScore)]}),o.fixedVersions.length>0&&t(e,{dimColor:!0,children:["Fixed in:",o.fixedVersions.join(", ")]})]})]},o.id))]}),l.socketReport&&t(i,{flexDirection:"column",marginTop:1,children:[r(e,{dimColor:!0,children:"── "}),r(e,{bold:!0,color:"cyan",children:"SOCKET.DEV"}),r(e,{}),t(i,{gap:2,children:[t(i,{children:[r(e,{dimColor:!0,children:"Overall: "}),t(e,{bold:!0,color:m,children:[String(Math.round(f*100)),"%"]})]}),t(i,{children:[r(e,{dimColor:!0,children:"Supply Chain: "}),t(e,{children:[String(Math.round(l.socketReport.score.supplyChain*100)),"%"]})]}),t(i,{children:[r(e,{dimColor:!0,children:"Quality: "}),t(e,{children:[String(Math.round(l.socketReport.score.quality*100)),"%"]})]})]}),t(i,{gap:2,children:[t(i,{children:[r(e,{dimColor:!0,children:"Maintenance: "}),t(e,{children:[String(Math.round(l.socketReport.score.maintenance*100)),"%"]})]}),t(i,{children:[r(e,{dimColor:!0,children:"Vulnerability: "}),t(e,{children:[String(Math.round(l.socketReport.score.vulnerability*100)),"%"]})]}),t(i,{children:[r(e,{dimColor:!0,children:"License: "}),t(e,{children:[l.socketReport.license||"unknown"," ","(",String(Math.round(l.socketReport.score.license*100)),"%)"]})]})]}),l.socketReport.alerts.length>0&&t(i,{flexDirection:"column",marginTop:1,children:[t(e,{bold:!0,color:"yellow",children:["⚠"," ",String(l.socketReport.alerts.length)," ","alert",l.socketReport.alerts.length===1?"":"s",":"]}),l.socketReport.alerts.map(o=>t(i,{gap:1,paddingLeft:2,children:[t(e,{bold:!0,color:Le[o.severity]??"gray",children:["[",o.severity.toUpperCase(),"]"]}),r(e,{children:o.type}),t(e,{dimColor:!0,children:["(",o.category,")"]})]},o.key))]})]}),c&&t(i,{flexDirection:"column",marginTop:1,children:[r(e,{dimColor:!0,children:"── "}),r(e,{bold:!0,color:"white",children:"AI ANALYSIS"}),r(e,{}),t(i,{gap:2,children:[t(i,{children:[r(e,{dimColor:!0,children:"Action: "}),r(e,{bold:!0,color:je[c.action]??"white",children:c.action})]}),t(i,{children:[r(e,{dimColor:!0,children:"Risk: "}),r(e,{bold:!0,color:Me[c.riskLevel]??"white",children:c.riskLevel})]}),t(i,{children:[r(e,{dimColor:!0,children:"Effort: "}),r(e,{bold:!0,children:c.effort})]})]}),c.reason&&r(i,{marginTop:1,paddingLeft:2,children:r(e,{children:c.reason})}),c.breakingChanges.length>0&&t(i,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[r(e,{bold:!0,color:"yellow",children:"Breaking changes:"}),c.breakingChanges.map((o,I)=>t(e,{children:[" ","•"," ",o]},String(I)))]})]}),s&&t(i,{flexDirection:"column",marginTop:1,children:[r(e,{dimColor:!0,children:"── "}),r(e,{bold:!0,color:"white",children:"CHANGELOG"}),r(i,{marginTop:1,paddingLeft:2,children:r(e,{color:"cyan",underline:!0,children:s})})]}),t(i,{flexDirection:"column",marginTop:1,children:[r(e,{dimColor:!0,children:"── "}),r(e,{bold:!0,color:"white",children:"LINKS"}),r(i,{flexDirection:"column",marginTop:1,paddingLeft:2,children:t(e,{color:"cyan",underline:!0,children:["https://npmx.dev/",l.packageName]})})]}),!c&&t(i,{flexDirection:"column",marginTop:1,children:[r(e,{dimColor:!0,children:"── "}),r(e,{bold:!0,color:"white",children:"GUIDANCE"}),t(i,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[l.updateType==="major"&&t(Z,{children:[t(e,{color:"red",children:["⚠"," ","Major update — likely contains breaking changes."]}),r(e,{dimColor:!0,children:" Review the changelog before updating."}),r(e,{dimColor:!0,children:" Use --changelog to fetch release URLs."})]}),l.updateType==="minor"&&t(Z,{children:[t(e,{color:"yellow",children:["ℹ"," ","Minor update — new features, backward compatible."]}),r(e,{dimColor:!0,children:" Generally safe to update."})]}),l.updateType==="patch"&&t(Z,{children:[t(e,{color:"green",children:["✓"," ","Patch update — bug fixes only."]}),r(e,{dimColor:!0,children:" Safe to update."})]}),!c&&r(e,{dimColor:!0,children:" Use --ai to get AI-powered analysis."})]})]})]})]})},"PackageDetailPanel");var $e=Object.defineProperty,re=T((s,l)=>$e(s,"name",{value:l,configurable:!0}),"f");const Oe={major:"red",minor:"yellow",patch:"green"},Ue=[{id:"all",label:"All"},{id:"major",label:"Major"},{id:"minor",label:"Minor"},{id:"patch",label:"Patch"},{id:"security",label:"Security"}],Ge=re(({checked:s,entry:l,isSelected:h})=>{const c=Oe[l.updateType]??"white",p=l.vulnerabilities&&l.vulnerabilities.length>0,a=l.socketReport&&l.socketReport.alerts.length>0,y=!!l.acceptedRisk,b=s?"☑":"☐",f=l.socketReport?`${String(Math.round(l.socketReport.score.overall*100))}%`:"",m=l.socketReport?se(l.socketReport.score.overall):"gray";return t(i,{flexShrink:0,height:1,children:[r(e,{children:h?">":" "}),t(e,{color:s?"white":"gray",children:[" ",b," "]}),p||a?r(e,{color:y?"gray":"red",children:y?"✓ ":"⚠ "}):r(e,{children:" "}),r(i,{flexGrow:1,children:t(e,{bold:h,inverse:h,wrap:"truncate",children:[l.packageName,y?" [ack]":""]})}),f&&t(e,{color:m,children:[" ",f]}),t(e,{dimColor:!0,children:[" ",l.currentRange]}),t(e,{dimColor:!0,children:[" ","→"," "]}),t(e,{children:[l.newRange," "]}),r(e,{bold:!0,color:c,children:l.updateType})]})},"PackageRow"),He=re(({count:s,name:l})=>t(i,{flexShrink:0,height:1,marginTop:1,children:[t(e,{dimColor:!0,children:["▼"," "]}),r(e,{bold:!0,color:"white",children:l.toUpperCase()}),t(e,{dimColor:!0,children:[" ","(",s,")"]})]}),"CatalogHeader"),Ve=re(({checkedEntries:s,entries:l,filterActive:h,filteredOutCount:c,filterText:p,filterType:a,focused:y,groupedByCatalog:b,isDryRun:f,onViewportHeightChange:m,scrollOffset:o,selectedIndex:I,totalCatalogEntries:D,totalChecked:v,totalEntries:H,viewportHeight:M})=>{const j=y?"white":"gray",{measuredHeight:w,ref:A}=Ae(M,m);let F=0,S=0,B=0,R=0;for(const g of l)g.updateType==="major"?F++:g.updateType==="minor"?S++:B++,(g.vulnerabilities&&g.vulnerabilities.length>0||g.socketReport&&g.socketReport.alerts.length>0)&&R++;const k=[];F>0&&k.push(`${F} major`),S>0&&k.push(`${S} minor`),B>0&&k.push(`${B} patch`),R>0&&k.push(`${R} vulnerable`);const N=k.length>0?` (${k.join(", ")})`:"";let x=0;for(const g of l)s.has(g.packageName)&&x++;const C=[];let V=0;for(const[g,E]of b){C.push(r(He,{count:E.length,name:g},`hdr-${g}`));for(const O of E){const P=V;C.push(r(Ge,{checked:s.has(O.packageName),entry:O,isSelected:P===I},O.packageName)),V++}}let $=0;for(const[,g]of b)$+=2+g.length;const q=$>w&&w>0;return t(i,{borderColor:j,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[t(i,{flexShrink:0,gap:1,paddingX:1,children:[r(e,{bold:!0,inverse:!0,children:" VIS "}),t(e,{wrap:"truncate",children:[H,v>0?`/${v}`:""," ","outdated",N,D>v?` · ${D-v} dupes`:""]}),!f&&x>0&&t(e,{dimColor:!0,children:[" ","—",x," ","selected"]})]}),r(i,{flexShrink:0,paddingX:1,paddingY:1,children:r(ye,{isFocused:y,keyMap:{next:[],previous:[],useNumbers:!1,useTab:!1},onChange:T(()=>{},"onChange"),showIndex:!1,value:a,children:Ue.map(({id:g,label:E})=>r(be,{name:g,children:E},g))})}),h&&t(i,{flexShrink:0,paddingX:1,children:[r(e,{bold:!0,color:"white",children:"/ "}),r(e,{children:p}),r(e,{inverse:!0,children:" "})]}),c>0&&r(i,{flexShrink:0,paddingX:1,children:t(e,{color:"yellow",children:["⚠"," ",c," ","package",c===1?"":"s"," ","filtered out by target constraint — press"," ",r(e,{bold:!0,color:"white",children:"f"})," ","to view"]})}),t(i,{flexDirection:"row",flexGrow:1,overflow:"hidden",ref:A,children:[r(i,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:r(i,{flexDirection:"column",marginTop:-o,children:C})}),q&&r(i,{flexShrink:0,marginLeft:1,marginRight:1,children:r(Ce,{contentHeight:$,placement:"inset",scrollOffset:o,style:"block",viewportHeight:w})})]},`list-${a}-${p}`)]})},"PackageListPanel");var qe=Object.defineProperty,Ke=T((s,l)=>qe(s,"name",{value:l,configurable:!0}),"K");const Xe=100,Ye=40,ze=10,We=[],ir=Ke(({autoExitSeconds:s=0,changelogUrls:l,checkedCount:h=0,filteredOutEntries:c=We,isDryRun:p,store:a,totalCatalogEntries:y=0})=>{const{exit:b}=ke(),{columns:f,rows:m}=ae(),o=Te(a.subscribe,a.getSnapshot),[I,D]=L(!1),[v,H]=L(!1),M=W(null),j=W(null),w=W(null),A=W(null),[F,S]=L(0),[B,R]=L(!1),[k,N]=L(!1),x=Se(()=>a.getFilteredEntries(),[o.entries,o.filterType,o.filterText]),C=x[o.selectedIndex]??null,V=C?a.getRecommendation(C.packageName):void 0,$=C&&l?l.get(C.packageName):void 0,q=de(n=>{let d=0,u=0;for(const[,Y]of o.groupedByCatalog){d+=2;for(let z=0;z<Y.length;z++){if(u===n)return d;d+=1,u++}}return d},[o.groupedByCatalog]),g=Math.max(1,m-8-(o.filterActive?1:0)),[E,O]=L(g),P=E>0?E:g,U=de(n=>{const d=q(n);S(u=>d>u+P-2?Math.max(0,d-P+2):d<u+1?Math.max(0,d-1):u)},[q,P]);if(ve(()=>{w.current?.scrollToTop()},[C?.packageName]),xe((n,d)=>{if(n==="c"&&d.ctrl){b();return}if(!k){if(v){d.escape||n==="f"||n==="q"?H(!1):d.downArrow||n==="j"?j.current?.scrollBy(1):(d.upArrow||n==="k")&&j.current?.scrollBy(-1);return}if(B){n==="u"||d.return?(R(!1),a.startApply(),b(a.getCheckedEntries())):d.escape||n==="q"?R(!1):d.downArrow||n==="j"?A.current?.scrollBy(1):d.upArrow||n==="k"?A.current?.scrollBy(-1):d.pageDown?A.current?.scrollBy(5):d.pageUp&&A.current?.scrollBy(-5);return}if(I){d.escape||n==="?"?D(!1):n==="q"?(D(!1),N(!0)):d.downArrow||n==="j"?M.current?.scrollBy(1):(d.upArrow||n==="k")&&M.current?.scrollBy(-1);return}if(n==="?"){D(!0);return}if(n==="q"){N(!0);return}if(d.tab){a.setFocusedPanel(o.focusedPanel==="list"?"detail":"list");return}if(o.focusedPanel==="list"&&(d.leftArrow||d.rightArrow)){const u=["all","major","minor","patch","security"],Y=u.indexOf(o.filterType),z=d.rightArrow?(Y+1)%u.length:(Y-1+u.length)%u.length;S(0),w.current?.scrollToTop(),a.setFilterType(u[z]);return}if(n==="f"&&c.length>0){H(u=>!u);return}if(o.filterActive){if(d.escape){a.setFilterActive(!1);return}if(d.return){a.setFilterActive(!1);return}if(d.backspace){S(0),a.setFilter(o.filterText.slice(0,-1));return}if(n&&!d.ctrl&&!d.meta){S(0),a.setFilter(o.filterText+n);return}return}if(o.focusedPanel==="list"){if(d.downArrow||n==="j"){const u=Math.min(o.selectedIndex+1,x.length-1);a.setSelectedIndex(u),U(u);return}if(d.upArrow||n==="k"){const u=Math.max(o.selectedIndex-1,0);a.setSelectedIndex(u),U(u);return}if(d.pageDown){const u=Math.min(o.selectedIndex+10,x.length-1);a.setSelectedIndex(u),U(u);return}if(d.pageUp){const u=Math.max(o.selectedIndex-10,0);a.setSelectedIndex(u),U(u);return}if(d.home){a.setSelectedIndex(0),S(0);return}if(d.end){const u=x.length-1;a.setSelectedIndex(u),U(u);return}if(n===" "||d.return){C&&a.toggleCheck(C.packageName);return}if(n==="a"){a.toggleAll();return}if(n==="/"){a.setFilterActive(!0);return}if(n==="u"&&!p&&o.checkedEntries.size>0){R(!0);return}if(d.rightArrow){a.setFocusedPanel("detail");return}return}if(o.focusedPanel==="detail"){if(d.escape||d.leftArrow){a.setFocusedPanel("list");return}if(d.downArrow||n==="j"){w.current?.scrollBy(1);return}if(d.upArrow||n==="k"){w.current?.scrollBy(-1);return}if(d.pageDown){w.current?.scrollBy(10);return}if(d.pageUp){w.current?.scrollBy(-10);return}if(d.home){w.current?.scrollToTop();return}d.end&&w.current?.scrollToBottom()}}},{isActive:!0}),f<Ye||m<ze)return r(i,{alignItems:"center",height:m,justifyContent:"center",width:f,children:t(e,{color:"yellow",children:["Terminal too small (",f,"x",m,")"]})});const ue=f>=Xe,K=[t(i,{gap:1,children:[r(e,{bold:!0,color:"white",children:"q"}),r(e,{dimColor:!0,children:"QUIT"})]},"q"),t(i,{gap:1,children:[r(e,{bold:!0,color:"white",children:"?"}),r(e,{dimColor:!0,children:"HELP"})]},"?"),t(i,{gap:1,children:[r(e,{bold:!0,color:"white",children:"↑↓"}),r(e,{dimColor:!0,children:"NAV"})]},"nav"),t(i,{gap:1,children:[r(e,{bold:!0,color:"white",children:"Space"}),r(e,{dimColor:!0,children:"CHECK"})]},"sp"),t(i,{gap:1,children:[r(e,{bold:!0,color:"white",children:"a"}),r(e,{dimColor:!0,children:"ALL"})]},"a")];!p&&o.checkedEntries.size>0&&K.push(t(i,{gap:1,children:[r(e,{bold:!0,color:"green",children:"u"}),r(e,{dimColor:!0,children:"APPLY"})]},"u")),c.length>0&&K.push(t(i,{gap:1,children:[r(e,{bold:!0,color:"yellow",children:"f"}),t(e,{dimColor:!0,children:["FILTERED (",c.length,")"]})]},"fo")),K.push(t(i,{gap:1,children:[r(e,{bold:!0,color:"white",children:"←→"}),r(e,{dimColor:!0,children:"FILTER"})]},"lr"),t(i,{gap:1,children:[r(e,{bold:!0,color:"white",children:"/"}),r(e,{dimColor:!0,children:"SEARCH"})]},"f"),t(i,{gap:1,children:[r(e,{bold:!0,color:"white",children:"Tab"}),r(e,{dimColor:!0,children:"PANEL"})]},"t"));const te=r(i,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,children:r(i,{flexWrap:"wrap",gap:2,paddingX:1,children:K})}),le=t(ee,{footer:t(e,{dimColor:!0,children:[r(e,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",r(e,{bold:!0,color:"white",children:"?"}),"/",r(e,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:M,title:"KEYBOARD SHORTCUTS",visible:I,width:52,children:[t(i,{flexDirection:"column",marginBottom:1,children:[t(i,{marginBottom:1,children:[r(e,{dimColor:!0,children:"── "}),r(e,{bold:!0,color:"white",children:"NAVIGATION"})]}),t(i,{children:[r(i,{width:24,children:t(e,{children:[t(e,{bold:!0,color:"white",children:[" ","↑","/k"]}),r(e,{dimColor:!0,children:" Move up"})]})}),t(e,{children:[t(e,{bold:!0,color:"white",children:[" ","↓","/j"]}),r(e,{dimColor:!0,children:" Move down"})]})]}),t(e,{children:[t(e,{bold:!0,color:"white",children:[" ","Tab"]}),r(e,{dimColor:!0,children:" Switch panel"})]}),t(e,{children:[t(e,{bold:!0,color:"white",children:[" ","→","/","←"]}),r(e,{dimColor:!0,children:" Focus detail/list"})]})]}),t(i,{flexDirection:"column",marginBottom:1,children:[t(i,{marginBottom:1,children:[r(e,{dimColor:!0,children:"── "}),r(e,{bold:!0,color:"white",children:"SELECTION"})]}),t(e,{children:[t(e,{bold:!0,color:"white",children:[" ","Space"]}),r(e,{dimColor:!0,children:" Toggle check on package"})]}),t(e,{children:[t(e,{bold:!0,color:"white",children:[" ","a"]}),r(e,{dimColor:!0,children:" Toggle check all"})]})]}),t(i,{flexDirection:"column",marginBottom:1,children:[t(i,{marginBottom:1,children:[r(e,{dimColor:!0,children:"── "}),r(e,{bold:!0,color:"white",children:"FILTERS"})]}),t(e,{children:[t(e,{bold:!0,color:"white",children:[" ","←→"]}),r(e,{dimColor:!0,children:" Switch filter tab"})]}),t(e,{children:[t(e,{bold:!0,color:"white",children:[" ","/"]}),r(e,{dimColor:!0,children:" Text filter"})]}),c.length>0&&t(e,{children:[t(e,{bold:!0,color:"white",children:[" ","f"]}),r(e,{dimColor:!0,children:" View filtered-out packages"})]})]}),t(i,{flexDirection:"column",children:[t(i,{marginBottom:1,children:[r(e,{dimColor:!0,children:"── "}),r(e,{bold:!0,color:"white",children:"ACTIONS"})]}),!p&&t(e,{children:[t(e,{bold:!0,color:"white",children:[" ","u"]}),r(e,{dimColor:!0,children:" Apply selected updates"})]}),t(e,{children:[t(e,{bold:!0,color:"white",children:[" ","q"]}),r(e,{dimColor:!0,children:" Quit"})]}),t(e,{children:[t(e,{bold:!0,color:"white",children:[" ","?"]}),r(e,{dimColor:!0,children:" Toggle help"})]})]})]}),X=a.getCheckedEntries(),J=X.filter(n=>n.updateType==="major").length,pe=t(i,{alignItems:"center",flexDirection:"column",children:[J>0&&r(i,{marginBottom:1,marginTop:1,children:t(e,{color:"yellow",children:["⚠"," ",J," ","major update",J===1?"":"s"," ","— review breaking changes"]})}),t(e,{dimColor:!0,children:["Press"," ",r(e,{bold:!0,color:"white",children:"u"})," ","or"," ",r(e,{bold:!0,color:"white",children:"Enter"})," ","to confirm,"," ",r(e,{bold:!0,color:"white",children:"Esc"})," ","to cancel"]})]}),ie=r(ee,{footer:pe,scrollRef:A,title:`Apply ${X.length} update${X.length===1?"":"s"}?`,visible:B,width:70,children:X.map(n=>t(i,{gap:1,children:[t(e,{children:[" ",n.packageName]}),t(e,{dimColor:!0,children:[n.currentRange," ","→"," ",n.newRange]}),r(e,{bold:!0,color:n.updateType==="major"?"red":n.updateType==="minor"?"yellow":"green",children:n.updateType})]},n.packageName))}),oe=c.length>0?r(ee,{footer:t(e,{dimColor:!0,children:[r(e,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",r(e,{bold:!0,color:"white",children:"f"}),"/",r(e,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:j,title:`${c.length} PACKAGE${c.length===1?"":"S"} FILTERED BY TARGET`,visible:v,width:70,children:t(i,{flexDirection:"column",children:[r(i,{marginBottom:1,children:t(e,{dimColor:!0,children:["These packages have newer versions available but are excluded by the current target constraint. Use"," ",r(e,{bold:!0,color:"white",children:"--target latest"})," ","to include them."]})}),c.map(n=>t(i,{gap:1,children:[t(e,{children:[" ",n.packageName]}),t(e,{dimColor:!0,children:[n.currentRange," ","→"," ",n.newRange]}),r(e,{bold:!0,color:n.updateType==="major"?"red":n.updateType==="minor"?"yellow":"green",children:n.updateType})]},n.packageName))]})}):null,ne=r(Ve,{checkedEntries:o.checkedEntries,entries:x,filterActive:o.filterActive,filteredOutCount:c.length,filterText:o.filterText,filterType:o.filterType,focused:o.focusedPanel==="list",groupedByCatalog:o.groupedByCatalog,isDryRun:p,onViewportHeightChange:O,scrollOffset:F,selectedIndex:o.selectedIndex,totalCatalogEntries:y,totalChecked:h,totalEntries:x.length,viewportHeight:P}),ce=r(Fe,{changelogUrl:$,entry:C,focused:o.focusedPanel==="detail",recommendation:V,scrollRef:w});if(ue){const n=Math.floor(f*.35);return t(i,{flexDirection:"column",height:m,width:f,children:[t(i,{flexDirection:"row",flexGrow:1,children:[r(i,{flexGrow:1,children:ne}),r(i,{width:n,children:ce})]}),te,ie,oe,r(he,{autoExitSeconds:s||3,onCancel:T(()=>{N(!1)},"onCancel"),visible:k}),le]})}const ge=Math.floor(m*.55);return t(i,{flexDirection:"column",height:m,width:f,children:[r(i,{height:ge,children:ne}),r(i,{flexGrow:1,children:ce}),te,ie,oe,r(he,{autoExitSeconds:s||3,onCancel:T(()=>{N(!1)},"onCancel"),visible:k}),le]})},"VisUpdateApp");export{ir as B,tr as T,lr as U};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/vis",
3
- "version": "1.0.0-alpha.14",
3
+ "version": "1.0.0-alpha.15",
4
4
  "description": "A CLI task runner for monorepo workspaces, powered by @visulima/task-runner",
5
5
  "keywords": [
6
6
  "build",
@@ -76,11 +76,9 @@
76
76
  "LICENSE.md"
77
77
  ],
78
78
  "dependencies": {
79
- "@visulima/find-cache-dir": "3.0.0-alpha.9",
80
- "@visulima/fs": "5.0.0-alpha.16",
81
79
  "@visulima/secret-scanner": "1.0.0-alpha.1",
82
80
  "@visulima/task-runner": "1.0.0-alpha.10",
83
- "@visulima/tui": "1.0.0-alpha.9",
81
+ "@visulima/tui": "1.0.0-alpha.10",
84
82
  "execa": "^9.6.1",
85
83
  "jiti": "^2.7.0",
86
84
  "module-replacements": "^2.11.0",
@@ -101,14 +99,14 @@
101
99
  }
102
100
  },
103
101
  "optionalDependencies": {
104
- "@visulima/vis-binding-darwin-arm64": "1.0.0-alpha.14",
105
- "@visulima/vis-binding-linux-arm64-gnu": "1.0.0-alpha.14",
106
- "@visulima/vis-binding-darwin-x64": "1.0.0-alpha.14",
107
- "@visulima/vis-binding-linux-arm64-musl": "1.0.0-alpha.14",
108
- "@visulima/vis-binding-linux-x64-gnu": "1.0.0-alpha.14",
109
- "@visulima/vis-binding-linux-x64-musl": "1.0.0-alpha.14",
110
- "@visulima/vis-binding-win32-x64-msvc": "1.0.0-alpha.14",
111
- "@visulima/vis-binding-win32-arm64-msvc": "1.0.0-alpha.14"
102
+ "@visulima/vis-binding-darwin-arm64": "1.0.0-alpha.15",
103
+ "@visulima/vis-binding-darwin-x64": "1.0.0-alpha.15",
104
+ "@visulima/vis-binding-linux-arm64-gnu": "1.0.0-alpha.15",
105
+ "@visulima/vis-binding-linux-arm64-musl": "1.0.0-alpha.15",
106
+ "@visulima/vis-binding-linux-x64-gnu": "1.0.0-alpha.15",
107
+ "@visulima/vis-binding-linux-x64-musl": "1.0.0-alpha.15",
108
+ "@visulima/vis-binding-win32-arm64-msvc": "1.0.0-alpha.15",
109
+ "@visulima/vis-binding-win32-x64-msvc": "1.0.0-alpha.15"
112
110
  },
113
111
  "engines": {
114
112
  "node": "^22.14.0 || >=24.10.0"
@@ -1 +0,0 @@
1
- var C=Object.defineProperty;var m=(t,e)=>C(t,"name",{value:e,configurable:!0});import{createRequire as _}from"node:module";import{X as S}from"./xxh3-DrAUNq4n.js";import{ensureDirSync as A,isAccessibleSync as d,readJsonSync as v}from"@visulima/fs";import{M as c}from"./index-OlP7U_t5.js";import{n as J}from"../packem_chunks/bin.js";const M=_(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,b=m(t=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[e,r]=u.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return u.getBuiltinModule(t)}return M(t)},"__cjs_getBuiltinModule"),{rmSync:f,writeFileSync:p,readdirSync:h,statSync:D}=b("node:fs");var w=Object.defineProperty,n=m((t,e)=>w(t,"name",{value:e,configurable:!0}),"r");const a=n(()=>c(J(),"ai"),"getCacheDirectory"),B=3600*1e3,N=1800*1e3,j=n(()=>{A(a())},"ensureCacheDirectory"),q=n((t,e,r)=>{const s=r.map(i=>({currentRange:i.currentRange,name:i.packageName,targetVersion:i.targetVersion})).toSorted((i,y)=>i.name.localeCompare(y.name)),o=JSON.stringify({analysisType:e,packages:s,provider:t});return S(Buffer.from(o))},"buildCacheKey"),z=n(t=>{const e=c(a(),`${t}.json`);if(d(e))try{const r=v(e);if(Date.now()-r.createdAt>r.ttlMs){f(e,{force:!0});return}return r.result}catch{f(e,{force:!0});return}},"getCachedAnalysis"),V=n((t,e,r)=>{j();const s=a(),o={createdAt:Date.now(),result:e,ttlMs:r};p(c(s,`${t}.json`),JSON.stringify(o,void 0,2),"utf8")},"setCachedAnalysis"),F=n((t,e)=>e!==void 0&&e>0?e:t==="security"?N:B,"getTtlForAnalysisType"),K=n(()=>{const t=a();if(!d(t))return{entries:0,newestEntry:void 0,oldestEntry:void 0,totalSizeBytes:0};const e=h(t).filter(i=>i.endsWith(".json"));let r=0,s,o;for(const i of e){const y=c(t,i),g=D(y);r+=g.size;const{mtimeMs:l}=g;(s===void 0||l<s)&&(s=l),(o===void 0||l>o)&&(o=l)}return{entries:e.length,newestEntry:o,oldestEntry:s,totalSizeBytes:r}},"getCacheStats"),P=n(t=>S(Buffer.from(JSON.stringify(t))),"buildHashCacheKey"),W=n(t=>{const e=c(a(),`${t}.json`);if(d(e))try{const r=v(e);if(Date.now()-r.createdAt>r.ttlMs){f(e,{force:!0});return}return r.result}catch{f(e,{force:!0});return}},"getCachedJson"),x=n((t,e,r)=>{j();const s=a(),o={createdAt:Date.now(),result:e,ttlMs:r};p(c(s,`${t}.json`),JSON.stringify(o,void 0,2),"utf8")},"setCachedJson"),H=n(()=>{const t=a();if(!d(t))return 0;const e=h(t).filter(r=>r.endsWith(".json"));for(const r of e)f(c(t,r),{force:!0});return e.length},"clearCache");export{H as B,K as J,P as M,W as N,x as O,V as R,z as T,F as j,q as k};
@@ -1 +0,0 @@
1
- var h=Object.defineProperty;var l=(e,r)=>h(e,"name",{value:r,configurable:!0});import{createRequire as d}from"node:module";import{O as p,C as a,z as m}from"./index-OlP7U_t5.js";import{DEFAULT_CACHE_DIRECTORY_NAME as u,getMainWorktreeRoot as v}from"@visulima/task-runner";const f=d(import.meta.url),i=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,g=l(e=>{if(typeof i<"u"&&i.versions&&i.versions.node){const[r,t]=i.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return i.getBuiltinModule(e)}return f(e)},"__cjs_getBuiltinModule"),{execFileSync:_}=g("node:child_process");var C=Object.defineProperty,s=l((e,r)=>C(e,"name",{value:r,configurable:!0}),"s");const y=s((e,r,t)=>{const n=s(c=>p(c)?c:a(e,c),"normalize");if(r&&r.length>0)return n(r);if(t&&t.length>0)return n(t);const o=process.env.VIS_CACHE_DIRECTORY;return o&&o.length>0?n(o):a(e,u)},"resolveCacheDirectory"),E=s((e,r)=>r===!1?e:v(e)??e,"resolveSharedCacheRoot"),I=s((e,r,t,n)=>{const o=r??t??process.env.VIS_CACHE_DIRECTORY;if(o&&o.length>0)return y(e,r,t);const c=E(e,n);return a(c,u)},"resolveSharedCacheDirectory"),R=/[^\w.-]+/g,S=/^-+|-+$/g,b=s(e=>e.trim().replaceAll(R,"-").replaceAll(S,"").slice(0,64),"sanitizeBranchSegment"),A=s(e=>{try{const r=_("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:e,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return!r||r==="HEAD"?void 0:r}catch{return}},"detectGitBranch"),z=s((e,r,t)=>{if(t!==!0)return e;const n=A(r);if(!n)return e;const o=b(n);return o.length===0?e:a(e,"branches",o)},"applyBranchScope"),H=s((e,r)=>{const t=m(r,e);return t.length===0?!1:t!==".."&&!t.startsWith("../")&&!p(t)},"isCacheDirectoryInsideWorkspace");export{I as E,z as a,H as m};
@@ -1,2 +0,0 @@
1
- var j=Object.defineProperty;var b=(t,e)=>j(t,"name",{value:e,configurable:!0});import{e as E,au as h,E as w,c as M,d as O,s as R}from"../packem_chunks/bin.js";import{Box as g,Text as d,Spinner as A,render as I}from"@visulima/tui";import k from"react";import{jsx as i,jsxs as v}from"react/jsx-runtime";import{D as S,W as Y,T as B,C as F}from"./symbols-CQmER5MT.js";import{readFileSync as $}from"@visulima/fs";import{F as D}from"./lockfile-BXylopgH.js";import{M as P}from"./index-OlP7U_t5.js";var G=Object.defineProperty,N=b((t,e)=>G(t,"name",{value:e,configurable:!0}),"l$1");const T=N(({rows:t})=>i(g,{flexDirection:"column",children:t.map(e=>{let r;switch(e.status){case"error":{r=i(d,{color:"red",children:F});break}case"ok":{r=i(d,{color:"green",children:B});break}case"running":{r=i(d,{color:"white",children:i(A,{type:"dots"})});break}case"warn":{r=i(d,{color:"yellow",children:Y});break}default:{r=i(d,{dimColor:!0,children:S});break}}return v(g,{children:[i(g,{width:3,children:r}),i(g,{flexGrow:1,children:i(d,{children:e.label})}),e.summary?i(g,{children:v(d,{dimColor:!0,children:[S," ",e.summary]})}):null]},e.id)})}),"ScanProgressApp");var W=Object.defineProperty,l=b((t,e)=>W(t,"name",{value:e,configurable:!0}),"e");const z={error:O(h.failure),ok:M(h.success),pending:w(h.dash),skip:w(h.dash),warn:E(h.warning)},H=l((t,e,r)=>{const m=r?`${t} ${w(`— ${r}`)}`:t;return` ${z[e]} ${m}
2
- `},"formatStaticRow"),ee=l((t,e={})=>{const r=e.stream??process.stderr,m=typeof r.isTTY=="boolean"&&r.isTTY&&!R,p=e.live??m,n=new Map;for(const a of t)n.set(a.id,{id:a.id,label:a.label,status:"pending"});if(!p||t.length===0)return{finish:l((a,c,y)=>{const f=n.get(a);f&&(n.set(a,{...f,status:c,summary:y}),r.write(H(f.label,c,y)))},"finish"),start:l(a=>{const c=n.get(a);c&&n.set(a,{...c,status:"running"})},"start"),stop:l(()=>{},"stop")};const u=l(()=>t.map(a=>n.get(a.id)),"buildRows");let s=I(k.createElement(T,{rows:u()}),{interactive:!0,patchConsole:!1});const o=l(()=>{s?.rerender(k.createElement(T,{rows:u()}))},"rerender");return{finish:l((a,c,y)=>{const f=n.get(a);f&&(n.set(a,{...f,status:c,summary:y}),o())},"finish"),start:l(a=>{const c=n.get(a);c&&(n.set(a,{...c,status:"running"}),o())},"start"),stop:l(()=>{s&&(o(),s.unmount(),s=void 0)},"stop")}},"startScanProgress");var K=Object.defineProperty,x=b((t,e)=>K(t,"name",{value:e,configurable:!0}),"l");const C={bun:{file:"bun.lock",type:"bun"},npm:{file:"package-lock.json",type:"npm"},pnpm:{file:"pnpm-lock.yaml",type:"pnpm"},yarn:{file:"yarn.lock",type:"yarn"}},re=x((t,e)=>{const r=C[e];if(!r)return[];let m;try{m=$(P(t,r.file))}catch{return[]}const p=D(m,r.type);if(p.length===0)return[];const n=new Set,u=[];for(const s of p){const o=`${s.name}@${s.version}`;n.has(o)||(n.add(o),u.push({isDev:!1,name:s.name,version:s.version}))}return u},"lockedPackages"),te=x((t,e)=>{const r=C[e];if(!r)return[];let m;try{m=$(P(t,r.file))}catch{return[]}const p=D(m,r.type);if(p.length===0)return[];const n=new Map;for(const s of p)n.has(s.name)||n.set(s.name,new Set),n.get(s.name).add(s.version);const u=[];for(const[s,o]of n)o.size<=1||u.push({name:s,versions:[...o]});return u.sort((s,o)=>s.name.localeCompare(o.name))},"findDuplicateDependencies");export{te as f,re as l,ee as s};
@@ -1,2 +0,0 @@
1
- var E=Object.defineProperty;var k=(e,o)=>E(e,"name",{value:o,configurable:!0});import{createRequire as D}from"node:module";import{ensureDirSync as R,writeFileSync as C,isAccessibleSync as M,readJsonSync as O}from"@visulima/fs";import{K as _,M as c,z as A}from"./index-OlP7U_t5.js";const T=D(import.meta.url),m=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,x=k(e=>{if(typeof m<"u"&&m.versions&&m.versions.node){const[o,r]=m.versions.node.split(".").map(Number);if(o>22||o===22&&r>=3||o===20&&r>=16)return m.getBuiltinModule(e)}return T(e)},"__cjs_getBuiltinModule"),{cpSync:S,lstatSync:F,readdirSync:N,rmSync:v}=x("node:fs");var P=Object.defineProperty,l=k((e,o)=>P(e,"name",{value:o,configurable:!0}),"p");const $=l((e,o)=>{const r=new Set,s=[e],a=new Set([e]);for(;s.length>0;){const n=s.shift(),f=o.dependencies[n]??[];for(const i of f)a.has(i.target)||(a.add(i.target),r.add(i.target),s.push(i.target))}return r},"collectTransitiveProjectDeps"),g="vis-docker-manifest.json",I=["package.json","project.json"],q=["package.json","pnpm-workspace.yaml","pnpm-lock.yaml","package-lock.json","yarn.lock","bun.lock","bun.lockb",".npmrc","vis.config.ts","vis.config.mts","vis.config.cts","vis.config.js","vis.config.mjs","vis.config.cjs"],L=l((e,o)=>{const r=new Set(e);for(const s of e){const a=$(s,o);for(const n of a)r.add(n)}return r},"resolveFocusProjects"),y=l(e=>{R(e)},"ensureDir"),h=l((e,o)=>{try{return y(_(o)),S(e,o),!0}catch(r){if(r.code==="ENOENT")return!1;throw r}},"copyFileIfExists"),b=l((e,o)=>{let r;try{r=F(e)}catch{return}if(!r.isSymbolicLink()){if(r.isFile()){y(_(o)),S(e,o);return}y(o);for(const s of N(e,{withFileTypes:!0}))s.name==="node_modules"||s.name===".git"||s.isSymbolicLink()||b(c(e,s.name),c(o,s.name))}},"copyTreeExcludingNodeModules"),G=l(e=>{const{focus:o,includeSources:r=!1,outDir:s,projectGraph:a,workspace:n,workspaceRoot:f}=e,i=o.filter(t=>n.projects[t]===void 0);if(i.length>0)throw new Error(`Unknown focus project(s): ${i.join(", ")}. Check project names in your workspace.`);const j=L(o,a),u=c(s,"workspace"),d=c(s,"sources");v(u,{force:!0,recursive:!0}),v(d,{force:!0,recursive:!0}),y(u);for(const t of q)h(c(f,t),c(u,t));for(const t of j){const p=n.projects[t];if(p?.root)for(const w of I)h(c(f,p.root,w),c(u,p.root,w))}if(r){y(d);for(const t of o){const p=n.projects[t];p?.root&&b(c(f,p.root),c(d,p.root))}}return C(c(s,g),`${JSON.stringify({focus:o,projects:[...j].sort()},null,2)}
2
- `),{projects:[...j]}},"scaffoldDockerContext"),U=l(e=>{const{contextRoot:o,workspace:r,workspaceRoot:s}=e,a=c(o,g);if(!M(a))throw new Error(`No ${g} at ${o}. Run \`vis docker scaffold\` first.`);const n=O(a);if(!Array.isArray(n.projects))throw new TypeError(`Invalid ${g}: "projects" must be an array.`);const f=new Set(n.projects),i=[];for(const[j,u]of Object.entries(r.projects)){if(f.has(j)||!u.root)continue;const d=c(s,u.root),t=A(s,d);t===""||t==="."||t.startsWith("..")||(v(d,{force:!0,recursive:!0}),i.push(t))}return{removed:i}},"pruneDockerContext");export{U as p,L as r,G as s};
@@ -1,2 +0,0 @@
1
- var h=Object.defineProperty;var a=(t,e)=>h(t,"name",{value:e,configurable:!0});import{createRequire as m}from"node:module";import{M as l}from"./index-OlP7U_t5.js";const y=m(import.meta.url),s=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=a(t=>{if(typeof s<"u"&&s.versions&&s.versions.node){const[e,r]=s.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return s.getBuiltinModule(t)}return y(t)},"__cjs_getBuiltinModule"),{mkdirSync:F,writeFileSync:L,readdirSync:_}=u("node:fs"),{readFile:v}=u("node:fs/promises");var j=Object.defineProperty,i=a((t,e)=>j(t,"name",{value:e,configurable:!0}),"i");const S="last-failures",c=i(t=>l(t,".task-runner",S),"getFailureLogDirectory"),d=i((t,e)=>l(c(t),`${encodeURIComponent(e)}.json`),"getFailureLogPath");class I{static{a(this,"FailureLogLifeCycle")}static{i(this,"FailureLogLifeCycle")}#e;#t;constructor(e,r){this.#e=e,this.#t=r}printTaskTerminalOutput(e,r,o){if(r!=="failure")return;const n=c(this.#e);try{F(n,{recursive:!0})}catch{return}const f=e.overrides.command,g=e.projectRoot,p={command:f,cwd:g,exitCode:void 0,hash:e.hash,runId:this.#t,status:r,taskId:e.id,terminalOutput:o,timestamp:new Date().toISOString()};try{L(d(this.#e,e.id),`${JSON.stringify(p,void 0,2)}
2
- `,"utf8")}catch{}}}const R=i(async(t,e)=>{const r=d(t,e);try{const o=await v(r,"utf8");return JSON.parse(o)}catch{return}},"loadFailureLog"),T=i(t=>{const e=c(t);let r;try{r=_(e)}catch{return[]}const o=[];for(const n of r)if(n.endsWith(".json"))try{o.push(decodeURIComponent(n.slice(0,-5)))}catch{}return o},"listFailureLogs");export{I as F,R as a,T as l};
@@ -1 +0,0 @@
1
- var k=Object.defineProperty;var f=(a,s)=>k(a,"name",{value:s,configurable:!0});import{createRequire as b}from"node:module";import{isAccessibleSync as S,readJsonSync as T}from"@visulima/fs";import{M as p}from"./index-OlP7U_t5.js";const R=b(import.meta.url),l=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,y=f(a=>{if(typeof l<"u"&&l.versions&&l.versions.node){const[s,n]=l.versions.node.split(".").map(Number);if(s>22||s===22&&n>=3||s===20&&n>=16)return l.getBuiltinModule(a)}return R(a)},"__cjs_getBuiltinModule"),{readdirSync:j}=y("node:fs");var v=Object.defineProperty,d=f((a,s)=>v(a,"name",{value:s,configurable:!0}),"i");const $=d((a,s)=>{let n=0,o=0,r=0;for(const[,t]of a)switch(t.status){case"failure":{r+=1;break}case"local-cache":case"local-cache-kept-existing":case"remote-cache":{o+=1;break}case"success":{n+=1;break}}const i=[];n>0&&i.push(`${String(n)} succeeded`),o>0&&i.push(`${String(o)} cached`),r>0&&i.push(`${String(r)} failed`);const c=(s/1e3).toFixed(1);return i.push(`${c}s`),i.join(" · ")},"formatTimingSummary"),g=d(a=>{const s=p(a,".task-runner","runs");if(!S(s))return[];const n=j(s).filter(r=>r.endsWith(".json")),o=[];for(const r of n)try{o.push(T(p(s,r)))}catch{}return o},"loadRunSummaries"),P=d((a,s,n)=>{const o=n??g(a);if(o.length<2)return;let r=0,i=0;for(const e of o)typeof e.duration=="number"&&e.duration>0&&(r+=e.duration,i+=1);if(i<2)return;const c=r/i-s,t=Math.abs(c/1e3).toFixed(1);return Math.abs(c)<500?"(about average)":c>0?`(${t}s faster than avg)`:`(${t}s slower than avg)`},"compareDuration");var F=Object.defineProperty,m=f((a,s)=>F(a,"name",{value:s,configurable:!0}),"l");const E=m((a,s={},n)=>{const o=n??g(a);if(o.length===0)return[];const r=new Map;for(const t of o)if(!(s.since&&(t.startTime===void 0||t.startTime<s.since))&&Array.isArray(t.tasks))for(const e of t.tasks){if(e.cacheStatus==="HIT"||e.cacheStatus==="REMOTE_HIT"||e.cacheStatus==="SKIPPED")continue;const u=r.get(e.taskId)??{failures:0,project:e.target.project,successes:0,target:e.target.target,totalRuns:0};u.totalRuns+=1,e.exitCode!==void 0&&e.exitCode!==0?(u.failures+=1,u.lastFailure=e.startTime??t.startTime):u.successes+=1,r.set(e.taskId,u)}const i=s.minRuns??2,c=[];for(const[t,e]of r)e.totalRuns<i||e.failures!==0&&c.push({failures:e.failures,flakinessRate:e.failures/e.totalRuns,lastFailure:e.lastFailure,project:e.project,successes:e.successes,target:e.target,taskId:t,totalRuns:e.totalRuns});return c.sort((t,e)=>e.flakinessRate-t.flakinessRate),c},"analyzeFlakiness"),q=m(a=>{if(a.length===0)return["No flaky tasks detected."];const s=["Task","Runs","Failures","Rate","Last Failure"],n=a.map(t=>[t.taskId,String(t.totalRuns),String(t.failures),`${(t.flakinessRate*100).toFixed(1)}%`,t.lastFailure??"—"]),o=s.map((t,e)=>{let u=0;for(const h of n)u=Math.max(u,(h[e]??"").length);return Math.max(t.length,u)}),r=m((t,e)=>t.padEnd(e),"pad"),i=o.map(t=>"─".repeat(t)).join("──"),c=[s.map((t,e)=>r(t,o[e])).join(" "),i];for(const t of n)c.push(t.map((e,u)=>r(e,o[u])).join(" "));return c},"formatFlakinessTable");export{E as a,q as b,P as c,$ as f,g as l};
@@ -1,6 +0,0 @@
1
- var Xt=Object.defineProperty;var w=(r,a)=>Xt(r,"name",{value:a,configurable:!0});import{definePlugin as Yt}from"../packem_chunks/applyDefaults.js";var en=Object.defineProperty,tn=w((r,a)=>en(r,"name",{value:a,configurable:!0}),"$e"),nn=Object.defineProperty,H=tn((r,a)=>nn(r,"name",{value:a,configurable:!0}),"W"),rn=Object.defineProperty,l=H((r,a)=>rn(r,"name",{value:a,configurable:!0}),"u$1");let me=l(()=>{var r=(()=>{var a=Object.defineProperty,i=Object.getOwnPropertyDescriptor,u=Object.getOwnPropertyNames,g=Object.prototype.hasOwnProperty,d=l((e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},"ne"),m=l((e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of u(t))!g.call(e,o)&&o!==n&&a(e,o,{get:l(()=>t[o],"get"),enumerable:!(s=i(t,o))||s.enumerable});return e},"ae"),x=l(e=>m(a({},"__esModule",{value:!0}),e),"oe"),I={};d(I,{zeptomatch:l(()=>xe,"zeptomatch")});var Q=l(e=>{const t=new Set,n=[e];for(let s=0;s<n.length;s++){const o=n[s];if(t.has(o))continue;t.add(o);const{children:c}=o;if(c?.length)for(let f=0,h=c.length;f<h;f++)n.push(c[f])}return Array.from(t)},"M"),Ee=l(e=>{let t="";const n=Q(e);for(let s=0,o=n.length;s<o;s++){const c=n[s];if(!c.regex)continue;const f=c.regex.flags;if(t||(t=f),t!==f)throw new Error(`Inconsistent RegExp flags used: "${t}" and "${f}"`)}return t},"se"),X=l((e,t,n)=>{const s=n.get(e);if(s!==void 0)return s;const o=e.partial??t;let c="";if(e.regex&&(c+=o?"(?:$|":"",c+=e.regex.source),e.children?.length){const f=Ae(e.children.map(h=>X(h,t,n)).filter(Boolean));if(f?.length){const h=e.children.some(N=>!N.regex||!(N.partial??t)),v=f.length>1||o&&(!c.length||h);c+=v?o?"(?:$|":"(?:":"",c+=f.join("|"),c+=v?")":""}}return e.regex&&(c+=o?")":""),n.set(e,c),c},"O"),Oe=l((e,t)=>{const n=new Map,s=Q(e);for(let o=s.length-1;o>=0;o--){const c=X(s[o],t,n);if(!(o>0))return c}return""},"ie"),Ae=l(e=>Array.from(new Set(e)),"ue"),Z=l((e,t,n)=>Z.compile(e,n).test(t),"R");Z.compile=(e,t)=>{const n=t?.partial??!1,s=Oe(e,n),o=Ee(e);return new RegExp(`^(?:${s})$`,o)};var Re=Z,Ce=l((e,t)=>{const n=Re.compile(e,t),s=`${n.source.slice(0,-1)}[\\\\/]?$`,o=n.flags;return new RegExp(s,o)},"le"),Me=Ce,Se=l(e=>{const t=e.map(s=>s.source).join("|")||"$^",n=e[0]?.flags;return new RegExp(t,n)},"ve"),ze=Se,Y=l(e=>Array.isArray(e),"j"),_=l(e=>typeof e=="function","_"),Pe=l(e=>e.length===0,"he"),Ie=(()=>{const{toString:e}=Function.prototype,t=/(?:^\(\s*(?:[^,.()]|\.(?!\.\.))*\s*\)\s*=>|^\s*[a-zA-Z$_][a-zA-Z0-9$_]*\s*=>)/;return n=>(n.length===0||n.length===1)&&t.test(e.call(n))})(),_e=l(e=>typeof e=="number","de"),We=l(e=>typeof e=="object"&&e!==null,"xe"),Ne=l(e=>e instanceof RegExp,"me"),Ve=(()=>{const e=/\\\(|\((?!\?(?::|=|!|<=|<!))/;return t=>e.test(t.source)})(),Be=(()=>{const e=/^[a-zA-Z0-9_-]+$/;return t=>e.test(t.source)&&!t.flags.includes("i")})(),ee=l(e=>typeof e=="string","A"),k=l(e=>e===void 0,"f"),Te=l(e=>{const t=new Map;return n=>{const s=t.get(n);if(s!==void 0)return s;const o=e(n);return t.set(n,o),o}},"ye"),te=l((e,t,n={})=>{const s={cache:{},input:e,index:0,indexBacktrackMax:0,options:n,output:[]},o=E(t)(s),c=Math.max(s.index,s.indexBacktrackMax);if(o&&s.index===e.length)return s.output;throw new Error(`Failed to parse at index ${c}`)},"I"),p=l((e,t)=>Y(e)?Ze(e,t):ee(e)?ne(e,t):Le(e,t),"i"),Ze=l((e,t)=>{const n={};for(const s of e){if(s.length!==1)throw new Error(`Invalid character: "${s}"`);const o=s.charCodeAt(0);n[o]=!0}return s=>{const o=s.input;let c=s.index,f=c;for(;f<o.length&&o.charCodeAt(f)in n;)f+=1;if(f>c){if(!k(t)&&!s.options.silent){const h=o.slice(c,f),v=_(t)?t(h,o,`${c}`):t;k(v)||s.output.push(v)}s.index=f}return!0}},"we"),Le=l((e,t)=>{if(Be(e))return ne(e.source,t);{const n=e.source,s=e.flags.replace(/y|$/,"y"),o=new RegExp(n,s);return Ve(e)&&_(t)&&!Ie(t)?Fe(o,t):qe(o,t)}},"$e"),Fe=l((e,t)=>n=>{const s=n.index,o=n.input;e.lastIndex=s;const c=e.exec(o);if(c){const f=e.lastIndex;if(!n.options.silent){const h=t(...c,o,`${s}`);k(h)||n.output.push(h)}return n.index=f,!0}else return!1},"Ee"),qe=l((e,t)=>n=>{const s=n.index,o=n.input;if(e.lastIndex=s,e.test(o)){const c=e.lastIndex;if(!k(t)&&!n.options.silent){const f=_(t)?t(o.slice(s,c),o,`${s}`):t;k(f)||n.output.push(f)}return n.index=c,!0}else return!1},"Ce"),ne=l((e,t)=>n=>{const s=n.index,o=n.input;if(o.startsWith(e,s)){if(!k(t)&&!n.options.silent){const c=_(t)?t(e,o,`${s}`):t;k(c)||n.output.push(c)}return n.index+=e.length,!0}else return!1},"F"),L=l((e,t,n,s)=>{const o=E(e),c=t>1;return q(F(oe(f=>{let h=0;for(;h<n;){const v=f.index;if(!o(f)||(h+=1,f.index===v))break}return h>=t},c),s))},"k"),re=l((e,t)=>L(e,0,1,t),"L"),T=l((e,t)=>L(e,0,1/0,t),"$"),Ue=l((e,t)=>L(e,1,1/0,t),"Re"),M=l((e,t)=>{const n=e.map(E);return q(F(oe(s=>{for(let o=0,c=n.length;o<c;o++)if(!n[o](s))return!1;return!0}),t))},"x"),y=l((e,t)=>{const n=e.map(E);return q(F(s=>{for(let o=0,c=n.length;o<c;o++)if(n[o](s))return!0;return!1},t))},"p"),oe=l((e,t=!0,n=!1)=>{const s=E(e);return t?o=>{const c=o.index,f=o.output.length,h=s(o);return!h&&!n&&(o.indexBacktrackMax=Math.max(o.indexBacktrackMax,o.index)),(!h||n)&&(o.index=c,o.output.length!==f&&(o.output.length=f)),h}:s},"q"),F=l((e,t)=>{const n=E(e);return t?s=>{if(s.options.silent)return n(s);const o=s.output.length;if(n(s)){const c=s.output.splice(o,1/0),f=t(c);return k(f)||s.output.push(f),!0}else return!1}:n},"B"),q=(()=>{let e=0;return t=>{const n=E(t),s=e+=1;return o=>{var c;if(o.options.memoization===!1)return n(o);const f=o.index,h=(c=o.cache)[s]||(c[s]={indexMax:-1,queue:[]}),v=h.queue;if(f<=h.indexMax){const V=h.store||(h.store=new Map);if(v.length){for(let z=0,Ht=v.length;z<Ht;z+=2){const Jt=v[z*2],Qt=v[z*2+1];V.set(Jt,Qt)}v.length=0}const j=V.get(f);if(j===!1)return!1;if(_e(j))return o.index=j,!0;if(j)return o.index=j.index,j.output?.length&&o.output.push(...j.output),!0}const N=o.output.length,Dt=n(o);if(h.indexMax=Math.max(h.indexMax,f),Dt){const V=o.index,j=o.output.length;if(j>N){const z=o.output.slice(N,j);v.push(f,{index:V,output:z})}else v.push(f,V);return!0}else return v.push(f,!1),!1}}})(),se=l(e=>{let t;return n=>(t||(t=E(e())),t(n))},"G"),E=Te(e=>{if(_(e))return Pe(e)?se(e):e;if(ee(e)||Ne(e))return p(e);if(Y(e))return M(e);if(We(e))return y(Object.values(e));throw new Error("Invalid rule")}),A=l(e=>e,"d"),Ke=l(e=>typeof e=="string","ke"),Ge=l(e=>{const t=new WeakMap,n=new WeakMap;return(s,o)=>{const c=o?.partial?n:t,f=c.get(s);if(f!==void 0)return f;const h=e(s,o);return c.set(s,h),h}},"Be"),De=l(e=>{const t={},n={};return(s,o)=>{const c=o?.partial?n:t;return c[s]??(c[s]=e(s,o))}},"Pe"),He=p(/\\./,A),Je=p(/./,A),Qe=p(/\*\*\*+/,"*"),Xe=p(/([^/{[(!])\*\*/,(e,t)=>`${t}*`),Ye=p(/(^|.)\*\*(?=[^*/)\]}])/,(e,t)=>`${t}*`),et=T(y([He,Qe,Xe,Ye,Je])),tt=et,nt=l(e=>te(e,tt,{memoization:!1}).join(""),"Ie"),rt=nt,ae="abcdefghijklmnopqrstuvwxyz",ot=l(e=>{let t="";for(;e>0;){const n=(e-1)%26;t=ae[n]+t,e=Math.floor((e-1)/26)}return t},"Le"),ie=l(e=>{let t=0;for(let n=0,s=e.length;n<s;n++)t=t*26+ae.indexOf(e[n])+1;return t},"V"),U=l((e,t)=>{if(t<e)return U(t,e);const n=[];for(;e<=t;)n.push(e++);return n},"b"),st=l((e,t,n)=>U(e,t).map(s=>String(s).padStart(n,"0")),"qe"),ue=l((e,t)=>U(ie(e),ie(t)).map(ot),"W"),$=l(e=>({partial:!1,regex:new RegExp(e,"s"),children:[]}),"c"),W=l(e=>({children:e}),"y"),S=(()=>{const e=l((t,n,s)=>{if(s.has(t))return;s.add(t);const{children:o}=t;if(!o.length)o.push(n);else for(let c=0,f=o.length;c<f;c++)e(o[c],n,s)},"e");return t=>{if(!t.length)return W([]);for(let n=t.length-1;n>=1;n--){const s=new Set,o=t[n-1],c=t[n];e(o,c,s)}return t[0]}})(),O=l(()=>({regex:new RegExp("[\\\\/]","s"),children:[]}),"g"),at=p(/\\./,$),it=p(/[$.*+?^(){}[\]\|]/,e=>$(`\\${e}`)),ut=p(/[\\\/]/,O),ct=p(/[^$.*+?^(){}[\]\|\\\/]+/,$),lt=p(/^(?:!!)*!(.*)$/,(e,t)=>$(`(?!^${xe.compile(t).source}$).*?`)),ft=p(/^(!!)+/),pt=y([lt,ft]),dt=p(/\/(\*\*\/)+/,()=>W([S([O(),$(".+?"),O()]),O()])),gt=p(/^(\*\*\/)+/,()=>W([$("^"),S([$(".*?"),O()])])),ht=p(/\/(\*\*)$/,()=>W([S([O(),$(".*?")]),$("$")])),xt=p(/\*\*/,()=>$(".*?")),ce=y([dt,gt,ht,xt]),mt=p(/\*\/(?!\*\*\/|\*$)/,()=>S([$("[^\\\\/]*?"),O()])),$t=p(/\*/,()=>$("[^\\\\/]*")),le=y([mt,$t]),fe=p("?",()=>$("[^\\\\/]")),vt=p("[",A),bt=p("]",A),wt=p(/[!^]/,"^\\\\/"),yt=p(/[a-z]-[a-z]|[0-9]-[0-9]/i,A),jt=p(/\\./,A),kt=p(/[$.*+?^(){}[\|]/,e=>`\\${e}`),Et=p(/[\\\/]/,"\\\\/"),Ot=p(/[^$.*+?^(){}[\]\|\\\/]+/,A),At=y([jt,kt,Et,yt,Ot]),pe=M([vt,re(wt),T(At),bt],e=>$(e.join(""))),Rt=p("{","(?:"),Ct=p("}",")"),Mt=p(/(\d+)\.\.(\d+)/,(e,t,n)=>st(+t,+n,Math.min(t.length,n.length)).join("|")),St=p(/([a-z]+)\.\.([a-z]+)/,(e,t,n)=>ue(t,n).join("|")),zt=p(/([A-Z]+)\.\.([A-Z]+)/,(e,t,n)=>ue(t.toLowerCase(),n.toLowerCase()).join("|").toUpperCase()),Pt=y([Mt,St,zt]),de=M([Rt,Pt,Ct],e=>$(e.join(""))),It=p("{"),_t=p("}"),Wt=p(","),Nt=p(/\\./,$),Vt=p(/[$.*+?^(){[\]\|]/,e=>$(`\\${e}`)),Bt=p(/[\\\/]/,O),Tt=p(/[^$.*+?^(){}[\]\|\\\/,]+/,$),Zt=se(()=>he),Lt=p("",()=>$("(?:)")),Ft=Ue(y([ce,le,fe,pe,de,Zt,Nt,Vt,Bt,Tt]),S),ge=y([Ft,Lt]),he=M([It,re(M([ge,T(M([Wt,ge]))])),_t],W),qt=T(y([pt,ce,le,fe,pe,de,he,at,it,ut,ct]),S),Ut=qt,Kt=l(e=>te(e,Ut,{memoization:!1})[0],"kr"),Gt=Kt,K=l((e,t,n)=>K.compile(e,n).test(t),"N");K.compile=(()=>{const e=De((n,s)=>Me(Gt(rt(n)),s)),t=Ge((n,s)=>ze(n.map(o=>e(o,s))));return(n,s)=>Ke(n)?e(n,s):t(n,s)})();var xe=K;return x(I)})();return r.default||r},"_lazyMatch"),G;const on=l((r,a)=>(G||(G=me(),me=null),G(r,a)),"default");var sn=Object.defineProperty,an=H((r,a)=>sn(r,"name",{value:a,configurable:!0}),"t$1");const un=/^[A-Z]:\//i,C=an((r="")=>r&&r.replaceAll("\\","/").replace(un,a=>a.toUpperCase()),"normalizeWindowsPath");var cn=Object.defineProperty,b=H((r,a)=>cn(r,"name",{value:a,configurable:!0}),"r");const ln=/^[/\\]{2}/,fn=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,be=/^[A-Z]:$/i,$e=/^\/([A-Z]:)?$/i,pn=/.(\.[^./]+)$/,dn=/^[/\\]|^[a-z]:[/\\]/i,gn=/\/$/,hn=/^win/i,xn=b(()=>typeof process.cwd=="function"?process.cwd().replaceAll("\\","/"):"/","cwd"),In="/",_n=hn.test(globalThis.process?.platform??"")?";":":",we=b((r,a)=>{let i="",u=0,g=-1,d=0,m;for(let x=0;x<=r.length;++x){if(x<r.length)m=r[x];else{if(m==="/")break;m="/"}if(m==="/"){if(!(g===x-1||d===1))if(d===2){if(i.length<2||u!==2||!i.endsWith(".")||i.at(-2)!=="."){if(i.length>2){const I=i.lastIndexOf("/");I===-1?(i="",u=0):(i=i.slice(0,I),u=i.length-1-i.lastIndexOf("/")),g=x,d=0;continue}else if(i.length>0){i="",u=0,g=x,d=0;continue}}a&&(i+=i.length>0?"/..":"..",u=2)}else i.length>0?i+=`/${r.slice(g+1,x)}`:i=r.slice(g+1,x),u=x-g-1;g=x,d=0}else m==="."&&d!==-1?++d:d=-1}return i},"normalizeString"),B=b(r=>fn.test(r),"isAbsolute"),ye=b(function(r){if(r.length===0)return".";r=C(r);const a=ln.exec(r),i=B(r),u=r.at(-1)==="/";return r=we(r,!i),r.length===0?i?"/":u?"./":".":(u&&(r+="/"),be.test(r)&&(r+="/"),a?i?`//${r}`:`//./${r}`:i&&!B(r)?`/${r}`:r)},"normalize"),Wn=b((...r)=>{let a="";for(const i of r)if(i)if(a.length>0){const u=a.at(-1)==="/",g=i[0]==="/";u&&g?a+=i.slice(1):a+=u||g?i:`/${i}`}else a+=i;return ye(a)},"join"),D=b(function(...r){r=r.map(u=>C(u));let a="",i=!1;for(let u=r.length-1;u>=-1&&!i;u--){const g=u>=0?r[u]:xn();!g||g.length===0||(a=`${g}/${a}`,i=B(g))}return a=we(a,!i),i&&!B(a)?`/${a}`:a.length>0?a:"."},"resolve");b(function(r){return C(r)},"toNamespacedPath");const mn=b(function(r){return pn.exec(C(r))?.[1]??""},"extname"),Nn=b(function(r,a){const i=D(r).replace($e,"$1").split("/"),u=D(a).replace($e,"$1").split("/");if(u[0][1]===":"&&i[0][1]===":"&&i[0]!==u[0])return u.join("/");const g=[...i];for(const d of g){if(u[0]!==d)break;i.shift(),u.shift()}return[...i.map(()=>".."),...u].join("/")},"relative"),$n=b(r=>{const a=C(r).replace(gn,"").split("/").slice(0,-1);return a.length===1&&be.test(a[0])&&(a[0]=`${a[0]}/`),a.join("/")||(B(r)?"/":".")},"dirname");b(function(r){const a=[r.root,r.dir,r.base??r.name+r.ext].filter(Boolean);return C(r.root?D(...a):a.join("/"))},"format");const vn=b((r,a)=>{const i=C(r).split("/").pop();return a&&i.endsWith(a)?i.slice(0,-a.length):i},"basename"),Vn=b(function(r){const a=dn.exec(r)?.[0]?.replaceAll("\\","/")??"",i=vn(r),u=mn(i);return{base:i,dir:$n(r),ext:u,name:i.slice(0,i.length-u.length),root:a}},"parse");b((r,a)=>on(a,ye(r)),"matchesGlob");var bn=Object.defineProperty,wn=w((r,a)=>bn(r,"name",{value:a,configurable:!0}),"s");class J extends Error{static{w(this,"VisConfigError")}static{wn(this,"VisConfigError")}chain;constructor(a,i,u){super(a,u),this.name=this.constructor.name,this.chain=i}}var yn=Object.defineProperty,jn=w((r,a)=>yn(r,"name",{value:a,configurable:!0}),"e");class Bn extends J{static{w(this,"VisConfigCycleError")}static{jn(this,"VisConfigCycleError")}constructor(a,i){const u=[...i,`${a} (re-enters)`].join(" → ");super(`Config cycle: ${u}`,i)}}var kn=Object.defineProperty,En=w((r,a)=>kn(r,"name",{value:a,configurable:!0}),"t$1");class Tn extends J{static{w(this,"VisConfigLoadError")}static{En(this,"VisConfigLoadError")}constructor(a,i,u){const g=u instanceof Error?u.message:String(u),d=i.length>0?`
2
- Chain: ${i.join(" → ")}`:"";super(`Failed to load ${a}: ${g}${d}`,i,{cause:u})}}var On=Object.defineProperty,je=w((r,a)=>On(r,"name",{value:a,configurable:!0}),"t");const An=je(r=>r.join(" → "),"formatChain");class Zn extends J{static{w(this,"VisConfigNotFoundError")}static{je(this,"VisConfigNotFoundError")}constructor(a,i,u){const g=i.length>0?i[i.length-1]:"<unknown>",d=u.length>0?`
3
- Tried:
4
- ${u.join(`
5
- `)}`:"";super(`Cannot resolve "${a}" extended from ${g}.${d}
6
- Chain: ${An(i)}`,i)}}var Rn=Object.defineProperty,ke=w((r,a)=>Rn(r,"name",{value:a,configurable:!0}),"i$1");const ve="@inherit",Cn=["aliases","dependsOn","inputs","outputs"],Mn=ke((r,a)=>{if(a===void 0)return r===void 0?void 0:[...r];if(!a.includes(ve))return[...a];const i=[];for(const u of a){if(u===ve){r!==void 0&&i.push(...r);continue}i.push(u)}return i},"mergeArrayWithInherit"),Ln=ke((r,a)=>{const i={...r,...a};for(const u of Cn){const g=r?.[u],d=a?.[u],m=Mn(g,d);m===void 0?delete i[u]:i[u]=m}return i},"mergeTargetWithInherit");var R;(function(r){r[r.UNSET=0]="UNSET",r[r.OK=1]="OK",r[r.ERROR=2]="ERROR"})(R||(R={}));var Sn=Object.defineProperty,P=w((r,a)=>Sn(r,"name",{value:a,configurable:!0}),"i");const Fn=P(r=>{const{renameSpan:a,tracer:i}=r;let u;const g=new Map;return Yt({hooks:{"run:after":P(d=>{if(!u)return;const m=[...d.values()].filter(x=>x.status==="failure").length;u.setAttribute("vis.run.tasks_total",d.size),u.setAttribute("vis.run.tasks_failed",m),m>0?u.setStatus({code:R.ERROR,message:`${String(m)} task(s) failed`}):u.setStatus({code:R.OK}),u.end(),u=void 0;for(const x of g.values())x.end();g.clear()},"run:after"),"run:before":P(d=>{u&&(u.setStatus({code:R.ERROR,message:"run:before fired while previous run was still active"}),u.end());for(const m of g.values())m.end();g.clear(),u=i.startSpan("vis.run",{attributes:{"vis.run.task_count":d.tasks.length,"vis.workspace_root":d.workspaceRoot}})},"run:before"),"task:after":P((d,m)=>{const x=g.get(d.id);x&&(x.setAttribute("vis.task.exit_code",m.code??0),x.setAttribute("vis.task.cache_status",m.status),x.end(),g.delete(d.id))},"task:after"),"task:before":P(d=>{const m=g.get(d.id);m&&(m.setStatus({code:R.ERROR,message:"retried — superseded by new attempt"}),m.end());const x=i.startSpan(a?a(d):d.id,{attributes:{"vis.task.id":d.id,"vis.task.project":d.target.project,"vis.task.target":d.target.target}});g.set(d.id,x)},"task:before"),"task:failure":P((d,m)=>{const x=g.get(d.id);x&&x.setStatus({code:R.ERROR,message:`Task failed with exit code ${String(m.code??-1)}`})},"task:failure")},name:"otel"})},"otelPlugin");export{D as C,$n as K,Wn as M,B as O,vn as Q,Bn as V,Tn as a,Zn as b,Vn as c,_n as j,Ln as m,Fn as o,In as y,Nn as z};
@@ -1 +0,0 @@
1
- var T=Object.defineProperty;var j=(n,e)=>T(n,"name",{value:e,configurable:!0});import{createRequire as A}from"node:module";import{findUp as R,findUpSync as U}from"@visulima/fs";const B=A(import.meta.url),h=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,q=j(n=>{if(typeof h<"u"&&h.versions&&h.versions.node){const[e,t]=h.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return h.getBuiltinModule(n)}return B(n)},"__cjs_getBuiltinModule"),{createRequire:N}=q("node:module");var C=Object.defineProperty,z=j((n,e)=>C(n,"name",{value:e,configurable:!0}),"L"),I=Object.defineProperty,S=z((n,e)=>I(n,"name",{value:e,configurable:!0}),"F");const J=N(import.meta.url),y=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$=S(n=>{if(typeof y<"u"&&y.versions&&y.versions.node){const[e,t]=y.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return y.getBuiltinModule(n)}return J(n)},"__cjs_getBuiltinModule"),{readFileSync:Y}=$("node:fs"),{readFile:Z}=$("node:fs/promises");var K=Object.defineProperty,l=S((n,e)=>K(n,"name",{value:e,configurable:!0}),"g");const G={sha256:"sha256",sha384:"sha384",sha512:"sha512"},H=1024,Q=/^[A-Z0-9+/]+={0,2}$/i,V=/.*node_modules\/((?:@[^/]+\/)?[^/]+)$/,k=/^['"]/,v=/['"]$/,X=/^[a-z][a-zA-Z0-9]*:\s*$/m,ee=/resolution:\s*\{[^}]*integrity:\s*([^,}\s]+)/,ne=/^["']?((?:@[^/@"']+\/)?[^@"'\n]+)@[^"'\n]+["']?:?[\t\v\f\r \u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*\n((?:[\t ][^\n]*\n?)+)/gm,te=/^\s+version:?\s+"?([^"\n]+)"?/m,se=/^\s+integrity[\s:]+"?([^"\s]+)"?/m,x=l(n=>{if(n.length>H)return;const e=n.indexOf("-");if(e<=0)return;const t=G[n.slice(0,e).toLowerCase()];if(!t)return;const s=n.slice(e+1);if(Q.test(s))try{const i=Buffer.from(s,"base64");return i.length===0?void 0:{algorithm:t,hex:i.toString("hex")}}catch{return}},"decodeSriIntegrity"),w=l((n,e,t)=>{const s=`${t.name}@${t.version}`;e.has(s)||(e.add(s),n.push(t))},"pushUniqueEntry"),m=l((n,e,t)=>{t&&Object.keys(t).length>0&&(n[e]={...t})},"copyDepMap"),g=l(n=>{if(!n)return;const e={};for(const[t,s]of Object.entries(n))e[t]=[s];return Object.keys(e).length>0?e:void 0},"liftDepMap"),re=l(n=>{const e=[],t=new Set;let s;try{s=JSON.parse(n)}catch{return e}if(!s.packages)return e;for(const[i,r]of Object.entries(s.packages)){if(!i||!r.version)continue;const p=V.exec(i);if(!p?.[1])continue;const c=r.name??p[1];if(c.startsWith("."))continue;const o={name:c,version:r.version};if(r.integrity){const a=x(r.integrity);a&&(o.integrity=a)}m(o,"dependencies",g(r.dependencies)),m(o,"peerDependencies",g(r.peerDependencies)),m(o,"optionalDependencies",g(r.optionalDependencies)),w(e,t,o)}return e},"parseNpmLockFile"),_=l(n=>{let e=n.trim();e.startsWith("/")&&(e=e.slice(1)),e=e.replace(k,"").replace(v,"");const t=e.indexOf("(");t>0&&(e=e.slice(0,t));const s=e.lastIndexOf("@");if(s<=0)return;const i=e.slice(0,s),r=e.slice(s+1);if(!(!i||!r||r.startsWith("link:")||r.startsWith("workspace:")||r.startsWith("file:")))return{name:i,version:r}},"splitPnpmPackageKey"),W=l((n,e)=>{const t=new RegExp(String.raw`^${e}:\s*$`,"m").exec(n);if(!t)return;const s=t.index+t[0].length,i=X.exec(n.slice(s));return n.slice(s,i?s+i.index:n.length)},"sliceTopLevelSection"),oe=l(n=>{const e=new Map,t=W(n,"snapshots");if(!t)return e;const s=/^ {2}(['"]?[^\s:][^:\n]*?['"]?):\s*\n((?: {4}[^\n]*\n?)+)/gm;let i;for(;(i=s.exec(t)??void 0)!==void 0;){const r=_(i[1]);if(!r)continue;const p=`${r.name}@${r.version}`,c=i[2],o=e.get(p)??{};for(const a of["dependencies","peerDependencies","optionalDependencies"]){const u=b(c,a);if(!u)continue;const d=o[a]??{};for(const[f,P]of Object.entries(u)){const D=d[f]??[];for(const F of P)D.includes(F)||D.push(F);d[f]=D}o[a]=d}e.set(p,o)}return e},"parsePnpmSnapshotEdges"),ie=l(n=>{const e=[],t=new Set,s=W(n,"packages");if(!s)return e;const i=oe(n),r=/^ {2}(['"]?[^\s:][^:\n]*?['"]?):\s*\n((?: {4}[^\n]*\n?)+)/gm;let p;for(;(p=r.exec(s)??void 0)!==void 0;){const c=_(p[1]);if(!c)continue;const o=p[2],a=ee.exec(o),u={name:c.name,version:c.version};if(a?.[1]){const f=x(a[1]);f&&(u.integrity=f)}const d=i.get(`${c.name}@${c.version}`);m(u,"dependencies",d?.dependencies??b(o,"dependencies")),m(u,"peerDependencies",d?.peerDependencies??b(o,"peerDependencies")),m(u,"optionalDependencies",d?.optionalDependencies??b(o,"optionalDependencies")),w(e,t,u)}return e},"parsePnpmLockFile"),b=l((n,e)=>{const t=new RegExp(String.raw`^ {4}${e}:\s*\n((?: {6,}[^\n]*\n?)+)`,"m").exec(n);if(!t?.[1])return;const s={},i=/^ {6}([^\s:]+):\s*([^\n]+)/gm;let r;for(;(r=i.exec(t[1])??void 0)!==void 0;){const p=r[1].replace(k,"").replace(v,"");let c=r[2].trim();c=c.replace(k,"").replace(v,"");const o=c.indexOf("(");if(o>0&&(c=c.slice(0,o).trim()),!p||!c)continue;const a=s[p]??[];a.includes(c)||a.push(c),s[p]=a}return Object.keys(s).length>0?s:void 0},"extractPnpmDependencyMap"),ce=l(n=>{const e=[],t=new Set,s=ne;s.lastIndex=0;let i;for(;(i=s.exec(n)??void 0)!==void 0;){const r=i[1].replace(k,"").replace(v,"");if(!r)continue;const p=i[2],c=te.exec(p);if(!c?.[1])continue;const o={name:r,version:c[1].trim()},a=se.exec(p);if(a?.[1]){const u=x(a[1]);u&&(o.integrity=u)}m(o,"dependencies",O(p,"dependencies")),m(o,"peerDependencies",O(p,"peerDependencies")),m(o,"optionalDependencies",O(p,"optionalDependencies")),w(e,t,o)}return e},"parseYarnLockFile"),O=l((n,e)=>{const t=new RegExp(String.raw`^ {2}${e}:\s*\n((?: {4,}[^\n]*\n?)+)`,"m").exec(n);if(!t?.[1])return;const s={},i=/^ {4}(['"]?[^\s:'"]+['"]?)\s*(?::\s*)?['"]([^'"\n]+)['"]/gm;let r;for(;(r=i.exec(t[1])??void 0)!==void 0;){const p=r[1].replace(k,"").replace(v,""),c=r[2];if(p&&c){const o=s[p]??[];o.includes(c)||o.push(c),s[p]=o}}return Object.keys(s).length>0?s:void 0},"extractYarnDependencyMap"),pe=/,(?=\s*[}\]])/g,ae=l(n=>{const e=[],t=new Set;let s;try{s=JSON.parse(n.replaceAll(pe,""))}catch{return e}if(!s.packages)return e;for(const i of Object.values(s.packages)){const r=i[0];if(typeof r!="string")continue;const p=r.indexOf("@",1);if(p<=0)continue;const c=r.slice(0,p),o=r.slice(p+1);if(!c||!o||o.startsWith("workspace:")||o.startsWith("link:")||o.startsWith("file:"))continue;const a={name:c,version:o},u=i[3];if(typeof u=="string"&&u.length>0){const f=x(u);f&&(a.integrity=f)}const d=i[2];if(d&&typeof d=="object"&&!Array.isArray(d)){const f=d;m(a,"dependencies",g(f.dependencies)),m(a,"peerDependencies",g(f.peerDependencies)),m(a,"optionalDependencies",g(f.optionalDependencies))}w(e,t,a)}return e},"parseBunLockFile"),E=l(n=>{if(n.endsWith("pnpm-lock.yaml"))return"pnpm";if(n.endsWith("package-lock.json"))return"npm";if(n.endsWith("yarn.lock"))return"yarn";if(n.endsWith("bun.lock"))return"bun"},"inferLockFileType"),L=l((n,e)=>{switch(e){case"bun":return ae(n);case"npm":return re(n);case"pnpm":return ie(n);case"yarn":return ce(n);default:return[]}},"parseLockFileContent"),M=["pnpm-lock.yaml","package-lock.json","yarn.lock","bun.lock"];l(async n=>{const e=await R(M,{type:"file",...n&&{cwd:n}});if(!e)throw new Error("Could not find a supported lock file (pnpm-lock.yaml, package-lock.json, yarn.lock, bun.lock)");const t=E(e);if(!t)throw new Error(`Unsupported lock file: ${e}`);const s=await Z(e,"utf8");return{entries:L(s,t),path:e,type:t}},"parseLockFile");l(n=>{const e=U(M,{type:"file",...n&&{cwd:n}});if(!e)throw new Error("Could not find a supported lock file (pnpm-lock.yaml, package-lock.json, yarn.lock, bun.lock)");const t=E(e);if(!t)throw new Error(`Unsupported lock file: ${e}`);return{entries:L(Y(e,"utf8"),t),path:e,type:t}},"parseLockFileSync");export{L as F};
@@ -1 +0,0 @@
1
- import"../packem_chunks/applyDefaults.js";import{o as e}from"./index-OlP7U_t5.js";export{e as otelPlugin};
@@ -1,2 +0,0 @@
1
- var b=Object.defineProperty;var c=(e,t)=>b(e,"name",{value:t,configurable:!0});import{createRequire as D}from"node:module";import{ensureDir as L,isAccessible as x,readJson as m}from"@visulima/fs";import{M as l}from"./index-OlP7U_t5.js";import{aj as I}from"../packem_chunks/bin.js";const R=D(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,p=c(e=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[t,r]=u.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return u.getBuiltinModule(e)}return R(e)},"__cjs_getBuiltinModule"),{Socket:T}=p("node:net"),{randomBytes:k}=p("node:crypto"),{readdir:M,writeFile:$,rename:j,rm:d,open:P,readFile:A,stat:F,unlink:y}=p("node:fs/promises");var N=Object.defineProperty,o=c((e,t)=>N(e,"name",{value:t,configurable:!0}),"s");const O=3e4,v=100;class q extends Error{static{c(this,"ServiceReadinessError")}constructor(t,r){super(t),this.elapsedMs=r,this.name="ServiceReadinessError"}elapsedMs;static{o(this,"ServiceReadinessError")}}const C=o(async e=>{const t=e.host??"127.0.0.1",{port:r}=e,s=e.timeoutMs??O,i=Date.now();for(;Date.now()-i<s;){if(await B(t,r))return;await J(v)}throw new q(`Timed out waiting for ${t}:${String(r)} to accept TCP connections (${String(s)}ms)`,Date.now()-i)},"waitForTcp"),B=o((e,t)=>new Promise(r=>{const s=new T,i=o(n=>{s.removeAllListeners(),s.destroy(),r(n)},"onDone");s.once("connect",()=>{i(!0)}),s.once("error",()=>{i(!1)}),s.setTimeout(v,()=>{i(!1)});try{s.connect(t,e)}catch{i(!1)}}),"tryConnect"),J=o(e=>new Promise(t=>{setTimeout(t,e)}),"delay"),it=o(async(e,t)=>{const r=e.readiness??(e.port===void 0?void 0:{tcp:{port:e.port}});r&&await C({host:r.tcp.host,port:r.tcp.port,timeoutMs:t?.timeoutMs??r.tcp.timeoutMs})},"runReadiness");var W=Object.defineProperty,a=c((e,t)=>W(e,"name",{value:t,configurable:!0}),"o");const g=384,h=5e3,G=50,V=3e4,w=a(async e=>{const t=l(I(e),"services");try{await L(t)}catch(r){throw r.code==="ENOTDIR"?new Error(`Service registry path ${t} exists but is not a directory. Remove it or move the conflicting file before running \`vis service\`.`,{cause:r}):r}return t},"getRegistryDir"),E=a(e=>e.replaceAll("/","_").replaceAll(":","__"),"slugify"),f=a((e,t)=>l(e,`${E(t)}.json`),"entryPath"),X=a((e,t)=>l(e,`${E(t)}.lock`),"lockPath"),_=a(async(e,t)=>{const r=await w(e),s=f(r,t);if(await x(s))try{return await m(s)}catch{return}},"readEntry"),Y=a(async e=>{const t=await w(e);let r;try{r=await M(t)}catch{return[]}const s=[];for(const i of r)if(i.endsWith(".json"))try{const n=await m(l(t,i));s.push(n)}catch{}return s},"readAllEntries"),st=a(async(e,t)=>{const r=await w(e),s=f(r,t.id),i=l(r,`.${k(8).toString("hex")}.tmp`);await $(i,`${JSON.stringify(t,void 0,2)}
2
- `,{mode:g});try{await j(i,s)}catch(n){throw await d(i,{force:!0}).catch(()=>{}),n}},"writeEntry"),z=a(async(e,t,r)=>{const s=await w(e),i=r??await _(e,t);await d(f(s,t),{force:!0}),i&&await d(i.logFile,{force:!0}).catch(()=>{})},"deleteEntry"),S=a(e=>{try{return process.kill(e,0),!0}catch{return!1}},"isAlive"),at=a(async e=>{const t=await Y(e),r=[],s=[];for(const i of t){if(S(i.pid)){s.push(i);continue}const n=await _(e,i.id);if(n&&n.pid!==i.pid){s.push(n);continue}await z(e,i.id,i).catch(()=>{}),r.push(i.id)}return{pruned:r,surviving:s}},"pruneDead"),H=a(e=>new Promise(t=>{setTimeout(t,e)}),"sleep"),K=a(async e=>{try{const t=await P(e,"wx",g);try{await t.writeFile(String(process.pid))}finally{await t.close().catch(()=>{})}return!0}catch(t){if(t.code==="EEXIST")return!1;throw t}},"tryClaimLock"),Q=a(async e=>{let t;try{const r=await A(e,"utf8"),s=Number.parseInt(r.trim(),10);t=Number.isFinite(s)?s:void 0}catch{return!0}if(t!==void 0&&!S(t))return!0;try{const r=await F(e);return Date.now()-r.mtimeMs>V}catch{return!0}},"isLockStale"),nt=a(async(e,t,r)=>{const s=await w(e),i=X(s,t),n=Date.now();for(;!await K(i);){if(await Q(i)){await y(i).catch(()=>{});continue}if(Date.now()-n>=h)throw new Error(`Could not acquire service lock for ${t} within ${String(h)}ms — another \`vis service\` invocation appears to be holding it.`);await H(G)}try{return await r()}finally{await y(i).catch(()=>{})}},"withServiceLock");export{g as R,q as S,st as a,it as b,Y as c,z as d,w as g,S as i,at as p,_ as r,E as s,nt as w};
@@ -1 +0,0 @@
1
- var y=Object.defineProperty;var d=(e,s)=>y(e,"name",{value:s,configurable:!0});import{createRequire as j}from"node:module";import{M as m}from"./index-OlP7U_t5.js";const M=j(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_=d(e=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[s,t]=u.versions.node.split(".").map(Number);if(s>22||s===22&&t>=3||s===20&&t>=16)return u.getBuiltinModule(e)}return M(e)},"__cjs_getBuiltinModule"),{readdir:p,stat:l,readFile:h}=_("node:fs/promises");var k=Object.defineProperty,c=d((e,s)=>k(e,"name",{value:s,configurable:!0}),"m");const b=c((e,s)=>e.tasks.find(t=>t.taskId===s),"findTaskInSummary"),f=c((e,s)=>{const t=e??{},i=s??{},n=[],r=[],a=[];for(const o of Object.keys(t))o in i?t[o]!==i[o]&&a.push(o):n.push(o);for(const o of Object.keys(i))o in t||r.push(o);return n.sort(),r.sort(),a.sort(),{added:n,changed:a,removed:r}},"diffHashBuckets"),R=c((e,s)=>({commandChanged:(e?.command??"")!==(s?.command??""),implicitDeps:f(e?.implicitDeps,s?.implicitDeps),nodes:f(e?.nodes,s?.nodes),runtime:f(e?.runtime,s?.runtime)}),"diffHashDetails"),w=c(async(e,s)=>{const t=m(e,".task-runner","runs",`${s}.json`);try{const i=await h(t,"utf8");return JSON.parse(i)}catch{return}},"readRunSummaryById"),B=c(async(e,s)=>{const t=m(e,".task-runner","runs");let i;try{i=await p(t)}catch{return}const n=[];for(const r of i){if(!r.endsWith(".json")||s!==void 0&&r===`${s}.json`)continue;const a=m(t,r);try{const o=await l(a);o.isFile()&&n.push({mtimeMs:o.mtimeMs,path:a})}catch{}}if(n.length!==0){n.sort((r,a)=>a.mtimeMs-r.mtimeMs);try{const r=await h(n[0].path,"utf8");return JSON.parse(r)}catch{return}}},"readPreviousRunSummary"),D=c(async e=>{const s=m(e,".task-runner","runs");let t;try{t=await p(s)}catch{return[]}const i=[];for(const n of t){if(!n.endsWith(".json"))continue;const r=m(s,n);try{const a=await l(r);a.isFile()&&i.push({id:n.slice(0,-5),mtimeMs:a.mtimeMs,path:r})}catch{}}return i.sort((n,r)=>r.mtimeMs-n.mtimeMs),i},"listRunSummaries");export{B as a,R as d,b as f,D as l,w as r};