@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,14 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
class T{cache=new Map;maxSize;options;sizes;bytes=0;constructor(e=100,t){this.maxSize=e,this.options=t??null,this.sizes=t?new Map:null}get byteSize(){return this.bytes}setMaxBytes(e){if(!this.options)return;this.options={...this.options,maxBytes:e};while(this.bytes>e&&this.cache.size>0){let t=this.cache.keys().next().value;if(t===void 0)break;this.delete(t)}}get(e){if(!this.cache.has(e))return;let t=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,t),t}set(e,t){if(this.cache.has(e))this.delete(e);let i=this.options?this.options.sizeOf(t):0;if(this.options&&i>this.options.maxBytes)return;while(this.cache.size>0&&(this.cache.size>=this.maxSize||this.options!==null&&this.bytes+i>this.options.maxBytes)){let n=this.cache.keys().next().value;if(n===void 0)break;this.delete(n)}if(this.cache.set(e,t),this.sizes)this.sizes.set(e,i),this.bytes+=i}has(e){return this.cache.has(e)}delete(e){if(this.sizes){let t=this.sizes.get(e);if(t!==void 0)this.bytes-=t,this.sizes.delete(e)}return this.cache.delete(e)}clear(){this.cache.clear(),this.sizes?.clear(),this.bytes=0}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var o=new Map,x=500;function Qt(e,t){if(t?.includes("g"))return new RegExp(e,t);let i=`${e}:${t||""}`;if(!o.has(i)){if(o.size>=x){let n=o.keys().next().value;if(n)o.delete(n)}o.set(i,new RegExp(e,t))}return o.get(i)}class f{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(e){let t=Array.from(new Set(e)),i=t.sort().join(","),n=this.pool.find((s)=>s.context.join(",")===i);if(n)return n.func;let r=this.fnCache,c=this.fnCacheMaxSize,a=(...s)=>(u)=>{try{let h=`${i}:${u}`,l=r.get(h);if(!l){if(r.size>=c){let d=r.keys().next().value;if(d)r.delete(d)}l=Function(...t,`
|
|
3
|
+
'use strict';
|
|
4
|
+
try {
|
|
5
|
+
return ${u};
|
|
6
|
+
}
|
|
7
|
+
catch (e) {
|
|
8
|
+
if (e instanceof ReferenceError || e instanceof TypeError) {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
throw e;
|
|
12
|
+
}
|
|
13
|
+
`),r.set(h,l)}return l(...s)}catch{return}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:a,context:t.slice()});return a}clear(){this.pool.length=0,this.fnCache.clear()}}var v=new f;class p{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(e){this.enabled=e}isEnabled(){return this.enabled}setBudget(e,t){this.budgets.set(e,{warnThreshold:0.8,action:"warn",...t})}setBudgets(e){for(let[t,i]of Object.entries(e))this.setBudget(t,i)}removeBudget(e){this.budgets.delete(e)}getBudgets(){let e={};for(let[t,i]of this.budgets.entries())e[t]=i;return e}onViolation(e){this.violationHandlers.push(e)}offViolation(e){let t=this.violationHandlers.indexOf(e);if(t!==-1)this.violationHandlers.splice(t,1)}time(e,t){if(!this.enabled)return t();let i=performance.now(),n=t(),r=performance.now()-i;return this.recordTime(e,r),this.checkBudget(e,r),n}async timeAsync(e,t){if(!this.enabled)return t();let i=performance.now(),n=await t(),r=performance.now()-i;return this.recordTime(e,r),this.checkBudget(e,r),n}checkBudget(e,t){let i=this.budgets.get(e);if(!i)return;let n=t/i.maxTime*100,r=i.warnThreshold!==void 0?t>=i.maxTime*i.warnThreshold&&t<i.maxTime:!1,c=t>=i.maxTime;if(!r&&!c)return;let a={label:e,actualTime:t,budgetTime:i.maxTime,exceedancePercent:n,timestamp:new Date,isWarning:r};this.violations.push(a);while(this.violations.length>this.maxViolations)this.violations.shift();for(let u of this.violationHandlers)try{u(a)}catch{}let s=r?`[Performance Warning] "${e}" took ${t.toFixed(2)}ms (${n.toFixed(1)}% of ${i.maxTime}ms budget)`:`[Performance Budget Exceeded] "${e}" took ${t.toFixed(2)}ms (exceeded ${i.maxTime}ms budget by ${(n-100).toFixed(1)}%)`;switch(i.action){case"log":console.log(s);break;case"warn":console.warn(s);break;case"error":console.error(s);break;case"throw":if(c)throw Error(s);else console.warn(s);break}}recordTime(e,t){let i=this.metrics.get(e);if(i)i.count++,i.totalTime+=t,i.maxTime=Math.max(i.maxTime,t),i.minTime=Math.min(i.minTime,t);else this.metrics.set(e,{count:1,totalTime:t,maxTime:t,minTime:t})}getStats(e){if(e){let i=this.metrics.get(e);if(!i)return{};let n=this.budgets.get(e);return{count:i.count,avgTime:i.totalTime/i.count,totalTime:i.totalTime,maxTime:i.maxTime,minTime:i.minTime,budget:n?.maxTime,budgetUtilization:n?i.totalTime/i.count/n.maxTime*100:void 0}}let t={};for(let[i,n]of this.metrics.entries()){let r=this.budgets.get(i);t[i]={count:n.count,avgTime:n.totalTime/n.count,totalTime:n.totalTime,maxTime:n.maxTime,minTime:n.minTime,budget:r?.maxTime,budgetUtilization:r?n.totalTime/n.count/r.maxTime*100:void 0}}return t}getViolations(e){if(e)return this.violations.filter((t)=>t.label===e);return[...this.violations]}getViolationStats(){let e={},t=0,i=0;for(let n of this.violations)if(e[n.label]=(e[n.label]||0)+1,n.isWarning)t++;else i++;return{total:this.violations.length,byLabel:e,warnings:t,errors:i}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var m=null;function b(){if(!m)m=new p;return m}var ye=new Proxy({},{get(e,t){return b()[t]}});var g=0;async function R(){if(performance.now()-g<16)return;await new Promise((e)=>setTimeout(e,0)),g=performance.now()}
|
|
14
|
+
export{T,Qt,ye,R};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import i from"path";var kn=".stx",o="STX_DIR",e=null;function Zc(t){e=t?.trim()||null}function $r(){return process.env[o]?.trim()||e||kn}function l(t=process.cwd(),...n){let r=$r();return i.isAbsolute(r)?i.join(r,...n):i.join(t,r,...n)}function Rr(t){if(!t||i.isAbsolute(t))return t;let n=t.replace(/\\/g,"/");if(n!==kn&&!n.startsWith(`${kn}/`))return t;let r=n.slice(kn.length+1);return r?i.join($r(),r):$r()}
|
|
3
|
+
export{kn,Zc,$r,l,Rr};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{c}from"./chunk-
|
|
2
|
+
import{c}from"./chunk-xpbakn6t.js";function r(){return`<script data-stx-scoped data-stx-x-element-runtime data-stx-run="always">
|
|
3
3
|
(function() {
|
|
4
4
|
'use strict';
|
|
5
5
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
`)}async function
|
|
2
|
+
import{K,H,Gr,Xr,Jr}from"./chunk-ram5944w.js";import{resolve as Q,basename as G,extname as J,join as Y}from"path";import{mkdir as Z}from"fs/promises";var U={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0};class aa{config;constructor(t={}){this.config={...U,...t}}async get(t,e){return Gr(t,e,"video",this.config)}async set(t,e,a){return Xr(t,e,a,"video",this.config)}async clear(){return Jr("video",this.config)}updateConfig(t){this.config={...this.config,...t}}}var V=null;function B(t){if(!V)V=new aa(t);else if(t)V.updateConfig(t);return V}async function ca(t,e,a){let c=a?{directory:`${a.outputDir}/../.cache`}:{};return B(c).get(t,e)}async function la(t,e,a,c){let r=c?{directory:`${c.outputDir}/../.cache`}:{};return B(r).set(t,e,a)}async function dm(){return B().clear()}import{resolve as _,basename as D,extname as A,join as v}from"path";import{mkdir as M}from"fs/promises";async function L(){try{return await import("ts-videos")}catch{return null}}async function ua(t,e,a,c){let r=await L();if(!r)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let n=_(t);if(!await H(n))return null;await M(a,{recursive:!0});let i=await K(n),s=D(t,A(t)),o=e.format||"webp",h=e.timestamp||0,y=`${s}-poster-${i}.${o}`,u=v(a,y),m=await r.extractThumbnails(n,{timestamps:[h],width:e.width||1280,height:e.height,format:o,quality:e.quality||85,outputDir:a,outputPattern:y.replace(`.${o}`,"")});if(m&&m.length>0){let d=m[0];return{path:u,url:`${c}/${y}`,width:d.width||e.width||1280,height:d.height||720,timestamp:h,size:d.size||0}}return null}catch(n){return console.warn(`[stx-media] Failed to generate poster: ${n}`),null}}async function da(t,e,a,c){let r=await L();if(!r)return[];try{let n=_(t);if(!await H(n))return[];await M(a,{recursive:!0});let i=await K(n),s=D(t,A(t)),o=e.format||"webp",u=(await new r.Input(n).getInfo()).duration||60,m=e.count||10,d=e.interval||u/m,g=[];for(let f=0;f<m&&f*d<u;f++)g.push(f*d);let l=await r.extractThumbnails(n,{timestamps:g,width:e.width||320,format:o,quality:e.quality||80,outputDir:a,outputPattern:`${s}-thumb-${i}`});if(l&&l.length>0)return l.map((f,b)=>({path:f.path||v(a,`${s}-thumb-${i}-${b}.${o}`),url:`${c}/${s}-thumb-${i}-${b}.${o}`,width:f.width||e.width||320,height:f.height||180,timestamp:g[b],size:f.size||0}));return[]}catch(n){return console.warn(`[stx-media] Failed to generate thumbnails: ${n}`),[]}}async function pm(t,e,a,c){let r=await L();if(!r)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let n=_(t);if(!await H(n))return null;await M(a,{recursive:!0});let i=await K(n),s=D(t,A(t)),y=(await new r.Input(n).getInfo()).duration||60,u=e.columns||10,m=e.interval||5,d=e.thumbnailWidth||160,g=e.thumbnailHeight||90,l=e.format||"jpeg",f=Math.ceil(y/m),b=Math.ceil(f/u),S=`${s}-sprite-${i}.${l}`,w=v(a,S),C=[];for(let P=0;P<f;P++)C.push(P*m);let p=await r.extractThumbnails(n,{timestamps:C,width:d,height:g,format:l,quality:e.quality||70,outputDir:v(a,".temp")});if(!p||p.length===0)return null;try{let P=await import("ts-images"),x=u*d,ie=b*g,re=await P.createSprite({images:p.map((O)=>O.path),columns:u,padding:0,outputPath:w,format:l,quality:e.quality||70});return{url:`${c}/${S}`,path:w,columns:u,rows:b,thumbnailWidth:d,thumbnailHeight:g,interval:m,totalFrames:f}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(n){return console.warn(`[stx-media] Failed to generate sprite sheet: ${n}`),null}}import{resolve as E,basename as F,extname as W,join as R}from"path";import{mkdir as T,writeFile as q}from"fs/promises";async function z(){try{return await import("ts-videos")}catch{return null}}var j=[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000},{label:"360p",width:640,height:360,bitrate:600000,audioBitrate:64000}];async function pa(t,e,a,c,r){let n=await z();if(!n)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let i=E(t);if(!await H(i))return null;let s=await K(i),o=F(t,W(t)),h=R(a,`${o}-${s}-hls`);await T(h,{recursive:!0});let y=e.length>0?e:j,u=r?.segmentDuration||6,g=(await new n.Input(i).getInfo()).duration||0,l=[],f=0;for(let w of y){let C=R(h,w.label);await T(C,{recursive:!0});let p=`${w.label}.m3u8`,P=R(C,p);try{let x=await n.generateHLS(i,{outputDir:C,segmentDuration:u,width:w.width,height:w.height,videoBitrate:w.bitrate,audioBitrate:w.audioBitrate,playlistName:w.label});if(x)l.push({quality:w,url:`${c}/${o}-${s}-hls/${w.label}/${p}`,path:P}),f+=x.segmentCount||Math.ceil(g/u)}catch(x){console.warn(`[stx-media] Failed to generate HLS for ${w.label}: ${x}`)}}if(l.length===0)return null;let b=R(h,"master.m3u8"),S=N(l,c,o,s);return await q(b,S),{manifestUrl:`${c}/${o}-${s}-hls/master.m3u8`,manifestPath:b,playlists:l,segmentCount:f,duration:g}}catch(i){return console.warn(`[stx-media] Failed to generate HLS manifest: ${i}`),null}}function N(t,e,a,c){let r=["#EXTM3U","#EXT-X-VERSION:3"];for(let n of t){let{quality:i}=n,s=i.bitrate+(i.audioBitrate||128000),o=`${i.width}x${i.height||Math.round(i.width*9/16)}`;r.push(`#EXT-X-STREAM-INF:BANDWIDTH=${s},RESOLUTION=${o},NAME="${i.label}"`,`${i.label}/${i.label}.m3u8`)}return r.join(`
|
|
3
|
+
`)}async function fa(t,e,a,c,r){let n=await z();if(!n)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let i=E(t);if(!await H(i))return null;let s=await K(i),o=F(t,W(t)),h=R(a,`${o}-${s}-dash`);await T(h,{recursive:!0});let y=e.length>0?e:j,u=r?.segmentDuration||4,m=r?.minBufferTime||2,l=(await new n.Input(i).getInfo()).duration||0,f=[],b=[];for(let p of y){let P=R(h,p.label);await T(P,{recursive:!0});try{if(await n.generateDASH(i,{outputDir:P,segmentDuration:u,width:p.width,height:p.height,videoBitrate:p.bitrate,audioBitrate:p.audioBitrate})){if(f.push({bandwidth:p.bitrate,width:p.width,height:p.height||Math.round(p.width*9/16),url:`${c}/${o}-${s}-dash/${p.label}/video`}),p.audioBitrate)b.push({bandwidth:p.audioBitrate,url:`${c}/${o}-${s}-dash/${p.label}/audio`})}}catch(x){console.warn(`[stx-media] Failed to generate DASH for ${p.label}: ${x}`)}}if(f.length===0)return null;let S=R(h,"manifest.mpd"),w=X(f,b,l,u,m);await q(S,w);let C=[{type:"video",representations:f}];if(b.length>0)C.push({type:"audio",representations:b});return{manifestUrl:`${c}/${o}-${s}-dash/manifest.mpd`,manifestPath:S,adaptationSets:C,duration:l}}catch(i){return console.warn(`[stx-media] Failed to generate DASH manifest: ${i}`),null}}function X(t,e,a,c,r){let n=I(a),i=I(r),s=`<?xml version="1.0" encoding="UTF-8"?>
|
|
4
4
|
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
|
|
5
5
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
6
6
|
xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
|
|
@@ -26,4 +26,4 @@ import{q,z,Hr,Vr,Ur}from"./chunk-rzd9hyhv.js";import{resolve as k,basename as J,
|
|
|
26
26
|
</Representation>
|
|
27
27
|
`}s+=` </AdaptationSet>
|
|
28
28
|
`}return s+=` </Period>
|
|
29
|
-
</MPD>`,s}function
|
|
29
|
+
</MPD>`,s}function I(t){let e=Math.floor(t/3600),a=Math.floor(t%3600/60),c=Math.floor(t%60),r="PT";if(e>0)r+=`${e}H`;if(a>0)r+=`${a}M`;return r+=`${c}S`,r}async function k(){try{return await import("ts-videos")}catch{return null}}function ee(t){switch(t){case"very-low":return 500000;case"low":return 1e6;case"medium":return 2500000;case"high":return 5000000;case"very-high":return 1e7;case"lossless":return 0;default:return 2500000}}function te(t){switch(t){case"youtube":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};case"twitter":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"instagram-feed":return{codec:"h264",maxWidth:1080,maxHeight:1080,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"instagram-story":case"instagram-reels":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"tiktok":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"discord":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:60,bitrate:8000000,audioCodec:"aac",audioBitrate:192000};case"linkedin":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"facebook":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"web-progressive":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000,twoPass:!0};case"web-streaming":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};default:return{}}}async function Yl(t){let e=await k();if(!e)return null;try{let a=Q(t),r=await new e.Input(a).getInfo();return{duration:r.duration||0,width:r.width||0,height:r.height||0,frameRate:r.frameRate||0,bitrate:r.bitrate||0,codec:r.videoCodec||"",audioCodec:r.audioCodec}}catch(a){return console.warn(`[stx-media] Failed to analyze video: ${a}`),null}}async function fm(t,e,a,c){let r=await k();if(!r)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:t,processed:!1};let n=await ca(t,e,a);if(n)return n;try{let i=Q(t);if(!await H(i))return{src:t,processed:!1,errors:[`Source file not found: ${t}`]};let s=a.outputDir||"dist/videos",o=a.baseUrl||"/videos";await Z(s,{recursive:!0});let h=await K(i),y=G(t,J(t)),u={src:t,processed:!0,hash:h};c?.({percentage:5,stage:"analyzing"}),u.metadata=await Yl(i)||void 0;let m={};if(e.quality)m.bitrate=ee(e.quality);if(e.platform)Object.assign(m,te(e.platform));if(e.transcode)Object.assign(m,e.transcode);if(Object.keys(m).length>0||e.process){c?.({percentage:10,stage:"transcoding"});let d=`${y}-${h}.mp4`,g=Y(s,d);try{let l=await ae(i,g,m,r,(f)=>c?.({percentage:10+f*0.5,stage:"transcoding"}));if(l)u.transcoded={path:g,url:`${o}/${d}`,duration:l.duration,size:l.size,video:{codec:m.codec||"h264",width:l.width,height:l.height,bitrate:l.bitrate,frameRate:l.frameRate},audio:l.audioCodec?{codec:m.audioCodec||"aac",bitrate:m.audioBitrate||128000,sampleRate:m.sampleRate||48000,channels:m.channels||2}:void 0}}catch(l){u.errors=u.errors||[],u.errors.push(`Transcoding failed: ${l}`)}}if(e.generatePoster){c?.({percentage:65,stage:"generating-poster"});let d=typeof e.generatePoster==="object"?e.generatePoster:{timestamp:0},g=await ua(i,d,s,o);if(g)u.poster=g}if(a.thumbnails?.enabled){c?.({percentage:70,stage:"generating-thumbnails"});let d=await da(i,a.thumbnails,s,o);if(d.length>0)u.thumbnails=d}if(e.streaming){c?.({percentage:80,stage:"generating-manifests"});let d=typeof e.streaming==="object"?e.streaming:a.streaming||{format:"hls"};if(d.format==="hls"||d.format===void 0){let g=await pa(i,d.qualities||a.streaming?.defaultQualities||[],s,o);if(g)u.streaming={...u.streaming,hls:g}}if(d.format==="dash"){let g=await fa(i,d.qualities||a.streaming?.defaultQualities||[],s,o);if(g)u.streaming={...u.streaming,dash:g}}}if(e.spriteSheet)c?.({percentage:90,stage:"generating-sprite-sheet"});return c?.({percentage:100,stage:"complete"}),await la(t,e,u,a),u}catch(i){return{src:t,processed:!1,errors:[`Processing failed: ${i}`]}}}async function ae(t,e,a,c,r){try{let i=await new c.Conversion(t,e,{videoCodec:a.codec,videoBitrate:a.bitrate,width:a.maxWidth,height:a.maxHeight,frameRate:a.frameRate,audioCodec:a.audioCodec,audioBitrate:a.audioBitrate,sampleRate:a.sampleRate,channels:a.channels}).run((s)=>{r?.(s.percentage/100)});return{duration:i.duration||0,size:i.size||0,width:i.width||a.maxWidth||0,height:i.height||a.maxHeight||0,bitrate:i.bitrate||a.bitrate||0,frameRate:i.frameRate||a.frameRate||30,audioCodec:i.audioCodec}}catch(n){return console.error(`[stx-media] Transcoding failed: ${n}`),null}}export{aa,ca,la,dm,ua,da,pm,pa,fa,Yl,fm};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{existsSync as x,realpathSync as b,statSync as y}from"fs";import f from"path";import k from"process";var E=/^[\w-]+(?:\/[\w-]+)*$/,j=/^[\w-]+$/;async function
|
|
3
|
-
export default kept[${n}] || (kept[${n}] = {});`}var M=new Map;function
|
|
2
|
+
import{existsSync as x,realpathSync as b,statSync as y}from"fs";import f from"path";import k from"process";var E=/^[\w-]+(?:\/[\w-]+)*$/,j=/^[\w-]+$/;async function Zr(s,e){let n=f.resolve(s,e.dir);if(!e.languages?.length)throw Error("messages.languages must name at least one language");let a=new Map,r=new Map;for(let t of e.languages){if(!j.test(t))throw Error(`messages: "${t}" is not a language directory name`);let g=f.join(n,t);if(!x(g))throw Error(`messages: ${f.relative(s,g)} does not exist`);let o=new Map;for(let i of[...new Bun.Glob("**/*.{ts,js,mjs,json}").scanSync({cwd:g})].sort()){if(/\.(?:test|spec|d)\.[^.]+$/.test(i))continue;let l=i.replace(/\.[^./]+$/,"").split(f.sep).join("/");if(!E.test(l))throw Error(`messages: ${t}/${i} is not an area name`);if(o.has(l))throw Error(`messages: ${t}/${l} is defined twice`);let c=f.join(g,i),p=await import(c),m=Object.keys(p).filter((S)=>S!=="default");if(m.length)throw Error(`messages: ${t}/${i} exports ${m.join(", ")}; a message module exports its messages as default, and nothing else`);let u=p.default,d=u!==null&&typeof u==="object"&&!Array.isArray(u)?JSON.stringify(u):void 0;if(d===void 0||!Bun.deepEquals(JSON.parse(d),u,!0))throw Error(`messages: ${t}/${i} must export plain data (an object JSON can hold) as default`);o.set(l,d),a.set(c,{language:t,area:l})}r.set(t,o)}return{files:a,data:r}}function h(s,e){return`stx-messages:${s}:${e}`}function _(s,e){let n=JSON.stringify(h(s,e));return`var kept = globalThis.__stxMessages || (globalThis.__stxMessages = {});
|
|
3
|
+
export default kept[${n}] || (kept[${n}] = {});`}var M=new Map;function Qr(s){let e=[s];try{e.push(b(s))}catch{}for(let n of[...e])if(n.startsWith("/private/"))e.push(n.slice(8));return[...new Set(e)]}function mm(s,e=k.env){if(!s.messages||e.STX_PAGE_MESSAGES==="0")return!1;return e.STX_PAGE_MESSAGES==="1"||e.NODE_ENV==="production"}async function hm(s,e){let n=f.resolve(s,e.dir),a=e.languages.map((c)=>{try{return`${c}:${y(f.join(n,c)).mtimeMs}`}catch{return`${c}:-`}}).join("|"),r=`${n}\x00${e.languages.join(",")}\x00${e.fallback??""}`,t=M.get(r);if(t&&t.signature===a)return t.messages;let g=await Zr(s,e),o=new Map;for(let[c,{language:p,area:m}]of g.files){let u=_(p,m);for(let d of Qr(c))o.set(d,u)}let i=e.fallback??e.languages[0];if(!e.languages.includes(i))throw Error(`messages.fallback "${i}" is not one of messages.languages`);let l={...g,stubs:o,languages:[...e.languages],fallback:i};return M.set(r,{signature:a,messages:l}),l}function ym(...s){let e=new Set;for(let n of s){if(!n||!n.includes("stx-messages:"))continue;for(let a of n.matchAll(/stx-messages:[\w-]+:([\w/-]+)/g))e.add(a[1])}return e}function bm(s,e){let n=/<html\b[^>]*>/i.exec(s)?.[0]??"",a=/\slang\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i.exec(n),r=(a?a[1]??a[2]??a[3]??"":"").trim().toLowerCase(),t=new Map(e.languages.map((o)=>[o.toLowerCase(),o])),g=t.get(r)??t.get(r.split(/[-_]/)[0]??"");if(!g)return[...e.languages];return[...new Set([g,e.fallback])]}var w=new WeakMap;function wm(s,e,n){let a=[...n].sort(),r=w.get(s);if(!r)w.set(s,r=new Map);let t=`${e.join(",")}\x00${a.join(",")}`;if(r.has(t))return r.get(t);let g=P(s,e,a);return r.set(t,g),g}function P(s,e,n){let a=[];for(let r of e){let t=s.data.get(r);if(!t)continue;for(let g of n){let o=t.get(g);if(o!==void 0)a.push(`put(${JSON.stringify(h(r,g))},${JSON.stringify(o)})`)}}if(a.length===0)return null;return`;(function(){var kept=globalThis.__stxMessages||(globalThis.__stxMessages={}),filled=globalThis.__stxMessagesFilled||(globalThis.__stxMessagesFilled={});function put(key,json){if(filled[key])return;filled[key]=1;var into=kept[key]||(kept[key]={}),data=JSON.parse(json);for(var name in data)into[name]=data[name]}
|
|
4
4
|
${a.join(`;
|
|
5
5
|
`)};
|
|
6
6
|
})();`}
|
|
7
|
-
export{
|
|
7
|
+
export{Zr,Qr,mm,hm,ym,bm,wm};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import c from"fs";import i from"path";import{createHash as k}from"crypto";var j=["pages","components","layouts","partials","composables"],w=new Set;function
|
|
3
|
-
`)}`);let o=r.outputs.find((a)=>a.kind==="entry-point");if(!o||r.outputs.length!==1)throw Error(`Unsupported layer config output: ${e}`);let s=(await import(`data:text/javascript;base64,${Buffer.from(await o.text()).toString("base64")}`)).default;if(!x(s))throw Error(`Layer ${e} must default-export a config object`);return s}async function
|
|
4
|
-
`)}function
|
|
5
|
-
export{
|
|
2
|
+
import c from"fs";import i from"path";import{createHash as k}from"crypto";var j=["pages","components","layouts","partials","composables"],w=new Set;function Wc(e){try{return w.has(c.realpathSync(e))}catch{return w.has(i.resolve(e))}}var _=new Set(["extends","root",...j.map((e)=>`${e}Dir`),"publicDir","stateDir","cachePath"]),x=(e)=>e!==null&&typeof e==="object"&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null);function b(e,n,r=""){if(Array.isArray(n))return["middleware","plugins"].includes(r)?[...Array.isArray(e)?e:[],...n]:[...n];if(!x(n))return n;let o={...x(e)?e:{}};for(let[s,a]of Object.entries(n)){if(["__proto__","constructor","prototype"].includes(s))throw Error(`Invalid layer config key: ${s}`);o[s]=b(o[s],a,s)}return o}function v(e){for(let n of["stx.config.ts","stx.config.js","stx.config.mjs",".config/stx.config.ts",".config/stx.ts","ui.config.ts"]){let r=i.join(e,n);if(c.existsSync(r))return c.realpathSync(r)}throw Error(`Application layer has no stx.config.ts: ${e}`)}function E(e,n,r){if(typeof e!=="string"||!e||/^(?:https?:|git[+:])/.test(e))throw Error(`Invalid application layer ${JSON.stringify(e)} in ${n}; use a local path or installed package`);if(e.startsWith(".")||i.isAbsolute(e)){let s=i.resolve(n,e);return c.statSync(s).isDirectory()?v(s):c.realpathSync(s)}let o=n;while(!0){let s=i.join(o,"node_modules",e),a=i.join(s,"package.json");if(c.existsSync(a)){r.add(c.realpathSync(a));let g=JSON.parse(c.readFileSync(a,"utf8"));return g.stx?.layer?c.realpathSync(i.resolve(s,g.stx.layer)):v(s)}let p=i.dirname(o);if(p===o)break;o=p}throw Error(`Cannot resolve application layer ${JSON.stringify(e)} from ${n}`)}async function C(e,n){let r=await Bun.build({entrypoints:[e],target:"bun",format:"esm",splitting:!1,plugins:[{name:"stx-layer-config",setup(a){a.onResolve({filter:/^[^./]/},(p)=>{if(p.path.startsWith("node:"))return{path:p.path,external:!0};return{path:Bun.resolveSync(p.path,p.resolveDir),external:!0}}),a.onLoad({filter:/./},(p)=>{let g=c.realpathSync(p.path);n.add(g),w.add(g);return})}}]});if(!r.success)throw Error(`Cannot load layer ${e}: ${r.logs.join(`
|
|
3
|
+
`)}`);let o=r.outputs.find((a)=>a.kind==="entry-point");if(!o||r.outputs.length!==1)throw Error(`Unsupported layer config output: ${e}`);let s=(await import(`data:text/javascript;base64,${Buffer.from(await o.text()).toString("base64")}`)).default;if(!x(s))throw Error(`Layer ${e} must default-export a config object`);return s}async function qc(e,n){let r=new Set,o=[],s=[],a=new Set,p=[];async function g(t,l){if(t=c.realpathSync(t),p.includes(t))throw Error(`Application layer cycle: ${[...p,t].join(" -> ")}`);if(a.has(t))return;a.add(t),p.push(t);let d=await C(t,r);l??=i.basename(i.dirname(t))===".config"?i.dirname(i.dirname(t)):i.dirname(t),l=c.realpathSync(l);let D=i.resolve(l,d.root??"."),L=Object.fromEntries(j.map((y)=>[y,i.resolve(D,d[`${y}Dir`]??(y==="composables"?"functions":y))]));o.push({root:l,configFile:t,resources:L});let u={...d};if(u.plugins)u.plugins=u.plugins.map((y)=>{let h=typeof y==="string"?y:y[0],S=h.startsWith(".")?i.resolve(l,h):i.isAbsolute(h)?h:Bun.resolveSync(h,l);return r.add(c.realpathSync(S)),typeof y==="string"?S:[S,y[1]]});if(typeof u.css==="string")u.css=i.resolve(l,u.css);if(u.serverApi)u.serverApi={...typeof u.serverApi==="object"?u.serverApi:{},dir:i.resolve(l,typeof u.serverApi==="object"?u.serverApi.dir??"server/api":"server/api")};if(s.push(u),d.extends!==void 0&&!Array.isArray(d.extends))throw Error(`extends in ${t} must be an array`);for(let y of d.extends??[])await g(E(y,l,r));p.pop()}await g(v(e),e);for(let t of["package.json","bun.lock","package-lock.json","pnpm-lock.yaml"]){let l=i.join(e,t);if(c.existsSync(l))r.add(c.realpathSync(l))}let f=b({},n);for(let t=s.length-1;t>=0;t--){let l=t===0?s[t]:Object.fromEntries(Object.entries(s[t]).filter(([d])=>!_.has(d)));f=b(f,l)}let m={layers:o,configDependencies:[...r].sort()};return f._layerGraph=m,f._layerPageDirs=o.map((t)=>t.resources.pages),f._layerComponentDirs=o.map((t)=>t.resources.components),f._layerLayoutDirs=o.map((t)=>t.resources.layouts),f._layerPartialDirs=o.map((t)=>t.resources.partials),f._layerComposableDirs=o.map((t)=>t.resources.composables),await hi(m,e),{config:f,graph:m}}async function hi(e,n){let r=new Map,o=[];for(let s of e.layers)for(let[a,p]of Object.entries(s.resources)){if(!c.existsSync(p))continue;let g=new Bun.Glob(a==="composables"?"**/*.ts":"**/*.stx");for(let f of[...g.scanSync({cwd:p})].sort()){let m=`${a}/${f}`,t=i.join(p,f),l=r.get(m);if(l)o.push({resource:m,winner:l,shadowed:t});else r.set(m,t)}}Object.assign(e,{overrides:o}),await Bun.write(i.join(n,".stx/layers.json"),JSON.stringify(e,null,2))}function A(e){let n=new Set(e.configDependencies);function r(o){if(!c.existsSync(o))return;n.add(o);for(let s of c.readdirSync(o,{withFileTypes:!0}).sort((a,p)=>a.name.localeCompare(p.name))){if(s.name.startsWith(".")||s.name==="node_modules")continue;let a=i.join(o,s.name);if(s.isDirectory())r(a);else if(s.isFile())n.add(a)}}for(let o of e.layers)for(let s of Object.values(o.resources))r(s);return[...n].sort()}function Ds(e){return O(A(e))}function Ls(e){return O(e.configDependencies)}function O(e){return e.map((n)=>{try{let r=c.statSync(n);return`${n}:${r.mtimeMs}:${r.size}`}catch{return`${n}:missing`}}).join(`
|
|
4
|
+
`)}function Kc(e){return e.layers.map((n)=>({config:i.relative(n.root,n.configFile),files:A({layers:[n],configDependencies:e.configDependencies.filter((r)=>r.startsWith(`${n.root}${i.sep}`))}).filter((r)=>c.statSync(r).isFile()).map((r)=>({path:i.relative(n.root,r).replaceAll(i.sep,"/"),sha256:k("sha256").update(c.readFileSync(r)).digest("hex")}))}))}
|
|
5
|
+
export{Wc,qc,hi,Ds,Ls,Kc};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
function
|
|
2
|
+
function ja(v,c){let{itemHeight:l,containerHeight:u,overscan:s=3,keyProperty:b="id",dynamicHeight:d=!1,estimatedItemHeight:g=l,direction:x="vertical"}=c,e=[...v],t=0,n=new Map;function f(){if(d)return h();let i=Math.max(0,Math.floor(t/l)-s),r=Math.ceil(u/l),m=Math.min(e.length-1,i+r+s*2);return{startIndex:i,endIndex:m}}function h(){let i=0,r=0,m=e.length-1;for(let p=0;p<e.length;p++){let M=n.get(p)||g;if(i+M>t){r=Math.max(0,p-s);break}i+=M}i=0;for(let p=0;p<e.length;p++){let M=n.get(p)||g;if(i+=M,i>t+u){m=Math.min(e.length-1,p+s);break}}return{startIndex:r,endIndex:m}}function w(){if(d){let i=0;for(let r=0;r<e.length;r++)i+=n.get(r)||g;return i}return e.length*l}function y(i){if(d){let r=0;for(let m=0;m<i;m++)r+=n.get(m)||g;return r}return i*l}function S(){let{startIndex:i,endIndex:r}=f();return{startIndex:i,endIndex:r,scrollTop:t,totalHeight:w(),visibleItems:e.slice(i,r+1),itemHeights:new Map(n)}}function L(i,r="auto"){let m=y(i);a(m,r)}function a(i,r="auto"){t=Math.max(0,Math.min(i,w()-u))}function o(){f()}function H(i){e=[...i],n.clear(),o()}function I(){e=[],n.clear()}return{scrollToIndex:L,scrollToOffset:a,getState:S,refresh:o,setItems:H,destroy:I}}function Ba(v,c={},l){let u=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return v.replace(u,(s,b,d,g)=>{let x=b.trim(),e=c[x];if(!e||!Array.isArray(e))return`<!-- virtualList: items "${x}" not found or not an array -->`;let t={itemHeight:50,containerHeight:400,overscan:3};if(d)try{let a=d.trim(),o=Function(`return ${a}`)();t={...t,...o}}catch{}let n=`vlist-${Math.random().toString(36).substring(2,9)}`,f=Math.ceil(t.containerHeight/t.itemHeight),h=t.overscan||3,w=0,y=Math.min(e.length-1,f+h),S="";for(let a=w;a<=y&&a<e.length;a++){let o=e[a],H=g.replace(/\{\{\s*item\s*\}\}/g,typeof o==="object"?JSON.stringify(o):String(o)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(I,i)=>{if(typeof o==="object"&&o!==null)return String(o[i]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(a));S+=`
|
|
3
3
|
<div class="virtual-item ${t.itemClass||""}"
|
|
4
4
|
style="position: absolute; top: ${a*t.itemHeight}px; height: ${t.itemHeight}px; width: 100%;"
|
|
5
5
|
data-index="${a}">
|
|
@@ -76,7 +76,7 @@ function Aa(v,c){let{itemHeight:l,containerHeight:u,overscan:s=3,keyProperty:b="
|
|
|
76
76
|
};
|
|
77
77
|
})();
|
|
78
78
|
</script>
|
|
79
|
-
`})}function
|
|
79
|
+
`})}function wu(){return`
|
|
80
80
|
.virtual-list-container {
|
|
81
81
|
position: relative;
|
|
82
82
|
overflow-y: auto;
|
|
@@ -124,7 +124,7 @@ function Aa(v,c){let{itemHeight:l,containerHeight:u,overscan:s=3,keyProperty:b="
|
|
|
124
124
|
0% { background-position: 200% 0; }
|
|
125
125
|
100% { background-position: -200% 0; }
|
|
126
126
|
}
|
|
127
|
-
`}function
|
|
127
|
+
`}function vu(v,c){let l=null,u=()=>{if(!l)l=ja(v(),c);return l};return{visibleItems:()=>u().getState().visibleItems,totalHeight:()=>u().getState().totalHeight,containerProps:()=>({style:{height:`${c.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(s)=>{let b=s.target;if(l)l.scrollToOffset(b.scrollTop)}}),itemProps:(s)=>({style:{position:"absolute",top:`${s*c.itemHeight}px`,height:`${c.itemHeight}px`,width:"100%"},"data-index":s}),scrollToIndex:(s)=>{u().scrollToIndex(s)}}}function xu(v,c={},l){let u=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return v.replace(u,(s,b,d,g,x)=>{let e=b.trim(),t=c[e];if(!t||!Array.isArray(t))return`<!-- infiniteList: items "${e}" not found or not an array -->`;let n={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(d)try{let w=Function(`return ${d.trim()}`)();n={...n,...w}}catch{}let f=`ilist-${Math.random().toString(36).substring(2,9)}`,h=Ba(`@virtualList(${e}, ${JSON.stringify({itemHeight:n.itemHeight,containerHeight:n.containerHeight,overscan:n.overscan,containerClass:n.containerClass})})${g}@endvirtualList`,c);return h=h.replace("</script>",`
|
|
128
128
|
// Infinite scroll detection
|
|
129
129
|
container.addEventListener('scroll', function() {
|
|
130
130
|
const scrollBottom = container.scrollTop + container.clientHeight;
|
|
@@ -142,7 +142,7 @@ function Aa(v,c){let{itemHeight:l,containerHeight:u,overscan:s=3,keyProperty:b="
|
|
|
142
142
|
${x}
|
|
143
143
|
</div>
|
|
144
144
|
</div>
|
|
145
|
-
`})}function
|
|
145
|
+
`})}function Su(v,c={},l){let u=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return v.replace(u,(s,b,d,g)=>{let x=b.trim(),e=c[x];if(!e||!Array.isArray(e))return`<!-- virtualGrid: items "${x}" not found or not an array -->`;let t={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(d)try{let o=Function(`return ${d.trim()}`)();t={...t,...o}}catch{}let n=`vgrid-${Math.random().toString(36).substring(2,9)}`,f=Math.ceil(e.length/t.columns),h=f*(t.rowHeight+(t.gap||0)),w=Math.ceil(t.containerHeight/(t.rowHeight+(t.gap||0))),y=t.overscan||2,S=0,L=Math.min(f-1,w+y),a="";for(let o=S;o<=L;o++)for(let H=0;H<t.columns;H++){let I=o*t.columns+H;if(I>=e.length)break;let i=e[I],r=H*(100/t.columns),m=o*(t.rowHeight+(t.gap||0)),p=g.replace(/\{\{\s*item\s*\}\}/g,typeof i==="object"?JSON.stringify(i):String(i)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(M,T)=>{if(typeof i==="object"&&i!==null)return String(i[T]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(I));a+=`
|
|
146
146
|
<div class="virtual-grid-item"
|
|
147
147
|
style="position: absolute; top: ${m}px; left: ${r}%; width: calc(${100/t.columns}% - ${t.gap||0}px); height: ${t.rowHeight}px;"
|
|
148
148
|
data-index="${I}">
|
|
@@ -212,5 +212,5 @@ function Aa(v,c){let{itemHeight:l,containerHeight:u,overscan:s=3,keyProperty:b="
|
|
|
212
212
|
});
|
|
213
213
|
})();
|
|
214
214
|
</script>
|
|
215
|
-
`})}var
|
|
216
|
-
export{
|
|
215
|
+
`})}var oh={createVirtualList:ja,processVirtualListDirectives:Ba,processInfiniteListDirectives:xu,processVirtualGridDirectives:Su,generateVirtualListCSS:wu,useVirtualList:vu};
|
|
216
|
+
export{ja,Ba,wu,vu,xu,Su,oh};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{xm}from"./chunk-4r2rfdmr.js";import"./chunk-egjmb32c.js";import"./chunk-3q0w0bzd.js";import"./chunk-kna1bdm2.js";import"./chunk-c0g30cjs.js";import"./chunk-cad7e5q1.js";import"./chunk-xz4v9tg1.js";import"./chunk-kn9tqjgv.js";import"./chunk-t94y8g35.js";import"./chunk-0m4c42qt.js";import"./chunk-hmntqqyd.js";import"./chunk-v1s838fe.js";import"./chunk-5eftxrvv.js";import"./chunk-nb6erf75.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{xm as startInteractive};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{d,m,wl,p,t,u}from"./chunk-pp99rmjm.js";import{st,Et,hn,oi}from"./chunk-xtaq95em.js";function L(w,e){try{let g=w.trim();if(m(g))return p(g,Object.keys(e))(...Object.values(e));else return d(g,e)}catch{return!1}}function Q(w,e,g){let n=w,v=!0;while(v){v=!1;let a=n.match(/@switch\s*\(/);if(!a||a.index===void 0)break;let f=a.index,s=oi(n,f);if(!s)break;try{let o;if(m(s.expression))o=p(s.expression,Object.keys(e))(...Object.values(e));else o=d(s.expression,e);let r="",c=!1;for(let i of s.cases)if(i.type==="default"){if(!c)r=i.content.trim()}else try{let b;if(i.value&&m(i.value))b=p(i.value,Object.keys(e))(...Object.values(e));else if(i.value)b=d(i.value,e);if(o===b){r=i.content.trim(),c=!0;break}}catch{continue}n=n.substring(0,f)+r+n.substring(s.end),v=!0}catch(o){let r=o instanceof Error?o.message:String(o),c=u("Switch",`Error evaluating @switch expression: ${r}`,t.EVALUATION_ERROR);n=n.substring(0,f)+c+n.substring(s.end);break}}return n}function H(w){let e=[];return{masked:w.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(n)=>(e.push(n),`\x00stx-script-${e.length-1}\x00`)),scripts:e}}function J(w,e){if(e.length===0)return w;return w.replace(/\u0000stx-script-(\d+)\u0000/g,(g,n)=>e[Number(n)]??g)}function de(w,e,g){let{masked:n,scripts:v}=H(w);return J(K(n,e,g),v)}function K(w,e,g){let n=w;n=Q(n,e,g);{let a=!0;while(a){a=!1;let f=n.match(/@unless\s*\(/);if(!f||f.index===void 0)break;let s=f.index,o=st(n,s+7);if(!o)break;let r=o.endPos,c=Et(n,"unless","endunless",r);if(c===-1){console.warn(`[stx] @unless directive at position ${s} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let i=n.slice(r,c),b=o.expression,y=-1;{let x=0,k=/@(?:if|unless)\s*\(/g,h=/@(?:endif|endunless)(?![a-z])/g,E=/@else(?![a-z])/g,S=[],C;while((C=k.exec(i))!==null)S.push({pos:C.index,type:"open"});while((C=h.exec(i))!==null)S.push({pos:C.index,type:"close"});while((C=E.exec(i))!==null)S.push({pos:C.index,type:"else"});S.sort((P,R)=>P.pos-R.pos);for(let P of S)if(P.type==="open")x++;else if(P.type==="close")x--;else if(P.type==="else"&&x===0){y=P.pos;break}}let l;if(y!==-1){let x=i.slice(0,y),k=i.slice(y+5);l=`@if (${b})${k}@else ${x}@endif`}else l=`@if (!(${b}))${i}@endif`;n=n.substring(0,s)+l+n.substring(c+10),a=!0}}n=Qo(n,e,g),n=ei(n,e,g),n=Zo(n,e);let v=()=>{let a=hn(n);if(a.length===0)return!1;let f=Array(a.length);for(let r=a.length-1;r>=0;r--){let c=a[r];try{let i="",b=!1;for(let y of c.branches){if(b)break;if(y.type==="else")i=y.content,b=!0;else try{if(y.condition?wl(y.condition,e):!1)i=y.content,b=!0}catch(l){i=u(y.type==="if"?"If":"Elseif",`Error in @${y.type}(${y.condition}): ${l instanceof Error?l.message:String(l)}`,t.EVALUATION_ERROR),b=!0}}f[r]=i}catch(i){let b=i instanceof Error?i.message:String(i);f[r]=u("If",`Error processing @if block: ${b}`,t.EVALUATION_ERROR)}}let s=Array(a.length*2+1),o=0;for(let r=0;r<a.length;r++){let c=a[r];s[r*2]=n.slice(o,c.start),s[r*2+1]=f[r],o=c.end}return s[a.length*2]=n.slice(o),n=s.join(""),!0};while(!0){let a=n;if(!v())break;if(n===a)break}return n}function q(w){let e=0;while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!=="(")return null;e++;while(e<w.length&&/\s/.test(w[e]))e++;let g=w[e];if(g!=="'"&&g!=='"')return null;e++;let n=[];while(e<w.length){let v=w[e];if(v==="\\"&&e+1<w.length){n.push(w[e+1]),e+=2;continue}if(v===g){e++;break}n.push(v),e++}while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!==")")return null;return e++,{value:n.join(""),consumed:e}}function Zo(w,e){let g=w;function n(s,o,r,c){let i=1,b=c,y=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),l=new RegExp(`@${r}(?![a-z])`,"g");while(b<s.length&&i>0){y.lastIndex=b,l.lastIndex=b;let x=y.exec(s),k=l.exec(s),h=x?x.index:1/0,E=k?k.index:1/0;if(h<E)i++,b=h+x[0].length;else if(E<1/0){if(i--,i===0)return E;b=E+k[0].length}else break}return-1}function v(s,o,r){let c=0,i=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),b=new RegExp(`@${r}(?![a-z])`,"g"),y=/@else(?![a-z])/g,l=[],x;while((x=i.exec(s))!==null)l.push({pos:x.index,type:"open"});while((x=b.exec(s))!==null)l.push({pos:x.index,type:"close"});while((x=y.exec(s))!==null)l.push({pos:x.index,type:"else"});l.sort((k,h)=>k.pos-h.pos);for(let k of l)if(k.type==="open")c++;else if(k.type==="close")c--;else if(k.type==="else"&&c===0)return k.pos;return-1}{let s=!0;while(s){s=!1;let o=g.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,c,i,b=g.slice(r+5),y=q(b);if(y)c=y.value,i=r+5+y.consumed;else i=r+5;let l=n(g,"auth","endauth",i);if(l===-1){console.warn(`[stx] @auth directive at position ${r} has no matching @endauth \u2014 the block was skipped.`);break}let x=g.slice(i,l),k=v(x,"auth","endauth"),h;if(!e.auth)h=!1;else h=c?L(`auth?.check && auth?.user?.[${c}]`,e):L("auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=h?S:C}else E=h?x:"";g=g.substring(0,r)+E+g.substring(l+8),s=!0}}{let s=!0;while(s){s=!1;let o=g.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,c,i,b=g.slice(r+6),y=q(b);if(y)c=y.value,i=r+6+y.consumed;else i=r+6;let l=n(g,"guest","endguest",i);if(l===-1){console.warn(`[stx] @guest directive at position ${r} has no matching @endguest \u2014 the block was skipped.`);break}let x=g.slice(i,l),k=v(x,"guest","endguest"),h;if(!e.auth)h=!0;else h=c?L(`!auth?.check || !auth?.user?.[${c}]`,e):L("!auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=h?S:C}else E=h?x:"";g=g.substring(0,r)+E+g.substring(l+9),s=!0}}function a(s,o,r){if(e.userCan&&typeof e.userCan[s]==="boolean")return e.userCan[s];if(e.permissions?.check&&typeof e.permissions.check==="function")try{let c=[s];if(o)c.push(o);if(r){let i=L(r,e);c.push(i)}return e.permissions.check(...c)}catch{return!1}return!1}function f(s){let o=s.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!o)return null;return{ability:o[1],type:o[2],id:o[3]?.trim(),paramsEnd:o[0].length}}for(let s of["can","cannot"]){let o=`end${s}`,r=s==="can"?"elsecan":"elsecannot",c=!0;while(c){c=!1;let i=g.match(new RegExp(`@${s}\\s*\\(`));if(!i||i.index===void 0)break;let b=i.index,y=g.slice(b+`@${s}`.length),l=f(y);if(!l)break;let x=b+`@${s}`.length+l.paramsEnd,k=n(g,s,o,x);if(k===-1){console.warn(`[stx] @${s} directive at position ${b} has no matching @${o} \u2014 the block was skipped.`);break}let h=g.slice(x,k),E=[],S=0,C=new RegExp(`@${s}\\s*\\(`,"g"),P=new RegExp(`@${o}(?![a-z])`,"g"),R=new RegExp(`@${r}\\s*\\(`,"g"),T=/@else(?![a-z])/g,_=[],M;while((M=C.exec(h))!==null)_.push({pos:M.index,type:"open"});while((M=P.exec(h))!==null)_.push({pos:M.index,type:"close"});while((M=R.exec(h))!==null)_.push({pos:M.index,type:"elseDirective"});while((M=T.exec(h))!==null)_.push({pos:M.index,type:"else"});_.sort((A,z)=>A.pos-z.pos);for(let A of _){if(A.type==="open"){S++;continue}if(A.type==="close"){S--;continue}if(S===0)E.push(A)}let I=[],F=0;for(let A=0;A<E.length;A++){let z=E[A];if(I.push({content:h.slice(F,z.pos),ability:void 0}),z.type==="elseDirective"){let D=h.slice(z.pos+`@${r}`.length),B=f(D);if(B){I[I.length-1]={content:h.slice(F,z.pos)},F=z.pos+`@${r}`.length+B.paramsEnd,I.push({content:"",ability:B.ability,type:B.type,id:B.id}),I.pop();let G=E[A+1],U=G?G.pos:h.length;I.push({content:h.slice(F,U),ability:B.ability,type:B.type,id:B.id}),F=U}}else F=z.pos+5}if(F<h.length){let A=I[I.length-1];if(E.length>0&&E[E.length-1].type==="else")I.push({content:h.slice(F),isFinalElse:!0});else if(I.length===0)I.push({content:h.slice(F)})}let O=a(l.ability,l.type,l.id),j=s==="can"?O:!O,V="";if(j)V=I[0]?.content||"";else{let A=!1;for(let z=1;z<I.length;z++){let D=I[z];if(D.isFinalElse){V=D.content,A=!0;break}if(D.ability){let B=a(D.ability,D.type,D.id);if(s==="can"?B:!B){V=D.content,A=!0;break}}}if(!A&&I.length>0){let z=I[I.length-1];if(z.isFinalElse)V=z.content}}g=g.substring(0,b)+V+g.substring(k+`@${o}`.length),c=!0}}return g}function Qo(w,e,g){let n=w;function v(a,f,s,o,r){let c=!0;while(c){c=!1;let i=new RegExp(`@${f}\\s*\\(`),b=a.match(i);if(!b||b.index===void 0)break;let y=b.index,l=st(a,y+`@${f}`.length);if(!l)break;let x=l.endPos,k=Et(a,f,s,x);if(k===-1){console.warn(`[stx] @${f} directive at position ${y} has no matching @${s} \u2014 the block was skipped.`);break}let h=a.slice(x,k),E=l.expression,S=-1,C=0,P=0;while(P<h.length){let R=h.indexOf("@",P);if(R===-1)break;let T=h.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(T)){C++,P=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(T)){C--,P=R+1;continue}if(C===0&&/^@else(?![a-z])/.test(T)){S=R;break}P=R+1}try{let R=o(E.trim()),T;if(S!==-1){let _=h.slice(0,S),M=h.slice(S+5);T=R?_:M}else T=R?h:"";a=a.substring(0,y)+T+a.substring(k+`@${s}`.length),c=!0}catch(R){let T=R instanceof Error?R.message:String(R),_=u(r,`Error processing @${f} directive: ${T}`,t.EVALUATION_ERROR);a=a.substring(0,y)+_+a.substring(k+`@${s}`.length);break}}return a}return n=v(n,"isset","endisset",(a)=>{let f=L(a,e);return f!==void 0&&f!==null},"Isset"),n=v(n,"empty","endempty",(a)=>{let f=L(a,e);return f===void 0||f===null||f===""||f===0||f===!1||Array.isArray(f)&&f.length===0||typeof f==="object"&&f!==null&&Object.keys(f).length===0},"Empty"),n}function ei(w,e,g){let n=w,v="development";function a(f,s,o,r){let c=new RegExp(`@${s}(?![a-z])`,"g"),i=new RegExp(`@${o}(?![a-z])`,"g"),b=new RegExp(`^@${s}(?![a-z])`),y=new RegExp(`^@${o}(?![a-z])`),l=f,x=!0;while(x){x=!1,c.lastIndex=0;let k=c.exec(l);if(!k)break;let h=k.index,E=h+k[0].length;if(s==="env"){let O=l.substring(E).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!O)break;E+=O[0].length,r=v===O[2]}let S=1,C=E,P=-1;while(S>0&&C<l.length){c.lastIndex=C,i.lastIndex=C;let O=c.exec(l),j=i.exec(l),V=O?O.index:1/0,A=j?j.index:1/0;if(V<A)S++,C=V+O[0].length;else if(A<1/0){if(S--,S===0){P=A;break}C=A+j[0].length}else break}if(P===-1){console.warn(`[stx] @${s} directive at position ${h} has no matching @${o} \u2014 the block was skipped.`);break}let R=l.substring(E,P),T=-1,_=0,M=0;while(M<R.length){let O=R.indexOf("@",M);if(O===-1)break;let j=R.substring(O);if(b.test(j)){_++,M=O+1;continue}if(y.test(j)){_--,M=O+1;continue}if(_===0&&/^@else(?![a-z])/.test(j)){T=O;break}M=O+1}let I;if(T!==-1){let O=R.slice(0,T),j=R.slice(T+5);I=r?O:j}else I=r?R:"";let F=`@${o}`.length;l=l.substring(0,h)+I+l.substring(P+F),x=!0}return l}return n=a(n,"env","endenv",!1),n=a(n,"production","endproduction",v==="production"),n=a(n,"development","enddevelopment",v==="development"),n=a(n,"staging","endstaging",v==="staging"),n=a(n,"testing","endtesting",v==="testing"),n}
|
|
3
|
-
export{
|
|
2
|
+
import{d,m,El,p,n,u}from"./chunk-86nsbxep.js";import{lt,It,Sn,pi}from"./chunk-v1s838fe.js";function L(w,e){try{let g=w.trim();if(m(g))return p(g,Object.keys(e))(...Object.values(e));else return d(g,e)}catch{return!1}}function Q(w,e,g){let t=w,v=!0;while(v){v=!1;let a=t.match(/@switch\s*\(/);if(!a||a.index===void 0)break;let f=a.index,s=pi(t,f);if(!s)break;try{let o;if(m(s.expression))o=p(s.expression,Object.keys(e))(...Object.values(e));else o=d(s.expression,e);let r="",c=!1;for(let i of s.cases)if(i.type==="default"){if(!c)r=i.content.trim()}else try{let b;if(i.value&&m(i.value))b=p(i.value,Object.keys(e))(...Object.values(e));else if(i.value)b=d(i.value,e);if(o===b){r=i.content.trim(),c=!0;break}}catch{continue}t=t.substring(0,f)+r+t.substring(s.end),v=!0}catch(o){let r=o instanceof Error?o.message:String(o),c=u("Switch",`Error evaluating @switch expression: ${r}`,n.EVALUATION_ERROR);t=t.substring(0,f)+c+t.substring(s.end);break}}return t}function H(w){let e=[];return{masked:w.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(t)=>(e.push(t),`\x00stx-script-${e.length-1}\x00`)),scripts:e}}function J(w,e){if(e.length===0)return w;return w.replace(/\u0000stx-script-(\d+)\u0000/g,(g,t)=>e[Number(t)]??g)}function fe(w,e,g){let{masked:t,scripts:v}=H(w);return J(K(t,e,g),v)}function K(w,e,g){let t=w;t=Q(t,e,g);{let a=!0;while(a){a=!1;let f=t.match(/@unless\s*\(/);if(!f||f.index===void 0)break;let s=f.index,o=lt(t,s+7);if(!o)break;let r=o.endPos,c=It(t,"unless","endunless",r);if(c===-1){console.warn(`[stx] @unless directive at position ${s} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let i=t.slice(r,c),b=o.expression,y=-1;{let x=0,k=/@(?:if|unless)\s*\(/g,h=/@(?:endif|endunless)(?![a-z])/g,E=/@else(?![a-z])/g,S=[],C;while((C=k.exec(i))!==null)S.push({pos:C.index,type:"open"});while((C=h.exec(i))!==null)S.push({pos:C.index,type:"close"});while((C=E.exec(i))!==null)S.push({pos:C.index,type:"else"});S.sort((P,R)=>P.pos-R.pos);for(let P of S)if(P.type==="open")x++;else if(P.type==="close")x--;else if(P.type==="else"&&x===0){y=P.pos;break}}let l;if(y!==-1){let x=i.slice(0,y),k=i.slice(y+5);l=`@if (${b})${k}@else ${x}@endif`}else l=`@if (!(${b}))${i}@endif`;t=t.substring(0,s)+l+t.substring(c+10),a=!0}}t=ii(t,e,g),t=ai(t,e,g),t=oi(t,e);let v=()=>{let a=Sn(t);if(a.length===0)return!1;let f=Array(a.length);for(let r=a.length-1;r>=0;r--){let c=a[r];try{let i="",b=!1;for(let y of c.branches){if(b)break;if(y.type==="else")i=y.content,b=!0;else try{if(y.condition?El(y.condition,e):!1)i=y.content,b=!0}catch(l){i=u(y.type==="if"?"If":"Elseif",`Error in @${y.type}(${y.condition}): ${l instanceof Error?l.message:String(l)}`,n.EVALUATION_ERROR),b=!0}}f[r]=i}catch(i){let b=i instanceof Error?i.message:String(i);f[r]=u("If",`Error processing @if block: ${b}`,n.EVALUATION_ERROR)}}let s=Array(a.length*2+1),o=0;for(let r=0;r<a.length;r++){let c=a[r];s[r*2]=t.slice(o,c.start),s[r*2+1]=f[r],o=c.end}return s[a.length*2]=t.slice(o),t=s.join(""),!0};while(!0){let a=t;if(!v())break;if(t===a)break}return t}function q(w){let e=0;while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!=="(")return null;e++;while(e<w.length&&/\s/.test(w[e]))e++;let g=w[e];if(g!=="'"&&g!=='"')return null;e++;let t=[];while(e<w.length){let v=w[e];if(v==="\\"&&e+1<w.length){t.push(w[e+1]),e+=2;continue}if(v===g){e++;break}t.push(v),e++}while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!==")")return null;return e++,{value:t.join(""),consumed:e}}function oi(w,e){let g=w;function t(s,o,r,c){let i=1,b=c,y=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),l=new RegExp(`@${r}(?![a-z])`,"g");while(b<s.length&&i>0){y.lastIndex=b,l.lastIndex=b;let x=y.exec(s),k=l.exec(s),h=x?x.index:1/0,E=k?k.index:1/0;if(h<E)i++,b=h+x[0].length;else if(E<1/0){if(i--,i===0)return E;b=E+k[0].length}else break}return-1}function v(s,o,r){let c=0,i=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),b=new RegExp(`@${r}(?![a-z])`,"g"),y=/@else(?![a-z])/g,l=[],x;while((x=i.exec(s))!==null)l.push({pos:x.index,type:"open"});while((x=b.exec(s))!==null)l.push({pos:x.index,type:"close"});while((x=y.exec(s))!==null)l.push({pos:x.index,type:"else"});l.sort((k,h)=>k.pos-h.pos);for(let k of l)if(k.type==="open")c++;else if(k.type==="close")c--;else if(k.type==="else"&&c===0)return k.pos;return-1}{let s=!0;while(s){s=!1;let o=g.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,c,i,b=g.slice(r+5),y=q(b);if(y)c=y.value,i=r+5+y.consumed;else i=r+5;let l=t(g,"auth","endauth",i);if(l===-1){console.warn(`[stx] @auth directive at position ${r} has no matching @endauth \u2014 the block was skipped.`);break}let x=g.slice(i,l),k=v(x,"auth","endauth"),h;if(!e.auth)h=!1;else h=c?L(`auth?.check && auth?.user?.[${c}]`,e):L("auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=h?S:C}else E=h?x:"";g=g.substring(0,r)+E+g.substring(l+8),s=!0}}{let s=!0;while(s){s=!1;let o=g.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,c,i,b=g.slice(r+6),y=q(b);if(y)c=y.value,i=r+6+y.consumed;else i=r+6;let l=t(g,"guest","endguest",i);if(l===-1){console.warn(`[stx] @guest directive at position ${r} has no matching @endguest \u2014 the block was skipped.`);break}let x=g.slice(i,l),k=v(x,"guest","endguest"),h;if(!e.auth)h=!0;else h=c?L(`!auth?.check || !auth?.user?.[${c}]`,e):L("!auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=h?S:C}else E=h?x:"";g=g.substring(0,r)+E+g.substring(l+9),s=!0}}function a(s,o,r){if(e.userCan&&typeof e.userCan[s]==="boolean")return e.userCan[s];if(e.permissions?.check&&typeof e.permissions.check==="function")try{let c=[s];if(o)c.push(o);if(r){let i=L(r,e);c.push(i)}return e.permissions.check(...c)}catch{return!1}return!1}function f(s){let o=s.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!o)return null;return{ability:o[1],type:o[2],id:o[3]?.trim(),paramsEnd:o[0].length}}for(let s of["can","cannot"]){let o=`end${s}`,r=s==="can"?"elsecan":"elsecannot",c=!0;while(c){c=!1;let i=g.match(new RegExp(`@${s}\\s*\\(`));if(!i||i.index===void 0)break;let b=i.index,y=g.slice(b+`@${s}`.length),l=f(y);if(!l)break;let x=b+`@${s}`.length+l.paramsEnd,k=t(g,s,o,x);if(k===-1){console.warn(`[stx] @${s} directive at position ${b} has no matching @${o} \u2014 the block was skipped.`);break}let h=g.slice(x,k),E=[],S=0,C=new RegExp(`@${s}\\s*\\(`,"g"),P=new RegExp(`@${o}(?![a-z])`,"g"),R=new RegExp(`@${r}\\s*\\(`,"g"),T=/@else(?![a-z])/g,_=[],M;while((M=C.exec(h))!==null)_.push({pos:M.index,type:"open"});while((M=P.exec(h))!==null)_.push({pos:M.index,type:"close"});while((M=R.exec(h))!==null)_.push({pos:M.index,type:"elseDirective"});while((M=T.exec(h))!==null)_.push({pos:M.index,type:"else"});_.sort((A,z)=>A.pos-z.pos);for(let A of _){if(A.type==="open"){S++;continue}if(A.type==="close"){S--;continue}if(S===0)E.push(A)}let I=[],F=0;for(let A=0;A<E.length;A++){let z=E[A];if(I.push({content:h.slice(F,z.pos),ability:void 0}),z.type==="elseDirective"){let D=h.slice(z.pos+`@${r}`.length),B=f(D);if(B){I[I.length-1]={content:h.slice(F,z.pos)},F=z.pos+`@${r}`.length+B.paramsEnd,I.push({content:"",ability:B.ability,type:B.type,id:B.id}),I.pop();let G=E[A+1],U=G?G.pos:h.length;I.push({content:h.slice(F,U),ability:B.ability,type:B.type,id:B.id}),F=U}}else F=z.pos+5}if(F<h.length){let A=I[I.length-1];if(E.length>0&&E[E.length-1].type==="else")I.push({content:h.slice(F),isFinalElse:!0});else if(I.length===0)I.push({content:h.slice(F)})}let O=a(l.ability,l.type,l.id),j=s==="can"?O:!O,V="";if(j)V=I[0]?.content||"";else{let A=!1;for(let z=1;z<I.length;z++){let D=I[z];if(D.isFinalElse){V=D.content,A=!0;break}if(D.ability){let B=a(D.ability,D.type,D.id);if(s==="can"?B:!B){V=D.content,A=!0;break}}}if(!A&&I.length>0){let z=I[I.length-1];if(z.isFinalElse)V=z.content}}g=g.substring(0,b)+V+g.substring(k+`@${o}`.length),c=!0}}return g}function ii(w,e,g){let t=w;function v(a,f,s,o,r){let c=!0;while(c){c=!1;let i=new RegExp(`@${f}\\s*\\(`),b=a.match(i);if(!b||b.index===void 0)break;let y=b.index,l=lt(a,y+`@${f}`.length);if(!l)break;let x=l.endPos,k=It(a,f,s,x);if(k===-1){console.warn(`[stx] @${f} directive at position ${y} has no matching @${s} \u2014 the block was skipped.`);break}let h=a.slice(x,k),E=l.expression,S=-1,C=0,P=0;while(P<h.length){let R=h.indexOf("@",P);if(R===-1)break;let T=h.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(T)){C++,P=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(T)){C--,P=R+1;continue}if(C===0&&/^@else(?![a-z])/.test(T)){S=R;break}P=R+1}try{let R=o(E.trim()),T;if(S!==-1){let _=h.slice(0,S),M=h.slice(S+5);T=R?_:M}else T=R?h:"";a=a.substring(0,y)+T+a.substring(k+`@${s}`.length),c=!0}catch(R){let T=R instanceof Error?R.message:String(R),_=u(r,`Error processing @${f} directive: ${T}`,n.EVALUATION_ERROR);a=a.substring(0,y)+_+a.substring(k+`@${s}`.length);break}}return a}return t=v(t,"isset","endisset",(a)=>{let f=L(a,e);return f!==void 0&&f!==null},"Isset"),t=v(t,"empty","endempty",(a)=>{let f=L(a,e);return f===void 0||f===null||f===""||f===0||f===!1||Array.isArray(f)&&f.length===0||typeof f==="object"&&f!==null&&Object.keys(f).length===0},"Empty"),t}function ai(w,e,g){let t=w,v="development";function a(f,s,o,r){let c=new RegExp(`@${s}(?![a-z])`,"g"),i=new RegExp(`@${o}(?![a-z])`,"g"),b=new RegExp(`^@${s}(?![a-z])`),y=new RegExp(`^@${o}(?![a-z])`),l=f,x=!0;while(x){x=!1,c.lastIndex=0;let k=c.exec(l);if(!k)break;let h=k.index,E=h+k[0].length;if(s==="env"){let O=l.substring(E).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!O)break;E+=O[0].length,r=v===O[2]}let S=1,C=E,P=-1;while(S>0&&C<l.length){c.lastIndex=C,i.lastIndex=C;let O=c.exec(l),j=i.exec(l),V=O?O.index:1/0,A=j?j.index:1/0;if(V<A)S++,C=V+O[0].length;else if(A<1/0){if(S--,S===0){P=A;break}C=A+j[0].length}else break}if(P===-1){console.warn(`[stx] @${s} directive at position ${h} has no matching @${o} \u2014 the block was skipped.`);break}let R=l.substring(E,P),T=-1,_=0,M=0;while(M<R.length){let O=R.indexOf("@",M);if(O===-1)break;let j=R.substring(O);if(b.test(j)){_++,M=O+1;continue}if(y.test(j)){_--,M=O+1;continue}if(_===0&&/^@else(?![a-z])/.test(j)){T=O;break}M=O+1}let I;if(T!==-1){let O=R.slice(0,T),j=R.slice(T+5);I=r?O:j}else I=r?R:"";let F=`@${o}`.length;l=l.substring(0,h)+I+l.substring(P+F),x=!0}return l}return t=a(t,"env","endenv",!1),t=a(t,"production","endproduction",v==="production"),t=a(t,"development","enddevelopment",v==="development"),t=a(t,"staging","endstaging",v==="staging"),t=a(t,"testing","endtesting",v==="testing"),t}
|
|
3
|
+
export{fe,oi,ii,ai};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{j,cl,no,$n,h,qe,Ke}from"./chunk-p55a910x.js";import{_r,ut,W}from"./chunk-ec5q4nnw.js";import{gr,i}from"./chunk-egjmb32c.js";import{$e}from"./chunk-hmntqqyd.js";import{ra}from"./chunk-xpbakn6t.js";function y(s){return s.endsWith(".md")||s.endsWith(".markdown")}function C(s){let e=[];m(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let r=[...e];m(/<code\b[^>]*>[\s\S]*?<\/code>/gi,r);function m(n,p){let g;while((g=n.exec(s))!==null){let t=g.index,o=t+g[0].length;if(p?.some((l)=>t>=l.start&&o<=l.end))continue;e.push({start:t,end:o})}}if(e.length===0)return s;e.sort((n,p)=>n.start-p.start);let c="",a=0;for(let n of e){if(n.start<a)continue;c+=s.slice(a,n.start),c+=`@raw${s.slice(n.start,n.end)}@endraw`,a=n.end}return c+=s.slice(a),c}async function b(s,e={}){let{data:r,content:m}=_r(s),a=await(e.renderer??((n)=>ut(n)))(m);return{html:C(a),frontmatter:r??{}}}import{dirname as k,resolve as R}from"path";function v(s){let e=s,r=j(s);if(r)e=r.content.trim();let m=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,c=[],a=[],n=[],p=(o)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(o),g;while((g=m.exec(s))!==null){let o=g[1],l=g[2],d=g[0],u=o.includes("server");if(p(l))n.push(d);else if(u)a.push(l);else c.push(d)}let t=e;{let o=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,l,d=[];while((l=o.exec(t))!==null){let u=l.index+l[0].length,f=t.indexOf("</script>",u);if(f===-1)continue;d.push({start:l.index,end:f+9}),o.lastIndex=f+9}for(let u=d.length-1;u>=0;u--)t=t.substring(0,d[u].start)+t.substring(d[u].end)}for(let o of c)t=t.replace(o,"");return{templateContent:t,serverScripts:a,clientScripts:c,signalsScripts:n}}function M(s,e){return`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
@@ -9,8 +9,8 @@ import{L,el,Js,Sn,h,He,Ve}from"./chunk-j1ytbd6r.js";import{wr,ot,U}from"./chunk-
|
|
|
9
9
|
<body>
|
|
10
10
|
${s}
|
|
11
11
|
</body>
|
|
12
|
-
</html>`}async function
|
|
12
|
+
</html>`}async function bc(s,e={}){let r=R(s),m=Bun.file(r);if(!await m.exists())throw Error(`Template file not found: ${r}`);let c=await m.text(),a=null;if(y(r)){let n=await b(c,{renderer:e.markdownRenderer});c=n.html,a=n.frontmatter}if(a)e={...e,context:{...a,...e.context||{}}};if(e.layout){let n=R(e.layout),p=Bun.file(n);if(!await p.exists())throw Error(`Layout template not found: ${n}`);let{layout:g,injectCSS:t,...o}=e,l={...e.context||{}};$n(l);let d=await w(c,r,{...o,context:{...l,__stx_defer_server_data:!0},injectCSS:!1}),u=await p.text(),f={...l,content:d},x={...o,context:f,injectCSS:t};return w(u,n,x)}return w(c,r,e)}async function w(s,e,r={}){let{templateContent:m,serverScripts:c,clientScripts:a}=v(s),n={...W,...r.options},p={__filename:e,__dirname:k(e),__stx:{},__stx_options:n,__stx_sfc_mode:!0,__stx_inject_css:r.injectCSS===!0,__stxServeContext:void 0,...no(r.context??{}),definePageMeta:()=>{},...r.context||{}};for(let o of c)await h(o,p,e);let g=new Set,t=m;if(t=await i(t,p,e,n,g),cl(p,r.context),r.templateOnly){if(t=t.replace(/<script data-stx-scoped>[\s\S]*?<\/script>\s*/gi,""),t=t.replace(/<!-- stx SEO Tags -->[\s\S]*?(?=<)/i,""),a.length>0)t+=`
|
|
13
13
|
${a.join(`
|
|
14
|
-
`)}`}else{if(r.processClientScripts!==!1&&a.length>0){let o=p.__stx_event_bindings||[],l=
|
|
15
|
-
`);t=
|
|
16
|
-
export{
|
|
14
|
+
`)}`}else{if(r.processClientScripts!==!1&&a.length>0){let o=p.__stx_event_bindings||[],l=qe(p),d=await Promise.all(a.map(async(x)=>{let _=x.match(/<script\b([^>]*)>/i)?.[1]||"";if(/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(_))return x;let S=x.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!S)return x;return await Ke(S[1],{eventBindings:o,templateContent:t,serverData:l,filePath:e})})),f=[await gr(d,{...n,buildMode:"compile"}),...d].filter(Boolean).join(`
|
|
15
|
+
`);t=ra(t,f)}t=await $e(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=M(t,r.title)}if(r.injectCSS)try{let{injectCss:o}=await import("./chunk-rdxph1tp.js");t=await o(t)}catch{}return t}
|
|
16
|
+
export{bc};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
`);if(!await Bun.file(o).exists()||await Bun.file(o).text()!==f)await Bun.write(o,f);return o}async function
|
|
4
|
-
`)}`);let a=e.outputs.find((u)=>u.kind==="entry-point");if(!a)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await a.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(c,n),a),f.push({...t,filePath:n})}return f}function E(s,c){let o=s.map((i)=>({route:i,...
|
|
5
|
-
`));let u=n.outputs.find((d)=>d.kind==="entry-point");if(!u||n.outputs.length!==1)throw Error(`Unsupported API bundle output: ${p.filePath}`);return(await import(`data:text/javascript;base64,${Buffer.from(await u.text()).toString("base64")}`)).default})(f))}catch(t){return console.error("[stx] API discovery failed:",t),Response.json({error:"API discovery failed; check the server log"},{status:500})}}}function
|
|
6
|
-
export{
|
|
2
|
+
import{ve}from"./chunk-agd2b928.js";import{Ye,F}from"./chunk-6t04tqvh.js";import{Wc}from"./chunk-ssg6ne5b.js";import{l}from"./chunk-s7xywsqd.js";import v from"fs";import m from"path";import{pathToFileURL as I}from"url";var P=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],R=new Set;function wn(s,c={}){let o=m.resolve(s,c.dir??"server/api"),i=[],f=new Map;if(!v.existsSync(o))return i;let t=Array.from(new Bun.Glob("**/*.{ts,js,mts,mjs}").scanSync({cwd:o})).sort();for(let e of t){if(e.endsWith(".d.ts"))continue;let p=e.replace(/\.(?:ts|js|mts|mjs)$/,"").split("/"),n=p.pop(),u=n.lastIndexOf("."),d=u>=0?n.slice(u+1):"get",g=d.toUpperCase();if(!P.includes(g)||d!==d.toLowerCase())throw Error(`Unsupported API method suffix in ${e}; use ${P.map((A)=>A.toLowerCase()).join(", ")}`);if(u>=0)n=n.slice(0,u);if(n!=="index")p.push(n);let r=new Set,h=p.map((A,j)=>{let y=/^\[(\.\.\.)?([A-Za-z_]\w*)\]$/.exec(A);if(y){if(r.has(y[2])||y[1]&&j!==p.length-1)throw Error(`Invalid API parameter in ${e}`);return r.add(y[2]),`:${y[2]}${y[1]?"*":""}`}if(!/^[\w-]+$/.test(A))throw Error(`Unsupported API path segment ${A} in ${e}`);return A}),w=`/api${h.length?`/${h.join("/")}`:""}`,S=`${g} ${w.replace(/:\w+/g,":param")}`;if(f.has(S))throw Error(`Ambiguous API route ${g} ${w}: ${f.get(S)} and ${e}`);f.set(S,e);let x=m.join(o,e);R.add(m.resolve(x)),R.add(v.realpathSync(x)),i.push({pattern:w,method:g,filePath:x})}return i.sort((e,a)=>{let p=e.pattern.split("/"),n=a.pattern.split("/"),u=(d)=>d?.endsWith("*")?0:d?.startsWith(":")?1:2;for(let d=0;d<Math.max(p.length,n.length);d++){let g=u(n[d])-u(p[d]);if(g)return g}return e.pattern.localeCompare(a.pattern)||e.method.localeCompare(a.method)})}async function Go(s,c){let o=l(s,"api-types.d.ts"),i=["// Generated by stx. Include this file in tsconfig.json.","declare module '@stacksjs/stx/api-client' {"," interface KnownApiRoutes {"];for(let t of c){let e=`./${m.relative(m.dirname(o),t.filePath).replace(/\\/g,"/")}`,{params:a}=ve(t.pattern);i.push(` ${JSON.stringify(`${t.method} ${t.pattern}`)}: { params: { ${a.map((p)=>`${JSON.stringify(p)}: string`).join("; ")} }; response: Awaited<ReturnType<typeof import(${JSON.stringify(e)}).default>> }`)}i.push(" }","}","export {}","");let f=i.join(`
|
|
3
|
+
`);if(!await Bun.file(o).exists()||await Bun.file(o).text()!==f)await Bun.write(o,f);return o}async function Xo(s,c,o={}){let i=wn(s,o);await Go(s,i);let f=[];for(let t of i){let e=await Bun.build({entrypoints:[t.filePath],target:"bun",format:"esm",minify:!1,splitting:!1});if(!e.success)throw Error(`API build failed for ${t.filePath}: ${e.logs.join(`
|
|
4
|
+
`)}`);let a=e.outputs.find((u)=>u.kind==="entry-point");if(!a)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await a.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(c,n),a),f.push({...t,filePath:n})}return f}function E(s,c){let o=s.map((i)=>({route:i,...ve(i.pattern)}));return async(i)=>{let f=new URL(i.url).pathname,t=o.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,a=(r)=>r.replace(/:\w+/g,":param"),p=t.filter((r)=>a(r.route.pattern)===a(e)),n=i.method,u=p.find((r)=>r.route.method===n)??(n==="HEAD"?p.find((r)=>r.route.method==="GET"):void 0);if(!u){let r=new Set(p.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=u.regex.exec(f),g=Object.create(null);try{u.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await c(u.route);if(typeof r!=="function")throw Error(`API endpoint ${u.route.filePath} must default-export a handler`);let h=await r(i,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function Jo(s,c){return E(c,async(o)=>(await import(I(m.resolve(s,o.filePath)).href)).default)}async function ey(s,c){if(!c)return async()=>null;let o=c===!0?{}:c,i=wn(s,o);return await Go(s,i),async(f)=>{if(!new URL(f.url).pathname.match(/^\/api(?:\/|$)/))return null;try{let t=wn(s,o);await Go(s,t);let{loadStxConfig:e}=await import("./chunk-p746twww.js"),a=F((await e(s)).runtimeConfig);return await Ye(a,()=>E(t,async(p)=>{let n=await Bun.build({entrypoints:[p.filePath],target:"bun",format:"esm",splitting:!1});if(!n.success)throw Error(n.logs.join(`
|
|
5
|
+
`));let u=n.outputs.find((d)=>d.kind==="entry-point");if(!u||n.outputs.length!==1)throw Error(`Unsupported API bundle output: ${p.filePath}`);return(await import(`data:text/javascript;base64,${Buffer.from(await u.text()).toString("base64")}`)).default})(f))}catch(t){return console.error("[stx] API discovery failed:",t),Response.json({error:"API discovery failed; check the server log"},{status:500})}}}function Yo(s,c,o){if(Wc(s))return!0;let i=/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/;if(i.test(m.basename(s)))return!0;try{if(i.test(m.basename(v.realpathSync(s))))return!0}catch{}if(R.has(m.resolve(s)))return!0;if(!o)return!1;let f=m.resolve(c,typeof o==="object"?o.dir??"server/api":"server/api"),t=(a)=>{try{return v.realpathSync(a)}catch{return m.resolve(a)}},e=t(s);return[f,m.resolve(c,"server"),m.resolve(c,".output/server")].some((a)=>{let p=t(a);return e===p||e.startsWith(`${p}${m.sep}`)})}
|
|
6
|
+
export{wn,Go,Xo,Jo,ey,Yo};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ga,Xa,Ja,Ya,Yh}from"./chunk-pm4rpc4a.js";import"./chunk-e362e615.js";import"./chunk-t9hxyvvc.js";import"./chunk-kee5a3ce.js";import"./chunk-egjmb32c.js";import"./chunk-3q0w0bzd.js";import"./chunk-kna1bdm2.js";import"./chunk-c0g30cjs.js";import"./chunk-cad7e5q1.js";import"./chunk-xz4v9tg1.js";import"./chunk-kn9tqjgv.js";import"./chunk-t94y8g35.js";import"./chunk-0m4c42qt.js";import"./chunk-hmntqqyd.js";import"./chunk-v1s838fe.js";import"./chunk-5eftxrvv.js";import"./chunk-nb6erf75.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{Ga as buildNative,Yh as default,Xa as findCraftBinary,Ya as getAvailableFormats,Ja as getAvailableTargets};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{k}from"./chunk-
|
|
2
|
+
import{k}from"./chunk-86nsbxep.js";function lt(e,r){let n=v(e,r);return n.ok?{expression:n.expression,endPos:n.endPos}:null}function v(e,r){let n=r;while(n<e.length&&/\s/.test(e[n]))n++;if(e[n]!=="(")return{ok:!1,reason:"missing-open-paren",pos:n};let c=k(e,"(",")",n);if(c===-1)return{ok:!1,reason:"unclosed-paren",pos:n};return{ok:!0,expression:e.slice(n+1,c),endPos:c+1}}function y(e,r){let n=e.lastIndexOf("<",r);if(n===-1)return!1;return n>e.lastIndexOf(">",r)}function It(e,r,n,c){let o=1,i=c,u=new RegExp(`@${r}\\s*\\(`,"g"),a=new RegExp(`@${n}(?![a-z])`,"g");while(i<e.length&&o>0){u.lastIndex=i,a.lastIndex=i;let p=u.exec(e),t=a.exec(e),s=p?p.index:1/0,f=t?t.index:1/0;if(s<f)o++,i=s+p[0].length;else if(f<1/0){if(o--,o===0)return f;i=f+t[0].length}else break}return-1}function P(e,r){let n=e.slice(r).match(/^@if\s*/);if(!n)return null;let c=r+n[0].length,o=lt(e,c);if(!o)return null;let i=o.endPos,u=It(e,"if","endif",i);if(u===-1)return null;let a=e.slice(i,u),p=[],t=0,s="if",f=o.expression,l=0,x=0;while(t<a.length){let h=a.indexOf("@",t);if(h===-1)break;t=h;let d=a.substring(h);if(y(a,h)){t++;continue}if(/^@if\s*\(/.test(d)){x++,t++;continue}if(/^@endif(?![a-z])/.test(d)){x--,t+=6;continue}if(x===0){let g=d.match(/^@elseif\s*/);if(g){p.push({type:s,condition:f,content:a.substring(l,t),start:i+l,end:i+t});let m=t+g[0].length,b=lt(a,m);if(!b){t++;continue}s="elseif",f=b.expression,t=b.endPos,l=t;continue}else if(/^@else(?![a-z])/.test(d)){p.push({type:s,condition:f,content:a.substring(l,t),start:i+l,end:i+t}),s="else",f=void 0,t+=5,l=t;continue}}t++}return p.push({type:s,condition:f,content:a.slice(l),start:i+l,end:i+a.length}),{fullMatch:e.slice(r,u+6),branches:p,start:r,end:u+6}}function Sn(e){let r=[],n=/@if\s*\(/g,c=n.exec(e);while(c!==null){if(r.some((u)=>c.index>u.start&&c.index<u.end)){c=n.exec(e);continue}let i=P(e,c.index);if(i)r.push(i),n.lastIndex=i.end;c=n.exec(e)}return r}function Is(e,r,n){let c=[],o=new RegExp(`@${r}\\s*\\(`,"g"),i=o.exec(e);while(i!==null){if(c.some((d)=>i.index>d.start&&i.index<d.end)){i=o.exec(e);continue}let a=i.index,p=a+i[0].length-1,t=k(e,"(",")",p);if(t===-1){i=o.exec(e);continue}let s=e.slice(p+1,t),f=t+1,l=It(e,r,n,f);if(l===-1){i=o.exec(e);continue}let x=e.slice(f,l),h=l+`@${n}`.length;c.push({fullMatch:e.slice(a,h),name:r,params:s,content:x,start:a,end:h}),o.lastIndex=h,i=o.exec(e)}return c}function pi(e,r){let n=e.slice(r).match(/^@switch\s*/);if(!n)return null;let c=r+n[0].length,o=lt(e,c);if(!o)return null;let i=o.endPos,u=It(e,"switch","endswitch",i);if(u===-1)return null;let a=e.slice(i,u),p=[],t=0,s=null,f=0;while(t<a.length){let l=a.slice(t),x=l.match(/^@switch\s*\(/),h=l.match(/^@endswitch(?![a-z])/);if(x){if(f++,s)s.content+=x[0];t+=x[0].length;continue}if(h){if(f--,s)s.content+=h[0];t+=h[0].length;continue}if(f>0){if(s)s.content+=a[t];t++;continue}let d=l.match(/^@case\s*/),g=l.match(/^@default(?![a-z])/),m=l.match(/^@break(?![a-z])/);if(d&&l.startsWith("@case")){if(s)p.push(s);let b=t+d[0].length,E=lt(a,b);if(!E){t++;continue}s={type:"case",value:E.expression,content:""},t=E.endPos}else if(g&&l.startsWith("@default")){if(s)p.push(s);s={type:"default",content:""},t+=g[0].length}else if(m&&l.startsWith("@break"))t+=m[0].length;else{if(s)s.content+=a[t];t++}}if(s)p.push(s);return{fullMatch:e.slice(r,u+10),expression:o.expression,cases:p,start:r,end:u+10}}export{lt,It,Sn,Is,pi};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import"./chunk-00tq7ghn.js";import"./chunk-hxhmhw23.js";import"./chunk-s29hp1qw.js";import"./chunk-a60ztvnp.js";import{S,_,A,oe}from"./chunk-p55a910x.js";import"./chunk-86nsbxep.js";import"./chunk-6t04tqvh.js";import"./chunk-19k15mfc.js";import{br}from"./chunk-7mcs59pr.js";import{existsSync as C}from"fs";import l from"path";var b=["applyOfflineUpdate","broadcast","cacheMedia","calculateDistance","canNotify","clearCookies","clearFetchCache","clearOfflineData","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","onOfflineUpdateReady","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAmbientSound","useAnimationFrame","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBreathPacer","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useCompletion","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useOutbox","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVirtualList","useVisibility","useWakeLock","useWindowSize"],L=new Set(b);var u=new Map,h=S(64),w=new Set,v=0,E=new Set(b);function z(){u.clear(),h.clear()}function R(s){let o=new Map;for(let t of s){let i=l.basename(t);if(i.endsWith(".d.ts"))continue;let r=i.replace(/\.[jt]s$/,"");if(r==="index")continue;if(r===i)continue;let a=o.get(r);if(a&&!a.endsWith(".js"))continue;o.set(r,t)}return[...o.values()].sort()}function P(s,o){let t=o.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${t}\\b`).test(s)}function I(s){if(!s)return[];let o=_(s,v),t=h.get(o);if(t)return t.slice();let i=s.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),r=[];for(let a of E){if(w.has(a))continue;let p=a.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${p}\\s*\\(`).test(i))r.push(a)}return r.sort(),h.set(o,r),r.slice()}function M(){let s=l.join(import.meta.dir,"composables"),o=import.meta.url.endsWith(".ts")?"ts":"js";if(C(l.join(s,`index.${o}`)))return s;let t=br("@stacksjs/stx/composables");return t?l.dirname(t):void 0}async function V(s,o){let t=I(s);if(t.length===0)return null;let i=o??M();if(!i)return null;let r=`${i}\x00${t.join(",")}`,a=u.get(r);if(a!==void 0)return a||null;let p=oe({loader:"ts",target:"browser",define:A()}),k=new Set(t),m=[],d=new Set,f=[];try{let n=new Bun.Glob("*.{ts,js}");for await(let e of n.scan({cwd:i,absolute:!0}))f.push(e)}catch{return u.set(r,""),null}f=R(f);for(let n of f){let e;try{e=await Bun.file(n).text()}catch{continue}let g=[];try{g=p.scan(e).exports.filter((c)=>c!=="default")}catch{continue}if(!g.some((c)=>k.has(c)))continue;try{e=e.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^import\s+type\s+.*$/gm,""),e=e.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),e=e.replace(/^export\s+default\s+/gm,""),e=e.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),m.push(`// ${l.basename(n).replace(/\.[jt]s$/,"")}
|
|
3
|
+
${p.transformSync(e).trim()}`);for(let c of g)d.add(c)}catch(c){console.warn(`[stx] framework composable ${l.basename(n)} could not be bundled:`,c)}}let x=t.filter((n)=>!d.has(n)&&!P(s,n));if(x.length>0)console.warn(`[stx] could not bundle ${x.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(m.length===0)return u.set(r,""),null;let O=[...d].map((n)=>` try { if (!(${JSON.stringify(n)} in __s)) { __s[${JSON.stringify(n)}] = ${n}; if (!(${JSON.stringify(n)} in window)) window[${JSON.stringify(n)}] = ${n}; } } catch (e) {}`).join(`
|
|
4
|
+
`),y=`<script data-stx-scoped data-stx-run="always" data-stx-framework-composables>
|
|
5
|
+
;(function(){
|
|
6
|
+
var __s = window.stx = window.stx || {};
|
|
7
|
+
${m.join(`
|
|
8
|
+
|
|
9
|
+
`)}
|
|
10
|
+
${O}
|
|
11
|
+
})();
|
|
12
|
+
</script>`;return u.set(r,y),y}function q(s){w.clear();for(let o of s)w.add(o);v++}export{q as __setRuntimeOwnedForTest,z as clearFrameworkComposableCache,V as getFrameworkComposableScript,I as referencedFrameworkComposables,R as selectComposableFiles};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Pm}from"./chunk-k40e0ete.js";import"./chunk-7bsrnpmh.js";import"./chunk-4fkcn6z5.js";import"./chunk-9cbf0seq.js";import"./chunk-tgzs1kbj.js";import"./chunk-egjmb32c.js";import"./chunk-3q0w0bzd.js";import"./chunk-kna1bdm2.js";import"./chunk-c0g30cjs.js";import"./chunk-cad7e5q1.js";import"./chunk-xz4v9tg1.js";import"./chunk-kn9tqjgv.js";import"./chunk-t94y8g35.js";import"./chunk-0m4c42qt.js";import"./chunk-hmntqqyd.js";import"./chunk-v1s838fe.js";import"./chunk-5eftxrvv.js";import"./chunk-nb6erf75.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{Pm as buildForProduction};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ql,eu}from"./chunk-xf0xacc9.js";import"./chunk-94ctmp0j.js";import"./chunk-4r2rfdmr.js";import"./chunk-g83ph305.js";import"./chunk-nysbdr4r.js";import"./chunk-4n45qa0b.js";import"./chunk-czcx3nbx.js";import"./chunk-rzcdwybt.js";import"./chunk-k40e0ete.js";import"./chunk-7bsrnpmh.js";import"./chunk-2r0nrvqe.js";import"./chunk-q1mb0fbt.js";import"./chunk-pdprhg5k.js";import"./chunk-awp8a3t4.js";import"./chunk-q74affc4.js";import"./chunk-gbncp2gp.js";import"./chunk-yp4tn4zn.js";import"./chunk-8va3fs07.js";import"./chunk-sv7fdqmc.js";import"./chunk-a7ryj8z8.js";import"./chunk-f7znj9xg.js";import"./chunk-93jhfbeg.js";import"./chunk-aaea157p.js";import"./chunk-8e1cv1hh.js";import"./chunk-ybjgnnyf.js";import"./chunk-a0q0kb0s.js";import"./chunk-ew3vs3jq.js";import"./chunk-k6c5t9we.js";import"./chunk-4fkcn6z5.js";import"./chunk-t9hxyvvc.js";import"./chunk-kee5a3ce.js";import"./chunk-59er0fc7.js";import{fn}from"./chunk-9cbf0seq.js";import{Qf}from"./chunk-cjv89tnb.js";import"./chunk-tgzs1kbj.js";import"./chunk-9f31gs4m.js";import{ze,i}from"./chunk-egjmb32c.js";import"./chunk-3q0w0bzd.js";import"./chunk-kna1bdm2.js";import"./chunk-c0g30cjs.js";import"./chunk-cad7e5q1.js";import"./chunk-xz4v9tg1.js";import"./chunk-kn9tqjgv.js";import"./chunk-t94y8g35.js";import"./chunk-0m4c42qt.js";import{$e}from"./chunk-hmntqqyd.js";import"./chunk-v1s838fe.js";import{Sr,kr}from"./chunk-5eftxrvv.js";import"./chunk-nb6erf75.js";import{Ms,W,a}from"./chunk-ec5q4nnw.js";import"./chunk-mygsektn.js";import"./chunk-h63ma36g.js";import"./chunk-ssg6ne5b.js";import"./chunk-h2tq6cbr.js";import"./chunk-agd2b928.js";import{j,h,Ke}from"./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";import{ra}from"./chunk-xpbakn6t.js";import"./chunk-463weehv.js";import"./chunk-shcnt6aa.js";export{Ms as buildWebComponents,kr as cacheTemplate,Sr as checkCache,fn as classifyAllScripts,Ql as createMiddleware,eu as createRoute,W as defaultConfig,h as extractVariables,j as findSfcTemplateBlock,$e as injectRouterScript,ra as insertBeforeBodyClose,a as loadStxConfig,Ke as processClientScript,i as processDirectives,ze as readMarkdownFile,Qf as withinBundlerCallback};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{mt,Tg,$g,Rg,Ag,Pg,h,Ig,Di,Og,hl,yl}from"./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{mt as STX_ENGINE_BINDING_NAMES,Di as convertToCommonJS,hl as extractScriptFromTemplate,h as extractVariables,yl as hasVariables,Ig as isCompleteImport,Pg as isMissingBindingFailure,Rg as isModuleResolutionFailure,Ag as isSyntaxFailure,Og as splitDeclaration,Tg as stripTypeScript,$g as withoutStxReferrer};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{h,Di,hl,yl,Dg,Lg,jg,Bg,Fg,oo,zg,Ge,oe,Xe,Hg,jr,Vg,vl,xl,Bi,Je,s,An,Sl,y,ke,Ey}from"./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{xl as SIGNAL_COMPOSABLE_CALL,ke as clearComponentCache,Bi as componentClientSignalNames,Di as convertToCommonJS,y as createDetailedErrorMessage,Fg as extractDirectiveNames,hl as extractScriptFromTemplate,h as extractVariables,s as fileExists,Ey as getComponentCacheStats,Lg as getPositionInfo,oe as getSharedTranspiler,Sl as getSourceLineInfo,Bg as hasDirectives,yl as hasVariables,Vg as isHydrateTrigger,zg as isJavaScriptScript,Je as renderComponentWithSlot,An as resolveTemplatePath,Hg as scopeOnRootElement,oo as scopeSequenceKey,Ge as shouldTranspileTypeScript,vl as slotContentHasExpressions,Xe as transpileTypeScript,jr as userComponentFileExists,jg as validateDirective,Dg as validateTemplate};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
function I(){let{NODE_ENV:n}=process.env;return n==="production"}function te(){let{STX_DEBUG:n}=process.env;return!I()||n==="true"}function Ln(){let{NODE_ENV:n}=process.env;return n==="test"}function Yi(n,t){return t??(n==="compile"||I())}function et(n){if(!n)return n;try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(n).trim()}catch{return n}}
|
|
3
|
+
export{I,te,Ln,Yi,et};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Oh,Do,Nh,Mh,Dh,Lh}from"./chunk-ew3vs3jq.js";import"./chunk-cjv89tnb.js";import"./chunk-tgzs1kbj.js";import"./chunk-9f31gs4m.js";import"./chunk-0m4c42qt.js";import"./chunk-hmntqqyd.js";import"./chunk-v1s838fe.js";import"./chunk-nb6erf75.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{Lh as clearStoreCache,Oh as getStoreScript,Dh as getStoreScriptFor,Mh as pageStoresAll,Do as storesRead,Nh as storesReadInFiles};
|