@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.
- package/CHANGELOG.md +17 -0
- package/LICENSE.md +936 -1
- package/dist/bin.js +1 -1
- package/dist/config/index.js +1 -1
- package/dist/packem_chunks/applyDefaults.js +2 -2
- package/dist/packem_chunks/bin.js +314 -311
- package/dist/packem_chunks/fix.js +1 -1
- package/dist/packem_chunks/handler.js +1 -1
- package/dist/packem_chunks/handler10.js +1 -1
- package/dist/packem_chunks/handler12.js +5 -5
- package/dist/packem_chunks/handler14.js +3 -3
- package/dist/packem_chunks/handler15.js +1 -1
- package/dist/packem_chunks/handler18.js +1 -1
- package/dist/packem_chunks/handler19.js +1 -1
- package/dist/packem_chunks/handler2.js +1 -1
- package/dist/packem_chunks/handler20.js +1 -1
- package/dist/packem_chunks/handler22.js +1 -1
- package/dist/packem_chunks/handler23.js +1 -1
- package/dist/packem_chunks/handler24.js +1 -1
- package/dist/packem_chunks/handler25.js +1 -1
- package/dist/packem_chunks/handler26.js +1 -1
- package/dist/packem_chunks/handler27.js +2 -2
- package/dist/packem_chunks/handler28.js +7 -7
- package/dist/packem_chunks/handler3.js +1 -1
- package/dist/packem_chunks/handler30.js +10 -10
- package/dist/packem_chunks/handler31.js +1 -1
- package/dist/packem_chunks/handler32.js +1 -1
- package/dist/packem_chunks/handler33.js +21 -21
- package/dist/packem_chunks/handler34.js +2 -2
- package/dist/packem_chunks/handler35.js +3 -3
- package/dist/packem_chunks/handler36.js +20 -20
- package/dist/packem_chunks/handler37.js +1 -1
- package/dist/packem_chunks/handler38.js +2 -2
- package/dist/packem_chunks/handler39.js +10 -10
- package/dist/packem_chunks/handler40.js +5 -5
- package/dist/packem_chunks/handler41.js +10 -24
- package/dist/packem_chunks/handler42.js +24 -10
- package/dist/packem_chunks/handler43.js +5 -5
- package/dist/packem_chunks/handler44.js +5 -5
- package/dist/packem_chunks/handler45.js +3 -3
- package/dist/packem_chunks/handler46.js +11 -11
- package/dist/packem_chunks/handler47.js +15 -15
- package/dist/packem_chunks/handler48.js +6 -6
- package/dist/packem_chunks/handler5.js +1 -1
- package/dist/packem_chunks/handler6.js +1 -1
- package/dist/packem_chunks/handler7.js +1 -1
- package/dist/packem_chunks/heal-accept.js +1 -1
- package/dist/packem_chunks/heal.js +1 -1
- package/dist/packem_chunks/help-command.js +1 -1
- package/dist/packem_chunks/index.js +2 -2
- package/dist/packem_chunks/loader.js +1 -1
- package/dist/packem_chunks/tar.js +1 -1
- package/dist/packem_shared/{ai-analysis-Dzs_nUwM.js → ai-analysis-CGVjqwdc.js} +1 -1
- package/dist/packem_shared/ai-cache-BdPgSfg2.js +1 -0
- package/dist/packem_shared/{ai-fix-BmLM72GS.js → ai-fix-iHtGLkJS.js} +1 -1
- package/dist/packem_shared/cache-directory-DTfMSzT9.js +1 -0
- package/dist/packem_shared/dependency-scan-SQeRzrpJ.js +2 -0
- package/dist/packem_shared/docker-D5p9mRPU.js +2 -0
- package/dist/packem_shared/failure-log-CElcbnb9.js +2 -0
- package/dist/packem_shared/flakiness-C4t4_NoA.js +1 -0
- package/dist/packem_shared/{giget-BX2ixMoa.js → giget-CcEy_Elm.js} +2 -2
- package/dist/packem_shared/lockfile-B7JJzxnL.js +1 -0
- package/dist/packem_shared/otel-CO8UEfTa.js +17 -0
- package/dist/packem_shared/otelPlugin-DTynZDWh.js +1 -0
- package/dist/packem_shared/readTomlSync-1fKo0R52-DAKNI1Me.js +109 -0
- package/dist/packem_shared/registry-D04iOQ5H.js +2 -0
- package/dist/packem_shared/run-summary-utils-BPraMTcm.js +1 -0
- package/dist/packem_shared/{runtime-check-BaKni2y1.js → runtime-check-l4qFpo08.js} +1 -1
- package/dist/packem_shared/{selectors-BvtUXWGY.js → selectors-Sem2CTYA.js} +1 -1
- package/dist/packem_shared/{toolchain-B7sIiJxK.js → toolchain-BhZNts--.js} +3 -3
- package/dist/packem_shared/typosquats-Dr7VIL2B.js +1 -0
- package/dist/packem_shared/verify-C6NNOhTA.js +1 -0
- package/dist/packem_shared/{vis-update-app-DR8c4OfG.js → vis-update-app-DGiMc5kb.js} +1 -1
- package/package.json +10 -12
- package/dist/packem_shared/ai-cache-Dtvmbsru.js +0 -1
- package/dist/packem_shared/cache-directory-xASJia6M.js +0 -1
- package/dist/packem_shared/dependency-scan-DmwPKwLy.js +0 -2
- package/dist/packem_shared/docker-CA-scYu0.js +0 -2
- package/dist/packem_shared/failure-log-fD4DiFb1.js +0 -2
- package/dist/packem_shared/flakiness-BIg1rwvp.js +0 -1
- package/dist/packem_shared/index-OlP7U_t5.js +0 -6
- package/dist/packem_shared/lockfile-BXylopgH.js +0 -1
- package/dist/packem_shared/otelPlugin-y5hoCw4b.js +0 -1
- package/dist/packem_shared/registry-BHqKXiLb.js +0 -2
- package/dist/packem_shared/run-summary-utils-D39XBHWW.js +0 -1
- package/dist/packem_shared/typosquats-XkC1CnOa.js +0 -1
- package/dist/packem_shared/verify-BVTcVfoW.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
var C=Object.defineProperty;var T=(e,t)=>C(e,"name",{value:t,configurable:!0});import{z as S}from"../packem_shared/
|
|
1
|
+
var C=Object.defineProperty;var T=(e,t)=>C(e,"name",{value:t,configurable:!0});import{z as S}from"../packem_shared/otel-CO8UEfTa.js";import{a7 as q,y as b}from"./bin.js";import{f as $}from"../packem_shared/selectors-Sem2CTYA.js";import{o as L}from"../packem_shared/index-DH-5hsrC.js";var M=Object.defineProperty,I=T((e,t)=>M(e,"name",{value:t,configurable:!0}),"p");const D=I((e,t)=>{for(const f of t)if(L(f,e))return!0;return!1},"matchesAny"),z=I((e,t={})=>{const{depTypes:f,excludePatterns:l,externalOnly:y,includePatterns:d,internalOnly:j}=t;if(j&&y)return[];const u=f&&f.length>0?new Set(f):void 0,N=d&&d.length>0?d:void 0,O=l&&l.length>0?l:void 0,w=[];for(const m of e)j&&!m.isInternal||y&&m.isInternal||u&&!u.has(m.depType)||N&&(!m.packageName||!D(m.packageName,N))||O&&m.packageName&&D(m.packageName,O)||w.push(m);return w},"filterDepInstances");var B=Object.defineProperty,v=T((e,t)=>B(e,"name",{value:t,configurable:!0}),"y");const F=new Set(["json","ndjson","table"]),R=v(e=>{if(e===void 0)return"table";const t=e.toLowerCase();if(!F.has(t))throw new Error(`--format must be one of: table, json, ndjson (got "${e}")`);return t},"resolveFormat"),x=v((e,t)=>({depName:e.depName,depType:e.depType,isInternal:e.isInternal,packageDir:e.packageDir,packageJsonPath:S(t,e.packageJsonPath),packageName:e.packageName,specifier:e.specifier}),"toDepRecord"),P=new Set(["dependencies","devDependencies","optionalDependencies","overrides","peerDependencies","pnpm.overrides","resolutions"]),V=v(e=>{if(!e||e.length===0)return;const t=[],f=[];for(const l of e)for(const y of l.split(",")){const d=y.trim();d&&(P.has(d)?t.push(d):f.push(d))}if(f.length>0)throw new Error(`Unknown --dep-type value(s): ${f.join(", ")}. Valid: ${[...P].join(", ")}`);return t.length>0?t:void 0},"parseDepTypes"),H=v(async({logger:e,options:t,visConfig:f,workspaceRoot:l})=>{if(!l)throw new Error("Could not determine workspace root.");const y=R(t.format);if(t.deps===!0){if(t.internalOnly&&t.externalOnly)throw new Error("--internal-only and --external-only are mutually exclusive");const c=V(t.depType),i=q(l);let n=z(i,{depTypes:c,excludePatterns:t.exclude,externalOnly:t.externalOnly,includePatterns:t.include,internalOnly:t.internalOnly});if(t.query){const{workspace:r}=b(l,f),p=new Set($(Object.keys(r.projects),r,t.query));n=n.filter(k=>k.packageName!==void 0&&p.has(k.packageName))}const g=[...n].sort((r,p)=>{const k=`${r.packageName??r.packageDir} ${r.depType} ${r.depName}`,J=`${p.packageName??p.packageDir} ${p.depType} ${p.depName}`;return k.localeCompare(J)});if(y==="ndjson"){for(const r of g)e.info(JSON.stringify(x(r,l)));return}if(y==="json"){const r=g.map(p=>x(p,l));e.info(JSON.stringify(r,null,t.pretty===!0?2:void 0));return}if(g.length===0){e.info("No matching dep-instances.");return}const a=["Package","Block","Dep","Specifier","Internal","Path"],o=g.map(r=>[r.packageName??r.packageDir,r.depType,r.depName,r.specifier,r.isInternal?"yes":"no",S(l,r.packageJsonPath)]),s=a.map((r,p)=>Math.max(r.length,...o.map(k=>(k[p]??"").length))),h=v((r,p)=>r.padEnd(p),"pad");e.info(a.map((r,p)=>h(r,s[p])).join(" ")),e.info(s.map(r=>"─".repeat(r)).join("──"));for(const r of o)e.info(r.map((p,k)=>h(p,s[k])).join(" "));e.info(""),e.info(`${String(g.length)} dep-instance(s)`);return}if(y==="ndjson")throw new Error("--format=ndjson is only supported with --deps");const{projectOptions:d,workspace:j}=b(l,f);let u=Object.keys(j.projects).sort();if(t.query&&(u=$(u,j,t.query)),u.length===0){e.info("No projects found.");return}const N=t.inferred===!0,O=t.targets===!0||N;if(y==="json"){const c=u.map(i=>{const n=j.projects[i],g=d.get(i)??{},a=Object.entries(n.targets??{}).map(([o])=>{const s=g[o],h=s?.inferred===!0;return{aliases:s?.aliases??[],command:s?.command,description:s?.description,...h?{inferred:!0}:{},name:o,type:s?.type}}).filter(o=>!N||o.inferred===!0);return{language:n.language,layer:n.layer,name:i,root:n.root,stack:n.stack,tags:n.tags??[],targets:a,type:n.projectType??"library"}});e.info(JSON.stringify(c,null,2));return}const w=v((c,i)=>{const n=c.map((a,o)=>{let s=0;for(const h of i)s=Math.max(s,(h[o]??"").length);return Math.max(a.length,s)}),g=v((a,o)=>a.padEnd(o),"pad");e.info(c.map((a,o)=>g(a,n[o])).join(" ")),e.info(n.map(a=>"─".repeat(a)).join("──"));for(const a of i)e.info(a.map((o,s)=>g(o,n[s])).join(" "))},"renderTable");if(O){const c=[];for(const i of u){const n=j.projects[i],g=d.get(i)??{};for(const a of Object.keys(n.targets??{}).sort()){const o=g[a],s=o?.inferred===!0;if(N&&!s)continue;const h=n.targets?.[a],r=h?.cache===!1?"no":h?.cache===!0?"yes":"default";c.push([i,a,o?.type??"—",r,s?"yes":"no",o?.description??"—"])}}if(c.length===0){e.info(N?"No inferred targets found.":"No targets found.");return}w(["Project","Target","Type","Cache","Inferred","Description"],c),e.info(""),e.info(`${String(c.length)} target(s) across ${String(u.length)} project(s)`);return}const m=["Project","Type","Layer","Tags","Targets"],E=u.map(c=>{const i=j.projects[c],n=Object.keys(i.targets??{});return[c,i.projectType??"library",i.layer??"—",(i.tags??[]).join(", ")||"—",n.length>4?`${n.slice(0,4).join(", ")}… (${String(n.length)})`:n.join(", ")||"—"]});w(m,E),e.info(""),e.info(`${String(u.length)} project(s)`)},"execute");export{H as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var d=Object.defineProperty;var p=(o,r)=>d(o,"name",{value:r,configurable:!0});import{createRequire as l}from"node:module";import{
|
|
1
|
+
var d=Object.defineProperty;var p=(o,r)=>d(o,"name",{value:r,configurable:!0});import{createRequire as l}from"node:module";import{a8 as R,a9 as E,aa as w,ab as s,ac as k,ad as v,ae as x,af as C,ag as b,ah as M,ai as h,aj as I,ak as _,al as S}from"./bin.js";import{v as N}from"../packem_shared/verify-C6NNOhTA.js";const m=l(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,y=p(o=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[r,t]=u.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return u.getBuiltinModule(o)}return m(o)},"__cjs_getBuiltinModule"),{stdin:f,stdout:T}=u,{createInterface:j}=y("node:readline/promises");var $=Object.defineProperty,q=p((o,r)=>$(o,"name",{value:r,configurable:!0}),"n");const B=q(async o=>{if(!f.isTTY)return!0;const r=j({input:f,output:T});try{const t=(await r.question(`${o} [Y/n] `)).trim().toLowerCase();return t===""||t==="y"||t==="yes"}finally{r.close()}},"confirm");var D=Object.defineProperty,n=p((o,r)=>D(o,"name",{value:r,configurable:!0}),"r");const a=n(o=>{const r=o.workspaceRoot??process.cwd(),t=o.visConfig??{};return{config:t,dryRun:!!o.options.dryRun,logger:o.logger,packageManager:E(r),report:R(),root:r,useEditorconfig:typeof t.editorconfig=="boolean"?t.editorconfig:!0}},"buildContext"),g=n(async(o,r,t)=>{if(r.yes||r.dryRun)return!0;const i=await B(`This will edit files, scripts, and hooks for "${o}". Backups (.bak) will be created. Continue?`);return i||t.info("Aborted."),i},"maybeConfirm"),c=n(o=>{o.dryRun&&o.logger.info(`Running in dry-run mode — no changes will be made.
|
|
2
2
|
`)},"announceDryRun"),K=n(async({logger:o,options:r,visConfig:t,workspaceRoot:i})=>{if(!await g("deps",r,o))return;const e=a({logger:o,options:r,visConfig:t,workspaceRoot:i});c(e),o.info("── Migrating dependencies and scripts ──"),w(e.root,e.packageManager,e.config,{dryRun:e.dryRun},o,e.report),o.info(""),s(e.report,o)},"migrateDepsExecuteImpl"),L=n(async({logger:o,options:r,visConfig:t,workspaceRoot:i})=>{if(!await g("lint-staged",r,o))return;const e=a({logger:o,options:r,visConfig:t,workspaceRoot:i});c(e),o.info("── Migrating lint-staged ──"),k(e.root,{dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},o,e.report),o.info(""),s(e.report,o)},"migrateLintStagedExecuteImpl"),P=n(async({logger:o,options:r,visConfig:t,workspaceRoot:i})=>{if(!await g("nano-staged",r,o))return;const e=a({logger:o,options:r,visConfig:t,workspaceRoot:i});c(e),o.info("── Migrating nano-staged ──"),v(e.root,{dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},o,e.report),o.info(""),s(e.report,o)},"migrateNanoStagedExecuteImpl"),G=n(async({logger:o,options:r,visConfig:t,workspaceRoot:i})=>{if(!await g("turborepo",r,o))return;const e=a({logger:o,options:r,visConfig:t,workspaceRoot:i});c(e),o.info("── Migrating turborepo ──"),x(e.root,{dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},o,e.report),o.info(""),s(e.report,o)},"migrateTurborepoExecuteImpl"),O=n(async({logger:o,options:r,visConfig:t,workspaceRoot:i})=>{if(!await g("nx",r,o))return;const e=a({logger:o,options:r,visConfig:t,workspaceRoot:i});c(e),o.info("── Migrating nx ──"),C(e.root,{dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},o,e.report),o.info(""),s(e.report,o)},"migrateNxExecuteImpl"),Q=n(async({logger:o,options:r,visConfig:t,workspaceRoot:i})=>{if(!await g("moon",r,o))return;const e=a({logger:o,options:r,visConfig:t,workspaceRoot:i});c(e),o.info("── Migrating moon ──"),b(e.root,{copyTemplates:!!r.copyTemplates,dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},o,e.report),o.info(""),s(e.report,o)},"migrateMoonExecuteImpl"),V=n(async({logger:o,options:r,visConfig:t,workspaceRoot:i})=>{if(!await g("gitleaks",r,o))return;const e=a({logger:o,options:r,visConfig:t,workspaceRoot:i});c(e),o.info("── Migrating gitleaks ──"),M(e.root,{dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},o,e.report),o.info(""),s(e.report,o)},"migrateGitleaksExecuteImpl"),Y=n(async({logger:o,options:r,visConfig:t,workspaceRoot:i})=>{if(!await g("kingfisher",r,o))return;const e=a({logger:o,options:r,visConfig:t,workspaceRoot:i});c(e),o.info("── Migrating Kingfisher ──"),h(e.root,{dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},o,e.report),o.info(""),s(e.report,o)},"migrateKingfisherExecuteImpl"),A=n(async({logger:o,options:r,visConfig:t,workspaceRoot:i})=>{if(!await g("secretlint",r,o))return;const e=a({logger:o,options:r,visConfig:t,workspaceRoot:i});c(e),o.info("── Migrating secretlint ──"),I(e.root,{dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},o,e.report),o.info(""),s(e.report,o)},"migrateSecretlintExecuteImpl"),W=n(async({logger:o,options:r,visConfig:t,workspaceRoot:i})=>{if(!await g("syncpack",r,o))return;const e=a({logger:o,options:r,visConfig:t,workspaceRoot:i});c(e),o.info("── Migrating syncpack ──"),_(e.root,{dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},o,e.report),o.info(""),s(e.report,o)},"migrateSyncpackExecuteImpl"),z=n(async({logger:o,options:r,visConfig:t,workspaceRoot:i})=>{if(!await g("sherif",r,o))return;const e=a({logger:o,options:r,visConfig:t,workspaceRoot:i});c(e),o.info("── Migrating sherif ──"),S(e.root,{dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},o,e.report),o.info(""),s(e.report,o)},"migrateSherifExecuteImpl"),F=n(({logger:o,workspaceRoot:r})=>{const t=r??process.cwd();N(t,o).length>0&&(process.exitCode=1)},"migrateVerifyExecuteImpl"),Z=K,oo=L,eo=P,ro=G,to=O,io=Q,no=V,so=Y,ao=A,go=W,co=z,uo=F;export{Z as migrateDepsExecute,no as migrateGitleaksExecute,so as migrateKingfisherExecute,oo as migrateLintStagedExecute,io as migrateMoonExecute,eo as migrateNanoStagedExecute,to as migrateNxExecute,ao as migrateSecretlintExecute,co as migrateSherifExecute,go as migrateSyncpackExecute,ro as migrateTurborepoExecute,uo as migrateVerifyExecute};
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
var he=Object.defineProperty;var W=(e,t)=>he(e,"name",{value:t,configurable:!0});import{createRequire as ve}from"node:module";import{
|
|
2
|
-
${G("⚠")} ${String(e.length)} package${e.length===1?"":"s"} skipped by target constraint (use --target latest to include):`);for(const n of e)t.info(` ${n.packageName} ${n.currentRange} → ${n.newRange} (${n.updateType})`)}},"logFilteredByTarget"),
|
|
3
|
-
`):n==="minimal"?process.stdout.write(`${
|
|
4
|
-
`):(
|
|
1
|
+
var he=Object.defineProperty;var W=(e,t)=>he(e,"name",{value:t,configurable:!0});import{createRequire as ve}from"node:module";import{am as we,t as ye,F as j,e as G,an as be,g as Re,G as Se,H as le,ao as Ce,ap as ce,f as Ae,R as xe,J as Ee,V as Te,aq as Ue,B as je,ar as Ne,s as qe,d as Fe,U as Be,as as Me,at as _e,au as Oe,h as Pe,av as We}from"./bin.js";import{M as X,i as ee}from"../packem_shared/otel-CO8UEfTa.js";import{d as Le}from"../packem_shared/readTomlSync-1fKo0R52-DAKNI1Me.js";import{render as te,renderToString as V,Text as b}from"@visulima/tui";import $ from"react";import{H as Ye,e as ze,Z as ne}from"../packem_shared/ai-analysis-CGVjqwdc.js";import{r as Ie,s as De}from"../packem_shared/typosquats-Dr7VIL2B.js";import{U as He,B as Ve,T as ae}from"../packem_shared/vis-update-app-DGiMc5kb.js";import{d as Ge}from"../packem_shared/utils-DrNg0XTR.js";const $e=ve(import.meta.url),M=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ke=W(e=>{if(typeof M<"u"&&M.versions&&M.versions.node){const[t,n]=M.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return M.getBuiltinModule(e)}return $e(e)},"__cjs_getBuiltinModule"),{execFileSync:ie}=ke("node:child_process");var Je=Object.defineProperty,x=W((e,t)=>Je(e,"name",{value:t,configurable:!0}),"s");const Ze=x(e=>{const t=[];for(const n of e.filters)t.push("--filter",n);return e.workspaceRoot&&t.push("--filter","."),t.push("update"),e.latest&&t.push("--latest"),e.recursive&&t.push("--recursive"),e.interactive&&t.push("--interactive"),e.dev&&t.push("--dev"),e.prod&&t.push("--prod"),e.noOptional&&t.push("--no-optional"),e.noSave&&t.push("--no-save"),t.push(...e.packages),{args:t,bin:"pnpm"}},"resolvePnpm"),Ke=x(e=>{const t=[];return e.filters.length>0&&t.push("workspace",e.filters[0]),t.push("upgrade"),e.latest&&t.push("--latest"),t.push(...e.packages),{args:t,bin:"yarn"}},"resolveYarnV1"),Qe=x(e=>{const t=[];if(e.filters.length>0||e.recursive){t.push("workspaces","foreach","--all");for(const n of e.filters)t.push("--include",n)}return t.push("up"),e.interactive&&t.push("--interactive"),t.push(...e.packages),{args:t,bin:"yarn"}},"resolveYarnBerry"),Xe=x((e,t)=>{const n=["update"];e.latest&&t.push("npm does not support --latest flag. Packages will be updated within their semver range."),e.interactive&&t.push("npm does not support --interactive mode.");for(const a of e.filters)n.push("--workspace",a);return e.recursive&&n.push("--workspaces"),e.workspaceRoot&&n.push("--include-workspace-root"),e.dev&&n.push("--dev"),e.prod&&n.push("--production"),e.noOptional&&n.push("--no-optional"),e.noSave&&n.push("--no-save"),n.push(...e.packages),{args:n,bin:"npm"}},"resolveNpm"),et=x(e=>{const t=["update"];e.latest&&t.push("--latest");for(const n of e.filters)t.push("--filter",n);return t.push(...e.packages),{args:t,bin:"bun"}},"resolveBun"),tt=x((e,t)=>{const n=["outdated","--update"];return e.latest&&n.push("--latest"),e.interactive&&n.push("--interactive"),e.filters.length>0&&t.push("deno outdated has no --filter flag; ignoring."),(e.dev||e.prod)&&t.push("deno outdated has no --dev / --prod flags; dev/prod is governed by deno.json."),e.noOptional&&t.push("deno outdated has no --no-optional flag; ignoring."),e.noSave&&t.push("deno outdated has no --no-save flag; ignoring."),n.push(...e.packages),{args:n,bin:"deno"}},"resolveDeno"),nt=x((e,t,n)=>{const a=[];if(n.global&&e!=="aube"&&e!=="deno")return{command:{args:["update","--global",...n.packages],bin:"npm"},warnings:a};let i;switch(e){case"aube":{const o=we(n);i={args:o.args,bin:o.bin},a.push(...o.warnings);break}case"bun":{i=et(n);break}case"deno":{i=tt(n,a);break}case"npm":{i=Xe(n,a);break}case"pnpm":{i=Ze(n);break}case"yarn":{i=t.startsWith("1.")?Ke(n):Qe(n);break}default:{const o=e;throw new Error(`Unsupported package manager: ${String(o)}`)}}return{command:i,warnings:a}},"resolveUpdateCommand");var at=Object.defineProperty,R=W((e,t)=>at(e,"name",{value:t,configurable:!0}),"C");const ot=R((e,t)=>{try{if(t==="pnpm"){const n=X(e,"pnpm-workspace.yaml");if(ee(n)){const a=ye(n);return{excludes:Array.isArray(a?.minimumReleaseAgeExclude)?a.minimumReleaseAgeExclude:void 0,minutes:typeof a?.minimumReleaseAge=="number"?a.minimumReleaseAge:void 0}}}else if(t==="bun"){const n=X(e,"bunfig.toml");if(ee(n)){const a=Le(n);return{excludes:Array.isArray(a?.install?.minimumReleaseAgeExcludes)?a.install.minimumReleaseAgeExcludes:void 0,minutes:typeof a?.install?.minimumReleaseAge=="number"?a.install.minimumReleaseAge:void 0}}}}catch{}return{}},"readPmNativeMinimumReleaseAge"),st=R((e,t,n)=>{const a=e.latest?"latest":e.target??t.target??"latest";if(!["latest","minor","patch"].includes(a))throw new Error(`Invalid target "${a}". Use: latest, minor, or patch.`);const i=e.maxConcurrentRequests,o=typeof i=="number"&&i>0?i:t.maxConcurrentRequests,r=typeof e.releaseChannel=="string"?e.releaseChannel.toLowerCase():void 0;if(r!==void 0&&!["any","same","stable"].includes(r))throw new Error(`Invalid --release-channel "${String(e.releaseChannel)}". Use: any, same, or stable.`);const g=r??t.releaseChannel;return{exclude:[...j(e.exclude),...j(t.exclude)],ignore:j(t.ignore),include:[...j(e.include),...j(t.include),...n],includeLocked:e.includeLocked||t.includeLocked||!1,includePrerelease:e.prerelease||t.prerelease||!1,maxConcurrentRequests:o,minimumReleaseAge:t.minimumReleaseAge,minimumReleaseAgeExclude:t.minimumReleaseAgeExclude,packageMode:t.packageMode,releaseChannel:g,security:e.security||e.ai||t.security||!1,target:a}},"buildCatalogCheckOptions"),oe=R((e,t)=>{if(e.length!==0){t.info(`
|
|
2
|
+
${G("⚠")} ${String(e.length)} package${e.length===1?"":"s"} skipped by target constraint (use --target latest to include):`);for(const n of e)t.info(` ${n.packageName} ${n.currentRange} → ${n.newRange} (${n.updateType})`)}},"logFilteredByTarget"),se=R((e,t,n,a)=>{n==="json"?process.stdout.write(`${be({checkedCount:0,failed:t,filteredByTarget:[],ignored:[],outdated:e})}
|
|
3
|
+
`):n==="minimal"?process.stdout.write(`${Re(e)}
|
|
4
|
+
`):(Se(e,a),a.info(le(e)))},"writeFormattedOutput"),re=R(async(e,t,n,a,i,o,r)=>{const g=Ce(e,n,t,!0,{useEditorconfig:r}),v=t==="pnpm"?"pnpm-workspace.yaml":"package.json";if(i.info(`
|
|
5
5
|
Updated ${v}`),g&&i.info(`Backup saved to ${g}`),a.changelog){i.info(`
|
|
6
|
-
Fetching changelogs...`);const u=await ce(n,void 0,o);for(const
|
|
7
|
-
`);try{ie(u,
|
|
8
|
-
`),U=te(
|
|
9
|
-
`);const
|
|
6
|
+
Fetching changelogs...`);const u=await ce(n,void 0,o);for(const d of u){const m=d.releaseUrl??d.repoUrl??d.npmUrl;i.info(` ${d.packageName}: ${m}`)}}if(a.install??!0){const u=t,d=["install"];i.info(`Running ${u} ${d.join(" ")}...
|
|
7
|
+
`);try{ie(u,d,{cwd:e,env:process.env,stdio:"inherit"})}catch{i.warn(`${u} ${d.join(" ")} failed. You may need to run it manually.`)}}},"applyCatalogAndInstall"),rt=R(async(e,t,n,a,i,o)=>{const r=n.update??{},g=[["global","--global is not supported in catalog mode"],["recursive","--recursive is not needed in catalog mode (catalogs are workspace-level)"],["filter","--filter is not supported in catalog mode (use --include/--exclude instead)"],["no-save","--no-save is not supported in catalog mode"],["workspace-root","--workspace-root is not needed in catalog mode"],["no-optional","--no-optional is not supported in catalog mode"]];for(const[s,c]of g)a[s]&&o.warn(`${G("⚠")} ${c}, ignoring.`);const{excludes:v,minutes:u}=ot(e,t),d=r.minimumReleaseAge??u,m=r.minimumReleaseAgeExclude??v;if(r.minimumReleaseAge!==void 0&&u!==void 0&&r.minimumReleaseAge!==u){const s=t==="pnpm"?"pnpm-workspace.yaml":"bunfig.toml";o.warn(`${G("⚠")} minimumReleaseAge mismatch: vis config = ${String(r.minimumReleaseAge)} min, ${s} = ${String(u)} min. Consider keeping them in sync.`)}const S=Ae(e),E=a["include-internal"],J=a.peer,N=xe(e,t,{depFields:r.depFields,dev:a.dev,includeInternal:E,peer:J,prod:a.prod});if(N.size===0){o.info("No catalogs found.");return}const ue={...r,minimumReleaseAge:d,minimumReleaseAgeExclude:m},T=st(a,ue,i);let L=0;for(const s of N.values())L+=s.size;const _=!!process.stdout.isTTY&&!qe;let U;const de=_?(s,c)=>{U?U.rerender($.createElement(ae,{current:s,total:c})):(process.stdout.write(`
|
|
8
|
+
`),U=te($.createElement(ae,{current:s,total:c}),{interactive:!0,patchConsole:!1}))}:(s,c)=>{o.info(`Checking ${String(s)}/${String(c)} dependencies...`)};_||o.info(`Checking ${String(L)} catalog dependencies...
|
|
9
|
+
`);const pe=Ee(n.security?.socket),{checkedCount:k,failed:w,filteredByTarget:f,ignored:C,outdated:p}=await Te(N,T,S,de,e,pe,n.security?.socket?.acceptedRisks);U&&(U.clear(),U.unmount());const O=E?{ignored:[],outdated:[]}:Ue(e,{depFields:r.depFields,dev:a.dev,exclude:T.exclude,ignore:T.ignore,include:T.include,packageMode:T.packageMode,peer:J,prod:a.prod,target:T.target});if(O.outdated.length>0){const s=new Set(p.map(c=>`${c.catalogName}|${c.packageName}`));for(const c of O.outdated)s.has(`${c.catalogName}|${c.packageName}`)||p.push(c)}if(O.ignored.length>0)for(const s of O.ignored)C.includes(s)||C.push(s);const Z=k-p.length-w.length;if(w.length>0&&o.warn(`Failed to fetch: ${w.join(", ")}`),C.length>0&&o.info(`Skipped ${String(C.length)} ignored package${C.length===1?"":"s"}: ${C.join(", ")}`),!_&&k>p.length){const s=[...N.values()].reduce((B,z)=>B+z.size,0),c=s>k?` (${String(s)} catalog entries, ${String(s-k)} duplicates)`:"";o.info(`Checked ${String(k)} unique packages${c}: ${String(p.length)} outdated, ${String(Z)} up-to-date${w.length>0?`, ${String(w.length)} failed`:""}${f.length>0?`, ${String(f.length)} skipped by target`:""}`)}if(p.length===0){f.length>0?o.info(`All catalog dependencies are up to date within the current target.
|
|
10
10
|
${String(f.length)} package${f.length===1?" has":"s have"} newer versions available with --target latest:
|
|
11
|
-
${f.map(
|
|
12
|
-
`)}`):o.info("All catalog dependencies are up to date.");return}const q=a.format??
|
|
13
|
-
`);for(const l of
|
|
11
|
+
${f.map(s=>` ${s.packageName} ${s.currentRange} → ${s.newRange} (${s.updateType})`).join(`
|
|
12
|
+
`)}`):o.info("All catalog dependencies are up to date.");return}const q=a.format??r.format??"table";let y;if(a.ai){const s=Ye(a.aiType??"impact");y=await ze(p,o,n.ai,s)}const Y=!!a.dryRun;if(_&&q==="table"){const s=new He(p,y??null);let c;if(a.changelog){o.info("Fetching changelogs...");const l=await ce(p,void 0,S);c=new Map;for(const h of l){const A=h.releaseUrl??h.repoUrl??h.npmUrl;A&&c.set(h.packageName,A)}}const B=n.tui?.autoExit??!1,z=B===!0?3:typeof B=="number"?B:0,K=await te($.createElement(Ve,{autoExitSeconds:z,changelogUrls:c,checkedCount:k,filteredOutEntries:f,isDryRun:Y,store:s,totalCatalogEntries:L}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}).waitUntilExit(),I=process.stdout.columns||80;process.stdout.write(`
|
|
13
|
+
`);for(const l of p){const h=l.vulnerabilities?.length||l.socketReport&&l.socketReport.alerts.length>0,A=!!l.acceptedRisk,H=h?A?"✓":"⚠":"✓",me=A?"gray":l.updateType==="major"?"red":l.updateType==="minor"?"yellow":"green",P=l.socketReport?.score.overall,fe=P===void 0?"":` [${String(Math.round(P*100))}%]`,Q=P===void 0?void 0:je(P);process.stdout.write(`${V($.createElement(b,null," ",$.createElement(b,{color:me},H),` ${l.packageName} ${l.currentRange} → ${l.newRange}`,$.createElement(b,{dimColor:!0},` ${l.updateType}`),Q?$.createElement(b,{color:Q},fe):null),{columns:I})}
|
|
14
14
|
`)}if(process.stdout.write(`
|
|
15
|
-
`),o.info(le(
|
|
16
|
-
`);const l=`${String(f.length)} package${f.length===1?"":"s"} skipped by target constraint (use --target latest to include):`;process.stdout.write(`${V(
|
|
17
|
-
`);for(const h of f)process.stdout.write(`${V(
|
|
18
|
-
`)}const D=Array.isArray(K)?K:[];if(D.length>0&&!
|
|
15
|
+
`),o.info(le(p)),k>p.length){const l=[...N.values()].reduce((A,H)=>A+H.size,0),h=l>k?` (${String(l)} catalog entries, ${String(l-k)} duplicates)`:"";o.info(` Checked ${String(k)} unique packages${h}: ${String(Z)} up-to-date${w.length>0?`, ${String(w.length)} failed`:""}`)}if(f.length>0){process.stdout.write(`
|
|
16
|
+
`);const l=`${String(f.length)} package${f.length===1?"":"s"} skipped by target constraint (use --target latest to include):`;process.stdout.write(`${V($.createElement(b,{color:"yellow"},` ${l}`),{columns:I})}
|
|
17
|
+
`);for(const h of f)process.stdout.write(`${V($.createElement(b,null," ",$.createElement(b,{dimColor:!0},h.packageName),` ${h.currentRange} → ${h.newRange}`,$.createElement(b,{dimColor:!0},` ${h.updateType}`)),{columns:I})}
|
|
18
|
+
`)}const D=Array.isArray(K)?K:[];if(D.length>0&&!Y){o.info(`
|
|
19
19
|
Applying ${String(D.length)} updates...
|
|
20
|
-
`);const l={...a,install:a.install??
|
|
21
|
-
`)}else o.info(`Would update ${String(
|
|
22
|
-
`),
|
|
23
|
-
`),
|
|
24
|
-
${
|
|
25
|
-
`),process.exitCode=m}},"executePmWrapper"),
|
|
20
|
+
`);const l={...a,install:a.install??r.install};await re(e,t,D,l,o,S,n.editorconfig??!0)}return}if(Y){if(q==="json"){const s={failed:w,filteredByTarget:f,ignored:C,outdated:p};y&&(s.aiAnalysis=y),process.stdout.write(`${JSON.stringify(s,void 0,2)}
|
|
21
|
+
`)}else o.info(`Would update ${String(p.length)} dependencies:
|
|
22
|
+
`),se(p,w,q,o),y&&(o.info(""),o.info(ne(y))),oe(f,o);return}y&&q!=="json"&&(o.info(ne(y)),o.info(""));let F=p;if(a.interactive&&(F=await Ne(p),F.length===0)){o.info("No updates selected.");return}o.info(`Updating ${String(F.length)} catalog dependencies...
|
|
23
|
+
`),se(F,[],q,o),oe(f,o);const ge={...a,install:a.install??r.install};await re(e,t,F,ge,o,S)},"executeCatalogUpdate"),it=R((e,t,n,a,i,o)=>{const r={dev:a.dev,filters:j(a.filter),global:a.global,interactive:a.interactive,latest:a.latest||a.target==="latest",noOptional:a.optional===!1,noSave:a.save===!1,packages:i,prod:a.prod,recursive:a.recursive,workspaceRoot:a.workspaceRoot},{command:g,warnings:v}=nt(t,n,r);for(const d of v)o.warn(d);const u=`${g.bin} ${g.args.join(" ")}`.trim();if(a.dryRun){o.info(`Would run: ${u}`);return}o.info(`Running: ${u}`);try{ie(g.bin,g.args,{cwd:e,env:process.env,stdio:"inherit"})}catch(d){const m=d.status??1;o.error(`
|
|
24
|
+
${Fe("✖")} Update failed (exit code ${String(m)})`),o.error(` Command: ${u}`),o.error(` Directory: ${e}
|
|
25
|
+
`),process.exitCode=m}},"executePmWrapper"),kt=R(async({argument:e,logger:t,options:n,visConfig:a,workspaceRoot:i})=>{if(!i)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");let o=e;const r=i,{packageManager:g}=Be(r);if(n.typosquatCheck!==!1){if(o.length>0){const v=o.map(m=>Ge(m)),u=a?.security?.typosquatAllowlist,d=await Ie(v.map(m=>m.name),u);if(!d.ok){process.exitCode=1;return}o=v.map((m,S)=>{const E=d.packages[S];return E!==m.name?m.versionSpec?`${E}@${m.versionSpec}`:E??"":o[S]??""})}else if(!await De(r,a?.security?.typosquatAllowlist)){process.exitCode=1;return}}if(n.rollback){if(!Me(r,g)){t.info("No backup found. Run 'vis update' first to create a backup.");return}if(_e(r,g))t.info("Restored from backup.");else throw new Error("Failed to restore from backup.");return}if(n.catalog!==!1&&Oe(r,g))await rt(r,g,a??{},n,o,t);else{const v=Pe(r,{configBackend:a?.install?.backend,configCorepack:a?.install?.corepack}),u=v.name==="aube"?"":We(v.name);it(r,v.name,u,n,o,t)}},"execute");export{kt as default,ot as readPmNativeMinimumReleaseAge};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var L=Object.defineProperty;var h=(e,t)=>L(e,"name",{value:t,configurable:!0});import{createRequire as O}from"node:module";import{
|
|
2
|
-
`);return}if(o.length===0){d.info("No running services registered for this workspace.");return}const s=Date.now(),i=o.map(p=>{const f=Date.parse(p.startedAt);return{age:Number.isFinite(f)?te(f,s):"?",id:p.id,log:p.logFile,pid:String(p.pid),port:de(p)}}),c=Math.max(2,...i.map(p=>p.id.length)),g=Math.max(3,...i.map(p=>p.pid.length)),u=Math.max(4,...i.map(p=>p.port.length)),w=Math.max(3,...i.map(p=>p.age.length));e.info(` ${"id".padEnd(c)} ${"pid".padEnd(g)} ${"port".padEnd(u)} ${"age".padEnd(w)} log`),e.info(` ${"-".repeat(c)} ${"-".repeat(g)} ${"-".repeat(u)} ${"-".repeat(w)} ---`);for(const p of i)e.info(` ${p.id.padEnd(c)} ${p.pid.padEnd(g)} ${p.port.padEnd(u)} ${p.age.padEnd(w)} ${p.log}`)},"serviceListExecute"),
|
|
1
|
+
var L=Object.defineProperty;var h=(e,t)=>L(e,"name",{value:t,configurable:!0});import{createRequire as O}from"node:module";import{p as d,aA as V,y as z,aB as B,ay as q}from"./bin.js";import{M as W}from"../packem_shared/otel-CO8UEfTa.js";import{R as H,w as F,r as S,i as m,d as $,g as J,s as K,a as Y,b as I,S as Q,c as X,p as Z}from"../packem_shared/registry-D04iOQ5H.js";import{formatAge as te}from"./handler30.js";const G=O(import.meta.url),y=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,T=h(e=>{if(typeof y<"u"&&y.versions&&y.versions.node){const[t,r]=y.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return y.getBuiltinModule(e)}return G(e)},"__cjs_getBuiltinModule"),{open:E,stat:k,watch:U}=T("node:fs/promises"),{spawn:ee}=T("node:child_process");var re=Object.defineProperty,oe=h((e,t)=>re(e,"name",{value:t,configurable:!0}),"i");const M=process.platform==="win32",se=oe(async e=>{const{command:t,cwd:r,env:n,logFile:a}=e,o=await E(a,"a",H);let s;try{s=ee(M?"cmd":"/bin/sh",M?["/d","/s","/c",t]:["-c",t],{cwd:r,detached:!0,env:{...process.env,...n},stdio:["ignore",o.fd,o.fd],windowsHide:!0})}finally{await o.close().catch(()=>{})}if(s.pid===void 0&&await new Promise((i,c)=>{s.once("spawn",()=>{i()}),s.once("error",g=>{c(g)})}),s.pid===void 0)throw new Error(`Failed to spawn detached process for command: ${t}`);return s.unref(),{pid:s.pid}},"spawnDetached");var ie=Object.defineProperty,R=h((e,t)=>ie(e,"name",{value:t,configurable:!0}),"t");const _=5e3,D=R(async e=>F(e.workspaceRoot,e.id,async()=>{const t=await S(e.workspaceRoot,e.id);if(t&&m(t.pid))throw new Error(`Service ${e.id} is already running (pid ${String(t.pid)})`);t&&await $(e.workspaceRoot,e.id,t);const r=await J(e.workspaceRoot),n=K(e.id),a=W(r,`${n}.log`),{pid:o}=await se({command:e.command,cwd:e.cwd,env:e.env,logFile:a}),s={command:e.command,config:e.config,cwd:e.cwd,env:e.config.env??{},id:e.id,logFile:a,pid:o,slug:n,startedAt:new Date().toISOString(),visVersion:process.env.VIS_VERSION??"0.0.0"};if(await Y(e.workspaceRoot,s),e.skipReadiness!==!0)try{await I(e.config,{timeoutMs:e.readinessTimeoutMs})}catch(i){throw await P(o,e.config.killGracePeriodMs??_).catch(()=>{}),await $(e.workspaceRoot,e.id,s).catch(()=>{}),i}return{entry:s}}),"startService"),N=R(async e=>F(e.workspaceRoot,e.id,async()=>{const t=await S(e.workspaceRoot,e.id);if(!t)return{stopped:!1};if(!m(t.pid))return await $(e.workspaceRoot,e.id,t),{stopped:!1};const r=e.graceMs??t.config.killGracePeriodMs??_;return await P(t.pid,r),await $(e.workspaceRoot,e.id,t),{stopped:!0}}),"stopService"),P=R(async(e,t)=>{b(e,"SIGTERM");const r=Date.now();for(;Date.now()-r<t;){if(!m(e))return;await new Promise(n=>{setTimeout(n,100)})}m(e)&&b(e,"SIGKILL")},"stopServiceByPid"),b=R((e,t)=>{try{process.platform==="win32"?process.kill(e,t):process.kill(-e,t)}catch(r){if(r.code==="ESRCH")return;throw r}},"sendSignalToServiceGroup");var ae=Object.defineProperty,l=h((e,t)=>ae(e,"name",{value:t,configurable:!0}),"g");const ne=l(e=>{const t=e.trim(),r=t.lastIndexOf(":");if(!(r<=0||r===t.length-1))return{project:t.slice(0,r),target:t.slice(r+1)}},"splitTargetId"),ce=l((e,t,r)=>r||!t?e:t.startsWith("/")?t:`${e}/${t}`,"resolveCwd"),A=l(async(e,t,r)=>{const n=ne(r);if(!n){d.error(`Invalid target id "${r}". Expected "<project>:<target>", e.g. "@my/api:db".`);return}const a=await V(e),{projectOptions:o,workspace:s}=z(e,t,a),i=s.projects[n.project],c=o.get(n.project)?.[n.target];if(!i||!c){d.error(`Target "${r}" not found in this workspace.`);return}const g=c.options?.service;if(!g){d.error(`Target "${r}" is not a service. Add an \`options.service\` block to make it eligible for \`vis service\`.`);return}if(!c.command){d.error(`Target "${r}" has no command — services must be runnable.`);return}const u=ce(e,i.root,c.options?.runFromWorkspaceRoot===!0),w=c.options?.envFile?B(u,c.options.envFile):{};return{command:c.command,cwd:u,env:{...w,...g.env},service:g,target:c,targetId:r}},"resolveTarget"),v=l(e=>{if(!e)throw new Error("Could not determine workspace root. Run `vis service` inside a workspace.");return e},"requireWorkspace"),ye=l(async({argument:e,options:t,visConfig:r,workspaceRoot:n})=>{const a=v(n),o=e[0]?.trim();if(!o){d.error("Missing target id. Usage: vis service start <project>:<target>"),process.exitCode=1;return}const s=await A(a,r,o);if(!s){process.exitCode=1;return}try{const{entry:i}=await D({command:s.command,config:s.service,cwd:s.cwd,env:s.env,id:o,readinessTimeoutMs:t.timeout,skipReadiness:t.readiness===!1,workspaceRoot:a});d.success(`Started ${o} (pid ${String(i.pid)})`),d.info(` log: ${i.logFile}`)}catch(i){const c=i instanceof Error?i.message:String(i);i instanceof Q?d.error(`Readiness probe failed for ${o}: ${c}`):d.error(`Failed to start ${o}: ${c}`),process.exitCode=1}},"serviceStartExecute"),C=l(async(e,t,r)=>{const{stopped:n}=await N({graceMs:r,id:t,workspaceRoot:e});return n?(d.success(`Stopped ${t}`),!0):(d.info(`No running service registered for ${t}`),!1)},"stopOne"),$e=l(async({argument:e,options:t,workspaceRoot:r})=>{const n=v(r),{graceMs:a}=t,o=e[0]?.trim();if(t.all===!0){if(o){d.error("Cannot combine --all with a target id. Use one or the other."),process.exitCode=1;return}const s=await X(n);if(s.length===0){d.info("No running services registered for this workspace.");return}for(const i of s)await C(n,i.id,a);return}if(!o){d.error("Missing target id. Usage: vis service stop <project>:<target> | --all"),process.exitCode=1;return}await C(n,o,a)||(process.exitCode=1)},"serviceStopExecute"),de=l(e=>{const t=e.config.readiness?.tcp.port??e.config.port;return t===void 0?"—":String(t)},"formatPort"),j=new Set(["json","table"]),Se=l(async({logger:e,options:t,workspaceRoot:r})=>{const n=v(r),a=t.format??"table";if(!j.has(a)){d.error(`Invalid --format "${a}". Expected one of: ${[...j].sort().join(", ")}.`),process.exitCode=1;return}const{surviving:o}=await Z(n);if(a==="json"){const p=Date.now();process.stdout.write(`${JSON.stringify(o.map(f=>{const x=Date.parse(f.startedAt);return{ageMs:Number.isFinite(x)?p-x:null,alive:m(f.pid),command:f.command,cwd:f.cwd,env:f.env,id:f.id,logFile:f.logFile,pid:f.pid,port:f.config.readiness?.tcp.port??f.config.port??null,startedAt:f.startedAt,visVersion:f.visVersion}}),void 0,2)}
|
|
2
|
+
`);return}if(o.length===0){d.info("No running services registered for this workspace.");return}const s=Date.now(),i=o.map(p=>{const f=Date.parse(p.startedAt);return{age:Number.isFinite(f)?te(f,s):"?",id:p.id,log:p.logFile,pid:String(p.pid),port:de(p)}}),c=Math.max(2,...i.map(p=>p.id.length)),g=Math.max(3,...i.map(p=>p.pid.length)),u=Math.max(4,...i.map(p=>p.port.length)),w=Math.max(3,...i.map(p=>p.age.length));e.info(` ${"id".padEnd(c)} ${"pid".padEnd(g)} ${"port".padEnd(u)} ${"age".padEnd(w)} log`),e.info(` ${"-".repeat(c)} ${"-".repeat(g)} ${"-".repeat(u)} ${"-".repeat(w)} ---`);for(const p of i)e.info(` ${p.id.padEnd(c)} ${p.pid.padEnd(g)} ${p.port.padEnd(u)} ${p.age.padEnd(w)} ${p.log}`)},"serviceListExecute"),Re=l(async({argument:e,options:t,workspaceRoot:r})=>{const n=v(r),a=e[0]?.trim();if(!a){d.error("Missing target id. Usage: vis service status <project>:<target>"),process.exitCode=1;return}const o=await S(n,a);if(!o){d.error(`No service registered for ${a}.`),process.exitCode=1;return}if(!m(o.pid)){d.error(`Service ${a} is not running (pid ${String(o.pid)} is dead). Run \`vis service start ${a}\` to recover.`),process.exitCode=1;return}try{await I(o.config,{timeoutMs:t.timeout}),d.success(`${a} healthy (pid ${String(o.pid)})`)}catch(s){const i=s instanceof Error?s.message:String(s);d.error(`${a} probe failed: ${i}`),process.exitCode=1}},"serviceStatusExecute"),Ee=l(async({argument:e,options:t,visConfig:r,workspaceRoot:n})=>{const a=v(n),o=e[0]?.trim();if(!o){d.error("Missing target id. Usage: vis service restart <project>:<target>"),process.exitCode=1;return}await N({graceMs:t.graceMs,id:o,workspaceRoot:a});const s=await A(a,r,o);if(!s){process.exitCode=1;return}try{const{entry:i}=await D({command:s.command,config:s.service,cwd:s.cwd,env:s.env,id:o,readinessTimeoutMs:t.timeout,skipReadiness:t.readiness===!1,workspaceRoot:a});d.success(`Restarted ${o} (pid ${String(i.pid)})`)}catch(i){const c=i instanceof Error?i.message:String(i);d.error(`Failed to restart ${o}: ${c}`),process.exitCode=1}},"serviceRestartExecute"),pe=200,ge=1024*1024,le=l(async e=>{let t=0;try{t=(await k(e)).size}catch{t=0}const r=new AbortController;let n=!1;const a=l(()=>{n=!0,r.abort()},"onSigint"),o=l(()=>{r.abort()},"onSigterm");process.on("SIGINT",a),process.on("SIGTERM",o);let s=!1;const i=l(async()=>{if(!s){s=!0;try{const c=await k(e).catch(()=>{});if(!c||(c.size<t&&(t=0),c.size===t))return;const g=c.size-t,u=Math.min(g,ge),w=await E(e,"r");try{const p=Buffer.alloc(u);await w.read(p,0,u,t),process.stdout.write(p),t+=u}finally{await w.close().catch(()=>{})}}finally{s=!1}}},"tickOnce");try{const c=(async()=>{try{const g=U(e,{signal:r.signal});for(;!(await g.next()).done;)await i()}catch{}})();for(;!r.signal.aborted;)await i(),await new Promise(g=>{const u=setTimeout(g,pe);r.signal.addEventListener("abort",()=>{clearTimeout(u),g()},{once:!0})});await c.catch(()=>{}),await i().catch(()=>{})}finally{process.off("SIGINT",a),process.off("SIGTERM",o)}n&&(process.exitCode=130)},"tailLog"),xe=l(async({argument:e,options:t,workspaceRoot:r})=>{const n=v(r),a=e[0]?.trim();if(!a){d.error("Missing target id. Usage: vis service logs <project>:<target>"),process.exitCode=1;return}const o=await S(n,a);if(!o){d.error(`No service registered for ${a}.`),process.exitCode=1;return}if(!await q(o.logFile)){d.warn(`Log file is missing for ${a}: ${o.logFile}`),process.exitCode=1;return}if(t.follow===!0){await le(o.logFile);return}const s=await E(o.logFile,"r");try{const i=s.createReadStream();await new Promise((c,g)=>{i.on("end",c),i.on("error",g),i.pipe(process.stdout,{end:!1})})}finally{await s.close().catch(()=>{})}},"serviceLogsExecute");export{Se as serviceListExecute,xe as serviceLogsExecute,Ee as serviceRestartExecute,ye as serviceStartExecute,Re as serviceStatusExecute,$e as serviceStopExecute};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
2
|
-
`)},"renderCodeowners");var
|
|
3
|
-
`);else if(f.length===0)e.info(`All ${j} package${j===1?"":"s"} in sync (fields: ${c.join(", ")}).`);else if(d){if(!v)for(const s of f)e.error(`${s.packageJsonPath}: ${s.field} drifts from root`);e.error(`Found ${f.length} field drift${f.length===1?"":"s"} across ${p.length} package${p.length===1?"":"s"}. Run \`vis sync package-json-fields\` to fix.`)}else{if(!v)for(const s of p)e.info(`${s.packageJsonPath}: synced ${s.pkgChanges.map(l=>l.field).join(", ")}`);e.info(`Synced ${f.length} field${f.length===1?"":"s"} across ${p.length} package${p.length===1?"":"s"}.`)}d&&f.length>0&&(process.exitCode=1)},"runPackageJsonFields"),
|
|
1
|
+
var J=Object.defineProperty;var y=(e,o)=>J(e,"name",{value:o,configurable:!0});import{createRequire as S}from"node:module";import{M as w,B as q,z as T,w as I}from"../packem_shared/otel-CO8UEfTa.js";import{o as L}from"../packem_shared/index-DH-5hsrC.js";import{y as U,aC as O,aD as W,a1 as B}from"./bin.js";const D=S(import.meta.url),k=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,x=y(e=>{if(typeof k<"u"&&k.versions&&k.versions.node){const[o,t]=k.versions.node.split(".").map(Number);if(o>22||o===22&&t>=3||o===20&&t>=16)return k.getBuiltinModule(e)}return D(e)},"__cjs_getBuiltinModule"),{readFileSync:M}=x("node:fs");var z=Object.defineProperty,C=y((e,o)=>z(e,"name",{value:o,configurable:!0}),"i");const K=C((e,o)=>{const t=o.replace(/^\.?\//,"");return t===""||t==="."?`/${e}/`:e===""||e==="."?`/${t}`:`/${e}/${t}`},"toWorkspacePath"),G=C((e,o)=>{const t=[];for(const[r,n]of Object.entries(o?.globalPaths??{}))t.push({owners:n,path:r});for(const[r,n]of Object.entries(e.projects)){const i=n.owners??[];for(const a of i)t.push({channel:a.channel,owners:a.owners,path:K(n.root??r,a.path),projectId:r})}return(o?.orderBy??"file-source")==="project-id"?t.sort((r,n)=>(r.projectId??"").localeCompare(n.projectId??"")||r.path.localeCompare(n.path)):t.sort((r,n)=>r.path.localeCompare(n.path)),t},"buildCodeownersLines"),V=["# CODEOWNERS — generated by `vis sync codeowners`. Do not edit by hand.","# Update each project's project.json `owners` field and re-run the command.",""],Y=C((e,o="github")=>{const t=[...V];for(const r of e){const n=r.owners.join(" "),i=r.channel?` # notify: ${r.channel}`:"";t.push(`${r.path} ${n}${i}`)}return t.push(""),t.join(`
|
|
2
|
+
`)},"renderCodeowners");var H=Object.defineProperty,u=y((e,o)=>H(e,"name",{value:o,configurable:!0}),"s");const Q=["author","bugs","homepage","license","repository","engines"],E=u(e=>typeof e=="object"&&e!==null&&!Array.isArray(e),"isPlainObject"),b=u((e,o)=>{if(e===o)return!0;if(typeof e!=typeof o||e===null||o===null)return!1;if(Array.isArray(e)){if(!Array.isArray(o)||e.length!==o.length)return!1;for(const[t,r]of e.entries())if(!b(r,o[t]))return!1;return!0}if(typeof e=="object"&&typeof o=="object"){const t=Object.keys(e),r=Object.keys(o);if(t.length!==r.length)return!1;for(const n of t)if(!b(e[n],o[n]))return!1;return!0}return!1},"deepEqual"),N=u(e=>e===void 0?e:structuredClone(e),"cloneJson"),X=u((e,o,t)=>{if(e==="repository"&&E(o)&&E(t)){const r={};for(const[n,i]of Object.entries(o))n!=="directory"&&(r[n]=N(i));return typeof t.directory=="string"&&(r.directory=t.directory),r}return N(o)},"buildTargetValue"),Z=u((e,o,t)=>{const r=[];for(const n of t.fields){if(!Object.hasOwn(e,n))continue;const i=e[n],a=o[n],c=X(n,i,a);b(c,a)||r.push({after:c,before:a,field:n,packageJsonPath:""})}return r},"computeFieldChanges"),ee=u((e,o)=>{for(const t of o)e[t.field]=t.after},"applyFieldChanges");var oe=Object.defineProperty,m=y((e,o)=>oe(e,"name",{value:o,configurable:!0}),"p");const _=["codeowners","package-json-fields"],te=m(e=>{const o=new Set,t=[];for(const r of e??[])for(const n of r.split(",")){const i=n.trim();i.length===0||o.has(i)||(o.add(i),t.push(i))}return t.length>0?t:[...Q]},"parseFieldsOption"),re=m((e,o)=>o.some(t=>L(t,e)),"matchesAnyGlob"),ne=m(({logger:e,options:o,visConfig:t,workspaceRoot:r})=>{const{workspace:n}=U(r,t),i=G(n,t?.codeowners);if(i.length===0){e.info("No `owners` entries found in any project. Nothing to sync.");return}const a=Y(i,t?.codeowners?.provider??"github"),c=o.out?w(r,o.out):w(r,"CODEOWNERS");if(o.check){let g="";try{g=M(c,"utf8")}catch(d){if(d.code!=="ENOENT")throw d}if(g.trim()!==a.trim()){e.error(`${c} is out of date. Run \`vis sync codeowners\` to update it.`),process.exitCode=1;return}e.info(`${c} is up to date.`);return}q(c,a),e.info(`Wrote ${i.length} entries to ${c}`)},"runCodeowners"),se=m(({logger:e,options:o,visConfig:t,workspaceRoot:r})=>{const n=r,i=t?.editorconfig??!0,a=O(w(n,"package.json"));if(!a){e.error("Could not read root package.json. Nothing to sync."),process.exitCode=1;return}const c=te(o.fields),g=o.ignorePackageName??[],d=o.check===!0,F=(o.format??"human").toLowerCase(),v=o.quiet===!0,R=W(n).filter(s=>s!=="."),p=[];let j=0;for(const s of R){const l=w(n,s,"package.json"),h=O(l);if(!h)continue;const $=typeof h.name=="string"?h.name:void 0;if($!==void 0&&g.length>0&&re($,g))continue;j+=1;const P=Z(a,h,{fields:c});P.length!==0&&p.push({filePath:l,packageJsonPath:T(n,l),packageName:$,pkg:h,pkgChanges:P})}if(!d)for(const s of p)ee(s.pkg,s.pkgChanges),I(s.filePath,s.pkg,{indent:B(s.filePath,{useEditorconfig:i}),overwrite:!0});const f=p.flatMap(s=>s.pkgChanges.map(l=>({after:l.after,before:l.before,field:l.field,packageJsonPath:s.packageJsonPath,packageName:s.packageName}))),A={changes:f,fields:c,kind:"package-json-fields",mode:d?"check":"write",totalChanges:f.length,totalPackages:j};if(F==="json")process.stdout.write(`${JSON.stringify(A,null,4)}
|
|
3
|
+
`);else if(f.length===0)e.info(`All ${j} package${j===1?"":"s"} in sync (fields: ${c.join(", ")}).`);else if(d){if(!v)for(const s of f)e.error(`${s.packageJsonPath}: ${s.field} drifts from root`);e.error(`Found ${f.length} field drift${f.length===1?"":"s"} across ${p.length} package${p.length===1?"":"s"}. Run \`vis sync package-json-fields\` to fix.`)}else{if(!v)for(const s of p)e.info(`${s.packageJsonPath}: synced ${s.pkgChanges.map(l=>l.field).join(", ")}`);e.info(`Synced ${f.length} field${f.length===1?"":"s"} across ${p.length} package${p.length===1?"":"s"}.`)}d&&f.length>0&&(process.exitCode=1)},"runPackageJsonFields"),pe=m(async e=>{const o=e.argument[0];if(!o)throw new Error(`Missing sync kind. Usage: vis sync <kind> (known kinds: ${_.join(", ")})`);if(!e.workspaceRoot)throw new Error("Could not determine workspace root. Run inside a monorepo.");if(o==="codeowners"){ne(e);return}if(o==="package-json-fields"){se(e);return}throw new Error(`Unknown sync kind: "${o}". Known kinds: ${_.join(", ")}.`)},"execute");export{pe as default};
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
var ae=Object.defineProperty;var j=(t,e)=>ae(t,"name",{value:e,configurable:!0});import{createRequire as ce}from"node:module";import{E as p,j as b,q as
|
|
2
|
-
`);for(const[
|
|
3
|
-
`)}for(;;){const
|
|
4
|
-
${p(`Enter choice (1-${String(r.length)}):`)} `);if(
|
|
1
|
+
var ae=Object.defineProperty;var j=(t,e)=>ae(t,"name",{value:e,configurable:!0});import{createRequire as ce}from"node:module";import{aF as Y,E as p,j as b,q as T,p as l}from"./bin.js";import{i as _,M as N,a as Q,O as L,z as X,y as pe,h as Z,B as fe,C as ue}from"../packem_shared/otel-CO8UEfTa.js";import{f as we}from"../packem_shared/giget-CcEy_Elm.js";const le=ce(import.meta.url),x=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,P=j(t=>{if(typeof x<"u"&&x.versions&&x.versions.node){const[e,r]=x.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return x.getBuiltinModule(t)}return le(t)},"__cjs_getBuiltinModule"),{fileURLToPath:de}=P("node:url"),{createInterface:me}=P("node:readline"),{mkdtempSync:he,rmSync:ge}=P("node:fs"),{tmpdir:$e}=P("node:os"),{spawnSync:ye}=P("node:child_process");var ve=Object.defineProperty,y=j((t,e)=>ve(t,"name",{value:e,configurable:!0}),"i");const ee=[".ts",".mts",".cts",".js",".mjs",".cjs"],be="template.yml",Te=[".d",".test",".spec",".config",".bench",".stories"],Se=[".d.ts",".d.mts",".d.cts",".js.map",".mjs.map",".cjs.map",".ts.map"],te=y(t=>{for(const e of ee)if(t.endsWith(e))return t.slice(0,-e.length);return t},"stripExtension"),Oe=y(t=>{if(Se.some(r=>t.endsWith(r))||!ee.some(r=>t.endsWith(r)))return!1;const e=te(t);return!Te.some(r=>e.endsWith(r))},"isNativeFile"),J=y((t,e)=>{const r=[];if(!_(t))return r;for(const s of Y(t,{includeDirs:!1,includeSymlinks:!1,maxDepth:1})){if(!Oe(s.name))continue;const n=te(s.name);r.push({load:y(()=>Ne(s.path),"load"),name:n,path:s.path,source:e})}return r},"scanNativeDirectory"),q=y((t,e)=>{const r=[];if(!_(t))return r;for(const s of Y(t,{includeFiles:!1,includeSymlinks:!1,maxDepth:1})){if(s.path===t)continue;const n=N(s.path,be);_(n)&&r.push({load:y(()=>Re(s.path,s.name),"load"),name:s.name,path:s.path,source:e})}return r},"scanMoonDirectory"),je=y(()=>{try{const t=de(import.meta.url),e=N(Q(t),"..","..","templates");return _(e)?e:void 0}catch{return}},"resolveBuiltinTemplatesDirectory"),I=y(t=>{const{extraDirectories:e=[],onWarning:r,workspaceRoot:s}=t,n=[...J(N(s,".vis","templates"),"native"),...q(N(s,".vis","templates"),"moon"),...q(N(s,".moon","templates"),"moon")];for(const o of e)n.push(...q(o,"config")),n.push(...J(o,"config"));const i=je();i&&n.push(...q(i,"builtin"));const a=new Map;for(const o of n){const c=a.get(o.name);if(!c){a.set(o.name,o);continue}r&&r(`Template "${o.name}" exists in multiple sources — using ${c.source} (${c.path}), ignoring ${o.source} (${o.path}).`)}return[...a.values()].sort((o,c)=>o.name.localeCompare(c.name))},"discoverTemplates"),Ne=y(async t=>{const{loadNativeTemplate:e}=await import("./loader.js");return e(t)},"loadNativeFromPath"),Re=y(async(t,e)=>{const{loadMoonTemplate:r}=await import("./index.js");return r(t,e)},"loadMoonFromPath");var Ee=Object.defineProperty,v=j((t,e)=>Ee(t,"name",{value:e,configurable:!0}),"c");const M=v((t,e)=>new Promise(r=>{t.question(e,s=>{r(s.trim())})}),"ask"),ke=v(async(t,e,r)=>{const s=await M(t,` ${e} ${p(r?"[Y/n]":"[y/N]")} `);return s===""?r:s.toLowerCase()==="y"||s.toLowerCase()==="yes"},"confirm"),xe=v(async(t,e,r,s)=>{process.stderr.write(` ${e}
|
|
2
|
+
`);for(const[n,i]of r.entries()){const a=b(T(` ${String(n+1)}.`)),o=i===s?p(" (default)"):"";process.stderr.write(`${a} ${i}${o}
|
|
3
|
+
`)}for(;;){const n=await M(t,`
|
|
4
|
+
${p(`Enter choice (1-${String(r.length)}):`)} `);if(n===""&&s!==void 0)return s;const i=Number.parseInt(n,10);if(Number.isInteger(i)&&i>=1&&i<=r.length)return r[i-1];const a=r.find(o=>o===n);if(a)return a;process.stderr.write(` ${p("Invalid choice. Try again.")}
|
|
5
5
|
`)}},"selectOne"),_e=v(async(t,e,r,s)=>{process.stderr.write(` ${e} ${p("(comma-separated numbers)")}
|
|
6
|
-
`);for(const[
|
|
7
|
-
`)}for(;;){const
|
|
8
|
-
${p("Enter choices:")} `);if(
|
|
9
|
-
`)}},"selectMany"),
|
|
10
|
-
`)}}else{Z(e.destination);let
|
|
11
|
-
`),l.notice("Next steps:");for(const
|
|
12
|
-
`)}},"runTemplate");var Ge=Object.defineProperty
|
|
13
|
-
`)}},"printList"),Xe
|
|
6
|
+
`);for(const[n,i]of r.entries()){const a=b(T(` ${String(n+1)}.`)),o=s.includes(i)?p(" (default)"):"";process.stderr.write(`${a} ${i}${o}
|
|
7
|
+
`)}for(;;){const n=await M(t,`
|
|
8
|
+
${p("Enter choices:")} `);if(n===""&&s.length>0)return s;const i=n.split(",").map(a=>Number.parseInt(a.trim(),10)).filter(a=>Number.isInteger(a)&&a>=1&&a<=r.length);if(i.length>0)return i.map(a=>r[a-1]);process.stderr.write(` ${p("Invalid choice. Try again.")}
|
|
9
|
+
`)}},"selectMany"),Pe=v(t=>` ${p(`${t}:`)} `,"promptText"),De=v((t,e)=>e.prompt??t,"variableLabel"),We=v(t=>Object.entries(t).sort(([e,r],[s,n])=>{const i=r.order??0,a=n.order??0;return i!==a?i-a:e.localeCompare(s)}),"sortVariables"),H=v((t,e)=>{switch(t.type){case"array":return e.split(",").map(r=>r.trim()).filter(Boolean);case"boolean":return e==="true"||e==="1"||e==="yes"||e==="y";case"enum":return t.multiple?e.split(",").map(r=>r.trim()).filter(Boolean):e;case"number":{const r=Number(e);if(Number.isNaN(r))throw new TypeError(`Expected a number, got "${e}"`);return r}default:return e}},"parseValue"),A=v((t,e,r)=>{if(e.type==="enum"){const s=Array.isArray(r)?r:[r];for(const n of s)if(typeof n!="string"||!e.values.includes(n))throw new Error(`Variable "${t}" must be one of: ${e.values.join(", ")} (got "${String(n)}")`)}},"validateValue"),Be=v(async t=>{const{defaults:e,interactive:r,overrides:s,variables:n}=t,i={},a=r?me({input:process.stdin,output:process.stderr}):null;try{for(const[o,c]of We(n)){if(Object.hasOwn(s,o)){const $=H(c,s[o]??"");A(o,c,$),i[o]=$;continue}if(e||!r||c.internal){if(c.default!==void 0){A(o,c,c.default),i[o]=c.default;continue}if(c.required)throw new Error(`Required variable "${o}" not provided. Pass --${o}=<value> or remove --defaults.`);continue}const g=De(o,c);let m;if(c.type==="boolean")m=await ke(a,g,!!(c.default??!1));else if(c.type==="enum")if(c.multiple){const $=Array.isArray(c.default)?c.default:[];m=await _e(a,g,c.values,$)}else{const $=typeof c.default=="string"?c.default:void 0;m=await xe(a,g,c.values,$)}else{const $=c.default===void 0?"":` (${String(c.default)})`,S=await M(a,Pe(`${g}${$}`));if(S===""&&c.default!==void 0)m=c.default;else if(S===""){if(c.required)throw new Error(`Variable "${o}" is required`);continue}else m=H(c,S)}A(o,c,m),i[o]=m}return i}finally{a?.close()}},"collectOptions");var qe=Object.defineProperty,V=j((t,e)=>qe(t,"name",{value:e,configurable:!0}),"o");const Ie=["git://","npm://","https://","github:","gitlab:","bitbucket:","sourcehut:"],Me=V(t=>Ie.some(e=>t.startsWith(e)),"isRemoteSource"),Ce=V(async(t,e={})=>{const r=e.targetDirectory===void 0,s=e.targetDirectory??he(N($e(),"vis-generate-")),n=V(()=>{if(r)try{ge(s,{force:!0,recursive:!0})}catch{}},"cleanup");l.info(`Downloading ${t}…`);try{const i=await we(t,{auth:e.auth||process.env.GIGET_AUTH||process.env.GITHUB_TOKEN||process.env.GH_TOKEN||void 0,dir:s,force:!0,preferOffline:e.preferOffline});return{cleanup:n,directory:i.dir}}catch(i){n();const a=i instanceof Error?i.message:String(i);throw l.warn(`Failed to download template: ${a}`),i}},"fetchRemoteTemplate");var Fe=Object.defineProperty,R=j((t,e)=>Fe(t,"name",{value:e,configurable:!0}),"a");const re=R((t,e="")=>{const r=[];for(const[s,n]of Object.entries(t)){const i=e?`${e}/${s}`:s;typeof n=="string"||Buffer.isBuffer(n)?r.push({content:n,path:i}):n&&typeof n=="object"&&r.push(...re(n,i))}return r},"flattenTree"),Ae=R(t=>t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`,"formatSize"),Le=R((t,e)=>{if(L(e))throw new Error(`Refusing to write outside destination: template produced absolute path "${e}".`);const r=N(t,e),s=X(t,r);if(s===".."||s.startsWith(`..${pe}`)||L(s))throw new Error(`Refusing to write outside destination: "${e}" resolves to "${r}" which escapes "${t}".`);return r},"safeJoinDestination"),Ve=R((t,e)=>{Z(Q(t)),fe(t,e)},"writeOne"),ze=R((t,e,r=!1)=>{const s=typeof t=="string"?[t]:t.commands,n=typeof t=="string"?r:t.silent??r;for(const i of s){n||l.info(`$ ${i}`);const a=ye(i,{cwd:e,shell:!0,stdio:n?"ignore":"inherit"});if(a.status!==0)return l.warn(`Script failed (exit ${String(a.status)}): ${i}`),!1}return!0},"runScript"),Ke=R(t=>{const e=new Map;for(const r of t){const s=typeof r=="string"?0:r.phase??0,n=e.get(s);n?n.push(r):e.set(s,[r])}return[...e.entries()].sort(([r],[s])=>r-s)},"groupByPhase"),Ue=R(async(t,e)=>{const r={builtins:{dest_dir:e.destination,dest_rel_dir:X(e.workspaceRoot,e.destination)||".",working_dir:e.cwd,workspace_root:e.workspaceRoot},options:e.options},s=await t.produce(r),n=s.files?re(s.files):[],i=s.filesMeta??{},a=[];for(const o of n){const c=Le(e.destination,o.path);a.push({file:o,meta:i[o.path]??{},target:c})}if(e.dryRun){l.info(`${b(T("Plan"))} ${p("(dry-run, no files written)")}`);for(const o of a){const c=Buffer.isBuffer(o.file.content)?o.file.content.length:Buffer.byteLength(o.file.content,"utf8");process.stderr.write(` ${p("write")} ${o.file.path} ${p(`(${Ae(c)})`)}
|
|
10
|
+
`)}}else{Z(e.destination);let o=0,c=0;for(const g of a){const{file:m,meta:$,target:S}=g,C=_(S),O=e.force||$.force===!0;if(C&&!O){l.warn(`Skipped existing file: ${m.path} (use --force or set frontmatter force: true to overwrite)`),c+=1;continue}Ve(S,m.content),o+=1}l.success(`Wrote ${String(o)} file${o===1?"":"s"}${c>0?`, skipped ${String(c)}`:""}`)}if(!e.dryRun&&!e.skipScripts&&s.scripts&&s.scripts.length>0){const o=Ke(s.scripts);l.info(`Running ${String(s.scripts.length)} script${s.scripts.length===1?"":"s"} across ${String(o.length)} phase${o.length===1?"":"s"}…`);for(const[,c]of o)if((await Promise.all(c.map(g=>Promise.resolve(ze(g,e.destination))))).includes(!1))throw new Error("Script failed — aborting.")}if(s.suggestions&&s.suggestions.length>0){process.stderr.write(`
|
|
11
|
+
`),l.notice("Next steps:");for(const o of s.suggestions)process.stderr.write(` ${p("•")} ${o}
|
|
12
|
+
`)}},"runTemplate");var Ge=Object.defineProperty,w=j((t,e)=>Ge(t,"name",{value:e,configurable:!0}),"u");const Je=w(async t=>{let e;try{e=(await t.load()).about?.description}catch{}return{description:e,name:t.name,path:t.path,source:t.source}},"toListEntry"),He=w((t,e)=>{const r={default:e.default,name:t,order:e.order,prompt:e.prompt,required:e.required,type:e.type};return e.type==="enum"&&(r.multiple=e.multiple,r.values=e.values),r},"summarizeVariable"),Ye=w(async t=>{const e=await t.load(),r=Object.entries(e.options??{}).sort(([s,n],[i,a])=>{const o=n.order??0,c=a.order??0;return o===c?s.localeCompare(i):o-c}).map(([s,n])=>He(s,n));return{description:e.about?.description??"",destination:e.destination,name:t.name,path:t.path,source:t.source,variables:r}},"describeTemplate"),Qe=w(t=>{if(t.length===0){l.info("No templates found."),l.notice("Create one at .vis/templates/<name>.ts (programmatic) or .vis/templates/<name>/ (moon-format with template.yml).");return}l.info("Available templates:");for(const e of t){const r=p(`(${e.source})`);process.stderr.write(` ${b(T(e.name))} ${r}
|
|
13
|
+
`)}},"printList"),Xe=w(t=>{const e={},r=[];for(const s of t){if(!s.startsWith("--")){r.push(s);continue}const n=s.indexOf("=");if(n===-1){const o=s.slice(2);o.startsWith("no-")?e[o.slice(3)]="false":e[o]="true";continue}const i=s.slice(2,n),a=s.slice(n+1);e[i]=a}return{overrides:e,remaining:r}},"parsePassthroughOverrides"),Ze=w(async t=>{const{createInterface:e}=await import("node:readline"),r=e({input:process.stdin,output:process.stderr});try{process.stderr.write(` ${b(T("vis generate"))} ${p("— pick a template")}
|
|
14
14
|
|
|
15
|
-
`);for(const[s,
|
|
16
|
-
`)}return new Promise((s,
|
|
17
|
-
${p(`Enter choice (1-${String(t.length)}):`)} `,i=>{const a=Number.parseInt(i.trim(),10);Number.isInteger(a)&&a>=1&&a<=t.length?s(t[a-1].name):
|
|
18
|
-
`);return}Qe(u);return}if(e.describe){const u=c[0];if(!u)throw new Error("`--describe` requires a template name. Run `vis generate --list` to see available templates.");const f=I({extraDirectories:
|
|
19
|
-
`);return}if(l.info(`Template: ${b(
|
|
20
|
-
`)}}return}let g=[...r??[]];if(g.length===0){const u=process.argv.slice(2),f=u.indexOf("--");f!==-1&&(g=u.slice(f+1))}const m=c.indexOf("--")
|
|
21
|
-
`);const ie=await
|
|
22
|
-
`),l.success(`Template '${
|
|
15
|
+
`);for(const[s,n]of t.entries()){const i=b(T(` ${String(s+1)}.`));process.stderr.write(`${i} ${n.name} ${p(`(${n.source})`)}
|
|
16
|
+
`)}return new Promise((s,n)=>{r.question(`
|
|
17
|
+
${p(`Enter choice (1-${String(t.length)}):`)} `,i=>{const a=Number.parseInt(i.trim(),10);Number.isInteger(a)&&a>=1&&a<=t.length?s(t[a-1].name):n(new Error("Invalid choice."))})})}finally{r.close()}},"pickInteractive"),nt=w(async({argument:t,options:e,rawUnknown:r,visConfig:s,workspaceRoot:n})=>{const i=e.cwd||n||process.cwd(),a=n??i,o=s?.generator,c=Array.isArray(t)?t:t?[t]:[];if(e.list){const u=I({extraDirectories:o?.templates??[],onWarning:w(f=>{l.warn(f)},"onWarning"),workspaceRoot:a});if(e.json){const f=await Promise.all(u.map(d=>Je(d)));process.stdout.write(`${JSON.stringify(f,null,2)}
|
|
18
|
+
`);return}Qe(u);return}if(e.describe){const u=c[0];if(!u)throw new Error("`--describe` requires a template name. Run `vis generate --list` to see available templates.");const f=I({extraDirectories:o?.templates??[],onWarning:w(h=>{l.warn(h)},"onWarning"),workspaceRoot:a}).find(h=>h.name===u);if(!f)throw new Error(`Template "${u}" not found. Run \`vis generate --list\` to see available templates.`);const d=await Ye(f);if(e.json){process.stdout.write(`${JSON.stringify(d,null,2)}
|
|
19
|
+
`);return}if(l.info(`Template: ${b(T(d.name))} ${p(`(${d.source})`)}`),d.description&&l.info(d.description),d.destination&&l.info(`Destination: ${p(d.destination)}`),d.variables.length===0)l.info("No variables.");else{l.info("Variables:");for(const h of d.variables){const B=[h.type];h.required&&B.push("required"),h.default!==void 0&&B.push(`default=${JSON.stringify(h.default)}`),h.values&&B.push(`values=${h.values.join("|")}`),process.stderr.write(` ${b(T(h.name))} ${p(`(${B.join(", ")})`)}
|
|
20
|
+
`)}}return}let g=[...r??[]];if(g.length===0){const u=process.argv.slice(2),f=u.indexOf("--");f!==-1&&(g=u.slice(f+1))}const m=c.indexOf("--"),$=m===-1?[]:c.slice(m+1),S=m===-1?c:c.slice(0,m),{overrides:C}=Xe([...$,...g]);let O,D,W;const k=S[0];let F;if(k&&Me(k)){const u=await Ce(k,{auth:o?.auth,preferOffline:!!e.preferOffline||o?.preferOffline});F=u.cleanup;try{const f=I({extraDirectories:[u.directory],workspaceRoot:a}).find(d=>d.path.startsWith(u.directory));if(!f)throw new Error(`Downloaded template at ${u.directory} contains no template.yml or *.ts entrypoint.`);O=await f.load(),D=f.name,W=O.destination}catch(f){throw F(),f}}else{const u=I({extraDirectories:o?.templates??[],onWarning:w(h=>{l.warn(h)},"onWarning"),workspaceRoot:a});if(u.length===0)throw new Error("No templates found. Create one at .vis/templates/<name>.ts or .vis/templates/<name>/template.yml.");let f;if(k)f=k;else{if(e.interactive===!1||!process.stdin.isTTY)throw new Error("No template specified. Pass a template name (see `vis generate --list`) or run interactively in a terminal.");f=await Ze(u)}const d=u.find(h=>h.name===f);if(!d)throw new Error(`Template "${f}" not found. Run 'vis generate --list' to see available templates.`);O=await d.load(),D=d.name,W=O.destination}const z=e.to,K=!!e.dryRun,se=!!e.force,U=!!e.defaults,oe=!!e.skipScripts,ne=e.interactive!==!1&&!!process.stdin.isTTY&&!U;let E;z?E=z:W?E=W:E=".";const G=L(E)?E:ue(i,E);l.info(`Template: ${b(T(D))}`),l.info(`Target: ${p(G)}`),process.stderr.write(`
|
|
21
|
+
`);const ie=await Be({defaults:U,interactive:ne,overrides:C,variables:O.options??{}});try{await Ue(O,{cwd:i,destination:G,dryRun:K,force:se,options:ie,skipScripts:oe,workspaceRoot:a}),K||(process.stderr.write(`
|
|
22
|
+
`),l.success(`Template '${D}' applied.`))}finally{F?.()}},"execute");export{nt as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var oe=Object.defineProperty;var E=(o,e)=>oe(o,"name",{value:e,configurable:!0});import{createRequire as ie}from"node:module";import{aA as z,E as k,j as S,q as W,y as ce,m as ae,s as pe}from"./bin.js";import{projectGraphToDot as he}from"@visulima/task-runner";import{Box as i,Text as t,ScrollView as ue,ScrollBar as fe,useApp as ge,useWindowSize as me,useInput as xe,Dialog as be,render as ye}from"@visulima/tui";import we,{useSyncExternalStore as ve,useState as O,useRef as q,useMemo as _,useCallback as U,useEffect as Ce}from"react";import{jsx as n,jsxs as r}from"react/jsx-runtime";const le=ie(import.meta.url),I=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,de=E(o=>{if(typeof I<"u"&&I.versions&&I.versions.node){const[e,l]=I.versions.node.split(".").map(Number);if(e>22||e===22&&l>=3||e===20&&l>=16)return I.getBuiltinModule(o)}return le(o)},"__cjs_getBuiltinModule"),{writeFileSync:se}=de("node:fs");var Ae=Object.defineProperty,$=E((o,e)=>Ae(o,"name",{value:e,configurable:!0}),"n");const ke=$(o=>{const e=new Map;for(const[l,d]of Object.entries(o.dependencies))for(const c of d){const s=e.get(c.target)??[];s.push(l),e.set(c.target,s)}return Object.values(o.nodes).map(l=>({deps:o.dependencies[l.name]??[],name:l.name,reverseDeps:e.get(l.name)??[],type:l.type})).sort((l,d)=>l.type!==d.type?l.type==="application"?-1:1:l.name.localeCompare(d.name))},"buildNodes"),Ee=$((o,e,l)=>{let d=o;if(e==="app"?d=d.filter(c=>c.type==="application"):e==="lib"&&(d=d.filter(c=>c.type!=="application")),l){const c=l.toLowerCase();d=d.filter(s=>s.name.toLowerCase().includes(c))}return d},"filterNodes");class Me{static{E(this,"GraphStore")}static{$(this,"GraphStore")}#e;#n=new Set;#r;constructor(e){this.#r=e;const l=ke(e);this.#e={allNodes:l,filterActive:!1,filterText:"",filterType:"all",focusedPanel:"list",selectedIndex:0}}getSnapshot=$(()=>this.#e,"getSnapshot");subscribe=$(e=>(this.#n.add(e),()=>{this.#n.delete(e)}),"subscribe");getFilteredNodes(){return Ee(this.#e.allNodes,this.#e.filterType,this.#e.filterText)}getStats(){const e=this.#e.allNodes.filter(c=>c.type==="application").length,l=this.#e.allNodes.length,d=Object.values(this.#r.dependencies).reduce((c,s)=>c+s.length,0);return{apps:e,deps:d,libs:l-e,total:l}}setSelectedIndex(e){const l=this.getFilteredNodes(),d=l.length===0?-1:Math.max(0,Math.min(e,l.length-1));d!==this.#e.selectedIndex&&this.#t({...this.#e,selectedIndex:d})}setFocusedPanel(e){e!==this.#e.focusedPanel&&this.#t({...this.#e,focusedPanel:e})}setFilterType(e){e!==this.#e.filterType&&this.#t({...this.#e,filterType:e,selectedIndex:0})}setFilter(e){this.#t({...this.#e,filterText:e,selectedIndex:0})}setFilterActive(e){e!==this.#e.filterActive&&this.#t({...this.#e,filterActive:e,filterText:e?this.#e.filterText:"",selectedIndex:e?this.#e.selectedIndex:0})}#t(e){this.#e=e;for(const l of this.#n)try{l()}catch{}}}var Te=Object.defineProperty,Se=E((o,e)=>Te(o,"name",{value:e,configurable:!0}),"p");const je=Se(({focused:o,node:e,scrollRef:l})=>{const d=o?"white":"gray";if(!e)return n(i,{alignItems:"center",borderColor:"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,justifyContent:"center",children:n(t,{dimColor:!0,children:"No project selected"})});const c=e.type==="application",s=c?"yellow":"cyan",u=c?"Application":"Library";return n(i,{borderColor:d,borderStyle:"single",borderTopRightTitle:` ${u} `,borderTopTitle:` ${e.name} `,flexDirection:"column",flexGrow:1,children:r(ue,{flexGrow:1,flexShrink:1,paddingX:2,ref:l,scrollbar:!0,scrollbarColor:"gray",children:[r(i,{flexDirection:"column",marginTop:1,children:[r(i,{children:[n(t,{dimColor:!0,children:"── "}),n(t,{bold:!0,color:"white",children:"DEPENDS ON"}),r(t,{dimColor:!0,children:[" ","(",e.deps.length,")"]})]}),e.deps.length===0?n(i,{marginTop:1,paddingLeft:2,children:n(t,{dimColor:!0,children:"No dependencies"})}):n(i,{flexDirection:"column",marginTop:1,children:e.deps.map(a=>r(i,{gap:1,paddingLeft:2,children:[n(t,{color:"cyan",children:"→"}),n(t,{children:a.target}),a.type!=="static"&&r(t,{dimColor:!0,children:["(",a.type,")"]})]},a.target))})]}),r(i,{flexDirection:"column",marginTop:1,children:[r(i,{children:[n(t,{dimColor:!0,children:"── "}),n(t,{bold:!0,color:"white",children:"REQUIRED BY"}),r(t,{dimColor:!0,children:[" ","(",e.reverseDeps.length,")"]})]}),e.reverseDeps.length===0?n(i,{marginTop:1,paddingLeft:2,children:n(t,{dimColor:!0,children:"No reverse dependencies"})}):n(i,{flexDirection:"column",marginTop:1,children:e.reverseDeps.map(a=>r(i,{gap:1,paddingLeft:2,children:[n(t,{color:"magenta",children:"←"}),n(t,{children:a})]},a))})]}),r(i,{flexDirection:"column",marginTop:1,children:[r(i,{children:[n(t,{dimColor:!0,children:"── "}),n(t,{bold:!0,color:"white",children:"INFO"})]}),r(i,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[r(i,{children:[n(i,{width:16,children:n(t,{dimColor:!0,children:"Type:"})}),n(t,{color:s,children:u})]}),r(i,{children:[n(i,{width:16,children:n(t,{dimColor:!0,children:"Dependencies:"})}),n(t,{children:String(e.deps.length)})]}),r(i,{children:[n(i,{width:16,children:n(t,{dimColor:!0,children:"Required by:"})}),n(t,{children:String(e.reverseDeps.length)})]}),r(i,{children:[n(i,{width:16,children:n(t,{dimColor:!0,children:"Connectivity:"})}),n(t,{children:String(e.deps.length+e.reverseDeps.length)})]})]})]})]})})},"ProjectDetailPanel");var De=Object.defineProperty,B=E((o,e)=>De(o,"name",{value:e,configurable:!0}),"g");const Ne=[{key:"all",label:"All",shortcut:"1"},{key:"app",label:"Apps",shortcut:"2"},{key:"lib",label:"Libs",shortcut:"3"}],Y=B(({isSelected:o,node:e})=>{const l=e.type==="application",d=l?"yellow":"cyan",c=l?"app":"lib";return r(i,{flexShrink:0,height:1,children:[r(t,{children:[o?"▶":" "," "]}),n(i,{flexGrow:1,children:n(t,{bold:o,inverse:o,wrap:"truncate",children:e.name})}),r(t,{color:d,children:[" ",c]}),r(t,{dimColor:!0,children:[" ","→",e.deps.length," ","←",e.reverseDeps.length]})]})},"ProjectRow"),X=B(({count:o,label:e})=>r(i,{flexShrink:0,height:1,marginTop:1,children:[r(t,{dimColor:!0,children:["▼"," "]}),n(t,{bold:!0,color:"white",children:e.toUpperCase()}),r(t,{dimColor:!0,children:[" ","(",o,")"]})]}),"TypeHeader"),Ie=B(({filterActive:o,filterText:e,filterType:l,focused:d,nodes:c,scrollOffset:s,selectedIndex:u,stats:a,viewportHeight:y})=>{const g=d?"white":"gray",v=c.filter(w=>w.type==="application"),h=c.filter(w=>w.type!=="application"),f=[];let x=0;if(v.length>0){f.push(n(X,{count:v.length,label:"Applications"},"hdr-apps"));for(const w of v){const A=x;f.push(n(Y,{isSelected:A===u,node:w},w.name)),x++}}if(h.length>0){f.push(n(X,{count:h.length,label:"Libraries"},"hdr-libs"));for(const w of h){const A=x;f.push(n(Y,{isSelected:A===u,node:w},w.name)),x++}}let C=0;v.length>0&&(C+=2+v.length),h.length>0&&(C+=2+h.length);const M=C>y&&y>0;return r(i,{borderColor:g,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[r(i,{flexShrink:0,gap:1,paddingX:1,children:[n(t,{bold:!0,inverse:!0,children:" VIS "}),r(t,{wrap:"truncate",children:[a.total," ","packages"]}),r(t,{dimColor:!0,children:["(",a.apps," ","apps,"," ",a.libs," ","libs,"," ",a.deps," ","deps)"]})]}),n(i,{flexShrink:0,gap:1,paddingX:1,paddingY:1,children:Ne.map(w=>{const A=l===w.key;return r(i,{children:[n(t,{dimColor:!A,children:"["}),n(t,{bold:A,color:A?"cyan":"gray",children:w.shortcut}),n(t,{dimColor:!A,children:"]"}),r(t,{color:A?"white":"gray",children:[" ",w.label]})]},w.key)})}),o&&r(i,{flexShrink:0,paddingX:1,children:[n(t,{bold:!0,color:"white",children:"/ "}),n(t,{children:e}),n(t,{inverse:!0,children:" "})]}),r(i,{flexDirection:"row",flexGrow:1,overflow:"hidden",children:[n(i,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:n(i,{flexDirection:"column",marginTop:-s,children:f})}),M&&n(i,{flexShrink:0,marginLeft:1,marginRight:1,children:n(fe,{contentHeight:C,placement:"inset",scrollOffset:s,style:"block",viewportHeight:y})})]})]})},"ProjectListPanel");var $e=Object.defineProperty,Pe=E((o,e)=>$e(o,"name",{value:e,configurable:!0}),"M$1");const Le=100,Oe=40,Be=10,J={1:"all",2:"app",3:"lib"},Re=Pe(({autoExitSeconds:o=0,store:e})=>{const{exit:l}=ge(),{columns:d,rows:c}=me(),s=ve(e.subscribe,e.getSnapshot),[u,a]=O(!1),y=q(null),g=q(null),[v,h]=O(0),[f,x]=O(!1),C=_(()=>e.getFilteredNodes(),[s.allNodes,s.filterType,s.filterText]),M=_(()=>e.getStats(),[s.allNodes]),w=C[s.selectedIndex]??null,A=U(m=>{const p=C.filter(T=>T.type==="application"),b=C.filter(T=>T.type!=="application");let j=0,L=0;if(p.length>0){j+=2;for(let T=0;T<p.length;T++){if(L===m)return j;j+=1,L++}}if(b.length>0){j+=2;for(let T=0;T<b.length;T++){if(L===m)return j;j+=1,L++}}return j},[C]),P=Math.max(1,c-8-(s.filterActive?1:0)),N=U(m=>{const p=A(m);h(b=>p>b+P-2?Math.max(0,p-P+2):p<b+1?Math.max(0,p-1):b)},[A,P]);if(Ce(()=>{g.current?.scrollToTop()},[w?.name]),xe((m,p)=>{if(m==="c"&&p.ctrl){l();return}if(!f){if(u){p.escape||m==="?"?a(!1):m==="q"?(a(!1),x(!0)):p.downArrow||m==="j"?y.current?.scrollBy(1):(p.upArrow||m==="k")&&y.current?.scrollBy(-1);return}if(m==="?"){a(!0);return}if(m==="q"){x(!0);return}if(p.tab){e.setFocusedPanel(s.focusedPanel==="list"?"detail":"list");return}if(J[m]){e.setFilterType(J[m]);return}if(s.filterActive){if(p.escape){e.setFilterActive(!1);return}if(p.return){e.setFilterActive(!1);return}if(p.backspace){e.setFilter(s.filterText.slice(0,-1));return}if(m&&!p.ctrl&&!p.meta){e.setFilter(s.filterText+m);return}return}if(s.focusedPanel==="list"){if(C.length===0){m==="/"&&e.setFilterActive(!0);return}if(p.downArrow||m==="j"){const b=Math.min(s.selectedIndex+1,C.length-1);e.setSelectedIndex(b),N(b);return}if(p.upArrow||m==="k"){const b=Math.max(s.selectedIndex-1,0);e.setSelectedIndex(b),N(b);return}if(p.pageDown){const b=Math.min(s.selectedIndex+10,C.length-1);e.setSelectedIndex(b),N(b);return}if(p.pageUp){const b=Math.max(s.selectedIndex-10,0);e.setSelectedIndex(b),N(b);return}if(p.home){e.setSelectedIndex(0),h(0);return}if(p.end){const b=C.length-1;e.setSelectedIndex(b),N(b);return}if(m==="/"){e.setFilterActive(!0);return}if(p.rightArrow){e.setFocusedPanel("detail");return}return}if(s.focusedPanel==="detail"){if(p.escape||p.leftArrow){e.setFocusedPanel("list");return}if(p.downArrow||m==="j"){g.current?.scrollBy(1);return}if(p.upArrow||m==="k"){g.current?.scrollBy(-1);return}if(p.pageDown){g.current?.scrollBy(10);return}if(p.pageUp){g.current?.scrollBy(-10);return}if(p.home){g.current?.scrollToTop();return}p.end&&g.current?.scrollToBottom()}}},{isActive:!0}),d<Oe||c<Be)return n(i,{alignItems:"center",height:c,justifyContent:"center",width:d,children:r(t,{color:"yellow",children:["Terminal too small (",d,"x",c,")"]})});const ne=d>=Le,R=n(i,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,children:r(i,{flexWrap:"wrap",gap:2,paddingX:1,children:[r(i,{gap:1,children:[n(t,{bold:!0,color:"white",children:"q"}),n(t,{dimColor:!0,children:"QUIT"})]},"q"),r(i,{gap:1,children:[n(t,{bold:!0,color:"white",children:"?"}),n(t,{dimColor:!0,children:"HELP"})]},"?"),r(i,{gap:1,children:[n(t,{bold:!0,color:"white",children:"↑↓"}),n(t,{dimColor:!0,children:"NAV"})]},"nav"),r(i,{gap:1,children:[n(t,{bold:!0,color:"white",children:"1-3 /"}),n(t,{dimColor:!0,children:"FILTER"})]},"f"),r(i,{gap:1,children:[n(t,{bold:!0,color:"white",children:"Tab"}),n(t,{dimColor:!0,children:"PANEL"})]},"t")]})}),F=r(be,{footer:r(t,{dimColor:!0,children:[n(t,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",n(t,{bold:!0,color:"white",children:"?"}),"/",n(t,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:y,title:"KEYBOARD SHORTCUTS",visible:u,width:52,children:[r(i,{flexDirection:"column",marginBottom:1,children:[r(i,{marginBottom:1,children:[n(t,{dimColor:!0,children:"── "}),n(t,{bold:!0,color:"white",children:"NAVIGATION"})]}),r(i,{children:[n(i,{width:24,children:r(t,{children:[r(t,{bold:!0,color:"white",children:[" ","↑","/k"]}),n(t,{dimColor:!0,children:" Move up"})]})}),r(t,{children:[r(t,{bold:!0,color:"white",children:[" ","↓","/j"]}),n(t,{dimColor:!0,children:" Move down"})]})]}),r(t,{children:[r(t,{bold:!0,color:"white",children:[" ","Tab"]}),n(t,{dimColor:!0,children:" Switch panel"})]}),r(t,{children:[r(t,{bold:!0,color:"white",children:[" ","→","/","←"]}),n(t,{dimColor:!0,children:" Focus detail/list"})]}),r(t,{children:[r(t,{bold:!0,color:"white",children:[" ","PgUp/PgDn"]}),n(t,{dimColor:!0,children:" Jump 10 items"})]}),r(t,{children:[r(t,{bold:!0,color:"white",children:[" ","Home/End"]}),n(t,{dimColor:!0,children:" Jump to start/end"})]})]}),r(i,{flexDirection:"column",marginBottom:1,children:[r(i,{marginBottom:1,children:[n(t,{dimColor:!0,children:"── "}),n(t,{bold:!0,color:"white",children:"FILTERS"})]}),r(i,{children:[n(i,{width:24,children:r(t,{children:[r(t,{bold:!0,color:"white",children:[" ","1"]}),n(t,{dimColor:!0,children:" All"})]})}),r(t,{children:[r(t,{bold:!0,color:"white",children:[" ","2"]}),n(t,{dimColor:!0,children:" Apps only"})]})]}),r(t,{children:[r(t,{bold:!0,color:"white",children:[" ","3"]}),n(t,{dimColor:!0,children:" Libraries only"})]}),r(t,{children:[r(t,{bold:!0,color:"white",children:[" ","/"]}),n(t,{dimColor:!0,children:" Text filter"})]})]}),r(i,{flexDirection:"column",children:[r(i,{marginBottom:1,children:[n(t,{dimColor:!0,children:"── "}),n(t,{bold:!0,color:"white",children:"ACTIONS"})]}),r(t,{children:[r(t,{bold:!0,color:"white",children:[" ","q"]}),n(t,{dimColor:!0,children:" Quit"})]}),r(t,{children:[r(t,{bold:!0,color:"white",children:[" ","?"]}),n(t,{dimColor:!0,children:" Toggle help"})]})]})]}),H=n(Ie,{filterActive:s.filterActive,filterText:s.filterText,filterType:s.filterType,focused:s.focusedPanel==="list",nodes:C,scrollOffset:v,selectedIndex:s.selectedIndex,stats:M,viewportHeight:P}),G=n(je,{focused:s.focusedPanel==="detail",node:w,scrollRef:g});if(ne){const m=Math.floor(d*.35);return r(i,{flexDirection:"column",height:c,width:d,children:[r(i,{flexDirection:"row",flexGrow:1,children:[n(i,{flexGrow:1,children:H}),n(i,{width:m,children:G})]}),R,n(z,{autoExitSeconds:o??3,onCancel:E(()=>{x(!1)},"onCancel"),visible:f}),F]})}const re=Math.floor(c*.55);return r(i,{flexDirection:"column",height:c,width:d,children:[n(i,{height:re,children:H}),n(i,{flexGrow:1,children:G}),R,n(z,{autoExitSeconds:o??3,onCancel:E(()=>{x(!1)},"onCancel"),visible:f}),F]})},"VisGraphApp");var V=Object.freeze,ee=Object.defineProperty,D=E((o,e)=>ee(o,"name",{value:e,configurable:!0}),"x"),Fe=E((o,e)=>V(ee(o,"raw",{value:V(e||o.slice())})),"C");const te=D((o,e,l,d,c,s,u,a)=>{const y=l?k("└── "):k("├── "),g=c.has(o),v=g?k(" (*)"):"",h=d.get(o),f=h?.type==="application"?S(o):o;if(s.push(`${e}${y}${f}${v}`),g)return;c.add(o);const x=h?.deps??[],C=l?`${e} `:`${e}${k("│")} `;if(a>=u&&x.length>0){s.push(`${C}${k(`... ${x.length} more`)}`);return}for(let M=0;M<x.length;M++){const w=x[M];w&&te(w.target,C,M===x.length-1,d,c,s,u,a+1)}},"printDepsTree"),Q=D((o,e,l,d,c,s)=>{const u=e.get(o),a=u?.type==="application"?S(o):o;d.push(`${s}${a}`),l.add(o);const y=u?.deps??[];if(y.length===0){d.push(`${s} ${k("(no dependencies)")}`);return}if(c<=0){d.push(`${s} ${k(`... ${y.length} dependencies`)}`);return}for(let g=0;g<y.length;g++){const v=y[g];v&&te(v.target,s,g===y.length-1,e,l,d,c,1)}},"printRootProject"),K=D((o,e)=>{const l=new Map;for(const[h,f]of Object.entries(o.nodes))l.set(h,{deps:(o.dependencies[h]??[]).map(x=>({target:x.target,type:x.type})),name:h,type:f.type});const d=[],c=[];for(const[h,f]of l)f.type==="application"?d.push(h):c.push(h);d.sort(),c.sort();const s=d.length+c.length,u=Object.values(o.dependencies).reduce((h,f)=>h+f.length,0),a=[S("Project Dependency Graph"),""];if(d.length>0){a.push(` ${S(W(`Applications (${d.length})`))}`,"");for(const h of d)Q(h,l,new Set,a,e," "),a.push("")}if(c.length>0){a.push(` ${S(W(`Libraries (${c.length})`))}`,"");for(const h of c)Q(h,l,new Set,a,e," "),a.push("")}const y=process.stdout.columns||80;a.push(k("─".repeat(Math.min(y,60)))),a.push(`${S(String(s))} packages ${k("·")} ${S(String(u))} dependencies ${k("·")} ${S(String(d.length))} apps${k(",")} ${S(String(c.length))} libraries`);const g=new Set;let v=!1;for(const h of[...d,...c]){const f=l.get(h)?.deps??[];for(const x of f)g.has(x.target)&&(v=!0),g.add(x.target);g.add(h)}return v&&a.push(k("(*) = already shown above")),a.join(`
|
|
1
|
+
var oe=Object.defineProperty;var E=(o,e)=>oe(o,"name",{value:e,configurable:!0});import{createRequire as ie}from"node:module";import{aG as z,E as k,j as S,q as W,y as ce,m as ae,s as pe}from"./bin.js";import{projectGraphToDot as he}from"@visulima/task-runner";import{Box as i,Text as t,ScrollView as ue,ScrollBar as fe,useApp as ge,useWindowSize as me,useInput as xe,Dialog as be,render as ye}from"@visulima/tui";import we,{useSyncExternalStore as ve,useState as O,useRef as q,useMemo as _,useCallback as U,useEffect as Ce}from"react";import{jsx as n,jsxs as r}from"react/jsx-runtime";const le=ie(import.meta.url),I=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,de=E(o=>{if(typeof I<"u"&&I.versions&&I.versions.node){const[e,l]=I.versions.node.split(".").map(Number);if(e>22||e===22&&l>=3||e===20&&l>=16)return I.getBuiltinModule(o)}return le(o)},"__cjs_getBuiltinModule"),{writeFileSync:se}=de("node:fs");var Ae=Object.defineProperty,$=E((o,e)=>Ae(o,"name",{value:e,configurable:!0}),"n");const ke=$(o=>{const e=new Map;for(const[l,d]of Object.entries(o.dependencies))for(const c of d){const s=e.get(c.target)??[];s.push(l),e.set(c.target,s)}return Object.values(o.nodes).map(l=>({deps:o.dependencies[l.name]??[],name:l.name,reverseDeps:e.get(l.name)??[],type:l.type})).sort((l,d)=>l.type!==d.type?l.type==="application"?-1:1:l.name.localeCompare(d.name))},"buildNodes"),Ee=$((o,e,l)=>{let d=o;if(e==="app"?d=d.filter(c=>c.type==="application"):e==="lib"&&(d=d.filter(c=>c.type!=="application")),l){const c=l.toLowerCase();d=d.filter(s=>s.name.toLowerCase().includes(c))}return d},"filterNodes");class Me{static{E(this,"GraphStore")}static{$(this,"GraphStore")}#e;#n=new Set;#r;constructor(e){this.#r=e;const l=ke(e);this.#e={allNodes:l,filterActive:!1,filterText:"",filterType:"all",focusedPanel:"list",selectedIndex:0}}getSnapshot=$(()=>this.#e,"getSnapshot");subscribe=$(e=>(this.#n.add(e),()=>{this.#n.delete(e)}),"subscribe");getFilteredNodes(){return Ee(this.#e.allNodes,this.#e.filterType,this.#e.filterText)}getStats(){const e=this.#e.allNodes.filter(c=>c.type==="application").length,l=this.#e.allNodes.length,d=Object.values(this.#r.dependencies).reduce((c,s)=>c+s.length,0);return{apps:e,deps:d,libs:l-e,total:l}}setSelectedIndex(e){const l=this.getFilteredNodes(),d=l.length===0?-1:Math.max(0,Math.min(e,l.length-1));d!==this.#e.selectedIndex&&this.#t({...this.#e,selectedIndex:d})}setFocusedPanel(e){e!==this.#e.focusedPanel&&this.#t({...this.#e,focusedPanel:e})}setFilterType(e){e!==this.#e.filterType&&this.#t({...this.#e,filterType:e,selectedIndex:0})}setFilter(e){this.#t({...this.#e,filterText:e,selectedIndex:0})}setFilterActive(e){e!==this.#e.filterActive&&this.#t({...this.#e,filterActive:e,filterText:e?this.#e.filterText:"",selectedIndex:e?this.#e.selectedIndex:0})}#t(e){this.#e=e;for(const l of this.#n)try{l()}catch{}}}var Te=Object.defineProperty,Se=E((o,e)=>Te(o,"name",{value:e,configurable:!0}),"p");const je=Se(({focused:o,node:e,scrollRef:l})=>{const d=o?"white":"gray";if(!e)return n(i,{alignItems:"center",borderColor:"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,justifyContent:"center",children:n(t,{dimColor:!0,children:"No project selected"})});const c=e.type==="application",s=c?"yellow":"cyan",u=c?"Application":"Library";return n(i,{borderColor:d,borderStyle:"single",borderTopRightTitle:` ${u} `,borderTopTitle:` ${e.name} `,flexDirection:"column",flexGrow:1,children:r(ue,{flexGrow:1,flexShrink:1,paddingX:2,ref:l,scrollbar:!0,scrollbarColor:"gray",children:[r(i,{flexDirection:"column",marginTop:1,children:[r(i,{children:[n(t,{dimColor:!0,children:"── "}),n(t,{bold:!0,color:"white",children:"DEPENDS ON"}),r(t,{dimColor:!0,children:[" ","(",e.deps.length,")"]})]}),e.deps.length===0?n(i,{marginTop:1,paddingLeft:2,children:n(t,{dimColor:!0,children:"No dependencies"})}):n(i,{flexDirection:"column",marginTop:1,children:e.deps.map(a=>r(i,{gap:1,paddingLeft:2,children:[n(t,{color:"cyan",children:"→"}),n(t,{children:a.target}),a.type!=="static"&&r(t,{dimColor:!0,children:["(",a.type,")"]})]},a.target))})]}),r(i,{flexDirection:"column",marginTop:1,children:[r(i,{children:[n(t,{dimColor:!0,children:"── "}),n(t,{bold:!0,color:"white",children:"REQUIRED BY"}),r(t,{dimColor:!0,children:[" ","(",e.reverseDeps.length,")"]})]}),e.reverseDeps.length===0?n(i,{marginTop:1,paddingLeft:2,children:n(t,{dimColor:!0,children:"No reverse dependencies"})}):n(i,{flexDirection:"column",marginTop:1,children:e.reverseDeps.map(a=>r(i,{gap:1,paddingLeft:2,children:[n(t,{color:"magenta",children:"←"}),n(t,{children:a})]},a))})]}),r(i,{flexDirection:"column",marginTop:1,children:[r(i,{children:[n(t,{dimColor:!0,children:"── "}),n(t,{bold:!0,color:"white",children:"INFO"})]}),r(i,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[r(i,{children:[n(i,{width:16,children:n(t,{dimColor:!0,children:"Type:"})}),n(t,{color:s,children:u})]}),r(i,{children:[n(i,{width:16,children:n(t,{dimColor:!0,children:"Dependencies:"})}),n(t,{children:String(e.deps.length)})]}),r(i,{children:[n(i,{width:16,children:n(t,{dimColor:!0,children:"Required by:"})}),n(t,{children:String(e.reverseDeps.length)})]}),r(i,{children:[n(i,{width:16,children:n(t,{dimColor:!0,children:"Connectivity:"})}),n(t,{children:String(e.deps.length+e.reverseDeps.length)})]})]})]})]})})},"ProjectDetailPanel");var De=Object.defineProperty,B=E((o,e)=>De(o,"name",{value:e,configurable:!0}),"g");const Ne=[{key:"all",label:"All",shortcut:"1"},{key:"app",label:"Apps",shortcut:"2"},{key:"lib",label:"Libs",shortcut:"3"}],Y=B(({isSelected:o,node:e})=>{const l=e.type==="application",d=l?"yellow":"cyan",c=l?"app":"lib";return r(i,{flexShrink:0,height:1,children:[r(t,{children:[o?"▶":" "," "]}),n(i,{flexGrow:1,children:n(t,{bold:o,inverse:o,wrap:"truncate",children:e.name})}),r(t,{color:d,children:[" ",c]}),r(t,{dimColor:!0,children:[" ","→",e.deps.length," ","←",e.reverseDeps.length]})]})},"ProjectRow"),X=B(({count:o,label:e})=>r(i,{flexShrink:0,height:1,marginTop:1,children:[r(t,{dimColor:!0,children:["▼"," "]}),n(t,{bold:!0,color:"white",children:e.toUpperCase()}),r(t,{dimColor:!0,children:[" ","(",o,")"]})]}),"TypeHeader"),Ie=B(({filterActive:o,filterText:e,filterType:l,focused:d,nodes:c,scrollOffset:s,selectedIndex:u,stats:a,viewportHeight:y})=>{const g=d?"white":"gray",v=c.filter(w=>w.type==="application"),h=c.filter(w=>w.type!=="application"),f=[];let x=0;if(v.length>0){f.push(n(X,{count:v.length,label:"Applications"},"hdr-apps"));for(const w of v){const A=x;f.push(n(Y,{isSelected:A===u,node:w},w.name)),x++}}if(h.length>0){f.push(n(X,{count:h.length,label:"Libraries"},"hdr-libs"));for(const w of h){const A=x;f.push(n(Y,{isSelected:A===u,node:w},w.name)),x++}}let C=0;v.length>0&&(C+=2+v.length),h.length>0&&(C+=2+h.length);const M=C>y&&y>0;return r(i,{borderColor:g,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[r(i,{flexShrink:0,gap:1,paddingX:1,children:[n(t,{bold:!0,inverse:!0,children:" VIS "}),r(t,{wrap:"truncate",children:[a.total," ","packages"]}),r(t,{dimColor:!0,children:["(",a.apps," ","apps,"," ",a.libs," ","libs,"," ",a.deps," ","deps)"]})]}),n(i,{flexShrink:0,gap:1,paddingX:1,paddingY:1,children:Ne.map(w=>{const A=l===w.key;return r(i,{children:[n(t,{dimColor:!A,children:"["}),n(t,{bold:A,color:A?"cyan":"gray",children:w.shortcut}),n(t,{dimColor:!A,children:"]"}),r(t,{color:A?"white":"gray",children:[" ",w.label]})]},w.key)})}),o&&r(i,{flexShrink:0,paddingX:1,children:[n(t,{bold:!0,color:"white",children:"/ "}),n(t,{children:e}),n(t,{inverse:!0,children:" "})]}),r(i,{flexDirection:"row",flexGrow:1,overflow:"hidden",children:[n(i,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:n(i,{flexDirection:"column",marginTop:-s,children:f})}),M&&n(i,{flexShrink:0,marginLeft:1,marginRight:1,children:n(fe,{contentHeight:C,placement:"inset",scrollOffset:s,style:"block",viewportHeight:y})})]})]})},"ProjectListPanel");var $e=Object.defineProperty,Pe=E((o,e)=>$e(o,"name",{value:e,configurable:!0}),"M$1");const Le=100,Oe=40,Be=10,J={1:"all",2:"app",3:"lib"},Re=Pe(({autoExitSeconds:o=0,store:e})=>{const{exit:l}=ge(),{columns:d,rows:c}=me(),s=ve(e.subscribe,e.getSnapshot),[u,a]=O(!1),y=q(null),g=q(null),[v,h]=O(0),[f,x]=O(!1),C=_(()=>e.getFilteredNodes(),[s.allNodes,s.filterType,s.filterText]),M=_(()=>e.getStats(),[s.allNodes]),w=C[s.selectedIndex]??null,A=U(m=>{const p=C.filter(T=>T.type==="application"),b=C.filter(T=>T.type!=="application");let j=0,L=0;if(p.length>0){j+=2;for(let T=0;T<p.length;T++){if(L===m)return j;j+=1,L++}}if(b.length>0){j+=2;for(let T=0;T<b.length;T++){if(L===m)return j;j+=1,L++}}return j},[C]),P=Math.max(1,c-8-(s.filterActive?1:0)),N=U(m=>{const p=A(m);h(b=>p>b+P-2?Math.max(0,p-P+2):p<b+1?Math.max(0,p-1):b)},[A,P]);if(Ce(()=>{g.current?.scrollToTop()},[w?.name]),xe((m,p)=>{if(m==="c"&&p.ctrl){l();return}if(!f){if(u){p.escape||m==="?"?a(!1):m==="q"?(a(!1),x(!0)):p.downArrow||m==="j"?y.current?.scrollBy(1):(p.upArrow||m==="k")&&y.current?.scrollBy(-1);return}if(m==="?"){a(!0);return}if(m==="q"){x(!0);return}if(p.tab){e.setFocusedPanel(s.focusedPanel==="list"?"detail":"list");return}if(J[m]){e.setFilterType(J[m]);return}if(s.filterActive){if(p.escape){e.setFilterActive(!1);return}if(p.return){e.setFilterActive(!1);return}if(p.backspace){e.setFilter(s.filterText.slice(0,-1));return}if(m&&!p.ctrl&&!p.meta){e.setFilter(s.filterText+m);return}return}if(s.focusedPanel==="list"){if(C.length===0){m==="/"&&e.setFilterActive(!0);return}if(p.downArrow||m==="j"){const b=Math.min(s.selectedIndex+1,C.length-1);e.setSelectedIndex(b),N(b);return}if(p.upArrow||m==="k"){const b=Math.max(s.selectedIndex-1,0);e.setSelectedIndex(b),N(b);return}if(p.pageDown){const b=Math.min(s.selectedIndex+10,C.length-1);e.setSelectedIndex(b),N(b);return}if(p.pageUp){const b=Math.max(s.selectedIndex-10,0);e.setSelectedIndex(b),N(b);return}if(p.home){e.setSelectedIndex(0),h(0);return}if(p.end){const b=C.length-1;e.setSelectedIndex(b),N(b);return}if(m==="/"){e.setFilterActive(!0);return}if(p.rightArrow){e.setFocusedPanel("detail");return}return}if(s.focusedPanel==="detail"){if(p.escape||p.leftArrow){e.setFocusedPanel("list");return}if(p.downArrow||m==="j"){g.current?.scrollBy(1);return}if(p.upArrow||m==="k"){g.current?.scrollBy(-1);return}if(p.pageDown){g.current?.scrollBy(10);return}if(p.pageUp){g.current?.scrollBy(-10);return}if(p.home){g.current?.scrollToTop();return}p.end&&g.current?.scrollToBottom()}}},{isActive:!0}),d<Oe||c<Be)return n(i,{alignItems:"center",height:c,justifyContent:"center",width:d,children:r(t,{color:"yellow",children:["Terminal too small (",d,"x",c,")"]})});const ne=d>=Le,R=n(i,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,children:r(i,{flexWrap:"wrap",gap:2,paddingX:1,children:[r(i,{gap:1,children:[n(t,{bold:!0,color:"white",children:"q"}),n(t,{dimColor:!0,children:"QUIT"})]},"q"),r(i,{gap:1,children:[n(t,{bold:!0,color:"white",children:"?"}),n(t,{dimColor:!0,children:"HELP"})]},"?"),r(i,{gap:1,children:[n(t,{bold:!0,color:"white",children:"↑↓"}),n(t,{dimColor:!0,children:"NAV"})]},"nav"),r(i,{gap:1,children:[n(t,{bold:!0,color:"white",children:"1-3 /"}),n(t,{dimColor:!0,children:"FILTER"})]},"f"),r(i,{gap:1,children:[n(t,{bold:!0,color:"white",children:"Tab"}),n(t,{dimColor:!0,children:"PANEL"})]},"t")]})}),F=r(be,{footer:r(t,{dimColor:!0,children:[n(t,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",n(t,{bold:!0,color:"white",children:"?"}),"/",n(t,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:y,title:"KEYBOARD SHORTCUTS",visible:u,width:52,children:[r(i,{flexDirection:"column",marginBottom:1,children:[r(i,{marginBottom:1,children:[n(t,{dimColor:!0,children:"── "}),n(t,{bold:!0,color:"white",children:"NAVIGATION"})]}),r(i,{children:[n(i,{width:24,children:r(t,{children:[r(t,{bold:!0,color:"white",children:[" ","↑","/k"]}),n(t,{dimColor:!0,children:" Move up"})]})}),r(t,{children:[r(t,{bold:!0,color:"white",children:[" ","↓","/j"]}),n(t,{dimColor:!0,children:" Move down"})]})]}),r(t,{children:[r(t,{bold:!0,color:"white",children:[" ","Tab"]}),n(t,{dimColor:!0,children:" Switch panel"})]}),r(t,{children:[r(t,{bold:!0,color:"white",children:[" ","→","/","←"]}),n(t,{dimColor:!0,children:" Focus detail/list"})]}),r(t,{children:[r(t,{bold:!0,color:"white",children:[" ","PgUp/PgDn"]}),n(t,{dimColor:!0,children:" Jump 10 items"})]}),r(t,{children:[r(t,{bold:!0,color:"white",children:[" ","Home/End"]}),n(t,{dimColor:!0,children:" Jump to start/end"})]})]}),r(i,{flexDirection:"column",marginBottom:1,children:[r(i,{marginBottom:1,children:[n(t,{dimColor:!0,children:"── "}),n(t,{bold:!0,color:"white",children:"FILTERS"})]}),r(i,{children:[n(i,{width:24,children:r(t,{children:[r(t,{bold:!0,color:"white",children:[" ","1"]}),n(t,{dimColor:!0,children:" All"})]})}),r(t,{children:[r(t,{bold:!0,color:"white",children:[" ","2"]}),n(t,{dimColor:!0,children:" Apps only"})]})]}),r(t,{children:[r(t,{bold:!0,color:"white",children:[" ","3"]}),n(t,{dimColor:!0,children:" Libraries only"})]}),r(t,{children:[r(t,{bold:!0,color:"white",children:[" ","/"]}),n(t,{dimColor:!0,children:" Text filter"})]})]}),r(i,{flexDirection:"column",children:[r(i,{marginBottom:1,children:[n(t,{dimColor:!0,children:"── "}),n(t,{bold:!0,color:"white",children:"ACTIONS"})]}),r(t,{children:[r(t,{bold:!0,color:"white",children:[" ","q"]}),n(t,{dimColor:!0,children:" Quit"})]}),r(t,{children:[r(t,{bold:!0,color:"white",children:[" ","?"]}),n(t,{dimColor:!0,children:" Toggle help"})]})]})]}),H=n(Ie,{filterActive:s.filterActive,filterText:s.filterText,filterType:s.filterType,focused:s.focusedPanel==="list",nodes:C,scrollOffset:v,selectedIndex:s.selectedIndex,stats:M,viewportHeight:P}),G=n(je,{focused:s.focusedPanel==="detail",node:w,scrollRef:g});if(ne){const m=Math.floor(d*.35);return r(i,{flexDirection:"column",height:c,width:d,children:[r(i,{flexDirection:"row",flexGrow:1,children:[n(i,{flexGrow:1,children:H}),n(i,{width:m,children:G})]}),R,n(z,{autoExitSeconds:o??3,onCancel:E(()=>{x(!1)},"onCancel"),visible:f}),F]})}const re=Math.floor(c*.55);return r(i,{flexDirection:"column",height:c,width:d,children:[n(i,{height:re,children:H}),n(i,{flexGrow:1,children:G}),R,n(z,{autoExitSeconds:o??3,onCancel:E(()=>{x(!1)},"onCancel"),visible:f}),F]})},"VisGraphApp");var V=Object.freeze,ee=Object.defineProperty,D=E((o,e)=>ee(o,"name",{value:e,configurable:!0}),"x"),Fe=E((o,e)=>V(ee(o,"raw",{value:V(e||o.slice())})),"C");const te=D((o,e,l,d,c,s,u,a)=>{const y=l?k("└── "):k("├── "),g=c.has(o),v=g?k(" (*)"):"",h=d.get(o),f=h?.type==="application"?S(o):o;if(s.push(`${e}${y}${f}${v}`),g)return;c.add(o);const x=h?.deps??[],C=l?`${e} `:`${e}${k("│")} `;if(a>=u&&x.length>0){s.push(`${C}${k(`... ${x.length} more`)}`);return}for(let M=0;M<x.length;M++){const w=x[M];w&&te(w.target,C,M===x.length-1,d,c,s,u,a+1)}},"printDepsTree"),Q=D((o,e,l,d,c,s)=>{const u=e.get(o),a=u?.type==="application"?S(o):o;d.push(`${s}${a}`),l.add(o);const y=u?.deps??[];if(y.length===0){d.push(`${s} ${k("(no dependencies)")}`);return}if(c<=0){d.push(`${s} ${k(`... ${y.length} dependencies`)}`);return}for(let g=0;g<y.length;g++){const v=y[g];v&&te(v.target,s,g===y.length-1,e,l,d,c,1)}},"printRootProject"),K=D((o,e)=>{const l=new Map;for(const[h,f]of Object.entries(o.nodes))l.set(h,{deps:(o.dependencies[h]??[]).map(x=>({target:x.target,type:x.type})),name:h,type:f.type});const d=[],c=[];for(const[h,f]of l)f.type==="application"?d.push(h):c.push(h);d.sort(),c.sort();const s=d.length+c.length,u=Object.values(o.dependencies).reduce((h,f)=>h+f.length,0),a=[S("Project Dependency Graph"),""];if(d.length>0){a.push(` ${S(W(`Applications (${d.length})`))}`,"");for(const h of d)Q(h,l,new Set,a,e," "),a.push("")}if(c.length>0){a.push(` ${S(W(`Libraries (${c.length})`))}`,"");for(const h of c)Q(h,l,new Set,a,e," "),a.push("")}const y=process.stdout.columns||80;a.push(k("─".repeat(Math.min(y,60)))),a.push(`${S(String(s))} packages ${k("·")} ${S(String(u))} dependencies ${k("·")} ${S(String(d.length))} apps${k(",")} ${S(String(c.length))} libraries`);const g=new Set;let v=!1;for(const h of[...d,...c]){const f=l.get(h)?.deps??[];for(const x of f)g.has(x.target)&&(v=!0),g.add(x.target);g.add(h)}return v&&a.push(k("(*) = already shown above")),a.join(`
|
|
2
2
|
`)},"projectGraphToAscii"),He=D(o=>{const e=Object.values(o.nodes).map(l=>({name:l.name,type:l.type}));return{edges:Object.values(o.dependencies).flat(),nodes:e}},"projectGraphToJson");var Z;const Ge=D(o=>{const e=Object.values(o.nodes).map(u=>({name:u.name,type:u.type})),l=[];for(const u of Object.values(o.dependencies))for(const a of u)l.push({source:a.source,target:a.target,type:a.type});const d=e.filter(u=>u.type==="application"),c=e.filter(u=>u.type!=="application"),s={apps:d.length,edges:l,libs:c.length,nodes:e};return String.raw(Z||(Z=Fe([`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|