@visulima/vis 1.0.0-alpha.41 → 1.0.0-alpha.43
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 +41 -0
- package/LICENSE.md +265 -35
- package/dist/bin.js +1 -1
- package/dist/binx.js +2 -2
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.js +1 -1
- package/dist/packem_chunks/CONFIG_FILES.js +8 -0
- package/dist/packem_chunks/bloom-status.js +1 -1
- package/dist/packem_chunks/bloom-sync.js +1 -1
- package/dist/packem_chunks/catalog.js +113 -0
- package/dist/packem_chunks/cli-exec.js +1 -0
- package/dist/packem_chunks/cli-main.js +1068 -0
- package/dist/packem_chunks/detect.js +3 -3
- package/dist/packem_chunks/devtools.js +1 -78
- package/dist/packem_chunks/dispatch.js +4 -0
- package/dist/packem_chunks/doctor-probe.js +1 -1
- package/dist/packem_chunks/fix.js +1 -1
- package/dist/packem_chunks/handler.js +1 -1
- package/dist/packem_chunks/handler10.js +5 -1
- package/dist/packem_chunks/handler11.js +1 -5
- package/dist/packem_chunks/handler12.js +27 -1
- package/dist/packem_chunks/handler13.js +5 -27
- package/dist/packem_chunks/handler14.js +1 -5
- package/dist/packem_chunks/handler15.js +1 -1
- package/dist/packem_chunks/handler16.js +1 -1
- package/dist/packem_chunks/handler17.js +1 -1
- package/dist/packem_chunks/handler18.js +1 -1
- package/dist/packem_chunks/handler19.js +5 -1
- package/dist/packem_chunks/handler2.js +1 -4
- package/dist/packem_chunks/handler20.js +2 -5
- package/dist/packem_chunks/handler21.js +2 -2
- package/dist/packem_chunks/handler22.js +5 -2
- 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 +1 -1
- package/dist/packem_chunks/handler28.js +1 -1
- package/dist/packem_chunks/handler29.js +1 -1
- package/dist/packem_chunks/handler3.js +4 -4
- package/dist/packem_chunks/handler30.js +1 -1
- package/dist/packem_chunks/handler33.js +1 -1
- package/dist/packem_chunks/handler4.js +4 -6
- package/dist/packem_chunks/handler40.js +1 -1
- package/dist/packem_chunks/handler5.js +6 -8
- package/dist/packem_chunks/handler50.js +5 -5
- package/dist/packem_chunks/handler51.js +5 -5
- package/dist/packem_chunks/handler52.js +1 -1
- package/dist/packem_chunks/handler53.js +1 -1
- package/dist/packem_chunks/handler54.js +1 -1
- package/dist/packem_chunks/handler55.js +1 -1
- package/dist/packem_chunks/handler56.js +1 -1
- package/dist/packem_chunks/handler57.js +5 -7
- package/dist/packem_chunks/handler58.js +11 -5
- package/dist/packem_chunks/handler59.js +3 -11
- package/dist/packem_chunks/handler6.js +8 -1
- package/dist/packem_chunks/handler60.js +22 -3
- package/dist/packem_chunks/handler61.js +60 -21
- package/dist/packem_chunks/handler62.js +3 -61
- package/dist/packem_chunks/handler63.js +6 -3
- package/dist/packem_chunks/handler64.js +9 -6
- package/dist/packem_chunks/handler65.js +2 -708
- package/dist/packem_chunks/handler66.js +10 -10
- package/dist/packem_chunks/handler67.js +5 -5
- package/dist/packem_chunks/handler68.js +1 -1
- package/dist/packem_chunks/handler69.js +5 -5
- package/dist/packem_chunks/handler7.js +1 -1
- package/dist/packem_chunks/handler70.js +7 -7
- package/dist/packem_chunks/handler71.js +15 -15
- package/dist/packem_chunks/handler72.js +708 -48
- package/dist/packem_chunks/handler73.js +48 -27
- package/dist/packem_chunks/handler74.js +27 -3
- package/dist/packem_chunks/handler75.js +3 -190
- package/dist/packem_chunks/handler76.js +189 -37
- package/dist/packem_chunks/handler77.js +38 -0
- package/dist/packem_chunks/handler8.js +1 -1
- package/dist/packem_chunks/handler9.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 +4 -4
- package/dist/packem_chunks/index2.js +2 -2
- package/dist/packem_chunks/index3.js +135 -0
- package/dist/packem_chunks/index4.js +74 -0
- package/dist/packem_chunks/keys-refresh.js +1 -1
- package/dist/packem_chunks/lean.js +4 -0
- package/dist/packem_chunks/list.js +1 -1
- package/dist/packem_chunks/loader.js +1 -1
- package/dist/packem_chunks/loader2.js +1 -1
- package/dist/packem_chunks/orchestrator.js +19 -19
- package/dist/packem_chunks/prompts.js +1 -1
- package/dist/packem_chunks/prune.js +1 -1
- package/dist/packem_chunks/registry.js +2 -2
- package/dist/packem_chunks/run.js +1 -1
- package/dist/packem_chunks/shell-runner.js +1 -1
- package/dist/packem_chunks/status.js +1 -1
- package/dist/packem_chunks/sync.js +1 -1
- package/dist/packem_chunks/sync2.js +1 -1
- package/dist/packem_chunks/tar.js +1 -1
- package/dist/packem_chunks/tripwire.js +1 -1
- package/dist/packem_chunks/ts-loader.js +2 -0
- package/dist/packem_chunks/verify-lockfile.js +1 -1
- package/dist/packem_chunks/version-resolver.js +2 -2
- package/dist/packem_shared/{Table-CcVkyULl-B_ef6zfS.js → Table-CcVkyULl-DLWu6XHL.js} +25 -26
- package/dist/packem_shared/{advisories-DLeO5KMN.js → advisories-CefYKEPe.js} +1 -1
- package/dist/packem_shared/{affected-shas-cVnX8-zs.js → affected-shas-C1XuRlvo.js} +1 -1
- package/dist/packem_shared/{ai-analysis-BUeX2J2H.js → ai-analysis-Co-b15d_.js} +7 -7
- package/dist/packem_shared/{ai-fix-9Vzlp6XU.js → ai-fix-DnJDgPN-.js} +9 -9
- package/dist/packem_shared/augment-8fIWWGSc.js +3 -0
- package/dist/packem_shared/bin-DDq2oszw.js +1 -0
- package/dist/packem_shared/build-scripts-Doxce2VM.js +1 -0
- package/dist/packem_shared/command-runtime-RiCMa2C8.js +1 -0
- package/dist/packem_shared/compile-cache-B_Vf_WxT.js +3 -0
- package/dist/packem_shared/{cyclonedx-Cadls41z.js → cyclonedx-BTBzGCBW.js} +1 -1
- package/dist/packem_shared/dependency-scan-DEv-scN6.js +1 -0
- package/dist/packem_shared/{docker-BMLrNtWm.js → docker-DKlF-gk3.js} +1 -1
- package/dist/packem_shared/env-XJzocuUP.js +27 -0
- package/dist/packem_shared/failure-log-Sp1j-5qo.js +2 -0
- package/dist/packem_shared/{giget-DHY1sQZC.js → giget-DVTFJlbR.js} +2 -2
- package/dist/packem_shared/glob-fqg4KepW-7Bs2kZuM.js +1 -0
- package/dist/packem_shared/index-B0EsgdzO.js +1 -0
- package/dist/packem_shared/{index-DGSsjmpV.js → index-Cg0IHaFI.js} +1 -1
- package/dist/packem_shared/index-CkZnT2Fe.js +1 -0
- package/dist/packem_shared/index-DJAnbLEh.js +28 -0
- package/dist/packem_shared/index-DjTWo3sH.js +1 -0
- package/dist/packem_shared/{index-BDmTbWX1.js → index-OQZQyN5R.js} +1 -1
- package/dist/packem_shared/index.server-J83sowC4.js +2 -0
- package/dist/packem_shared/{lifecycle-4z9hHE5b.js → lifecycle-C4nRsXxc.js} +2 -2
- package/dist/packem_shared/{lockfile-C8Q1_4KK.js → lockfile-DIGyLfmF.js} +1 -1
- package/dist/packem_shared/main-B3juSU5z.js +1 -0
- package/dist/packem_shared/manifests-pLwnVmCN.js +1 -0
- package/dist/packem_shared/{min-release-age-D1alDE3K.js → min-release-age-B23Mr7NO.js} +3 -3
- package/dist/packem_shared/missing-package-json-DdMNbe_j.js +1 -0
- package/dist/packem_shared/{native-config-sync-BEkJW7g3.js → native-config-sync-4K9wWTj5.js} +1 -1
- package/dist/packem_shared/{osv-bloom-B03tUWf3.js → osv-bloom-BsQ-aFiM.js} +1 -1
- package/dist/packem_shared/packument-QjOLAMSk.js +1 -0
- package/dist/packem_shared/{pm-runner-BKZQo7Ts.js → pm-runner-CIH0wPh-.js} +1 -1
- package/dist/packem_shared/prompt-DjXHVgYU.js +1 -0
- package/dist/packem_shared/provenance-CilBg0Ee.js +1 -0
- package/dist/packem_shared/readJsonSync-CvkZyKmL-CY7PZob_.js +4 -0
- package/dist/packem_shared/registry-keys-BEavOCPz.js +1 -0
- package/dist/packem_shared/resolve-explicit-C4o8_-SE.js +5 -0
- package/dist/packem_shared/resolve-runtime-CJSWV-K8.js +1 -0
- package/dist/packem_shared/run-file-B4TqKa0X.js +1 -0
- package/dist/packem_shared/runtime-check-0lUJvgKt.js +1 -0
- package/dist/packem_shared/runtime-process-Dmz0vCJy-DUwTvH1J.js +1 -0
- package/dist/packem_shared/s1ngularity-DuG-LLaX.js +1 -0
- package/dist/packem_shared/scan-progress-RTMsE3Z4.js +2 -0
- package/dist/packem_shared/{selectors-GCJIe342.js → selectors-UmnAuc26.js} +1 -1
- package/dist/packem_shared/{signatures-Xpd6HjG_.js → signatures-CYheSqd3.js} +2 -2
- package/dist/packem_shared/spinner-DuJJvFTl.js +1 -0
- package/dist/packem_shared/tabs-CgxCvjCY.js +1 -0
- package/dist/packem_shared/target-merge-DOm6h6tW.js +11 -0
- package/dist/packem_shared/target-options-ChWcK60i.js +1 -0
- package/dist/packem_shared/toolchain-DyCKnGch.js +5 -0
- package/dist/packem_shared/typosquats-hCtH-23t.js +1 -0
- package/dist/packem_shared/use-measured-height-BKUjhm_3.js +1 -0
- package/dist/packem_shared/verify-CVPYlUrF.js +1 -0
- package/dist/packem_shared/vis-update-app-K-qATSeh.js +1 -0
- package/dist/packem_shared/watch-Bkp_AAbc.js +1 -0
- package/dist/packem_shared/watch-loop-WE7nWIEt.js +11 -0
- package/dist/packem_shared/window-ops-DDePlWLV.js +2 -0
- package/dist/runtime/preload.d.ts +1 -0
- package/dist/runtime/preload.js +1 -0
- package/index.d.ts +215 -201
- package/index.js +54 -53
- package/package.json +18 -27
- package/dist/packem_chunks/bin.js +0 -1198
- package/dist/packem_chunks/config.js +0 -21
- package/dist/packem_shared/CONFIG_FILES-BfaR0jKT.js +0 -1
- package/dist/packem_shared/build-scripts-CCCi8U66.js +0 -1
- package/dist/packem_shared/command-runtime-CR70qSUM.js +0 -1
- package/dist/packem_shared/dependency-scan-DnTgYleU.js +0 -1
- package/dist/packem_shared/failure-log-CEWP3bP0.js +0 -2
- package/dist/packem_shared/glob-fqg4KepW-B7EjLRvw.js +0 -1
- package/dist/packem_shared/index-3jMNqQom.js +0 -1
- package/dist/packem_shared/index-Bt521H5J.js +0 -30
- package/dist/packem_shared/manifests-Dj3pRKBT.js +0 -1
- package/dist/packem_shared/missing-package-json-8vNHwbqw.js +0 -1
- package/dist/packem_shared/provenance-BFEwKgI3.js +0 -1
- package/dist/packem_shared/registry-keys-BfFto6vI.js +0 -1
- package/dist/packem_shared/resolve-explicit-C6WM-I2u.js +0 -5
- package/dist/packem_shared/runtime-check-Stc9AI78.js +0 -1
- package/dist/packem_shared/s1ngularity-DCPmPE5M.js +0 -1
- package/dist/packem_shared/scan-progress-CFhc0CMj.js +0 -2
- package/dist/packem_shared/spinner-CV3WVJLv.js +0 -1
- package/dist/packem_shared/tabs-BuTy5gPV.js +0 -1
- package/dist/packem_shared/toolchain-pR7AJ-tB.js +0 -5
- package/dist/packem_shared/typosquats-DN78xx1x.js +0 -1
- package/dist/packem_shared/use-measured-height-_eVGWtWt.js +0 -1
- package/dist/packem_shared/verify-6WCmFmy8.js +0 -1
- package/dist/packem_shared/vis-update-app-k3fDxech.js +0 -1
- package/dist/packem_shared/watch-BvIwLG4N.js +0 -1
- package/dist/packem_shared/watch-loop-DWkvv2tK.js +0 -11
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import{createRequire as z}from"node:module";import{y as L,v as _,m as P,f as M,J as V,B as Y}from"../packem_shared/index-BDmTbWX1.js";import{a4 as t,a5 as a,m as c,aE as K,aF as Q,aG as U,aD as Z,s as v,ae as ee,p as k,r as re,$ as te,d as se,t as ne,aN as oe,aO as ie,aP as le,i as ce,W as N}from"./bin.js";import ae from"./index.js";import{sortPackageJsonStringWithOptions as q}from"#native";import{c as O}from"../packem_shared/utils-Cxree603.js";const Ke=z(import.meta.url),Qe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process;const D={error:0,rewritten:1,"would-rewrite":1,unchanged:2},de=e=>[...e].sort((r,s)=>D[r.status]-D[s.status]),ue=(e,r)=>r==="all"?e:r==="errors"?e.filter(s=>s.status==="error"):r==="rewritten"?e.filter(s=>s.status==="rewritten"||s.status==="would-rewrite"):e.filter(s=>s.status==="unchanged");class fe{#e;#r=new Set;constructor(r){this.#e={entries:de(r),filterType:"all",focusedPanel:"list",selectedIndex:0}}getSnapshot=()=>this.#e;subscribe=r=>(this.#r.add(r),()=>{this.#r.delete(r)});getFilteredEntries=()=>ue(this.#e.entries,this.#e.filterType);#t(){this.#e={...this.#e};for(const r of this.#r)r()}select(r){const s=this.getFilteredEntries();this.#e.selectedIndex=s.length===0?-1:Math.max(0,Math.min(r,s.length-1)),this.#t()}selectStep(r){this.select(this.#e.selectedIndex+r)}setFilter(r){this.#e.filterType=r,this.#e.selectedIndex=0,this.#t()}setFocusedPanel(r){this.#e.focusedPanel=r,this.#t()}}const he=({checkMode:e,entry:r,focused:s,scrollRef:l})=>{const i=s?"white":"gray";return r?t.jsxs(a,{borderColor:i,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[t.jsx(a,{flexShrink:0,paddingTop:1,paddingX:2,children:t.jsx(c,{bold:!0,color:"white",children:r.relativePath})}),t.jsxs(K,{flexGrow:1,flexShrink:1,paddingX:2,ref:l,scrollbar:!0,scrollbarColor:"gray",children:[t.jsx(c,{}),t.jsxs(a,{children:[t.jsx(a,{width:10,children:t.jsx(c,{dimColor:!0,children:"Status:"})}),r.status==="error"?t.jsx(c,{bold:!0,color:"red",children:"error"}):r.status==="unchanged"?t.jsx(c,{bold:!0,color:"green",children:"already sorted"}):r.status==="rewritten"?t.jsx(c,{bold:!0,color:"yellow",children:"rewritten"}):t.jsx(c,{bold:!0,color:"yellow",children:"would rewrite (--check)"})]}),t.jsxs(a,{children:[t.jsx(a,{width:10,children:t.jsx(c,{dimColor:!0,children:"Path:"})}),t.jsx(c,{children:r.filePath})]}),r.error?t.jsxs(t.Fragment,{children:[t.jsxs(a,{flexDirection:"column",marginTop:1,children:[t.jsx(c,{dimColor:!0,children:"── "}),t.jsx(c,{bold:!0,color:"red",children:"ERROR"}),t.jsxs(a,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[t.jsxs(a,{children:[t.jsx(a,{width:10,children:t.jsx(c,{dimColor:!0,children:"Step:"})}),t.jsx(c,{color:"yellow",children:r.error.step})]}),r.error.context&&t.jsxs(a,{children:[t.jsx(a,{width:10,children:t.jsx(c,{dimColor:!0,children:"Position:"})}),t.jsx(c,{children:`line ${String(r.error.context.line)}, column ${String(r.error.context.column)}`})]}),t.jsx(a,{marginTop:1,children:t.jsx(c,{color:"red",children:r.error.message})})]})]}),r.error.context&&r.error.context.snippet.length>0&&t.jsxs(a,{flexDirection:"column",marginTop:1,children:[t.jsx(c,{dimColor:!0,children:"── "}),t.jsx(c,{bold:!0,color:"white",children:"SNIPPET"}),t.jsxs(a,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[r.error.context.snippet.map(n=>{const o=`${n.isErrorLine?"❯":" "} ${String(n.lineNumber).padStart(4)} `;return t.jsxs(a,{children:[t.jsx(c,{color:n.isErrorLine?"red":"gray",children:o}),t.jsx(c,{color:n.isErrorLine?"white":"gray",wrap:"truncate-end",children:n.content||" "})]},n.lineNumber)}),r.error.context.column>0&&t.jsx(a,{children:t.jsx(c,{color:"red",children:`${" ".repeat(7+r.error.context.column-1)}↑`})})]})]})]}):t.jsxs(a,{flexDirection:"column",marginTop:1,children:[t.jsx(c,{dimColor:!0,children:"── "}),t.jsx(c,{bold:!0,color:"white",children:"KEY DIFF"}),t.jsx(a,{flexDirection:"column",marginTop:1,paddingLeft:2,children:r.diff.length===0?t.jsx(c,{dimColor:!0,children:"No top-level keys moved (sub-key reorder only)."}):r.diff.map(n=>{const o=n.toIndex-n.fromIndex,d=o<0?`↑ ${String(Math.abs(o))}`:`↓ ${String(o)}`,g=o<0?"green":"yellow";return t.jsxs(a,{children:[t.jsx(a,{width:28,children:t.jsx(c,{wrap:"truncate",children:n.key})}),t.jsx(a,{width:10,children:t.jsxs(c,{dimColor:!0,children:[String(n.fromIndex)," → ",String(n.toIndex)]})}),t.jsx(c,{color:g,children:d})]},n.key)})}),e&&r.status==="would-rewrite"&&t.jsx(a,{marginTop:1,paddingLeft:2,children:t.jsx(c,{dimColor:!0,children:"--check mode: no write performed."})})]})]})]}):t.jsx(a,{alignItems:"center",borderColor:"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,justifyContent:"center",children:t.jsx(c,{dimColor:!0,children:"No entry selected"})})},ge={error:"red",rewritten:"yellow",unchanged:"green","would-rewrite":"yellow"},xe={error:"ERROR",rewritten:"REWROTE",unchanged:"SORTED","would-rewrite":"REWRITE"},H={error:"errors",rewritten:"rewrites",unchanged:"sorted","would-rewrite":"rewrites"},pe={errors:"Errors",rewrites:"Rewrites",sorted:"Sorted"},me=[{count:e=>e.errors+e.rewrites+e.sorted,key:"all",label:"All",shortcut:"1"},{count:e=>e.rewrites,key:"rewritten",label:"Rewrites",shortcut:"2"},{count:e=>e.errors,key:"errors",label:"Errors",shortcut:"3"},{count:e=>e.sorted,key:"unchanged",label:"Sorted",shortcut:"4"}],X=e=>{const r={errors:0,rewrites:0,sorted:0};for(const s of e)r[H[s.status]]++;return r},we=({entry:e,isSelected:r})=>{const s=ge[e.status],l=xe[e.status];return t.jsxs(a,{flexShrink:0,height:1,children:[t.jsx(c,{children:r?">":" "}),t.jsx(c,{children:" "}),t.jsx(c,{bold:!0,color:s,children:`[${l}]`.padEnd(10)}),t.jsx(c,{children:" "}),t.jsx(a,{flexGrow:1,children:t.jsx(c,{bold:r,inverse:r,wrap:"truncate",children:e.relativePath})}),e.status!=="error"&&e.diff.length>0&&t.jsx(c,{dimColor:!0,children:` ${String(e.diff.length)} key${e.diff.length===1?"":"s"}`})]})},je=({color:e,count:r,label:s})=>t.jsx(a,{flexShrink:0,height:1,children:t.jsx(c,{bold:!0,color:e,children:`${s} (${String(r)})`})}),ye=({counts:e,entries:r,filterType:s,focused:l,selectedIndex:i,totalEntries:n,viewportHeight:o})=>{const d=l?"white":"gray",g=X(r),m=(g.errors>0?1:0)+(g.rewrites>0?1:0)+(g.sorted>0?1:0),y=s==="all"&&m>1,h=[];let w;for(const[u,p]of r.entries()){const b=H[p.status];y&&b!==w&&(w!==void 0&&h.push({kind:"spacer"}),h.push({color:b==="errors"?"red":b==="rewrites"?"yellow":"green",count:g[b],kind:"header",label:pe[b]}),w=b),h.push({entry:p,entryIndex:u,kind:"entry"})}const x=h.findIndex(u=>u.kind==="entry"&&u.entryIndex===i),S=x!==-1,j=h.length,$=Math.max(0,j-o);let f=0;S&&o>0&&(f=Math.min($,Math.max(0,x-o+1)));const E=j>o&&o>0;return t.jsxs(a,{borderColor:d,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[t.jsxs(a,{flexShrink:0,gap:1,paddingX:1,children:[t.jsx(c,{bold:!0,inverse:!0,children:" VIS SORT "}),t.jsxs(c,{wrap:"truncate",children:[n," ","file",n===1?"":"s"]})]}),t.jsx(a,{flexShrink:0,gap:1,paddingX:1,paddingY:1,children:me.map(u=>{const p=s===u.key,b=u.count(e);return t.jsxs(a,{children:[t.jsx(c,{dimColor:!p,children:"["}),t.jsx(c,{bold:p,color:p?"cyan":"gray",children:u.shortcut}),t.jsx(c,{dimColor:!p,children:"]"}),t.jsxs(c,{color:p?"white":"gray",children:[" ",u.label]}),t.jsxs(c,{dimColor:!0,children:[" ","(",b,")"]})]},u.key)})}),t.jsxs(a,{flexDirection:"row",flexGrow:1,overflow:"hidden",children:[t.jsx(a,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:t.jsx(a,{flexDirection:"column",marginTop:-f,children:h.map((u,p)=>u.kind==="spacer"?t.jsx(a,{flexShrink:0,height:1},`s-${String(p)}`):u.kind==="header"?t.jsx(je,{color:u.color,count:u.count,label:u.label},`h-${u.label}`):t.jsx(we,{entry:u.entry,isSelected:u.entryIndex===i},u.entry.filePath))})}),E&&t.jsx(a,{flexShrink:0,marginLeft:1,marginRight:1,children:t.jsx(Q,{contentHeight:j,placement:"inset",scrollOffset:f,style:"block",viewportHeight:o})})]})]})},be=100,A=10,ke=6,Se=1,F={1:"all",2:"rewritten",3:"errors",4:"unchanged"},$e=({checkMode:e,store:r})=>{const{exit:s}=U(),{columns:l,rows:i}=Z(),n=v.useSyncExternalStore(r.subscribe,r.getSnapshot),o=v.useRef(null),d=r.getFilteredEntries(),g=d[n.selectedIndex]??null,m=X(n.entries),y=l>=be,h=Math.max(0,i-Se),w=y?h:Math.floor(h/2),x=Math.max(0,w-ke),S=v.useCallback(()=>{s()},[s]),j=v.useRef(0),$=v.useRef(void 0),f=v.useRef(!1),E=v.useCallback((u,p)=>{j.current+=p,$.current=u,!f.current&&(f.current=!0,queueMicrotask(()=>{f.current=!1;const b=j.current,T=$.current;j.current=0,$.current=void 0,!(b===0||T===void 0)&&(T==="list"?r.selectStep(Math.sign(b)):o.current?.scrollBy(Math.sign(b)))}))},[r]);return ee((u,p)=>{if(u==="q"||p.escape){S();return}if(F[u]){r.setFilter(F[u]);return}if(p.tab){r.setFocusedPanel(n.focusedPanel==="list"?"detail":"list");return}n.focusedPanel==="list"?p.upArrow||u==="k"?E("list",-1):(p.downArrow||u==="j")&&E("list",1):n.focusedPanel==="detail"&&(p.upArrow||u==="k"?E("detail",-1):(p.downArrow||u==="j")&&E("detail",1))}),i<A?t.jsx(a,{alignItems:"center",justifyContent:"center",children:t.jsxs(c,{color:"yellow",children:["Terminal too small. Resize to at least",A," ","rows."]})}):t.jsxs(a,{flexDirection:"column",height:i,width:l,children:[t.jsxs(a,{flexDirection:y?"row":"column",flexGrow:1,children:[t.jsx(a,{flexBasis:"50%",flexGrow:1,flexShrink:1,children:t.jsx(ye,{counts:m,entries:d,filterType:n.filterType,focused:n.focusedPanel==="list",selectedIndex:n.selectedIndex,totalEntries:n.entries.length,viewportHeight:x})}),t.jsx(a,{flexBasis:"50%",flexGrow:1,flexShrink:1,children:t.jsx(he,{checkMode:e,entry:g,focused:n.focusedPanel==="detail",scrollRef:o})})]}),t.jsx(a,{flexShrink:0,paddingX:1,children:t.jsx(c,{dimColor:!0,children:"↑/↓ or j/k:navigate | tab:switch panel | 1-4:filter | q:quit"})})]})},B=["types","node-addons","node","import","require","default"],ve=/^git\+https:\/\/github\.com\/([^/]+)\/([^/.]+(?:\.git)?)$/,Ee=/^git\+ssh:\/\/git@github\.com\/([^/]+)\/([^/.]+(?:\.git)?)$/,C=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),I=e=>{if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(s=>I(s));const r={};for(const[s,l]of Object.entries(e))r[s]=I(l);return r},Pe=e=>{if(!C(e))return{changed:!1,value:e};const r=Object.keys(e);return r.length===1&&r[0]==="url"&&typeof e.url=="string"?{changed:!0,value:e.url}:{changed:!1,value:e}},Oe=e=>e.endsWith(".git")?e.slice(0,-4):e,Ce=e=>{if(!C(e))return{changed:!1,value:e};if(typeof e.directory=="string"&&e.directory.length>0)return{changed:!1,value:e};const{type:r}=e;if(r!==void 0&&r!=="git")return{changed:!1,value:e};const{url:s}=e;if(typeof s!="string")return{changed:!1,value:e};const l=ve.exec(s)??Ee.exec(s);if(!l)return{changed:!1,value:e};const i=l[1],n=Oe(l[2]??"");if(!i||!n)return{changed:!1,value:e};const o=new Set(["type","url"]);for(const d of Object.keys(e))if(!o.has(d))return{changed:!1,value:e};return{changed:!0,value:`${i}/${n}`}},Re=e=>{const r=Object.keys(e),s=[],l=[];for(const o of B)Object.hasOwn(e,o)&&s.push(o);for(const o of r)B.includes(o)||l.push(o);const i=[...s,...l];if(i.length===r.length&&i.every((o,d)=>o===r[d]))return{changed:!1,value:e};const n={};for(const o of i)n[o]=e[o];return{changed:!0,value:n}},W=e=>{if(!C(e))return{changed:!1,value:e};let r=!1;const s={};for(const[i,n]of Object.entries(e)){const o=W(n);s[i]=o.value,o.changed&&(r=!0)}const l=Re(s);return{changed:r||l.changed,value:l.value}},Ie=(e,r)=>{const s=I(e);let l=!1;if(r.formatBugs!==!1&&Object.hasOwn(s,"bugs")){const i=Pe(s.bugs);i.changed&&(s.bugs=i.value,l=!0)}if(r.formatRepository!==!1&&Object.hasOwn(s,"repository")){const i=Ce(s.repository);i.changed&&(s.repository=i.value,l=!0)}if(r.sortExports!==!1&&Object.hasOwn(s,"exports")&&C(s.exports)){const i=W(s.exports);i.changed&&(s.exports=i.value,l=!0)}return{changed:l,pkg:s}},Te=/at position (\d+)/,Me=/\(?line (\d+) column (\d+)\)?/,Ne=e=>{const r=new Set,s=[],l=n=>{const o=Y(n);!r.has(o)&&M(o)&&(r.add(o),s.push(o))};l(P(e,"package.json"));const i=ce(e);if(i){const n=N(e,i);for(const o of n)l(P(e,o,"package.json"))}else{const n=P(e,"package.json");if(M(n)){const o=JSON.parse(_(n)),d=Array.isArray(o.workspaces)?o.workspaces:o.workspaces?.packages;if(d){const g=N(e,d);for(const m of g)l(P(e,m,"package.json"))}}}return s},De=e=>/\n([ \t]+)/.exec(e)?.[1]??" ",Ae=e=>{if(!(e===void 0||e===""))return e==="tab"||e===String.raw`\t`?" ":/^\d+$/.test(e)?" ".repeat(Number.parseInt(e,10)):e},R=e=>e===void 0?[]:(Array.isArray(e)?e:[e]).flatMap(r=>r.split(",")).map(r=>r.trim()).filter(r=>r.length>0),Fe=e=>e.includes(`\r
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
`)
|
|
1
|
+
import{createRequire as q}from"node:module";import{DEFAULT_CHANGES_DIR as Z}from"./DEFAULT_CLEAN_KEEP.js";import{b as J,f as Q}from"./orchestrator.js";import{createShellRunner as X}from"./shell-runner.js";import{r as ee}from"../packem_shared/slug-DoueYuLo.js";import{maxBump as te}from"../release/types.js";const V=q(import.meta.url),P=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,U=s=>{if(typeof P<"u"&&P.versions&&P.versions.node){const[e,t]=P.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return P.getBuiltinModule(s)}return V(s)},{join:M,relative:Y}=U("node:path"),D=/(?!.*)/;function re(s){return s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function S(s){return s.map(e=>typeof e=="string"?re(e.trim()):e.source).filter(Boolean).join("|")}function ne(s,e){if(!s)return D;const t=S(s);return e?e(t):new RegExp(`^[\\s|*]*(${t})[:\\s]+(.*)`,"i")}function se(s,e){if(!s)return D;const t=e?"g":"gi";return new RegExp(`(?:.*?)??\\s*([\\w-\\.\\/]*?)??(${S(s)})([\\w-]+)(?=\\s|$|[,;)\\]])`,t)}function ie(s){if(!s)return/()(.+)/gi;const e=S(s);return new RegExp(`(${e})(?:\\s+(.*?))(?=(?:${e})|$)`,"gi")}function oe(s={}){const e=ne(s.noteKeywords,s.notesPattern),t=se(s.issuePrefixes,s.issuePrefixesCaseSensitive),r=ie(s.referenceActions);return{notes:e,referenceParts:t,references:r,mentions:/@([\w-]+)/g,url:/\b(?:https?):\/\/(?:www\.)?([-a-zA-Z0-9@:%_+.~#?&//=])+\b/}}const ce="------------------------ >8 ------------------------";function j(s){const e=s.match(/[^\r\n]/);if(typeof e?.index!="number")return"";const t=e.index;let r=s.length-1;for(;s[r]==="\r"||s[r]===`
|
|
2
|
+
`;)r--;return s.substring(t,r+1)}function A(s,e){return s?`${s}
|
|
3
|
+
${e||""}`:e||""}function ae(s){return s?e=>!e.startsWith(s):()=>!0}function le(s,e){const t=s.indexOf(`${e} ${ce}`);return t===-1?s:s.slice(0,t)}function I(s){return!s.match(/^\s*gpg:/)}function _(s,e,t){const{groups:r}=e;for(let n=0,i=t.length,c;n<i;n++)c=t[n],s[c]=(r?r[c]:e[n+1])||null;return s}const fe={noteKeywords:["BREAKING CHANGE","BREAKING-CHANGE"],issuePrefixes:["#"],referenceActions:["close","closes","closed","fix","fixes","fixed","resolve","resolves","resolved"],headerPattern:/^(\w*)(?:\(([\w$@.\-*/ ]*)\))?: (.*)$/,headerCorrespondence:["type","scope","subject"],revertPattern:/^Revert\s"([\s\S]*)"\s*This reverts commit (\w*)\.?/,revertCorrespondence:["header","hash"],fieldPattern:/^-(.*?)-$/};function T(s={}){return{merge:null,revert:null,header:null,body:null,footer:null,notes:[],mentions:[],references:[],...s}}class he{options;regexes;lines=[];lineIndex=0;commit=T();constructor(e={}){this.options={...fe,...e},this.regexes=oe(this.options)}currentLine(){return this.lines[this.lineIndex]}nextLine(){return this.lines[this.lineIndex++]}isLineAvailable(){return this.lineIndex<this.lines.length}parseReference(e,t){const{regexes:r}=this;if(r.url.test(e))return null;const n=r.referenceParts.exec(e);if(!n)return null;let[i,c=null,u,p]=n,x=null;if(c){const b=c.indexOf("/");b!==-1&&(x=c.slice(0,b),c=c.slice(b+1))}return{raw:i,action:t,owner:x,repository:c,prefix:u,issue:p}}parseReferences(e){const{regexes:t}=this,r=e.match(t.references)?t.references:/()(.+)/gi,n=[];let i,c,u,p;for(;i=r.exec(e),!!i;)for(c=i[1]||null,u=i[2]||"";p=this.parseReference(u,c),!!p;)n.push(p);return n}skipEmptyLines(){let e=this.currentLine();for(;e!==void 0&&!e.trim();)this.nextLine(),e=this.currentLine()}parseMerge(){const{commit:e,options:t}=this,r=t.mergeCorrespondence||[],n=this.currentLine(),i=n&&t.mergePattern?n.match(t.mergePattern):null;return i?(this.nextLine(),e.merge=i[0]||null,_(e,i,r),!0):!1}parseHeader(e){e&&this.skipEmptyLines();const{commit:t,options:r}=this,n=r.headerCorrespondence||[],i=t.header??this.nextLine();let c=null;i&&(r.breakingHeaderPattern&&(c=i.match(r.breakingHeaderPattern)),!c&&r.headerPattern&&(c=i.match(r.headerPattern))),i&&(t.header=i),c&&_(t,c,n)}parseMeta(){const{options:e,commit:t}=this;if(!e.fieldPattern||!this.isLineAvailable())return!1;let r,n=null,i=!1;for(;this.isLineAvailable();){if(r=this.currentLine().match(e.fieldPattern),r){n=r[1]||null,this.nextLine();continue}if(n)i=!0,t[n]=A(t[n],this.currentLine()),this.nextLine();else break}return i}parseNotes(){const{regexes:e,commit:t}=this;if(!this.isLineAvailable())return!1;const r=this.currentLine().match(e.notes);let n=[];if(r){const i={title:r[1],text:r[2]};for(t.notes.push(i),t.footer=A(t.footer,this.currentLine()),this.nextLine();this.isLineAvailable();){if(this.parseMeta()||this.parseNotes())return!0;if(n=this.parseReferences(this.currentLine()),n.length?t.references.push(...n):i.text=A(i.text,this.currentLine()),t.footer=A(t.footer,this.currentLine()),this.nextLine(),n.length)break}return!0}return!1}parseBodyAndFooter(e){const{commit:t}=this;if(!this.isLineAvailable())return e;const r=this.parseReferences(this.currentLine()),n=!r.length&&e;return n?t.body=A(t.body,this.currentLine()):(t.references.push(...r),t.footer=A(t.footer,this.currentLine())),this.nextLine(),n}parseBreakingHeader(){const{commit:e,options:t}=this;if(!t.breakingHeaderPattern||e.notes.length||!e.header)return;const r=e.header.match(t.breakingHeaderPattern);r&&e.notes.push({title:"BREAKING CHANGE",text:r[3]})}parseMentions(e){const{commit:t,regexes:r}=this;let n;for(;n=r.mentions.exec(e),!!n;)t.mentions.push(n[1])}parseRevert(e){const{commit:t,options:r}=this,n=r.revertCorrespondence||[],i=r.revertPattern?e.match(r.revertPattern):null;i&&(t.revert=_({},i,n))}cleanupCommit(){const{commit:e}=this;e.body&&(e.body=j(e.body)),e.footer&&(e.footer=j(e.footer)),e.notes.forEach(r=>{r.text=j(r.text)});const t=new Set;e.references=e.references.filter(r=>{const n=`${r.action} ${r.raw}`.toLocaleLowerCase(),i=!t.has(n);return i&&t.add(n),i})}parse(e){if(!e.trim())throw new TypeError("Expected a raw commit");const{commentChar:t}=this.options,r=ae(t),n=j(e).split(/\r?\n/),i=t?le(n,t).filter(x=>r(x)&&I(x)):n.filter(x=>I(x)),c=T();this.lines=i,this.lineIndex=0,this.commit=c;const u=this.parseMerge();this.parseHeader(u),c.header&&(c.references=this.parseReferences(c.header));let p=!0;for(;this.isLineAvailable();)this.parseMeta(),this.parseNotes()&&(p=!1),this.parseBodyAndFooter(p)||(p=!1);return this.parseBreakingHeader(),this.parseMentions(e),this.parseRevert(e),this.cleanupCommit(),c}}const N={build:"patch",chore:"patch",ci:"patch",docs:"patch",feat:"minor",fix:"patch",perf:"patch",refactor:"patch",style:"patch",test:"patch"},ue=new he,pe=/^Revert\s+"(.+)"\s*$/,de=/This reverts commit\s+([0-9a-f]{7,40})/i,me=/^(?:[\p{Emoji_Presentation}\p{Extended_Pictographic}]|:\w+:)\s+/u,ge=(s,e)=>{const t=s.replace(me,""),r=ue.parse(`${t}
|
|
4
|
+
|
|
5
|
+
${e}`);return{breaking:r.notes.some(n=>/BREAKING/i.test(n.title)),scope:r.scope??void 0,type:r.type??void 0}},xe=(s,e,t)=>{let r,n=!1;if(t.type==="revert"){n=!0;const u=s.indexOf(":");u!==-1&&(r=s.slice(u+1).trim())}else{const u=pe.exec(s.trim());u&&(n=!0,r=u[1]?.trim())}let i;const c=de.exec(e);return c&&(i=c[1]?.toLowerCase()),{isRevert:n,targetSha:i,targetSubject:r}},ve=(s,e=new Set,t)=>{const r=s.map(o=>{const l=ge(o.subject,o.body),{isRevert:a,targetSha:f,targetSubject:d}=xe(o.subject,o.body,l);return{...o,cancelled:!1,parsed:l,revert:a,revertSubject:d,revertTargetSha:f}}),n=r.toReversed(),i=12,c=new Map;for(const o of n)if(c.set(o.hash,o),o.hash.length>=7){const l=Math.min(o.hash.length-1,i);for(let a=7;a<=l;a+=1){const f=o.hash.slice(0,a);if(c.has(f)){const d=c.get(f);d!==null&&d!==o&&c.set(f,null)}else c.set(f,o)}}const u=(o,l)=>{if(o.revertTargetSha){const a=o.revertTargetSha.toLowerCase();let f=c.get(a)??void 0;if(f||(f=n.find(d=>d.hash.startsWith(a))),f&&f!==o)return f}if(o.revertSubject)for(let a=l.length-1;a>=0;a-=1){const f=l[a];if(f.subject===o.revertSubject)return f}},p=64,x=o=>{let l=o;for(let a=0;a<p;a+=1){if(!l.revert)return l;const f=l.cancelledBy;let d;if(f&&(d=c.get(f)??void 0,d||(d=c.get(f.slice(0,7))??void 0)),!d||d===l)return l;l=d}},b=[],w=[];for(const o of n){if(o.revert){const l=u(o,w);if(l){if(e.has(l.hash)){w.push(o);continue}const a=x(l);if(a===void 0){b.push(`Revert chain at ${o.hash} exceeded depth limit (${p}) — skipping cancellation`),w.push(o);continue}if(e.has(a.hash)){w.push(o);continue}a.cancelled=!a.cancelled,a.cancelledBy=a.cancelled?o.hash:void 0,o.cancelled=!0,o.cancelledBy=l.hash}}w.push(o)}const L=r.filter(o=>!o.cancelled&&!o.revert&&!o.subject?.startsWith("Merge ")),C=L.filter(o=>!o.parsed.type);if(L.length>0&&C.length/L.length>.5){const o=t??"<from>..HEAD";b.push(`${C.length}/${L.length} commits in ${o} have no conventional-commits prefix. Consider enabling commit-message linting.`)}return{commits:r,warnings:b}},Ae=async({fs:s,logger:e,options:t,workspaceRoot:r})=>{const n=r??process.cwd(),i=await J({cwd:n,skipRegistryLookup:!0}),{printConfigIfRequested:c}=await import("./print-config.js");if(c(t,i,e))return;const u=X();let p=t.from;if(!p){const h=i.config.baseBranch??"main",m=await u.run("git",["merge-base",`origin/${h}`,"HEAD"],{cwd:n,silent:!0});if(m.exitCode===0&&m.stdout.trim())p=m.stdout.trim();else{const g=await u.run("git",["merge-base",h,"HEAD"],{cwd:n,silent:!0});p=g.exitCode===0?g.stdout.trim():"HEAD~10"}}const x=new Map;for(const h of i.packages){const m=(h.dir.startsWith(n)?h.dir.slice(n.length):h.dir).replaceAll("\\","/").replace(/^\/+/,"");x.set(m,h.name)}const b=h=>{for(const[m,g]of x)if(h.startsWith(`${m}/`)||h===`${m}/package.json`)return g},w=Math.random().toString(16).slice(2,10),L=`@@VIS_RELEASE_COMMIT_${w}@@`,C=`@@VIS_RELEASE_FILES_${w}@@`,o=await u.run("git",["log",`${p}..HEAD`,`--pretty=format:${L}%n%H%n%s%n%b%n${C}`,"--name-only"],{cwd:n,silent:!0});if(o.exitCode!==0){e.error(`git log failed: ${o.stderr}`),process.exitCode=1;return}const l=new Map,a=[],f=[],d=o.stdout.split(L).map(h=>h.trim()).filter(Boolean);for(const h of d){const[m,g=""]=h.split(C).toReversed(),E=g.split(`
|
|
6
|
+
`),$=E[0]?.trim()??"",y=E[1]?.trim()??"",v=E.slice(2).join(`
|
|
7
|
+
`).trim(),R=(m??"").split(`
|
|
8
|
+
`).map(z=>z.trim()).filter(Boolean);$&&f.push({body:v,files:R,hash:$,subject:y})}const{commits:F,warnings:G}=ve(f,void 0,`${p}..HEAD`);for(const h of G)e.warn(h);for(const{cancelled:h,files:m,parsed:g,subject:E}of F){if(h)continue;let $="patch";g.breaking?$="major":g.type&&N[g.type]&&($=N[g.type]??"patch");const y=new Set;if(g.scope)for(const v of i.packages)(v.name===g.scope||v.name.endsWith(`/${g.scope}`))&&y.add(v.name);if(y.size===0)for(const v of m){const R=b(v);R&&y.add(R)}for(const v of y){const R=l.get(v);l.set(v,R?te(R,$):$)}y.size>0&&a.push(`- ${E}`)}if(l.size===0){e.info("No commits affected workspace packages — nothing to generate.");return}const O={bumps:Object.fromEntries(l)},K=a.length>0?a.join(`
|
|
9
|
+
`):"Auto-generated change file.",k=Q(O,K);if(t.dryRun){e.info("[dry-run] would write:"),e.info(k);return}const B=i.config.changesDir??Z,W=(t.name??ee()).replaceAll(/[^a-z0-9-]/gi,"-"),H=M(n,B,`${W}.md`);await s.mkdir(M(n,B),{recursive:!0}),await s.writeFile(H,k),e.info(`Created ${Y(n,H)}`);for(const[h,m]of l)e.info(` ${h}: ${m}`)};export{Ae as default};
|