@stacksjs/stx 0.2.354 → 0.2.356
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/dist/chunk-0c49cy69.js +2 -0
- package/dist/chunk-0chkqvs1.js +2 -0
- package/dist/chunk-0d6qgbks.js +2 -0
- package/dist/{chunk-84bhnp6p.js → chunk-0dj2gne3.js} +2 -2
- package/dist/{chunk-57atgbyq.js → chunk-0knxnyq6.js} +1 -1
- package/dist/{chunk-m6dstr44.js → chunk-0smr2xjs.js} +2 -2
- package/dist/{chunk-e4g8wz6t.js → chunk-0t1yyn1d.js} +1 -1
- package/dist/{chunk-xvh1k1a4.js → chunk-19m7hed6.js} +1 -1
- package/dist/{chunk-vhta1be7.js → chunk-1nnza3m6.js} +1 -1
- package/dist/chunk-284kattb.js +2 -0
- package/dist/{chunk-n5657hm3.js → chunk-2gtwha4k.js} +1 -1
- package/dist/{chunk-f5veee11.js → chunk-2s3wvns6.js} +1 -1
- package/dist/chunk-2x3zy811.js +2 -0
- package/dist/chunk-38mpg3kn.js +2 -0
- package/dist/chunk-3eya6sbk.js +2 -0
- package/dist/chunk-3f782ywp.js +2 -0
- package/dist/{chunk-mmnf2pac.js → chunk-3kd0zn9c.js} +2 -2
- package/dist/{chunk-avye7h5s.js → chunk-3kyydhzt.js} +1 -1
- package/dist/{chunk-msq8xvhp.js → chunk-3ssjb8cx.js} +309 -312
- package/dist/{chunk-6r3aavbv.js → chunk-3y8vvkar.js} +2 -2
- package/dist/chunk-4ce5ma6a.js +20 -0
- package/dist/{chunk-8cc4vdkh.js → chunk-4gtsf1xw.js} +1 -1
- package/dist/chunk-4mkqzhfh.js +2 -0
- package/dist/{chunk-xj6bcwqa.js → chunk-5270fyk7.js} +1 -1
- package/dist/{chunk-a1knndrh.js → chunk-57kxjr4t.js} +10 -10
- package/dist/chunk-596cftgk.js +2 -0
- package/dist/{chunk-8bxtvsgm.js → chunk-634gaa9d.js} +1 -1
- package/dist/{chunk-pwh8pbks.js → chunk-6gsgayq3.js} +1 -1
- package/dist/{chunk-a8ghkfh6.js → chunk-6qhatdte.js} +2 -2
- package/dist/{chunk-6zrg2mmc.js → chunk-6yfccnr7.js} +2 -2
- package/dist/{chunk-z23sc9p4.js → chunk-79fj9zem.js} +2 -2
- package/dist/{chunk-2ver2s2y.js → chunk-7hb89n3z.js} +1 -1
- package/dist/{chunk-05zfez2g.js → chunk-7jcntsp4.js} +1 -1
- package/dist/{chunk-nf7k53ap.js → chunk-7kw3grq5.js} +1 -1
- package/dist/chunk-7nf8azjh.js +2 -0
- package/dist/{chunk-g5mhck0r.js → chunk-801bg5d8.js} +2 -2
- package/dist/chunk-8wgsjh65.js +2 -0
- package/dist/{chunk-34f8c48f.js → chunk-8xjasa91.js} +1 -1
- package/dist/{chunk-w5j9tbsk.js → chunk-94dz7hrj.js} +1 -1
- package/dist/{chunk-6h3r8v55.js → chunk-9qdn9y72.js} +1 -1
- package/dist/chunk-a6x0czvr.js +2 -0
- package/dist/{chunk-72x62kch.js → chunk-aa8015mk.js} +1 -1
- package/dist/{chunk-64n10kpa.js → chunk-aacfyyya.js} +1 -1
- package/dist/chunk-abtxpqna.js +2 -0
- package/dist/{chunk-c30qnb6z.js → chunk-apbr1kb1.js} +2 -2
- package/dist/{chunk-nm60wh6r.js → chunk-awyyskad.js} +1 -1
- package/dist/{chunk-ppzz953j.js → chunk-b8ywrx2w.js} +1 -1
- package/dist/{chunk-18018jkn.js → chunk-bcpjhcpn.js} +1 -1
- package/dist/{chunk-kw9cgyfc.js → chunk-c17ybabd.js} +1 -1
- package/dist/chunk-c4rpdtvw.js +2 -0
- package/dist/{chunk-zk6ghjnj.js → chunk-c79nfdyj.js} +1 -1
- package/dist/chunk-cgs5xpsn.js +2 -0
- package/dist/{chunk-avwywzsj.js → chunk-czj6nq0b.js} +2 -2
- package/dist/{chunk-9kmhwbwy.js → chunk-czypgdc1.js} +1 -1
- package/dist/{chunk-epqd3eah.js → chunk-degz74nv.js} +2 -2
- package/dist/chunk-dpyc7pht.js +2 -0
- package/dist/{chunk-hay8nwv3.js → chunk-dtdwjpvf.js} +2 -2
- package/dist/{chunk-dsztk2kp.js → chunk-e48050x3.js} +1 -1
- package/dist/{chunk-3nx7z086.js → chunk-ec8jsqgm.js} +3 -3
- package/dist/{chunk-86c461ca.js → chunk-eg8k598q.js} +1 -1
- package/dist/{chunk-bgrkxzr7.js → chunk-ej8mv2k6.js} +1 -1
- package/dist/{chunk-y2f41kaq.js → chunk-ejwfnttb.js} +1 -1
- package/dist/{chunk-ejqpq0wc.js → chunk-emjmshj8.js} +1 -1
- package/dist/{chunk-59906baj.js → chunk-ep034wt0.js} +1 -1
- package/dist/{chunk-njx93b4z.js → chunk-ez003q74.js} +1 -1
- package/dist/{chunk-ws0282jr.js → chunk-f11z7q5g.js} +1 -1
- package/dist/chunk-f3eb1f6z.js +2 -0
- package/dist/{chunk-1z1efvtw.js → chunk-fqq5k9ve.js} +1 -1
- package/dist/{chunk-c0n802j1.js → chunk-frp9fc7j.js} +1 -1
- package/dist/chunk-fzq2n865.js +2 -0
- package/dist/{chunk-g6czgcg4.js → chunk-g1vxsvqv.js} +1 -1
- package/dist/chunk-g3cmkyk2.js +2 -0
- package/dist/{chunk-7r9vgzg4.js → chunk-g7bpkpd4.js} +1 -1
- package/dist/{chunk-at622hg0.js → chunk-gn2qc03b.js} +1 -1
- package/dist/chunk-gxgrzeeh.js +2 -0
- package/dist/{chunk-a9w1ds4w.js → chunk-h99qxgbr.js} +1 -1
- package/dist/{chunk-dgv43ccd.js → chunk-hcf8399w.js} +1 -1
- package/dist/{chunk-hbkjzx1h.js → chunk-hh0aaxxy.js} +1 -1
- package/dist/{chunk-tc4pj651.js → chunk-hkrzv980.js} +2 -2
- package/dist/{chunk-7qp3zphs.js → chunk-hy79zwyy.js} +2 -2
- package/dist/chunk-j6kec9kp.js +2 -0
- package/dist/{chunk-e631svvs.js → chunk-j8wycqve.js} +1 -1
- package/dist/chunk-jmdxn2mq.js +2 -0
- package/dist/chunk-jwmact5f.js +2 -0
- package/dist/{chunk-g7msqva8.js → chunk-jy451jg5.js} +3 -3
- package/dist/{chunk-a959m68j.js → chunk-k33778kc.js} +1 -1
- package/dist/{chunk-wvc7t11n.js → chunk-kaet6r9w.js} +1 -1
- package/dist/chunk-kdmkk0rb.js +2 -0
- package/dist/{chunk-9e20mgwc.js → chunk-kjd9hbg4.js} +3 -3
- package/dist/{chunk-8m0g0h4x.js → chunk-krt45cqy.js} +2 -2
- package/dist/{chunk-2wb3pgp4.js → chunk-kyyt9xhs.js} +1 -1
- package/dist/{chunk-0k1mtwby.js → chunk-mdbj7sq8.js} +1 -1
- package/dist/{chunk-d86q27j8.js → chunk-mere396d.js} +1 -1
- package/dist/{chunk-1c9453w0.js → chunk-ms25gb16.js} +1 -1
- package/dist/{chunk-ym3r8ktq.js → chunk-n0d7nwhd.js} +1 -1
- package/dist/{chunk-7h9fajgs.js → chunk-n1y0hjk1.js} +2 -2
- package/dist/{chunk-bk1zb1xp.js → chunk-n5tpqzcb.js} +1 -1
- package/dist/{chunk-b5hank5e.js → chunk-nybn003d.js} +2 -2
- package/dist/chunk-p1426yar.js +2 -0
- package/dist/chunk-p78b80dp.js +2 -0
- package/dist/chunk-pr3hz3ec.js +2 -0
- package/dist/{chunk-gtqbvt3a.js → chunk-q4kgqqed.js} +2 -2
- package/dist/{chunk-san1eq0r.js → chunk-qbz6yn8c.js} +2 -2
- package/dist/{chunk-fvsefztj.js → chunk-qjvny3wf.js} +1 -1
- package/dist/{chunk-v0e259x2.js → chunk-qnptmtqh.js} +1 -1
- package/dist/{chunk-msywnv5n.js → chunk-qrvey4wk.js} +2 -2
- package/dist/{chunk-7we3xfde.js → chunk-ra1s4s6b.js} +1 -1
- package/dist/{chunk-62nz9v8t.js → chunk-rbfm5sjt.js} +2 -2
- package/dist/{chunk-99b5tfxc.js → chunk-rcbt11p8.js} +1 -1
- package/dist/{chunk-9nrgjtah.js → chunk-rtfwn4cm.js} +1 -1
- package/dist/chunk-rydb5n5b.js +2 -0
- package/dist/{chunk-6k5a03pw.js → chunk-s5dwatkj.js} +2 -2
- package/dist/chunk-sa6cgj9h.js +2 -0
- package/dist/chunk-skdfq4hq.js +2 -0
- package/dist/{chunk-ngjkzaj7.js → chunk-t23kccpz.js} +3 -3
- package/dist/{chunk-89mqnh67.js → chunk-tf16jtj4.js} +1 -1
- package/dist/{chunk-swvm1wgn.js → chunk-trva71am.js} +2 -2
- package/dist/{chunk-rwwfzkz4.js → chunk-tv04k7gq.js} +1 -1
- package/dist/{chunk-5wbdbcvf.js → chunk-v1qm7p7t.js} +2 -2
- package/dist/chunk-w1a8dwgx.js +2 -0
- package/dist/{chunk-y6xzr30x.js → chunk-wkyt4j9e.js} +1 -1
- package/dist/{chunk-p3p4d6g1.js → chunk-wz4fnsat.js} +2 -2
- package/dist/chunk-x131a0jq.js +2 -0
- package/dist/{chunk-f5cw54q3.js → chunk-x21hdhjw.js} +1 -1
- package/dist/chunk-x5b8az2h.js +2 -0
- package/dist/chunk-xk782v5z.js +2 -0
- package/dist/{chunk-qsbjtp60.js → chunk-y4nzmkea.js} +1 -1
- package/dist/{chunk-sqvqwd0p.js → chunk-y4zddt5r.js} +1 -1
- package/dist/{chunk-vgfd9582.js → chunk-ya5m5vbn.js} +1 -1
- package/dist/{chunk-1vb2rj09.js → chunk-yg0qm73a.js} +2 -2
- package/dist/{chunk-8y1ve8tc.js → chunk-ykevda74.js} +2 -2
- package/dist/chunk-ynj1y0qm.js +2 -0
- package/dist/{chunk-v6e35j4g.js → chunk-z50ex86m.js} +1 -1
- package/dist/chunk-z8gccz1q.js +2 -0
- package/dist/{chunk-wj21f1e0.js → chunk-zxfejz72.js} +1 -1
- package/dist/chunk-zxnf0c9x.js +2 -0
- package/dist/cli.js +14 -14
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/database.js +1 -1
- package/dist/engine-bindings.d.ts +35 -0
- package/dist/engine-bindings.js +55 -0
- package/dist/pwa.js +2 -2
- package/dist/ssg.js +2 -2
- package/dist/stx-module-imports.d.ts +24 -0
- package/dist/stx-module-imports.js +57 -0
- package/dist/stx-module.d.ts +154 -0
- package/dist/stx-virtual-ts.d.ts +74 -1
- package/dist/stx-virtual-ts.js +81 -21
- package/dist/typecheck.d.ts +13 -0
- package/dist/typecheck.js +31 -25
- package/dist/variable-extractor.d.ts +2 -22
- package/dist/variable-extractor.js +3 -55
- package/dist/visual-testing.js +1 -1
- package/package.json +7 -6
- package/stx-module.d.ts +154 -0
- package/dist/chunk-04x3vny9.js +0 -19
- package/dist/chunk-1apnswz7.js +0 -2
- package/dist/chunk-1qvf8ase.js +0 -2
- package/dist/chunk-1vt1h19d.js +0 -2
- package/dist/chunk-32x78na8.js +0 -2
- package/dist/chunk-3z4d7kmp.js +0 -2
- package/dist/chunk-4b2vsawv.js +0 -2
- package/dist/chunk-616fn77w.js +0 -2
- package/dist/chunk-70zk8tj2.js +0 -2
- package/dist/chunk-86q2h34b.js +0 -2
- package/dist/chunk-88e14er7.js +0 -2
- package/dist/chunk-8yydz0hk.js +0 -2
- package/dist/chunk-a7yxvxke.js +0 -2
- package/dist/chunk-aanwshk6.js +0 -2
- package/dist/chunk-ahfj7dc7.js +0 -2
- package/dist/chunk-bed5f4bp.js +0 -2
- package/dist/chunk-dxkjvajv.js +0 -2
- package/dist/chunk-e7np0h2q.js +0 -2
- package/dist/chunk-erb294sv.js +0 -2
- package/dist/chunk-evfr2zgg.js +0 -2
- package/dist/chunk-f85f75jh.js +0 -2
- package/dist/chunk-gsc2vds7.js +0 -2
- package/dist/chunk-h5jt4mxx.js +0 -2
- package/dist/chunk-hke0k33t.js +0 -2
- package/dist/chunk-hysq9e9t.js +0 -2
- package/dist/chunk-kq30wqp6.js +0 -2
- package/dist/chunk-m2j5skez.js +0 -2
- package/dist/chunk-ntzzhw3w.js +0 -2
- package/dist/chunk-px0bs815.js +0 -2
- package/dist/chunk-qw92p9za.js +0 -2
- package/dist/chunk-rjwnw5hj.js +0 -2
- package/dist/chunk-tmr3xq5d.js +0 -2
- package/dist/chunk-tpk6wm38.js +0 -2
- package/dist/chunk-vw4b7g24.js +0 -2
- package/dist/chunk-x054qzma.js +0 -2
- package/dist/chunk-x2n1x19t.js +0 -2
- package/dist/chunk-zks9ft7n.js +0 -2
- package/dist/chunk-zkxnarrh.js +0 -2
- package/dist/chunk-zp14ksx1.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Hw as y}from"./chunk-trva71am.js";import N from"fs";import B from"path";var Y="_stx";function L(M){return Bun.hash(M).toString(16).slice(0,8)}function T(M){let C=[],v=(q)=>{for(let g of N.readdirSync(q,{withFileTypes:!0})){let j=B.join(q,g.name);if(g.isDirectory())v(j);else if(g.isFile()&&j.endsWith(".html"))C.push(j)}};if(N.existsSync(M))v(M);return C}var S=[{pattern:/<script\b([^>]*\bdata-stx-runtime\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"runtime",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(M)=>`<script data-stx-runtime src="${M}"></script>`},{pattern:/<script\b([^>]*\bdata-stx-router\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"router",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(M)=>`<script data-stx-router src="${M}"></script>`},{pattern:/<style\b([^>]*\bdata-css=(?:"generated"|'generated')[^>]*)>([\s\S]*?)<\/style>/gi,prefix:"css",extension:"css",contentType:"text/css; charset=utf-8",replace:(M)=>`<link data-css="generated" rel="stylesheet" href="${M}">`}];function _(M,C=`/${Y}`){let v=[],q=new Set,g=0,j=M;for(let G of S)j=j.replace(G.pattern,(R,K,W)=>{if(/\b(?:src|href)\s*=/.test(K)||!W.trim())return R;let Q=`${G.prefix}.${L(W)}.${G.extension}`;if(!q.has(Q))q.add(Q),v.push({filename:Q,contents:W,contentType:G.contentType});return g+=W.length,G.replace(`${C}/${Q}`)});return{html:j,assets:v,bytesInlined:g}}function a(M){let C={pages:0,assets:0,bytesInlined:0},v=B.join(M,Y),q=new Set;for(let g of T(M)){let j=N.readFileSync(g,"utf8"),{html:G,assets:R,bytesInlined:K}=_(j);if(G===j)continue;for(let W of R){if(q.has(W.filename))continue;q.add(W.filename),N.mkdirSync(v,{recursive:!0}),N.writeFileSync(B.join(v,W.filename),W.contents),C.assets++}N.writeFileSync(g,G),C.bytesInlined+=K,C.pages++}return C}import z from"fs";import P from"path";var I=1024,E=/<(script|style)\b([^>]*)>([\s\S]*?)<\/\1>/gi,d=new Set(["","module","text/javascript","application/javascript","module/javascript"]);function b(M){return Bun.hash(M).toString(16).slice(0,8)}function p(M){let C=[],v=(q)=>{for(let g of z.readdirSync(q,{withFileTypes:!0})){let j=P.join(q,g.name);if(g.isDirectory())v(j);else if(g.isFile()&&j.endsWith(".html"))C.push(j)}};if(z.existsSync(M))v(M);return C}function D(M,C){let v=M.match(new RegExp(`\\b${C}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i"));if(!v)return;return v[2]??v[3]??v[4]??""}function m(M,C,v){if(v.length<I)return!1;if(/\b(?:src|href)\s*=/i.test(C))return!1;if(M.toLowerCase()==="script"){if(!d.has((D(C,"type")??"").trim().toLowerCase()))return!1;return!0}return!0}function o(M){let C=[];for(let v of M.matchAll(/<template\b[^>]*>[\s\S]*?<\/template>/gi))C.push([v.index,v.index+v[0].length]);return C}function s(M){let C={pages:0,assets:0,bytesInlined:0},v=p(M);if(v.length<2)return C;let q=new Map,g=new Map;for(let Q of v){let O=z.readFileSync(Q,"utf8");q.set(Q,O);let x=o(O);for(let U of O.matchAll(E)){let[w,V,J,$]=U;if(!m(V,J,$))continue;if(x.some(([A,k])=>U.index>=A&&U.index<k))continue;let H=`${V.toLowerCase()}\x00${$}`,X=g.get(H);if(X)X.push({file:Q,whole:w,tag:V,attrs:J,body:$});else g.set(H,[{file:Q,whole:w,tag:V,attrs:J,body:$}])}}let j=[...g.values()].filter((Q)=>new Set(Q.map((O)=>O.file)).size>1);if(j.length===0)return C;let G=P.join(M,Y),R=new Map(q),K=new Map,W=[];for(let Q of j){let{tag:O,body:x}=Q[0],U=O.toLowerCase()==="script",w=`${U?"chunk":"style"}.${b(x)}.${U?"js":"css"}`;W.push({filename:w,contents:x,contentType:U?"text/javascript; charset=utf-8":"text/css; charset=utf-8"});let V=`/${Y}/${w}`;for(let J of Q){let $=U?`<script${J.attrs} src="${V}"></script>`:`<link${J.attrs} rel="stylesheet" href="${V}">`,H=R.get(J.file),X=H.replace(J.whole,()=>$);if(X===H)continue;R.set(J.file,X),K.set(J.file,(K.get(J.file)??0)+J.body.length)}}z.mkdirSync(G,{recursive:!0});for(let Q of W)z.writeFileSync(P.join(G,Q.filename),Q.contents),C.assets++;for(let[Q,O]of R){if(O===q.get(Q))continue;z.writeFileSync(Q,O),C.pages++,C.bytesInlined+=K.get(Q)??0}return C}y();import Z from"fs";import F from"path";var h="layout-types.d.ts";function f(M){let C=[],v=(q,g)=>{let j;try{j=Z.readdirSync(q,{withFileTypes:!0})}catch{return}for(let G of j){if(G.name.startsWith("."))continue;let R=F.join(q,G.name);if(G.isDirectory())v(R,g?`${g}/${G.name}`:G.name);else if(G.isFile()&&G.name.endsWith(".stx")&&G.name!=="_layout.stx"){let K=G.name.slice(0,-4);C.push(g?`${g}/${K}`:K)}}};return v(M,""),C.sort()}function c(M){let C=["// Auto-generated by stx \u2014 do not edit.","//","// Makes `definePageMeta({ layout })` reject a name with no layout behind it.","// Include this file in your tsconfig (it lives in the stx state directory,","// `.stx/` by default) for the check to apply.",""];if(M.length===0)return C.push("// No layouts found \u2014 `layout` stays typed as `string`.","export {}",""),C.join(`
|
|
3
3
|
`);return C.push("declare module '@stacksjs/stx' {"," interface KnownLayouts {",...M.map((v)=>` '${v}': true`)," }","}","","export {}",""),C.join(`
|
|
4
4
|
`)}function HM(M,C){if(!M)return[];let v=F.isAbsolute(M)?M:F.resolve(process.cwd(),M),q=f(v),g=c(q),j=F.join(C,h);try{if(Z.existsSync(j)&&Z.readFileSync(j,"utf8")===g)return q;Z.mkdirSync(C,{recursive:!0}),Z.writeFileSync(j,g)}catch{}return q}
|
|
5
|
-
export{Y as
|
|
5
|
+
export{Y as vk,_ as wk,a as xk,s as yk,h as zk,f as Ak,c as Bk,HM as Ck};
|
|
@@ -5,4 +5,4 @@ var P=new Map([["craft-button",{name:"Button",zigType:"craft.Button",props:[{nam
|
|
|
5
5
|
${F} [${U.join(`,
|
|
6
6
|
${F} `)}]`:"";return`Craft.create("${j.zigType}", ${Q}${W})`}function s(j,q,F){if(q.target==="universal"){let G=[];G.push("// Universal entry point"),G.push("");for(let[Q,U]of F)G.push(`// --- ${Q.toUpperCase()} ---`),G.push(`#if ${Q.toUpperCase()}`),G.push(U),G.push("#endif"),G.push("");return G.join(`
|
|
7
7
|
`)}return F.get(q.target)||J(j,q)}function r(j,q,F){let G=[];function Q(U){G.push({name:U.zigType,hash:D(JSON.stringify(U.props)),props:Object.keys(U.props),events:Array.from(U.events.keys()),slots:[],isNative:U.zigType.startsWith("craft.")});for(let W of U.children)Q(W)}return Q(q),{version:"1.0.0",components:G,entry:j.id,assets:[],styles:j.styles}}function p(j,q){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}var d=0;function E(){return`id_${++d}`}function D(j){let q=0;for(let F=0;F<j.length;F++){let G=j.charCodeAt(F);q=(q<<5)-q+G,q=q&q}return Math.abs(q).toString(36)}function l(j){return j.charAt(0).toUpperCase()+j.slice(1)}function i(j){let q=[],F=/<script[^>]*>([\s\S]*?)<\/script>/gi,G;while((G=F.exec(j))!==null)q.push(G[1]);return q}function a(j){let q=[],F=/<style[^>]*>([\s\S]*?)<\/style>/gi,G;while((G=F.exec(j))!==null)q.push(G[1]);return q}function B(j){let q=j.type==="component"?1:0;if(j.children)for(let F of j.children)q+=B(F);return q}function b(j){let q=j.zigType.startsWith("craft.")?1:0;for(let F of j.children)q+=b(F);return q}function o(j){return{start:async()=>{console.log("[craft-compiler] Hot reload server started")},stop:async()=>{console.log("[craft-compiler] Hot reload server stopped")},notifyChange:(q)=>{console.log(`[craft-compiler] File changed: ${q}`)}}}var t={compileToNative:k,createHotReloadServer:o,NATIVE_COMPONENTS:P},e=t;
|
|
8
|
-
export{P as
|
|
8
|
+
export{P as Yj,k as Zj,o as _j,e as $j};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{$h as d,Yh as a,Zh as b,_h as c,ai as e,bi as f,ci as g,di as h}from"./chunk-yg0qm73a.js";import"./chunk-0t1yyn1d.js";import"./chunk-emjmshj8.js";export{d as v,a as useForm,g as processHasErrorsDirective,h as processFormValidationDirectives,f as processErrorsDirective,e as processErrorDirective,b as defineForm,c as Validator};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Do as a,Eo as b,Fo as c,Go as d,Ho as e,Io as f,Jo as g,Ko as h,Lo as i,Mo as j,No as k}from"./chunk-3ssjb8cx.js";import"./chunk-ykevda74.js";import"./chunk-ez003q74.js";import"./chunk-kyyt9xhs.js";import"./chunk-tf16jtj4.js";import"./chunk-19m7hed6.js";import"./chunk-kjd9hbg4.js";import"./chunk-ejwfnttb.js";import"./chunk-5270fyk7.js";import"./chunk-q4kgqqed.js";import"./chunk-1nnza3m6.js";import"./chunk-hkrzv980.js";import"./chunk-qbz6yn8c.js";import"./chunk-czj6nq0b.js";import"./chunk-zxfejz72.js";import"./chunk-mere396d.js";import"./chunk-aa8015mk.js";import"./chunk-trva71am.js";import"./chunk-rtfwn4cm.js";import"./chunk-emjmshj8.js";export{b as stripTypeScript,i as splitDeclaration,d as isSyntaxFailure,c as isModuleResolutionFailure,e as isMissingBindingFailure,g as isCompleteImport,k as hasVariables,f as extractVariables,j as extractScriptFromTemplate,h as convertToCommonJS,a as STX_ENGINE_BINDING_NAMES};
|
|
@@ -318,4 +318,4 @@ else {
|
|
|
318
318
|
console.log('[stx] Transition runtime initialized');
|
|
319
319
|
})();
|
|
320
320
|
`}function $(b){let j=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return b.replace(j,(B,q,A,z)=>{let F=A||"300",G=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${q}" data-stx-transition-duration="${F}" data-stx-transition-condition="${z}" data-stx-transition-id="${G}"`})}
|
|
321
|
-
export{W as
|
|
321
|
+
export{W as li,X as mi,Y as ni,Z as oi,_ as pi,$ as qi};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
function D(j){return j}class F{plugins=new Map;sortedPlugins=[];initialized=!1;async register(j,q){if(this.plugins.has(j.name))throw Error(`Plugin "${j.name}" is already registered`);if(j.dependencies){for(let w of j.dependencies)if(!this.plugins.has(w))throw Error(`Plugin "${j.name}" depends on "${w}" which is not registered`)}if(this.plugins.set(j.name,j),j.onRegister)await j.onRegister(q);this.sortPlugins()}async unregister(j){let q=this.plugins.get(j);if(!q)return!1;for(let[w,z]of this.plugins)if(z.dependencies?.includes(j))throw Error(`Cannot unregister "${j}" because "${w}" depends on it`);if(q.onUnregister)await q.onUnregister();return this.plugins.delete(j),this.sortPlugins(),!0}get(j){return this.plugins.get(j)}has(j){return this.plugins.has(j)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let j=[];for(let q of this.sortedPlugins)if(q.registerDirectives)j.push(...q.registerDirectives());return j}getAllFilters(){let j={};for(let q of this.sortedPlugins)if(q.registerFilters)Object.assign(j,q.registerFilters());return j}async runBeforeProcess(j){return this.runHooks("beforeProcess",j)}async runAfterParse(j){return this.runHooks("afterParse",j)}async runBeforeDirective(j,q){return this.runDirectiveHooks("beforeDirective",j,q)}async runAfterDirective(j,q){return this.runDirectiveHooks("afterDirective",j,q)}async runBeforeRender(j){return this.runHooks("beforeRender",j)}async runAfterRender(j){return this.runHooks("afterRender",j)}async runOnError(j){for(let q of this.sortedPlugins)if(q.onError)try{let w=await q.onError(j);if(w){if(w.template!==void 0)j.template=w.template;if(w.context)j.context={...j.context,...w.context};if(w.metadata)j.metadata={...j.metadata,...w.metadata};if(w.skip)return j}}catch(w){console.error(`Error in plugin "${q.name}" onError hook:`,w)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort((j,q)=>(j.priority??100)-(q.priority??100))}async runHooks(j,q){let w={...q};for(let z of this.sortedPlugins){let B=z[j];if(B)try{let y=await B(w);if(y){if(y.template!==void 0)w.template=y.template;if(y.context)w.context={...w.context,...y.context};if(y.metadata)w.metadata={...w.metadata,...y.metadata};if(y.skip)break}}catch(y){console.error(`Error in plugin "${z.name}" ${j} hook:`,y)}}return w}async runDirectiveHooks(j,q,w){let z={...w};for(let B of this.sortedPlugins){let y=B[j];if(y)try{let A=await y(q,z);if(A){if(A.template!==void 0)z.template=A.template;if(A.context)z.context={...z.context,...A.context};if(A.metadata)z.metadata={...z.metadata,...A.metadata};if(A.skip)break}}catch(A){console.error(`Error in plugin "${B.name}" ${j} hook:`,A)}}return z}}var G=new F;function H(j,q,w={}){return{name:j,...w,registerDirectives:()=>q}}function I(j,q,w={}){return{name:j,...w,registerFilters:()=>q}}var J=D({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess(j){console.log("[stx-debug] beforeProcess:",j.filePath)},afterParse(j){console.log("[stx-debug] afterParse:",j.template.length,"chars")},beforeDirective(j,q){console.log("[stx-debug] beforeDirective:",j)},afterDirective(j,q){console.log("[stx-debug] afterDirective:",j)},beforeRender(j){console.log("[stx-debug] beforeRender")},afterRender(j){console.log("[stx-debug] afterRender:",j.template.length,"chars")},onError(j){console.error("[stx-debug] onError:",j.error.message,"in phase:",j.phase)}}),K=D({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess(j){j.metadata.startTime=performance.now()},afterRender(j){let q=j.metadata.startTime;if(q){let w=performance.now()-q;console.log(`[stx-timing] Processing took ${w.toFixed(2)}ms`)}}});function L(j){return D({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(q){return{context:{...q.context,...j}}}})}
|
|
3
|
-
export{D as
|
|
3
|
+
export{D as uh,F as vh,G as wh,H as xh,I as yh,J as zh,K as Ah,L as Bh};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{wj as _}from"./chunk-0t1yyn1d.js";function Y(q,z){let B={};for(let C of q)B[C]=_(z(C));return new Proxy({},{get:(C,G)=>B[G]?.(),set:(C,G,L)=>{if(B[G])B[G].set(L);else B[G]=_(L);return!0},has:(C,G)=>(G in B),deleteProperty:(C,G)=>{return delete B[G],!0},ownKeys:()=>Reflect.ownKeys(B),getOwnPropertyDescriptor:(C,G)=>(G in B)?{enumerable:!0,configurable:!0,writable:!0,value:B[G]()}:void 0})}function T(q,z){let B={};for(let C of z)B[C]=q[C];return B}function $(q,z){let B=Object.keys(q),C=Y(B,(I)=>z?.[I]??q[I].getDefaultValue()),G=Y(B,()=>[]),L=Y(B,()=>!1),W=Y(B,()=>!1),X=Y(B,()=>!1),J=_(!1);async function M(I){X[I]=!0;let Q=await q[I].validate(C[I],C);return G[I]=Q,X[I]=!1,Q.length===0}async function O(){J.set(!0);let I=await Promise.all(B.map(M));return J.set(!1),I.every(Boolean)}function j(){for(let I of B)C[I]=z?.[I]??q[I].getDefaultValue(),G[I]=[],L[I]=!1,W[I]=!1}function A(I){for(let Q of B)if(Q in I)C[Q]=I[Q],W[Q]=!0}function H(I,Q){C[I]=Q,W[I]=!0}function K(I,Q=!0){if(L[I]=Q,Q)M(I)}function U(I){return{value:C[I],errors:G[I],touched:L[I],dirty:W[I],valid:G[I].length===0,validating:X[I]}}function k(I){return async(Q)=>{Q?.preventDefault?.();for(let N of B)L[N]=!0;if(await O())await I(T(C,B))}}return{values:C,errors:G,touched:L,dirty:W,get isValid(){return B.every((I)=>G[I].length===0)},get isValidating(){return J()||B.some((I)=>X[I])},get isDirty(){return B.some((I)=>W[I])},validate:O,validateField:M,reset:j,setValues:A,setFieldValue:H,setFieldTouched:K,getFieldState:U,handleSubmit:k}}var E=$;class Z{rules=[];defaultValue="";addRule(q){let z=new Z;return z.rules=[...this.rules,q],z.defaultValue=this.defaultValue,z}required(q="This field is required"){return this.addRule({name:"required",message:q,validate:(z)=>{if(z===null||z===void 0)return q;if(typeof z==="string"&&z.trim()==="")return q;if(Array.isArray(z)&&z.length===0)return q;return!0}})}email(q="Please enter a valid email"){return this.addRule({name:"email",message:q,validate:(z)=>{if(!z)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(z))||q}})}url(q="Please enter a valid URL"){return this.addRule({name:"url",message:q,validate:(z)=>{if(!z)return!0;try{return new URL(String(z)),!0}catch{return q}}})}min(q,z){let B=z||`Must be at least ${q} characters`;return this.addRule({name:"min",message:B,validate:(C)=>{if(!C)return!0;return String(C).length>=q||B}})}max(q,z){let B=z||`Must be no more than ${q} characters`;return this.addRule({name:"max",message:B,validate:(C)=>{if(!C)return!0;return String(C).length<=q||B}})}length(q,z,B){let C=B||`Must be between ${q} and ${z} characters`;return this.addRule({name:"length",message:C,validate:(G)=>{if(!G)return!0;let L=String(G).length;return L>=q&&L<=z||C}})}pattern(q,z="Invalid format"){return this.addRule({name:"pattern",message:z,validate:(B)=>{if(!B)return!0;return q.test(String(B))||z}})}hasUppercase(q="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,q)}hasLowercase(q="Must contain a lowercase letter"){return this.pattern(/[a-z]/,q)}hasNumber(q="Must contain a number"){return this.pattern(/\d/,q)}hasSpecial(q="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,q)}alphanumeric(q="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,q)}startsWithLetter(q="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,q)}noSpaces(q="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:q,validate:(z)=>{if(!z)return!0;return!String(z).includes(" ")||q}})}number(q="Must be a number"){let z=this.addRule({name:"number",message:q,validate:(B)=>{if(!B&&B!==0)return!0;return!Number.isNaN(Number(B))||q}});return z.defaultValue=0,z}integer(q="Must be a whole number"){return this.addRule({name:"integer",message:q,validate:(z)=>{if(!z&&z!==0)return!0;return Number.isInteger(Number(z))||q}})}positive(q="Must be a positive number"){return this.addRule({name:"positive",message:q,validate:(z)=>{if(!z&&z!==0)return!0;return Number(z)>0||q}})}negative(q="Must be a negative number"){return this.addRule({name:"negative",message:q,validate:(z)=>{if(!z&&z!==0)return!0;return Number(z)<0||q}})}minValue(q,z){let B=z||`Must be at least ${q}`;return this.addRule({name:"minValue",message:B,validate:(C)=>{if(!C&&C!==0)return!0;return Number(C)>=q||B}})}maxValue(q,z){let B=z||`Must be no more than ${q}`;return this.addRule({name:"maxValue",message:B,validate:(C)=>{if(!C&&C!==0)return!0;return Number(C)<=q||B}})}between(q,z,B){let C=B||`Must be between ${q} and ${z}`;return this.addRule({name:"between",message:C,validate:(G)=>{if(!G&&G!==0)return!0;let L=Number(G);return L>=q&&L<=z||C}})}matches(q,z){let B=z||`Must match ${q}`;return this.addRule({name:"matches",message:B,validate:(C,G)=>{if(!G)return!0;return C===G[q]||B}})}oneOf(q,z){let B=z||`Must be one of: ${q.join(", ")}`;return this.addRule({name:"oneOf",message:B,validate:(C)=>{if(!C)return!0;return q.includes(C)||B}})}notOneOf(q,z){let B=z||`Cannot be one of: ${q.join(", ")}`;return this.addRule({name:"notOneOf",message:B,validate:(C)=>{if(!C)return!0;return!q.includes(C)||B}})}date(q="Must be a valid date"){return this.addRule({name:"date",message:q,validate:(z)=>{if(!z)return!0;let B=new Date(String(z));return!Number.isNaN(B.getTime())||q}})}before(q,z){let B=new Date(q),C=z||`Must be before ${B.toLocaleDateString()}`;return this.addRule({name:"before",message:C,validate:(G)=>{if(!G)return!0;return new Date(String(G))<B||C}})}after(q,z){let B=new Date(q),C=z||`Must be after ${B.toLocaleDateString()}`;return this.addRule({name:"after",message:C,validate:(G)=>{if(!G)return!0;return new Date(String(G))>B||C}})}custom(q,z="Invalid value"){return this.addRule({name:"custom",message:z,validate:q})}async(q,z="Invalid value"){return this.addRule({name:"async",message:z,async:!0,validate:q})}when(q,z){let B=new Z;B.rules=[...this.rules],B.defaultValue=this.defaultValue;for(let C of z.getRules())B.rules.push({...C,validate:(G,L)=>{if(!q(G,L||{}))return!0;return C.validate(G,L)}});return B}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default(q){let z=new Z;return z.rules=[...this.rules],z.defaultValue=q,z}async validate(q,z){let B=[];for(let C of this.rules){let G=await C.validate(q,z);if(G!==!0)B.push(G)}return B}validateSync(q,z){let B=[];for(let C of this.rules){if(C.async)continue;let G=C.validate(q,z);if(G!==!0)B.push(G)}return B}}var y=new Z;function w(q,z,B){let C=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return q.replace(C,(G,L,W)=>{try{let X=L.trim().split("."),J=z;for(let O of X)if(J&&typeof J==="object"&&O in J)J=J[O];else return"";let M=J;if(!M||!Array.isArray(M)||M.length===0)return"";return M.map((O)=>{return W.replace(/\{\{\s*message\s*\}\}/g,O)}).join(`
|
|
3
3
|
`)}catch{return""}})}function D(q,z,B){let C=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return q.replace(C,(G,L,W)=>{try{let X=L.trim().split("."),J=z;for(let O of X)if(J&&typeof J==="object"&&O in J)J=J[O];else return"";let M=J;if(!M||!Array.isArray(M)||M.length===0)return"";return M.map((O)=>W.replace(/\{\{\s*message\s*\}\}/g,O)).join(`
|
|
4
|
-
`)}catch{return""}})}function S(q,z,B){let C=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return q.replace(C,(G,L,W)=>{try{let X=L.trim().split("."),J=z;for(let O of X)if(J&&typeof J==="object"&&O in J)J=J[O];else return"";let M=J;if(!M||!Array.isArray(M)||M.length===0)return"";return W}catch{return""}})}function V(q,z,B){let C=q;return C=w(C,z,B),C=D(C,z,B),C=S(C,z,B),C}export{$ as
|
|
4
|
+
`)}catch{return""}})}function S(q,z,B){let C=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return q.replace(C,(G,L,W)=>{try{let X=L.trim().split("."),J=z;for(let O of X)if(J&&typeof J==="object"&&O in J)J=J[O];else return"";let M=J;if(!M||!Array.isArray(M)||M.length===0)return"";return W}catch{return""}})}function V(q,z,B){let C=q;return C=w(C,z,B),C=D(C,z,B),C=S(C,z,B),C}export{$ as Yh,E as Zh,Z as _h,y as $h,w as ai,D as bi,S as ci,V as di};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{ns as i}from"./chunk-ez003q74.js";import{Hu as R,Xu as T,pv as S}from"./chunk-czj6nq0b.js";import{Rw as g}from"./chunk-emjmshj8.js";import k from"path";var O;async function t(){if(O!==void 0)return O;try{O=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{O=null}return O}var y={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},F={},V={},E={};function vq(q){if(q)delete F[q];else for(let X of Object.keys(F))delete F[X]}function fq(){let q=Object.entries(F).map(([X,Q])=>({locale:X,loadedAt:new Date(Q.loadedAt),keyCount:p(Q.translations)}));return{size:Object.keys(F).length,locales:Object.keys(F),entries:q}}function p(q,X=0){for(let Q of Object.values(q))if(X++,Q&&typeof Q==="object"&&!Array.isArray(Q))X=p(Q,X);return X}function e(q,X=0){if(X<=0)return!1;return Date.now()-q.loadedAt>X}function dq(q){if(F[q])return"loaded";return E[q]||"idle"}function gq(q){return E[q]==="loading"}function uq(q){return!!F[q]}async function qq(q,X){let{locales:Q,parallel:H=!0,priority:J={},onLocaleLoaded:Y,onComplete:W,onError:$}=q,Z=H?Q:[...Q].sort((_,z)=>(J[z]||0)-(J[_]||0));if(H){let _=Z.map(async(z)=>{try{await P(z,X),Y?.(z)}catch(G){$?.(z,G instanceof Error?G:Error(String(G)))}});await Promise.all(_)}else for(let _ of Z)try{await P(_,X),Y?.(_)}catch(z){$?.(_,z instanceof Error?z:Error(String(z)))}W?.()}function hq(q,X){queueMicrotask(()=>{qq(q,X).catch((Q)=>{if(X.debug)console.error("Background preload error:",Q)})})}async function P(q,X){if({...y,...X.i18n}.cache&&F[q]){let J=F[q],Y=X.i18n?.cacheMaxAge??0;if(!e(J,Y))return J.translations}if(V[q]?.state==="loading")return V[q].promise;E[q]="loading";let H=b(q,X).then((J)=>{return E[q]="loaded",delete V[q],J}).catch((J)=>{throw E[q]="error",V[q]={promise:H,state:"error",error:J instanceof Error?J:Error(String(J))},J});return V[q]={promise:H,state:"loading"},H}function Hq(q){return F[q]?.translations}async function pq(q,X){let Q=Hq(q);if(Q)return Q;return P(q,X)}async function mq(q,X){if(F[q])return F[q].translations;if(V[q]){if(X)return Promise.race([V[q].promise,new Promise((Q,H)=>setTimeout(()=>H(Error(`Timeout waiting for locale: ${q}`)),X))]);return V[q].promise}throw Error(`Locale "${q}" is not loading. Call loadTranslationLazy first.`)}function cq(){return Object.entries(E).filter(([q,X])=>X==="loading").map(([q])=>q)}function iq(q){if(q)delete V[q],delete E[q];else{for(let X of Object.keys(V))delete V[X];for(let X of Object.keys(E))delete E[X]}}async function b(q,X){let Q={...y,...X.i18n},H=k.isAbsolute(Q.translationsDir)?Q.translationsDir:k.resolve(X.root||process.cwd(),Q.translationsDir);try{let J=await t(),Y=J?await J(q,{translationsDir:H,defaultLocale:Q.defaultLocale,sources:$q(Q.format)}):await Jq(q,Q,H);if(Y===void 0){if(q!==Q.defaultLocale)return b(Q.defaultLocale,X);return{}}let W=Y;if(Q.cache)F[q]={translations:W,loadedAt:Date.now(),locale:q};return W}catch(J){if(X.debug)console.error(`Error loading translation file for locale "${q}":`,J);if(q!==Q.defaultLocale)return b(Q.defaultLocale,X);return{}}}async function Jq(q,X,Q){let H=k.join(Q,`${q}${Qq(X.format)}`);try{let J=await import(H);return J.default||J}catch(J){try{let Y=await Bun.file(H).text();if(X.format==="yaml"||X.format==="yml")return Xq(Y);if(X.format==="json")return JSON.parse(Y);throw J}catch{return}}}function Qq(q){switch(q){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function Xq(q){let X={},Q=q.split(`
|
|
3
3
|
`),H=[{obj:X,indent:-1}];for(let J of Q){let Y=J.replace(/#.*$/,"").trimEnd();if(!Y.trim())continue;let W=Y.search(/\S/);if(W===-1)continue;while(H.length>1&&H[H.length-1].indent>=W)H.pop();let $=H[H.length-1].obj,Z=Y.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(Z){let[,,_,z]=Z,G=_.trim(),w=z.trim();if(w==="")$[G]={},H.push({obj:$[G],indent:W});else $[G]=Zq(w)}}return X}function Zq(q){if(q.startsWith("'")&&q.endsWith("'")||q.startsWith('"')&&q.endsWith('"'))return q.slice(1,-1);let X=q.toLowerCase();if(X==="true"||X==="yes")return!0;if(X==="false"||X==="no")return!1;if(X==="null"||X==="~")return null;let Q=Number(q);if(!Number.isNaN(Q)&&q!=="")return Q;return q}function $q(q){switch(q){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function Wq(q,X){return P(q,X)}function Yq(q,X){for(let Q of q){let H=Q.trim(),J=H.match(/^\{(\d+)\}\s*(.*)$/);if(J){let W=Number.parseInt(J[1],10);if(X===W)return J[2];continue}let Y=H.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(Y){let W=Number.parseInt(Y[1],10),$=Y[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(Y[2],10);if(X>=W&&X<=$)return Y[3];continue}}if(q.length===2)return X===1?q[0].trim():q[1].trim();if(X<q.length)return q[X].trim();return q[q.length-1].trim()}function _q(q,X={}){return m(q,X)}function m(q,X){let Q="",H=0;while(H<q.length)if(q[H]==="{"){let J=zq(q,H);if(J===-1){Q+=q[H],H++;continue}let Y=q.slice(H+1,J);Q+=Gq(Y,X),H=J+1}else if(q[H]==="'"&&H+1<q.length)if(q[H+1]==="'")Q+="'",H+=2;else if(q[H+1]==="{"||q[H+1]==="}")Q+=q[H+1],H+=2;else Q+=q[H],H++;else Q+=q[H],H++;return Q}function zq(q,X){let Q=0;for(let H=X;H<q.length;H++)if(q[H]==="{")Q++;else if(q[H]==="}"){if(Q--,Q===0)return H}return-1}function Gq(q,X){let Q=Bq(q);if(Q.length===0)return`{${q}}`;let H=Q[0].trim(),J=X[H];if(Q.length===1)return J!==void 0?String(J):`{${H}}`;switch(Q[1].trim().toLowerCase()){case"plural":return wq(J,Q.slice(2).join(","),X);case"select":return Dq(J,Q.slice(2).join(","));case"selectordinal":return Kq(J,Q.slice(2).join(","));case"number":return Vq(J,Q[2]?.trim());case"date":return Eq(J,Q[2]?.trim());case"time":return Aq(J,Q[2]?.trim());default:return J!==void 0?String(J):`{${q}}`}}function Bq(q){let X=[],Q="",H=0;for(let J=0;J<q.length;J++){let Y=q[J];if(Y==="{")H++,Q+=Y;else if(Y==="}")H--,Q+=Y;else if(Y===","&&H===0)X.push(Q),Q="";else Q+=Y}if(Q)X.push(Q);return X}function wq(q,X,Q){let H=Number(q)||0,J=C(X),Y=`=${H}`;if(J[Y])return I(J[Y],H,Q);let W=jq(H);if(J[W])return I(J[W],H,Q);if(J.other)return I(J.other,H,Q);return String(H)}function I(q,X,Q){let H=q.replace(/#/g,String(X));return m(H,Q)}function jq(q){let X=Math.abs(q),Q=Math.floor(X),H=String(q).includes(".")?String(q).split(".")[1].length:0;if(Q===1&&H===0)return"one";return"other"}function Dq(q,X){let Q=String(q||""),H=C(X);if(H[Q])return H[Q];return H.other||String(q)}function Kq(q,X){let Q=Number(q)||0,H=C(X),J=Fq(Q);if(H[J])return H[J].replace(/#/g,String(Q));if(H.other)return H.other.replace(/#/g,String(Q));return String(Q)}function Fq(q){let X=Math.abs(q),Q=X%10,H=X%100;if(Q===1&&H!==11)return"one";if(Q===2&&H!==12)return"two";if(Q===3&&H!==13)return"few";return"other"}function C(q){let X={},Q=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,H=Q.exec(q);while(H!==null)X[H[1]]=H[2],H=Q.exec(q);return X}function Vq(q,X){let Q=Number(q);if(Number.isNaN(Q))return String(q);switch(X){case"integer":return Math.floor(Q).toLocaleString();case"percent":return`${(Q*100).toFixed(0)}%`;case"currency":return Q.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Q.toLocaleString()}}function Eq(q,X){let Q=q instanceof Date?q:new Date(String(q));if(Number.isNaN(Q.getTime()))return String(q);let H={};switch(X){case"short":H.dateStyle="short";break;case"medium":H.dateStyle="medium";break;case"long":H.dateStyle="long";break;case"full":H.dateStyle="full";break;default:H.dateStyle="medium"}return Q.toLocaleDateString(void 0,H)}function Aq(q,X){let Q=q instanceof Date?q:new Date(String(q));if(Number.isNaN(Q.getTime()))return String(q);let H={};switch(X){case"short":H.timeStyle="short";break;case"medium":H.timeStyle="medium";break;case"long":H.timeStyle="long";break;case"full":H.timeStyle="full";break;default:H.timeStyle="short"}return Q.toLocaleTimeString(void 0,H)}function Uq(q){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(q)}function L(q,X,Q=!0,H={}){let J=q.split("."),Y=X;for(let $ of J){if(Y===void 0||Y===null)break;Y=Y[$]}if(Y===void 0||Y===null)return Q?q:"";let W=String(Y);if(Uq(W))return _q(W,H);if(W.includes("|")&&"count"in H){let $=Number(H.count),Z=W.split("|");W=Yq(Z,$)}for(let[$,Z]of Object.entries(H)){let _=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");W=W.replace(new RegExp(`:${_}`,"g"),String(Z))}return W}var u=new Set(["ar","arc","ckb","dv","fa","he","khw","ks","nqo","prs","ps","sd","syr","ug","ur","uz-af","yi"]),Mq=new Set(["adlm","arab","aran","hebr","nkoo","rohg","syrc","thaa","yezi"]);function x(q){if(!q)return"ltr";let X=q.trim().toLowerCase().replace(/_/g,"-").split("-"),Q=X[0];if(!Q)return"ltr";let H=X[1]?.length===4?X[1]:void 0;if(H)return Mq.has(H)?"rtl":"ltr";if(X.length>1&&u.has(`${Q}-${X[1]}`))return"rtl";return u.has(Q)?"rtl":"ltr"}function nq(q){return x(q)==="rtl"}async function sq(q,X,Q,H){let J=q,Y=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,W={...y,...H.i18n},$=await Wq(W.locale,H);X.__translations=$,X.__locale=W.locale,X.__i18nConfig=W,J=await h(J,Y,async(z,G,w,K,j)=>{try{let D={};if(w)try{let B=[()=>JSON.parse(w),()=>{let U=`{"data":${w}}`,M=JSON.parse(U);return typeof M.data==="object"?M.data:{}},()=>{return S(w,X)}];for(let U of B)try{if(D=U(),Object.keys(D).length>0)break}catch{}}catch(B){if(H.debug)console.error("Error parsing parameters for @translate directive:",B)}return L(G,$,W.fallbackToKey,D)||K.trim()}catch(D){if(H.debug)console.error("Error processing @translate directive:",D);return T("Translate",`Error in @translate('${G}'): ${D instanceof Error?D.message:String(D)}`,R.EVALUATION_ERROR)}});let Z=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(H.debug){console.warn(`Processing translations in template. Sections: ${J.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let z=[...J.matchAll(Z)];console.warn(`Found ${z.length} @translate matches`),z.forEach((G,w)=>console.warn(`Match ${w}: ${G[0]}, Key: ${G[1]}, Params: ${G[2]||"none"}`))}return J=await h(J,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(z,G,w,K)=>{try{let j={};if(w)try{let D=[()=>JSON.parse(w),()=>{let A=`{"data":${w}}`,B=JSON.parse(A);return typeof B.data==="object"?B.data:{}},()=>{return S(w,X)}];for(let A of D)try{if(j=A(),Object.keys(j).length>0)break}catch{}}catch(D){if(H.debug)console.error("Error parsing parameters for @translate directive:",D)}return L(G,$,W.fallbackToKey,j)}catch(j){if(H.debug)console.error("Error processing @translate directive:",j);return T("Translate",`Error in @translate('${G}'): ${j instanceof Error?j.message:String(j)}`,R.EVALUATION_ERROR)}}),J}async function h(q,X,Q){let H=[];return q.replace(X,(Y,...W)=>{let $=Q(Y,...W).then((Z)=>({match:Y,replacement:Z}));return H.push($),Y}),(await Promise.all(H)).reduce((Y,{match:W,replacement:$})=>Y.replace(W,$),q)}function rq(q,X=!0){return(Q,H={})=>{return L(Q,q,X,H)}}import c from"path";function v(q,X){if(!q||x(q)!=="rtl")return!1;return!X||X.trim().toLowerCase()!=="rtl"}function n(q){if(!q)return!1;return q.trim().split(/\s+/)[0]?.toLowerCase()==="presentation"||q.trim().split(/\s+/)[0]?.toLowerCase()==="none"}function N(q,X){let Q=new RegExp(`\\b${X}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i").exec(q);if(!Q)return null;return Q[2]??Q[3]??Q[4]??null}function eq(q,X,Q,H){let J=q;J=J.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(W,$,Z)=>{let z={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[$]||"Make this element accessible";return`<!-- a11y-hint: ${Z||z} -->`});let Y=/@screenReader\(([^@]*)\)@endScreenReader/g;return J=J.replace(Y,(W,$)=>{return`<span class="sr-only">${$.trim()}</span>`}),J=J.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(W,$,Z)=>{return`<span id="${`desc-${$}`}" class="sr-only">${Z}</span>`}),J}function qH(){return`
|
|
4
4
|
.sr-only {
|
|
5
5
|
position: absolute;
|
|
@@ -13,4 +13,4 @@ import{js as i}from"./chunk-njx93b4z.js";import{Du as R,Tu as T,lv as S}from"./c
|
|
|
13
13
|
border-width: 0;
|
|
14
14
|
}
|
|
15
15
|
`.trim()}function Oq(){return typeof globalThis.document<"u"&&typeof globalThis.document.createElement==="function"}function s(q){let X=new Map,Q=q.replace(/<(\/?)([A-Z][\w:.-]*)(?=[\s/>])/g,(J,Y,W)=>{let $=X.get(W);if(!$)$=`stx-a11y-component-${X.size}`,X.set(W,$);return`<${Y}${$}`}),H=new Map([...X.entries()].map(([J,Y])=>[Y,J]));return{protectedSource:Q,restore:(J)=>J.replace(/<(\/?)(stx-a11y-component-\d+)(?=[\s/>])/g,(Y,W,$)=>{let Z=H.get($);return Z?`<${W}${Z}`:Y})}}function Nq(q,X){let Q=[],H=/<img\s+([^>]*)>/gi,J;J=H.exec(q);while(J!==null){let B=J[1];if(!/\balt\s*=/i.test(B))Q.push({type:"missing-alt",element:J[0].substring(0,100),message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"});J=H.exec(q)}let Y=/<button([^>]*)>\s*<\/button>/gi;J=Y.exec(q);while(J!==null){let B=J[1];if(!/\baria-label\s*=/i.test(B)&&!/\btitle\s*=/i.test(B))Q.push({type:"missing-accessible-name",element:J[0].substring(0,100),message:"Empty button missing accessible name",impact:"critical",help:"Add text content, aria-label, or title",helpUrl:"https://web.dev/learn/accessibility/aria-html/"});J=Y.exec(q)}let W=/<a\s+([^>]*)>\s*<\/a>/gi;J=W.exec(q);while(J!==null){let B=J[1];if(!/\baria-label\s*=/i.test(B)&&!/\btitle\s*=/i.test(B))Q.push({type:"link-missing-text",element:J[0].substring(0,100),message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"});J=W.exec(q)}let $=/<(input|select|textarea)\s+([^>]*)>/gi;J=$.exec(q);while(J!==null){let B=J[2];if(/\btype\s*=\s*["']hidden["']/i.test(B)){J=$.exec(q);continue}let U=/\baria-label\s*=/i.test(B)||/\baria-labelledby\s*=/i.test(B),M=B.match(/\bid\s*=\s*["']([^"']+)["']/i);if(!U){let r=M&&new RegExp(`<label[^>]*\\bfor\\s*=\\s*["']${M[1]}["']`,"i").test(q),f=J.index,d=q.substring(0,f),Lq=q.substring(f),l=(d.match(/<label\b/gi)||[]).length,o=(d.match(/<\/label>/gi)||[]).length,a=l>o;if(!r&&!a)Q.push({type:"input-missing-label",element:J[0].substring(0,100),message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})}J=$.exec(q)}let Z=/<h([1-6])[^>]*>/gi,_=[];J=Z.exec(q);while(J!==null)_.push(Number.parseInt(J[1],10)),J=Z.exec(q);let z=0;for(let B of _){if(z>0&&B>z+1)Q.push({type:"heading-skip",element:`<h${B}>`,message:`Heading level skipped from h${z} to h${B}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});z=B}if(/<html\b/i.test(q)&&!/<html[^>]*\slang\s*=/i.test(q))Q.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});let G=q.match(/<html\b([^>]*)>/i);if(G&&v(N(G[1],"lang"),N(G[1],"dir")))Q.push({type:"missing-dir",element:G[0].substring(0,100),message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});let w=/<table([^>]*)>([\s\S]*?)<\/table>/gi;J=w.exec(q);while(J!==null){let B=J[2];if(!n(N(J[1],"role"))&&!/<th\b/i.test(B))Q.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});J=w.exec(q)}let K=/<(video|audio)[^>]*\sautoplay\s[^>]*>/gi;J=K.exec(q);while(J!==null){if(!/\bmuted\b/i.test(J[0]))Q.push({type:"autoplay-audio",element:`<${J[1]}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"});J=K.exec(q)}let j=/\btabindex\s*=\s*["']([1-9]\d*)["']/gi;J=j.exec(q);while(J!==null)Q.push({type:"positive-tabindex",element:`tabindex="${J[1]}"`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"}),J=j.exec(q);let D=/<iframe\s+([^>]*)>/gi;J=D.exec(q);while(J!==null){let B=J[1];if(!/\btitle\s*=/i.test(B)&&!/\baria-label\s*=/i.test(B))Q.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"});J=D.exec(q)}let A=/<([a-z]+)\s+([^>]*role\s*=\s*["']button["'][^>]*)>/gi;J=A.exec(q);while(J!==null){let B=J[1].toLowerCase(),U=J[2];if(B!=="button"&&!/\btabindex\s*=/i.test(U))Q.push({type:"button-not-focusable",element:J[0].substring(0,100),message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"});J=A.exec(q)}return Q}async function Pq(q,X){let{protectedSource:Q}=s(q);if(!Oq())return Nq(Q,X);let H=[];try{let J=globalThis.document.createElement("div");J.innerHTML=Q,J.querySelectorAll("img").forEach((Z)=>{if(!Z.hasAttribute("alt"))H.push({type:"missing-alt",element:`<${Z.outerHTML}>`,message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"})}),J.querySelectorAll('button, a, [role="button"]').forEach((Z)=>{if(!(Z.hasAttribute("aria-label")||Z.hasAttribute("aria-labelledby")||Z.textContent&&Z.textContent.trim().length>0))H.push({type:"missing-accessible-name",element:`<${Z.outerHTML}>`,message:"Interactive element missing accessible name",impact:"critical",help:"Add text content, aria-label, or aria-labelledby",helpUrl:"https://web.dev/learn/accessibility/aria-html/"})}),J.querySelectorAll("input, select, textarea").forEach((Z)=>{let _=Z.getAttribute("id"),z=_&&J.querySelector(`label[for="${_}"]`),G=Z.hasAttribute("aria-label")||Z.hasAttribute("aria-labelledby"),w=Z.closest("label")!==null;if(!z&&!G&&!w)H.push({type:"input-missing-label",element:`<${Z.outerHTML}>`,message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})});let Y=Array.from(J.querySelectorAll("h1, h2, h3, h4, h5, h6")),W=0;for(let Z of Y){let _=Number.parseInt(Z.tagName.charAt(1));if(W>0&&_>W+1)H.push({type:"heading-skip",element:`<${Z.outerHTML}>`,message:`Heading level skipped from h${W} to h${_}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});W=_}let $=J.querySelector("html");if(Q.includes("<html")&&$&&!$.hasAttribute("lang"))H.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});if($&&v($.getAttribute("lang"),$.getAttribute("dir")))H.push({type:"missing-dir",element:"<html>",message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});if(J.querySelectorAll("a").forEach((Z)=>{let _=Z.textContent&&Z.textContent.trim().length>0,z=Z.hasAttribute("aria-label")||Z.hasAttribute("aria-labelledby"),G=Z.hasAttribute("title"),w=Z.querySelector("img[alt]");if(!_&&!z&&!G&&!w)H.push({type:"link-missing-text",element:`<${Z.outerHTML}>`,message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"})}),Q.includes("<nav")||Q.includes("<header")){if(!J.querySelector('a[href="#main"], a[href="#content"], .skip-link, [class*="skip"]')&&J.querySelectorAll("a").length>5)H.push({type:"missing-skip-link",element:"<nav>",message:"Consider adding a skip navigation link",impact:"minor",help:"Add a skip link to allow keyboard users to bypass navigation",helpUrl:"https://web.dev/learn/accessibility/focus/#skip-links"})}if(J.querySelectorAll("table").forEach((Z)=>{if(n(Z.getAttribute("role")))return;let _=Z.querySelector("caption");if(!Z.querySelector("th"))H.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});if(!_&&!Z.hasAttribute("aria-label")&&!Z.hasAttribute("aria-labelledby"))H.push({type:"table-missing-caption",element:"<table>",message:"Table missing caption or accessible name",impact:"minor",help:"Add a caption element or aria-label to describe the table",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"})}),J.querySelectorAll('[style*="color"]').forEach((Z)=>{let _=Z.getAttribute("style")||"";if(_.includes("color:")&&!_.includes("background"))H.push({type:"potential-contrast-issue",element:`<${Z.tagName.toLowerCase()}>`,message:"Element has inline color style - verify contrast ratio",impact:"minor",help:"Ensure text has sufficient contrast ratio (4.5:1 for normal text)",helpUrl:"https://web.dev/learn/accessibility/color-contrast/"})}),J.querySelectorAll("video[autoplay], audio[autoplay]").forEach((Z)=>{if(!Z.hasAttribute("muted"))H.push({type:"autoplay-audio",element:`<${Z.tagName.toLowerCase()}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"})}),J.querySelectorAll("[tabindex]").forEach((Z)=>{if(Number.parseInt(Z.getAttribute("tabindex")||"0")>0)H.push({type:"positive-tabindex",element:`<${Z.tagName.toLowerCase()}>`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"})}),J.querySelectorAll('[role="button"]').forEach((Z)=>{if(!Z.hasAttribute("tabindex"))H.push({type:"button-not-focusable",element:`<${Z.outerHTML}>`,message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"})}),Q.includes("<body")&&!J.querySelector('main, [role="main"]'))H.push({type:"missing-main-landmark",element:"<body>",message:"Document missing main landmark region",impact:"moderate",help:"Add a main element to identify the primary content",helpUrl:"https://web.dev/learn/accessibility/structure/#landmarks"});J.querySelectorAll("iframe").forEach((Z)=>{if(!Z.hasAttribute("title")&&!Z.hasAttribute("aria-label"))H.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"})})}catch(J){console.error(`Error checking accessibility in ${X}:`,J)}return H}async function Iq(q,X={}){let Q={},{recursive:H=!0,ignorePaths:J=[]}=X,Y=Array.isArray(q)?q:[q],W=await i(Y,{recursive:H,ignorePaths:J}),$=[];for(let Z of W)try{let _=await Bun.file(Z).text();if(Z.endsWith("good-a11y.stx"))continue;let z=await Pq(_,Z);if($.push(Z),z.length>0)Q[Z]=z}catch(_){console.error(`Error scanning ${Z}:`,_)}return{results:Q,scannedFiles:$}}async function HH(q,X={}){return(await Iq(q,X)).results}var Rq={fixMissingAlt:!0,fixMissingLabels:!0,fixMissingFormLabels:!0,fixTableHeaders:!0,fixMissingLang:!0,fixMissingDir:!0,fixPositiveTabindex:!0,fixButtonFocusable:!0,defaultLang:"en"};function Tq(q,X={}){let Q={...Rq,...X},H=[],{protectedSource:J,restore:Y}=s(q),W=J;if(Q.fixMissingAlt)W=W.replace(/<img([^>]*?)(?<!\balt\s*=\s*["'][^"']*["'])(\s*\/?>)/gi,($,Z,_)=>{if(/\balt\s*=/i.test(Z))return $;let z=$,G=`<img${Z} alt=""${_}`;return H.push({type:"missing-alt",description:"Added empty alt attribute to image",before:z,after:G}),G});if(Q.fixMissingLabels)W=W.replace(/<button([^>]*)>\s*<\/button>/gi,($,Z)=>{if(/\baria-label\s*=/i.test(Z)||/\btitle\s*=/i.test(Z))return $;let _=$,z=`<button${Z} aria-label="Button"></button>`;return H.push({type:"missing-accessible-name",description:"Added aria-label to empty button",before:_,after:z}),z}),W=W.replace(/<a([^>]*)>\s*(<(?:i|span|svg)[^>]*(?:class="[^"]*icon[^"]*")?[^>]*>.*?<\/(?:i|span|svg)>)?\s*<\/a>/gi,($,Z,_)=>{if(/\baria-label\s*=/i.test(Z)||/\btitle\s*=/i.test(Z))return $;if(!_&&$.replace(/<a[^>]*>|<\/a>/gi,"").trim())return $;let z=$,G=`<a${Z} aria-label="Link">${_||""}</a>`;return H.push({type:"missing-accessible-name",description:"Added aria-label to link without text",before:z,after:G}),G});if(Q.fixMissingFormLabels)W=W.replace(/<(input|select|textarea)([^>]*)>/gi,($,Z,_)=>{if(/\baria-label\s*=/i.test(_)||/\baria-labelledby\s*=/i.test(_))return $;if(/\btype\s*=\s*["']hidden["']/i.test(_))return $;let z=_.match(/\bname\s*=\s*["']([^"']+)["']/i),G=_.match(/\bid\s*=\s*["']([^"']+)["']/i),w=z?.[1]||G?.[1]||Z,K=$,j=`<${Z}${_} aria-label="${w}">`;return H.push({type:"input-missing-label",description:`Added aria-label to ${Z} element`,before:K,after:j}),j});if(Q.fixMissingLang)W=W.replace(/<html([^>]*)>/gi,($,Z)=>{if(/\blang\s*=/i.test(Z))return $;let _=$,z=`<html${Z} lang="${Q.defaultLang}">`;return H.push({type:"missing-lang",description:`Added lang="${Q.defaultLang}" to html element`,before:_,after:z}),z});if(Q.fixMissingDir)W=W.replace(/<html([^>]*)>/gi,($,Z)=>{let _=N(Z,"lang");if(!v(_,N(Z,"dir")))return $;let z=/\bdir\s*=/i.test(Z)?`<html${Z.replace(/\bdir\s*=\s*(["'])[^"']*\1/i,'dir="rtl"')}>`:`<html${Z} dir="rtl">`;return H.push({type:"missing-dir",description:`Added dir="rtl" to html element (lang="${_}" is right-to-left)`,before:$,after:z}),z});if(Q.fixPositiveTabindex)W=W.replace(/\btabindex\s*=\s*["']([1-9]\d*)["']/gi,($,Z)=>{let _=$,z='tabindex="0"';return H.push({type:"positive-tabindex",description:`Changed tabindex="${Z}" to tabindex="0"`,before:_,after:'tabindex="0"'}),'tabindex="0"'});if(Q.fixButtonFocusable)W=W.replace(/<([a-z]+)(\s[^>]*role\s*=\s*["']button["'][^>]*)>/gi,($,Z,_)=>{if(/\btabindex\s*=/i.test(_))return $;if(Z.toLowerCase()==="button")return $;let z=$,G=`<${Z}${_} tabindex="0">`;return H.push({type:"button-not-focusable",description:'Added tabindex="0" to element with role="button"',before:z,after:G}),G});if(Q.fixTableHeaders)W=W.replace(/<th([^>]*)>/gi,($,Z)=>{if(/\bscope\s*=/i.test(Z))return $;let _=$,z=`<th${Z} scope="col">`;return H.push({type:"table-missing-scope",description:'Added scope="col" to table header',before:_,after:z}),z});return{original:q,fixed:Y(W),fixCount:H.length,fixes:H}}async function Sq(q,X={},Q=!1){let H=await Bun.file(q).text(),J=Tq(H,X);if(Q&&J.fixCount>0)await Bun.write(q,J.fixed);return J}async function JH(q,X={},Q={}){let H={},{recursive:J=!0,ignorePaths:Y=[],writeBack:W=!1,extensions:$=[".stx",".html",".htm"]}=Q,Z=$.length===1?`*${$[0]}`:`*{${$.join(",")}}`,_=c.join(q,J?`**/${Z}`:Z),z=new Bun.Glob(_);for await(let G of z.scan()){if(Y.some((K)=>G.includes(c.normalize(K))))continue;try{let K=await Sq(G,X,W);if(K.fixCount>0)H[G]=K}catch(K){console.error(`Error fixing ${G}:`,K)}}return H}var kq={name:"a11y",handler:(q,X,Q,H)=>{if(!X.length)return q;let J=X[0].replace(/['"]/g,""),Y=X.length>1?X[1].replace(/['"]/g,""):"",$={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[J]||"Make this element accessible";return`<!-- a11y-hint: ${Y||$} -->${q}`},hasEndTag:!1},bq={name:"screenReader",handler:(q)=>{return`<span class="sr-only">${q}</span>`},hasEndTag:!0};function QH(){return[kq,bq]}
|
|
16
|
-
export{y as
|
|
16
|
+
export{y as Dr,vq as Er,fq as Fr,dq as Gr,gq as Hr,uq as Ir,qq as Jr,hq as Kr,P as Lr,Hq as Mr,pq as Nr,mq as Or,cq as Pr,iq as Qr,Wq as Rr,_q as Sr,Uq as Tr,L as Ur,x as Vr,nq as Wr,sq as Xr,rq as Yr,n as Zr,N as _r,eq as $r,qH as as,Oq as bs,Nq as cs,Pq as ds,Iq as es,HH as fs,Tq as gs,Sq as hs,JH as is,kq as js,bq as ks,QH as ls};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Oo as a,Po as b,Qo as c}from"./chunk-3ssjb8cx.js";import"./chunk-ykevda74.js";import"./chunk-ez003q74.js";import"./chunk-kyyt9xhs.js";import"./chunk-tf16jtj4.js";import"./chunk-19m7hed6.js";import"./chunk-kjd9hbg4.js";import"./chunk-ejwfnttb.js";import"./chunk-5270fyk7.js";import"./chunk-q4kgqqed.js";import"./chunk-1nnza3m6.js";import"./chunk-hkrzv980.js";import"./chunk-qbz6yn8c.js";import"./chunk-czj6nq0b.js";import"./chunk-zxfejz72.js";import"./chunk-mere396d.js";import"./chunk-aa8015mk.js";import"./chunk-trva71am.js";import"./chunk-rtfwn4cm.js";import"./chunk-emjmshj8.js";export{b as reportDeferredLoopWarnings,c as processLoops,a as parseLoopBinding};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Nh as a,Oh as b,Ph as c,Qh as d,Rh as e,Sh as f,Th as g,Uh as h,Vh as i,Wh as j,Xh as k}from"./chunk-k33778kc.js";import"./chunk-emjmshj8.js";export{i as processStaticDirectives,b as processPartialHydrationDirectives,h as onHydrated,g as isHydrated,d as hydrateIsland,e as hydrateByStrategy,f as hydrateAll,c as generatePartialHydrationCSS,j as generateIslandManifest,k as default,a as createIslandRegistry};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ue as a}from"./chunk-0smr2xjs.js";import"./chunk-3ssjb8cx.js";import"./chunk-ykevda74.js";import"./chunk-ez003q74.js";import"./chunk-kyyt9xhs.js";import"./chunk-tf16jtj4.js";import"./chunk-19m7hed6.js";import"./chunk-kjd9hbg4.js";import"./chunk-ejwfnttb.js";import"./chunk-5270fyk7.js";import"./chunk-q4kgqqed.js";import"./chunk-1nnza3m6.js";import"./chunk-hkrzv980.js";import"./chunk-qbz6yn8c.js";import"./chunk-czj6nq0b.js";import"./chunk-zxfejz72.js";import"./chunk-mere396d.js";import"./chunk-aa8015mk.js";import"./chunk-trva71am.js";import"./chunk-rtfwn4cm.js";import"./chunk-emjmshj8.js";export{a as startInteractive};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
function A(h){let q=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;h=h.replace(q,(w,j)=>{return`const { ${j.split(",").map((k)=>k.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
|
|
3
3
|
`});let v=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return h=h.replace(v,(w,j)=>{return`const { ${j.split(",").map((k)=>k.trim()).filter(Boolean).join(", ")} } = window.__composables
|
|
4
4
|
`}),h}function B(h){return h.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}
|
|
5
|
-
export{A as
|
|
5
|
+
export{A as uv,B as vv};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{nl as a,ol as b,pl as c,ql as d,rl as e,sl as f,tl as g}from"./chunk-t23kccpz.js";import"./chunk-tf16jtj4.js";import"./chunk-ejwfnttb.js";import"./chunk-1nnza3m6.js";import"./chunk-trva71am.js";import"./chunk-emjmshj8.js";export{e as productionApiDispatcher,g as isServerApiSource,b as generateApiTypes,a as discoverServerApi,f as createServerApi,d as createApiDispatcher,c as buildServerApi};
|
package/dist/cli.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
import{Ha as a,He as F,Je as v,Ke as P,Va as r,de as s,ee as t,nb as n,o as m,oa as l,ob as p,qb as i,wb as e}from"./chunk-
|
|
4
|
-
Test run interrupted`),j.kill("SIGINT"),w.exit(1)})})}catch(K){return console.error("Error running tests:",K instanceof Error?K.message:String(K)),!1}}var Qb=w.argv.length>=3&&(jb(w.argv[2])&&L.existsSync(w.argv[2])||V(w.argv[2]));if(Qb){let J=w.argv[2],Z={port:3000,watch:!0,cache:!0,markdown:{syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}}};for(let K=3;K<w.argv.length;K++){let x=w.argv[K];if(x==="--port"&&K+1<w.argv.length){let b=h(w.argv[++K]);if(!b.isValid)S(b);Z.port=Number.parseInt(w.argv[K],10)}else if(x==="--no-watch")Z.watch=!1;else if(x==="--highlight-theme"&&K+1<w.argv.length){if(!Z.markdown)Z.markdown={};if(!Z.markdown.syntaxHighlighting)Z.markdown.syntaxHighlighting={};Z.markdown.syntaxHighlighting.defaultTheme=w.argv[++K]}else if(x==="--no-highlight"){if(!Z.markdown)Z.markdown={};if(!Z.markdown.syntaxHighlighting)Z.markdown.syntaxHighlighting={};Z.markdown.syntaxHighlighting.enabled=!1}else if(x==="--no-highlight-unknown"){if(!Z.markdown)Z.markdown={};if(!Z.markdown.syntaxHighlighting)Z.markdown.syntaxHighlighting={};Z.markdown.syntaxHighlighting.highlightUnknownLanguages=!1}else if(x==="--no-cache")Z.cache=!1;else if(x==="--native")Z.native=!0}if(V(J))try{let K=await Array.fromAsync(new Bun.Glob(J).scan({onlyFiles:!0,absolute:!0})),x=J.endsWith(".stx")?K.filter((j)=>j.endsWith(".stx")):J.endsWith(".md")?K.filter((j)=>j.endsWith(".md")):K.filter((j)=>j.endsWith(".stx")||j.endsWith(".md")),b=J.split("*")[0].replace(/\/$/,"")||".",z=$.resolve(b);try{let j=new Bun.Glob("**/*.stx"),H=(await Array.fromAsync(j.scan({cwd:z,onlyFiles:!0,absolute:!0}))).filter((U)=>/\[.+\]/.test($.basename(U)));for(let U of H)if(!x.includes(U))x.push(U)}catch{}if(x.length===0)console.error(`Error: No STX or Markdown files found matching pattern: ${J}`),w.exit(1);if(!await v(x,Z))w.exit(1)}catch(K){console.error("Failed to process files:",K),w.exit(1)}else F(J,Z).catch((K)=>{console.error("Failed to start dev server:",K),w.exit(1)})}else{let J=function(x,b){let z=[];for(let k=0;k<=b.length;k++)z[k]=[k];for(let k=0;k<=x.length;k++)z[0][k]=k;for(let k=1;k<=b.length;k++)for(let j=1;j<=x.length;j++)if(b.charAt(k-1)===x.charAt(j-1))z[k][j]=z[k-1][j-1];else z[k][j]=Math.min(z[k-1][j-1]+1,z[k][j-1]+1,z[k-1][j]+1);return z[b.length][x.length]};E.command("docs","Generate documentation for components, templates, and directives").option("--output <dir>","Output directory for documentation",{default:"docs"}).option("--format <format>","Documentation format (markdown, html, json)",{default:"markdown"}).option("--components-dir <dir>","Components directory",{default:"components"}).option("--templates-dir <dir>","Templates directory",{default:"."}).option("--no-components","Disable components documentation").option("--no-templates","Disable templates documentation").option("--no-directives","Disable directives documentation").option("--extra-content <content>","Extra content to include in documentation").example("stx docs --output docs --format html").action(async(x)=>{try{if(await r(x))console.log("Documentation generated successfully."),w.exit(0);else console.error("Documentation generation failed."),w.exit(1)}catch(b){console.error("Error generating documentation:",b),w.exit(1)}}),E.command("iconify <command>","Generate Iconify icon packages").option("--output <dir>","Output directory for generated packages",{default:"packages"}).option("--icons <icons>","Comma-separated list of specific icons to generate").example("stx iconify list").example("stx iconify generate mdi").example("stx iconify generate lucide --icons home,settings,user").action(async(x,b)=>{try{let{fetchCollections:z,generatePackage:k}=await import("./chunk-
|
|
3
|
+
import{Ha as a,He as F,Je as v,Ke as P,Va as r,de as s,ee as t,nb as n,o as m,oa as l,ob as p,qb as i,wb as e}from"./chunk-57kxjr4t.js";import"./chunk-4ce5ma6a.js";import"./chunk-7hb89n3z.js";import"./chunk-0smr2xjs.js";import"./chunk-801bg5d8.js";import"./chunk-s5dwatkj.js";import"./chunk-n0d7nwhd.js";import"./chunk-qrvey4wk.js";import"./chunk-nybn003d.js";import"./chunk-hy79zwyy.js";import"./chunk-rbfm5sjt.js";import"./chunk-jy451jg5.js";import"./chunk-0knxnyq6.js";import"./chunk-634gaa9d.js";import"./chunk-6yfccnr7.js";import"./chunk-tv04k7gq.js";import"./chunk-n1y0hjk1.js";import"./chunk-bcpjhcpn.js";import"./chunk-y4zddt5r.js";import"./chunk-g7bpkpd4.js";import"./chunk-k33778kc.js";import"./chunk-yg0qm73a.js";import"./chunk-g1vxsvqv.js";import"./chunk-3y8vvkar.js";import"./chunk-fqq5k9ve.js";import"./chunk-ya5m5vbn.js";import"./chunk-y4nzmkea.js";import"./chunk-7kw3grq5.js";import"./chunk-c79nfdyj.js";import"./chunk-ej8mv2k6.js";import"./chunk-dtdwjpvf.js";import"./chunk-ra1s4s6b.js";import"./chunk-79fj9zem.js";import"./chunk-krt45cqy.js";import"./chunk-0t1yyn1d.js";import"./chunk-3kd0zn9c.js";import"./chunk-ec8jsqgm.js";import"./chunk-wz4fnsat.js";import"./chunk-frp9fc7j.js";import{bl as u,cl as c}from"./chunk-degz74nv.js";import"./chunk-t23kccpz.js";import"./chunk-qjvny3wf.js";import"./chunk-3ssjb8cx.js";import{es as f}from"./chunk-ykevda74.js";import"./chunk-ez003q74.js";import"./chunk-kyyt9xhs.js";import"./chunk-tf16jtj4.js";import"./chunk-19m7hed6.js";import{Is as A}from"./chunk-kjd9hbg4.js";import"./chunk-ejwfnttb.js";import"./chunk-5270fyk7.js";import"./chunk-q4kgqqed.js";import"./chunk-1nnza3m6.js";import"./chunk-hkrzv980.js";import"./chunk-qbz6yn8c.js";import"./chunk-czj6nq0b.js";import"./chunk-zxfejz72.js";import"./chunk-mere396d.js";import"./chunk-aa8015mk.js";import"./chunk-trva71am.js";import"./chunk-rtfwn4cm.js";import{Rw as B}from"./chunk-emjmshj8.js";import{spawn as o}from"child_process";import L from"fs";import zb from"os";import $ from"path";import w from"process";import{CLI as wb}from"@stacksjs/clapp";var N="0.2.356";var __dirname="/home/runner/work/stx/stx/packages/stx/bin",E=new wb("stx");function h(J){let Z=typeof J==="string"?Number.parseInt(J,10):J;if(Number.isNaN(Z))return{isValid:!1,error:"Port must be a valid number",suggestion:"Try using a number between 1024 and 65535"};if(Z<1024||Z>65535)return{isValid:!1,error:"Port must be between 1024 and 65535",suggestion:"Try using a port between 1024 and 65535"};return{isValid:!0}}function d(J){try{if(!L.existsSync(J)){let K=$.dirname(J),x=$.basename(J);if(L.existsSync(K)){let z=L.readdirSync(K).filter((j)=>j.toLowerCase().includes(x.toLowerCase().substring(0,3))||j.endsWith(".stx")||j.endsWith(".md")),k=z.length>0?`File not found. Similar files in ${K}: ${z.slice(0,3).join(", ")}`:`File not found. Directory ${K} exists but doesn't contain the specified file.`;return{isValid:!1,error:`File does not exist: ${J}`,suggestion:k}}return{isValid:!1,error:`File does not exist: ${J}`,suggestion:"Check the file path and try again"}}if(L.statSync(J).isDirectory())return{isValid:!1,error:`Expected file but got directory: ${J}`,suggestion:"Specify a .stx or .md file path"};return{isValid:!0}}catch(Z){return{isValid:!1,error:`Cannot access file: ${J}`,suggestion:"Check file permissions and path"}}}function y(J){let Z=typeof J==="string"?Number.parseInt(J,10):J;if(Number.isNaN(Z))return{isValid:!1,error:"Timeout must be a valid number",suggestion:"Specify timeout in milliseconds (e.g., 5000 for 5 seconds)"};if(Z<100)return{isValid:!1,error:"Timeout too short (minimum 100ms)",suggestion:"Use a timeout of at least 100ms"};if(Z>300000)return{isValid:!1,error:"Timeout too long (maximum 5 minutes)",suggestion:"Use a timeout of less than 300000ms (5 minutes)"};return{isValid:!0}}var V=(J)=>J.includes("*")||J.includes("?")||J.includes("{")||J.includes("["),jb=(J)=>J.endsWith(".stx")||J.endsWith(".md");function S(J,Z=1){if(console.error(`\u274C ${J.error}`),J.suggestion)console.error(`\uD83D\uDCA1 suggestion: ${J.suggestion}`);w.exit(Z)}function kb(J){if(!J)return;let Z;try{Z=JSON.parse(J)}catch(K){console.error(`\u274C --info-plist is not valid JSON: ${K.message}`),w.exit(1)}if(typeof Z!=="object"||Z===null||Array.isArray(Z))console.error(`\u274C --info-plist must be a JSON object, e.g. '{"NSFocusStatusUsageDescription":"\u2026"}'`),w.exit(1);for(let[K,x]of Object.entries(Z))if(typeof x!=="string"&&typeof x!=="number"&&typeof x!=="boolean")console.error(`\u274C --info-plist value for "${K}" must be a string, number or boolean`),w.exit(1);return Z}async function Hb(J,Z){try{let K=["test"],x=[];if(J&&J.length>0)for(let W of J)if(V(W))try{let H=await Array.fromAsync(new Bun.Glob(W).scan({onlyFiles:!0,absolute:!0}));if(H.length===0)console.warn(`Warning: No files found matching pattern: ${W}`);else if(x.push(...H),Z.verbose)console.log(`Found ${H.length} file(s) matching pattern: ${W}`)}catch(H){return console.error(`Error expanding glob pattern ${W}:`,H),!1}else x.push(W);if(x.length===0)return console.error("Error: No test files found matching the provided patterns."),!1;if(K.push(...x),Z.filter)K.push("--pattern",Z.filter);if(Z.timeout)K.push("--timeout",Z.timeout.toString());if(Z.reporter&&Z.reporter!=="default")if(Z.reporter==="junit"){let W=$.join(zb.tmpdir(),`stx-test-report-${Date.now()}.xml`);K.push("--reporter",Z.reporter),K.push("--reporter-outfile",W)}else console.warn(`Warning: Reporter '${Z.reporter}' is not supported. Using default reporter.`);if(Z.coverage)K.push("--coverage");if(Z.watch)K.push("--watch");K.push("--preload",$.join(__dirname,"../../../test-utils/happy-dom.ts"));let b={...w.env,STX_TEST_MODE:"true",STX_TEST_UI:Z.ui?"true":"false",STX_TEST_VERBOSE:Z.verbose?"true":"false"},z="bun";if(Z.verbose)console.log(`Running: ${z} ${K.join(" ")}`);let k=performance.now(),j=o(z,K,{stdio:"inherit",shell:!1,env:b});return new Promise((W)=>{j.on("close",(H)=>{let Y=((performance.now()-k)/1000).toFixed(2);if(H===0)W(!0);else W(!1)}),w.on("SIGINT",()=>{console.log(`
|
|
4
|
+
Test run interrupted`),j.kill("SIGINT"),w.exit(1)})})}catch(K){return console.error("Error running tests:",K instanceof Error?K.message:String(K)),!1}}var Qb=w.argv.length>=3&&(jb(w.argv[2])&&L.existsSync(w.argv[2])||V(w.argv[2]));if(Qb){let J=w.argv[2],Z={port:3000,watch:!0,cache:!0,markdown:{syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}}};for(let K=3;K<w.argv.length;K++){let x=w.argv[K];if(x==="--port"&&K+1<w.argv.length){let b=h(w.argv[++K]);if(!b.isValid)S(b);Z.port=Number.parseInt(w.argv[K],10)}else if(x==="--no-watch")Z.watch=!1;else if(x==="--highlight-theme"&&K+1<w.argv.length){if(!Z.markdown)Z.markdown={};if(!Z.markdown.syntaxHighlighting)Z.markdown.syntaxHighlighting={};Z.markdown.syntaxHighlighting.defaultTheme=w.argv[++K]}else if(x==="--no-highlight"){if(!Z.markdown)Z.markdown={};if(!Z.markdown.syntaxHighlighting)Z.markdown.syntaxHighlighting={};Z.markdown.syntaxHighlighting.enabled=!1}else if(x==="--no-highlight-unknown"){if(!Z.markdown)Z.markdown={};if(!Z.markdown.syntaxHighlighting)Z.markdown.syntaxHighlighting={};Z.markdown.syntaxHighlighting.highlightUnknownLanguages=!1}else if(x==="--no-cache")Z.cache=!1;else if(x==="--native")Z.native=!0}if(V(J))try{let K=await Array.fromAsync(new Bun.Glob(J).scan({onlyFiles:!0,absolute:!0})),x=J.endsWith(".stx")?K.filter((j)=>j.endsWith(".stx")):J.endsWith(".md")?K.filter((j)=>j.endsWith(".md")):K.filter((j)=>j.endsWith(".stx")||j.endsWith(".md")),b=J.split("*")[0].replace(/\/$/,"")||".",z=$.resolve(b);try{let j=new Bun.Glob("**/*.stx"),H=(await Array.fromAsync(j.scan({cwd:z,onlyFiles:!0,absolute:!0}))).filter((U)=>/\[.+\]/.test($.basename(U)));for(let U of H)if(!x.includes(U))x.push(U)}catch{}if(x.length===0)console.error(`Error: No STX or Markdown files found matching pattern: ${J}`),w.exit(1);if(!await v(x,Z))w.exit(1)}catch(K){console.error("Failed to process files:",K),w.exit(1)}else F(J,Z).catch((K)=>{console.error("Failed to start dev server:",K),w.exit(1)})}else{let J=function(x,b){let z=[];for(let k=0;k<=b.length;k++)z[k]=[k];for(let k=0;k<=x.length;k++)z[0][k]=k;for(let k=1;k<=b.length;k++)for(let j=1;j<=x.length;j++)if(b.charAt(k-1)===x.charAt(j-1))z[k][j]=z[k-1][j-1];else z[k][j]=Math.min(z[k-1][j-1]+1,z[k][j-1]+1,z[k-1][j]+1);return z[b.length][x.length]};E.command("docs","Generate documentation for components, templates, and directives").option("--output <dir>","Output directory for documentation",{default:"docs"}).option("--format <format>","Documentation format (markdown, html, json)",{default:"markdown"}).option("--components-dir <dir>","Components directory",{default:"components"}).option("--templates-dir <dir>","Templates directory",{default:"."}).option("--no-components","Disable components documentation").option("--no-templates","Disable templates documentation").option("--no-directives","Disable directives documentation").option("--extra-content <content>","Extra content to include in documentation").example("stx docs --output docs --format html").action(async(x)=>{try{if(await r(x))console.log("Documentation generated successfully."),w.exit(0);else console.error("Documentation generation failed."),w.exit(1)}catch(b){console.error("Error generating documentation:",b),w.exit(1)}}),E.command("iconify <command>","Generate Iconify icon packages").option("--output <dir>","Output directory for generated packages",{default:"packages"}).option("--icons <icons>","Comma-separated list of specific icons to generate").example("stx iconify list").example("stx iconify generate mdi").example("stx iconify generate lucide --icons home,settings,user").action(async(x,b)=>{try{let{fetchCollections:z,generatePackage:k}=await import("./chunk-7jcntsp4.js");if(x==="list"){console.log(`
|
|
5
5
|
\uD83D\uDCDA Fetching available icon collections...
|
|
6
6
|
`);let j=await z(),W=Object.entries(j).sort((H,U)=>U[1].total-H[1].total);console.log(`Available collections:
|
|
7
7
|
`);for(let[H,U]of W){let Y=U;console.log(` ${H.padEnd(30)} ${Y.name} (${Y.total} icons)`)}console.log(`
|
|
8
8
|
Total: ${W.length} collections`)}else if(x.startsWith("generate")){let j=x==="generate"?"":x.replace("generate:","").replace("generate-","").replace("generate","").trim();if(!j)console.error("Error: Please specify a collection prefix"),console.error("Usage: stx iconify generate <prefix> [--icons icon1,icon2,...]"),w.exit(1);let W=b.output||$.join(w.cwd(),"packages/collections"),H=b.icons?b.icons.split(",").map((U)=>U.trim()):void 0;await k(j,W,H),console.log(`
|
|
9
9
|
\u2713 Package generated successfully!`),console.log(`
|
|
10
|
-
To use the package:`),console.log(` 1. cd packages/collections/iconify-${j}`),console.log(" 2. bun install"),console.log(" 3. bun run build")}else console.error(`Unknown iconify command: ${x}`),console.error("Available commands: list, generate"),w.exit(1)}catch(z){console.error("Error:",z instanceof Error?z.message:String(z)),w.exit(1)}}),E.command("pwa <command>","PWA tools - audit configuration and build output").option("--output <dir>","Build output directory to audit",{default:"dist"}).example("stx pwa audit").example("stx pwa audit --output build").action(async(x,b)=>{try{if(x==="audit"){let{runPwaAudit:z,formatAuditResult:k}=await import("./chunk-
|
|
10
|
+
To use the package:`),console.log(` 1. cd packages/collections/iconify-${j}`),console.log(" 2. bun install"),console.log(" 3. bun run build")}else console.error(`Unknown iconify command: ${x}`),console.error("Available commands: list, generate"),w.exit(1)}catch(z){console.error("Error:",z instanceof Error?z.message:String(z)),w.exit(1)}}),E.command("pwa <command>","PWA tools - audit configuration and build output").option("--output <dir>","Build output directory to audit",{default:"dist"}).example("stx pwa audit").example("stx pwa audit --output build").action(async(x,b)=>{try{if(x==="audit"){let{runPwaAudit:z,formatAuditResult:k}=await import("./chunk-sa6cgj9h.js"),{loadConfig:j}=await import("./chunk-c4rpdtvw.js");console.log(`
|
|
11
11
|
\uD83D\uDD0D Running PWA audit...
|
|
12
12
|
`);let W=await j(),H=b.output||"dist",U=z(W,H);if(console.log(k(U)),U.failed>0)w.exit(1)}else console.error(`Unknown pwa command: ${x}`),console.error("Available commands: audit"),w.exit(1)}catch(z){console.error("Error:",z instanceof Error?z.message:String(z)),w.exit(1)}}),E.command("dev [file]","Start a development server for an STX app or file").option("--port <port>","Port to use for the dev server",{default:3000}).option("--pages <dir>",'Directory containing page templates (default: pagesDir from stx.config.ts, else "pages")').option("--no-watch","Disable file watching and auto-reload").option("--native","Open in a native desktop window using Zyte").option("--titlebar-hidden","Hide the native titlebar but keep the traffic-light buttons (web content draws under a transparent full-size titlebar). Implies --native.").option("--highlight-theme <theme>","Syntax highlighting theme for Markdown code blocks",{default:"github-dark"}).option("--no-highlight","Disable syntax highlighting for Markdown code blocks").option("--no-highlight-unknown","Disable syntax highlighting for unknown languages in Markdown").option("--no-cache","Disable caching of parsed files").option("--no-hmr","Disable HMR / live-reload script injection (useful for clean network traces)").option("--profile","Print per-directive timing for every page render via performanceMonitor").option("--debug-directives","Log directive ordering and intermediate template state during rendering").example("stx dev").example("stx dev --port 8080").example("stx dev --pages src/pages").example("stx dev template.stx").example("stx dev components/hero.stx --port 8080").example("stx dev **/*.stx").example("stx dev docs/guide.md").example("stx dev template.stx --native").action(async(x,b)=>{try{if(b.port!==void 0){let k=h(b.port);if(!k.isValid)S(k);b.port=Number.parseInt(String(b.port),10)}if(b.timeout!==void 0){let k=y(b.timeout);if(!k.isValid)S(k)}let z={syntaxHighlighting:{enabled:b.highlight!==!1,serverSide:!0,defaultTheme:b.highlightTheme||"github-dark",highlightUnknownLanguages:b.highlightUnknown!==!1}};if(!x){if(!await P(".",{port:b.port,watch:b.watch!==!1,native:b.native||b.titlebarHidden||!1,titlebarHidden:b.titlebarHidden===!0,cache:b.cache!==!1,hotReload:b.hmr!==!1,profile:b.profile===!0,debugDirectives:b.debugDirectives===!0,...b.pages&&{pagesDir:b.pages}}))w.exit(1);return}if(!V(x))try{let k=await import("fs");if(k.existsSync(x)&&k.statSync(x).isDirectory()){if(!await P(x,{port:b.port,watch:b.watch!==!1,native:b.native||b.titlebarHidden||!1,titlebarHidden:b.titlebarHidden===!0,cache:b.cache!==!1,hotReload:b.hmr!==!1,profile:b.profile===!0,debugDirectives:b.debugDirectives===!0,...b.pages&&{pagesDir:b.pages}}))w.exit(1);return}}catch{}if(V(x)){console.log(`Expanding glob pattern: ${x}`);let k=await A.timeAsync("glob-expansion",async()=>{return Array.fromAsync(new Bun.Glob(x).scan({onlyFiles:!0,absolute:!0}))}),j=x.endsWith(".stx")?k.filter((Y)=>Y.endsWith(".stx")):x.endsWith(".md")?k.filter((Y)=>Y.endsWith(".md")):k.filter((Y)=>Y.endsWith(".stx")||Y.endsWith(".md"));if(j.length===0)console.error(`No STX or Markdown files found matching pattern: ${x}`),console.error("Try using patterns like '*.stx' or 'components/**/*.stx'"),w.exit(1);let W=x.split("*")[0].replace(/\/$/,"")||".",H=$.resolve(W);try{let Y=new Bun.Glob("**/*.stx"),X=(await Array.fromAsync(Y.scan({cwd:H,onlyFiles:!0,absolute:!0}))).filter((_)=>/\[.+\]/.test($.basename(_)));for(let _ of X)if(!j.includes(_))j.push(_)}catch{}if(console.log(`Found ${j.length} ${j.length===1?"file":"files"} matching ${x}`),!await v(j,{port:b.port,watch:b.watch!==!1,native:b.native||b.titlebarHidden||!1,titlebarHidden:b.titlebarHidden===!0,markdown:z,cache:b.cache!==!1}))w.exit(1)}else{if(!V(x)){let j=d(x);if(!j.isValid)S(j)}if(!await F(x,{port:b.port,watch:b.watch!==!1,native:b.native||b.titlebarHidden||!1,titlebarHidden:b.titlebarHidden===!0,markdown:z,cache:b.cache!==!1}))w.exit(1)}}catch(z){console.error("Error starting dev server:",z),w.exit(1)}}),E.command("a11y [target]","Scan .stx files for accessibility issues (directory, file, or glob)").option("--no-recursive","Disable recursive scanning of directories").option("--ignore <paths>","Comma-separated paths to ignore",{default:""}).option("--json","Output results as JSON").option("--output <file>","Write results to a file instead of stdout").option("--fix","Automatically fix common accessibility issues").example("stx a11y ./templates").example('stx a11y "resources/**/*.stx"').example("stx a11y resources/emails/welcome.stx").example("stx a11y --json --output a11y-report.json").action(async(x=".",b)=>{try{console.log(`Scanning ${x} for accessibility issues...`);let z=b.ignore?b.ignore.split(",").map((U)=>U.trim()):[],{results:k,scannedFiles:j}=await f(x,{recursive:b.recursive!==!1,ignorePaths:z});if(j.length===0)console.log(`
|
|
13
13
|
No .stx files matched ${x}
|
|
@@ -69,7 +69,7 @@ Total: ${H} issues in ${W} files`),b.output){let U=`
|
|
|
69
69
|
File not found: ${x}`),w.exit(1);if(!x.endsWith(".stx"))console.error(`
|
|
70
70
|
File must have .stx extension: ${x}`),w.exit(1)}let k=$.resolve(b.pages),j=$.resolve(b.out);if(!x&&!L.existsSync(k))console.error(`
|
|
71
71
|
Pages directory not found: ${k}`),console.log(`
|
|
72
|
-
Create a 'pages' directory with .stx files, or use --pages to specify a different directory.`),w.exit(1);let{buildApp:W}=await import("./chunk-
|
|
72
|
+
Create a 'pages' directory with .stx files, or use --pages to specify a different directory.`),w.exit(1);let{buildApp:W}=await import("./chunk-596cftgk.js");c();let H=await W({root:x?$.dirname(x):void 0,debug:b.verbose,ssg:{pagesDir:b.pages,outputDir:b.out,domain:b.domain,baseUrl:b.base,sitemap:b.sitemap,rss:b.rss,minify:b.minify,cache:b.cache!==!1,cleanOutput:b.clean,concurrency:Number.parseInt(b.concurrency,10)||10,publicDir:b.public,trailingSlash:b.trailingSlash,generate404:!0,hooks:b.verbose?{onPageStart:(Y)=>console.log(` Generating: ${Y}`),onPageEnd:(Y,Q)=>console.log(` Generated: ${Y} (${Q.length} bytes)`),onError:(Y,Q)=>console.error(` Error in ${Q}: ${Y.message}`)}:void 0},ssr:{outputDir:b.out==="dist"?".output":b.out,debug:b.verbose}}),U=((performance.now()-z)/1000).toFixed(2);if(H.mode==="ssr"&&H.ssr)console.log(`
|
|
73
73
|
Build complete! (SSR)
|
|
74
74
|
`),console.log(` Pages compiled: ${H.ssr.pageCount}`),console.log(` Output: ${H.ssr.outputDir}`),console.log(` Duration: ${U}s
|
|
75
75
|
`);else if(H.ssg){if(console.log(`
|
|
@@ -84,8 +84,8 @@ Total: ${H} issues in ${W} files`),b.output){let U=`
|
|
|
84
84
|
Build completed with ${H.ssg.failedCount} error(s). Fix the issues above and try again.
|
|
85
85
|
`),w.exit(1);console.log(" To preview locally:"),console.log(` cd ${b.out||"dist"} && npx serve
|
|
86
86
|
`)}}catch(z){console.error(`
|
|
87
|
-
Build failed:`,z instanceof Error?z.message:String(z)),w.exit(1)}}),E.command("start","Start the production server (serves pre-built .output/)").option("--port <number>","Server port",{default:"3000"}).option("--output <dir>","Output directory from stx build",{default:".output"}).example("stx start").example("stx start --port 8080").action(async(x)=>{try{let b=$.resolve(x.output);if(!L.existsSync($.join(b,"manifest.json")))console.error("\n No production build found. Run `stx build --out .output` first.\n"),w.exit(1);let{startProductionServer:z}=await import("./chunk-
|
|
88
|
-
Failed to start production server:`,b instanceof Error?b.message:String(b)),w.exit(1)}}),E.command("deploy [directory]","Deploy built site to Netlify").option("--site-id <id>","Netlify site ID (or set NETLIFY_SITE_ID env var)").option("--token <token>","Auth token (or set NETLIFY_AUTH_TOKEN env var)").option("--production","Deploy to production (default: draft preview)").option("--message <msg>","Deploy message/title").option("--no-build","Skip build step before deploy").option("--open","Open deployed URL in browser").option("--dry-run","Preview deployment without uploading").option("--init","Initialize Netlify configuration for this project").example("stx deploy").example("stx deploy --production").example("stx deploy dist --site-id my-site-abc123").example("stx deploy --init").example("stx deploy --dry-run").action(async(x,b)=>{try{let{deploy:z,initNetlify:k,DeployError:j}=await import("./chunk-
|
|
87
|
+
Build failed:`,z instanceof Error?z.message:String(z)),w.exit(1)}}),E.command("start","Start the production server (serves pre-built .output/)").option("--port <number>","Server port",{default:"3000"}).option("--output <dir>","Output directory from stx build",{default:".output"}).example("stx start").example("stx start --port 8080").action(async(x)=>{try{let b=$.resolve(x.output);if(!L.existsSync($.join(b,"manifest.json")))console.error("\n No production build found. Run `stx build --out .output` first.\n"),w.exit(1);let{startProductionServer:z}=await import("./chunk-p1426yar.js");await z({outputDir:b,port:Number.parseInt(x.port,10)||3000})}catch(b){console.error(`
|
|
88
|
+
Failed to start production server:`,b instanceof Error?b.message:String(b)),w.exit(1)}}),E.command("deploy [directory]","Deploy built site to Netlify").option("--site-id <id>","Netlify site ID (or set NETLIFY_SITE_ID env var)").option("--token <token>","Auth token (or set NETLIFY_AUTH_TOKEN env var)").option("--production","Deploy to production (default: draft preview)").option("--message <msg>","Deploy message/title").option("--no-build","Skip build step before deploy").option("--open","Open deployed URL in browser").option("--dry-run","Preview deployment without uploading").option("--init","Initialize Netlify configuration for this project").example("stx deploy").example("stx deploy --production").example("stx deploy dist --site-id my-site-abc123").example("stx deploy --init").example("stx deploy --dry-run").action(async(x,b)=>{try{let{deploy:z,initNetlify:k,DeployError:j}=await import("./chunk-9qdn9y72.js");if(console.log(`\x1B[1mstx deploy\x1B[0m \x1B[2mv${N}\x1B[0m`),b.init){console.log(`
|
|
89
89
|
\uD83D\uDCDD Initializing Netlify configuration...
|
|
90
90
|
`);let H=await k({directory:x||w.cwd(),siteId:b.siteId});if(console.log(`\u2713 Created ${H.configPath}`),H.siteId)console.log("\u2713 Saved site ID to .env.local");console.log(`
|
|
91
91
|
You can now deploy with: stx deploy`);return}if(b.build!==!1){if(console.log(`
|
|
@@ -97,7 +97,7 @@ You can now deploy with: stx deploy`);return}if(b.build!==!1){if(console.log(`
|
|
|
97
97
|
`),console.log(` ${b.dryRun?"Would deploy":"Draft URL"}: ${W.url}`),W.siteUrl)console.log(` Site URL: ${W.siteUrl}`);if(!b.dryRun)console.log(`
|
|
98
98
|
Deploy ID: ${W.deployId}`),console.log(` Duration: ${(W.duration/1000).toFixed(1)}s`),console.log(` Files: ${W.filesUploaded}`)}}catch(z){if(z instanceof Error&&z.name==="DeployError")console.error(`
|
|
99
99
|
\u274C ${z.message}`),w.exit(1);console.error(`
|
|
100
|
-
\u274C Deploy failed:`,z instanceof Error?z.message:String(z)),w.exit(1)}}),E.command("images <input>","Optimize images for production").option("-o, --output <dir>","Output directory",{default:"dist/images"}).option("-w, --widths <sizes>","Output widths (comma-separated)",{default:"320,640,768,1024,1280,1536,1920"}).option("-f, --formats <types>","Output formats (comma-separated)",{default:"webp,jpeg"}).option("-q, --quality <n>","Output quality (1-100)",{default:"80"}).option("--placeholder <type>","Placeholder type: blur, dominant-color, none",{default:"none"}).option("--dry-run","Preview without processing").option("--verbose","Show detailed output").example("stx images public/images").example("stx images public/images -o dist/images").example("stx images public/images --widths 640,1024,1920").example("stx images public/images --formats webp,avif").example("stx images public/images --quality 85").example("stx images public/images --dry-run").action(async(x,b)=>{try{let{optimizeDirectory:z,isSharpAvailable:k,formatSize:j}=await import("./chunk-
|
|
100
|
+
\u274C Deploy failed:`,z instanceof Error?z.message:String(z)),w.exit(1)}}),E.command("images <input>","Optimize images for production").option("-o, --output <dir>","Output directory",{default:"dist/images"}).option("-w, --widths <sizes>","Output widths (comma-separated)",{default:"320,640,768,1024,1280,1536,1920"}).option("-f, --formats <types>","Output formats (comma-separated)",{default:"webp,jpeg"}).option("-q, --quality <n>","Output quality (1-100)",{default:"80"}).option("--placeholder <type>","Placeholder type: blur, dominant-color, none",{default:"none"}).option("--dry-run","Preview without processing").option("--verbose","Show detailed output").example("stx images public/images").example("stx images public/images -o dist/images").example("stx images public/images --widths 640,1024,1920").example("stx images public/images --formats webp,avif").example("stx images public/images --quality 85").example("stx images public/images --dry-run").action(async(x,b)=>{try{let{optimizeDirectory:z,isSharpAvailable:k,formatSize:j}=await import("./chunk-wkyt4j9e.js"),W=await import("fs"),H=await import("path");if(console.log(`\x1B[1mstx images\x1B[0m \x1B[2mv${N}\x1B[0m`),!await k())console.error(`
|
|
101
101
|
\u274C sharp is required for image optimization.`),console.log(`
|
|
102
102
|
Install sharp with:`),console.log(" bun add sharp"),w.exit(1);let Y=b.widths.split(",").map((G)=>Number.parseInt(G.trim(),10)).filter((G)=>!Number.isNaN(G)),Q=b.formats.split(",").map((G)=>G.trim().toLowerCase()),X=Number.parseInt(b.quality,10)||80,_=b.placeholder,q=H.resolve(x);if(!W.existsSync(q))console.error(`
|
|
103
103
|
\u274C Input directory not found: ${q}`),w.exit(1);if(!W.statSync(q).isDirectory())console.error(`
|
|
@@ -110,7 +110,7 @@ Would generate ~${bb} image variants`);return}console.log(`
|
|
|
110
110
|
`);let M=await z(q,b.output,{widths:Y,formats:Q,quality:X,placeholder:_,verbose:b.verbose});if(console.log(`
|
|
111
111
|
\u2713 Optimization complete!
|
|
112
112
|
`),console.log(` Images processed: ${M.stats.optimizedImages}/${M.stats.totalImages}`),console.log(` Variants created: ${M.stats.variants}`),M.stats.savedBytes>0)console.log(` Estimated savings: ~${j(M.stats.savedBytes)}`)}catch(z){console.error(`
|
|
113
|
-
\u274C Image optimization failed:`,z instanceof Error?z.message:String(z)),w.exit(1)}}),E.command("bundle [directory]","Analyze bundle size and composition").option("-o, --output <file>","Output file path").option("--json","Output as JSON").option("--text","Output as text summary").option("--markdown","Output as Markdown").option("--no-open","Do not open HTML report in browser").option("--no-gzip","Do not show gzip sizes").option("--threshold <size>","Fail if total size exceeds threshold (e.g., 500KB, 1MB)").option("--top <n>","Number of top modules to show",{default:"20"}).example("stx bundle").example("stx bundle dist/").example("stx bundle dist/ --json").example("stx bundle dist/ --text").example("stx bundle dist/ --threshold 500KB").example("stx bundle dist/ --no-open").action(async(x,b)=>{try{let{analyze:z,formatBytes:k,parseSize:j}=await import("./chunk-
|
|
113
|
+
\u274C Image optimization failed:`,z instanceof Error?z.message:String(z)),w.exit(1)}}),E.command("bundle [directory]","Analyze bundle size and composition").option("-o, --output <file>","Output file path").option("--json","Output as JSON").option("--text","Output as text summary").option("--markdown","Output as Markdown").option("--no-open","Do not open HTML report in browser").option("--no-gzip","Do not show gzip sizes").option("--threshold <size>","Fail if total size exceeds threshold (e.g., 500KB, 1MB)").option("--top <n>","Number of top modules to show",{default:"20"}).example("stx bundle").example("stx bundle dist/").example("stx bundle dist/ --json").example("stx bundle dist/ --text").example("stx bundle dist/ --threshold 500KB").example("stx bundle dist/ --no-open").action(async(x,b)=>{try{let{analyze:z,formatBytes:k,parseSize:j}=await import("./chunk-f11z7q5g.js"),W=await import("path");console.log(`\x1B[1mstx bundle\x1B[0m \x1B[2mv${N}\x1B[0m`);let H=x||"dist",U=W.resolve(H);if(!(await import("fs")).existsSync(U))console.error(`
|
|
114
114
|
\u274C Directory not found: ${U}`),console.log("\nRun `stx build` first to generate build output."),w.exit(1);let Q="html";if(b.json)Q="json";else if(b.text)Q="text";else if(b.markdown)Q="markdown";console.log(`
|
|
115
115
|
\uD83D\uDCE6 Analyzing: ${U}`);let X=await z({directory:U,output:b.output,format:Q,open:b.open!==!1&&Q==="html",gzip:b.gzip!==!1,threshold:b.threshold,topModules:Number.parseInt(b.top||"20",10),recommendations:!0});if(Q==="html"){if(console.log(`
|
|
116
116
|
\u2713 Report generated: ${X.outputPath}`),b.open!==!1)console.log(" Opening in browser...")}else console.log(X.report);if(X.exceedsThreshold){let _=b.threshold;console.error(`
|
|
@@ -124,7 +124,7 @@ To view it in the development server:`),console.log(` stx dev ${x}
|
|
|
124
124
|
\uD83D\uDCDD ${$.relative(w.cwd(),Q)}:`),console.log("--- Original"),console.log("+++ Formatted"),console.log(`@@ Changes in ${$.basename(Q)} @@`),console.log("+ Formatted content would be applied");else await Bun.write(Q,q),console.log(`\u2705 Formatted ${$.relative(w.cwd(),Q)}`),U++}catch(X){console.error(`\u274C Error formatting ${$.relative(w.cwd(),Q)}:`,X),Y++}if(b.check&&Y>0)console.log(`
|
|
125
125
|
${Y} files need formatting. Run 'stx format' to fix.`),w.exit(1);else if(!b.check&&!b.diff)console.log(`\u2728 Formatted ${U} files successfully`)}catch(z){console.error("Error formatting files:",z),w.exit(1)}}),E.command("perf [command...]","Show performance statistics for STX operations").option("--clear","Clear performance statistics").option("--json","Output as JSON").example("stx perf").example("stx perf --clear").example("stx perf --json").action(async(x,b)=>{try{if(b.clear){A.clear(),console.log("\u2705 Performance statistics cleared");return}let z=A.getStats();if(Object.keys(z).length===0){if(b.json){console.log(JSON.stringify({},null,2));return}console.log("No performance data available. Run some STX commands first.");return}if(b.json)console.log(JSON.stringify(z,null,2));else{console.log(`
|
|
126
126
|
\uD83D\uDCCA STX Performance Statistics
|
|
127
|
-
`);for(let[k,j]of Object.entries(z))console.log(`\uD83D\uDD27 ${k}:`),console.log(` Count: ${j.count}`),console.log(` Average: ${j.avgTime.toFixed(2)}ms`),console.log(` Total: ${j.totalTime.toFixed(2)}ms`),console.log(` Min: ${j.minTime.toFixed(2)}ms`),console.log(` Max: ${j.maxTime.toFixed(2)}ms`),console.log("")}}catch(z){console.error("Error showing performance stats:",z),w.exit(1)}}),E.command("typecheck [patterns...]","Type-check the TypeScript inside .stx script blocks").option("--no-client","Skip <script client> and bare <script> blocks").option("--no-server","Skip <script server> blocks").option("--no-templates","Skip {{ }} and directive expressions in the markup").option("--lib <path>","Extra ambient declaration file (repeatable)").example("stx typecheck").example('stx typecheck "resources/views/**/*.stx"').action(async(x,b)=>{let{formatTypecheckDiagnostics:z,typecheckStxFiles:k}=await import("./chunk-
|
|
127
|
+
`);for(let[k,j]of Object.entries(z))console.log(`\uD83D\uDD27 ${k}:`),console.log(` Count: ${j.count}`),console.log(` Average: ${j.avgTime.toFixed(2)}ms`),console.log(` Total: ${j.totalTime.toFixed(2)}ms`),console.log(` Min: ${j.minTime.toFixed(2)}ms`),console.log(` Max: ${j.maxTime.toFixed(2)}ms`),console.log("")}}catch(z){console.error("Error showing performance stats:",z),w.exit(1)}}),E.command("typecheck [patterns...]","Type-check the TypeScript inside .stx script blocks").option("--no-client","Skip <script client> and bare <script> blocks").option("--no-server","Skip <script server> blocks").option("--no-templates","Skip {{ }} and directive expressions in the markup").option("--lib <path>","Extra ambient declaration file (repeatable)").example("stx typecheck").example('stx typecheck "resources/views/**/*.stx"').action(async(x,b)=>{let{formatTypecheckDiagnostics:z,typecheckStxFiles:k}=await import("./chunk-kdmkk0rb.js"),{resolveStxTargets:j}=await import("./chunk-dpyc7pht.js"),W=Array.isArray(x)?x:x?[x]:[],H=W.length?W:["**/*.stx"],U=await j(H);if(U.length===0){console.log(`
|
|
128
128
|
No .stx files matched ${H.join(", ")}
|
|
129
129
|
`);return}let Y=m(w.argv,"--lib"),Q=Y.length>0?Y:b.lib?Array.isArray(b.lib)?b.lib:[b.lib]:[],X=await k(U,{client:b.client!==!1,server:b.server!==!1,templates:b.templates!==!1,extraLibs:Q});if(X.failure)console.error(`
|
|
130
130
|
Type-check did not run.
|
|
@@ -135,8 +135,8 @@ ${Y} files need formatting. Run 'stx format' to fix.`),w.exit(1);else if(!b.chec
|
|
|
135
135
|
`),w.exit(2);let _=X.diagnostics.filter((q)=>q.category==="error");if(X.diagnostics.length>0)console.error(`
|
|
136
136
|
${z(X.diagnostics)}
|
|
137
137
|
`);if(console.log(` Checked ${X.blockCount} script block(s) and ${X.expressionCount} template expression(s) in ${X.checkedFiles.length} file(s) \u2014 `+`${_.length} error(s), ${X.diagnostics.length-_.length} warning(s)
|
|
138
|
-
`),_.length>0)w.exit(1)}),E.command("codemod [patterns...]","Find hand-rolled code that an stx primitive already covers").option("--fix","Write the safe rewrites (default is report-only)").option("--rule <rule>","Run one rule only: confirm | tooltip (rewritable) \xB7 alert | route-params | search-params | navigate | "+"fetch | polling | debounce | click-outside | focus | clipboard | watch (report-only)").example("stx codemod").example("stx codemod --rule route-params").example('stx codemod --fix "resources/views/**/*.stx"').action(async(x,b)=>{let{codemodSource:z,formatCodemodFindings:k}=await import("./chunk-
|
|
139
|
-
${X} file(s) written.`)}),E.command("doctor","Diagnose the stx framework-runtime resolution + staleness chain").option("--json","Output the report as JSON").example("stx doctor").example("stx doctor --json").action(async(x)=>{try{let b;try{b=(await import("./chunk-
|
|
138
|
+
`),_.length>0)w.exit(1)}),E.command("codemod [patterns...]","Find hand-rolled code that an stx primitive already covers").option("--fix","Write the safe rewrites (default is report-only)").option("--rule <rule>","Run one rule only: confirm | tooltip (rewritable) \xB7 alert | route-params | search-params | navigate | "+"fetch | polling | debounce | click-outside | focus | clipboard | watch (report-only)").example("stx codemod").example("stx codemod --rule route-params").example('stx codemod --fix "resources/views/**/*.stx"').action(async(x,b)=>{let{codemodSource:z,formatCodemodFindings:k}=await import("./chunk-h99qxgbr.js"),j=globalThis.Bun.Glob,W=Array.isArray(x)?x:x?[x]:[],H=W.length?W:["**/*.stx","**/*.ts"],U=b.rule?[b.rule]:void 0;if(b.rule&&b.rule!=="confirm"&&b.rule!=="tooltip")console.error(`Unknown rule "${b.rule}". Expected: confirm | tooltip`),w.exit(1);let Y=new Set,Q=[],X=0,_=new Set;try{let q=Bun.spawnSync(["git","ls-files","--others","--ignored","--exclude-standard","-z"],{cwd:w.cwd(),stdout:"pipe",stderr:"pipe"});for(let O of new TextDecoder().decode(q.stdout).split("\x00"))if(O)_.add($.resolve(w.cwd(),O))}catch{}for(let q of H)for await(let O of new j(q).scan({cwd:w.cwd(),absolute:!0})){if(O.includes("/node_modules/")||O.includes("/dist/")||Y.has(O)||_.has(O))continue;Y.add(O);let M=await Bun.file(O).text(),G=z(M,{file:O,rules:U});if(Q.push(...G.findings),b.fix&&G.code!==M)await Bun.write(O,G.code),X++}if(console.error(k(Q,Boolean(b.fix))),b.fix)console.error(`
|
|
139
|
+
${X} file(s) written.`)}),E.command("doctor","Diagnose the stx framework-runtime resolution + staleness chain").option("--json","Output the report as JSON").example("stx doctor").example("stx doctor --json").action(async(x)=>{try{let b;try{b=(await import("./chunk-2s3wvns6.js")).generateSignalsRuntime}catch{b=void 0}let z=await s({generateRuntime:b});if(x.json)console.log(JSON.stringify(z,null,2));else console.log(t(z));if(!z.ok)w.exit(1)}catch(b){console.error("Error running doctor:",b),w.exit(1)}}),E.command("debug <file>","Debug STX template processing step by step").option("--step","Step through processing stages interactively").option("--verbose","Show detailed processing information").option("--context <data>","JSON string of context data to use").option("--save-report <file>","Save debug report to file").example("stx debug template.stx").example("stx debug template.stx --step").example(`stx debug template.stx --context '{"name": "John", "items": [1,2,3]}'`).action(async(x,b)=>{try{let z=d(x);if(!z.isValid)S(z);console.log(`\uD83D\uDD0D Debugging stx template: ${x}
|
|
140
140
|
`);let k={};if(b.context)try{k=JSON.parse(b.context)}catch(H){console.error("\u274C Invalid JSON in --context option"),w.exit(1)}let j=await Bun.file(x).text();console.log(`\uD83D\uDCC4 Template Content (${j.length} chars):`),console.log("\u2500".repeat(50)),console.log(j.substring(0,500)+(j.length>500?`
|
|
141
141
|
...
|
|
142
142
|
`:"")),console.log("\u2500".repeat(50));let W=j.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(W)console.log(`
|
|
@@ -159,12 +159,12 @@ Press Ctrl+C to stop watching...
|
|
|
159
159
|
\uD83D\uDCDD ${$.relative(w.cwd(),Q.file)}`),console.log(` Lines: ${Q.metrics.lines} | Complexity: ${Q.metrics.complexity}/10 | Estimated render: ${Q.performance.estimatedRenderTime}ms`),Q.issues.length>0){let X=Q.issues.filter((_)=>j[_.type]>=W);if(X.length>0)console.log(` Issues (${X.length}):`),X.forEach((_)=>{let q=_.type==="error"?"\u274C":_.type==="warning"?"\u26A0\uFE0F":"\u2139\uFE0F";if(console.log(` ${q} ${_.message}`),_.suggestion)console.log(` \uD83D\uDCA1 ${_.suggestion}`)})}if(Q.suggestions.length>0)console.log(` Suggestions (${Q.suggestions.length}):`),Q.suggestions.forEach((X)=>{let _=X.impact==="high"?"\uD83D\uDD25":X.impact==="medium"?"\u26A1":"\uD83D\uDCAB";console.log(` ${_} ${X.message} (${X.impact} impact, ${X.effort} effort)`)})}}else if(Y.length>0&&!b.onlyIssues)console.log(`
|
|
160
160
|
\uD83D\uDCC4 Files with issues:`),Y.forEach((Q)=>{let X=Q.issues.filter((_)=>j[_.type]>=W).length;if(X>0)console.log(` ${$.relative(w.cwd(),Q.file)} (${X} issues)`)});if(b.saveReport){let Q={summary:U,results:Y,generatedAt:new Date().toISOString(),commandOptions:b};await Bun.write(b.saveReport,JSON.stringify(Q,null,2)),console.log(`
|
|
161
161
|
\uD83D\uDCCB Analysis report saved to: ${b.saveReport}`)}console.log(`
|
|
162
|
-
\u2728 Analysis complete! Use --detailed for more information.`)}catch(z){console.error("Error analyzing templates:",z),w.exit(1)}}),E.command("screenshot [input]","Capture PNG screenshot(s) of page(s) via Bun WebView \u2014 a file, URL, or dist directory").option("--out <dir>","Output directory",{default:"screenshots"}).option("--width <px>","Viewport width",{default:"1440"}).option("--height <px>","Viewport height",{default:"2200"}).option("--wait <ms>","Settle time after navigation before capture",{default:"800"}).option("--timeout <ms>","Hard cap on waiting for navigation",{default:"15000"}).option("--full-page","Capture the entire scrollable page, not just the viewport").option("--wait-selector <sel>","Wait until a CSS selector exists before capturing").option("--format <fmt>","Image format: png | jpeg | webp",{default:"png"}).option("--backend <name>","WebView backend: webkit (macOS, default) | chrome").action(async(x,b)=>{let{captureScreenshots:z}=await import("./chunk-
|
|
163
|
-
\u2728 Captured ${j.length} screenshot(s) to ${b.out}/ via Bun WebView`)}catch(j){console.error(`Screenshot failed: ${j.message}`),w.exit(1)}}),E.command("version","Show the version of the CLI").action(()=>{console.log(N)}),E.command("interactive","Start interactive REPL mode for template development").alias("i").option("--context <file>","Load initial context from JSON file").option("--cwd <directory>","Set working directory").option("--verbose","Show verbose output").action(async(x)=>{let{startInteractive:b}=await import("./chunk-
|
|
162
|
+
\u2728 Analysis complete! Use --detailed for more information.`)}catch(z){console.error("Error analyzing templates:",z),w.exit(1)}}),E.command("screenshot [input]","Capture PNG screenshot(s) of page(s) via Bun WebView \u2014 a file, URL, or dist directory").option("--out <dir>","Output directory",{default:"screenshots"}).option("--width <px>","Viewport width",{default:"1440"}).option("--height <px>","Viewport height",{default:"2200"}).option("--wait <ms>","Settle time after navigation before capture",{default:"800"}).option("--timeout <ms>","Hard cap on waiting for navigation",{default:"15000"}).option("--full-page","Capture the entire scrollable page, not just the viewport").option("--wait-selector <sel>","Wait until a CSS selector exists before capturing").option("--format <fmt>","Image format: png | jpeg | webp",{default:"png"}).option("--backend <name>","WebView backend: webkit (macOS, default) | chrome").action(async(x,b)=>{let{captureScreenshots:z}=await import("./chunk-rydb5n5b.js"),k=x||"dist";try{let j=await z(k,b.out,{width:Number.parseInt(b.width,10),height:Number.parseInt(b.height,10),waitMs:Number.parseInt(b.wait,10),timeoutMs:Number.parseInt(b.timeout,10),fullPage:Boolean(b.fullPage),waitSelector:b.waitSelector,format:b.format,backend:b.backend});for(let W of j)console.log(`\uD83D\uDCF8 ${W.output} (${(W.bytes/1024).toFixed(0)} KB)`);console.log(`
|
|
163
|
+
\u2728 Captured ${j.length} screenshot(s) to ${b.out}/ via Bun WebView`)}catch(j){console.error(`Screenshot failed: ${j.message}`),w.exit(1)}}),E.command("version","Show the version of the CLI").action(()=>{console.log(N)}),E.command("interactive","Start interactive REPL mode for template development").alias("i").option("--context <file>","Load initial context from JSON file").option("--cwd <directory>","Set working directory").option("--verbose","Show verbose output").action(async(x)=>{let{startInteractive:b}=await import("./chunk-z8gccz1q.js"),z={};if(x.context){let k=$.resolve(x.context);if(L.existsSync(k))try{let j=L.readFileSync(k,"utf-8");z=JSON.parse(j)}catch(j){console.error("Error loading context file:",j),w.exit(1)}else console.error(`Context file not found: ${k}`),w.exit(1)}await b({context:z,cwd:x.cwd?$.resolve(x.cwd):w.cwd(),verbose:x.verbose})}),E.command("build:native <input>","Build stx template into a native desktop/mobile app").option("--output <dir>","Output directory",{default:"dist/native"}).option("--target <platform>","Target platform: macos, windows, linux, ios, android").option("--format <format>","Output format: app, dmg, pkg, msi, zip, deb, rpm, appimage, ipa, apk").option("--name <name>","Application name (defaults to filename)").option("--version <version>","Application version",{default:"1.0.0"}).option("--description <desc>","Application description").option("--author <author>","Author/Maintainer name").option("--bundle-id <id>","Bundle identifier (macOS/iOS)").option("--icon <path>","Path to application icon").option("--width <width>","Window width",{default:"1200"}).option("--height <height>","Window height",{default:"800"}).option("--title <title>","Window title").option("--system-tray","Enable system tray/menubar mode").option("--menubar-only","Run without a dock icon (implied by --system-tray)").option("--category <type>","LSApplicationCategoryType (macOS)").option("--copyright <text>","NSHumanReadableCopyright (macOS)").option("--min-system-version <v>","LSMinimumSystemVersion (macOS)").option("--info-plist <json>","Extra Info.plist keys as a JSON object (macOS)").option("--dev-tools","Enable developer tools").option("--frameless","Create frameless window").option("--always-on-top","Keep window always on top").option("--craft-path <path>","Path to Craft binary").option("--verbose","Show verbose output").example("stx build:native app.stx --target macos").example("stx build:native app.stx --target macos --format dmg").example("stx build:native app.stx --target linux --format appimage").example('stx build:native app.stx --name "My App" --icon icon.png').action(async(x,b)=>{try{let{buildNative:z,getAvailableTargets:k,getAvailableFormats:j}=await import("./chunk-skdfq4hq.js"),W=$.resolve(x);if(!L.existsSync(W))console.error(`\u274C Input file not found: ${x}`),w.exit(1);let H=k();if(b.target&&!["macos","windows","linux","ios","android"].includes(b.target))console.error(`\u274C Invalid target: ${b.target}`),console.error("\uD83D\uDCA1 Available targets: macos, windows, linux, ios, android"),console.error(`\uD83D\uDCA1 Targets available on this machine: ${H.join(", ")}`),w.exit(1);let U=b.target||H[0],Y=j(U);if(b.format&&!Y.includes(b.format))console.error(`\u274C Invalid format for ${U}: ${b.format}`),console.error(`\uD83D\uDCA1 Available formats: ${Y.join(", ")}`),w.exit(1);console.log(`
|
|
164
164
|
\uD83D\uDD28 Building native app...`),console.log(` Input: ${x}`),console.log(` Target: ${U}`),console.log(` Format: ${b.format||"default"}`),console.log(` Output: ${b.output}
|
|
165
165
|
`);let Q=await z({input:W,output:$.resolve(b.output),target:U,format:b.format,name:b.name,version:b.version,description:b.description,author:b.author,bundleId:b.bundleId,icon:b.icon?$.resolve(b.icon):void 0,window:{title:b.title,width:Number.parseInt(b.width,10),height:Number.parseInt(b.height,10),frameless:b.frameless,alwaysOnTop:b.alwaysOnTop},systemTray:b.systemTray,menubarOnly:b.menubarOnly,category:b.category,copyright:b.copyright,minimumSystemVersion:b.minSystemVersion,infoPlist:kb(b.infoPlist),devTools:b.devTools,craftPath:b.craftPath,verbose:b.verbose});if(Q.success){if(console.log("\u2705 Build successful!"),console.log(` Output: ${Q.outputPath}`),Q.duration)console.log(` Duration: ${(Q.duration/1000).toFixed(2)}s`);if(U==="macos"&&Q.format==="app")console.log(`
|
|
166
166
|
\uD83D\uDCA1 To run: open "${Q.outputPath}"`);else if(U==="linux"&&Q.format==="appimage")console.log(`
|
|
167
|
-
\uD83D\uDCA1 To run: chmod +x "${Q.outputPath}" && "${Q.outputPath}"`)}else console.error(`\u274C Build failed: ${Q.error}`),w.exit(1)}catch(z){console.error(`\u274C Build error: ${z.message}`),w.exit(1)}}),E.command("story","Start component showcase and testing server").option("-p, --port <port>","Server port",{default:"6006"}).option("-o, --open","Open browser automatically",{default:!1}).option("--host <host>","Host to bind to",{default:"localhost"}).example("stx story").example("stx story --port 3000 --open").action(async(x)=>{try{let{devCommand:b}=await import("./chunk-
|
|
167
|
+
\uD83D\uDCA1 To run: chmod +x "${Q.outputPath}" && "${Q.outputPath}"`)}else console.error(`\u274C Build failed: ${Q.error}`),w.exit(1)}catch(z){console.error(`\u274C Build error: ${z.message}`),w.exit(1)}}),E.command("story","Start component showcase and testing server").option("-p, --port <port>","Server port",{default:"6006"}).option("-o, --open","Open browser automatically",{default:!1}).option("--host <host>","Host to bind to",{default:"localhost"}).example("stx story").example("stx story --port 3000 --open").action(async(x)=>{try{let{devCommand:b}=await import("./chunk-v1qm7p7t.js");await b({port:x.port?Number.parseInt(x.port,10):6006,open:x.open,host:x.host})}catch(b){console.error(`\u274C Story error: ${b.message}`),w.exit(1)}}),E.command("story:build","Build static story site").option("-o, --outDir <dir>","Output directory",{default:".stx/dist/story"}).example("stx story:build").example("stx story:build --outDir ./docs/components").action(async(x)=>{try{let{buildCommand:b}=await import("./chunk-c17ybabd.js");await b({outDir:x.outDir})}catch(b){console.error(`\u274C Story build error: ${b.message}`),w.exit(1)}}),E.command("story:test","Run visual regression tests").option("-u, --update","Update snapshots",{default:!1}).option("-f, --filter <name>","Filter components by name").example("stx story:test").example("stx story:test --update").example("stx story:test --filter Button").action(async(x)=>{try{let{createContext:b}=await import("./chunk-ep034wt0.js"),{runVisualTests:z,updateSnapshots:k,formatTestResults:j}=await import("./chunk-awyyskad.js"),W=await b({mode:"build"});if(x.update){let H=await k(W,{filter:x.filter?[x.filter]:void 0});console.log(`Updated ${H} snapshots`)}else{let H=await z(W,{filter:x.filter?[x.filter]:void 0});if(console.log(j(H)),H.failed>0)w.exit(1)}}catch(b){console.error(`\u274C Story test error: ${b.message}`),w.exit(1)}}),E.command("compile <input>","Compile stx template to native Craft component code").option("--target <platform>","Target platform: macos, windows, linux, ios, android, universal",{default:"universal"}).option("--format <format>","Output format: zig, typescript, json",{default:"zig"}).option("--output <path>","Output directory for compiled files",{default:"./dist"}).option("--optimize","Enable optimizations",{default:!0}).option("--tree-shake","Enable tree shaking",{default:!0}).option("--hot-reload","Enable hot reload support",{default:!1}).option("--sourcemaps","Generate source maps",{default:!1}).option("--bundle","Bundle all dependencies",{default:!0}).option("--minify","Minify output",{default:!1}).option("--verbose","Show detailed output",{default:!1}).example("stx compile app.stx").example("stx compile app.stx --target macos --format zig").example("stx compile app.stx --format typescript --output ./native").example("stx compile app.stx --optimize --tree-shake --minify").action(async(x,b)=>{try{let{compileToNative:z}=await import("./chunk-j6kec9kp.js"),k=$.resolve(x);if(!L.existsSync(k))console.error(`\u274C Input file not found: ${x}`),w.exit(1);let j=["macos","windows","linux","ios","android","universal"];if(!j.includes(b.target))console.error(`\u274C Invalid target: ${b.target}`),console.error(`\uD83D\uDCA1 Available targets: ${j.join(", ")}`),w.exit(1);let W=["zig","typescript","json"];if(!W.includes(b.format))console.error(`\u274C Invalid format: ${b.format}`),console.error(`\uD83D\uDCA1 Available formats: ${W.join(", ")}`),w.exit(1);console.log(`
|
|
168
168
|
\uD83D\uDD27 Compiling stx template to native code...`),console.log(` Input: ${x}`),console.log(` Target: ${b.target}`),console.log(` Format: ${b.format}`),console.log(` Output: ${b.output}
|
|
169
169
|
`);let H=L.readFileSync(k,"utf-8"),U=await z(H,{target:b.target,format:b.format,optimize:b.optimize,treeShake:b.treeShake,hotReload:b.hotReload,debug:b.verbose,sourceMaps:b.sourcemaps,bundle:b.bundle,minify:b.minify}),Y=$.resolve(b.output);if(!L.existsSync(Y))L.mkdirSync(Y,{recursive:!0});let Q=$.basename(x,$.extname(x)),X=b.format==="typescript"?"ts":b.format==="json"?"json":"zig",_=$.join(Y,`${Q}.${X}`);L.writeFileSync(_,U.code);let q=$.join(Y,`${Q}.manifest.json`);if(L.writeFileSync(q,JSON.stringify(U.manifest,null,2)),b.sourcemaps&&U.sourceMaps){let O=$.join(Y,`${Q}.${X}.map`);L.writeFileSync(O,U.sourceMaps)}if(b.target==="universal"&&U.platformCode.size>0)for(let[O,M]of U.platformCode){let G=$.join(Y,`${Q}.${O}.${X}`);L.writeFileSync(G,M)}if(console.log("\u2705 Compilation successful!"),console.log(` Output: ${_}`),console.log(` Manifest: ${q}`),console.log(`
|
|
170
170
|
\uD83D\uDCCA Statistics:`),console.log(` Compilation time: ${U.stats.compilationTime.toFixed(2)}ms`),console.log(` Total components: ${U.stats.totalComponents}`),console.log(` Native components: ${U.stats.nativeComponents}`),console.log(` Web fallback components: ${U.stats.webComponents}`),console.log(` Bundle size: ${(U.stats.bundleSize/1024).toFixed(2)}KB`),U.stats.warnings.length>0){console.log(`
|
package/dist/craft-entry.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Yj as Nj,Zj as wj,_j as Aj}from"./chunk-x21hdhjw.js";import{ak as Uj,bk as Xj,ck as Yj,dk as Zj,ek as _j,fk as $j,gk as qj,hk as Fj,ik as Oj,jk as Vj,kk as Ij,lk as Qj,mk as Wj,nk as Kj}from"./chunk-0dj2gne3.js";import"./chunk-ec8jsqgm.js";import"./chunk-3ssjb8cx.js";import"./chunk-ykevda74.js";import"./chunk-ez003q74.js";import"./chunk-kyyt9xhs.js";import"./chunk-tf16jtj4.js";import"./chunk-19m7hed6.js";import"./chunk-kjd9hbg4.js";import"./chunk-ejwfnttb.js";import"./chunk-5270fyk7.js";import"./chunk-q4kgqqed.js";import"./chunk-1nnza3m6.js";import"./chunk-hkrzv980.js";import"./chunk-qbz6yn8c.js";import"./chunk-czj6nq0b.js";import"./chunk-zxfejz72.js";import"./chunk-mere396d.js";import"./chunk-aa8015mk.js";import"./chunk-trva71am.js";import"./chunk-rtfwn4cm.js";import"./chunk-emjmshj8.js";var I=new Map,Q=new Map;function L(j,B){let G=B?.id||g(j),J=h(j),U=I.get(G);if(U&&U.hash===J)return U;let X=S(j),Z=y(j),Y=T(j),_=v(X),{staticParts:q,dynamicParts:$}=C(X),F=u(j),O={id:G,hash:J,tree:X,scripts:Z,styles:Y,staticParts:q,dynamicParts:$,dependencies:F,metadata:_};return I.set(G,O),O}async function r(j,B={},G={}){let J=performance.now();if(G.cache){let Y=`${j.id}:${JSON.stringify(B)}`,_=Q.get(Y);if(_&&Date.now()-_.timestamp<(G.cacheTTL||60000))return{html:_.html,styles:j.styles.join(`
|
|
3
3
|
`),scripts:j.scripts.join(`
|
|
4
4
|
`),metadata:{renderTime:0,cacheHit:!0,totalSize:_.html.length,componentCount:j.metadata.componentCount}}}let U;if(G.streaming)U=await H(j.tree,B);else U=W(j.tree,B);let X;if(G.hydrate){let Y=k(U,j,B);U=Y.html,X=Y.data}if(G.minify)U=x(U);if(G.cache){let Y=`${j.id}:${JSON.stringify(B)}`;Q.set(Y,{html:U,timestamp:Date.now()})}let Z=performance.now()-J;return{html:U,styles:j.styles.join(`
|
|
5
5
|
`),scripts:j.scripts.join(`
|
package/dist/craft.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Yj as Nj,Zj as wj,_j as Aj}from"./chunk-x21hdhjw.js";import{ak as Uj,bk as Xj,ck as Yj,dk as Zj,ek as _j,fk as $j,gk as qj,hk as Fj,ik as Oj,jk as Vj,kk as Ij,lk as Qj,mk as Wj,nk as Kj}from"./chunk-0dj2gne3.js";import"./chunk-ec8jsqgm.js";import"./chunk-3ssjb8cx.js";import"./chunk-ykevda74.js";import"./chunk-ez003q74.js";import"./chunk-kyyt9xhs.js";import"./chunk-tf16jtj4.js";import"./chunk-19m7hed6.js";import"./chunk-kjd9hbg4.js";import"./chunk-ejwfnttb.js";import"./chunk-5270fyk7.js";import"./chunk-q4kgqqed.js";import"./chunk-1nnza3m6.js";import"./chunk-hkrzv980.js";import"./chunk-qbz6yn8c.js";import"./chunk-czj6nq0b.js";import"./chunk-zxfejz72.js";import"./chunk-mere396d.js";import"./chunk-aa8015mk.js";import"./chunk-trva71am.js";import"./chunk-rtfwn4cm.js";import"./chunk-emjmshj8.js";var I=new Map,Q=new Map;function L(j,B){let G=B?.id||g(j),J=h(j),U=I.get(G);if(U&&U.hash===J)return U;let X=S(j),Z=y(j),Y=T(j),_=v(X),{staticParts:q,dynamicParts:$}=C(X),F=u(j),O={id:G,hash:J,tree:X,scripts:Z,styles:Y,staticParts:q,dynamicParts:$,dependencies:F,metadata:_};return I.set(G,O),O}async function r(j,B={},G={}){let J=performance.now();if(G.cache){let Y=`${j.id}:${JSON.stringify(B)}`,_=Q.get(Y);if(_&&Date.now()-_.timestamp<(G.cacheTTL||60000))return{html:_.html,styles:j.styles.join(`
|
|
3
3
|
`),scripts:j.scripts.join(`
|
|
4
4
|
`),metadata:{renderTime:0,cacheHit:!0,totalSize:_.html.length,componentCount:j.metadata.componentCount}}}let U;if(G.streaming)U=await H(j.tree,B);else U=W(j.tree,B);let X;if(G.hydrate){let Y=k(U,j,B);U=Y.html,X=Y.data}if(G.minify)U=x(U);if(G.cache){let Y=`${j.id}:${JSON.stringify(B)}`;Q.set(Y,{html:U,timestamp:Date.now()})}let Z=performance.now()-J;return{html:U,styles:j.styles.join(`
|
|
5
5
|
`),scripts:j.scripts.join(`
|