@stacksjs/stx 0.2.237 → 0.2.238
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-3j404s9z.js → chunk-0b88ky9d.js} +1 -1
- package/dist/{chunk-qpbywzvg.js → chunk-0e1pt5my.js} +2 -2
- package/dist/{chunk-haeynd7x.js → chunk-11mxy34t.js} +2 -2
- package/dist/{chunk-g5bhgv8m.js → chunk-1jcyfxq5.js} +1 -1
- package/dist/{chunk-6qhezn34.js → chunk-1xgva25g.js} +1 -1
- package/dist/{chunk-nebfw3pc.js → chunk-2k9xsqnx.js} +1 -1
- package/dist/{chunk-85frtq6r.js → chunk-38nq2ymv.js} +1 -1
- package/dist/chunk-412apa52.js +2 -0
- package/dist/{chunk-fgfb9fs0.js → chunk-4s11yb67.js} +1 -1
- package/dist/{chunk-bjs711qv.js → chunk-4tybm7fx.js} +1 -1
- package/dist/chunk-5a1b5kjt.js +3 -0
- package/dist/{chunk-r23ycexh.js → chunk-5e2j8d7r.js} +1 -1
- package/dist/{chunk-x3tvmc58.js → chunk-5q44vwmg.js} +1 -1
- package/dist/{chunk-c5411vve.js → chunk-6x3jqwxp.js} +1 -1
- package/dist/{chunk-vgf3zdpb.js → chunk-7hfjv9ej.js} +1 -1
- package/dist/{chunk-f3r3x3bh.js → chunk-7qgt3b5t.js} +1 -1
- package/dist/chunk-7rfx2s7c.js +2 -0
- package/dist/{chunk-3sy1cf6v.js → chunk-7y7dp1ba.js} +1 -1
- package/dist/{chunk-c8sh51p7.js → chunk-89nbkhxk.js} +1 -1
- package/dist/{chunk-3zdkcdvf.js → chunk-8k7evyhh.js} +1 -1
- package/dist/{chunk-2tew0h6f.js → chunk-8p8qa1s9.js} +1 -1
- package/dist/{chunk-qpt60465.js → chunk-8t7w323q.js} +1 -1
- package/dist/{chunk-qsdv9c1c.js → chunk-9g2rhkx8.js} +1 -1
- package/dist/{chunk-f48gnx24.js → chunk-9hcw5zsr.js} +1 -1
- package/dist/{chunk-1x91733n.js → chunk-9scfmhph.js} +1 -1
- package/dist/chunk-a0aqpzm6.js +2 -0
- package/dist/{chunk-ae1pb4a7.js → chunk-a0zaf8r9.js} +1 -1
- package/dist/{chunk-wx8pg3dw.js → chunk-a6m63ra1.js} +1 -1
- package/dist/{chunk-nb7rbydx.js → chunk-acwjyext.js} +1 -1
- package/dist/{chunk-q7e9d2m9.js → chunk-bskzz385.js} +1 -1
- package/dist/{chunk-jqefbg40.js → chunk-cdb8a0tx.js} +1 -1
- package/dist/chunk-cff5gpvr.js +2 -0
- package/dist/{chunk-akm700yc.js → chunk-cjhpwef8.js} +1 -1
- package/dist/{chunk-81zcv66r.js → chunk-cs9cynxh.js} +1 -1
- package/dist/{chunk-xkeyq622.js → chunk-d1pp19wx.js} +1 -1
- package/dist/chunk-dcc04y1t.js +2 -0
- package/dist/{chunk-kq3erhfz.js → chunk-dzr5w33y.js} +10 -10
- package/dist/chunk-e4gycrtb.js +2 -0
- package/dist/chunk-f7se90b8.js +2 -0
- package/dist/{chunk-ba75f8qh.js → chunk-fee1k8c5.js} +1 -1
- package/dist/{chunk-ttmtwp1x.js → chunk-frh6b2q7.js} +1 -1
- package/dist/{chunk-8m7fhky6.js → chunk-frv8qh41.js} +1 -1
- package/dist/{chunk-mgexc8xe.js → chunk-g6bdbdvj.js} +1 -1
- package/dist/{chunk-savq2gjy.js → chunk-g98vjcbj.js} +1 -1
- package/dist/chunk-gcn830km.js +2 -0
- package/dist/{chunk-fwrhkhhz.js → chunk-gg2epwyx.js} +1 -1
- package/dist/{chunk-geztp3y3.js → chunk-ggsxz07y.js} +1 -1
- package/dist/chunk-h451yyp6.js +2 -0
- package/dist/chunk-hd1hr94w.js +2 -0
- package/dist/chunk-hfc4afre.js +2 -0
- package/dist/{chunk-ypajs9wd.js → chunk-hv6hat6p.js} +1 -1
- package/dist/{chunk-pwfqgvyf.js → chunk-hx0zj6c9.js} +1 -1
- package/dist/{chunk-1nztpv0g.js → chunk-j2pmv4jw.js} +1 -1
- package/dist/{chunk-yx8vftp0.js → chunk-j4ze77e0.js} +1 -1
- package/dist/chunk-j5rmhyqr.js +2 -0
- package/dist/chunk-je7cvg5j.js +2 -0
- package/dist/{chunk-1z4dvqqv.js → chunk-jjehgxtc.js} +1 -1
- package/dist/{chunk-7b9tak12.js → chunk-jqnckvbk.js} +1 -1
- package/dist/{chunk-2w64hysh.js → chunk-k46js7bz.js} +1 -1
- package/dist/{chunk-17kxd17m.js → chunk-m2v35nze.js} +1 -1
- package/dist/{chunk-gtek2yzx.js → chunk-mbwe1z12.js} +1 -1
- package/dist/{chunk-gjapb8k6.js → chunk-mccyah24.js} +1 -1
- package/dist/chunk-mdk3c8n2.js +2 -0
- package/dist/{chunk-74r77tz1.js → chunk-msxcd1kp.js} +1 -1
- package/dist/{chunk-35ezbs7m.js → chunk-n0kbk2ge.js} +1 -1
- package/dist/{chunk-7t4yc43k.js → chunk-n27c7jvr.js} +1 -1
- package/dist/{chunk-fexeqbkk.js → chunk-n7w8kgfw.js} +1 -1
- package/dist/{chunk-rcv6w99y.js → chunk-nnd1hqht.js} +2 -2
- package/dist/{chunk-fj497e24.js → chunk-nrzx6d77.js} +1 -1
- package/dist/{chunk-h9e1mhhk.js → chunk-p4a35r71.js} +1 -1
- package/dist/{chunk-ksrrk187.js → chunk-p56hfz00.js} +1 -1
- package/dist/{chunk-am6ee3yg.js → chunk-pz3n5qde.js} +1 -1
- package/dist/{chunk-vbrbg7s2.js → chunk-qa8qmer5.js} +1 -1
- package/dist/{chunk-znjrab9a.js → chunk-qygqf2zb.js} +1 -1
- package/dist/{chunk-7kpfk426.js → chunk-r2kag877.js} +2 -2
- package/dist/{chunk-6k94kwfr.js → chunk-rkhfhfas.js} +1 -1
- package/dist/{chunk-yzceabbm.js → chunk-s2smc4wv.js} +1 -1
- package/dist/{chunk-q7pafzst.js → chunk-s8bx0wv7.js} +1 -1
- package/dist/{chunk-eb9caxff.js → chunk-sbpzt8yd.js} +1 -1
- package/dist/{chunk-cnayba7d.js → chunk-spnkgsft.js} +21 -21
- package/dist/chunk-ssbddr82.js +2 -0
- package/dist/{chunk-hjdqejae.js → chunk-v4t1kxm7.js} +1 -1
- package/dist/{chunk-ts9swsgf.js → chunk-v65nfy32.js} +1 -1
- package/dist/{chunk-z9tj6jq7.js → chunk-vtfzc29r.js} +1 -1
- package/dist/{chunk-www2w0mc.js → chunk-w56erqz5.js} +1 -1
- package/dist/{chunk-v80629x2.js → chunk-w9yfvb4d.js} +1 -1
- package/dist/chunk-wc5385mg.js +2 -0
- package/dist/{chunk-hh6yxbyv.js → chunk-wdwf3wzg.js} +1 -1
- package/dist/{chunk-tyeb73qy.js → chunk-x21s75kv.js} +1 -1
- package/dist/{chunk-8srw2ck7.js → chunk-x58dcsjw.js} +1 -1
- package/dist/chunk-xrx24ndt.js +2 -0
- package/dist/{chunk-kp0g4ckk.js → chunk-y805f58c.js} +1 -1
- package/dist/{chunk-jd90twtr.js → chunk-yf04htgs.js} +1 -1
- package/dist/{chunk-te108yc3.js → chunk-z0y4gcsp.js} +1 -1
- package/dist/chunk-z54ans51.js +2 -0
- package/dist/cli.js +14 -14
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/database.js +1 -1
- package/dist/index.d.ts +16 -0
- package/dist/index.js +1 -0
- package/dist/pwa.js +2 -2
- package/dist/ssg.js +2 -2
- package/dist/visual-testing.js +1 -1
- package/package.json +5 -5
- package/dist/chunk-0e4xfaxn.js +0 -2
- package/dist/chunk-3w2k2ma8.js +0 -2
- package/dist/chunk-4regf51y.js +0 -2
- package/dist/chunk-67az313z.js +0 -2
- package/dist/chunk-9sg8p36m.js +0 -2
- package/dist/chunk-c0hd0jtr.js +0 -2
- package/dist/chunk-ccbgys65.js +0 -2
- package/dist/chunk-ddqzxbkr.js +0 -2
- package/dist/chunk-dhcdsfga.js +0 -2
- package/dist/chunk-e4ta7mkk.js +0 -2
- package/dist/chunk-fsr7j01j.js +0 -2
- package/dist/chunk-js0r6bc9.js +0 -2
- package/dist/chunk-pwn4hxjb.js +0 -2
- package/dist/chunk-qh9bw4w4.js +0 -2
- package/dist/chunk-r3vb8c9k.js +0 -2
- package/dist/chunk-s9669ak6.js +0 -2
- package/dist/chunk-t4e1wqa0.js +0 -2
- package/dist/chunk-wmwjbk2g.js +0 -2
- package/dist/chunk-xaqjtned.js +0 -3
|
@@ -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}from"./chunk-ntnv2f7a.js";import"./chunk-
|
|
2
|
+
import{bi as a,ci as b,di as c,ei as d,fi as e,gi as f}from"./chunk-ntnv2f7a.js";import"./chunk-j4ze77e0.js";export{c as processTransitionDirectives,f as processTransitionAttributes,b as performLeave,a as performEnter,e as generateTransitionRuntime,d as generateTransitionCSS};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{mg as _$,ng as K5}from"./chunk-
|
|
2
|
+
import{mg as _$,ng as K5}from"./chunk-89nbkhxk.js";import{Ag as q6,Cg as Z1,Dg as y6,Eg as Q5,Fg as B$,Gg as L$,Hg as v6,Ig as g6,xg as y7,zg as U$}from"./chunk-y805f58c.js";import{Bj as c5,uj as u1,vj as O1,wj as H1,xj as m$,yj as p$,zj as p5}from"./chunk-nhmq45hh.js";import{Vj as Y$,Wj as J$}from"./chunk-x58dcsjw.js";import{xk as g5,yk as f5}from"./chunk-8k7evyhh.js";import{Ek as l7,Fk as i7}from"./chunk-frp9fc7j.js";import{hl as Q1}from"./chunk-r84h7wxw.js";import{$l as X6,$o as S6,Dq as O0,Hm as x6,Lm as Z5,Nr as G$,Om as N1,Pm as M1,Rq as Q6,Sq as E1,Vo as Z$,Wq as p0,Zl as b7,Zo as X5,_m as c1,_r as E$,ap as z6,as as d0,bn as L6,bq as g7,bs as M0,fs as V0,iq as P6,jn as n$,jq as b6,ln as o$,on as l1,pm as u0,rp as j0,sn as t$,vn as Q$,wn as F6,zm as s$,zp as m0}from"./chunk-spnkgsft.js";import{Ls as B,Ts as W$,Us as K$,Ys as o}from"./chunk-nnd1hqht.js";import{it as S0}from"./chunk-xgtcq9bj.js";import{Du as A6,Zt as $5,_t as H6,cu as V6,du as E6,su as I6,tu as R6,uu as D6,vu as w6,wu as T6,xu as C6,zu as k6}from"./chunk-r2kag877.js";import{Nu as p}from"./chunk-j4ze77e0.js";var l5={read:($)=>{try{return JSON.parse($)}catch{return $}},write:($)=>{return JSON.stringify($)}};function e7($,X,Q={}){let{storage:Z="local",serializer:Y=l5,mergeDefaults:J=!1,listenToStorageChanges:G=!0}=Q,W=new Set,K=typeof window<"u",_=()=>{if(!K)return null;return Z==="session"?sessionStorage:localStorage},U=()=>{let L=_();if(!L)return X;try{let H=L.getItem($);if(H===null)return X;let q=Y.read(H);if(J&&typeof X==="object"&&X!==null)return{...X,...q};return q}catch{return X}},F=(L)=>{let H=_();if(!H)return;try{if(L===null||L===void 0)H.removeItem($);else H.setItem($,Y.write(L))}catch(q){console.warn(`[useStorage] Failed to write key "${$}":`,q)}},z=U(),j=(L,H)=>{for(let q of W)try{q(L,H)}catch(A){console.error("[useStorage] Subscriber error:",A)}};if(K&&G){let L=(q)=>{if(q.key===$&&q.storageArea===_()){let A=z;try{z=q.newValue?Y.read(q.newValue):X}catch(N){console.warn(`[useStorage] Failed to read key "${$}" from a cross-tab update:`,N);return}j(z,A)}};window.addEventListener("storage",L);let H=globalThis.onDestroy;if(typeof H==="function")H(()=>window.removeEventListener("storage",L))}let O={get value(){return z},set value(L){let H=z;z=L,F(L),j(L,H)},get:()=>z,set:(L)=>{O.value=L},remove:()=>{let L=_();if(L){L.removeItem($);let H=z;z=X,j(X,H)}},subscribe:(L)=>{return W.add(L),L(z,void 0),()=>W.delete(L)}};return O}function i5($,X,Q,Z,Y={}){let{serializer:J=l5,mergeDefaults:G=!1,listenToStorageChanges:W=!0}=Y,K=typeof window<"u",_=()=>{if(!K)return null;return $==="session"?sessionStorage:localStorage},U=(j)=>{if(j===null||j===void 0)return Z;try{let O=J.read(j);if(G&&typeof Z==="object"&&Z!==null)return{...Z,...O};return O}catch(O){return console.warn(`[${X}] Failed to read key "${Q}":`,O),Z}},z=p5((()=>{let j=_();if(!j)return Z;try{return U(j.getItem(Q))}catch(O){return console.warn(`[${X}] Cannot read "${Q}":`,O),Z}})());if(c5(()=>{let j=z(),O=_();if(!O)return;try{if(j===null||j===void 0)O.removeItem(Q);else O.setItem(Q,J.write(j))}catch(L){console.warn(`[${X}] Cannot persist "${Q}":`,L)}}),K&&W){let j=(L)=>{if(L.key!==Q)return;if(L.storageArea&&L.storageArea!==_())return;z.set(U(L.newValue))};window.addEventListener("storage",j);let O=globalThis.onDestroy;if(typeof O==="function")O(()=>window.removeEventListener("storage",j))}return z}function $3($,X,Q){return i5("local","useLocalStorage",$,X,Q)}function X3($,X,Q){return i5("session","useSessionStorage",$,X,Q)}function Q3($="local"){if(typeof window>"u")return;($==="session"?sessionStorage:localStorage).clear()}function Z3($="local"){if(typeof window>"u")return[];let X=$==="session"?sessionStorage:localStorage;return Object.keys(X)}function Y3($="local"){if(typeof window>"u")return 0;let X=$==="session"?sessionStorage:localStorage,Q=0;for(let Z in X)if(Object.prototype.hasOwnProperty.call(X,Z))Q+=(Z.length+(X.getItem(Z)?.length||0))*2;return Q}var l=null;function d1($,X,Q=new WeakSet){if(Object.is($,X))return!0;if(typeof $!=="object"||typeof X!=="object"||$===null||X===null)return!1;if(Q.has($))return!0;if(Q.add($),$ instanceof Date&&X instanceof Date)return $.getTime()===X.getTime();if($ instanceof RegExp&&X instanceof RegExp)return $.source===X.source&&$.flags===X.flags;if(Array.isArray($)){if(!Array.isArray(X)||$.length!==X.length)return!1;for(let J=0;J<$.length;J++)if(!d1($[J],X[J],Q))return!1;return!0}if(Array.isArray(X))return!1;if($ instanceof Map){if(!(X instanceof Map)||$.size!==X.size)return!1;for(let[J,G]of $)if(!X.has(J)||!d1(G,X.get(J),Q))return!1;return!0}if(X instanceof Map)return!1;if($ instanceof Set){if(!(X instanceof Set)||$.size!==X.size)return!1;for(let J of $)if(!X.has(J))return!1;return!0}if(X instanceof Set)return!1;let Z=Object.keys($),Y=Object.keys(X);if(Z.length!==Y.length)return!1;for(let J of Z){if(!Object.prototype.hasOwnProperty.call(X,J))return!1;if(!d1($[J],X[J],Q))return!1}return!0}function UJ($){l=$}function BJ(){return l}function LJ(){return{isMounted:!1,isUnmounted:!1,hooks:{beforeMount:[],mounted:[],beforeUpdate:[],updated:[],beforeUnmount:[],unmounted:[]},effects:[],scope:J3()}}function J3(){return{refs:new Map,effects:new Set,cleanups:[]}}function FJ($){let X=new Set,Q=new Set,Z=$,Y=Symbol("ref"),J={get value(){let G=u1();if(G)Q.add(G);return Z},set value(G){if(!Object.is(G,Z)){let W=Z;Z=G;for(let K of X)K(G,W);for(let K of Q)if(m$())p$(K);else K()}},subscribe(G){return X.add(G),()=>{X.delete(G)}}};if(l)l.scope.refs.set(Y,J);return J}var a5=new WeakMap;function G3($){let X=a5.get($);if(X)return X;let Q=new Map,Z=(G)=>{let W=Q.get(G);if(!W)return;for(let K of[...W])if(m$())p$(K);else K()},Y=(G,W)=>{if(!Q.has(G))Q.set(G,new Set);return Q.get(G).add(W),()=>{Q.get(G)?.delete(W)}},J=new Proxy($,{get(G,W,K){let _=Reflect.get(G,W,K),U=u1();if(U)Y(W,U);if(_!==null&&typeof _==="object"&&!Array.isArray(_)){let F=Object.getPrototypeOf(_);if(F===Object.prototype||F===null)return G3(_)}return _},set(G,W,K,_){let U=Reflect.get(G,W,_),F=Reflect.set(G,W,K,_);if(!Object.is(K,U))Z(W);return F},deleteProperty(G,W){let K=Reflect.deleteProperty(G,W);return Z(W),K}});return a5.set($,J),J}function zJ($){let X,Q=!0,Z=new Set,Y=new Set,J=()=>{Q=!0,G()},G=()=>{if(Q){let K=X,_=O1(J);if(X=$(),H1(_),Q=!1,!Object.is(X,K)){for(let U of Z)U(X,K);for(let U of Y)U()}}},W=O1(J);return X=$(),Q=!1,H1(W),{get value(){let K=u1();if(K)Y.add(K);return G(),X},set value(K){console.warn("[stx] Computed properties are readonly")},subscribe(K){return Z.add(K),()=>{Z.delete(K)}}}}function W3($){if(typeof requestAnimationFrame==="function"){requestAnimationFrame(()=>{requestAnimationFrame($)});return}setTimeout($,0)}function jJ($,X,Q={}){let{immediate:Z=!1,deep:Y=!1,flush:J="post"}=Q,G,W,K=!1,_=()=>{if(K)return;let O=j();if((Y?!d1(O,G):!Object.is(O,G))||Z)if(X(O,G),Y&&O!==null&&typeof O==="object")try{G=structuredClone(O)}catch{G=O}else G=O},U=(O)=>{if(J==="sync")O();else if(J==="pre")Promise.resolve().then(O);else W3(O)},F=!1,z=()=>{if(K||F)return;F=!0,U(()=>{F=!1,_()})},j=()=>{if(typeof $==="function"){let O=O1(z);try{return $()}finally{H1(O)}}return $.value};if(typeof $!=="function"){let O=$.subscribe(()=>{U(_)});W=()=>{K=!0,O()}}else W=()=>{K=!0};if(G=j(),Z)U(_);if(l)l.scope.cleanups.push(()=>W?.());return()=>W?.()}function OJ($,X,Q={}){let Z=[],Y=$.map((J)=>J.value);for(let J of $){let G=J.subscribe(()=>{let W=$.map((K)=>K.value);X(W,Y),Y=[...W]});Z.push(G)}if(Q.immediate){let J=$.map((G)=>G.value);X(J,Y)}return()=>{for(let J of Z)J()}}function HJ($){let X,Q=!1,Z=()=>{if(Q)return;if(X)X();let Y=O1(Z);X=$(),H1(Y)};if(Z(),l)l.scope.cleanups.push(()=>{if(Q=!0,X)X()});return()=>{if(Q=!0,X)X()}}function AJ($){if(l)l.hooks.beforeMount.push($);else console.warn("[stx] onBeforeMount called outside of component setup")}function qJ($){if(l)l.hooks.mounted.push($);else console.warn("[stx] onMounted called outside of component setup")}function NJ($){if(l)l.hooks.beforeUpdate.push($);else console.warn("[stx] onBeforeUpdate called outside of component setup")}function MJ($){if(l)l.hooks.updated.push($);else console.warn("[stx] onUpdated called outside of component setup")}function VJ($){if(l)l.hooks.beforeUnmount.push($);else console.warn("[stx] onBeforeUnmount called outside of component setup")}function EJ($){if(l)l.hooks.unmounted.push($);else console.warn("[stx] onUnmounted called outside of component setup")}async function n0($,X){let Q=$.hooks[X];for(let Z of Q)await Z()}async function IJ($){await n0($,"beforeMount"),$.isMounted=!0,await n0($,"mounted")}async function RJ($){if(!$.isMounted||$.isUnmounted)return;await n0($,"beforeUpdate"),await n0($,"updated")}async function DJ($){if($.isUnmounted)return;await n0($,"beforeUnmount");for(let X of $.scope.cleanups)X();$.isUnmounted=!0,await n0($,"unmounted")}function wJ(){return`
|
|
3
3
|
<script data-stx-client-runtime>
|
|
4
4
|
(function() {
|
|
5
5
|
'use strict';
|
|
@@ -685,7 +685,7 @@ else {
|
|
|
685
685
|
<span class="frontmatter-label">${X}:</span>
|
|
686
686
|
<span>${Array.isArray(Q)?Q.join(", "):String(Q)}</span>
|
|
687
687
|
</div>`).join("")}
|
|
688
|
-
</div>`}import U6 from"net";async function Y4($){return new Promise((X)=>{let Q=U6.createServer();Q.once("error",()=>X(!1)),Q.once("listening",()=>{Q.close(()=>X(!0))}),Q.listen($,"0.0.0.0")})}async function J4($){return new Promise((X)=>{let Q=U6.createServer();Q.once("error",()=>X(!1)),Q.once("listening",()=>{Q.close(()=>X(!0))}),Q.listen($,"::")})}async function G4($){if(!await Y4($))return!1;return await J4($)}async function k0($,X=20){$=Number($);for(let Q=0;Q<X;Q++){let Z=$+Q;if(await G4(Z))return Z}throw Error(`Could not find an available port between ${$} and ${$+X-1}`)}var W4={title:"stx Development",width:1400,height:900,darkMode:!0,hotReload:!0,titlebarHidden:!1,nativeSidebar:!1,sidebarWidth:260,sidebarConfig:void 0};async function K4(){try{let $=await import("./chunk-
|
|
688
|
+
</div>`}import U6 from"net";async function Y4($){return new Promise((X)=>{let Q=U6.createServer();Q.once("error",()=>X(!1)),Q.once("listening",()=>{Q.close(()=>X(!0))}),Q.listen($,"0.0.0.0")})}async function J4($){return new Promise((X)=>{let Q=U6.createServer();Q.once("error",()=>X(!1)),Q.once("listening",()=>{Q.close(()=>X(!0))}),Q.listen($,"::")})}async function G4($){if(!await Y4($))return!1;return await J4($)}async function k0($,X=20){$=Number($);for(let Q=0;Q<X;Q++){let Z=$+Q;if(await G4(Z))return Z}throw Error(`Could not find an available port between ${$} and ${$+X-1}`)}var W4={title:"stx Development",width:1400,height:900,darkMode:!0,hotReload:!0,titlebarHidden:!1,nativeSidebar:!1,sidebarWidth:260,sidebarConfig:void 0};async function K4(){try{let $=await import("./chunk-hv6hat6p.js");if(typeof $.openDevWindow!=="function")return null;return $}catch{return null}}async function t0($,X={}){let Q={...W4,...X},Z=await K4();if(!Z)return console.log(`${B.yellow}\u26A0${B.reset} Native window requested, but @stacksjs/desktop is not available.`),console.log(" Install & build the desktop package to enable --native."),!1;try{let Y=await Z.openDevWindow($,{title:Q.title,width:Q.width,height:Q.height,darkMode:Q.darkMode,hotReload:Q.hotReload,titlebarHidden:Q.titlebarHidden,nativeSidebar:Q.nativeSidebar,sidebarWidth:Q.sidebarWidth,sidebarConfig:Q.sidebarConfig});if(Y&&Q.nativeSidebar)console.log(`${B.green}\u2713${B.reset} Native sidebar enabled (macOS Tahoe style)`);return Y}catch(Y){return console.log(`${B.red}\u2717${B.reset} Could not open native window:`,Y),!1}}function o1($){if($.match(/<Sidebar[\s\S]*?variant=["'](?:tahoe|vibrancy|desktop)["'][\s\S]*?\/>/i)){let Y=$.match(/<script\s+server[^>]*>([\s\S]*?)<\/script>/i);if(Y){let J=Y[1];try{let G=`
|
|
689
689
|
${J}
|
|
690
690
|
return typeof sidebarConfig !== 'undefined' ? sidebarConfig : null;
|
|
691
691
|
`,K=Function(G)();if(K)return K}catch(G){console.warn("Invalid sidebarConfig:",G)}}return{sections:[]}}let Q=$.match(/@nativeSidebar\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(Q)try{return JSON.parse(Q[1])}catch{console.warn("Invalid @nativeSidebar configuration")}let Z=$.match(/<script\s+native-sidebar[^>]*>([\s\S]*?)<\/script>/i);if(Z)try{let Y=Z[1].match(/(?:export\s+(?:default\s+)?|const\s+\w+\s*=\s*)(\{[\s\S]*\})/m);if(Y)return Function(`return ${Y[1]}`)()}catch(Y){console.warn("Invalid native-sidebar script configuration:",Y)}return}function i$(){console.log(`
|
|
@@ -1057,7 +1057,7 @@ else {
|
|
|
1057
1057
|
};
|
|
1058
1058
|
})();
|
|
1059
1059
|
</script>
|
|
1060
|
-
`}function D0($,X,Q={}){let Z=z4(X,Q),Y=$.lastIndexOf("</body>");if(Y!==-1)return $.slice(0,Y)+Z+$.slice(Y);if($.includes("</html>"))return $.replace("</html>",`${Z}</html>`);return $+Z}function t1($){let X=$.toLowerCase();return X.endsWith(".css")||X.endsWith(".scss")||X.endsWith(".sass")||X.endsWith(".less")}function e1($){let X=$.toLowerCase();return[".stx",".html",".htm",".md",".js",".ts",".jsx",".tsx",".json"].some((Z)=>X.endsWith(Z))}function $$($){return[/^\./,/node_modules/,/\.stx\/output/,/\.stx\/cache/,/~$/,/\.swp$/,/\.swo$/].some((Q)=>Q.test($))}var $1=null;function X$($){if(!$1)$1=new B6($);return $1}function A1(){if($1)$1.stop(),$1=null}import q1 from"path";var X1={name:"bun-plugin-stx",async setup($){let Q={...await d0(),...$.config?.stx},Z=new Set,Y=Q.webComponents?.enabled?`./${q1.relative(q1.dirname($.config?.outdir||"dist"),Q.webComponents.outputDir||"dist/web-components")}`:"/web-components",J=[];if(Q.webComponents?.enabled)try{let G=await G$(Q,Z);if(J.push(...G),Q.debug&&G.length>0)console.log(`Successfully built ${G.length} web components`)}catch(G){console.error("Failed to build web components:",G)}$.onLoad({filter:/\.stx$/},async({path:G})=>{try{let W=new Set;if(Q.cache&&Q.cachePath){let L=await Y$(G,Q);if(L){if(Q.debug)console.log(`Using cached version of ${G}`);return{contents:L,loader:"html"}}}let K=await t$(()=>Bun.file(G).text(),"",(L)=>{throw new o$(`Failed to read stx file: ${G}`,G,void 0,void 0,`File read error: ${L.message}`)});if(!K)throw new o$(`stx file is empty: ${G}`,G);let{scriptContent:_,templateContent:U,allScripts:F}=s$.time("script-extraction",()=>{let L=K,H=Z$(K);if(H)L=H.content.trim();let q=K.match(/<script\b[^>]*>[\s\S]*?<\/script>/gi)||[],A="",N=[];for(let M of q){let I=M.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i)?.[1]||"",w=M.match(/<script\b([^>]*)>/i),C=w?w[1]:"";if(/\bserver\b/i.test(C))A=I;else N.push(M)}let V=L.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"");return{scriptContent:A,templateContent:V,allScripts:N}}),z={__filename:G,__dirname:q1.dirname(G),__stx:{webComponentsPath:Y,builtComponents:J}};await t$(()=>j0(_,z,G),void 0,(L)=>{let H=new n$(`Script execution failed in ${G}: ${L.message}`,G,void 0,void 0,_.substring(0,100));if(Q$.log(H,{filePath:G,scriptContent:_}),Q.debug)throw H});let O=await s$.timeAsync("directive-processing",async()=>{return await O0(U,z,G,Q,W)});if(F.length>0){let{interpolateScriptsInTemplate:L}=await import("./chunk-
|
|
1060
|
+
`}function D0($,X,Q={}){let Z=z4(X,Q),Y=$.lastIndexOf("</body>");if(Y!==-1)return $.slice(0,Y)+Z+$.slice(Y);if($.includes("</html>"))return $.replace("</html>",`${Z}</html>`);return $+Z}function t1($){let X=$.toLowerCase();return X.endsWith(".css")||X.endsWith(".scss")||X.endsWith(".sass")||X.endsWith(".less")}function e1($){let X=$.toLowerCase();return[".stx",".html",".htm",".md",".js",".ts",".jsx",".tsx",".json"].some((Z)=>X.endsWith(Z))}function $$($){return[/^\./,/node_modules/,/\.stx\/output/,/\.stx\/cache/,/~$/,/\.swp$/,/\.swo$/].some((Q)=>Q.test($))}var $1=null;function X$($){if(!$1)$1=new B6($);return $1}function A1(){if($1)$1.stop(),$1=null}import q1 from"path";var X1={name:"bun-plugin-stx",async setup($){let Q={...await d0(),...$.config?.stx},Z=new Set,Y=Q.webComponents?.enabled?`./${q1.relative(q1.dirname($.config?.outdir||"dist"),Q.webComponents.outputDir||"dist/web-components")}`:"/web-components",J=[];if(Q.webComponents?.enabled)try{let G=await G$(Q,Z);if(J.push(...G),Q.debug&&G.length>0)console.log(`Successfully built ${G.length} web components`)}catch(G){console.error("Failed to build web components:",G)}$.onLoad({filter:/\.stx$/},async({path:G})=>{try{let W=new Set;if(Q.cache&&Q.cachePath){let L=await Y$(G,Q);if(L){if(Q.debug)console.log(`Using cached version of ${G}`);return{contents:L,loader:"html"}}}let K=await t$(()=>Bun.file(G).text(),"",(L)=>{throw new o$(`Failed to read stx file: ${G}`,G,void 0,void 0,`File read error: ${L.message}`)});if(!K)throw new o$(`stx file is empty: ${G}`,G);let{scriptContent:_,templateContent:U,allScripts:F}=s$.time("script-extraction",()=>{let L=K,H=Z$(K);if(H)L=H.content.trim();let q=K.match(/<script\b[^>]*>[\s\S]*?<\/script>/gi)||[],A="",N=[];for(let M of q){let I=M.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i)?.[1]||"",w=M.match(/<script\b([^>]*)>/i),C=w?w[1]:"";if(/\bserver\b/i.test(C))A=I;else N.push(M)}let V=L.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"");return{scriptContent:A,templateContent:V,allScripts:N}}),z={__filename:G,__dirname:q1.dirname(G),__stx:{webComponentsPath:Y,builtComponents:J}};await t$(()=>j0(_,z,G),void 0,(L)=>{let H=new n$(`Script execution failed in ${G}: ${L.message}`,G,void 0,void 0,_.substring(0,100));if(Q$.log(H,{filePath:G,scriptContent:_}),Q.debug)throw H});let O=await s$.timeAsync("directive-processing",async()=>{return await O0(U,z,G,Q,W)});if(F.length>0){let{interpolateScriptsInTemplate:L}=await import("./chunk-nrzx6d77.js"),H=L(F.join(`
|
|
1061
1061
|
`),z),q=O.search(/<\/body>/i);if(q!==-1)O=O.slice(0,q)+H+`
|
|
1062
1062
|
`+O.slice(q);else O+=`
|
|
1063
1063
|
${H}`}if(O=await z6(O),W.forEach((L)=>Z.add(L)),Q.cache&&Q.cachePath){if(await J$(G,O,W,Q),Q.debug)console.log(`Cached template ${G} with ${W.size} dependencies`)}return{contents:O,loader:"html"}}catch(W){let K=W instanceof Error?W:new n$(`Plugin processing failed: ${String(W)}`,G);if(Q$.log(K,{filePath:G,buildConfig:$.config}),F6.logDetailedError(K,{filePath:G,plugin:"bun-plugin-stx"}),Q.debug)console.error("stx Plugin Error:",K);let _=K,U=_.line||null,F=_.context||null;return{contents:Q.debug||L6()?`<!DOCTYPE html>
|
|
@@ -1120,7 +1120,7 @@ ${H}`}if(O=await z6(O),W.forEach((L)=>Z.add(L)),Q.cache&&Q.cachePath){if(await J
|
|
|
1120
1120
|
<h1>Something went wrong</h1>
|
|
1121
1121
|
<p>An internal error occurred. Please try again later.</p>
|
|
1122
1122
|
</body>
|
|
1123
|
-
</html>`,loader:"html"}}})}};async function O4($,X={}){let Q=X.port||3000,Z=X.watch!==!1,Y=X.hotReload!==!1&&Z,J=null,G=X.hmrPort||Q+1,W=Y0.resolve($);if(!H0.existsSync(W))return console.error(`${B.red}Error: File not found: ${B.bright}${W}${B.reset}`),!1;if(W.endsWith(".md"))return r$(W,X);else if(!W.endsWith(".stx"))return console.error(`${B.red}Error: Unsupported file type: ${B.bright}${W}${B.reset}. Only .stx and .md files are supported.`),!1;let K=S0(process.cwd(),"output");H0.mkdirSync(K,{recursive:!0}),console.log(`${B.blue}Building ${B.bright}${$}${B.reset}...`);let _=null,U=async()=>{try{let A={name:"public-assets",setup(I){I.onResolve({filter:/^\/(images|fonts|assets|public)\//},(w)=>{return{path:w.path,external:!0}})}},N=await Bun.build({entrypoints:[W],outdir:K,plugins:[A,X1],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...X.stxOptions});if(!N.success)return console.error(`${B.red}Build failed:${B.reset}`,N.logs),!1;let V=N.outputs.find((I)=>I.path.endsWith(".html"));if(!V)return console.error(`${B.red}No HTML output found${B.reset}`),!1;return _=await Bun.file(V.path).text(),!0}catch(A){return console.error(`${B.red}Error building stx file:${B.reset}`,A),!1}};if(!await U())return!1;let z=Y0.dirname(W);await W$(z);let j=Q;try{if(j=await k0(Q),j!==Q)console.log(`${B.yellow}Port ${Q} is busy, using port ${j} instead${B.reset}`)}catch{return console.error(`${B.red}Could not find an available port${B.reset}`),!1}if(Y){let A=X.hmrPort||j+1;J=X$({wsPort:A,verbose:!1}),G=J.start(A)}let O={},L=null;try{let{loadStxConfig:A}=await import("./chunk-
|
|
1123
|
+
</html>`,loader:"html"}}})}};async function O4($,X={}){let Q=X.port||3000,Z=X.watch!==!1,Y=X.hotReload!==!1&&Z,J=null,G=X.hmrPort||Q+1,W=Y0.resolve($);if(!H0.existsSync(W))return console.error(`${B.red}Error: File not found: ${B.bright}${W}${B.reset}`),!1;if(W.endsWith(".md"))return r$(W,X);else if(!W.endsWith(".stx"))return console.error(`${B.red}Error: Unsupported file type: ${B.bright}${W}${B.reset}. Only .stx and .md files are supported.`),!1;let K=S0(process.cwd(),"output");H0.mkdirSync(K,{recursive:!0}),console.log(`${B.blue}Building ${B.bright}${$}${B.reset}...`);let _=null,U=async()=>{try{let A={name:"public-assets",setup(I){I.onResolve({filter:/^\/(images|fonts|assets|public)\//},(w)=>{return{path:w.path,external:!0}})}},N=await Bun.build({entrypoints:[W],outdir:K,plugins:[A,X1],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...X.stxOptions});if(!N.success)return console.error(`${B.red}Build failed:${B.reset}`,N.logs),!1;let V=N.outputs.find((I)=>I.path.endsWith(".html"));if(!V)return console.error(`${B.red}No HTML output found${B.reset}`),!1;return _=await Bun.file(V.path).text(),!0}catch(A){return console.error(`${B.red}Error building stx file:${B.reset}`,A),!1}};if(!await U())return!1;let z=Y0.dirname(W);await W$(z);let j=Q;try{if(j=await k0(Q),j!==Q)console.log(`${B.yellow}Port ${Q} is busy, using port ${j} instead${B.reset}`)}catch{return console.error(`${B.red}Could not find an available port${B.reset}`),!1}if(Y){let A=X.hmrPort||j+1;J=X$({wsPort:A,verbose:!1}),G=J.start(A)}let O={},L=null;try{let{loadStxConfig:A}=await import("./chunk-xrx24ndt.js"),N=await A();if(N?.apiRouter)L=N?.apiRouter,console.log(`${B.blue}Using custom router for API handling${B.reset}`);if(N?.apiRoutes){O=N.apiRoutes;let V=Object.keys(O).length;if(V>0)console.log(`${B.blue}Loaded ${B.bright}${V} API route${V>1?"s":""}${B.reset}`)}if(N?.broadcasting?.enabled)try{let{startBroadcasting:V,loadChannels:M}=await import("./chunk-frv8qh41.js"),I=N.broadcasting;await V(I);let w=I.port??6001;console.log(`${B.magenta}Broadcasting on ${B.cyan}ws://localhost:${w}/ws${B.reset}`);let C=Y0.join(process.cwd(),"channels.ts");if(H0.existsSync(C))try{let R=await M(C);console.log(`${B.blue}Loaded ${B.bright}${R} broadcast channel${R!==1?"s":""}${B.blue} from channels.ts${B.reset}`)}catch(R){console.warn(`${B.yellow}Failed to load channels.ts: ${R.message}${B.reset}`)}}catch(V){console.warn(`${B.yellow}Broadcasting failed to start: ${V.message}${B.reset}`)}}catch{}if(console.log(`${B.blue}Starting server on ${B.cyan}http://localhost:${j}/${B.reset}...`),Y)console.log(`${B.magenta}Hot reload enabled on ws://localhost:${G}${B.reset}`);let H=j4({port:j,async fetch(A){return _$(A,await(async()=>{let N=new URL(A.url);if(L)try{let C=await L.handleRequest(A);if(C.status!==404)return C}catch{}if(O[N.pathname])try{return await O[N.pathname](A)}catch(C){return new Response(JSON.stringify({error:C.message}),{status:500,headers:{"Content-Type":"application/json"}})}if(N.pathname==="/")return(async()=>{let R=await o(_||"");if(Y)R=D0(R,G);if(X.native)if(R.includes("<head>"))R=R.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else if(R.includes("<html"))R=R.replace(/(<html[^>]*>)/,"$1<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>");else R="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+R;if(X.titlebarHidden)if(R.includes("<head>"))R=R.replace("<head>","<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script>");else if(R.includes("<html"))R=R.replace(/(<html[^>]*>)/,"$1<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>");else R=`<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>${R}`;return R})().then((R)=>new Response(R,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}}));let V=Y0.join(K,N.pathname);if(H0.existsSync(V)&&H0.statSync(V).isFile()){let C=Bun.file(V),R=Y0.extname(V).toLowerCase(),E="text/plain";if(R===".ts"||R===".tsx"){let h=new Bun.Transpiler({loader:R===".tsx"?"tsx":"ts"}),u=await C.text(),t=h.transformSync(u);return new Response(t,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(R){case".html":E="text/html";break;case".css":E="text/css";break;case".js":E="text/javascript";break;case".json":E="application/json";break;case".png":E="image/png";break;case".jpg":case".jpeg":E="image/jpeg";break;case".gif":E="image/gif";break;case".woff":E="font/woff";break;case".woff2":E="font/woff2";break;case".ttf":E="font/ttf";break;case".otf":E="font/otf";break;case".eot":E="application/vnd.ms-fontobject";break}return new Response(C,{headers:{"Content-Type":E}})}let M=Y0.dirname(W),I=Y0.join(M,N.pathname);if(H0.existsSync(I)&&H0.statSync(I).isFile()){let C=Bun.file(I),R=Y0.extname(I).toLowerCase(),E="text/plain";if(R===".ts"||R===".tsx"){let h=new Bun.Transpiler({loader:R===".tsx"?"tsx":"ts"}),u=await C.text(),t=h.transformSync(u);return new Response(t,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(R){case".html":E="text/html";break;case".css":E="text/css";break;case".js":E="text/javascript";break;case".json":E="application/json";break;case".png":E="image/png";break;case".jpg":case".jpeg":E="image/jpeg";break;case".gif":E="image/gif";break;case".svg":E="image/svg+xml";break;case".ico":E="image/x-icon";break;case".woff":E="font/woff";break;case".woff2":E="font/woff2";break;case".ttf":E="font/ttf";break;case".otf":E="font/otf";break;case".eot":E="application/vnd.ms-fontobject";break}return new Response(C,{headers:{"Content-Type":E}})}let w=Y0.join(process.cwd(),"public",N.pathname);if(H0.existsSync(w)&&H0.statSync(w).isFile()){let C=Bun.file(w),R=Y0.extname(w).toLowerCase(),E="application/octet-stream";if(R===".ts"||R===".tsx"){let h=new Bun.Transpiler({loader:R===".tsx"?"tsx":"ts"}),u=await C.text(),t=h.transformSync(u);return new Response(t,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(R){case".html":E="text/html";break;case".css":E="text/css";break;case".js":E="text/javascript";break;case".json":E="application/json";break;case".png":E="image/png";break;case".jpg":case".jpeg":E="image/jpeg";break;case".gif":E="image/gif";break;case".svg":E="image/svg+xml";break;case".ico":E="image/x-icon";break;case".woff":E="font/woff";break;case".woff2":E="font/woff2";break;case".ttf":E="font/ttf";break;case".otf":E="font/otf";break;case".eot":E="application/vnd.ms-fontobject";break}return new Response(C,{headers:{"Content-Type":E}})}return new Response("Not Found",{status:404})})())},error(A){return new Response(`<pre>${A}
|
|
1124
1124
|
${A.stack}</pre>`,{headers:{"Content-Type":"text/html"}})}});console.clear(),console.log(`
|
|
1125
1125
|
${B.blue}stx${B.reset} ${B.green}${process.env.stx_VERSION||"v0.0.10"}${B.reset} ${B.dim}ready in ${Math.random()*10+5|0}.${Math.random()*90+10|0} ms${B.reset}`),console.log(`
|
|
1126
1126
|
${B.bright}\u2192 ${B.cyan}http://localhost:${j}/${B.reset}`),console.log(`
|
|
@@ -1607,12 +1607,12 @@ ${O.stack}</pre>`,{headers:{"Content-Type":"text/html"}})}});console.clear(),con
|
|
|
1607
1607
|
${B.blue}stx${B.reset} ${B.green}${process.env.stx_VERSION||"v0.0.10"}${B.reset} ${B.dim}ready in ${Math.random()*10+5|0}.${Math.random()*90+10|0} ms${B.reset}`),console.log(`
|
|
1608
1608
|
${B.bright}\u2192 ${B.cyan}http://localhost:${U}/${B.reset}`),console.log(`
|
|
1609
1609
|
${B.yellow}Routes:${B.reset}`);let z=new Set(W.map((O)=>O.routeTemplate)),j=Object.entries(G).filter(([O])=>!z.has(O)).sort(([O],[L])=>O.localeCompare(L)).map(([O,L])=>({route:O==="/"?"/":O,filePath:Q0.relative(process.cwd(),L.filePath),fileType:L.fileType}));for(let O of W){let L=O.routeTemplate.replace(/\[([^\]]+)\]/g,":$1");j.push({route:L,filePath:Q0.relative(process.cwd(),O.filePath),fileType:"stx"})}if(j.sort((O,L)=>O.route.localeCompare(L.route)),j.forEach((O,L)=>{let q=L===j.length-1?"\u2514\u2500 ":"\u251C\u2500 ",A=O.fileType==="md"?`${B.magenta}(markdown)${B.reset}`:"";console.log(` ${B.green}${q}${O.route}${B.reset} \u2192 ${B.bright}${O.filePath}${B.reset} ${A}`)}),console.log(`
|
|
1610
|
-
Press ${B.cyan}h${B.reset} + ${B.cyan}Enter${B.reset} to show shortcuts`),x0(F.url.toString(),()=>{if(Z)P0.watch(J,{recursive:!0}).close();F.stop()}),Z){console.log(`${B.blue}Watching for changes...${B.reset}`);let O=P0.watch(J,{recursive:!0},async(L,H)=>{if(!H)return;if(H.endsWith(".stx")||H.endsWith(".js")||H.endsWith(".ts")||H.endsWith(".md"))console.log(`${B.yellow}File ${B.bright}${H}${B.yellow} changed, rebuilding...${B.reset}`),m0.clear(),p0(),await K()});process.on("SIGINT",()=>{O.close(),F.stop(),process.exit(0)})}return!0}function O6($){return String($??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}var{serve:q4}=globalThis.Bun;import J0 from"fs";import g from"path";async function M6($){try{return Z5(await Bun.file($).text())}catch{return}}function e$($){let X=Bun.file($),Q=g.extname($).toLowerCase(),Z={".html":"text/html",".css":"text/css",".js":"text/javascript",".json":"application/json",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".ico":"image/x-icon",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"},J=[".js",".css",".json"].includes(Q)?{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}:{};return new Response(X,{headers:{"Content-Type":Z[Q]||"application/octet-stream",...J}})}async function N4($=".",X={}){let Q=X.port||3000,Z=X.watch!==!1,Y=X.hotReload!==!1&&Z,J=null,G=X.hmrPort||Q+1,W=g.resolve($),{loadStxConfig:K}=await import("./chunk-9sg8p36m.js"),_=await K(W),U=_.root&&_.root!=="."?g.join(W,_.root):W,F=X.pagesDir||_.pagesDir||"pages",z=g.join(U,F);if(!J0.existsSync(z))return console.error(`${B.red}Error: No '${F}' directory found${B.reset}`),console.log(`${B.dim}Looked in: ${B.bright}${z}${B.reset}`),console.log(`${B.dim}Run stx dev from the app directory, pass it as an argument (stx dev <dir>),${B.reset}`),console.log(`${B.dim}point at another directory with --pages <dir>, or set pagesDir in stx.config.ts.${B.reset}`),console.log(`${B.dim}Starting fresh? Create ${F}/index.stx for the homepage.${B.reset}`),!1;let j=X5(U,{pagesDir:F});if(j.length===0)return console.error(`${B.red}Error: No page files found in ${B.bright}${z}${B.reset}`),!1;console.log(`${B.blue}Found ${B.bright}${j.length}${B.blue} routes${B.reset}`);let O=_?._pluginPageDirs||[],L=[];for(let{dir:D,prefix:T}of O)if(J0.existsSync(D)){let x=X5(g.dirname(D),{pagesDir:g.basename(D)});for(let S of x){let b=T==="/"?S.pattern:`${T}${S.pattern==="/"?"":S.pattern}`;L.push({route:{...S,pattern:b},prefix:T})}if(x.length>0)console.log(`${B.blue}Plugin pages: ${B.bright}${x.length}${B.blue} routes at ${B.cyan}${T}${B.reset}`)}let H=new Map,q=null,A=null;if(X.stxOptions?.shell!==!1){if(A=await y6(W,X.stxOptions?.shell),A){if(q=await Q5(A,X.stxOptions||{}),q)console.log(`${B.blue}Using app shell: ${B.bright}${g.relative(W,A)}${B.reset} ${B.dim}(deprecated: use layouts/default.stx instead)${B.reset}`)}}I6(),await D6(W);let N=R6();if(N.length>0)console.log(`${B.blue}Loaded ${B.bright}${N.length}${B.blue} middleware: ${B.dim}${N.join(", ")}${B.reset}`);let V={},M=null;try{let{loadStxConfig:D}=await import("./chunk-9sg8p36m.js"),T=await D(W);if(T?.apiRouter)M=T?.apiRouter,console.log(`${B.blue}Using custom router for API handling${B.reset}`);if(T?.apiRoutes){V=T.apiRoutes;let x=Object.keys(V).length;if(x>0)console.log(`${B.blue}Loaded ${B.bright}${x} API route${x>1?"s":""}${B.reset}`)}if(T?.broadcasting?.enabled)try{let{startBroadcasting:x,loadChannels:S}=await import("./chunk-8m7fhky6.js"),b=T.broadcasting;await x(b);let _0=b.port??6001;console.log(`${B.magenta}Broadcasting on ${B.cyan}ws://localhost:${_0}/ws${B.reset}`);let K0=g.join(process.cwd(),"channels.ts");if(J0.existsSync(K0))try{let C0=await S(K0);console.log(`${B.blue}Loaded ${B.bright}${C0} broadcast channel${C0!==1?"s":""}${B.blue} from channels.ts${B.reset}`)}catch(C0){console.warn(`${B.yellow}Failed to load channels.ts: ${C0.message}${B.reset}`)}}catch(x){console.warn(`${B.yellow}Broadcasting failed to start: ${x.message}${B.reset}`)}}catch{}let I=S0(W,"output");J0.mkdirSync(I,{recursive:!0});let w=new Map,C=new Set,R=async(D)=>{let T=V6(z,D);if(!T)return null;try{let x=await Bun.build({entrypoints:[T],outdir:I,plugins:[X1],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...X.stxOptions});if(!x.success)return null;let S=x.outputs.find((b)=>b.path.endsWith(".html"));if(!S)return null;return await Bun.file(S.path).text()}catch{return null}},E=new Map,h=async(D,T)=>{try{let{processDirectives:x,extractVariables:S,defaultConfig:b,loadStxConfig:_0,injectRouterScript:K0}=await import("./chunk-9sg8p36m.js"),{checkCache:C0,cacheTemplate:u$,readFileCached:r,templateCache:f1}=await import("./chunk-tyeb73qy.js"),h1=await _0(W),k=(d)=>{if(!d)return d;if(g.isAbsolute(d))return d;return g.resolve(W,d)},y={...b,...h1,...X.stxOptions,autoShell:!0};if(X.debugDirectives)y.debug=!0;y.partialsDir=k(y.partialsDir),y.componentsDir=k(y.componentsDir),y.layoutsDir=k(y.layoutsDir),y.storesDir=k(y.storesDir||"stores"),y.cachePath=k(y.cachePath)??S0(W,"cache");let m=!T&&!X.profile,c=y.cache!==!1;if(c&&m){let d=f1.get(D.filePath);if(d)try{if((await J0.promises.stat(D.filePath)).mtime.getTime()<=d.mtime){let z0=!0;for(let $0 of d.dependencies){if(!J0.existsSync($0)){z0=!1;break}if((await J0.promises.stat($0)).mtime.getTime()>d.mtime){z0=!1;break}}if(z0){let $0=d.output;if(q)$0=L$($0,{preserveHead:!0});let j1=E.get(D.filePath);return{route:D,content:$0,status:j1?.status??await M6(D.filePath),headers:j1?.headers}}}}catch{}let L0=await C0(D.filePath,y);if(L0){let F0=L0;if(q)F0=L$(F0,{preserveHead:!0});let z0=E.get(D.filePath);return{route:D,content:F0,status:z0?.status??await M6(D.filePath),headers:z0?.headers}}}let s=c?await r(D.filePath):await Bun.file(D.filePath).text(),v=Z5(s),{classifyAllScripts:U0}=await import("./chunk-9sg8p36m.js"),B0=U0(s),a=B0.server.map((d)=>d.content),e=s;for(let d of B0.server)e=e.replace(d.fullTag,"");let n={__filename:D.filePath,__dirname:g.dirname(D.filePath),params:T??{},__stx_runtime_head:{}};for(let d of a)try{await S(d,n,D.filePath)}catch(L0){if(X.stxOptions?.debug)console.error("[stx] variable extraction error",D.filePath,L0?.message||L0)}let r0=new Set,N0;if(X.profile){let d=performance.now();N0=await x(e,n,D.filePath,y,r0);let L0=performance.now()-d,F0=g.relative(W,D.filePath)||D.filePath;console.log(`[stx:profile] ${F0} \u2192 ${L0.toFixed(2)}ms`)}else N0=await x(e,n,D.filePath,y,r0);if(!q)N0=await K0(N0,{router:y.router});{let{interpolateScriptExpressions:d}=await import("./chunk-fj497e24.js");N0=N0.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/g,(L0,F0,z0)=>{if(!/function\s+__stx_setup_/.test(z0))return L0;return`<script${F0}>${d(z0,n)}</script>`})}if(q)N0=L$(N0,{preserveHead:!0});if(c&&m)await u$(D.filePath,N0,r0,y);let{extractStreamBoundaries:t7}=await import("./chunk-yzceabbm.js"),s0=t7(n),z1=n.__streamTemplates;if(z1&&typeof z1==="object"&&Object.keys(z1).length>0){let d=n.streamBoundaries||{},L0={...y,autoShell:!1},F0=Object.keys(z1).map(($0)=>({id:$0,render:async()=>{let j1=typeof d[$0]==="function"?await d[$0]():void 0;return x(z1[$0],{...n,$boundary:j1},D.filePath,L0,new Set)}})),z0=new Set(F0.map(($0)=>$0.id));s0=[...(s0||[]).filter(($0)=>!z0.has($0.id)),...F0]}if(s0&&s0.length>0)C.add(D.pattern);else s0=void 0;let u5=N1(n),m5=M1(n);if(m)E.set(D.filePath,{status:u5,headers:m5});return{route:D,content:N0,status:u5??v,headers:m5,boundaries:s0}}catch(x){return console.error(`${B.red}Error building ${B.bright}${D.pattern}${B.reset}:`,x),null}},u=8,t=async()=>{w.clear(),H.clear();for(let D=0;D<j.length;D+=u){let T=j.slice(D,D+u),x=await Promise.all(T.map((S)=>h(S)));for(let S of x)if(S)w.set(S.route.pattern,S)}for(let D=0;D<L.length;D+=u){let T=L.slice(D,D+u),x=await Promise.all(T.map(({route:S})=>h(S)));for(let S of x)if(S)H.set(S.route.pattern,S)}return w.size>0};if(console.log(`${B.blue}Building pages...${B.reset}`),!await t())return console.error(`${B.red}No pages were successfully built${B.reset}`),!1;await W$(W);let W0=Q;try{if(W0=await k0(Q),W0!==Q)console.log(`${B.yellow}Port ${Q} is busy, using port ${W0} instead${B.reset}`)}catch{return console.error(`${B.red}Could not find an available port${B.reset}`),!1}if(Y){let D=X.hmrPort||W0+1;J=X$({wsPort:D,verbose:!1}),G=J.start(D)}let v1=(D,T)=>{let S=`<script data-stx-route-params>(function(){var p=${JSON.stringify(T).replace(/</g,"\\u003C").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")};window.__stx_rp=p;if(window.stx){window.stx._rp=p;if(window.stx.setRouteParams)window.stx.setRouteParams(p)}})()</script>`;if(D.includes("</head>"))return D.replace("</head>",`${S}</head>`);if(D.includes("<body"))return D.replace(/<body([^>]*)>/,`<body$1>${S}`);return S+D};console.log(`${B.blue}Starting server...${B.reset}`);let g1=q4({port:W0,async fetch(D){let T=new URL(D.url),x=_?.publicDir||"public",S=g.join(W,x,T.pathname),b=g.join(W,T.pathname),_0=g.join(I,T.pathname),[K0,C0,u$]=await Promise.all([J0.promises.stat(S).catch(()=>null),J0.promises.stat(b).catch(()=>null),J0.promises.stat(_0).catch(()=>null)]);if(K0?.isFile())return e$(S);if(C0?.isFile())return e$(b);if(u$?.isFile())return e$(_0);if(T.pathname.startsWith("/_stx/component/")){let k=decodeURIComponent(T.pathname.slice(16));if(k)try{let y=`<${k} />`,m={...buildConfig,autoShell:!1},c=await processDirectives(y,{},g.join(W,"components",`${k}.stx`),m,new Set);return new Response(c,{headers:{"Content-Type":"text/html"}})}catch(y){return new Response(`<div class="stx-async-error">${y.message}</div>`,{status:500,headers:{"Content-Type":"text/html"}})}}if(T.pathname==="/_stx/img"){let{handleImageRequest:k}=await import("./chunk-ddqzxbkr.js"),y=await k(D,{publicDir:g.join(W,x),cacheDir:S0(W,"cache","img")});if(y)return y}if(M)try{let k=await M.handleRequest(D);if(k.status!==404)return k}catch{}if(V[T.pathname])try{return await V[T.pathname](D)}catch(k){return new Response(JSON.stringify({error:k.message}),{status:500,headers:{"Content-Type":"application/json"}})}let r=$5(T.pathname,j);if(r){let k=w.get(r.route.pattern),y=C.has(r.route.pattern);if(r.route.isDynamic&&Object.keys(r.params).length>0||y){let m=await h(r.route,r.params);if(m)k=m}if(k){let m=k.status??200,c=k.headers??{},s=(r.route.filePath?x6(await Bun.file(r.route.filePath).text().catch(()=>"")):null)??{};if(s.validate){if(!await s.validate({params:r.params})){let B0=await R(404);if(B0){let a=B0;if(a=await o(a,W),Y)a=D0(a,G);return new Response(a,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})}}if(s.middleware){let U0=w6(T.pathname,r.params,s,T.search),B0=T6(U0,null,D,{isServer:!0}),a=await C6(s.middleware,B0);if(a.redirect){let e=a.redirect.path,n=a.redirect.options.redirectCode||302,r0=new Headers(a.responseHeaders);return r0.set("Location",e),new Response(null,{status:n,headers:r0})}if(a.abort){let{statusCode:e,message:n}=a.abort.error;return new Response(`<!DOCTYPE html><html><head><title>Error ${e}</title></head><body><h1>Error ${e}</h1><p>${n}</p></body></html>`,{status:e,headers:{"Content-Type":"text/html"}})}if(Object.keys(a.state).length>0){let e=`<script>(function(){var s=typeof stx!=='undefined'?stx:{};s._ms=${JSON.stringify(a.state)};if(s.setMiddlewareState)s.setMiddlewareState(s._ms);})()</script>`;k.content=k.content.replace("</head>",`${e}</head>`)}}let v=k.content;if(q&&v6(D)){let U0=k6(v),B0=S6(v),a=v.match(/<title[^>]*>([\s\S]*?)<\/title>/i),e=a?a[1].trim():"";if(Object.keys(r.params).length>0)v=v1(v,r.params);v=await o(v,W);let n=_?.router?.container||"main";return v=g6(v,n),new Response(v,{status:m,headers:{"Content-Type":"text/html","X-STX-Fragment":"true","X-STX-Layout":U0.layout,"X-STX-Layout-Group":U0.group,"X-STX-Runtime":B0?"true":"false",...e&&{"X-STX-Title":encodeURIComponent(e)},[P6]:b6(),...Z1(),"Cache-Control":U$}})}if(q)v=B$(q,v);if(Object.keys(r.params).length>0)v=v1(v,r.params);if(v=await o(v,W),Y)v=D0(v,G);if(X.native)if(v.includes("<head>"))v=v.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else v="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+v;if(X.titlebarHidden)if(v.includes("<head>"))v=v.replace("<head>","<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script>");else v=`<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>${v}`;if(k.boundaries&&k.boundaries.length>0){let{renderStreamingPage:U0,streamToResponse:B0}=await import("./chunk-yzceabbm.js");return B0(U0(v,k.boundaries,{timeoutMs:30000}),{status:m,headers:{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}return new Response(v,{status:m,headers:{"Content-Type":"text/html",...Z1(),"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0",...c}})}}if(L.length>0){let k=L.map((m)=>m.route),y=$5(T.pathname,k);if(y){let m=H.get(y.route.pattern);if(m){let c=m.content;if(q)c=B$(q,c);if(Object.keys(y.params).length>0)c=v1(c,y.params);if(c=await o(c,W),Y)c=D0(c,G);return new Response(c,{status:m.status??200,headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}for(let{prefix:m}of O)if(m!=="/"&&T.pathname.startsWith(m)){let c=H.get(m)||H.get(m+"/");if(c){let s=c.content;if(q)s=B$(q,s);if(s=await o(s,W),Y)s=D0(s,G);return new Response(s,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}}let f1=w.get("/");if(f1){let k=f1.content;if(k=await o(k,W),Y)k=D0(k,G);if(X.native)if(k.includes("<head>"))k=k.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else k="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+k;return new Response(k,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}let h1=await R(404);if(h1){let k=h1;if(k=await o(k,W),Y)k=D0(k,G);return new Response(k,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})},async error(D){let T=await R(500);if(T)return new Response(T,{status:500,headers:{"Content-Type":"text/html"}});return new Response(`<pre>${D}
|
|
1610
|
+
Press ${B.cyan}h${B.reset} + ${B.cyan}Enter${B.reset} to show shortcuts`),x0(F.url.toString(),()=>{if(Z)P0.watch(J,{recursive:!0}).close();F.stop()}),Z){console.log(`${B.blue}Watching for changes...${B.reset}`);let O=P0.watch(J,{recursive:!0},async(L,H)=>{if(!H)return;if(H.endsWith(".stx")||H.endsWith(".js")||H.endsWith(".ts")||H.endsWith(".md"))console.log(`${B.yellow}File ${B.bright}${H}${B.yellow} changed, rebuilding...${B.reset}`),m0.clear(),p0(),await K()});process.on("SIGINT",()=>{O.close(),F.stop(),process.exit(0)})}return!0}function O6($){return String($??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}var{serve:q4}=globalThis.Bun;import J0 from"fs";import g from"path";async function M6($){try{return Z5(await Bun.file($).text())}catch{return}}function e$($){let X=Bun.file($),Q=g.extname($).toLowerCase(),Z={".html":"text/html",".css":"text/css",".js":"text/javascript",".json":"application/json",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".ico":"image/x-icon",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"},J=[".js",".css",".json"].includes(Q)?{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}:{};return new Response(X,{headers:{"Content-Type":Z[Q]||"application/octet-stream",...J}})}async function N4($=".",X={}){let Q=X.port||3000,Z=X.watch!==!1,Y=X.hotReload!==!1&&Z,J=null,G=X.hmrPort||Q+1,W=g.resolve($),{loadStxConfig:K}=await import("./chunk-xrx24ndt.js"),_=await K(W),U=_.root&&_.root!=="."?g.join(W,_.root):W,F=X.pagesDir||_.pagesDir||"pages",z=g.join(U,F);if(!J0.existsSync(z))return console.error(`${B.red}Error: No '${F}' directory found${B.reset}`),console.log(`${B.dim}Looked in: ${B.bright}${z}${B.reset}`),console.log(`${B.dim}Run stx dev from the app directory, pass it as an argument (stx dev <dir>),${B.reset}`),console.log(`${B.dim}point at another directory with --pages <dir>, or set pagesDir in stx.config.ts.${B.reset}`),console.log(`${B.dim}Starting fresh? Create ${F}/index.stx for the homepage.${B.reset}`),!1;let j=X5(U,{pagesDir:F});if(j.length===0)return console.error(`${B.red}Error: No page files found in ${B.bright}${z}${B.reset}`),!1;console.log(`${B.blue}Found ${B.bright}${j.length}${B.blue} routes${B.reset}`);let O=_?._pluginPageDirs||[],L=[];for(let{dir:D,prefix:T}of O)if(J0.existsSync(D)){let x=X5(g.dirname(D),{pagesDir:g.basename(D)});for(let S of x){let b=T==="/"?S.pattern:`${T}${S.pattern==="/"?"":S.pattern}`;L.push({route:{...S,pattern:b},prefix:T})}if(x.length>0)console.log(`${B.blue}Plugin pages: ${B.bright}${x.length}${B.blue} routes at ${B.cyan}${T}${B.reset}`)}let H=new Map,q=null,A=null;if(X.stxOptions?.shell!==!1){if(A=await y6(W,X.stxOptions?.shell),A){if(q=await Q5(A,X.stxOptions||{}),q)console.log(`${B.blue}Using app shell: ${B.bright}${g.relative(W,A)}${B.reset} ${B.dim}(deprecated: use layouts/default.stx instead)${B.reset}`)}}I6(),await D6(W);let N=R6();if(N.length>0)console.log(`${B.blue}Loaded ${B.bright}${N.length}${B.blue} middleware: ${B.dim}${N.join(", ")}${B.reset}`);let V={},M=null;try{let{loadStxConfig:D}=await import("./chunk-xrx24ndt.js"),T=await D(W);if(T?.apiRouter)M=T?.apiRouter,console.log(`${B.blue}Using custom router for API handling${B.reset}`);if(T?.apiRoutes){V=T.apiRoutes;let x=Object.keys(V).length;if(x>0)console.log(`${B.blue}Loaded ${B.bright}${x} API route${x>1?"s":""}${B.reset}`)}if(T?.broadcasting?.enabled)try{let{startBroadcasting:x,loadChannels:S}=await import("./chunk-frv8qh41.js"),b=T.broadcasting;await x(b);let _0=b.port??6001;console.log(`${B.magenta}Broadcasting on ${B.cyan}ws://localhost:${_0}/ws${B.reset}`);let K0=g.join(process.cwd(),"channels.ts");if(J0.existsSync(K0))try{let C0=await S(K0);console.log(`${B.blue}Loaded ${B.bright}${C0} broadcast channel${C0!==1?"s":""}${B.blue} from channels.ts${B.reset}`)}catch(C0){console.warn(`${B.yellow}Failed to load channels.ts: ${C0.message}${B.reset}`)}}catch(x){console.warn(`${B.yellow}Broadcasting failed to start: ${x.message}${B.reset}`)}}catch{}let I=S0(W,"output");J0.mkdirSync(I,{recursive:!0});let w=new Map,C=new Set,R=async(D)=>{let T=V6(z,D);if(!T)return null;try{let x=await Bun.build({entrypoints:[T],outdir:I,plugins:[X1],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...X.stxOptions});if(!x.success)return null;let S=x.outputs.find((b)=>b.path.endsWith(".html"));if(!S)return null;return await Bun.file(S.path).text()}catch{return null}},E=new Map,h=async(D,T)=>{try{let{processDirectives:x,extractVariables:S,defaultConfig:b,loadStxConfig:_0,injectRouterScript:K0}=await import("./chunk-xrx24ndt.js"),{checkCache:C0,cacheTemplate:u$,readFileCached:r,templateCache:f1}=await import("./chunk-x21s75kv.js"),h1=await _0(W),k=(d)=>{if(!d)return d;if(g.isAbsolute(d))return d;return g.resolve(W,d)},y={...b,...h1,...X.stxOptions,autoShell:!0};if(X.debugDirectives)y.debug=!0;y.partialsDir=k(y.partialsDir),y.componentsDir=k(y.componentsDir),y.layoutsDir=k(y.layoutsDir),y.storesDir=k(y.storesDir||"stores"),y.cachePath=k(y.cachePath)??S0(W,"cache");let m=!T&&!X.profile,c=y.cache!==!1;if(c&&m){let d=f1.get(D.filePath);if(d)try{if((await J0.promises.stat(D.filePath)).mtime.getTime()<=d.mtime){let z0=!0;for(let $0 of d.dependencies){if(!J0.existsSync($0)){z0=!1;break}if((await J0.promises.stat($0)).mtime.getTime()>d.mtime){z0=!1;break}}if(z0){let $0=d.output;if(q)$0=L$($0,{preserveHead:!0});let j1=E.get(D.filePath);return{route:D,content:$0,status:j1?.status??await M6(D.filePath),headers:j1?.headers}}}}catch{}let L0=await C0(D.filePath,y);if(L0){let F0=L0;if(q)F0=L$(F0,{preserveHead:!0});let z0=E.get(D.filePath);return{route:D,content:F0,status:z0?.status??await M6(D.filePath),headers:z0?.headers}}}let s=c?await r(D.filePath):await Bun.file(D.filePath).text(),v=Z5(s),{classifyAllScripts:U0}=await import("./chunk-xrx24ndt.js"),B0=U0(s),a=B0.server.map((d)=>d.content),e=s;for(let d of B0.server)e=e.replace(d.fullTag,"");let n={__filename:D.filePath,__dirname:g.dirname(D.filePath),params:T??{},__stx_runtime_head:{}};for(let d of a)try{await S(d,n,D.filePath)}catch(L0){if(X.stxOptions?.debug)console.error("[stx] variable extraction error",D.filePath,L0?.message||L0)}let r0=new Set,N0;if(X.profile){let d=performance.now();N0=await x(e,n,D.filePath,y,r0);let L0=performance.now()-d,F0=g.relative(W,D.filePath)||D.filePath;console.log(`[stx:profile] ${F0} \u2192 ${L0.toFixed(2)}ms`)}else N0=await x(e,n,D.filePath,y,r0);if(!q)N0=await K0(N0,{router:y.router});{let{interpolateScriptExpressions:d}=await import("./chunk-nrzx6d77.js");N0=N0.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/g,(L0,F0,z0)=>{if(!/function\s+__stx_setup_/.test(z0))return L0;return`<script${F0}>${d(z0,n)}</script>`})}if(q)N0=L$(N0,{preserveHead:!0});if(c&&m)await u$(D.filePath,N0,r0,y);let{extractStreamBoundaries:t7}=await import("./chunk-s2smc4wv.js"),s0=t7(n),z1=n.__streamTemplates;if(z1&&typeof z1==="object"&&Object.keys(z1).length>0){let d=n.streamBoundaries||{},L0={...y,autoShell:!1},F0=Object.keys(z1).map(($0)=>({id:$0,render:async()=>{let j1=typeof d[$0]==="function"?await d[$0]():void 0;return x(z1[$0],{...n,$boundary:j1},D.filePath,L0,new Set)}})),z0=new Set(F0.map(($0)=>$0.id));s0=[...(s0||[]).filter(($0)=>!z0.has($0.id)),...F0]}if(s0&&s0.length>0)C.add(D.pattern);else s0=void 0;let u5=N1(n),m5=M1(n);if(m)E.set(D.filePath,{status:u5,headers:m5});return{route:D,content:N0,status:u5??v,headers:m5,boundaries:s0}}catch(x){return console.error(`${B.red}Error building ${B.bright}${D.pattern}${B.reset}:`,x),null}},u=8,t=async()=>{w.clear(),H.clear();for(let D=0;D<j.length;D+=u){let T=j.slice(D,D+u),x=await Promise.all(T.map((S)=>h(S)));for(let S of x)if(S)w.set(S.route.pattern,S)}for(let D=0;D<L.length;D+=u){let T=L.slice(D,D+u),x=await Promise.all(T.map(({route:S})=>h(S)));for(let S of x)if(S)H.set(S.route.pattern,S)}return w.size>0};if(console.log(`${B.blue}Building pages...${B.reset}`),!await t())return console.error(`${B.red}No pages were successfully built${B.reset}`),!1;await W$(W);let W0=Q;try{if(W0=await k0(Q),W0!==Q)console.log(`${B.yellow}Port ${Q} is busy, using port ${W0} instead${B.reset}`)}catch{return console.error(`${B.red}Could not find an available port${B.reset}`),!1}if(Y){let D=X.hmrPort||W0+1;J=X$({wsPort:D,verbose:!1}),G=J.start(D)}let v1=(D,T)=>{let S=`<script data-stx-route-params>(function(){var p=${JSON.stringify(T).replace(/</g,"\\u003C").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")};window.__stx_rp=p;if(window.stx){window.stx._rp=p;if(window.stx.setRouteParams)window.stx.setRouteParams(p)}})()</script>`;if(D.includes("</head>"))return D.replace("</head>",`${S}</head>`);if(D.includes("<body"))return D.replace(/<body([^>]*)>/,`<body$1>${S}`);return S+D};console.log(`${B.blue}Starting server...${B.reset}`);let g1=q4({port:W0,async fetch(D){let T=new URL(D.url),x=_?.publicDir||"public",S=g.join(W,x,T.pathname),b=g.join(W,T.pathname),_0=g.join(I,T.pathname),[K0,C0,u$]=await Promise.all([J0.promises.stat(S).catch(()=>null),J0.promises.stat(b).catch(()=>null),J0.promises.stat(_0).catch(()=>null)]);if(K0?.isFile())return e$(S);if(C0?.isFile())return e$(b);if(u$?.isFile())return e$(_0);if(T.pathname.startsWith("/_stx/component/")){let k=decodeURIComponent(T.pathname.slice(16));if(k)try{let y=`<${k} />`,m={...buildConfig,autoShell:!1},c=await processDirectives(y,{},g.join(W,"components",`${k}.stx`),m,new Set);return new Response(c,{headers:{"Content-Type":"text/html"}})}catch(y){return new Response(`<div class="stx-async-error">${y.message}</div>`,{status:500,headers:{"Content-Type":"text/html"}})}}if(T.pathname==="/_stx/img"){let{handleImageRequest:k}=await import("./chunk-z54ans51.js"),y=await k(D,{publicDir:g.join(W,x),cacheDir:S0(W,"cache","img")});if(y)return y}if(M)try{let k=await M.handleRequest(D);if(k.status!==404)return k}catch{}if(V[T.pathname])try{return await V[T.pathname](D)}catch(k){return new Response(JSON.stringify({error:k.message}),{status:500,headers:{"Content-Type":"application/json"}})}let r=$5(T.pathname,j);if(r){let k=w.get(r.route.pattern),y=C.has(r.route.pattern);if(r.route.isDynamic&&Object.keys(r.params).length>0||y){let m=await h(r.route,r.params);if(m)k=m}if(k){let m=k.status??200,c=k.headers??{},s=(r.route.filePath?x6(await Bun.file(r.route.filePath).text().catch(()=>"")):null)??{};if(s.validate){if(!await s.validate({params:r.params})){let B0=await R(404);if(B0){let a=B0;if(a=await o(a,W),Y)a=D0(a,G);return new Response(a,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})}}if(s.middleware){let U0=w6(T.pathname,r.params,s,T.search),B0=T6(U0,null,D,{isServer:!0}),a=await C6(s.middleware,B0);if(a.redirect){let e=a.redirect.path,n=a.redirect.options.redirectCode||302,r0=new Headers(a.responseHeaders);return r0.set("Location",e),new Response(null,{status:n,headers:r0})}if(a.abort){let{statusCode:e,message:n}=a.abort.error;return new Response(`<!DOCTYPE html><html><head><title>Error ${e}</title></head><body><h1>Error ${e}</h1><p>${n}</p></body></html>`,{status:e,headers:{"Content-Type":"text/html"}})}if(Object.keys(a.state).length>0){let e=`<script>(function(){var s=typeof stx!=='undefined'?stx:{};s._ms=${JSON.stringify(a.state)};if(s.setMiddlewareState)s.setMiddlewareState(s._ms);})()</script>`;k.content=k.content.replace("</head>",`${e}</head>`)}}let v=k.content;if(q&&v6(D)){let U0=k6(v),B0=S6(v),a=v.match(/<title[^>]*>([\s\S]*?)<\/title>/i),e=a?a[1].trim():"";if(Object.keys(r.params).length>0)v=v1(v,r.params);v=await o(v,W);let n=_?.router?.container||"main";return v=g6(v,n),new Response(v,{status:m,headers:{"Content-Type":"text/html","X-STX-Fragment":"true","X-STX-Layout":U0.layout,"X-STX-Layout-Group":U0.group,"X-STX-Runtime":B0?"true":"false",...e&&{"X-STX-Title":encodeURIComponent(e)},[P6]:b6(),...Z1(),"Cache-Control":U$}})}if(q)v=B$(q,v);if(Object.keys(r.params).length>0)v=v1(v,r.params);if(v=await o(v,W),Y)v=D0(v,G);if(X.native)if(v.includes("<head>"))v=v.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else v="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+v;if(X.titlebarHidden)if(v.includes("<head>"))v=v.replace("<head>","<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script>");else v=`<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>${v}`;if(k.boundaries&&k.boundaries.length>0){let{renderStreamingPage:U0,streamToResponse:B0}=await import("./chunk-s2smc4wv.js");return B0(U0(v,k.boundaries,{timeoutMs:30000}),{status:m,headers:{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}return new Response(v,{status:m,headers:{"Content-Type":"text/html",...Z1(),"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0",...c}})}}if(L.length>0){let k=L.map((m)=>m.route),y=$5(T.pathname,k);if(y){let m=H.get(y.route.pattern);if(m){let c=m.content;if(q)c=B$(q,c);if(Object.keys(y.params).length>0)c=v1(c,y.params);if(c=await o(c,W),Y)c=D0(c,G);return new Response(c,{status:m.status??200,headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}for(let{prefix:m}of O)if(m!=="/"&&T.pathname.startsWith(m)){let c=H.get(m)||H.get(m+"/");if(c){let s=c.content;if(q)s=B$(q,s);if(s=await o(s,W),Y)s=D0(s,G);return new Response(s,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}}let f1=w.get("/");if(f1){let k=f1.content;if(k=await o(k,W),Y)k=D0(k,G);if(X.native)if(k.includes("<head>"))k=k.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else k="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+k;return new Response(k,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}let h1=await R(404);if(h1){let k=h1;if(k=await o(k,W),Y)k=D0(k,G);return new Response(k,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})},async error(D){let T=await R(500);if(T)return new Response(T,{status:500,headers:{"Content-Type":"text/html"}});return new Response(`<pre>${D}
|
|
1611
1611
|
${D.stack}</pre>`,{headers:{"Content-Type":"text/html"}})}});if(console.clear(),console.log(`
|
|
1612
1612
|
${B.blue}stx${B.reset} ${B.green}${process.env.stx_VERSION||"v0.0.10"}${B.reset} ${B.dim}ready in ${Math.random()*10+5|0}.${Math.random()*90+10|0} ms${B.reset}`),console.log(`
|
|
1613
1613
|
${B.bright}\u2192 ${B.cyan}http://localhost:${W0}/${B.reset}`),Y)console.log(`${B.dim} HMR: ws://localhost:${G}${B.reset}`);console.log(`
|
|
1614
1614
|
${B.yellow}Routes:${B.reset}`);let a0=[...E6(j,W)];for(let{route:D}of L)a0.push(`${D.pattern}`);if(a0.forEach((D,T)=>{let S=T===a0.length-1?"\u2514\u2500 ":"\u251C\u2500 ";console.log(` ${B.green}${S}${B.reset}${D}`)}),console.log(`
|
|
1615
|
-
Press ${B.cyan}h${B.reset} + ${B.cyan}Enter${B.reset} to show shortcuts`),x0(g1.url.toString(),()=>{if(J)A1();g1.stop()}),X.native){let D,T=g.join(z,"index.stx");if(J0.existsSync(T)){let S=await Bun.file(T).text();D=o1(S)}let x=_?.app?.window??{};await t0(W0,{title:_?.app?.head?.title||g.basename(W)||"stx App",width:x.width,height:x.height,darkMode:x.darkMode,hotReload:x.hotReload,titlebarHidden:x.titlebarHidden??X.titlebarHidden===!0,nativeSidebar:!!D,sidebarConfig:D})}if(Z){console.log(`${B.blue}Watching for changes...${B.reset}`);let D=(S)=>{return S.startsWith("public/")||S.startsWith("public\\")},T=(S)=>{let b=S.toLowerCase();return b.endsWith(".stx")||b.endsWith(".html")||b.endsWith(".md")},x=J0.watch(W,{recursive:!0},async(S,b)=>{if(!b||$$(b))return;if(e1(b))if(D(b)){if(console.log(`${B.cyan}${b} changed${B.reset}`),Y&&J)J.reload(b)}else if(T(b)){console.log(`${B.yellow}${b} changed, rebuilding...${B.reset}`),m0.clear(),p0();try{let{invalidateFileCache:_0,templateCache:K0}=await import("./chunk-
|
|
1615
|
+
Press ${B.cyan}h${B.reset} + ${B.cyan}Enter${B.reset} to show shortcuts`),x0(g1.url.toString(),()=>{if(J)A1();g1.stop()}),X.native){let D,T=g.join(z,"index.stx");if(J0.existsSync(T)){let S=await Bun.file(T).text();D=o1(S)}let x=_?.app?.window??{};await t0(W0,{title:_?.app?.head?.title||g.basename(W)||"stx App",width:x.width,height:x.height,darkMode:x.darkMode,hotReload:x.hotReload,titlebarHidden:x.titlebarHidden??X.titlebarHidden===!0,nativeSidebar:!!D,sidebarConfig:D})}if(Z){console.log(`${B.blue}Watching for changes...${B.reset}`);let D=(S)=>{return S.startsWith("public/")||S.startsWith("public\\")},T=(S)=>{let b=S.toLowerCase();return b.endsWith(".stx")||b.endsWith(".html")||b.endsWith(".md")},x=J0.watch(W,{recursive:!0},async(S,b)=>{if(!b||$$(b))return;if(e1(b))if(D(b)){if(console.log(`${B.cyan}${b} changed${B.reset}`),Y&&J)J.reload(b)}else if(T(b)){console.log(`${B.yellow}${b} changed, rebuilding...${B.reset}`),m0.clear(),p0();try{let{invalidateFileCache:_0,templateCache:K0}=await import("./chunk-x21s75kv.js");_0(g.resolve(W,b)),K0.delete(g.resolve(W,b))}catch{}if(A&&b){if(g.resolve(W,b)===A||g.basename(A)===b){let K0=await Q5(A,X.stxOptions||{});if(K0)q=K0}}if(await t(),await K$(W),Y&&J)J.reload(b)}else{console.log(`${B.yellow}${b} changed, rebuilding...${B.reset}`),m0.clear(),p0();try{let{invalidateFileCache:_0,templateCache:K0}=await import("./chunk-x21s75kv.js");_0(g.resolve(W,b)),K0.delete(g.resolve(W,b))}catch{}if(await t(),Y&&J)J.reload(b)}else if(t1(b)){if(console.log(`${B.cyan}CSS ${b} changed${B.reset}`),Y&&J)J.updateCss(b)}});process.on("SIGINT",()=>{if(x.close(),J)A1();g1.stop(),process.exit(0)})}return!0}var M4=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function V4($){let X=($||"").trim();if(!X)return null;if(/[\s>+~,:]/.test(X))return null;let Q={},Z=X,Y=Z.match(/^[a-z][\w-]*/i);if(Y)Q.tag=Y[0].toLowerCase(),Z=Z.slice(Y[0].length);while(Z.length>0){let J=Z.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(J){if(Q.attr=J[1],J[3]!==void 0&&J[3]!=="")Q.attrValue=J[3];Z=Z.slice(J[0].length);continue}let G=Z.match(/^#([\w-]+)/);if(G){Q.id=G[1],Z=Z.slice(G[0].length);continue}let W=Z.match(/^\.([\w-]+)/);if(W){Q.className=W[1],Z=Z.slice(W[0].length);continue}return null}if(!Q.tag&&!Q.attr&&!Q.id&&!Q.className)return null;return Q}function E4($,X){if(X.attr){if(!(X.attrValue===void 0?new RegExp(`\\b${X.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${X.attr}\\s*=\\s*(["'])\\s*${X.attrValue}\\s*\\1`,"i")).test($))return!1}if(X.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${X.id}\\s*\\1`,"i").test($))return!1}if(X.className){let Q=$.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!Q)return!1;if(!Q[2].split(/\s+/).includes(X.className))return!1}return!0}function gW($,X="main"){let Q=V4(X);if(!Q)return null;let Z=/<([a-z][\w-]*)\b([^>]*)>/gi,Y;while((Y=Z.exec($))!==null){let J=Y[1].toLowerCase(),G=Y[2]||"";if(G.trimEnd().endsWith("/")||M4.has(J))continue;if(Q.tag&&Q.tag!==J)continue;if(!E4(G,Q))continue;let W=Y[0],K=Y.index+W.length,_=new RegExp(`<(/?)${J}\\b([^>]*)>`,"gi");_.lastIndex=K;let U=1,F;while((F=_.exec($))!==null){let z=F[1]==="/";if(!z&&(F[2]||"").trimEnd().endsWith("/"))continue;if(U+=z?-1:1,U===0)return{openTag:W,openIndex:Y.index,start:K,end:F.index,tagName:J}}return null}return null}var P={enabled:!1,components:new Map,stores:new Map,events:[],performance:[],selectedComponent:null,selectedStore:null,maxEvents:1000,maxPerformance:500};function I4($={}){if(typeof window>"u")return;P.enabled=!0,P.maxEvents=$.maxEvents||1000,P.maxPerformance=$.maxPerformance||500,window.__STX_DEVTOOLS__={getState:()=>P,getComponents:()=>Array.from(P.components.values()),getComponent:(X)=>P.components.get(X),getStores:()=>Array.from(P.stores.values()),getStore:(X)=>P.stores.get(X),getEvents:()=>P.events,getPerformance:()=>P.performance,selectComponent:(X)=>J5(X),selectStore:(X)=>D4(X),inspectElement:(X)=>w4(X),highlightComponent:(X)=>m6(X),clearHighlight:()=>p6(),logComponentTree:()=>T4(),logStoreState:(X)=>C4(X),timeTravel:(X,Q)=>k4(X,Q)},S4(),x4(),console.log("%c[STX DevTools] Enabled","color: #10b981; font-weight: bold;")}function R4(){P.enabled=!1,delete window.__STX_DEVTOOLS__;let $=document.getElementById("stx-devtools-panel");if($)$.remove();console.log("%c[STX DevTools] Disabled","color: #ef4444;")}function f6($){if(!P.enabled)return;let X=P.components.get($);if(X){if(X.parentId){let Q=P.components.get(X.parentId);if(Q)Q.children=Q.children.filter((Z)=>Z!==$)}P.components.delete($),Y5({timestamp:Date.now(),type:"component:unmounted",componentId:$,payload:{name:X.name}})}}function d6($,X,Q={},Z=[]){if(!P.enabled)return;let Y={id:$,state:X,getters:Q,actions:Z,history:[{timestamp:Date.now(),type:"state",name:"__init__",newValue:X}]};P.stores.set($,Y),Y5({timestamp:Date.now(),type:"store:registered",payload:{id:$,state:X}})}function u6($,X,Q,Z,Y="state"){if(!P.enabled)return;let J=P.stores.get($);if(J){let G={timestamp:Date.now(),type:Y,name:X,oldValue:Q,newValue:Z,stack:Error().stack};if(J.history.push(G),J.history.length>100)J.history=J.history.slice(-100);if(Y==="state")J.state={...J.state,[X]:Z};Y5({timestamp:Date.now(),type:`store:${Y}`,payload:{storeId:$,name:X,oldValue:Q,newValue:Z}})}}function Y5($){if(!P.enabled)return;if(P.events.push($),P.events.length>P.maxEvents)P.events=P.events.slice(-P.maxEvents);if(typeof window<"u")window.dispatchEvent(new CustomEvent("stx:devtools:event",{detail:$}))}function J5($){P.selectedComponent=$;let X=P.components.get($);if(X)m6($),console.log("%c[STX DevTools] Selected component:","color: #3b82f6;",X);return X}function D4($){P.selectedStore=$;let X=P.stores.get($);if(X)console.log("%c[STX DevTools] Selected store:","color: #8b5cf6;",X);return X}function w4($){let X=$;while(X){let Q=X.getAttribute("data-stx-component-id");if(Q)return J5(Q);X=X.parentElement}console.log("%c[STX DevTools] No component found for element","color: #f59e0b;");return}function m6($){p6();let X=P.components.get($);if(X?.element){let Q=document.createElement("div");Q.id="stx-devtools-highlight",Q.style.cssText=`
|
|
1616
1616
|
position: absolute;
|
|
1617
1617
|
background: rgba(59, 130, 246, 0.2);
|
|
1618
1618
|
border: 2px solid #3b82f6;
|
|
@@ -2881,9 +2881,9 @@ describe('Example', () => {
|
|
|
2881
2881
|
</footer>
|
|
2882
2882
|
@yield('scripts')
|
|
2883
2883
|
</body>
|
|
2884
|
-
</html>`}function rX(){return"<!-- Hero section -->"}function sX(){return"<!-- Features -->"}function nX(){return"<!-- Pricing -->"}function oX(){return"<!-- Button -->"}function C1($){if(!T1($))L5($,{recursive:!0})}function tX(){if(T1("bun.lockb"))return"bun";if(T1("pnpm-lock.yaml"))return"pnpm";if(T1("yarn.lock"))return"yarn";return"bun"}function F5($){return $.replace(/[-_\s]+(.)?/g,(X,Q)=>Q?Q.toUpperCase():"").replace(/^./,(X)=>X.toUpperCase())}function eX($){return $.replace(/[-_\s]+(.)?/g,(X,Q)=>Q?Q.toUpperCase():"").replace(/^./,(X)=>X.toLowerCase())}function c0($){return $.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}var{serve:$Q}=globalThis.Bun;import k1 from"fs";import y0 from"path";function a2($,X=200,Q={}){return new Response($,{status:X,headers:{"Content-Type":"text/html; charset=utf-8",...Q}})}async function J8($){let{loadStxConfig:X}=await import("./chunk-
|
|
2884
|
+
</html>`}function rX(){return"<!-- Hero section -->"}function sX(){return"<!-- Features -->"}function nX(){return"<!-- Pricing -->"}function oX(){return"<!-- Button -->"}function C1($){if(!T1($))L5($,{recursive:!0})}function tX(){if(T1("bun.lockb"))return"bun";if(T1("pnpm-lock.yaml"))return"pnpm";if(T1("yarn.lock"))return"yarn";return"bun"}function F5($){return $.replace(/[-_\s]+(.)?/g,(X,Q)=>Q?Q.toUpperCase():"").replace(/^./,(X)=>X.toUpperCase())}function eX($){return $.replace(/[-_\s]+(.)?/g,(X,Q)=>Q?Q.toUpperCase():"").replace(/^./,(X)=>X.toLowerCase())}function c0($){return $.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}var{serve:$Q}=globalThis.Bun;import k1 from"fs";import y0 from"path";function a2($,X=200,Q={}){return new Response($,{status:X,headers:{"Content-Type":"text/html; charset=utf-8",...Q}})}async function J8($){let{loadStxConfig:X}=await import("./chunk-jqnckvbk.js");return{...await X($.configDir??process.cwd()).catch(()=>({})),...$.stxOptions??{}}}async function XQ($={}){let{port:X=3000,root:Q=".",watch:Z=!0,onRequest:Y,routes:J={},middleware:G=[],on404:W,onError:K}=$,_=y0.resolve(Q),U=await J8($),F=new Map;async function z(A){let N=k1.statSync(A),V=`${A}:${N.mtimeMs}`,M=F.get(V);if(M)return{content:M.content,status:M.status,headers:M.headers};for(let T of F.keys())if(T.startsWith(`${A}:`)&&T!==V)F.delete(T);let I=await Bun.file(A).text(),w=I,C=Z$(I);if(C)w=C.content.trim();let R=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,E=[],h=[],u;while((u=R.exec(I))!==null){let T=u[1],x=u[2],S=u[0];if(T.includes("server"))h.push(x);else E.push(S)}let t=I.match(/<style\b[^>]*>[\s\S]*?<\/style>/gi)||[],d5=w.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,""),W0={__filename:A,__dirname:y0.dirname(A)};for(let T of h)await j0(T,W0,A);let q0=await O0(d5,W0,A,U,new Set);if(t.length>0){let T=t.join(`
|
|
2885
2885
|
`);if(q0.match(/(<\/head>)/i))q0=q0.replace(/(<\/head>)/i,`${T}
|
|
2886
|
-
$1`)}if(E.length>0){let{interpolateScriptsInTemplate:T}=await import("./chunk-
|
|
2886
|
+
$1`)}if(E.length>0){let{interpolateScriptsInTemplate:T}=await import("./chunk-nrzx6d77.js"),x=T(E.join(`
|
|
2887
2887
|
`),W0);if(q0.match(/(<\/body>)/i))q0=q0.replace(/(<\/body>)/i,`${x}
|
|
2888
2888
|
$1`);else q0+=`
|
|
2889
2889
|
${x}`}let a0=N1(W0),D=M1(W0);return F.set(V,{content:q0,mtime:N.mtimeMs,status:a0,headers:D}),{content:q0,status:a0,headers:D}}async function j(A){let N=k1.statSync(A),V=`${A}:${N.mtimeMs}`,M=F.get(V);if(M)return M.content;let{content:I}=await V0(A,U);return F.set(V,{content:I,mtime:N.mtimeMs}),I}function O(A){let N=A.startsWith("/")?A.slice(1):A,V=[N,`${N}.stx`,`${N}.md`,`${N}.html`,y0.join(N,"index.stx"),y0.join(N,"index.md"),y0.join(N,"index.html")];for(let M of V){let I=y0.join(_,M);if(k1.existsSync(I)&&k1.statSync(I).isFile())return I}return null}async function L(A){let N=new URL(A.url),V=async()=>{if(J[N.pathname])return await J[N.pathname](A);if(Y){let I=await Y(A);if(I)return I}let M=O(N.pathname);if(!M){if(W)return await W(A);return new Response("Not Found",{status:404})}try{let I,w="text/html",C,R;if(M.endsWith(".stx")){let E=await z(M);I=E.content,C=E.status,R=E.headers}else if(M.endsWith(".md"))I=await j(M);else if(M.endsWith(".html"))I=await Bun.file(M).text();else if(M.endsWith(".css"))I=await Bun.file(M).text(),w="text/css";else if(M.endsWith(".js"))I=await Bun.file(M).text(),w="text/javascript";else if(M.endsWith(".json"))I=await Bun.file(M).text(),w="application/json";else return new Response(Bun.file(M));return new Response(I,{status:C??200,headers:{"Content-Type":w,...R}})}catch(I){if(K)return await K(I,A);let w=I instanceof Error?I.message:String(I),R=U?.debug===!0?`<h1>Error</h1><pre>${w}
|
|
@@ -4315,7 +4315,7 @@ else {
|
|
|
4315
4315
|
\u26A0\uFE0F Built ${Q.views.length} views with ${Q.errors.length} errors`);return Q}function W9($,X){let Q=V$.watch($.viewsDir,{recursive:!0},async(Z,Y)=>{if(!Y)return;if(Y.endsWith(".stx")||Y.endsWith(".ts")||Y.endsWith(".js")){if($.debug)console.log(`
|
|
4316
4316
|
File changed: ${Y}, rebuilding...`);let J=await IZ($);X?.(J)}});return{close:()=>Q.close()}}async function K9($,X={},Q={}){let Z={...Q,skipDefaultSeoTags:!0,skipSignalsRuntime:!0},Y=await V7($,X,Z);Y=await RZ(Y),Y=Y.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Y=Y.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,""),Y=Y.replace(/<!--\s*stx SEO Tags\s*-->/gi,""),Y=Y.replace(/\n\s*\n\s*\n/g,`
|
|
4317
4317
|
|
|
4318
|
-
`).trim();let J=wZ(Y);return{html:Y,text:J}}async function RZ($){try{let{generateCrosswindCSS:X,extractClassNames:Q}=await import("./chunk-
|
|
4318
|
+
`).trim();let J=wZ(Y);return{html:Y,text:J}}async function RZ($){try{let{generateCrosswindCSS:X,extractClassNames:Q}=await import("./chunk-a6m63ra1.js");if(Q($).size===0)return $;let Y=await X($);if(!Y)return $;let J=DZ(Y);if(J.size===0)return $;return $.replace(/(<[a-z][a-z0-9]*)((?:\s+[a-z][a-z0-9-]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s+)class\s*=\s*"([^"]*)"((?:\s+[a-z][a-z0-9-]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?>)/gi,(G,W,K,_,U,F)=>{let z=_.split(/\s+/).filter(Boolean),j=[];for(let q of z){let A=J.get(q);if(A)j.push(A)}if(j.length===0)return`${W}${K}class="${_}"${U}${F}`;let O=j.join("; "),H=`${K}${U}`.match(/style\s*=\s*"([^"]*)"/);if(H){let q=`${O}; ${H[1]}`,A=K.replace(/style\s*=\s*"[^"]*"/,`style="${q}"`),N=U.replace(/style\s*=\s*"[^"]*"/,`style="${q}"`);return`${W}${A}class="${_}"${N}${F}`}return`${W}${K}class="${_}" style="${O}"${U}${F}`})}catch{return $}}function DZ($){let X=new Map,Q=/\.([a-zA-Z0-9_-]+(?:\\:[a-zA-Z0-9_-]+)*)\s*\{([^}]+)\}/g,Z=Q.exec($);while(Z!==null){let Y=Z[1].replace(/\\/g,""),J=Z[2].split(";").map((G)=>G.trim()).filter(Boolean).join("; ");if(J)X.set(Y,J);Z=Q.exec($)}return X}function wZ($){return $.replace(/<br\s*\/?>/gi,`
|
|
4319
4319
|
`).replace(/<\/(p|div|h[1-6]|li|tr)>/gi,`
|
|
4320
4320
|
`).replace(/<\/td>/gi,"\t").replace(/<[^>]*>/g,"").replace(/ /g," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/©/g,"(c)").replace(/·/g,"-").replace(/\n\s*\n\s*\n/g,`
|
|
4321
4321
|
|
|
@@ -4450,7 +4450,7 @@ ${I}`}function Z0($){return $.replace(/&/g,"&").replace(/"/g,""").repla
|
|
|
4450
4450
|
`;let Q=$.sitemap!==!1?`Sitemap: ${$.url.replace(/\/$/,"")}/sitemap.xml
|
|
4451
4451
|
`:"";if(X==="disallow")return["User-agent: *","Disallow: /","",Q].filter(Boolean).join(`
|
|
4452
4452
|
`);return["User-agent: *","Allow: /","",Q].filter(Boolean).join(`
|
|
4453
|
-
`)}var F1=null;async function WY(){if(F1!==null)return F1;try{let $=await import("./chunk-
|
|
4453
|
+
`)}var F1=null;async function WY(){if(F1!==null)return F1;try{let $=await import("./chunk-mbwe1z12.js");if(typeof $.getRouterScript==="function")F1=$.getRouterScript();else F1=""}catch{F1=""}return F1}async function b5($,X){let Q=await WY();if(!Q)return $;let Z={interceptAllLinks:!0,container:"main",...X},J=`${`<script>window.__stxRouterConfig=${JSON.stringify(Z)};</script>
|
|
4454
4454
|
`}<script>${Q}</script>`;if(/<\/body>/i.test($))return $.replace(/<\/body>/i,`${J}
|
|
4455
4455
|
</body>`);return`${$}
|
|
4456
4456
|
${J}`}var KY=`window.__stxThemeIcon=function(isDark){try{var want=isDark?'dark':'light';var pick=document.querySelector('link[rel~="icon"][media*="prefers-color-scheme: '+want+'"]');if(!pick)return;var live=document.querySelector('link[rel~="icon"]:not([media])');if(!live){live=document.createElement('link');live.setAttribute('rel','icon');document.head.appendChild(live)}if(pick.type)live.setAttribute('type',pick.type);var href=pick.getAttribute('href');if(live.getAttribute('href')!==href)live.setAttribute('href',href)}catch(e){}};`,_Y=($,X,Q,Z)=>`(function(){${KY}function read(){try{var k=${JSON.stringify(X)};var t=localStorage.getItem(k);return t===null?(${JSON.stringify($)}==='dark'||(${JSON.stringify($)}==='auto'&&window.matchMedia('(prefers-color-scheme: dark)').matches)):t==='dark'}catch(e){return ${JSON.stringify($)}==='dark'}}function apply(){var isDark=read();var html=document.documentElement;html.classList[isDark?'add':'remove']('dark');var color=isDark?${JSON.stringify(Z)}:${JSON.stringify(Q)};if(!document.head)return;var tc=document.querySelector('meta[name="theme-color"]:not([media])');if(!tc){tc=document.createElement('meta');tc.setAttribute('name','theme-color');tc.setAttribute('data-stx-theme-meta','1')}tc.setAttribute('content',color);if(tc!==document.head.firstChild){document.head.insertBefore(tc,document.head.firstChild)}if(window.__stxThemeIcon)window.__stxThemeIcon(isDark)}apply();window.addEventListener('stx:navigate',apply);window.addEventListener('popstate',apply)})();`,UY=($,X,Q)=>`document.addEventListener('click',function(e){var t=e.target&&e.target.closest&&e.target.closest('#theme-toggle');if(!t)return;var html=document.documentElement;var isDark=html.classList.toggle('dark');try{localStorage.setItem(${JSON.stringify($)},isDark?'dark':'light')}catch(e){}var tc=document.querySelector('meta[name="theme-color"]:not([media])');if(tc)tc.setAttribute('content',isDark?${JSON.stringify(Q)}:${JSON.stringify(X)});if(window.__stxThemeIcon)window.__stxThemeIcon(isDark)});`;function C$($,X){if(X.theme===!1)return $;let Q=$.includes(g7),Z=typeof X.theme==="object"&&X.theme!==null?X.theme:{},Y=Z.default??"dark",J=Z.storageKey??"theme",G=Z.colors?.light??"#ffffff",W=Z.colors?.dark??"#000000";if(Y==="dark"&&!Q){if(!/<html\b[^>]*\bclass=/.test($))$=$.replace(/<html\b([^>]*)>/i,'<html$1 class="dark">');else if(!/<html\b[^>]*\bclass="[^"]*\bdark\b/.test($))$=$.replace(/<html\b([^>]*\bclass=")([^"]*)(")/i,"<html$1$2 dark$3")}if(!$.includes("data-stx-theme-meta")&&/<head\b[^>]*>/i.test($)){let K=['<meta name="color-scheme" content="dark light" data-stx-theme-meta="1">',`<meta name="theme-color" media="(prefers-color-scheme: light)" content="${G}" data-stx-theme-meta="1">`,`<meta name="theme-color" media="(prefers-color-scheme: dark)" content="${W}" data-stx-theme-meta="1">`].join(`
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{np as a,op as b,pp as c,qp as d,rp as e,sp as f,tp as g,up as h,vp as i,wp as j}from"./chunk-spnkgsft.js";import"./chunk-4awxsp8f.js";import"./chunk-hk8j3eps.js";import"./chunk-mxva4zmq.js";import"./chunk-1kg9sz9a.js";import"./chunk-nnd1hqht.js";import"./chunk-msxcd1kp.js";import"./chunk-xgtcq9bj.js";import"./chunk-2fspj91j.js";import"./chunk-evv58hf5.js";import"./chunk-5a1b5kjt.js";import"./chunk-r2kag877.js";import"./chunk-8p8qa1s9.js";import"./chunk-j4ze77e0.js";export{b as stripTypeScript,h as splitDeclaration,c as isModuleResolutionFailure,d as isMissingBindingFailure,f as isCompleteImport,j as hasVariables,e as extractVariables,i as extractScriptFromTemplate,g as convertToCommonJS,a as STX_ENGINE_BINDING_NAMES};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ff as a}from"./chunk-bskzz385.js";import"./chunk-spnkgsft.js";import"./chunk-4awxsp8f.js";import"./chunk-hk8j3eps.js";import"./chunk-mxva4zmq.js";import"./chunk-1kg9sz9a.js";import"./chunk-nnd1hqht.js";import"./chunk-msxcd1kp.js";import"./chunk-xgtcq9bj.js";import"./chunk-2fspj91j.js";import"./chunk-evv58hf5.js";import"./chunk-5a1b5kjt.js";import"./chunk-r2kag877.js";import"./chunk-8p8qa1s9.js";import"./chunk-j4ze77e0.js";export{a as startInteractive};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Dq as H,Vq as x,_r as g,pm as O,rp as R}from"./chunk-
|
|
2
|
+
import{Dq as H,Vq as x,_r as g,pm as O,rp as R}from"./chunk-spnkgsft.js";import b from"path";var v={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},M=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var T=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function f(q){let B=[],Q=0,G;T.lastIndex=0;while((G=T.exec(q))!==null){if(G.index>Q){let X=q.slice(Q,G.index);if(X.trim())B.push({type:B.length===0?"shell":"content",content:X})}let J=G[1],K=G[2];B.push({type:"suspense",name:J,content:K}),Q=G.index+G[0].length}if(Q<q.length){let J=q.slice(Q);if(J.trim())B.push({type:B.length===0?"shell":"content",content:J})}if(B.length===0)B.push({type:"shell",content:q});return B}async function r(q,B={},Q={}){let G={...g,...Q,streaming:{...v,...Q.streaming}},J=G.streaming?.bufferSize||16384;return new ReadableStream({async start(K){try{let X=await Bun.file(q).text(),z=X.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),L=z?z[1]:"",Y=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),j={...B,__filename:q,__dirname:b.dirname(q)};if(L.trim())await R(L,j,q);let D=f(Y),$=new Set;if(!D.some((w)=>w.type==="suspense")){let w=G.streaming?.strategy||"auto",U=new RegExp(M.source,"g");if(!(w!=="manual"&&U.test(Y))){let F=await H(Y,j,q,G,$);for(let V=0;V<F.length;V+=J)K.enqueue(F.slice(V,V+J)),await new Promise((W)=>setTimeout(W,0))}else{let F=[],V=new RegExp(M.source,"g"),W;while((W=V.exec(Y))!==null)F.push({name:W[1],content:W[2],start:W.index,end:W.index+W[0].length});let y=0;for(let A of F){if(A.start>y){let k=Y.slice(y,A.start);if(k.trim()){let E=await H(k,j,q,G,$);K.enqueue(E),await new Promise((S)=>setTimeout(S,0))}}let I=await H(A.content,j,q,G,$);K.enqueue(I),await new Promise((k)=>setTimeout(k,0)),y=A.end}if(y<Y.length){let A=Y.slice(y);if(A.trim()){let I=await H(A,j,q,G,$);K.enqueue(I)}}}}else{let w=new Map;for(let Z of D)if(Z.type==="shell"||Z.type==="content"){let F=await H(Z.content,j,q,G,$);K.enqueue(F)}else if(Z.type==="suspense"&&Z.name){let F=`stx-suspense-${Z.name}`;K.enqueue(`<div id="${F}" data-suspense="${Z.name}" style="display:contents;">
|
|
3
3
|
<template data-suspense-fallback>Loading...</template>
|
|
4
4
|
</div>`),w.set(Z.name,H(Z.content,j,q,G,$))}K.enqueue(`
|
|
5
5
|
<script>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{bj as a,cj as b}from"./chunk-b6jhznkh.js";import"./chunk-
|
|
2
|
+
import{bj as a,cj as b}from"./chunk-b6jhznkh.js";import"./chunk-j4ze77e0.js";export{a as processTeleportDirectives,b as ensureTeleportTargets};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$f as e,Xf as a,Yf as b,Zf as c,_f as d,ag as f,bg as g,cg as h,dg as i,eg as j,fg as k,gg as l}from"./chunk-d19bydks.js";import"./chunk-
|
|
2
|
+
import{$f as e,Xf as a,Yf as b,Zf as c,_f as d,ag as f,bg as g,cg as h,dg as i,eg as j,fg as k,gg as l}from"./chunk-d19bydks.js";import"./chunk-j4ze77e0.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{hi as a,ii as b,ji as c,ki as d,li as e}from"./chunk-1gdzz04h.js";import"./chunk-
|
|
2
|
+
import{hi as a,ii as b,ji as c,ki as d,li as e}from"./chunk-1gdzz04h.js";import"./chunk-j4ze77e0.js";export{c as renderSSRSuspense,a as processSuspenseDirectives,e as generateSuspenseRuntime,d as generateSuspenseCSS,b as createSSRSuspense};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{bp as a,cp as b,dp as c,ep as d,fp as e,gp as f,hp as g,ip as h,jp as i,kp as j,lp as k,mp as l}from"./chunk-
|
|
2
|
+
import{bp as a,cp as b,dp as c,ep as d,fp as e,gp as f,hp as g,ip as h,jp as i,kp as j,lp as k,mp as l}from"./chunk-spnkgsft.js";import"./chunk-4awxsp8f.js";import"./chunk-hk8j3eps.js";import"./chunk-mxva4zmq.js";import"./chunk-1kg9sz9a.js";import"./chunk-nnd1hqht.js";import"./chunk-msxcd1kp.js";import"./chunk-xgtcq9bj.js";import"./chunk-2fspj91j.js";import"./chunk-evv58hf5.js";import"./chunk-5a1b5kjt.js";import"./chunk-r2kag877.js";import"./chunk-8p8qa1s9.js";import"./chunk-j4ze77e0.js";export{l as stripStxRuntimeImports,a as scanScriptTags,k as rewriteStxImportSpecifiers,i as processSignals,g as processScriptSetup,e as preEvalLiteralReactiveIfs,b as parseLoopExpression,c as hasSignalsSyntax,j as findMarkupIndexOutsideScripts,h as extractExports,f as convertSignalLoopsToAttributes,d as convertSignalDirectivesToAttributes};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Lf as a}from"./chunk-w56erqz5.js";import"./chunk-9g2rhkx8.js";import"./chunk-y805f58c.js";import"./chunk-qa8qmer5.js";import"./chunk-nhmq45hh.js";import"./chunk-frp9fc7j.js";import"./chunk-spnkgsft.js";import"./chunk-4awxsp8f.js";import"./chunk-hk8j3eps.js";import"./chunk-mxva4zmq.js";import"./chunk-1kg9sz9a.js";import"./chunk-nnd1hqht.js";import"./chunk-msxcd1kp.js";import"./chunk-xgtcq9bj.js";import"./chunk-2fspj91j.js";import"./chunk-evv58hf5.js";import"./chunk-5a1b5kjt.js";import"./chunk-r2kag877.js";import"./chunk-8p8qa1s9.js";import"./chunk-j4ze77e0.js";export{a as buildForProduction};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Af as f,Bf as g,Cf as h,xf as c,yf as d,zf as e}from"./chunk-
|
|
2
|
+
import{Af as f,Bf as g,Cf as h,xf as c,yf as d,zf as e}from"./chunk-acwjyext.js";import{Mf as a,Pf as b}from"./chunk-9g2rhkx8.js";import"./chunk-5q44vwmg.js";import"./chunk-ht51fz7w.js";import"./chunk-spnkgsft.js";import"./chunk-4awxsp8f.js";import"./chunk-hk8j3eps.js";import"./chunk-mxva4zmq.js";import"./chunk-1kg9sz9a.js";import"./chunk-nnd1hqht.js";import"./chunk-msxcd1kp.js";import"./chunk-xgtcq9bj.js";import"./chunk-2fspj91j.js";import"./chunk-evv58hf5.js";import"./chunk-5a1b5kjt.js";import"./chunk-r2kag877.js";import"./chunk-8p8qa1s9.js";import"./chunk-j4ze77e0.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{a as N,c as R,e as W,g as j,i as H,k as J}from"./chunk-0y46fbkx.js";import{l as k,m as w,n as B}from"./chunk-q9n5swx7.js";import"./chunk-
|
|
2
|
+
import{a as N,c as R,e as W,g as j,i as H,k as J}from"./chunk-0y46fbkx.js";import{l as k,m as w,n as B}from"./chunk-q9n5swx7.js";import"./chunk-j4ze77e0.js";import E from"fs";import K from"path";var V=[];function _(U){V=[];for(let A of U.storyFiles)if(V.push({text:A.fileName.toLowerCase(),original:A.fileName,type:"story",storyId:A.id}),V.push({text:A.relativePath.toLowerCase(),original:A.relativePath,type:"story",storyId:A.id}),A.story)for(let z of A.story.variants)V.push({text:z.title.toLowerCase(),original:z.title,type:"story",storyId:A.id,variantId:z.id})}function $(){return JSON.stringify(V)}async function O(U={}){let A=Date.now();N();let z=await k({mode:"build"});if(!z.config.enabled){W("Story feature is disabled in config.");return}let P=await H(z);w(z,P);let Y=J(z.config,P);B(z,Y),R(P.length);let X=U.outDir??z.config.outDir,Q=K.resolve(z.root,X);await E.promises.mkdir(Q,{recursive:!0}),console.log(` Building to ${X}...`);let M=F(z);await E.promises.writeFile(K.join(Q,"index.html"),M);let v={files:P.map((G)=>({id:G.id,fileName:G.fileName,relativePath:G.relativePath,treePath:G.treePath})),tree:Y};await E.promises.writeFile(K.join(Q,"stories.json"),JSON.stringify(v,null,2));let L={theme:z.config.theme,responsivePresets:z.config.responsivePresets,backgroundPresets:z.config.backgroundPresets};await E.promises.writeFile(K.join(Q,"config.json"),JSON.stringify(L,null,2));let Z=K.join(Q,"stories");await E.promises.mkdir(Z,{recursive:!0});for(let G of P){let g=await E.promises.readFile(G.path,"utf-8");await E.promises.writeFile(K.join(Z,`${G.id}.stx`),g)}_(z);let T=$();await E.promises.writeFile(K.join(Q,"search-index.json"),T);let C=Date.now()-A;j(P.length,X,C)}function F(U){let{theme:A}=U.config,z=A.title||"STX Story";return`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Aq as b,Bq as c,Cq as d,Dq as e,ap as a}from"./chunk-spnkgsft.js";import"./chunk-4awxsp8f.js";import"./chunk-hk8j3eps.js";import"./chunk-mxva4zmq.js";import"./chunk-1kg9sz9a.js";import"./chunk-nnd1hqht.js";import"./chunk-msxcd1kp.js";import"./chunk-xgtcq9bj.js";import"./chunk-2fspj91j.js";import"./chunk-evv58hf5.js";import"./chunk-5a1b5kjt.js";import"./chunk-r2kag877.js";import"./chunk-8p8qa1s9.js";import"./chunk-j4ze77e0.js";export{d as validateClientScript,c as processOnceDirective,b as processJsonDirective,e as processDirectives,a as injectRouterScript};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{hk as a,ik as b,jk as c,kk as d}from"./chunk-p4a35r71.js";import"./chunk-0e1pt5my.js";import"./chunk-spnkgsft.js";import"./chunk-4awxsp8f.js";import"./chunk-hk8j3eps.js";import"./chunk-mxva4zmq.js";import"./chunk-1kg9sz9a.js";import"./chunk-nnd1hqht.js";import"./chunk-msxcd1kp.js";import"./chunk-xgtcq9bj.js";import"./chunk-2fspj91j.js";import"./chunk-evv58hf5.js";import"./chunk-5a1b5kjt.js";import"./chunk-r2kag877.js";import"./chunk-8p8qa1s9.js";import"./chunk-j4ze77e0.js";export{b as getAvailableTargets,c as getAvailableFormats,d as default,a as buildNative};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{xp as a,yp as b}from"./chunk-spnkgsft.js";import"./chunk-4awxsp8f.js";import"./chunk-hk8j3eps.js";import"./chunk-mxva4zmq.js";import"./chunk-1kg9sz9a.js";import"./chunk-nnd1hqht.js";import"./chunk-msxcd1kp.js";import"./chunk-xgtcq9bj.js";import"./chunk-2fspj91j.js";import"./chunk-evv58hf5.js";import"./chunk-5a1b5kjt.js";import"./chunk-r2kag877.js";import"./chunk-8p8qa1s9.js";import"./chunk-j4ze77e0.js";export{b as processLoops,a as parseLoopBinding};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Nu as v}from"./chunk-j4ze77e0.js";function D4(){if(typeof Notification<"u"&&Notification.permission==="granted")return!0;return!1}function zZ(){return typeof window<"u"&&typeof document<"u"}async function M4(){if(typeof Notification>"u")return!1;if(Notification.permission==="granted")return!0;if(Notification.permission==="denied")return!1;return await Notification.requestPermission()==="granted"}var y=new Map;function T4(){return`alert-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}function _4(Z){switch(Z){case"info":return"ℹ";case"success":return"✔";case"warning":return"⚠";case"error":return"✖";default:return"ℹ"}}function N4(Z="top-right"){if(!zZ())throw Error("Toast container requires browser environment");try{let $=document.querySelector(`.stx-toast-container[data-position="${Z}"]`);if($)return $}catch{}let Y=document.createElement("div");Y.className=`stx-toast-container ${Z}`,Y.dataset.position=Z;try{if(document.body)document.body.appendChild(Y)}catch{}return Y}function E4(Z){let{options:Y}=Z,$=_4(Y.type),J=Y.type||"info",G=Y.duration!==0;return`
|
|
3
3
|
<div class="stx-toast ${J}" data-alert-id="${Z.id}" role="alert" aria-live="polite">
|
|
4
4
|
<div class="stx-toast-icon">${$}</div>
|
|
5
5
|
<div class="stx-toast-content">
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Ku as W,Lu as k,Mu as G}from"./chunk-j4ze77e0.js";import A from"fs";import B from"path";function h(j){let q=0;for(let K=0;K<j.length;K++){let Q=j[K];q=(q<<5)-q+Q,q=q&q}return Math.abs(q).toString(16).padStart(8,"0")}function u(j,q){let K=B.basename(j);for(let Q of q)if(Q.startsWith("*.")){let Y=Q.slice(1);if(K.endsWith(Y))return!0}else if(Q.includes("*")){let Y=new RegExp(`^${Q.replace(/\*/g,".*")}$`);if(Y.test(K)||Y.test(j))return!0}else if(K===Q||j.includes(Q))return!0;return!1}function f(j,q,K){let Q=B.extname(j).toLowerCase(),Y=l[Q],X=(K.maxFileSizeKB||500)*1024;if(q>X)return!1;if(K.exclude&&u(j,K.exclude))return!1;if(K.include&&K.include.length>0){for(let Z of K.include)if(Z.startsWith("*.")){if(j.endsWith(Z.slice(1)))return!0}else if(j.includes(Z))return!0}if(Y&&K[Y]===!0)return!0;if(!Y)return!1;return!1}function T(j,q,K,Q){let Y=A.readdirSync(j,{withFileTypes:!0});for(let X of Y){let Z=B.join(j,X.name);if(X.isDirectory()){if(["node_modules",".git",".stx"].includes(X.name))continue;T(Z,q,K,Q)}else if(X.isFile()){let O=A.statSync(Z),_=B.relative(q,Z);if(f(_,O.size,K)){let $=A.readFileSync(Z),L=h($),V=`/${_.replace(/\\/g,"/")}`;Q.push({url:V,revision:L,size:O.size})}}}}function U(j,q){let K=q.pwa?.precache,Q=[];if(!K?.enabled)return{entries:[],totalSize:0,fileCount:0};if(!A.existsSync(j))return{entries:[],totalSize:0,fileCount:0};T(j,j,K,Q),Q.sort((X,Z)=>X.url.localeCompare(Z.url));let Y=Q.reduce((X,Z)=>X+Z.size,0);return{entries:Q,totalSize:Y,fileCount:Q.length}}function J(j){if(j.entries.length===0)return"[]";return`[
|
|
3
3
|
${j.entries.map((K)=>` { url: '${K.url}', revision: '${K.revision}' }`).join(`,
|
|
4
4
|
`)}
|
|
5
5
|
]`}function E(j){if(j<1024)return`${j} B`;if(j<1048576)return`${(j/1024).toFixed(1)} KB`;return`${(j/1048576).toFixed(2)} MB`}var l;var F=G(()=>{l={".html":"includeHtml",".htm":"includeHtml",".js":"includeJs",".mjs":"includeJs",".css":"includeCss",".png":"includeImages",".jpg":"includeImages",".jpeg":"includeImages",".gif":"includeImages",".webp":"includeImages",".svg":"includeImages",".ico":"includeImages",".woff":"includeFonts",".woff2":"includeFonts",".ttf":"includeFonts",".eot":"includeFonts",".otf":"includeFonts"}});function g(j){let q={"cache-first":{className:"CacheFirst",importFrom:"workbox-strategies"},"network-first":{className:"NetworkFirst",importFrom:"workbox-strategies"},"stale-while-revalidate":{className:"StaleWhileRevalidate",importFrom:"workbox-strategies"},"network-only":{className:"NetworkOnly",importFrom:"workbox-strategies"},"cache-only":{className:"CacheOnly",importFrom:"workbox-strategies"}};return q[j]||q["network-first"]}function R(j){return g(j).className}function M(j){let q=j.pwa;if(!q?.enabled)return"";let K=q.routes||[],Q=q.cacheStorage,Y=[];for(let X of K){let Z=R(X.strategy),O=[];if(X.maxAgeSeconds||X.maxEntries||Q?.maxEntries){let $=X.maxEntries||Q?.maxEntries||100,L=X.maxAgeSeconds||(Q?.maxAge?Q.maxAge*24*60*60:void 0);O.push(`new ExpirationPlugin({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{dh as L,eh as w,fh as x,gh as p,hh as F,ih as T,lh as I,mh as f,nh as l,oh as n,ph as i,qh as P,rh as o,sh as a}from"./chunk-
|
|
2
|
+
import{dh as L,eh as w,fh as x,gh as p,hh as F,ih as T,lh as I,mh as f,nh as l,oh as n,ph as i,qh as P,rh as o,sh as a}from"./chunk-k46js7bz.js";import{As as ZG}from"./chunk-hk8j3eps.js";function HG(X,Z={}){let{src:G,alt:J,width:q,height:$,sizes:K="100vw",loading:Q="lazy",priority:Y=!1,quality:M=x,placeholder:N="none",formats:j=w,widths:C=L,decoding:B="async",fetchpriority:V,objectFit:O,objectPosition:W}=X,H=X.class,z=X.style,{processedImage:R,variants:_,optimize:E=!0,isDev:S=!1}=Z;if(_&&_.length>0)return OG(X,_,R);if(S||!E)return MG(X);return VG(X)}function OG(X,Z,G){let{src:J,alt:q,width:$,height:K,sizes:Q="100vw",loading:Y="lazy",priority:M=!1,decoding:N="async",fetchpriority:j,objectFit:C,objectPosition:B,placeholder:V="none"}=X,O=X.class,W=X.style,H=n(Z),z=l(Z),R=typeof Q==="object"?f(Q):Q,_=G?G.aspectRatio:$&&K?Number($)/Number(K):void 0,E=[];if(_)E.push(`aspect-ratio: ${_}`);if(C)E.push(`object-fit: ${C}`);if(B)E.push(`object-position: ${B}`);if(W)E.push(W);let S=E.length>0?` style="${E.join("; ")}"`:"",b=O?` class="${O}"`:"",u=M?"":` loading="${Y}"`,d=` decoding="${N}"`,h=j?` fetchpriority="${j}"`:M?' fetchpriority="high"':"",r=["avif","webp","jpeg","png"],s=[];for(let U of r){let D=H.get(U);if(D&&D.length>0){let m=I(D),QG=P(U);s.push(` <source type="${QG}" srcset="${m}" sizes="${R}" />`)}}let e="",t="",g;if(V!=="none"&&G?.placeholder){let U=`img-${Math.random().toString(36).slice(2,8)}`;if(e=`<div class="stx-image-wrapper" id="${U}">`,t="</div>",V==="blur")g=`
|
|
3
3
|
#${U} {
|
|
4
4
|
position: relative;
|
|
5
5
|
background-image: url('${G.placeholder}');
|
|
@@ -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 Ku,n as Lu,o as Mu,p as Nu};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Wi as a,Xi as b,Yi as c}from"./chunk-5q44vwmg.js";import"./chunk-ht51fz7w.js";import"./chunk-spnkgsft.js";import"./chunk-4awxsp8f.js";import"./chunk-hk8j3eps.js";import"./chunk-mxva4zmq.js";import"./chunk-1kg9sz9a.js";import"./chunk-nnd1hqht.js";import"./chunk-msxcd1kp.js";import"./chunk-xgtcq9bj.js";import"./chunk-2fspj91j.js";import"./chunk-evv58hf5.js";import"./chunk-5a1b5kjt.js";import"./chunk-r2kag877.js";import"./chunk-8p8qa1s9.js";import"./chunk-j4ze77e0.js";export{a as listComposableModules,b as getComposableScript,c as clearComposableCache};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Lq as x,Pl as Y}from"./chunk-
|
|
2
|
+
import{Lq as x,Pl as Y}from"./chunk-spnkgsft.js";import"./chunk-4awxsp8f.js";import"./chunk-hk8j3eps.js";import"./chunk-mxva4zmq.js";import"./chunk-1kg9sz9a.js";import"./chunk-nnd1hqht.js";import"./chunk-msxcd1kp.js";import"./chunk-xgtcq9bj.js";import"./chunk-2fspj91j.js";import"./chunk-evv58hf5.js";import"./chunk-5a1b5kjt.js";import"./chunk-r2kag877.js";import"./chunk-8p8qa1s9.js";import"./chunk-j4ze77e0.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{$r as b,_r as a,as as c,bs as d,cs as e,ds as f}from"./chunk-
|
|
2
|
+
import{$r as b,_r as a,as as c,bs as d,cs as e,ds as f}from"./chunk-spnkgsft.js";import"./chunk-4awxsp8f.js";import"./chunk-hk8j3eps.js";import"./chunk-mxva4zmq.js";import"./chunk-1kg9sz9a.js";import"./chunk-nnd1hqht.js";import"./chunk-msxcd1kp.js";import"./chunk-xgtcq9bj.js";import"./chunk-2fspj91j.js";import"./chunk-evv58hf5.js";import"./chunk-5a1b5kjt.js";import"./chunk-r2kag877.js";import"./chunk-8p8qa1s9.js";import"./chunk-j4ze77e0.js";export{f as validateConfig,b as resolveStxDirectories,c as loadStxConfig,e as defineStxConfig,a as defaultConfig,d as config};
|