@stacksjs/stx 0.2.888 → 0.2.890
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-c0g30cjs.js → chunk-05x1rd86.js} +2 -2
- package/dist/{chunk-6qq3wy3m.js → chunk-062qfv99.js} +2 -2
- package/dist/{chunk-s29hp1qw.js → chunk-0jdz31q1.js} +3 -3
- package/dist/{chunk-1kc0jyhj.js → chunk-0jkj8thz.js} +1 -1
- package/dist/chunk-0k437z3q.js +2 -0
- package/dist/chunk-0q0nbq50.js +2 -0
- package/dist/{chunk-5ysv0499.js → chunk-0wp23n1d.js} +1 -1
- package/dist/{chunk-9f31gs4m.js → chunk-115bb91s.js} +2 -2
- package/dist/chunk-12cjs6vs.js +2 -0
- package/dist/chunk-1a7a8cjs.js +2 -0
- package/dist/{chunk-wpa3r3b9.js → chunk-1bft48gk.js} +2 -2
- package/dist/{chunk-9tecekzq.js → chunk-1jtsr42q.js} +18 -18
- package/dist/{chunk-vazk5qbh.js → chunk-1knk403z.js} +2 -2
- package/dist/chunk-1p4q6t48.js +2 -0
- package/dist/chunk-1ph2yhfn.js +3 -0
- package/dist/{chunk-c1b0fy70.js → chunk-1t15z230.js} +5 -5
- package/dist/{chunk-2assyczz.js → chunk-1w0bqqh5.js} +2 -2
- package/dist/chunk-1z6pqvmf.js +2 -0
- package/dist/chunk-2nqmw4dv.js +2 -0
- package/dist/{chunk-e9tjxnhn.js → chunk-2xnbdqy4.js} +5 -5
- package/dist/chunk-35j7gaj5.js +2 -0
- package/dist/chunk-3b3mkgpj.js +3 -0
- package/dist/{chunk-7mcs59pr.js → chunk-3bsz7zj3.js} +2 -2
- package/dist/{chunk-w624s5jf.js → chunk-3qk8vf9m.js} +3 -3
- package/dist/chunk-3yvmaphj.js +2 -0
- package/dist/{chunk-mk6thhwf.js → chunk-40k0r6z9.js} +2 -2
- package/dist/{chunk-6t04tqvh.js → chunk-41z7f41b.js} +2 -2
- package/dist/chunk-44teqn0b.js +2 -0
- package/dist/{chunk-372xh1g1.js → chunk-49xwf7dk.js} +6 -6
- package/dist/chunk-4akw3bym.js +2 -0
- package/dist/chunk-4d85str1.js +2 -0
- package/dist/{chunk-whsdyf4t.js → chunk-4eescf3s.js} +7 -7
- package/dist/chunk-4xbtxeak.js +2 -0
- package/dist/chunk-53kcqdjj.js +2 -0
- package/dist/{chunk-1xpq83mc.js → chunk-67j2m620.js} +4 -4
- package/dist/chunk-690518hw.js +2 -0
- package/dist/chunk-6s3jwysv.js +2 -0
- package/dist/{chunk-znnvq1jp.js → chunk-6svc4kb8.js} +65 -65
- package/dist/chunk-732gb689.js +2 -0
- package/dist/{chunk-ah6nc29h.js → chunk-80ky40mm.js} +2 -2
- package/dist/chunk-80xzjxah.js +2 -0
- package/dist/chunk-850tye3c.js +2 -0
- package/dist/{chunk-b8528fra.js → chunk-8ccgty8s.js} +4 -4
- package/dist/{chunk-btsgt6w3.js → chunk-8f8qgjjr.js} +2 -2
- package/dist/{chunk-ry6w43p6.js → chunk-8hwfdwgn.js} +6 -6
- package/dist/chunk-9344rq4r.js +38 -0
- package/dist/chunk-94j4p584.js +2 -0
- package/dist/{chunk-y76znqmh.js → chunk-97snfzsy.js} +54 -54
- package/dist/chunk-9a9cec4x.js +2 -0
- package/dist/chunk-9afkttvz.js +2 -0
- package/dist/{chunk-0hj5apb9.js → chunk-9rjgq8k4.js} +1 -1
- package/dist/chunk-a0aqs5a8.js +3 -0
- package/dist/{chunk-9qrgdekg.js → chunk-a3zrwky3.js} +16 -16
- package/dist/{chunk-care745q.js → chunk-a7bqrjm5.js} +2 -2
- package/dist/{chunk-pm4kn9h2.js → chunk-adsqckg4.js} +10 -10
- package/dist/chunk-ah8az9vv.js +2 -0
- package/dist/{chunk-605g9qhp.js → chunk-aj5tsksz.js} +9 -9
- package/dist/chunk-amb7e0fp.js +2 -0
- package/dist/chunk-arr79m90.js +2 -0
- package/dist/{chunk-55kwxxm5.js → chunk-b0hj8eg2.js} +2 -2
- package/dist/{chunk-r57jz09p.js → chunk-bgfs3mbg.js} +5 -5
- package/dist/chunk-bm0mzk3b.js +2 -0
- package/dist/{chunk-ymqm898x.js → chunk-bvqgq18r.js} +2 -2
- package/dist/{chunk-wbxmn5gk.js → chunk-bw2m1e7g.js} +5 -5
- package/dist/{chunk-wm287dz2.js → chunk-c25q87ys.js} +3 -3
- package/dist/{chunk-98mj0es1.js → chunk-ch9028z3.js} +1 -1
- package/dist/{chunk-sbwvvjkc.js → chunk-cmg9x1ka.js} +3 -3
- package/dist/{chunk-11fxbd71.js → chunk-cphc60zw.js} +2 -2
- package/dist/{chunk-dj9ztcth.js → chunk-dvjv4c3a.js} +1 -1
- package/dist/{chunk-v8e2c2r1.js → chunk-e16ef18k.js} +2 -2
- package/dist/chunk-e28czxw3.js +2 -0
- package/dist/chunk-e8szp5wa.js +2 -0
- package/dist/chunk-eq86wzhr.js +1314 -0
- package/dist/chunk-essd43ad.js +2 -0
- package/dist/chunk-f60k8j9m.js +2 -0
- package/dist/chunk-fsk3rk2x.js +2 -0
- package/dist/{chunk-fce8wj3t.js → chunk-g3vce7ka.js} +2 -2
- package/dist/{chunk-em6fqvjy.js → chunk-g5nfqzfh.js} +2 -2
- package/dist/chunk-gfea8a9y.js +2 -0
- package/dist/chunk-hda7t8g6.js +2 -0
- package/dist/chunk-hk241gt2.js +2 -0
- package/dist/{chunk-c3ca056p.js → chunk-htx5yezj.js} +2 -2
- package/dist/{chunk-b0jekg4c.js → chunk-hxws025y.js} +3 -3
- package/dist/chunk-hyyh7qxw.js +25 -0
- package/dist/chunk-j6fs31va.js +2 -0
- package/dist/chunk-j9kejcrx.js +2 -0
- package/dist/chunk-j9vfv53x.js +20 -0
- package/dist/chunk-jhbz5w30.js +2 -0
- package/dist/chunk-jvnsz2x9.js +2 -0
- package/dist/chunk-k4x680e3.js +2 -0
- package/dist/chunk-k8bk685s.js +2 -0
- package/dist/chunk-kexqmwx8.js +2 -0
- package/dist/chunk-kfdmm240.js +2 -0
- package/dist/{chunk-fepezvdq.js → chunk-kg7vby72.js} +8 -8
- package/dist/{chunk-wf8pdjq5.js → chunk-khm56bfm.js} +1 -1
- package/dist/{chunk-303vzq80.js → chunk-kk2p2tgv.js} +3 -3
- package/dist/chunk-kpjq135z.js +2 -0
- package/dist/chunk-kqsm7gf1.js +2 -0
- package/dist/{chunk-j51wss7s.js → chunk-kr2400c3.js} +4 -4
- package/dist/{chunk-r8xper92.js → chunk-ksmn19qw.js} +2 -2
- package/dist/{chunk-7hm1tpw0.js → chunk-mhrnjaka.js} +6 -6
- package/dist/chunk-mtfymhy1.js +2 -0
- package/dist/{chunk-52mhrbps.js → chunk-n6q1d66k.js} +1 -1
- package/dist/chunk-neg6ckjg.js +12 -0
- package/dist/{chunk-wscry63p.js → chunk-nhv81gp2.js} +2 -2
- package/dist/{chunk-c73c0wf9.js → chunk-nq60tjkz.js} +2 -2
- package/dist/{chunk-v47xc2fr.js → chunk-nzpb263k.js} +9 -9
- package/dist/{chunk-p33npqjt.js → chunk-p0bjbtdx.js} +33 -33
- package/dist/{chunk-gdtj5rfa.js → chunk-p3hbsrk9.js} +6 -6
- package/dist/chunk-p82fzxdg.js +2 -0
- package/dist/{chunk-0d7ypcjb.js → chunk-pjj54ddk.js} +3 -3
- package/dist/{chunk-qsnpqa8q.js → chunk-pnmafbv5.js} +1 -1
- package/dist/{chunk-vgsasnwm.js → chunk-pvm48tse.js} +3 -3
- package/dist/{chunk-zek9t5za.js → chunk-pwpge9bj.js} +2 -2
- package/dist/{chunk-6zq3eh7d.js → chunk-q0y8gv18.js} +2 -2
- package/dist/{chunk-7s3j8pqq.js → chunk-qnf7w4xw.js} +3 -3
- package/dist/chunk-qsv84cwm.js +2 -0
- package/dist/{chunk-xavx271y.js → chunk-r5ecgcx2.js} +5 -5
- package/dist/chunk-r7m60q1m.js +2 -0
- package/dist/chunk-r98pye4h.js +2 -0
- package/dist/{chunk-zf29ahhd.js → chunk-rb2zbdqd.js} +4 -4
- package/dist/{chunk-vjfp8n6p.js → chunk-rd663v1m.js} +3 -3
- package/dist/{chunk-4nnmrp7w.js → chunk-rf0smj4c.js} +2 -2
- package/dist/{chunk-0dq9svfb.js → chunk-sh7a0g09.js} +3 -3
- package/dist/chunk-snkbn5y8.js +2 -0
- package/dist/chunk-sztr4d5g.js +2 -0
- package/dist/{chunk-4c9p434g.js → chunk-t0ttxayz.js} +2 -2
- package/dist/{chunk-5ymf5c8m.js → chunk-t3zmfh8w.js} +7 -7
- package/dist/chunk-t4gcsbna.js +2 -0
- package/dist/chunk-tbh7r1wh.js +2 -0
- package/dist/chunk-tspqdt8e.js +2 -0
- package/dist/{chunk-6fsnnj5v.js → chunk-v1mwwben.js} +6 -6
- package/dist/chunk-v3jyb8k6.js +2 -0
- package/dist/chunk-v6gkjg5f.js +3 -0
- package/dist/chunk-v90nz5xm.js +54 -0
- package/dist/{chunk-7nhgpjjw.js → chunk-vf4ejngv.js} +6 -6
- package/dist/chunk-vfcbz0an.js +3 -0
- package/dist/{chunk-hxhmhw23.js → chunk-vk2jy6mn.js} +3 -3
- package/dist/{chunk-e1qcfesw.js → chunk-vkfw9k1n.js} +8 -8
- package/dist/{chunk-mm1eg2pg.js → chunk-vxbvrbqs.js} +10 -10
- package/dist/chunk-wedwczed.js +2 -0
- package/dist/chunk-wg6fmren.js +4 -0
- package/dist/{chunk-s7wp7a2x.js → chunk-whcrca58.js} +31 -31
- package/dist/chunk-wmvvrsn0.js +2 -0
- package/dist/chunk-wnrh62by.js +2 -0
- package/dist/{chunk-q3bkxg2n.js → chunk-wy6vjz1e.js} +21 -21
- package/dist/{chunk-mbm3ma63.js → chunk-x5bn2svk.js} +2 -2
- package/dist/chunk-x6565mhk.js +2 -0
- package/dist/{chunk-brzjass3.js → chunk-xc5esqcb.js} +2 -2
- package/dist/{chunk-e2ws79vt.js → chunk-xeyq6d0t.js} +8 -8
- package/dist/{chunk-xw291tn7.js → chunk-xmg6bmh6.js} +27 -22
- package/dist/{chunk-3fbgpv1d.js → chunk-xvncq3m5.js} +2 -2
- package/dist/chunk-xwgdcc7w.js +2 -0
- package/dist/chunk-xwrjre34.js +2 -0
- package/dist/{chunk-1wkp3pks.js → chunk-xy8smv5e.js} +2 -2
- package/dist/{chunk-y8p59h6c.js → chunk-y1d3j2j7.js} +4 -4
- package/dist/{chunk-zje94z0k.js → chunk-yesh4dfe.js} +61 -61
- package/dist/chunk-ymc1wgb3.js +2 -0
- package/dist/{chunk-xy4j8t7w.js → chunk-ytjn0gq2.js} +2 -2
- package/dist/chunk-z4tdnfxd.js +2 -0
- package/dist/{chunk-w1q86c89.js → chunk-zf68afyh.js} +3 -3
- package/dist/{chunk-6c1vm6bs.js → chunk-zkwkhesc.js} +2 -2
- package/dist/{chunk-2rmqmajd.js → chunk-zpqjsnz9.js} +3 -3
- package/dist/{chunk-vgr7gd8k.js → chunk-zwqkbk2m.js} +2 -2
- package/dist/chunk-zxjdfgdx.js +3 -0
- package/dist/cli.js +29 -29
- package/dist/component-contract.d.ts +1 -0
- package/dist/component-contract.js +6 -4
- package/dist/component-library.d.ts +2 -1
- package/dist/component-library.js +218 -348
- package/dist/composition-api.d.ts +7 -1
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/directive-arguments.js +39 -6
- package/dist/emits-declaration.d.ts +9 -0
- package/dist/emits-declaration.js +64 -0
- package/dist/parser/tokenizer.d.ts +2 -1
- package/dist/parser/tokenizer.js +7 -5
- package/dist/props-declaration.d.ts +66 -0
- package/dist/props-declaration.js +379 -0
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +28 -28
- package/dist/utils.js +20 -109
- package/package.json +5 -5
- package/dist/chunk-000mwmfq.js +0 -1203
- package/dist/chunk-043d0en0.js +0 -2
- package/dist/chunk-0w66z6eq.js +0 -2
- package/dist/chunk-13wd9gf0.js +0 -3
- package/dist/chunk-1znqedae.js +0 -2
- package/dist/chunk-2drzzjcm.js +0 -2
- package/dist/chunk-3c7nt5qp.js +0 -2
- package/dist/chunk-3ed2erm6.js +0 -12
- package/dist/chunk-3zyzhcd9.js +0 -2
- package/dist/chunk-44rb9fk0.js +0 -2
- package/dist/chunk-472j3bhp.js +0 -2
- package/dist/chunk-4acce1m8.js +0 -2
- package/dist/chunk-4kasmp98.js +0 -2
- package/dist/chunk-53kkjn23.js +0 -2
- package/dist/chunk-5gwvy612.js +0 -2
- package/dist/chunk-61vbqrde.js +0 -2
- package/dist/chunk-6fpzwryt.js +0 -2
- package/dist/chunk-7195598h.js +0 -2
- package/dist/chunk-7zvf79vb.js +0 -2
- package/dist/chunk-88a735jw.js +0 -2
- package/dist/chunk-8v7yjq3b.js +0 -2
- package/dist/chunk-94mpe1ny.js +0 -3
- package/dist/chunk-97kgrevs.js +0 -4
- package/dist/chunk-a8c9j9cj.js +0 -2
- package/dist/chunk-acw851e8.js +0 -2
- package/dist/chunk-andfvr3g.js +0 -2
- package/dist/chunk-aqxh80vh.js +0 -2
- package/dist/chunk-ay5zkfdg.js +0 -2
- package/dist/chunk-b4gptdtc.js +0 -2
- package/dist/chunk-baaw9w7y.js +0 -2
- package/dist/chunk-bw2p9h2g.js +0 -2
- package/dist/chunk-ce0vv7kz.js +0 -2
- package/dist/chunk-d1yj29g2.js +0 -2
- package/dist/chunk-dbhmbef1.js +0 -20
- package/dist/chunk-dfsykk1r.js +0 -2
- package/dist/chunk-e9p596bp.js +0 -2
- package/dist/chunk-edysherg.js +0 -25
- package/dist/chunk-ftecsa8e.js +0 -2
- package/dist/chunk-ge2h5v46.js +0 -2
- package/dist/chunk-gqvnz8a7.js +0 -2
- package/dist/chunk-j41gp8p3.js +0 -2
- package/dist/chunk-jxvccj30.js +0 -2
- package/dist/chunk-k5bbre7d.js +0 -2
- package/dist/chunk-kd47vgs8.js +0 -2
- package/dist/chunk-keqjafdz.js +0 -2
- package/dist/chunk-kvxdyg7e.js +0 -3
- package/dist/chunk-kz3mejc4.js +0 -2
- package/dist/chunk-ngkh0t5b.js +0 -2
- package/dist/chunk-nx9895m6.js +0 -2
- package/dist/chunk-nxgtt1t1.js +0 -2
- package/dist/chunk-nyw2ztar.js +0 -2
- package/dist/chunk-p5q27adr.js +0 -2
- package/dist/chunk-p6hcrg3r.js +0 -3
- package/dist/chunk-pa2vt2ej.js +0 -2
- package/dist/chunk-pczb7xav.js +0 -2
- package/dist/chunk-ps37r6hj.js +0 -2
- package/dist/chunk-pvbhk17r.js +0 -2
- package/dist/chunk-q252qvsy.js +0 -2
- package/dist/chunk-q5b0vpmm.js +0 -2
- package/dist/chunk-qg1kw5yf.js +0 -2
- package/dist/chunk-qjy5yq25.js +0 -54
- package/dist/chunk-r561zt9v.js +0 -38
- package/dist/chunk-sbr85vda.js +0 -2
- package/dist/chunk-tkab24xr.js +0 -2
- package/dist/chunk-vn59yrjh.js +0 -2
- package/dist/chunk-w50yggy3.js +0 -3
- package/dist/chunk-w5zzwe2f.js +0 -2
- package/dist/chunk-wa9q1gyv.js +0 -2
- package/dist/chunk-wbmx0rge.js +0 -2
- package/dist/chunk-wpgxhrd7.js +0 -2
- package/dist/chunk-x3azrbpr.js +0 -2
- package/dist/chunk-x50hk1hq.js +0 -2
- package/dist/chunk-xbkbvfcg.js +0 -2
- package/dist/chunk-z55rpt3s.js +0 -3
- package/dist/chunk-zwde52kw.js +0 -2
- package/dist/chunk-zxff7kq9.js +0 -2
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
function m(e,s){let i=e[s],n=s+1;while(n<e.length){if(e[n]==="\\"){n+=2;continue}if(e[n]===i)return n+1;n++}return e.length}function c(e,s){let i=s+1;while(i<e.length){if(e[i]==="\\"){i+=2;continue}if(e[i]==="`")return i+1;if(e[i]==="$"&&e[i+1]==="{"){if(i=jl(e,i+2),i<e.length)i++;continue}i++}return e.length}function jl(e,s){let i=1,n=s,l="{",r="";while(n<e.length){let f=e[n];if(f==="\\"){n+=2;continue}if(f==='"'||f==="'"){n=m(e,n),l=a,r="";continue}if(f==="`"){n=c(e,n),l=a,r="";continue}if(f==="/"&&e[n+1]==="/"){while(n<e.length&&e[n]!==`
|
|
3
|
+
`)n++;continue}if(f==="/"&&e[n+1]==="*"){n+=2;while(n<e.length&&e.slice(n,n+2)!=="*/")n++;n+=2;continue}if(f==="/"&&p(l,r)){let u=b(e,n);if(u!==-1){n=u,l=a,r="";continue}}if(f==="{")i++;else if(f==="}"){if(i--,i===0)return n}if(/[\w$]/.test(f))r=/[\w$]/.test(l)?r+f:f,l=f;else if(!/\s/.test(f))l=f,r="";n++}return e.length}var E=new Set(["return","typeof","instanceof","in","of","new","delete","void","throw","case","do","else","yield","await"]);function p(e,s){if(s)return E.has(s);return!(e===")"||e==="]"||e===a)}var a="\x00";function b(e,s){let i=s+1,n=!1;while(i<e.length){let l=e[i];if(l===`
|
|
4
|
+
`)return-1;if(l==="\\"){i+=2;continue}if(l==="[")n=!0;else if(l==="]")n=!1;else if(l==="/"&&!n){i++;while(i<e.length&&/[a-z]/i.test(e[i]))i++;return i}i++}return-1}function t(e){return o(e,!1)}function zn(e){return o(e,!0)}function o(e,s){let i="",n=0,l="",r="";while(n<e.length){let f=e.slice(n,n+2);if(f==="//"){while(n<e.length&&e[n]!==`
|
|
5
|
+
`)i+=" ",n++;continue}if(f==="/*"){while(n<e.length&&e.slice(n,n+2)!=="*/")i+=e[n]===`
|
|
6
|
+
`?`
|
|
7
|
+
`:" ",n++;i+=" ",n+=2;continue}let u=e[n];if(u==='"'||u==="'"){let g=u;i+=" ",n++;while(n<e.length&&e[n]!==g){if(e[n]==="\\"){i+=" ",n+=2;continue}i+=e[n]===`
|
|
8
|
+
`?`
|
|
9
|
+
`:" ",n++}i+=s?"$":" ",n++,l=a,r="";continue}if(u==="/"&&p(l,r)){let g=b(e,n);if(g!==-1){i+=`/${" ".repeat(g-n-2)}/`,n=g,l=a,r="";continue}}if(u==="`"){i+=s?"(":" ",n++;while(n<e.length&&e[n]!=="`"){if(e[n]==="\\"){i+=" ",n+=2;continue}if(e[n]==="$"&&e[n+1]==="{"){let g=n+2,w=jl(e,g);if(i+=s?" {":" ",i+=o(e.slice(g,w),s),w<e.length)i+=s?"}":" ";n=w+1;continue}i+=e[n]===`
|
|
10
|
+
`?`
|
|
11
|
+
`:" ",n++}i+=s?")":" ",n++,l=a,r="";continue}if(i+=u,n++,/[\w$]/.test(u))r=/[\w$]/.test(l)?r+u:u,l=u;else if(!/\s/.test(u))l=u,r=""}return i}function h(e){let s=new Uint16Array(e.length),i=0,n=!0;for(let l=0;l<e.length;l++){let r=e[l];if(r===")"||r==="]"||r==="}")if(i===0)n=!1;else i--;if(s[l]=i,r==="("||r==="["||r==="{")i++}return{depths:s,balanced:n&&i===0}}
|
|
12
|
+
export{jl,t,zn,h};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ye,F,Gt}from"./chunk-6t04tqvh.js";import{T}from"./chunk-s29hp1qw.js";import{Ct,Le,V,rt,je,Ma,No,Da,Wn}from"./chunk-v47xc2fr.js";import{Nt,ve,dt}from"./chunk-b8528fra.js";import{Jo}from"./chunk-e9tjxnhn.js";import{qn}from"./chunk-c73c0wf9.js";import{$e}from"./chunk-fepezvdq.js";import Z from"fs";import P from"path";var{serve:ae}=globalThis.Bun;import O from"zlib";import{promisify as Y}from"util";var K=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],ee=["text/event-stream","multipart/x-mixed-replace"],te=1024;function ne(t){if(!t)return!1;let e=t.toLowerCase();if(ee.some((a)=>e.startsWith(a)))return!1;return K.some((a)=>e.startsWith(a))}function re(t){let e=new Map;for(let a of t.split(",")){let[r,...i]=a.trim().split(";"),f=r.trim().toLowerCase();if(!f)continue;let h=1;for(let g of i){let l=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(g);if(!l)continue;let m=Number.parseFloat(l[1]);if(Number.isFinite(m))h=m}e.set(f,h)}return e}function se(t){if(!t)return null;let e=re(t),a=e.get("*"),r=(i)=>e.get(i)??a??0;if(r("br")>0)return"br";if(r("gzip")>0)return"gzip";return null}var J=33554432,H=new Map,z=0;function oe(t,e){if(e.length>J/8)return;H.set(t,e),z+=e.length;for(let[a,r]of H){if(z<=J)break;H.delete(a),z-=r.length}}async function zn(t,e,a={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!ne(e.headers.get("content-type")))return e;let r=se(t.headers.get("accept-encoding"));if(!r)return e;let i;try{i=new Uint8Array(await e.arrayBuffer())}catch{return e}let f=()=>new Response(i,{status:e.status,statusText:e.statusText,headers:Q(e.headers)});if(i.length<(a.threshold??te))return f();try{let h=a.quality??5,g=`${r}:${h}:${i.length}:${Bun.hash(i)}`,l=H.get(g);if(!l)l=r==="br"?await Y(O.brotliCompress)(i,{params:{[O.constants.BROTLI_PARAM_QUALITY]:h,[O.constants.BROTLI_PARAM_SIZE_HINT]:i.length}}):await Y(O.gzip)(i),oe(g,l);if(l.length>=i.length)return f();let m=Q(e.headers);return m.set("Content-Encoding",r),m.set("Content-Length",String(l.length)),new Response(l,{status:e.status,statusText:e.statusText,headers:m})}catch{return f()}}function Q(t){let e=new Headers(t),a=e.get("Vary");if(!a)return e.set("Vary","Accept-Encoding"),e;if(!a.split(",").some((i)=>i.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${a}, Accept-Encoding`);return e}class G{now;entries=new T(1000,{maxBytes:33554432,sizeOf:(t)=>t.body.byteLength+JSON.stringify(t.headers).length*2});pending=new Map;generation=0;constructor(t=Date.now){this.now=t}invalidate(t){this.generation++,this.pending.clear();for(let e of Array.from(this.entries.keys()))if(t===void 0||this.entries.get(e)?.path===t)this.entries.delete(e)}async respond(t,e,a){let r,i=async()=>{let s=r??await a();return s.headers.set("Cache-Control","private, no-store"),s.headers.set("Vary",V(s.headers.get("Vary")).Vary),s};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return i();let f=new URL(t.url),h=`${f.origin}${f.pathname}${f.search}|${Le(t)?"fragment":"document"}`,g=this.entries.get(h),l=(s)=>{let b=new Headers(s.headers);return b.set("Cache-Control","private, no-store"),b.set("Age",String(Math.max(0,Math.floor((this.now()-s.created)/1000)))),new Response(s.body.slice(0),{headers:b})},m=g?(this.now()-g.created)/1000:1/0;if(g&&m<e.maxAge)return l(g);let v=this.generation,_=async()=>{let s=await a();r=s;let b=(s.headers.get("Vary")??"").toLowerCase().split(",").map((y)=>y.trim()).filter(Boolean);if(s.status!==200||s.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(s.headers.get("Cache-Control")??"")||b.some((y)=>y!=="x-stx-router"&&y!=="accept-encoding"))return null;let E=await s.clone().arrayBuffer();if(E.byteLength>1048576)return null;s.headers.set("Vary",V(s.headers.get("Vary")).Vary);let n={body:E,headers:Array.from(s.headers.entries()),created:this.now(),path:f.pathname};if(this.generation===v)this.entries.set(h,n);return n},x=this.pending.get(h);if(!x){if(this.pending.size>=1000)return i();x=_().finally(()=>{if(this.pending.get(h)===x)this.pending.delete(h)}),this.pending.set(h,x)}if(g&&m<e.maxAge+(e.swr??0))return x.catch(()=>{}),l(g);let M=await x;return M?l(M):i()}}var ie={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"};async function _m(t={}){let e=P.resolve(t.outputDir||".output"),a=t.port??3000,r=Ma(e);if(!r)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${r.routes.length} routes...`);let i=qn(r.routeRules),f=new G,h=Jo(e,r.apiRoutes??[]),g=Bun.file(P.join(e,"server/runtime-config.json")),l=t.runtimeConfig??(await g.exists()?await g.json():void 0),m=l?F(l):void 0,v=new Map,_=new Map,x=new Map,M=new Map;for(let n of r.routes)try{let y=P.join(e,n.compiledPath),c=JSON.parse(await Bun.file(y).text());if(m)c.html=Gt(c.html,m);v.set(n.pattern,c),x.set(n.pattern,dt(c.html)),M.set(n.pattern,$e(c.html));let j=P.join(e,n.fragmentPath);if(rt(c.html,r.routerContainer||"main")&&await Bun.file(j).exists()){let A=await Bun.file(j).text();_.set(n.pattern,m?Gt(A,m):A)}}catch(y){console.warn(`[stx] Failed to load route ${n.pattern}:`,y)}let s=new Map,b=[];for(let n of r.routes)if(n.hasParams){let{regex:y,params:c}=ve(n.pattern,{page:!0});b.push({regex:y,route:n,paramNames:c})}else s.set(n.pattern,n);let E=ae({port:a,async fetch(n){return zn(n,await Ye(m??F(),async()=>{let c=new URL(n.url).pathname;if(t.onRequest){let p=await t.onRequest(n);if(p)return p}if(t.apiRouter){let p=await t.apiRouter.handleRequest(n);if(p.status!==404)return p}if(t.apiRoutes?.[c])return t.apiRoutes[c](n);let j=await h(n);if(j)return j;if((n.method==="GET"||n.method==="HEAD")&&c!=="/"){let p=P.resolve(e,"public"),d;try{d=decodeURIComponent(c)}catch{d=c}if(!d.includes("\x00")){let u=P.resolve(p,`.${d}`);if(u===p||u.startsWith(`${p}${P.sep}`))try{if(Z.existsSync(u)&&Z.statSync(u).isFile()){let R=P.extname(u).toLowerCase(),B=ie[R]||"application/octet-stream",X=c.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(c);return new Response(Bun.file(u),{headers:{"Content-Type":B,"Cache-Control":X?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let A=Le(n),C=null,q={};if(C=s.get(c)||null,!C)for(let{regex:p,route:d,paramNames:u}of b){let o=c.match(p);if(o){C=d,u.forEach((R,B)=>{q[R]=o[B+1]});break}}if(!C){let p=Nt(c)?null:s.get("/404")||null;if(p){let d=v.get(p.pattern);if(d)return new Response(d.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}})}let N=i(c),W=Object.keys(N).length>0;return f.respond(n,N.cache,async()=>{let p=v.get(C.pattern);if(A&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let o=_.get(C.pattern);if(o){let R=x.get(C.pattern);return new Response(o,{status:p.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...M.has(C.pattern)?{"X-STX-Runtime":M.get(C.pattern)?"true":"false"}:{},...R?{"X-STX-Layout":R.layout,"X-STX-Layout-Group":R.group}:{},...V(),...N.cache?{}:{"Cache-Control":Ct}}})}}let d=No(n.method),u=v.get(C.pattern);if(!u){let o=s.get("/500")||null;if(o){let R=v.get(o.pattern);if(R)return new Response(R.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(C.prerendered&&d)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!d&&!u.hasServerScripts&&Object.keys(u.placeholders).length===0)return new Response(u.html,{status:u.status??200,headers:{"Content-Type":"text/html",...V(),"Cache-Control":"public, max-age=60"}});try{let{html:o,boundaries:R,redirect:B,cookies:X,status:I,headers:D}=await Wn(u,{params:q,request:n,method:n.method,__stx_strict_hydration:W,__stx_runtime_config:m});if(B)return Da(B,X,D);if(R&&R.length>0){let{renderStreamingPage:S,streamToResponse:U}=await import("./chunk-a8c9j9cj.js"),L=new Headers({...V(),...D,"Cache-Control":"private, no-store"});for(let k of X??[])L.append("Set-Cookie",k);if(A&&!d&&rt(o,r.routerContainer||"main")){let k=dt(o);L.set("X-STX-Fragment","true"),L.set("X-STX-Runtime",$e(o)?"true":"false"),L.set("X-STX-Layout",k.layout),L.set("X-STX-Layout-Group",k.group)}return U(S(A&&!d&&rt(o,r.routerContainer||"main")?je(o,r.routerContainer||"main",!0):o,R,{timeoutMs:30000}),{status:I??u.status??200,headers:L})}let w=new Headers({"Content-Type":"text/html",...V(),...N.cache?{}:{"Cache-Control":"private, no-store"}});for(let S of X??[])w.append("Set-Cookie",S);for(let[S,U]of Object.entries(D??{}))w.set(S,U);if(w.set("Vary",V(w.get("Vary")).Vary),A&&!d&&rt(o,r.routerContainer||"main")){let S=dt(o);return w.set("X-STX-Fragment","true"),w.set("X-STX-Runtime",$e(o)?"true":"false"),w.set("X-STX-Layout",S.layout),w.set("X-STX-Layout-Group",S.group),new Response(je(o,r.routerContainer||"main",!0),{status:I??u.status??200,headers:w})}return new Response(o,{status:I??u.status??200,headers:w})}catch(o){if(console.error(`[stx] Hydration error for ${c}:`,o),W)return new Response("Internal Server Error",{status:500});return new Response(u.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${E.port}`),console.log(`[stx] Serving ${r.routes.length} routes (${v.size} pre-loaded)`),{port:E.port,stop:()=>{f.invalidate(),E.stop()},invalidate:(n)=>f.invalidate(n)}}
|
|
3
|
-
export{
|
|
2
|
+
import{Ze,z,Jt}from"./chunk-41z7f41b.js";import{T}from"./chunk-0jdz31q1.js";import{Tt,je,U,st,Be,Da,Lo,La,Kn}from"./chunk-nzpb263k.js";import{Dt,Se,pt}from"./chunk-8ccgty8s.js";import{Qo}from"./chunk-2xnbdqy4.js";import{Gn}from"./chunk-nq60tjkz.js";import{Re}from"./chunk-kg7vby72.js";import Z from"fs";import P from"path";var{serve:ae}=globalThis.Bun;import O from"zlib";import{promisify as Y}from"util";var K=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],ee=["text/event-stream","multipart/x-mixed-replace"],te=1024;function ne(t){if(!t)return!1;let e=t.toLowerCase();if(ee.some((a)=>e.startsWith(a)))return!1;return K.some((a)=>e.startsWith(a))}function re(t){let e=new Map;for(let a of t.split(",")){let[r,...i]=a.trim().split(";"),f=r.trim().toLowerCase();if(!f)continue;let h=1;for(let g of i){let l=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(g);if(!l)continue;let m=Number.parseFloat(l[1]);if(Number.isFinite(m))h=m}e.set(f,h)}return e}function se(t){if(!t)return null;let e=re(t),a=e.get("*"),r=(i)=>e.get(i)??a??0;if(r("br")>0)return"br";if(r("gzip")>0)return"gzip";return null}var J=33554432,V=new Map,D=0;function oe(t,e){if(e.length>J/8)return;V.set(t,e),D+=e.length;for(let[a,r]of V){if(D<=J)break;V.delete(a),D-=r.length}}async function Vn(t,e,a={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!ne(e.headers.get("content-type")))return e;let r=se(t.headers.get("accept-encoding"));if(!r)return e;let i;try{i=new Uint8Array(await e.arrayBuffer())}catch{return e}let f=()=>new Response(i,{status:e.status,statusText:e.statusText,headers:Q(e.headers)});if(i.length<(a.threshold??te))return f();try{let h=a.quality??5,g=`${r}:${h}:${i.length}:${Bun.hash(i)}`,l=V.get(g);if(!l)l=r==="br"?await Y(O.brotliCompress)(i,{params:{[O.constants.BROTLI_PARAM_QUALITY]:h,[O.constants.BROTLI_PARAM_SIZE_HINT]:i.length}}):await Y(O.gzip)(i),oe(g,l);if(l.length>=i.length)return f();let m=Q(e.headers);return m.set("Content-Encoding",r),m.set("Content-Length",String(l.length)),new Response(l,{status:e.status,statusText:e.statusText,headers:m})}catch{return f()}}function Q(t){let e=new Headers(t),a=e.get("Vary");if(!a)return e.set("Vary","Accept-Encoding"),e;if(!a.split(",").some((i)=>i.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${a}, Accept-Encoding`);return e}class G{now;entries=new T(1000,{maxBytes:33554432,sizeOf:(t)=>t.body.byteLength+JSON.stringify(t.headers).length*2});pending=new Map;generation=0;constructor(t=Date.now){this.now=t}invalidate(t){this.generation++,this.pending.clear();for(let e of Array.from(this.entries.keys()))if(t===void 0||this.entries.get(e)?.path===t)this.entries.delete(e)}async respond(t,e,a){let r,i=async()=>{let s=r??await a();return s.headers.set("Cache-Control","private, no-store"),s.headers.set("Vary",U(s.headers.get("Vary")).Vary),s};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return i();let f=new URL(t.url),h=`${f.origin}${f.pathname}${f.search}|${je(t)?"fragment":"document"}`,g=this.entries.get(h),l=(s)=>{let b=new Headers(s.headers);return b.set("Cache-Control","private, no-store"),b.set("Age",String(Math.max(0,Math.floor((this.now()-s.created)/1000)))),new Response(s.body.slice(0),{headers:b})},m=g?(this.now()-g.created)/1000:1/0;if(g&&m<e.maxAge)return l(g);let v=this.generation,_=async()=>{let s=await a();r=s;let b=(s.headers.get("Vary")??"").toLowerCase().split(",").map((y)=>y.trim()).filter(Boolean);if(s.status!==200||s.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(s.headers.get("Cache-Control")??"")||b.some((y)=>y!=="x-stx-router"&&y!=="accept-encoding"))return null;let E=await s.clone().arrayBuffer();if(E.byteLength>1048576)return null;s.headers.set("Vary",U(s.headers.get("Vary")).Vary);let n={body:E,headers:Array.from(s.headers.entries()),created:this.now(),path:f.pathname};if(this.generation===v)this.entries.set(h,n);return n},x=this.pending.get(h);if(!x){if(this.pending.size>=1000)return i();x=_().finally(()=>{if(this.pending.get(h)===x)this.pending.delete(h)}),this.pending.set(h,x)}if(g&&m<e.maxAge+(e.swr??0))return x.catch(()=>{}),l(g);let M=await x;return M?l(M):i()}}var ie={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"};async function Cm(t={}){let e=P.resolve(t.outputDir||".output"),a=t.port??3000,r=Da(e);if(!r)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${r.routes.length} routes...`);let i=Gn(r.routeRules),f=new G,h=Qo(e,r.apiRoutes??[]),g=Bun.file(P.join(e,"server/runtime-config.json")),l=t.runtimeConfig??(await g.exists()?await g.json():void 0),m=l?z(l):void 0,v=new Map,_=new Map,x=new Map,M=new Map;for(let n of r.routes)try{let y=P.join(e,n.compiledPath),c=JSON.parse(await Bun.file(y).text());if(m)c.html=Jt(c.html,m);v.set(n.pattern,c),x.set(n.pattern,pt(c.html)),M.set(n.pattern,Re(c.html));let j=P.join(e,n.fragmentPath);if(st(c.html,r.routerContainer||"main")&&await Bun.file(j).exists()){let A=await Bun.file(j).text();_.set(n.pattern,m?Jt(A,m):A)}}catch(y){console.warn(`[stx] Failed to load route ${n.pattern}:`,y)}let s=new Map,b=[];for(let n of r.routes)if(n.hasParams){let{regex:y,params:c}=Se(n.pattern,{page:!0});b.push({regex:y,route:n,paramNames:c})}else s.set(n.pattern,n);let E=ae({port:a,async fetch(n){return Vn(n,await Ze(m??z(),async()=>{let c=new URL(n.url).pathname;if(t.onRequest){let p=await t.onRequest(n);if(p)return p}if(t.apiRouter){let p=await t.apiRouter.handleRequest(n);if(p.status!==404)return p}if(t.apiRoutes?.[c])return t.apiRoutes[c](n);let j=await h(n);if(j)return j;if((n.method==="GET"||n.method==="HEAD")&&c!=="/"){let p=P.resolve(e,"public"),d;try{d=decodeURIComponent(c)}catch{d=c}if(!d.includes("\x00")){let u=P.resolve(p,`.${d}`);if(u===p||u.startsWith(`${p}${P.sep}`))try{if(Z.existsSync(u)&&Z.statSync(u).isFile()){let R=P.extname(u).toLowerCase(),B=ie[R]||"application/octet-stream",X=c.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(c);return new Response(Bun.file(u),{headers:{"Content-Type":B,"Cache-Control":X?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let A=je(n),C=null,q={};if(C=s.get(c)||null,!C)for(let{regex:p,route:d,paramNames:u}of b){let o=c.match(p);if(o){C=d,u.forEach((R,B)=>{q[R]=o[B+1]});break}}if(!C){let p=Dt(c)?null:s.get("/404")||null;if(p){let d=v.get(p.pattern);if(d)return new Response(d.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}})}let N=i(c),W=Object.keys(N).length>0;return f.respond(n,N.cache,async()=>{let p=v.get(C.pattern);if(A&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let o=_.get(C.pattern);if(o){let R=x.get(C.pattern);return new Response(o,{status:p.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...M.has(C.pattern)?{"X-STX-Runtime":M.get(C.pattern)?"true":"false"}:{},...R?{"X-STX-Layout":R.layout,"X-STX-Layout-Group":R.group}:{},...U(),...N.cache?{}:{"Cache-Control":Tt}}})}}let d=Lo(n.method),u=v.get(C.pattern);if(!u){let o=s.get("/500")||null;if(o){let R=v.get(o.pattern);if(R)return new Response(R.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(C.prerendered&&d)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!d&&!u.hasServerScripts&&Object.keys(u.placeholders).length===0)return new Response(u.html,{status:u.status??200,headers:{"Content-Type":"text/html",...U(),"Cache-Control":"public, max-age=60"}});try{let{html:o,boundaries:R,redirect:B,cookies:X,status:H,headers:F}=await Kn(u,{params:q,request:n,method:n.method,__stx_strict_hydration:W,__stx_runtime_config:m});if(B)return La(B,X,F);if(R&&R.length>0){let{renderStreamingPage:S,streamToResponse:I}=await import("./chunk-hda7t8g6.js"),L=new Headers({...U(),...F,"Cache-Control":"private, no-store"});for(let k of X??[])L.append("Set-Cookie",k);if(A&&!d&&st(o,r.routerContainer||"main")){let k=pt(o);L.set("X-STX-Fragment","true"),L.set("X-STX-Runtime",Re(o)?"true":"false"),L.set("X-STX-Layout",k.layout),L.set("X-STX-Layout-Group",k.group)}return I(S(A&&!d&&st(o,r.routerContainer||"main")?Be(o,r.routerContainer||"main",!0):o,R,{timeoutMs:30000}),{status:H??u.status??200,headers:L})}let w=new Headers({"Content-Type":"text/html",...U(),...N.cache?{}:{"Cache-Control":"private, no-store"}});for(let S of X??[])w.append("Set-Cookie",S);for(let[S,I]of Object.entries(F??{}))w.set(S,I);if(w.set("Vary",U(w.get("Vary")).Vary),A&&!d&&st(o,r.routerContainer||"main")){let S=pt(o);return w.set("X-STX-Fragment","true"),w.set("X-STX-Runtime",Re(o)?"true":"false"),w.set("X-STX-Layout",S.layout),w.set("X-STX-Layout-Group",S.group),new Response(Be(o,r.routerContainer||"main",!0),{status:H??u.status??200,headers:w})}return new Response(o,{status:H??u.status??200,headers:w})}catch(o){if(console.error(`[stx] Hydration error for ${c}:`,o),W)return new Response("Internal Server Error",{status:500});return new Response(u.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${E.port}`),console.log(`[stx] Serving ${r.routes.length} routes (${v.size} pre-loaded)`),{port:E.port,stop:()=>{f.invalidate(),E.stop()},invalidate:(n)=>f.invalidate(n)}}
|
|
3
|
+
export{Vn,Cm};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
function c(i){if(!i.startsWith("/")||/[?#\\]/.test(i))throw Error(`Invalid route rule pattern: ${i}`);let t=i==="/"?[]:i.slice(1).split("/");if(t.some((r,e)=>!r||r.includes("*")&&r!=="*"&&r!=="**"||r==="**"&&e!==t.length-1||r.startsWith(":")&&!/^:[\w]+$/.test(r)))throw Error(`Unsupported route rule pattern: ${i}`);return t}function
|
|
3
|
-
export{
|
|
2
|
+
function c(i){if(!i.startsWith("/")||/[?#\\]/.test(i))throw Error(`Invalid route rule pattern: ${i}`);let t=i==="/"?[]:i.slice(1).split("/");if(t.some((r,e)=>!r||r.includes("*")&&r!=="*"&&r!=="**"||r==="**"&&e!==t.length-1||r.startsWith(":")&&!/^:[\w]+$/.test(r)))throw Error(`Unsupported route rule pattern: ${i}`);return t}function jo(i){for(let[t,r]of Object.entries(i)){if(c(t),!r||typeof r!=="object"||Object.keys(r).some((e)=>e!=="rendering"&&e!=="cache"))throw Error(`Unsupported route rule for ${t}`);if(r.rendering!==void 0&&r.rendering!=="prerender"&&r.rendering!=="dynamic")throw Error(`Unsupported rendering mode for ${t}`);if(r.cache!==void 0&&r.cache!==!1){let e=r.cache;if(!e||e.public!==!0||Object.keys(e).some((n)=>!["public","maxAge","swr"].includes(n))||!Number.isFinite(e.maxAge)||e.maxAge<=0||e.swr!==void 0&&(!Number.isFinite(e.swr)||e.swr<0))throw Error(`Route cache for ${t} requires public: true, maxAge > 0 and swr >= 0`);if(r.rendering==="prerender")throw Error(`Prerendered route ${t} cannot revalidate; use dynamic rendering with cache`)}}}function Gn(i={}){jo(i);let t=(e)=>e==="**"?0:e==="*"?1:e.startsWith(":")?2:3,r=Object.entries(i).map(([e,n])=>({pattern:e,parts:c(e),rule:n}));return r.sort((e,n)=>{for(let o=0;o<Math.max(e.parts.length,n.parts.length);o++){let s=(n.parts[o]===void 0?4:t(n.parts[o]))-(e.parts[o]===void 0?4:t(e.parts[o]));if(s)return s}return e.pattern.localeCompare(n.pattern)}),(e)=>{let n=e==="/"?[]:e.replace(/\/$/,"").slice(1).split("/");return r.find(({parts:o})=>o.every((s,u)=>s==="**"||n[u]!==void 0&&(s==="*"||s.startsWith(":")||s===n[u]))&&(o.at(-1)==="**"||o.length===n.length))?.rule??{}}}
|
|
3
|
+
export{jo,Gn};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
`}var et=["media","crossorigin","integrity"];function
|
|
4
|
-
`:""}import T from"path";var
|
|
2
|
+
import{Ln}from"./chunk-xmg6bmh6.js";import{B,Q,x,Kt,Gt,Br,y,Tl,Vi,Y,N}from"./chunk-eq86wzhr.js";import{gn}from"./chunk-1w0bqqh5.js";import{r}from"./chunk-vfcbz0an.js";import{ne}from"./chunk-a0aqs5a8.js";import{L,c}from"./chunk-hxws025y.js";var X=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function J(t){let s=[],e=/<!--[\s\S]*?(?:-->|$)|<(script|style|textarea|title|template)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,n;while((n=e.exec(t))!==null)s.push({start:n.index,end:n.index+n[0].length});return s}function I(t,s){return s.some((e)=>t>=e.start&&t<e.end)}function K(t){let s=(t||"").trim();if(!s)return null;if(/[\s>+~,:]/.test(s))return null;let e={},n=s,i=n.match(/^[a-z][\w-]*/i);if(i)e.tag=i[0].toLowerCase(),n=n.slice(i[0].length);while(n.length>0){let o=n.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(o){if(e.attr=o[1],o[3]!==void 0&&o[3]!=="")e.attrValue=o[3];n=n.slice(o[0].length);continue}let l=n.match(/^#([\w-]+)/);if(l){e.id=l[1],n=n.slice(l[0].length);continue}let a=n.match(/^\.([\w-]+)/);if(a){e.className=a[1],n=n.slice(a[0].length);continue}return null}if(!e.tag&&!e.attr&&!e.id&&!e.className)return null;return e}function Z(t,s){if(s.attr){if(!(s.attrValue===void 0?new RegExp(`\\b${s.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${s.attr}\\s*=\\s*(["'])\\s*${s.attrValue}\\s*\\1`,"i")).test(t))return!1}if(s.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${s.id}\\s*\\1`,"i").test(t))return!1}if(s.className){let e=t.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!e)return!1;if(!e[2].split(/\s+/).includes(s.className))return!1}return!0}function P(t,s="main"){let e=K(s);if(!e)return null;let n=/<([a-z][\w-]*)\b([^>]*)>/gi,i=J(t),o;while((o=n.exec(t))!==null){if(I(o.index,i))continue;let l=o[1].toLowerCase(),a=o[2]||"";if(a.trimEnd().endsWith("/")||X.has(l))continue;if(e.tag&&e.tag!==l)continue;if(!Z(a,e))continue;let u=o[0],g=o.index+u.length,f=new RegExp(`<(/?)${l}\\b([^>]*)>`,"gi");f.lastIndex=g;let d=1,h;while((h=f.exec(t))!==null){if(I(h.index,i))continue;let b=h[1]==="/";if(!b&&(h[2]||"").trimEnd().endsWith("/"))continue;if(d+=b?-1:1,d===0)return{openTag:u,openIndex:o.index,start:g,end:h.index,tagName:l}}return null}return null}var Tt="private, no-store";function cn(t){return t.replace(/&#(\d+);/g,(s,e)=>F(Number(e),s)).replace(/&#x([0-9a-f]+);/gi,(s,e)=>F(Number.parseInt(e,16),s)).replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/&/g,"&")}function F(t,s){if(!Number.isInteger(t)||t<0||t>1114111)return s;try{return String.fromCodePoint(t)}catch{return s}}function je(t){return t.headers.get("X-STX-Router")==="true"}function tt(t,s){if(!t)return s;return t.split(",").some((n)=>n.trim().toLowerCase()===s.toLowerCase())?t:`${t}, ${s}`}function U(t){return{Vary:tt(t,"X-STX-Router")}}function E(t){return t.replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function D(t){let s=/<head\b[^>]*>([\s\S]*?)<\/head\s*>/i.exec(t)?.[1]??"",e=/<(meta|link)\b(?:[^>"']|"[^"]*"|'[^']*')*>|<title\b[^>]*>[\s\S]*?<\/title\s*>/giy;return x(s,(n,i)=>(e.lastIndex=i,e.exec(n)?e.lastIndex:-1)).map(({token:n})=>n)}function H(t){let s=Object.create(null),e=t.replace(/^<\w+\b|>$/g,"");for(let n of e.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g)){let i=n[1].toLowerCase();if(!(i in s))s[i]=n[2]??n[3]??n[4]??""}return s}function Wn(t){let s=[];for(let e of D(t)){if(/^<title\b/i.test(e)){s.push(`<title>${E(e.replace(/^<title\b[^>]*>|<\/title\s*>$/gi,""))}</title>`);continue}let n=H(e);if(/^<meta\b/i.test(e)){let i=n.property?"property":"name",o=cn(n[i]??"").toLowerCase();if(o==="description"||/^(?:og|twitter):[\w:]+$/.test(o))s.push(`<meta ${i}="${r(o)}" content="${E(n.content??"")}">`)}else{let i=cn(n.rel??"").toLowerCase();if(i==="canonical"||i==="alternate"&&n.hreflang)s.push(`<link rel="${i}" href="${E(n.href??"")}"${i==="alternate"?` hreflang="${E(n.hreflang)}"`:""}>`)}}return`<template data-stx-page-head="1">${s.join("")}</template>
|
|
3
|
+
`}var et=["media","crossorigin","integrity"];function qn(t){let s=[];for(let e of D(t)){if(!/^<link\b/i.test(e))continue;let n=H(e);if(cn(n.rel??"").trim().toLowerCase()!=="stylesheet")continue;if(!n.href||"data-css"in n||"disabled"in n)continue;let i=et.filter((o)=>(o in n)).map((o)=>` ${o}="${E(n[o])}"`).join("");s.push(`<link rel="stylesheet" href="${E(n.href)}"${i}>`)}return s.length?`<template data-stx-page-css="1">${s.join("")}</template>
|
|
4
|
+
`:""}import T from"path";var nt="stx-page-head:",it=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,_={dev:null,prod:null};function ot(){let t=ne()?"dev":"prod",s=_[t];if(s!==null)return s;try{let e=import.meta.require("./chunk-xwrjre34.js"),n=t==="dev"&&typeof e.getRouterScriptDev==="function"?e.getRouterScriptDev:e.getRouterScript;_[t]=`<script>${n()}</script>`}catch{_[t]=""}return _[t]}async function Ia(t,s){if(s===!1)return null;if(s&&typeof s==="string"){let n=T.resolve(t,s);if(await Bun.file(n).exists())return n;return null}let e=T.join(t,"app.stx");if(await Bun.file(e).exists())return e;return null}async function Do(t,s){try{let e=await Bun.file(t).text(),n=e,i=B(e);if(i)n=i.content.trim();let o=gn(e),l=[...o.client.map((p)=>p.fullTag),...o.signals.map((p)=>p.fullTag)],a=[],u=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,g;while((g=u.exec(e))!==null)a.push(g[0]);let f=n;for(let p of o.server)f=f.replace(p.fullTag,"");for(let p of o.client)f=f.replace(p.fullTag,"");f=f.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let d="<!--__STX_PAGE_SLOT__-->";if(f=f.replace(/<slot\s*\/>/gi,d).replace(/<slot\s*>\s*<\/slot>/gi,d),!f.includes(d))return console.warn(`[stx] Shell ${t} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:h,extractVariables:b,defaultConfig:w,loadStxConfig:R}=await import("./chunk-amb7e0fp.js"),k=await R(),m={__filename:t,__dirname:T.dirname(t)};for(let p of l){let A=p.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(A&&!p.includes("client")&&!p.includes('type="module"'))await b(A[1],m,t)}let S=await h(f,m,t,{...w,...k,...s},new Set),C=S.indexOf(d);if(C===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:S.substring(0,C),afterSlot:S.substring(C+d.length),filePath:t,shellScripts:l,shellStyles:a}}catch(e){return console.error(`[stx] Error processing shell ${t}:`,e),null}}function ls(t,s,e){let n,i="",o=s.match(it);if(o){s=s.replace(o[0],"");try{let f=Buffer.from(o[1],"base64").toString("utf8"),d=f.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(d)n=d[1].trim();i=f.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let l=e||n||"stx App",a=ot(),u="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
|
|
5
5
|
<html lang="en">
|
|
6
6
|
<head>
|
|
7
7
|
<meta charset="UTF-8">
|
|
@@ -20,14 +20,14 @@ ${t.shellScripts.filter((f)=>!f.includes("server")).join(`
|
|
|
20
20
|
${u}
|
|
21
21
|
${a}
|
|
22
22
|
</body>
|
|
23
|
-
</html>`}function
|
|
23
|
+
</html>`}function rt(t,s={}){let e=t.trim();if(!Ln(e))return t;let n=[],i=e.match(/<head\b[^>]*>([\s\S]*?)<\/head>/i);if(i){let u=i[1],g=/<style\b[^>]*>[\s\S]*?<\/style>/gi,f;while((f=g.exec(u))!==null)n.push(f[0]);let d=u.match(/<script\b[^>]*data-stx-server-data[^>]*>[\s\S]*?<\/script>/i);if(d)n.push(d[0]);let h=u.match(/<script\b[^>]*data-stx-runtime-config[^>]*>[\s\S]*?<\/script>/i);if(h)n.push(h[0])}if(s.preserveHead&&i){let u=[],g=/<title\b[^>]*>[\s\S]*?<\/title>|<meta\b[^>]*>|<link\b[^>]*>/gi,f;while((f=g.exec(i[1]))!==null){if(/<meta\b[^>]*(?:\bcharset|name="viewport")/i.test(f[0]))continue;u.push(f[0])}if(u.length>0)n.unshift(`<!--${nt}${Buffer.from(u.join(`
|
|
24
24
|
`),"utf8").toString("base64")}-->`)}let o=e.match(/<body\b[^>]*>/i),l=c(e);if(o&&l!==-1){let u=o.index+o[0].length,g=e.slice(u,l).trim();if(n.length>0)return n.join(`
|
|
25
25
|
`)+`
|
|
26
26
|
`+g;return g}let a=e;if(a=a.replace(/<!DOCTYPE\b[^>]*>/i,""),a=a.replace(/<html\b[^>]*>/i,""),a=a.replace(/<\/html\s*>/i,""),i)a=a.replace(/<head\b[^>]*>[\s\S]*?<\/head>/i,n.join(`
|
|
27
|
-
`));return a=a.replace(/<body\b[^>]*>/i,""),a=a.replace(/<\/body\s*>/i,""),a.trim()}var
|
|
27
|
+
`));return a=a.replace(/<body\b[^>]*>/i,""),a=a.replace(/<\/body\s*>/i,""),a.trim()}var V=/^<script\b[^>]*\sdata-stx-(?:owner|instance)(?=[\s=/>])/i;function q(t,s,e,n){if(!V.test(s))return!1;let i=s.slice(0,s.indexOf(">")+1),o=/\sdata-stx-owner="([^"]+)"/i.exec(i)?.[1];if(!o)return!0;let l=`data-stx-scope="${o}"`;for(let a=t.indexOf(l);a!==-1;a=t.indexOf(l,a+l.length))if(a>=e&&a<n)return!1;return!0}function Oa(t){return je(t)}function at(t,s){let e=[],n=new Set;for(let i of x(t,Q)){if(i.start>=s.start&&i.start<s.end)continue;let o=i.token.match(/^<script\b((?:"[^"]*"|'[^']*'|[^'">])*)>/i)?.[1]??"",l=new Map;for(let g of o.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g))l.set(g[1].toLowerCase(),g[2]??g[3]??g[4]??"");let a=l.get("src")?.trim(),u=l.get("type")?.trim().toLowerCase();if(!a||l.has("server")||u&&!["module","text/javascript","application/javascript"].includes(u))continue;if(l.has("data-stx-runtime")||l.has("data-stx-router")||/^\/_stx\/(?:runtime|router)(?:\.[a-f0-9]{16})?\.js(?:[?#]|$)/i.test(a))continue;if(q(t,i.token,s.start,s.end)||n.has(i.token))continue;n.add(i.token),e.push(i.token)}return e}function st(t,s="main"){return!!P(t.trim(),s)}function Be(t,s="main",e=!1){let n=t.trim(),i=[],o=[],l=n.match(/<head\b[^>]*>([\s\S]*?)<\/head>/i);if(l){let S=l[1],C=/<style\b[^>]*>[\s\S]*?<\/style>/gi,p;while((p=C.exec(S))!==null)i.push(p[0]);let A=/<script\b[^>]*data-stx-(?:route-params|server-data|scoped|component-factories)[^>]*>[\s\S]*?<\/script>/gi;while((p=A.exec(S))!==null){if(V.test(p[0])||p[0].includes("__stx_early_mounts")||/^<script\b[^>]*\bdata-stx-runtime(?=[\s=>])/i.test(p[0]))continue;o.push(p[0])}}let a=P(n,s);if(!a)return(e?Wn(t)+qn(t):"")+rt(t);let u=at(n,a),g=new Set(u),{tagName:f,start:d,end:h}=a,b=n.slice(d,h).trim(),w=[],R=n.match(/<body\b[^>]*>/i),k=c(n);if(R&&R.index!==void 0&&k!==-1){let C=[[R.index+R[0].length,a.openIndex],[h+`</${f}>`.length,k]],p=/<script\b[^>]*>[\s\S]*?<\/script>/gi;for(let[A,j]of C){if(A>=j)continue;let W=n.slice(A,j),v;p.lastIndex=0;while((v=p.exec(W))!==null){if(q(n,v[0],d,h))continue;w.push(v[0])}}}let m=[];if(e)m.push(Wn(t)+qn(t));if(i.length>0)m.push(i.join(`
|
|
28
28
|
`));if(u.length>0)m.push(u.join(`
|
|
29
29
|
`));if(o.length>0)m.push(o.filter((S)=>!g.has(S)).join(`
|
|
30
|
-
`));if(
|
|
31
|
-
`));return m.push(
|
|
32
|
-
`)}import
|
|
33
|
-
export{
|
|
30
|
+
`));if(w.length>0)m.push(w.filter((S)=>!g.has(S)).join(`
|
|
31
|
+
`));return m.push(b),m.join(`
|
|
32
|
+
`)}import O from"fs";import z from"path";function Na(t,s,e){return{version:1,buildTime:new Date().toISOString(),routes:t,assets:s,outputDir:e}}function Ma(t,s){let e=z.join(s,"manifest.json");O.writeFileSync(e,JSON.stringify(t,null,2))}function Da(t){let s=z.join(t,"manifest.json");if(!O.existsSync(s))return null;try{let e=O.readFileSync(s,"utf-8"),n=JSON.parse(e);if(n.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${n.version}`),null;return n}catch(e){return console.warn("[stx] Failed to load manifest:",e),null}}function M(t,s,e={}){let n=`${encodeURIComponent(t)}=${encodeURIComponent(s)}`;if(e.maxAge!==void 0)n+=`; Max-Age=${e.maxAge}`;if(e.expires)n+=`; Expires=${e.expires.toUTCString()}`;if(e.path)n+=`; Path=${e.path}`;if(e.domain)n+=`; Domain=${e.domain}`;if(e.secure)n+="; Secure";if(e.httpOnly)n+="; HttpOnly";if(e.sameSite)n+=`; SameSite=${e.sameSite}`;return n}async function ct(t){let s=t.headers.get("content-type")||"",e={},n=(i,o)=>{let l=e[i];if(l===void 0)e[i]=o;else if(Array.isArray(l))l.push(o);else e[i]=[l,o]};if(s.includes("multipart/form-data")){let i=await t.formData();for(let[o,l]of i.entries())if(typeof l==="string")n(o,l);return e}if(s.includes("application/x-www-form-urlencoded")){for(let[i,o]of new URLSearchParams(await t.text()).entries())n(i,o);return e}return e}function Lo(t){if(!t)return!1;let s=t.toUpperCase();return s!=="GET"&&s!=="HEAD"}async function G(t,s={}){let e=s.request,n=s.method??e?.method;if(!e||!Lo(n))return{ran:!1};if(typeof t.action!=="function")return{ran:!1};let i={};try{i=await ct(e)}catch{}let o=await t.action({request:e,form:i,params:s.params??{},query:t.query??{},cookies:s.cookies??{}});if(o&&typeof o==="object"){let l=o,a=lt(l.cookies),u=l.redirect;if(typeof u==="string"&&u)return{redirect:u,ran:!0,...a.length>0?{cookies:a}:{}};let{cookies:g,redirect:f,...d}=l;if(Object.assign(t,d),a.length>0)return{ran:!0,cookies:a}}return{ran:!0}}function lt(t){if(!t||typeof t!=="object"||Array.isArray(t))return[];let s=[];for(let[e,n]of Object.entries(t)){if(!e)continue;if(typeof n==="string"){s.push(M(e,n));continue}if(n&&typeof n==="object"){let i=n;if(typeof i.value!=="string")continue;s.push(M(e,i.value,i))}}return s}function La(t,s=[],e){let n=new Headers({Location:t,"Cache-Control":"no-store"});for(let i of s)n.append("Set-Cookie",i);for(let[i,o]of Object.entries(e??{}))if(i.toLowerCase()!=="location")n.set(i,o);return new Response(null,{status:303,headers:n})}async function Kn(t,s={}){let{html:e,context:n,redirect:i,cookies:o}=await ut(t,s),l=Kt(n),a=Gt(n);if(i)return{html:e,redirect:i,cookies:o,status:l,headers:a};let{extractStreamBoundaries:u}=await import("./chunk-hda7t8g6.js"),g=u(n),f=t.streamTemplates;if(f&&Object.keys(f).length>0){let{processDirectives:d}=await import("./chunk-kpjq135z.js"),{defaultConfig:h}=await import("./chunk-0q0nbq50.js"),b=n.streamBoundaries||{},w={...h,autoShell:!1},R=Object.keys(f).map((m)=>({id:m,render:async()=>{let S=typeof b[m]==="function"?await b[m]():void 0;return d(f[m],{...n,$boundary:S},t.sourceFile,w,new Set)}})),k=new Set(R.map((m)=>m.id));g=[...(g||[]).filter((m)=>!k.has(m.id)),...R]}return{html:e,boundaries:g&&g.length>0?g:void 0,cookies:o,status:l,headers:a}}async function ut(t,s){let e={__filename:t.sourceFile,__dirname:t.sourceFile.replace(/[/\\][^/\\]+$/,""),...s};if(!t.hasServerScripts&&!Vi(t.html))return{html:t.html,context:e};for(let l of t.serverScriptContent)try{await y(l,e,t.sourceFile)}catch(a){if(s.__stx_strict_hydration)throw a;console.warn(`[stx] Server script error in ${t.sourceFile}:`,a)}let n=await G(e,{request:s.request,method:s.method,params:s.params??{},cookies:s.cookies??{}}),i=(l)=>{let a=l.replace(/<script\b[^>]*\bdata-stx-server-data\b[^>]*>[\s\S]*?<\/script>/gi,""),u=Br(e);if(!u)return a;let g=L(a);return g<0?u+a:a.slice(0,g)+u+a.slice(g)};if(n.redirect)return{html:t.html,context:e,redirect:n.redirect,cookies:n.cookies};if(!Vi(t.html))return{html:i(t.html),context:e,cookies:n.cookies};let o=new Map;for(let[l,a]of Object.entries(t.placeholders))if(a.expression)try{let u=N(a.expression,e);if(a.type==="raw")o.set(l,u!==void 0&&u!==null?String(u):"");else o.set(l,u!==void 0&&u!==null?Y(String(u)):"")}catch(u){if(s.__stx_strict_hydration)throw u;o.set(l,"")}return{html:i(Tl(t.html,o)),context:e,cookies:n.cookies}}
|
|
33
|
+
export{Tt,cn,je,U,Wn,qn,Ia,Do,ls,rt,Oa,st,Be,Na,Ma,Da,Lo,La,Kn};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{ys,bs}from"./chunk-whcrca58.js";import{x}from"./chunk-eq86wzhr.js";import{a}from"./chunk-yesh4dfe.js";import{ot,fe}from"./chunk-pvm48tse.js";import{vc}from"./chunk-1t15z230.js";import{W}from"./chunk-a7bqrjm5.js";import{w}from"./chunk-v6gkjg5f.js";import{f}from"./chunk-hxws025y.js";import{existsSync as z,mkdirSync as C,copyFileSync as I,chmodSync as B,rmSync as xe}from"fs";import{join as c,basename as ye,resolve as K}from"path";import{spawn as _}from"child_process";import{platform as Se}from"os";function O(e,r,i){let n=new RegExp(`</${r}\\s*>`,"iy"),s=x(e,(t,o)=>(n.lastIndex=o,n.exec(t)?n.lastIndex:-1))[0];return s?e.slice(0,s.start)+i+e.slice(s.start):null}var Hu=`
|
|
3
3
|
<script>
|
|
4
4
|
(function() {
|
|
5
5
|
'use strict';
|
|
@@ -468,9 +468,9 @@ else if (data.type === 'event' && data.method) {
|
|
|
468
468
|
}
|
|
469
469
|
})();
|
|
470
470
|
</script>
|
|
471
|
-
`;function
|
|
472
|
-
`);if(n!==null)return n;let s=
|
|
473
|
-
${i}`+e.slice(t)}return i+e}var
|
|
471
|
+
`;function qa(e={}){let{debug:r=!1,timeout:i=30000}=e;return Hu.replace("debug: false,",`debug: ${r},`).replace("timeout: 30000",`timeout: ${i}`)}function Xh(){return!1}function Jh(e,r={}){let i=/@craft(?:\(([\s\S]*?)\))?/g;return e.replace(i,(n,s)=>{let t={};if(s)try{t=JSON.parse(s.replace(/'/g,'"'))}catch{try{t=Function(`return ${s}`)()}catch{console.warn(`[stx] Invalid @craft config: ${s}`)}}return qa(t)})}function Ka(e,r={}){if(e.includes("__craftBridgeInitialized"))return e;let i=qa(r),n=O(e,"head",`${i}
|
|
472
|
+
`);if(n!==null)return n;let s=W(e);if(s){let t=s.index+s.tag.length;return e.slice(0,t)+`
|
|
473
|
+
${i}`+e.slice(t)}return i+e}var Uo={button:{nativeType:"craft-button",fallbackTag:"button",fallbackClasses:"craft-button",nativeProps:["variant","size","disabled","loading"]},"text-input":{nativeType:"craft-text-input",fallbackTag:"input",fallbackClasses:"craft-text-input",nativeProps:["placeholder","value","type","disabled","readonly"]},textarea:{nativeType:"craft-textarea",fallbackTag:"textarea",fallbackClasses:"craft-textarea",nativeProps:["placeholder","value","rows","disabled","readonly"]},checkbox:{nativeType:"craft-checkbox",fallbackTag:"input",fallbackClasses:"craft-checkbox",nativeProps:["checked","disabled","label"],render:(e,r)=>{let i=e.checked?"checked":"",n=e.disabled?"disabled":"";return`<label class="craft-checkbox-wrapper">
|
|
474
474
|
<input type="checkbox" class="craft-checkbox" ${i} ${n}>
|
|
475
475
|
<span class="craft-checkbox-label">${r||e.label||""}</span>
|
|
476
476
|
</label>`}},radio:{nativeType:"craft-radio",fallbackTag:"input",fallbackClasses:"craft-radio",nativeProps:["checked","disabled","name","value","label"]},select:{nativeType:"craft-select",fallbackTag:"select",fallbackClasses:"craft-select",nativeProps:["value","disabled","options","placeholder"]},slider:{nativeType:"craft-slider",fallbackTag:"input",fallbackClasses:"craft-slider",nativeProps:["value","min","max","step","disabled"],render:(e,r)=>{let i=e.min??0,n=e.max??100,s=e.step??1,t=e.value??50,o=e.disabled?"disabled":"";return`<input type="range" class="craft-slider" min="${i}" max="${n}" step="${s}" value="${t}" ${o}>`}},label:{nativeType:"craft-label",fallbackTag:"span",fallbackClasses:"craft-label",nativeProps:["text","for"]},badge:{nativeType:"craft-badge",fallbackTag:"span",fallbackClasses:"craft-badge",nativeProps:["variant","size"]},avatar:{nativeType:"craft-avatar",fallbackTag:"div",fallbackClasses:"craft-avatar",nativeProps:["src","alt","size","fallback"],render:(e,r)=>{let i=e.size||40,n=e.src,s=String(e.alt||""),t=e.fallback||(s?s.charAt(0).toUpperCase():"?");if(n)return`<img class="craft-avatar" src="${n}" alt="${s}" style="width:${i}px;height:${i}px;border-radius:50%">`;return`<div class="craft-avatar craft-avatar-fallback" style="width:${i}px;height:${i}px;border-radius:50%;display:flex;align-items:center;justify-content:center">${t}</div>`}},progress:{nativeType:"craft-progress",fallbackTag:"div",fallbackClasses:"craft-progress",nativeProps:["value","max","variant"],render:(e,r)=>{let i=Number(e.value)||0,n=Number(e.max)||100;return`<div class="craft-progress"><div class="craft-progress-bar" style="width:${Math.min(100,Math.max(0,i/n*100))}%"></div></div>`}},spinner:{nativeType:"craft-spinner",fallbackTag:"div",fallbackClasses:"craft-spinner",nativeProps:["size"],render:(e,r)=>{let i=e.size||24;return`<div class="craft-spinner" style="width:${i}px;height:${i}px"></div>`}},card:{nativeType:"craft-card",fallbackTag:"div",fallbackClasses:"craft-card",nativeProps:["title","subtitle","variant"]},modal:{nativeType:"craft-modal",fallbackTag:"dialog",fallbackClasses:"craft-modal",nativeProps:["open","title","closable","size"],render:(e,r)=>{let i=e.open?"open":"",n=e.title||"";return`<dialog class="craft-modal" ${i}>
|
|
@@ -484,7 +484,7 @@ ${i}`+e.slice(t)}return i+e}var zo={button:{nativeType:"craft-button",fallbackTa
|
|
|
484
484
|
</details>`}},divider:{nativeType:"craft-divider",fallbackTag:"hr",fallbackClasses:"craft-divider",nativeProps:["orientation","variant"]},table:{nativeType:"craft-table",fallbackTag:"table",fallbackClasses:"craft-table",nativeProps:["columns","rows","sortable","selectable"]},list:{nativeType:"craft-list",fallbackTag:"ul",fallbackClasses:"craft-list",nativeProps:["items","selectable"]},tree:{nativeType:"craft-tree",fallbackTag:"div",fallbackClasses:"craft-tree",nativeProps:["nodes","expandable","selectable"]},alert:{nativeType:"craft-alert",fallbackTag:"div",fallbackClasses:"craft-alert",nativeProps:["variant","title","dismissible"],render:(e,r)=>{let i=e.variant||"info",n=e.title||"";return`<div class="craft-alert craft-alert-${i}" role="alert">
|
|
485
485
|
${n?`<div class="craft-alert-title">${n}</div>`:""}
|
|
486
486
|
<div class="craft-alert-content">${r}</div>
|
|
487
|
-
</div>`}},toast:{nativeType:"craft-toast",fallbackTag:"div",fallbackClasses:"craft-toast",nativeProps:["variant","duration","position"]},tooltip:{nativeType:"craft-tooltip",fallbackTag:"span",fallbackClasses:"craft-tooltip",nativeProps:["content","position"],render:(e,r)=>{let i=e.content||"",n=e.position||"top";return`<span class="craft-tooltip" data-tooltip="${i}" data-position="${n}">${r}</span>`}},menu:{nativeType:"craft-menu",fallbackTag:"nav",fallbackClasses:"craft-menu",nativeProps:["items","orientation"]},breadcrumb:{nativeType:"craft-breadcrumb",fallbackTag:"nav",fallbackClasses:"craft-breadcrumb",nativeProps:["items","separator"]},sidebar:{nativeType:"craft-sidebar",fallbackTag:"aside",fallbackClasses:"craft-sidebar craft-sidebar-tahoe",nativeProps:["id","variant","material","backgroundEffect","allowsVibrancy","materialOpacity","materialDarkOpacity","minWidth","maxWidth","canCollapse","searchPlaceholder","selectedItem","sections","spaces","selectedSpace"],render:re},"sidebar-space":{nativeType:"craft-sidebar-space",fallbackTag:"section",fallbackClasses:"craft-sidebar-space",nativeProps:["id","label","icon","tint"],render:ae},"sidebar-section":{nativeType:"craft-sidebar-section",fallbackTag:"section",fallbackClasses:"craft-sidebar-section",nativeProps:["id","title","header"],render:ie},"sidebar-item":{nativeType:"craft-sidebar-item",fallbackTag:"button",fallbackClasses:"craft-sidebar-item",nativeProps:["id","label","icon","badge","tintColor"],render:ne},pagination:{nativeType:"craft-pagination",fallbackTag:"nav",fallbackClasses:"craft-pagination",nativeProps:["total","page","pageSize"]},"code-editor":{nativeType:"craft-code-editor",fallbackTag:"textarea",fallbackClasses:"craft-code-editor",nativeProps:["value","language","theme","readonly","lineNumbers"]},"file-browser":{nativeType:"craft-file-browser",fallbackTag:"div",fallbackClasses:"craft-file-browser",nativeProps:["path","showHidden","selectable"]},"color-picker":{nativeType:"craft-color-picker",fallbackTag:"input",fallbackClasses:"craft-color-picker",nativeProps:["value","format"],render:(e,r)=>`<input type="color" class="craft-color-picker" value="${e.value||"#000000"}">`},"date-picker":{nativeType:"craft-date-picker",fallbackTag:"input",fallbackClasses:"craft-date-picker",nativeProps:["value","min","max","format"],render:(e,r)=>{let i=e.value||"",n=e.min||"",s=e.max||"";return`<input type="date" class="craft-date-picker" value="${i}" min="${n}" max="${s}">`}},"time-picker":{nativeType:"craft-time-picker",fallbackTag:"input",fallbackClasses:"craft-time-picker",nativeProps:["value","min","max","step"],render:(e,r)=>`<input type="time" class="craft-time-picker" value="${e.value||""}">`}},
|
|
487
|
+
</div>`}},toast:{nativeType:"craft-toast",fallbackTag:"div",fallbackClasses:"craft-toast",nativeProps:["variant","duration","position"]},tooltip:{nativeType:"craft-tooltip",fallbackTag:"span",fallbackClasses:"craft-tooltip",nativeProps:["content","position"],render:(e,r)=>{let i=e.content||"",n=e.position||"top";return`<span class="craft-tooltip" data-tooltip="${i}" data-position="${n}">${r}</span>`}},menu:{nativeType:"craft-menu",fallbackTag:"nav",fallbackClasses:"craft-menu",nativeProps:["items","orientation"]},breadcrumb:{nativeType:"craft-breadcrumb",fallbackTag:"nav",fallbackClasses:"craft-breadcrumb",nativeProps:["items","separator"]},sidebar:{nativeType:"craft-sidebar",fallbackTag:"aside",fallbackClasses:"craft-sidebar craft-sidebar-tahoe",nativeProps:["id","variant","material","backgroundEffect","allowsVibrancy","materialOpacity","materialDarkOpacity","minWidth","maxWidth","canCollapse","searchPlaceholder","selectedItem","sections","spaces","selectedSpace"],render:re},"sidebar-space":{nativeType:"craft-sidebar-space",fallbackTag:"section",fallbackClasses:"craft-sidebar-space",nativeProps:["id","label","icon","tint"],render:ae},"sidebar-section":{nativeType:"craft-sidebar-section",fallbackTag:"section",fallbackClasses:"craft-sidebar-section",nativeProps:["id","title","header"],render:ie},"sidebar-item":{nativeType:"craft-sidebar-item",fallbackTag:"button",fallbackClasses:"craft-sidebar-item",nativeProps:["id","label","icon","badge","tintColor"],render:ne},pagination:{nativeType:"craft-pagination",fallbackTag:"nav",fallbackClasses:"craft-pagination",nativeProps:["total","page","pageSize"]},"code-editor":{nativeType:"craft-code-editor",fallbackTag:"textarea",fallbackClasses:"craft-code-editor",nativeProps:["value","language","theme","readonly","lineNumbers"]},"file-browser":{nativeType:"craft-file-browser",fallbackTag:"div",fallbackClasses:"craft-file-browser",nativeProps:["path","showHidden","selectable"]},"color-picker":{nativeType:"craft-color-picker",fallbackTag:"input",fallbackClasses:"craft-color-picker",nativeProps:["value","format"],render:(e,r)=>`<input type="color" class="craft-color-picker" value="${e.value||"#000000"}">`},"date-picker":{nativeType:"craft-date-picker",fallbackTag:"input",fallbackClasses:"craft-date-picker",nativeProps:["value","min","max","format"],render:(e,r)=>{let i=e.value||"",n=e.min||"",s=e.max||"";return`<input type="date" class="craft-date-picker" value="${i}" min="${n}" max="${s}">`}},"time-picker":{nativeType:"craft-time-picker",fallbackTag:"input",fallbackClasses:"craft-time-picker",nativeProps:["value","min","max","step"],render:(e,r)=>`<input type="time" class="craft-time-picker" value="${e.value||""}">`}},hs=`
|
|
488
488
|
<style id="craft-component-styles">
|
|
489
489
|
/* Craft Component Base Styles */
|
|
490
490
|
.craft-button {
|
|
@@ -902,7 +902,7 @@ ${i}`+e.slice(t)}return i+e}var zo={button:{nativeType:"craft-button",fallbackTa
|
|
|
902
902
|
}
|
|
903
903
|
}
|
|
904
904
|
</style>
|
|
905
|
-
`,
|
|
905
|
+
`,Ga=`
|
|
906
906
|
<script id="craft-component-runtime">
|
|
907
907
|
(function() {
|
|
908
908
|
if (window.__stxCraftComponentRuntime) return;
|
|
@@ -1006,11 +1006,11 @@ ${i}`+e.slice(t)}return i+e}var zo={button:{nativeType:"craft-button",fallbackTa
|
|
|
1006
1006
|
document.addEventListener('craft:nativeui:ready', initializeCraftComponents);
|
|
1007
1007
|
})();
|
|
1008
1008
|
</script>
|
|
1009
|
-
`;function
|
|
1010
|
-
`)??
|
|
1011
|
-
`)??e+
|
|
1009
|
+
`;function Xa(e,r={}){let{classPrefix:i="craft"}=r;if(!e.includes("craft-component-styles"))e=O(e,"head",`${hs}
|
|
1010
|
+
`)??hs+e;if(!e.includes("craft-component-runtime"))e=O(e,"body",`${Ga}
|
|
1011
|
+
`)??e+Ga;return e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(n,s,t)=>N("sidebar",s,t.trim(),r,i)),e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(n,s)=>N("sidebar",s,"",r,i)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(n,s,t)=>N(s,t,"",r,i)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(n,s,t,o)=>N(s,t,o.trim(),r,i)),e}function N(e,r,i,n,s){let t=n.components?.[e]||Uo[e];if(!t)return console.warn(`[stx] Unknown Craft component: @craft-${e}`),`<div class="${s}-unknown" data-component="${e}">${i}</div>`;let o=F(r),d=[t.fallbackClasses||`${s}-${e}`];if(o.class)d.push(o.class),delete o.class;if(t.render)return o.__fallbackClasses=d.join(" "),t.render(o,i);let p=be(o,t,d);if(["input","hr","br","img"].includes(t.fallbackTag))return`<${t.fallbackTag} ${p}>`;return`<${t.fallbackTag} ${p}>${i}</${t.fallbackTag}>`}function F(e){let r={},i=/(?::|@)?(\w+[-\w]*)(?:=(?:"([^"]*)"|'([^']*)'))?/g,n;while((n=i.exec(e))!==null){let[s,t,o,d]=n,p=o??d;if(s.startsWith(":"))r[t]=p;else if(s.startsWith("@"))r[`on${t.charAt(0).toUpperCase()}${t.slice(1)}`]=p;else if(p===void 0)r[t]=!0;else r[t]=p}return r}function re(e,r){let i=R(String(e.id||`craft-sidebar-${pe(r||JSON.stringify(e))}`)),n=ce(e.spaces)||oe(r),s=n.length?[]:le(e.sections)||j(r),t=String(e.selectedSpace||n[0]?.id||""),o=n.find((y)=>y.id===t)||n[0],d=String(e.selectedItem||e.selected||(n.length?o?.sections[0]?.items[0]?.id:s[0]?.items[0]?.id)||""),p={id:i,variant:String(e.variant||"desktop"),material:String(e.material||"sidebar"),backgroundEffect:String(e.backgroundEffect||"shimmer"),allowsVibrancy:e.allowsVibrancy!==!1&&e.allowsVibrancy!=="false",materialOpacity:Number(e.materialOpacity??0.68),materialDarkOpacity:e.materialDarkOpacity===void 0?void 0:Number(e.materialDarkOpacity),minWidth:e.minWidth===void 0?240:Number(e.minWidth),maxWidth:e.maxWidth===void 0?340:Number(e.maxWidth),canCollapse:e.canCollapse!==!1&&e.canCollapse!=="false",searchPlaceholder:e.searchPlaceholder?String(e.searchPlaceholder):void 0,selectedItem:d,sections:s,spaces:n,selectedSpace:t||void 0},u=String(e.__fallbackClasses||"craft-sidebar craft-sidebar-tahoe"),l=Number(e.width||e.sidebarWidth||286),b=e.native===!1||e.native==="false"?"false":"true",g=p.searchPlaceholder?`<div class="craft-sidebar-search"><input type="search" placeholder="${P(p.searchPlaceholder)}"></div>`:"",m;if(n.length)m=de(n,t,d);else if(s.length)m=s.map((y)=>L(y,d)).join("");else m=r;return`<aside class="${S(u)}" data-craft="craft-sidebar" data-craft-native-sidebar data-craft-sidebar-id="${S(i)}" data-native="${b}" style="--craft-sidebar-width:${l}px">
|
|
1012
|
+
${g}
|
|
1012
1013
|
${m}
|
|
1013
|
-
${h}
|
|
1014
1014
|
</aside>
|
|
1015
1015
|
<script type="application/json" data-craft-sidebar-config="${S(i)}">${ue(p)}</script>`}function ae(e,r){let i=R(String(e.id||e.label||"space"));return`<section class="craft-sidebar-space" data-craft="craft-sidebar-space" data-space-id="${S(i)}">
|
|
1016
1016
|
${e.label?`<div class="craft-sidebar-space-title">${P(String(e.label))}</div>`:""}
|
|
@@ -1018,19 +1018,19 @@ ${i}`+e.slice(t)}return i+e}var zo={button:{nativeType:"craft-button",fallbackTa
|
|
|
1018
1018
|
</section>`}function ie(e,r){let i=String(e.header||e.title||"");return`<section class="craft-sidebar-section" data-craft="craft-sidebar-section" data-section-id="${S(String(e.id||"section"))}">
|
|
1019
1019
|
${i?`<div class="craft-sidebar-section-title">${P(i)}</div>`:""}
|
|
1020
1020
|
${r}
|
|
1021
|
-
</section>`}function ne(e,r){let i={id:String(e.id||R(String(e.label||r||"item"))),label:String(e.label||r||""),icon:e.icon?String(e.icon):void 0,badge:e.badge?String(e.badge):void 0,tintColor:e.tintColor?String(e.tintColor):void 0};return
|
|
1021
|
+
</section>`}function ne(e,r){let i={id:String(e.id||R(String(e.label||r||"item"))),label:String(e.label||r||""),icon:e.icon?String(e.icon):void 0,badge:e.badge?String(e.badge):void 0,tintColor:e.tintColor?String(e.tintColor):void 0};return H(i,String(e.selected||"")==="true")}function j(e){let r=[],i=/<@craft-sidebar-section\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-section>)/g,n;while((n=i.exec(e))!==null){let s=F(n[1]||""),t=n[2]||"",o=String(s.id||R(String(s.header||s.title||`section-${r.length+1}`))),d=String(s.header||s.title||o),p=se(t);r.push({id:o,header:d,title:d,items:p})}return r}function se(e){let r=[],i=/<@craft-sidebar-item\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-item>)/g,n;while((n=i.exec(e))!==null){let s=F(n[1]||""),t=String(s.label||(n[2]||"").replace(/<[^>]*>/g,"").trim()),o=String(s.id||R(t||`item-${r.length+1}`));r.push({id:o,label:t,icon:s.icon?String(s.icon):void 0,badge:s.badge?String(s.badge):void 0,tintColor:s.tintColor?String(s.tintColor):void 0})}return r}function oe(e){let r=[],i=/<@craft-sidebar-space\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-space>)/g,n;while((n=i.exec(e))!==null){let s=F(n[1]||""),t=n[2]||"",o=String(s.label||s.title||`Space ${r.length+1}`);r.push({id:String(s.id||R(o)),label:o,icon:s.icon?String(s.icon):void 0,tint:s.tint?String(s.tint):void 0,sections:j(t)})}return r}function ce(e){if(!e)return;if(Array.isArray(e))return e;if(typeof e!=="string")return;try{let r=JSON.parse(e);return Array.isArray(r)?r:void 0}catch{return}}function de(e,r,i){let n=e.map((t)=>`<button class="craft-sidebar-space-tab" type="button" data-space-target="${S(t.id)}" data-selected="${t.id===r?"true":"false"}" title="${S(t.label||t.id)}">${t.icon?`<span class="craft-sidebar-item-icon" data-icon="${S(t.icon)}"></span>`:P((t.label||t.id).charAt(0))}</button>`).join("");return`<div class="craft-sidebar-spaces">${e.map((t)=>`<section class="craft-sidebar-space" data-space-id="${S(t.id)}" data-selected="${t.id===r?"true":"false"}">
|
|
1022
1022
|
${t.label?`<div class="craft-sidebar-space-title">${P(t.label)}</div>`:""}
|
|
1023
|
-
${t.sections.map((o)=>
|
|
1023
|
+
${t.sections.map((o)=>L(o,i)).join("")}
|
|
1024
1024
|
</section>`).join("")}</div>
|
|
1025
|
-
<div class="craft-sidebar-space-switcher">${n}</div>`}function le(e){if(!e)return;if(Array.isArray(e))return e;if(typeof e!=="string")return;try{let r=JSON.parse(e);return Array.isArray(r)?r:void 0}catch{return}}function
|
|
1025
|
+
<div class="craft-sidebar-space-switcher">${n}</div>`}function le(e){if(!e)return;if(Array.isArray(e))return e;if(typeof e!=="string")return;try{let r=JSON.parse(e);return Array.isArray(r)?r:void 0}catch{return}}function L(e,r){let i=e.header||e.title||e.id;return`<section class="craft-sidebar-section" data-section-id="${S(e.id)}">
|
|
1026
1026
|
<div class="craft-sidebar-section-title">${P(i)}</div>
|
|
1027
|
-
${e.items.map((n)=>
|
|
1028
|
-
</section>`}function
|
|
1027
|
+
${e.items.map((n)=>H(n,n.id===r)).join("")}
|
|
1028
|
+
</section>`}function H(e,r){let i=e.tintColor?` style="--craft-sidebar-icon-color:${S(e.tintColor)}"`:"";return`<button class="craft-sidebar-item" type="button" data-item-id="${S(e.id)}" data-selected="${r?"true":"false"}">
|
|
1029
1029
|
${e.icon?`<span class="craft-sidebar-item-icon" data-icon="${S(e.icon)}"${i}></span>`:""}
|
|
1030
1030
|
<span class="craft-sidebar-item-label">${P(e.label)}</span>
|
|
1031
1031
|
${e.badge?`<span class="craft-sidebar-item-badge">${P(e.badge)}</span>`:""}
|
|
1032
|
-
</button>`}function R(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function
|
|
1033
|
-
${i(
|
|
1032
|
+
</button>`}function R(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function pe(e){let r=5381;for(let i=0;i<e.length;i++)r=r*33^e.charCodeAt(i);return(r>>>0).toString(36)}function P(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function S(e){return P(e).replace(/`/g,"`")}function ue(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function be(e,r,i){let n=[];n.push(`class="${i.join(" ")}"`),n.push(`data-craft="${r.nativeType}"`);for(let[s,t]of Object.entries(e))if(t===!0)n.push(s);else if(t!==!1&&t!==void 0&&t!==null){let o=String(t).replace(/"/g,""");n.push(`${s}="${o}"`)}return n.join(" ")}function Yh(e,r){Uo[e]=r}function Zh(){return{...Uo}}import{chmodSync as ge,copyFileSync as me,mkdtempSync as V,rmSync as we,writeFileSync as J}from"fs";import{tmpdir as Q}from"os";import{join as D}from"path";function he(e){let r=Bun.spawnSync(["/usr/bin/plutil","-extract","Entitlements","xml1","-o","-","-"],{stdin:e});if(r.exitCode!==0)throw Error(`Could not extract the macOS profile entitlements: ${r.stderr.toString().trim()||r.stdout.toString().trim()}`);let i=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-","-"],{stdin:r.stdout});if(i.exitCode!==0)throw Error(`Could not convert the macOS profile entitlements: ${i.stderr.toString().trim()||i.stdout.toString().trim()}`);let n=JSON.parse(i.stdout.toString());if(!n||typeof n!=="object"||Array.isArray(n))throw Error("The macOS profile entitlements must be a dictionary.");return n}function ve(e,r){let i=D(r,"Contents","embedded.provisionprofile");me(e,i),ge(i,420)}async function Y(e,r=[],i={}){if(process.platform!=="darwin")return;let n=i.entitlements,s;try{if(i.provisioningProfile){if(!i.identity||i.identity==="-")throw Error("A provisioning profile requires a signing identity.");let u=Bun.spawnSync(["/usr/bin/security","cms","-D","-i",i.provisioningProfile]);if(u.exitCode!==0)throw Error("Could not decode the macOS provisioning profile.");let l=he(u.stdout),b={};if(i.entitlements){let g=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-",i.entitlements]);if(g.exitCode!==0)throw Error("Could not read the app entitlements plist.");b=JSON.parse(g.stdout.toString())}for(let g of["com.apple.application-identifier","com.apple.developer.team-identifier"])if(l[g])b[g]=l[g];if(s=V(D(Q(),"stx-entitlements-")),n=D(s,"entitlements.plist"),J(n,JSON.stringify(b)),Bun.spawnSync(["/usr/bin/plutil","-convert","xml1",n]).exitCode!==0)throw Error("Could not generate the provisioned app entitlements.");ve(i.provisioningProfile,e)}let t;if(r.length){let u=!1;if(n){let l=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-",n]);if(l.exitCode!==0)throw Error("Could not read native parent entitlements.");u=JSON.parse(l.stdout.toString())["com.apple.security.app-sandbox"]===!0}if(s??=V(D(Q(),"stx-entitlements-")),t=D(s,"helper.entitlements.plist"),J(t,JSON.stringify({"com.apple.security.cs.allow-jit":!0,...u?{"com.apple.security.app-sandbox":!0,"com.apple.security.inherit":!0}:{}})),Bun.spawnSync(["/usr/bin/plutil","-convert","xml1",t]).exitCode!==0)throw Error("Could not generate native helper entitlements.")}for(let u of[...r,e]){let l=i.hardenedRuntime?["--options","runtime"]:[];if(u===e&&n)l.push("--entitlements",n);if(u!==e&&t)l.push("--entitlements",t);let b=i.identity&&i.identity!=="-"?"--timestamp":"--timestamp=none",g=Bun.spawn(["/usr/bin/codesign","--force","--sign",i.identity||"-",b,...l,u],{stdout:"pipe",stderr:"pipe"}),[m,y]=await Promise.all([new Response(g.stderr).text(),g.exited]);if(y!==0)throw Error(`Could not sign native bundle ${u}: ${m.trim()}`)}let o=Bun.spawn(["/usr/bin/codesign","--verify","--strict",e],{stdout:"pipe",stderr:"pipe"}),[d,p]=await Promise.all([new Response(o.stderr).text(),o.exited]);if(p!==0)throw Error(`Invalid native bundle signature: ${d.trim()}`)}finally{if(s)we(s,{recursive:!0,force:!0})}}var G=(e)=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");function X(e){let r=new Set,i=(n,s,t)=>{if(typeof n==="string")return`${s}<string>${G(n)}</string>`;if(typeof n==="boolean")return`${s}<${n}/>`;if(typeof n==="number"){if(!Number.isFinite(n))throw TypeError(`Non-finite Info.plist number at ${t}`);let o=Number.isSafeInteger(n)?"integer":"real";return`${s}<${o}>${n}</${o}>`}if(n!==null&&typeof n==="object"){let o=Array.isArray(n);if(!o&&Object.getPrototypeOf(n)!==Object.prototype&&Object.getPrototypeOf(n)!==null)throw TypeError(`Unsupported Info.plist value at ${t}`);if(r.has(n))throw TypeError(`Cyclic Info.plist value at ${t}`);r.add(n);try{let d=o?"array":"dict",p=`${s} `,u=o?Array.from(n,(l,b)=>i(l,p,`${t}[${b}]`)):Object.entries(n).map(([l,b])=>`${p}<key>${G(l)}</key>
|
|
1033
|
+
${i(b,p,`${t}.${l}`)}`);return u.length?`${s}<${d}>
|
|
1034
1034
|
${u.join(`
|
|
1035
1035
|
`)}
|
|
1036
1036
|
${s}</${d}>`:`${s}<${d}/>`}finally{r.delete(n)}}throw TypeError(`Unsupported Info.plist value at ${t}`)};if(!e||Array.isArray(e)||typeof e!=="object")throw TypeError("Info.plist root must be a dictionary");return`<?xml version="1.0" encoding="UTF-8"?>
|
|
@@ -1038,20 +1038,20 @@ ${s}</${d}>`:`${s}<${d}/>`}finally{r.delete(n)}}throw TypeError(`Unsupported Inf
|
|
|
1038
1038
|
<plist version="1.0">
|
|
1039
1039
|
${i(e,"","infoPlist")}
|
|
1040
1040
|
</plist>
|
|
1041
|
-
`}async function
|
|
1041
|
+
`}async function Ja(e){if(e.window?.cornerRadius!==void 0&&(!Number.isFinite(e.window.cornerRadius)||e.window.cornerRadius<0||e.window.cornerRadius>128))throw Error("Native window cornerRadius must be between 0 and 128");let r=Date.now();try{if(!await Bun.file(e.input).exists())return{success:!1,target:e.target||q(),format:e.format||"app",error:`Input file not found: ${e.input}`};let i=e.target||q(),n=e.format||Re(i);if(e.backend&&i!=="macos")throw Error("Native backend bundles currently support macOS only.");if(e.backend&&!z(K(e.backend.entry)))throw Error(`Native backend not found: ${e.backend.entry}`);let s=e.output||c(process.cwd(),"dist","native");if(!z(s))C(s,{recursive:!0});let t=await a(process.cwd()),o=await vc(e.input,{context:e.context,options:{...t,isDev:!1},injectCSS:!0});if(o=Ka(o,{debug:e.verbose}),o=Xa(o),!o.includes("craft-component-styles")){if(o.includes("</head>"))o=f(o,hs)}let d=e.name||ye(e.input,".stx"),p=e.version||"1.0.0",u=e.craftPath||Ya(e.runtimeProfile);if(!u)return{success:!1,target:i,format:n,error:"Craft native binary not found on PATH. Run pantry install craft, or specify craftPath for framework development."};if(e.runtimeProfile==="webview"){if(i!=="macos")throw Error("The webview runtime profile is currently available on macOS only.");let b=Bun.spawnSync([u,"--runtime-profile"],{stdout:"pipe",stderr:"pipe",timeout:1e4});if(b.exitCode!==0||b.stdout.toString().trim()!=="webview")throw Error("The requested Craft webview runtime is unavailable. Upgrade Craft with Pantry before building.")}if(u=ys(e.craftPath,e.runtimeProfile),e.verbose)console.log(`\uD83D\uDCE6 Building native app for ${i}...`),console.log(` Input: ${e.input}`),console.log(` Output: ${s}`),console.log(` Craft: ${u}`);let l;switch(i){case"macos":l=await Ce(o,d,p,s,n,e,u);break;case"windows":l=await Te(o,d,p,s,n,e,u);break;case"linux":l=await Pe(o,d,p,s,n,e,u);break;case"ios":l=await Ie(o,d,p,s,e,u);break;case"android":l=await Be(o,d,p,s,e,u);break;default:l={success:!1,target:i,format:n,error:`Unsupported target: ${i}`}}return l.duration=Date.now()-r,l}catch(i){return{success:!1,target:e.target||q(),format:e.format||"app",error:i.message,duration:Date.now()-r}}}async function Ce(e,r,i,n,s,t,o){let d=t.bundleId||`com.stx.${r.toLowerCase().replace(/[^a-z0-9]/g,"")}`,p=c(n,`${r}.app`),u=c(p,"Contents"),l=c(u,"MacOS"),b=c(u,"Resources");xe(p,{recursive:!0,force:!0}),C(l,{recursive:!0}),C(b,{recursive:!0});let g=c(b,"index.html");await Bun.write(g,e);let m="";if(t.sidebar?.enabled&&t.sidebar?.config)m=c(b,"sidebar-config.json"),await Bun.write(m,JSON.stringify(t.sidebar.config));let y=t.sidebar?.enabled?`--native-sidebar --sidebar-width ${t.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",T=t.menubarOnly??t.systemTray,v=t.bundleStyle||(await $e(o)?"executable":"launcher");if(t.backend){if(!await ke(o))throw Error("This Craft runtime does not support bundled backends. Upgrade Craft before building this app.");I(o,c(l,r)),B(c(l,r),493);let k=ot("native-backend");try{let h=c(k,"launcher.ts"),M=c(import.meta.dir,"native-backend"+(import.meta.path.endsWith(".ts")?".ts":".js"));await Bun.write(h,`import { runNativeBackend } from ${JSON.stringify(M)}
|
|
1042
1042
|
import * as backend from ${JSON.stringify(K(t.backend.entry))}
|
|
1043
1043
|
await runNativeBackend({ html: ${JSON.stringify(e)}, fetch: backend.default, shutdown: Reflect.get(backend, "shutdown"),
|
|
1044
1044
|
maxRequestBodySize: ${t.backend.maxRequestBodySize??33554432} })
|
|
1045
|
-
`);let E=Bun.spawn([process.execPath,"build",
|
|
1046
|
-
${ee}`)}finally{
|
|
1047
|
-
`)}else if(
|
|
1048
|
-
`)}else{let k=c(l,"craft");I(o,k),B(k,493);let
|
|
1045
|
+
`);let E=Bun.spawn([process.execPath,"build",h,"--compile","--minify","--no-compile-autoload-bunfig","--no-compile-autoload-dotenv","--outfile",c(l,"stx-backend")],{stdout:"pipe",stderr:"pipe"}),[A,ee,te]=await Promise.all([new Response(E.stdout).text(),new Response(E.stderr).text(),E.exited]);if(te!==0)throw Error(`Native backend compilation failed: ${A}
|
|
1046
|
+
${ee}`)}finally{fe(k)}await Bun.write(c(b,"craft.json"),`${JSON.stringify({backend:{executable:"stx-backend"},runtimeProfile:t.runtimeProfile||"full",title:t.window?.title||r,appName:r,width:t.window?.width||1200,height:t.window?.height||800,devTools:Boolean(t.devTools),frameless:Boolean(t.window?.frameless),transparent:Boolean(t.window?.transparent),cornerRadius:t.window?.cornerRadius??0,alwaysOnTop:Boolean(t.window?.alwaysOnTop),resizable:t.window?.resizable!==!1,hideDockIcon:Boolean(t.hideDockIcon),headless:Boolean(t.window?.startHidden),...t.trayPopover?{trayPopover:!0}:T?{menubarOnly:!0}:t.systemTray?{systemTray:!0}:{}},null,2)}
|
|
1047
|
+
`)}else if(v==="executable"){let k=c(l,r);I(o,k),B(k,493);let h={html:"index.html",title:t.window?.title||r,width:t.window?.width||1200,height:t.window?.height||800,devTools:Boolean(t.devTools)};if(t.trayPopover)h.trayPopover=!0;else if(T)h.menubarOnly=!0;else if(t.systemTray)h.systemTray=!0;if(t.window?.frameless)h.frameless=!0;if(t.window?.transparent)h.transparent=!0;if(t.window?.cornerRadius)h.cornerRadius=t.window.cornerRadius;if(t.window?.alwaysOnTop)h.alwaysOnTop=!0;if(t.window?.resizable===!1)h.resizable=!1;if(t.hideDockIcon)h.hideDockIcon=!0;if(t.window?.startHidden)h.headless=!0;await Bun.write(c(b,"craft.json"),`${JSON.stringify(h,null,2)}
|
|
1048
|
+
`)}else{let k=c(l,"craft");I(o,k),B(k,493);let h=t.sidebar?.enabled?`--native-sidebar --sidebar-width ${t.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",E=`#!/bin/bash
|
|
1049
1049
|
set -euo pipefail
|
|
1050
1050
|
DIR="$( cd "$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
|
|
1051
1051
|
RESOURCES="$DIR/../Resources"
|
|
1052
1052
|
exec "$DIR/craft" --html-file "$RESOURCES/index.html" \\
|
|
1053
|
-
${[`--title "${t.window?.title||r}"`,`--width ${t.window?.width||1200}`,`--height ${t.window?.height||800}`,t.trayPopover?"--tray-popover":T?"--menubar-only":t.systemTray?"--system-tray":"",t.devTools?"":"--no-devtools",t.window?.frameless?"--frameless":"",t.window?.transparent?"--transparent":"",t.window?.cornerRadius?`--corner-radius ${t.window.cornerRadius}`:"",t.window?.alwaysOnTop?"--always-on-top":"",t.window?.resizable===!1?"--no-resize":"",t.hideDockIcon?"--hide-dock-icon":"",t.window?.startHidden?"--headless":"",
|
|
1054
|
-
`,A=c(l,r);await Bun.write(A,E),B(A,493)}let
|
|
1053
|
+
${[`--title "${t.window?.title||r}"`,`--width ${t.window?.width||1200}`,`--height ${t.window?.height||800}`,t.trayPopover?"--tray-popover":T?"--menubar-only":t.systemTray?"--system-tray":"",t.devTools?"":"--no-devtools",t.window?.frameless?"--frameless":"",t.window?.transparent?"--transparent":"",t.window?.cornerRadius?`--corner-radius ${t.window.cornerRadius}`:"",t.window?.alwaysOnTop?"--always-on-top":"",t.window?.resizable===!1?"--no-resize":"",t.hideDockIcon?"--hide-dock-icon":"",t.window?.startHidden?"--headless":"",h].filter(Boolean).join(" \\\n ")}
|
|
1054
|
+
`,A=c(l,r);await Bun.write(A,E),B(A,493)}let U=Boolean(t.icon&&await Bun.file(t.icon).exists());if(U)I(t.icon,c(b,"AppIcon.icns"));let Z={CFBundleInfoDictionaryVersion:"6.0",CFBundleExecutable:r,CFBundleIdentifier:d,CFBundleName:r,CFBundleDisplayName:r,CFBundleShortVersionString:i,CFBundleVersion:i,CFBundlePackageType:"APPL",CFBundleSignature:"????",LSMinimumSystemVersion:t.minimumSystemVersion||"13.0",NSHighResolutionCapable:!0,NSSupportsAutomaticGraphicsSwitching:!0,LSUIElement:t.hideDockIcon||t.trayPopover||(t.menubarOnly??Boolean(t.systemTray)),...U?{CFBundleIconFile:"AppIcon"}:{},...t.category?{LSApplicationCategoryType:t.category}:{},...t.copyright?{NSHumanReadableCopyright:t.copyright}:{},...t.infoPlist||{}};if(await Bun.write(c(u,"Info.plist"),X(Z)),await Y(p,t.backend?[c(l,"stx-backend")]:v==="launcher"?[c(l,"craft")]:[],t.macosSigning),s==="dmg"){let k=c(n,`${r}-${i}.dmg`),h=await Ee(p,k,r);if(!h.success)return{success:!1,target:"macos",format:"dmg",error:h.error};return{success:!0,target:"macos",format:"dmg",outputPath:k}}return{success:!0,target:"macos",format:"app",outputPath:p}}async function ke(e){let r=Bun.spawn([e,"--capabilities"],{stdout:"pipe",stderr:"pipe"}),i=setTimeout(()=>r.kill(),5000);try{let[n,s,t]=await Promise.all([new Response(r.stdout).text(),new Response(r.stderr).text(),r.exited]);if(t!==0)return!1;return JSON.parse(`${n}${s}`.trim()).bundleBackend===!0}catch{return!1}finally{clearTimeout(i)}}async function $e(e){try{let r=Bun.spawn([e,"--version"],{stdout:"pipe",stderr:"pipe"}),[i,n]=await Promise.all([new Response(r.stdout).text(),new Response(r.stderr).text()]);await r.exited;let t=`${i}
|
|
1055
1055
|
${n}`.match(/(\d+)\.(\d+)\.(\d+)/);if(!t)return!1;let[o,d,p]=t.slice(1).map(Number);if(o>0||d>0)return!0;return p>=57}catch{return!1}}async function Te(e,r,i,n,s,t,o){let d=c(n,r);C(d,{recursive:!0});let p=c(d,"index.html");await Bun.write(p,e),I(o,c(d,"craft.exe"));let u=`@echo off
|
|
1056
1056
|
set DIR=%~dp0
|
|
1057
1057
|
"%DIR%craft.exe" --html-file "%DIR%index.html" ^
|
|
@@ -1060,7 +1060,7 @@ set DIR=%~dp0
|
|
|
1060
1060
|
--height ${t.window?.height||800} ^
|
|
1061
1061
|
${t.systemTray?"--system-tray":""} ^
|
|
1062
1062
|
${t.devTools?"":"--no-devtools"}
|
|
1063
|
-
`;if(await Bun.write(c(d,`${r}.bat`),u),s==="zip"){let l=c(n,`${r}-${i}-windows.zip`),
|
|
1063
|
+
`;if(await Bun.write(c(d,`${r}.bat`),u),s==="zip"){let l=c(n,`${r}-${i}-windows.zip`),b=await Oe(d,l);if(!b.success)return{success:!1,target:"windows",format:"zip",error:b.error};return{success:!0,target:"windows",format:"zip",outputPath:l}}return{success:!0,target:"windows",format:"app",outputPath:d}}async function Pe(e,r,i,n,s,t,o){let d=c(n,r);C(d,{recursive:!0});let p=c(d,"index.html");await Bun.write(p,e);let u=c(d,"craft");I(o,u),B(u,493);let l=`#!/bin/bash
|
|
1064
1064
|
set -euo pipefail
|
|
1065
1065
|
DIR="$( cd "$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
|
|
1066
1066
|
exec "$DIR/craft" --html-file "$DIR/index.html" \\
|
|
@@ -1069,14 +1069,14 @@ exec "$DIR/craft" --html-file "$DIR/index.html" \\
|
|
|
1069
1069
|
--height ${t.window?.height||800} \\
|
|
1070
1070
|
${t.systemTray?"--system-tray":""} \\
|
|
1071
1071
|
${t.devTools?"":"--no-devtools"}
|
|
1072
|
-
`,
|
|
1072
|
+
`,b=c(d,r.toLowerCase());await Bun.write(b,l),B(b,493);let g=`[Desktop Entry]
|
|
1073
1073
|
Type=Application
|
|
1074
1074
|
Name=${r}
|
|
1075
|
-
Exec=${
|
|
1075
|
+
Exec=${b}
|
|
1076
1076
|
Terminal=false
|
|
1077
1077
|
Categories=Utility;
|
|
1078
|
-
`;if(await Bun.write(c(d,`${r.toLowerCase()}.desktop`),
|
|
1079
|
-
exec /usr/share/${i.toLowerCase()}/${i.toLowerCase()} "$@"`;
|
|
1078
|
+
`;if(await Bun.write(c(d,`${r.toLowerCase()}.desktop`),g),s==="deb"){let m=c(n,`${r.toLowerCase()}_${i}_amd64.deb`),y=await De(d,m,r,i,t);if(!y.success)return{success:!1,target:"linux",format:"deb",error:y.error};return{success:!0,target:"linux",format:"deb",outputPath:m}}if(s==="appimage"){let m=c(n,`${r}-${i}-x86_64.AppImage`),y=await qe(d,m,r,t);if(!y.success)return{success:!1,target:"linux",format:"appimage",error:y.error};return{success:!0,target:"linux",format:"appimage",outputPath:m}}return{success:!0,target:"linux",format:"app",outputPath:d}}async function Ie(e,r,i,n,s,t){return{success:!1,target:"ios",format:"ipa",error:`iOS build requires Xcode and additional setup. Use 'stx init:ios ${r}' to create an iOS project.`}}async function Be(e,r,i,n,s,t){return{success:!1,target:"android",format:"apk",error:`Android build requires Android SDK and additional setup. Use 'stx init:android ${r}' to create an Android project.`}}function Ya(e="full"){let r=process.env.CRAFT_BIN;if(r){if(!z(r))throw Error(`CRAFT_BIN points to a missing file: ${r}`);return r}return Bun.which(e==="webview"?"craft-webview":"craft",{PATH:process.env.PATH??"",cwd:process.cwd()})}function q(){switch(Se()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function Re(e){switch(e){case"macos":return"app";case"windows":return"zip";case"linux":return"appimage";case"ios":return"ipa";case"android":return"apk";default:return"app"}}async function Ee(e,r,i){return bs({appBundlePath:e,outputPath:r,volumeName:i})}async function Oe(e,r){return new Promise((i)=>{let n=_("zip",["-r",r,"."],{cwd:e});n.on("close",(s)=>{if(s===0)i({success:!0});else i({success:!1,error:`zip exited with code ${s}`})}),n.on("error",(s)=>{i({success:!1,error:s.message})})})}async function De(e,r,i,n,s){return new Promise((t)=>{let o=ot("deb");try{let d=c(o,"pkg"),p=c(d,"DEBIAN"),u=c(d,"usr","bin"),l=c(d,"usr","share","applications"),b=c(d,"usr","share",i.toLowerCase());C(p,{recursive:!0}),C(u,{recursive:!0}),C(l,{recursive:!0}),C(b,{recursive:!0});let g=w("fs").readdirSync(e);for(let v of g)I(c(e,v),c(b,v));let m=`#!/bin/bash
|
|
1079
|
+
exec /usr/share/${i.toLowerCase()}/${i.toLowerCase()} "$@"`;w("fs").writeFileSync(c(u,i.toLowerCase()),m),B(c(u,i.toLowerCase()),493);let y=`Package: ${i.toLowerCase()}
|
|
1080
1080
|
Version: ${n}
|
|
1081
1081
|
Section: utils
|
|
1082
1082
|
Priority: optional
|
|
@@ -1084,17 +1084,17 @@ Architecture: amd64
|
|
|
1084
1084
|
Depends: libgtk-3-0, libwebkit2gtk-4.0-37
|
|
1085
1085
|
Maintainer: ${s.author||"Unknown"}
|
|
1086
1086
|
Description: ${s.description||i}
|
|
1087
|
-
`;
|
|
1087
|
+
`;w("fs").writeFileSync(c(p,"control"),y);let T=_("dpkg-deb",["--build",d,r]);T.on("close",(v)=>{if(fe(o),v===0)t({success:!0});else t({success:!1,error:`dpkg-deb exited with code ${v}`})}),T.on("error",(v)=>{fe(o),t({success:!1,error:v.message})})}catch(d){fe(o),t({success:!1,error:d.message})}})}async function qe(e,r,i,n){return new Promise((s)=>{let t=ot("appimage");try{let o=c(t,`${i}.AppDir`),d=c(o,"usr"),p=c(d,"bin"),u=c(d,"share");C(p,{recursive:!0}),C(u,{recursive:!0});let l=c(u,i.toLowerCase());C(l,{recursive:!0});let b=w("fs").readdirSync(e);for(let v of b)I(c(e,v),c(l,v));let g=`#!/bin/bash
|
|
1088
1088
|
SELF=$(readlink -f "$0")
|
|
1089
1089
|
HERE=\${SELF%/*}
|
|
1090
1090
|
export PATH="\${HERE}/usr/bin:\${PATH}"
|
|
1091
1091
|
exec "\${HERE}/usr/share/${i.toLowerCase()}/${i.toLowerCase()}" "$@"
|
|
1092
|
-
`;
|
|
1092
|
+
`;w("fs").writeFileSync(c(o,"AppRun"),g),B(c(o,"AppRun"),493);let m=`[Desktop Entry]
|
|
1093
1093
|
Type=Application
|
|
1094
1094
|
Name=${i}
|
|
1095
1095
|
Exec=${i.toLowerCase()}
|
|
1096
1096
|
Terminal=false
|
|
1097
1097
|
Categories=Utility;
|
|
1098
1098
|
Icon=${i.toLowerCase()}
|
|
1099
|
-
`;
|
|
1100
|
-
export{
|
|
1099
|
+
`;w("fs").writeFileSync(c(o,`${i.toLowerCase()}.desktop`),m);let y=Buffer.from([137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,1,0,0,0,1,8,2,0,0,0,144,119,83,222,0,0,0,12,73,68,65,84,8,215,99,248,255,255,63,0,5,254,2,254,220,204,89,231,0,0,0,0,73,69,78,68,174,66,96,130]);if(w("fs").writeFileSync(c(o,`${i.toLowerCase()}.png`),y),n.icon&&z(n.icon))I(n.icon,c(o,`${i.toLowerCase()}.png`));let T=_("appimagetool",[o,r],{env:{...process.env,ARCH:"x86_64"}});T.on("close",(v)=>{if(fe(t),v===0)B(r,493),s({success:!0});else s({success:!1,error:`appimagetool exited with code ${v}. Install from https://appimage.github.io/appimagetool/`})}),T.on("error",(v)=>{fe(t),s({success:!1,error:`appimagetool not found: ${v.message}`})})}catch(o){fe(t),s({success:!1,error:o.message})}})}function Za(){return[q()]}function Qa(e){switch(e){case"macos":return["app","dmg","pkg"];case"windows":return["app","zip","msi"];case"linux":return["app","deb","rpm","appimage"];case"ios":return["ipa"];case"android":return["apk"];default:return["app"]}}var Ae={buildNative:Ja,getAvailableTargets:Za,getAvailableFormats:Qa,detectPlatform:q},Qh=Ae;
|
|
1100
|
+
export{Hu,qa,Xh,Jh,Ka,Uo,hs,Ga,Xa,Yh,Zh,Ja,Ya,Za,Qa,Qh};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{tn}from"./chunk-67j2m620.js";import{c,f}from"./chunk-hxws025y.js";function vo(e){let n=e.pwa;if(!n?.enabled)return"";let r=n.manifest,t=n.icons?.outputDir?`/${n.icons.outputDir}`:"/pwa-icons",o=tn(e),i=`
|
|
3
3
|
<!-- stx PWA Meta Tags -->
|
|
4
4
|
<link rel="manifest" href="/manifest.json">
|
|
5
5
|
<meta name="theme-color" content="${a(r?.themeColor||"#000000")}">
|
|
@@ -43,11 +43,11 @@ if ('serviceWorker' in navigator) {
|
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
</script>
|
|
46
|
-
<!-- End stx PWA -->`,i}function
|
|
47
|
-
`+e.slice(o)}return e+
|
|
46
|
+
<!-- End stx PWA -->`,i}function ra(e,n){let r=n.pwa;if(!r?.enabled||r.autoInject===!1)return e;if(e.includes("<!-- stx PWA Meta Tags -->"))return e;if(!e.includes("</head>")){let o=c(e);if(o!==-1){let i=vo(n);return e.slice(0,o)+i+`
|
|
47
|
+
`+e.slice(o)}return e+vo(n)}let t=vo(n);return f(e,t)}function em(e){if(!e.pwa?.enabled)return"";return`<script>
|
|
48
48
|
if ('serviceWorker' in navigator) {
|
|
49
49
|
window.addEventListener('load', function() {
|
|
50
|
-
navigator.serviceWorker.register('/${
|
|
50
|
+
navigator.serviceWorker.register('/${tn(e)}')
|
|
51
51
|
.then(function(registration) {
|
|
52
52
|
console.log('[PWA] Service Worker registered:', registration.scope);
|
|
53
53
|
})
|
|
@@ -56,5 +56,5 @@ if ('serviceWorker' in navigator) {
|
|
|
56
56
|
});
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
|
-
</script>`}function
|
|
60
|
-
export{
|
|
59
|
+
</script>`}function tm(){return'<link rel="manifest" href="/manifest.json">'}function nm(e){return`<meta name="theme-color" content="${a(e)}">`}function a(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}
|
|
60
|
+
export{vo,ra,em,tm,nm};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{sg,Ac,ry,Pc,og,ig,Sn,wr,sy,ag,cg,oy,S}from"./chunk-adsqckg4.js";import"./chunk-b0hj8eg2.js";import"./chunk-eq86wzhr.js";import"./chunk-g3vce7ka.js";import"./chunk-41z7f41b.js";import"./chunk-xmg6bmh6.js";import"./chunk-vk2jy6mn.js";import"./chunk-3b3mkgpj.js";import"./chunk-0jdz31q1.js";import"./chunk-cphc60zw.js";export{Sn as buildCss,ag as extractClassNames,ig as fingerprintConfig,cg as generateCss,sy as getCachedCSS,sg as getCssServeAsset,S as injectCss,Ac as loadCssEngine,Pc as loadCssEngineConfig,wr as rebuildCss,ry as resetCssCache,og as resolveUserCssConfig,oy as withLinkedModuleBundles};
|