@stacksjs/stx 0.2.290 → 0.2.292
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-n0dbcnxr.js → chunk-0vnb799d.js} +1 -1
- package/dist/{chunk-hxrj0068.js → chunk-1808n1wa.js} +1 -1
- package/dist/{chunk-wsf5hxe3.js → chunk-1jaecby8.js} +1 -1
- package/dist/{chunk-bpjmm432.js → chunk-208m2e5n.js} +1 -1
- package/dist/{chunk-3w7zzc09.js → chunk-28fp26rb.js} +1 -1
- package/dist/{chunk-vdb2696a.js → chunk-2h3jgpts.js} +2 -2
- package/dist/{chunk-f6fe6rnb.js → chunk-2zbkpbhr.js} +1 -1
- package/dist/{chunk-jxpjb31v.js → chunk-34wtqndg.js} +1 -1
- package/dist/{chunk-r09mh5jg.js → chunk-3esxha5p.js} +1 -1
- package/dist/{chunk-dkb0vas3.js → chunk-418g2nh4.js} +1 -1
- package/dist/{chunk-q1sv9qtc.js → chunk-4njgtpcx.js} +2 -2
- package/dist/{chunk-5qn5hm0m.js → chunk-5ygw1kzd.js} +1 -1
- package/dist/{chunk-htkktmh3.js → chunk-6exjvza5.js} +1 -1
- package/dist/chunk-6xm5p7xv.js +2 -0
- package/dist/{chunk-8xw54xkz.js → chunk-7g71qjfg.js} +9 -9
- package/dist/{chunk-2ky53kzn.js → chunk-9r5kevtk.js} +1 -1
- package/dist/{chunk-38c4xz9b.js → chunk-9xtn4ybq.js} +1 -1
- package/dist/{chunk-m31cshyg.js → chunk-a540pndz.js} +1 -1
- package/dist/{chunk-68fb23tb.js → chunk-bk3pm7vs.js} +1 -1
- package/dist/{chunk-d7gf69nf.js → chunk-cfy4n2pn.js} +1 -1
- package/dist/{chunk-e7mmb0b3.js → chunk-ejcag982.js} +1 -1
- package/dist/{chunk-9vnh50p1.js → chunk-eqnsptkc.js} +1 -1
- package/dist/{chunk-27mcbgsp.js → chunk-et9qad4w.js} +1 -1
- package/dist/{chunk-vkv3deyw.js → chunk-fcde3yy0.js} +1 -1
- package/dist/{chunk-teptnq41.js → chunk-gcwnxq0b.js} +1 -1
- package/dist/{chunk-raczxett.js → chunk-hf3pqryr.js} +1 -1
- package/dist/{chunk-mw4kqnjq.js → chunk-hmzf7jey.js} +1 -1
- package/dist/{chunk-kth7xvwx.js → chunk-mf4akzqj.js} +1 -1
- package/dist/{chunk-rwaxnpr3.js → chunk-mqempwb6.js} +1 -1
- package/dist/{chunk-d8t2719e.js → chunk-msb45j2n.js} +1 -1
- package/dist/{chunk-3sgrdrav.js → chunk-pktseark.js} +1 -1
- package/dist/{chunk-8ybhs27t.js → chunk-qsgd6bvq.js} +161 -53
- package/dist/{chunk-ppdc35r2.js → chunk-rwaqb3bs.js} +1 -1
- package/dist/{chunk-41zwd0va.js → chunk-s4h21td2.js} +1 -1
- package/dist/{chunk-4xg7zasg.js → chunk-t7jv48p8.js} +1 -1
- package/dist/{chunk-7wfm9ydm.js → chunk-tkpafgzq.js} +1 -1
- package/dist/{chunk-65rj7hds.js → chunk-tq005ysq.js} +1 -1
- package/dist/{chunk-cz9srk67.js → chunk-vcmbscjx.js} +1 -1
- package/dist/{chunk-xws9mpmv.js → chunk-vw5ynbz7.js} +1 -1
- package/dist/{chunk-gc57b4y2.js → chunk-w6d78tbf.js} +165 -164
- package/dist/{chunk-qbzf9eaf.js → chunk-wmgndxeg.js} +1 -1
- package/dist/{chunk-8gyh1gsg.js → chunk-x544hah3.js} +1 -1
- package/dist/{chunk-1sptqk7h.js → chunk-xr0g1j44.js} +1 -1
- package/dist/chunk-xxp2vgk5.js +2 -0
- package/dist/{chunk-ywhapcwn.js → chunk-z21f96n7.js} +1 -1
- package/dist/{chunk-dd4yb7x1.js → chunk-z26wja8z.js} +1 -1
- package/dist/{chunk-mzstheqe.js → chunk-zdd1gjzw.js} +1 -1
- package/dist/cli.js +7 -7
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/inline-assets.d.ts +0 -14
- package/dist/inline-assets.js +16 -2
- package/dist/pwa.js +1 -1
- package/dist/ssg.js +2 -2
- package/package.json +5 -5
- package/dist/chunk-gw9twshb.js +0 -2
- package/dist/chunk-nhk9xscz.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$k as a,al as b,bl as c,cl as d,dl as e,el as f,fl as g,gl as h,hl as i,il as j,jl as k,kl as l,ll as m}from"./chunk-
|
|
2
|
+
import{$k as a,al as b,bl as c,cl as d,dl as e,el as f,fl as g,gl as h,hl as i,il as j,jl as k,kl as l,ll as m}from"./chunk-mf4akzqj.js";import"./chunk-w6d78tbf.js";import"./chunk-kzt0ycg7.js";import"./chunk-r2pck10q.js";import"./chunk-278ay77z.js";import"./chunk-fq5d2r74.js";import"./chunk-ant3p5v8.js";import"./chunk-t7jv48p8.js";import"./chunk-bf4xr43a.js";import"./chunk-n3kmd544.js";import"./chunk-c1rwzz7v.js";import"./chunk-wzb9q4ta.js";import"./chunk-ncnmb3kq.js";import"./chunk-qsgd6bvq.js";import"./chunk-0jznnssx.js";import"./chunk-vqq5zjbg.js";export{b as shouldLogBundlerDiagnostics,f as setBundlerFallbackMode,k as rewriteRegistryImports,g as resolveBundlerFallback,j as registryIdForPath,c as recordBundleFailure,l as queueClientBundleBuild,h as hasUserImports,d as getBundleFailures,a as clientBundleDependencies,e as clearBundleFailures,m as bundleClientScript,i as MODULE_SPECIFIER_PREFIX};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$l as k,Rl as c,Ul as d,Vl as e,Wl as f,Xl as g,Yl as h,Zl as i,_l as j,am as l,bm as m}from"./chunk-
|
|
2
|
+
import{$l as k,Rl as c,Ul as d,Vl as e,Wl as f,Xl as g,Yl as h,Zl as i,_l as j,am as l,bm as m}from"./chunk-w6d78tbf.js";import"./chunk-kzt0ycg7.js";import"./chunk-r2pck10q.js";import"./chunk-278ay77z.js";import{Zs as a,_s as b}from"./chunk-fq5d2r74.js";import"./chunk-ant3p5v8.js";import"./chunk-t7jv48p8.js";import"./chunk-bf4xr43a.js";import"./chunk-n3kmd544.js";import"./chunk-c1rwzz7v.js";import"./chunk-wzb9q4ta.js";import"./chunk-ncnmb3kq.js";import"./chunk-qsgd6bvq.js";import"./chunk-0jznnssx.js";import"./chunk-vqq5zjbg.js";export{h as transformAutoImports,b as stripCommentsAndLiterals,e as renderVendorStyleTags,m as processClientScript,g as injectBrowserCoreAutoImports,l as generateServerDataBridge,j as generateBrowserAutoImportDestructuring,i as generateAutoImportDestructuring,a as findInterpolationEnd,k as extractBridgeData,d as extractAndStripCssImports,f as STX_AUTO_IMPORTS,c as BROWSER_CORE_IMPORTS};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Fp as b,Gp as c,Hp as d,Ip as e,do as a}from"./chunk-
|
|
2
|
+
import{Fp as b,Gp as c,Hp as d,Ip as e,do as a}from"./chunk-w6d78tbf.js";import"./chunk-kzt0ycg7.js";import"./chunk-r2pck10q.js";import"./chunk-278ay77z.js";import"./chunk-fq5d2r74.js";import"./chunk-ant3p5v8.js";import"./chunk-t7jv48p8.js";import"./chunk-bf4xr43a.js";import"./chunk-n3kmd544.js";import"./chunk-c1rwzz7v.js";import"./chunk-wzb9q4ta.js";import"./chunk-ncnmb3kq.js";import"./chunk-qsgd6bvq.js";import"./chunk-0jznnssx.js";import"./chunk-vqq5zjbg.js";export{d as validateClientScript,c as processOnceDirective,b as processJsonDirective,e as processDirectives,a as injectRouterScript};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{jv as Ae,kv as u}from"./chunk-vqq5zjbg.js";function _(e){return e.split(/[\\/]/).filter(Boolean).slice(0,-1).some((a)=>g.includes(a))}function m(e){return _(e.replace(/^\//,""))}var g;var b=u(()=>{g=["components","layouts","partials","emails"]});import h from"fs";import y from"path";function x(e,t){let a=e.filter((o)=>!m(o.pattern)),r=["// Auto-generated by STX - do not edit"];if(a.length===0)r.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{r.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let o of a){let i=[];for(let
|
|
3
|
-
`),s=y.join(t,"route-types.d.ts");try{if(h.existsSync(s)&&h.readFileSync(s,"utf8")===n)return;h.mkdirSync(t,{recursive:!0}),h.writeFileSync(s,n)}catch{}}function S(e,t,a){let r=process.cwd(),n=y.relative(r,a),s=e.filter((i)=>!m(i.pattern)),o=["// Auto-generated by stx \u2014 do not edit",`// Source: ${n||"pages"}/`,"","export const routes = ["];for(let i of s){let
|
|
4
|
-
`))}var F=u(()=>{b()});import V from"path";function k(e,t){let r=V.relative(t,e).replace(/\.(stx|md)$/,"");if(r=r.split(V.sep).join("/"),r==="index")return"/";if(r.endsWith("/index"))r=r.slice(0,-6);return r=r.replace(/\[\[([^\]]+)\]\]/g,":$1?"),r=r.replace(/\[([^\]]+)\]/g,":$1"),r=r.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${r}`}function v(e){let t=[],a="",r=0;while(r<e.length){let n=e.slice(r),s=/^\/:([^/?*]+)\?/.exec(n);if(s){t.push(s[1]),a+="(?:/([^/]+))?",r+=s[0].length;continue}let o=/^:([^/?*]+)\*/.exec(n);if(o){t.push(o[1]),a+="(.+)",r+=o[0].length;continue}let i=/^:([^/?*]+)/.exec(n);if(i){t.push(i[1]),a+="([^/]+)",r+=i[0].length;continue}a+=e[r].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),r+=1}return{regex:new RegExp(`^${a}$`),params:t}}function D(e,t){let a=e===""?"/":e;for(let r of t){let n=a.match(r.regex);if(n){let s={};return r.params.forEach((o,i)=>{s[o]=n[i+1]}),{route:r,params:s}}}return null}function W(e){let t=e.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return v(t)}var
|
|
2
|
+
import{jv as Ae,kv as u}from"./chunk-vqq5zjbg.js";function _(e){return e.split(/[\\/]/).filter(Boolean).slice(0,-1).some((a)=>g.includes(a))}function m(e){return _(e.replace(/^\//,""))}var g;var b=u(()=>{g=["components","layouts","partials","emails"]});import h from"fs";import y from"path";function x(e,t){let a=e.filter((o)=>!m(o.pattern)),r=["// Auto-generated by STX - do not edit"];if(a.length===0)r.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{r.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let o of a){let i=[];for(let c of o.params){let f=o.pattern.includes(`:${c}?`)?"?":"";i.push(`${c}${f}: string`)}let l=i.join("; ");r.push(` '${o.pattern}': { ${l} }`)}r.push(" }","}","","export {}","")}let n=r.join(`
|
|
3
|
+
`),s=y.join(t,"route-types.d.ts");try{if(h.existsSync(s)&&h.readFileSync(s,"utf8")===n)return;h.mkdirSync(t,{recursive:!0}),h.writeFileSync(s,n)}catch{}}function S(e,t,a){let r=process.cwd(),n=y.relative(r,a),s=e.filter((i)=>!m(i.pattern)),o=["// Auto-generated by stx \u2014 do not edit",`// Source: ${n||"pages"}/`,"","export const routes = ["];for(let i of s){let l=y.relative(r,i.filePath).replace(/\\/g,"/"),c=JSON.stringify(i.params),f=i.layout?`, layout: '${y.relative(r,i.layout).replace(/\\/g,"/")}'`:"";o.push(` { pattern: '${i.pattern}', filePath: '${l}', isDynamic: ${i.isDynamic}, params: ${c}${f} },`)}o.push("] as const",""),o.push("export type RouteName = typeof routes[number]['pattern']",""),h.mkdirSync(t,{recursive:!0}),h.writeFileSync(y.join(t,"routes.ts"),o.join(`
|
|
4
|
+
`))}var F=u(()=>{b()});import V from"path";function k(e,t){let r=V.relative(t,e).replace(/\.(stx|md)$/,"");if(r=r.split(V.sep).join("/"),r==="index")return"/";if(r.endsWith("/index"))r=r.slice(0,-6);return r=r.replace(/\[\[([^\]]+)\]\]/g,":$1?"),r=r.replace(/\[([^\]]+)\]/g,":$1"),r=r.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${r}`}function v(e){let t=[],a="",r=0;while(r<e.length){let n=e.slice(r),s=/^\/:([^/?*]+)\?/.exec(n);if(s){t.push(s[1]),a+="(?:/([^/]+))?",r+=s[0].length;continue}let o=/^:([^/?*]+)\*/.exec(n);if(o){t.push(o[1]),a+="(.+)",r+=o[0].length;continue}let i=/^:([^/?*]+)/.exec(n);if(i){t.push(i[1]),a+="([^/]+)",r+=i[0].length;continue}a+=e[r].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),r+=1}return{regex:new RegExp(`^${a}$`),params:t}}function D(e,t){let a=e===""?"/":e;for(let r of t){let n=a.match(r.regex);if(n){let s={};return r.params.forEach((o,i)=>{s[o]=n[i+1]}),{route:r,params:s}}}return null}function W(e){let t=e.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return v(t)}var M=()=>{};import xe from"fs";import I from"path";function A(e,t){let a=[],r=I.dirname(e);while(r.startsWith(t)||r===t){let n=I.join(r,"_layout.stx");if(xe.existsSync(n))a.unshift(n);if(r===t)break;r=I.dirname(r)}return a}var N=()=>{};import P from"fs";import d from"path";function K(e,t){let a=[];if(!P.existsSync(e))return a;let r=P.readdirSync(e,{withFileTypes:!0});for(let n of r){let s=d.join(e,n.name);if(n.isDirectory()){if(n.name.startsWith("."))continue;if(g.includes(n.name))continue;a.push(...K(s,t))}else if(n.isFile()){let o=d.extname(n.name);if(t.includes(o)){if(n.name.startsWith("_")&&n.name!=="_layout.stx")continue;if(n.name==="_layout.stx")continue;a.push(s)}}}return a}class C{routes;pagesDir;pagesDirs;config;constructor(e,t={}){this.config=t;let a=t.pagesDirs&&t.pagesDirs.length>0?t.pagesDirs:[t.pagesDir||"pages"];this.pagesDirs=a.map((o)=>d.resolve(e,o)),this.pagesDir=this.pagesDirs[0];let r=t.extensions||[".stx"],n=new Set;this.routes=[];for(let o of this.pagesDirs){let i=K(o,r);for(let l of i){let c=k(l,o);if(n.has(c))continue;n.add(c);let{regex:f,params:H}=v(c),O=t.layouts!==!1?A(l,o):[];this.routes.push({pattern:c,regex:f,params:H,filePath:l,isDynamic:H.length>0,layout:O.length>0?O[O.length-1]:void 0})}}this.routes.sort((o,i)=>{if(!o.isDynamic&&i.isDynamic)return-1;if(o.isDynamic&&!i.isDynamic)return 1;let l=o.pattern.split("/").length,c=i.pattern.split("/").length;if(l!==c)return c-l;return o.pattern.localeCompare(i.pattern)});let s=d.resolve(e,t.stateDir||process.env.STX_DIR?.trim()||".stx");x(this.routes,s),S(this.routes,s,this.pagesDir)}match(e){let t=e===""?"/":e;for(let a of this.routes){let r=t.match(a.regex);if(r){let n={};return a.params.forEach((s,o)=>{n[s]=r[o+1]}),{route:a,params:n}}}return null}resolve(e,t){let a=this.routes.find((n)=>n.pattern===e||n.filePath.includes(e));if(!a)return"#not-found";let r=a.pattern;if(t)for(let[n,s]of Object.entries(t))r=r.replace(`:${n}`,encodeURIComponent(s));return r}addRoute(e){this.routes.push(e),this.routes.sort((t,a)=>{if(!t.isDynamic&&a.isDynamic)return-1;if(t.isDynamic&&!a.isDynamic)return 1;return t.pattern.localeCompare(a.pattern)})}getLayout(e){return e.layout??null}}function z(e,t){return new C(e,t)}function $(e,t){let a=[`${t}.stx`,"error.stx"];for(let r of a){let n=d.join(e,r);if(P.existsSync(n))return n}return null}function Y(e,t){return e.map((a)=>{let r=d.relative(t,a.filePath),n=a.isDynamic?" (dynamic)":"";return`${a.pattern} \u2192 ${r}${n}`})}var J=u(()=>{F();M();N();b()});function Z(e){T=e.replace(/\/$/,"")}function Q(e,t,a={}){p[e]={path:t,name:e,params:a}}function ee(e){for(let[t,a]of Object.entries(e))if(typeof a==="string")p[t]={path:a,name:t};else p[t]={...a,name:t}}function te(e,t={},a=!1){let r=p[e];if(!r)return console.warn(`Route [${e}] not defined.`),"#undefined-route";let n={...r.params,...t},s=r.path;s=s.replace(/:(\w+)/g,(i,l)=>{let c=n[l];if(c===void 0)return console.warn(`Missing parameter [${l}] for route [${e}].`),`:${l}`;return delete n[l],encodeURIComponent(String(c))});let o=Object.entries(n);if(o.length>0){let i=o.map(([l,c])=>`${encodeURIComponent(l)}=${encodeURIComponent(String(c))}`).join("&");s+=(s.includes("?")?"&":"?")+i}return a&&T?`${T}${s}`:s}function re(){for(let e of Object.keys(p))delete p[e];T=""}var p,T="";var ae=u(()=>{p={}});import ne from"fs";import oe from"path";function se(e,t={}){return{type:"redirect",path:e,options:{replace:t.replace??!1,external:t.external??!1,redirectCode:t.redirectCode??302}}}function ie(e){return{type:"abort",error:typeof e==="string"?{statusCode:500,message:e}:e}}function le(e,t={}){return{handler:e,mode:t.mode??"universal"}}function B(e){let t={};if(!e)return t;let a=e.split(";");for(let r of a){let[n,...s]=r.split("=");if(n){let o=n.trim(),i=s.join("=").trim();if(o)t[o]=decodeURIComponent(i)}}return t}function E(e,t,a={}){let r=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(a.expires){let n=typeof a.expires==="number"?new Date(Date.now()+a.expires*1000):a.expires;r+=`; Expires=${n.toUTCString()}`}if(a.path)r+=`; Path=${a.path}`;if(a.domain)r+=`; Domain=${a.domain}`;if(a.secure)r+="; Secure";if(a.httpOnly)r+="; HttpOnly";if(a.sameSite)r+=`; SameSite=${a.sameSite}`;return r}function G(e,t){let a=e.headers.get("cookie")||"",r=B(a);return{get(n){return r[n]},set(n,s,o={}){r[n]=s,t.append("Set-Cookie",E(n,s,o))},delete(n){delete r[n],t.append("Set-Cookie",E(n,"",{expires:new Date(0),path:"/"}))},getAll(){return{...r}}}}function U(){return{get(e){if(typeof document>"u")return;return B(document.cookie)[e]},set(e,t,a={}){if(typeof document>"u")return;document.cookie=E(e,t,a)},delete(e){if(typeof document>"u")return;document.cookie=E(e,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return B(document.cookie)}}}function X(){let e=typeof window<"u"&&typeof window.localStorage<"u";return{get(t){if(!e)return null;try{return window.localStorage.getItem(t)}catch{return null}},set(t,a){if(!e)return;try{window.localStorage.setItem(t,a)}catch{}},remove(t){if(!e)return;try{window.localStorage.removeItem(t)}catch{}},isAvailable(){return e}}}function R(e,t){w.set(e,t)}function j(e){return w.get(e)}function ce(e){return w.has(e)}function ue(){w.clear()}function he(){return Array.from(w.keys())}async function de(e,t="middleware"){let a=oe.resolve(e,t);if(!ne.existsSync(a))return;let r=ne.readdirSync(a);for(let n of r){if(!n.endsWith(".ts")&&!n.endsWith(".js"))continue;if(n.includes(".test.")||n.includes(".spec."))continue;let s=n.replace(/\.(ts|js)$/,""),o=oe.join(a,n);try{let l=(await import(o)).default;if(l&&typeof l.handler==="function")R(s,l);else if(typeof l==="function")R(s,{handler:l,mode:"universal"})}catch(i){console.warn(`Failed to load middleware '${s}' from ${o}:`,i)}}}function Se(e){let t={};if(!e)return t;let a=new URLSearchParams(e);for(let[r,n]of a)t[r]=n;return t}function pe(e,t,a,r=""){return{path:e,params:t,query:Se(r),fullPath:r?`${e}?${r}`:e,meta:a}}function fe(e,t,a,r){let n=r?.isServer??typeof window>"u",s=!n,o=new Headers;return{to:e,from:t,isClient:s,isServer:n,cookies:n&&a?G(a,o):U(),storage:X(),state:{},request:a,responseHeaders:o}}async function ge(e,t){let a=Array.isArray(e)?e:[e],r=t.isServer;for(let n of a){let s=j(n);if(!s)return console.error(`Route middleware '${n}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${n}' is not registered`}},state:t.state,responseHeaders:t.responseHeaders};if(s.mode==="server"&&!r)continue;try{let o=await s.handler(t);if(o){if(o.type==="redirect")return{passed:!1,redirect:o,state:t.state,responseHeaders:t.responseHeaders};if(o.type==="abort")return{passed:!1,abort:o,state:t.state,responseHeaders:t.responseHeaders}}}catch(o){return console.error(`Error in middleware '${n}':`,o),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:o instanceof Error?o.message:"Middleware error"}},state:t.state,responseHeaders:t.responseHeaders}}}return{passed:!0,state:t.state,responseHeaders:t.responseHeaders}}var w;var me=u(()=>{w=new Map});function q(e){let a=e.replace(/\\/g,"/").split("/").filter(Boolean),r=a.lastIndexOf("layouts"),n=r>=0?a[r+1]:a.at(-1);if(!n)return"app";return n.replace(/\.stx$/i,"")||"app"}function ye(e){let t=e.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),a=e.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),r=e.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),n=t?.[1]||r?.[1]||"";return{layout:n,group:a?.[1]||q(n)}}var ve=()=>{};function ke(e){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(e).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return e}}function we(){if(L)return L;return L=ke(`
|
|
5
5
|
;(function(){
|
|
6
6
|
'use strict';
|
|
7
7
|
var ROUTER_REV=7;
|
|
8
8
|
if(window.__stxRouter&&window.__stxRouter.__rev===ROUTER_REV)return;
|
|
9
9
|
|
|
10
10
|
// \u2500\u2500 Configuration \u2500\u2500
|
|
11
|
-
var defaults={container:'main',loadingClass:'stx-navigating',viewTransitions:true,cache:true,scrollToTop:true,prefetch:true,progress:true,progressColor:'#78dce8',progressHeight:'2px',interceptAllLinks:false,prefetchCacheMax:50,routeFocus:true,announceRoute:true,interceptForms:false};
|
|
11
|
+
var defaults={container:'main',loadingClass:'stx-navigating',viewTransitions:true,cache:true,scrollToTop:true,prefetch:true,progress:true,progressColor:'#78dce8',progressHeight:'2px',interceptAllLinks:false,prefetchCacheMax:50,routeFocus:true,announceRoute:true,interceptForms:false,cssLoadTimeout:1500};
|
|
12
12
|
var o=Object.assign({},defaults,window.__stxRouterConfig||{},window.STX_ROUTER_OPTIONS||{});
|
|
13
13
|
var containerSel=o.container;
|
|
14
14
|
var debug=!!o.debug;
|
|
@@ -772,6 +772,99 @@ else {
|
|
|
772
772
|
try{target.focus({preventScroll:true})}catch(e){try{target.focus()}catch(e2){}}
|
|
773
773
|
}
|
|
774
774
|
|
|
775
|
+
// \u2500\u2500 Generated utility stylesheets \u2500\u2500
|
|
776
|
+
// Every page ships its own content-addressed utility sheet as
|
|
777
|
+
// <link data-css="generated">, and none of them is ever removed on a
|
|
778
|
+
// navigation, so they pile up in <head>. Two of them can define the same
|
|
779
|
+
// class at the same specificity, which makes their ORDER decide the cascade:
|
|
780
|
+
// the later sheet wins. Deduping alone left that order as "first seen", so
|
|
781
|
+
// after Records \u2192 Feed \u2192 Records the Feed sheet still sat after the Records
|
|
782
|
+
// one and its .flex-col beat Records' own responsive sm:flex-row \u2014 the header
|
|
783
|
+
// stacked into a column on desktop. The current page's complete sheet has to
|
|
784
|
+
// be the last one, every navigation, not just the first time it is seen.
|
|
785
|
+
function findGeneratedCss(abs){
|
|
786
|
+
var found=null;
|
|
787
|
+
document.querySelectorAll('head link[data-css][href]').forEach(function(link){
|
|
788
|
+
if(new URL(link.getAttribute('href'),location.href).href!==abs)return;
|
|
789
|
+
// Collapse duplicates, so moving one copy to the end can never leave an
|
|
790
|
+
// older copy of the same sheet behind to fight it.
|
|
791
|
+
if(found){link.parentNode.removeChild(link);return}
|
|
792
|
+
found=link;
|
|
793
|
+
});
|
|
794
|
+
return found;
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
// Before the swap: add each sheet the page does not have yet, as
|
|
798
|
+
// media="print" so it downloads without restyling the page still on screen.
|
|
799
|
+
// Returns a promise for them to finish (load OR error, capped at
|
|
800
|
+
// cssLoadTimeout so a slow or missing sheet never stalls navigation), or null
|
|
801
|
+
// when nothing new is needed and the swap can go ahead in the same turn.
|
|
802
|
+
function preloadGeneratedCss(hrefs,base){
|
|
803
|
+
var pending=[];
|
|
804
|
+
hrefs.forEach(function(href){
|
|
805
|
+
var abs;
|
|
806
|
+
try{abs=new URL(href,base).href}catch(e){return}
|
|
807
|
+
var link=findGeneratedCss(abs);
|
|
808
|
+
if(link){
|
|
809
|
+
// Still downloading for a navigation that never swapped \u2014 wait on it
|
|
810
|
+
// rather than on nothing.
|
|
811
|
+
if(link.__stxCssReady)pending.push(link.__stxCssReady);
|
|
812
|
+
return;
|
|
813
|
+
}
|
|
814
|
+
link=document.createElement('link');
|
|
815
|
+
link.setAttribute('data-css','generated');
|
|
816
|
+
link.setAttribute('rel','stylesheet');
|
|
817
|
+
link.setAttribute('href',new URL(href,location.href).href===abs?href:abs);
|
|
818
|
+
link.setAttribute('media','print');
|
|
819
|
+
link.setAttribute('data-stx-css-pending','');
|
|
820
|
+
link.__stxCssReady=new Promise(function(resolve){
|
|
821
|
+
var timer=setTimeout(finish,o.cssLoadTimeout);
|
|
822
|
+
function finish(){clearTimeout(timer);link.onload=null;link.onerror=null;link.__stxCssReady=null;resolve()}
|
|
823
|
+
link.onload=finish;
|
|
824
|
+
link.onerror=finish;
|
|
825
|
+
});
|
|
826
|
+
pending.push(link.__stxCssReady);
|
|
827
|
+
document.head.appendChild(link);
|
|
828
|
+
});
|
|
829
|
+
return pending.length?Promise.all(pending):null;
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
// At the swap: make the destination's sheets live and move them to the end
|
|
833
|
+
// of <head>. appendChild on a node that is already there MOVES it \u2014 no
|
|
834
|
+
// duplicate, and the browser keeps the parsed sheet rather than refetching.
|
|
835
|
+
// Only generated sheets are reordered; app and font stylesheets keep the
|
|
836
|
+
// order they were declared in.
|
|
837
|
+
function promoteGeneratedCss(hrefs,base){
|
|
838
|
+
hrefs.forEach(function(href){
|
|
839
|
+
var abs;
|
|
840
|
+
try{abs=new URL(href,base).href}catch(e){return}
|
|
841
|
+
var link=findGeneratedCss(abs);
|
|
842
|
+
if(!link){
|
|
843
|
+
preloadGeneratedCss([href],base);
|
|
844
|
+
link=findGeneratedCss(abs);
|
|
845
|
+
if(!link)return;
|
|
846
|
+
}
|
|
847
|
+
if(link.hasAttribute('data-stx-css-pending')){
|
|
848
|
+
link.removeAttribute('data-stx-css-pending');
|
|
849
|
+
link.removeAttribute('media');
|
|
850
|
+
}
|
|
851
|
+
document.head.appendChild(link);
|
|
852
|
+
});
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
// The generated-sheet hrefs a fragment carries. Scripts are skipped so a
|
|
856
|
+
// <link> written inside a string in page code is not mistaken for one.
|
|
857
|
+
function fragmentCssHrefs(html){
|
|
858
|
+
var hrefs=[];
|
|
859
|
+
html.replace(new RegExp('<scr'+'ipt\\\\b[^>]*>[\\\\s\\\\S]*?<\\\\/scr'+'ipt>','gi'),'').replace(new RegExp('<link\\\\b([^>]*)>','gi'),function(m,attrs){
|
|
860
|
+
if(attrs.indexOf('data-css')===-1)return m;
|
|
861
|
+
var hrefMatch=attrs.match(/\\bhref=(["'])(.*?)\\1/i);
|
|
862
|
+
if(hrefMatch&&hrefMatch[2])hrefs.push(hrefMatch[2]);
|
|
863
|
+
return m;
|
|
864
|
+
});
|
|
865
|
+
return hrefs;
|
|
866
|
+
}
|
|
867
|
+
|
|
775
868
|
function swap(html,url,pushState,hash){
|
|
776
869
|
var fragMark=/^<!--stx-fragment(?: rt=([01]))?-->/.exec(html);
|
|
777
870
|
var isFragment=!!fragMark;
|
|
@@ -792,7 +885,6 @@ else {
|
|
|
792
885
|
location.href=url;
|
|
793
886
|
return Promise.resolve(false);
|
|
794
887
|
}
|
|
795
|
-
if(window.stx&&window.stx._cleanupContainer)window.stx._cleanupContainer(currentContent);
|
|
796
888
|
function doFragSwap(){
|
|
797
889
|
// Extract scripts from fragment before injecting HTML
|
|
798
890
|
var fragScripts=[];
|
|
@@ -869,19 +961,9 @@ else {
|
|
|
869
961
|
document.head.appendChild(cw);
|
|
870
962
|
}
|
|
871
963
|
}
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
document.querySelectorAll('head link[data-css][href]').forEach(function(link){
|
|
876
|
-
if(new URL(link.getAttribute('href'),location.href).href===absolute)exists=true;
|
|
877
|
-
});
|
|
878
|
-
if(exists)return;
|
|
879
|
-
var link=document.createElement('link');
|
|
880
|
-
link.setAttribute('data-css','generated');
|
|
881
|
-
link.setAttribute('rel','stylesheet');
|
|
882
|
-
link.setAttribute('href',href);
|
|
883
|
-
document.head.appendChild(link);
|
|
884
|
-
});
|
|
964
|
+
// Already present ones are MOVED last, not skipped \u2014 see
|
|
965
|
+
// promoteGeneratedCss for why their order is the whole bug.
|
|
966
|
+
promoteGeneratedCss(fragCssHrefs,location.href);
|
|
885
967
|
// Add new page styles
|
|
886
968
|
fragStyles.forEach(function(s){
|
|
887
969
|
var el=document.createElement('style');
|
|
@@ -1000,16 +1082,25 @@ else {
|
|
|
1000
1082
|
if(fragPending.length)Promise.all(fragPending).then(runFragScripts).catch(runFragScripts);
|
|
1001
1083
|
else runFragScripts();
|
|
1002
1084
|
}
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1085
|
+
function startFragSwap(){
|
|
1086
|
+
if(window.stx&&window.stx._cleanupContainer)window.stx._cleanupContainer(currentContent);
|
|
1087
|
+
return new Promise(function(resolve,reject){
|
|
1088
|
+
function completeFragSwap(){
|
|
1089
|
+
try{
|
|
1090
|
+
doFragSwap();
|
|
1091
|
+
resolve(true);
|
|
1092
|
+
}catch(err){reject(err)}
|
|
1093
|
+
}
|
|
1094
|
+
if(runViewTransition(completeFragSwap)){}
|
|
1095
|
+
else{currentContent.style.transition='opacity 0.12s ease-out';currentContent.style.opacity='0';setTimeout(function(){completeFragSwap();currentContent.style.opacity='1';setTimeout(function(){currentContent.style.transition=''},150)},120)}
|
|
1096
|
+
});
|
|
1097
|
+
}
|
|
1098
|
+
// A stylesheet this page has never loaded is fetched BEFORE the content
|
|
1099
|
+
// swaps, or the new markup paints once without its utilities and then
|
|
1100
|
+
// jumps. Cleanup waits with it so the outgoing page stays live meanwhile.
|
|
1101
|
+
// With nothing new to load this runs in the same turn, as it always did.
|
|
1102
|
+
var fragCssReady=preloadGeneratedCss(fragmentCssHrefs(html),location.href);
|
|
1103
|
+
return fragCssReady?fragCssReady.then(startFragSwap):startFragSwap();
|
|
1013
1104
|
}
|
|
1014
1105
|
|
|
1015
1106
|
// Full document mode: parse with DOMParser and extract container content
|
|
@@ -1039,10 +1130,13 @@ else {
|
|
|
1039
1130
|
var newContent=doc.querySelector(containerSel)||doc.querySelector('[data-stx-content]')||doc.querySelector('main');
|
|
1040
1131
|
if(!newContent){location.href=url;return Promise.resolve(false)}
|
|
1041
1132
|
|
|
1042
|
-
//
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1133
|
+
// The destination's generated utility sheets, resolved against the page
|
|
1134
|
+
// being navigated to. Loaded before the swap and moved last during it \u2014
|
|
1135
|
+
// same reasons as the fragment path (promoteGeneratedCss).
|
|
1136
|
+
var docCssBase;
|
|
1137
|
+
try{docCssBase=new URL(url,location.href).href}catch(e){docCssBase=location.href}
|
|
1138
|
+
var docCssHrefs=[];
|
|
1139
|
+
doc.querySelectorAll('head link[data-css][href]').forEach(function(l){docCssHrefs.push(l.getAttribute('href'))});
|
|
1046
1140
|
|
|
1047
1141
|
function doSwap(){
|
|
1048
1142
|
// \u2500\u2500 Swap <head> styles \u2500\u2500
|
|
@@ -1109,6 +1203,9 @@ else {
|
|
|
1109
1203
|
doc.querySelectorAll('head '+linkSel).forEach(function(l){
|
|
1110
1204
|
var href=l.getAttribute('href');
|
|
1111
1205
|
if(!href)return;
|
|
1206
|
+
// Generated utility sheets are not additive-only: promoteGeneratedCss
|
|
1207
|
+
// below also reorders them.
|
|
1208
|
+
if(l.hasAttribute('data-css'))return;
|
|
1112
1209
|
var abs=new URL(href,docBase).href;
|
|
1113
1210
|
if(curLinks[abs])return;
|
|
1114
1211
|
curLinks[abs]=1;
|
|
@@ -1116,6 +1213,9 @@ else {
|
|
|
1116
1213
|
Array.from(l.attributes).forEach(function(a){nl.setAttribute(a.name,a.value)});
|
|
1117
1214
|
document.head.appendChild(nl);
|
|
1118
1215
|
});
|
|
1216
|
+
// After every other stylesheet link, so the destination's complete
|
|
1217
|
+
// utility sheet is last in the cascade.
|
|
1218
|
+
promoteGeneratedCss(docCssHrefs,docBase);
|
|
1119
1219
|
|
|
1120
1220
|
// \u2500\u2500 Swap content \u2500\u2500
|
|
1121
1221
|
// For layout changes: swap the entire <body> to replace layout chrome (nav, footer, etc.)
|
|
@@ -1409,26 +1509,34 @@ else {
|
|
|
1409
1509
|
}
|
|
1410
1510
|
}
|
|
1411
1511
|
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
resolve(true);
|
|
1417
|
-
}catch(err){reject(err)}
|
|
1418
|
-
}
|
|
1419
|
-
if(runViewTransition(completeSwap)){
|
|
1420
|
-
}
|
|
1421
|
-
else {
|
|
1422
|
-
// Fallback fade for browsers without View Transitions API
|
|
1423
|
-
currentContent.style.transition='opacity 0.12s ease-out';
|
|
1424
|
-
currentContent.style.opacity='0';
|
|
1425
|
-
setTimeout(function(){
|
|
1426
|
-
completeSwap();
|
|
1427
|
-
currentContent.style.opacity='1';
|
|
1428
|
-
setTimeout(function(){currentContent.style.transition=''},150);
|
|
1429
|
-
},120);
|
|
1512
|
+
function startSwap(){
|
|
1513
|
+
// Clean up existing signals/effects
|
|
1514
|
+
if(window.stx&&window.stx._cleanupContainer){
|
|
1515
|
+
window.stx._cleanupContainer(currentContent);
|
|
1430
1516
|
}
|
|
1431
|
-
|
|
1517
|
+
return new Promise(function(resolve,reject){
|
|
1518
|
+
function completeSwap(){
|
|
1519
|
+
try{
|
|
1520
|
+
doSwap();
|
|
1521
|
+
resolve(true);
|
|
1522
|
+
}catch(err){reject(err)}
|
|
1523
|
+
}
|
|
1524
|
+
if(runViewTransition(completeSwap)){
|
|
1525
|
+
}
|
|
1526
|
+
else {
|
|
1527
|
+
// Fallback fade for browsers without View Transitions API
|
|
1528
|
+
currentContent.style.transition='opacity 0.12s ease-out';
|
|
1529
|
+
currentContent.style.opacity='0';
|
|
1530
|
+
setTimeout(function(){
|
|
1531
|
+
completeSwap();
|
|
1532
|
+
currentContent.style.opacity='1';
|
|
1533
|
+
setTimeout(function(){currentContent.style.transition=''},150);
|
|
1534
|
+
},120);
|
|
1535
|
+
}
|
|
1536
|
+
});
|
|
1537
|
+
}
|
|
1538
|
+
var docCssReady=preloadGeneratedCss(docCssHrefs,docCssBase);
|
|
1539
|
+
return docCssReady?docCssReady.then(startSwap):startSwap();
|
|
1432
1540
|
}
|
|
1433
1541
|
|
|
1434
1542
|
// \u2500\u2500 Link interception \u2500\u2500
|
|
@@ -1854,5 +1962,5 @@ else {
|
|
|
1854
1962
|
|
|
1855
1963
|
if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);else init();
|
|
1856
1964
|
})();
|
|
1857
|
-
`),L}var L;var be=()=>{};var Ce={};Ae(Ce,{setAppUrl:()=>Z,runMiddleware:()=>ge,route:()=>te,resolveLayoutChain:()=>A,resetRoutes:()=>re,registerMiddleware:()=>R,patternToRegex:()=>v,navigateTo:()=>se,matchRoute:()=>D,loadMiddlewareFromDirectory:()=>de,isNonPageRoutePattern:()=>m,isNonPageRoutePath:()=>_,hasMiddleware:()=>
|
|
1858
|
-
export{g as qu,_ as ru,m as su,x as tu,S as uu,k as vu,v as wu,D as xu,W as yu,A as zu,C as Au,z as Bu,$ as Cu,Y as Du,Z as Eu,Q as Fu,ee as Gu,te as Hu,re as Iu,se as Ju,ie as Ku,
|
|
1965
|
+
`),L}var L;var be=()=>{};var Ce={};Ae(Ce,{setAppUrl:()=>Z,runMiddleware:()=>ge,route:()=>te,resolveLayoutChain:()=>A,resetRoutes:()=>re,registerMiddleware:()=>R,patternToRegex:()=>v,navigateTo:()=>se,matchRoute:()=>D,loadMiddlewareFromDirectory:()=>de,isNonPageRoutePattern:()=>m,isNonPageRoutePath:()=>_,hasMiddleware:()=>ce,getRouterScript:()=>we,getMiddlewareNames:()=>he,getMiddleware:()=>j,generateRouteTypes:()=>x,generateRouteManifest:()=>S,formatRoutes:()=>Y,findErrorPage:()=>$,filePathToPattern:()=>k,extractLayoutMetadata:()=>ye,deriveLayoutGroup:()=>q,defineRoutes:()=>ee,defineRoute:()=>Q,defineMiddleware:()=>le,createStorageManager:()=>X,createServerCookieManager:()=>G,createRouter:()=>z,createRouteLocation:()=>pe,createMiddlewareContext:()=>fe,createClientCookieManager:()=>U,clearMiddleware:()=>ue,bracketPathToRegex:()=>W,abortNavigation:()=>ie,Router:()=>C,NON_PAGE_DIRS:()=>g});var Te=u(()=>{J();M();ae();me();N();ve();F();b();be()});
|
|
1966
|
+
export{g as qu,_ as ru,m as su,x as tu,S as uu,k as vu,v as wu,D as xu,W as yu,A as zu,C as Au,z as Bu,$ as Cu,Y as Du,Z as Eu,Q as Fu,ee as Gu,te as Hu,re as Iu,se as Ju,ie as Ku,le as Lu,G as Mu,U as Nu,X as Ou,R as Pu,j as Qu,ce as Ru,ue as Su,he as Tu,de as Uu,pe as Vu,fe as Wu,ge as Xu,q as Yu,ye as Zu,ve as _u,we as $u,Ce as av,Te as bv};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Oj as a,Pj as b,Qj as c,Rj as d,Sj as e,Tj as f,Uj as g,Vj as h,Wj as i,Xj as j,Yj as k}from"./chunk-
|
|
2
|
+
import{Oj as a,Pj as b,Qj as c,Rj as d,Sj as e,Tj as f,Uj as g,Vj as h,Wj as i,Xj as j,Yj as k}from"./chunk-5ygw1kzd.js";import"./chunk-w6d78tbf.js";import"./chunk-kzt0ycg7.js";import"./chunk-r2pck10q.js";import"./chunk-278ay77z.js";import"./chunk-fq5d2r74.js";import"./chunk-ant3p5v8.js";import"./chunk-t7jv48p8.js";import"./chunk-bf4xr43a.js";import"./chunk-n3kmd544.js";import"./chunk-c1rwzz7v.js";import"./chunk-wzb9q4ta.js";import"./chunk-ncnmb3kq.js";import"./chunk-qsgd6bvq.js";import"./chunk-0jznnssx.js";import"./chunk-vqq5zjbg.js";export{a as templateCache,b as readFileCached,d as invalidateFileCacheByDir,c as invalidateFileCache,k as hashFilePath,f as getCachedSignalsRuntime,g as getCachedRouterScript,h as clearDevCaches,i as checkCache,j as cacheTemplate,e as __setSignalsGeneratorsForTest};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Yi as a,Zi as b}from"./chunk-
|
|
2
|
+
import{Yi as a,Zi as b}from"./chunk-hmzf7jey.js";import"./chunk-efr3ejqt.js";import"./chunk-mf4akzqj.js";import"./chunk-w6d78tbf.js";import"./chunk-kzt0ycg7.js";import"./chunk-r2pck10q.js";import"./chunk-278ay77z.js";import"./chunk-fq5d2r74.js";import"./chunk-ant3p5v8.js";import"./chunk-t7jv48p8.js";import"./chunk-bf4xr43a.js";import"./chunk-n3kmd544.js";import"./chunk-c1rwzz7v.js";import"./chunk-wzb9q4ta.js";import"./chunk-ncnmb3kq.js";import"./chunk-qsgd6bvq.js";import"./chunk-0jznnssx.js";import"./chunk-vqq5zjbg.js";export{a as getStoreScript,b as clearStoreCache};
|
|
@@ -11,7 +11,7 @@ catch (e) {
|
|
|
11
11
|
}
|
|
12
12
|
throw e;
|
|
13
13
|
}
|
|
14
|
-
`),Z.set(V,I)}return I(...j)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:U,context:J.slice()});return U}clear(){this.pool.length=0,this.fnCache.clear()}}var uJ=new qJ;class UJ{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(Q){this.enabled=Q}isEnabled(){return this.enabled}setBudget(Q,J){this.budgets.set(Q,{warnThreshold:0.8,action:"warn",...J})}setBudgets(Q){for(let[J,Y]of Object.entries(Q))this.setBudget(J,Y)}removeBudget(Q){this.budgets.delete(Q)}getBudgets(){let Q={};for(let[J,Y]of this.budgets.entries())Q[J]=Y;return Q}onViolation(Q){this.violationHandlers.push(Q)}offViolation(Q){let J=this.violationHandlers.indexOf(Q);if(J!==-1)this.violationHandlers.splice(J,1)}time(Q,J){if(!this.enabled)return J();let Y=performance.now(),$=J(),Z=performance.now()-Y;return this.recordTime(Q,Z),this.checkBudget(Q,Z),$}async timeAsync(Q,J){if(!this.enabled)return J();let Y=performance.now(),$=await J(),Z=performance.now()-Y;return this.recordTime(Q,Z),this.checkBudget(Q,Z),$}checkBudget(Q,J){let Y=this.budgets.get(Q);if(!Y)return;let $=J/Y.maxTime*100,Z=Y.warnThreshold!==void 0?J>=Y.maxTime*Y.warnThreshold&&J<Y.maxTime:!1,q=J>=Y.maxTime;if(!Z&&!q)return;let U={label:Q,actualTime:J,budgetTime:Y.maxTime,exceedancePercent:$,timestamp:new Date,isWarning:Z};this.violations.push(U);while(this.violations.length>this.maxViolations)this.violations.shift();for(let F of this.violationHandlers)try{F(U)}catch{}let j=Z?`[Performance Warning] "${Q}" took ${J.toFixed(2)}ms (${$.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${Q}" took ${J.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${($-100).toFixed(1)}%)`;switch(Y.action){case"log":console.log(j);break;case"warn":console.warn(j);break;case"error":console.error(j);break;case"throw":if(q)throw Error(j);else console.warn(j);break}}recordTime(Q,J){let Y=this.metrics.get(Q);if(Y)Y.count++,Y.totalTime+=J,Y.maxTime=Math.max(Y.maxTime,J),Y.minTime=Math.min(Y.minTime,J);else this.metrics.set(Q,{count:1,totalTime:J,maxTime:J,minTime:J})}getStats(Q){if(Q){let Y=this.metrics.get(Q);if(!Y)return{};let $=this.budgets.get(Q);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:$?.maxTime,budgetUtilization:$?Y.totalTime/Y.count/$.maxTime*100:void 0}}let J={};for(let[Y,$]of this.metrics.entries()){let Z=this.budgets.get(Y);J[Y]={count:$.count,avgTime:$.totalTime/$.count,totalTime:$.totalTime,maxTime:$.maxTime,minTime:$.minTime,budget:Z?.maxTime,budgetUtilization:Z?$.totalTime/$.count/Z.maxTime*100:void 0}}return J}getViolations(Q){if(Q)return this.violations.filter((J)=>J.label===Q);return[...this.violations]}getViolationStats(){let Q={},J=0,Y=0;for(let $ of this.violations)if(Q[$.label]=(Q[$.label]||0)+1,$.isWarning)J++;else Y++;return{total:this.violations.length,byLabel:Q,warnings:J,errors:Y}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var d=null;function HJ(){if(!d)d=new UJ;return d}var dJ=new Proxy({},{get(Q,J){return HJ()[J]}});var WJ=[];function jJ(Q){let J=new h(Q);return WJ.push(J),J}function lJ(){for(let Q of WJ)Q.clear()}function i(Q,...J){return`${J.map((Y)=>String(Y??"")).join("\x00")}\x00${Q.length}\x00${Bun.hash(Q)}`}function nJ(Q){let J=[];for(let Y of new Set(Q))try{J.push({path:Y,mtimeMs:OJ.statSync(Y).mtimeMs})}catch{}return J}function oJ(Q){for(let J of Q)try{if(OJ.statSync(J.path).mtimeMs!==J.mtimeMs)return!1}catch{return!1}return!0}var N=null,l=!1,X=null,M="",w=!1,NJ=256,_=new Map,z=new Map,H=null,E=null;function x(Q){return Bun.hash(Q).toString(16).padStart(16,"0").slice(0,16)}function c(Q,J){if(_.has(Q))_.delete(Q);else if(_.size>=NJ)_.delete(_.keys().next().value);_.set(Q,J)}function TJ(Q){let J=x(Q);if(z.has(J))z.delete(J);else if(z.size>=NJ)z.delete(z.keys().next().value);return z.set(J,Q),J}function YQ(Q){let J=z.get(Q);if(J===void 0)return;return z.delete(Q),z.set(Q,J),J}async function BJ(Q){if(!H)return null;try{let J=Bun.file(O.join(H,`cw-${x(Q)}.css`));if(!await J.exists())return null;return await J.text()}catch{return null}}async function wJ(Q,J){if(!H)return;try{if(!fs.existsSync(H))fs.mkdirSync(H,{recursive:!0});await Bun.write(O.join(H,`cw-${x(Q)}.css`),J)}catch{}}async function GJ(Q){try{let J=await import(Q);if(J&&J.CSSGenerator)return{CSSGenerator:J.CSSGenerator,config:J.config,build:J.build,defaultConfig:J.defaultConfig,extractClasses:J.extractClasses}}catch{}return null}var KJ=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],RJ=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function PJ(){let Q=[],J=process.cwd();while(J!==O.dirname(J)){for(let Y of["node_modules","pantry"])for(let $ of KJ)Q.push(O.join(J,Y,...$));J=O.dirname(J)}return Q}function DJ(){let Q=[],J=process.env.HOME||process.env.USERPROFILE||"",Y=[J&&O.join(J,"Code","Tools","ts-css"),J&&O.join(J,"Code","Tools","crosswind"),J&&O.join(J,"repos","stacks-org","ts-css"),J&&O.join(J,"repos","stacks-org","crosswind"),O.join(process.cwd(),"..","ts-css"),O.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let $ of Y)Q.push(O.join($,"packages","toolkit","dist","engine","index.js")),Q.push(O.join($,"packages","toolkit","src","engine","index.ts"));if(J)Q.push(O.join(J,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return Q}async function zJ(){if(l)return N;l=!0;try{let Q=async(Z)=>{for(let q of Z){if(!await Bun.file(q).exists())continue;let U=await GJ(q);if(U){if(!process.env.STACKS_DEV_QUIET)console.log(`${W.green}[ts-css]${W.reset} CSS engine loaded from ${O.dirname(O.dirname(q))}`);return U}}return null};if(process.env.CROSSWIND_SRC){let Z=O.resolve(process.env.CROSSWIND_SRC),q=await Q([Z]);if(!q)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${Z}`);return N=q,N}let J=await Q(PJ());if(J)return N=J,N;let Y=RJ;for(let Z of Y){let q=await GJ(Z);if(q){if(N=q,!process.env.STACKS_DEV_QUIET)console.log(`${W.green}[ts-css]${W.reset} CSS engine loaded`);return N}}let $=await Q(DJ());if($)return N=$,N;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${W.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${W.reset}`),console.warn(`${W.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${W.reset}`),null}}function $Q(){n.clear(),N=null,l=!1,X=null,M="",_.clear(),z.clear(),E=null}var XJ=!1;async function AJ(Q){try{let J=FJ({name:"css",cwd:Q})?"css":FJ({name:"crosswind",cwd:Q})?"crosswind":null;if(!J)return null;if(J==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!XJ)XJ=!0,console.warn(`${W.yellow}[ts-css]${W.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:Y}=await import("bunfig"),$=await Y({name:J,cwd:Q,defaultConfig:{},checkEnv:!1,verbose:!1});if(!$?.path||!$.config||Object.keys($.config).length===0)return null;let Z=O.relative(Q,$.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${W.green}[ts-css]${W.reset} Loaded config from ${Z||$.path}`);return $.config}catch(J){if(J instanceof Error&&J.name==="ConfigNotFoundError")return null;return console.warn(`${W.yellow}[ts-css]${W.reset} Failed to load css config:`,J instanceof Error?J.message:J),null}}async function MJ(Q){let J=null;try{let{loadStxConfig:Y}=await import("./chunk-dkb0vas3.js"),$=await Y(Q);if($.css)if(typeof $.css==="string"){let Z=O.isAbsolute($.css)?$.css:O.resolve(Q,$.css);if(await Bun.file(Z).exists()){let q=await import(Z);J=q.default||q,console.log(`${W.green}[ts-css]${W.reset} Loaded config from stx.config.ts \u2192 ${$.css}`)}}else{if(J={...$.css,content:$.css.content||[],preflight:$.css.preflight??!0,minify:$.css.minify??!1},$.css.config){let Z=O.isAbsolute($.css.config)?$.css.config:O.resolve(Q,$.css.config);if(await Bun.file(Z).exists()){let q=await import(Z);J={...q.default||q,...J}}}console.log(`${W.green}[ts-css]${W.reset} Using inline CSS config from stx.config.ts`)}}catch{}return J||await AJ(Q)}function EJ(Q){try{let J=new WeakSet;return x(JSON.stringify(Q??{},(Y,$)=>{if(typeof $==="function")return`[fn]${String($)}`;if(typeof $==="object"&&$!==null){if(J.has($))return"[circular]";J.add($)}return $})??"")}catch{return"unhashable"}}async function SJ(Q){if(w)return M;w=!0;try{let J=await zJ();if(!J||!J.build)return w=!1,"";if(!X)X=await AJ(Q);if(!X)return w=!1,"";let Y=J.defaultConfig?.theme||{},$=X.theme||{},Z={...J.defaultConfig,...X,theme:{...Y,...$,extend:{...Y.extend||{},...$.extend||{}}}},q=performance.now(),U=await J.build(Z),j=performance.now()-q;if(M=U.css,console.log(`${W.cyan}[ts-css]${W.reset} Built ${U.classes.size} classes in ${j.toFixed(1)}ms`),Z.output){let F=O.isAbsolute(Z.output)?Z.output:O.join(Q,Z.output),V=O.dirname(F);if(!fs.existsSync(V))fs.mkdirSync(V,{recursive:!0});await Bun.write(F,U.css)}return w=!1,U.css}catch(J){return console.error(`${W.red}[ts-css]${W.reset} Build error:`,J),w=!1,M}}async function ZQ(Q){X=null,await SJ(Q)}function qQ(){return M}function vJ(Q){let J=new Set,Y=/class\s*=\s*["']([^"']+)["']/gi,$=Y.exec(Q);while($!==null){for(let U of $[1].split(/\s+/))if(U.trim())J.add(U.trim());$=Y.exec(Q)}let Z=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,q=Z.exec(Q);while(q!==null){let U=q[1].match(/'([^']+)'/g);if(U){for(let j of U)for(let F of j.slice(1,-1).split(/\s+/))if(F.trim())J.add(F.trim())}q=Z.exec(Q)}return J}var n=jJ(64);async function xJ(Q,J){let Y=n.get(i(Q,J,E));if(Y!==void 0)return Y;let $=await kJ(Q,J);if($)n.set(i(Q,J,E),$);return $}async function kJ(Q,J){try{let Y=await zJ();if(!Y)return"";let $=typeof Y.extractClasses==="function"?Y.extractClasses(Q):vJ(Q);if($.size===0)return"";let Z=J?O.resolve(J):process.cwd();if(!H)H=IJ(Z,"cache");let q=[...$].sort().join(" "),U=`${E||"default"}::${q}`,j=_.get(U);if(j!==void 0)return c(U,j),j;let F=await BJ(U);if(F!==null)return c(U,F),F;if(!X)X=await MJ(Z),E=EJ(X);let V=Y.defaultConfig||Y.config,I=X||{},L=ZJ(V,I),{safelist:T,includePreflight:K,minify:k,tokenCSS:LJ}=L,o=L.config,R=new Y.CSSGenerator(o);for(let G of T)R.generate(G);for(let G of $)R.generate(G);let A=R.toCSS(K,k),r=o.shortcuts||I.shortcuts||{};for(let[G,b]of Object.entries(r)){if(!$.has(G)&&!T.includes(G))continue;let y=b.split(/\s+/).filter(Boolean);for(let D of y)R.generate(D)}A=R.toCSS(K,k);let P=A.split(`
|
|
14
|
+
`),Z.set(V,I)}return I(...j)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:U,context:J.slice()});return U}clear(){this.pool.length=0,this.fnCache.clear()}}var uJ=new qJ;class UJ{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(Q){this.enabled=Q}isEnabled(){return this.enabled}setBudget(Q,J){this.budgets.set(Q,{warnThreshold:0.8,action:"warn",...J})}setBudgets(Q){for(let[J,Y]of Object.entries(Q))this.setBudget(J,Y)}removeBudget(Q){this.budgets.delete(Q)}getBudgets(){let Q={};for(let[J,Y]of this.budgets.entries())Q[J]=Y;return Q}onViolation(Q){this.violationHandlers.push(Q)}offViolation(Q){let J=this.violationHandlers.indexOf(Q);if(J!==-1)this.violationHandlers.splice(J,1)}time(Q,J){if(!this.enabled)return J();let Y=performance.now(),$=J(),Z=performance.now()-Y;return this.recordTime(Q,Z),this.checkBudget(Q,Z),$}async timeAsync(Q,J){if(!this.enabled)return J();let Y=performance.now(),$=await J(),Z=performance.now()-Y;return this.recordTime(Q,Z),this.checkBudget(Q,Z),$}checkBudget(Q,J){let Y=this.budgets.get(Q);if(!Y)return;let $=J/Y.maxTime*100,Z=Y.warnThreshold!==void 0?J>=Y.maxTime*Y.warnThreshold&&J<Y.maxTime:!1,q=J>=Y.maxTime;if(!Z&&!q)return;let U={label:Q,actualTime:J,budgetTime:Y.maxTime,exceedancePercent:$,timestamp:new Date,isWarning:Z};this.violations.push(U);while(this.violations.length>this.maxViolations)this.violations.shift();for(let F of this.violationHandlers)try{F(U)}catch{}let j=Z?`[Performance Warning] "${Q}" took ${J.toFixed(2)}ms (${$.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${Q}" took ${J.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${($-100).toFixed(1)}%)`;switch(Y.action){case"log":console.log(j);break;case"warn":console.warn(j);break;case"error":console.error(j);break;case"throw":if(q)throw Error(j);else console.warn(j);break}}recordTime(Q,J){let Y=this.metrics.get(Q);if(Y)Y.count++,Y.totalTime+=J,Y.maxTime=Math.max(Y.maxTime,J),Y.minTime=Math.min(Y.minTime,J);else this.metrics.set(Q,{count:1,totalTime:J,maxTime:J,minTime:J})}getStats(Q){if(Q){let Y=this.metrics.get(Q);if(!Y)return{};let $=this.budgets.get(Q);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:$?.maxTime,budgetUtilization:$?Y.totalTime/Y.count/$.maxTime*100:void 0}}let J={};for(let[Y,$]of this.metrics.entries()){let Z=this.budgets.get(Y);J[Y]={count:$.count,avgTime:$.totalTime/$.count,totalTime:$.totalTime,maxTime:$.maxTime,minTime:$.minTime,budget:Z?.maxTime,budgetUtilization:Z?$.totalTime/$.count/Z.maxTime*100:void 0}}return J}getViolations(Q){if(Q)return this.violations.filter((J)=>J.label===Q);return[...this.violations]}getViolationStats(){let Q={},J=0,Y=0;for(let $ of this.violations)if(Q[$.label]=(Q[$.label]||0)+1,$.isWarning)J++;else Y++;return{total:this.violations.length,byLabel:Q,warnings:J,errors:Y}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var d=null;function HJ(){if(!d)d=new UJ;return d}var dJ=new Proxy({},{get(Q,J){return HJ()[J]}});var WJ=[];function jJ(Q){let J=new h(Q);return WJ.push(J),J}function lJ(){for(let Q of WJ)Q.clear()}function i(Q,...J){return`${J.map((Y)=>String(Y??"")).join("\x00")}\x00${Q.length}\x00${Bun.hash(Q)}`}function nJ(Q){let J=[];for(let Y of new Set(Q))try{J.push({path:Y,mtimeMs:OJ.statSync(Y).mtimeMs})}catch{}return J}function oJ(Q){for(let J of Q)try{if(OJ.statSync(J.path).mtimeMs!==J.mtimeMs)return!1}catch{return!1}return!0}var N=null,l=!1,X=null,M="",w=!1,NJ=256,_=new Map,z=new Map,H=null,E=null;function x(Q){return Bun.hash(Q).toString(16).padStart(16,"0").slice(0,16)}function c(Q,J){if(_.has(Q))_.delete(Q);else if(_.size>=NJ)_.delete(_.keys().next().value);_.set(Q,J)}function TJ(Q){let J=x(Q);if(z.has(J))z.delete(J);else if(z.size>=NJ)z.delete(z.keys().next().value);return z.set(J,Q),J}function YQ(Q){let J=z.get(Q);if(J===void 0)return;return z.delete(Q),z.set(Q,J),J}async function BJ(Q){if(!H)return null;try{let J=Bun.file(O.join(H,`cw-${x(Q)}.css`));if(!await J.exists())return null;return await J.text()}catch{return null}}async function wJ(Q,J){if(!H)return;try{if(!fs.existsSync(H))fs.mkdirSync(H,{recursive:!0});await Bun.write(O.join(H,`cw-${x(Q)}.css`),J)}catch{}}async function GJ(Q){try{let J=await import(Q);if(J&&J.CSSGenerator)return{CSSGenerator:J.CSSGenerator,config:J.config,build:J.build,defaultConfig:J.defaultConfig,extractClasses:J.extractClasses}}catch{}return null}var KJ=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],RJ=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function PJ(){let Q=[],J=process.cwd();while(J!==O.dirname(J)){for(let Y of["node_modules","pantry"])for(let $ of KJ)Q.push(O.join(J,Y,...$));J=O.dirname(J)}return Q}function DJ(){let Q=[],J=process.env.HOME||process.env.USERPROFILE||"",Y=[J&&O.join(J,"Code","Tools","ts-css"),J&&O.join(J,"Code","Tools","crosswind"),J&&O.join(J,"repos","stacks-org","ts-css"),J&&O.join(J,"repos","stacks-org","crosswind"),O.join(process.cwd(),"..","ts-css"),O.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let $ of Y)Q.push(O.join($,"packages","toolkit","dist","engine","index.js")),Q.push(O.join($,"packages","toolkit","src","engine","index.ts"));if(J)Q.push(O.join(J,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return Q}async function zJ(){if(l)return N;l=!0;try{let Q=async(Z)=>{for(let q of Z){if(!await Bun.file(q).exists())continue;let U=await GJ(q);if(U){if(!process.env.STACKS_DEV_QUIET)console.log(`${W.green}[ts-css]${W.reset} CSS engine loaded from ${O.dirname(O.dirname(q))}`);return U}}return null};if(process.env.CROSSWIND_SRC){let Z=O.resolve(process.env.CROSSWIND_SRC),q=await Q([Z]);if(!q)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${Z}`);return N=q,N}let J=await Q(PJ());if(J)return N=J,N;let Y=RJ;for(let Z of Y){let q=await GJ(Z);if(q){if(N=q,!process.env.STACKS_DEV_QUIET)console.log(`${W.green}[ts-css]${W.reset} CSS engine loaded`);return N}}let $=await Q(DJ());if($)return N=$,N;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${W.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${W.reset}`),console.warn(`${W.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${W.reset}`),null}}function $Q(){n.clear(),N=null,l=!1,X=null,M="",_.clear(),z.clear(),E=null}var XJ=!1;async function AJ(Q){try{let J=FJ({name:"css",cwd:Q})?"css":FJ({name:"crosswind",cwd:Q})?"crosswind":null;if(!J)return null;if(J==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!XJ)XJ=!0,console.warn(`${W.yellow}[ts-css]${W.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:Y}=await import("bunfig"),$=await Y({name:J,cwd:Q,defaultConfig:{},checkEnv:!1,verbose:!1});if(!$?.path||!$.config||Object.keys($.config).length===0)return null;let Z=O.relative(Q,$.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${W.green}[ts-css]${W.reset} Loaded config from ${Z||$.path}`);return $.config}catch(J){if(J instanceof Error&&J.name==="ConfigNotFoundError")return null;return console.warn(`${W.yellow}[ts-css]${W.reset} Failed to load css config:`,J instanceof Error?J.message:J),null}}async function MJ(Q){let J=null;try{let{loadStxConfig:Y}=await import("./chunk-418g2nh4.js"),$=await Y(Q);if($.css)if(typeof $.css==="string"){let Z=O.isAbsolute($.css)?$.css:O.resolve(Q,$.css);if(await Bun.file(Z).exists()){let q=await import(Z);J=q.default||q,console.log(`${W.green}[ts-css]${W.reset} Loaded config from stx.config.ts \u2192 ${$.css}`)}}else{if(J={...$.css,content:$.css.content||[],preflight:$.css.preflight??!0,minify:$.css.minify??!1},$.css.config){let Z=O.isAbsolute($.css.config)?$.css.config:O.resolve(Q,$.css.config);if(await Bun.file(Z).exists()){let q=await import(Z);J={...q.default||q,...J}}}console.log(`${W.green}[ts-css]${W.reset} Using inline CSS config from stx.config.ts`)}}catch{}return J||await AJ(Q)}function EJ(Q){try{let J=new WeakSet;return x(JSON.stringify(Q??{},(Y,$)=>{if(typeof $==="function")return`[fn]${String($)}`;if(typeof $==="object"&&$!==null){if(J.has($))return"[circular]";J.add($)}return $})??"")}catch{return"unhashable"}}async function SJ(Q){if(w)return M;w=!0;try{let J=await zJ();if(!J||!J.build)return w=!1,"";if(!X)X=await AJ(Q);if(!X)return w=!1,"";let Y=J.defaultConfig?.theme||{},$=X.theme||{},Z={...J.defaultConfig,...X,theme:{...Y,...$,extend:{...Y.extend||{},...$.extend||{}}}},q=performance.now(),U=await J.build(Z),j=performance.now()-q;if(M=U.css,console.log(`${W.cyan}[ts-css]${W.reset} Built ${U.classes.size} classes in ${j.toFixed(1)}ms`),Z.output){let F=O.isAbsolute(Z.output)?Z.output:O.join(Q,Z.output),V=O.dirname(F);if(!fs.existsSync(V))fs.mkdirSync(V,{recursive:!0});await Bun.write(F,U.css)}return w=!1,U.css}catch(J){return console.error(`${W.red}[ts-css]${W.reset} Build error:`,J),w=!1,M}}async function ZQ(Q){X=null,await SJ(Q)}function qQ(){return M}function vJ(Q){let J=new Set,Y=/class\s*=\s*["']([^"']+)["']/gi,$=Y.exec(Q);while($!==null){for(let U of $[1].split(/\s+/))if(U.trim())J.add(U.trim());$=Y.exec(Q)}let Z=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,q=Z.exec(Q);while(q!==null){let U=q[1].match(/'([^']+)'/g);if(U){for(let j of U)for(let F of j.slice(1,-1).split(/\s+/))if(F.trim())J.add(F.trim())}q=Z.exec(Q)}return J}var n=jJ(64);async function xJ(Q,J){let Y=n.get(i(Q,J,E));if(Y!==void 0)return Y;let $=await kJ(Q,J);if($)n.set(i(Q,J,E),$);return $}async function kJ(Q,J){try{let Y=await zJ();if(!Y)return"";let $=typeof Y.extractClasses==="function"?Y.extractClasses(Q):vJ(Q);if($.size===0)return"";let Z=J?O.resolve(J):process.cwd();if(!H)H=IJ(Z,"cache");let q=[...$].sort().join(" "),U=`${E||"default"}::${q}`,j=_.get(U);if(j!==void 0)return c(U,j),j;let F=await BJ(U);if(F!==null)return c(U,F),F;if(!X)X=await MJ(Z),E=EJ(X);let V=Y.defaultConfig||Y.config,I=X||{},L=ZJ(V,I),{safelist:T,includePreflight:K,minify:k,tokenCSS:LJ}=L,o=L.config,R=new Y.CSSGenerator(o);for(let G of T)R.generate(G);for(let G of $)R.generate(G);let A=R.toCSS(K,k),r=o.shortcuts||I.shortcuts||{};for(let[G,b]of Object.entries(r)){if(!$.has(G)&&!T.includes(G))continue;let y=b.split(/\s+/).filter(Boolean);for(let D of y)R.generate(D)}A=R.toCSS(K,k);let P=A.split(`
|
|
15
15
|
`);for(let[G,b]of Object.entries(r)){if(!$.has(G)&&!T.includes(G))continue;let y=b.split(/\s+/).filter(Boolean),D=[],f=[];for(let C of y){let a=C.startsWith("dark:"),s=`.${(a?C.slice(5):C).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let S=0;S<P.length;S++){let t=P[S].trim();if(t===`${s} {`||t.startsWith(`${s} {`)){let v=S,e="";while(v<P.length){if(e+=P[v],P[v].includes("}"))break;v++}let p=e.match(/\{([^}]+)\}/);if(p)if(a)f.push(p[1].trim());else D.push(p[1].trim());break}}}if(D.length)A+=`
|
|
16
16
|
.${G} { ${D.join(" ")} }`;if(f.length)A+=`
|
|
17
17
|
@media (prefers-color-scheme: dark) { .dark .${G} { ${f.join(" ")} } }`}return A=LJ+A,c(U,A),wJ(U,A),A}catch(Y){return console.warn("Failed to generate Css CSS:",Y),""}}async function UQ(Q,J,Y=!1){let $=await xJ(Q,J);if(!$)return Q;let Z=Y?`<link data-css="generated" rel="stylesheet" href="/_stx/css.${TJ($)}.css">`:`<style data-css="generated">
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ip as X,vm as W}from"./chunk-
|
|
2
|
+
import{Ip as X,vm as W}from"./chunk-w6d78tbf.js";import V from"fs";import M from"path";import*as Y from"readline";var j={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m"},Q={help:{description:"Show available commands",usage:"help [command]",handler:async(q,z)=>{if(q[0]&&Q[q[0]]){let A=Q[q[0]];console.log(`
|
|
3
3
|
${j.bold}${q[0]}${j.reset} - ${A.description}`),console.log(` Usage: ${j.cyan}${A.usage}${j.reset}
|
|
4
4
|
`)}else{console.log(`
|
|
5
5
|
${j.bold}Available Commands:${j.reset}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Do as a,Eo as b,Fo as c,Go as d,Ho as e,Io as f}from"./chunk-
|
|
2
|
+
import{Do as a,Eo as b,Fo as c,Go as d,Ho as e,Io as f}from"./chunk-w6d78tbf.js";import"./chunk-kzt0ycg7.js";import"./chunk-r2pck10q.js";import"./chunk-278ay77z.js";import"./chunk-fq5d2r74.js";import"./chunk-ant3p5v8.js";import"./chunk-t7jv48p8.js";import"./chunk-bf4xr43a.js";import"./chunk-n3kmd544.js";import"./chunk-c1rwzz7v.js";import"./chunk-wzb9q4ta.js";import"./chunk-ncnmb3kq.js";import"./chunk-qsgd6bvq.js";import"./chunk-0jznnssx.js";import"./chunk-vqq5zjbg.js";export{f as processStackReplacements,e as processStackPushDirectives,d as processIncludes,a as partialsCache,b as onceStore,c as clearOnceStore};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{bj as v,cj as F,dj as P}from"./chunk-efr3ejqt.js";import{Qp as B,Sl as K,fr as S}from"./chunk-
|
|
2
|
+
import{bj as v,cj as F,dj as P}from"./chunk-efr3ejqt.js";import{Qp as B,Sl as K,fr as S}from"./chunk-w6d78tbf.js";import{Wt as _,Xt as x}from"./chunk-c1rwzz7v.js";import{$t as N}from"./chunk-ncnmb3kq.js";import U from"path";var j=new Map,E=new Map,h=["composables","functions"];function T(Q){let z=U.basename(Q,".ts");return z==="index"||z==="types"||Q.endsWith(".d.ts")}async function D(Q){if(Q)return U.resolve(Q);let z=`<default>:${process.cwd()}`,Y=E.get(z);if(Y!==void 0)return Y;let J=await u();if(J!==null)E.set(z,J);return J}async function u(){let Q=await S(),z=Q.root||process.cwd(),Y=Q.composablesDir;if(Y)return U.resolve(z,Y);for(let J of h){let V=U.resolve(z,J);try{let W=new Bun.Glob("**/*.ts");for await(let Z of W.scan({cwd:V,absolute:!0}))if(!T(Z))return V}catch{}}return null}async function i(Q){let z=await D(Q);if(!z)return[];let Y=[];try{let W=new Bun.Glob("**/*.ts");for await(let Z of W.scan({cwd:z,absolute:!0}))if(!T(Z))Y.push(Z)}catch{return[]}Y.sort();let J=B({loader:"ts",target:"browser",define:K()}),V=[];for(let W of Y)try{let Z=await Bun.file(W).text(),$=J.scan(Z).exports.filter((G)=>G!=="default");if($.length>0)V.push({file:W,names:$})}catch{}return V}function f(Q,z){return new RegExp(`\\b${z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(Q)}function p(Q,z,Y){let J=new Map;for(let{file:$,names:G}of Q)for(let O of G)if(!J.has(O))J.set(O,$);let V=($)=>{let G=[];for(let[O,L]of J)if(f($,O))G.push(L);return G},W=new Set,Z=Y.flatMap(V);while(Z.length>0){let $=[];for(let G of Z){if(W.has(G))continue;W.add(G);for(let O of V(z.get(G)??""))if(!W.has(O))$.push(O)}Z=$}return W}async function o(Q,z,Y){let J=await D(Q);if(!J)return null;let V=[];try{let q=new Bun.Glob("**/*.ts");for await(let H of q.scan({cwd:J,absolute:!0})){if(T(H))continue;V.push(H)}}catch{return P(j,J,"",""),null}let W=v(V);if(V.length===0)return P(j,J,W,""),null;V.sort();let Z=B({loader:"ts",target:"browser",define:K()}),$=new Map,G=[];for(let q of V)try{let H=await Bun.file(q).text();$.set(q,H);let w=Z.scan(H).exports.filter((X)=>X!=="default");if(w.length>0)G.push({file:q,names:w})}catch{$.set(q,"")}let O=z===void 0?new Set(V):p(G,$,Y?[z,...Y]:[z]);if(O.size===0)return null;let L=V.filter((q)=>O.has(q)),A=`${J}\x00${L.join("\x00")}`,I=F(j,A,W);if(I!==void 0)return I||null;let M=[],R=new Set,k=new Set;for(let q of L)try{let H=$.get(q)??await Bun.file(q).text(),w=U.basename(q,".ts");for(let X of H.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(X[1])k.add(X[1]);try{for(let X of Z.scan(H).exports)if(X!=="default")R.add(X)}catch{}H=_(H),H=x(H),H=H.replace(/^export\s+(default\s+)?/gm,""),H=Z.transformSync(H),M.push(`// Composable: ${w}
|
|
3
3
|
${H.trim()}`)}catch(H){console.warn(`[stx] Failed to load composable ${q}:`,H)}if(M.length===0||R.size===0)return P(j,A,W,""),null;let b=[...R].map((q)=>` try { __c[${JSON.stringify(q)}] = ${q}; } catch (e) {}`).join(`
|
|
4
4
|
`),g=JSON.stringify([...R]),y=M.join(`
|
|
5
5
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import{lv as H}from"./chunk-vqq5zjbg.js";import P from"path";var $=/__stxModules\["((?:[^"\\]|\\.)*)"\]/g;function G(...v){let w=new Set;for(let q of v){if(!q||!q.includes("__stxModules["))continue;for(let z of q.matchAll($))try{w.add(JSON.parse(`"${z[1]}"`))}catch{}}return[...w].sort()}async function T(v,w={}){if(v.length===0)return null;let q=process.cwd(),z=[],J=[];v.forEach((j,X)=>{let Z=j.startsWith("npm:")?j.slice(4):P.resolve(q,j),N=`__stxRegistered${X}`,O=JSON.stringify(j);z.push(`import * as ${N} from ${JSON.stringify(Z)};`),J.push(`if (!globalThis.__stxModules[${O}]) globalThis.__stxModules[${O}] = ${N};`)});let L=[...z,"globalThis.__stxModules = globalThis.__stxModules || {};",...J].join(`
|
|
3
|
-
`),B;try{let{bundleClientScript:j}=await import("./chunk-
|
|
3
|
+
`),B;try{let{bundleClientScript:j}=await import("./chunk-mqempwb6.js");B=await j(L,P.join(q,".stx-module-registry.ts"),{projectRoot:q,minify:w.minify,externalizeUserModules:!1})}catch(j){return console.warn("[stx] could not build the page module registry (#1957):",j),null}let{transformAutoImports:Q,generateAutoImportDestructuring:U}=await import("./chunk-msb45j2n.js"),F=Q(B),V=U(F.stxImports,F.browserImports),{transformStoreImports:W}=await import("./chunk-cjf28904.js");B=W(F.code);let M=JSON.stringify(new Bun.CryptoHasher("md5").update(L).digest("hex").slice(0,12));return[";(function() {"," var __stxBundles = globalThis.__stxModuleBundles || (globalThis.__stxModuleBundles = {});",` if (__stxBundles[${M}]) return;`,` __stxBundles[${M}] = true;`,V,B,"})();"].join(`
|
|
4
4
|
`)}export{G as registeredModuleIdsIn,T as buildModuleRegistryScript};
|