@visulima/vis 1.0.0-alpha.19 → 1.0.0-alpha.20
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 +164 -0
- package/LICENSE.md +187 -779
- package/README.md +1 -1
- package/dist/config/index.d.ts +535 -121
- package/dist/config/index.js +1 -1
- package/dist/packem_chunks/bin.js +380 -286
- package/dist/packem_chunks/config.js +15 -14
- package/dist/packem_chunks/doctor-probe.js +2 -2
- package/dist/packem_chunks/fix.js +9 -9
- package/dist/packem_chunks/handler.js +1 -1
- package/dist/packem_chunks/handler10.js +1 -2
- package/dist/packem_chunks/handler11.js +5 -1
- package/dist/packem_chunks/handler12.js +1 -5
- package/dist/packem_chunks/handler13.js +27 -1
- package/dist/packem_chunks/handler14.js +5 -20
- 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 +1 -5
- package/dist/packem_chunks/handler20.js +5 -2
- package/dist/packem_chunks/handler21.js +2 -18
- package/dist/packem_chunks/handler22.js +2 -1
- package/dist/packem_chunks/handler23.js +18 -1
- package/dist/packem_chunks/handler24.js +1 -5
- package/dist/packem_chunks/handler25.js +1 -1
- package/dist/packem_chunks/handler26.js +5 -3
- package/dist/packem_chunks/handler27.js +1 -1
- package/dist/packem_chunks/handler28.js +3 -1
- package/dist/packem_chunks/handler29.js +1 -7
- package/dist/packem_chunks/handler3.js +3 -3
- package/dist/packem_chunks/handler30.js +6 -22
- package/dist/packem_chunks/handler31.js +33 -3
- package/dist/packem_chunks/handler32.js +3 -1
- package/dist/packem_chunks/handler33.js +1 -2
- package/dist/packem_chunks/handler34.js +25 -24
- package/dist/packem_chunks/handler35.js +3 -3
- package/dist/packem_chunks/handler36.js +6 -21
- package/dist/packem_chunks/handler37.js +22 -428
- package/dist/packem_chunks/handler38.js +428 -6
- package/dist/packem_chunks/handler39.js +6 -5
- package/dist/packem_chunks/handler4.js +8 -2
- package/dist/packem_chunks/handler40.js +24 -10
- package/dist/packem_chunks/handler41.js +10 -24
- package/dist/packem_chunks/handler42.js +1 -1
- package/dist/packem_chunks/handler43.js +6 -6
- package/dist/packem_chunks/handler44.js +13 -13
- package/dist/packem_chunks/handler45.js +213 -3
- package/dist/packem_chunks/handler46.js +3 -27
- package/dist/packem_chunks/handler47.js +21 -161
- package/dist/packem_chunks/handler48.js +166 -33
- package/dist/packem_chunks/handler49.js +34 -0
- package/dist/packem_chunks/handler5.js +1 -8
- package/dist/packem_chunks/handler6.js +1 -1
- package/dist/packem_chunks/handler7.js +1 -1
- package/dist/packem_chunks/handler8.js +1 -1
- package/dist/packem_chunks/handler9.js +2 -1
- package/dist/packem_chunks/heal-accept.js +2 -2
- package/dist/packem_chunks/heal.js +1 -1
- package/dist/packem_chunks/help-command.js +16 -16
- package/dist/packem_chunks/index.js +6 -6
- package/dist/packem_chunks/keys-refresh.js +4 -0
- package/dist/packem_chunks/list.js +3 -0
- package/dist/packem_chunks/loader.js +1 -1
- package/dist/packem_chunks/prune.js +3 -0
- package/dist/packem_chunks/run.js +1 -0
- package/dist/packem_chunks/status.js +2 -0
- package/dist/packem_chunks/sync.js +2 -0
- package/dist/packem_chunks/sync2.js +2 -0
- package/dist/packem_chunks/tripwire.js +2 -0
- package/dist/packem_shared/advisories-DsynpacV.js +1 -0
- package/dist/packem_shared/{ai-analysis-C_GpXikx.js → ai-analysis-uYuTIIXi.js} +1 -1
- package/dist/packem_shared/{ai-cache-DrCLD4gc.js → ai-cache-DuwHYx2O.js} +1 -1
- package/dist/packem_shared/{ai-fix-CWOz12Om.js → ai-fix-DzrA-dVz.js} +4 -4
- package/dist/packem_shared/applyDefaults-BOVDw1jD.js +1 -0
- package/dist/packem_shared/build-scripts-DsWMSWDs.js +1 -0
- package/dist/packem_shared/{cache-directory-C_U1qsIw.js → cache-directory-DQak1Vjc.js} +1 -1
- package/dist/packem_shared/cyclonedx-CiHXuG8M.js +4 -0
- package/dist/packem_shared/dependency-scan-DC3nAFHS.js +1 -0
- package/dist/packem_shared/{docker-B4s1fjiN.js → docker-B-CIN_nj.js} +19 -19
- package/dist/packem_shared/{failure-log-CSC6KfcO.js → failure-log-C3LEMmkq.js} +1 -1
- package/dist/packem_shared/{flakiness-DUtrm-wS.js → flakiness-Dq6K4ymq.js} +1 -1
- package/dist/packem_shared/glob-MHJQjR39-CQ2GC0b_.js +1 -0
- package/dist/packem_shared/{lifecycle-CgK8pcfa.js → lifecycle-Dv3nAtoD.js} +2 -2
- package/dist/packem_shared/{lockfile-i-qvq_k8.js → lockfile-C5DYMHVq.js} +1 -1
- package/dist/packem_shared/manifests-B0fMp872.js +1 -0
- package/dist/packem_shared/min-release-age-BFozFonQ.js +34 -0
- package/dist/packem_shared/native-config-sync-Dvi1g2nQ.js +21 -0
- package/dist/packem_shared/registry-keys-CewRFW0e.js +1 -0
- package/dist/packem_shared/resolve-explicit-CC4Kifk5.js +5 -0
- package/dist/packem_shared/{run-summary-utils-CJv75pla.js → run-summary-utils-BaBGP3bo.js} +1 -1
- package/dist/packem_shared/{runtime-check-CBU6W8qG.js → runtime-check-BusAwPb2.js} +1 -1
- package/dist/packem_shared/scan-progress-CMynp3eA.js +2 -0
- package/dist/packem_shared/signatures-5ZdjJ2Pu.js +2 -0
- package/dist/packem_shared/{toolchain-B7dckBQ1.js → toolchain-Cc3cwyLP.js} +3 -3
- package/dist/packem_shared/typosquats-BCeR-sLf.js +1 -0
- package/dist/packem_shared/verify-07kUNTuP.js +1 -0
- package/dist/packem_shared/{vis-update-app-D0uL3eO5.js → vis-update-app-CFrlJ3mW.js} +1 -1
- package/index.d.ts +358 -0
- package/index.js +56 -53
- package/package.json +14 -13
- package/schemas/vis-config.schema.json +595 -100
- package/dist/packem_shared/applyDefaults-DLY94gWA.js +0 -1
- package/dist/packem_shared/dependency-scan-YdgNVvoz.js +0 -2
- package/dist/packem_shared/readTomlSync-1fKo0R52-DtxWULlF.js +0 -109
- package/dist/packem_shared/typosquats-B3A38-qx.js +0 -1
- package/dist/packem_shared/verify-WDStBFvK.js +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var Te=Object.defineProperty;var w=(e,t)=>Te(e,"name",{value:t,configurable:!0});import{createRequire as ze}from"node:module";import{u as Be,aI as Ie,p as Ne,b7 as qe}from"./bin.js";import{z as he,M as me,$ as I}from"./config.js";const Me=ze(import.meta.url),z=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Fe=w(e=>{if(typeof z<"u"&&z.versions&&z.versions.node){const[t,r]=z.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return z.getBuiltinModule(e)}return Me(e)},"__cjs_getBuiltinModule"),{createRequire:Ge}=Fe("node:module");var De=Object.defineProperty,Ke=w((e,t)=>De(e,"name",{value:t,configurable:!0}),"p$6"),Qe=Object.defineProperty,de=Ke((e,t)=>Qe(e,"name",{value:t,configurable:!0}),"e"),Ve=Object.defineProperty,He=de((e,t)=>Ve(e,"name",{value:t,configurable:!0}),"E");const ge=String.raw,re=ge`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,Je=He(()=>new RegExp(ge`\p{RI}{2}|(?)${re}(?:\u200D${re})*`,"gu"),"default");var Ye=Object.defineProperty,Xe=de((e,t)=>Ye(e,"name",{value:t,configurable:!0}),"p");Object.freeze(new Map([[0,0],[1,22],[2,22],[3,23],[4,24],[7,27],[8,28],[9,29],[30,39],[31,39],[32,39],[33,39],[34,39],[35,39],[36,39],[37,39],[40,49],[41,49],[42,49],[43,49],[44,49],[45,49],[46,49],[47,49],[90,39]]));const T=Je(),Ze=/[-_./\s]+/g,L=/(\u001B\[[0-9;]*[a-z])/i,ne=new RegExp("\\p{Script=Arabic}","u"),et=new RegExp("\\p{Script=Bengali}","u"),_=new RegExp("\\p{Script=Cyrillic}","u"),tt=new RegExp("\\p{Script=Devanagari}","u"),rt=new RegExp("\\p{Script=Ethiopic}","u"),Q=new RegExp("\\p{Script=Greek}","u"),ae=new RegExp("\\p{Script=Greek}+|\\p{Script=Latin}+|[^\\p{Script=Greek}\\p{Script=Latin}]+","gu"),nt=new RegExp("\\p{Script=Gujarati}","u"),at=new RegExp("\\p{Script=Gurmukhi}","u"),ie=new RegExp("\\p{Script=Hangul}","u"),se=new RegExp("\\p{Script=Hebrew}","u"),it=new RegExp("\\p{Script=Hiragana}","u"),oe=new RegExp("\\p{Script=Han}","u"),st=new RegExp("\\p{Script=Kannada}","u"),ot=new RegExp("\\p{Script=Katakana}","u"),lt=new RegExp("\\p{Script=Khmer}","u"),ct=new RegExp("\\p{Script=Lao}","u"),O=new RegExp("\\p{Script=Latin}","u"),ut=new RegExp("\\p{Script=Malayalam}","u"),pt=new RegExp("\\p{Script=Myanmar}","u"),ft=new RegExp("\\p{Script=Oriya}","u"),ht=new RegExp("\\p{Script=Sinhala}","u"),mt=new RegExp("\\p{Script=Tamil}","u"),dt=new RegExp("\\p{Script=Telugu}","u"),gt=new RegExp("\\p{Script=Thai}","u"),yt=new RegExp("\\p{Script=Tibetan}","u"),le=/[\u02BB\u02BC\u0027]/u,bt=Xe(e=>e.replace(T,""),"stripEmoji");var $t=Object.defineProperty,ye=w((e,t)=>$t(e,"name",{value:t,configurable:!0}),"i$5"),vt=Object.defineProperty,be=ye((e,t)=>vt(e,"name",{value:t,configurable:!0}),"r"),wt=Object.defineProperty,jt=be((e,t)=>wt(e,"name",{value:t,configurable:!0}),"c");let W=class{static{w(this,"l")}static{ye(this,"y")}static{be(this,"s")}static{jt(this,"LRUCache")}capacity;cache;keyOrder;constructor(t){this.capacity=t,this.cache=new Map,this.keyOrder=[]}get(t){if(this.cache.has(t))return this.keyOrder=this.keyOrder.filter(r=>r!==t),this.keyOrder.push(t),this.cache.get(t)}has(t){return this.cache.has(t)}set(t,r){if(this.cache.has(t))this.keyOrder=this.keyOrder.filter(n=>n!==t);else if(this.cache.size>=this.capacity){const n=this.keyOrder.shift();n!==void 0&&this.cache.delete(n)}this.cache.set(t,r),this.keyOrder.push(t)}delete(t){this.cache.delete(t),this.keyOrder=this.keyOrder.filter(r=>r!==t)}clear(){this.cache.clear(),this.keyOrder=[]}size(){return this.cache.size}};var Et=Object.defineProperty,Ot=w((e,t)=>Et(e,"name",{value:t,configurable:!0}),"r$6"),kt=Object.defineProperty,xt=Ot((e,t)=>kt(e,"name",{value:t,configurable:!0}),"a"),Ct=Object.defineProperty,St=xt((e,t)=>Ct(e,"name",{value:t,configurable:!0}),"s");const Pt=St((e,t)=>typeof e!="string"||e===""?"":(t?.locale?e[0].toLocaleLowerCase(t.locale):e[0].toLowerCase())+e.slice(1),"lowerFirst");var At=Object.defineProperty,Lt=w((e,t)=>At(e,"name",{value:t,configurable:!0}),"I"),Wt=Object.defineProperty,q=Lt((e,t)=>Wt(e,"name",{value:t,configurable:!0}),"W");const Rt=Ge(import.meta.url),M=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_t=q(e=>{if(typeof M<"u"&&M.versions&&M.versions.node){const[t,r]=M.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return M.getBuiltinModule(e)}return Rt(e)},"__cjs_getBuiltinModule"),{stripVTControlCharacters:Ut}=_t("node:util");var Tt=Object.defineProperty,zt=q((e,t)=>Tt(e,"name",{value:t,configurable:!0}),"g");const V=new W(1e3),Mt=/[.*+?^${}()|[\]\\]/g,Ft=zt(e=>{const t=e.join("");if(V.has(t))return V.get(t);const r=e.map(a=>a.replaceAll(Mt,String.raw`\$&`)).join("|"),n=new RegExp(r,"g");return V.set(t,n),n},"getSeparatorsRegex");var Bt=Object.defineProperty,It=q((e,t)=>Bt(e,"name",{value:t,configurable:!0}),"t");const Nt=It(e=>{const t=[];let r=0,n;for(T.lastIndex=0;(n=T.exec(e))!==null;)n.index>r&&t.push(e.slice(r,n.index)),t.push(n[0]),r=T.lastIndex;return r<e.length&&t.push(e.slice(r)),t.filter(Boolean)},"splitByEmoji");var qt=Object.defineProperty,$=q((e,t)=>qt(e,"name",{value:t,configurable:!0}),"u");const Gt=/[ČŠŽĐ]/i,$e=new Uint8Array(128),ve=new Uint8Array(128),we=new Uint8Array(128);for(let e=0;e<128;e++)$e[e]=e>=65&&e<=90?1:0,ve[e]=e>=97&&e<=122?1:0,we[e]=e>=48&&e<=57?1:0;const H=$(e=>$e[e],"isUpper"),ce=$(e=>ve[e],"isLower"),J=$(e=>we[e],"isDigit"),A=$((e,t,r,n,a)=>{if(e.length===0)return[];let i=!1;const l=Object.values(t);for(const u of l)if(u(e[0])){i=!0;break}if(!i&&!r)return[e];const o=[...e],h=[];let s=o[0],f="other";const m=Object.entries(t);for(const u of m){const[p,g]=u;if(g(o[0])){f=p;break}}let c=r&&n?o[0]===o[0].toLocaleUpperCase(n):!1;for(let u=1;u<o.length;u++){const p=o[u];let g="other";for(const b of m){const[v,E]=b;if(E(p)){g=v;break}}const y=r&&n?p===p.toLocaleUpperCase(n):!1;let d=!1;a?d=a(f,g,c,y,p,u,o):(f!==g&&f!=="other"&&g!=="other"&&(d=!0),r&&g!=="other"&&!c&&y&&(d=!0)),d?(h.push(s),s=p):s+=p,f=g,r&&(c=y)}return s&&s.length>0&&h.push(s),h.length>0?h:[e]},"handleScriptTransitions"),Dt=$((e,t,r,n)=>{if(r.size===0)return t;for(const a of r)if(e.startsWith(a,t))return n.push(a),t+a.length;return t},"detectAndProcessAcronym"),je=$((e,t=new Set)=>{if(e.length===0)return[];if(e.toUpperCase()===e)return[e];let r=0;const n=[],a=e.length;for(let i=1;i<a;i++){const l=Dt(e,r,t,n);if(l!==r){r=l,i=r-1;continue}const o=e.codePointAt(i-1),h=e.codePointAt(i),s=o&&o<128&&H(o),f=h&&h<128&&H(h),m=o&&o<128&&ce(o),c=o&&o<128&&J(o),u=h&&h<128&&J(h);if(m&&f){n.push(e.slice(r,i)),r=i;continue}if(c&&!u||!c&&u){n.push(e.slice(r,i)),r=i;continue}if(u&&!c){let p=!1,g=!1;if(i+1<a){const y=e.codePointAt(i+1);p=y&&y<128&&H(y),g=y&&y<128&&J(y)}if(!g&&p){n.push(e.slice(r,i),e.slice(i,i+1)),r=i+1;continue}}if(i+1<a){const p=e.codePointAt(i+1),g=p&&p<128&&ce(p);if(s&&f&&g){const y=e.slice(r,i+1);t.has(y)||(n.push(e.slice(r,i)),r=i)}}}return r<a&&n.push(e.slice(r)),n.filter(i=>i!=="")},"splitCamelCaseFast"),Ee=$((e,t,r)=>{if(e.length===0)return[];const n=e===e.toLocaleUpperCase(t);if(t.startsWith("de")){if(!n&&e.replaceAll("ß","SS")===e.toLocaleUpperCase(t))return[e];const s=[...e],f=s.length,m=[];let c=s[0],u=s[0]===s[0].toLocaleUpperCase(t),p=u,g=u?0:-1;for(let y=1;y<f;y++){const d=s[y],b=d===d.toLocaleUpperCase(t);if(b===u)c+=d;else if(b)c&&c.length>0&&(m.push(c),c=d),p=!0,g=y;else{if(p&&y-g>1){const v=s[y-1],E=c.slice(0,-1);E&&E.length>0&&m.push(E),c=v+d}else c+=d;p=!1,g=-1}u=b}return c&&c.length>0&&m.push(c),m}if(t.startsWith("uk")||t.startsWith("ru")||t.startsWith("bg")||t.startsWith("sr")||t.startsWith("mk")||t.startsWith("be")){if(!_.test(e)&&!O.test(e))return[e];const s=[...e],f=s.length,m=[];let c=s[0];const u=s[0];let p;_.test(u)?p=1:O.test(u)?p=2:p=0;let g=u===u.toLocaleUpperCase(t);for(let d=1;d<f;d++){const b=s[d];let v;_.test(b)?v=1:O.test(b)?v=2:v=0;const E=b===b.toLocaleUpperCase(t);p!==v&&(p===1||p===2)&&(v===1||v===2)||v===p&&!g&&E?(m.push(c),c=b):c+=b,p=v,g=E}c&&c.length>0&&m.push(c);const y=[];for(let d=0;d<m.length;d++)d<m.length-1&&m[d].length===1&&O.test(m[d])&&_.test(m[d+1][0])?(y.push(m[d]+m[d+1]),d+=1):y.push(m[d]);return y}if(t.startsWith("el")){if(!Q.test(e)&&!O.test(e))return[e];const s=[];ae.lastIndex=0;let f;for(;(f=ae.exec(e))!==null;)s.push(f[0]);s.length===0&&s.push(e);const m=[];if(s.length===1){const c=s[0];if(!c||!Q.test(c[0])||c.length===1)return[c??e]}for(const c of s){if(!c)continue;if(!Q.test(c[0])||c.length===1){m.push(c);continue}const u=c.length;let p=c[0],g=c[0]===c[0].toLocaleUpperCase(t);for(let y=1;y<u;y++){const d=c[y],b=d===d.toLocaleUpperCase(t);!g&&b?(m.push(p),p=d):p+=d,g=b}p&&m.push(p)}return m}if(t.startsWith("ja")||t.startsWith("ko")){const s=t.startsWith("ja"),f=s?{hiragana:$(c=>it.test(c),"hiragana"),kanji:$(c=>oe.test(c),"kanji"),katakana:$(c=>ot.test(c),"katakana"),latin:$(c=>O.test(c),"latin")}:{hangul:$(c=>ie.test(c),"hangul"),latin:$(c=>O.test(c),"latin")},m=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(s){const c=A(e,f,!1,t,(p,g)=>p==="hiragana"&&g==="katakana"||p==="katakana"&&g==="hiragana"||p==="hiragana"&&g==="latin"||p==="katakana"&&g==="latin"||p==="kanji"&&g==="latin"||p==="latin"&&(g==="hiragana"||g==="katakana"||g==="kanji")),u=[];for(const p of c){const g=p;g.length===1&&m.has(g)&&u.length>0?u[u.length-1]=u.at(-1)+g:u.push(g)}return u.length>0?u:[e]}return A(e,f,!1,t,(c,u)=>c==="hangul"&&u==="latin"||c==="latin"&&u==="hangul")}if(t.startsWith("sl")){const s=[...e],f=s.length,m=[];let c=s[0],u=s[0]===s[0].toLocaleUpperCase(t);for(let p=1;p<f;p++){const g=s[p],y=g===g.toLocaleUpperCase(t),d=Gt.test(g),b=p<f-1&&s[p+1]===s[p+1].toLocaleUpperCase(t);!u&&y||d&&b?(m.push(c),c=g,d&&b&&(m.push(c),c="")):c+=g,u=y}return c&&c.length>0&&m.push(c),m}if(t.startsWith("zh"))return A(e,{han:$(s=>oe.test(s),"han"),latin:$(s=>O.test(s),"latin")},!1,t);if(["ar","fa","he","ur"].includes(t.split("-")[0])){const s=$(f=>se.test(f)||ne.test(f),"isRtlChar");return A(e,{latin:$(f=>O.test(f),"latin"),rtl:$(f=>s(f),"rtl")},!1,t)}if(["am","bn","gu","hi","km","kn","lo","ml","mr","ne","or","pa","si","ta","te","th"].includes(t.split("-")[0])){const s=$(f=>tt.test(f)||et.test(f)||nt.test(f)||at.test(f)||st.test(f)||mt.test(f)||dt.test(f)||ut.test(f)||ht.test(f)||gt.test(f)||ct.test(f)||yt.test(f)||pt.test(f)||rt.test(f)||lt.test(f)||ft.test(f),"isIndicChar");return A(e,{indic:$(f=>s(f),"indic"),latin:$(f=>O.test(f),"latin")},!1,t)}if(["be","bg","ru","sr","uk"].includes(t))return A(e,{cyrillic:$(s=>_.test(s),"cyrillic"),latin:$(s=>O.test(s),"latin")},!0,t);if(["ar","fa","he"].includes(t))return A(e,{latin:$(s=>O.test(s),"latin"),rtl:$(s=>se.test(s)||ne.test(s),"rtl")},!1,t);if(t.startsWith("ko"))return A(e,{hangul:$(s=>ie.test(s),"hangul"),latin:$(s=>O.test(s),"latin")},!1,t);if(t.startsWith("uz")){if(!_.test(e)&&!O.test(e))return[e];const s=[...e],f=s.length,m=[];let c=s[0],u=s[0]===s[0].toLocaleUpperCase(t);for(let p=1;p<f;p++){const g=s[p],y=g===g.toLocaleUpperCase(t);if(le.test(g)||le.test(s[p-1])){c+=g;continue}!u&&y?(m.push(c),c=g):c+=g,u=y}return c&&c.length>0&&m.push(c),m}const a=[...e],i=a.length,l=[];let o=a[0],h=a[0]===a[0].toLocaleUpperCase(t);for(const s of r)if(e.startsWith(s)){l.push(s),o=a[s.length],h=o===o.toLocaleUpperCase(t);break}for(let s=1;s<i;s++){const f=a[s],m=f===f.toLocaleUpperCase(t);let c=0;for(const u of r)if(e.startsWith(u,s)){l.push(o,u),c=u.length,o="";const p=u.at(-1);p&&(h=p===p.toLocaleUpperCase(t));break}if(c>0){s+=c-1;continue}!h&&m?(l.push(o),o=f):o+=f,h=m}return o&&l.push(o),l},"splitCamelCaseLocale"),Kt=$((e,t,r)=>{const n=[],a=L.test(e)?e.split(L).filter(Boolean):[e];for(const i of a){const l=i;if(L.test(l))n.push(l);else{const o=T.test(l)?Nt(l).filter(Boolean):[l];for(const h of o)if(T.test(h))n.push(h);else if(t){const s=t.toLowerCase().split("-")[0];n.push(...Ee(h,s,r))}else n.push(...je(h,r))}}return n},"processTextWithAnsiEmoji"),G=$((e,t={})=>{if(!e||typeof e!="string")return[];const{handleAnsi:r=!1,handleEmoji:n=!1,knownAcronyms:a=[],locale:i,normalize:l=!1,separators:o,stripAnsi:h=!1,stripEmoji:s=!1}=t,f=new Set([...a].toSorted((d,b)=>b.length-d.length));let m=e;h&&(m=Ut(m)),s&&(m=bt(m));let c;Array.isArray(o)?c=Ft(o):o instanceof RegExp?c=o:c=Ze;const u=[];let p=m;const g=c.flags.includes("g")?c:new RegExp(c.source,`${c.flags}g`);for(;p.length>0;){const d=g.exec(p);if(!d){p===".."?u.push(".."):p==="."?u.push("."):p.length>0&&u.push(p);break}const b=d.index,v=d[0],E=v.length,B=p.slice(0,b),Ue=p.slice(b+E);if(v.startsWith("../"))u.push(".."),p=p.slice(b+3);else if(v.startsWith("./"))u.push("."),p=p.slice(b+2);else if(b===0&&v==="..")u.push(".."),p=p.slice(2);else if(b===0&&v===".")u.push("."),p=p.slice(1);else{B.length>0&&u.push(B);let S=0;for(;(S=v.indexOf("../",S))!==-1;)u.push(".."),S+=3;for(S=0;(S=v.indexOf("./",S))!==-1;)(S===0||v[S-1]!==".")&&u.push("."),S+=2;let P=Ue;for(;P.startsWith("../");)u.push(".."),P=P.slice(3);for(;P.startsWith("./");)u.push("."),P=P.slice(2);if(P===".."){u.push("..");break}else if(P==="."){u.push(".");break}else p=P}g.lastIndex=0}if(u.length===0){const d=m.split(c).filter(Boolean);u.push(...d)}let y=[];for(const d of u)r||n?y.push(...Kt(d,i,f)):i?y.push(...Ee(d,i,f)):y.push(...je(d,f));return l&&(y=y.map(d=>f.has(d)?d:i&&d===d.toLocaleUpperCase(i)?d[0]+d.slice(1).toLocaleLowerCase(i):d.toUpperCase()===d&&!f.has(d)?d.slice(0,1)+d.slice(1).toLowerCase():d)),y},"splitByCase");var Qt=Object.defineProperty,Vt=w((e,t)=>Qt(e,"name",{value:t,configurable:!0}),"r$5"),Ht=Object.defineProperty,Jt=Vt((e,t)=>Ht(e,"name",{value:t,configurable:!0}),"o"),Yt=Object.defineProperty,Xt=Jt((e,t)=>Yt(e,"name",{value:t,configurable:!0}),"s");const Z=Xt((e,t)=>typeof e!="string"||e===""?"":(t?.locale?e[0].toLocaleUpperCase(t.locale):e[0].toUpperCase())+e.slice(1),"upperFirst");var Zt=Object.defineProperty,er=w((e,t)=>Zt(e,"name",{value:t,configurable:!0}),"r$4"),tr=Object.defineProperty,rr=er((e,t)=>tr(e,"name",{value:t,configurable:!0}),"r"),nr=Object.defineProperty,ar=rr((e,t)=>nr(e,"name",{value:t,configurable:!0}),"n");const D=ar((e,t)=>`${e}::${t?.joiner??""}::${t?.locale??""}::${t?.knownAcronyms?.join(",")??""}::${t?.normalize?"true":"false"}`,"generateCacheKey");var ir=Object.defineProperty,sr=w((e,t)=>ir(e,"name",{value:t,configurable:!0}),"i$3"),or=Object.defineProperty,lr=sr((e,t)=>or(e,"name",{value:t,configurable:!0}),"f"),cr=Object.defineProperty,ur=lr((e,t)=>cr(e,"name",{value:t,configurable:!0}),"l");const K=ur((e,t)=>{const{length:r}=e;if(r===0)return"";if(r===1)return e[0];const n=[];let a="",i="";for(let l=0;l<r;l++){const o=e[l];if(L.test(o)){a?(n.push(a+i+o),a="",i=""):(n.length>0&&n.push(t),a=o);continue}a?(i&&(i+=t),i+=o):(n.length>0&&n.push(t),n.push(o))}return n.join("")},"joinSegments");var pr=Object.defineProperty,fr=w((e,t)=>pr(e,"name",{value:t,configurable:!0}),"r$3"),hr=Object.defineProperty,mr=fr((e,t)=>hr(e,"name",{value:t,configurable:!0}),"a"),dr=Object.defineProperty,gr=mr((e,t)=>dr(e,"name",{value:t,configurable:!0}),"e");const yr=/(?<![a-zß])SS(?![a-z])/g,ee=gr(e=>e.replaceAll(yr,"ß"),"normalizeGermanEszett");var br=Object.defineProperty,$r=w((e,t)=>br(e,"name",{value:t,configurable:!0}),"c$3"),vr=Object.defineProperty,wr=$r((e,t)=>vr(e,"name",{value:t,configurable:!0}),"c"),jr=Object.defineProperty,Er=wr((e,t)=>jr(e,"name",{value:t,configurable:!0}),"o");const Or=new W(1e3),kr=Er((e,t)=>{if(typeof e!="string"||!e)return"";const r=t?.cache??!1,n=t?.cacheStore??Or;let a;if(r&&(a=D(e,t)),r&&a&&n.has(a))return n.get(a);let i=!0;const l=K(G(e,{handleAnsi:t?.handleAnsi,handleEmoji:t?.handleEmoji,knownAcronyms:t?.knownAcronyms,locale:t?.locale,normalize:t?.normalize,separators:void 0,stripAnsi:t?.stripAnsi,stripEmoji:t?.stripEmoji}).map(o=>{if(t?.handleAnsi&&L.test(o))return o;const h=t?.locale?.startsWith("de")?ee(o):o,s=t?.locale?h.toLocaleLowerCase(t.locale):h.toLowerCase();return i?(i=!1,Pt(s,t)):Z(s,t)}),"");return r&&a&&n.set(a,l),l},"camelCase");var xr=Object.defineProperty,Cr=w((e,t)=>xr(e,"name",{value:t,configurable:!0}),"l$3"),Sr=Object.defineProperty,Pr=Cr((e,t)=>Sr(e,"name",{value:t,configurable:!0}),"l"),Ar=Object.defineProperty,Lr=Pr((e,t)=>Ar(e,"name",{value:t,configurable:!0}),"o");const Wr=new W(1e3),te=Lr((e,t)=>{if(typeof e!="string")return"";const r=t?.cache??!1,n=t?.cacheStore??Wr;let a;if(r&&(a=D(e,t)),r&&a&&n.has(a))return n.get(a);const i=G(e,{handleAnsi:t?.handleAnsi,handleEmoji:t?.handleEmoji,knownAcronyms:t?.knownAcronyms,locale:t?.locale,normalize:t?.normalize,separators:void 0,stripAnsi:t?.stripAnsi,stripEmoji:t?.stripEmoji}).map(o=>{if(t?.handleAnsi&&L.test(o))return o;if(t?.toUpperCase)return t.locale?o.toLocaleUpperCase(t.locale):o.toUpperCase();const h=t?.locale?.startsWith("de")?ee(o):o;return t?.locale?h.toLocaleLowerCase(t.locale):h.toLowerCase()}),l=K(i,t?.joiner??"-");return r&&a&&n.set(a,l),l},"kebabCase");var Rr=Object.defineProperty,_r=w((e,t)=>Rr(e,"name",{value:t,configurable:!0}),"r$2"),Ur=Object.defineProperty,Tr=_r((e,t)=>Ur(e,"name",{value:t,configurable:!0}),"a"),zr=Object.defineProperty,Mr=Tr((e,t)=>zr(e,"name",{value:t,configurable:!0}),"s");const Fr=new W(1e3),Br=Mr((e,t)=>te(e,{cacheStore:Fr,...t,joiner:"_",toUpperCase:!0}),"constantCase");var Ir=Object.defineProperty,Nr=w((e,t)=>Ir(e,"name",{value:t,configurable:!0}),"l$2"),qr=Object.defineProperty,Gr=Nr((e,t)=>qr(e,"name",{value:t,configurable:!0}),"l"),Dr=Object.defineProperty,Kr=Gr((e,t)=>Dr(e,"name",{value:t,configurable:!0}),"i");const Qr=new W(1e3),Vr=Kr((e,t)=>{if(typeof e!="string"||!e)return"";const r=t?.cache??!1,n=t?.cacheStore??Qr;let a;if(r&&(a=D(e,t)),r&&a&&n.has(a))return n.get(a);const i=K(G(e,{handleAnsi:t?.handleAnsi,handleEmoji:t?.handleEmoji,knownAcronyms:t?.knownAcronyms,locale:t?.locale,normalize:t?.normalize,separators:void 0,stripAnsi:t?.stripAnsi,stripEmoji:t?.stripEmoji}).map(l=>{if(t?.handleAnsi&&L.test(l))return l;const o=t?.locale?.startsWith("de")?ee(l):l;return Z(t?.locale?o.toLocaleLowerCase(t.locale):o.toLowerCase(),{locale:t?.locale})}),"");return r&&a&&n.set(a,i),i},"pascalCase");var Hr=Object.defineProperty,Jr=w((e,t)=>Hr(e,"name",{value:t,configurable:!0}),"r$1"),Yr=Object.defineProperty,Xr=Jr((e,t)=>Yr(e,"name",{value:t,configurable:!0}),"a"),Zr=Object.defineProperty,en=Xr((e,t)=>Zr(e,"name",{value:t,configurable:!0}),"s");const tn=new W(1e3),rn=en((e,t)=>te(e,{cacheStore:tn,...t,joiner:"_"}),"snakeCase");var nn=Object.defineProperty,an=w((e,t)=>nn(e,"name",{value:t,configurable:!0}),"r"),sn=Object.defineProperty,on=an((e,t)=>sn(e,"name",{value:t,configurable:!0}),"e"),ln=Object.defineProperty,cn=on((e,t)=>ln(e,"name",{value:t,configurable:!0}),"i");const un=new W(1e3),pn=cn((e,t)=>{if(typeof e!="string")return"";const r=t?.cache??!1,n=t?.cacheStore??un;let a;if(r&&(a=D(e,t)),r&&a&&n.has(a))return n.get(a);const i=K(G(e,{handleAnsi:t?.handleAnsi,handleEmoji:t?.handleEmoji,knownAcronyms:t?.knownAcronyms,locale:t?.locale,normalize:t?.normalize,separators:void 0,stripAnsi:t?.stripAnsi,stripEmoji:t?.stripEmoji}).map(l=>Z(l,{locale:t?.locale})),"-");return r&&a&&n.set(a,i),i},"trainCase");var fn=Object.defineProperty,k=w((e,t)=>fn(e,"name",{value:t,configurable:!0}),"e");const x=k(e=>e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"||typeof e=="bigint"?String(e):JSON.stringify(e),"stringify"),Y={camel_case:k(e=>kr(x(e)),"camel_case"),kebab_case:k(e=>te(x(e)),"kebab_case"),lower_case:k(e=>x(e).toLowerCase(),"lower_case"),pascal_case:k(e=>Vr(x(e)),"pascal_case"),path_join:k((e,...t)=>{const r=[x(e),...t.map(n=>x(n))];return me(...r)},"path_join"),path_relative:k((e,t)=>he(x(t),x(e)),"path_relative"),snake_case:k(e=>rn(x(e)),"snake_case"),upper_case:k(e=>x(e).toUpperCase(),"upper_case"),upper_kebab_case:k(e=>pn(x(e)),"upper_kebab_case"),upper_snake_case:k(e=>Br(x(e)),"upper_snake_case")};k(e=>Object.hasOwn(Y,e),"isKnownFilter");const Oe=k((e,t,r=[])=>{const n=Y[e];if(!n)throw new Error(`Unknown filter "${e}". Known filters: ${Object.keys(Y).sort().join(", ")}.`);return n(t,...r)},"applyFilter");var hn=Object.defineProperty,ke=w((e,t)=>hn(e,"name",{value:t,configurable:!0}),"d$1");const xe=ke(e=>{const t=[];let r=0,n=0,a,i=-1;for(const l of e){if(i+=1,a){l===a&&(a=void 0);continue}if(l==='"'||l==="'"){a=l;continue}l==="("?r+=1:l===")"?r-=1:l===","&&r===0&&(t.push(e.slice(n,i)),n=i+1)}return t.push(e.slice(n)),t},"splitCommaOutsideQuotes"),mn=ke(e=>{if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return e.slice(1,-1)},"stripQuotes");var dn=Object.defineProperty,R=w((e,t)=>dn(e,"name",{value:t,configurable:!0}),"s$1");const gn=/\[([^\]]+)\]/g,yn=R(e=>{const t=e.trim(),r=t.indexOf("(");if(r===-1)return{args:[],name:t};if(!t.endsWith(")"))throw new Error(`Filter call "${e}" missing closing ")"`);const n=t.slice(0,r).trim(),a=t.slice(r+1,-1).trim();return a===""?{args:[],name:n}:{args:xe(a).map(i=>{const l=i.trim();return mn(l)??l}),name:n}},"parseFilterCall"),bn=R(e=>{const t=e.split("|").map(n=>n.trim()),r=t[0]??"";if(!r)throw new Error(`Empty variable name in expression "${e}"`);return{filters:t.slice(1).map(n=>yn(n)),name:r}},"parsePipe"),$n=R(e=>e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"||typeof e=="bigint"?String(e):JSON.stringify(e),"stringify"),vn=R((e,t)=>{const r=e.replaceAll(gn,(n,a)=>{const{filters:i,name:l}=bn(a);if(!Object.hasOwn(t,l))throw new Error(`Variable "${l}" used in filename "${e}" but not defined`);let o=t[l];for(const h of i)o=Oe(h.name,o,h.args);return $n(o)});return Ce(r)},"interpolateFilename"),Ce=R(e=>e.split("/").map(t=>t.endsWith(".tera")||t.endsWith(".twig")?t.slice(0,-5):t).join("/"),"stripTeraSuffix"),wn=R(e=>e.endsWith(".raw")?e.slice(0,-4):e,"stripRawSuffix"),jn=R(e=>{const t=e.split("/");return(t.at(-1)??"").startsWith("_")?!0:t.slice(0,-1).includes("partials")},"isPartialPath");var En=Object.defineProperty,On=w((e,t)=>En(e,"name",{value:t,configurable:!0}),"i");const kn=On((e,t)=>{if(!e.startsWith(`---
|
|
1
|
+
var ie=Object.defineProperty;var h=(e,t)=>ie(e,"name",{value:t,configurable:!0});import{b0 as S,b1 as E,b2 as _,b3 as U,b4 as z,b5 as W,b6 as q,b7 as ae,u as oe,ay as se,p as le,b8 as ce}from"./bin.js";import{z as Q,M as G,$ as A}from"./config.js";var fe=Object.defineProperty,ue=h((e,t)=>fe(e,"name",{value:t,configurable:!0}),"l$3"),pe=Object.defineProperty,me=ue((e,t)=>pe(e,"name",{value:t,configurable:!0}),"l"),de=Object.defineProperty,he=me((e,t)=>de(e,"name",{value:t,configurable:!0}),"o");const ye=new E(1e3),T=he((e,t)=>{if(typeof e!="string")return"";const n=t?.cache??!1,r=t?.cacheStore??ye;let i;if(n&&(i=S(e,t)),n&&i&&r.has(i))return r.get(i);const a=_(e,{handleAnsi:t?.handleAnsi,handleEmoji:t?.handleEmoji,knownAcronyms:t?.knownAcronyms,locale:t?.locale,normalize:t?.normalize,separators:void 0,stripAnsi:t?.stripAnsi,stripEmoji:t?.stripEmoji}).map(s=>{if(t?.handleAnsi&&U.test(s))return s;if(t?.toUpperCase)return t.locale?s.toLocaleUpperCase(t.locale):s.toUpperCase();const l=t?.locale?.startsWith("de")?z(s):s;return t?.locale?l.toLocaleLowerCase(t.locale):l.toLowerCase()}),o=W(a,t?.joiner??"-");return n&&i&&r.set(i,o),o},"kebabCase");var be=Object.defineProperty,ge=h((e,t)=>be(e,"name",{value:t,configurable:!0}),"r$2"),ve=Object.defineProperty,$e=ge((e,t)=>ve(e,"name",{value:t,configurable:!0}),"a"),we=Object.defineProperty,je=$e((e,t)=>we(e,"name",{value:t,configurable:!0}),"s");const Oe=new E(1e3),Ee=je((e,t)=>T(e,{cacheStore:Oe,...t,joiner:"_",toUpperCase:!0}),"constantCase");var xe=Object.defineProperty,Ae=h((e,t)=>xe(e,"name",{value:t,configurable:!0}),"l$2"),ke=Object.defineProperty,Pe=Ae((e,t)=>ke(e,"name",{value:t,configurable:!0}),"l"),Ce=Object.defineProperty,Se=Pe((e,t)=>Ce(e,"name",{value:t,configurable:!0}),"i");const _e=new E(1e3),We=Se((e,t)=>{if(typeof e!="string"||!e)return"";const n=t?.cache??!1,r=t?.cacheStore??_e;let i;if(n&&(i=S(e,t)),n&&i&&r.has(i))return r.get(i);const a=W(_(e,{handleAnsi:t?.handleAnsi,handleEmoji:t?.handleEmoji,knownAcronyms:t?.knownAcronyms,locale:t?.locale,normalize:t?.normalize,separators:void 0,stripAnsi:t?.stripAnsi,stripEmoji:t?.stripEmoji}).map(o=>{if(t?.handleAnsi&&U.test(o))return o;const s=t?.locale?.startsWith("de")?z(o):o;return q(t?.locale?s.toLocaleLowerCase(t.locale):s.toLowerCase(),{locale:t?.locale})}),"");return n&&i&&r.set(i,a),a},"pascalCase");var Te=Object.defineProperty,Le=h((e,t)=>Te(e,"name",{value:t,configurable:!0}),"r$1"),Me=Object.defineProperty,Fe=Le((e,t)=>Me(e,"name",{value:t,configurable:!0}),"a"),Ne=Object.defineProperty,Re=Fe((e,t)=>Ne(e,"name",{value:t,configurable:!0}),"s");const Ie=new E(1e3),Ue=Re((e,t)=>T(e,{cacheStore:Ie,...t,joiner:"_"}),"snakeCase");var ze=Object.defineProperty,qe=h((e,t)=>ze(e,"name",{value:t,configurable:!0}),"r"),Qe=Object.defineProperty,Ge=qe((e,t)=>Qe(e,"name",{value:t,configurable:!0}),"e"),Ve=Object.defineProperty,Be=Ge((e,t)=>Ve(e,"name",{value:t,configurable:!0}),"i");const De=new E(1e3),Je=Be((e,t)=>{if(typeof e!="string")return"";const n=t?.cache??!1,r=t?.cacheStore??De;let i;if(n&&(i=S(e,t)),n&&i&&r.has(i))return r.get(i);const a=W(_(e,{handleAnsi:t?.handleAnsi,handleEmoji:t?.handleEmoji,knownAcronyms:t?.knownAcronyms,locale:t?.locale,normalize:t?.normalize,separators:void 0,stripAnsi:t?.stripAnsi,stripEmoji:t?.stripEmoji}).map(o=>q(o,{locale:t?.locale})),"-");return n&&i&&r.set(i,a),a},"trainCase");var Ke=Object.defineProperty,d=h((e,t)=>Ke(e,"name",{value:t,configurable:!0}),"e");const y=d(e=>e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"||typeof e=="bigint"?String(e):JSON.stringify(e),"stringify"),P={camel_case:d(e=>ae(y(e)),"camel_case"),kebab_case:d(e=>T(y(e)),"kebab_case"),lower_case:d(e=>y(e).toLowerCase(),"lower_case"),pascal_case:d(e=>We(y(e)),"pascal_case"),path_join:d((e,...t)=>{const n=[y(e),...t.map(r=>y(r))];return G(...n)},"path_join"),path_relative:d((e,t)=>Q(y(t),y(e)),"path_relative"),snake_case:d(e=>Ue(y(e)),"snake_case"),upper_case:d(e=>y(e).toUpperCase(),"upper_case"),upper_kebab_case:d(e=>Je(y(e)),"upper_kebab_case"),upper_snake_case:d(e=>Ee(y(e)),"upper_snake_case")};d(e=>Object.hasOwn(P,e),"isKnownFilter");const V=d((e,t,n=[])=>{const r=P[e];if(!r)throw new Error(`Unknown filter "${e}". Known filters: ${Object.keys(P).sort().join(", ")}.`);return r(t,...n)},"applyFilter");var Ye=Object.defineProperty,B=h((e,t)=>Ye(e,"name",{value:t,configurable:!0}),"d$1");const D=B(e=>{const t=[];let n=0,r=0,i,a=-1;for(const o of e){if(a+=1,i){o===i&&(i=void 0);continue}if(o==='"'||o==="'"){i=o;continue}o==="("?n+=1:o===")"?n-=1:o===","&&n===0&&(t.push(e.slice(r,a)),r=a+1)}return t.push(e.slice(r)),t},"splitCommaOutsideQuotes"),He=B(e=>{if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return e.slice(1,-1)},"stripQuotes");var Xe=Object.defineProperty,w=h((e,t)=>Xe(e,"name",{value:t,configurable:!0}),"s$1");const Ze=/\[([^\]]+)\]/g,et=w(e=>{const t=e.trim(),n=t.indexOf("(");if(n===-1)return{args:[],name:t};if(!t.endsWith(")"))throw new Error(`Filter call "${e}" missing closing ")"`);const r=t.slice(0,n).trim(),i=t.slice(n+1,-1).trim();return i===""?{args:[],name:r}:{args:D(i).map(a=>{const o=a.trim();return He(o)??o}),name:r}},"parseFilterCall"),tt=w(e=>{const t=e.split("|").map(r=>r.trim()),n=t[0]??"";if(!n)throw new Error(`Empty variable name in expression "${e}"`);return{filters:t.slice(1).map(r=>et(r)),name:n}},"parsePipe"),rt=w(e=>e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"||typeof e=="bigint"?String(e):JSON.stringify(e),"stringify"),nt=w((e,t)=>{const n=e.replaceAll(Ze,(r,i)=>{const{filters:a,name:o}=tt(i);if(!Object.hasOwn(t,o))throw new Error(`Variable "${o}" used in filename "${e}" but not defined`);let s=t[o];for(const l of a)s=V(l.name,s,l.args);return rt(s)});return J(n)},"interpolateFilename"),J=w(e=>e.split("/").map(t=>t.endsWith(".tera")||t.endsWith(".twig")?t.slice(0,-5):t).join("/"),"stripTeraSuffix"),it=w(e=>e.endsWith(".raw")?e.slice(0,-4):e,"stripRawSuffix"),at=w(e=>{const t=e.split("/");return(t.at(-1)??"").startsWith("_")?!0:t.slice(0,-1).includes("partials")},"isPartialPath");var ot=Object.defineProperty,st=h((e,t)=>ot(e,"name",{value:t,configurable:!0}),"i");const lt=st((e,t)=>{if(!e.startsWith(`---
|
|
2
2
|
`)&&!e.startsWith(`---\r
|
|
3
|
-
`))return{body:e};const
|
|
4
|
-
---`,3);if(
|
|
5
|
-
`&&(
|
|
6
|
-
`)?5:4,
|
|
7
|
-
`&&(n+=1)},"advanceLine");for(const i of e.matchAll(Cn)){const l=i.index??0;if(l>r){const s=e.slice(r,l);t.push({line:n,type:"text",value:s}),a(s)}const o=n,h=i[0];h.startsWith("{{")?t.push({line:o,type:"expr",value:(i[1]??"").trim()}):t.push({line:o,type:"stmt",value:(i[2]??"").trim()}),a(h),r=l+h.length}if(r<e.length){const i=e.slice(r);t.push({line:n,type:"text",value:i})}return t},"tokenize"),Sn=new Set(["block","endblock","endfilter","endmacro","extends","filter","import","macro","set"]),Pe=j((e,t)=>{let r=0;const n=j((i,l)=>{throw new Error(`${t}:${i}: ${l}`)},"error"),a=j(i=>{const l=[];for(;r<e.length;){const o=e[r];if(o.type==="text"){l.push({type:"text",value:o.value}),r+=1;continue}if(o.type==="expr"){l.push({expression:o.value,line:o.line,type:"expr"}),r+=1;continue}const h=o.value.split(/\s+/)[0]??"";if(i.includes(h))return l;if(Sn.has(h)&&n(o.line,`Tera feature "{% ${h} %}" is not supported. Supported: if/else/endif, for/endfor, include. Rewrite the template to avoid macros, set, extends, block, and import.`),h==="if"){r+=1;const s=o.value.slice(2).trim(),f=a(["else","endif"]);let m;r<e.length&&e[r].type==="stmt"&&e[r].value.split(/\s+/)[0]==="else"&&(r+=1,m=a(["endif"])),(r>=e.length||e[r].type!=="stmt"||e[r].value.split(/\s+/)[0]!=="endif")&&n(o.line,"Unterminated {% if %} — missing {% endif %}"),r+=1,l.push({alternate:m,condition:s,consequent:f,line:o.line,type:"if"});continue}if(h==="for"){r+=1;const s=o.value.slice(3).trim(),f=s.indexOf(" in ");f===-1&&n(o.line,"Malformed {% for %} — expected `for <name> in <collection>`");const m=s.slice(0,f).trim(),c=s.slice(f+4).trim();(!m||!c)&&n(o.line,"Malformed {% for %} — missing binding or collection");const u=a(["endfor"]);(r>=e.length||e[r].type!=="stmt"||e[r].value.split(/\s+/)[0]!=="endfor")&&n(o.line,"Unterminated {% for %} — missing {% endfor %}"),r+=1,l.push({binding:m,body:u,collection:c,line:o.line,type:"for"});continue}if(h==="include"){r+=1;const s=o.value.slice(7).trim(),f=Ae(s);f===void 0&&n(o.line,"Malformed {% include %} — expected a quoted partial name"),l.push({line:o.line,name:f,type:"include"});continue}n(o.line,`Unknown tag "{% ${h} %}". Supported: if, for, include.`)}return l},"parseBlock");return a([])},"parse"),Ae=j(e=>{if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return e.slice(1,-1)},"stripQuotes"),Pn=j(e=>e==null?"":typeof e=="boolean"||typeof e=="number"?String(e):typeof e=="string"?e:JSON.stringify(e),"stringify"),An=j(e=>e==null||e===!1||e===0||e===""?!1:Array.isArray(e)?e.length>0:!0,"isTruthy"),Le=j((e,t,r,n,a=!0)=>{const i=e.split(".");if(a&&i.length>0&&!Object.hasOwn(t,i[0]))throw new Error(`${n}:${r}: Variable "${e}" is not defined`);let l=t;for(const o of i){if(l==null)return;if(typeof l!="object")throw new TypeError(`${n}:${r}: Cannot read "${o}" on non-object value`);l=l[o]}return l},"lookupVariable"),Ln=j(e=>{const t=[];let r=0,n=0,a;for(let i=0;i<e.length;i+=1){const l=e[i];if(a){l===a&&(a=void 0);continue}if(l==='"'||l==="'"){a=l;continue}l==="("?r+=1:l===")"?r-=1:l==="|"&&r===0&&(t.push(e.slice(n,i)),n=i+1)}return t.push(e.slice(n)),t},"splitFilterPipe"),Wn=j(e=>{const t=e.trim(),r=t.indexOf("(");if(r===-1)return{args:[],name:t};if(!t.endsWith(")"))throw new Error(`Filter call "${e}" missing closing ")"`);const n=t.slice(0,r).trim(),a=t.slice(r+1,-1).trim();return a?{args:xe(a).map(i=>i.trim()),name:n}:{args:[],name:n}},"parseFilterCall"),N=j((e,t,r,n,a=!0)=>{const i=e.trim();if(i==="true")return!0;if(i==="false")return!1;if(i==="null"||i==="none")return null;const l=Ae(i);return l!==void 0?l:/^-?\d+(?:\.\d+)?$/.test(i)?Number(i):Le(i,t,r,n,a)},"evaluatePrimary"),We=j((e,t,r,n,a=!0)=>{const i=Ln(e),l=i[0].trim();let o=N(l,t,r,n,a);for(let h=1;h<i.length;h+=1){const s=i[h].trim(),{args:f,name:m}=Wn(s),c=f.map(u=>N(u,t,r,n,a));try{o=Oe(m,o,c)}catch(u){const p=u instanceof Error?u.message:String(u);throw new Error(`${n}:${r}: ${p}`,{cause:u})}}return o},"evaluateExpression"),Re=j((e,t)=>{let r,n=0;for(let a=0;a<=e.length-t.length;a+=1){const i=e[a];if(r){i===r&&(r=void 0);continue}if(i==='"'||i==="'"){r=i;continue}if(i==="("){n+=1;continue}if(i===")"){n-=1;continue}if(n===0&&e.slice(a,a+t.length)===t)return a}return-1},"findOperatorOutsideQuotes"),ue=j((e,t)=>{const r=[];let n=0,a=0;for(;a<=e.length-t.length;){const i=Re(e.slice(a),t);if(i===-1)break;r.push(e.slice(n,a+i)),a+=i+t.length,n=a}return r.push(e.slice(n)),r},"splitLogical"),U=j((e,t,r,n)=>{const a=e.trim();if(a==="")return!1;if(a.startsWith("(")&&a.endsWith(")")&&Rn(a)===a.length-1)return U(a.slice(1,-1),t,r,n);const i=ue(a," or ");if(i.length>1)return i.some(o=>U(o,t,r,n));const l=ue(a," and ");if(l.length>1)return l.every(o=>U(o,t,r,n));if(a.startsWith("not "))return!U(a.slice(4),t,r,n);for(const o of["==","!="]){const h=Re(a,o);if(h!==-1){const s=N(a.slice(0,h),t,n,r,!1),f=N(a.slice(h+o.length),t,n,r,!1),m=s===f;return o==="=="?m:!m}}return An(We(a,t,n,r,!1))},"evaluateConditionExpression"),Rn=j(e=>{if(e[0]!=="(")return-1;let t=0,r,n=-1;for(const a of e){if(n+=1,r){a===r&&(r=void 0);continue}if(a==='"'||a==="'"){r=a;continue}if(a==="(")t+=1;else if(a===")"&&(t-=1,t===0))return n}return-1},"matchingParen"),F=j((e,t)=>{let r="";for(const n of e){if(n.type==="text"){r+=n.value;continue}if(n.type==="expr"){r+=Pn(We(n.expression,t.scope,n.line,t.filename));continue}if(n.type==="if"){const a=U(n.condition,t.scope,t.filename,n.line)?n.consequent:n.alternate??[];r+=F(a,t);continue}if(n.type==="for"){const a=Le(n.collection,t.scope,n.line,t.filename,!1);if(a==null)continue;if(!Array.isArray(a))throw new TypeError(`${t.filename}:${n.line}: {% for %} expected an array, got ${typeof a}`);for(const i of a){const l={...t.scope,[n.binding]:i};r+=F(n.body,{...t,scope:l})}continue}if(n.type==="include"){const a=t.partials?.get(n.name);if(!a)throw new Error(`${t.filename}:${n.line}: Partial "${n.name}" not found. Available: ${[...t.partials?.keys()??[]].join(", ")||"(none)"}`);const i=t.includeStack??new Set;if(i.has(n.name)){const l=[...i,n.name].join(" → ");throw new Error(`${t.filename}:${n.line}: Circular partial include detected: ${l}`)}i.add(n.name);try{r+=F(a,{...t,filename:`<partial:${n.name}>`,includeStack:i})}finally{i.delete(n.name)}}}return r},"renderNodes"),_n=j((e,t)=>Pe(Se(e),t),"parseTemplate");j((e,t)=>F(e,t),"renderAst");const X=j((e,t)=>F(Pe(Se(e),t.filename),t),"renderTemplate");var Un=Object.defineProperty,C=w((e,t)=>Un(e,"name",{value:t,configurable:!0}),"s");const pe="template.yml",Tn=".raw",zn=new Set([".cjs",".css",".env",".gitattributes",".gitignore",".graphql",".html",".ini",".js",".json",".json5",".jsonc",".jsx",".lock",".md",".mdx",".mjs",".prettierrc",".raw",".rs",".scss",".sh",".sql",".svg",".tera",".toml",".ts",".tsx",".twig",".txt",".vue",".xml",".yaml",".yml"]),Mn=new Set(["Brewfile","CHANGELOG","CODEOWNERS","CONTRIBUTING","COPYING","Dockerfile","Gemfile","LICENCE","LICENSE","Makefile","NOTICE","Procfile","Rakefile","README","VERSION"]),Fn=C(e=>{const t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\")),r=t===-1?e:e.slice(t+1),n=r.lastIndexOf(".");return n===-1||n===0?"":r.slice(n).toLowerCase()},"lastDot"),_e=C(e=>{const t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t===-1?e:e.slice(t+1)},"basename"),Bn=C(e=>{const t=Fn(e);if(t!=="")return zn.has(t);const r=_e(e);return Mn.has(r)},"isLikelyText"),In=C(e=>{const t={default:e.default,internal:e.internal,order:e.order,prompt:e.prompt,required:e.required};switch(e.type){case"array":return{...t,type:"array"};case"boolean":return{...t,default:typeof t.default=="boolean"?t.default:void 0,type:"boolean"};case"enum":return{...t,multiple:e.multiple,type:"enum",values:e.values??[]};case"number":return{...t,type:"number"};case"string":return{...t,type:"string"};default:throw new Error(`Unsupported variable type "${String(e.type)}"`)}},"yamlVariableToVariable"),Nn=C(e=>e.replaceAll("\\","/").replace(/^\.\//,"").replaceAll(/\/+/g,"/"),"normalizeDestinationPath"),qn=C((e,t,r)=>{const n=t.split("/").filter(Boolean);if(n.length===0)throw new Error("Empty destination path for value");let a=e;for(let i=0;i<n.length-1;i+=1){const l=n[i],o=a[l];if(o===void 0){const h={};a[l]=h,a=h}else if(typeof o=="object"&&!Buffer.isBuffer(o))a=o;else throw new TypeError(`Path conflict: "${n.slice(0,i+1).join("/")}" is both a file and a directory`)}a[n.at(-1)]=r},"flattenFiles"),fe=C((e,t,r)=>{if(typeof e!="string")return Gn(e);const n=e.includes("{{")||e.includes("{%")?X(e,{filename:`${r}#frontmatter`,scope:t}):e;return U(n,t,`${r}#frontmatter`,1)},"evaluateGate"),Gn=C(e=>e==null||e===!1||e===0||e===""?!1:Array.isArray(e)?e.length>0:typeof e=="string"?e!=="false"&&e!=="0":!0,"truthyValue"),Yn=C((e,t)=>{const r=me(e,pe),n=Be(r);if(!n||typeof n!="object")throw new Error(`${r}: must contain a YAML mapping`);const a={};if(n.variables)for(const[h,s]of Object.entries(n.variables))a[h]=In(s);const i=new Map,l=[];for(const h of Ie(e,{includeDirs:!1,includeSymlinks:!1})){if(h.path===r)continue;const s=he(e,h.path).replaceAll("\\","/");if(s===pe)continue;if(jn(s)){const m=I(h.path),c=_n(m,s);for(const u of Dn(s))i.has(u)&&i.get(u)!==c&&Ne.warn(`partial name "${u}" is declared by multiple files — last one wins. Use distinct names or fully-qualified includes.`),i.set(u,c);continue}if(s.endsWith(Tn)){const m=I(h.path);l.push({binary:null,isRaw:!0,rawText:m,relativePath:s});continue}if(Bn(s)){const m=I(h.path);l.push({binary:null,isRaw:!1,rawText:m,relativePath:s});continue}const f=I(h.path,{buffer:!0});l.push({binary:f,isRaw:!1,rawText:null,relativePath:s})}const o=C(h=>{const s={...h.builtins,...h.options},f={},m={};for(const u of l){const p=u.relativePath;let g,y,d=!1;if(u.binary)g=u.binary;else if(u.isRaw)g=u.rawText??"";else{const v=u.rawText??"",E=kn(v,B=>qe(B));if(E.frontmatter){if(E.frontmatter.skip!==void 0&&fe(E.frontmatter.skip,s,p)||E.frontmatter.if!==void 0&&!fe(E.frontmatter.if,s,p))continue;typeof E.frontmatter.to=="string"&&(y=X(E.frontmatter.to,{filename:`${p}#frontmatter.to`,partials:i,scope:s})),E.frontmatter.force===!0&&(d=!0)}g=X(E.body,{filename:p,partials:i,scope:s})}const b=Nn(y??vn(wn(p),s));qn(f,b,g),d&&(m[b]={force:!0})}const c={files:f};return Object.keys(m).length>0&&(c.filesMeta=m),c},"produce");return{about:{description:n.description??`Moon-format template at ${e}`,name:n.title??t},destination:n.destination,options:a,produce:o}},"loadMoonTemplate"),Dn=C(e=>{const t=Ce(e),r=_e(t),n=new Set([r,t]);if(r.startsWith("_")){n.add(r.replace(/^_+/,""));const a=t.slice(0,t.length-r.length);n.add(`${a}${r.replace(/^_+/,"")}`)}return[...n]},"partialKeys");export{Yn as loadMoonTemplate};
|
|
3
|
+
`))return{body:e};const n=e.indexOf(`
|
|
4
|
+
---`,3);if(n===-1)return{body:e};let r=n+1+3;e[r]==="\r"&&(r+=1),e[r]===`
|
|
5
|
+
`&&(r+=1);const i=e.startsWith(`---\r
|
|
6
|
+
`)?5:4,a=e.slice(i,n).replaceAll("\r","");let o;try{o=t(a)}catch(s){const l=s instanceof Error?s.message:String(s);throw new Error(`Failed to parse frontmatter YAML: ${l}`,{cause:s})}if(o==null)return{body:e.slice(r)};if(typeof o!="object"||Array.isArray(o))throw new TypeError(`Frontmatter must be a YAML mapping, got ${Array.isArray(o)?"array":typeof o}`);return{body:e.slice(r),frontmatter:o}},"splitFrontmatter");var ct=Object.defineProperty,f=h((e,t)=>ct(e,"name",{value:t,configurable:!0}),"c");const ft=/\{\{-?(.+?)-?\}\}|\{%-?(.+?)-?%\}/gs,K=f(e=>{const t=[];let n=0,r=1;const i=f(a=>{for(const o of a)o===`
|
|
7
|
+
`&&(r+=1)},"advanceLine");for(const a of e.matchAll(ft)){const o=a.index??0;if(o>n){const c=e.slice(n,o);t.push({line:r,type:"text",value:c}),i(c)}const s=r,l=a[0];l.startsWith("{{")?t.push({line:s,type:"expr",value:(a[1]??"").trim()}):t.push({line:s,type:"stmt",value:(a[2]??"").trim()}),i(l),n=o+l.length}if(n<e.length){const a=e.slice(n);t.push({line:r,type:"text",value:a})}return t},"tokenize"),ut=new Set(["block","endblock","endfilter","endmacro","extends","filter","import","macro","set"]),Y=f((e,t)=>{let n=0;const r=f((a,o)=>{throw new Error(`${t}:${a}: ${o}`)},"error"),i=f(a=>{const o=[];for(;n<e.length;){const s=e[n];if(s.type==="text"){o.push({type:"text",value:s.value}),n+=1;continue}if(s.type==="expr"){o.push({expression:s.value,line:s.line,type:"expr"}),n+=1;continue}const l=s.value.split(/\s+/)[0]??"";if(a.includes(l))return o;if(ut.has(l)&&r(s.line,`Tera feature "{% ${l} %}" is not supported. Supported: if/else/endif, for/endfor, include. Rewrite the template to avoid macros, set, extends, block, and import.`),l==="if"){n+=1;const c=s.value.slice(2).trim(),m=i(["else","endif"]);let u;n<e.length&&e[n].type==="stmt"&&e[n].value.split(/\s+/)[0]==="else"&&(n+=1,u=i(["endif"])),(n>=e.length||e[n].type!=="stmt"||e[n].value.split(/\s+/)[0]!=="endif")&&r(s.line,"Unterminated {% if %} — missing {% endif %}"),n+=1,o.push({alternate:u,condition:c,consequent:m,line:s.line,type:"if"});continue}if(l==="for"){n+=1;const c=s.value.slice(3).trim(),m=c.indexOf(" in ");m===-1&&r(s.line,"Malformed {% for %} — expected `for <name> in <collection>`");const u=c.slice(0,m).trim(),g=c.slice(m+4).trim();(!u||!g)&&r(s.line,"Malformed {% for %} — missing binding or collection");const p=i(["endfor"]);(n>=e.length||e[n].type!=="stmt"||e[n].value.split(/\s+/)[0]!=="endfor")&&r(s.line,"Unterminated {% for %} — missing {% endfor %}"),n+=1,o.push({binding:u,body:p,collection:g,line:s.line,type:"for"});continue}if(l==="include"){n+=1;const c=s.value.slice(7).trim(),m=H(c);m===void 0&&r(s.line,"Malformed {% include %} — expected a quoted partial name"),o.push({line:s.line,name:m,type:"include"});continue}r(s.line,`Unknown tag "{% ${l} %}". Supported: if, for, include.`)}return o},"parseBlock");return i([])},"parse"),H=f(e=>{if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return e.slice(1,-1)},"stripQuotes"),pt=f(e=>e==null?"":typeof e=="boolean"||typeof e=="number"?String(e):typeof e=="string"?e:JSON.stringify(e),"stringify"),mt=f(e=>e==null||e===!1||e===0||e===""?!1:Array.isArray(e)?e.length>0:!0,"isTruthy"),X=f((e,t,n,r,i=!0)=>{const a=e.split(".");if(i&&a.length>0&&!Object.hasOwn(t,a[0]))throw new Error(`${r}:${n}: Variable "${e}" is not defined`);let o=t;for(const s of a){if(o==null)return;if(typeof o!="object")throw new TypeError(`${r}:${n}: Cannot read "${s}" on non-object value`);o=o[s]}return o},"lookupVariable"),dt=f(e=>{const t=[];let n=0,r=0,i;for(let a=0;a<e.length;a+=1){const o=e[a];if(i){o===i&&(i=void 0);continue}if(o==='"'||o==="'"){i=o;continue}o==="("?n+=1:o===")"?n-=1:o==="|"&&n===0&&(t.push(e.slice(r,a)),r=a+1)}return t.push(e.slice(r)),t},"splitFilterPipe"),ht=f(e=>{const t=e.trim(),n=t.indexOf("(");if(n===-1)return{args:[],name:t};if(!t.endsWith(")"))throw new Error(`Filter call "${e}" missing closing ")"`);const r=t.slice(0,n).trim(),i=t.slice(n+1,-1).trim();return i?{args:D(i).map(a=>a.trim()),name:r}:{args:[],name:r}},"parseFilterCall"),k=f((e,t,n,r,i=!0)=>{const a=e.trim();if(a==="true")return!0;if(a==="false")return!1;if(a==="null"||a==="none")return null;const o=H(a);return o!==void 0?o:/^-?\d+(?:\.\d+)?$/.test(a)?Number(a):X(a,t,n,r,i)},"evaluatePrimary"),Z=f((e,t,n,r,i=!0)=>{const a=dt(e),o=a[0].trim();let s=k(o,t,n,r,i);for(let l=1;l<a.length;l+=1){const c=a[l].trim(),{args:m,name:u}=ht(c),g=m.map(p=>k(p,t,n,r,i));try{s=V(u,s,g)}catch(p){const $=p instanceof Error?p.message:String(p);throw new Error(`${r}:${n}: ${$}`,{cause:p})}}return s},"evaluateExpression"),ee=f((e,t)=>{let n,r=0;for(let i=0;i<=e.length-t.length;i+=1){const a=e[i];if(n){a===n&&(n=void 0);continue}if(a==='"'||a==="'"){n=a;continue}if(a==="("){r+=1;continue}if(a===")"){r-=1;continue}if(r===0&&e.slice(i,i+t.length)===t)return i}return-1},"findOperatorOutsideQuotes"),N=f((e,t)=>{const n=[];let r=0,i=0;for(;i<=e.length-t.length;){const a=ee(e.slice(i),t);if(a===-1)break;n.push(e.slice(r,i+a)),i+=a+t.length,r=i}return n.push(e.slice(r)),n},"splitLogical"),j=f((e,t,n,r)=>{const i=e.trim();if(i==="")return!1;if(i.startsWith("(")&&i.endsWith(")")&&yt(i)===i.length-1)return j(i.slice(1,-1),t,n,r);const a=N(i," or ");if(a.length>1)return a.some(s=>j(s,t,n,r));const o=N(i," and ");if(o.length>1)return o.every(s=>j(s,t,n,r));if(i.startsWith("not "))return!j(i.slice(4),t,n,r);for(const s of["==","!="]){const l=ee(i,s);if(l!==-1){const c=k(i.slice(0,l),t,r,n,!1),m=k(i.slice(l+s.length),t,r,n,!1),u=c===m;return s==="=="?u:!u}}return mt(Z(i,t,r,n,!1))},"evaluateConditionExpression"),yt=f(e=>{if(e[0]!=="(")return-1;let t=0,n,r=-1;for(const i of e){if(r+=1,n){i===n&&(n=void 0);continue}if(i==='"'||i==="'"){n=i;continue}if(i==="(")t+=1;else if(i===")"&&(t-=1,t===0))return r}return-1},"matchingParen"),O=f((e,t)=>{let n="";for(const r of e){if(r.type==="text"){n+=r.value;continue}if(r.type==="expr"){n+=pt(Z(r.expression,t.scope,r.line,t.filename));continue}if(r.type==="if"){const i=j(r.condition,t.scope,t.filename,r.line)?r.consequent:r.alternate??[];n+=O(i,t);continue}if(r.type==="for"){const i=X(r.collection,t.scope,r.line,t.filename,!1);if(i==null)continue;if(!Array.isArray(i))throw new TypeError(`${t.filename}:${r.line}: {% for %} expected an array, got ${typeof i}`);for(const a of i){const o={...t.scope,[r.binding]:a};n+=O(r.body,{...t,scope:o})}continue}if(r.type==="include"){const i=t.partials?.get(r.name);if(!i)throw new Error(`${t.filename}:${r.line}: Partial "${r.name}" not found. Available: ${[...t.partials?.keys()??[]].join(", ")||"(none)"}`);const a=t.includeStack??new Set;if(a.has(r.name)){const o=[...a,r.name].join(" → ");throw new Error(`${t.filename}:${r.line}: Circular partial include detected: ${o}`)}a.add(r.name);try{n+=O(i,{...t,filename:`<partial:${r.name}>`,includeStack:a})}finally{a.delete(r.name)}}}return n},"renderNodes"),bt=f((e,t)=>Y(K(e),t),"parseTemplate");f((e,t)=>O(e,t),"renderAst");const C=f((e,t)=>O(Y(K(e),t.filename),t),"renderTemplate");var gt=Object.defineProperty,b=h((e,t)=>gt(e,"name",{value:t,configurable:!0}),"s");const R="template.yml",vt=".raw",$t=new Set([".cjs",".css",".env",".gitattributes",".gitignore",".graphql",".html",".ini",".js",".json",".json5",".jsonc",".jsx",".lock",".md",".mdx",".mjs",".prettierrc",".raw",".rs",".scss",".sh",".sql",".svg",".tera",".toml",".ts",".tsx",".twig",".txt",".vue",".xml",".yaml",".yml"]),wt=new Set(["Brewfile","CHANGELOG","CODEOWNERS","CONTRIBUTING","COPYING","Dockerfile","Gemfile","LICENCE","LICENSE","Makefile","NOTICE","Procfile","Rakefile","README","VERSION"]),jt=b(e=>{const t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\")),n=t===-1?e:e.slice(t+1),r=n.lastIndexOf(".");return r===-1||r===0?"":n.slice(r).toLowerCase()},"lastDot"),te=b(e=>{const t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t===-1?e:e.slice(t+1)},"basename"),Ot=b(e=>{const t=jt(e);if(t!=="")return $t.has(t);const n=te(e);return wt.has(n)},"isLikelyText"),Et=b(e=>{const t={default:e.default,internal:e.internal,order:e.order,prompt:e.prompt,required:e.required};switch(e.type){case"array":return{...t,type:"array"};case"boolean":return{...t,default:typeof t.default=="boolean"?t.default:void 0,type:"boolean"};case"enum":return{...t,multiple:e.multiple,type:"enum",values:e.values??[]};case"number":return{...t,type:"number"};case"string":return{...t,type:"string"};default:throw new Error(`Unsupported variable type "${String(e.type)}"`)}},"yamlVariableToVariable"),xt=b(e=>e.replaceAll("\\","/").replace(/^\.\//,"").replaceAll(/\/+/g,"/"),"normalizeDestinationPath"),At=b((e,t,n)=>{const r=t.split("/").filter(Boolean);if(r.length===0)throw new Error("Empty destination path for value");let i=e;for(let a=0;a<r.length-1;a+=1){const o=r[a],s=i[o];if(s===void 0){const l={};i[o]=l,i=l}else if(typeof s=="object"&&!Buffer.isBuffer(s))i=s;else throw new TypeError(`Path conflict: "${r.slice(0,a+1).join("/")}" is both a file and a directory`)}i[r.at(-1)]=n},"flattenFiles"),I=b((e,t,n)=>{if(typeof e!="string")return kt(e);const r=e.includes("{{")||e.includes("{%")?C(e,{filename:`${n}#frontmatter`,scope:t}):e;return j(r,t,`${n}#frontmatter`,1)},"evaluateGate"),kt=b(e=>e==null||e===!1||e===0||e===""?!1:Array.isArray(e)?e.length>0:typeof e=="string"?e!=="false"&&e!=="0":!0,"truthyValue"),Wt=b((e,t)=>{const n=G(e,R),r=oe(n);if(!r||typeof r!="object")throw new Error(`${n}: must contain a YAML mapping`);const i={};if(r.variables)for(const[l,c]of Object.entries(r.variables))i[l]=Et(c);const a=new Map,o=[];for(const l of se(e,{includeDirs:!1,includeSymlinks:!1})){if(l.path===n)continue;const c=Q(e,l.path).replaceAll("\\","/");if(c===R)continue;if(at(c)){const u=A(l.path),g=bt(u,c);for(const p of Pt(c))a.has(p)&&a.get(p)!==g&&le.warn(`partial name "${p}" is declared by multiple files — last one wins. Use distinct names or fully-qualified includes.`),a.set(p,g);continue}if(c.endsWith(vt)){const u=A(l.path);o.push({binary:null,isRaw:!0,rawText:u,relativePath:c});continue}if(Ot(c)){const u=A(l.path);o.push({binary:null,isRaw:!1,rawText:u,relativePath:c});continue}const m=A(l.path,{buffer:!0});o.push({binary:m,isRaw:!1,rawText:null,relativePath:c})}const s=b(l=>{const c={...l.builtins,...l.options},m={},u={};for(const p of o){const $=p.relativePath;let x,L,M=!1;if(p.binary)x=p.binary;else if(p.isRaw)x=p.rawText??"";else{const re=p.rawText??"",v=lt(re,ne=>ce(ne));if(v.frontmatter){if(v.frontmatter.skip!==void 0&&I(v.frontmatter.skip,c,$)||v.frontmatter.if!==void 0&&!I(v.frontmatter.if,c,$))continue;typeof v.frontmatter.to=="string"&&(L=C(v.frontmatter.to,{filename:`${$}#frontmatter.to`,partials:a,scope:c})),v.frontmatter.force===!0&&(M=!0)}x=C(v.body,{filename:$,partials:a,scope:c})}const F=xt(L??nt(it($),c));At(m,F,x),M&&(u[F]={force:!0})}const g={files:m};return Object.keys(u).length>0&&(g.filesMeta=u),g},"produce");return{about:{description:r.description??`Moon-format template at ${e}`,name:r.title??t},destination:r.destination,options:i,produce:s}},"loadMoonTemplate"),Pt=b(e=>{const t=J(e),n=te(t),r=new Set([n,t]);if(n.startsWith("_")){r.add(n.replace(/^_+/,""));const i=t.slice(0,t.length-n.length);r.add(`${i}${n.replace(/^_+/,"")}`)}return[...r]},"partialKeys");export{Wt as loadMoonTemplate};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var i=Object.defineProperty;var a=(r,e)=>i(r,"name",{value:e,configurable:!0});import{p as s}from"./bin.js";import{c as o,f as c}from"../packem_shared/registry-keys-CewRFW0e.js";var n=Object.defineProperty,f=a((r,e)=>n(r,"name",{value:e,configurable:!0}),"n");const g=f(async({options:r})=>{if(r.clear){const t=o();if(r.json){process.stdout.write(`${JSON.stringify({cleared:t,refetched:!1},void 0,2)}
|
|
2
|
+
`);return}s.success(t?"Cleared cached npm signing keys.":"No cached npm signing keys to clear.");return}const e=await c({forceRefresh:!0});if(e===void 0){if(r.json){process.stdout.write(`${JSON.stringify({cleared:!1,error:"fetch-failed",refetched:!1},void 0,2)}
|
|
3
|
+
`),process.exitCode=1;return}s.error("Failed to fetch npm signing keys (network error and no cached keys available)."),process.exitCode=1;return}if(r.json){process.stdout.write(`${JSON.stringify({cleared:!1,fromCache:e.fromCache,keyCount:e.keys.length,refetched:!e.fromCache,stale:e.stale??!1},void 0,2)}
|
|
4
|
+
`);return}if(e.fromCache&&e.stale===!0){s.warn(`Network fetch failed — falling back to expired cache (${String(e.keys.length)} keys).`);return}s.success(`Refreshed npm signing keys (${String(e.keys.length)} keys).`)},"execute");export{g as default};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var x=Object.defineProperty;var k=(t,s)=>x(t,"name",{value:s,configurable:!0});import{createRequire as B}from"node:module";import{A as P,ak as R,p as o,al as V}from"./bin.js";import{x as C}from"../packem_shared/build-scripts-DsWMSWDs.js";import{M as y,i as w,n as q}from"./config.js";const D=B(import.meta.url),v=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,M=k(t=>{if(typeof v<"u"&&v.versions&&v.versions.node){const[s,f]=v.versions.node.split(".").map(Number);if(s>22||s===22&&f>=3||s===20&&f>=16)return v.getBuiltinModule(t)}return D(t)},"__cjs_getBuiltinModule"),{readdirSync:j,statSync:O}=M("node:fs");var A=Object.defineProperty,_=k((t,s)=>A(t,"name",{value:s,configurable:!0}),"p$1");const N=_((t,s={})=>{const f=y(t,"node_modules");if(!w(f))return[];const l=new Map,p=new Set,b=_((n,i,a)=>{const e=`${i}@${a}`;if(p.has(e))return;p.add(e);const r=a.startsWith(t)?a.slice(t.length+1):a;let u=l.get(n);u||(u=[],l.set(n,u)),u.some($=>$.name===i)||u.push({name:i,relativePath:r})},"recordBin"),m=_((n,i="")=>{let a;try{a=j(n)}catch{return}for(const e of a){const r=y(n,e);if(e.startsWith("@")){m(r,`${e}/`);continue}if(e===".pnpm"&&i===""){let c;try{c=j(r)}catch{continue}for(const d of c){const h=y(r,d,"node_modules");w(h)&&m(h)}continue}if(e.startsWith("."))continue;const u=i+e,$=y(r,"package.json");try{if(!O(r).isDirectory()||!w($))continue;const c=q($),d=typeof c.name=="string"?c.name:u;if(typeof c.bin=="string"){const S=d.includes("/")?d.split("/").pop():d;b(S,d,r)}else if(c.bin&&typeof c.bin=="object")for(const S of Object.keys(c.bin))b(S,d,r);const h=y(r,"node_modules");w(h)&&m(h)}catch{}}},"scanDir");m(f);const g=[];for(const[n,i]of l)i.length<2||s[n]===!0||i.every(a=>s[`${a.name}#${n}`]===!0)||g.push({bin:n,packages:i});return g.sort((n,i)=>n.bin.localeCompare(i.bin))},"collectBinShadows");var T=Object.defineProperty,W=k((t,s)=>T(t,"name",{value:s,configurable:!0}),"p");const U=new Set(["bun","npm","pnpm","yarn"]),H=W(({options:t,visConfig:s,workspaceRoot:f})=>{const l=f??process.cwd(),p=P(l),b=s?.security?.policies?.installScripts?.allow??{},m=s?.security?.allowBins??{},g=s?.security?.pinVersions===!0,n=C(l,b,{pinVersions:g}),i=N(l,m),a=s&&U.has(p.name)?R(s,p.name,l):void 0;if(t.json){process.stdout.write(`${JSON.stringify({binConflicts:i,drift:a,excess:n.excess,installed:n.installed.map(e=>({hooks:e.hooks,name:e.name,version:e.version})),packageManager:p.name,pinVersions:g,unapproved:n.unapproved.map(e=>({hooks:e.hooks,name:e.name,version:e.version})),versionDrift:n.versionDrift},void 0,2)}
|
|
2
|
+
`);return}if(o.info(`Build-script status (${p.name}):
|
|
3
|
+
`),n.installed.length===0&&n.unapproved.length===0&&o.success(" No installed packages declare lifecycle scripts."),n.installed.length>0){o.success(` Approved (${String(n.installed.length)}):`);for(const e of n.installed)o.info(` ✓ ${e.name} — ${e.hooks.join(", ")}`)}if(n.unapproved.length>0){o.info(""),o.warn(` Unapproved (${String(n.unapproved.length)}):`);for(const e of n.unapproved)o.info(` ✗ ${e.name} — ${e.hooks.join(", ")}`);o.notice(" Run 'vis approve-builds' to review.")}if(n.excess.length>0){o.info(""),o.warn(` Stale allowlist entries (${String(n.excess.length)}):`);for(const e of n.excess)o.info(` ! ${e}`);o.notice(" Remove these from vis.config.ts security.policies.installScripts.allow.")}if(n.versionDrift.length>0){o.info(""),o.warn(` Version drift (pinVersions: true) — ${String(n.versionDrift.length)} entr${n.versionDrift.length===1?"y":"ies"} point at outdated versions:`);for(const{from:e,to:r}of n.versionDrift)o.info(` ${e} → ${r}`);o.notice(" Update vis.config.ts security.policies.installScripts.allow keys to migrate.")}if(i.length>0){o.info(""),o.warn(` Bin conflicts (${String(i.length)}) — multiple packages expose the same bin name:`);for(const e of i)o.info(` ${e.bin} ← ${e.packages.map(r=>r.name).join(", ")}`);o.notice(" Add the bin (or 'pkg#bin') to vis.config.ts security.allowBins to silence this.")}if(a?.hasDrift){o.info("");for(const e of V(a))o.warn(e)}},"execute");export{H as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var u=Object.defineProperty;var o=(t,e)=>u(t,"name",{value:e,configurable:!0});import{
|
|
1
|
+
var u=Object.defineProperty;var o=(t,e)=>u(t,"name",{value:e,configurable:!0});import{g as n}from"./config.js";import{createJiti as l}from"jiti";var p=Object.defineProperty,a=o((t,e)=>p(t,"name",{value:e,configurable:!0}),"r");const i=a((t,e)=>{if(!e||typeof e!="object")throw new TypeError(`${t}: default export must be an object (got ${e===null?"null":typeof e}). Use createTemplate({ ... }).`);const r=e;if(typeof r.about!="object"||r.about===null)throw new TypeError(`${t}: default export missing required "about" object`);if(typeof r.produce!="function")throw new TypeError(`${t}: default export missing required "produce" function`);return e},"validateTemplateExport"),m=a(async t=>{const e=await l(n(t),{fsCache:!1,moduleCache:!1}).import(t,{default:!0,try:!0})??null;return i(t,e)},"loadNativeTemplate");export{m as loadNativeTemplate};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var f=Object.defineProperty;var i=(o,e)=>f(o,"name",{value:e,configurable:!0});import{createRequire as p}from"node:module";import{p as n}from"./bin.js";import{r as h}from"../packem_shared/advisories-DsynpacV.js";const l=p(import.meta.url),t=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,m=i(o=>{if(typeof t<"u"&&t.versions&&t.versions.node){const[e,s]=t.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return t.getBuiltinModule(o)}return l(o)},"__cjs_getBuiltinModule"),{rm:v}=m("node:fs/promises");var _=Object.defineProperty,g=i((o,e)=>_(o,"name",{value:e,configurable:!0}),"c");const w=g(async({logger:o,options:e,workspaceRoot:s})=>{if(!s)throw new Error("Could not determine workspace root. Run this command inside a workspace.");const r=e.db??h(s),c=e.format==="json";if(!e.force){n.warn(`Prune is destructive. Will remove: ${r}`),n.info("Re-run with --force to proceed."),c&&process.stdout.write(`${JSON.stringify({dbPath:r,reason:"needs --force",removed:!1})}
|
|
2
|
+
`);return}const d=[r,`${r}-wal`,`${r}-shm`,`${r}-journal`],a=[];for(const u of d)try{await v(u,{force:!0}),a.push(u)}catch{}if(c){process.stdout.write(`${JSON.stringify({dbPath:r,files:a,removed:!0})}
|
|
3
|
+
`);return}n.success(`Removed ${r}.`)},"execute"),$=w;export{$ as advisoriesPruneExecute};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var l=Object.defineProperty;var a=(t,o)=>l(t,"name",{value:o,configurable:!0});import{p as c,Z as p,a0 as u}from"./bin.js";var w=Object.defineProperty,f=a((t,o)=>w(t,"name",{value:o,configurable:!0}),"c");const m=f(({options:t,visConfig:o,workspaceRoot:s})=>{const i=s??process.cwd(),n=o?.security?.policies?.installScripts?.allow??{},r=Object.entries(n).filter(([,e])=>e).map(([e])=>e);r.length===0&&!t.rootOnly&&(c.warn("No approved packages in security.policies.installScripts.allow — nothing to run."),!t.withRoot)||(t.rootOnly||p(i,r),(t.withRoot||t.rootOnly)&&u(i))},"execute");export{m as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var l=Object.defineProperty;var c=(s,e)=>l(s,"name",{value:e,configurable:!0});import{p as r,e as v,E as f,I as g}from"./bin.js";import{r as p,g as h}from"../packem_shared/advisories-DsynpacV.js";var $=Object.defineProperty,i=c((s,e)=>$(s,"name",{value:e,configurable:!0}),"a");const B=i(s=>{if(s===0)return"0 B";const e=["B","KB","MB","GB"],a=Math.min(Math.floor(Math.log(s)/Math.log(1024)),e.length-1),o=s/1024**a;return`${o.toFixed(o<10&&a>0?1:0)} ${e[a]}`},"formatBytes"),w=i(s=>{if(!s)return"never";const e=Date.parse(s);if(Number.isNaN(e))return s;const a=Date.now()-e;if(a<0)return s;const o=Math.floor(a/6e4);if(o<1)return"just now";if(o<60)return`${o}m ago`;const t=Math.floor(o/60);return t<24?`${t}h ago`:`${Math.floor(t/24)}d ago`},"formatRelative"),S=i(async({logger:s,options:e,workspaceRoot:a})=>{if(!a)throw new Error("Could not determine workspace root. Run this command inside a workspace.");const o=e.db??p(a),t=await h(a,o);if(e.format==="json"){process.stdout.write(`${JSON.stringify({dbPath:o,ecosystems:t.ecosystems.map(n=>({advisoryCount:n.advisoryCount,lastSyncIso:n.lastSyncIso,manifestEtag:n.manifestEtag??null,name:n.name})),exists:t.exists,schemaVersion:t.schemaVersion,sizeBytes:t.sizeBytes},void 0,2)}
|
|
2
|
+
`);return}if(r.info(`DB: ${o}`),!t.exists){r.warn(`No advisory DB yet. Run ${v("vis advisories sync")} to populate.`);return}if(r.info(`Schema: v${t.schemaVersion} Size: ${B(t.sizeBytes)}`),t.ecosystems.length===0){r.warn("DB exists but contains no ecosystems. Run `vis advisories sync`.");return}r.info(""),r.info("Ecosystem Advisories Last sync ETag"),r.info(f("────────── ────────── ───────────────── ──────"));for(const n of t.ecosystems){const m=n.name.padEnd(10),u=n.advisoryCount.toLocaleString().padStart(10),d=`${n.lastSyncIso||"never"} (${w(n.lastSyncIso)})`.padEnd(19),y=n.manifestEtag??f("—");r.info(`${g(m)} ${u} ${d} ${y}`)}},"execute"),b=S;export{b as advisoriesStatusExecute};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var w=Object.defineProperty;var y=(e,o)=>w(e,"name",{value:o,configurable:!0});import{p as l,E as $}from"./bin.js";import{s as D}from"../packem_shared/scan-progress-CMynp3eA.js";import{s as b,D as S}from"../packem_shared/advisories-DsynpacV.js";var E=Object.defineProperty,c=y((e,o)=>E(e,"name",{value:o,configurable:!0}),"c");const P=c(e=>e?.security?.audit?.advisories??{},"readAdvisoriesConfig"),k=c(e=>e?e.split(",").map(o=>o.trim()).filter(o=>o.length>0):["npm"],"parseEcosystems"),x=c(async({logger:e,options:o,visConfig:g,workspaceRoot:d})=>{if(!d)throw new Error("Could not determine workspace root. Run this command inside a workspace.");const u=o.format==="json",m=P(g),f=o.source??m.source??S,p=k(o.ecosystem),v=p.map(s=>({id:s,label:`Sync ${s} advisories`})),n=D(v,{live:!u}),i=[];try{for(const s of p){n.start(s);const r=Date.now();try{const t=await b({allowedHosts:m.allowedHosts,dbPath:o.db,ecosystem:s,force:!!o.force,source:f,workspaceRoot:d});i.push({ecosystem:s,result:t}),t.upToDate?n.finish(s,"ok",`up to date · ${h(Date.now()-r)}`):n.finish(s,"ok",`${t.advisoriesIngested.toLocaleString()} advisories · ${h(t.durationMs)}`)}catch(t){const a=t instanceof Error?t.message:String(t);i.push({ecosystem:s,error:a}),n.finish(s,"error",a)}}}finally{n.stop()}if(u){const s={ecosystems:i.map(r=>({advisoriesIngested:r.result?.advisoriesIngested??0,dbPath:r.result?.dbPath??null,durationMs:r.result?.durationMs??0,ecosystem:r.ecosystem,error:r.error??null,upToDate:r.result?.upToDate??!1})),source:f};process.stdout.write(`${JSON.stringify(s,void 0,2)}
|
|
2
|
+
`)}else{const s=i.filter(a=>a.error),r=i.filter(a=>a.result),t=r[0];t?.result?.dbPath&&l.info($(`DB: ${t.result.dbPath}`)),s.length===0?l.success(`Synced ${r.length} ecosystem${r.length===1?"":"s"}.`):l.error(`${s.length} ecosystem${s.length===1?"":"s"} failed to sync.`)}i.some(s=>s.error)&&(process.exitCode=1)},"execute"),h=c(e=>e>=1e3?`${(e/1e3).toFixed(1)}s`:`${Math.round(e)}ms`,"formatDuration"),M=x;export{M as advisoriesSyncExecute};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var g=Object.defineProperty;var f=(e,n)=>g(e,"name",{value:n,configurable:!0});import{A as m,p as t}from"./bin.js";import{N as y}from"../packem_shared/native-config-sync-Dvi1g2nQ.js";import{E as v}from"../packem_shared/min-release-age-BFozFonQ.js";var h=Object.defineProperty,w=f((e,n)=>h(e,"name",{value:n,configurable:!0}),"l");const b=new Set(["bun","npm","pnpm","yarn"]),O=w(({options:e,visConfig:n,workspaceRoot:u})=>{const o=u??process.cwd(),s=m(o);if(!b.has(s.name)){t.warn(`Package manager '${s.name}' has no native security config to sync.`);return}if(!n?.security){t.warn("vis.config has no `security` block — nothing to sync.");return}const r=n.security.policies??{},a=Object.fromEntries(Object.entries(r.installScripts?.allow??{}).filter(([,c])=>c)),l=r.firstSeen?.minutes,p=r.firstSeen?.exclude??[],i=[];if(Object.keys(a).length>0&&!e.skipAllowBuilds&&i.push(...y(s.name,o,a)),e.skipMinReleaseAge||i.push(...v(s.name,o,l,p)),i.length===0){t.success("Nothing to sync — vis.config and native PM config are aligned.");return}t.info(`Syncing vis.config security settings to ${s.name} native config…
|
|
2
|
+
`);for(const c of i)t.success(` ${c}`)},"execute");export{O as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var y=Object.defineProperty;var d=(r,n)=>y(r,"name",{value:n,configurable:!0});import{createRequire as w}from"node:module";import{M as u,i as f,n as m,B as k}from"./config.js";import{p as e,A as j}from"./bin.js";const v=w(import.meta.url),c=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,h=d(r=>{if(typeof c<"u"&&c.versions&&c.versions.node){const[n,s]=c.versions.node.split(".").map(Number);if(n>22||n===22&&s>=3||n===20&&s>=16)return c.getBuiltinModule(r)}return v(r)},"__cjs_getBuiltinModule"),{spawnSync:$}=h("node:child_process");var _=Object.defineProperty,l=d((r,n)=>_(r,"name",{value:n,configurable:!0}),"c");const t="@lavamoat/preinstall-always-fail",p=l(r=>{const n=u(r,"package.json");if(!f(n))return"no-package-json";try{const s=m(n);if(s.devDependencies?.[t]||s.dependencies?.[t])return"installed"}catch{}return"missing"},"tripwireStatus"),b=l(r=>{const n=u(r,"package.json");if(!f(n))return!1;try{const s=m(n);let a=!1;const o=l(i=>!i||!(t in i)?i:(a=!0,Object.fromEntries(Object.entries(i).filter(([g])=>g!==t))),"stripFrom");return s.devDependencies=o(s.devDependencies),s.dependencies=o(s.dependencies),a&&k(n,`${JSON.stringify(s,null,2)}
|
|
2
|
+
`),a}catch{return!1}},"removeFromPackageJson"),P=l(({options:r,workspaceRoot:n})=>{const s=n??process.cwd();if(r.status){switch(p(s)){case"installed":{e.success(`Preinstall tripwire is installed (${t}).`),e.info("Removing 'ignore-scripts=true' will cause future installs to fail loudly.");break}case"missing":{e.warn("Preinstall tripwire is not installed."),e.info(`Run 'vis security tripwire' to add ${t} as a devDependency.`);break}default:e.error("No package.json found at the workspace root."),process.exitCode=1}return}if(r.remove){b(s)?e.success(`Removed ${t} from package.json. Run your PM's install to clean node_modules.`):e.info(`${t} was not present in package.json.`);return}if(p(s)==="installed"){e.info(`${t} is already installed.`);return}const a=j(s),o={bun:["add","-d",t],npm:["install","--save-dev",t],pnpm:["add","-D","-w",t],yarn:["add","-D",t]}[a.name];if(!o){e.error(`Cannot install tripwire — unsupported package manager '${a.name}'.`),process.exitCode=1;return}e.info(`Installing ${t} via ${a.name}…`);const i=$(a.name,o,{cwd:s,stdio:"inherit"});if(i.error){e.error(`Failed to install tripwire: ${i.error.message}`),process.exitCode=1;return}if(i.signal!==null){e.error(`${a.name} was terminated by signal ${i.signal}`),process.exitCode=1;return}if(i.status!==0){e.error(`${a.name} exited with code ${String(i.status)}`),process.exitCode=i.status??1;return}e.success(`Installed ${t} as a devDependency.`),e.notice(""),e.notice("How the tripwire works:"),e.notice(` ${t} declares a preinstall script that always fails.`),e.notice(" When 'ignore-scripts=true' is set (.npmrc / bunfig.toml / .yarnrc.yml),"),e.notice(" the script is skipped and installs succeed normally. If someone deletes"),e.notice(" that setting, the next install fails — loudly — instead of silently"),e.notice(" running every dependency's lifecycle scripts.")},"execute");export{P as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var I=Object.defineProperty;var d=(s,e)=>I(s,"name",{value:e,configurable:!0});import{createRequire as $}from"node:module";import{K as j}from"../packem_chunks/config.js";import{advisoriesStatus as E,NATIVE_BINDING_VERSION as A,advisoriesIngest as q,advisoriesQuery as B}from"#native";const T=$(import.meta.url),v=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,l=d(s=>{if(typeof v<"u"&&v.versions&&v.versions.node){const[e,t]=v.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return v.getBuiltinModule(s)}return T(s)},"__cjs_getBuiltinModule"),{randomUUID:O}=l("node:crypto"),{createWriteStream:P,existsSync:k}=l("node:fs"),{mkdir:U,unlink:x,stat:C}=l("node:fs/promises"),{join:w,dirname:L}=l("node:path"),{Readable:M}=l("node:stream"),{pipeline:W}=l("node:stream/promises");var F=Object.defineProperty,r=d((s,e)=>F(s,"name",{value:e,configurable:!0}),"s");const b=4;if(A!==b)throw new Error(`vis native binding ABI mismatch in advisories: expected ${b}, got ${A}. Rebuild via \`pnpm --filter @visulima/vis run build:native\` or reinstall the platform binding package.`);const es="https://osv-vulnerabilities.storage.googleapis.com",V=new Set(["osv-vulnerabilities.storage.googleapis.com"]);class H extends Error{static{d(this,"AdvisoryDbNotFoundError")}static{r(this,"AdvisoryDbNotFoundError")}cause="DB_NOT_FOUND";constructor(e){super(`No local advisory DB at ${e}. Run 'vis advisories sync' first.`),this.name="AdvisoryDbNotFoundError"}}class p extends Error{static{d(this,"AdvisorySourceNotAllowedError")}static{r(this,"AdvisorySourceNotAllowedError")}cause="SOURCE_NOT_ALLOWED";constructor(e){super(`Advisory source host '${e}' is not in the built-in allowlist. Add it to \`security.audit.advisories.allowedHosts\` if intentional.`),this.name="AdvisorySourceNotAllowedError"}}class N extends Error{static{d(this,"AdvisorySyncNetworkError")}static{r(this,"AdvisorySyncNetworkError")}cause="SYNC_NETWORK";constructor(e,t){super(`Advisory sync failed for ${e}: ${t}. Check connectivity, proxy env vars, or --source.`),this.name="AdvisorySyncNetworkError"}}const g=r(s=>{const e=j("vis",{create:!0,cwd:s})??w(s,"node_modules",".cache","vis");return w(e,"advisories","db.sqlite")},"resolveAdvisoryDbPath"),z=r((s,e)=>{let t;try{t=new URL(s)}catch{throw new p(s)}if(t.protocol!=="https:")throw new p(`${t.protocol}//${t.host}`);if(!new Set([...V,...e??[]]).has(t.host))throw new p(t.host);return t},"validateAdvisorySource"),ts=r(async s=>{const e=s.dbPath??g(s.workspaceRoot);await U(L(e),{recursive:!0});const t=z(s.source,s.allowedHosts),u=new URL(`${s.ecosystem}/all.zip`,Q(t.toString())),y=await K(e,s.ecosystem);let i=null;if(!s.force){const n=await S(u,{method:"HEAD"});if(n.ok&&(i=n.headers.get("etag"),i&&y&&i===y))return{advisoriesIngested:0,dbPath:e,durationMs:0,upToDate:!0}}const a=`${e}.${s.ecosystem}.${process.pid}.${O()}.zip.tmp`,o=await S(u,{method:"GET"});if(!o.ok||!o.body)throw new N(u.toString(),o.status);i||(i=o.headers.get("etag"));const m=o.headers.get("content-length"),c=m?Number.parseInt(m,10):null;let h=0;const _=P(a),f=M.fromWeb(o.body);s.onProgress&&c&&f.on("data",n=>{h+=n.byteLength,s.onProgress?.(h,c,"download")}),await W(f,_);try{const n=await q({dbPath:e,ecosystem:s.ecosystem,manifestEtag:i??void 0,zipPath:a},(D,R)=>s.onProgress?.(D,R,"ingest"));return{advisoriesIngested:n.advisoriesIngested,dbPath:e,durationMs:n.durationMs,upToDate:!1}}finally{await x(a).catch(()=>{})}},"syncAdvisories"),rs=r((s,e)=>{if(s.length===0)return new Map;const t=e.dbPath??g(e.workspaceRoot),u=e.ecosystem??"npm";if(!k(t))throw new H(t);const y=s.map(o=>({ecosystem:u,name:o.name,version:o.version})),i=B(t,y),a=new Map;for(const[o,m]of s.entries()){const c=i[o];!c||c.vulnerabilities.length===0||a.set(m.name,c.vulnerabilities.map(h=>G(h)))}return a},"queryAdvisories"),os=r(async(s,e)=>{const t=e??g(s);return E(t)},"getAdvisoryStatus"),K=r(async(s,e)=>{try{await C(s)}catch{return null}return E(s).ecosystems.find(t=>t.name===e)?.manifestEtag??null},"readStoredEtag"),G=r(s=>({aliases:s.aliases.length>0?s.aliases:void 0,cvssScore:s.cvssScore??void 0,fixedVersions:s.fixedVersions,id:s.id,severity:Y(s.severity),summary:s.summary}),"toSecurityVulnerability"),Y=r(s=>{const e=s.toUpperCase();return e==="CRITICAL"||e==="HIGH"||e==="MODERATE"||e==="LOW"?e:"UNKNOWN"},"normalizeSeverity"),Q=r(s=>s.endsWith("/")?s:`${s}/`,"ensureTrailingSlash"),S=r(async(s,e)=>{try{return await fetch(s,e)}catch(t){throw new N(s.toString(),t instanceof Error?t.message:String(t))}},"safeFetch");export{H as A,es as D,os as g,rs as q,g as r,ts as s};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var H=Object.defineProperty;var k=(e,r)=>H(e,"name",{value:r,configurable:!0});import{createRequire as B}from"node:module";import{renderToString as z}from"@visulima/tui";import{Box as U}from"@visulima/tui/components/box";import{Table as W}from"@visulima/tui/components/table";import{Text as y}from"@visulima/tui/components/text";import v from"react";import{k as K,T as G,R as Y,j as X}from"./ai-cache-
|
|
1
|
+
var H=Object.defineProperty;var k=(e,r)=>H(e,"name",{value:r,configurable:!0});import{createRequire as B}from"node:module";import{renderToString as z}from"@visulima/tui";import{Box as U}from"@visulima/tui/components/box";import{Table as W}from"@visulima/tui/components/table";import{Text as y}from"@visulima/tui/components/text";import v from"react";import{k as K,T as G,R as Y,j as X}from"./ai-cache-DuwHYx2O.js";const F=B(import.meta.url),w=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$=k(e=>{if(typeof w<"u"&&w.versions&&w.versions.node){const[r,a]=w.versions.node.split(".").map(Number);if(r>22||r===22&&a>=3||r===20&&a>=16)return w.getBuiltinModule(e)}return F(e)},"__cjs_getBuiltinModule"),{spawn:D,execFileSync:O}=$("node:child_process"),{existsSync:T}=$("node:fs"),{platform:J,homedir:R}=$("node:os"),{join:g}=$("node:path"),Q=/v?(\d+\.\d+\.\d+(?:-[\w.]+)?)/,Z=5e3,ee=1e4,re=3e5,te=4096,E=J()==="win32",M=["amp","claude","codex","copilot","crush","cursor","droid","gemini","kimi","opencode","qwen"];var ae=Object.defineProperty,ne=k((e,r)=>ae(e,"name",{value:r,configurable:!0}),"A$1"),ie=Object.defineProperty,m=ne((e,r)=>ie(e,"name",{value:r,configurable:!0}),"o"),oe=Object.defineProperty,se=m((e,r)=>oe(e,"name",{value:r,configurable:!0}),"a$6");const ce={alternateCommands:[],buildArgs:se((e,r,a)=>["-x",e,"--dangerously-allow-all"],"buildArgs"),command:"amp",defaultModel:"",envVariable:"AMP_PATH"};var le=Object.defineProperty,ue=m((e,r)=>le(e,"name",{value:r,configurable:!0}),"t$8");const de={alternateCommands:[],buildArgs:ue((e,r,a)=>["--dangerously-skip-permissions","--model",r,"--output-format","text","-p",e],"buildArgs"),command:"claude",defaultModel:"claude-sonnet-4-20250514",envVariable:"CLAUDE_PATH"};var me=Object.defineProperty,pe=m((e,r)=>me(e,"name",{value:r,configurable:!0}),"a$4");const ge={alternateCommands:["openai-codex"],buildArgs:pe((e,r,a)=>[e,"--approval-mode","full-auto","--quiet","--model",r,"--max-tokens",String(a)],"buildArgs"),command:"codex",defaultModel:"o3",envVariable:"CODEX_PATH"};var fe=Object.defineProperty,he=m((e,r)=>fe(e,"name",{value:r,configurable:!0}),"l");const ve={alternateCommands:[],buildArgs:he((e,r,a)=>{const t=["-p",e,"--allow-all-tools"];return r&&t.push("--model",r),t},"buildArgs"),command:"copilot",defaultModel:"",envVariable:"COPILOT_PATH"};var ye=Object.defineProperty,be=m((e,r)=>ye(e,"name",{value:r,configurable:!0}),"n$2");const ke={alternateCommands:[],buildArgs:be((e,r,a)=>{const t=["run","--yolo"];return r&&t.push("-m",r),t.push(e),t},"buildArgs"),command:"crush",defaultModel:"",envVariable:"CRUSH_PATH"};var we=Object.defineProperty,Ae=m((e,r)=>we(e,"name",{value:r,configurable:!0}),"t$5");const $e={alternateCommands:["cursor"],buildArgs:Ae((e,r,a)=>{const t=["-p","--force","--output-format","text"];return r&&t.push("--model",r),t.push(e),t},"buildArgs"),command:"agent",defaultModel:"",envVariable:"CURSOR_PATH"};var Se=Object.defineProperty,Pe=m((e,r)=>Se(e,"name",{value:r,configurable:!0}),"i");const Te={alternateCommands:[],buildArgs:Pe((e,r,a)=>{const t=[e,"--skip-permissions-unsafe","-o","text"];return r&&t.push("-m",r),t},"buildArgs"),command:"droid",defaultModel:"",envVariable:"DROID_PATH"};var Ce=Object.defineProperty,je=m((e,r)=>Ce(e,"name",{value:r,configurable:!0}),"o$1");const Oe={alternateCommands:["gemini-cli"],buildArgs:je((e,r,a)=>["--sandbox","--model",r,"--max-output-tokens",String(a),"-p",e],"buildArgs"),command:"gemini",defaultModel:"gemini-2.5-pro",envVariable:"GEMINI_PATH"};var Re=Object.defineProperty,Ee=m((e,r)=>Re(e,"name",{value:r,configurable:!0}),"o");const Me={alternateCommands:[],buildArgs:Ee((e,r,a)=>{const t=["--quiet","-p",e];return r&&t.push("-m",r),t},"buildArgs"),command:"kimi",defaultModel:"",envVariable:"KIMI_PATH"};var xe=Object.defineProperty,_e=m((e,r)=>xe(e,"name",{value:r,configurable:!0}),"r");const Ie={alternateCommands:[],buildArgs:_e((e,r,a)=>{const t=["run",e];return r&&t.push("-m",r),t},"buildArgs"),command:"opencode",defaultModel:"anthropic/claude-sonnet-4",envVariable:"OPENCODE_PATH"};var Ne=Object.defineProperty,Le=m((e,r)=>Ne(e,"name",{value:r,configurable:!0}),"n");const qe={alternateCommands:["qwen-code"],buildArgs:Le((e,r,a)=>["-p",e,"--yolo","-o","text"],"buildArgs"),command:"qwen",defaultModel:"",envVariable:"QWEN_PATH"};var Ve=Object.defineProperty,f=m((e,r)=>Ve(e,"name",{value:r,configurable:!0}),"s");const x={amp:ce,claude:de,codex:ge,copilot:ve,crush:ke,cursor:$e,droid:Te,gemini:Oe,kimi:Me,opencode:Ie,qwen:qe},C=f(e=>e.startsWith("~")?g(R(),e.slice(1)):e,"resolveHome"),He=f(e=>{try{const r=O(E?"where":"which",[e],{encoding:"utf8",stdio:["pipe","pipe","pipe"],timeout:Z}).trim().split(`
|
|
2
2
|
`)[0]?.trim();return r&&r.length>0?r:void 0}catch{return}},"whichCommand"),Be=f(e=>{const r=R();if(E){const a=process.env.APPDATA??"",t=process.env.LOCALAPPDATA??"",n=process.env.ProgramFiles??"";return[g(a,"npm",`${e}.cmd`),g(a,"npm",e),g(t,"Programs",e,`${e}.exe`),g(n,e,`${e}.exe`),g(r,".npm-global","bin",`${e}.cmd`)]}return[`/opt/homebrew/bin/${e}`,`/usr/local/bin/${e}`,g(r,".npm-global","bin",e),g(r,".local","bin",e),g(r,".cargo","bin",e)]},"getKnownPaths"),S=f(e=>{try{const r=O(e,["--version"],{encoding:"utf8",stdio:["pipe","pipe","pipe"],timeout:ee}),a=Q.exec(r);return a?a[1]:void 0}catch{return}},"detectVersion"),_=f(e=>{const r=x[e],a={available:!1,name:e},t=process.env[r.envVariable];if(t&&T(C(t))){const i=C(t);return{...a,available:!0,detectionMethod:"envvar",path:i,version:S(i)}}const n=[r.command,...r.alternateCommands];for(const i of n){const o=He(i);if(o)return{...a,available:!0,detectionMethod:"which",path:o,version:S(o)}}for(const i of n)for(const o of Be(i))if(T(o))return{...a,available:!0,detectionMethod:"known-path",path:o,version:S(o)};return a},"detectProvider"),Fe=f(()=>M.map(e=>_(e)),"detectAllProviders"),De=f(()=>Fe().filter(e=>e.available),"detectAvailableProviders"),Je=f((e,r,a={})=>{const t=x[e],n=a.model??t.defaultModel,i=a.maxTokens??te;return t.buildArgs(r,n,i)},"buildCliArgs"),ze=f(async(e,r,a={})=>{if(!e.available||!e.path)throw new Error(`AI provider "${e.name}" is not available.`);const t=Je(e.name,r,a),n=a.timeoutMs??re;return new Promise((i,o)=>{const p={env:{...process.env,FORCE_COLOR:"0",NO_COLOR:"1"},stdio:["pipe","pipe","pipe"]},s=D(e.path,t,p);s.stdin.end();let c="",d="",u=!1;const b=setTimeout(()=>{u=!0,s.kill("SIGTERM"),o(new Error(`${e.name} CLI timed out after ${String(n)}ms`))},n);s.stdout.on("data",h=>{c+=h.toString("utf8")}),s.stderr.on("data",h=>{d+=h.toString("utf8")}),s.on("close",h=>{clearTimeout(b),!u&&(h===0?i({provider:e.name,stderr:d,stdout:c}):o(new Error(`${e.name} CLI exited with code ${String(h)}: ${d||c}`)))}),s.on("error",h=>{clearTimeout(b),u||o(new Error(`Failed to spawn ${e.name} CLI: ${h.message}`))})})},"runProvider");var Ue=Object.defineProperty,I=k((e,r)=>Ue(e,"name",{value:r,configurable:!0}),"i");const We=12e4,Ke=2,Ge=1e3,Ye=I(e=>new Promise(r=>{setTimeout(r,e)}),"sleep"),N=I(async(e,r,a=Ke)=>{let t;for(let n=0;n<=a;n+=1)try{return(await ze(e,r,{timeoutMs:We})).stdout}catch(i){if(t=i instanceof Error?i:new Error(String(i)),t.message.includes("timed out"))throw t;if(n<a){const o=Ge*2**n;await Ye(o)}}throw t??new Error("AI request failed after retries")},"runWithRetry");var Xe=Object.defineProperty,l=k((e,r)=>Xe(e,"name",{value:r,configurable:!0}),"c");const Qe={amp:30,claude:80,codex:60,copilot:50,crush:35,cursor:40,droid:20,gemini:100,kimi:25,opencode:35,qwen:30},Ze=l(e=>{if(e?.provider){if(!M.includes(e.provider))return;const t=_(e.provider);return t.available?t:void 0}const r=De();if(r.length===0)return;const a={...Qe,...e?.priority};return r.toSorted((t,n)=>(a[n.name]??0)-(a[t.name]??0))[0]},"resolveProvider"),er=new Set(["defer","review","skip","update"]),rr=new Set(["critical","high","low","medium"]),tr=new Set(["high","low","medium"]),ar=50,P=30,nr=l(e=>e.map(r=>{const a=r.vulnerabilities&&r.vulnerabilities.length>0?` [VULNERABILITIES: ${r.vulnerabilities.map(n=>`${n.severity} ${n.id}`).join(", ")}]`:"";let t="";if(r.socketReport){const n=Math.round(r.socketReport.score.overall*100),i=[`score:${String(n)}%`];if(r.socketReport.alerts.length>0){const o={};for(const s of r.socketReport.alerts)o[s.severity]=(o[s.severity]??0)+1;const p=Object.entries(o).map(([s,c])=>`${String(c)} ${s}`).join(", ");i.push(`alerts: ${p}`)}i.push(`supply-chain:${String(Math.round(r.socketReport.score.supplyChain*100))}%`),i.push(`quality:${String(Math.round(r.socketReport.score.quality*100))}%`),t=` [SOCKET.DEV: ${i.join(", ")}]`}return`- ${r.packageName}: ${r.currentRange} → ${r.newRange} (${r.updateType})${a}${t}`}).join(`
|
|
3
3
|
`),"buildPackageList"),A=`Respond ONLY with valid JSON in this exact structure:
|
|
4
4
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var S=Object.defineProperty;var g=(t,e)=>S(t,"name",{value:e,configurable:!0});import{createRequire as _}from"node:module";import{X as v}from"./xxh3-DrAUNq4n.js";import{M as c,
|
|
1
|
+
var S=Object.defineProperty;var g=(t,e)=>S(t,"name",{value:e,configurable:!0});import{createRequire as _}from"node:module";import{X as v}from"./xxh3-DrAUNq4n.js";import{M as c,b as w,i as d,n as j}from"../packem_chunks/config.js";import{n as A}from"../packem_chunks/bin.js";const M=_(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,b=g(t=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[e,r]=u.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return u.getBuiltinModule(t)}return M(t)},"__cjs_getBuiltinModule"),{rmSync:f,writeFileSync:h,readdirSync:p,statSync:D}=b("node:fs");var B=Object.defineProperty,n=g((t,e)=>B(t,"name",{value:e,configurable:!0}),"r");const a=n(()=>c(A(),"ai"),"getCacheDirectory"),J=3600*1e3,N=1800*1e3,C=n(()=>{w(a())},"ensureCacheDirectory"),k=n((t,e,r)=>{const s=r.map(i=>({currentRange:i.currentRange,name:i.packageName,targetVersion:i.targetVersion})).toSorted((i,y)=>i.name.localeCompare(y.name)),o=JSON.stringify({analysisType:e,packages:s,provider:t});return v(Buffer.from(o))},"buildCacheKey"),q=n(t=>{const e=c(a(),`${t}.json`);if(d(e))try{const r=j(e);if(Date.now()-r.createdAt>r.ttlMs){f(e,{force:!0});return}return r.result}catch{f(e,{force:!0});return}},"getCachedAnalysis"),z=n((t,e,r)=>{C();const s=a(),o={createdAt:Date.now(),result:e,ttlMs:r};h(c(s,`${t}.json`),JSON.stringify(o,void 0,2),"utf8")},"setCachedAnalysis"),V=n((t,e)=>e!==void 0&&e>0?e:t==="security"?N:J,"getTtlForAnalysisType"),F=n(()=>{const t=a();if(!d(t))return{entries:0,newestEntry:void 0,oldestEntry:void 0,totalSizeBytes:0};const e=p(t).filter(i=>i.endsWith(".json"));let r=0,s,o;for(const i of e){const y=c(t,i),m=D(y);r+=m.size;const{mtimeMs:l}=m;(s===void 0||l<s)&&(s=l),(o===void 0||l>o)&&(o=l)}return{entries:e.length,newestEntry:o,oldestEntry:s,totalSizeBytes:r}},"getCacheStats"),K=n(t=>v(Buffer.from(JSON.stringify(t))),"buildHashCacheKey"),P=n(t=>{const e=c(a(),`${t}.json`);if(d(e))try{const r=j(e);if(Date.now()-r.createdAt>r.ttlMs){f(e,{force:!0});return}return r.result}catch{f(e,{force:!0});return}},"getCachedJson"),W=n((t,e,r)=>{C();const s=a(),o={createdAt:Date.now(),result:e,ttlMs:r};h(c(s,`${t}.json`),JSON.stringify(o,void 0,2),"utf8")},"setCachedJson"),x=n(()=>{const t=a();if(!d(t))return 0;const e=p(t).filter(r=>r.endsWith(".json"));for(const r of e)f(c(t,r),{force:!0});return e.length},"clearCache");export{x as B,F as J,K as M,P as N,W as O,z as R,q as T,V as j,k};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var O=Object.defineProperty;var f=(t,e)=>O(t,"name",{value:e,configurable:!0});import{createRequire as F}from"node:module";import{readLastRunSummary as T}from"@visulima/task-runner";import{a as k}from"./failure-log-
|
|
2
|
-
${a}`},"truncateHead"),U=m(async(t,e)=>e===void 0?T(t,{dataDirectory:N(t)}):j(t,e),"loadSummary"),xt=m(async(t,e,a={})=>{const o=a.terminalOutputLimit??J,[n,r]=await Promise.all([k(t,e),U(t,a.runId)]),i=r?y(r,e):void 0;if(!n&&!i)return;let s,c;if(r&&i){const d=await D(t,r.id),g=d?y(d,e):void 0;s=_(i.hashDetails,g?.hashDetails),c=d?.id}const h=n?.terminalOutput??"";return{command:n?.command??void 0,cwd:n?.cwd??void 0,dependencies:i?.dependencies??[],duration:i?.duration,exitCode:n?.exitCode??i?.exitCode,hash:i?.hash??n?.hash,hashDetails:i?.hashDetails,hashDiff:s,previousRunId:c,project:i?.target.project,runId:r?.id??n?.runId,status:n?.status??(i?G(i):void 0),target:i?.target.target,taskId:e,terminalOutput:K(h,o),terminalOutputCaptured:!!n,timestamp:n?.timestamp??i?.endTime??i?.startTime}},"aggregateFailureContext"),G=m(t=>{if(t.exitCode!==void 0&&t.exitCode!==0)return"failure";switch(t.cacheStatus){case"HIT":return"local-cache";case"REMOTE_HIT":return"remote-cache";case"SKIPPED":return"skipped";default:return t.exitCode===0?"success":void 0}},"mapCacheStatusToTaskStatus");var
|
|
1
|
+
var O=Object.defineProperty;var f=(t,e)=>O(t,"name",{value:e,configurable:!0});import{createRequire as F}from"node:module";import{readLastRunSummary as T}from"@visulima/task-runner";import{a as k}from"./failure-log-C3LEMmkq.js";import{r as j,f as y,a as D,d as _}from"./run-summary-utils-BaBGP3bo.js";import{Y as N}from"../packem_chunks/bin.js";import{O as $,C as b,M as A,z as E}from"../packem_chunks/config.js";import{w as B,b as H,r as W}from"./ai-analysis-uYuTIIXi.js";import{M as q,N as Y,O as L}from"./ai-cache-DuwHYx2O.js";const C=F(import.meta.url),l=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,I=f(t=>{if(typeof l<"u"&&l.versions&&l.versions.node){const[e,a]=l.versions.node.split(".").map(Number);if(e>22||e===22&&a>=3||e===20&&a>=16)return l.getBuiltinModule(t)}return C(t)},"__cjs_getBuiltinModule"),{readFile:M,writeFile:R}=I("node:fs/promises");var z=Object.defineProperty,m=f((t,e)=>z(t,"name",{value:e,configurable:!0}),"u");const J=32*1024,K=m((t,e)=>{if(t.length<=e)return t;const a=t.slice(-e),o=t.length-a.length;return`[…${String(o)} bytes truncated from head…]
|
|
2
|
+
${a}`},"truncateHead"),U=m(async(t,e)=>e===void 0?T(t,{dataDirectory:N(t)}):j(t,e),"loadSummary"),xt=m(async(t,e,a={})=>{const o=a.terminalOutputLimit??J,[n,r]=await Promise.all([k(t,e),U(t,a.runId)]),i=r?y(r,e):void 0;if(!n&&!i)return;let s,c;if(r&&i){const d=await D(t,r.id),g=d?y(d,e):void 0;s=_(i.hashDetails,g?.hashDetails),c=d?.id}const h=n?.terminalOutput??"";return{command:n?.command??void 0,cwd:n?.cwd??void 0,dependencies:i?.dependencies??[],duration:i?.duration,exitCode:n?.exitCode??i?.exitCode,hash:i?.hash??n?.hash,hashDetails:i?.hashDetails,hashDiff:s,previousRunId:c,project:i?.target.project,runId:r?.id??n?.runId,status:n?.status??(i?G(i):void 0),target:i?.target.target,taskId:e,terminalOutput:K(h,o),terminalOutputCaptured:!!n,timestamp:n?.timestamp??i?.endTime??i?.startTime}},"aggregateFailureContext"),G=m(t=>{if(t.exitCode!==void 0&&t.exitCode!==0)return"failure";switch(t.cacheStatus){case"HIT":return"local-cache";case"REMOTE_HIT":return"remote-cache";case"SKIPPED":return"skipped";default:return t.exitCode===0?"success":void 0}},"mapCacheStatusToTaskStatus");var V=Object.defineProperty,u=f((t,e)=>V(t,"name",{value:e,configurable:!0}),"a");const Q=3600*1e3,S=80,X=new Set(["high","low","medium"]),Z=u(()=>`You are an expert software engineer helping fix a failing build/test/lint task.
|
|
3
3
|
|
|
4
4
|
You will be given:
|
|
5
5
|
- The terminal output (stdout/stderr) from the failed task.
|
|
@@ -37,7 +37,7 @@ ${a.join(`
|
|
|
37
37
|
`)},"buildUserPrompt"),at=u(t=>`${Z()}
|
|
38
38
|
|
|
39
39
|
${et(t)}`,"buildFixPrompt"),it=u((t,e)=>{const a=Array.isArray(t.patches)?t.patches:[],o=[];for(const r of a)typeof r.file!="string"||r.file.length===0||typeof r.oldString!="string"||r.oldString.length===0||typeof r.newString=="string"&&o.push({file:r.file,newString:r.newString,oldString:r.oldString,reason:typeof r.reason=="string"&&r.reason.length>0?r.reason:void 0});const n=typeof t.cannotFix=="string"&&t.cannotFix.length>0?t.cannotFix:void 0;return{cannotFix:n,confidence:X.has(t.confidence)?t.confidence:"low",explanation:typeof t.explanation=="string"?t.explanation:"",patches:n?[]:o,provider:e}},"normalizeFixProposal"),rt=u((t,e)=>{const a=B(t);return!a||typeof a!="object"?{cannotFix:"AI response was not valid JSON.",confidence:"low",explanation:"Failed to parse AI response.",patches:[],provider:e}:it(a,e)},"parseFixResponse"),nt=u((t,e)=>q({cwd:e.cwd??null,flow:"ai-fix",hash:e.hash??null,provider:t,taskId:e.taskId,terminalOutput:e.terminalOutput,terminalOutputCaptured:e.terminalOutputCaptured}),"buildFixCacheKey"),wt=u(async(t,e,a={})=>{const o=H(a.config);if(!o){e.warn(`No AI provider available — install one of: claude, gemini, copilot, codex.
|
|
40
|
-
`);return}const n=a.cache!==!1,r=nt(o.name,t);if(n){const i=
|
|
40
|
+
`);return}const n=a.cache!==!1,r=nt(o.name,t);if(n){const i=Y(r);if(i)return e.info(`Using cached fix proposal from ${i.provider}.
|
|
41
41
|
`),i}e.info(`Generating fix proposal with ${o.name}...
|
|
42
|
-
`);try{const i=await W(o,at(t)),s=rt(i,o.name);return n&&s.patches.length>0&&!s.cannotFix&&
|
|
42
|
+
`);try{const i=await W(o,at(t)),s=rt(i,o.name);return n&&s.patches.length>0&&!s.cannotFix&&L(r,s,Q),s}catch(i){const s=i instanceof Error?i.message:String(i);e.warn(`AI fix proposal failed (${s}).
|
|
43
43
|
`);return}},"runFixAnalysis"),st=u((t,e,a)=>$(a)?b(a):b(A(e??t,a)),"resolvePatchPath"),ot=u((t,e)=>{const a=E(t,e);return a===""?!0:!a.startsWith("..")&&!$(a)},"isInsideWorkspace"),ct=u((t,e,a)=>{const o=t.indexOf(e),n=Math.max(0,o-S),r=Math.min(t.length,o+e.length+S),i=t.slice(n,r);return{previewAfter:`${t.slice(n,o)}${a}${t.slice(o+e.length,r)}`,previewBefore:i}},"buildPreview"),yt=u(async(t,e,a,o={})=>{const n=o.dryRun===!0,r=new Map,i=[];for(const s of a.patches){const c=st(t,e,s.file);if(!ot(t,c)){i.push({absolutePath:c,patch:s,status:"outside-workspace"});continue}let h=r.get(c);if(h===void 0){try{h=await M(c,"utf8")}catch(p){const w=p.code;i.push({absolutePath:c,error:w==="ENOENT"?void 0:p.message,patch:s,status:w==="ENOENT"?"missing-file":"error"});continue}r.set(c,h)}const d=h.indexOf(s.oldString);if(d===-1){i.push({absolutePath:c,patch:s,status:"no-match"});continue}if(h.indexOf(s.oldString,d+s.oldString.length)!==-1){i.push({absolutePath:c,patch:s,status:"ambiguous-match"});continue}const{previewAfter:g,previewBefore:P}=ct(h,s.oldString,s.newString),x=`${h.slice(0,d)}${s.newString}${h.slice(d+s.oldString.length)}`;if(!n)try{await R(c,x,"utf8")}catch(p){r.delete(c),i.push({absolutePath:c,error:p.message,patch:s,status:"error"});continue}r.set(c,x),i.push({absolutePath:c,patch:s,previewAfter:g,previewBefore:P,status:"applied"})}return i},"applyFixProposal");export{xt as a,wt as b,yt as c,st as r};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as e}from"node:module";import{h as l,H as _,l as d,V as p,y as u,c,a as g,j as m,G as T,e as E,r as C}from"../packem_chunks/config.js";import"jiti";import{otelPlugin as I}from"./otelPlugin-CJR2T_lk.js";import{definePlugin as j}from"./definePlugin-CWm4Dv_t.js";const n=e(import.meta.url),r=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process;export{l as CONFIG_FILES,_ as DEFAULT_MIN_RELEASE_AGE_MINUTES,d as SECURITY_DEFAULTS,p as TASK_CONFIG_FILES,u as applyDefaults,c as defineConfig,j as definePlugin,g as defineTaskConfig,m as findVisConfigFile,T as findVisTaskConfigFile,E as loadVisConfig,C as loadVisTaskConfig,I as otelPlugin};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var k=Object.defineProperty;var b=(e,t)=>k(e,"name",{value:t,configurable:!0});import{createRequire as M}from"node:module";import{M as h,i as _,n as w}from"../packem_chunks/config.js";const $=M(import.meta.url),y=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,B=b(e=>{if(typeof y<"u"&&y.versions&&y.versions.node){const[t,s]=y.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return y.getBuiltinModule(e)}return $(e)},"__cjs_getBuiltinModule"),{readdirSync:j,statSync:O}=B("node:fs");var x=Object.defineProperty,v=b((e,t)=>x(e,"name",{value:t,configurable:!0}),"g");const P=["preinstall","install","postinstall","prepare"],q=v(e=>{const t=h(e,"node_modules");if(!_(t))return[];const s=new Map,i=v((p,f="")=>{let u;try{u=j(p)}catch{return}for(const r of u){const o=h(p,r);if(r.startsWith("@")){i(o,`${r}/`);continue}if(r===".pnpm"&&f===""){let l;try{l=j(o)}catch{continue}for(const a of l){const c=h(o,a,"node_modules");_(c)&&i(c)}continue}if(r.startsWith("."))continue;const m=f+r,n=h(o,"package.json");try{if(!O(o).isDirectory()||!_(n))continue;const l=w(n),a=l.scripts??{},c=P.filter(g=>a[g]);!a.preinstall&&!a.install&&!a.postinstall&&_(h(o,"binding.gyp"))&&c.push("install (binding.gyp)"),c.length>0&&!s.has(m)&&s.set(m,{directory:o,hooks:c,name:m,version:typeof l.version=="string"?l.version:void 0});const d=h(o,"node_modules");_(d)&&i(d)}catch{}}},"scanDir");return i(t),[...s.values()]},"collectBuildScriptPackages"),W=v(e=>{const t=e.startsWith("@"),s=e.indexOf("@",t?1:0);return s===-1?{name:e}:{name:e.slice(0,s),version:e.slice(s+1)}},"splitAllowKey"),D=v((e,t,s)=>{for(const[i,p]of Object.entries(t)){if(!p)continue;if(i.endsWith("@*")){if(i.slice(0,-2)===e.name)return!0;continue}if(i.endsWith("*")){if(e.name.startsWith(i.slice(0,-1)))return!0;continue}const{name:f,version:u}=W(i);if(f===e.name&&(!s||u===void 0||e.version===u))return!0}return!1},"isPatternAllowed"),T=v((e,t,s={})=>{const i=s.pinVersions===!0,p=q(e),f=[],u=[],r=new Map(p.map(n=>[n.name,n]));for(const n of p)D(n,t,i)?u.push(n):f.push(n);const o=[],m=[];for(const[n,l]of Object.entries(t)){if(!l)continue;if(n.endsWith("@*")){const g=n.slice(0,-2);r.has(g)||o.push(n);continue}if(n.endsWith("*")){const g=n.slice(0,-1);[...r.keys()].some(S=>S.startsWith(g))||o.push(n);continue}const{name:a,version:c}=W(n),d=r.get(a);if(!d){o.push(n);continue}i&&c!==void 0&&c!=="*"&&d.version&&d.version!==c&&m.push({from:n,to:`${a}@${d.version}`})}return{excess:o,installed:u,unapproved:f,versionDrift:m}},"scanBuildScriptStatus"),K=v((e,t)=>T(e,t).unapproved.map(s=>`${s.name} (${s.hooks.join(", ")})`),"scanUnapprovedBuildScripts");export{K as O,T as x};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var h=Object.defineProperty;var l=(e,r)=>h(e,"name",{value:r,configurable:!0});import{createRequire as f}from"node:module";import{
|
|
1
|
+
var h=Object.defineProperty;var l=(e,r)=>h(e,"name",{value:r,configurable:!0});import{createRequire as f}from"node:module";import{O as p,C as a,z as m}from"../packem_chunks/config.js";import{getMainWorktreeRoot as C}from"@visulima/task-runner";import{D as u}from"../packem_chunks/bin.js";const d=f(import.meta.url),i=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,g=l(e=>{if(typeof i<"u"&&i.versions&&i.versions.node){const[r,t]=i.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return i.getBuiltinModule(e)}return d(e)},"__cjs_getBuiltinModule"),{execFileSync:_}=g("node:child_process");var v=Object.defineProperty,s=l((e,r)=>v(e,"name",{value:r,configurable:!0}),"i");const R=s((e,r,t)=>{const n=s(c=>p(c)?c:a(e,c),"normalize");if(r&&r.length>0)return n(r);if(t&&t.length>0)return n(t);const o=process.env.VIS_CACHE_DIRECTORY;return o&&o.length>0?n(o):a(e,u)},"resolveCacheDirectory"),y=s((e,r)=>r===!1?e:C(e)??e,"resolveSharedCacheRoot"),O=s((e,r,t,n)=>{const o=r??t??process.env.VIS_CACHE_DIRECTORY;if(o&&o.length>0)return R(e,r,t);const c=y(e,n);return a(c,u)},"resolveSharedCacheDirectory"),E=/[^\w.-]+/g,S=/^-+|-+$/g,D=s(e=>e.trim().replaceAll(E,"-").replaceAll(S,"").slice(0,64),"sanitizeBranchSegment"),b=s(e=>{try{const r=_("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:e,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return!r||r==="HEAD"?void 0:r}catch{return}},"detectGitBranch"),z=s((e,r,t)=>{if(t!==!0)return e;const n=b(r);if(!n)return e;const o=D(n);return o.length===0?e:a(e,"branches",o)},"applyBranchScope"),H=s((e,r)=>{const t=m(r,e);return t.length===0?!1:t!==".."&&!t.startsWith("../")&&!p(t)},"isCacheDirectoryInsideWorkspace");export{O as E,H as _,z as a};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var ge=Object.defineProperty;var A=(e,n)=>ge(e,"name",{value:n,configurable:!0});import{createRequire as ye}from"node:module";import{n as ie,M as R,$ as ve}from"../packem_chunks/config.js";import{r as $e}from"./docker-B-CIN_nj.js";import{F as Se}from"./lockfile-C5DYMHVq.js";import{aY as je}from"../packem_chunks/bin.js";const _e=ye(import.meta.url),W=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ae=A(e=>{if(typeof W<"u"&&W.versions&&W.versions.node){const[n,t]=W.versions.node.split(".").map(Number);if(n>22||n===22&&t>=3||n===20&&t>=16)return W.getBuiltinModule(e)}return _e(e)},"__cjs_getBuiltinModule"),{randomUUID:be}=ae("node:crypto"),{readdirSync:Oe}=ae("node:fs");var ke=Object.defineProperty,pe=A((e,n)=>ke(e,"name",{value:n,configurable:!0}),"r$1");const Y=pe(e=>e.replaceAll(/[^\w.~-]/g,n=>`%${(n.codePointAt(0)??0).toString(16).toUpperCase().padStart(2,"0")}`),"encodeSegment"),N=pe((e,n)=>{const t=e.toLowerCase();if(t.startsWith("@")){const o=t.indexOf("/");if(o>0){const r=t.slice(0,o),p=t.slice(o+1);return`pkg:npm/${Y(r)}/${Y(p)}@${Y(n)}`}}return`pkg:npm/${Y(t)}@${Y(n)}`},"toNpmPurl");var Le=Object.defineProperty,j=A((e,n)=>Le(e,"name",{value:n,configurable:!0}),"a$1");const m={ARRAY:"array",BOOLEAN:"boolean",DATE:"date",FUNCTION:"function",JSTOXML_OBJECT:"jstoxml-object",NULL:"null",NUMBER:"number",OBJECT:"object",STRING:"string"},Ce=[m.STRING,m.NUMBER,m.BOOLEAN],Pe='<?xml version="1.0" encoding="UTF-8"?>',se=["_selfCloseTag","_attrs"],Te=j((e="",n=0)=>e.repeat(n),"getIndentStr"),Z=j(e=>Array.isArray(e)&&m.ARRAY||typeof e===m.OBJECT&&e!==null&&e._name&&m.JSTOXML_OBJECT||e instanceof Date&&m.DATE||e===null&&m.NULL||typeof e,"getType"),le=j(e=>e.startsWith("<![CDATA["),"isCDATA"),ue=j((e="",n={},t)=>{let o=e;if(typeof e===m.STRING){if(le(e))return e;const r=new RegExp(`(${Object.keys(n).join("|")})(?!(\\w|#)*;)`,"g");o=String(e).replace(r,(p,g)=>n[g]||"")}return typeof t=="function"?t(o):o},"mapStr"),Ae=j((e={},n,t,o)=>(Array.isArray(e)?e:Object.entries(e).map(([r,p])=>({[r]:p}))).reduce((r,p)=>{const g=Object.keys(p)[0],y=p[g];if(typeof t===m.FUNCTION&&t(g,y))return r;const b=n?ue(y,n):y,$=!o&&b===!0?"":`="${b}"`;return r.push(`${g}${$}`),r},[]),"getAttributeKeyVals"),De=j((e={},n,t,o)=>{const r=Ae(e,n,t,o);return r.length===0?"":` ${r.join(" ")}`},"formatAttributes"),xe=j((e={})=>Object.keys(e).map(n=>({_name:n,_content:e[n]})),"objToArray"),Be=j(e=>Ce.includes(Z(e)),"isPrimitive"),we=j(e=>!e.match("<"),"isSimpleXML"),Me=j(({header:e,isOutputStart:n})=>e&&n?typeof e===m.BOOLEAN?Pe:e:"","getHeaderString"),re={"<":"<",">":">","&":"&",'"':"""},F=j((e={},n={})=>{const{depth:t=0,indent:o,_isFirstItem:r,_isOutputStart:p=!0,header:g,attributeReplacements:y={},attributeFilter:b,attributeExplicitTrue:$=!1,contentReplacements:X={},contentMap:E,selfCloseTags:I=!0}=n,q=typeof y=="boolean"&&!y?{}:{...re,...y},H=typeof X=="boolean"&&!X?{}:{...re,...X},B=typeof o=="string",L=Te(o,t),V=Z(e),U=Me({header:g,indent:o,depth:t,isOutputStart:p}),w=p&&!U&&r&&t===0,M=B&&!w?`
|
|
2
|
+
`:"";let v="";switch(V){case m.JSTOXML_OBJECT:{const{_name:f,_content:l}=e;if(l===null&&typeof E!="function"){v=`${M}${L}${f}`;break}if(Array.isArray(l)&&l.every(Be))return l.map(k=>F({_name:f,_content:k},{...n,depth:t,_isOutputStart:!1})).join("");if(se.includes(f))break;const _=F(l,{...n,depth:t+1,_isOutputStart:w}),D=Z(_),O=we(_),S=le(_),x=`${M}${L}`;if(f==="_comment"){v+=`${x}<!-- ${l} -->`;break}const K=D==="undefined"||_==="",c=I,s=e._selfCloseTag,i=typeof s===m.BOOLEAN?K&&s:K&&c,a=i?"/":"",u=De(e._attrs,q,b,$),d=`<${f}${u}${a}>`,C=B&&!O&&!S?`
|
|
3
|
+
${L}`:"",P=i?"":`${_}${C}</${f}>`;v+=`${x}${d}${P}`;break}case m.OBJECT:{const f=Object.keys(e);v=f.map((l,_)=>{const D={...n,_isFirstItem:_===0,_isLastItem:_+1===f.length,_isOutputStart:w},O={_name:l};if(Z(e[l])===m.OBJECT&&(se.forEach(S=>{const x=e[l][S];typeof x<"u"&&(O[S]=x,delete e[l][S])}),typeof e[l]._content<"u"&&Object.keys(e[l]).length>1)){const S=Object.assign({},e[l]);delete S._content,O._content=[...xe(S),e[l]._content]}return typeof O._content>"u"&&(O._content=e[l]),F(O,D)},n).join("");break}case m.FUNCTION:{const f=e(n);v=F(f,n);break}case m.ARRAY:{v=e.map((f,l)=>{const _={...n,_isFirstItem:l===0,_isLastItem:l+1===e.length,_isOutputStart:w};return F(f,_)}).join("");break}default:{v=ue(e,H,E);break}}return`${U}${v}`},"toXML");var Ne=Object.defineProperty,J=A((e,n)=>Ne(e,"name",{value:n,configurable:!0}),"r");const te=J(e=>{try{return ie(e)}catch{return}},"readJsonSafe"),Re=J(e=>{if(e.length===0||e.includes("..")||e.startsWith(".")||e.includes("\0")||e.includes("\\"))return!1;if(e.startsWith("@")){const n=e.indexOf("/");return n>1&&!e.includes("/",n+1)}return!e.includes("/")},"isSafePackageName"),Ee=J(e=>e.length>0&&!e.includes("/")&&!e.includes("\\")&&!e.includes("..")&&!e.includes("\0"),"isSafeVersion"),Ie=J((e,n,t)=>{const o=`${n.replaceAll("/","+")}@${t}`,r=R(e,"node_modules",".pnpm"),p=te(R(r,o,"node_modules",n,"package.json"));if(p)return p;let g;try{g=Oe(r)}catch{return}const y=`${o}_`;for(const b of g){if(!b.startsWith(y))continue;const $=te(R(r,b,"node_modules",n,"package.json"));if($)return $}},"readPnpmVirtualStore"),Ue=J((e,n,t)=>{const o=te(R(e,"node_modules",n,"package.json"));return o?.version===t?o:void 0},"readHoistedCopy"),Ge=J((e,n,t)=>{if(!(!Re(n)||!Ee(t)))return Ie(e,n,t)??Ue(e,n,t)},"readInstalledPackageMetadata");var Fe=Object.defineProperty,me=A((e,n)=>Fe(e,"name",{value:n,configurable:!0}),"i");const fe=new Set(["0BSD","AGPL-3.0","AGPL-3.0-only","AGPL-3.0-or-later","Apache-1.1","Apache-2.0","Artistic-2.0","BlueOak-1.0.0","BSD-2-Clause","BSD-3-Clause","BSL-1.0","CC0-1.0","CC-BY-3.0","CC-BY-4.0","CDDL-1.0","CDDL-1.1","EPL-1.0","EPL-2.0","GPL-2.0","GPL-2.0-only","GPL-2.0-or-later","GPL-3.0","GPL-3.0-only","GPL-3.0-or-later","ISC","LGPL-2.0","LGPL-2.1","LGPL-3.0","MIT","MIT-0","MPL-1.1","MPL-2.0","Python-2.0","Unlicense","WTFPL","Zlib"]),Je={apache2:"Apache-2.0","apache 2.0":"Apache-2.0",bsd:"BSD-3-Clause","bsd-2":"BSD-2-Clause","bsd-3":"BSD-3-Clause",mit:"MIT",public:"Unlicense","public domain":"Unlicense"},Xe=(()=>{const e=new Map;for(const n of fe)e.set(n.toLowerCase(),n);for(const[n,t]of Object.entries(Je))e.set(n,t);return e})(),qe=me(e=>{const n=e.trim();if(n.length!==0)return fe.has(n)?n:Xe.get(n.toLowerCase())},"normalizeSpdxId"),ze=me(e=>{let n;if(typeof e.license=="string")n=e.license;else if(e.license&&typeof e.license=="object"&&typeof e.license.type=="string")n=e.license.type;else if(Array.isArray(e.licenses)&&e.licenses.length>0){const r=e.licenses[0];r&&typeof r.type=="string"&&(n=r.type)}if(!n)return;const t=n.trim();if(t.length===0)return;if(/[()]|\b(?:and|or|with)\b/i.test(t))return[{expression:t}];const o=qe(t);return o?[{license:{id:o}}]:[{license:{name:t}}]},"extractLicenseChoice");var We=Object.defineProperty,de=A((e,n)=>We(e,"name",{value:n,configurable:!0}),"t");const Ye={sha256:"SHA-256",sha384:"SHA-384",sha512:"SHA-512"},He={sha256:64,sha384:96,sha512:128},Ve=de(e=>{const n={name:e.name,version:e.version},{integrity:t}=e;return t&&t.hex.length===He[t.algorithm]&&(n.hash={alg:Ye[t.algorithm],content:t.hex}),e.dependencies&&(n.dependencies=e.dependencies),e.peerDependencies&&(n.peerDependencies=e.peerDependencies),e.optionalDependencies&&(n.optionalDependencies=e.optionalDependencies),n},"toResolvedPackage"),Ke=[{file:"pnpm-lock.yaml",type:"pnpm"},{file:"package-lock.json",type:"npm"},{file:"yarn.lock",type:"yarn"},{file:"bun.lock",type:"bun"}],Ze=de(e=>{for(const{file:n,type:t}of Ke){let o;try{o=ve(R(e,n))}catch{continue}const r=new Map;for(const p of Se(o,t))r.set(`${p.name}@${p.version}`,Ve(p));return{packages:r,type:t}}},"readLockfilePackages");var Qe=Object.defineProperty,he=A((e,n)=>Qe(e,"name",{value:n,configurable:!0}),"s");const en=he(e=>{const n=e.indexOf(":");return n<=0?e:e.slice(0,n)==="npm"?e.slice(n+1):e},"stripProtocolPrefix"),ee=he((e,n,t)=>{const o=t.get(e);if(!o||o.size===0)return;if(o.has(n))return n;const r=en(n);if(r!==n&&o.has(r))return r;const p=[...o];return je.maxSatisfying(p,r,{includePrerelease:!0})||p[0]},"resolveSpecifier");var nn=Object.defineProperty,h=A((e,n)=>nn(e,"name",{value:n,configurable:!0}),"p");const tn="1.7",on="CycloneDX",sn="http://cyclonedx.org/schema/bom-1.7.schema.json",rn="@visulima/vis",ce=h(e=>{try{return ie(e)}catch{return}},"readPackageJson"),cn=h(e=>{if(e){if(typeof e=="string")return e;if(typeof e=="object"&&e.name)return e.email?`${e.name} <${e.email}>`:e.name}},"toAuthorString"),an=h(e=>{if(e)return typeof e=="string"?e:e.url},"toRepositoryUrl"),pn=h(e=>{if(e)return typeof e=="string"?e:e.url},"toBugsUrl"),ln=h(e=>{const n=[];e.homepage&&n.push({type:"website",url:e.homepage});const t=an(e.repository);t&&n.push({type:"vcs",url:t});const o=pn(e.bugs);return o&&n.push({type:"issue-tracker",url:o}),n.length>0?n:void 0},"buildExternalReferences"),un=h(e=>e==="application"||e==="service"||e==="tool"?"application":"library","toCycloneDxComponentType"),ne=h((e,n)=>{if(!n)return;n.description&&(e.description=n.description);const t=cn(n.author);t&&(e.author=t);const o=ze(n);o&&(e.licenses=o);const r=ln(n);r&&(e.externalReferences=r)},"decoratePackageComponent"),$n=h(e=>{const{focus:n,generatorVersion:t,includeDev:o=!1,now:r=new Date,projectGraph:p,serialNumber:g,workspace:y,workspaceRoot:b}=e,$=n&&n.length>0?[...$e(n,p)].sort():Object.keys(y.projects).sort(),X=new Set($),E=new Map;for(const c of $){const s=y.projects[c];s&&E.set(c,ce(R(b,s.root,"package.json")))}const I=[],q=new Map;for(const c of $){const s=y.projects[c];if(!s)continue;const i=E.get(c),a=i?.version??"0.0.0",u=N(c,a);q.set(c,u);const d={"bom-ref":u,name:c,purl:u,type:un(s.projectType),version:a};ne(d,i),I.push(d)}const H=Ze(b),B=new Map,L=new Map;if(H)for(const c of H.packages.values()){B.set(`${c.name}@${c.version}`,c);let s=L.get(c.name);s||(s=new Set,L.set(c.name,s)),s.add(c.version)}const V=[],U=[],w=new Map;for(const c of $){const s=E.get(c);if(!s)continue;const i=[s.dependencies,s.peerDependencies];o&&i.push(s.devDependencies);const a=new Set,u=h((d,C)=>{if(C)for(const[P,k]of Object.entries(C)){if(X.has(P)){const G=q.get(P);G&&a.add(G);continue}const T=ee(P,k,L);T&&(a.add(N(P,T)),d.push(`${P}@${T}`))}},"seedRef");for(const d of i)u(V,d);u(U,s.optionalDependencies),w.set(c,a)}const M=new Map,v=new Map,f=h((c,s)=>{const i=[...c];for(;i.length>0;){const a=i.pop(),u=M.get(a);if(u==="required"||u==="optional"&&s==="optional")continue;M.set(a,s);const d=B.get(a);if(!d)continue;const C=v.get(a)??new Set,P=[d.dependencies,d.peerDependencies];for(const k of P)if(k)for(const[T,G]of Object.entries(k))for(const z of G){const Q=ee(T,z,L);Q&&(C.add(N(T,Q)),i.push(`${T}@${Q}`))}if(d.optionalDependencies)for(const[k,T]of Object.entries(d.optionalDependencies))for(const G of T){const z=ee(k,G,L);z&&(C.add(N(k,z)),U.push(`${k}@${z}`))}C.size>0&&v.set(a,C)}},"walk");f(V,"required"),f(U,"optional");const l=[],_=[...M.keys()].sort();for(const c of _){const s=B.get(c);if(!s)continue;const i=N(s.name,s.version),a={"bom-ref":i,name:s.name,purl:i,scope:M.get(c)??"required",type:"library",version:s.version};s.hash&&(a.hashes=[s.hash]),ne(a,Ge(b,s.name,s.version)),l.push(a)}const D=[];for(const[c,s]of w){const i=q.get(c);if(!i)continue;const a=[...s].sort();D.push(a.length>0?{dependsOn:a,ref:i}:{ref:i})}for(const c of _){const s=B.get(c);if(!s)continue;const i=N(s.name,s.version),a=v.get(c),u=a?[...a].sort():[];D.push(u.length>0?{dependsOn:u,ref:i}:{ref:i})}D.sort((c,s)=>c.ref.localeCompare(s.ref));const O=ce(R(b,"package.json")),S=(()=>{if(n?.length===1){const u=I.find(d=>d.name===n[0]);if(u)return{"bom-ref":u["bom-ref"],name:u.name,purl:u.purl,type:u.type,version:u.version}}const c=O?.name??"workspace",s=O?.version??"0.0.0",i=N(c,s),a={"bom-ref":i,name:c,purl:i,type:"application",version:s};return ne(a,O),a})(),x=S["bom-ref"],K=x?I.filter(c=>c["bom-ref"]!==x):I;return{$schema:sn,bomFormat:on,components:[...K,...l],dependencies:D,metadata:{component:S,lifecycles:[{phase:"build"}],timestamp:r.toISOString(),tools:{components:[{name:rn,type:"application",...t?{version:t}:{}}]}},serialNumber:g??`urn:uuid:${be()}`,specVersion:tn,version:1}},"buildCycloneDxBom"),On=h(e=>{const n={version:e.version??1,xmlns:"http://cyclonedx.org/schema/bom/1.7"};e.serialNumber&&(n.serialNumber=e.serialNumber);const t=[];return e.metadata&&t.push(mn(e.metadata)),e.components&&e.components.length>0&&t.push({_content:e.components.map(o=>oe(o)),_name:"components"}),e.dependencies&&e.dependencies.length>0&&t.push({_content:e.dependencies.map(o=>dn(o)),_name:"dependencies"}),`${F({_attrs:n,_content:t,_name:"bom"},{header:!0,indent:" ",selfCloseTags:!0})}
|
|
4
|
+
`},"serializeBomToXml"),mn=h(e=>{const n=[];return e.timestamp&&n.push({timestamp:e.timestamp}),e.lifecycles&&e.lifecycles.length>0&&n.push({_content:e.lifecycles.map(t=>{const o=[];return t.phase&&o.push({phase:t.phase}),t.name&&o.push({name:t.name}),t.description&&o.push({description:t.description}),{_content:o,_name:"lifecycle"}}),_name:"lifecycles"}),e.tools?.components&&n.push({_content:[{_content:e.tools.components.map(t=>oe(t)),_name:"components"}],_name:"tools"}),e.component&&n.push(oe(e.component)),{_content:n,_name:"metadata"}},"metadataToXmlElement"),oe=h(e=>{const n={type:e.type};e["bom-ref"]&&(n["bom-ref"]=e["bom-ref"]);const t=[];e.group&&t.push({group:e.group}),t.push({name:e.name}),e.version&&t.push({version:e.version}),e.description&&t.push({description:e.description}),e.author&&t.push({author:e.author}),e.hashes&&e.hashes.length>0&&t.push({_content:e.hashes.map(r=>({_attrs:{alg:r.alg},_content:r.content,_name:"hash"})),_name:"hashes"});const o=fn(e.licenses);return o&&t.push(o),e.purl&&t.push({purl:e.purl}),e.scope&&t.push({scope:e.scope}),e.externalReferences&&e.externalReferences.length>0&&t.push({_content:e.externalReferences.map(r=>({_attrs:{type:r.type},_content:[{url:r.url}],_name:"reference"})),_name:"externalReferences"}),{_attrs:n,_content:t,_name:"component"}},"componentToXmlElement"),fn=h(e=>{if(!e||e.length===0)return;const n=[];for(const t of e){if("expression"in t){n.push({expression:t.expression});continue}const o=[];"id"in t.license&&t.license.id?o.push({id:t.license.id}):"name"in t.license&&t.license.name&&o.push({name:t.license.name}),n.push({_content:o,_name:"license"})}return{_content:n,_name:"licenses"}},"licensesToXmlElement"),dn=h(e=>e.dependsOn&&e.dependsOn.length>0?{_attrs:{ref:e.ref},_content:e.dependsOn.map(n=>({_attrs:{ref:n},_name:"dependency"})),_name:"dependency"}:{_attrs:{ref:e.ref},_name:"dependency"},"dependencyToXmlElement");export{$n as b,qe as n,On as s,N as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var g=Object.defineProperty;var m=(t,r)=>g(t,"name",{value:r,configurable:!0});import{$ as d,M as l}from"../packem_chunks/config.js";import{F as h}from"./lockfile-C5DYMHVq.js";import{h as v,k as D}from"../packem_chunks/bin.js";var w=Object.defineProperty,u=m((t,r)=>w(t,"name",{value:r,configurable:!0}),"g");const y={bun:{file:"bun.lock",type:"bun"},npm:{file:"package-lock.json",type:"npm"},pnpm:{file:"pnpm-lock.yaml",type:"pnpm"},yarn:{file:"yarn.lock",type:"yarn"}},k=u(t=>{try{return JSON.parse(d(t))}catch{return}},"readPackageJsonShape"),b=u(t=>{const r=[],o=k(l(t,"package.json"));o&&r.push(o);const a=v(t);let s;if(a?s=a:o?.workspaces&&(Array.isArray(o.workspaces)?s=o.workspaces:o.workspaces.packages&&(s=o.workspaces.packages)),!s)return r;const c=D(t,s);for(const n of c){const e=k(l(t,n,"package.json"));e&&r.push(e)}return r},"collectWorkspacePackageJsons"),P=u((t,r)=>{const o=new Set,a=[],s=new Map;for(const n of r){const e=s.get(n.name);e?e.push(n):s.set(n.name,[n])}const c=u(n=>{if(n)for(const e of Object.keys(n))o.has(e)||(o.add(e),a.push(e))},"enqueueRoots");for(const n of b(t))c(n.dependencies),c(n.peerDependencies),c(n.optionalDependencies);for(;a.length>0;){const n=a.shift(),e=s.get(n);if(e){for(const p of e)for(const i of[p.dependencies,p.peerDependencies,p.optionalDependencies])if(i)for(const f of Object.keys(i))o.has(f)||(o.add(f),a.push(f))}}return o},"computeProdReachable"),A=u((t,r,o={})=>{const a=y[r];if(!a)return[];let s;try{s=d(l(t,a.file))}catch{return[]}const c=h(s,a.type);if(c.length===0)return[];const n=o.includeDev??!0?void 0:P(t,c),e=new Set,p=[];for(const i of c){if(n&&!n.has(i.name))continue;const f=`${i.name}@${i.version}`;e.has(f)||(e.add(f),p.push({isDev:!1,name:i.name,version:i.version}))}return p},"lockedPackages"),J=u((t,r)=>{const o=y[r];if(!o)return[];let a;try{a=d(l(t,o.file))}catch{return[]}const s=h(a,o.type);if(s.length===0)return[];const c=new Map;for(const e of s)c.has(e.name)||c.set(e.name,new Set),c.get(e.name).add(e.version);const n=[];for(const[e,p]of c)p.size<=1||n.push({name:e,versions:[...p]});return n.sort((e,p)=>e.name.localeCompare(p.name))},"findDuplicateDependencies");export{y as L,J as f,A as l};
|