@visulima/vis 1.0.0-alpha.24 → 1.0.0-alpha.25
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 +61 -0
- package/LICENSE.md +1260 -152
- package/README.md +5 -3
- package/dist/bin.js +1 -1
- package/dist/binx.js +1 -1
- package/dist/config/index.d.ts +19 -0
- package/dist/packem_chunks/bin.js +299 -290
- package/dist/packem_chunks/fix.js +1 -1
- package/dist/packem_chunks/handler.js +1 -1
- package/dist/packem_chunks/handler10.js +2 -2
- package/dist/packem_chunks/handler11.js +1 -1
- package/dist/packem_chunks/handler12.js +1 -1
- package/dist/packem_chunks/handler13.js +1 -1
- package/dist/packem_chunks/handler14.js +10 -10
- 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 -1
- package/dist/packem_chunks/handler2.js +2 -2
- package/dist/packem_chunks/handler20.js +1 -1
- package/dist/packem_chunks/handler21.js +5 -5
- package/dist/packem_chunks/handler22.js +2 -2
- package/dist/packem_chunks/handler23.js +2 -2
- package/dist/packem_chunks/handler24.js +1 -1
- package/dist/packem_chunks/handler25.js +1 -1
- package/dist/packem_chunks/handler27.js +1 -1
- package/dist/packem_chunks/handler28.js +1 -1
- package/dist/packem_chunks/handler29.js +1 -1
- package/dist/packem_chunks/handler3.js +1 -1
- package/dist/packem_chunks/handler30.js +1 -1
- package/dist/packem_chunks/handler31.js +1 -1
- package/dist/packem_chunks/handler32.js +3 -3
- package/dist/packem_chunks/handler34.js +5 -28
- package/dist/packem_chunks/handler35.js +22 -5
- package/dist/packem_chunks/handler36.js +60 -21
- package/dist/packem_chunks/handler37.js +6 -61
- package/dist/packem_chunks/handler38.js +24 -6
- package/dist/packem_chunks/handler39.js +152 -707
- package/dist/packem_chunks/handler4.js +1 -1
- package/dist/packem_chunks/handler40.js +10 -24
- package/dist/packem_chunks/handler41.js +25 -286
- package/dist/packem_chunks/handler42.js +707 -152
- package/dist/packem_chunks/handler43.js +24 -10
- package/dist/packem_chunks/handler44.js +322 -25
- package/dist/packem_chunks/handler45.js +46 -24
- package/dist/packem_chunks/handler46.js +1 -1
- package/dist/packem_chunks/handler47.js +7 -7
- package/dist/packem_chunks/handler48.js +65 -58
- package/dist/packem_chunks/handler5.js +3 -3
- package/dist/packem_chunks/handler6.js +1 -1
- package/dist/packem_chunks/handler8.js +1 -1
- package/dist/packem_chunks/handler9.js +1 -1
- package/dist/packem_chunks/heal-accept.js +1 -1
- package/dist/packem_chunks/heal.js +1 -1
- package/dist/packem_chunks/help-command.js +16 -16
- package/dist/packem_chunks/index.js +6 -6
- package/dist/packem_chunks/list.js +1 -1
- package/dist/packem_chunks/loader.js +1 -1
- package/dist/packem_chunks/prune.js +3 -3
- package/dist/packem_chunks/run.js +1 -1
- package/dist/packem_chunks/sync2.js +1 -1
- package/dist/packem_chunks/tripwire.js +1 -1
- package/dist/packem_chunks/verify-lockfile.js +1 -1
- package/dist/packem_shared/affected-shas-Dm7eqcI8.js +1 -0
- package/dist/packem_shared/{ai-analysis-B8pDCOuT.js → ai-analysis-Csn82p17.js} +1 -1
- package/dist/packem_shared/{ai-fix-DiGSrGKv.js → ai-fix-BlYyz5bI.js} +3 -3
- package/dist/packem_shared/{cyclonedx-DPEW0nwS.js → cyclonedx-D6F9rAay.js} +1 -1
- package/dist/packem_shared/dependency-scan-s2MD0vi-.js +1 -0
- package/dist/packem_shared/{docker-_pBC9Loj.js → docker-BU-7veP5.js} +1 -1
- package/dist/packem_shared/index-D9ZIw4ra.js +29 -0
- package/dist/packem_shared/{index-D_tAc2nS.js → index-PexbdLyT.js} +1 -1
- package/dist/packem_shared/lifecycle-ChCFTm5Q.js +2 -0
- package/dist/packem_shared/{lockfile-CQLFNyVa.js → lockfile-BG1HvBzH.js} +1 -1
- package/dist/packem_shared/{min-release-age-Cz6HbF-I.js → min-release-age-heJgeP7o.js} +1 -1
- package/dist/packem_shared/{pm-runner-Dnj9J3KF.js → pm-runner-Cj76BV8q.js} +1 -1
- package/dist/packem_shared/{provenance-yESbF7Vs.js → provenance-CdvMwB2R.js} +1 -1
- package/dist/packem_shared/{resolve-explicit-BpxcFRuk.js → resolve-explicit-CRFybyxv.js} +1 -1
- package/dist/packem_shared/{s1ngularity-B_xjP4lC.js → s1ngularity-CiZla5EP.js} +1 -1
- package/dist/packem_shared/{signatures-DBwSnMBB.js → signatures-BsEDWhME.js} +1 -1
- package/dist/packem_shared/{typosquats-Citu7BRY.js → typosquats-_7T7U2q2.js} +1 -1
- package/dist/packem_shared/vis-update-app-qhQPV97i.js +1 -0
- package/index.js +52 -52
- package/package.json +14 -25
- package/schemas/project.schema.json +4 -0
- package/schemas/vis-config.schema.json +5 -0
- package/dist/packem_shared/dependency-scan-BbtivycX.js +0 -1
- package/dist/packem_shared/index-B8Ko8mwG.js +0 -29
- package/dist/packem_shared/lifecycle-DJDsjoic.js +0 -2
- package/dist/packem_shared/vis-update-app-BWA1kA1q.js +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var ie=Object.defineProperty;var h=(e,t)=>ie(e,"name",{value:t,configurable:!0});import{o as ae,am as oe,p as se,aO as le}from"./bin.js";import{z as U,M as z,$ as A}from"../packem_shared/readFileSync-CGmzMUF2-D6rUjGDn.js";import{b as S,l as E,O as _,M as q,v as Q,c as W,s as G,L as ce}from"../packem_shared/index-B8Ko8mwG.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&&q.test(s))return s;if(t?.toUpperCase)return t.locale?s.toLocaleUpperCase(t.locale):s.toUpperCase();const l=t?.locale?.startsWith("de")?Q(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&&q.test(o))return o;const s=t?.locale?.startsWith("de")?Q(o):o;return G(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=>G(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=>ce(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 z(...n)},"path_join"),path_relative:d((e,t)=>U(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(`---
|
|
1
|
+
var Te=Object.defineProperty;var w=(e,t)=>Te(e,"name",{value:t,configurable:!0});import{createRequire as ze}from"node:module";import{o as Be,ac as Ie,p as Ne,aF as qe}from"./bin.js";import{z as he,M as me,$ as I}from"../packem_shared/readFileSync-CGmzMUF2-D6rUjGDn.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(`---
|
|
2
2
|
`)&&!e.startsWith(`---\r
|
|
3
|
-
`))return{body:e};const
|
|
4
|
-
---`,3);if(
|
|
5
|
-
`&&(
|
|
6
|
-
`)?5:4,
|
|
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"),Tt=b((e,t)=>{const n=z(e,R),r=ae(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 oe(e,{includeDirs:!1,includeSymlinks:!1})){if(l.path===n)continue;const c=U(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&&se.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=>le(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{Tt as loadMoonTemplate};
|
|
3
|
+
`))return{body:e};const r=e.indexOf(`
|
|
4
|
+
---`,3);if(r===-1)return{body:e};let n=r+1+3;e[n]==="\r"&&(n+=1),e[n]===`
|
|
5
|
+
`&&(n+=1);const a=e.startsWith(`---\r
|
|
6
|
+
`)?5:4,i=e.slice(a,r).replaceAll("\r","");let l;try{l=t(i)}catch(o){const h=o instanceof Error?o.message:String(o);throw new Error(`Failed to parse frontmatter YAML: ${h}`,{cause:o})}if(l==null)return{body:e.slice(n)};if(typeof l!="object"||Array.isArray(l))throw new TypeError(`Frontmatter must be a YAML mapping, got ${Array.isArray(l)?"array":typeof l}`);return{body:e.slice(n),frontmatter:l}},"splitFrontmatter");var xn=Object.defineProperty,j=w((e,t)=>xn(e,"name",{value:t,configurable:!0}),"c");const Cn=/\{\{-?(.+?)-?\}\}|\{%-?(.+?)-?%\}/gs,Se=j(e=>{const t=[];let r=0,n=1;const a=j(i=>{for(const l of i)l===`
|
|
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};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var x=Object.defineProperty;var w=(t,s)=>x(t,"name",{value:s,configurable:!0});import{createRequire as B}from"node:module";import{a6 as P,p as o,a7 as R}from"./bin.js";import{A as V}from"../packem_shared/pm-runner-
|
|
1
|
+
var x=Object.defineProperty;var w=(t,s)=>x(t,"name",{value:s,configurable:!0});import{createRequire as B}from"node:module";import{a6 as P,p as o,a7 as R}from"./bin.js";import{A as V}from"../packem_shared/pm-runner-Cj76BV8q.js";import{x as C}from"../packem_shared/build-scripts-3E2pmscY.js";import{M as y,i as k}from"../packem_shared/readFileSync-CGmzMUF2-D6rUjGDn.js";import{n as q}from"./config.js";const D=B(import.meta.url),v=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,M=w(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,_=w((t,s)=>A(t,"name",{value:s,configurable:!0}),"p$1");const N=_((t,s={})=>{const f=y(t,"node_modules");if(!k(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");k(h)&&m(h)}continue}if(e.startsWith("."))continue;const u=i+e,$=y(r,"package.json");try{if(!O(r).isDirectory()||!k($))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");k(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=w((t,s)=>T(t,"name",{value:s,configurable:!0}),"p");const U=new Set(["bun","npm","pnpm","yarn"]),K=W(({options:t,visConfig:s,workspaceRoot:f})=>{const l=f??process.cwd(),p=V(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)?P(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
2
|
`);return}if(o.info(`Build-script status (${p.name}):
|
|
3
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 R(a))o.warn(e)}},"execute");export{K as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var w=Object.defineProperty;var c=(e,t)=>w(e,"name",{value:t,configurable:!0});import{createRequire as y}from"node:module";import{A as m,P as $}from"../packem_shared/pm-runner-
|
|
1
|
+
var w=Object.defineProperty;var c=(e,t)=>w(e,"name",{value:t,configurable:!0});import{createRequire as y}from"node:module";import{A as m,P as $}from"../packem_shared/pm-runner-Cj76BV8q.js";const _=y(import.meta.url),a=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,v=c(e=>{if(typeof a<"u"&&a.versions&&a.versions.node){const[t,s]=a.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return a.getBuiltinModule(e)}return _(e)},"__cjs_getBuiltinModule"),{createInterface:I}=v("node:readline");var h=Object.defineProperty,o=c((e,t)=>h(e,"name",{value:t,configurable:!0}),"n");const r="sigstore",b=o(()=>!!process.stdout.isTTY&&process.env.CI!=="true","isInteractive"),O=o(e=>new Promise(t=>{const s=I({input:process.stdin,output:process.stderr});s.question(`${e} (Y/n) `,i=>{s.close();const n=i.trim().toLowerCase();t(n===""||n==="y"||n==="yes")})}),"defaultPrompt"),D=o(e=>{const t=m(e),s=$(t,{exact:!1,filter:[],global:!1,optional:!1,packages:[r],peer:!1,saveDev:!0,workspace:!1,workspaceRoot:!1},e,console);return Promise.resolve({exitCode:s})},"defaultRunInstall"),k=o(()=>{try{return import.meta.resolve(r),!0}catch{return!1}},"isSigstoreInstalled"),P=o(e=>{let t="pnpm";try{t=m(e).name}catch{}switch(t){case"bun":return`bun add -d ${r}`;case"npm":return`npm install -D ${r}`;case"yarn":return`yarn add -D ${r}`;default:return`pnpm add -D ${r}`}},"installCommandFor"),R=o(()=>import("sigstore"),"defaultImport"),x=o(async(e={})=>{const t=e.interactive??b(),s=e.prompt??O,i=e.runInstall??D,n=e.importImpl??R,d=e.workspaceRoot??process.cwd(),l=P(d);try{return await n()}catch(p){const{code:f,message:g}=p;if(!(f==="ERR_MODULE_NOT_FOUND"||f==="MODULE_NOT_FOUND")||!g.includes(r))throw p}if(!t)throw new Error(`${r} is not installed. \`vis attest\` needs it for keyless signing/verification. Install it in your repo first:
|
|
2
2
|
${l}`);if(!await s(`${r} isn't installed. Install it now?`))throw new Error(`${r} install declined. Re-run \`vis attest\` after installing manually:
|
|
3
3
|
${l}`);const u=await i(d);if(u.exitCode!==0)throw new Error(`Install of ${r} failed (exit ${String(u.exitCode)}). Install manually and retry:
|
|
4
4
|
${l}`);return await n()},"loadOptionalSigstore");export{P as installCommandFor,k as isSigstoreInstalled,x as loadOptionalSigstore};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
2
|
-
`);return}const
|
|
3
|
-
`);return}
|
|
1
|
+
var d=Object.defineProperty;var u=(r,o)=>d(r,"name",{value:o,configurable:!0});import{p as s}from"./bin.js";import{r as m}from"../packem_shared/advisories-U1QKY_tg.js";var p=Object.defineProperty,l=u((r,o)=>p(r,"name",{value:o,configurable:!0}),"a");const v=l(async({fs:r,logger:o,options:t,workspaceRoot:n})=>{if(!n)throw new Error("Could not determine workspace root. Run this command inside a workspace.");const e=t.db??m(n),a=t.format==="json";if(!t.force){s.warn(`Prune is destructive. Will remove: ${e}`),s.info("Re-run with --force to proceed."),a&&process.stdout.write(`${JSON.stringify({dbPath:e,reason:"needs --force",removed:!1})}
|
|
2
|
+
`);return}const f=[e,`${e}-wal`,`${e}-shm`,`${e}-journal`],i=[];for(const c of f)try{await r.rm(c,{force:!0}),i.push(c)}catch{}if(a){process.stdout.write(`${JSON.stringify({dbPath:e,files:i,removed:!0})}
|
|
3
|
+
`);return}s.success(`Removed ${e}.`)},"execute"),b=v;export{b as advisoriesPruneExecute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var l=Object.defineProperty;var a=(t,o)=>l(t,"name",{value:o,configurable:!0});import{p as c,
|
|
1
|
+
var l=Object.defineProperty;var a=(t,o)=>l(t,"name",{value:o,configurable:!0});import{p as c,u as p,D 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:n})=>{const i=n??process.cwd(),s=o?.security?.policies?.installScripts?.allow??{},r=Object.entries(s).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};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var m=Object.defineProperty;var f=(e,n)=>m(e,"name",{value:n,configurable:!0});import{p as i}from"./bin.js";import{A as g}from"../packem_shared/pm-runner-
|
|
1
|
+
var m=Object.defineProperty;var f=(e,n)=>m(e,"name",{value:n,configurable:!0});import{p as i}from"./bin.js";import{A as g}from"../packem_shared/pm-runner-Cj76BV8q.js";import{N as y}from"../packem_shared/native-config-sync-BOeuyrBj.js";import{E as v}from"../packem_shared/min-release-age-heJgeP7o.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"]),x=w(({options:e,visConfig:n,workspaceRoot:u})=>{const o=u??process.cwd(),t=g(o);if(!b.has(t.name)){i.warn(`Package manager '${t.name}' has no native security config to sync.`);return}if(!n?.security){i.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)),p=r.firstSeen?.minutes,l=r.firstSeen?.exclude??[],s=[];if(Object.keys(a).length>0&&!e.skipAllowBuilds&&s.push(...y(t.name,o,a)),e.skipMinReleaseAge||s.push(...v(t.name,o,p,l)),s.length===0){i.success("Nothing to sync — vis.config and native PM config are aligned.");return}i.info(`Syncing vis.config security settings to ${t.name} native config…
|
|
2
2
|
`);for(const c of s)i.success(` ${c}`)},"execute");export{x as default};
|
|
@@ -1,2 +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}from"../packem_shared/readFileSync-CGmzMUF2-D6rUjGDn.js";import{n as m,B as k}from"./config.js";import{p as e}from"./bin.js";import{A as j}from"../packem_shared/pm-runner-
|
|
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}from"../packem_shared/readFileSync-CGmzMUF2-D6rUjGDn.js";import{n as m,B as k}from"./config.js";import{p as e}from"./bin.js";import{A as j}from"../packem_shared/pm-runner-Cj76BV8q.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 o=!1;const a=l(i=>!i||!(t in i)?i:(o=!0,Object.fromEntries(Object.entries(i).filter(([g])=>g!==t))),"stripFrom");return s.devDependencies=a(s.devDependencies),s.dependencies=a(s.dependencies),o&&k(n,`${JSON.stringify(s,null,2)}
|
|
2
2
|
`),o}catch{return!1}},"removeFromPackageJson"),O=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 o=j(s),a={bun:["add","-d",t],npm:["install","--save-dev",t],pnpm:["add","-D","-w",t],yarn:["add","-D",t]}[o.name];if(!a){e.error(`Cannot install tripwire — unsupported package manager '${o.name}'.`),process.exitCode=1;return}e.info(`Installing ${t} via ${o.name}…`);const i=$(o.name,a,{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(`${o.name} was terminated by signal ${i.signal}`),process.exitCode=1;return}if(i.status!==0){e.error(`${o.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{O as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var $=Object.defineProperty;var k=(e,o)=>$(e,"name",{value:o,configurable:!0});import{p}from"./bin.js";import{A as x}from"../packem_shared/pm-runner-
|
|
1
|
+
var $=Object.defineProperty;var k=(e,o)=>$(e,"name",{value:o,configurable:!0});import{p}from"./bin.js";import{A as x}from"../packem_shared/pm-runner-Cj76BV8q.js";import{r as v,l as C,L as S}from"../packem_shared/dependency-scan-s2MD0vi-.js";import{$ as M,M as h,i as L}from"../packem_shared/readFileSync-CGmzMUF2-D6rUjGDn.js";import{F as E}from"../packem_shared/lockfile-BG1HvBzH.js";import{e as P}from"../packem_shared/index-PexbdLyT.js";var D=Object.defineProperty,m=k((e,o)=>D(e,"name",{value:o,configurable:!0}),"r");const V=m(e=>{const o=e.trim();return o===""?!1:/^(?:git\+|git:\/\/|git@|ssh:\/\/)/i.test(o)||/^(?:github|gitlab|bitbucket|gist):/i.test(o)||/^[\w.-]+\/[\w.-]+(?:#.+)?$/.test(o)&&!o.includes("@")?!0:/^https?:\/\//i.test(o)},"isExoticSpecifier"),N=m((e,o)=>{for(const s of o)if(s===e||s.endsWith("*")&&e.startsWith(s.slice(0,-1)))return!0;return!1},"matchesAllow"),O=m((e,o,s={})=>{const t=v(e,o);if(!t)return[];let i;try{i=M(h(e,t.file))}catch{return[]}const n=E(i,t.type);if(n.length===0)return[];const c=s.allow??[],l=[],f=new Set;for(const r of n){const a=`${r.name}@${r.version}`;for(const g of[r.dependencies,r.optionalDependencies])if(g){for(const[u,w]of Object.entries(g))if(!N(u,c))for(const y of w){if(!V(y))continue;const b=`${a}->${u}@${y}`;f.has(b)||(f.add(b),l.push({declaredBy:a,packageName:u,source:y}))}}}return l.sort((r,a)=>r.packageName.localeCompare(a.packageName)||r.declaredBy.localeCompare(a.declaredBy))},"scanExoticSubdeps");var R=Object.defineProperty,d=k((e,o)=>R(e,"name",{value:o,configurable:!0}),"n");const j=new Set(["firstSeen","publisherChange"]),A=d(e=>e.severity==="block"&&e.acceptedRisk===void 0,"isGatingDecision"),B=d(e=>{const o=e.security?.policies?.firstSeen?.minutes,s=typeof o=="number"&&o>0,t=e.security?.policies?.publisherChange?.mode==="no-downgrade",i=e.security?.blockExoticSubdeps===!0;return s||t||i},"anyPolicyConfigured"),F=d(async e=>{const{offline:o=!1,packageManager:s,visConfig:t,workspaceRoot:i}=e,n=Date.now();if(!B(t))return{decisions:[],durationMs:Date.now()-n,entryCount:0,exoticViolations:[],lockfileMissing:!1,status:"skipped"};const c=v(i,s);if(!c||!L(h(i,c.file)))return{decisions:[],durationMs:Date.now()-n,entryCount:0,exoticViolations:[],lockfileMissing:!0,status:"fail"};const l=C(i,s,{includeDev:!0}),f=l.length,r=await P({offline:o,packageManager:s,packages:l,workspaceRoot:i},"install",{enabledPolicies:new Set(j),visConfig:t}),a=t.security?.blockExoticSubdeps===!0?O(i,s,{allow:t.security.exoticSubdepsAllow}):[],g=r.some(u=>A(u))||a.length>0;return{decisions:r,durationMs:Date.now()-n,entryCount:f,exoticViolations:a,lockfileMissing:!1,status:g?"fail":"pass"}},"verifyLockfile"),W=d(e=>e<1e3?`${String(e)}ms`:`${(e/1e3).toFixed(1)}s`,"formatElapsed"),G=d(e=>{if(e.status==="skipped")return["– Lockfile supply-chain verification skipped (no firstSeen / publisherChange / blockExoticSubdeps policy configured)"];if(e.lockfileMissing)return["✗ Lockfile supply-chain verification failed — no lockfile found, the resolved closure cannot be attested"];const o=`(${String(e.entryCount)} ${e.entryCount===1?"entry":"entries"}, ${W(e.durationMs)})`;if(e.status==="pass")return[`✓ Lockfile passes supply-chain policies ${o}`];const s=[`✗ Lockfile failed supply-chain policy check ${o}`];for(const t of e.decisions)t.severity==="block"&&t.acceptedRisk===void 0&&s.push(` [${t.policy}] ${t.reason}`);for(const t of e.exoticViolations)s.push(` [blockExoticSubdeps] ${t.packageName} pulled from exotic source by ${t.declaredBy}: ${t.source}`);return s},"formatLockfileVerification");var I=Object.defineProperty,J=k((e,o)=>I(e,"name",{value:o,configurable:!0}),"a");const U=J(async({options:e,visConfig:o,workspaceRoot:s})=>{const t=s??process.cwd(),i=x(t);if(!S[i.name]){p.warn(`Package manager '${i.name}' has no lockfile vis can verify.`);return}const n=await F({offline:!!e.offline,packageManager:i.name,visConfig:o??{},workspaceRoot:t});if(e.json){process.stdout.write(`${JSON.stringify(n,void 0,2)}
|
|
2
2
|
`),n.status==="fail"&&(process.exitCode=1);return}const[c,...l]=G(n);if(n.status==="skipped"){p.info(c);return}if(n.status==="pass"){p.success(c);return}p.error(c);for(const f of l)p.error(f);process.exitCode=1},"execute");export{U as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var E=Object.defineProperty;var c=(e,t)=>E(e,"name",{value:t,configurable:!0});import{createRequire as p}from"node:module";import{i as f,$ as A}from"./readFileSync-CGmzMUF2-D6rUjGDn.js";const g=p(import.meta.url),l=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,h=c(e=>{if(typeof l<"u"&&l.versions&&l.versions.node){const[t,r]=l.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return l.getBuiltinModule(e)}return g(e)},"__cjs_getBuiltinModule"),{spawnSync:b}=h("node:child_process");var v=Object.defineProperty,i=c((e,t)=>v(e,"name",{value:t,configurable:!0}),"o");const I="0000000000000000000000000000000000000000",R=i(e=>{if(f(e))try{const t=A(e);return JSON.parse(t)}catch{return}},"defaultReadEventPayload"),C=i((e,t)=>{const r=b("git",e,{cwd:t,encoding:"utf8"});if(!(r.error||typeof r.status!="number"||r.status!==0))return typeof r.stdout=="string"?r.stdout.trim():void 0},"defaultRunGit"),d=i(e=>typeof e=="string"&&e.length>0&&e!==I,"isNonEmptySha");i((e,...t)=>{let r=e;for(const o of t){if(r===null||typeof r!="object")return;r=r[o]}return r},"getNested");const B=i((e,t,r)=>{const o=[],s=e.GITHUB_BASE_REF,n=e.GITHUB_SHA??"HEAD";if(s&&s.length>0)return o.push(`pull_request: $GITHUB_BASE_REF=${s}`),{base:`origin/${s}`,head:n,notes:o,provider:"github"};const u=e.GITHUB_EVENT_PATH,a=u?r(u):void 0;if(a){const _=typeof a.before=="string"?a.before:void 0;if(d(_))return o.push(`push: event.before=${_}`),{base:_,head:n,notes:o,provider:"github"}}return o.push(`fallback: origin/${t}`),{base:`origin/${t}`,head:n,notes:o,provider:"github"}},"resolveGithub"),T=i((e,t)=>{const r=[],o=e.CI_COMMIT_SHA??"HEAD";if(e.CI_PIPELINE_SOURCE==="merge_request_event"){const u=e.CI_MERGE_REQUEST_DIFF_BASE_SHA;if(d(u))return r.push(`merge_request: $CI_MERGE_REQUEST_DIFF_BASE_SHA=${u}`),{base:u,head:o,notes:r,provider:"gitlab"};const a=e.CI_MERGE_REQUEST_TARGET_BRANCH_NAME;if(a&&a.length>0)return r.push(`merge_request: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME=${a}`),{base:`origin/${a}`,head:o,notes:r,provider:"gitlab"}}const s=e.CI_COMMIT_BEFORE_SHA;if(d(s))return r.push(`push: $CI_COMMIT_BEFORE_SHA=${s}`),{base:s,head:o,notes:r,provider:"gitlab"};const n=e.CI_DEFAULT_BRANCH??t;return r.push(`fallback: origin/${n}`),{base:`origin/${n}`,head:o,notes:r,provider:"gitlab"}},"resolveGitlab"),$=i((e,t)=>{const r=[],o=e.BUILDKITE_COMMIT??"HEAD",s=e.BUILDKITE_PULL_REQUEST_BASE_BRANCH;return s&&s.length>0?(r.push(`pull_request: $BUILDKITE_PULL_REQUEST_BASE_BRANCH=${s}`),{base:`origin/${s}`,head:o,notes:r,provider:"buildkite"}):(r.push(`fallback: origin/${t} (buildkite has no canonical previous-build SHA env)`),{base:`origin/${t}`,head:o,notes:r,provider:"buildkite"})},"resolveBuildkite"),H=i((e,t)=>{const r=[],o=e.CIRCLE_SHA1??"HEAD",s=e.CIRCLE_PR_BASE_BRANCH;return s&&s.length>0?(r.push(`pull_request: $CIRCLE_PR_BASE_BRANCH=${s}`),{base:`origin/${s}`,head:o,notes:r,provider:"circleci"}):(r.push(`fallback: origin/${t} (circleci has no canonical previous-build SHA env)`),{base:`origin/${t}`,head:o,notes:r,provider:"circleci"})},"resolveCircleCI"),S=i((e,t,r)=>{const o=[],s=t(["merge-base","HEAD",`origin/${e}`],r);return s&&s.length>0?(o.push(`local: git merge-base HEAD origin/${e}=${s}`),{base:s,head:"HEAD",notes:o,provider:"local"}):(o.push(`local fallback: origin/${e} (no merge-base available)`),{base:`origin/${e}`,head:"HEAD",notes:o,provider:"local"})},"resolveLocal"),L=i(e=>{const t=e?.env??process.env,r=e?.defaultBase??"main",o=e?.readEventPayload??R,s=e?.runGit??C,n=e?.workspaceRoot??process.cwd();return t.GITHUB_ACTIONS==="true"?B(t,r,o):t.GITLAB_CI==="true"?T(t,r):t.BUILDKITE==="true"?$(t,r):t.CIRCLECI==="true"?H(t,r):S(r,s,n)},"resolveAffectedShas");export{L as r};
|
|
@@ -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{
|
|
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{a8 as K,a9 as G,aa as Y,ab as X}from"../packem_chunks/bin.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:C}=$("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 Ce={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 Te=Object.defineProperty,je=m((e,r)=>Te(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:Ce,gemini:Oe,kimi:Me,opencode:Ie,qwen:qe},T=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&&C(T(t))){const i=T(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(C(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,4 +1,4 @@
|
|
|
1
|
-
var O=Object.defineProperty;var f=(e,t)=>O(e,"name",{value:t,configurable:!0});import{createRequire as F}from"node:module";import{readLastRunSummary as T}from"@visulima/task-runner";import{a as k}from"./failure-log-B0Uh-65U.js";import{
|
|
1
|
+
var O=Object.defineProperty;var f=(e,t)=>O(e,"name",{value:t,configurable:!0});import{createRequire as F}from"node:module";import{readLastRunSummary as T}from"@visulima/task-runner";import{a as k}from"./failure-log-B0Uh-65U.js";import{q as j,r as D,$ as y,a0 as _,a1 as N,a2 as R,a3 as A,a4 as M}from"../packem_chunks/bin.js";import{a as $,C as b,M as H,z as q}from"./readFileSync-CGmzMUF2-D6rUjGDn.js";import{w as W,b as L,r as Y}from"./ai-analysis-Csn82p17.js";const C=F(import.meta.url),d=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,I=f(e=>{if(typeof d<"u"&&d.versions&&d.versions.node){const[t,a]=d.versions.node.split(".").map(Number);if(t>22||t===22&&a>=3||t===20&&a>=16)return d.getBuiltinModule(e)}return C(e)},"__cjs_getBuiltinModule"),{readFile:E,writeFile:B}=I("node:fs/promises");var z=Object.defineProperty,m=f((e,t)=>z(e,"name",{value:t,configurable:!0}),"u");const J=32*1024,K=m((e,t)=>{if(e.length<=t)return e;const a=e.slice(-t),o=e.length-a.length;return`[…${String(o)} bytes truncated from head…]
|
|
2
2
|
${a}`},"truncateHead"),U=m(async(e,t)=>t===void 0?T(e,{dataDirectory:j(e)}):D(e,t),"loadSummary"),ge=m(async(e,t,a={})=>{const o=a.terminalOutputLimit??J,[r,n]=await Promise.all([k(e,t),U(e,a.runId)]),i=n?y(n,t):void 0;if(!r&&!i)return;let s,c;if(n&&i){const l=await _(e,n.id),g=l?y(l,t):void 0;s=N(i.hashDetails,g?.hashDetails),c=l?.id}const h=r?.terminalOutput??"";return{command:r?.command??void 0,cwd:r?.cwd??void 0,dependencies:i?.dependencies??[],duration:i?.duration,exitCode:r?.exitCode??i?.exitCode,hash:i?.hash??r?.hash,hashDetails:i?.hashDetails,hashDiff:s,previousRunId:c,project:i?.target.project,runId:n?.id??r?.runId,status:r?.status??(i?G(i):void 0),target:i?.target.target,taskId:t,terminalOutput:K(h,o),terminalOutputCaptured:!!r,timestamp:r?.timestamp??i?.endTime??i?.startTime}},"aggregateFailureContext"),G=m(e=>{if(e.exitCode!==void 0&&e.exitCode!==0)return"failure";switch(e.cacheStatus){case"HIT":return"local-cache";case"REMOTE_HIT":return"remote-cache";case"SKIPPED":return"skipped";default:return e.exitCode===0?"success":void 0}},"mapCacheStatusToTaskStatus");var V=Object.defineProperty,u=f((e,t)=>V(e,"name",{value:t,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:
|
|
@@ -36,8 +36,8 @@ ${a.join(`
|
|
|
36
36
|
`)},"buildHashDiffSummary"),te=u(e=>{const t=[`Task: ${e.taskId}`];return e.project&&t.push(`Project: ${e.project}`),e.target&&t.push(`Target: ${e.target}`),e.command&&t.push(`Command: ${e.command}`),e.cwd&&t.push(`CWD: ${e.cwd}`),e.exitCode!==void 0&&t.push(`Exit code: ${String(e.exitCode)}`),e.hash&&t.push(`Task hash: ${e.hash}`),t.push("","Hash-diff since previous run:",ee(e),""),e.terminalOutputCaptured?t.push("Terminal output:","```",e.terminalOutput,"```"):t.push("Terminal output: <no failure log was captured for this task>",'Set "cannotFix" and tell the user to re-run with `vis run` so logs can be captured.'),t.join(`
|
|
37
37
|
`)},"buildUserPrompt"),ae=u(e=>`${Z()}
|
|
38
38
|
|
|
39
|
-
${te(e)}`,"buildFixPrompt"),ie=u((e,t)=>{const a=Array.isArray(e.patches)?e.patches:[],o=[];for(const n of a)typeof n.file!="string"||n.file.length===0||typeof n.oldString!="string"||n.oldString.length===0||typeof n.newString=="string"&&o.push({file:n.file,newString:n.newString,oldString:n.oldString,reason:typeof n.reason=="string"&&n.reason.length>0?n.reason:void 0});const r=typeof e.cannotFix=="string"&&e.cannotFix.length>0?e.cannotFix:void 0;return{cannotFix:r,confidence:X.has(e.confidence)?e.confidence:"low",explanation:typeof e.explanation=="string"?e.explanation:"",patches:r?[]:o,provider:t}},"normalizeFixProposal"),ne=u((e,t)=>{const a=
|
|
39
|
+
${te(e)}`,"buildFixPrompt"),ie=u((e,t)=>{const a=Array.isArray(e.patches)?e.patches:[],o=[];for(const n of a)typeof n.file!="string"||n.file.length===0||typeof n.oldString!="string"||n.oldString.length===0||typeof n.newString=="string"&&o.push({file:n.file,newString:n.newString,oldString:n.oldString,reason:typeof n.reason=="string"&&n.reason.length>0?n.reason:void 0});const r=typeof e.cannotFix=="string"&&e.cannotFix.length>0?e.cannotFix:void 0;return{cannotFix:r,confidence:X.has(e.confidence)?e.confidence:"low",explanation:typeof e.explanation=="string"?e.explanation:"",patches:r?[]:o,provider:t}},"normalizeFixProposal"),ne=u((e,t)=>{const a=W(e);return!a||typeof a!="object"?{cannotFix:"AI response was not valid JSON.",confidence:"low",explanation:"Failed to parse AI response.",patches:[],provider:t}:ie(a,t)},"parseFixResponse"),re=u((e,t)=>R({cwd:t.cwd??null,flow:"ai-fix",hash:t.hash??null,provider:e,taskId:t.taskId,terminalOutput:t.terminalOutput,terminalOutputCaptured:t.terminalOutputCaptured}),"buildFixCacheKey"),ve=u(async(e,t,a={})=>{const o=L(a.config);if(!o){t.warn(`No AI provider available — install one of: claude, gemini, copilot, codex.
|
|
40
40
|
`);return}const r=a.cache!==!1,n=re(o.name,e);if(r){const i=A(n);if(i)return t.info(`Using cached fix proposal from ${i.provider}.
|
|
41
41
|
`),i}t.info(`Generating fix proposal with ${o.name}...
|
|
42
42
|
`);try{const i=await Y(o,ae(e)),s=ne(i,o.name);return r&&s.patches.length>0&&!s.cannotFix&&M(n,s,Q),s}catch(i){const s=i instanceof Error?i.message:String(i);t.warn(`AI fix proposal failed (${s}).
|
|
43
|
-
`);return}},"runFixAnalysis"),se=u((e,t,a)=>$(a)?b(a):b(H(t??e,a)),"resolvePatchPath"),oe=u((e,t)=>{const a=
|
|
43
|
+
`);return}},"runFixAnalysis"),se=u((e,t,a)=>$(a)?b(a):b(H(t??e,a)),"resolvePatchPath"),oe=u((e,t)=>{const a=q(e,t);return a===""?!0:!a.startsWith("..")&&!$(a)},"isInsideWorkspace"),ce=u((e,t,a)=>{const o=e.indexOf(t),r=Math.max(0,o-S),n=Math.min(e.length,o+t.length+S),i=e.slice(r,n);return{previewAfter:`${e.slice(r,o)}${a}${e.slice(o+t.length,n)}`,previewBefore:i}},"buildPreview"),xe=u(async(e,t,a,o={})=>{const r=o.dryRun===!0,n=new Map,i=[];for(const s of a.patches){const c=se(e,t,s.file);if(!oe(e,c)){i.push({absolutePath:c,patch:s,status:"outside-workspace"});continue}let h=n.get(c);if(h===void 0){try{h=await E(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}n.set(c,h)}const l=h.indexOf(s.oldString);if(l===-1){i.push({absolutePath:c,patch:s,status:"no-match"});continue}if(h.indexOf(s.oldString,l+s.oldString.length)!==-1){i.push({absolutePath:c,patch:s,status:"ambiguous-match"});continue}const{previewAfter:g,previewBefore:P}=ce(h,s.oldString,s.newString),x=`${h.slice(0,l)}${s.newString}${h.slice(l+s.oldString.length)}`;if(!r)try{await B(c,x,"utf8")}catch(p){n.delete(c),i.push({absolutePath:c,error:p.message,patch:s,status:"error"});continue}n.set(c,x),i.push({absolutePath:c,patch:s,previewAfter:g,previewBefore:P,status:"applied"})}return i},"applyFixProposal");export{ge as a,ve as b,xe as c,se as r};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var de=Object.defineProperty;var w=(e,n)=>de(e,"name",{value:n,configurable:!0});import{createRequire as he}from"node:module";import{n as ie}from"../packem_chunks/config.js";import{M as B,$ as _e}from"./readFileSync-CGmzMUF2-D6rUjGDn.js";import{r as be}from"./docker-
|
|
1
|
+
var de=Object.defineProperty;var w=(e,n)=>de(e,"name",{value:n,configurable:!0});import{createRequire as he}from"node:module";import{n as ie}from"../packem_chunks/config.js";import{M as B,$ as _e}from"./readFileSync-CGmzMUF2-D6rUjGDn.js";import{r as be}from"./docker-BU-7veP5.js";import{e as $e}from"./license-zZU7aavK.js";import{F as Oe}from"./lockfile-BG1HvBzH.js";import{x as ke}from"./pm-runner-Cj76BV8q.js";const ge=he(import.meta.url),W=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ae=w(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 ge(e)},"__cjs_getBuiltinModule"),{randomUUID:ye}=ae("node:crypto"),{readdirSync:ve}=ae("node:fs");var je=Object.defineProperty,pe=w((e,n)=>je(e,"name",{value:n,configurable:!0}),"r$1");const z=pe(e=>e.replaceAll(/[^\w.~-]/g,n=>`%${(n.codePointAt(0)??0).toString(16).toUpperCase().padStart(2,"0")}`),"encodeSegment"),M=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/${z(r)}/${z(p)}@${z(n)}`}}return`pkg:npm/${z(t)}@${z(n)}`},"toNpmPurl");var Se=Object.defineProperty,j=w((e,n)=>Se(e,"name",{value:n,configurable:!0}),"a");const m={ARRAY:"array",BOOLEAN:"boolean",DATE:"date",FUNCTION:"function",JSTOXML_OBJECT:"jstoxml-object",NULL:"null",NUMBER:"number",OBJECT:"object",STRING:"string"},Te=[m.STRING,m.NUMBER,m.BOOLEAN],Ae='<?xml version="1.0" encoding="UTF-8"?>',se=["_selfCloseTag","_attrs"],xe=j((e="",n=0)=>e.repeat(n),"getIndentStr"),Q=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"),Ce=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"),Ne=j((e={},n,t,o)=>{const r=Ce(e,n,t,o);return r.length===0?"":` ${r.join(" ")}`},"formatAttributes"),Re=j((e={})=>Object.keys(e).map(n=>({_name:n,_content:e[n]})),"objToArray"),we=j(e=>Te.includes(Q(e)),"isPrimitive"),Pe=j(e=>!e.match("<"),"isSimpleXML"),De=j(({header:e,isOutputStart:n})=>e&&n?typeof e===m.BOOLEAN?Ae:e:"","getHeaderString"),re={"<":"<",">":">","&":"&",'"':"""},J=j((e={},n={})=>{const{depth:t=0,indent:o,_isFirstItem:r,_isOutputStart:p=!0,header:g,attributeReplacements:y={},attributeFilter:b,attributeExplicitTrue:$=!1,contentReplacements:q={},contentMap:L,selfCloseTags:I=!0}=n,H=typeof y=="boolean"&&!y?{}:{...re,...y},Y=typeof q=="boolean"&&!q?{}:{...re,...q},P=typeof o=="string",T=xe(o,t),G=Q(e),U=De({header:g,indent:o,depth:t,isOutputStart:p}),D=p&&!U&&r&&t===0,E=P&&!D?`
|
|
2
2
|
`:"";let v="";switch(G){case m.JSTOXML_OBJECT:{const{_name:f,_content:l}=e;if(l===null&&typeof L!="function"){v=`${E}${T}${f}`;break}if(Array.isArray(l)&&l.every(we))return l.map(S=>J({_name:f,_content:S},{...n,depth:t,_isOutputStart:!1})).join("");if(se.includes(f))break;const _=J(l,{...n,depth:t+1,_isOutputStart:D}),N=Q(_),O=Pe(_),k=le(_),R=`${E}${T}`;if(f==="_comment"){v+=`${R}<!-- ${l} -->`;break}const K=N==="undefined"||_==="",c=I,s=e._selfCloseTag,i=typeof s===m.BOOLEAN?K&&s:K&&c,a=i?"/":"",u=Ne(e._attrs,H,b,$),d=`<${f}${u}${a}>`,A=P&&!O&&!k?`
|
|
3
3
|
${T}`:"",x=i?"":`${_}${A}</${f}>`;v+=`${R}${d}${x}`;break}case m.OBJECT:{const f=Object.keys(e);v=f.map((l,_)=>{const N={...n,_isFirstItem:_===0,_isLastItem:_+1===f.length,_isOutputStart:D},O={_name:l};if(Q(e[l])===m.OBJECT&&(se.forEach(k=>{const R=e[l][k];typeof R<"u"&&(O[k]=R,delete e[l][k])}),typeof e[l]._content<"u"&&Object.keys(e[l]).length>1)){const k=Object.assign({},e[l]);delete k._content,O._content=[...Re(k),e[l]._content]}return typeof O._content>"u"&&(O._content=e[l]),J(O,N)},n).join("");break}case m.FUNCTION:{const f=e(n);v=J(f,n);break}case m.ARRAY:{v=e.map((f,l)=>{const _={...n,_isFirstItem:l===0,_isLastItem:l+1===e.length,_isOutputStart:D};return J(f,_)}).join("");break}default:{v=ue(e,Y,L);break}}return`${U}${v}`},"toXML");var Ee=Object.defineProperty,X=w((e,n)=>Ee(e,"name",{value:n,configurable:!0}),"r");const te=X(e=>{try{return ie(e)}catch{return}},"readJsonSafe"),Me=X(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"),Be=X(e=>e.length>0&&!e.includes("/")&&!e.includes("\\")&&!e.includes("..")&&!e.includes("\0"),"isSafeVersion"),Le=X((e,n,t)=>{const o=`${n.replaceAll("/","+")}@${t}`,r=B(e,"node_modules",".pnpm"),p=te(B(r,o,"node_modules",n,"package.json"));if(p)return p;let g;try{g=ve(r)}catch{return}const y=`${o}_`;for(const b of g){if(!b.startsWith(y))continue;const $=te(B(r,b,"node_modules",n,"package.json"));if($)return $}},"readPnpmVirtualStore"),Ie=X((e,n,t)=>{const o=te(B(e,"node_modules",n,"package.json"));return o?.version===t?o:void 0},"readHoistedCopy"),Ue=X((e,n,t)=>{if(!(!Me(n)||!Be(t)))return Le(e,n,t)??Ie(e,n,t)},"readInstalledPackageMetadata");var Fe=Object.defineProperty,me=w((e,n)=>Fe(e,"name",{value:n,configurable:!0}),"t");const Je={sha256:"SHA-256",sha384:"SHA-384",sha512:"SHA-512"},Xe={sha256:64,sha384:96,sha512:128},qe=me(e=>{const n={name:e.name,version:e.version},{integrity:t}=e;return t&&t.hex.length===Xe[t.algorithm]&&(n.hash={alg:Je[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"),He=[{file:"pnpm-lock.yaml",type:"pnpm"},{file:"npm-shrinkwrap.json",type:"npm"},{file:"package-lock.json",type:"npm"},{file:"yarn.lock",type:"yarn"},{file:"bun.lock",type:"bun"}],Ve=me(e=>{for(const{file:n,type:t}of He){let o;try{o=_e(B(e,n))}catch{continue}const r=new Map;for(const p of Oe(o,t))r.set(`${p.name}@${p.version}`,qe(p));return{packages:r,type:t}}},"readLockfilePackages");var We=Object.defineProperty,fe=w((e,n)=>We(e,"name",{value:n,configurable:!0}),"s");const ze=fe(e=>{const n=e.indexOf(":");return n<=0?e:e.slice(0,n)==="npm"?e.slice(n+1):e},"stripProtocolPrefix"),ee=fe((e,n,t)=>{const o=t.get(e);if(!o||o.size===0)return;if(o.has(n))return n;const r=ze(n);if(r!==n&&o.has(r))return r;const p=[...o];return ke.maxSatisfying(p,r,{includePrerelease:!0})||p[0]},"resolveSpecifier");var Ye=Object.defineProperty,h=w((e,n)=>Ye(e,"name",{value:n,configurable:!0}),"p");const Ge="1.7",Ke="CycloneDX",Qe="http://cyclonedx.org/schema/bom-1.7.schema.json",Ze="@visulima/vis",ce=h(e=>{try{return ie(e)}catch{return}},"readPackageJson"),en=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"),nn=h(e=>{if(e)return typeof e=="string"?e:e.url},"toRepositoryUrl"),tn=h(e=>{if(e)return typeof e=="string"?e:e.url},"toBugsUrl"),on=h(e=>{const n=[];e.homepage&&n.push({type:"website",url:e.homepage});const t=nn(e.repository);t&&n.push({type:"vcs",url:t});const o=tn(e.bugs);return o&&n.push({type:"issue-tracker",url:o}),n.length>0?n:void 0},"buildExternalReferences"),sn=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=en(n.author);t&&(e.author=t);const o=$e(n);o&&(e.licenses=o);const r=on(n);r&&(e.externalReferences=r)},"decoratePackageComponent"),yn=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?[...be(n,p)].sort():Object.keys(y.projects).sort(),q=new Set($),L=new Map;for(const c of $){const s=y.projects[c];s&&L.set(c,ce(B(b,s.root,"package.json")))}const I=[],H=new Map;for(const c of $){const s=y.projects[c];if(!s)continue;const i=L.get(c),a=i?.version??"0.0.0",u=M(c,a);H.set(c,u);const d={"bom-ref":u,name:c,purl:u,type:sn(s.projectType),version:a};ne(d,i),I.push(d)}const Y=Ve(b),P=new Map,T=new Map;if(Y)for(const c of Y.packages.values()){P.set(`${c.name}@${c.version}`,c);let s=T.get(c.name);s||(s=new Set,T.set(c.name,s)),s.add(c.version)}const G=[],U=[],D=new Map;for(const c of $){const s=L.get(c);if(!s)continue;const i=[s.dependencies,s.peerDependencies];o&&i.push(s.devDependencies);const a=new Set,u=h((d,A)=>{if(A)for(const[x,S]of Object.entries(A)){if(q.has(x)){const F=H.get(x);F&&a.add(F);continue}const C=ee(x,S,T);C&&(a.add(M(x,C)),d.push(`${x}@${C}`))}},"seedRef");for(const d of i)u(G,d);u(U,s.optionalDependencies),D.set(c,a)}const E=new Map,v=new Map,f=h((c,s)=>{const i=[...c];for(;i.length>0;){const a=i.pop(),u=E.get(a);if(u==="required"||u==="optional"&&s==="optional")continue;E.set(a,s);const d=P.get(a);if(!d)continue;const A=v.get(a)??new Set,x=[d.dependencies,d.peerDependencies];for(const S of x)if(S)for(const[C,F]of Object.entries(S))for(const V of F){const Z=ee(C,V,T);Z&&(A.add(M(C,Z)),i.push(`${C}@${Z}`))}if(d.optionalDependencies)for(const[S,C]of Object.entries(d.optionalDependencies))for(const F of C){const V=ee(S,F,T);V&&(A.add(M(S,V)),U.push(`${S}@${V}`))}A.size>0&&v.set(a,A)}},"walk");f(G,"required"),f(U,"optional");const l=[],_=[...E.keys()].sort();for(const c of _){const s=P.get(c);if(!s)continue;const i=M(s.name,s.version),a={"bom-ref":i,name:s.name,purl:i,scope:E.get(c)??"required",type:"library",version:s.version};s.hash&&(a.hashes=[s.hash]),ne(a,Ue(b,s.name,s.version)),l.push(a)}const N=[];for(const[c,s]of D){const i=H.get(c);if(!i)continue;const a=[...s].sort();N.push(a.length>0?{dependsOn:a,ref:i}:{ref:i})}for(const c of _){const s=P.get(c);if(!s)continue;const i=M(s.name,s.version),a=v.get(c),u=a?[...a].sort():[];N.push(u.length>0?{dependsOn:u,ref:i}:{ref:i})}N.sort((c,s)=>c.ref.localeCompare(s.ref));const O=ce(B(b,"package.json")),k=(()=>{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=M(c,s),a={"bom-ref":i,name:c,purl:i,type:"application",version:s};return ne(a,O),a})(),R=k["bom-ref"],K=R?I.filter(c=>c["bom-ref"]!==R):I;return{$schema:Qe,bomFormat:Ke,components:[...K,...l],dependencies:N,metadata:{component:k,lifecycles:[{phase:"build"}],timestamp:r.toISOString(),tools:{components:[{name:Ze,type:"application",...t?{version:t}:{}}]}},serialNumber:g??`urn:uuid:${ye()}`,specVersion:Ge,version:1}},"buildCycloneDxBom"),_n=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(rn(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=>an(o)),_name:"dependencies"}),`${J({_attrs:n,_content:t,_name:"bom"},{header:!0,indent:" ",selfCloseTags:!0})}
|
|
4
4
|
`},"serializeBomToXml"),rn=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=cn(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"),cn=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"),an=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{yn as b,_n as s,M as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var D=Object.defineProperty;var y=(o,t)=>D(o,"name",{value:t,configurable:!0});import{i as w,M as u,$ as d}from"./readFileSync-CGmzMUF2-D6rUjGDn.js";import{F as h}from"./lockfile-BG1HvBzH.js";import{h as b,J as j}from"../packem_chunks/bin.js";var L=Object.defineProperty,l=y((o,t)=>L(o,"name",{value:t,configurable:!0}),"f");const S={bun:{file:"bun.lock",type:"bun"},npm:{aliases:["npm-shrinkwrap.json"],file:"package-lock.json",type:"npm"},pnpm:{file:"pnpm-lock.yaml",type:"pnpm"},yarn:{file:"yarn.lock",type:"yarn"}},O=l(o=>{const t=S[o];return t?[...t.aliases??[],t.file].map(e=>({file:e,type:t.type})):[]},"lockfileCandidates"),m=l((o,t)=>{const e=O(t);if(e.length!==0)return e.find(r=>w(u(o,r.file)))??e[e.length-1]},"resolveLockfile"),g=l(o=>{try{return JSON.parse(d(o))}catch{return}},"readPackageJsonShape"),v=l(o=>{const t=[],e=g(u(o,"package.json"));e&&t.push(e);const r=b(o);let c;if(r?c=r:e?.workspaces&&(Array.isArray(e.workspaces)?c=e.workspaces:e.workspaces.packages&&(c=e.workspaces.packages)),!c)return t;const a=j(o,c);for(const s of a){const n=g(u(o,s,"package.json"));n&&t.push(n)}return t},"collectWorkspacePackageJsons"),P=l((o,t)=>{const e=new Set,r=[],c=new Map;for(const s of t){const n=c.get(s.name);n?n.push(s):c.set(s.name,[s])}const a=l(s=>{if(s)for(const n of Object.keys(s))e.has(n)||(e.add(n),r.push(n))},"enqueueRoots");for(const s of v(o))a(s.dependencies),a(s.peerDependencies),a(s.optionalDependencies);for(;r.length>0;){const s=r.shift(),n=c.get(s);if(n){for(const i of n)for(const p of[i.dependencies,i.peerDependencies,i.optionalDependencies])if(p)for(const f of Object.keys(p))e.has(f)||(e.add(f),r.push(f))}}return e},"computeProdReachable"),C=l((o,t,e={})=>{const r=m(o,t);if(!r)return[];let c;try{c=d(u(o,r.file))}catch{return[]}const a=h(c,r.type);if(a.length===0)return[];const s=e.includeDev??!0?void 0:P(o,a),n=new Set,i=[];for(const p of a){if(s&&!s.has(p.name))continue;const f=`${p.name}@${p.version}`;n.has(f)||(n.add(f),i.push({isDev:!1,name:p.name,version:p.version}))}return i},"lockedPackages"),E=l((o,t)=>{const e=m(o,t);if(!e)return[];let r;try{r=d(u(o,e.file))}catch{return[]}const c=h(r,e.type);if(c.length===0)return[];const a=new Map;for(const n of c)a.has(n.name)||a.set(n.name,new Set),a.get(n.name).add(n.version);const s=[];for(const[n,i]of a)i.size<=1||s.push({name:n,versions:[...i]});return s.sort((n,i)=>n.name.localeCompare(i.name))},"findDuplicateDependencies"),F=l((o,t)=>{const e=m(o,t);if(!e)return;let r;try{r=d(u(o,e.file))}catch{return}const c=h(r,e.type);if(c.length===0)return;const a=[],s=new Set;for(const n of v(o))for(const i of[n.dependencies,n.devDependencies,n.peerDependencies,n.optionalDependencies])if(i)for(const[p,f]of Object.entries(i)){const k=`${p}@${f}`;s.has(k)||(s.add(k),a.push({name:p,version:f}))}return{entries:c,roots:a}},"loadLockfileGraph");export{S as L,F as a,E as f,C as l,m as r};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var pa=Object.defineProperty;var c=(h,n)=>pa(h,"name",{value:n,configurable:!0});import{createRequire as da}from"node:module";import{b as va,n as Do,B as Ji}from"../packem_chunks/config.js";import{K as ci,M as Be,i as Aa,z as ba}from"./readFileSync-CGmzMUF2-D6rUjGDn.js";import{bf as Ca,bg as $a}from"../packem_chunks/bin.js";import"./index-
|
|
1
|
+
var pa=Object.defineProperty;var c=(h,n)=>pa(h,"name",{value:n,configurable:!0});import{createRequire as da}from"node:module";import{b as va,n as Do,B as Ji}from"../packem_chunks/config.js";import{K as ci,M as Be,i as Aa,z as ba}from"./readFileSync-CGmzMUF2-D6rUjGDn.js";import{bf as Ca,bg as $a}from"../packem_chunks/bin.js";import"./index-D9ZIw4ra.js";const ha=da(import.meta.url),vr=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ga=c(h=>{if(typeof vr<"u"&&vr.versions&&vr.versions.node){const[n,m]=vr.versions.node.split(".").map(Number);if(n>22||n===22&&m>=3||n===20&&m>=16)return vr.getBuiltinModule(h)}return ha(h)},"__cjs_getBuiltinModule"),{cpSync:No,lstatSync:ma,readdirSync:ya,existsSync:Mo,rmSync:si,readFileSync:Vi}=ga("node:fs");var Sa=Object.defineProperty,Ea=c((h,n)=>Sa(h,"name",{value:n,configurable:!0}),"t");class ft extends Error{static{c(this,"LockfilePruneError")}static{Ea(this,"LockfilePruneError")}constructor(n){super(n),this.name="LockfilePruneError"}}var wa=Object.defineProperty,Bt=c((h,n)=>wa(h,"name",{value:n,configurable:!0}),"p$2");const qo=Bt(h=>{let n=h.startsWith("/")?h.slice(1):h;const m=n.indexOf("(");return m!==-1&&(n=n.slice(0,m)),n},"canonicalKey"),ka=Bt((h,n)=>{if(!(n.startsWith("link:")||n.startsWith("file:")||n.startsWith("workspace:")))return`${h}@${n}`},"resolveDepKey"),xa=Bt(h=>{const n=[];for(const m of[h.dependencies,h.devDependencies,h.optionalDependencies])if(m)for(const[v,$]of Object.entries(m))$?.version&&n.push({name:v,version:$.version});return n},"collectImporterDeps"),Ki=Bt(h=>{const n=[];for(const m of[h.dependencies,h.optionalDependencies])if(m)for(const[v,$]of Object.entries(m))typeof $=="string"&&n.push({name:v,version:$});return n},"collectPackageDeps"),Gi=Bt(h=>{const n=new Map;if(!h)return n;for(const m of Object.keys(h)){const v=qo(m),$=n.get(v);$?$.push(m):n.set(v,[m])}return n},"buildKeyIndex"),Yo=Bt(h=>{const n=h.displayName??"pnpm-lock.yaml",m=typeof h.lockfileContent=="string"?h.lockfileContent:h.lockfileContent.toString("utf8");let v;try{v=Ca(m)}catch(oe){throw new ft(`${n}: parse failed — ${oe.message}`)}const $=Bt(oe=>oe.packages?Object.keys(oe.packages).length:0,"packageCount");let a;for(const oe of v){const[T]=oe.errors;if(T)throw new ft(`${n}: parse failed — ${T.message}`);const ne=oe.toJS();if(!ne||typeof ne!="object")continue;const me=ne;(a===void 0||$(me)>$(a))&&(a=me)}if(a===void 0)throw new ft(`${n}: top-level value is not an object`);const g=a.importers??{},e=Gi(a.packages),C=Gi(a.snapshots),k=new Set(["."]);for(const oe of h.closure)k.add(oe.relativeRoot===""?".":oe.relativeRoot);const b={};for(const[oe,T]of Object.entries(g))k.has(oe)&&(b[oe]=T);const S=new Set,O=new Set,H=[];for(const oe of Object.values(b))for(const T of xa(oe))H.push(T);for(;H.length>0;){const{name:oe,version:T}=H.shift(),ne=ka(oe,T);if(!ne)continue;const me=qo(ne),U=C.get(me)??C.get(ne)??[];for(const be of U){if(O.has(be))continue;O.add(be);const ye=a.snapshots?.[be];if(ye)for(const je of Ki(ye))H.push(je)}const ue=e.get(me)??e.get(ne)??[];for(const be of ue){if(S.has(be))continue;S.add(be);const ye=a.packages?.[be];if(ye&&!a.snapshots)for(const je of Ki(ye))H.push(je)}}const A={lockfileVersion:a.lockfileVersion};for(const oe of["settings","overrides","patchedDependencies","catalogs"])a[oe]!==void 0&&(A[oe]=a[oe]);if(A.importers=b,a.packages){const oe={};for(const T of Object.keys(a.packages))S.has(T)&&(oe[T]=a.packages[T]);A.packages=oe}if(a.snapshots){const oe={};for(const T of Object.keys(a.snapshots))O.has(T)&&(oe[T]=a.snapshots[T]);A.snapshots=oe}const y=Object.keys(a.packages??{}).length,E=Object.keys(A.packages??{}).length,X=y-E,fe=Object.keys(g).length-Object.keys(b).length;return{content:$a(A,{lineWidth:0}),message:`${n}: kept ${E}/${y} packages and ${Object.keys(b).length} importers (dropped ${X} packages, ${fe} importers)`,status:"pruned"}},"prunePnpmLockfile");var Oa=Object.defineProperty,ja=c((h,n)=>Oa(h,"name",{value:n,configurable:!0}),"p$1");const _a=ja(h=>Yo({...h,displayName:h.displayName??"aube-lock.yaml"}),"pruneAubeLockfile");var Ta=Object.defineProperty,Sr=c((h,n)=>Ta(h,"name",{value:n,configurable:!0}),"p");const Ra=Sr(h=>{let n="",m=!1,v=!1,$=!1;for(let a=0;a<h.length;a+=1){const g=h[a],e=h[a+1];if(v){g===`
|
|
2
2
|
`&&(v=!1,n+=g);continue}if($){g==="*"&&e==="/"&&($=!1,a+=1);continue}if(m){if(g==="\\"){n+=g,e!==void 0&&(n+=e,a+=1);continue}g==='"'&&(m=!1),n+=g;continue}if(g==='"'){m=!0,n+=g;continue}if(g==="/"&&e==="/"){v=!0,a+=1;continue}if(g==="/"&&e==="*"){$=!0,a+=1;continue}n+=g}return n},"stripJsonComments"),La=Sr(h=>{const n=[];for(const m of[h.dependencies,h.devDependencies,h.optionalDependencies,h.peerDependencies])if(m)for(const[v,$]of Object.entries(m))typeof $=="string"&&n.push({name:v,spec:$});return n},"collectWorkspaceDeps"),Fa=Sr(h=>{for(const n of h)if(typeof n=="object"&&!Array.isArray(n))return n},"extractMetadata"),Pa=Sr(h=>{if(!h)return[];const n=[];for(const m of["dependencies","optionalDependencies","peerDependencies"]){const v=h[m];v!==null&&typeof v=="object"&&!Array.isArray(v)&&n.push(...Object.keys(v))}return n},"collectMetadataDeps"),Ia=Sr(h=>{if(Buffer.isBuffer(h.lockfileContent))return{message:"bun.lockb is binary; run `bun install --save-text-lockfile` to regenerate as bun.lock, then rerun `vis docker scaffold`.",status:"skipped"};const n=Ra(h.lockfileContent);let m;try{m=JSON.parse(n)}catch(y){throw new ft(`bun.lock: parse failed — ${y.message}`)}if(!m||typeof m!="object")throw new ft("bun.lock: top-level value is not an object");const v=m.workspaces??{},$=m.packages??{},a=new Set([""]);for(const y of h.closure)a.add(y.relativeRoot===""?"":y.relativeRoot);const g={},e=[];for(const[y,E]of Object.entries(v))a.has(y)&&(g[y]=E,e.push(...La(E)));const C=new Set;for(const{name:y}of e)C.add(y);const k=[...C];for(;k.length>0;){const y=k.shift();for(const E of Object.keys($)){if(E.split("/")[0]!==y&&E!==y)continue;const X=Fa($[E]);for(const fe of Pa(X))C.has(fe)||(C.add(fe),k.push(fe))}}const b={};for(const[y,E]of Object.entries($)){const X=y.split("/")[0];(C.has(X)||C.has(y))&&(b[y]=E)}const S={...m,packages:b,workspaces:g},O=Object.keys($).length,H=Object.keys(b).length,A=O-H;return{content:`${JSON.stringify(S,null,2)}
|
|
3
3
|
`,message:`bun.lock: kept ${H}/${O} packages (dropped ${A})`,status:"pruned"}},"pruneBunLockfile");var Na=Object.defineProperty,li=c((h,n)=>Na(h,"name",{value:n,configurable:!0}),"k");const _n="node_modules/",Ma=li((h,n,m)=>{let v=n;for(;;){const $=v===""?`${_n}${m}`:`${v}/${_n}${m}`;if(h[$]!==void 0)return $;if(v==="")return;const a=v.lastIndexOf(`/${_n.slice(0,-1)}/`);v=a===-1?"":v.slice(0,a)}},"resolveDep"),Da=li(h=>{const n=[];for(const m of[h.dependencies,h.devDependencies,h.optionalDependencies,h.peerDependencies])if(m)for(const v of Object.keys(m))n.push(v);return n},"collectDepNames"),qa=li(h=>{const n=h.displayName??"package-lock.json",m=typeof h.lockfileContent=="string"?h.lockfileContent:h.lockfileContent.toString("utf8");let v;try{v=JSON.parse(m)}catch(A){throw new ft(`${n}: parse failed — ${A.message}`)}if(!v||typeof v!="object")throw new ft(`${n}: top-level value is not an object`);const $=v.packages??{},a=new Set([""]);for(const A of h.closure)A.relativeRoot!==""&&a.add(A.relativeRoot);const g=new Set,e=[];for(const A of Object.keys($))a.has(A)&&(g.add(A),e.push(A));for(const[A,y]of Object.entries($))y.link===!0&&typeof y.resolved=="string"&&a.has(y.resolved)&&g.add(A);for(;e.length>0;){const A=e.shift(),y=$[A];if(y)for(const E of Da(y)){const X=Ma($,A,E);if(!X||g.has(X))continue;g.add(X);const fe=$[X];fe.link===!0&&typeof fe.resolved=="string"&&$[fe.resolved]!==void 0&&!g.has(fe.resolved)?(g.add(fe.resolved),e.push(fe.resolved)):e.push(X)}}const C={};for(const A of Object.keys($))g.has(A)&&(C[A]=$[A]);const k=C[""];k&&Array.isArray(k.workspaces)&&(k.workspaces=k.workspaces.filter(A=>{if(typeof A!="string")return!1;const y=A.replace(/\/?\*+$/,"").replace(/\/$/,"");if(y===""||y==="*")return!0;for(const E of a)if(E===A||E===y||E.startsWith(`${y}/`))return!0;return!1}));const b={...v,packages:C};delete b.dependencies;const S=Object.keys($).length,O=Object.keys(C).length,H=S-O;return{content:`${JSON.stringify(b,null,2)}
|
|
4
4
|
`,message:`${n}: kept ${O}/${S} entries (dropped ${H})`,status:"pruned"}},"pruneNpmLockfile");var Tn={},Fe={},Rn,Qi;function Ya(){if(Qi)return Rn;Qi=1;var h=Object.defineProperty,n=c((a,g)=>h(a,"name",{value:g,configurable:!0}),"a");function m(a,g){function e(){this.constructor=a}c(e,"s"),n(e,"ctor"),e.prototype=g.prototype,a.prototype=new e}c(m,"peg$subclass"),n(m,"peg$subclass");function v(a,g,e,C){this.message=a,this.expected=g,this.found=e,this.location=C,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,v)}c(v,"peg$SyntaxError"),n(v,"peg$SyntaxError"),m(v,Error),v.buildMessage=function(a,g){var e={literal:n(function(A){return'"'+k(A.text)+'"'},"literal"),class:n(function(A){var y="",E;for(E=0;E<A.parts.length;E++)y+=A.parts[E]instanceof Array?b(A.parts[E][0])+"-"+b(A.parts[E][1]):b(A.parts[E]);return"["+(A.inverted?"^":"")+y+"]"},"class"),any:n(function(A){return"any character"},"any"),end:n(function(A){return"end of input"},"end"),other:n(function(A){return A.description},"other")};function C(A){return A.charCodeAt(0).toString(16).toUpperCase()}c(C,"T"),n(C,"hex");function k(A){return A.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(y){return"\\x0"+C(y)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(y){return"\\x"+C(y)})}c(k,"q"),n(k,"literalEscape");function b(A){return A.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(y){return"\\x0"+C(y)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(y){return"\\x"+C(y)})}c(b,"_"),n(b,"classEscape");function S(A){return e[A.type](A)}c(S,"re"),n(S,"describeExpectation");function O(A){var y=new Array(A.length),E,X;for(E=0;E<A.length;E++)y[E]=S(A[E]);if(y.sort(),y.length>0){for(E=1,X=1;E<y.length;E++)y[E-1]!==y[E]&&(y[X]=y[E],X++);y.length=X}switch(y.length){case 1:return y[0];case 2:return y[0]+" or "+y[1];default:return y.slice(0,-1).join(", ")+", or "+y[y.length-1]}}c(O,"le"),n(O,"describeExpected");function H(A){return A?'"'+k(A)+'"':"end of input"}return c(H,"te"),n(H,"describeFound"),"Expected "+O(a)+" but "+H(g)+" found."};function $(a,g){g=g!==void 0?g:{};var e={},C={Start:pn},k=pn,b=n(function(t){return t||[]},"peg$c0"),S=n(function(t,o,u){return[{command:t,type:o}].concat(u||[])},"peg$c1"),O=n(function(t,o){return[{command:t,type:o||";"}]},"peg$c2"),H=n(function(t){return t},"peg$c3"),A=";",y=ce(";",!1),E="&",X=ce("&",!1),fe=n(function(t,o){return o?{chain:t,then:o}:{chain:t}},"peg$c8"),oe=n(function(t,o){return{type:t,line:o}},"peg$c9"),T="&&",ne=ce("&&",!1),me="||",U=ce("||",!1),ue=n(function(t,o){return o?{...t,then:o}:t},"peg$c14"),be=n(function(t,o){return{type:t,chain:o}},"peg$c15"),ye="|&",je=ce("|&",!1),Me="|",De=ce("|",!1),qe="=",rt=ce("=",!1),Ee=n(function(t,o){return{name:t,args:[o]}},"peg$c22"),He=n(function(t){return{name:t,args:[]}},"peg$c23"),Ge="(",Qe=ce("(",!1),re=")",Pe=ce(")",!1),We=n(function(t,o){return{type:"subshell",subshell:t,args:o}},"peg$c28"),ke="{",xe=ce("{",!1),$e="}",Le=ce("}",!1),Ae=n(function(t,o){return{type:"group",group:t,args:o}},"peg$c33"),Ye=n(function(t,o){return{type:"command",args:o,envs:t}},"peg$c34"),Ue=n(function(t){return{type:"envs",envs:t}},"peg$c35"),Ve=n(function(t){return t},"peg$c36"),Je=n(function(t){return t},"peg$c37"),q=/^[0-9]/,W=Ze([["0","9"]],!1,!1),se=n(function(t,o,u){return{type:"redirection",subtype:o,fd:t!==null?parseInt(t):null,args:[u]}},"peg$c40"),Ce=">>",nt=ce(">>",!1),at=">&",st=ce(">&",!1),At=">",Ke=ce(">",!1),pt="<<<",et=ce("<<<",!1),ze="<&",dt=ce("<&",!1),bt="<",ht=ce("<",!1),r=n(function(t){return{type:"argument",segments:[].concat(...t)}},"peg$c53"),_=n(function(t){return t},"peg$c54"),R="$'",z=ce("$'",!1),Y="'",l=ce("'",!1),w=n(function(t){return[{type:"text",text:t}]},"peg$c59"),L='""',F=ce('""',!1),D=n(function(){return{type:"text",text:""}},"peg$c62"),V='"',P=ce('"',!1),Z=n(function(t){return t},"peg$c65"),J=n(function(t){return{type:"arithmetic",arithmetic:t,quoted:!0}},"peg$c66"),ie=n(function(t){return{type:"shell",shell:t,quoted:!0}},"peg$c67"),ve=n(function(t){return{type:"variable",...t,quoted:!0}},"peg$c68"),pe=n(function(t){return{type:"text",text:t}},"peg$c69"),_e=n(function(t){return{type:"arithmetic",arithmetic:t,quoted:!1}},"peg$c70"),Qr=n(function(t){return{type:"shell",shell:t,quoted:!1}},"peg$c71"),zr=n(function(t){return{type:"variable",...t,quoted:!1}},"peg$c72"),wr=n(function(t){return{type:"glob",pattern:t}},"peg$c73"),Ut=/^[^']/,Wt=Ze(["'"],!0,!1),wt=n(function(t){return t.join("")},"peg$c76"),kr=/^[^$"]/,xr=Ze(["$",'"'],!0,!1),tr=`\\
|