@stacksjs/stx 0.2.833 → 0.2.834
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/builtins/image-worker.js +6 -1
- package/dist/{chunk-vb4xzz5c.js → chunk-0a36jnq4.js} +1 -1
- package/dist/chunk-0c8fqfan.js +3 -0
- package/dist/{chunk-3sqay5jm.js → chunk-0mb3jch4.js} +3 -3
- package/dist/{chunk-qym44qqd.js → chunk-0mrzdsh5.js} +4 -4
- package/dist/chunk-0rnfywsx.js +2 -0
- package/dist/chunk-0z7w8e0s.js +2 -0
- package/dist/{chunk-y34ayg61.js → chunk-1qgzexkc.js} +42 -40
- package/dist/{chunk-mxvevxb8.js → chunk-29f6vmyz.js} +4 -4
- package/dist/{chunk-jp6sbk05.js → chunk-2nxxhcyy.js} +1 -1
- package/dist/{chunk-xdwnbr9b.js → chunk-33czswpt.js} +2 -2
- package/dist/{chunk-ekh3mxyp.js → chunk-3bjnrmha.js} +2 -2
- package/dist/chunk-3f1ks1ah.js +2 -0
- package/dist/{chunk-6qbatp72.js → chunk-3tn9tb9w.js} +5 -5
- package/dist/{chunk-g0vz0ch5.js → chunk-3w8kt53x.js} +7 -7
- package/dist/chunk-4f2zy3y6.js +2 -0
- package/dist/{chunk-fby81k5g.js → chunk-4g6v5qsp.js} +2 -2
- package/dist/{chunk-04z1xyrb.js → chunk-4ntm3dtk.js} +2 -2
- package/dist/chunk-523s4p08.js +2 -0
- package/dist/{chunk-mypygxdm.js → chunk-52g026sc.js} +2 -2
- package/dist/{chunk-716jrdcg.js → chunk-52t0qpx6.js} +1 -1
- package/dist/{chunk-z58dr234.js → chunk-5379q74v.js} +1 -1
- package/dist/{chunk-4a3r1kh1.js → chunk-55e46spy.js} +2 -2
- package/dist/{chunk-gy59sm92.js → chunk-55k7m9cp.js} +2 -2
- package/dist/chunk-5gqjhq31.js +2 -0
- package/dist/chunk-6j2aea05.js +2 -0
- package/dist/{chunk-yrw5ensv.js → chunk-7bvvv74e.js} +2 -2
- package/dist/chunk-7efkc3gk.js +2 -0
- package/dist/{chunk-m6q2vedz.js → chunk-7h5rt22w.js} +4 -4
- package/dist/{chunk-5201w0f1.js → chunk-84nw3921.js} +3 -3
- package/dist/chunk-913grzaj.js +2 -0
- package/dist/chunk-99ddfv0b.js +2 -0
- package/dist/{chunk-7nnep25t.js → chunk-9n14m2gn.js} +5 -5
- package/dist/chunk-9w3r1ch2.js +3 -0
- package/dist/chunk-a1hxz8q4.js +2 -0
- package/dist/{chunk-wt7qhv5b.js → chunk-a579jdwb.js} +1 -1
- package/dist/{chunk-7p8m82pj.js → chunk-amg6kr1p.js} +2 -2
- package/dist/{chunk-cfqz4bd6.js → chunk-b0z85f8h.js} +1 -1
- package/dist/chunk-b3s8tb18.js +2 -0
- package/dist/{chunk-67nq6csk.js → chunk-bc4x45vx.js} +1 -1
- package/dist/{chunk-3p7r3ajd.js → chunk-bky02g7k.js} +2 -2
- package/dist/chunk-brk1pk8w.js +2 -0
- package/dist/{chunk-hd378dgy.js → chunk-c3dg8qdn.js} +2 -2
- package/dist/{chunk-cca18z35.js → chunk-c9vxm8yq.js} +8 -8
- package/dist/{chunk-g00nhj1d.js → chunk-cddzcckm.js} +7 -7
- package/dist/chunk-cy3c4yxg.js +2 -0
- package/dist/chunk-db7p6bc4.js +2 -0
- package/dist/{chunk-1b1crd5a.js → chunk-ddtk57fy.js} +4 -4
- package/dist/{chunk-95d5qy7d.js → chunk-dgqp0pjn.js} +2 -2
- package/dist/{chunk-gcf97wgx.js → chunk-dv11h4f0.js} +1 -1
- package/dist/{chunk-yd1j88kp.js → chunk-dvyysszs.js} +6 -6
- package/dist/chunk-e7ssdryq.js +2 -0
- package/dist/{chunk-a395a3dt.js → chunk-ecmvq302.js} +8 -8
- package/dist/chunk-ee147ezb.js +2 -0
- package/dist/chunk-f6vzn90z.js +2 -0
- package/dist/chunk-fc5zj6qg.js +2 -0
- package/dist/{chunk-wr7bmkne.js → chunk-fvgk1w9s.js} +2 -2
- package/dist/{chunk-hfktzsat.js → chunk-g3xbwz51.js} +1 -1
- package/dist/chunk-g5jfb1ms.js +2 -0
- package/dist/{chunk-6b1g5a6a.js → chunk-ga2k1rga.js} +11 -11
- package/dist/{chunk-cv1zc9dg.js → chunk-gh62p9mx.js} +2 -2
- package/dist/{chunk-4xw22xqd.js → chunk-gnt1v0kc.js} +6 -6
- package/dist/chunk-gtj8wy95.js +2 -0
- package/dist/{chunk-wb6w807m.js → chunk-h4tbpr7p.js} +1 -1
- package/dist/chunk-j0w048sj.js +2 -0
- package/dist/chunk-jmk1ze6r.js +2 -0
- package/dist/{chunk-t59bc7na.js → chunk-jr0r5pzw.js} +2 -2
- package/dist/{chunk-r2fwxtke.js → chunk-k46pfdmn.js} +1 -1
- package/dist/chunk-k4hjqfx1.js +2 -0
- package/dist/chunk-k761q7s7.js +2 -0
- package/dist/{chunk-1vzncfka.js → chunk-kw5gra2z.js} +2 -2
- package/dist/chunk-kzvt88tk.js +2 -0
- package/dist/chunk-mdtysd2d.js +2 -0
- package/dist/{chunk-rkdsgfhd.js → chunk-ms3v5nat.js} +6 -6
- package/dist/{chunk-ba499a3p.js → chunk-mya2g8sn.js} +1 -1
- package/dist/{chunk-f6b7av6b.js → chunk-n4qznmkm.js} +5 -5
- package/dist/{chunk-m9bbhg46.js → chunk-nmtya57z.js} +2 -2
- package/dist/chunk-npn692c4.js +42 -0
- package/dist/{chunk-02zvytqx.js → chunk-nxfyjw59.js} +1 -1
- package/dist/{chunk-xn9jg1q5.js → chunk-nyg0nbjj.js} +1 -1
- package/dist/chunk-pt8nft3k.js +2 -0
- package/dist/chunk-pwv77cyb.js +2 -0
- package/dist/chunk-q1cfc2fp.js +2 -0
- package/dist/{chunk-qy6dtm1a.js → chunk-q46ay7aq.js} +4 -4
- package/dist/{chunk-38wq4ttd.js → chunk-qbvy23qa.js} +95 -95
- package/dist/{chunk-xdqv5yq4.js → chunk-qdagsy5b.js} +2 -2
- package/dist/{chunk-s67pnfvz.js → chunk-qfcabz87.js} +4 -4
- package/dist/{chunk-qws72sn9.js → chunk-rfdwn0k3.js} +32 -32
- package/dist/{chunk-wvds0s9m.js → chunk-rnm8ejpz.js} +2 -2
- package/dist/{chunk-a9d14beh.js → chunk-rtj900pa.js} +1 -1
- package/dist/{chunk-c84pxd2k.js → chunk-s33andzg.js} +2 -2
- package/dist/{chunk-4z0jpzdq.js → chunk-s3j5vxy9.js} +2 -2
- package/dist/{chunk-8y8kgw9s.js → chunk-s6r54dyf.js} +2 -2
- package/dist/{chunk-c6gr71fg.js → chunk-srb0qmgx.js} +1 -1
- package/dist/{chunk-a7j451hn.js → chunk-srqk1nxc.js} +2 -2
- package/dist/{chunk-vhehb6eh.js → chunk-t33fttx9.js} +1 -1
- package/dist/chunk-t612xpa4.js +2 -0
- package/dist/{chunk-g4qzy5hv.js → chunk-tesbhpbp.js} +1 -1
- package/dist/{chunk-m9dj8pgb.js → chunk-tvw571ab.js} +1 -1
- package/dist/{chunk-6k26n0sj.js → chunk-tx8wk6h7.js} +2 -2
- package/dist/{chunk-c9mdvpf5.js → chunk-txd2js5v.js} +10 -10
- package/dist/chunk-v1wgp7ep.js +2 -0
- package/dist/{chunk-qnrgfm9v.js → chunk-v3xyb3ws.js} +2 -2
- package/dist/{chunk-w7m9pecb.js → chunk-v4kenb7z.js} +5 -5
- package/dist/chunk-v53kdjz6.js +2 -0
- package/dist/{chunk-2qngyyaz.js → chunk-vfj9wp11.js} +2 -2
- package/dist/{chunk-nfpsaaqm.js → chunk-vfxkn1pe.js} +3 -3
- package/dist/{chunk-tchz2m2v.js → chunk-vnk6gt0t.js} +1 -1
- package/dist/chunk-vqpypnys.js +2 -0
- package/dist/{chunk-1c62mrad.js → chunk-x57x0yq7.js} +5 -5
- package/dist/{chunk-3grrmmrg.js → chunk-xd9t20sx.js} +1 -1
- package/dist/{chunk-dzm9g76x.js → chunk-xqy8y5dc.js} +1 -1
- package/dist/{chunk-6tjm38e4.js → chunk-xtqapjz3.js} +1 -1
- package/dist/{chunk-6kk8p766.js → chunk-xvmn976f.js} +1 -1
- package/dist/chunk-xxyhzsqx.js +2 -0
- package/dist/{chunk-bgqbvf1w.js → chunk-y47n1j5x.js} +6 -6
- package/dist/{chunk-qadce16v.js → chunk-ya6bp08c.js} +1 -1
- package/dist/{chunk-zvvv6x8c.js → chunk-yw1s8kyj.js} +3 -3
- package/dist/{chunk-rmygv0n0.js → chunk-z0ynyz62.js} +4 -4
- package/dist/chunk-z2e06633.js +2 -0
- package/dist/{chunk-kn3pknzt.js → chunk-zb7kfwac.js} +3 -3
- package/dist/chunk-zsdqsky6.js +2 -0
- package/dist/cli.js +13 -13
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/document-styles.d.ts +7 -0
- package/dist/document-styles.js +40 -0
- package/dist/html-masking.js +6 -3
- package/dist/process.js +3 -0
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +4 -4
- package/package.json +1 -1
- package/dist/chunk-09fbj9b4.js +0 -2
- package/dist/chunk-17h13201.js +0 -2
- package/dist/chunk-17zrprh0.js +0 -2
- package/dist/chunk-28z6pq6w.js +0 -42
- package/dist/chunk-293fnyc2.js +0 -2
- package/dist/chunk-42c92rp3.js +0 -2
- package/dist/chunk-437wgphe.js +0 -2
- package/dist/chunk-46yyc2sf.js +0 -2
- package/dist/chunk-503ppv77.js +0 -2
- package/dist/chunk-5e7abvtz.js +0 -2
- package/dist/chunk-6r4teng3.js +0 -2
- package/dist/chunk-7b105hww.js +0 -2
- package/dist/chunk-83hwrh5n.js +0 -2
- package/dist/chunk-8n8vj099.js +0 -2
- package/dist/chunk-9jvpyq5h.js +0 -2
- package/dist/chunk-abh791bh.js +0 -2
- package/dist/chunk-aqjcqnex.js +0 -2
- package/dist/chunk-awd0dvjb.js +0 -2
- package/dist/chunk-b39g02k9.js +0 -2
- package/dist/chunk-e7yejx6x.js +0 -2
- package/dist/chunk-f8g0sgs0.js +0 -2
- package/dist/chunk-fb90n0by.js +0 -2
- package/dist/chunk-ggnzezrn.js +0 -2
- package/dist/chunk-jny0vbmt.js +0 -2
- package/dist/chunk-k6ye0159.js +0 -3
- package/dist/chunk-kgn911k7.js +0 -2
- package/dist/chunk-kr6x19z0.js +0 -2
- package/dist/chunk-kshem79d.js +0 -2
- package/dist/chunk-ns23fv15.js +0 -3
- package/dist/chunk-pc4xah5j.js +0 -2
- package/dist/chunk-q2tbbtqn.js +0 -2
- package/dist/chunk-qg2tpvdw.js +0 -2
- package/dist/chunk-shzkz2az.js +0 -2
- package/dist/chunk-v1mwhvf8.js +0 -2
- package/dist/chunk-vce1js6z.js +0 -2
- package/dist/chunk-vhmzkhy4.js +0 -2
- package/dist/chunk-wpyhavjy.js +0 -2
- package/dist/chunk-zt74q4c8.js +0 -2
- package/dist/chunk-zty254tw.js +0 -2
- package/dist/chunk-zy41xhc4.js +0 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import x from"fs";import u from"path";import p from"fs";import w from"path";var y=["components","layouts","partials","emails"];function M(e){return e.split(/[\\/]/).filter(Boolean).slice(0,-1).some((a)=>y.includes(a))}function b(e){return M(e.replace(/^\//,""))}function
|
|
3
|
-
`),o=w.join(t,"route-types.d.ts");try{if(p.existsSync(o)&&p.readFileSync(o,"utf8")===n)return;p.mkdirSync(t,{recursive:!0}),p.writeFileSync(o,n)}catch{}}function
|
|
4
|
-
`))}import I from"path";var N=Object.freeze(["ico","png","jpg","jpeg","gif","webp","avif","svg","bmp","tif","tiff","heic","css","js","mjs","cjs","map","wasm","webmanifest","json","xml","txt","rss","atom","woff","woff2","ttf","otf","eot","mp3","mp4","m4a","m4v","mov","webm","ogg","ogv","oga","wav","flac","avi","mkv","pdf","csv","doc","docx","xls","xlsx","ppt","pptx","rtf","odt","zip","gz","tgz","tar","rar","7z","bz2","xz","php","phtml","asp","aspx","jsp","cgi","env","ini","yml","yaml","toml","sql","bak","old","swp","log","conf","cfg","exe","dmg","pkg","apk","ipa","msi","iso","bin","dll"]),D=N.flatMap((e)=>e===e.toUpperCase()?[e]:[e,e.toUpperCase()]).join("|"),G=new RegExp(`\\.(?:${D})$`),E=`(?![^/]*\\.(?:${D})$)`;function kt(e){let t=e,a=t.search(/[?#]/);if(a!==-1)t=t.slice(0,a);let r=t.slice(t.lastIndexOf("/")+1);return r.length>0&&G.test(r)}function R(e,t){let r=I.relative(t,e).replace(/\.(stx|md)$/,"");if(r=r.split(I.sep).join("/"),r==="index")return"/";if(r.endsWith("/index"))r=r.slice(0,-6);return r=r.replace(/\[\[([^\]]+)\]\]/g,":$1?"),r=r.replace(/\[([^\]]+)\]/g,":$1"),r=r.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${r}`}function de(e,t={}){let a=t.page?E:"",r=[],n="",o=0;while(o<e.length){let i=e.slice(o),c=/^\/:([^/?*]+)\?/.exec(i);if(c){r.push(c[1]);let d=o+c[0].length===e.length;n+=`(?:/${d?a:""}([^/]+))?`,o+=c[0].length;continue}let s=/^:([^/?*]+)\*/.exec(i);if(s){r.push(s[1]),n+="(.+)",o+=s[0].length;continue}let l=/^:([^/?*]+)/.exec(i);if(l){r.push(l[1]);let d=o+l[0].length===e.length;n+=`${d?a:""}([^/]+)`,o+=l[0].length;continue}n+=e[o].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),o+=1}return{regex:new RegExp(`^${n}$`),params:r}}function pr(e,t){let a=e===""?"/":e;for(let r of t){let n=a.match(r.regex);if(n){let o={};return r.params.forEach((i,c)=>{o[i]=n[c+1]}),{route:r,params:o}}}return null}function Ts(e,t={}){let a=e.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return de(a,t)}import j from"fs";import L from"path";function _(e,t){let a=[],r=L.dirname(e);while(r.startsWith(t)||r===t){let n=L.join(r,"_layout.stx");if(j.existsSync(n))a.unshift(n);if(r===t)break;r=L.dirname(r)}return a}function B(e,t){let a=[];if(!x.existsSync(e))return a;let r=x.readdirSync(e,{withFileTypes:!0});for(let n of r){let o=u.join(e,n.name);if(n.isDirectory()){if(n.name.startsWith("."))continue;if(y.includes(n.name))continue;a.push(...B(o,t))}else if(n.isFile()){let i=u.extname(n.name);if(t.includes(i)){if(n.name.startsWith("_")&&n.name!=="_layout.stx")continue;if(n.name==="_layout.stx")continue;a.push(o)}}}return a}class fr{routes;pagesDir;pagesDirs;config;constructor(e,t={}){this.config=t;let a=t.pagesDirs&&t.pagesDirs.length>0?t.pagesDirs:[t.pagesDir||"pages"];this.pagesDirs=a.map((s)=>u.resolve(e,s)),this.pagesDir=this.pagesDirs[0];let r=t.extensions||[".stx"],n=(s)=>{let l=u.resolve(e,s);try{return x.realpathSync(l)}catch{return l}},o=(t.exclude??[]).filter((s)=>typeof s==="string"&&s.trim()!=="").map(n),i=(s)=>{if(o.length===0)return!1;let l=n(s);return o.some((d)=>l===d||l.startsWith(`${d}${u.sep}`))},c=new Set;this.routes=[];for(let s of this.pagesDirs){let l=B(s,r).filter((h)=>!i(h)),d=new Map;for(let h of l){let g=R(h,s),m=t.pagesDirs?g.replace(/:[\w]+/g,":param"):g;if(t.pagesDirs&&d.has(m))throw Error(`Conflicting layer pages for ${g}: ${d.get(m)} and ${h}`);if(d.set(m,h),c.has(m))continue;c.add(m);let{regex:X,params:P}=de(g,{page:!0}),C=t.layouts!==!1?_(h,s):[];this.routes.push({pattern:g,regex:X,params:P,filePath:h,isDynamic:P.length>0,layout:C.length>0?C[C.length-1]:void 0})}}if(this.routes.sort((s,l)=>{if(!s.isDynamic&&l.isDynamic)return-1;if(s.isDynamic&&!l.isDynamic)return 1;let d=s.pattern.split("/").length,h=l.pattern.split("/").length;if(d!==h)return h-d;return s.pattern.localeCompare(l.pattern)}),t.emit!==!1){let s=u.resolve(e,t.stateDir||process.env.STX_DIR?.trim()||".stx");ri(this.routes,s),si(this.routes,s,this.pagesDir)}}match(e){let t=e===""?"/":e;for(let a of this.routes){let r=t.match(a.regex);if(r){let n={};return a.params.forEach((o,i)=>{n[o]=r[i+1]}),{route:a,params:n}}}return null}resolve(e,t){let a=this.routes.find((n)=>n.pattern===e||n.filePath.includes(e));if(!a)return"#not-found";let r=a.pattern;if(t)for(let[n,o]of Object.entries(t))r=r.replace(`:${n}`,encodeURIComponent(o));return r}addRoute(e){this.routes.push(e),this.routes.sort((t,a)=>{if(!t.isDynamic&&a.isDynamic)return-1;if(t.isDynamic&&!a.isDynamic)return 1;return t.pattern.localeCompare(a.pattern)})}getLayout(e){return e.layout??null}}function $s(e,t){let a=[`${t}.stx`,"error.stx"];for(let r of a){let n=u.join(e,r);if(x.existsSync(n))return n}return null}function Rs(e,t){return e.map((a)=>{let r=u.relative(t,a.filePath),n=a.isDynamic?" (dynamic)":"";return`${a.pattern} \u2192 ${r}${n}`})}var f={},k="";function Wf(e){k=e.replace(/\/$/,"")}function qf(e,t,a={}){f[e]={path:t,name:e,params:a}}function Kf(e){for(let[t,a]of Object.entries(e))if(typeof a==="string")f[t]={path:a,name:t};else f[t]={...a,name:t}}function gr(e,t={},a=!1){let r=f[e];if(!r)return console.warn(`Route [${e}] not defined.`),"#undefined-route";let n={...r.params,...t},o=r.path;o=o.replace(/:(\w+)/g,(c,s)=>{let l=n[s];if(l===void 0)return console.warn(`Missing parameter [${s}] for route [${e}].`),`:${s}`;return delete n[s],encodeURIComponent(String(l))});let i=Object.entries(n);if(i.length>0){let c=i.map(([s,l])=>`${encodeURIComponent(s)}=${encodeURIComponent(String(l))}`).join("&");o+=(o.includes("?")?"&":"?")+c}return a&&k?`${k}${o}`:o}function Xf(){for(let e of Object.keys(f))delete f[e];k=""}import F from"fs";import q from"path";function Gf(e,t={}){return{type:"redirect",path:e,options:{replace:t.replace??!1,external:t.external??!1,redirectCode:t.redirectCode??302}}}function Jf(e){return{type:"abort",error:typeof e==="string"?{statusCode:500,message:e}:e}}function Yf(e,t={}){return{handler:e,mode:t.mode??"universal"}}function O(e){let t={};if(!e)return t;let a=e.split(";");for(let r of a){let[n,...o]=r.split("=");if(n){let i=n.trim(),c=o.join("=").trim();if(i)t[i]=decodeURIComponent(c)}}return t}function S(e,t,a={}){let r=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(a.expires){let n=typeof a.expires==="number"?new Date(Date.now()+a.expires*1000):a.expires;r+=`; Expires=${n.toUTCString()}`}if(a.path)r+=`; Path=${a.path}`;if(a.domain)r+=`; Domain=${a.domain}`;if(a.secure)r+="; Secure";if(a.httpOnly)r+="; HttpOnly";if(a.sameSite)r+=`; SameSite=${a.sameSite}`;return r}function Cc(e,t){let a=e.headers.get("cookie")||"",r=O(a);return{get(n){return r[n]},set(n,o,i={}){r[n]=o,t.append("Set-Cookie",S(n,o,i))},delete(n){delete r[n],t.append("Set-Cookie",S(n,"",{expires:new Date(0),path:"/"}))},getAll(){return{...r}}}}function Ec(){return{get(e){if(typeof document>"u")return;return O(document.cookie)[e]},set(e,t,a={}){if(typeof document>"u")return;document.cookie=S(e,t,a)},delete(e){if(typeof document>"u")return;document.cookie=S(e,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return O(document.cookie)}}}function Tc(){let e=typeof window<"u"&&typeof window.localStorage<"u";return{get(t){if(!e)return null;try{return window.localStorage.getItem(t)}catch{return null}},set(t,a){if(!e)return;try{window.localStorage.setItem(t,a)}catch{}},remove(t){if(!e)return;try{window.localStorage.removeItem(t)}catch{}},isAvailable(){return e}}}var v=new Map;function oi(e,t){v.set(e,t)}function $c(e){return v.get(e)}function Zf(e){return v.has(e)}function _t(){v.clear()}function Ct(){return Array.from(v.keys())}async function Et(e,t="middleware"){let a=q.resolve(e,t);if(!F.existsSync(a))return;let r=F.readdirSync(a);for(let n of r){if(!n.endsWith(".ts")&&!n.endsWith(".js"))continue;if(n.includes(".test.")||n.includes(".spec."))continue;let o=n.replace(/\.(ts|js)$/,""),i=q.join(a,n);try{let s=(await import(i)).default;if(s&&typeof s.handler==="function")oi(o,s);else if(typeof s==="function")oi(o,{handler:s,mode:"universal"})}catch(c){console.warn(`Failed to load middleware '${o}' from ${i}:`,c)}}}function K(e){let t={};if(!e)return t;let a=new URLSearchParams(e);for(let[r,n]of a)t[r]=n;return t}function Tt(e,t,a,r=""){return{path:e,params:t,query:K(r),fullPath:r?`${e}?${r}`:e,meta:a}}function $t(e,t,a,r){let n=r?.isServer??typeof window>"u",o=!n,i=new Headers;return{to:e,from:t,isClient:o,isServer:n,cookies:n&&a?Cc(a,i):Ec(),storage:Tc(),state:{},request:a,responseHeaders:i}}async function Rt(e,t){let a=Array.isArray(e)?e:[e],r=t.isServer;for(let n of a){let o=$c(n);if(!o)return console.error(`Route middleware '${n}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${n}' is not registered`}},state:t.state,responseHeaders:t.responseHeaders};if(o.mode==="server"&&!r)continue;try{let i=await o.handler(t);if(i){if(i.type==="redirect")return{passed:!1,redirect:i,state:t.state,responseHeaders:t.responseHeaders};if(i.type==="abort")return{passed:!1,abort:i,state:t.state,responseHeaders:t.responseHeaders}}}catch(i){return console.error(`Error in middleware '${n}':`,i),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:i instanceof Error?i.message:"Middleware error"}},state:t.state,responseHeaders:t.responseHeaders}}}return{passed:!0,state:t.state,responseHeaders:t.responseHeaders}}function As(e){let a=e.replace(/\\/g,"/").split("/").filter(Boolean),r=a.lastIndexOf("layouts"),n=r>=0?a[r+1]:a.at(-1);if(!n)return"app";return n.replace(/\.stx$/i,"")||"app"}function tt(e){let t=e.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),a=e.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),r=e.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),n=t?.[1]||r?.[1]||"";return{layout:n,group:a?.[1]||As(n)}}var A,T;function W(e){let t=[],a="log(",r=0;while(r<e.length){let n=e.indexOf("log(",r);if(n===-1){t.push(e.slice(r));break}let o=n>0?e[n-1]:" ",i=/\bfunction\s+$/.test(e.slice(Math.max(0,n-16),n));if(/[\w$.]/.test(o)||i){t.push(e.slice(r,n+4)),r=n+4;continue}t.push(e.slice(r,n));let c=1,s=n+4;while(s<e.length&&c>0){let l=e[s];if(l==='"'||l==="'"||l==="`"){let d=l;s++;while(s<e.length&&e[s]!==d){if(e[s]==="\\")s++;s++}s++;continue}if(l==="(")c++;else if(l===")")c--;s++}t.push("0"),r=s}return t.join("")}function U(e,t=!1){try{return new Bun.Transpiler(t?{loader:"js",minify:{whitespace:!0,identifiers:!0}}:{loader:"js",minifyWhitespace:!0}).transformSync(e).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return e}}function H(){return`
|
|
2
|
+
import x from"fs";import u from"path";import p from"fs";import w from"path";var y=["components","layouts","partials","emails"];function M(e){return e.split(/[\\/]/).filter(Boolean).slice(0,-1).some((a)=>y.includes(a))}function b(e){return M(e.replace(/^\//,""))}function si(e,t){let a=e.filter((i)=>!b(i.pattern)),r=["// Auto-generated by STX - do not edit"];if(a.length===0)r.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{r.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let i of a){let c=[];for(let l of i.params){let d=i.pattern.includes(`:${l}?`)?"?":"";c.push(`${l}${d}: string`)}let s=c.join("; ");r.push(` '${i.pattern}': { ${s} }`)}r.push(" }","}","","export {}","")}let n=r.join(`
|
|
3
|
+
`),o=w.join(t,"route-types.d.ts");try{if(p.existsSync(o)&&p.readFileSync(o,"utf8")===n)return;p.mkdirSync(t,{recursive:!0}),p.writeFileSync(o,n)}catch{}}function oi(e,t,a){let r=process.cwd(),n=w.relative(r,a),o=e.filter((c)=>!b(c.pattern)),i=["// Auto-generated by stx \u2014 do not edit",`// Source: ${n||"pages"}/`,"","export const routes = ["];for(let c of o){let s=w.relative(r,c.filePath).replace(/\\/g,"/"),l=JSON.stringify(c.params),d=c.layout?`, layout: '${w.relative(r,c.layout).replace(/\\/g,"/")}'`:"";i.push(` { pattern: '${c.pattern}', filePath: '${s}', isDynamic: ${c.isDynamic}, params: ${l}${d} },`)}i.push("] as const",""),i.push("export type RouteName = typeof routes[number]['pattern']",""),p.mkdirSync(t,{recursive:!0}),p.writeFileSync(w.join(t,"routes.ts"),i.join(`
|
|
4
|
+
`))}import I from"path";var N=Object.freeze(["ico","png","jpg","jpeg","gif","webp","avif","svg","bmp","tif","tiff","heic","css","js","mjs","cjs","map","wasm","webmanifest","json","xml","txt","rss","atom","woff","woff2","ttf","otf","eot","mp3","mp4","m4a","m4v","mov","webm","ogg","ogv","oga","wav","flac","avi","mkv","pdf","csv","doc","docx","xls","xlsx","ppt","pptx","rtf","odt","zip","gz","tgz","tar","rar","7z","bz2","xz","php","phtml","asp","aspx","jsp","cgi","env","ini","yml","yaml","toml","sql","bak","old","swp","log","conf","cfg","exe","dmg","pkg","apk","ipa","msi","iso","bin","dll"]),D=N.flatMap((e)=>e===e.toUpperCase()?[e]:[e,e.toUpperCase()]).join("|"),G=new RegExp(`\\.(?:${D})$`),E=`(?![^/]*\\.(?:${D})$)`;function kt(e){let t=e,a=t.search(/[?#]/);if(a!==-1)t=t.slice(0,a);let r=t.slice(t.lastIndexOf("/")+1);return r.length>0&&G.test(r)}function R(e,t){let r=I.relative(t,e).replace(/\.(stx|md)$/,"");if(r=r.split(I.sep).join("/"),r==="index")return"/";if(r.endsWith("/index"))r=r.slice(0,-6);return r=r.replace(/\[\[([^\]]+)\]\]/g,":$1?"),r=r.replace(/\[([^\]]+)\]/g,":$1"),r=r.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${r}`}function de(e,t={}){let a=t.page?E:"",r=[],n="",o=0;while(o<e.length){let i=e.slice(o),c=/^\/:([^/?*]+)\?/.exec(i);if(c){r.push(c[1]);let d=o+c[0].length===e.length;n+=`(?:/${d?a:""}([^/]+))?`,o+=c[0].length;continue}let s=/^:([^/?*]+)\*/.exec(i);if(s){r.push(s[1]),n+="(.+)",o+=s[0].length;continue}let l=/^:([^/?*]+)/.exec(i);if(l){r.push(l[1]);let d=o+l[0].length===e.length;n+=`${d?a:""}([^/]+)`,o+=l[0].length;continue}n+=e[o].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),o+=1}return{regex:new RegExp(`^${n}$`),params:r}}function fr(e,t){let a=e===""?"/":e;for(let r of t){let n=a.match(r.regex);if(n){let o={};return r.params.forEach((i,c)=>{o[i]=n[c+1]}),{route:r,params:o}}}return null}function $s(e,t={}){let a=e.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return de(a,t)}import j from"fs";import L from"path";function _(e,t){let a=[],r=L.dirname(e);while(r.startsWith(t)||r===t){let n=L.join(r,"_layout.stx");if(j.existsSync(n))a.unshift(n);if(r===t)break;r=L.dirname(r)}return a}function B(e,t){let a=[];if(!x.existsSync(e))return a;let r=x.readdirSync(e,{withFileTypes:!0});for(let n of r){let o=u.join(e,n.name);if(n.isDirectory()){if(n.name.startsWith("."))continue;if(y.includes(n.name))continue;a.push(...B(o,t))}else if(n.isFile()){let i=u.extname(n.name);if(t.includes(i)){if(n.name.startsWith("_")&&n.name!=="_layout.stx")continue;if(n.name==="_layout.stx")continue;a.push(o)}}}return a}class gr{routes;pagesDir;pagesDirs;config;constructor(e,t={}){this.config=t;let a=t.pagesDirs&&t.pagesDirs.length>0?t.pagesDirs:[t.pagesDir||"pages"];this.pagesDirs=a.map((s)=>u.resolve(e,s)),this.pagesDir=this.pagesDirs[0];let r=t.extensions||[".stx"],n=(s)=>{let l=u.resolve(e,s);try{return x.realpathSync(l)}catch{return l}},o=(t.exclude??[]).filter((s)=>typeof s==="string"&&s.trim()!=="").map(n),i=(s)=>{if(o.length===0)return!1;let l=n(s);return o.some((d)=>l===d||l.startsWith(`${d}${u.sep}`))},c=new Set;this.routes=[];for(let s of this.pagesDirs){let l=B(s,r).filter((h)=>!i(h)),d=new Map;for(let h of l){let g=R(h,s),m=t.pagesDirs?g.replace(/:[\w]+/g,":param"):g;if(t.pagesDirs&&d.has(m))throw Error(`Conflicting layer pages for ${g}: ${d.get(m)} and ${h}`);if(d.set(m,h),c.has(m))continue;c.add(m);let{regex:X,params:P}=de(g,{page:!0}),C=t.layouts!==!1?_(h,s):[];this.routes.push({pattern:g,regex:X,params:P,filePath:h,isDynamic:P.length>0,layout:C.length>0?C[C.length-1]:void 0})}}if(this.routes.sort((s,l)=>{if(!s.isDynamic&&l.isDynamic)return-1;if(s.isDynamic&&!l.isDynamic)return 1;let d=s.pattern.split("/").length,h=l.pattern.split("/").length;if(d!==h)return h-d;return s.pattern.localeCompare(l.pattern)}),t.emit!==!1){let s=u.resolve(e,t.stateDir||process.env.STX_DIR?.trim()||".stx");si(this.routes,s),oi(this.routes,s,this.pagesDir)}}match(e){let t=e===""?"/":e;for(let a of this.routes){let r=t.match(a.regex);if(r){let n={};return a.params.forEach((o,i)=>{n[o]=r[i+1]}),{route:a,params:n}}}return null}resolve(e,t){let a=this.routes.find((n)=>n.pattern===e||n.filePath.includes(e));if(!a)return"#not-found";let r=a.pattern;if(t)for(let[n,o]of Object.entries(t))r=r.replace(`:${n}`,encodeURIComponent(o));return r}addRoute(e){this.routes.push(e),this.routes.sort((t,a)=>{if(!t.isDynamic&&a.isDynamic)return-1;if(t.isDynamic&&!a.isDynamic)return 1;return t.pattern.localeCompare(a.pattern)})}getLayout(e){return e.layout??null}}function Rs(e,t){let a=[`${t}.stx`,"error.stx"];for(let r of a){let n=u.join(e,r);if(x.existsSync(n))return n}return null}function As(e,t){return e.map((a)=>{let r=u.relative(t,a.filePath),n=a.isDynamic?" (dynamic)":"";return`${a.pattern} \u2192 ${r}${n}`})}var f={},k="";function Wf(e){k=e.replace(/\/$/,"")}function qf(e,t,a={}){f[e]={path:t,name:e,params:a}}function Kf(e){for(let[t,a]of Object.entries(e))if(typeof a==="string")f[t]={path:a,name:t};else f[t]={...a,name:t}}function mr(e,t={},a=!1){let r=f[e];if(!r)return console.warn(`Route [${e}] not defined.`),"#undefined-route";let n={...r.params,...t},o=r.path;o=o.replace(/:(\w+)/g,(c,s)=>{let l=n[s];if(l===void 0)return console.warn(`Missing parameter [${s}] for route [${e}].`),`:${s}`;return delete n[s],encodeURIComponent(String(l))});let i=Object.entries(n);if(i.length>0){let c=i.map(([s,l])=>`${encodeURIComponent(s)}=${encodeURIComponent(String(l))}`).join("&");o+=(o.includes("?")?"&":"?")+c}return a&&k?`${k}${o}`:o}function Xf(){for(let e of Object.keys(f))delete f[e];k=""}import F from"fs";import q from"path";function Gf(e,t={}){return{type:"redirect",path:e,options:{replace:t.replace??!1,external:t.external??!1,redirectCode:t.redirectCode??302}}}function Jf(e){return{type:"abort",error:typeof e==="string"?{statusCode:500,message:e}:e}}function Yf(e,t={}){return{handler:e,mode:t.mode??"universal"}}function O(e){let t={};if(!e)return t;let a=e.split(";");for(let r of a){let[n,...o]=r.split("=");if(n){let i=n.trim(),c=o.join("=").trim();if(i)t[i]=decodeURIComponent(c)}}return t}function S(e,t,a={}){let r=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(a.expires){let n=typeof a.expires==="number"?new Date(Date.now()+a.expires*1000):a.expires;r+=`; Expires=${n.toUTCString()}`}if(a.path)r+=`; Path=${a.path}`;if(a.domain)r+=`; Domain=${a.domain}`;if(a.secure)r+="; Secure";if(a.httpOnly)r+="; HttpOnly";if(a.sameSite)r+=`; SameSite=${a.sameSite}`;return r}function Cc(e,t){let a=e.headers.get("cookie")||"",r=O(a);return{get(n){return r[n]},set(n,o,i={}){r[n]=o,t.append("Set-Cookie",S(n,o,i))},delete(n){delete r[n],t.append("Set-Cookie",S(n,"",{expires:new Date(0),path:"/"}))},getAll(){return{...r}}}}function Ec(){return{get(e){if(typeof document>"u")return;return O(document.cookie)[e]},set(e,t,a={}){if(typeof document>"u")return;document.cookie=S(e,t,a)},delete(e){if(typeof document>"u")return;document.cookie=S(e,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return O(document.cookie)}}}function Tc(){let e=typeof window<"u"&&typeof window.localStorage<"u";return{get(t){if(!e)return null;try{return window.localStorage.getItem(t)}catch{return null}},set(t,a){if(!e)return;try{window.localStorage.setItem(t,a)}catch{}},remove(t){if(!e)return;try{window.localStorage.removeItem(t)}catch{}},isAvailable(){return e}}}var v=new Map;function ii(e,t){v.set(e,t)}function $c(e){return v.get(e)}function Zf(e){return v.has(e)}function _t(){v.clear()}function Ct(){return Array.from(v.keys())}async function Et(e,t="middleware"){let a=q.resolve(e,t);if(!F.existsSync(a))return;let r=F.readdirSync(a);for(let n of r){if(!n.endsWith(".ts")&&!n.endsWith(".js"))continue;if(n.includes(".test.")||n.includes(".spec."))continue;let o=n.replace(/\.(ts|js)$/,""),i=q.join(a,n);try{let s=(await import(i)).default;if(s&&typeof s.handler==="function")ii(o,s);else if(typeof s==="function")ii(o,{handler:s,mode:"universal"})}catch(c){console.warn(`Failed to load middleware '${o}' from ${i}:`,c)}}}function K(e){let t={};if(!e)return t;let a=new URLSearchParams(e);for(let[r,n]of a)t[r]=n;return t}function Tt(e,t,a,r=""){return{path:e,params:t,query:K(r),fullPath:r?`${e}?${r}`:e,meta:a}}function $t(e,t,a,r){let n=r?.isServer??typeof window>"u",o=!n,i=new Headers;return{to:e,from:t,isClient:o,isServer:n,cookies:n&&a?Cc(a,i):Ec(),storage:Tc(),state:{},request:a,responseHeaders:i}}async function Rt(e,t){let a=Array.isArray(e)?e:[e],r=t.isServer;for(let n of a){let o=$c(n);if(!o)return console.error(`Route middleware '${n}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${n}' is not registered`}},state:t.state,responseHeaders:t.responseHeaders};if(o.mode==="server"&&!r)continue;try{let i=await o.handler(t);if(i){if(i.type==="redirect")return{passed:!1,redirect:i,state:t.state,responseHeaders:t.responseHeaders};if(i.type==="abort")return{passed:!1,abort:i,state:t.state,responseHeaders:t.responseHeaders}}}catch(i){return console.error(`Error in middleware '${n}':`,i),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:i instanceof Error?i.message:"Middleware error"}},state:t.state,responseHeaders:t.responseHeaders}}}return{passed:!0,state:t.state,responseHeaders:t.responseHeaders}}function Ps(e){let a=e.replace(/\\/g,"/").split("/").filter(Boolean),r=a.lastIndexOf("layouts"),n=r>=0?a[r+1]:a.at(-1);if(!n)return"app";return n.replace(/\.stx$/i,"")||"app"}function tt(e){let t=e.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),a=e.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),r=e.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),n=t?.[1]||r?.[1]||"";return{layout:n,group:a?.[1]||Ps(n)}}var A,T;function W(e){let t=[],a="log(",r=0;while(r<e.length){let n=e.indexOf("log(",r);if(n===-1){t.push(e.slice(r));break}let o=n>0?e[n-1]:" ",i=/\bfunction\s+$/.test(e.slice(Math.max(0,n-16),n));if(/[\w$.]/.test(o)||i){t.push(e.slice(r,n+4)),r=n+4;continue}t.push(e.slice(r,n));let c=1,s=n+4;while(s<e.length&&c>0){let l=e[s];if(l==='"'||l==="'"||l==="`"){let d=l;s++;while(s<e.length&&e[s]!==d){if(e[s]==="\\")s++;s++}s++;continue}if(l==="(")c++;else if(l===")")c--;s++}t.push("0"),r=s}return t.join("")}function U(e,t=!1){try{return new Bun.Transpiler(t?{loader:"js",minify:{whitespace:!0,identifiers:!0}}:{loader:"js",minifyWhitespace:!0}).transformSync(e).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return e}}function H(){return`
|
|
5
5
|
;(function(){
|
|
6
6
|
'use strict';
|
|
7
7
|
var ROUTER_REV=8;
|
|
@@ -4095,4 +4095,4 @@ else {
|
|
|
4095
4095
|
|
|
4096
4096
|
if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);else init();
|
|
4097
4097
|
})();
|
|
4098
|
-
`}function nt(){if(A)return A;return A=U(W(H()),!0),A}function Qf(){if(T)return T;return T=U(H()),T}export{
|
|
4098
|
+
`}function nt(){if(A)return A;return A=U(W(H()),!0),A}function Qf(){if(T)return T;return T=U(H()),T}export{si,oi,kt,de,fr,$s,gr,Rs,As,Wf,qf,Kf,mr,Xf,Gf,Jf,Yf,Cc,Ec,Tc,ii,$c,Zf,_t,Ct,Et,Tt,$t,Rt,Ps,tt,nt,Qf};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Br,Fr,Vg,Ug,Wg,qg,Kg}from"./chunk-vfxkn1pe.js";export{Br as collectMessageCatalogs,Ug as loadPageMessages,Wg as messageAreasIn,qg as pageLanguages,Vg as pageMessagesEnabled,Kg as pageMessagesScript,Fr as pathSpellings};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import a from"fs";function ht(r){return o(r)}var g=1000,i=new Map;function
|
|
2
|
+
import a from"fs";function ht(r){return o(r)}var g=1000,i=new Map;function Vn(){i.clear()}function o(r){return[...r].sort().map((n)=>{try{let t=a.statSync(n);return`${n}:${t.size}:${t.mtimeMs}`}catch{return`${n}:missing`}}).join(`
|
|
3
3
|
`)}function Jt(r,n,t){let e=r.get(n);return e!==void 0&&e.signature===t?e.value:void 0}function le(r,n,t,e){return r.set(n,{signature:t,value:e}),e}
|
|
4
|
-
export{ht,
|
|
4
|
+
export{ht,Vn,Jt,le};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{u,f,sl,d,t,l}from"./chunk-c9mdvpf5.js";import{Qe,xt,un,Xo}from"./chunk-qadce16v.js";function L(w,e){try{let p=w.trim();if(f(p))return d(p,Object.keys(e))(...Object.values(e));else return u(p,e)}catch{return!1}}function Q(w,e,p){let n=w,v=!0;while(v){v=!1;let g=n.match(/@switch\s*\(/);if(!g||g.index===void 0)break;let b=g.index,s=Xo(n,b);if(!s)break;try{let o;if(f(s.expression))o=d(s.expression,Object.keys(e))(...Object.values(e));else o=u(s.expression,e);let r="",a=!1;for(let i of s.cases)if(i.type==="default"){if(!a)r=i.content.trim()}else try{let y;if(i.value&&f(i.value))y=d(i.value,Object.keys(e))(...Object.values(e));else if(i.value)y=u(i.value,e);if(o===y){r=i.content.trim(),a=!0;break}}catch{continue}n=n.substring(0,b)+r+n.substring(s.end),v=!0}catch(o){let r=o instanceof Error?o.message:String(o),a=l("Switch",`Error evaluating @switch expression: ${r}`,t.EVALUATION_ERROR);n=n.substring(0,b)+a+n.substring(s.end);break}}return n}function H(w){let e=[];return{masked:w.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(n)=>(e.push(n),`\x00stx-script-${e.length-1}\x00`)),scripts:e}}function J(w,e){if(e.length===0)return w;return w.replace(/\u0000stx-script-(\d+)\u0000/g,(p,n)=>e[Number(n)]??p)}function oe(w,e,p){let{masked:n,scripts:v}=H(w);return J(K(n,e,p),v)}function K(w,e,p){let n=w;n=Q(n,e,p);{let g=!0;while(g){g=!1;let b=n.match(/@unless\s*\(/);if(!b||b.index===void 0)break;let s=b.index,o=Qe(n,s+7);if(!o)break;let r=o.endPos,a=xt(n,"unless","endunless",r);if(a===-1){console.warn(`[stx] @unless directive at position ${s} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let i=n.slice(r,a),y=o.expression,m=-1;{let x=0,k=/@(?:if|unless)\s*\(/g,h=/@(?:endif|endunless)(?![a-z])/g,E=/@else(?![a-z])/g,S=[],C;while((C=k.exec(i))!==null)S.push({pos:C.index,type:"open"});while((C=h.exec(i))!==null)S.push({pos:C.index,type:"close"});while((C=E.exec(i))!==null)S.push({pos:C.index,type:"else"});S.sort((P,R)=>P.pos-R.pos);for(let P of S)if(P.type==="open")x++;else if(P.type==="close")x--;else if(P.type==="else"&&x===0){m=P.pos;break}}let c;if(m!==-1){let x=i.slice(0,m),k=i.slice(m+5);c=`@if (${y})${k}@else ${x}@endif`}else c=`@if (!(${y}))${i}@endif`;n=n.substring(0,s)+c+n.substring(a+10),g=!0}}n=Ho(n,e,p),n=Vo(n,e,p),n=zo(n,e);let v=()=>{let g=un(n);if(g.length===0)return!1;let b=Array(g.length);for(let r=g.length-1;r>=0;r--){let a=g[r];try{let i="",y=!1;for(let m of a.branches){if(y)break;if(m.type==="else")i=m.content,y=!0;else try{if(m.condition?sl(m.condition,e):!1)i=m.content,y=!0}catch(c){i=l(m.type==="if"?"If":"Elseif",`Error in @${m.type}(${m.condition}): ${c instanceof Error?c.message:String(c)}`,t.EVALUATION_ERROR),y=!0}}b[r]=i}catch(i){let y=i instanceof Error?i.message:String(i);b[r]=l("If",`Error processing @if block: ${y}`,t.EVALUATION_ERROR)}}let s=Array(g.length*2+1),o=0;for(let r=0;r<g.length;r++){let a=g[r];s[r*2]=n.slice(o,a.start),s[r*2+1]=b[r],o=a.end}return s[g.length*2]=n.slice(o),n=s.join(""),!0};while(!0){let g=n;if(!v())break;if(n===g)break}return n}function q(w){let e=0;while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!=="(")return null;e++;while(e<w.length&&/\s/.test(w[e]))e++;let p=w[e];if(p!=="'"&&p!=='"')return null;e++;let n=[];while(e<w.length){let v=w[e];if(v==="\\"&&e+1<w.length){n.push(w[e+1]),e+=2;continue}if(v===p){e++;break}n.push(v),e++}while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!==")")return null;return e++,{value:n.join(""),consumed:e}}function zo(w,e){let p=w;function n(s,o,r,a){let i=1,y=a,m=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),c=new RegExp(`@${r}(?![a-z])`,"g");while(y<s.length&&i>0){m.lastIndex=y,c.lastIndex=y;let x=m.exec(s),k=c.exec(s),h=x?x.index:1/0,E=k?k.index:1/0;if(h<E)i++,y=h+x[0].length;else if(E<1/0){if(i--,i===0)return E;y=E+k[0].length}else break}return-1}function v(s,o,r){let a=0,i=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),y=new RegExp(`@${r}(?![a-z])`,"g"),m=/@else(?![a-z])/g,c=[],x;while((x=i.exec(s))!==null)c.push({pos:x.index,type:"open"});while((x=y.exec(s))!==null)c.push({pos:x.index,type:"close"});while((x=m.exec(s))!==null)c.push({pos:x.index,type:"else"});c.sort((k,h)=>k.pos-h.pos);for(let k of c)if(k.type==="open")a++;else if(k.type==="close")a--;else if(k.type==="else"&&a===0)return k.pos;return-1}{let s=!0;while(s){s=!1;let o=p.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,a,i,y=p.slice(r+5),m=q(y);if(m)a=m.value,i=r+5+m.consumed;else i=r+5;let c=n(p,"auth","endauth",i);if(c===-1){console.warn(`[stx] @auth directive at position ${r} has no matching @endauth \u2014 the block was skipped.`);break}let x=p.slice(i,c),k=v(x,"auth","endauth"),h;if(!e.auth)h=!1;else h=a?L(`auth?.check && auth?.user?.[${a}]`,e):L("auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=h?S:C}else E=h?x:"";p=p.substring(0,r)+E+p.substring(c+8),s=!0}}{let s=!0;while(s){s=!1;let o=p.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,a,i,y=p.slice(r+6),m=q(y);if(m)a=m.value,i=r+6+m.consumed;else i=r+6;let c=n(p,"guest","endguest",i);if(c===-1){console.warn(`[stx] @guest directive at position ${r} has no matching @endguest \u2014 the block was skipped.`);break}let x=p.slice(i,c),k=v(x,"guest","endguest"),h;if(!e.auth)h=!0;else h=a?L(`!auth?.check || !auth?.user?.[${a}]`,e):L("!auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=h?S:C}else E=h?x:"";p=p.substring(0,r)+E+p.substring(c+9),s=!0}}function g(s,o,r){if(e.userCan&&typeof e.userCan[s]==="boolean")return e.userCan[s];if(e.permissions?.check&&typeof e.permissions.check==="function")try{let a=[s];if(o)a.push(o);if(r){let i=L(r,e);a.push(i)}return e.permissions.check(...a)}catch{return!1}return!1}function b(s){let o=s.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!o)return null;return{ability:o[1],type:o[2],id:o[3]?.trim(),paramsEnd:o[0].length}}for(let s of["can","cannot"]){let o=`end${s}`,r=s==="can"?"elsecan":"elsecannot",a=!0;while(a){a=!1;let i=p.match(new RegExp(`@${s}\\s*\\(`));if(!i||i.index===void 0)break;let y=i.index,m=p.slice(y+`@${s}`.length),c=b(m);if(!c)break;let x=y+`@${s}`.length+c.paramsEnd,k=n(p,s,o,x);if(k===-1){console.warn(`[stx] @${s} directive at position ${y} has no matching @${o} \u2014 the block was skipped.`);break}let h=p.slice(x,k),E=[],S=0,C=new RegExp(`@${s}\\s*\\(`,"g"),P=new RegExp(`@${o}(?![a-z])`,"g"),R=new RegExp(`@${r}\\s*\\(`,"g"),T=/@else(?![a-z])/g,_=[],M;while((M=C.exec(h))!==null)_.push({pos:M.index,type:"open"});while((M=P.exec(h))!==null)_.push({pos:M.index,type:"close"});while((M=R.exec(h))!==null)_.push({pos:M.index,type:"elseDirective"});while((M=T.exec(h))!==null)_.push({pos:M.index,type:"else"});_.sort((A,z)=>A.pos-z.pos);for(let A of _){if(A.type==="open"){S++;continue}if(A.type==="close"){S--;continue}if(S===0)E.push(A)}let I=[],F=0;for(let A=0;A<E.length;A++){let z=E[A];if(I.push({content:h.slice(F,z.pos),ability:void 0}),z.type==="elseDirective"){let D=h.slice(z.pos+`@${r}`.length),B=b(D);if(B){I[I.length-1]={content:h.slice(F,z.pos)},F=z.pos+`@${r}`.length+B.paramsEnd,I.push({content:"",ability:B.ability,type:B.type,id:B.id}),I.pop();let G=E[A+1],U=G?G.pos:h.length;I.push({content:h.slice(F,U),ability:B.ability,type:B.type,id:B.id}),F=U}}else F=z.pos+5}if(F<h.length){let A=I[I.length-1];if(E.length>0&&E[E.length-1].type==="else")I.push({content:h.slice(F),isFinalElse:!0});else if(I.length===0)I.push({content:h.slice(F)})}let O=g(c.ability,c.type,c.id),j=s==="can"?O:!O,V="";if(j)V=I[0]?.content||"";else{let A=!1;for(let z=1;z<I.length;z++){let D=I[z];if(D.isFinalElse){V=D.content,A=!0;break}if(D.ability){let B=g(D.ability,D.type,D.id);if(s==="can"?B:!B){V=D.content,A=!0;break}}}if(!A&&I.length>0){let z=I[I.length-1];if(z.isFinalElse)V=z.content}}p=p.substring(0,y)+V+p.substring(k+`@${o}`.length),a=!0}}return p}function Ho(w,e,p){let n=w;function v(g,b,s,o,r){let a=!0;while(a){a=!1;let i=new RegExp(`@${b}\\s*\\(`),y=g.match(i);if(!y||y.index===void 0)break;let m=y.index,c=Qe(g,m+`@${b}`.length);if(!c)break;let x=c.endPos,k=xt(g,b,s,x);if(k===-1){console.warn(`[stx] @${b} directive at position ${m} has no matching @${s} \u2014 the block was skipped.`);break}let h=g.slice(x,k),E=c.expression,S=-1,C=0,P=0;while(P<h.length){let R=h.indexOf("@",P);if(R===-1)break;let T=h.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(T)){C++,P=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(T)){C--,P=R+1;continue}if(C===0&&/^@else(?![a-z])/.test(T)){S=R;break}P=R+1}try{let R=o(E.trim()),T;if(S!==-1){let _=h.slice(0,S),M=h.slice(S+5);T=R?_:M}else T=R?h:"";g=g.substring(0,m)+T+g.substring(k+`@${s}`.length),a=!0}catch(R){let T=R instanceof Error?R.message:String(R),_=l(r,`Error processing @${b} directive: ${T}`,t.EVALUATION_ERROR);g=g.substring(0,m)+_+g.substring(k+`@${s}`.length);break}}return g}return n=v(n,"isset","endisset",(g)=>{let b=L(g,e);return b!==void 0&&b!==null},"Isset"),n=v(n,"empty","endempty",(g)=>{let b=L(g,e);return b===void 0||b===null||b===""||b===0||b===!1||Array.isArray(b)&&b.length===0||typeof b==="object"&&b!==null&&Object.keys(b).length===0},"Empty"),n}function Vo(w,e,p){let n=w,v="development";function g(b,s,o,r){let a=new RegExp(`@${s}(?![a-z])`,"g"),i=new RegExp(`@${o}(?![a-z])`,"g"),y=new RegExp(`^@${s}(?![a-z])`),m=new RegExp(`^@${o}(?![a-z])`),c=b,x=!0;while(x){x=!1,a.lastIndex=0;let k=a.exec(c);if(!k)break;let h=k.index,E=h+k[0].length;if(s==="env"){let O=c.substring(E).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!O)break;E+=O[0].length,r=v===O[2]}let S=1,C=E,P=-1;while(S>0&&C<c.length){a.lastIndex=C,i.lastIndex=C;let O=a.exec(c),j=i.exec(c),V=O?O.index:1/0,A=j?j.index:1/0;if(V<A)S++,C=V+O[0].length;else if(A<1/0){if(S--,S===0){P=A;break}C=A+j[0].length}else break}if(P===-1){console.warn(`[stx] @${s} directive at position ${h} has no matching @${o} \u2014 the block was skipped.`);break}let R=c.substring(E,P),T=-1,_=0,M=0;while(M<R.length){let O=R.indexOf("@",M);if(O===-1)break;let j=R.substring(O);if(y.test(j)){_++,M=O+1;continue}if(m.test(j)){_--,M=O+1;continue}if(_===0&&/^@else(?![a-z])/.test(j)){T=O;break}M=O+1}let I;if(T!==-1){let O=R.slice(0,T),j=R.slice(T+5);I=r?O:j}else I=r?R:"";let F=`@${o}`.length;c=c.substring(0,h)+I+c.substring(P+F),x=!0}return c}return n=g(n,"env","endenv",!1),n=g(n,"production","endproduction",v==="production"),n=g(n,"development","enddevelopment",v==="development"),n=g(n,"staging","endstaging",v==="staging"),n=g(n,"testing","endtesting",v==="testing"),n}
|
|
3
|
-
export{oe,
|
|
2
|
+
import{u,f,sl,d,t,l}from"./chunk-txd2js5v.js";import{Qe,xt,un,Go}from"./chunk-ya6bp08c.js";function L(w,e){try{let p=w.trim();if(f(p))return d(p,Object.keys(e))(...Object.values(e));else return u(p,e)}catch{return!1}}function Q(w,e,p){let n=w,v=!0;while(v){v=!1;let g=n.match(/@switch\s*\(/);if(!g||g.index===void 0)break;let b=g.index,s=Go(n,b);if(!s)break;try{let o;if(f(s.expression))o=d(s.expression,Object.keys(e))(...Object.values(e));else o=u(s.expression,e);let r="",a=!1;for(let i of s.cases)if(i.type==="default"){if(!a)r=i.content.trim()}else try{let y;if(i.value&&f(i.value))y=d(i.value,Object.keys(e))(...Object.values(e));else if(i.value)y=u(i.value,e);if(o===y){r=i.content.trim(),a=!0;break}}catch{continue}n=n.substring(0,b)+r+n.substring(s.end),v=!0}catch(o){let r=o instanceof Error?o.message:String(o),a=l("Switch",`Error evaluating @switch expression: ${r}`,t.EVALUATION_ERROR);n=n.substring(0,b)+a+n.substring(s.end);break}}return n}function H(w){let e=[];return{masked:w.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(n)=>(e.push(n),`\x00stx-script-${e.length-1}\x00`)),scripts:e}}function J(w,e){if(e.length===0)return w;return w.replace(/\u0000stx-script-(\d+)\u0000/g,(p,n)=>e[Number(n)]??p)}function oe(w,e,p){let{masked:n,scripts:v}=H(w);return J(K(n,e,p),v)}function K(w,e,p){let n=w;n=Q(n,e,p);{let g=!0;while(g){g=!1;let b=n.match(/@unless\s*\(/);if(!b||b.index===void 0)break;let s=b.index,o=Qe(n,s+7);if(!o)break;let r=o.endPos,a=xt(n,"unless","endunless",r);if(a===-1){console.warn(`[stx] @unless directive at position ${s} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let i=n.slice(r,a),y=o.expression,m=-1;{let x=0,k=/@(?:if|unless)\s*\(/g,h=/@(?:endif|endunless)(?![a-z])/g,E=/@else(?![a-z])/g,S=[],C;while((C=k.exec(i))!==null)S.push({pos:C.index,type:"open"});while((C=h.exec(i))!==null)S.push({pos:C.index,type:"close"});while((C=E.exec(i))!==null)S.push({pos:C.index,type:"else"});S.sort((P,R)=>P.pos-R.pos);for(let P of S)if(P.type==="open")x++;else if(P.type==="close")x--;else if(P.type==="else"&&x===0){m=P.pos;break}}let c;if(m!==-1){let x=i.slice(0,m),k=i.slice(m+5);c=`@if (${y})${k}@else ${x}@endif`}else c=`@if (!(${y}))${i}@endif`;n=n.substring(0,s)+c+n.substring(a+10),g=!0}}n=Vo(n,e,p),n=Uo(n,e,p),n=Ho(n,e);let v=()=>{let g=un(n);if(g.length===0)return!1;let b=Array(g.length);for(let r=g.length-1;r>=0;r--){let a=g[r];try{let i="",y=!1;for(let m of a.branches){if(y)break;if(m.type==="else")i=m.content,y=!0;else try{if(m.condition?sl(m.condition,e):!1)i=m.content,y=!0}catch(c){i=l(m.type==="if"?"If":"Elseif",`Error in @${m.type}(${m.condition}): ${c instanceof Error?c.message:String(c)}`,t.EVALUATION_ERROR),y=!0}}b[r]=i}catch(i){let y=i instanceof Error?i.message:String(i);b[r]=l("If",`Error processing @if block: ${y}`,t.EVALUATION_ERROR)}}let s=Array(g.length*2+1),o=0;for(let r=0;r<g.length;r++){let a=g[r];s[r*2]=n.slice(o,a.start),s[r*2+1]=b[r],o=a.end}return s[g.length*2]=n.slice(o),n=s.join(""),!0};while(!0){let g=n;if(!v())break;if(n===g)break}return n}function q(w){let e=0;while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!=="(")return null;e++;while(e<w.length&&/\s/.test(w[e]))e++;let p=w[e];if(p!=="'"&&p!=='"')return null;e++;let n=[];while(e<w.length){let v=w[e];if(v==="\\"&&e+1<w.length){n.push(w[e+1]),e+=2;continue}if(v===p){e++;break}n.push(v),e++}while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!==")")return null;return e++,{value:n.join(""),consumed:e}}function Ho(w,e){let p=w;function n(s,o,r,a){let i=1,y=a,m=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),c=new RegExp(`@${r}(?![a-z])`,"g");while(y<s.length&&i>0){m.lastIndex=y,c.lastIndex=y;let x=m.exec(s),k=c.exec(s),h=x?x.index:1/0,E=k?k.index:1/0;if(h<E)i++,y=h+x[0].length;else if(E<1/0){if(i--,i===0)return E;y=E+k[0].length}else break}return-1}function v(s,o,r){let a=0,i=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),y=new RegExp(`@${r}(?![a-z])`,"g"),m=/@else(?![a-z])/g,c=[],x;while((x=i.exec(s))!==null)c.push({pos:x.index,type:"open"});while((x=y.exec(s))!==null)c.push({pos:x.index,type:"close"});while((x=m.exec(s))!==null)c.push({pos:x.index,type:"else"});c.sort((k,h)=>k.pos-h.pos);for(let k of c)if(k.type==="open")a++;else if(k.type==="close")a--;else if(k.type==="else"&&a===0)return k.pos;return-1}{let s=!0;while(s){s=!1;let o=p.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,a,i,y=p.slice(r+5),m=q(y);if(m)a=m.value,i=r+5+m.consumed;else i=r+5;let c=n(p,"auth","endauth",i);if(c===-1){console.warn(`[stx] @auth directive at position ${r} has no matching @endauth \u2014 the block was skipped.`);break}let x=p.slice(i,c),k=v(x,"auth","endauth"),h;if(!e.auth)h=!1;else h=a?L(`auth?.check && auth?.user?.[${a}]`,e):L("auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=h?S:C}else E=h?x:"";p=p.substring(0,r)+E+p.substring(c+8),s=!0}}{let s=!0;while(s){s=!1;let o=p.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,a,i,y=p.slice(r+6),m=q(y);if(m)a=m.value,i=r+6+m.consumed;else i=r+6;let c=n(p,"guest","endguest",i);if(c===-1){console.warn(`[stx] @guest directive at position ${r} has no matching @endguest \u2014 the block was skipped.`);break}let x=p.slice(i,c),k=v(x,"guest","endguest"),h;if(!e.auth)h=!0;else h=a?L(`!auth?.check || !auth?.user?.[${a}]`,e):L("!auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=h?S:C}else E=h?x:"";p=p.substring(0,r)+E+p.substring(c+9),s=!0}}function g(s,o,r){if(e.userCan&&typeof e.userCan[s]==="boolean")return e.userCan[s];if(e.permissions?.check&&typeof e.permissions.check==="function")try{let a=[s];if(o)a.push(o);if(r){let i=L(r,e);a.push(i)}return e.permissions.check(...a)}catch{return!1}return!1}function b(s){let o=s.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!o)return null;return{ability:o[1],type:o[2],id:o[3]?.trim(),paramsEnd:o[0].length}}for(let s of["can","cannot"]){let o=`end${s}`,r=s==="can"?"elsecan":"elsecannot",a=!0;while(a){a=!1;let i=p.match(new RegExp(`@${s}\\s*\\(`));if(!i||i.index===void 0)break;let y=i.index,m=p.slice(y+`@${s}`.length),c=b(m);if(!c)break;let x=y+`@${s}`.length+c.paramsEnd,k=n(p,s,o,x);if(k===-1){console.warn(`[stx] @${s} directive at position ${y} has no matching @${o} \u2014 the block was skipped.`);break}let h=p.slice(x,k),E=[],S=0,C=new RegExp(`@${s}\\s*\\(`,"g"),P=new RegExp(`@${o}(?![a-z])`,"g"),R=new RegExp(`@${r}\\s*\\(`,"g"),T=/@else(?![a-z])/g,_=[],M;while((M=C.exec(h))!==null)_.push({pos:M.index,type:"open"});while((M=P.exec(h))!==null)_.push({pos:M.index,type:"close"});while((M=R.exec(h))!==null)_.push({pos:M.index,type:"elseDirective"});while((M=T.exec(h))!==null)_.push({pos:M.index,type:"else"});_.sort((A,z)=>A.pos-z.pos);for(let A of _){if(A.type==="open"){S++;continue}if(A.type==="close"){S--;continue}if(S===0)E.push(A)}let I=[],F=0;for(let A=0;A<E.length;A++){let z=E[A];if(I.push({content:h.slice(F,z.pos),ability:void 0}),z.type==="elseDirective"){let D=h.slice(z.pos+`@${r}`.length),B=b(D);if(B){I[I.length-1]={content:h.slice(F,z.pos)},F=z.pos+`@${r}`.length+B.paramsEnd,I.push({content:"",ability:B.ability,type:B.type,id:B.id}),I.pop();let G=E[A+1],U=G?G.pos:h.length;I.push({content:h.slice(F,U),ability:B.ability,type:B.type,id:B.id}),F=U}}else F=z.pos+5}if(F<h.length){let A=I[I.length-1];if(E.length>0&&E[E.length-1].type==="else")I.push({content:h.slice(F),isFinalElse:!0});else if(I.length===0)I.push({content:h.slice(F)})}let O=g(c.ability,c.type,c.id),j=s==="can"?O:!O,V="";if(j)V=I[0]?.content||"";else{let A=!1;for(let z=1;z<I.length;z++){let D=I[z];if(D.isFinalElse){V=D.content,A=!0;break}if(D.ability){let B=g(D.ability,D.type,D.id);if(s==="can"?B:!B){V=D.content,A=!0;break}}}if(!A&&I.length>0){let z=I[I.length-1];if(z.isFinalElse)V=z.content}}p=p.substring(0,y)+V+p.substring(k+`@${o}`.length),a=!0}}return p}function Vo(w,e,p){let n=w;function v(g,b,s,o,r){let a=!0;while(a){a=!1;let i=new RegExp(`@${b}\\s*\\(`),y=g.match(i);if(!y||y.index===void 0)break;let m=y.index,c=Qe(g,m+`@${b}`.length);if(!c)break;let x=c.endPos,k=xt(g,b,s,x);if(k===-1){console.warn(`[stx] @${b} directive at position ${m} has no matching @${s} \u2014 the block was skipped.`);break}let h=g.slice(x,k),E=c.expression,S=-1,C=0,P=0;while(P<h.length){let R=h.indexOf("@",P);if(R===-1)break;let T=h.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(T)){C++,P=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(T)){C--,P=R+1;continue}if(C===0&&/^@else(?![a-z])/.test(T)){S=R;break}P=R+1}try{let R=o(E.trim()),T;if(S!==-1){let _=h.slice(0,S),M=h.slice(S+5);T=R?_:M}else T=R?h:"";g=g.substring(0,m)+T+g.substring(k+`@${s}`.length),a=!0}catch(R){let T=R instanceof Error?R.message:String(R),_=l(r,`Error processing @${b} directive: ${T}`,t.EVALUATION_ERROR);g=g.substring(0,m)+_+g.substring(k+`@${s}`.length);break}}return g}return n=v(n,"isset","endisset",(g)=>{let b=L(g,e);return b!==void 0&&b!==null},"Isset"),n=v(n,"empty","endempty",(g)=>{let b=L(g,e);return b===void 0||b===null||b===""||b===0||b===!1||Array.isArray(b)&&b.length===0||typeof b==="object"&&b!==null&&Object.keys(b).length===0},"Empty"),n}function Uo(w,e,p){let n=w,v="development";function g(b,s,o,r){let a=new RegExp(`@${s}(?![a-z])`,"g"),i=new RegExp(`@${o}(?![a-z])`,"g"),y=new RegExp(`^@${s}(?![a-z])`),m=new RegExp(`^@${o}(?![a-z])`),c=b,x=!0;while(x){x=!1,a.lastIndex=0;let k=a.exec(c);if(!k)break;let h=k.index,E=h+k[0].length;if(s==="env"){let O=c.substring(E).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!O)break;E+=O[0].length,r=v===O[2]}let S=1,C=E,P=-1;while(S>0&&C<c.length){a.lastIndex=C,i.lastIndex=C;let O=a.exec(c),j=i.exec(c),V=O?O.index:1/0,A=j?j.index:1/0;if(V<A)S++,C=V+O[0].length;else if(A<1/0){if(S--,S===0){P=A;break}C=A+j[0].length}else break}if(P===-1){console.warn(`[stx] @${s} directive at position ${h} has no matching @${o} \u2014 the block was skipped.`);break}let R=c.substring(E,P),T=-1,_=0,M=0;while(M<R.length){let O=R.indexOf("@",M);if(O===-1)break;let j=R.substring(O);if(y.test(j)){_++,M=O+1;continue}if(m.test(j)){_--,M=O+1;continue}if(_===0&&/^@else(?![a-z])/.test(j)){T=O;break}M=O+1}let I;if(T!==-1){let O=R.slice(0,T),j=R.slice(T+5);I=r?O:j}else I=r?R:"";let F=`@${o}`.length;c=c.substring(0,h)+I+c.substring(P+F),x=!0}return c}return n=g(n,"env","endenv",!1),n=g(n,"production","endproduction",v==="production"),n=g(n,"development","enddevelopment",v==="development"),n=g(n,"staging","endstaging",v==="staging"),n=g(n,"testing","endtesting",v==="testing"),n}
|
|
3
|
+
export{oe,Ho,Vo,Uo};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ih,Nf,Ye,cc,Oh,as,cs,ls}from"./chunk-cddzcckm.js";import"./chunk-npn692c4.js";import"./chunk-0c8fqfan.js";import"./chunk-3bjnrmha.js";import"./chunk-ya6bp08c.js";import"./chunk-qbvy23qa.js";import"./chunk-qdagsy5b.js";import"./chunk-vfj9wp11.js";import"./chunk-txd2js5v.js";import"./chunk-s6r54dyf.js";import"./chunk-4ntm3dtk.js";export{Oh as clearOnceStore,cc as onceStore,Ye as partialsCache,as as processIncludes,cs as processStackPushDirectives,ls as processStackReplacements,Ih as resetUnscopedSignalWarnings,Nf as topLevelElements};
|