@stacksjs/stx 0.2.875 → 0.2.880
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-fdjx4vs3.js → chunk-00tq7ghn.js} +2 -2
- package/dist/{chunk-nv4c25zj.js → chunk-02qmvcmv.js} +3 -3
- package/dist/chunk-08cb7cyw.js +2 -0
- package/dist/chunk-0h1dyd38.js +2 -0
- package/dist/{chunk-4m11kcxz.js → chunk-0m4c42qt.js} +10 -10
- package/dist/{chunk-6ykfy7eh.js → chunk-19k15mfc.js} +2 -2
- package/dist/chunk-1avy0p8v.js +2 -0
- package/dist/chunk-1jk46ve0.js +2 -0
- package/dist/chunk-1r612xxs.js +2 -0
- package/dist/chunk-1z6rrqvm.js +2 -0
- package/dist/chunk-2d68p12e.js +2 -0
- package/dist/chunk-2haf7t5h.js +2 -0
- package/dist/{chunk-1q5w3xav.js → chunk-2r0nrvqe.js} +2 -2
- package/dist/chunk-3jp5z1qj.js +2 -0
- package/dist/{chunk-644ckv6e.js → chunk-3q0w0bzd.js} +10 -10
- package/dist/{chunk-eknm4jrm.js → chunk-3sema2js.js} +2 -2
- package/dist/{chunk-vznf808n.js → chunk-3wb82rxw.js} +5 -5
- package/dist/chunk-3zds0gmd.js +2 -0
- package/dist/{chunk-qnwd5bz4.js → chunk-463weehv.js} +1 -1
- package/dist/{chunk-wm029dh0.js → chunk-4fkcn6z5.js} +18 -12
- package/dist/{chunk-976kgb3r.js → chunk-4n45qa0b.js} +9 -9
- package/dist/chunk-4pjqj54a.js +2 -0
- package/dist/{chunk-9anqwafq.js → chunk-4r2rfdmr.js} +5 -5
- package/dist/{chunk-ft6em3wm.js → chunk-50cnypys.js} +6 -6
- package/dist/chunk-53cc06w7.js +2 -0
- package/dist/{chunk-y2e2zm6y.js → chunk-57q4nvs9.js} +3 -3
- package/dist/{chunk-3mz9bdf7.js → chunk-59er0fc7.js} +3 -3
- package/dist/{chunk-dw0ttj6p.js → chunk-5eftxrvv.js} +2 -2
- package/dist/chunk-5p3825qw.js +2 -0
- package/dist/chunk-5rd0an89.js +2 -0
- package/dist/{chunk-pk714ynv.js → chunk-69ezjc8k.js} +4 -4
- package/dist/{chunk-75v0yxeh.js → chunk-6c1vm6bs.js} +2 -2
- package/dist/{chunk-d3q0cg47.js → chunk-6df3j3qq.js} +3 -3
- package/dist/{chunk-kzc2tqzr.js → chunk-6t04tqvh.js} +2 -2
- package/dist/chunk-78zgmqhd.js +2 -0
- package/dist/chunk-7bsrnpmh.js +33 -0
- package/dist/chunk-7dq6ebvp.js +2 -0
- package/dist/chunk-7kqgp3p7.js +2 -0
- package/dist/{chunk-wzvdr4ta.js → chunk-7mcs59pr.js} +2 -2
- package/dist/chunk-83b9k17j.js +2 -0
- package/dist/chunk-86nsbxep.js +61 -0
- package/dist/{chunk-0g2mg8cw.js → chunk-8e1cv1hh.js} +3 -3
- package/dist/chunk-8h5nje66.js +2 -0
- package/dist/{chunk-ae8q4gze.js → chunk-8va3fs07.js} +5 -5
- package/dist/{chunk-fnjm3xbf.js → chunk-93jhfbeg.js} +6 -6
- package/dist/{chunk-xmws1gaf.js → chunk-94ctmp0j.js} +2 -2
- package/dist/chunk-97kgrevs.js +4 -0
- package/dist/{chunk-qvrew79n.js → chunk-9cbf0seq.js} +2 -2
- package/dist/{chunk-mce3g2wb.js → chunk-9f31gs4m.js} +2 -2
- package/dist/chunk-9kza7gxd.js +2 -0
- package/dist/{chunk-b4d4tjvx.js → chunk-a0q0kb0s.js} +5 -5
- package/dist/chunk-a5gnxdfe.js +2 -0
- package/dist/chunk-a60ztvnp.js +3 -0
- package/dist/{chunk-s7fhpkvf.js → chunk-a7ryj8z8.js} +6 -6
- package/dist/{chunk-gqtb53s8.js → chunk-aaea157p.js} +2 -2
- package/dist/{chunk-wp0qpa50.js → chunk-agd2b928.js} +59 -27
- package/dist/chunk-aqxh80vh.js +2 -0
- package/dist/{chunk-az5rh7fs.js → chunk-awp8a3t4.js} +2 -2
- package/dist/chunk-axra1yas.js +2 -0
- package/dist/chunk-az8b0726.js +21 -0
- package/dist/chunk-b7d3n4aw.js +2 -0
- package/dist/{chunk-r2bxjna3.js → chunk-c0g30cjs.js} +2 -2
- package/dist/{chunk-jt5tzddc.js → chunk-c73c0wf9.js} +2 -2
- package/dist/{chunk-88xayf21.js → chunk-cad7e5q1.js} +9 -9
- package/dist/{chunk-bjjfr7qt.js → chunk-care745q.js} +2 -2
- package/dist/chunk-ce0zbpr5.js +2 -0
- package/dist/chunk-cjv89tnb.js +20 -0
- package/dist/chunk-cv1vm1w0.js +2 -0
- package/dist/{chunk-mw0rb1sf.js → chunk-czcx3nbx.js} +6 -6
- package/dist/chunk-d7b30bg6.js +2 -0
- package/dist/{chunk-stn7p7f1.js → chunk-dwyhpbpx.js} +2 -2
- package/dist/{chunk-y75bds1g.js → chunk-e362e615.js} +30 -30
- package/dist/{chunk-ydppkb8y.js → chunk-e41pgmgk.js} +2 -2
- package/dist/{chunk-6az66mrc.js → chunk-ec5q4nnw.js} +66 -66
- package/dist/{chunk-0h6r7nvn.js → chunk-egjmb32c.js} +126 -71
- package/dist/{chunk-q7zc78az.js → chunk-ew3vs3jq.js} +8 -8
- package/dist/{chunk-jqxerj6k.js → chunk-ezna4dhj.js} +2 -2
- package/dist/chunk-f3j1h3ch.js +2 -0
- package/dist/{chunk-vmssv78v.js → chunk-f7znj9xg.js} +3 -3
- package/dist/chunk-fz4c5e9m.js +2 -0
- package/dist/{chunk-esjr9qhe.js → chunk-g2xy0z0e.js} +2 -2
- package/dist/{chunk-fy6ts0n4.js → chunk-g83ph305.js} +2 -2
- package/dist/{chunk-kywe0f1v.js → chunk-gbncp2gp.js} +2 -2
- package/dist/chunk-gm67jt8p.js +2 -0
- package/dist/chunk-gmp10259.js +2 -0
- package/dist/{chunk-0sa9gqmc.js → chunk-h2tq6cbr.js} +11 -11
- package/dist/chunk-h3fv0q25.js +2 -0
- package/dist/{chunk-r09kz9bf.js → chunk-h63ma36g.js} +2 -2
- package/dist/chunk-hkx51atf.js +2 -0
- package/dist/{chunk-95hbmv7k.js → chunk-hmntqqyd.js} +7 -7
- package/dist/{chunk-3w7gacva.js → chunk-hxhmhw23.js} +3 -3
- package/dist/chunk-jghpzx5m.js +2 -0
- package/dist/chunk-k206d3pn.js +2 -0
- package/dist/chunk-k40e0ete.js +4 -0
- package/dist/chunk-k6c5t9we.js +38 -0
- package/dist/{chunk-f4vgagjb.js → chunk-kee5a3ce.js} +3 -3
- package/dist/chunk-kn9tqjgv.js +25 -0
- package/dist/chunk-kna1bdm2.js +54 -0
- package/dist/{chunk-a5yb8w7s.js → chunk-mygsektn.js} +3 -3
- package/dist/chunk-nb6erf75.js +9 -0
- package/dist/chunk-ngzyzcrp.js +2 -0
- package/dist/{chunk-3f9wctns.js → chunk-nysbdr4r.js} +2 -2
- package/dist/chunk-p55a910x.js +1198 -0
- package/dist/chunk-p6hcrg3r.js +3 -0
- package/dist/chunk-p746twww.js +2 -0
- package/dist/chunk-pa2vt2ej.js +2 -0
- package/dist/chunk-pa6kgbmw.js +2 -0
- package/dist/{chunk-saqzk45g.js → chunk-pdprhg5k.js} +1 -1
- package/dist/chunk-pjjrx9pk.js +2 -0
- package/dist/{chunk-g7qpnmbm.js → chunk-pm4rpc4a.js} +23 -23
- package/dist/chunk-pt3rp3zg.js +2 -0
- package/dist/{chunk-4517hny7.js → chunk-q1mb0fbt.js} +2 -2
- package/dist/{chunk-k1ew643q.js → chunk-q74affc4.js} +2 -2
- package/dist/chunk-qd9v1v8z.js +2 -0
- package/dist/chunk-qfwk93fk.js +2 -0
- package/dist/chunk-qg1kw5yf.js +2 -0
- package/dist/chunk-qn6y5ttj.js +2 -0
- package/dist/chunk-qxcc0aar.js +2 -0
- package/dist/{chunk-rzd9hyhv.js → chunk-ram5944w.js} +2 -2
- package/dist/{chunk-p5m1z6e1.js → chunk-rcxer2km.js} +4 -4
- package/dist/chunk-rdxph1tp.js +2 -0
- package/dist/chunk-rnrdngnn.js +2 -0
- package/dist/{chunk-x2ftkaz3.js → chunk-rsxxajv6.js} +2 -2
- package/dist/chunk-rw5sxr5a.js +2 -0
- package/dist/chunk-rzcdwybt.js +26 -0
- package/dist/chunk-s29hp1qw.js +14 -0
- package/dist/chunk-s7xywsqd.js +3 -0
- package/dist/{chunk-d6gqh2wv.js → chunk-satrf398.js} +1 -1
- package/dist/{chunk-zn6n075d.js → chunk-shcnt6aa.js} +3 -3
- package/dist/{chunk-ysfgabpf.js → chunk-sn4ndpd7.js} +3 -3
- package/dist/{chunk-zc8a2erc.js → chunk-ssg6ne5b.js} +4 -4
- package/dist/{chunk-afxfkb60.js → chunk-sv7fdqmc.js} +6 -6
- package/dist/chunk-swz0xprw.js +2 -0
- package/dist/chunk-t8r40wgf.js +2 -0
- package/dist/{chunk-dbvsa5ya.js → chunk-t94y8g35.js} +2 -2
- package/dist/{chunk-g33ycxe3.js → chunk-t9hxyvvc.js} +5 -5
- package/dist/{chunk-cmh0bfkb.js → chunk-tgzs1kbj.js} +5 -5
- package/dist/chunk-tka73egx.js +2 -0
- package/dist/{chunk-xtaq95em.js → chunk-v1s838fe.js} +1 -1
- package/dist/chunk-v3747589.js +12 -0
- package/dist/chunk-v9h2bbhf.js +2 -0
- package/dist/chunk-v9mxhch2.js +2 -0
- package/dist/chunk-vm42j29z.js +2 -0
- package/dist/chunk-w2kdhm7k.js +2 -0
- package/dist/chunk-w5zzwe2f.js +2 -0
- package/dist/chunk-wbmx0rge.js +2 -0
- package/dist/chunk-wjafpvjv.js +2 -0
- package/dist/chunk-ws2h92mm.js +3 -0
- package/dist/chunk-ws9kr80x.js +2 -0
- package/dist/{chunk-45rzd16g.js → chunk-xf0xacc9.js} +44 -44
- package/dist/chunk-xhr35ctb.js +2 -0
- package/dist/chunk-xmmr0916.js +2 -0
- package/dist/{chunk-yxdhz4ps.js → chunk-xpbakn6t.js} +2 -2
- package/dist/chunk-xz4v9tg1.js +3 -0
- package/dist/chunk-y7e61pz3.js +3 -0
- package/dist/{chunk-v0tdg16k.js → chunk-ybjgnnyf.js} +5 -5
- package/dist/chunk-yh2hnt3m.js +12 -0
- package/dist/{chunk-w6pzkcjp.js → chunk-ymqm898x.js} +2 -2
- package/dist/{chunk-2zaatnnh.js → chunk-yp4tn4zn.js} +4 -4
- package/dist/chunk-z7k1xn6k.js +2 -0
- package/dist/{chunk-t4g3ka8c.js → chunk-z9ffr9gy.js} +7 -7
- package/dist/{chunk-nnp6rf4c.js → chunk-zch65qrd.js} +1 -1
- package/dist/{chunk-pbakxcv8.js → chunk-zek9t5za.js} +2 -2
- package/dist/cli.js +23 -23
- package/dist/client/signals-dom-ready-runtime.js +6 -0
- package/dist/client/signals-mount-runtime.js +1 -1
- package/dist/client-module-registry.js +10 -4
- package/dist/client-parameter-bindings.d.ts +5 -0
- package/dist/client-parameter-bindings.js +47 -6
- package/dist/client-script-bundler.js +4 -3
- package/dist/component-library.d.ts +1 -0
- package/dist/component-library.js +42 -14
- package/dist/composable-loader.js +19 -9
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/html-masking.d.ts +2 -0
- package/dist/html-masking.js +10 -0
- package/dist/inherited-context.d.ts +1 -1
- package/dist/inherited-context.js +43 -14
- package/dist/module-syntax.d.ts +2 -0
- package/dist/module-syntax.js +21 -0
- package/dist/native-component-context.js +44 -17
- package/dist/page-module-order.d.ts +10 -0
- package/dist/page-module-order.js +139 -0
- package/dist/process.js +6 -4
- package/dist/pwa.js +3 -3
- package/dist/script-attributes.d.ts +4 -0
- package/dist/script-attributes.js +10 -0
- package/dist/ssg.js +39 -39
- package/dist/strip-literals.d.ts +2 -0
- package/dist/strip-literals.js +12 -6
- package/dist/stx-virtual-ts.d.ts +1 -0
- package/dist/stx-virtual-ts.js +21 -27
- package/dist/typecheck.js +8 -0
- package/package.json +5 -5
- package/dist/chunk-003ph86a.js +0 -2
- package/dist/chunk-027meh1k.js +0 -2
- package/dist/chunk-0bc3mwqd.js +0 -2
- package/dist/chunk-0gv2mmr0.js +0 -2
- package/dist/chunk-0j8zre1m.js +0 -2
- package/dist/chunk-0qwbhv3f.js +0 -33
- package/dist/chunk-1gfg6qmr.js +0 -2
- package/dist/chunk-1tqp2s13.js +0 -2
- package/dist/chunk-1y7kfp5d.js +0 -2
- package/dist/chunk-1ztp5vkh.js +0 -3
- package/dist/chunk-24e4dapm.js +0 -2
- package/dist/chunk-2qb9kp21.js +0 -25
- package/dist/chunk-32wvc376.js +0 -2
- package/dist/chunk-3te2y9qf.js +0 -2
- package/dist/chunk-447jc6zc.js +0 -2
- package/dist/chunk-51ymssz5.js +0 -2
- package/dist/chunk-6dz5za5z.js +0 -2
- package/dist/chunk-6ezt9kbe.js +0 -54
- package/dist/chunk-6grkdknk.js +0 -2
- package/dist/chunk-6q9a5bph.js +0 -2
- package/dist/chunk-6rqef7wp.js +0 -2
- package/dist/chunk-72p5annm.js +0 -33
- package/dist/chunk-74x6j229.js +0 -4
- package/dist/chunk-7j11vgm1.js +0 -3
- package/dist/chunk-7ngfcdv9.js +0 -2
- package/dist/chunk-7njy024g.js +0 -2
- package/dist/chunk-9e3ggwk7.js +0 -2
- package/dist/chunk-9mz2n39m.js +0 -2
- package/dist/chunk-a262spx7.js +0 -2
- package/dist/chunk-a8wn0snv.js +0 -2
- package/dist/chunk-af6m1s2b.js +0 -3
- package/dist/chunk-b1tcym2x.js +0 -2
- package/dist/chunk-b61dq7pz.js +0 -12
- package/dist/chunk-bdh73gxd.js +0 -4
- package/dist/chunk-bs7g6jtt.js +0 -2
- package/dist/chunk-bspj1rf1.js +0 -2
- package/dist/chunk-bx3hpsxn.js +0 -2
- package/dist/chunk-byq488g4.js +0 -2
- package/dist/chunk-c8pzj57b.js +0 -2
- package/dist/chunk-e2b2f502.js +0 -2
- package/dist/chunk-ec6mrad6.js +0 -2
- package/dist/chunk-eh2gec79.js +0 -2
- package/dist/chunk-em31p5pb.js +0 -2
- package/dist/chunk-eqfsw6x4.js +0 -2
- package/dist/chunk-ey1vwfpc.js +0 -24
- package/dist/chunk-fa57bncd.js +0 -2
- package/dist/chunk-fk79jbzn.js +0 -2
- package/dist/chunk-g97krv0d.js +0 -2
- package/dist/chunk-gn16yq49.js +0 -2
- package/dist/chunk-gvs61tqn.js +0 -2
- package/dist/chunk-h2928108.js +0 -2
- package/dist/chunk-hd5bny2c.js +0 -2
- package/dist/chunk-j1ytbd6r.js +0 -1184
- package/dist/chunk-jm7qa3v3.js +0 -2
- package/dist/chunk-jmjgj3nh.js +0 -2
- package/dist/chunk-jqtpzzz4.js +0 -12
- package/dist/chunk-kq8mffgf.js +0 -2
- package/dist/chunk-kx06jzdw.js +0 -2
- package/dist/chunk-n344ss97.js +0 -2
- package/dist/chunk-n5pvdrkb.js +0 -2
- package/dist/chunk-ne8q191s.js +0 -2
- package/dist/chunk-np8wgbsa.js +0 -3
- package/dist/chunk-p4e8myzj.js +0 -17
- package/dist/chunk-pp99rmjm.js +0 -72
- package/dist/chunk-pqmjeea6.js +0 -2
- package/dist/chunk-q0k2gmva.js +0 -2
- package/dist/chunk-qggwr60r.js +0 -2
- package/dist/chunk-qm3v4qb7.js +0 -2
- package/dist/chunk-qrn1nza9.js +0 -2
- package/dist/chunk-qty0t69x.js +0 -2
- package/dist/chunk-rzadf7vx.js +0 -20
- package/dist/chunk-snz2cxqv.js +0 -2
- package/dist/chunk-ts37jw3s.js +0 -2
- package/dist/chunk-vnrbjbrw.js +0 -3
- package/dist/chunk-wkb7dhp7.js +0 -2
- package/dist/chunk-wxyqp6g9.js +0 -2
- package/dist/chunk-x76qvq1n.js +0 -2
- package/dist/chunk-y4hn1qh0.js +0 -2
- package/dist/chunk-yc8ggeh2.js +0 -2
- package/dist/chunk-ydy0tfar.js +0 -2
- package/dist/chunk-yfed67yc.js +0 -2
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{T}from"./chunk-s29hp1qw.js";import{t,Bn,C}from"./chunk-yh2hnt3m.js";var z=new T(32,{maxBytes:2097152,sizeOf:(x)=>x.code.length*4}),N=/^[A-Za-z_$][\w$]*$/,D=new Set(["if","for","while","switch","with"]),M=["(","[","{"],_=[")","]","}"],O=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function Z(x){let u=t(x),m=[];for(let e of u.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let r=e.index??0;m.push({text:e[0],start:r,end:r+e[0].length})}return{code:u,tokens:m}}function B(x){let u=z.get(x);if(u)return u;let{code:m,tokens:e}=Z(x),r=new Map,f=[];for(let o=0;o<e.length;o++){let n=e[o].text;if(["(","[","{"].includes(n))f.push(o);else if([")","]","}"].includes(n)){let i=f.at(-1);if(i!==void 0&&["()","[]","{}"].includes(e[i].text+n))f.pop(),r.set(i,o),r.set(o,i)}}function S(o,n){let i=[],s=o;for(let c=o;c<n;c++){if(["(","[","{"].includes(e[c].text)&&(r.get(c)??n)<n){c=r.get(c);continue}if(e[c].text===",")i.push([s,c]),s=c+1}return i.push([s,n]),i}let y=[];function k(o,n,i,s=!1,c){if(e[o]?.text==="...")o++;if(o>=n)return;let d=e[o].text;if(N.test(d)){if(i.add(d),i===I)y.push({name:d,token:o,functionScoped:s,declarationToken:c});return}if(d!=="{"&&d!=="[")return;let A=r.get(o);if(A===void 0||A>=n)return;for(let[w,h]of S(o+1,A)){let g=w;if(d==="{")for(let v=w;v<h;v++){if(e[v].text===":"){g=v+1;break}if(e[v].text==="=")break;if(["(","[","{"].includes(e[v].text)&&r.has(v))v=r.get(v)}k(g,h,i,s,c)}}function p(o,n){let i=new Set;for(let[s,c]of S(o,n))k(s,c,i);return i}function E(o){let n=o;for(;n<e.length;n++){let i=e[n].text;if(["(","[","{"].includes(i)&&r.has(n)){n=r.get(n);continue}if([",",";",")","]","}"].includes(i))break}return e[Math.max(o,n-1)]?.end??m.length}let I=new Set,L=[];for(let o=0;o<e.length;o++)if(e[o].text==="=>"){let n=o-1,i=n,s;if(e[n]?.text===")"&&r.has(n))i=r.get(n),s=p(i+1,n);else if(e[n]&&N.test(e[n].text))s=new Set([e[n].text]);else continue;let c=o+1,d=e[c]?.text==="{"&&r.has(c)?e[r.get(c)].end:E(c);L.push({start:e[i].start,end:d,bodyStart:e[c]?.start??d,functionBody:!0,names:s})}else if(e[o].text==="("&&r.has(o)){let n=e[o-1]?.text;if(!n||D.has(n)||!N.test(n)&&n!=="*"&&n!=="]")continue;let i=r.get(o),s=i+1;if(e[s]?.text===":"){s++;while(s<e.length&&!["{","=>",";","="].includes(e[s].text))s++}if(e[s]?.text!=="{"||!r.has(s))continue;L.push({start:e[o].start,end:e[r.get(s)].end,bodyStart:e[s].start,functionBody:n!=="catch",names:p(o+1,i)})}function a(o){let n=o;for(;n<e.length;n++){let i=e[n].text;if(M.includes(i)&&r.has(n)){n=r.get(n);continue}if(i===";"||_.includes(i))break;let s=e[n-1];if(n>o&&O.has(i)&&s.text!==".")break;if(n>o&&/[\n\r]/.test(m.slice(s.end,e[n].start))&&(/^[\w$]+$/.test(s.text)||_.includes(s.text)||['"',"'","`"].includes(s.text))&&N.test(i)&&!["in","of","instanceof"].includes(i))break}return n}let l=[];for(let o=0;o<e.length;o++){if(e[o].text!=="for")continue;let n=e[o+1]?.text==="await"?o+2:o+1;if(e[n]?.text!=="("||!r.has(n))continue;let i=r.get(n),s=i+1,c=e[s]?.text==="{"&&r.has(s)?r.get(s):a(s),d=e[c]?.text===";"||e[c]?.text==="}"?e[c].end:e[Math.max(s,c-1)]?.end??m.length;l.push({headStart:n,headEnd:i,start:e[n].start,end:d})}for(let o=0;o<e.length;o++){let n=e[o].text,i=e[o-1]?.text;if(i==="."||e[o+1]?.text===":")continue;if(i==="as"||i==="<")continue;if(n==="const"||n==="let"||n==="var"){let s=a(o+1),c=o+1,d=!1,A=!1,w=0;for(let h=o+1;h<=s;h++){let g=e[h]?.text;if(h<s&&M.includes(g)&&r.has(h)&&r.get(h)<s){h=r.get(h);continue}if(h<s&&g===":"&&!A)d=!0;else if(h<s&&g==="="&&w===0)d=!1,A=!0;else if(h<s&&d&&g==="<")w++;else if(h<s&&d&&g===">"&&w>0)w--;else if(h===s||g===","&&w===0)k(c,h,I,n==="var",o),c=h+1,d=!1,A=!1}}else if(n==="function"||n==="class"){let s=o+1;if(e[s]?.text==="*")s++;if(e[s]&&N.test(e[s].text)&&e[s].text!=="extends")I.add(e[s].text),y.push({name:e[s].text,token:s,declarationToken:o})}else if(n==="import"){let s=o+1;if(e[s]?.text==="*"&&e[s+1]?.text==="as")s+=2;let c=e[s]?.text;if(c&&N.test(c)&&c!=="type"&&e[s+1]?.text!=="("&&e[s+1]?.text!==".")I.add(c),y.push({name:c,token:s,file:!0});let d=e[s]?.text==="{"?s:e[s+1]?.text===","&&e[s+2]?.text==="{"?s+2:-1;if(d!==-1&&r.has(d)){let A=r.get(d);for(let[w,h]of S(d+1,A)){let g=h-1;while(g>=w&&!N.test(e[g].text))g--;if(g>=w&&e[g].text!=="type")y.push({name:e[g].text,token:g,file:!0})}}}}let b={code:m,scopes:L,loops:l,declarations:I,sites:y,tokens:e,pairs:r};return z.set(x,b),b}function qr(x){let u=B(x);return{code:u.code,shadows:(m,e)=>u.scopes.some((r)=>e>=r.start&&e<r.end&&r.names.has(m))}}function mo(x){return new Set(B(x).declarations)}function Zi(x){let u=B(x),m=Bn(x),{depths:e}=C(m),r=[];for(let f of u.sites){if(f.file||f.declarationToken===void 0)continue;let S=u.tokens[f.declarationToken];if(e[S.start]!==0)continue;let y=m.slice(0,S.start),k=[...y.matchAll(/[A-Za-z_$][\w$]*|\d+(?:[.]\d+)?|[^\s]/g)],p=k.pop();if(p?.[0]==="declare")continue;if(S.text==="function"||S.text==="class"){while(p&&["async","export","default","abstract"].includes(p[0]))p=k.pop();if(p&&![";","}"].includes(p[0])){let E=y.slice(p.index+p[0].length);if(!/[\r\n]/.test(E)||!/^(?:[\w$]+|[)\]])$/.test(p[0])||["return","throw","yield","await","new"].includes(p[0]))continue}}r.push({name:f.name,start:S.start})}return r}function Nl(x){return[...new Set(Zi(x).map((u)=>u.name))].sort()}function De(x,u){let{scopes:m,loops:e,sites:r,tokens:f,pairs:S}=B(x),y=Array.from({length:f.length},()=>-1),k=[];for(let a=0;a<f.length;a++){y[a]=k.length?k[k.length-1]:-1;let l=f[a].text;if(l==="{"&&S.has(a))k.push(a);else if(l==="}"&&k.length&&S.get(a)===k[k.length-1])k.pop()}let p=new Set,E=new Map;for(let a of r){if(!u.has(a.name))continue;p.add(a.token);let l=a.file?-1:y[a.token],b=l===-1?[0,Number.POSITIVE_INFINITY]:[f[l].start,f[S.get(l)].end];if(a.functionScoped){let n=f[a.token].start,i=m.filter((s)=>s.functionBody&&n>=s.bodyStart&&n<s.end).sort((s,c)=>s.end-s.bodyStart-(c.end-c.bodyStart))[0];b=i?[i.bodyStart,i.end]:[0,Number.POSITIVE_INFINITY]}else if(!a.file){let n=e.filter((i)=>a.token>i.headStart&&a.token<i.headEnd).sort((i,s)=>i.headEnd-i.headStart-(s.headEnd-s.headStart))[0];if(n)b=[n.start,n.end]}let o=E.get(a.name);if(o)o.push(b);else E.set(a.name,[b])}let I=new Set;for(let a=0;a<f.length;a++){if(f[a].text!=="import"||f[a-1]?.text===".")continue;let l=a+1;if(f[l]?.text==="type")l++;if(f[l]&&N.test(f[l].text)&&f[l+1]?.text===",")l+=2;if(f[l]?.text==="{"&&S.has(l))for(let b=l+1;b<S.get(l);b++)I.add(b)}let L=new Set;for(let a=0;a<f.length;a++){let l=f[a].text;if(!u.has(l)||L.has(l)||p.has(a)||I.has(a))continue;let b=f[a-1]?.text;if(b==="#"||b==="."&&f[a-2]?.text!=="..")continue;if(f[a+1]?.text===":"&&(b==="{"||b===","))continue;let o=f[a].start;if(E.get(l)?.some(([n,i])=>o>=n&&o<i))continue;if(m.some((n)=>o>=n.start&&o<n.end&&n.names.has(l)))continue;L.add(l)}return L}function Ml(x){let u=B(Bn(x));return u.tokens.some((m,e)=>{if(m.text!=="await")return!1;if(u.tokens[e-1]?.text==="."||u.tokens[e+1]?.text===":")return!1;let r=e+1;if(u.tokens[r]?.text==="("&&u.tokens[(u.pairs.get(r)??-2)+1]?.text==="{")return!1;return!u.scopes.some((f)=>f.functionBody&&f.start<=m.start&&m.start<f.end)})}
|
|
3
|
+
export{qr,mo,Zi,Nl,De,Ml};
|
|
@@ -159,7 +159,7 @@ else {
|
|
|
159
159
|
stxIslands.initIslands();
|
|
160
160
|
}
|
|
161
161
|
})();
|
|
162
|
-
</script>`}function b(e){let t=e.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(t)return t[1];let n=e.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(n)return n[1];return null}function w(e,t){let n={},r=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,i;while((i=r.exec(e))!==null){let d=i[1],o=i[2];if(o in t)n[d]=t[o];else n[d]=o}return n}function
|
|
162
|
+
</script>`}function b(e){let t=e.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(t)return t[1];let n=e.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(n)return n[1];return null}function w(e,t){let n={},r=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,i;while((i=r.exec(e))!==null){let d=i[1],o=i[2];if(o in t)n[d]=t[o];else n[d]=o}return n}function ku(){let e=new Map;return{islands:e,register(t){e.set(t.id,t)},get(t){return e.get(t)},async hydrate(t){let n=e.get(t);if(!n||n.hydrated)return;if(n.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:t,component:n.component}}))},async hydrateAll(){let t=Array.from(e.values()).filter((n)=>!n.hydrated).map((n)=>this.hydrate(n.id));await Promise.all(t)}}}function I(e){return`
|
|
163
163
|
<script data-hydrate="${e}">
|
|
164
164
|
(function() {
|
|
165
165
|
const island = document.querySelector('[data-island="${e}"]');
|
|
@@ -311,7 +311,7 @@ else {
|
|
|
311
311
|
});
|
|
312
312
|
})();
|
|
313
313
|
</script>
|
|
314
|
-
`}function
|
|
314
|
+
`}function _u(e,t={},n){let r=e,i=!1,d=/@client:(load|idle|visible|media|only|hover|event)/i.test(e);if(r=u(r,"load",t),r=u(r,"idle",t),r=u(r,"visible",t),r=u(r,"media",t),r=M(r),r=u(r,"hover",t),r=u(r,"event",t),i=d&&r!==e,i)r+=`
|
|
315
315
|
`+v();return r}function u(e,t,n){let r=new RegExp(`@client:${t}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return e.replace(r,(i,d,o)=>{let a={strategy:t};if(d)try{let E=d.split(",").map((h)=>h.trim());for(let h of E){let[m,g]=h.split(":").map((p)=>p.trim());if(m&&g){let p=g.replace(/^['"]|['"]$/g,"");a[m]=p}}}catch{}let s=`island-${Math.random().toString(36).substring(2,9)}`,y=b(o.trim()),f=w(o.trim(),n),c=[];if(a.rootMargin)c.push(`data-root-margin="${a.rootMargin}"`);if(a.threshold!==void 0)c.push(`data-threshold="${a.threshold}"`);if(a.media)c.push(`data-media="${a.media}"`);if(a.event)c.push(`data-event="${a.event}"`);if(y)c.push(`data-component="${y}"`);let x=Object.keys(f).length>0?`
|
|
316
316
|
<script type="application/json" data-island-props="${s}">${JSON.stringify(f)}</script>`:"",l="";switch(t){case"load":l=I(s);break;case"idle":l=L(s,a);break;case"visible":l=C(s,a);break;case"media":l=S(s,a);break;case"hover":l=k(s);break;case"event":l=H(s,a);break}return`
|
|
317
317
|
<div data-island="${s}"
|
|
@@ -342,7 +342,7 @@ else {
|
|
|
342
342
|
}
|
|
343
343
|
})();
|
|
344
344
|
</script>
|
|
345
|
-
`})}function
|
|
345
|
+
`})}function Cu(){return`
|
|
346
346
|
/* Island base styles */
|
|
347
347
|
.stx-island {
|
|
348
348
|
display: contents;
|
|
@@ -383,9 +383,9 @@ else {
|
|
|
383
383
|
.stx-island.hydrated {
|
|
384
384
|
opacity: 1;
|
|
385
385
|
}
|
|
386
|
-
`}function
|
|
386
|
+
`}function Eu(e){if(typeof window>"u")return;let t=document.querySelector(`[data-island="${e}"]`);if(!t||t.classList.contains("hydrated"))return;t.classList.add("hydrated"),t.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function Tu(e){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${e}"]:not(.hydrated)`).forEach((n)=>{n.classList.add("hydrated"),n.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function $u(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach((t)=>{t.classList.add("hydrated"),t.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function Ru(e){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${e}"]`)?.classList.contains("hydrated")??!1}function Au(e){return new Promise((t)=>{if(typeof window>"u"){t();return}let n=document.querySelector(`[data-island="${e}"]`);if(!n){t();return}if(n.classList.contains("hydrated")){t();return}n.addEventListener("stx:hydrated",()=>t(),{once:!0})})}function Pu(e){return e.replace(/@static\s*([\s\S]*?)@endstatic/gi,(t,n)=>`<div class="stx-static">${n.trim()}</div>`)}function Iu(e){let t=e.map((n)=>({id:n.id,component:n.component,strategy:n.options.strategy,props:n.props}));return`
|
|
387
387
|
<script type="application/json" id="stx-island-manifest">
|
|
388
388
|
${JSON.stringify(t)}
|
|
389
389
|
</script>
|
|
390
|
-
`}var
|
|
391
|
-
export{
|
|
390
|
+
`}var ih={processPartialHydrationDirectives:_u,processStaticDirectives:Pu,generatePartialHydrationCSS:Cu,generateIslandManifest:Iu,createIslandRegistry:ku,hydrateIsland:Eu,hydrateByStrategy:Tu,hydrateAll:$u,isHydrated:Ru,onHydrated:Au};
|
|
391
|
+
export{ku,_u,Cu,Eu,Tu,$u,Ru,Au,Pu,Iu,ih};
|
|
@@ -72,7 +72,7 @@ else {
|
|
|
72
72
|
${t}
|
|
73
73
|
})();
|
|
74
74
|
</script>
|
|
75
|
-
`}function
|
|
75
|
+
`}function wh(i,n,o){f=0;let l=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return i.replace(l,(t,e,s)=>{let a=v(),r=p(t,e,s),d=r.placeholder?`<div data-defer-placeholder>${r.placeholder}</div>`:"",c=r.loading?`<div data-defer-loading style="display: none;">${r.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',g=r.error?`<div data-defer-error style="display: none;">${r.error}</div>`:"",u=`<div data-defer-content style="display: none;">${r.content}</div>`,h=E(a,r);return`
|
|
76
76
|
<div id="${a}" class="stx-defer" data-defer-trigger="${r.trigger}">
|
|
77
77
|
${d}
|
|
78
78
|
${c}
|
|
@@ -81,4 +81,4 @@ else {
|
|
|
81
81
|
</div>
|
|
82
82
|
${h}
|
|
83
83
|
`})}
|
|
84
|
-
export{
|
|
84
|
+
export{wh};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import x from"fs";import u from"path";import p from"fs";import w from"path";var y=["components","layouts","partials","emails"];function M(e){return e.split(/[\\/]/).filter(Boolean).slice(0,-1).some((a)=>y.includes(a))}function b(e){return M(e.replace(/^\//,""))}function
|
|
3
|
-
`),o=w.join(t,"route-types.d.ts");try{if(p.existsSync(o)&&p.readFileSync(o,"utf8")===n)return;p.mkdirSync(t,{recursive:!0}),p.writeFileSync(o,n)}catch{}}function
|
|
4
|
-
`))}import I from"path";var N=Object.freeze(["ico","png","jpg","jpeg","gif","webp","avif","svg","bmp","tif","tiff","heic","css","js","mjs","cjs","map","wasm","webmanifest","json","xml","txt","rss","atom","woff","woff2","ttf","otf","eot","mp3","mp4","m4a","m4v","mov","webm","ogg","ogv","oga","wav","flac","avi","mkv","pdf","csv","doc","docx","xls","xlsx","ppt","pptx","rtf","odt","zip","gz","tgz","tar","rar","7z","bz2","xz","php","phtml","asp","aspx","jsp","cgi","env","ini","yml","yaml","toml","sql","bak","old","swp","log","conf","cfg","exe","dmg","pkg","apk","ipa","msi","iso","bin","dll"]),D=N.flatMap((e)=>e===e.toUpperCase()?[e]:[e,e.toUpperCase()]).join("|"),X=new RegExp(`\\.(?:${D})$`),E=`(?![^/]*\\.(?:${D})$)`;function $t(e){let t=e,a=t.search(/[?#]/);if(a!==-1)t=t.slice(0,a);let r=t.slice(t.lastIndexOf("/")+1);return r.length>0&&X.test(r)}function R(e,t){let r=I.relative(t,e).replace(/\.(stx|md)$/,"");if(r=r.split(I.sep).join("/"),r==="index")return"/";if(r.endsWith("/index"))r=r.slice(0,-6);return r=r.replace(/\[\[([^\]]+)\]\]/g,":$1?"),r=r.replace(/\[([^\]]+)\]/g,":$1"),r=r.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${r}`}function be(e,t={}){let a=t.page?E:"",r=[],n="",o=0;while(o<e.length){let i=e.slice(o),c=/^\/:([^/?*]+)\?/.exec(i);if(c){r.push(c[1]);let d=o+c[0].length===e.length;n+=`(?:/${d?a:""}([^/]+))?`,o+=c[0].length;continue}let s=/^:([^/?*]+)\*/.exec(i);if(s){r.push(s[1]),n+="(.+)",o+=s[0].length;continue}let l=/^:([^/?*]+)/.exec(i);if(l){r.push(l[1]);let d=o+l[0].length===e.length;n+=`${d?a:""}([^/]+)`,o+=l[0].length;continue}n+=e[o].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),o+=1}return{regex:new RegExp(`^${n}$`),params:r}}function vr(e,t){let a=e===""?"/":e;for(let r of t){let n=a.match(r.regex);if(n){let o={};return r.params.forEach((i,c)=>{o[i]=n[c+1]}),{route:r,params:o}}}return null}function Ds(e,t={}){let a=e.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return be(a,t)}import j from"fs";import L from"path";function _(e,t){let a=[],r=L.dirname(e);while(r.startsWith(t)||r===t){let n=L.join(r,"_layout.stx");if(j.existsSync(n))a.unshift(n);if(r===t)break;r=L.dirname(r)}return a}function B(e,t){let a=[];if(!x.existsSync(e))return a;let r=x.readdirSync(e,{withFileTypes:!0});for(let n of r){let o=u.join(e,n.name);if(n.isDirectory()){if(n.name.startsWith("."))continue;if(y.includes(n.name))continue;a.push(...B(o,t))}else if(n.isFile()){let i=u.extname(n.name);if(t.includes(i)){if(n.name.startsWith("_")&&n.name!=="_layout.stx")continue;if(n.name==="_layout.stx")continue;a.push(o)}}}return a}class xr{routes;pagesDir;pagesDirs;config;constructor(e,t={}){this.config=t;let a=t.pagesDirs&&t.pagesDirs.length>0?t.pagesDirs:[t.pagesDir||"pages"];this.pagesDirs=a.map((s)=>u.resolve(e,s)),this.pagesDir=this.pagesDirs[0];let r=t.extensions||[".stx"],n=(s)=>{let l=u.resolve(e,s);try{return x.realpathSync(l)}catch{return l}},o=(t.exclude??[]).filter((s)=>typeof s==="string"&&s.trim()!=="").map(n),i=(s)=>{if(o.length===0)return!1;let l=n(s);return o.some((d)=>l===d||l.startsWith(`${d}${u.sep}`))},c=new Set;this.routes=[];for(let s of this.pagesDirs){let l=B(s,r).filter((h)=>!i(h)),d=new Map;for(let h of l){let g=R(h,s),m=t.pagesDirs?g.replace(/:[\w]+/g,":param"):g;if(t.pagesDirs&&d.has(m))throw Error(`Conflicting layer pages for ${g}: ${d.get(m)} and ${h}`);if(d.set(m,h),c.has(m))continue;c.add(m);let{regex:G,params:P}=be(g,{page:!0}),T=t.layouts!==!1?_(h,s):[];this.routes.push({pattern:g,regex:G,params:P,filePath:h,isDynamic:P.length>0,layout:T.length>0?T[T.length-1]:void 0})}}if(this.routes.sort((s,l)=>{if(!s.isDynamic&&l.isDynamic)return-1;if(s.isDynamic&&!l.isDynamic)return 1;let d=s.pattern.split("/").length,h=l.pattern.split("/").length;if(d!==h)return h-d;return s.pattern.localeCompare(l.pattern)}),t.emit!==!1){let s=u.resolve(e,t.stateDir||process.env.STX_DIR?.trim()||".stx");gi(this.routes,s),mi(this.routes,s,this.pagesDir)}}match(e){let t=e===""?"/":e;for(let a of this.routes){let r=t.match(a.regex);if(r){let n={};return a.params.forEach((o,i)=>{n[o]=r[i+1]}),{route:a,params:n}}}return null}resolve(e,t){let a=this.routes.find((n)=>n.pattern===e||n.filePath.includes(e));if(!a)return"#not-found";let r=a.pattern;if(t)for(let[n,o]of Object.entries(t))r=r.replace(`:${n}`,encodeURIComponent(o));return r}addRoute(e){this.routes.push(e),this.routes.sort((t,a)=>{if(!t.isDynamic&&a.isDynamic)return-1;if(t.isDynamic&&!a.isDynamic)return 1;return t.pattern.localeCompare(a.pattern)})}getLayout(e){return e.layout??null}}function Ms(e,t){let a=[`${t}.stx`,"error.stx"];for(let r of a){let n=u.join(e,r);if(x.existsSync(n))return n}return null}function Ls(e,t){return e.map((a)=>{let r=u.relative(t,a.filePath),n=a.isDynamic?" (dynamic)":"";return`${a.pattern} \u2192 ${r}${n}`})}var f={},k="";function cg(e){k=e.replace(/\/$/,"")}function lg(e,t,a={}){f[e]={path:t,name:e,params:a}}function ug(e){for(let[t,a]of Object.entries(e))if(typeof a==="string")f[t]={path:a,name:t};else f[t]={...a,name:t}}function Sr(e,t={},a=!1){let r=f[e];if(!r)return console.warn(`Route [${e}] not defined.`),"#undefined-route";let n={...r.params,...t},o=r.path;o=o.replace(/:(\w+)/g,(c,s)=>{let l=n[s];if(l===void 0)return console.warn(`Missing parameter [${s}] for route [${e}].`),`:${s}`;return delete n[s],encodeURIComponent(String(l))});let i=Object.entries(n);if(i.length>0){let c=i.map(([s,l])=>`${encodeURIComponent(s)}=${encodeURIComponent(String(l))}`).join("&");o+=(o.includes("?")?"&":"?")+c}return a&&k?`${k}${o}`:o}function dg(){for(let e of Object.keys(f))delete f[e];k=""}import F from"fs";import q from"path";function pg(e,t={}){return{type:"redirect",path:e,options:{replace:t.replace??!1,external:t.external??!1,redirectCode:t.redirectCode??302}}}function fg(e){return{type:"abort",error:typeof e==="string"?{statusCode:500,message:e}:e}}function gg(e,t={}){return{handler:e,mode:t.mode??"universal"}}function O(e){let t={};if(!e)return t;let a=e.split(";");for(let r of a){let[n,...o]=r.split("=");if(n){let i=n.trim(),c=o.join("=").trim();if(i)t[i]=decodeURIComponent(c)}}return t}function S(e,t,a={}){let r=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(a.expires){let n=typeof a.expires==="number"?new Date(Date.now()+a.expires*1000):a.expires;r+=`; Expires=${n.toUTCString()}`}if(a.path)r+=`; Path=${a.path}`;if(a.domain)r+=`; Domain=${a.domain}`;if(a.secure)r+="; Secure";if(a.httpOnly)r+="; HttpOnly";if(a.sameSite)r+=`; SameSite=${a.sameSite}`;return r}function Fc(e,t){let a=e.headers.get("cookie")||"",r=O(a);return{get(n){return r[n]},set(n,o,i={}){r[n]=o,t.append("Set-Cookie",S(n,o,i))},delete(n){delete r[n],t.append("Set-Cookie",S(n,"",{expires:new Date(0),path:"/"}))},getAll(){return{...r}}}}function zc(){return{get(e){if(typeof document>"u")return;return O(document.cookie)[e]},set(e,t,a={}){if(typeof document>"u")return;document.cookie=S(e,t,a)},delete(e){if(typeof document>"u")return;document.cookie=S(e,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return O(document.cookie)}}}function Hc(){let e=typeof window<"u"&&typeof window.localStorage<"u";return{get(t){if(!e)return null;try{return window.localStorage.getItem(t)}catch{return null}},set(t,a){if(!e)return;try{window.localStorage.setItem(t,a)}catch{}},remove(t){if(!e)return;try{window.localStorage.removeItem(t)}catch{}},isAvailable(){return e}}}var v=new Map;function hi(e,t){v.set(e,t)}function Vc(e){return v.get(e)}function mg(e){return v.has(e)}function Rt(){v.clear()}function At(){return Array.from(v.keys())}async function Pt(e,t="middleware"){let a=q.resolve(e,t);if(!F.existsSync(a))return;let r=F.readdirSync(a);for(let n of r){if(!n.endsWith(".ts")&&!n.endsWith(".js"))continue;if(n.includes(".test.")||n.includes(".spec."))continue;let o=n.replace(/\.(ts|js)$/,""),i=q.join(a,n);try{let s=(await import(i)).default;if(s&&typeof s.handler==="function")hi(o,s);else if(typeof s==="function")hi(o,{handler:s,mode:"universal"})}catch(c){console.warn(`Failed to load middleware '${o}' from ${i}:`,c)}}}function K(e){let t={};if(!e)return t;let a=new URLSearchParams(e);for(let[r,n]of a)t[r]=n;return t}function It(e,t,a,r=""){return{path:e,params:t,query:K(r),fullPath:r?`${e}?${r}`:e,meta:a}}function Ot(e,t,a,r){let n=r?.isServer??typeof window>"u",o=!n,i=new Headers;return{to:e,from:t,isClient:o,isServer:n,cookies:n&&a?Fc(a,i):zc(),storage:Hc(),state:{},request:a,responseHeaders:i}}async function Nt(e,t){let a=Array.isArray(e)?e:[e],r=t.isServer;for(let n of a){let o=Vc(n);if(!o)return console.error(`Route middleware '${n}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${n}' is not registered`}},state:t.state,responseHeaders:t.responseHeaders};if(o.mode==="server"&&!r)continue;try{let i=await o.handler(t);if(i){if(i.type==="redirect")return{passed:!1,redirect:i,state:t.state,responseHeaders:t.responseHeaders};if(i.type==="abort")return{passed:!1,abort:i,state:t.state,responseHeaders:t.responseHeaders}}}catch(i){return console.error(`Error in middleware '${n}':`,i),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:i instanceof Error?i.message:"Middleware error"}},state:t.state,responseHeaders:t.responseHeaders}}}return{passed:!0,state:t.state,responseHeaders:t.responseHeaders}}function js(e){let a=e.replace(/\\/g,"/").split("/").filter(Boolean),r=a.lastIndexOf("layouts"),n=r>=0?a[r+1]:a.at(-1);if(!n)return"app";return n.replace(/\.stx$/i,"")||"app"}function it(e){let t=e.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),a=e.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),r=e.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),n=t?.[1]||r?.[1]||"";return{layout:n,group:a?.[1]||js(n)}}var A,C;function W(e){let t=[],a="log(",r=0;while(r<e.length){let n=e.indexOf("log(",r);if(n===-1){t.push(e.slice(r));break}let o=n>0?e[n-1]:" ",i=/\bfunction\s+$/.test(e.slice(Math.max(0,n-16),n));if(/[\w$.]/.test(o)||i){t.push(e.slice(r,n+4)),r=n+4;continue}t.push(e.slice(r,n));let c=1,s=n+4;while(s<e.length&&c>0){let l=e[s];if(l==='"'||l==="'"||l==="`"){let d=l;s++;while(s<e.length&&e[s]!==d){if(e[s]==="\\")s++;s++}s++;continue}if(l==="(")c++;else if(l===")")c--;s++}t.push("0"),r=s}return t.join("")}function U(e,t=!1){try{return new Bun.Transpiler(t?{loader:"js",minify:{whitespace:!0,identifiers:!0}}:{loader:"js",minifyWhitespace:!0}).transformSync(e).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return e}}function H(){return`
|
|
2
|
+
import x from"fs";import u from"path";import p from"fs";import w from"path";var y=["components","layouts","partials","emails"];function M(e){return e.split(/[\\/]/).filter(Boolean).slice(0,-1).some((a)=>y.includes(a))}function b(e){return M(e.replace(/^\//,""))}function xi(e,t){let a=e.filter((i)=>!b(i.pattern)),r=["// Auto-generated by STX - do not edit"];if(a.length===0)r.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{r.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let i of a){let c=[];for(let l of i.params){let d=i.pattern.includes(`:${l}?`)?"?":"";c.push(`${l}${d}: string`)}let s=c.join("; ");r.push(` '${i.pattern}': { ${s} }`)}r.push(" }","}","","export {}","")}let n=r.join(`
|
|
3
|
+
`),o=w.join(t,"route-types.d.ts");try{if(p.existsSync(o)&&p.readFileSync(o,"utf8")===n)return;p.mkdirSync(t,{recursive:!0}),p.writeFileSync(o,n)}catch{}}function Si(e,t,a){let r=process.cwd(),n=w.relative(r,a),o=e.filter((c)=>!b(c.pattern)),i=["// Auto-generated by stx \u2014 do not edit",`// Source: ${n||"pages"}/`,"","export const routes = ["];for(let c of o){let s=w.relative(r,c.filePath).replace(/\\/g,"/"),l=JSON.stringify(c.params),d=c.layout?`, layout: '${w.relative(r,c.layout).replace(/\\/g,"/")}'`:"";i.push(` { pattern: '${c.pattern}', filePath: '${s}', isDynamic: ${c.isDynamic}, params: ${l}${d} },`)}i.push("] as const",""),i.push("export type RouteName = typeof routes[number]['pattern']",""),p.mkdirSync(t,{recursive:!0}),p.writeFileSync(w.join(t,"routes.ts"),i.join(`
|
|
4
|
+
`))}import I from"path";var N=Object.freeze(["ico","png","jpg","jpeg","gif","webp","avif","svg","bmp","tif","tiff","heic","css","js","mjs","cjs","map","wasm","webmanifest","json","xml","txt","rss","atom","woff","woff2","ttf","otf","eot","mp3","mp4","m4a","m4v","mov","webm","ogg","ogv","oga","wav","flac","avi","mkv","pdf","csv","doc","docx","xls","xlsx","ppt","pptx","rtf","odt","zip","gz","tgz","tar","rar","7z","bz2","xz","php","phtml","asp","aspx","jsp","cgi","env","ini","yml","yaml","toml","sql","bak","old","swp","log","conf","cfg","exe","dmg","pkg","apk","ipa","msi","iso","bin","dll"]),D=N.flatMap((e)=>e===e.toUpperCase()?[e]:[e,e.toUpperCase()]).join("|"),G=new RegExp(`\\.(?:${D})$`),E=`(?![^/]*\\.(?:${D})$)`;function Nt(e){let t=e,a=t.search(/[?#]/);if(a!==-1)t=t.slice(0,a);let r=t.slice(t.lastIndexOf("/")+1);return r.length>0&&G.test(r)}function R(e,t){let r=I.relative(t,e).replace(/\.(stx|md)$/,"");if(r=r.split(I.sep).join("/"),r==="index")return"/";if(r.endsWith("/index"))r=r.slice(0,-6);return r=r.replace(/\[\[([^\]]+)\]\]/g,":$1?"),r=r.replace(/\[([^\]]+)\]/g,":$1"),r=r.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${r}`}function ve(e,t={}){let a=t.page?E:"",r=[],n="",o=0;while(o<e.length){let i=e.slice(o),c=/^\/:([^/?*]+)\?/.exec(i);if(c){r.push(c[1]);let d=o+c[0].length===e.length;n+=`(?:/${d?a:""}([^/]+))?`,o+=c[0].length;continue}let s=/^:([^/?*]+)\*/.exec(i);if(s){r.push(s[1]),n+="(.+)",o+=s[0].length;continue}let l=/^:([^/?*]+)/.exec(i);if(l){r.push(l[1]);let d=o+l[0].length===e.length;n+=`${d?a:""}([^/]+)`,o+=l[0].length;continue}n+=e[o].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),o+=1}return{regex:new RegExp(`^${n}$`),params:r}}function Cr(e,t){let a=e===""?"/":e;for(let r of t){let n=a.match(r.regex);if(n){let o={};return r.params.forEach((i,c)=>{o[i]=n[c+1]}),{route:r,params:o}}}return null}function zs(e,t={}){let a=e.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return ve(a,t)}import X from"fs";import L from"path";function _(e,t){let a=[],r=L.dirname(e);while(r.startsWith(t)||r===t){let n=L.join(r,"_layout.stx");if(X.existsSync(n))a.unshift(n);if(r===t)break;r=L.dirname(r)}return a}function B(e,t){let a=[];if(!x.existsSync(e))return a;let r=x.readdirSync(e,{withFileTypes:!0});for(let n of r){let o=u.join(e,n.name);if(n.isDirectory()){if(n.name.startsWith("."))continue;if(y.includes(n.name))continue;a.push(...B(o,t))}else if(n.isFile()){let i=u.extname(n.name);if(t.includes(i)){if(n.name.startsWith("_")&&n.name!=="_layout.stx")continue;if(n.name==="_layout.stx")continue;a.push(o)}}}return a}class Er{routes;pagesDir;pagesDirs;config;constructor(e,t={}){this.config=t;let a=t.pagesDirs&&t.pagesDirs.length>0?t.pagesDirs:[t.pagesDir||"pages"];this.pagesDirs=a.map((s)=>u.resolve(e,s)),this.pagesDir=this.pagesDirs[0];let r=t.extensions||[".stx"],n=(s)=>{let l=u.resolve(e,s);try{return x.realpathSync(l)}catch{return l}},o=(t.exclude??[]).filter((s)=>typeof s==="string"&&s.trim()!=="").map(n),i=(s)=>{if(o.length===0)return!1;let l=n(s);return o.some((d)=>l===d||l.startsWith(`${d}${u.sep}`))},c=new Set;this.routes=[];for(let s of this.pagesDirs){let l=B(s,r).filter((h)=>!i(h)),d=new Map;for(let h of l){let g=R(h,s),m=t.pagesDirs?g.replace(/:[\w]+/g,":param"):g;if(t.pagesDirs&&d.has(m))throw Error(`Conflicting layer pages for ${g}: ${d.get(m)} and ${h}`);if(d.set(m,h),c.has(m))continue;c.add(m);let{regex:j,params:O}=ve(g,{page:!0}),T=t.layouts!==!1?_(h,s):[];this.routes.push({pattern:g,regex:j,params:O,filePath:h,isDynamic:O.length>0,layout:T.length>0?T[T.length-1]:void 0})}}if(this.routes.sort((s,l)=>{if(!s.isDynamic&&l.isDynamic)return-1;if(s.isDynamic&&!l.isDynamic)return 1;let d=s.pattern.split("/").length,h=l.pattern.split("/").length;if(d!==h)return h-d;return s.pattern.localeCompare(l.pattern)}),t.emit!==!1){let s=u.resolve(e,t.stateDir||process.env.STX_DIR?.trim()||".stx");xi(this.routes,s),Si(this.routes,s,this.pagesDir)}}match(e){let t=e===""?"/":e;for(let a of this.routes){let r=t.match(a.regex);if(r){let n={};return a.params.forEach((o,i)=>{n[o]=r[i+1]}),{route:a,params:n}}}return null}resolve(e,t){let a=this.routes.find((n)=>n.pattern===e||n.filePath.includes(e));if(!a)return"#not-found";let r=a.pattern;if(t)for(let[n,o]of Object.entries(t))r=r.replace(`:${n}`,encodeURIComponent(o));return r}addRoute(e){this.routes.push(e),this.routes.sort((t,a)=>{if(!t.isDynamic&&a.isDynamic)return-1;if(t.isDynamic&&!a.isDynamic)return 1;return t.pattern.localeCompare(a.pattern)})}getLayout(e){return e.layout??null}}function Hs(e,t){let a=[`${t}.stx`,"error.stx"];for(let r of a){let n=u.join(e,r);if(x.existsSync(n))return n}return null}function Vs(e,t){return e.map((a)=>{let r=u.relative(t,a.filePath),n=a.isDynamic?" (dynamic)":"";return`${a.pattern} \u2192 ${r}${n}`})}var f={},k="";function bg(e){k=e.replace(/\/$/,"")}function wg(e,t,a={}){f[e]={path:t,name:e,params:a}}function vg(e){for(let[t,a]of Object.entries(e))if(typeof a==="string")f[t]={path:a,name:t};else f[t]={...a,name:t}}function Tr(e,t={},a=!1){let r=f[e];if(!r)return console.warn(`Route [${e}] not defined.`),"#undefined-route";let n={...r.params,...t},o=r.path;o=o.replace(/:(\w+)/g,(c,s)=>{let l=n[s];if(l===void 0)return console.warn(`Missing parameter [${s}] for route [${e}].`),`:${s}`;return delete n[s],encodeURIComponent(String(l))});let i=Object.entries(n);if(i.length>0){let c=i.map(([s,l])=>`${encodeURIComponent(s)}=${encodeURIComponent(String(l))}`).join("&");o+=(o.includes("?")?"&":"?")+c}return a&&k?`${k}${o}`:o}function xg(){for(let e of Object.keys(f))delete f[e];k=""}import F from"fs";import q from"path";function Sg(e,t={}){return{type:"redirect",path:e,options:{replace:t.replace??!1,external:t.external??!1,redirectCode:t.redirectCode??302}}}function kg(e){return{type:"abort",error:typeof e==="string"?{statusCode:500,message:e}:e}}function _g(e,t={}){return{handler:e,mode:t.mode??"universal"}}function P(e){let t={};if(!e)return t;let a=e.split(";");for(let r of a){let[n,...o]=r.split("=");if(n){let i=n.trim(),c=o.join("=").trim();if(i)t[i]=decodeURIComponent(c)}}return t}function S(e,t,a={}){let r=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(a.expires){let n=typeof a.expires==="number"?new Date(Date.now()+a.expires*1000):a.expires;r+=`; Expires=${n.toUTCString()}`}if(a.path)r+=`; Path=${a.path}`;if(a.domain)r+=`; Domain=${a.domain}`;if(a.secure)r+="; Secure";if(a.httpOnly)r+="; HttpOnly";if(a.sameSite)r+=`; SameSite=${a.sameSite}`;return r}function Gc(e,t){let a=e.headers.get("cookie")||"",r=P(a);return{get(n){return r[n]},set(n,o,i={}){r[n]=o,t.append("Set-Cookie",S(n,o,i))},delete(n){delete r[n],t.append("Set-Cookie",S(n,"",{expires:new Date(0),path:"/"}))},getAll(){return{...r}}}}function Xc(){return{get(e){if(typeof document>"u")return;return P(document.cookie)[e]},set(e,t,a={}){if(typeof document>"u")return;document.cookie=S(e,t,a)},delete(e){if(typeof document>"u")return;document.cookie=S(e,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return P(document.cookie)}}}function Jc(){let e=typeof window<"u"&&typeof window.localStorage<"u";return{get(t){if(!e)return null;try{return window.localStorage.getItem(t)}catch{return null}},set(t,a){if(!e)return;try{window.localStorage.setItem(t,a)}catch{}},remove(t){if(!e)return;try{window.localStorage.removeItem(t)}catch{}},isAvailable(){return e}}}var v=new Map;function ki(e,t){v.set(e,t)}function Yc(e){return v.get(e)}function Cg(e){return v.has(e)}function Mt(){v.clear()}function Dt(){return Array.from(v.keys())}async function Lt(e,t="middleware"){let a=q.resolve(e,t);if(!F.existsSync(a))return;let r=F.readdirSync(a);for(let n of r){if(!n.endsWith(".ts")&&!n.endsWith(".js"))continue;if(n.includes(".test.")||n.includes(".spec."))continue;let o=n.replace(/\.(ts|js)$/,""),i=q.join(a,n);try{let s=(await import(i)).default;if(s&&typeof s.handler==="function")ki(o,s);else if(typeof s==="function")ki(o,{handler:s,mode:"universal"})}catch(c){console.warn(`Failed to load middleware '${o}' from ${i}:`,c)}}}function K(e){let t={};if(!e)return t;let a=new URLSearchParams(e);for(let[r,n]of a)t[r]=n;return t}function jt(e,t,a,r=""){return{path:e,params:t,query:K(r),fullPath:r?`${e}?${r}`:e,meta:a}}function Bt(e,t,a,r){let n=r?.isServer??typeof window>"u",o=!n,i=new Headers;return{to:e,from:t,isClient:o,isServer:n,cookies:n&&a?Gc(a,i):Xc(),storage:Jc(),state:{},request:a,responseHeaders:i}}async function Ft(e,t){let a=Array.isArray(e)?e:[e],r=t.isServer;for(let n of a){let o=Yc(n);if(!o)return console.error(`Route middleware '${n}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${n}' is not registered`}},state:t.state,responseHeaders:t.responseHeaders};if(o.mode==="server"&&!r)continue;try{let i=await o.handler(t);if(i){if(i.type==="redirect")return{passed:!1,redirect:i,state:t.state,responseHeaders:t.responseHeaders};if(i.type==="abort")return{passed:!1,abort:i,state:t.state,responseHeaders:t.responseHeaders}}}catch(i){return console.error(`Error in middleware '${n}':`,i),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:i instanceof Error?i.message:"Middleware error"}},state:t.state,responseHeaders:t.responseHeaders}}}return{passed:!0,state:t.state,responseHeaders:t.responseHeaders}}function Us(e){let a=e.replace(/\\/g,"/").split("/").filter(Boolean),r=a.lastIndexOf("layouts"),n=r>=0?a[r+1]:a.at(-1);if(!n)return"app";return n.replace(/\.stx$/i,"")||"app"}function dt(e){let t=e.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),a=e.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),r=e.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),n=t?.[1]||r?.[1]||"";return{layout:n,group:a?.[1]||Us(n)}}var A,C;function W(e){let t=[],a="log(",r=0;while(r<e.length){let n=e.indexOf("log(",r);if(n===-1){t.push(e.slice(r));break}let o=n>0?e[n-1]:" ",i=/\bfunction\s+$/.test(e.slice(Math.max(0,n-16),n));if(/[\w$.]/.test(o)||i){t.push(e.slice(r,n+4)),r=n+4;continue}t.push(e.slice(r,n));let c=1,s=n+4;while(s<e.length&&c>0){let l=e[s];if(l==='"'||l==="'"||l==="`"){let d=l;s++;while(s<e.length&&e[s]!==d){if(e[s]==="\\")s++;s++}s++;continue}if(l==="(")c++;else if(l===")")c--;s++}t.push("0"),r=s}return t.join("")}function U(e,t=!1){try{return new Bun.Transpiler(t?{loader:"js",minify:{whitespace:!0,identifiers:!0,syntax:!0}}:{loader:"js",minifyWhitespace:!0}).transformSync(e).replace(/\}(var |let |const |function )/g,"};$1").replace(/<\/script/gi,"<\\/script").trim()}catch{return e}}function H(){return`
|
|
5
5
|
;(function(){
|
|
6
6
|
'use strict';
|
|
7
7
|
var ROUTER_REV=8;
|
|
@@ -349,11 +349,13 @@ import x from"fs";import u from"path";import p from"fs";import w from"path";var
|
|
|
349
349
|
// with no animation) until they all have, capped so it can never hang.
|
|
350
350
|
var scriptsPending=0;
|
|
351
351
|
var hydrateWaiters=[];
|
|
352
|
-
|
|
352
|
+
var moduleCompletions={},moduleCompletionId=0;
|
|
353
|
+
window.__stxScriptRan=function(token){
|
|
354
|
+
if(token&&moduleCompletions[token]){var done=moduleCompletions[token];delete moduleCompletions[token];done();}
|
|
353
355
|
if(scriptsPending>0)scriptsPending--;
|
|
354
356
|
if(!scriptsPending){var w=hydrateWaiters;hydrateWaiters=[];w.forEach(function(f){f()})}
|
|
355
357
|
};
|
|
356
|
-
function markRan(code){scriptsPending++;return code+String.fromCharCode(10)+';window.__stxScriptRan&&window.__stxScriptRan();'}
|
|
358
|
+
function markRan(code,complete){scriptsPending++;var token=complete?'module-'+(++moduleCompletionId):'';if(complete)moduleCompletions[token]=complete;return code+String.fromCharCode(10)+';window.__stxScriptRan&&window.__stxScriptRan('+(token?JSON.stringify(token):'')+');'}
|
|
357
359
|
function whenHydrated(capMs){
|
|
358
360
|
return new Promise(function(resolve){
|
|
359
361
|
var done=false;
|
|
@@ -1066,7 +1068,7 @@ import x from"fs";import u from"path";import p from"fs";import w from"path";var
|
|
|
1066
1068
|
var el=source;
|
|
1067
1069
|
if(typeof source==='string')el=new DOMParser().parseFromString('<scr'+'ipt '+source+'></scr'+'ipt>','text/html').querySelector('script');
|
|
1068
1070
|
var attrs={};
|
|
1069
|
-
if(el)['src','type','integrity','crossorigin','referrerpolicy','nonce','nomodule','defer','fetchpriority','blocking'].forEach(function(name){
|
|
1071
|
+
if(el)['src','type','integrity','crossorigin','referrerpolicy','nonce','nomodule','defer','fetchpriority','blocking','data-stx-module-job'].forEach(function(name){
|
|
1070
1072
|
if(el.hasAttribute(name))attrs[name]=name==='nonce'?(el.nonce||el.getAttribute(name)||''):(el.getAttribute(name)||'');
|
|
1071
1073
|
});
|
|
1072
1074
|
return attrs;
|
|
@@ -1107,6 +1109,25 @@ import x from"fs";import u from"path";import p from"fs";import w from"path";var
|
|
|
1107
1109
|
// Waits for the files a swap loads, then runs its scripts -- or, when one
|
|
1108
1110
|
// of them was a module bundle that did not load, recovers the page instead
|
|
1109
1111
|
// of running a setup that can only throw.
|
|
1112
|
+
// Classic entries stay synchronous. Once an ESM entry starts, execute the
|
|
1113
|
+
// rest only after its load event (which includes top-level await) completes.
|
|
1114
|
+
function runPageScriptEntries(entries,execute,complete,ctx){
|
|
1115
|
+
function current(){return !ctx||!ctx.id||ctx.id===navSeq}
|
|
1116
|
+
function run(entry){if(current())return execute(entry)}
|
|
1117
|
+
var pending=null;
|
|
1118
|
+
entries.forEach(function(entry){
|
|
1119
|
+
if(pending)pending=pending.then(function(){return run(entry)});
|
|
1120
|
+
else {var result=run(entry);if(result)pending=Promise.resolve(result)}
|
|
1121
|
+
});
|
|
1122
|
+
function finish(){
|
|
1123
|
+
if(!current())return;
|
|
1124
|
+
var ready=window.__stxPageModulesReady;
|
|
1125
|
+
if(ready){window.__stxPageModulesReady=null;return ready.then(function(){if(current())complete()},function(error){console.error('[router] page initialization failed',error)})}
|
|
1126
|
+
complete();
|
|
1127
|
+
}
|
|
1128
|
+
if(pending)return pending.then(finish,function(error){console.error('[router] page module failed',error)});
|
|
1129
|
+
return finish();
|
|
1130
|
+
}
|
|
1110
1131
|
function afterExternalScripts(pending,run,url,ctx){
|
|
1111
1132
|
if(!pending.length){run();return}
|
|
1112
1133
|
var failed=false;
|
|
@@ -1819,7 +1840,7 @@ else {
|
|
|
1819
1840
|
// incoming page's scripts register next (see beginSwap in the runtime).
|
|
1820
1841
|
// Called after the outgoing page is put aside and before any incoming
|
|
1821
1842
|
// script runs. Absent on an older runtime, which drains as it always has.
|
|
1822
|
-
function beginPageSwap(){if(window.stx&&typeof window.stx._beginSwap==='function')window.stx._beginSwap()}
|
|
1843
|
+
function beginPageSwap(){window.__stxPageModulesReady=null;if(window.stx&&typeof window.stx._beginSwap==='function')window.stx._beginSwap()}
|
|
1823
1844
|
function swap(html,url,pushState,hash){
|
|
1824
1845
|
var fragMark=/^<!--stx-fragment(?: rt=([01]))?-->/.exec(html);
|
|
1825
1846
|
var isFragment=!!fragMark;
|
|
@@ -1892,7 +1913,7 @@ else {
|
|
|
1892
1913
|
var ownerDecl=(attrs.match(/data-stx-owner\\s*=\\s*["']([^"']+)["']/i)||[])[1]||'';
|
|
1893
1914
|
var registry=/(?:^|\\s)data-stx-modules(?:\\s|=|$)/i.test(attrs)||REGISTRY_TEXT.test(code);
|
|
1894
1915
|
var composables=/(?:^|\\s)data-stx-(?:framework-)?composables(?:\\s|=|$)/i.test(attrs)||COMPOSABLES_TEXT.test(code);
|
|
1895
|
-
fragScripts.push({text:code,slot:slot,setupName:generatedSetupName(code),scoped:scoped,run:runDecl?runDecl.toLowerCase():'',owner:ownerDecl,registry:registry,composables:composables});
|
|
1916
|
+
fragScripts.push({text:code,slot:slot,setupName:generatedSetupName(code),scoped:scoped,run:runDecl?runDecl.toLowerCase():'',owner:ownerDecl,registry:registry,composables:composables,module:scriptType==='module',moduleJob:externalAttrs['data-stx-module-job']||''});
|
|
1896
1917
|
// Retain scoped setup code in its inert placeholder. A placeholder
|
|
1897
1918
|
// inside template.content is unreachable through document, so the
|
|
1898
1919
|
// repeated component runtime must execute it for each clone.
|
|
@@ -1900,6 +1921,7 @@ else {
|
|
|
1900
1921
|
+(scoped?' data-stx-scoped':'')
|
|
1901
1922
|
+(runDecl?' data-stx-run="'+runDecl.toLowerCase()+'"':'')
|
|
1902
1923
|
+(ownerDecl?' data-stx-owner="'+ownerDecl+'"':'')
|
|
1924
|
+
+(externalAttrs['data-stx-module-job']?' data-stx-module-job="'+externalAttrs['data-stx-module-job']+'"':'')
|
|
1903
1925
|
+'>'+code+'<\\/scr'+'ipt>';
|
|
1904
1926
|
}
|
|
1905
1927
|
return '';
|
|
@@ -1987,7 +2009,7 @@ else {
|
|
|
1987
2009
|
function fragOrder(entry){return entry.registry?0:entry.composables?1:entry.setupName?3:2}
|
|
1988
2010
|
fragScripts.sort(function(a,b){return fragOrder(a)-fragOrder(b)});
|
|
1989
2011
|
function runFragScripts(){
|
|
1990
|
-
fragScripts
|
|
2012
|
+
return runPageScriptEntries(fragScripts,function(entry){
|
|
1991
2013
|
var code=entry.text;
|
|
1992
2014
|
log('[router] exec script len:', code.length, 'has __stx_setup:', code.indexOf('__stx_setup')>-1);
|
|
1993
2015
|
if(branchSlots&&branchSlots[entry.slot]){
|
|
@@ -2033,11 +2055,14 @@ else {
|
|
|
2033
2055
|
}
|
|
2034
2056
|
executedScriptHashes[h]=1;
|
|
2035
2057
|
var ns=ce('script');
|
|
2036
|
-
var hasImport=hasStaticImport(code);
|
|
2058
|
+
var hasImport=entry.module||hasStaticImport(code);
|
|
2037
2059
|
if(hasImport){
|
|
2038
2060
|
ns.type='module';
|
|
2039
2061
|
}
|
|
2040
|
-
|
|
2062
|
+
var moduleDone;
|
|
2063
|
+
var modulePending=hasImport?new Promise(function(resolve,reject){moduleDone=resolve;ns.onerror=reject}):null;
|
|
2064
|
+
if(entry.moduleJob)ns.setAttribute('data-stx-module-job',entry.moduleJob);
|
|
2065
|
+
ns.textContent=markRan((hasImport||isAlreadyScoped)?code:'{'+code+'}',moduleDone);
|
|
2041
2066
|
ns.setAttribute('data-stx-page','');
|
|
2042
2067
|
if(placeholder&&placeholder.parentNode){
|
|
2043
2068
|
ns.setAttribute('data-stx-positioned','');
|
|
@@ -2045,7 +2070,8 @@ else {
|
|
|
2045
2070
|
}else{
|
|
2046
2071
|
document.body.appendChild(ns);
|
|
2047
2072
|
}
|
|
2048
|
-
|
|
2073
|
+
return modulePending;
|
|
2074
|
+
},function(){
|
|
2049
2075
|
// Guarded: the router ships on every page, the signals runtime only on
|
|
2050
2076
|
// pages that have a client script. log() is debug-gated but its
|
|
2051
2077
|
// ARGUMENTS are evaluated at the call site regardless, so an unguarded
|
|
@@ -2054,6 +2080,7 @@ else {
|
|
|
2054
2080
|
log('[router] scripts done. _latestSetup:', !!(window.stx&&window.stx._latestSetup));
|
|
2055
2081
|
// THEN fire stx:load \u2014 now _latestSetup is set and processElement has the right scope
|
|
2056
2082
|
window.dispatchEvent(new Event('stx:load'));
|
|
2083
|
+
},ctx);
|
|
2057
2084
|
}
|
|
2058
2085
|
// The container's own files first, for the same reason as the
|
|
2059
2086
|
// full-document path: the inline scripts call into them. Only awaited
|
|
@@ -2280,7 +2307,7 @@ else {
|
|
|
2280
2307
|
var slot='document-'+(++routedBodyScriptId);
|
|
2281
2308
|
var setupName=generatedSetupName(text);
|
|
2282
2309
|
if(setupName)incomingSetupName=setupName;
|
|
2283
|
-
routedBodyScripts.push({text:text,runAlways:true,slot:slot,setupName:setupName,run:s.getAttribute('data-stx-run')||'',owner:s.getAttribute('data-stx-owner')||'',registry:isModuleRegistryScript(s),composables:isComposablesScript(s)});
|
|
2310
|
+
routedBodyScripts.push({text:text,runAlways:true,slot:slot,setupName:setupName,run:s.getAttribute('data-stx-run')||'',owner:s.getAttribute('data-stx-owner')||'',registry:isModuleRegistryScript(s),composables:isComposablesScript(s),module:type==='module',moduleJob:s.getAttribute('data-stx-module-job')||''});
|
|
2284
2311
|
s.textContent='';
|
|
2285
2312
|
s.setAttribute('type','application/stx-pending');
|
|
2286
2313
|
s.setAttribute('data-stx-route-script',slot);
|
|
@@ -2356,8 +2383,8 @@ else {
|
|
|
2356
2383
|
qsa('script[data-stx-page]').forEach(function(s){s.remove()});
|
|
2357
2384
|
|
|
2358
2385
|
var scripts=routedBodyScripts.slice();
|
|
2359
|
-
function addScript(text, runAlways, slot, owner){
|
|
2360
|
-
scripts.push({text:text,runAlways:!!runAlways,slot:slot||'',owner:owner||'',registry
|
|
2386
|
+
function addScript(text, runAlways, slot, owner, module, moduleJob, registry, composables){
|
|
2387
|
+
scripts.push({text:text,runAlways:!!runAlways,slot:slot||'',owner:owner||'',registry:!!registry||REGISTRY_TEXT.test(text),composables:!!composables||COMPOSABLES_TEXT.test(text),module:!!module,moduleJob:moduleJob||''});
|
|
2361
2388
|
}
|
|
2362
2389
|
if(isLayoutChange){
|
|
2363
2390
|
// Also collect setup functions from <head>, and the page's module
|
|
@@ -2373,7 +2400,7 @@ else {
|
|
|
2373
2400
|
if(s.hasAttribute('src'))return;
|
|
2374
2401
|
if(!text.trim())return;
|
|
2375
2402
|
if(isSignalsRuntimeScript(s,text))return;
|
|
2376
|
-
if(isModuleRegistryScript(s)||isComposablesScript(s))addScript(text,true,'','');
|
|
2403
|
+
if(isModuleRegistryScript(s)||isComposablesScript(s))addScript(text,true,'','',s.type==='module',s.getAttribute('data-stx-module-job'),isModuleRegistryScript(s),isComposablesScript(s));
|
|
2377
2404
|
else if(text.indexOf('__stx_setup_')!==-1)addScript(text,true);
|
|
2378
2405
|
});
|
|
2379
2406
|
} else {
|
|
@@ -2382,7 +2409,7 @@ else {
|
|
|
2382
2409
|
// in <head>. Without this, SPA navigation on static sites never
|
|
2383
2410
|
// runs the setup and reactive data stays empty.
|
|
2384
2411
|
var seenSetups={};
|
|
2385
|
-
scripts.forEach(function(entry){var t=entry.text;if(t.indexOf('__stx_setup_')!==-1)seenSetups[t
|
|
2412
|
+
scripts.forEach(function(entry){var t=entry.text;if(t.indexOf('__stx_setup_')!==-1)seenSetups[t]=1});
|
|
2386
2413
|
doc.querySelectorAll('script').forEach(function(s){
|
|
2387
2414
|
var text=s.textContent||'';
|
|
2388
2415
|
if(s.hasAttribute('src'))return;
|
|
@@ -2404,12 +2431,12 @@ else {
|
|
|
2404
2431
|
// incoming page's content (#1958). Fragments leave these out.
|
|
2405
2432
|
if(s.hasAttribute('data-stx-instance'))return;
|
|
2406
2433
|
if(text.indexOf('__stx_setup_')===-1&&!s.hasAttribute('data-stx-scoped')&&!s.hasAttribute('data-stx-page')&&!s.hasAttribute('data-stx-route-params'))return;
|
|
2407
|
-
var key=text
|
|
2434
|
+
var key=text;
|
|
2408
2435
|
if(seenSetups[key])return;
|
|
2409
2436
|
seenSetups[key]=1;
|
|
2410
2437
|
// A layout component outside the container carries its owner, so
|
|
2411
2438
|
// execScripts skips it when it stayed on the page (#1958).
|
|
2412
|
-
addScript(text,true,'',s.getAttribute('data-stx-owner')||'');
|
|
2439
|
+
addScript(text,true,'',s.getAttribute('data-stx-owner')||'',s.type==='module',s.getAttribute('data-stx-module-job'),isModuleRegistryScript(s),isComposablesScript(s));
|
|
2413
2440
|
});
|
|
2414
2441
|
}
|
|
2415
2442
|
// Component setup scripts also assign window.stx._latestSetup. Run the
|
|
@@ -2492,7 +2519,7 @@ else {
|
|
|
2492
2519
|
// onMount -- HQ's calendar wrote ?athlete_id into /relax. Fragments
|
|
2493
2520
|
// never hit this only because the server prepends the same clear.
|
|
2494
2521
|
if(window.stx)window.stx._latestSetup=null;
|
|
2495
|
-
scripts
|
|
2522
|
+
return runPageScriptEntries(scripts,function(entry){
|
|
2496
2523
|
var text=typeof entry==='string'?entry:entry.text;
|
|
2497
2524
|
var runAlways=typeof entry==='string'?false:entry.runAlways;
|
|
2498
2525
|
if(typeof entry!=='string'&&ownerStays(entry.owner))return;
|
|
@@ -2504,7 +2531,7 @@ else {
|
|
|
2504
2531
|
// need special handling.
|
|
2505
2532
|
var h=hashScript(text);
|
|
2506
2533
|
var isSetup=text.indexOf('__stx_setup_')!==-1;
|
|
2507
|
-
var hasImport=hasStaticImport(text);
|
|
2534
|
+
var hasImport=entry.module||hasStaticImport(text);
|
|
2508
2535
|
if(!runAlways&&!isSetup&&executedScriptHashes[h])return;
|
|
2509
2536
|
executedScriptHashes[h]=1;
|
|
2510
2537
|
// Wrap scripts with import statements as modules (Bug 3 fix)
|
|
@@ -2519,7 +2546,10 @@ else {
|
|
|
2519
2546
|
// ESM, and top-level 'import' is illegal inside a block, which
|
|
2520
2547
|
// would throw SyntaxError before the script ever runs.
|
|
2521
2548
|
var alreadyScoped=runsAlways(typeof entry==='string'?'':entry.run,text);
|
|
2522
|
-
|
|
2549
|
+
var moduleDone;
|
|
2550
|
+
var modulePending=hasImport?new Promise(function(resolve,reject){moduleDone=resolve;ns.onerror=reject}):null;
|
|
2551
|
+
if(entry.moduleJob)ns.setAttribute('data-stx-module-job',entry.moduleJob);
|
|
2552
|
+
ns.textContent=markRan((hasImport||alreadyScoped)?text:'{'+text+republishTopLevel(text)+'}',moduleDone);
|
|
2523
2553
|
ns.setAttribute('data-stx-page','');
|
|
2524
2554
|
var placeholder=entry.slot?qs('script[data-stx-route-script="'+entry.slot+'"]'):null;
|
|
2525
2555
|
if(placeholder&&placeholder.parentNode){
|
|
@@ -2528,9 +2558,11 @@ else {
|
|
|
2528
2558
|
}else{
|
|
2529
2559
|
document.body.appendChild(ns);
|
|
2530
2560
|
}
|
|
2531
|
-
|
|
2561
|
+
return modulePending;
|
|
2562
|
+
},function(){
|
|
2532
2563
|
// THEN fire stx:load \u2014 now _latestSetup is set and processElement has the right scope
|
|
2533
2564
|
window.dispatchEvent(new Event('stx:load'));
|
|
2565
|
+
},ctx);
|
|
2534
2566
|
}
|
|
2535
2567
|
|
|
2536
2568
|
afterExternalScripts(extPromises,execScripts,url+(hash||''),ctx);
|
|
@@ -2779,9 +2811,9 @@ else {
|
|
|
2779
2811
|
// reach the other.
|
|
2780
2812
|
var retagSeq=0;
|
|
2781
2813
|
function retagCollisions(html){
|
|
2782
|
-
var ids={},
|
|
2783
|
-
html.replace(/data-stx-scope="([^"]+)"/g,function(m,id){ids[id]=1;
|
|
2784
|
-
if(!
|
|
2814
|
+
var ids={},found=false;
|
|
2815
|
+
html.replace(/data-stx-scope="([^"]+)"/g,function(m,id){ids[id]=1;found=true;return m});
|
|
2816
|
+
if(!found)return;
|
|
2785
2817
|
var scopes=window.stx&&window.stx._scopes;
|
|
2786
2818
|
eachEntry(function(e){
|
|
2787
2819
|
if(!e.el)return;
|
|
@@ -4184,4 +4216,4 @@ else {
|
|
|
4184
4216
|
|
|
4185
4217
|
if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);else init();
|
|
4186
4218
|
})();
|
|
4187
|
-
`}function
|
|
4219
|
+
`}function pt(){if(A)return A;return A=U(W(H()),!0),A}function Eg(){if(C)return C;return C=U(H()),C}export{xi,Si,Nt,ve,Cr,zs,Er,Hs,Vs,bg,wg,vg,Tr,xg,Sg,kg,_g,Gc,Xc,Jc,ki,Yc,Cg,Mt,Dt,Lt,jt,Bt,Ft,Us,dt,pt,Eg};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{m,p}from"./chunk-
|
|
3
|
-
export{
|
|
2
|
+
import{m,p}from"./chunk-86nsbxep.js";import{se,B,g}from"./chunk-p55a910x.js";function z(t,o){let i=1,r=o,e="<template",n="</template";while(r<t.length&&i>0){let s=t.indexOf("<",r);if(s===-1)break;if(r=s,t.startsWith(e,r)&&(r+e.length>=t.length||/[\s>\/]/.test(t[r+e.length]))){i++,r+=e.length;continue}if(t.startsWith(n,r)){let a=t.indexOf(">",r+n.length);if(a!==-1){if(i--,i===0)return a+1;r=a+1;continue}}r++}return i===0?r:-1}var N=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function k(t,o){let i=null;for(let r=o;r<t.length;r++){let e=t[r];if(i){if(e==="\\"){r++;continue}if(e===i)i=null;continue}if(e==='"'||e==="'"){i=e;continue}if(e===">")return r+1}return-1}function Z(t,o,i){let r=o.toLowerCase(),e=1,n=i;while(n<t.length){let s=t.indexOf("<",n);if(s===-1)return-1;if(t.startsWith("<!--",s)){let f=t.indexOf("-->",s+4);n=f===-1?t.length:f+3;continue}let a=k(t,s+1);if(a===-1)return-1;let u=t.slice(s,a),c=u.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(c&&c[2].toLowerCase()===r){if(c[1]==="/"){if(e--,e===0)return a}else if(!/\/\s*>$/.test(u))e++}n=a}return-1}function L(t){let o=[],i=[],r=/\bslot\s*=\s*(?:"([^"]+)"|'([^']+)')/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let l=t.indexOf("-->",n+4);e=l===-1?t.length:l+3;continue}let s=k(t,n+1);if(s===-1)break;let a=t.slice(n,s),u=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!u){e=s;continue}let c=u[2].toLowerCase();if(u[1]==="/"){let l=i.lastIndexOf(c);if(l!==-1)i.splice(l);e=s;continue}let f=/\/\s*>$/.test(a),d=i.length===0?a.match(r):null;if(d){let l=d[1]||d[2],h=a.replace(r,"").replace(/\s+(?=\/?>$)/,"").replace(/\s{2,}/g," "),S=f||N.has(c)?-1:Z(t,c,s);if(S===-1)o.push({start:n,end:s,slotName:l,element:h}),e=s;else o.push({start:n,end:S,slotName:l,element:h+t.slice(s,S)}),e=S;continue}if(!f&&!N.has(c)){if(i.push(c),c==="script"||c==="style"){let l=t.toLowerCase().indexOf(`</${c}>`,s);if(l!==-1){e=l;continue}}}e=s}return o}function j(t){let o=[],i=[],r=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let l=t.indexOf("-->",n+4);e=l===-1?t.length:l+3;continue}let s=k(t,n+1);if(s===-1)break;let a=t.slice(n,s),u=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!u){e=s;continue}let c=u[1]==="/",f=u[2].toLowerCase();if(c){let l=i.lastIndexOf(f);if(l!==-1)i.splice(l);e=s;continue}if(f==="template"&&i.length===0){let l=a.match(r);if(l){let h=z(t,s);if(h!==-1){let S=l[1]||l[2]||l[3];o.push({start:n,end:h,slotName:S,content:t.slice(s,h-11).trim(),propsBinding:l[4]||void 0}),e=h;continue}}}if(!/\/\s*>$/.test(a)&&!N.has(f)){if(i.push(f),f==="script"||f==="style"){let l=t.toLowerCase().indexOf(`</${f}>`,s);if(l!==-1){e=l;continue}}}e=s}return o}function gu(t){let o={default:"",named:new Map},i=t,r=j(t);for(let n of r)o.named.set(n.slotName,{name:n.slotName,content:n.content,propsBinding:n.propsBinding});r.sort((n,s)=>s.start-n.start);for(let n of r)i=i.slice(0,n.start)+i.slice(n.end);let e=L(i);for(let n of e){let s=o.named.get(n.slotName);if(s)s.content+=n.element;else o.named.set(n.slotName,{name:n.slotName,content:n.element})}for(let n=e.length-1;n>=0;n--){let s=e[n];i=i.slice(0,s.start)+i.slice(s.end)}return o.default=i.trim(),o}function Um(t){let o=t.match(/name\s*=\s*["']([^"']+)["']/),i=o?o[1]:"",r={},e=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,n;while((n=e.exec(t))!==null)r[n[1]]=n[2];let s=t.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),a=s?s[1].trim():"";return{name:i,props:r,defaultContent:a}}async function mu(t,o,i,r){if(!t)return i;let e=t.content;if(t.propsBinding&&Object.keys(o).length>0){let n=t.propsBinding.trim(),s={...r},a=new Set,u=new Set;if(n.startsWith("{")&&n.endsWith("}")){let c=n.slice(1,-1).split(",").map((f)=>f.trim()).filter(Boolean);for(let f of c){let[d,l]=f.split(":").map((S)=>S.trim()),h=l||d;if(s[h]=o[d],o[d]!==void 0)u.add(h);else a.add(h)}}else if(s[n]=o,Object.values(o).some((c)=>c===void 0))a.add(n);else u.add(n);e=I(e,s,a,u)}return e}function I(t,o,i,r){return t.replace(/\{\{\s*([^}]+)\s*\}\}/g,(e,n)=>{try{let s=n.trim();if(B(s,i))return e;if(Array.isArray(o.__stx_preserved_client_expressions)&&o.__stx_preserved_client_expressions.includes(s)&&!B(s,r))return e;let a=_(s,o);if(a===void 0)return e;return g(String(a??""))}catch{return`{{ ${n} }}`}})}function _(t,o){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(t)){let r=t.split("."),e=o;for(let n of r)if(e&&typeof e==="object"&&n in e)e=e[n];else return;return e}let i=t.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(i){let[,r,e,n]=i,s=o[r],a=parseInt(n,10);if(typeof s==="number")switch(e){case"+":return s+a;case"-":return s-a;case"*":return s*a;case"/":return s/a}}try{if(!m(t))return;return p(t,Object.keys(o))(...Object.values(o))}catch{return}}async function hu(t,o,i,r){let e=t;e=await W(e,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(a,u,c,f)=>{let d=o.named.get(u),l=f?.trim()||"",h=c||"",S={},E=[],C=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,b;while((b=C.exec(h))!==null){let w=b[1],x=b[2];S[w]=_(x,i),E.push([w,x])}if(r!==void 0&&d?.propsBinding&&Object.values(S).some((w)=>w===void 0)){let w=d.propsBinding.trim(),x=se(`${w} in []`),y="__stx_slot_props";while(x.includes(y))y+="_";let M=E.map(([A,P])=>{let O=S[A],R;try{R=O===void 0?void 0:JSON.stringify(O)}catch{}return`${JSON.stringify(A)}:(${R??P})`}).join(","),v=g(JSON.stringify({binding:w,names:x,owner:r}));return`<template :for="${g(`${y} in [{${M}}]`)}" data-stx-slot-binding="${encodeURIComponent(w)}" data-stx-slot-scope="${v}">${d.content}</template>`}return await mu(d,S,l,i)});let s=/<slot\b((?:"[^"]*"|'[^']*'|[^>"'])*?)\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return e=e.replace(s,(a,u,c)=>{if(/\bname\s*=/.test(u||""))return a;let f=c?.trim()||"";return o.default||f}),e}async function W(t,o,i){let r=[],e=[];t.replace(o,(a,...u)=>{let c=u[u.length-2];return e.push({match:a,index:c}),r.push(i(a,...u.slice(0,-2))),a});let n=await Promise.all(r),s=t;for(let a=e.length-1;a>=0;a--){let{match:u,index:c}=e[a];s=s.slice(0,c)+n[a]+s.slice(c+u.length)}return s}function Wm(t){let o=gu(t);return{defaultSlot:o.default,namedSlots:o.named}}async function qm(t,o,i,r,e){return await hu(t,{default:o,named:i},r,e)}
|
|
3
|
+
export{gu,Um,mu,hu,Wm,qm};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Z}from"./chunk-nb6erf75.js";import R from"path";var B=/__stxModules\["((?:[^"\\]|\\.)*)"\]/g;function Yr(...d){let g=new Set;for(let l of d){if(!l||!l.includes("__stxModules["))continue;for(let e of l.matchAll(B))try{g.add(JSON.parse(`"${e[1]}"`))}catch{}}return[...g].sort()}function So(...d){let g=new Map,l=(e,n)=>{let o=g.get(e);if(o===null)return;if(n===null){g.set(e,null);return}let s=o??new Set;for(let i of n)s.add(i);g.set(e,s)};for(let e of d){if(!e||!e.includes("__stxModules["))continue;let n=[];for(let s of e.matchAll(/([\w$]+)\s*=\s*globalThis\.__stxModules\s*&&\s*globalThis\.__stxModules\["((?:[^"\\]|\\.)*)"\]/g)){let i;try{i=JSON.parse(`"${s[2]}"`)}catch{continue}n.push({variable:s[1],id:i,start:s.index+s[0].length,end:e.length})}let o=e.match(/__stxModules\["(?:[^"\\]|\\.)*"\]/g)?.length??0;if(n.length===0||o!==n.length){for(let s of Yr(e))l(s,null);continue}for(let[s,i]of n.entries()){let p=n.slice(s+1).find((h)=>h.variable===i.variable);i.end=p?p.start:e.length}for(let s of n){let i=new Set,p=!1,h=s.variable.replace(/[$]/g,"\\$&"),r=e.slice(s.start,s.end);for(let a of r.matchAll(new RegExp(`(?<![\\w$.])${h}(?![\\w$])`,"g"))){let f=r.slice(a.index+s.variable.length,a.index+s.variable.length+200),c=/^\s*\[\s*(["'])([A-Za-z_$][\w$]*)\1\s*\]/.exec(f)??/^\s*\.\s*([A-Za-z_$][\w$]*)/.exec(f);if(c){i.add(c[c.length-1]);continue}if(/^\s*[!=]==?\s*(?:undefined|void 0)\b/.test(f))continue;p=!0;break}l(s.id,p?null:i)}}return g}function k(d,g,l){let e=[],n=[];return d.forEach((o,s)=>{let i=o.startsWith("npm:")?o.slice(4):R.resolve(g,o),p=`__stxRegistered${s}`,h=JSON.stringify(o),r=l?.get(o);if(r&&[...r].every((a)=>/^[A-Za-z_$][\w$]*$/.test(a))){let a=[...r].sort(),f=a.map((m,_)=>`${m} as ${p}_${_}`);e.push(a.length>0?`import { ${f.join(", ")} } from ${JSON.stringify(i)};`:`import ${JSON.stringify(i)};`);let c=a.map((m,_)=>`get ${JSON.stringify(m)}() { return ${p}_${_}; }`).join(", ");n.push(`if (!globalThis.__stxModules[${h}]) globalThis.__stxModules[${h}] = { ${c} };`);return}e.push(`import * as ${p} from ${JSON.stringify(i)};`),n.push(`if (!globalThis.__stxModules[${h}]) globalThis.__stxModules[${h}] = ${p};`)}),[...e,"globalThis.__stxModules = globalThis.__stxModules || {};",...n].join(`
|
|
3
|
+
`)}async function gm(d,g={}){if(d.length===0)return null;let l=process.cwd(),e=k(d,l,g.names),n;try{let{bundleClientScript:f}=await import("./chunk-3zds0gmd.js"),c=()=>f(e,R.join(l,".stx-module-registry.ts"),{projectRoot:l,minify:g.minify,externalizeUserModules:!1,collectInputs:g.collectInputs,throwOnFailure:!0});try{n=await c()}catch(m){if(!g.names)throw m;e=k(d,l,void 0),n=await c()}}catch(f){let{formatBuildFailure:c}=await import("./chunk-qg1kw5yf.js"),m=c(f);console.warn(`[stx] could not build the page module registry (#1957): ${m}`);let _=`[stx] the page module registry did not build, so ${d.join(", ")} cannot load (#1957): ${m}`;return`;console.error(${JSON.stringify(_)});`}let{transformAutoImports:o,generateAutoImportDestructuring:s}=await import("./chunk-2d68p12e.js"),i=o(n),p=s(i.stxImports,i.browserImports),{transformStoreImports:h}=await import("./chunk-aqxh80vh.js");n=h(i.code);let r=JSON.stringify(new Bun.CryptoHasher("md5").update(e).digest("hex").slice(0,12)),a=Z(n);return[a?";await (async function() {":";(function() {"," var __stxBundles = globalThis.__stxModuleBundles || (globalThis.__stxModuleBundles = {});",` if (__stxBundles[${r}]) { ${a?"await __stxBundles["+r+"];":""} return; }`,a?`var __resolveBundle, __rejectBundle;
|
|
4
|
+
__stxBundles[${r}]=new Promise(function(resolve,reject){__resolveBundle=resolve;__rejectBundle=reject;});
|
|
5
|
+
__stxBundles[${r}].catch(function(){});
|
|
6
|
+
try {`:`__stxBundles[${r}] = true;`,p,n,a?`__resolveBundle();
|
|
7
|
+
} catch(error) { delete __stxBundles[${r}]; __rejectBundle(error); throw error; }`:"","})();"].join(`
|
|
8
|
+
`)}var j=/^import(?:[ \t]*(\{[^}]*\})[ \t]*from|[ \t]*\*[ \t]*as[ \t]+([\w$]+)[ \t]+from)?[ \t]*["']\.\/(chunk-[\w-]+)\.js["'][ \t]*;?[ \t]*$/gm,O=/^export\s*\{([^}]*)\}\s*;?[ \t]*$/gm,I=new Set(["__preload","__chunks"]),N=/^("[^"]*"|[\w$]+)(?:\s+as\s+("[^"]*"|[\w$]+))?$/;function P(d){let g=[],l=[],e=!0,o=d.replace(/^var __chunkGraphs;[\s\S]*?^var __chunks = [\s\S]*?^\};[ \t]*\n?/m,"").replace(/^__chunks\(import\.meta\.url,[^\n]*\);[ \t]*\n?/gm,"").replace(j,(h,r,a,f)=>{let c=`__stxChunkExports${g.length}`;if(g.push(f),l.push(`var ${c} = __stxChunk(${JSON.stringify(f)});`),a)l.push(`var ${a} = ${c};`);else if(r)for(let m of r.slice(1,-1).split(",")){let _=m.trim();if(!_)continue;let w=N.exec(_);if(!w){e=!1;continue}if(I.has(w[1]))continue;let M=w[1].startsWith('"')?JSON.parse(w[1]):w[1],t=w[2]??w[1];if(t.startsWith('"')){e=!1;continue}l.push(`var ${t} = ${c}[${JSON.stringify(M)}];`)}return""});if(!e)throw Error("an import it does not read");let s=[];o=o.replace(/\(\s*__preload\([^)]*\)\s*,\s*import\(\s*["']\.\/(chunk-[\w-]+)\.js["']\s*\)\s*\)|\bimport\(\s*["']\.\/(chunk-[\w-]+)\.js["']\s*\)/g,(h,r,a)=>{let f=r??a;return s.push(f),`Promise.resolve().then(function () { return __stxChunk(${JSON.stringify(f)}); })`});let i=[];o=o.replace(O,(h,r)=>{for(let a of r.split(",")){let f=a.trim();if(!f)continue;let c=N.exec(f);if(!c||c[1].startsWith('"')){e=!1;continue}if(I.has(c[1]))continue;let m=c[2]??c[1];i.push([c[1],m.startsWith('"')?JSON.parse(m):m])}return""});let p=[/\bimport\.meta\b/,/\b__chunks\b/,/\b__preload\b/,/^\s*export\s+(?:default\b|const\b|let\b|var\b|function\b|class\b|async\b|\*|\{)/m,/\bfrom\s*["']\.\/chunk-/,/^\s*import\s*["']\.\/chunk-/m].find((h)=>h.test(o));if(!e||p)throw Error(`${p?`${p.source} is left in it`:"an export it does not read"}`);return{reads:l.join(`
|
|
9
|
+
`),chunks:g,lazy:s,body:o,exports:i}}function Zl(d){if(/\bexport\s+(?:let|var)\b/.test(d))return!0;if(d.length/Math.max(1,d.split(`
|
|
10
|
+
`).length)>200)return!1;for(let g of d.matchAll(/\bexport\s*\{([^}]*)\}(?!\s*from\b)/g))for(let l of g[1].split(",")){let e=l.trim().split(/\s+as\s+/)[0].trim();if(!/^[A-Za-z_$][\w$]*$/.test(e))continue;let n=e.replace(/[$]/g,"\\$&");if(!new RegExp(`(?<![\\w$.])(?:let|var)\\s+${n}(?![\\w$])`,"g").test(d))continue;let s=new RegExp(`(?<![\\w$.])${n}\\s*(?:=(?![=>])|[-+*/%&|^]=|\\*\\*=|<<=|>>>?=|&&=|\\|\\|=|\\?\\?=|\\+\\+|--)|(?:\\+\\+|--)\\s*${n}(?![\\w$])`,"g"),i=new RegExp(`(?<![\\w$.])(?:let|var|const)\\s+${n}\\s*=`,"g");if((d.match(s)?.length??0)>(d.match(i)?.length??0))return!0}return!1}async function ko(d,g={}){let l=d.filter((n)=>n.ids.length>0);if(l.length===0)return{chunks:new Map,routes:new Map,reads:new Map};let e=process.cwd();try{let{bundleClientEntriesSplit:n}=await import("./chunk-3zds0gmd.js"),o=[],s=await n(new Map(l.map((t)=>[t.name,k(t.ids,e,t.names)])),{projectRoot:e,filePath:R.join(e,".stx-module-registry.ts"),collectInputs:o});g.collectInputs?.push(...o);let{transformAutoImports:i,generateAutoImportDestructuring:p}=await import("./chunk-2d68p12e.js"),{transformStoreImports:h}=await import("./chunk-aqxh80vh.js"),r=new Map;for(let[t,u]of[...s.chunks,...s.entries])try{r.set(t,P(u))}catch(x){throw Error(`cannot read ${t}: ${x instanceof Error?x.message:String(x)}`)}for(let[t,u]of[...s.chunks,...s.entries])if(/\b__esm\(/.test(u))throw Error(`${t} initialises a module lazily`);for(let t of o)if(/\.(?:[cm]?[jt]sx?)$/.test(t)&&Zl(await Bun.file(t).text()))throw Error(`${t} exports a binding that changes after it is read`);let a=new Set,f=new Set,c=(t)=>{if(f.has(t))return;if(a.has(t))throw Error(`the chunks import each other (${t})`);a.add(t);for(let u of r.get(t)?.chunks??[]){if(!r.has(u))throw Error(`${t} imports ${u}, which was not built`);c(u)}for(let u of r.get(t)?.lazy??[])if(!r.has(u))throw Error(`${t} imports ${u}, which was not built`);a.delete(t),f.add(t)};for(let t of r.keys())c(t);let m=(t)=>{let u=i(t.body);return{prelude:p(u.stxImports,u.browserImports),body:h(u.code)}},_=new Map;for(let t of s.chunks.keys()){let u=r.get(t),{prelude:x,body:v}=m(u),b=u.exports.map(([S,y])=>`get ${JSON.stringify(y)}() { return ${S}; }`).join(", ");_.set(t,`function (__stxChunk) {
|
|
11
|
+
${x}
|
|
12
|
+
${u.reads}
|
|
13
|
+
${v}
|
|
14
|
+
return { ${b} };
|
|
15
|
+
}`)}let w=new Map,M=new Map;for(let t of s.entries.keys()){let u=r.get(t),{prelude:x,body:v}=m(u);w.set(t,`;(function() {
|
|
16
|
+
var __stxChunk = function (name) { return globalThis.__stxNativeRuntime.chunk(name); };
|
|
17
|
+
${x}
|
|
18
|
+
${u.reads}
|
|
19
|
+
${v}
|
|
20
|
+
})();`);let b=new Set,S=(y)=>{if(b.has(y))return;b.add(y);let E=r.get(y);for(let A of[...E.chunks,...E.lazy])S(A)};for(let y of[...u.chunks,...u.lazy])S(y);M.set(t,[...b].sort())}return{chunks:_,routes:w,reads:M}}catch(n){let{formatBuildFailure:o}=await import("./chunk-qg1kw5yf.js");return console.warn(`[stx] could not share the native routes' modules, building each route's alone: ${o(n)}`),null}}
|
|
21
|
+
export{Yr,So,gm,Zl,ko};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Sm}from"./chunk-g83ph305.js";import"./chunk-ec5q4nnw.js";import"./chunk-mygsektn.js";import"./chunk-h63ma36g.js";import"./chunk-ssg6ne5b.js";import"./chunk-h2tq6cbr.js";import"./chunk-agd2b928.js";import"./chunk-p55a910x.js";import"./chunk-19k15mfc.js";import"./chunk-6t04tqvh.js";import"./chunk-86nsbxep.js";import"./chunk-hxhmhw23.js";import"./chunk-a60ztvnp.js";import"./chunk-s29hp1qw.js";import"./chunk-00tq7ghn.js";export{Sm as buildApp};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
var f=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),b=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);function l(i){return i.replace(/[^\n]/g," ")}function w(i){let o=i.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,l).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,l).replace(/<!--[\s\S]*?-->/g,l).replace(/\{\{\{[\s\S]*?\}\}\}/g,l).replace(/\{\{[\s\S]*?\}\}/g,l).replace(/\{!![\s\S]*?!!\}/g,l),s=new Map,r=new Map,p=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,t;while((t=p.exec(o))!==null){let e=t[1]==="/",n=t[2],a=t[3]==="/";if(f.has(n.toLowerCase()))continue;if(a)continue;if(e)r.set(n,(r.get(n)??0)+1);else{let g=s.get(n);if(g)g.count++;else{let d=o.slice(0,t.index).split(`
|
|
3
|
-
`).length;s.set(n,{count:1,firstLine:d})}}}let c=[];for(let e of new Set([...s.keys(),...r.keys()])){if(b.has(e.toLowerCase()))continue;let n=s.get(e)?.count??0,a=r.get(e)??0;if(n!==a)c.push({tag:e,opened:n,closed:a,firstOpenLine:s.get(e)?.firstLine??0})}return c}var u=new Set;function
|
|
4
|
-
export{
|
|
3
|
+
`).length;s.set(n,{count:1,firstLine:d})}}}let c=[];for(let e of new Set([...s.keys(),...r.keys()])){if(b.has(e.toLowerCase()))continue;let n=s.get(e)?.count??0,a=r.get(e)??0;if(n!==a)c.push({tag:e,opened:n,closed:a,firstOpenLine:s.get(e)?.firstLine??0})}return c}var u=new Set;function ei(i,o){let s;try{s=w(i)}catch{return}if(s.length===0)return;let r=`${o}:${i.length}`;if(u.has(r))return;u.add(r);let p=o?o.split(/[/\\]/).pop()||o:"template";for(let{tag:t,opened:c,closed:e,firstOpenLine:n}of s)if(c>e){let a=n?` (first opened at line ${n})`:"";console.warn(`[stx] ${p}: <${t}> ${c} opened, ${e} closed \u2014 an unclosed <${t}>${a} may swallow the content that follows it.`)}else console.warn(`[stx] ${p}: <${t}> ${c} opened, ${e} closed \u2014 ${e-c} stray </${t}>.`)}
|
|
4
|
+
export{ei};
|
|
@@ -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 Mo(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 qn(i={}){Mo(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{Mo,qn};
|