@stacksjs/stx 0.2.482 → 0.2.483
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-4ebwk9cw.js → chunk-01rz8h7x.js} +2 -2
- package/dist/{chunk-tr25zcf1.js → chunk-0egg3666.js} +9 -9
- package/dist/chunk-0fad6jf4.js +2 -0
- package/dist/chunk-0jfrzq0r.js +2 -0
- package/dist/{chunk-1m9v96z5.js → chunk-0ma6yhg9.js} +6 -6
- package/dist/{chunk-49h8ke5d.js → chunk-0ttq5enq.js} +1 -1
- package/dist/chunk-0vdxchfw.js +2 -0
- package/dist/{chunk-cgf2a166.js → chunk-1c407nky.js} +5 -5
- package/dist/{chunk-99kt56fn.js → chunk-1erc0vrb.js} +2 -2
- package/dist/chunk-1hpttjgq.js +2 -0
- package/dist/chunk-1mrn5s5z.js +2 -0
- package/dist/{chunk-v5rgebzz.js → chunk-1v86h5vn.js} +5 -5
- package/dist/chunk-1yckkva7.js +2 -0
- package/dist/{chunk-44dk5bb5.js → chunk-24jeywdh.js} +41 -41
- package/dist/chunk-258qj7pt.js +2 -0
- package/dist/{chunk-1z26g0cf.js → chunk-25m2wqsd.js} +6 -6
- package/dist/{chunk-28s5x7wv.js → chunk-298s08st.js} +2 -2
- package/dist/{chunk-eg5djbse.js → chunk-2cybh8dh.js} +2 -2
- package/dist/chunk-2fb4yx25.js +4 -0
- package/dist/chunk-2grygc4b.js +2 -0
- package/dist/{chunk-hq97tyb6.js → chunk-2hbygqzj.js} +2 -2
- package/dist/{chunk-8scw1bes.js → chunk-2hc5mbw8.js} +2 -2
- package/dist/{chunk-zpcxx4pp.js → chunk-2kyfaa0p.js} +2 -2
- package/dist/{chunk-ab7vh24b.js → chunk-2pph3dh0.js} +6 -6
- package/dist/{chunk-cd6hz56r.js → chunk-34154wz1.js} +5 -5
- package/dist/chunk-368zt1db.js +2 -0
- package/dist/{chunk-sarr8kz1.js → chunk-3mynjdqr.js} +6 -6
- package/dist/{chunk-5t5ahhjp.js → chunk-3s9s1mdt.js} +3 -3
- package/dist/chunk-3vqabd10.js +2 -0
- package/dist/chunk-490f2x2r.js +2 -0
- package/dist/chunk-4b5hg8y1.js +2 -0
- package/dist/{chunk-33h9ggbz.js → chunk-4c1afy15.js} +4 -4
- package/dist/{chunk-tfexmdkt.js → chunk-4drgbkga.js} +2 -2
- package/dist/chunk-4j2ej7er.js +2 -0
- package/dist/chunk-4k65naeg.js +2 -0
- package/dist/{chunk-cgszdc9m.js → chunk-4snv0gm8.js} +4 -4
- package/dist/chunk-5cd0jbt4.js +2 -0
- package/dist/{chunk-b1kdmkk8.js → chunk-5f7qy42x.js} +247 -266
- package/dist/{chunk-vvs75dse.js → chunk-67actssw.js} +2 -2
- package/dist/chunk-69dc3tyz.js +2 -0
- package/dist/chunk-6ejfx4qw.js +2 -0
- package/dist/{chunk-7ejq9n1v.js → chunk-71bbv43t.js} +4 -4
- package/dist/{chunk-7grtpdw5.js → chunk-7cbtcdqw.js} +2 -2
- package/dist/chunk-7wxmsv41.js +2 -0
- package/dist/{chunk-ah4qyrnn.js → chunk-802qf0vz.js} +1 -1
- package/dist/chunk-8b71njp8.js +30 -0
- package/dist/{chunk-2542vq5p.js → chunk-8fb1mqw1.js} +1 -1
- package/dist/{chunk-f4v80grv.js → chunk-8j8egh39.js} +3 -3
- package/dist/{chunk-6vn4pa76.js → chunk-93wkn776.js} +1 -1
- package/dist/chunk-9ds5dn6f.js +2 -0
- package/dist/chunk-9mywx2x0.js +2 -0
- package/dist/chunk-9s3tf3m3.js +2 -0
- package/dist/{chunk-jxrnagej.js → chunk-aabzyk88.js} +5 -5
- package/dist/chunk-ah4ww997.js +2 -0
- package/dist/chunk-avq5209p.js +2 -0
- package/dist/chunk-b0bgprzs.js +2 -0
- package/dist/chunk-b77v56fz.js +24 -0
- package/dist/{chunk-rycvcgkc.js → chunk-baprpeby.js} +3 -3
- package/dist/{chunk-bvhr055w.js → chunk-bv7bsdfe.js} +2 -2
- package/dist/{chunk-wkc34drs.js → chunk-c57j92td.js} +2 -2
- package/dist/chunk-c7cajwd2.js +2 -0
- package/dist/{chunk-8rx2v7zj.js → chunk-c8psbk2e.js} +1 -1
- package/dist/chunk-ckrpk6ak.js +2 -0
- package/dist/{chunk-3fjpg8kb.js → chunk-cp7hph6f.js} +3 -3
- package/dist/{chunk-80hpdc22.js → chunk-d19vgjjt.js} +2 -2
- package/dist/{chunk-pf0d8y9n.js → chunk-d4k4nyj0.js} +2 -2
- package/dist/{chunk-04qmr675.js → chunk-e62nw7zk.js} +2 -2
- package/dist/{chunk-pcq6vphz.js → chunk-e6y6s7q8.js} +2 -2
- package/dist/chunk-egax8990.js +2 -0
- package/dist/chunk-en0atzsp.js +2 -0
- package/dist/{chunk-2gmbxp60.js → chunk-er7y8hk9.js} +3 -3
- package/dist/chunk-ezvy497d.js +2 -0
- package/dist/chunk-f0prq6yw.js +2 -0
- package/dist/chunk-ftdabyt6.js +2 -0
- package/dist/chunk-g7ey7mtw.js +3 -0
- package/dist/chunk-g7jcpd5j.js +2 -0
- package/dist/chunk-gty89j8s.js +2 -0
- package/dist/{chunk-t7s0pdtw.js → chunk-gzt3ghgq.js} +3 -3
- package/dist/{chunk-3pv6f998.js → chunk-h6q8jafh.js} +2 -2
- package/dist/chunk-hem4ak5x.js +2 -0
- package/dist/{chunk-kp5tv8jx.js → chunk-hkjqqx92.js} +3 -3
- package/dist/{chunk-29pn79t5.js → chunk-hktvv0hd.js} +2 -2
- package/dist/chunk-hmyyq2hh.js +2 -0
- package/dist/{chunk-j2zgh5yk.js → chunk-hqvdm4h9.js} +2 -2
- package/dist/chunk-hsywkvng.js +2 -0
- package/dist/chunk-j2q2pp0x.js +2 -0
- package/dist/chunk-jbj6xh7f.js +3 -0
- package/dist/{chunk-33gkx5z1.js → chunk-jbvg29t0.js} +7 -7
- package/dist/chunk-jd9c46cc.js +2 -0
- package/dist/{chunk-kzzjk2mx.js → chunk-jva1bbpw.js} +10 -10
- package/dist/{chunk-27kb6nrb.js → chunk-jwjggr91.js} +2 -2
- package/dist/chunk-kkn0m1eg.js +2 -0
- package/dist/{chunk-j4afmryj.js → chunk-kp4mzspk.js} +4 -4
- package/dist/chunk-njpxfd44.js +2 -0
- package/dist/{chunk-7kjkmvrn.js → chunk-nr7qak48.js} +2 -2
- package/dist/{chunk-q9996m6n.js → chunk-nxxmhrd0.js} +2 -2
- package/dist/chunk-p5bwcppv.js +2 -0
- package/dist/chunk-p5pna1sn.js +2 -0
- package/dist/chunk-p6trwjap.js +2 -0
- package/dist/{chunk-8emc4aq5.js → chunk-qk5j55r0.js} +5 -5
- package/dist/chunk-qmcmjdy7.js +65 -0
- package/dist/{chunk-91jyax19.js → chunk-qv3rrz9a.js} +11 -11
- package/dist/chunk-rbsn2vf5.js +2 -0
- package/dist/chunk-rcn6m3cj.js +2 -0
- package/dist/chunk-rd2w20hg.js +2 -0
- package/dist/{chunk-5x9ftmve.js → chunk-rhrv2j36.js} +2 -2
- package/dist/{chunk-9ztdvnkk.js → chunk-rmavqxd8.js} +4 -4
- package/dist/chunk-rn2w32kh.js +2 -0
- package/dist/{chunk-q8pn42an.js → chunk-rn4cppcj.js} +4 -4
- package/dist/chunk-rt71qxdq.js +2 -0
- package/dist/chunk-s6v5p03w.js +2 -0
- package/dist/{chunk-k4shjm8n.js → chunk-s9mq9x2k.js} +5 -5
- package/dist/chunk-svywp38a.js +2 -0
- package/dist/chunk-sybzayv3.js +2 -0
- package/dist/{chunk-8adstrk5.js → chunk-szry3s17.js} +3 -3
- package/dist/chunk-tse7jzmz.js +2 -0
- package/dist/chunk-tvag2s5a.js +2 -0
- package/dist/{chunk-01nx6zcw.js → chunk-v7vkqg8f.js} +2 -2
- package/dist/chunk-vbhykx9z.js +2 -0
- package/dist/{chunk-se55qe2x.js → chunk-vg9dyc4y.js} +1 -1
- package/dist/{chunk-zkg0rbmp.js → chunk-vp827ah7.js} +6 -6
- package/dist/chunk-vr0fb0x1.js +2 -0
- package/dist/{chunk-bqx3dqv1.js → chunk-vs0ebfg5.js} +1 -1
- package/dist/chunk-vwybce48.js +2 -0
- package/dist/chunk-vzxkwr23.js +2 -0
- package/dist/{chunk-ak95401g.js → chunk-x8mp9yvn.js} +3 -3
- package/dist/{chunk-b8p9y1kv.js → chunk-xevnx24r.js} +2 -2
- package/dist/chunk-xfxrh6vx.js +2 -0
- package/dist/{chunk-960axmf7.js → chunk-yhv65tpd.js} +2 -2
- package/dist/chunk-yxgfw906.js +2 -0
- package/dist/chunk-z6nm6rf1.js +2 -0
- package/dist/{chunk-cxbp2m66.js → chunk-z9fz5dby.js} +5 -5
- package/dist/{chunk-gkj42zq7.js → chunk-z9tvn738.js} +2 -2
- package/dist/{chunk-abts223v.js → chunk-zkjp87ak.js} +3 -3
- package/dist/{chunk-w6n2j62h.js → chunk-zv0vgamy.js} +3 -3
- package/dist/cli.js +20 -20
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/document-shell.d.ts +11 -0
- package/dist/document-shell.js +11 -3
- package/dist/head.js +2 -1
- package/dist/pwa.js +3 -3
- package/dist/seo.d.ts +16 -0
- package/dist/seo.js +9 -6
- package/dist/ssg.js +13 -13
- package/package.json +5 -5
- package/dist/chunk-0e1rga0j.js +0 -2
- package/dist/chunk-0jp07cjs.js +0 -2
- package/dist/chunk-1kkyg54v.js +0 -2
- package/dist/chunk-2njt4vbe.js +0 -2
- package/dist/chunk-3aw80qrg.js +0 -2
- package/dist/chunk-3gbjppvg.js +0 -2
- package/dist/chunk-3nq94g1b.js +0 -2
- package/dist/chunk-4aw47rmg.js +0 -2
- package/dist/chunk-50vq8k55.js +0 -2
- package/dist/chunk-5fvzzqa3.js +0 -2
- package/dist/chunk-5pjsc9zv.js +0 -3
- package/dist/chunk-5sb7gw66.js +0 -2
- package/dist/chunk-5y4qxmaw.js +0 -2
- package/dist/chunk-7mh0fnrq.js +0 -2
- package/dist/chunk-8mxjd1ge.js +0 -2
- package/dist/chunk-8xvrcwtk.js +0 -2
- package/dist/chunk-969np51a.js +0 -2
- package/dist/chunk-9kzk7zyy.js +0 -2
- package/dist/chunk-9vqz2m13.js +0 -2
- package/dist/chunk-ap9nnv9z.js +0 -2
- package/dist/chunk-bw0gkfb3.js +0 -2
- package/dist/chunk-d20gxzk9.js +0 -2
- package/dist/chunk-db2sy0f3.js +0 -2
- package/dist/chunk-dbj4sn74.js +0 -2
- package/dist/chunk-dts9z53c.js +0 -2
- package/dist/chunk-ecr642nj.js +0 -2
- package/dist/chunk-eev60q15.js +0 -2
- package/dist/chunk-ep7hz9af.js +0 -2
- package/dist/chunk-fe5xht52.js +0 -2
- package/dist/chunk-fqhewm3t.js +0 -2
- package/dist/chunk-gzbzfndm.js +0 -2
- package/dist/chunk-hgcvtfnz.js +0 -2
- package/dist/chunk-j338fs8k.js +0 -2
- package/dist/chunk-jbmwm6k4.js +0 -2
- package/dist/chunk-jvdren00.js +0 -2
- package/dist/chunk-k7t0rmzy.js +0 -2
- package/dist/chunk-k84qkm21.js +0 -2
- package/dist/chunk-kd7m4d0g.js +0 -2
- package/dist/chunk-kk5cyjfs.js +0 -3
- package/dist/chunk-kmf7yh91.js +0 -2
- package/dist/chunk-m5dgc757.js +0 -2
- package/dist/chunk-m8w4hve0.js +0 -2
- package/dist/chunk-mhwptrvm.js +0 -2
- package/dist/chunk-mmh37ywa.js +0 -2
- package/dist/chunk-ms5aj58v.js +0 -2
- package/dist/chunk-n454sydr.js +0 -2
- package/dist/chunk-pd5r4j8r.js +0 -2
- package/dist/chunk-pe9bvwqn.js +0 -30
- package/dist/chunk-pt566gqb.js +0 -2
- package/dist/chunk-q4wpzj1f.js +0 -2
- package/dist/chunk-qtsymvxx.js +0 -2
- package/dist/chunk-r54tkwpc.js +0 -2
- package/dist/chunk-ra321t5d.js +0 -2
- package/dist/chunk-s10r6hxp.js +0 -64
- package/dist/chunk-sqjdb265.js +0 -2
- package/dist/chunk-st1s30tn.js +0 -2
- package/dist/chunk-tbef3yyk.js +0 -5
- package/dist/chunk-v7ahbhbd.js +0 -2
- package/dist/chunk-v9t3z8nm.js +0 -2
- package/dist/chunk-vcs1fx8e.js +0 -2
- package/dist/chunk-w0vrmvh7.js +0 -2
- package/dist/chunk-w28c9st3.js +0 -2
- package/dist/chunk-x73mzzm8.js +0 -2
- package/dist/chunk-xnjcmhs5.js +0 -4
- package/dist/chunk-yed9c66h.js +0 -2
- package/dist/chunk-zb5p05v4.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Bs,Fs,Qe,G,xn,lr,Sn,ur,dr,Bc,Fc,zc,kn,Hc,Vc,Uc,Wc,Fi,zi,Hi,zs,Vi,qc,et,tt,nt,rt,st,ot,Ce,Kc}from"./chunk-rmavqxd8.js";export{Sn as Router,Uc as abortNavigation,lr as bracketPathToRegex,et as clearMiddleware,zi as createClientCookieManager,st as createMiddlewareContext,rt as createRouteLocation,Fi as createServerCookieManager,Hi as createStorageManager,Wc as defineMiddleware,Fc as defineRoute,zc as defineRoutes,ur as findErrorPage,dr as formatRoutes,Fs as generateRouteManifest,Bs as generateRouteTypes,Vi as getMiddleware,tt as getMiddlewareNames,Ce as getRouterScript,Kc as getRouterScriptDev,qc as hasMiddleware,Qe as isFileRequestPath,nt as loadMiddlewareFromDirectory,xn as matchRoute,Vc as navigateTo,G as patternToRegex,zs as registerMiddleware,Hc as resetRoutes,kn as route,ot as runMiddleware,Bc as setAppUrl};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Ni,Li,ji}from"./chunk-v7vkqg8f.js";import{V,Dn,Xt,jr,Br,On,Gt,Jt,Fr,Mn}from"./chunk-d19vgjjt.js";function z(r,d=!0,u){if(!d||!r||typeof window>"u")return;let s=window;if(!s.__STX_DATA__){let y=document.querySelector("script[data-stx-server-data]");try{let h=JSON.parse(y?.textContent||"{}");s.__STX_DATA__=h&&typeof h==="object"&&!Array.isArray(h)?h:{}}catch{s.__STX_DATA__={}}}let i=s.__STX_DATA__;if(i&&Object.prototype.hasOwnProperty.call(i,r))try{return{data:u?u(i[r]):i[r]}}catch(y){return{data:null,error:y instanceof Error?y:Error(String(y))}}return}function X(r){if(typeof window>"u")return;let d=window;if(r===void 0)d.__STX_DATA__={};else{if(!d.__STX_DATA__)try{let u=JSON.parse(document.querySelector("script[data-stx-server-data]")?.textContent||"{}");d.__STX_DATA__=u&&typeof u==="object"&&!Array.isArray(u)?u:{}}catch{d.__STX_DATA__={}}if(d.__STX_DATA__)delete d.__STX_DATA__[r]}}function Q(r){let d=null;try{d=typeof indexedDB<"u"?indexedDB:null}catch{d=null}if(!d)return null;let u=d,s=r||"stx-kept",i=null,y=()=>{if(!i)i=new Promise((f,l)=>{let a=u.open(s,1);a.onupgradeneeded=()=>{a.result.createObjectStore("kv")},a.onsuccess=()=>f(a.result),a.onerror=()=>l(a.error),a.onblocked=()=>l(Error("blocked"))}),i.catch(()=>{i=null});return i},h=(f,l)=>y().then((a)=>new Promise((v,g)=>{let t=a.transaction("kv",f),o=l(t.objectStore("kv"));t.oncomplete=()=>v(o?o.result:void 0),t.onerror=()=>g(t.error),t.onabort=()=>g(t.error)}));return{get:(f)=>h("readonly",(l)=>l.get(f)),set:(f,l)=>h("readwrite",(a)=>{a.put(l,f)}),remove:(f)=>h("readwrite",(l)=>{l.delete(f)}),removePrefix:(f)=>h("readwrite",(l)=>{l.delete(IDBKeyRange.bound(f,`${f}\uFFFF`))})}}function G(r,d){let u=r||{},s=null;if(u.storage!==void 0)s=u.storage;else try{s=typeof localStorage<"u"?localStorage:null}catch{s=null}let i=null,y=u.backend!==void 0;if(y)i=u.backend||null;let h=()=>{if(y)return i;y=!0;try{i=d?d():null}catch{i=null}if(i){let e=i;e.get("__stx_probe__").catch(()=>{if(i===e)i=null})}return i},f=u.limit||32768,l=u.defer||((e)=>{let n=typeof requestIdleCallback==="function"?requestIdleCallback:null;if(n)n(e,{timeout:200});else setTimeout(e,16)}),a=new Map,v=new Set,g=new Map,t=!1,o=Promise.resolve(),m=(e)=>{try{return JSON.parse(e)}catch{return e}},p=(e,n)=>{if(!s)return!1;try{return s.setItem(e,n),!0}catch{return!1}},T=(e)=>{try{if(s)s.removeItem(e)}catch{}},S=()=>{if(t=!1,!g.size)return o;let e=Array.from(g.entries());return g.clear(),o=o.then(()=>Promise.all(e.map(([n,c])=>{if(!i){v.delete(n);try{p(n,JSON.stringify(c===void 0?null:c))}catch{}return}let _;try{return _={v:c},i.set(n,_).catch(()=>{let w;try{w=JSON.stringify(c)}catch{return}return i?i.set(n,{j:w}).catch(()=>{p(n,w)}):void 0})}catch{return}}))).then(()=>{}),o},R=(e,n)=>{if(g.set(e,n),v.add(e),t)return;t=!0,l(()=>{S()})},O=(e)=>{if(!e||typeof e!=="object")return;let n=e;if("v"in n)return{value:n.v};if(typeof n.j==="string")return{value:m(n.j)};return},E={peek(e){if(a.has(e))return{value:a.get(e)};let n=null;try{n=s?s.getItem(e):null}catch{n=null}if(n===null||n===void 0)return;let c=m(n);return a.set(e,c),{value:c}},load(e){let n=E.peek(e),c=n?null:h();if(n||!c)return Promise.resolve(n);return c.get(e).then((_)=>{if(a.has(e))return{value:a.get(e)};let w=O(_);if(w)a.set(e,w.value),v.add(e);return w},()=>{return})},set(e,n){if(a.set(e,n),i&&v.has(e)){R(e,n);return}let c;try{c=JSON.stringify(n===void 0?null:n)}catch{return}if(c.length<=f&&p(e,c))return;if(!h()){if(c.length>f)p(e,c);return}T(e),R(e,n)},forget(e){for(let c of Array.from(a.keys()))if(c.indexOf(e)===0)a.delete(c);for(let c of Array.from(g.keys()))if(c.indexOf(e)===0)g.delete(c);for(let c of Array.from(v))if(c.indexOf(e)===0)v.delete(c);try{if(s)for(let c=s.length-1;c>=0;c--){let _=s.key(c);if(_&&_.indexOf(e)===0)s.removeItem(_)}}catch{}let n=h();if(!n)return o;return o=o.then(()=>n.removePrefix(e)).catch(()=>{}),o},flush(){return S()}};try{if(typeof document<"u"&&document.addEventListener)document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden")S()});if(typeof addEventListener==="function")addEventListener("pagehide",()=>{S()})}catch{}return E}function J(r,d){if(!r)return!1;if(r===d.key)return!0;if(!d.url)return!1;if(r===d.url)return!0;try{let u=typeof location<"u"&&location.origin&&location.origin!=="null"?location.origin:"http://localhost",s=new URL(r,u),i=new URL(d.url,u);if(s.origin!==i.origin||s.pathname!==i.pathname)return!1;return!s.search||s.search===i.search}catch{return!1}}function Y(r){let d=r.prefix||"stx:kept:",u=r.matches||((t,o)=>t===o.key||t===o.url),s=new Set,i=new Map,y,h=(t)=>t===void 0?y:t,f=(t,o)=>{let m=h(o);if(m===!1||m===null||m==="")return null;return`${d}${m===void 0?"":`${m}:`}query:${t}`},l=(t)=>{let o=t&&t.value;if(!o||typeof o!=="object"||!("d"in o))return;return{data:o.d,at:Number(o.at)||0}},a=()=>{let t=globalThis;return t.__stx_outboxes instanceof Map?t.__stx_outboxes:null},v={setScope(t){y=t},scope:()=>y,keyFor:f,seed(t,o){let m=f(t,o);return m?l(r.kept.peek(m)):void 0},restore(t,o){let m=f(t,o);return m?r.kept.load(m).then(l):Promise.resolve(void 0)},persist(t,o,m){let p=f(t,m);if(p)r.kept.set(p,{d:o,at:Date.now()})},overlay(t,o,m){let p=a();if(!p||!p.size)return o;let T=o;return p.forEach((S)=>{try{T=S.overlay(t,T,m)}catch{}}),T},watch(t){return s.add(t),()=>{s.delete(t)}},cachedQuery(t,o){let m=i.get(t);if(m){if(o&&m.__options)m.__options(o);return m}let p=o||{},T=p.initial===void 0?null:p.initial,S=()=>typeof p.scope==="function"?p.scope():p.scope,R=()=>(typeof p.url==="function"?p.url():p.url)||null,O=()=>({key:t,url:R()}),E=S(),e=T,n=0,c=null,_=v.seed(t,E);if(_)e=_.data;let w=r.state(v.overlay(O(),e)),H=r.state(!1),q=r.state(!1),B=r.state(null),I=r.state(_?_.at:0),N=0,P=()=>{w.set(v.overlay(O(),e))},W=(b)=>{let x=N;v.restore(t,b).then((C)=>{if(!C||x!==N||n)return;e=C.data,I.set(C.at),P()})};if(!_)W(E);let ee=()=>{let b=S();if(b===E)return;E=b,N++,c=null,n=0;let x=v.seed(t,E);if(e=x?x.data:T,I.set(x?x.at:0),P(),!x)W(E)},te=(b)=>{let x=R(),C=p.timeoutMs||15000,A=typeof AbortController<"u"?new AbortController:null,k=null,ne=new Promise((D,L)=>{k=setTimeout(()=>{if(A)A.abort();L(Error("The request took too long."))},C)}),K;if(p.load)K=p.load({force:b,url:x,signal:A?A.signal:void 0});else if(x){let D=p.fetch||((M,F)=>fetch(M,F)),L={method:"GET",headers:{Accept:"application/json"}};if(b)L.cache="no-cache";if(A)L.signal=A.signal;K=D(x,L).then((M)=>{if(!M.ok)return M.json().catch(()=>null).then((F)=>{throw Error(F&&(F.error||F.message)||`Request failed (${M.status})`)});return M.json()})}else return Promise.resolve(w());return Promise.race([K,ne]).then((D)=>{if(k)clearTimeout(k);return p.transform?p.transform(D):D},(D)=>{if(k)clearTimeout(k);throw D})},U=(b)=>{if(c)return c;let x=N;if(q.set(!0),n===0&&!I())H.set(!0);let C=()=>{if(x!==N)return;c=null,q.set(!1),H.set(!1)},A=te(b).then((k)=>{if(x!==N)return w();return e=k,n=Date.now(),I.set(n),B.set(null),v.persist(t,k,E),P(),C(),w()},(k)=>{if(x===N)B.set(k&&k.message?k.message:"Could not load.");return C(),w()});return c=A,A},j={data:w,loading:H,isFetching:q,error:B,updatedAt:I,get key(){return t},load(b){if(ee(),!b&&n&&Date.now()-n<(p.staleTime||0))return Promise.resolve(w());return U(!!b)},refresh(){return j.load(!0)},set(b){e=typeof b==="function"?b(e):b,v.persist(t,e,E),P()},invalidate(){n=0},__options(b){p={...p,...b}}};if(s.add({target:O,updated:()=>{if(n||I())U(!1)},outbox:(b)=>{if(b)e=v.overlay(O(),e,b.id),n=0,U(!0);P()}}),i.set(t,j),p.immediate)j.load();return j}},g=typeof window<"u"?window:typeof addEventListener==="function"?globalThis:null;if(r.listen!==!1&&g&&typeof g.addEventListener==="function")g.addEventListener("stx:updated",(t)=>{let o=t.detail||{};if(o.kind!=="api"||typeof o.url!=="string")return;s.forEach((m)=>{if(u(o.url,m.target()))m.updated()})}),g.addEventListener("stx:outbox",(t)=>{let o=t.detail||{},m=o.sent&&typeof o.sent.id==="string"?o.sent:null;s.forEach((p)=>{if(m){let T=Array.isArray(m.affects)?m.affects:[],S=p.target();if(!T.some((R)=>u(R,S)))return}p.outbox(m)})});return v}function Z(r,d,u,s,i){let y=!0,h=new Set,f=(a)=>s.get?s.get(a):a,l=()=>f(r());return Object.defineProperty(l,"_isSignal",{value:!0}),Object.defineProperty(l,"modifiers",{get:d}),l.set=(a)=>{if(!y)return;let v=d(),g=s.set?s.set(a,v):a;if(v.trim&&typeof g==="string")g=g.trim();if(v.number&&typeof g==="string"&&g!==""){let t=Number(g);if(!Number.isNaN(t))g=t}if(Object.is(r(),g))return;r.set(g),u(g)},l.update=(a)=>l.set(a(l())),l.input=(a)=>{if(!d().lazy)l.set(a)},l.change=(a)=>{if(d().lazy)l.set(a)},l.subscribe=(a)=>{if(!y)return()=>{};let v=r.subscribe((g,t)=>a(f(g),f(t)));return h.add(v),()=>{v(),h.delete(v)}},Object.defineProperty(l,"value",{get:l,set:l.set}),i(()=>{y=!1,h.forEach((a)=>a()),h.clear()}),l}function De(){let r=re(Kt());try{let u=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(r);return u=u.replace(/\}(var |let |const |function )/g,"};$1"),u}catch{return r}}function re(r){let d=[],u=0,s="console.log(";while(u<r.length){let i=r.indexOf(s,u);if(i===-1){d.push(r.slice(u));break}d.push(r.slice(u,i));let y=1,h=i+s.length;while(h<r.length&&y>0){let f=r[h];if(f==='"'||f==="'"||f==="`"){let l=f;h++;while(h<r.length&&r[h]!==l){if(r[h]==="\\")h++;h++}h++;continue}if(f==="(")y++;else if(f===")")y--;h++}d.push("0"),u=h}return d.join("")}function Kt(){return`
|
|
3
3
|
// STX Signals Runtime (Development Build)
|
|
4
4
|
console.log('[stx] signals runtime loading');
|
|
5
5
|
// Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
|
|
@@ -3143,7 +3143,7 @@ catch (e2) {
|
|
|
3143
3143
|
};
|
|
3144
3144
|
|
|
3145
3145
|
// Known directive names to exclude from generic :attr binding
|
|
3146
|
-
var DIRECTIVE_NAMES = ${
|
|
3146
|
+
var DIRECTIVE_NAMES = ${Li()};
|
|
3147
3147
|
|
|
3148
3148
|
// A bound value cannot introduce a URL scheme the page did not ask for.
|
|
3149
3149
|
// This is the client half of url-safety.ts: the server refuses a scheme
|
|
@@ -3178,7 +3178,7 @@ catch (e2) {
|
|
|
3178
3178
|
// a dead duplicate attribute and the real viewBox never updates.
|
|
3179
3179
|
var SVG_ATTR_CASE = {attributename:'attributeName', attributetype:'attributeType', basefrequency:'baseFrequency', baseprofile:'baseProfile', calcmode:'calcMode', clippathunits:'clipPathUnits', diffuseconstant:'diffuseConstant', edgemode:'edgeMode', filterunits:'filterUnits', glyphref:'glyphRef', gradienttransform:'gradientTransform', gradientunits:'gradientUnits', kernelmatrix:'kernelMatrix', kernelunitlength:'kernelUnitLength', keypoints:'keyPoints', keysplines:'keySplines', keytimes:'keyTimes', lengthadjust:'lengthAdjust', limitingconeangle:'limitingConeAngle', markerheight:'markerHeight', markerunits:'markerUnits', markerwidth:'markerWidth', maskcontentunits:'maskContentUnits', maskunits:'maskUnits', numoctaves:'numOctaves', pathlength:'pathLength', patterncontentunits:'patternContentUnits', patterntransform:'patternTransform', patternunits:'patternUnits', pointsatx:'pointsAtX', pointsaty:'pointsAtY', pointsatz:'pointsAtZ', preservealpha:'preserveAlpha', preserveaspectratio:'preserveAspectRatio', primitiveunits:'primitiveUnits', refx:'refX', refy:'refY', repeatcount:'repeatCount', repeatdur:'repeatDur', requiredextensions:'requiredExtensions', requiredfeatures:'requiredFeatures', specularconstant:'specularConstant', specularexponent:'specularExponent', spreadmethod:'spreadMethod', startoffset:'startOffset', stddeviation:'stdDeviation', stitchtiles:'stitchTiles', surfacescale:'surfaceScale', systemlanguage:'systemLanguage', tablevalues:'tableValues', targetx:'targetX', targety:'targetY', textlength:'textLength', viewbox:'viewBox', viewtarget:'viewTarget', xchannelselector:'xChannelSelector', ychannelselector:'yChannelSelector', zoomandpan:'zoomAndPan'};
|
|
3180
3180
|
var SVG_NS = 'http://www.w3.org/2000/svg';
|
|
3181
|
-
var EVENT_RE = ${
|
|
3181
|
+
var EVENT_RE = ${ji()};
|
|
3182
3182
|
var KEY_MAP = {enter:'Enter', tab:'Tab', escape:'Escape', space:' ', up:'ArrowUp', down:'ArrowDown', left:'ArrowLeft', right:'ArrowRight', 'delete':'Delete', backspace:'Backspace'};
|
|
3183
3183
|
|
|
3184
3184
|
// Handle attributes
|
|
@@ -3214,7 +3214,7 @@ catch (e2) {
|
|
|
3214
3214
|
// :attr still works for backward compat but is reserved for structural directives.
|
|
3215
3215
|
// x-text, x-html, x-model, x-show, x-if, x-for, x-cloak, x-ref, x-data are
|
|
3216
3216
|
// handled by their own code paths below \u2014 exclude them here.
|
|
3217
|
-
var X_HANDLED = ${
|
|
3217
|
+
var X_HANDLED = ${Ni()};
|
|
3218
3218
|
if (name.startsWith('@bind:') || name.startsWith('x-bind:')
|
|
3219
3219
|
|| (name.startsWith(':') && !name.startsWith('::') && !DIRECTIVE_NAMES[name.slice(1).split('.')[0]] && !EVENT_RE.test(name.slice(1)))
|
|
3220
3220
|
|| (name.startsWith('x-') && !X_HANDLED[name.split('.')[0]] && !X_HANDLED[name])) {
|
|
@@ -9776,5 +9776,5 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
|
|
|
9776
9776
|
}
|
|
9777
9777
|
}
|
|
9778
9778
|
})();
|
|
9779
|
-
`}var
|
|
9780
|
-
export{
|
|
9779
|
+
`}var su={state:V,derived:Dn,effect:Xt,batch:jr,onMount:Br,onDestroy:On,isSignal:Gt,isDerived:Jt,untrack:Fr,peek:Mn,generateSignalsRuntime:De,generateSignalsRuntimeDev:Kt};
|
|
9780
|
+
export{De,Kt,su};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import I from"fs";import u from"path";import V from"os";import x from"crypto";import{generatePlaceholder as C,processImage as D}from"ts-images";var j=[320,640,768,1024,1280,1536,1920],B=["webp","jpeg"],F=80,O=[".jpg",".jpeg",".png",".webp",".avif",".gif",".svg"],L={webp:"image/webp",avif:"image/avif",jpeg:"image/jpeg",png:"image/png"},w=null,v=!1;async function p(){if(v)return w;v=!0;try{let t=await import("sharp");return w=t.default||t,w}catch{return null}}async function
|
|
3
|
-
export{j,B,F,
|
|
2
|
+
import I from"fs";import u from"path";import V from"os";import x from"crypto";import{generatePlaceholder as C,processImage as D}from"ts-images";var j=[320,640,768,1024,1280,1536,1920],B=["webp","jpeg"],F=80,O=[".jpg",".jpeg",".png",".webp",".avif",".gif",".svg"],L={webp:"image/webp",avif:"image/avif",jpeg:"image/jpeg",png:"image/png"},w=null,v=!1;async function p(){if(v)return w;v=!0;try{let t=await import("sharp");return w=t.default||t,w}catch{return null}}async function Nt(){return await p()!==null}async function J(){return!0}async function se(t,e={}){let{widths:a=j,formats:r=B,quality:n=F,fit:i="cover",placeholder:m="none",outputDir:o=".stx/images",baseUrl:b="/images"}=e,h,g;if(typeof t==="string"){if(g=t,!await Bun.file(t).exists())throw new In(`Image not found: ${t}`,"NOT_FOUND");h=await Bun.file(t).arrayBuffer().then((s)=>Buffer.from(s))}else g="buffer-input",h=t;let y=x.createHash("sha256").update(h).digest("hex").slice(0,12),k=await Pn(h),{width:c,height:S}=k,P=c/S;await I.promises.mkdir(o,{recursive:!0});let E=[],R=u.basename(g,u.extname(g)),l=a.filter((s)=>s<=c);if(!l.includes(c)&&c<=Math.max(...a))l.push(c);l.sort((s,f)=>s-f);for(let s of l){let f=Math.round(s/P);for(let d of r){let U=`${R}-${s}w-${y}.${d}`,A=u.join(o,U),T=`${b}/${U}`,q=await ia(h,{width:s,height:f,format:d,quality:n,fit:i});await Bun.write(A,q),E.push({path:A,url:T,width:s,height:f,format:d,size:q.length})}}let M;if(m!=="none")M=await _(h,m);return{src:g,variants:E,placeholder:M,width:c,height:S,aspectRatio:P,hash:y}}async function Pn(t){let e=typeof t==="string"?Buffer.from(await Bun.file(t).arrayBuffer()):t,a=await p();if(a){let n=await a(e).metadata();return{width:n.width||0,height:n.height||0,format:n.format||"unknown",hasAlpha:n.hasAlpha}}return N(e)}function N(t){if(t[0]===137&&t[1]===80&&t[2]===78&&t[3]===71){let e=t.readUInt32BE(16),a=t.readUInt32BE(20);return{width:e,height:a,format:"png",hasAlpha:!0}}if(t[0]===255&&t[1]===216){let e=2;while(e<t.length){if(t[e]!==255)break;let a=t[e+1];if(a>=192&&a<=207&&a!==196&&a!==200&&a!==204){let n=t.readUInt16BE(e+5);return{width:t.readUInt16BE(e+7),height:n,format:"jpeg",hasAlpha:!1}}let r=t.readUInt16BE(e+2);e+=2+r}}if(t.toString("utf8",0,4)==="RIFF"&&t.toString("utf8",8,12)==="WEBP"){let e=t.toString("utf8",12,16);if(e==="VP8 "){let a=t.readUInt16LE(26)&16383,r=t.readUInt16LE(28)&16383;return{width:a,height:r,format:"webp",hasAlpha:!1}}if(e==="VP8L"){let a=t.readUInt32LE(21),r=(a&16383)+1,n=(a>>14&16383)+1;return{width:r,height:n,format:"webp",hasAlpha:!0}}}if(t.toString("utf8",0,3)==="GIF"){let e=t.readUInt16LE(6),a=t.readUInt16LE(8);return{width:e,height:a,format:"gif",hasAlpha:!0}}throw new In("Unable to parse image dimensions","PARSE_ERROR")}async function ia(t,e){let a=await p();if(a){let n=a(t).resize(e.width,e.height,{fit:e.fit});switch(e.format){case"webp":n=n.webp({quality:e.quality});break;case"avif":n=n.avif({quality:e.quality});break;case"jpeg":n=n.jpeg({quality:e.quality});break;case"png":n=n.png({quality:e.quality});break}return n.toBuffer()}let r=u.join(V.tmpdir(),`stx-img-${x.randomBytes(8).toString("hex")}.${e.format}`);try{return await D({input:t,output:r,format:e.format,quality:e.quality,resize:{width:e.width,height:e.height,fit:e.fit}}),Buffer.from(await Bun.file(r).arrayBuffer())}finally{await I.promises.unlink(r).catch(()=>{})}}async function _(t,e){let a=await p();if(e==="blur"&&a){let m=(await a(t).resize(20).blur(10).toBuffer()).toString("base64"),o=await Pn(t);return`data:${L[o.format]||"image/jpeg"};base64,${m}`}if(e==="dominant-color"&&a){let{dominant:i}=await a(t).resize(1,1).toBuffer().then(async(m)=>{let o=await a(m).metadata();return{dominant:{r:128,g:128,b:128}}}).catch(()=>({dominant:{r:128,g:128,b:128}}));return`rgb(${i.r}, ${i.g}, ${i.b})`}let r=await Pn(t),n=u.join(V.tmpdir(),`stx-ph-${x.randomBytes(8).toString("hex")}.${r.format==="unknown"?"bin":r.format}`);try{await Bun.write(n,t);let i=e==="blur"?"blur":e==="thumbhash"?"thumbhash":"dominant-color",o=await C(n,{strategy:i,width:i==="thumbhash"?void 0:32});if(e==="dominant-color"&&o.dominantColor)return o.dominantColor;if(o.dataURL)return o.dataURL;return"rgb(128, 128, 128)"}catch{return"rgb(128, 128, 128)"}finally{await I.promises.unlink(n).catch(()=>{})}}function Pe(t,e){return(e?t.filter((r)=>r.format===e):t).sort((r,n)=>r.width-n.width).map((r)=>`${r.url} ${r.width}w`).join(", ")}function dt(t){if(!t||Object.keys(t).length===0)return"100vw";return Object.entries(t).sort((a,r)=>{let n=Number.parseInt(a[0].replace(/\D/g,""))||0;return(Number.parseInt(r[0].replace(/\D/g,""))||0)-n}).map(([a,r])=>`(max-width: ${a}) ${r}`).join(", ")+", 100vw"}function Lt(t){let e=t.filter((r)=>r.format==="jpeg");if(e.length===0)return t[Math.floor(t.length/2)];let a=e.sort((r,n)=>r.width-n.width);return a[Math.floor(a.length/2)]}function jt(t){let e=new Map;for(let a of t){let r=e.get(a.format)||[];r.push(a),e.set(a.format,r)}return e}function Bt(t){let e=u.extname(t).toLowerCase();return O.includes(e)}function z(t){return L[t]||"application/octet-stream"}function Ft(t){return t.reduce((e,a)=>e+a.size,0)}function zt(t){if(t<1024)return`${t} B`;if(t<1048576)return`${(t/1024).toFixed(1)} KB`;return`${(t/1048576).toFixed(2)} MB`}class In extends Error{code;constructor(t,e){super(t);this.name="ImageProcessingError",this.code=e}}
|
|
3
|
+
export{j,B,F,Nt,J,se,Pn,ia,Pe,dt,Lt,jt,Bt,z,Ft,zt,In};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{p,l}from"./chunk-
|
|
3
|
-
export{
|
|
2
|
+
import{p,l}from"./chunk-2pph3dh0.js";import{b}from"./chunk-5f7qy42x.js";function y(t,o){let i=1,r=o,e="<template",n="</template";while(r<t.length&&i>0){let s=t.indexOf("<",r);if(s===-1)break;if(r=s,t.startsWith(e,r)&&(r+e.length>=t.length||/[\s>\/]/.test(t[r+e.length]))){i++,r+=e.length;continue}if(t.startsWith(n,r)){let a=t.indexOf(">",r+n.length);if(a!==-1){if(i--,i===0)return a+1;r=a+1;continue}}r++}return i===0?r:-1}var w=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function x(t,o){let i=null;for(let r=o;r<t.length;r++){let e=t[r];if(i){if(e==="\\"){r++;continue}if(e===i)i=null;continue}if(e==='"'||e==="'"){i=e;continue}if(e===">")return r+1}return-1}function N(t,o,i){let r=o.toLowerCase(),e=1,n=i;while(n<t.length){let s=t.indexOf("<",n);if(s===-1)return-1;if(t.startsWith("<!--",s)){let g=t.indexOf("-->",s+4);n=g===-1?t.length:g+3;continue}let a=x(t,s+1);if(a===-1)return-1;let f=t.slice(s,a),u=f.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(u&&u[2].toLowerCase()===r){if(u[1]==="/"){if(e--,e===0)return a}else if(!/\/\s*>$/.test(f))e++}n=a}return-1}function A(t){let o=[],i=[],r=/\bslot\s*=\s*(?:"([^"]+)"|'([^']+)')/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let c=t.indexOf("-->",n+4);e=c===-1?t.length:c+3;continue}let s=x(t,n+1);if(s===-1)break;let a=t.slice(n,s),f=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!f){e=s;continue}let u=f[2].toLowerCase();if(f[1]==="/"){let c=i.lastIndexOf(u);if(c!==-1)i.splice(c);e=s;continue}let g=/\/\s*>$/.test(a),d=i.length===0?a.match(r):null;if(d){let c=d[1]||d[2],m=a.replace(r,"").replace(/\s+(?=\/?>$)/,"").replace(/\s{2,}/g," "),h=g||w.has(u)?-1:N(t,u,s);if(h===-1)o.push({start:n,end:s,slotName:c,element:m}),e=s;else o.push({start:n,end:h,slotName:c,element:m+t.slice(s,h)}),e=h;continue}if(!g&&!w.has(u)){if(i.push(u),u==="script"||u==="style"){let c=t.toLowerCase().indexOf(`</${u}>`,s);if(c!==-1){e=c;continue}}}e=s}return o}function O(t){let o=[],i=[],r=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let c=t.indexOf("-->",n+4);e=c===-1?t.length:c+3;continue}let s=x(t,n+1);if(s===-1)break;let a=t.slice(n,s),f=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!f){e=s;continue}let u=f[1]==="/",g=f[2].toLowerCase();if(u){let c=i.lastIndexOf(g);if(c!==-1)i.splice(c);e=s;continue}if(g==="template"&&i.length===0){let c=a.match(r);if(c){let m=y(t,s);if(m!==-1){let h=c[1]||c[2]||c[3];o.push({start:n,end:m,slotName:h,content:t.slice(s,m-11).trim(),propsBinding:c[4]||void 0}),e=m;continue}}}if(!/\/\s*>$/.test(a)&&!w.has(g)){if(i.push(g),g==="script"||g==="style"){let c=t.toLowerCase().indexOf(`</${g}>`,s);if(c!==-1){e=c;continue}}}e=s}return o}function aa(t){let o={default:"",named:new Map},i=t,r=O(t);for(let n of r)o.named.set(n.slotName,{name:n.slotName,content:n.content,propsBinding:n.propsBinding});r.sort((n,s)=>s.start-n.start);for(let n of r)i=i.slice(0,n.start)+i.slice(n.end);let e=A(i);for(let n of e){let s=o.named.get(n.slotName);if(s)s.content+=n.element;else o.named.set(n.slotName,{name:n.slotName,content:n.element})}for(let n=e.length-1;n>=0;n--){let s=e[n];i=i.slice(0,s.start)+i.slice(s.end)}return o.default=i.trim(),o}function xl(t){let o=t.match(/name\s*=\s*["']([^"']+)["']/),i=o?o[1]:"",r={},e=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,n;while((n=e.exec(t))!==null)r[n[1]]=n[2];let s=t.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),a=s?s[1].trim():"";return{name:i,props:r,defaultContent:a}}async function ca(t,o,i,r){if(!t)return i;let e=t.content;if(t.propsBinding&&Object.keys(o).length>0){let n=t.propsBinding.trim(),s={...r};if(n.startsWith("{")&&n.endsWith("}")){let a=n.slice(1,-1).split(",").map((f)=>f.trim()).filter(Boolean);for(let f of a){let[u,g]=f.split(":").map((c)=>c.trim()),d=g||u;if(o[u]!==void 0)s[d]=o[u]}}else s[n]=o;e=C(e,s)}return e}function C(t,o){return t.replace(/\{\{\s*([^}]+)\s*\}\}/g,(i,r)=>{try{let e=r.trim(),n=k(e,o);return b(String(n??""))}catch{return`{{ ${r} }}`}})}function k(t,o){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(t)){let r=t.split("."),e=o;for(let n of r)if(e&&typeof e==="object"&&n in e)e=e[n];else return;return e}let i=t.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(i){let[,r,e,n]=i,s=o[r],a=parseInt(n,10);if(typeof s==="number")switch(e){case"+":return s+a;case"-":return s-a;case"*":return s*a;case"/":return s/a}}try{if(!p(t))return;return l(t,Object.keys(o))(...Object.values(o))}catch{return}}async function la(t,o,i){let r=t;r=await M(r,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(s,a,f,u)=>{let g=o.named.get(a),d=u?.trim()||"",c=f||"",m={},h=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,S;while((S=h.exec(c))!==null){let E=S[1],R=S[2];m[E]=k(R,i)}return await ca(g,m,d,i)});let n=/<slot\b((?:"[^"]*"|'[^']*'|[^>"'])*?)\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return r=r.replace(n,(s,a,f)=>{if(/\bname\s*=/.test(a||""))return s;let u=f?.trim()||"";return o.default||u}),r}async function M(t,o,i){let r=[],e=[];t.replace(o,(a,...f)=>{let u=f[f.length-2];return e.push({match:a,index:u}),r.push(i(a,...f.slice(0,-2))),a});let n=await Promise.all(r),s=t;for(let a=e.length-1;a>=0;a--){let{match:f,index:u}=e[a];s=s.slice(0,u)+n[a]+s.slice(u+f.length)}return s}function Sl(t){let o=aa(t);return{defaultSlot:o.default,namedSlots:o.named}}async function kl(t,o,i,r){return await la(t,{default:o,named:i},r)}
|
|
3
|
+
export{aa,xl,ca,la,Sl,kl};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import a from"fs";function Ie(r){return o(r)}var g=1000,i=new Map;function qt(){i.clear()}function o(r){return[...r].sort().map((n)=>{try{let t=a.statSync(n);return`${n}:${t.size}:${t.mtimeMs}`}catch{return`${n}:missing`}}).join(`
|
|
3
|
+
`)}function pt(r,n,t){let e=r.get(n);return e!==void 0&&e.signature===t?e.value:void 0}function H(r,n,t,e){return r.set(n,{signature:t,value:e}),e}
|
|
4
|
+
export{Ie,qt,pt,H};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{o}from"./chunk-
|
|
3
|
-
export{
|
|
2
|
+
import{o}from"./chunk-5f7qy42x.js";import{Er}from"./chunk-7cbtcdqw.js";import p from"path";async function wl(t={}){let d=performance.now(),s=t.root||process.cwd(),e=await o(s),u=t.ssr?.routeRules??e.routeRules??{};if(Er(u),!e.ssr&&Object.keys(u).length)throw Error("routeRules require ssr: true and the production server; flat SSG output cannot apply request/cache policies");if(!e.ssr&&(t.ssr?.serverApi??e.serverApi))throw Error("serverApi requires ssr: true; flat SSG output cannot execute API endpoints");let r=e.ssr?"ssr":"ssg";console.log(`[stx build] Mode: ${r.toUpperCase()}${e.ssr?" (ssr: true in stx.config.ts)":" (default \u2014 ssr is false)"}`);let n,l;if(r==="ssg"){let{generateStaticSite:i}=await import("./ssg.js");n=await i({pagesDir:p.join(e.root||".",e.pagesDir||e.build?.pagesDir||"pages"),publicDir:e.publicDir||e.build?.publicDir||"public",outputDir:e.build?.outputDir||"dist",generate404:e.build?.generate404??!0,minify:e.build?.minify??!0,cleanOutput:e.build?.cleanOutput??!0,router:e.router,...t.ssg})}else{let{buildForProduction:i}=await import("./chunk-g7jcpd5j.js");l=await i({root:s,outputDir:".output",debug:t.debug,...t.ssr})}let a=Math.round(performance.now()-d);return{mode:r,ssg:n,ssr:l,duration:a}}
|
|
3
|
+
export{wl};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
function t(n){if(!n||typeof n!=="object")return!1;let i=n;return typeof i.message==="string"&&(i.name==="BuildMessage"||i.name==="ResolveMessage"||("position"in i))}function o(n){if(n&&typeof n==="object"&&Array.isArray(n.errors))return n.errors;return[n]}function
|
|
2
|
+
function t(n){if(!n||typeof n!=="object")return!1;let i=n;return typeof i.message==="string"&&(i.name==="BuildMessage"||i.name==="ResolveMessage"||("position"in i))}function o(n){if(n&&typeof n==="object"&&Array.isArray(n.errors))return n.errors;return[n]}function en(n,i){let e=[];for(let r of o(n)){if(t(r)){let s=r.position||void 0;e.push({file:i||s?.file,line:s?.line,column:s?.column,message:r.message??"",lineText:s?.lineText});continue}e.push({file:i,message:r instanceof Error?r.message:String(r)})}return e}function ae(n,i){return en(n,i).map((e)=>{let r=e.file?`${e.file}${e.line?`:${e.line}${e.column?`:${e.column}`:""}`:""}`:"",s=e.lineText?`
|
|
3
3
|
${e.lineText.trim()}`:"";return r?`${r}: ${e.message}${s}`:`${e.message}${s}`}).join(`
|
|
4
|
-
`)}export{
|
|
4
|
+
`)}export{en,ae};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var w={black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",brightRed:"\x1B[91m",brightGreen:"\x1B[92m",brightYellow:"\x1B[93m",brightBlue:"\x1B[94m",brightMagenta:"\x1B[95m",brightCyan:"\x1B[96m",brightWhite:"\x1B[97m"},R={bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",underline:"\x1B[4m",inverse:"\x1B[7m",strikethrough:"\x1B[9m"};function p(e,t){return`${w[t]}${e}\x1B[0m`}function C(e,t){return`${R[t]}${e}\x1B[0m`}var b=(e)=>p(e,"red"),S=(e)=>p(e,"green"),y=(e)=>p(e,"yellow"),O=(e)=>p(e,"blue");var c=(e)=>p(e,"cyan");var a=(e)=>C(e,"bold"),m=(e)=>C(e,"dim");function
|
|
3
|
-
export{
|
|
2
|
+
var w={black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",brightRed:"\x1B[91m",brightGreen:"\x1B[92m",brightYellow:"\x1B[93m",brightBlue:"\x1B[94m",brightMagenta:"\x1B[95m",brightCyan:"\x1B[96m",brightWhite:"\x1B[97m"},R={bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",underline:"\x1B[4m",inverse:"\x1B[7m",strikethrough:"\x1B[9m"};function p(e,t){return`${w[t]}${e}\x1B[0m`}function C(e,t){return`${R[t]}${e}\x1B[0m`}var b=(e)=>p(e,"red"),S=(e)=>p(e,"green"),y=(e)=>p(e,"yellow"),O=(e)=>p(e,"blue");var c=(e)=>p(e,"cyan");var a=(e)=>C(e,"bold"),m=(e)=>C(e,"dim");function it(){console.log(""),console.log(c(" \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")),console.log(c(" \u2551")+a(" \uD83D\uDCD6 STX Story ")+c("\u2551")),console.log(c(" \u2551")+m(" Component Showcase & Testing ")+c("\u2551")),console.log(c(" \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")),console.log("")}function gr(e,t){if(console.log(a(" Server running at:")),console.log(""),console.log(` ${m("\u279C")} ${a("Local:")} ${c(e)}`),t)console.log(` ${m("\u279C")} ${a("Network:")} ${c(t)}`);console.log("")}function at(e){let t=e>0?"\u2713":"\u25CB",r=e>0?S:y;console.log(` ${r(t)} Found ${a(String(e))} story ${e===1?"file":"files"}`)}function Vs(e,t){if(console.log(""),console.log(` ${b("\u2717")} ${a(b("Error:"))} ${e}`),t)console.log(` ${m(t)}`);console.log("")}function $e(e){console.log(` ${y("\u26A0")} ${y("Warning:")} ${e}`)}function Us(e){console.log(` ${O("\u2139")} ${e}`)}function Ws(e,t,r){console.log(""),console.log(c(" \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")),console.log(c(" \u2551")+a(" Build Complete ")+c("\u2551")),console.log(c(" \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")),console.log(""),console.log(` ${S("\u2713")} Stories: ${a(String(e))}`),console.log(` ${S("\u2713")} Output: ${a(t)}`),console.log(` ${S("\u2713")} Time: ${a(`${r}ms`)}`),console.log("")}function mr(){console.log(""),console.log(a(" Keyboard Shortcuts:")),console.log(""),console.log(` ${c("h")} Show this help`),console.log(` ${c("o")} Open in browser`),console.log(` ${c("r")} Restart server`),console.log(` ${c("c")} Clear console`),console.log(` ${c("q")} Quit`),console.log("")}import h from"fs";import d from"path";async function ct(e){let{root:t,config:r}=e,o=[],i=await P(t,r.storyMatch,r.storyIgnored);for(let s of i){let n=d.resolve(t,s),l=v(s,n);o.push(l)}return o}async function P(e,t,r){let o=[];async function i(s,n){let l=await h.promises.readdir(s,{withFileTypes:!0});for(let g of l){let f=d.join(s,g.name),u=d.relative(n,f);if(T(u,r))continue;if(g.isDirectory())await i(f,n);else if(g.isFile()){if(F(u,t))o.push(u)}}}return await i(e,e),o}function T(e,t){for(let r of t)if(E(e,r))return!0;return!1}function F(e,t){for(let r of t)if(E(e,r))return!0;return!1}function E(e,t){let r=e.replace(/\\/g,"/"),i=t.replace(/\\/g,"/").replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"{{GLOBSTAR}}").replace(/\*/g,"[^/]*").replace(/\?/g,".").replace(/\{\{GLOBSTAR\}\}/g,".*");return i=`^${i}$`,new RegExp(i).test(r)}function v(e,t){let r=d.basename(e,".story.stx");return{id:e.toLowerCase().replace(/\.story\.stx$/,"").replace(/[/\\]/g,"-").replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,""),path:t,relativePath:e,fileName:r,treeFile:{title:r,path:e}}}function qs(e,t){let{root:r,config:o}=e,i=[],s=h.watch(r,{recursive:!0},async(n,l)=>{if(!l)return;let g=l.replace(/\\/g,"/");if(!F(g,o.storyMatch))return;if(T(g,o.storyIgnored))return;let f=d.resolve(r,g);try{await h.promises.access(f);let u=v(g,f);t(n==="rename"?"add":"change",u)}catch{let u=v(g,f);t("unlink",u)}});return i.push(s),()=>{for(let n of i)n.close()}}function N(e,t){let r=t.treeFile||{title:t.fileName,path:t.relativePath};if(e.tree.file==="title")return r.title.split("/");if(e.tree.file==="path")return[...t.relativePath.split("/").slice(0,-1),r.title];if(typeof e.tree.file==="function")return e.tree.file(r);return[r.title]}function lt(e,t){for(let n of t)n.treePath=N(e,n);let r=(e.tree.groups||[]).map((n)=>({groupConfig:{id:n.id||n.title,title:n.title,include:n.include},treeObject:{}})),o={treeObject:{}};r.push(o);for(let n=0;n<t.length;n++){let l=t[n],g=j(l,r,o);k(l.treePath,n,g.treeObject)}let i=e.tree.order==="asc"?(n,l)=>n.localeCompare(l):e.tree.order,s=[];for(let n of r)if(n===o)s.push(...x(n.treeObject,i));else if(n.groupConfig&&Object.keys(n.treeObject).length>0)s.push({group:!0,id:n.groupConfig.id,title:n.groupConfig.title,children:x(n.treeObject,i)});return s}function j(e,t,r){let o=e.treeFile||{title:e.fileName,path:e.relativePath};for(let i of t)if(i.groupConfig?.include&&i.groupConfig.include(o))return i;return r}function k(e,t,r){let o=r;for(let i=0;i<e.length;i++){let s=e[i];if(i===e.length-1)if(o[s]!==void 0){let l=1;while(o[`${s}-${l}`]!==void 0)l++;o[`${s}-${l}`]=t}else o[s]=t;else{if(o[s]===void 0)o[s]={};else if(typeof o[s]==="number"){let l=o[s];o[s]={"":l}}o=o[s]}}}function x(e,t){let r=[];for(let[o,i]of Object.entries(e))if(typeof i==="number")r.push({title:o,index:i});else r.push({title:o,children:x(i,t)});return r.sort((o,i)=>t(o.title,i.title)),r}
|
|
3
|
+
export{it,gr,at,Vs,$e,Us,Ws,mr,ct,qs,lt};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{O}from"./chunk-
|
|
2
|
+
import{O}from"./chunk-hktvv0hd.js";var t={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603};function N(e){for(let[r,n]of Object.entries(t))if(n===e)return r;return}import ee from"path";var re={showRelativePaths:!1,enableAutoRecovery:O(),logRecoveryWarnings:!0},P={...re};function R(){return{...P}}function k(e){if(!P.showRelativePaths||!e)return e;let r=P.baseDir||process.cwd();try{let n=ee.relative(r,e);return n.startsWith("..")?e:n}catch{return e}}class v extends Error{code;filePath;line;column;context;numericCode;constructor(e,r,n,o,s,a,g){super(e);this.code=r;this.filePath=n;this.line=o;this.column=s;this.context=a;if(this.name="StxError",this.numericCode=g||t.EVALUATION_ERROR,this.filePath)this.filePath=k(this.filePath)}}class X extends v{constructor(e,r,n,o,s,a){super(e,"stx_RUNTIME_ERROR",r,n,o,s,a||t.EVALUATION_ERROR);this.name="StxRuntimeError"}}class yn extends v{constructor(e,r,n,o,s,a){super(e,"stx_FILE_ERROR",r,n,o,s,a||t.FILE_NOT_FOUND);this.name="StxFileError"}}class ir extends v{isFatal=!0;constructor(e,r,n,o,s,a){super(e,"stx_VALIDATION_ERROR",r,n,o,s,a||t.DOM_API_VIOLATION);this.name="StxValidationError"}}function U(e){let{type:r,message:n,code:o,filePath:s,line:a,column:g,template:u,offset:d,snippet:f,suggestion:m,format:h="text"}=e,E=a,x=g;if(!E&&u&&d!==void 0){let z=ce(u,d);E=z.line,x=z.column}let y=s?k(s):void 0,K=o?N(o):void 0,w={type:r,code:o,codeName:K,message:n,filePath:y,line:E,column:x,snippet:f,suggestion:m,timestamp:new Date().toISOString()},S;switch(h){case"html":S=oe(w);break;case"json":S=JSON.stringify(w,null,2);break;case"console":S=ie(w,u,d);break;case"text":default:S=ne(w,u,d);break}return{formatted:S,data:w}}function ne(e,r,n){let o=[],s=e.code?` [${e.codeName||e.code}]`:"";if(o.push(`[${e.type} Error${s}]`),e.filePath){let a=e.filePath;if(e.line){if(a+=`:${e.line}`,e.column)a+=`:${e.column}`}o.push(`at ${a}`)}if(o.push(`
|
|
3
3
|
${e.message}`),r&&e.line){let a=se(r,e.line,2);if(a)o.push(`
|
|
4
4
|
${a}`)}if(e.snippet)o.push(`
|
|
5
5
|
Snippet: ${e.snippet}`);if(e.suggestion)o.push(`
|
|
@@ -17,15 +17,15 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
|
|
|
17
17
|
`)}function ae(e,r,n){let o=e.split(`
|
|
18
18
|
`),s=Math.max(0,r-n-1),a=Math.min(o.length-1,r+n-1),g="\x1B[90m",u="\x1B[31m",d="\x1B[0m",f=[];for(let m=s;m<=a;m++){let h=(m+1).toString().padStart(4),E=m===r-1,x=E?"\x1B[31m>\x1B[0m":" ",y=E?`\x1B[31m${o[m]}\x1B[0m`:`\x1B[90m${o[m]}\x1B[0m`;f.push(`${x}\x1B[90m${h}\x1B[0m | ${y}`)}return f.join(`
|
|
19
19
|
`)}function M(e){return e.replace(/--/g,"- -").replace(/>/g,">")}function ce(e,r){let o=e.substring(0,r).split(`
|
|
20
|
-
`);return{line:o.length,column:o[o.length-1].length}}function i(e,r,n){return U({type:e,message:r,code:n,format:"html"}).formatted}async function te(e,r,n){try{return await e()}catch(o){if(n&&o instanceof Error)n(o);return r}}var
|
|
20
|
+
`);return{line:o.length,column:o[o.length-1].length}}function i(e,r,n){return U({type:e,message:r,code:n,format:"html"}).formatted}async function te(e,r,n){try{return await e()}catch(o){if(n&&o instanceof Error)n(o);return r}}var Os={isEnabled(){return R().enableAutoRecovery},fixCommonSyntaxErrors(e){let r=R();if(!r.enableAutoRecovery)return{fixed:e,fixes:[]};let n=e,o=[],s=(n.match(/\{\{/g)||[]).length,a=(n.match(/\}\}/g)||[]).length;if(s>a){let u=s-a;n+="}}".repeat(u),o.push(`Added ${u} missing closing braces '}}'`)}let g=["if","foreach","for","switch","section"];for(let u of g){let d=(n.match(new RegExp(`@${u}\\b`,"g"))||[]).length,f=(n.match(new RegExp(`@end${u}\\b`,"g"))||[]).length;if(d>f){let m=d-f;for(let h=0;h<m;h++)n+=`
|
|
21
21
|
@end${u}`;o.push(`Added ${m} missing @end${u}`)}}if(o.length>0&&r.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),o.forEach((u)=>console.warn(` - ${u}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:n,fixes:o}},createFallbackContent(e,r){if(O())return`<!-- ${e} failed: ${r.message} -->`;return"<!-- stx rendering error -->"}};class L{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor(e={}){this.maxErrors=e.maxErrors??1000,this.enableFileLogging=e.enableFileLogging??!1,this.logFilePath=e.logFilePath??".stx/errors.log",this.logFormat=e.logFormat??"json",this.maxFileSize=e.maxFileSize??10485760,this.maxLogFiles=e.maxLogFiles??5,this.minLevel=e.minLevel??"all"}configure(e){if(e.maxErrors!==void 0)this.maxErrors=e.maxErrors;if(e.enableFileLogging!==void 0)this.enableFileLogging=e.enableFileLogging;if(e.logFilePath!==void 0)this.logFilePath=e.logFilePath;if(e.logFormat!==void 0)this.logFormat=e.logFormat;if(e.maxFileSize!==void 0)this.maxFileSize=e.maxFileSize;if(e.maxLogFiles!==void 0)this.maxLogFiles=e.maxLogFiles;if(e.minLevel!==void 0)this.minLevel=e.minLevel}log(e,r,n="error"){let o={timestamp:new Date,error:e,context:r,level:n};if(this.errors.push(o),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(n))this.writeToFile(o)}shouldLog(e){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return e==="error"||e==="warning";if(this.minLevel==="error")return e==="error";return!0}formatEntry(e){if(this.logFormat==="json")return JSON.stringify({timestamp:e.timestamp.toISOString(),level:e.level||"error",type:e.error.constructor.name,message:e.error.message,stack:e.error.stack,context:e.context});let r=[`[${e.timestamp.toISOString()}] [${(e.level||"error").toUpperCase()}] ${e.error.constructor.name}: ${e.error.message}`];if(e.error.stack)r.push(` Stack: ${e.error.stack.split(`
|
|
22
22
|
`).slice(1).join(`
|
|
23
23
|
`)}`);if(e.context)r.push(` Context: ${JSON.stringify(e.context)}`);return r.join(`
|
|
24
24
|
`)}writeToFile(e){this.writeQueue=this.writeQueue.then(async()=>{try{let r=await import("fs"),n=await import("path"),o=n.dirname(this.logFilePath);if(!r.existsSync(o))r.mkdirSync(o,{recursive:!0});await this.rotateIfNeeded(r);let s=`${this.formatEntry(e)}
|
|
25
25
|
`;r.appendFileSync(this.logFilePath,s,"utf-8")}catch(r){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",r)}})}async rotateIfNeeded(e){try{if(!e.existsSync(this.logFilePath))return;if(e.statSync(this.logFilePath).size<this.maxFileSize)return;for(let n=this.maxLogFiles-1;n>=1;n--){let o=`${this.logFilePath}.${n}`,s=`${this.logFilePath}.${n+1}`;if(e.existsSync(o))if(n>=this.maxLogFiles-1)e.unlinkSync(o);else e.renameSync(o,s)}if(this.maxLogFiles<=1)e.writeFileSync(this.logFilePath,"");else e.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch(r){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",r)}}getRecentErrors(e=10){return this.errors.slice(-e)}getErrorsByType(e){return this.errors.filter((r)=>r.error.constructor.name===e)}getErrorsByLevel(e){return this.errors.filter((r)=>r.level===e)}clear(){this.errors.length=0}async clearLogFile(){try{let e=await import("fs");if(e.existsSync(this.logFilePath))e.writeFileSync(this.logFilePath,"","utf-8")}catch(e){if(process.env.STX_DEBUG==="true")console.error("Failed to clear error log:",e)}}getStats(){let e={},r={error:0,warning:0,info:0};for(let n of this.errors){let o=n.error.constructor.name;e[o]=(e[o]||0)+1;let s=n.level||"error";r[s]=(r[s]||0)+1}return{total:this.errors.length,byType:e,byLevel:r}}async exportToFile(e,r="json"){let n=await import("fs"),o=await import("path"),s=o.dirname(e);if(!n.existsSync(s))n.mkdirSync(s,{recursive:!0});if(r==="json"){let a=this.errors.map((g)=>({timestamp:g.timestamp.toISOString(),level:g.level||"error",type:g.error.constructor.name,message:g.error.message,stack:g.error.stack,context:g.context}));n.writeFileSync(e,JSON.stringify(a,null,2),"utf-8")}else{let a=this.errors.map((g)=>this.formatEntry(g));n.writeFileSync(e,a.join(`
|
|
26
26
|
|
|
27
|
-
`),"utf-8")}}async flush(){await this.writeQueue}}var A=new L,
|
|
28
|
-
`)}};var le={maxSanitizeDepth:10,allowBracketNotation:!1},G={...le};var C=/\bnew\s+/,F="__stx_safe_ctors",H=[/\b(eval|Function|setTimeout|setInterval|setImmediate)\b/,/\b(process|require|import|exports|module)\b/,/\b(window|document|global|globalThis)\b/,/\b(constructor|prototype|__proto__)\b/,/\b(Reflect|Proxy)\b/,/\bSymbol\b/,/\b(WeakMap|WeakSet|WeakRef|FinalizationRegistry)\b/,/\b(Generator|AsyncGenerator)\b/,/__\w+__/,/\.(bind|call|apply)\s*\(/,C,/\bdelete\s+/,/\bthis\b/],ue=new Set(["eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this",F]),q=new Set(["__proto__","constructor","prototype"]),ge=/[\w)\]]\s*\[\s*['"]/;function J(e){let r="",n=[],o=null,s=!1;for(let a=0;a<e.length;a++){let g=e[a];if(s){s=!1;continue}if(g==="\\"&&o){s=!0;continue}if(o){if(o==="`"&&g==="$"&&a+1<e.length&&e[a+1]==="{"){let u=1;a+=2;while(a<e.length&&u>0){if(e[a]==="{")u++;else if(e[a]==="}")u--;if(u>0)r+=e[a],n.push(a),a++}continue}if(g===o)o=null;continue}if(g==='"'||g==="'"||g==="`"){o=g;continue}r+=g,n.push(a)}return{text:r,map:n}}function fe(e){return J(e).text}var Y=["Collator","DateTimeFormat","DisplayNames","ListFormat","Locale","NumberFormat","PluralRules","RelativeTimeFormat","Segmenter"],Z=(()=>{let e={Date,URL,URLSearchParams},r=Intl;for(let n of Y)if(typeof r[n]==="function")e[`Intl_${n}`]=r[n];return Object.freeze(Object.assign(Object.create(null),e))})(),me=/^new(\s+)(Date|URLSearchParams|URL|Intl\s*\.\s*([A-Z_a-z]\w*))\s*\(/,j=/(?<![\w$])new(?![\w$])/g,B=`only new Date(), new URL(), new URLSearchParams() and new Intl.{${Y.join(",")}}() are allowed`;function pe(e){let{text:r,map:n}=J(e),o=[];j.lastIndex=0;let s;while((s=j.exec(r))!==null){let g=s.index;if(/(?<!\.)\.\s*$/.test(r.slice(0,g)))continue;let u=me.exec(r.slice(g)),d=u?.[3],f=!u?null:d?`Intl_${d}`:u[2];if(!u||!f||!(f in Z))throw new b(`matched /${C.source}/; ${B}`,e);let m=g+u[0].length,h=n[g],E=n[m-1]+1;if(e.slice(h,E)!==r.slice(g,m))throw new b(`matched /${C.source}/; ${B}`,e);let x=h+3+u[1].length;o.push({start:x,end:x+u[2].length,key:f})}let a=e;for(let g=o.length-1;g>=0;g--){let u=o[g];a=`${a.slice(0,u.start)}${F}.${u.key}${a.slice(u.end)}`}return{source:a,usesSafeConstructors:o.length>0}}class b extends Error{rule;expression;constructor(e,r,n){super(n??`Potentially unsafe expression (${e}): ${r}`);this.name="UnsafeExpressionError",this.rule=e,this.expression=r}}function
|
|
27
|
+
`),"utf-8")}}async flush(){await this.writeQueue}}var A=new L,Rt={isDevelopment(){return O()},logDetailedError(e,r){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",e.message),console.error("Stack:",e.stack),r)console.error("Context:",r);console.error("========================")},createErrorReport(e,r){let n=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${e.message}`,`Type: ${e.constructor.name}`,`Stack: ${e.stack}`];if(r)n.push(`Context: ${JSON.stringify(r,null,2)}`);return n.push("========================"),n.join(`
|
|
28
|
+
`)}};var le={maxSanitizeDepth:10,allowBracketNotation:!1},G={...le};var C=/\bnew\s+/,F="__stx_safe_ctors",H=[/\b(eval|Function|setTimeout|setInterval|setImmediate)\b/,/\b(process|require|import|exports|module)\b/,/\b(window|document|global|globalThis)\b/,/\b(constructor|prototype|__proto__)\b/,/\b(Reflect|Proxy)\b/,/\bSymbol\b/,/\b(WeakMap|WeakSet|WeakRef|FinalizationRegistry)\b/,/\b(Generator|AsyncGenerator)\b/,/__\w+__/,/\.(bind|call|apply)\s*\(/,C,/\bdelete\s+/,/\bthis\b/],ue=new Set(["eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this",F]),q=new Set(["__proto__","constructor","prototype"]),ge=/[\w)\]]\s*\[\s*['"]/;function J(e){let r="",n=[],o=null,s=!1;for(let a=0;a<e.length;a++){let g=e[a];if(s){s=!1;continue}if(g==="\\"&&o){s=!0;continue}if(o){if(o==="`"&&g==="$"&&a+1<e.length&&e[a+1]==="{"){let u=1;a+=2;while(a<e.length&&u>0){if(e[a]==="{")u++;else if(e[a]==="}")u--;if(u>0)r+=e[a],n.push(a),a++}continue}if(g===o)o=null;continue}if(g==='"'||g==="'"||g==="`"){o=g;continue}r+=g,n.push(a)}return{text:r,map:n}}function fe(e){return J(e).text}var Y=["Collator","DateTimeFormat","DisplayNames","ListFormat","Locale","NumberFormat","PluralRules","RelativeTimeFormat","Segmenter"],Z=(()=>{let e={Date,URL,URLSearchParams},r=Intl;for(let n of Y)if(typeof r[n]==="function")e[`Intl_${n}`]=r[n];return Object.freeze(Object.assign(Object.create(null),e))})(),me=/^new(\s+)(Date|URLSearchParams|URL|Intl\s*\.\s*([A-Z_a-z]\w*))\s*\(/,j=/(?<![\w$])new(?![\w$])/g,B=`only new Date(), new URL(), new URLSearchParams() and new Intl.{${Y.join(",")}}() are allowed`;function pe(e){let{text:r,map:n}=J(e),o=[];j.lastIndex=0;let s;while((s=j.exec(r))!==null){let g=s.index;if(/(?<!\.)\.\s*$/.test(r.slice(0,g)))continue;let u=me.exec(r.slice(g)),d=u?.[3],f=!u?null:d?`Intl_${d}`:u[2];if(!u||!f||!(f in Z))throw new b(`matched /${C.source}/; ${B}`,e);let m=g+u[0].length,h=n[g],E=n[m-1]+1;if(e.slice(h,E)!==r.slice(g,m))throw new b(`matched /${C.source}/; ${B}`,e);let x=h+3+u[1].length;o.push({start:x,end:x+u[2].length,key:f})}let a=e;for(let g=o.length-1;g>=0;g--){let u=o[g];a=`${a.slice(0,u.start)}${F}.${u.key}${a.slice(u.end)}`}return{source:a,usesSafeConstructors:o.length>0}}class b extends Error{rule;expression;constructor(e,r,n){super(n??`Potentially unsafe expression (${e}): ${r}`);this.name="UnsafeExpressionError",this.rule=e,this.expression=r}}function bn(e){try{return T(e),null}catch(r){return r instanceof b?r.rule:r instanceof Error?r.message:String(r)}}function de(e,r){let n=/[$A-Z_a-z][$\w]*/g,o;while((o=n.exec(e))!==null){let s=o[0],a=e[o.index-1];if(ue.has(s))throw new b(`matched /\\b${s}\\b/; identifier ${s}`,r);if(a==="."&&q.has(s))throw new b(`matched /.${s}/; property ${s}`,r)}}function he(e){let r=/\[\s*(['"])(.*?)\1\s*\]/g,n;while((n=r.exec(e))!==null){let o=n[2];if(!q.has(o))continue;let s=e.slice(0,n.index).match(/\S(?=\s*$)/)?.[0],a=e.slice(n.index+n[0].length).match(/^\s*(\S)/)?.[1];if(!((s==="{"||s===",")&&a===":"))throw new b(`bracket key ${n[2]}`,e)}}function T(e){let r=e.trim(),n=fe(r);de(n,r),he(r);for(let o of H){if(o===C)continue;if(o.test(n))throw new b(`matched /${o.source}/`,r)}if(!G.allowBracketNotation&&ge.test(r))throw new b("bracket notation with a string key; enable with configureSafeEvaluator({ allowBracketNotation: true })",r,`Bracket notation with strings not allowed: ${r}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return pe(r)}function Ms(e){return T(e),e.trim()}function Ns(e){let r={};r.Math=Math,r.JSON=JSON,r.Date=Date,r.String=String,r.Number=Number,r.Boolean=Boolean,r.Array=Array,r.parseInt=Number.parseInt,r.parseFloat=Number.parseFloat,r.isNaN=Number.isNaN,r.isFinite=Number.isFinite,r.encodeURIComponent=encodeURIComponent,r.decodeURIComponent=decodeURIComponent;for(let[n,o]of Object.entries(e)){if(n.startsWith("__")||H.some((s)=>s.test(n)))continue;if(o&&typeof o==="object"&&!Array.isArray(o))r[n]=I(o);else r[n]=o}return r}function I(e,r=0){if(r>=G.maxSanitizeDepth)return"[Object too deep]";if(e===null||typeof e!=="object")return e;if(Array.isArray(e))return e.map((o)=>I(o,r+1));if(e instanceof Date||e instanceof RegExp||e instanceof Map||e instanceof Set||e instanceof Error)return e;let n={};for(let[o,s]of Object.entries(e)){if(o.startsWith("__")||o==="constructor"||o==="prototype")continue;if(s&&typeof s==="object")n[o]=I(s,r+1);else n[o]=s}return n}function c(e,r){try{let n=Ns(r),o=Object.keys(n),s=Object.values(n);return l(e,o)(...s)}catch{return}}function p(e){try{return Ms(e),!0}catch{return!1}}function D(e,r){try{let n=c(e,r);if(n&&typeof n==="object"&&!Array.isArray(n))return n;return{}}catch{return{}}}var Q=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","implements","interface","package","private","protected","public","arguments","eval","await"]),Ee=2000,_=new Map;function V(e,r){let n=`${e.join(",")}\x00${r}`,o=_.get(n);if(o)return o;let s=Function(...e,r);if(_.size>=Ee)_.clear();return _.set(n,s),s}function Se(e){return e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:)/g,"$1$2").match(/\b[a-zA-Z_$][\w$]*\b/g)||[]}var xe=/^[A-Za-z_$][\w$]*$/;function Ze(e){return xe.test(e)&&!Q.has(e)}function l(e,r){let{source:n,usesSafeConstructors:o}=T(e),s=[];for(let f=0;f<r.length;f++){if(!Ze(r[f]))continue;if(r[f]===F)continue;s.push({key:r[f],index:f})}s.sort((f,m)=>f.key.localeCompare(m.key));let a=s.map((f)=>f.key),g=s.map((f)=>f.index),u=`
|
|
29
29
|
'use strict';
|
|
30
30
|
try {
|
|
31
31
|
return ${n};
|
|
@@ -36,5 +36,5 @@ catch (e) {
|
|
|
36
36
|
}
|
|
37
37
|
throw e;
|
|
38
38
|
}
|
|
39
|
-
`;return
|
|
40
|
-
export{t,X,
|
|
39
|
+
`;return be(o?(f)=>{let m=V([F,...a,...f],u);return(...h)=>m(Z,...h)}:(f)=>V([...a,...f],u),a,r,s,g)}function be(e,r,n,o,s){let a=e([]),g=o.every((d,f)=>d.index===f);if(r.length===n.length&&g)return W(a,r,e);return W((...d)=>{let f=Array(s.length);for(let m=0;m<s.length;m++)f[m]=d[s[m]];return a(...f)},r,e,(d)=>{a=e(d)})}function W(e,r,n,o){let a=/^(\w+) is not defined$/,g=e,u=[],d=new Set(r);return(...f)=>{for(let m=0;m<=8;m++)try{return g(...f)}catch(h){let E=h instanceof Error?h.message:"",x=a.exec(E);if(!(h instanceof ReferenceError)||!x)return;let y=x[1];if(d.has(y)||Q.has(y))return;if(d.add(y),u.push(y),o)o(u);else g=n(u)}return}}function ar(e){let r=e.trim(),n=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let o of n)if(o.test(r))return!1;return!0}
|
|
40
|
+
export{t,X,yn,ir,i,te,Os,A,Rt,bn,Ms,Ns,c,p,D,Se,Ze,l,ar};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{G}from"./chunk-
|
|
3
|
-
`);if(!await Bun.file(o).exists()||await Bun.file(o).text()!==f)await Bun.write(o,f);return o}async function
|
|
4
|
-
`)}`);let p=e.outputs.find((c)=>c.kind==="entry-point");if(!p)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await p.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(l,n),p),f.push({...t,filePath:n})}return f}function E(s,l){let o=s.map((i)=>({route:i,...G(i.pattern)}));return async(i)=>{let f=new URL(i.url).pathname,t=o.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,p=(r)=>r.replace(/:\w+/g,":param"),u=t.filter((r)=>p(r.route.pattern)===p(e)),n=i.method,c=u.find((r)=>r.route.method===n)??(n==="HEAD"?u.find((r)=>r.route.method==="GET"):void 0);if(!c){let r=new Set(u.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=c.regex.exec(f),g=Object.create(null);try{c.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await l(c.route);if(typeof r!=="function")throw Error(`API endpoint ${c.route.filePath} must default-export a handler`);let h=await r(i,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function
|
|
5
|
-
`));let c=n.outputs.find((d)=>d.kind==="entry-point");if(!c||n.outputs.length!==1)throw Error(`Unsupported API bundle output: ${u.filePath}`);return(await import(`data:text/javascript;base64,${Buffer.from(await c.text()).toString("base64")}`)).default})(f))}catch(t){return console.error("[stx] API discovery failed:",t),Response.json({error:"API discovery failed; check the server log"},{status:500})}}}function
|
|
6
|
-
export{
|
|
2
|
+
import{G}from"./chunk-rmavqxd8.js";import{ue,C}from"./chunk-1erc0vrb.js";import{xi}from"./chunk-kp4mzspk.js";import{a}from"./chunk-jbj6xh7f.js";import v from"fs";import m from"path";import{pathToFileURL as I}from"url";var P=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],R=new Set;function wt(s,l={}){let o=m.resolve(s,l.dir??"server/api"),i=[],f=new Map;if(!v.existsSync(o))return i;let t=Array.from(new Bun.Glob("**/*.{ts,js,mts,mjs}").scanSync({cwd:o})).sort();for(let e of t){if(e.endsWith(".d.ts"))continue;let u=e.replace(/\.(?:ts|js|mts|mjs)$/,"").split("/"),n=u.pop(),c=n.lastIndexOf("."),d=c>=0?n.slice(c+1):"get",g=d.toUpperCase();if(!P.includes(g)||d!==d.toLowerCase())throw Error(`Unsupported API method suffix in ${e}; use ${P.map((A)=>A.toLowerCase()).join(", ")}`);if(c>=0)n=n.slice(0,c);if(n!=="index")u.push(n);let r=new Set,h=u.map((A,j)=>{let y=/^\[(\.\.\.)?([A-Za-z_]\w*)\]$/.exec(A);if(y){if(r.has(y[2])||y[1]&&j!==u.length-1)throw Error(`Invalid API parameter in ${e}`);return r.add(y[2]),`:${y[2]}${y[1]?"*":""}`}if(!/^[\w-]+$/.test(A))throw Error(`Unsupported API path segment ${A} in ${e}`);return A}),w=`/api${h.length?`/${h.join("/")}`:""}`,S=`${g} ${w.replace(/:\w+/g,":param")}`;if(f.has(S))throw Error(`Ambiguous API route ${g} ${w}: ${f.get(S)} and ${e}`);f.set(S,e);let x=m.join(o,e);R.add(m.resolve(x)),R.add(v.realpathSync(x)),i.push({pattern:w,method:g,filePath:x})}return i.sort((e,p)=>{let u=e.pattern.split("/"),n=p.pattern.split("/"),c=(d)=>d?.endsWith("*")?0:d?.startsWith(":")?1:2;for(let d=0;d<Math.max(u.length,n.length);d++){let g=c(n[d])-c(u[d]);if(g)return g}return e.pattern.localeCompare(p.pattern)||e.method.localeCompare(p.method)})}async function Wr(s,l){let o=a(s,"api-types.d.ts"),i=["// Generated by stx. Include this file in tsconfig.json.","declare module '@stacksjs/stx/api-client' {"," interface KnownApiRoutes {"];for(let t of l){let e=`./${m.relative(m.dirname(o),t.filePath).replace(/\\/g,"/")}`,{params:p}=G(t.pattern);i.push(` ${JSON.stringify(`${t.method} ${t.pattern}`)}: { params: { ${p.map((u)=>`${JSON.stringify(u)}: string`).join("; ")} }; response: Awaited<ReturnType<typeof import(${JSON.stringify(e)}).default>> }`)}i.push(" }","}","export {}","");let f=i.join(`
|
|
3
|
+
`);if(!await Bun.file(o).exists()||await Bun.file(o).text()!==f)await Bun.write(o,f);return o}async function qr(s,l,o={}){let i=wt(s,o);await Wr(s,i);let f=[];for(let t of i){let e=await Bun.build({entrypoints:[t.filePath],target:"bun",format:"esm",minify:!1,splitting:!1});if(!e.success)throw Error(`API build failed for ${t.filePath}: ${e.logs.join(`
|
|
4
|
+
`)}`);let p=e.outputs.find((c)=>c.kind==="entry-point");if(!p)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await p.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(l,n),p),f.push({...t,filePath:n})}return f}function E(s,l){let o=s.map((i)=>({route:i,...G(i.pattern)}));return async(i)=>{let f=new URL(i.url).pathname,t=o.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,p=(r)=>r.replace(/:\w+/g,":param"),u=t.filter((r)=>p(r.route.pattern)===p(e)),n=i.method,c=u.find((r)=>r.route.method===n)??(n==="HEAD"?u.find((r)=>r.route.method==="GET"):void 0);if(!c){let r=new Set(u.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=c.regex.exec(f),g=Object.create(null);try{c.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await l(c.route);if(typeof r!=="function")throw Error(`API endpoint ${c.route.filePath} must default-export a handler`);let h=await r(i,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function Kr(s,l){return E(l,async(o)=>(await import(I(m.resolve(s,o.filePath)).href)).default)}async function Tu(s,l){if(!l)return async()=>null;let o=l===!0?{}:l,i=wt(s,o);return await Wr(s,i),async(f)=>{if(!new URL(f.url).pathname.match(/^\/api(?:\/|$)/))return null;try{let t=wt(s,o);await Wr(s,t);let{loadStxConfig:e}=await import("./chunk-368zt1db.js"),p=C((await e(s)).runtimeConfig);return await ue(p,()=>E(t,async(u)=>{let n=await Bun.build({entrypoints:[u.filePath],target:"bun",format:"esm",splitting:!1});if(!n.success)throw Error(n.logs.join(`
|
|
5
|
+
`));let c=n.outputs.find((d)=>d.kind==="entry-point");if(!c||n.outputs.length!==1)throw Error(`Unsupported API bundle output: ${u.filePath}`);return(await import(`data:text/javascript;base64,${Buffer.from(await c.text()).toString("base64")}`)).default})(f))}catch(t){return console.error("[stx] API discovery failed:",t),Response.json({error:"API discovery failed; check the server log"},{status:500})}}}function Xr(s,l,o){if(xi(s))return!0;let i=/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/;if(i.test(m.basename(s)))return!0;try{if(i.test(m.basename(v.realpathSync(s))))return!0}catch{}if(R.has(m.resolve(s)))return!0;if(!o)return!1;let f=m.resolve(l,typeof o==="object"?o.dir??"server/api":"server/api"),t=(p)=>{try{return v.realpathSync(p)}catch{return m.resolve(p)}},e=t(s);return[f,m.resolve(l,"server"),m.resolve(l,".output/server")].some((p)=>{let u=t(p);return e===u||e.startsWith(`${u}${m.sep}`)})}
|
|
6
|
+
export{wt,Wr,qr,Kr,Tu,Xr};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{I,Nc,o,R,Yu,Zu}from"./chunk-5f7qy42x.js";import"./chunk-szry3s17.js";import"./chunk-c57j92td.js";import"./chunk-kp4mzspk.js";import"./chunk-nxxmhrd0.js";import"./chunk-1erc0vrb.js";import"./chunk-qmcmjdy7.js";import"./chunk-b77v56fz.js";import"./chunk-2pph3dh0.js";import"./chunk-d4k4nyj0.js";import"./chunk-v7vkqg8f.js";import"./chunk-rmavqxd8.js";import"./chunk-e6y6s7q8.js";export{R as config,I as defaultConfig,Yu as defineStxConfig,o as loadStxConfig,Nc as resolveStxDirectories,Zu as validateConfig};
|
|
@@ -159,7 +159,7 @@ else {
|
|
|
159
159
|
stxIslands.initIslands();
|
|
160
160
|
}
|
|
161
161
|
})();
|
|
162
|
-
</script>`}function b(e){let t=e.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(t)return t[1];let n=e.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(n)return n[1];return null}function w(e,t){let n={},r=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,i;while((i=r.exec(e))!==null){let d=i[1],o=i[2];if(o in t)n[d]=t[o];else n[d]=o}return n}function
|
|
162
|
+
</script>`}function b(e){let t=e.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(t)return t[1];let n=e.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(n)return n[1];return null}function w(e,t){let n={},r=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,i;while((i=r.exec(e))!==null){let d=i[1],o=i[2];if(o in t)n[d]=t[o];else n[d]=o}return n}function Sa(){let e=new Map;return{islands:e,register(t){e.set(t.id,t)},get(t){return e.get(t)},async hydrate(t){let n=e.get(t);if(!n||n.hydrated)return;if(n.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:t,component:n.component}}))},async hydrateAll(){let t=Array.from(e.values()).filter((n)=>!n.hydrated).map((n)=>this.hydrate(n.id));await Promise.all(t)}}}function I(e){return`
|
|
163
163
|
<script data-hydrate="${e}">
|
|
164
164
|
(function() {
|
|
165
165
|
const island = document.querySelector('[data-island="${e}"]');
|
|
@@ -311,7 +311,7 @@ else {
|
|
|
311
311
|
});
|
|
312
312
|
})();
|
|
313
313
|
</script>
|
|
314
|
-
`}function
|
|
314
|
+
`}function ka(e,t={},n){let r=e,i=!1,d=/@client:(load|idle|visible|media|only|hover|event)/i.test(e);if(r=u(r,"load",t),r=u(r,"idle",t),r=u(r,"visible",t),r=u(r,"media",t),r=M(r),r=u(r,"hover",t),r=u(r,"event",t),i=d&&r!==e,i)r+=`
|
|
315
315
|
`+v();return r}function u(e,t,n){let r=new RegExp(`@client:${t}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return e.replace(r,(i,d,o)=>{let a={strategy:t};if(d)try{let E=d.split(",").map((h)=>h.trim());for(let h of E){let[m,g]=h.split(":").map((p)=>p.trim());if(m&&g){let p=g.replace(/^['"]|['"]$/g,"");a[m]=p}}}catch{}let s=`island-${Math.random().toString(36).substring(2,9)}`,y=b(o.trim()),f=w(o.trim(),n),c=[];if(a.rootMargin)c.push(`data-root-margin="${a.rootMargin}"`);if(a.threshold!==void 0)c.push(`data-threshold="${a.threshold}"`);if(a.media)c.push(`data-media="${a.media}"`);if(a.event)c.push(`data-event="${a.event}"`);if(y)c.push(`data-component="${y}"`);let x=Object.keys(f).length>0?`
|
|
316
316
|
<script type="application/json" data-island-props="${s}">${JSON.stringify(f)}</script>`:"",l="";switch(t){case"load":l=I(s);break;case"idle":l=L(s,a);break;case"visible":l=C(s,a);break;case"media":l=S(s,a);break;case"hover":l=k(s);break;case"event":l=H(s,a);break}return`
|
|
317
317
|
<div data-island="${s}"
|
|
@@ -342,7 +342,7 @@ else {
|
|
|
342
342
|
}
|
|
343
343
|
})();
|
|
344
344
|
</script>
|
|
345
|
-
`})}function
|
|
345
|
+
`})}function Ca(){return`
|
|
346
346
|
/* Island base styles */
|
|
347
347
|
.stx-island {
|
|
348
348
|
display: contents;
|
|
@@ -383,9 +383,9 @@ else {
|
|
|
383
383
|
.stx-island.hydrated {
|
|
384
384
|
opacity: 1;
|
|
385
385
|
}
|
|
386
|
-
`}function
|
|
386
|
+
`}function $a(e){if(typeof window>"u")return;let t=document.querySelector(`[data-island="${e}"]`);if(!t||t.classList.contains("hydrated"))return;t.classList.add("hydrated"),t.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function Ea(e){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${e}"]:not(.hydrated)`).forEach((n)=>{n.classList.add("hydrated"),n.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function _a(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach((t)=>{t.classList.add("hydrated"),t.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function Ta(e){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${e}"]`)?.classList.contains("hydrated")??!1}function Ra(e){return new Promise((t)=>{if(typeof window>"u"){t();return}let n=document.querySelector(`[data-island="${e}"]`);if(!n){t();return}if(n.classList.contains("hydrated")){t();return}n.addEventListener("stx:hydrated",()=>t(),{once:!0})})}function Aa(e){return e.replace(/@static\s*([\s\S]*?)@endstatic/gi,(t,n)=>`<div class="stx-static">${n.trim()}</div>`)}function Pa(e){let t=e.map((n)=>({id:n.id,component:n.component,strategy:n.options.strategy,props:n.props}));return`
|
|
387
387
|
<script type="application/json" id="stx-island-manifest">
|
|
388
388
|
${JSON.stringify(t)}
|
|
389
389
|
</script>
|
|
390
|
-
`}var
|
|
391
|
-
export{
|
|
390
|
+
`}var Il={processPartialHydrationDirectives:ka,processStaticDirectives:Aa,generatePartialHydrationCSS:Ca,generateIslandManifest:Pa,createIslandRegistry:Sa,hydrateIsland:$a,hydrateByStrategy:Ea,hydrateAll:_a,isHydrated:Ta,onHydrated:Ra};
|
|
391
|
+
export{Sa,ka,Ca,$a,Ea,_a,Ta,Ra,Aa,Pa,Il};
|
|
@@ -45,12 +45,12 @@ var p=0;function f(){return`stx-teleport-${++p}`}function g(t){let e=t.split(","
|
|
|
45
45
|
});
|
|
46
46
|
})();
|
|
47
47
|
</script>
|
|
48
|
-
`}function
|
|
48
|
+
`}function jl(t,e,l){p=0;let o=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return t.replace(o,(r,s,d)=>{let a=f(),{target:u,disabled:n}=g(s),c=d.trim();if(n)try{let i=!1;if(n==="true")i=!0;else if(n==="false")i=!1;else if(n in e)i=Boolean(e[n]);if(i)return`<div class="stx-teleport-inline" data-teleport-disabled>${c}</div>`}catch{}let m=h(a,u);return`
|
|
49
49
|
<div id="${a}" class="stx-teleport-source" style="display: none;">
|
|
50
50
|
<template>${c}</template>
|
|
51
51
|
</div>
|
|
52
52
|
${m}
|
|
53
|
-
`})}function
|
|
53
|
+
`})}function Bl(){return`
|
|
54
54
|
<script>
|
|
55
55
|
(function() {
|
|
56
56
|
// Common teleport targets
|
|
@@ -68,4 +68,4 @@ var p=0;function f(){return`stx-teleport-${++p}`}function g(t){let e=t.split(","
|
|
|
68
68
|
})();
|
|
69
69
|
</script>
|
|
70
70
|
`}
|
|
71
|
-
export{
|
|
71
|
+
export{jl,Bl};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Xu,Ec,be,di,Gu,ms,hs,ys}from"./chunk-5f7qy42x.js";import"./chunk-szry3s17.js";import"./chunk-c57j92td.js";import"./chunk-kp4mzspk.js";import"./chunk-nxxmhrd0.js";import"./chunk-1erc0vrb.js";import"./chunk-qmcmjdy7.js";import"./chunk-b77v56fz.js";import"./chunk-2pph3dh0.js";import"./chunk-d4k4nyj0.js";import"./chunk-v7vkqg8f.js";import"./chunk-rmavqxd8.js";import"./chunk-e6y6s7q8.js";export{Gu as clearOnceStore,di as onceStore,be as partialsCache,ms as processIncludes,hs as processStackPushDirectives,ys as processStackReplacements,Xu as resetUnscopedSignalWarnings,Ec as topLevelElements};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{oe,
|
|
2
|
+
import{oe,gt,Ur}from"./chunk-hkjqqx92.js";function Ln(e,a){let t=e.pwa;if(!t?.enabled)return"";let c=t.serviceWorker||{},d=t.routes||[],i=c.cacheVersion||"1.0.0",o=t.offline,l=o?.page?"/offline.html":"/offline.html",{push:r,backgroundSync:s,cacheStorage:n}=t,u=a?oe(a,e):null,h=u?gt(u):"[]",f=["/","/manifest.json",...o?.enabled?[l]:[],...o?.precacheAssets||[]];return`/**
|
|
3
3
|
* Service Worker - Auto-generated by stx
|
|
4
4
|
* Cache Version: ${i}
|
|
5
5
|
*
|
|
@@ -13,7 +13,7 @@ import{oe,ft,Hr}from"./chunk-kp5tv8jx.js";function In(e,a){let t=e.pwa;if(!t?.en
|
|
|
13
13
|
* Additional features:
|
|
14
14
|
* - Push notifications: ${r?.enabled?"enabled":"disabled"}
|
|
15
15
|
* - Background sync: ${s?.enabled?"enabled":"disabled"}
|
|
16
|
-
* - Cache limits: ${n?.maxSize?`${
|
|
16
|
+
* - Cache limits: ${n?.maxSize?`${Ur(n.maxSize*1024*1024)}`:"unlimited"}
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
const CACHE_VERSION = '${i}';
|
|
@@ -825,5 +825,5 @@ self.addEventListener('message', (event) => {
|
|
|
825
825
|
event.waitUntil(registerFormSync(event.data.payload));
|
|
826
826
|
}
|
|
827
827
|
});
|
|
828
|
-
`}function
|
|
829
|
-
export{
|
|
828
|
+
`}function Oe(e){return e.pwa?.serviceWorker?.fileName||"sw.js"}function Bo(e){return e.pwa?.enabled===!0&&e.pwa?.serviceWorker?.useWorkbox===!0}function Wa(e,a){if(!e.pwa?.enabled)return"";if(Bo(e)){let{generateWorkboxServiceWorker:t}=import.meta.require("./chunk-hqvdm4h9.js");return t(e,a)}return Ln(e,a)}
|
|
829
|
+
export{Ln,Oe,Bo,Wa};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var l=new Map,u=new Map;function m(t){if(l.set(t.name,t),t.client)u.set(t.name,t.client)}function
|
|
3
|
-
export{
|
|
2
|
+
var l=new Map,u=new Map;function m(t){if(l.set(t.name,t),t.client)u.set(t.name,t.client)}function Ke(t){return m(t),{name:t.name,hasEndTag:t.hasEndTag??!0,description:t.description,handler:async(r,o,a,s)=>{let n=f(o,t.defaults);if(t.validate){let e=t.validate(n);if(e!==!0){let d=typeof e==="string"?e:`Invalid parameters for @${t.name}`;throw Error(d)}}let i=r;if(t.transform)i=await t.transform(r,n,a,s);if(t.clientScript){let e=t.clientScript(n);i+=`<script>${e}</script>`}if(t.css){let e=t.css(n);i+=`<style>${e}</style>`}return i}}}function f(t,c){let r={...c};for(let o of t){let a=o.indexOf(":"),s=o.indexOf("="),n=a>=0&&(s<0||a<s)?a:s;if(n>=0){let i=o.slice(0,n).trim(),e=o.slice(n+1).trim();if(e==="true")e=!0;else if(e==="false")e=!1;else if(e==="null")e=null;else if(!Number.isNaN(Number(e)))e=Number(e);else if(typeof e==="string"&&e.startsWith("{"))try{e=JSON.parse(e)}catch{}r[i]=e}else{let i=Object.keys(r).filter((e)=>!c||!(e in c)).length;r[i===0?"value":`arg${i}`]=o}}return r}
|
|
3
|
+
export{Ke};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Es,_s,Ts,Rs,er,tr,Qu,ed,td,nd,nr,rd}from"./chunk-qmcmjdy7.js";import"./chunk-b77v56fz.js";import"./chunk-2pph3dh0.js";export{rd as generateDefaultRobotsTxt,nr as generateRobotsTxt,ed as generateSitemap,td as generateSitemapIndex,Rs as injectSeoTags,er as metaDirective,Es as processMetaDirectives,Ts as processSeoDirective,_s as processStructuredData,Qu as registerSeoDirectives,nd as scanForSitemapEntries,tr as structuredDataDirective};
|