@visulima/vis 1.0.0-alpha.34 → 1.0.0-alpha.36
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 +78 -0
- package/LICENSE.md +3244 -1611
- package/README.md +44 -0
- package/dashboard/dist/index.html +11 -11
- package/dist/bin.js +1 -1
- package/dist/binx.js +1 -1
- package/dist/config/index.d.ts +74 -2
- package/dist/config/index.js +1 -1
- package/dist/generate/index.js +1 -1
- package/dist/packem_chunks/bin.js +584 -588
- package/dist/packem_chunks/bloom-status.js +2 -2
- package/dist/packem_chunks/bloom-sync.js +2 -2
- package/dist/packem_chunks/cache-attestation.js +1 -1
- package/dist/packem_chunks/config.js +18 -16
- package/dist/packem_chunks/devtools.js +56 -57
- package/dist/packem_chunks/doctor-probe.js +2 -2
- package/dist/packem_chunks/fix.js +11 -11
- package/dist/packem_chunks/handler.js +1 -1
- package/dist/packem_chunks/handler10.js +1 -1
- package/dist/packem_chunks/handler11.js +5 -5
- package/dist/packem_chunks/handler12.js +1 -1
- package/dist/packem_chunks/handler13.js +7 -7
- package/dist/packem_chunks/handler14.js +4 -4
- 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 +3 -3
- package/dist/packem_chunks/handler20.js +5 -5
- package/dist/packem_chunks/handler21.js +2 -2
- package/dist/packem_chunks/handler22.js +2 -2
- package/dist/packem_chunks/handler23.js +1 -1
- package/dist/packem_chunks/handler24.js +1 -1
- package/dist/packem_chunks/handler25.js +1 -5
- package/dist/packem_chunks/handler26.js +5 -1
- package/dist/packem_chunks/handler27.js +1 -3
- package/dist/packem_chunks/handler28.js +3 -1
- package/dist/packem_chunks/handler29.js +1 -7
- package/dist/packem_chunks/handler3.js +4 -4
- package/dist/packem_chunks/handler30.js +6 -32
- package/dist/packem_chunks/handler31.js +33 -3
- package/dist/packem_chunks/handler32.js +3 -8
- package/dist/packem_chunks/handler33.js +8 -1
- package/dist/packem_chunks/handler34.js +4 -5
- package/dist/packem_chunks/handler35.js +1 -11
- package/dist/packem_chunks/handler36.js +5 -3
- package/dist/packem_chunks/handler37.js +11 -22
- package/dist/packem_chunks/handler38.js +3 -61
- package/dist/packem_chunks/handler39.js +22 -3
- package/dist/packem_chunks/handler4.js +6 -6
- package/dist/packem_chunks/handler40.js +61 -6
- package/dist/packem_chunks/handler41.js +3 -24
- package/dist/packem_chunks/handler42.js +6 -25
- package/dist/packem_chunks/handler43.js +24 -153
- package/dist/packem_chunks/handler44.js +25 -10
- package/dist/packem_chunks/handler45.js +152 -707
- package/dist/packem_chunks/handler46.js +10 -24
- package/dist/packem_chunks/handler47.js +24 -322
- package/dist/packem_chunks/handler48.js +322 -48
- package/dist/packem_chunks/handler49.js +708 -3
- package/dist/packem_chunks/handler5.js +7 -7
- package/dist/packem_chunks/handler50.js +48 -27
- package/dist/packem_chunks/handler51.js +21 -189
- package/dist/packem_chunks/handler52.js +3 -34
- package/dist/packem_chunks/handler53.js +200 -0
- package/dist/packem_chunks/handler54.js +38 -0
- package/dist/packem_chunks/handler6.js +1 -1
- package/dist/packem_chunks/handler7.js +1 -1
- package/dist/packem_chunks/handler8.js +1 -1
- package/dist/packem_chunks/handler9.js +1 -1
- package/dist/packem_chunks/heal-accept.js +7 -7
- package/dist/packem_chunks/heal.js +11 -11
- package/dist/packem_chunks/help-command.js +30 -7
- package/dist/packem_chunks/index.js +6 -6
- package/dist/packem_chunks/keys-refresh.js +4 -4
- package/dist/packem_chunks/list.js +2 -2
- package/dist/packem_chunks/loader.js +4 -4
- package/dist/packem_chunks/loader2.js +1 -1
- package/dist/packem_chunks/prune.js +3 -3
- package/dist/packem_chunks/run.js +1 -1
- package/dist/packem_chunks/status.js +2 -2
- package/dist/packem_chunks/sync.js +2 -2
- package/dist/packem_chunks/sync2.js +2 -2
- package/dist/packem_chunks/tar.js +3 -3
- package/dist/packem_chunks/tripwire.js +2 -2
- package/dist/packem_chunks/verify-lockfile.js +2 -2
- package/dist/packem_shared/CONFIG_FILES-BfaR0jKT.js +1 -0
- package/dist/packem_shared/MultiSpinner-B9U0-aE3-B-gIXhFk.js +3 -0
- package/dist/packem_shared/Table-CcVkyULl-B_ef6zfS.js +35 -0
- package/dist/packem_shared/_commonjsHelpers-B5Y90VFO.js +1 -0
- package/dist/packem_shared/advisories-DLeO5KMN.js +1 -0
- package/dist/packem_shared/affected-shas-cVnX8-zs.js +1 -0
- package/dist/packem_shared/ai-analysis-DT3bU-_M.js +68 -0
- package/dist/packem_shared/ai-fix-BkNqd5nP.js +43 -0
- package/dist/packem_shared/build-scripts-CCCi8U66.js +1 -0
- package/dist/packem_shared/cyclonedx-86-DbHtf.js +4 -0
- package/dist/packem_shared/definePlugin-DoUcoYSy.js +1 -0
- package/dist/packem_shared/dependency-scan-BDTH898x.js +1 -0
- package/dist/packem_shared/docker-tNrDU3oK.js +59 -0
- package/dist/packem_shared/failure-log-Dwqt6_Ga.js +2 -0
- package/dist/packem_shared/giget-DHY1sQZC.js +2 -0
- package/dist/packem_shared/glob-fqg4KepW-B7EjLRvw.js +1 -0
- package/dist/packem_shared/index-BDmTbWX1.js +19 -0
- package/dist/packem_shared/index-C0Vj3XF8.js +30 -0
- package/dist/packem_shared/index-CB4p298r.js +1 -0
- package/dist/packem_shared/index-DMefdF51.js +1 -0
- package/dist/packem_shared/license-t5KnNX6v.js +1 -0
- package/dist/packem_shared/lifecycle-4z9hHE5b.js +2 -0
- package/dist/packem_shared/lockfile-C8Q1_4KK.js +1 -0
- package/dist/packem_shared/manifests-Dj3pRKBT.js +1 -0
- package/dist/packem_shared/min-release-age-D1alDE3K.js +34 -0
- package/dist/packem_shared/missing-package-json-41VUWFBY.js +1 -0
- package/dist/packem_shared/native-config-sync-BKAZ0NIs.js +21 -0
- package/dist/packem_shared/osv-bloom-B03tUWf3.js +2 -0
- package/dist/packem_shared/otelPlugin-DmKDBaPo.js +1 -0
- package/dist/packem_shared/peer-warnings-BXAzXqY3.js +1 -0
- package/dist/packem_shared/pm-runner-pVihAfxV.js +1 -0
- package/dist/packem_shared/provenance-DMuEftgc.js +1 -0
- package/dist/packem_shared/registry-keys-Bf2zzlcZ.js +1 -0
- package/dist/packem_shared/resolve-explicit-jH0RKyMJ.js +5 -0
- package/dist/packem_shared/runtime-check-Stc9AI78.js +1 -0
- package/dist/packem_shared/s1ngularity-BkfgC6NO.js +1 -0
- package/dist/packem_shared/scan-progress-JBbd9QeT.js +2 -0
- package/dist/packem_shared/selectors-GCJIe342.js +3 -0
- package/dist/packem_shared/signatures-D1H6h6GH.js +2 -0
- package/dist/packem_shared/spinner-BXSl864p.js +1 -0
- package/dist/packem_shared/subtree-C7bZuiSQ.js +2 -0
- package/dist/packem_shared/symbols-DPTlrJ3B.js +1 -0
- package/dist/packem_shared/tabs-BqUepRaD.js +1 -0
- package/dist/packem_shared/toolchain-pR7AJ-tB.js +5 -0
- package/dist/packem_shared/typosquats-C8qg1neE.js +1 -0
- package/dist/packem_shared/use-measured-height-BBJ9intr.js +1 -0
- package/dist/packem_shared/utils-Cxree603.js +1 -0
- package/dist/packem_shared/verify-Du7xZ2BJ.js +1 -0
- package/dist/packem_shared/vis-update-app-CTwRkNgj.js +1 -0
- package/dist/packem_shared/watch-BvIwLG4N.js +1 -0
- package/dist/packem_shared/watch-loop-DWkvv2tK.js +11 -0
- package/index.d.ts +201 -201
- package/index.js +751 -567
- package/package.json +16 -16
- package/schemas/vis-config.schema.json +4 -0
- package/dist/packem_shared/Table-3pFgIUZ2-DABgc6rj.js +0 -12
- package/dist/packem_shared/_commonjsHelpers-CLblCigl.js +0 -1
- package/dist/packem_shared/advisories-CGKZo9Rx.js +0 -1
- package/dist/packem_shared/affected-shas-BdnlfiV1.js +0 -1
- package/dist/packem_shared/ai-analysis-3QD_RS6F.js +0 -68
- package/dist/packem_shared/ai-fix-TsjDQz_0.js +0 -43
- package/dist/packem_shared/applyDefaults-BogleaFi.js +0 -1
- package/dist/packem_shared/build-scripts-DE6U8jVq.js +0 -1
- package/dist/packem_shared/cyclonedx-zf9R2jCs.js +0 -4
- package/dist/packem_shared/definePlugin-CWm4Dv_t.js +0 -1
- package/dist/packem_shared/dependency-scan-B70azq4x.js +0 -1
- package/dist/packem_shared/docker-EJiTY0Sz.js +0 -60
- package/dist/packem_shared/failure-log-Dxafk3t4.js +0 -2
- package/dist/packem_shared/giget-CcEy_Elm.js +0 -2
- package/dist/packem_shared/glob-D_7bct6p-D8itOHsr.js +0 -1
- package/dist/packem_shared/index-BpbjpCNL.js +0 -1
- package/dist/packem_shared/index-DH-5hsrC.js +0 -1
- package/dist/packem_shared/index-di3jpyZS.js +0 -30
- package/dist/packem_shared/license-zZU7aavK.js +0 -1
- package/dist/packem_shared/lifecycle-DvVTL8nx.js +0 -2
- package/dist/packem_shared/lockfile-CedmXr44.js +0 -1
- package/dist/packem_shared/lockfile-Cu2BH6bl.js +0 -1
- package/dist/packem_shared/manifests-BzWpKW8F.js +0 -1
- package/dist/packem_shared/min-release-age-DKMW2N_v.js +0 -34
- package/dist/packem_shared/missing-package-json-DKAwoiWK.js +0 -1
- package/dist/packem_shared/native-config-sync-DBkJ-hsF.js +0 -21
- package/dist/packem_shared/osv-bloom-0Vu8YRhg.js +0 -2
- package/dist/packem_shared/otelPlugin-CJR2T_lk.js +0 -1
- package/dist/packem_shared/peer-warnings-EvSJ18gE.js +0 -1
- package/dist/packem_shared/pm-runner-DmKT2FqF.js +0 -1
- package/dist/packem_shared/provenance-Cu6VR1Hy.js +0 -1
- package/dist/packem_shared/readFileSync-DseCu8sg-DEq4Fn3a.js +0 -1
- package/dist/packem_shared/registry-keys-CuBAVdsk.js +0 -1
- package/dist/packem_shared/resolve-explicit-Xue0oq8V.js +0 -5
- package/dist/packem_shared/runtime-check-CilFOqUU.js +0 -1
- package/dist/packem_shared/s1ngularity-adnHbyTd.js +0 -1
- package/dist/packem_shared/scan-progress-lZdk5KJ-.js +0 -2
- package/dist/packem_shared/selectors-DkgYFzdq.js +0 -3
- package/dist/packem_shared/signatures-FGbYV5QE.js +0 -2
- package/dist/packem_shared/spinner-0acw5pd_.js +0 -1
- package/dist/packem_shared/spinners-f91Rbo99-Bjf3NcO0.js +0 -1
- package/dist/packem_shared/symbols-CQmER5MT.js +0 -1
- package/dist/packem_shared/tabs-zUSdR1HI.js +0 -1
- package/dist/packem_shared/toolchain-DoG6b_G_.js +0 -5
- package/dist/packem_shared/typosquats-acxQ7blw.js +0 -1
- package/dist/packem_shared/use-measured-height-DyCBfLtu.js +0 -1
- package/dist/packem_shared/utils-DrNg0XTR.js +0 -1
- package/dist/packem_shared/verify-BYzxSKWD.js +0 -1
- package/dist/packem_shared/vis-update-app-D0QyGneK.js +0 -1
- package/dist/packem_shared/watch-DEL0yol9.js +0 -1
- package/dist/packem_shared/watch-loop-jmQQl2Qe.js +0 -11
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var We=Object.defineProperty;var k=(e,t)=>We(e,"name",{value:t,configurable:!0});import{createRequire as Ue}from"node:module";import{bc as _,bd as U,be as T,bf as A,bg as G,bh as te,bi as Pe,bj as ne,bk as Te,bl as se,bm as re,bn as ie,bo as ze,bp as Me,bq as Ie,br as Re,bs as Fe,bt as Ne,bu as Be,bv as qe,bw as De,bx as Ve,by as Ge,bz as Qe,bA as Je,bB as Ke,bC as He,bD as Ye,bE as oe,bF as S,bG as Xe,bH as Ze,t as et,m as tt,p as nt,b0 as st}from"./bin.js";import{z as ue,M as pe,B as N}from"../packem_shared/readFileSync-DseCu8sg-DEq4Fn3a.js";const Se=Ue(import.meta.url),M=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_e=k(e=>{if(typeof M<"u"&&M.versions&&M.versions.node){const[t,n]=M.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return M.getBuiltinModule(e)}return Se(e)},"__cjs_getBuiltinModule"),{createRequire:rt}=_e("node:module");var it=Object.defineProperty,ot=k((e,t)=>it(e,"name",{value:t,configurable:!0}),"e$2");const at=ot((e,t)=>typeof e!="string"||e===""?"":(t?.locale?e[0].toLocaleLowerCase(t.locale):e[0].toLowerCase())+e.slice(1),"a");var lt=Object.defineProperty,y=k((e,t)=>lt(e,"name",{value:t,configurable:!0}),"g");const ct=rt(import.meta.url),I=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ft=y(e=>{if(typeof I<"u"&&I.versions&&I.versions.node){const[t,n]=I.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return I.getBuiltinModule(e)}return ct(e)},"V"),{stripVTControlCharacters:ut}=ft("node:util"),Q=new _(1e3),pt=/[.*+?^${}()|[\]\\]/g,ht=y(e=>{const t=e.join("");if(Q.has(t)){const r=Q.get(t);return r.lastIndex=0,r}const n=e.map(r=>r.replaceAll(pt,String.raw`\$&`)).join("|"),s=new RegExp(n,"g");return Q.set(t,s),s},"Le"),mt=y(e=>{const t=[];let n=0,s;for(U.lastIndex=0;(s=U.exec(e))!==null;)s.index>n&&t.push(e.slice(n,s.index)),t.push(s[0]),n=U.lastIndex;return n<e.length&&t.push(e.slice(n)),t.filter(Boolean)},"Ce"),dt=/[ČŠŽĐ]/i,he=new Uint8Array(128),me=new Uint8Array(128),de=new Uint8Array(128);for(let e=0;e<128;e++)he[e]=e>=65&&e<=90?1:0,me[e]=e>=97&&e<=122?1:0,de[e]=e>=48&&e<=57?1:0;const J=y(e=>he[e],"j"),ae=y(e=>me[e],"O"),K=y(e=>de[e],"w"),W=y((e,t,n,s,r)=>{if(e.length===0)return[];let i=!1;const l=Object.values(t);for(const f of l)if(f(e[0])){i=!0;break}if(!i&&!n)return[e];const a=[...e],h=[];let o=a[0],p="other";const m=Object.entries(t);for(const f of m){const[u,g]=f;if(g(a[0])){p=u;break}}let c=n&&s?a[0]===a[0].toLocaleUpperCase(s):!1;for(let f=1;f<a.length;f++){const u=a[f];let g="other";for(const $ of m){const[v,j]=$;if(j(u)){g=v;break}}const b=n&&s?u===u.toLocaleUpperCase(s):!1;let d=!1;r?d=r(p,g,c,b,u,f,a):(p!==g&&p!=="other"&&g!=="other"&&(d=!0),n&&g!=="other"&&!c&&b&&(d=!0)),d?(h.push(o),o=u):o+=u,p=g,n&&(c=b)}return o&&o.length>0&&h.push(o),h.length>0?h:[e]},"k"),gt=y((e,t,n,s)=>{if(n.size===0)return t;for(const r of n)if(e.startsWith(r,t))return s.push(r),t+r.length;return t},"Ue"),ge=y((e,t=new Set)=>{if(e.length===0)return[];if(e.toUpperCase()===e)return[e];let n=0;const s=[],r=e.length;for(let i=1;i<r;i++){const l=gt(e,n,t,s);if(l!==n){n=l,i=n-1;continue}const a=e.codePointAt(i-1),h=e.codePointAt(i),o=a&&a<128&&J(a),p=h&&h<128&&J(h),m=a&&a<128&&ae(a),c=a&&a<128&&K(a),f=h&&h<128&&K(h);if(m&&p){s.push(e.slice(n,i)),n=i;continue}if(c&&!f||!c&&f){s.push(e.slice(n,i)),n=i;continue}if(f&&!c){let u=!1,g=!1;if(i+1<r){const b=e.codePointAt(i+1);u=b&&b<128&&J(b),g=b&&b<128&&K(b)}if(!g&&u){s.push(e.slice(n,i),e.slice(i,i+1)),n=i+1;continue}}if(i+1<r){const u=e.codePointAt(i+1),g=u&&u<128&&ae(u);if(o&&p&&g){const b=e.slice(n,i+1);t.has(b)||(s.push(e.slice(n,i)),n=i)}}}return n<r&&s.push(e.slice(n)),s.filter(i=>i!=="")},"D"),be=y((e,t,n)=>{if(e.length===0)return[];const s=e===e.toLocaleUpperCase(t);if(t.startsWith("de")){if(!s&&e.replaceAll("ß","SS")===e.toLocaleUpperCase(t))return[e];const o=[...e],p=o.length,m=[];let c=o[0],f=o[0]===o[0].toLocaleUpperCase(t),u=f,g=f?0:-1;for(let b=1;b<p;b++){const d=o[b],$=d===d.toLocaleUpperCase(t);if($===f)c+=d;else if($)c&&c.length>0&&(m.push(c),c=d),u=!0,g=b;else{if(u&&b-g>1){const v=o[b-1],j=c.slice(0,-1);j&&j.length>0&&m.push(j),c=v+d}else c+=d;u=!1,g=-1}f=$}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(!T.test(e)&&!A.test(e))return[e];const o=[...e],p=o.length,m=[];let c=o[0];const f=o[0];let u;T.test(f)?u=1:A.test(f)?u=2:u=0;let g=f===f.toLocaleUpperCase(t);for(let d=1;d<p;d++){const $=o[d];let v;T.test($)?v=1:A.test($)?v=2:v=0;const j=$===$.toLocaleUpperCase(t);u!==v&&(u===1||u===2)&&(v===1||v===2)||v===u&&!g&&j?(m.push(c),c=$):c+=$,u=v,g=j}c&&c.length>0&&m.push(c);const b=[];for(let d=0;d<m.length;d++)d<m.length-1&&m[d].length===1&&A.test(m[d])&&T.test(m[d+1][0])?(b.push(m[d]+m[d+1]),d+=1):b.push(m[d]);return b}if(t.startsWith("el")){if(!G.test(e)&&!A.test(e))return[e];const o=[];te.lastIndex=0;let p;for(;(p=te.exec(e))!==null;)o.push(p[0]);o.length===0&&o.push(e);const m=[];if(o.length===1){const c=o[0];if(!c||!G.test(c[0])||c.length===1)return[c??e]}for(const c of o){if(!c)continue;if(!G.test(c[0])||c.length===1){m.push(c);continue}const f=c.length;let u=c[0],g=c[0]===c[0].toLocaleUpperCase(t);for(let b=1;b<f;b++){const d=c[b],$=d===d.toLocaleUpperCase(t);!g&&$?(m.push(u),u=d):u+=d,g=$}u&&m.push(u)}return m}if(t.startsWith("ja")||t.startsWith("ko")){const o=t.startsWith("ja"),p=o?{hiragana:y(c=>Te.test(c),"hiragana"),kanji:y(c=>ne.test(c),"kanji"),katakana:y(c=>Pe.test(c),"katakana"),latin:y(c=>A.test(c),"latin")}:{hangul:y(c=>se.test(c),"hangul"),latin:y(c=>A.test(c),"latin")},m=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(o){const c=W(e,p,!1,t,(u,g)=>u==="hiragana"&&g==="katakana"||u==="katakana"&&g==="hiragana"||u==="hiragana"&&g==="latin"||u==="katakana"&&g==="latin"||u==="kanji"&&g==="latin"||u==="latin"&&(g==="hiragana"||g==="katakana"||g==="kanji")),f=[];for(const u of c){const g=u;g.length===1&&m.has(g)&&f.length>0?f[f.length-1]=f.at(-1)+g:f.push(g)}return f.length>0?f:[e]}return W(e,p,!1,t,(c,f)=>c==="hangul"&&f==="latin"||c==="latin"&&f==="hangul")}if(t.startsWith("sl")){const o=[...e],p=o.length,m=[];let c=o[0],f=o[0]===o[0].toLocaleUpperCase(t);for(let u=1;u<p;u++){const g=o[u],b=g===g.toLocaleUpperCase(t),d=dt.test(g),$=u<p-1&&o[u+1]===o[u+1].toLocaleUpperCase(t);!f&&b||d&&$?(m.push(c),c=g,d&&$&&(m.push(c),c="")):c+=g,f=b}return c&&c.length>0&&m.push(c),m}if(t.startsWith("zh"))return W(e,{han:y(o=>ne.test(o),"han"),latin:y(o=>A.test(o),"latin")},!1,t);if(["ar","fa","he","ur"].includes(t.split("-")[0])){const o=y(p=>re.test(p)||ie.test(p),"s");return W(e,{latin:y(p=>A.test(p),"latin"),rtl:y(p=>o(p),"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 o=y(p=>ze.test(p)||Me.test(p)||Ie.test(p)||Re.test(p)||Fe.test(p)||Ne.test(p)||Be.test(p)||qe.test(p)||De.test(p)||Ve.test(p)||Ge.test(p)||Qe.test(p)||Je.test(p)||Ke.test(p)||He.test(p)||Ye.test(p),"s");return W(e,{indic:y(p=>o(p),"indic"),latin:y(p=>A.test(p),"latin")},!1,t)}if(["be","bg","ru","sr","uk"].includes(t))return W(e,{cyrillic:y(o=>T.test(o),"cyrillic"),latin:y(o=>A.test(o),"latin")},!0,t);if(["ar","fa","he"].includes(t))return W(e,{latin:y(o=>A.test(o),"latin"),rtl:y(o=>re.test(o)||ie.test(o),"rtl")},!1,t);if(t.startsWith("ko"))return W(e,{hangul:y(o=>se.test(o),"hangul"),latin:y(o=>A.test(o),"latin")},!1,t);if(t.startsWith("uz")){if(!T.test(e)&&!A.test(e))return[e];const o=[...e],p=o.length,m=[];let c=o[0],f=o[0]===o[0].toLocaleUpperCase(t);for(let u=1;u<p;u++){const g=o[u],b=g===g.toLocaleUpperCase(t);if(oe.test(g)||oe.test(o[u-1])){c+=g;continue}!f&&b?(m.push(c),c=g):c+=g,f=b}return c&&c.length>0&&m.push(c),m}const r=[...e],i=r.length,l=[];let a=r[0],h=r[0]===r[0].toLocaleUpperCase(t);for(const o of n)if(e.startsWith(o)){l.push(o),a=r[o.length],h=a===a.toLocaleUpperCase(t);break}for(let o=1;o<i;o++){const p=r[o],m=p===p.toLocaleUpperCase(t);let c=0;for(const f of n)if(e.startsWith(f,o)){l.push(a,f),c=f.length,a="";const u=f.at(-1);u&&(h=u===u.toLocaleUpperCase(t));break}if(c>0){o+=c-1;continue}!h&&m?(l.push(a),a=p):a+=p,h=m}return a&&l.push(a),l},"q"),bt=y((e,t,n)=>{const s=[],r=S.test(e)?e.split(S).filter(Boolean):[e];for(const i of r){const l=i;if(S.test(l))s.push(l);else{U.lastIndex=0;const a=U.test(l)?mt(l).filter(Boolean):[l];for(const h of a)if(U.lastIndex=0,U.test(h))s.push(h);else if(t){const o=t.toLowerCase().split("-")[0];s.push(...be(h,o,n))}else s.push(...ge(h,n))}}return s},"Ie"),q=y((e,t={})=>{if(!e||typeof e!="string")return[];const{handleAnsi:n=!1,handleEmoji:s=!1,knownAcronyms:r=[],locale:i,normalize:l=!1,separators:a,stripAnsi:h=!1,stripEmoji:o=!1}=t,p=new Set([...r].toSorted((d,$)=>$.length-d.length));let m=e;h&&(m=ut(m)),o&&(m=Xe(m));let c;Array.isArray(a)?c=ht(a):a instanceof RegExp?c=a:c=Ze;const f=[];let u=m;const g=c.flags.includes("g")?c:new RegExp(c.source,`${c.flags}g`);for(;u.length>0;){const d=g.exec(u);if(!d){u===".."?f.push(".."):u==="."?f.push("."):u.length>0&&f.push(u);break}const $=d.index,v=d[0],j=v.length,F=u.slice(0,$),Oe=u.slice($+j);if(v.startsWith("../"))f.push(".."),u=u.slice($+3);else if(v.startsWith("./"))f.push("."),u=u.slice($+2);else if($===0&&v==="..")f.push(".."),u=u.slice(2);else if($===0&&v===".")f.push("."),u=u.slice(1);else{F.length>0&&f.push(F);let L=0;for(;(L=v.indexOf("../",L))!==-1;)f.push(".."),L+=3;for(L=0;(L=v.indexOf("./",L))!==-1;)(L===0||v[L-1]!==".")&&f.push("."),L+=2;let O=Oe;for(;O.startsWith("../");)f.push(".."),O=O.slice(3);for(;O.startsWith("./");)f.push("."),O=O.slice(2);if(O===".."){f.push("..");break}else if(O==="."){f.push(".");break}else u=O}g.lastIndex=0}if(f.length===0){const d=m.split(c).filter(Boolean);f.push(...d)}let b=[];for(const d of f)n||s?b.push(...bt(d,i,p)):i?b.push(...be(d,i,p)):b.push(...ge(d,p));return l&&(b=b.map(d=>p.has(d)?d:i&&d===d.toLocaleUpperCase(i)?d[0]+d.slice(1).toLocaleLowerCase(i):d.toUpperCase()===d&&!p.has(d)?d.slice(0,1)+d.slice(1).toLowerCase():d)),b},"be");var yt=Object.defineProperty,$t=k((e,t)=>yt(e,"name",{value:t,configurable:!0}),"l$4");const X=$t((e,t)=>typeof e!="string"||e===""?"":(t?.locale?e[0].toLocaleUpperCase(t.locale):e[0].toUpperCase())+e.slice(1),"a");var vt=Object.defineProperty,wt=k((e,t)=>vt(e,"name",{value:t,configurable:!0}),"r$2");const D=wt((e,t)=>`${e}::${t?.joiner??""}::${t?.locale??""}::${t?.knownAcronyms?.join(",")??""}::${t?.normalize?"true":"false"}`,"r");var jt=Object.defineProperty,kt=k((e,t)=>jt(e,"name",{value:t,configurable:!0}),"p$4");const V=kt((e,t)=>{const{length:n}=e;if(n===0)return"";if(n===1)return e[0];const s=[];let r="",i="";for(let l=0;l<n;l++){const a=e[l];if(S.test(a)){r?(s.push(r+i+a),r="",i=""):(s.length>0&&s.push(t),r=a);continue}r?(i&&(i+=t),i+=a):(s.length>0&&s.push(t),s.push(a))}return s.join("")},"p");var At=Object.defineProperty,Ct=k((e,t)=>At(e,"name",{value:t,configurable:!0}),"e$1");const xt=/(?<![a-zß])SS(?![a-z])/g,Z=Ct(e=>e.replaceAll(xt,"ß"),"l");var Et=Object.defineProperty,Lt=k((e,t)=>Et(e,"name",{value:t,configurable:!0}),"p$2");const Ot=new _(1e3),Wt=Lt((e,t)=>{if(typeof e!="string"||!e)return"";const n=t?.cache??!1,s=t?.cacheStore??Ot;let r;if(n&&(r=D(e,t)),n&&r&&s.has(r))return s.get(r);let i=!0;const l=V(q(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(a=>{if(t?.handleAnsi&&S.test(a))return a;const h=t?.locale?.startsWith("de")?Z(a):a,o=t?.locale?h.toLocaleLowerCase(t.locale):h.toLowerCase();return i?(i=!1,at(o,t)):X(o,t)}),"");return n&&r&&s.set(r,l),l},"R");var Ut=Object.defineProperty,St=k((e,t)=>Ut(e,"name",{value:t,configurable:!0}),"l$2");const _t=new _(1e3),ee=St((e,t)=>{if(typeof e!="string")return"";const n=t?.cache??!1,s=t?.cacheStore??_t;let r;if(n&&(r=D(e,t)),n&&r&&s.has(r))return s.get(r);const i=q(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(a=>{if(t?.handleAnsi&&S.test(a))return a;if(t?.toUpperCase)return t.locale?a.toLocaleUpperCase(t.locale):a.toUpperCase();const h=t?.locale?.startsWith("de")?Z(a):a;return t?.locale?h.toLocaleLowerCase(t.locale):h.toLowerCase()}),l=V(i,t?.joiner??"-");return n&&r&&s.set(r,l),l},"L");var Pt=Object.defineProperty,Tt=k((e,t)=>Pt(e,"name",{value:t,configurable:!0}),"r$1");const zt=new _(1e3),Mt=Tt((e,t)=>ee(e,{cacheStore:zt,...t,joiner:"_",toUpperCase:!0}),"m");var It=Object.defineProperty,Rt=k((e,t)=>It(e,"name",{value:t,configurable:!0}),"l$1");const Ft=new _(1e3),Nt=Rt((e,t)=>{if(typeof e!="string"||!e)return"";const n=t?.cache??!1,s=t?.cacheStore??Ft;let r;if(n&&(r=D(e,t)),n&&r&&s.has(r))return s.get(r);const i=V(q(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&&S.test(l))return l;const a=t?.locale?.startsWith("de")?Z(l):l;return X(t?.locale?a.toLocaleLowerCase(t.locale):a.toLowerCase(),{locale:t?.locale})}),"");return n&&r&&s.set(r,i),i},"L");var Bt=Object.defineProperty,qt=k((e,t)=>Bt(e,"name",{value:t,configurable:!0}),"r");const Dt=new _(1e3),Vt=qt((e,t)=>ee(e,{cacheStore:Dt,...t,joiner:"_"}),"n");var Gt=Object.defineProperty,Qt=k((e,t)=>Gt(e,"name",{value:t,configurable:!0}),"a$1");const Jt=new _(1e3),Kt=Qt((e,t)=>{if(typeof e!="string")return"";const n=t?.cache??!1,s=t?.cacheStore??Jt;let r;if(n&&(r=D(e,t)),n&&r&&s.has(r))return s.get(r);const i=V(q(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=>X(l,{locale:t?.locale})),"-");return n&&r&&s.set(r,i),i},"y");var Ht=Object.defineProperty,C=k((e,t)=>Ht(e,"name",{value:t,configurable:!0}),"e");const x=C(e=>e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"||typeof e=="bigint"?String(e):JSON.stringify(e),"stringify"),H={camel_case:C(e=>Wt(x(e)),"camel_case"),kebab_case:C(e=>ee(x(e)),"kebab_case"),lower_case:C(e=>x(e).toLowerCase(),"lower_case"),pascal_case:C(e=>Nt(x(e)),"pascal_case"),path_join:C((e,...t)=>{const n=[x(e),...t.map(s=>x(s))];return pe(...n)},"path_join"),path_relative:C((e,t)=>ue(x(t),x(e)),"path_relative"),snake_case:C(e=>Vt(x(e)),"snake_case"),upper_case:C(e=>x(e).toUpperCase(),"upper_case"),upper_kebab_case:C(e=>Kt(x(e)),"upper_kebab_case"),upper_snake_case:C(e=>Mt(x(e)),"upper_snake_case")};C(e=>Object.hasOwn(H,e),"isKnownFilter");const ye=C((e,t,n=[])=>{const s=H[e];if(!s)throw new Error(`Unknown filter "${e}". Known filters: ${Object.keys(H).sort().join(", ")}.`);return s(t,...n)},"applyFilter");var Yt=Object.defineProperty,$e=k((e,t)=>Yt(e,"name",{value:t,configurable:!0}),"d$1");const ve=$e(e=>{const t=[];let n=0,s=0,r,i=-1;for(const l of e){if(i+=1,r){l===r&&(r=void 0);continue}if(l==='"'||l==="'"){r=l;continue}l==="("?n+=1:l===")"?n-=1:l===","&&n===0&&(t.push(e.slice(s,i)),s=i+1)}return t.push(e.slice(s)),t},"splitCommaOutsideQuotes"),Xt=$e(e=>{if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return e.slice(1,-1)},"stripQuotes");var Zt=Object.defineProperty,P=k((e,t)=>Zt(e,"name",{value:t,configurable:!0}),"s$1");const en=/\[([^\]]+)\]/g,tn=P(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 s=t.slice(0,n).trim(),r=t.slice(n+1,-1).trim();return r===""?{args:[],name:s}:{args:ve(r).map(i=>{const l=i.trim();return Xt(l)??l}),name:s}},"parseFilterCall"),nn=P(e=>{const t=e.split("|").map(s=>s.trim()),n=t[0]??"";if(!n)throw new Error(`Empty variable name in expression "${e}"`);return{filters:t.slice(1).map(s=>tn(s)),name:n}},"parsePipe"),sn=P(e=>e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"||typeof e=="bigint"?String(e):JSON.stringify(e),"stringify"),rn=P((e,t)=>{const n=e.replaceAll(en,(s,r)=>{const{filters:i,name:l}=nn(r);if(!Object.hasOwn(t,l))throw new Error(`Variable "${l}" used in filename "${e}" but not defined`);let a=t[l];for(const h of i)a=ye(h.name,a,h.args);return sn(a)});return we(n)},"interpolateFilename"),we=P(e=>e.split("/").map(t=>t.endsWith(".tera")||t.endsWith(".twig")?t.slice(0,-5):t).join("/"),"stripTeraSuffix"),on=P(e=>e.endsWith(".raw")?e.slice(0,-4):e,"stripRawSuffix"),an=P(e=>{const t=e.split("/");return(t.at(-1)??"").startsWith("_")?!0:t.slice(0,-1).includes("partials")},"isPartialPath");var ln=Object.defineProperty,cn=k((e,t)=>ln(e,"name",{value:t,configurable:!0}),"i");const fn=cn((e,t)=>{if(!e.startsWith(`---
|
|
1
|
+
import{y as U,m as I,I as K,v as b}from"../packem_shared/index-BDmTbWX1.js";import{b8 as N,b9 as A,ba as x,u as Q,p as X,aY as Z}from"./bin.js";const ee=(e,t)=>typeof e!="string"||e===""?"":e[0].toLowerCase()+e.slice(1),k=(e,t)=>typeof e!="string"||e===""?"":(t?.locale?e[0].toLocaleUpperCase(t.locale):e[0].toUpperCase())+e.slice(1),te=(e,t)=>`${e}::${t?.joiner??""}::${t?.locale??""}::${t?.knownAcronyms?.join(",")??""}::${t?.normalize?"true":"false"}`,$=(e,t)=>{const{length:r}=e;if(r===0)return"";if(r===1)return e[0];const n=[];let i="",o="";for(let s=0;s<r;s++){const l=e[s];if(N.test(l)){i?(n.push(i+o+l),i="",o=""):(n.length>0&&n.push(t),i=l);continue}i?(o&&(o+=t),o+=l):(n.length>0&&n.push(t),n.push(l))}return n.join("")},ne=/(?<![a-zß])SS(?![a-z])/g,re=e=>e.replaceAll(ne,"ß"),ie=(e,t)=>{if(typeof e!="string"||!e)return"";let r=!0;return $(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(i=>{const o=i,s=o.toLowerCase();return r?(r=!1,ee(s)):k(s,t)}),"")},oe=new x(1e3),S=(e,t)=>{if(typeof e!="string")return"";const r=t?.cache??!1,n=t?.cacheStore??oe;let i;if(r&&(i=te(e,t)),r&&i&&n.has(i))return n.get(i);const o=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(l=>{if(t?.handleAnsi&&N.test(l))return l;if(t?.toUpperCase)return t.locale?l.toLocaleUpperCase(t.locale):l.toUpperCase();const a=t?.locale?.startsWith("de")?re(l):l;return t?.locale?a.toLocaleLowerCase(t.locale):a.toLowerCase()}),s=$(o,t?.joiner??"-");return r&&i&&n.set(i,s),s},se=new x(1e3),le=(e,t)=>S(e,{cacheStore:se,...t,joiner:"_",toUpperCase:!0}),ae=(e,t)=>typeof e!="string"||!e?"":$(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(n=>k(n.toLowerCase(),{locale:t?.locale})),""),ce=new x(1e3),fe=(e,t)=>S(e,{cacheStore:ce,...t,joiner:"_"}),ue=(e,t)=>typeof e!="string"?"":$(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(n=>k(n,{locale:t?.locale})),"-"),m=e=>e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"||typeof e=="bigint"?String(e):JSON.stringify(e),T={camel_case:e=>ie(m(e)),kebab_case:e=>S(m(e)),lower_case:e=>m(e).toLowerCase(),pascal_case:e=>ae(m(e)),path_join:(e,...t)=>{const r=[m(e),...t.map(n=>m(n))];return I(...r)},path_relative:(e,t)=>U(m(t),m(e)),snake_case:e=>fe(m(e)),upper_case:e=>m(e).toUpperCase(),upper_kebab_case:e=>ue(m(e)),upper_snake_case:e=>le(m(e))},z=(e,t,r=[])=>{const n=T[e];if(!n)throw new Error(`Unknown filter "${e}". Known filters: ${Object.keys(T).sort().join(", ")}.`);return n(t,...r)},R=e=>{const t=[];let r=0,n=0,i,o=-1;for(const s of e){if(o+=1,i){s===i&&(i=void 0);continue}if(s==='"'||s==="'"){i=s;continue}s==="("?r+=1:s===")"?r-=1:s===","&&r===0&&(t.push(e.slice(n,o)),n=o+1)}return t.push(e.slice(n)),t},pe=e=>{if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return e.slice(1,-1)},me=/\[([^\]]+)\]/g,de=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(),i=t.slice(r+1,-1).trim();return i===""?{args:[],name:n}:{args:R(i).map(o=>{const s=o.trim();return pe(s)??s}),name:n}},he=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=>de(n)),name:r}},ye=e=>e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"||typeof e=="bigint"?String(e):JSON.stringify(e),ge=(e,t)=>{const r=e.replaceAll(me,(n,i)=>{const{filters:o,name:s}=he(i);if(!Object.hasOwn(t,s))throw new Error(`Variable "${s}" used in filename "${e}" but not defined`);let l=t[s];for(const a of o)l=z(a.name,l,a.args);return ye(l)});return P(r)},P=e=>e.split("/").map(t=>t.endsWith(".tera")||t.endsWith(".twig")?t.slice(0,-5):t).join("/"),we=e=>e.endsWith(".raw")?e.slice(0,-4):e,be=e=>{const t=e.split("/");return(t.at(-1)??"").startsWith("_")?!0:t.slice(0,-1).includes("partials")},Ee=(e,t)=>{if(!e.startsWith(`---
|
|
2
2
|
`)&&!e.startsWith(`---\r
|
|
3
|
-
`))return{body:e};const
|
|
4
|
-
---`,3);if(
|
|
5
|
-
`&&(
|
|
6
|
-
`)?5:4,
|
|
7
|
-
`&&(s+=1)},"advanceLine");for(const i of e.matchAll(pn)){const l=i.index??0;if(l>n){const o=e.slice(n,l);t.push({line:s,type:"text",value:o}),r(o)}const a=s,h=i[0];h.startsWith("{{")?t.push({line:a,type:"expr",value:(i[1]??"").trim()}):t.push({line:a,type:"stmt",value:(i[2]??"").trim()}),r(h),n=l+h.length}if(n<e.length){const i=e.slice(n);t.push({line:s,type:"text",value:i})}return t},"tokenize"),hn=new Set(["block","endblock","endfilter","endmacro","extends","filter","import","macro","set"]),ke=w((e,t)=>{let n=0;const s=w((i,l)=>{throw new Error(`${t}:${i}: ${l}`)},"error"),r=w(i=>{const l=[];for(;n<e.length;){const a=e[n];if(a.type==="text"){l.push({type:"text",value:a.value}),n+=1;continue}if(a.type==="expr"){l.push({expression:a.value,line:a.line,type:"expr"}),n+=1;continue}const h=a.value.split(/\s+/)[0]??"";if(i.includes(h))return l;if(hn.has(h)&&s(a.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"){n+=1;const o=a.value.slice(2).trim(),p=r(["else","endif"]);let m;n<e.length&&e[n].type==="stmt"&&e[n].value.split(/\s+/)[0]==="else"&&(n+=1,m=r(["endif"])),(n>=e.length||e[n].type!=="stmt"||e[n].value.split(/\s+/)[0]!=="endif")&&s(a.line,"Unterminated {% if %} — missing {% endif %}"),n+=1,l.push({alternate:m,condition:o,consequent:p,line:a.line,type:"if"});continue}if(h==="for"){n+=1;const o=a.value.slice(3).trim(),p=o.indexOf(" in ");p===-1&&s(a.line,"Malformed {% for %} — expected `for <name> in <collection>`");const m=o.slice(0,p).trim(),c=o.slice(p+4).trim();(!m||!c)&&s(a.line,"Malformed {% for %} — missing binding or collection");const f=r(["endfor"]);(n>=e.length||e[n].type!=="stmt"||e[n].value.split(/\s+/)[0]!=="endfor")&&s(a.line,"Unterminated {% for %} — missing {% endfor %}"),n+=1,l.push({binding:m,body:f,collection:c,line:a.line,type:"for"});continue}if(h==="include"){n+=1;const o=a.value.slice(7).trim(),p=Ae(o);p===void 0&&s(a.line,"Malformed {% include %} — expected a quoted partial name"),l.push({line:a.line,name:p,type:"include"});continue}s(a.line,`Unknown tag "{% ${h} %}". Supported: if, for, include.`)}return l},"parseBlock");return r([])},"parse"),Ae=w(e=>{if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return e.slice(1,-1)},"stripQuotes"),mn=w(e=>e==null?"":typeof e=="boolean"||typeof e=="number"?String(e):typeof e=="string"?e:JSON.stringify(e),"stringify"),dn=w(e=>e==null||e===!1||e===0||e===""?!1:Array.isArray(e)?e.length>0:!0,"isTruthy"),Ce=w((e,t,n,s,r=!0)=>{const i=e.split(".");if(r&&i.length>0&&!Object.hasOwn(t,i[0]))throw new Error(`${s}:${n}: Variable "${e}" is not defined`);let l=t;for(const a of i){if(l==null)return;if(typeof l!="object")throw new TypeError(`${s}:${n}: Cannot read "${a}" on non-object value`);l=l[a]}return l},"lookupVariable"),gn=w(e=>{const t=[];let n=0,s=0,r;for(let i=0;i<e.length;i+=1){const l=e[i];if(r){l===r&&(r=void 0);continue}if(l==='"'||l==="'"){r=l;continue}l==="("?n+=1:l===")"?n-=1:l==="|"&&n===0&&(t.push(e.slice(s,i)),s=i+1)}return t.push(e.slice(s)),t},"splitFilterPipe"),bn=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 s=t.slice(0,n).trim(),r=t.slice(n+1,-1).trim();return r?{args:ve(r).map(i=>i.trim()),name:s}:{args:[],name:s}},"parseFilterCall"),B=w((e,t,n,s,r=!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):Ce(i,t,n,s,r)},"evaluatePrimary"),xe=w((e,t,n,s,r=!0)=>{const i=gn(e),l=i[0].trim();let a=B(l,t,n,s,r);for(let h=1;h<i.length;h+=1){const o=i[h].trim(),{args:p,name:m}=bn(o),c=p.map(f=>B(f,t,n,s,r));try{a=ye(m,a,c)}catch(f){const u=f instanceof Error?f.message:String(f);throw new Error(`${s}:${n}: ${u}`,{cause:f})}}return a},"evaluateExpression"),Ee=w((e,t)=>{let n,s=0;for(let r=0;r<=e.length-t.length;r+=1){const i=e[r];if(n){i===n&&(n=void 0);continue}if(i==='"'||i==="'"){n=i;continue}if(i==="("){s+=1;continue}if(i===")"){s-=1;continue}if(s===0&&e.slice(r,r+t.length)===t)return r}return-1},"findOperatorOutsideQuotes"),le=w((e,t)=>{const n=[];let s=0,r=0;for(;r<=e.length-t.length;){const i=Ee(e.slice(r),t);if(i===-1)break;n.push(e.slice(s,r+i)),r+=i+t.length,s=r}return n.push(e.slice(s)),n},"splitLogical"),z=w((e,t,n,s)=>{const r=e.trim();if(r==="")return!1;if(r.startsWith("(")&&r.endsWith(")")&&yn(r)===r.length-1)return z(r.slice(1,-1),t,n,s);const i=le(r," or ");if(i.length>1)return i.some(a=>z(a,t,n,s));const l=le(r," and ");if(l.length>1)return l.every(a=>z(a,t,n,s));if(r.startsWith("not "))return!z(r.slice(4),t,n,s);for(const a of["==","!="]){const h=Ee(r,a);if(h!==-1){const o=B(r.slice(0,h),t,s,n,!1),p=B(r.slice(h+a.length),t,s,n,!1),m=o===p;return a==="=="?m:!m}}return dn(xe(r,t,s,n,!1))},"evaluateConditionExpression"),yn=w(e=>{if(e[0]!=="(")return-1;let t=0,n,s=-1;for(const r of e){if(s+=1,n){r===n&&(n=void 0);continue}if(r==='"'||r==="'"){n=r;continue}if(r==="(")t+=1;else if(r===")"&&(t-=1,t===0))return s}return-1},"matchingParen"),R=w((e,t)=>{let n="";for(const s of e){if(s.type==="text"){n+=s.value;continue}if(s.type==="expr"){n+=mn(xe(s.expression,t.scope,s.line,t.filename));continue}if(s.type==="if"){const r=z(s.condition,t.scope,t.filename,s.line)?s.consequent:s.alternate??[];n+=R(r,t);continue}if(s.type==="for"){const r=Ce(s.collection,t.scope,s.line,t.filename,!1);if(r==null)continue;if(!Array.isArray(r))throw new TypeError(`${t.filename}:${s.line}: {% for %} expected an array, got ${typeof r}`);for(const i of r){const l={...t.scope,[s.binding]:i};n+=R(s.body,{...t,scope:l})}continue}if(s.type==="include"){const r=t.partials?.get(s.name);if(!r)throw new Error(`${t.filename}:${s.line}: Partial "${s.name}" not found. Available: ${[...t.partials?.keys()??[]].join(", ")||"(none)"}`);const i=t.includeStack??new Set;if(i.has(s.name)){const l=[...i,s.name].join(" → ");throw new Error(`${t.filename}:${s.line}: Circular partial include detected: ${l}`)}i.add(s.name);try{n+=R(r,{...t,filename:`<partial:${s.name}>`,includeStack:i})}finally{i.delete(s.name)}}}return n},"renderNodes"),$n=w((e,t)=>ke(je(e),t),"parseTemplate");w((e,t)=>R(e,t),"renderAst");const Y=w((e,t)=>R(ke(je(e),t.filename),t),"renderTemplate");var vn=Object.defineProperty,E=k((e,t)=>vn(e,"name",{value:t,configurable:!0}),"s");const ce="template.yml",wn=".raw",jn=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"]),kn=new Set(["Brewfile","CHANGELOG","CODEOWNERS","CONTRIBUTING","COPYING","Dockerfile","Gemfile","LICENCE","LICENSE","Makefile","NOTICE","Procfile","Rakefile","README","VERSION"]),An=E(e=>{const t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\")),n=t===-1?e:e.slice(t+1),s=n.lastIndexOf(".");return s===-1||s===0?"":n.slice(s).toLowerCase()},"lastDot"),Le=E(e=>{const t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t===-1?e:e.slice(t+1)},"basename"),Cn=E(e=>{const t=An(e);if(t!=="")return jn.has(t);const n=Le(e);return kn.has(n)},"isLikelyText"),xn=E(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"),En=E(e=>e.replaceAll("\\","/").replace(/^\.\//,"").replaceAll(/\/+/g,"/"),"normalizeDestinationPath"),Ln=E((e,t,n)=>{const s=t.split("/").filter(Boolean);if(s.length===0)throw new Error("Empty destination path for value");let r=e;for(let i=0;i<s.length-1;i+=1){const l=s[i],a=r[l];if(a===void 0){const h={};r[l]=h,r=h}else if(typeof a=="object"&&!Buffer.isBuffer(a))r=a;else throw new TypeError(`Path conflict: "${s.slice(0,i+1).join("/")}" is both a file and a directory`)}r[s.at(-1)]=n},"flattenFiles"),fe=E((e,t,n)=>{if(typeof e!="string")return On(e);const s=e.includes("{{")||e.includes("{%")?Y(e,{filename:`${n}#frontmatter`,scope:t}):e;return z(s,t,`${n}#frontmatter`,1)},"evaluateGate"),On=E(e=>e==null||e===!1||e===0||e===""?!1:Array.isArray(e)?e.length>0:typeof e=="string"?e!=="false"&&e!=="0":!0,"truthyValue"),Tn=E((e,t)=>{const n=pe(e,ce),s=et(n);if(!s||typeof s!="object")throw new Error(`${n}: must contain a YAML mapping`);const r={};if(s.variables)for(const[h,o]of Object.entries(s.variables))r[h]=xn(o);const i=new Map,l=[];for(const h of tt(e,{includeDirs:!1,includeSymlinks:!1})){if(h.path===n)continue;const o=ue(e,h.path).replaceAll("\\","/");if(o===ce)continue;if(an(o)){const m=N(h.path),c=$n(m,o);for(const f of Wn(o))i.has(f)&&i.get(f)!==c&&nt.warn(`partial name "${f}" is declared by multiple files — last one wins. Use distinct names or fully-qualified includes.`),i.set(f,c);continue}if(o.endsWith(wn)){const m=N(h.path);l.push({binary:null,isRaw:!0,rawText:m,relativePath:o});continue}if(Cn(o)){const m=N(h.path);l.push({binary:null,isRaw:!1,rawText:m,relativePath:o});continue}const p=N(h.path,{buffer:!0});l.push({binary:p,isRaw:!1,rawText:null,relativePath:o})}const a=E(h=>{const o={...h.builtins,...h.options},p={},m={};for(const f of l){const u=f.relativePath;let g,b,d=!1;if(f.binary)g=f.binary;else if(f.isRaw)g=f.rawText??"";else{const v=f.rawText??"",j=fn(v,F=>st(F));if(j.frontmatter){if(j.frontmatter.skip!==void 0&&fe(j.frontmatter.skip,o,u)||j.frontmatter.if!==void 0&&!fe(j.frontmatter.if,o,u))continue;typeof j.frontmatter.to=="string"&&(b=Y(j.frontmatter.to,{filename:`${u}#frontmatter.to`,partials:i,scope:o})),j.frontmatter.force===!0&&(d=!0)}g=Y(j.body,{filename:u,partials:i,scope:o})}const $=En(b??rn(on(u),o));Ln(p,$,g),d&&(m[$]={force:!0})}const c={files:p};return Object.keys(m).length>0&&(c.filesMeta=m),c},"produce");return{about:{description:s.description??`Moon-format template at ${e}`,name:s.title??t},destination:s.destination,options:r,produce:a}},"loadMoonTemplate"),Wn=E(e=>{const t=we(e),n=Le(t),s=new Set([n,t]);if(n.startsWith("_")){s.add(n.replace(/^_+/,""));const r=t.slice(0,t.length-n.length);s.add(`${r}${n.replace(/^_+/,"")}`)}return[...s]},"partialKeys");export{Tn 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 i=e.startsWith(`---\r
|
|
6
|
+
`)?5:4,o=e.slice(i,r).replaceAll("\r","");let s;try{s=t(o)}catch(l){const a=l instanceof Error?l.message:String(l);throw new Error(`Failed to parse frontmatter YAML: ${a}`,{cause:l})}if(s==null)return{body:e.slice(n)};if(typeof s!="object"||Array.isArray(s))throw new TypeError(`Frontmatter must be a YAML mapping, got ${Array.isArray(s)?"array":typeof s}`);return{body:e.slice(n),frontmatter:s}},ve=/\{\{-?(.+?)-?\}\}|\{%-?(.+?)-?%\}/gs,q=e=>{const t=[];let r=0,n=1;const i=o=>{for(const s of o)s===`
|
|
7
|
+
`&&(n+=1)};for(const o of e.matchAll(ve)){const s=o.index??0;if(s>r){const c=e.slice(r,s);t.push({line:n,type:"text",value:c}),i(c)}const l=n,a=o[0];a.startsWith("{{")?t.push({line:l,type:"expr",value:(o[1]??"").trim()}):t.push({line:l,type:"stmt",value:(o[2]??"").trim()}),i(a),r=s+a.length}if(r<e.length){const o=e.slice(r);t.push({line:n,type:"text",value:o})}return t},Ae=new Set(["block","endblock","endfilter","endmacro","extends","filter","import","macro","set"]),F=(e,t)=>{let r=0;const n=(o,s)=>{throw new Error(`${t}:${o}: ${s}`)},i=o=>{const s=[];for(;r<e.length;){const l=e[r];if(l.type==="text"){s.push({type:"text",value:l.value}),r+=1;continue}if(l.type==="expr"){s.push({expression:l.value,line:l.line,type:"expr"}),r+=1;continue}const a=l.value.split(/\s+/)[0]??"";if(o.includes(a))return s;if(Ae.has(a)&&n(l.line,`Tera feature "{% ${a} %}" is not supported. Supported: if/else/endif, for/endfor, include. Rewrite the template to avoid macros, set, extends, block, and import.`),a==="if"){r+=1;const c=l.value.slice(2).trim(),p=i(["else","endif"]);let f;r<e.length&&e[r].type==="stmt"&&e[r].value.split(/\s+/)[0]==="else"&&(r+=1,f=i(["endif"])),(r>=e.length||e[r].type!=="stmt"||e[r].value.split(/\s+/)[0]!=="endif")&&n(l.line,"Unterminated {% if %} — missing {% endif %}"),r+=1,s.push({alternate:f,condition:c,consequent:p,line:l.line,type:"if"});continue}if(a==="for"){r+=1;const c=l.value.slice(3).trim(),p=c.indexOf(" in ");p===-1&&n(l.line,"Malformed {% for %} — expected `for <name> in <collection>`");const f=c.slice(0,p).trim(),d=c.slice(p+4).trim();(!f||!d)&&n(l.line,"Malformed {% for %} — missing binding or collection");const u=i(["endfor"]);(r>=e.length||e[r].type!=="stmt"||e[r].value.split(/\s+/)[0]!=="endfor")&&n(l.line,"Unterminated {% for %} — missing {% endfor %}"),r+=1,s.push({binding:f,body:u,collection:d,line:l.line,type:"for"});continue}if(a==="include"){r+=1;const c=l.value.slice(7).trim(),p=G(c);p===void 0&&n(l.line,"Malformed {% include %} — expected a quoted partial name"),s.push({line:l.line,name:p,type:"include"});continue}n(l.line,`Unknown tag "{% ${a} %}". Supported: if, for, include.`)}return s};return i([])},G=e=>{if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return e.slice(1,-1)},$e=e=>e==null?"":typeof e=="boolean"||typeof e=="number"?String(e):typeof e=="string"?e:JSON.stringify(e),je=e=>e==null||e===!1||e===0||e===""?!1:Array.isArray(e)?e.length>0:!0,B=(e,t,r,n,i=!0)=>{const o=e.split(".");if(i&&o.length>0&&!Object.hasOwn(t,o[0]))throw new Error(`${n}:${r}: Variable "${e}" is not defined`);let s=t;for(const l of o){if(s==null)return;if(typeof s!="object")throw new TypeError(`${n}:${r}: Cannot read "${l}" on non-object value`);s=s[l]}return s},xe=e=>{const t=[];let r=0,n=0,i;for(let o=0;o<e.length;o+=1){const s=e[o];if(i){s===i&&(i=void 0);continue}if(s==='"'||s==="'"){i=s;continue}s==="("?r+=1:s===")"?r-=1:s==="|"&&r===0&&(t.push(e.slice(n,o)),n=o+1)}return t.push(e.slice(n)),t},ke=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(),i=t.slice(r+1,-1).trim();return i?{args:R(i).map(o=>o.trim()),name:n}:{args:[],name:n}},v=(e,t,r,n,i=!0)=>{const o=e.trim();if(o==="true")return!0;if(o==="false")return!1;if(o==="null"||o==="none")return null;const s=G(o);return s!==void 0?s:/^-?\d+(?:\.\d+)?$/.test(o)?Number(o):B(o,t,r,n,i)},Y=(e,t,r,n,i=!0)=>{const o=xe(e),s=o[0].trim();let l=v(s,t,r,n,i);for(let a=1;a<o.length;a+=1){const c=o[a].trim(),{args:p,name:f}=ke(c),d=p.map(u=>v(u,t,r,n,i));try{l=z(f,l,d)}catch(u){const y=u instanceof Error?u.message:String(u);throw new Error(`${n}:${r}: ${y}`,{cause:u})}}return l},D=(e,t)=>{let r,n=0;for(let i=0;i<=e.length-t.length;i+=1){const o=e[i];if(r){o===r&&(r=void 0);continue}if(o==='"'||o==="'"){r=o;continue}if(o==="("){n+=1;continue}if(o===")"){n-=1;continue}if(n===0&&e.slice(i,i+t.length)===t)return i}return-1},_=(e,t)=>{const r=[];let n=0,i=0;for(;i<=e.length-t.length;){const o=D(e.slice(i),t);if(o===-1)break;r.push(e.slice(n,i+o)),i+=o+t.length,n=i}return r.push(e.slice(n)),r},g=(e,t,r,n)=>{const i=e.trim();if(i==="")return!1;if(i.startsWith("(")&&i.endsWith(")")&&Se(i)===i.length-1)return g(i.slice(1,-1),t,r,n);const o=_(i," or ");if(o.length>1)return o.some(l=>g(l,t,r,n));const s=_(i," and ");if(s.length>1)return s.every(l=>g(l,t,r,n));if(i.startsWith("not "))return!g(i.slice(4),t,r,n);for(const l of["==","!="]){const a=D(i,l);if(a!==-1){const c=v(i.slice(0,a),t,n,r,!1),p=v(i.slice(a+l.length),t,n,r,!1),f=c===p;return l==="=="?f:!f}}return je(Y(i,t,n,r,!1))},Se=e=>{if(e[0]!=="(")return-1;let t=0,r,n=-1;for(const i of e){if(n+=1,r){i===r&&(r=void 0);continue}if(i==='"'||i==="'"){r=i;continue}if(i==="(")t+=1;else if(i===")"&&(t-=1,t===0))return n}return-1},E=(e,t)=>{let r="";for(const n of e){if(n.type==="text"){r+=n.value;continue}if(n.type==="expr"){r+=$e(Y(n.expression,t.scope,n.line,t.filename));continue}if(n.type==="if"){const i=g(n.condition,t.scope,t.filename,n.line)?n.consequent:n.alternate??[];r+=E(i,t);continue}if(n.type==="for"){const i=B(n.collection,t.scope,n.line,t.filename,!1);if(i==null)continue;if(!Array.isArray(i))throw new TypeError(`${t.filename}:${n.line}: {% for %} expected an array, got ${typeof i}`);for(const o of i){const s={...t.scope,[n.binding]:o};r+=E(n.body,{...t,scope:s})}continue}if(n.type==="include"){const i=t.partials?.get(n.name);if(!i)throw new Error(`${t.filename}:${n.line}: Partial "${n.name}" not found. Available: ${[...t.partials?.keys()??[]].join(", ")||"(none)"}`);const o=t.includeStack??new Set;if(o.has(n.name)){const s=[...o,n.name].join(" → ");throw new Error(`${t.filename}:${n.line}: Circular partial include detected: ${s}`)}o.add(n.name);try{r+=E(i,{...t,filename:`<partial:${n.name}>`,includeStack:o})}finally{o.delete(n.name)}}}return r},Ce=(e,t)=>F(q(e),t),j=(e,t)=>E(F(q(e),t.filename),t),L="template.yml",Oe=".raw",We=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"]),Te=new Set(["Brewfile","CHANGELOG","CODEOWNERS","CONTRIBUTING","COPYING","Dockerfile","Gemfile","LICENCE","LICENSE","Makefile","NOTICE","Procfile","Rakefile","README","VERSION"]),_e=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()},J=e=>{const t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t===-1?e:e.slice(t+1)},Le=e=>{const t=_e(e);if(t!=="")return We.has(t);const r=J(e);return Te.has(r)},Me=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)}"`)}},Ue=e=>e.replaceAll("\\","/").replace(/^\.\//,"").replaceAll(/\/+/g,"/"),Ie=(e,t,r)=>{const n=t.split("/").filter(Boolean);if(n.length===0)throw new Error("Empty destination path for value");let i=e;for(let o=0;o<n.length-1;o+=1){const s=n[o],l=i[s];if(l===void 0){const a={};i[s]=a,i=a}else if(typeof l=="object"&&!Buffer.isBuffer(l))i=l;else throw new TypeError(`Path conflict: "${n.slice(0,o+1).join("/")}" is both a file and a directory`)}i[n.at(-1)]=r},M=(e,t,r)=>{if(typeof e!="string")return Ne(e);const n=e.includes("{{")||e.includes("{%")?j(e,{filename:`${r}#frontmatter`,scope:t}):e;return g(n,t,`${r}#frontmatter`,1)},Ne=e=>e==null||e===!1||e===0||e===""?!1:Array.isArray(e)?e.length>0:typeof e=="string"?e!=="false"&&e!=="0":!0,qe=(e,t)=>{const r=I(e,L),n=Q(r);if(!n||typeof n!="object")throw new Error(`${r}: must contain a YAML mapping`);const i={};if(n.variables)for(const[a,c]of Object.entries(n.variables))i[a]=Me(c);const o=new Map,s=[];for(const a of K(e,{includeDirs:!1,includeSymlinks:!1})){if(a.path===r)continue;const c=U(e,a.path).replaceAll("\\","/");if(c===L)continue;if(be(c)){const f=b(a.path),d=Ce(f,c);for(const u of ze(c))o.has(u)&&o.get(u)!==d&&X.warn(`partial name "${u}" is declared by multiple files — last one wins. Use distinct names or fully-qualified includes.`),o.set(u,d);continue}if(c.endsWith(Oe)){const f=b(a.path);s.push({binary:null,isRaw:!0,rawText:f,relativePath:c});continue}if(Le(c)){const f=b(a.path);s.push({binary:null,isRaw:!1,rawText:f,relativePath:c});continue}const p=b(a.path,{buffer:!0});s.push({binary:p,isRaw:!1,rawText:null,relativePath:c})}const l=a=>{const c={...a.builtins,...a.options},p={},f={};for(const u of s){const y=u.relativePath;let w,C,O=!1;if(u.binary)w=u.binary;else if(u.isRaw)w=u.rawText??"";else{const V=u.rawText??"",h=Ee(V,H=>Z(H));if(h.frontmatter){if(h.frontmatter.skip!==void 0&&M(h.frontmatter.skip,c,y)||h.frontmatter.if!==void 0&&!M(h.frontmatter.if,c,y))continue;typeof h.frontmatter.to=="string"&&(C=j(h.frontmatter.to,{filename:`${y}#frontmatter.to`,partials:o,scope:c})),h.frontmatter.force===!0&&(O=!0)}w=j(h.body,{filename:y,partials:o,scope:c})}const W=Ue(C??ge(we(y),c));Ie(p,W,w),O&&(f[W]={force:!0})}const d={files:p};return Object.keys(f).length>0&&(d.filesMeta=f),d};return{about:{description:n.description??`Moon-format template at ${e}`,name:n.title??t},destination:n.destination,options:i,produce:l}},ze=e=>{const t=P(e),r=J(t),n=new Set([r,t]);if(r.startsWith("_")){n.add(r.replace(/^_+/,""));const i=t.slice(0,t.length-r.length);n.add(`${i}${r.replace(/^_+/,"")}`)}return[...n]};export{qe as loadMoonTemplate};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
`);return}
|
|
3
|
-
`),process.exitCode=1;return}
|
|
4
|
-
`);return}if(e.fromCache&&e.stale===!0){
|
|
1
|
+
import{p as r}from"./bin.js";import{c as i,f as a}from"../packem_shared/registry-keys-Bf2zzlcZ.js";const n=async({options:s})=>{if(s.clear){const t=i();if(s.json){process.stdout.write(`${JSON.stringify({cleared:t,refetched:!1},void 0,2)}
|
|
2
|
+
`);return}r.success(t?"Cleared cached npm signing keys.":"No cached npm signing keys to clear.");return}const e=await a({forceRefresh:!0});if(e===void 0){if(s.json){process.stdout.write(`${JSON.stringify({cleared:!1,error:"fetch-failed",refetched:!1},void 0,2)}
|
|
3
|
+
`),process.exitCode=1;return}r.error("Failed to fetch npm signing keys (network error and no cached keys available)."),process.exitCode=1;return}if(s.json){process.stdout.write(`${JSON.stringify({cleared:!1,fromCache:e.fromCache,keyCount:e.keys.length,refetched:!e.fromCache,stale:e.stale??!1},void 0,2)}
|
|
4
|
+
`);return}if(e.fromCache&&e.stale===!0){r.warn(`Network fetch failed — falling back to expired cache (${String(e.keys.length)} keys).`);return}r.success(`Refreshed npm signing keys (${String(e.keys.length)} keys).`)};export{n as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import{createRequire as _}from"node:module";import{ag as x,p as o,ah as B}from"./bin.js";import{w as R}from"../packem_shared/pm-runner-pVihAfxV.js";import{W as V}from"../packem_shared/build-scripts-CCCi8U66.js";import{m as y,f as w}from"../packem_shared/index-BDmTbWX1.js";import{a as W}from"./config.js";const j=_(import.meta.url),v=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,D=c=>{if(typeof v<"u"&&v.versions&&v.versions.node){const[r,f]=v.versions.node.split(".").map(Number);if(r>22||r===22&&f>=3||r===20&&f>=16)return v.getBuiltinModule(c)}return j(c)},{readdirSync:S,statSync:M}=D("node:fs"),q=(c,r={})=>{const f=y(c,"node_modules");if(!w(f))return[];const l=new Map,p=new Set,$=(n,s,t)=>{const e=`${s}@${t}`;if(p.has(e))return;p.add(e);const i=t.startsWith(c)?t.slice(c.length+1):t;let u=l.get(n);u||(u=[],l.set(n,u)),u.some(b=>b.name===s)||u.push({name:s,relativePath:i})},d=(n,s="")=>{let t;try{t=S(n)}catch{return}for(const e of t){const i=y(n,e);if(e.startsWith("@")){d(i,`${e}/`);continue}if(e===".pnpm"&&s===""){let a;try{a=S(i)}catch{continue}for(const m of a){const h=y(i,m,"node_modules");w(h)&&d(h)}continue}if(e.startsWith("."))continue;const u=s+e,b=y(i,"package.json");try{if(!M(i).isDirectory()||!w(b))continue;const a=W(b),m=typeof a.name=="string"?a.name:u;if(typeof a.bin=="string"){const k=m.includes("/")?m.split("/").pop():m;$(k,m,i)}else if(a.bin&&typeof a.bin=="object")for(const k of Object.keys(a.bin))$(k,m,i);const h=y(i,"node_modules");w(h)&&d(h)}catch{}}};d(f);const g=[];for(const[n,s]of l)s.length<2||r[n]===!0||s.every(t=>r[`${t.name}#${n}`]===!0)||g.push({bin:n,packages:s});return g.sort((n,s)=>n.bin.localeCompare(s.bin))},C=new Set(["bun","npm","pnpm","yarn"]),J=({options:c,visConfig:r,workspaceRoot:f})=>{const l=f??process.cwd(),p=R(l),$=r?.security?.policies?.installScripts?.allow??{},d=r?.security?.allowBins??{},g=r?.security?.pinVersions===!0,n=V(l,$,{pinVersions:g}),s=q(l,d),t=r&&C.has(p.name)?x(r,p.name,l):void 0;if(c.json){process.stdout.write(`${JSON.stringify({binConflicts:s,drift:t,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
|
-
`),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:
|
|
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:i}of n.versionDrift)o.info(` ${e} → ${i}`);o.notice(" Update vis.config.ts security.policies.installScripts.allow keys to migrate.")}if(s.length>0){o.info(""),o.warn(` Bin conflicts (${String(s.length)}) — multiple packages expose the same bin name:`);for(const e of s)o.info(` ${e.bin} ← ${e.packages.map(i=>i.name).join(", ")}`);o.notice(" Add the bin (or 'pkg#bin') to vis.config.ts security.allowBins to silence this.")}if(t?.hasDrift){o.info("");for(const e of B(t))o.warn(e)}};export{J as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
${
|
|
3
|
-
${
|
|
4
|
-
${
|
|
1
|
+
import{createRequire as m}from"node:module";import{w as d,M as _}from"../packem_shared/pm-runner-pVihAfxV.js";const w=m(import.meta.url),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,g=e=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[t,r]=o.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return o.getBuiltinModule(e)}return w(e)},{createInterface:y}=g("node:readline"),s="sigstore",$=()=>!!process.stdout.isTTY&&process.env.CI!=="true",v=e=>new Promise(t=>{const r=y({input:process.stdin,output:process.stderr});r.question(`${e} (Y/n) `,i=>{r.close();const n=i.trim().toLowerCase();t(n===""||n==="y"||n==="yes")})}),h=e=>{const t=d(e),r=_(t,{exact:!1,filter:[],global:!1,optional:!1,packages:[s],peer:!1,saveDev:!0,workspace:!1,workspaceRoot:!1},e,console);return Promise.resolve({exitCode:r})},R=()=>{try{return import.meta.resolve(s),!0}catch{return!1}},I=e=>{let t="pnpm";try{t=d(e).name}catch{}switch(t){case"bun":return`bun add -d ${s}`;case"npm":return`npm install -D ${s}`;case"yarn":return`yarn add -D ${s}`;default:return`pnpm add -D ${s}`}},D=()=>import("sigstore"),T=async(e={})=>{const t=e.interactive??$(),r=e.prompt??v,i=e.runInstall??h,n=e.importImpl??D,l=e.workspaceRoot??process.cwd(),a=I(l);try{return await n()}catch(p){const{code:u,message:f}=p;if(!(u==="ERR_MODULE_NOT_FOUND"||u==="MODULE_NOT_FOUND")||!f.includes(s))throw p}if(!t)throw new Error(`${s} is not installed. \`vis attest\` needs it for keyless signing/verification. Install it in your repo first:
|
|
2
|
+
${a}`);if(!await r(`${s} isn't installed. Install it now?`))throw new Error(`${s} install declined. Re-run \`vis attest\` after installing manually:
|
|
3
|
+
${a}`);const c=await i(l);if(c.exitCode!==0)throw new Error(`Install of ${s} failed (exit ${String(c.exitCode)}). Install manually and retry:
|
|
4
|
+
${a}`);return await n()};export{I as installCommandFor,R as isSigstoreInstalled,T as loadOptionalSigstore};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{H as r}from"../packem_shared/index-BDmTbWX1.js";import{createJiti as u}from"jiti";const a=(t,e)=>{if(!e||typeof e!="object")throw new TypeError(`${t}: default export must be an object (got ${e===null?"null":typeof e}). Use createTemplate({ ... }).`);const o=e;if(typeof o.about!="object"||o.about===null)throw new TypeError(`${t}: default export missing required "about" object`);if(typeof o.produce!="function")throw new TypeError(`${t}: default export missing required "produce" function`);return e},f=async t=>{const e=await u(r(t),{fsCache:!1,moduleCache:!1}).import(t,{default:!0,try:!0})??null;return a(t,e)};export{f as loadNativeTemplate};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
`);return}const
|
|
3
|
-
`);return}
|
|
1
|
+
import{p as o}from"./bin.js";import{r as d}from"../packem_shared/advisories-DLeO5KMN.js";const f=async({fs:c,logger:u,options:e,workspaceRoot:s})=>{if(!s)throw new Error("Could not determine workspace root. Run this command inside a workspace.");const r=e.db??d(s),t=e.format==="json";if(!e.force){o.warn(`Prune is destructive. Will remove: ${r}`),o.info("Re-run with --force to proceed."),t&&process.stdout.write(`${JSON.stringify({dbPath:r,reason:"needs --force",removed:!1})}
|
|
2
|
+
`);return}const a=[r,`${r}-wal`,`${r}-shm`,`${r}-journal`],i=[];for(const n of a)try{await c.rm(n,{force:!0}),i.push(n)}catch{}if(t){process.stdout.write(`${JSON.stringify({dbPath:r,files:i,removed:!0})}
|
|
3
|
+
`);return}o.success(`Removed ${r}.`)},w=f;export{w as advisoriesPruneExecute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{p as e,J as n,K as p}from"./bin.js";const w=({options:o,visConfig:l,workspaceRoot:r})=>{const i=r??process.cwd(),a=l?.security?.policies?.installScripts?.allow??{},s=Object.entries(a).filter(([,t])=>t).map(([t])=>t);s.length===0&&!o.rootOnly&&(e.warn("No approved packages in security.policies.installScripts.allow — nothing to run."),!o.withRoot)||(o.rootOnly||n(i,s),(o.withRoot||o.rootOnly)&&p(i))};export{w as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
`);return}if(
|
|
1
|
+
import{s as d,E as i,I as y}from"../packem_shared/Table-CcVkyULl-B_ef6zfS.js";import{p as a}from"./bin.js";import{r as l,g as h}from"../packem_shared/advisories-DLeO5KMN.js";const p=r=>{if(r===0)return"0 B";const n=["B","KB","MB","GB"],t=Math.min(Math.floor(Math.log(r)/Math.log(1024)),n.length-1),o=r/1024**t;return`${o.toFixed(o<10&&t>0?1:0)} ${n[t]}`},v=r=>{if(!r)return"never";const n=Date.parse(r);if(Number.isNaN(n))return r;const t=Date.now()-n;if(t<0)return r;const o=Math.floor(t/6e4);if(o<1)return"just now";if(o<60)return`${o}m ago`;const s=Math.floor(o/60);return s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`},g=async({logger:r,options:n,workspaceRoot:t})=>{if(!t)throw new Error("Could not determine workspace root. Run this command inside a workspace.");const o=n.db??l(t),s=await h(t,o);if(n.format==="json"){process.stdout.write(`${JSON.stringify({dbPath:o,ecosystems:s.ecosystems.map(e=>({advisoryCount:e.advisoryCount,lastSyncIso:e.lastSyncIso,manifestEtag:e.manifestEtag??null,name:e.name})),exists:s.exists,schemaVersion:s.schemaVersion,sizeBytes:s.sizeBytes},void 0,2)}
|
|
2
|
+
`);return}if(a.info(`DB: ${o}`),!s.exists){a.warn(`No advisory DB yet. Run ${d("vis advisories sync")} to populate.`);return}if(a.info(`Schema: v${s.schemaVersion} Size: ${p(s.sizeBytes)}`),s.ecosystems.length===0){a.warn("DB exists but contains no ecosystems. Run `vis advisories sync`.");return}a.info(""),a.info("Ecosystem Advisories Last sync ETag"),a.info(i("────────── ────────── ───────────────── ──────"));for(const e of s.ecosystems){const c=e.name.padEnd(10),f=e.advisoryCount.toLocaleString().padStart(10),m=`${e.lastSyncIso||"never"} (${v(e.lastSyncIso)})`.padEnd(19),u=e.manifestEtag??i("—");a.info(`${y(c)} ${f} ${m} ${u}`)}},S=g;export{S as advisoriesStatusExecute};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
`)}else{const s=i.filter(a=>a.error),
|
|
1
|
+
import{E as g}from"../packem_shared/Table-CcVkyULl-B_ef6zfS.js";import{p as c}from"./bin.js";import{s as $}from"../packem_shared/scan-progress-JBbd9QeT.js";import{s as w,D as v}from"../packem_shared/advisories-DLeO5KMN.js";const S=t=>t?.security?.audit?.advisories??{},D=t=>t?t.split(",").map(r=>r.trim()).filter(r=>r.length>0):["npm"],b=async({logger:t,options:r,visConfig:h,workspaceRoot:d})=>{if(!d)throw new Error("Could not determine workspace root. Run this command inside a workspace.");const l=r.format==="json",u=S(h),m=r.source??u.source??v,p=D(r.ecosystem),y=p.map(s=>({id:s,label:`Sync ${s} advisories`})),n=$(y,{live:!l}),i=[];try{for(const s of p){n.start(s);const o=Date.now();try{const e=await w({allowedHosts:u.allowedHosts,dbPath:r.db,ecosystem:s,force:!!r.force,source:m,workspaceRoot:d});i.push({ecosystem:s,result:e}),e.upToDate?n.finish(s,"ok",`up to date · ${f(Date.now()-o)}`):n.finish(s,"ok",`${e.advisoriesIngested.toLocaleString()} advisories · ${f(e.durationMs)}`)}catch(e){const a=e instanceof Error?e.message:String(e);i.push({ecosystem:s,error:a}),n.finish(s,"error",a)}}}finally{n.stop()}if(l){const s={ecosystems:i.map(o=>({advisoriesIngested:o.result?.advisoriesIngested??0,dbPath:o.result?.dbPath??null,durationMs:o.result?.durationMs??0,ecosystem:o.ecosystem,error:o.error??null,upToDate:o.result?.upToDate??!1})),source:m};process.stdout.write(`${JSON.stringify(s,void 0,2)}
|
|
2
|
+
`)}else{const s=i.filter(a=>a.error),o=i.filter(a=>a.result),e=o[0];e?.result?.dbPath&&c.info(g(`DB: ${e.result.dbPath}`)),s.length===0?c.success(`Synced ${o.length} ecosystem${o.length===1?"":"s"}.`):c.error(`${s.length} ecosystem${s.length===1?"":"s"} failed to sync.`)}i.some(s=>s.error)&&(process.exitCode=1)},f=t=>t>=1e3?`${(t/1e3).toFixed(1)}s`:`${Math.round(t)}ms`,R=b;export{R as advisoriesSyncExecute};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
`);for(const
|
|
1
|
+
import{p as e}from"./bin.js";import{w as u}from"../packem_shared/pm-runner-pVihAfxV.js";import{O as g}from"../packem_shared/native-config-sync-BKAZ0NIs.js";import{S as l}from"../packem_shared/min-release-age-D1alDE3K.js";const y=new Set(["bun","npm","pnpm","yarn"]),k=({options:r,visConfig:c,workspaceRoot:f})=>{const s=f??process.cwd(),n=u(s);if(!y.has(n.name)){e.warn(`Package manager '${n.name}' has no native security config to sync.`);return}if(!c?.security){e.warn("vis.config has no `security` block — nothing to sync.");return}const t=c.security.policies??{},a=Object.fromEntries(Object.entries(t.installScripts?.allow??{}).filter(([,o])=>o)),m=t.firstSeen?.minutes,p=t.firstSeen?.exclude??[],i=[];if(Object.keys(a).length>0&&!r.skipAllowBuilds&&i.push(...g(n.name,s,a)),r.skipMinReleaseAge||i.push(...l(n.name,s,m,p)),i.length===0){e.success("Nothing to sync — vis.config and native PM config are aligned.");return}e.info(`Syncing vis.config security settings to ${n.name} native config…
|
|
2
|
+
`);for(const o of i)e.success(` ${o}`)};export{k as default};
|