@stacksjs/stx 0.2.854 → 0.2.855
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-krnp1bae.js → chunk-0vg0j7xa.js} +1 -1
- package/dist/{chunk-kdhgvfxw.js → chunk-11y3106w.js} +1 -1
- package/dist/chunk-161ksm7f.js +2 -0
- package/dist/{chunk-ga0e15n5.js → chunk-1qybwj8k.js} +2 -2
- package/dist/{chunk-m2srr0pz.js → chunk-279n7sde.js} +1 -1
- package/dist/chunk-2y20dvab.js +2 -0
- package/dist/{chunk-djte6zvt.js → chunk-3pm6d9zj.js} +1 -1
- package/dist/{chunk-8vs6xk89.js → chunk-463zkecq.js} +1 -1
- package/dist/{chunk-5t4k477c.js → chunk-4cd94cd5.js} +1 -1
- package/dist/{chunk-1wczdwv6.js → chunk-4dfz7cdr.js} +2 -2
- package/dist/{chunk-ht550m3c.js → chunk-4wrddn8m.js} +2 -2
- package/dist/{chunk-w525ymys.js → chunk-5dykcrnv.js} +1 -1
- package/dist/{chunk-7zhtnnzk.js → chunk-5xcxc9f8.js} +1 -1
- package/dist/{chunk-h8bqgjw4.js → chunk-6w3gv9d6.js} +1 -1
- package/dist/{chunk-3gbexkdv.js → chunk-77kanny8.js} +4 -4
- package/dist/{chunk-y3gajdr9.js → chunk-7hp50cpd.js} +4 -4
- package/dist/{chunk-tks9wec7.js → chunk-7tteg9bn.js} +1 -1
- package/dist/{chunk-cj923dqv.js → chunk-81z64a84.js} +1 -1
- package/dist/{chunk-hn1c3te7.js → chunk-8gsd2n0j.js} +1 -1
- package/dist/{chunk-xk113s55.js → chunk-8kqqxqyp.js} +1 -1
- package/dist/chunk-8qe34jb8.js +3 -0
- package/dist/{chunk-txg0pp28.js → chunk-9hvfmqs1.js} +2 -2
- package/dist/{chunk-1026xh3q.js → chunk-9n3584wt.js} +1 -1
- package/dist/{chunk-j05z0m3r.js → chunk-bk0arddt.js} +1 -1
- package/dist/chunk-c557w9e6.js +2 -0
- package/dist/chunk-ck9zengd.js +2 -0
- package/dist/{chunk-dak3fb0d.js → chunk-cy60hmv2.js} +1 -1
- package/dist/chunk-dbag44ta.js +2 -0
- package/dist/{chunk-5wct6n72.js → chunk-dfcnaaym.js} +1 -1
- package/dist/{chunk-njj4mmdc.js → chunk-e8zpzt9s.js} +1 -1
- package/dist/{chunk-qndtva3r.js → chunk-eegs2at0.js} +1 -1
- package/dist/{chunk-kdc0xsds.js → chunk-f858fazq.js} +1 -1
- package/dist/{chunk-xsc8pksj.js → chunk-fba71th7.js} +3 -3
- package/dist/{chunk-vpqr2td2.js → chunk-fbpqkrvb.js} +1 -1
- package/dist/{chunk-9f1p4y5e.js → chunk-fzkyk5j4.js} +1 -1
- package/dist/{chunk-dq41v6hy.js → chunk-ggthncvg.js} +1 -1
- package/dist/{chunk-7bt73vzq.js → chunk-gxqtbbz0.js} +2 -2
- package/dist/{chunk-xt6gss6f.js → chunk-hfcagm39.js} +1 -1
- package/dist/{chunk-fgxagxde.js → chunk-hfe2byfx.js} +1 -1
- package/dist/{chunk-59br2agx.js → chunk-hgy98n76.js} +2 -2
- package/dist/chunk-j3s5y2k5.js +2 -0
- package/dist/{chunk-r8vx6aw7.js → chunk-jn6mdfrs.js} +1 -1
- package/dist/{chunk-wsz9vajc.js → chunk-k0arm18k.js} +1 -1
- package/dist/{chunk-2f2rxpm9.js → chunk-mhjxx64x.js} +5 -5
- package/dist/{chunk-5c5nr9sf.js → chunk-mv48q1p4.js} +6 -6
- package/dist/chunk-p91288ce.js +2 -0
- package/dist/{chunk-r4r1fydy.js → chunk-pesgcwrj.js} +1 -1
- package/dist/{chunk-41vnkj8n.js → chunk-pw6n7a9k.js} +1 -1
- package/dist/{chunk-16tghnfh.js → chunk-pwem4sed.js} +1 -1
- package/dist/{chunk-df71jdb5.js → chunk-q0jmc3m4.js} +1 -1
- package/dist/{chunk-spnq5xjw.js → chunk-qccpfn5x.js} +1 -1
- package/dist/{chunk-5mjsx45g.js → chunk-qxk9grjm.js} +1 -1
- package/dist/{chunk-pyc91z27.js → chunk-vbsr76qe.js} +1 -1
- package/dist/chunk-vgaqznwt.js +2 -0
- package/dist/chunk-w165qe5q.js +2 -0
- package/dist/{chunk-97qv554b.js → chunk-w835crjw.js} +1 -1
- package/dist/{chunk-rpk744cn.js → chunk-wz54wsm7.js} +1 -1
- package/dist/{chunk-3fjdwr6s.js → chunk-xfb7fdeq.js} +4 -4
- package/dist/{chunk-4qf5qh20.js → chunk-xn2gyhes.js} +1 -1
- package/dist/{chunk-f61153pm.js → chunk-ynd2nfvs.js} +4 -4
- package/dist/{chunk-4ekpj06v.js → chunk-yscys65t.js} +1 -1
- package/dist/{chunk-6ygjr05v.js → chunk-yzvp90yk.js} +1 -1
- package/dist/{chunk-6gt2br9n.js → chunk-zme05d1n.js} +1 -1
- package/dist/{chunk-9tbghxd0.js → chunk-zqb294v2.js} +1 -1
- package/dist/cli.js +7 -7
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/pwa.js +1 -1
- package/dist/ssg.js +2 -2
- package/package.json +5 -5
- package/dist/chunk-0x4j65b0.js +0 -2
- package/dist/chunk-5k8n17b4.js +0 -2
- package/dist/chunk-cddvc63n.js +0 -2
- package/dist/chunk-dxgjmdnx.js +0 -2
- package/dist/chunk-ec54y5py.js +0 -2
- package/dist/chunk-g39txgtx.js +0 -2
- package/dist/chunk-hxz5cd52.js +0 -3
- package/dist/chunk-k4swzkyq.js +0 -2
- package/dist/chunk-vz0t4mnc.js +0 -2
- package/dist/chunk-wa06df5a.js +0 -2
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{yr}from"./chunk-9r999ees.js";import{Pr}from"./chunk-0dmpc70r.js";import{a}from"./chunk-
|
|
2
|
+
import{yr}from"./chunk-9r999ees.js";import{Pr}from"./chunk-0dmpc70r.js";import{a}from"./chunk-1qybwj8k.js";import{B,Ze}from"./chunk-ybq56wam.js";import{bc}from"./chunk-s37af6rd.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 we(e){return e.includes("data-stx-runtime")}function hc(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 Ze(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-8gsd2n0j.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-8gsd2n0j.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 yc(e){if(e.includes("data-stx-tooltip-runtime")||!m(e))return e;let r=`<script data-stx-scoped data-stx-tooltip-runtime>${bc()}</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 ve(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 ve(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-8gsd2n0j.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-8gsd2n0j.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
14
|
export{dr,X,we,hc,pr,yc,ve};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{_n,Ti}from"./chunk-
|
|
2
|
+
import{_n,Ti}from"./chunk-e8zpzt9s.js";import"./chunk-v4bqmzj9.js";export{Ti as generateRuntimeConfigTypes,_n as prepareRuntimeConfig};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Mf,dc,Mh,pc,Df,Lf,dn,cr,Dh,jf,Bf,Lh,b}from"./chunk-
|
|
2
|
+
import{Mf,dc,Mh,pc,Df,Lf,dn,cr,Dh,jf,Bf,Lh,b}from"./chunk-9hvfmqs1.js";import"./chunk-k0arm18k.js";import"./chunk-mv48q1p4.js";import"./chunk-e8zpzt9s.js";import"./chunk-v4bqmzj9.js";import"./chunk-0dmpc70r.js";import"./chunk-xppm4cs4.js";import"./chunk-ngnvyqk3.js";export{dn as buildCss,jf as extractClassNames,Lf as fingerprintConfig,Bf as generateCss,Dh as getCachedCSS,Mf as getCssServeAsset,b as injectCss,dc as loadCssEngine,pc as loadCssEngineConfig,cr as rebuildCss,Mh as resetCssCache,Df as resolveUserCssConfig,Lh as withLinkedModuleBundles};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{qf,Wh,qh,Kh,Gh,Kf,Gf,Xh,Jh,Qo,Yh,fr,gr,ks}from"./chunk-
|
|
2
|
+
import{qf,Wh,qh,Kh,Gh,Kf,Gf,Xh,Jh,Qo,Yh,fr,gr,ks}from"./chunk-k0arm18k.js";import{rt}from"./chunk-car6nhfe.js";import"./chunk-mv48q1p4.js";import"./chunk-e8zpzt9s.js";import"./chunk-v4bqmzj9.js";import"./chunk-0dmpc70r.js";import"./chunk-xppm4cs4.js";import"./chunk-ngnvyqk3.js";export{Gh as __setSignalsGeneratorsForTest,rt as cacheEngineFingerprint,gr as cacheTemplate,fr as checkCache,Yh as clearDevCaches,Gf as getCachedRouterScript,Kf as getCachedSignalsRuntime,Xh as getServeClientAsset,Qo as getServeModuleBundle,ks as hashFilePath,qh as invalidateFileCache,Kh as invalidateFileCacheByDir,Wh as readFileCached,Jh as registerServeModuleBundle,qf as templateCache};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Se,xi,Si,gg,Lt,tl,mg,nl,oy,Le,vn,je}from"./chunk-
|
|
2
|
+
import{Se,xi,Si,gg,Lt,tl,mg,nl,oy,Le,vn,je}from"./chunk-mv48q1p4.js";import{ll,r}from"./chunk-7kc9xwht.js";import"./chunk-e8zpzt9s.js";import"./chunk-v4bqmzj9.js";import"./chunk-0dmpc70r.js";import"./chunk-xppm4cs4.js";import"./chunk-ngnvyqk3.js";export{Se as BROWSER_CORE_IMPORTS,gg as STX_AUTO_IMPORTS,xi as extractAndStripCssImports,Le as extractBridgeData,ll as findInterpolationEnd,nl as generateAutoImportDestructuring,oy as generateBrowserAutoImportDestructuring,vn as generateServerDataBridge,Lt as injectBrowserCoreAutoImports,je as processClientScript,mg as referencesName,Si as renderVendorStyleTags,r as stripCommentsAndLiterals,tl as transformAutoImports};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{w,S,bi,hn}from"./chunk-
|
|
2
|
+
import{w,S,bi,hn}from"./chunk-mv48q1p4.js";import{Qo}from"./chunk-k0arm18k.js";import{c}from"./chunk-ehp792dy.js";import F from"fs";import d from"path";import{hasLocalConfig as he}from"bunfig";var vt={fg:{light:"neutral-900",dark:"neutral-100",description:"Primary text"},"fg-strong":{light:"neutral-700",dark:"neutral-300",description:"Labels, secondary headings"},"fg-muted":{light:"neutral-600",dark:"neutral-400",description:"Supporting text"},"fg-soft":{light:"neutral-500",dark:"neutral-400",description:"De-emphasised text"},"fg-subtle":{light:"neutral-400",dark:"neutral-500",description:"Recessive, non-essential text"},surface:{light:"neutral-50",dark:"neutral-800",description:"Page and panel background"},"surface-raised":{light:"neutral-100",dark:"neutral-700",description:"Cards, popovers"},"surface-sunken":{light:"neutral-200",dark:"neutral-700",description:"Wells, track backgrounds"},panel:{light:"white",dark:"neutral-800",description:"Card, menu, dialog surface"},field:{light:"white",dark:"neutral-700",description:"Form control surface"},page:{light:"neutral-50",dark:"neutral-900",description:"Page background, behind panels"},content:{light:"white",dark:"neutral-900",description:"Content area under a chrome header - a table or list body"},"surface-hover":{light:"neutral-100",dark:"neutral-700",description:"Row or item highlight on a page or panel"},"surface-raised-hover":{light:"neutral-200",dark:"neutral-600",description:"Raised surface, hovered"},"surface-sunken-hover":{light:"neutral-300",dark:"neutral-600",description:"Sunken surface, hovered"},"field-hover":{light:"neutral-50",dark:"neutral-600",description:"Form control surface, hovered"},link:{light:"blue-500",dark:"blue-400",description:"Hyperlink"},"link-hover":{light:"blue-600",dark:"blue-300",description:"Hyperlink, hovered"},inverse:{light:"neutral-900",dark:"neutral-700",description:"Tooltip bubble, inverted surface"},"inverse-ink":{light:"white",dark:"white",description:"Text on an inverted surface"},line:{light:"neutral-200",dark:"neutral-700",description:"Default border, divider"},"line-strong":{light:"neutral-300",dark:"neutral-600",description:"Input border, focus ring track"},"line-hover":{light:"neutral-400",dark:"neutral-500",description:"Border of a hovered control"},accent:{light:"blue-600",dark:"blue-400",description:"Primary action, selected state"},info:{light:"cyan-600",dark:"cyan-400",description:"Informational emphasis"},danger:{light:"red-600",dark:"red-400",description:"Errors, destructive actions"},success:{light:"green-600",dark:"green-400",description:"Confirmation"},warning:{light:"yellow-600",dark:"yellow-400",description:"Caution"},"accent-solid":{light:"blue-500",dark:"blue-600",description:"Primary button fill"},"info-solid":{light:"cyan-500",dark:"cyan-600",description:"Informational fill"},"danger-solid":{light:"red-500",dark:"red-600",description:"Destructive button fill"},"success-solid":{light:"green-500",dark:"green-600",description:"Confirmation fill"},"warning-solid":{light:"yellow-500",dark:"yellow-600",description:"Caution fill"},"accent-solid-hover":{light:"blue-600",dark:"blue-700",description:"Primary button fill, hovered"},"info-solid-hover":{light:"cyan-600",dark:"cyan-700",description:"Informational fill, hovered"},"danger-solid-hover":{light:"red-600",dark:"red-700",description:"Destructive fill, hovered"},"success-solid-hover":{light:"green-600",dark:"green-700",description:"Confirmation fill, hovered"},"warning-solid-hover":{light:"yellow-600",dark:"yellow-700",description:"Caution fill, hovered"},"accent-ink":{light:"white",dark:"white",description:"Text on a primary fill"},"info-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on an informational fill"},"danger-ink":{light:"white",dark:"white",description:"Text on a destructive fill"},"success-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a confirmation fill"},"warning-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a caution fill"},"accent-soft":{light:"blue-100",dark:"blue-900",description:"Tinted primary fill"},"accent-soft-ink":{light:"blue-800",dark:"blue-200",description:"Text on a tinted primary fill"},"info-soft":{light:"cyan-100",dark:"cyan-900",description:"Tinted informational fill"},"info-soft-ink":{light:"cyan-800",dark:"cyan-200",description:"Text on a tinted informational fill"},"danger-soft":{light:"red-100",dark:"red-900",description:"Tinted destructive fill"},"danger-soft-ink":{light:"red-800",dark:"red-200",description:"Text on a tinted destructive fill"},"success-soft":{light:"green-100",dark:"green-900",description:"Tinted confirmation fill"},"success-soft-ink":{light:"green-800",dark:"green-200",description:"Text on a tinted confirmation fill"},"warning-soft":{light:"yellow-100",dark:"yellow-900",description:"Tinted caution fill"},"warning-soft-ink":{light:"yellow-800",dark:"yellow-200",description:"Text on a tinted caution fill"},secondary:{light:"purple-600",dark:"purple-400",description:"Secondary emphasis"},"secondary-solid":{light:"purple-500",dark:"purple-600",description:"Secondary fill"},"secondary-solid-hover":{light:"purple-600",dark:"purple-700",description:"Secondary fill, hovered"},"secondary-ink":{light:"white",dark:"white",description:"Text on a secondary fill"},"secondary-soft":{light:"purple-100",dark:"purple-900",description:"Tinted secondary fill"},"secondary-soft-ink":{light:"purple-800",dark:"purple-200",description:"Text on a tinted secondary fill"},"danger-fg":{light:"red-900",dark:"red-300",description:"Text in a field with an error"},"danger-fg-subtle":{light:"red-300",dark:"red-500",description:"Recessive text in a field with an error"},"danger-line":{light:"red-300",dark:"red-600",description:"Border of a field with an error"},"danger-focus":{light:"red-500",dark:"red-400",description:"Focus ring of a field with an error"}};function Xe(n){return`--stx-${n}`}function _(n,t){let s=t.lastIndexOf("-");if(s===-1)return typeof n[t]==="string"?n[t]:void 0;let r=n[t.slice(0,s)];if(!r||typeof r!=="object")return;let i=r[t.slice(s+1)];return typeof i==="string"?i:void 0}var we=/^(?:#[\da-f]{3,8}|(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix|var)\(.*\)|white|black|transparent|currentcolor)$/i;function q(n,t){let s=t.trim();return _(n,s)??(we.test(s)?s:void 0)}function ee(n={}){return[...Object.keys(n.roles??{}).filter((t)=>!vt[t]).map((t)=>`roles.${t}`),...Object.keys(n.shapes??{}).filter((t)=>!be[t]).map((t)=>`shapes.${t}`),...Object.keys(n.density??{}).filter((t)=>!Pe[t]).map((t)=>`density.${t}`)]}function te(n){let t={};for(let[s,r]of Object.entries(vt)){let i=_(n,r.light);if(i===void 0)continue;t[s]=`var(${Xe(s)}, ${i})`}return t}function ne(n,t={}){let s=[],r=[];for(let[i,l]of Object.entries(vt)){let a=t[i],g=typeof a==="string"?a:a?.light,o=typeof a==="string"?a:a?.dark,f=g&&q(n,g)||_(n,l.light),h=o&&q(n,o)||_(n,l.dark);if(f===void 0)continue;if(s.push(` ${Xe(i)}: ${f};`),h!==void 0)r.push(` ${Xe(i)}: ${h};`)}if(s.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",...s,"}",".dark {",...r,"}",""].join(`
|
|
3
3
|
`)}var be={control:{value:"0.375rem",description:"Buttons, inputs, selects \u2014 rounded-md"},panel:{value:"0.5rem",description:"Cards, dialogs, menus \u2014 rounded-lg"},pill:{value:"9999px",description:"Chips and badges, which are pill-shaped by intent"}};function un(n){return`--stx-radius-${n}`}function se(){let n={};for(let[t,s]of Object.entries(be))n[t]=`var(${un(t)}, ${s.value})`;return n}function re(n={}){return["/* stx shape tokens \u2014 a radius by what the thing is. */",":root {",...Object.entries(be).map(([t,s])=>` ${un(t)}: ${n[t]??s.value};`),"}",""].join(`
|
|
4
4
|
`)}var Pe={"control-px":{value:"1rem",description:"Inline padding of a md text control \u2014 px-4"},"control-py":{value:"0.5rem",description:"Block padding of a md text control \u2014 py-2"},"control-text":{value:"1rem",description:"Font size of a md text control \u2014 text-base"},"control-leading":{value:"1.5rem",description:"Line height of a md text control \u2014 text-base"},"cell-px":{value:"1.5rem",description:"Inline padding of every table cell, header or body \u2014 px-6"},"cell-py":{value:"1rem",description:"Block padding of a body cell \u2014 py-4"},"cell-text":{value:"0.875rem",description:"Font size of a body cell \u2014 text-sm"},"cell-leading":{value:"1.25rem",description:"Line height of a body cell \u2014 text-sm"},"cell-head-py":{value:"0.75rem",description:"Block padding of a header cell \u2014 py-3"},"cell-head-text":{value:"0.75rem",description:"Font size of a header cell \u2014 text-xs"},"cell-head-leading":{value:"1rem",description:"Line height of a header cell \u2014 text-xs"}},ir={"control-x":"control-px","control-y":"control-py","cell-x":"cell-px","cell-y":"cell-py","cell-head-y":"cell-head-py"},ar={control:{size:"control-text",leading:"control-leading"},cell:{size:"cell-text",leading:"cell-leading"},"cell-head":{size:"cell-head-text",leading:"cell-head-leading"}};function Je(n){return`--stx-${n}`}function V(n){let t=Pe[n];if(!t)throw Error(`[stx] unknown density token "${n}"`);return`var(${Je(n)}, ${t.value})`}function ie(){let n={};for(let[t,s]of Object.entries(ir))n[t]=V(s);return n}function oe(){let n={};for(let[t,{size:s,leading:r}]of Object.entries(ar))n[t]=[V(s),{lineHeight:V(r)}];return n}function ce(n={}){return["/* stx density tokens \u2014 how much room a control or a table cell takes. */",":root {",...Object.entries(Pe).map(([t,s])=>` ${Je(t)}: ${n[t]??s.value};`),"}",""].join(`
|
|
5
5
|
`)}function ae(n){return typeof n==="object"&&n!==null&&!Array.isArray(n)}function W(n,t){let s={...n};for(let[r,i]of Object.entries(t))s[r]=ae(i)&&ae(s[r])?W(s[r],i):i;return s}function le(n,t){if(!t.fonts)return"";let s=new n({...t.config,fonts:t.fonts,cssVariables:!1}).toCSS(!1,t.minify);return s&&!t.minify?`${s}
|
|
6
|
-
`:s}function de(n={},t={}){let s=n.theme||{},r=t.theme||{},{extend:i,...l}=r,{extend:a,...g}=s,o=g.colors||{};g.colors={...o,...te(o)};let f=g.borderRadius||{};g.borderRadius={...f,...se()};let h=g.spacing||{};g.spacing={...h,...ie()};let K=g.fontSize||{};g.fontSize={...K,...oe()};let R=W(g,l),m=W(a||{},i||{});if(Object.keys(m).length>0)R.extend=m;let P=[...n.safelist||[],...t.safelist||[]],M={...n.shortcuts||{},...t.shortcuts||{}},D=[...n.preflights||[],...t.preflights||[]],{fonts:U,...O}=n,{fonts:N,roles:T,shapes:I,density:y,...C}=t,u={roles:T,shapes:I,density:y},j=N??U;return{config:{...O,...C,theme:R,safelist:P,shortcuts:M,...D.length>0?{preflights:D}:{},content:[],output:""},safelist:P,shortcuts:M,includePreflight:t.preflight!==!1,minify:t.minify===!0,tokenCSS:ne({...o,...R.colors},T)+re(I)+ce(y),unknownRoles:ee(u),...j?{fonts:j}:{}}}var e={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"};import B from"fs";import ve from"path";var $e=256,x=new Map,ge=(n)=>Bun.hash(n).toString(16).padStart(16,"0").slice(0,16),fe=(n)=>c(process.cwd(),"css-assets",`${n}.css`);function z(n,t){if(x.delete(n),x.set(n,t),x.size>$e)x.delete(x.keys().next().value)}function ue(n){let t=ge(n),s=fe(t);if(x.has(s))return z(s,n),t;let r;try{let i;try{i=B.readFileSync(s,"utf8")}catch{}if(i!==n)B.mkdirSync(ve.dirname(s),{recursive:!0}),r=`${s}.${process.pid}.${crypto.randomUUID()}.tmp`,B.writeFileSync(r,n,{flag:"wx"}),B.renameSync(r,s);return z(s,n),t}catch{return}finally{if(r)try{B.unlinkSync(r)}catch{}}}function Mf(n){if(!/^[a-f0-9]{16}$/.test(n))return;let t=fe(n),s=x.get(t);if(s!==void 0)return z(t,s),s;try{let r=B.readFileSync(t,"utf8");if(ge(r)!==n)return;return z(t,r),r}catch{return}}function pe(){x.clear()}var p=null,G="";function me(n){try{let t=n.startsWith("file:")?new URL(n).pathname:n;G=`${t}@${Math.trunc(F.statSync(t).mtimeMs)}`}catch{G=n}}var Y=!1,v=null,A="",E=!1,Re=256,k=new Map,L=null,Ce=null,H=new Map,ye=new Set;function X(n){return Bun.hash(n).toString(16).padStart(16,"0").slice(0,16)}function Q(n,t){if(k.has(n))k.delete(n);else if(k.size>=Re)k.delete(k.keys().next().value);k.set(n,t)}async function Te(n,t=L){if(!t)return null;try{let s=Bun.file(d.join(t,`cw-${X(n)}.css`));if(!await s.exists())return null;return await s.text()}catch{return null}}async function je(n,t,s=L){if(!s)return;try{if(!F.existsSync(s))F.mkdirSync(s,{recursive:!0});await Bun.write(d.join(s,`cw-${X(n)}.css`),t)}catch{}}async function xe(n){try{let t=await import(n);if(t&&t.CSSGenerator)return{CSSGenerator:t.CSSGenerator,config:t.config,build:t.build,defaultConfig:t.defaultConfig,extractClasses:t.extractClasses}}catch{}return null}var Be=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],Ee=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function De(){let n=[],t=process.cwd();while(t!==d.dirname(t)){for(let s of["node_modules","pantry"])for(let r of Be)n.push(d.join(t,s,...r));t=d.dirname(t)}return n}function Oe(){let n=[],t=process.env.HOME||process.env.USERPROFILE||"",s=[t&&d.join(t,"Code","Tools","ts-css"),t&&d.join(t,"Code","Tools","crosswind"),t&&d.join(t,"repos","stacks-org","ts-css"),t&&d.join(t,"repos","stacks-org","crosswind"),d.join(process.cwd(),"..","ts-css"),d.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let r of s)n.push(d.join(r,"packages","toolkit","dist","engine","index.js")),n.push(d.join(r,"packages","toolkit","src","engine","index.ts"));if(t)n.push(d.join(t,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return n}async function dc(){if(Y)return p;Y=!0;try{let n=async(i)=>{for(let l of i){if(!await Bun.file(l).exists())continue;let a=await xe(l);if(a){if(me(l),!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded from ${d.dirname(d.dirname(l))}`);return a}}return null};if(process.env.CROSSWIND_SRC){let i=d.resolve(process.env.CROSSWIND_SRC),l=await n([i]);if(!l)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${i}`);return p=l,p}let t=await n(De());if(t)return p=t,p;let s=Ee;for(let i of s){let l=await xe(i);if(l){p=l;try{me(import.meta.resolve(i))}catch{G=i}if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded`);return p}}let r=await n(Oe());if(r)return p=r,p;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${e.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${e.reset}`),console.warn(`${e.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${e.reset}`),null}}function Mh(){J.clear(),p=null,Y=!1,v=null,A="",k.clear(),pe(),Ce=null,H.clear()}var ke=!1;async function pc(n){try{let t=he({name:"css",cwd:n})?"css":he({name:"crosswind",cwd:n})?"crosswind":null;if(!t)return null;if(t==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!ke)ke=!0,console.warn(`${e.yellow}[ts-css]${e.reset} Reading the CSS config from a \`crosswind\` file. Rename it to \`css\` (e.g. config/css.ts) \u2014 the old name is deprecated.`);let{loadConfigWithResult:s}=await import("bunfig"),r=await s({name:t,cwd:n,defaultConfig:{},checkEnv:!1,verbose:!1});if(!r?.path||!r.config||Object.keys(r.config).length===0)return null;let i=d.relative(n,r.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} Loaded config from ${i||r.path}`);return r.config}catch(t){if(t instanceof Error&&t.name==="ConfigNotFoundError")return null;return console.warn(`${e.yellow}[ts-css]${e.reset} Failed to load css config:`,t instanceof Error?t.message:t),null}}async function Df(n){let t=null;try{let{loadStxConfig:s}=await import("./chunk-
|
|
6
|
+
`:s}function de(n={},t={}){let s=n.theme||{},r=t.theme||{},{extend:i,...l}=r,{extend:a,...g}=s,o=g.colors||{};g.colors={...o,...te(o)};let f=g.borderRadius||{};g.borderRadius={...f,...se()};let h=g.spacing||{};g.spacing={...h,...ie()};let K=g.fontSize||{};g.fontSize={...K,...oe()};let R=W(g,l),m=W(a||{},i||{});if(Object.keys(m).length>0)R.extend=m;let P=[...n.safelist||[],...t.safelist||[]],M={...n.shortcuts||{},...t.shortcuts||{}},D=[...n.preflights||[],...t.preflights||[]],{fonts:U,...O}=n,{fonts:N,roles:T,shapes:I,density:y,...C}=t,u={roles:T,shapes:I,density:y},j=N??U;return{config:{...O,...C,theme:R,safelist:P,shortcuts:M,...D.length>0?{preflights:D}:{},content:[],output:""},safelist:P,shortcuts:M,includePreflight:t.preflight!==!1,minify:t.minify===!0,tokenCSS:ne({...o,...R.colors},T)+re(I)+ce(y),unknownRoles:ee(u),...j?{fonts:j}:{}}}var e={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"};import B from"fs";import ve from"path";var $e=256,x=new Map,ge=(n)=>Bun.hash(n).toString(16).padStart(16,"0").slice(0,16),fe=(n)=>c(process.cwd(),"css-assets",`${n}.css`);function z(n,t){if(x.delete(n),x.set(n,t),x.size>$e)x.delete(x.keys().next().value)}function ue(n){let t=ge(n),s=fe(t);if(x.has(s))return z(s,n),t;let r;try{let i;try{i=B.readFileSync(s,"utf8")}catch{}if(i!==n)B.mkdirSync(ve.dirname(s),{recursive:!0}),r=`${s}.${process.pid}.${crypto.randomUUID()}.tmp`,B.writeFileSync(r,n,{flag:"wx"}),B.renameSync(r,s);return z(s,n),t}catch{return}finally{if(r)try{B.unlinkSync(r)}catch{}}}function Mf(n){if(!/^[a-f0-9]{16}$/.test(n))return;let t=fe(n),s=x.get(t);if(s!==void 0)return z(t,s),s;try{let r=B.readFileSync(t,"utf8");if(ge(r)!==n)return;return z(t,r),r}catch{return}}function pe(){x.clear()}var p=null,G="";function me(n){try{let t=n.startsWith("file:")?new URL(n).pathname:n;G=`${t}@${Math.trunc(F.statSync(t).mtimeMs)}`}catch{G=n}}var Y=!1,v=null,A="",E=!1,Re=256,k=new Map,L=null,Ce=null,H=new Map,ye=new Set;function X(n){return Bun.hash(n).toString(16).padStart(16,"0").slice(0,16)}function Q(n,t){if(k.has(n))k.delete(n);else if(k.size>=Re)k.delete(k.keys().next().value);k.set(n,t)}async function Te(n,t=L){if(!t)return null;try{let s=Bun.file(d.join(t,`cw-${X(n)}.css`));if(!await s.exists())return null;return await s.text()}catch{return null}}async function je(n,t,s=L){if(!s)return;try{if(!F.existsSync(s))F.mkdirSync(s,{recursive:!0});await Bun.write(d.join(s,`cw-${X(n)}.css`),t)}catch{}}async function xe(n){try{let t=await import(n);if(t&&t.CSSGenerator)return{CSSGenerator:t.CSSGenerator,config:t.config,build:t.build,defaultConfig:t.defaultConfig,extractClasses:t.extractClasses}}catch{}return null}var Be=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],Ee=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function De(){let n=[],t=process.cwd();while(t!==d.dirname(t)){for(let s of["node_modules","pantry"])for(let r of Be)n.push(d.join(t,s,...r));t=d.dirname(t)}return n}function Oe(){let n=[],t=process.env.HOME||process.env.USERPROFILE||"",s=[t&&d.join(t,"Code","Tools","ts-css"),t&&d.join(t,"Code","Tools","crosswind"),t&&d.join(t,"repos","stacks-org","ts-css"),t&&d.join(t,"repos","stacks-org","crosswind"),d.join(process.cwd(),"..","ts-css"),d.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let r of s)n.push(d.join(r,"packages","toolkit","dist","engine","index.js")),n.push(d.join(r,"packages","toolkit","src","engine","index.ts"));if(t)n.push(d.join(t,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return n}async function dc(){if(Y)return p;Y=!0;try{let n=async(i)=>{for(let l of i){if(!await Bun.file(l).exists())continue;let a=await xe(l);if(a){if(me(l),!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded from ${d.dirname(d.dirname(l))}`);return a}}return null};if(process.env.CROSSWIND_SRC){let i=d.resolve(process.env.CROSSWIND_SRC),l=await n([i]);if(!l)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${i}`);return p=l,p}let t=await n(De());if(t)return p=t,p;let s=Ee;for(let i of s){let l=await xe(i);if(l){p=l;try{me(import.meta.resolve(i))}catch{G=i}if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded`);return p}}let r=await n(Oe());if(r)return p=r,p;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${e.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${e.reset}`),console.warn(`${e.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${e.reset}`),null}}function Mh(){J.clear(),p=null,Y=!1,v=null,A="",k.clear(),pe(),Ce=null,H.clear()}var ke=!1;async function pc(n){try{let t=he({name:"css",cwd:n})?"css":he({name:"crosswind",cwd:n})?"crosswind":null;if(!t)return null;if(t==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!ke)ke=!0,console.warn(`${e.yellow}[ts-css]${e.reset} Reading the CSS config from a \`crosswind\` file. Rename it to \`css\` (e.g. config/css.ts) \u2014 the old name is deprecated.`);let{loadConfigWithResult:s}=await import("bunfig"),r=await s({name:t,cwd:n,defaultConfig:{},checkEnv:!1,verbose:!1});if(!r?.path||!r.config||Object.keys(r.config).length===0)return null;let i=d.relative(n,r.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} Loaded config from ${i||r.path}`);return r.config}catch(t){if(t instanceof Error&&t.name==="ConfigNotFoundError")return null;return console.warn(`${e.yellow}[ts-css]${e.reset} Failed to load css config:`,t instanceof Error?t.message:t),null}}async function Df(n){let t=null;try{let{loadStxConfig:s}=await import("./chunk-hfe2byfx.js"),r=await s(n);if(r.css)if(typeof r.css==="string"){let i=d.isAbsolute(r.css)?r.css:d.resolve(n,r.css);if(await Bun.file(i).exists()){let l=await import(i);t=l.default||l,console.log(`${e.green}[ts-css]${e.reset} Loaded config from stx.config.ts \u2192 ${r.css}`)}}else{if(t={...r.css,content:r.css.content||[],preflight:r.css.preflight??!0,minify:r.css.minify??!1},r.css.config){let i=d.isAbsolute(r.css.config)?r.css.config:d.resolve(n,r.css.config);if(await Bun.file(i).exists()){let l=await import(i);t={...l.default||l,...t}}}console.log(`${e.green}[ts-css]${e.reset} Using inline CSS config from stx.config.ts`)}}catch{}return t||await pc(n)}function Lf(n){try{let t=new WeakSet;return X(JSON.stringify(n??{},(s,r)=>{if(typeof r==="function")return`[fn]${String(r)}`;if(typeof r==="object"&&r!==null){if(t.has(r))return"[circular]";t.add(r)}return r})??"")}catch{return"unhashable"}}async function dn(n){if(E)return A;E=!0;try{let t=await dc();if(!t||!t.build)return E=!1,"";if(!v)v=await pc(n);if(!v)return E=!1,"";let s=t.defaultConfig?.theme||{},r=v.theme||{},i={...t.defaultConfig,...v,theme:{...s,...r,extend:{...s.extend||{},...r.extend||{}}}},l=performance.now(),a=await t.build(i),g=performance.now()-l;if(A=a.css,console.log(`${e.cyan}[ts-css]${e.reset} Built ${a.classes.size} classes in ${g.toFixed(1)}ms`),i.output){let o=d.isAbsolute(i.output)?i.output:d.join(n,i.output),f=d.dirname(o);if(!F.existsSync(f))F.mkdirSync(f,{recursive:!0});await Bun.write(o,a.css)}return E=!1,a.css}catch(t){return console.error(`${e.red}[ts-css]${e.reset} Build error:`,t),E=!1,A}}async function cr(n){v=null,await dn(n)}function Dh(){return A}function jf(n){let t=new Set,s=/class\s*=\s*["']([^"']+)["']/gi,r=s.exec(n);while(r!==null){for(let a of r[1].split(/\s+/))if(a.trim())t.add(a.trim());r=s.exec(n)}let i=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,l=i.exec(n);while(l!==null){let a=l[1].match(/'([^']+)'/g);if(a){for(let g of a)for(let o of g.slice(1,-1).split(/\s+/))if(o.trim())t.add(o.trim())}l=i.exec(n)}return t}var J=w(64);async function Bf(n,t){let s=()=>H.get(t?d.resolve(t):process.cwd())?.fingerprint??null,r=J.get(S(n,t,s()));if(r!==void 0)return r;let i=await Ne(n,t);if(i)J.set(S(n,t,s()),i);return i}function*Se(n){yield n;let t=new Set;for(let s of n.matchAll(/\/_stx\/modules\.([0-9a-f]{16})\.js/g)){let r=s[1];if(t.has(r))continue;t.add(r);let i=Qo(r);if(i)yield i}}function Lh(n){return[...Se(n)].join(`
|
|
7
7
|
`)}async function Ne(n,t){try{let s=await dc();if(!s)return"";let r=new Set;for(let u of Se(n)){let j=typeof s.extractClasses==="function"?s.extractClasses(u):jf(u);for(let Z of j)r.add(Z)}if(r.size===0)return"";let i=t?d.resolve(t):process.cwd(),l=c(i,"cache");if(!L)L=l;let a=H.get(i);if(!a){let u=await Df(i);a={config:u,fingerprint:Lf(u)},H.set(i,a),Ce=a.fingerprint}let g=[...r].sort().join(" "),o=`${G}::${a.fingerprint||"default"}::${g}`,f=k.get(o);if(f!==void 0)return Q(o,f),f;let h=await Te(o,l);if(h!==null)return Q(o,h),h;let K=s.defaultConfig||s.config,R=a.config||{},m=de(K,R),{safelist:P,includePreflight:M,minify:D,tokenCSS:U}=m;if(m.unknownRoles.length>0&&!ye.has(i))ye.add(i),console.warn(`${e.yellow}[ts-css]${e.reset} No stx role for ${m.unknownRoles.join(", ")} - these keep the stock value. Role names: semanticTokenNames() in @stacksjs/stx/theme-tokens.`);let O=m.config,N=new s.CSSGenerator(O),T=O.shortcuts||R.shortcuts||{},I=Object.keys(T).filter((u)=>r.has(u)||P.includes(u));for(let u of P)if(!T[u])N.generate(u);for(let u of r)if(!T[u])N.generate(u);let y="";if(I.length>0){let u=new s.CSSGenerator(O);for(let j of I)u.generate(j);if(y=u.toCSS(!1,D),y&&!y.endsWith(`
|
|
8
8
|
`))y+=`
|
|
9
9
|
`}let C=y+N.toCSS(M,D);return C=le(s.CSSGenerator,m)+U+C,Q(o,C),je(o,C,l),C}catch(s){return console.warn("Failed to generate Css CSS:",s),""}}async function b(n,t,s=!1,r=!1){let i=await Bf(n,t);if(!i)return r?hn(n):n;let l=s?ue(i):void 0,a=l?`<link data-css="generated" rel="stylesheet" href="/_stx/css.${l}.css">`:`<style data-css="generated">
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{He,M,jt}from"./chunk-v4bqmzj9.js";import{R}from"./chunk-0dmpc70r.js";import{mt,Ee,j,Ke,Te,ba,vo,wa,Dn}from"./chunk-xsc8pksj.js";import{_t,de,tt}from"./chunk-9r999ees.js";import{Do}from"./chunk-5t4k477c.js";import{Ln}from"./chunk-12r22pf0.js";import{we}from"./chunk-y3gajdr9.js";import Z from"fs";import P from"path";var{serve:ae}=globalThis.Bun;import H from"zlib";import{promisify as Y}from"util";var K=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],ee=["text/event-stream","multipart/x-mixed-replace"],te=1024;function ne(t){if(!t)return!1;let e=t.toLowerCase();if(ee.some((a)=>e.startsWith(a)))return!1;return K.some((a)=>e.startsWith(a))}function re(t){let e=new Map;for(let a of t.split(",")){let[r,...i]=a.trim().split(";"),f=r.trim().toLowerCase();if(!f)continue;let h=1;for(let g of i){let l=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(g);if(!l)continue;let m=Number.parseFloat(l[1]);if(Number.isFinite(m))h=m}e.set(f,h)}return e}function se(t){if(!t)return null;let e=re(t),a=e.get("*"),r=(i)=>e.get(i)??a??0;if(r("br")>0)return"br";if(r("gzip")>0)return"gzip";return null}var J=33554432,F=new Map,z=0;function oe(t,e){if(e.length>J/8)return;F.set(t,e),z+=e.length;for(let[a,r]of F){if(z<=J)break;F.delete(a),z-=r.length}}async function In(t,e,a={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!ne(e.headers.get("content-type")))return e;let r=se(t.headers.get("accept-encoding"));if(!r)return e;let i;try{i=new Uint8Array(await e.arrayBuffer())}catch{return e}let f=()=>new Response(i,{status:e.status,statusText:e.statusText,headers:Q(e.headers)});if(i.length<(a.threshold??te))return f();try{let h=a.quality??5,g=`${r}:${h}:${i.length}:${Bun.hash(i)}`,l=F.get(g);if(!l)l=r==="br"?await Y(H.brotliCompress)(i,{params:{[H.constants.BROTLI_PARAM_QUALITY]:h,[H.constants.BROTLI_PARAM_SIZE_HINT]:i.length}}):await Y(H.gzip)(i),oe(g,l);if(l.length>=i.length)return f();let m=Q(e.headers);return m.set("Content-Encoding",r),m.set("Content-Length",String(l.length)),new Response(l,{status:e.status,statusText:e.statusText,headers:m})}catch{return f()}}function Q(t){let e=new Headers(t),a=e.get("Vary");if(!a)return e.set("Vary","Accept-Encoding"),e;if(!a.split(",").some((i)=>i.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${a}, Accept-Encoding`);return e}class G{now;entries=new R(1000,{maxBytes:33554432,sizeOf:(t)=>t.body.byteLength+JSON.stringify(t.headers).length*2});pending=new Map;generation=0;constructor(t=Date.now){this.now=t}invalidate(t){this.generation++,this.pending.clear();for(let e of Array.from(this.entries.keys()))if(t===void 0||this.entries.get(e)?.path===t)this.entries.delete(e)}async respond(t,e,a){let r,i=async()=>{let s=r??await a();return s.headers.set("Cache-Control","private, no-store"),s.headers.set("Vary",j(s.headers.get("Vary")).Vary),s};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return i();let f=new URL(t.url),h=`${f.origin}${f.pathname}${f.search}|${Ee(t)?"fragment":"document"}`,g=this.entries.get(h),l=(s)=>{let S=new Headers(s.headers);return S.set("Cache-Control","private, no-store"),S.set("Age",String(Math.max(0,Math.floor((this.now()-s.created)/1000)))),new Response(s.body.slice(0),{headers:S})},m=g?(this.now()-g.created)/1000:1/0;if(g&&m<e.maxAge)return l(g);let b=this.generation,k=async()=>{let s=await a();r=s;let S=(s.headers.get("Vary")??"").toLowerCase().split(",").map((C)=>C.trim()).filter(Boolean);if(s.status!==200||s.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(s.headers.get("Cache-Control")??"")||S.some((C)=>C!=="x-stx-router"&&C!=="accept-encoding"))return null;let B=await s.clone().arrayBuffer();if(B.byteLength>1048576)return null;s.headers.set("Vary",j(s.headers.get("Vary")).Vary);let n={body:B,headers:Array.from(s.headers.entries()),created:this.now(),path:f.pathname};if(this.generation===b)this.entries.set(h,n);return n},v=this.pending.get(h);if(!v){if(this.pending.size>=1000)return i();v=k().finally(()=>{if(this.pending.get(h)===v)this.pending.delete(h)}),this.pending.set(h,v)}if(g&&m<e.maxAge+(e.swr??0))return v.catch(()=>{}),l(g);let E=await v;return E?l(E):i()}}var ie={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"};async function rm(t={}){let e=P.resolve(t.outputDir||".output"),a=t.port??3000,r=ba(e);if(!r)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${r.routes.length} routes...`);let i=Ln(r.routeRules),f=new G,h=Do(e,r.apiRoutes??[]),g=Bun.file(P.join(e,"server/runtime-config.json")),l=t.runtimeConfig??(await g.exists()?await g.json():void 0),m=l?M(l):void 0,b=new Map,k=new Map,v=new Map,E=new Map;for(let n of r.routes)try{let C=P.join(e,n.compiledPath),c=JSON.parse(await Bun.file(C).text());if(m)c.html=jt(c.html,m);b.set(n.pattern,c),v.set(n.pattern,tt(c.html)),E.set(n.pattern,we(c.html));let _=P.join(e,n.fragmentPath);if(Ke(c.html,r.routerContainer||"main")&&await Bun.file(_).exists()){let A=await Bun.file(_).text();k.set(n.pattern,m?jt(A,m):A)}}catch(C){console.warn(`[stx] Failed to load route ${n.pattern}:`,C)}let s=new Map,S=[];for(let n of r.routes)if(n.hasParams){let{regex:C,params:c}=de(n.pattern,{page:!0});S.push({regex:C,route:n,paramNames:c})}else s.set(n.pattern,n);let B=ae({port:a,async fetch(n){return In(n,await He(m??M(),async()=>{let c=new URL(n.url).pathname;if(t.onRequest){let p=await t.onRequest(n);if(p)return p}if(t.apiRouter){let p=await t.apiRouter.handleRequest(n);if(p.status!==404)return p}if(t.apiRoutes?.[c])return t.apiRoutes[c](n);let _=await h(n);if(_)return _;if((n.method==="GET"||n.method==="HEAD")&&c!=="/"){let p=P.resolve(e,"public"),d;try{d=decodeURIComponent(c)}catch{d=c}if(!d.includes("\x00")){let u=P.resolve(p,`.${d}`);if(u===p||u.startsWith(`${p}${P.sep}`))try{if(Z.existsSync(u)&&Z.statSync(u).isFile()){let y=P.extname(u).toLowerCase(),L=ie[y]||"application/octet-stream",N=c.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(c);return new Response(Bun.file(u),{headers:{"Content-Type":L,"Cache-Control":N?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let A=Ee(n),w=null,q={};if(w=s.get(c)||null,!w)for(let{regex:p,route:d,paramNames:u}of S){let o=c.match(p);if(o){w=d,u.forEach((y,L)=>{q[y]=o[L+1]});break}}if(!w){let p=_t(c)?null:s.get("/404")||null;if(p){let d=b.get(p.pattern);if(d)return new Response(d.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}})}let O=i(c),W=Object.keys(O).length>0;return f.respond(n,O.cache,async()=>{let p=b.get(w.pattern);if(A&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let o=k.get(w.pattern);if(o){let y=v.get(w.pattern);return new Response(o,{status:p.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...E.has(w.pattern)?{"X-STX-Runtime":E.get(w.pattern)?"true":"false"}:{},...y?{"X-STX-Layout":y.layout,"X-STX-Layout-Group":y.group}:{},...j(),...O.cache?{}:{"Cache-Control":mt}}})}}let d=vo(n.method),u=b.get(w.pattern);if(!u){let o=s.get("/500")||null;if(o){let y=b.get(o.pattern);if(y)return new Response(y.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(w.prerendered&&d)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!d&&!u.hasServerScripts&&Object.keys(u.placeholders).length===0)return new Response(u.html,{status:u.status??200,headers:{"Content-Type":"text/html",...j(),"Cache-Control":"public, max-age=60"}});try{let{html:o,boundaries:y,redirect:L,cookies:N,status:I,headers:D}=await Dn(u,{params:q,request:n,method:n.method,__stx_strict_hydration:W,__stx_runtime_config:m});if(L)return wa(L,N,D);if(y&&y.length>0){let{renderStreamingPage:T,streamToResponse:U}=await import("./chunk-dq41v6hy.js"),X=new Headers({...j(),...D,"Cache-Control":"private, no-store"});for(let V of N??[])X.append("Set-Cookie",V);if(A&&!d&&Ke(o,r.routerContainer||"main")){let V=tt(o);X.set("X-STX-Fragment","true"),X.set("X-STX-Runtime",we(o)?"true":"false"),X.set("X-STX-Layout",V.layout),X.set("X-STX-Layout-Group",V.group)}return U(T(A&&!d&&Ke(o,r.routerContainer||"main")?Te(o,r.routerContainer||"main",!0):o,y,{timeoutMs:30000}),{status:I??u.status??200,headers:X})}let x=new Headers({"Content-Type":"text/html",...j(),...O.cache?{}:{"Cache-Control":"private, no-store"}});for(let T of N??[])x.append("Set-Cookie",T);for(let[T,U]of Object.entries(D??{}))x.set(T,U);if(x.set("Vary",j(x.get("Vary")).Vary),A&&!d&&Ke(o,r.routerContainer||"main")){let T=tt(o);return x.set("X-STX-Fragment","true"),x.set("X-STX-Runtime",we(o)?"true":"false"),x.set("X-STX-Layout",T.layout),x.set("X-STX-Layout-Group",T.group),new Response(Te(o,r.routerContainer||"main",!0),{status:I??u.status??200,headers:x})}return new Response(o,{status:I??u.status??200,headers:x})}catch(o){if(console.error(`[stx] Hydration error for ${c}:`,o),W)return new Response("Internal Server Error",{status:500});return new Response(u.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${B.port}`),console.log(`[stx] Serving ${r.routes.length} routes (${b.size} pre-loaded)`),{port:B.port,stop:()=>{f.invalidate(),B.stop()},invalidate:(n)=>f.invalidate(n)}}
|
|
2
|
+
import{He,M,jt}from"./chunk-v4bqmzj9.js";import{R}from"./chunk-0dmpc70r.js";import{mt,Ee,j,Ke,Te,ba,vo,wa,Dn}from"./chunk-fba71th7.js";import{_t,de,tt}from"./chunk-9r999ees.js";import{Do}from"./chunk-4cd94cd5.js";import{Ln}from"./chunk-12r22pf0.js";import{we}from"./chunk-7hp50cpd.js";import Z from"fs";import P from"path";var{serve:ae}=globalThis.Bun;import H from"zlib";import{promisify as Y}from"util";var K=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],ee=["text/event-stream","multipart/x-mixed-replace"],te=1024;function ne(t){if(!t)return!1;let e=t.toLowerCase();if(ee.some((a)=>e.startsWith(a)))return!1;return K.some((a)=>e.startsWith(a))}function re(t){let e=new Map;for(let a of t.split(",")){let[r,...i]=a.trim().split(";"),f=r.trim().toLowerCase();if(!f)continue;let h=1;for(let g of i){let l=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(g);if(!l)continue;let m=Number.parseFloat(l[1]);if(Number.isFinite(m))h=m}e.set(f,h)}return e}function se(t){if(!t)return null;let e=re(t),a=e.get("*"),r=(i)=>e.get(i)??a??0;if(r("br")>0)return"br";if(r("gzip")>0)return"gzip";return null}var J=33554432,F=new Map,z=0;function oe(t,e){if(e.length>J/8)return;F.set(t,e),z+=e.length;for(let[a,r]of F){if(z<=J)break;F.delete(a),z-=r.length}}async function In(t,e,a={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!ne(e.headers.get("content-type")))return e;let r=se(t.headers.get("accept-encoding"));if(!r)return e;let i;try{i=new Uint8Array(await e.arrayBuffer())}catch{return e}let f=()=>new Response(i,{status:e.status,statusText:e.statusText,headers:Q(e.headers)});if(i.length<(a.threshold??te))return f();try{let h=a.quality??5,g=`${r}:${h}:${i.length}:${Bun.hash(i)}`,l=F.get(g);if(!l)l=r==="br"?await Y(H.brotliCompress)(i,{params:{[H.constants.BROTLI_PARAM_QUALITY]:h,[H.constants.BROTLI_PARAM_SIZE_HINT]:i.length}}):await Y(H.gzip)(i),oe(g,l);if(l.length>=i.length)return f();let m=Q(e.headers);return m.set("Content-Encoding",r),m.set("Content-Length",String(l.length)),new Response(l,{status:e.status,statusText:e.statusText,headers:m})}catch{return f()}}function Q(t){let e=new Headers(t),a=e.get("Vary");if(!a)return e.set("Vary","Accept-Encoding"),e;if(!a.split(",").some((i)=>i.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${a}, Accept-Encoding`);return e}class G{now;entries=new R(1000,{maxBytes:33554432,sizeOf:(t)=>t.body.byteLength+JSON.stringify(t.headers).length*2});pending=new Map;generation=0;constructor(t=Date.now){this.now=t}invalidate(t){this.generation++,this.pending.clear();for(let e of Array.from(this.entries.keys()))if(t===void 0||this.entries.get(e)?.path===t)this.entries.delete(e)}async respond(t,e,a){let r,i=async()=>{let s=r??await a();return s.headers.set("Cache-Control","private, no-store"),s.headers.set("Vary",j(s.headers.get("Vary")).Vary),s};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return i();let f=new URL(t.url),h=`${f.origin}${f.pathname}${f.search}|${Ee(t)?"fragment":"document"}`,g=this.entries.get(h),l=(s)=>{let S=new Headers(s.headers);return S.set("Cache-Control","private, no-store"),S.set("Age",String(Math.max(0,Math.floor((this.now()-s.created)/1000)))),new Response(s.body.slice(0),{headers:S})},m=g?(this.now()-g.created)/1000:1/0;if(g&&m<e.maxAge)return l(g);let b=this.generation,k=async()=>{let s=await a();r=s;let S=(s.headers.get("Vary")??"").toLowerCase().split(",").map((C)=>C.trim()).filter(Boolean);if(s.status!==200||s.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(s.headers.get("Cache-Control")??"")||S.some((C)=>C!=="x-stx-router"&&C!=="accept-encoding"))return null;let B=await s.clone().arrayBuffer();if(B.byteLength>1048576)return null;s.headers.set("Vary",j(s.headers.get("Vary")).Vary);let n={body:B,headers:Array.from(s.headers.entries()),created:this.now(),path:f.pathname};if(this.generation===b)this.entries.set(h,n);return n},v=this.pending.get(h);if(!v){if(this.pending.size>=1000)return i();v=k().finally(()=>{if(this.pending.get(h)===v)this.pending.delete(h)}),this.pending.set(h,v)}if(g&&m<e.maxAge+(e.swr??0))return v.catch(()=>{}),l(g);let E=await v;return E?l(E):i()}}var ie={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"};async function rm(t={}){let e=P.resolve(t.outputDir||".output"),a=t.port??3000,r=ba(e);if(!r)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${r.routes.length} routes...`);let i=Ln(r.routeRules),f=new G,h=Do(e,r.apiRoutes??[]),g=Bun.file(P.join(e,"server/runtime-config.json")),l=t.runtimeConfig??(await g.exists()?await g.json():void 0),m=l?M(l):void 0,b=new Map,k=new Map,v=new Map,E=new Map;for(let n of r.routes)try{let C=P.join(e,n.compiledPath),c=JSON.parse(await Bun.file(C).text());if(m)c.html=jt(c.html,m);b.set(n.pattern,c),v.set(n.pattern,tt(c.html)),E.set(n.pattern,we(c.html));let _=P.join(e,n.fragmentPath);if(Ke(c.html,r.routerContainer||"main")&&await Bun.file(_).exists()){let A=await Bun.file(_).text();k.set(n.pattern,m?jt(A,m):A)}}catch(C){console.warn(`[stx] Failed to load route ${n.pattern}:`,C)}let s=new Map,S=[];for(let n of r.routes)if(n.hasParams){let{regex:C,params:c}=de(n.pattern,{page:!0});S.push({regex:C,route:n,paramNames:c})}else s.set(n.pattern,n);let B=ae({port:a,async fetch(n){return In(n,await He(m??M(),async()=>{let c=new URL(n.url).pathname;if(t.onRequest){let p=await t.onRequest(n);if(p)return p}if(t.apiRouter){let p=await t.apiRouter.handleRequest(n);if(p.status!==404)return p}if(t.apiRoutes?.[c])return t.apiRoutes[c](n);let _=await h(n);if(_)return _;if((n.method==="GET"||n.method==="HEAD")&&c!=="/"){let p=P.resolve(e,"public"),d;try{d=decodeURIComponent(c)}catch{d=c}if(!d.includes("\x00")){let u=P.resolve(p,`.${d}`);if(u===p||u.startsWith(`${p}${P.sep}`))try{if(Z.existsSync(u)&&Z.statSync(u).isFile()){let y=P.extname(u).toLowerCase(),L=ie[y]||"application/octet-stream",N=c.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(c);return new Response(Bun.file(u),{headers:{"Content-Type":L,"Cache-Control":N?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let A=Ee(n),w=null,q={};if(w=s.get(c)||null,!w)for(let{regex:p,route:d,paramNames:u}of S){let o=c.match(p);if(o){w=d,u.forEach((y,L)=>{q[y]=o[L+1]});break}}if(!w){let p=_t(c)?null:s.get("/404")||null;if(p){let d=b.get(p.pattern);if(d)return new Response(d.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}})}let O=i(c),W=Object.keys(O).length>0;return f.respond(n,O.cache,async()=>{let p=b.get(w.pattern);if(A&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let o=k.get(w.pattern);if(o){let y=v.get(w.pattern);return new Response(o,{status:p.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...E.has(w.pattern)?{"X-STX-Runtime":E.get(w.pattern)?"true":"false"}:{},...y?{"X-STX-Layout":y.layout,"X-STX-Layout-Group":y.group}:{},...j(),...O.cache?{}:{"Cache-Control":mt}}})}}let d=vo(n.method),u=b.get(w.pattern);if(!u){let o=s.get("/500")||null;if(o){let y=b.get(o.pattern);if(y)return new Response(y.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(w.prerendered&&d)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!d&&!u.hasServerScripts&&Object.keys(u.placeholders).length===0)return new Response(u.html,{status:u.status??200,headers:{"Content-Type":"text/html",...j(),"Cache-Control":"public, max-age=60"}});try{let{html:o,boundaries:y,redirect:L,cookies:N,status:I,headers:D}=await Dn(u,{params:q,request:n,method:n.method,__stx_strict_hydration:W,__stx_runtime_config:m});if(L)return wa(L,N,D);if(y&&y.length>0){let{renderStreamingPage:T,streamToResponse:U}=await import("./chunk-ggthncvg.js"),X=new Headers({...j(),...D,"Cache-Control":"private, no-store"});for(let V of N??[])X.append("Set-Cookie",V);if(A&&!d&&Ke(o,r.routerContainer||"main")){let V=tt(o);X.set("X-STX-Fragment","true"),X.set("X-STX-Runtime",we(o)?"true":"false"),X.set("X-STX-Layout",V.layout),X.set("X-STX-Layout-Group",V.group)}return U(T(A&&!d&&Ke(o,r.routerContainer||"main")?Te(o,r.routerContainer||"main",!0):o,y,{timeoutMs:30000}),{status:I??u.status??200,headers:X})}let x=new Headers({"Content-Type":"text/html",...j(),...O.cache?{}:{"Cache-Control":"private, no-store"}});for(let T of N??[])x.append("Set-Cookie",T);for(let[T,U]of Object.entries(D??{}))x.set(T,U);if(x.set("Vary",j(x.get("Vary")).Vary),A&&!d&&Ke(o,r.routerContainer||"main")){let T=tt(o);return x.set("X-STX-Fragment","true"),x.set("X-STX-Runtime",we(o)?"true":"false"),x.set("X-STX-Layout",T.layout),x.set("X-STX-Layout-Group",T.group),new Response(Te(o,r.routerContainer||"main",!0),{status:I??u.status??200,headers:x})}return new Response(o,{status:I??u.status??200,headers:x})}catch(o){if(console.error(`[stx] Hydration error for ${c}:`,o),W)return new Response("Internal Server Error",{status:500});return new Response(u.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${B.port}`),console.log(`[stx] Serving ${r.routes.length} routes (${b.size} pre-loaded)`),{port:B.port,stop:()=>{f.invalidate(),B.stop()},invalidate:(n)=>f.invalidate(n)}}
|
|
3
3
|
export{In,rm};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Uh,ys,Go,bs,ur,Xo,Jo,Uf,ws,vs,xs,Yo,mc,Wf,xt}from"./chunk-
|
|
2
|
+
import{Uh,ys,Go,bs,ur,Xo,Jo,Uf,ws,vs,xs,Yo,mc,Wf,xt}from"./chunk-4wrddn8m.js";import"./chunk-7hp50cpd.js";import"./chunk-zswtgwxg.js";import"./chunk-1qybwj8k.js";import"./chunk-qxk9grjm.js";import"./chunk-kvafq9gy.js";import"./chunk-tm8a2b69.js";import"./chunk-vw73gsxx.js";import"./chunk-9r999ees.js";import{V}from"./chunk-mv48q1p4.js";import"./chunk-e8zpzt9s.js";import"./chunk-v4bqmzj9.js";import"./chunk-0dmpc70r.js";import"./chunk-xppm4cs4.js";import"./chunk-ngnvyqk3.js";export{Uf as bindLoopInterpolations,Uh as clearScriptScanCache,ws as convertServerLoopAttributesToDirectives,Xo as convertSignalDirectivesToAttributes,vs as convertSignalLoopsToAttributes,ur as extractClientSignalNames,V as extractExports,mc as findMarkupIndexOutsideScripts,bs as hasSignalsSyntax,Go as parseLoopExpression,Jo as preEvalLiteralReactiveIfs,xs as processScriptSetup,Yo as processSignals,Wf as rewriteStxImportSpecifiers,ys as scanScriptTags,xt as stripStxRuntimeImports};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{rm}from"./chunk-9n3584wt.js";import"./chunk-fba71th7.js";import"./chunk-yzvp90yk.js";import"./chunk-4cd94cd5.js";import"./chunk-8qe34jb8.js";import"./chunk-7hp50cpd.js";import"./chunk-1qybwj8k.js";import"./chunk-qxk9grjm.js";import"./chunk-kvafq9gy.js";import"./chunk-tm8a2b69.js";import"./chunk-vw73gsxx.js";import"./chunk-9r999ees.js";import"./chunk-mv48q1p4.js";import"./chunk-e8zpzt9s.js";import"./chunk-v4bqmzj9.js";import"./chunk-0dmpc70r.js";import"./chunk-xppm4cs4.js";import"./chunk-ngnvyqk3.js";export{rm as startProductionServer};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{dm}from"./chunk-w835crjw.js";import"./chunk-fba71th7.js";import"./chunk-f9thwm8c.js";import"./chunk-yzvp90yk.js";import"./chunk-4cd94cd5.js";import"./chunk-ynd2nfvs.js";import"./chunk-9hvfmqs1.js";import"./chunk-xfb7fdeq.js";import"./chunk-t5q31st4.js";import"./chunk-q0jmc3m4.js";import"./chunk-8qe34jb8.js";import"./chunk-279n7sde.js";import"./chunk-v8p8t3t4.js";import"./chunk-4wrddn8m.js";import"./chunk-7hp50cpd.js";import"./chunk-zswtgwxg.js";import"./chunk-k0arm18k.js";import"./chunk-1qybwj8k.js";import"./chunk-qxk9grjm.js";import"./chunk-kvafq9gy.js";import"./chunk-tm8a2b69.js";import"./chunk-vw73gsxx.js";import"./chunk-9r999ees.js";import"./chunk-mv48q1p4.js";import"./chunk-e8zpzt9s.js";import"./chunk-v4bqmzj9.js";import"./chunk-0dmpc70r.js";import"./chunk-xppm4cs4.js";import"./chunk-ngnvyqk3.js";export{dm as buildForProduction};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-0dmpc70r.js";import"./chunk-ngnvyqk3.js";import"./chunk-xppm4cs4.js";import"./chunk-
|
|
2
|
+
import"./chunk-0dmpc70r.js";import"./chunk-ngnvyqk3.js";import"./chunk-xppm4cs4.js";import"./chunk-mv48q1p4.js";import"./chunk-v4bqmzj9.js";import"./chunk-e8zpzt9s.js";import"./chunk-kvafq9gy.js";import"./chunk-qxk9grjm.js";import{c}from"./chunk-ehp792dy.js";import u from"fs";import l from"path";async function d(e,t={}){let s=Date.now(),n={total:0,passed:0,failed:0,new:0,failures:[],duration:0},i=t.snapshotDir||c(e.root,"story","snapshots");await u.promises.mkdir(i,{recursive:!0});let r=e.storyFiles;if(t.filter&&t.filter.length>0)r=r.filter((a)=>t.filter.some((o)=>a.fileName.toLowerCase().includes(o.toLowerCase())));for(let a of r)await h(a,i,t,n);return n.duration=Date.now()-s,n}async function h(e,t,s,n){let i=e.story;if(!i)return;for(let r of i.variants){n.total++;let a=l.join(t,`${e.id}-${r.id}.snap`),o=g(r.source||""),f=await w(a);if(s.update||!f){let p={storyId:e.id,variantId:r.id,component:e.fileName,timestamp:Date.now(),hash:o};if(await u.promises.writeFile(a,JSON.stringify(p,null,2)),!f)n.new++;n.passed++}else try{let p=await u.promises.readFile(a,"utf-8"),m=JSON.parse(p);if(m.hash===o)n.passed++;else n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:"Snapshot mismatch",difference:y(m.hash,o)})}catch(p){n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:`Error reading snapshot: ${p}`})}}}async function x(e,t={}){return(await d(e,{...t,update:!0})).total}function g(e){let t=0;for(let s=0;s<e.length;s++){let n=e.charCodeAt(s);t=(t<<5)-t+n,t=t&t}return t.toString(16)}function y(e,t){if(e===t)return 0;let s=Math.abs(Number.parseInt(e,16)-Number.parseInt(t,16));return Math.min(s/1e6,1)}async function w(e){try{return await u.promises.access(e),!0}catch{return!1}}function F(e){let t=[];if(t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(" STX Story Visual Regression Tests"),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),e.failures.length>0){t.push(" \u274C Failures:"),t.push("");for(let s of e.failures){if(t.push(` \u2022 ${s.component} / ${s.variantId}`),t.push(` ${s.message}`),s.difference!==void 0)t.push(` Difference: ${(s.difference*100).toFixed(2)}%`);t.push("")}}if(t.push(" Summary:"),t.push(` Total: ${e.total}`),t.push(` Passed: ${e.passed} \u2713`),t.push(` Failed: ${e.failed} \u2717`),e.new>0)t.push(` New: ${e.new} \u26A1`);return t.push(` Time: ${e.duration}ms`),t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),t.join(`
|
|
3
3
|
`)}export{F as formatTestResults,d as runVisualTests,x as updateSnapshots};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ia,Oa,Na,Ma,Ph}from"./chunk-fzkyk5j4.js";import"./chunk-te82sjhy.js";import"./chunk-hgy98n76.js";import"./chunk-68pvvd7v.js";import"./chunk-ynd2nfvs.js";import"./chunk-9hvfmqs1.js";import"./chunk-xfb7fdeq.js";import"./chunk-t5q31st4.js";import"./chunk-q0jmc3m4.js";import"./chunk-8qe34jb8.js";import"./chunk-279n7sde.js";import"./chunk-v8p8t3t4.js";import"./chunk-4wrddn8m.js";import"./chunk-7hp50cpd.js";import"./chunk-zswtgwxg.js";import"./chunk-k0arm18k.js";import"./chunk-1qybwj8k.js";import"./chunk-qxk9grjm.js";import"./chunk-kvafq9gy.js";import"./chunk-tm8a2b69.js";import"./chunk-vw73gsxx.js";import"./chunk-9r999ees.js";import"./chunk-mv48q1p4.js";import"./chunk-e8zpzt9s.js";import"./chunk-v4bqmzj9.js";import"./chunk-0dmpc70r.js";import"./chunk-xppm4cs4.js";import"./chunk-ngnvyqk3.js";export{Ia as buildNative,Ph as default,Oa as findCraftBinary,Ma as getAvailableFormats,Na as getAvailableTargets};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{_a,gu,Un,zm,mu,hu,yu,Hm}from"./chunk-
|
|
2
|
+
import{_a,gu,Un,zm,mu,hu,yu,Hm}from"./chunk-0vg0j7xa.js";import"./chunk-mv48q1p4.js";import"./chunk-e8zpzt9s.js";import"./chunk-v4bqmzj9.js";import"./chunk-0dmpc70r.js";import"./chunk-xppm4cs4.js";import"./chunk-ngnvyqk3.js";export{Un as Validator,gu as defineForm,mu as processErrorDirective,hu as processErrorsDirective,Hm as processFormValidationDirectives,yu as processHasErrorsDirective,_a as useForm,zm as v};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Cn,M}from"./chunk-v4bqmzj9.js";import m from"fs";import e from"path";async function _n(r,o,i){if(r.__stx_runtime_config)return;let n=Cn();if(n||i){r.__stx_runtime_config=n??M(i);return}let t=e.dirname(e.resolve(o));while(!0){if(["stx.config.ts","stx.config.js",".config/stx.config.ts",".config/stx.config.js"].some((f)=>m.existsSync(e.join(t,f)))){let{loadStxConfig:f}=await import("./chunk-
|
|
2
|
+
import{Cn,M}from"./chunk-v4bqmzj9.js";import m from"fs";import e from"path";async function _n(r,o,i){if(r.__stx_runtime_config)return;let n=Cn();if(n||i){r.__stx_runtime_config=n??M(i);return}let t=e.dirname(e.resolve(o));while(!0){if(["stx.config.ts","stx.config.js",".config/stx.config.ts",".config/stx.config.js"].some((f)=>m.existsSync(e.join(t,f)))){let{loadStxConfig:f}=await import("./chunk-hfe2byfx.js"),c=await f(t);if(c.runtimeConfig)r.__stx_runtime_config=M(c.runtimeConfig);return}let s=e.dirname(t);if(s===t)return;t=s}}async function Ti(r,o){function i(n){if(n===null)return"null";if(Array.isArray(n))return`Array<${n.length?[...new Set(n.map(i))].join(" | "):"unknown"}>`;if(typeof n==="object")return`{ ${Object.entries(n).map(([t,s])=>`readonly ${JSON.stringify(t)}: ${i(s)}`).join("; ")} }`;return typeof n}await Bun.write(e.join(r,".stx/runtime-config.d.ts"),`import '@stacksjs/stx/runtime-config'
|
|
3
3
|
declare module '@stacksjs/stx/runtime-config' { interface PublicRuntimeConfig ${i(o.public??{})} }
|
|
4
4
|
`),await Bun.write(e.join(r,".stx/runtime-config-server.d.ts"),`import '@stacksjs/stx/runtime-config-server'
|
|
5
5
|
declare module '@stacksjs/stx/runtime-config-server' { interface PrivateRuntimeConfig ${i(o.private??{})} }
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{wn,ag,cg,lg,ug,dg,g,pg,vi,fg,Qc,el}from"./chunk-
|
|
2
|
+
import{wn,ag,cg,lg,ug,dg,g,pg,vi,fg,Qc,el}from"./chunk-mv48q1p4.js";import"./chunk-e8zpzt9s.js";import"./chunk-v4bqmzj9.js";import"./chunk-0dmpc70r.js";import"./chunk-xppm4cs4.js";import"./chunk-ngnvyqk3.js";export{wn as STX_ENGINE_BINDING_NAMES,vi as convertToCommonJS,Qc as extractScriptFromTemplate,g as extractVariables,el as hasVariables,pg as isCompleteImport,dg as isMissingBindingFailure,lg as isModuleResolutionFailure,ug as isSyntaxFailure,fg as splitDeclaration,ag as stripTypeScript,cg as withoutStxReferrer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{zr,co,Gg,Ol,lo}from"./chunk-
|
|
2
|
+
import{zr,co,Gg,Ol,lo}from"./chunk-gxqtbbz0.js";export{Gg as buildModuleRegistryScript,lo as buildSharedModuleRegistries,Ol as exportsMutableBinding,zr as registeredModuleIdsIn,co as registeredModuleNamesIn};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Tn}from"./chunk-0dmpc70r.js";import{q,y,Mt,Dt,$r,g,cl,_i,W,A}from"./chunk-
|
|
2
|
+
import{Tn}from"./chunk-0dmpc70r.js";import{q,y,Mt,Dt,$r,g,cl,_i,W,A}from"./chunk-mv48q1p4.js";import{nn}from"./chunk-yzvp90yk.js";import{n}from"./chunk-8qe34jb8.js";import{G}from"./chunk-ym5qgw03.js";var X=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function J(t){let s=[],e=/<!--[\s\S]*?(?:-->|$)|<(script|style|textarea|title|template)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,r;while((r=e.exec(t))!==null)s.push({start:r.index,end:r.index+r[0].length});return s}function N(t,s){return s.some((e)=>t>=e.start&&t<e.end)}function K(t){let s=(t||"").trim();if(!s)return null;if(/[\s>+~,:]/.test(s))return null;let e={},r=s,i=r.match(/^[a-z][\w-]*/i);if(i)e.tag=i[0].toLowerCase(),r=r.slice(i[0].length);while(r.length>0){let o=r.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(o){if(e.attr=o[1],o[3]!==void 0&&o[3]!=="")e.attrValue=o[3];r=r.slice(o[0].length);continue}let c=r.match(/^#([\w-]+)/);if(c){e.id=c[1],r=r.slice(c[0].length);continue}let a=r.match(/^\.([\w-]+)/);if(a){e.className=a[1],r=r.slice(a[0].length);continue}return null}if(!e.tag&&!e.attr&&!e.id&&!e.className)return null;return e}function Y(t,s){if(s.attr){if(!(s.attrValue===void 0?new RegExp(`\\b${s.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${s.attr}\\s*=\\s*(["'])\\s*${s.attrValue}\\s*\\1`,"i")).test(t))return!1}if(s.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${s.id}\\s*\\1`,"i").test(t))return!1}if(s.className){let e=t.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!e)return!1;if(!e[2].split(/\s+/).includes(s.className))return!1}return!0}function P(t,s="main"){let e=K(s);if(!e)return null;let r=/<([a-z][\w-]*)\b([^>]*)>/gi,i=J(t),o;while((o=r.exec(t))!==null){if(N(o.index,i))continue;let c=o[1].toLowerCase(),a=o[2]||"";if(a.trimEnd().endsWith("/")||X.has(c))continue;if(e.tag&&e.tag!==c)continue;if(!Y(a,e))continue;let l=o[0],f=o.index+l.length,u=new RegExp(`<(/?)${c}\\b([^>]*)>`,"gi");u.lastIndex=f;let d=1,h;while((h=u.exec(t))!==null){if(N(h.index,i))continue;let S=h[1]==="/";if(!S&&(h[2]||"").trimEnd().endsWith("/"))continue;if(d+=S?-1:1,d===0)return{openTag:l,openIndex:o.index,start:f,end:h.index,tagName:c}}return null}return null}var mt="private, no-store";function Jt(t){return t.replace(/&#(\d+);/g,(s,e)=>F(Number(e),s)).replace(/&#x([0-9a-f]+);/gi,(s,e)=>F(Number.parseInt(e,16),s)).replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/&/g,"&")}function F(t,s){if(!Number.isInteger(t)||t<0||t>1114111)return s;try{return String.fromCodePoint(t)}catch{return s}}function Ee(t){return t.headers.get("X-STX-Router")==="true"}function Z(t,s){if(!t)return s;return t.split(",").some((r)=>r.trim().toLowerCase()===s.toLowerCase())?t:`${t}, ${s}`}function j(t){return{Vary:Z(t,"X-STX-Router")}}function E(t){return t.replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function D(t){let s=/<head\b[^>]*>([\s\S]*?)<\/head\s*>/i.exec(t)?.[1]??"",e=/<(meta|link)\b(?:[^>"']|"[^"]*"|'[^']*')*>|<title\b[^>]*>[\s\S]*?<\/title\s*>/giy;return y(s,(r,i)=>(e.lastIndex=i,e.exec(r)?e.lastIndex:-1)).map(({token:r})=>r)}function L(t){let s=Object.create(null),e=t.replace(/^<\w+\b|>$/g,"");for(let r of e.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g)){let i=r[1].toLowerCase();if(!(i in s))s[i]=r[2]??r[3]??r[4]??""}return s}function Nn(t){let s=[];for(let e of D(t)){if(/^<title\b/i.test(e)){s.push(`<title>${E(e.replace(/^<title\b[^>]*>|<\/title\s*>$/gi,""))}</title>`);continue}let r=L(e);if(/^<meta\b/i.test(e)){let i=r.property?"property":"name",o=Jt(r[i]??"").toLowerCase();if(o==="description"||/^(?:og|twitter):[\w:]+$/.test(o))s.push(`<meta ${i}="${n(o)}" content="${E(r.content??"")}">`)}else{let i=Jt(r.rel??"").toLowerCase();if(i==="canonical"||i==="alternate"&&r.hreflang)s.push(`<link rel="${i}" href="${E(r.href??"")}"${i==="alternate"?` hreflang="${E(r.hreflang)}"`:""}>`)}}return`<template data-stx-page-head="1">${s.join("")}</template>
|
|
3
3
|
`}var Q=["media","crossorigin","integrity"];function Mn(t){let s=[];for(let e of D(t)){if(!/^<link\b/i.test(e))continue;let r=L(e);if(Jt(r.rel??"").trim().toLowerCase()!=="stylesheet")continue;if(!r.href||"data-css"in r||"disabled"in r)continue;let i=Q.filter((o)=>(o in r)).map((o)=>` ${o}="${E(r[o])}"`).join("");s.push(`<link rel="stylesheet" href="${E(r.href)}"${i}>`)}return s.length?`<template data-stx-page-css="1">${s.join("")}</template>
|
|
4
|
-
`:""}import T from"path";var tt="stx-page-head:",et=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,_={dev:null,prod:null};function nt(){let t=G()?"dev":"prod",s=_[t];if(s!==null)return s;try{let e=import.meta.require("./chunk-6bm19d4k.js"),r=t==="dev"&&typeof e.getRouterScriptDev==="function"?e.getRouterScriptDev:e.getRouterScript;_[t]=`<script>${r()}</script>`}catch{_[t]=""}return _[t]}async function ga(t,s){if(s===!1)return null;if(s&&typeof s==="string"){let r=T.resolve(t,s);if(await Bun.file(r).exists())return r;return null}let e=T.join(t,"app.stx");if(await Bun.file(e).exists())return e;return null}async function wo(t,s){try{let e=await Bun.file(t).text(),r=e,i=e.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if(i)r=i[1].trim();let o=nn(e),c=[...o.client.map((p)=>p.fullTag),...o.signals.map((p)=>p.fullTag)],a=[],l=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,f;while((f=l.exec(e))!==null)a.push(f[0]);let u=r;for(let p of o.server)u=u.replace(p.fullTag,"");for(let p of o.client)u=u.replace(p.fullTag,"");u=u.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let d="<!--__STX_PAGE_SLOT__-->";if(u=u.replace(/<slot\s*\/>/gi,d).replace(/<slot\s*>\s*<\/slot>/gi,d),!u.includes(d))return console.warn(`[stx] Shell ${t} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:h,extractVariables:S,defaultConfig:R,loadStxConfig:b}=await import("./chunk-
|
|
4
|
+
`:""}import T from"path";var tt="stx-page-head:",et=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,_={dev:null,prod:null};function nt(){let t=G()?"dev":"prod",s=_[t];if(s!==null)return s;try{let e=import.meta.require("./chunk-6bm19d4k.js"),r=t==="dev"&&typeof e.getRouterScriptDev==="function"?e.getRouterScriptDev:e.getRouterScript;_[t]=`<script>${r()}</script>`}catch{_[t]=""}return _[t]}async function ga(t,s){if(s===!1)return null;if(s&&typeof s==="string"){let r=T.resolve(t,s);if(await Bun.file(r).exists())return r;return null}let e=T.join(t,"app.stx");if(await Bun.file(e).exists())return e;return null}async function wo(t,s){try{let e=await Bun.file(t).text(),r=e,i=e.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if(i)r=i[1].trim();let o=nn(e),c=[...o.client.map((p)=>p.fullTag),...o.signals.map((p)=>p.fullTag)],a=[],l=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,f;while((f=l.exec(e))!==null)a.push(f[0]);let u=r;for(let p of o.server)u=u.replace(p.fullTag,"");for(let p of o.client)u=u.replace(p.fullTag,"");u=u.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let d="<!--__STX_PAGE_SLOT__-->";if(u=u.replace(/<slot\s*\/>/gi,d).replace(/<slot\s*>\s*<\/slot>/gi,d),!u.includes(d))return console.warn(`[stx] Shell ${t} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:h,extractVariables:S,defaultConfig:R,loadStxConfig:b}=await import("./chunk-j3s5y2k5.js"),k=await b(),m={__filename:t,__dirname:T.dirname(t)};for(let p of c){let C=p.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(C&&!p.includes("client")&&!p.includes('type="module"'))await S(C[1],m,t)}let x=await h(u,m,t,{...R,...k,...s},new Set),w=x.indexOf(d);if(w===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:x.substring(0,w),afterSlot:x.substring(w+d.length),filePath:t,shellScripts:c,shellStyles:a}}catch(e){return console.error(`[stx] Error processing shell ${t}:`,e),null}}function Jr(t,s,e){let r,i="",o=s.match(et);if(o){s=s.replace(o[0],"");try{let u=Buffer.from(o[1],"base64").toString("utf8"),d=u.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(d)r=d[1].trim();i=u.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let c=e||r||"stx App",a=nt(),l="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
|
|
5
5
|
<html lang="en">
|
|
6
6
|
<head>
|
|
7
7
|
<meta charset="UTF-8">
|
|
@@ -29,5 +29,5 @@ ${a}
|
|
|
29
29
|
`));if(o.length>0)m.push(o.filter((x)=>!f.has(x)).join(`
|
|
30
30
|
`));if(R.length>0)m.push(R.filter((x)=>!f.has(x)).join(`
|
|
31
31
|
`));return m.push(S),m.join(`
|
|
32
|
-
`)}import O from"fs";import B from"path";function ha(t,s,e){return{version:1,buildTime:new Date().toISOString(),routes:t,assets:s,outputDir:e}}function ya(t,s){let e=B.join(s,"manifest.json");O.writeFileSync(e,JSON.stringify(t,null,2))}function ba(t){let s=B.join(t,"manifest.json");if(!O.existsSync(s))return null;try{let e=O.readFileSync(s,"utf-8"),r=JSON.parse(e);if(r.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${r.version}`),null;return r}catch(e){return console.warn("[stx] Failed to load manifest:",e),null}}function M(t,s,e={}){let r=`${encodeURIComponent(t)}=${encodeURIComponent(s)}`;if(e.maxAge!==void 0)r+=`; Max-Age=${e.maxAge}`;if(e.expires)r+=`; Expires=${e.expires.toUTCString()}`;if(e.path)r+=`; Path=${e.path}`;if(e.domain)r+=`; Domain=${e.domain}`;if(e.secure)r+="; Secure";if(e.httpOnly)r+="; HttpOnly";if(e.sameSite)r+=`; SameSite=${e.sameSite}`;return r}async function st(t){let s=t.headers.get("content-type")||"",e={},r=(i,o)=>{let c=e[i];if(c===void 0)e[i]=o;else if(Array.isArray(c))c.push(o);else e[i]=[c,o]};if(s.includes("multipart/form-data")){let i=await t.formData();for(let[o,c]of i.entries())if(typeof c==="string")r(o,c);return e}if(s.includes("application/x-www-form-urlencoded")){for(let[i,o]of new URLSearchParams(await t.text()).entries())r(i,o);return e}return e}function vo(t){if(!t)return!1;let s=t.toUpperCase();return s!=="GET"&&s!=="HEAD"}async function U(t,s={}){let e=s.request,r=s.method??e?.method;if(!e||!vo(r))return{ran:!1};if(typeof t.action!=="function")return{ran:!1};let i={};try{i=await st(e)}catch{}let o=await t.action({request:e,form:i,params:s.params??{},query:t.query??{},cookies:s.cookies??{}});if(o&&typeof o==="object"){let c=o,a=it(c.cookies),l=c.redirect;if(typeof l==="string"&&l)return{redirect:l,ran:!0,...a.length>0?{cookies:a}:{}};let{cookies:f,redirect:u,...d}=c;if(Object.assign(t,d),a.length>0)return{ran:!0,cookies:a}}return{ran:!0}}function it(t){if(!t||typeof t!=="object"||Array.isArray(t))return[];let s=[];for(let[e,r]of Object.entries(t)){if(!e)continue;if(typeof r==="string"){s.push(M(e,r));continue}if(r&&typeof r==="object"){let i=r;if(typeof i.value!=="string")continue;s.push(M(e,i.value,i))}}return s}function wa(t,s=[],e){let r=new Headers({Location:t,"Cache-Control":"no-store"});for(let i of s)r.append("Set-Cookie",i);for(let[i,o]of Object.entries(e??{}))if(i.toLowerCase()!=="location")r.set(i,o);return new Response(null,{status:303,headers:r})}async function Dn(t,s={}){let{html:e,context:r,redirect:i,cookies:o}=await ot(t,s),c=Mt(r),a=Dt(r);if(i)return{html:e,redirect:i,cookies:o,status:c,headers:a};let{extractStreamBoundaries:l}=await import("./chunk-
|
|
32
|
+
`)}import O from"fs";import B from"path";function ha(t,s,e){return{version:1,buildTime:new Date().toISOString(),routes:t,assets:s,outputDir:e}}function ya(t,s){let e=B.join(s,"manifest.json");O.writeFileSync(e,JSON.stringify(t,null,2))}function ba(t){let s=B.join(t,"manifest.json");if(!O.existsSync(s))return null;try{let e=O.readFileSync(s,"utf-8"),r=JSON.parse(e);if(r.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${r.version}`),null;return r}catch(e){return console.warn("[stx] Failed to load manifest:",e),null}}function M(t,s,e={}){let r=`${encodeURIComponent(t)}=${encodeURIComponent(s)}`;if(e.maxAge!==void 0)r+=`; Max-Age=${e.maxAge}`;if(e.expires)r+=`; Expires=${e.expires.toUTCString()}`;if(e.path)r+=`; Path=${e.path}`;if(e.domain)r+=`; Domain=${e.domain}`;if(e.secure)r+="; Secure";if(e.httpOnly)r+="; HttpOnly";if(e.sameSite)r+=`; SameSite=${e.sameSite}`;return r}async function st(t){let s=t.headers.get("content-type")||"",e={},r=(i,o)=>{let c=e[i];if(c===void 0)e[i]=o;else if(Array.isArray(c))c.push(o);else e[i]=[c,o]};if(s.includes("multipart/form-data")){let i=await t.formData();for(let[o,c]of i.entries())if(typeof c==="string")r(o,c);return e}if(s.includes("application/x-www-form-urlencoded")){for(let[i,o]of new URLSearchParams(await t.text()).entries())r(i,o);return e}return e}function vo(t){if(!t)return!1;let s=t.toUpperCase();return s!=="GET"&&s!=="HEAD"}async function U(t,s={}){let e=s.request,r=s.method??e?.method;if(!e||!vo(r))return{ran:!1};if(typeof t.action!=="function")return{ran:!1};let i={};try{i=await st(e)}catch{}let o=await t.action({request:e,form:i,params:s.params??{},query:t.query??{},cookies:s.cookies??{}});if(o&&typeof o==="object"){let c=o,a=it(c.cookies),l=c.redirect;if(typeof l==="string"&&l)return{redirect:l,ran:!0,...a.length>0?{cookies:a}:{}};let{cookies:f,redirect:u,...d}=c;if(Object.assign(t,d),a.length>0)return{ran:!0,cookies:a}}return{ran:!0}}function it(t){if(!t||typeof t!=="object"||Array.isArray(t))return[];let s=[];for(let[e,r]of Object.entries(t)){if(!e)continue;if(typeof r==="string"){s.push(M(e,r));continue}if(r&&typeof r==="object"){let i=r;if(typeof i.value!=="string")continue;s.push(M(e,i.value,i))}}return s}function wa(t,s=[],e){let r=new Headers({Location:t,"Cache-Control":"no-store"});for(let i of s)r.append("Set-Cookie",i);for(let[i,o]of Object.entries(e??{}))if(i.toLowerCase()!=="location")r.set(i,o);return new Response(null,{status:303,headers:r})}async function Dn(t,s={}){let{html:e,context:r,redirect:i,cookies:o}=await ot(t,s),c=Mt(r),a=Dt(r);if(i)return{html:e,redirect:i,cookies:o,status:c,headers:a};let{extractStreamBoundaries:l}=await import("./chunk-ggthncvg.js"),f=l(r),u=t.streamTemplates;if(u&&Object.keys(u).length>0){let{processDirectives:d}=await import("./chunk-vgaqznwt.js"),{defaultConfig:h}=await import("./chunk-hfe2byfx.js"),S=r.streamBoundaries||{},R={...h,autoShell:!1},b=Object.keys(u).map((m)=>({id:m,render:async()=>{let x=typeof S[m]==="function"?await S[m]():void 0;return d(u[m],{...r,$boundary:x},t.sourceFile,R,new Set)}})),k=new Set(b.map((m)=>m.id));f=[...(f||[]).filter((m)=>!k.has(m.id)),...b]}return{html:e,boundaries:f&&f.length>0?f:void 0,cookies:o,status:c,headers:a}}async function ot(t,s){let e={__filename:t.sourceFile,__dirname:t.sourceFile.replace(/[/\\][^/\\]+$/,""),...s};if(!t.hasServerScripts&&!_i(t.html))return{html:t.html,context:e};for(let c of t.serverScriptContent)try{await g(c,e,t.sourceFile)}catch(a){if(s.__stx_strict_hydration)throw a;console.warn(`[stx] Server script error in ${t.sourceFile}:`,a)}let r=await U(e,{request:s.request,method:s.method,params:s.params??{},cookies:s.cookies??{}}),i=(c)=>{let a=c.replace(/<script\b[^>]*\bdata-stx-server-data\b[^>]*>[\s\S]*?<\/script>/gi,""),l=$r(e);if(!l)return a;let f=a.indexOf("</head>");return f<0?l+a:a.slice(0,f)+l+a.slice(f)};if(r.redirect)return{html:t.html,context:e,redirect:r.redirect,cookies:r.cookies};if(!_i(t.html))return{html:i(t.html),context:e,cookies:r.cookies};let o=new Map;for(let[c,a]of Object.entries(t.placeholders))if(a.expression)try{let l=A(a.expression,e);if(a.type==="raw")o.set(c,l!==void 0&&l!==null?String(l):"");else o.set(c,l!==void 0&&l!==null?W(String(l)):"")}catch(l){if(s.__stx_strict_hydration)throw l;o.set(c,"")}return{html:i(cl(t.html,o)),context:e,cookies:r.cookies}}
|
|
33
33
|
export{mt,Jt,Ee,j,Nn,Mn,ga,wo,Jr,qe,ma,Ke,Te,ha,ya,ba,vo,wa,Dn};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Oe,C,Z}from"./chunk-
|
|
2
|
+
import{Oe,C,Z}from"./chunk-mv48q1p4.js";import{k}from"./chunk-ngnvyqk3.js";import{I,An}from"./chunk-xppm4cs4.js";import{a}from"./chunk-1qybwj8k.js";import{ye,on,an,cn}from"./chunk-pesgcwrj.js";import{xt}from"./chunk-4wrddn8m.js";import{yt,Wn,Zt,le}from"./chunk-z0qfspzg.js";import{T,Rn}from"./chunk-ym5qgw03.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${an()}\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 le(h,t,"",{chunks:[]}),null}let i=()=>[...new Set([...r,...r.flatMap((l)=>ye(l))])],f=yt(i()),u=Zt(h,t,f);if(u!==void 0)return u.chunks.length>0?u:null;if(r.length===0)return le(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(on(c))c=await cn(c,l,{projectRoot:x.cwd(),externalizeUserModules:o});c=xt(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 le(h,t,f,{chunks:[]}),null;f=yt(i());let S={chunks:g};return le(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(){
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{rs,ss}from"./chunk-te82sjhy.js";import{y}from"./chunk-
|
|
2
|
+
import{rs,ss}from"./chunk-te82sjhy.js";import{y}from"./chunk-mv48q1p4.js";import{a}from"./chunk-1qybwj8k.js";import{Ge,oe}from"./chunk-68pvvd7v.js";import{nc}from"./chunk-hgy98n76.js";import{B}from"./chunk-ybq56wam.js";import{h}from"./chunk-kgrvvtcy.js";import{existsSync as z,mkdirSync as S,copyFileSync as P,chmodSync as I,rmSync as ve}from"fs";import{join as c,basename as xe,resolve as X}from"path";import{spawn as _}from"child_process";import{platform as ye}from"os";function O(e,r,i){let n=new RegExp(`</${r}\\s*>`,"iy"),s=y(e,(t,o)=>(n.lastIndex=o,n.exec(t)?n.lastIndex:-1))[0];return s?e.slice(0,s.start)+i+e.slice(s.start):null}var xu=`
|
|
3
3
|
<script>
|
|
4
4
|
(function() {
|
|
5
5
|
'use strict';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Vm,Ca,bu,Um,Wm,qm,Km,Gm,wu,vu,Xm,Jm,Ym,Zm}from"./chunk-
|
|
2
|
+
import{Vm,Ca,bu,Um,Wm,qm,Km,Gm,wu,vu,Xm,Jm,Ym,Zm}from"./chunk-11y3106w.js";import"./chunk-ynd2nfvs.js";import"./chunk-9hvfmqs1.js";import"./chunk-xfb7fdeq.js";import"./chunk-t5q31st4.js";import"./chunk-q0jmc3m4.js";import"./chunk-8qe34jb8.js";import"./chunk-279n7sde.js";import"./chunk-v8p8t3t4.js";import"./chunk-4wrddn8m.js";import"./chunk-7hp50cpd.js";import"./chunk-zswtgwxg.js";import"./chunk-k0arm18k.js";import"./chunk-1qybwj8k.js";import"./chunk-qxk9grjm.js";import"./chunk-kvafq9gy.js";import"./chunk-tm8a2b69.js";import"./chunk-vw73gsxx.js";import"./chunk-9r999ees.js";import"./chunk-mv48q1p4.js";import"./chunk-e8zpzt9s.js";import"./chunk-v4bqmzj9.js";import"./chunk-0dmpc70r.js";import"./chunk-xppm4cs4.js";import"./chunk-ngnvyqk3.js";export{bu as SUSPENSE_RESOLVER_RUNTIME,Ca as buildSuspenseResolveScript,Gm as createStreamRenderer,qm as extractStreamBoundaries,Zm as generateHydrationRuntime,vu as islandDirective,Jm as processSectionDirectives,Wm as processStreamDirectives,Xm as registerStreamingDirectives,Um as renderStreamingPage,Vm as streamTemplate,Km as streamTemplateSimple,Ym as streamToResponse,wu as streamingSuspenseDirective};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import R from"path";var O=/__stxModules\["((?:[^"\\]|\\.)*)"\]/g;function zr(...g){let d=new Set;for(let c of g){if(!c||!c.includes("__stxModules["))continue;for(let s of c.matchAll(O))try{d.add(JSON.parse(`"${s[1]}"`))}catch{}}return[...d].sort()}function co(...g){let d=new Map,c=(s,e)=>{let r=d.get(s);if(r===null)return;if(e===null){d.set(s,null);return}let n=r??new Set;for(let i of e)n.add(i);d.set(s,n)};for(let s of g){if(!s||!s.includes("__stxModules["))continue;let e=[];for(let n of s.matchAll(/([\w$]+)\s*=\s*globalThis\.__stxModules\s*&&\s*globalThis\.__stxModules\["((?:[^"\\]|\\.)*)"\]/g)){let i;try{i=JSON.parse(`"${n[2]}"`)}catch{continue}e.push({variable:n[1],id:i,start:n.index+n[0].length,end:s.length})}let r=s.match(/__stxModules\["(?:[^"\\]|\\.)*"\]/g)?.length??0;if(e.length===0||r!==e.length){for(let n of zr(s))c(n,null);continue}for(let[n,i]of e.entries()){let p=e.slice(n+1).find((h)=>h.variable===i.variable);i.end=p?p.start:s.length}for(let n of e){let i=new Set,p=!1,h=n.variable.replace(/[$]/g,"\\$&"),o=s.slice(n.start,n.end);for(let l of o.matchAll(new RegExp(`(?<![\\w$.])${h}(?![\\w$])`,"g"))){let f=o.slice(l.index+n.variable.length,l.index+n.variable.length+200),a=/^\s*\[\s*(["'])([A-Za-z_$][\w$]*)\1\s*\]/.exec(f)??/^\s*\.\s*([A-Za-z_$][\w$]*)/.exec(f);if(a){i.add(a[a.length-1]);continue}if(/^\s*[!=]==?\s*(?:undefined|void 0)\b/.test(f))continue;p=!0;break}c(n.id,p?null:i)}}return d}function v(g,d,c){let s=[],e=[];return g.forEach((r,n)=>{let i=r.startsWith("npm:")?r.slice(4):R.resolve(d,r),p=`__stxRegistered${n}`,h=JSON.stringify(r),o=c?.get(r);if(o&&[...o].every((l)=>/^[A-Za-z_$][\w$]*$/.test(l))){let l=[...o].sort(),f=l.map((m,_)=>`${m} as ${p}_${_}`);s.push(l.length>0?`import { ${f.join(", ")} } from ${JSON.stringify(i)};`:`import ${JSON.stringify(i)};`);let a=l.map((m,_)=>`get ${JSON.stringify(m)}() { return ${p}_${_}; }`).join(", ");e.push(`if (!globalThis.__stxModules[${h}]) globalThis.__stxModules[${h}] = { ${a} };`);return}s.push(`import * as ${p} from ${JSON.stringify(i)};`),e.push(`if (!globalThis.__stxModules[${h}]) globalThis.__stxModules[${h}] = ${p};`)}),[...s,"globalThis.__stxModules = globalThis.__stxModules || {};",...e].join(`
|
|
3
|
-
`)}async function Gg(g,d={}){if(g.length===0)return null;let c=process.cwd(),s=v(g,c,d.names),e;try{let{bundleClientScript:l}=await import("./chunk-
|
|
3
|
+
`)}async function Gg(g,d={}){if(g.length===0)return null;let c=process.cwd(),s=v(g,c,d.names),e;try{let{bundleClientScript:l}=await import("./chunk-qccpfn5x.js"),f=()=>l(s,R.join(c,".stx-module-registry.ts"),{projectRoot:c,minify:d.minify,externalizeUserModules:!1,collectInputs:d.collectInputs,throwOnFailure:!0});try{e=await f()}catch(a){if(!d.names)throw a;s=v(g,c,void 0),e=await f()}}catch(l){let{formatBuildFailure:f}=await import("./chunk-1p968nww.js"),a=f(l);console.warn(`[stx] could not build the page module registry (#1957): ${a}`);let m=`[stx] the page module registry did not build, so ${g.join(", ")} cannot load (#1957): ${a}`;return`;console.error(${JSON.stringify(m)});`}let{transformAutoImports:r,generateAutoImportDestructuring:n}=await import("./chunk-8kqqxqyp.js"),i=r(e),p=n(i.stxImports,i.browserImports),{transformStoreImports:h}=await import("./chunk-f18rxz70.js");e=h(i.code);let o=JSON.stringify(new Bun.CryptoHasher("md5").update(s).digest("hex").slice(0,12));return[";(function() {"," var __stxBundles = globalThis.__stxModuleBundles || (globalThis.__stxModuleBundles = {});",` if (__stxBundles[${o}]) return;`,` __stxBundles[${o}] = true;`,p,e,"})();"].join(`
|
|
4
4
|
`)}var P=/^import(?:[ \t]*(\{[^}]*\})[ \t]*from|[ \t]*\*[ \t]*as[ \t]+([\w$]+)[ \t]+from)?[ \t]*["']\.\/(chunk-[\w-]+)\.js["'][ \t]*;?[ \t]*$/gm,j=/^export\s*\{([^}]*)\}\s*;?[ \t]*$/gm,I=new Set(["__preload","__chunks"]),N=/^("[^"]*"|[\w$]+)(?:\s+as\s+("[^"]*"|[\w$]+))?$/;function J(g){let d=[],c=[],s=!0,r=g.replace(/^var __chunkGraphs;[\s\S]*?^var __chunks = [\s\S]*?^\};[ \t]*\n?/m,"").replace(/^__chunks\(import\.meta\.url,[^\n]*\);[ \t]*\n?/gm,"").replace(P,(h,o,l,f)=>{let a=`__stxChunkExports${d.length}`;if(d.push(f),c.push(`var ${a} = __stxChunk(${JSON.stringify(f)});`),l)c.push(`var ${l} = ${a};`);else if(o)for(let m of o.slice(1,-1).split(",")){let _=m.trim();if(!_)continue;let w=N.exec(_);if(!w){s=!1;continue}if(I.has(w[1]))continue;let M=w[1].startsWith('"')?JSON.parse(w[1]):w[1],t=w[2]??w[1];if(t.startsWith('"')){s=!1;continue}c.push(`var ${t} = ${a}[${JSON.stringify(M)}];`)}return""});if(!s)throw Error("an import it does not read");let n=[];r=r.replace(/\(\s*__preload\([^)]*\)\s*,\s*import\(\s*["']\.\/(chunk-[\w-]+)\.js["']\s*\)\s*\)|\bimport\(\s*["']\.\/(chunk-[\w-]+)\.js["']\s*\)/g,(h,o,l)=>{let f=o??l;return n.push(f),`Promise.resolve().then(function () { return __stxChunk(${JSON.stringify(f)}); })`});let i=[];r=r.replace(j,(h,o)=>{for(let l of o.split(",")){let f=l.trim();if(!f)continue;let a=N.exec(f);if(!a||a[1].startsWith('"')){s=!1;continue}if(I.has(a[1]))continue;let m=a[2]??a[1];i.push([a[1],m.startsWith('"')?JSON.parse(m):m])}return""});let p=[/\bimport\.meta\b/,/\b__chunks\b/,/\b__preload\b/,/^\s*export\s+(?:default\b|const\b|let\b|var\b|function\b|class\b|async\b|\*|\{)/m,/\bfrom\s*["']\.\/chunk-/,/^\s*import\s*["']\.\/chunk-/m].find((h)=>h.test(r));if(!s||p)throw Error(`${p?`${p.source} is left in it`:"an export it does not read"}`);return{reads:c.join(`
|
|
5
5
|
`),chunks:d,lazy:n,body:r,exports:i}}function Ol(g){if(/\bexport\s+(?:let|var)\b/.test(g))return!0;if(g.length/Math.max(1,g.split(`
|
|
6
|
-
`).length)>200)return!1;for(let d of g.matchAll(/\bexport\s*\{([^}]*)\}(?!\s*from\b)/g))for(let c of d[1].split(",")){let s=c.trim().split(/\s+as\s+/)[0].trim();if(!/^[A-Za-z_$][\w$]*$/.test(s))continue;let e=s.replace(/[$]/g,"\\$&");if(!new RegExp(`(?<![\\w$.])(?:let|var)\\s+${e}(?![\\w$])`,"g").test(g))continue;let n=new RegExp(`(?<![\\w$.])${e}\\s*(?:=(?![=>])|[-+*/%&|^]=|\\*\\*=|<<=|>>>?=|&&=|\\|\\|=|\\?\\?=|\\+\\+|--)|(?:\\+\\+|--)\\s*${e}(?![\\w$])`,"g"),i=new RegExp(`(?<![\\w$.])(?:let|var|const)\\s+${e}\\s*=`,"g");if((g.match(n)?.length??0)>(g.match(i)?.length??0))return!0}return!1}async function lo(g,d={}){let c=g.filter((e)=>e.ids.length>0);if(c.length===0)return{chunks:new Map,routes:new Map,reads:new Map};let s=process.cwd();try{let{bundleClientEntriesSplit:e}=await import("./chunk-
|
|
6
|
+
`).length)>200)return!1;for(let d of g.matchAll(/\bexport\s*\{([^}]*)\}(?!\s*from\b)/g))for(let c of d[1].split(",")){let s=c.trim().split(/\s+as\s+/)[0].trim();if(!/^[A-Za-z_$][\w$]*$/.test(s))continue;let e=s.replace(/[$]/g,"\\$&");if(!new RegExp(`(?<![\\w$.])(?:let|var)\\s+${e}(?![\\w$])`,"g").test(g))continue;let n=new RegExp(`(?<![\\w$.])${e}\\s*(?:=(?![=>])|[-+*/%&|^]=|\\*\\*=|<<=|>>>?=|&&=|\\|\\|=|\\?\\?=|\\+\\+|--)|(?:\\+\\+|--)\\s*${e}(?![\\w$])`,"g"),i=new RegExp(`(?<![\\w$.])(?:let|var|const)\\s+${e}\\s*=`,"g");if((g.match(n)?.length??0)>(g.match(i)?.length??0))return!0}return!1}async function lo(g,d={}){let c=g.filter((e)=>e.ids.length>0);if(c.length===0)return{chunks:new Map,routes:new Map,reads:new Map};let s=process.cwd();try{let{bundleClientEntriesSplit:e}=await import("./chunk-qccpfn5x.js"),r=[],n=await e(new Map(c.map((t)=>[t.name,v(t.ids,s,t.names)])),{projectRoot:s,filePath:R.join(s,".stx-module-registry.ts"),collectInputs:r});d.collectInputs?.push(...r);let{transformAutoImports:i,generateAutoImportDestructuring:p}=await import("./chunk-8kqqxqyp.js"),{transformStoreImports:h}=await import("./chunk-f18rxz70.js"),o=new Map;for(let[t,u]of[...n.chunks,...n.entries])try{o.set(t,J(u))}catch(b){throw Error(`cannot read ${t}: ${b instanceof Error?b.message:String(b)}`)}for(let[t,u]of[...n.chunks,...n.entries])if(/\b__esm\(/.test(u))throw Error(`${t} initialises a module lazily`);for(let t of r)if(/\.(?:[cm]?[jt]sx?)$/.test(t)&&Ol(await Bun.file(t).text()))throw Error(`${t} exports a binding that changes after it is read`);let l=new Set,f=new Set,a=(t)=>{if(f.has(t))return;if(l.has(t))throw Error(`the chunks import each other (${t})`);l.add(t);for(let u of o.get(t)?.chunks??[]){if(!o.has(u))throw Error(`${t} imports ${u}, which was not built`);a(u)}for(let u of o.get(t)?.lazy??[])if(!o.has(u))throw Error(`${t} imports ${u}, which was not built`);l.delete(t),f.add(t)};for(let t of o.keys())a(t);let m=(t)=>{let u=i(t.body);return{prelude:p(u.stxImports,u.browserImports),body:h(u.code)}},_=new Map;for(let t of n.chunks.keys()){let u=o.get(t),{prelude:b,body:k}=m(u),y=u.exports.map(([S,x])=>`get ${JSON.stringify(x)}() { return ${S}; }`).join(", ");_.set(t,`function (__stxChunk) {
|
|
7
7
|
${b}
|
|
8
8
|
${u.reads}
|
|
9
9
|
${k}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ln,No,Mo,Do,Nh,Lo}from"./chunk-
|
|
2
|
+
import{ln,No,Mo,Do,Nh,Lo}from"./chunk-4cd94cd5.js";import"./chunk-tm8a2b69.js";import"./chunk-9r999ees.js";import"./chunk-v4bqmzj9.js";export{Mo as buildServerApi,Nh as createServerApi,ln as discoverServerApi,No as generateApiTypes,Lo as isServerApiSource,Do as productionApiDispatcher};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{F,Xf,ei,Sc,a,O,Zh,Qh}from"./chunk-
|
|
2
|
+
import{F,Xf,ei,Sc,a,O,Zh,Qh}from"./chunk-1qybwj8k.js";import"./chunk-qxk9grjm.js";import"./chunk-kvafq9gy.js";import"./chunk-tm8a2b69.js";import"./chunk-vw73gsxx.js";import"./chunk-9r999ees.js";import"./chunk-mv48q1p4.js";import"./chunk-e8zpzt9s.js";import"./chunk-v4bqmzj9.js";import"./chunk-0dmpc70r.js";import"./chunk-xppm4cs4.js";import"./chunk-ngnvyqk3.js";export{O as config,F as defaultConfig,Zh as defineStxConfig,ei as discoverConfig,a as loadStxConfig,Sc as resolveInstalledPackage,Xf as resolveStxDirectories,Qh as validateConfig};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{pe,Wc,Us,bn,g,Le,je}from"./chunk-
|
|
2
|
+
import{pe,Wc,Us,bn,g,Le,je}from"./chunk-mv48q1p4.js";import{mr,et,F}from"./chunk-1qybwj8k.js";import{or,i}from"./chunk-ynd2nfvs.js";import{ve}from"./chunk-7hp50cpd.js";function b(s){return s.endsWith(".md")||s.endsWith(".markdown")}function k(s){let e=[];m(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let r=[...e];m(/<code\b[^>]*>[\s\S]*?<\/code>/gi,r);function m(n,p){let u;while((u=n.exec(s))!==null){let t=u.index,o=t+u[0].length;if(p?.some((l)=>t>=l.start&&o<=l.end))continue;e.push({start:t,end:o})}}if(e.length===0)return s;e.sort((n,p)=>n.start-p.start);let c="",a=0;for(let n of e){if(n.start<a)continue;c+=s.slice(a,n.start),c+=`@raw${s.slice(n.start,n.end)}@endraw`,a=n.end}return c+=s.slice(a),c}async function R(s,e={}){let{data:r,content:m}=mr(s),a=await(e.renderer??((n)=>et(n)))(m);return{html:k(a),frontmatter:r??{}}}import{dirname as v,resolve as _}from"path";function M(s){let e=s,r=pe(s);if(r)e=r.content.trim();let m=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,c=[],a=[],n=[],p=(o)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(o),u;while((u=m.exec(s))!==null){let o=u[1],l=u[2],d=u[0],f=o.includes("server");if(p(l))n.push(d);else if(f)a.push(l);else c.push(d)}let t=e;{let o=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,l,d=[];while((l=o.exec(t))!==null){let f=l.index+l[0].length,x=t.indexOf("</script>",f);if(x===-1)continue;d.push({start:l.index,end:x+9}),o.lastIndex=x+9}for(let f=d.length-1;f>=0;f--)t=t.substring(0,d[f].start)+t.substring(d[f].end)}for(let o of c)t=t.replace(o,"");return{templateContent:t,serverScripts:a,clientScripts:c,signalsScripts:n}}function E(s,e){return`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
@@ -14,5 +14,5 @@ ${a.join(`
|
|
|
14
14
|
`)}`}else{if(r.processClientScripts!==!1&&a.length>0){let o=p.__stx_event_bindings||[],l=Le(p),d=await Promise.all(a.map(async(w)=>{let C=w.match(/<script\b([^>]*)>/i)?.[1]||"";if(/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(C))return w;let h=w.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!h)return w;return await je(h[1],{eventBindings:o,templateContent:t,serverData:l,filePath:e})})),x=[await or(d,{...n,buildMode:"compile"}),...d].filter(Boolean).join(`
|
|
15
15
|
`);if(t.match(/(<\/body>)/i))t=t.replace(/(<\/body>)/i,`${x}
|
|
16
16
|
$1`);else t+=`
|
|
17
|
-
${x}`}t=await ve(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=E(t,r.title)}if(r.injectCSS)try{let{injectCss:o}=await import("./chunk-
|
|
17
|
+
${x}`}t=await ve(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=E(t,r.title)}if(r.injectCSS)try{let{injectCss:o}=await import("./chunk-81z64a84.js");t=await o(t)}catch{}return t}
|
|
18
18
|
export{nc};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Nl,Ml}from"./chunk-mhjxx64x.js";import"./chunk-d4gy4yz0.js";import"./chunk-zqb294v2.js";import"./chunk-zme05d1n.js";import"./chunk-9n3584wt.js";import"./chunk-2rxr5cj6.js";import"./chunk-ma4ftg5p.js";import"./chunk-xn2gyhes.js";import"./chunk-w835crjw.js";import"./chunk-fba71th7.js";import"./chunk-t3a3wbjk.js";import"./chunk-q0ycypnt.js";import"./chunk-r69en2jg.js";import"./chunk-jn6mdfrs.js";import"./chunk-h1f3dpvq.js";import"./chunk-5erremft.js";import"./chunk-ya6f7mt5.js";import"./chunk-mpmnbvy4.js";import"./chunk-bkefg64w.js";import"./chunk-fj5jw2jd.js";import"./chunk-0vg0j7xa.js";import"./chunk-11y3106w.js";import"./chunk-n77xrpv9.js";import"./chunk-63rvsnt2.js";import"./chunk-4nhbbcr9.js";import"./chunk-fphnst8a.js";import"./chunk-fbpqkrvb.js";import"./chunk-pwem4sed.js";import"./chunk-f9thwm8c.js";import"./chunk-hgy98n76.js";import"./chunk-68pvvd7v.js";import"./chunk-qa4vs1qg.js";import{nn}from"./chunk-yzvp90yk.js";import"./chunk-pesgcwrj.js";import"./chunk-4cd94cd5.js";import"./chunk-hpwtjb4a.js";import{Ae,i}from"./chunk-ynd2nfvs.js";import"./chunk-9hvfmqs1.js";import"./chunk-xfb7fdeq.js";import"./chunk-t5q31st4.js";import"./chunk-q0jmc3m4.js";import"./chunk-8qe34jb8.js";import"./chunk-279n7sde.js";import"./chunk-v8p8t3t4.js";import"./chunk-4wrddn8m.js";import{ve}from"./chunk-7hp50cpd.js";import"./chunk-zswtgwxg.js";import{fr,gr}from"./chunk-k0arm18k.js";import{Cs,F,a}from"./chunk-1qybwj8k.js";import"./chunk-qxk9grjm.js";import"./chunk-kvafq9gy.js";import"./chunk-tm8a2b69.js";import"./chunk-vw73gsxx.js";import"./chunk-9r999ees.js";import{g,je}from"./chunk-mv48q1p4.js";import"./chunk-e8zpzt9s.js";import"./chunk-v4bqmzj9.js";import"./chunk-0dmpc70r.js";import"./chunk-xppm4cs4.js";import"./chunk-ngnvyqk3.js";import"./chunk-w7p34cr3.js";import"./chunk-jr346anv.js";export{Cs as buildWebComponents,gr as cacheTemplate,fr as checkCache,nn as classifyAllScripts,Nl as createMiddleware,Ml as createRoute,F as defaultConfig,g as extractVariables,ve as injectRouterScript,a as loadStxConfig,je as processClientScript,i as processDirectives,Ae as readMarkdownFile};
|