@visulima/vis 1.0.0-alpha.18 → 1.0.0-alpha.19
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 +23 -0
- package/dist/packem_chunks/bin.js +3 -3
- package/dist/packem_chunks/handler10.js +1 -1
- package/dist/packem_chunks/handler20.js +1 -1
- package/dist/packem_chunks/handler39.js +5 -22
- package/dist/packem_chunks/handler40.js +10 -5
- package/dist/packem_chunks/handler41.js +24 -10
- package/dist/packem_chunks/handler42.js +153 -24
- package/dist/packem_chunks/handler43.js +25 -153
- package/dist/packem_chunks/handler44.js +24 -25
- package/dist/packem_chunks/handler47.js +1 -1
- package/dist/packem_chunks/help-command.js +8 -8
- package/dist/packem_chunks/index.js +1 -1
- package/dist/packem_shared/{docker-Cw5IT5Ow.js → docker-B4s1fjiN.js} +1 -1
- package/dist/packem_shared/{lifecycle-C7vfQmA3.js → lifecycle-CgK8pcfa.js} +2 -2
- package/index.js +560 -729
- package/package.json +10 -10
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
var
|
|
2
|
-
`)
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
`)
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
`)
|
|
9
|
-
`);Se(n,f,{overwrite:!0}),r.push(n);continue}const p=W(n),c=p.workspaces;Array.isArray(c)?p.workspaces=c.filter(f=>typeof f!="string"||!i.has(f)):c&&Array.isArray(c.packages)&&(c.packages=c.packages.filter(f=>typeof f!="string"||!i.has(f))),C(n,p,{indent:E(n,{useEditorconfig:o}),overwrite:!0}),r.push(n)}return r},"applyDeadWorkspacePatternFixes");var Ue=Object.defineProperty,fe=D((e,s)=>Ue(e,"name",{value:s,configurable:!0}),"f$2");const Ge=["dependencies","devDependencies","peerDependencies","optionalDependencies"],Ke=fe((e,s={})=>{const o=new Set(s.ignoreBlocks),t=Pe(e),r=[];for(const n of t){const a=M(e,n,"package.json"),i=L(a);if(!i)continue;const p=typeof i.name=="string"?i.name:void 0;for(const c of Ge){if(o.has(c))continue;const f=i[c];typeof f=="object"&&f!==null&&!Array.isArray(f)&&Object.keys(f).length===0&&r.push({depType:c,packageDir:n,packageJsonPath:a,packageName:p})}}return r},"lintEmptyDeps"),Qe=fe((e,s={})=>{const{useEditorconfig:o}=s,t=new Map;for(const n of e){const a=t.get(n.packageJsonPath);a?a.push(n):t.set(n.packageJsonPath,[n])}const r=[];for(const[n,a]of t){const i=W(n);for(const p of a){const c=i[p.depType];typeof c=="object"&&c!==null&&!Array.isArray(c)&&Object.keys(c).length===0&&Reflect.deleteProperty(i,p.depType)}C(n,i,{indent:E(n,{useEditorconfig:o}),overwrite:!0}),r.push(n)}return r},"applyEmptyDepsFixes");var Xe=Object.defineProperty,le=D((e,s)=>Xe(e,"name",{value:s,configurable:!0}),"o");const Ye=/\/+$/,Q=/node_modules/,X=/\.git/,Ze=/[$()+.?[\\\]^{|}]/g,et=/\/\*\*$|\/\*\/\*$/,tt=le((e,s)=>{const o=s.replace(Ye,"");if(o.startsWith("!"))return[];const t=[];if(o.endsWith("/*")){const n=o.slice(0,-2),a=K(e,n);if(!I(a))return[];for(const i of G(a,{includeFiles:!1,includeSymlinks:!1,maxDepth:1,skip:[Q,X]}))i.path===a||i.name.startsWith(".")||t.push(M(n,i.name));return t}if(o.endsWith("/**")||o.endsWith("/*/*")){const n=o.replace(et,""),a=K(e,n);if(!I(a))return[];for(const i of G(a,{includeFiles:!1,includeSymlinks:!1,skip:[Q,X]})){if(i.path===a)continue;const p=i.path.slice(a.length+1);t.push(`${n}/${p}`)}return t}if(!o.includes("/")&&o.includes("*")){const n=o.replaceAll(Ze,String.raw`\$&`).replaceAll("*",".*"),a=new RegExp(`^${n}$`);for(const i of G(e,{includeFiles:!1,includeSymlinks:!1,maxDepth:1,skip:[Q,X]}))i.path!==e&&a.test(i.name)&&t.push(i.name);return t}const r=K(e,o);return I(r)&&t.push(o),t},"collectPatternMatches"),ot=le(e=>{const s=re(e)??ve(e)??[],o=new Set,t=[];for(const r of s)for(const n of tt(e,r))n==="."||o.has(n)||(o.add(n),I(M(e,n,"package.json"))||t.push({packageDir:n}));return t},"lintMissingPackageJson");var st=Object.defineProperty,at=D((e,s)=>st(e,"name",{value:s,configurable:!0}),"r$2");const nt=["dependencies","devDependencies","optionalDependencies","peerDependencies"],rt=at((e,s={})=>{const o=new Set(s.depTypes??nt),t=new Set(s.ignoreDeps),r=new Map;for(const a of e)a.packageDir!=="."||!o.has(a.depType)||r.set(a.depName,{depType:a.depType,specifier:a.specifier});if(r.size===0)return[];const n=[];for(const a of e){if(a.packageDir==="."||!o.has(a.depType)||t.has(a.depName))continue;const i=r.get(a.depName);i&&n.push({childSpecifier:a.specifier,depName:a.depName,depType:a.depType,packageDir:a.packageDir,packageJsonPath:a.packageJsonPath,packageName:a.packageName,rootDepType:i.depType,rootSpecifier:i.specifier})}return n},"lintRedefineRoot");var it=Object.defineProperty,ge=D((e,s)=>it(e,"name",{value:s,configurable:!0}),"a$1");const pt=ge((e,s)=>{if(!s)return[];const o=M(e,"package.json"),t=L(o);if(!t)return[];if(t.private!==!0)return[];const r=t.dependencies;if(typeof r!="object"||r===null||Array.isArray(r))return[];const n=Object.keys(r);return n.length===0?[]:[{depNames:n,packageJsonPath:o}]},"lintRootDeps"),ct=ge((e,s={})=>{const{useEditorconfig:o}=s,t=[];for(const r of e){const n=W(r.packageJsonPath),a=n.dependencies;if(typeof a!="object"||a===null)continue;const i=a;n.devDependencies??={};const p=n.devDependencies;for(const c of r.depNames){const f=i[c];typeof f=="string"&&(c in p||(p[c]=f),Reflect.deleteProperty(i,c))}Object.keys(i).length===0&&Reflect.deleteProperty(n,"dependencies"),C(r.packageJsonPath,n,{indent:E(r.packageJsonPath,{useEditorconfig:o}),overwrite:!0}),t.push(r.packageJsonPath)}return t},"applyRootDepsFixes");var ft=Object.defineProperty,de=D((e,s)=>ft(e,"name",{value:s,configurable:!0}),"r$1");const lt=/^[a-z][\w-]*@\S+$/i,gt=de((e,s,o={})=>{if(!s)return[];const t=M(e,"package.json"),r=L(t);if(!r)return[];const n=r.packageManager;return typeof n=="string"&<.test(n)?[]:[{packageJsonPath:t,suggested:o.suggested}]},"lintRootPackageManager"),dt=de((e,s={})=>{const{useEditorconfig:o}=s,t=[];for(const r of e){if(!r.suggested)continue;const n=W(r.packageJsonPath);n.packageManager=r.suggested,C(r.packageJsonPath,n,{indent:E(r.packageJsonPath,{useEditorconfig:o}),overwrite:!0}),t.push(r.packageJsonPath)}return t},"applyRootPackageManagerFixes");var ut=Object.defineProperty,ue=D((e,s)=>ut(e,"name",{value:s,configurable:!0}),"a");const mt=ue((e,s)=>{if(!s)return[];const o=M(e,"package.json"),t=L(o);return t?t.private===!0?[]:[{packageJsonPath:o,rawValue:t.private}]:[]},"lintRootPrivate"),ht=ue((e,s={})=>{const{useEditorconfig:o}=s,t=[];for(const r of e){const n=W(r.packageJsonPath);let a=n;if("private"in n)n.private=!0;else{const{name:i,version:p,...c}=n,f={};i!==void 0&&(f.name=i),p!==void 0&&(f.version=p),f.private=!0;for(const[m,d]of Object.entries(c))f[m]=d;a=f}C(r.packageJsonPath,a,{indent:E(r.packageJsonPath,{useEditorconfig:o}),overwrite:!0}),t.push(r.packageJsonPath)}return t},"applyRootPrivateFixes");var kt=Object.defineProperty,Z=D((e,s)=>kt(e,"name",{value:s,configurable:!0}),"p$1");const yt=[{id:"react",label:"React",members:["react","react-dom","react-test-renderer"]},{id:"next",label:"Next.js",members:["next","@next/font","@next/bundle-analyzer","@next/mdx","@next/third-parties","@next/eslint-plugin-next","eslint-config-next"]},{id:"babel",label:"Babel",prefixes:["@babel/"]},{id:"storybook",label:"Storybook",members:["storybook","sb"],prefixes:["@storybook/"]},{id:"vitest",label:"Vitest",members:["vitest"],prefixes:["@vitest/"]},{id:"playwright",label:"Playwright",members:["playwright","@playwright/test"]},{id:"trpc",label:"tRPC",prefixes:["@trpc/"]},{id:"prisma",label:"Prisma",members:["prisma"],prefixes:["@prisma/"]},{id:"turborepo",label:"Turborepo",members:["turbo","turbo-ignore","@turbo/gen","eslint-config-turbo","eslint-plugin-turbo"]},{id:"typescript-eslint",label:"typescript-eslint",members:["typescript-eslint"],prefixes:["@typescript-eslint/"]},{id:"eslint-stylistic",label:"ESLint Stylistic",prefixes:["@stylistic/"]},{id:"lexical",label:"Lexical",members:["lexical"],prefixes:["@lexical/"]},{id:"nx",label:"Nx",prefixes:["@nx/","@nrwl/"]}],$t=new Set(["dependencies","devDependencies","peerDependencies"]),Pt=Z((e,s)=>{for(const o of e)if(o.members?.includes(s)||o.prefixes?.some(t=>s.startsWith(t)))return o},"familyForDep"),vt=Z(e=>e.startsWith("workspace:")||e.startsWith("catalog:"),"isWorkspaceOrCatalogReference"),wt=Z((e,s={})=>{const o=new Set(s.ignoreFamilies),t=new Map;for(const i of yt)t.set(i.id,i);for(const i of s.extraFamilies??[])t.set(i.id,i);const r=[...t.values()],n=new Map;for(const i of e){if(i.isInternal||!$t.has(i.depType)||vt(i.specifier))continue;const p=Pt(r,i.depName);if(!p||o.has(p.id))continue;const c=n.get(p.id),f={depName:i.depName,depType:i.depType,packageDir:i.packageDir,packageJsonPath:i.packageJsonPath,packageName:i.packageName,specifier:i.specifier};c?c.push(f):n.set(p.id,[f])}const a=[];for(const[i,p]of n){const c=[...new Set(p.map(m=>m.specifier))];if(c.length<2)continue;const f=t.get(i);f&&a.push({family:i,familyLabel:f.label??i,members:p,specifiers:c})}return a},"lintSimilarDeps");var Dt=Object.defineProperty,B=D((e,s)=>Dt(e,"name",{value:s,configurable:!0}),"r");const bt=B(e=>e.startsWith("@types/"),"isTypesPackage"),xt=B((e,s={})=>{const o=new Set(s.ignoreDeps),t=new Map,r=B(a=>{const i=t.get(a);if(i!==void 0)return i;try{const p=W(a).private===!0;return t.set(a,p),p}catch{return t.set(a,!1),!1}},"isPrivate"),n=[];for(const a of e)a.depType==="dependencies"&&bt(a.depName)&&(o.has(a.depName)||r(a.packageJsonPath)&&n.push({childSpecifier:a.specifier,depName:a.depName,packageDir:a.packageDir,packageJsonPath:a.packageJsonPath,packageName:a.packageName}));return n},"lintTypesInDeps"),Nt=B((e,s={})=>{const{useEditorconfig:o}=s,t=new Map;for(const n of e){const a=t.get(n.packageJsonPath);a?a.push(n):t.set(n.packageJsonPath,[n])}const r=[];for(const[n,a]of t){const i=W(n),p=i.dependencies;if(typeof p!="object"||p===null)continue;const c=p;i.devDependencies??={};const f=i.devDependencies;for(const m of a){const d=c[m.depName];typeof d=="string"&&(m.depName in f||(f[m.depName]=d),Reflect.deleteProperty(c,m.depName))}Object.keys(c).length===0&&Reflect.deleteProperty(i,"dependencies"),C(n,i,{indent:E(n,{useEditorconfig:o}),overwrite:!0}),r.push(n)}return r},"applyTypesInDepsFixes");var Jt=Object.defineProperty,q=D((e,s)=>Jt(e,"name",{value:s,configurable:!0}),"f");const Tt=q(e=>e.startsWith("workspace:"),"isWorkspaceSpecifier"),St=q((e,s={})=>{const o=s.fixSpecifier??"workspace:*",t=[];for(const r of e)r.isInternal&&(Tt(r.specifier)||t.push({depName:r.depName,depType:r.depType,fix:o,packageDir:r.packageDir,packageJsonPath:r.packageJsonPath,packageName:r.packageName,specifier:r.specifier}));return t},"lintWorkspaceProtocol"),Rt=q((e,s,o,t)=>{const r=s.split(".");let n=e;for(let p=0;p<r.length-1;p+=1){const c=r[p],f=n[c];(typeof f!="object"||f===null)&&(n[c]={}),n=n[c]}const a=r.at(-1);let i=n[a];(typeof i!="object"||i===null)&&(i={},n[a]=i),i[o]=t},"setNestedField"),Mt=q((e,s={})=>{const{useEditorconfig:o}=s,t=new Map;for(const n of e){const a=t.get(n.packageJsonPath);a?a.push(n):t.set(n.packageJsonPath,[n])}const r=[];for(const[n,a]of t){const i=W(n);for(const p of a)if(p.depType.includes("."))Rt(i,p.depType,p.depName,p.fix);else{const c=i[p.depType];typeof c=="object"&&c!==null&&(c[p.depName]=p.fix)}C(n,i,{indent:E(n,{useEditorconfig:o}),overwrite:!0}),r.push(n)}return r},"applyWorkspaceProtocolFixes");var Wt=Object.defineProperty,V=D((e,s)=>Wt(e,"name",{value:s,configurable:!0}),"p");const jt=new Set(["dependencies","devDependencies","peerDependencies"]),Ft=V(e=>e.startsWith("catalog:"),"isCatalogReference"),It=V(e=>e.startsWith("workspace:"),"isWorkspaceReference"),Et=V(e=>{if(!e.startsWith("catalog:"))return;const s=e.slice(8);return s===""?"default":s},"catalogNameOf"),Ct=V((e,s)=>{if(e.get("default")?.has(s))return"default";const o=[...e.keys()].filter(t=>t!=="default").sort();for(const t of o)if(e.get(t)?.has(s))return t},"findCatalogPinning"),Vt=V(e=>e==="default"?"catalog:":`catalog:${e}`,"buildCatalogSpecifier"),At=V((e,s)=>{const o=[...e].sort((r,n)=>(r.packageName??r.packageDir).localeCompare(n.packageName??n.packageDir));let t;for(const r of o){const n=te(r.specifier);if(!n)continue;if(!t){t=r;continue}const a=te(t.specifier);if(!a){t=r;continue}const i=oe(a,n),p=oe(n,a);(s==="highest"&&i||s==="lowest"&&p)&&(t=r)}if(t)return{canonical:t,canonicalSource:t.packageName??t.packageDir}},"pickCanonicalBySemver"),Ot=V((e,s={})=>{const o=s.resolve??"highest",t=new Set(s.ignoreDeps),r=[],n=e.filter(i=>i.isInternal||!jt.has(i.depType)||It(i.specifier)||s.dep!==void 0&&i.depName!==s.dep?!1:!t.has(i.depName)),a=new Map;for(const i of n){const p=a.get(i.depName);p?p.push(i):a.set(i.depName,[i])}for(const[i,p]of a){const c=s.pinned?.get(i);if(c!==void 0){for(const g of p)g.specifier!==c&&r.push({canonicalSource:"cli:--pin",depName:i,depType:g.depType,fix:c,packageDir:g.packageDir,packageJsonPath:g.packageJsonPath,packageName:g.packageName,specifier:g.specifier});continue}if(o==="catalog"){const{catalogs:g}=s;if(!g)continue;const h=Ct(g,i);if(!h)continue;const $=Vt(h);for(const T of p)Et(T.specifier)!==h&&r.push({canonicalSource:`catalog:${h}`,depName:i,depType:T.depType,fix:$,packageDir:T.packageDir,packageJsonPath:T.packageJsonPath,packageName:T.packageName,specifier:T.specifier});continue}const f=p.filter(g=>!Ft(g.specifier));if(f.length<2||new Set(f.map(g=>g.specifier)).size<=1)continue;const m=At(f,o);if(!m)continue;const d=m.canonical.specifier;for(const g of f)g.specifier!==d&&r.push({canonicalSource:m.canonicalSource,depName:i,depType:g.depType,fix:d,packageDir:g.packageDir,packageJsonPath:g.packageJsonPath,packageName:g.packageName,specifier:g.specifier})}return r},"lintWorkspaceVersions"),Ht=V((e,s={})=>{const{useEditorconfig:o}=s,t=new Map;for(const n of e){const a=t.get(n.packageJsonPath);a?a.push(n):t.set(n.packageJsonPath,[n])}const r=[];for(const[n,a]of t){const i=W(n);for(const p of a){const c=i[p.depType];typeof c=="object"&&c!==null&&(c[p.depName]=p.fix)}C(n,i,{indent:E(n,{useEditorconfig:o}),overwrite:!0}),r.push(n)}return r},"applyWorkspaceVersionsFixes");var _t=Object.defineProperty,y=D((e,s)=>_t(e,"name",{value:s,configurable:!0}),"u");const zt=y(e=>{if(I(M(e,"pnpm-workspace.yaml")))return!0;const s=M(e,"package.json");if(!I(s))return!1;try{return W(s).workspaces!==void 0}catch{return!1}},"detectWorkspaceConfig"),A=y((e,s)=>{const o=new Map;for(const t of e){const r=s(t),n=o.get(r);n?n.push(t):o.set(r,[t])}return o},"groupBy"),Bt=y((e,s,o,t)=>{if(e.length===0){t.info(w("✓ workspace-protocol: no violations"));return}const r=o?"Fixed":"Found",n=o?R:x;t.info(n(v(`${r} ${String(e.length)} workspace-protocol violation${e.length===1?"":"s"}`)));for(const[a,i]of A(e,p=>p.packageName??p.packageJsonPath)){const p=P(s,i[0].packageJsonPath);t.info(` ${v(a)} ${u(`(${p})`)}`);for(const c of i){const f=o?R("→"):x("→");t.info(` ${u(c.depType)} ${c.depName}: ${b(c.specifier)} ${f} ${w(c.fix)}`)}}o||t.info(u(" Run with --fix to rewrite specifiers in place."))},"printWorkspaceProtocolHuman"),Lt=y((e,s,o)=>{if(e.length===0){o.info(w("✓ redefine-root: no violations"));return}o.info(x(v(`Found ${String(e.length)} dep${e.length===1?"":"s"} re-declared from root`)));for(const[t,r]of A(e,n=>n.packageName??n.packageJsonPath)){const n=P(s,r[0].packageJsonPath);o.info(` ${v(t)} ${u(`(${n})`)}`);for(const a of r)o.info(` ${u(a.depType)} ${a.depName}: ${b(a.childSpecifier)} ${u(`(root ${a.rootDepType}: ${a.rootSpecifier})`)}`)}o.info(u(" Remove these from child package.json files — root pin will resolve."))},"printRedefineRootHuman"),qt=y((e,s,o,t)=>{if(e.length===0){t.info(w("✓ workspace-versions: no drift"));return}const r=o?"Fixed":"Found",n=o?R:x;t.info(n(v(`${r} ${String(e.length)} workspace-version drift${e.length===1?"":"s"}`)));for(const[a,i]of A(e,p=>p.depName)){const p=i[0].fix,c=i[0].canonicalSource;t.info(` ${v(a)} ${u(`canonical: ${p} (from ${c})`)}`);for(const f of i){const m=P(s,f.packageJsonPath),d=f.packageName??m,g=o?R("→"):x("→");t.info(` ${d} ${u(`(${m})`)} ${u(f.depType)}: ${b(f.specifier)} ${g} ${w(f.fix)}`)}}o||t.info(u(" Run with --fix to align drifting specifiers."))},"printWorkspaceVersionsHuman"),Ut=y((e,s,o)=>{if(e.length===0){o.info(w("✓ banned-deps: no violations"));return}o.info(b(v(`Found ${String(e.length)} banned dep${e.length===1?"":"s"}`)));for(const[t,r]of A(e,n=>n.packageName??n.packageJsonPath)){const n=P(s,r[0].packageJsonPath);o.info(` ${v(t)} ${u(`(${n})`)}`);for(const a of r){const i=a.replacement?` ${u("→")} ${w(a.replacement)}`:"";o.info(` ${u(a.depType)} ${b(a.depName)}${i}`),o.info(` ${u(a.reason)}`)}}},"printBannedDepsHuman"),Gt=y((e,s,o,t)=>{if(e.length===0){t.info(w("✓ catalog-proposals: nothing worth promoting"));return}const r=o?"Added":"Would add",n=o?R:x;t.info(n(v(`${r} ${String(e.length)} catalog entr${e.length===1?"y":"ies"}`)));for(const a of e)t.info(` ${v(a.depName)}: ${w(a.specifier)} ${u(`(${String(a.instanceCount)} packages agree)`)}`);if(!o){const a=ze(s,e);if(a){t.info(""),t.info(u("Proposed pnpm-workspace.yaml changes:"));for(const i of a.split(`
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
`)}for(const o of e.catalogProposals??[])process.stdout.write(`catalog-proposal ${o.catalogName} ${o.depName} ${o.specifier} ${String(o.instanceCount)}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
`)}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
`)},"printJson"),S=y((e,s,o)=>{const t=e[s];return typeof t=="boolean"?t:e[o]===!0},"flag"),io=y(e=>{const s=e,o=(e.ban?.length??0)>0,t=(e.pin?.length??0)>0,r=S(s,"workspaceProtocol","workspace-protocol"),n=S(s,"redefineRoot","redefine-root"),a=S(s,"bannedDeps","banned-deps"),i=S(s,"workspaceVersions","workspace-versions"),p=S(s,"customTypes","custom-types"),c=S(s,"emptyDeps","empty-deps"),f=S(s,"rootPrivate","root-private"),m=S(s,"rootPackageManager","root-package-manager"),d=S(s,"rootDeps","root-deps"),g=S(s,"missingPackageJson","missing-package-json"),h=S(s,"deadWorkspacePatterns","dead-workspace-patterns"),$=S(s,"typesInDeps","types-in-deps"),T=S(s,"similarDeps","similar-deps");return r||n||a||i||p||c||f||m||d||g||h||$||T||o||t?{bannedDeps:a||o,customTypes:p,deadWorkspacePatterns:h,emptyDeps:c,missingPackageJson:g,redefineRoot:n,rootDeps:d,rootPackageManager:m,rootPrivate:f,similarDeps:T,typesInDeps:$,workspaceProtocol:r,workspaceVersions:i||t}:{bannedDeps:!0,customTypes:!0,deadWorkspacePatterns:!0,emptyDeps:!0,missingPackageJson:!0,redefineRoot:!0,rootDeps:!0,rootPackageManager:!0,rootPrivate:!0,similarDeps:!0,typesInDeps:!0,workspaceProtocol:!0,workspaceVersions:!0}},"resolveSelection"),po=y(e=>{const s=new Map;for(const o of e??[]){const t=o.lastIndexOf("@");if(t<=0||t===o.length-1)throw new Error(`Invalid --pin "${o}". Use: name@<specifier> (e.g. react@^18.2.0).`);const r=o.slice(0,t),n=o.slice(t+1);s.set(r,n)}return s},"parsePinFlags"),co=new Set(["catalog","highest","lowest"]),fo=y(e=>{if(e===void 0)return"highest";if(!co.has(e))throw new Error(`Invalid --resolve "${e}". Use: highest, lowest, or catalog.`);return e},"parseResolveStrategy"),F=y((e,s)=>e?s===void 0||s===!0:!1,"isAutofixAllowed"),lo={"custom-types":"policy.customTypes.autofix","workspace-protocol":"policy.workspaceProtocol.autofix","workspace-versions":"policy.workspaceVersions.autofix"},Y=y((e,s,o,t)=>{const r=lo[s],n=o==="prompt"?`${r} = "prompt" (interactive mode not yet implemented; report-only)`:`${r} = false`,a=`Set "${r}": true (or remove it) to enable rewrites.`;e.warn(`${s}: ${String(t)} issue${t===1?"":"s"} not rewritten — ${n}. ${a}`)},"warnAutofixDenied"),yo=y(async({logger:e,options:s,visConfig:o,workspaceRoot:t})=>{if(!t)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const r=t,n=s.fix??!1,a=s.format??"human",i=s.quiet??!1;if(!["human","json","minimal"].includes(a))throw new Error(`Invalid --format "${a}". Use: human, json, or minimal.`);const p=io(s),c=o?.policy??{},f=o?.editorconfig??!0,m=po(s.pin),d=s.ban??[];(s.dep!==void 0||s.resolve!==void 0)&&!p.workspaceVersions&&!i&&e.warn("--dep / --resolve only apply to --workspace-versions; ignored.");const g=we(r),h={},$={catalogProposals:!1,customTypes:!1,deadWorkspacePatterns:!1,emptyDeps:!1,rootDeps:!1,rootPackageManager:!1,rootPrivate:!1,typesInDeps:!1,workspaceProtocol:!1,workspaceVersions:!1},T=zt(r);let N=0;if(p.workspaceProtocol){const l=St(g,{fixSpecifier:s.fixSpecifier}),k=F(n,c.workspaceProtocol?.autofix);k&&l.length>0&&(Mt(l,{useEditorconfig:f}),$.workspaceProtocol=!0),h.workspaceProtocol=l,k||(N+=l.length),n&&!k&&l.length>0&&!i&&Y(e,"workspace-protocol",c.workspaceProtocol?.autofix,l.length)}if(p.redefineRoot){const l=rt(g,{ignoreDeps:c.redefineRoot?.ignore});h.redefineRoot=l,N+=l.length}if(p.workspaceVersions){const l=fo(s.resolve??c.workspaceVersions?.resolve),k=l==="catalog"?De(r):void 0;l==="catalog"&&(!k||k.size===0)&&!i&&e.warn("--resolve catalog: no catalog found in pnpm-workspace.yaml or root package.json — nothing to align.");const J=Ot(g,{catalogs:k,dep:s.dep,ignoreDeps:c.workspaceVersions?.ignore,pinned:m.size>0?m:void 0,resolve:l}),H=F(n,c.workspaceVersions?.autofix);if(H&&J.length>0&&(Ht(J,{useEditorconfig:f}),$.workspaceVersions=!0),h.workspaceVersions=J,H||(N+=J.length),n&&!H&&J.length>0&&!i&&Y(e,"workspace-versions",c.workspaceVersions?.autofix,J.length),s.proposeMin!==void 0){if(l!=="catalog"&&!i)e.warn("--propose-min only runs under --resolve catalog; ignored.");else if(l==="catalog"){const j=He(g,{catalogs:k,ignoreDeps:c.workspaceVersions?.ignore,min:s.proposeMin});H&&j.length>0&&(_e(r,j),$.catalogProposals=!0),h.catalogProposals=j}}}if(p.customTypes){const l=c.customTypes?.extraTypes,k=be(l);if(k.length>0){for(const me of k)e.error(`policy.customTypes.${me}`);process.exitCode=1;return}const J=xe(r,l),H=(s.resolve??c.customTypes?.resolve)==="lowest"?"lowest":"highest",j=Ne(J,{dep:s.dep,ignoreDeps:c.customTypes?.ignore,resolve:H}),U=F(n,c.customTypes?.autofix);U&&j.length>0&&(Je(j,{useEditorconfig:f}),$.customTypes=!0),h.customTypes=j,U||(N+=j.length),n&&!U&&j.length>0&&!i&&Y(e,"custom-types",c.customTypes?.autofix,j.length)}if(p.bannedDeps){const l={...c.bannedDeps};for(const J of d)l[J]={reason:"banned via --ban CLI flag"};Object.keys(l).length===0&&s.bannedDeps&&!i&&e.warn("--banned-deps: no policy.bannedDeps in vis config, nothing to check.");const k=Ie(g,l);h.bannedDeps=k,N+=k.length}if(p.emptyDeps){const l=Ke(r,{ignoreBlocks:c.emptyDeps?.ignoreBlocks}),k=F(n,c.emptyDeps?.autofix);k&&l.length>0&&(Qe(l,{useEditorconfig:f}),$.emptyDeps=!0),h.emptyDeps=l,k||(N+=l.length)}if(p.rootPrivate){const l=mt(r,T),k=F(n,c.rootPrivate?.autofix);k&&l.length>0&&(ht(l,{useEditorconfig:f}),$.rootPrivate=!0),h.rootPrivate=l,k||(N+=l.length)}if(p.rootPackageManager){const l=gt(r,T,{suggested:c.rootPackageManager?.suggested}),k=F(n,c.rootPackageManager?.autofix);k&&l.some(J=>J.suggested!==void 0)&&(dt(l,{useEditorconfig:f}),$.rootPackageManager=!0),h.rootPackageManager=l,(!k||!$.rootPackageManager)&&(N+=l.filter(J=>J.suggested===void 0||!$.rootPackageManager).length)}if(p.rootDeps){const l=pt(r,T),k=F(n,c.rootDeps?.autofix);k&&l.length>0&&(ct(l,{useEditorconfig:f}),$.rootDeps=!0),h.rootDeps=l,k||(N+=l.length)}if(p.missingPackageJson){const l=ot(r);h.missingPackageJson=l,N+=l.length}if(p.deadWorkspacePatterns){const l=Le(r),k=F(n,c.deadWorkspacePatterns?.autofix);k&&l.length>0&&(qe(l,{useEditorconfig:f}),$.deadWorkspacePatterns=!0),h.deadWorkspacePatterns=l,k||(N+=l.length)}if(p.typesInDeps){const l=xt(g,{ignoreDeps:c.typesInDeps?.ignore}),k=F(n,c.typesInDeps?.autofix);k&&l.length>0&&(Nt(l,{useEditorconfig:f}),$.typesInDeps=!0),h.typesInDeps=l,k||(N+=l.length)}if(p.similarDeps){const l=wt(g,{extraFamilies:c.similarDeps?.extraFamilies,ignoreFamilies:c.similarDeps?.ignoreFamilies});h.similarDeps=l,N+=l.length}i||(a==="json"?ro(h,r,$,p):a==="minimal"?no(h,r):ao(h,r,$,p,e)),N>0&&(process.exitCode=1)},"execute");export{yo as default};
|
|
1
|
+
var Fe=Object.defineProperty;var k=(e,t)=>Fe(e,"name",{value:t,configurable:!0});import{createRequire as Ae}from"node:module";import{M as g,a as S,$ as M,h as pe}from"./config.js";import{b0 as he,b1 as X,b2 as Be,b3 as Me,b4 as Z,b5 as Ne,b6 as He,b7 as De,a$ as We,b8 as me,b9 as $e,ba as ye}from"./bin.js";import{d as Le}from"../packem_shared/readTomlSync-1fKo0R52-DtxWULlF.js";import{NATIVE_BINDING_VERSION as ie,allKnownTags as qe,tagsFromPath as Ge,tagsFromPaths as Je,parseShebang as Ke}from"#native";const _e=Ae(import.meta.url),I=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,V=k(e=>{if(typeof I<"u"&&I.versions&&I.versions.node){const[t,o]=I.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return I.getBuiltinModule(e)}return _e(e)},"__cjs_getBuiltinModule"),{readdirSync:de,statSync:z,readFileSync:N,existsSync:H,writeFileSync:x,unlinkSync:Pe,rmSync:Te,chmodSync:Ce}=V("node:fs"),{cwd:B}=I,{createInterface:Ie}=V("node:readline"),{spawnSync:R}=V("node:child_process"),{basename:Ve}=V("node:path");var Ue=Object.defineProperty,q=k((e,t)=>Ue(e,"name",{value:t,configurable:!0}),"c$6");const ze=/^# ([^:\s]\S*)(?::\s+(.+))?$/,Ye=q(e=>{const t=[],o=e.split(`
|
|
2
|
+
`);let r;for(const s of o){if(s.startsWith("#!")||s.startsWith("# Generated by")||s.startsWith("# NOTE:")||s==="set -e"||s==="")continue;const n=ze.exec(s);if(n){r&&t.push(r),r={command:"",id:n[1]??"",...n[2]?{name:n[2]}:{}};continue}r?r.command=r.command.length>0?`${r.command}
|
|
3
|
+
${s}`:s:r={command:s,id:"(custom)"}}return r&&t.push(r),t},"parseStageScript"),Qe=q((e,t)=>{const o=g(e,t),r=[],s=new Set(he);if(S(o))for(const n of de(o)){if(n.startsWith(".")||n==="_"||!s.has(n))continue;const i=g(o,n);if(!z(i).isFile())continue;const a=M(i),c=Ye(a);r.push({blocks:c,rawLineCount:a.split(`
|
|
4
|
+
`).length,stage:n})}return r.sort((n,i)=>n.stage.localeCompare(i.stage)),{hooksDirectory:t,stages:r}},"listHooks"),Xe=q(e=>{const t=[];if(e.stages.length===0)return t.push(`No hooks installed in ${e.hooksDirectory}/.`),t;t.push(`Hooks in ${e.hooksDirectory}/:`);for(const o of e.stages)if(t.push("",`${o.stage} (${o.rawLineCount} lines)`),o.blocks.length===0)t.push(" (empty)");else for(const r of o.blocks){const s=r.name?`${r.id} — ${r.name}`:r.id;t.push(` - ${s}`);const n=r.command.split(`
|
|
5
|
+
`).find(i=>i.trim()!=="");if(n){const i=n.length>120?`${n.slice(0,117)}...`:n;t.push(` ${i}`)}}return t},"formatListResult"),Ze=q((e,t)=>{const o=Qe(B(),e);for(const r of Xe(o))t.info(r)},"runList");var et=Object.defineProperty,O=k((e,t)=>et(e,"name",{value:t,configurable:!0}),"o$2");const ae=3;if(ie!==ae)throw new Error(`vis native binding ABI mismatch: expected ${ae}, got ${ie}. Rebuild via \`pnpm --filter @visulima/vis run build:native\` or reinstall the platform binding package.`);const ke={".releaserc":["release-config","vis-config"],".releaserc.json":["release-config","vis-config"],"nx.json":["nx-workspace","vis-config"],"packem.config.js":["packem-config","vis-config"],"packem.config.mjs":["packem-config","vis-config"],"packem.config.ts":["packem-config","vis-config"],"pnpm-workspace.yaml":["pnpm-workspace","vis-config"],"project.json":["nx-project","vis-config"],"turbo.json":["turbo-config","vis-config"],"vis.config.js":["vis-config"],"vis.config.ts":["vis-config"]},ve=[[".releaserc.json",["release-config","vis-config"]]],we=O(e=>{const t=new Set,o=Ve(e),r=ke[o];if(r)for(const n of r)t.add(n);const s=o.toLowerCase();for(const[n,i]of ve)if(s.endsWith(n))for(const a of i)t.add(a);return t},"classifyVis"),be=new Set([...Object.values(ke).flat(),...ve.flatMap(([,e])=>e)]);let K;const xe=O(()=>(K||(K=new Set(qe())),K),"getPrekUniverse");O(e=>{const t=new Set(Ge(e)),o=we(e);return{all:new Set([...t,...o]),prek:t,vis:o}},"classify");const tt=O(e=>{const t=Je([...e]),o=new Map;for(const[r,s]of e.entries()){const n=new Set(t[r]),i=we(s),a=new Set([...n,...i]);o.set(s,{all:a,prek:n,vis:i})}return o},"classifyMany");O(e=>Ke(e),"parseShebang");const ot=O(e=>xe().has(e)||be.has(e),"isKnownTag");O(e=>xe().has(e),"isPrekTag");O(e=>be.has(e),"isVisTag");const rt=O((e,t)=>{const{all:o}=e;if(t.types&&t.types.length>0){for(const r of t.types)if(!o.has(r))return!1}if(t.typesOr&&t.typesOr.length>0){let r=!1;for(const s of t.typesOr)if(o.has(s)){r=!0;break}if(!r)return!1}if(t.excludeTypes&&t.excludeTypes.length>0){for(const r of t.excludeTypes)if(o.has(r))return!1}return!0},"matchesFilter");var nt=Object.defineProperty,_=k((e,t)=>nt(e,"name",{value:t,configurable:!0}),"s$2");const st=_(e=>{let t=0;const o=e.length,r=_(()=>{for(;t<o&&/\s/.test(e[t]);)t+=1},"skipWs"),s=_(()=>{if(e[t]!=='"')throw new Error(`expected string at ${t}`);t+=1;const c=t;for(;t<o&&e[t]!=='"';)e[t]==="\\"?t+=2:t+=1;const l=e.slice(c,t);return t+=1,JSON.parse(`"${l}"`)},"parseString"),n=_(()=>{r();const c=e[t];if(c==="{")a();else if(c==="[")i();else if(c==='"')s();else for(;t<o&&",}]".indexOf(e[t])===-1&&!/\s/.test(e[t]);)t+=1},"parseValue"),i=_(()=>{if(t+=1,r(),e[t]==="]"){t+=1;return}for(;t<o;)if(n(),r(),e[t]===",")t+=1,r();else if(e[t]==="]"){t+=1;return}},"parseArray"),a=_(()=>{t+=1,r();const c=new Set;if(e[t]==="}"){t+=1;return}for(;t<o;){r();const l=s();if(c.has(l))throw new Error(`Duplicate key: ${l}`);if(c.add(l),r(),e[t]!==":")throw new Error(`expected colon at ${t}`);if(t+=1,n(),r(),e[t]===",")t+=1,r();else if(e[t]==="}"){t+=1;return}}},"parseObject");r(),n()},"detectDuplicateJsonKeys"),it=_((e,t,o)=>{let r=0;for(const s of e){const n=N(g(o.root,s),"utf8");try{JSON.parse(n),st(n)}catch(i){const a=i instanceof Error?i.message:String(i);o.logger.info(`${s}: Failed to json decode (${a})`),r=1}}return r},"runCheckJson");var at=Object.defineProperty,Ee=k((e,t)=>at(e,"name",{value:t,configurable:!0}),"c$5");const ct=Ee(e=>{const t=R("git",["rev-parse","--git-dir"],{cwd:e,encoding:"utf8"});if(t.status!==0)return!1;const o=t.stdout.trim(),r=o.startsWith("/")?o:g(e,o);return H(g(r,"MERGE_MSG"))?H(g(r,"MERGE_HEAD"))||H(g(r,"rebase-apply"))||H(g(r,"rebase-merge")):!1},"isInMerge"),ft=["<<<<<<< ","======= ",`=======\r
|
|
6
|
+
`,`=======
|
|
7
|
+
`,">>>>>>> "],lt=Ee((e,t,o)=>{if(!t.includes("--assume-in-merge")&&!ct(o.root))return 0;let r=0;for(const s of e){const n=N(g(o.root,s),"utf8").split(`
|
|
8
|
+
`);for(let i=0;i<n.length;i+=1){const a=n[i]+(i<n.length-1?`
|
|
9
|
+
`:"");for(const c of ft)a.startsWith(c)&&(o.logger.info(`${s}:${i+1}: Merge conflict string ${JSON.stringify(c.trim())} found`),r=1)}}return r},"runCheckMergeConflict");var ut=Object.defineProperty,gt=k((e,t)=>ut(e,"name",{value:t,configurable:!0}),"c$4");const dt=gt((e,t,o)=>{let r=0;for(const s of e){const n=g(o.root,s),i=N(n);if(i.length===0)continue;let a=i.length;const c=i[a-1];if(c!==10&&c!==13){x(n,Buffer.concat([i,Buffer.from([10])])),o.logger.info(`Fixing ${s}`),r=1;continue}for(;a>0&&(i[a-1]===10||i[a-1]===13);)a-=1;if(a===0){x(n,Buffer.alloc(0)),o.logger.info(`Fixing ${s}`),r=1;continue}const l=i.subarray(a);let d;l[0]===13&&l[1]===10?d=Buffer.from([13,10]):l[0]===13?d=Buffer.from([13]):d=Buffer.from([10]),!l.equals(d)&&(x(n,Buffer.concat([i.subarray(0,a),d])),o.logger.info(`Fixing ${s}`),r=1)}return r},"runEndOfFileFixer");var pt=Object.defineProperty,ce=k((e,t)=>pt(e,"name",{value:t,configurable:!0}),"h$3");const ht={cr:Buffer.from([13]),crlf:Buffer.from([13,10]),lf:Buffer.from([10])},mt=new Set(["auto","cr","crlf","lf","no"]),$t=ce((e,t,o)=>{let r="auto";for(let n=0;n<t.length;n+=1){const i=t[n];if(i==="-f"||i==="--fix"){n+=1;const a=t[n];if(a===void 0)return o.logger.error(`mixed-line-ending: ${i} requires a value (auto|no|lf|crlf|cr)`),2;r=a}else i.startsWith("--fix=")&&(r=i.slice(6))}if(!mt.has(r))return o.logger.error(`mixed-line-ending: invalid --fix value ${r}`),2;let s=0;for(const n of e){const i=g(o.root,n),a=N(i),c=[],l=ce(f=>{const p=c.find(b=>b.kind===f);p?p.count+=1:c.push({count:1,kind:f})},"bumpCount"),d=[];let u=0;for(let f=0;f<a.length;f+=1){const p=a[f];p===13&&a[f+1]===10?(d.push({content:a.subarray(u,f),ending:"crlf"}),l("crlf"),f+=1,u=f+1):p===13?(d.push({content:a.subarray(u,f),ending:"cr"}),l("cr"),u=f+1):p===10&&(d.push({content:a.subarray(u,f),ending:"lf"}),l("lf"),u=f+1)}u<a.length&&d.push({content:a.subarray(u),ending:null});const m=c.length>1;if(r==="no"){m&&(o.logger.info(`${n}: mixed line endings`),s=1);continue}let $;if(r==="auto"){if(!m)continue;let f;for(const p of c)(!f||p.count>f.count)&&(f=p);$=f?.kind}else if($=r,!c.some(f=>f.kind!==$&&f.count>0))continue;const w=ht[$],h=[];for(const f of d)h.push(f.content),f.ending!==null&&h.push(w);x(i,Buffer.concat(h)),o.logger.info(`${n}: fixed mixed line endings`),s=1}return s},"runMixedLineEnding");var yt=Object.defineProperty,kt=k((e,t)=>yt(e,"name",{value:t,configurable:!0}),"g$3");const fe=new Set([32,9,11,12,13]),vt=/\.(md|markdown|mdown|mdx)$/i,wt=kt((e,t,o)=>{let r=0;for(const s of e){const n=vt.test(s),i=g(o.root,s),a=N(i),c=[];let l=0;for(;l<=a.length;){let u=l;for(;u<a.length&&a[u]!==10;)u+=1;const m=u<a.length&&a[u]===10;let $=u,w=!1;m&&u>l&&a[u-1]===13&&(w=!0,$=u-1);const h=a.subarray(l,$);let f=h.length;for(;f>0&&fe.has(h[f-1]);)f-=1;const p=h.some(b=>!fe.has(b));if(n&&h.length>=2&&h[h.length-1]===32&&h[h.length-2]===32&&p&&(f=Math.min(f+2,h.length)),c.push(h.subarray(0,f)),w&&c.push(Buffer.from([13])),m&&c.push(Buffer.from([10])),!m)break;l=u+1}const d=Buffer.concat(c);d.equals(a)||(x(i,d),o.logger.info(`Fixing ${s}`),r=1)}return r},"runTrailingWhitespace");var bt=Object.defineProperty,Se=k((e,t)=>bt(e,"name",{value:t,configurable:!0}),"t");const ee={"check-json":it,"check-merge-conflict":lt,"end-of-file-fixer":dt,"mixed-line-ending":$t,"trailing-whitespace":wt},xt=Object.keys(ee).sort();Se(e=>Object.hasOwn(ee,e),"isBuiltin");const Et=Se(e=>ee[e],"getBuiltin");var St=Object.defineProperty,j=k((e,t)=>St(e,"name",{value:t,configurable:!0}),"i$3");const F="config.json",W=1,Rt=new Set(["alwaysRun","args","builtin","entry","exclude","excludeTypes","fail","files","id","name","passFilenames","types","typesOr","verbose"]),Ot=new Set(["failFast","stages","version"]),jt=["args","exclude","excludeTypes","files","passFilenames","types","typesOr"],Re=j((e,t)=>g(e,t,F),"configPath"),Y=j(e=>e!==null&&typeof e=="object"&&!Array.isArray(e),"isStringRecord"),D=j(e=>{if(!Array.isArray(e))return;const t=[];for(const o of e){if(typeof o!="string")return;t.push(o)}return t},"asStringArray"),L=j(e=>typeof e=="boolean"?e:void 0,"asBoolean"),C=j(e=>typeof e=="string"&&e.length>0?e:void 0,"asNonEmptyString"),Ft=j((e,t,o)=>{if(!Y(e))throw new TypeError("hook entry must be an object");if(typeof e.id!="string"||e.id.length===0)throw new TypeError("hook entry is missing `id`");const r={id:e.id},s=L(e.alwaysRun);s!==void 0&&(r.alwaysRun=s);const n=D(e.args);n&&(r.args=n);const i=C(e.builtin);i&&(r.builtin=i);const a=C(e.entry);a&&(r.entry=a);const c=C(e.exclude);c&&(r.exclude=c);const l=D(e.excludeTypes);l&&(r.excludeTypes=l);const d=C(e.fail);d&&(r.fail=d);const u=C(e.files);u&&(r.files=u);const m=C(e.name);m&&(r.name=m);const $=L(e.passFilenames);$!==void 0&&(r.passFilenames=$);const w=D(e.types);w&&(r.types=w);const h=D(e.typesOr);h&&(r.typesOr=h);const f=L(e.verbose);if(f!==void 0&&(r.verbose=f),[r.builtin,r.entry,r.fail].filter(p=>p!==void 0).length!==1)throw new TypeError(`hook "${r.id}" must set exactly one of \`builtin\`, \`entry\`, \`fail\``);if(r.fail!==void 0){const p=jt.filter(b=>r[b]!==void 0);if(p.length>0)throw new TypeError(`hook "${r.id}" is a \`fail\` entry — remove ${p.join(", ")} (filters do not apply)`)}for(const p of Object.keys(e))Rt.has(p)||t.push({hookId:r.id,message:`unknown field "${p}" ignored`,stage:o});return r},"parseEntry"),At=j((e,t)=>{if(!Y(e))throw new TypeError("hook config must be an object");if(e.version!==W)throw new TypeError(`unsupported hook config version: expected ${W}, got ${String(e.version)}`);if(!Y(e.stages))throw new TypeError("hook config is missing `stages` map");const o={};for(const[n,i]of Object.entries(e.stages)){if(!Array.isArray(i))throw new TypeError(`hook config: stage "${n}" must be an array`);o[n]=i.map(a=>Ft(a,t,n))}const r={stages:o,version:W},s=L(e.failFast);s!==void 0&&(r.failFast=s);for(const n of Object.keys(e))Ot.has(n)||t.push({message:`unknown top-level field "${n}" ignored`});return r},"parseConfig"),Oe=j((e,t=X,o)=>{const r=Re(e,t);if(!S(r))return;const s=M(r);let n;try{n=JSON.parse(s)}catch(i){const a=i instanceof Error?i.message:String(i);throw new TypeError(`failed to parse ${r}: ${a}`)}return At(n,o??[])},"loadHookConfig"),_t=j((e,t,o)=>{const r=Re(e,t);x(r,`${JSON.stringify(o,void 0,4)}
|
|
10
|
+
`,"utf8")},"writeHookConfig");var Pt=Object.defineProperty,v=k((e,t)=>Pt(e,"name",{value:t,configurable:!0}),"d");const Tt=new Map([["pre-commit/pre-commit-hooks#check-json","check-json"],["pre-commit/pre-commit-hooks#check-merge-conflict","check-merge-conflict"],["pre-commit/pre-commit-hooks#end-of-file-fixer","end-of-file-fixer"],["pre-commit/pre-commit-hooks#mixed-line-ending","mixed-line-ending"],["pre-commit/pre-commit-hooks#trailing-whitespace","trailing-whitespace"]]),Ct=/[<>=!~]=/,It=/github\.com[/:]([^/\s]+\/[^/\s.]+)/i,Bt="# Generated by `vis hook migrate` from prek",Mt=v(e=>`#!/usr/bin/env sh
|
|
11
|
+
${Bt}
|
|
12
|
+
exec vis hook run ${e} "$@"
|
|
13
|
+
`,"stageScriptBody"),te=v(e=>{for(const t of Be)if(S(g(e,t)))return t},"detectPrekConfig"),Nt=v(e=>Me[e]??e,"mapPrekStage"),Ht=v(e=>It.exec(e)?.[1]??e,"normalizeRepoKey"),Dt=v(e=>{if(Ct.test(e))return;if(e.startsWith("@")){const r=e.indexOf("@",1);if(r===-1)return{name:e,version:"latest"};const s=e.slice(r+1).trim();return{name:e.slice(0,r),version:s||"latest"}}const t=e.indexOf("@");if(t===-1)return{name:e,version:"latest"};const o=e.slice(t+1).trim();return{name:e.slice(0,t),version:o||"latest"}},"parseAdditionalDep"),Wt=v(e=>{const t=[];for(const o of[e.types,e.types_or,e.exclude_types])for(const r of o??[])ot(r)||t.push(r);return t},"unknownTypes"),Lt=v((e,t)=>(e.stages&&e.stages.length>0?e.stages:t??["pre-commit"]).map(o=>Nt(o)),"resolveStages"),Vt=v((e,t,o)=>{const r=e.id??"<unknown>",s=Z.has(t),n={id:r};return e.name&&(n.name=e.name),e.language==="fail"?(n.fail=e.entry??e.name??r,n):(o?n.builtin=o:e.entry&&(n.entry=e.entry),Array.isArray(e.args)&&e.args.length>0&&(n.args=[...e.args]),s||(e.files&&(n.files=e.files),e.exclude&&(n.exclude=e.exclude),e.types&&e.types.length>0&&(n.types=[...e.types]),e.types_or&&e.types_or.length>0&&(n.typesOr=[...e.types_or]),e.exclude_types&&e.exclude_types.length>0&&(n.excludeTypes=[...e.exclude_types])),(e.pass_filenames===!1||s)&&(n.passFilenames=!1),(e.always_run||s)&&(n.alwaysRun=!0),e.verbose&&(n.verbose=!0),n)},"buildHookEntry"),qt=v((e,t,o,r)=>{if(Array.isArray(e.additional_dependencies))for(const s of e.additional_dependencies){const n=Dt(s);if(!n){r.push(`"${t}": additional_dependency "${s}" uses a pip-style pin and cannot be added to package.json — install manually.`);continue}o.push({hookId:t,name:n.name,raw:s,version:n.version})}},"collectAdditionalDeps"),Gt=v(e=>{const t={},o=[],r=[],s=[],n=[];(e.files||e.exclude)&&r.push("top-level files/exclude filter dropped — apply it per hook if needed");for(const a of e.repos??[]){const c=a.repo??"<unknown>",l=c==="local",d=l?void 0:Ht(c);for(const u of a.hooks??[]){const m=u.id??"<unknown>";let $;if(l){const f=u.language??"system";if(!Ne.has(f)){o.push({hookId:m,reason:`language "${f}" needs an isolated toolchain — run via prek or reimplement as a system command`,repo:c});continue}if(f!=="fail"&&!u.entry){o.push({hookId:m,reason:"missing `entry`",repo:c});continue}}else if(d&&($=Tt.get(`${d}#${m}`)),!$){o.push({hookId:m,reason:`remote repo "${c}"@${a.rev??"?"} has no bundled equivalent — run via prek or replace with a system command`,repo:c});continue}qt(u,m,n,s);const w=Wt(u);w.length>0&&r.push(`hook "${m}": unsupported types ${w.join(", ")} — those entries are ignored by the dispatcher`);const h=Lt(u,e.default_stages);for(const f of h){if(f==="manual")continue;if(!He.has(f)){o.push({hookId:m,reason:`unsupported stage "${f}"`,repo:c});continue}const p=Vt(u,f,$),b=t[f];b?b.push(p):t[f]=[p]}}}const i={stages:t,version:W};return e.fail_fast&&(i.failFast=!0),{additionalDeps:n,config:i,droppedFilters:r,manualSteps:s,skippedHooks:o}},"convertPrekConfig"),Jt=v(e=>{const t=De(e);if(t&&typeof t=="object")return t},"parsePrekConfig"),Kt=v(e=>{if(e.endsWith(".toml")){const o=Le(e);return o&&typeof o=="object"?o:void 0}const t=M(e);return Jt(t)},"loadPrekConfig"),Ut=v((e,t,o)=>{const r=g(e,"package.json"),s=[],n=[];if(!S(r)||t.length===0)return{added:s,skipped:n};const i=M(r),a=JSON.parse(i),c=a.devDependencies??{},l=a.dependencies??{};for(const u of t){if(u.name in c||u.name in l){n.push(u.name);continue}c[u.name]=u.version,s.push(u.name)}if(s.length===0)return{added:s,skipped:n};a.devDependencies=c;const d=We(r,i,{defaultIndent:" ",useEditorconfig:o});return x(r,`${JSON.stringify(a,void 0,d)}
|
|
14
|
+
`,"utf8"),{added:s,skipped:n}},"mergeAdditionalDependencies"),zt=v((e,t)=>{const o=g(e,t);pe(o),x(g(o,"README.md"),["# Vis hook config","","`config.json` is the single source of truth for what each stage","script runs. Auto-generated by `vis hook migrate`. Edit by hand","or re-run the migrator after updating your prek config.","",`Bundled builtins: ${xt.join(", ")}`,""].join(`
|
|
15
|
+
`),"utf8")},"writeConfigReadme"),Yt=v((e,t)=>{R("prek",["--version"],{cwd:e,encoding:"utf8"}).status===0?R("prek",["uninstall"],{cwd:e,encoding:"utf8"}).status===0?t.info("Detached prek via `prek uninstall`."):t.info("`prek uninstall` did not exit cleanly — continuing. You may need to run it manually."):t.info("prek binary not found on PATH — skipping `prek uninstall`. Run it manually if prek is installed elsewhere.")},"detachPrek"),je=v((e,t,o,r={})=>{const s=te(e),n=r.dryRun===!0;if(!s)return{isError:!0,message:"No prek configuration found (.pre-commit-config.yaml, .pre-commit-config.yml, or prek.toml)"};o.info(`Found prek config at ${s}`);const i=g(e,s),a=M(i),c=Kt(i);if(!c)return{isError:!0,message:`Could not parse ${s}`};const{additionalDeps:l,config:d,droppedFilters:u,manualSteps:m,skippedHooks:$}=Gt(c),w=Object.keys(d.stages);if(w.length===0&&$.length===0)return{isError:!0,message:`${s} has no hooks to migrate`};if(!n){const y=R("git",["config","--local","core.hooksPath"],{cwd:e,encoding:"utf8"});if(y.status===0){const J=y.stdout?.toString().trim();J&&(J.includes(".prek")||J.includes("prek-hooks"))&&R("git",["config","--local","--unset","core.hooksPath"],{cwd:e})}const T=me(t);if(T.isError)return T;T.message&&o.info(T.message)}const h=g(e,t);n||pe(h),n?o.info(` (would write) ${t}/${F}`):(_t(e,t,d),zt(e,t),o.info(` Wrote ${t}/${F}`));let f=0;for(const y of w){const T=Mt(y);n?o.info(` (would write) ${t}/${y}`):(x(g(h,y),T,{mode:493}),o.info(` Wrote ${t}/${y}`)),f+=1}const{added:p,skipped:b}=n?{added:l.map(y=>y.name),skipped:[]}:Ut(e,l,r.useEditorconfig);if(p.length>0){const y=n?"would add":"Added";o.info(`${y} ${p.length} package${p.length===1?"":"s"} to devDependencies: ${p.join(", ")}`),n||o.info("Run your package manager's install (e.g. `pnpm install`) to pick up the new devDependencies.")}b.length>0&&o.info(`Skipped ${b.length} already-declared package${b.length===1?"":"s"}: ${b.join(", ")}`),n||Yt(e,o);const se=`${i}.bak`;if(n?o.info(` (would remove) ${s} and back it up to ${s}.bak`):(S(se)||x(se,a,"utf8"),Pe(i),o.info(`Removed ${s} (backup at ${s}.bak)`)),$.length>0){o.warn(`Skipped ${$.length} hook${$.length===1?"":"s"} that cannot run without prek:`);for(const y of $)o.warn(` - ${y.repo}::${y.hookId} — ${y.reason}`)}if(u.length>0){o.warn("Partial filter translations:");for(const y of u)o.warn(` - ${y}`)}if(m.length>0){o.warn("Manual follow-up required:");for(const y of m)o.warn(` - ${y}`)}return{isError:!1,message:`${n?"would migrate":"Migration complete:"} ${f} stage script${f===1?"":"s"} ${n?"into":"written to"} ${t}/`}},"migrateFromPrek");var Qt=Object.defineProperty,oe=k((e,t)=>Qt(e,"name",{value:t,configurable:!0}),"i$2");const le=oe((e,t)=>{try{return new RegExp(e)}catch(o){const r=o instanceof Error?o.message:String(o);throw new Error(`invalid ${t} regex ${JSON.stringify(e)}: ${r}`)}},"compileRegex"),Xt=oe(e=>e.types&&e.types.length>0||e.typesOr&&e.typesOr.length>0||e.excludeTypes&&e.excludeTypes.length>0||!1,"hasTagFilters"),Zt=oe((e,t)=>{let o=e;if(t.files){const n=le(t.files,"files");o=o.filter(i=>n.test(i))}if(t.exclude){const n=le(t.exclude,"exclude");o=o.filter(i=>!n.test(i))}if(!Xt(t))return[...o];const r=tt(o),s={excludeTypes:t.excludeTypes,types:t.types,typesOr:t.typesOr};return o.filter(n=>{const i=r.get(n);return i?rt(i,s):!1})},"applyHookFilter");var eo=Object.defineProperty,A=k((e,t)=>eo(e,"name",{value:t,configurable:!0}),"u$2");const to=32*1024,oo=A((e,t)=>{const o=[],r=Math.max(1024,to-t);let s=[],n=0;for(const i of e){const a=Buffer.byteLength(i,"utf8")+8;n+a>r&&s.length>0&&(o.push(s),s=[],n=0),s.push(i),n+=a}return s.length>0&&o.push(s),o},"chunkFiles"),ro=A(e=>({error:A(t=>e.error(t),"error"),info:A(t=>e.info(t),"info")}),"builtinLoggerFor"),ue=A((e,t,o)=>o?o.message:t?`terminated by signal ${t}`:`exited with status ${String(e)}`,"describeSpawnFailure"),no=A((e,t,o,r,s)=>{const n=r?s.extraArgs:[];if(!o||t.length===0){const c=R("sh",["-c",e,"sh",...n],{cwd:s.root,stdio:"inherit"});return c.status===null?(s.logger.error(`hook command failed: ${ue(c.status,c.signal,c.error)}`),1):c.status}const i=Buffer.byteLength(e,"utf8")+Buffer.byteLength("sh","utf8")+Buffer.byteLength("-c","utf8")+n.reduce((c,l)=>c+Buffer.byteLength(l,"utf8")+8,0)+64;let a=0;for(const c of oo(t,i)){const l=R("sh",["-c",`${e} "$@"`,"sh",...n,...c],{cwd:s.root,stdio:"inherit"});l.status===null?(s.logger.error(`hook command failed: ${ue(l.status,l.signal,l.error)}`),a|=1):a|=l.status}return a},"runShellCommand"),so=A((e,t,o)=>{if(e.fail!==void 0)return o.logger.info(e.fail),1;const r=Z.has(o.stage);let s;try{s=Zt(t,e)}catch(c){const l=c instanceof Error?c.message:String(c);return o.logger.error(`hook "${e.id}": ${l}`),2}if(s.length===0&&e.alwaysRun!==!0&&!r)return 0;const n=e.passFilenames!==!1;if(e.verbose){const c=e.name??e.id;o.logger.info(`+ ${c}`)}if(e.builtin){const c=Et(e.builtin);if(!c)return o.logger.error(`unknown builtin "${e.builtin}" referenced by hook "${e.id}"`),2;const l={logger:ro(o.logger),root:o.root};try{return c(s,e.args??[],l)}catch(d){const u=d instanceof Error?d.message:String(d);return o.logger.error(`builtin "${e.builtin}" crashed: ${u}`),1}}if(e.entry===void 0)return o.logger.error(`hook "${e.id}" has no \`entry\`, \`builtin\`, or \`fail\` to run`),2;const i=(e.args??[]).map(c=>`'${c.replaceAll("'",String.raw`'\''`)}'`).join(" "),a=i?`${e.entry} ${i}`:e.entry;return no(a,s,n,r,o)},"runHookEntry"),io=A((e,t,o,r)=>{const s=e.stages[t];if(!s||s.length===0)return 0;let n=0;for(const i of s){const a=so(i,o,r);if(a!==0&&(n|=a,e.failFast))return n}return n},"runStage");var ao=Object.defineProperty,re=k((e,t)=>ao(e,"name",{value:t,configurable:!0}),"i$1");const co=re(e=>{const t=[];let o=0;for(let r=0;r<e.length;r+=1)e[r]===0&&(r>o&&t.push(e.subarray(o,r).toString("utf8")),o=r+1);return o<e.length&&t.push(e.subarray(o).toString("utf8")),t},"splitNulBuffer"),U=re((e,t,o)=>{const r=R("git",[...e],{cwd:o,encoding:"buffer"});if(r.status!==0){const s=r.stderr?r.stderr.toString():"";throw new Error(`git ${t} failed${s?`: ${s.trim()}`:""}`)}return r.stdout.length===0?[]:co(r.stdout)},"gitListFiles"),fo=re((e,t)=>{switch(e.kind){case"all":return U(["ls-files","-z"],"ls-files",t);case"range":return U(["diff","--name-only","--diff-filter=ACM","-z",e.fromRef,e.toRef],"diff --from-ref/--to-ref",t);case"staged":return U(["diff","--cached","--name-only","--diff-filter=ACM","-z"],"diff --cached",t);default:{const o=e;throw new Error(`unknown discover mode: ${JSON.stringify(o)}`)}}},"discoverFiles");var lo=Object.defineProperty,ne=k((e,t)=>lo(e,"name",{value:t,configurable:!0}),"s");const uo="pre-commit",go=ne(e=>{if(e.lastCommit&&(e.fromRef||e.toRef))throw new Error("--last-commit cannot be combined with --from-ref or --to-ref");const t=e.lastCommit?"HEAD~1":e.fromRef,o=e.lastCommit?"HEAD":e.toRef;if(t&&!o||o&&!t)throw new Error("--from-ref and --to-ref must be specified together");return t&&o?{fromRef:t,kind:"range",toRef:o}:e.allFiles?{kind:"all"}:{kind:"staged"}},"resolveDiscoverMode"),po=ne((e,t,o,r)=>{const s=o.stage??uo,n=Oe(e,t);if(!n)throw new Error(`No hook config found at ${t}/config.json. Install or migrate hooks first.`);const i=n.stages[s];if(!i||i.length===0)return r.info(`No hooks configured for stage "${s}".`),0;const a=Z.has(s)?void 0:go(o),c=a?.kind==="all"?" (--all-files)":a?.kind==="range"?` (${a.fromRef}..${a.toRef})`:"";r.info(`Running ${s}${c}`);const l=a?fo(a,e):[],d={extraArgs:o.extraArgs??[],logger:r,root:e,stage:s};return io(n,s,l,d)},"runHookStage"),ho=ne((e,t,o)=>{const r=po(B(),e,t,o);if(r!==0)throw new Error(`Hook stage exited with code ${r}`)},"runRun");var mo=Object.defineProperty,$o=k((e,t)=>mo(e,"name",{value:t,configurable:!0}),"e");const yo=$o((e=X)=>{if(R("git",["config","--local","core.hooksPath"]).status!==0)return{isError:!1,message:"No custom hooks path configured"};const{status:t,stderr:o}=R("git",["config","--local","--unset","core.hooksPath"]);if(t===null)return{isError:!0,message:"git command not found"};if(t&&t!==5)return{isError:!0,message:String(o)};const r=g(e,"_");return S(r)&&Te(r,{force:!0,recursive:!0}),{isError:!1,message:""}},"uninstallHooks");var ko=Object.defineProperty,G=k((e,t)=>ko(e,"name",{value:t,configurable:!0}),"u");const vo=new Set(he),wo=G(e=>{const t=R("sh",["-n",e],{encoding:"utf8"});if(t.status===null)return`failed to run "sh -n" (${t.error?.message??"unknown error"})`;if(t.status!==0)return t.stderr.trim()||`sh -n exited with ${t.status}`},"runSyntaxCheck"),bo=G((e,t)=>{const o=[],r=g(e,t),s=R("git",["config","--local","core.hooksPath"],{cwd:e,encoding:"utf8"});if(s.status===0){const i=s.stdout.trim(),a=`${t}/_`;i&&i!==a&&o.push({kind:"warning",message:`core.hooksPath is "${i}" — expected "${a}". Re-run \`vis hook install\` to fix.`})}else o.push({kind:"warning",message:"core.hooksPath is not set — run `vis hook install`."});if(S(g(r,"_"))||o.push({kind:"error",message:`Dispatcher directory ${t}/_ is missing. Run \`vis hook install\`.`}),!S(r))return o.push({kind:"error",message:`Hooks directory ${t}/ is missing.`}),{issues:o,ok:!1};let n=!1;for(const i of de(r)){if(i.startsWith(".")||i==="_"||i===F||i==="README.md")continue;if(!vo.has(i)){o.push({kind:"warning",message:`Unknown hook "${i}" — not a standard git hook.`,path:g(t,i)});continue}const a=g(r,i);if(!z(a).isFile())continue;n=!0;const c=z(a).mode&511;(c&64)===0&&o.push({kind:"warning",message:`Script is not owner-executable (mode ${c.toString(8)}).`,path:g(t,i)});const l=wo(a);l&&o.push({kind:"error",message:`Shell syntax error: ${l}`,path:g(t,i)})}if(n){const i=g(r,F);if(!S(i))o.push({kind:"error",message:`Stage scripts are present but ${t}/${F} is missing. Re-run \`vis hook migrate\`.`});else try{Oe(e,t)}catch(a){o.push({kind:"error",message:`${F} is malformed: ${a instanceof Error?a.message:String(a)}`,path:g(t,F)})}}return{issues:o,ok:!o.some(i=>i.kind==="error")}},"validateHooks"),xo=G((e,t)=>{if(e.issues.length===0)return[`Hook directory ${t}/ looks good.`];const o=[];for(const r of e.issues){const s=r.kind==="error"?"ERROR":"WARN ",n=r.path?` (${r.path})`:"";o.push(`${s} ${r.message}${n}`)}return o.push("",e.ok?"No errors — warnings only.":`${e.issues.filter(r=>r.kind==="error").length} error(s).`),o},"formatValidationResult"),Eo=G((e,t)=>{const o=bo(B(),e),r=xo(o,e);for(const s of r)s.startsWith("ERROR")||s.startsWith("WARN")?t.warn(s):t.info(s);if(!o.ok)throw new Error("Hook validation failed")},"runValidate");var So=Object.defineProperty,E=k((e,t)=>So(e,"name",{value:t,configurable:!0}),"i");const P=E(e=>e.hooksDir??X,"resolveHooksDirectory"),ge=E(e=>new Promise(t=>{const o=Ie({input:process.stdin,output:process.stdout});o.question(`${e} (y/N) `,r=>{o.close();const s=r.trim().toLowerCase();t(s==="y"||s==="yes")})}),"confirmPrompt"),Ro=E(async(e,t,o)=>{const r=B(),s=$e(r),n=te(r);if(s&&n)throw new Error(`Found both husky (${s}/) and prek (${n}). Remove or migrate one before running \`vis hook install\`.`);if(s){if(t.info(`Existing husky installation found at ${s}/`),await ge("Would you like to migrate your husky hooks to vis?")){const a=ye(r,e,t,{useEditorconfig:o});if(a.isError)throw new Error(a.message);a.message&&t.info(a.message);return}t.info("Aborting install. Remove husky first or run 'vis hook migrate' to migrate.");return}if(n){if(t.info(`Existing prek configuration found at ${n}`),await ge("Would you like to migrate your prek hooks to vis?")){const a=je(r,e,t,{useEditorconfig:o});if(a.isError)throw new Error(a.message);a.message&&t.info(a.message);return}t.info("Aborting install. Remove the prek config first or run 'vis hook migrate' to migrate.");return}t.info(`Installing git hooks in ${e}/...`);const i=me(e);if(i.message){if(i.isError)throw new Error(i.message);t.info(i.message);return}S(g(r,e,"pre-commit"))||x(g(r,e,"pre-commit"),`#!/usr/bin/env sh
|
|
16
|
+
`,{mode:493}),t.info("Git hooks installed successfully.")},"executeInstall"),Oo=E((e,t,o,r)=>{const s=B(),n=$e(s),i=te(s);if(n&&i)throw new Error(`Found both husky (${n}/) and prek (${i}). Migrate one at a time — rename or remove one before retrying.`);if(!n&&!i)throw new Error("No husky (.husky/) or prek (.pre-commit-config.yaml / prek.toml) configuration found to migrate.");t&&o.info("(dry-run) no files will be written");const a=n?ye(s,e,o,{dryRun:t,useEditorconfig:r}):je(s,e,o,{dryRun:t,useEditorconfig:r});if(a.isError)throw new Error(a.message);a.message&&o.info(a.message)},"executeMigrate"),Q="# vis:secrets-hook",jo=`#!/usr/bin/env sh
|
|
17
|
+
${Q}
|
|
18
|
+
# Scan staged files for secrets before each commit. Remove this block or the whole file to disable.
|
|
19
|
+
pnpm exec vis secrets --staged --quiet || exit 1
|
|
20
|
+
`,Fo=E((e,t,o)=>{if(e!=="secrets")throw new Error(`Unknown hook add target "${String(e)}". Currently supported: "secrets".`);const r=B(),s=g(r,t,"pre-commit");if(!S(g(r,t)))throw new Error(`Hooks directory ${t}/ does not exist. Run \`vis hook install\` first.`);if(S(s)){const n=M(s);if(n.includes(Q)){o.info(`Secrets hook already present in ${s}.`);return}if(/\bvis secrets\b/.test(n)){o.warn(`Found a \`vis secrets\` invocation in ${s} without the managed marker — leaving it untouched.`);return}const i=`${n.trimEnd()}
|
|
21
|
+
|
|
22
|
+
${Q}
|
|
23
|
+
pnpm exec vis secrets --staged --quiet || exit 1
|
|
24
|
+
`;x(s,i),Ce(s,493),o.info(`Appended secrets scan to ${s}.`);return}x(s,jo,{mode:493}),o.info(`Created ${s} with a secrets-scan pre-commit check.`)},"executeAdd"),Ao=E((e,t)=>{t.info("Removing git hooks...");const o=yo(e);if(o.message){if(o.isError)throw new Error(o.message);t.info(o.message);return}t.info("Git hooks removed successfully.")},"executeUninstall"),_o=E(async({logger:e,options:t,visConfig:o})=>{await Ro(P(t),e,o?.editorconfig??!0)},"hookInstallImpl"),Po=E(({logger:e,options:t})=>{Ao(P(t),e)},"hookUninstallImpl"),To=E(({logger:e,options:t,visConfig:o})=>{Oo(P(t),!!t.dryRun,e,o?.editorconfig??!0)},"hookMigrateImpl"),Co=E(({logger:e,options:t})=>{Ze(P(t),e)},"hookListImpl"),Io=E(({logger:e,options:t})=>{Eo(P(t),e)},"hookValidateImpl"),Bo=E(({argument:e,logger:t,options:o})=>{ho(P(o),{allFiles:!!o.allFiles,extraArgs:e.slice(1),fromRef:o.fromRef,lastCommit:!!o.lastCommit,stage:e[0],toRef:o.toRef},t)},"hookRunImpl"),Mo=E(({argument:e,logger:t,options:o})=>{Fo(e[0],P(o),t)},"hookAddImpl"),qo=_o,Go=Po,Jo=To,Ko=Co,Uo=Io,zo=Bo,Yo=Mo;export{Yo as hookAddExecute,qo as hookInstallExecute,Ko as hookListExecute,Jo as hookMigrateExecute,zo as hookRunExecute,Go as hookUninstallExecute,Uo as hookValidateExecute};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Zr=Object.defineProperty;var _=(r,e)=>Zr(r,"name",{value:e,configurable:!0});import{createRequire as es}from"node:module";import{M as ve,Q as rs,K as ss,C as Ir,z as is,B as Cr,$ as os}from"./config.js";import{aJ as ns,p as er,Y as Tt,Z as It,bb as as,bc as cs,Q as at,bd as ls,X as ds,y as us,m as hs,be as fs,bf as ps,s as rt,bg as gs}from"./bin.js";import{runConcurrently as ct,TerminalBuffer as xr,readLastRunSummary as ms,getLastRunSummaryPath as ws,enforceProjectConstraints as vs,expandTokensInString as tr,parsePartition as ys,TaskScheduler as ks,createTaskGraph as bs,reverseTaskGraph as Ss,generateRunSummary as rr,writeChromeTrace as $s,resolveTurboEnvCompat as Ts,CompositeLifeCycle as sr,defaultTaskRunner as ir,createLogReporter as Is,writeRunSummary as Cs}from"@visulima/task-runner";import{E as xs,a as Ms}from"../packem_shared/cache-directory-C_U1qsIw.js";import{F as Ds}from"../packem_shared/failure-log-CSC6KfcO.js";import{f as As,l as Ls,c as Bs,a as Ns,b as Gs}from"../packem_shared/flakiness-DUtrm-wS.js";import{r as _s}from"../packem_shared/toolchain-B7dckBQ1.js";import{i as qs,a as Hs,b as Vs,s as zs,d as Us,c as Ws,r as Ks,H as Ys,f as Xs,e as Js}from"../packem_shared/lifecycle-C7vfQmA3.js";import{p as Qs,r as Zs,f as ei}from"../packem_shared/selectors-B2ISH581.js";import{renderToString as fe,render as si}from"@visulima/tui";import{Text as a}from"@visulima/tui/components/text";import J,{useSyncExternalStore as ot,useCallback as st,useState as Ye,useRef as Xe,useEffect as wt,useMemo as or}from"react";import{jsxs as u,jsx as l,Fragment as Mr}from"react/jsx-runtime";import{Box as g}from"@visulima/tui/components/box";import{StaticRender as nr}from"@visulima/tui/components/static-render";import{T as Er,C as xt,D as ht,E as Rr}from"../packem_shared/symbols-CQmER5MT.js";import{Dialog as ii}from"@visulima/tui/components/dialog";import{useApp as oi}from"@visulima/tui/hooks/use-app";import{useInput as ar}from"@visulima/tui/hooks/use-input";import{useWindowSize as ni}from"@visulima/tui/hooks/use-window-size";import{ScrollView as Fr}from"@visulima/tui/components/scroll-view";import{Spinner as Or}from"@visulima/tui/components/spinner";const ts=es(import.meta.url),Ke=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ve=_(r=>{if(typeof Ke<"u"&&Ke.versions&&Ke.versions.node){const[e,t]=Ke.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return Ke.getBuiltinModule(r)}return ts(r)},"__cjs_getBuiltinModule"),{existsSync:Ct,statSync:lt,watch:Es,openSync:Rs,readSync:Fs,closeSync:Os,readFileSync:Ps,mkdtempSync:js}=Ve("node:fs"),{createInterface:ti,emitKeypressEvents:ri}=Ve("node:readline"),{createHash:ai}=Ve("node:crypto"),{appendFile:Mt}=Ve("node:fs/promises"),{platform:ci,homedir:Et,tmpdir:li}=Ve("node:os"),{spawn:di}=Ve("node:child_process");var ui=Object.defineProperty,hi=_((r,e)=>ui(r,"name",{value:e,configurable:!0}),"u$1"),fi=Object.defineProperty,pi=hi((r,e)=>fi(r,"name",{value:e,configurable:!0}),"v"),gi=Object.defineProperty,mi=pi((r,e)=>gi(r,"name",{value:e,configurable:!0}),"D");const wi=mi((r,e,t,s,o,n,i,d,f,p,h,m,c,$)=>{const E={d:s,h:o,m:n,mo:e,ms:d,s:i,w:t,y:r};return f!==void 0&&(E.future=f),p!==void 0&&(E.past=p),h!==void 0&&(E.decimal=h),m!==void 0&&(E.unitMap=m),c!==void 0&&(E.groupSeparator=c),$!==void 0&&(E.placeholderSeparator=$),E},"createDurationLanguage"),vi={d:"d",day:"d",days:"d",h:"h",hour:"h",hours:"h",hr:"h",hrs:"h",m:"m",millisecond:"ms",milliseconds:"ms",min:"m",mins:"m",minute:"m",minutes:"m",mo:"mo",month:"mo",months:"mo",ms:"ms",s:"s",sec:"s",second:"s",seconds:"s",secs:"s",w:"w",week:"w",weeks:"w",y:"y",year:"y",years:"y",yr:"y",yrs:"y"},yi=wi(r=>`year${r===1?"":"s"}`,r=>`month${r===1?"":"s"}`,r=>`week${r===1?"":"s"}`,r=>`day${r===1?"":"s"}`,r=>`hour${r===1?"":"s"}`,r=>`minute${r===1?"":"s"}`,r=>`second${r===1?"":"s"}`,r=>`millisecond${r===1?"":"s"}`,"in %s","%s ago",".",vi,",","_");var ki=Object.defineProperty,bi=_((r,e)=>ki(r,"name",{value:e,configurable:!0}),"o$4"),Si=Object.defineProperty,$i=bi((r,e)=>Si(r,"name",{value:e,configurable:!0}),"o"),Ti=Object.defineProperty,Ii=$i((r,e)=>Ti(r,"name",{value:e,configurable:!0}),"o");const Ci=Ii(r=>{const e=["y","mo","w","d","h","m","s","ms","future","past"];for(const s of e)if(!Object.hasOwn(r,s))throw new TypeError(`Missing required property: ${s}`);if(typeof r.future!="string"||typeof r.past!="string")throw new TypeError("Properties future and past must be of type string");const t=["y","mo","w","d","h","m","s","ms"];for(const s of t)if(typeof r[s]!="string"&&typeof r[s]!="function")throw new TypeError(`Property ${s} must be of type string or function`);if(r.decimal&&typeof r.decimal!="string")throw new TypeError("Property decimal must be of type string");if(r.delimiter&&typeof r.delimiter!="string")throw new TypeError("Property delimiter must be of type string");if(r._digitReplacements&&!Array.isArray(r._digitReplacements))throw new TypeError("Property _digitReplacements must be an array");if(r._numberFirst&&typeof r._numberFirst!="boolean")throw new TypeError("Property _numberFirst must be of type boolean");if(r.unitMap&&typeof r.unitMap!="object")throw new TypeError("Property unitMap must be an object");if(r.unitMap&&Object.values(r.unitMap).some(s=>typeof s!="string"))throw new TypeError("All values in unitMap must be of type string")},"validateDurationLanguage");var xi=Object.defineProperty,Mi=_((r,e)=>xi(r,"name",{value:e,configurable:!0}),"b$2"),Ei=Object.defineProperty,Ri=Mi((r,e)=>Ei(r,"name",{value:e,configurable:!0}),"b"),Fi=Object.defineProperty,Qe=Ri((r,e)=>Fi(r,"name",{value:e,configurable:!0}),"g");const Pr=Qe((r,e)=>{e=e||-1;const t=new RegExp(String.raw`^-?\d+(?:.\d{0,${String(e)}})?`).exec(r.toString());return t===null?r:Number.parseFloat(t[0])},"toFixed"),cr=Qe(({unitCount:r,unitName:e},t,s)=>{let{spacer:o}=s;const{maxDecimalPoints:n}=s;let i=".";s.decimal!==void 0?i=s.decimal:t.decimal!==void 0&&(i=t.decimal);let d;"digitReplacements"in s?d=s.digitReplacements:"_digitReplacements"in t&&(d=t._digitReplacements);let f,p=r;n!==void 0&&(p=Pr(r,n));const h=p.toString();if(!t._hideCountIf2||r!==2)if(d){f="";for(const $ of h)f+=$==="."?i:d[$]}else f=h.replace(".",i);else f="";const m=t[e];let c=m;return typeof m=="function"&&(c=m(r)),t._hideCountIf2&&r===2&&(o=""),t._numberFirst?c+o+f:f+o+c},"renderPiece"),Oi=Qe((r,e)=>{const{units:t}=e;if(t.length===0)return[];const{unitMeasures:s}=e,o=e.largest??Number.POSITIVE_INFINITY,n={};let i,d,f,p=r;for(d=0;d<t.length;d++){i=t[d];const m=s[i];f=d===t.length-1?p/m:Math.floor(p/m),n[i]=f,p-=f*m}if(e.round){let m=o;for(d=0;d<t.length;d++)if(i=t[d],f=n[i],f!==0&&(m--,m===0)){for(let c=d+1;c<t.length;c++){const $=t[c],E=n[$];n[i]=(n[i]??0)+E*s[$]/s[i],n[$]=0}break}for(d=t.length-1;d>=0;d--){if(i=t[d],f=n[i],f===0)continue;const c=Math.round(f);if(n[i]=c,d===0)break;const $=t[d-1],E=s[$],D=Math.floor(c*s[i]/E);if(D)n[$]=(n[$]??0)+D,n[i]=0;else break}}const h=[];for(d=0;d<t.length&&h.length<o;d++){if(i=t[d],f=n[i],f&&!e.round&&h.length===o-1){let m,c=0;for(m=d+1,t.length;m<t.length;m++){const $=t[m];c+=n[$]*(e.unitMeasures[$]/e.unitMeasures[i])}f+=c,e.maxDecimalPoints!==void 0&&(f=Pr(f,e.maxDecimalPoints))}f&&h.push({unitCount:f,unitName:i})}return h},"getPieces"),Pi=Qe((r,e,t)=>{const{language:s,units:o}=e;if(r.length===0){const m=o.at(-1);return cr({unitCount:0,unitName:m},s,e)}const{conjunction:n,serialComma:i}=e;let d=", ";e.delimiter!==void 0?d=e.delimiter:s.delimiter!==void 0&&(d=s.delimiter);let f="";e.timeAdverb&&t!==0&&(f=s.future??"",t<0&&(f=s.past??""));const p=r.map(m=>cr(m,s,e));let h;return!n||r.length===1?h=p.join(d):r.length===2?h=p.join(n):h=p.slice(0,-1).join(d)+(i?",":"")+n+(p.at(-1)??""),f&&(h=f.replace("%s",h)),h},"formatPieces"),jr=Qe((r,e)=>{if(Number.isNaN(r))throw new TypeError("Expected a valid number");if(typeof r!="number")throw new TypeError("Expected a number for milliseconds input");const t={conjunction:"",language:yi,round:!1,serialComma:!0,spacer:" ",timeAdverb:!1,unitMeasures:{d:864e5,h:36e5,m:6e4,mo:2629746e3,ms:1,s:1e3,w:6048e5,y:31556952e3},units:["w","d","h","m","s"],...e};Ci(t.language);const s=Math.abs(r),o=Oi(s,t);return Pi(o,t,r)},"duration");var ji=Object.defineProperty,ft=_((r,e)=>ji(r,"name",{value:e,configurable:!0}),"s$2");const Di={bun:["bun.lock","bun.lockb"],npm:["package-lock.json"],pnpm:["pnpm-lock.yaml"],yarn:["yarn.lock"]},Ai={bun:["node_modules/.bun-tag"],npm:["node_modules/.package-lock.json"],pnpm:["node_modules/.modules.yaml","node_modules/.pnpm/lock.yaml"],yarn:["node_modules/.yarn-integrity","node_modules/.yarn-state.yml",".yarn/install-state.gz"]},Li={ci:{bun:"bun install --frozen-lockfile",npm:"npm ci",pnpm:"pnpm install --frozen-lockfile",yarn:"yarn install --immutable"},tty:{bun:"bun install",npm:"npm install",pnpm:"pnpm install",yarn:"yarn install"}},Bi=1e3,Ni=ft(r=>{for(const[e,t]of Object.entries(Di))for(const s of t)if(Ct(ve(r,s)))return{lockfileFile:s,manager:e}},"detectPackageManager"),Gi=ft((r,e)=>{let t;for(const s of Ai[e]){const o=ve(r,s);if(!Ct(o))continue;const{mtimeMs:n}=lt(o);(!t||n>t.mtimeMs)&&(t={mtimeMs:n,path:s})}return t},"findFreshestMarker"),_i=ft((r,e={})=>{const t=Ni(r);if(!t)return{checked:!1};const{lockfileFile:s,manager:o}=t,n=lt(ve(r,s)).mtimeMs,i=Gi(r,o),d=Li[e.inCi?"ci":"tty"][o],f={installMarkerMtimeMs:i?.mtimeMs,lockfileMtimeMs:n,lockfilePath:s,marker:i?.path,packageManager:o};return i?n>i.mtimeMs+Bi?{checked:!0,detail:f,failure:"stale-install",message:`${s} is newer than node_modules (${i.path}) — run \`${d}\` to sync.`}:{checked:!0,detail:f}:{checked:!0,detail:f,failure:"missing-install",message:`lockfile detected but node_modules looks uninitialised — run \`${d}\` before \`vis run\`.`}},"checkLockfileFreshness"),qi=ft((r,e,t,s={})=>{if(s.skip)return{checked:!1,shouldContinue:!0};const o=_i(r,{inCi:e});if(!o.failure)return{...o,shouldContinue:!0};const n=`preflight: ${o.message??"lockfile drift detected"}`;return e&&!s.ciAsWarning?{...o,formattedMessage:n,shouldContinue:!1}:(t.warn(n),{...o,formattedMessage:n,shouldContinue:!0})},"runLockfilePreflight");var Hi=Object.defineProperty,Dr=_((r,e)=>Hi(r,"name",{value:e,configurable:!0}),"f$6");const Vi=Dr(r=>r.split(",").map(e=>e.trim()).filter(e=>e!==""),"splitPatterns"),zi=Dr((r,e,t)=>{const s=new Set,o=[];if(r===void 0||r.trim()==="")return{skipTaskIds:s,unmatchedPatterns:o};const n=[...t],i=new Set(n),d=new Map;for(const f of n){const p=f.lastIndexOf(":");if(p===-1)continue;const h=f.slice(p+1),m=d.get(h);m===void 0?d.set(h,[f]):m.push(f)}for(const f of Vi(r)){if(f.startsWith("~:"))throw new Error(`--skip-cache does not support the closest-project selector "~:" (received "${f}"). Use \`pkg:target\`, \`:target\`, or \`#tag:target\`.`);if(i.has(f)){s.add(f);continue}const p=Qs(f);if(!p){o.push(f);continue}let h=!1;switch(p.kind){case"all":{const m=d.get(p.target)??[];for(const c of m)s.add(c),h=!0;break}case"project":{const m=p.projects?.[0];if(m!==void 0){const c=`${m}:${p.target}`;i.has(c)&&(s.add(c),h=!0)}break}case"tag":{const{tag:m}=p;if(m!==void 0){const c=d.get(p.target)??[];for(const $ of c){const E=$.slice(0,$.lastIndexOf(":"));e.projects[E]?.tags?.includes(m)===!0&&(s.add($),h=!0)}}break}}h||o.push(f)}return{skipTaskIds:s,unmatchedPatterns:o}},"resolveSkipCachePatterns");var Ui=Object.defineProperty,Rt=_((r,e)=>Ui(r,"name",{value:e,configurable:!0}),"a$1");const Wi=/\$(?:\{([A-Z_]\w*)(:-[^}]*)?\}|([A-Z_]\w*))/gi,Ki=new Set(["0","!","#","$","*","-","?","@","_"]),Yi=Rt(r=>{const e=new Map;for(const t of r.matchAll(Wi)){const s=t[1],o=t[3],n=t[2],i=s??o;if(i===void 0||Ki.has(i))continue;const d=n!==void 0,f=e.get(i);f===void 0?e.set(i,d):f&&!d&&e.set(i,!1)}return[...e.entries()].map(([t,s])=>({hasDefault:s,name:t}))},"extractEnvReferences"),Xi=Rt(r=>{const{command:e,processEnv:t,taskEnv:s,taskId:o}=r,n=Yi(e);if(n.length===0)return;const i=[];for(const{hasDefault:d,name:f}of n){if(d)continue;const p=s[f],h=t[f];p===void 0&&h===void 0&&i.push(f)}if(i.length!==0)return{missing:i.toSorted(),taskId:o}},"checkStrictEnv"),Ji=Rt(r=>{const e=r.missing.map(t=>`$${t}`).join(", ");return`Strict env: ${r.taskId} references unset variable${r.missing.length===1?"":"s"} ${e}. Set ${r.missing.length===1?"it":"them"} in the task env, an envFile, or the parent shell — or opt out with options.strictEnv: false.`},"formatStrictEnvError");var Qi=Object.defineProperty,Pe=_((r,e)=>Qi(r,"name",{value:e,configurable:!0}),"i$2");const lr=Pe(r=>{const e=new Set;for(const t of Object.values(r.projects))for(const s of Object.keys(t.targets??{}))e.add(s);return[...e].sort()},"collectAvailableTargets"),Zi=Pe(r=>{const e=new Map;for(const t of r.values())for(const[s,o]of Object.entries(t))for(const n of o.aliases??[])e.has(n)||e.set(n,s);return e},"buildAliasMap"),eo=Pe((r,e)=>e.get(r)??r,"resolveTargetAlias"),to=Pe((r,e)=>{if(r.length===0)return e.length;if(e.length===0)return r.length;const t=[];for(let s=0;s<=e.length;s++)t[s]=[s];for(let s=0;s<=r.length;s++)t[0][s]=s;for(let s=1;s<=e.length;s++)for(let o=1;o<=r.length;o++){const n=e[s-1]===r[o-1]?0:1;t[s][o]=Math.min(t[s-1][o]+1,t[s][o-1]+1,t[s-1][o-1]+n)}return t[e.length][r.length]},"levenshtein"),ro=Pe((r,e,t=3)=>Ar(r,e,1,t)[0],"suggestTarget"),Ar=Pe((r,e,t=3,s=3)=>{const o=[];for(const n of e){const i=to(r.toLowerCase(),n.toLowerCase());i<=s&&o.push({distance:i,name:n})}return o.sort((n,i)=>n.distance-i.distance||n.name.localeCompare(i.name)),o.slice(0,t).map(n=>n.name)},"suggestTargets"),so=Pe(r=>r.length===0?" (no targets found)":r.map(e=>` - ${e}`).join(`
|
|
1
|
+
var Zr=Object.defineProperty;var _=(r,e)=>Zr(r,"name",{value:e,configurable:!0});import{createRequire as es}from"node:module";import{M as ve,Q as rs,K as ss,C as Ir,z as is,B as Cr,$ as os}from"./config.js";import{aJ as ns,p as er,Y as Tt,Z as It,bb as as,bc as cs,Q as at,bd as ls,X as ds,y as us,m as hs,be as fs,bf as ps,s as rt,bg as gs}from"./bin.js";import{runConcurrently as ct,TerminalBuffer as xr,readLastRunSummary as ms,getLastRunSummaryPath as ws,enforceProjectConstraints as vs,expandTokensInString as tr,parsePartition as ys,TaskScheduler as ks,createTaskGraph as bs,reverseTaskGraph as Ss,generateRunSummary as rr,writeChromeTrace as $s,resolveTurboEnvCompat as Ts,CompositeLifeCycle as sr,defaultTaskRunner as ir,createLogReporter as Is,writeRunSummary as Cs}from"@visulima/task-runner";import{E as xs,a as Ms}from"../packem_shared/cache-directory-C_U1qsIw.js";import{F as Ds}from"../packem_shared/failure-log-CSC6KfcO.js";import{f as As,l as Ls,c as Bs,a as Ns,b as Gs}from"../packem_shared/flakiness-DUtrm-wS.js";import{r as _s}from"../packem_shared/toolchain-B7dckBQ1.js";import{i as qs,a as Hs,b as Vs,s as zs,d as Us,c as Ws,r as Ks,H as Ys,f as Xs,e as Js}from"../packem_shared/lifecycle-CgK8pcfa.js";import{p as Qs,r as Zs,f as ei}from"../packem_shared/selectors-B2ISH581.js";import{renderToString as fe,render as si}from"@visulima/tui";import{Text as a}from"@visulima/tui/components/text";import J,{useSyncExternalStore as ot,useCallback as st,useState as Ye,useRef as Xe,useEffect as wt,useMemo as or}from"react";import{jsxs as u,jsx as l,Fragment as Mr}from"react/jsx-runtime";import{Box as g}from"@visulima/tui/components/box";import{StaticRender as nr}from"@visulima/tui/components/static-render";import{T as Er,C as xt,D as ht,E as Rr}from"../packem_shared/symbols-CQmER5MT.js";import{Dialog as ii}from"@visulima/tui/components/dialog";import{useApp as oi}from"@visulima/tui/hooks/use-app";import{useInput as ar}from"@visulima/tui/hooks/use-input";import{useWindowSize as ni}from"@visulima/tui/hooks/use-window-size";import{ScrollView as Fr}from"@visulima/tui/components/scroll-view";import{Spinner as Or}from"@visulima/tui/components/spinner";const ts=es(import.meta.url),Ke=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ve=_(r=>{if(typeof Ke<"u"&&Ke.versions&&Ke.versions.node){const[e,t]=Ke.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return Ke.getBuiltinModule(r)}return ts(r)},"__cjs_getBuiltinModule"),{existsSync:Ct,statSync:lt,watch:Es,openSync:Rs,readSync:Fs,closeSync:Os,readFileSync:Ps,mkdtempSync:js}=Ve("node:fs"),{createInterface:ti,emitKeypressEvents:ri}=Ve("node:readline"),{createHash:ai}=Ve("node:crypto"),{appendFile:Mt}=Ve("node:fs/promises"),{platform:ci,homedir:Et,tmpdir:li}=Ve("node:os"),{spawn:di}=Ve("node:child_process");var ui=Object.defineProperty,hi=_((r,e)=>ui(r,"name",{value:e,configurable:!0}),"u$1"),fi=Object.defineProperty,pi=hi((r,e)=>fi(r,"name",{value:e,configurable:!0}),"v"),gi=Object.defineProperty,mi=pi((r,e)=>gi(r,"name",{value:e,configurable:!0}),"D");const wi=mi((r,e,t,s,o,n,i,d,f,p,h,m,c,$)=>{const E={d:s,h:o,m:n,mo:e,ms:d,s:i,w:t,y:r};return f!==void 0&&(E.future=f),p!==void 0&&(E.past=p),h!==void 0&&(E.decimal=h),m!==void 0&&(E.unitMap=m),c!==void 0&&(E.groupSeparator=c),$!==void 0&&(E.placeholderSeparator=$),E},"createDurationLanguage"),vi={d:"d",day:"d",days:"d",h:"h",hour:"h",hours:"h",hr:"h",hrs:"h",m:"m",millisecond:"ms",milliseconds:"ms",min:"m",mins:"m",minute:"m",minutes:"m",mo:"mo",month:"mo",months:"mo",ms:"ms",s:"s",sec:"s",second:"s",seconds:"s",secs:"s",w:"w",week:"w",weeks:"w",y:"y",year:"y",years:"y",yr:"y",yrs:"y"},yi=wi(r=>`year${r===1?"":"s"}`,r=>`month${r===1?"":"s"}`,r=>`week${r===1?"":"s"}`,r=>`day${r===1?"":"s"}`,r=>`hour${r===1?"":"s"}`,r=>`minute${r===1?"":"s"}`,r=>`second${r===1?"":"s"}`,r=>`millisecond${r===1?"":"s"}`,"in %s","%s ago",".",vi,",","_");var ki=Object.defineProperty,bi=_((r,e)=>ki(r,"name",{value:e,configurable:!0}),"o$4"),Si=Object.defineProperty,$i=bi((r,e)=>Si(r,"name",{value:e,configurable:!0}),"o"),Ti=Object.defineProperty,Ii=$i((r,e)=>Ti(r,"name",{value:e,configurable:!0}),"o");const Ci=Ii(r=>{const e=["y","mo","w","d","h","m","s","ms","future","past"];for(const s of e)if(!Object.hasOwn(r,s))throw new TypeError(`Missing required property: ${s}`);if(typeof r.future!="string"||typeof r.past!="string")throw new TypeError("Properties future and past must be of type string");const t=["y","mo","w","d","h","m","s","ms"];for(const s of t)if(typeof r[s]!="string"&&typeof r[s]!="function")throw new TypeError(`Property ${s} must be of type string or function`);if(r.decimal&&typeof r.decimal!="string")throw new TypeError("Property decimal must be of type string");if(r.delimiter&&typeof r.delimiter!="string")throw new TypeError("Property delimiter must be of type string");if(r._digitReplacements&&!Array.isArray(r._digitReplacements))throw new TypeError("Property _digitReplacements must be an array");if(r._numberFirst&&typeof r._numberFirst!="boolean")throw new TypeError("Property _numberFirst must be of type boolean");if(r.unitMap&&typeof r.unitMap!="object")throw new TypeError("Property unitMap must be an object");if(r.unitMap&&Object.values(r.unitMap).some(s=>typeof s!="string"))throw new TypeError("All values in unitMap must be of type string")},"validateDurationLanguage");var xi=Object.defineProperty,Mi=_((r,e)=>xi(r,"name",{value:e,configurable:!0}),"b$2"),Ei=Object.defineProperty,Ri=Mi((r,e)=>Ei(r,"name",{value:e,configurable:!0}),"b"),Fi=Object.defineProperty,Qe=Ri((r,e)=>Fi(r,"name",{value:e,configurable:!0}),"g");const Pr=Qe((r,e)=>{e=e||-1;const t=new RegExp(String.raw`^-?\d+(?:.\d{0,${String(e)}})?`).exec(r.toString());return t===null?r:Number.parseFloat(t[0])},"toFixed"),cr=Qe(({unitCount:r,unitName:e},t,s)=>{let{spacer:o}=s;const{maxDecimalPoints:n}=s;let i=".";s.decimal!==void 0?i=s.decimal:t.decimal!==void 0&&(i=t.decimal);let d;"digitReplacements"in s?d=s.digitReplacements:"_digitReplacements"in t&&(d=t._digitReplacements);let f,p=r;n!==void 0&&(p=Pr(r,n));const h=p.toString();if(!t._hideCountIf2||r!==2)if(d){f="";for(const $ of h)f+=$==="."?i:d[$]}else f=h.replace(".",i);else f="";const m=t[e];let c=m;return typeof m=="function"&&(c=m(r)),t._hideCountIf2&&r===2&&(o=""),t._numberFirst?c+o+f:f+o+c},"renderPiece"),Oi=Qe((r,e)=>{const{units:t}=e;if(t.length===0)return[];const{unitMeasures:s}=e,o=e.largest??Number.POSITIVE_INFINITY,n={};let i,d,f,p=r;for(d=0;d<t.length;d++){i=t[d];const m=s[i];f=d===t.length-1?p/m:Math.floor(p/m),n[i]=f,p-=f*m}if(e.round){let m=o;for(d=0;d<t.length;d++)if(i=t[d],f=n[i],f!==0&&(m--,m===0)){for(let c=d+1;c<t.length;c++){const $=t[c],E=n[$];n[i]=(n[i]??0)+E*s[$]/s[i],n[$]=0}break}for(d=t.length-1;d>=0;d--){if(i=t[d],f=n[i],f===0)continue;const c=Math.round(f);if(n[i]=c,d===0)break;const $=t[d-1],E=s[$],D=Math.floor(c*s[i]/E);if(D)n[$]=(n[$]??0)+D,n[i]=0;else break}}const h=[];for(d=0;d<t.length&&h.length<o;d++){if(i=t[d],f=n[i],f&&!e.round&&h.length===o-1){let m,c=0;for(m=d+1,t.length;m<t.length;m++){const $=t[m];c+=n[$]*(e.unitMeasures[$]/e.unitMeasures[i])}f+=c,e.maxDecimalPoints!==void 0&&(f=Pr(f,e.maxDecimalPoints))}f&&h.push({unitCount:f,unitName:i})}return h},"getPieces"),Pi=Qe((r,e,t)=>{const{language:s,units:o}=e;if(r.length===0){const m=o.at(-1);return cr({unitCount:0,unitName:m},s,e)}const{conjunction:n,serialComma:i}=e;let d=", ";e.delimiter!==void 0?d=e.delimiter:s.delimiter!==void 0&&(d=s.delimiter);let f="";e.timeAdverb&&t!==0&&(f=s.future??"",t<0&&(f=s.past??""));const p=r.map(m=>cr(m,s,e));let h;return!n||r.length===1?h=p.join(d):r.length===2?h=p.join(n):h=p.slice(0,-1).join(d)+(i?",":"")+n+(p.at(-1)??""),f&&(h=f.replace("%s",h)),h},"formatPieces"),jr=Qe((r,e)=>{if(Number.isNaN(r))throw new TypeError("Expected a valid number");if(typeof r!="number")throw new TypeError("Expected a number for milliseconds input");const t={conjunction:"",language:yi,round:!1,serialComma:!0,spacer:" ",timeAdverb:!1,unitMeasures:{d:864e5,h:36e5,m:6e4,mo:2629746e3,ms:1,s:1e3,w:6048e5,y:31556952e3},units:["w","d","h","m","s"],...e};Ci(t.language);const s=Math.abs(r),o=Oi(s,t);return Pi(o,t,r)},"duration");var ji=Object.defineProperty,ft=_((r,e)=>ji(r,"name",{value:e,configurable:!0}),"s$2");const Di={bun:["bun.lock","bun.lockb"],npm:["package-lock.json"],pnpm:["pnpm-lock.yaml"],yarn:["yarn.lock"]},Ai={bun:["node_modules/.bun-tag"],npm:["node_modules/.package-lock.json"],pnpm:["node_modules/.modules.yaml","node_modules/.pnpm/lock.yaml"],yarn:["node_modules/.yarn-integrity","node_modules/.yarn-state.yml",".yarn/install-state.gz"]},Li={ci:{bun:"bun install --frozen-lockfile",npm:"npm ci",pnpm:"pnpm install --frozen-lockfile",yarn:"yarn install --immutable"},tty:{bun:"bun install",npm:"npm install",pnpm:"pnpm install",yarn:"yarn install"}},Bi=1e3,Ni=ft(r=>{for(const[e,t]of Object.entries(Di))for(const s of t)if(Ct(ve(r,s)))return{lockfileFile:s,manager:e}},"detectPackageManager"),Gi=ft((r,e)=>{let t;for(const s of Ai[e]){const o=ve(r,s);if(!Ct(o))continue;const{mtimeMs:n}=lt(o);(!t||n>t.mtimeMs)&&(t={mtimeMs:n,path:s})}return t},"findFreshestMarker"),_i=ft((r,e={})=>{const t=Ni(r);if(!t)return{checked:!1};const{lockfileFile:s,manager:o}=t,n=lt(ve(r,s)).mtimeMs,i=Gi(r,o),d=Li[e.inCi?"ci":"tty"][o],f={installMarkerMtimeMs:i?.mtimeMs,lockfileMtimeMs:n,lockfilePath:s,marker:i?.path,packageManager:o};return i?n>i.mtimeMs+Bi?{checked:!0,detail:f,failure:"stale-install",message:`${s} is newer than node_modules (${i.path}) — run \`${d}\` to sync.`}:{checked:!0,detail:f}:{checked:!0,detail:f,failure:"missing-install",message:`lockfile detected but node_modules looks uninitialised — run \`${d}\` before \`vis run\`.`}},"checkLockfileFreshness"),qi=ft((r,e,t,s={})=>{if(s.skip)return{checked:!1,shouldContinue:!0};const o=_i(r,{inCi:e});if(!o.failure)return{...o,shouldContinue:!0};const n=`preflight: ${o.message??"lockfile drift detected"}`;return e&&!s.ciAsWarning?{...o,formattedMessage:n,shouldContinue:!1}:(t.warn(n),{...o,formattedMessage:n,shouldContinue:!0})},"runLockfilePreflight");var Hi=Object.defineProperty,Dr=_((r,e)=>Hi(r,"name",{value:e,configurable:!0}),"f$6");const Vi=Dr(r=>r.split(",").map(e=>e.trim()).filter(e=>e!==""),"splitPatterns"),zi=Dr((r,e,t)=>{const s=new Set,o=[];if(r===void 0||r.trim()==="")return{skipTaskIds:s,unmatchedPatterns:o};const n=[...t],i=new Set(n),d=new Map;for(const f of n){const p=f.lastIndexOf(":");if(p===-1)continue;const h=f.slice(p+1),m=d.get(h);m===void 0?d.set(h,[f]):m.push(f)}for(const f of Vi(r)){if(f.startsWith("~:"))throw new Error(`--skip-cache does not support the closest-project selector "~:" (received "${f}"). Use \`pkg:target\`, \`:target\`, or \`#tag:target\`.`);if(i.has(f)){s.add(f);continue}const p=Qs(f);if(!p){o.push(f);continue}let h=!1;switch(p.kind){case"all":{const m=d.get(p.target)??[];for(const c of m)s.add(c),h=!0;break}case"project":{const m=p.projects?.[0];if(m!==void 0){const c=`${m}:${p.target}`;i.has(c)&&(s.add(c),h=!0)}break}case"tag":{const{tag:m}=p;if(m!==void 0){const c=d.get(p.target)??[];for(const $ of c){const E=$.slice(0,$.lastIndexOf(":"));e.projects[E]?.tags?.includes(m)===!0&&(s.add($),h=!0)}}break}}h||o.push(f)}return{skipTaskIds:s,unmatchedPatterns:o}},"resolveSkipCachePatterns");var Ui=Object.defineProperty,Rt=_((r,e)=>Ui(r,"name",{value:e,configurable:!0}),"a$1");const Wi=/\$(?:\{([A-Z_]\w*)(:-[^}]*)?\}|([A-Z_]\w*))/gi,Ki=new Set(["0","!","#","$","*","-","?","@","_"]),Yi=Rt(r=>{const e=new Map;for(const t of r.matchAll(Wi)){const s=t[1],o=t[3],n=t[2],i=s??o;if(i===void 0||Ki.has(i))continue;const d=n!==void 0,f=e.get(i);f===void 0?e.set(i,d):f&&!d&&e.set(i,!1)}return[...e.entries()].map(([t,s])=>({hasDefault:s,name:t}))},"extractEnvReferences"),Xi=Rt(r=>{const{command:e,processEnv:t,taskEnv:s,taskId:o}=r,n=Yi(e);if(n.length===0)return;const i=[];for(const{hasDefault:d,name:f}of n){if(d)continue;const p=s[f],h=t[f];p===void 0&&h===void 0&&i.push(f)}if(i.length!==0)return{missing:i.toSorted(),taskId:o}},"checkStrictEnv"),Ji=Rt(r=>{const e=r.missing.map(t=>`$${t}`).join(", ");return`Strict env: ${r.taskId} references unset variable${r.missing.length===1?"":"s"} ${e}. Set ${r.missing.length===1?"it":"them"} in the task env, an envFile, or the parent shell — or opt out with options.strictEnv: false.`},"formatStrictEnvError");var Qi=Object.defineProperty,Pe=_((r,e)=>Qi(r,"name",{value:e,configurable:!0}),"i$2");const lr=Pe(r=>{const e=new Set;for(const t of Object.values(r.projects))for(const s of Object.keys(t.targets??{}))e.add(s);return[...e].sort()},"collectAvailableTargets"),Zi=Pe(r=>{const e=new Map;for(const t of r.values())for(const[s,o]of Object.entries(t))for(const n of o.aliases??[])e.has(n)||e.set(n,s);return e},"buildAliasMap"),eo=Pe((r,e)=>e.get(r)??r,"resolveTargetAlias"),to=Pe((r,e)=>{if(r.length===0)return e.length;if(e.length===0)return r.length;const t=[];for(let s=0;s<=e.length;s++)t[s]=[s];for(let s=0;s<=r.length;s++)t[0][s]=s;for(let s=1;s<=e.length;s++)for(let o=1;o<=r.length;o++){const n=e[s-1]===r[o-1]?0:1;t[s][o]=Math.min(t[s-1][o]+1,t[s][o-1]+1,t[s-1][o-1]+n)}return t[e.length][r.length]},"levenshtein"),ro=Pe((r,e,t=3)=>Ar(r,e,1,t)[0],"suggestTarget"),Ar=Pe((r,e,t=3,s=3)=>{const o=[];for(const n of e){const i=to(r.toLowerCase(),n.toLowerCase());i<=s&&o.push({distance:i,name:n})}return o.sort((n,i)=>n.distance-i.distance||n.name.localeCompare(i.name)),o.slice(0,t).map(n=>n.name)},"suggestTargets"),so=Pe(r=>r.length===0?" (no targets found)":r.map(e=>` - ${e}`).join(`
|
|
2
2
|
`),"formatTargetList"),io=Pe(async r=>{if(r.length===0||!process.stdin.isTTY||!process.stdout.isTTY)return;const e=ti({input:process.stdin,output:process.stdout});try{process.stdout.write(`Available targets:
|
|
3
3
|
`);for(const[o,n]of r.entries())process.stdout.write(` ${String(o+1).padStart(2," ")}. ${n}
|
|
4
4
|
`);process.stdout.write(`
|