@stacksjs/stx 0.2.876 → 0.2.881
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-h17pfbng.js → chunk-002zrse4.js} +2 -2
- 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-1jk46ve0.js +2 -0
- package/dist/chunk-1z6rrqvm.js +2 -0
- package/dist/{chunk-w8k9fz1w.js → chunk-1zkymrw0.js} +7 -7
- package/dist/chunk-2cvwjtjh.js +16 -0
- package/dist/{chunk-k0t9ye9j.js → chunk-2gg3vjks.js} +126 -71
- package/dist/{chunk-1q5w3xav.js → chunk-2r0nrvqe.js} +2 -2
- package/dist/{chunk-3922g6sh.js → chunk-345waetq.js} +9 -9
- package/dist/{chunk-eknm4jrm.js → chunk-3sema2js.js} +2 -2
- package/dist/{chunk-cvbwxskc.js → chunk-45jpwbzd.js} +5 -5
- package/dist/{chunk-qnwd5bz4.js → chunk-463weehv.js} +1 -1
- package/dist/{chunk-wm029dh0.js → chunk-4fkcn6z5.js} +18 -12
- package/dist/chunk-4frh1qg5.js +2 -0
- package/dist/{chunk-976kgb3r.js → chunk-4n45qa0b.js} +9 -9
- package/dist/chunk-4pjqj54a.js +2 -0
- package/dist/{chunk-ft6em3wm.js → chunk-50cnypys.js} +6 -6
- package/dist/chunk-51qyxm0y.js +2 -0
- 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-5hrx1p6g.js +2 -0
- package/dist/chunk-5mwzea5d.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-7kqgp3p7.js +2 -0
- package/dist/{chunk-wzvdr4ta.js → chunk-7mcs59pr.js} +2 -2
- 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-8nqyyj1h.js +33 -0
- package/dist/chunk-8qr3cmpb.js +2 -0
- package/dist/{chunk-ae8q4gze.js → chunk-8va3fs07.js} +5 -5
- package/dist/chunk-909tgpxp.js +2 -0
- package/dist/{chunk-xmws1gaf.js → chunk-94ctmp0j.js} +2 -2
- package/dist/chunk-95j7y1rt.js +2 -0
- package/dist/chunk-97kgrevs.js +4 -0
- package/dist/{chunk-mce3g2wb.js → chunk-9f31gs4m.js} +2 -2
- package/dist/chunk-9fvjr9dd.js +4 -0
- package/dist/chunk-9kza7gxd.js +2 -0
- package/dist/chunk-9yx7cbhz.js +25 -0
- package/dist/{chunk-nn6hvsxp.js → chunk-9zj3xztb.js} +2 -2
- package/dist/{chunk-b4d4tjvx.js → chunk-a0q0kb0s.js} +5 -5
- 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-asv4b65m.js +12 -0
- package/dist/chunk-axra1yas.js +2 -0
- package/dist/chunk-bhc25n2n.js +2 -0
- package/dist/chunk-brp8np3t.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-bjjfr7qt.js → chunk-care745q.js} +2 -2
- package/dist/chunk-cv1vm1w0.js +2 -0
- package/dist/{chunk-mw0rb1sf.js → chunk-czcx3nbx.js} +6 -6
- package/dist/{chunk-vnkvnenn.js → chunk-czzehcxs.js} +7 -7
- package/dist/chunk-d7b30bg6.js +2 -0
- package/dist/{chunk-cj44e8mw.js → chunk-d8qt6hjg.js} +5 -5
- package/dist/chunk-dfbbkjz6.js +3 -0
- package/dist/chunk-dv0cpmat.js +2 -0
- package/dist/{chunk-stn7p7f1.js → chunk-dwyhpbpx.js} +2 -2
- package/dist/chunk-dze7f9vv.js +2 -0
- package/dist/{chunk-y75bds1g.js → chunk-e362e615.js} +30 -30
- package/dist/{chunk-ydppkb8y.js → chunk-e41pgmgk.js} +2 -2
- package/dist/chunk-ekdhjm8p.js +54 -0
- package/dist/chunk-etavf6mr.js +2 -0
- package/dist/{chunk-jqxerj6k.js → chunk-ezna4dhj.js} +2 -2
- package/dist/chunk-f3j1h3ch.js +2 -0
- package/dist/chunk-f6ac0gbe.js +2 -0
- package/dist/chunk-fwhr3jda.js +2 -0
- package/dist/chunk-fxhgj8tp.js +2 -0
- package/dist/chunk-fz4c5e9m.js +2 -0
- package/dist/{chunk-esjr9qhe.js → chunk-g2xy0z0e.js} +2 -2
- package/dist/chunk-g5q0wgzk.js +2 -0
- package/dist/{chunk-j0rqa9bk.js → chunk-gad3ebgr.js} +5 -5
- package/dist/{chunk-kywe0f1v.js → chunk-gbncp2gp.js} +2 -2
- package/dist/{chunk-df6vjs3p.js → chunk-gmbw1xhm.js} +5 -5
- package/dist/chunk-gmp10259.js +2 -0
- package/dist/chunk-gs6geqeg.js +2 -0
- package/dist/chunk-h26mpqrh.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-g15reb1h.js → chunk-hnxwqamj.js} +8 -8
- package/dist/{chunk-3w7gacva.js → chunk-hxhmhw23.js} +3 -3
- package/dist/{chunk-6kp4mg3h.js → chunk-jc74097x.js} +2 -2
- package/dist/chunk-jghpzx5m.js +2 -0
- package/dist/{chunk-fh72k2ks.js → chunk-jqvc2wbz.js} +6 -6
- package/dist/chunk-k52126rh.js +2 -0
- package/dist/chunk-k7ffxfgp.js +3 -0
- package/dist/{chunk-f4vgagjb.js → chunk-kee5a3ce.js} +3 -3
- package/dist/chunk-kyh32kma.js +20 -0
- package/dist/{chunk-2tcyfrvb.js → chunk-m91jj8nq.js} +2 -2
- package/dist/chunk-my3yv4sg.js +2 -0
- package/dist/chunk-nb6erf75.js +9 -0
- package/dist/chunk-ndqq991c.js +26 -0
- package/dist/chunk-ngzyzcrp.js +2 -0
- package/dist/chunk-nj1ssjtd.js +2 -0
- package/dist/chunk-njza56wn.js +1198 -0
- package/dist/{chunk-ttjscvre.js → chunk-nnynrb97.js} +3 -3
- package/dist/chunk-p6hcrg3r.js +3 -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-mkwavsb3.js → chunk-pm27mcfp.js} +3 -3
- package/dist/chunk-pstbfz5g.js +2 -0
- package/dist/chunk-pt3rp3zg.js +2 -0
- package/dist/chunk-pw9qqcw3.js +2 -0
- package/dist/chunk-q1jjgg4w.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-qg1kw5yf.js +2 -0
- package/dist/chunk-r32ddrvn.js +21 -0
- package/dist/{chunk-rzd9hyhv.js → chunk-ram5944w.js} +2 -2
- package/dist/{chunk-p5m1z6e1.js → chunk-rcxer2km.js} +4 -4
- package/dist/{chunk-x2ftkaz3.js → chunk-rsxxajv6.js} +2 -2
- package/dist/chunk-rw5sxr5a.js +2 -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-zgds9nwv.js → chunk-smkerejj.js} +44 -44
- package/dist/{chunk-ysfgabpf.js → chunk-sn4ndpd7.js} +3 -3
- package/dist/{chunk-7rep2jqh.js → chunk-sq6werer.js} +23 -23
- package/dist/{chunk-zc8a2erc.js → chunk-ssg6ne5b.js} +4 -4
- package/dist/{chunk-afxfkb60.js → chunk-sv7fdqmc.js} +6 -6
- package/dist/chunk-t8r40wgf.js +2 -0
- package/dist/{chunk-dbvsa5ya.js → chunk-t94y8g35.js} +2 -2
- package/dist/{chunk-xtaq95em.js → chunk-v1s838fe.js} +1 -1
- package/dist/chunk-v5cah9pt.js +2 -0
- package/dist/chunk-v8ea76j6.js +2 -0
- package/dist/chunk-vxw92h3q.js +2 -0
- package/dist/{chunk-ctjxcaxq.js → chunk-w53p65hy.js} +66 -66
- package/dist/chunk-w5zzwe2f.js +2 -0
- package/dist/chunk-wbmx0rge.js +2 -0
- package/dist/chunk-wfthd3n5.js +2 -0
- package/dist/chunk-wjafpvjv.js +2 -0
- package/dist/chunk-ws2h92mm.js +3 -0
- package/dist/chunk-xf6snj8e.js +38 -0
- package/dist/chunk-xfhxfcvk.js +2 -0
- 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-v0tdg16k.js → chunk-ybjgnnyf.js} +5 -5
- package/dist/{chunk-x4jzhgdm.js → chunk-yffqfgjx.js} +2 -2
- package/dist/chunk-yh2hnt3m.js +12 -0
- package/dist/{chunk-2mt2zc5y.js → chunk-ym0cdk7m.js} +10 -10
- package/dist/{chunk-w6pzkcjp.js → chunk-ymqm898x.js} +2 -2
- package/dist/{chunk-2zaatnnh.js → chunk-yp4tn4zn.js} +4 -4
- package/dist/{chunk-fwbccyhw.js → chunk-ypsf5y5g.js} +2 -2
- package/dist/chunk-z7k1xn6k.js +2 -0
- 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/dev-server/ts-css.js +3 -3
- 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 +42 -16
- 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-027meh1k.js +0 -2
- package/dist/chunk-0hs633pt.js +0 -2
- package/dist/chunk-0j8zre1m.js +0 -2
- package/dist/chunk-0v02qms8.js +0 -2
- package/dist/chunk-0z9gttw0.js +0 -2
- package/dist/chunk-11dwmcpy.js +0 -3
- package/dist/chunk-1a237qky.js +0 -33
- package/dist/chunk-1ehjzhnc.js +0 -25
- package/dist/chunk-1gfg6qmr.js +0 -2
- package/dist/chunk-1kgnk6ds.js +0 -2
- package/dist/chunk-1ztp5vkh.js +0 -3
- package/dist/chunk-32wvc376.js +0 -2
- package/dist/chunk-3k2d2jsn.js +0 -2
- package/dist/chunk-3te2y9qf.js +0 -2
- package/dist/chunk-40330tm5.js +0 -2
- package/dist/chunk-447jc6zc.js +0 -2
- package/dist/chunk-4dk6k0ad.js +0 -2
- package/dist/chunk-4e48zkq0.js +0 -2
- package/dist/chunk-5ep7p8te.js +0 -2
- package/dist/chunk-5gx403te.js +0 -1184
- package/dist/chunk-6q9a5bph.js +0 -2
- package/dist/chunk-7ds9mx4c.js +0 -2
- package/dist/chunk-7njy024g.js +0 -2
- package/dist/chunk-7tjewwmd.js +0 -2
- package/dist/chunk-85xabvtj.js +0 -2
- package/dist/chunk-880f8j99.js +0 -2
- package/dist/chunk-8f3dbthj.js +0 -2
- package/dist/chunk-99e3mxnn.js +0 -20
- package/dist/chunk-9gv847nn.js +0 -2
- package/dist/chunk-9mz2n39m.js +0 -2
- package/dist/chunk-akthsg33.js +0 -54
- package/dist/chunk-b1tcym2x.js +0 -2
- package/dist/chunk-bdh73gxd.js +0 -4
- package/dist/chunk-bspj1rf1.js +0 -2
- package/dist/chunk-bx3hpsxn.js +0 -2
- package/dist/chunk-byq488g4.js +0 -2
- package/dist/chunk-c4s25bm2.js +0 -2
- package/dist/chunk-csjqtzwc.js +0 -2
- package/dist/chunk-df78j74w.js +0 -4
- package/dist/chunk-dgs3d367.js +0 -2
- package/dist/chunk-dmf6zcf4.js +0 -2
- package/dist/chunk-dv56x3g8.js +0 -16
- package/dist/chunk-e2b2f502.js +0 -2
- package/dist/chunk-ec6mrad6.js +0 -2
- package/dist/chunk-eecctzgp.js +0 -17
- package/dist/chunk-fa57bncd.js +0 -2
- package/dist/chunk-g4eheg0t.js +0 -24
- package/dist/chunk-gfe1jrw9.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-hat353vx.js +0 -2
- package/dist/chunk-jmjgj3nh.js +0 -2
- package/dist/chunk-jqtpzzz4.js +0 -12
- package/dist/chunk-jvy7z3hz.js +0 -3
- package/dist/chunk-k9dne5by.js +0 -12
- package/dist/chunk-kq8mffgf.js +0 -2
- package/dist/chunk-kx06jzdw.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-nthw4dca.js +0 -2
- package/dist/chunk-pp99rmjm.js +0 -72
- package/dist/chunk-pqmjeea6.js +0 -2
- package/dist/chunk-qggwr60r.js +0 -2
- package/dist/chunk-qm3v4qb7.js +0 -2
- package/dist/chunk-qty0t69x.js +0 -2
- package/dist/chunk-rjv6885r.js +0 -2
- package/dist/chunk-rm5gbthk.js +0 -2
- package/dist/chunk-sgengtap.js +0 -2
- package/dist/chunk-snz2cxqv.js +0 -2
- package/dist/chunk-szp7ajfm.js +0 -33
- package/dist/chunk-ts37jw3s.js +0 -2
- package/dist/chunk-v4emesnw.js +0 -2
- package/dist/chunk-vnrbjbrw.js +0 -3
- package/dist/chunk-vxra53wq.js +0 -2
- package/dist/chunk-x76qvq1n.js +0 -2
- package/dist/chunk-x85z6dmw.js +0 -2
- package/dist/chunk-xkfe03y9.js +0 -2
- package/dist/chunk-y4hn1qh0.js +0 -2
- package/dist/chunk-yc8ggeh2.js +0 -2
- package/dist/chunk-yfed67yc.js +0 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{
|
|
2
|
+
import{el,s,ke}from"./chunk-njza56wn.js";import{ft}from"./chunk-6c1vm6bs.js";import{l}from"./chunk-s7xywsqd.js";import o from"fs";import u from"path";var fg=new Map,m=new Map;async function dy(e){let n;for(let i=0;i<3;i++)try{let g=(await o.promises.stat(e)).mtime.getTime(),a=m.get(e);if(a&&a.mtime===g)return a.content;let h=await Bun.file(e).text(),w=(await o.promises.stat(e)).mtime.getTime();if(w!==g)continue;return m.set(e,{content:h,mtime:w}),h}catch(r){n=r;break}throw m.delete(e),Error(`File not found: ${e}${n?` (${n.message})`:""}`)}function py(e){m.delete(e)}function fy(e){for(let t of m.keys())if(t.startsWith(e))m.delete(t)}var f=null,B=null,x=null;function gy(e){x=e}async function gg(e=!1){let t=x??await import("./chunk-rw5sxr5a.js");if(e)return t.generateSignalsRuntimeDev();if(f===null)f=t.generateSignalsRuntime();return f}var S=null;async function mg(){if(S===null){let{getRouterScript:e}=await import("./chunk-1z6rrqvm.js");S=e()}return S}var y={};async function my(e,t=!1){let n=e==="runtime"?await gg(t):await mg(),i=e==="runtime"&&t?"runtime-debug":e,r=y[i];if(!r||r.content!==n)r={content:n,hash:Bun.hash(n).toString(16).padStart(16,"0").slice(0,16)},y[i]=r;return{content:n,hash:r.hash,url:`/_stx/${e}.${r.hash}.js`}}var E=500,T=33554432,c=new Map,p=0;function C(e){return l(process.cwd(),"module-bundles",`${e}.js`)}function hy(e){let t=Bun.hash(e).toString(16).padStart(16,"0").slice(0,16),n=c.get(t),i=n!==void 0;if(i)c.delete(t),p-=n.length*2;c.set(t,e),p+=e.length*2;while(c.size>1&&(c.size>E||p>T)){let r=c.keys().next().value;p-=c.get(r).length*2,c.delete(r)}if(!i)try{let r=C(t);if(!o.existsSync(r))o.mkdirSync(u.dirname(r),{recursive:!0}),o.writeFileSync(r,e)}catch{}return`/_stx/modules.${t}.js`}function fi(e){if(!/^[0-9a-f]{16}$/.test(e))return;let t=c.get(e);if(t!==void 0)return t;try{return o.readFileSync(C(e),"utf8")}catch{return}}function yy(){m.clear(),ke(),el(),f=null,B=null,S=null}function v(e){let t={debug:e.debug===!0,middleware:(e.middleware??[]).map((n)=>({name:n.name,timing:n.timing,handler:String(n.handler)})),customDirectives:(e.customDirectives??[]).map((n)=>({name:n.name,hasEndTag:n.hasEndTag===!0,rawParams:n.rawParams===!0,handler:String(n.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(t)).digest("hex")}async function Sr(e,t){try{if(!t.cachePath)return null;let n=u.resolve(t.cachePath),i=u.join(n,`${Os(e)}.html`),r=u.join(n,`${Os(e)}.meta.json`);if(!await s(i)||!await s(r))return null;let g=await Bun.file(r).text(),a=JSON.parse(g);if(a.cacheVersion!==t.cacheVersion)return null;if(a.engine!==ft())return null;if(a.optionsSignature!==v(t))return null;if((await o.promises.stat(e)).mtime.getTime()>a.mtime)return null;for(let d of a.dependencies)if(await s(d)){if((await o.promises.stat(d)).mtime.getTime()>a.mtime)return null}else return null;return await Bun.file(i).text()}catch(n){return console.warn(`Cache error for ${e}:`,n),null}}async function kr(e,t,n,i){try{if(!i.cachePath)return;let r=u.resolve(i.cachePath);await o.promises.mkdir(r,{recursive:!0});let g=u.join(r,`${Os(e)}.html`),a=u.join(r,`${Os(e)}.meta.json`),h=await o.promises.stat(e);await Bun.write(g,t);let d={sourcePath:e,mtime:h.mtime.getTime(),dependencies:Array.from(n),cacheVersion:i.cacheVersion,engine:ft(),optionsSignature:v(i),generatedAt:Date.now()};await Bun.write(a,JSON.stringify(d,null,2)),fg.set(e,{output:t,mtime:h.mtime.getTime(),dependencies:n})}catch(r){console.warn(`Failed to cache template ${e}:`,r)}}var _=16;function Os(e){return new Bun.CryptoHasher("sha1").update(e).digest("hex").substring(0,_)}
|
|
3
|
+
export{fg,dy,py,fy,gy,gg,mg,my,hy,fi,yy,Sr,kr,Os};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{h,y,g}from"./chunk-
|
|
2
|
+
import{h,y,g}from"./chunk-njza56wn.js";import{W}from"./chunk-w53p65hy.js";import{i}from"./chunk-2gg3vjks.js";import k from"path";var q={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},T=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var M=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function H(e){let t=[],o=0,n;M.lastIndex=0;while((n=M.exec(e))!==null){if(n.index>o){let a=e.slice(o,n.index);if(a.trim())t.push({type:t.length===0?"shell":"content",content:a})}let s=n[1],r=n[2];t.push({type:"suspense",name:s,content:r}),o=n.index+n[0].length}if(o<e.length){let s=e.slice(o);if(s.trim())t.push({type:t.length===0?"shell":"content",content:s})}if(t.length===0)t.push({type:"shell",content:e});return t}async function lh(e,t={},o={}){let n={...W,...o,streaming:{...q,...o.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(r){try{let a=await Bun.file(e).text(),S=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),p=S?S[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),f={...t,__filename:e,__dirname:k.dirname(e)};if(p.trim())await h(p,f,e);let E=H(c),l=new Set;if(!E.some((w)=>w.type==="suspense")){let w=n.streaming?.strategy||"auto",x=new RegExp(T.source,"g");if(!(w!=="manual"&&x.test(c))){let u=await i(c,f,e,n,l);for(let b=0;b<u.length;b+=s)r.enqueue(u.slice(b,b+s)),await new Promise((m)=>setTimeout(m,0))}else{let u=[],b=new RegExp(T.source,"g"),m;while((m=b.exec(c))!==null)u.push({name:m[1],content:m[2],start:m.index,end:m.index+m[0].length});let v=0;for(let _ of u){if(_.start>v){let I=c.slice(v,_.start);if(I.trim()){let O=await i(I,f,e,n,l);r.enqueue(O),await new Promise((D)=>setTimeout(D,0))}}let C=await i(_.content,f,e,n,l);r.enqueue(C),await new Promise((I)=>setTimeout(I,0)),v=_.end}if(v<c.length){let _=c.slice(v);if(_.trim()){let C=await i(_,f,e,n,l);r.enqueue(C)}}}}else{let w=new Map;for(let d of E)if(d.type==="shell"||d.type==="content"){let u=await i(d.content,f,e,n,l);r.enqueue(u)}else if(d.type==="suspense"&&d.name){let u=`stx-suspense-${d.name}`;r.enqueue(`<div id="${u}" data-suspense="${d.name}" style="display:contents;">
|
|
3
3
|
<template data-suspense-fallback>Loading...</template>
|
|
4
4
|
</div>`),w.set(d.name,i(d.content,f,e,n,l))}r.enqueue(`
|
|
5
5
|
<script>
|
|
@@ -17,13 +17,13 @@ import{h,y,g}from"./chunk-5gx403te.js";import{U}from"./chunk-ctjxcaxq.js";import
|
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
})();
|
|
20
|
-
</script>`);let x=Array.from(w.entries()).map(async([d,u])=>{r.enqueue(await
|
|
20
|
+
</script>`);let x=Array.from(w.entries()).map(async([d,u])=>{r.enqueue(await za(d,u))});await Promise.all(x)}r.close()}catch(a){r.error(a)}}})}async function za(e,t){try{let n=(await t).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
|
|
21
21
|
<script>
|
|
22
22
|
window.__stxSuspense.resolve('${e}', \`${n}\`);
|
|
23
23
|
</script>`}catch(o){let n=o instanceof Error?o.message:String(o);return`
|
|
24
24
|
<script>
|
|
25
25
|
window.__stxSuspense.resolve('${e}', '<div class="stx-error">Error loading content: ${g(n)}</div>');
|
|
26
|
-
</script>`}}var
|
|
26
|
+
</script>`}}var Lu=`
|
|
27
27
|
<script>
|
|
28
28
|
(function(){
|
|
29
29
|
window.__stxSuspense = window.__stxSuspense || {
|
|
@@ -43,12 +43,12 @@ window.__stxSuspense.resolve('${e}', '<div class="stx-error">Error loading conte
|
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
})();
|
|
46
|
-
</script>`;function z(e,t,o){if(!t||t<=0)return e;let n,s=new Promise((r,a)=>{n=setTimeout(()=>a(Error(`streaming boundary "${o}" timed out after ${t}ms`)),t)});return Promise.race([e,s]).finally(()=>clearTimeout(n))}function
|
|
46
|
+
</script>`;function z(e,t,o){if(!t||t<=0)return e;let n,s=new Promise((r,a)=>{n=setTimeout(()=>a(Error(`streaming boundary "${o}" timed out after ${t}ms`)),t)});return Promise.race([e,s]).finally(()=>clearTimeout(n))}function uh(e,t=[],o={}){let n=o.timeoutMs??0;return new ReadableStream({async start(s){try{if(s.enqueue(e),t.length>0)s.enqueue(Lu),await Promise.all(t.map(async(r)=>{let a=z(r.render(),n,r.id);s.enqueue(await za(r.id,a))}));s.close()}catch(r){s.error(r)}}})}var A=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;function dh(e,t){return e.replace(A,(o,n,s)=>{let r=n.trim(),a=s.split(/@fallback/i),S=a[0].trim(),p=a.length>1?a.slice(1).join("@fallback").trim():"";if(!t.__streamTemplates)t.__streamTemplates={};return t.__streamTemplates[r]=S,`<div data-suspense="${r}">${p}</div>`})}function ph(e){let t=e?.streamBoundaries;if(!t||typeof t!=="object")return;let o=Object.entries(t).filter(([,n])=>typeof n==="function");return o.length>0?o.map(([n,s])=>({id:n,render:s})):void 0}async function fh(e,t={},o={}){let n={...W,...o,streaming:{...q,...o.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(r){try{let a=await Bun.file(e).text(),S=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),p=S?S[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),f={...t,__filename:e,__dirname:k.dirname(e)};if(p.trim())await h(p,f,e);let E=new Set,l=n.streaming?.strategy||"auto",R=new RegExp(T.source,"g");if(!(l!=="manual"&&R.test(c))){let x=await i(c,f,e,n,E);for(let d=0;d<x.length;d+=s)r.enqueue(x.slice(d,d+s))}else{let x=[],d=new RegExp(T.source,"g"),u;while((u=d.exec(c))!==null)x.push({name:u[1],content:u[2],start:u.index,end:u.index+u[0].length});let b=0;for(let m of x){if(m.start>b){let _=c.slice(b,m.start);if(_.trim()){let C=await i(_,f,e,n,E);r.enqueue(C)}}let v=await i(m.content,f,e,n,E);r.enqueue(v),b=m.end}if(b<c.length){let m=c.slice(b);if(m.trim()){let v=await i(m,f,e,n,E);r.enqueue(v)}}}r.close()}catch(a){r.error(a)}}})}async function gh(e,t={}){let o={...W,...t,streaming:{...q,...t.streaming}},n=await Bun.file(e).text(),s=n.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),r=s?s[1]:"",a=n.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),S=a,p={},c;T.lastIndex=0;while((c=T.exec(a))!==null){let l=c[1],R=c[2];p[l]=R}let f=a.replace(T,"");return{renderShell:async(l={})=>{let R={...l,__filename:e,__dirname:k.dirname(e)};return await h(r,R,e),i(f,R,e,o,new Set)},renderSection:async(l,R={})=>{try{if(!p[l])return`<div class="error-message">Section "${g(l)}" not found in template "${g(e)}"</div>`;let w={...R,__filename:e,__dirname:k.dirname(e)};await h(r,w,e);let x=new Set;return await i(p[l],w,e,o,x)}catch(w){let x=w instanceof Error?w.message:String(w);return y("Expression",x,e,p[l]||"",0,p[l]||"")}},getSections:()=>Object.keys(p),getTemplate:()=>S}}var ju={name:"suspense",hasEndTag:!0,handler:(e,t,o,n)=>{if(!t||t.length===0)throw Error("Suspense directive requires a name parameter");let s=t[0].replace(/['"`]/g,"");return`<!-- @suspense:${s} -->${e}<!-- @endsuspense:${s} -->`}},Bu={name:"island",hasEndTag:!0,handler:(e,t,o,n)=>{if(!t||t.length===0)throw Error("Island directive requires a name parameter");let s=t[0].replace(/['"`]/g,""),r=t[1]?t[1].replace(/['"`]/g,""):"lazy",a=`island-${s}-${Math.random().toString(36).substring(2,9)}`,S=e.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),p=S?S[1].trim():"",c=S?e.replace(S[0],""):e;return`<div data-island="${s}" data-island-id="${a}" data-priority="${r}">
|
|
47
47
|
${c}
|
|
48
48
|
<script type="application/json" data-island-props="${a}">
|
|
49
49
|
${p?`{${p}}`:"{}"}
|
|
50
50
|
</script>
|
|
51
|
-
</div>`}};function
|
|
51
|
+
</div>`}};function mh(e={}){let t=[];if(e.streaming?.enabled)t.push(ju);if(e.hydration?.enabled)t.push(Bu);return t}async function hh(e,t,o,n={}){return e}function yh(e,t={}){let o=new TextEncoder,n=e.pipeThrough(new TransformStream({transform(r,a){a.enqueue(o.encode(r))}})),s=new Headers(t.headers);if(!s.has("Content-Type"))s.set("Content-Type","text/html; charset=utf-8");if(!s.has("Transfer-Encoding"))s.set("Transfer-Encoding","chunked");if(!s.has("X-Content-Type-Options"))s.set("X-Content-Type-Options","nosniff");if(!s.has("X-Accel-Buffering"))s.set("X-Accel-Buffering","no");return new Response(n,{...t,headers:s})}function bh(e={mode:"full"}){let{mode:t,components:o={},dynamicImports:n=!0}=e,s=Object.entries(o).map(([r,a])=>`'${r}': ${n?`() => import('${a}')`:`require('${a}')`}`).join(`,
|
|
52
52
|
`);if(t==="loader")return`
|
|
53
53
|
(function() {
|
|
54
54
|
window.__stx = window.__stx || {};
|
|
@@ -191,4 +191,4 @@ else {
|
|
|
191
191
|
stx.hydrate();
|
|
192
192
|
}
|
|
193
193
|
})();`}
|
|
194
|
-
export{
|
|
194
|
+
export{lh,za,Lu,uh,dh,ph,fh,gh,ju,Bu,mh,hh,yh,bh};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{mt,Tg,$g,Rg,Ag,Pg,h,Ig,Di,Og,hl,yl}from"./chunk-njza56wn.js";import"./chunk-yffqfgjx.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};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{existsSync as A,mkdtempSync as D,readdirSync as M,rmSync as b,statSync as g,writeFileSync as k}from"fs";import{constants as P,tmpdir as x}from"os";import{join as s}from"path";import t from"process";var _=/^stx-(?:.+-)?p(\d+)-\w{6}$/,v=".stx-keep",I=60000,N=["SIGINT","SIGTERM","SIGHUP"],i=new Set,y=new Set,c=!1,S=new Set;function p(e){try{b(e,{recursive:!0,force:!0})}catch{}}function R(){for(let e of i)p(e);i.clear(),f()}function E(){for(let e of i)p(e);i.clear()}function C(e){if(R(),t.listenerCount(e)===0)t.exit(128+(P.signals[e]??1))}var h=new Map(N.map((e)=>[e,()=>C(e)]));function G(){if(c)return;c=!0,t.on("exit",E);for(let[e,n]of h)try{t.on(e,n)}catch{}}function f(){if(!c)return;c=!1,t.off("exit",E);for(let[e,n]of h)t.off(e,n)}function K(e){try{return t.kill(e,0),!0}catch(n){return n.code==="EPERM"}}function O(e={}){let n=e.root??x(),r=e.isAlive??K,w=e.minAgeMs??I,T=e.now??Date.now(),a=[],u;try{u=M(n)}catch{return a}for(let d of u){let l=_.exec(d);if(!l)continue;let m=Number(l[1]);if(m===t.pid||r(m))continue;let o=s(n,d);try{if(!g(o).isDirectory())continue;if(T-g(o).mtimeMs<w)continue;if(A(s(o,v)))continue}catch{continue}p(o),a.push(o)}return a}function L(e){let n=e.replace(/^stx-/,"").replace(/-+$/,"");return n?`stx-${n}-p${t.pid}-`:`stx-p${t.pid}-`}function z(e=t.env){let n=e.STX_KEEP_TEMP?.trim().toLowerCase();return!!n&&n!=="0"&&n!=="false"}function
|
|
3
|
-
`)}catch{}if(y.add(e),i.delete(e),i.size===0)f()}async function
|
|
4
|
-
export{
|
|
2
|
+
import{existsSync as A,mkdtempSync as D,readdirSync as M,rmSync as b,statSync as g,writeFileSync as k}from"fs";import{constants as P,tmpdir as x}from"os";import{join as s}from"path";import t from"process";var _=/^stx-(?:.+-)?p(\d+)-\w{6}$/,v=".stx-keep",I=60000,N=["SIGINT","SIGTERM","SIGHUP"],i=new Set,y=new Set,c=!1,S=new Set;function p(e){try{b(e,{recursive:!0,force:!0})}catch{}}function R(){for(let e of i)p(e);i.clear(),f()}function E(){for(let e of i)p(e);i.clear()}function C(e){if(R(),t.listenerCount(e)===0)t.exit(128+(P.signals[e]??1))}var h=new Map(N.map((e)=>[e,()=>C(e)]));function G(){if(c)return;c=!0,t.on("exit",E);for(let[e,n]of h)try{t.on(e,n)}catch{}}function f(){if(!c)return;c=!1,t.off("exit",E);for(let[e,n]of h)t.off(e,n)}function K(e){try{return t.kill(e,0),!0}catch(n){return n.code==="EPERM"}}function O(e={}){let n=e.root??x(),r=e.isAlive??K,w=e.minAgeMs??I,T=e.now??Date.now(),a=[],u;try{u=M(n)}catch{return a}for(let d of u){let l=_.exec(d);if(!l)continue;let m=Number(l[1]);if(m===t.pid||r(m))continue;let o=s(n,d);try{if(!g(o).isDirectory())continue;if(T-g(o).mtimeMs<w)continue;if(A(s(o,v)))continue}catch{continue}p(o),a.push(o)}return a}function L(e){let n=e.replace(/^stx-/,"").replace(/-+$/,"");return n?`stx-${n}-p${t.pid}-`:`stx-p${t.pid}-`}function z(e=t.env){let n=e.STX_KEEP_TEMP?.trim().toLowerCase();return!!n&&n!=="0"&&n!=="false"}function st(e="stx",n=x()){if(!S.has(n))S.add(n),O({root:n});let r=D(s(n,L(e)));if(z())return H(r),console.warn(`[stx] STX_KEEP_TEMP: keeping ${r}`),r;return G(),i.add(r),r}function pe(e){if(y.has(e))return;if(p(e),i.delete(e),i.size===0)f()}function H(e){try{k(s(e,v),`kept by pid ${t.pid}
|
|
3
|
+
`)}catch{}if(y.add(e),i.delete(e),i.size===0)f()}async function wc(e,n){let r=st(e);try{return await n(r)}finally{pe(r)}}
|
|
4
|
+
export{st,pe,wc};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{fr,Fe}from"./chunk-9f31gs4m.js";import{G,S,Pr,Js,A}from"./chunk-njza56wn.js";import{a,L}from"./chunk-w53p65hy.js";import{Yo}from"./chunk-45jpwbzd.js";import{Z}from"./chunk-nb6erf75.js";import{ft}from"./chunk-6c1vm6bs.js";import{l}from"./chunk-s7xywsqd.js";import{t,C}from"./chunk-yh2hnt3m.js";import d from"path";import j from"fs";import{AsyncLocalStorage as lt}from"async_hooks";import{randomUUID as St}from"crypto";var vt=12;function X(e,n,s){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(d.basename(e))||Yo(e,n,s)}var ct=2;function Kf(e){let n=process.env.STX_BUNDLE_CACHE_DIR?.trim();return n?d.resolve(n):l(e,"bundle-cache")}function rt(e,n){let s=e;for(let i of Bt(n))if(i!==d.sep)s=s.split(i).join("\x00root");return s}var it=new Map;function Bt(e){let n=d.resolve(e),s=it.get(n);if(!s){let i=n;try{i=j.realpathSync(n)}catch{}s=[...new Set([n,i])].sort((c,p)=>p.length-c.length),it.set(n,s)}return s}function jt(e,n){try{let s=j.statSync(e),i=d.resolve(n),c=e.startsWith(`${i}${d.sep}`);return{path:c?d.relative(i,e):e,...c?{inRoot:!0}:{},mtimeMs:s.mtimeMs,size:s.size,hash:Bun.hash(j.readFileSync(e)).toString(36)}}catch{return null}}function ut(e,n){return e.inRoot?d.join(d.resolve(n),e.path):e.path}function Et(e,n){for(let s of e){let i=ut(s,n);try{let c=j.statSync(i);if(c.size!==s.size)return!1;if(c.mtimeMs!==s.mtimeMs&&Bun.hash(j.readFileSync(i)).toString(36)!==s.hash)return!1}catch{return!1}}return!0}var dt=new Map,_t=100;function Gf(e=process.env){let n=Number(e.STX_BUNDLE_CACHE_LIMIT);return Number.isFinite(n)&&n>=1?Math.floor(n):2000}var q=new Map;async function Mt(e){let n=q.get(e)??0;if(n>0&&n<_t){q.set(e,n+1);return}q.set(e,1);try{let s=(await j.promises.readdir(e)).filter((o)=>o.endsWith(".js")),i=Gf();if(s.length<=i)return;let p=(await Promise.all(s.map(async(o)=>{try{return{name:o,at:(await j.promises.stat(d.join(e,o))).mtimeMs}}catch{return null}}))).filter((o)=>o!==null);p.sort((o,b)=>b.at-o.at);for(let o of p.slice(i)){let b=o.name.slice(0,-3);await j.promises.rm(d.join(e,`${b}.js`),{force:!0}),await j.promises.rm(d.join(e,`${b}.deps.json`),{force:!0})}N("pruned bundle cache to",i,"entries")}catch{}}function Ce(e){return dt.get(e)??[]}function Y(e,n){if(e)dt.set(e,n)}function Xf(e=process.env){return e.STX_DEBUG==="true"||e.STX_DEBUG==="1"}function N(...e){if(Xf())console.log("[stx:bundler]",...e)}var et=[];function kc(e,n,s){et.push({filePath:e||"<inline>",message:n,details:s})}function gn(){return et.slice()}function mn(){et.length=0}var K;function Zh(e){K=e}function _c(){if(K)return K;try{let e=L.strict;return typeof e==="object"&&e!==null?e.bundlerFallback??"warn":"warn"}catch{return"warn"}}var tt=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function hn(e){let n=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,s;while((s=n.exec(e))!==null){let c=s[1];if(!tt.some((o)=>o.test(c)))return N("detected user import:",c),!0}let i=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((s=i.exec(e))!==null){let c=s[1];if(/\.css(?:\?.*)?$/.test(c))continue;if(!tt.some((o)=>o.test(c)))return N("detected side-effect import:",c),!0}return!1}var pr="stx-module:",Rt=/\.(?:[cm]?[jt]sx?|json)$/i;function Jf(e,n){return d.relative(e,n).split(d.sep).join("/")}function Yf(e,n){if(n.size===0)return e;return e.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(s,i,c,p)=>{let o=n.get(p);return o&&!p.startsWith(pr)?`${i}${c}${o}${c}`:s})}function Zf(e,n){let s=0,i=(p)=>{let o=`__stxMod${s++}`,b=JSON.stringify(p);return n.push(`var ${o} = globalThis.__stxModules && globalThis.__stxModules[${b}];`,`if (${o} === undefined) throw new Error("[stx] module " + ${JSON.stringify(b)} + " is not registered on this page (#1957)");`),o},c=(p,o)=>{for(let b of p.split(",")){let I=b.trim();if(!I)continue;let M=I.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!M)continue;let w=M[1].startsWith('"')?JSON.parse(M[1]):M[1],f=M[2]??w;n.push(`var ${f} = ${o}[${JSON.stringify(w)}];`)}};return e=e.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,o,b)=>{let I=b.slice(pr.length),M=i(I),w=o.trim(),f=w.match(/^([\w$]+)\s*(?:,\s*|$)/);if(f&&!w.startsWith("{")&&!w.startsWith("*"))n.push(`var ${f[1]} = ${M}.default;`),w=w.slice(f[0].length).trim();let v=w.match(/^\*\s*as\s+([\w$]+)$/);if(v)n.push(`var ${v[1]} = ${M};`);else if(w.startsWith("{"))c(w.replace(/^\{|\}$/g,""),M);return""}),e=e.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,o)=>(i(o.slice(pr.length)),"")),e}function ot(e){let n=[e,`${e}.ts`,`${e}.tsx`,`${e}.js`,`${e}.mjs`,`${e}.jsx`,d.join(e,"index.ts"),d.join(e,"index.tsx"),d.join(e,"index.js"),d.join(e,"index.mjs")];for(let s of n)try{if(j.existsSync(s)&&j.statSync(s,{throwIfNoEntry:!1})?.isFile())return s}catch{}return}var H=new lt;function ws(e,n){let s=new Bun.CryptoHasher("md5");for(let[i,c]of[...e].sort(([p],[o])=>p<o?-1:p>o?1:0))s.update(`${i}\x00${c}\x00`);return H.run({modules:e,key:s.digest("hex").slice(0,12)},n)}var pt=new lt;function Qf(e){return pt.run(!0,e)}function eg(){return pt.getStore()===!0}function Cc(e){if(!eg())return;throw Error(`The client script of ${e} needs bundling, and it is being rendered inside a Bun.build loader, where Bun never finishes a second build. Make the page an entrypoint of the build (bun-plugin-stx renders entrypoints before the bundler starts), or render it once outside the build so its bundle is cached.`)}function yn(){return H.getStore()?.key??""}function mt(e,n,s,i,c,p,o=new Map,b,I,M){let w=new Map([[s,i],...M??[]]),f=(B)=>B!==void 0&&w.has(B),v=(B,r,u)=>{if(X(r,e,b))return null;if(!p||!f(B)||!Rt.test(r))return null;try{if(!j.statSync(r,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}c.add(r);let E=`${pr}${Jf(process.cwd(),r)}`;return o.set(u,E),{path:E,external:!0}},y=(B,r)=>{let u=f(B)?n:d.dirname(B),E=d.resolve(u,r);return ot(E)??E};return{name:"stx-client-bundle",setup(B){if(B.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(r)=>({path:r.path,external:!0})),B.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(r)=>({path:r.path,external:!0})),B.onResolve({filter:/^\//},(r)=>{if(f(r.path))return{path:r.path};let u=ot(r.path);if(u){let E=v(r.importer,u,r.path);if(E)return E;if(!f(u))c.add(u);return{path:u}}return{path:r.path,external:!0}}),B.onResolve({filter:/^\.\.?\//},(r)=>{let u=y(r.importer,r.path),E=v(r.importer,u,r.path);if(E)return E;return c.add(u),{path:u}}),B.onResolve({filter:/^[@~]\//},(r)=>{let u=d.resolve(e,r.path.slice(2)),E=[u,`${u}.ts`,`${u}.tsx`,`${u}.js`,`${u}.mjs`,`${u}.jsx`,d.join(u,"index.ts"),d.join(u,"index.tsx"),d.join(u,"index.js"),d.join(u,"index.mjs")];for(let h of E)if(j.existsSync(h)&&j.statSync(h,{throwIfNoEntry:!1})?.isFile()){let D=v(r.importer,h,r.path);if(D)return D;return N(`resolved ${r.path[0]}/ import:`,r.path,"\u2192",h),c.add(h),{path:h}}return console.warn(`[stx:bundler] could not resolve ${r.path[0]}/ import:`,r.path),{path:u}}),p)B.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(r)=>{if(!f(r.importer))return;let u=`${pr}npm:${r.path}`;return o.set(r.path,u),{path:u,external:!0}});B.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(r)=>{if(w.has(r.path))return{contents:w.get(r.path),loader:"ts"};if(X(r.path,e,b))throw Error(`Server-only API source cannot be imported by a client script: ${r.path}`);let u=d.extname(r.path).toLowerCase(),E=u===".json"?"json":u===".tsx"?"tsx":u===".jsx"?"jsx":u===".ts"||u===".mts"||u===".cts"?"ts":"js";if(!f(r.path))c.add(r.path);let h=I?.get(r.path);if(h!==void 0)return{contents:h,loader:"js"};return{contents:j.readFileSync(r.path,"utf8"),loader:E}})}}}var Q=new Map,V=S(64),at=Symbol.for("stx.client-bundle-build-queue");function tg(e){let n=globalThis,i=(n[at]??Promise.resolve()).then(e,e);return n[at]=i.then(()=>{return},()=>{return}),i}async function bn(e,n,s={}){let i=s.projectRoot||process.cwd(),c=(await a(i)).serverApi,p=s.minify??!1,o=s.externalizeUserModules??!0,b=s.expose?.length?[...new Set(s.expose)].sort():void 0,I=s.cacheDir||Kf(i),M=H.getStore(),w=new Bun.CryptoHasher("md5");w.update(`${vt}\x00${ft()}\x00${JSON.stringify(c??!1)}\x00${o?"registry":"inline"}\x00${b?b.join(","):"*"}\x00${p?"minified":"readable"}\x00${M?.key??""}\x00${rt(e,i)}\x00${rt(n,i)}`);let f=w.digest("hex").slice(0,12),v=d.join(I,`${f}.js`),y=V.get(v);if(y){if(Js(y.files)&&y.files.every((h)=>!X(h.path,i,c))){N("memo hit:",f);let h=y.files.map((D)=>D.path);return Y(n,h),s.collectInputs?.push(...h),y.code}V.delete(v),N("memo invalidated by dep change:",f)}let B=d.join(I,`${f}.deps.json`),r=Bun.file(v);if(await r.exists()){let h=Bun.file(B),D=!1,k=null;if(await h.exists())try{let O=JSON.parse(await h.text());if(O.metadataVersion===ct&&Array.isArray(O.files)&&Et(O.files,i))k=Pr(O.files.map((g)=>ut(g,i))),D=k.length===O.files.length&&!k.some((g)=>X(g.path,i,c))}catch{D=!1}if(D){if(N("cache hit:",f),k)Y(n,k.map((U)=>U.path)),s.collectInputs?.push(...k.map((U)=>U.path));let O=await r.text(),g=new Date;if(j.promises.utimes(v,g,g).catch(()=>{}),k)V.set(v,{code:O,files:k});return O}N("cache invalidated by dep change:",f)}let u=Q.get(f);if(u){let h=await u;if(s.collectInputs)s.collectInputs.push(...(V.get(v)?.files??[]).map((D)=>D.path));return h}Cc(n);let E=tg(()=>Ft(e,n,{projectRoot:i,minify:p,cacheDir:I,hash:f,cachePath:v,depsPath:B,collectInputs:s.collectInputs,externalizeUserModules:o,serverApi:c,expose:b,throwOnFailure:s.throwOnFailure,substitutes:M?.modules}));Q.set(f,E);try{return await E}finally{Q.delete(f)}}function Ec(e){return`${e}-${process.pid}-${St()}`}async function Qh(e,n){let{projectRoot:s}=n,i=Ec(new Bun.CryptoHasher("md5").update([...e.keys()].join("\x00")).digest("hex").slice(0,12)),c=d.join(l(s,"bundle-tmp"),"out",i);j.mkdirSync(c,{recursive:!0});let p=new Map,o=new Map,b=0;for(let[f,v]of e){let y=d.join(s,`.stx-split-${i}-${b++}.ts`);p.set(y,v),o.set(d.basename(y).replace(/\.ts$/,""),f)}let[I,M]=[...p][0],w=new Set;Cc(n.filePath);try{let f=await Bun.build({entrypoints:[...p.keys()],outdir:c,target:"browser",format:"esm",splitting:!0,minify:!1,naming:{entry:"[name].js",chunk:"chunk-[hash].js"},plugins:[mt(s,d.dirname(n.filePath),I,M,w,!1,new Map,void 0,H.getStore()?.modules,p)],define:{"process.env.NODE_ENV":'"development"',...A()},root:s});if(!f.success)throw Error(f.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ")||"Unable to bundle the entries");let v={entries:new Map,chunks:new Map};for(let y of f.outputs){let B=d.basename(y.path);if(y.kind==="entry-point"){let r=o.get(B.replace(/\.js$/,""));if(r!==void 0)v.entries.set(r,await y.text())}else if(y.kind==="chunk")v.chunks.set(B.replace(/\.js$/,""),await y.text())}return n.collectInputs?.push(...w),v}finally{try{j.rmSync(c,{recursive:!0,force:!0})}catch{}}}async function Ft(e,n,s){let{projectRoot:i,minify:c,cacheDir:p,hash:o,cachePath:b,depsPath:I,externalizeUserModules:M}=s,w=l(i,"bundle-tmp"),f=Ec(o),v=d.join(i,`.stx-client-${f}.ts`),y=d.join(w,"out",f);j.mkdirSync(y,{recursive:!0});let B=d.dirname(n),r=new Set,u=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,E=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,h=t(e),{depths:D,balanced:k}=C(h),O=(R)=>!k||D[R]===0,g;while((g=u.exec(h))!==null){if(g[1])continue;if(!O(g.index))continue;if(g[2])g[2].split(",").forEach((R)=>{let m=It(R);if(m)r.add(m)});else if(g[3])r.add(g[3])}while((g=E.exec(h))!==null){if(g[1])continue;if(!O(g.index))continue;r.add(g[2])}let U=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=U.exec(h))!==null){if(!O(g.index))continue;let R=/^\s*['"]([^'"]+)['"]/.exec(e.slice(g.index+g[0].length))?.[1];if(R&&tt.some((m)=>m.test(R)))continue;if(g[1])r.add(g[1]);if(g[2])r.add(g[2]);for(let m of(g[3]??"").split(",")){let _=m.trim();if(!_||/^type\s/.test(_))continue;let P=/\bas\s+(\w+)\s*$/.exec(_)?.[1]??/^\w+$/.exec(_)?.[0];if(P)r.add(P)}}for(let R of h.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let m of R[1].split(",")){let _=/\bas\s+(\w+)\s*$/.exec(m)?.[1]??/^\s*(\w+)\s*$/.exec(m)?.[1];if(_)r.delete(_)}let gt=r.size>0?`
|
|
3
|
+
export { ${[...r].join(", ")} }`:"";N("bundling:",o,"from:",d.basename(n));let nt=new Set,st=new Map;try{let R=await Bun.build({entrypoints:[v],outdir:y,target:"browser",format:"esm",minify:c?{whitespace:!1,identifiers:!0,syntax:!0}:!1,plugins:[mt(i,B,v,e+gt,nt,M,st,s.serverApi,s.substitutes)],define:{"process.env.NODE_ENV":c?'"production"':'"development"',...A()},root:i});if(!R.success){let F=R.logs.filter((T)=>T.level==="error").map((T)=>T.message).join(", ")||`Unable to bundle ${d.basename(n)}`,z=fr(R.logs,n||void 0);if(console.warn("[stx:bundler] build failed:",F),kc(n||"",F,z),s.throwOnFailure||_c()==="error")throw Error(F);return e}let m="";for(let x of R.outputs){m=await x.text();break}let _=[];for(let x of m.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let F of x[1].split(",")){let z=F.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(z){_.push([z[2],z[1]]);continue}let T=F.trim();if(/^[A-Za-z_$][\w$]*$/.test(T))_.push([T,T])}if(s.expose){let x=new Set(s.expose);for(let F=_.length-1;F>=0;F--)if(!x.has(_[F][0]))_.splice(F,1)}let P=[];m=Zf(Yf(m,st),P);let ht=m.match(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm)||[];if(m=m.replace(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),c&&m)try{m=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(m)}catch{}let xt=Z(m),W=`__stxBundle_${o}`,yt=new Set(G(e,!0).split(",").map((x)=>x.trim())),$t=_.map(([x,F])=>`get ${JSON.stringify(x)}() { return ${F} }${yt.has(x)?`, set ${JSON.stringify(x)}(__stxValue_${F}) { ${F} = __stxValue_${F} }`:""}`).join(", "),bt=_.map(([x])=>`var ${x} = undefined;`).join(`
|
|
4
|
+
`),wt=_.map(([x])=>`${x} = ${W}[${JSON.stringify(x)}];`).join(`
|
|
5
|
+
`);if(m=`${ht.join(`
|
|
6
|
+
`)}
|
|
7
|
+
${bt}
|
|
8
|
+
var ${W} = ${xt?"await (async function":"(function"}() {
|
|
9
|
+
${P.join(`
|
|
10
|
+
`)}
|
|
11
|
+
${m}
|
|
12
|
+
return { ${$t} };
|
|
13
|
+
})();
|
|
14
|
+
${wt}
|
|
15
|
+
var __stxLiveBindings = typeof __stxLiveBindings === 'undefined' ? {} : __stxLiveBindings;
|
|
16
|
+
Object.keys(${W}).forEach(function(name) {
|
|
17
|
+
if (!Object.prototype.hasOwnProperty.call(__stxLiveBindings, name))
|
|
18
|
+
Object.defineProperty(__stxLiveBindings, name, Object.getOwnPropertyDescriptor(${W}, name));
|
|
19
|
+
});`.trim(),N("bundled:",o,"output:",m.length,"bytes"),r.size>0&&_.length===0)return console.warn(`[stx:bundler] dropped every binding for ${d.basename(n)} (${o}); serving the unbundled source and not caching this result`),e;j.mkdirSync(p,{recursive:!0}),await Bun.write(b,m);let J=Pr(nt);return await Bun.write(I,JSON.stringify({metadataVersion:ct,files:J.map((x)=>jt(x.path,i)).filter((x)=>x!==null)})),Y(n,J.map((x)=>x.path)),s.collectInputs?.push(...J.map((x)=>x.path)),V.set(b,{code:m,files:J}),await Mt(p),m}catch(R){let m=fr(R,n||void 0),_=Fe(R,n||void 0);if(console.warn(`[stx:bundler] error: ${_}`),kc(n||"",_,m),s.throwOnFailure||_c()==="error")throw R;return e}finally{try{j.rmSync(y,{recursive:!0,force:!0})}catch{}}}function It(e){let n=e.trim();if(!n)return null;let s=n.indexOf("=");if(s!==-1)n=n.slice(0,s).trim();let i=n.indexOf(":");if(i!==-1)n=n.slice(i+1).trim();if(n.startsWith("..."))n=n.slice(3).trim();return/^[A-Za-z_$][\w$]*$/.test(n)?n:null}
|
|
20
|
+
export{Kf,Gf,Ce,Xf,kc,gn,mn,Zh,_c,hn,pr,Jf,Yf,Zf,ws,Qf,eg,Cc,yn,tg,bn,Ec,Qh};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{m,p}from"./chunk-
|
|
3
|
-
export{
|
|
2
|
+
import{m,p}from"./chunk-86nsbxep.js";import{se,B,g}from"./chunk-njza56wn.js";function z(t,o){let i=1,r=o,e="<template",n="</template";while(r<t.length&&i>0){let s=t.indexOf("<",r);if(s===-1)break;if(r=s,t.startsWith(e,r)&&(r+e.length>=t.length||/[\s>\/]/.test(t[r+e.length]))){i++,r+=e.length;continue}if(t.startsWith(n,r)){let a=t.indexOf(">",r+n.length);if(a!==-1){if(i--,i===0)return a+1;r=a+1;continue}}r++}return i===0?r:-1}var N=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function k(t,o){let i=null;for(let r=o;r<t.length;r++){let e=t[r];if(i){if(e==="\\"){r++;continue}if(e===i)i=null;continue}if(e==='"'||e==="'"){i=e;continue}if(e===">")return r+1}return-1}function Z(t,o,i){let r=o.toLowerCase(),e=1,n=i;while(n<t.length){let s=t.indexOf("<",n);if(s===-1)return-1;if(t.startsWith("<!--",s)){let f=t.indexOf("-->",s+4);n=f===-1?t.length:f+3;continue}let a=k(t,s+1);if(a===-1)return-1;let u=t.slice(s,a),c=u.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(c&&c[2].toLowerCase()===r){if(c[1]==="/"){if(e--,e===0)return a}else if(!/\/\s*>$/.test(u))e++}n=a}return-1}function L(t){let o=[],i=[],r=/\bslot\s*=\s*(?:"([^"]+)"|'([^']+)')/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let l=t.indexOf("-->",n+4);e=l===-1?t.length:l+3;continue}let s=k(t,n+1);if(s===-1)break;let a=t.slice(n,s),u=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!u){e=s;continue}let c=u[2].toLowerCase();if(u[1]==="/"){let l=i.lastIndexOf(c);if(l!==-1)i.splice(l);e=s;continue}let f=/\/\s*>$/.test(a),d=i.length===0?a.match(r):null;if(d){let l=d[1]||d[2],h=a.replace(r,"").replace(/\s+(?=\/?>$)/,"").replace(/\s{2,}/g," "),S=f||N.has(c)?-1:Z(t,c,s);if(S===-1)o.push({start:n,end:s,slotName:l,element:h}),e=s;else o.push({start:n,end:S,slotName:l,element:h+t.slice(s,S)}),e=S;continue}if(!f&&!N.has(c)){if(i.push(c),c==="script"||c==="style"){let l=t.toLowerCase().indexOf(`</${c}>`,s);if(l!==-1){e=l;continue}}}e=s}return o}function j(t){let o=[],i=[],r=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let l=t.indexOf("-->",n+4);e=l===-1?t.length:l+3;continue}let s=k(t,n+1);if(s===-1)break;let a=t.slice(n,s),u=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!u){e=s;continue}let c=u[1]==="/",f=u[2].toLowerCase();if(c){let l=i.lastIndexOf(f);if(l!==-1)i.splice(l);e=s;continue}if(f==="template"&&i.length===0){let l=a.match(r);if(l){let h=z(t,s);if(h!==-1){let S=l[1]||l[2]||l[3];o.push({start:n,end:h,slotName:S,content:t.slice(s,h-11).trim(),propsBinding:l[4]||void 0}),e=h;continue}}}if(!/\/\s*>$/.test(a)&&!N.has(f)){if(i.push(f),f==="script"||f==="style"){let l=t.toLowerCase().indexOf(`</${f}>`,s);if(l!==-1){e=l;continue}}}e=s}return o}function gu(t){let o={default:"",named:new Map},i=t,r=j(t);for(let n of r)o.named.set(n.slotName,{name:n.slotName,content:n.content,propsBinding:n.propsBinding});r.sort((n,s)=>s.start-n.start);for(let n of r)i=i.slice(0,n.start)+i.slice(n.end);let e=L(i);for(let n of e){let s=o.named.get(n.slotName);if(s)s.content+=n.element;else o.named.set(n.slotName,{name:n.slotName,content:n.element})}for(let n=e.length-1;n>=0;n--){let s=e[n];i=i.slice(0,s.start)+i.slice(s.end)}return o.default=i.trim(),o}function Um(t){let o=t.match(/name\s*=\s*["']([^"']+)["']/),i=o?o[1]:"",r={},e=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,n;while((n=e.exec(t))!==null)r[n[1]]=n[2];let s=t.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),a=s?s[1].trim():"";return{name:i,props:r,defaultContent:a}}async function mu(t,o,i,r){if(!t)return i;let e=t.content;if(t.propsBinding&&Object.keys(o).length>0){let n=t.propsBinding.trim(),s={...r},a=new Set,u=new Set;if(n.startsWith("{")&&n.endsWith("}")){let c=n.slice(1,-1).split(",").map((f)=>f.trim()).filter(Boolean);for(let f of c){let[d,l]=f.split(":").map((S)=>S.trim()),h=l||d;if(s[h]=o[d],o[d]!==void 0)u.add(h);else a.add(h)}}else if(s[n]=o,Object.values(o).some((c)=>c===void 0))a.add(n);else u.add(n);e=I(e,s,a,u)}return e}function I(t,o,i,r){return t.replace(/\{\{\s*([^}]+)\s*\}\}/g,(e,n)=>{try{let s=n.trim();if(B(s,i))return e;if(Array.isArray(o.__stx_preserved_client_expressions)&&o.__stx_preserved_client_expressions.includes(s)&&!B(s,r))return e;let a=_(s,o);if(a===void 0)return e;return g(String(a??""))}catch{return`{{ ${n} }}`}})}function _(t,o){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(t)){let r=t.split("."),e=o;for(let n of r)if(e&&typeof e==="object"&&n in e)e=e[n];else return;return e}let i=t.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(i){let[,r,e,n]=i,s=o[r],a=parseInt(n,10);if(typeof s==="number")switch(e){case"+":return s+a;case"-":return s-a;case"*":return s*a;case"/":return s/a}}try{if(!m(t))return;return p(t,Object.keys(o))(...Object.values(o))}catch{return}}async function hu(t,o,i,r){let e=t;e=await W(e,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(a,u,c,f)=>{let d=o.named.get(u),l=f?.trim()||"",h=c||"",S={},E=[],C=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,b;while((b=C.exec(h))!==null){let w=b[1],x=b[2];S[w]=_(x,i),E.push([w,x])}if(r!==void 0&&d?.propsBinding&&Object.values(S).some((w)=>w===void 0)){let w=d.propsBinding.trim(),x=se(`${w} in []`),y="__stx_slot_props";while(x.includes(y))y+="_";let M=E.map(([A,P])=>{let O=S[A],R;try{R=O===void 0?void 0:JSON.stringify(O)}catch{}return`${JSON.stringify(A)}:(${R??P})`}).join(","),v=g(JSON.stringify({binding:w,names:x,owner:r}));return`<template :for="${g(`${y} in [{${M}}]`)}" data-stx-slot-binding="${encodeURIComponent(w)}" data-stx-slot-scope="${v}">${d.content}</template>`}return await mu(d,S,l,i)});let s=/<slot\b((?:"[^"]*"|'[^']*'|[^>"'])*?)\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return e=e.replace(s,(a,u,c)=>{if(/\bname\s*=/.test(u||""))return a;let f=c?.trim()||"";return o.default||f}),e}async function W(t,o,i){let r=[],e=[];t.replace(o,(a,...u)=>{let c=u[u.length-2];return e.push({match:a,index:c}),r.push(i(a,...u.slice(0,-2))),a});let n=await Promise.all(r),s=t;for(let a=e.length-1;a>=0;a--){let{match:u,index:c}=e[a];s=s.slice(0,c)+n[a]+s.slice(c+u.length)}return s}function Wm(t){let o=gu(t);return{defaultSlot:o.default,namedSlots:o.named}}async function qm(t,o,i,r,e){return await hu(t,{default:o,named:i},r,e)}
|
|
3
|
+
export{gu,Um,mu,hu,Wm,qm};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{uy,Ts,ci,$s,wr,li,ui,dg,Rs,As,Ps,di,Ic,pg,Pt}from"./chunk-ym0cdk7m.js";import"./chunk-1zkymrw0.js";import"./chunk-v1s838fe.js";import"./chunk-w53p65hy.js";import"./chunk-nnynrb97.js";import"./chunk-h63ma36g.js";import"./chunk-ssg6ne5b.js";import"./chunk-h2tq6cbr.js";import"./chunk-agd2b928.js";import{G}from"./chunk-njza56wn.js";import"./chunk-yffqfgjx.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{dg as bindLoopInterpolations,uy as clearScriptScanCache,Rs as convertServerLoopAttributesToDirectives,li as convertSignalDirectivesToAttributes,As as convertSignalLoopsToAttributes,wr as extractClientSignalNames,G as extractExports,Ic as findMarkupIndexOutsideScripts,$s as hasSignalsSyntax,ci as parseLoopExpression,ui as preEvalLiteralReactiveIfs,Ps as processScriptSetup,di as processSignals,pg as rewriteStxImportSpecifiers,Ts as scanScriptTags,Pt as stripStxRuntimeImports};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ml}from"./chunk-a60ztvnp.js";function Z(n){let r=new Bun.Transpiler({loader:"js"});if(Ml(n))return r.transformSync(`(async function(){
|
|
3
|
+
${n}
|
|
4
|
+
})()`),!0;try{return r.transformSync(`(function(){
|
|
5
|
+
${n}
|
|
6
|
+
})()`),!1}catch{return r.transformSync(`(async function(){
|
|
7
|
+
${n}
|
|
8
|
+
})()`),!0}}
|
|
9
|
+
export{Z};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ae,mt,Ut,Ys,Zs,Se,$i,Cn,rl,sl,Ri,ol,il,eo,Pi,Ii,al,Oi}from"./chunk-njza56wn.js";import{E}from"./chunk-00tq7ghn.js";import{a}from"./chunk-w53p65hy.js";import{Lo}from"./chunk-xf6snj8e.js";import{l}from"./chunk-s7xywsqd.js";import{existsSync as G,readFileSync as U}from"fs";import h from"path";var ke=new Set(["module","exports","require","$bool","$num","window","document","console","confirm","alert","fetch"]),oe=mt.filter((e)=>!ke.has(e)).sort(),ce=[...E].sort(),ve=[...new Set([...oe,...ce])].sort(),$e=new Set(oe),De=new Set(ce),Te=new Set(ve),re=/\bimport\s+(?!type[\s{])\{([^}]*)\}\s*from\s*(['"])stx\2/g;function Ce(e,t){if(t==="server")return`'${e}' is not provided by 'stx' in a <script server> block. The engine binds only its own names there (defineProps, state, useHead, ...); any other name becomes \`await import('stx')\`, which does not resolve, so the whole script fails when the page renders. Import it from '@stacksjs/stx' instead.`;return`'${e}' is not provided by 'stx' in a client <script> block. The import is replaced by the window.stx runtime, which has no '${e}', so it is undefined in the browser.`}function ae(e,t){let o=[];for(let d of t){if(d.offset===void 0)continue;let i=d.kind==="server"?$e:De;re.lastIndex=0;for(let c of d.code.matchAll(re)){let m=c.index+c[0].indexOf("{")+1;for(let f of c[1].matchAll(/[^,]+/g)){let k=f[0];if(/^\s*type\s/.test(k))continue;let S=/^\s*([A-Za-z_$][\w$]*)/.exec(k);if(!S)continue;let s=S[1];if(!Te.has(s)||i.has(s))continue;let u=d.offset+m+f.index+S[0].length-s.length,g=e.slice(0,u),v=g.split(`
|
|
3
|
+
`).length;o.push({line:v,column:u-(g.lastIndexOf(`
|
|
4
|
+
`)+1)+1,offset:u,length:s.length,name:s,kind:d.kind,message:Ce(s,d.kind)})}}}return o}import M from"path";var Ee="@stacksjs/stx-typescript-plugin";function Oe(e,t){let o=M.resolve(e);for(;;){let d=M.join(o,"tsconfig.json");if(t(d))return d;let i=M.dirname(o);if(i===o)return;o=i}}function le(e,t,o){let d=Oe(e,o);if(!d)return;let i=new Set,c=(m)=>{if(i.has(m))return;i.add(m);let f=t(m);if(!f)return;let k=f.compilerOptions?.plugins;if(Array.isArray(k)){let s=k.find((g)=>g?.name===Ee),u=Array.isArray(s?.libs)?s.libs.filter((g)=>typeof g==="string"):[];return s?{configPath:m,libs:u.map((g)=>M.resolve(M.dirname(m),g))}:null}let S=typeof f.extends==="string"?[f.extends]:Array.isArray(f.extends)?f.extends:[];for(let s of[...S].reverse()){if(typeof s!=="string"||!s.startsWith("."))continue;let u=M.resolve(M.dirname(m),s.endsWith(".json")?s:`${s}.json`),g=c(u);if(g!==void 0)return g}return};return c(d)??void 0}function Ra(e,t="",o="",d=t,i){let c=e.startLine>1?`
|
|
5
|
+
`.repeat(e.startLine-1):"",m=$i(Pi(e)+e.code,d),f=e.kind==="client"&&i?i.project(m.code):void 0,k=Cn(f?.code??m.code),S=e.kind==="client"||e.kind==="plain"?ol(t,e.code):"",s=(c+k).split(`
|
|
6
|
+
`),u=s.length,g=new Map;for(let y of m.declarations)for(let[w,D]of y.text.split(`
|
|
7
|
+
`).entries())if(s.push(D),y.origin)g.set(s.length,{...y.origin,line:e.startLine+y.origin.line-1+w,column:w===0?y.origin.column:1});s.push(...S.split(`
|
|
8
|
+
`),...(i?.declarations??"").split(`
|
|
9
|
+
`),...(e.kind==="server"?Ys(e.code):"").split(`
|
|
10
|
+
`));let v=e.kind==="server"?Ut(e.code):void 0;if(v?.unsupported){let y=e.code.slice(0,v.offset),w=e.startLine+y.split(`
|
|
11
|
+
`).length-1,D=v.offset-e.code.lastIndexOf(`
|
|
12
|
+
`,v.offset-1)+(w===e.startLine?(e.startColumn??1)-1:0);s.push(`;({})[${JSON.stringify(v.unsupported)}];`),g.set(s.length,{line:w,column:D,anchor:!0})}s.push("export {}","");let R=eo(s.join(`
|
|
13
|
+
`),o);return{text:R.code,sourceLineCount:u,lineMap:g,scriptColumns:new Map([...m.columns].map(([y,w])=>[y+e.startLine-1,w])),importColumns:R.columns,componentColumns:f?new Map([...f.columns].map(([y,w])=>[y+e.startLine-1,w])):void 0}}function Tm(e,t="",o=""){return Ra(e,t,o).text}var Ne=new Set(["name","status","length","location","history","origin","closed","close","open","focus","blur","print","scroll","scrollTo","scrollBy","stop","top","parent","self","frames","event","external","menubar","toolbar"]);function _e(e){if(e.length===0)return"";let t=["// Generated \u2014 the composables the runtime publishes as bare globals."],o=new Set(E),d=[];for(let{file:i,names:c}of e){let m=JSON.stringify(i.replace(/\\/g,"/").replace(/\.ts$/,""));d.push(` export * from ${m}`);for(let f of c){if(o.has(f)||Ne.has(f))continue;o.add(f),t.push(`declare const ${f}: typeof import(${m})[${JSON.stringify(f)}]`)}}return t.push("declare module '@composables' {",...d,"}"),t.join(`
|
|
14
|
+
`)}function Io(e,t,o){return`${e}.__stx_${t}${o}.ts`}function $m(e){return e.replace(/\.__stx_(?:server|client|plain|template)\d+\.ts$/,"")}function uu(){return ue("stx.d.ts")}function du(){return ue("stx-module.d.ts")}function ue(e){for(let t of[h.resolve(import.meta.dir,"..",e),h.resolve(import.meta.dir,"..","..",e)])if(G(t))return t;return null}var Me=/^(.*?)\((\d+),(\d+)\):\s+(error|warning)\s+TS(\d+):\s+(.*)$/;function pe(e){return e>=1000&&e<2000}function de(e){let t="",o=!1,d=!1;for(let i=0;i<e.length;i++){let c=e[i];if(o){if(t+=c,d)d=!1;else if(c==="\\")d=!0;else if(c==='"')o=!1;continue}if(c==='"'){o=!0,t+=c;continue}if(c==="/"&&e[i+1]==="/"){while(i<e.length&&e[i]!==`
|
|
15
|
+
`)i++;t+=`
|
|
16
|
+
`;continue}if(c==="/"&&e[i+1]==="*"){i+=2;while(i<e.length&&!(e[i]==="*"&&e[i+1]==="/"))i++;i++;continue}t+=c}return t.replace(/,(\s*[}\]])/g,"$1")}function Re(e){try{return JSON.parse(de(U(e,"utf8")))}catch{return}}function je(e){let t=h.resolve(e),o;for(;;){let s=h.join(t,"tsconfig.json");if(G(s)){o=s;break}let u=h.dirname(t);if(u===t)break;t=u}if(!o)return{};let d=new Set,i=o,c,m,f=o;while(i&&!d.has(i)){d.add(i);let s;try{s=JSON.parse(de(U(i,"utf8")))}catch{break}let u=s?.compilerOptions??{};if(!c&&u.paths&&typeof u.paths==="object")c=u.paths,f=i;if(!m&&typeof u.baseUrl==="string")m=h.resolve(h.dirname(i),u.baseUrl);if(c&&m)break;i=typeof s?.extends==="string"?h.resolve(h.dirname(i),s.extends.endsWith(".json")?s.extends:`${s.extends}.json`):void 0}if(!c)return{};let k=m??h.dirname(f),S={};for(let[s,u]of Object.entries(c)){if(!Array.isArray(u))continue;S[s]=u.map((g)=>typeof g==="string"&&!h.isAbsolute(g)?h.resolve(k,g):g)}return{paths:S}}async function Rm(e,t={}){let o=t.client!==!1,d=t.server!==!1,i=t.templates!==!1,c=i?await a():void 0,m=t.componentsDir??c?.componentsDir,f=t.partialsDir??c?.partialsDir,k=t.layoutsDir??c?.layoutsDir,S=new Map(await Promise.all(e.map(async(n)=>[n,await Bun.file(n).text()]))),s=[...S.values()].some((n)=>Ut(Se(n).filter((r)=>r.kind==="server").map((r)=>r.code).join(`
|
|
17
|
+
`))),u=new Map,g=new Map,v=[],R=[],y=0,w=0,D=uu();for(let n of e){let r=S.get(n),x=Se(r).filter((p)=>{if(p.kind==="server")return d;return o}),O=Se(r).filter((p)=>p.kind==="server").map((p)=>p.code).join(`
|
|
18
|
+
`),B=Ri(Se(r)),_=Zs(r);for(let p of ae(r,x))v.push({file:n,line:p.line,column:p.column,code:0,message:p.message,category:"error",blockKind:p.kind});if(o&&O){let p=x.filter((C)=>C.kind!=="server"),b=[...new Set(p.flatMap((C)=>il(O,C.code)))];if(b.length>0)g.set(n,{names:b,line:p[0].startLine,kind:p[0].kind})}let I=h.dirname(h.resolve(n)),T=i?Ii(r,{runtimeGlobals:!D,originDir:I,filePath:h.resolve(n),componentsDir:m,partialsDir:f,layoutsDir:k,inheritedContractsKnown:s}):null,A=T?[...T.lineMap.values()].filter((p)=>p.expression).length:0;if(x.length===0&&A===0&&!_?.checks.length)continue;if(R.push(n),y+=x.length,w+=A,_&&o&&(x.some((p)=>p.kind!=="server")||!i&&_.checks.length)){let p=Ii(r,{runtimeGlobals:!1,globals:!1,originDir:I,templateExpressions:!1,scriptKinds:["client","plain"],nativeChecks:!i});u.set(Io(n,"client",0),{virtual:p,source:p.text,origin:n,kind:"client"})}if(x.forEach((p,b)=>{if(_&&p.kind!=="server")return;let C=Ra(p,O,I,B);u.set(Io(n,p.kind,b),{virtual:C,source:C.text,origin:n,kind:p.kind})}),T&&(A>0||_?.checks.length))u.set(Io(n,"template",0),{source:T.text,origin:n,kind:"template",virtual:T})}if(u.size===0)return{diagnostics:v,checkedFiles:R,blockCount:0,expressionCount:0};let j=(t.extraLibs??[]).map((n)=>h.resolve(n)),fe=le(e.length>0?h.dirname(h.resolve(e[0])):process.cwd(),Re,G);for(let n of fe?.libs??[])if(!j.includes(n)&&G(n))j.push(n);if(D)j.push(D);let W=D?du():null;if(W)j.push(W);let z=`${l()}/typecheck/__stx_globals.d.ts`,me=["// Generated \u2014 the context serve.ts injects into <script server> blocks.",rl(D?sl(U(D,"utf8")):void 0),...D?[]:["declare const window: any",...E.map((n)=>`declare const ${n}: any`)],["// Generated \u2014 the names stx auto-imports from @stacksjs/browser.",...Ae.map((n)=>`declare const ${n}: any`)].join(`
|
|
19
|
+
`),_e(await Lo())].filter(Boolean).join(`
|
|
20
|
+
`),L=`${l()}/typecheck`;await Bun.$`rm -rf ${L}`.quiet().nothrow(),await Bun.$`mkdir -p ${L}`.quiet().nothrow(),await Bun.write(z,me);let P=new Map,ge=0;for(let[n,r]of u){let x=`${ge++}_${n.replace(/[^\w.-]+/g,"_")}`;await Bun.write(`${L}/${x}`,r.source),P.set(x,r)}let he={target:"ESNext",module:"ESNext",moduleResolution:"bundler",strict:!0,noEmit:!0,skipLibCheck:!0,allowJs:!0,esModuleInterop:!0,resolveJsonModule:!0,lib:["ESNext","DOM","DOM.Iterable"],types:[],...je(e.length>0?h.dirname(h.resolve(e[0])):process.cwd()),...t.compilerOptions??{}},q=async(n,r)=>{let x=`${L}/tsconfig${r===1?"":`.${r}`}.json`;await Bun.write(x,JSON.stringify({compilerOptions:he,files:n.map((B)=>`${L}/${B}`).concat(z,...j)},null,2));let O=Bun.spawnSync(["bun","x","tsc","-p",x,"--pretty","false"],{stdout:"pipe",stderr:"pipe"});return{output:new TextDecoder().decode(O.stdout)+new TextDecoder().decode(O.stderr),exitCode:O.exitCode??0}},H=await q([...P.keys()],1),Z=H.output,K=[],Q=H.exitCode,Y=0,xe=new Set(j.map((n)=>n.split("/").pop())),ee=0,F=new Set,te=(n)=>{for(let r of n.replace(/\n[\t ]+([^\n]*)/g," $1").split(`
|
|
21
|
+
`)){let x=r.match(Me);if(!x)continue;if(Y++,xe.has(x[1].split("/").pop()))ee++;let[,O,B,_,I,T,A]=x,p=O.split("/").pop(),b=P.get(p);if(!b)continue;if(pe(Number(T)))F.add(p);let C=Number(B),X=Number(_),se,J=b.kind;if(b.virtual){let N=Oi(b.virtual,C,X)??(b.kind!=="template"&&pe(Number(T))?Oi(b.virtual,b.virtual.sourceLineCount,1):null);if(!N||b.kind==="template"&&!N.expression&&!N.diagnosticOrigin)continue;if(al(N,Number(T)))continue;C=N.line,X=N.column,se=N.expression?.code.trim(),J=N.diagnosticOrigin??J}K.push({file:b.origin,line:C,column:X,code:Number(T),message:A,category:I==="error"?"error":"warning",blockKind:J,expression:se})}};te(Z);let ye=Y,be=ee;if(F.size>0&&F.size<P.size){let n=[...P.keys()].filter((r)=>!F.has(r));te((await q(n,2)).output)}if(o)for(let[n,r]of g){if(r.names.length===0)continue;K.push({file:n,line:r.line,column:1,code:0,message:`${r.names.length===1?"1 value reaches":`${r.names.length} values reach`} this block on the implicit bridge and ${r.names.length===1?"is":"are"} untyped: ${r.names.join(", ")}. Declare them with defineClientPayload({ ${r.names.join(", ")} }) in the server block to have them checked.`,category:"warning",blockKind:r.kind})}K.push(...v);let ne=new Set,V=K.filter((n)=>{let r=`${n.file}:${n.line}:${n.column}:${n.code}:${n.message}`;if(ne.has(r))return!1;return ne.add(r),!0});V.sort((n,r)=>n.file.localeCompare(r.file)||n.line-r.line||n.column-r.column);let ie=be>0&&V.length===0,we=ie||Q!==0&&ye===0?`${ie?"a file passed with --lib has errors of its own, so nothing in your code was checked":`tsc exited ${Q} without reporting any diagnostic, so nothing was checked`}. `+"A syntax error in an ambient declaration file does this \u2014 skipLibCheck suppresses "+`SEMANTIC diagnostics only. tsc said:
|
|
22
|
+
${Z.trim().split(`
|
|
23
|
+
`).slice(0,12).join(`
|
|
24
|
+
`)||"(no output)"}`:void 0;return{diagnostics:V,checkedFiles:R,blockCount:y,expressionCount:w,failure:we}}function Am(e){return e.map((t)=>{let o=t.blockKind==="template"?`[template: ${t.expression??""}]`:`[${t.blockKind==="plain"?"<script>":`<script ${t.blockKind}>`}]`;return`${t.file}:${t.line}:${t.column} ${t.category} TS${t.code} ${t.message} ${o}`}).join(`
|
|
25
|
+
`)}
|
|
26
|
+
export{Ra,Tm,Io,$m,uu,du,Rm,Am};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{nu,Ea,ru,su,Ta,ou,iu,au,cu,$a,lu,Em}from"./chunk-czcx3nbx.js";import{Da,fu}from"./chunk-q1mb0fbt.js";import{ce,le,ue,Kn,_e,Be,as,Et,cn,Gn,Xn,Jn,de,Yn,Zn,cs}from"./chunk-q74affc4.js";import{bu}from"./chunk-gbncp2gp.js";import"./chunk-kee5a3ce.js";export{le as DEFAULT_FORMATS,ue as DEFAULT_QUALITY,ce as DEFAULT_WIDTHS,cs as ImageProcessingError,su as clearImageCache,Ta as createImageDirective,fu as createImageHandler,iu as createImagePlugin,Em as defaultImageConfig,Zn as formatSize,$a as generateImageManifest,cn as generateSizes,Et as generateSrcSet,Gn as getFallbackVariant,as as getImageMetadata,de as getMimeType,Yn as getTotalSize,Xn as groupVariantsByFormat,Da as handleImageRequest,ou as imageDirective,_e as isImageBackendAvailable,Jn as isImageFile,Kn as isSharpAvailable,cu as optimizeDirectory,au as optimizeImage,Ea as parseImageComponent,Be as processImage,ru as processImageComponents,nu as renderImageComponent,bu as rewriteImagesWithSiblings,lu as writeImageManifest};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Es,lg,si,ug}from"./chunk-9yx7cbhz.js";import"./chunk-t94y8g35.js";import"./chunk-ym0cdk7m.js";import"./chunk-1zkymrw0.js";import"./chunk-v1s838fe.js";import"./chunk-w53p65hy.js";import"./chunk-nnynrb97.js";import"./chunk-h63ma36g.js";import"./chunk-ssg6ne5b.js";import"./chunk-h2tq6cbr.js";import"./chunk-agd2b928.js";import{Vt}from"./chunk-njza56wn.js";import"./chunk-yffqfgjx.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{ug as declareBareLoopHead,Vt as parseLoopBinding,lg as processLoops,si as processLoopsAsync,Es as reportDeferredLoopWarnings};
|