@stacksjs/stx 0.2.576 → 0.2.578
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-0047meje.js +2 -0
- package/dist/chunk-00p22wzr.js +3 -0
- package/dist/{chunk-z33z3rr4.js → chunk-0k5faspy.js} +6 -6
- package/dist/{chunk-wwhxgvr8.js → chunk-0vnngvy1.js} +4 -4
- package/dist/{chunk-7a0ewpz0.js → chunk-101ekf6y.js} +2 -2
- package/dist/{chunk-t79xnvzr.js → chunk-117xss52.js} +2 -2
- package/dist/chunk-1cat8kdj.js +2 -0
- package/dist/chunk-1dwnp35v.js +2 -0
- package/dist/{chunk-5vw8493b.js → chunk-1r1maqep.js} +3 -3
- package/dist/{chunk-zak5xare.js → chunk-1v1mew46.js} +1 -1
- package/dist/chunk-2dnr5qfk.js +2 -0
- package/dist/{chunk-1swmxkdt.js → chunk-2rx9d75e.js} +2 -2
- package/dist/chunk-2v73cjbc.js +2 -0
- package/dist/chunk-3akgppsy.js +2 -0
- package/dist/{chunk-8efe5vpm.js → chunk-3e3dpp7w.js} +3 -3
- package/dist/{chunk-vnsby98n.js → chunk-3qrrv6af.js} +1 -1
- package/dist/{chunk-fkbthywg.js → chunk-3wy8q3aq.js} +5 -5
- package/dist/chunk-3x6p9me0.js +2 -0
- package/dist/{chunk-tybk9hw9.js → chunk-43h8q2cm.js} +9 -9
- package/dist/{chunk-pqkb1m5x.js → chunk-4rkvwm6v.js} +5 -5
- package/dist/{chunk-bks1fe5e.js → chunk-4srg0qbv.js} +1 -1
- package/dist/chunk-4t67wmcg.js +2 -0
- package/dist/chunk-51zn42jy.js +2 -0
- package/dist/chunk-5702x95v.js +2 -0
- package/dist/{chunk-4z21afpp.js → chunk-5db5sxy3.js} +2 -2
- package/dist/{chunk-r4w1cye7.js → chunk-5kh5ehfh.js} +2 -2
- package/dist/chunk-5pgbsc3a.js +2 -0
- package/dist/chunk-60c2bsh9.js +2 -0
- package/dist/{chunk-vw1rmevt.js → chunk-620szfcp.js} +3 -3
- package/dist/{chunk-6rfm6b1c.js → chunk-6w2yqtrd.js} +2 -2
- package/dist/{chunk-37d52q0d.js → chunk-6z3e1tyz.js} +1 -1
- package/dist/{chunk-nskvepjv.js → chunk-71sdgv7e.js} +5 -5
- package/dist/chunk-79v4d9qh.js +2 -0
- package/dist/{chunk-qfb34r6k.js → chunk-7hkc96de.js} +6 -6
- package/dist/chunk-7pp2vx1g.js +2 -0
- package/dist/chunk-84f9dnq5.js +2 -0
- package/dist/chunk-8tq5x4z8.js +2 -0
- package/dist/{chunk-gjp2jxrp.js → chunk-8v19753h.js} +1 -1
- package/dist/chunk-8zm6tkqb.js +2 -0
- package/dist/{chunk-1dg5qxg9.js → chunk-9jh2ake5.js} +5 -5
- package/dist/chunk-a1z36dt5.js +2 -0
- package/dist/{chunk-7hr63cp5.js → chunk-ah9xyss2.js} +2 -2
- package/dist/chunk-atsf1fe0.js +2 -0
- package/dist/{chunk-x5xwe5nr.js → chunk-ayy9mmrw.js} +7 -7
- package/dist/chunk-b8qd6h1q.js +2 -0
- package/dist/{chunk-vde4mtfr.js → chunk-be2ba3hj.js} +2 -2
- package/dist/{chunk-pxk0tpw2.js → chunk-bj29pwm0.js} +3 -3
- package/dist/{chunk-gpb22a8n.js → chunk-c0h2eqe0.js} +2 -2
- package/dist/{chunk-agk478t4.js → chunk-c0s3k64c.js} +2 -2
- package/dist/{chunk-bctjmaxg.js → chunk-c1r7zq0q.js} +41 -41
- package/dist/{chunk-32gycb72.js → chunk-cb2pyg5t.js} +2 -2
- package/dist/chunk-ccxs40xy.js +2 -0
- package/dist/{chunk-7j9m4d7x.js → chunk-cdgwkzms.js} +3 -3
- package/dist/{chunk-6c2y9h5h.js → chunk-cnknvvwm.js} +1 -1
- package/dist/chunk-cp442y7a.js +2 -0
- package/dist/chunk-d4en5d3s.js +2 -0
- package/dist/chunk-dh80d57p.js +2 -0
- package/dist/{chunk-je0cttam.js → chunk-djft0m5h.js} +2 -2
- package/dist/chunk-dpn1pmxj.js +2 -0
- package/dist/chunk-dtcc09x1.js +2 -0
- package/dist/{chunk-sf7z2ar9.js → chunk-dvgvvy5b.js} +3 -3
- package/dist/chunk-dyqte1xq.js +2 -0
- package/dist/chunk-e4n4v022.js +2 -0
- package/dist/chunk-efgk2xv1.js +2 -0
- package/dist/{chunk-h1n43e5n.js → chunk-ev5f79mg.js} +5 -5
- package/dist/{chunk-1wkpxa58.js → chunk-eww6sdzz.js} +2 -2
- package/dist/{chunk-34fajf1n.js → chunk-faghmmrs.js} +139 -139
- package/dist/chunk-fj70wq7k.js +2 -0
- package/dist/chunk-g2fw68zm.js +2 -0
- package/dist/{chunk-szfkkbve.js → chunk-g4crr86j.js} +3 -3
- package/dist/{chunk-xh0808cd.js → chunk-h0a2s340.js} +2 -2
- package/dist/chunk-hcgm37dy.js +2 -0
- package/dist/chunk-hd2bn5q7.js +2 -0
- package/dist/{chunk-5dm4k229.js → chunk-hzfhn2vr.js} +2 -2
- package/dist/{chunk-6wz6f8d5.js → chunk-j1nqnmcd.js} +4 -4
- package/dist/{chunk-1c8sdf9a.js → chunk-jpqkm8tm.js} +2 -2
- package/dist/{chunk-550q827h.js → chunk-jtbzmbzz.js} +4 -4
- package/dist/chunk-k7jqkt93.js +2 -0
- package/dist/{chunk-wvk932dp.js → chunk-k9th7hc4.js} +4 -4
- package/dist/chunk-kp0hg06s.js +15 -0
- package/dist/{chunk-kskyfss0.js → chunk-ktyctev3.js} +2 -2
- package/dist/{chunk-xk2v20xe.js → chunk-m8tm44rq.js} +2 -2
- package/dist/chunk-mhjwtkx9.js +2 -0
- package/dist/chunk-mqy7g74k.js +2 -0
- package/dist/chunk-mxe21m6q.js +2 -0
- package/dist/chunk-ne03tfje.js +2 -0
- package/dist/{chunk-3gqrv02t.js → chunk-nrfh7gaa.js} +3 -3
- package/dist/chunk-p2sns0bn.js +2 -0
- package/dist/chunk-pjrh71sn.js +122 -0
- package/dist/{chunk-jgrtvs81.js → chunk-pmpb34md.js} +5 -5
- package/dist/chunk-q2a58n2a.js +2 -0
- package/dist/{chunk-5xwmkxkk.js → chunk-qazn64pm.js} +1 -1
- package/dist/{chunk-7bwkeake.js → chunk-qccgncp2.js} +6 -6
- package/dist/{chunk-1edvsndv.js → chunk-qdyp2zqf.js} +2 -2
- package/dist/chunk-rr8a7d4q.js +11 -0
- package/dist/{chunk-mr9c2ej6.js → chunk-s12bnv32.js} +2 -2
- package/dist/chunk-s1sycp43.js +2 -0
- package/dist/chunk-s932zfjz.js +2 -0
- package/dist/chunk-sp46w7z9.js +2 -0
- package/dist/{chunk-tasjpnbf.js → chunk-sv5nvfmb.js} +2 -2
- package/dist/chunk-sy1bk1ry.js +2 -0
- package/dist/chunk-t48ws5j0.js +2 -0
- package/dist/{chunk-sn3htx1z.js → chunk-t4g2fptt.js} +6 -6
- package/dist/{chunk-d8ek63nc.js → chunk-t8wpzqs4.js} +1 -1
- package/dist/{chunk-bpdsdbvg.js → chunk-ta3wn842.js} +2 -2
- package/dist/chunk-thbc9gtj.js +2 -0
- package/dist/chunk-tn9v10q2.js +2 -0
- package/dist/chunk-tpd5nwa3.js +2 -0
- package/dist/chunk-tpt4bgs5.js +2 -0
- package/dist/{chunk-n829xbbq.js → chunk-tszkg6sj.js} +2 -2
- package/dist/chunk-v8p5p2kp.js +2 -0
- package/dist/chunk-v9jd283e.js +2 -0
- package/dist/{chunk-4xvbc0mb.js → chunk-vpdx7qr3.js} +2 -2
- package/dist/chunk-vq0cb1m9.js +2 -0
- package/dist/chunk-vx75fb0d.js +33 -0
- package/dist/{chunk-pveafhzg.js → chunk-w3rmepwy.js} +2 -2
- package/dist/{chunk-xsxh7h8z.js → chunk-wg2w7zmt.js} +2 -2
- package/dist/chunk-wgkxgsqx.js +2 -0
- package/dist/{chunk-707n4pbz.js → chunk-wwj8zbzc.js} +5 -5
- package/dist/{chunk-p3xkj7pm.js → chunk-xpnpg967.js} +2 -2
- package/dist/chunk-y1bppxgw.js +2 -0
- package/dist/{chunk-1w9ngqpv.js → chunk-y8q1n7hx.js} +10 -10
- package/dist/{chunk-vmetcczm.js → chunk-yfq2v7x5.js} +6 -6
- package/dist/{chunk-h72befy4.js → chunk-yhpyqsbr.js} +4 -4
- package/dist/{chunk-n0kw3q6p.js → chunk-yk3fbzx5.js} +4 -4
- package/dist/chunk-yv5rwthv.js +2 -0
- package/dist/{chunk-mp99h8wh.js → chunk-yy3ser06.js} +5 -5
- package/dist/chunk-yygze2s0.js +2 -0
- package/dist/chunk-z1r4tdqy.js +2 -0
- package/dist/chunk-z732tf98.js +2 -0
- package/dist/{chunk-haeb904b.js → chunk-zk2xk0wd.js} +2 -2
- package/dist/chunk-zv288w4e.js +2 -0
- package/dist/{chunk-j4zyq2ap.js → chunk-zz02hwec.js} +11 -11
- package/dist/cli.js +19 -19
- package/dist/client-script-bundler.d.ts +12 -0
- package/dist/client-script-bundler.js +19 -5
- package/dist/composable-loader.js +2 -2
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/native/compiler/bundle.d.ts +22 -0
- package/dist/native/compiler/bundle.js +164 -20
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +3 -3
- package/dist/store-loader.js +7 -7
- package/package.json +5 -5
- package/dist/chunk-08a98yqt.js +0 -2
- package/dist/chunk-0q5s55km.js +0 -2
- package/dist/chunk-181m21rg.js +0 -2
- package/dist/chunk-194qgkc9.js +0 -2
- package/dist/chunk-1nbn56jw.js +0 -2
- package/dist/chunk-2ry2pfpe.js +0 -2
- package/dist/chunk-3bj1w990.js +0 -2
- package/dist/chunk-4a12azrb.js +0 -2
- package/dist/chunk-6aq3sm83.js +0 -2
- package/dist/chunk-6fpynp8q.js +0 -2
- package/dist/chunk-6q3yszw9.js +0 -74
- package/dist/chunk-6ryab0yy.js +0 -2
- package/dist/chunk-6sasxbv9.js +0 -2
- package/dist/chunk-6w9km7qb.js +0 -2
- package/dist/chunk-7kh4p06d.js +0 -2
- package/dist/chunk-7xrrzqh7.js +0 -2
- package/dist/chunk-7y73q42g.js +0 -11
- package/dist/chunk-8jaw6exk.js +0 -2
- package/dist/chunk-98r9jk2b.js +0 -2
- package/dist/chunk-9dgygz8d.js +0 -2
- package/dist/chunk-a51f04an.js +0 -2
- package/dist/chunk-aa52jhak.js +0 -2
- package/dist/chunk-ambynnzb.js +0 -2
- package/dist/chunk-ampr3fpv.js +0 -2
- package/dist/chunk-asbq9cgs.js +0 -2
- package/dist/chunk-bbdg3sqq.js +0 -33
- package/dist/chunk-bmtsb5mr.js +0 -2
- package/dist/chunk-c8rd3573.js +0 -2
- package/dist/chunk-d4b8cgvt.js +0 -2
- package/dist/chunk-d7skqhrc.js +0 -2
- package/dist/chunk-ensp20xk.js +0 -2
- package/dist/chunk-f1zyc84x.js +0 -2
- package/dist/chunk-f2y8bwdd.js +0 -2
- package/dist/chunk-g9vtny6q.js +0 -2
- package/dist/chunk-hcsrj8z6.js +0 -3
- package/dist/chunk-hj1bntaa.js +0 -2
- package/dist/chunk-hwy3aw5v.js +0 -2
- package/dist/chunk-hyafyqy6.js +0 -2
- package/dist/chunk-j75hqvgt.js +0 -2
- package/dist/chunk-j83ax407.js +0 -2
- package/dist/chunk-k3hfwve1.js +0 -2
- package/dist/chunk-ktc1ecsm.js +0 -2
- package/dist/chunk-mbmbaj0m.js +0 -2
- package/dist/chunk-nd3qttxh.js +0 -2
- package/dist/chunk-ndc1bmj7.js +0 -2
- package/dist/chunk-nn462qm9.js +0 -2
- package/dist/chunk-nr07vxm2.js +0 -2
- package/dist/chunk-q7a5pwaz.js +0 -2
- package/dist/chunk-qx6tr8mr.js +0 -2
- package/dist/chunk-r51vyhms.js +0 -2
- package/dist/chunk-s68bqf62.js +0 -2
- package/dist/chunk-s6sf70ty.js +0 -2
- package/dist/chunk-svavrmxb.js +0 -2
- package/dist/chunk-sw7mvg9p.js +0 -2
- package/dist/chunk-tz40t18m.js +0 -2
- package/dist/chunk-v1k0bdsg.js +0 -2
- package/dist/chunk-vd10tty0.js +0 -2
- package/dist/chunk-vqkzhd19.js +0 -2
- package/dist/chunk-w1yft5gg.js +0 -2
- package/dist/chunk-w6sa921x.js +0 -2
- package/dist/chunk-y120qq1a.js +0 -15
- package/dist/chunk-zcw74jmk.js +0 -2
- package/dist/chunk-zxvndwaz.js +0 -2
- package/dist/chunk-zzr0p4bb.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Ot}from"./chunk-43h8q2cm.js";import{ni,as,U,ze,ee,Tt,x,Ue,Ve,er,d}from"./chunk-faghmmrs.js";import{M}from"./chunk-5db5sxy3.js";var H=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function V(t,n,e){let r={fullTag:e,content:n,attrs:t};if(/\bserver\b/.test(t))return{...r,type:"server"};if(/\bdata-stx-scoped\b/.test(t))return{...r,type:"client"};if(H.test(n))return{...r,type:"signals"};if(/\bclient\b/.test(t)||/\btype\s*=\s*["']module["']/.test(t)||/\bsrc\s*=/.test(t))return{...r,type:"client"};return{...r,type:"server"}}var B=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function ho(t){let n=[],e=[],r=[],i=0;while(i<t.length){let s=t.indexOf("<",i);if(s===-1)break;let a=ze(t,s);if(a>s){i=a;continue}let o=U(t,s);if(o>s){let c=t.slice(s,o),u=B.exec(c);if(u){let l=V(u[1],u[2],c);switch(l.type){case"signals":n.push(l);break;case"client":e.push(l);break;case"server":r.push(l);break}}i=o;continue}i=s+(t.startsWith("<!--",s)?4:1)}return{signals:n,client:e,server:r}}var q=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function z(t){let n=[],e=/<!--[\s\S]*?(?:-->|$)|<(script|style|textarea|title|template)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,r;while((r=e.exec(t))!==null)n.push({start:r.index,end:r.index+r[0].length});return n}function P(t,n){return n.some((e)=>t>=e.start&&t<e.end)}function G(t){let n=(t||"").trim();if(!n)return null;if(/[\s>+~,:]/.test(n))return null;let e={},r=n,i=r.match(/^[a-z][\w-]*/i);if(i)e.tag=i[0].toLowerCase(),r=r.slice(i[0].length);while(r.length>0){let s=r.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(s){if(e.attr=s[1],s[3]!==void 0&&s[3]!=="")e.attrValue=s[3];r=r.slice(s[0].length);continue}let a=r.match(/^#([\w-]+)/);if(a){e.id=a[1],r=r.slice(a[0].length);continue}let o=r.match(/^\.([\w-]+)/);if(o){e.className=o[1],r=r.slice(o[0].length);continue}return null}if(!e.tag&&!e.attr&&!e.id&&!e.className)return null;return e}function W(t,n){if(n.attr){if(!(n.attrValue===void 0?new RegExp(`\\b${n.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${n.attr}\\s*=\\s*(["'])\\s*${n.attrValue}\\s*\\1`,"i")).test(t))return!1}if(n.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${n.id}\\s*\\1`,"i").test(t))return!1}if(n.className){let e=t.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!e)return!1;if(!e[2].split(/\s+/).includes(n.className))return!1}return!0}function O(t,n="main"){let e=G(n);if(!e)return null;let r=/<([a-z][\w-]*)\b([^>]*)>/gi,i=z(t),s;while((s=r.exec(t))!==null){if(P(s.index,i))continue;let a=s[1].toLowerCase(),o=s[2]||"";if(o.trimEnd().endsWith("/")||q.has(a))continue;if(e.tag&&e.tag!==a)continue;if(!W(o,e))continue;let c=s[0],u=s.index+c.length,l=new RegExp(`<(/?)${a}\\b([^>]*)>`,"gi");l.lastIndex=u;let f=1,m;while((m=l.exec(t))!==null){if(P(m.index,i))continue;let S=m[1]==="/";if(!S&&(m[2]||"").trimEnd().endsWith("/"))continue;if(f+=S?-1:1,f===0)return{openTag:c,openIndex:s.index,start:u,end:m.index,tagName:a}}return null}return null}var Oe="private, no-store";function yo(t){return t.replace(/&#(\d+);/g,(n,e)=>j(Number(e),n)).replace(/&#x([0-9a-f]+);/gi,(n,e)=>j(Number.parseInt(e,16),n)).replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/&/g,"&")}function j(t,n){if(!Number.isInteger(t)||t<0||t>1114111)return n;try{return String.fromCodePoint(t)}catch{return n}}function se(t){return t.headers.get("X-STX-Router")==="true"}function X(t,n){if(!t)return n;return t.split(",").some((r)=>r.trim().toLowerCase()===n.toLowerCase())?t:`${t}, ${n}`}function T(t){return{Vary:X(t,"X-STX-Router")}}import E from"path";var J="stx-page-head:",K=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,v={dev:null,prod:null};function Y(){let t=M()?"dev":"prod",n=v[t];if(n!==null)return n;try{let e=import.meta.require("./chunk-v8p5p2kp.js"),r=t==="dev"&&typeof e.getRouterScriptDev==="function"?e.getRouterScriptDev:e.getRouterScript;v[t]=`<script>${r()}</script>`}catch{v[t]=""}return v[t]}async function bo(t,n){if(n===!1)return null;if(n&&typeof n==="string"){let r=E.resolve(t,n);if(await Bun.file(r).exists())return r;return null}let e=E.join(t,"app.stx");if(await Bun.file(e).exists())return e;return null}async function Ir(t,n){try{let e=await Bun.file(t).text(),r=e,i=e.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if(i)r=i[1].trim();let s=ho(e),a=[...s.client.map((p)=>p.fullTag),...s.signals.map((p)=>p.fullTag)],o=[],c=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,u;while((u=c.exec(e))!==null)o.push(u[0]);let l=r;for(let p of s.server)l=l.replace(p.fullTag,"");for(let p of s.client)l=l.replace(p.fullTag,"");l=l.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let f="<!--__STX_PAGE_SLOT__-->";if(l=l.replace(/<slot\s*\/>/gi,f).replace(/<slot\s*>\s*<\/slot>/gi,f),!l.includes(f))return console.warn(`[stx] Shell ${t} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:m,extractVariables:S,defaultConfig:b,loadStxConfig:w}=await import("./chunk-yv5rwthv.js"),y=await w(),g={__filename:t,__dirname:E.dirname(t)};for(let p of a){let C=p.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(C&&!p.includes("client")&&!p.includes('type="module"'))await S(C[1],g,t)}let R=await m(l,g,t,{...b,...y,...n},new Set),h=R.indexOf(f);if(h===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:R.substring(0,h),afterSlot:R.substring(h+f.length),filePath:t,shellScripts:a,shellStyles:o}}catch(e){return console.error(`[stx] Error processing shell ${t}:`,e),null}}function jn(t,n,e){let r,i="",s=n.match(K);if(s){n=n.replace(s[0],"");try{let l=Buffer.from(s[1],"base64").toString("utf8"),f=l.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(f)r=f[1].trim();i=l.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let a=e||r||"stx App",o=Y(),c="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
@@ -18,14 +18,14 @@ ${t.shellScripts.filter((l)=>!l.includes("server")).join(`
|
|
|
18
18
|
${c}
|
|
19
19
|
${o}
|
|
20
20
|
</body>
|
|
21
|
-
</html>`}function ye(t,n={}){let e=t.trim();if(!
|
|
21
|
+
</html>`}function ye(t,n={}){let e=t.trim();if(!Ot(e))return t;let r=[],i=e.match(/<head\b[^>]*>([\s\S]*?)<\/head>/i);if(i){let c=i[1],u=/<style\b[^>]*>[\s\S]*?<\/style>/gi,l;while((l=u.exec(c))!==null)r.push(l[0]);let f=c.match(/<script\b[^>]*data-stx-server-data[^>]*>[\s\S]*?<\/script>/i);if(f)r.push(f[0]);let m=c.match(/<script\b[^>]*data-stx-runtime-config[^>]*>[\s\S]*?<\/script>/i);if(m)r.push(m[0])}if(n.preserveHead&&i){let c=[],u=/<title\b[^>]*>[\s\S]*?<\/title>|<meta\b[^>]*>|<link\b[^>]*>/gi,l;while((l=u.exec(i[1]))!==null){if(/<meta\b[^>]*(?:\bcharset|name="viewport")/i.test(l[0]))continue;c.push(l[0])}if(c.length>0)r.unshift(`<!--${J}${Buffer.from(c.join(`
|
|
22
22
|
`),"utf8").toString("base64")}-->`)}let s=e.match(/<body\b[^>]*>/i),a=e.lastIndexOf("</body>");if(s&&a!==-1){let c=s.index+s[0].length,u=e.slice(c,a).trim();if(r.length>0)return r.join(`
|
|
23
23
|
`)+`
|
|
24
24
|
`+u;return u}let o=e;if(o=o.replace(/<!DOCTYPE\b[^>]*>/i,""),o=o.replace(/<html\b[^>]*>/i,""),o=o.replace(/<\/html\s*>/i,""),i)o=o.replace(/<head\b[^>]*>[\s\S]*?<\/head>/i,r.join(`
|
|
25
|
-
`));return o=o.replace(/<body\b[^>]*>/i,""),o=o.replace(/<\/body\s*>/i,""),o.trim()}var N=/^<script\b[^>]*\sdata-stx-(?:owner|instance)(?=[\s=/>])/i;function I(t,n,e,r){if(!N.test(n))return!1;let i=n.slice(0,n.indexOf(">")+1),s=/\sdata-stx-owner="([^"]+)"/i.exec(i)?.[1];if(!s)return!0;let a=`data-stx-scope="${s}"`;for(let o=t.indexOf(a);o!==-1;o=t.indexOf(a,o+a.length))if(o>=e&&o<r)return!1;return!0}function
|
|
25
|
+
`));return o=o.replace(/<body\b[^>]*>/i,""),o=o.replace(/<\/body\s*>/i,""),o.trim()}var N=/^<script\b[^>]*\sdata-stx-(?:owner|instance)(?=[\s=/>])/i;function I(t,n,e,r){if(!N.test(n))return!1;let i=n.slice(0,n.indexOf(">")+1),s=/\sdata-stx-owner="([^"]+)"/i.exec(i)?.[1];if(!s)return!0;let a=`data-stx-scope="${s}"`;for(let o=t.indexOf(a);o!==-1;o=t.indexOf(a,o+a.length))if(o>=e&&o<r)return!1;return!0}function wo(t){return se(t)}function Z(t,n){let e=[],r=new Set;for(let i of ee(t,U)){if(i.start>=n.start&&i.start<n.end)continue;let s=i.token.match(/^<script\b((?:"[^"]*"|'[^']*'|[^'">])*)>/i)?.[1]??"",a=new Map;for(let u of s.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g))a.set(u[1].toLowerCase(),u[2]??u[3]??u[4]??"");let o=a.get("src")?.trim(),c=a.get("type")?.trim().toLowerCase();if(!o||a.has("server")||c&&!["module","text/javascript","application/javascript"].includes(c))continue;if(a.has("data-stx-runtime")||a.has("data-stx-router")||/^\/_stx\/(?:runtime|router)(?:\.[a-f0-9]{16})?\.js(?:[?#]|$)/i.test(o))continue;if(I(t,i.token,n.start,n.end)||r.has(i.token))continue;r.add(i.token),e.push(i.token)}return e}function oe(t,n="main"){let e=t.trim(),r=[],i=[],s=e.match(/<head\b[^>]*>([\s\S]*?)<\/head>/i);if(s){let g=s[1],R=/<style\b[^>]*>[\s\S]*?<\/style>/gi,h;while((h=R.exec(g))!==null)r.push(h[0]);let p=/<script\b[^>]*data-stx-(?:route-params|server-data|scoped|component-factories)[^>]*>[\s\S]*?<\/script>/gi;while((h=p.exec(g))!==null){if(N.test(h[0])||h[0].includes("__stx_early_mounts")||/^<script\b[^>]*\bdata-stx-runtime(?=[\s=>])/i.test(h[0]))continue;i.push(h[0])}}let a=O(e,n);if(!a)return ye(t);let o=Z(e,a),c=new Set(o),{tagName:u,start:l,end:f}=a,m=e.slice(l,f).trim(),S=[],b=e.match(/<body\b[^>]*>/i),w=e.lastIndexOf("</body>");if(b&&b.index!==void 0&&w!==-1){let R=[[b.index+b[0].length,a.openIndex],[f+`</${u}>`.length,w]],h=/<script\b[^>]*>[\s\S]*?<\/script>/gi;for(let[p,C]of R){if(p>=C)continue;let L=e.slice(p,C),A;h.lastIndex=0;while((A=h.exec(L))!==null){if(I(e,A[0],l,f))continue;S.push(A[0])}}}let y=[];if(r.length>0)y.push(r.join(`
|
|
26
26
|
`));if(o.length>0)y.push(o.join(`
|
|
27
27
|
`));if(i.length>0)y.push(i.filter((g)=>!c.has(g)).join(`
|
|
28
28
|
`));if(S.length>0)y.push(S.filter((g)=>!c.has(g)).join(`
|
|
29
29
|
`));return y.push(m),y.join(`
|
|
30
|
-
`)}import k from"fs";import D from"path";function
|
|
31
|
-
export{
|
|
30
|
+
`)}import k from"fs";import D from"path";function vo(t,n,e){return{version:1,buildTime:new Date().toISOString(),routes:t,assets:n,outputDir:e}}function xo(t,n){let e=D.join(n,"manifest.json");k.writeFileSync(e,JSON.stringify(t,null,2))}function So(t){let n=D.join(t,"manifest.json");if(!k.existsSync(n))return null;try{let e=k.readFileSync(n,"utf-8"),r=JSON.parse(e);if(r.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${r.version}`),null;return r}catch(e){return console.warn("[stx] Failed to load manifest:",e),null}}function _(t,n,e={}){let r=`${encodeURIComponent(t)}=${encodeURIComponent(n)}`;if(e.maxAge!==void 0)r+=`; Max-Age=${e.maxAge}`;if(e.expires)r+=`; Expires=${e.expires.toUTCString()}`;if(e.path)r+=`; Path=${e.path}`;if(e.domain)r+=`; Domain=${e.domain}`;if(e.secure)r+="; Secure";if(e.httpOnly)r+="; HttpOnly";if(e.sameSite)r+=`; SameSite=${e.sameSite}`;return r}async function Q(t){let n=t.headers.get("content-type")||"",e={},r=(i,s)=>{let a=e[i];if(a===void 0)e[i]=s;else if(Array.isArray(a))a.push(s);else e[i]=[a,s]};if(n.includes("multipart/form-data")){let i=await t.formData();for(let[s,a]of i.entries())if(typeof a==="string")r(s,a);return e}if(n.includes("application/x-www-form-urlencoded")){for(let[i,s]of new URLSearchParams(await t.text()).entries())r(i,s);return e}return e}function Or(t){if(!t)return!1;let n=t.toUpperCase();return n!=="GET"&&n!=="HEAD"}async function F(t,n={}){let e=n.request,r=n.method??e?.method;if(!e||!Or(r))return{ran:!1};if(typeof t.action!=="function")return{ran:!1};let i={};try{i=await Q(e)}catch{}let s=await t.action({request:e,form:i,params:n.params??{},query:t.query??{},cookies:n.cookies??{}});if(s&&typeof s==="object"){let a=s,o=tt(a.cookies),c=a.redirect;if(typeof c==="string"&&c)return{redirect:c,ran:!0,...o.length>0?{cookies:o}:{}};let{cookies:u,redirect:l,...f}=a;if(Object.assign(t,f),o.length>0)return{ran:!0,cookies:o}}return{ran:!0}}function tt(t){if(!t||typeof t!=="object"||Array.isArray(t))return[];let n=[];for(let[e,r]of Object.entries(t)){if(!e)continue;if(typeof r==="string"){n.push(_(e,r));continue}if(r&&typeof r==="object"){let i=r;if(typeof i.value!=="string")continue;n.push(_(e,i.value,i))}}return n}function ko(t,n=[],e){let r=new Headers({Location:t,"Cache-Control":"no-store"});for(let i of n)r.append("Set-Cookie",i);for(let[i,s]of Object.entries(e??{}))if(i.toLowerCase()!=="location")r.set(i,s);return new Response(null,{status:303,headers:r})}async function Bt(t,n={}){let{html:e,context:r,redirect:i,cookies:s}=await et(t,n),a=Ue(r),o=Ve(r);if(i)return{html:e,redirect:i,cookies:s,status:a,headers:o};let{extractStreamBoundaries:c}=await import("./chunk-1cat8kdj.js"),u=c(r),l=t.streamTemplates;if(l&&Object.keys(l).length>0){let{processDirectives:f}=await import("./chunk-sy1bk1ry.js"),{defaultConfig:m}=await import("./chunk-1dwnp35v.js"),S=r.streamBoundaries||{},b={...m,autoShell:!1},w=Object.keys(l).map((g)=>({id:g,render:async()=>{let R=typeof S[g]==="function"?await S[g]():void 0;return f(l[g],{...r,$boundary:R},t.sourceFile,b,new Set)}})),y=new Set(w.map((g)=>g.id));u=[...(u||[]).filter((g)=>!y.has(g.id)),...w]}return{html:e,boundaries:u&&u.length>0?u:void 0,cookies:s,status:a,headers:o}}async function et(t,n){let e={__filename:t.sourceFile,__dirname:t.sourceFile.replace(/[/\\][^/\\]+$/,""),...n};if(!t.hasServerScripts&&!as(t.html))return{html:t.html,context:e};for(let a of t.serverScriptContent)try{await d(a,e,t.sourceFile)}catch(o){if(n.__stx_strict_hydration)throw o;console.warn(`[stx] Server script error in ${t.sourceFile}:`,o)}let r=await F(e,{request:n.request,method:n.method,params:n.params??{},cookies:n.cookies??{}}),i=(a)=>{let o=a.replace(/<script\b[^>]*\bdata-stx-server-data\b[^>]*>[\s\S]*?<\/script>/gi,""),c=er(e);if(!c)return o;let u=o.indexOf("</head>");return u<0?c+o:o.slice(0,u)+c+o.slice(u)};if(r.redirect)return{html:t.html,context:e,redirect:r.redirect,cookies:r.cookies};if(!as(t.html))return{html:i(t.html),context:e,cookies:r.cookies};let s=new Map;for(let[a,o]of Object.entries(t.placeholders))if(o.expression)try{let c=x(o.expression,e);if(o.type==="raw")s.set(a,c!==void 0&&c!==null?String(c):"");else s.set(a,c!==void 0&&c!==null?Tt(String(c)):"")}catch(c){if(n.__stx_strict_hydration)throw c;s.set(a,"")}return{html:i(ni(t.html,s)),context:e,cookies:r.cookies}}
|
|
31
|
+
export{ho,Oe,yo,se,T,bo,Ir,jn,ye,wo,oe,vo,xo,So,Or,ko,Bt};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ae,yt}from"./chunk-
|
|
2
|
+
import{ae,yt}from"./chunk-jpqkm8tm.js";import{E}from"./chunk-5db5sxy3.js";function m(e){let t={"cache-first":{className:"CacheFirst",importFrom:"workbox-strategies"},"network-first":{className:"NetworkFirst",importFrom:"workbox-strategies"},"stale-while-revalidate":{className:"StaleWhileRevalidate",importFrom:"workbox-strategies"},"network-only":{className:"NetworkOnly",importFrom:"workbox-strategies"},"cache-only":{className:"CacheOnly",importFrom:"workbox-strategies"}};return t[e]||t["network-first"]}function g(e){return m(e).className}function d(e){let t=e.pwa;if(!t?.enabled)return"";let r=t.routes||[],n=t.cacheStorage,c=[];for(let a of r){let i=g(a.strategy),s=[];if(a.maxAgeSeconds||a.maxEntries||n?.maxEntries){let o=a.maxEntries||n?.maxEntries||100,u=a.maxAgeSeconds||(n?.maxAge?n.maxAge*24*60*60:void 0);s.push(`new ExpirationPlugin({
|
|
3
3
|
maxEntries: ${o},
|
|
4
4
|
${u?`maxAgeSeconds: ${u},`:""}
|
|
5
5
|
purgeOnQuotaError: true,
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{iu,Nc,xe,xi,au,ks,Cs,_s}from"./chunk-faghmmrs.js";import"./chunk-cdgwkzms.js";import"./chunk-ah9xyss2.js";import"./chunk-jtbzmbzz.js";import"./chunk-eww6sdzz.js";import"./chunk-be2ba3hj.js";import"./chunk-ayy9mmrw.js";import"./chunk-43h8q2cm.js";import"./chunk-7hkc96de.js";import"./chunk-vpdx7qr3.js";import"./chunk-zk2xk0wd.js";import"./chunk-yhpyqsbr.js";import"./chunk-qdyp2zqf.js";export{au as clearOnceStore,xi as onceStore,xe as partialsCache,ks as processIncludes,Cs as processStackPushDirectives,_s as processStackReplacements,iu as resetUnscopedSignalWarnings,Nc as topLevelElements};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ba,Pl,wa,va,Il,Ol}from"./chunk-cb2pyg5t.js";import"./chunk-faghmmrs.js";import"./chunk-cdgwkzms.js";import"./chunk-ah9xyss2.js";import"./chunk-jtbzmbzz.js";import"./chunk-eww6sdzz.js";import"./chunk-be2ba3hj.js";import"./chunk-ayy9mmrw.js";import"./chunk-43h8q2cm.js";import"./chunk-7hkc96de.js";import"./chunk-vpdx7qr3.js";import"./chunk-zk2xk0wd.js";import"./chunk-yhpyqsbr.js";import"./chunk-qdyp2zqf.js";export{Ol as applySlots,Il as extractSlotContent,Pl as parseSlotElement,ba as parseSlots,va as processSlots,wa as renderSlot};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
function E(){let{NODE_ENV:n}=process.env;return n==="production"}function M(){let{STX_DEBUG:n}=process.env;return!E()||n==="true"}function
|
|
3
|
-
export{E,M,
|
|
2
|
+
function E(){let{NODE_ENV:n}=process.env;return n==="production"}function M(){let{STX_DEBUG:n}=process.env;return!E()||n==="true"}function En(){let{NODE_ENV:n}=process.env;return n==="test"}function Ws(n){return n==="compile"||E()}function Tn(n){if(!n)return n;try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(n).trim()}catch{return n}}
|
|
3
|
+
export{E,M,En,Ws,Tn};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var{WebView:p}=globalThis.Bun;import{existsSync as y,mkdirSync as b,readdirSync as v,statSync as S}from"fs";import l from"path";var h=16384;function M(e){if(/^https?:\/\//.test(e)||e.startsWith("file://"))return e;return`file://${l.resolve(e)}`}function g(e,n,t,o){return new Promise((s)=>{let i=!1,r,m,c=()=>{if(!i){if(i=!0,clearTimeout(m),r)clearTimeout(r);e.onNavigated=void 0,s()}};m=setTimeout(c,o),e.onNavigated=()=>{if(!i)r=setTimeout(c,t)};try{let u=e.navigate(n);if(u&&typeof u.catch==="function")u.catch(c)}catch{c()}})}async function w(e,n,t){let o=`!!document.querySelector(${JSON.stringify(n)})`,s=Date.now()+t;while(Date.now()<s){try{if(await e.evaluate(o))return}catch{}await new Promise((i)=>setTimeout(i,100))}}async function T(e){try{let n=await e.evaluate("Math.ceil(Math.max(document.documentElement.scrollHeight, document.documentElement.offsetHeight, document.body ? document.body.scrollHeight : 0, document.body ? document.body.offsetHeight : 0))");return typeof n==="number"&&Number.isFinite(n)&&n>0?Math.min(n,h):0}catch{return 0}}async function
|
|
3
|
-
export{
|
|
2
|
+
var{WebView:p}=globalThis.Bun;import{existsSync as y,mkdirSync as b,readdirSync as v,statSync as S}from"fs";import l from"path";var h=16384;function M(e){if(/^https?:\/\//.test(e)||e.startsWith("file://"))return e;return`file://${l.resolve(e)}`}function g(e,n,t,o){return new Promise((s)=>{let i=!1,r,m,c=()=>{if(!i){if(i=!0,clearTimeout(m),r)clearTimeout(r);e.onNavigated=void 0,s()}};m=setTimeout(c,o),e.onNavigated=()=>{if(!i)r=setTimeout(c,t)};try{let u=e.navigate(n);if(u&&typeof u.catch==="function")u.catch(c)}catch{c()}})}async function w(e,n,t){let o=`!!document.querySelector(${JSON.stringify(n)})`,s=Date.now()+t;while(Date.now()<s){try{if(await e.evaluate(o))return}catch{}await new Promise((i)=>setTimeout(i,100))}}async function T(e){try{let n=await e.evaluate("Math.ceil(Math.max(document.documentElement.scrollHeight, document.documentElement.offsetHeight, document.body ? document.body.scrollHeight : 0, document.body ? document.body.offsetHeight : 0))");return typeof n==="number"&&Number.isFinite(n)&&n>0?Math.min(n,h):0}catch{return 0}}async function ga(e,n,t={}){let o=Math.min(t.width??1440,h),s=Math.min(t.height??2200,h),i=t.waitMs??800,r=t.timeoutMs??15000,m=t.format??"png",c=M(e),u=(f)=>new p({width:o,height:f,headless:!0,...t.backend?{backend:t.backend}:{}}),a=u(s);try{if(await g(a,c,i,r),t.waitSelector)await w(a,t.waitSelector,r);if(t.fullPage){let d=await T(a);if(d>s){if(a.close(),a=u(d),await g(a,c,i,r),t.waitSelector)await w(a,t.waitSelector,r)}}let f=await a.screenshot({encoding:"buffer",format:m});b(l.dirname(l.resolve(n)),{recursive:!0}),await Bun.write(n,f)}finally{a.close()}if(!y(n))throw Error(`Screenshot was not produced for ${e}`);return{input:e,output:n,bytes:S(n).size}}async function hl(e,n,t={}){b(n,{recursive:!0});let o;if(!/^https?:\/\//.test(e)&&y(e)&&S(e).isDirectory())o=v(e).filter((r)=>r.endsWith(".html")).map((r)=>l.join(e,r));else o=[e];let s=t.format??"png",i=[];for(let r of o){let m=/^https?:\/\//.test(r)?new URL(r).pathname.replace(/\W+/g,"-").replace(/^-|-$/g,"")||"index":l.basename(r).replace(/\.html?$/,"");i.push(await ga(r,l.join(n,`${m}.${s}`),t))}return i}
|
|
3
|
+
export{ga,hl};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{No,Lo,jo,Nd}from"./chunk-zz02hwec.js";import"./chunk-j1nqnmcd.js";import"./chunk-117xss52.js";import"./chunk-faghmmrs.js";import"./chunk-cdgwkzms.js";import"./chunk-ah9xyss2.js";import"./chunk-jtbzmbzz.js";import"./chunk-eww6sdzz.js";import"./chunk-be2ba3hj.js";import"./chunk-ayy9mmrw.js";import"./chunk-43h8q2cm.js";import"./chunk-7hkc96de.js";import"./chunk-vpdx7qr3.js";import"./chunk-zk2xk0wd.js";import"./chunk-yhpyqsbr.js";import"./chunk-qdyp2zqf.js";export{No as buildNative,Nd as default,jo as getAvailableFormats,Lo as getAvailableTargets};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var Xr=new Map([["craft-button",{name:"Button",zigType:"craft.Button",props:[{name:"variant",type:"string",required:!1,default:"primary"},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onclick",type:"callback",required:!1}],children:"single"}],["craft-text-input",{name:"TextInput",zigType:"craft.TextInput",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-textarea",{name:"TextArea",zigType:"craft.TextArea",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"rows",type:"number",required:!1,default:3},{name:"disabled",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-checkbox",{name:"Checkbox",zigType:"craft.Checkbox",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"label",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-select",{name:"Select",zigType:"craft.Select",props:[{name:"value",type:"string",required:!1},{name:"options",type:"array",required:!0},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-slider",{name:"Slider",zigType:"craft.Slider",props:[{name:"value",type:"number",required:!1,default:0},{name:"min",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"step",type:"number",required:!1,default:1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-toggle",{name:"Toggle",zigType:"craft.Toggle",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-modal",{name:"Modal",zigType:"craft.Modal",props:[{name:"open",type:"boolean",required:!1,default:!1},{name:"title",type:"string",required:!1},{name:"closable",type:"boolean",required:!1,default:!0},{name:"onclose",type:"callback",required:!1}],children:"multiple"}],["craft-alert",{name:"Alert",zigType:"craft.Alert",props:[{name:"variant",type:"string",required:!1,default:"info"},{name:"title",type:"string",required:!1},{name:"dismissible",type:"boolean",required:!1,default:!1}],children:"single"}],["craft-progress",{name:"ProgressBar",zigType:"craft.ProgressBar",props:[{name:"value",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"indeterminate",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-spinner",{name:"Spinner",zigType:"craft.Spinner",props:[{name:"size",type:"number",required:!1,default:24}],children:"none"}],["craft-avatar",{name:"Avatar",zigType:"craft.Avatar",props:[{name:"src",type:"string",required:!1},{name:"alt",type:"string",required:!1},{name:"size",type:"number",required:!1,default:40}],children:"none"}],["craft-badge",{name:"Badge",zigType:"craft.Badge",props:[{name:"variant",type:"string",required:!1,default:"default"}],children:"single"}],["craft-card",{name:"Card",zigType:"craft.Card",props:[{name:"padding",type:"number",required:!1,default:16}],children:"multiple"}],["craft-sidebar",{name:"Sidebar",zigType:"craft.NativeSidebar",props:[{name:"id",type:"string",required:!1},{name:"variant",type:"string",required:!1,default:"desktop"},{name:"material",type:"string",required:!1,default:"sidebar"},{name:"backgroundEffect",type:"string",required:!1,default:"shimmer"},{name:"allowsVibrancy",type:"boolean",required:!1,default:!0},{name:"materialOpacity",type:"number",required:!1,default:0.68},{name:"minWidth",type:"number",required:!1,default:240},{name:"maxWidth",type:"number",required:!1,default:340},{name:"canCollapse",type:"boolean",required:!1,default:!0},{name:"selectedItem",type:"string",required:!1},{name:"sections",type:"array",required:!1}],children:"multiple",platform:["macos"],fallback:"aside"}],["craft-sidebar-section",{name:"SidebarSection",zigType:"craft.NativeSidebarSection",props:[{name:"id",type:"string",required:!0},{name:"title",type:"string",required:!1},{name:"header",type:"string",required:!1}],children:"multiple",platform:["macos"],fallback:"section"}],["craft-sidebar-item",{name:"SidebarItem",zigType:"craft.NativeSidebarItem",props:[{name:"id",type:"string",required:!0},{name:"label",type:"string",required:!0},{name:"icon",type:"string",required:!1},{name:"badge",type:"string",required:!1},{name:"tintColor",type:"color",required:!1}],children:"none",platform:["macos"],fallback:"button"}],["craft-accordion",{name:"Accordion",zigType:"craft.Accordion",props:[{name:"title",type:"string",required:!0},{name:"open",type:"boolean",required:!1,default:!1}],children:"multiple"}],["craft-tabs",{name:"TabView",zigType:"craft.TabView",props:[{name:"activeTab",type:"number",required:!1,default:0},{name:"ontabchange",type:"callback",required:!1}],children:"multiple"}],["craft-tooltip",{name:"Tooltip",zigType:"craft.Tooltip",props:[{name:"content",type:"string",required:!0},{name:"position",type:"string",required:!1,default:"top"}],children:"single"}],["craft-date-picker",{name:"DatePicker",zigType:"craft.DatePicker",props:[{name:"value",type:"string",required:!1},{name:"min",type:"string",required:!1},{name:"max",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-time-picker",{name:"TimePicker",zigType:"craft.TimePicker",props:[{name:"value",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-color-picker",{name:"ColorPicker",zigType:"craft.ColorPicker",props:[{name:"value",type:"color",required:!1,default:"#000000"},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-data-table",{name:"DataTable",zigType:"craft.DataTable",props:[{name:"data",type:"array",required:!0},{name:"columns",type:"array",required:!0},{name:"sortable",type:"boolean",required:!1,default:!1},{name:"paginated",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-virtual-list",{name:"VirtualList",zigType:"craft.VirtualList",props:[{name:"items",type:"array",required:!0},{name:"itemHeight",type:"number",required:!1,default:48},{name:"renderItem",type:"callback",required:!0}],children:"none"}],["craft-tree-view",{name:"TreeView",zigType:"craft.TreeView",props:[{name:"data",type:"object",required:!0},{name:"expandable",type:"boolean",required:!1,default:!0}],children:"none"}]]);async function Lo(e,t={}){let r=performance.now(),n={target:t.target||"universal",format:t.format||"zig",optimize:t.optimize??!0,treeShake:t.treeShake??!0,hotReload:t.hotReload??!1,debug:t.debug??!1,sourceMaps:t.sourceMaps??!1,bundle:t.bundle??!0,minify:t.minify??!1,components:t.components||Xr},i=typeof e==="string"?w(e):e,o=I(i.tree,n),s=L(o),a=n.treeShake?O(o,s):o,l=new Map;if(n.target==="universal"){let c=["macos","windows","linux","ios","android"];for(let g of c){let q=u(a,{...n,target:g});l.set(g,q)}}else{let c=u(a,n);l.set(n.target,c)}let p=H(a,n,l),S=_(i,a,n),k={compilationTime:performance.now()-r,totalComponents:f(i.tree),nativeComponents:d(a),webComponents:f(i.tree)-d(a),bundleSize:p.length,treeShakenSize:n.treeShake?W(o,a):p.length,warnings:[],errors:[]},m;if(n.sourceMaps)m=B(i,a);return{code:p,platformCode:l,dependencies:s,manifest:S,sourceMaps:m,stats:k}}function w(e){let t={type:"fragment",children:[]},r=e.match(/<body[^>]*>([\s\S]*?)<\/body>/i),n=r?r[1]:e;return b(n,t),{id:T(),hash:x(e),tree:t,scripts:U(e),styles:Z(e),staticParts:new Map,dynamicParts:new Map,dependencies:[],metadata:{hasSlots:!1,hasDynamicContent:e.includes("{{"),hasEventHandlers:e.includes("onclick")||e.includes("onchange"),hasAsyncContent:!1,componentCount:0,maxDepth:0,estimatedSize:e.length}}}function b(e,t){let r=/<(@?[\w-]+)([^>]*)(?:\/>|>([\s\S]*?)<\/\1>)/g,n;while((n=r.exec(e))!==null){let[,i,o,s]=n,a=i.startsWith("@craft-"),l={type:a?"component":"element",tag:a?i.slice(1):i,props:z(o),children:[],componentName:a?i.slice(1):void 0};if(s){let p=s.replace(/<[^>]+>/g,"").trim();if(p)l.children=l.children??[],l.children.push({type:"text",text:p});b(s,l)}t.children=t.children??[],t.children.push(l)}}function z(e){let t={},r=/([\w-:@]+)(?:=["']([^"']*)["'])?/g,n;while((n=r.exec(e))!==null){let[,i,o]=n;t[i]=o??!0}return t}function I(e,t){return h(e,t)}function h(e,t){let r=e.componentName?t.components?.get(e.componentName):void 0,n="craft.View";if(r)n=r.zigType;else if(e.type==="text")n="craft.Text";else if(e.tag)n=R(e.tag);let i={};if(e.props)for(let[l,p]of Object.entries(e.props))i[l]=M(p);let o=[];if(e.children)for(let l of e.children)o.push(h(l,t));let s=new Map;if(e.props){for(let[l,p]of Object.entries(e.props))if(l.startsWith("on")&&typeof p==="string")s.set(l.slice(2).toLowerCase(),p)}let a=V(e);return{type:A(e,r),zigType:n,props:i,children:o,events:s,styles:a,id:e.hydrationKey,key:e.props?.key}}function R(e){return{div:"craft.View",span:"craft.Text",p:"craft.Text",h1:"craft.Text",h2:"craft.Text",h3:"craft.Text",h4:"craft.Text",h5:"craft.Text",h6:"craft.Text",button:"craft.Button",input:"craft.TextInput",textarea:"craft.TextArea",select:"craft.Select",img:"craft.Image",a:"craft.Link",ul:"craft.List",ol:"craft.List",li:"craft.ListItem",form:"craft.Form",label:"craft.Label",nav:"craft.View",header:"craft.View",footer:"craft.View",main:"craft.View",section:"craft.View",article:"craft.View",aside:"craft.View"}[e.toLowerCase()]||"craft.View"}function M(e){if(typeof e==="string"){if(e.startsWith("{{")&&e.endsWith("}}"))return{type:"binding",path:e.slice(2,-2).trim()};if(e.includes("(")&&e.includes(")"))return{type:"callback",handler:e};return{type:"literal",value:e}}if(typeof e==="number"||typeof e==="boolean")return{type:"literal",value:e};return{type:"literal",value:String(e)}}function A(e,t){if(t){let n=t.name.toLowerCase();if(n.includes("button"))return"button";if(n.includes("input")||n.includes("text"))return"input";if(n.includes("image")||n.includes("avatar"))return"image";if(n.includes("list")||n.includes("table"))return"list";if(n.includes("scroll"))return"scroll";return"custom"}if(e.type==="text")return"text";let r=e.tag?.toLowerCase();if(r==="button")return"button";if(r==="input"||r==="textarea")return"input";if(r==="img")return"image";if(r==="ul"||r==="ol")return"list";return"view"}function V(e){let t=e.props?.style,r={},n={};if(t){let i=t.split(";").filter(Boolean);for(let o of i){let[s,a]=o.split(":").map((l)=>l.trim());if(!s||!a)continue;switch(s){case"display":r.display=a;break;case"flex-direction":r.flexDirection=a;break;case"justify-content":r.justifyContent=j(a);break;case"align-items":r.alignItems=D(a);break;case"gap":r.gap=Number.parseInt(a,10);break;case"padding":r.padding=Number.parseInt(a,10);break;case"margin":r.margin=Number.parseInt(a,10);break;case"width":r.width=a==="auto"?"auto":Number.parseInt(a,10);break;case"height":r.height=a==="auto"?"auto":Number.parseInt(a,10);break;case"background-color":case"background":n.backgroundColor=a;break;case"border-color":n.borderColor=a;break;case"border-width":n.borderWidth=Number.parseInt(a,10);break;case"border-radius":n.borderRadius=Number.parseInt(a,10);break;case"opacity":n.opacity=Number.parseFloat(a);break}}}return{layout:r,appearance:n}}function j(e){return{"flex-start":"start","flex-end":"end",center:"center","space-between":"between","space-around":"around"}[e]||"start"}function D(e){return{"flex-start":"start","flex-end":"end",center:"center",stretch:"stretch"}[e]||"start"}function L(e){let t=[],r=new Set;function n(i,o){let s=i.id||T();if(r.has(s))return;r.add(s);let a={id:s,type:"component",path:i.zigType,dependencies:o?[o]:[],size:C(i),isStatic:P(i)};t.push(a);for(let l of i.children)n(l,s)}return n(e),t}function C(e){let t=100;return t+=Object.keys(e.props).length*20,t+=e.events.size*50,t}function P(e){for(let t of Object.values(e.props))if(t.type!=="literal")return!1;return e.events.size===0}function O(e,t){return e}function W(e,t){let r=0;function n(i){r+=C(i);for(let o of i.children)n(o)}return n(t),r}function u(e,t){switch(t.format){case"zig":return y(e,t);case"typescript":return E(e,t);case"json":return JSON.stringify(e,null,t.minify?0:2);default:return y(e,t)}}function y(e,t){let r=[];return r.push("// Auto-generated by stx compiler"),r.push("// Target: "+t.target),r.push(""),r.push('const std = @import("std");'),r.push('const craft = @import("craft");'),r.push(""),r.push("pub fn render(allocator: std.mem.Allocator) !craft.Element {"),r.push(" return try build(allocator);"),r.push("}"),r.push(""),N(e,r,0),r.join(`
|
|
2
|
+
var Jr=new Map([["craft-button",{name:"Button",zigType:"craft.Button",props:[{name:"variant",type:"string",required:!1,default:"primary"},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onclick",type:"callback",required:!1}],children:"single"}],["craft-text-input",{name:"TextInput",zigType:"craft.TextInput",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-textarea",{name:"TextArea",zigType:"craft.TextArea",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"rows",type:"number",required:!1,default:3},{name:"disabled",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-checkbox",{name:"Checkbox",zigType:"craft.Checkbox",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"label",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-select",{name:"Select",zigType:"craft.Select",props:[{name:"value",type:"string",required:!1},{name:"options",type:"array",required:!0},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-slider",{name:"Slider",zigType:"craft.Slider",props:[{name:"value",type:"number",required:!1,default:0},{name:"min",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"step",type:"number",required:!1,default:1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-toggle",{name:"Toggle",zigType:"craft.Toggle",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-modal",{name:"Modal",zigType:"craft.Modal",props:[{name:"open",type:"boolean",required:!1,default:!1},{name:"title",type:"string",required:!1},{name:"closable",type:"boolean",required:!1,default:!0},{name:"onclose",type:"callback",required:!1}],children:"multiple"}],["craft-alert",{name:"Alert",zigType:"craft.Alert",props:[{name:"variant",type:"string",required:!1,default:"info"},{name:"title",type:"string",required:!1},{name:"dismissible",type:"boolean",required:!1,default:!1}],children:"single"}],["craft-progress",{name:"ProgressBar",zigType:"craft.ProgressBar",props:[{name:"value",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"indeterminate",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-spinner",{name:"Spinner",zigType:"craft.Spinner",props:[{name:"size",type:"number",required:!1,default:24}],children:"none"}],["craft-avatar",{name:"Avatar",zigType:"craft.Avatar",props:[{name:"src",type:"string",required:!1},{name:"alt",type:"string",required:!1},{name:"size",type:"number",required:!1,default:40}],children:"none"}],["craft-badge",{name:"Badge",zigType:"craft.Badge",props:[{name:"variant",type:"string",required:!1,default:"default"}],children:"single"}],["craft-card",{name:"Card",zigType:"craft.Card",props:[{name:"padding",type:"number",required:!1,default:16}],children:"multiple"}],["craft-sidebar",{name:"Sidebar",zigType:"craft.NativeSidebar",props:[{name:"id",type:"string",required:!1},{name:"variant",type:"string",required:!1,default:"desktop"},{name:"material",type:"string",required:!1,default:"sidebar"},{name:"backgroundEffect",type:"string",required:!1,default:"shimmer"},{name:"allowsVibrancy",type:"boolean",required:!1,default:!0},{name:"materialOpacity",type:"number",required:!1,default:0.68},{name:"minWidth",type:"number",required:!1,default:240},{name:"maxWidth",type:"number",required:!1,default:340},{name:"canCollapse",type:"boolean",required:!1,default:!0},{name:"selectedItem",type:"string",required:!1},{name:"sections",type:"array",required:!1}],children:"multiple",platform:["macos"],fallback:"aside"}],["craft-sidebar-section",{name:"SidebarSection",zigType:"craft.NativeSidebarSection",props:[{name:"id",type:"string",required:!0},{name:"title",type:"string",required:!1},{name:"header",type:"string",required:!1}],children:"multiple",platform:["macos"],fallback:"section"}],["craft-sidebar-item",{name:"SidebarItem",zigType:"craft.NativeSidebarItem",props:[{name:"id",type:"string",required:!0},{name:"label",type:"string",required:!0},{name:"icon",type:"string",required:!1},{name:"badge",type:"string",required:!1},{name:"tintColor",type:"color",required:!1}],children:"none",platform:["macos"],fallback:"button"}],["craft-accordion",{name:"Accordion",zigType:"craft.Accordion",props:[{name:"title",type:"string",required:!0},{name:"open",type:"boolean",required:!1,default:!1}],children:"multiple"}],["craft-tabs",{name:"TabView",zigType:"craft.TabView",props:[{name:"activeTab",type:"number",required:!1,default:0},{name:"ontabchange",type:"callback",required:!1}],children:"multiple"}],["craft-tooltip",{name:"Tooltip",zigType:"craft.Tooltip",props:[{name:"content",type:"string",required:!0},{name:"position",type:"string",required:!1,default:"top"}],children:"single"}],["craft-date-picker",{name:"DatePicker",zigType:"craft.DatePicker",props:[{name:"value",type:"string",required:!1},{name:"min",type:"string",required:!1},{name:"max",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-time-picker",{name:"TimePicker",zigType:"craft.TimePicker",props:[{name:"value",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-color-picker",{name:"ColorPicker",zigType:"craft.ColorPicker",props:[{name:"value",type:"color",required:!1,default:"#000000"},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-data-table",{name:"DataTable",zigType:"craft.DataTable",props:[{name:"data",type:"array",required:!0},{name:"columns",type:"array",required:!0},{name:"sortable",type:"boolean",required:!1,default:!1},{name:"paginated",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-virtual-list",{name:"VirtualList",zigType:"craft.VirtualList",props:[{name:"items",type:"array",required:!0},{name:"itemHeight",type:"number",required:!1,default:48},{name:"renderItem",type:"callback",required:!0}],children:"none"}],["craft-tree-view",{name:"TreeView",zigType:"craft.TreeView",props:[{name:"data",type:"object",required:!0},{name:"expandable",type:"boolean",required:!1,default:!0}],children:"none"}]]);async function Bo(e,t={}){let r=performance.now(),n={target:t.target||"universal",format:t.format||"zig",optimize:t.optimize??!0,treeShake:t.treeShake??!0,hotReload:t.hotReload??!1,debug:t.debug??!1,sourceMaps:t.sourceMaps??!1,bundle:t.bundle??!0,minify:t.minify??!1,components:t.components||Jr},i=typeof e==="string"?w(e):e,o=I(i.tree,n),s=L(o),a=n.treeShake?O(o,s):o,l=new Map;if(n.target==="universal"){let c=["macos","windows","linux","ios","android"];for(let g of c){let q=u(a,{...n,target:g});l.set(g,q)}}else{let c=u(a,n);l.set(n.target,c)}let p=H(a,n,l),S=_(i,a,n),k={compilationTime:performance.now()-r,totalComponents:f(i.tree),nativeComponents:d(a),webComponents:f(i.tree)-d(a),bundleSize:p.length,treeShakenSize:n.treeShake?W(o,a):p.length,warnings:[],errors:[]},m;if(n.sourceMaps)m=B(i,a);return{code:p,platformCode:l,dependencies:s,manifest:S,sourceMaps:m,stats:k}}function w(e){let t={type:"fragment",children:[]},r=e.match(/<body[^>]*>([\s\S]*?)<\/body>/i),n=r?r[1]:e;return b(n,t),{id:T(),hash:x(e),tree:t,scripts:U(e),styles:Z(e),staticParts:new Map,dynamicParts:new Map,dependencies:[],metadata:{hasSlots:!1,hasDynamicContent:e.includes("{{"),hasEventHandlers:e.includes("onclick")||e.includes("onchange"),hasAsyncContent:!1,componentCount:0,maxDepth:0,estimatedSize:e.length}}}function b(e,t){let r=/<(@?[\w-]+)([^>]*)(?:\/>|>([\s\S]*?)<\/\1>)/g,n;while((n=r.exec(e))!==null){let[,i,o,s]=n,a=i.startsWith("@craft-"),l={type:a?"component":"element",tag:a?i.slice(1):i,props:z(o),children:[],componentName:a?i.slice(1):void 0};if(s){let p=s.replace(/<[^>]+>/g,"").trim();if(p)l.children=l.children??[],l.children.push({type:"text",text:p});b(s,l)}t.children=t.children??[],t.children.push(l)}}function z(e){let t={},r=/([\w-:@]+)(?:=["']([^"']*)["'])?/g,n;while((n=r.exec(e))!==null){let[,i,o]=n;t[i]=o??!0}return t}function I(e,t){return h(e,t)}function h(e,t){let r=e.componentName?t.components?.get(e.componentName):void 0,n="craft.View";if(r)n=r.zigType;else if(e.type==="text")n="craft.Text";else if(e.tag)n=R(e.tag);let i={};if(e.props)for(let[l,p]of Object.entries(e.props))i[l]=M(p);let o=[];if(e.children)for(let l of e.children)o.push(h(l,t));let s=new Map;if(e.props){for(let[l,p]of Object.entries(e.props))if(l.startsWith("on")&&typeof p==="string")s.set(l.slice(2).toLowerCase(),p)}let a=V(e);return{type:A(e,r),zigType:n,props:i,children:o,events:s,styles:a,id:e.hydrationKey,key:e.props?.key}}function R(e){return{div:"craft.View",span:"craft.Text",p:"craft.Text",h1:"craft.Text",h2:"craft.Text",h3:"craft.Text",h4:"craft.Text",h5:"craft.Text",h6:"craft.Text",button:"craft.Button",input:"craft.TextInput",textarea:"craft.TextArea",select:"craft.Select",img:"craft.Image",a:"craft.Link",ul:"craft.List",ol:"craft.List",li:"craft.ListItem",form:"craft.Form",label:"craft.Label",nav:"craft.View",header:"craft.View",footer:"craft.View",main:"craft.View",section:"craft.View",article:"craft.View",aside:"craft.View"}[e.toLowerCase()]||"craft.View"}function M(e){if(typeof e==="string"){if(e.startsWith("{{")&&e.endsWith("}}"))return{type:"binding",path:e.slice(2,-2).trim()};if(e.includes("(")&&e.includes(")"))return{type:"callback",handler:e};return{type:"literal",value:e}}if(typeof e==="number"||typeof e==="boolean")return{type:"literal",value:e};return{type:"literal",value:String(e)}}function A(e,t){if(t){let n=t.name.toLowerCase();if(n.includes("button"))return"button";if(n.includes("input")||n.includes("text"))return"input";if(n.includes("image")||n.includes("avatar"))return"image";if(n.includes("list")||n.includes("table"))return"list";if(n.includes("scroll"))return"scroll";return"custom"}if(e.type==="text")return"text";let r=e.tag?.toLowerCase();if(r==="button")return"button";if(r==="input"||r==="textarea")return"input";if(r==="img")return"image";if(r==="ul"||r==="ol")return"list";return"view"}function V(e){let t=e.props?.style,r={},n={};if(t){let i=t.split(";").filter(Boolean);for(let o of i){let[s,a]=o.split(":").map((l)=>l.trim());if(!s||!a)continue;switch(s){case"display":r.display=a;break;case"flex-direction":r.flexDirection=a;break;case"justify-content":r.justifyContent=j(a);break;case"align-items":r.alignItems=D(a);break;case"gap":r.gap=Number.parseInt(a,10);break;case"padding":r.padding=Number.parseInt(a,10);break;case"margin":r.margin=Number.parseInt(a,10);break;case"width":r.width=a==="auto"?"auto":Number.parseInt(a,10);break;case"height":r.height=a==="auto"?"auto":Number.parseInt(a,10);break;case"background-color":case"background":n.backgroundColor=a;break;case"border-color":n.borderColor=a;break;case"border-width":n.borderWidth=Number.parseInt(a,10);break;case"border-radius":n.borderRadius=Number.parseInt(a,10);break;case"opacity":n.opacity=Number.parseFloat(a);break}}}return{layout:r,appearance:n}}function j(e){return{"flex-start":"start","flex-end":"end",center:"center","space-between":"between","space-around":"around"}[e]||"start"}function D(e){return{"flex-start":"start","flex-end":"end",center:"center",stretch:"stretch"}[e]||"start"}function L(e){let t=[],r=new Set;function n(i,o){let s=i.id||T();if(r.has(s))return;r.add(s);let a={id:s,type:"component",path:i.zigType,dependencies:o?[o]:[],size:C(i),isStatic:P(i)};t.push(a);for(let l of i.children)n(l,s)}return n(e),t}function C(e){let t=100;return t+=Object.keys(e.props).length*20,t+=e.events.size*50,t}function P(e){for(let t of Object.values(e.props))if(t.type!=="literal")return!1;return e.events.size===0}function O(e,t){return e}function W(e,t){let r=0;function n(i){r+=C(i);for(let o of i.children)n(o)}return n(t),r}function u(e,t){switch(t.format){case"zig":return y(e,t);case"typescript":return E(e,t);case"json":return JSON.stringify(e,null,t.minify?0:2);default:return y(e,t)}}function y(e,t){let r=[];return r.push("// Auto-generated by stx compiler"),r.push("// Target: "+t.target),r.push(""),r.push('const std = @import("std");'),r.push('const craft = @import("craft");'),r.push(""),r.push("pub fn render(allocator: std.mem.Allocator) !craft.Element {"),r.push(" return try build(allocator);"),r.push("}"),r.push(""),N(e,r,0),r.join(`
|
|
3
3
|
`)}function N(e,t,r){let n=" ".repeat(r);if(r===0)t.push("fn build(allocator: std.mem.Allocator) !craft.Element {");let i=`node_${r}`;t.push(`${n} var ${i} = try ${e.zigType}.init(allocator);`);for(let[o,s]of Object.entries(e.props))if(s.type==="literal"){let a=typeof s.value==="string"?`"${s.value}"`:String(s.value);t.push(`${n} ${i}.set${J(o)}(${a});`)}for(let o=0;o<e.children.length;o++){let s=e.children[o];if(s.type==="text"){let a=s.props.text?.type==="literal"?String(s.props.text.value):"";t.push(`${n} try ${i}.addChild(try craft.Text.init(allocator, "${a}"));`)}else N(s,t,r+1),t.push(`${n} try ${i}.addChild(node_${r+1});`)}if(r===0)t.push(` return ${i}.element();`),t.push("}")}function E(e,t){let r=[];return r.push("// Auto-generated by stx compiler"),r.push("// Target: "+t.target),r.push(""),r.push('import { Craft } from "@stacksjs/craft";'),r.push(""),r.push("export function render(): Craft.Element {"),r.push(" return "+v(e,1)+";"),r.push("}"),r.join(`
|
|
4
4
|
`)}function v(e,t){let r=" ".repeat(t),n=[];for(let[a,l]of Object.entries(e.props))if(l.type==="literal"){let p=typeof l.value==="string"?`"${l.value}"`:String(l.value);n.push(`${a}: ${p}`)}let i=n.length>0?`{ ${n.join(", ")} }`:"{}",o=e.children.map((a)=>a.type==="text"?`"${a.props.text?.type==="literal"?a.props.text.value:""}"`:v(a,t+1)),s=o.length>0?`,
|
|
5
5
|
${r} [${o.join(`,
|
|
6
6
|
${r} `)}]`:"";return`Craft.create("${e.zigType}", ${i}${s})`}function H(e,t,r){if(t.target==="universal"){let n=[];n.push("// Universal entry point"),n.push("");for(let[i,o]of r)n.push(`// --- ${i.toUpperCase()} ---`),n.push(`#if ${i.toUpperCase()}`),n.push(o),n.push("#endif"),n.push("");return n.join(`
|
|
7
|
-
`)}return r.get(t.target)||u(e,t)}function _(e,t,r){let n=[];function i(o){n.push({name:o.zigType,hash:x(JSON.stringify(o.props)),props:Object.keys(o.props),events:Array.from(o.events.keys()),slots:[],isNative:o.zigType.startsWith("craft.")});for(let s of o.children)i(s)}return i(t),{version:"1.0.0",components:n,entry:e.id,assets:[],styles:e.styles}}function B(e,t){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}var F=0;function T(){return`id_${++F}`}function x(e){let t=0;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);t=(t<<5)-t+n,t=t&t}return Math.abs(t).toString(36)}function J(e){return e.charAt(0).toUpperCase()+e.slice(1)}function U(e){let t=[],r=/<script[^>]*>([\s\S]*?)<\/script>/gi,n;while((n=r.exec(e))!==null)t.push(n[1]);return t}function Z(e){let t=[],r=/<style[^>]*>([\s\S]*?)<\/style>/gi,n;while((n=r.exec(e))!==null)t.push(n[1]);return t}function f(e){let t=e.type==="component"?1:0;if(e.children)for(let r of e.children)t+=f(r);return t}function d(e){let t=e.zigType.startsWith("craft.")?1:0;for(let r of e.children)t+=d(r);return t}function
|
|
8
|
-
export{
|
|
7
|
+
`)}return r.get(t.target)||u(e,t)}function _(e,t,r){let n=[];function i(o){n.push({name:o.zigType,hash:x(JSON.stringify(o.props)),props:Object.keys(o.props),events:Array.from(o.events.keys()),slots:[],isNative:o.zigType.startsWith("craft.")});for(let s of o.children)i(s)}return i(t),{version:"1.0.0",components:n,entry:e.id,assets:[],styles:e.styles}}function B(e,t){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}var F=0;function T(){return`id_${++F}`}function x(e){let t=0;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);t=(t<<5)-t+n,t=t&t}return Math.abs(t).toString(36)}function J(e){return e.charAt(0).toUpperCase()+e.slice(1)}function U(e){let t=[],r=/<script[^>]*>([\s\S]*?)<\/script>/gi,n;while((n=r.exec(e))!==null)t.push(n[1]);return t}function Z(e){let t=[],r=/<style[^>]*>([\s\S]*?)<\/style>/gi,n;while((n=r.exec(e))!==null)t.push(n[1]);return t}function f(e){let t=e.type==="component"?1:0;if(e.children)for(let r of e.children)t+=f(r);return t}function d(e){let t=e.zigType.startsWith("craft.")?1:0;for(let r of e.children)t+=d(r);return t}function Fo(e){return{start:async()=>{console.log("[craft-compiler] Hot reload server started")},stop:async()=>{console.log("[craft-compiler] Hot reload server stopped")},notifyChange:(t)=>{console.log(`[craft-compiler] File changed: ${t}`)}}}var K={compileToNative:Bo,createHotReloadServer:Fo,NATIVE_COMPONENTS:Jr},Ld=K;
|
|
8
|
+
export{Jr,Bo,Fo,Ld};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Te}from"./chunk-
|
|
2
|
+
import{Te}from"./chunk-yhpyqsbr.js";import{Ne,Zt}from"./chunk-71sdgv7e.js";import{ei,ti,f,Rt,de,L,n,A,o}from"./chunk-faghmmrs.js";import{C}from"./chunk-be2ba3hj.js";import{Os}from"./chunk-eww6sdzz.js";import{wn,vn,xn,kn,me}from"./chunk-43h8q2cm.js";import{Oi}from"./chunk-jtbzmbzz.js";import{ye,oe,vo,xo,Bt}from"./chunk-4rkvwm6v.js";import{kt,ts}from"./chunk-yy3ser06.js";import{Ft}from"./chunk-xpnpg967.js";import{ht,rn,sn}from"./chunk-wg2w7zmt.js";import m from"fs";import c from"path";import{createHash as Q}from"crypto";function J(i){return Q("sha256").update(i).digest("hex").slice(0,8)}function U(i=!1){let l=i?Zt():Ne(),a=J(l);return{content:l,filename:`runtime.${a}.js`,hash:a}}function V(){let i=Te(),l=J(i);return{content:i,filename:`router.${l}.js`,hash:l}}import q from"path";import{createHash as ee}from"crypto";function te(i={}){let l=new Set;return{context:new Proxy(i,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function X(i,l,a={}){let r=q.resolve(i),e=await Bun.file(r).text(),S=ee("sha256").update(e).digest("hex").slice(0,16);ei();let _={};try{_=await o(a.configDir)}catch{}let y=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))y.push(g[2])}let u=new Set(y.flatMap((R)=>de(R))),{context:D}=te({__filename:r,__dirname:q.dirname(r),__stx_serverDeclared:u}),w=new Set,P={...A,..._,...a,buildMode:"compile",strict:!1},b=await n(e,D,r,P,w),T=ye(b),B=ti();return{route:l,sourceFile:i,html:b,fragment:T,placeholders:B,hasServerScripts:y.length>0,serverScriptContent:y,dependencies:Array.from(w),contentHash:S,status:Rt(e),streamTemplates:D.__streamTemplates}}var re=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function Z(i,l){let a=0,r=0;if(!m.existsSync(i))return{copied:a,bytes:r};m.mkdirSync(l,{recursive:!0});function e(S,_){let y=m.readdirSync(S,{withFileTypes:!0});for(let d of y){if(re.has(d.name))continue;let g=c.join(S,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(g,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(g,u),a++,r+=m.statSync(u).size}}}return e(i,l),{copied:a,bytes:r}}async function yl(i={}){let l=Date.now(),a=c.resolve(i.root||process.cwd()),r=c.resolve(a,i.outputDir||".output");console.log("[stx build] Starting production build...");let e=await o(a),S=c.resolve(a,i.componentsDir??e.componentsDir??"components"),_=c.resolve(a,i.partialsDir??e.partialsDir??"partials"),y=c.resolve(a,i.layoutsDir??e.layoutsDir??"layouts"),d=i.publicDir??e.publicDir??"public",g=me(e.app?.head,{known:kn,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",w=i.routeRules??e.routeRules??{},P=Ft(w),b=i.serverApi??e.serverApi,T=typeof b==="object"?b:{};if(b)kt(a,T);if(e.runtimeConfig)C(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let B=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of B)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=L(a,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],M=R.filter((s)=>!Y.some((h)=>s.pattern.startsWith(`/${h}/`)||s.pattern===`/${h}`));console.log(`[stx build] Found ${M.length} page routes (${R.length-M.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=U(i.debug),x=V();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",x.filename),x.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${x.filename} (${(x.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let O=[],E=[];for(let s of M){let h=P(s.pattern),k=h.rendering==="prerender";if(k&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await X(s.filePath,s.pattern,{configDir:a,componentsDir:S,partialsDir:_,layoutsDir:y,debug:i.debug});if(O.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,x.filename),t.html=xn(t.html,g,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=wn(t.html,u);if(g.htmlAttrs)t.html=vn(t.html,g.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let W=p[1];t.html=t.html.replace(" "+W,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${W}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await f(t.html),k){let p=await Bt(t,{params:{},request:new Request(`http://stx.build${s.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${s.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=oe(t.html,D);let z=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),G=c.join("server","pages",`${z}.compiled.json`),I=c.join("server","fragments",`${z}.html`);await Bun.write(c.join(r,G),JSON.stringify(t,null,2)),await Bun.write(c.join(r,I),t.fragment),E.push({pattern:s.pattern,compiledPath:G,fragmentPath:I,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:k}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(h).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let H=c.resolve(a,d);if(m.existsSync(H)){let{copied:s,bytes:h}=Z(H,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${d}/`)}let F=sn(a);if(F){let{copied:s,bytes:h}=Z(F,c.join(r,"public",rn));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${ht}/`)}let N={runtime:v.filename,router:x.filename},j=vo(E,N,r);if(j.routeRules=w,j.routerContainer=D,b)j.apiRoutes=await ts(a,r,T);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await Os(a,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(Oi(e._layerGraph),null,2));xo(j,r);let K=Date.now()-l;return console.log(`
|
|
3
3
|
[stx build] Done in ${K}ms \u2014 ${O.length} pages compiled`),{pageCount:O.length,assets:N,outputDir:r,duration:K}}
|
|
4
|
-
export{
|
|
4
|
+
export{yl};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
function
|
|
2
|
+
function _o(e){return e}class a{plugins=new Map;sortedPlugins=[];initialized=!1;async register(e,t){if(this.plugins.has(e.name))throw Error(`Plugin "${e.name}" is already registered`);if(e.dependencies){for(let r of e.dependencies)if(!this.plugins.has(r))throw Error(`Plugin "${e.name}" depends on "${r}" which is not registered`)}if(this.plugins.set(e.name,e),e.onRegister)await e.onRegister(t);this.sortPlugins()}async unregister(e){let t=this.plugins.get(e);if(!t)return!1;for(let[r,i]of this.plugins)if(i.dependencies?.includes(e))throw Error(`Cannot unregister "${e}" because "${r}" depends on it`);if(t.onUnregister)await t.onUnregister();return this.plugins.delete(e),this.sortPlugins(),!0}get(e){return this.plugins.get(e)}has(e){return this.plugins.has(e)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let e=[];for(let t of this.sortedPlugins)if(t.registerDirectives)e.push(...t.registerDirectives());return e}getAllFilters(){let e={};for(let t of this.sortedPlugins)if(t.registerFilters)Object.assign(e,t.registerFilters());return e}async runBeforeProcess(e){return this.runHooks("beforeProcess",e)}async runAfterParse(e){return this.runHooks("afterParse",e)}async runBeforeDirective(e,t){return this.runDirectiveHooks("beforeDirective",e,t)}async runAfterDirective(e,t){return this.runDirectiveHooks("afterDirective",e,t)}async runBeforeRender(e){return this.runHooks("beforeRender",e)}async runAfterRender(e){return this.runHooks("afterRender",e)}async runOnError(e){for(let t of this.sortedPlugins)if(t.onError)try{let r=await t.onError(e);if(r){if(r.template!==void 0)e.template=r.template;if(r.context)e.context={...e.context,...r.context};if(r.metadata)e.metadata={...e.metadata,...r.metadata};if(r.skip)return e}}catch(r){console.error(`Error in plugin "${t.name}" onError hook:`,r)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort((e,t)=>(e.priority??100)-(t.priority??100))}async runHooks(e,t){let r={...t};for(let i of this.sortedPlugins){let s=i[e];if(s)try{let n=await s(r);if(n){if(n.template!==void 0)r.template=n.template;if(n.context)r.context={...r.context,...n.context};if(n.metadata)r.metadata={...r.metadata,...n.metadata};if(n.skip)break}}catch(n){console.error(`Error in plugin "${i.name}" ${e} hook:`,n)}}return r}async runDirectiveHooks(e,t,r){let i={...r};for(let s of this.sortedPlugins){let n=s[e];if(n)try{let o=await n(t,i);if(o){if(o.template!==void 0)i.template=o.template;if(o.context)i.context={...i.context,...o.context};if(o.metadata)i.metadata={...i.metadata,...o.metadata};if(o.skip)break}}catch(o){console.error(`Error in plugin "${s.name}" ${e} hook:`,o)}}return i}}var Al=new a;var u=_o({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess(e){console.log("[stx-debug] beforeProcess:",e.filePath)},afterParse(e){console.log("[stx-debug] afterParse:",e.template.length,"chars")},beforeDirective(e,t){console.log("[stx-debug] beforeDirective:",e)},afterDirective(e,t){console.log("[stx-debug] afterDirective:",e)},beforeRender(e){console.log("[stx-debug] beforeRender")},afterRender(e){console.log("[stx-debug] afterRender:",e.template.length,"chars")},onError(e){console.error("[stx-debug] onError:",e.error.message,"in phase:",e.phase)}}),l=_o({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess(e){e.metadata.startTime=performance.now()},afterRender(e){let t=e.metadata.startTime;if(t){let r=performance.now()-t;console.log(`[stx-timing] Processing took ${r.toFixed(2)}ms`)}}});export{_o,Al};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Gi,Ki,Xi}from"./chunk-zk2xk0wd.js";import{W,Qt,en,qr,Gr,zn,tn,nn,Kr,Hn}from"./chunk-c0s3k64c.js";function X(e,a,i,o,u){let y=!0,s=new Set,h=(l)=>o.get?o.get(l):l,r=()=>h(e());return Object.defineProperty(r,"_isSignal",{value:!0}),Object.defineProperty(r,"modifiers",{get:a}),r.set=(l)=>{if(!y)return;let m=a(),d=o.set?o.set(l,m):l;if(m.trim&&typeof d==="string")d=d.trim();if(m.number&&typeof d==="string"&&d!==""){let n=Number(d);if(!Number.isNaN(n))d=n}if(Object.is(e(),d))return;e.set(d),i(d)},r.update=(l)=>r.set(l(r())),r.input=(l)=>{if(!a().lazy)r.set(l)},r.change=(l)=>{if(a().lazy)r.set(l)},r.subscribe=(l)=>{if(!y)return()=>{};let m=e.subscribe((d,n)=>l(h(d),h(n)));return s.add(m),()=>{m(),s.delete(m)}},Object.defineProperty(r,"value",{get:r,set:r.set}),u(()=>{y=!1,s.forEach((l)=>l()),s.clear()}),r}function Q(e,a=!0,i){if(!a||!e||typeof window>"u")return;let o=window;if(!o.__STX_DATA__){let y=document.querySelector("script[data-stx-server-data]");try{let s=JSON.parse(y?.textContent||"{}");o.__STX_DATA__=s&&typeof s==="object"&&!Array.isArray(s)?s:{}}catch{o.__STX_DATA__={}}}let u=o.__STX_DATA__;if(u&&Object.prototype.hasOwnProperty.call(u,e))try{return{data:i?i(u[e]):u[e]}}catch(y){return{data:null,error:y instanceof Error?y:Error(String(y))}}return}function Y(e){if(typeof window>"u")return;let a=window;if(e===void 0)a.__STX_DATA__={};else{if(!a.__STX_DATA__)try{let i=JSON.parse(document.querySelector("script[data-stx-server-data]")?.textContent||"{}");a.__STX_DATA__=i&&typeof i==="object"&&!Array.isArray(i)?i:{}}catch{a.__STX_DATA__={}}if(a.__STX_DATA__)delete a.__STX_DATA__[e]}}function J(e){let a=null;try{a=typeof indexedDB<"u"?indexedDB:null}catch{a=null}if(!a)return null;let i=a,o=e||"stx-kept",u=null,y=()=>{if(!u)u=new Promise((h,r)=>{let l=i.open(o,1);l.onupgradeneeded=()=>{l.result.createObjectStore("kv")},l.onsuccess=()=>h(l.result),l.onerror=()=>r(l.error),l.onblocked=()=>r(Error("blocked"))}),u.catch(()=>{u=null});return u},s=(h,r)=>y().then((l)=>new Promise((m,d)=>{let n=l.transaction("kv",h),p=r(n.objectStore("kv"));n.oncomplete=()=>m(p?p.result:void 0),n.onerror=()=>d(n.error),n.onabort=()=>d(n.error)}));return{get:(h)=>s("readonly",(r)=>r.get(h)),set:(h,r)=>s("readwrite",(l)=>{l.put(r,h)}),remove:(h)=>s("readwrite",(r)=>{r.delete(h)}),removePrefix:(h)=>s("readwrite",(r)=>{r.delete(IDBKeyRange.bound(h,`${h}\uFFFF`))})}}function Z(e,a){let i=e||{},o=null;if(i.storage!==void 0)o=i.storage;else try{o=typeof localStorage<"u"?localStorage:null}catch{o=null}let u=null,y=i.backend!==void 0;if(y)u=i.backend||null;let s=()=>{if(y)return u;y=!0;try{u=a?a():null}catch{u=null}if(u){let t=u;t.get("__stx_probe__").catch(()=>{if(u===t)u=null})}return u},h=i.limit||32768,r=i.defer||((t)=>{let c=typeof requestIdleCallback==="function"?requestIdleCallback:null;if(c)c(t,{timeout:200});else setTimeout(t,16)}),l=new Map,m=new Set,d=new Map,n=!1,p=Promise.resolve(),v=(t)=>{try{return JSON.parse(t)}catch{return t}},f=(t,c)=>{if(!o)return!1;try{return o.setItem(t,c),!0}catch{return!1}},E=(t)=>{try{if(o)o.removeItem(t)}catch{}},S=()=>{if(n=!1,!d.size)return p;let t=Array.from(d.entries());return d.clear(),p=p.then(()=>Promise.all(t.map(([c,g])=>{if(!u){m.delete(c);try{f(c,JSON.stringify(g===void 0?null:g))}catch{}return}let _;try{return _={v:g},u.set(c,_).catch(()=>{let x;try{x=JSON.stringify(g)}catch{return}return u?u.set(c,{j:x}).catch(()=>{f(c,x)}):void 0})}catch{return}}))).then(()=>{}),p},N=(t,c)=>{if(d.set(t,c),m.add(t),n)return;n=!0,r(()=>{S()})},D=(t)=>{if(!t||typeof t!=="object")return;let c=t;if("v"in c)return{value:c.v};if(typeof c.j==="string")return{value:v(c.j)};return},k={peek(t){if(l.has(t))return{value:l.get(t)};let c=null;try{c=o?o.getItem(t):null}catch{c=null}if(c===null||c===void 0)return;let g=v(c);return l.set(t,g),{value:g}},load(t){let c=k.peek(t),g=c?null:s();if(c||!g)return Promise.resolve(c);return g.get(t).then((_)=>{if(l.has(t))return{value:l.get(t)};let x=D(_);if(x)l.set(t,x.value),m.add(t);return x},()=>{return})},set(t,c){if(l.set(t,c),u&&m.has(t)){N(t,c);return}let g;try{g=JSON.stringify(c===void 0?null:c)}catch{return}if(g.length<=h&&f(t,g))return;if(!s()){if(g.length>h)f(t,g);return}E(t),N(t,c)},forget(t){for(let g of Array.from(l.keys()))if(g.indexOf(t)===0)l.delete(g);for(let g of Array.from(d.keys()))if(g.indexOf(t)===0)d.delete(g);for(let g of Array.from(m))if(g.indexOf(t)===0)m.delete(g);try{if(o)for(let g=o.length-1;g>=0;g--){let _=o.key(g);if(_&&_.indexOf(t)===0)o.removeItem(_)}}catch{}let c=s();if(!c)return p;return p=p.then(()=>c.removePrefix(t)).catch(()=>{}),p},flush(){return S()}};try{if(typeof document<"u"&&document.addEventListener)document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden")S()});if(typeof addEventListener==="function")addEventListener("pagehide",()=>{S()})}catch{}return k}function ee(e,a){if(!e)return!1;if(e===a.key)return!0;if(!a.url)return!1;if(e===a.url)return!0;try{let i=typeof location<"u"&&location.origin&&location.origin!=="null"?location.origin:"http://localhost",o=new URL(e,i),u=new URL(a.url,i);if(o.origin!==u.origin||o.pathname!==u.pathname)return!1;return!o.search||o.search===u.search}catch{return!1}}function te(e){let a=e.prefix||"stx:kept:",i=e.matches||((n,p)=>n===p.key||n===p.url),o=new Set,u=new Map,y,s=(n)=>n===void 0?y:n,h=(n,p)=>{let v=s(p);if(v===!1||v===null||v==="")return null;return`${a}${v===void 0?"":`${v}:`}query:${n}`},r=(n)=>{let p=n&&n.value;if(!p||typeof p!=="object"||!("d"in p))return;return{data:p.d,at:Number(p.at)||0}},l=()=>{let n=globalThis;return n.__stx_outboxes instanceof Map?n.__stx_outboxes:null},m={setScope(n){y=n},scope:()=>y,keyFor:h,seed(n,p){let v=h(n,p);return v?r(e.kept.peek(v)):void 0},restore(n,p){let v=h(n,p);return v?e.kept.load(v).then(r):Promise.resolve(void 0)},persist(n,p,v){let f=h(n,v);if(f)e.kept.set(f,{d:p,at:Date.now()})},overlay(n,p,v){let f=l();if(!f||!f.size)return p;let E=p;return f.forEach((S)=>{try{E=S.overlay(n,E,v)}catch{}}),E},watch(n){return o.add(n),()=>{o.delete(n)}},cachedQuery(n,p){let v=u.get(n);if(v){if(p&&v.__options)v.__options(p);return v}let f=p||{},E=f.initial===void 0?null:f.initial,S=()=>typeof f.scope==="function"?f.scope():f.scope,N=()=>(typeof f.url==="function"?f.url():f.url)||null,D=()=>({key:n,url:N()}),k=S(),t=E,c=0,g=e.sharedRequest(),_=0,x=m.seed(n,k);if(x)t=x.data;let I=e.state(m.overlay(D(),t)),U=e.state(!1),q=e.state(!1),K=e.state(null),P=e.state(x?x.at:0),R=0,F=()=>{I.set(m.overlay(D(),t))},z=(b)=>{let w=R;m.restore(n,b).then((T)=>{if(!T||w!==R||c)return;t=T.data,P.set(T.at),F()})};if(!x)z(k);let wt=()=>{let b=S();if(b===k)return;k=b,R++,_=0,q.set(!1),U.set(!1),c=0;let w=m.seed(n,k);if(t=w?w.data:E,P.set(w?w.at:0),F(),!w)z(k)},_t=(b,w)=>{let T=f.timeoutMs||15000,C=typeof AbortController<"u"?new AbortController:null,O=null,j=new Promise((M,V)=>{O=setTimeout(()=>{if(C)C.abort();V(Error("The request took too long."))},T)}),A;if(f.load)A=f.load({force:b,url:w,signal:C?C.signal:void 0});else if(w){let M=f.fetch||((L,H)=>fetch(L,H)),V={method:"GET",headers:{Accept:"application/json"}};if(b)V.cache="no-cache";if(C)V.signal=C.signal;A=M(w,V).then((L)=>{if(!L.ok)return L.json().catch(()=>null).then((H)=>{throw Error(H&&(H.error||H.message)||`Request failed (${L.status})`)});return L.json()})}else return Promise.resolve(I());return Promise.race([A,j]).then((M)=>{if(O)clearTimeout(O);return f.transform?f.transform(M):M},(M)=>{if(O)clearTimeout(O);throw M})},G=(b)=>{let w=R,T=N(),C=()=>{if(w!==R)return Promise.resolve(I());if(_++,q.set(!0),c===0&&!P())U.set(!0);let j=()=>{if(w!==R)return;if(_=Math.max(0,_-1),!_)q.set(!1),U.set(!1)};return _t(b,T).then((A)=>{if(w!==R||T!==N())return j(),I();return t=A,c=Date.now(),P.set(c),K.set(null),m.persist(n,A,k),F(),j(),I()},(A)=>{if(w===R&&T===N())K.set(A&&A.message?A.message:"Could not load.");return j(),I()})},O=`${w} ${T||""}`;return b?g.fresh(O,C):g.run(O,C)},B={data:I,loading:U,isFetching:q,error:K,updatedAt:P,get key(){return n},load(b){if(wt(),!b&&c&&Date.now()-c<(f.staleTime||0))return Promise.resolve(I());return G(!!b)},refresh(){return B.load(!0)},set(b){t=typeof b==="function"?b(t):b,m.persist(n,t,k),F()},invalidate(){c=0},__options(b){f={...f,...b}}};if(o.add({target:D,updated:()=>{if(c||P())G(!1)},outbox:(b)=>{if(b)t=m.overlay(D(),t,b.id),c=0,G(!0);F()}}),u.set(n,B),f.immediate)B.load();return B}},d=typeof window<"u"?window:typeof addEventListener==="function"?globalThis:null;if(e.listen!==!1&&d&&typeof d.addEventListener==="function")d.addEventListener("stx:updated",(n)=>{let p=n.detail||{};if(p.kind!=="api"||typeof p.url!=="string")return;o.forEach((v)=>{if(i(p.url,v.target()))v.updated()})}),d.addEventListener("stx:outbox",(n)=>{let p=n.detail||{},v=p.sent&&typeof p.sent.id==="string"?p.sent:null;o.forEach((f)=>{if(v){let E=Array.isArray(v.affects)?v.affects:[],S=f.target();if(!E.some((N)=>i(N,S)))return}f.outbox(v)})});return m}function ne(e){let a=e&&e.covers||((s,h)=>Object.is(s,h)),i=[],o=[],u=0,y=(s,h)=>{let r;try{r=Promise.resolve(h())}catch(d){r=Promise.reject(d)}let l={key:s,promise:r};i.push(l);let m=()=>{let d=i.indexOf(l);if(d!==-1)i.splice(d,1)};return r.then(m,m),r};return{run(s,h){for(let r of i)if(a(r.key,s))return r.promise;for(let r of o)if(a(r.key,s))return r.promise;return y(s,h)},fresh(s,h){for(let d of o)if(a(d.key,s))return d.promise;let r=i.filter((d)=>a(d.key,s)).map((d)=>d.promise);if(!r.length)return y(s,h);let l={key:s,promise:null},m=()=>{};return l.promise=Promise.all(r.map((d)=>d.then(m,m))).then(()=>{let d=o.indexOf(l);if(d!==-1)o.splice(d,1);return y(s,h)}),o.push(l),l.promise},latest(){let s=++u;return()=>s===u},get busy(){return i.length>0||o.length>0}}}var re=` function useColorMode(options) {
|
|
3
3
|
options = options || {};
|
|
4
4
|
// The pre-paint boot script (stacksjs/stx#1794) publishes the app's
|
|
5
5
|
// configured options here. Reading them makes a bare useColorMode() agree
|
|
@@ -10101,7 +10101,7 @@ else if (timer === null) {
|
|
|
10101
10101
|
subscribe: subscribe
|
|
10102
10102
|
};
|
|
10103
10103
|
}
|
|
10104
|
-
`;function Ne(){let e=xt(
|
|
10104
|
+
`;function Ne(){let e=xt(Zt());try{let i=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(e);return i=i.replace(/\}(var |let |const |function )/g,"};$1"),i}catch{return e}}function xt(e){let a=[],i=0,o="console.log(";while(i<e.length){let u=e.indexOf(o,i);if(u===-1){a.push(e.slice(i));break}a.push(e.slice(i,u));let y=1,s=u+o.length;while(s<e.length&&y>0){let h=e[s];if(h==='"'||h==="'"||h==="`"){let r=h;s++;while(s<e.length&&e[s]!==r){if(e[s]==="\\")s++;s++}s++;continue}if(h==="(")y++;else if(h===")")y--;s++}a.push("0"),i=s}return a.join("")}function Zt(){return`${ae}${Me}
|
|
10105
10105
|
${Je(ie,Se,Ee)}
|
|
10106
10106
|
|
|
10107
10107
|
${Oe}
|
|
@@ -10128,7 +10128,7 @@ ${se}
|
|
|
10128
10128
|
${de}
|
|
10129
10129
|
${fe}
|
|
10130
10130
|
${Ke}
|
|
10131
|
-
${tt(
|
|
10131
|
+
${tt(Ki(),Xi(),Gi())}
|
|
10132
10132
|
|
|
10133
10133
|
${ft}
|
|
10134
10134
|
${it}
|
|
@@ -10179,5 +10179,5 @@ ${lt}
|
|
|
10179
10179
|
${ct}
|
|
10180
10180
|
${at}
|
|
10181
10181
|
})();
|
|
10182
|
-
`}var
|
|
10183
|
-
export{Ne,
|
|
10182
|
+
`}var gd={state:W,derived:Qt,effect:en,batch:qr,onMount:Gr,onDestroy:zn,isSignal:tn,isDerived:nn,untrack:Kr,peek:Hn,generateSignalsRuntime:Ne,generateSignalsRuntimeDev:Zt};
|
|
10183
|
+
export{Ne,Zt,gd};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{M}from"./chunk-
|
|
2
|
+
import{M}from"./chunk-5db5sxy3.js";var t={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603};function L(e){for(let[r,n]of Object.entries(t))if(n===e)return r;return}import le from"path";var ue={showRelativePaths:!1,enableAutoRecovery:M(),logRecoveryWarnings:!0},A={...ue};function k(){return{...A}}function _(e){if(!A.showRelativePaths||!e)return e;let r=A.baseDir||process.cwd();try{let n=le.relative(r,e);return n.startsWith("..")?e:n}catch{return e}}class R extends Error{code;filePath;line;column;context;numericCode;constructor(e,r,n,o,s,a,g){super(e);this.code=r;this.filePath=n;this.line=o;this.column=s;this.context=a;if(this.name="StxError",this.numericCode=g||t.EVALUATION_ERROR,this.filePath)this.filePath=_(this.filePath)}}class Y extends R{constructor(e,r,n,o,s,a){super(e,"stx_RUNTIME_ERROR",r,n,o,s,a||t.EVALUATION_ERROR);this.name="StxRuntimeError"}}class Cn extends R{constructor(e,r,n,o,s,a){super(e,"stx_FILE_ERROR",r,n,o,s,a||t.FILE_NOT_FOUND);this.name="StxFileError"}}class fr extends R{isFatal=!0;constructor(e,r,n,o,s,a){super(e,"stx_VALIDATION_ERROR",r,n,o,s,a||t.DOM_API_VIOLATION);this.name="StxValidationError"}}function G(e){let{type:r,message:n,code:o,filePath:s,line:a,column:g,template:u,offset:h,snippet:m,suggestion:d,format:f="text"}=e,E=a,x=g;if(!E&&u&&h!==void 0){let V=he(u,h);E=V.line,x=V.column}let w=s?_(s):void 0,y=o?L(o):void 0,S={type:r,code:o,codeName:y,message:n,filePath:w,line:E,column:x,snippet:m,suggestion:d,timestamp:new Date().toISOString()},v;switch(f){case"html":v=fe(S);break;case"json":v=JSON.stringify(S,null,2);break;case"console":v=me(S,u,h);break;case"text":default:v=ge(S,u,h);break}return{formatted:v,data:S}}function ge(e,r,n){let o=[],s=e.code?` [${e.codeName||e.code}]`:"";if(o.push(`[${e.type} Error${s}]`),e.filePath){let a=e.filePath;if(e.line){if(a+=`:${e.line}`,e.column)a+=`:${e.column}`}o.push(`at ${a}`)}if(o.push(`
|
|
3
3
|
${e.message}`),r&&e.line){let a=pe(r,e.line,2);if(a)o.push(`
|
|
4
4
|
${a}`)}if(e.snippet)o.push(`
|
|
5
5
|
Snippet: ${e.snippet}`);if(e.suggestion)o.push(`
|
|
@@ -17,15 +17,15 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
|
|
|
17
17
|
`)}function de(e,r,n){let o=e.split(`
|
|
18
18
|
`),s=Math.max(0,r-n-1),a=Math.min(o.length-1,r+n-1),g="\x1B[90m",u="\x1B[31m",h="\x1B[0m",m=[];for(let d=s;d<=a;d++){let f=(d+1).toString().padStart(4),E=d===r-1,x=E?"\x1B[31m>\x1B[0m":" ",w=E?`\x1B[31m${o[d]}\x1B[0m`:`\x1B[90m${o[d]}\x1B[0m`;m.push(`${x}\x1B[90m${f}\x1B[0m | ${w}`)}return m.join(`
|
|
19
19
|
`)}function X(e){return e.replace(/--/g,"- -").replace(/>/g,">")}function he(e,r){let o=e.substring(0,r).split(`
|
|
20
|
-
`);return{line:o.length,column:o[o.length-1].length}}function i(e,r,n){return G({type:e,message:r,code:n,format:"html"}).formatted}async function re(e,r,n){try{return await e()}catch(o){if(n&&o instanceof Error)n(o);return r}}var
|
|
20
|
+
`);return{line:o.length,column:o[o.length-1].length}}function i(e,r,n){return G({type:e,message:r,code:n,format:"html"}).formatted}async function re(e,r,n){try{return await e()}catch(o){if(n&&o instanceof Error)n(o);return r}}var Us={isEnabled(){return k().enableAutoRecovery},fixCommonSyntaxErrors(e){let r=k();if(!r.enableAutoRecovery)return{fixed:e,fixes:[]};let n=e,o=[],s=(n.match(/\{\{/g)||[]).length,a=(n.match(/\}\}/g)||[]).length;if(s>a){let u=s-a;n+="}}".repeat(u),o.push(`Added ${u} missing closing braces '}}'`)}let g=["if","foreach","for","switch","section"];for(let u of g){let h=(n.match(new RegExp(`@${u}\\b`,"g"))||[]).length,m=(n.match(new RegExp(`@end${u}\\b`,"g"))||[]).length;if(h>m){let d=h-m;for(let f=0;f<d;f++)n+=`
|
|
21
21
|
@end${u}`;o.push(`Added ${d} missing @end${u}`)}}if(o.length>0&&r.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),o.forEach((u)=>console.warn(` - ${u}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:n,fixes:o}},createFallbackContent(e,r){if(M())return`<!-- ${e} failed: ${r.message} -->`;return"<!-- stx rendering error -->"}};class P{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor(e={}){this.maxErrors=e.maxErrors??1000,this.enableFileLogging=e.enableFileLogging??!1,this.logFilePath=e.logFilePath??".stx/errors.log",this.logFormat=e.logFormat??"json",this.maxFileSize=e.maxFileSize??10485760,this.maxLogFiles=e.maxLogFiles??5,this.minLevel=e.minLevel??"all"}configure(e){if(e.maxErrors!==void 0)this.maxErrors=e.maxErrors;if(e.enableFileLogging!==void 0)this.enableFileLogging=e.enableFileLogging;if(e.logFilePath!==void 0)this.logFilePath=e.logFilePath;if(e.logFormat!==void 0)this.logFormat=e.logFormat;if(e.maxFileSize!==void 0)this.maxFileSize=e.maxFileSize;if(e.maxLogFiles!==void 0)this.maxLogFiles=e.maxLogFiles;if(e.minLevel!==void 0)this.minLevel=e.minLevel}log(e,r,n="error"){let o={timestamp:new Date,error:e,context:r,level:n};if(this.errors.push(o),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(n))this.writeToFile(o)}shouldLog(e){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return e==="error"||e==="warning";if(this.minLevel==="error")return e==="error";return!0}formatEntry(e){if(this.logFormat==="json")return JSON.stringify({timestamp:e.timestamp.toISOString(),level:e.level||"error",type:e.error.constructor.name,message:e.error.message,stack:e.error.stack,context:e.context});let r=[`[${e.timestamp.toISOString()}] [${(e.level||"error").toUpperCase()}] ${e.error.constructor.name}: ${e.error.message}`];if(e.error.stack)r.push(` Stack: ${e.error.stack.split(`
|
|
22
22
|
`).slice(1).join(`
|
|
23
23
|
`)}`);if(e.context)r.push(` Context: ${JSON.stringify(e.context)}`);return r.join(`
|
|
24
24
|
`)}writeToFile(e){this.writeQueue=this.writeQueue.then(async()=>{try{let r=await import("fs"),n=await import("path"),o=n.dirname(this.logFilePath);if(!r.existsSync(o))r.mkdirSync(o,{recursive:!0});await this.rotateIfNeeded(r);let s=`${this.formatEntry(e)}
|
|
25
25
|
`;r.appendFileSync(this.logFilePath,s,"utf-8")}catch(r){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",r)}})}async rotateIfNeeded(e){try{if(!e.existsSync(this.logFilePath))return;if(e.statSync(this.logFilePath).size<this.maxFileSize)return;for(let n=this.maxLogFiles-1;n>=1;n--){let o=`${this.logFilePath}.${n}`,s=`${this.logFilePath}.${n+1}`;if(e.existsSync(o))if(n>=this.maxLogFiles-1)e.unlinkSync(o);else e.renameSync(o,s)}if(this.maxLogFiles<=1)e.writeFileSync(this.logFilePath,"");else e.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch(r){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",r)}}getRecentErrors(e=10){return this.errors.slice(-e)}getErrorsByType(e){return this.errors.filter((r)=>r.error.constructor.name===e)}getErrorsByLevel(e){return this.errors.filter((r)=>r.level===e)}clear(){this.errors.length=0}async clearLogFile(){try{let e=await import("fs");if(e.existsSync(this.logFilePath))e.writeFileSync(this.logFilePath,"","utf-8")}catch(e){if(process.env.STX_DEBUG==="true")console.error("Failed to clear error log:",e)}}getStats(){let e={},r={error:0,warning:0,info:0};for(let n of this.errors){let o=n.error.constructor.name;e[o]=(e[o]||0)+1;let s=n.level||"error";r[s]=(r[s]||0)+1}return{total:this.errors.length,byType:e,byLevel:r}}async exportToFile(e,r="json"){let n=await import("fs"),o=await import("path"),s=o.dirname(e);if(!n.existsSync(s))n.mkdirSync(s,{recursive:!0});if(r==="json"){let a=this.errors.map((g)=>({timestamp:g.timestamp.toISOString(),level:g.level||"error",type:g.error.constructor.name,message:g.error.message,stack:g.error.stack,context:g.context}));n.writeFileSync(e,JSON.stringify(a,null,2),"utf-8")}else{let a=this.errors.map((g)=>this.formatEntry(g));n.writeFileSync(e,a.join(`
|
|
26
26
|
|
|
27
|
-
`),"utf-8")}}async flush(){await this.writeQueue}}var I=new P,
|
|
28
|
-
`)}};var Ee={maxSanitizeDepth:10,allowBracketNotation:!1},K={...Ee};var O=/\bnew\s+/,F="__stx_safe_ctors",ee=["Bun","Deno","Buffer","fetch","atob","btoa","console","Response","Request","Headers","WebAssembly","structuredClone","queueMicrotask","crypto","performance","navigator","Worker","WebSocket","BroadcastChannel","EventSource","XMLHttpRequest","localStorage","sessionStorage"],N=[...ee,"Function","setTimeout","setInterval","setImmediate","process","require","exports","module","window","document","global","globalThis","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry"],H=N.map(()=>{return}),T=Object.freeze(Object.assign(Object.create(null),{keys:Object.keys,values:Object.values,entries:Object.entries,fromEntries:Object.fromEntries,assign:Object.assign,hasOwn:Object.hasOwn,is:Object.is})),j=[/\b(eval|Function|setTimeout|setInterval|setImmediate)\b/,/\b(process|require|import|exports|module)\b/,/\b(window|document|global|globalThis)\b/,/\b(constructor|prototype|__proto__)\b/,/\b(Reflect|Proxy)\b/,/\bSymbol\b/,/\b(WeakMap|WeakSet|WeakRef|FinalizationRegistry)\b/,/\b(Generator|AsyncGenerator)\b/,/__\w+__/,/\.(bind|call|apply)\s*\(/,O,/\bdelete\s+/,/\bthis\b/,/\\u(?:\{[\dA-Fa-f]+\}|[\dA-Fa-f]{4})/],U=new Set([...ee,"eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this",F]),B=new Set(["__proto__","constructor","prototype"]);function te(e){let r="",n=[],o=null,s=!1;for(let a=0;a<e.length;a++){let g=e[a];if(s){s=!1;continue}if(g==="\\"&&o){s=!0;continue}if(o){if(o==="`"&&g==="$"&&a+1<e.length&&e[a+1]==="{"){let u=1;a+=2;while(a<e.length&&u>0){if(e[a]==="{")u++;else if(e[a]==="}")u--;if(u>0)r+=e[a],n.push(a),a++}continue}if(g===o)o=null;continue}if(g==='"'||g==="'"||g==="`"){o=g;continue}r+=g,n.push(a)}return{text:r,map:n}}function ne(e){return te(e).text}var oe=["Collator","DateTimeFormat","DisplayNames","ListFormat","Locale","NumberFormat","PluralRules","RelativeTimeFormat","Segmenter"],se=(()=>{let e={Date,URL,URLSearchParams},r=Intl;for(let n of oe)if(typeof r[n]==="function")e[`Intl_${n}`]=r[n];return Object.freeze(Object.assign(Object.create(null),e))})(),xe=/^new(\s+)(Date|URLSearchParams|URL|Intl\s*\.\s*([A-Z_a-z]\w*))\s*\(/,q=/(?<![\w$])new(?![\w$])/g,J=`only new Date(), new URL(), new URLSearchParams() and new Intl.{${oe.join(",")}}() are allowed`;function be(e){let{text:r,map:n}=te(e),o=[];q.lastIndex=0;let s;while((s=q.exec(r))!==null){let g=s.index;if(/(?<!\.)\.\s*$/.test(r.slice(0,g)))continue;let u=xe.exec(r.slice(g)),h=u?.[3],m=!u?null:h?`Intl_${h}`:u[2];if(!u||!m||!(m in se))throw new b(`matched /${O.source}/; ${J}`,e);let d=g+u[0].length,f=n[g],E=n[d-1]+1;if(e.slice(f,E)!==r.slice(g,d))throw new b(`matched /${O.source}/; ${J}`,e);let x=f+3+u[1].length;o.push({start:x,end:x+u[2].length,key:m})}let a=e;for(let g=o.length-1;g>=0;g--){let u=o[g];a=`${a.slice(0,u.start)}${F}.${u.key}${a.slice(u.end)}`}return{source:a,usesSafeConstructors:o.length>0}}class b extends Error{rule;expression;constructor(e,r,n){super(n??`Potentially unsafe expression (${e}): ${r}`);this.name="UnsafeExpressionError",this.rule=e,this.expression=r}}function
|
|
27
|
+
`),"utf-8")}}async flush(){await this.writeQueue}}var I=new P,Dt={isDevelopment(){return M()},logDetailedError(e,r){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",e.message),console.error("Stack:",e.stack),r)console.error("Context:",r);console.error("========================")},createErrorReport(e,r){let n=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${e.message}`,`Type: ${e.constructor.name}`,`Stack: ${e.stack}`];if(r)n.push(`Context: ${JSON.stringify(r,null,2)}`);return n.push("========================"),n.join(`
|
|
28
|
+
`)}};var Ee={maxSanitizeDepth:10,allowBracketNotation:!1},K={...Ee};var O=/\bnew\s+/,F="__stx_safe_ctors",ee=["Bun","Deno","Buffer","fetch","atob","btoa","console","Response","Request","Headers","WebAssembly","structuredClone","queueMicrotask","crypto","performance","navigator","Worker","WebSocket","BroadcastChannel","EventSource","XMLHttpRequest","localStorage","sessionStorage"],N=[...ee,"Function","setTimeout","setInterval","setImmediate","process","require","exports","module","window","document","global","globalThis","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry"],H=N.map(()=>{return}),T=Object.freeze(Object.assign(Object.create(null),{keys:Object.keys,values:Object.values,entries:Object.entries,fromEntries:Object.fromEntries,assign:Object.assign,hasOwn:Object.hasOwn,is:Object.is})),j=[/\b(eval|Function|setTimeout|setInterval|setImmediate)\b/,/\b(process|require|import|exports|module)\b/,/\b(window|document|global|globalThis)\b/,/\b(constructor|prototype|__proto__)\b/,/\b(Reflect|Proxy)\b/,/\bSymbol\b/,/\b(WeakMap|WeakSet|WeakRef|FinalizationRegistry)\b/,/\b(Generator|AsyncGenerator)\b/,/__\w+__/,/\.(bind|call|apply)\s*\(/,O,/\bdelete\s+/,/\bthis\b/,/\\u(?:\{[\dA-Fa-f]+\}|[\dA-Fa-f]{4})/],U=new Set([...ee,"eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this",F]),B=new Set(["__proto__","constructor","prototype"]);function te(e){let r="",n=[],o=null,s=!1;for(let a=0;a<e.length;a++){let g=e[a];if(s){s=!1;continue}if(g==="\\"&&o){s=!0;continue}if(o){if(o==="`"&&g==="$"&&a+1<e.length&&e[a+1]==="{"){let u=1;a+=2;while(a<e.length&&u>0){if(e[a]==="{")u++;else if(e[a]==="}")u--;if(u>0)r+=e[a],n.push(a),a++}continue}if(g===o)o=null;continue}if(g==='"'||g==="'"||g==="`"){o=g;continue}r+=g,n.push(a)}return{text:r,map:n}}function ne(e){return te(e).text}var oe=["Collator","DateTimeFormat","DisplayNames","ListFormat","Locale","NumberFormat","PluralRules","RelativeTimeFormat","Segmenter"],se=(()=>{let e={Date,URL,URLSearchParams},r=Intl;for(let n of oe)if(typeof r[n]==="function")e[`Intl_${n}`]=r[n];return Object.freeze(Object.assign(Object.create(null),e))})(),xe=/^new(\s+)(Date|URLSearchParams|URL|Intl\s*\.\s*([A-Z_a-z]\w*))\s*\(/,q=/(?<![\w$])new(?![\w$])/g,J=`only new Date(), new URL(), new URLSearchParams() and new Intl.{${oe.join(",")}}() are allowed`;function be(e){let{text:r,map:n}=te(e),o=[];q.lastIndex=0;let s;while((s=q.exec(r))!==null){let g=s.index;if(/(?<!\.)\.\s*$/.test(r.slice(0,g)))continue;let u=xe.exec(r.slice(g)),h=u?.[3],m=!u?null:h?`Intl_${h}`:u[2];if(!u||!m||!(m in se))throw new b(`matched /${O.source}/; ${J}`,e);let d=g+u[0].length,f=n[g],E=n[d-1]+1;if(e.slice(f,E)!==r.slice(g,d))throw new b(`matched /${O.source}/; ${J}`,e);let x=f+3+u[1].length;o.push({start:x,end:x+u[2].length,key:m})}let a=e;for(let g=o.length-1;g>=0;g--){let u=o[g];a=`${a.slice(0,u.start)}${F}.${u.key}${a.slice(u.end)}`}return{source:a,usesSafeConstructors:o.length>0}}class b extends Error{rule;expression;constructor(e,r,n){super(n??`Potentially unsafe expression (${e}): ${r}`);this.name="UnsafeExpressionError",this.rule=e,this.expression=r}}function _n(e){try{return W(e),null}catch(r){return r instanceof b?r.rule:r instanceof Error?r.message:String(r)}}function ie(e,r){let n=/[$A-Z_a-z][$\w]*/g,o;while((o=n.exec(e))!==null){let s=o[0],a=e[o.index-1];if(U.has(s))throw new b(`matched /\\b${s}\\b/; identifier ${s}`,r);if(a==="."&&B.has(s))throw new b(`matched /.${s}/; property ${s}`,r)}}function ae(e,r=!0){let n=/(?:[$\w)\].]|\?\.)\s*\[([^\]]*)\]/g,o=new Set,s;while((s=n.exec(e))!==null){let a=s.index+s[0].indexOf("["),g=e.slice(0,a);if(/(?:^|[^$\w])(?:let|const|var)\s*$/.test(g))continue;let u=s[1].trim(),h=/^'(?:[^'\\]|\\.)*'$/.test(u),m=/^"(?:[^"\\]|\\.)*"$/.test(u);if(/^\d+$/.test(u))continue;if(h||m){let f=u.slice(1,-1);if(B.has(f))throw new b(`bracket key ${f}`,e);if(!K.allowBracketNotation)throw new b("bracket notation with a string key; enable with configureSafeEvaluator({ allowBracketNotation: true })",e,`Bracket notation with strings not allowed: ${e}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);continue}if(r&&/^[$A-Z_a-z][$\w]*$/.test(u)){o.add(u);continue}throw new b("dynamic bracket notation is not allowed",e)}return[...o]}function W(e){let r=e.trim(),n=ne(r);ie(n,r);let o=ae(r);for(let s of j){if(s===O)continue;if(s.test(n))throw new b(`matched /${s.source}/`,r)}return{...be(r),dynamicKeys:o}}function Vs(e){return W(e),e.trim()}function gr(e){let r={};r.Math=Math,r.JSON=JSON,r.Date=Date,r.String=String,r.Number=Number,r.Boolean=Boolean,r.Array=Array,r.Object=T,r.parseInt=Number.parseInt,r.parseFloat=Number.parseFloat,r.isNaN=Number.isNaN,r.isFinite=Number.isFinite,r.encodeURIComponent=encodeURIComponent,r.decodeURIComponent=decodeURIComponent;for(let[n,o]of Object.entries(e)){if(n.startsWith("__")||j.some((s)=>s.test(n)))continue;if(o&&typeof o==="object"&&!Array.isArray(o))r[n]=z(o);else r[n]=o}return r}function z(e,r=0){if(r>=K.maxSanitizeDepth)return"[Object too deep]";if(e===null||typeof e!=="object")return e;if(Array.isArray(e))return e.map((o)=>z(o,r+1));if(e instanceof Date||e instanceof RegExp||e instanceof Map||e instanceof Set||e instanceof Error)return e;let n={};for(let[o,s]of Object.entries(e)){if(o.startsWith("__")||o==="constructor"||o==="prototype")continue;if(s&&typeof s==="object")n[o]=z(s,r+1);else n[o]=s}return n}function l(e,r){try{let n=gr(r),o=Object.keys(n),s=Object.values(n);return c(e,o)(...s)}catch{return}}function p(e){try{return Vs(e),!0}catch{return!1}}function zi(e,r){try{let n=gr(r),o=Object.keys(n),s=Object.values(n),a=!1,u=c(e,o,()=>{a=!0})(...s);return!a&&Boolean(u)}catch{return!1}}function D(e,r){try{let n=l(e,r);if(n&&typeof n==="object"&&!Array.isArray(n))return n;return{}}catch{return{}}}var ce=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","implements","interface","package","private","protected","public","arguments","eval","await"]),ye=2000,C=new Map;function Q(e,r){let n=`${e.join(",")}\x00${r}`,o=C.get(n);if(o)return o;let s=Function(...e,r);if(C.size>=ye)C.clear();return C.set(n,s),s}function _e(e){return e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:)/g,"$1$2").match(/\b[a-zA-Z_$][\w$]*\b/g)||[]}var we=/^[A-Za-z_$][\w$]*$/;function tt(e){return we.test(e)&&!ce.has(e)}function c(e,r,n){let{source:o,usesSafeConstructors:s,dynamicKeys:a}=W(e),g=[];for(let f=0;f<r.length;f++){if(!tt(r[f]))continue;if(r[f]===F||r[f]==="Object"||U.has(r[f]))continue;g.push({key:r[f],index:f})}g.sort((f,E)=>f.key.localeCompare(E.key));let u=g.map((f)=>f.key),h=g.map((f)=>f.index),m=`
|
|
29
29
|
'use strict';
|
|
30
30
|
try {
|
|
31
31
|
return ${o};
|
|
@@ -36,5 +36,5 @@ catch (e) {
|
|
|
36
36
|
}
|
|
37
37
|
throw e;
|
|
38
38
|
}
|
|
39
|
-
`;return Se(ve(s?(f)=>{let E=Q([F,"Object",...N,...u,...f],m);return(...x)=>E(se,T,...H,...x)}:(f)=>{let E=Q(["Object",...N,...u,...f],m);return(...x)=>E(T,...H,...x)},u,r,g,h,n),r,a)}function Se(e,r,n){if(n.length===0)return e;let o=n.map((s)=>r.indexOf(s));return(...s)=>{for(let a of o){if(a<0)continue;let g=s[a];if(typeof g==="string"&&B.has(g))return}return e(...s)}}function ve(e,r,n,o,s,a){let g=e([]),u=o.every((m,d)=>m.index===d);if(r.length===n.length&&u)return Z(g,r,e,void 0,a);return Z((...m)=>{let d=Array(s.length);for(let f=0;f<s.length;f++)d[f]=m[s[f]];return g(...d)},r,e,(m)=>{g=e(m)},a)}function Z(e,r,n,o,s){let g=/^(\w+) is not defined$/,u=e,h=[],m=new Set(r);return(...d)=>{for(let f=0;f<=8;f++)try{return u(...d)}catch(E){let x=E instanceof Error?E.message:"",w=g.exec(x);if(!(E instanceof ReferenceError)||!w)return;let y=w[1];if(m.has(y)||ce.has(y)||U.has(y))return;if(s?.(y),m.add(y),h.push(y),o)o(h);else u=n(h)}return}}function
|
|
40
|
-
export{t,Y,
|
|
39
|
+
`;return Se(ve(s?(f)=>{let E=Q([F,"Object",...N,...u,...f],m);return(...x)=>E(se,T,...H,...x)}:(f)=>{let E=Q(["Object",...N,...u,...f],m);return(...x)=>E(T,...H,...x)},u,r,g,h,n),r,a)}function Se(e,r,n){if(n.length===0)return e;let o=n.map((s)=>r.indexOf(s));return(...s)=>{for(let a of o){if(a<0)continue;let g=s[a];if(typeof g==="string"&&B.has(g))return}return e(...s)}}function ve(e,r,n,o,s,a){let g=e([]),u=o.every((m,d)=>m.index===d);if(r.length===n.length&&u)return Z(g,r,e,void 0,a);return Z((...m)=>{let d=Array(s.length);for(let f=0;f<s.length;f++)d[f]=m[s[f]];return g(...d)},r,e,(m)=>{g=e(m)},a)}function Z(e,r,n,o,s){let g=/^(\w+) is not defined$/,u=e,h=[],m=new Set(r);return(...d)=>{for(let f=0;f<=8;f++)try{return u(...d)}catch(E){let x=E instanceof Error?E.message:"",w=g.exec(x);if(!(E instanceof ReferenceError)||!w)return;let y=w[1];if(m.has(y)||ce.has(y)||U.has(y))return;if(s?.(y),m.add(y),h.push(y),o)o(h);else u=n(h)}return}}function mr(e){let r=e.trim();try{let n=ne(r);if(/\b(?:eval|function|import|require|process|globalthis|window|document|fetch|bun|deno|buffer|console|reflect|proxy|prototype|constructor|this)\b/i.test(n))return!1;ie(n,r),ae(r);for(let o of j)if(o.test(n))return!1}catch{return!1}return!0}
|
|
40
|
+
export{t,Y,Cn,fr,i,re,Us,I,Dt,_n,Vs,gr,l,p,zi,D,_e,tt,c,mr};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Mr,Nr,Lr,xa,Sa,ka,Eo,Ca,_a}from"./chunk-t8wpzqs4.js";export{Mr as ImageProcessorCache,Eo as applyTransformations,xa as clearImageCache,Ca as generateResponsiveVariants,_a as generateSrcset,Nr as getCachedImageResult,ka as optimizeImage,Sa as processImage,Lr as setCachedImageResult};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Oa,Da,Ma,Na,La,ja,Ba,Fa,za,Ha,Hl}from"./chunk-qccgncp2.js";export{Oa as createIslandRegistry,Hl as default,Ha as generateIslandManifest,Ma as generatePartialHydrationCSS,ja as hydrateAll,La as hydrateByStrategy,Na as hydrateIsland,Ba as isHydrated,Fa as onHydrated,Da as processPartialHydrationDirectives,za as processStaticDirectives};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import m from"path";var y=/__stxModules\["((?:[^"\\]|\\.)*)"\]/g;function I(...o){let r=new Set;for(let s of o){if(!s||!s.includes("__stxModules["))continue;for(let e of s.matchAll(y))try{r.add(JSON.parse(`"${e[1]}"`))}catch{}}return[...r].sort()}async function w(o,r={}){if(o.length===0)return null;let s=process.cwd(),e=[],a=[];o.forEach((t,c)=>{let i=t.startsWith("npm:")?t.slice(4):m.resolve(s,t),l=`__stxRegistered${c}`,p=JSON.stringify(t);e.push(`import * as ${l} from ${JSON.stringify(i)};`),a.push(`if (!globalThis.__stxModules[${p}]) globalThis.__stxModules[${p}] = ${l};`)});let d=[...e,"globalThis.__stxModules = globalThis.__stxModules || {};",...a].join(`
|
|
3
|
-
`),n;try{let{bundleClientScript:t}=await import("./chunk-
|
|
3
|
+
`),n;try{let{bundleClientScript:t}=await import("./chunk-zv288w4e.js");n=await t(d,m.join(s,".stx-module-registry.ts"),{projectRoot:s,minify:r.minify,externalizeUserModules:!1,collectInputs:r.collectInputs,throwOnFailure:!0})}catch(t){let{formatBuildFailure:c}=await import("./chunk-wgkxgsqx.js"),i=c(t);console.warn(`[stx] could not build the page module registry (#1957): ${i}`);let l=`[stx] the page module registry did not build, so ${o.join(", ")} cannot load (#1957): ${i}`;return`;console.error(${JSON.stringify(l)});`}let{transformAutoImports:f,generateAutoImportDestructuring:_}=await import("./chunk-g2fw68zm.js"),u=f(n),h=_(u.stxImports,u.browserImports),{transformStoreImports:x}=await import("./chunk-mhjwtkx9.js");n=x(u.code);let g=JSON.stringify(new Bun.CryptoHasher("md5").update(d).digest("hex").slice(0,12));return[";(function() {"," var __stxBundles = globalThis.__stxModuleBundles || (globalThis.__stxModuleBundles = {});",` if (__stxBundles[${g}]) return;`,` __stxBundles[${g}] = true;`,h,n,"})();"].join(`
|
|
4
4
|
`)}export{w as buildModuleRegistryScript,I as registeredModuleIdsIn};
|