@stacksjs/stx 0.2.286 → 0.2.288
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/builtins/index.d.ts +4 -3
- package/dist/builtins/index.js +11 -11
- package/dist/{chunk-3bv8h4r6.js → chunk-02af607x.js} +1 -1
- package/dist/chunk-06706a9a.js +2 -0
- package/dist/chunk-0896td83.js +2 -0
- package/dist/chunk-08yja60e.js +2 -0
- package/dist/{chunk-e2w23g2r.js → chunk-13tawjw8.js} +10 -10
- package/dist/{chunk-zn5jgmqw.js → chunk-1e83cj7k.js} +1 -1
- package/dist/chunk-1g6pvs7k.js +11 -0
- package/dist/chunk-1gvebxh4.js +2 -0
- package/dist/{chunk-jbfpc4z7.js → chunk-1t9g3mhg.js} +2 -2
- package/dist/{chunk-0f1kz0x2.js → chunk-2e6xafcm.js} +1 -1
- package/dist/chunk-2rfxs7zm.js +2 -0
- package/dist/{chunk-sskbegsz.js → chunk-2vza9m2x.js} +1 -1
- package/dist/{chunk-pbk8jxe2.js → chunk-2wtn443n.js} +1 -1
- package/dist/{chunk-6cye5m9f.js → chunk-34qkshwh.js} +2 -2
- package/dist/{chunk-2g9jwgs7.js → chunk-3br3pt6k.js} +1 -1
- package/dist/{chunk-kmhr1z0m.js → chunk-3p0n9ryv.js} +1 -1
- package/dist/chunk-437n7hyx.js +2 -0
- package/dist/{chunk-ayrjwkyw.js → chunk-461br5nn.js} +1 -1
- package/dist/chunk-4tr92e0v.js +2 -0
- package/dist/{chunk-t6nseeb9.js → chunk-4vpsvh6x.js} +1 -1
- package/dist/{chunk-nh21517m.js → chunk-5j9tvhpq.js} +2 -2
- package/dist/{chunk-mb518a4n.js → chunk-5yp3vt00.js} +1 -1
- package/dist/{chunk-e4hhz9j3.js → chunk-5zcg61j9.js} +2 -2
- package/dist/{chunk-snknv47x.js → chunk-6085vha7.js} +1 -1
- package/dist/{chunk-9th1wd1d.js → chunk-72c7gyqc.js} +3 -3
- package/dist/chunk-811cxzn4.js +2 -0
- package/dist/{chunk-bz2gytfs.js → chunk-8883pgj8.js} +1 -1
- package/dist/{chunk-vqxmxgaj.js → chunk-8bxtvsgm.js} +1 -1
- package/dist/{chunk-a63y3aa0.js → chunk-8daczchh.js} +1 -1
- package/dist/chunk-91ffbzmh.js +2 -0
- package/dist/chunk-96cqevhm.js +2 -0
- package/dist/chunk-978faewt.js +2 -0
- package/dist/{chunk-g3fy0tw8.js → chunk-9veqmqb6.js} +154 -48
- package/dist/{chunk-7q9mwh4v.js → chunk-a668m28h.js} +1 -1
- package/dist/{chunk-xg57nax9.js → chunk-a9fxxwrv.js} +2 -2
- package/dist/chunk-adkjxvy6.js +2 -0
- package/dist/{chunk-a2qghr2x.js → chunk-agx0620p.js} +1 -1
- package/dist/chunk-ak06mywr.js +2 -0
- package/dist/chunk-ayaz0wcj.js +2 -0
- package/dist/{chunk-ah4e6e09.js → chunk-bphx7ngb.js} +2 -2
- package/dist/chunk-bw48gj8j.js +2 -0
- package/dist/{chunk-7rxtra1g.js → chunk-byq2xpgb.js} +1 -1
- package/dist/chunk-bzsjhyet.js +2 -0
- package/dist/{chunk-rhs51nmz.js → chunk-ch31zddx.js} +2 -2
- package/dist/chunk-cqzqfm7m.js +2 -0
- package/dist/{chunk-9zndrzb3.js → chunk-d0f60jrg.js} +2 -2
- package/dist/{chunk-c0an64km.js → chunk-dcxtrqfy.js} +1 -1
- package/dist/{chunk-bf8wf3r2.js → chunk-drbbt69f.js} +35 -10
- package/dist/chunk-e0aybavh.js +2 -0
- package/dist/chunk-e63a220e.js +28 -0
- package/dist/chunk-e67w1bge.js +2 -0
- package/dist/chunk-e7kd0ny8.js +2 -0
- package/dist/{chunk-y8n174xq.js → chunk-ee2tfpec.js} +2 -2
- package/dist/{chunk-9n0gvfrg.js → chunk-efr3ejqt.js} +1 -1
- package/dist/chunk-evfct6hb.js +2 -0
- package/dist/{chunk-kzyhvrp8.js → chunk-favq46aa.js} +1 -1
- package/dist/{chunk-0fgcnv6y.js → chunk-fcfphfpw.js} +2 -2
- package/dist/{chunk-w95sp0k9.js → chunk-fed3xsp9.js} +2 -2
- package/dist/{chunk-e7jfpyqy.js → chunk-ffmtamm2.js} +1 -1
- package/dist/{chunk-39f40yc4.js → chunk-fv923f7g.js} +1 -1
- package/dist/{chunk-jr3jp3ev.js → chunk-fvh9ca47.js} +1 -1
- package/dist/chunk-fxk9j0rm.js +2 -0
- package/dist/{chunk-fskfes13.js → chunk-gy933rct.js} +1 -1
- package/dist/{chunk-f3hfk78e.js → chunk-h61qt916.js} +1 -1
- package/dist/{chunk-c6fw33zh.js → chunk-h7v70dbp.js} +2 -2
- package/dist/{chunk-bz820epz.js → chunk-hmf9z4jx.js} +1 -1
- package/dist/{chunk-j9g11dzx.js → chunk-hqh7x9h5.js} +2 -2
- package/dist/{chunk-hs0387tm.js → chunk-hv5v6vc2.js} +2 -2
- package/dist/{chunk-xttsqmkm.js → chunk-jem20v5k.js} +1 -1
- package/dist/{chunk-t1k5dpbr.js → chunk-jj6yp7gm.js} +1 -1
- package/dist/{chunk-90qr4f9m.js → chunk-jv91rkhx.js} +1 -1
- package/dist/{chunk-qbeffw17.js → chunk-jyc9eha6.js} +1 -1
- package/dist/{chunk-w3ycm4na.js → chunk-k0y7ta0d.js} +1 -1
- package/dist/chunk-k4jt9t4p.js +2 -0
- package/dist/{chunk-9y0g8kzt.js → chunk-k70fgb2f.js} +1 -1
- package/dist/{chunk-74cv4ta1.js → chunk-k78gvm0g.js} +1 -1
- package/dist/{chunk-jn6m8zf7.js → chunk-kb5j08tq.js} +1 -1
- package/dist/{chunk-a54n1r1q.js → chunk-kf8t2wq7.js} +1 -1
- package/dist/chunk-kfy1jh6p.js +2 -0
- package/dist/chunk-kws4rewx.js +17 -0
- package/dist/{chunk-s67mgegv.js → chunk-mc58fhgm.js} +1 -1
- package/dist/{chunk-n3ggrhb3.js → chunk-mjpqz66q.js} +1 -1
- package/dist/{chunk-mjkfc2v6.js → chunk-mmnqd035.js} +1 -1
- package/dist/{chunk-54st8g2j.js → chunk-mywp77gt.js} +1 -1
- package/dist/{chunk-p396xrew.js → chunk-n0j85038.js} +1 -1
- package/dist/{chunk-gjemavhx.js → chunk-n5y9gh1q.js} +1 -1
- package/dist/{chunk-qd8ggjdx.js → chunk-n9kk3jz1.js} +1 -1
- package/dist/{chunk-49kk0s96.js → chunk-nmkra8q5.js} +2 -2
- package/dist/{chunk-s2284nbk.js → chunk-np5dc1q1.js} +1 -1
- package/dist/chunk-nygtwffe.js +5 -0
- package/dist/{chunk-y6kw0wb7.js → chunk-p0zq5ckb.js} +1 -1
- package/dist/chunk-pb16azfa.js +4 -0
- package/dist/{chunk-nx5qkm8k.js → chunk-ps20v1ah.js} +1 -1
- package/dist/chunk-pv9apyrr.js +2 -0
- package/dist/chunk-qj2s3r1w.js +3756 -0
- package/dist/chunk-qjkzpd68.js +11 -0
- package/dist/chunk-qww39be9.js +2 -0
- package/dist/chunk-r90w3x6h.js +2 -0
- package/dist/chunk-rb87b7kr.js +2 -0
- package/dist/{chunk-an2539bs.js → chunk-rjqfa3g8.js} +2 -2
- package/dist/{chunk-2q630fj4.js → chunk-sag55qv7.js} +1 -1
- package/dist/chunk-srcbkg7g.js +2 -0
- package/dist/chunk-sxderfaa.js +12 -0
- package/dist/{chunk-ysnk7x79.js → chunk-t5c7rk0h.js} +1 -1
- package/dist/chunk-v2z3creg.js +2 -0
- package/dist/chunk-vtjfv7kg.js +2 -0
- package/dist/{chunk-5aq35j2e.js → chunk-vvqe2gaz.js} +2 -2
- package/dist/{chunk-s7pc68jf.js → chunk-vwzqg4fh.js} +2 -2
- package/dist/{chunk-7p9ns60j.js → chunk-vxxxczmn.js} +1 -1
- package/dist/chunk-vzzkhjw7.js +2 -0
- package/dist/{chunk-wcm80anz.js → chunk-wvq1g6gr.js} +1 -1
- package/dist/{chunk-y7m2dpd3.js → chunk-wyxw61az.js} +1 -1
- package/dist/{chunk-kdrpx9ft.js → chunk-xpct12p7.js} +1 -1
- package/dist/chunk-xvndd7h6.js +2 -0
- package/dist/{chunk-d0c3v7ax.js → chunk-y5jjrnfa.js} +1 -1
- package/dist/{chunk-vbdca0k1.js → chunk-ym4ggcpy.js} +1 -1
- package/dist/{chunk-q68xmak4.js → chunk-ymc99r5x.js} +18 -18
- package/dist/{chunk-refwkt87.js → chunk-ynt7y2n5.js} +1 -1
- package/dist/chunk-z6azwfb4.js +2 -0
- package/dist/chunk-zfnabevq.js +2 -0
- package/dist/{chunk-cvnh7dma.js → chunk-zqwmy0av.js} +1 -1
- package/dist/{chunk-phhzfeh9.js → chunk-zvw2qgwt.js} +1 -1
- package/dist/cli.js +14 -14
- package/dist/client-module-registry.d.ts +36 -0
- package/dist/client-module-registry.js +55 -0
- package/dist/client-script-bundler.d.ts +39 -0
- package/dist/client-script-bundler.js +89 -12
- package/dist/client-script.js +15 -8
- package/dist/component-client-factories.js +10 -5
- package/dist/component-processing.d.ts +13 -0
- package/dist/component-processing.js +37 -1
- package/dist/component-renderer.js +34 -15
- package/dist/conditionals.js +14 -3
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/database.js +1 -1
- package/dist/document-shell.d.ts +1 -34
- package/dist/document-shell.js +19 -11
- package/dist/html-masking.d.ts +65 -9
- package/dist/html-masking.js +103 -15
- package/dist/misc-directives.d.ts +1 -1
- package/dist/misc-directives.js +48 -13
- package/dist/process.js +38 -7
- package/dist/pwa.js +2 -2
- package/dist/reactive-bindings.js +2 -0
- package/dist/runtime-globals.d.ts +7 -20
- package/dist/runtime-globals.js +28 -3
- package/dist/safe-evaluator.d.ts +15 -0
- package/dist/safe-evaluator.js +16 -12
- package/dist/server-bindings.js +21 -5
- package/dist/signal-processing.d.ts +17 -7
- package/dist/signal-processing.js +116 -46
- package/dist/signals-api.js +5 -2
- package/dist/signals.js +153 -47
- package/dist/ssg.js +2 -2
- package/dist/store-loader.js +1 -1
- package/dist/strip-literals.d.ts +20 -0
- package/dist/strip-literals.js +16 -0
- package/dist/utils.js +24 -7
- package/dist/variable-extractor.js +17 -47
- package/dist/visual-testing.js +1 -1
- package/package.json +5 -5
- package/dist/chunk-3ehv1by2.js +0 -2
- package/dist/chunk-4cqgbcy7.js +0 -3756
- package/dist/chunk-52mh63sp.js +0 -11
- package/dist/chunk-56ywtaff.js +0 -2
- package/dist/chunk-61sj52qh.js +0 -2
- package/dist/chunk-7ej1d910.js +0 -2
- package/dist/chunk-829pcte9.js +0 -2
- package/dist/chunk-8emkx9ja.js +0 -2
- package/dist/chunk-ajbfeey7.js +0 -2
- package/dist/chunk-areethga.js +0 -2
- package/dist/chunk-b29wbjs5.js +0 -2
- package/dist/chunk-b7tjq91c.js +0 -2
- package/dist/chunk-ba6tthsm.js +0 -2
- package/dist/chunk-e4akvata.js +0 -2
- package/dist/chunk-f4k2a7vs.js +0 -2
- package/dist/chunk-f80wwn5x.js +0 -2
- package/dist/chunk-fjkstnz3.js +0 -2
- package/dist/chunk-j03bare5.js +0 -2
- package/dist/chunk-jg0axas8.js +0 -2
- package/dist/chunk-jrk8rhwt.js +0 -28
- package/dist/chunk-kawk5ve9.js +0 -2
- package/dist/chunk-m3yaa0v5.js +0 -15
- package/dist/chunk-m7xnzt2t.js +0 -2
- package/dist/chunk-mkn6qqc7.js +0 -2
- package/dist/chunk-n3jyv9z6.js +0 -2
- package/dist/chunk-nvgxjvnb.js +0 -2
- package/dist/chunk-qk8tbcwk.js +0 -2
- package/dist/chunk-qp97dx7x.js +0 -2
- package/dist/chunk-qsr3bqav.js +0 -12
- package/dist/chunk-vb10qph4.js +0 -2
- package/dist/chunk-vrvehb01.js +0 -2
- package/dist/chunk-vy8v5xdb.js +0 -2
- package/dist/chunk-w0sqz3cb.js +0 -11
- package/dist/chunk-w8smn72c.js +0 -2
- package/dist/chunk-wxk2pbrh.js +0 -2
- package/dist/chunk-x1nw1p8z.js +0 -2
- package/dist/chunk-xz55q3gr.js +0 -2
- package/dist/chunk-yq1d9hb3.js +0 -2
- package/dist/chunk-ytgnzeeb.js +0 -2
- package/dist/chunk-zfr4d08r.js +0 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{d as
|
|
2
|
+
import{kv as l}from"./chunk-2vza9m2x.js";import U from"fs";import G from"path";import I from"os";import H from"crypto";import{generatePlaceholder as m,processImage as g}from"ts-images";var d=[320,640,768,1024,1280,1536,1920],h=["webp","jpeg"],b=80,u=[".jpg",".jpeg",".png",".webp",".avif",".gif",".svg"],P={webp:"image/webp",avif:"image/avif",jpeg:"image/jpeg",png:"image/png"},N=null,W=!1;async function Y(){if(W)return N;W=!0;try{let J=await import("sharp");return N=J.default||J,N}catch{return null}}async function e(){return await Y()!==null}async function t(){return!0}async function JJ(J,K={}){let{widths:Z=d,formats:$=h,quality:q=b,fit:C="cover",placeholder:X="none",outputDir:Q=".stx/images",baseUrl:_="/images"}=K,j,x;if(typeof J==="string"){if(x=J,!await Bun.file(J).exists())throw new L(`Image not found: ${J}`,"NOT_FOUND");j=await Bun.file(J).arrayBuffer().then((V)=>Buffer.from(V))}else x="buffer-input",j=J;let w=H.createHash("sha256").update(j).digest("hex").slice(0,12),y=await O(j),{width:B,height:D}=y,A=B/D;await U.promises.mkdir(Q,{recursive:!0});let T=[],v=G.basename(x,G.extname(x)),z=Z.filter((V)=>V<=B);if(!z.includes(B)&&B<=Math.max(...Z))z.push(B);z.sort((V,R)=>V-R);for(let V of z){let R=Math.round(V/A);for(let F of $){let S=`${v}-${V}w-${w}.${F}`,k=G.join(Q,S),c=`${_}/${S}`,E=await n(j,{width:V,height:R,format:F,quality:q,fit:C});await Bun.write(k,E),T.push({path:k,url:c,width:V,height:R,format:F,size:E.length})}}let M;if(X!=="none")M=await o(j,X);return{src:x,variants:T,placeholder:M,width:B,height:D,aspectRatio:A,hash:w}}async function O(J){let K=typeof J==="string"?Buffer.from(await Bun.file(J).arrayBuffer()):J,Z=await Y();if(Z){let q=await Z(K).metadata();return{width:q.width||0,height:q.height||0,format:q.format||"unknown",hasAlpha:q.hasAlpha}}return p(K)}function p(J){if(J[0]===137&&J[1]===80&&J[2]===78&&J[3]===71){let K=J.readUInt32BE(16),Z=J.readUInt32BE(20);return{width:K,height:Z,format:"png",hasAlpha:!0}}if(J[0]===255&&J[1]===216){let K=2;while(K<J.length){if(J[K]!==255)break;let Z=J[K+1];if(Z>=192&&Z<=207&&Z!==196&&Z!==200&&Z!==204){let q=J.readUInt16BE(K+5);return{width:J.readUInt16BE(K+7),height:q,format:"jpeg",hasAlpha:!1}}let $=J.readUInt16BE(K+2);K+=2+$}}if(J.toString("utf8",0,4)==="RIFF"&&J.toString("utf8",8,12)==="WEBP"){let K=J.toString("utf8",12,16);if(K==="VP8 "){let Z=J.readUInt16LE(26)&16383,$=J.readUInt16LE(28)&16383;return{width:Z,height:$,format:"webp",hasAlpha:!1}}if(K==="VP8L"){let Z=J.readUInt32LE(21),$=(Z&16383)+1,q=(Z>>14&16383)+1;return{width:$,height:q,format:"webp",hasAlpha:!0}}}if(J.toString("utf8",0,3)==="GIF"){let K=J.readUInt16LE(6),Z=J.readUInt16LE(8);return{width:K,height:Z,format:"gif",hasAlpha:!0}}throw new L("Unable to parse image dimensions","PARSE_ERROR")}async function n(J,K){let Z=await Y();if(Z){let q=Z(J).resize(K.width,K.height,{fit:K.fit});switch(K.format){case"webp":q=q.webp({quality:K.quality});break;case"avif":q=q.avif({quality:K.quality});break;case"jpeg":q=q.jpeg({quality:K.quality});break;case"png":q=q.png({quality:K.quality});break}return q.toBuffer()}let $=G.join(I.tmpdir(),`stx-img-${H.randomBytes(8).toString("hex")}.${K.format}`);try{return await g({input:J,output:$,format:K.format,quality:K.quality,resize:{width:K.width,height:K.height,fit:K.fit}}),Buffer.from(await Bun.file($).arrayBuffer())}finally{await U.promises.unlink($).catch(()=>{})}}async function o(J,K){let Z=await Y();if(K==="blur"&&Z){let X=(await Z(J).resize(20).blur(10).toBuffer()).toString("base64"),Q=await O(J);return`data:${P[Q.format]||"image/jpeg"};base64,${X}`}if(K==="dominant-color"&&Z){let{dominant:C}=await Z(J).resize(1,1).toBuffer().then(async(X)=>{let Q=await Z(X).metadata();return{dominant:{r:128,g:128,b:128}}}).catch(()=>({dominant:{r:128,g:128,b:128}}));return`rgb(${C.r}, ${C.g}, ${C.b})`}let $=await O(J),q=G.join(I.tmpdir(),`stx-ph-${H.randomBytes(8).toString("hex")}.${$.format==="unknown"?"bin":$.format}`);try{await Bun.write(q,J);let C=K==="blur"?"blur":K==="thumbhash"?"thumbhash":"dominant-color",Q=await m(q,{strategy:C,width:C==="thumbhash"?void 0:32});if(K==="dominant-color"&&Q.dominantColor)return Q.dominantColor;if(Q.dataURL)return Q.dataURL;return"rgb(128, 128, 128)"}catch{return"rgb(128, 128, 128)"}finally{await U.promises.unlink(q).catch(()=>{})}}function KJ(J,K){return(K?J.filter(($)=>$.format===K):J).sort(($,q)=>$.width-q.width).map(($)=>`${$.url} ${$.width}w`).join(", ")}function ZJ(J){if(!J||Object.keys(J).length===0)return"100vw";return Object.entries(J).sort((Z,$)=>{let q=Number.parseInt(Z[0].replace(/\D/g,""))||0;return(Number.parseInt($[0].replace(/\D/g,""))||0)-q}).map(([Z,$])=>`(max-width: ${Z}) ${$}`).join(", ")+", 100vw"}function $J(J){let K=J.filter(($)=>$.format==="jpeg");if(K.length===0)return J[Math.floor(J.length/2)];let Z=K.sort(($,q)=>$.width-q.width);return Z[Math.floor(Z.length/2)]}function qJ(J){let K=new Map;for(let Z of J){let $=K.get(Z.format)||[];$.push(Z),K.set(Z.format,$)}return K}function CJ(J){let K=G.extname(J).toLowerCase();return u.includes(K)}function QJ(J){return P[J]||"application/octet-stream"}function VJ(J){return J.reduce((K,Z)=>K+Z.size,0)}function XJ(J){if(J<1024)return`${J} B`;if(J<1048576)return`${(J/1024).toFixed(1)} KB`;return`${(J/1048576).toFixed(2)} MB`}class L extends Error{code;constructor(J,K){super(J);this.name="ImageProcessingError",this.code=K}}
|
|
3
|
+
export{d as Eh,h as Fh,b as Gh,e as Hh,t as Ih,JJ as Jh,O as Kh,n as Lh,KJ as Mh,ZJ as Nh,$J as Oh,qJ as Ph,CJ as Qh,QJ as Rh,VJ as Sh,XJ as Th,L as Uh};
|
|
@@ -144,4 +144,4 @@ var N=new Map,Q=new Map;function T(A){if(N.set(A.name,A),A.client)Q.set(A.name,A
|
|
|
144
144
|
console.log('[stx] Directive runtime initialized');
|
|
145
145
|
})();
|
|
146
146
|
`}function $(A){let B=/v-(\w+)(?::(\w+))?(?:\.([\w.]+))?="([^"]*)"/g;return A.replace(B,(C,F,H,L,J)=>{let E=(L?L.split("."):[]).reduce((M,S)=>{return M[S]=!0,M},{});return`data-stx-directive="${F}:${J}" data-stx-directive-arg="${H||""}" data-stx-directive-modifiers='${JSON.stringify(E)}'`})}
|
|
147
|
-
export{T as
|
|
147
|
+
export{T as Ns,V as Os,W as Ps,X as Qs,G as Rs,Y as Ss,Z as Ts,_ as Us,$ as Vs};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
`),s=y.join(t,"route-types.d.ts");try{if(h.existsSync(s)&&h.readFileSync(s,"utf8")===n)return;h.mkdirSync(t,{recursive:!0}),h.writeFileSync(s,n)}catch{}}function S(e,t,a){let r=process.cwd(),n=y.relative(r,a),s=e.filter((i)=>!m(i.pattern)),o=["// Auto-generated by stx \u2014 do not edit",`// Source: ${n||"pages"}/`,"","export const routes = ["];for(let i of s){let
|
|
4
|
-
`))}var F=u(()=>{b()});import V from"path";function k(e,t){let r=V.relative(t,e).replace(/\.(stx|md)$/,"");if(r=r.split(V.sep).join("/"),r==="index")return"/";if(r.endsWith("/index"))r=r.slice(0,-6);return r=r.replace(/\[\[([^\]]+)\]\]/g,":$1?"),r=r.replace(/\[([^\]]+)\]/g,":$1"),r=r.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${r}`}function v(e){let t=[],a="",r=0;while(r<e.length){let n=e.slice(r),s=/^\/:([^/?*]+)\?/.exec(n);if(s){t.push(s[1]),a+="(?:/([^/]+))?",r+=s[0].length;continue}let o=/^:([^/?*]+)\*/.exec(n);if(o){t.push(o[1]),a+="(.+)",r+=o[0].length;continue}let i=/^:([^/?*]+)/.exec(n);if(i){t.push(i[1]),a+="([^/]+)",r+=i[0].length;continue}a+=e[r].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),r+=1}return{regex:new RegExp(`^${a}$`),params:t}}function D(e,t){let a=e===""?"/":e;for(let r of t){let n=a.match(r.regex);if(n){let s={};return r.params.forEach((o,i)=>{s[o]=n[i+1]}),{route:r,params:s}}}return null}function W(e){let t=e.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return v(t)}var
|
|
2
|
+
import{iv as Ae,jv as u}from"./chunk-2vza9m2x.js";function _(e){return e.split(/[\\/]/).filter(Boolean).slice(0,-1).some((a)=>g.includes(a))}function m(e){return _(e.replace(/^\//,""))}var g;var b=u(()=>{g=["components","layouts","partials","emails"]});import h from"fs";import y from"path";function x(e,t){let a=e.filter((o)=>!m(o.pattern)),r=["// Auto-generated by STX - do not edit"];if(a.length===0)r.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{r.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let o of a){let i=[];for(let l of o.params){let f=o.pattern.includes(`:${l}?`)?"?":"";i.push(`${l}${f}: string`)}let c=i.join("; ");r.push(` '${o.pattern}': { ${c} }`)}r.push(" }","}","","export {}","")}let n=r.join(`
|
|
3
|
+
`),s=y.join(t,"route-types.d.ts");try{if(h.existsSync(s)&&h.readFileSync(s,"utf8")===n)return;h.mkdirSync(t,{recursive:!0}),h.writeFileSync(s,n)}catch{}}function S(e,t,a){let r=process.cwd(),n=y.relative(r,a),s=e.filter((i)=>!m(i.pattern)),o=["// Auto-generated by stx \u2014 do not edit",`// Source: ${n||"pages"}/`,"","export const routes = ["];for(let i of s){let c=y.relative(r,i.filePath).replace(/\\/g,"/"),l=JSON.stringify(i.params),f=i.layout?`, layout: '${y.relative(r,i.layout).replace(/\\/g,"/")}'`:"";o.push(` { pattern: '${i.pattern}', filePath: '${c}', isDynamic: ${i.isDynamic}, params: ${l}${f} },`)}o.push("] as const",""),o.push("export type RouteName = typeof routes[number]['pattern']",""),h.mkdirSync(t,{recursive:!0}),h.writeFileSync(y.join(t,"routes.ts"),o.join(`
|
|
4
|
+
`))}var F=u(()=>{b()});import V from"path";function k(e,t){let r=V.relative(t,e).replace(/\.(stx|md)$/,"");if(r=r.split(V.sep).join("/"),r==="index")return"/";if(r.endsWith("/index"))r=r.slice(0,-6);return r=r.replace(/\[\[([^\]]+)\]\]/g,":$1?"),r=r.replace(/\[([^\]]+)\]/g,":$1"),r=r.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${r}`}function v(e){let t=[],a="",r=0;while(r<e.length){let n=e.slice(r),s=/^\/:([^/?*]+)\?/.exec(n);if(s){t.push(s[1]),a+="(?:/([^/]+))?",r+=s[0].length;continue}let o=/^:([^/?*]+)\*/.exec(n);if(o){t.push(o[1]),a+="(.+)",r+=o[0].length;continue}let i=/^:([^/?*]+)/.exec(n);if(i){t.push(i[1]),a+="([^/]+)",r+=i[0].length;continue}a+=e[r].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),r+=1}return{regex:new RegExp(`^${a}$`),params:t}}function D(e,t){let a=e===""?"/":e;for(let r of t){let n=a.match(r.regex);if(n){let s={};return r.params.forEach((o,i)=>{s[o]=n[i+1]}),{route:r,params:s}}}return null}function W(e){let t=e.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return v(t)}var I=()=>{};import xe from"fs";import M from"path";function A(e,t){let a=[],r=M.dirname(e);while(r.startsWith(t)||r===t){let n=M.join(r,"_layout.stx");if(xe.existsSync(n))a.unshift(n);if(r===t)break;r=M.dirname(r)}return a}var N=()=>{};import P from"fs";import d from"path";function K(e,t){let a=[];if(!P.existsSync(e))return a;let r=P.readdirSync(e,{withFileTypes:!0});for(let n of r){let s=d.join(e,n.name);if(n.isDirectory()){if(n.name.startsWith("."))continue;if(g.includes(n.name))continue;a.push(...K(s,t))}else if(n.isFile()){let o=d.extname(n.name);if(t.includes(o)){if(n.name.startsWith("_")&&n.name!=="_layout.stx")continue;if(n.name==="_layout.stx")continue;a.push(s)}}}return a}class C{routes;pagesDir;pagesDirs;config;constructor(e,t={}){this.config=t;let a=t.pagesDirs&&t.pagesDirs.length>0?t.pagesDirs:[t.pagesDir||"pages"];this.pagesDirs=a.map((o)=>d.resolve(e,o)),this.pagesDir=this.pagesDirs[0];let r=t.extensions||[".stx"],n=new Set;this.routes=[];for(let o of this.pagesDirs){let i=K(o,r);for(let c of i){let l=k(c,o);if(n.has(l))continue;n.add(l);let{regex:f,params:H}=v(l),O=t.layouts!==!1?A(c,o):[];this.routes.push({pattern:l,regex:f,params:H,filePath:c,isDynamic:H.length>0,layout:O.length>0?O[O.length-1]:void 0})}}this.routes.sort((o,i)=>{if(!o.isDynamic&&i.isDynamic)return-1;if(o.isDynamic&&!i.isDynamic)return 1;let c=o.pattern.split("/").length,l=i.pattern.split("/").length;if(c!==l)return l-c;return o.pattern.localeCompare(i.pattern)});let s=d.resolve(e,t.stateDir||process.env.STX_DIR?.trim()||".stx");x(this.routes,s),S(this.routes,s,this.pagesDir)}match(e){let t=e===""?"/":e;for(let a of this.routes){let r=t.match(a.regex);if(r){let n={};return a.params.forEach((s,o)=>{n[s]=r[o+1]}),{route:a,params:n}}}return null}resolve(e,t){let a=this.routes.find((n)=>n.pattern===e||n.filePath.includes(e));if(!a)return"#not-found";let r=a.pattern;if(t)for(let[n,s]of Object.entries(t))r=r.replace(`:${n}`,encodeURIComponent(s));return r}addRoute(e){this.routes.push(e),this.routes.sort((t,a)=>{if(!t.isDynamic&&a.isDynamic)return-1;if(t.isDynamic&&!a.isDynamic)return 1;return t.pattern.localeCompare(a.pattern)})}getLayout(e){return e.layout??null}}function z(e,t){return new C(e,t)}function $(e,t){let a=[`${t}.stx`,"error.stx"];for(let r of a){let n=d.join(e,r);if(P.existsSync(n))return n}return null}function Y(e,t){return e.map((a)=>{let r=d.relative(t,a.filePath),n=a.isDynamic?" (dynamic)":"";return`${a.pattern} \u2192 ${r}${n}`})}var J=u(()=>{F();I();N();b()});function Z(e){E=e.replace(/\/$/,"")}function Q(e,t,a={}){p[e]={path:t,name:e,params:a}}function ee(e){for(let[t,a]of Object.entries(e))if(typeof a==="string")p[t]={path:a,name:t};else p[t]={...a,name:t}}function te(e,t={},a=!1){let r=p[e];if(!r)return console.warn(`Route [${e}] not defined.`),"#undefined-route";let n={...r.params,...t},s=r.path;s=s.replace(/:(\w+)/g,(i,c)=>{let l=n[c];if(l===void 0)return console.warn(`Missing parameter [${c}] for route [${e}].`),`:${c}`;return delete n[c],encodeURIComponent(String(l))});let o=Object.entries(n);if(o.length>0){let i=o.map(([c,l])=>`${encodeURIComponent(c)}=${encodeURIComponent(String(l))}`).join("&");s+=(s.includes("?")?"&":"?")+i}return a&&E?`${E}${s}`:s}function re(){for(let e of Object.keys(p))delete p[e];E=""}var p,E="";var ae=u(()=>{p={}});import ne from"fs";import oe from"path";function se(e,t={}){return{type:"redirect",path:e,options:{replace:t.replace??!1,external:t.external??!1,redirectCode:t.redirectCode??302}}}function ie(e){return{type:"abort",error:typeof e==="string"?{statusCode:500,message:e}:e}}function ce(e,t={}){return{handler:e,mode:t.mode??"universal"}}function B(e){let t={};if(!e)return t;let a=e.split(";");for(let r of a){let[n,...s]=r.split("=");if(n){let o=n.trim(),i=s.join("=").trim();if(o)t[o]=decodeURIComponent(i)}}return t}function T(e,t,a={}){let r=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(a.expires){let n=typeof a.expires==="number"?new Date(Date.now()+a.expires*1000):a.expires;r+=`; Expires=${n.toUTCString()}`}if(a.path)r+=`; Path=${a.path}`;if(a.domain)r+=`; Domain=${a.domain}`;if(a.secure)r+="; Secure";if(a.httpOnly)r+="; HttpOnly";if(a.sameSite)r+=`; SameSite=${a.sameSite}`;return r}function U(e,t){let a=e.headers.get("cookie")||"",r=B(a);return{get(n){return r[n]},set(n,s,o={}){r[n]=s,t.append("Set-Cookie",T(n,s,o))},delete(n){delete r[n],t.append("Set-Cookie",T(n,"",{expires:new Date(0),path:"/"}))},getAll(){return{...r}}}}function G(){return{get(e){if(typeof document>"u")return;return B(document.cookie)[e]},set(e,t,a={}){if(typeof document>"u")return;document.cookie=T(e,t,a)},delete(e){if(typeof document>"u")return;document.cookie=T(e,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return B(document.cookie)}}}function X(){let e=typeof window<"u"&&typeof window.localStorage<"u";return{get(t){if(!e)return null;try{return window.localStorage.getItem(t)}catch{return null}},set(t,a){if(!e)return;try{window.localStorage.setItem(t,a)}catch{}},remove(t){if(!e)return;try{window.localStorage.removeItem(t)}catch{}},isAvailable(){return e}}}function R(e,t){w.set(e,t)}function j(e){return w.get(e)}function le(e){return w.has(e)}function ue(){w.clear()}function he(){return Array.from(w.keys())}async function de(e,t="middleware"){let a=oe.resolve(e,t);if(!ne.existsSync(a))return;let r=ne.readdirSync(a);for(let n of r){if(!n.endsWith(".ts")&&!n.endsWith(".js"))continue;if(n.includes(".test.")||n.includes(".spec."))continue;let s=n.replace(/\.(ts|js)$/,""),o=oe.join(a,n);try{let c=(await import(o)).default;if(c&&typeof c.handler==="function")R(s,c);else if(typeof c==="function")R(s,{handler:c,mode:"universal"})}catch(i){console.warn(`Failed to load middleware '${s}' from ${o}:`,i)}}}function Se(e){let t={};if(!e)return t;let a=new URLSearchParams(e);for(let[r,n]of a)t[r]=n;return t}function pe(e,t,a,r=""){return{path:e,params:t,query:Se(r),fullPath:r?`${e}?${r}`:e,meta:a}}function fe(e,t,a,r){let n=r?.isServer??typeof window>"u",s=!n,o=new Headers;return{to:e,from:t,isClient:s,isServer:n,cookies:n&&a?U(a,o):G(),storage:X(),state:{},request:a,responseHeaders:o}}async function ge(e,t){let a=Array.isArray(e)?e:[e],r=t.isServer;for(let n of a){let s=j(n);if(!s)return console.error(`Route middleware '${n}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${n}' is not registered`}},state:t.state,responseHeaders:t.responseHeaders};if(s.mode==="server"&&!r)continue;try{let o=await s.handler(t);if(o){if(o.type==="redirect")return{passed:!1,redirect:o,state:t.state,responseHeaders:t.responseHeaders};if(o.type==="abort")return{passed:!1,abort:o,state:t.state,responseHeaders:t.responseHeaders}}}catch(o){return console.error(`Error in middleware '${n}':`,o),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:o instanceof Error?o.message:"Middleware error"}},state:t.state,responseHeaders:t.responseHeaders}}}return{passed:!0,state:t.state,responseHeaders:t.responseHeaders}}var w;var me=u(()=>{w=new Map});function q(e){let a=e.replace(/\\/g,"/").split("/").filter(Boolean),r=a.lastIndexOf("layouts"),n=r>=0?a[r+1]:a.at(-1);if(!n)return"app";return n.replace(/\.stx$/i,"")||"app"}function ye(e){let t=e.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),a=e.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),r=e.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),n=t?.[1]||r?.[1]||"";return{layout:n,group:a?.[1]||q(n)}}var ve=()=>{};function ke(e){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(e).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return e}}function we(){if(L)return L;return L=ke(`
|
|
5
5
|
;(function(){
|
|
6
6
|
'use strict';
|
|
7
7
|
var ROUTER_REV=7;
|
|
@@ -314,6 +314,23 @@ import{bv as Ae,cv as u}from"./chunk-sskbegsz.js";function _(e){return e.split(/
|
|
|
314
314
|
var head=code.trimStart();
|
|
315
315
|
return head.charAt(0)==='('||head.charAt(0)===';';
|
|
316
316
|
}
|
|
317
|
+
// A component scope script names the root it binds in data-stx-owner (#1958).
|
|
318
|
+
// On navigation it runs only for a root that just ARRIVED: one swapped in
|
|
319
|
+
// with the new content, which is not bound yet. A layout component that
|
|
320
|
+
// stayed on screen is skipped, in both shapes that reach here:
|
|
321
|
+
// - its root is gone: it keeps its first render's id while the fragment
|
|
322
|
+
// carries the next page's id for it (ids are page-keyed on purpose), so
|
|
323
|
+
// the script has no markup of its own;
|
|
324
|
+
// - its root is present and already bound: the same page file on both
|
|
325
|
+
// sides of the navigation gives the same id.
|
|
326
|
+
// Either way running it built a second instance of a component whose markup
|
|
327
|
+
// stays bound to the first -- setup and its side effects repeated on every
|
|
328
|
+
// navigation. Scripts without an owner are unaffected.
|
|
329
|
+
function ownerStays(owner){
|
|
330
|
+
if(!owner)return false;
|
|
331
|
+
var root=document.querySelector('[data-stx-scope="'+owner+'"]');
|
|
332
|
+
return !root||typeof root.__stx_disposers==='function';
|
|
333
|
+
}
|
|
317
334
|
function hashScript(code){
|
|
318
335
|
var h=0;for(var i=0;i<code.length;i++){h=((h<<5)-h)+code.charCodeAt(i);h|=0}
|
|
319
336
|
return h;
|
|
@@ -811,7 +828,8 @@ else {
|
|
|
811
828
|
var slot='fragment-'+(++fragScriptId);
|
|
812
829
|
var scoped=/(?:^|\\s)data-stx-scoped(?:\\s|=|$)/i.test(attrs);
|
|
813
830
|
var runDecl=(attrs.match(/data-stx-run\\s*=\\s*["']?(always|once)["']?/i)||[])[1];
|
|
814
|
-
|
|
831
|
+
var ownerDecl=(attrs.match(/data-stx-owner\\s*=\\s*["']([^"']+)["']/i)||[])[1]||'';
|
|
832
|
+
fragScripts.push({text:code,slot:slot,setupName:generatedSetupName(code),scoped:scoped,run:runDecl?runDecl.toLowerCase():'',owner:ownerDecl});
|
|
815
833
|
// Retain scoped setup code in its inert placeholder. A placeholder
|
|
816
834
|
// inside template.content is unreachable through document, so the
|
|
817
835
|
// repeated component runtime must execute it for each clone.
|
|
@@ -926,6 +944,10 @@ else {
|
|
|
926
944
|
// declarations would throw "Identifier has already been declared"
|
|
927
945
|
// on re-execution. Setup functions (__stx_setup_) must always
|
|
928
946
|
// re-execute because each page has its own setup.
|
|
947
|
+
if(ownerStays(entry.owner)){
|
|
948
|
+
log('[router] skipping component that stayed on the page:', entry.owner);
|
|
949
|
+
return;
|
|
950
|
+
}
|
|
929
951
|
var h=hashScript(code);
|
|
930
952
|
var isSetup=code.indexOf('__stx_setup_')!==-1;
|
|
931
953
|
// Self-contained scope scripts must re-execute on every navigation:
|
|
@@ -1149,7 +1171,7 @@ else {
|
|
|
1149
1171
|
var slot='document-'+(++routedBodyScriptId);
|
|
1150
1172
|
var setupName=generatedSetupName(text);
|
|
1151
1173
|
if(setupName)incomingSetupName=setupName;
|
|
1152
|
-
routedBodyScripts.push({text:text,runAlways:true,slot:slot,setupName:setupName,run:s.getAttribute('data-stx-run')||''});
|
|
1174
|
+
routedBodyScripts.push({text:text,runAlways:true,slot:slot,setupName:setupName,run:s.getAttribute('data-stx-run')||'',owner:s.getAttribute('data-stx-owner')||''});
|
|
1153
1175
|
s.textContent='';
|
|
1154
1176
|
s.setAttribute('type','application/stx-pending');
|
|
1155
1177
|
s.setAttribute('data-stx-route-script',slot);
|
|
@@ -1218,8 +1240,8 @@ else {
|
|
|
1218
1240
|
document.querySelectorAll('script[data-stx-page]').forEach(function(s){s.remove()});
|
|
1219
1241
|
|
|
1220
1242
|
var scripts=routedBodyScripts.slice();
|
|
1221
|
-
function addScript(text, runAlways, slot){
|
|
1222
|
-
scripts.push({text:text,runAlways:!!runAlways,slot:slot||''});
|
|
1243
|
+
function addScript(text, runAlways, slot, owner){
|
|
1244
|
+
scripts.push({text:text,runAlways:!!runAlways,slot:slot||'',owner:owner||''});
|
|
1223
1245
|
}
|
|
1224
1246
|
if(isLayoutChange){
|
|
1225
1247
|
// Also collect setup functions from <head>
|
|
@@ -1249,7 +1271,9 @@ else {
|
|
|
1249
1271
|
var key=text.substring(0,80);
|
|
1250
1272
|
if(seenSetups[key])return;
|
|
1251
1273
|
seenSetups[key]=1;
|
|
1252
|
-
|
|
1274
|
+
// A layout component outside the container carries its owner, so
|
|
1275
|
+
// execScripts skips it when it stayed on the page (#1958).
|
|
1276
|
+
addScript(text,true,'',s.getAttribute('data-stx-owner')||'');
|
|
1253
1277
|
});
|
|
1254
1278
|
}
|
|
1255
1279
|
// Component setup scripts also assign window.stx._latestSetup. Run the
|
|
@@ -1320,6 +1344,7 @@ else {
|
|
|
1320
1344
|
scripts.forEach(function(entry){
|
|
1321
1345
|
var text=typeof entry==='string'?entry:entry.text;
|
|
1322
1346
|
var runAlways=typeof entry==='string'?false:entry.runAlways;
|
|
1347
|
+
if(typeof entry!=='string'&&ownerStays(entry.owner))return;
|
|
1323
1348
|
// Skip scripts that were already executed (layout-level partials
|
|
1324
1349
|
// like theme.stx). Their top-level const/function declarations
|
|
1325
1350
|
// would throw "Identifier has already been declared" on re-execution.
|
|
@@ -1810,5 +1835,5 @@ else {
|
|
|
1810
1835
|
|
|
1811
1836
|
if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);else init();
|
|
1812
1837
|
})();
|
|
1813
|
-
`),L}var L;var be=()=>{};var Ce={};Ae(Ce,{setAppUrl:()=>Z,runMiddleware:()=>ge,route:()=>te,resolveLayoutChain:()=>A,resetRoutes:()=>re,registerMiddleware:()=>R,patternToRegex:()=>v,navigateTo:()=>se,matchRoute:()=>D,loadMiddlewareFromDirectory:()=>de,isNonPageRoutePattern:()=>m,isNonPageRoutePath:()=>_,hasMiddleware:()=>
|
|
1814
|
-
export{g as
|
|
1838
|
+
`),L}var L;var be=()=>{};var Ce={};Ae(Ce,{setAppUrl:()=>Z,runMiddleware:()=>ge,route:()=>te,resolveLayoutChain:()=>A,resetRoutes:()=>re,registerMiddleware:()=>R,patternToRegex:()=>v,navigateTo:()=>se,matchRoute:()=>D,loadMiddlewareFromDirectory:()=>de,isNonPageRoutePattern:()=>m,isNonPageRoutePath:()=>_,hasMiddleware:()=>le,getRouterScript:()=>we,getMiddlewareNames:()=>he,getMiddleware:()=>j,generateRouteTypes:()=>x,generateRouteManifest:()=>S,formatRoutes:()=>Y,findErrorPage:()=>$,filePathToPattern:()=>k,extractLayoutMetadata:()=>ye,deriveLayoutGroup:()=>q,defineRoutes:()=>ee,defineRoute:()=>Q,defineMiddleware:()=>ce,createStorageManager:()=>X,createServerCookieManager:()=>U,createRouter:()=>z,createRouteLocation:()=>pe,createMiddlewareContext:()=>fe,createClientCookieManager:()=>G,clearMiddleware:()=>ue,bracketPathToRegex:()=>W,abortNavigation:()=>ie,Router:()=>C,NON_PAGE_DIRS:()=>g});var Ee=u(()=>{J();I();ae();me();N();ve();F();b();be()});
|
|
1839
|
+
export{g as pu,_ as qu,m as ru,x as su,S as tu,k as uu,v as vu,D as wu,W as xu,A as yu,C as zu,z as Au,$ as Bu,Y as Cu,Z as Du,Q as Eu,ee as Fu,te as Gu,re as Hu,se as Iu,ie as Ju,ce as Ku,U as Lu,G as Mu,X as Nu,R as Ou,j as Pu,le as Qu,ue as Ru,he as Su,de as Tu,pe as Uu,fe as Vu,ge as Wu,q as Xu,ye as Yu,ve as Zu,we as _u,Ce as $u,Ee as av};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{bj as v,cj as F,dj as P}from"./chunk-efr3ejqt.js";import{Pp as B,Sl as K,er as S}from"./chunk-qj2s3r1w.js";import{Vt as _,Wt as x}from"./chunk-nygtwffe.js";import{_t as N}from"./chunk-h7v70dbp.js";import U from"path";var j=new Map,E=new Map,h=["composables","functions"];function T(Q){let z=U.basename(Q,".ts");return z==="index"||z==="types"||Q.endsWith(".d.ts")}async function D(Q){if(Q)return U.resolve(Q);let z=`<default>:${process.cwd()}`,Y=E.get(z);if(Y!==void 0)return Y;let J=await u();if(J!==null)E.set(z,J);return J}async function u(){let Q=await S(),z=Q.root||process.cwd(),Y=Q.composablesDir;if(Y)return U.resolve(z,Y);for(let J of h){let V=U.resolve(z,J);try{let W=new Bun.Glob("**/*.ts");for await(let Z of W.scan({cwd:V,absolute:!0}))if(!T(Z))return V}catch{}}return null}async function i(Q){let z=await D(Q);if(!z)return[];let Y=[];try{let W=new Bun.Glob("**/*.ts");for await(let Z of W.scan({cwd:z,absolute:!0}))if(!T(Z))Y.push(Z)}catch{return[]}Y.sort();let J=B({loader:"ts",target:"browser",define:K()}),V=[];for(let W of Y)try{let Z=await Bun.file(W).text(),$=J.scan(Z).exports.filter((G)=>G!=="default");if($.length>0)V.push({file:W,names:$})}catch{}return V}function f(Q,z){return new RegExp(`\\b${z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(Q)}function p(Q,z,Y){let J=new Map;for(let{file:$,names:G}of Q)for(let O of G)if(!J.has(O))J.set(O,$);let V=($)=>{let G=[];for(let[O,L]of J)if(f($,O))G.push(L);return G},W=new Set,Z=Y.flatMap(V);while(Z.length>0){let $=[];for(let G of Z){if(W.has(G))continue;W.add(G);for(let O of V(z.get(G)??""))if(!W.has(O))$.push(O)}Z=$}return W}async function o(Q,z,Y){let J=await D(Q);if(!J)return null;let V=[];try{let q=new Bun.Glob("**/*.ts");for await(let H of q.scan({cwd:J,absolute:!0})){if(T(H))continue;V.push(H)}}catch{return P(j,J,"",""),null}let W=v(V);if(V.length===0)return P(j,J,W,""),null;V.sort();let Z=B({loader:"ts",target:"browser",define:K()}),$=new Map,G=[];for(let q of V)try{let H=await Bun.file(q).text();$.set(q,H);let w=Z.scan(H).exports.filter((X)=>X!=="default");if(w.length>0)G.push({file:q,names:w})}catch{$.set(q,"")}let O=z===void 0?new Set(V):p(G,$,Y?[z,...Y]:[z]);if(O.size===0)return null;let L=V.filter((q)=>O.has(q)),A=`${J}\x00${L.join("\x00")}`,I=F(j,A,W);if(I!==void 0)return I||null;let M=[],R=new Set,k=new Set;for(let q of L)try{let H=$.get(q)??await Bun.file(q).text(),w=U.basename(q,".ts");for(let X of H.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(X[1])k.add(X[1]);try{for(let X of Z.scan(H).exports)if(X!=="default")R.add(X)}catch{}H=_(H),H=x(H),H=H.replace(/^export\s+(default\s+)?/gm,""),H=Z.transformSync(H),M.push(`// Composable: ${w}
|
|
3
|
+
${H.trim()}`)}catch(H){console.warn(`[stx] Failed to load composable ${q}:`,H)}if(M.length===0||R.size===0)return P(j,A,W,""),null;let b=[...R].map((q)=>` try { __c[${JSON.stringify(q)}] = ${q}; } catch (e) {}`).join(`
|
|
4
|
+
`),g=JSON.stringify([...R]),y=M.join(`
|
|
5
|
+
|
|
6
|
+
`),C=`;(function(){
|
|
7
|
+
window.__composables = window.__composables || {};
|
|
8
|
+
var __c = window.__composables;
|
|
9
|
+
var __stx = window.stx || {};
|
|
10
|
+
${N.filter((q)=>!k.has(q)&&new RegExp(`\\b${q}\\b`).test(y)).map((q)=>`var ${q} = __stx[${JSON.stringify(q)}];`).join(`
|
|
11
|
+
`)}
|
|
12
|
+
${y}
|
|
13
|
+
${b}
|
|
14
|
+
var __names = ${g};
|
|
15
|
+
for (var __i = 0; __i < __names.length; __i++) {
|
|
16
|
+
var __n = __names[__i];
|
|
17
|
+
if (!(__n in __c)) continue;
|
|
18
|
+
var __takenByBuiltin = !!(window.stx && __n in window.stx);
|
|
19
|
+
if (__takenByBuiltin || __n in window) {
|
|
20
|
+
console.warn('[stx] composable "' + __n + '" is not available as a bare identifier: '
|
|
21
|
+
+ (__takenByBuiltin ? 'a built-in of that name already exists' : 'window already defines that property')
|
|
22
|
+
+ '. Rename it, or use: import { ' + __n + ' } from "@composables"');
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
window[__n] = __c[__n];
|
|
26
|
+
}
|
|
27
|
+
})();`;return P(j,A,W,C),C}function e(){j.clear(),E.clear()}
|
|
28
|
+
export{i as _i,o as $i,e as aj};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{$l as B,Hp as k,Kl as A,Ll as D,Pm as T,Qm as y,Rn as x,bm as F,co as M,cr as w,uo as R}from"./chunk-qj2s3r1w.js";import{kv as P}from"./chunk-2vza9m2x.js";function b(K){return K.endsWith(".md")||K.endsWith(".markdown")}function C(K){let z=[];_(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let G=[...z];_(/<code\b[^>]*>[\s\S]*?<\/code>/gi,G);function _(J,X){let $;while(($=J.exec(K))!==null){let q=$.index,N=q+$[0].length;if(X?.some((Y)=>q>=Y.start&&N<=Y.end))continue;z.push({start:q,end:N})}}if(z.length===0)return K;z.sort((J,X)=>J.start-X.start);let U="",Q=0;for(let J of z){if(J.start<Q)continue;U+=K.slice(Q,J.start),U+=`@raw${K.slice(J.start,J.end)}@endraw`,Q=J.end}return U+=K.slice(Q),U}async function j(K,z={}){let{data:G,content:_}=A(K),Q=await(z.renderer??((J)=>D(J)))(_);return{html:C(Q),frontmatter:G??{}}}import{dirname as v,resolve as H}from"path";function f(K){let z=K,G=x(K);if(G)z=G.content.trim();let _=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,U=[],Q=[],J=[],X=(N)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(N),$;while(($=_.exec(K))!==null){let N=$[1],Y=$[2],E=$[0],Z=N.includes("server");if(X(Y))J.push(E);else if(Z)Q.push(Y);else U.push(E)}let q=z;{let N=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,Y,E=[];while((Y=N.exec(q))!==null){let Z=Y.index+Y[0].length,L=q.indexOf("</script>",Z);if(L===-1)continue;E.push({start:Y.index,end:L+9}),N.lastIndex=L+9}for(let Z=E.length-1;Z>=0;Z--)q=q.substring(0,E[Z].start)+q.substring(E[Z].end)}for(let N of U)q=q.replace(N,"");return{templateContent:q,serverScripts:Q,clientScripts:U,signalsScripts:J}}function S(K,z){return`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
@@ -14,5 +14,5 @@ ${Q.join(`
|
|
|
14
14
|
`)}`}else{if(G.processClientScripts!==!1&&Q.length>0){let N=X.__stx_event_bindings||[],Y=B(X),Z=(await Promise.all(Q.map(async(V)=>{let W=V.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!W)return V;return await F(W[1],{eventBindings:N,templateContent:q,serverData:Y,filePath:z})}))).join(`
|
|
15
15
|
`);if(q.match(/(<\/body>)/i))q=q.replace(/(<\/body>)/i,`${Z}
|
|
16
16
|
$1`);else q+=`
|
|
17
|
-
${Z}`}q=await M(q)}if(G.wrapInDocument){if(!q.trim().toLowerCase().startsWith("<!doctype")&&!q.trim().toLowerCase().startsWith("<html"))q=S(q,G.title)}if(G.injectCSS)try{let{injectCss:N}=await import("./chunk-
|
|
17
|
+
${Z}`}q=await M(q)}if(G.wrapInDocument){if(!q.trim().toLowerCase().startsWith("<!doctype")&&!q.trim().toLowerCase().startsWith("<html"))q=S(q,G.title)}if(G.injectCSS)try{let{injectCss:N}=await import("./chunk-sag55qv7.js");q=await N(q)}catch{}return q}
|
|
18
18
|
export{b as qk,C as rk,j as sk,s as tk,i as uk,I as vk};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import z from"fs";function B(x){return[...x].sort().map((b)=>{try{let j=z.statSync(b);return`${b}:${j.size}:${j.mtimeMs}`}catch{return`${b}:missing`}}).join(`
|
|
3
3
|
`)}function C(x,b,j){let q=x.get(b);return q!==void 0&&q.signature===j?q.value:void 0}function D(x,b,j,q){return x.set(b,{signature:j,value:q}),q}
|
|
4
|
-
export{B as
|
|
4
|
+
export{B as bj,C as cj,D as dj};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ng as a,Og as b,Pg as c,Qg as d,Rg as e,Sg as f}from"./chunk-bphx7ngb.js";import"./chunk-qj2s3r1w.js";import"./chunk-ymc99r5x.js";import"./chunk-dcxtrqfy.js";import"./chunk-jj6yp7gm.js";import"./chunk-qjkzpd68.js";import"./chunk-t5c7rk0h.js";import"./chunk-72c7gyqc.js";import"./chunk-fv923f7g.js";import"./chunk-2e6xafcm.js";import"./chunk-nygtwffe.js";import"./chunk-461br5nn.js";import"./chunk-h7v70dbp.js";import"./chunk-drbbt69f.js";import"./chunk-kb5j08tq.js";import"./chunk-2vza9m2x.js";export{c as renderSlot,d as processSlots,a as parseSlots,b as parseSlotElement,e as extractSlotContent,f as applySlots};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-2vza9m2x.js";import v from"fs";import H from"path";import{gzipSync as z}from"zlib";import{createHash as g}from"crypto";var D={".js":"js",".mjs":"js",".cjs":"js",".ts":"js",".jsx":"js",".tsx":"js",".css":"css",".scss":"css",".sass":"css",".less":"css",".html":"html",".htm":"html",".png":"image",".jpg":"image",".jpeg":"image",".gif":"image",".svg":"image",".webp":"image",".avif":"image",".ico":"image",".woff":"font",".woff2":"font",".ttf":"font",".eot":"font",".otf":"font"},b=[/node_modules/,/vendor/,/bower_components/,/\.min\./],B=[/index\.(js|ts|html)$/,/main\.(js|ts)$/,/app\.(js|ts)$/,/entry\.(js|ts)$/];async function L(X,Z={}){let{includeSourceMaps:Q=!1,parseImports:$=!0,detectDuplicates:U=!0,topModulesCount:K=20}=Z;if(!v.existsSync(X))throw Error(`Build directory not found: ${X}`);if(!v.statSync(X).isDirectory())throw Error(`Not a directory: ${X}`);let q=await k(X,Q),J=[],F=[];for(let A of q)try{let O=await f(A,X,$);J.push(O)}catch(O){F.push(`Failed to process ${A}: ${O}`)}let Y=c(J,X),V=J.reduce((A,O)=>A+O.size,0),_=J.reduce((A,O)=>A+O.gzipSize,0),w=m(J),G=U?p(J):[],C=[...J].sort((A,O)=>O.size-A.size).slice(0,K);return{timestamp:Date.now(),buildDir:H.resolve(X),chunks:Y,totalSize:V,totalGzipSize:_,moduleCount:J.length,duplicates:G,byType:w,largestModules:C,warnings:F}}async function k(X,Z){let Q=[];async function $(U){let K=await v.promises.readdir(U,{withFileTypes:!0});for(let j of K){let q=H.join(U,j.name);if(j.isDirectory()){if(!j.name.startsWith(".")&&j.name!=="node_modules")await $(q)}else if(j.isFile()){if(!Z&&j.name.endsWith(".map"))continue;Q.push(q)}}}return await $(X),Q}async function f(X,Z,Q){let $=await v.promises.readFile(X),U=H.relative(Z,X),K=H.extname(X).toLowerCase(),j=$.length,q=y($),J=h($,K),F=g("md5").update($).digest("hex").slice(0,8),Y=D[K]||"other",V=[];if(Q&&Y==="js")V.push(...d($.toString("utf-8")));return{id:U,path:U,size:j,gzipSize:q,parsedSize:J,extension:K,type:Y,imports:V,importedBy:[],hash:F}}function y(X){try{let Z=z(X,{level:9}).length;return Math.min(Z,X.length)}catch{return X.length}}function h(X,Z){if(Z.includes(".min.")||X.length<1000)return X.length;let $=D[Z];if($==="js")return Math.round(X.length*0.6);if($==="css")return Math.round(X.length*0.7);return X.length}function d(X){let Z=[],Q=/import\s+(?:[\w*{}\s,]+\s+from\s+)?['"]([^'"]+)['"]/g,$;while(($=Q.exec(X))!==null)Z.push($[1]);let U=/import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;while(($=U.exec(X))!==null)Z.push($[1]);let K=/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g;while(($=K.exec(X))!==null)Z.push($[1]);return[...new Set(Z)]}function c(X,Z){let Q=new Map;for(let U of X){let K=U.path.split(H.sep),j;if(K.length===1)j=H.basename(U.path,U.extension);else j=K[0];let q=Q.get(j)||[];q.push(U),Q.set(j,q)}let $=[];for(let[U,K]of Q){let j=K.reduce((Y,V)=>Y+V.size,0),q=K.reduce((Y,V)=>Y+V.gzipSize,0),J=K.some((Y)=>B.some((V)=>V.test(Y.path))),F=K.some((Y)=>b.some((V)=>V.test(Y.path)));$.push({name:U,files:K.map((Y)=>Y.path),modules:K,size:j,gzipSize:q,isEntry:J,isVendor:F})}return $.sort((U,K)=>K.size-U.size)}function m(X){let Z={js:{count:0,size:0,gzipSize:0},css:{count:0,size:0,gzipSize:0},html:{count:0,size:0,gzipSize:0},image:{count:0,size:0,gzipSize:0},font:{count:0,size:0,gzipSize:0},other:{count:0,size:0,gzipSize:0}};for(let Q of X)Z[Q.type].count++,Z[Q.type].size+=Q.size,Z[Q.type].gzipSize+=Q.gzipSize;return Z}function p(X){let Z=new Map;for(let $ of X){let U=Z.get($.hash)||[];U.push($),Z.set($.hash,U)}let Q=[];for(let[,$]of Z)if($.length>1){let U=$[0];Q.push({path:U.path,count:$.length,wastedBytes:U.size*($.length-1),locations:$.map((K)=>K.path)})}return Q.sort(($,U)=>U.wastedBytes-$.wastedBytes)}function W(X){if(X<1024)return`${X} B`;if(X<1048576)return`${(X/1024).toFixed(2)} KB`;return`${(X/1048576).toFixed(2)} MB`}function I(X){let Z=X.match(/^([\d.]+)\s*(B|KB|MB|GB)?$/i);if(!Z)return 0;let Q=Number.parseFloat(Z[1]);switch((Z[2]||"B").toUpperCase()){case"KB":return Q*1024;case"MB":return Q*1024*1024;case"GB":return Q*1024*1024*1024;default:return Q}}function E(X,Z){if(Z===0)return"0%";return`${(X/Z*100).toFixed(1)}%`}function R(X,Z){switch(Z.format){case"json":return u(X,Z);case"markdown":return l(X,Z);case"text":default:return r(X,Z)}}function u(X,Z){let Q=N(X,Z);return JSON.stringify({timestamp:X.timestamp,buildDir:X.buildDir,summary:{totalSize:X.totalSize,totalSizeFormatted:W(X.totalSize),totalGzipSize:X.totalGzipSize,totalGzipSizeFormatted:W(X.totalGzipSize),moduleCount:X.moduleCount,chunkCount:X.chunks.length,duplicateCount:X.duplicates.length},byType:Object.fromEntries(Object.entries(X.byType).map(([$,U])=>[$,{...U,sizeFormatted:W(U.size),gzipSizeFormatted:W(U.gzipSize)}])),chunks:X.chunks.map(($)=>({name:$.name,size:$.size,sizeFormatted:W($.size),gzipSize:$.gzipSize,gzipSizeFormatted:W($.gzipSize),moduleCount:$.modules.length,isEntry:$.isEntry,isVendor:$.isVendor})),largestModules:X.largestModules.slice(0,Z.topModules||10).map(($)=>({path:$.path,size:$.size,sizeFormatted:W($.size),gzipSize:$.gzipSize,gzipSizeFormatted:W($.gzipSize),type:$.type})),duplicates:X.duplicates,analysis:Q,warnings:X.warnings},null,2)}function r(X,Z){let Q=[],$=Z.showGzip!==!1;if(Q.push(""),Q.push("Bundle Analysis Report"),Q.push("\u2550".repeat(50)),Q.push(""),Q.push("Summary"),Q.push("\u2500".repeat(50)),$)Q.push(`Total Size: ${W(X.totalSize)} (${W(X.totalGzipSize)} gzip)`);else Q.push(`Total Size: ${W(X.totalSize)}`);if(Q.push(`Modules: ${X.moduleCount}`),Q.push(`Chunks: ${X.chunks.length}`),X.duplicates.length>0)Q.push(`Duplicates: ${X.duplicates.length}`);if(Q.push(""),Z.threshold&&X.totalSize>Z.threshold)Q.push(`\u26A0\uFE0F Bundle exceeds threshold of ${W(Z.threshold)}!`),Q.push("");Q.push("Size by Type"),Q.push("\u2500".repeat(50));let U=["js","css","html","image","font","other"];for(let j of U){let q=X.byType[j];if(q.count>0){let J=E(q.size,X.totalSize),F=$?` (${W(q.gzipSize)} gzip)`:"";Q.push(` ${j.padEnd(8)} ${W(q.size).padStart(12)}${F} ${J.padStart(6)} (${q.count} files)`)}}Q.push(""),Q.push("Chunks"),Q.push("\u2500".repeat(50));for(let j of X.chunks.slice(0,10)){let q=[];if(j.isEntry)q.push("entry");if(j.isVendor)q.push("vendor");let J=q.length>0?` [${q.join(", ")}]`:"",F=$?` (${W(j.gzipSize)} gzip)`:"";Q.push(` ${j.name.padEnd(20)} ${W(j.size).padStart(12)}${F}${J}`)}if(X.chunks.length>10)Q.push(` ... and ${X.chunks.length-10} more chunks`);Q.push("");let K=Z.topModules||10;Q.push(`Largest Modules (Top ${K})`),Q.push("\u2500".repeat(50));for(let j=0;j<Math.min(K,X.largestModules.length);j++){let q=X.largestModules[j],J=$?` (${W(q.gzipSize)} gzip)`:"";Q.push(` ${(j+1).toString().padStart(2)}. ${q.path}`),Q.push(` ${W(q.size)}${J}`)}if(Q.push(""),X.duplicates.length>0){Q.push("Duplicate Modules"),Q.push("\u2500".repeat(50));for(let j of X.duplicates.slice(0,5))Q.push(` ${j.path}`),Q.push(` ${j.count} copies, wasting ${W(j.wastedBytes)}`);if(X.duplicates.length>5)Q.push(` ... and ${X.duplicates.length-5} more duplicates`);Q.push("")}if(Z.recommendations!==!1){let j=N(X,Z);if(j.recommendations.length>0){Q.push("Recommendations"),Q.push("\u2500".repeat(50));for(let q of j.recommendations.slice(0,5)){let J=q.impact==="high"?"\u26A1":q.impact==="medium"?"\uD83D\uDCCA":"\uD83D\uDCA1";Q.push(` ${J} ${q.title}`),Q.push(` ${q.description}`)}Q.push("")}}if(X.warnings.length>0){Q.push("Warnings"),Q.push("\u2500".repeat(50));for(let j of X.warnings)Q.push(` \u26A0\uFE0F ${j}`);Q.push("")}return Q.join(`
|
|
3
3
|
`)}function l(X,Z){let Q=[],$=Z.showGzip!==!1;if(Q.push("# Bundle Analysis Report"),Q.push(""),Q.push(`Generated: ${new Date(X.timestamp).toISOString()}`),Q.push(""),Q.push("## Summary"),Q.push(""),Q.push("| Metric | Value |"),Q.push("|--------|-------|"),Q.push(`| Total Size | ${W(X.totalSize)} |`),$)Q.push(`| Gzip Size | ${W(X.totalGzipSize)} |`);Q.push(`| Modules | ${X.moduleCount} |`),Q.push(`| Chunks | ${X.chunks.length} |`),Q.push(`| Duplicates | ${X.duplicates.length} |`),Q.push(""),Q.push("## Size by Type"),Q.push(""),Q.push("| Type | Size | Gzip | % | Files |"),Q.push("|------|------|------|---|-------|");let U=["js","css","html","image","font","other"];for(let j of U){let q=X.byType[j];if(q.count>0)Q.push(`| ${j} | ${W(q.size)} | ${W(q.gzipSize)} | ${E(q.size,X.totalSize)} | ${q.count} |`)}Q.push(""),Q.push("## Chunks"),Q.push(""),Q.push("| Name | Size | Gzip | Modules | Type |"),Q.push("|------|------|------|---------|------|");for(let j of X.chunks.slice(0,15)){let q=j.isEntry?"Entry":j.isVendor?"Vendor":"-";Q.push(`| ${j.name} | ${W(j.size)} | ${W(j.gzipSize)} | ${j.modules.length} | ${q} |`)}Q.push("");let K=Z.topModules||10;Q.push(`## Largest Modules (Top ${K})`),Q.push(""),Q.push("| # | Path | Size | Gzip |"),Q.push("|---|------|------|------|");for(let j=0;j<Math.min(K,X.largestModules.length);j++){let q=X.largestModules[j];Q.push(`| ${j+1} | \`${q.path}\` | ${W(q.size)} | ${W(q.gzipSize)} |`)}if(Q.push(""),X.duplicates.length>0){Q.push("## Duplicates"),Q.push(""),Q.push("| Path | Copies | Wasted |"),Q.push("|------|--------|--------|");for(let j of X.duplicates.slice(0,10))Q.push(`| \`${j.path}\` | ${j.count} | ${W(j.wastedBytes)} |`);Q.push("")}if(Z.recommendations!==!1){let j=N(X,Z);if(j.recommendations.length>0){Q.push("## Recommendations"),Q.push("");for(let q of j.recommendations)Q.push(`### ${q.title}`),Q.push(""),Q.push(q.description),Q.push(""),Q.push(`- **Impact:** ${q.impact}`),Q.push(`- **Effort:** ${q.effort}`),Q.push("")}}return Q.join(`
|
|
4
4
|
`)}function N(X,Z){let Q=[],$=[];if(Z.threshold&&X.totalSize>Z.threshold)Q.push({severity:"error",message:`Bundle size (${W(X.totalSize)}) exceeds threshold (${W(Z.threshold)})`});if(X.totalSize>1048576)Q.push({severity:"warning",message:`Bundle is over 1MB (${W(X.totalSize)})`,details:"Large bundles can significantly impact load time"});if(X.duplicates.length>0){let q=X.duplicates.reduce((J,F)=>J+F.wastedBytes,0);Q.push({severity:"warning",message:`${X.duplicates.length} duplicate modules found, wasting ${W(q)}`}),$.push({title:"Remove Duplicate Modules",description:"Consider using import aliases or ensuring consistent package versions to eliminate duplicates.",impact:"medium",effort:"low"})}if(X.byType.js.size/X.totalSize>0.8&&X.totalSize>512000)$.push({title:"Code Splitting",description:"Over 80% of your bundle is JavaScript. Consider splitting code by route or feature.",impact:"high",effort:"medium"});let K=X.largestModules.filter((q)=>q.size>102400);if(K.length>0){Q.push({severity:"info",message:`${K.length} modules are over 100KB`});for(let q of K){if(q.path.includes("lodash")&&!q.path.includes("lodash-es"))$.push({title:"Use lodash-es instead of lodash",description:"lodash-es supports tree-shaking and can significantly reduce bundle size.",impact:"high",effort:"low"});if(q.path.includes("moment"))$.push({title:"Replace moment.js",description:"Consider using date-fns or dayjs for smaller date handling libraries.",impact:"high",effort:"medium"})}}if(X.byType.image.size>512000)$.push({title:"Optimize Images",description:`Images account for ${W(X.byType.image.size)}. Consider using WebP/AVIF formats and responsive images.`,impact:"high",effort:"low"});let j=100;if(X.totalSize>1048576)j-=20;else if(X.totalSize>512000)j-=10;if(j-=Math.min(20,X.duplicates.length*2),j-=Math.min(15,K.length*3),Z.threshold&&X.totalSize>Z.threshold)j-=25;return{score:Math.max(0,j),issues:Q,recommendations:$}}var i={lodash:{alternative:"lodash-es or individual imports",savings:"~70%"},moment:{alternative:"date-fns or dayjs",savings:"~90%"},"chart.js":{alternative:"chart.js with tree-shaking",savings:"~50%"},"highlight.js":{alternative:"Selective language imports",savings:"~80%"},fontawesome:{alternative:"Individual icon imports",savings:"~90%"},"material-ui":{alternative:"Named imports from @mui/*",savings:"~60%"}};function n(X){for(let[Z,Q]of Object.entries(i))if(X.includes(Z))return{title:`Optimize ${Z}`,description:`Consider using ${Q.alternative}. Potential savings: ${Q.savings}`,impact:"high",effort:"low"};return null}var o={default:{js:"#f7df1e",css:"#264de4",html:"#e34c26",image:"#4caf50",font:"#9c27b0",other:"#607d8b",vendor:"#ff5722"},pastel:{js:"#fff3b0",css:"#b0d4ff",html:"#ffb0b0",image:"#b0ffb0",font:"#e0b0ff",other:"#d0d0d0",vendor:"#ffcfb0"},monochrome:{js:"#333333",css:"#555555",html:"#777777",image:"#999999",font:"#bbbbbb",other:"#dddddd",vendor:"#444444"}};function x(X,Z={}){let{title:Q="Bundle Analysis",gzip:$=!0,colorScheme:U="default"}=Z,K=o[U],j=a(X),q=JSON.stringify(j);return`<!DOCTYPE html>
|
|
5
5
|
<html lang="en">
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Eh as L,Fh as w,Gh as x,Hh as p,Ih as F,Jh as T,Mh as I,Nh as f,Oh as l,Ph as n,Qh as i,Rh as P,Sh as o,Th as a}from"./chunk-d0f60jrg.js";import{Rs as ZG}from"./chunk-dcxtrqfy.js";function HG(X,Z={}){let{src:G,alt:J,width:q,height:$,sizes:K="100vw",loading:Q="lazy",priority:Y=!1,quality:M=x,placeholder:N="none",formats:j=w,widths:C=L,decoding:B="async",fetchpriority:V,objectFit:O,objectPosition:W}=X,H=X.class,z=X.style,{processedImage:R,variants:_,optimize:E=!0,isDev:S=!1}=Z;if(_&&_.length>0)return OG(X,_,R);if(S||!E)return MG(X);return VG(X)}function OG(X,Z,G){let{src:J,alt:q,width:$,height:K,sizes:Q="100vw",loading:Y="lazy",priority:M=!1,decoding:N="async",fetchpriority:j,objectFit:C,objectPosition:B,placeholder:V="none"}=X,O=X.class,W=X.style,H=n(Z),z=l(Z),R=typeof Q==="object"?f(Q):Q,_=G?G.aspectRatio:$&&K?Number($)/Number(K):void 0,E=[];if(_)E.push(`aspect-ratio: ${_}`);if(C)E.push(`object-fit: ${C}`);if(B)E.push(`object-position: ${B}`);if(W)E.push(W);let S=E.length>0?` style="${E.join("; ")}"`:"",b=O?` class="${O}"`:"",u=M?"":` loading="${Y}"`,d=` decoding="${N}"`,h=j?` fetchpriority="${j}"`:M?' fetchpriority="high"':"",r=["avif","webp","jpeg","png"],s=[];for(let U of r){let D=H.get(U);if(D&&D.length>0){let m=I(D),QG=P(U);s.push(` <source type="${QG}" srcset="${m}" sizes="${R}" />`)}}let e="",t="",g;if(V!=="none"&&G?.placeholder){let U=`img-${Math.random().toString(36).slice(2,8)}`;if(e=`<div class="stx-image-wrapper" id="${U}">`,t="</div>",V==="blur")g=`
|
|
3
3
|
#${U} {
|
|
4
4
|
position: relative;
|
|
5
5
|
background-image: url('${G.placeholder}');
|
|
@@ -40,4 +40,4 @@ ${O}
|
|
|
40
40
|
${O}
|
|
41
41
|
</div>`}}if(G.priority&&C){let W=P(C.format);O=`<link rel="preload" as="image" href="${k(C.url)}" type="${W}" />
|
|
42
42
|
`+O}return O}function k(X){return X.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var UG=$G();import v from"fs";import A from"path";function LG(X={}){let{inputDirs:Z=["public","src/assets","assets"],outputDir:G="dist/images",baseUrl:J="/images",formats:q=w,widths:$=L,quality:K=x,placeholder:Q="none",concurrency:Y=4,cache:M=!0,cacheDir:N=".stx/image-cache",referencedOnly:j=!1,verbose:C=!1}=X,B={imageReferences:new Set,processedImages:new Map,stats:{totalImages:0,optimizedImages:0,savedBytes:0,variants:0}};return{name:"stx-image-optimization",async setup(V){if(!await F()){console.warn("[stx-images] no image backend available, optimization disabled");return}if(M)await v.promises.mkdir(N,{recursive:!0});if(C){let W=await p();console.log("[stx-images] Plugin initialized"),console.log(` Backend: ${W?"sharp (native fast path) + ts-images":"ts-images (pure TS)"}`),console.log(` Input dirs: ${Z.join(", ")}`),console.log(` Output dir: ${G}`),console.log(` Formats: ${q.join(", ")}`),console.log(` Widths: ${$.join(", ")}`)}},async buildStart(){B.imageReferences.clear(),B.processedImages.clear(),B.stats={totalImages:0,optimizedImages:0,savedBytes:0,variants:0}},async transform(V,O){if(O.endsWith(".html")||O.endsWith(".stx")){let W=wG(V);for(let H of W)B.imageReferences.add(H)}if(V.includes("<Image")||V.includes("@image"))return await kG(V,{formats:q,widths:$,quality:K,placeholder:Q,outputDir:G,baseUrl:J,processedImages:B.processedImages});return V},async buildEnd(V){if(!await F())return;await v.promises.mkdir(G,{recursive:!0});let W=[];for(let R of Z){if(!v.existsSync(R))continue;let _=await KG(R);W.push(..._)}let H=j?W.filter((R)=>xG(R,B.imageReferences)):W;if(B.stats.totalImages=H.length,C)console.log(`[stx-images] Processing ${H.length} images...`);let z=qG(H,Y);for(let R of z)await Promise.all(R.map(async(_)=>{try{let E=await T(_,{formats:q,widths:$,quality:K,placeholder:Q,outputDir:G,baseUrl:J});B.processedImages.set(_,E),B.stats.optimizedImages++,B.stats.variants+=E.variants.length;let S=v.statSync(_).size,b=o(E.variants);if(B.stats.savedBytes+=Math.max(0,S-b/E.variants.length),C)console.log(` \u2713 ${A.basename(_)} \u2192 ${E.variants.length} variants`)}catch(E){console.error(`[stx-images] Error processing ${_}:`,E)}}));if(console.log("[stx-images] Optimization complete:"),console.log(` Images: ${B.stats.optimizedImages}/${B.stats.totalImages}`),console.log(` Variants: ${B.stats.variants}`),B.stats.savedBytes>0)console.log(` Saved: ~${a(B.stats.savedBytes)}`)}}}function wG(X){let Z=[],G=/src=["']([^"']+\.(jpg|jpeg|png|webp|avif|gif))["']/gi,J;while((J=G.exec(X))!==null)Z.push(J[1]);let q=/<Image[^>]+src=["']([^"']+)["']/gi;while((J=q.exec(X))!==null)Z.push(J[1]);let $=/@image\s*\(\s*['"]([^'"]+)['"]/gi;while((J=$.exec(X))!==null)Z.push(J[1]);let K=/background(?:-image)?:\s*url\(["']?([^"')]+\.(jpg|jpeg|png|webp|avif|gif))["']?\)/gi;while((J=K.exec(X))!==null)Z.push(J[1]);return Z}function xG(X,Z){let G=A.basename(X);for(let J of Z)if(J.endsWith(G)||J.includes(G))return!0;return!1}async function kG(X,Z){return X}async function KG(X){let Z=[];async function G(J){let q=await v.promises.readdir(J,{withFileTypes:!0});for(let $ of q){let K=A.join(J,$.name);if($.isDirectory())await G(K);else if($.isFile()&&i(K))Z.push(K)}}return await G(X),Z}function qG(X,Z){let G=[];for(let J=0;J<X.length;J+=Z)G.push(X.slice(J,J+Z));return G}async function FG(X,Z,G={}){if(!await F())throw Error("No image backend available \u2014 install sharp or ensure ts-images is bundled");return T(X,{...G,outputDir:Z})}async function SG(X,Z,G={}){let{formats:J=w,widths:q=L,quality:$=x,placeholder:K="none",concurrency:Q=4,verbose:Y=!1}=G;if(!await F())throw Error("No image backend available \u2014 install sharp or ensure ts-images is bundled");await v.promises.mkdir(Z,{recursive:!0});let N=await KG(X),j=[],C={totalImages:N.length,optimizedImages:0,savedBytes:0,variants:0},B=qG(N,Q);for(let V of B){let O=await Promise.all(V.map(async(W)=>{try{let H=await T(W,{formats:J,widths:q,quality:$,placeholder:K,outputDir:Z,baseUrl:"/"});if(C.optimizedImages++,C.variants+=H.variants.length,Y)console.log(` \u2713 ${A.basename(W)}`);return H}catch(H){return console.error(`Error processing ${W}:`,H),null}}));j.push(...O.filter((W)=>W!==null))}return{processed:j,stats:C}}function YG(X){let Z={};for(let G of X)Z[G.src]={variants:G.variants,placeholder:G.placeholder};return Z}async function PG(X,Z){let G=YG(X);await Bun.write(Z,JSON.stringify(G,null,2))}var cG={enabled:!0,widths:[320,640,768,1024,1280,1536,1920],formats:["webp","jpeg"],quality:80,devOptimize:!1,cacheDir:".stx/image-cache",placeholder:"none",inputDirs:["public","src/assets","assets"],outputDir:"dist/images",baseUrl:"/images"};
|
|
43
|
-
export{HG as
|
|
43
|
+
export{HG as xf,JG as yf,jG as zf,CG as Af,$G as Bf,UG as Cf,LG as Df,FG as Ef,SG as Ff,YG as Gf,PG as Hf,cG as If};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var L=null,R=[],N=0,U=new Set;function X(){return L}function Y(j){let G=L;return R.push(j),L=j,G}function Z(j){R.pop(),L=j}function _(){return N>0}function $(j){U.add(j)}function B(j){N++;try{j()}finally{if(N--,N===0){let G=[...U];U.clear();for(let F of G)F()}}}function A(j){let G=L;L=null;try{return j()}finally{L=G}}var O=[],P=[];function q(j){let G=j,F=new Set,H=new Set,I=()=>{let z=X();if(z)H.add(z);return G};return I.set=(z)=>{if(!Object.is(z,G)){let J=G;if(G=z,F.forEach((K)=>K(G,J)),_())H.forEach((K)=>$(K));else H.forEach((K)=>K())}},I.update=(z)=>{I.set(z(G))},I.subscribe=(z)=>{return F.add(z),()=>F.delete(z)},Object.defineProperty(I,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(I,"value",{get:()=>I(),set:(z)=>I.set(z),configurable:!0}),I}function E(j){let G,F=!0,H=new Set,I=()=>{if(!F)if(F=!0,_())H.forEach((J)=>$(J));else H.forEach((J)=>J())},z=()=>{let J=X();if(J)H.add(J);if(F){let K=Y(I);try{G=j()}finally{Z(K)}F=!1}return G};return Object.defineProperty(z,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(z,"value",{get:()=>z(),configurable:!0}),z}function V(j,G={}){let F,H=!1,I=()=>{if(H)return;if(F)F(),F=void 0;let z=Y(I);try{let J=j();F=typeof J==="function"?J:void 0}finally{Z(z)}};if(G.immediate!==!1)I();return()=>{if(H=!0,F)F()}}function h(j){B(j)}function k(j){O.push(j)}function o(j){P.push(j)}function g(){W(O,"onMount",P)}function
|
|
3
|
-
export{X as vj,Y as wj,Z as xj,_ as yj,$ as zj,q as Aj,E as Bj,V as Cj,h as Dj,k as Ej,o as Fj,g as Gj,
|
|
2
|
+
var L=null,R=[],N=0,U=new Set;function X(){return L}function Y(j){let G=L;return R.push(j),L=j,G}function Z(j){R.pop(),L=j}function _(){return N>0}function $(j){U.add(j)}function B(j){N++;try{j()}finally{if(N--,N===0){let G=[...U];U.clear();for(let F of G)F()}}}function A(j){let G=L;L=null;try{return j()}finally{L=G}}var O=[],P=[];function q(j){let G=j,F=new Set,H=new Set,I=()=>{let z=X();if(z)H.add(z);return G};return I.set=(z)=>{if(!Object.is(z,G)){let J=G;if(G=z,F.forEach((K)=>K(G,J)),_())H.forEach((K)=>$(K));else H.forEach((K)=>K())}},I.update=(z)=>{I.set(z(G))},I.subscribe=(z)=>{return F.add(z),()=>F.delete(z)},Object.defineProperty(I,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(I,"value",{get:()=>I(),set:(z)=>I.set(z),configurable:!0}),I}function E(j){let G,F=!0,H=new Set,I=()=>{if(!F)if(F=!0,_())H.forEach((J)=>$(J));else H.forEach((J)=>J())},z=()=>{let J=X();if(J)H.add(J);if(F){let K=Y(I);try{G=j()}finally{Z(K)}F=!1}return G};return Object.defineProperty(z,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(z,"value",{get:()=>z(),configurable:!0}),z}function V(j,G={}){let F,H=!1,I=()=>{if(H)return;if(F)F(),F=void 0;let z=Y(I);try{let J=j();F=typeof J==="function"?J:void 0}finally{Z(z)}};if(G.immediate!==!1)I();return()=>{if(H=!0,F){let z=F;F=void 0,z()}}}function h(j){B(j)}function k(j){O.push(j)}function o(j){P.push(j)}function g(){W(O,"onMount",P)}function v(){W(P,"onDestroy")}function W(j,G,F){let H=j.splice(0,j.length);for(let I of H)try{let z=I();if(F&&typeof z==="function")F.push(z)}catch(z){console.error(`[stx] ${G} callback threw:`,z)}}function d(){return{mount:O.length,destroy:P.length}}function m(j){return typeof j==="function"&&j._isSignal===!0}function D(j){return typeof j==="function"&&j._isDerived===!0}function p(j){if(m(j)||D(j))return j();return j}function w(j){return A(j)}function f(j,G){let F=typeof j==="function"?j:()=>j,H=q([]),I=E(()=>H().reduce((K,M)=>G(K,M.action),F())),z=!1;return V(()=>{if(F(),!z){z=!0;return}if(w(()=>H().length))H.set([])}),[I,(K,M)=>{let T={action:K};H.set([...H(),T]);let Q=()=>{let x=H().filter((C)=>C!==T);if(x.length!==H().length)H.set(x)};if(M&&typeof M.then==="function")Promise.resolve(M).then(Q,Q);return Q}]}
|
|
3
|
+
export{X as vj,Y as wj,Z as xj,_ as yj,$ as zj,q as Aj,E as Bj,V as Cj,h as Dj,k as Ej,o as Fj,g as Gj,v as Hj,d as Ij,m as Jj,D as Kj,p as Lj,w as Mj,f as Nj};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Eh as a,Fh as b,Gh as c,Hh as d,Ih as e,Jh as f,Kh as g,Lh as h,Mh as i,Nh as j,Oh as k,Ph as l,Qh as m,Rh as n,Sh as o,Th as p,Uh as q}from"./chunk-d0f60jrg.js";import"./chunk-2vza9m2x.js";export{h as resizeAndConvert,f as processImage,d as isSharpAvailable,m as isImageFile,e as isImageBackendAvailable,l as groupVariantsByFormat,o as getTotalSize,n as getMimeType,g as getImageMetadata,k as getFallbackVariant,i as generateSrcSet,j as generateSizes,p as formatSize,q as ImageProcessingError,a as DEFAULT_WIDTHS,c as DEFAULT_QUALITY,b as DEFAULT_FORMATS};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import C from"path";var G=".stx",K="STX_DIR",J=null;function O(j){J=j?.trim()||null}function H(){return process.env[K]?.trim()||J||G}function Q(j=process.cwd(),...q){let B=H();return C.isAbsolute(B)?C.join(B,...q):C.join(j,B,...q)}function W(j){if(!j||C.isAbsolute(j))return j;let q=j.replace(/\\/g,"/");if(q!==G&&!q.startsWith(`${G}/`))return j;let B=q.slice(G.length+1);return B?C.join(H(),B):H()}
|
|
3
|
-
export{G as
|
|
3
|
+
export{G as zt,K as At,O as Bt,H as Ct,Q as Dt,W as Et};
|
|
@@ -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 mk,k as nk,o as ok,e as pk};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{sj as o,tj as p,uj as q}from"./chunk-
|
|
2
|
+
import{sj as o,tj as p,uj as q}from"./chunk-9veqmqb6.js";import{Aj as a,Bj as b,Cj as c,Dj as d,Ej as e,Fj as f,Gj as g,Hj as h,Ij as i,Jj as j,Kj as k,Lj as l,Mj as m,Nj as n}from"./chunk-fed3xsp9.js";import"./chunk-h7v70dbp.js";import"./chunk-2vza9m2x.js";export{n as useOptimistic,l as untrack,a as state,g as runMountCallbacks,h as runDestroyCallbacks,i as pendingLifecycleCounts,m as peek,e as onMount,f as onDestroy,j as isSignal,k as isDerived,p as generateSignalsRuntimeDev,o as generateSignalsRuntime,c as effect,b as derived,q as default,d as batch};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{$g as i,Tg as a,Ug as b,Vg as c,Wg as d,Xg as e,Yg as f,Zg as g,_g as h}from"./chunk-5yp3vt00.js";import"./chunk-k78gvm0g.js";import"./chunk-2vza9m2x.js";export{c as setCachedImageResult,e as processImage,f as optimizeImage,b as getCachedImageResult,i as generateSrcset,h as generateResponsiveVariants,d as clearImageCache,g as applyTransformations,a as ImageProcessorCache};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import
|
|
3
|
-
export{K as
|
|
2
|
+
import y from"fs";import V from"path";var B=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^<>()]*>)?\s*\(/,X=/(?:^|\n)\s*(?:import|export)\s+(?:[^'"]*?\sfrom\s+)?['"](\.[^'"]*)['"]/g,D=["",".ts",".tsx",".js",".jsx",".mts",".mjs","/index.ts","/index.js"],g=3;function H(j,q){let J=V.resolve(V.dirname(q),j);for(let Q of D){let z=J+Q;try{if(y.statSync(z).isFile())return z}catch{}}return null}function K(j,q,J=0,Q=new Set){if(!q||J>=g)return!1;for(let z of j.matchAll(X)){let Z=H(z[1],q);if(!Z||Q.has(Z))continue;Q.add(Z);let $;try{$=y.readFileSync(Z,"utf8")}catch{continue}if(B.test($))return!0;if(K($,Z,J+1,Q))return!0}return!1}var Y=["batch","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refresh","registerStoresClient","setRouteParams","state","untrack","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],R=["onMount","onDestroy"];function A(j="const",q=[],J){let Q=q.length?Y.filter((z)=>!q.includes(z)):Y;if(J!==void 0)Q=Q.filter((z)=>{let Z=z.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${Z}(?![\\w$])`).test(J)});return`${j} { ${Q.join(", ")} } = window.stx;`}var k=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"],E={redirect:{category:"server-only",reason:"returns an HTTP Response for <script server>/edge/build; use navigate() on the client."},useAsyncData:{category:"browser-composable",reason:"inlined on demand from src/composables when a script references it; reachable, not a bare global."},Teleport:{category:"compile-time-directive",reason:"template tag resolved by processTeleportDirectives; not a script callable."},StxModalBuiltin:{category:"builtin-component",reason:"builtin component used as a template tag; drive open/close from the modal store."},StxToastBuiltin:{category:"builtin-component",reason:"builtin component used as a template tag; push toasts via the toast store."},useForm:{category:"browser-composable",reason:"reactive form primitive; lives in src/composables/use-form.ts and is inlined on demand when a <script client> references it (#1846)."},defineForm:{category:"browser-composable",reason:"deprecated alias of useForm, kept for a minor (#1843). Same delivery path \u2014 inlined on demand from src/composables/use-form.ts."},validateFields:{category:"isomorphic-import",reason:"pure validation helper; import it directly, not auto-delivered to <script client> (per client-api-delivery.test.ts)."},validateField:{category:"isomorphic-import",reason:"singular pure validation helper; same explicit-import boundary as validateFields."}},x=Y.filter((j)=>!k.includes(j));function O(j){if(!j)return!1;return x.some((q)=>new RegExp(`\\b${q}\\s*(?:<[^>]*>)?\\s*\\(`).test(j))}var M=[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\s:[a-z][\w-]*\s*=\s*["']/i,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/],C=/\s@[a-z][\w.:-]*\s*=/i;function T(j,q){if(!j)return!1;let J=U(j);return F(J,q)}function F(j,q){if(M.some((J)=>J.test(j)))return!0;if(O(j))return!0;return P(j,q)}function P(j,q){if(!q)return!1;for(let J of j.matchAll(/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script\s*>/gi))if(K(J[1],q))return!0;return!1}function d(j,q){if(!j)return!1;let J=U(j);return C.test(J)||F(J,q)}var u=["if","else-if","elseif","else","for","show","key","text","html","model","ref"];function _(j){return u.includes(j.toLowerCase())}var G=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],b=["x-init","x-transition","x-effect","x-on"],p=[...G,...b];function c(){return`{${G.map((j)=>`'${j}':1`).join(",")}}`}var v=65536,S=4,w=new Map;function r(){w.clear()}function U(j){if(!j)return j;if(!j.includes("<!--")&&!/<(?:pre|code)\b/i.test(j))return j;let q=j.length>=v;if(q){let z=w.get(j);if(z!==void 0)return z}let J=(z)=>z.replace(/(<[^>]*>)|([^<]+)/g,(Z,$,W)=>$??" ".repeat(W.length)),Q=j.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(z,Z,$,W)=>Z+J($)+W).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(z,Z,$,W)=>Z+J($)+W).replace(/<!--[\s\S]*?-->/g,(z)=>" ".repeat(z.length));if(q){while(w.size>=S){let z=w.keys().next();if(z.done)break;w.delete(z.value)}w.set(j,Q)}return Q}
|
|
3
|
+
export{K as Zt,Y as _t,R as $t,A as au,k as bu,E as cu,x as du,O as eu,T as fu,d as gu,u as hu,_ as iu,G as ju,b as ku,p as lu,c as mu,r as nu,U as ou};
|
|
@@ -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 wh,F as xh,G as yh,H as zh,I as Ah,J as Bh,K as Ch,L as Dh};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{M as
|
|
2
|
+
import{er as E}from"./chunk-qj2s3r1w.js";import{kv as D}from"./chunk-2vza9m2x.js";import I from"path";async function M(k={}){let G=performance.now(),J=k.root||process.cwd(),j=await E(),q=j.ssr?"ssr":"ssg";console.log(`[stx build] Mode: ${q.toUpperCase()}${j.ssr?" (ssr: true in stx.config.ts)":" (default \u2014 ssr is false)"}`);let A,B;if(q==="ssg"){let{generateStaticSite:z}=await import("./ssg.js");A=await z({pagesDir:I.join(j.root||".",j.pagesDir||j.build?.pagesDir||"pages"),publicDir:j.publicDir||j.build?.publicDir||"public",outputDir:j.build?.outputDir||"dist",generate404:j.build?.generate404??!0,minify:j.build?.minify??!0,cleanOutput:j.build?.cleanOutput??!0,router:j.router,...k.ssg})}else{let{buildForProduction:z}=await import("./chunk-z6azwfb4.js");B=await z({outputDir:".output",debug:k.debug,...k.ssr})}let H=Math.round(performance.now()-G);return{mode:q,ssg:A,ssr:B,duration:H}}
|
|
3
|
+
export{M as Mg};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{hg as a,jg as JF,kg as ZF,lg as qF}from"./chunk-34qkshwh.js";import{rg as p}from"./chunk-rjqfa3g8.js";import{sj as C,tj as D}from"./chunk-9veqmqb6.js";import{Ek as QF,Fk as XF,Gk as YF}from"./chunk-58f0mthg.js";import{$n as o,Dp as FF,Hp as c,Km as u,cm as d,cr as n,em as l,er as N,gp as e,vp as t}from"./chunk-qj2s3r1w.js";import{yt as r}from"./chunk-72c7gyqc.js";import{_u as S,av as WF}from"./chunk-drbbt69f.js";import G from"fs";import Z from"path";import{createHash as $F}from"crypto";WF();function g(J){return $F("sha256").update(J).digest("hex").slice(0,8)}function f(J=!1){let q=J?D():C(),z=g(q);return{content:q,filename:`runtime.${z}.js`,hash:z}}function m(){let J=S(),q=g(J);return{content:J,filename:`router.${q}.js`,hash:q}}function UF(J){return{runtimeTag:J.runtime?`<script src="/__stx/${J.runtime.filename}"></script>`:"",routerTag:J.router?`<script src="/__stx/${J.router.filename}"></script>`:"",cssTag:J.css?`<link rel="stylesheet" href="/__stx/${J.css.filename}">`:""}}import h from"path";import{createHash as GF}from"crypto";function VF(J={}){let q=new Set;return{context:new Proxy(J,{get(Q,X){if(X in Q)return Q[X];if(typeof X==="string"&&!X.startsWith("__"))q.add(X);return},has(Q,X){if(X in Q)return!0;if(typeof X==="string"&&!X.startsWith("__"))q.add(X);return!1}}),accessedKeys:q}}async function i(J,q,z={}){let Q=h.resolve(J),X=await Bun.file(Q).text(),I=GF("sha256").update(X).digest("hex").slice(0,16);d();let K={};try{K=await N()}catch{}let B=[],V=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,k;while((k=V.exec(X))!==null){let $=k[1];if(/\bserver\b/.test($))B.push(k[2])}let W=new Set(B.flatMap(($)=>p($))),{context:w}=VF({__filename:Q,__dirname:h.dirname(Q),__stx_serverDeclared:W}),E=new Set,L={...n,...K,...z,buildMode:"compile",strict:!1},_=await c(X,w,Q,L,E),U=a(_),H=l();return{route:q,sourceFile:J,html:_,fragment:U,placeholders:H,hasServerScripts:B.length>0,serverScriptContent:B,dependencies:Array.from(E),contentHash:I,status:u(X),streamTemplates:w.__streamTemplates}}var kF=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function s(J,q){let z=0,Q=0;if(!G.existsSync(J))return{copied:z,bytes:Q};G.mkdirSync(q,{recursive:!0});function X(I,K){let B=G.readdirSync(I,{withFileTypes:!0});for(let V of B){if(kF.has(V.name))continue;let k=Z.join(I,V.name),W=Z.join(K,V.name);if(V.isDirectory())G.mkdirSync(W,{recursive:!0}),X(k,W);else if(V.isFile()){if(G.existsSync(W))continue;G.copyFileSync(k,W),z++,Q+=G.statSync(W).size}}}return X(J,q),{copied:z,bytes:Q}}async function dF(J={}){let q=Date.now(),z=Z.resolve(J.root||process.cwd()),Q=Z.resolve(z,J.outputDir||".output");console.log("[stx build] Starting production build...");let X={};try{X=await N()}catch{}let I=J.componentsDir??X.componentsDir??"components",K=J.partialsDir??X.partialsDir??"partials",B=J.layoutsDir??X.layoutsDir??"layouts",V=J.publicDir??X.publicDir??"public",k=X.app?.head||{},W=X.app?.colorMode,w=X.router?.container||"main";if(G.existsSync(Q))G.rmSync(Q,{recursive:!0});let E=[Z.join(Q,"public","__stx"),Z.join(Q,"public","assets"),Z.join(Q,"server","pages"),Z.join(Q,"server","fragments")];for(let Y of E)G.mkdirSync(Y,{recursive:!0});console.log("[stx build] Discovering routes...");let L=o(z),_=["components","layouts","partials"],U=L.filter((Y)=>{return!_.some((F)=>Y.pattern.startsWith(`/${F}/`)||Y.pattern===`/${F}`)});console.log(`[stx build] Found ${U.length} page routes (${L.length-U.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let H=f(J.debug),$=m();await Bun.write(Z.join(Q,"public","__stx",H.filename),H.content),await Bun.write(Z.join(Q,"public","__stx",$.filename),$.content),console.log(`[stx build] Runtime: ${H.filename} (${(H.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${$.filename} (${($.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let O=[],j=[];for(let Y of U)try{let F=await i(Y.filePath,Y.pattern,{componentsDir:I,partialsDir:K,layoutsDir:B,debug:J.debug});if(O.push(F),F.html=F.html.replace(/runtime\.__STX_HASH__\.js/g,H.filename).replace(/router\.__STX_HASH__\.js/g,$.filename),F.html=FF(F.html,k,{bodyScripts:[`<script src="/__stx/${$.filename}"></script>`],...W&&{colorMode:W}}),W)F.html=e(F.html,W);if(k.htmlAttrs)F.html=t(F.html,k.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(F.html)){let T=F.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(T&&T[1]){let P=T[1];F.html=F.html.replace(" "+P,""),F.html=F.html.replace(/<body([^>]*)>/,`<body$1 ${P}>`)}}F.html=F.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),F.html=await r(F.html),F.fragment=JF(F.html,w);let y=Y.pattern==="/"?"index":Y.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),b=Z.join("server","pages",`${y}.compiled.json`),A=Z.join("server","fragments",`${y}.html`);await Bun.write(Z.join(Q,b),JSON.stringify(F,null,2)),await Bun.write(Z.join(Q,A),F.fragment),j.push({pattern:Y.pattern,compiledPath:b,fragmentPath:A,isDynamic:F.hasServerScripts,hasParams:Y.pattern.includes(":")||Y.pattern.includes("[")}),console.log(`[stx build] \u2713 ${Y.pattern}`)}catch(F){console.error(`[stx build] \u2717 ${Y.pattern}:`,F instanceof Error?F.message:F)}let M=Z.resolve(z,V);if(G.existsSync(M)){let{copied:Y,bytes:F}=s(M,Z.join(Q,"public"));if(Y>0)console.log(`[stx build] Copied ${Y} public asset${Y===1?"":"s"} (${(F/1024).toFixed(1)}KB) from ${V}/`)}let v=YF(z);if(v){let{copied:Y,bytes:F}=s(v,Z.join(Q,"public",XF));if(Y>0)console.log(`[stx build] Copied ${Y} asset${Y===1?"":"s"} (${(F/1024).toFixed(1)}KB) from ${QF}/`)}let R={runtime:H.filename,router:$.filename},zF=ZF(j,R,Q);qF(zF,Q);let x=Date.now()-q;return console.log(`
|
|
3
3
|
[stx build] Done in ${x}ms \u2014 ${O.length} pages compiled`),{pageCount:O.length,assets:R,outputDir:Q,duration:x}}
|
|
4
|
-
export{g as
|
|
4
|
+
export{g as Rf,f as Sf,m as Tf,UF as Uf,i as Vf,dF as Wf};
|
|
@@ -213,4 +213,4 @@ function w(Z,M){let{itemHeight:K,containerHeight:P,overscan:F=3,keyProperty:$="i
|
|
|
213
213
|
})();
|
|
214
214
|
</script>
|
|
215
215
|
`})}var v={createVirtualList:w,processVirtualListDirectives:C,processInfiniteListDirectives:E,processVirtualGridDirectives:f,generateVirtualListCSS:b,useVirtualList:L};
|
|
216
|
-
export{w as
|
|
216
|
+
export{w as Ri,C as Si,b as Ti,L as Ui,E as Vi,f as Wi,v as Xi};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import{existsSync as U,statSync as V}from"fs";import z from"path";var W=/[*?[\]{}]/;function X(D){return W.test(D)}async function $(D,E={}){let H=E.cwd??process.cwd(),N=E.recursive!==!1,Q=E.ignorePaths??[],J=globalThis.Bun.Glob,K=new Set,F=(j)=>{if(j.includes(`${z.sep}node_modules${z.sep}`)||j.includes(`${z.sep}dist${z.sep}`))return;if(Q.some((q)=>q&&j.includes(z.normalize(q))))return;K.add(j)},R=async(j)=>{try{for await(let q of new J(j).scan({cwd:H,absolute:!0}))F(q)}catch{}};for(let j of D){if(!j)continue;if(X(j)){await R(j);continue}let q=z.resolve(H,j);if(!U(q))continue;if(V(q).isDirectory()){for await(let T of new J(N?"**/*.stx":"*.stx").scan({cwd:q,absolute:!0}))F(T);continue}F(q)}return[...K].sort()}
|
|
3
|
-
export{X as
|
|
3
|
+
export{X as Ws,$ as Xs};
|