@stacksjs/stx 0.2.859 → 0.2.861
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/body-close.d.ts +13 -0
- package/dist/body-close.js +8 -0
- package/dist/{chunk-5va6c7jf.js → chunk-02css3vk.js} +5 -5
- package/dist/chunk-0hqr6bff.js +2 -0
- package/dist/{chunk-astcp7bc.js → chunk-121cgm3s.js} +4 -4
- package/dist/{chunk-xytq7q8j.js → chunk-15jymk6t.js} +2 -2
- package/dist/{chunk-gq9h36jf.js → chunk-15rkvc0t.js} +4 -4
- package/dist/chunk-15sgdvyd.js +2 -0
- package/dist/{chunk-fkh4xece.js → chunk-1jwcp2k0.js} +2 -2
- package/dist/{chunk-b1kc0ka1.js → chunk-261t62q4.js} +38 -38
- package/dist/chunk-2b4a8tbd.js +3 -0
- package/dist/chunk-2fw36w1x.js +2 -0
- package/dist/chunk-2jcxsw75.js +2 -0
- package/dist/{chunk-t2nhr2tc.js → chunk-2pbhdaka.js} +1 -1
- package/dist/chunk-2wba5ypm.js +2 -0
- package/dist/chunk-353gnvfe.js +2 -0
- package/dist/{chunk-14h4n1sj.js → chunk-36vksrry.js} +2 -2
- package/dist/{chunk-0es47pwe.js → chunk-37tefp7s.js} +5 -5
- package/dist/{chunk-ktnb1j54.js → chunk-38qp2pg2.js} +2 -2
- package/dist/chunk-3cr5y8v1.js +2 -0
- package/dist/{chunk-g17q4y5k.js → chunk-3gfd9t8a.js} +2 -2
- package/dist/{chunk-ts4t2n6b.js → chunk-3wg9kr5z.js} +4 -4
- package/dist/chunk-3y7yp0ka.js +2 -0
- package/dist/chunk-41wwqw0q.js +2 -0
- package/dist/chunk-4a1y51fs.js +2 -0
- package/dist/chunk-4a751brg.js +2 -0
- package/dist/{chunk-kpsxhm4x.js → chunk-4jgcd4d9.js} +3 -3
- package/dist/{chunk-k8pzk8v9.js → chunk-4rrxrxp6.js} +4 -4
- package/dist/chunk-5awhm4na.js +2 -0
- package/dist/chunk-5fhp9hxd.js +2 -0
- package/dist/{chunk-ywk6t76q.js → chunk-5ka3h8dy.js} +6 -6
- package/dist/chunk-5mg443dw.js +2 -0
- package/dist/{chunk-9qe4qsc7.js → chunk-5neezkj1.js} +4 -4
- package/dist/{chunk-6w5a5ns4.js → chunk-5q4tncfw.js} +5 -5
- package/dist/chunk-5x9ajbq0.js +2 -0
- package/dist/{chunk-gndxakrh.js → chunk-5xdkmn39.js} +2 -2
- package/dist/{chunk-3w3fxcyx.js → chunk-65cbfx5x.js} +2 -2
- package/dist/{chunk-hf9pvmq2.js → chunk-68w65mhs.js} +3 -3
- package/dist/chunk-6g7tkmty.js +2 -0
- package/dist/{chunk-wfd9e224.js → chunk-6nb49h13.js} +9 -9
- package/dist/{chunk-6t0xy3wk.js → chunk-6tp0w6hf.js} +2 -2
- package/dist/chunk-72bj7ea4.js +2 -0
- package/dist/{chunk-tc31my2p.js → chunk-74g64pzt.js} +4 -4
- package/dist/{chunk-0yw86e75.js → chunk-76360zky.js} +5 -5
- package/dist/{chunk-wdcz6d20.js → chunk-7bajrfb1.js} +2 -2
- package/dist/{chunk-2kc0vsnb.js → chunk-7de5y29a.js} +5 -5
- package/dist/{chunk-cj9rev2p.js → chunk-7yhhwv07.js} +2 -2
- package/dist/chunk-811hh6vp.js +2 -0
- package/dist/{chunk-9nh48zvm.js → chunk-830ej8d2.js} +9 -9
- package/dist/chunk-8fkmxrat.js +2 -0
- package/dist/{chunk-dbm963p9.js → chunk-8hck9qqm.js} +4 -4
- package/dist/chunk-8p9npc8y.js +2 -0
- package/dist/chunk-9fz3h6sx.js +2 -0
- package/dist/chunk-9jr30fns.js +2 -0
- package/dist/{chunk-2sq9pdg3.js → chunk-9pyvc0dc.js} +2 -2
- package/dist/{chunk-4yfbd8ny.js → chunk-9syvkm5z.js} +6 -6
- package/dist/{chunk-a9c3gndq.js → chunk-a6d92kv6.js} +2 -2
- package/dist/chunk-a9m6ajd7.js +2 -0
- package/dist/{chunk-403a4pqm.js → chunk-aj6vqdf7.js} +3 -3
- package/dist/chunk-asr5v51s.js +2 -0
- package/dist/{chunk-v9h7s8ce.js → chunk-avp271q4.js} +1 -1
- package/dist/{chunk-3248qphb.js → chunk-b1tctqn5.js} +6 -6
- package/dist/{chunk-8mdhencj.js → chunk-b7nmgkwa.js} +3 -3
- package/dist/{chunk-6e44f8w8.js → chunk-bag9q4m0.js} +30 -30
- package/dist/{chunk-7m17m22p.js → chunk-bg0ywp5w.js} +2 -2
- package/dist/{chunk-aq8r4rbs.js → chunk-bv14vry8.js} +2 -2
- package/dist/chunk-byx82s10.js +2 -0
- package/dist/{chunk-q3cyycnh.js → chunk-c2w4wc9f.js} +1 -1
- package/dist/chunk-c9y1g61m.js +2 -0
- package/dist/chunk-ck5nzbbv.js +2 -0
- package/dist/{chunk-yd6ej23e.js → chunk-cq2hedwn.js} +5 -5
- package/dist/chunk-cvdm0hgq.js +2 -0
- package/dist/{chunk-6mza6zr3.js → chunk-d6216bcw.js} +3 -3
- package/dist/{chunk-s4592dy0.js → chunk-dba4bwkd.js} +6 -6
- package/dist/{chunk-rgjjt1mb.js → chunk-dt73ww6m.js} +1 -1
- package/dist/chunk-e0fxgbcc.js +2 -0
- package/dist/{chunk-49j3cn9h.js → chunk-e8nzbz66.js} +2 -2
- package/dist/chunk-ed2m6pjf.js +2 -0
- package/dist/chunk-ednwdhv0.js +2 -0
- package/dist/chunk-egtphftq.js +2 -0
- package/dist/{chunk-2w7csg0c.js → chunk-eye156nv.js} +1 -1
- package/dist/chunk-fahqq7c4.js +2 -0
- package/dist/chunk-fcbpzdyz.js +2 -0
- package/dist/{chunk-x9c4njvx.js → chunk-fyfvqd2s.js} +2 -2
- package/dist/{chunk-1v95w26e.js → chunk-gc79s0wh.js} +9 -9
- package/dist/{chunk-9a3rv0rj.js → chunk-gggadrs4.js} +2 -2
- package/dist/{chunk-vj1bwnvs.js → chunk-gjnrmz2q.js} +2 -2
- package/dist/{chunk-w1d8t47c.js → chunk-gp1dt8b8.js} +3 -3
- package/dist/{chunk-5t1k0dxm.js → chunk-gx96hctv.js} +2 -2
- package/dist/chunk-h0dsxxz4.js +2 -0
- package/dist/{chunk-1hebvmaj.js → chunk-h2cvfp9y.js} +1 -1
- package/dist/{chunk-ews9yzr7.js → chunk-h4aqpf2r.js} +3 -3
- package/dist/{chunk-52b6czss.js → chunk-hyea17hp.js} +69 -69
- package/dist/chunk-k3yym9zg.js +2 -0
- package/dist/chunk-k9fsd6t3.js +2 -0
- package/dist/chunk-kepxsjfx.js +2 -0
- package/dist/chunk-kh01rvag.js +2 -0
- package/dist/{chunk-qd87dk1d.js → chunk-kv40xq53.js} +14 -14
- package/dist/{chunk-m1qqqc2j.js → chunk-m3p4hksq.js} +2 -2
- package/dist/chunk-mad172af.js +2 -0
- package/dist/{chunk-kvc9cwvx.js → chunk-mjkdskeg.js} +1 -1
- package/dist/{chunk-wjamjgx6.js → chunk-naj146zq.js} +1 -1
- package/dist/chunk-npt0mdzb.js +2 -0
- package/dist/{chunk-shke1fcm.js → chunk-nwxjh1gv.js} +3 -3
- package/dist/chunk-ptc3yqn3.js +2 -0
- package/dist/chunk-pybm7c9p.js +2 -0
- package/dist/{chunk-xpg52hsz.js → chunk-q6w7a1vc.js} +3 -3
- package/dist/{chunk-26jt4jvh.js → chunk-qjm23ma2.js} +1 -1
- package/dist/chunk-qnx71b17.js +2 -0
- package/dist/chunk-qx8cav4w.js +2 -0
- package/dist/chunk-rb7cwck6.js +2 -0
- package/dist/chunk-s1e0t3hv.js +2 -0
- package/dist/chunk-s7vfmasx.js +2 -0
- package/dist/{chunk-jd4dr23j.js → chunk-scwbttvt.js} +2 -2
- package/dist/{chunk-7trdtz0c.js → chunk-sxtvy0sm.js} +2 -2
- package/dist/chunk-t7z67vf6.js +2 -0
- package/dist/{chunk-qttq8cje.js → chunk-tarvase5.js} +1 -1
- package/dist/{chunk-qgxwf9xr.js → chunk-thdnk1kd.js} +3 -3
- package/dist/{chunk-ftwdjgzd.js → chunk-tjz3r7rj.js} +5 -5
- package/dist/{chunk-yehdcjn1.js → chunk-tm201m9x.js} +2 -2
- package/dist/chunk-tqs9pcga.js +2 -0
- package/dist/chunk-twjfrywv.js +2 -0
- package/dist/{chunk-rwxg4m3h.js → chunk-v0wdgxga.js} +1 -1
- package/dist/{chunk-p9jfn4yh.js → chunk-vggtxttf.js} +5 -5
- package/dist/chunk-vyna2rsq.js +2 -0
- package/dist/chunk-w4gjx2zs.js +18 -0
- package/dist/{chunk-v4rrgphj.js → chunk-wrbhq1y2.js} +3 -3
- package/dist/{chunk-4a0x737h.js → chunk-x69457q9.js} +4 -4
- package/dist/chunk-xhe7pw6e.js +2 -0
- package/dist/{chunk-33x46g87.js → chunk-xmy6g81m.js} +1 -1
- package/dist/chunk-y86mpnrg.js +2 -0
- package/dist/{chunk-ypgegzh2.js → chunk-yj9nyt93.js} +2 -2
- package/dist/{chunk-w1stsxm3.js → chunk-z99bf0q0.js} +2 -2
- package/dist/chunk-zm0g7ntw.js +2 -0
- package/dist/{chunk-618t6hxp.js → chunk-zpkgs5d3.js} +4 -4
- package/dist/chunk-zrm2x65c.js +2 -0
- package/dist/{chunk-fxxh149b.js → chunk-zs4s9fcq.js} +4 -4
- package/dist/cli.js +13 -13
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/pwa.js +3 -3
- package/dist/render.js +2 -6
- package/dist/serve.js +2 -6
- package/dist/site-builder/build.js +2 -2
- package/dist/site-builder/router.js +2 -5
- package/dist/site-builder/theme.js +2 -2
- package/dist/ssg.js +4 -4
- package/package.json +5 -5
- package/dist/chunk-13fe3avf.js +0 -2
- package/dist/chunk-1p47cg0g.js +0 -2
- package/dist/chunk-1z46g29d.js +0 -2
- package/dist/chunk-228cbw2p.js +0 -2
- package/dist/chunk-2bggrzv0.js +0 -2
- package/dist/chunk-2dnd2s2a.js +0 -3
- package/dist/chunk-34rh88vd.js +0 -2
- package/dist/chunk-3cqp0m62.js +0 -2
- package/dist/chunk-3dtzcc9j.js +0 -2
- package/dist/chunk-3rgqrs3c.js +0 -2
- package/dist/chunk-51kb36f7.js +0 -2
- package/dist/chunk-53ezn1tw.js +0 -2
- package/dist/chunk-636j1nmd.js +0 -2
- package/dist/chunk-756rpwn0.js +0 -2
- package/dist/chunk-7pq02v7n.js +0 -2
- package/dist/chunk-7sht1rkv.js +0 -2
- package/dist/chunk-9rgp005c.js +0 -2
- package/dist/chunk-azvx5gaa.js +0 -2
- package/dist/chunk-ebk1723c.js +0 -2
- package/dist/chunk-emc7zqry.js +0 -2
- package/dist/chunk-eppv6knk.js +0 -2
- package/dist/chunk-f935fec7.js +0 -2
- package/dist/chunk-g0v1shhr.js +0 -2
- package/dist/chunk-g5pg0pg1.js +0 -2
- package/dist/chunk-g8x32bq2.js +0 -2
- package/dist/chunk-g978f9qg.js +0 -18
- package/dist/chunk-hk7vjyqa.js +0 -2
- package/dist/chunk-jmaw2cdt.js +0 -2
- package/dist/chunk-jw75rmpw.js +0 -2
- package/dist/chunk-m3fq72f8.js +0 -2
- package/dist/chunk-n54twtm7.js +0 -2
- package/dist/chunk-np6y9evb.js +0 -2
- package/dist/chunk-pk0mxjxw.js +0 -2
- package/dist/chunk-q9r13taa.js +0 -2
- package/dist/chunk-qqjhq0hb.js +0 -2
- package/dist/chunk-qsjkewah.js +0 -2
- package/dist/chunk-qw80eta1.js +0 -2
- package/dist/chunk-r51bfc2y.js +0 -2
- package/dist/chunk-rbrvepr3.js +0 -2
- package/dist/chunk-se4ny3q0.js +0 -2
- package/dist/chunk-sxvv9w8t.js +0 -2
- package/dist/chunk-sy703233.js +0 -2
- package/dist/chunk-syzn6mq5.js +0 -2
- package/dist/chunk-v3r1wwec.js +0 -2
- package/dist/chunk-vd5d1yb9.js +0 -2
- package/dist/chunk-vmdsj8r5.js +0 -2
- package/dist/chunk-vmg3f76h.js +0 -2
- package/dist/chunk-w63c96ce.js +0 -2
- package/dist/chunk-wcgca1q6.js +0 -2
- package/dist/chunk-wv8qmwqp.js +0 -2
- package/dist/chunk-x90f7h2g.js +0 -2
- package/dist/chunk-xhnpgey5.js +0 -2
- package/dist/chunk-y54pj23g.js +0 -2
- package/dist/chunk-yhrkqcqd.js +0 -2
- package/dist/chunk-ykxpzjgy.js +0 -2
- package/dist/chunk-zhyrhxdp.js +0 -2
- package/dist/chunk-zn5tewws.js +0 -2
- package/dist/chunk-zvra3bmk.js +0 -2
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Put markup just before the document's closing `</body>`.
|
|
3
|
+
*
|
|
4
|
+
* The LAST one, never the first. A page's first `</body>` is routinely inside a
|
|
5
|
+
* script: a component that writes a document of its own (a preview frame, a
|
|
6
|
+
* print view) has the tag in a string, and so do the router and x-element
|
|
7
|
+
* runtimes. Replacing the first match drops the new markup into the middle of
|
|
8
|
+
* that script, which ends it early and leaves the rest of its source on the
|
|
9
|
+
* page as text.
|
|
10
|
+
*
|
|
11
|
+
* Without a `</body>` the markup goes on the end.
|
|
12
|
+
*/
|
|
13
|
+
export declare function insertBeforeBodyClose(html: string, markup: string): string;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{yr}from"./chunk-
|
|
2
|
+
import{yr}from"./chunk-3gfd9t8a.js";import{Pr}from"./chunk-830ej8d2.js";import{a}from"./chunk-6nb49h13.js";import{B,Qe}from"./chunk-pb09xy77.js";import{xc}from"./chunk-7yhhwv07.js";var p=/<style\b[^>]*>/iy,x=/<\/style>/gi,R=/<script\b[^>]*>/iy,b=/<template(?=[\s>/])[^>]*>/iy,S=/<\/template\s*>/iy;function dr(e){let r=0,t=0,s=-1;while(r<e.length){let n=e.indexOf("<",r);if(n===-1)return-1;if(e.startsWith("<!--",n)){let d=e.indexOf("-->",n+4);r=d===-1?e.length:d+3;continue}p.lastIndex=n;let c=p.exec(e);if(c){x.lastIndex=n+c[0].length;let d=x.exec(e);r=d===null?e.length:d.index+8;continue}b.lastIndex=n;let o=b.exec(e);if(o){if(t===0)s=n;t++,r=n+o[0].length;continue}S.lastIndex=n;let u=S.exec(e);if(u){if(t>0)t--;r=n+u[0].length;continue}if(R.lastIndex=n,R.test(e))return t>0?s:n;r=n+1}return-1}function X(e,r={}){return new yr(e,r).routes}import w from"path";var y=new Map;async function h(e,r){let t=e,s=r;if(!t||!s)try{let u=await a();t||=u?.pagesDir||"pages",s||=u?.root||"."}catch{t||="pages",s||="."}let n=w.isAbsolute(t)?t:w.join(s,t),c=y.get(n);if(c)return c;let o=[];try{o=X(".",{pagesDir:n,emit:!1}).map((u)=>u.regex.source).filter(Boolean)}catch{o=[]}return y.set(n,o),o}function O(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function g(e){return O(JSON.stringify(e))}function ve(e){return e.includes("data-stx-runtime")}function wc(e){let r=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let t=r.exec(e);t!==null;t=r.exec(e)){let s=e.slice(Math.max(0,t.index-80),t.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(s))continue;return!0}return!1}function l(e,r){let t=dr(e),s=e.search(/<!doctype\b/i);if(t!==-1&&(s===-1||t>s))return e.slice(0,t)+r+`
|
|
3
3
|
`+e.slice(t);let n=Pr(e);if(n!==null)return`${e.slice(0,n)}
|
|
4
4
|
${r}${e.slice(n)}`;if(e.includes("</head>")){let o=e.indexOf("</head>");return e.slice(0,o)+r+`
|
|
5
5
|
`+e.slice(o)}if(B(e))return Qe(e,(o)=>`${o}
|
|
6
6
|
${r}`);return`${r}
|
|
7
|
-
${e}`}async function pr(e,r){if(e.includes("data-stx-runtime")||e.includes("window.stx.state")||e.includes("STX Signals Runtime"))return e;if(r.buildMode==="serve"){let{getServeClientAsset:n}=await import("./chunk-
|
|
7
|
+
${e}`}async function pr(e,r){if(e.includes("data-stx-runtime")||e.includes("window.stx.state")||e.includes("STX Signals Runtime"))return e;if(r.buildMode==="serve"){let{getServeClientAsset:n}=await import("./chunk-qx8cav4w.js"),{url:c}=await n("runtime",r.debug===!0);return l(e,`<script data-stx-runtime src="${c}"></script>`)}if(r.buildMode==="compile")return l(e,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:t}=await import("./chunk-qx8cav4w.js"),s=await t(r.debug);return l(e,`<script data-stx-scoped data-stx-runtime>${s}</script>`)}function m(e){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(e)}function vc(e){if(e.includes("data-stx-tooltip-runtime")||!m(e))return e;let r=`<script data-stx-scoped data-stx-tooltip-runtime>${xc()}</script>`,t=e.lastIndexOf("</body>");if(t===-1)return`${e}
|
|
8
8
|
${r}`;return`${e.slice(0,t)}${r}
|
|
9
|
-
${e.slice(t)}`}var E=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function C(e){return E.test(e)||e.includes("__stxRouter)return")||e.includes("__stxRouter=true")}async function xe(e,r){if(!e.includes("</body>"))return e;if(C(e))return e;let t=r?.router,s="",n="";{let i={};if(t){if(t.container)i.container=t.container;if(t.interceptAllLinks!==void 0)i.interceptAllLinks=t.interceptAllLinks;if(t.progress!==void 0)i.progress=t.progress;if(t.viewTransitions!==void 0)i.viewTransitions=t.viewTransitions;if(t.viewTransitionDuration!==void 0)i.viewTransitionDuration=t.viewTransitionDuration;if(t.viewTransitionEasing!==void 0)i.viewTransitionEasing=t.viewTransitionEasing;if(t.scrollToTop!==void 0)i.scrollToTop=t.scrollToTop;if(t.scrollRestoration!==void 0)i.scrollRestoration=t.scrollRestoration;if(t.prefetch!==void 0)i.prefetch=t.prefetch;if(t.cache!==void 0)i.cache=t.cache;if(t.progressColor!==void 0)i.progressColor=t.progressColor;if(t.progressHeight!==void 0)i.progressHeight=t.progressHeight;if(t.prefetchVisible!==void 0)i.prefetchVisible=t.prefetchVisible;if(t.prefetchVisibleMax!==void 0)i.prefetchVisibleMax=t.prefetchVisibleMax;if(t.prefetchBudgetBytes!==void 0)i.prefetchBudgetBytes=t.prefetchBudgetBytes;if(t.keepOpening!==void 0)i.keepOpening=t.keepOpening}try{let f=await h(r?.pagesDir,r?.root);if(f.length>0)if(r?.buildMode==="serve"){let{registerServeModuleBundle:T}=await import("./chunk-
|
|
9
|
+
${e.slice(t)}`}var E=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function C(e){return E.test(e)||e.includes("__stxRouter)return")||e.includes("__stxRouter=true")}async function xe(e,r){if(!e.includes("</body>"))return e;if(C(e))return e;let t=r?.router,s="",n="";{let i={};if(t){if(t.container)i.container=t.container;if(t.interceptAllLinks!==void 0)i.interceptAllLinks=t.interceptAllLinks;if(t.progress!==void 0)i.progress=t.progress;if(t.viewTransitions!==void 0)i.viewTransitions=t.viewTransitions;if(t.viewTransitionDuration!==void 0)i.viewTransitionDuration=t.viewTransitionDuration;if(t.viewTransitionEasing!==void 0)i.viewTransitionEasing=t.viewTransitionEasing;if(t.scrollToTop!==void 0)i.scrollToTop=t.scrollToTop;if(t.scrollRestoration!==void 0)i.scrollRestoration=t.scrollRestoration;if(t.prefetch!==void 0)i.prefetch=t.prefetch;if(t.cache!==void 0)i.cache=t.cache;if(t.progressColor!==void 0)i.progressColor=t.progressColor;if(t.progressHeight!==void 0)i.progressHeight=t.progressHeight;if(t.prefetchVisible!==void 0)i.prefetchVisible=t.prefetchVisible;if(t.prefetchVisibleMax!==void 0)i.prefetchVisibleMax=t.prefetchVisibleMax;if(t.prefetchBudgetBytes!==void 0)i.prefetchBudgetBytes=t.prefetchBudgetBytes;if(t.keepOpening!==void 0)i.keepOpening=t.keepOpening}try{let f=await h(r?.pagesDir,r?.root);if(f.length>0)if(r?.buildMode==="serve"){let{registerServeModuleBundle:T}=await import("./chunk-qx8cav4w.js");n=`<script data-stx-owned-routes src="${T(`(window.__stxRouterConfig=window.__stxRouterConfig||{}).ownedRoutes=${g(f)};
|
|
10
10
|
`)}"></script>
|
|
11
11
|
`}else i.ownedRoutes=f}catch{}if(Object.keys(i).length>0)s=`<script>window.__stxRouterConfig=${g(i)};</script>
|
|
12
|
-
`}let{getCachedRouterScript:c,getServeClientAsset:o}=await import("./chunk-
|
|
12
|
+
`}let{getCachedRouterScript:c,getServeClientAsset:o}=await import("./chunk-qx8cav4w.js"),u=r?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':r?.buildMode==="serve"?`<script data-stx-router src="${(await o("router")).url}"></script>`:`<script data-stx-router>${await c()}</script>`,d=e.lastIndexOf("</body>");return e.slice(0,d)+s+n+u+`
|
|
13
13
|
</body>`+e.slice(d+7)}
|
|
14
|
-
export{dr,X,ve,
|
|
14
|
+
export{dr,X,ve,wc,pr,vc,xe};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{or,i}from"./chunk-kv40xq53.js";import"./chunk-5q4tncfw.js";import"./chunk-7de5y29a.js";import"./chunk-t5q31st4.js";import"./chunk-b7nmgkwa.js";import"./chunk-2b4a8tbd.js";import"./chunk-aj6vqdf7.js";import"./chunk-v0wdgxga.js";import"./chunk-b1tctqn5.js";import{xe}from"./chunk-02css3vk.js";import"./chunk-h2cvfp9y.js";import"./chunk-z99bf0q0.js";import"./chunk-6nb49h13.js";import"./chunk-68w65mhs.js";import"./chunk-9pyvc0dc.js";import"./chunk-4rrxrxp6.js";import"./chunk-dba4bwkd.js";import"./chunk-3gfd9t8a.js";import{Me,Ws,qs}from"./chunk-261t62q4.js";import"./chunk-naj146zq.js";import"./chunk-5rxks14t.js";import"./chunk-830ej8d2.js";import"./chunk-xppm4cs4.js";import"./chunk-1jwcp2k0.js";export{or as buildModulesTag,xe as injectRouterScript,i as processDirectives,Ws as processJsonDirective,qs as processOnceDirective,Me as validateClientScript};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ne,C,Z}from"./chunk-
|
|
2
|
+
import{Ne,C,Z}from"./chunk-261t62q4.js";import{k}from"./chunk-1jwcp2k0.js";import{I,An}from"./chunk-xppm4cs4.js";import{a}from"./chunk-6nb49h13.js";import{be,an,cn,ln}from"./chunk-74g64pzt.js";import{St}from"./chunk-b1tctqn5.js";import{bt,Wn,Qt,ue}from"./chunk-jhm1228j.js";import{T,Rn}from"./chunk-9xr628ew.js";import A from"fs";import b from"path";import x from"process";function U(s,o){for(let e of s.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(e[1])o.add(e[1]);for(let e of s.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let t of(e[1]??"").split(",")){let r=((t.includes(":")?t.split(":").pop():t)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(r))o.add(r)}for(let e of s.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let t of(e[1]??"").split(",")){let n=t.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(n))o.add(n)}}var h=new Map;async function O(s,o=T()){let e;if(s)e=b.resolve(s);else{let l=await a();e=b.resolve(l.root||x.cwd(),l.storesDir||"stores")}let t=`${e}\x00${cn()}\x00${o?"shared":"inline"}`,n=new Bun.Glob("*.ts"),r=[];try{for await(let l of n.scan({cwd:e,absolute:!0})){let c=b.basename(l,".ts");if(["index","types"].includes(c))continue;if(l.includes(".d.ts"))continue;r.push(l)}}catch{return ue(h,t,"",{chunks:[]}),null}let i=()=>[...new Set([...r,...r.flatMap((l)=>be(l))])],f=bt(i()),u=Qt(h,t,f);if(u!==void 0)return u.chunks.length>0?u:null;if(r.length===0)return ue(h,t,f,{chunks:[]}),null;let m=[];for(let l of r){let c=await Bun.file(l).text();m.push({file:l,hasUseStore:/useStore\s*\(/.test(c)})}m.sort((l,c)=>{if(l.hasUseStore===c.hasUseStore)return 0;return l.hasUseStore?1:-1});let p=m.map((l)=>l.file),g=[],d=Z({loader:"ts",target:"browser",define:C()});for(let l of p)try{let c=await Bun.file(l).text(),_=b.basename(l,".ts"),y=new Set;U(c,y);let v=[...c.matchAll(/\bdefineStore\s*(?:<[^>()]*>)?\(\s*(['"`])([^'"`$\\]+)\1/g)].map((N)=>N[2]),E=c.match(/\bdefineStore\s*(?:<[^>()]*>)?\(/g)?.length??0;if(an(c))c=await ln(c,l,{projectRoot:x.cwd(),externalizeUserModules:o});c=St(c),c=I(c),c=An(c),c=c.replace(/^export\s+(default\s+)?/gm,""),c=d.transformSync(c),g.push({name:_,ids:v.length===E?v:[],declared:y,code:`// Store: ${_}
|
|
3
3
|
${c.trim()}`})}catch(c){console.warn(`[stx] Failed to load store ${l}:`,c)}if(g.length===0)return ue(h,t,f,{chunks:[]}),null;f=bt(i());let S={chunks:g};return ue(h,t,f,S),S}function R(s){let o=new Set;for(let r of s)for(let i of r.declared)o.add(i);let e=s.map((r)=>r.code).join(`
|
|
4
4
|
|
|
5
5
|
`),n=`;(function(){
|
|
@@ -12,7 +12,7 @@ var __stx = window.stx || {};
|
|
|
12
12
|
${k.filter((i)=>!n.has(i)&&new RegExp(`\\b${i}\\b`).test(e.code)).map((i)=>`var ${i} = __stx[${JSON.stringify(i)}];`).join(`
|
|
13
13
|
`)}
|
|
14
14
|
${e.code}
|
|
15
|
-
}`})}var M=new WeakMap;async function
|
|
15
|
+
}`})}var M=new WeakMap;async function bh(s){let o=await O(s);if(!o)return null;let e=M.get(o);if(e===void 0)e=R(o.chunks),M.set(o,e);return e}function W(s){if(!/\buseStore\b/.test(s))return!1;if(/\buseStore\s+as\s+[A-Za-z_$]/.test(s))return!0;if(/\{[^{}]*\buseStore\s*:\s*[A-Za-z_$[{][^{}]*\}\s*=(?!=)/.test(s))return!0;if(/\[\s*(['"`])useStore\1\s*\]/.test(s.replace(/\b(?:var|let|const)\s+useStore\s*=\s*[\w$.]*\[\s*(['"`])useStore\1\s*\]/g," ")))return!0;let o=s.replace(/\/\*[\s\S]*?\*\//g," ").replace(/(^|[^:\\'"`])\/\/[^\n]*/g,"$1 ").replace(/\b(?:var|let|const)\s+useStore\s*=\s*[\w$.]*\[\s*(['"`])useStore\1\s*\]/g," ").replace(/\b(?:const|let|var)\s*\{[^{}]*\}\s*=/g," ").replace(/\bimport\s*(?:type\s+)?\{[^{}]*\}\s*from\b/g," ").replace(/\bexport\s*(?:type\s+)?\{[^{}]*\}/g," ").replace(/\btypeof\s+useStore\b/g," ").replace(/(['"`])useStore\1/g," ");for(let e of o.matchAll(/\buseStore\b/g)){let t=o.slice(Math.max(0,e.index-9),e.index);if(/\bfunction\s*$/.test(t))continue;let n=o.slice(e.index+8).trimStart();if(n.startsWith("(")||n.startsWith("<")||n.startsWith("?.("))continue;if(/^=(?![=>])/.test(n))continue;return!0}return!1}function So(...s){let o=new Set,e=!1;for(let t of s){if(!t)continue;if(/__STX_STORES__|\b_stores\b/.test(t))e=!0;if(W(t))e=!0;let n=t.match(/\buseStore\s*(?:<[^>()]*>)?\s*(?:\?\.\s*)?\(/g)?.length??0;if(n===0)continue;let r=0;for(let i of t.matchAll(/\buseStore\s*(?:<[^>()]*>)?\s*(?:\?\.\s*)?\(\s*(['"`])([^'"`$\\]+)\1\s*[,)]/g))o.add(i[2]),r++;if(r!==n)e=!0}return{names:o,all:e}}var z=new Map;function wh(s){let o=new Set,e=!1;for(let t of s){if(/\.(?:css|json|svg|wasm|png|jpe?g|gif|webp|avif|woff2?|ttf|txt|md)$/i.test(t))continue;let n;try{let r=A.statSync(t),i=z.get(t);if(i&&i.mtimeMs===r.mtimeMs&&i.size===r.size)n=i.read;else n=So(A.readFileSync(t,"utf8")),z.set(t,{mtimeMs:r.mtimeMs,size:r.size,read:n})}catch{n={names:new Set,all:!0}}if(n.all)e=!0;for(let r of n.names)o.add(r)}return{names:o,all:e}}function vh(s=x.env){return s.STX_PAGE_STORES==="all"}async function xh(s,o,e={}){let t=await O(s,e.sharedModules);if(!t)return null;let{chunks:n}=t,r=So(...o);if(e.reads){if(e.reads.all)r.all=!0;for(let u of e.reads.names)r.names.add(u)}let i=e.runOnce?P(t):void 0,f;if(e.all||r.all||n.some((u)=>u.ids.length===0)||i===null)f=n;else{let u=new Map;for(let d of n)for(let S of d.ids)u.set(S,d);let m=new Set,p=[...r.names],g=!1;while(p.length>0&&!g){let d=u.get(p.pop());if(!d||m.has(d))continue;m.add(d);let S=So(d.code);if(S.all)g=!0;else p.push(...S.names)}f=g?n:n.filter((d)=>m.has(d))}if(f.length===0)return null;if(i){let u=f.map((d)=>i.get(d)),m=f.map((d)=>d.name),p=F.get(t);if(!p)F.set(t,p=new Map);let g=p.get(m.join("\x00"));if(g===void 0)p.set(m.join("\x00"),g=D(m,u));return{code:g,stores:m,functions:u}}return{code:R(f),stores:f.map((u)=>u.name),functions:j(f)}}var F=new WeakMap,w=new WeakMap;function P(s){if(w.has(s))return w.get(s);let o=j(s.chunks),e=o?new Map(s.chunks.map((t,n)=>[t,o[n]])):null;return w.set(s,e),e}function D(s,o){let t=`;(function(){
|
|
16
16
|
var ran = window.__stxStoreFiles || (window.__stxStoreFiles = {});
|
|
17
17
|
function run(name, define) {
|
|
18
18
|
if (ran[name]) return;
|
|
@@ -22,5 +22,5 @@ function run(name, define) {
|
|
|
22
22
|
}
|
|
23
23
|
${s.map((n,r)=>`run(${JSON.stringify(n)}, ${o[r]})`).join(`;
|
|
24
24
|
`)};
|
|
25
|
-
})();`;return T()?Rn(t):t}function
|
|
26
|
-
export{
|
|
25
|
+
})();`;return T()?Rn(t):t}function Sh(){h.clear(),Wn()}
|
|
26
|
+
export{bh,So,wh,vh,xh,Sh};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{se}from"./chunk-
|
|
3
|
-
export{xa,
|
|
2
|
+
import{se}from"./chunk-fyfvqd2s.js";import R from"fs";import g from"path";import C from"crypto";var S=new Set(["webp","avif","jpeg","png"]),T=new Set(["cover","contain","fill","inside","outside"]),q=new Set([".jpg",".jpeg",".png",".webp",".avif",".gif"]),k=4096,D=80,U="cover";async function xa(e,t){let r=t.routePath??"/_stx/img",h=new URL(e.url);if(h.pathname!==r)return null;let a=A(h,t);if(!a.ok)return new Response(a.error,{status:a.status,headers:{"Content-Type":"text/plain"}});let{srcFsPath:n,srcUrl:d,width:l,height:i,format:s,quality:u,fit:c}=a,m;try{m=R.statSync(n)}catch{return new Response(`Source image not found: ${d}`,{status:404,headers:{"Content-Type":"text/plain"}})}if(!m.isFile())return new Response("Not a file",{status:404,headers:{"Content-Type":"text/plain"}});let w=t.cacheDir??".stx/cache/img";await R.promises.mkdir(w,{recursive:!0});let b=`${n}:${m.mtimeMs}:${m.size}`,I=`${l}x${i}:${s}:${u}:${c}`,f=C.createHash("sha256").update(`${b}|${I}`).digest("hex").slice(0,16),o=g.join(w,`${f}.${s}`),p={"Content-Type":se(s),"Cache-Control":"public, max-age=31536000, immutable",ETag:`"${f}"`,"X-Stx-Image-Cache":"HIT"};if(e.headers.get("if-none-match")===`"${f}"`)return new Response(null,{status:304,headers:p});let v=Bun.file(o);if(await v.exists())return new Response(v,{headers:p});try{let x=Buffer.from(await Bun.file(n).arrayBuffer()),{resizeAndConvert:P}=await L(),F=await P(x,{width:l,height:i,format:s,quality:u,fit:c});return await Bun.write(o,F),p["X-Stx-Image-Cache"]="MISS",new Response(new Uint8Array(F),{headers:p})}catch(x){let P=x.message;return new Response(`Image processing failed: ${P}`,{status:500,headers:{"Content-Type":"text/plain"}})}}function Yl(e){return async(t)=>await xa(t,e)??new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain"}})}function A(e,t){let r=e.searchParams.get("src");if(!r)return{ok:!1,error:"Missing required param: src",status:400};if(!r.startsWith("/"))return{ok:!1,error:"src must be an absolute URL path (start with /)",status:400};if(r.startsWith("//"))return{ok:!1,error:"src must be a local path",status:400};let h=g.extname(r).toLowerCase();if(!q.has(h))return{ok:!1,error:`Unsupported source extension: ${h}`,status:400};let a=g.resolve(t.publicDir),n=g.resolve(a,r.slice(1));if(!n.startsWith(`${a}${g.sep}`)&&n!==a)return{ok:!1,error:"src is outside publicDir",status:400};let d=t.maxWidth??k,l=t.maxHeight??k,i=e.searchParams.get("w"),s=e.searchParams.get("h"),u=i?Number.parseInt(i,10):0,c=s?Number.parseInt(s,10):0;if(i&&(!Number.isFinite(u)||u<=0))return{ok:!1,error:"Invalid w (must be positive integer)",status:400};if(s&&(!Number.isFinite(c)||c<=0))return{ok:!1,error:"Invalid h (must be positive integer)",status:400};if(!i&&!s)return{ok:!1,error:"At least one of w or h is required",status:400};let m=Math.min(u||d,d),w=Math.min(c||l,l),b=e.searchParams.get("f")||"webp";if(!S.has(b))return{ok:!1,error:`Invalid f (must be one of: ${[...S].join(", ")})`,status:400};let I=b,f=e.searchParams.get("q"),o=f?Number.parseInt(f,10):t.defaultQuality??D;if(!Number.isFinite(o)||o<1||o>100)return{ok:!1,error:"Invalid q (must be 1-100)",status:400};let y=e.searchParams.get("fit")||t.defaultFit||U;if(!T.has(y))return{ok:!1,error:`Invalid fit (must be one of: ${[...T].join(", ")})`,status:400};return{ok:!0,srcFsPath:n,srcUrl:r,width:m,height:w,format:I,quality:o,fit:y}}async function L(){return await import("./chunk-2pbhdaka.js")}
|
|
3
|
+
export{xa,Yl};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{pe}from"./chunk-
|
|
2
|
+
import{pe}from"./chunk-3gfd9t8a.js";import{Ve,M}from"./chunk-5rxks14t.js";import{Pc}from"./chunk-4rrxrxp6.js";import{c}from"./chunk-sxtvy0sm.js";import v from"fs";import m from"path";import{pathToFileURL as I}from"url";var P=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],R=new Set;function un(s,l={}){let o=m.resolve(s,l.dir??"server/api"),i=[],f=new Map;if(!v.existsSync(o))return i;let t=Array.from(new Bun.Glob("**/*.{ts,js,mts,mjs}").scanSync({cwd:o})).sort();for(let e of t){if(e.endsWith(".d.ts"))continue;let p=e.replace(/\.(?:ts|js|mts|mjs)$/,"").split("/"),n=p.pop(),u=n.lastIndexOf("."),d=u>=0?n.slice(u+1):"get",g=d.toUpperCase();if(!P.includes(g)||d!==d.toLowerCase())throw Error(`Unsupported API method suffix in ${e}; use ${P.map((A)=>A.toLowerCase()).join(", ")}`);if(u>=0)n=n.slice(0,u);if(n!=="index")p.push(n);let r=new Set,h=p.map((A,j)=>{let y=/^\[(\.\.\.)?([A-Za-z_]\w*)\]$/.exec(A);if(y){if(r.has(y[2])||y[1]&&j!==p.length-1)throw Error(`Invalid API parameter in ${e}`);return r.add(y[2]),`:${y[2]}${y[1]?"*":""}`}if(!/^[\w-]+$/.test(A))throw Error(`Unsupported API path segment ${A} in ${e}`);return A}),w=`/api${h.length?`/${h.join("/")}`:""}`,S=`${g} ${w.replace(/:\w+/g,":param")}`;if(f.has(S))throw Error(`Ambiguous API route ${g} ${w}: ${f.get(S)} and ${e}`);f.set(S,e);let x=m.join(o,e);R.add(m.resolve(x)),R.add(v.realpathSync(x)),i.push({pattern:w,method:g,filePath:x})}return i.sort((e,a)=>{let p=e.pattern.split("/"),n=a.pattern.split("/"),u=(d)=>d?.endsWith("*")?0:d?.startsWith(":")?1:2;for(let d=0;d<Math.max(p.length,n.length);d++){let g=u(n[d])-u(p[d]);if(g)return g}return e.pattern.localeCompare(a.pattern)||e.method.localeCompare(a.method)})}async function No(s,l){let o=c(s,"api-types.d.ts"),i=["// Generated by stx. Include this file in tsconfig.json.","declare module '@stacksjs/stx/api-client' {"," interface KnownApiRoutes {"];for(let t of l){let e=`./${m.relative(m.dirname(o),t.filePath).replace(/\\/g,"/")}`,{params:a}=pe(t.pattern);i.push(` ${JSON.stringify(`${t.method} ${t.pattern}`)}: { params: { ${a.map((p)=>`${JSON.stringify(p)}: string`).join("; ")} }; response: Awaited<ReturnType<typeof import(${JSON.stringify(e)}).default>> }`)}i.push(" }","}","export {}","");let f=i.join(`
|
|
3
3
|
`);if(!await Bun.file(o).exists()||await Bun.file(o).text()!==f)await Bun.write(o,f);return o}async function Mo(s,l,o={}){let i=un(s,o);await No(s,i);let f=[];for(let t of i){let e=await Bun.build({entrypoints:[t.filePath],target:"bun",format:"esm",minify:!1,splitting:!1});if(!e.success)throw Error(`API build failed for ${t.filePath}: ${e.logs.join(`
|
|
4
|
-
`)}`);let a=e.outputs.find((u)=>u.kind==="entry-point");if(!a)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await a.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(l,n),a),f.push({...t,filePath:n})}return f}function E(s,l){let o=s.map((i)=>({route:i,...pe(i.pattern)}));return async(i)=>{let f=new URL(i.url).pathname,t=o.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,a=(r)=>r.replace(/:\w+/g,":param"),p=t.filter((r)=>a(r.route.pattern)===a(e)),n=i.method,u=p.find((r)=>r.route.method===n)??(n==="HEAD"?p.find((r)=>r.route.method==="GET"):void 0);if(!u){let r=new Set(p.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=u.regex.exec(f),g=Object.create(null);try{u.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await l(u.route);if(typeof r!=="function")throw Error(`API endpoint ${u.route.filePath} must default-export a handler`);let h=await r(i,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function Do(s,l){return E(l,async(o)=>(await import(I(m.resolve(s,o.filePath)).href)).default)}async function
|
|
5
|
-
`));let u=n.outputs.find((d)=>d.kind==="entry-point");if(!u||n.outputs.length!==1)throw Error(`Unsupported API bundle output: ${p.filePath}`);return(await import(`data:text/javascript;base64,${Buffer.from(await u.text()).toString("base64")}`)).default})(f))}catch(t){return console.error("[stx] API discovery failed:",t),Response.json({error:"API discovery failed; check the server log"},{status:500})}}}function Lo(s,l,o){if(
|
|
6
|
-
export{un,No,Mo,Do,
|
|
4
|
+
`)}`);let a=e.outputs.find((u)=>u.kind==="entry-point");if(!a)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await a.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(l,n),a),f.push({...t,filePath:n})}return f}function E(s,l){let o=s.map((i)=>({route:i,...pe(i.pattern)}));return async(i)=>{let f=new URL(i.url).pathname,t=o.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,a=(r)=>r.replace(/:\w+/g,":param"),p=t.filter((r)=>a(r.route.pattern)===a(e)),n=i.method,u=p.find((r)=>r.route.method===n)??(n==="HEAD"?p.find((r)=>r.route.method==="GET"):void 0);if(!u){let r=new Set(p.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=u.regex.exec(f),g=Object.create(null);try{u.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await l(u.route);if(typeof r!=="function")throw Error(`API endpoint ${u.route.filePath} must default-export a handler`);let h=await r(i,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function Do(s,l){return E(l,async(o)=>(await import(I(m.resolve(s,o.filePath)).href)).default)}async function Bh(s,l){if(!l)return async()=>null;let o=l===!0?{}:l,i=un(s,o);return await No(s,i),async(f)=>{if(!new URL(f.url).pathname.match(/^\/api(?:\/|$)/))return null;try{let t=un(s,o);await No(s,t);let{loadStxConfig:e}=await import("./chunk-h0dsxxz4.js"),a=M((await e(s)).runtimeConfig);return await Ve(a,()=>E(t,async(p)=>{let n=await Bun.build({entrypoints:[p.filePath],target:"bun",format:"esm",splitting:!1});if(!n.success)throw Error(n.logs.join(`
|
|
5
|
+
`));let u=n.outputs.find((d)=>d.kind==="entry-point");if(!u||n.outputs.length!==1)throw Error(`Unsupported API bundle output: ${p.filePath}`);return(await import(`data:text/javascript;base64,${Buffer.from(await u.text()).toString("base64")}`)).default})(f))}catch(t){return console.error("[stx] API discovery failed:",t),Response.json({error:"API discovery failed; check the server log"},{status:500})}}}function Lo(s,l,o){if(Pc(s))return!0;let i=/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/;if(i.test(m.basename(s)))return!0;try{if(i.test(m.basename(v.realpathSync(s))))return!0}catch{}if(R.has(m.resolve(s)))return!0;if(!o)return!1;let f=m.resolve(l,typeof o==="object"?o.dir??"server/api":"server/api"),t=(a)=>{try{return v.realpathSync(a)}catch{return m.resolve(a)}},e=t(s);return[f,m.resolve(l,"server"),m.resolve(l,".output/server")].some((a)=>{let p=t(a);return e===p||e.startsWith(`${p}${m.sep}`)})}
|
|
6
|
+
export{un,No,Mo,Do,Bh,Lo};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Vh,Wf,Ze,hc,Uh,us,ds,ps}from"./chunk-7de5y29a.js";import"./chunk-b7nmgkwa.js";import"./chunk-2b4a8tbd.js";import"./chunk-v0wdgxga.js";import"./chunk-h2cvfp9y.js";import"./chunk-261t62q4.js";import"./chunk-naj146zq.js";import"./chunk-5rxks14t.js";import"./chunk-830ej8d2.js";import"./chunk-xppm4cs4.js";import"./chunk-1jwcp2k0.js";export{Uh as clearOnceStore,hc as onceStore,Ze as partialsCache,us as processIncludes,ds as processStackPushDirectives,ps as processStackReplacements,Vh as resetUnscopedSignalWarnings,Wf as topLevelElements};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import l from"fs";import u from"path";var m=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^<>()]*>)?\s*\(/,g=/(?:^|\n)\s*(?:import|export)\s+(?:[^'"]*?\sfrom\s+)?['"](\.[^'"]*)['"]/g,b=["",".ts",".tsx",".js",".jsx",".mts",".mjs","/index.ts","/index.js"],x=3;function h(e,t){let r=u.resolve(u.dirname(t),e);for(let o of b){let s=r+o;try{if(l.statSync(s).isFile())return s}catch{}}return null}function Lr(e,t,r=0,o=new Set){if(!t||r>=x)return!1;for(let s of e.matchAll(g)){let n=h(s[1],t);if(!n||o.has(n))continue;o.add(n);let i;try{i=l.readFileSync(n,"utf8")}catch{continue}if(m.test(i))return!0;if(Lr(i,n,r+1,o))return!0}return!1}var k=["batch","cachedQuery","clearServerData","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","flushKeptState","forgetKeptState","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","keptState","memo","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refDebounced","refresh","registerStoresClient","setKeptScope","setRouteParams","sharedRequest","state","untrack","useAsync","useBroadcastStream","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebounceFn","useDebouncedValue","useDocumentVisibility","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useModel","useMutation","useNativeDesktop","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useThrottleFn","useTimeout","useTimeoutFn","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],
|
|
3
|
-
export{Lr,k,
|
|
2
|
+
import l from"fs";import u from"path";var m=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^<>()]*>)?\s*\(/,g=/(?:^|\n)\s*(?:import|export)\s+(?:[^'"]*?\sfrom\s+)?['"](\.[^'"]*)['"]/g,b=["",".ts",".tsx",".js",".jsx",".mts",".mjs","/index.ts","/index.js"],x=3;function h(e,t){let r=u.resolve(u.dirname(t),e);for(let o of b){let s=r+o;try{if(l.statSync(s).isFile())return s}catch{}}return null}function Lr(e,t,r=0,o=new Set){if(!t||r>=x)return!1;for(let s of e.matchAll(g)){let n=h(s[1],t);if(!n||o.has(n))continue;o.add(n);let i;try{i=l.readFileSync(n,"utf8")}catch{continue}if(m.test(i))return!0;if(Lr(i,n,r+1,o))return!0}return!1}var k=["batch","cachedQuery","clearServerData","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","flushKeptState","forgetKeptState","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","keptState","memo","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refDebounced","refresh","registerStoresClient","setKeptScope","setRouteParams","sharedRequest","state","untrack","useAsync","useBroadcastStream","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebounceFn","useDebouncedValue","useDocumentVisibility","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useModel","useMutation","useNativeDesktop","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useThrottleFn","useTimeout","useTimeoutFn","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],xl=["onMount","onDestroy"];function ut(e="const",t=[],r){let o=t.length?k.filter((s)=>!t.includes(s)):k;if(r!==void 0)o=o.filter((s)=>{let n=s.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${n}(?![\\w$])`).test(r)});return`${e} { ${o.join(", ")} } = window.stx;`}var y=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"];var S=k.filter((e)=>!y.includes(e));function Li(e){if(!e)return!1;return S.some((t)=>new RegExp(`\\b${t}\\s*(?:<[^>]*>)?\\s*\\(`).test(e))}var v=[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\s:[a-z][\w-]*\s*=\s*["']/i,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/],E=/\s@[a-z][\w.:-]*\s*=/i;function Sl(e,t){if(!e)return!1;let r=f(e);return d(r,t)}function d(e,t){if(v.some((r)=>r.test(e)))return!0;if(Li(e))return!0;return T(e,t)}function T(e,t){if(!t)return!1;for(let r of e.matchAll(/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script\s*>/gi))if(Lr(r[1],t))return!0;return!1}function kl(e,t){if(!e)return!1;let r=f(e);return E.test(r)||d(r,t)}var R=["if","else-if","elseif","else","for","show","key","text","html","model","ref"];function _l(e){return R.includes(e.toLowerCase())}var no=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],_=["x-init","x-transition","x-effect","x-on"],Cl=[...no,..._];function El(){return`{${no.map((e)=>`'${e}':1`).join(",")}}`}var ji=["class","style","text","html","show","model","if","ref"];function Tl(){return`{${ji.map((e)=>e==="if"?"'if':1":`${e}:1`).join(",")}}`}var p=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","keydown","keyup","keypress","input","change","submit","focus","blur","scroll","resize","touchstart","touchend","touchmove","contextmenu","wheel","pointerdown","pointerup","pointermove"];function $l(){return`/^(${p.join("|")})(?:\\.|$)/`}function Rl(e){return p.some((t)=>e===t||e.startsWith(`${t}.`))}var w=65536,A=4,c=new Map;function f(e){if(!e)return e;if(!e.includes("<!--")&&!/<(?:pre|code)\b/i.test(e))return e;let t=e.length>=w;if(t){let s=c.get(e);if(s!==void 0)return s}let r=(s)=>s.replace(/(<[^>]*>)|([^<]+)/g,(n,i,a)=>i??" ".repeat(a.length)),o=e.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(s,n,i,a)=>n+r(i)+a).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(s,n,i,a)=>n+r(i)+a).replace(/<!--[\s\S]*?-->/g,(s)=>" ".repeat(s.length));if(t){while(c.size>=A){let s=c.keys().next();if(s.done)break;c.delete(s.value)}c.set(e,o)}return o}
|
|
3
|
+
export{Lr,k,xl,ut,Li,Sl,kl,_l,no,Cl,El,ji,Tl,$l,Rl};
|