@stacksjs/stx 0.2.817 → 0.2.818
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-pyytr30r.js → chunk-035m9ada.js} +3 -3
- package/dist/chunk-03mtfndv.js +2 -0
- package/dist/chunk-18qxd18d.js +2 -0
- package/dist/{chunk-d47m4qat.js → chunk-1a8qtvs1.js} +2 -2
- package/dist/{chunk-s9xs2ff4.js → chunk-1ae3megp.js} +5 -5
- package/dist/chunk-1cd0w20k.js +2 -0
- package/dist/{chunk-549end3k.js → chunk-1hg0zb3p.js} +2 -2
- package/dist/{chunk-p8wq37hd.js → chunk-1rvgv1fr.js} +5 -5
- package/dist/{chunk-n761hp6d.js → chunk-1tzqqr0p.js} +2 -2
- package/dist/{chunk-rc424p1c.js → chunk-2bnbcr22.js} +24 -24
- package/dist/{chunk-b5ckg7zq.js → chunk-2jn0x4sh.js} +5 -5
- package/dist/chunk-2kt1gqtq.js +2 -0
- package/dist/chunk-2vaap97d.js +2 -0
- package/dist/chunk-33ewq978.js +2 -0
- package/dist/chunk-3m342maz.js +2 -0
- package/dist/chunk-46sej67y.js +2 -0
- package/dist/{chunk-5efv1fhk.js → chunk-4fbg7gq8.js} +2 -2
- package/dist/{chunk-cj1p3qdh.js → chunk-4h78zypb.js} +1 -1
- package/dist/chunk-5zf566bv.js +2 -0
- package/dist/chunk-67k5q95t.js +2 -0
- package/dist/chunk-6e76tz09.js +2 -0
- package/dist/{chunk-bphwhfbd.js → chunk-6n11z33h.js} +5 -5
- package/dist/{chunk-7rk7wfm6.js → chunk-72jt897s.js} +13 -13
- package/dist/chunk-72w08sh9.js +2 -0
- package/dist/{chunk-agxjwnz0.js → chunk-7ac98ja7.js} +8 -8
- package/dist/chunk-7q79h0j4.js +2 -0
- package/dist/chunk-88mhhbqj.js +2 -0
- package/dist/{chunk-a0r4dpzs.js → chunk-8dmey36n.js} +2 -2
- package/dist/chunk-8gcg9maj.js +1327 -0
- package/dist/{chunk-gtfs96f2.js → chunk-8hfgvs0x.js} +2 -2
- package/dist/{chunk-cm5cp3m0.js → chunk-8wdy7kdq.js} +4 -4
- package/dist/{chunk-kjjvs3sc.js → chunk-9487tyfa.js} +2 -2
- package/dist/chunk-9736003n.js +2 -0
- package/dist/chunk-99zwpazg.js +2 -0
- package/dist/chunk-9e5gamvs.js +2 -0
- package/dist/{chunk-17wb2x3z.js → chunk-9egd7tx3.js} +2 -2
- package/dist/{chunk-5hxvhmg3.js → chunk-9gj702tw.js} +4 -4
- package/dist/{chunk-2ws2qe1k.js → chunk-9gwhs0gk.js} +2 -2
- package/dist/{chunk-rxt4jj9b.js → chunk-9tzcvsv0.js} +6 -6
- package/dist/{chunk-133vw0ae.js → chunk-9xd85mvm.js} +4 -4
- package/dist/chunk-9y1dm510.js +2 -0
- package/dist/{chunk-yvqe0pzk.js → chunk-a1cy78h3.js} +2 -2
- package/dist/{chunk-sa0nkpx9.js → chunk-a67c2xrp.js} +2 -2
- package/dist/chunk-abzrvxct.js +2 -0
- package/dist/chunk-avbvedyx.js +2 -0
- package/dist/{chunk-3vpgr6nk.js → chunk-b9d70mgr.js} +3 -3
- package/dist/chunk-bbxzkcsk.js +2 -0
- package/dist/chunk-c179xpsq.js +2 -0
- package/dist/{chunk-n9av365c.js → chunk-casvvt3k.js} +1 -1
- package/dist/{chunk-p5ez40kf.js → chunk-cf196sv5.js} +2 -2
- package/dist/chunk-cvq4bz8y.js +2 -0
- package/dist/{chunk-1wdv3zj2.js → chunk-d4pmddb9.js} +1 -1
- package/dist/chunk-dh1f8ga0.js +2 -0
- package/dist/{chunk-1fc6rax4.js → chunk-dpn314z2.js} +2 -2
- package/dist/{chunk-6cw072n5.js → chunk-dq9djbgq.js} +4 -4
- package/dist/{chunk-tb4wmzzd.js → chunk-e3t2bqyf.js} +5 -5
- package/dist/{chunk-y3p6w1e0.js → chunk-e9w8qav3.js} +5 -5
- package/dist/{chunk-jg9f5nqf.js → chunk-em2yy1te.js} +6 -6
- package/dist/chunk-em7kntfc.js +2 -0
- package/dist/chunk-enm79dwe.js +2 -0
- package/dist/{chunk-m0x96g8e.js → chunk-f6nk205v.js} +1 -1
- package/dist/{chunk-f54t0qar.js → chunk-fmawgk87.js} +1 -1
- package/dist/chunk-fvs15n0s.js +2 -0
- package/dist/{chunk-gqjb1y7c.js → chunk-g7mjv276.js} +2 -2
- package/dist/{chunk-r6dtrd7y.js → chunk-gcje06er.js} +30 -30
- package/dist/{chunk-1bgv727x.js → chunk-gtd6qs1r.js} +2 -2
- package/dist/chunk-gvthmy3a.js +2 -0
- package/dist/chunk-h8kbcz9t.js +2 -0
- package/dist/chunk-h8x56dq5.js +2 -0
- package/dist/{chunk-hg67a15h.js → chunk-hntm02x0.js} +3 -3
- package/dist/chunk-hx575xy8.js +2 -0
- package/dist/{chunk-dy7yccxm.js → chunk-j24psz0z.js} +7 -7
- package/dist/chunk-j58z3y2g.js +2 -0
- package/dist/chunk-j5t40n2g.js +2 -0
- package/dist/{chunk-nmkkfpmh.js → chunk-j65nf7mt.js} +6 -6
- package/dist/{chunk-kvhsdyfg.js → chunk-j8r0am39.js} +1 -1
- package/dist/{chunk-jtx9x3as.js → chunk-k01aftw0.js} +6 -6
- package/dist/{chunk-0h99mrb0.js → chunk-k3t72x38.js} +2 -2
- package/dist/{chunk-0svj1nfa.js → chunk-k3zcadcc.js} +2 -2
- package/dist/chunk-kgwdxx75.js +2 -0
- package/dist/{chunk-r5nt1bcx.js → chunk-mbhvf0sv.js} +2 -2
- package/dist/{chunk-fn3q1gtr.js → chunk-mjg9cx5a.js} +3 -3
- package/dist/{chunk-ccxphr19.js → chunk-mm8ak4w2.js} +2 -2
- package/dist/{chunk-xrd1md4j.js → chunk-mr2ke5km.js} +6 -6
- package/dist/chunk-n1tbc7da.js +2 -0
- package/dist/{chunk-4ws3yz5q.js → chunk-n4s0se11.js} +8 -8
- package/dist/chunk-n7dm6prj.js +2 -0
- package/dist/chunk-nknpr8cy.js +2 -0
- package/dist/{chunk-jham85mf.js → chunk-nqdh7z2d.js} +1 -1
- package/dist/{chunk-vbrn4w81.js → chunk-p13wg97w.js} +3 -3
- package/dist/chunk-pe9npaby.js +2 -0
- package/dist/chunk-pyz2jqph.js +2 -0
- package/dist/chunk-q51w24br.js +2 -0
- package/dist/chunk-qek9bcjt.js +2 -0
- package/dist/chunk-qkxx34vt.js +2 -0
- package/dist/{chunk-0jcady6w.js → chunk-qr14xvwb.js} +1 -1
- package/dist/chunk-r2v042ym.js +2 -0
- package/dist/{chunk-df60fpgx.js → chunk-r8ydxe4z.js} +3 -3
- package/dist/chunk-rjzp7za8.js +2 -0
- package/dist/{chunk-yts2b9d8.js → chunk-s6mte5vy.js} +11 -6
- package/dist/chunk-s9b49v74.js +3 -0
- package/dist/{chunk-vkn133cs.js → chunk-s9b6abkb.js} +2 -2
- package/dist/chunk-sata7rh2.js +2 -0
- package/dist/{chunk-pdnyhs63.js → chunk-sf4rntqj.js} +1 -1
- package/dist/{chunk-8h3jv8dd.js → chunk-sh1hbhhb.js} +2 -2
- package/dist/{chunk-ntn6bnjv.js → chunk-skht06a2.js} +1 -1
- package/dist/{chunk-gc7pykfq.js → chunk-swbrvrgr.js} +2 -2
- package/dist/{chunk-s90m43sm.js → chunk-sxad7x2s.js} +4 -4
- package/dist/{chunk-w6n4y2xg.js → chunk-tj6zvs8f.js} +2 -2
- package/dist/chunk-tmcgpf68.js +2 -0
- package/dist/chunk-tsb5h4e2.js +2 -0
- package/dist/chunk-v8h2kns0.js +2 -0
- package/dist/{chunk-ncyjaxyz.js → chunk-vmxzktdr.js} +1 -1
- package/dist/chunk-vpazz8ca.js +2 -0
- package/dist/{chunk-5gxneecs.js → chunk-vtt2dec3.js} +3 -3
- package/dist/chunk-vyw40ym7.js +2 -0
- package/dist/chunk-whq40bdm.js +2 -0
- package/dist/chunk-x15hrtmt.js +2 -0
- package/dist/{chunk-fcvyk047.js → chunk-x34me5ar.js} +7 -7
- package/dist/{chunk-0ekdbagy.js → chunk-xc7nynb9.js} +2 -2
- package/dist/chunk-xha2gt0n.js +2 -0
- package/dist/{chunk-hhazm0cs.js → chunk-y3zjmv9e.js} +3 -3
- package/dist/chunk-ydt1pbhx.js +2 -0
- package/dist/chunk-ymypc1rp.js +709 -0
- package/dist/chunk-z8ywxqqg.js +2 -0
- package/dist/{chunk-crmxg1c0.js → chunk-zgq8bfaw.js} +4 -4
- package/dist/{chunk-e39nkbt4.js → chunk-zhvmcj78.js} +4 -4
- package/dist/{chunk-2p3eaj16.js → chunk-zme16hcr.js} +3 -3
- package/dist/{chunk-sphc7xzx.js → chunk-znx5m1jv.js} +1 -1
- package/dist/chunk-zwp7n01x.js +2 -0
- package/dist/cli.js +12 -12
- package/dist/client/signals-expression-runtime.js +6 -2
- package/dist/client/signals-public-api-runtime.js +1 -0
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/process.js +2 -2
- package/dist/pwa.js +3 -3
- package/dist/reactive.d.ts +12 -2
- package/dist/reactive.js +69 -32
- package/dist/ssg.js +10 -10
- package/dist/utils.js +6 -1
- package/package.json +5 -5
- package/dist/chunk-0yjm4j26.js +0 -2
- package/dist/chunk-1kz70290.js +0 -2
- package/dist/chunk-1rwfgmmk.js +0 -2
- package/dist/chunk-2k3qtmn8.js +0 -2
- package/dist/chunk-2vget8rh.js +0 -2
- package/dist/chunk-3e85etrf.js +0 -2
- package/dist/chunk-3eqs0rpv.js +0 -2
- package/dist/chunk-3ftaegqg.js +0 -2
- package/dist/chunk-3jd5ak8h.js +0 -2
- package/dist/chunk-4ypwqrj2.js +0 -2
- package/dist/chunk-5eqna31h.js +0 -2
- package/dist/chunk-6a97a9wk.js +0 -2
- package/dist/chunk-7agp0wj2.js +0 -2
- package/dist/chunk-7hch54b2.js +0 -2
- package/dist/chunk-7pb9fepg.js +0 -2
- package/dist/chunk-8g8h2xwz.js +0 -2
- package/dist/chunk-9mtw71xy.js +0 -2
- package/dist/chunk-9ttf7k5e.js +0 -2
- package/dist/chunk-9wmjmas8.js +0 -2
- package/dist/chunk-a350jjd3.js +0 -2
- package/dist/chunk-aqydav9y.js +0 -2
- package/dist/chunk-ar7w1kx0.js +0 -2
- package/dist/chunk-aya8nv31.js +0 -2
- package/dist/chunk-b9ntt41z.js +0 -2
- package/dist/chunk-bj6ax0he.js +0 -2
- package/dist/chunk-cxpnkgvw.js +0 -2
- package/dist/chunk-d3gncxq1.js +0 -2
- package/dist/chunk-da886asf.js +0 -2
- package/dist/chunk-dnemxdvy.js +0 -2
- package/dist/chunk-dnqt6y8v.js +0 -3
- package/dist/chunk-f0bwetnx.js +0 -421
- package/dist/chunk-gzhrtymg.js +0 -1592
- package/dist/chunk-h9yvb9qn.js +0 -2
- package/dist/chunk-hsmwzzy2.js +0 -2
- package/dist/chunk-jsvc264s.js +0 -2
- package/dist/chunk-k98nt4pk.js +0 -2
- package/dist/chunk-ka1hrt56.js +0 -2
- package/dist/chunk-m477m5dp.js +0 -2
- package/dist/chunk-mkr46mzz.js +0 -2
- package/dist/chunk-mmyrdbxx.js +0 -2
- package/dist/chunk-p4f1hrvn.js +0 -2
- package/dist/chunk-py244ymg.js +0 -2
- package/dist/chunk-rp6b7awz.js +0 -2
- package/dist/chunk-rqfg21xk.js +0 -2
- package/dist/chunk-rxc1076r.js +0 -2
- package/dist/chunk-rzwyaqgg.js +0 -2
- package/dist/chunk-s5pegavh.js +0 -2
- package/dist/chunk-sj4vw93g.js +0 -2
- package/dist/chunk-snfjvd94.js +0 -2
- package/dist/chunk-syvsj91a.js +0 -2
- package/dist/chunk-tzb0n60s.js +0 -2
- package/dist/chunk-w8xvkbt9.js +0 -2
- package/dist/chunk-x5rt4kpx.js +0 -2
- package/dist/chunk-xbknqp19.js +0 -2
- package/dist/chunk-xgqyzkt2.js +0 -2
- package/dist/chunk-yd0074ks.js +0 -2
- package/dist/chunk-yd1zsy7t.js +0 -2
- package/dist/chunk-yjezsy4p.js +0 -2
- package/dist/chunk-yjvwp1s6.js +0 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ne}from"./chunk-
|
|
3
|
-
export{fa,
|
|
2
|
+
import{ne}from"./chunk-4fbg7gq8.js";import R from"fs";import g from"path";import C from"crypto";var S=new Set(["webp","avif","jpeg","png"]),T=new Set(["cover","contain","fill","inside","outside"]),q=new Set([".jpg",".jpeg",".png",".webp",".avif",".gif"]),k=4096,D=80,U="cover";async function fa(e,t){let r=t.routePath??"/_stx/img",h=new URL(e.url);if(h.pathname!==r)return null;let a=A(h,t);if(!a.ok)return new Response(a.error,{status:a.status,headers:{"Content-Type":"text/plain"}});let{srcFsPath:n,srcUrl:d,width:l,height:i,format:s,quality:u,fit:c}=a,m;try{m=R.statSync(n)}catch{return new Response(`Source image not found: ${d}`,{status:404,headers:{"Content-Type":"text/plain"}})}if(!m.isFile())return new Response("Not a file",{status:404,headers:{"Content-Type":"text/plain"}});let w=t.cacheDir??".stx/cache/img";await R.promises.mkdir(w,{recursive:!0});let b=`${n}:${m.mtimeMs}:${m.size}`,I=`${l}x${i}:${s}:${u}:${c}`,f=C.createHash("sha256").update(`${b}|${I}`).digest("hex").slice(0,16),o=g.join(w,`${f}.${s}`),p={"Content-Type":ne(s),"Cache-Control":"public, max-age=31536000, immutable",ETag:`"${f}"`,"X-Stx-Image-Cache":"HIT"};if(e.headers.get("if-none-match")===`"${f}"`)return new Response(null,{status:304,headers:p});let v=Bun.file(o);if(await v.exists())return new Response(v,{headers:p});try{let x=Buffer.from(await Bun.file(n).arrayBuffer()),{resizeAndConvert:P}=await L(),F=await P(x,{width:l,height:i,format:s,quality:u,fit:c});return await Bun.write(o,F),p["X-Stx-Image-Cache"]="MISS",new Response(new Uint8Array(F),{headers:p})}catch(x){let P=x.message;return new Response(`Image processing failed: ${P}`,{status:500,headers:{"Content-Type":"text/plain"}})}}function Fl(e){return async(t)=>await fa(t,e)??new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain"}})}function A(e,t){let r=e.searchParams.get("src");if(!r)return{ok:!1,error:"Missing required param: src",status:400};if(!r.startsWith("/"))return{ok:!1,error:"src must be an absolute URL path (start with /)",status:400};if(r.startsWith("//"))return{ok:!1,error:"src must be a local path",status:400};let h=g.extname(r).toLowerCase();if(!q.has(h))return{ok:!1,error:`Unsupported source extension: ${h}`,status:400};let a=g.resolve(t.publicDir),n=g.resolve(a,r.slice(1));if(!n.startsWith(`${a}${g.sep}`)&&n!==a)return{ok:!1,error:"src is outside publicDir",status:400};let d=t.maxWidth??k,l=t.maxHeight??k,i=e.searchParams.get("w"),s=e.searchParams.get("h"),u=i?Number.parseInt(i,10):0,c=s?Number.parseInt(s,10):0;if(i&&(!Number.isFinite(u)||u<=0))return{ok:!1,error:"Invalid w (must be positive integer)",status:400};if(s&&(!Number.isFinite(c)||c<=0))return{ok:!1,error:"Invalid h (must be positive integer)",status:400};if(!i&&!s)return{ok:!1,error:"At least one of w or h is required",status:400};let m=Math.min(u||d,d),w=Math.min(c||l,l),b=e.searchParams.get("f")||"webp";if(!S.has(b))return{ok:!1,error:`Invalid f (must be one of: ${[...S].join(", ")})`,status:400};let I=b,f=e.searchParams.get("q"),o=f?Number.parseInt(f,10):t.defaultQuality??D;if(!Number.isFinite(o)||o<1||o>100)return{ok:!1,error:"Invalid q (must be 1-100)",status:400};let y=e.searchParams.get("fit")||t.defaultFit||U;if(!T.has(y))return{ok:!1,error:`Invalid fit (must be one of: ${[...T].join(", ")})`,status:400};return{ok:!0,srcFsPath:n,srcUrl:r,width:m,height:w,format:I,quality:o,fit:y}}async function L(){return await import("./chunk-nqdh7z2d.js")}
|
|
3
|
+
export{fa,Fl};
|
|
@@ -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 Wm(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 qm(){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{Wm,qm};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{de,Lc,Fs,mn,m,De,Le}from"./chunk-
|
|
2
|
+
import{de,Lc,Fs,mn,m,De,Le}from"./chunk-ymypc1rp.js";import{dr,Qe,B}from"./chunk-j65nf7mt.js";import{tr,i}from"./chunk-8gcg9maj.js";import{we}from"./chunk-9xd85mvm.js";function b(s){return s.endsWith(".md")||s.endsWith(".markdown")}function k(s){let e=[];g(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let r=[...e];g(/<code\b[^>]*>[\s\S]*?<\/code>/gi,r);function g(n,p){let u;while((u=n.exec(s))!==null){let t=u.index,o=t+u[0].length;if(p?.some((l)=>t>=l.start&&o<=l.end))continue;e.push({start:t,end:o})}}if(e.length===0)return s;e.sort((n,p)=>n.start-p.start);let c="",a=0;for(let n of e){if(n.start<a)continue;c+=s.slice(a,n.start),c+=`@raw${s.slice(n.start,n.end)}@endraw`,a=n.end}return c+=s.slice(a),c}async function R(s,e={}){let{data:r,content:g}=dr(s),a=await(e.renderer??((n)=>Qe(n)))(g);return{html:k(a),frontmatter:r??{}}}import{dirname as v,resolve as _}from"path";function M(s){let e=s,r=de(s);if(r)e=r.content.trim();let g=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,c=[],a=[],n=[],p=(o)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(o),u;while((u=g.exec(s))!==null){let o=u[1],l=u[2],d=u[0],f=o.includes("server");if(p(l))n.push(d);else if(f)a.push(l);else c.push(d)}let t=e;{let o=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,l,d=[];while((l=o.exec(t))!==null){let f=l.index+l[0].length,x=t.indexOf("</script>",f);if(x===-1)continue;d.push({start:l.index,end:x+9}),o.lastIndex=x+9}for(let f=d.length-1;f>=0;f--)t=t.substring(0,d[f].start)+t.substring(d[f].end)}for(let o of c)t=t.replace(o,"");return{templateContent:t,serverScripts:a,clientScripts:c,signalsScripts:n}}function E(s,e){return`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
@@ -14,5 +14,5 @@ ${a.join(`
|
|
|
14
14
|
`)}`}else{if(r.processClientScripts!==!1&&a.length>0){let o=p.__stx_event_bindings||[],l=De(p),d=await Promise.all(a.map(async(w)=>{let C=w.match(/<script\b([^>]*)>/i)?.[1]||"";if(/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(C))return w;let h=w.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!h)return w;return await Le(h[1],{eventBindings:o,templateContent:t,serverData:l,filePath:e})})),x=[await tr(d,{...n,buildMode:"compile"}),...d].filter(Boolean).join(`
|
|
15
15
|
`);if(t.match(/(<\/body>)/i))t=t.replace(/(<\/body>)/i,`${x}
|
|
16
16
|
$1`);else t+=`
|
|
17
|
-
${x}`}t=await we(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=E(t,r.title)}if(r.injectCSS)try{let{injectCss:o}=await import("./chunk-
|
|
17
|
+
${x}`}t=await we(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=E(t,r.title)}if(r.injectCSS)try{let{injectCss:o}=await import("./chunk-33ewq978.js");t=await o(t)}catch{}return t}
|
|
18
18
|
export{Ga};
|
|
@@ -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 Jl(){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 Yl(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 Zl(){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 Ql(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 eu(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 tu(){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 nu(e){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${e}"]`)?.classList.contains("hydrated")??!1}function ru(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 su(e){return e.replace(/@static\s*([\s\S]*?)@endstatic/gi,(t,n)=>`<div class="stx-static">${n.trim()}</div>`)}function ou(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 Pm={processPartialHydrationDirectives:Yl,processStaticDirectives:su,generatePartialHydrationCSS:Zl,generateIslandManifest:ou,createIslandRegistry:Jl,hydrateIsland:Ql,hydrateByStrategy:eu,hydrateAll:tu,isHydrated:nu,onHydrated:ru};
|
|
391
|
+
export{Jl,Yl,Zl,Ql,eu,tu,nu,ru,su,ou,Pm};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{de,gn,It,Ot,m,s,fe,p}from"./chunk-
|
|
2
|
+
import{de,gn,It,Ot,m,s,fe,p}from"./chunk-ymypc1rp.js";import{yt,Re,rc,os,No,Mo,i}from"./chunk-8gcg9maj.js";import{ie,ae,Er,ke,F,Sn}from"./chunk-72jt897s.js";import{St,pr,Ts,$s,Rs,kt,_t,Ct,Et,Tt,$t,et}from"./chunk-gtd6qs1r.js";import{xs,a,I}from"./chunk-j65nf7mt.js";import{ft,An,Ce,L,aa,mo,qr,We,ca,qe,Ee}from"./chunk-k01aftw0.js";import{lr,ur}from"./chunk-swbrvrgr.js";import{$n}from"./chunk-cf196sv5.js";import{e,cn,sr,y}from"./chunk-9tzcvsv0.js";import{Je}from"./chunk-7ac98ja7.js";import{$e}from"./chunk-7sh9fa3q.js";import{X,be,we}from"./chunk-9xd85mvm.js";import{c}from"./chunk-0rjcbqk3.js";import{K}from"./chunk-c5vzr1va.js";async function Nn(t){try{let n=await Bun.file(t).text(),r=Un(n),d=Wn(n,t),o=Vn(n,r),l=qn(n,r);return{file:t,metrics:r,issues:d,suggestions:o,performance:l}}catch(n){throw Error(`Failed to analyze template ${t}: ${n instanceof Error?n.message:String(n)}`)}}function Un(t){let n=t.split(`
|
|
3
3
|
`),r=t.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),o=(r?r[1]:"").split(`
|
|
4
4
|
`).length,l={conditionals:(t.match(/@(if|unless|elseif|else|endif|endunless)\b/g)||[]).length,loops:(t.match(/@(foreach|for|endforeach|endfor|while|endwhile)\b/g)||[]).length,includes:(t.match(/@(include|component|extends|section|yield)\b/g)||[]).length,custom:0,total:0};l.total=l.conditionals+l.loops+l.includes+l.custom;let u=(t.match(/\{\{[\s\S]*?\}\}/g)||[]).length,f=(t.match(/\{!![\s\S]*?!!\}/g)||[]).length,g=(t.match(/@(?:if|unless|elseif|foreach|for|while)\s*\([^)]+\)/g)||[]).length,h=u+f+g,x=(t.match(/<[A-Z][^>]*>/g)||[]).length,v=(t.match(/@(?:layout|extends)\(/g)||[]).length,S=0,T=0;for(let k of n)if(/@(?:if|unless|foreach|for|while|section)\b/.test(k)&&!/@end/.test(k)&&!/@else/.test(k))T++,S=Math.max(S,T);else if(/@end(?:if|unless|foreach|for|while|section)\b/.test(k))T--;let w=S>=4?3:0,b=Math.min(10,Math.ceil(l.total*0.5+h*0.1+x*0.3+(o>10?o*0.05:0)+w));return{lines:n.length,characters:t.length,directives:l,expressions:h,components:x,layouts:v,scriptLines:o,complexity:b}}function Wn(t,n){let r=[],d=Xt(t,"if","endif");if(d>0)r.push({type:"error",category:"syntax",message:`Found ${d} unmatched @if directive(s)`,suggestion:"Ensure every @if has a corresponding @endif"});let o=Xt(t,"foreach","endforeach");if(o>0)r.push({type:"error",category:"syntax",message:`Found ${o} unmatched @foreach directive(s)`,suggestion:"Ensure every @foreach has a corresponding @endforeach"});let l=t.match(/@foreach[\s\S]*?@foreach[\s\S]*?@endforeach[\s\S]*?@endforeach/g);if(l&&l.length>0)r.push({type:"warning",category:"performance",message:"Nested loops detected which may impact performance",suggestion:"Consider preprocessing data or using more efficient data structures"});let u=(t.match(/\{!![\s\S]*?!!\}/g)||[]).length;if(u>0)r.push({type:"warning",category:"security",message:`Found ${u} raw output expression(s) {!! !!}`,suggestion:"Ensure raw outputs are properly sanitized to prevent XSS"});let f=t.match(/<img[^>]*>/g);if(f){let x=f.filter((v)=>!v.includes("alt="));if(x.length>0)r.push({type:"warning",category:"accessibility",message:`Found ${x.length} image(s) without alt attributes`,suggestion:"Add alt attributes to all images for screen reader accessibility"})}let g=t.split(`
|
|
5
5
|
`).filter((x)=>x.length>120);if(g.length>0)r.push({type:"info",category:"maintainability",message:`Found ${g.length} line(s) longer than 120 characters`,suggestion:"Consider breaking long lines for better readability"});let h=(t.match(/style\s*=\s*["'][^"']*["']/g)||[]).length;if(h>3)r.push({type:"info",category:"maintainability",message:`Found ${h} inline style attributes`,suggestion:"Consider moving styles to CSS classes for better maintainability"});return r}function Vn(t,n){let r=[];if(n.complexity>7)r.push({type:"refactor",message:"Template complexity is high. Consider breaking into smaller components.",impact:"high",effort:"medium"});else if(n.complexity>5&&n.directives.total>8)r.push({type:"optimization",message:"Template has moderate complexity. Consider component extraction for reusability.",impact:"medium",effort:"low"});if(n.lines>100&&n.components===0)r.push({type:"refactor",message:"Large template with no components. Consider extracting reusable parts into components.",impact:"medium",effort:"medium"});if(n.expressions>20)r.push({type:"optimization",message:"Many template expressions detected. Consider preprocessing some data in the script section.",impact:"medium",effort:"low"});let d=t.match(/@foreach[\s\S]*?@foreach[\s\S]*?@endforeach[\s\S]*?@endforeach/g);if(d&&d.length>0)r.push({type:"optimization",message:"Nested loops detected. Consider preprocessing data or optimizing data structures.",impact:"high",effort:"medium"});if(n.directives.total===0&&n.expressions<5)r.push({type:"optimization",message:"Template appears static. Consider enabling aggressive caching.",impact:"high",effort:"low"});if(n.scriptLines>50)r.push({type:"refactor",message:"Large script section. Consider moving complex logic to external modules.",impact:"medium",effort:"medium"});return r}function qn(t,n){let r=1;if(r+=n.directives.conditionals*0.1,r+=n.directives.loops*0.5,r+=n.directives.includes*2,r+=n.expressions*0.05,r+=n.components*1,n.scriptLines>10)r+=n.scriptLines*0.1;let d;if(n.expressions===0&&n.directives.total===0)d="high";else if(n.expressions<5&&n.directives.total<3)d="medium";else d="low";let o=[];if(r>10)o.push("Consider optimizing template complexity");if(d==="low"&&n.directives.total>5)o.push("Reduce dynamic content for better caching");if(n.components===0&&n.lines>40)o.push("Extract components to improve reusability and performance");return{estimatedRenderTime:Math.round(r*100)/100,complexityScore:n.complexity,cacheability:d,recommendations:o}}function Xt(t,n,r){let d=t.replace(/<!--[\s\S]*?-->/g,""),o=(d.match(new RegExp(`@${n}\\b`,"g"))||[]).length,l=(d.match(new RegExp(`@${r}\\b`,"g"))||[]).length;return Math.abs(o-l)}async function Xi(t=["**/*.stx"],n){let r=[],d=[];for(let l of t){let u=await Array.fromAsync(new Bun.Glob(l).scan({cwd:n||process.cwd(),onlyFiles:!0,absolute:!0}));d.push(...u.filter((f)=>f.endsWith(".stx")))}for(let l of d)try{let u=await Nn(l);r.push(u)}catch(u){console.warn(`Failed to analyze ${l}:`,u)}let o=Kn(r);return{results:r,summary:o}}function Kn(t){let n=t.length,r=t.reduce((h,x)=>h+x.metrics.lines,0),d=n>0?t.reduce((h,x)=>h+x.metrics.complexity,0)/n:0,o=t.reduce((h,x)=>h+x.issues.length,0),l={};t.forEach((h)=>{h.issues.forEach((x)=>{l[x.category]=(l[x.category]||0)+1})});let u=n>0?t.reduce((h,x)=>h+x.performance.estimatedRenderTime,0)/n:0,f=Math.max(1,Math.min(10,Math.round(10-u/2-d/2))),g=[];if(d>6)g.push("Project has high average complexity. Consider refactoring complex templates.");if(o>n*2)g.push("High number of issues detected. Run detailed analysis on individual files.");if(l.security>0)g.push("Security issues found. Review raw output usage and input sanitization.");return{totalFiles:n,totalLines:r,avgComplexity:Math.round(d*100)/100,totalIssues:o,issuesByCategory:l,performanceScore:f,recommendations:g}}import{mkdir as Xn,readFile as Gn,readdir as Jn,stat as Gt,writeFile as Yn}from"fs/promises";import Te from"path";function tn(t){if(t==="connectedCallback")return`method "${t}" is reserved; define "onConnect" instead, which the element calls once it is connected, rendered and bound`;if(t==="disconnectedCallback")return`method "${t}" is reserved; define "onDisconnect" instead, which the element calls as it leaves the DOM, before it releases its own listeners`;return`method "${t}" is reserved`}var nn=new Set(["constructor","connectedCallback","disconnectedCallback","attributeChangedCallback","adoptedCallback"]);function Qn(t){return t.replace(/\.stx$/i,"").split(/[^a-z0-9]+/i).filter(Boolean).map((n)=>n.charAt(0).toUpperCase()+n.slice(1)).join("")}function jt(t){return t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[^a-z0-9]+/gi,"-").replace(/^-+|-+$/g,"").toLowerCase()}function Zn(t){return/^[a-z][.0-9_a-z-]*-[.0-9_a-z-]*$/.test(t)&&!t.startsWith("xml")&&!/[A-Z]/.test(t)}function er(t){if(t===!0)return"open";if(t==="open"||t==="closed")return t;return!1}async function tr(t){let n=[];async function r(d){let o=await Jn(d,{withFileTypes:!0});o.sort((l,u)=>l.name.localeCompare(u.name));for(let l of o){let u=Te.join(d,l.name);if(l.isDirectory()){if(!l.name.startsWith(".")&&l.name!=="node_modules")await r(u)}else if(l.isFile()&&l.name.endsWith(".stx")&&!/\.(?:test|spec)\.stx$/i.test(l.name))n.push(u)}}return await r(t),n}function nr(t,n){let r=t.match(/<script\b(?=[^>]*(?:\bcomponent\b|\bstx:component\b))[^>]*>([\s\S]*?)<\/script>/i);if(!r)return{};let d=r[1].trim();if(!d)return{};try{return JSON.parse(d)}catch(o){throw Error(`${n}: <script component> must contain JSON metadata (${o.message})`)}}function rr(t,n){let r={},d=[...t.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)];for(let o of d){if(!/\bclient\b/i.test(o[1])||/\bcomponent\b|\bstx:component\b/i.test(o[1]))continue;let l;try{l=new Bun.Transpiler({loader:"ts"}).transformSync(o[2])}catch(g){throw Error(`${n}: failed to transpile <script client> (${g.message})`)}let u=/(?:export\s+)?(?:async\s+)?function\s+([A-Za-z_$][\w$]*)\s*\(([^)]*)\)\s*\{/g,f;while(f=u.exec(l)){let g=f[1];if(nn.has(g))throw Error(`${n}: client ${tn(g)}`);let h=u.lastIndex,x=1,v="",S=!1,T=h;for(;T<l.length&&x>0;T++){let b=l[T];if(S){S=!1;continue}if(v){if(b==="\\")S=!0;else if(b===v)v="";continue}if(b==='"'||b==="'"||b==="`")v=b;else if(b==="{")x++;else if(b==="}")x--}if(x!==0)throw Error(`${n}: unterminated client function "${g}"`);let w=f[0].includes("async")?"async ":"";r[g]=`${w}${g}(${f[2]}) {${l.slice(h,T-1)}}`,u.lastIndex=T}}return r}function or(t){let n=t.match(/<template\b(?![^>]*\bshadowrootmode\b)[^>]*>([\s\S]*?)<\/template>/i);return(n?n[1]:t).replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"").trim()}function Jt(t){return[...t.matchAll(/<style\b[^>]*>([\s\S]*?)<\/style>/gi)].map((n)=>n[1].trim()).filter(Boolean).join(`
|
|
@@ -515,7 +515,7 @@ else {
|
|
|
515
515
|
<span class="frontmatter-label">${n}:</span>
|
|
516
516
|
<span>${Array.isArray(r)?r.join(", "):String(r)}</span>
|
|
517
517
|
</div>`).join("")}
|
|
518
|
-
</div>`}import rn from"net";async function Rr(t){return new Promise((n)=>{let r=rn.createServer();r.once("error",()=>n(!1)),r.once("listening",()=>{r.close(()=>n(!0))}),r.listen(t,"0.0.0.0")})}async function Pr(t){return new Promise((n)=>{let r=rn.createServer();r.once("error",()=>n(!1)),r.once("listening",()=>{r.close(()=>n(!0))}),r.listen(t,"::")})}async function Or(t){if(!await Rr(t))return!1;return await Pr(t)}async function Ve(t,n=20){t=Number(t);for(let r=0;r<n;r++){let d=t+r;if(await Or(d))return d}throw Error(`Could not find an available port between ${t} and ${t+n-1}`)}var Ar={title:"stx Development",width:1400,height:900,darkMode:!0,hotReload:!0,titlebarHidden:!1,nativeSidebar:!1,sidebarWidth:260,sidebarConfig:void 0};async function Dr(){try{let t=await import("./chunk-
|
|
518
|
+
</div>`}import rn from"net";async function Rr(t){return new Promise((n)=>{let r=rn.createServer();r.once("error",()=>n(!1)),r.once("listening",()=>{r.close(()=>n(!0))}),r.listen(t,"0.0.0.0")})}async function Pr(t){return new Promise((n)=>{let r=rn.createServer();r.once("error",()=>n(!1)),r.once("listening",()=>{r.close(()=>n(!0))}),r.listen(t,"::")})}async function Or(t){if(!await Rr(t))return!1;return await Pr(t)}async function Ve(t,n=20){t=Number(t);for(let r=0;r<n;r++){let d=t+r;if(await Or(d))return d}throw Error(`Could not find an available port between ${t} and ${t+n-1}`)}var Ar={title:"stx Development",width:1400,height:900,darkMode:!0,hotReload:!0,titlebarHidden:!1,nativeSidebar:!1,sidebarWidth:260,sidebarConfig:void 0};async function Dr(){try{let t=await import("./chunk-nknpr8cy.js");if(typeof t.openDevWindow!=="function")return null;return t}catch{return null}}async function Ze(t,n={}){let r={...Ar,...n},d=await Dr();if(!d)return console.log(`${e.yellow}\u26A0${e.reset} Native window requested, but @stacksjs/desktop is not available.`),console.log(" Install & build the desktop package to enable --native."),!1;try{let o=await d.openDevWindow(t,{title:r.title,width:r.width,height:r.height,darkMode:r.darkMode,hotReload:r.hotReload,titlebarHidden:r.titlebarHidden,nativeSidebar:r.nativeSidebar,sidebarWidth:r.sidebarWidth,sidebarConfig:r.sidebarConfig});if(o&&r.nativeSidebar)console.log(`${e.green}\u2713${e.reset} Native sidebar enabled (macOS Tahoe style)`);return o}catch(o){return console.log(`${e.red}\u2717${e.reset} Could not open native window:`,o),!1}}function gt(t){if(t.match(/<Sidebar[\s\S]*?variant=["'](?:tahoe|vibrancy|desktop)["'][\s\S]*?\/>/i)){let o=t.match(/<script\s+server[^>]*>([\s\S]*?)<\/script>/i);if(o){let l=o[1];try{let u=`
|
|
519
519
|
${l}
|
|
520
520
|
return typeof sidebarConfig !== 'undefined' ? sidebarConfig : null;
|
|
521
521
|
`,g=Function(u)();if(g)return g}catch(u){console.warn("Invalid sidebarConfig:",u)}}return{sections:[]}}let r=t.match(/@nativeSidebar\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(r)try{return JSON.parse(r[1])}catch{console.warn("Invalid @nativeSidebar configuration")}let d=t.match(/<script\s+native-sidebar[^>]*>([\s\S]*?)<\/script>/i);if(d)try{let o=d[1].match(/(?:export\s+(?:default\s+)?|const\s+\w+\s*=\s*)(\{[\s\S]*\})/m);if(o)return Function(`return ${o[1]}`)()}catch(o){console.warn("Invalid native-sidebar script configuration:",o)}return}function Bt(){console.log(`
|
|
@@ -887,7 +887,7 @@ else {
|
|
|
887
887
|
};
|
|
888
888
|
})();
|
|
889
889
|
</script>
|
|
890
|
-
`}function Ne(t,n,r={}){let d=Br(n,r),o=t.lastIndexOf("</body>");if(o!==-1)return t.slice(0,o)+d+t.slice(o);if(t.includes("</html>"))return t.replace("</html>",`${d}</html>`);return t+d}function ht(t){let n=t.toLowerCase();return n.endsWith(".css")||n.endsWith(".scss")||n.endsWith(".sass")||n.endsWith(".less")}function bt(t){let n=t.toLowerCase();return[".stx",".html",".htm",".md",".js",".ts",".jsx",".tsx",".json"].some((d)=>n.endsWith(d))}function xt(t){return[/^\./,/node_modules/,/\.stx\/output/,/\.stx\/cache/,/~$/,/\.swp$/,/\.swo$/].some((r)=>r.test(t))}var nt=null;function vt(t){if(!nt)nt=new on(t);return nt}function it(){if(nt)nt.stop(),nt=null}import wt from"path";var rt={name:"bun-plugin-stx",async setup(t){let r={...await a(),...t.config?.stx},d=new Set,o=r.webComponents?.enabled?`./${wt.relative(wt.dirname(t.config?.outdir||"dist"),r.webComponents.outputDir||"dist/web-components")}`:"/web-components",l=[];if(r.webComponents?.enabled)try{let u=await xs(r,d);if(l.push(...u),r.debug&&u.length>0)console.log(`Successfully built ${u.length} web components`)}catch(u){console.error("Failed to build web components:",u)}t.onLoad({filter:/\.stx$/},async({path:u})=>{try{let f=new Set;if(r.cache&&r.cachePath){let b=await lr(u,r);if(b){if(r.debug)console.log(`Using cached version of ${u}`);return{contents:b,loader:"html"}}}let g=await ke(()=>Bun.file(u).text(),"",(b)=>{throw new Er(`Failed to read stx file: ${u}`,u,void 0,void 0,`File read error: ${b.message}`)});if(!g)throw new Er(`stx file is empty: ${u}`,u);let{scriptContent:h,templateContent:x,allScripts:v}=ie.time("script-extraction",()=>{let b=g,k=de(g);if(k)b=k.content.trim();let D=g.match(/<script\b[^>]*>[\s\S]*?<\/script>/gi)||[],E="",R=[];for(let C of D){let A=C.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i)?.[1]||"",_=C.match(/<script\b([^>]*)>/i),V=_?_[1]:"";if(/\bserver\b/i.test(V))E=A;else R.push(C)}let O=b.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"");return{scriptContent:E,templateContent:O,allScripts:R}}),S={__filename:u,__dirname:wt.dirname(u),__stx:{webComponentsPath:o,builtComponents:l}};await ke(()=>m(h,S,u),void 0,(b)=>{let k=new ae(`Script execution failed in ${u}: ${b.message}`,u,void 0,void 0,h.substring(0,100));if(F.log(k,{filePath:u,scriptContent:h}),r.debug)throw k});let w=await ie.timeAsync("directive-processing",async()=>await i(x,S,u,r,f));if(v.length>0){let{interpolateScriptsInTemplate:b}=await import("./chunk-
|
|
890
|
+
`}function Ne(t,n,r={}){let d=Br(n,r),o=t.lastIndexOf("</body>");if(o!==-1)return t.slice(0,o)+d+t.slice(o);if(t.includes("</html>"))return t.replace("</html>",`${d}</html>`);return t+d}function ht(t){let n=t.toLowerCase();return n.endsWith(".css")||n.endsWith(".scss")||n.endsWith(".sass")||n.endsWith(".less")}function bt(t){let n=t.toLowerCase();return[".stx",".html",".htm",".md",".js",".ts",".jsx",".tsx",".json"].some((d)=>n.endsWith(d))}function xt(t){return[/^\./,/node_modules/,/\.stx\/output/,/\.stx\/cache/,/~$/,/\.swp$/,/\.swo$/].some((r)=>r.test(t))}var nt=null;function vt(t){if(!nt)nt=new on(t);return nt}function it(){if(nt)nt.stop(),nt=null}import wt from"path";var rt={name:"bun-plugin-stx",async setup(t){let r={...await a(),...t.config?.stx},d=new Set,o=r.webComponents?.enabled?`./${wt.relative(wt.dirname(t.config?.outdir||"dist"),r.webComponents.outputDir||"dist/web-components")}`:"/web-components",l=[];if(r.webComponents?.enabled)try{let u=await xs(r,d);if(l.push(...u),r.debug&&u.length>0)console.log(`Successfully built ${u.length} web components`)}catch(u){console.error("Failed to build web components:",u)}t.onLoad({filter:/\.stx$/},async({path:u})=>{try{let f=new Set;if(r.cache&&r.cachePath){let b=await lr(u,r);if(b){if(r.debug)console.log(`Using cached version of ${u}`);return{contents:b,loader:"html"}}}let g=await ke(()=>Bun.file(u).text(),"",(b)=>{throw new Er(`Failed to read stx file: ${u}`,u,void 0,void 0,`File read error: ${b.message}`)});if(!g)throw new Er(`stx file is empty: ${u}`,u);let{scriptContent:h,templateContent:x,allScripts:v}=ie.time("script-extraction",()=>{let b=g,k=de(g);if(k)b=k.content.trim();let D=g.match(/<script\b[^>]*>[\s\S]*?<\/script>/gi)||[],E="",R=[];for(let C of D){let A=C.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i)?.[1]||"",_=C.match(/<script\b([^>]*)>/i),V=_?_[1]:"";if(/\bserver\b/i.test(V))E=A;else R.push(C)}let O=b.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"");return{scriptContent:E,templateContent:O,allScripts:R}}),S={__filename:u,__dirname:wt.dirname(u),__stx:{webComponentsPath:o,builtComponents:l}};await ke(()=>m(h,S,u),void 0,(b)=>{let k=new ae(`Script execution failed in ${u}: ${b.message}`,u,void 0,void 0,h.substring(0,100));if(F.log(k,{filePath:u,scriptContent:h}),r.debug)throw k});let w=await ie.timeAsync("directive-processing",async()=>await i(x,S,u,r,f));if(v.length>0){let{interpolateScriptsInTemplate:b}=await import("./chunk-c179xpsq.js"),k=b(v.join(`
|
|
891
891
|
`),S),D=w.search(/<\/body>/i);if(D!==-1)w=w.slice(0,D)+k+`
|
|
892
892
|
`+w.slice(D);else w+=`
|
|
893
893
|
${k}`}if(w=await we(w),f.forEach((b)=>d.add(b)),r.cache&&r.cachePath){if(await ur(u,w,f,r),r.debug)console.log(`Cached template ${u} with ${f.size} dependencies`)}return{contents:w,loader:"html"}}catch(f){let g=f instanceof Error?f:new ae(`Plugin processing failed: ${String(f)}`,u);if(F.log(g,{filePath:u,buildConfig:t.config}),Sn.logDetailedError(g,{filePath:u,plugin:"bun-plugin-stx"}),r.debug)console.error("stx Plugin Error:",g);let h=g,x=h.line||null,v=h.context||null;return{contents:r.debug||K()?`<!DOCTYPE html>
|
|
@@ -950,7 +950,7 @@ ${k}`}if(w=await we(w),f.forEach((b)=>d.add(b)),r.cache&&r.cachePath){if(await u
|
|
|
950
950
|
<h1>Something went wrong</h1>
|
|
951
951
|
<p>An internal error occurred. Please try again later.</p>
|
|
952
952
|
</body>
|
|
953
|
-
</html>`,loader:"html"}}})}};async function Fr(t,n={}){let r=n.port||3000,d=n.watch!==!1,o=n.hotReload!==!1&&d,l=null,u=n.hmrPort||r+1,f=ge.resolve(t);if(!Be.existsSync(f))return console.error(`${e.red}Error: File not found: ${e.bright}${f}${e.reset}`),!1;if(f.endsWith(".md"))return zt(f,n);else if(!f.endsWith(".stx"))return console.error(`${e.red}Error: Unsupported file type: ${e.bright}${f}${e.reset}. Only .stx and .md files are supported.`),!1;let g=c(process.cwd(),"output");Be.mkdirSync(g,{recursive:!0}),console.log(`${e.blue}Building ${e.bright}${t}${e.reset}...`);let h=null,x=async()=>{try{let A={name:"public-assets",setup(xe){xe.onResolve({filter:/^\/(images|fonts|assets|public)\//},(le)=>({path:le.path,external:!0}))}},_=await Bun.build({entrypoints:[f],outdir:g,plugins:[A,rt],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...n.stxOptions});if(!_.success)return console.error(`${e.red}Build failed:${e.reset}`,_.logs),!1;let V=_.outputs.find((xe)=>xe.path.endsWith(".html"));if(!V)return console.error(`${e.red}No HTML output found${e.reset}`),!1;return h=await Bun.file(V.path).text(),!0}catch(A){return console.error(`${e.red}Error building stx file:${e.reset}`,A),!1}};if(!await x())return!1;let S=ge.dirname(f);await cn(S);let T=r;try{if(T=await Ve(r),T!==r)console.log(`${e.yellow}Port ${r} is busy, using port ${T} instead${e.reset}`)}catch{return console.error(`${e.red}Could not find an available port${e.reset}`),!1}if(o){let A=n.hmrPort||T+1;l=vt({wsPort:A,verbose:!1}),u=l.start(A)}let w={},b=null,k;try{let{loadStxConfig:A}=await import("./chunk-
|
|
953
|
+
</html>`,loader:"html"}}})}};async function Fr(t,n={}){let r=n.port||3000,d=n.watch!==!1,o=n.hotReload!==!1&&d,l=null,u=n.hmrPort||r+1,f=ge.resolve(t);if(!Be.existsSync(f))return console.error(`${e.red}Error: File not found: ${e.bright}${f}${e.reset}`),!1;if(f.endsWith(".md"))return zt(f,n);else if(!f.endsWith(".stx"))return console.error(`${e.red}Error: Unsupported file type: ${e.bright}${f}${e.reset}. Only .stx and .md files are supported.`),!1;let g=c(process.cwd(),"output");Be.mkdirSync(g,{recursive:!0}),console.log(`${e.blue}Building ${e.bright}${t}${e.reset}...`);let h=null,x=async()=>{try{let A={name:"public-assets",setup(xe){xe.onResolve({filter:/^\/(images|fonts|assets|public)\//},(le)=>({path:le.path,external:!0}))}},_=await Bun.build({entrypoints:[f],outdir:g,plugins:[A,rt],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...n.stxOptions});if(!_.success)return console.error(`${e.red}Build failed:${e.reset}`,_.logs),!1;let V=_.outputs.find((xe)=>xe.path.endsWith(".html"));if(!V)return console.error(`${e.red}No HTML output found${e.reset}`),!1;return h=await Bun.file(V.path).text(),!0}catch(A){return console.error(`${e.red}Error building stx file:${e.reset}`,A),!1}};if(!await x())return!1;let S=ge.dirname(f);await cn(S);let T=r;try{if(T=await Ve(r),T!==r)console.log(`${e.yellow}Port ${r} is busy, using port ${T} instead${e.reset}`)}catch{return console.error(`${e.red}Could not find an available port${e.reset}`),!1}if(o){let A=n.hmrPort||T+1;l=vt({wsPort:A,verbose:!1}),u=l.start(A)}let w={},b=null,k;try{let{loadStxConfig:A}=await import("./chunk-vpazz8ca.js"),_=await A();if(k=n.stxOptions?.serverApi??_.serverApi,_?.apiRouter)b=_?.apiRouter,console.log(`${e.blue}Using custom router for API handling${e.reset}`);if(_?.apiRoutes){w=_.apiRoutes;let V=Object.keys(w).length;if(V>0)console.log(`${e.blue}Loaded ${e.bright}${V} API route${V>1?"s":""}${e.reset}`)}if(_?.broadcasting?.enabled)try{let{startBroadcasting:V,loadChannels:Y}=await import("./chunk-vyw40ym7.js"),xe=_.broadcasting;await V(xe);let le=xe.port??6001;console.log(`${e.magenta}Broadcasting on ${e.cyan}ws://localhost:${le}/ws${e.reset}`);let Oe=ge.join(process.cwd(),"channels.ts");if(Be.existsSync(Oe))try{let ne=await Y(Oe);console.log(`${e.blue}Loaded ${e.bright}${ne} broadcast channel${ne!==1?"s":""}${e.blue} from channels.ts${e.reset}`)}catch(ne){console.warn(`${e.yellow}Failed to load channels.ts: ${ne.message}${e.reset}`)}}catch(V){console.warn(`${e.yellow}Broadcasting failed to start: ${V.message}${e.reset}`)}}catch{}let{createServerApi:D,isServerApiSource:E}=await import("./chunk-ydt1pbhx.js"),R=await D(process.cwd(),k);if(console.log(`${e.blue}Starting server on ${e.cyan}http://localhost:${T}/${e.reset}...`),o)console.log(`${e.magenta}Hot reload enabled on ws://localhost:${u}${e.reset}`);let O=Nr({port:T,async fetch(A){return $n(A,await(async()=>{let _=new URL(A.url);if([g,ge.dirname(f),ge.join(process.cwd(),"public")].some((ne)=>E(ge.join(ne,_.pathname),process.cwd(),k)))return new Response("Not Found",{status:404});if(b)try{let ne=await b.handleRequest(A);if(ne.status!==404)return ne}catch{}if(w[_.pathname])try{return await w[_.pathname](A)}catch(ne){return new Response(JSON.stringify({error:ne.message}),{status:500,headers:{"Content-Type":"application/json"}})}let V=await R(A);if(V)return V;if(_.pathname==="/")return(async()=>{let z=await y(h||"");if(o)z=Ne(z,u);if(n.native)if(z.includes("<head>"))z=z.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else if(z.includes("<html"))z=z.replace(/(<html[^>]*>)/,"$1<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>");else z="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+z;if(n.titlebarHidden)if(z.includes("<head>"))z=z.replace("<head>","<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script>");else if(z.includes("<html"))z=z.replace(/(<html[^>]*>)/,"$1<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>");else z=`<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>${z}`;return z})().then((z)=>new Response(z,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}}));let Y=ge.join(g,_.pathname);if(Be.existsSync(Y)&&Be.statSync(Y).isFile()){let ne=Bun.file(Y),z=ge.extname(Y).toLowerCase(),M="text/plain";if(z===".ts"||z===".tsx"){let Fe=new Bun.Transpiler({loader:z===".tsx"?"tsx":"ts"}),ze=await ne.text(),Ye=Fe.transformSync(ze);return new Response(Ye,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(z){case".html":M="text/html";break;case".css":M="text/css";break;case".js":M="text/javascript";break;case".json":M="application/json";break;case".png":M="image/png";break;case".jpg":case".jpeg":M="image/jpeg";break;case".gif":M="image/gif";break;case".woff":M="font/woff";break;case".woff2":M="font/woff2";break;case".ttf":M="font/ttf";break;case".otf":M="font/otf";break;case".eot":M="application/vnd.ms-fontobject";break}return new Response(ne,{headers:{"Content-Type":M}})}let xe=ge.dirname(f),le=ge.join(xe,_.pathname);if(Be.existsSync(le)&&Be.statSync(le).isFile()){let ne=Bun.file(le),z=ge.extname(le).toLowerCase(),M="text/plain";if(z===".ts"||z===".tsx"){let Fe=new Bun.Transpiler({loader:z===".tsx"?"tsx":"ts"}),ze=await ne.text(),Ye=Fe.transformSync(ze);return new Response(Ye,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(z){case".html":M="text/html";break;case".css":M="text/css";break;case".js":M="text/javascript";break;case".json":M="application/json";break;case".png":M="image/png";break;case".jpg":case".jpeg":M="image/jpeg";break;case".gif":M="image/gif";break;case".svg":M="image/svg+xml";break;case".ico":M="image/x-icon";break;case".woff":M="font/woff";break;case".woff2":M="font/woff2";break;case".ttf":M="font/ttf";break;case".otf":M="font/otf";break;case".eot":M="application/vnd.ms-fontobject";break}return new Response(ne,{headers:{"Content-Type":M}})}let Oe=ge.join(process.cwd(),"public",_.pathname);if(Be.existsSync(Oe)&&Be.statSync(Oe).isFile()){let ne=Bun.file(Oe),z=ge.extname(Oe).toLowerCase(),M="application/octet-stream";if(z===".ts"||z===".tsx"){let Fe=new Bun.Transpiler({loader:z===".tsx"?"tsx":"ts"}),ze=await ne.text(),Ye=Fe.transformSync(ze);return new Response(Ye,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(z){case".html":M="text/html";break;case".css":M="text/css";break;case".js":M="text/javascript";break;case".json":M="application/json";break;case".png":M="image/png";break;case".jpg":case".jpeg":M="image/jpeg";break;case".gif":M="image/gif";break;case".svg":M="image/svg+xml";break;case".ico":M="image/x-icon";break;case".woff":M="font/woff";break;case".woff2":M="font/woff2";break;case".ttf":M="font/ttf";break;case".otf":M="font/otf";break;case".eot":M="application/vnd.ms-fontobject";break}return new Response(ne,{headers:{"Content-Type":M}})}return new Response("Not Found",{status:404})})())},error(A){return new Response(`<pre>${A}
|
|
954
954
|
${A.stack}</pre>`,{headers:{"Content-Type":"text/html"}})}});console.clear(),console.log(`
|
|
955
955
|
${e.blue}stx${e.reset} ${e.green}${process.env.stx_VERSION||"v0.0.10"}${e.reset} ${e.dim}ready in ${Math.random()*10+5|0}.${Math.random()*90+10|0} ms${e.reset}`),console.log(`
|
|
956
956
|
${e.bright}\u2192 ${e.cyan}http://localhost:${T}/${e.reset}`),console.log(`
|
|
@@ -1437,12 +1437,12 @@ ${w.stack}</pre>`,{headers:{"Content-Type":"text/html"}})}});console.clear(),con
|
|
|
1437
1437
|
${e.blue}stx${e.reset} ${e.green}${process.env.stx_VERSION||"v0.0.10"}${e.reset} ${e.dim}ready in ${Math.random()*10+5|0}.${Math.random()*90+10|0} ms${e.reset}`),console.log(`
|
|
1438
1438
|
${e.bright}\u2192 ${e.cyan}http://localhost:${x}/${e.reset}`),console.log(`
|
|
1439
1439
|
${e.yellow}Routes:${e.reset}`);let S=new Set(f.map((w)=>w.routeTemplate)),T=Object.entries(u).filter(([w])=>!S.has(w)).sort(([w],[b])=>w.localeCompare(b)).map(([w,b])=>({route:w==="/"?"/":w,filePath:Pe.relative(process.cwd(),b.filePath),fileType:b.fileType}));for(let w of f){let b=w.routeTemplate.replace(/\[([^\]]+)\]/g,":$1");T.push({route:b,filePath:Pe.relative(process.cwd(),w.filePath),fileType:"stx"})}if(T.sort((w,b)=>w.route.localeCompare(b.route)),T.forEach((w,b)=>{let D=b===T.length-1?"\u2514\u2500 ":"\u251C\u2500 ",E=w.fileType==="md"?`${e.magenta}(markdown)${e.reset}`:"";console.log(` ${e.green}${D}${w.route}${e.reset} \u2192 ${e.bright}${w.filePath}${e.reset} ${E}`)}),console.log(`
|
|
1440
|
-
Press ${e.cyan}h${e.reset} + ${e.cyan}Enter${e.reset} to show shortcuts`),Ke(v.url.toString(),()=>{if(d)Xe.watch(l,{recursive:!0}).close();v.stop()}),d){console.log(`${e.blue}Watching for changes...${e.reset}`);let w=Xe.watch(l,{recursive:!0},async(b,k)=>{if(!k)return;if(k.endsWith(".stx")||k.endsWith(".js")||k.endsWith(".ts")||k.endsWith(".md"))console.log(`${e.yellow}File ${e.bright}${k}${e.yellow} changed, rebuilding...${e.reset}`),Je.clear(),fe(),await g()});process.on("SIGINT",()=>{w.close(),v.stop(),process.exit(0)})}return!0}function an(t){return String(t??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}var{serve:Wr}=globalThis.Bun;import me from"fs";import te from"path";async function dn(t){try{return gn(await Bun.file(t).text())}catch{return}}function Nt(t){let n=Bun.file(t),r=te.extname(t).toLowerCase(),d={".html":"text/html",".css":"text/css",".js":"text/javascript",".json":"application/json",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".ico":"image/x-icon",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"},l=[".js",".css",".json"].includes(r)?{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}:{};return new Response(n,{headers:{"Content-Type":d[r]||"application/octet-stream",...l}})}async function Hr(t=".",n={}){let r=n.port||3000,d=n.watch!==!1,o=n.hotReload!==!1&&d,l=null,u=n.hmrPort||r+1,f=te.resolve(t),{loadStxConfig:g}=await import("./chunk-3eqs0rpv.js"),h=await g(f),{createServerApi:x,isServerApiSource:v}=await import("./chunk-3ftaegqg.js"),S=n.stxOptions?.serverApi??h.serverApi,T=await x(f,S),w=h.root&&h.root!=="."?te.join(f,h.root):f,b=n.pagesDir||h.pagesDir||"pages",k=te.join(w,b);if(!me.existsSync(k)&&!h._layerPageDirs?.some((P)=>me.existsSync(P)))return console.error(`${e.red}Error: No '${b}' directory found${e.reset}`),console.log(`${e.dim}Looked in: ${e.bright}${k}${e.reset}`),console.log(`${e.dim}Run stx dev from the app directory, pass it as an argument (stx dev <dir>),${e.reset}`),console.log(`${e.dim}point at another directory with --pages <dir>, or set pagesDir in stx.config.ts.${e.reset}`),console.log(`${e.dim}Starting fresh? Create ${b}/index.stx for the homepage.${e.reset}`),!1;let D=X(w,{pagesDir:b,pagesDirs:h._layerPageDirs?[k,...h._layerPageDirs.slice(1)]:void 0});if(D.length===0)return console.error(`${e.red}Error: No page files found in ${e.bright}${k}${e.reset}`),!1;console.log(`${e.blue}Found ${e.bright}${D.length}${e.blue} routes${e.reset}`);let E=h?._pluginPageDirs||[],R=[];for(let{dir:P,prefix:j}of E)if(me.existsSync(P)){let N=X(te.dirname(P),{pagesDir:te.basename(P)});for(let Q of N){let q=j==="/"?Q.pattern:`${j}${Q.pattern==="/"?"":Q.pattern}`;R.push({route:{...Q,pattern:q},prefix:j})}if(N.length>0)console.log(`${e.blue}Plugin pages: ${e.bright}${N.length}${e.blue} routes at ${e.cyan}${j}${e.reset}`)}let O=new Map,C=null,A=null;if(n.stxOptions?.shell!==!1){if(A=await aa(f,n.stxOptions?.shell),A){if(C=await mo(A,n.stxOptions||{}),C)console.log(`${e.blue}Using app shell: ${e.bright}${te.relative(f,A)}${e.reset} ${e.dim}(deprecated: use layouts/default.stx instead)${e.reset}`)}}kt(),await Ct(f);let _=_t();if(_.length>0)console.log(`${e.blue}Loaded ${e.bright}${_.length}${e.blue} middleware: ${e.dim}${_.join(", ")}${e.reset}`);let V={},Y=null;try{let{loadStxConfig:P}=await import("./chunk-3eqs0rpv.js"),j=await P(f);if(j?.apiRouter)Y=j?.apiRouter,console.log(`${e.blue}Using custom router for API handling${e.reset}`);if(j?.apiRoutes){V=j.apiRoutes;let N=Object.keys(V).length;if(N>0)console.log(`${e.blue}Loaded ${e.bright}${N} API route${N>1?"s":""}${e.reset}`)}if(j?.broadcasting?.enabled)try{let{startBroadcasting:N,loadChannels:Q}=await import("./chunk-7agp0wj2.js"),q=j.broadcasting;await N(q);let Ae=q.port??6001;console.log(`${e.magenta}Broadcasting on ${e.cyan}ws://localhost:${Ae}/ws${e.reset}`);let ve=te.join(process.cwd(),"channels.ts");if(me.existsSync(ve))try{let U=await Q(ve);console.log(`${e.blue}Loaded ${e.bright}${U} broadcast channel${U!==1?"s":""}${e.blue} from channels.ts${e.reset}`)}catch(U){console.warn(`${e.yellow}Failed to load channels.ts: ${U.message}${e.reset}`)}}catch(N){console.warn(`${e.yellow}Broadcasting failed to start: ${N.message}${e.reset}`)}}catch{}let xe=c(f,"output");me.mkdirSync(xe,{recursive:!0});let le=new Map,Oe=new Set,ne=async(P)=>{let j=$s(k,P);if(!j)return null;try{let N=await Bun.build({entrypoints:[j],outdir:xe,plugins:[rt],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...n.stxOptions});if(!N.success)return null;let Q=N.outputs.find((q)=>q.path.endsWith(".html"));if(!Q)return null;return await Bun.file(Q.path).text()}catch{return null}},z=new Map,M=async(P,j)=>{try{let{processDirectives:N,extractVariables:Q,defaultConfig:q,loadStxConfig:Ae,injectRouterScript:ve}=await import("./chunk-3eqs0rpv.js"),{checkCache:U,cacheTemplate:J,readFileCached:W,templateCache:pe}=await import("./chunk-1kz70290.js"),G=await Ae(f),Ue=(se)=>{if(!se)return se;if(te.isAbsolute(se))return se;return te.resolve(f,se)},ce={...q,...G,...n.stxOptions,autoShell:!0};if(n.debugDirectives)ce.debug=!0;ce.partialsDir=Ue(ce.partialsDir),ce.componentsDir=Ue(ce.componentsDir),ce.layoutsDir=Ue(ce.layoutsDir),ce.storesDir=Ue(ce.storesDir||"stores"),ce.cachePath=Ue(ce.cachePath)??c(f,"cache");let H=!j&&!n.profile,re=ce.cache!==!1;if(re&&H){let se=pe.get(P.filePath);if(se)try{if((await me.promises.stat(P.filePath)).mtime.getTime()<=se.mtime){let He=!0;for(let Se of se.dependencies){if(!me.existsSync(Se)){He=!1;break}if((await me.promises.stat(Se)).mtime.getTime()>se.mtime){He=!1;break}}if(He){let Se=se.output;if(C)Se=We(Se,{preserveHead:!0});let st=z.get(P.filePath);return{route:P,content:Se,status:st?.status??await dn(P.filePath),headers:st?.headers}}}}catch{}let Ie=await U(P.filePath,ce);if(Ie){let je=Ie;if(C)je=We(je,{preserveHead:!0});let He=z.get(P.filePath);return{route:P,content:je,status:He?.status??await dn(P.filePath),headers:He?.headers}}}let Z=re?await W(P.filePath):await Bun.file(P.filePath).text(),oe=gn(Z),{classifyAllScripts:ue}=await import("./chunk-3eqs0rpv.js"),B=ue(Z),Le=B.server.map((se)=>se.content),Me=Z;for(let se of B.server)Me=Me.replace(se.fullTag,"");let ee={__filename:P.filePath,__dirname:te.dirname(P.filePath),__stx_options:ce,params:j??{},__stx_runtime_head:{}};for(let se of Le)try{await Q(se,ee,P.filePath)}catch(Ie){if(n.stxOptions?.debug)console.error("[stx] variable extraction error",P.filePath,Ie?.message||Ie)}let De=new Set,he;if(n.profile){let se=performance.now();he=await N(Me,ee,P.filePath,ce,De);let Ie=performance.now()-se,je=te.relative(f,P.filePath)||P.filePath;console.log(`[stx:profile] ${je} \u2192 ${Ie.toFixed(2)}ms`)}else he=await N(Me,ee,P.filePath,ce,De);if(!C)he=await ve(he,{router:ce.router});{let{interpolateScriptExpressions:se}=await import("./chunk-yd0074ks.js");he=he.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/g,(Ie,je,He)=>{if(!/function\s+__stx_setup_/.test(He))return Ie;return`<script${je}>${se(He,ee)}</script>`})}if(C)he=We(he,{preserveHead:!0});if(re&&H)await J(P.filePath,he,De,ce);let{extractStreamBoundaries:ct}=await import("./chunk-9ttf7k5e.js"),Qe=ct(ee),ot=ee.__streamTemplates;if(ot&&typeof ot==="object"&&Object.keys(ot).length>0){let se=ee.streamBoundaries||{},Ie={...ce,autoShell:!1},je=Object.keys(ot).map((Se)=>({id:Se,render:async()=>{let st=typeof se[Se]==="function"?await se[Se]():void 0;return N(ot[Se],{...ee,$boundary:st},P.filePath,Ie,new Set)}})),He=new Set(je.map((Se)=>Se.id));Qe=[...(Qe||[]).filter((Se)=>!He.has(Se.id)),...je]}if(Qe&&Qe.length>0)Oe.add(P.pattern);else Qe=void 0;let Vt=It(ee),qt=Ot(ee);if(H)z.set(P.filePath,{status:Vt,headers:qt});return{route:P,content:he,status:Vt??oe,headers:qt,boundaries:Qe}}catch(N){return console.error(`${e.red}Error building ${e.bright}${P.pattern}${e.reset}:`,N),null}},Fe=8,ze=async()=>{let P=new Set(le.keys()),j=new Set(O.keys());le.clear(),O.clear();let N=n.prebuild===!1?D.filter((q)=>P.has(q.pattern)):D,Q=n.prebuild===!1?R.filter(({route:q})=>j.has(q.pattern)):R;for(let q=0;q<N.length;q+=Fe){let Ae=N.slice(q,q+Fe),ve=await Promise.all(Ae.map((U)=>M(U)));for(let U of ve)if(U)le.set(U.route.pattern,U)}for(let q=0;q<Q.length;q+=Fe){let Ae=Q.slice(q,q+Fe),ve=await Promise.all(Ae.map(({route:U})=>M(U)));for(let U of ve)if(U)O.set(U.route.pattern,U)}return le.size>0};if(console.log(`${e.blue}${n.prebuild===!1?"Rendering pages on request...":"Building pages..."}${e.reset}`),!(n.prebuild===!1?D.length+R.length>0:await ze()))return console.error(`${e.red}No pages were successfully built${e.reset}`),!1;await cn(f);let Ge=r;try{if(Ge=await Ve(r),Ge!==r)console.log(`${e.yellow}Port ${r} is busy, using port ${Ge} instead${e.reset}`)}catch{return console.error(`${e.red}Could not find an available port${e.reset}`),!1}if(o){let P=n.hmrPort||Ge+1;l=vt({wsPort:P,verbose:!1}),u=l.start(P)}let Pt=(P,j)=>{let Q=`<script data-stx-route-params>(function(){var p=${JSON.stringify(j).replace(/</g,"\\u003C").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")};window.__stx_rp=p;if(window.stx){window.stx._rp=p;if(window.stx.setRouteParams)window.stx.setRouteParams(p)}})()</script>`;if(P.includes("</head>"))return P.replace("</head>",`${Q}</head>`);if(P.includes("<body"))return P.replace(/<body([^>]*)>/,`<body$1>${Q}`);return Q+P};console.log(`${e.blue}Starting server...${e.reset}`);let At=Wr({port:Ge,hostname:n.hostname,async fetch(P){let j=new URL(P.url),N=n.stxOptions?.offline??h.offline;if(j.pathname===No&&N?.enabled){if(!["GET","HEAD"].includes(P.method))return new Response("Method Not Allowed",{status:405,headers:{Allow:"GET, HEAD"}});return new Response(P.method==="HEAD"?null:Mo(N,os()),{headers:{"Content-Type":"application/javascript; charset=utf-8","Cache-Control":"no-store","Service-Worker-Allowed":"/"}})}let Q=h?.publicDir||"public",q=te.join(f,Q,j.pathname),Ae=te.join(f,j.pathname),ve=te.join(xe,j.pathname);if([q,Ae,ve].some((H)=>v(H,f,S)))return new Response("Not Found",{status:404});let[U,J,W]=await Promise.all([me.promises.stat(q).catch(()=>null),me.promises.stat(Ae).catch(()=>null),me.promises.stat(ve).catch(()=>null)]);if(U?.isFile()&&!v(q,f,S))return Nt(q);if(J?.isFile()&&!v(Ae,f,S))return Nt(Ae);if(W?.isFile()&&!v(ve,f,S))return Nt(ve);if(j.pathname.startsWith("/_stx/component/")){let H=decodeURIComponent(j.pathname.slice(16));if(H)try{let re=`<${H} />`,Z={...buildConfig,autoShell:!1},oe=await processDirectives(re,{},te.join(f,"components",`${H}.stx`),Z,new Set);return new Response(oe,{headers:{"Content-Type":"text/html"}})}catch(re){return new Response(`<div class="stx-async-error">${re.message}</div>`,{status:500,headers:{"Content-Type":"text/html"}})}}if(j.pathname==="/_stx/img"){let{handleImageRequest:H}=await import("./chunk-8g8h2xwz.js"),re=await H(P,{publicDir:te.join(f,Q),cacheDir:c(f,"cache","img")});if(re)return re}if(Y)try{let H=await Y.handleRequest(P);if(H.status!==404)return H}catch{}if(V[j.pathname])try{return await V[j.pathname](P)}catch(H){return new Response(JSON.stringify({error:H.message}),{status:500,headers:{"Content-Type":"application/json"}})}let pe=await T(P);if(pe)return pe;let G=pr(j.pathname,D);if(G){let H=le.get(G.route.pattern),re=Oe.has(G.route.pattern);if(!H||G.route.isDynamic&&Object.keys(G.params).length>0||re){let Z=await M(G.route,G.params);if(Z){if(H=Z,!G.route.isDynamic&&!re)le.set(G.route.pattern,Z)}}if(H){let Z=H.status??200,oe=H.headers??{},ue=(G.route.filePath?yt(await Bun.file(G.route.filePath).text().catch(()=>"")):null)??{};if(ue.validate){if(!await ue.validate({params:G.params})){let Me=await ne(404);if(Me){let ee=Me;if(ee=await y(ee,f),o)ee=Ne(ee,u);return new Response(ee,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})}}if(ue.middleware){let Le=Et(j.pathname,G.params,ue,j.search),Me=Tt(Le,null,P,{isServer:!0}),ee=await $t(ue.middleware,Me);if(ee.redirect){let De=ee.redirect.path,he=ee.redirect.options.redirectCode||302,ct=new Headers(ee.responseHeaders);return ct.set("Location",De),new Response(null,{status:he,headers:ct})}if(ee.abort){let{statusCode:De,message:he}=ee.abort.error;return new Response(`<!DOCTYPE html><html><head><title>Error ${De}</title></head><body><h1>Error ${De}</h1><p>${he}</p></body></html>`,{status:De,headers:{"Content-Type":"text/html"}})}if(Object.keys(ee.state).length>0){let De=`<script>(function(){var s=typeof stx!=='undefined'?stx:{};s._ms=${JSON.stringify(ee.state)};if(s.setMiddlewareState)s.setMiddlewareState(s._ms);})()</script>`;H.content=H.content.replace("</head>",`${De}</head>`)}}let B=H.content;if(C&&ca(P)&&qe(B,h?.router?.container||"main")){let Le=et(B),Me=be(B),ee=B.match(/<title[^>]*>([\s\S]*?)<\/title>/i),De=ee?An(ee[1].trim()):"";if(Object.keys(G.params).length>0)B=Pt(B,G.params);B=await y(B,f);let he=h?.router?.container||"main";return B=Ee(B,he,!0),new Response(B,{status:Z,headers:{"Content-Type":"text/html","X-STX-Fragment":"true","X-STX-Layout":Le.layout,"X-STX-Layout-Group":Le.group,"X-STX-Runtime":Me?"true":"false",...De&&{"X-STX-Title":encodeURIComponent(De)},[rc]:os(),...L(),"Cache-Control":ft}})}if(C)B=qr(C,B);if(Object.keys(G.params).length>0)B=Pt(B,G.params);if(B=await y(B,f),o)B=Ne(B,u);if(n.native)if(B.includes("<head>"))B=B.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else B="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+B;if(n.titlebarHidden)if(B.includes("<head>"))B=B.replace("<head>","<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script>");else B=`<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>${B}`;if(H.boundaries&&H.boundaries.length>0){let{renderStreamingPage:Le,streamToResponse:Me}=await import("./chunk-9ttf7k5e.js");return Me(Le(B,H.boundaries,{timeoutMs:30000}),{status:Z,headers:{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}return new Response(B,{status:Z,headers:{"Content-Type":"text/html",...L(),"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0",...oe}})}}if(R.length>0){let H=R.map((Z)=>Z.route),re=pr(j.pathname,H);if(re){let Z=O.get(re.route.pattern);if(!Z||re.route.isDynamic){let oe=await M(re.route,re.params);if(oe){if(Z=oe,!re.route.isDynamic)O.set(re.route.pattern,oe)}}if(Z){let oe=Z.content;if(C)oe=qr(C,oe);if(Object.keys(re.params).length>0)oe=Pt(oe,re.params);if(oe=await y(oe,f),o)oe=Ne(oe,u);return new Response(oe,{status:Z.status??200,headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}for(let{prefix:Z}of E)if(Z!=="/"&&j.pathname.startsWith(Z)){let oe=O.get(Z)||O.get(Z+"/");if(!oe){let ue=R.find(({route:B})=>B.pattern===Z||B.pattern===`${Z}/`);if(ue){let B=await M(ue.route);if(B)oe=B,O.set(ue.route.pattern,B)}}if(oe){let ue=oe.content;if(C)ue=qr(C,ue);if(ue=await y(ue,f),o)ue=Ne(ue,u);return new Response(ue,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}}if(St(j.pathname))return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}});let Ue=le.get("/");if(Ue){let H=Ue.content;if(H=await y(H,f),o)H=Ne(H,u);if(n.native)if(H.includes("<head>"))H=H.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else H="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+H;return new Response(H,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}let ce=await ne(404);if(ce){let H=ce;if(H=await y(H,f),o)H=Ne(H,u);return new Response(H,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})},async error(P){let j=await ne(500);if(j)return new Response(j,{status:500,headers:{"Content-Type":"text/html"}});return new Response(`<pre>${P}
|
|
1440
|
+
Press ${e.cyan}h${e.reset} + ${e.cyan}Enter${e.reset} to show shortcuts`),Ke(v.url.toString(),()=>{if(d)Xe.watch(l,{recursive:!0}).close();v.stop()}),d){console.log(`${e.blue}Watching for changes...${e.reset}`);let w=Xe.watch(l,{recursive:!0},async(b,k)=>{if(!k)return;if(k.endsWith(".stx")||k.endsWith(".js")||k.endsWith(".ts")||k.endsWith(".md"))console.log(`${e.yellow}File ${e.bright}${k}${e.yellow} changed, rebuilding...${e.reset}`),Je.clear(),fe(),await g()});process.on("SIGINT",()=>{w.close(),v.stop(),process.exit(0)})}return!0}function an(t){return String(t??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}var{serve:Wr}=globalThis.Bun;import me from"fs";import te from"path";async function dn(t){try{return gn(await Bun.file(t).text())}catch{return}}function Nt(t){let n=Bun.file(t),r=te.extname(t).toLowerCase(),d={".html":"text/html",".css":"text/css",".js":"text/javascript",".json":"application/json",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".ico":"image/x-icon",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"},l=[".js",".css",".json"].includes(r)?{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}:{};return new Response(n,{headers:{"Content-Type":d[r]||"application/octet-stream",...l}})}async function Hr(t=".",n={}){let r=n.port||3000,d=n.watch!==!1,o=n.hotReload!==!1&&d,l=null,u=n.hmrPort||r+1,f=te.resolve(t),{loadStxConfig:g}=await import("./chunk-vpazz8ca.js"),h=await g(f),{createServerApi:x,isServerApiSource:v}=await import("./chunk-ydt1pbhx.js"),S=n.stxOptions?.serverApi??h.serverApi,T=await x(f,S),w=h.root&&h.root!=="."?te.join(f,h.root):f,b=n.pagesDir||h.pagesDir||"pages",k=te.join(w,b);if(!me.existsSync(k)&&!h._layerPageDirs?.some((P)=>me.existsSync(P)))return console.error(`${e.red}Error: No '${b}' directory found${e.reset}`),console.log(`${e.dim}Looked in: ${e.bright}${k}${e.reset}`),console.log(`${e.dim}Run stx dev from the app directory, pass it as an argument (stx dev <dir>),${e.reset}`),console.log(`${e.dim}point at another directory with --pages <dir>, or set pagesDir in stx.config.ts.${e.reset}`),console.log(`${e.dim}Starting fresh? Create ${b}/index.stx for the homepage.${e.reset}`),!1;let D=X(w,{pagesDir:b,pagesDirs:h._layerPageDirs?[k,...h._layerPageDirs.slice(1)]:void 0});if(D.length===0)return console.error(`${e.red}Error: No page files found in ${e.bright}${k}${e.reset}`),!1;console.log(`${e.blue}Found ${e.bright}${D.length}${e.blue} routes${e.reset}`);let E=h?._pluginPageDirs||[],R=[];for(let{dir:P,prefix:j}of E)if(me.existsSync(P)){let N=X(te.dirname(P),{pagesDir:te.basename(P)});for(let Q of N){let q=j==="/"?Q.pattern:`${j}${Q.pattern==="/"?"":Q.pattern}`;R.push({route:{...Q,pattern:q},prefix:j})}if(N.length>0)console.log(`${e.blue}Plugin pages: ${e.bright}${N.length}${e.blue} routes at ${e.cyan}${j}${e.reset}`)}let O=new Map,C=null,A=null;if(n.stxOptions?.shell!==!1){if(A=await aa(f,n.stxOptions?.shell),A){if(C=await mo(A,n.stxOptions||{}),C)console.log(`${e.blue}Using app shell: ${e.bright}${te.relative(f,A)}${e.reset} ${e.dim}(deprecated: use layouts/default.stx instead)${e.reset}`)}}kt(),await Ct(f);let _=_t();if(_.length>0)console.log(`${e.blue}Loaded ${e.bright}${_.length}${e.blue} middleware: ${e.dim}${_.join(", ")}${e.reset}`);let V={},Y=null;try{let{loadStxConfig:P}=await import("./chunk-vpazz8ca.js"),j=await P(f);if(j?.apiRouter)Y=j?.apiRouter,console.log(`${e.blue}Using custom router for API handling${e.reset}`);if(j?.apiRoutes){V=j.apiRoutes;let N=Object.keys(V).length;if(N>0)console.log(`${e.blue}Loaded ${e.bright}${N} API route${N>1?"s":""}${e.reset}`)}if(j?.broadcasting?.enabled)try{let{startBroadcasting:N,loadChannels:Q}=await import("./chunk-vyw40ym7.js"),q=j.broadcasting;await N(q);let Ae=q.port??6001;console.log(`${e.magenta}Broadcasting on ${e.cyan}ws://localhost:${Ae}/ws${e.reset}`);let ve=te.join(process.cwd(),"channels.ts");if(me.existsSync(ve))try{let U=await Q(ve);console.log(`${e.blue}Loaded ${e.bright}${U} broadcast channel${U!==1?"s":""}${e.blue} from channels.ts${e.reset}`)}catch(U){console.warn(`${e.yellow}Failed to load channels.ts: ${U.message}${e.reset}`)}}catch(N){console.warn(`${e.yellow}Broadcasting failed to start: ${N.message}${e.reset}`)}}catch{}let xe=c(f,"output");me.mkdirSync(xe,{recursive:!0});let le=new Map,Oe=new Set,ne=async(P)=>{let j=$s(k,P);if(!j)return null;try{let N=await Bun.build({entrypoints:[j],outdir:xe,plugins:[rt],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...n.stxOptions});if(!N.success)return null;let Q=N.outputs.find((q)=>q.path.endsWith(".html"));if(!Q)return null;return await Bun.file(Q.path).text()}catch{return null}},z=new Map,M=async(P,j)=>{try{let{processDirectives:N,extractVariables:Q,defaultConfig:q,loadStxConfig:Ae,injectRouterScript:ve}=await import("./chunk-vpazz8ca.js"),{checkCache:U,cacheTemplate:J,readFileCached:W,templateCache:pe}=await import("./chunk-67k5q95t.js"),G=await Ae(f),Ue=(se)=>{if(!se)return se;if(te.isAbsolute(se))return se;return te.resolve(f,se)},ce={...q,...G,...n.stxOptions,autoShell:!0};if(n.debugDirectives)ce.debug=!0;ce.partialsDir=Ue(ce.partialsDir),ce.componentsDir=Ue(ce.componentsDir),ce.layoutsDir=Ue(ce.layoutsDir),ce.storesDir=Ue(ce.storesDir||"stores"),ce.cachePath=Ue(ce.cachePath)??c(f,"cache");let H=!j&&!n.profile,re=ce.cache!==!1;if(re&&H){let se=pe.get(P.filePath);if(se)try{if((await me.promises.stat(P.filePath)).mtime.getTime()<=se.mtime){let He=!0;for(let Se of se.dependencies){if(!me.existsSync(Se)){He=!1;break}if((await me.promises.stat(Se)).mtime.getTime()>se.mtime){He=!1;break}}if(He){let Se=se.output;if(C)Se=We(Se,{preserveHead:!0});let st=z.get(P.filePath);return{route:P,content:Se,status:st?.status??await dn(P.filePath),headers:st?.headers}}}}catch{}let Ie=await U(P.filePath,ce);if(Ie){let je=Ie;if(C)je=We(je,{preserveHead:!0});let He=z.get(P.filePath);return{route:P,content:je,status:He?.status??await dn(P.filePath),headers:He?.headers}}}let Z=re?await W(P.filePath):await Bun.file(P.filePath).text(),oe=gn(Z),{classifyAllScripts:ue}=await import("./chunk-vpazz8ca.js"),B=ue(Z),Le=B.server.map((se)=>se.content),Me=Z;for(let se of B.server)Me=Me.replace(se.fullTag,"");let ee={__filename:P.filePath,__dirname:te.dirname(P.filePath),__stx_options:ce,params:j??{},__stx_runtime_head:{}};for(let se of Le)try{await Q(se,ee,P.filePath)}catch(Ie){if(n.stxOptions?.debug)console.error("[stx] variable extraction error",P.filePath,Ie?.message||Ie)}let De=new Set,he;if(n.profile){let se=performance.now();he=await N(Me,ee,P.filePath,ce,De);let Ie=performance.now()-se,je=te.relative(f,P.filePath)||P.filePath;console.log(`[stx:profile] ${je} \u2192 ${Ie.toFixed(2)}ms`)}else he=await N(Me,ee,P.filePath,ce,De);if(!C)he=await ve(he,{router:ce.router});{let{interpolateScriptExpressions:se}=await import("./chunk-c179xpsq.js");he=he.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/g,(Ie,je,He)=>{if(!/function\s+__stx_setup_/.test(He))return Ie;return`<script${je}>${se(He,ee)}</script>`})}if(C)he=We(he,{preserveHead:!0});if(re&&H)await J(P.filePath,he,De,ce);let{extractStreamBoundaries:ct}=await import("./chunk-pyz2jqph.js"),Qe=ct(ee),ot=ee.__streamTemplates;if(ot&&typeof ot==="object"&&Object.keys(ot).length>0){let se=ee.streamBoundaries||{},Ie={...ce,autoShell:!1},je=Object.keys(ot).map((Se)=>({id:Se,render:async()=>{let st=typeof se[Se]==="function"?await se[Se]():void 0;return N(ot[Se],{...ee,$boundary:st},P.filePath,Ie,new Set)}})),He=new Set(je.map((Se)=>Se.id));Qe=[...(Qe||[]).filter((Se)=>!He.has(Se.id)),...je]}if(Qe&&Qe.length>0)Oe.add(P.pattern);else Qe=void 0;let Vt=It(ee),qt=Ot(ee);if(H)z.set(P.filePath,{status:Vt,headers:qt});return{route:P,content:he,status:Vt??oe,headers:qt,boundaries:Qe}}catch(N){return console.error(`${e.red}Error building ${e.bright}${P.pattern}${e.reset}:`,N),null}},Fe=8,ze=async()=>{let P=new Set(le.keys()),j=new Set(O.keys());le.clear(),O.clear();let N=n.prebuild===!1?D.filter((q)=>P.has(q.pattern)):D,Q=n.prebuild===!1?R.filter(({route:q})=>j.has(q.pattern)):R;for(let q=0;q<N.length;q+=Fe){let Ae=N.slice(q,q+Fe),ve=await Promise.all(Ae.map((U)=>M(U)));for(let U of ve)if(U)le.set(U.route.pattern,U)}for(let q=0;q<Q.length;q+=Fe){let Ae=Q.slice(q,q+Fe),ve=await Promise.all(Ae.map(({route:U})=>M(U)));for(let U of ve)if(U)O.set(U.route.pattern,U)}return le.size>0};if(console.log(`${e.blue}${n.prebuild===!1?"Rendering pages on request...":"Building pages..."}${e.reset}`),!(n.prebuild===!1?D.length+R.length>0:await ze()))return console.error(`${e.red}No pages were successfully built${e.reset}`),!1;await cn(f);let Ge=r;try{if(Ge=await Ve(r),Ge!==r)console.log(`${e.yellow}Port ${r} is busy, using port ${Ge} instead${e.reset}`)}catch{return console.error(`${e.red}Could not find an available port${e.reset}`),!1}if(o){let P=n.hmrPort||Ge+1;l=vt({wsPort:P,verbose:!1}),u=l.start(P)}let Pt=(P,j)=>{let Q=`<script data-stx-route-params>(function(){var p=${JSON.stringify(j).replace(/</g,"\\u003C").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")};window.__stx_rp=p;if(window.stx){window.stx._rp=p;if(window.stx.setRouteParams)window.stx.setRouteParams(p)}})()</script>`;if(P.includes("</head>"))return P.replace("</head>",`${Q}</head>`);if(P.includes("<body"))return P.replace(/<body([^>]*)>/,`<body$1>${Q}`);return Q+P};console.log(`${e.blue}Starting server...${e.reset}`);let At=Wr({port:Ge,hostname:n.hostname,async fetch(P){let j=new URL(P.url),N=n.stxOptions?.offline??h.offline;if(j.pathname===No&&N?.enabled){if(!["GET","HEAD"].includes(P.method))return new Response("Method Not Allowed",{status:405,headers:{Allow:"GET, HEAD"}});return new Response(P.method==="HEAD"?null:Mo(N,os()),{headers:{"Content-Type":"application/javascript; charset=utf-8","Cache-Control":"no-store","Service-Worker-Allowed":"/"}})}let Q=h?.publicDir||"public",q=te.join(f,Q,j.pathname),Ae=te.join(f,j.pathname),ve=te.join(xe,j.pathname);if([q,Ae,ve].some((H)=>v(H,f,S)))return new Response("Not Found",{status:404});let[U,J,W]=await Promise.all([me.promises.stat(q).catch(()=>null),me.promises.stat(Ae).catch(()=>null),me.promises.stat(ve).catch(()=>null)]);if(U?.isFile()&&!v(q,f,S))return Nt(q);if(J?.isFile()&&!v(Ae,f,S))return Nt(Ae);if(W?.isFile()&&!v(ve,f,S))return Nt(ve);if(j.pathname.startsWith("/_stx/component/")){let H=decodeURIComponent(j.pathname.slice(16));if(H)try{let re=`<${H} />`,Z={...buildConfig,autoShell:!1},oe=await processDirectives(re,{},te.join(f,"components",`${H}.stx`),Z,new Set);return new Response(oe,{headers:{"Content-Type":"text/html"}})}catch(re){return new Response(`<div class="stx-async-error">${re.message}</div>`,{status:500,headers:{"Content-Type":"text/html"}})}}if(j.pathname==="/_stx/img"){let{handleImageRequest:H}=await import("./chunk-dh1f8ga0.js"),re=await H(P,{publicDir:te.join(f,Q),cacheDir:c(f,"cache","img")});if(re)return re}if(Y)try{let H=await Y.handleRequest(P);if(H.status!==404)return H}catch{}if(V[j.pathname])try{return await V[j.pathname](P)}catch(H){return new Response(JSON.stringify({error:H.message}),{status:500,headers:{"Content-Type":"application/json"}})}let pe=await T(P);if(pe)return pe;let G=pr(j.pathname,D);if(G){let H=le.get(G.route.pattern),re=Oe.has(G.route.pattern);if(!H||G.route.isDynamic&&Object.keys(G.params).length>0||re){let Z=await M(G.route,G.params);if(Z){if(H=Z,!G.route.isDynamic&&!re)le.set(G.route.pattern,Z)}}if(H){let Z=H.status??200,oe=H.headers??{},ue=(G.route.filePath?yt(await Bun.file(G.route.filePath).text().catch(()=>"")):null)??{};if(ue.validate){if(!await ue.validate({params:G.params})){let Me=await ne(404);if(Me){let ee=Me;if(ee=await y(ee,f),o)ee=Ne(ee,u);return new Response(ee,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})}}if(ue.middleware){let Le=Et(j.pathname,G.params,ue,j.search),Me=Tt(Le,null,P,{isServer:!0}),ee=await $t(ue.middleware,Me);if(ee.redirect){let De=ee.redirect.path,he=ee.redirect.options.redirectCode||302,ct=new Headers(ee.responseHeaders);return ct.set("Location",De),new Response(null,{status:he,headers:ct})}if(ee.abort){let{statusCode:De,message:he}=ee.abort.error;return new Response(`<!DOCTYPE html><html><head><title>Error ${De}</title></head><body><h1>Error ${De}</h1><p>${he}</p></body></html>`,{status:De,headers:{"Content-Type":"text/html"}})}if(Object.keys(ee.state).length>0){let De=`<script>(function(){var s=typeof stx!=='undefined'?stx:{};s._ms=${JSON.stringify(ee.state)};if(s.setMiddlewareState)s.setMiddlewareState(s._ms);})()</script>`;H.content=H.content.replace("</head>",`${De}</head>`)}}let B=H.content;if(C&&ca(P)&&qe(B,h?.router?.container||"main")){let Le=et(B),Me=be(B),ee=B.match(/<title[^>]*>([\s\S]*?)<\/title>/i),De=ee?An(ee[1].trim()):"";if(Object.keys(G.params).length>0)B=Pt(B,G.params);B=await y(B,f);let he=h?.router?.container||"main";return B=Ee(B,he,!0),new Response(B,{status:Z,headers:{"Content-Type":"text/html","X-STX-Fragment":"true","X-STX-Layout":Le.layout,"X-STX-Layout-Group":Le.group,"X-STX-Runtime":Me?"true":"false",...De&&{"X-STX-Title":encodeURIComponent(De)},[rc]:os(),...L(),"Cache-Control":ft}})}if(C)B=qr(C,B);if(Object.keys(G.params).length>0)B=Pt(B,G.params);if(B=await y(B,f),o)B=Ne(B,u);if(n.native)if(B.includes("<head>"))B=B.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else B="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+B;if(n.titlebarHidden)if(B.includes("<head>"))B=B.replace("<head>","<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script>");else B=`<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>${B}`;if(H.boundaries&&H.boundaries.length>0){let{renderStreamingPage:Le,streamToResponse:Me}=await import("./chunk-pyz2jqph.js");return Me(Le(B,H.boundaries,{timeoutMs:30000}),{status:Z,headers:{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}return new Response(B,{status:Z,headers:{"Content-Type":"text/html",...L(),"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0",...oe}})}}if(R.length>0){let H=R.map((Z)=>Z.route),re=pr(j.pathname,H);if(re){let Z=O.get(re.route.pattern);if(!Z||re.route.isDynamic){let oe=await M(re.route,re.params);if(oe){if(Z=oe,!re.route.isDynamic)O.set(re.route.pattern,oe)}}if(Z){let oe=Z.content;if(C)oe=qr(C,oe);if(Object.keys(re.params).length>0)oe=Pt(oe,re.params);if(oe=await y(oe,f),o)oe=Ne(oe,u);return new Response(oe,{status:Z.status??200,headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}for(let{prefix:Z}of E)if(Z!=="/"&&j.pathname.startsWith(Z)){let oe=O.get(Z)||O.get(Z+"/");if(!oe){let ue=R.find(({route:B})=>B.pattern===Z||B.pattern===`${Z}/`);if(ue){let B=await M(ue.route);if(B)oe=B,O.set(ue.route.pattern,B)}}if(oe){let ue=oe.content;if(C)ue=qr(C,ue);if(ue=await y(ue,f),o)ue=Ne(ue,u);return new Response(ue,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}}if(St(j.pathname))return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}});let Ue=le.get("/");if(Ue){let H=Ue.content;if(H=await y(H,f),o)H=Ne(H,u);if(n.native)if(H.includes("<head>"))H=H.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else H="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+H;return new Response(H,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}let ce=await ne(404);if(ce){let H=ce;if(H=await y(H,f),o)H=Ne(H,u);return new Response(H,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})},async error(P){let j=await ne(500);if(j)return new Response(j,{status:500,headers:{"Content-Type":"text/html"}});return new Response(`<pre>${P}
|
|
1441
1441
|
${P.stack}</pre>`,{headers:{"Content-Type":"text/html"}})}});if(console.clear(),console.log(`
|
|
1442
1442
|
${e.blue}stx${e.reset} ${e.green}${process.env.stx_VERSION||"v0.0.10"}${e.reset} ${e.dim}ready in ${Math.random()*10+5|0}.${Math.random()*90+10|0} ms${e.reset}`),console.log(`
|
|
1443
1443
|
${e.bright}\u2192 ${e.cyan}http://localhost:${Ge}/${e.reset}`),o)console.log(`${e.dim} HMR: ws://localhost:${u}${e.reset}`);console.log(`
|
|
1444
1444
|
${e.yellow}Routes:${e.reset}`);let Dt=[...Rs(D,f)];for(let{route:P}of R)Dt.push(`${P.pattern}`);if(Dt.forEach((P,j)=>{let Q=j===Dt.length-1?"\u2514\u2500 ":"\u251C\u2500 ";console.log(` ${e.green}${Q}${e.reset}${P}`)}),console.log(`
|
|
1445
|
-
Press ${e.cyan}h${e.reset} + ${e.cyan}Enter${e.reset} to show shortcuts`),Ke(At.url.toString(),()=>{if(l)it();At.stop()}),n.native){let P,j=te.join(k,"index.stx");if(me.existsSync(j)){let Q=await Bun.file(j).text();P=gt(Q)}let N=h?.app?.window??{};await Ze(Ge,{title:h?.app?.head?.title||te.basename(f)||"stx App",width:N.width,height:N.height,darkMode:N.darkMode,hotReload:N.hotReload,titlebarHidden:N.titlebarHidden??n.titlebarHidden===!0,nativeSidebar:!!P,sidebarConfig:P})}if(d){console.log(`${e.blue}Watching for changes...${e.reset}`);let P=(U)=>U.startsWith("public/")||U.startsWith("public\\"),j=(U)=>{let J=U.toLowerCase();return J.endsWith(".stx")||J.endsWith(".html")||J.endsWith(".md")},N=new Map,Q=()=>{let U=new Set([f,...h._layerGraph?.layers.map((J)=>J.root)??[],...h._layerGraph?.configDependencies.map((J)=>te.dirname(J))??[]].filter((J)=>me.existsSync(J)).map((J)=>me.realpathSync(J)));for(let J of h._layerGraph?.layers??[])for(let W of Object.values(J.resources)){if(!me.existsSync(W))continue;let pe=me.realpathSync(W);if(![...U].some((G)=>pe===G||pe.startsWith(`${G}${te.sep}`)))U.add(pe)}for(let[J,W]of N)if(!U.has(J))W.close(),N.delete(J);for(let J of U)if(!N.has(J)&&me.existsSync(J))N.set(J,me.watch(J,{recursive:!0},(W,pe)=>{Ae(J,W,pe).catch((G)=>console.error("[stx] Layer rebuild failed:",G))}))},q=Promise.resolve(),Ae=(U,J,W)=>(q=q.catch(()=>{}).then(()=>ve(U,J,W)),q),ve=async(U,J,W)=>{if(!W||xt(W))return;if(bt(W)){if(h._layerGraph){let pe=await g(f);Object.assign(h,pe),D.splice(0,D.length,...X(w,{pagesDir:b,pagesDirs:pe._layerPageDirs?[k,...pe._layerPageDirs.slice(1)]:void 0})),Q()}if(P(W)){if(console.log(`${e.cyan}${W} changed${e.reset}`),o&&l)l.reload(W)}else if(j(W)){console.log(`${e.yellow}${W} changed, rebuilding...${e.reset}`),Je.clear(),fe();try{let{invalidateFileCache:pe,templateCache:G}=await import("./chunk-
|
|
1445
|
+
Press ${e.cyan}h${e.reset} + ${e.cyan}Enter${e.reset} to show shortcuts`),Ke(At.url.toString(),()=>{if(l)it();At.stop()}),n.native){let P,j=te.join(k,"index.stx");if(me.existsSync(j)){let Q=await Bun.file(j).text();P=gt(Q)}let N=h?.app?.window??{};await Ze(Ge,{title:h?.app?.head?.title||te.basename(f)||"stx App",width:N.width,height:N.height,darkMode:N.darkMode,hotReload:N.hotReload,titlebarHidden:N.titlebarHidden??n.titlebarHidden===!0,nativeSidebar:!!P,sidebarConfig:P})}if(d){console.log(`${e.blue}Watching for changes...${e.reset}`);let P=(U)=>U.startsWith("public/")||U.startsWith("public\\"),j=(U)=>{let J=U.toLowerCase();return J.endsWith(".stx")||J.endsWith(".html")||J.endsWith(".md")},N=new Map,Q=()=>{let U=new Set([f,...h._layerGraph?.layers.map((J)=>J.root)??[],...h._layerGraph?.configDependencies.map((J)=>te.dirname(J))??[]].filter((J)=>me.existsSync(J)).map((J)=>me.realpathSync(J)));for(let J of h._layerGraph?.layers??[])for(let W of Object.values(J.resources)){if(!me.existsSync(W))continue;let pe=me.realpathSync(W);if(![...U].some((G)=>pe===G||pe.startsWith(`${G}${te.sep}`)))U.add(pe)}for(let[J,W]of N)if(!U.has(J))W.close(),N.delete(J);for(let J of U)if(!N.has(J)&&me.existsSync(J))N.set(J,me.watch(J,{recursive:!0},(W,pe)=>{Ae(J,W,pe).catch((G)=>console.error("[stx] Layer rebuild failed:",G))}))},q=Promise.resolve(),Ae=(U,J,W)=>(q=q.catch(()=>{}).then(()=>ve(U,J,W)),q),ve=async(U,J,W)=>{if(!W||xt(W))return;if(bt(W)){if(h._layerGraph){let pe=await g(f);Object.assign(h,pe),D.splice(0,D.length,...X(w,{pagesDir:b,pagesDirs:pe._layerPageDirs?[k,...pe._layerPageDirs.slice(1)]:void 0})),Q()}if(P(W)){if(console.log(`${e.cyan}${W} changed${e.reset}`),o&&l)l.reload(W)}else if(j(W)){console.log(`${e.yellow}${W} changed, rebuilding...${e.reset}`),Je.clear(),fe();try{let{invalidateFileCache:pe,templateCache:G}=await import("./chunk-67k5q95t.js");pe(te.resolve(U,W)),G.delete(te.resolve(U,W))}catch{}if(A&&W){if(te.resolve(U,W)===A||te.basename(A)===W){let G=await mo(A,n.stxOptions||{});if(G)C=G}}if(await ze(),await sr(f),o&&l)l.reload(W)}else{console.log(`${e.yellow}${W} changed, rebuilding...${e.reset}`),Je.clear(),fe();try{let{invalidateFileCache:pe,templateCache:G}=await import("./chunk-67k5q95t.js");pe(te.resolve(U,W)),G.delete(te.resolve(U,W))}catch{}if(await ze(),o&&l)l.reload(W)}}else if(ht(W)){if(console.log(`${e.cyan}CSS ${W} changed${e.reset}`),o&&l)l.updateCss(W)}};Q(),process.on("SIGINT",()=>{for(let U of N.values())U.close();if(l)it();At.stop(),process.exit(0)})}return!0}import Ut from"fs";import at from"path";async function Vr(t){try{let r=(await Bun.file(t).text()).match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(!r)return[];let d=r[1],o=[],l=/\/\*\*\s*([\s\S]*?)\s*\*\/\s*(?:(?:const|let|var)\s*)?(?:([\w$]+)\s*=|module\.exports\.([\w$]+)\s*=|\s*([\w$]+)\s*:)/g,u;while((u=l.exec(d))!==null){let f=u[1],g=u[2]||u[3]||u[4];if(!g)continue;let h={name:g},x=f.match(/@type\s+\{([^}]+)\}/i);if(x)h.type=x[1].trim();if(f.match(/@required/i))h.required=!0;let S=f.match(/@default\s+(.+?)(?:\s+|$)/i);if(S)h.default=S[1].trim();let T=f.split(`
|
|
1446
1446
|
`).map((w)=>w.trim().replace(/^\*\s*/,"")).filter((w)=>!w.startsWith("@")&&w.length>0);h.description=T.join(" ").trim(),o.push(h)}if(o.length===0){let f=d.match(/module\.exports\s*=\s*\{([^}]+)\}/i);if(f){let h=f[1].split(",").map((x)=>x.trim()).filter(Boolean);for(let x of h){let[v]=x.split(":").map((S)=>S.trim());if(v)o.push({name:v})}}}return o}catch(n){return console.error(`Error extracting props from ${t}:`,n),[]}}async function Kr(t){try{let n=await Bun.file(t).text(),r=n.match(/^\s*<!--\s*([\s\S]*?)\s*-->/)||n.match(/^\s*\/\*\*\s*([\s\S]*?)\s*\*\//);if(r)return r[1].split(`
|
|
1447
1447
|
`).map((d)=>d.trim().replace(/^\*\s*/,"")).join(" ").trim();return""}catch{return""}}async function Xr(t,n=!1,r){let d=at.basename(t,".stx"),o=await Vr(t),l=await Kr(t),u="";if(n&&r)u=`<${r}></${r}>`;else{let f=o.map((g)=>{if(g.type==="boolean")return`:${g.name}="true"`;return`${g.name}="value"`}).join(`
|
|
1448
1448
|
`);u=`<${d}
|
|
@@ -2040,5 +2040,5 @@ const features = [
|
|
|
2040
2040
|
})();
|
|
2041
2041
|
</script>
|
|
2042
2042
|
</body>
|
|
2043
|
-
</html>`}var Qi="f9c3713";function
|
|
2044
|
-
`)}export{Ki,Xi,Gi,Ji,io,Yi,Zi,Qi,
|
|
2043
|
+
</html>`}var Qi="f9c3713";function El(t){return t}function Tl(t){return t}function Ki(t,n){let r=[],d=`${n}=`;for(let o=0;o<t.length;o++){let l=t[o];if(l.startsWith(d)){let u=l.slice(d.length);if(u)r.push(u);continue}if(l===n){let u=t[o+1];if(u!==void 0&&!u.startsWith("-"))r.push(u),o++}}return r}import _e from"fs";import ye from"path";function Rn(t){try{return _e.statSync(t).mtimeMs}catch{return null}}function Rt(t,n){let r=Math.max(0,Math.round((n-t)/1000));if(r<60)return`${r}s ago`;if(r<3600)return`${Math.round(r/60)}m ago`;return`${Math.round(r/3600)}h ago`}function $i(t,n){try{return globalThis.Bun?.resolveSync(t,n)??null}catch{return null}}function En(t,n="stx"){let r=ye.resolve(t);for(let d=0;d<10;d++){let o=ye.join(r,"pantry","@stacksjs",n);if(_e.existsSync(o))return o;let l=ye.dirname(r);if(l===r)break;r=l}return null}var Pn=["@stacksjs/stx","bun-plugin-stx"];function Ci(t){try{let n=_e.readFileSync(ye.join(t,"package.json"),"utf8"),r=JSON.parse(n)?.version;return typeof r==="string"?r:null}catch{return null}}function Ri(t,n=6){let r=ye.resolve(t),d=[],o=new Set;function l(f,g){if(g>n)return;let h;try{h=_e.realpathSync(f)}catch{return}if(o.has(h))return;o.add(h);for(let v of Pn){let S=ye.join(f,v),T=Ci(S);if(T!==null)d.push({name:v,version:T,dir:ye.relative(r,S)||S,nested:g>0})}let x;try{x=_e.readdirSync(f,{withFileTypes:!0})}catch{return}for(let v of x){if(!v.isDirectory()&&!v.isSymbolicLink())continue;if(v.name===".bin"||v.name===".cache")continue;let S=ye.join(f,v.name);if(v.name.startsWith("@")){let w;try{w=_e.readdirSync(S,{withFileTypes:!0})}catch{continue}for(let b of w){let k=ye.join(S,b.name,"node_modules");if(_e.existsSync(k))l(k,g+1)}continue}let T=ye.join(S,"node_modules");if(_e.existsSync(T))l(T,g+1)}}let u=ye.join(r,"node_modules");if(_e.existsSync(u))l(u,0);return d}function Ei(t){let n=[];for(let r of Pn){let d=t.filter((u)=>u.name===r);if(d.length<=1)continue;let o=[...new Set(d.map((u)=>u.version))],l=d.map((u)=>`${u.version} at ${u.dir}`).join("; ");if(o.length===1){n.push({name:`${r} copies`,status:"info",detail:`${d.length} copies, all ${o[0]} \u2014 duplicated but in agreement`});continue}n.push({name:`${r} copies disagree`,status:"error",detail:`${o.length} versions installed, so which one runs depends on who imports it: ${l}`,fix:`remove the nested copies, or add an overrides entry pinning ${r}, then reinstall \u2014 and verify with: find -L node_modules -path '*/${r}/package.json' -exec grep -H '"version"' {} +`})}return n}async function ao(t={}){let n=t.cwd?ye.resolve(t.cwd):process.cwd(),r=t.resolve??$i,d=Date.now(),o=[],l=r("@stacksjs/stx",n);o.push(l?{name:"@stacksjs/stx resolves to",status:"ok",detail:l}:{name:"@stacksjs/stx resolves to",status:"info",detail:"not resolvable from here (running inside the stx repo, or not installed)"});let u=r("bun-plugin-stx",n);if(u)o.push({name:"bun-plugin-stx resolves to",status:"ok",detail:u});for(let g of Ei(Ri(n)))o.push(g);let f=En(n,"stx");if(!f)o.push({name:"pantry",status:"info",detail:"no pantry/@stacksjs/stx found \u2014 standard install (nothing to rebuild)"});else{let g=ye.join(f,"src/signals.ts"),h=[ye.join(f,"dist/index.js"),ye.join(f,"dist/signals.js")].find((w)=>_e.existsSync(w))||null,x=Rn(g),v=h?Rn(h):null;if(x==null)o.push({name:"pantry dist freshness",status:"info",detail:`found pantry at ${f} but no src/signals.ts to compare`});else if(v==null)o.push({name:"pantry dist freshness",status:"error",detail:"pantry has src but no built dist \u2014 the dev server will resolve nothing (or a stale copy elsewhere)",fix:`cd ${f} && bun build.ts`});else if(v<x){let w=Math.round((x-v)/1000);o.push({name:"pantry dist freshness",status:"error",detail:`dist (${Rt(v,d)}) is OLDER than src/signals.ts (${Rt(x,d)}) by ${w}s \u2014 your edit isn't built`,fix:`cd ${f} && bun build.ts`})}else o.push({name:"pantry dist freshness",status:"ok",detail:`dist rebuilt after src (src ${Rt(x,d)}, dist ${Rt(v,d)})`});let S=ye.join(n,"node_modules/@stacksjs/stx"),T=null;try{T=_e.lstatSync(S)}catch{T=null}if(!T)o.push({name:"node_modules \u2192 pantry",status:"info",detail:"node_modules/@stacksjs/stx not present (not installed here)"});else if(T.isSymbolicLink()){let w=null;try{w=_e.realpathSync(S)}catch{}let b=(()=>{try{return _e.realpathSync(f)}catch{return f}})();o.push(w===b?{name:"node_modules \u2192 pantry",status:"ok",detail:"symlinked to pantry"}:{name:"node_modules \u2192 pantry",status:"warn",detail:`symlinked to ${w||"(dangling)"}, not pantry`})}else o.push({name:"node_modules \u2192 pantry",status:"warn",detail:"is a real directory, NOT symlinked to pantry \u2014 edits to pantry src/dist won't be resolved",fix:"rm -rf node_modules/@stacksjs/stx && ln -s ../../pantry/@stacksjs/stx node_modules/@stacksjs/stx"})}if(o.push({name:"dev runtime cache",status:"info",detail:"cleared automatically on source edits by the dev watcher (clearDevCaches, #1745 item C)"}),t.generateRuntime)try{let h=t.generateRuntime().length;o.push(h>1000?{name:"signals runtime",status:"ok",detail:`generated ${h.toLocaleString()} chars`}:{name:"signals runtime",status:"warn",detail:`generated only ${h} chars \u2014 suspiciously short`})}catch(g){o.push({name:"signals runtime",status:"error",detail:`failed to generate: ${g.message}`})}return{checks:o,ok:!o.some((g)=>g.status==="error")}}function co(t){let n={ok:"\u2713",warn:"\u26A0",error:"\u2717",info:"\xB7"},r=["stx runtime resolution:"];for(let d of t.checks)if(r.push(` ${n[d.status]} ${d.name}: ${d.detail}`),d.fix)r.push(` \u2192 ${d.fix}`);return r.push(""),r.push(t.ok?"\u2713 All framework-runtime layers are aligned.":"\u2717 A runtime layer is stale \u2014 see the fixes above."),r.join(`
|
|
2044
|
+
`)}export{Ki,Xi,Gi,Ji,io,Yi,Zi,Qi,El,Tl,ao,co,Fr,zr,Hr};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Di,Li,ji,Dg,Bi,Fi,Lg,zi,Hi,_l,jg}from"./chunk-sh1hbhhb.js";export{Di as VideoProcessorCache,_l as analyzeVideo,Dg as clearVideoCache,Hi as generateDASHManifest,zi as generateHLSManifest,Bi as generatePoster,Lg as generateSpriteSheet,Fi as generateThumbnails,Li as getCachedVideoResult,jg as processVideo,ji as setCachedVideoResult};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{gu,_o,Kn,mu,hu,yu,bu,wu,vu,xu,Su,ku,_u,Cu,Eu,Tu,$u,Ru,Au,Pu,Iu,Ou,Nu,Mu,Du,Lu,ju,Bu,Fu,zu,Hu,Vu,Uu,Wu,qu,Ku,Xu,Gu,Ju,Yu,Zu,Qu,ed,td,nd,rd,sd,od,Jt,Ra,id,ad,cd,Aa,ld,ud,dd,pd,fd,gd,Pa,md,hd,yd,bd,wd,vd,xd,Sd,kd,Xn,_d,Cd,Ed,Td,$d,Rd,Ad,Pd,Id,Od,Nd,Md,Co,Dd,Ld,jd,Bd,Fd,Qr,es,zd,Hd,Vd,Ud,Wd,Ia,qd,Kd,Xd,Oa,Eo,Gd,Jd,Na,Ma,ts,Da,Yd,Yt,Zd,La,ja,To,Qd,$o,ep,tp,np,rp,sp,op,ip,Ba,ap,cp,Fa,lp,up,dp,pp,fp,gp,mp,hp,yp,bp,wp,vp,xp,Sp,kp,_p,Cp,Ep,Tp,$p,Rp,Ap,Pp,Ip,za,Op,Np,Mp,Dp,Lp,jp,Bp,Fp,zp,Hp,Vp,Gn,Ha,Va,Up,Jn,Wp,qp,Kp,Ua,Wa,ns,rs,Xp,Ro,Gp,Jp,Yp,Zp,Qp,ef,tf,nf,rf,sf,of,af,cf,lf,uf,df,pf,ff,gf,mf,qa,hf,yf,Ka,Xa,bf,wf}from"./chunk-gcje06er.js";export{sd as AVAILABLE_COMPONENTS,Ia as AutoUpdater,od as COMPONENT_STYLES,ns as DEFAULT_WATCH_INTERVAL_MS,Wa as MAX_WATCH_INTERVAL_MS,Ua as MIN_WATCH_INTERVAL_MS,gd as MODAL_STYLES,ku as TOAST_STYLES,xd as TRAY_MENU_STYLES,Na as UPDATE_MANIFEST_ASSET,ud as alert,Rp as appInfo,ef as appleScript,wf as applicationDataDirectory,Qp as audio,yf as backgroundDelay,Cp as battery,Zp as biometric,Hp as bluetooth,of as bonjour,Yt as bundlePathForExecutable,Qd as caffeinate,qd as canReplaceBundle,Kd as clearQuarantine,hp as clipboard,fd as closeAllModals,Md as closeAllWindows,ld as confirm,Ip as contextMenu,pf as continuityCamera,df as coreml,Ud as craftBinaryNotFoundMessage,Co as craftWindowArguments,Gn as crashReporter,qu as createAccordion,Bu as createAutocomplete,Au as createAvatar,Ru as createBadge,_u as createButton,Pu as createCard,Qu as createChart,Eu as createCheckbox,Hu as createChip,ed as createCodeEditor,Du as createColorPicker,Zu as createDataGrid,Lu as createDatePicker,es as createDiskImage,Ou as createDropdown,nd as createFileExplorer,Yd as createGitHubUpdateManifest,Da as createGitHubUpdater,zu as createImageView,pp as createInterval,Fu as createLabel,Gu as createListView,td as createMediaPlayer,md as createMenubar,Xu as createModalComponent,bf as createNativeUpdateApi,Xa as createPantrySelfUpdater,sp as createPreferences,$u as createProgressBar,Mu as createRadioButton,Nu as createRating,Uu as createScrollView,To as createSelfUpdater,Tu as createSlider,Wu as createSplitView,Ku as createStepper,Pa as createSystemTray,Ju as createTable,Iu as createTabs,Cu as createTextInput,ju as createTimePicker,dp as createTimer,Vu as createTooltip,Yu as createTreeView,rd as createWebView,Dd as createWindow,jd as createWindowWithHTML,$o as decaffeinate,_p as deepLinks,fp as delay,vu as dismissAlertById,xu as dismissAllAlerts,Sp as dragOut,Xd as extractBundle,tf as fileAssociations,Ro as focus,Jp as focusShortcutsReady,mp as formatCompact,rp as formatDuration,np as formatRemainingTime,ap as formatShortcut,gp as formatTime,bp as fs,Oa as generateUpdateManifest,Su as getActiveAlertCount,pd as getActiveModalCount,hd as getActiveTrayInstances,Od as getActiveWindowIds,tp as getCaffeinateStatus,mf as getCapabilities,qa as getCapability,Pd as getDesktopConfig,Rd as getDialogBridgeScript,up as getRegisteredHotkeys,wd as getSimulatedTrayHTML,vd as getTrayBridgeScript,yd as getTrayInstance,Nd as getWindow,Fd as getWindowBridgeScript,Ma as githubLatestAssetUrl,ts as githubReleaseAssetUrl,vp as globalShortcuts,Jn as handoff,Gp as hasFocusShortcuts,Up as iap,ip as isAutoLaunchEnabled,hf as isAvailable,ep as isCaffeinated,kp as isDragOutAvailable,Bd as isWebviewAvailable,Mp as keychain,Wp as liveActivities,Yp as localServer,qp as location,sf as log,zd as macOSRuntimeExecutablePath,Pp as menu,uf as midi,jp as nativeAutoLaunch,Bp as nativeTray,Fp as nativeWindow,Ep as network,yp as notifications,wu as notify,Ld as openDevWindow,Hd as pack,Vd as packageApp,Ka as parsePantryUpdateManifest,Ba as parseShortcut,rf as pdf,Dp as permissions,Lp as printing,dd as prompt,La as quitLauncher,Eo as readBundleIdentity,Ha as redactPII,cp as registerHotkey,ja as relaunchBundle,gu as requestNotificationPermission,Id as resetDesktopConfig,Wd as resolveCraftBinary,Qr as resolveCraftExecutablePath,Zd as runningBundleTeamId,Np as screen,Kp as screenCapture,rs as screenSharing,gf as serial,ff as serviceMenu,op as setAutoLaunch,Ad as setDesktopConfig,wp as shell,_o as showAlert,Cd as showAlertDialog,_d as showColorPicker,Ed as showConfirmDialog,Td as showErrorDialog,ad as showErrorModal,bu as showErrorToast,Ra as showInfoModal,mu as showInfoToast,Xn as showMessageBox,Jt as showModal,Sd as showOpenDialog,Aa as showQuestionModal,kd as showSaveDialog,cd as showSuccessModal,hu as showSuccessToast,Kn as showToast,$d as showWarningDialog,id as showWarningModal,yu as showWarningToast,za as sidebar,Va as signPayload,Vp as speech,cf as speechRecognition,af as spotlight,Ap as standardMenus,Gd as swapBundle,Op as system,nf as tags,xp as theme,zp as touchbar,bd as triggerTrayAction,lp as unregisterAllHotkeys,Fa as unregisterHotkey,Tp as updater,Jd as verifyBundleTrust,lf as vision,Xp as watchScreenSharing,$p as windowEvents};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Q,ee,te,Nn,me,Te,Kr,
|
|
2
|
+
import{Q,ee,te,Nn,me,Te,Kr,Ul,gt,Xt,Mn,Dn,Ln,ne,jn,Bn,Xr}from"./chunk-4fbg7gq8.js";import"./chunk-baj6w8ja.js";export{ee as DEFAULT_FORMATS,te as DEFAULT_QUALITY,Q as DEFAULT_WIDTHS,Xr as ImageProcessingError,Bn as formatSize,Xt as generateSizes,gt as generateSrcSet,Mn as getFallbackVariant,Kr as getImageMetadata,ne as getMimeType,jn as getTotalSize,Dn as groupVariantsByFormat,me as isImageBackendAvailable,Ln as isImageFile,Nn as isSharpAvailable,Te as processImage,Ul as resizeAndConvert};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ue}from"./chunk-
|
|
2
|
+
import{ue}from"./chunk-gtd6qs1r.js";import{ze,N}from"./chunk-m7hfcxt3.js";import{vc}from"./chunk-t2sg2tp2.js";import{c}from"./chunk-0rjcbqk3.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 on(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 p=e.replace(/\.(?:ts|js|mts|mjs)$/,"").split("/"),n=p.pop(),u=n.lastIndexOf("."),d=u>=0?n.slice(u+1):"get",g=d.toUpperCase();if(!P.includes(g)||d!==d.toLowerCase())throw Error(`Unsupported API method suffix in ${e}; use ${P.map((A)=>A.toLowerCase()).join(", ")}`);if(u>=0)n=n.slice(0,u);if(n!=="index")p.push(n);let r=new Set,h=p.map((A,j)=>{let y=/^\[(\.\.\.)?([A-Za-z_]\w*)\]$/.exec(A);if(y){if(r.has(y[2])||y[1]&&j!==p.length-1)throw Error(`Invalid API parameter in ${e}`);return r.add(y[2]),`:${y[2]}${y[1]?"*":""}`}if(!/^[\w-]+$/.test(A))throw Error(`Unsupported API path segment ${A} in ${e}`);return A}),w=`/api${h.length?`/${h.join("/")}`:""}`,S=`${g} ${w.replace(/:\w+/g,":param")}`;if(f.has(S))throw Error(`Ambiguous API route ${g} ${w}: ${f.get(S)} and ${e}`);f.set(S,e);let x=m.join(o,e);R.add(m.resolve(x)),R.add(v.realpathSync(x)),i.push({pattern:w,method:g,filePath:x})}return i.sort((e,a)=>{let p=e.pattern.split("/"),n=a.pattern.split("/"),u=(d)=>d?.endsWith("*")?0:d?.startsWith(":")?1:2;for(let d=0;d<Math.max(p.length,n.length);d++){let g=u(n[d])-u(p[d]);if(g)return g}return e.pattern.localeCompare(a.pattern)||e.method.localeCompare(a.method)})}async function Ao(s,l){let o=c(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:a}=ue(t.pattern);i.push(` ${JSON.stringify(`${t.method} ${t.pattern}`)}: { params: { ${a.map((p)=>`${JSON.stringify(p)}: string`).join("; ")} }; response: Awaited<ReturnType<typeof import(${JSON.stringify(e)}).default>> }`)}i.push(" }","}","export {}","");let f=i.join(`
|
|
3
3
|
`);if(!await Bun.file(o).exists()||await Bun.file(o).text()!==f)await Bun.write(o,f);return o}async function Po(s,l,o={}){let i=on(s,o);await Ao(s,i);let f=[];for(let t of i){let e=await Bun.build({entrypoints:[t.filePath],target:"bun",format:"esm",minify:!1,splitting:!1});if(!e.success)throw Error(`API build failed for ${t.filePath}: ${e.logs.join(`
|
|
4
|
-
`)}`);let a=e.outputs.find((u)=>u.kind==="entry-point");if(!a)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await a.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(l,n),a),f.push({...t,filePath:n})}return f}function E(s,l){let o=s.map((i)=>({route:i,...ue(i.pattern)}));return async(i)=>{let f=new URL(i.url).pathname,t=o.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,a=(r)=>r.replace(/:\w+/g,":param"),p=t.filter((r)=>a(r.route.pattern)===a(e)),n=i.method,u=p.find((r)=>r.route.method===n)??(n==="HEAD"?p.find((r)=>r.route.method==="GET"):void 0);if(!u){let r=new Set(p.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=u.regex.exec(f),g=Object.create(null);try{u.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await l(u.route);if(typeof r!=="function")throw Error(`API endpoint ${u.route.filePath} must default-export a handler`);let h=await r(i,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function Io(s,l){return E(l,async(o)=>(await import(I(m.resolve(s,o.filePath)).href)).default)}async function
|
|
4
|
+
`)}`);let a=e.outputs.find((u)=>u.kind==="entry-point");if(!a)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await a.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(l,n),a),f.push({...t,filePath:n})}return f}function E(s,l){let o=s.map((i)=>({route:i,...ue(i.pattern)}));return async(i)=>{let f=new URL(i.url).pathname,t=o.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,a=(r)=>r.replace(/:\w+/g,":param"),p=t.filter((r)=>a(r.route.pattern)===a(e)),n=i.method,u=p.find((r)=>r.route.method===n)??(n==="HEAD"?p.find((r)=>r.route.method==="GET"):void 0);if(!u){let r=new Set(p.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=u.regex.exec(f),g=Object.create(null);try{u.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await l(u.route);if(typeof r!=="function")throw Error(`API endpoint ${u.route.filePath} must default-export a handler`);let h=await r(i,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function Io(s,l){return E(l,async(o)=>(await import(I(m.resolve(s,o.filePath)).href)).default)}async function Ch(s,l){if(!l)return async()=>null;let o=l===!0?{}:l,i=on(s,o);return await Ao(s,i),async(f)=>{if(!new URL(f.url).pathname.match(/^\/api(?:\/|$)/))return null;try{let t=on(s,o);await Ao(s,t);let{loadStxConfig:e}=await import("./chunk-fvs15n0s.js"),a=N((await e(s)).runtimeConfig);return await ze(a,()=>E(t,async(p)=>{let n=await Bun.build({entrypoints:[p.filePath],target:"bun",format:"esm",splitting:!1});if(!n.success)throw Error(n.logs.join(`
|
|
5
5
|
`));let u=n.outputs.find((d)=>d.kind==="entry-point");if(!u||n.outputs.length!==1)throw Error(`Unsupported API bundle output: ${p.filePath}`);return(await import(`data:text/javascript;base64,${Buffer.from(await u.text()).toString("base64")}`)).default})(f))}catch(t){return console.error("[stx] API discovery failed:",t),Response.json({error:"API discovery failed; check the server log"},{status:500})}}}function Oo(s,l,o){if(vc(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=(a)=>{try{return v.realpathSync(a)}catch{return m.resolve(a)}},e=t(s);return[f,m.resolve(l,"server"),m.resolve(l,".output/server")].some((a)=>{let p=t(a);return e===p||e.startsWith(`${p}${m.sep}`)})}
|
|
6
|
-
export{on,Ao,Po,Io,
|
|
6
|
+
export{on,Ao,Po,Io,Ch,Oo};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Nm,ba,uu,Mm,Dm,Lm,jm,Bm,du,pu,Fm,zm,Hm,Vm}from"./chunk-2jn0x4sh.js";import"./chunk-8gcg9maj.js";import"./chunk-9tzcvsv0.js";import"./chunk-7ac98ja7.js";import"./chunk-c84pxd2k.js";import"./chunk-r8ydxe4z.js";import"./chunk-s9b49v74.js";import"./chunk-e9w8qav3.js";import"./chunk-f6nk205v.js";import"./chunk-x34me5ar.js";import"./chunk-9xd85mvm.js";import"./chunk-fmawgk87.js";import"./chunk-swbrvrgr.js";import"./chunk-j65nf7mt.js";import"./chunk-casvvt3k.js";import"./chunk-9gwhs0gk.js";import"./chunk-t2sg2tp2.js";import"./chunk-em2yy1te.js";import"./chunk-gtd6qs1r.js";import"./chunk-ymypc1rp.js";import"./chunk-sf4rntqj.js";import"./chunk-m7hfcxt3.js";import"./chunk-72jt897s.js";import"./chunk-r9e0r6jx.js";import"./chunk-1tzqqr0p.js";export{uu as SUSPENSE_RESOLVER_RUNTIME,ba as buildSuspenseResolveScript,Bm as createStreamRenderer,Lm as extractStreamBoundaries,Vm as generateHydrationRuntime,pu as islandDirective,zm as processSectionDirectives,Dm as processStreamDirectives,Fm as registerStreamingDirectives,Mm as renderStreamingPage,Nm as streamTemplate,jm as streamTemplateSimple,Hm as streamToResponse,du as streamingSuspenseDirective};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Xg}from"./chunk-cf196sv5.js";import"./chunk-k01aftw0.js";import"./chunk-qr14xvwb.js";import"./chunk-p13wg97w.js";import"./chunk-s9b49v74.js";import"./chunk-9xd85mvm.js";import"./chunk-j65nf7mt.js";import"./chunk-casvvt3k.js";import"./chunk-9gwhs0gk.js";import"./chunk-t2sg2tp2.js";import"./chunk-em2yy1te.js";import"./chunk-gtd6qs1r.js";import"./chunk-ymypc1rp.js";import"./chunk-sf4rntqj.js";import"./chunk-m7hfcxt3.js";import"./chunk-72jt897s.js";import"./chunk-r9e0r6jx.js";import"./chunk-1tzqqr0p.js";export{Xg as startProductionServer};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ya,iu,Fn,Im,au,cu,lu,Om}from"./chunk-hntm02x0.js";import"./chunk-ymypc1rp.js";import"./chunk-sf4rntqj.js";import"./chunk-m7hfcxt3.js";import"./chunk-72jt897s.js";import"./chunk-r9e0r6jx.js";import"./chunk-1tzqqr0p.js";export{Fn as Validator,iu as defineForm,au as processErrorDirective,cu as processErrorsDirective,Om as processFormValidationDirectives,lu as processHasErrorsDirective,ya as useForm,Im as v};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Rh,If,Je,ic,Ah,is,as,cs}from"./chunk-7ac98ja7.js";import"./chunk-r8ydxe4z.js";import"./chunk-s9b49v74.js";import"./chunk-f6nk205v.js";import"./chunk-fmawgk87.js";import"./chunk-ymypc1rp.js";import"./chunk-sf4rntqj.js";import"./chunk-m7hfcxt3.js";import"./chunk-72jt897s.js";import"./chunk-r9e0r6jx.js";import"./chunk-1tzqqr0p.js";export{Ah as clearOnceStore,ic as onceStore,Je as partialsCache,is as processIncludes,as as processStackPushDirectives,cs as processStackReplacements,Rh as resetUnscopedSignalWarnings,If as topLevelElements};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{W,Ne}from"./chunk-
|
|
2
|
+
import{W,Ne}from"./chunk-ymypc1rp.js";var o=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function u(t,e,r){let i={fullTag:r,content:e,attrs:t};if(/\bserver\b/.test(t))return{...i,type:"server"};if(/\bdata-stx-scoped\b/.test(t))return{...i,type:"client"};if(o.test(e))return{...i,type:"signals"};if(/\bclient\b/.test(t)||/\btype\s*=\s*["']module["']/.test(t)||/\bsrc\s*=/.test(t))return{...i,type:"client"};return{...i,type:"server"}}var S=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function Qt(t){let e=[],r=[],i=[],c=0;while(c<t.length){let s=t.indexOf("<",c);if(s===-1)break;let p=Ne(t,s);if(p>s){c=p;continue}let a=W(t,s);if(a>s){let f=t.slice(s,a),l=S.exec(f);if(l){let n=u(l[1],l[2],f);switch(n.type){case"signals":e.push(n);break;case"client":r.push(n);break;case"server":i.push(n);break}}c=a;continue}c=s+(t.startsWith("<!--",s)?4:1)}return{signals:e,client:r,server:i}}
|
|
3
3
|
export{Qt};
|