@stacksjs/stx 0.2.250 → 0.2.252
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-3rs2etjv.js → chunk-0na9rn3e.js} +1 -1
- package/dist/{chunk-ypgmke1m.js → chunk-0sj6nj4d.js} +1 -1
- package/dist/{chunk-8g7acryv.js → chunk-1b1fwf1e.js} +1 -1
- package/dist/{chunk-2tdg6dkd.js → chunk-1b3pey4n.js} +1 -1
- package/dist/{chunk-e27qwbj8.js → chunk-3ej56pch.js} +1 -1
- package/dist/{chunk-pj5ahn52.js → chunk-4zpmg5ct.js} +1 -1
- package/dist/{chunk-j5wp00fs.js → chunk-5qy49drk.js} +1 -1
- package/dist/{chunk-17zb5sdn.js → chunk-6jay0ejd.js} +1 -1
- package/dist/{chunk-yzjrtq3k.js → chunk-7hrttzad.js} +16 -16
- package/dist/{chunk-0thzzef1.js → chunk-81e0mjtz.js} +1 -1
- package/dist/{chunk-ys59ganx.js → chunk-95t702td.js} +1 -1
- package/dist/{chunk-51wgz0xg.js → chunk-9dagx91q.js} +1 -1
- package/dist/{chunk-7tbepz6d.js → chunk-9qn3f7tp.js} +98 -7
- package/dist/{chunk-de9r2yhn.js → chunk-a8yc5svy.js} +1 -1
- package/dist/chunk-ay40p1k6.js +2 -0
- package/dist/{chunk-t60sskkr.js → chunk-bmxqkast.js} +46 -5
- package/dist/{chunk-tv59qkyk.js → chunk-bs3n1zt2.js} +1 -1
- package/dist/{chunk-dm3wagpw.js → chunk-c06970qq.js} +9 -9
- package/dist/{chunk-hsmd7q0n.js → chunk-c6k8yfwa.js} +1 -1
- package/dist/{chunk-xyxh8nwd.js → chunk-cg6v2ff1.js} +1 -1
- package/dist/{chunk-59bmhwch.js → chunk-cjk6zcgz.js} +1 -1
- package/dist/{chunk-ettkbnvm.js → chunk-ck11f0w4.js} +1 -1
- package/dist/{chunk-2rq32e9t.js → chunk-cxvmws79.js} +1 -1
- package/dist/{chunk-eez474bd.js → chunk-dde4fvwg.js} +1 -1
- package/dist/{chunk-5864xxx9.js → chunk-djkwdpcb.js} +1 -1
- package/dist/{chunk-w4hpp2q7.js → chunk-dkrgh8gv.js} +1 -1
- package/dist/{chunk-fqy71v2e.js → chunk-f1m5a48z.js} +1 -1
- package/dist/{chunk-dadn4tgg.js → chunk-f7ye3z1y.js} +1 -1
- package/dist/{chunk-cwfd9z9w.js → chunk-fcgewg4k.js} +1 -1
- package/dist/{chunk-2xkqwatw.js → chunk-fmj97bm8.js} +2 -2
- package/dist/{chunk-kpf2c85z.js → chunk-gn21yx6c.js} +1 -1
- package/dist/{chunk-00qcqjda.js → chunk-h3cvkas0.js} +1 -1
- package/dist/{chunk-8a25zrth.js → chunk-kwz1hy66.js} +1 -1
- package/dist/{chunk-0jdxe23c.js → chunk-m1qf02qz.js} +1 -1
- package/dist/{chunk-zcc9pxva.js → chunk-m8y2hnqk.js} +1 -1
- package/dist/{chunk-z4dffsr3.js → chunk-nm1mh7ay.js} +1 -1
- package/dist/chunk-nrkkxkzb.js +2 -0
- package/dist/{chunk-rrwrczr5.js → chunk-pctsgktp.js} +1 -1
- package/dist/{chunk-vknx6nvv.js → chunk-pfhm9kh8.js} +1 -1
- package/dist/{chunk-wb34r474.js → chunk-pt25jgqd.js} +1 -1
- package/dist/{chunk-9z5cbn7k.js → chunk-sd0rmt49.js} +1 -1
- package/dist/{chunk-e4pb02w6.js → chunk-t0dq8bsd.js} +1 -1
- package/dist/{chunk-81vzysty.js → chunk-thermrhq.js} +1 -1
- package/dist/{chunk-wqxyrh79.js → chunk-v0tdgxs9.js} +2 -2
- package/dist/{chunk-yhrr7k23.js → chunk-vn7stdg9.js} +1 -1
- package/dist/{chunk-s29q9nt0.js → chunk-xsze8fa2.js} +1 -1
- package/dist/{chunk-5jww9gpz.js → chunk-xw1x7nkg.js} +1 -1
- package/dist/{chunk-vpmw7990.js → chunk-zrhbc7jj.js} +1 -1
- package/dist/cli.js +8 -8
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/pwa.js +1 -1
- package/dist/signals.js +46 -5
- package/dist/ssg.js +2 -2
- package/package.json +5 -5
- package/dist/chunk-9fpaygtf.js +0 -2
- package/dist/chunk-w6mbb5qk.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Rf as p}from"./chunk-
|
|
2
|
+
import{Rf as p}from"./chunk-95t702td.js";import{Hg as a,Jg as JF,Kg as ZF,Lg as qF}from"./chunk-m1qf02qz.js";import{sj as C,tj as D}from"./chunk-bmxqkast.js";import{Ek as QF,Fk as XF,Gk as YF}from"./chunk-58f0mthg.js";import{Cq as FF,Gq as c,Om as u,ap as o,bs as n,ds as N,fm as l,hm as d,hq as e,vq as t}from"./chunk-7hrttzad.js";import{$s as r}from"./chunk-pctsgktp.js";import{Eu as S,Gu as WF}from"./chunk-9qn3f7tp.js";import G from"fs";import Z from"path";import{createHash as $F}from"crypto";WF();function g(J){return $F("sha256").update(J).digest("hex").slice(0,8)}function f(J=!1){let q=J?D():C(),z=g(q);return{content:q,filename:`runtime.${z}.js`,hash:z}}function m(){let J=S(),q=g(J);return{content:J,filename:`router.${q}.js`,hash:q}}function UF(J){return{runtimeTag:J.runtime?`<script src="/__stx/${J.runtime.filename}"></script>`:"",routerTag:J.router?`<script src="/__stx/${J.router.filename}"></script>`:"",cssTag:J.css?`<link rel="stylesheet" href="/__stx/${J.css.filename}">`:""}}import h from"path";import{createHash as GF}from"crypto";function VF(J={}){let q=new Set;return{context:new Proxy(J,{get(Q,X){if(X in Q)return Q[X];if(typeof X==="string"&&!X.startsWith("__"))q.add(X);return},has(Q,X){if(X in Q)return!0;if(typeof X==="string"&&!X.startsWith("__"))q.add(X);return!1}}),accessedKeys:q}}async function i(J,q,z={}){let Q=h.resolve(J),X=await Bun.file(Q).text(),I=GF("sha256").update(X).digest("hex").slice(0,16);l();let K={};try{K=await N()}catch{}let B=[],V=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,k;while((k=V.exec(X))!==null){let $=k[1];if(/\bserver\b/.test($))B.push(k[2])}let W=new Set(B.flatMap(($)=>p($))),{context:E}=VF({__filename:Q,__dirname:h.dirname(Q),__stx_serverDeclared:W}),L=new Set,_={...n,...K,...z,buildMode:"compile",strict:!1},w=await c(X,E,Q,_,L),U=a(w),H=d();return{route:q,sourceFile:J,html:w,fragment:U,placeholders:H,hasServerScripts:B.length>0,serverScriptContent:B,dependencies:Array.from(L),contentHash:I,status:u(X),streamTemplates:E.__streamTemplates}}var kF=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function s(J,q){let z=0,Q=0;if(!G.existsSync(J))return{copied:z,bytes:Q};G.mkdirSync(q,{recursive:!0});function X(I,K){let B=G.readdirSync(I,{withFileTypes:!0});for(let V of B){if(kF.has(V.name))continue;let k=Z.join(I,V.name),W=Z.join(K,V.name);if(V.isDirectory())G.mkdirSync(W,{recursive:!0}),X(k,W);else if(V.isFile()){if(G.existsSync(W))continue;G.copyFileSync(k,W),z++,Q+=G.statSync(W).size}}}return X(J,q),{copied:z,bytes:Q}}async function lF(J={}){let q=Date.now(),z=Z.resolve(J.root||process.cwd()),Q=Z.resolve(z,J.outputDir||".output");console.log("[stx build] Starting production build...");let X={};try{X=await N()}catch{}let I=J.componentsDir??X.componentsDir??"components",K=J.partialsDir??X.partialsDir??"partials",B=J.layoutsDir??X.layoutsDir??"layouts",V=J.publicDir??X.publicDir??"public",k=X.app?.head||{},W=X.app?.colorMode,E=X.router?.container||"main";if(G.existsSync(Q))G.rmSync(Q,{recursive:!0});let L=[Z.join(Q,"public","__stx"),Z.join(Q,"public","assets"),Z.join(Q,"server","pages"),Z.join(Q,"server","fragments")];for(let Y of L)G.mkdirSync(Y,{recursive:!0});console.log("[stx build] Discovering routes...");let _=o(z),w=["components","layouts","partials"],U=_.filter((Y)=>{return!w.some((F)=>Y.pattern.startsWith(`/${F}/`)||Y.pattern===`/${F}`)});console.log(`[stx build] Found ${U.length} page routes (${_.length-U.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let H=f(J.debug),$=m();await Bun.write(Z.join(Q,"public","__stx",H.filename),H.content),await Bun.write(Z.join(Q,"public","__stx",$.filename),$.content),console.log(`[stx build] Runtime: ${H.filename} (${(H.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${$.filename} (${($.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let O=[],j=[];for(let Y of U)try{let F=await i(Y.filePath,Y.pattern,{componentsDir:I,partialsDir:K,layoutsDir:B,debug:J.debug});if(O.push(F),F.html=F.html.replace(/runtime\.__STX_HASH__\.js/g,H.filename).replace(/router\.__STX_HASH__\.js/g,$.filename),F.html=FF(F.html,k,{bodyScripts:[`<script src="/__stx/${$.filename}"></script>`],...W&&{colorMode:W}}),W)F.html=e(F.html,W);if(k.htmlAttrs)F.html=t(F.html,k.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(F.html)){let T=F.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(T&&T[1]){let P=T[1];F.html=F.html.replace(" "+P,""),F.html=F.html.replace(/<body([^>]*)>/,`<body$1 ${P}>`)}}F.html=F.html.replace(/<style data-crosswind="generated">[\s\S]*?<\/style>\s*/g,""),F.html=await r(F.html),F.fragment=JF(F.html,E);let y=Y.pattern==="/"?"index":Y.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),b=Z.join("server","pages",`${y}.compiled.json`),A=Z.join("server","fragments",`${y}.html`);await Bun.write(Z.join(Q,b),JSON.stringify(F,null,2)),await Bun.write(Z.join(Q,A),F.fragment),j.push({pattern:Y.pattern,compiledPath:b,fragmentPath:A,isDynamic:F.hasServerScripts,hasParams:Y.pattern.includes(":")||Y.pattern.includes("[")}),console.log(`[stx build] \u2713 ${Y.pattern}`)}catch(F){console.error(`[stx build] \u2717 ${Y.pattern}:`,F instanceof Error?F.message:F)}let M=Z.resolve(z,V);if(G.existsSync(M)){let{copied:Y,bytes:F}=s(M,Z.join(Q,"public"));if(Y>0)console.log(`[stx build] Copied ${Y} public asset${Y===1?"":"s"} (${(F/1024).toFixed(1)}KB) from ${V}/`)}let v=YF(z);if(v){let{copied:Y,bytes:F}=s(v,Z.join(Q,"public",XF));if(Y>0)console.log(`[stx build] Copied ${Y} asset${Y===1?"":"s"} (${(F/1024).toFixed(1)}KB) from ${QF}/`)}let R={runtime:H.filename,router:$.filename},zF=ZF(j,R,Q);qF(zF,Q);let x=Date.now()-q;return console.log(`
|
|
3
3
|
[stx build] Done in ${x}ms \u2014 ${O.length} pages compiled`),{pageCount:O.length,assets:R,outputDir:Q,duration:x}}
|
|
4
4
|
export{g as Hf,f as If,m as Jf,UF as Kf,i as Lf,lF as Mf};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Gq as k,Il as A,Jl as D,Tm as T,Um as y,Yo as x,_l as B,am as F,bs as w,dp as M,up as R}from"./chunk-
|
|
2
|
+
import{Gq as k,Il as A,Jl as D,Tm as T,Um as y,Yo as x,_l as B,am as F,bs as w,dp as M,up as R}from"./chunk-7hrttzad.js";import{Qu as P}from"./chunk-b9691w0f.js";function b(K){return K.endsWith(".md")||K.endsWith(".markdown")}function C(K){let z=[];_(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let G=[...z];_(/<code\b[^>]*>[\s\S]*?<\/code>/gi,G);function _(J,X){let $;while(($=J.exec(K))!==null){let q=$.index,N=q+$[0].length;if(X?.some((Y)=>q>=Y.start&&N<=Y.end))continue;z.push({start:q,end:N})}}if(z.length===0)return K;z.sort((J,X)=>J.start-X.start);let U="",Q=0;for(let J of z){if(J.start<Q)continue;U+=K.slice(Q,J.start),U+=`@raw${K.slice(J.start,J.end)}@endraw`,Q=J.end}return U+=K.slice(Q),U}async function j(K,z={}){let{data:G,content:_}=A(K),Q=await(z.renderer??((J)=>D(J)))(_);return{html:C(Q),frontmatter:G??{}}}import{dirname as v,resolve as H}from"path";function f(K){let z=K,G=x(K);if(G)z=G.content.trim();let _=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,U=[],Q=[],J=[],X=(N)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(N),$;while(($=_.exec(K))!==null){let N=$[1],Y=$[2],E=$[0],Z=N.includes("server");if(X(Y))J.push(E);else if(Z)Q.push(Y);else U.push(E)}let q=z;{let N=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,Y,E=[];while((Y=N.exec(q))!==null){let Z=Y.index+Y[0].length,L=q.indexOf("</script>",Z);if(L===-1)continue;E.push({start:Y.index,end:L+9}),N.lastIndex=L+9}for(let Z=E.length-1;Z>=0;Z--)q=q.substring(0,E[Z].start)+q.substring(E[Z].end)}for(let N of U)q=q.replace(N,"");return{templateContent:q,serverScripts:Q,clientScripts:U,signalsScripts:J}}function g(K,z){return`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
@@ -14,5 +14,5 @@ ${Q.join(`
|
|
|
14
14
|
`)}`}else{if(G.processClientScripts!==!1&&Q.length>0){let N=X.__stx_event_bindings||[],Y=B(X),Z=(await Promise.all(Q.map(async(V)=>{let W=V.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!W)return V;return await F(W[1],{eventBindings:N,templateContent:q,serverData:Y,filePath:z})}))).join(`
|
|
15
15
|
`);if(q.match(/(<\/body>)/i))q=q.replace(/(<\/body>)/i,`${Z}
|
|
16
16
|
$1`);else q+=`
|
|
17
|
-
${Z}`}q=await M(q)}if(G.wrapInDocument){if(!q.trim().toLowerCase().startsWith("<!doctype")&&!q.trim().toLowerCase().startsWith("<html"))q=g(q,G.title)}if(G.injectCSS)try{let{injectCrosswindCSS:N}=await import("./chunk-
|
|
17
|
+
${Z}`}q=await M(q)}if(G.wrapInDocument){if(!q.trim().toLowerCase().startsWith("<!doctype")&&!q.trim().toLowerCase().startsWith("<html"))q=g(q,G.title)}if(G.injectCSS)try{let{injectCrosswindCSS:N}=await import("./chunk-f7ye3z1y.js");q=await N(q)}catch{}return q}
|
|
18
18
|
export{b as qk,C as rk,j as sk,s as tk,i as uk,I as vk};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ap as a,Bp as b}from"./chunk-
|
|
2
|
+
import{Ap as a,Bp as b}from"./chunk-7hrttzad.js";import"./chunk-vr4ycjqv.js";import"./chunk-cbj5a2tk.js";import"./chunk-fmw1mscr.js";import"./chunk-wfsf3vmh.js";import"./chunk-pctsgktp.js";import"./chunk-q0sgqw4m.js";import"./chunk-ecncwde8.js";import"./chunk-fdd1ccv6.js";import"./chunk-yjrdr27z.js";import"./chunk-rrxm5s7d.js";import"./chunk-9qn3f7tp.js";import"./chunk-zpkdfbyp.js";import"./chunk-b9691w0f.js";export{b as processLoops,a as parseLoopBinding};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Gu as y}from"./chunk-
|
|
2
|
+
import{Gu as y}from"./chunk-9qn3f7tp.js";import N from"fs";import B from"path";var Y="_stx";function L(M){return Bun.hash(M).toString(16).slice(0,8)}function T(M){let C=[],v=(q)=>{for(let g of N.readdirSync(q,{withFileTypes:!0})){let j=B.join(q,g.name);if(g.isDirectory())v(j);else if(g.isFile()&&j.endsWith(".html"))C.push(j)}};if(N.existsSync(M))v(M);return C}var S=[{pattern:/<script\b([^>]*\bdata-stx-runtime\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"runtime",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(M)=>`<script data-stx-runtime src="${M}"></script>`},{pattern:/<script\b([^>]*\bdata-stx-router\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"router",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(M)=>`<script data-stx-router src="${M}"></script>`},{pattern:/<style\b([^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*)>([\s\S]*?)<\/style>/gi,prefix:"crosswind",extension:"css",contentType:"text/css; charset=utf-8",replace:(M)=>`<link data-crosswind="generated" rel="stylesheet" href="${M}">`}];function _(M,C=`/${Y}`){let v=[],q=new Set,g=0,j=M;for(let G of S)j=j.replace(G.pattern,(R,K,W)=>{if(/\b(?:src|href)\s*=/.test(K)||!W.trim())return R;let Q=`${G.prefix}.${L(W)}.${G.extension}`;if(!q.has(Q))q.add(Q),v.push({filename:Q,contents:W,contentType:G.contentType});return g+=W.length,G.replace(`${C}/${Q}`)});return{html:j,assets:v,bytesInlined:g}}function a(M){let C={pages:0,assets:0,bytesInlined:0},v=B.join(M,Y),q=new Set;for(let g of T(M)){let j=N.readFileSync(g,"utf8"),{html:G,assets:R,bytesInlined:K}=_(j);if(G===j)continue;for(let W of R){if(q.has(W.filename))continue;q.add(W.filename),N.mkdirSync(v,{recursive:!0}),N.writeFileSync(B.join(v,W.filename),W.contents),C.assets++}N.writeFileSync(g,G),C.bytesInlined+=K,C.pages++}return C}import z from"fs";import P from"path";var I=1024,E=/<(script|style)\b([^>]*)>([\s\S]*?)<\/\1>/gi,d=new Set(["","module","text/javascript","application/javascript","module/javascript"]);function b(M){return Bun.hash(M).toString(16).slice(0,8)}function p(M){let C=[],v=(q)=>{for(let g of z.readdirSync(q,{withFileTypes:!0})){let j=P.join(q,g.name);if(g.isDirectory())v(j);else if(g.isFile()&&j.endsWith(".html"))C.push(j)}};if(z.existsSync(M))v(M);return C}function D(M,C){let v=M.match(new RegExp(`\\b${C}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i"));if(!v)return;return v[2]??v[3]??v[4]??""}function m(M,C,v){if(v.length<I)return!1;if(/\b(?:src|href)\s*=/i.test(C))return!1;if(M.toLowerCase()==="script"){if(!d.has((D(C,"type")??"").trim().toLowerCase()))return!1;return!0}return!0}function o(M){let C=[];for(let v of M.matchAll(/<template\b[^>]*>[\s\S]*?<\/template>/gi))C.push([v.index,v.index+v[0].length]);return C}function s(M){let C={pages:0,assets:0,bytesInlined:0},v=p(M);if(v.length<2)return C;let q=new Map,g=new Map;for(let Q of v){let O=z.readFileSync(Q,"utf8");q.set(Q,O);let x=o(O);for(let U of O.matchAll(E)){let[w,V,J,$]=U;if(!m(V,J,$))continue;if(x.some(([A,k])=>U.index>=A&&U.index<k))continue;let H=`${V.toLowerCase()}\x00${$}`,X=g.get(H);if(X)X.push({file:Q,whole:w,tag:V,attrs:J,body:$});else g.set(H,[{file:Q,whole:w,tag:V,attrs:J,body:$}])}}let j=[...g.values()].filter((Q)=>new Set(Q.map((O)=>O.file)).size>1);if(j.length===0)return C;let G=P.join(M,Y),R=new Map(q),K=new Map,W=[];for(let Q of j){let{tag:O,body:x}=Q[0],U=O.toLowerCase()==="script",w=`${U?"chunk":"style"}.${b(x)}.${U?"js":"css"}`;W.push({filename:w,contents:x,contentType:U?"text/javascript; charset=utf-8":"text/css; charset=utf-8"});let V=`/${Y}/${w}`;for(let J of Q){let $=U?`<script${J.attrs} src="${V}"></script>`:`<link${J.attrs} rel="stylesheet" href="${V}">`,H=R.get(J.file),X=H.replace(J.whole,()=>$);if(X===H)continue;R.set(J.file,X),K.set(J.file,(K.get(J.file)??0)+J.body.length)}}z.mkdirSync(G,{recursive:!0});for(let Q of W)z.writeFileSync(P.join(G,Q.filename),Q.contents),C.assets++;for(let[Q,O]of R){if(O===q.get(Q))continue;z.writeFileSync(Q,O),C.pages++,C.bytesInlined+=K.get(Q)??0}return C}y();import Z from"fs";import F from"path";var h="layout-types.d.ts";function f(M){let C=[],v=(q,g)=>{let j;try{j=Z.readdirSync(q,{withFileTypes:!0})}catch{return}for(let G of j){if(G.name.startsWith("."))continue;let R=F.join(q,G.name);if(G.isDirectory())v(R,g?`${g}/${G.name}`:G.name);else if(G.isFile()&&G.name.endsWith(".stx")&&G.name!=="_layout.stx"){let K=G.name.slice(0,-4);C.push(g?`${g}/${K}`:K)}}};return v(M,""),C.sort()}function c(M){let C=["// Auto-generated by stx \u2014 do not edit.","//","// Makes `definePageMeta({ layout })` reject a name with no layout behind it.","// Include this file in your tsconfig (it lives in the stx state directory,","// `.stx/` by default) for the check to apply.",""];if(M.length===0)return C.push("// No layouts found \u2014 `layout` stays typed as `string`.","export {}",""),C.join(`
|
|
3
3
|
`);return C.push("declare module '@stacksjs/stx' {"," interface KnownLayouts {",...M.map((v)=>` '${v}': true`)," }","}","","export {}",""),C.join(`
|
|
4
4
|
`)}function HM(M,C){if(!M)return[];let v=F.isAbsolute(M)?M:F.resolve(process.cwd(),M),q=f(v),g=c(q),j=F.join(C,h);try{if(Z.existsSync(j)&&Z.readFileSync(j,"utf8")===g)return q;Z.mkdirSync(C,{recursive:!0}),Z.writeFileSync(j,g)}catch{}return q}
|
|
5
5
|
export{Y as wk,_ as xk,a as yk,s as zk,h as Ak,f as Bk,c as Ck,HM as Dk};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ep as a,fp as b,gp as c,hp as d,ip as e,jp as f,kp as g,lp as h,mp as i,np as j,op as k,pp as l}from"./chunk-
|
|
2
|
+
import{ep as a,fp as b,gp as c,hp as d,ip as e,jp as f,kp as g,lp as h,mp as i,np as j,op as k,pp as l}from"./chunk-7hrttzad.js";import"./chunk-vr4ycjqv.js";import"./chunk-cbj5a2tk.js";import"./chunk-fmw1mscr.js";import"./chunk-wfsf3vmh.js";import"./chunk-pctsgktp.js";import"./chunk-q0sgqw4m.js";import"./chunk-ecncwde8.js";import"./chunk-fdd1ccv6.js";import"./chunk-yjrdr27z.js";import"./chunk-rrxm5s7d.js";import"./chunk-9qn3f7tp.js";import"./chunk-zpkdfbyp.js";import"./chunk-b9691w0f.js";export{l as stripStxRuntimeImports,a as scanScriptTags,k as rewriteStxImportSpecifiers,i as processSignals,g as processScriptSetup,e as preEvalLiteralReactiveIfs,b as parseLoopExpression,c as hasSignalsSyntax,j as findMarkupIndexOutsideScripts,h as extractExports,f as convertSignalLoopsToAttributes,d as convertSignalDirectivesToAttributes};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{lm as E,mm as M,zq as T}from"./chunk-
|
|
2
|
+
import{lm as E,mm as M,zq as T}from"./chunk-7hrttzad.js";import{Du as d,Fu as c,Gu as i}from"./chunk-9qn3f7tp.js";import{Nu as m,Qu as p}from"./chunk-b9691w0f.js";var y=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function f(z,Q,F){let J={fullTag:F,content:Q,attrs:z};if(/\bserver\b/.test(z))return{...J,type:"server"};if(/\bdata-stx-scoped\b/.test(z))return{...J,type:"client"};if(y.test(Q))return{...J,type:"signals"};if(/\bclient\b/.test(z)||/\btype\s*=\s*["']module["']/.test(z)||/\bsrc\s*=/.test(z))return{...J,type:"client"};return{...J,type:"server"}}var g=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function P(z){let Q=[],F=[],J=[],$=0;while($<z.length){let Y=z.indexOf("<",$);if(Y===-1)break;let K=M(z,Y);if(K>Y){$=K;continue}let Z=E(z,Y);if(Z>Y){let B=z.slice(Y,Z),U=g.exec(B);if(U){let X=f(U[1],U[2],B);switch(X.type){case"signals":Q.push(X);break;case"client":F.push(X);break;case"server":J.push(X);break}}$=Z;continue}$=Y+(z.startsWith("<!--",Y)?4:1)}return{signals:Q,client:F,server:J}}var s="X-STX-Router",a="private, no-store";function R(z){return z.headers.get("X-STX-Router")==="true"}function u(z,Q){if(!z)return Q;return z.split(",").some((J)=>J.trim().toLowerCase()===Q.toLowerCase())?z:`${z}, ${Q}`}function t(z){return{Vary:u(z,"X-STX-Router")}}import L from"path";d();var h="stx-page-head:",o=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,I=null;function r(){if(I!==null)return I;try{let{getRouterScript:z}=(i(),m(c));I=`<script>${z()}</script>`}catch{I=""}return I}async function Yz(z,Q){if(Q===!1)return null;if(Q&&typeof Q==="string"){let J=L.resolve(z,Q);if(await Bun.file(J).exists())return J;return null}let F=L.join(z,"app.stx");if(await Bun.file(F).exists())return F;return null}async function Zz(z,Q){try{let F=await Bun.file(z).text(),J=F,$=F.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if($)J=$[1].trim();let Y=P(F),K=[...Y.client.map((j)=>j.fullTag),...Y.signals.map((j)=>j.fullTag)],Z=[],B=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,U;while((U=B.exec(F))!==null)Z.push(U[0]);let X=J;for(let j of Y.server)X=X.replace(j.fullTag,"");for(let j of Y.client)X=X.replace(j.fullTag,"");X=X.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let W="<!--__STX_PAGE_SLOT__-->";if(X=X.replace(/<slot\s*\/>/gi,W).replace(/<slot\s*>\s*<\/slot>/gi,W),!X.includes(W))return console.warn(`[stx] Shell ${z} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:q,extractVariables:k,defaultConfig:v,loadStxConfig:H}=await import("./chunk-cxvmws79.js"),w=await H(),A={__filename:z,__dirname:L.dirname(z)};for(let j of K){let N=j.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(N&&!j.includes("client")&&!j.includes('type="module"'))await k(N[1],A,z)}let V=await q(X,A,z,{...v,...w,...Q},new Set),G=V.indexOf(W);if(G===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:V.substring(0,G),afterSlot:V.substring(G+W.length),filePath:z,shellScripts:K,shellStyles:Z}}catch(F){return console.error(`[stx] Error processing shell ${z}:`,F),null}}function $z(z,Q,F){let J,$="",Y=Q.match(o);if(Y){Q=Q.replace(Y[0],"");try{let X=Buffer.from(Y[1],"base64").toString("utf8"),W=X.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(W)J=W[1].trim();$=X.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let K=F||J||"stx App",Z=r(),B="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Gf as a}from"./chunk-
|
|
2
|
+
import{Gf as a}from"./chunk-3ej56pch.js";import"./chunk-7hrttzad.js";import"./chunk-vr4ycjqv.js";import"./chunk-cbj5a2tk.js";import"./chunk-fmw1mscr.js";import"./chunk-wfsf3vmh.js";import"./chunk-pctsgktp.js";import"./chunk-q0sgqw4m.js";import"./chunk-ecncwde8.js";import"./chunk-fdd1ccv6.js";import"./chunk-yjrdr27z.js";import"./chunk-rrxm5s7d.js";import"./chunk-9qn3f7tp.js";import"./chunk-zpkdfbyp.js";import"./chunk-b9691w0f.js";export{a as startInteractive};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ik as a,jk as b,kk as c,lk as d}from"./chunk-
|
|
2
|
+
import{ik as a,jk as b,kk as c,lk as d}from"./chunk-0na9rn3e.js";import"./chunk-fmj97bm8.js";import"./chunk-7hrttzad.js";import"./chunk-vr4ycjqv.js";import"./chunk-cbj5a2tk.js";import"./chunk-fmw1mscr.js";import"./chunk-wfsf3vmh.js";import"./chunk-pctsgktp.js";import"./chunk-q0sgqw4m.js";import"./chunk-ecncwde8.js";import"./chunk-fdd1ccv6.js";import"./chunk-yjrdr27z.js";import"./chunk-rrxm5s7d.js";import"./chunk-9qn3f7tp.js";import"./chunk-zpkdfbyp.js";import"./chunk-b9691w0f.js";export{b as getAvailableTargets,c as getAvailableFormats,d as default,a as buildNative};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Mf as a}from"./chunk-fcgewg4k.js";import"./chunk-95t702td.js";import"./chunk-m1qf02qz.js";import"./chunk-bmxqkast.js";import"./chunk-w95sp0k9.js";import"./chunk-58f0mthg.js";import"./chunk-7hrttzad.js";import"./chunk-vr4ycjqv.js";import"./chunk-cbj5a2tk.js";import"./chunk-fmw1mscr.js";import"./chunk-wfsf3vmh.js";import"./chunk-pctsgktp.js";import"./chunk-q0sgqw4m.js";import"./chunk-ecncwde8.js";import"./chunk-fdd1ccv6.js";import"./chunk-yjrdr27z.js";import"./chunk-rrxm5s7d.js";import"./chunk-9qn3f7tp.js";import"./chunk-zpkdfbyp.js";import"./chunk-b9691w0f.js";export{a as buildForProduction};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import{lt as Jq}from"./chunk-ecncwde8.js";import{Qu as Gq}from"./chunk-b9691w0f.js";import $ from"path";import{hasLocalConfig as Uq}from"bunfig";var a={fg:{light:"gray-900",dark:"gray-100",description:"Primary text"},"fg-strong":{light:"gray-700",dark:"gray-300",description:"Labels, secondary headings"},"fg-muted":{light:"gray-600",dark:"gray-400",description:"Supporting text"},"fg-soft":{light:"gray-500",dark:"gray-400",description:"De-emphasised text"},"fg-subtle":{light:"gray-400",dark:"gray-500",description:"Placeholders, disabled text"},surface:{light:"gray-50",dark:"gray-800",description:"Page and panel background"},"surface-raised":{light:"gray-100",dark:"gray-700",description:"Cards, popovers"},"surface-sunken":{light:"gray-200",dark:"gray-700",description:"Wells, track backgrounds"},line:{light:"gray-200",dark:"gray-700",description:"Default border, divider"},"line-strong":{light:"gray-300",dark:"gray-600",description:"Input border, focus ring track"},accent:{light:"indigo-600",dark:"indigo-400",description:"Primary action, selected state"},info:{light:"blue-600",dark:"blue-400",description:"Informational emphasis, links"},danger:{light:"red-600",dark:"red-400",description:"Errors, destructive actions"},success:{light:"green-600",dark:"green-400",description:"Confirmation"},warning:{light:"yellow-500",dark:"yellow-400",description:"Caution"},"accent-solid":{light:"indigo-600",dark:"indigo-500",description:"Primary button fill"},"info-solid":{light:"blue-600",dark:"blue-500",description:"Informational fill"},"danger-solid":{light:"red-600",dark:"red-500",description:"Destructive button fill"},"success-solid":{light:"green-600",dark:"green-500",description:"Confirmation fill"}};function m(G){return`--stx-${G}`}function p(G,q){let Q=q.lastIndexOf("-");if(Q===-1)return typeof G[q]==="string"?G[q]:void 0;let J=G[q.slice(0,Q)];if(!J||typeof J!=="object")return;let Y=J[q.slice(Q+1)];return typeof Y==="string"?Y:void 0}function o(G){let q={};for(let[Q,J]of Object.entries(a)){let Y=p(G,J.light);if(Y===void 0)continue;q[Q]=`var(${m(Q)}, ${Y})`}return q}function t(G){let q=[],Q=[];for(let[J,Y]of Object.entries(a)){let Z=p(G,Y.light),U=p(G,Y.dark);if(Z===void 0)continue;if(q.push(` ${m(J)}: ${Z};`),U!==void 0)Q.push(` ${m(J)}: ${U};`)}if(q.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",...q,"}",".dark {",...Q,"}",""].join(`
|
|
3
|
-
`)}function s(G){return typeof G==="object"&&G!==null&&!Array.isArray(G)}function g(G,q){let Q={...G};for(let[J,Y]of Object.entries(q))Q[J]=s(Y)&&s(Q[J])?g(Q[J],Y):Y;return Q}function e(G={},q={}){let Q=G.theme||{},J=q.theme||{},{extend:Y,...Z}=J,{extend:U,...z}=Q,X=z.colors||{};z.colors={...X,...o(X)};let A=g(z,Z),L=g(U||{},Y||{});if(Object.keys(L).length>0)A.extend=L;let H=[...G.safelist||[],...q.safelist||[]],E={...G.shortcuts||{},...q.shortcuts||{}},P=[...G.preflights||[],...q.preflights||[]];return{config:{...G,...q,theme:A,safelist:H,shortcuts:E,...P.length>0?{preflights:P}:{},content:[],output:""},safelist:H,shortcuts:E,includePreflight:q.preflight!==!1,minify:q.minify===!0,tokenCSS:t(X)}}var W={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"};var F=null,C=!1,_=null,b="",K=!1,Qq=256,V=new Map,O=new Map,j=null,d=null;function S(G){return Bun.hash(G).toString(16).padStart(16,"0").slice(0,16)}function u(G,q){if(V.has(G))V.delete(G);else if(V.size>=Qq)V.delete(V.keys().next().value);V.set(G,q)}function Wq(G){let q=S(G);if(O.has(q))O.delete(q);else if(O.size>=Qq)O.delete(O.keys().next().value);return O.set(q,G),q}function Dq(G){let q=O.get(G);if(q===void 0)return;return O.delete(G),O.set(G,q),q}async function Xq(G){if(!j)return null;try{let q=Bun.file($.join(j,`cw-${S(G)}.css`));if(!await q.exists())return null;return await q.text()}catch{return null}}async function zq(G,q){if(!j)return;try{if(!fs.existsSync(j))fs.mkdirSync(j,{recursive:!0});await Bun.write($.join(j,`cw-${S(G)}.css`),q)}catch{}}async function qq(G){try{let q=await import(G);if(q&&q.CSSGenerator)return{CSSGenerator:q.CSSGenerator,config:q.config,build:q.build,defaultConfig:q.defaultConfig,extractClasses:q.extractClasses}}catch{}return null}function Iq(){let G=[],q=process.cwd();while(q!==$.dirname(q))G.push($.join(q,"node_modules","@cwcss","crosswind","dist","index.js")),G.push($.join(q,"node_modules","@cwcss","crosswind","src","index.ts")),G.push($.join(q,"pantry","@cwcss","crosswind","dist","index.js")),G.push($.join(q,"pantry","@cwcss","crosswind","src","index.ts")),G.push($.join(q,"node_modules","@stacksjs","crosswind","dist","index.js")),G.push($.join(q,"pantry","@stacksjs","crosswind","dist","index.js")),q=$.dirname(q);return G}function Oq(){let G=[],q=process.env.HOME||process.env.USERPROFILE||"";if(q){let Q=[$.join(q,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),$.join(q,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),$.join(q,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),$.join(q,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),$.join(q,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),$.join(q,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];G.push(...Q)}return G.push($.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),G.push($.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),G}async function Yq(){if(C)return F;C=!0;try{let G=async(Y)=>{for(let Z of Y){if(!await Bun.file(Z).exists())continue;let U=await qq(Z);if(U){if(!process.env.STACKS_DEV_QUIET)console.log(`${W.green}[Crosswind]${W.reset} CSS engine loaded from ${$.dirname($.dirname(Z))}`);return U}}return null};if(process.env.CROSSWIND_SRC){let Y=$.resolve(process.env.CROSSWIND_SRC),Z=await G([Y]);if(!Z)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${Y}`);return F=Z,F}let q=await G(Iq());if(q)return F=q,F;let Q=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Y of Q){let Z=await qq(Y);if(Z){if(F=Z,!process.env.STACKS_DEV_QUIET)console.log(`${W.green}[Crosswind]${W.reset} CSS engine loaded`);return F}}let J=await G(Oq());if(J)return F=J,F;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${W.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${W.reset}`),console.warn(`${W.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${W.reset}`),null}}function Sq(){V.clear(),O.clear()}function xq(){F=null,C=!1,_=null,b="",V.clear(),O.clear(),d=null}async function Zq(G){try{if(!Uq({name:"crosswind",cwd:G}))return null;let{loadConfigWithResult:q}=await import("bunfig"),Q=await q({name:"crosswind",cwd:G,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Q?.path||!Q.config||Object.keys(Q.config).length===0)return null;let J=$.relative(G,Q.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${W.green}[Crosswind]${W.reset} Loaded config from ${J||Q.path}`);return Q.config}catch(q){if(q instanceof Error&&q.name==="ConfigNotFoundError")return null;return console.warn(`${W.yellow}[Crosswind]${W.reset} Failed to load crosswind config:`,q instanceof Error?q.message:q),null}}async function _q(G){let q=null;try{let{loadStxConfig:Q}=await import("./chunk-
|
|
3
|
+
`)}function s(G){return typeof G==="object"&&G!==null&&!Array.isArray(G)}function g(G,q){let Q={...G};for(let[J,Y]of Object.entries(q))Q[J]=s(Y)&&s(Q[J])?g(Q[J],Y):Y;return Q}function e(G={},q={}){let Q=G.theme||{},J=q.theme||{},{extend:Y,...Z}=J,{extend:U,...z}=Q,X=z.colors||{};z.colors={...X,...o(X)};let A=g(z,Z),L=g(U||{},Y||{});if(Object.keys(L).length>0)A.extend=L;let H=[...G.safelist||[],...q.safelist||[]],E={...G.shortcuts||{},...q.shortcuts||{}},P=[...G.preflights||[],...q.preflights||[]];return{config:{...G,...q,theme:A,safelist:H,shortcuts:E,...P.length>0?{preflights:P}:{},content:[],output:""},safelist:H,shortcuts:E,includePreflight:q.preflight!==!1,minify:q.minify===!0,tokenCSS:t(X)}}var W={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"};var F=null,C=!1,_=null,b="",K=!1,Qq=256,V=new Map,O=new Map,j=null,d=null;function S(G){return Bun.hash(G).toString(16).padStart(16,"0").slice(0,16)}function u(G,q){if(V.has(G))V.delete(G);else if(V.size>=Qq)V.delete(V.keys().next().value);V.set(G,q)}function Wq(G){let q=S(G);if(O.has(q))O.delete(q);else if(O.size>=Qq)O.delete(O.keys().next().value);return O.set(q,G),q}function Dq(G){let q=O.get(G);if(q===void 0)return;return O.delete(G),O.set(G,q),q}async function Xq(G){if(!j)return null;try{let q=Bun.file($.join(j,`cw-${S(G)}.css`));if(!await q.exists())return null;return await q.text()}catch{return null}}async function zq(G,q){if(!j)return;try{if(!fs.existsSync(j))fs.mkdirSync(j,{recursive:!0});await Bun.write($.join(j,`cw-${S(G)}.css`),q)}catch{}}async function qq(G){try{let q=await import(G);if(q&&q.CSSGenerator)return{CSSGenerator:q.CSSGenerator,config:q.config,build:q.build,defaultConfig:q.defaultConfig,extractClasses:q.extractClasses}}catch{}return null}function Iq(){let G=[],q=process.cwd();while(q!==$.dirname(q))G.push($.join(q,"node_modules","@cwcss","crosswind","dist","index.js")),G.push($.join(q,"node_modules","@cwcss","crosswind","src","index.ts")),G.push($.join(q,"pantry","@cwcss","crosswind","dist","index.js")),G.push($.join(q,"pantry","@cwcss","crosswind","src","index.ts")),G.push($.join(q,"node_modules","@stacksjs","crosswind","dist","index.js")),G.push($.join(q,"pantry","@stacksjs","crosswind","dist","index.js")),q=$.dirname(q);return G}function Oq(){let G=[],q=process.env.HOME||process.env.USERPROFILE||"";if(q){let Q=[$.join(q,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),$.join(q,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),$.join(q,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),$.join(q,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),$.join(q,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),$.join(q,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];G.push(...Q)}return G.push($.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),G.push($.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),G}async function Yq(){if(C)return F;C=!0;try{let G=async(Y)=>{for(let Z of Y){if(!await Bun.file(Z).exists())continue;let U=await qq(Z);if(U){if(!process.env.STACKS_DEV_QUIET)console.log(`${W.green}[Crosswind]${W.reset} CSS engine loaded from ${$.dirname($.dirname(Z))}`);return U}}return null};if(process.env.CROSSWIND_SRC){let Y=$.resolve(process.env.CROSSWIND_SRC),Z=await G([Y]);if(!Z)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${Y}`);return F=Z,F}let q=await G(Iq());if(q)return F=q,F;let Q=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Y of Q){let Z=await qq(Y);if(Z){if(F=Z,!process.env.STACKS_DEV_QUIET)console.log(`${W.green}[Crosswind]${W.reset} CSS engine loaded`);return F}}let J=await G(Oq());if(J)return F=J,F;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${W.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${W.reset}`),console.warn(`${W.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${W.reset}`),null}}function Sq(){V.clear(),O.clear()}function xq(){F=null,C=!1,_=null,b="",V.clear(),O.clear(),d=null}async function Zq(G){try{if(!Uq({name:"crosswind",cwd:G}))return null;let{loadConfigWithResult:q}=await import("bunfig"),Q=await q({name:"crosswind",cwd:G,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Q?.path||!Q.config||Object.keys(Q.config).length===0)return null;let J=$.relative(G,Q.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${W.green}[Crosswind]${W.reset} Loaded config from ${J||Q.path}`);return Q.config}catch(q){if(q instanceof Error&&q.name==="ConfigNotFoundError")return null;return console.warn(`${W.yellow}[Crosswind]${W.reset} Failed to load crosswind config:`,q instanceof Error?q.message:q),null}}async function _q(G){let q=null;try{let{loadStxConfig:Q}=await import("./chunk-f1m5a48z.js"),J=await Q(G);if(J.css)if(typeof J.css==="string"){let Y=$.isAbsolute(J.css)?J.css:$.resolve(G,J.css);if(await Bun.file(Y).exists()){let Z=await import(Y);q=Z.default||Z,console.log(`${W.green}[Crosswind]${W.reset} Loaded config from stx.config.ts \u2192 ${J.css}`)}}else{if(q={...J.css,content:J.css.content||[],preflight:J.css.preflight??!0,minify:J.css.minify??!1},J.css.config){let Y=$.isAbsolute(J.css.config)?J.css.config:$.resolve(G,J.css.config);if(await Bun.file(Y).exists()){let Z=await import(Y);q={...Z.default||Z,...q}}}console.log(`${W.green}[Crosswind]${W.reset} Using inline CSS config from stx.config.ts`)}}catch{}return q||await Zq(G)}function Fq(G){try{let q=new WeakSet;return S(JSON.stringify(G??{},(Q,J)=>{if(typeof J==="function")return`[fn]${String(J)}`;if(typeof J==="object"&&J!==null){if(q.has(J))return"[circular]";q.add(J)}return J})??"")}catch{return"unhashable"}}async function Nq(G){if(K)return b;K=!0;try{let q=await Yq();if(!q||!q.build)return K=!1,"";if(!_)_=await Zq(G);if(!_)return K=!1,"";let Q=q.defaultConfig?.theme||{},J=_.theme||{},Y={...q.defaultConfig,..._,theme:{...Q,...J,extend:{...Q.extend||{},...J.extend||{}}}},Z=performance.now(),U=await q.build(Y),z=performance.now()-Z;if(b=U.css,console.log(`${W.cyan}[Crosswind]${W.reset} Built ${U.classes.size} classes in ${z.toFixed(1)}ms`),Y.output){let X=$.isAbsolute(Y.output)?Y.output:$.join(G,Y.output),A=$.dirname(X);if(!fs.existsSync(A))fs.mkdirSync(A,{recursive:!0});await Bun.write(X,U.css)}return K=!1,U.css}catch(q){return console.error(`${W.red}[Crosswind]${W.reset} Build error:`,q),K=!1,b}}async function kq(G){_=null,await Nq(G)}function wq(){return b}function Vq(G){let q=new Set,Q=/class\s*=\s*["']([^"']+)["']/gi,J=Q.exec(G);while(J!==null){for(let U of J[1].split(/\s+/))if(U.trim())q.add(U.trim());J=Q.exec(G)}let Y=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,Z=Y.exec(G);while(Z!==null){let U=Z[1].match(/'([^']+)'/g);if(U){for(let z of U)for(let X of z.slice(1,-1).split(/\s+/))if(X.trim())q.add(X.trim())}Z=Y.exec(G)}return q}async function jq(G,q){try{let Q=await Yq();if(!Q)return"";let J=typeof Q.extractClasses==="function"?Q.extractClasses(G):Vq(G);if(J.size===0)return"";let Y=q?$.resolve(q):process.cwd();if(!j)j=Jq(Y,"cache");let Z=[...J].sort().join(" "),U=`${d||"default"}::${Z}`,z=V.get(U);if(z!==void 0)return u(U,z),z;let X=await Xq(U);if(X!==null)return u(U,X),X;if(!_)_=await _q(Y),d=Fq(_);let A=Q.defaultConfig||Q.config,L=_||{},H=e(A,L),{safelist:E,includePreflight:P,minify:x,tokenCSS:$q}=H,h=H.config,R=new Q.CSSGenerator(h);for(let I of E)R.generate(I);for(let I of J)R.generate(I);let N=R.toCSS(P,x),i=h.shortcuts||L.shortcuts||{};for(let[I,k]of Object.entries(i)){if(!J.has(I)&&!E.includes(I))continue;let w=k.split(/\s+/).filter(Boolean);for(let T of w)R.generate(T)}N=R.toCSS(P,x);let B=N.split(`
|
|
4
4
|
`);for(let[I,k]of Object.entries(i)){if(!J.has(I)&&!E.includes(I))continue;let w=k.split(/\s+/).filter(Boolean),T=[],y=[];for(let v of w){let c=v.startsWith("dark:"),n=`.${(c?v.slice(5):v).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let M=0;M<B.length;M++){let l=B[M].trim();if(l===`${n} {`||l.startsWith(`${n} {`)){let D=M,r="";while(D<B.length){if(r+=B[D],B[D].includes("}"))break;D++}let f=r.match(/\{([^}]+)\}/);if(f)if(c)y.push(f[1].trim());else T.push(f[1].trim());break}}}if(T.length)N+=`
|
|
5
5
|
.${I} { ${T.join(" ")} }`;if(y.length)N+=`
|
|
6
6
|
@media (prefers-color-scheme: dark) { .dark .${I} { ${y.join(" ")} } }`}return N=$q+N,u(U,N),zq(U,N),N}catch(Q){return console.warn("Failed to generate Crosswind CSS:",Q),""}}async function yq(G,q,Q=!1){let J=await jq(G,q);if(!J)return G;let Y=Q?`<link data-crosswind="generated" rel="stylesheet" href="/_stx/crosswind.${Wq(J)}.css">`:`<style data-crosswind="generated">
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$t as g,Au as H,Bu as I,Cu as J,Eu as K,Gu as L,Vt as a,Wt as b,Xt as c,Yt as d,Zt as e,_t as f,au as h,bu as i,cu as j,du as k,eu as l,fu as m,gu as n,hu as o,iu as p,ju as q,ku as r,lu as s,mu as t,nu as u,ou as v,pu as w,qu as x,ru as y,su as z,tu as A,uu as B,vu as C,wu as D,xu as E,yu as F,zu as G}from"./chunk-
|
|
2
|
+
import{$t as g,Au as H,Bu as I,Cu as J,Eu as K,Gu as L,Vt as a,Wt as b,Xt as c,Yt as d,Zt as e,_t as f,au as h,bu as i,cu as j,du as k,eu as l,fu as m,gu as n,hu as o,iu as p,ju as q,ku as r,lu as s,mu as t,nu as u,ou as v,pu as w,qu as x,ru as y,su as z,tu as A,uu as B,vu as C,wu as D,xu as E,yu as F,zu as G}from"./chunk-9qn3f7tp.js";import"./chunk-b9691w0f.js";L();export{o as setAppUrl,H as runMiddleware,r as route,j as resolveLayoutChain,s as resetRoutes,z as registerMiddleware,g as patternToRegex,t as navigateTo,h as matchRoute,E as loadMiddlewareFromDirectory,c as isNonPageRoutePattern,b as isNonPageRoutePath,B as hasMiddleware,K as getRouterScript,D as getMiddlewareNames,A as getMiddleware,d as generateRouteTypes,e as generateRouteManifest,n as formatRoutes,m as findErrorPage,f as filePathToPattern,J as extractLayoutMetadata,I as deriveLayoutGroup,q as defineRoutes,p as defineRoute,v as defineMiddleware,y as createStorageManager,w as createServerCookieManager,l as createRouter,F as createRouteLocation,G as createMiddlewareContext,x as createClientCookieManager,C as clearMiddleware,i as bracketPathToRegex,u as abortNavigation,k as Router,a as NON_PAGE_DIRS};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$o as c,_o as b,dm as a}from"./chunk-
|
|
2
|
+
import{$o as c,_o as b,dm as a}from"./chunk-7hrttzad.js";import"./chunk-vr4ycjqv.js";import"./chunk-cbj5a2tk.js";import"./chunk-fmw1mscr.js";import"./chunk-wfsf3vmh.js";import"./chunk-pctsgktp.js";import"./chunk-q0sgqw4m.js";import"./chunk-ecncwde8.js";import"./chunk-fdd1ccv6.js";import"./chunk-yjrdr27z.js";import"./chunk-rrxm5s7d.js";import"./chunk-9qn3f7tp.js";import"./chunk-zpkdfbyp.js";import"./chunk-b9691w0f.js";export{b as processESImports,c as processComponents,a as freeIdentifiers};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{sj as o,tj as p,uj as q}from"./chunk-
|
|
2
|
+
import{sj as o,tj as p,uj as q}from"./chunk-bmxqkast.js";import{Aj as a,Bj as b,Cj as c,Dj as d,Ej as e,Fj as f,Gj as g,Hj as h,Ij as i,Jj as j,Kj as k,Lj as l,Mj as m,Nj as n}from"./chunk-w95sp0k9.js";import"./chunk-rrxm5s7d.js";import"./chunk-b9691w0f.js";export{n as useOptimistic,l as untrack,a as state,g as runMountCallbacks,h as runDestroyCallbacks,i as pendingLifecycleCounts,m as peek,e as onMount,f as onDestroy,j as isSignal,k as isDerived,p as generateSignalsRuntimeDev,o as generateSignalsRuntime,c as effect,b as derived,q as default,d as batch};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ag as t,Bg as e,Dg as b,Mg as JJ}from"./chunk-0jdxe23c.js";import{Am as v,Rm as u,Sm as l,cp as o,jm as y,km as P,tm as x,up as g}from"./chunk-yzjrtq3k.js";import{$t as a,Cu as s,Gu as OJ}from"./chunk-7tbepz6d.js";import{Qu as R}from"./chunk-b9691w0f.js";import r from"fs";import B from"path";var{serve:IJ}=globalThis.Bun;function q(J,K,Q={}){let X=`${encodeURIComponent(J)}=${encodeURIComponent(K)}`;if(Q.maxAge!==void 0)X+=`; Max-Age=${Q.maxAge}`;if(Q.expires)X+=`; Expires=${Q.expires.toUTCString()}`;if(Q.path)X+=`; Path=${Q.path}`;if(Q.domain)X+=`; Domain=${Q.domain}`;if(Q.secure)X+="; Secure";if(Q.httpOnly)X+="; HttpOnly";if(Q.sameSite)X+=`; SameSite=${Q.sameSite}`;return X}async function KJ(J){let K=J.headers.get("content-type")||"",Q={},X=(Z,$)=>{let G=Q[Z];if(G===void 0)Q[Z]=$;else if(Array.isArray(G))G.push($);else Q[Z]=[G,$]};if(K.includes("multipart/form-data")){let Z=await J.formData();for(let[$,G]of Z.entries())if(typeof G==="string")X($,G);return Q}if(K.includes("application/x-www-form-urlencoded")){for(let[Z,$]of new URLSearchParams(await J.text()).entries())X(Z,$);return Q}return Q}function f(J){if(!J)return!1;let K=J.toUpperCase();return K!=="GET"&&K!=="HEAD"}async function h(J,K={}){let Q=K.request,X=K.method??Q?.method;if(!Q||!f(X))return{ran:!1};if(typeof J.action!=="function")return{ran:!1};let Z={};try{Z=await KJ(Q)}catch{}let $=await J.action({request:Q,form:Z,params:K.params??{},query:J.query??{},cookies:K.cookies??{}});if($&&typeof $==="object"){let G=$,W=QJ(G.cookies),I=G.redirect;if(typeof I==="string"&&I)return{redirect:I,ran:!0,...W.length>0?{cookies:W}:{}};let{cookies:_,redirect:N,...U}=G;if(Object.assign(J,U),W.length>0)return{ran:!0,cookies:W}}return{ran:!0}}function QJ(J){if(!J||typeof J!=="object"||Array.isArray(J))return[];let K=[];for(let[Q,X]of Object.entries(J)){if(!Q)continue;if(typeof X==="string"){K.push(q(Q,X));continue}if(X&&typeof X==="object"){let Z=X;if(typeof Z.value!=="string")continue;K.push(q(Q,Z.value,Z))}}return K}function m(J,K=[],Q){let X=new Headers({Location:J,"Cache-Control":"no-store"});for(let Z of K)X.append("Set-Cookie",Z);for(let[Z,$]of Object.entries(Q??{}))if(Z.toLowerCase()!=="location")X.set(Z,$);return new Response(null,{status:303,headers:X})}async function wJ(J,K={}){return(await c(J,K)).html}async function d(J,K={}){let{html:Q,context:X,redirect:Z,cookies:$}=await c(J,K),G=u(X),W=l(X);if(Z)return{html:Q,redirect:Z,cookies:$,status:G,headers:W};let{extractStreamBoundaries:I}=await import("./chunk-hsmd7q0n.js"),_=I(X),N=J.streamTemplates;if(N&&Object.keys(N).length>0){let{processDirectives:U}=await import("./chunk-eez474bd.js"),{defaultConfig:z}=await import("./chunk-fqy71v2e.js"),O=X.streamBoundaries||{},w={...z,autoShell:!1},D=Object.keys(N).map((V)=>({id:V,render:async()=>{let F=typeof O[V]==="function"?await O[V]():void 0;return U(N[V],{...X,$boundary:F},J.sourceFile,w,new Set)}})),E=new Set(D.map((V)=>V.id));_=[...(_||[]).filter((V)=>!E.has(V.id)),...D]}return{html:Q,boundaries:_&&_.length>0?_:void 0,cookies:$,status:G,headers:W}}async function c(J,K){let Q={__filename:J.sourceFile,__dirname:J.sourceFile.replace(/[/\\][^/\\]+$/,""),...K};if(!J.hasServerScripts&&!P(J.html))return{html:J.html,context:Q};for(let $ of J.serverScriptContent)try{await g($,Q,J.sourceFile)}catch(G){console.warn(`[stx] Server script error in ${J.sourceFile}:`,G)}let X=await h(Q,{request:K.request,method:K.method,params:K.params??{},cookies:K.cookies??{}});if(X.redirect)return{html:J.html,context:Q,redirect:X.redirect,cookies:X.cookies};if(!P(J.html))return{html:J.html,context:Q,cookies:X.cookies};let Z=new Map;for(let[$,G]of Object.entries(J.placeholders))if(G.expression)try{let W=v(G.expression,Q);if(G.type==="raw")Z.set($,W!==void 0&&W!==null?String(W):"");else Z.set($,W!==void 0&&W!==null?x(String(W)):"")}catch{Z.set($,"")}return{html:y(J.html,Z),context:Q,cookies:X.cookies}}async function AJ(J,K={}){if(!J.hasServerScripts&&!P(J.fragment))return J.fragment;let Q={__filename:J.sourceFile,__dirname:J.sourceFile.replace(/[/\\][^/\\]+$/,""),...K};for(let Z of J.serverScriptContent)try{await g(Z,Q,J.sourceFile)}catch($){console.warn(`[stx] Server script error in ${J.sourceFile}:`,$)}if(!P(J.fragment))return J.fragment;let X=new Map;for(let[Z,$]of Object.entries(J.placeholders))if($.expression)try{let G=v($.expression,Q);if($.type==="raw")X.set(Z,G!==void 0&&G!==null?String(G):"");else X.set(Z,G!==void 0&&G!==null?x(String(G)):"")}catch{X.set(Z,"")}return y(J.fragment,X)}OJ();import C from"zlib";import{promisify as n}from"util";var XJ=n(C.brotliCompress),ZJ=n(C.gzip),$J=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],GJ=["text/event-stream","multipart/x-mixed-replace"],UJ=1024;function WJ(J){if(!J)return!1;let K=J.toLowerCase();if(GJ.some((Q)=>K.startsWith(Q)))return!1;return $J.some((Q)=>K.startsWith(Q))}function jJ(J){let K=new Map;for(let Q of J.split(",")){let[X,...Z]=Q.trim().split(";"),$=X.trim().toLowerCase();if(!$)continue;let G=1;for(let W of Z){let I=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(W);if(!I)continue;let _=Number.parseFloat(I[1]);if(Number.isFinite(_))G=_}K.set($,G)}return K}function YJ(J){if(!J)return null;let K=jJ(J),Q=K.get("*"),X=(Z)=>K.get(Z)??Q??0;if(X("br")>0)return"br";if(X("gzip")>0)return"gzip";return null}async function i(J,K,Q={}){if(K.headers.get("content-encoding"))return K;if(K.status===204||K.status===304||!K.body)return K;if(!WJ(K.headers.get("content-type")))return K;let X=YJ(J.headers.get("accept-encoding"));if(!X)return K;let Z;try{Z=new Uint8Array(await K.arrayBuffer())}catch{return K}let $=()=>new Response(Z,{status:K.status,statusText:K.statusText,headers:p(K.headers)});if(Z.length<(Q.threshold??UJ))return $();try{let G=X==="br"?await XJ(Z,{params:{[C.constants.BROTLI_PARAM_QUALITY]:Q.quality??5,[C.constants.BROTLI_PARAM_SIZE_HINT]:Z.length}}):await ZJ(Z);if(G.length>=Z.length)return $();let W=p(K.headers);return W.set("Content-Encoding",X),W.set("Content-Length",String(G.length)),new Response(G,{status:K.status,statusText:K.statusText,headers:W})}catch{return $()}}function p(J){let K=new Headers(J),Q=K.get("Vary");if(!Q)return K.set("Vary","Accept-Encoding"),K;if(!Q.split(",").some((Z)=>Z.trim().toLowerCase()==="accept-encoding"))K.set("Vary",`${Q}, Accept-Encoding`);return K}var _J={".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 mJ(J={}){let K=B.resolve(J.outputDir||".output"),Q=J.port||3000,X=JJ(K);if(!X)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${X.routes.length} routes...`);let Z=new Map,$=new Map,G=new Map,W=new Map;for(let U of X.routes)try{let z=B.join(K,U.compiledPath),O=JSON.parse(await Bun.file(z).text());Z.set(U.pattern,O),G.set(U.pattern,s(O.html)),W.set(U.pattern,o(O.html));let w=B.join(K,U.fragmentPath);if(await Bun.file(w).exists())$.set(U.pattern,await Bun.file(w).text())}catch(z){console.warn(`[stx] Failed to load route ${U.pattern}:`,z)}let I=new Map,_=[];for(let U of X.routes)if(U.hasParams){let{regex:z,params:O}=a(U.pattern);_.push({regex:z,route:U,paramNames:O})}else I.set(U.pattern,U);let N=IJ({port:Q,async fetch(U){return i(U,await(async()=>{let O=new URL(U.url).pathname;if(J.onRequest){let j=await J.onRequest(U);if(j)return j}if(J.apiRoutes?.[O])return J.apiRoutes[O](U);if((U.method==="GET"||U.method==="HEAD")&&O!=="/"){let j=B.resolve(K,"public"),Y;try{Y=decodeURIComponent(O)}catch{Y=O}if(!Y.includes("\x00")){let L=B.resolve(j,`.${Y}`);if(L===j||L.startsWith(`${j}${B.sep}`))try{if(r.existsSync(L)&&r.statSync(L).isFile()){let M=B.extname(L).toLowerCase(),S=_J[M]||"application/octet-stream",H=O.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(O);return new Response(Bun.file(L),{headers:{"Content-Type":S,"Cache-Control":H?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let w=e(U),D=null,E={};if(D=I.get(O)||null,!D)for(let{regex:j,route:Y,paramNames:L}of _){let A=O.match(j);if(A){D=Y,L.forEach((M,S)=>{E[M]=A[S+1]});break}}if(!D){let j=I.get("/404")||null;if(j){let Y=Z.get(j.pattern);if(Y)return new Response(Y.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})}if(w){let j=$.get(D.pattern);if(j){let Y=G.get(D.pattern);return new Response(j,{headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...W.has(D.pattern)?{"X-STX-Runtime":W.get(D.pattern)?"true":"false"}:{},...Y?{"X-STX-Layout":Y.layout,"X-STX-Layout-Group":Y.group}:{},...b(),"Cache-Control":t}})}}let V=f(U.method),F=Z.get(D.pattern);if(!F){let j=I.get("/500")||null;if(j){let Y=Z.get(j.pattern);if(Y)return new Response(Y.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(!V&&!F.hasServerScripts&&Object.keys(F.placeholders).length===0)return new Response(F.html,{status:F.status??200,headers:{"Content-Type":"text/html",...b(),"Cache-Control":"public, max-age=60"}});try{let{html:j,boundaries:Y,redirect:L,cookies:A,status:M,headers:S}=await d(F,{params:E,request:U,method:U.method});if(L)return m(L,A,S);if(Y&&Y.length>0){let{renderStreamingPage:T,streamToResponse:k}=await import("./chunk-hsmd7q0n.js");return k(T(j,Y,{timeoutMs:30000}),{status:M??F.status??200,headers:{"Cache-Control":"no-cache",...S}})}let H=new Headers({"Content-Type":"text/html",...b(),"Cache-Control":"no-cache"});for(let T of A??[])H.append("Set-Cookie",T);for(let[T,k]of Object.entries(S??{}))H.set(T,k);return new Response(j,{status:M??F.status??200,headers:H})}catch(j){return console.error(`[stx] Hydration error for ${O}:`,j),new Response(F.html,{headers:{"Content-Type":"text/html"}})}})())}});return console.log(`[stx] Production server running at http://localhost:${Q}`),console.log(`[stx] Serving ${X.routes.length} routes (${Z.size} pre-loaded)`),{port:Q,stop:()=>N.stop()}}
|
|
2
|
+
import{Ag as t,Bg as e,Dg as b,Mg as JJ}from"./chunk-m1qf02qz.js";import{Am as v,Rm as u,Sm as l,cp as o,jm as y,km as P,tm as x,up as g}from"./chunk-7hrttzad.js";import{$t as a,Cu as s,Gu as OJ}from"./chunk-9qn3f7tp.js";import{Qu as R}from"./chunk-b9691w0f.js";import r from"fs";import B from"path";var{serve:IJ}=globalThis.Bun;function q(J,K,Q={}){let X=`${encodeURIComponent(J)}=${encodeURIComponent(K)}`;if(Q.maxAge!==void 0)X+=`; Max-Age=${Q.maxAge}`;if(Q.expires)X+=`; Expires=${Q.expires.toUTCString()}`;if(Q.path)X+=`; Path=${Q.path}`;if(Q.domain)X+=`; Domain=${Q.domain}`;if(Q.secure)X+="; Secure";if(Q.httpOnly)X+="; HttpOnly";if(Q.sameSite)X+=`; SameSite=${Q.sameSite}`;return X}async function KJ(J){let K=J.headers.get("content-type")||"",Q={},X=(Z,$)=>{let G=Q[Z];if(G===void 0)Q[Z]=$;else if(Array.isArray(G))G.push($);else Q[Z]=[G,$]};if(K.includes("multipart/form-data")){let Z=await J.formData();for(let[$,G]of Z.entries())if(typeof G==="string")X($,G);return Q}if(K.includes("application/x-www-form-urlencoded")){for(let[Z,$]of new URLSearchParams(await J.text()).entries())X(Z,$);return Q}return Q}function f(J){if(!J)return!1;let K=J.toUpperCase();return K!=="GET"&&K!=="HEAD"}async function h(J,K={}){let Q=K.request,X=K.method??Q?.method;if(!Q||!f(X))return{ran:!1};if(typeof J.action!=="function")return{ran:!1};let Z={};try{Z=await KJ(Q)}catch{}let $=await J.action({request:Q,form:Z,params:K.params??{},query:J.query??{},cookies:K.cookies??{}});if($&&typeof $==="object"){let G=$,W=QJ(G.cookies),I=G.redirect;if(typeof I==="string"&&I)return{redirect:I,ran:!0,...W.length>0?{cookies:W}:{}};let{cookies:_,redirect:N,...U}=G;if(Object.assign(J,U),W.length>0)return{ran:!0,cookies:W}}return{ran:!0}}function QJ(J){if(!J||typeof J!=="object"||Array.isArray(J))return[];let K=[];for(let[Q,X]of Object.entries(J)){if(!Q)continue;if(typeof X==="string"){K.push(q(Q,X));continue}if(X&&typeof X==="object"){let Z=X;if(typeof Z.value!=="string")continue;K.push(q(Q,Z.value,Z))}}return K}function m(J,K=[],Q){let X=new Headers({Location:J,"Cache-Control":"no-store"});for(let Z of K)X.append("Set-Cookie",Z);for(let[Z,$]of Object.entries(Q??{}))if(Z.toLowerCase()!=="location")X.set(Z,$);return new Response(null,{status:303,headers:X})}async function wJ(J,K={}){return(await c(J,K)).html}async function d(J,K={}){let{html:Q,context:X,redirect:Z,cookies:$}=await c(J,K),G=u(X),W=l(X);if(Z)return{html:Q,redirect:Z,cookies:$,status:G,headers:W};let{extractStreamBoundaries:I}=await import("./chunk-c6k8yfwa.js"),_=I(X),N=J.streamTemplates;if(N&&Object.keys(N).length>0){let{processDirectives:U}=await import("./chunk-dde4fvwg.js"),{defaultConfig:z}=await import("./chunk-f1m5a48z.js"),O=X.streamBoundaries||{},w={...z,autoShell:!1},D=Object.keys(N).map((V)=>({id:V,render:async()=>{let F=typeof O[V]==="function"?await O[V]():void 0;return U(N[V],{...X,$boundary:F},J.sourceFile,w,new Set)}})),E=new Set(D.map((V)=>V.id));_=[...(_||[]).filter((V)=>!E.has(V.id)),...D]}return{html:Q,boundaries:_&&_.length>0?_:void 0,cookies:$,status:G,headers:W}}async function c(J,K){let Q={__filename:J.sourceFile,__dirname:J.sourceFile.replace(/[/\\][^/\\]+$/,""),...K};if(!J.hasServerScripts&&!P(J.html))return{html:J.html,context:Q};for(let $ of J.serverScriptContent)try{await g($,Q,J.sourceFile)}catch(G){console.warn(`[stx] Server script error in ${J.sourceFile}:`,G)}let X=await h(Q,{request:K.request,method:K.method,params:K.params??{},cookies:K.cookies??{}});if(X.redirect)return{html:J.html,context:Q,redirect:X.redirect,cookies:X.cookies};if(!P(J.html))return{html:J.html,context:Q,cookies:X.cookies};let Z=new Map;for(let[$,G]of Object.entries(J.placeholders))if(G.expression)try{let W=v(G.expression,Q);if(G.type==="raw")Z.set($,W!==void 0&&W!==null?String(W):"");else Z.set($,W!==void 0&&W!==null?x(String(W)):"")}catch{Z.set($,"")}return{html:y(J.html,Z),context:Q,cookies:X.cookies}}async function AJ(J,K={}){if(!J.hasServerScripts&&!P(J.fragment))return J.fragment;let Q={__filename:J.sourceFile,__dirname:J.sourceFile.replace(/[/\\][^/\\]+$/,""),...K};for(let Z of J.serverScriptContent)try{await g(Z,Q,J.sourceFile)}catch($){console.warn(`[stx] Server script error in ${J.sourceFile}:`,$)}if(!P(J.fragment))return J.fragment;let X=new Map;for(let[Z,$]of Object.entries(J.placeholders))if($.expression)try{let G=v($.expression,Q);if($.type==="raw")X.set(Z,G!==void 0&&G!==null?String(G):"");else X.set(Z,G!==void 0&&G!==null?x(String(G)):"")}catch{X.set(Z,"")}return y(J.fragment,X)}OJ();import C from"zlib";import{promisify as n}from"util";var XJ=n(C.brotliCompress),ZJ=n(C.gzip),$J=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],GJ=["text/event-stream","multipart/x-mixed-replace"],UJ=1024;function WJ(J){if(!J)return!1;let K=J.toLowerCase();if(GJ.some((Q)=>K.startsWith(Q)))return!1;return $J.some((Q)=>K.startsWith(Q))}function jJ(J){let K=new Map;for(let Q of J.split(",")){let[X,...Z]=Q.trim().split(";"),$=X.trim().toLowerCase();if(!$)continue;let G=1;for(let W of Z){let I=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(W);if(!I)continue;let _=Number.parseFloat(I[1]);if(Number.isFinite(_))G=_}K.set($,G)}return K}function YJ(J){if(!J)return null;let K=jJ(J),Q=K.get("*"),X=(Z)=>K.get(Z)??Q??0;if(X("br")>0)return"br";if(X("gzip")>0)return"gzip";return null}async function i(J,K,Q={}){if(K.headers.get("content-encoding"))return K;if(K.status===204||K.status===304||!K.body)return K;if(!WJ(K.headers.get("content-type")))return K;let X=YJ(J.headers.get("accept-encoding"));if(!X)return K;let Z;try{Z=new Uint8Array(await K.arrayBuffer())}catch{return K}let $=()=>new Response(Z,{status:K.status,statusText:K.statusText,headers:p(K.headers)});if(Z.length<(Q.threshold??UJ))return $();try{let G=X==="br"?await XJ(Z,{params:{[C.constants.BROTLI_PARAM_QUALITY]:Q.quality??5,[C.constants.BROTLI_PARAM_SIZE_HINT]:Z.length}}):await ZJ(Z);if(G.length>=Z.length)return $();let W=p(K.headers);return W.set("Content-Encoding",X),W.set("Content-Length",String(G.length)),new Response(G,{status:K.status,statusText:K.statusText,headers:W})}catch{return $()}}function p(J){let K=new Headers(J),Q=K.get("Vary");if(!Q)return K.set("Vary","Accept-Encoding"),K;if(!Q.split(",").some((Z)=>Z.trim().toLowerCase()==="accept-encoding"))K.set("Vary",`${Q}, Accept-Encoding`);return K}var _J={".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 mJ(J={}){let K=B.resolve(J.outputDir||".output"),Q=J.port||3000,X=JJ(K);if(!X)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${X.routes.length} routes...`);let Z=new Map,$=new Map,G=new Map,W=new Map;for(let U of X.routes)try{let z=B.join(K,U.compiledPath),O=JSON.parse(await Bun.file(z).text());Z.set(U.pattern,O),G.set(U.pattern,s(O.html)),W.set(U.pattern,o(O.html));let w=B.join(K,U.fragmentPath);if(await Bun.file(w).exists())$.set(U.pattern,await Bun.file(w).text())}catch(z){console.warn(`[stx] Failed to load route ${U.pattern}:`,z)}let I=new Map,_=[];for(let U of X.routes)if(U.hasParams){let{regex:z,params:O}=a(U.pattern);_.push({regex:z,route:U,paramNames:O})}else I.set(U.pattern,U);let N=IJ({port:Q,async fetch(U){return i(U,await(async()=>{let O=new URL(U.url).pathname;if(J.onRequest){let j=await J.onRequest(U);if(j)return j}if(J.apiRoutes?.[O])return J.apiRoutes[O](U);if((U.method==="GET"||U.method==="HEAD")&&O!=="/"){let j=B.resolve(K,"public"),Y;try{Y=decodeURIComponent(O)}catch{Y=O}if(!Y.includes("\x00")){let L=B.resolve(j,`.${Y}`);if(L===j||L.startsWith(`${j}${B.sep}`))try{if(r.existsSync(L)&&r.statSync(L).isFile()){let M=B.extname(L).toLowerCase(),S=_J[M]||"application/octet-stream",H=O.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(O);return new Response(Bun.file(L),{headers:{"Content-Type":S,"Cache-Control":H?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let w=e(U),D=null,E={};if(D=I.get(O)||null,!D)for(let{regex:j,route:Y,paramNames:L}of _){let A=O.match(j);if(A){D=Y,L.forEach((M,S)=>{E[M]=A[S+1]});break}}if(!D){let j=I.get("/404")||null;if(j){let Y=Z.get(j.pattern);if(Y)return new Response(Y.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})}if(w){let j=$.get(D.pattern);if(j){let Y=G.get(D.pattern);return new Response(j,{headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...W.has(D.pattern)?{"X-STX-Runtime":W.get(D.pattern)?"true":"false"}:{},...Y?{"X-STX-Layout":Y.layout,"X-STX-Layout-Group":Y.group}:{},...b(),"Cache-Control":t}})}}let V=f(U.method),F=Z.get(D.pattern);if(!F){let j=I.get("/500")||null;if(j){let Y=Z.get(j.pattern);if(Y)return new Response(Y.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(!V&&!F.hasServerScripts&&Object.keys(F.placeholders).length===0)return new Response(F.html,{status:F.status??200,headers:{"Content-Type":"text/html",...b(),"Cache-Control":"public, max-age=60"}});try{let{html:j,boundaries:Y,redirect:L,cookies:A,status:M,headers:S}=await d(F,{params:E,request:U,method:U.method});if(L)return m(L,A,S);if(Y&&Y.length>0){let{renderStreamingPage:T,streamToResponse:k}=await import("./chunk-c6k8yfwa.js");return k(T(j,Y,{timeoutMs:30000}),{status:M??F.status??200,headers:{"Cache-Control":"no-cache",...S}})}let H=new Headers({"Content-Type":"text/html",...b(),"Cache-Control":"no-cache"});for(let T of A??[])H.append("Set-Cookie",T);for(let[T,k]of Object.entries(S??{}))H.set(T,k);return new Response(j,{status:M??F.status??200,headers:H})}catch(j){return console.error(`[stx] Hydration error for ${O}:`,j),new Response(F.html,{headers:{"Content-Type":"text/html"}})}})())}});return console.log(`[stx] Production server running at http://localhost:${Q}`),console.log(`[stx] Serving ${X.routes.length} routes (${Z.size} pre-loaded)`),{port:Q,stop:()=>N.stop()}}
|
|
3
3
|
export{WJ as lg,YJ as mg,i as ng,q as og,KJ as pg,f as qg,h as rg,m as sg,wJ as tg,d as ug,AJ as vg,mJ as wg};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$i as v,_i as _,aj as U}from"./chunk-9n0gvfrg.js";import{Oq as T,Pl as C,Ql as N,Sl as E,ds as S}from"./chunk-
|
|
2
|
+
import{$i as v,_i as _,aj as U}from"./chunk-9n0gvfrg.js";import{Oq as T,Pl as C,Ql as N,Sl as E,ds as S}from"./chunk-7hrttzad.js";import{Ft as y}from"./chunk-rrxm5s7d.js";import L from"path";var j=new Map,M=new Map,b=["composables","functions"];function K(V){let J=L.basename(V,".ts");return J==="index"||J==="types"||V.endsWith(".d.ts")}async function F(V){if(V)return L.resolve(V);let J=`<default>:${process.cwd()}`,Q=M.get(J);if(Q!==void 0)return Q;let z=await h();if(z!==null)M.set(J,z);return z}async function h(){let V=await S(),J=V.root||process.cwd(),Q=V.composablesDir;if(Q)return L.resolve(J,Q);for(let z of b){let Z=L.resolve(J,z);try{let W=new Bun.Glob("**/*.ts");for await(let Y of W.scan({cwd:Z,absolute:!0}))if(!K(Y))return Z}catch{}}return null}async function s(V){let J=await F(V);if(!J)return[];let Q=[];try{let W=new Bun.Glob("**/*.ts");for await(let Y of W.scan({cwd:J,absolute:!0}))if(!K(Y))Q.push(Y)}catch{return[]}Q.sort();let z=T({loader:"ts",target:"browser",define:E()}),Z=[];for(let W of Q)try{let Y=await Bun.file(W).text(),G=z.scan(Y).exports.filter(($)=>$!=="default");if(G.length>0)Z.push({file:W,names:G})}catch{}return Z}function u(V,J){return new RegExp(`\\b${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(V)}function f(V,J,Q){let z=new Map;for(let{file:G,names:$}of V)for(let O of $)if(!z.has(O))z.set(O,G);let Z=(G)=>{let $=[];for(let[O,P]of z)if(u(G,O))$.push(P);return $},W=new Set,Y=Z(Q);while(Y.length>0){let G=[];for(let $ of Y){if(W.has($))continue;W.add($);for(let O of Z(J.get($)??""))if(!W.has(O))G.push(O)}Y=G}return W}async function i(V,J){let Q=await F(V);if(!Q)return null;let z=[];try{let q=new Bun.Glob("**/*.ts");for await(let H of q.scan({cwd:Q,absolute:!0})){if(K(H))continue;z.push(H)}}catch{return U(j,Q,"",""),null}let Z=_(z);if(z.length===0)return U(j,Q,Z,""),null;z.sort();let W=T({loader:"ts",target:"browser",define:E()}),Y=new Map,G=[];for(let q of z)try{let H=await Bun.file(q).text();Y.set(q,H);let w=W.scan(H).exports.filter((X)=>X!=="default");if(w.length>0)G.push({file:q,names:w})}catch{Y.set(q,"")}let $=J===void 0?new Set(z):f(G,Y,J);if($.size===0)return null;let O=z.filter((q)=>$.has(q)),P=`${Q}\x00${O.join("\x00")}`,B=v(j,P,Z);if(B!==void 0)return B||null;let A=[],R=new Set,I=new Set;for(let q of O)try{let H=Y.get(q)??await Bun.file(q).text(),w=L.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])I.add(X[1]);try{for(let X of W.scan(H).exports)if(X!=="default")R.add(X)}catch{}H=C(H),H=N(H),H=H.replace(/^export\s+(default\s+)?/gm,""),H=W.transformSync(H),A.push(`// Composable: ${w}
|
|
3
3
|
${H.trim()}`)}catch(H){console.warn(`[stx] Failed to load composable ${q}:`,H)}if(A.length===0||R.size===0)return U(j,P,Z,""),null;let D=[...R].map((q)=>` try { __c[${JSON.stringify(q)}] = ${q}; } catch (e) {}`).join(`
|
|
4
4
|
`),g=JSON.stringify([...R]),k=A.join(`
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{a as x,b as u,c as b,d as Az,e as G,f as d,h as y,i as I,j as Uz,k as v}from"./chunk-0y46fbkx.js";import{l as h,m as f,n as g}from"./chunk-q9n5swx7.js";import{up as V}from"./chunk-
|
|
2
|
+
import{a as x,b as u,c as b,d as Az,e as G,f as d,h as y,i as I,j as Uz,k as v}from"./chunk-0y46fbkx.js";import{l as h,m as f,n as g}from"./chunk-q9n5swx7.js";import{up as V}from"./chunk-7hrttzad.js";import"./chunk-vr4ycjqv.js";import"./chunk-cbj5a2tk.js";import"./chunk-fmw1mscr.js";import"./chunk-wfsf3vmh.js";import"./chunk-pctsgktp.js";import"./chunk-q0sgqw4m.js";import"./chunk-ecncwde8.js";import"./chunk-fdd1ccv6.js";import"./chunk-yjrdr27z.js";import"./chunk-rrxm5s7d.js";import"./chunk-9qn3f7tp.js";import"./chunk-zpkdfbyp.js";import{Qu as F}from"./chunk-b9691w0f.js";import l from"fs";import R from"path";function m(z,J){let Z=[R.join(z.root,"stx.config.ts"),R.join(z.root,"stx.config.js"),R.join(z.root,"stx.config.mjs")],K=J.debounceMs??300,$=null,X=[];for(let B of Z)try{if(!l.existsSync(B))continue;let Y=l.watch(B,(W)=>{if(W==="change"){if($)clearTimeout($);$=setTimeout(async()=>{d("Config file changed, restarting...");try{await J.onChange()}catch(j){G(`Failed to restart: ${j}`)}},K)}});X.push(Y)}catch{}return{stop(){if($)clearTimeout($);for(let B of X)B.close()}}}import E from"fs";import i from"path";var Gz=".stx/story/analytics.json",Nz=1,c=1e4;class M{storage;storagePath;currentSession=null;dirty=!1;viewStartTimes=new Map;constructor(z){this.storagePath=i.join(z,Gz),this.storage=this.loadStorage(),this.startSession()}loadStorage(){try{let z=E.readFileSync(this.storagePath,"utf-8");return JSON.parse(z)}catch{return{version:Nz,events:[],sessions:[]}}}async save(){if(!this.dirty)return;let z=i.dirname(this.storagePath);if(await E.promises.mkdir(z,{recursive:!0}),this.storage.events.length>c)this.storage.events=this.storage.events.slice(-c);await E.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}startSession(){this.endSession(),this.currentSession={id:Hz(),startTime:Date.now(),componentViews:[]},this.storage.sessions.push(this.currentSession),this.dirty=!0}endSession(){if(this.currentSession)this.currentSession.endTime=Date.now(),this.currentSession=null}track(z){this.storage.events.push({...z,timestamp:Date.now()}),this.dirty=!0}trackView(z,J){if(this.endViewTiming(z),this.viewStartTimes.set(z,Date.now()),this.track({type:"view",componentId:z,variantId:J}),this.currentSession&&!this.currentSession.componentViews.includes(z))this.currentSession.componentViews.push(z)}endViewTiming(z){let J=this.viewStartTimes.get(z);if(J){let Z=Date.now()-J;this.track({type:"view",componentId:z,metadata:{duration:Z,endView:!0}}),this.viewStartTimes.delete(z)}}trackPropChange(z,J,Z){this.track({type:"prop_change",componentId:z,propName:J,metadata:{value:Z}})}trackVariantSwitch(z,J){this.track({type:"variant_switch",componentId:z,variantId:J})}trackSearch(z,J){this.track({type:"search",query:z,metadata:{resultCount:J}})}getComponentAnalytics(z,J){let Z=this.storage.events.filter((Q)=>Q.componentId===z),K=Z.filter((Q)=>Q.type==="view"&&!Q.metadata?.endView),$=Z.filter((Q)=>Q.type==="prop_change"),X=Z.filter((Q)=>Q.type==="variant_switch"),B={};for(let Q of $)if(Q.propName)B[Q.propName]=(B[Q.propName]||0)+1;let Y={};for(let Q of X)if(Q.variantId)Y[Q.variantId]=(Y[Q.variantId]||0)+1;let W=new Set(this.storage.sessions.filter((Q)=>Q.componentViews.includes(z)).map((Q)=>Q.id)),j=Z.filter((Q)=>Q.metadata?.duration).map((Q)=>Q.metadata.duration),U=j.length>0?j.reduce((Q,D)=>Q+D,0)/j.length:0,_=Object.entries(B).sort((Q,D)=>D[1]-Q[1]).slice(0,5).map(([Q])=>Q);return{componentId:z,componentName:J,viewCount:K.length,uniqueViews:W.size,lastViewed:K[K.length-1]?.timestamp,propChanges:B,topChangedProps:_,variantViews:Y,avgTimeSpent:U}}getMostViewedComponents(z=10){let J=new Map;for(let Z of this.storage.events)if(Z.type==="view"&&Z.componentId&&!Z.metadata?.endView)J.set(Z.componentId,(J.get(Z.componentId)||0)+1);return Array.from(J.entries()).map(([Z,K])=>({componentId:Z,viewCount:K})).sort((Z,K)=>K.viewCount-Z.viewCount).slice(0,z)}getMostChangedProps(z=10){let J=new Map;for(let Z of this.storage.events)if(Z.type==="prop_change"&&Z.propName)J.set(Z.propName,(J.get(Z.propName)||0)+1);return Array.from(J.entries()).map(([Z,K])=>({propName:Z,changeCount:K})).sort((Z,K)=>K.changeCount-Z.changeCount).slice(0,z)}getSearchAnalytics(){let z=this.storage.events.filter(($)=>$.type==="search"),J=new Map,Z=0;for(let $ of z){if($.query)J.set($.query,(J.get($.query)||0)+1);if($.metadata?.resultCount!==void 0)Z+=$.metadata.resultCount}let K=Array.from(J.entries()).map(([$,X])=>({query:$,count:X})).sort(($,X)=>X.count-$.count).slice(0,10);return{totalSearches:z.length,topQueries:K,avgResultCount:z.length>0?Z/z.length:0}}clear(){this.storage.events=[],this.storage.sessions=[],this.dirty=!0,this.startSession()}exportAnalytics(){return JSON.stringify({exportedAt:Date.now(),...this.storage},null,2)}}function Hz(){return`session-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import P from"fs";import p from"path";var Fz=".stx/story/bookmarks.json",Vz=1;class T{storage;storagePath;dirty=!1;constructor(z){this.storagePath=p.join(z,Fz),this.storage=this.loadStorage()}loadStorage(){try{let z=P.readFileSync(this.storagePath,"utf-8");return JSON.parse(z)}catch{return{version:Vz,bookmarks:[]}}}async save(){if(!this.dirty)return;let z=p.dirname(this.storagePath);await P.promises.mkdir(z,{recursive:!0}),await P.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}addBookmark(z,J,Z,K={}){let $={id:Rz(),name:K.name||`${z}/${J}`,storyId:z,variantId:J,props:Z,created:Date.now(),notes:K.notes,color:K.color};return this.storage.bookmarks.push($),this.dirty=!0,$}getAllBookmarks(){return[...this.storage.bookmarks]}getBookmarksForStory(z){return this.storage.bookmarks.filter((J)=>J.storyId===z)}getBookmark(z){return this.storage.bookmarks.find((J)=>J.id===z)}isBookmarked(z,J){return this.storage.bookmarks.some((Z)=>Z.storyId===z&&Z.variantId===J)}updateBookmark(z,J){let Z=this.getBookmark(z);if(!Z)return;return Object.assign(Z,J),this.dirty=!0,Z}deleteBookmark(z){let J=this.storage.bookmarks.findIndex((Z)=>Z.id===z);if(J===-1)return!1;return this.storage.bookmarks.splice(J,1),this.dirty=!0,!0}toggleBookmark(z,J,Z){let K=this.storage.bookmarks.find((X)=>X.storyId===z&&X.variantId===J);if(K)return this.deleteBookmark(K.id),{added:!1};return{added:!0,bookmark:this.addBookmark(z,J,Z)}}exportBookmarks(){return JSON.stringify(this.storage,null,2)}importBookmarks(z,J=!0){let Z=JSON.parse(z),K=0;for(let $ of Z.bookmarks){if(J){let X=this.storage.bookmarks.find((B)=>B.id===$.id);if(X)Object.assign(X,$);else this.storage.bookmarks.push($)}else this.storage.bookmarks.push($);K++}if(K>0)this.dirty=!0;return K}}function Rz(){return`bm-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}var N=new Set;function s(){return{open(z){N.add(z),z.send(JSON.stringify({type:"connected",timestamp:Date.now()}))},close(z){N.delete(z)},message(z,J){}}}function q(z){let J=JSON.stringify({...z,timestamp:z.timestamp||Date.now()});for(let Z of N)try{Z.send(J)}catch{N.delete(Z)}}function n(z,J){q({type:"story-update",data:{storyId:z,...J}})}function a(z,J){q({type:"story-add",data:{storyId:z,...J}})}function o(z){q({type:"story-remove",data:{storyId:z}})}function r(z){return`
|
|
3
3
|
<script>
|
|
4
4
|
(function() {
|
|
5
5
|
const ws = new WebSocket('${z}');
|
|
@@ -556,7 +556,7 @@ window.__stxPerformance = {
|
|
|
556
556
|
|
|
557
557
|
window.clearPerformanceMetrics = () => window.__stxPerformance.clear();
|
|
558
558
|
</script>
|
|
559
|
-
`}import w from"fs";import Xz from"path";var Mz=".stx/story/presets.json",C=1,Pz=10;class k{storage;storagePath;dirty=!1;constructor(z){this.storagePath=Xz.join(z,Mz),this.storage=this.loadStorage()}loadStorage(){try{let z=w.readFileSync(this.storagePath,"utf-8"),J=JSON.parse(z);if(J.version!==C)return this.migrateStorage(J);return J}catch{return{version:C,presets:[],recentIds:[]}}}migrateStorage(z){return{version:C,presets:z.presets||[],recentIds:z.recentIds||[]}}async save(){if(!this.dirty)return;let z=Xz.dirname(this.storagePath);await w.promises.mkdir(z,{recursive:!0}),await w.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}createPreset(z,J,Z={}){let K={id:Tz(),name:z,description:Z.description,props:J,componentId:Z.componentId,created:Date.now(),usageCount:0,tags:Z.tags};return this.storage.presets.push(K),this.dirty=!0,K}getPreset(z){return this.storage.presets.find((J)=>J.id===z)}getAllPresets(){return[...this.storage.presets]}getPresetsForComponent(z){return this.storage.presets.filter((J)=>!J.componentId||J.componentId===z)}getRecentPresets(){return this.storage.recentIds.map((z)=>this.getPreset(z)).filter((z)=>z!==void 0)}usePreset(z){let J=this.getPreset(z);if(!J)return;return J.lastUsed=Date.now(),J.usageCount++,this.storage.recentIds=[z,...this.storage.recentIds.filter((Z)=>Z!==z)].slice(0,Pz),this.dirty=!0,J}updatePreset(z,J){let Z=this.getPreset(z);if(!Z)return;return Object.assign(Z,J),this.dirty=!0,Z}deletePreset(z){let J=this.storage.presets.findIndex((Z)=>Z.id===z);if(J===-1)return!1;return this.storage.presets.splice(J,1),this.storage.recentIds=this.storage.recentIds.filter((Z)=>Z!==z),this.dirty=!0,!0}searchPresets(z){let J=z.toLowerCase();return this.storage.presets.filter((Z)=>{if(Z.name.toLowerCase().includes(J))return!0;if(Z.description?.toLowerCase().includes(J))return!0;if(Z.tags?.some((K)=>K.toLowerCase().includes(J)))return!0;return!1})}getMostUsedPresets(z=5){return[...this.storage.presets].sort((J,Z)=>Z.usageCount-J.usageCount).slice(0,z)}exportPresets(z){let J=z?this.storage.presets.filter((Z)=>z.includes(Z.id)):this.storage.presets;return JSON.stringify({presets:J},null,2)}importPresets(z,J=!1){let Z=JSON.parse(z),K=0;for(let $ of Z.presets){let X=this.storage.presets.find((B)=>B.id===$.id);if(X&&!J)continue;if(X)Object.assign(X,$);else this.storage.presets.push($);K++}if(K>0)this.dirty=!0;return K}}function Tz(){return`preset-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import S from"fs";var Qz=new Map;async function H(z,J,Z={}){let K=performance.now(),$=[];try{let X=await S.promises.stat(J),B=Qz.get(J),Y;if(B&&B.mtime===X.mtimeMs)Y=B.content;else Y=await S.promises.readFile(J,"utf-8"),Qz.set(J,{content:Y,mtime:X.mtimeMs,analyzed:null});let{processDirectives:W}=await import("./chunk-
|
|
559
|
+
`}import w from"fs";import Xz from"path";var Mz=".stx/story/presets.json",C=1,Pz=10;class k{storage;storagePath;dirty=!1;constructor(z){this.storagePath=Xz.join(z,Mz),this.storage=this.loadStorage()}loadStorage(){try{let z=w.readFileSync(this.storagePath,"utf-8"),J=JSON.parse(z);if(J.version!==C)return this.migrateStorage(J);return J}catch{return{version:C,presets:[],recentIds:[]}}}migrateStorage(z){return{version:C,presets:z.presets||[],recentIds:z.recentIds||[]}}async save(){if(!this.dirty)return;let z=Xz.dirname(this.storagePath);await w.promises.mkdir(z,{recursive:!0}),await w.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}createPreset(z,J,Z={}){let K={id:Tz(),name:z,description:Z.description,props:J,componentId:Z.componentId,created:Date.now(),usageCount:0,tags:Z.tags};return this.storage.presets.push(K),this.dirty=!0,K}getPreset(z){return this.storage.presets.find((J)=>J.id===z)}getAllPresets(){return[...this.storage.presets]}getPresetsForComponent(z){return this.storage.presets.filter((J)=>!J.componentId||J.componentId===z)}getRecentPresets(){return this.storage.recentIds.map((z)=>this.getPreset(z)).filter((z)=>z!==void 0)}usePreset(z){let J=this.getPreset(z);if(!J)return;return J.lastUsed=Date.now(),J.usageCount++,this.storage.recentIds=[z,...this.storage.recentIds.filter((Z)=>Z!==z)].slice(0,Pz),this.dirty=!0,J}updatePreset(z,J){let Z=this.getPreset(z);if(!Z)return;return Object.assign(Z,J),this.dirty=!0,Z}deletePreset(z){let J=this.storage.presets.findIndex((Z)=>Z.id===z);if(J===-1)return!1;return this.storage.presets.splice(J,1),this.storage.recentIds=this.storage.recentIds.filter((Z)=>Z!==z),this.dirty=!0,!0}searchPresets(z){let J=z.toLowerCase();return this.storage.presets.filter((Z)=>{if(Z.name.toLowerCase().includes(J))return!0;if(Z.description?.toLowerCase().includes(J))return!0;if(Z.tags?.some((K)=>K.toLowerCase().includes(J)))return!0;return!1})}getMostUsedPresets(z=5){return[...this.storage.presets].sort((J,Z)=>Z.usageCount-J.usageCount).slice(0,z)}exportPresets(z){let J=z?this.storage.presets.filter((Z)=>z.includes(Z.id)):this.storage.presets;return JSON.stringify({presets:J},null,2)}importPresets(z,J=!1){let Z=JSON.parse(z),K=0;for(let $ of Z.presets){let X=this.storage.presets.find((B)=>B.id===$.id);if(X&&!J)continue;if(X)Object.assign(X,$);else this.storage.presets.push($);K++}if(K>0)this.dirty=!0;return K}}function Tz(){return`preset-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import S from"fs";var Qz=new Map;async function H(z,J,Z={}){let K=performance.now(),$=[];try{let X=await S.promises.stat(J),B=Qz.get(J),Y;if(B&&B.mtime===X.mtimeMs)Y=B.content;else Y=await S.promises.readFile(J,"utf-8"),Qz.set(J,{content:Y,mtime:X.mtimeMs,analyzed:null});let{processDirectives:W}=await import("./chunk-dde4fvwg.js"),j={},U=A(Y);if(U)try{await V(U,j,J)}catch(O){$.push(`Warning: Could not extract script variables: ${O instanceof Error?O.message:String(O)}`)}if(Z.props)Object.assign(j,Z.props);let Q=await W(Y,j,J,{},new Set),D=Wz(Y),L=A(Y);return Q=jz(Q),Q=Dz(Q,j),{html:Q,css:D,js:L,errors:$,duration:performance.now()-K}}catch(X){return $.push(X instanceof Error?X.message:String(X)),{html:`<div class="stx-render-error">${Lz($[0])}</div>`,css:"",js:"",errors:$,duration:performance.now()-K}}}async function qz(z){try{let J=await S.promises.readFile(z,"utf-8"),Z=A(J);if(!Z)return null;let K={};if(await V(Z,K,z),Array.isArray(K.variants))return K.variants;return null}catch{return null}}async function Bz(z,J,Z,K){let $=J.story?.variants;if(!$){let Y=await qz(J.path);if(Y)$=Y}if(!$&&Z==="default")return H(z,J.path,{props:K||{}});if(!$)return H(z,J.path,{props:K||{}});let X=$.find((Y)=>Y.id===Z);if(!X&&Z==="default")return H(z,J.path,{props:K||{}});if(!X)return{html:'<div class="stx-render-error">Variant not found</div>',css:"",js:"",errors:[`Variant '${Z}' not found`],duration:0};let B={...X.state,...K};if(X.source)return wz(z,X.source,B);return H(z,J.path,{props:B})}async function wz(z,J,Z={}){let K=performance.now(),$=[];try{let{processDirectives:X}=await import("./chunk-dde4fvwg.js"),B={...Z},Y=A(J);if(Y)try{await V(Y,B,"inline-template.stx")}catch{}let j=await X(J,B,"inline-template.stx",{},new Set);return j=jz(j),j=Dz(j,B),{html:j,css:Wz(J),js:A(J),errors:$,duration:performance.now()-K}}catch(X){return $.push(X instanceof Error?X.message:String(X)),{html:`<div class="stx-render-error">${Lz($[0])}</div>`,css:"",js:"",errors:$,duration:performance.now()-K}}}function Wz(z){let J=[],Z=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,K=Z.exec(z);while(K!==null)J.push(K[1].trim()),K=Z.exec(z);return J.join(`
|
|
560
560
|
`)}function jz(z){return z.replace(/<!--[\s\S]*?-->/g,"").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"").replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/^\s*\n/gm,"").trim()}function A(z){let J=[],Z=/<script\b[^>]*>([\s\S]*?)<\/script>/gi,K=Z.exec(z);while(K!==null)J.push(K[1].trim()),K=Z.exec(z);return J.join(`
|
|
561
561
|
`)}function Dz(z,J){let Z=`<script>window.__stxProps = ${JSON.stringify(J)};</script>`;return z+Z}function Lz(z){return z.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}async function Oz(z,J){let Z=await I(z);f(z,Z);let K=v(z.config,Z);g(z,K),console.log(` Found ${Z.length} story files`);let $=typeof J.host==="string"?J.host:J.host===!0?"0.0.0.0":"localhost",X=new k(z.root),B=new T(z.root),Y=new M(z.root),W=s(),j=Bun.serve({port:J.port,hostname:$,fetch:async(Q,D)=>{let O=new URL(Q.url).pathname;if(O==="/__hmr"){if(D.upgrade(Q,{data:{isHmr:!0}}))return;return new Response("WebSocket upgrade failed",{status:400})}if(O.startsWith("/api/"))return Cz(z,O,Q,{presetsManager:X,bookmarksManager:B,analyticsTracker:Y});return kz(z,O,J.port)},websocket:{open(Q){W.open(Q)},close(Q){W.close(Q)},message(Q,D){W.message(Q,D)}}}),U=`http://${$}:${J.port}`,_=Uz(z,async(Q,D)=>{console.log(` [${Q}] ${D.relativePath}`);let L=await I(z);f(z,L);let O=v(z.config,L);if(g(z,O),Q==="add")a(D.id,{fileName:D.fileName});else if(Q==="unlink")o(D.id);else n(D.id,{fileName:D.fileName})});if(J.open){let Q=U;try{let{exec:D}=await import("child_process"),L=process.platform;D(`${L==="darwin"?"open":L==="win32"?"start":"xdg-open"} ${Q}`)}catch{}}return{server:j,url:U,close:async()=>{_(),j.stop()}}}async function Cz(z,J,Z,K){let{presetsManager:$,bookmarksManager:X,analyticsTracker:B}=K;if(J==="/api/stories")return Response.json({files:z.storyFiles.map((Y)=>({id:Y.id,fileName:Y.fileName,relativePath:Y.relativePath,treePath:Y.treePath})),tree:z.tree});if(J.startsWith("/api/story/")){let Y=J.slice(11),W=z.storyFiles.find((j)=>j.id===Y);if(!W)return new Response("Story not found",{status:404});try{let j=await Bun.file(W.path).text();return Response.json({id:W.id,fileName:W.fileName,relativePath:W.relativePath,content:j})}catch{return new Response("Error reading story",{status:500})}}if(J==="/api/config")return Response.json({theme:z.config.theme,responsivePresets:z.config.responsivePresets,backgroundPresets:z.config.backgroundPresets});if(J.startsWith("/api/render/")){let Y=new URL(Z.url),W=J.slice(12).split("/"),j=W[0],U=W[1]||"default",_,Q=Y.searchParams.get("props");if(Q)try{_=JSON.parse(Q)}catch{}let D=z.storyFiles.find((L)=>L.id===j);if(!D)return new Response("Story not found",{status:404});try{let L=await Bz(z,D,U,_);return Response.json({html:L.html,css:L.css,js:L.js,errors:L.errors,duration:L.duration})}catch(L){return Response.json({html:"",css:"",js:"",errors:[L instanceof Error?L.message:String(L)],duration:0},{status:500})}}if(J==="/api/presets"&&Z.method==="GET")return Response.json({presets:$.getAllPresets()});if(J==="/api/presets"&&Z.method==="POST")try{let Y=await Z.json(),W=$.createPreset(Y.name,Y.props,{componentId:Y.componentId,description:Y.description});return await $.save(),Response.json(W)}catch(Y){return Response.json({error:String(Y)},{status:400})}if(J.startsWith("/api/presets/")&&!J.includes("/use")&&Z.method==="GET"){let Y=J.slice(13),W=$.getPreset(Y);if(!W)return new Response("Preset not found",{status:404});return Response.json(W)}if(J.endsWith("/use")&&Z.method==="POST"){let Y=J.slice(13,-4),W=$.usePreset(Y);if(!W)return new Response("Preset not found",{status:404});return await $.save(),Response.json(W)}if(J.startsWith("/api/presets/")&&Z.method==="DELETE"){let Y=J.slice(13);if(!$.deletePreset(Y))return new Response("Preset not found",{status:404});return await $.save(),Response.json({success:!0})}if(J==="/api/bookmarks"&&Z.method==="GET")return Response.json({bookmarks:X.getAllBookmarks()});if(J==="/api/bookmarks"&&Z.method==="POST")try{let Y=await Z.json(),W=X.addBookmark(Y.storyId,Y.variantId,Y.props,{name:Y.name,notes:Y.notes,color:Y.color});return await X.save(),Response.json(W)}catch(Y){return Response.json({error:String(Y)},{status:400})}if(J==="/api/bookmarks/toggle"&&Z.method==="POST")try{let Y=await Z.json(),W=X.toggleBookmark(Y.storyId,Y.variantId,Y.props);return await X.save(),Response.json(W)}catch(Y){return Response.json({error:String(Y)},{status:400})}if(J.startsWith("/api/bookmarks/")&&J!=="/api/bookmarks/toggle"&&Z.method==="GET"){let Y=J.slice(15),W=X.getBookmark(Y);if(!W)return new Response("Bookmark not found",{status:404});return Response.json(W)}if(J.startsWith("/api/bookmarks/")&&Z.method==="DELETE"){let Y=J.slice(15);if(!X.deleteBookmark(Y))return new Response("Bookmark not found",{status:404});return await X.save(),Response.json({success:!0})}if(J==="/api/analytics/track"&&Z.method==="POST")try{let Y=await Z.json();if(Y.type==="view"&&Y.componentId)B.trackView(Y.componentId,Y.variantId);else if(Y.type==="prop_change"&&Y.componentId&&Y.propName)B.trackPropChange(Y.componentId,Y.propName,null);else if(Y.type==="variant_switch"&&Y.componentId&&Y.variantId)B.trackVariantSwitch(Y.componentId,Y.variantId);else if(Y.type==="search"&&Y.query)B.trackSearch(Y.query,0);return await B.save(),Response.json({success:!0})}catch(Y){return Response.json({error:String(Y)},{status:400})}if(J==="/api/analytics/summary"&&Z.method==="GET")return Response.json({mostViewed:B.getMostViewedComponents(10),mostChangedProps:B.getMostChangedProps(10),searchAnalytics:B.getSearchAnalytics()});if(J.startsWith("/api/analytics/component/")&&Z.method==="GET"){let Y=J.slice(25),W=z.storyFiles.find((U)=>U.id===Y),j=B.getComponentAnalytics(Y,W?.fileName||Y);return Response.json(j)}return new Response("Not found",{status:404})}function kz(z,J,Z){let K=Sz(z,Z);return new Response(K,{headers:{"Content-Type":"text/html; charset=utf-8"}})}function Sz(z,J){let{theme:Z}=z.config,K=Z.title||"STX Story",$=`ws://localhost:${J}/__hmr`,X=r($);return`<!DOCTYPE html>
|
|
562
562
|
<html lang="en" class="${Z.darkClass||"dark"}">
|
|
@@ -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}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}from"./chunk-7hrttzad.js";import"./chunk-vr4ycjqv.js";import"./chunk-cbj5a2tk.js";import"./chunk-fmw1mscr.js";import{Ks as a,Ls as b}from"./chunk-wfsf3vmh.js";import"./chunk-pctsgktp.js";import"./chunk-q0sgqw4m.js";import"./chunk-ecncwde8.js";import"./chunk-fdd1ccv6.js";import"./chunk-yjrdr27z.js";import"./chunk-rrxm5s7d.js";import"./chunk-9qn3f7tp.js";import"./chunk-zpkdfbyp.js";import"./chunk-b9691w0f.js";export{b as stripCommentsAndLiterals,e as renderVendorStyleTags,l as processClientScript,g as injectBrowserCoreAutoImports,k as generateServerDataBridge,i as generateBrowserAutoImportDestructuring,h as generateAutoImportDestructuring,a as findInterpolationEnd,j as extractBridgeData,d as extractAndStripCssImports,f as STX_AUTO_IMPORTS,c as BROWSER_CORE_IMPORTS};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Vq as q,Zq as y}from"./chunk-
|
|
2
|
+
import{Vq as q,Zq as y}from"./chunk-7hrttzad.js";import{Qu as L}from"./chunk-b9691w0f.js";import M from"fs";import X from"path";var T=new Map,Q=new Map;async function A(j){let z;for(let K=0;K<3;K++)try{let V=(await M.promises.stat(j)).mtime.getTime(),J=Q.get(j);if(J&&J.mtime===V)return J.content;let W=await Bun.file(j).text(),U=(await M.promises.stat(j)).mtime.getTime();if(U!==V)continue;return Q.set(j,{content:W,mtime:U}),W}catch(I){z=I;break}throw Q.delete(j),Error(`File not found: ${j}${z?` (${z.message})`:""}`)}function H(j){Q.delete(j)}function v(j){for(let B of Q.keys())if(B.startsWith(j))Q.delete(B)}var Z=null,b=null,N=null;function E(j){N=j}async function F(j=!1){let B=N??await import("./chunk-sd0rmt49.js");if(j)return B.generateSignalsRuntimeDev();if(Z===null)Z=B.generateSignalsRuntime();return Z}var $=null;async function R(){if($===null){let{getRouterScript:j}=await import("./chunk-pfhm9kh8.js");$=j()}return $}function S(){Q.clear(),y(),Z=null,b=null,$=null}function k(j){let B={debug:j.debug===!0,middleware:(j.middleware??[]).map((z)=>({name:z.name,timing:z.timing,handler:String(z.handler)})),customDirectives:(j.customDirectives??[]).map((z)=>({name:z.name,hasEndTag:z.hasEndTag===!0,handler:String(z.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(B)).digest("hex")}async function _(j,B){try{if(!B.cachePath)return null;let z=X.resolve(B.cachePath),K=X.join(z,`${D(j)}.html`),I=X.join(z,`${D(j)}.meta.json`);if(!await q(K)||!await q(I))return null;let V=await Bun.file(I).text(),J=JSON.parse(V);if(J.cacheVersion!==B.cacheVersion)return null;if(J.optionsSignature!==k(B))return null;if((await M.promises.stat(j)).mtime.getTime()>J.mtime)return null;for(let Y of J.dependencies)if(await q(Y)){if((await M.promises.stat(Y)).mtime.getTime()>J.mtime)return null}else return null;return await Bun.file(K).text()}catch(z){return console.warn(`Cache error for ${j}:`,z),null}}async function g(j,B,z,K){try{if(!K.cachePath)return;let I=X.resolve(K.cachePath);await M.promises.mkdir(I,{recursive:!0});let V=X.join(I,`${D(j)}.html`),J=X.join(I,`${D(j)}.meta.json`),W=await M.promises.stat(j);await Bun.write(V,B);let Y={sourcePath:j,mtime:W.mtime.getTime(),dependencies:Array.from(z),cacheVersion:K.cacheVersion,optionsSignature:k(K),generatedAt:Date.now()};await Bun.write(J,JSON.stringify(Y,null,2)),T.set(j,{output:B,mtime:W.mtime.getTime(),dependencies:z})}catch(I){console.warn(`Failed to cache template ${j}:`,I)}}var G=16;function D(j){return new Bun.CryptoHasher("sha1").update(j).digest("hex").substring(0,G)}
|
|
3
3
|
export{T as Oj,A as Pj,H as Qj,v as Rj,E as Sj,F as Tj,R as Uj,S as Vj,_ as Wj,g as Xj,D as Yj};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{bm as F,em as V,sm as I}from"./chunk-
|
|
2
|
+
import{bm as F,em as V,sm as I}from"./chunk-7hrttzad.js";function R(j,W){let U=1,z=W,G="<template",X="</template";while(z<j.length&&U>0){let J=j.indexOf("<",z);if(J===-1)break;if(z=J,j.startsWith(G,z)&&(z+G.length>=j.length||/[\s>\/]/.test(j[z+G.length]))){U++,z+=G.length;continue}if(j.startsWith(X,z)){let Y=j.indexOf(">",z+X.length);if(Y!==-1){if(U--,U===0)return Y+1;z=Y+1;continue}}z++}return U===0?z:-1}var P=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function D(j,W){let U=null;for(let z=W;z<j.length;z++){let G=j[z];if(U){if(G==="\\"){z++;continue}if(G===U)U=null;continue}if(G==='"'||G==="'"){U=G;continue}if(G===">")return z+1}return-1}function b(j){let W=[],U=[],z=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,G=0;while(G<j.length){let X=j.indexOf("<",G);if(X===-1)break;if(j.startsWith("<!--",X)){let $=j.indexOf("-->",X+4);G=$===-1?j.length:$+3;continue}let J=D(j,X+1);if(J===-1)break;let Y=j.slice(X,J),Q=Y.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!Q){G=J;continue}let Z=Q[1]==="/",H=Q[2].toLowerCase();if(Z){let $=U.lastIndexOf(H);if($!==-1)U.splice($);G=J;continue}if(H==="template"&&U.length===0){let $=Y.match(z);if($){let K=R(j,J);if(K!==-1){let O=$[1]||$[2]||$[3];W.push({start:X,end:K,slotName:O,content:j.slice(J,K-11).trim(),propsBinding:$[4]||void 0}),G=K;continue}}}if(!/\/\s*>$/.test(Y)&&!P.has(H)){if(U.push(H),H==="script"||H==="style"){let $=j.toLowerCase().indexOf(`</${H}>`,J);if($!==-1){G=$;continue}}}G=J}return W}function w(j){let W={default:"",named:new Map},U=j,z=b(j);for(let Q of z)W.named.set(Q.slotName,{name:Q.slotName,content:Q.content,propsBinding:Q.propsBinding});z.sort((Q,Z)=>Z.start-Q.start);for(let Q of z)U=U.slice(0,Q.start)+U.slice(Q.end);let G=[],X=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,J;while((J=X.exec(U))!==null){let[Q,Z,H,_,$,K]=J,O=H.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),B=$.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=(O+B).trim(),q=`<${Z}${L?" "+L:""}>${K}</${Z}>`;G.push({start:J.index,end:J.index+Q.length,slotName:_,element:q})}let Y=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((J=Y.exec(U))!==null){let[Q,Z,H,_,$]=J,K=H.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),O=$.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),B=(K+O).trim(),L=`<${Z}${B?" "+B:""} />`;G.push({start:J.index,end:J.index+Q.length,slotName:_,element:L})}G.sort((Q,Z)=>Z.start-Q.start);for(let Q of G){let Z=W.named.get(Q.slotName);if(Z)Z.content+=Q.element;else W.named.set(Q.slotName,{name:Q.slotName,content:Q.element});U=U.slice(0,Q.start)+U.slice(Q.end)}return W.default=U.trim(),W}function C(j){let W=j.match(/name\s*=\s*["']([^"']+)["']/),U=W?W[1]:"",z={},G=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,X;while((X=G.exec(j))!==null)z[X[1]]=X[2];let J=j.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),Y=J?J[1].trim():"";return{name:U,props:z,defaultContent:Y}}async function N(j,W,U,z){if(!j)return U;let G=j.content;if(j.propsBinding&&Object.keys(W).length>0){let X=j.propsBinding.trim(),J={...z};if(X.startsWith("{")&&X.endsWith("}")){let Y=X.slice(1,-1).split(",").map((Q)=>Q.trim()).filter(Boolean);for(let Q of Y){let[Z,H]=Q.split(":").map(($)=>$.trim()),_=H||Z;if(W[Z]!==void 0)J[_]=W[Z]}}else J[X]=W;G=k(G,J)}return G}function k(j,W){return j.replace(/\{\{\s*([^}]+)\s*\}\}/g,(U,z)=>{try{let G=z.trim(),X=y(G,W);return I(String(X??""))}catch{return`{{ ${z} }}`}})}function y(j,W){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(j)){let z=j.split("."),G=W;for(let X of z)if(G&&typeof G==="object"&&X in G)G=G[X];else return;return G}let U=j.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(U){let[,z,G,X]=U,J=W[z],Y=parseInt(X,10);if(typeof J==="number")switch(G){case"+":return J+Y;case"-":return J-Y;case"*":return J*Y;case"/":return J/Y}}try{if(!F(j))return;return V(j,Object.keys(W))(...Object.values(W))}catch{return}}async function A(j,W,U){let z=j;z=await v(z,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(J,Y,Q,Z)=>{let H=W.named.get(Y),_=Z?.trim()||"",$=Q||"",K={},O=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,B;while((B=O.exec($))!==null){let L=B[1],q=B[2];K[L]=y(q,U)}return await N(H,K,_,U)});let X=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return z=z.replace(X,(J,Y)=>{if(J.includes("name="))return J;let Q=Y?.trim()||"";return W.default||Q}),z}async function v(j,W,U){let z=[],G=[];j.replace(W,(Y,...Q)=>{let Z=Q[Q.length-2];return G.push({match:Y,index:Z}),z.push(U(Y,...Q.slice(0,-2))),Y});let X=await Promise.all(z),J=j;for(let Y=G.length-1;Y>=0;Y--){let{match:Q,index:Z}=G[Y];J=J.slice(0,Z)+X[Y]+J.slice(Z+Q.length)}return J}function E(j){let W=w(j);return{defaultSlot:W.default,namedSlots:W.named}}async function M(j,W,U,z){return await A(j,{default:W,named:U},z)}
|
|
3
3
|
export{w as Eh,C as Fh,N as Gh,A as Hh,E as Ih,M as Jh};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Am as n,Bm as o,nm as a,om as b,pm as c,qm as d,rm as e,sm as f,tm as g,um as h,vm as i,wm as j,xm as k,ym as l,zm as m}from"./chunk-
|
|
2
|
+
import{Am as n,Bm as o,nm as a,om as b,pm as c,qm as d,rm as e,sm as f,tm as g,um as h,vm as i,wm as j,xm as k,ym as l,zm as m}from"./chunk-7hrttzad.js";import"./chunk-vr4ycjqv.js";import"./chunk-cbj5a2tk.js";import"./chunk-fmw1mscr.js";import"./chunk-wfsf3vmh.js";import"./chunk-pctsgktp.js";import"./chunk-q0sgqw4m.js";import"./chunk-ecncwde8.js";import"./chunk-fdd1ccv6.js";import"./chunk-yjrdr27z.js";import"./chunk-rrxm5s7d.js";import"./chunk-9qn3f7tp.js";import"./chunk-zpkdfbyp.js";import"./chunk-b9691w0f.js";export{h as usesSignalsInScript,o as unescapeHtml,c as registerFilters,b as registerFilter,l as processExpressions,k as interpolateScriptsInTemplate,i as interpolateScriptExpressions,j as interpolateScriptAttributes,d as getAllFilters,n as evaluateExpression,g as escapeHtmlValue,f as escapeHtml,a as defaultFilters,e as clearCustomFilters,m as applyFilters};
|