@stacksjs/stx 0.2.674 → 0.2.675
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-szevd7d5.js → chunk-028e9fty.js} +2 -2
- package/dist/{chunk-5vt48yce.js → chunk-03hhanvm.js} +9 -9
- package/dist/{chunk-rr527jt6.js → chunk-078qg8r5.js} +2 -2
- package/dist/{chunk-zmg1peyg.js → chunk-09gchq7d.js} +3 -3
- package/dist/chunk-0gk78x3r.js +2 -0
- package/dist/{chunk-mwnhdsbp.js → chunk-0thxpgtp.js} +2 -2
- package/dist/{chunk-fw413k9q.js → chunk-1b9thkg5.js} +2 -2
- package/dist/chunk-1s2y6f4b.js +2 -0
- package/dist/chunk-1wdawkn8.js +2 -0
- package/dist/chunk-248a88mc.js +2 -0
- package/dist/{chunk-nj343mw2.js → chunk-29wj0c68.js} +5 -5
- package/dist/chunk-2nqtmp8c.js +2 -0
- package/dist/chunk-2pga7zzb.js +4 -0
- package/dist/chunk-2xv29pfj.js +11 -0
- package/dist/{chunk-md2jn67b.js → chunk-374nhgyf.js} +2 -2
- package/dist/chunk-3vwkyjan.js +421 -0
- package/dist/chunk-3wsm9g9c.js +2 -0
- package/dist/chunk-3xx9d934.js +2 -0
- package/dist/chunk-41q5rww8.js +2 -0
- package/dist/chunk-4c5tk71j.js +2 -0
- package/dist/chunk-4e5jrxbn.js +14 -0
- package/dist/{chunk-ham5x7ts.js → chunk-4fhbh04h.js} +4 -4
- package/dist/chunk-4x5dk7a4.js +2 -0
- package/dist/{chunk-hz4x7h0n.js → chunk-54fazdmn.js} +5 -5
- package/dist/chunk-57ege36s.js +2 -0
- package/dist/{chunk-z22zy22p.js → chunk-5fh9m8fm.js} +2 -2
- package/dist/chunk-5n4c99y5.js +2 -0
- package/dist/{chunk-rdr09efy.js → chunk-5z0q3qv3.js} +5 -5
- package/dist/{chunk-6sjtyd0k.js → chunk-5z8mq37c.js} +4 -4
- package/dist/{chunk-p6qd7ad0.js → chunk-5zvrbms2.js} +2 -2
- package/dist/{chunk-ce6zddpf.js → chunk-6beg47t4.js} +2 -2
- package/dist/chunk-6kam8r5y.js +2 -0
- package/dist/{chunk-kdebh22m.js → chunk-6ncvb8gp.js} +10 -10
- package/dist/{chunk-srq9fqq8.js → chunk-6qh2mx6q.js} +38 -38
- package/dist/chunk-6rftdp7c.js +2 -0
- package/dist/{chunk-tddnb5bv.js → chunk-6ycyaf5g.js} +2 -2
- package/dist/chunk-7475sm3m.js +2 -0
- package/dist/{chunk-pb6erpj3.js → chunk-78x52gz3.js} +5 -5
- package/dist/{chunk-zp79zkkd.js → chunk-78yjmbbs.js} +2 -2
- package/dist/{chunk-v21bhhjb.js → chunk-7j7h1eg3.js} +1 -1
- package/dist/{chunk-4bgjrrvz.js → chunk-7q699phs.js} +1 -1
- package/dist/chunk-7s6hypn5.js +2 -0
- package/dist/chunk-7ym269yp.js +2 -0
- package/dist/{chunk-d1a86qx8.js → chunk-81rdyz2n.js} +1 -1
- package/dist/chunk-855h3crg.js +2 -0
- package/dist/chunk-8an7vcxx.js +2 -0
- package/dist/{chunk-bkkpq8dx.js → chunk-8jdbrcgt.js} +10 -10
- package/dist/{chunk-w7t2cfgy.js → chunk-8md2707p.js} +66 -66
- package/dist/chunk-8p92r2sc.js +2 -0
- package/dist/{chunk-rym0309c.js → chunk-8xxc5edr.js} +3 -3
- package/dist/{chunk-trz8z4j4.js → chunk-93z9f2be.js} +37 -37
- package/dist/{chunk-r7fdw2v5.js → chunk-97h9ga3b.js} +3 -3
- package/dist/chunk-9859r1d5.js +2 -0
- package/dist/{chunk-aet1pgw7.js → chunk-9azagdq6.js} +74 -74
- package/dist/{chunk-25zmy8q6.js → chunk-9wdd7eq6.js} +2 -2
- package/dist/{chunk-t0k16vqv.js → chunk-9ybjsfyp.js} +2 -2
- package/dist/chunk-ammn4wbd.js +2 -0
- package/dist/chunk-arh1qgmp.js +2 -0
- package/dist/{chunk-qz5b8ed4.js → chunk-bh19ezq0.js} +5 -5
- package/dist/chunk-bpf3xxng.js +3 -0
- package/dist/chunk-c2rq9pap.js +2 -0
- package/dist/chunk-cfm6a679.js +2 -0
- package/dist/{chunk-hegfgw27.js → chunk-cxgremn0.js} +5 -5
- package/dist/chunk-dasxbb9y.js +2 -0
- package/dist/{chunk-sqn3y9qt.js → chunk-db5017x8.js} +2 -2
- package/dist/{chunk-hgry3mjd.js → chunk-dba795e1.js} +1 -1
- package/dist/{chunk-7adznted.js → chunk-dera8fmc.js} +2 -2
- package/dist/chunk-e02ne8zd.js +2 -0
- package/dist/chunk-e492je6q.js +2 -0
- package/dist/{chunk-v6peecfp.js → chunk-e4ezpevb.js} +2 -2
- package/dist/chunk-etbpzmxv.js +4 -0
- package/dist/{chunk-4s8zacxg.js → chunk-f26n6y9p.js} +4 -4
- package/dist/chunk-fqa5ej45.js +2 -0
- package/dist/{chunk-dgc1a3yt.js → chunk-fzc98qgn.js} +7 -7
- package/dist/{chunk-4w6baw62.js → chunk-g98gafg7.js} +2 -2
- package/dist/chunk-gc4w2s5n.js +31 -0
- package/dist/{chunk-hb3edeq9.js → chunk-ggf4z3bv.js} +6 -6
- package/dist/chunk-ggwvnpwj.js +2 -0
- package/dist/chunk-gx6wxmbv.js +2 -0
- package/dist/chunk-hamk3dky.js +2 -0
- package/dist/{chunk-vayhx642.js → chunk-haz2ezyk.js} +2 -2
- package/dist/chunk-hfbkbrwk.js +130 -0
- package/dist/chunk-hg0dd64a.js +2 -0
- package/dist/chunk-hh58k0nh.js +3 -0
- package/dist/chunk-hz5eh77e.js +2 -0
- package/dist/chunk-hz8dj5jy.js +21 -0
- package/dist/{chunk-9dtbvjpp.js → chunk-j6x7ryyn.js} +11 -11
- package/dist/{chunk-d09q93yf.js → chunk-jv021x8e.js} +2 -2
- package/dist/{chunk-pg2v1pb5.js → chunk-k06n5bjp.js} +3 -3
- package/dist/{chunk-35ezh7de.js → chunk-k72jqz6a.js} +3 -3
- package/dist/chunk-kqbpkg8n.js +2 -0
- package/dist/{chunk-bsajk82t.js → chunk-kzb04293.js} +19 -19
- package/dist/{chunk-5zhp87wv.js → chunk-mabja59q.js} +2 -2
- package/dist/chunk-mf19qxgv.js +3 -0
- package/dist/{chunk-fd49fahd.js → chunk-mn47s2ef.js} +5 -5
- package/dist/{chunk-hsmcbh0p.js → chunk-mvz825w0.js} +5 -5
- package/dist/chunk-n615cbxq.js +2 -0
- package/dist/chunk-nv0jjhtd.js +2 -0
- package/dist/chunk-nvbyscdh.js +20 -0
- package/dist/chunk-nw44qq6h.js +24 -0
- package/dist/{chunk-s0vtjyyj.js → chunk-p6g58hwg.js} +2 -2
- package/dist/chunk-prc5dxp1.js +2 -0
- package/dist/{chunk-am2w363p.js → chunk-q3gactm1.js} +4 -4
- package/dist/{chunk-w3d98907.js → chunk-q4rejyd2.js} +2 -2
- package/dist/{chunk-7j1zgrnf.js → chunk-q7tfqavs.js} +9 -9
- package/dist/{chunk-4b9s7wgy.js → chunk-qdkwg2b8.js} +2 -2
- package/dist/{chunk-a4p18ybc.js → chunk-qr7a378v.js} +3 -3
- package/dist/chunk-qwdgx34g.js +2 -0
- package/dist/chunk-r6t1712p.js +2 -0
- package/dist/{chunk-cbjabv1w.js → chunk-ram7pa4k.js} +6 -6
- package/dist/{chunk-thceyzj6.js → chunk-rza1p6e4.js} +2 -2
- package/dist/chunk-s5q9ztvj.js +2 -0
- package/dist/chunk-s8qe247r.js +2 -0
- package/dist/chunk-sfpymq5h.js +2 -0
- package/dist/chunk-shft9r9d.js +2 -0
- package/dist/{chunk-6s7tvmqp.js → chunk-sr3hmrah.js} +2 -2
- package/dist/chunk-sswy3tfc.js +2 -0
- package/dist/chunk-swxznm5v.js +2 -0
- package/dist/chunk-t8tst3sk.js +2 -0
- package/dist/chunk-t9bsgbwv.js +3 -0
- package/dist/chunk-tst8p27s.js +12 -0
- package/dist/chunk-tz09earb.js +2 -0
- package/dist/{chunk-ck2e3e47.js → chunk-vd5w1jaz.js} +3 -3
- package/dist/chunk-vf6yaymh.js +2 -0
- package/dist/{chunk-xghcsg3f.js → chunk-vg1pg6yt.js} +1 -1
- package/dist/chunk-w0vpvcj0.js +2 -0
- package/dist/{chunk-s2wptfm1.js → chunk-wav0xbnb.js} +2 -2
- package/dist/{chunk-t9kxhe46.js → chunk-wr1gm35v.js} +1 -1
- package/dist/{chunk-faakv1p6.js → chunk-wscnjtss.js} +2 -2
- package/dist/{chunk-asezs2n3.js → chunk-wtvy9r5w.js} +6 -6
- package/dist/{chunk-t79jfpv6.js → chunk-x4q4bx3q.js} +2 -2
- package/dist/{chunk-y1pcdeg9.js → chunk-x7wr720m.js} +5 -5
- package/dist/chunk-xayfz35c.js +2 -0
- package/dist/{chunk-yx3dpdwc.js → chunk-xdn6rtq2.js} +3 -3
- package/dist/chunk-xh5mh8kn.js +2 -0
- package/dist/chunk-xna6b7km.js +2 -0
- package/dist/chunk-xrrx2ddz.js +2 -0
- package/dist/{chunk-fbmth6xv.js → chunk-xtnxvmdb.js} +13 -13
- package/dist/chunk-xw4rm5zj.js +2 -0
- package/dist/{chunk-5qtthtg3.js → chunk-yaccg2c0.js} +7 -7
- package/dist/chunk-yar7fwrb.js +2 -0
- package/dist/{chunk-2zzc7006.js → chunk-yn9kvsk1.js} +2 -2
- package/dist/chunk-yt33wzqk.js +2 -0
- package/dist/{chunk-j6m8xqh3.js → chunk-z17sy8g3.js} +2 -2
- package/dist/chunk-z4bfgvb3.js +25 -0
- package/dist/chunk-z6mrnh98.js +2 -0
- package/dist/chunk-zq7xbc1k.js +2 -0
- package/dist/cli.js +22 -22
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/native/compiler/headwind-to-style.js +13 -1
- package/dist/native/compiler/html-to-ir.d.ts +2 -0
- package/dist/native/compiler/html-to-ir.js +9 -0
- package/dist/native/compiler/ir.d.ts +1 -0
- package/dist/native/compiler/render-screen.js +4 -3
- package/dist/native/compiler/style-config.d.ts +3 -0
- package/dist/native/compiler/style-config.js +5 -0
- package/dist/native/components/primitives.d.ts +2 -0
- package/dist/native/event-names.js +2 -0
- package/dist/native/prop-names.js +1 -0
- package/dist/native/runtime/craft-bridge.js +15 -8
- package/dist/pwa.js +3 -3
- package/dist/signal-processing.js +75 -16
- package/dist/ssg-static-paths.d.ts +12 -0
- package/dist/ssg-static-paths.js +62 -0
- package/dist/ssg.d.ts +2 -4
- package/dist/ssg.js +43 -47
- package/dist/utils.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-0jwdcqj8.js +0 -2
- package/dist/chunk-0mwdq478.js +0 -2
- package/dist/chunk-0nfqgv4n.js +0 -4
- package/dist/chunk-1y6egkty.js +0 -2
- package/dist/chunk-280p4q7a.js +0 -2
- package/dist/chunk-2881tcqt.js +0 -2
- package/dist/chunk-2a775q7x.js +0 -2
- package/dist/chunk-2asdbd5e.js +0 -2
- package/dist/chunk-34yj93hh.js +0 -2
- package/dist/chunk-40tswfe7.js +0 -21
- package/dist/chunk-41de209e.js +0 -2
- package/dist/chunk-506mv7hb.js +0 -3
- package/dist/chunk-5s1ay9mv.js +0 -2
- package/dist/chunk-7kznee1g.js +0 -2
- package/dist/chunk-7mvz972c.js +0 -12
- package/dist/chunk-80zgyaqe.js +0 -2
- package/dist/chunk-84tqb1rn.js +0 -2
- package/dist/chunk-8azm7nha.js +0 -2
- package/dist/chunk-902qnyg0.js +0 -2
- package/dist/chunk-9n6jwcpb.js +0 -2
- package/dist/chunk-a6y8td0d.js +0 -2
- package/dist/chunk-a7kt1ts4.js +0 -2
- package/dist/chunk-a81y8g40.js +0 -2
- package/dist/chunk-aft1zc84.js +0 -2
- package/dist/chunk-bawq4fqy.js +0 -31
- package/dist/chunk-bdp2r0v4.js +0 -2
- package/dist/chunk-brtvm8mb.js +0 -2
- package/dist/chunk-bvzr9zqt.js +0 -2
- package/dist/chunk-cbvgtf3m.js +0 -2
- package/dist/chunk-cfydbaeq.js +0 -2
- package/dist/chunk-dq8c3h4n.js +0 -2
- package/dist/chunk-e36pne7n.js +0 -2
- package/dist/chunk-e62qfexp.js +0 -2
- package/dist/chunk-eq5jzaj5.js +0 -2
- package/dist/chunk-f9zyf9n6.js +0 -421
- package/dist/chunk-fb7t1nn9.js +0 -24
- package/dist/chunk-fr39emcz.js +0 -2
- package/dist/chunk-fsq13amm.js +0 -2
- package/dist/chunk-fxh12vqd.js +0 -2
- package/dist/chunk-gcc9fa33.js +0 -2
- package/dist/chunk-h6t2ney6.js +0 -2
- package/dist/chunk-hvtzw1jh.js +0 -2
- package/dist/chunk-j8g5cvvm.js +0 -2
- package/dist/chunk-jzjpyyw2.js +0 -2
- package/dist/chunk-k1b8x73j.js +0 -2
- package/dist/chunk-nw9bdk2n.js +0 -2
- package/dist/chunk-p4jkswz8.js +0 -2
- package/dist/chunk-p4r90vqf.js +0 -2
- package/dist/chunk-p8bgy5tt.js +0 -2
- package/dist/chunk-pqqe2b6m.js +0 -11
- package/dist/chunk-q6nwcav4.js +0 -2
- package/dist/chunk-qmqavdz2.js +0 -2
- package/dist/chunk-qpw72bty.js +0 -2
- package/dist/chunk-qwnh1kj6.js +0 -2
- package/dist/chunk-qy9m6qdn.js +0 -2
- package/dist/chunk-qychcdsm.js +0 -2
- package/dist/chunk-rj3w1ama.js +0 -2
- package/dist/chunk-rv39s5az.js +0 -20
- package/dist/chunk-sf0r963g.js +0 -2
- package/dist/chunk-ss820yys.js +0 -2
- package/dist/chunk-t4j9g2vh.js +0 -2
- package/dist/chunk-trh7s6k3.js +0 -130
- package/dist/chunk-ttemwrbx.js +0 -2
- package/dist/chunk-twqzn21x.js +0 -14
- package/dist/chunk-v14rq8b4.js +0 -3
- package/dist/chunk-vdxg7e1y.js +0 -4
- package/dist/chunk-vq513cxx.js +0 -2
- package/dist/chunk-vvq8xe3n.js +0 -2
- package/dist/chunk-w8t31bn9.js +0 -2
- package/dist/chunk-x1kz4d7j.js +0 -2
- package/dist/chunk-xaa36b0x.js +0 -3
- package/dist/chunk-xcsyqwxf.js +0 -25
- package/dist/chunk-xn9jrjzh.js +0 -2
- package/dist/chunk-z97bwx8m.js +0 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{AsyncLocalStorage as R}from"async_hooks";var b=Symbol.for("stx.runtime-config.scope"),y=globalThis,m=y[b]??=new R;function
|
|
3
|
-
export{
|
|
2
|
+
import{AsyncLocalStorage as R}from"async_hooks";var b=Symbol.for("stx.runtime-config.scope"),y=globalThis,m=y[b]??=new R;function Be(n,f){return m.run(n,f)}function yn(){return m.getStore()}function ws(){let n=m.getStore();if(!n)throw Error("useServerRuntimeConfig requires a server request or template render");return Object.freeze(Object.defineProperty({public:n.public},"private",{value:n.private}))}function Ho(){return ws().public}function A(n={},f=process.env){let s=new Set;function o(e,i){if(i===null)return e===null;if(Array.isArray(i))return Array.isArray(e)&&(!i.length||e.every((r)=>i.some((u)=>o(r,u))));if(typeof i==="object")return e!==null&&typeof e==="object"&&!Array.isArray(e)&&Object.entries(i).every(([r,u])=>Object.hasOwn(e,r)&&o(e[r],u));return typeof e===typeof i}function g(e,i){if(e&&typeof e==="object"&&!Array.isArray(e)){if(Object.getPrototypeOf(e)!==Object.prototype&&Object.getPrototypeOf(e)!==null)throw TypeError(`Runtime config ${i.join(".")} must contain JSON values`);let t=Object.create(null);for(let[c,l]of Object.entries(e)){if(!/^[a-zA-Z][a-zA-Z0-9_]*$/.test(c)||["constructor","prototype","__proto__"].includes(c))throw TypeError(`Invalid runtime config key: ${c}`);t[c]=g(l,[...i,c])}return Object.freeze(t)}let r=`STX_RUNTIME_${i.map((t)=>t.replace(/([a-z0-9])([A-Z])/g,"$1_$2").toUpperCase()).join("__")}`;if(s.has(r))throw TypeError(`Ambiguous runtime config environment key: ${r}`);s.add(r);let u=f[r],a=e;if(u!==void 0){try{a=typeof e==="string"?u:JSON.parse(u)}catch{throw TypeError(`Invalid runtime config override: ${r}`)}if(!o(a,e))throw TypeError(`Wrong runtime config override type: ${r}`)}function p(t){if(t===null||typeof t==="string"||typeof t==="boolean")return t;if(typeof t==="number"&&Number.isFinite(t))return t;if(Array.isArray(t))return Object.freeze(t.map(p));if(t&&typeof t==="object"&&(Object.getPrototypeOf(t)===Object.prototype||Object.getPrototypeOf(t)===null))return Object.freeze(Object.fromEntries(Object.entries(t).map(([c,l])=>[c,p(l)])));throw TypeError(`Runtime config ${i.join(".")} must contain JSON values`)}return p(a)}return Object.freeze({public:g(n.public??{},["public"]),private:g(n.private??{},["private"])})}function C(n){return`<script data-stx-scoped data-stx-runtime-config type="application/json">${JSON.stringify(n.public).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function Nt(n,f){let s=n.replace(/<script\b[^>]*\bdata-stx-runtime-config\b[^>]*>[\s\S]*?<\/script>/gi,""),o=/<head\b[^>]*>/i.exec(s),g=o?o.index+o[0].length:0;return s.slice(0,g)+C(f)+s.slice(g)}
|
|
3
|
+
export{Be,yn,ws,Ho,A,Nt};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var f=null,D=[],v=0,g=new Set;function x(){return f}function S(e){let n=f;return D.push(e),f=e,n}function h(e){D.pop(),f=e}var A=new WeakMap;function w(e,n){A.set(e,n)}function p(e,n){for(let r of e){let i=A.get(r);if(i)i(n);else n.add(r)}}function b(e){if(v>0){p(e,g);return}let n=new Set;p(e,n);for(let r of n)r()}function C(e){v++;try{e()}finally{if(v--,v===0){let n=[...g];g.clear();for(let r of n)r()}}}function m(e){let n=f;f=null;try{return e()}finally{f=n}}var k=[],T=[];function
|
|
3
|
-
export{
|
|
2
|
+
var f=null,D=[],v=0,g=new Set;function x(){return f}function S(e){let n=f;return D.push(e),f=e,n}function h(e){D.pop(),f=e}var A=new WeakMap;function w(e,n){A.set(e,n)}function p(e,n){for(let r of e){let i=A.get(r);if(i)i(n);else n.add(r)}}function b(e){if(v>0){p(e,g);return}let n=new Set;p(e,n);for(let r of n)r()}function C(e){v++;try{e()}finally{if(v--,v===0){let n=[...g];g.clear();for(let r of n)r()}}}function m(e){let n=f;f=null;try{return e()}finally{f=n}}var k=[],T=[];function ce(e){let n=e,r=new Set,i=new Set,o=()=>{let t=x();if(t)i.add(t);return n};return o.set=(t)=>{if(!Object.is(t,n)){let c=n;n=t,r.forEach((u)=>{try{u(n,c)}catch(l){console.error("[stx] subscriber error:",l)}}),b(i)}},o.update=(t)=>{o.set(t(n))},o.subscribe=(t)=>(r.add(t),()=>r.delete(t)),Object.defineProperty(o,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(o,"value",{get:()=>o(),set:(t)=>o.set(t),configurable:!0}),o}function Mn(e,n={}){let r,i=!0,o=!1,t=new Set,c=typeof n.equals==="function"?n.equals:null,u=()=>{let s=S(d);try{r=e(),o=!0}finally{h(s)}i=!1},l=()=>{let s=r,y=o;try{u()}catch{return i=!0,!0}return!y||!c(s,r)},d=()=>{if(i)return;if(c&&t.size){if(l())b(t);return}i=!0,b(t)};w(d,(s)=>{if(i)return;if(c&&t.size){if(l())p(t,s);return}i=!0,p(t,s)});let a=()=>{let s=x();if(s)t.add(s);if(i)u();return r};return Object.defineProperty(a,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(a,"value",{get:()=>a(),configurable:!0}),a}function Gd(e,n=Object.is){return Mn(e,{equals:n})}function Ln(e,n={}){let r,i=!1,o=()=>{if(i)return;if(r){let c=r;r=void 0;try{c()}catch(u){console.error("[stx] effect cleanup error:",u)}}let t=S(o);try{let c=e();r=typeof c==="function"?c:void 0}catch(c){i=!0,console.error("[stx] effect error (the effect is disposed):",c)}finally{h(t)}};if(n.immediate!==!1)o();return()=>{if(i=!0,r){let t=r;r=void 0,t()}}}function Ws(e){C(e)}function Nr(e){k.push(e)}function Dr(e){T.push(e)}function Kd(){O(k,"onMount",T)}function Xd(){O(T,"onDestroy")}function O(e,n,r){let i=e.splice(0,e.length);for(let o of i)try{let t=o();if(r&&typeof t==="function")r.push(t)}catch(t){console.error(`[stx] ${n} callback threw:`,t)}}function Jd(){return{mount:k.length,destroy:T.length}}function jn(e){return typeof e==="function"&&e._isSignal===!0}function Bn(e){return typeof e==="function"&&e._isDerived===!0}function qs(e){if(jn(e)||Bn(e))return m(()=>e());return e}function Mr(e){return m(e)}function Yd(e,n){let r=typeof e==="function"?e:()=>e,i=ce([]),o=Mn(()=>i().reduce((u,l)=>n(u,l.action),r())),t=!1;return Ln(()=>{if(r(),!t){t=!0;return}if(Mr(()=>i().length))i.set([])}),[o,(u,l)=>{let d={action:u};i.set([...i(),d]);let a=()=>{let s=i().filter((y)=>y!==d);if(s.length!==i().length)i.set(s)};if(l&&typeof l.then==="function")Promise.resolve(l).then(a,a);return a}]}
|
|
3
|
+
export{ce,Mn,Gd,Ln,Ws,Nr,Dr,Kd,Xd,Jd,jn,Bn,qs,Mr,Yd};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ji,sl,On,sd,ol,il,al,od}from"./chunk-xdn6rtq2.js";import"./chunk-3vwkyjan.js";import"./chunk-0thxpgtp.js";import"./chunk-9wdd7eq6.js";import"./chunk-kzb04293.js";import"./chunk-6beg47t4.js";import"./chunk-78yjmbbs.js";export{On as Validator,sl as defineForm,ol as processErrorDirective,il as processErrorsDirective,od as processFormValidationDirectives,al as processHasErrorsDirective,ji as useForm,sd as v};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Y,Z,Q,
|
|
2
|
+
import{Y,Z,Q,Tn,ge,Ce,dt,Wt,$n,Rn,An,ee,Pn,In}from"./chunk-x4q4bx3q.js";import{bt}from"./chunk-3hxd5td3.js";function Ec(s,r={}){let{src:e,alt:t,width:n,height:a,sizes:i="100vw",loading:m="lazy",priority:o=!1,quality:u=Q,placeholder:l="none",formats:f=Z,widths:y=Y,decoding:c="async",fetchpriority:h,objectFit:d,objectPosition:g}=s,{class:p,style:v}=s,{processedImage:w,variants:I,optimize:b=!0,isDev:A=!1}=r;if(I&&I.length>0)return G(s,I,w);if(A||!b)return X(s);return te(s)}function G(s,r,e){let{src:t,alt:n,width:a,height:i,sizes:m="100vw",loading:o="lazy",priority:u=!1,decoding:l="async",fetchpriority:f,objectFit:y,objectPosition:c,placeholder:h="none"}=s,{class:d,style:g}=s,p=Rn(r),v=$n(r),w=typeof m==="object"?Wt(m):m,I=e?e.aspectRatio:a&&i?Number(a)/Number(i):void 0,b=[];if(I)b.push(`aspect-ratio: ${I}`);if(y)b.push(`object-fit: ${y}`);if(c)b.push(`object-position: ${c}`);if(g)b.push(g);let A=b.length>0?` style="${b.join("; ")}"`:"",S=d?` class="${d}"`:"",F=u?"":` loading="${o}"`,R=` decoding="${l}"`,C=f?` fetchpriority="${f}"`:u?' fetchpriority="high"':"",E=["avif","webp","jpeg","png"],M=[];for(let k of E){let z=p.get(k);if(z&&z.length>0){let O=dt(z),K=ee(k);M.push(` <source type="${K}" srcset="${O}" sizes="${w}" />`)}}let U="",L="",T;if(h!=="none"&&e?.placeholder){let k=`img-${Math.random().toString(36).slice(2,8)}`;if(U=`<div class="stx-image-wrapper" id="${k}">`,L="</div>",h==="blur")T=`
|
|
3
3
|
#${k} {
|
|
4
4
|
position: relative;
|
|
5
5
|
background-image: url('${e.placeholder}');
|
|
@@ -23,14 +23,14 @@ ${M.join(`
|
|
|
23
23
|
src="${v?.url||t}"
|
|
24
24
|
alt="${B(n)}"${_}${H}${S}${A}${F}${R}${C}
|
|
25
25
|
/>
|
|
26
|
-
</picture>${L}`,V;if(u&&v){let k=p.get("webp"),z=k?.[Math.floor(k.length/2)]||v,O=ee(z.format);V=`<link rel="preload" as="image" href="${z.url}" type="${O}" />`}return{html:J,preloadLink:V,placeholderCss:T}}function X(s){let{src:r,alt:e,width:t,height:n,loading:a="lazy",decoding:i="async",priority:m=!1,fetchpriority:o,objectFit:u,objectPosition:l}=s,{class:f,style:y}=s,c=[];if(u)c.push(`object-fit: ${u}`);if(l)c.push(`object-position: ${l}`);if(y)c.push(y);let h=c.length>0?` style="${c.join("; ")}"`:"",d=f?` class="${f}"`:"",g=t?` width="${t}"`:"",p=n?` height="${n}"`:"",v=m?"":` loading="${a}"`,w=` decoding="${i}"`,I=o?` fetchpriority="${o}"`:m?' fetchpriority="high"':"";return{html:`<img src="${r}" alt="${B(e)}"${g}${p}${d}${h}${v}${w}${I} />`}}function te(s){let{src:r,alt:e,width:t,height:n,sizes:a="100vw",loading:i="lazy",priority:m=!1,quality:o=Q,formats:u=Z,widths:l=Y,decoding:f="async",fetchpriority:y,objectFit:c,objectPosition:h}=s,{class:d,style:g}=s,p=[];if(c)p.push(`object-fit: ${c}`);if(h)p.push(`object-position: ${h}`);if(g)p.push(g);let v=p.length>0?` style="${p.join("; ")}"`:"",w=d?` class="${d}"`:"",I=t?` width="${t}"`:"",b=n?` height="${n}"`:"",A=m?"":` loading="${i}"`,S=` decoding="${f}"`,F=y?` fetchpriority="${y}"`:m?' fetchpriority="high"':"",R=typeof a==="object"?
|
|
26
|
+
</picture>${L}`,V;if(u&&v){let k=p.get("webp"),z=k?.[Math.floor(k.length/2)]||v,O=ee(z.format);V=`<link rel="preload" as="image" href="${z.url}" type="${O}" />`}return{html:J,preloadLink:V,placeholderCss:T}}function X(s){let{src:r,alt:e,width:t,height:n,loading:a="lazy",decoding:i="async",priority:m=!1,fetchpriority:o,objectFit:u,objectPosition:l}=s,{class:f,style:y}=s,c=[];if(u)c.push(`object-fit: ${u}`);if(l)c.push(`object-position: ${l}`);if(y)c.push(y);let h=c.length>0?` style="${c.join("; ")}"`:"",d=f?` class="${f}"`:"",g=t?` width="${t}"`:"",p=n?` height="${n}"`:"",v=m?"":` loading="${a}"`,w=` decoding="${i}"`,I=o?` fetchpriority="${o}"`:m?' fetchpriority="high"':"";return{html:`<img src="${r}" alt="${B(e)}"${g}${p}${d}${h}${v}${w}${I} />`}}function te(s){let{src:r,alt:e,width:t,height:n,sizes:a="100vw",loading:i="lazy",priority:m=!1,quality:o=Q,formats:u=Z,widths:l=Y,decoding:f="async",fetchpriority:y,objectFit:c,objectPosition:h}=s,{class:d,style:g}=s,p=[];if(c)p.push(`object-fit: ${c}`);if(h)p.push(`object-position: ${h}`);if(g)p.push(g);let v=p.length>0?` style="${p.join("; ")}"`:"",w=d?` class="${d}"`:"",I=t?` width="${t}"`:"",b=n?` height="${n}"`:"",A=m?"":` loading="${i}"`,S=` decoding="${f}"`,F=y?` fetchpriority="${y}"`:m?' fetchpriority="high"':"",R=typeof a==="object"?Wt(a):a,C=`
|
|
27
27
|
data-stx-image
|
|
28
28
|
data-src="${r}"
|
|
29
29
|
data-sizes="${R}"
|
|
30
30
|
data-quality="${o}"
|
|
31
31
|
data-formats="${u.join(",")}"
|
|
32
32
|
data-widths="${l.join(",")}"
|
|
33
|
-
`.replace(/\s+/g," ").trim();return{html:`<img src="${r}" alt="${B(e)}"${I}${b}${w}${v}${A}${S}${F} ${C} />`}}function
|
|
33
|
+
`.replace(/\s+/g," ").trim();return{html:`<img src="${r}" alt="${B(e)}"${I}${b}${w}${v}${A}${S}${F} ${C} />`}}function ki(s){let r=s.match(/<Image\s+([^>]*?)\/?>/);if(!r)return null;let e=r[1],t={},n=/(\w+)(?:=(?:"([^"]*)"|'([^']*)'|(\{[^}]+\})))?/g,a;while((a=n.exec(e))!==null){let[,i,m,o,u]=a,l=m??o??u??!0;switch(i){case"src":t.src=String(l);break;case"alt":t.alt=String(l);break;case"width":t.width=Number(l)||l;break;case"height":t.height=Number(l)||l;break;case"sizes":t.sizes=String(l);break;case"loading":t.loading=l;break;case"priority":t.priority=l===!0||l==="true";break;case"quality":t.quality=Number(l);break;case"placeholder":t.placeholder=l;break;case"class":t.class=String(l);break;case"style":t.style=String(l);break;case"decoding":t.decoding=l;break;case"fetchpriority":t.fetchpriority=l;break;case"objectFit":t.objectFit=l;break;case"objectPosition":t.objectPosition=String(l);break}}if(!t.src||!t.alt)return null;return t}async function Tc(s,r){let e=/<Image\s+[^>]*?\/?>/g,t=[],n=[],a=s,i,m=[];while((i=e.exec(s))!==null)m.push({match:i[0],index:i.index});for(let o=m.length-1;o>=0;o--){let{match:u}=m[o],l=ki(u);if(l){let f=await r(l);if(a=a.replace(u,f.html),f.preloadLink)t.push(f.preloadLink);if(f.placeholderCss)n.push(f.placeholderCss)}}return{html:a,preloadLinks:t,styles:n}}function B(s){return s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var D=new Map;function $c(){D.clear()}async function se(s,r){let e=`${s}:${JSON.stringify(r)}`;if(D.has(e))return D.get(e);try{let t=await Ce(s,r);return D.set(e,t),t}catch{return null}}function _i(){return bt({name:"image",hasEndTag:!1,description:"Render an optimized image with responsive variants",transform:async(s,r,e)=>{let{src:t,alt:n,options:a}=re(s,r,e);if(!t)return console.warn("@image directive: missing src argument"),"<!-- @image: missing src -->";let i={widths:a.widths||(a.width?[a.width]:Y),formats:a.formats||Z,quality:a.quality||Q,placeholder:(a.placeholder==="color"?"dominant-color":a.placeholder)||"none"};if(!await ge())return q(t,n||"",a);let o=await se(t,i);if(!o)return q(t,n||"",a);return ie(o,n||"",a)}})}function re(s,r,e){if(r.src)return{src:String(r.src),alt:String(r.alt||""),options:r.options||{}};let n=s.trim();if(n.startsWith("@image(")||n.startsWith("("))n=n.replace(/^@image\(/,"").replace(/^\(/,"").replace(/\)$/,"");let a=ae(n),i=a[0]||"",m=a[1]||"",o={};if(i&&!i.startsWith("/")&&!i.startsWith(".")&&!i.startsWith("http")){let u=e[i];if(typeof u==="string")i=u}if(a[2])try{if(typeof a[2]==="string")o=JSON.parse(a[2]);else o=a[2]}catch{}return{src:i,alt:m,options:o}}function ae(s){let r=[],e="",t=!1,n="",a=0,i=0;for(let m=0;m<s.length;m++){let o=s[m],u=m>0?s[m-1]:"";if((o==='"'||o==="'")&&u!=="\\"){if(!t)t=!0,n=o;else if(o===n)t=!1,n="";else e+=o;continue}if(!t){if(o==="{")a++;if(o==="}")a--;if(o==="[")i++;if(o==="]")i--;if(o===","&&a===0&&i===0){r.push(e.trim()),e="";continue}}e+=o}if(e.trim())r.push(e.trim());return r}function q(s,r,e){let t=[`src="${x(s)}"`];if(r)t.push(`alt="${x(r)}"`);if(e.width)t.push(`width="${e.width}"`);if(e.height)t.push(`height="${e.height}"`);if(e.class)t.push(`class="${x(e.class)}"`);if(e.style)t.push(`style="${x(e.style)}"`);if(e.lazy!==!1)t.push('loading="lazy"');return t.push('decoding="async"'),`<img ${t.join(" ")} />`}function ie(s,r,e){let{variants:t,placeholder:n,width:a,height:i,aspectRatio:m}=s,o=new Map;for(let g of t){let p=o.get(g.format)||[];p.push(g),o.set(g.format,p)}let u=["avif","webp","jpeg","png"],l=[];for(let g of u){let p=o.get(g);if(p&&p.length>0){let v=dt(p),w=ee(g),I=e.sizes||"100vw";l.push(` <source type="${w}" srcset="${x(v)}" sizes="${x(I)}" />`)}}let f=o.get("jpeg")||[],y=f.length>0?f[Math.floor(f.length/2)]:t[Math.floor(t.length/2)],c=[`src="${y?.url||s.src}"`,`alt="${x(r)}"`];if(e.width||a)c.push(`width="${e.width||a}"`);if(e.height||i)c.push(`height="${e.height||i}"`);if(e.class)c.push(`class="${x(e.class)}"`);let h=[];if(m)h.push(`aspect-ratio: ${m.toFixed(4)}`);if(e.style)h.push(e.style);if(h.length>0)c.push(`style="${h.join("; ")}"`);if(e.lazy!==!1&&!e.priority)c.push('loading="lazy"');if(c.push('decoding="async"'),e.priority)c.push('fetchpriority="high"');let d=`<picture>
|
|
34
34
|
`;if(d+=l.join(`
|
|
35
35
|
`)+`
|
|
36
36
|
`,d+=` <img ${c.join(" ")} />
|
|
@@ -39,5 +39,5 @@ ${d}
|
|
|
39
39
|
</div>`}else if(e.placeholder==="color"){let p=n.replace(/[^a-zA-Z0-9#(),.\s%-]/g,"");d=`<div id="${g}" class="stx-image-placeholder" style="background-color: ${p};">
|
|
40
40
|
${d}
|
|
41
41
|
</div>`}}if(e.priority&&y){let g=ee(y.format);d=`<link rel="preload" as="image" href="${x(y.url)}" type="${g}" />
|
|
42
|
-
`+d}return d}function x(s){return s.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var
|
|
43
|
-
export{
|
|
42
|
+
`+d}return d}function x(s){return s.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var Rc=_i();import P from"fs";import j from"path";function Ac(s={}){let{inputDirs:r=["public","src/assets","assets"],outputDir:e="dist/images",baseUrl:t="/images",formats:n=Z,widths:a=Y,quality:i=Q,placeholder:m="none",concurrency:o=4,cache:u=!0,cacheDir:l=".stx/image-cache",referencedOnly:f=!1,verbose:y=!1}=s,c={imageReferences:new Set,processedImages:new Map,stats:{totalImages:0,optimizedImages:0,savedBytes:0,variants:0}};return{name:"stx-image-optimization",async setup(h){if(!await ge()){console.warn("[stx-images] no image backend available, optimization disabled");return}if(u)await P.promises.mkdir(l,{recursive:!0});if(y){let g=await Tn();console.log("[stx-images] Plugin initialized"),console.log(` Backend: ${g?"sharp (native fast path) + ts-images":"ts-images (pure TS)"}`),console.log(` Input dirs: ${r.join(", ")}`),console.log(` Output dir: ${e}`),console.log(` Formats: ${n.join(", ")}`),console.log(` Widths: ${a.join(", ")}`)}},async buildStart(){c.imageReferences.clear(),c.processedImages.clear(),c.stats={totalImages:0,optimizedImages:0,savedBytes:0,variants:0}},async transform(h,d){if(d.endsWith(".html")||d.endsWith(".stx")){let g=ne(h);for(let p of g)c.imageReferences.add(p)}if(h.includes("<Image")||h.includes("@image"))return await ce(h,{formats:n,widths:a,quality:i,placeholder:m,outputDir:e,baseUrl:t,processedImages:c.processedImages});return h},async buildEnd(h){if(!await ge())return;await P.promises.mkdir(e,{recursive:!0});let g=[];for(let w of r){if(!P.existsSync(w))continue;let I=await N(w);g.push(...I)}let p=f?g.filter((w)=>oe(w,c.imageReferences)):g;if(c.stats.totalImages=p.length,y)console.log(`[stx-images] Processing ${p.length} images...`);let v=W(p,o);for(let w of v)await Promise.all(w.map(async(I)=>{try{let b=await Ce(I,{formats:n,widths:a,quality:i,placeholder:m,outputDir:e,baseUrl:t});c.processedImages.set(I,b),c.stats.optimizedImages++,c.stats.variants+=b.variants.length;let A=P.statSync(I).size,S=Pn(b.variants);if(c.stats.savedBytes+=Math.max(0,A-S/b.variants.length),y)console.log(` \u2713 ${j.basename(I)} \u2192 ${b.variants.length} variants`)}catch(b){console.error(`[stx-images] Error processing ${I}:`,b)}}));if(console.log("[stx-images] Optimization complete:"),console.log(` Images: ${c.stats.optimizedImages}/${c.stats.totalImages}`),console.log(` Variants: ${c.stats.variants}`),c.stats.savedBytes>0)console.log(` Saved: ~${In(c.stats.savedBytes)}`)}}}function ne(s){let r=[],e=/src=["']([^"']+\.(jpg|jpeg|png|webp|avif|gif))["']/gi,t;while((t=e.exec(s))!==null)r.push(t[1]);let n=/<Image[^>]+src=["']([^"']+)["']/gi;while((t=n.exec(s))!==null)r.push(t[1]);let a=/@image\s*\(\s*['"]([^'"]+)['"]/gi;while((t=a.exec(s))!==null)r.push(t[1]);let i=/background(?:-image)?:\s*url\(["']?([^"')]+\.(jpg|jpeg|png|webp|avif|gif))["']?\)/gi;while((t=i.exec(s))!==null)r.push(t[1]);return r}function oe(s,r){let e=j.basename(s);for(let t of r)if(t.endsWith(e)||t.includes(e))return!0;return!1}async function ce(s,r){return s}async function N(s){let r=[];async function e(t){let n=await P.promises.readdir(t,{withFileTypes:!0});for(let a of n){let i=j.join(t,a.name);if(a.isDirectory())await e(i);else if(a.isFile()&&An(i))r.push(i)}}return await e(s),r}function W(s,r){let e=[];for(let t=0;t<s.length;t+=r)e.push(s.slice(t,t+r));return e}async function Pc(s,r,e={}){if(!await ge())throw Error("No image backend available \u2014 install sharp or ensure ts-images is bundled");return Ce(s,{...e,outputDir:r})}async function Ic(s,r,e={}){let{formats:t=Z,widths:n=Y,quality:a=Q,placeholder:i="none",concurrency:m=4,verbose:o=!1}=e;if(!await ge())throw Error("No image backend available \u2014 install sharp or ensure ts-images is bundled");await P.promises.mkdir(r,{recursive:!0});let l=await N(s),f=[],y={totalImages:l.length,optimizedImages:0,savedBytes:0,variants:0},c=W(l,m);for(let h of c){let d=await Promise.all(h.map(async(g)=>{try{let p=await Ce(g,{formats:t,widths:n,quality:a,placeholder:i,outputDir:r,baseUrl:"/"});if(y.optimizedImages++,y.variants+=p.variants.length,o)console.log(` \u2713 ${j.basename(g)}`);return p}catch(p){return console.error(`Error processing ${g}:`,p),null}}));f.push(...d.filter((g)=>g!==null))}return{processed:f,stats:y}}function Ci(s){let r={};for(let e of s)r[e.src]={variants:e.variants,placeholder:e.placeholder};return r}async function Oc(s,r){let e=Ci(s);await Bun.write(r,JSON.stringify(e,null,2))}var Nu={enabled:!0,widths:[320,640,768,1024,1280,1536,1920],formats:["webp","jpeg"],quality:80,devOptimize:!1,cacheDir:".stx/image-cache",placeholder:"none",inputDirs:["public","src/assets","assets"],outputDir:"dist/images",baseUrl:"/images"};
|
|
43
|
+
export{Ec,ki,Tc,$c,_i,Rc,Ac,Pc,Ic,Ci,Oc,Nu};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{pl,fl,Ee,gl,ta,Xt,Jt,ip,na,Yt,Hn,ml,hl,yl,Xs,Zt,bl,Qt,vl}from"./chunk-nvbyscdh.js";import"./chunk-54fazdmn.js";import"./chunk-374nhgyf.js";import"./chunk-6qh2mx6q.js";import"./chunk-8xxc5edr.js";import"./chunk-dera8fmc.js";import"./chunk-q3gactm1.js";import"./chunk-yaccg2c0.js";import"./chunk-f26n6y9p.js";import"./chunk-3vwkyjan.js";import"./chunk-0thxpgtp.js";import"./chunk-9wdd7eq6.js";import"./chunk-kzb04293.js";import"./chunk-6beg47t4.js";import"./chunk-78yjmbbs.js";export{Hn as MODULE_SPECIFIER_PREFIX,pl as bundleCacheDir,fl as bundleCacheEntryLimit,Qt as bundleClientScript,Jt as clearBundleFailures,Ee as clientBundleDependencies,Xt as getBundleFailures,Yt as hasUserImports,Zt as moduleSubstitutionKey,hl as normalizeRegistrySpecifiers,bl as queueClientBundleBuild,ta as recordBundleFailure,ml as registryIdForPath,na as resolveBundlerFallback,yl as rewriteRegistryImports,ip as setBundlerFallbackMode,gl as shouldLogBundlerDiagnostics,vl as tempBuildName,Xs as withModuleSubstitutes};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
`)
|
|
2
|
+
import{r}from"./chunk-tst8p27s.js";function y(e,n,i=240){return e.slice(n,n+i)}var v=[{rule:"route-params",pattern:/\blocation\s*\.\s*pathname\s*\.\s*(?:match|split)\s*\(/g,primitive:"useRoute() / useRouteParams() / useRouteParam(name)",why:"parsing the URL by hand re-implements the router and does not update on SPA navigation"},{rule:"alert",pattern:/(?<![.#\w$])(?:(?:window|globalThis)\s*\.\s*)?alert\s*\(/g,primitive:"stxAlert(message)",why:"themed, focus-trapped and non-blocking \u2014 but `await` it if the code after it "+"depended on the native dialog blocking until dismissal",reject:(e)=>/\b(?:async\s+)?function\s+alert\s*\(/.test(e)||/\b(?:const|let|var)\s+alert\s*=/.test(e)},{rule:"search-params",pattern:/new\s+URLSearchParams\s*\(/g,primitive:"useSearchParams()",why:"reactive, and writes back through the router instead of history.replaceState",reject:(e,n)=>{let i=e.indexOf("(",n);if(i===-1)return!0;let o=e.slice(i+1,e.indexOf(")",i)+1);return!/\b(?:location|search|href|url)\b/i.test(o)}},{rule:"navigate",pattern:/\blocation\s*\.\s*(?:assign|replace)\s*\(|\blocation\s*\.\s*href\s*=/g,primitive:"navigate(path) / goBack()",why:"a full document load throws away every store and the scroll position; navigate() is an SPA transition",reject:(e,n)=>/^[^\n]*?(?:['"`]\s*)?(?:mailto:|tel:|sms:|https?:\/\/|\/\/)/.test(y(e,n,160))},{rule:"fetch",pattern:/new\s+AbortController\s*\(/g,primitive:"useFetch(url) / useAsyncData(key, fn)",why:"cancellation, loading and error state are already wired; hand-rolling them is where the races live"},{rule:"polling",pattern:/setInterval\s*\(/g,primitive:"useEventSource() / useSSE() / useWebSocket() / useChannel()",why:"polling burns requests and lags; the push primitives are delivered",reject:(e,n)=>!/\bfetch\s*\(|\$fetch\b|useFetch\b|\.get\s*\(|axios\b/.test(y(e,n))},{rule:"debounce",pattern:/\bclearTimeout\s*\(/g,primitive:"useDebounce(fn, ms) / useThrottle(fn, ms)",why:"a hand-held timer handle per call site is the usual source of stale-result bugs",requires:(e)=>/setTimeout\s*\(/.test(e)},{rule:"click-outside",pattern:/document\s*\.\s*addEventListener\s*\(\s*['"](?:click|mousedown|pointerdown)['"]/g,primitive:"useClickOutside(ref, fn)",why:"the document-level listener plus the blur race is exactly what this composable exists to remove"},{rule:"focus",pattern:/\.\s*(?:getElementById|querySelector)\s*\([^)]*\)\s*(?:\?\.)?\s*\.?focus\s*\(/g,primitive:"useFocus(ref) with x-ref",why:"a query by id breaks under nested scopes and SPA navigation; a ref does not"},{rule:"clipboard",pattern:/navigator\s*\.\s*(?:clipboard|share)\b/g,primitive:"useClipboard() / useShare()",why:"permission state, the copied flag and the unsupported-browser fallback are already handled"},{rule:"watch",pattern:/\beffect\s*\(\s*\(\s*\)\s*=>\s*\{[^}]*\bvoid\s+\w+\s*\(\s*\)/g,primitive:"watch(source, cb) / watchMultiple([...], cb)",why:"the `void a(); void b()` dance is a manual dependency list; watch takes one directly"}],C=["confirm","tooltip",...v.map((e)=>e.rule)];function g(e,n){let i=1;for(let o=0;o<n;o++)if(e[o]===`
|
|
3
|
+
`)i++;return i}function b(e,n){let i=e.lastIndexOf(`
|
|
4
4
|
`,n)+1,o=e.indexOf(`
|
|
5
|
-
`,n);return e.slice(
|
|
6
|
-
${t.reason}`)}if(l.length>0){
|
|
7
|
-
use ${t.reason}`)}return
|
|
5
|
+
`,n);return e.slice(i,o===-1?e.length:o).trim().slice(0,120)}function S(e,n){let i=e.slice(0,n),o=i.lastIndexOf("function"),l=i.lastIndexOf("=>"),s=Math.max(o,l);if(s===-1)return!1;let t=e.slice(Math.max(0,s-120),s);return/\basync\b[^;{}]*$/.test(t)}function k(e){return/\b(?:async\s+)?function\s+confirm\s*\(/.test(e)||/\b(?:const|let|var)\s+confirm\s*=/.test(e)||/\bimport\s*\{[^}]*\bconfirm\b[^}]*\}/.test(e)}function A(e,n,i){if(k(e))return e;let o=/(^|[^\w$.])(?:(?:window|globalThis)\s*\.\s*)?confirm\s*\(/g,l=m(e),s="",t=0,a;while((a=o.exec(l))!==null){let c=a.index+a[1].length,u=g(e,c),d=b(e,c);if(/stxConfirm\s*\($/.test(e.slice(0,c+8)))continue;let p=S(e,c);if(i.push({file:n,line:u,rule:"confirm",applied:p,snippet:d,reason:p?void 0:"stxConfirm() returns a Promise and native confirm() is synchronous, so this needs `await` inside an async function. Rewriting it here would make the condition always true."}),p)s+=e.slice(t,c)+"await stxConfirm(",t=c+(a[0].length-a[1].length)}return s+e.slice(t)}function E(e,n,i){let o=/(<[a-z][\w-]*\b[^>]*?)\stitle=(["'])(.*?)\2/gis,l=R(e),s="",t=0,a;while((a=o.exec(l))!==null){let[c,u,d,p]=a,h=g(e,a.index),f=b(e,a.index),w=u.match(/^<([A-Za-z][\w-]*)/)?.[1]??"";if(/^[A-Z]/.test(w)){i.push({file:n,line:h,rule:"tooltip",applied:!1,snippet:f,reason:`\`title\` on <${w}> is a component prop, not an HTML attribute \u2014 `+"adding x-tooltip here would put a tooltip on a component and may duplicate text it already renders."});continue}if(/\bx-tooltip[=\s]/.test(u)||p.trim()===""){i.push({file:n,line:h,rule:"tooltip",applied:!1,snippet:f,reason:/\bx-tooltip[=\s]/.test(u)?"already has x-tooltip":"empty title"});continue}i.push({file:n,line:h,rule:"tooltip",applied:!0,snippet:f}),s+=e.slice(t,a.index)+`${u} x-tooltip=${d}${p}${d} title=${d}${p}${d}`,t=a.index+c.length}return s+e.slice(t)}function R(e){return e.replace(/<!--[\s\S]*?-->/g,(n)=>n.replace(/[^\n]/g," ")).replace(/\{\{--[\s\S]*?--\}\}/g,(n)=>n.replace(/[^\n]/g," "))}function F(e){let n=(i)=>i.replace(/[^\n]/g," ");return e.replace(/\/\*[\s\S]*?\*\//g,n).replace(/\/\/[^\n]*/g,n)}function m(e,n=!1){let i=R(e);return(n?F(i):r(i)).replace(/<script\b([^>]*)>([\s\S]*?)<\/script\s*>/gi,(l,s)=>/\bclient\b/i.test(s)?l:l.replace(/[^\n]/g," "))}function O(e,n,i,o){let l=m(e),s=m(e,!0);for(let t of v){if(!i.includes(t.rule))continue;if(t.requires&&!t.requires(e))continue;t.pattern.lastIndex=0;let a,c=/['"]/.test(t.pattern.source)?s:l;t.pattern.lastIndex=0;while((a=t.pattern.exec(c))!==null){if(t.reject?.(e,a.index))continue;o.push({file:n,line:g(e,a.index),rule:t.rule,applied:!1,snippet:b(e,a.index),reason:`${t.primitive} \u2014 ${t.why}`})}}}function q(e,n={}){let i=n.rules??C,o=n.file??"<source>",l=[];O(e,o,i,l);let s=e;if(i.includes("confirm"))s=A(s,o,l);if(i.includes("tooltip"))s=E(s,o,l);l.sort((c,u)=>c.line-u.line);let t=new Set,a=l.filter((c)=>{let u=`${c.rule}:${c.line}`;if(t.has(u))return!1;return t.add(u),!0});return{code:s,findings:a}}var x=new Set(["confirm","tooltip"]);function I(e,n){if(e.length===0)return"No hand-rolled equivalents found.";let i=e.filter((t)=>t.applied),o=e.filter((t)=>!t.applied&&x.has(t.rule)),l=e.filter((t)=>!t.applied&&!x.has(t.rule)),s=[];if(i.length>0){s.push(n?`Rewrote ${i.length} site(s):`:`Would rewrite ${i.length} site(s) (pass --fix):`);for(let t of i)s.push(` ${t.file}:${t.line} [${t.rule}] ${t.snippet}`)}if(o.length>0){s.push("",`Needs a human \u2014 ${o.length} site(s):`);for(let t of o)s.push(` ${t.file}:${t.line} [${t.rule}] ${t.snippet}
|
|
6
|
+
${t.reason}`)}if(l.length>0){s.push("",`An stx primitive already covers this \u2014 ${l.length} site(s):`);for(let t of l)s.push(` ${t.file}:${t.line} [${t.rule}] ${t.snippet}
|
|
7
|
+
use ${t.reason}`)}return s.join(`
|
|
8
8
|
`)}export{q as codemodSource,I as formatCodemodFindings};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{cp,sa,lp,oa,wl,xl,nn,Gn,up,Sl,kl,dp,h}from"./chunk-6ncvb8gp.js";import"./chunk-qdkwg2b8.js";import"./chunk-3vwkyjan.js";import"./chunk-0thxpgtp.js";import"./chunk-9wdd7eq6.js";import"./chunk-kzb04293.js";import"./chunk-6beg47t4.js";import"./chunk-78yjmbbs.js";export{nn as buildCss,Sl as extractClassNames,xl as fingerprintConfig,kl as generateCss,up as getCachedCSS,cp as getCssServeAsset,h as injectCss,sa as loadCssEngine,oa as loadCssEngineConfig,Gn as rebuildCss,lp as resetCssCache,wl as resolveUserCssConfig,dp as withLinkedModuleBundles};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{B}from"./chunk-
|
|
3
|
-
export{
|
|
2
|
+
import{B}from"./chunk-3vwkyjan.js";import{Be,A,Nt}from"./chunk-9wdd7eq6.js";import{ut,ke,O,_e,Ii,Hs,Oi,Cn}from"./chunk-gc4w2s5n.js";import{vt,le,Ye}from"./chunk-f26n6y9p.js";import{Zs}from"./chunk-54fazdmn.js";import{En}from"./chunk-wav0xbnb.js";import{he}from"./chunk-4e5jrxbn.js";import Z from"fs";import T from"path";var{serve:ce}=globalThis.Bun;import F from"zlib";import{promisify as Q}from"util";var K=Q(F.brotliCompress),ee=Q(F.gzip),te=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],ne=["text/event-stream","multipart/x-mixed-replace"],re=1024;function se(t){if(!t)return!1;let e=t.toLowerCase();if(ne.some((o)=>e.startsWith(o)))return!1;return te.some((o)=>e.startsWith(o))}function oe(t){let e=new Map;for(let o of t.split(",")){let[r,...a]=o.trim().split(";"),f=r.trim().toLowerCase();if(!f)continue;let h=1;for(let g of a){let l=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(g);if(!l)continue;let m=Number.parseFloat(l[1]);if(Number.isFinite(m))h=m}e.set(f,h)}return e}function ae(t){if(!t)return null;let e=oe(t),o=e.get("*"),r=(a)=>e.get(a)??o??0;if(r("br")>0)return"br";if(r("gzip")>0)return"gzip";return null}var Y=33554432,H=new Map,U=0;function ie(t,e){if(e.length>Y/8)return;H.set(t,e),U+=e.length;for(let[o,r]of H){if(U<=Y)break;H.delete(o),U-=r.length}}async function kn(t,e,o={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!se(e.headers.get("content-type")))return e;let r=ae(t.headers.get("accept-encoding"));if(!r)return e;let a;try{a=new Uint8Array(await e.arrayBuffer())}catch{return e}let f=()=>new Response(a,{status:e.status,statusText:e.statusText,headers:J(e.headers)});if(a.length<(o.threshold??re))return f();try{let h=o.quality??5,g=`${r}:${h}:${a.length}:${Bun.hash(a)}`,l=H.get(g);if(!l)l=r==="br"?await K(a,{params:{[F.constants.BROTLI_PARAM_QUALITY]:h,[F.constants.BROTLI_PARAM_SIZE_HINT]:a.length}}):await ee(a),ie(g,l);if(l.length>=a.length)return f();let m=J(e.headers);return m.set("Content-Encoding",r),m.set("Content-Length",String(l.length)),new Response(l,{status:e.status,statusText:e.statusText,headers:m})}catch{return f()}}function J(t){let e=new Headers(t),o=e.get("Vary");if(!o)return e.set("Vary","Accept-Encoding"),e;if(!o.split(",").some((a)=>a.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${o}, Accept-Encoding`);return e}class G{now;entries=new B(1000,{maxBytes:33554432,sizeOf:(t)=>t.body.byteLength+JSON.stringify(t.headers).length*2});pending=new Map;generation=0;constructor(t=Date.now){this.now=t}invalidate(t){this.generation++,this.pending.clear();for(let e of Array.from(this.entries.keys()))if(t===void 0||this.entries.get(e)?.path===t)this.entries.delete(e)}async respond(t,e,o){let r,a=async()=>{let s=r??await o();return s.headers.set("Cache-Control","private, no-store"),s.headers.set("Vary",O(s.headers.get("Vary")).Vary),s};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return a();let f=new URL(t.url),h=`${f.origin}${f.pathname}${f.search}|${ke(t)?"fragment":"document"}`,g=this.entries.get(h),l=(s)=>{let b=new Headers(s.headers);return b.set("Cache-Control","private, no-store"),b.set("Age",String(Math.max(0,Math.floor((this.now()-s.created)/1000)))),new Response(s.body.slice(0),{headers:b})},m=g?(this.now()-g.created)/1000:1/0;if(g&&m<e.maxAge)return l(g);let v=this.generation,N=async()=>{let s=await o();r=s;let b=(s.headers.get("Vary")??"").toLowerCase().split(",").map((y)=>y.trim()).filter(Boolean);if(s.status!==200||s.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(s.headers.get("Cache-Control")??"")||b.some((y)=>y!=="x-stx-router"&&y!=="accept-encoding"))return null;let E=await s.clone().arrayBuffer();if(E.byteLength>1048576)return null;s.headers.set("Vary",O(s.headers.get("Vary")).Vary);let n={body:E,headers:Array.from(s.headers.entries()),created:this.now(),path:f.pathname};if(this.generation===v)this.entries.set(h,n);return n},x=this.pending.get(h);if(!x){if(this.pending.size>=1000)return a();x=N().finally(()=>{if(this.pending.get(h)===x)this.pending.delete(h)}),this.pending.set(h,x)}if(g&&m<e.maxAge+(e.swr??0))return x.catch(()=>{}),l(g);let M=await x;return M?l(M):a()}}var pe={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"};async function Pu(t={}){let e=T.resolve(t.outputDir||".output"),o=t.port??3000,r=Ii(e);if(!r)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${r.routes.length} routes...`);let a=En(r.routeRules),f=new G,h=Zs(e,r.apiRoutes??[]),g=Bun.file(T.join(e,"server/runtime-config.json")),l=t.runtimeConfig??(await g.exists()?await g.json():void 0),m=l?A(l):void 0,v=new Map,N=new Map,x=new Map,M=new Map;for(let n of r.routes)try{let y=T.join(e,n.compiledPath),i=JSON.parse(await Bun.file(y).text());if(m)i.html=Nt(i.html,m);v.set(n.pattern,i),x.set(n.pattern,Ye(i.html)),M.set(n.pattern,he(i.html));let X=T.join(e,n.fragmentPath);if(await Bun.file(X).exists()){let P=await Bun.file(X).text();N.set(n.pattern,m?Nt(P,m):P)}}catch(y){console.warn(`[stx] Failed to load route ${n.pattern}:`,y)}let s=new Map,b=[];for(let n of r.routes)if(n.hasParams){let{regex:y,params:i}=le(n.pattern,{page:!0});b.push({regex:y,route:n,paramNames:i})}else s.set(n.pattern,n);let E=ce({port:o,async fetch(n){return kn(n,await Be(m??A(),async()=>{let i=new URL(n.url).pathname;if(t.onRequest){let p=await t.onRequest(n);if(p)return p}if(t.apiRouter){let p=await t.apiRouter.handleRequest(n);if(p.status!==404)return p}if(t.apiRoutes?.[i])return t.apiRoutes[i](n);let X=await h(n);if(X)return X;if((n.method==="GET"||n.method==="HEAD")&&i!=="/"){let p=T.resolve(e,"public"),d;try{d=decodeURIComponent(i)}catch{d=i}if(!d.includes("\x00")){let u=T.resolve(p,`.${d}`);if(u===p||u.startsWith(`${p}${T.sep}`))try{if(Z.existsSync(u)&&Z.statSync(u).isFile()){let R=T.extname(u).toLowerCase(),L=pe[R]||"application/octet-stream",_=i.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(i);return new Response(Bun.file(u),{headers:{"Content-Type":L,"Cache-Control":_?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let P=ke(n),C=null,q={};if(C=s.get(i)||null,!C)for(let{regex:p,route:d,paramNames:u}of b){let c=i.match(p);if(c){C=d,u.forEach((R,L)=>{q[R]=c[L+1]});break}}if(!C){let p=vt(i)?null:s.get("/404")||null;if(p){let d=v.get(p.pattern);if(d)return new Response(d.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}})}let k=a(i),W=Object.keys(k).length>0;return f.respond(n,k.cache,async()=>{let p=v.get(C.pattern);if(P&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let c=N.get(C.pattern);if(c){let R=x.get(C.pattern);return new Response(c,{status:p.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...M.has(C.pattern)?{"X-STX-Runtime":M.get(C.pattern)?"true":"false"}:{},...R?{"X-STX-Layout":R.layout,"X-STX-Layout-Group":R.group}:{},...O(),...k.cache?{}:{"Cache-Control":ut}}})}}let d=Hs(n.method),u=v.get(C.pattern);if(!u){let c=s.get("/500")||null;if(c){let R=v.get(c.pattern);if(R)return new Response(R.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(C.prerendered&&d)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!d&&!u.hasServerScripts&&Object.keys(u.placeholders).length===0)return new Response(u.html,{status:u.status??200,headers:{"Content-Type":"text/html",...O(),"Cache-Control":"public, max-age=60"}});try{let{html:c,boundaries:R,redirect:L,cookies:_,status:I,headers:D}=await Cn(u,{params:q,request:n,method:n.method,__stx_strict_hydration:W,__stx_runtime_config:m});if(L)return Oi(L,_,D);if(R&&R.length>0){let{renderStreamingPage:S,streamToResponse:z}=await import("./chunk-855h3crg.js"),j=new Headers({...O(),...D,"Cache-Control":"private, no-store"});for(let V of _??[])j.append("Set-Cookie",V);if(P&&!d){let V=Ye(c);j.set("X-STX-Fragment","true"),j.set("X-STX-Runtime",he(c)?"true":"false"),j.set("X-STX-Layout",V.layout),j.set("X-STX-Layout-Group",V.group)}return z(S(P&&!d?_e(c,r.routerContainer||"main"):c,R,{timeoutMs:30000}),{status:I??u.status??200,headers:j})}let w=new Headers({"Content-Type":"text/html",...O(),...k.cache?{}:{"Cache-Control":"private, no-store"}});for(let S of _??[])w.append("Set-Cookie",S);for(let[S,z]of Object.entries(D??{}))w.set(S,z);if(w.set("Vary",O(w.get("Vary")).Vary),P&&!d){let S=Ye(c);return w.set("X-STX-Fragment","true"),w.set("X-STX-Runtime",he(c)?"true":"false"),w.set("X-STX-Layout",S.layout),w.set("X-STX-Layout-Group",S.group),new Response(_e(c,r.routerContainer||"main"),{status:I??u.status??200,headers:w})}return new Response(c,{status:I??u.status??200,headers:w})}catch(c){if(console.error(`[stx] Hydration error for ${i}:`,c),W)return new Response("Internal Server Error",{status:500});return new Response(u.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${E.port}`),console.log(`[stx] Serving ${r.routes.length} routes (${v.size} pre-loaded)`),{port:E.port,stop:()=>{f.invalidate(),E.stop()},invalidate:(n)=>f.invalidate(n)}}
|
|
3
|
+
export{kn,Pu};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{y}from"./chunk-kzb04293.js";function Xe(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=y(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 k(e,r){let n=e.lastIndexOf("<",r);if(n===-1)return!1;return n>e.lastIndexOf(">",r)}function yt(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=Xe(e,c);if(!o)return null;let i=o.endPos,u=yt(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(k(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=Xe(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 rn(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 Gr(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=y(e,"(",")",p);if(t===-1){i=o.exec(e);continue}let s=e.slice(p+1,t),f=t+1,l=yt(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 fo(e,r){let n=e.slice(r).match(/^@switch\s*/);if(!n)return null;let c=r+n[0].length,o=Xe(e,c);if(!o)return null;let i=o.endPos,u=yt(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=Xe(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{Xe,yt,rn,Gr,fo};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{existsSync as g,statSync as p}from"fs";import e from"path";var w=/[*?[\]{}]/;function
|
|
3
|
-
export{
|
|
2
|
+
import{existsSync as g,statSync as p}from"fs";import e from"path";var w=/[*?[\]{}]/;function Ol(o){return w.test(o)}async function ho(o,n={}){let i=n.cwd??process.cwd(),u=n.recursive!==!1,l=n.ignorePaths??[],c=globalThis.Bun.Glob,a=new Set,r=(t)=>{if(t.includes(`${e.sep}node_modules${e.sep}`)||t.includes(`${e.sep}dist${e.sep}`))return;if(l.some((s)=>s&&t.includes(e.normalize(s))))return;a.add(t)},d=async(t)=>{try{for await(let s of new c(t).scan({cwd:i,absolute:!0}))r(s)}catch{}};for(let t of o){if(!t)continue;if(Ol(t)){await d(t);continue}let s=e.resolve(i,t);if(!g(s))continue;if(p(s).isDirectory()){for await(let f of new c(u?"**/*.stx":"*.stx").scan({cwd:s,absolute:!0}))r(f);continue}r(s)}return[...a].sort()}
|
|
3
|
+
export{Ol,ho};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{l,p,ec,u,t,a}from"./chunk-bsajk82t.js";import{Ke,yt,tn,uo}from"./chunk-hgry3mjd.js";function L(w,e){try{let f=w.trim();if(p(f))return u(f,Object.keys(e))(...Object.values(e));else return l(f,e)}catch{return!1}}function Q(w,e,f){let n=w,v=!0;while(v){v=!1;let h=n.match(/@switch\s*\(/);if(!h||h.index===void 0)break;let b=h.index,s=uo(n,b);if(!s)break;try{let o;if(p(s.expression))o=u(s.expression,Object.keys(e))(...Object.values(e));else o=l(s.expression,e);let r="",g=!1;for(let i of s.cases)if(i.type==="default"){if(!g)r=i.content.trim()}else try{let y;if(i.value&&p(i.value))y=u(i.value,Object.keys(e))(...Object.values(e));else if(i.value)y=l(i.value,e);if(o===y){r=i.content.trim(),g=!0;break}}catch{continue}n=n.substring(0,b)+r+n.substring(s.end),v=!0}catch(o){let r=o instanceof Error?o.message:String(o),g=a("Switch",`Error evaluating @switch expression: ${r}`,t.EVALUATION_ERROR);n=n.substring(0,b)+g+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,(f,n)=>e[Number(n)]??f)}function ne(w,e,f){let{masked:n,scripts:v}=H(w);return J(K(n,e,f),v)}function K(w,e,f){let n=w;n=Q(n,e,f);{let h=!0;while(h){h=!1;let b=n.match(/@unless\s*\(/);if(!b||b.index===void 0)break;let s=b.index,o=Ke(n,s+7);if(!o)break;let r=o.endPos,g=yt(n,"unless","endunless",r);if(g===-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,g),y=o.expression,m=-1;{let x=0,k=/@(?:if|unless)\s*\(/g,d=/@(?: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=d.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){m=P.pos;break}}let c;if(m!==-1){let x=i.slice(0,m),k=i.slice(m+5);c=`@if (${y})${k}@else ${x}@endif`}else c=`@if (!(${y}))${i}@endif`;n=n.substring(0,s)+c+n.substring(g+10),h=!0}}n=so(n,e,f),n=oo(n,e,f),n=ro(n,e);let v=()=>{let h=tn(n);if(h.length===0)return!1;let b=Array(h.length);for(let r=h.length-1;r>=0;r--){let g=h[r];try{let i="",y=!1;for(let m of g.branches){if(y)break;if(m.type==="else")i=m.content,y=!0;else try{if(m.condition?ec(m.condition,e):!1)i=m.content,y=!0}catch(c){i=a(m.type==="if"?"If":"Elseif",`Error in @${m.type}(${m.condition}): ${c instanceof Error?c.message:String(c)}`,t.EVALUATION_ERROR),y=!0}}b[r]=i}catch(i){let y=i instanceof Error?i.message:String(i);b[r]=a("If",`Error processing @if block: ${y}`,t.EVALUATION_ERROR)}}let s=Array(h.length*2+1),o=0;for(let r=0;r<h.length;r++){let g=h[r];s[r*2]=n.slice(o,g.start),s[r*2+1]=b[r],o=g.end}return s[h.length*2]=n.slice(o),n=s.join(""),!0};while(!0){let h=n;if(!v())break;if(n===h)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 f=w[e];if(f!=="'"&&f!=='"')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===f){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 ro(w,e){let f=w;function n(s,o,r,g){let i=1,y=g,m=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),c=new RegExp(`@${r}(?![a-z])`,"g");while(y<s.length&&i>0){m.lastIndex=y,c.lastIndex=y;let x=m.exec(s),k=c.exec(s),d=x?x.index:1/0,E=k?k.index:1/0;if(d<E)i++,y=d+x[0].length;else if(E<1/0){if(i--,i===0)return E;y=E+k[0].length}else break}return-1}function v(s,o,r){let g=0,i=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),y=new RegExp(`@${r}(?![a-z])`,"g"),m=/@else(?![a-z])/g,c=[],x;while((x=i.exec(s))!==null)c.push({pos:x.index,type:"open"});while((x=y.exec(s))!==null)c.push({pos:x.index,type:"close"});while((x=m.exec(s))!==null)c.push({pos:x.index,type:"else"});c.sort((k,d)=>k.pos-d.pos);for(let k of c)if(k.type==="open")g++;else if(k.type==="close")g--;else if(k.type==="else"&&g===0)return k.pos;return-1}{let s=!0;while(s){s=!1;let o=f.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,g,i,y=f.slice(r+5),m=q(y);if(m)g=m.value,i=r+5+m.consumed;else i=r+5;let c=n(f,"auth","endauth",i);if(c===-1){console.warn(`[stx] @auth directive at position ${r} has no matching @endauth \u2014 the block was skipped.`);break}let x=f.slice(i,c),k=v(x,"auth","endauth"),d;if(!e.auth)d=!1;else d=g?L(`auth?.check && auth?.user?.[${g}]`,e):L("auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=d?S:C}else E=d?x:"";f=f.substring(0,r)+E+f.substring(c+8),s=!0}}{let s=!0;while(s){s=!1;let o=f.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,g,i,y=f.slice(r+6),m=q(y);if(m)g=m.value,i=r+6+m.consumed;else i=r+6;let c=n(f,"guest","endguest",i);if(c===-1){console.warn(`[stx] @guest directive at position ${r} has no matching @endguest \u2014 the block was skipped.`);break}let x=f.slice(i,c),k=v(x,"guest","endguest"),d;if(!e.auth)d=!0;else d=g?L(`!auth?.check || !auth?.user?.[${g}]`,e):L("!auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=d?S:C}else E=d?x:"";f=f.substring(0,r)+E+f.substring(c+9),s=!0}}function h(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 g=[s];if(o)g.push(o);if(r){let i=L(r,e);g.push(i)}return e.permissions.check(...g)}catch{return!1}return!1}function b(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",g=!0;while(g){g=!1;let i=f.match(new RegExp(`@${s}\\s*\\(`));if(!i||i.index===void 0)break;let y=i.index,m=f.slice(y+`@${s}`.length),c=b(m);if(!c)break;let x=y+`@${s}`.length+c.paramsEnd,k=n(f,s,o,x);if(k===-1){console.warn(`[stx] @${s} directive at position ${y} has no matching @${o} \u2014 the block was skipped.`);break}let d=f.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(d))!==null)_.push({pos:M.index,type:"open"});while((M=P.exec(d))!==null)_.push({pos:M.index,type:"close"});while((M=R.exec(d))!==null)_.push({pos:M.index,type:"elseDirective"});while((M=T.exec(d))!==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:d.slice(F,z.pos),ability:void 0}),z.type==="elseDirective"){let D=d.slice(z.pos+`@${r}`.length),B=b(D);if(B){I[I.length-1]={content:d.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:d.length;I.push({content:d.slice(F,U),ability:B.ability,type:B.type,id:B.id}),F=U}}else F=z.pos+5}if(F<d.length){let A=I[I.length-1];if(E.length>0&&E[E.length-1].type==="else")I.push({content:d.slice(F),isFinalElse:!0});else if(I.length===0)I.push({content:d.slice(F)})}let O=h(c.ability,c.type,c.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=h(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}}f=f.substring(0,y)+V+f.substring(k+`@${o}`.length),g=!0}}return f}function so(w,e,f){let n=w;function v(h,b,s,o,r){let g=!0;while(g){g=!1;let i=new RegExp(`@${b}\\s*\\(`),y=h.match(i);if(!y||y.index===void 0)break;let m=y.index,c=Ke(h,m+`@${b}`.length);if(!c)break;let x=c.endPos,k=yt(h,b,s,x);if(k===-1){console.warn(`[stx] @${b} directive at position ${m} has no matching @${s} \u2014 the block was skipped.`);break}let d=h.slice(x,k),E=c.expression,S=-1,C=0,P=0;while(P<d.length){let R=d.indexOf("@",P);if(R===-1)break;let T=d.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 _=d.slice(0,S),M=d.slice(S+5);T=R?_:M}else T=R?d:"";h=h.substring(0,m)+T+h.substring(k+`@${s}`.length),g=!0}catch(R){let T=R instanceof Error?R.message:String(R),_=a(r,`Error processing @${b} directive: ${T}`,t.EVALUATION_ERROR);h=h.substring(0,m)+_+h.substring(k+`@${s}`.length);break}}return h}return n=v(n,"isset","endisset",(h)=>{let b=L(h,e);return b!==void 0&&b!==null},"Isset"),n=v(n,"empty","endempty",(h)=>{let b=L(h,e);return b===void 0||b===null||b===""||b===0||b===!1||Array.isArray(b)&&b.length===0||typeof b==="object"&&b!==null&&Object.keys(b).length===0},"Empty"),n}function oo(w,e,f){let n=w,v="development";function h(b,s,o,r){let g=new RegExp(`@${s}(?![a-z])`,"g"),i=new RegExp(`@${o}(?![a-z])`,"g"),y=new RegExp(`^@${s}(?![a-z])`),m=new RegExp(`^@${o}(?![a-z])`),c=b,x=!0;while(x){x=!1,g.lastIndex=0;let k=g.exec(c);if(!k)break;let d=k.index,E=d+k[0].length;if(s==="env"){let O=c.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<c.length){g.lastIndex=C,i.lastIndex=C;let O=g.exec(c),j=i.exec(c),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 ${d} has no matching @${o} \u2014 the block was skipped.`);break}let R=c.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(y.test(j)){_++,M=O+1;continue}if(m.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;c=c.substring(0,d)+I+c.substring(P+F),x=!0}return c}return n=h(n,"env","endenv",!1),n=h(n,"production","endproduction",v==="production"),n=h(n,"development","enddevelopment",v==="development"),n=h(n,"staging","endstaging",v==="staging"),n=h(n,"testing","endtesting",v==="testing"),n}
|
|
3
|
-
export{ne,
|
|
2
|
+
import{l,p,tc,u,t,a}from"./chunk-kzb04293.js";import{Xe,yt,rn,fo}from"./chunk-dba795e1.js";function L(w,e){try{let f=w.trim();if(p(f))return u(f,Object.keys(e))(...Object.values(e));else return l(f,e)}catch{return!1}}function Q(w,e,f){let n=w,v=!0;while(v){v=!1;let h=n.match(/@switch\s*\(/);if(!h||h.index===void 0)break;let b=h.index,s=fo(n,b);if(!s)break;try{let o;if(p(s.expression))o=u(s.expression,Object.keys(e))(...Object.values(e));else o=l(s.expression,e);let r="",g=!1;for(let i of s.cases)if(i.type==="default"){if(!g)r=i.content.trim()}else try{let y;if(i.value&&p(i.value))y=u(i.value,Object.keys(e))(...Object.values(e));else if(i.value)y=l(i.value,e);if(o===y){r=i.content.trim(),g=!0;break}}catch{continue}n=n.substring(0,b)+r+n.substring(s.end),v=!0}catch(o){let r=o instanceof Error?o.message:String(o),g=a("Switch",`Error evaluating @switch expression: ${r}`,t.EVALUATION_ERROR);n=n.substring(0,b)+g+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,(f,n)=>e[Number(n)]??f)}function ne(w,e,f){let{masked:n,scripts:v}=H(w);return J(K(n,e,f),v)}function K(w,e,f){let n=w;n=Q(n,e,f);{let h=!0;while(h){h=!1;let b=n.match(/@unless\s*\(/);if(!b||b.index===void 0)break;let s=b.index,o=Xe(n,s+7);if(!o)break;let r=o.endPos,g=yt(n,"unless","endunless",r);if(g===-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,g),y=o.expression,m=-1;{let x=0,k=/@(?:if|unless)\s*\(/g,d=/@(?: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=d.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){m=P.pos;break}}let c;if(m!==-1){let x=i.slice(0,m),k=i.slice(m+5);c=`@if (${y})${k}@else ${x}@endif`}else c=`@if (!(${y}))${i}@endif`;n=n.substring(0,s)+c+n.substring(g+10),h=!0}}n=io(n,e,f),n=ao(n,e,f),n=oo(n,e);let v=()=>{let h=rn(n);if(h.length===0)return!1;let b=Array(h.length);for(let r=h.length-1;r>=0;r--){let g=h[r];try{let i="",y=!1;for(let m of g.branches){if(y)break;if(m.type==="else")i=m.content,y=!0;else try{if(m.condition?tc(m.condition,e):!1)i=m.content,y=!0}catch(c){i=a(m.type==="if"?"If":"Elseif",`Error in @${m.type}(${m.condition}): ${c instanceof Error?c.message:String(c)}`,t.EVALUATION_ERROR),y=!0}}b[r]=i}catch(i){let y=i instanceof Error?i.message:String(i);b[r]=a("If",`Error processing @if block: ${y}`,t.EVALUATION_ERROR)}}let s=Array(h.length*2+1),o=0;for(let r=0;r<h.length;r++){let g=h[r];s[r*2]=n.slice(o,g.start),s[r*2+1]=b[r],o=g.end}return s[h.length*2]=n.slice(o),n=s.join(""),!0};while(!0){let h=n;if(!v())break;if(n===h)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 f=w[e];if(f!=="'"&&f!=='"')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===f){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 oo(w,e){let f=w;function n(s,o,r,g){let i=1,y=g,m=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),c=new RegExp(`@${r}(?![a-z])`,"g");while(y<s.length&&i>0){m.lastIndex=y,c.lastIndex=y;let x=m.exec(s),k=c.exec(s),d=x?x.index:1/0,E=k?k.index:1/0;if(d<E)i++,y=d+x[0].length;else if(E<1/0){if(i--,i===0)return E;y=E+k[0].length}else break}return-1}function v(s,o,r){let g=0,i=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),y=new RegExp(`@${r}(?![a-z])`,"g"),m=/@else(?![a-z])/g,c=[],x;while((x=i.exec(s))!==null)c.push({pos:x.index,type:"open"});while((x=y.exec(s))!==null)c.push({pos:x.index,type:"close"});while((x=m.exec(s))!==null)c.push({pos:x.index,type:"else"});c.sort((k,d)=>k.pos-d.pos);for(let k of c)if(k.type==="open")g++;else if(k.type==="close")g--;else if(k.type==="else"&&g===0)return k.pos;return-1}{let s=!0;while(s){s=!1;let o=f.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,g,i,y=f.slice(r+5),m=q(y);if(m)g=m.value,i=r+5+m.consumed;else i=r+5;let c=n(f,"auth","endauth",i);if(c===-1){console.warn(`[stx] @auth directive at position ${r} has no matching @endauth \u2014 the block was skipped.`);break}let x=f.slice(i,c),k=v(x,"auth","endauth"),d;if(!e.auth)d=!1;else d=g?L(`auth?.check && auth?.user?.[${g}]`,e):L("auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=d?S:C}else E=d?x:"";f=f.substring(0,r)+E+f.substring(c+8),s=!0}}{let s=!0;while(s){s=!1;let o=f.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,g,i,y=f.slice(r+6),m=q(y);if(m)g=m.value,i=r+6+m.consumed;else i=r+6;let c=n(f,"guest","endguest",i);if(c===-1){console.warn(`[stx] @guest directive at position ${r} has no matching @endguest \u2014 the block was skipped.`);break}let x=f.slice(i,c),k=v(x,"guest","endguest"),d;if(!e.auth)d=!0;else d=g?L(`!auth?.check || !auth?.user?.[${g}]`,e):L("!auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=d?S:C}else E=d?x:"";f=f.substring(0,r)+E+f.substring(c+9),s=!0}}function h(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 g=[s];if(o)g.push(o);if(r){let i=L(r,e);g.push(i)}return e.permissions.check(...g)}catch{return!1}return!1}function b(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",g=!0;while(g){g=!1;let i=f.match(new RegExp(`@${s}\\s*\\(`));if(!i||i.index===void 0)break;let y=i.index,m=f.slice(y+`@${s}`.length),c=b(m);if(!c)break;let x=y+`@${s}`.length+c.paramsEnd,k=n(f,s,o,x);if(k===-1){console.warn(`[stx] @${s} directive at position ${y} has no matching @${o} \u2014 the block was skipped.`);break}let d=f.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(d))!==null)_.push({pos:M.index,type:"open"});while((M=P.exec(d))!==null)_.push({pos:M.index,type:"close"});while((M=R.exec(d))!==null)_.push({pos:M.index,type:"elseDirective"});while((M=T.exec(d))!==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:d.slice(F,z.pos),ability:void 0}),z.type==="elseDirective"){let D=d.slice(z.pos+`@${r}`.length),B=b(D);if(B){I[I.length-1]={content:d.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:d.length;I.push({content:d.slice(F,U),ability:B.ability,type:B.type,id:B.id}),F=U}}else F=z.pos+5}if(F<d.length){let A=I[I.length-1];if(E.length>0&&E[E.length-1].type==="else")I.push({content:d.slice(F),isFinalElse:!0});else if(I.length===0)I.push({content:d.slice(F)})}let O=h(c.ability,c.type,c.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=h(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}}f=f.substring(0,y)+V+f.substring(k+`@${o}`.length),g=!0}}return f}function io(w,e,f){let n=w;function v(h,b,s,o,r){let g=!0;while(g){g=!1;let i=new RegExp(`@${b}\\s*\\(`),y=h.match(i);if(!y||y.index===void 0)break;let m=y.index,c=Xe(h,m+`@${b}`.length);if(!c)break;let x=c.endPos,k=yt(h,b,s,x);if(k===-1){console.warn(`[stx] @${b} directive at position ${m} has no matching @${s} \u2014 the block was skipped.`);break}let d=h.slice(x,k),E=c.expression,S=-1,C=0,P=0;while(P<d.length){let R=d.indexOf("@",P);if(R===-1)break;let T=d.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 _=d.slice(0,S),M=d.slice(S+5);T=R?_:M}else T=R?d:"";h=h.substring(0,m)+T+h.substring(k+`@${s}`.length),g=!0}catch(R){let T=R instanceof Error?R.message:String(R),_=a(r,`Error processing @${b} directive: ${T}`,t.EVALUATION_ERROR);h=h.substring(0,m)+_+h.substring(k+`@${s}`.length);break}}return h}return n=v(n,"isset","endisset",(h)=>{let b=L(h,e);return b!==void 0&&b!==null},"Isset"),n=v(n,"empty","endempty",(h)=>{let b=L(h,e);return b===void 0||b===null||b===""||b===0||b===!1||Array.isArray(b)&&b.length===0||typeof b==="object"&&b!==null&&Object.keys(b).length===0},"Empty"),n}function ao(w,e,f){let n=w,v="development";function h(b,s,o,r){let g=new RegExp(`@${s}(?![a-z])`,"g"),i=new RegExp(`@${o}(?![a-z])`,"g"),y=new RegExp(`^@${s}(?![a-z])`),m=new RegExp(`^@${o}(?![a-z])`),c=b,x=!0;while(x){x=!1,g.lastIndex=0;let k=g.exec(c);if(!k)break;let d=k.index,E=d+k[0].length;if(s==="env"){let O=c.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<c.length){g.lastIndex=C,i.lastIndex=C;let O=g.exec(c),j=i.exec(c),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 ${d} has no matching @${o} \u2014 the block was skipped.`);break}let R=c.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(y.test(j)){_++,M=O+1;continue}if(m.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;c=c.substring(0,d)+I+c.substring(P+F),x=!0}return c}return n=h(n,"env","endenv",!1),n=h(n,"production","endproduction",v==="production"),n=h(n,"development","enddevelopment",v==="development"),n=h(n,"staging","endstaging",v==="staging"),n=h(n,"testing","endtesting",v==="testing"),n}
|
|
3
|
+
export{ne,oo,io,ao};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ze}from"./chunk-f26n6y9p.js";import{ft,Dn}from"./chunk-j6x7ryyn.js";import{Oe,un,Ya,Za}from"./chunk-3vwkyjan.js";import{mr,hr,yr,vr,Se}from"./chunk-kzb04293.js";import{A}from"./chunk-9wdd7eq6.js";import{zo}from"./chunk-0thxpgtp.js";import{h}from"./chunk-6ncvb8gp.js";import{o}from"./chunk-9azagdq6.js";import{N,i}from"./chunk-6qh2mx6q.js";import{Sa}from"./chunk-q3gactm1.js";import{Ve,_e,Ai,Pi,Cn}from"./chunk-gc4w2s5n.js";import{en,Ys}from"./chunk-54fazdmn.js";import{En}from"./chunk-wav0xbnb.js";import{Gt,Fn,zn}from"./chunk-bpf3xxng.js";import{W}from"./chunk-4e5jrxbn.js";import m from"fs";import c from"path";import{createHash as Q}from"crypto";function J(n){return Q("sha256").update(n).digest("hex").slice(0,8)}function U(n=!1){let l=n?Dn():ft(),a=J(l);return{content:l,filename:`runtime.${a}.js`,hash:a}}function V(){let n=Ze(),l=J(n);return{content:n,filename:`router.${l}.js`,hash:l}}import q from"path";import{createHash as ee}from"crypto";function te(n={}){let l=new Set;return{context:new Proxy(n,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function X(n,l,a={}){let r=q.resolve(n),e=await Bun.file(r).text(),S=ee("sha256").update(e).digest("hex").slice(0,16);Ya();let _={};try{_=await i(a.configDir)}catch{}let y=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,f;while((f=d.exec(e))!==null){let R=f[1];if(/\bserver\b/.test(R))y.push(f[2])}let u=new Set(y.flatMap((R)=>Oe(R))),{context:D}=te({__filename:r,__dirname:q.dirname(r),__stx_serverDeclared:u}),w=new Set,j={...N,..._,...a,buildMode:"compile",strict:!1},b=await o(e,D,r,j,w),C=Ve(b),P=Za();return{route:l,sourceFile:n,html:b,fragment:C,placeholders:P,hasServerScripts:y.length>0,serverScriptContent:y,dependencies:Array.from(w),contentHash:S,status:un(e),streamTemplates:D.__streamTemplates}}var re=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function Z(n,l){let a=0,r=0;if(!m.existsSync(n))return{copied:a,bytes:r};m.mkdirSync(l,{recursive:!0});function e(S,_){let y=m.readdirSync(S,{withFileTypes:!0});for(let d of y){if(re.has(d.name))continue;let f=c.join(S,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(f,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(f,u),a++,r+=m.statSync(u).size}}}return e(n,l),{copied:a,bytes:r}}async function Bu(n={}){let l=Date.now(),a=c.resolve(n.root||process.cwd()),r=c.resolve(a,n.outputDir||".output");console.log("[stx build] Starting production build...");let e=await i(a),S=c.resolve(a,n.componentsDir??e.componentsDir??"components"),_=c.resolve(a,n.partialsDir??e.partialsDir??"partials"),y=c.resolve(a,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",f=Se(e.app?.head,{known:vr,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",w=n.routeRules??e.routeRules??{},j=En(w),b=n.serverApi??e.serverApi,C=typeof b==="object"?b:{};if(b)en(a,C);if(e.runtimeConfig)A(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let P=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of P)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=W(a,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],B=R.filter((s)=>!Y.some((g)=>s.pattern.startsWith(`/${g}/`)||s.pattern===`/${g}`));console.log(`[stx build] Found ${B.length} page routes (${R.length-B.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=U(n.debug),x=V();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",x.filename),x.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${x.filename} (${(x.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let M=[],k=[];for(let s of B){let g=j(s.pattern),O=g.rendering==="prerender";if(O&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await X(s.filePath,s.pattern,{configDir:a,componentsDir:S,partialsDir:_,layoutsDir:y,debug:n.debug});if(M.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,x.filename),t.html=yr(t.html,f,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=mr(t.html,u);if(f.htmlAttrs)t.html=hr(t.html,f.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let I=p[1];t.html=t.html.replace(" "+I,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${I}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await h(t.html),O){let p=await Cn(t,{params:{},request:new Request(`http://stx.build${s.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${s.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=_e(t.html,D);let L=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),z=c.join("server","pages",`${L}.compiled.json`),G=c.join("server","fragments",`${L}.html`);await Bun.write(c.join(r,z),JSON.stringify(t,null,2)),await Bun.write(c.join(r,G),t.fragment),k.push({pattern:s.pattern,compiledPath:z,fragmentPath:G,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:O}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(g).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let E=c.resolve(a,d);if(m.existsSync(E)){let{copied:s,bytes:g}=Z(E,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(g/1024).toFixed(1)}KB) from ${d}/`)}let H=zn(a);if(H){let{copied:s,bytes:g}=Z(H,c.join(r,"public",Fn));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(g/1024).toFixed(1)}KB) from ${Gt}/`)}let F={runtime:v.filename,router:x.filename},T=Ai(k,F,r);if(T.routeRules=w,T.routerContainer=D,b)T.apiRoutes=await Ys(a,r,C);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await zo(a,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(Sa(e._layerGraph),null,2));Pi(T,r);let K=Date.now()-l;return console.log(`
|
|
3
|
+
[stx build] Done in ${K}ms \u2014 ${M.length} pages compiled`),{pageCount:M.length,assets:F,outputDir:r,duration:K}}
|
|
4
|
+
export{Bu};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import x from"fs";import u from"path";import p from"fs";import w from"path";var y=["components","layouts","partials","emails"];function P(e){return e.split(/[\\/]/).filter(Boolean).slice(0,-1).some((a)=>y.includes(a))}function b(e){return P(e.replace(/^\//,""))}function
|
|
3
|
-
`),o=w.join(t,"route-types.d.ts");try{if(p.existsSync(o)&&p.readFileSync(o,"utf8")===n)return;p.mkdirSync(t,{recursive:!0}),p.writeFileSync(o,n)}catch{}}function
|
|
4
|
-
`))}import I from"path";var N=Object.freeze(["ico","png","jpg","jpeg","gif","webp","avif","svg","bmp","tif","tiff","heic","css","js","mjs","cjs","map","wasm","webmanifest","json","xml","txt","rss","atom","woff","woff2","ttf","otf","eot","mp3","mp4","m4a","m4v","mov","webm","ogg","ogv","oga","wav","flac","avi","mkv","pdf","csv","doc","docx","xls","xlsx","ppt","pptx","rtf","odt","zip","gz","tgz","tar","rar","7z","bz2","xz","php","phtml","asp","aspx","jsp","cgi","env","ini","yml","yaml","toml","sql","bak","old","swp","log","conf","cfg","exe","dmg","pkg","apk","ipa","msi","iso","bin","dll"]),D=N.flatMap((e)=>e===e.toUpperCase()?[e]:[e,e.toUpperCase()]).join("|"),G=new RegExp(`\\.(?:${D})$`),E=`(?![^/]*\\.(?:${D})$)`;function vt(e){let t=e,a=t.search(/[?#]/);if(a!==-1)t=t.slice(0,a);let r=t.slice(t.lastIndexOf("/")+1);return r.length>0&&G.test(r)}function R(e,t){let r=I.relative(t,e).replace(/\.(stx|md)$/,"");if(r=r.split(I.sep).join("/"),r==="index")return"/";if(r.endsWith("/index"))r=r.slice(0,-6);return r=r.replace(/\[\[([^\]]+)\]\]/g,":$1?"),r=r.replace(/\[([^\]]+)\]/g,":$1"),r=r.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${r}`}function ce(e,t={}){let a=t.page?E:"",r=[],n="",o=0;while(o<e.length){let i=e.slice(o),c=/^\/:([^/?*]+)\?/.exec(i);if(c){r.push(c[1]);let d=o+c[0].length===e.length;n+=`(?:/${d?a:""}([^/]+))?`,o+=c[0].length;continue}let s=/^:([^/?*]+)\*/.exec(i);if(s){r.push(s[1]),n+="(.+)",o+=s[0].length;continue}let l=/^:([^/?*]+)/.exec(i);if(l){r.push(l[1]);let d=o+l[0].length===e.length;n+=`${d?a:""}([^/]+)`,o+=l[0].length;continue}n+=e[o].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),o+=1}return{regex:new RegExp(`^${n}$`),params:r}}function Qn(e,t){let a=e===""?"/":e;for(let r of t){let n=a.match(r.regex);if(n){let o={};return r.params.forEach((i,c)=>{o[i]=n[c+1]}),{route:r,params:o}}}return null}function Qr(e,t={}){let a=e.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return ce(a,t)}import j from"fs";import L from"path";function _(e,t){let a=[],r=L.dirname(e);while(r.startsWith(t)||r===t){let n=L.join(r,"_layout.stx");if(j.existsSync(n))a.unshift(n);if(r===t)break;r=L.dirname(r)}return a}function F(e,t){let a=[];if(!x.existsSync(e))return a;let r=x.readdirSync(e,{withFileTypes:!0});for(let n of r){let o=u.join(e,n.name);if(n.isDirectory()){if(n.name.startsWith("."))continue;if(y.includes(n.name))continue;a.push(...F(o,t))}else if(n.isFile()){let i=u.extname(n.name);if(t.includes(i)){if(n.name.startsWith("_")&&n.name!=="_layout.stx")continue;if(n.name==="_layout.stx")continue;a.push(o)}}}return a}class er{routes;pagesDir;pagesDirs;config;constructor(e,t={}){this.config=t;let a=t.pagesDirs&&t.pagesDirs.length>0?t.pagesDirs:[t.pagesDir||"pages"];this.pagesDirs=a.map((s)=>u.resolve(e,s)),this.pagesDir=this.pagesDirs[0];let r=t.extensions||[".stx"],n=(s)=>{let l=u.resolve(e,s);try{return x.realpathSync(l)}catch{return l}},o=(t.exclude??[]).filter((s)=>typeof s==="string"&&s.trim()!=="").map(n),i=(s)=>{if(o.length===0)return!1;let l=n(s);return o.some((d)=>l===d||l.startsWith(`${d}${u.sep}`))},c=new Set;this.routes=[];for(let s of this.pagesDirs){let l=F(s,r).filter((h)=>!i(h)),d=new Map;for(let h of l){let g=R(h,s),m=t.pagesDirs?g.replace(/:[\w]+/g,":param"):g;if(t.pagesDirs&&d.has(m))throw Error(`Conflicting layer pages for ${g}: ${d.get(m)} and ${h}`);if(d.set(m,h),c.has(m))continue;c.add(m);let{regex:H,params:M}=ce(g,{page:!0}),C=t.layouts!==!1?_(h,s):[];this.routes.push({pattern:g,regex:H,params:M,filePath:h,isDynamic:M.length>0,layout:C.length>0?C[C.length-1]:void 0})}}if(this.routes.sort((s,l)=>{if(!s.isDynamic&&l.isDynamic)return-1;if(s.isDynamic&&!l.isDynamic)return 1;let d=s.pattern.split("/").length,h=l.pattern.split("/").length;if(d!==h)return h-d;return s.pattern.localeCompare(l.pattern)}),t.emit!==!1){let s=u.resolve(e,t.stateDir||process.env.STX_DIR?.trim()||".stx");wo(this.routes,s),xo(this.routes,s,this.pagesDir)}}match(e){let t=e===""?"/":e;for(let a of this.routes){let r=t.match(a.regex);if(r){let n={};return a.params.forEach((o,i)=>{n[o]=r[i+1]}),{route:a,params:n}}}return null}resolve(e,t){let a=this.routes.find((n)=>n.pattern===e||n.filePath.includes(e));if(!a)return"#not-found";let r=a.pattern;if(t)for(let[n,o]of Object.entries(t))r=r.replace(`:${n}`,encodeURIComponent(o));return r}addRoute(e){this.routes.push(e),this.routes.sort((t,a)=>{if(!t.isDynamic&&a.isDynamic)return-1;if(t.isDynamic&&!a.isDynamic)return 1;return t.pattern.localeCompare(a.pattern)})}getLayout(e){return e.layout??null}}function es(e,t){let a=[`${t}.stx`,"error.stx"];for(let r of a){let n=u.join(e,r);if(x.existsSync(n))return n}return null}function ts(e,t){return e.map((a)=>{let r=u.relative(t,a.filePath),n=a.isDynamic?" (dynamic)":"";return`${a.pattern} \u2192 ${r}${n}`})}var f={},k="";function Il(e){k=e.replace(/\/$/,"")}function Ol(e,t,a={}){f[e]={path:t,name:e,params:a}}function Nl(e){for(let[t,a]of Object.entries(e))if(typeof a==="string")f[t]={path:a,name:t};else f[t]={...a,name:t}}function tr(e,t={},a=!1){let r=f[e];if(!r)return console.warn(`Route [${e}] not defined.`),"#undefined-route";let n={...r.params,...t},o=r.path;o=o.replace(/:(\w+)/g,(c,s)=>{let l=n[s];if(l===void 0)return console.warn(`Missing parameter [${s}] for route [${e}].`),`:${s}`;return delete n[s],encodeURIComponent(String(l))});let i=Object.entries(n);if(i.length>0){let c=i.map(([s,l])=>`${encodeURIComponent(s)}=${encodeURIComponent(String(l))}`).join("&");o+=(o.includes("?")?"&":"?")+c}return a&&k?`${k}${o}`:o}function Dl(){for(let e of Object.keys(f))delete f[e];k=""}import B from"fs";import U from"path";function Ml(e,t={}){return{type:"redirect",path:e,options:{replace:t.replace??!1,external:t.external??!1,redirectCode:t.redirectCode??302}}}function Ll(e){return{type:"abort",error:typeof e==="string"?{statusCode:500,message:e}:e}}function jl(e,t={}){return{handler:e,mode:t.mode??"universal"}}function O(e){let t={};if(!e)return t;let a=e.split(";");for(let r of a){let[n,...o]=r.split("=");if(n){let i=n.trim(),c=o.join("=").trim();if(i)t[i]=decodeURIComponent(c)}}return t}function S(e,t,a={}){let r=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(a.expires){let n=typeof a.expires==="number"?new Date(Date.now()+a.expires*1000):a.expires;r+=`; Expires=${n.toUTCString()}`}if(a.path)r+=`; Path=${a.path}`;if(a.domain)r+=`; Domain=${a.domain}`;if(a.secure)r+="; Secure";if(a.httpOnly)r+="; HttpOnly";if(a.sameSite)r+=`; SameSite=${a.sameSite}`;return r}function Sa(e,t){let a=e.headers.get("cookie")||"",r=O(a);return{get(n){return r[n]},set(n,o,i={}){r[n]=o,t.append("Set-Cookie",S(n,o,i))},delete(n){delete r[n],t.append("Set-Cookie",S(n,"",{expires:new Date(0),path:"/"}))},getAll(){return{...r}}}}function ka(){return{get(e){if(typeof document>"u")return;return O(document.cookie)[e]},set(e,t,a={}){if(typeof document>"u")return;document.cookie=S(e,t,a)},delete(e){if(typeof document>"u")return;document.cookie=S(e,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return O(document.cookie)}}}function _a(){let e=typeof window<"u"&&typeof window.localStorage<"u";return{get(t){if(!e)return null;try{return window.localStorage.getItem(t)}catch{return null}},set(t,a){if(!e)return;try{window.localStorage.setItem(t,a)}catch{}},remove(t){if(!e)return;try{window.localStorage.removeItem(t)}catch{}},isAvailable(){return e}}}var v=new Map;function So(e,t){v.set(e,t)}function Ca(e){return v.get(e)}function Bl(e){return v.has(e)}function wt(){v.clear()}function xt(){return Array.from(v.keys())}async function St(e,t="middleware"){let a=U.resolve(e,t);if(!B.existsSync(a))return;let r=B.readdirSync(a);for(let n of r){if(!n.endsWith(".ts")&&!n.endsWith(".js"))continue;if(n.includes(".test.")||n.includes(".spec."))continue;let o=n.replace(/\.(ts|js)$/,""),i=U.join(a,n);try{let s=(await import(i)).default;if(s&&typeof s.handler==="function")So(o,s);else if(typeof s==="function")So(o,{handler:s,mode:"universal"})}catch(c){console.warn(`Failed to load middleware '${o}' from ${i}:`,c)}}}function K(e){let t={};if(!e)return t;let a=new URLSearchParams(e);for(let[r,n]of a)t[r]=n;return t}function kt(e,t,a,r=""){return{path:e,params:t,query:K(r),fullPath:r?`${e}?${r}`:e,meta:a}}function _t(e,t,a,r){let n=r?.isServer??typeof window>"u",o=!n,i=new Headers;return{to:e,from:t,isClient:o,isServer:n,cookies:n&&a?Sa(a,i):ka(),storage:_a(),state:{},request:a,responseHeaders:i}}async function Ct(e,t){let a=Array.isArray(e)?e:[e],r=t.isServer;for(let n of a){let o=Ca(n);if(!o)return console.error(`Route middleware '${n}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${n}' is not registered`}},state:t.state,responseHeaders:t.responseHeaders};if(o.mode==="server"&&!r)continue;try{let i=await o.handler(t);if(i){if(i.type==="redirect")return{passed:!1,redirect:i,state:t.state,responseHeaders:t.responseHeaders};if(i.type==="abort")return{passed:!1,abort:i,state:t.state,responseHeaders:t.responseHeaders}}}catch(i){return console.error(`Error in middleware '${n}':`,i),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:i instanceof Error?i.message:"Middleware error"}},state:t.state,responseHeaders:t.responseHeaders}}}return{passed:!0,state:t.state,responseHeaders:t.responseHeaders}}function ns(e){let a=e.replace(/\\/g,"/").split("/").filter(Boolean),r=a.lastIndexOf("layouts"),n=r>=0?a[r+1]:a.at(-1);if(!n)return"app";return n.replace(/\.stx$/i,"")||"app"}function Je(e){let t=e.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),a=e.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),r=e.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),n=t?.[1]||r?.[1]||"";return{layout:n,group:a?.[1]||ns(n)}}var A,T;function W(e){let t=[],a="log(",r=0;while(r<e.length){let n=e.indexOf("log(",r);if(n===-1){t.push(e.slice(r));break}let o=n>0?e[n-1]:" ",i=/\bfunction\s+$/.test(e.slice(Math.max(0,n-16),n));if(/[\w$.]/.test(o)||i){t.push(e.slice(r,n+4)),r=n+4;continue}t.push(e.slice(r,n));let c=1,s=n+4;while(s<e.length&&c>0){let l=e[s];if(l==='"'||l==="'"||l==="`"){let d=l;s++;while(s<e.length&&e[s]!==d){if(e[s]==="\\")s++;s++}s++;continue}if(l==="(")c++;else if(l===")")c--;s++}t.push("0"),r=s}return t.join("")}function q(e,t=!1){try{return new Bun.Transpiler(t?{loader:"js",minify:{whitespace:!0,identifiers:!0}}:{loader:"js",minifyWhitespace:!0}).transformSync(e).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return e}}function X(){return`
|
|
2
|
+
import x from"fs";import u from"path";import p from"fs";import w from"path";var y=["components","layouts","partials","emails"];function P(e){return e.split(/[\\/]/).filter(Boolean).slice(0,-1).some((a)=>y.includes(a))}function b(e){return P(e.replace(/^\//,""))}function So(e,t){let a=e.filter((i)=>!b(i.pattern)),r=["// Auto-generated by STX - do not edit"];if(a.length===0)r.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{r.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let i of a){let c=[];for(let l of i.params){let d=i.pattern.includes(`:${l}?`)?"?":"";c.push(`${l}${d}: string`)}let s=c.join("; ");r.push(` '${i.pattern}': { ${s} }`)}r.push(" }","}","","export {}","")}let n=r.join(`
|
|
3
|
+
`),o=w.join(t,"route-types.d.ts");try{if(p.existsSync(o)&&p.readFileSync(o,"utf8")===n)return;p.mkdirSync(t,{recursive:!0}),p.writeFileSync(o,n)}catch{}}function ko(e,t,a){let r=process.cwd(),n=w.relative(r,a),o=e.filter((c)=>!b(c.pattern)),i=["// Auto-generated by stx \u2014 do not edit",`// Source: ${n||"pages"}/`,"","export const routes = ["];for(let c of o){let s=w.relative(r,c.filePath).replace(/\\/g,"/"),l=JSON.stringify(c.params),d=c.layout?`, layout: '${w.relative(r,c.layout).replace(/\\/g,"/")}'`:"";i.push(` { pattern: '${c.pattern}', filePath: '${s}', isDynamic: ${c.isDynamic}, params: ${l}${d} },`)}i.push("] as const",""),i.push("export type RouteName = typeof routes[number]['pattern']",""),p.mkdirSync(t,{recursive:!0}),p.writeFileSync(w.join(t,"routes.ts"),i.join(`
|
|
4
|
+
`))}import I from"path";var N=Object.freeze(["ico","png","jpg","jpeg","gif","webp","avif","svg","bmp","tif","tiff","heic","css","js","mjs","cjs","map","wasm","webmanifest","json","xml","txt","rss","atom","woff","woff2","ttf","otf","eot","mp3","mp4","m4a","m4v","mov","webm","ogg","ogv","oga","wav","flac","avi","mkv","pdf","csv","doc","docx","xls","xlsx","ppt","pptx","rtf","odt","zip","gz","tgz","tar","rar","7z","bz2","xz","php","phtml","asp","aspx","jsp","cgi","env","ini","yml","yaml","toml","sql","bak","old","swp","log","conf","cfg","exe","dmg","pkg","apk","ipa","msi","iso","bin","dll"]),D=N.flatMap((e)=>e===e.toUpperCase()?[e]:[e,e.toUpperCase()]).join("|"),G=new RegExp(`\\.(?:${D})$`),E=`(?![^/]*\\.(?:${D})$)`;function vt(e){let t=e,a=t.search(/[?#]/);if(a!==-1)t=t.slice(0,a);let r=t.slice(t.lastIndexOf("/")+1);return r.length>0&&G.test(r)}function R(e,t){let r=I.relative(t,e).replace(/\.(stx|md)$/,"");if(r=r.split(I.sep).join("/"),r==="index")return"/";if(r.endsWith("/index"))r=r.slice(0,-6);return r=r.replace(/\[\[([^\]]+)\]\]/g,":$1?"),r=r.replace(/\[([^\]]+)\]/g,":$1"),r=r.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${r}`}function le(e,t={}){let a=t.page?E:"",r=[],n="",o=0;while(o<e.length){let i=e.slice(o),c=/^\/:([^/?*]+)\?/.exec(i);if(c){r.push(c[1]);let d=o+c[0].length===e.length;n+=`(?:/${d?a:""}([^/]+))?`,o+=c[0].length;continue}let s=/^:([^/?*]+)\*/.exec(i);if(s){r.push(s[1]),n+="(.+)",o+=s[0].length;continue}let l=/^:([^/?*]+)/.exec(i);if(l){r.push(l[1]);let d=o+l[0].length===e.length;n+=`${d?a:""}([^/]+)`,o+=l[0].length;continue}n+=e[o].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),o+=1}return{regex:new RegExp(`^${n}$`),params:r}}function tr(e,t){let a=e===""?"/":e;for(let r of t){let n=a.match(r.regex);if(n){let o={};return r.params.forEach((i,c)=>{o[i]=n[c+1]}),{route:r,params:o}}}return null}function ts(e,t={}){let a=e.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return le(a,t)}import j from"fs";import L from"path";function _(e,t){let a=[],r=L.dirname(e);while(r.startsWith(t)||r===t){let n=L.join(r,"_layout.stx");if(j.existsSync(n))a.unshift(n);if(r===t)break;r=L.dirname(r)}return a}function F(e,t){let a=[];if(!x.existsSync(e))return a;let r=x.readdirSync(e,{withFileTypes:!0});for(let n of r){let o=u.join(e,n.name);if(n.isDirectory()){if(n.name.startsWith("."))continue;if(y.includes(n.name))continue;a.push(...F(o,t))}else if(n.isFile()){let i=u.extname(n.name);if(t.includes(i)){if(n.name.startsWith("_")&&n.name!=="_layout.stx")continue;if(n.name==="_layout.stx")continue;a.push(o)}}}return a}class nr{routes;pagesDir;pagesDirs;config;constructor(e,t={}){this.config=t;let a=t.pagesDirs&&t.pagesDirs.length>0?t.pagesDirs:[t.pagesDir||"pages"];this.pagesDirs=a.map((s)=>u.resolve(e,s)),this.pagesDir=this.pagesDirs[0];let r=t.extensions||[".stx"],n=(s)=>{let l=u.resolve(e,s);try{return x.realpathSync(l)}catch{return l}},o=(t.exclude??[]).filter((s)=>typeof s==="string"&&s.trim()!=="").map(n),i=(s)=>{if(o.length===0)return!1;let l=n(s);return o.some((d)=>l===d||l.startsWith(`${d}${u.sep}`))},c=new Set;this.routes=[];for(let s of this.pagesDirs){let l=F(s,r).filter((h)=>!i(h)),d=new Map;for(let h of l){let g=R(h,s),m=t.pagesDirs?g.replace(/:[\w]+/g,":param"):g;if(t.pagesDirs&&d.has(m))throw Error(`Conflicting layer pages for ${g}: ${d.get(m)} and ${h}`);if(d.set(m,h),c.has(m))continue;c.add(m);let{regex:H,params:M}=le(g,{page:!0}),C=t.layouts!==!1?_(h,s):[];this.routes.push({pattern:g,regex:H,params:M,filePath:h,isDynamic:M.length>0,layout:C.length>0?C[C.length-1]:void 0})}}if(this.routes.sort((s,l)=>{if(!s.isDynamic&&l.isDynamic)return-1;if(s.isDynamic&&!l.isDynamic)return 1;let d=s.pattern.split("/").length,h=l.pattern.split("/").length;if(d!==h)return h-d;return s.pattern.localeCompare(l.pattern)}),t.emit!==!1){let s=u.resolve(e,t.stateDir||process.env.STX_DIR?.trim()||".stx");So(this.routes,s),ko(this.routes,s,this.pagesDir)}}match(e){let t=e===""?"/":e;for(let a of this.routes){let r=t.match(a.regex);if(r){let n={};return a.params.forEach((o,i)=>{n[o]=r[i+1]}),{route:a,params:n}}}return null}resolve(e,t){let a=this.routes.find((n)=>n.pattern===e||n.filePath.includes(e));if(!a)return"#not-found";let r=a.pattern;if(t)for(let[n,o]of Object.entries(t))r=r.replace(`:${n}`,encodeURIComponent(o));return r}addRoute(e){this.routes.push(e),this.routes.sort((t,a)=>{if(!t.isDynamic&&a.isDynamic)return-1;if(t.isDynamic&&!a.isDynamic)return 1;return t.pattern.localeCompare(a.pattern)})}getLayout(e){return e.layout??null}}function ns(e,t){let a=[`${t}.stx`,"error.stx"];for(let r of a){let n=u.join(e,r);if(x.existsSync(n))return n}return null}function rs(e,t){return e.map((a)=>{let r=u.relative(t,a.filePath),n=a.isDynamic?" (dynamic)":"";return`${a.pattern} \u2192 ${r}${n}`})}var f={},k="";function Nl(e){k=e.replace(/\/$/,"")}function Dl(e,t,a={}){f[e]={path:t,name:e,params:a}}function Ml(e){for(let[t,a]of Object.entries(e))if(typeof a==="string")f[t]={path:a,name:t};else f[t]={...a,name:t}}function rr(e,t={},a=!1){let r=f[e];if(!r)return console.warn(`Route [${e}] not defined.`),"#undefined-route";let n={...r.params,...t},o=r.path;o=o.replace(/:(\w+)/g,(c,s)=>{let l=n[s];if(l===void 0)return console.warn(`Missing parameter [${s}] for route [${e}].`),`:${s}`;return delete n[s],encodeURIComponent(String(l))});let i=Object.entries(n);if(i.length>0){let c=i.map(([s,l])=>`${encodeURIComponent(s)}=${encodeURIComponent(String(l))}`).join("&");o+=(o.includes("?")?"&":"?")+c}return a&&k?`${k}${o}`:o}function Ll(){for(let e of Object.keys(f))delete f[e];k=""}import B from"fs";import U from"path";function jl(e,t={}){return{type:"redirect",path:e,options:{replace:t.replace??!1,external:t.external??!1,redirectCode:t.redirectCode??302}}}function Bl(e){return{type:"abort",error:typeof e==="string"?{statusCode:500,message:e}:e}}function Fl(e,t={}){return{handler:e,mode:t.mode??"universal"}}function O(e){let t={};if(!e)return t;let a=e.split(";");for(let r of a){let[n,...o]=r.split("=");if(n){let i=n.trim(),c=o.join("=").trim();if(i)t[i]=decodeURIComponent(c)}}return t}function S(e,t,a={}){let r=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(a.expires){let n=typeof a.expires==="number"?new Date(Date.now()+a.expires*1000):a.expires;r+=`; Expires=${n.toUTCString()}`}if(a.path)r+=`; Path=${a.path}`;if(a.domain)r+=`; Domain=${a.domain}`;if(a.secure)r+="; Secure";if(a.httpOnly)r+="; HttpOnly";if(a.sameSite)r+=`; SameSite=${a.sameSite}`;return r}function ka(e,t){let a=e.headers.get("cookie")||"",r=O(a);return{get(n){return r[n]},set(n,o,i={}){r[n]=o,t.append("Set-Cookie",S(n,o,i))},delete(n){delete r[n],t.append("Set-Cookie",S(n,"",{expires:new Date(0),path:"/"}))},getAll(){return{...r}}}}function _a(){return{get(e){if(typeof document>"u")return;return O(document.cookie)[e]},set(e,t,a={}){if(typeof document>"u")return;document.cookie=S(e,t,a)},delete(e){if(typeof document>"u")return;document.cookie=S(e,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return O(document.cookie)}}}function Ca(){let e=typeof window<"u"&&typeof window.localStorage<"u";return{get(t){if(!e)return null;try{return window.localStorage.getItem(t)}catch{return null}},set(t,a){if(!e)return;try{window.localStorage.setItem(t,a)}catch{}},remove(t){if(!e)return;try{window.localStorage.removeItem(t)}catch{}},isAvailable(){return e}}}var v=new Map;function _o(e,t){v.set(e,t)}function Ea(e){return v.get(e)}function zl(e){return v.has(e)}function wt(){v.clear()}function xt(){return Array.from(v.keys())}async function St(e,t="middleware"){let a=U.resolve(e,t);if(!B.existsSync(a))return;let r=B.readdirSync(a);for(let n of r){if(!n.endsWith(".ts")&&!n.endsWith(".js"))continue;if(n.includes(".test.")||n.includes(".spec."))continue;let o=n.replace(/\.(ts|js)$/,""),i=U.join(a,n);try{let s=(await import(i)).default;if(s&&typeof s.handler==="function")_o(o,s);else if(typeof s==="function")_o(o,{handler:s,mode:"universal"})}catch(c){console.warn(`Failed to load middleware '${o}' from ${i}:`,c)}}}function K(e){let t={};if(!e)return t;let a=new URLSearchParams(e);for(let[r,n]of a)t[r]=n;return t}function kt(e,t,a,r=""){return{path:e,params:t,query:K(r),fullPath:r?`${e}?${r}`:e,meta:a}}function _t(e,t,a,r){let n=r?.isServer??typeof window>"u",o=!n,i=new Headers;return{to:e,from:t,isClient:o,isServer:n,cookies:n&&a?ka(a,i):_a(),storage:Ca(),state:{},request:a,responseHeaders:i}}async function Ct(e,t){let a=Array.isArray(e)?e:[e],r=t.isServer;for(let n of a){let o=Ea(n);if(!o)return console.error(`Route middleware '${n}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${n}' is not registered`}},state:t.state,responseHeaders:t.responseHeaders};if(o.mode==="server"&&!r)continue;try{let i=await o.handler(t);if(i){if(i.type==="redirect")return{passed:!1,redirect:i,state:t.state,responseHeaders:t.responseHeaders};if(i.type==="abort")return{passed:!1,abort:i,state:t.state,responseHeaders:t.responseHeaders}}}catch(i){return console.error(`Error in middleware '${n}':`,i),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:i instanceof Error?i.message:"Middleware error"}},state:t.state,responseHeaders:t.responseHeaders}}}return{passed:!0,state:t.state,responseHeaders:t.responseHeaders}}function ss(e){let a=e.replace(/\\/g,"/").split("/").filter(Boolean),r=a.lastIndexOf("layouts"),n=r>=0?a[r+1]:a.at(-1);if(!n)return"app";return n.replace(/\.stx$/i,"")||"app"}function Ye(e){let t=e.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),a=e.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),r=e.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),n=t?.[1]||r?.[1]||"";return{layout:n,group:a?.[1]||ss(n)}}var A,T;function W(e){let t=[],a="log(",r=0;while(r<e.length){let n=e.indexOf("log(",r);if(n===-1){t.push(e.slice(r));break}let o=n>0?e[n-1]:" ",i=/\bfunction\s+$/.test(e.slice(Math.max(0,n-16),n));if(/[\w$.]/.test(o)||i){t.push(e.slice(r,n+4)),r=n+4;continue}t.push(e.slice(r,n));let c=1,s=n+4;while(s<e.length&&c>0){let l=e[s];if(l==='"'||l==="'"||l==="`"){let d=l;s++;while(s<e.length&&e[s]!==d){if(e[s]==="\\")s++;s++}s++;continue}if(l==="(")c++;else if(l===")")c--;s++}t.push("0"),r=s}return t.join("")}function q(e,t=!1){try{return new Bun.Transpiler(t?{loader:"js",minify:{whitespace:!0,identifiers:!0}}:{loader:"js",minifyWhitespace:!0}).transformSync(e).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return e}}function X(){return`
|
|
5
5
|
;(function(){
|
|
6
6
|
'use strict';
|
|
7
7
|
var ROUTER_REV=7;
|
|
@@ -3939,4 +3939,4 @@ else {
|
|
|
3939
3939
|
|
|
3940
3940
|
if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);else init();
|
|
3941
3941
|
})();
|
|
3942
|
-
`}function
|
|
3942
|
+
`}function Ze(){if(A)return A;return A=q(W(X()),!0),A}function Hl(){if(T)return T;return T=q(X()),T}export{So,ko,vt,le,tr,ts,nr,ns,rs,Nl,Dl,Ml,rr,Ll,jl,Bl,Fl,ka,_a,Ca,_o,Ea,zl,wt,xt,St,kt,_t,Ct,ss,Ye,Ze,Hl};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{_c,Cc}from"./chunk-8md2707p.js";import"./chunk-nw44qq6h.js";import"./chunk-db5017x8.js";import"./chunk-mn47s2ef.js";import"./chunk-bh19ezq0.js";import"./chunk-xtnxvmdb.js";import"./chunk-6ycyaf5g.js";import"./chunk-etbpzmxv.js";import"./chunk-gc4w2s5n.js";import"./chunk-z17sy8g3.js";import"./chunk-1b9thkg5.js";import"./chunk-5fh9m8fm.js";import"./chunk-wr1gm35v.js";import"./chunk-g98gafg7.js";import"./chunk-x4q4bx3q.js";import"./chunk-wtvy9r5w.js";import"./chunk-ggf4z3bv.js";import"./chunk-xdn6rtq2.js";import"./chunk-q4rejyd2.js";import"./chunk-03hhanvm.js";import"./chunk-wscnjtss.js";import"./chunk-k06n5bjp.js";import"./chunk-5z0q3qv3.js";import"./chunk-78x52gz3.js";import"./chunk-4fhbh04h.js";import"./chunk-x7wr720m.js";import"./chunk-2xv29pfj.js";import"./chunk-mvz825w0.js";import"./chunk-j6x7ryyn.js";import"./chunk-ram7pa4k.js";import"./chunk-qr7a378v.js";import"./chunk-97h9ga3b.js";import{Kt}from"./chunk-t9bsgbwv.js";import"./chunk-nvbyscdh.js";import"./chunk-54fazdmn.js";import"./chunk-374nhgyf.js";import{$e,o}from"./chunk-9azagdq6.js";import"./chunk-6ncvb8gp.js";import"./chunk-078qg8r5.js";import"./chunk-z4bfgvb3.js";import"./chunk-8jdbrcgt.js";import"./chunk-q7tfqavs.js";import"./chunk-e4ezpevb.js";import"./chunk-hz8dj5jy.js";import{ye}from"./chunk-4e5jrxbn.js";import"./chunk-dba795e1.js";import{Zn,Qn}from"./chunk-qdkwg2b8.js";import{Xr,N,i}from"./chunk-6qh2mx6q.js";import"./chunk-8xxc5edr.js";import"./chunk-dera8fmc.js";import"./chunk-q3gactm1.js";import"./chunk-yaccg2c0.js";import"./chunk-f26n6y9p.js";import{g,De}from"./chunk-3vwkyjan.js";import"./chunk-0thxpgtp.js";import"./chunk-9wdd7eq6.js";import"./chunk-kzb04293.js";import"./chunk-6beg47t4.js";import"./chunk-78yjmbbs.js";import"./chunk-vg1pg6yt.js";import"./chunk-vd5w1jaz.js";export{Xr as buildWebComponents,Qn as cacheTemplate,Zn as checkCache,Kt as classifyAllScripts,_c as createMiddleware,Cc as createRoute,N as defaultConfig,g as extractVariables,ye as injectRouterScript,i as loadStxConfig,De as processClientScript,o as processDirectives,$e as readMarkdownFile};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Bt}from"./chunk-5z8mq37c.js";function $s(e){let n=e.pwa;if(!n?.enabled)return"";let r=n.manifest,t=n.icons?.outputDir?`/${n.icons.outputDir}`:"/pwa-icons",o=Bt(e),i=`
|
|
3
3
|
<!-- stx PWA Meta Tags -->
|
|
4
4
|
<link rel="manifest" href="/manifest.json">
|
|
5
5
|
<meta name="theme-color" content="${a(r?.themeColor||"#000000")}">
|
|
@@ -43,12 +43,12 @@ if ('serviceWorker' in navigator) {
|
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
</script>
|
|
46
|
-
<!-- End stx PWA -->`,i}function
|
|
47
|
-
`+e.slice(o)}return e
|
|
48
|
-
</head>`)}function
|
|
46
|
+
<!-- End stx PWA -->`,i}function Zo(e,n){let r=n.pwa;if(!r?.enabled||r.autoInject===!1)return e;if(e.includes("<!-- stx PWA Meta Tags -->"))return e;if(!e.includes("</head>")){let o=e.lastIndexOf("</body>");if(o!==-1){let i=$s(n);return e.slice(0,o)+i+`
|
|
47
|
+
`+e.slice(o)}return e+$s(n)}let t=$s(n);return e.replace("</head>",`${t}
|
|
48
|
+
</head>`)}function gu(e){if(!e.pwa?.enabled)return"";return`<script>
|
|
49
49
|
if ('serviceWorker' in navigator) {
|
|
50
50
|
window.addEventListener('load', function() {
|
|
51
|
-
navigator.serviceWorker.register('/${
|
|
51
|
+
navigator.serviceWorker.register('/${Bt(e)}')
|
|
52
52
|
.then(function(registration) {
|
|
53
53
|
console.log('[PWA] Service Worker registered:', registration.scope);
|
|
54
54
|
})
|
|
@@ -57,5 +57,5 @@ if ('serviceWorker' in navigator) {
|
|
|
57
57
|
});
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
|
-
</script>`}function
|
|
61
|
-
export{
|
|
60
|
+
</script>`}function mu(){return'<link rel="manifest" href="/manifest.json">'}function hu(e){return`<meta name="theme-color" content="${a(e)}">`}function a(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}
|
|
61
|
+
export{$s,Zo,gu,mu,hu};
|