@stacksjs/stx 0.2.858 → 0.2.859
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-m2rm2gxv.js → chunk-0es47pwe.js} +5 -5
- package/dist/{chunk-78amng8s.js → chunk-0yw86e75.js} +6 -6
- package/dist/chunk-13fe3avf.js +2 -0
- package/dist/{chunk-ff3j7jnf.js → chunk-14h4n1sj.js} +2 -2
- package/dist/{chunk-wd4z5w4d.js → chunk-1hebvmaj.js} +1 -1
- package/dist/chunk-1p47cg0g.js +2 -0
- package/dist/{chunk-xz1csyq9.js → chunk-1v95w26e.js} +10 -10
- package/dist/chunk-1z46g29d.js +2 -0
- package/dist/chunk-228cbw2p.js +2 -0
- package/dist/{chunk-w7s3afam.js → chunk-26jt4jvh.js} +1 -1
- package/dist/chunk-2bggrzv0.js +2 -0
- package/dist/chunk-2dnd2s2a.js +3 -0
- package/dist/{chunk-rq9pqd4s.js → chunk-2kc0vsnb.js} +5 -5
- package/dist/{chunk-e763qsg0.js → chunk-2sq9pdg3.js} +2 -2
- package/dist/{chunk-bhzh7mj1.js → chunk-2w7csg0c.js} +1 -1
- package/dist/{chunk-8623gte8.js → chunk-3248qphb.js} +6 -6
- package/dist/{chunk-d6am6en8.js → chunk-33x46g87.js} +1 -1
- package/dist/chunk-34rh88vd.js +2 -0
- package/dist/chunk-3cqp0m62.js +2 -0
- package/dist/chunk-3dtzcc9j.js +2 -0
- package/dist/chunk-3rgqrs3c.js +2 -0
- package/dist/{chunk-fw50vydb.js → chunk-3w3fxcyx.js} +2 -2
- package/dist/{chunk-mxazxwc4.js → chunk-403a4pqm.js} +3 -3
- package/dist/{chunk-z703xzhy.js → chunk-49j3cn9h.js} +2 -2
- package/dist/{chunk-2bks42z4.js → chunk-4a0x737h.js} +5 -5
- package/dist/{chunk-3b7q7d7j.js → chunk-4yfbd8ny.js} +6 -6
- package/dist/chunk-51kb36f7.js +2 -0
- package/dist/{chunk-4ezfen91.js → chunk-52b6czss.js} +13 -13
- package/dist/chunk-53ezn1tw.js +2 -0
- package/dist/{chunk-e8we717q.js → chunk-5n7m8vqx.js} +2 -2
- package/dist/{chunk-sny8rqe8.js → chunk-5rxks14t.js} +2 -2
- package/dist/{chunk-jgvwzt1t.js → chunk-5t1k0dxm.js} +2 -2
- package/dist/{chunk-s322kcw7.js → chunk-5va6c7jf.js} +5 -5
- package/dist/{chunk-5xy1z71a.js → chunk-618t6hxp.js} +4 -4
- package/dist/chunk-636j1nmd.js +2 -0
- package/dist/{chunk-fxk1psd8.js → chunk-6e44f8w8.js} +30 -30
- package/dist/{chunk-y67r0d0c.js → chunk-6mza6zr3.js} +4 -4
- package/dist/{chunk-e7thwrt5.js → chunk-6t0xy3wk.js} +2 -2
- package/dist/{chunk-6qbha6fb.js → chunk-6w5a5ns4.js} +6 -6
- package/dist/chunk-756rpwn0.js +2 -0
- package/dist/{chunk-0vptj943.js → chunk-7m17m22p.js} +2 -2
- package/dist/chunk-7pq02v7n.js +2 -0
- package/dist/chunk-7sht1rkv.js +2 -0
- package/dist/{chunk-ksxbfyef.js → chunk-7trdtz0c.js} +2 -2
- package/dist/{chunk-71s4hpkj.js → chunk-8mdhencj.js} +3 -3
- package/dist/{chunk-hjh5wt5f.js → chunk-9a3rv0rj.js} +3 -3
- package/dist/{chunk-0z2gqttt.js → chunk-9nh48zvm.js} +12 -12
- package/dist/{chunk-kq3h2rjq.js → chunk-9qe4qsc7.js} +4 -4
- package/dist/chunk-9rgp005c.js +2 -0
- package/dist/{chunk-ym5qgw03.js → chunk-9xr628ew.js} +2 -2
- package/dist/{chunk-k19ba3jz.js → chunk-a9c3gndq.js} +2 -2
- package/dist/{chunk-g8d24rfk.js → chunk-aq8r4rbs.js} +2 -2
- package/dist/{chunk-wskdnfh9.js → chunk-astcp7bc.js} +4 -4
- package/dist/chunk-azvx5gaa.js +2 -0
- package/dist/{chunk-jdqmk5sv.js → chunk-b1kc0ka1.js} +63 -63
- package/dist/{chunk-jafn7f7f.js → chunk-cj9rev2p.js} +2 -2
- package/dist/{chunk-27zp4q77.js → chunk-cxpq2zna.js} +1 -1
- package/dist/{chunk-gjbnzn7k.js → chunk-dbm963p9.js} +4 -4
- package/dist/chunk-ebk1723c.js +2 -0
- package/dist/chunk-emc7zqry.js +2 -0
- package/dist/chunk-eppv6knk.js +2 -0
- package/dist/{chunk-egwtv5hp.js → chunk-ews9yzr7.js} +3 -3
- package/dist/chunk-f935fec7.js +2 -0
- package/dist/{chunk-7fgfzaah.js → chunk-fkh4xece.js} +2 -2
- package/dist/{chunk-4h9kkkh7.js → chunk-fpkp0bqf.js} +1 -1
- package/dist/{chunk-8cpqcn19.js → chunk-ftwdjgzd.js} +5 -5
- package/dist/{chunk-va1hj69e.js → chunk-fxxh149b.js} +4 -4
- package/dist/chunk-g0v1shhr.js +2 -0
- package/dist/{chunk-jwwsxym6.js → chunk-g17q4y5k.js} +2 -2
- package/dist/chunk-g5pg0pg1.js +2 -0
- package/dist/chunk-g8x32bq2.js +2 -0
- package/dist/{chunk-afrqm7w5.js → chunk-g978f9qg.js} +4 -4
- package/dist/{chunk-az9b4bj4.js → chunk-gndxakrh.js} +2 -2
- package/dist/{chunk-qvwzaxdd.js → chunk-gq9h36jf.js} +4 -4
- package/dist/{chunk-tk67pqaf.js → chunk-hf9pvmq2.js} +3 -3
- package/dist/chunk-hk7vjyqa.js +2 -0
- package/dist/{chunk-bxn4b0wm.js → chunk-jd4dr23j.js} +2 -2
- package/dist/{chunk-admnvsmx.js → chunk-jh2v1vvb.js} +2 -2
- package/dist/chunk-jmaw2cdt.js +2 -0
- package/dist/chunk-jw75rmpw.js +2 -0
- package/dist/{chunk-kedgfk9z.js → chunk-k8pzk8v9.js} +4 -4
- package/dist/{chunk-cqkr291c.js → chunk-kpsxhm4x.js} +5 -5
- package/dist/{chunk-1z2am28h.js → chunk-ktnb1j54.js} +2 -2
- package/dist/{chunk-c7eew8qs.js → chunk-kvc9cwvx.js} +1 -1
- package/dist/{chunk-tjer45j7.js → chunk-m1qqqc2j.js} +4 -4
- package/dist/chunk-m3fq72f8.js +2 -0
- package/dist/chunk-n54twtm7.js +2 -0
- package/dist/chunk-np6y9evb.js +2 -0
- package/dist/chunk-p95fsnbk.js +2 -0
- package/dist/{chunk-bef0wr53.js → chunk-p9jfn4yh.js} +5 -5
- package/dist/chunk-pk0mxjxw.js +2 -0
- package/dist/{chunk-smve11g0.js → chunk-q3cyycnh.js} +1 -1
- package/dist/chunk-q9r13taa.js +2 -0
- package/dist/{chunk-mzg1wq86.js → chunk-qd87dk1d.js} +15 -15
- package/dist/{chunk-qa4vs1qg.js → chunk-qgxwf9xr.js} +3 -3
- package/dist/chunk-qqjhq0hb.js +2 -0
- package/dist/chunk-qsjkewah.js +2 -0
- package/dist/chunk-qttq8cje.js +2 -0
- package/dist/chunk-qw80eta1.js +2 -0
- package/dist/chunk-r51bfc2y.js +2 -0
- package/dist/chunk-rbrvepr3.js +2 -0
- package/dist/{chunk-3evwxrpx.js → chunk-rgjjt1mb.js} +1 -1
- package/dist/{chunk-me16tftr.js → chunk-rwxg4m3h.js} +1 -1
- package/dist/{chunk-pa8xkctc.js → chunk-s4592dy0.js} +6 -6
- package/dist/chunk-se4ny3q0.js +2 -0
- package/dist/{chunk-snmq7yn4.js → chunk-shke1fcm.js} +3 -3
- package/dist/chunk-sxvv9w8t.js +2 -0
- package/dist/chunk-sy703233.js +2 -0
- package/dist/chunk-syzn6mq5.js +2 -0
- package/dist/{chunk-6d74qdc6.js → chunk-t2nhr2tc.js} +1 -1
- package/dist/{chunk-jwtp4csj.js → chunk-tc31my2p.js} +4 -4
- package/dist/{chunk-zn9dp7yn.js → chunk-ts4t2n6b.js} +5 -5
- package/dist/chunk-v3r1wwec.js +2 -0
- package/dist/{chunk-fd7e162p.js → chunk-v4rrgphj.js} +3 -3
- package/dist/{chunk-252enthj.js → chunk-v9h7s8ce.js} +1 -1
- package/dist/chunk-vd5d1yb9.js +2 -0
- package/dist/{chunk-nv5xhfwz.js → chunk-vj1bwnvs.js} +2 -2
- package/dist/chunk-vmdsj8r5.js +2 -0
- package/dist/chunk-vmg3f76h.js +2 -0
- package/dist/{chunk-fbnykfnv.js → chunk-w1d8t47c.js} +3 -3
- package/dist/{chunk-jtag68hg.js → chunk-w1stsxm3.js} +2 -2
- package/dist/chunk-w63c96ce.js +2 -0
- package/dist/chunk-wcgca1q6.js +2 -0
- package/dist/{chunk-gz0j98dy.js → chunk-wdcz6d20.js} +4 -4
- package/dist/{chunk-1347hwt5.js → chunk-wfd9e224.js} +40 -40
- package/dist/{chunk-qv52et0d.js → chunk-wjamjgx6.js} +2 -2
- package/dist/chunk-wv8qmwqp.js +2 -0
- package/dist/chunk-x90f7h2g.js +2 -0
- package/dist/{chunk-tpw435g0.js → chunk-x9c4njvx.js} +2 -2
- package/dist/chunk-xhnpgey5.js +2 -0
- package/dist/{chunk-69zj9q02.js → chunk-xpg52hsz.js} +3 -3
- package/dist/{chunk-eazccp6e.js → chunk-xytq7q8j.js} +2 -2
- package/dist/chunk-y54pj23g.js +2 -0
- package/dist/{chunk-mh45hcsa.js → chunk-yd6ej23e.js} +6 -6
- package/dist/{chunk-xhvw0t0f.js → chunk-yehdcjn1.js} +3 -3
- package/dist/chunk-yhrkqcqd.js +2 -0
- package/dist/chunk-ykxpzjgy.js +2 -0
- package/dist/{chunk-3zjyhhg4.js → chunk-ypgegzh2.js} +2 -2
- package/dist/{chunk-q93jcdgj.js → chunk-ywk6t76q.js} +12 -12
- package/dist/chunk-zhyrhxdp.js +2 -0
- package/dist/chunk-zn5tewws.js +2 -0
- package/dist/chunk-zvra3bmk.js +2 -0
- package/dist/cli.js +19 -19
- package/dist/config.js +11 -1
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +4 -4
- package/package.json +5 -5
- package/dist/chunk-0ts3p84y.js +0 -2
- package/dist/chunk-139mxsyc.js +0 -2
- package/dist/chunk-1barsha6.js +0 -2
- package/dist/chunk-1fnx7ze9.js +0 -2
- package/dist/chunk-1g06wfs9.js +0 -2
- package/dist/chunk-1nasq00e.js +0 -2
- package/dist/chunk-2102tvxh.js +0 -2
- package/dist/chunk-39cwa35j.js +0 -2
- package/dist/chunk-3rcegvgg.js +0 -2
- package/dist/chunk-3wvq28hz.js +0 -2
- package/dist/chunk-6m4v1tsq.js +0 -2
- package/dist/chunk-75e4wzzs.js +0 -3
- package/dist/chunk-7ambc4f7.js +0 -2
- package/dist/chunk-8nmc3rh7.js +0 -2
- package/dist/chunk-8pn7ah12.js +0 -2
- package/dist/chunk-8zwwmnpb.js +0 -2
- package/dist/chunk-98bgx3ws.js +0 -2
- package/dist/chunk-a4v8z93r.js +0 -2
- package/dist/chunk-a58w524e.js +0 -2
- package/dist/chunk-a6v6x2pg.js +0 -2
- package/dist/chunk-b62mr2kz.js +0 -2
- package/dist/chunk-b7vxb2y6.js +0 -2
- package/dist/chunk-bb20hnqd.js +0 -2
- package/dist/chunk-bc3sknxf.js +0 -2
- package/dist/chunk-cbrbrkp1.js +0 -2
- package/dist/chunk-d8djpp7f.js +0 -2
- package/dist/chunk-dk6t4h48.js +0 -2
- package/dist/chunk-dkbm7117.js +0 -2
- package/dist/chunk-e44bse67.js +0 -2
- package/dist/chunk-ewnfgczq.js +0 -2
- package/dist/chunk-f1v5hvbt.js +0 -2
- package/dist/chunk-g6epqcb3.js +0 -2
- package/dist/chunk-gmvypdm8.js +0 -2
- package/dist/chunk-hmgry6dn.js +0 -2
- package/dist/chunk-jbv1srnh.js +0 -2
- package/dist/chunk-jzynkjfc.js +0 -2
- package/dist/chunk-k1qajhpx.js +0 -2
- package/dist/chunk-m28j4ym7.js +0 -2
- package/dist/chunk-mzembfxk.js +0 -2
- package/dist/chunk-ngzjwp2e.js +0 -2
- package/dist/chunk-nj9n0en9.js +0 -2
- package/dist/chunk-nyasqjnt.js +0 -2
- package/dist/chunk-pn0rmd8d.js +0 -2
- package/dist/chunk-pvx1hrqq.js +0 -2
- package/dist/chunk-q78dsejp.js +0 -2
- package/dist/chunk-qw1f97s7.js +0 -2
- package/dist/chunk-rcn0yyh2.js +0 -2
- package/dist/chunk-t9h3e3bp.js +0 -2
- package/dist/chunk-ts9bvjzh.js +0 -2
- package/dist/chunk-tzvgjrp4.js +0 -2
- package/dist/chunk-v8b1wz1b.js +0 -2
- package/dist/chunk-w9aa8xte.js +0 -2
- package/dist/chunk-wegkgjmf.js +0 -2
- package/dist/chunk-wn065q3f.js +0 -2
- package/dist/chunk-y2dtqrrz.js +0 -2
- package/dist/chunk-yss7n9db.js +0 -2
- package/dist/chunk-z6p0yxwd.js +0 -2
- package/dist/chunk-zcpwc47w.js +0 -2
- package/dist/chunk-zsmrq1w3.js +0 -2
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
function o(t,i){let n=t[i],e=i+1;while(e<t.length){if(t[e]==="\\"){e+=2;continue}if(t[e]===n)return e+1;e++}return t.length}function b(t,i){let n=i+1;while(n<t.length){if(t[n]==="\\"){n+=2;continue}if(t[n]==="`")return n+1;if(t[n]==="$"&&t[n+1]==="{"){if(n=
|
|
2
|
+
function o(t,i){let n=t[i],e=i+1;while(e<t.length){if(t[e]==="\\"){e+=2;continue}if(t[e]===n)return e+1;e++}return t.length}function b(t,i){let n=i+1;while(n<t.length){if(t[n]==="\\"){n+=2;continue}if(t[n]==="`")return n+1;if(t[n]==="$"&&t[n+1]==="{"){if(n=dl(t,n+2),n<t.length)n++;continue}n++}return t.length}function dl(t,i){let n=1,e=i,s="{",f="";while(e<t.length){let l=t[e];if(l==="\\"){e+=2;continue}if(l==='"'||l==="'"){e=o(t,e),s=h,f="";continue}if(l==="`"){e=b(t,e),s=h,f="";continue}if(l==="/"&&t[e+1]==="/"){while(e<t.length&&t[e]!==`
|
|
3
3
|
`)e++;continue}if(l==="/"&&t[e+1]==="*"){e+=2;while(e<t.length&&t.slice(e,e+2)!=="*/")e++;e+=2;continue}if(l==="/"&&a(s,f)){let u=w(t,e);if(u!==-1){e=u,s=h,f="";continue}}if(l==="{")n++;else if(l==="}"){if(n--,n===0)return e}if(/[\w$]/.test(l))f=/[\w$]/.test(s)?f+l:l,s=l;else if(!/\s/.test(l))s=l,f="";e++}return t.length}var m=new Set(["return","typeof","instanceof","in","of","new","delete","void","throw","case","do","else","yield","await"]);function a(t,i){if(i)return m.has(i);return!(t===")"||t==="]"||t===h)}var h="\x00";function w(t,i){let n=i+1,e=!1;while(n<t.length){let s=t[n];if(s===`
|
|
4
4
|
`)return-1;if(s==="\\"){n+=2;continue}if(s==="[")e=!0;else if(s==="]")e=!1;else if(s==="/"&&!e){n++;while(n<t.length&&/[a-z]/i.test(t[n]))n++;return n}n++}return-1}function r(t){let i="",n=0,e="",s="";while(n<t.length){let f=t.slice(n,n+2);if(f==="//"){while(n<t.length&&t[n]!==`
|
|
5
5
|
`)i+=" ",n++;continue}if(f==="/*"){while(n<t.length&&t.slice(n,n+2)!=="*/")i+=t[n]===`
|
|
6
6
|
`?`
|
|
7
7
|
`:" ",n++;i+=" ",n+=2;continue}let l=t[n];if(l==='"'||l==="'"){let u=l;i+=" ",n++;while(n<t.length&&t[n]!==u){if(t[n]==="\\"){i+=" ",n+=2;continue}i+=t[n]===`
|
|
8
8
|
`?`
|
|
9
|
-
`:" ",n++}i+=" ",n++,e=h,s="";continue}if(l==="/"&&a(e,s)){let u=w(t,n);if(u!==-1){i+=`/${" ".repeat(u-n-2)}/`,n=u,e=h,s="";continue}}if(l==="`"){i+=" ",n++;while(n<t.length&&t[n]!=="`"){if(t[n]==="\\"){i+=" ",n+=2;continue}if(t[n]==="$"&&t[n+1]==="{"){let u=n+2,g=
|
|
9
|
+
`:" ",n++}i+=" ",n++,e=h,s="";continue}if(l==="/"&&a(e,s)){let u=w(t,n);if(u!==-1){i+=`/${" ".repeat(u-n-2)}/`,n=u,e=h,s="";continue}}if(l==="`"){i+=" ",n++;while(n<t.length&&t[n]!=="`"){if(t[n]==="\\"){i+=" ",n+=2;continue}if(t[n]==="$"&&t[n+1]==="{"){let u=n+2,g=dl(t,u);if(i+=" ",i+=r(t.slice(u,g)),g<t.length)i+=" ";n=g+1;continue}i+=t[n]===`
|
|
10
10
|
`?`
|
|
11
11
|
`:" ",n++}i+=" ",n++,e=h,s="";continue}if(i+=l,n++,/[\w$]/.test(l))s=/[\w$]/.test(e)?s+l:l,e=l;else if(!/\s/.test(l))e=l,s=""}return i}function he(t){let i=new Uint16Array(t.length),n=0,e=!0;for(let s=0;s<t.length;s++){let f=t[s];if(f===")"||f==="]"||f==="}")if(n===0)e=!1;else n--;if(i[s]=n,f==="("||f==="["||f==="{")n++}return{depths:i,balanced:e&&n===0}}
|
|
12
|
-
export{
|
|
12
|
+
export{dl,r,he};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Yl,$m,Zl,Ql,Rm,Am}from"./chunk-jd4dr23j.js";import"./chunk-b1kc0ka1.js";import"./chunk-wjamjgx6.js";import"./chunk-5rxks14t.js";import"./chunk-9nh48zvm.js";import"./chunk-xppm4cs4.js";import"./chunk-fkh4xece.js";export{Am as applySlots,Rm as extractSlotContent,$m as parseSlotElement,Yl as parseSlots,Ql as processSlots,Zl as renderSlot};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{wn,dg,pg,fg,gg,mg,g,hg,xi,yg,tl,nl}from"./chunk-b1kc0ka1.js";import"./chunk-wjamjgx6.js";import"./chunk-5rxks14t.js";import"./chunk-9nh48zvm.js";import"./chunk-xppm4cs4.js";import"./chunk-fkh4xece.js";export{wn as STX_ENGINE_BINDING_NAMES,xi as convertToCommonJS,tl as extractScriptFromTemplate,g as extractVariables,nl as hasVariables,hg as isCompleteImport,mg as isMissingBindingFailure,fg as isModuleResolutionFailure,gg as isSyntaxFailure,yg as splitDeclaration,dg as stripTypeScript,pg as withoutStxReferrer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{te,ne,re,jn,ye,Re,Yr,
|
|
2
|
+
import{te,ne,re,jn,ye,Re,Yr,eu,yt,Zt,Bn,Fn,zn,se,Hn,Vn,Zr}from"./chunk-x9c4njvx.js";import"./chunk-ypgegzh2.js";export{ne as DEFAULT_FORMATS,re as DEFAULT_QUALITY,te as DEFAULT_WIDTHS,Zr as ImageProcessingError,Vn as formatSize,Zt as generateSizes,yt as generateSrcSet,Bn as getFallbackVariant,Yr as getImageMetadata,se as getMimeType,Hn as getTotalSize,Fn as groupVariantsByFormat,ye as isImageBackendAvailable,zn as isImageFile,jn as isSharpAvailable,Re as processImage,eu as resizeAndConvert};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{sr,Ae}from"./chunk-mzes9ds7.js";import{V,w,Sr,Fs,C}from"./chunk-jdqmk5sv.js";import{a,O}from"./chunk-1347hwt5.js";import{Lo}from"./chunk-qvwzaxdd.js";import{st}from"./chunk-9n8t7v78.js";import{c}from"./chunk-ksxbfyef.js";import{r,he}from"./chunk-snmq7yn4.js";import d from"path";import j from"fs";import{AsyncLocalStorage as at}from"async_hooks";import{randomUUID as bt}from"crypto";var $t=11;function X(t,e,n){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(d.basename(t))||Lo(t,e,n)}var lt=2;function Rf(t){let e=process.env.STX_BUNDLE_CACHE_DIR?.trim();return e?d.resolve(e):c(t,"bundle-cache")}function nt(t,e){let n=t;for(let i of wt(e))if(i!==d.sep)n=n.split(i).join("\x00root");return n}var rt=new Map;function wt(t){let e=d.resolve(t),n=rt.get(e);if(!n){let i=e;try{i=j.realpathSync(e)}catch{}n=[...new Set([e,i])].sort((l,p)=>p.length-l.length),rt.set(e,n)}return n}function St(t,e){try{let n=j.statSync(t),i=d.resolve(e),l=t.startsWith(`${i}${d.sep}`);return{path:l?d.relative(i,t):t,...l?{inRoot:!0}:{},mtimeMs:n.mtimeMs,size:n.size,hash:Bun.hash(j.readFileSync(t)).toString(36)}}catch{return null}}function ct(t,e){return t.inRoot?d.join(d.resolve(e),t.path):t.path}function vt(t,e){for(let n of t){let i=ct(n,e);try{let l=j.statSync(i);if(l.size!==n.size)return!1;if(l.mtimeMs!==n.mtimeMs&&Bun.hash(j.readFileSync(i)).toString(36)!==n.hash)return!1}catch{return!1}}return!0}var ut=new Map,Bt=100;function Af(t=process.env){let e=Number(t.STX_BUNDLE_CACHE_LIMIT);return Number.isFinite(e)&&e>=1?Math.floor(e):2000}var H=new Map;async function jt(t){let e=H.get(t)??0;if(e>0&&e<Bt){H.set(t,e+1);return}H.set(t,1);try{let n=(await j.promises.readdir(t)).filter((o)=>o.endsWith(".js")),i=Af();if(n.length<=i)return;let p=(await Promise.all(n.map(async(o)=>{try{return{name:o,at:(await j.promises.stat(d.join(t,o))).mtimeMs}}catch{return null}}))).filter((o)=>o!==null);p.sort((o,b)=>b.at-o.at);for(let o of p.slice(i)){let b=o.name.slice(0,-3);await j.promises.rm(d.join(t,`${b}.js`),{force:!0}),await j.promises.rm(d.join(t,`${b}.deps.json`),{force:!0})}A("pruned bundle cache to",i,"entries")}catch{}}function be(t){return ut.get(t)??[]}function Z(t,e){if(t)ut.set(t,e)}function Pf(t=process.env){return t.STX_DEBUG==="true"||t.STX_DEBUG==="1"}function A(...t){if(Pf())console.log("[stx:bundler]",...t)}var K=[];function ac(t,e,n){K.push({filePath:t||"<inline>",message:e,details:n})}function sn(){return K.slice()}function on(){K.length=0}var Q;function Mh(t){Q=t}function cc(){if(Q)return Q;try{let t=O.strict;return typeof t==="object"&&t!==null?t.bundlerFallback??"warn":"warn"}catch{return"warn"}}var Y=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function an(t){let e=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,n;while((n=e.exec(t))!==null){let l=n[1];if(!Y.some((o)=>o.test(l)))return A("detected user import:",l),!0}let i=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((n=i.exec(t))!==null){let l=n[1];if(/\.css(?:\?.*)?$/.test(l))continue;if(!Y.some((o)=>o.test(l)))return A("detected side-effect import:",l),!0}return!1}var rr="stx-module:",Et=/\.(?:[cm]?[jt]sx?|json)$/i;function If(t,e){return d.relative(t,e).split(d.sep).join("/")}function Of(t,e){if(e.size===0)return t;return t.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(n,i,l,p)=>{let o=e.get(p);return o&&!p.startsWith(rr)?`${i}${l}${o}${l}`:n})}function Nf(t,e){let n=0,i=(p)=>{let o=`__stxMod${n++}`,b=JSON.stringify(p);return e.push(`var ${o} = globalThis.__stxModules && globalThis.__stxModules[${b}];`,`if (${o} === undefined) throw new Error("[stx] module " + ${JSON.stringify(b)} + " is not registered on this page (#1957)");`),o},l=(p,o)=>{for(let b of p.split(",")){let I=b.trim();if(!I)continue;let M=I.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!M)continue;let S=M[1].startsWith('"')?JSON.parse(M[1]):M[1],f=M[2]??S;e.push(`var ${f} = ${o}[${JSON.stringify(S)}];`)}};return t=t.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,o,b)=>{let I=b.slice(rr.length),M=i(I),S=o.trim(),f=S.match(/^([\w$]+)\s*(?:,\s*|$)/);if(f&&!S.startsWith("{")&&!S.startsWith("*"))e.push(`var ${f[1]} = ${M}.default;`),S=S.slice(f[0].length).trim();let v=S.match(/^\*\s*as\s+([\w$]+)$/);if(v)e.push(`var ${v[1]} = ${M};`);else if(S.startsWith("{"))l(S.replace(/^\{|\}$/g,""),M);return""}),t=t.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,o)=>(i(o.slice(rr.length)),"")),t}function it(t){let e=[t,`${t}.ts`,`${t}.tsx`,`${t}.js`,`${t}.mjs`,`${t}.jsx`,d.join(t,"index.ts"),d.join(t,"index.tsx"),d.join(t,"index.js"),d.join(t,"index.mjs")];for(let n of e)try{if(j.existsSync(n)&&j.statSync(n,{throwIfNoEntry:!1})?.isFile())return n}catch{}return}var G=new at;function cs(t,e){let n=new Bun.CryptoHasher("md5");for(let[i,l]of[...t].sort(([p],[o])=>p<o?-1:p>o?1:0))n.update(`${i}\x00${l}\x00`);return G.run({modules:t,key:n.digest("hex").slice(0,12)},e)}var dt=new at;function Mf(t){return dt.run(!0,t)}function Df(){return dt.getStore()===!0}function lc(t){if(!Df())return;throw Error(`The client script of ${t} needs bundling, and it is being rendered inside a Bun.build loader, where Bun never finishes a second build. Make the page an entrypoint of the build (bun-plugin-stx renders entrypoints before the bundler starts), or render it once outside the build so its bundle is cached.`)}function cn(){return G.getStore()?.key??""}function pt(t,e,n,i,l,p,o=new Map,b,I,M){let S=new Map([[n,i],...M??[]]),f=(B)=>B!==void 0&&S.has(B),v=(B,s,u)=>{if(X(s,t,b))return null;if(!p||!f(B)||!Et.test(s))return null;try{if(!j.statSync(s,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}l.add(s);let E=`${rr}${If(process.cwd(),s)}`;return o.set(u,E),{path:E,external:!0}},y=(B,s)=>{let u=f(B)?e:d.dirname(B),E=d.resolve(u,s);return it(E)??E};return{name:"stx-client-bundle",setup(B){if(B.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(s)=>({path:s.path,external:!0})),B.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(s)=>({path:s.path,external:!0})),B.onResolve({filter:/^\//},(s)=>{if(f(s.path))return{path:s.path};let u=it(s.path);if(u){let E=v(s.importer,u,s.path);if(E)return E;if(!f(u))l.add(u);return{path:u}}return{path:s.path,external:!0}}),B.onResolve({filter:/^\.\.?\//},(s)=>{let u=y(s.importer,s.path),E=v(s.importer,u,s.path);if(E)return E;return l.add(u),{path:u}}),B.onResolve({filter:/^[@~]\//},(s)=>{let u=d.resolve(t,s.path.slice(2)),E=[u,`${u}.ts`,`${u}.tsx`,`${u}.js`,`${u}.mjs`,`${u}.jsx`,d.join(u,"index.ts"),d.join(u,"index.tsx"),d.join(u,"index.js"),d.join(u,"index.mjs")];for(let h of E)if(j.existsSync(h)&&j.statSync(h,{throwIfNoEntry:!1})?.isFile()){let D=v(s.importer,h,s.path);if(D)return D;return A(`resolved ${s.path[0]}/ import:`,s.path,"\u2192",h),l.add(h),{path:h}}return console.warn(`[stx:bundler] could not resolve ${s.path[0]}/ import:`,s.path),{path:u}}),p)B.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(s)=>{if(!f(s.importer))return;let u=`${rr}npm:${s.path}`;return o.set(s.path,u),{path:u,external:!0}});B.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(s)=>{if(S.has(s.path))return{contents:S.get(s.path),loader:"ts"};if(X(s.path,t,b))throw Error(`Server-only API source cannot be imported by a client script: ${s.path}`);let u=d.extname(s.path).toLowerCase(),E=u===".json"?"json":u===".tsx"?"tsx":u===".jsx"?"jsx":u===".ts"||u===".mts"||u===".cts"?"ts":"js";if(!f(s.path))l.add(s.path);let h=I?.get(s.path);if(h!==void 0)return{contents:h,loader:"js"};return{contents:j.readFileSync(s.path,"utf8"),loader:E}})}}}var q=new Map,z=w(64),ot=Symbol.for("stx.client-bundle-build-queue");function Lf(t){let e=globalThis,i=(e[ot]??Promise.resolve()).then(t,t);return e[ot]=i.then(()=>{return},()=>{return}),i}async function ln(t,e,n={}){let i=n.projectRoot||process.cwd(),l=(await a(i)).serverApi,p=n.minify??!1,o=n.externalizeUserModules??!0,b=n.expose?.length?[...new Set(n.expose)].sort():void 0,I=n.cacheDir||Rf(i),M=G.getStore(),S=new Bun.CryptoHasher("md5");S.update(`${$t}\x00${st()}\x00${JSON.stringify(l??!1)}\x00${o?"registry":"inline"}\x00${b?b.join(","):"*"}\x00${p?"minified":"readable"}\x00${M?.key??""}\x00${nt(t,i)}\x00${nt(e,i)}`);let f=S.digest("hex").slice(0,12),v=d.join(I,`${f}.js`),y=z.get(v);if(y){if(Fs(y.files)&&y.files.every((h)=>!X(h.path,i,l))){A("memo hit:",f);let h=y.files.map((D)=>D.path);return Z(e,h),n.collectInputs?.push(...h),y.code}z.delete(v),A("memo invalidated by dep change:",f)}let B=d.join(I,`${f}.deps.json`),s=Bun.file(v);if(await s.exists()){let h=Bun.file(B),D=!1,N=null;if(await h.exists())try{let k=JSON.parse(await h.text());if(k.metadataVersion===lt&&Array.isArray(k.files)&&vt(k.files,i))N=Sr(k.files.map((g)=>ct(g,i))),D=N.length===k.files.length&&!N.some((g)=>X(g.path,i,l))}catch{D=!1}if(D){if(A("cache hit:",f),N)Z(e,N.map((U)=>U.path)),n.collectInputs?.push(...N.map((U)=>U.path));let k=await s.text(),g=new Date;if(j.promises.utimes(v,g,g).catch(()=>{}),N)z.set(v,{code:k,files:N});return k}A("cache invalidated by dep change:",f)}let u=q.get(f);if(u){let h=await u;if(n.collectInputs)n.collectInputs.push(...(z.get(v)?.files??[]).map((D)=>D.path));return h}lc(e);let E=Lf(()=>_t(t,e,{projectRoot:i,minify:p,cacheDir:I,hash:f,cachePath:v,depsPath:B,collectInputs:n.collectInputs,externalizeUserModules:o,serverApi:l,expose:b,throwOnFailure:n.throwOnFailure,substitutes:M?.modules}));q.set(f,E);try{return await E}finally{q.delete(f)}}function uc(t){return`${t}-${process.pid}-${bt()}`}async function Dh(t,e){let{projectRoot:n}=e,i=uc(new Bun.CryptoHasher("md5").update([...t.keys()].join("\x00")).digest("hex").slice(0,12)),l=d.join(c(n,"bundle-tmp"),"out",i);j.mkdirSync(l,{recursive:!0});let p=new Map,o=new Map,b=0;for(let[f,v]of t){let y=d.join(n,`.stx-split-${i}-${b++}.ts`);p.set(y,v),o.set(d.basename(y).replace(/\.ts$/,""),f)}let[I,M]=[...p][0],S=new Set;lc(e.filePath);try{let f=await Bun.build({entrypoints:[...p.keys()],outdir:l,target:"browser",format:"esm",splitting:!0,minify:!1,naming:{entry:"[name].js",chunk:"chunk-[hash].js"},plugins:[pt(n,d.dirname(e.filePath),I,M,S,!1,new Map,void 0,G.getStore()?.modules,p)],define:{"process.env.NODE_ENV":'"development"',...C()},root:n});if(!f.success)throw Error(f.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ")||"Unable to bundle the entries");let v={entries:new Map,chunks:new Map};for(let y of f.outputs){let B=d.basename(y.path);if(y.kind==="entry-point"){let s=o.get(B.replace(/\.js$/,""));if(s!==void 0)v.entries.set(s,await y.text())}else if(y.kind==="chunk")v.chunks.set(B.replace(/\.js$/,""),await y.text())}return e.collectInputs?.push(...S),v}finally{try{j.rmSync(l,{recursive:!0,force:!0})}catch{}}}async function _t(t,e,n){let{projectRoot:i,minify:l,cacheDir:p,hash:o,cachePath:b,depsPath:I,externalizeUserModules:M}=n,S=c(i,"bundle-tmp"),f=uc(o),v=d.join(i,`.stx-client-${f}.ts`),y=d.join(S,"out",f);j.mkdirSync(y,{recursive:!0});let B=d.dirname(e),s=new Set,u=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,E=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,h=r(t),{depths:D,balanced:N}=he(h),k=(R)=>!N||D[R]===0,g;while((g=u.exec(h))!==null){if(g[1])continue;if(!k(g.index))continue;if(g[2])g[2].split(",").forEach((R)=>{let m=Mt(R);if(m)s.add(m)});else if(g[3])s.add(g[3])}while((g=E.exec(h))!==null){if(g[1])continue;if(!k(g.index))continue;s.add(g[2])}let U=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=U.exec(h))!==null){if(!k(g.index))continue;let R=/^\s*['"]([^'"]+)['"]/.exec(t.slice(g.index+g[0].length))?.[1];if(R&&Y.some((m)=>m.test(R)))continue;if(g[1])s.add(g[1]);if(g[2])s.add(g[2]);for(let m of(g[3]??"").split(",")){let _=m.trim();if(!_||/^type\s/.test(_))continue;let L=/\bas\s+(\w+)\s*$/.exec(_)?.[1]??/^\w+$/.exec(_)?.[0];if(L)s.add(L)}}for(let R of h.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let m of R[1].split(",")){let _=/\bas\s+(\w+)\s*$/.exec(m)?.[1]??/^\s*(\w+)\s*$/.exec(m)?.[1];if(_)s.delete(_)}let ft=s.size>0?`
|
|
3
|
-
export { ${[...s].join(", ")} }`:"";A("bundling:",o,"from:",d.basename(e));let tt=new Set,et=new Map;try{let R=await Bun.build({entrypoints:[v],outdir:y,target:"browser",format:"esm",minify:l?{whitespace:!1,identifiers:!0,syntax:!0}:!1,plugins:[pt(i,B,v,t+ft,tt,M,et,n.serverApi,n.substitutes)],define:{"process.env.NODE_ENV":l?'"production"':'"development"',...C()},root:i});if(!R.success){let F=R.logs.filter((T)=>T.level==="error").map((T)=>T.message).join(", ")||`Unable to bundle ${d.basename(e)}`,P=sr(R.logs,e||void 0);if(console.warn("[stx:bundler] build failed:",F),
|
|
2
|
+
import{sr,Ae}from"./chunk-mzes9ds7.js";import{V,w,Sr,Fs,C}from"./chunk-b1kc0ka1.js";import{a,O}from"./chunk-wfd9e224.js";import{Lo}from"./chunk-gq9h36jf.js";import{st}from"./chunk-9n8t7v78.js";import{c}from"./chunk-7trdtz0c.js";import{r,he}from"./chunk-shke1fcm.js";import d from"path";import j from"fs";import{AsyncLocalStorage as at}from"async_hooks";import{randomUUID as bt}from"crypto";var $t=11;function X(t,e,n){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(d.basename(t))||Lo(t,e,n)}var lt=2;function Af(t){let e=process.env.STX_BUNDLE_CACHE_DIR?.trim();return e?d.resolve(e):c(t,"bundle-cache")}function nt(t,e){let n=t;for(let i of wt(e))if(i!==d.sep)n=n.split(i).join("\x00root");return n}var rt=new Map;function wt(t){let e=d.resolve(t),n=rt.get(e);if(!n){let i=e;try{i=j.realpathSync(e)}catch{}n=[...new Set([e,i])].sort((l,p)=>p.length-l.length),rt.set(e,n)}return n}function St(t,e){try{let n=j.statSync(t),i=d.resolve(e),l=t.startsWith(`${i}${d.sep}`);return{path:l?d.relative(i,t):t,...l?{inRoot:!0}:{},mtimeMs:n.mtimeMs,size:n.size,hash:Bun.hash(j.readFileSync(t)).toString(36)}}catch{return null}}function ct(t,e){return t.inRoot?d.join(d.resolve(e),t.path):t.path}function vt(t,e){for(let n of t){let i=ct(n,e);try{let l=j.statSync(i);if(l.size!==n.size)return!1;if(l.mtimeMs!==n.mtimeMs&&Bun.hash(j.readFileSync(i)).toString(36)!==n.hash)return!1}catch{return!1}}return!0}var ut=new Map,Bt=100;function Pf(t=process.env){let e=Number(t.STX_BUNDLE_CACHE_LIMIT);return Number.isFinite(e)&&e>=1?Math.floor(e):2000}var H=new Map;async function jt(t){let e=H.get(t)??0;if(e>0&&e<Bt){H.set(t,e+1);return}H.set(t,1);try{let n=(await j.promises.readdir(t)).filter((o)=>o.endsWith(".js")),i=Pf();if(n.length<=i)return;let p=(await Promise.all(n.map(async(o)=>{try{return{name:o,at:(await j.promises.stat(d.join(t,o))).mtimeMs}}catch{return null}}))).filter((o)=>o!==null);p.sort((o,b)=>b.at-o.at);for(let o of p.slice(i)){let b=o.name.slice(0,-3);await j.promises.rm(d.join(t,`${b}.js`),{force:!0}),await j.promises.rm(d.join(t,`${b}.deps.json`),{force:!0})}A("pruned bundle cache to",i,"entries")}catch{}}function be(t){return ut.get(t)??[]}function Z(t,e){if(t)ut.set(t,e)}function If(t=process.env){return t.STX_DEBUG==="true"||t.STX_DEBUG==="1"}function A(...t){if(If())console.log("[stx:bundler]",...t)}var K=[];function cc(t,e,n){K.push({filePath:t||"<inline>",message:e,details:n})}function sn(){return K.slice()}function on(){K.length=0}var Q;function Dh(t){Q=t}function lc(){if(Q)return Q;try{let t=O.strict;return typeof t==="object"&&t!==null?t.bundlerFallback??"warn":"warn"}catch{return"warn"}}var Y=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function an(t){let e=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,n;while((n=e.exec(t))!==null){let l=n[1];if(!Y.some((o)=>o.test(l)))return A("detected user import:",l),!0}let i=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((n=i.exec(t))!==null){let l=n[1];if(/\.css(?:\?.*)?$/.test(l))continue;if(!Y.some((o)=>o.test(l)))return A("detected side-effect import:",l),!0}return!1}var rr="stx-module:",Et=/\.(?:[cm]?[jt]sx?|json)$/i;function Of(t,e){return d.relative(t,e).split(d.sep).join("/")}function Nf(t,e){if(e.size===0)return t;return t.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(n,i,l,p)=>{let o=e.get(p);return o&&!p.startsWith(rr)?`${i}${l}${o}${l}`:n})}function Mf(t,e){let n=0,i=(p)=>{let o=`__stxMod${n++}`,b=JSON.stringify(p);return e.push(`var ${o} = globalThis.__stxModules && globalThis.__stxModules[${b}];`,`if (${o} === undefined) throw new Error("[stx] module " + ${JSON.stringify(b)} + " is not registered on this page (#1957)");`),o},l=(p,o)=>{for(let b of p.split(",")){let I=b.trim();if(!I)continue;let M=I.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!M)continue;let S=M[1].startsWith('"')?JSON.parse(M[1]):M[1],f=M[2]??S;e.push(`var ${f} = ${o}[${JSON.stringify(S)}];`)}};return t=t.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,o,b)=>{let I=b.slice(rr.length),M=i(I),S=o.trim(),f=S.match(/^([\w$]+)\s*(?:,\s*|$)/);if(f&&!S.startsWith("{")&&!S.startsWith("*"))e.push(`var ${f[1]} = ${M}.default;`),S=S.slice(f[0].length).trim();let v=S.match(/^\*\s*as\s+([\w$]+)$/);if(v)e.push(`var ${v[1]} = ${M};`);else if(S.startsWith("{"))l(S.replace(/^\{|\}$/g,""),M);return""}),t=t.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,o)=>(i(o.slice(rr.length)),"")),t}function it(t){let e=[t,`${t}.ts`,`${t}.tsx`,`${t}.js`,`${t}.mjs`,`${t}.jsx`,d.join(t,"index.ts"),d.join(t,"index.tsx"),d.join(t,"index.js"),d.join(t,"index.mjs")];for(let n of e)try{if(j.existsSync(n)&&j.statSync(n,{throwIfNoEntry:!1})?.isFile())return n}catch{}return}var G=new at;function cs(t,e){let n=new Bun.CryptoHasher("md5");for(let[i,l]of[...t].sort(([p],[o])=>p<o?-1:p>o?1:0))n.update(`${i}\x00${l}\x00`);return G.run({modules:t,key:n.digest("hex").slice(0,12)},e)}var dt=new at;function Df(t){return dt.run(!0,t)}function Lf(){return dt.getStore()===!0}function uc(t){if(!Lf())return;throw Error(`The client script of ${t} needs bundling, and it is being rendered inside a Bun.build loader, where Bun never finishes a second build. Make the page an entrypoint of the build (bun-plugin-stx renders entrypoints before the bundler starts), or render it once outside the build so its bundle is cached.`)}function cn(){return G.getStore()?.key??""}function pt(t,e,n,i,l,p,o=new Map,b,I,M){let S=new Map([[n,i],...M??[]]),f=(B)=>B!==void 0&&S.has(B),v=(B,s,u)=>{if(X(s,t,b))return null;if(!p||!f(B)||!Et.test(s))return null;try{if(!j.statSync(s,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}l.add(s);let E=`${rr}${Of(process.cwd(),s)}`;return o.set(u,E),{path:E,external:!0}},y=(B,s)=>{let u=f(B)?e:d.dirname(B),E=d.resolve(u,s);return it(E)??E};return{name:"stx-client-bundle",setup(B){if(B.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(s)=>({path:s.path,external:!0})),B.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(s)=>({path:s.path,external:!0})),B.onResolve({filter:/^\//},(s)=>{if(f(s.path))return{path:s.path};let u=it(s.path);if(u){let E=v(s.importer,u,s.path);if(E)return E;if(!f(u))l.add(u);return{path:u}}return{path:s.path,external:!0}}),B.onResolve({filter:/^\.\.?\//},(s)=>{let u=y(s.importer,s.path),E=v(s.importer,u,s.path);if(E)return E;return l.add(u),{path:u}}),B.onResolve({filter:/^[@~]\//},(s)=>{let u=d.resolve(t,s.path.slice(2)),E=[u,`${u}.ts`,`${u}.tsx`,`${u}.js`,`${u}.mjs`,`${u}.jsx`,d.join(u,"index.ts"),d.join(u,"index.tsx"),d.join(u,"index.js"),d.join(u,"index.mjs")];for(let h of E)if(j.existsSync(h)&&j.statSync(h,{throwIfNoEntry:!1})?.isFile()){let D=v(s.importer,h,s.path);if(D)return D;return A(`resolved ${s.path[0]}/ import:`,s.path,"\u2192",h),l.add(h),{path:h}}return console.warn(`[stx:bundler] could not resolve ${s.path[0]}/ import:`,s.path),{path:u}}),p)B.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(s)=>{if(!f(s.importer))return;let u=`${rr}npm:${s.path}`;return o.set(s.path,u),{path:u,external:!0}});B.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(s)=>{if(S.has(s.path))return{contents:S.get(s.path),loader:"ts"};if(X(s.path,t,b))throw Error(`Server-only API source cannot be imported by a client script: ${s.path}`);let u=d.extname(s.path).toLowerCase(),E=u===".json"?"json":u===".tsx"?"tsx":u===".jsx"?"jsx":u===".ts"||u===".mts"||u===".cts"?"ts":"js";if(!f(s.path))l.add(s.path);let h=I?.get(s.path);if(h!==void 0)return{contents:h,loader:"js"};return{contents:j.readFileSync(s.path,"utf8"),loader:E}})}}}var q=new Map,z=w(64),ot=Symbol.for("stx.client-bundle-build-queue");function jf(t){let e=globalThis,i=(e[ot]??Promise.resolve()).then(t,t);return e[ot]=i.then(()=>{return},()=>{return}),i}async function ln(t,e,n={}){let i=n.projectRoot||process.cwd(),l=(await a(i)).serverApi,p=n.minify??!1,o=n.externalizeUserModules??!0,b=n.expose?.length?[...new Set(n.expose)].sort():void 0,I=n.cacheDir||Af(i),M=G.getStore(),S=new Bun.CryptoHasher("md5");S.update(`${$t}\x00${st()}\x00${JSON.stringify(l??!1)}\x00${o?"registry":"inline"}\x00${b?b.join(","):"*"}\x00${p?"minified":"readable"}\x00${M?.key??""}\x00${nt(t,i)}\x00${nt(e,i)}`);let f=S.digest("hex").slice(0,12),v=d.join(I,`${f}.js`),y=z.get(v);if(y){if(Fs(y.files)&&y.files.every((h)=>!X(h.path,i,l))){A("memo hit:",f);let h=y.files.map((D)=>D.path);return Z(e,h),n.collectInputs?.push(...h),y.code}z.delete(v),A("memo invalidated by dep change:",f)}let B=d.join(I,`${f}.deps.json`),s=Bun.file(v);if(await s.exists()){let h=Bun.file(B),D=!1,N=null;if(await h.exists())try{let k=JSON.parse(await h.text());if(k.metadataVersion===lt&&Array.isArray(k.files)&&vt(k.files,i))N=Sr(k.files.map((g)=>ct(g,i))),D=N.length===k.files.length&&!N.some((g)=>X(g.path,i,l))}catch{D=!1}if(D){if(A("cache hit:",f),N)Z(e,N.map((U)=>U.path)),n.collectInputs?.push(...N.map((U)=>U.path));let k=await s.text(),g=new Date;if(j.promises.utimes(v,g,g).catch(()=>{}),N)z.set(v,{code:k,files:N});return k}A("cache invalidated by dep change:",f)}let u=q.get(f);if(u){let h=await u;if(n.collectInputs)n.collectInputs.push(...(z.get(v)?.files??[]).map((D)=>D.path));return h}uc(e);let E=jf(()=>_t(t,e,{projectRoot:i,minify:p,cacheDir:I,hash:f,cachePath:v,depsPath:B,collectInputs:n.collectInputs,externalizeUserModules:o,serverApi:l,expose:b,throwOnFailure:n.throwOnFailure,substitutes:M?.modules}));q.set(f,E);try{return await E}finally{q.delete(f)}}function dc(t){return`${t}-${process.pid}-${bt()}`}async function Lh(t,e){let{projectRoot:n}=e,i=dc(new Bun.CryptoHasher("md5").update([...t.keys()].join("\x00")).digest("hex").slice(0,12)),l=d.join(c(n,"bundle-tmp"),"out",i);j.mkdirSync(l,{recursive:!0});let p=new Map,o=new Map,b=0;for(let[f,v]of t){let y=d.join(n,`.stx-split-${i}-${b++}.ts`);p.set(y,v),o.set(d.basename(y).replace(/\.ts$/,""),f)}let[I,M]=[...p][0],S=new Set;uc(e.filePath);try{let f=await Bun.build({entrypoints:[...p.keys()],outdir:l,target:"browser",format:"esm",splitting:!0,minify:!1,naming:{entry:"[name].js",chunk:"chunk-[hash].js"},plugins:[pt(n,d.dirname(e.filePath),I,M,S,!1,new Map,void 0,G.getStore()?.modules,p)],define:{"process.env.NODE_ENV":'"development"',...C()},root:n});if(!f.success)throw Error(f.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ")||"Unable to bundle the entries");let v={entries:new Map,chunks:new Map};for(let y of f.outputs){let B=d.basename(y.path);if(y.kind==="entry-point"){let s=o.get(B.replace(/\.js$/,""));if(s!==void 0)v.entries.set(s,await y.text())}else if(y.kind==="chunk")v.chunks.set(B.replace(/\.js$/,""),await y.text())}return e.collectInputs?.push(...S),v}finally{try{j.rmSync(l,{recursive:!0,force:!0})}catch{}}}async function _t(t,e,n){let{projectRoot:i,minify:l,cacheDir:p,hash:o,cachePath:b,depsPath:I,externalizeUserModules:M}=n,S=c(i,"bundle-tmp"),f=dc(o),v=d.join(i,`.stx-client-${f}.ts`),y=d.join(S,"out",f);j.mkdirSync(y,{recursive:!0});let B=d.dirname(e),s=new Set,u=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,E=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,h=r(t),{depths:D,balanced:N}=he(h),k=(R)=>!N||D[R]===0,g;while((g=u.exec(h))!==null){if(g[1])continue;if(!k(g.index))continue;if(g[2])g[2].split(",").forEach((R)=>{let m=Mt(R);if(m)s.add(m)});else if(g[3])s.add(g[3])}while((g=E.exec(h))!==null){if(g[1])continue;if(!k(g.index))continue;s.add(g[2])}let U=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=U.exec(h))!==null){if(!k(g.index))continue;let R=/^\s*['"]([^'"]+)['"]/.exec(t.slice(g.index+g[0].length))?.[1];if(R&&Y.some((m)=>m.test(R)))continue;if(g[1])s.add(g[1]);if(g[2])s.add(g[2]);for(let m of(g[3]??"").split(",")){let _=m.trim();if(!_||/^type\s/.test(_))continue;let L=/\bas\s+(\w+)\s*$/.exec(_)?.[1]??/^\w+$/.exec(_)?.[0];if(L)s.add(L)}}for(let R of h.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let m of R[1].split(",")){let _=/\bas\s+(\w+)\s*$/.exec(m)?.[1]??/^\s*(\w+)\s*$/.exec(m)?.[1];if(_)s.delete(_)}let ft=s.size>0?`
|
|
3
|
+
export { ${[...s].join(", ")} }`:"";A("bundling:",o,"from:",d.basename(e));let tt=new Set,et=new Map;try{let R=await Bun.build({entrypoints:[v],outdir:y,target:"browser",format:"esm",minify:l?{whitespace:!1,identifiers:!0,syntax:!0}:!1,plugins:[pt(i,B,v,t+ft,tt,M,et,n.serverApi,n.substitutes)],define:{"process.env.NODE_ENV":l?'"production"':'"development"',...C()},root:i});if(!R.success){let F=R.logs.filter((T)=>T.level==="error").map((T)=>T.message).join(", ")||`Unable to bundle ${d.basename(e)}`,P=sr(R.logs,e||void 0);if(console.warn("[stx:bundler] build failed:",F),cc(e||"",F,P),n.throwOnFailure||lc()==="error")throw Error(F);return t}let m="";for(let x of R.outputs){m=await x.text();break}let _=[];for(let x of m.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let F of x[1].split(",")){let P=F.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(P){_.push([P[2],P[1]]);continue}let T=F.trim();if(/^[A-Za-z_$][\w$]*$/.test(T))_.push([T,T])}if(n.expose){let x=new Set(n.expose);for(let F=_.length-1;F>=0;F--)if(!x.has(_[F][0]))_.splice(F,1)}let L=[];m=Mf(Nf(m,et),L);let mt=m.match(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm)||[];if(m=m.replace(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),l&&m)try{m=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(m)}catch{}let W=`__stxBundle_${o}`,gt=new Set(V(t,!0).split(",").map((x)=>x.trim())),ht=_.map(([x,F])=>`get ${JSON.stringify(x)}() { return ${F} }${gt.has(x)?`, set ${JSON.stringify(x)}(__stxValue_${F}) { ${F} = __stxValue_${F} }`:""}`).join(", "),xt=_.map(([x])=>`var ${x} = undefined;`).join(`
|
|
4
4
|
`),yt=_.map(([x])=>`${x} = ${W}[${JSON.stringify(x)}];`).join(`
|
|
5
5
|
`);if(m=`${mt.join(`
|
|
6
6
|
`)}
|
|
@@ -16,5 +16,5 @@ var __stxLiveBindings = typeof __stxLiveBindings === 'undefined' ? {} : __stxLiv
|
|
|
16
16
|
Object.keys(${W}).forEach(function(name) {
|
|
17
17
|
if (!Object.prototype.hasOwnProperty.call(__stxLiveBindings, name))
|
|
18
18
|
Object.defineProperty(__stxLiveBindings, name, Object.getOwnPropertyDescriptor(${W}, name));
|
|
19
|
-
});`.trim(),A("bundled:",o,"output:",m.length,"bytes"),s.size>0&&_.length===0)return console.warn(`[stx:bundler] dropped every binding for ${d.basename(e)} (${o}); serving the unbundled source and not caching this result`),t;j.mkdirSync(p,{recursive:!0}),await Bun.write(b,m);let J=Sr(tt);return await Bun.write(I,JSON.stringify({metadataVersion:lt,files:J.map((x)=>St(x.path,i)).filter((x)=>x!==null)})),Z(e,J.map((x)=>x.path)),n.collectInputs?.push(...J.map((x)=>x.path)),z.set(b,{code:m,files:J}),await jt(p),m}catch(R){let m=sr(R,e||void 0),_=Ae(R,e||void 0);if(console.warn(`[stx:bundler] error: ${_}`),
|
|
20
|
-
export{
|
|
19
|
+
});`.trim(),A("bundled:",o,"output:",m.length,"bytes"),s.size>0&&_.length===0)return console.warn(`[stx:bundler] dropped every binding for ${d.basename(e)} (${o}); serving the unbundled source and not caching this result`),t;j.mkdirSync(p,{recursive:!0}),await Bun.write(b,m);let J=Sr(tt);return await Bun.write(I,JSON.stringify({metadataVersion:lt,files:J.map((x)=>St(x.path,i)).filter((x)=>x!==null)})),Z(e,J.map((x)=>x.path)),n.collectInputs?.push(...J.map((x)=>x.path)),z.set(b,{code:m,files:J}),await jt(p),m}catch(R){let m=sr(R,e||void 0),_=Ae(R,e||void 0);if(console.warn(`[stx:bundler] error: ${_}`),cc(e||"",_,m),n.throwOnFailure||lc()==="error")throw R;return t}finally{try{j.rmSync(y,{recursive:!0,force:!0})}catch{}}}function Mt(t){let e=t.trim();if(!e)return null;let n=e.indexOf("=");if(n!==-1)e=e.slice(0,n).trim();let i=e.indexOf(":");if(i!==-1)e=e.slice(i+1).trim();if(e.startsWith("..."))e=e.slice(3).trim();return/^[A-Za-z_$][\w$]*$/.test(e)?e:null}
|
|
20
|
+
export{Af,Pf,be,If,cc,sn,on,Dh,lc,an,rr,Of,Nf,Mf,cs,Df,Lf,uc,cn,jf,ln,dc,Lh};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Wt}from"./chunk-
|
|
2
|
+
import{Wt}from"./chunk-m1qqqc2j.js";function ro(e){let n=e.pwa;if(!n?.enabled)return"";let r=n.manifest,t=n.icons?.outputDir?`/${n.icons.outputDir}`:"/pwa-icons",o=Wt(e),i=`
|
|
3
3
|
<!-- stx PWA Meta Tags -->
|
|
4
4
|
<link rel="manifest" href="/manifest.json">
|
|
5
5
|
<meta name="theme-color" content="${a(r?.themeColor||"#000000")}">
|
|
@@ -43,9 +43,9 @@ if ('serviceWorker' in navigator) {
|
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
</script>
|
|
46
|
-
<!-- End stx PWA -->`,i}function
|
|
46
|
+
<!-- End stx PWA -->`,i}function Bi(e,n){let r=n.pwa;if(!r?.enabled||r.autoInject===!1)return e;if(e.includes("<!-- stx PWA Meta Tags -->"))return e;if(!e.includes("</head>")){let o=e.lastIndexOf("</body>");if(o!==-1){let i=ro(n);return e.slice(0,o)+i+`
|
|
47
47
|
`+e.slice(o)}return e+ro(n)}let t=ro(n);return e.replace("</head>",`${t}
|
|
48
|
-
</head>`)}function
|
|
48
|
+
</head>`)}function Dg(e){if(!e.pwa?.enabled)return"";return`<script>
|
|
49
49
|
if ('serviceWorker' in navigator) {
|
|
50
50
|
window.addEventListener('load', function() {
|
|
51
51
|
navigator.serviceWorker.register('/${Wt(e)}')
|
|
@@ -57,5 +57,5 @@ if ('serviceWorker' in navigator) {
|
|
|
57
57
|
});
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
|
-
</script>`}function
|
|
61
|
-
export{ro,
|
|
60
|
+
</script>`}function Lg(){return'<link rel="manifest" href="/manifest.json">'}function jg(e){return`<meta name="theme-color" content="${a(e)}">`}function a(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}
|
|
61
|
+
export{ro,Bi,Dg,Lg,jg};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Se,Gs,$g,dy,Rg,py,Sn,p,W,Q,kn,_e,Ag,Ei,Pg,fy,E,Ti,Ig,gy,A,my}from"./chunk-b1kc0ka1.js";import"./chunk-wjamjgx6.js";import"./chunk-5rxks14t.js";import"./chunk-9nh48zvm.js";import"./chunk-xppm4cs4.js";import"./chunk-fkh4xece.js";export{Ig as applyFilters,py as clearCustomFilters,Ag as clientLoopScopes,Gs as defaultFilters,kn as escapeAttributeValue,p as escapeHtml,W as escapeHtmlValue,Q as escapeInterpolatedHtmlValue,A as evaluateExpression,Se as findMustacheEnd,Rg as getAllFilters,Pg as interpolateScriptAttributes,Ei as interpolateScriptExpressions,fy as interpolateScriptsInTemplate,E as processExpressions,Ti as processExpressionsChunked,$g as registerFilter,dy as registerFilters,Sn as replaceInterpolations,gy as resetRejectedExpressionWarnings,my as unescapeHtml,_e as usesSignalsInScript};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{E}from"./chunk-
|
|
3
|
-
`)}catch{return""}})}function
|
|
4
|
-
`)}catch{return""}})}function
|
|
2
|
+
import{E}from"./chunk-b1kc0ka1.js";import{de}from"./chunk-ktnb1j54.js";function g(e,t){let r={};for(let n of e)r[n]=de(t(n));return new Proxy({},{get:(n,a)=>r[a]?.(),set:(n,a,o)=>{if(r[a])r[a].set(o);else r[a]=de(o);return!0},has:(n,a)=>(a in r),deleteProperty:(n,a)=>(delete r[a],!0),ownKeys:()=>Reflect.ownKeys(r),getOwnPropertyDescriptor:(n,a)=>(a in r)?{enumerable:!0,configurable:!0,writable:!0,value:r[a]()}:void 0})}function v(e,t){let r={};for(let n of t)r[n]=e[n];return r}function Ca(e,t){let r=Object.keys(e),n=g(r,(i)=>t?.[i]??e[i].getDefaultValue()),a=g(r,()=>[]),o=g(r,()=>!1),c=g(r,()=>!1),f=g(r,()=>!1),s=de(!1);async function u(i){f[i]=!0;let d=await e[i].validate(n[i],n);return a[i]=d,f[i]=!1,d.length===0}async function l(){s.set(!0);let i=await Promise.all(r.map(u));return s.set(!1),i.every(Boolean)}function m(){for(let i of r)n[i]=t?.[i]??e[i].getDefaultValue(),a[i]=[],o[i]=!1,c[i]=!1}function h(i){for(let d of r)if(d in i)n[d]=i[d],c[d]=!0}function b(i,d){n[i]=d,c[i]=!0}function y(i,d=!0){if(o[i]=d,d)u(i)}function p(i){return{value:n[i],errors:a[i],touched:o[i],dirty:c[i],valid:a[i].length===0,validating:f[i]}}function V(i){return async(d)=>{d?.preventDefault?.();for(let w of r)o[w]=!0;if(await l())await i(v(n,r))}}return{values:n,errors:a,touched:o,dirty:c,get isValid(){return r.every((i)=>a[i].length===0)},get isValidating(){return s()||r.some((i)=>f[i])},get isDirty(){return r.some((i)=>c[i])},validate:l,validateField:u,reset:m,setValues:h,setFieldValue:b,setFieldTouched:y,getFieldState:p,handleSubmit:V}}var hu=Ca;class Un{rules=[];defaultValue="";addRule(e){let t=new Un;return t.rules=[...this.rules,e],t.defaultValue=this.defaultValue,t}required(e="This field is required"){return this.addRule({name:"required",message:e,validate:(t)=>{if(t===null||t===void 0)return e;if(typeof t==="string"&&t.trim()==="")return e;if(Array.isArray(t)&&t.length===0)return e;return!0}})}email(e="Please enter a valid email"){return this.addRule({name:"email",message:e,validate:(t)=>{if(!t)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(t))||e}})}url(e="Please enter a valid URL"){return this.addRule({name:"url",message:e,validate:(t)=>{if(!t)return!0;try{return new URL(String(t)),!0}catch{return e}}})}min(e,t){let r=t||`Must be at least ${e} characters`;return this.addRule({name:"min",message:r,validate:(n)=>{if(!n)return!0;return String(n).length>=e||r}})}max(e,t){let r=t||`Must be no more than ${e} characters`;return this.addRule({name:"max",message:r,validate:(n)=>{if(!n)return!0;return String(n).length<=e||r}})}length(e,t,r){let n=r||`Must be between ${e} and ${t} characters`;return this.addRule({name:"length",message:n,validate:(a)=>{if(!a)return!0;let o=String(a).length;return o>=e&&o<=t||n}})}pattern(e,t="Invalid format"){return this.addRule({name:"pattern",message:t,validate:(r)=>{if(!r)return!0;return e.test(String(r))||t}})}hasUppercase(e="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,e)}hasLowercase(e="Must contain a lowercase letter"){return this.pattern(/[a-z]/,e)}hasNumber(e="Must contain a number"){return this.pattern(/\d/,e)}hasSpecial(e="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,e)}alphanumeric(e="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,e)}startsWithLetter(e="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,e)}noSpaces(e="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:e,validate:(t)=>{if(!t)return!0;return!String(t).includes(" ")||e}})}number(e="Must be a number"){let t=this.addRule({name:"number",message:e,validate:(r)=>{if(!r&&r!==0)return!0;return!Number.isNaN(Number(r))||e}});return t.defaultValue=0,t}integer(e="Must be a whole number"){return this.addRule({name:"integer",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number.isInteger(Number(t))||e}})}positive(e="Must be a positive number"){return this.addRule({name:"positive",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)>0||e}})}negative(e="Must be a negative number"){return this.addRule({name:"negative",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)<0||e}})}minValue(e,t){let r=t||`Must be at least ${e}`;return this.addRule({name:"minValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)>=e||r}})}maxValue(e,t){let r=t||`Must be no more than ${e}`;return this.addRule({name:"maxValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)<=e||r}})}between(e,t,r){let n=r||`Must be between ${e} and ${t}`;return this.addRule({name:"between",message:n,validate:(a)=>{if(!a&&a!==0)return!0;let o=Number(a);return o>=e&&o<=t||n}})}matches(e,t){let r=t||`Must match ${e}`;return this.addRule({name:"matches",message:r,validate:(n,a)=>{if(!a)return!0;return n===a[e]||r}})}oneOf(e,t){let r=t||`Must be one of: ${e.join(", ")}`;return this.addRule({name:"oneOf",message:r,validate:(n)=>{if(!n)return!0;return e.includes(n)||r}})}notOneOf(e,t){let r=t||`Cannot be one of: ${e.join(", ")}`;return this.addRule({name:"notOneOf",message:r,validate:(n)=>{if(!n)return!0;return!e.includes(n)||r}})}date(e="Must be a valid date"){return this.addRule({name:"date",message:e,validate:(t)=>{if(!t)return!0;let r=new Date(String(t));return!Number.isNaN(r.getTime())||e}})}before(e,t){let r=new Date(e),n=t||`Must be before ${r.toLocaleDateString()}`;return this.addRule({name:"before",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))<r||n}})}after(e,t){let r=new Date(e),n=t||`Must be after ${r.toLocaleDateString()}`;return this.addRule({name:"after",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))>r||n}})}custom(e,t="Invalid value"){return this.addRule({name:"custom",message:t,validate:e})}async(e,t="Invalid value"){return this.addRule({name:"async",message:t,async:!0,validate:e})}when(e,t){let r=new Un;r.rules=[...this.rules],r.defaultValue=this.defaultValue;for(let n of t.getRules())r.rules.push({...n,validate:(a,o)=>{if(!e(a,o||{}))return!0;return n.validate(a,o)}});return r}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default(e){let t=new Un;return t.rules=[...this.rules],t.defaultValue=e,t}async validate(e,t){let r=[];for(let n of this.rules){let a=await n.validate(e,t);if(a!==!0)r.push(a)}return r}validateSync(e,t){let r=[];for(let n of this.rules){if(n.async)continue;let a=n.validate(e,t);if(a!==!0)r.push(a)}return r}}var Wm=new Un;function yu(e,t,r){let n=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return u.map((l)=>E(c,{...t,message:l},r)).join(`
|
|
3
|
+
`)}catch{return""}})}function bu(e,t,r){let n=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return u.map((l)=>E(c,{...t,message:l},r)).join(`
|
|
4
|
+
`)}catch{return""}})}function wu(e,t,r){let n=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return c}catch{return""}})}function qm(e,t,r){let n=e;return n=yu(n,t,r),n=bu(n,t,r),n=wu(n,t,r),n}export{Ca,hu,Un,Wm,yu,bu,wu,qm};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{q,De}from"./chunk-
|
|
2
|
+
import{q,De}from"./chunk-b1kc0ka1.js";var o=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function u(t,e,r){let i={fullTag:r,content:e,attrs:t};if(/\bserver\b/.test(t))return{...i,type:"server"};if(/\bdata-stx-scoped\b/.test(t))return{...i,type:"client"};if(o.test(e))return{...i,type:"signals"};if(/\bclient\b/.test(t)||/\btype\s*=\s*["']module["']/.test(t)||/\bsrc\s*=/.test(t))return{...i,type:"client"};return{...i,type:"server"}}var S=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function rn(t){let e=[],r=[],i=[],c=0;while(c<t.length){let s=t.indexOf("<",c);if(s===-1)break;let p=De(t,s);if(p>s){c=p;continue}let a=q(t,s);if(a>s){let f=t.slice(s,a),l=S.exec(f);if(l){let n=u(l[1],l[2],f);switch(n.type){case"signals":e.push(n);break;case"client":r.push(n);break;case"server":i.push(n);break}}c=a;continue}c=s+(t.startsWith("<!--",s)?4:1)}return{signals:e,client:r,server:i}}
|
|
3
3
|
export{rn};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{hm,ym,bm,wm,Xl,vm,xm,Sm,km,_m,Cm,Em}from"./chunk-gndxakrh.js";export{Cm as Broadcast,Em as BroadcastServer,Xl as broadcast,km as broadcastPresence,Sm as broadcastPrivate,_m as channel,hm as getBroadcastServer,wm as loadChannels,ym as startBroadcasting,bm as stopBroadcasting,vm as toUser,xm as toUsers};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{rt}from"./chunk-
|
|
2
|
+
import{rt}from"./chunk-g17q4y5k.js";import{wt,qn}from"./chunk-9qe4qsc7.js";import{Ir,Or,Nr,Dr,Ee}from"./chunk-9nh48zvm.js";import{Le,yn,cl,ll}from"./chunk-b1kc0ka1.js";import{M}from"./chunk-5rxks14t.js";import{$i}from"./chunk-wjamjgx6.js";import{b}from"./chunk-6w5a5ns4.js";import{i}from"./chunk-qd87dk1d.js";import{F,a}from"./chunk-wfd9e224.js";import{Ic}from"./chunk-k8pzk8v9.js";import{Nn,Mn,Ke,$e,ya,ba,Dn}from"./chunk-kpsxhm4x.js";import{un,Mo}from"./chunk-gq9h36jf.js";import{Ln}from"./chunk-12r22pf0.js";import{nn,tr,nr}from"./chunk-q87hkwfg.js";import{X}from"./chunk-5va6c7jf.js";import m from"fs";import c from"path";import{createHash as Q}from"crypto";function W(n){return Q("sha256").update(n).digest("hex").slice(0,8)}function J(n=!1){let l=n?qn():wt(),o=W(l);return{content:l,filename:`runtime.${o}.js`,hash:o}}function U(){let n=rt(),l=W(n);return{content:n,filename:`router.${l}.js`,hash:l}}import V from"path";import{createHash as ee}from"crypto";function te(n={}){let l=new Set;return{context:new Proxy(n,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function q(n,l,o={}){let r=V.resolve(n),e=await Bun.file(r).text(),S=ee("sha256").update(e).digest("hex").slice(0,16);cl();let _={};try{_=await a(o.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)=>Le(R))),{context:D}=te({__filename:r,__dirname:V.dirname(r),__stx_serverDeclared:u}),A=new Set,T={...F,..._,...o,buildMode:"compile",strict:!1},f=await i(e,D,r,T,A),w=Nn(f)+Mn(f)+Ke(f),j=ll();return{route:l,sourceFile:n,html:f,fragment:w,placeholders:j,hasServerScripts:y.length>0,serverScriptContent:y,dependencies:Array.from(A),contentHash:S,status:yn(e),streamTemplates:D.__streamTemplates}}var re=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function Z(n,l){let o=0,r=0;if(!m.existsSync(n))return{copied:o,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),o++,r+=m.statSync(u).size}}}return e(n,l),{copied:o,bytes:r}}async function mm(n={}){let l=Date.now(),o=c.resolve(n.root||process.cwd()),r=c.resolve(o,n.outputDir||".output");console.log("[stx build] Starting production build...");let e=await a(o),S=c.resolve(o,n.componentsDir??e.componentsDir??"components"),_=c.resolve(o,n.partialsDir??e.partialsDir??"partials"),y=c.resolve(o,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",g=Ee(e.app?.head,{known:Dr,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",A=n.routeRules??e.routeRules??{},T=Ln(A),f=n.serverApi??e.serverApi,w=typeof f==="object"?f:{};if(f)un(o,w);if(e.runtimeConfig)M(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let j=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of j)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=X(o,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],P=R.filter((s)=>!Y.some((h)=>s.pattern.startsWith(`/${h}/`)||s.pattern===`/${h}`));console.log(`[stx build] Found ${P.length} page routes (${R.length-P.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=J(n.debug),x=U();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 B=[],H=[];for(let s of P){let h=T(s.pattern),O=h.rendering==="prerender";if(O&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await q(s.filePath,s.pattern,{configDir:o,componentsDir:S,partialsDir:_,layoutsDir:y,debug:n.debug});if(B.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,x.filename),t.html=Nr(t.html,g,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=Ir(t.html,u);if(g.htmlAttrs)t.html=Or(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 I=p[1];t.html=t.html.replace(" "+I,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${I}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await b(t.html),O){let p=await Dn(t,{params:{},request:new Request(`http://stx.build${s.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${s.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=$e(t.html,D,!0);let L=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),z=c.join("server","pages",`${L}.compiled.json`),G=c.join("server","fragments",`${L}.html`);await Bun.write(c.join(r,z),JSON.stringify(t,null,2)),await Bun.write(c.join(r,G),t.fragment),H.push({pattern:s.pattern,compiledPath:z,fragmentPath:G,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:O}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(h).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let k=c.resolve(o,d);if(m.existsSync(k)){let{copied:s,bytes:h}=Z(k,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 E=nr(o);if(E){let{copied:s,bytes:h}=Z(E,c.join(r,"public",tr));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${nn}/`)}let N={runtime:v.filename,router:x.filename},C=ya(H,N,r);if(C.routeRules=A,C.routerContainer=D,f)C.apiRoutes=await Mo(o,r,w);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await $i(o,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(Ic(e._layerGraph),null,2));ba(C,r);let K=Date.now()-l;return console.log(`
|
|
3
3
|
[stx build] Done in ${K}ms \u2014 ${B.length} pages compiled`),{pageCount:B.length,assets:N,outputDir:r,duration:K}}
|
|
4
|
-
export{
|
|
4
|
+
export{mm};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{_u,$o,Yn,Cu,Eu,Tu,$u,Ru,Au,Pu,Iu,Ou,Nu,Mu,Du,Lu,ju,Bu,Fu,zu,Hu,Vu,Uu,Wu,qu,Ku,Gu,Xu,Ju,Yu,Zu,Qu,ed,td,nd,rd,sd,od,id,ad,cd,ld,ud,dd,pd,fd,gd,md,en,La,hd,yd,bd,ja,wd,vd,xd,Sd,kd,_d,Ba,Cd,Ed,Td,$d,Rd,Ad,Pd,Id,Od,Zn,Nd,Md,Dd,Ld,jd,Bd,Fd,zd,Hd,Vd,Ud,Wd,Ro,qd,Kd,Gd,Xd,Jd,rs,ss,Yd,Zd,Qd,ep,tp,Fa,np,rp,sp,za,Ao,op,ip,Ha,Va,os,Ua,ap,tn,cp,Wa,qa,Po,lp,Io,up,dp,pp,fp,gp,mp,hp,Ka,yp,bp,Ga,wp,vp,xp,Sp,kp,_p,Cp,Ep,Tp,$p,Rp,Ap,Pp,Ip,Op,Np,Mp,Dp,Lp,jp,Bp,Fp,zp,Hp,Xa,Vp,Up,Wp,qp,Kp,Gp,Xp,Jp,Yp,Zp,Qp,Qn,Ja,Ya,ef,er,tf,nf,rf,Za,Qa,is,as,sf,Oo,of,af,cf,lf,uf,df,pf,ff,gf,mf,hf,yf,bf,wf,vf,xf,Sf,kf,_f,Cf,ec,Ef,Tf,tc,nc,$f,Rf}from"./chunk-6e44f8w8.js";export{gd as AVAILABLE_COMPONENTS,Fa as AutoUpdater,md as COMPONENT_STYLES,is as DEFAULT_WATCH_INTERVAL_MS,Qa as MAX_WATCH_INTERVAL_MS,Za as MIN_WATCH_INTERVAL_MS,_d as MODAL_STYLES,Ou as TOAST_STYLES,Pd as TRAY_MENU_STYLES,Ha as UPDATE_MANIFEST_ASSET,vd as alert,Bp as appInfo,df as appleScript,Rf as applicationDataDirectory,uf as audio,Tf as backgroundDelay,Mp as battery,lf as biometric,Zp as bluetooth,hf as bonjour,tn as bundlePathForExecutable,lp as caffeinate,np as canReplaceBundle,rp as clearQuarantine,Ep as clipboard,kd as closeAllModals,Wd as closeAllWindows,wd as confirm,Hp as contextMenu,Sf as continuityCamera,xf as coreml,ep as craftBinaryNotFoundMessage,Ro as craftWindowArguments,Qn as crashReporter,nd as createAccordion,Xu as createAutocomplete,Fu as createAvatar,Bu as createBadge,Nu as createButton,zu as createCard,ld as createChart,Du as createCheckbox,Zu as createChip,ud as createCodeEditor,qu as createColorPicker,cd as createDataGrid,Ku as createDatePicker,ss as createDiskImage,Vu as createDropdown,pd as createFileExplorer,ap as createGitHubUpdateManifest,Ua as createGitHubUpdater,Yu as createImageView,Sp as createInterval,Ju as createLabel,od as createListView,dd as createMediaPlayer,Cd as createMenubar,sd as createModalComponent,$f as createNativeUpdateApi,nc as createPantrySelfUpdater,gp as createPreferences,ju as createProgressBar,Wu as createRadioButton,Uu as createRating,ed as createScrollView,Po as createSelfUpdater,Lu as createSlider,td as createSplitView,rd as createStepper,Ba as createSystemTray,id as createTable,Hu as createTabs,Mu as createTextInput,Gu as createTimePicker,xp as createTimer,Qu as createTooltip,ad as createTreeView,fd as createWebView,qd as createWindow,Gd as createWindowWithHTML,Io as decaffeinate,Np as deepLinks,kp as delay,Au as dismissAlertById,Pu as dismissAllAlerts,Ip as dragOut,sp as extractBundle,pf as fileAssociations,Oo as focus,af as focusShortcutsReady,Cp as formatCompact,fp as formatDuration,pp as formatRemainingTime,yp as formatShortcut,_p as formatTime,$p as fs,za as generateUpdateManifest,Iu as getActiveAlertCount,Sd as getActiveModalCount,Ed as getActiveTrayInstances,Vd as getActiveWindowIds,dp as getCaffeinateStatus,Cf as getCapabilities,ec as getCapability,zd as getDesktopConfig,Bd as getDialogBridgeScript,vp as getRegisteredHotkeys,Rd as getSimulatedTrayHTML,Ad as getTrayBridgeScript,Td as getTrayInstance,Ud as getWindow,Jd as getWindowBridgeScript,Va as githubLatestAssetUrl,os as githubReleaseAssetUrl,Ap as globalShortcuts,er as handoff,of as hasFocusShortcuts,ef as iap,hp as isAutoLaunchEnabled,Ef as isAvailable,up as isCaffeinated,Op as isDragOutAvailable,Xd as isWebviewAvailable,Wp as keychain,tf as liveActivities,cf as localServer,nf as location,mf as log,Yd as macOSRuntimeExecutablePath,zp as menu,vf as midi,Gp as nativeAutoLaunch,Xp as nativeTray,Jp as nativeWindow,Dp as network,Tp as notifications,Ru as notify,Kd as openDevWindow,Zd as pack,Qd as packageApp,tc as parsePantryUpdateManifest,Ka as parseShortcut,gf as pdf,qp as permissions,Kp as printing,xd as prompt,Wa as quitLauncher,Ao as readBundleIdentity,Ja as redactPII,bp as registerHotkey,qa as relaunchBundle,_u as requestNotificationPermission,Hd as resetDesktopConfig,tp as resolveCraftBinary,rs as resolveCraftExecutablePath,cp as runningBundleTeamId,Up as screen,rf as screenCapture,as as screenSharing,_f as serial,kf as serviceMenu,mp as setAutoLaunch,Fd as setDesktopConfig,Rp as shell,$o as showAlert,Md as showAlertDialog,Nd as showColorPicker,Dd as showConfirmDialog,Ld as showErrorDialog,yd as showErrorModal,$u as showErrorToast,La as showInfoModal,Cu as showInfoToast,Zn as showMessageBox,en as showModal,Id as showOpenDialog,ja as showQuestionModal,Od as showSaveDialog,bd as showSuccessModal,Eu as showSuccessToast,Yn as showToast,jd as showWarningDialog,hd as showWarningModal,Tu as showWarningToast,Xa as sidebar,Ya as signPayload,Qp as speech,bf as speechRecognition,yf as spotlight,Fp as standardMenus,op as swapBundle,Vp as system,ff as tags,Pp as theme,Yp as touchbar,$d as triggerTrayAction,wp as unregisterAllHotkeys,Ga as unregisterHotkey,Lp as updater,ip as verifyBundleTrust,wf as vision,sf as watchScreenSharing,jp as windowEvents};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ne,w,S,C,Z}from"./chunk-
|
|
2
|
+
import{Ne,w,S,C,Z}from"./chunk-b1kc0ka1.js";import{k}from"./chunk-fkh4xece.js";import{I,An}from"./chunk-xppm4cs4.js";import{a}from"./chunk-wfd9e224.js";import{be,an,cn,ln}from"./chunk-tc31my2p.js";import{St}from"./chunk-3248qphb.js";import{bt,Wn,Qt,ue}from"./chunk-jhm1228j.js";import{T,Rn}from"./chunk-9xr628ew.js";import h from"path";var v=new Map,A=new Map,E=w(64),F=new Map,Y=["composables","functions"];function H(e){let s=h.basename(e,".ts");return s==="index"||s==="types"||e.endsWith(".d.ts")}async function ee(e){if(e)return h.resolve(e);let s=`<default>:${process.cwd()}`,r=F.get(s);if(r!==void 0)return r;let t=await te();if(t!==null)F.set(s,t);return t}async function te(){let e=await a(),s=e.root||process.cwd(),r=e.composablesDir;if(r)return h.resolve(s,r);for(let t of Y){let n=h.resolve(s,t);try{let c=new Bun.Glob("**/*.ts");for await(let i of c.scan({cwd:n,absolute:!0}))if(!H(i))return n}catch{}}return null}async function W(e){let s=Array.isArray(e)?e:e?[h.resolve(e)]:(await a())._layerComposableDirs??[await ee()].filter((t)=>!!t),r=new Map;for(let t of s){let n=new Bun.Glob("**/*.ts");try{for await(let c of n.scan({cwd:t,absolute:!0})){let i=h.relative(t,c);if(!H(c)&&!r.has(i))r.set(i,c)}}catch{}}return{key:s.join("\x00"),files:[...r.values()].sort()}}async function ko(e){let{files:s}=await W(e),r=Z({loader:"ts",target:"browser",define:C()}),t=[];for(let n of s)try{let c=await Bun.file(n).text(),i=r.scan(c).exports.filter((u)=>u!=="default");if(i.length>0)t.push({file:n,names:i})}catch{}return t}function ne(e,s){return new RegExp(`\\b${s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(e)}function R(e,s){let r=new Set(e.match(/\w+/g)),t=new Set;for(let n of s)if(/^\w+$/.test(n)?r.has(n):ne(e,n))t.add(n);return t}var J=w(64);function X(e,s){let r=S(e,s.size),t=J.get(r);if(t)return t;let n;try{n=Ne(e,s)}catch{n=R(e,s)}let c=[...e.matchAll(/(?:const|let|var)\s*\{([^}]*)\}\s*=\s*window\.__composables\u0008/g),...e.matchAll(/import\s*\{([^}]*)\}\s*from\s*['"]@composables['"]/g)];for(let i of c)for(let u of i[1].split(",")){let f=u.trim().split(/\s*(?::|\u0008as\u0008)\s*/)[0];if(f&&s.has(f))n.add(f)}return J.set(r,n),n}function se(e){return!e||/^(?:module|(?:text|application)\/(?:java|ecma)script|application\/stx-[\w-]+)$/i.test(e)}var L=w(256);function oe(e,s){let r=new Set(s),t="",n=0,c=new Set;for(let i of e.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script\s*>/gi)){t+=e.slice(n,i.index),n=i.index+i[0].length;let u=i[1]??"",f=i[2]??"",d=/\btype\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i.exec(u),m=d?(d[1]??d[2]??d[3]??"").trim():void 0;if(!se(m)){if(!/json/i.test(m??""))t+=` ${f} `;continue}let y=R(f,r);if(y.size===0)continue;let _=S(f,[...y].sort().join(",")),b=L.get(_);if(!b)b=X(f,y),L.set(_,b);for(let B of b)c.add(B)}t+=e.slice(n);for(let i of R(t,r))c.add(i);return c}function ie(e,s,r){let t=new Map;for(let{file:f,names:d}of e)for(let m of d)if(!t.has(m))t.set(m,f);let n=new Set(t.keys()),c=(f)=>{let d=[];for(let m of X(f,n))d.push(t.get(m));return d},i=new Set,u=r.flatMap((f,d)=>d===0?[...oe(f,t.keys())].map((m)=>t.get(m)):c(f));while(u.length>0){let f=[];for(let d of u){if(i.has(d))continue;i.add(d);for(let m of c(s.get(d)??""))if(!i.has(m))f.push(m)}u=f}return i}async function Sh(e,s,r,t){let{key:n,files:c}=await W(e);if(!n)return null;let i=()=>[...new Set([...c,...c.flatMap((o)=>be(o))])],u=bt(i());if(c.length===0)return ue(v,n,u,""),null;c.sort();let f=Z({loader:"ts",target:"browser",define:C()}),d=Qt(A,n,u);if(!d){let o=new Map,l=[];for(let p of c)try{let x=await Bun.file(p).text();o.set(p,x);let g=f.scan(x).exports.filter((V)=>V!=="default");if(g.length>0)l.push({file:p,names:g})}catch{o.set(p,"")}d=ue(A,n,u,{codeByFile:o,modules:l})}let{codeByFile:m,modules:y}=d,_;if(s===void 0)_=new Set(c);else{let o=r?[s,...r]:[s],l=S(o.join("\x00"),n,o.length,u),p=E.get(l);if(_=p??ie(y,m,o),!p)E.set(l,_)}if(_.size===0)return null;let b=c.filter((o)=>_.has(o)),B=()=>{if(!t)return;for(let o of b)t.push(o,...be(o))},N=`${n}\x00${b.join("\x00")}\x00${cn()}`,P=Qt(v,N,u);if(P!==void 0)return B(),P||null;let D=[],M=new Set,U=new Set;for(let o of b)try{let l=m.get(o)??await Bun.file(o).text(),p=h.basename(o,".ts");for(let g of l.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(g[1])U.add(g[1]);let x=[];try{for(let g of f.scan(l).exports)if(g!=="default")M.add(g),x.push(g)}catch{}if(l=I(l),an(l))l=await ln(l,o,{projectRoot:process.cwd(),externalizeUserModules:!1,expose:x}),l=St(l);l=An(l),l=l.replace(/^export\s+(default\s+)?/gm,""),l=f.transformSync(l),D.push(`// Composable: ${p}
|
|
3
3
|
${l.trim()}`)}catch(l){console.warn(`[stx] Failed to load composable ${o}:`,l)}if(D.length===0||M.size===0)return ue(v,N,u,""),null;let q=[...M].map((o)=>` try { if (!(${JSON.stringify(o)} in __c)) __c[${JSON.stringify(o)}] = ${o}; } catch (e) {}`).join(`
|
|
4
4
|
`),z=JSON.stringify([...M]),j=D.join(`
|
|
5
5
|
|
|
@@ -29,5 +29,5 @@ ${q}
|
|
|
29
29
|
window[__n] = __c[__n];
|
|
30
30
|
__published[__n] = true;
|
|
31
31
|
}
|
|
32
|
-
})();`,G=T()?Rn(O):O;return u=bt(i()),ue(v,N,u,G),B(),G}function
|
|
33
|
-
export{ko,
|
|
32
|
+
})();`,G=T()?Rn(O):O;return u=bt(i()),ue(v,N,u,G),B(),G}function kh(){v.clear(),Wn(),A.clear(),E.clear(),F.clear()}
|
|
33
|
+
export{ko,Sh,kh};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{
|
|
2
|
+
import{Bc,s,me}from"./chunk-b1kc0ka1.js";import{st}from"./chunk-9n8t7v78.js";import{c}from"./chunk-7trdtz0c.js";import o from"fs";import l from"path";var Jf=new Map,m=new Map;async function Xh(e){let n;for(let i=0;i<3;i++)try{let g=(await o.promises.stat(e)).mtime.getTime(),a=m.get(e);if(a&&a.mtime===g)return a.content;let h=await Bun.file(e).text(),w=(await o.promises.stat(e)).mtime.getTime();if(w!==g)continue;return m.set(e,{content:h,mtime:w}),h}catch(r){n=r;break}throw m.delete(e),Error(`File not found: ${e}${n?` (${n.message})`:""}`)}function Jh(e){m.delete(e)}function Yh(e){for(let t of m.keys())if(t.startsWith(e))m.delete(t)}var f=null,B=null,x=null;function Zh(e){x=e}async function Yf(e=!1){let t=x??await import("./chunk-zvra3bmk.js");if(e)return t.generateSignalsRuntimeDev();if(f===null)f=t.generateSignalsRuntime();return f}var S=null;async function Zf(){if(S===null){let{getRouterScript:e}=await import("./chunk-r51bfc2y.js");S=e()}return S}var y={};async function Qh(e,t=!1){let n=e==="runtime"?await Yf(t):await Zf(),i=e==="runtime"&&t?"runtime-debug":e,r=y[i];if(!r||r.content!==n)r={content:n,hash:Bun.hash(n).toString(16).padStart(16,"0").slice(0,16)},y[i]=r;return{content:n,hash:r.hash,url:`/_stx/${e}.${r.hash}.js`}}var E=500,T=33554432,u=new Map,p=0;function C(e){return c(process.cwd(),"module-bundles",`${e}.js`)}function ey(e){let t=Bun.hash(e).toString(16).padStart(16,"0").slice(0,16),n=u.get(t),i=n!==void 0;if(i)u.delete(t),p-=n.length*2;u.set(t,e),p+=e.length*2;while(u.size>1&&(u.size>E||p>T)){let r=u.keys().next().value;p-=u.get(r).length*2,u.delete(r)}if(!i)try{let r=C(t);if(!o.existsSync(r))o.mkdirSync(l.dirname(r),{recursive:!0}),o.writeFileSync(r,e)}catch{}return`/_stx/modules.${t}.js`}function Qo(e){if(!/^[0-9a-f]{16}$/.test(e))return;let t=u.get(e);if(t!==void 0)return t;try{return o.readFileSync(C(e),"utf8")}catch{return}}function ty(){m.clear(),me(),Bc(),f=null,B=null,S=null}function v(e){let t={debug:e.debug===!0,middleware:(e.middleware??[]).map((n)=>({name:n.name,timing:n.timing,handler:String(n.handler)})),customDirectives:(e.customDirectives??[]).map((n)=>({name:n.name,hasEndTag:n.hasEndTag===!0,rawParams:n.rawParams===!0,handler:String(n.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(t)).digest("hex")}async function fr(e,t){try{if(!t.cachePath)return null;let n=l.resolve(t.cachePath),i=l.join(n,`${ks(e)}.html`),r=l.join(n,`${ks(e)}.meta.json`);if(!await s(i)||!await s(r))return null;let g=await Bun.file(r).text(),a=JSON.parse(g);if(a.cacheVersion!==t.cacheVersion)return null;if(a.engine!==st())return null;if(a.optionsSignature!==v(t))return null;if((await o.promises.stat(e)).mtime.getTime()>a.mtime)return null;for(let d of a.dependencies)if(await s(d)){if((await o.promises.stat(d)).mtime.getTime()>a.mtime)return null}else return null;return await Bun.file(i).text()}catch(n){return console.warn(`Cache error for ${e}:`,n),null}}async function gr(e,t,n,i){try{if(!i.cachePath)return;let r=l.resolve(i.cachePath);await o.promises.mkdir(r,{recursive:!0});let g=l.join(r,`${ks(e)}.html`),a=l.join(r,`${ks(e)}.meta.json`),h=await o.promises.stat(e);await Bun.write(g,t);let d={sourcePath:e,mtime:h.mtime.getTime(),dependencies:Array.from(n),cacheVersion:i.cacheVersion,engine:st(),optionsSignature:v(i),generatedAt:Date.now()};await Bun.write(a,JSON.stringify(d,null,2)),Jf.set(e,{output:t,mtime:h.mtime.getTime(),dependencies:n})}catch(r){console.warn(`Failed to cache template ${e}:`,r)}}var _=16;function ks(e){return new Bun.CryptoHasher("sha1").update(e).digest("hex").substring(0,_)}
|
|
3
|
+
export{Jf,Xh,Jh,Yh,Zh,Yf,Zf,Qh,ey,Qo,ty,fr,gr,ks};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{iu,au,cu,lu,uu,du,pu,fu,gu,mu,Um}from"./chunk-4yfbd8ny.js";export{iu as createIslandRegistry,Um as default,mu as generateIslandManifest,cu as generatePartialHydrationCSS,du as hydrateAll,uu as hydrateByStrategy,lu as hydrateIsland,pu as isHydrated,fu as onHydrated,au as processPartialHydrationDirectives,gu as processStaticDirectives};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{pt,ft,gt}from"./chunk-1nankvf6.js";import"./chunk-
|
|
2
|
+
import{pt,ft,gt}from"./chunk-1nankvf6.js";import"./chunk-fkh4xece.js";import"./chunk-xppm4cs4.js";import"./chunk-9nh48zvm.js";import{g}from"./chunk-b1kc0ka1.js";import"./chunk-5rxks14t.js";import"./chunk-wjamjgx6.js";import{qt,io,Kt,Yi,dt,Zi,ao,Gt,ea,Xt}from"./chunk-5n7m8vqx.js";import M from"fs";import x from"path";function E(t,e){let r=[x.join(t.root,"stx.config.ts"),x.join(t.root,"stx.config.js"),x.join(t.root,"stx.config.mjs")],s=e.debounceMs??300,o=null,a=[];for(let c of r)try{if(!M.existsSync(c))continue;let n=M.watch(c,(d)=>{if(d==="change"){if(o)clearTimeout(o);o=setTimeout(async()=>{Zi("Config file changed, restarting...");try{await e.onChange()}catch(p){dt(`Failed to restart: ${p}`)}},s)}});a.push(n)}catch{}return{stop(){if(o)clearTimeout(o);for(let c of a)c.close()}}}import w from"fs";import j from"path";var nt=".stx/story/analytics.json",st=1,A=1e4;class k{storage;storagePath;currentSession=null;dirty=!1;viewStartTimes=new Map;constructor(t){this.storagePath=j.join(t,nt),this.storage=this.loadStorage(),this.startSession()}loadStorage(){try{let t=w.readFileSync(this.storagePath,"utf-8");return JSON.parse(t)}catch{return{version:st,events:[],sessions:[]}}}async save(){if(!this.dirty)return;let t=j.dirname(this.storagePath);if(await w.promises.mkdir(t,{recursive:!0}),this.storage.events.length>A)this.storage.events=this.storage.events.slice(-A);await w.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}startSession(){this.endSession(),this.currentSession={id:at(),startTime:Date.now(),componentViews:[]},this.storage.sessions.push(this.currentSession),this.dirty=!0}endSession(){if(this.currentSession)this.currentSession.endTime=Date.now(),this.currentSession=null}track(t){this.storage.events.push({...t,timestamp:Date.now()}),this.dirty=!0}trackView(t,e){if(this.endViewTiming(t),this.viewStartTimes.set(t,Date.now()),this.track({type:"view",componentId:t,variantId:e}),this.currentSession&&!this.currentSession.componentViews.includes(t))this.currentSession.componentViews.push(t)}endViewTiming(t){let e=this.viewStartTimes.get(t);if(e){let r=Date.now()-e;this.track({type:"view",componentId:t,metadata:{duration:r,endView:!0}}),this.viewStartTimes.delete(t)}}trackPropChange(t,e,r){this.track({type:"prop_change",componentId:t,propName:e,metadata:{value:r}})}trackVariantSwitch(t,e){this.track({type:"variant_switch",componentId:t,variantId:e})}trackSearch(t,e){this.track({type:"search",query:t,metadata:{resultCount:e}})}getComponentAnalytics(t,e){let r=this.storage.events.filter((i)=>i.componentId===t),s=r.filter((i)=>i.type==="view"&&!i.metadata?.endView),o=r.filter((i)=>i.type==="prop_change"),a=r.filter((i)=>i.type==="variant_switch"),c={};for(let i of o)if(i.propName)c[i.propName]=(c[i.propName]||0)+1;let n={};for(let i of a)if(i.variantId)n[i.variantId]=(n[i.variantId]||0)+1;let d=new Set(this.storage.sessions.filter((i)=>i.componentViews.includes(t)).map((i)=>i.id)),p=r.filter((i)=>i.metadata?.duration).map((i)=>i.metadata.duration),u=p.length>0?p.reduce((i,l)=>i+l,0)/p.length:0,y=Object.entries(c).sort((i,l)=>l[1]-i[1]).slice(0,5).map(([i])=>i);return{componentId:t,componentName:e,viewCount:s.length,uniqueViews:d.size,lastViewed:s[s.length-1]?.timestamp,propChanges:c,topChangedProps:y,variantViews:n,avgTimeSpent:u}}getMostViewedComponents(t=10){let e=new Map;for(let r of this.storage.events)if(r.type==="view"&&r.componentId&&!r.metadata?.endView)e.set(r.componentId,(e.get(r.componentId)||0)+1);return Array.from(e.entries()).map(([r,s])=>({componentId:r,viewCount:s})).sort((r,s)=>s.viewCount-r.viewCount).slice(0,t)}getMostChangedProps(t=10){let e=new Map;for(let r of this.storage.events)if(r.type==="prop_change"&&r.propName)e.set(r.propName,(e.get(r.propName)||0)+1);return Array.from(e.entries()).map(([r,s])=>({propName:r,changeCount:s})).sort((r,s)=>s.changeCount-r.changeCount).slice(0,t)}getSearchAnalytics(){let t=this.storage.events.filter((o)=>o.type==="search"),e=new Map,r=0;for(let o of t){if(o.query)e.set(o.query,(e.get(o.query)||0)+1);if(o.metadata?.resultCount!==void 0)r+=o.metadata.resultCount}let s=Array.from(e.entries()).map(([o,a])=>({query:o,count:a})).sort((o,a)=>a.count-o.count).slice(0,10);return{totalSearches:t.length,topQueries:s,avgResultCount:t.length>0?r/t.length:0}}clear(){this.storage.events=[],this.storage.sessions=[],this.dirty=!0,this.startSession()}exportAnalytics(){return JSON.stringify({exportedAt:Date.now(),...this.storage},null,2)}}function at(){return`session-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import S from"fs";import B from"path";var it=".stx/story/bookmarks.json",ct=1;class P{storage;storagePath;dirty=!1;constructor(t){this.storagePath=B.join(t,it),this.storage=this.loadStorage()}loadStorage(){try{let t=S.readFileSync(this.storagePath,"utf-8");return JSON.parse(t)}catch{return{version:ct,bookmarks:[]}}}async save(){if(!this.dirty)return;let t=B.dirname(this.storagePath);await S.promises.mkdir(t,{recursive:!0}),await S.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}addBookmark(t,e,r,s={}){let o={id:lt(),name:s.name||`${t}/${e}`,storyId:t,variantId:e,props:r,created:Date.now(),notes:s.notes,color:s.color};return this.storage.bookmarks.push(o),this.dirty=!0,o}getAllBookmarks(){return[...this.storage.bookmarks]}getBookmarksForStory(t){return this.storage.bookmarks.filter((e)=>e.storyId===t)}getBookmark(t){return this.storage.bookmarks.find((e)=>e.id===t)}isBookmarked(t,e){return this.storage.bookmarks.some((r)=>r.storyId===t&&r.variantId===e)}updateBookmark(t,e){let r=this.getBookmark(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deleteBookmark(t){let e=this.storage.bookmarks.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.bookmarks.splice(e,1),this.dirty=!0,!0}toggleBookmark(t,e,r){let s=this.storage.bookmarks.find((a)=>a.storyId===t&&a.variantId===e);if(s)return this.deleteBookmark(s.id),{added:!1};return{added:!0,bookmark:this.addBookmark(t,e,r)}}exportBookmarks(){return JSON.stringify(this.storage,null,2)}importBookmarks(t,e=!0){let r=JSON.parse(t),s=0;for(let o of r.bookmarks){if(e){let a=this.storage.bookmarks.find((c)=>c.id===o.id);if(a)Object.assign(a,o);else this.storage.bookmarks.push(o)}else this.storage.bookmarks.push(o);s++}if(s>0)this.dirty=!0;return s}}function lt(){return`bm-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}var v=new Set;function N(){return{open(t){v.add(t),t.send(JSON.stringify({type:"connected",timestamp:Date.now()}))},close(t){v.delete(t)},message(t,e){}}}function C(t){let e=JSON.stringify({...t,timestamp:t.timestamp||Date.now()});for(let r of v)try{r.send(e)}catch{v.delete(r)}}function V(t,e){C({type:"story-update",data:{storyId:t,...e}})}function H(t,e){C({type:"story-add",data:{storyId:t,...e}})}function O(t){C({type:"story-remove",data:{storyId:t}})}function F(t){return`
|
|
3
3
|
<script>
|
|
4
4
|
(function() {
|
|
5
5
|
const ws = new WebSocket('${t}');
|
|
@@ -556,9 +556,9 @@ window.__stxPerformance = {
|
|
|
556
556
|
|
|
557
557
|
window.clearPerformanceMetrics = () => window.__stxPerformance.clear();
|
|
558
558
|
</script>
|
|
559
|
-
`}import T from"fs";import K from"path";var ut=".stx/story/presets.json",R=1,yt=10;class I{storage;storagePath;dirty=!1;constructor(t){this.storagePath=K.join(t,ut),this.storage=this.loadStorage()}loadStorage(){try{let t=T.readFileSync(this.storagePath,"utf-8"),e=JSON.parse(t);if(e.version!==R)return this.migrateStorage(e);return e}catch{return{version:R,presets:[],recentIds:[]}}}migrateStorage(t){return{version:R,presets:t.presets||[],recentIds:t.recentIds||[]}}async save(){if(!this.dirty)return;let t=K.dirname(this.storagePath);await T.promises.mkdir(t,{recursive:!0}),await T.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}createPreset(t,e,r={}){let s={id:ht(),name:t,description:r.description,props:e,componentId:r.componentId,created:Date.now(),usageCount:0,tags:r.tags};return this.storage.presets.push(s),this.dirty=!0,s}getPreset(t){return this.storage.presets.find((e)=>e.id===t)}getAllPresets(){return[...this.storage.presets]}getPresetsForComponent(t){return this.storage.presets.filter((e)=>!e.componentId||e.componentId===t)}getRecentPresets(){return this.storage.recentIds.map((t)=>this.getPreset(t)).filter((t)=>t!==void 0)}usePreset(t){let e=this.getPreset(t);if(!e)return;return e.lastUsed=Date.now(),e.usageCount++,this.storage.recentIds=[t,...this.storage.recentIds.filter((r)=>r!==t)].slice(0,yt),this.dirty=!0,e}updatePreset(t,e){let r=this.getPreset(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deletePreset(t){let e=this.storage.presets.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.presets.splice(e,1),this.storage.recentIds=this.storage.recentIds.filter((r)=>r!==t),this.dirty=!0,!0}searchPresets(t){let e=t.toLowerCase();return this.storage.presets.filter((r)=>{if(r.name.toLowerCase().includes(e))return!0;if(r.description?.toLowerCase().includes(e))return!0;if(r.tags?.some((s)=>s.toLowerCase().includes(e)))return!0;return!1})}getMostUsedPresets(t=5){return[...this.storage.presets].sort((e,r)=>r.usageCount-e.usageCount).slice(0,t)}exportPresets(t){let e=t?this.storage.presets.filter((r)=>t.includes(r.id)):this.storage.presets;return JSON.stringify({presets:e},null,2)}importPresets(t,e=!1){let r=JSON.parse(t),s=0;for(let o of r.presets){let a=this.storage.presets.find((c)=>c.id===o.id);if(a&&!e)continue;if(a)Object.assign(a,o);else this.storage.presets.push(o);s++}if(s>0)this.dirty=!0;return s}}function ht(){return`preset-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import _ from"fs";var q=new Map;async function b(t,e,r={}){let s=performance.now(),o=[];try{let a=await _.promises.stat(e),c=q.get(e),n;if(c&&c.mtime===a.mtimeMs)n=c.content;else n=await _.promises.readFile(e,"utf-8"),q.set(e,{content:n,mtime:a.mtimeMs,analyzed:null});let{processDirectives:d}=await import("./chunk-
|
|
559
|
+
`}import T from"fs";import K from"path";var ut=".stx/story/presets.json",R=1,yt=10;class I{storage;storagePath;dirty=!1;constructor(t){this.storagePath=K.join(t,ut),this.storage=this.loadStorage()}loadStorage(){try{let t=T.readFileSync(this.storagePath,"utf-8"),e=JSON.parse(t);if(e.version!==R)return this.migrateStorage(e);return e}catch{return{version:R,presets:[],recentIds:[]}}}migrateStorage(t){return{version:R,presets:t.presets||[],recentIds:t.recentIds||[]}}async save(){if(!this.dirty)return;let t=K.dirname(this.storagePath);await T.promises.mkdir(t,{recursive:!0}),await T.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}createPreset(t,e,r={}){let s={id:ht(),name:t,description:r.description,props:e,componentId:r.componentId,created:Date.now(),usageCount:0,tags:r.tags};return this.storage.presets.push(s),this.dirty=!0,s}getPreset(t){return this.storage.presets.find((e)=>e.id===t)}getAllPresets(){return[...this.storage.presets]}getPresetsForComponent(t){return this.storage.presets.filter((e)=>!e.componentId||e.componentId===t)}getRecentPresets(){return this.storage.recentIds.map((t)=>this.getPreset(t)).filter((t)=>t!==void 0)}usePreset(t){let e=this.getPreset(t);if(!e)return;return e.lastUsed=Date.now(),e.usageCount++,this.storage.recentIds=[t,...this.storage.recentIds.filter((r)=>r!==t)].slice(0,yt),this.dirty=!0,e}updatePreset(t,e){let r=this.getPreset(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deletePreset(t){let e=this.storage.presets.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.presets.splice(e,1),this.storage.recentIds=this.storage.recentIds.filter((r)=>r!==t),this.dirty=!0,!0}searchPresets(t){let e=t.toLowerCase();return this.storage.presets.filter((r)=>{if(r.name.toLowerCase().includes(e))return!0;if(r.description?.toLowerCase().includes(e))return!0;if(r.tags?.some((s)=>s.toLowerCase().includes(e)))return!0;return!1})}getMostUsedPresets(t=5){return[...this.storage.presets].sort((e,r)=>r.usageCount-e.usageCount).slice(0,t)}exportPresets(t){let e=t?this.storage.presets.filter((r)=>t.includes(r.id)):this.storage.presets;return JSON.stringify({presets:e},null,2)}importPresets(t,e=!1){let r=JSON.parse(t),s=0;for(let o of r.presets){let a=this.storage.presets.find((c)=>c.id===o.id);if(a&&!e)continue;if(a)Object.assign(a,o);else this.storage.presets.push(o);s++}if(s>0)this.dirty=!0;return s}}function ht(){return`preset-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import _ from"fs";var q=new Map;async function b(t,e,r={}){let s=performance.now(),o=[];try{let a=await _.promises.stat(e),c=q.get(e),n;if(c&&c.mtime===a.mtimeMs)n=c.content;else n=await _.promises.readFile(e,"utf-8"),q.set(e,{content:n,mtime:a.mtimeMs,analyzed:null});let{processDirectives:d}=await import("./chunk-ykxpzjgy.js"),p={},u=h(n);if(u)try{await g(u,p,e)}catch(f){o.push(`Warning: Could not extract script variables: ${f instanceof Error?f.message:String(f)}`)}if(r.props)Object.assign(p,r.props);let i=await d(n,p,e,{},new Set),l=Z(n),m=h(n);return i=Q(i),i=tt(i,p),{html:i,css:l,js:m,errors:o,duration:performance.now()-s}}catch(a){return o.push(a instanceof Error?a.message:String(a)),{html:`<div class="stx-render-error">${et(o[0])}</div>`,css:"",js:"",errors:o,duration:performance.now()-s}}}async function vt(t){try{let e=await _.promises.readFile(t,"utf-8"),r=h(e);if(!r)return null;let s={};if(await g(r,s,t),Array.isArray(s.variants))return s.variants;return null}catch{return null}}async function Y(t,e,r,s){let o=e.story?.variants;if(!o){let n=await vt(e.path);if(n)o=n}if(!o&&r==="default")return b(t,e.path,{props:s||{}});if(!o)return b(t,e.path,{props:s||{}});let a=o.find((n)=>n.id===r);if(!a&&r==="default")return b(t,e.path,{props:s||{}});if(!a)return{html:'<div class="stx-render-error">Variant not found</div>',css:"",js:"",errors:[`Variant '${r}' not found`],duration:0};let c={...a.state,...s};if(a.source)return bt(t,a.source,c);return b(t,e.path,{props:c})}async function bt(t,e,r={}){let s=performance.now(),o=[];try{let{processDirectives:a}=await import("./chunk-ykxpzjgy.js"),c={...r},n=h(e);if(n)try{await g(n,c,"inline-template.stx")}catch{}let p=await a(e,c,"inline-template.stx",{},new Set);return p=Q(p),p=tt(p,c),{html:p,css:Z(e),js:h(e),errors:o,duration:performance.now()-s}}catch(a){return o.push(a instanceof Error?a.message:String(a)),{html:`<div class="stx-render-error">${et(o[0])}</div>`,css:"",js:"",errors:o,duration:performance.now()-s}}}function Z(t){let e=[],r=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,s=r.exec(t);while(s!==null)e.push(s[1].trim()),s=r.exec(t);return e.join(`
|
|
560
560
|
`)}function Q(t){return t.replace(/<!--[\s\S]*?-->/g,"").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"").replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/^\s*\n/gm,"").trim()}function h(t){let e=[],r=/<script\b[^>]*>([\s\S]*?)<\/script>/gi,s=r.exec(t);while(s!==null)e.push(s[1].trim()),s=r.exec(t);return e.join(`
|
|
561
|
-
`)}function tt(t,e){let r=`<script>window.__stxProps = ${JSON.stringify(e)};</script>`;return t+r}function et(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}async function rt(t,e){let r=await Gt(t);ft(t,r);let s=Xt(t.config,r);gt(t,s),console.log(` Found ${r.length} story files`);let o=typeof e.host==="string"?e.host:e.host===!0?"0.0.0.0":"localhost",a=new I(t.root),c=new P(t.root),n=new k(t.root),d=N(),p=Bun.serve({port:e.port,hostname:o,fetch:async(i,l)=>{let f=new URL(i.url).pathname;if(f==="/__hmr"){if(l.upgrade(i,{data:{isHmr:!0}}))return;return new Response("WebSocket upgrade failed",{status:400})}if(f.startsWith("/api/"))return xt(t,f,i,{presetsManager:a,bookmarksManager:c,analyticsTracker:n});return wt(t,f,e.port)},websocket:{open(i){d.open(i)},close(i){d.close(i)},message(i,l){d.message(i,l)}}}),u=`http://${o}:${e.port}`,y=
|
|
561
|
+
`)}function tt(t,e){let r=`<script>window.__stxProps = ${JSON.stringify(e)};</script>`;return t+r}function et(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}async function rt(t,e){let r=await Gt(t);ft(t,r);let s=Xt(t.config,r);gt(t,s),console.log(` Found ${r.length} story files`);let o=typeof e.host==="string"?e.host:e.host===!0?"0.0.0.0":"localhost",a=new I(t.root),c=new P(t.root),n=new k(t.root),d=N(),p=Bun.serve({port:e.port,hostname:o,fetch:async(i,l)=>{let f=new URL(i.url).pathname;if(f==="/__hmr"){if(l.upgrade(i,{data:{isHmr:!0}}))return;return new Response("WebSocket upgrade failed",{status:400})}if(f.startsWith("/api/"))return xt(t,f,i,{presetsManager:a,bookmarksManager:c,analyticsTracker:n});return wt(t,f,e.port)},websocket:{open(i){d.open(i)},close(i){d.close(i)},message(i,l){d.message(i,l)}}}),u=`http://${o}:${e.port}`,y=ea(t,async(i,l)=>{console.log(` [${i}] ${l.relativePath}`);let m=await Gt(t);ft(t,m);let f=Xt(t.config,m);if(gt(t,f),i==="add")H(l.id,{fileName:l.fileName});else if(i==="unlink")O(l.id);else V(l.id,{fileName:l.fileName})});if(e.open){let i=u;try{let{exec:l}=await import("child_process"),m=process.platform;l(`${m==="darwin"?"open":m==="win32"?"start":"xdg-open"} ${i}`)}catch{}}return{server:p,url:u,close:async()=>{y(),p.stop()}}}async function xt(t,e,r,s){let{presetsManager:o,bookmarksManager:a,analyticsTracker:c}=s;if(e==="/api/stories")return Response.json({files:t.storyFiles.map((n)=>({id:n.id,fileName:n.fileName,relativePath:n.relativePath,treePath:n.treePath})),tree:t.tree});if(e.startsWith("/api/story/")){let n=e.slice(11),d=t.storyFiles.find((p)=>p.id===n);if(!d)return new Response("Story not found",{status:404});try{let p=await Bun.file(d.path).text();return Response.json({id:d.id,fileName:d.fileName,relativePath:d.relativePath,content:p})}catch{return new Response("Error reading story",{status:500})}}if(e==="/api/config")return Response.json({theme:t.config.theme,responsivePresets:t.config.responsivePresets,backgroundPresets:t.config.backgroundPresets});if(e.startsWith("/api/render/")){let n=new URL(r.url),d=e.slice(12).split("/"),p=d[0],u=d[1]||"default",y,i=n.searchParams.get("props");if(i)try{y=JSON.parse(i)}catch{}let l=t.storyFiles.find((m)=>m.id===p);if(!l)return new Response("Story not found",{status:404});try{let m=await Y(t,l,u,y);return Response.json({html:m.html,css:m.css,js:m.js,errors:m.errors,duration:m.duration})}catch(m){return Response.json({html:"",css:"",js:"",errors:[m instanceof Error?m.message:String(m)],duration:0},{status:500})}}if(e==="/api/presets"&&r.method==="GET")return Response.json({presets:o.getAllPresets()});if(e==="/api/presets"&&r.method==="POST")try{let n=await r.json(),d=o.createPreset(n.name,n.props,{componentId:n.componentId,description:n.description});return await o.save(),Response.json(d)}catch(n){return Response.json({error:String(n)},{status:400})}if(e.startsWith("/api/presets/")&&!e.includes("/use")&&r.method==="GET"){let n=e.slice(13),d=o.getPreset(n);if(!d)return new Response("Preset not found",{status:404});return Response.json(d)}if(e.endsWith("/use")&&r.method==="POST"){let n=e.slice(13,-4),d=o.usePreset(n);if(!d)return new Response("Preset not found",{status:404});return await o.save(),Response.json(d)}if(e.startsWith("/api/presets/")&&r.method==="DELETE"){let n=e.slice(13);if(!o.deletePreset(n))return new Response("Preset not found",{status:404});return await o.save(),Response.json({success:!0})}if(e==="/api/bookmarks"&&r.method==="GET")return Response.json({bookmarks:a.getAllBookmarks()});if(e==="/api/bookmarks"&&r.method==="POST")try{let n=await r.json(),d=a.addBookmark(n.storyId,n.variantId,n.props,{name:n.name,notes:n.notes,color:n.color});return await a.save(),Response.json(d)}catch(n){return Response.json({error:String(n)},{status:400})}if(e==="/api/bookmarks/toggle"&&r.method==="POST")try{let n=await r.json(),d=a.toggleBookmark(n.storyId,n.variantId,n.props);return await a.save(),Response.json(d)}catch(n){return Response.json({error:String(n)},{status:400})}if(e.startsWith("/api/bookmarks/")&&e!=="/api/bookmarks/toggle"&&r.method==="GET"){let n=e.slice(15),d=a.getBookmark(n);if(!d)return new Response("Bookmark not found",{status:404});return Response.json(d)}if(e.startsWith("/api/bookmarks/")&&r.method==="DELETE"){let n=e.slice(15);if(!a.deleteBookmark(n))return new Response("Bookmark not found",{status:404});return await a.save(),Response.json({success:!0})}if(e==="/api/analytics/track"&&r.method==="POST")try{let n=await r.json();if(n.type==="view"&&n.componentId)c.trackView(n.componentId,n.variantId);else if(n.type==="prop_change"&&n.componentId&&n.propName)c.trackPropChange(n.componentId,n.propName,null);else if(n.type==="variant_switch"&&n.componentId&&n.variantId)c.trackVariantSwitch(n.componentId,n.variantId);else if(n.type==="search"&&n.query)c.trackSearch(n.query,0);return await c.save(),Response.json({success:!0})}catch(n){return Response.json({error:String(n)},{status:400})}if(e==="/api/analytics/summary"&&r.method==="GET")return Response.json({mostViewed:c.getMostViewedComponents(10),mostChangedProps:c.getMostChangedProps(10),searchAnalytics:c.getSearchAnalytics()});if(e.startsWith("/api/analytics/component/")&&r.method==="GET"){let n=e.slice(25),d=t.storyFiles.find((u)=>u.id===n),p=c.getComponentAnalytics(n,d?.fileName||n);return Response.json(p)}return new Response("Not found",{status:404})}function wt(t,e,r){let s=kt(t,r);return new Response(s,{headers:{"Content-Type":"text/html; charset=utf-8"}})}function kt(t,e){let{theme:r}=t.config,s=r.title||"STX Story",o=`ws://localhost:${e}/__hmr`,a=F(o);return`<!DOCTYPE html>
|
|
562
562
|
<html lang="en" class="${r.darkClass||"dark"}">
|
|
563
563
|
<head>
|
|
564
564
|
<meta charset="UTF-8">
|
|
@@ -1277,4 +1277,4 @@ else {
|
|
|
1277
1277
|
${D()}
|
|
1278
1278
|
</body>
|
|
1279
1279
|
</html>`}import St from"fs";import Pt from"path";var Ct=new Map,Tt=[],Rt=[],It=new Map;async function ot(t){let e=t.config.setupFile;if(!e)return;let r=Pt.resolve(t.root,e);try{await St.promises.access(r)}catch{return}let s={storyContext:t,registerComponent:(o,a)=>{Ct.set(o,a)},addCSS:(o)=>{Tt.push(o)},addScript:(o)=>{Rt.push(o)},setState:(o,a)=>{It.set(o,a)}};try{let o=await import(r);if(typeof o.default==="function")await o.default(s);else if(typeof o.setupStory==="function")await o.setupStory(s)}catch(o){console.warn(`Warning: Failed to load setup file: ${o}`)}}async function we(t={}){qt();let e=await pt({mode:"dev"});if(!e.config.enabled){dt("Story feature is disabled in config.");return}await ot(e);let r=t.port??e.config.port,s,o=async()=>{s=await rt(e,{port:r,open:t.open,host:t.host}),Kt(e.storyFiles.length),io(s.url),ao()};await o();let a=E(e,{onChange:async()=>{await s.close();let n=await pt({mode:"dev"});Object.assign(e,n),await o()}}),c=async()=>{console.log(`
|
|
1280
|
-
`),a.stop(),await s.close(),process.exit(0)};if(process.on("SIGINT",c),process.on("SIGTERM",c),process.stdin.isTTY)process.stdin.setRawMode(!0),process.stdin.resume(),process.stdin.on("data",async(n)=>{switch(n.toString()){case"h":ao();break;case"o":try{let{exec:p}=await import("child_process"),u=process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open";p(`${u} ${s.url}`)}catch{
|
|
1280
|
+
`),a.stop(),await s.close(),process.exit(0)};if(process.on("SIGINT",c),process.on("SIGTERM",c),process.stdin.isTTY)process.stdin.setRawMode(!0),process.stdin.resume(),process.stdin.on("data",async(n)=>{switch(n.toString()){case"h":ao();break;case"o":try{let{exec:p}=await import("child_process"),u=process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open";p(`${u} ${s.url}`)}catch{Yi("Failed to open browser")}break;case"r":await s.close(),await o();break;case"c":console.clear(),qt(),Kt(e.storyFiles.length),io(s.url);break;case"q":case"\x03":await c();break}});await new Promise(()=>{})}export{we as devCommand};
|