@stacksjs/stx 0.2.210 → 0.2.212
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-4fe1ypxz.js → chunk-0rpqx6xa.js} +1 -1
- package/dist/{chunk-7ry55nms.js → chunk-1306tswx.js} +1 -1
- package/dist/{chunk-1bq2xyax.js → chunk-1hx2z3m0.js} +1 -1
- package/dist/{chunk-kjr22neh.js → chunk-1nm2xrvq.js} +1 -1
- package/dist/{chunk-ycn1vnv2.js → chunk-1nnpwrqj.js} +1 -1
- package/dist/{chunk-12n9mz15.js → chunk-1wfvhxjz.js} +1 -1
- package/dist/{chunk-mjt5e2jy.js → chunk-2me28xee.js} +1 -1
- package/dist/chunk-2vdxfjxw.js +2 -0
- package/dist/{chunk-jr5tp4ks.js → chunk-2w5d5tw1.js} +1 -1
- package/dist/chunk-2xeq5xnf.js +2 -0
- package/dist/{chunk-nye9brje.js → chunk-3fwn9edg.js} +1 -1
- package/dist/{chunk-zda3hvde.js → chunk-3twce5kp.js} +1 -1
- package/dist/{chunk-dtmwr674.js → chunk-3wd9kfyz.js} +1 -1
- package/dist/chunk-3z8tp7v4.js +2 -0
- package/dist/{chunk-wnaddtv3.js → chunk-47pge5gz.js} +1 -1
- package/dist/chunk-4vwxgmg0.js +2 -0
- package/dist/{chunk-x0ks1fer.js → chunk-53ajah3v.js} +1 -1
- package/dist/{chunk-vydqh4xr.js → chunk-5ckn8vbq.js} +1 -1
- package/dist/{chunk-a2899x2t.js → chunk-5gr4vv7m.js} +1 -1
- package/dist/chunk-62gc6qg9.js +2 -0
- package/dist/{chunk-cm0ykjs1.js → chunk-655pb2nj.js} +1 -1
- package/dist/chunk-66630av9.js +2 -0
- package/dist/{chunk-whq99ytc.js → chunk-6ndvtzpk.js} +1 -1
- package/dist/{chunk-x0zh76yv.js → chunk-6xg3j487.js} +1 -1
- package/dist/chunk-7jq78m57.js +2 -0
- package/dist/{chunk-h2wpnxrh.js → chunk-7mst8kqm.js} +1 -1
- package/dist/{chunk-r41nsgym.js → chunk-7zk48rd8.js} +1 -1
- package/dist/{chunk-xp3fp266.js → chunk-8anh6d36.js} +1 -1
- package/dist/chunk-8xtvmwpr.js +2 -0
- package/dist/{chunk-ryjpp51z.js → chunk-96kpqgh3.js} +1 -1
- package/dist/{chunk-910sy8sk.js → chunk-9whrwhx4.js} +1 -1
- package/dist/{chunk-ygr11tgz.js → chunk-a2rj5ce0.js} +1 -1
- package/dist/chunk-amv1v5qf.js +2 -0
- package/dist/{chunk-3nmpfsw5.js → chunk-aw9z3m10.js} +1 -1
- package/dist/chunk-ba18hn7n.js +2 -0
- package/dist/{chunk-abpw3b39.js → chunk-bsr7yrxh.js} +1 -1
- package/dist/{chunk-5n0dt838.js → chunk-c0p9kf53.js} +1 -1
- package/dist/chunk-c11nnxkg.js +2 -0
- package/dist/{chunk-dhpy0h9y.js → chunk-c7pvwvse.js} +1 -1
- package/dist/chunk-cf6npetr.js +2 -0
- package/dist/{chunk-vr3qtsj4.js → chunk-cqt6ry1e.js} +1 -1
- package/dist/{chunk-rs2fa3g1.js → chunk-cr7s8q08.js} +1 -1
- package/dist/{chunk-xm6kwq2r.js → chunk-d8hzg54c.js} +2 -2
- package/dist/chunk-drzrf2t7.js +2 -0
- package/dist/chunk-e4h9zd1m.js +2 -0
- package/dist/{chunk-44423f7c.js → chunk-ejrtygcb.js} +1 -1
- package/dist/{chunk-gcns5vw5.js → chunk-em4wy7zv.js} +1 -1
- package/dist/chunk-eva1mgf5.js +2 -0
- package/dist/{chunk-wtengj6h.js → chunk-f6jm4hy3.js} +1 -1
- package/dist/{chunk-vpwjr05r.js → chunk-fc3g2z0p.js} +1 -1
- package/dist/{chunk-bmpkpgx2.js → chunk-hnrtw0rd.js} +10 -10
- package/dist/{chunk-9kf4q3ec.js → chunk-hq60td8b.js} +1 -1
- package/dist/{chunk-jsndbe2q.js → chunk-hz1jcwdb.js} +1 -1
- package/dist/{chunk-8src5smc.js → chunk-j0tfxbns.js} +2 -2
- package/dist/{chunk-nsjyn31z.js → chunk-j5vyt8wd.js} +1 -1
- package/dist/{chunk-gcnrdgrq.js → chunk-khrtzbxd.js} +1 -1
- package/dist/{chunk-cbc56wpd.js → chunk-m2mhtpwy.js} +1 -1
- package/dist/{chunk-n9eahkjg.js → chunk-mm0f84gm.js} +196 -196
- package/dist/{chunk-mkm91b6w.js → chunk-msjzqne1.js} +1 -1
- package/dist/{chunk-7w4c5w2b.js → chunk-ne8sygmy.js} +1 -1
- package/dist/{chunk-syy7d9w2.js → chunk-nrksd914.js} +1 -1
- package/dist/chunk-nvfawtpq.js +2 -0
- package/dist/{chunk-ndnc7k2n.js → chunk-p7qqbw2k.js} +1 -1
- package/dist/{chunk-xfp10a23.js → chunk-p8pyqr7p.js} +1 -1
- package/dist/{chunk-0ae6chzd.js → chunk-q4se9rtw.js} +1 -1
- package/dist/chunk-r153ybwd.js +2 -0
- package/dist/chunk-r7qzjt0h.js +2 -0
- package/dist/{chunk-va9k88da.js → chunk-rczpw37w.js} +1 -1
- package/dist/{chunk-jpbk42j7.js → chunk-rg6v68ya.js} +1 -1
- package/dist/{chunk-1e25ksp6.js → chunk-s7dqawk0.js} +1 -1
- package/dist/chunk-s9pa2var.js +2 -0
- package/dist/chunk-sgxjx75w.js +2 -0
- package/dist/{chunk-e0bk1mqp.js → chunk-sk8ybwpe.js} +1 -1
- package/dist/{chunk-hb83d0qc.js → chunk-srdwsrnj.js} +1 -1
- package/dist/{chunk-5gb0zjx0.js → chunk-t82z0cbv.js} +1 -1
- package/dist/{chunk-pw0rzgpv.js → chunk-trtm887x.js} +1 -1
- package/dist/{chunk-qz75kx6n.js → chunk-tryt2h85.js} +1 -1
- package/dist/chunk-vgr8kykv.js +2 -0
- package/dist/{chunk-5s2y052b.js → chunk-w670sde5.js} +1 -1
- package/dist/{chunk-4pf61rcb.js → chunk-wbq7cp57.js} +1 -1
- package/dist/{chunk-nenge2m2.js → chunk-whxregkn.js} +1 -1
- package/dist/{chunk-qpcwahse.js → chunk-x8b16v5q.js} +1 -1
- package/dist/{chunk-n35c984x.js → chunk-xerx4bn9.js} +2 -2
- package/dist/chunk-xgxjp647.js +2 -0
- package/dist/{chunk-q02jg1pk.js → chunk-xkd164zg.js} +1 -1
- package/dist/{chunk-e0460y7f.js → chunk-y2jr10y8.js} +1 -1
- package/dist/chunk-y8m9n9v6.js +2 -0
- package/dist/{chunk-jvqjh17y.js → chunk-yb6f8ey1.js} +3 -3
- package/dist/chunk-yhn2saa7.js +2 -0
- package/dist/{chunk-5hpp0vzz.js → chunk-yk1smsev.js} +1 -1
- package/dist/{chunk-abzhv6v3.js → chunk-yvgjys59.js} +1 -1
- package/dist/chunk-yxefre1s.js +2 -0
- package/dist/{chunk-spn8e3b3.js → chunk-z0hkt5sk.js} +1 -1
- package/dist/{chunk-3952ykhb.js → chunk-z47tw39z.js} +2 -2
- package/dist/{chunk-nngpktr2.js → chunk-zj44h5kk.js} +1 -1
- package/dist/{chunk-evxg9pe7.js → chunk-znsffkmk.js} +1 -1
- package/dist/{chunk-m0sd10cs.js → chunk-zsfpwqrt.js} +1 -1
- package/dist/{chunk-1mhc4g86.js → chunk-zxb128xa.js} +1 -1
- package/dist/cli.js +14 -14
- package/dist/component-renderer.d.ts +2 -0
- package/dist/component-renderer.js +5 -3
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/database.js +1 -1
- package/dist/loops.js +8 -2
- package/dist/pwa.js +2 -2
- package/dist/safe-evaluator.d.ts +22 -0
- package/dist/safe-evaluator.js +3 -0
- package/dist/ssg.js +2 -2
- package/dist/visual-testing.js +1 -1
- package/package.json +5 -5
- package/dist/chunk-00a028s3.js +0 -2
- package/dist/chunk-02n7khen.js +0 -2
- package/dist/chunk-0kdc3x7v.js +0 -2
- package/dist/chunk-2z6br22w.js +0 -2
- package/dist/chunk-3acgbcv6.js +0 -2
- package/dist/chunk-3vy1q9da.js +0 -2
- package/dist/chunk-5dxctm6h.js +0 -2
- package/dist/chunk-5xpp3z95.js +0 -2
- package/dist/chunk-66081bkn.js +0 -2
- package/dist/chunk-6bxcjdp4.js +0 -2
- package/dist/chunk-8sx4vf6p.js +0 -2
- package/dist/chunk-bpvp21dd.js +0 -2
- package/dist/chunk-btgrvrxy.js +0 -2
- package/dist/chunk-ehfzp7xe.js +0 -2
- package/dist/chunk-g9kvpgha.js +0 -2
- package/dist/chunk-k03erdj7.js +0 -2
- package/dist/chunk-k25mqtht.js +0 -2
- package/dist/chunk-me5h5mkq.js +0 -2
- package/dist/chunk-mtr2f82n.js +0 -2
- package/dist/chunk-mz5hjxjv.js +0 -2
- package/dist/chunk-nd9d80gb.js +0 -2
- package/dist/chunk-sry9atvv.js +0 -2
- package/dist/chunk-t98920tc.js +0 -2
- package/dist/chunk-xz019t7t.js +0 -2
- package/dist/chunk-z21qzyh1.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Fh as x,Kh as M,Lh as C,Mh as v,Nh as P}from"./chunk-q8szpd6w.js";import{
|
|
2
|
+
import{Fh as x,Kh as M,Lh as C,Mh as v,Nh as P}from"./chunk-q8szpd6w.js";import{iu as y}from"./chunk-trtm887x.js";import{resolve as h,basename as f,extname as u,join as m}from"path";import{mkdir as l}from"fs/promises";var I={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0};class z{config;constructor(J={}){this.config={...I,...J}}async get(J,Z){return C(J,Z,"image",this.config)}async set(J,Z,Y){return v(J,Z,Y,"image",this.config)}async clear(){return P("image",this.config)}updateConfig(J){this.config={...this.config,...J}}}var H=null;function S(J){if(!H)H=new z(J);else if(J)H.updateConfig(J);return H}async function w(J,Z,Y){let K=Y?{directory:`${Y.outputDir}/../.cache`}:{};return S(K).get(J,Z)}async function Q(J,Z,Y,K){let X=K?{directory:`${K.outputDir}/../.cache`}:{};return S(X).set(J,Z,Y)}async function d(){return S().clear()}async function R(){try{return await import("ts-images")}catch{return null}}function b(J){switch(J){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function p(J,Z){let Y=Z?b(Z):b("web"),K=J.formatQuality||{};return{jpeg:{...Y.jpeg,...K.jpeg},png:{...Y.png,...K.png},webp:{...Y.webp,...K.webp},avif:{...Y.avif,...K.avif}}}async function g(J,Z,Y){let K=await R();if(!K)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:J,processed:!1};let X=await w(J,Z,Y);if(X)return X;try{let N=h(J);if(!await M(N))return{src:J,processed:!1,errors:[`Source file not found: ${J}`]};let L=p(Y,Z.preset),V=Y.outputDir||"dist/images",F=Y.baseUrl||"/images";await l(V,{recursive:!0});let q=await x(N),U=f(J,u(J)),E=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],G={src:J,processed:!0,variants:[],hash:q},j=null;if(Z.transformations&&Z.transformations.length>0)j=await D(N,Z.transformations,K);for(let $ of E){let A=L[$]||{},W=`${U}-${q}.${$}`,_=m(V,W);try{let O=await K.optimizeImage({input:j||N,output:_,format:$,quality:A.quality,progressive:A.progressive});if(O){if(G.variants.push({path:_,url:`${F}/${W}`,width:O.width||0,height:O.height||0,format:$,size:O.outputSize||0}),!G.originalWidth&&O.width)G.originalWidth=O.width,G.originalHeight=O.height}}catch(O){G.errors=G.errors||[],G.errors.push(`Failed to optimize ${$}: ${O}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let $=await K.generateThumbHash(N);G.placeholder=$.dataUrl}catch($){G.errors=G.errors||[],G.errors.push(`Failed to generate thumbhash: ${$}`)}if(Z.useDominantColor)try{let $=await K.generatePlaceholder(N,{strategy:"dominant-color"});G.dominantColor=$.dominantColor}catch($){G.errors=G.errors||[],G.errors.push(`Failed to extract dominant color: ${$}`)}return await Q(J,Z,G,Y),G}catch(N){return{src:J,processed:!1,errors:[`Processing failed: ${N}`]}}}async function n(J,Z,Y,K){let X=await R();if(!X)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await X.optimizeImage({input:J,output:K,format:Z,quality:Y}))?.outputSize}}catch(N){return{success:!1,error:String(N)}}}async function D(J,Z,Y){let K=Y||await R();if(!K)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let X=await K.decode(J);for(let N of Z){let L=N.options||{};switch(N.type){case"resize":if(L.width||L.height)X=await K.resize(X,{width:L.width,height:L.height,fit:L.fit});break;case"blur":if(L.sigma!==void 0)X=await K.blur(X,L.sigma);break;case"sharpen":if(L.amount!==void 0)X=await K.sharpen(X,L.amount);break;case"grayscale":X=await K.grayscale(X);break;case"rotate":if(L.angle!==void 0)X=await K.rotate(X,L.angle);break;case"flip":X=await K.flip(X);break;case"flop":X=await K.flop(X);break;case"brightness":if(L.value!==void 0)X=await K.brightness(X,L.value);break;case"contrast":if(L.value!==void 0)X=await K.contrast(X,L.value);break;case"saturation":if(L.value!==void 0)X=await K.saturation(X,L.value);break}}return await K.encode(X,"png")}catch(X){return console.error(`[stx-media] Transformation failed: ${X}`),null}}import{resolve as c,basename as i,extname as r,join as o}from"path";import{mkdir as a}from"fs/promises";async function e(){try{return await import("ts-images")}catch{return null}}var s=[320,480,640,768,1024,1280,1536,1920];async function t(J,Z,Y){let K=await e();if(!K)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let X=c(J);if(!await M(X))return console.warn(`[stx-media] Source file not found: ${J}`),null;try{let N=Z.responsiveWidths||Y.breakpoints||s,L=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],V=Y.outputDir||"dist/images",F=Y.baseUrl||"/images";await a(V,{recursive:!0});let q=await x(X),U=i(J,r(J)),E=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},G={src:J,byFormat:{},srcsets:{}};for(let $ of L){G.byFormat[$]=[];let A=[];for(let W of N){let _=`${U}-${W}w-${q}.${$}`,O=o(V,_),B=`${F}/${_}`;try{let T=E[$]?.quality||80;if(await M(O)){G.byFormat[$].push({path:O,url:B,width:W,height:0,format:$,size:0}),A.push(`${B} ${W}w`);continue}let k=await K.processImage({input:X,output:O,format:$,quality:T,resize:{width:W}});if(k)G.byFormat[$].push({path:O,url:B,width:W,height:k.height||Math.round(W*(k.height||1)/(k.width||1)),format:$,size:k.outputSize||0}),A.push(`${B} ${W}w`)}catch(T){console.warn(`[stx-media] Failed to generate ${$} at ${W}w: ${T}`)}}G.srcsets[$]=A.join(", ")}let j=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(j!=="none")try{if(j==="thumbhash"){let $=await K.generateThumbHash(X);G.placeholder={dataURL:$.dataUrl,width:$.width||32,height:$.height||32,strategy:"thumbhash"}}else{let $=await K.generatePlaceholder(X,{strategy:j,width:20});G.placeholder={dataURL:$.dataURL,width:$.width,height:$.height,strategy:j}}}catch($){console.warn(`[stx-media] Failed to generate placeholder: ${$}`)}return G.sizes=Z.sizes||JJ(N),G}catch(N){return console.error(`[stx-media] Responsive generation failed: ${N}`),null}}function JJ(J){let Z=[...J].sort((K,X)=>K-X),Y=[];for(let K=0;K<Z.length-1;K++){let X=Z[K];Y.push(`(max-width: ${X}px) ${X}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function KJ(J,Z="width"){if(!J||J.length===0)return"";if(Z==="dpr")return J.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return J.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}export{z as lh,w as mh,Q as nh,d as oh,g as ph,n as qh,D as rh,t as sh,KJ as th};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{dj as a,ej as b,fj as c,gj as d,hj as e,ij as f}from"./chunk-hyrjade7.js";import"./chunk-
|
|
2
|
+
import{dj as a,ej as b,fj as c,gj as d,hj as e,ij as f}from"./chunk-hyrjade7.js";import"./chunk-trtm887x.js";export{c as processTransitionDirectives,f as processTransitionAttributes,b as performLeave,a as performEnter,e as generateTransitionRuntime,d as generateTransitionCSS};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Tg as n}from"./chunk-5gb0zjx0.js";import{Mo as f,Xp as p,am as b,bm as S,km as k,rm as q}from"./chunk-n9eahkjg.js";import{Vt as c,Zt as XG,st as d}from"./chunk-3952ykhb.js";import{hu as T}from"./chunk-pw0rzgpv.js";import l from"fs";import F from"path";var{serve:ZG}=globalThis.Bun;function R(G,J,K={}){let Q=`${encodeURIComponent(G)}=${encodeURIComponent(J)}`;if(K.maxAge!==void 0)Q+=`; Max-Age=${K.maxAge}`;if(K.expires)Q+=`; Expires=${K.expires.toUTCString()}`;if(K.path)Q+=`; Path=${K.path}`;if(K.domain)Q+=`; Domain=${K.domain}`;if(K.secure)Q+="; Secure";if(K.httpOnly)Q+="; HttpOnly";if(K.sameSite)Q+=`; SameSite=${K.sameSite}`;return Q}async function i(G){let J=G.headers.get("content-type")||"",K={},Q=(X,Z)=>{let $=K[X];if($===void 0)K[X]=Z;else if(Array.isArray($))$.push(Z);else K[X]=[$,Z]};if(J.includes("multipart/form-data")){let X=await G.formData();for(let[Z,$]of X.entries())if(typeof $==="string")Q(Z,$);return K}if(J.includes("application/x-www-form-urlencoded")){for(let[X,Z]of new URLSearchParams(await G.text()).entries())Q(X,Z);return K}return K}function C(G){if(!G)return!1;let J=G.toUpperCase();return J!=="GET"&&J!=="HEAD"}async function y(G,J={}){let K=J.request,Q=J.method??K?.method;if(!K||!C(Q))return{ran:!1};if(typeof G.action!=="function")return{ran:!1};let X={};try{X=await i(K)}catch{}let Z=await G.action({request:K,form:X,params:J.params??{},query:G.query??{},cookies:J.cookies??{}});if(Z&&typeof Z==="object"){let $=Z,U=a($.cookies),I=$.redirect;if(typeof I==="string"&&I)return{redirect:I,ran:!0,...U.length>0?{cookies:U}:{}};let{cookies:V,redirect:A,...O}=$;if(Object.assign(G,O),U.length>0)return{ran:!0,cookies:U}}return{ran:!0}}function a(G){if(!G||typeof G!=="object"||Array.isArray(G))return[];let J=[];for(let[K,Q]of Object.entries(G)){if(!K)continue;if(typeof Q==="string"){J.push(R(K,Q));continue}if(Q&&typeof Q==="object"){let X=Q;if(typeof X.value!=="string")continue;J.push(R(K,X.value,X))}}return J}function v(G,J=[]){let K=new Headers({Location:G,"Cache-Control":"no-store"});for(let Q of J)K.append("Set-Cookie",Q);return new Response(null,{status:303,headers:K})}async function LG(G,J={}){return(await x(G,J)).html}async function g(G,J={}){let{html:K,context:Q,redirect:X,cookies:Z}=await x(G,J);if(X)return{html:K,redirect:X,cookies:Z};let{extractStreamBoundaries:$}=await import("./chunk-vpwjr05r.js"),U=$(Q),I=G.streamTemplates;if(I&&Object.keys(I).length>0){let{processDirectives:V}=await import("./chunk-3acgbcv6.js"),{defaultConfig:A}=await import("./chunk-z21qzyh1.js"),O=Q.streamBoundaries||{},D={...A,autoShell:!1},j=Object.keys(I).map((_)=>({id:_,render:async()=>{let M=typeof O[_]==="function"?await O[_]():void 0;return V(I[_],{...Q,$boundary:M},G.sourceFile,D,new Set)}})),N=new Set(j.map((_)=>_.id));U=[...(U||[]).filter((_)=>!N.has(_.id)),...j]}return{html:K,boundaries:U&&U.length>0?U:void 0,cookies:Z}}async function x(G,J){let K={__filename:G.sourceFile,__dirname:G.sourceFile.replace(/[/\\][^/\\]+$/,""),...J};if(!G.hasServerScripts&&!S(G.html))return{html:G.html,context:K};for(let Z of G.serverScriptContent)try{await f(Z,K,G.sourceFile)}catch($){console.warn(`[stx] Server script error in ${G.sourceFile}:`,$)}let Q=await y(K,{request:J.request,method:J.method,params:J.params??{},cookies:J.cookies??{}});if(Q.redirect)return{html:G.html,context:K,redirect:Q.redirect,cookies:Q.cookies};if(!S(G.html))return{html:G.html,context:K,cookies:Q.cookies};let X=new Map;for(let[Z,$]of Object.entries(G.placeholders))if($.expression)try{let U=q($.expression,K);if($.type==="raw")X.set(Z,U!==void 0&&U!==null?String(U):"");else X.set(Z,U!==void 0&&U!==null?k(String(U)):"")}catch{X.set(Z,"")}return{html:b(G.html,X),context:K,cookies:Q.cookies}}async function VG(G,J={}){if(!G.hasServerScripts&&!S(G.fragment))return G.fragment;let K={__filename:G.sourceFile,__dirname:G.sourceFile.replace(/[/\\][^/\\]+$/,""),...J};for(let X of G.serverScriptContent)try{await f(X,K,G.sourceFile)}catch(Z){console.warn(`[stx] Server script error in ${G.sourceFile}:`,Z)}if(!S(G.fragment))return G.fragment;let Q=new Map;for(let[X,Z]of Object.entries(G.placeholders))if(Z.expression)try{let $=q(Z.expression,K);if(Z.type==="raw")Q.set(X,$!==void 0&&$!==null?String($):"");else Q.set(X,$!==void 0&&$!==null?k(String($)):"")}catch{Q.set(X,"")}return b(G.fragment,Q)}XG();import E from"zlib";import{promisify as u}from"util";var s=u(E.brotliCompress),t=u(E.gzip),o=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],e=["text/event-stream","multipart/x-mixed-replace"],GG=1024;function JG(G){if(!G)return!1;let J=G.toLowerCase();if(e.some((K)=>J.startsWith(K)))return!1;return o.some((K)=>J.startsWith(K))}function KG(G){let J=new Map;for(let K of G.split(",")){let[Q,...X]=K.trim().split(";"),Z=Q.trim().toLowerCase();if(!Z)continue;let $=1;for(let U of X){let I=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(U);if(!I)continue;let V=Number.parseFloat(I[1]);if(Number.isFinite(V))$=V}J.set(Z,$)}return J}function QG(G){if(!G)return null;let J=KG(G),K=J.get("*"),Q=(X)=>J.get(X)??K??0;if(Q("br")>0)return"br";if(Q("gzip")>0)return"gzip";return null}async function m(G,J,K={}){if(J.headers.get("content-encoding"))return J;if(J.status===204||J.status===304||!J.body)return J;if(!JG(J.headers.get("content-type")))return J;let Q=QG(G.headers.get("accept-encoding"));if(!Q)return J;let X;try{X=new Uint8Array(await J.arrayBuffer())}catch{return J}let Z=()=>new Response(X,{status:J.status,statusText:J.statusText,headers:h(J.headers)});if(X.length<(K.threshold??GG))return Z();try{let $=Q==="br"?await s(X,{params:{[E.constants.BROTLI_PARAM_QUALITY]:K.quality??5,[E.constants.BROTLI_PARAM_SIZE_HINT]:X.length}}):await t(X);if($.length>=X.length)return Z();let U=h(J.headers);return U.set("Content-Encoding",Q),U.set("Content-Length",String($.length)),new Response($,{status:J.status,statusText:J.statusText,headers:U})}catch{return Z()}}function h(G){let J=new Headers(G),K=J.get("Vary");if(!K)return J.set("Vary","Accept-Encoding"),J;if(!K.split(",").some((X)=>X.trim().toLowerCase()==="accept-encoding"))J.set("Vary",`${K}, Accept-Encoding`);return J}var $G={".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 bG(G={}){let J=F.resolve(G.outputDir||".output"),K=G.port||3000,Q=n(J);if(!Q)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${Q.routes.length} routes...`);let X=new Map,Z=new Map,$=new Map,U=new Map;for(let O of Q.routes)try{let D=F.join(J,O.compiledPath),j=JSON.parse(await Bun.file(D).text());X.set(O.pattern,j),$.set(O.pattern,c(j.html)),U.set(O.pattern,p(j.html));let N=F.join(J,O.fragmentPath);if(await Bun.file(N).exists())Z.set(O.pattern,await Bun.file(N).text())}catch(D){console.warn(`[stx] Failed to load route ${O.pattern}:`,D)}let I=new Map,V=[];for(let O of Q.routes)if(O.hasParams){let{regex:D,params:j}=d(O.pattern);V.push({regex:D,route:O,paramNames:j})}else I.set(O.pattern,O);let A=ZG({port:K,async fetch(O){return m(O,await(async()=>{let j=new URL(O.url).pathname;if(G.onRequest){let W=await G.onRequest(O);if(W)return W}if(G.apiRoutes?.[j])return G.apiRoutes[j](O);if((O.method==="GET"||O.method==="HEAD")&&j!=="/"){let W=F.resolve(J,"public"),Y;try{Y=decodeURIComponent(j)}catch{Y=j}if(!Y.includes("\x00")){let L=F.resolve(W,`.${Y}`);if(L===W||L.startsWith(`${W}${F.sep}`))try{if(l.existsSync(L)&&l.statSync(L).isFile()){let w=F.extname(L).toLowerCase(),H=$G[w]||"application/octet-stream",P=j.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(j);return new Response(Bun.file(L),{headers:{"Content-Type":H,"Cache-Control":P?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let N=O.headers.get("X-STX-Router")==="true",_=null,M={};if(_=I.get(j)||null,!_)for(let{regex:W,route:Y,paramNames:L}of V){let B=j.match(W);if(B){_=Y,L.forEach((w,H)=>{M[w]=B[H+1]});break}}if(!_){let W=I.get("/404")||null;if(W){let Y=X.get(W.pattern);if(Y)return new Response(Y.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})}if(N){let W=Z.get(_.pattern);if(W){let Y=$.get(_.pattern);return new Response(W,{headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...U.has(_.pattern)?{"X-STX-Runtime":U.get(_.pattern)?"true":"false"}:{},...Y?{"X-STX-Layout":Y.layout,"X-STX-Layout-Group":Y.group}:{},"Cache-Control":"no-cache"}})}}let r=C(O.method),z=X.get(_.pattern);if(!z){let W=I.get("/500")||null;if(W){let Y=X.get(W.pattern);if(Y)return new Response(Y.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(!r&&!z.hasServerScripts&&Object.keys(z.placeholders).length===0)return new Response(z.html,{headers:{"Content-Type":"text/html","Cache-Control":"public, max-age=60"}});try{let{html:W,boundaries:Y,redirect:L,cookies:B}=await g(z,{params:M,request:O,method:O.method});if(L)return v(L,B);if(Y&&Y.length>0){let{renderStreamingPage:H,streamToResponse:P}=await import("./chunk-vpwjr05r.js");return P(H(W,Y,{timeoutMs:30000}),{headers:{"Cache-Control":"no-cache"}})}let w=new Headers({"Content-Type":"text/html","Cache-Control":"no-cache"});for(let H of B??[])w.append("Set-Cookie",H);return new Response(W,{headers:w})}catch(W){return console.error(`[stx] Hydration error for ${j}:`,W),new Response(z.html,{headers:{"Content-Type":"text/html"}})}})())}});return console.log(`[stx] Production server running at http://localhost:${K}`),console.log(`[stx] Serving ${Q.routes.length} routes (${X.size} pre-loaded)`),{port:K,stop:()=>A.stop()}}
|
|
2
|
+
import{Tg as n}from"./chunk-t82z0cbv.js";import{No as f,Yp as p,bm as b,cm as S,lm as k,sm as q}from"./chunk-mm0f84gm.js";import{Wt as c,_t as XG,tt as d}from"./chunk-z47tw39z.js";import{iu as T}from"./chunk-trtm887x.js";import l from"fs";import F from"path";var{serve:ZG}=globalThis.Bun;function R(G,J,K={}){let Q=`${encodeURIComponent(G)}=${encodeURIComponent(J)}`;if(K.maxAge!==void 0)Q+=`; Max-Age=${K.maxAge}`;if(K.expires)Q+=`; Expires=${K.expires.toUTCString()}`;if(K.path)Q+=`; Path=${K.path}`;if(K.domain)Q+=`; Domain=${K.domain}`;if(K.secure)Q+="; Secure";if(K.httpOnly)Q+="; HttpOnly";if(K.sameSite)Q+=`; SameSite=${K.sameSite}`;return Q}async function i(G){let J=G.headers.get("content-type")||"",K={},Q=(X,Z)=>{let $=K[X];if($===void 0)K[X]=Z;else if(Array.isArray($))$.push(Z);else K[X]=[$,Z]};if(J.includes("multipart/form-data")){let X=await G.formData();for(let[Z,$]of X.entries())if(typeof $==="string")Q(Z,$);return K}if(J.includes("application/x-www-form-urlencoded")){for(let[X,Z]of new URLSearchParams(await G.text()).entries())Q(X,Z);return K}return K}function C(G){if(!G)return!1;let J=G.toUpperCase();return J!=="GET"&&J!=="HEAD"}async function y(G,J={}){let K=J.request,Q=J.method??K?.method;if(!K||!C(Q))return{ran:!1};if(typeof G.action!=="function")return{ran:!1};let X={};try{X=await i(K)}catch{}let Z=await G.action({request:K,form:X,params:J.params??{},query:G.query??{},cookies:J.cookies??{}});if(Z&&typeof Z==="object"){let $=Z,U=a($.cookies),I=$.redirect;if(typeof I==="string"&&I)return{redirect:I,ran:!0,...U.length>0?{cookies:U}:{}};let{cookies:V,redirect:A,...O}=$;if(Object.assign(G,O),U.length>0)return{ran:!0,cookies:U}}return{ran:!0}}function a(G){if(!G||typeof G!=="object"||Array.isArray(G))return[];let J=[];for(let[K,Q]of Object.entries(G)){if(!K)continue;if(typeof Q==="string"){J.push(R(K,Q));continue}if(Q&&typeof Q==="object"){let X=Q;if(typeof X.value!=="string")continue;J.push(R(K,X.value,X))}}return J}function v(G,J=[]){let K=new Headers({Location:G,"Cache-Control":"no-store"});for(let Q of J)K.append("Set-Cookie",Q);return new Response(null,{status:303,headers:K})}async function LG(G,J={}){return(await x(G,J)).html}async function g(G,J={}){let{html:K,context:Q,redirect:X,cookies:Z}=await x(G,J);if(X)return{html:K,redirect:X,cookies:Z};let{extractStreamBoundaries:$}=await import("./chunk-fc3g2z0p.js"),U=$(Q),I=G.streamTemplates;if(I&&Object.keys(I).length>0){let{processDirectives:V}=await import("./chunk-eva1mgf5.js"),{defaultConfig:A}=await import("./chunk-nvfawtpq.js"),O=Q.streamBoundaries||{},D={...A,autoShell:!1},j=Object.keys(I).map((_)=>({id:_,render:async()=>{let M=typeof O[_]==="function"?await O[_]():void 0;return V(I[_],{...Q,$boundary:M},G.sourceFile,D,new Set)}})),N=new Set(j.map((_)=>_.id));U=[...(U||[]).filter((_)=>!N.has(_.id)),...j]}return{html:K,boundaries:U&&U.length>0?U:void 0,cookies:Z}}async function x(G,J){let K={__filename:G.sourceFile,__dirname:G.sourceFile.replace(/[/\\][^/\\]+$/,""),...J};if(!G.hasServerScripts&&!S(G.html))return{html:G.html,context:K};for(let Z of G.serverScriptContent)try{await f(Z,K,G.sourceFile)}catch($){console.warn(`[stx] Server script error in ${G.sourceFile}:`,$)}let Q=await y(K,{request:J.request,method:J.method,params:J.params??{},cookies:J.cookies??{}});if(Q.redirect)return{html:G.html,context:K,redirect:Q.redirect,cookies:Q.cookies};if(!S(G.html))return{html:G.html,context:K,cookies:Q.cookies};let X=new Map;for(let[Z,$]of Object.entries(G.placeholders))if($.expression)try{let U=q($.expression,K);if($.type==="raw")X.set(Z,U!==void 0&&U!==null?String(U):"");else X.set(Z,U!==void 0&&U!==null?k(String(U)):"")}catch{X.set(Z,"")}return{html:b(G.html,X),context:K,cookies:Q.cookies}}async function VG(G,J={}){if(!G.hasServerScripts&&!S(G.fragment))return G.fragment;let K={__filename:G.sourceFile,__dirname:G.sourceFile.replace(/[/\\][^/\\]+$/,""),...J};for(let X of G.serverScriptContent)try{await f(X,K,G.sourceFile)}catch(Z){console.warn(`[stx] Server script error in ${G.sourceFile}:`,Z)}if(!S(G.fragment))return G.fragment;let Q=new Map;for(let[X,Z]of Object.entries(G.placeholders))if(Z.expression)try{let $=q(Z.expression,K);if(Z.type==="raw")Q.set(X,$!==void 0&&$!==null?String($):"");else Q.set(X,$!==void 0&&$!==null?k(String($)):"")}catch{Q.set(X,"")}return b(G.fragment,Q)}XG();import E from"zlib";import{promisify as u}from"util";var s=u(E.brotliCompress),t=u(E.gzip),o=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],e=["text/event-stream","multipart/x-mixed-replace"],GG=1024;function JG(G){if(!G)return!1;let J=G.toLowerCase();if(e.some((K)=>J.startsWith(K)))return!1;return o.some((K)=>J.startsWith(K))}function KG(G){let J=new Map;for(let K of G.split(",")){let[Q,...X]=K.trim().split(";"),Z=Q.trim().toLowerCase();if(!Z)continue;let $=1;for(let U of X){let I=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(U);if(!I)continue;let V=Number.parseFloat(I[1]);if(Number.isFinite(V))$=V}J.set(Z,$)}return J}function QG(G){if(!G)return null;let J=KG(G),K=J.get("*"),Q=(X)=>J.get(X)??K??0;if(Q("br")>0)return"br";if(Q("gzip")>0)return"gzip";return null}async function m(G,J,K={}){if(J.headers.get("content-encoding"))return J;if(J.status===204||J.status===304||!J.body)return J;if(!JG(J.headers.get("content-type")))return J;let Q=QG(G.headers.get("accept-encoding"));if(!Q)return J;let X;try{X=new Uint8Array(await J.arrayBuffer())}catch{return J}let Z=()=>new Response(X,{status:J.status,statusText:J.statusText,headers:h(J.headers)});if(X.length<(K.threshold??GG))return Z();try{let $=Q==="br"?await s(X,{params:{[E.constants.BROTLI_PARAM_QUALITY]:K.quality??5,[E.constants.BROTLI_PARAM_SIZE_HINT]:X.length}}):await t(X);if($.length>=X.length)return Z();let U=h(J.headers);return U.set("Content-Encoding",Q),U.set("Content-Length",String($.length)),new Response($,{status:J.status,statusText:J.statusText,headers:U})}catch{return Z()}}function h(G){let J=new Headers(G),K=J.get("Vary");if(!K)return J.set("Vary","Accept-Encoding"),J;if(!K.split(",").some((X)=>X.trim().toLowerCase()==="accept-encoding"))J.set("Vary",`${K}, Accept-Encoding`);return J}var $G={".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 bG(G={}){let J=F.resolve(G.outputDir||".output"),K=G.port||3000,Q=n(J);if(!Q)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${Q.routes.length} routes...`);let X=new Map,Z=new Map,$=new Map,U=new Map;for(let O of Q.routes)try{let D=F.join(J,O.compiledPath),j=JSON.parse(await Bun.file(D).text());X.set(O.pattern,j),$.set(O.pattern,c(j.html)),U.set(O.pattern,p(j.html));let N=F.join(J,O.fragmentPath);if(await Bun.file(N).exists())Z.set(O.pattern,await Bun.file(N).text())}catch(D){console.warn(`[stx] Failed to load route ${O.pattern}:`,D)}let I=new Map,V=[];for(let O of Q.routes)if(O.hasParams){let{regex:D,params:j}=d(O.pattern);V.push({regex:D,route:O,paramNames:j})}else I.set(O.pattern,O);let A=ZG({port:K,async fetch(O){return m(O,await(async()=>{let j=new URL(O.url).pathname;if(G.onRequest){let W=await G.onRequest(O);if(W)return W}if(G.apiRoutes?.[j])return G.apiRoutes[j](O);if((O.method==="GET"||O.method==="HEAD")&&j!=="/"){let W=F.resolve(J,"public"),Y;try{Y=decodeURIComponent(j)}catch{Y=j}if(!Y.includes("\x00")){let L=F.resolve(W,`.${Y}`);if(L===W||L.startsWith(`${W}${F.sep}`))try{if(l.existsSync(L)&&l.statSync(L).isFile()){let w=F.extname(L).toLowerCase(),H=$G[w]||"application/octet-stream",P=j.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(j);return new Response(Bun.file(L),{headers:{"Content-Type":H,"Cache-Control":P?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let N=O.headers.get("X-STX-Router")==="true",_=null,M={};if(_=I.get(j)||null,!_)for(let{regex:W,route:Y,paramNames:L}of V){let B=j.match(W);if(B){_=Y,L.forEach((w,H)=>{M[w]=B[H+1]});break}}if(!_){let W=I.get("/404")||null;if(W){let Y=X.get(W.pattern);if(Y)return new Response(Y.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})}if(N){let W=Z.get(_.pattern);if(W){let Y=$.get(_.pattern);return new Response(W,{headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...U.has(_.pattern)?{"X-STX-Runtime":U.get(_.pattern)?"true":"false"}:{},...Y?{"X-STX-Layout":Y.layout,"X-STX-Layout-Group":Y.group}:{},"Cache-Control":"no-cache"}})}}let r=C(O.method),z=X.get(_.pattern);if(!z){let W=I.get("/500")||null;if(W){let Y=X.get(W.pattern);if(Y)return new Response(Y.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(!r&&!z.hasServerScripts&&Object.keys(z.placeholders).length===0)return new Response(z.html,{headers:{"Content-Type":"text/html","Cache-Control":"public, max-age=60"}});try{let{html:W,boundaries:Y,redirect:L,cookies:B}=await g(z,{params:M,request:O,method:O.method});if(L)return v(L,B);if(Y&&Y.length>0){let{renderStreamingPage:H,streamToResponse:P}=await import("./chunk-fc3g2z0p.js");return P(H(W,Y,{timeoutMs:30000}),{headers:{"Cache-Control":"no-cache"}})}let w=new Headers({"Content-Type":"text/html","Cache-Control":"no-cache"});for(let H of B??[])w.append("Set-Cookie",H);return new Response(W,{headers:w})}catch(W){return console.error(`[stx] Hydration error for ${j}:`,W),new Response(z.html,{headers:{"Content-Type":"text/html"}})}})())}});return console.log(`[stx] Production server running at http://localhost:${K}`),console.log(`[stx] Serving ${Q.routes.length} routes (${X.size} pre-loaded)`),{port:K,stop:()=>A.stop()}}
|
|
3
3
|
export{JG as gf,QG as hf,m as if,R as jf,i as kf,C as lf,y as mf,v as nf,LG as of,g as pf,VG as qf,bG as rf};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Jr as a,Kr as b,Lr as c,Mr as d,Nr as e,Or as f}from"./chunk-mm0f84gm.js";import"./chunk-j0tfxbns.js";import"./chunk-khrtzbxd.js";import"./chunk-8anh6d36.js";import"./chunk-3fwn9edg.js";import"./chunk-yb6f8ey1.js";import"./chunk-m2mhtpwy.js";import"./chunk-6xg3j487.js";import"./chunk-q4se9rtw.js";import"./chunk-1nm2xrvq.js";import"./chunk-z47tw39z.js";import"./chunk-3wd9kfyz.js";import"./chunk-trtm887x.js";export{f as validateConfig,b as resolveStxDirectories,c as loadStxConfig,e as defineStxConfig,a as defaultConfig,d as config};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{is as Y}from"./chunk-8anh6d36.js";import{et as N}from"./chunk-1nm2xrvq.js";import C from"path";var O=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function x(K){let J=(Q)=>Q.replace(/[^\n]/g," ");return K.replace(/<!--[\s\S]*?-->/g,J).replace(/\{\{--[\s\S]*?--\}\}/g,J)}function R(K){let J=[],Q=x(K);O.lastIndex=0;let Z;while((Z=O.exec(Q))!==null){let j=(Z[1]||"").trim(),F=(Z[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,z=(Z[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,W=Z.index+F,$=Z.index+Z[0].length-z,U=K.slice(W,$);if(/\bsrc\s*=/.test(j))continue;let q=j.match(/\btype\s*=\s*["']([^"']+)["']/i);if(q&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(q[1]))continue;let G=/\bserver\b/.test(j)?"server":/\bclient\b/.test(j)?"client":"plain",X=B(K,W);J.push({kind:G,code:U,startLine:X,attrs:j})}return J}function B(K,J){let Q=1;for(let Z=0;Z<J&&Z<K.length;Z++)if(K.charCodeAt(Z)===10)Q++;return Q}function M(K,J){let Q=K.lastIndexOf(`
|
|
3
3
|
`,J-1)+1;return J-Q+1}function k(K){let J=K.split(""),Q=(j,F)=>{for(let z=j;z<F&&z<J.length;z++)if(J[z]!==`
|
|
4
4
|
`)J[z]=" "},Z=[/<script(?:\s[^>]*)?>[\s\S]*?<\/script>/gi,/<style(?:\s[^>]*)?>[\s\S]*?<\/style>/gi,/<!--[\s\S]*?-->/g,/\{\{--[\s\S]*?--\}\}/g,/@verbatim\b[\s\S]*?@endverbatim\b/g];for(let j of Z){j.lastIndex=0;let F;while((F=j.exec(K))!==null)Q(F.index,F.index+F[0].length)}return J.join("")}function T(K){let J=0,Q="";for(let Z=0;Z<K.length;Z++){let j=K[Z];if(Q){if(j==="\\"){Z++;continue}if(j===Q)Q="";continue}if(j==='"'||j==="'"||j==="`"){Q=j;continue}if(j==="("||j==="["||j==="{"){J++;continue}if(j===")"||j==="]"||j==="}"){J--;continue}if(j==="|"&&J===0){if(K[Z+1]==="|"){Z++;continue}if(K[Z-1]==="|")continue;return K.slice(0,Z)}}return K}var L=new Set([":for","x-for","v-for"]),w=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,g="__stx_interpolated",D="__StxElement",A="__StxTemplateValue",E=`type ${A}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function P(K){return K.replace(/\{\{[\s\S]*?\}\}/g,g).replace(/\{!![\s\S]*?!!\}/g,g)}function Zj(K){return K.replace(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/g,(J)=>{let Q=J.split(`
|
|
5
5
|
`).length-1,Z=J.length-Q;return`0${" ".repeat(Math.max(0,Z-1))}${`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$f as g,Vf as a,Wf as b,Xf as c,Yf as d,Zf as e,_f as f,ag as h}from"./chunk-9b82d4g5.js";import"./chunk-
|
|
2
|
+
import{$f as g,Vf as a,Wf as b,Xf as c,Yf as d,Zf as e,_f as f,ag as h}from"./chunk-9b82d4g5.js";import"./chunk-trtm887x.js";export{g as timingPlugin,c as pluginManager,a as definePlugin,f as debugPlugin,h as createVariablesPlugin,e as createFilterPlugin,d as createDirectivePlugin,b as PluginManager};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
var E=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),N=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);function X(Q){return Q.replace(/[^\n]/g," ")}function R(Q){let H=Q.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,X).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,X).replace(/<!--[\s\S]*?-->/g,X).replace(/\{\{\{[\s\S]*?\}\}\}/g,X).replace(/\{\{[\s\S]*?\}\}/g,X).replace(/\{!![\s\S]*?!!\}/g,X),F=new Map,J=new Map,Y=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,z;while((z=Y.exec(H))!==null){let j=z[1]==="/",q=z[2],W=z[3]==="/";if(E.has(q.toLowerCase()))continue;if(W)continue;if(j)J.set(q,(J.get(q)??0)+1);else{let Z=F.get(q);if(Z)Z.count++;else{let B=H.slice(0,z.index).split(`
|
|
3
3
|
`).length;F.set(q,{count:1,firstLine:B})}}}let M=[];for(let j of new Set([...F.keys(),...J.keys()])){if(N.has(j.toLowerCase()))continue;let q=F.get(j)?.count??0,W=J.get(j)??0;if(q!==W)M.push({tag:j,opened:q,closed:W,firstOpenLine:F.get(j)?.firstLine??0})}return M}var $=new Set;function U(Q,H){let F;try{F=R(Q)}catch{return}if(F.length===0)return;let J=`${H}:${Q.length}`;if($.has(J))return;$.add(J);let Y=H?H.split(/[/\\]/).pop()||H:"template";for(let{tag:z,opened:M,closed:j,firstOpenLine:q}of F)if(M>j){let W=q?` (first opened at line ${q})`:"";console.warn(`[stx] ${Y}: <${z}> ${M} opened, ${j} closed \u2014 an unclosed <${z}>${W} may swallow the content that follows it.`)}else console.warn(`[stx] ${Y}: <${z}> ${M} opened, ${j} closed \u2014 ${j-M} stray </${z}>.`)}
|
|
4
|
-
export{R as
|
|
4
|
+
export{R as ct,U as dt};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ui as a,Vi as b}from"./chunk-1wfvhxjz.js";import"./chunk-ht51fz7w.js";import"./chunk-mm0f84gm.js";import"./chunk-j0tfxbns.js";import"./chunk-khrtzbxd.js";import"./chunk-8anh6d36.js";import"./chunk-3fwn9edg.js";import"./chunk-yb6f8ey1.js";import"./chunk-m2mhtpwy.js";import"./chunk-6xg3j487.js";import"./chunk-q4se9rtw.js";import"./chunk-1nm2xrvq.js";import"./chunk-z47tw39z.js";import"./chunk-3wd9kfyz.js";import"./chunk-trtm887x.js";export{a as getStoreScript,b as clearStoreCache};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Vh as a,Wh as b,Xh as c,Yh as d,Zh as e}from"./chunk-x13f5bbe.js";import"./chunk-
|
|
2
|
+
import{Vh as a,Wh as b,Xh as c,Yh as d,Zh as e}from"./chunk-x13f5bbe.js";import"./chunk-trtm887x.js";export{a as processAsyncDirectives,c as isAsyncComponent,e as generateAsyncComponentRuntime,d as generateAsyncComponentCSS,b as defineAsyncComponent};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$s as
|
|
2
|
+
import{$s as n,Os as a,Ps as b,Qs as c,Rs as d,Ss as e,Ts as f,Us as g,Vs as h,Ws as i,Xs as j,Ys as k,Zs as l,_s as m,at as o,bt as p}from"./chunk-6xg3j487.js";import"./chunk-trtm887x.js";export{i as useTitle,f as useSeoMeta,i as usePageTitle,d as useHead,g as seoMetaToHeadConfig,c as resetHead,k as renderHtmlAttrs,j as renderHead,l as renderBodyAttrs,o as processTitleDirective,p as processMetaDirective,n as processHeadDirective,e as mergeHeadConfigs,b as getPageMeta,a as getHead,h as definePageMeta,m as applyHead};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{og as T}from"./chunk-
|
|
2
|
+
import{og as T}from"./chunk-a2rj5ce0.js";import{iu as I}from"./chunk-trtm887x.js";import E from"fs";import X from"path";import U from"crypto";var _=new Set(["webp","avif","jpeg","png"]),F=new Set(["cover","contain","fill","inside","outside"]),A=new Set([".jpg",".jpeg",".png",".webp",".avif",".gif"]),S=4096,y=80,D="cover";async function g(k,G){let J=G.routePath??"/_stx/img",B=new URL(k.url);if(B.pathname!==J)return null;let $=q(B,G);if(!$.ok)return new Response($.error,{status:$.status,headers:{"Content-Type":"text/plain"}});let{srcFsPath:j,srcUrl:K,width:H,height:v,format:Z,quality:Y,fit:z}=$,C;try{C=E.statSync(j)}catch{return new Response(`Source image not found: ${K}`,{status:404,headers:{"Content-Type":"text/plain"}})}if(!C.isFile())return new Response("Not a file",{status:404,headers:{"Content-Type":"text/plain"}});let N=G.cacheDir??".stx/cache/img";await E.promises.mkdir(N,{recursive:!0});let V=`${j}:${C.mtimeMs}:${C.size}`,O=`${H}x${v}:${Z}:${Y}:${z}`,b=U.createHash("sha256").update(`${V}|${O}`).digest("hex").slice(0,16),Q=X.join(N,`${b}.${Z}`),W={"Content-Type":T(Z),"Cache-Control":"public, max-age=31536000, immutable",ETag:`"${b}"`,"X-Stx-Image-Cache":"HIT"};if(k.headers.get("if-none-match")===`"${b}"`)return new Response(null,{status:304,headers:W});let L=Bun.file(Q);if(await L.exists())return new Response(L,{headers:W});try{let R=Buffer.from(await Bun.file(j).arrayBuffer()),{resizeAndConvert:M}=await P(),w=await M(R,{width:H,height:v,format:Z,quality:Y,fit:z});return await Bun.write(Q,w),W["X-Stx-Image-Cache"]="MISS",new Response(new Uint8Array(w),{headers:W})}catch(R){let M=R.message;return new Response(`Image processing failed: ${M}`,{status:500,headers:{"Content-Type":"text/plain"}})}}function l(k){return async(G)=>{return await g(G,k)??new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain"}})}}function q(k,G){let J=k.searchParams.get("src");if(!J)return{ok:!1,error:"Missing required param: src",status:400};if(!J.startsWith("/"))return{ok:!1,error:"src must be an absolute URL path (start with /)",status:400};if(J.startsWith("//"))return{ok:!1,error:"src must be a local path",status:400};let B=X.extname(J).toLowerCase();if(!A.has(B))return{ok:!1,error:`Unsupported source extension: ${B}`,status:400};let $=X.resolve(G.publicDir),j=X.resolve($,J.slice(1));if(!j.startsWith(`${$}${X.sep}`)&&j!==$)return{ok:!1,error:"src is outside publicDir",status:400};let K=G.maxWidth??S,H=G.maxHeight??S,v=k.searchParams.get("w"),Z=k.searchParams.get("h"),Y=v?Number.parseInt(v,10):0,z=Z?Number.parseInt(Z,10):0;if(v&&(!Number.isFinite(Y)||Y<=0))return{ok:!1,error:"Invalid w (must be positive integer)",status:400};if(Z&&(!Number.isFinite(z)||z<=0))return{ok:!1,error:"Invalid h (must be positive integer)",status:400};if(!v&&!Z)return{ok:!1,error:"At least one of w or h is required",status:400};let C=Math.min(Y||K,K),N=Math.min(z||H,H),V=k.searchParams.get("f")||"webp";if(!_.has(V))return{ok:!1,error:`Invalid f (must be one of: ${[..._].join(", ")})`,status:400};let O=V,b=k.searchParams.get("q"),Q=b?Number.parseInt(b,10):G.defaultQuality??y;if(!Number.isFinite(Q)||Q<1||Q>100)return{ok:!1,error:"Invalid q (must be 1-100)",status:400};let x=k.searchParams.get("fit")||G.defaultFit||D;if(!F.has(x))return{ok:!1,error:`Invalid fit (must be one of: ${[...F].join(", ")})`,status:400};return{ok:!0,srcFsPath:j,srcUrl:J,width:C,height:N,format:O,quality:Q,fit:x}}async function P(){return await import("./chunk-bsr7yrxh.js")}
|
|
3
3
|
export{g as Tf,l as Uf};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{rf as a}from"./chunk-nrksd914.js";import"./chunk-t82z0cbv.js";import"./chunk-mm0f84gm.js";import"./chunk-j0tfxbns.js";import"./chunk-khrtzbxd.js";import"./chunk-8anh6d36.js";import"./chunk-3fwn9edg.js";import"./chunk-yb6f8ey1.js";import"./chunk-m2mhtpwy.js";import"./chunk-6xg3j487.js";import"./chunk-q4se9rtw.js";import"./chunk-1nm2xrvq.js";import"./chunk-z47tw39z.js";import"./chunk-3wd9kfyz.js";import"./chunk-trtm887x.js";export{a as startProductionServer};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{$p as b,_p as a,aq as c,bq as d,cq as e,dq as f,eq as g,fq as h,gq as i,hq as j,iq as k}from"./chunk-mm0f84gm.js";import"./chunk-j0tfxbns.js";import"./chunk-khrtzbxd.js";import"./chunk-8anh6d36.js";import"./chunk-3fwn9edg.js";import"./chunk-yb6f8ey1.js";import"./chunk-m2mhtpwy.js";import"./chunk-6xg3j487.js";import"./chunk-q4se9rtw.js";import"./chunk-1nm2xrvq.js";import"./chunk-z47tw39z.js";import"./chunk-3wd9kfyz.js";import"./chunk-trtm887x.js";export{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{Kl as Y,
|
|
2
|
+
import{Kl as Y,uq as x}from"./chunk-mm0f84gm.js";import"./chunk-j0tfxbns.js";import"./chunk-khrtzbxd.js";import"./chunk-8anh6d36.js";import"./chunk-3fwn9edg.js";import"./chunk-yb6f8ey1.js";import"./chunk-m2mhtpwy.js";import"./chunk-6xg3j487.js";import"./chunk-q4se9rtw.js";import"./chunk-1nm2xrvq.js";import"./chunk-z47tw39z.js";import"./chunk-3wd9kfyz.js";import"./chunk-trtm887x.js";import A from"path";var C=["broadcast","calculateDistance","canNotify","clearCookies","clearFetchCache","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],y=new Set(C);var Z=new Map,I=new Set,P=new Set(C);function R(){Z.clear()}function D(G){let H=new Map;for(let z of G){let K=A.basename(z);if(K.endsWith(".d.ts"))continue;let J=K.replace(/\.[jt]s$/,"");if(J==="index")continue;if(J===K)continue;let X=H.get(J);if(X&&!X.endsWith(".js"))continue;H.set(J,z)}return[...H.values()].sort()}function L(G,H){let z=H.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${z}\\b`).test(G)}function k(G){if(!G)return[];let H=G.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),z=[];for(let K of P){if(I.has(K))continue;let J=K.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${J}\\s*\\(`).test(H))z.push(K)}return z.sort()}async function _(G,H){let z=k(G);if(z.length===0)return null;let K=H??A.join(import.meta.dir,"composables"),J=`${K}\x00${z.join(",")}`,X=Z.get(J);if(X!==void 0)return X||null;let T=x({loader:"ts",target:"browser",define:Y()}),B=new Set(z),F=[],w=new Set,$=[];try{let q=new Bun.Glob("*.{ts,js}");for await(let j of q.scan({cwd:K,absolute:!0}))$.push(j)}catch{return Z.set(J,""),null}$=D($);for(let q of $){let j;try{j=await Bun.file(q).text()}catch{continue}let W=[];try{W=T.scan(j).exports.filter((Q)=>Q!=="default")}catch{continue}if(!W.some((Q)=>B.has(Q)))continue;try{j=j.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^import\s+type\s+.*$/gm,""),j=j.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),j=j.replace(/^export\s+default\s+/gm,""),j=j.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),F.push(`// ${A.basename(q).replace(/\.[jt]s$/,"")}
|
|
3
3
|
${T.transformSync(j).trim()}`);for(let Q of W)w.add(Q)}catch(Q){console.warn(`[stx] framework composable ${A.basename(q)} could not be bundled:`,Q)}}let U=z.filter((q)=>!w.has(q)&&!L(G,q));if(U.length>0)console.warn(`[stx] could not bundle ${U.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(F.length===0)return Z.set(J,""),null;let M=[...w].map((q)=>` try { if (!(${JSON.stringify(q)} in __s)) { __s[${JSON.stringify(q)}] = ${q}; if (!(${JSON.stringify(q)} in window)) window[${JSON.stringify(q)}] = ${q}; } } catch (e) {}`).join(`
|
|
4
4
|
`),V=`<script data-stx-framework-composables>
|
|
5
5
|
;(function(){
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{xj as o,yj as p,zj as q}from"./chunk-
|
|
2
|
+
import{xj as o,yj as p,zj as q}from"./chunk-6ndvtzpk.js";import{Fj as a,Gj as b,Hj as c,Ij as d,Jj as e,Kj as f,Lj as g,Mj as h,Nj as i,Oj as j,Pj as k,Qj as l,Rj as m,Sj as n}from"./chunk-3es366z4.js";import"./chunk-1nm2xrvq.js";import"./chunk-trtm887x.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,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Sp as R,dm as E,em as M}from"./chunk-mm0f84gm.js";import{Xt as m,Zt as d,_t as p}from"./chunk-z47tw39z.js";import{fu as g,iu as u}from"./chunk-trtm887x.js";var f=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function C(w,J,z){let B={fullTag:z,content:J,attrs:w};if(/\bserver\b/.test(w))return{...B,type:"server"};if(/\bdata-stx-scoped\b/.test(w))return{...B,type:"client"};if(f.test(J))return{...B,type:"signals"};if(/\bclient\b/.test(w)||/\btype\s*=\s*["']module["']/.test(w)||/\bsrc\s*=/.test(w))return{...B,type:"client"};return{...B,type:"server"}}var S=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function P(w){let J=[],z=[],B=[],Y=0;while(Y<w.length){let Q=w.indexOf("<",Y);if(Q===-1)break;let U=M(w,Q);if(U>Q){Y=U;continue}let X=E(w,Q);if(X>Q){let $=w.slice(Q,X),j=S.exec($);if(j){let F=C(j[1],j[2],$);switch(F.type){case"signals":J.push(F);break;case"client":z.push(F);break;case"server":B.push(F);break}}Y=X;continue}Y=Q+(w.startsWith("<!--",Q)?4:1)}return{signals:J,client:z,server:B}}import L from"path";m();var c="stx-page-head:",i=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,A=null;function h(){if(A!==null)return A;try{let{getRouterScript:w}=(p(),g(d));A=`<script>${w()}</script>`}catch{A=""}return A}async function e(w,J){if(J===!1)return null;if(J&&typeof J==="string"){let B=L.resolve(w,J);if(await Bun.file(B).exists())return B;return null}let z=L.join(w,"app.stx");if(await Bun.file(z).exists())return z;return null}async function t(w,J){try{let z=await Bun.file(w).text(),B=z,Y=z.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if(Y)B=Y[1].trim();let Q=P(z),U=[...Q.client.map((Z)=>Z.fullTag),...Q.signals.map((Z)=>Z.fullTag)],X=[],$=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,j;while((j=$.exec(z))!==null)X.push(j[0]);let F=B;for(let Z of Q.server)F=F.replace(Z.fullTag,"");for(let Z of Q.client)F=F.replace(Z.fullTag,"");F=F.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let V="<!--__STX_PAGE_SLOT__-->";if(F=F.replace(/<slot\s*\/>/gi,V).replace(/<slot\s*>\s*<\/slot>/gi,V),!F.includes(V))return console.warn(`[stx] Shell ${w} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:W,extractVariables:G,defaultConfig:_,loadStxConfig:v}=await import("./chunk-em4wy7zv.js"),k=await v(),H={__filename:w,__dirname:L.dirname(w)};for(let Z of U){let K=Z.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(K&&!Z.includes("client")&&!Z.includes('type="module"'))await G(K[1],H,w)}let N=await W(F,H,w,{..._,...k,...J},new Set),q=N.indexOf(V);if(q===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:N.substring(0,q),afterSlot:N.substring(q+V.length),filePath:w,shellScripts:U,shellStyles:X}}catch(z){return console.error(`[stx] Error processing shell ${w}:`,z),null}}function ww(w,J,z){let B,Y="",Q=J.match(i);if(Q){J=J.replace(Q[0],"");try{let F=Buffer.from(Q[1],"base64").toString("utf8"),V=F.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(V)B=V[1].trim();Y=F.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let U=z||B||"stx App",X=h(),$="<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,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
var{defineProperty:e,getOwnPropertyNames:g,getOwnPropertyDescriptor:h}=Object,i=Object.prototype.hasOwnProperty;function j(a){return this[a]}var m=(a)=>{var b=(f??=new WeakMap).get(a),c;if(b)return b;if(b=e({},"__esModule",{value:!0}),a&&typeof a==="object"||typeof a==="function"){for(var d of g(a))if(!i.call(b,d))e(b,d,{get:j.bind(a,d),enumerable:!(c=h(a,d))||c.enumerable})}return f.set(a,b),b},f;var k=(a)=>a;function l(a,b){this[a]=k.bind(null,b)}var n=(a,b)=>{for(var c in b)e(a,c,{get:b[c],enumerable:!0,configurable:!0,set:l.bind(b,c)})};var o=(a,b)=>()=>(a&&(b=a(a=0)),b);var p=import.meta.require;
|
|
3
|
-
export{m as
|
|
3
|
+
export{m as fu,n as gu,o as hu,p as iu};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-trtm887x.js";var N=0;function P(){return`eb-${++N}-${Date.now().toString(36)}`}function W(q,z={},A){let j=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return q.replace(j,(D,F,J,K)=>{let L=P(),M=Q(F||"");return T(L,J.trim(),K.trim(),M)})}function Q(q){let z={},A=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,j;while((j=A.exec(q))!==null){let D=j[1],F=j[2]||j[3]||j[4];switch(D){case"id":z.id=F;break;case"logErrors":z.logErrors=F==="true";break}}return z}function T(q,z,A,j){let D=j.logErrors!==!1;return`
|
|
3
3
|
<div class="stx-error-boundary" data-boundary-id="${q}" data-has-error="false">
|
|
4
4
|
<div class="stx-error-boundary-content" data-boundary-content="${q}">
|
|
5
5
|
${z}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Bi as a,Ci as b,Di as c,Ei as d,Fi as e,Gi as f,Hi as g,Ii as h}from"./chunk-y4hkqsgw.js";import"./chunk-3es366z4.js";import"./chunk-
|
|
2
|
+
import{Bi as a,Ci as b,Di as c,Ei as d,Fi as e,Gi as f,Hi as g,Ii as h}from"./chunk-y4hkqsgw.js";import"./chunk-3es366z4.js";import"./chunk-trtm887x.js";export{d as v,a as useForm,g as processHasErrorsDirective,h as processFormValidationDirectives,f as processErrorsDirective,e as processErrorDirective,b as defineForm,c as Validator};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{fi as a,gi as b,hi as c,ii as d,ji as e,ki as f,li as g}from"./chunk-vgk5v31k.js";import"./chunk-
|
|
2
|
+
import{fi as a,gi as b,hi as c,ii as d,ji as e,ki as f,li as g}from"./chunk-vgk5v31k.js";import"./chunk-trtm887x.js";export{d as useVirtualList,b as processVirtualListDirectives,f as processVirtualGridDirectives,e as processInfiniteListDirectives,c as generateVirtualListCSS,g as default,a as createVirtualList};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$g as h,Ug as a,Vg as b,Wg as c,Xg as d,Yg as e,Zg as f,_g as g,ah as i,bh as j,ch as k,dh as l}from"./chunk-st5qggks.js";import"./chunk-
|
|
2
|
+
import{$g as h,Ug as a,Vg as b,Wg as c,Xg as d,Yg as e,Zg as f,_g as g,ah as i,bh as j,ch as k,dh as l}from"./chunk-st5qggks.js";import"./chunk-trtm887x.js";export{g as toUsers,f as toUser,c as stopBroadcasting,b as startBroadcasting,d as loadChannels,a as getBroadcastServer,j as channel,h as broadcastPrivate,i as broadcastPresence,e as broadcast,l as BroadcastServer,k as Broadcast};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Hf as t,If as u,Jf as v,Kf as w,Lf as x,Mf as y,Nf as z,Of as A,Pf as B,Qf as C,Rf as D,Sf as E}from"./chunk-
|
|
2
|
+
import{Hf as t,If as u,Jf as v,Kf as w,Lf as x,Mf as y,Nf as z,Of as A,Pf as B,Qf as C,Rf as D,Sf as E}from"./chunk-zxb128xa.js";import{Tf as r,Uf as s}from"./chunk-s7dqawk0.js";import{bg as b,cg as c,dg as d,eg as e,fg as f,gg as g,hg as h,jg as i,kg as j,lg as k,mg as l,ng as m,og as n,pg as o,qg as p,rg as q}from"./chunk-a2rj5ce0.js";import{eh as a}from"./chunk-z2sp0k8d.js";import"./chunk-3fwn9edg.js";import"./chunk-trtm887x.js";export{D as writeImageManifest,a as rewriteImagesWithSiblings,t as renderImageComponent,v as processImageComponents,g as processImage,u as parseImageComponent,A as optimizeImage,B as optimizeDirectory,e as isSharpAvailable,m as isImageFile,f as isImageBackendAvailable,y as imageDirective,r as handleImageRequest,l as groupVariantsByFormat,o as getTotalSize,n as getMimeType,h as getImageMetadata,k as getFallbackVariant,i as generateSrcSet,j as generateSizes,C as generateImageManifest,p as formatSize,E as defaultImageConfig,z as createImagePlugin,s as createImageHandler,x as createImageDirective,w as clearImageCache,q as ImageProcessingError,b as DEFAULT_WIDTHS,d as DEFAULT_QUALITY,c as DEFAULT_FORMATS};
|
|
@@ -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{
|
|
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{No as V}from"./chunk-mm0f84gm.js";import"./chunk-j0tfxbns.js";import"./chunk-khrtzbxd.js";import"./chunk-8anh6d36.js";import"./chunk-3fwn9edg.js";import"./chunk-yb6f8ey1.js";import"./chunk-m2mhtpwy.js";import"./chunk-6xg3j487.js";import"./chunk-q4se9rtw.js";import"./chunk-1nm2xrvq.js";import"./chunk-z47tw39z.js";import"./chunk-3wd9kfyz.js";import{iu as F}from"./chunk-trtm887x.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-eva1mgf5.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-eva1mgf5.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"}">
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{$e as f,Ye as c,Ze as d,_e as e,af as g,bf as h}from"./chunk-hz1jcwdb.js";import{Bg as b,yg as a}from"./chunk-p7qqbw2k.js";import"./chunk-yvgjys59.js";import"./chunk-ht51fz7w.js";import"./chunk-mm0f84gm.js";import"./chunk-j0tfxbns.js";import"./chunk-khrtzbxd.js";import"./chunk-8anh6d36.js";import"./chunk-3fwn9edg.js";import"./chunk-yb6f8ey1.js";import"./chunk-m2mhtpwy.js";import"./chunk-6xg3j487.js";import"./chunk-q4se9rtw.js";import"./chunk-1nm2xrvq.js";import"./chunk-z47tw39z.js";import"./chunk-3wd9kfyz.js";import"./chunk-trtm887x.js";export{d as virtualPathFor,g as typecheckStxFiles,e as sourcePathFor,h as formatTypecheckDiagnostics,f as findRuntimeTypeDeclarations,b as extractTemplateExpressions,a as extractScriptBlocks,c as buildVirtualSource};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{iu as Y}from"./chunk-trtm887x.js";import{mkdir as O,writeFile as q}from"fs/promises";import{join as X}from"path";var T="https://api.iconify.design";async function k(){let E=await fetch(`${T}/collections`);if(!E.ok)throw Error(`Failed to fetch collections: ${E.statusText}`);return await E.json()}async function P(E,z){try{let U=Y.resolve("@iconify/json"),S=`${`${U.substring(0,U.lastIndexOf("/node_modules/@iconify/json/"))}/node_modules/@iconify/json`}/json/${E}.json`,M=Bun.file(S);if(await M.exists()){let V=await M.json();if(z&&z.length>0){let Z={};for(let L of z)if(V.icons[L])Z[L]=V.icons[L];return{...V,icons:Z}}return V}}catch{}let K=z&&z.length>0?`${T}/${E}.json?icons=${z.join(",")}`:`${T}/${E}.json`,Q=await fetch(K);if(!Q.ok)throw Error(`Failed to fetch icons for ${E}: ${Q.statusText}`);return await Q.json()}function j(E,z=24,K=24){return{body:E.body,width:E.width||z,height:E.height||K,viewBox:`0 0 ${E.width||z} ${E.height||K}`}}function F(E,z){let K=B(E);return`import type { IconData } from '@stacksjs/iconify-core'
|
|
3
3
|
|
|
4
4
|
export const ${K}: IconData = ${JSON.stringify(z,null,2)}
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Fh as x,Kh as B,Lh as c,Mh as u,Nh as n}from"./chunk-q8szpd6w.js";import{
|
|
2
|
+
import{Fh as x,Kh as B,Lh as c,Mh as u,Nh as n}from"./chunk-q8szpd6w.js";import{iu as v}from"./chunk-trtm887x.js";import{resolve as JJ,basename as WJ,extname as _J,join as LJ}from"path";import{mkdir as QJ}from"fs/promises";var ZJ={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0};class V{config;constructor(K={}){this.config={...ZJ,...K}}async get(K,J){return c(K,J,"video",this.config)}async set(K,J,X){return u(K,J,X,"video",this.config)}async clear(){return n("video",this.config)}updateConfig(K){this.config={...this.config,...K}}}var S=null;function D(K){if(!S)S=new V(K);else if(K)S.updateConfig(K);return S}async function q(K,J,X){let N=X?{directory:`${X.outputDir}/../.cache`}:{};return D(N).get(K,J)}async function b(K,J,X,N){let Z=N?{directory:`${N.outputDir}/../.cache`}:{};return D(Z).set(K,J,X)}async function $J(){return D().clear()}import{resolve as y,basename as P,extname as f,join as U}from"path";import{mkdir as g}from"fs/promises";async function m(){try{return await import("ts-videos")}catch{return null}}async function h(K,J,X,N){let Z=await m();if(!Z)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let $=y(K);if(!await B($))return null;await g(X,{recursive:!0});let Y=await x($),z=P(K,f(K)),G=J.format||"webp",M=J.timestamp||0,E=`${z}-poster-${Y}.${G}`,W=U(X,E),Q=await Z.extractThumbnails($,{timestamps:[M],width:J.width||1280,height:J.height,format:G,quality:J.quality||85,outputDir:X,outputPattern:E.replace(`.${G}`,"")});if(Q&&Q.length>0){let _=Q[0];return{path:W,url:`${N}/${E}`,width:_.width||J.width||1280,height:_.height||720,timestamp:M,size:_.size||0}}return null}catch($){return console.warn(`[stx-media] Failed to generate poster: ${$}`),null}}async function d(K,J,X,N){let Z=await m();if(!Z)return[];try{let $=y(K);if(!await B($))return[];await g(X,{recursive:!0});let Y=await x($),z=P(K,f(K)),G=J.format||"webp",W=(await new Z.Input($).getInfo()).duration||60,Q=J.count||10,_=J.interval||W/Q,O=[];for(let w=0;w<Q&&w*_<W;w++)O.push(w*_);let L=await Z.extractThumbnails($,{timestamps:O,width:J.width||320,format:G,quality:J.quality||80,outputDir:X,outputPattern:`${z}-thumb-${Y}`});if(L&&L.length>0)return L.map((w,j)=>({path:w.path||U(X,`${z}-thumb-${Y}-${j}.${G}`),url:`${N}/${z}-thumb-${Y}-${j}.${G}`,width:w.width||J.width||320,height:w.height||180,timestamp:O[j],size:w.size||0}));return[]}catch($){return console.warn(`[stx-media] Failed to generate thumbnails: ${$}`),[]}}async function zJ(K,J,X,N){let Z=await m();if(!Z)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let $=y(K);if(!await B($))return null;await g(X,{recursive:!0});let Y=await x($),z=P(K,f(K)),E=(await new Z.Input($).getInfo()).duration||60,W=J.columns||10,Q=J.interval||5,_=J.thumbnailWidth||160,O=J.thumbnailHeight||90,L=J.format||"jpeg",w=Math.ceil(E/Q),j=Math.ceil(w/W),F=`${z}-sprite-${Y}.${L}`,k=U(X,F),T=[];for(let I=0;I<w;I++)T.push(I*Q);let A=await Z.extractThumbnails($,{timestamps:T,width:_,height:O,format:L,quality:J.quality||70,outputDir:U(X,".temp")});if(!A||A.length===0)return null;try{let I=await import("ts-images"),H=W*_,kJ=j*O,jJ=await I.createSprite({images:A.map((YJ)=>YJ.path),columns:W,padding:0,outputPath:k,format:L,quality:J.quality||70});return{url:`${N}/${F}`,path:k,columns:W,rows:j,thumbnailWidth:_,thumbnailHeight:O,interval:Q,totalFrames:w}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch($){return console.warn(`[stx-media] Failed to generate sprite sheet: ${$}`),null}}import{resolve as r,basename as e,extname as i,join as C}from"path";import{mkdir as R,writeFile as o}from"fs/promises";async function t(){try{return await import("ts-videos")}catch{return null}}var s=[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000},{label:"360p",width:640,height:360,bitrate:600000,audioBitrate:64000}];async function p(K,J,X,N,Z){let $=await t();if(!$)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let Y=r(K);if(!await B(Y))return null;let z=await x(Y),G=e(K,i(K)),M=C(X,`${G}-${z}-hls`);await R(M,{recursive:!0});let E=J.length>0?J:s,W=Z?.segmentDuration||6,O=(await new $.Input(Y).getInfo()).duration||0,L=[],w=0;for(let k of E){let T=C(M,k.label);await R(T,{recursive:!0});let A=`${k.label}.m3u8`,I=C(T,A);try{let H=await $.generateHLS(Y,{outputDir:T,segmentDuration:W,width:k.width,height:k.height,videoBitrate:k.bitrate,audioBitrate:k.audioBitrate,playlistName:k.label});if(H)L.push({quality:k,url:`${N}/${G}-${z}-hls/${k.label}/${A}`,path:I}),w+=H.segmentCount||Math.ceil(O/W)}catch(H){console.warn(`[stx-media] Failed to generate HLS for ${k.label}: ${H}`)}}if(L.length===0)return null;let j=C(M,"master.m3u8"),F=GJ(L,N,G,z);return await o(j,F),{manifestUrl:`${N}/${G}-${z}-hls/master.m3u8`,manifestPath:j,playlists:L,segmentCount:w,duration:O}}catch(Y){return console.warn(`[stx-media] Failed to generate HLS manifest: ${Y}`),null}}function GJ(K,J,X,N){let Z=["#EXTM3U","#EXT-X-VERSION:3"];for(let $ of K){let{quality:Y}=$,z=Y.bitrate+(Y.audioBitrate||128000),G=`${Y.width}x${Y.height||Math.round(Y.width*9/16)}`;Z.push(`#EXT-X-STREAM-INF:BANDWIDTH=${z},RESOLUTION=${G},NAME="${Y.label}"`,`${Y.label}/${Y.label}.m3u8`)}return Z.join(`
|
|
3
3
|
`)}async function l(K,J,X,N,Z){let $=await t();if(!$)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let Y=r(K);if(!await B(Y))return null;let z=await x(Y),G=e(K,i(K)),M=C(X,`${G}-${z}-dash`);await R(M,{recursive:!0});let E=J.length>0?J:s,W=Z?.segmentDuration||4,Q=Z?.minBufferTime||2,L=(await new $.Input(Y).getInfo()).duration||0,w=[],j=[];for(let A of E){let I=C(M,A.label);await R(I,{recursive:!0});try{if(await $.generateDASH(Y,{outputDir:I,segmentDuration:W,width:A.width,height:A.height,videoBitrate:A.bitrate,audioBitrate:A.audioBitrate})){if(w.push({bandwidth:A.bitrate,width:A.width,height:A.height||Math.round(A.width*9/16),url:`${N}/${G}-${z}-dash/${A.label}/video`}),A.audioBitrate)j.push({bandwidth:A.audioBitrate,url:`${N}/${G}-${z}-dash/${A.label}/audio`})}}catch(H){console.warn(`[stx-media] Failed to generate DASH for ${A.label}: ${H}`)}}if(w.length===0)return null;let F=C(M,"manifest.mpd"),k=NJ(w,j,L,W,Q);await o(F,k);let T=[{type:"video",representations:w}];if(j.length>0)T.push({type:"audio",representations:j});return{manifestUrl:`${N}/${G}-${z}-dash/manifest.mpd`,manifestPath:F,adaptationSets:T,duration:L}}catch(Y){return console.warn(`[stx-media] Failed to generate DASH manifest: ${Y}`),null}}function NJ(K,J,X,N,Z){let $=a(X),Y=a(Z),z=`<?xml version="1.0" encoding="UTF-8"?>
|
|
4
4
|
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
|
|
5
5
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{To as a,Uo as b}from"./chunk-mm0f84gm.js";import"./chunk-j0tfxbns.js";import"./chunk-khrtzbxd.js";import"./chunk-8anh6d36.js";import"./chunk-3fwn9edg.js";import"./chunk-yb6f8ey1.js";import"./chunk-m2mhtpwy.js";import"./chunk-6xg3j487.js";import"./chunk-q4se9rtw.js";import"./chunk-1nm2xrvq.js";import"./chunk-z47tw39z.js";import"./chunk-3wd9kfyz.js";import"./chunk-trtm887x.js";export{b as processLoops,a as parseLoopBinding};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
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-
|
|
2
|
+
import{Ms as Jq}from"./chunk-m2mhtpwy.js";import{iu as Gq}from"./chunk-trtm887x.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-nvfawtpq.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">
|
|
@@ -8,4 +8,4 @@ ${J}
|
|
|
8
8
|
</style>`,Z=/(?:<style\b[^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*>)/g;if(Z.test(G)){let U=!1;return G.replace(Z,()=>{if(U)return"";return U=!0,Y})}if(G.includes("</head>"))return G.replace("</head>",`${Y}
|
|
9
9
|
</head>`);if(G.includes("<body"))return G.replace(/<body([^>]*)>/,`<body$1>
|
|
10
10
|
${Y}`);return Y+G}
|
|
11
|
-
export{g as
|
|
11
|
+
export{g as ss,e as ts,W as us,Dq as vs,Yq as ws,Sq as xs,xq as ys,Zq as zs,_q as As,Fq as Bs,Nq as Cs,kq as Ds,wq as Es,Vq as Fs,jq as Gs,yq as Hs};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{gk as a,hk as b,ik as c,jk as d}from"./chunk-1hx2z3m0.js";import"./chunk-d8hzg54c.js";import"./chunk-mm0f84gm.js";import"./chunk-j0tfxbns.js";import"./chunk-khrtzbxd.js";import"./chunk-8anh6d36.js";import"./chunk-3fwn9edg.js";import"./chunk-yb6f8ey1.js";import"./chunk-m2mhtpwy.js";import"./chunk-6xg3j487.js";import"./chunk-q4se9rtw.js";import"./chunk-1nm2xrvq.js";import"./chunk-z47tw39z.js";import"./chunk-3wd9kfyz.js";import"./chunk-trtm887x.js";export{b as getAvailableTargets,c as getAvailableFormats,d as default,a as buildNative};
|