@stacksjs/stx 0.2.833 → 0.2.835
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-a395a3dt.js → chunk-02s0hzwa.js} +8 -8
- package/dist/{chunk-vb4xzz5c.js → chunk-0a36jnq4.js} +1 -1
- package/dist/chunk-0nc94zjd.js +2 -0
- package/dist/chunk-0rnfywsx.js +2 -0
- package/dist/chunk-0ygvav3v.js +3 -0
- package/dist/{chunk-qym44qqd.js → chunk-12bwztw2.js} +4 -4
- package/dist/{chunk-4xw22xqd.js → chunk-1pg50kva.js} +6 -6
- package/dist/chunk-1q3gjt3t.js +2 -0
- package/dist/chunk-213skjvq.js +2 -0
- package/dist/{chunk-mxvevxb8.js → chunk-29f6vmyz.js} +4 -4
- package/dist/{chunk-jp6sbk05.js → chunk-2nxxhcyy.js} +1 -1
- package/dist/{chunk-1c62mrad.js → chunk-2xcnynmg.js} +5 -5
- package/dist/{chunk-xdwnbr9b.js → chunk-33czswpt.js} +2 -2
- package/dist/{chunk-r2fwxtke.js → chunk-35vsv68x.js} +1 -1
- package/dist/{chunk-ekh3mxyp.js → chunk-3bjnrmha.js} +2 -2
- package/dist/{chunk-1b1crd5a.js → chunk-3fk1cm0n.js} +4 -4
- package/dist/{chunk-tchz2m2v.js → chunk-3s70qc9v.js} +1 -1
- package/dist/{chunk-04z1xyrb.js → chunk-4ntm3dtk.js} +2 -2
- package/dist/{chunk-mypygxdm.js → chunk-52g026sc.js} +2 -2
- package/dist/{chunk-716jrdcg.js → chunk-52t0qpx6.js} +1 -1
- package/dist/{chunk-w7m9pecb.js → chunk-53gp3w46.js} +5 -5
- package/dist/{chunk-4a3r1kh1.js → chunk-55e46spy.js} +2 -2
- package/dist/{chunk-kn3pknzt.js → chunk-5n988caw.js} +3 -3
- package/dist/{chunk-xdqv5yq4.js → chunk-6eqjf0r6.js} +2 -2
- package/dist/{chunk-6kk8p766.js → chunk-6vx101bj.js} +1 -1
- package/dist/{chunk-yrw5ensv.js → chunk-7bvvv74e.js} +2 -2
- package/dist/chunk-7chq9qj0.js +2 -0
- package/dist/chunk-7efkc3gk.js +2 -0
- package/dist/chunk-7phzt95j.js +2 -0
- package/dist/{chunk-g00nhj1d.js → chunk-7v372ds3.js} +7 -7
- package/dist/chunk-7ygadxrq.js +2 -0
- package/dist/{chunk-5201w0f1.js → chunk-84nw3921.js} +3 -3
- package/dist/{chunk-qws72sn9.js → chunk-88b319bz.js} +32 -32
- package/dist/{chunk-g0vz0ch5.js → chunk-8f49t8wb.js} +7 -7
- package/dist/chunk-8tm6701m.js +2 -0
- package/dist/{chunk-gy59sm92.js → chunk-9cy3fy0k.js} +2 -2
- package/dist/chunk-9fk98kja.js +2 -0
- package/dist/chunk-9q378vgc.js +2 -0
- package/dist/{chunk-c6gr71fg.js → chunk-9q3pqtx8.js} +1 -1
- package/dist/chunk-9w3r1ch2.js +3 -0
- package/dist/{chunk-38wq4ttd.js → chunk-a1fp1nyf.js} +95 -95
- 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-anckn6bc.js +42 -0
- package/dist/{chunk-67nq6csk.js → chunk-bc4x45vx.js} +1 -1
- package/dist/{chunk-3p7r3ajd.js → chunk-bky02g7k.js} +2 -2
- package/dist/chunk-bsm5ds0r.js +2 -0
- package/dist/{chunk-hd378dgy.js → chunk-c3dg8qdn.js} +2 -2
- package/dist/chunk-c7hw37ww.js +2 -0
- package/dist/{chunk-cca18z35.js → chunk-c9vxm8yq.js} +8 -8
- package/dist/{chunk-gcf97wgx.js → chunk-dv11h4f0.js} +1 -1
- package/dist/{chunk-6b1g5a6a.js → chunk-e3pkgwd8.js} +11 -11
- package/dist/chunk-f6vzn90z.js +2 -0
- package/dist/chunk-fcy7n409.js +2 -0
- package/dist/{chunk-wr7bmkne.js → chunk-fvgk1w9s.js} +2 -2
- package/dist/chunk-g40zerct.js +2 -0
- package/dist/{chunk-cv1zc9dg.js → chunk-gh62p9mx.js} +2 -2
- package/dist/chunk-gtj8wy95.js +2 -0
- package/dist/{chunk-3grrmmrg.js → chunk-gy3pegf9.js} +1 -1
- package/dist/{chunk-wb6w807m.js → chunk-h4tbpr7p.js} +1 -1
- package/dist/{chunk-s67pnfvz.js → chunk-h6w7jr4b.js} +4 -4
- package/dist/{chunk-a7j451hn.js → chunk-h8pp1dsq.js} +2 -2
- package/dist/chunk-hhh6v5cw.js +2 -0
- package/dist/chunk-hzs22cc9.js +2 -0
- package/dist/chunk-j0w048sj.js +2 -0
- package/dist/chunk-j6146c13.js +2 -0
- package/dist/{chunk-t59bc7na.js → chunk-jr0r5pzw.js} +2 -2
- package/dist/{chunk-fby81k5g.js → chunk-k23nn7k9.js} +2 -2
- package/dist/chunk-k5jmnt0z.js +2 -0
- package/dist/chunk-k761q7s7.js +2 -0
- package/dist/{chunk-1vzncfka.js → chunk-kw5gra2z.js} +2 -2
- package/dist/chunk-mdtysd2d.js +2 -0
- package/dist/{chunk-hfktzsat.js → chunk-mejtwsgy.js} +1 -1
- package/dist/chunk-mmm5t7jf.js +2 -0
- package/dist/chunk-mr97dmgb.js +2 -0
- package/dist/{chunk-rkdsgfhd.js → chunk-ms3v5nat.js} +6 -6
- package/dist/{chunk-95d5qy7d.js → chunk-mvk7rm5q.js} +2 -2
- package/dist/{chunk-f6b7av6b.js → chunk-n4qznmkm.js} +5 -5
- package/dist/{chunk-6qbatp72.js → chunk-n82sms5e.js} +5 -5
- package/dist/{chunk-a9d14beh.js → chunk-nbz025jk.js} +1 -1
- package/dist/{chunk-m9bbhg46.js → chunk-nmtya57z.js} +2 -2
- package/dist/{chunk-02zvytqx.js → chunk-nxfyjw59.js} +1 -1
- package/dist/{chunk-xn9jg1q5.js → chunk-nyg0nbjj.js} +1 -1
- package/dist/{chunk-7nnep25t.js → chunk-pq6x35gz.js} +5 -5
- package/dist/chunk-pwv77cyb.js +2 -0
- package/dist/{chunk-dzm9g76x.js → chunk-pzavparv.js} +1 -1
- package/dist/{chunk-bgqbvf1w.js → chunk-q4h6mhn1.js} +6 -6
- package/dist/chunk-rkk2mb0h.js +2 -0
- package/dist/{chunk-wvds0s9m.js → chunk-rnm8ejpz.js} +2 -2
- package/dist/chunk-rsg4zdt3.js +2 -0
- 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-vhehb6eh.js → chunk-sstbhctt.js} +1 -1
- package/dist/chunk-t612xpa4.js +2 -0
- package/dist/{chunk-g4qzy5hv.js → chunk-tesbhpbp.js} +1 -1
- package/dist/chunk-tj90sfcs.js +2 -0
- 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-qnrgfm9v.js → chunk-v3xyb3ws.js} +2 -2
- package/dist/chunk-vbwtx73e.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-cfqz4bd6.js → chunk-vmj0hqzc.js} +1 -1
- package/dist/chunk-vqpypnys.js +2 -0
- package/dist/{chunk-qy6dtm1a.js → chunk-w0a6yz73.js} +8 -8
- package/dist/{chunk-ba499a3p.js → chunk-w5g788r7.js} +1 -1
- package/dist/{chunk-3sqay5jm.js → chunk-waz6g84g.js} +3 -3
- package/dist/{chunk-yd1j88kp.js → chunk-wpy1ytv9.js} +6 -6
- package/dist/{chunk-m6q2vedz.js → chunk-ws9ypnvs.js} +4 -4
- package/dist/chunk-wz24zyt1.js +2 -0
- package/dist/chunk-x4x1xj40.js +2 -0
- package/dist/{chunk-z58dr234.js → chunk-x6ck5s29.js} +1 -1
- package/dist/chunk-x7bbbmgd.js +2 -0
- package/dist/{chunk-6tjm38e4.js → chunk-xtqapjz3.js} +1 -1
- 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-y34ayg61.js → chunk-zr4e0jrh.js} +42 -40
- package/dist/cli.js +13 -13
- package/dist/client/signals-class-runtime.js +1 -1
- package/dist/client/signals-native-row-runtime.js +3 -3
- 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
|
@@ -2,7 +2,6 @@ import fs from "node:fs";
|
|
|
2
2
|
import os from "node:os";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
|
-
import { Worker as ThreadWorker } from "node:worker_threads";
|
|
6
5
|
export const WORKER_UNAVAILABLE = Symbol("stx.image-worker.unavailable");
|
|
7
6
|
export function imageWorkerSlots(cores = typeof os.availableParallelism === "function" ? os.availableParallelism() : os.cpus().length) {
|
|
8
7
|
return Math.max(1, Math.min(2, cores - 1));
|
|
@@ -60,6 +59,12 @@ function messageOf(error) {
|
|
|
60
59
|
return error instanceof Error ? error.message : String(error);
|
|
61
60
|
}
|
|
62
61
|
export async function runImageTask(task, args) {
|
|
62
|
+
let ThreadWorker;
|
|
63
|
+
try {
|
|
64
|
+
ThreadWorker = (await import("node:worker_threads")).Worker;
|
|
65
|
+
} catch (error) {
|
|
66
|
+
return unavailable(`could not load node:worker_threads: ${messageOf(error)}`);
|
|
67
|
+
}
|
|
63
68
|
if (typeof ThreadWorker !== "function")
|
|
64
69
|
return unavailable("node:worker_threads has no Worker in this runtime");
|
|
65
70
|
const entry = imageWorkerEntry();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{t,l}from"./chunk-
|
|
2
|
+
import{t,l}from"./chunk-txd2js5v.js";import{s,vn,h}from"./chunk-a1fp1nyf.js";import{nt}from"./chunk-29f6vmyz.js";import{Cs,Es}from"./chunk-ms3v5nat.js";import{kc,Qo,ks,_s}from"./chunk-amg6kr1p.js";import{vc,xc}from"./chunk-h8pp1dsq.js";import{St}from"./chunk-b1q40vq4.js";import{dn,Rc,hr,yr}from"./chunk-9w3r1ch2.js";import{g}from"./chunk-0dve54ne.js";import{no}from"./chunk-52g026sc.js";import Q from"fs";import j from"path";import{loadConfigWithResult as Bt}from"bunfig";var B={duration:300,delay:0,ease:"ease",direction:"both"};function it(e,r={}){let{duration:i,delay:o,ease:n,direction:c,custom:d}={...B,...r};if(e==="custom"&&d)return d;switch(e){case"fade":return`${c==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":c==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
|
|
3
3
|
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
|
|
4
4
|
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }`;case"slide":return`${c==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":c==="out"?"transform: translateY(0); opacity: 1; animation: slideOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: translateY(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
|
|
5
5
|
@keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
|
|
@@ -619,7 +619,7 @@ else {
|
|
|
619
619
|
};
|
|
620
620
|
})();
|
|
621
621
|
</script>
|
|
622
|
-
`}function mc(e,r){let i=Oe(r);if(!i)return e;let o=e.lastIndexOf("</body>");if(o!==-1)return e.slice(0,o)+i+e.slice(o);return e+i}var Ee={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async(e,r,i,o)=>{let n=i.__stx_config||{};if(r.length>0){let c=mt(r.join(" "));n.heatmap={...n.heatmap,...c,enabled:!0}}return Oe(n)}};function mt(e){let r={},i=e.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let o of i){let[n,c]=o.split("="),d=c?.replace(/["']/g,"");switch(n){case"endpoint":r.endpoint=d;break;case"samplingRate":r.samplingRate=Number.parseInt(d,10);break;case"batchSize":r.batchSize=Number.parseInt(d,10);break;case"trackMouse":r.trackMouse=d==="true";break;case"trackClicks":r.trackClicks=d==="true";break;case"trackScroll":r.trackScroll=d==="true";break;case"honorDnt":r.honorDnt=d==="true";break;case"debugOverlay":r.debugOverlay=d==="true";break}}return r}function J(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Ie(e){let r=e.trim().toLowerCase();return!r.startsWith("javascript:")&&!r.startsWith("vbscript:")&&!r.startsWith("data:text/html")}function
|
|
622
|
+
`}function mc(e,r){let i=Oe(r);if(!i)return e;let o=e.lastIndexOf("</body>");if(o!==-1)return e.slice(0,o)+i+e.slice(o);return e+i}var Ee={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async(e,r,i,o)=>{let n=i.__stx_config||{};if(r.length>0){let c=mt(r.join(" "));n.heatmap={...n.heatmap,...c,enabled:!0}}return Oe(n)}};function mt(e){let r={},i=e.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let o of i){let[n,c]=o.split("="),d=c?.replace(/["']/g,"");switch(n){case"endpoint":r.endpoint=d;break;case"samplingRate":r.samplingRate=Number.parseInt(d,10);break;case"batchSize":r.batchSize=Number.parseInt(d,10);break;case"trackMouse":r.trackMouse=d==="true";break;case"trackClicks":r.trackClicks=d==="true";break;case"trackScroll":r.trackScroll=d==="true";break;case"honorDnt":r.honorDnt=d==="true";break;case"debugOverlay":r.debugOverlay=d==="true";break}}return r}function J(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Ie(e){let r=e.trim().toLowerCase();return!r.startsWith("javascript:")&&!r.startsWith("vbscript:")&&!r.startsWith("data:text/html")}function pr(e){let r=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,i=e.match(r);if(!i)return{data:{},content:e.trim()};let o=i[1],n=e.slice(i[0].length),c={};for(let d of o.split(`
|
|
623
623
|
`)){let p=d.trim();if(!p||p.startsWith("#"))continue;let u=p.indexOf(":");if(u===-1)continue;let m=p.slice(0,u).trim(),y=p.slice(u+1).trim();if(typeof y==="string"){if(y.startsWith('"')&&y.endsWith('"')||y.startsWith("'")&&y.endsWith("'"))y=y.slice(1,-1);else if(y.startsWith("[")&&y.endsWith("]"))try{y=JSON.parse(y)}catch{}else if(y==="true")y=!0;else if(y==="false")y=!1;else if(/^-?\d+(?:\.\d+)?$/.test(y))y=Number(y)}c[m]=y}return{data:c,content:n.trim()}}function et(e,r={}){let{gfm:i=!0,breaks:o=!1}=r,n=e,c=[];if(n=n.replace(/```(\w*)\n([\s\S]*?)```/g,(y,f,v)=>{let b=c.length,x=f?` class="language-${J(f)}"`:"";return c.push(`<pre><code${x}>${J(v.trim())}</code></pre>`),`\x00CODEBLOCK${b}\x00`}),n=n.replace(/`([^`]*)`/g,(y,f)=>`<code>${J(f)}</code>`),n=n.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),n=n.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),n=n.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),n=n.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),n=n.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),n=n.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),n=n.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),n=n.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),n=n.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),n=n.replace(/__(.+?)__/g,"<strong>$1</strong>"),n=n.replace(/\*(.+?)\*/g,"<em>$1</em>"),n=n.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),i)n=n.replace(/~~(.+?)~~/g,"<del>$1</del>");if(n=n.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(y,f,v)=>`<img src="${Ie(v)?J(v):""}" alt="${J(f)}" />`),n=n.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(y,f,v)=>`<a href="${Ie(v)?J(v):""}">${f}</a>`),n=n.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),n=n.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),n=n.replace(/<\/blockquote>\n<blockquote>/g,`
|
|
624
624
|
`),n=n.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),n=n.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),n=n.replace(/<\/ul>\n<ul>/g,""),n=n.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),n=n.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),n=n.replace(/<\/ol>\n<ol>/g,""),n=n.replace(/<li data-ul>/g,"<li>"),n=n.replace(/<li data-ol>/g,"<li>"),i)n=n.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(y,f,v)=>{let x=`<tr>${f.split("|").map((S)=>S.trim()).filter(Boolean).map((S)=>`<th>${J(S)}</th>`).join("")}</tr>`,P=v.trim().split(`
|
|
625
625
|
`).map((S)=>`<tr>${S.split("|").map((k)=>k.trim()).filter(Boolean).map((k)=>`<td>${J(k)}</td>`).join("")}</tr>`).join(`
|
|
@@ -684,7 +684,7 @@ ${P}
|
|
|
684
684
|
#${e}.stx-img-loaded img {
|
|
685
685
|
opacity: 1;
|
|
686
686
|
}
|
|
687
|
-
`.trim()}var he=new Map;async function Ne(e,r={}){let i=`${e}:${JSON.stringify(r)}`;if(he.has(i))return he.get(i);let o=await vt(e,r);return he.set(i,o),o}async function wt(){try{return await import("./chunk-
|
|
687
|
+
`.trim()}var he=new Map;async function Ne(e,r={}){let i=`${e}:${JSON.stringify(r)}`;if(he.has(i))return he.get(i);let o=await vt(e,r);return he.set(i,o),o}async function wt(){try{return await import("./chunk-0a36jnq4.js")}catch(e){if(!Ve)console.warn("[stx-media] Image processor not available, some features disabled:",e),Ve=!0;return null}}var Ve=!1,ve=80,le="async",ce="lazy",ze=!1;async function oe(e,r={}){let i=r,o=e;if(o.process&&!o.skipOptimization){if(i.tsImagesConfig?.enabled&&!i.isDev)return Pt(o,i)}if(i.processedResult?.processed)return we(e,i.processedResult,r);if(i.responsiveVariants)return Fe(e,i.responsiveVariants,r);let{src:n,alt:c,width:d,height:p,sizes:u,widths:m=Z,dpr:y,formats:f=te,quality:v=ve,params:b={},placeholder:x="none",placeholderOptions:P={},lazy:S=!0,priority:A=!1,loading:k=A?"eager":ce,decoding:E=le,fetchpriority:I,objectFit:w,objectPosition:C,crossorigin:D,referrerpolicy:z}=e,{class:L,style:T,id:N}=e,_=e.data||{},{isDev:V=!1,baseUrl:G=""}=r;if(V&&!r.optimize)return Dt(e);let W,R,H=N||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(x!=="none"&&!A)try{W=await Ne(n,{strategy:x,...P}),R=je(H,W,P)}catch{}let ie=y!==void 0&&d!==void 0,X;if(ie)X=Ct(e,H,W,r);else X=await $t(e,H,W,r);let ee;if(A){let De=f.includes("webp")?"webp":f[0],rt=me(n,m,{...b,q:v},De),st=typeof u==="object"?ge(u):u||"100vw";ee=`<link rel="preload" as="image" imagesrcset="${rt}" imagesizes="${st}" />`}let ae=[];if(!ze&&x!=="none")ae.push(ye),ze=!0;if(R)ae.push(R);let tt=S?We(H):void 0;return{html:X,preloadLink:ee,css:ae.length>0?ae.join(`
|
|
688
688
|
`):void 0,script:tt}}async function $t(e,r,i,o){let{src:n,alt:c,width:d,height:p,sizes:u,widths:m=Z,formats:y=te,quality:f=ve,params:v={},lazy:b=!0,priority:x=!1,loading:P=x?"eager":ce,decoding:S=le,fetchpriority:A,objectFit:k,objectPosition:E,crossorigin:I,referrerpolicy:w}=e,{class:C,style:D}=e,z=e.data||{},L=typeof u==="object"?ge(u):u||"100vw",T=[];for(let V of y){let G=me(n,m,{...v,q:f},V),W=fe(V);if(b&&!x)T.push(` <source type="${W}" data-srcset="${G}" data-sizes="${L}" />`);else T.push(` <source type="${W}" srcset="${G}" sizes="${L}" />`)}let N=be({src:re(n,{...v,q:f}),alt:c,width:d,height:p,loading:x?void 0:P,decoding:S,fetchpriority:x?"high":A,objectFit:k,objectPosition:E,crossorigin:I,referrerpolicy:w,className:Le(C,i),style:xe(D,k,E,i),lazy:b&&!x,data:z}),_;if(i){let V=`background-image: url('${i.dataURL}'); background-size: cover; background-position: center;`;_=`<div id="${r}" class="stx-img-placeholder" style="${V}">
|
|
689
689
|
<picture>
|
|
690
690
|
${T.join(`
|
|
@@ -748,7 +748,7 @@ ${w.join(`
|
|
|
748
748
|
`):void 0,script:G}}async function Fe(e,r,i){let o={src:r.src,processed:!0,variants:[],placeholder:r.placeholder?.dataURL,originalWidth:r.placeholder?.width,originalHeight:r.placeholder?.height};for(let[n,c]of Object.entries(r.byFormat))if(c)o.variants.push(...c);return we(e,o,i)}function kt(){return St({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async(e,r,i,o)=>{let{src:n,alt:c,options:d}=At(e,r,i);if(!n)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let p={src:n,alt:c||"",widths:d.widths||Z,formats:d.formats||te,quality:d.quality,sizes:d.sizes,dpr:d.dpr,params:d.params,placeholder:d.placeholder,placeholderOptions:d.placeholderOptions,lazy:d.lazy!==!1,priority:d.priority||!1,loading:d.loading,decoding:d.decoding,fetchpriority:d.fetchpriority,objectFit:d.objectFit,objectPosition:d.objectPosition,class:d.class,style:d.style,id:d.id,width:d.width,height:d.height},u=i.__isDev||!1,m=await oe(p,{isDev:u}),y=m.html;if(m.preloadLink)y=m.preloadLink+`
|
|
749
749
|
`+y;if(m.css)y+=`
|
|
750
750
|
<style>${m.css}</style>`;if(m.script)y+=`
|
|
751
|
-
<script>${m.script}</script>`;return y},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function At(e,r,i){if(r.src)return{src:String(r.src),alt:String(r.alt||""),options:r.options||{}};let o=e.trim();if(o.startsWith("@img(")||o.startsWith("("))o=o.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let n=_t(o),c=$e(n[0],i)||"",d=$e(n[1],i)||"",p={};if(n[2]){let u=$e(n[2],i);if(typeof u==="object"&&u!==null)p=u;else if(typeof n[2]==="string")try{p=JSON.parse(n[2])}catch{}}return{src:c,alt:d,options:p}}function _t(e){let r=[],i="",o=!1,n="",c=0,d=0;for(let p=0;p<e.length;p++){let u=e[p],m=p>0?e[p-1]:"";if((u==='"'||u==="'"||u==="`")&&m!=="\\"){if(!o)o=!0,n=u;else if(u===n)o=!1,n="";else i+=u;continue}if(!o){if(u==="{")c++;if(u==="}")c--;if(u==="[")d++;if(u==="]")d--;if(u===","&&c===0&&d===0){r.push(i.trim()),i="";continue}}i+=u}if(i.trim())r.push(i.trim());return r}function $e(e,r){if(typeof e!=="string")return e;let i=e.trim();if(i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'"))return i.slice(1,-1);if(!i.startsWith("/")&&!i.startsWith(".")&&!i.startsWith("http")&&!i.startsWith("{")){let o=r[i];if(o!==void 0)return o}if(i.startsWith("{")||i.startsWith("["))try{return JSON.parse(i)}catch{}return i}var qe=kt();import{existsSync as Rt}from"fs";import ne from"path";function
|
|
751
|
+
<script>${m.script}</script>`;return y},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function At(e,r,i){if(r.src)return{src:String(r.src),alt:String(r.alt||""),options:r.options||{}};let o=e.trim();if(o.startsWith("@img(")||o.startsWith("("))o=o.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let n=_t(o),c=$e(n[0],i)||"",d=$e(n[1],i)||"",p={};if(n[2]){let u=$e(n[2],i);if(typeof u==="object"&&u!==null)p=u;else if(typeof n[2]==="string")try{p=JSON.parse(n[2])}catch{}}return{src:c,alt:d,options:p}}function _t(e){let r=[],i="",o=!1,n="",c=0,d=0;for(let p=0;p<e.length;p++){let u=e[p],m=p>0?e[p-1]:"";if((u==='"'||u==="'"||u==="`")&&m!=="\\"){if(!o)o=!0,n=u;else if(u===n)o=!1,n="";else i+=u;continue}if(!o){if(u==="{")c++;if(u==="}")c--;if(u==="[")d++;if(u==="]")d--;if(u===","&&c===0&&d===0){r.push(i.trim()),i="";continue}}i+=u}if(i.trim())r.push(i.trim());return r}function $e(e,r){if(typeof e!=="string")return e;let i=e.trim();if(i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'"))return i.slice(1,-1);if(!i.startsWith("/")&&!i.startsWith(".")&&!i.startsWith("http")&&!i.startsWith("{")){let o=r[i];if(o!==void 0)return o}if(i.startsWith("{")||i.startsWith("["))try{return JSON.parse(i)}catch{}return i}var qe=kt();import{existsSync as Rt}from"fs";import ne from"path";function xs(){let e=[ne.join(import.meta.dir,"primitives"),ne.join(import.meta.dir,"..","primitives"),ne.join(import.meta.dir,"native","primitives"),ne.join(import.meta.dir,"..","native","primitives")];for(let r of e)if(Rt(ne.join(r,"View.stx")))return r;return e[0]}async function Ue(){try{return await import("./chunk-a579jdwb.js")}catch(e){if(!He)console.warn("[stx-media] Video processor not available, some features disabled:",e),He=!0;return null}}var He=!1,Be=!0,Je="metadata",Ot="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function de(e,r={}){let i=r,o=e;if(o.process&&!o.skipProcessing){if(i.tsVideosConfig?.enabled&&!i.isDev)return jt(o,i)}if(i.processedResult?.processed)return Ge(e,i.processedResult,r);let n;if(o.generatePoster&&o.src&&!e.poster)n=await Nt(o,i);let{src:c,sources:d=[],poster:p,posterPlaceholder:u,controls:m=Be,autoplay:y=!1,muted:f=!1,loop:v=!1,preload:b=Je,playsinline:x=!0,lazy:P=!0,player:S="native",type:A,width:k,height:E,crossorigin:I,disablePictureInPicture:w=!1,disableRemotePlayback:C=!1}=e,D=n||p,{class:z,style:L}=e,T=e.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(S==="ts-video")return It(e,r);if(A&&A!=="video")return Et(c||"",A,e);let N=d.length>0?d:c?[{src:c,type:Ke(c)}]:[],_=[`id="${T}"`];if(m)_.push("controls");if(y)_.push("autoplay");if(f)_.push("muted");if(v)_.push("loop");if(x)_.push("playsinline");if(w)_.push("disablepictureinpicture");if(C)_.push("disableremoteplayback");if(I)_.push(`crossorigin="${I}"`);if(P){if(_.push(`data-preload="${b}"`),_.push('preload="none"'),D)_.push(`data-poster="${M(D)}"`);_.push("data-stx-lazy")}else if(_.push(`preload="${b}"`),D)_.push(`poster="${M(D)}"`);if(k)_.push(`width="${k}"`);if(E)_.push(`height="${E}"`);if(z)_.push(`class="${M(z)}"`);if(L)_.push(`style="${M(L)}"`);let V=N.map((R)=>` <source ${P?`data-src="${M(R.src)}"`:`src="${M(R.src)}"`} type="${R.type}"${R.media?` media="${R.media}"`:""} />`).join(`
|
|
752
752
|
`),G=`<video ${_.join(" ")}>
|
|
753
753
|
${V}
|
|
754
754
|
Your browser does not support the video tag.
|
|
@@ -1007,7 +1007,7 @@ ${N}
|
|
|
1007
1007
|
}
|
|
1008
1008
|
`.trim();return{html:N,script:_,css:V}}function Ye(){return St({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async(e,r,i,o)=>{let{src:n,options:c}=Vt(e,r,i);if(!n)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let d={src:n,poster:c.poster,controls:c.controls!==!1,autoplay:c.autoplay||!1,muted:c.muted||!1,loop:c.loop||!1,preload:c.preload||"metadata",playsinline:c.playsinline!==!1,lazy:c.lazy!==!1,player:c.player||"native",type:c.type,width:c.width,height:c.height,class:c.class,style:c.style,id:c.id,crossorigin:c.crossorigin,disablePictureInPicture:c.disablePictureInPicture,disableRemotePlayback:c.disableRemotePlayback,title:c.title,quality:c.quality,platform:c.platform,process:c.process,generatePoster:c.generatePoster,streaming:c.streaming,transcode:c.transcode,spriteSheet:c.spriteSheet,waveform:c.waveform},u={isDev:i.__isDev||!1,tsVideosConfig:i.__tsVideosConfig},m=await de(d,u),y=m.html;if(m.css)y+=`
|
|
1009
1009
|
<style>${m.css}</style>`;if(m.script)y+=`
|
|
1010
|
-
<script>${m.script}</script>`;return y},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function Vt(e,r,i){if(r.src)return{src:String(r.src),options:r.options||{}};let o=e.trim();if(o.startsWith("@video(")||o.startsWith("("))o=o.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let n=zt(o),c=Xe(n[0],i)||"",d={};if(n[1]){let p=Xe(n[1],i);if(typeof p==="object"&&p!==null)d=p;else if(typeof n[1]==="string")try{d=JSON.parse(n[1])}catch{}}return{src:c,options:d}}function zt(e){let r=[],i="",o=!1,n="",c=0,d=0;for(let p=0;p<e.length;p++){let u=e[p],m=p>0?e[p-1]:"";if((u==='"'||u==="'"||u==="`")&&m!=="\\"){if(!o)o=!0,n=u;else if(u===n)o=!1,n="";else i+=u;continue}if(!o){if(u==="{")c++;if(u==="}")c--;if(u==="[")d++;if(u==="]")d--;if(u===","&&c===0&&d===0){r.push(i.trim()),i="";continue}}i+=u}if(i.trim())r.push(i.trim());return r}function Xe(e,r){if(typeof e!=="string")return e;let i=e.trim();if(i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'"))return i.slice(1,-1);if(!i.startsWith("/")&&!i.startsWith(".")&&!i.startsWith("http")&&!i.startsWith("{")){let o=r[i];if(o!==void 0)return o}if(i.startsWith("{")||i.startsWith("["))try{return JSON.parse(i)}catch{}return i}var Se=Ye();import Lt from"fs";import q from"path";async function
|
|
1010
|
+
<script>${m.script}</script>`;return y},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function Vt(e,r,i){if(r.src)return{src:String(r.src),options:r.options||{}};let o=e.trim();if(o.startsWith("@video(")||o.startsWith("("))o=o.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let n=zt(o),c=Xe(n[0],i)||"",d={};if(n[1]){let p=Xe(n[1],i);if(typeof p==="object"&&p!==null)d=p;else if(typeof n[1]==="string")try{d=JSON.parse(n[1])}catch{}}return{src:c,options:d}}function zt(e){let r=[],i="",o=!1,n="",c=0,d=0;for(let p=0;p<e.length;p++){let u=e[p],m=p>0?e[p-1]:"";if((u==='"'||u==="'"||u==="`")&&m!=="\\"){if(!o)o=!0,n=u;else if(u===n)o=!1,n="";else i+=u;continue}if(!o){if(u==="{")c++;if(u==="}")c--;if(u==="[")d++;if(u==="]")d--;if(u===","&&c===0&&d===0){r.push(i.trim()),i="";continue}}i+=u}if(i.trim())r.push(i.trim());return r}function Xe(e,r){if(typeof e!=="string")return e;let i=e.trim();if(i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'"))return i.slice(1,-1);if(!i.startsWith("/")&&!i.startsWith(".")&&!i.startsWith("http")&&!i.startsWith("{")){let o=r[i];if(o!==void 0)return o}if(i.startsWith("{")||i.startsWith("["))try{return JSON.parse(i)}catch{}return i}var Se=Ye();import Lt from"fs";import q from"path";async function Ss(e,r){if(!e.webComponents?.enabled)return[];let i=e.webComponents.components||[],o=[];if(i.length>0){if(e.debug)console.log(`Building ${i.length} web components...`);for(let n of i)try{let c=await Wt(n,e,r);if(c)o.push(c)}catch(c){if(console.error(`Error building web component ${n.name}:`,c),e.debug)throw c}}return o}async function Wt(e,r,i){let{name:o,file:n,tag:c,extends:d}=e;if(!o||!n||!c)return console.error("Invalid web component configuration, missing required fields:",e),null;let p=null;if(q.isAbsolute(n)&&await s(n))p=n;else if(r.componentsDir){let P=q.join(r.componentsDir,n);if(await s(P))p=P}if(!p)p=await vn(n,process.cwd(),r,i);if(!p)return console.error(`Web component source file not found: ${n}`),null;let u=await Bun.file(p).text();i.add(p);let y=(e.outputFormat||"js")==="ts",f=y?qt({name:o,tag:c,baseElement:d,source:u,shadowDOM:e.shadowDOM??!0,template:e.template??!0,styleSource:e.styleSource,attributes:e.attributes||[],attributeTypes:e.attributeTypes||{}}):Ft({name:o,tag:c,baseElement:d,source:u,shadowDOM:e.shadowDOM??!0,template:e.template??!0,styleSource:e.styleSource,attributes:e.attributes||[]}),v=r.webComponents?.outputDir||"dist/web-components";await Lt.promises.mkdir(v,{recursive:!0});let b=y?"ts":"js",x=q.join(v,`${c}.${b}`);if(await Bun.write(x,f),r.debug)console.log(`Built web component ${o} -> ${x}`);return x}function Ft(e){let{name:r,tag:i,baseElement:o="HTMLElement",source:n,shadowDOM:c,template:d,styleSource:p,attributes:u=[]}=e,m=n.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!c)m=m.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),m=m.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),m=m.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),m=m.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");let y="";if(p)y=`<link rel="stylesheet" href="${p}">`;return`/**
|
|
1011
1011
|
* ${r} Web Component
|
|
1012
1012
|
* Auto-generated from stx component
|
|
1013
1013
|
*/
|
|
@@ -1307,6 +1307,6 @@ ${y}
|
|
|
1307
1307
|
customElements.define('${r}', ${d});
|
|
1308
1308
|
`}async function Ze(e,r,i,o){if(r.length<1)return l("WebComponent","@webcomponent directive requires at least the tag name parameter",t.INVALID_DIRECTIVE_SYNTAX);let n=r[0].replace(/['"]/g,""),d=(i.__stx_options||{}).componentsDir||"components",p=q.isAbsolute(d)?[q.join(d,`${n}.stx`),q.join(q.dirname(o),`${n}.stx`)]:[q.join(q.dirname(o),d,`${n}.stx`),q.join(process.cwd(),d,`${n}.stx`),q.join(q.dirname(o),`${n}.stx`)],u=null;for(let f of p)if(await s(f)){u=await Bun.file(f).text();break}if(!u)return l("WebComponent",`Component file not found: ${n}.stx`,t.FILE_NOT_FOUND);let m=Ht(u,n);return`<script type="module">
|
|
1309
1309
|
${Ut(m)}
|
|
1310
|
-
</script>`}var F={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:dn,cachePath:".stx/cache",cacheVersion:"1.0.0",componentRenderCacheBytes:33554432,build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:Te,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:Ze,hasEndTag:!1,description:"Include a web component in the template"},vc,xc,_s,Cs,Pe,Ae,_e,ke,Re,Ee,qe,Se,...to],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,scrollRestoration:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};function Jt(e,r,i){let o=r||"pages";if(e)return{root:e,pagesDir:o};let n=i||process.cwd(),c=j.join(n,"resources","views"),d=j.join(n,"resources","layouts");if(Q.existsSync(c)&&Q.existsSync(d))return{root:"resources",pagesDir:"views"};let p=j.join(n,"resources","views","pages");if(Q.existsSync(p))return{root:"resources/views",pagesDir:o};return{root:".",pagesDir:o}}var Qe=new Set,pe=["partialsDir","componentsDir","layoutsDir"],Ce=new WeakMap;function Kt(e,r){let i=r.replace(/[\\/]+$/,"");if(!i||i===".")return!0;let o=e.replace(/\\/g,"/"),n=i.replace(/\\/g,"/");return o===n||o.startsWith(`${n}/`)}function Vf(e,r){let i=!e.root,o=Jt(e.root,e.pagesDir,r);if(e.root=o.root,e.pagesDir=o.pagesDir,i&&o.root!=="."){let n=`${r}::${o.root}`;if(!Qe.has(n))Qe.add(n),console.warn(`[stx] No "root" in config \u2014 inferred "${o.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!Ce.has(e)){let n={};for(let c of pe){let d=e[c];if(typeof d==="string"&&d)n[c]=d}Ce.set(e,n)}if(e.root&&e.root!=="."){let n=e.root;for(let c of pe){let d=e[c];if(typeof d!=="string"||!d)continue;if(j.isAbsolute(d)||Kt(d,n))continue;e[c]=j.join(n,d)}}for(let n of pe){let c=e[n];if(typeof c!=="string"||!c||j.isAbsolute(c))continue;e[n]=j.resolve(r,c)}return e}function Gt(e,r){let i=Ce.get(e);for(let o of pe){let n=e[o];if(typeof n!=="string"||!n)continue;let c=j.isAbsolute(n)?n:j.join(r,n);if(Q.existsSync(c))continue;let d=i?.[o]??n,p=e.root,u=!!p&&p!==".";console.warn(`[stx] ${String(o)} resolves to "${c}", which does not exist. Configured as "${d}"`+(u?`, resolved under root "${p}".`:"."))}}function Yt(e){if(e.customDirectives)e.customDirectives=[...e.customDirectives];if(e.middleware)e.middleware=[...e.middleware];if(e.apiRoutes)e.apiRoutes={...e.apiRoutes}}function Xt(e){if(Rc(e.stateDir),e.stateDir=mr(),e.cachePath=hr(e.cachePath),e.build)e.build.cacheDir=hr(e.build.cacheDir);if(e.media?.cache)e.media.cache.directory=hr(e.media.cache.directory);if(e.story)e.story.outDir=hr(e.story.outDir)}var K=null,Y=new Map,ue=new Map,se=null;async function Jo(e,r=Bt){try{return await r(e)}catch(i){if(i instanceof Error&&i.name==="ConfigNotFoundError")return{config:e.defaultConfig};throw i}}async function a(e){let r=e?j.resolve(e):process.cwd(),i=ue.get(r);if(i&&i.signature!==Ss(i.graph)){let c=Y.get(r);if(Y.delete(r),ue.delete(r),!e)K=null,se=null;let{clearComponentCache:d}=await import("./chunk-z58dr234.js"),{partialsCache:p}=await import("./chunk-aqjcqnex.js");if(d(),p.clear(),c&&i.configSignature===ks(i.graph)){let u=c.then(async(m)=>{let y={...i.graph};await Zo(y,r),ue.set(r,{graph:y,signature:Ss(y),configSignature:ks(y)});let f={...m,_layerGraph:y};if(!e)K=f;return f});return Y.set(r,u),u}}if(!e){if(K)return K;if(se)return se}let o=Y.get(r);if(o)return o;let n=(async()=>{let c=[".ts",".js",".mjs",".cjs",".json"],d=c.some((v)=>Q.existsSync(j.join(r,`stx.config${v}`))),p=c.some((v)=>Q.existsSync(j.join(r,"config",`ui${v}`))),u;if(d&&p){let v=await Jo({name:"ui",cwd:j.join(r,"config"),defaultConfig:F,errorPolicy:"throw",verbose:!1});u=(await Jo({name:"stx",alias:"ui",cwd:r,defaultConfig:v.config,errorPolicy:"throw",verbose:!1})).config}else u=(await Jo({name:"stx",alias:"ui",cwd:r,defaultConfig:F,errorPolicy:"throw",verbose:!1})).config;if(u.extends!==void 0||i){let v=await kc(r,F);u=v.config,ue.set(r,{graph:v.graph,signature:Ss(v.graph),configSignature:ks(v.graph)})}if(u.runtimeConfig){let{resolveRuntimeConfig:v}=await import("./chunk-zty254tw.js");v(u.runtimeConfig,{});let{generateRuntimeConfigTypes:b}=await import("./chunk-shzkz2az.js");await b(r,u.runtimeConfig)}Yt(u),Xt(u),Vf(u,r),Gt(u,r);let m=[],y=new Set((u.plugins??[]).map((v)=>typeof v==="string"?v:v[0]));for(let v of u.componentPackages??["@stacksjs/components"]){let b=`${v}/stx-plugin`;if(y.has(b)||y.has(v))continue;try{g.resolve(b,{paths:[r]}),m.push(b)}catch{}}let f=[...u.plugins??[],...m];if(f.length>0){let{pluginManager:v}=await import("./chunk-cfrgrnej.js"),b=[],x=[];for(let P of f){let S=typeof P==="string"?P:P[0],A=typeof P==="string"?{}:P[1]||{};try{let k,E;try{let w=g.resolve(S,{paths:[r]});k=await import(w),E=j.dirname(w)}catch{let w=j.resolve(r,S);k=await import(w),E=j.dirname(w)}let I=k.default||k;if(!v.has(I.name))await v.register(I,u);if(I.components){let w=Array.isArray(I.components)?I.components:[I.components];for(let C of w)b.push(j.resolve(E,C))}if(I.pages){let w=j.resolve(E,I.pages),C=A.path||"/";x.push({dir:w,prefix:C})}if(I.setup){let w={addDirective:(C)=>{u.customDirectives=u.customDirectives||[],u.customDirectives.push(C)},addRoute:(C,D)=>{u.apiRoutes=u.apiRoutes||{},u.apiRoutes[C]=D},addMiddleware:(C)=>{u.middleware=u.middleware||[],u.middleware.push(C)},pluginDir:E,config:u};await I.setup(A,w)}process.stderr.write(`[stx] Plugin loaded: ${I.name||S}
|
|
1311
|
-
`)}catch(k){console.warn(`[stx] Failed to load plugin ${S}:`,k.message)}}u._pluginComponentDirs=b,u._pluginPageDirs=x}if(u.nativePrimitives!==!1)u._nativePrimitivesFallback={dir:
|
|
1312
|
-
export{gc,mc,
|
|
1310
|
+
</script>`}var F={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:dn,cachePath:".stx/cache",cacheVersion:"1.0.0",componentRenderCacheBytes:33554432,build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:Te,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:Ze,hasEndTag:!1,description:"Include a web component in the template"},vc,xc,Cs,Es,Pe,Ae,_e,ke,Re,Ee,qe,Se,...no],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,scrollRestoration:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};function Jt(e,r,i){let o=r||"pages";if(e)return{root:e,pagesDir:o};let n=i||process.cwd(),c=j.join(n,"resources","views"),d=j.join(n,"resources","layouts");if(Q.existsSync(c)&&Q.existsSync(d))return{root:"resources",pagesDir:"views"};let p=j.join(n,"resources","views","pages");if(Q.existsSync(p))return{root:"resources/views",pagesDir:o};return{root:".",pagesDir:o}}var Qe=new Set,pe=["partialsDir","componentsDir","layoutsDir"],Ce=new WeakMap;function Kt(e,r){let i=r.replace(/[\\/]+$/,"");if(!i||i===".")return!0;let o=e.replace(/\\/g,"/"),n=i.replace(/\\/g,"/");return o===n||o.startsWith(`${n}/`)}function Vf(e,r){let i=!e.root,o=Jt(e.root,e.pagesDir,r);if(e.root=o.root,e.pagesDir=o.pagesDir,i&&o.root!=="."){let n=`${r}::${o.root}`;if(!Qe.has(n))Qe.add(n),console.warn(`[stx] No "root" in config \u2014 inferred "${o.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!Ce.has(e)){let n={};for(let c of pe){let d=e[c];if(typeof d==="string"&&d)n[c]=d}Ce.set(e,n)}if(e.root&&e.root!=="."){let n=e.root;for(let c of pe){let d=e[c];if(typeof d!=="string"||!d)continue;if(j.isAbsolute(d)||Kt(d,n))continue;e[c]=j.join(n,d)}}for(let n of pe){let c=e[n];if(typeof c!=="string"||!c||j.isAbsolute(c))continue;e[n]=j.resolve(r,c)}return e}function Gt(e,r){let i=Ce.get(e);for(let o of pe){let n=e[o];if(typeof n!=="string"||!n)continue;let c=j.isAbsolute(n)?n:j.join(r,n);if(Q.existsSync(c))continue;let d=i?.[o]??n,p=e.root,u=!!p&&p!==".";console.warn(`[stx] ${String(o)} resolves to "${c}", which does not exist. Configured as "${d}"`+(u?`, resolved under root "${p}".`:"."))}}function Yt(e){if(e.customDirectives)e.customDirectives=[...e.customDirectives];if(e.middleware)e.middleware=[...e.middleware];if(e.apiRoutes)e.apiRoutes={...e.apiRoutes}}function Xt(e){if(Rc(e.stateDir),e.stateDir=hr(),e.cachePath=yr(e.cachePath),e.build)e.build.cacheDir=yr(e.build.cacheDir);if(e.media?.cache)e.media.cache.directory=yr(e.media.cache.directory);if(e.story)e.story.outDir=yr(e.story.outDir)}var K=null,Y=new Map,ue=new Map,se=null;async function Yo(e,r=Bt){try{return await r(e)}catch(i){if(i instanceof Error&&i.name==="ConfigNotFoundError")return{config:e.defaultConfig};throw i}}async function a(e){let r=e?j.resolve(e):process.cwd(),i=ue.get(r);if(i&&i.signature!==ks(i.graph)){let c=Y.get(r);if(Y.delete(r),ue.delete(r),!e)K=null,se=null;let{clearComponentCache:d}=await import("./chunk-x6ck5s29.js"),{partialsCache:p}=await import("./chunk-rkk2mb0h.js");if(d(),p.clear(),c&&i.configSignature===_s(i.graph)){let u=c.then(async(m)=>{let y={...i.graph};await Qo(y,r),ue.set(r,{graph:y,signature:ks(y),configSignature:_s(y)});let f={...m,_layerGraph:y};if(!e)K=f;return f});return Y.set(r,u),u}}if(!e){if(K)return K;if(se)return se}let o=Y.get(r);if(o)return o;let n=(async()=>{let c=[".ts",".js",".mjs",".cjs",".json"],d=c.some((v)=>Q.existsSync(j.join(r,`stx.config${v}`))),p=c.some((v)=>Q.existsSync(j.join(r,"config",`ui${v}`))),u;if(d&&p){let v=await Yo({name:"ui",cwd:j.join(r,"config"),defaultConfig:F,errorPolicy:"throw",verbose:!1});u=(await Yo({name:"stx",alias:"ui",cwd:r,defaultConfig:v.config,errorPolicy:"throw",verbose:!1})).config}else u=(await Yo({name:"stx",alias:"ui",cwd:r,defaultConfig:F,errorPolicy:"throw",verbose:!1})).config;if(u.extends!==void 0||i){let v=await kc(r,F);u=v.config,ue.set(r,{graph:v.graph,signature:ks(v.graph),configSignature:_s(v.graph)})}if(u.runtimeConfig){let{resolveRuntimeConfig:v}=await import("./chunk-7efkc3gk.js");v(u.runtimeConfig,{});let{generateRuntimeConfigTypes:b}=await import("./chunk-k5jmnt0z.js");await b(r,u.runtimeConfig)}Yt(u),Xt(u),Vf(u,r),Gt(u,r);let m=[],y=new Set((u.plugins??[]).map((v)=>typeof v==="string"?v:v[0]));for(let v of u.componentPackages??["@stacksjs/components"]){let b=`${v}/stx-plugin`;if(y.has(b)||y.has(v))continue;try{g.resolve(b,{paths:[r]}),m.push(b)}catch{}}let f=[...u.plugins??[],...m];if(f.length>0){let{pluginManager:v}=await import("./chunk-cfrgrnej.js"),b=[],x=[];for(let P of f){let S=typeof P==="string"?P:P[0],A=typeof P==="string"?{}:P[1]||{};try{let k,E;try{let w=g.resolve(S,{paths:[r]});k=await import(w),E=j.dirname(w)}catch{let w=j.resolve(r,S);k=await import(w),E=j.dirname(w)}let I=k.default||k;if(!v.has(I.name))await v.register(I,u);if(I.components){let w=Array.isArray(I.components)?I.components:[I.components];for(let C of w)b.push(j.resolve(E,C))}if(I.pages){let w=j.resolve(E,I.pages),C=A.path||"/";x.push({dir:w,prefix:C})}if(I.setup){let w={addDirective:(C)=>{u.customDirectives=u.customDirectives||[],u.customDirectives.push(C)},addRoute:(C,D)=>{u.apiRoutes=u.apiRoutes||{},u.apiRoutes[C]=D},addMiddleware:(C)=>{u.middleware=u.middleware||[],u.middleware.push(C)},pluginDir:E,config:u};await I.setup(A,w)}process.stderr.write(`[stx] Plugin loaded: ${I.name||S}
|
|
1311
|
+
`)}catch(k){console.warn(`[stx] Failed to load plugin ${S}:`,k.message)}}u._pluginComponentDirs=b,u._pluginPageDirs=x}if(u.nativePrimitives!==!1)u._nativePrimitivesFallback={dir:xs(),except:["Button","Checkbox","Switch","TextInput","Image","Video"]};return u})();if(Y.set(r,n),n.catch(()=>{if(Y.get(r)===n)Y.delete(r)}),!e)se=n,n.then((c)=>{K=c}).catch(()=>{});return n}var O=new Proxy(F,{get(e,r){if(K&&r in K)return K[r];if(!se)a().catch((i)=>{console.warn("[stx] Failed to load config file:",i?.message||i)});return e[r]}});function Uh(e){return e}function Wh(e){let r=[],i=[];if(e.partialsDir!==void 0&&typeof e.partialsDir!=="string")r.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if(e.componentsDir!==void 0&&typeof e.componentsDir!=="string")r.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if(e.cache!==void 0&&typeof e.cache!=="boolean")r.push({path:"cache",message:"cache must be a boolean",severity:"error"});if(e.debug!==void 0&&typeof e.debug!=="boolean")r.push({path:"debug",message:"debug must be a boolean",severity:"error"});if(e.streaming){if(e.streaming.bufferSize!==void 0){if(typeof e.streaming.bufferSize!=="number"||e.streaming.bufferSize<=0)r.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if(e.streaming.timeout!==void 0){if(typeof e.streaming.timeout!=="number"||e.streaming.timeout<=0)r.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if(e.streaming.strategy!==void 0){let o=["auto","manual","sections"];if(!o.includes(e.streaming.strategy))r.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${o.join(", ")}`,severity:"error"})}}if(e.i18n){if(e.i18n.format!==void 0){let o=["json","yaml","yml","js"];if(!o.includes(e.i18n.format))r.push({path:"i18n.format",message:`i18n.format must be one of: ${o.join(", ")}`,severity:"error"})}}if(e.animation){if(e.animation.defaultDuration!==void 0){if(typeof e.animation.defaultDuration!=="number"||e.animation.defaultDuration<0)r.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if(e.animation.staggerDelay!==void 0){if(typeof e.animation.staggerDelay!=="number"||e.animation.staggerDelay<0)r.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if(e.a11y){if(e.a11y.level!==void 0){let o=["AA","AAA"];if(!o.includes(e.a11y.level))r.push({path:"a11y.level",message:`a11y.level must be one of: ${o.join(", ")}`,severity:"error"})}}if(e.hydration){if(e.hydration.mode!==void 0){let o=["progressive","islands"];if(!o.includes(e.hydration.mode))r.push({path:"hydration.mode",message:`hydration.mode must be one of: ${o.join(", ")}`,severity:"error"})}if(e.hydration.preload!==void 0){let o=["none","eager","lazy"];if(!o.includes(e.hydration.preload))r.push({path:"hydration.preload",message:`hydration.preload must be one of: ${o.join(", ")}`,severity:"error"})}}if(e.customDirectives)if(!Array.isArray(e.customDirectives))r.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else e.customDirectives.forEach((o,n)=>{if(!o.name||typeof o.name!=="string")r.push({path:`customDirectives[${n}].name`,message:"Custom directive must have a name string",severity:"error"});if(!o.handler||typeof o.handler!=="function")r.push({path:`customDirectives[${n}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if(e.middleware)if(!Array.isArray(e.middleware))r.push({path:"middleware",message:"middleware must be an array",severity:"error"});else e.middleware.forEach((o,n)=>{if(!o.name||typeof o.name!=="string")r.push({path:`middleware[${n}].name`,message:"Middleware must have a name string",severity:"error"});if(!o.handler||typeof o.handler!=="function")r.push({path:`middleware[${n}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!o.timing||!["before","after"].includes(o.timing))r.push({path:`middleware[${n}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if(e.debug===!0&&e.cache===!0)i.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if(e.seo?.enabled===!0&&!e.seo?.defaultConfig?.title)i.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if(e.pwa){if(e.pwa.enabled===!0&&!e.pwa.manifest?.name)r.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if(e.pwa.manifest?.display!==void 0){let o=["fullscreen","standalone","minimal-ui","browser"];if(!o.includes(e.pwa.manifest.display))r.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${o.join(", ")}`,severity:"error"})}if(e.pwa.manifest?.orientation!==void 0){let o=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!o.includes(e.pwa.manifest.orientation))r.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${o.join(", ")}`,severity:"error"})}if(e.pwa.routes){let o=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];e.pwa.routes.forEach((n,c)=>{if(!n.pattern||typeof n.pattern!=="string")r.push({path:`pwa.routes[${c}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!o.includes(n.strategy))r.push({path:`pwa.routes[${c}].strategy`,message:`PWA route strategy must be one of: ${o.join(", ")}`,severity:"error"});if(n.maxAgeSeconds!==void 0&&(typeof n.maxAgeSeconds!=="number"||n.maxAgeSeconds<0))r.push({path:`pwa.routes[${c}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(n.maxEntries!==void 0&&(typeof n.maxEntries!=="number"||n.maxEntries<1))r.push({path:`pwa.routes[${c}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if(e.pwa.icons?.sizes){if(!Array.isArray(e.pwa.icons.sizes))r.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if(e.pwa.icons.sizes.filter((n)=>typeof n!=="number"||n<16||n>1024).length>0)r.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if(e.pwa.icons?.purpose){let o=["any","maskable","monochrome"];if(e.pwa.icons.purpose.filter((c)=>!o.includes(c)).length>0)r.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${o.join(", ")}`,severity:"error"})}if(e.pwa.enabled===!0&&!e.pwa.icons?.src)i.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if(e.pwa.enabled===!0&&!e.pwa.manifest?.themeColor)i.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:r.length===0,errors:r,warnings:i}}
|
|
1312
|
+
export{gc,mc,pr,et,hc,xs,Ss,F,Vf,Yo,a,O,Uh,Wh};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Mi,Di,Li,Ng,Mg,Dg,Cl,Lg,jg}from"./chunk-
|
|
2
|
+
import{Mi,Di,Li,Ng,Mg,Dg,Cl,Lg,jg}from"./chunk-dv11h4f0.js";export{Mi as ImageProcessorCache,Cl as applyTransformations,Ng as clearImageCache,Lg as generateResponsiveVariants,jg as generateSrcset,Di as getCachedImageResult,Dg as optimizeImage,Mg as processImage,Li as setCachedImageResult};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Dh,gs,Wo,ms,ar,qo,Ko,jf,hs,ys,bs,Xo,uc,Bf,vt}from"./chunk-8f49t8wb.js";import"./chunk-wpy1ytv9.js";import"./chunk-ya6bp08c.js";import"./chunk-02s0hzwa.js";import"./chunk-h8pp1dsq.js";import"./chunk-gh62p9mx.js";import"./chunk-amg6kr1p.js";import"./chunk-ms3v5nat.js";import"./chunk-29f6vmyz.js";import{V}from"./chunk-a1fp1nyf.js";import"./chunk-6eqjf0r6.js";import"./chunk-vfj9wp11.js";import"./chunk-txd2js5v.js";import"./chunk-s6r54dyf.js";import"./chunk-4ntm3dtk.js";export{jf as bindLoopInterpolations,Dh as clearScriptScanCache,hs as convertServerLoopAttributesToDirectives,qo as convertSignalDirectivesToAttributes,ys as convertSignalLoopsToAttributes,ar as extractClientSignalNames,V as extractExports,uc as findMarkupIndexOutsideScripts,ms as hasSignalsSyntax,Wo as parseLoopExpression,Ko as preEvalLiteralReactiveIfs,bs as processScriptSetup,Xo as processSignals,Bf as rewriteStxImportSpecifiers,gs as scanScriptTags,vt as stripStxRuntimeImports};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Se,It,ui,
|
|
2
|
+
import{Se,It,ui,js,Oc,Nc,Mc,Dc,Bs,pi,Lc,jc,fi,bn}from"./chunk-a1fp1nyf.js";import{k}from"./chunk-4ntm3dtk.js";import{a}from"./chunk-02s0hzwa.js";import{vo}from"./chunk-waz6g84g.js";import{c}from"./chunk-9w3r1ch2.js";import{existsSync as B,readFileSync as K}from"fs";import h from"path";var ge=new Set(["module","exports","require","$bool","$num","window","document","console","confirm","alert","fetch"]),ee=bn.filter((e)=>!ge.has(e)).sort(),te=[...k].sort(),he=[...new Set([...ee,...te])].sort(),be=new Set(ee),xe=new Set(te),ye=new Set(he),Y=/\bimport\s+(?!type[\s{])\{([^}]*)\}\s*from\s*(['"])stx\2/g;function ke(e,t){if(t==="server")return`'${e}' is not provided by 'stx' in a <script server> block. The engine binds only its own names there (defineProps, state, useHead, ...); any other name becomes \`await import('stx')\`, which does not resolve, so the whole script fails when the page renders. Import it from '@stacksjs/stx' instead.`;return`'${e}' is not provided by 'stx' in a client <script> block. The import is replaced by the window.stx runtime, which has no '${e}', so it is undefined in the browser.`}function ne(e,t){let s=[];for(let f of t){if(f.offset===void 0)continue;let i=f.kind==="server"?be:xe;Y.lastIndex=0;for(let p of f.code.matchAll(Y)){let g=p.index+p[0].indexOf("{")+1;for(let d of p[1].matchAll(/[^,]+/g)){let y=d[0];if(/^\s*type\s/.test(y))continue;let b=/^\s*([A-Za-z_$][\w$]*)/.exec(y);if(!b)continue;let r=b[1];if(!ye.has(r)||i.has(r))continue;let o=f.offset+g+d.index+b[0].length-r.length,u=e.slice(0,o),S=u.split(`
|
|
3
3
|
`).length;s.push({line:S,column:o-(u.lastIndexOf(`
|
|
4
4
|
`)+1)+1,offset:o,length:r.length,name:r,kind:f.kind,message:ke(r,f.kind)})}}}return s}import E from"path";var we="@stacksjs/stx-typescript-plugin";function $e(e,t){let s=E.resolve(e);for(;;){let f=E.join(s,"tsconfig.json");if(t(f))return f;let i=E.dirname(s);if(i===s)return;s=i}}function ie(e,t,s){let f=$e(e,s);if(!f)return;let i=new Set,p=(g)=>{if(i.has(g))return;i.add(g);let d=t(g);if(!d)return;let y=d.compilerOptions?.plugins;if(Array.isArray(y)){let r=y.find((u)=>u?.name===we),o=Array.isArray(r?.libs)?r.libs.filter((u)=>typeof u==="string"):[];return r?{configPath:g,libs:o.map((u)=>E.resolve(E.dirname(g),u))}:null}let b=typeof d.extends==="string"?[d.extends]:Array.isArray(d.extends)?d.extends:[];for(let r of[...b].reverse()){if(typeof r!=="string"||!r.startsWith("."))continue;let o=E.resolve(E.dirname(g),r.endsWith(".json")?r:`${r}.json`),u=p(o);if(u!==void 0)return u}return};return p(f)??void 0}function aa(e,t="",s=""){let f=e.startLine>1?`
|
|
5
|
-
`.repeat(e.startLine-1):"",i=ui(pi(e)+e.code,t),p=
|
|
5
|
+
`.repeat(e.startLine-1):"",i=ui(pi(e)+e.code,t),p=js(i.code),g=e.kind==="client"||e.kind==="plain"?Mc(t,e.code):"",d=(f+p).split(`
|
|
6
6
|
`),y=d.length,b=new Map;for(let o of i.declarations)for(let[u,S]of o.text.split(`
|
|
7
|
-
`).entries())if(d.push(S),o.origin)b.set(d.length,{...o.origin,line:e.startLine+o.origin.line-1+u,column:u===0?o.origin.column:1});d.push(g,"export {}","");let r=
|
|
7
|
+
`).entries())if(d.push(S),o.origin)b.set(d.length,{...o.origin,line:e.startLine+o.origin.line-1+u,column:u===0?o.origin.column:1});d.push(g,"export {}","");let r=Bs(d.join(`
|
|
8
8
|
`),s);return{text:r.code,sourceLineCount:y,lineMap:b,scriptColumns:new Map([...i.columns].map(([o,u])=>[o+e.startLine-1,u])),importColumns:r.columns}}function tm(e,t="",s=""){return aa(e,t,s).text}var ve=new Set(["name","status","length","location","history","origin","closed","close","open","focus","blur","print","scroll","scrollTo","scrollBy","stop","top","parent","self","frames","event","external","menubar","toolbar"]);function Te(e){if(e.length===0)return"";let t=["// Generated \u2014 the composables the runtime publishes as bare globals."],s=new Set(k),f=[];for(let{file:i,names:p}of e){let g=JSON.stringify(i.replace(/\\/g,"/").replace(/\.ts$/,""));f.push(` export * from ${g}`);for(let d of p){if(s.has(d)||ve.has(d))continue;s.add(d),t.push(`declare const ${d}: typeof import(${g})[${JSON.stringify(d)}]`)}}return t.push("declare module '@composables' {",...f,"}"),t.join(`
|
|
9
9
|
`)}function ca(e,t,s){return`${e}.__stx_${t}${s}.ts`}function nm(e){return e.replace(/\.__stx_(?:server|client|plain|template)\d+\.ts$/,"")}function Bl(){return se("stx.d.ts")}function Fl(){return se("stx-module.d.ts")}function se(e){for(let t of[h.resolve(import.meta.dir,"..",e),h.resolve(import.meta.dir,"..","..",e)])if(B(t))return t;return null}var De=/^(.*?)\((\d+),(\d+)\):\s+(error|warning)\s+TS(\d+):\s+(.*)$/;function re(e){return e>=1000&&e<2000}function oe(e){let t="",s=!1,f=!1;for(let i=0;i<e.length;i++){let p=e[i];if(s){if(t+=p,f)f=!1;else if(p==="\\")f=!0;else if(p==='"')s=!1;continue}if(p==='"'){s=!0,t+=p;continue}if(p==="/"&&e[i+1]==="/"){while(i<e.length&&e[i]!==`
|
|
10
10
|
`)i++;t+=`
|
|
11
11
|
`;continue}if(p==="/"&&e[i+1]==="*"){i+=2;while(i<e.length&&!(e[i]==="*"&&e[i+1]==="/"))i++;i++;continue}t+=p}return t.replace(/,(\s*[}\]])/g,"$1")}function Ee(e){try{return JSON.parse(oe(K(e,"utf8")))}catch{return}}function Ne(e){let t=h.resolve(e),s;for(;;){let r=h.join(t,"tsconfig.json");if(B(r)){s=r;break}let o=h.dirname(t);if(o===t)break;t=o}if(!s)return{};let f=new Set,i=s,p,g,d=s;while(i&&!f.has(i)){f.add(i);let r;try{r=JSON.parse(oe(K(i,"utf8")))}catch{break}let o=r?.compilerOptions??{};if(!p&&o.paths&&typeof o.paths==="object")p=o.paths,d=i;if(!g&&typeof o.baseUrl==="string")g=h.resolve(h.dirname(i),o.baseUrl);if(p&&g)break;i=typeof r?.extends==="string"?h.resolve(h.dirname(i),r.extends.endsWith(".json")?r.extends:`${r.extends}.json`):void 0}if(!p)return{};let y=g??h.dirname(d),b={};for(let[r,o]of Object.entries(p)){if(!Array.isArray(o))continue;b[r]=o.map((u)=>typeof u==="string"&&!h.isAbsolute(u)?h.resolve(y,u):u)}return{paths:b}}async function rm(e,t={}){let s=t.client!==!1,f=t.server!==!1,i=t.templates!==!1,p=t.componentsDir??(i?(await a()).componentsDir:void 0),g=new Map,d=new Map,y=[],b=[],r=0,o=0,u=Bl();for(let n of e){let l=await Bun.file(n).text(),x=It(l).filter((m)=>{if(m.kind==="server")return f;return s}),w=It(l).filter((m)=>m.kind==="server").map((m)=>m.code).join(`
|
|
12
12
|
`);for(let m of ne(l,x))y.push({file:n,line:m.line,column:m.column,code:0,message:m.message,category:"error",blockKind:m.kind});if(s&&w){let m=x.filter((v)=>v.kind!=="server"),O=[...new Set(m.flatMap((v)=>Dc(w,v.code)))];if(O.length>0)d.set(n,{names:O,line:m[0].startLine,kind:m[0].kind})}let N=h.dirname(h.resolve(n)),D=i?Lc(l,{runtimeGlobals:!u,originDir:N,filePath:h.resolve(n),componentsDir:p}):null,R=D?[...D.lineMap.values()].filter((m)=>m.expression).length:0;if(x.length===0&&R===0)continue;if(b.push(n),r+=x.length,o+=R,x.forEach((m,O)=>{let v=aa(m,w,N);g.set(ca(n,m.kind,O),{virtual:v,source:v.text,origin:n,kind:m.kind})}),D&&R>0)g.set(ca(n,"template",0),{source:D.text,origin:n,kind:"template",virtual:D})}if(g.size===0)return{diagnostics:y,checkedFiles:b,blockCount:0,expressionCount:0};let S=(t.extraLibs??[]).map((n)=>h.resolve(n)),ce=ie(e.length>0?h.dirname(h.resolve(e[0])):process.cwd(),Ee,B);for(let n of ce?.libs??[])if(!S.includes(n)&&B(n))S.push(n);if(u)S.push(u);let F=u?Fl():null;if(F)S.push(F);let G=`${c()}/typecheck/__stx_globals.d.ts`,ae=["// Generated \u2014 the context serve.ts injects into <script server> blocks.",Oc(u?Nc(K(u,"utf8")):void 0),...u?[]:["declare const window: any",...k.map((n)=>`declare const ${n}: any`)],["// Generated \u2014 the names stx auto-imports from @stacksjs/browser.",...Se.map((n)=>`declare const ${n}: any`)].join(`
|
|
13
|
-
`),Te(await
|
|
13
|
+
`),Te(await vo())].filter(Boolean).join(`
|
|
14
14
|
`),C=`${c()}/typecheck`;await Bun.$`rm -rf ${C}`.quiet().nothrow(),await Bun.$`mkdir -p ${C}`.quiet().nothrow(),await Bun.write(G,ae);let M=new Map,le=0;for(let[n,l]of g){let x=`${le++}_${n.replace(/[^\w.-]+/g,"_")}`;await Bun.write(`${C}/${x}`,l.source),M.set(x,l)}let ue={target:"ESNext",module:"ESNext",moduleResolution:"bundler",strict:!0,noEmit:!0,skipLibCheck:!0,allowJs:!0,esModuleInterop:!0,resolveJsonModule:!0,lib:["ESNext","DOM","DOM.Iterable"],types:[],...Ne(e.length>0?h.dirname(h.resolve(e[0])):process.cwd()),...t.compilerOptions??{}},V=async(n,l)=>{let x=`${C}/tsconfig${l===1?"":`.${l}`}.json`;await Bun.write(x,JSON.stringify({compilerOptions:ue,files:n.map((N)=>`${C}/${N}`).concat(G,...S)},null,2));let w=Bun.spawnSync(["bun","x","tsc","-p",x,"--pretty","false"],{stdout:"pipe",stderr:"pipe"});return{output:new TextDecoder().decode(w.stdout)+new TextDecoder().decode(w.stderr),exitCode:w.exitCode??0}},X=await V([...M.keys()],1),J=X.output,P=[],U=X.exitCode,W=0,pe=new Set(S.map((n)=>n.split("/").pop())),z=0,j=new Set,q=(n)=>{for(let l of n.replace(/\n[\t ]+([^\n]*)/g," $1").split(`
|
|
15
15
|
`)){let x=l.match(De);if(!x)continue;if(W++,pe.has(x[1].split("/").pop()))z++;let[,w,N,D,R,m,O]=x,v=w.split("/").pop(),T=M.get(v);if(!T)continue;if(re(Number(m)))j.add(v);let L=Number(N),A=Number(D),Q;if(T.virtual){let _=fi(T.virtual,L,A)??(T.kind!=="template"&&re(Number(m))?fi(T.virtual,T.virtual.sourceLineCount,1):null);if(!_||T.kind==="template"&&!_.expression)continue;if(jc(_,Number(m)))continue;L=_.line,A=_.column,Q=_.expression?.code.trim()}P.push({file:T.origin,line:L,column:A,code:Number(m),message:O,category:R==="error"?"error":"warning",blockKind:T.kind,expression:Q})}};q(J);let de=W,fe=z;if(j.size>0&&j.size<M.size){let n=[...M.keys()].filter((l)=>!j.has(l));q((await V(n,2)).output)}if(s)for(let[n,l]of d){if(l.names.length===0)continue;P.push({file:n,line:l.line,column:1,code:0,message:`${l.names.length===1?"1 value reaches":`${l.names.length} values reach`} this block on the implicit bridge and ${l.names.length===1?"is":"are"} untyped: ${l.names.join(", ")}. Declare them with defineClientPayload({ ${l.names.join(", ")} }) in the server block to have them checked.`,category:"warning",blockKind:l.kind})}P.push(...y);let H=new Set,I=P.filter((n)=>{let l=`${n.file}:${n.line}:${n.column}:${n.code}:${n.message}`;if(H.has(l))return!1;return H.add(l),!0});I.sort((n,l)=>n.file.localeCompare(l.file)||n.line-l.line||n.column-l.column);let Z=fe>0&&I.length===0,me=Z||U!==0&&de===0?`${Z?"a file passed with --lib has errors of its own, so nothing in your code was checked":`tsc exited ${U} without reporting any diagnostic, so nothing was checked`}. `+"A syntax error in an ambient declaration file does this \u2014 skipLibCheck suppresses "+`SEMANTIC diagnostics only. tsc said:
|
|
16
16
|
${J.trim().split(`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
`}import O from"path";var Y="stx-page-head:",Z=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,v={dev:null,prod:null};function Q(){let t=X()?"dev":"prod",r=v[t];if(r!==null)return r;try{let e=import.meta.require("./chunk-
|
|
2
|
+
import{Cn}from"./chunk-txd2js5v.js";import{q,y,Ot,Nt,Cr,m,nl,vi,W,R}from"./chunk-a1fp1nyf.js";import{en}from"./chunk-3s70qc9v.js";import{n}from"./chunk-0ygvav3v.js";import{X}from"./chunk-jr0r5pzw.js";var z=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function U(t){let r=[],e=/<!--[\s\S]*?(?:-->|$)|<(script|style|textarea|title|template)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,s;while((s=e.exec(t))!==null)r.push({start:s.index,end:s.index+s[0].length});return r}function N(t,r){return r.some((e)=>t>=e.start&&t<e.end)}function G(t){let r=(t||"").trim();if(!r)return null;if(/[\s>+~,:]/.test(r))return null;let e={},s=r,a=s.match(/^[a-z][\w-]*/i);if(a)e.tag=a[0].toLowerCase(),s=s.slice(a[0].length);while(s.length>0){let i=s.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(i){if(e.attr=i[1],i[3]!==void 0&&i[3]!=="")e.attrValue=i[3];s=s.slice(i[0].length);continue}let o=s.match(/^#([\w-]+)/);if(o){e.id=o[1],s=s.slice(o[0].length);continue}let c=s.match(/^\.([\w-]+)/);if(c){e.className=c[1],s=s.slice(c[0].length);continue}return null}if(!e.tag&&!e.attr&&!e.id&&!e.className)return null;return e}function J(t,r){if(r.attr){if(!(r.attrValue===void 0?new RegExp(`\\b${r.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${r.attr}\\s*=\\s*(["'])\\s*${r.attrValue}\\s*\\1`,"i")).test(t))return!1}if(r.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${r.id}\\s*\\1`,"i").test(t))return!1}if(r.className){let e=t.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!e)return!1;if(!e[2].split(/\s+/).includes(r.className))return!1}return!0}function P(t,r="main"){let e=G(r);if(!e)return null;let s=/<([a-z][\w-]*)\b([^>]*)>/gi,a=U(t),i;while((i=s.exec(t))!==null){if(N(i.index,a))continue;let o=i[1].toLowerCase(),c=i[2]||"";if(c.trimEnd().endsWith("/")||z.has(o))continue;if(e.tag&&e.tag!==o)continue;if(!J(c,e))continue;let l=i[0],u=i.index+l.length,f=new RegExp(`<(/?)${o}\\b([^>]*)>`,"gi");f.lastIndex=u;let p=1,h;while((h=f.exec(t))!==null){if(N(h.index,a))continue;let S=h[1]==="/";if(!S&&(h[2]||"").trimEnd().endsWith("/"))continue;if(p+=S?-1:1,p===0)return{openTag:l,openIndex:i.index,start:u,end:h.index,tagName:o}}return null}return null}var gt="private, no-store";function In(t){return t.replace(/&#(\d+);/g,(r,e)=>D(Number(e),r)).replace(/&#x([0-9a-f]+);/gi,(r,e)=>D(Number.parseInt(e,16),r)).replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/&/g,"&")}function D(t,r){if(!Number.isInteger(t)||t<0||t>1114111)return r;try{return String.fromCodePoint(t)}catch{return r}}function Ee(t){return t.headers.get("X-STX-Router")==="true"}function K(t,r){if(!t)return r;return t.split(",").some((s)=>s.trim().toLowerCase()===r.toLowerCase())?t:`${t}, ${r}`}function j(t){return{Vary:K(t,"X-STX-Router")}}function k(t){return t.replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function On(t){let r=/<head\b[^>]*>([\s\S]*?)<\/head\s*>/i.exec(t)?.[1]??"",e=/<(meta|link)\b(?:[^>"']|"[^"]*"|'[^']*')*>|<title\b[^>]*>[\s\S]*?<\/title\s*>/giy,s=y(r,(i,o)=>(e.lastIndex=o,e.exec(i)?e.lastIndex:-1)),a=[];for(let{token:i}of s){if(/^<title\b/i.test(i)){a.push(`<title>${k(i.replace(/^<title\b[^>]*>|<\/title\s*>$/gi,""))}</title>`);continue}let o=Object.create(null),c=i.replace(/^<\w+\b|>$/g,"");for(let l of c.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g)){let u=l[1].toLowerCase();if(!(u in o))o[u]=l[2]??l[3]??l[4]??""}if(/^<meta\b/i.test(i)){let l=o.property?"property":"name",u=In(o[l]??"").toLowerCase();if(u==="description"||/^(?:og|twitter):[\w:]+$/.test(u))a.push(`<meta ${l}="${n(u)}" content="${k(o.content??"")}">`)}else{let l=In(o.rel??"").toLowerCase();if(l==="canonical"||l==="alternate"&&o.hreflang)a.push(`<link rel="${l}" href="${k(o.href??"")}"${l==="alternate"?` hreflang="${k(o.hreflang)}"`:""}>`)}}return`<template data-stx-page-head="1">${a.join("")}</template>
|
|
3
|
+
`}import O from"path";var Y="stx-page-head:",Z=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,v={dev:null,prod:null};function Q(){let t=X()?"dev":"prod",r=v[t];if(r!==null)return r;try{let e=import.meta.require("./chunk-a1hxz8q4.js"),s=t==="dev"&&typeof e.getRouterScriptDev==="function"?e.getRouterScriptDev:e.getRouterScript;v[t]=`<script>${s()}</script>`}catch{v[t]=""}return v[t]}async function la(t,r){if(r===!1)return null;if(r&&typeof r==="string"){let s=O.resolve(t,r);if(await Bun.file(s).exists())return s;return null}let e=O.join(t,"app.stx");if(await Bun.file(e).exists())return e;return null}async function ho(t,r){try{let e=await Bun.file(t).text(),s=e,a=e.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if(a)s=a[1].trim();let i=en(e),o=[...i.client.map((g)=>g.fullTag),...i.signals.map((g)=>g.fullTag)],c=[],l=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,u;while((u=l.exec(e))!==null)c.push(u[0]);let f=s;for(let g of i.server)f=f.replace(g.fullTag,"");for(let g of i.client)f=f.replace(g.fullTag,"");f=f.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let p="<!--__STX_PAGE_SLOT__-->";if(f=f.replace(/<slot\s*\/>/gi,p).replace(/<slot\s*>\s*<\/slot>/gi,p),!f.includes(p))return console.warn(`[stx] Shell ${t} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:h,extractVariables:S,defaultConfig:w,loadStxConfig:b}=await import("./chunk-9fk98kja.js"),E=await b(),d={__filename:t,__dirname:O.dirname(t)};for(let g of o){let A=g.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(A&&!g.includes("client")&&!g.includes('type="module"'))await S(A[1],d,t)}let x=await h(f,d,t,{...w,...E,...r},new Set),C=x.indexOf(p);if(C===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:x.substring(0,C),afterSlot:x.substring(C+p.length),filePath:t,shellScripts:o,shellStyles:c}}catch(e){return console.error(`[stx] Error processing shell ${t}:`,e),null}}function Kr(t,r,e){let s,a="",i=r.match(Z);if(i){r=r.replace(i[0],"");try{let f=Buffer.from(i[1],"base64").toString("utf8"),p=f.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(p)s=p[1].trim();a=f.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let o=e||s||"stx App",c=Q(),l="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
|
|
4
4
|
<html lang="en">
|
|
5
5
|
<head>
|
|
6
6
|
<meta charset="UTF-8">
|
|
@@ -19,14 +19,14 @@ ${t.shellScripts.filter((f)=>!f.includes("server")).join(`
|
|
|
19
19
|
${l}
|
|
20
20
|
${c}
|
|
21
21
|
</body>
|
|
22
|
-
</html>`}function qe(t,r={}){let e=t.trim();if(!
|
|
22
|
+
</html>`}function qe(t,r={}){let e=t.trim();if(!Cn(e))return t;let s=[],a=e.match(/<head\b[^>]*>([\s\S]*?)<\/head>/i);if(a){let l=a[1],u=/<style\b[^>]*>[\s\S]*?<\/style>/gi,f;while((f=u.exec(l))!==null)s.push(f[0]);let p=l.match(/<script\b[^>]*data-stx-server-data[^>]*>[\s\S]*?<\/script>/i);if(p)s.push(p[0]);let h=l.match(/<script\b[^>]*data-stx-runtime-config[^>]*>[\s\S]*?<\/script>/i);if(h)s.push(h[0])}if(r.preserveHead&&a){let l=[],u=/<title\b[^>]*>[\s\S]*?<\/title>|<meta\b[^>]*>|<link\b[^>]*>/gi,f;while((f=u.exec(a[1]))!==null){if(/<meta\b[^>]*(?:\bcharset|name="viewport")/i.test(f[0]))continue;l.push(f[0])}if(l.length>0)s.unshift(`<!--${Y}${Buffer.from(l.join(`
|
|
23
23
|
`),"utf8").toString("base64")}-->`)}let i=e.match(/<body\b[^>]*>/i),o=e.lastIndexOf("</body>");if(i&&o!==-1){let l=i.index+i[0].length,u=e.slice(l,o).trim();if(s.length>0)return s.join(`
|
|
24
24
|
`)+`
|
|
25
25
|
`+u;return u}let c=e;if(c=c.replace(/<!DOCTYPE\b[^>]*>/i,""),c=c.replace(/<html\b[^>]*>/i,""),c=c.replace(/<\/html\s*>/i,""),a)c=c.replace(/<head\b[^>]*>[\s\S]*?<\/head>/i,s.join(`
|
|
26
|
-
`));return c=c.replace(/<body\b[^>]*>/i,""),c=c.replace(/<\/body\s*>/i,""),c.trim()}var F=/^<script\b[^>]*\sdata-stx-(?:owner|instance)(?=[\s=/>])/i;function L(t,r,e,s){if(!F.test(r))return!1;let a=r.slice(0,r.indexOf(">")+1),i=/\sdata-stx-owner="([^"]+)"/i.exec(a)?.[1];if(!i)return!0;let o=`data-stx-scope="${i}"`;for(let c=t.indexOf(o);c!==-1;c=t.indexOf(o,c+o.length))if(c>=e&&c<s)return!1;return!0}function ua(t){return Ee(t)}function tt(t,r){let e=[],s=new Set;for(let a of y(t,q)){if(a.start>=r.start&&a.start<r.end)continue;let i=a.token.match(/^<script\b((?:"[^"]*"|'[^']*'|[^'">])*)>/i)?.[1]??"",o=new Map;for(let u of i.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g))o.set(u[1].toLowerCase(),u[2]??u[3]??u[4]??"");let c=o.get("src")?.trim(),l=o.get("type")?.trim().toLowerCase();if(!c||o.has("server")||l&&!["module","text/javascript","application/javascript"].includes(l))continue;if(o.has("data-stx-runtime")||o.has("data-stx-router")||/^\/_stx\/(?:runtime|router)(?:\.[a-f0-9]{16})?\.js(?:[?#]|$)/i.test(c))continue;if(L(t,a.token,r.start,r.end)||s.has(a.token))continue;s.add(a.token),e.push(a.token)}return e}function Ke(t,r="main"){return!!P(t.trim(),r)}function Te(t,r="main",e=!1){let s=t.trim(),a=[],i=[],o=s.match(/<head\b[^>]*>([\s\S]*?)<\/head>/i);if(o){let x=o[1],C=/<style\b[^>]*>[\s\S]*?<\/style>/gi,g;while((g=C.exec(x))!==null)a.push(g[0]);let A=/<script\b[^>]*data-stx-(?:route-params|server-data|scoped|component-factories)[^>]*>[\s\S]*?<\/script>/gi;while((g=A.exec(x))!==null){if(F.test(g[0])||g[0].includes("__stx_early_mounts")||/^<script\b[^>]*\bdata-stx-runtime(?=[\s=>])/i.test(g[0]))continue;i.push(g[0])}}let c=P(s,r);if(!c)return(e?
|
|
26
|
+
`));return c=c.replace(/<body\b[^>]*>/i,""),c=c.replace(/<\/body\s*>/i,""),c.trim()}var F=/^<script\b[^>]*\sdata-stx-(?:owner|instance)(?=[\s=/>])/i;function L(t,r,e,s){if(!F.test(r))return!1;let a=r.slice(0,r.indexOf(">")+1),i=/\sdata-stx-owner="([^"]+)"/i.exec(a)?.[1];if(!i)return!0;let o=`data-stx-scope="${i}"`;for(let c=t.indexOf(o);c!==-1;c=t.indexOf(o,c+o.length))if(c>=e&&c<s)return!1;return!0}function ua(t){return Ee(t)}function tt(t,r){let e=[],s=new Set;for(let a of y(t,q)){if(a.start>=r.start&&a.start<r.end)continue;let i=a.token.match(/^<script\b((?:"[^"]*"|'[^']*'|[^'">])*)>/i)?.[1]??"",o=new Map;for(let u of i.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g))o.set(u[1].toLowerCase(),u[2]??u[3]??u[4]??"");let c=o.get("src")?.trim(),l=o.get("type")?.trim().toLowerCase();if(!c||o.has("server")||l&&!["module","text/javascript","application/javascript"].includes(l))continue;if(o.has("data-stx-runtime")||o.has("data-stx-router")||/^\/_stx\/(?:runtime|router)(?:\.[a-f0-9]{16})?\.js(?:[?#]|$)/i.test(c))continue;if(L(t,a.token,r.start,r.end)||s.has(a.token))continue;s.add(a.token),e.push(a.token)}return e}function Ke(t,r="main"){return!!P(t.trim(),r)}function Te(t,r="main",e=!1){let s=t.trim(),a=[],i=[],o=s.match(/<head\b[^>]*>([\s\S]*?)<\/head>/i);if(o){let x=o[1],C=/<style\b[^>]*>[\s\S]*?<\/style>/gi,g;while((g=C.exec(x))!==null)a.push(g[0]);let A=/<script\b[^>]*data-stx-(?:route-params|server-data|scoped|component-factories)[^>]*>[\s\S]*?<\/script>/gi;while((g=A.exec(x))!==null){if(F.test(g[0])||g[0].includes("__stx_early_mounts")||/^<script\b[^>]*\bdata-stx-runtime(?=[\s=>])/i.test(g[0]))continue;i.push(g[0])}}let c=P(s,r);if(!c)return(e?On(t):"")+qe(t);let l=tt(s,c),u=new Set(l),{tagName:f,start:p,end:h}=c,S=s.slice(p,h).trim(),w=[],b=s.match(/<body\b[^>]*>/i),E=s.lastIndexOf("</body>");if(b&&b.index!==void 0&&E!==-1){let C=[[b.index+b[0].length,c.openIndex],[h+`</${f}>`.length,E]],g=/<script\b[^>]*>[\s\S]*?<\/script>/gi;for(let[A,I]of C){if(A>=I)continue;let B=s.slice(A,I),_;g.lastIndex=0;while((_=g.exec(B))!==null){if(L(s,_[0],p,h))continue;w.push(_[0])}}}let d=[];if(e)d.push(On(t));if(a.length>0)d.push(a.join(`
|
|
27
27
|
`));if(l.length>0)d.push(l.join(`
|
|
28
28
|
`));if(i.length>0)d.push(i.filter((x)=>!u.has(x)).join(`
|
|
29
29
|
`));if(w.length>0)d.push(w.filter((x)=>!u.has(x)).join(`
|
|
30
30
|
`));return d.push(S),d.join(`
|
|
31
|
-
`)}import T from"fs";import H from"path";function da(t,r,e){return{version:1,buildTime:new Date().toISOString(),routes:t,assets:r,outputDir:e}}function pa(t,r){let e=H.join(r,"manifest.json");T.writeFileSync(e,JSON.stringify(t,null,2))}function fa(t){let r=H.join(t,"manifest.json");if(!T.existsSync(r))return null;try{let e=T.readFileSync(r,"utf-8"),s=JSON.parse(e);if(s.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${s.version}`),null;return s}catch(e){return console.warn("[stx] Failed to load manifest:",e),null}}function M(t,r,e={}){let s=`${encodeURIComponent(t)}=${encodeURIComponent(r)}`;if(e.maxAge!==void 0)s+=`; Max-Age=${e.maxAge}`;if(e.expires)s+=`; Expires=${e.expires.toUTCString()}`;if(e.path)s+=`; Path=${e.path}`;if(e.domain)s+=`; Domain=${e.domain}`;if(e.secure)s+="; Secure";if(e.httpOnly)s+="; HttpOnly";if(e.sameSite)s+=`; SameSite=${e.sameSite}`;return s}async function et(t){let r=t.headers.get("content-type")||"",e={},s=(a,i)=>{let o=e[a];if(o===void 0)e[a]=i;else if(Array.isArray(o))o.push(i);else e[a]=[o,i]};if(r.includes("multipart/form-data")){let a=await t.formData();for(let[i,o]of a.entries())if(typeof o==="string")s(i,o);return e}if(r.includes("application/x-www-form-urlencoded")){for(let[a,i]of new URLSearchParams(await t.text()).entries())s(a,i);return e}return e}function
|
|
32
|
-
export{gt,
|
|
31
|
+
`)}import T from"fs";import H from"path";function da(t,r,e){return{version:1,buildTime:new Date().toISOString(),routes:t,assets:r,outputDir:e}}function pa(t,r){let e=H.join(r,"manifest.json");T.writeFileSync(e,JSON.stringify(t,null,2))}function fa(t){let r=H.join(t,"manifest.json");if(!T.existsSync(r))return null;try{let e=T.readFileSync(r,"utf-8"),s=JSON.parse(e);if(s.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${s.version}`),null;return s}catch(e){return console.warn("[stx] Failed to load manifest:",e),null}}function M(t,r,e={}){let s=`${encodeURIComponent(t)}=${encodeURIComponent(r)}`;if(e.maxAge!==void 0)s+=`; Max-Age=${e.maxAge}`;if(e.expires)s+=`; Expires=${e.expires.toUTCString()}`;if(e.path)s+=`; Path=${e.path}`;if(e.domain)s+=`; Domain=${e.domain}`;if(e.secure)s+="; Secure";if(e.httpOnly)s+="; HttpOnly";if(e.sameSite)s+=`; SameSite=${e.sameSite}`;return s}async function et(t){let r=t.headers.get("content-type")||"",e={},s=(a,i)=>{let o=e[a];if(o===void 0)e[a]=i;else if(Array.isArray(o))o.push(i);else e[a]=[o,i]};if(r.includes("multipart/form-data")){let a=await t.formData();for(let[i,o]of a.entries())if(typeof o==="string")s(i,o);return e}if(r.includes("application/x-www-form-urlencoded")){for(let[a,i]of new URLSearchParams(await t.text()).entries())s(a,i);return e}return e}function yo(t){if(!t)return!1;let r=t.toUpperCase();return r!=="GET"&&r!=="HEAD"}async function V(t,r={}){let e=r.request,s=r.method??e?.method;if(!e||!yo(s))return{ran:!1};if(typeof t.action!=="function")return{ran:!1};let a={};try{a=await et(e)}catch{}let i=await t.action({request:e,form:a,params:r.params??{},query:t.query??{},cookies:r.cookies??{}});if(i&&typeof i==="object"){let o=i,c=nt(o.cookies),l=o.redirect;if(typeof l==="string"&&l)return{redirect:l,ran:!0,...c.length>0?{cookies:c}:{}};let{cookies:u,redirect:f,...p}=o;if(Object.assign(t,p),c.length>0)return{ran:!0,cookies:c}}return{ran:!0}}function nt(t){if(!t||typeof t!=="object"||Array.isArray(t))return[];let r=[];for(let[e,s]of Object.entries(t)){if(!e)continue;if(typeof s==="string"){r.push(M(e,s));continue}if(s&&typeof s==="object"){let a=s;if(typeof a.value!=="string")continue;r.push(M(e,a.value,a))}}return r}function ga(t,r=[],e){let s=new Headers({Location:t,"Cache-Control":"no-store"});for(let a of r)s.append("Set-Cookie",a);for(let[a,i]of Object.entries(e??{}))if(a.toLowerCase()!=="location")s.set(a,i);return new Response(null,{status:303,headers:s})}async function Nn(t,r={}){let{html:e,context:s,redirect:a,cookies:i}=await rt(t,r),o=Ot(s),c=Nt(s);if(a)return{html:e,redirect:a,cookies:i,status:o,headers:c};let{extractStreamBoundaries:l}=await import("./chunk-hhh6v5cw.js"),u=l(s),f=t.streamTemplates;if(f&&Object.keys(f).length>0){let{processDirectives:p}=await import("./chunk-x4x1xj40.js"),{defaultConfig:h}=await import("./chunk-tj90sfcs.js"),S=s.streamBoundaries||{},w={...h,autoShell:!1},b=Object.keys(f).map((d)=>({id:d,render:async()=>{let x=typeof S[d]==="function"?await S[d]():void 0;return p(f[d],{...s,$boundary:x},t.sourceFile,w,new Set)}})),E=new Set(b.map((d)=>d.id));u=[...(u||[]).filter((d)=>!E.has(d.id)),...b]}return{html:e,boundaries:u&&u.length>0?u:void 0,cookies:i,status:o,headers:c}}async function rt(t,r){let e={__filename:t.sourceFile,__dirname:t.sourceFile.replace(/[/\\][^/\\]+$/,""),...r};if(!t.hasServerScripts&&!vi(t.html))return{html:t.html,context:e};for(let o of t.serverScriptContent)try{await m(o,e,t.sourceFile)}catch(c){if(r.__stx_strict_hydration)throw c;console.warn(`[stx] Server script error in ${t.sourceFile}:`,c)}let s=await V(e,{request:r.request,method:r.method,params:r.params??{},cookies:r.cookies??{}}),a=(o)=>{let c=o.replace(/<script\b[^>]*\bdata-stx-server-data\b[^>]*>[\s\S]*?<\/script>/gi,""),l=Cr(e);if(!l)return c;let u=c.indexOf("</head>");return u<0?l+c:c.slice(0,u)+l+c.slice(u)};if(s.redirect)return{html:t.html,context:e,redirect:s.redirect,cookies:s.cookies};if(!vi(t.html))return{html:a(t.html),context:e,cookies:s.cookies};let i=new Map;for(let[o,c]of Object.entries(t.placeholders))if(c.expression)try{let l=R(c.expression,e);if(c.type==="raw")i.set(o,l!==void 0&&l!==null?String(l):"");else i.set(o,l!==void 0&&l!==null?W(String(l)):"")}catch(l){if(r.__stx_strict_hydration)throw l;i.set(o,"")}return{html:a(nl(t.html,i)),context:e,cookies:s.cookies}}
|
|
32
|
+
export{gt,In,Ee,j,On,la,ho,Kr,qe,ua,Ke,Te,da,pa,fa,yo,ga,Nn};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{wa,cu,Hn,Mm,lu,uu,du,Dm}from"./chunk-mvk7rm5q.js";import"./chunk-a1fp1nyf.js";import"./chunk-6eqjf0r6.js";import"./chunk-vfj9wp11.js";import"./chunk-txd2js5v.js";import"./chunk-s6r54dyf.js";import"./chunk-4ntm3dtk.js";export{Hn as Validator,cu as defineForm,lu as processErrorDirective,uu as processErrorsDirective,Dm as processFormValidationDirectives,du as processHasErrorsDirective,wa as useForm,Mm as v};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Yg}from"./chunk-9cy3fy0k.js";import"./chunk-1pg50kva.js";import"./chunk-3s70qc9v.js";import"./chunk-53gp3w46.js";import"./chunk-0ygvav3v.js";import"./chunk-wpy1ytv9.js";import"./chunk-02s0hzwa.js";import"./chunk-h8pp1dsq.js";import"./chunk-gh62p9mx.js";import"./chunk-amg6kr1p.js";import"./chunk-ms3v5nat.js";import"./chunk-29f6vmyz.js";import"./chunk-a1fp1nyf.js";import"./chunk-6eqjf0r6.js";import"./chunk-vfj9wp11.js";import"./chunk-txd2js5v.js";import"./chunk-s6r54dyf.js";import"./chunk-4ntm3dtk.js";export{Yg as startProductionServer};
|
|
@@ -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,9 +1,9 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import R from"path";var O=/__stxModules\["((?:[^"\\]|\\.)*)"\]/g;function
|
|
3
|
-
`)}async function Hg(g,d={}){if(g.length===0)return null;let c=process.cwd(),s=v(g,c,d.names),e;try{let{bundleClientScript:l}=await import("./chunk-
|
|
2
|
+
import R from"path";var O=/__stxModules\["((?:[^"\\]|\\.)*)"\]/g;function jr(...g){let d=new Set;for(let c of g){if(!c||!c.includes("__stxModules["))continue;for(let s of c.matchAll(O))try{d.add(JSON.parse(`"${s[1]}"`))}catch{}}return[...d].sort()}function oo(...g){let d=new Map,c=(s,e)=>{let r=d.get(s);if(r===null)return;if(e===null){d.set(s,null);return}let n=r??new Set;for(let i of e)n.add(i);d.set(s,n)};for(let s of g){if(!s||!s.includes("__stxModules["))continue;let e=[];for(let n of s.matchAll(/([\w$]+)\s*=\s*globalThis\.__stxModules\s*&&\s*globalThis\.__stxModules\["((?:[^"\\]|\\.)*)"\]/g)){let i;try{i=JSON.parse(`"${n[2]}"`)}catch{continue}e.push({variable:n[1],id:i,start:n.index+n[0].length,end:s.length})}let r=s.match(/__stxModules\["(?:[^"\\]|\\.)*"\]/g)?.length??0;if(e.length===0||r!==e.length){for(let n of jr(s))c(n,null);continue}for(let[n,i]of e.entries()){let p=e.slice(n+1).find((h)=>h.variable===i.variable);i.end=p?p.start:s.length}for(let n of e){let i=new Set,p=!1,h=n.variable.replace(/[$]/g,"\\$&"),o=s.slice(n.start,n.end);for(let l of o.matchAll(new RegExp(`(?<![\\w$.])${h}(?![\\w$])`,"g"))){let f=o.slice(l.index+n.variable.length,l.index+n.variable.length+200),a=/^\s*\[\s*(["'])([A-Za-z_$][\w$]*)\1\s*\]/.exec(f)??/^\s*\.\s*([A-Za-z_$][\w$]*)/.exec(f);if(a){i.add(a[a.length-1]);continue}if(/^\s*[!=]==?\s*(?:undefined|void 0)\b/.test(f))continue;p=!0;break}c(n.id,p?null:i)}}return d}function v(g,d,c){let s=[],e=[];return g.forEach((r,n)=>{let i=r.startsWith("npm:")?r.slice(4):R.resolve(d,r),p=`__stxRegistered${n}`,h=JSON.stringify(r),o=c?.get(r);if(o&&[...o].every((l)=>/^[A-Za-z_$][\w$]*$/.test(l))){let l=[...o].sort(),f=l.map((m,_)=>`${m} as ${p}_${_}`);s.push(l.length>0?`import { ${f.join(", ")} } from ${JSON.stringify(i)};`:`import ${JSON.stringify(i)};`);let a=l.map((m,_)=>`get ${JSON.stringify(m)}() { return ${p}_${_}; }`).join(", ");e.push(`if (!globalThis.__stxModules[${h}]) globalThis.__stxModules[${h}] = { ${a} };`);return}s.push(`import * as ${p} from ${JSON.stringify(i)};`),e.push(`if (!globalThis.__stxModules[${h}]) globalThis.__stxModules[${h}] = ${p};`)}),[...s,"globalThis.__stxModules = globalThis.__stxModules || {};",...e].join(`
|
|
3
|
+
`)}async function Hg(g,d={}){if(g.length===0)return null;let c=process.cwd(),s=v(g,c,d.names),e;try{let{bundleClientScript:l}=await import("./chunk-j6146c13.js"),f=()=>l(s,R.join(c,".stx-module-registry.ts"),{projectRoot:c,minify:d.minify,externalizeUserModules:!1,collectInputs:d.collectInputs,throwOnFailure:!0});try{e=await f()}catch(a){if(!d.names)throw a;s=v(g,c,void 0),e=await f()}}catch(l){let{formatBuildFailure:f}=await import("./chunk-0rnfywsx.js"),a=f(l);console.warn(`[stx] could not build the page module registry (#1957): ${a}`);let m=`[stx] the page module registry did not build, so ${g.join(", ")} cannot load (#1957): ${a}`;return`;console.error(${JSON.stringify(m)});`}let{transformAutoImports:r,generateAutoImportDestructuring:n}=await import("./chunk-nbz025jk.js"),i=r(e),p=n(i.stxImports,i.browserImports),{transformStoreImports:h}=await import("./chunk-pwv77cyb.js");e=h(i.code);let o=JSON.stringify(new Bun.CryptoHasher("md5").update(s).digest("hex").slice(0,12));return[";(function() {"," var __stxBundles = globalThis.__stxModuleBundles || (globalThis.__stxModuleBundles = {});",` if (__stxBundles[${o}]) return;`,` __stxBundles[${o}] = true;`,p,e,"})();"].join(`
|
|
4
4
|
`)}var P=/^import(?:[ \t]*(\{[^}]*\})[ \t]*from|[ \t]*\*[ \t]*as[ \t]+([\w$]+)[ \t]+from)?[ \t]*["']\.\/(chunk-[\w-]+)\.js["'][ \t]*;?[ \t]*$/gm,j=/^export\s*\{([^}]*)\}\s*;?[ \t]*$/gm,I=new Set(["__preload","__chunks"]),N=/^("[^"]*"|[\w$]+)(?:\s+as\s+("[^"]*"|[\w$]+))?$/;function J(g){let d=[],c=[],s=!0,r=g.replace(/^var __chunkGraphs;[\s\S]*?^var __chunks = [\s\S]*?^\};[ \t]*\n?/m,"").replace(/^__chunks\(import\.meta\.url,[^\n]*\);[ \t]*\n?/gm,"").replace(P,(h,o,l,f)=>{let a=`__stxChunkExports${d.length}`;if(d.push(f),c.push(`var ${a} = __stxChunk(${JSON.stringify(f)});`),l)c.push(`var ${l} = ${a};`);else if(o)for(let m of o.slice(1,-1).split(",")){let _=m.trim();if(!_)continue;let w=N.exec(_);if(!w){s=!1;continue}if(I.has(w[1]))continue;let M=w[1].startsWith('"')?JSON.parse(w[1]):w[1],t=w[2]??w[1];if(t.startsWith('"')){s=!1;continue}c.push(`var ${t} = ${a}[${JSON.stringify(M)}];`)}return""});if(!s)throw Error("an import it does not read");let n=[];r=r.replace(/\(\s*__preload\([^)]*\)\s*,\s*import\(\s*["']\.\/(chunk-[\w-]+)\.js["']\s*\)\s*\)|\bimport\(\s*["']\.\/(chunk-[\w-]+)\.js["']\s*\)/g,(h,o,l)=>{let f=o??l;return n.push(f),`Promise.resolve().then(function () { return __stxChunk(${JSON.stringify(f)}); })`});let i=[];r=r.replace(j,(h,o)=>{for(let l of o.split(",")){let f=l.trim();if(!f)continue;let a=N.exec(f);if(!a||a[1].startsWith('"')){s=!1;continue}if(I.has(a[1]))continue;let m=a[2]??a[1];i.push([a[1],m.startsWith('"')?JSON.parse(m):m])}return""});let p=[/\bimport\.meta\b/,/\b__chunks\b/,/\b__preload\b/,/^\s*export\s+(?:default\b|const\b|let\b|var\b|function\b|class\b|async\b|\*|\{)/m,/\bfrom\s*["']\.\/chunk-/,/^\s*import\s*["']\.\/chunk-/m].find((h)=>h.test(r));if(!s||p)throw Error(`${p?`${p.source} is left in it`:"an export it does not read"}`);return{reads:c.join(`
|
|
5
5
|
`),chunks:d,lazy:n,body:r,exports:i}}function Tl(g){if(/\bexport\s+(?:let|var)\b/.test(g))return!0;if(g.length/Math.max(1,g.split(`
|
|
6
|
-
`).length)>200)return!1;for(let d of g.matchAll(/\bexport\s*\{([^}]*)\}(?!\s*from\b)/g))for(let c of d[1].split(",")){let s=c.trim().split(/\s+as\s+/)[0].trim();if(!/^[A-Za-z_$][\w$]*$/.test(s))continue;let e=s.replace(/[$]/g,"\\$&");if(!new RegExp(`(?<![\\w$.])(?:let|var)\\s+${e}(?![\\w$])`,"g").test(g))continue;let n=new RegExp(`(?<![\\w$.])${e}\\s*(?:=(?![=>])|[-+*/%&|^]=|\\*\\*=|<<=|>>>?=|&&=|\\|\\|=|\\?\\?=|\\+\\+|--)|(?:\\+\\+|--)\\s*${e}(?![\\w$])`,"g"),i=new RegExp(`(?<![\\w$.])(?:let|var|const)\\s+${e}\\s*=`,"g");if((g.match(n)?.length??0)>(g.match(i)?.length??0))return!0}return!1}async function
|
|
6
|
+
`).length)>200)return!1;for(let d of g.matchAll(/\bexport\s*\{([^}]*)\}(?!\s*from\b)/g))for(let c of d[1].split(",")){let s=c.trim().split(/\s+as\s+/)[0].trim();if(!/^[A-Za-z_$][\w$]*$/.test(s))continue;let e=s.replace(/[$]/g,"\\$&");if(!new RegExp(`(?<![\\w$.])(?:let|var)\\s+${e}(?![\\w$])`,"g").test(g))continue;let n=new RegExp(`(?<![\\w$.])${e}\\s*(?:=(?![=>])|[-+*/%&|^]=|\\*\\*=|<<=|>>>?=|&&=|\\|\\|=|\\?\\?=|\\+\\+|--)|(?:\\+\\+|--)\\s*${e}(?![\\w$])`,"g"),i=new RegExp(`(?<![\\w$.])(?:let|var|const)\\s+${e}\\s*=`,"g");if((g.match(n)?.length??0)>(g.match(i)?.length??0))return!0}return!1}async function io(g,d={}){let c=g.filter((e)=>e.ids.length>0);if(c.length===0)return{chunks:new Map,routes:new Map,reads:new Map};let s=process.cwd();try{let{bundleClientEntriesSplit:e}=await import("./chunk-j6146c13.js"),r=[],n=await e(new Map(c.map((t)=>[t.name,v(t.ids,s,t.names)])),{projectRoot:s,filePath:R.join(s,".stx-module-registry.ts"),collectInputs:r});d.collectInputs?.push(...r);let{transformAutoImports:i,generateAutoImportDestructuring:p}=await import("./chunk-nbz025jk.js"),{transformStoreImports:h}=await import("./chunk-pwv77cyb.js"),o=new Map;for(let[t,u]of[...n.chunks,...n.entries])try{o.set(t,J(u))}catch(b){throw Error(`cannot read ${t}: ${b instanceof Error?b.message:String(b)}`)}for(let[t,u]of[...n.chunks,...n.entries])if(/\b__esm\(/.test(u))throw Error(`${t} initialises a module lazily`);for(let t of r)if(/\.(?:[cm]?[jt]sx?)$/.test(t)&&Tl(await Bun.file(t).text()))throw Error(`${t} exports a binding that changes after it is read`);let l=new Set,f=new Set,a=(t)=>{if(f.has(t))return;if(l.has(t))throw Error(`the chunks import each other (${t})`);l.add(t);for(let u of o.get(t)?.chunks??[]){if(!o.has(u))throw Error(`${t} imports ${u}, which was not built`);a(u)}for(let u of o.get(t)?.lazy??[])if(!o.has(u))throw Error(`${t} imports ${u}, which was not built`);l.delete(t),f.add(t)};for(let t of o.keys())a(t);let m=(t)=>{let u=i(t.body);return{prelude:p(u.stxImports,u.browserImports),body:h(u.code)}},_=new Map;for(let t of n.chunks.keys()){let u=o.get(t),{prelude:b,body:k}=m(u),y=u.exports.map(([S,x])=>`get ${JSON.stringify(x)}() { return ${S}; }`).join(", ");_.set(t,`function (__stxChunk) {
|
|
7
7
|
${b}
|
|
8
8
|
${u.reads}
|
|
9
9
|
${k}
|
|
@@ -13,5 +13,5 @@ var __stxChunk = function (name) { return globalThis.__stxNativeRuntime.chunk(na
|
|
|
13
13
|
${b}
|
|
14
14
|
${u.reads}
|
|
15
15
|
${k}
|
|
16
|
-
})();`);let y=new Set,S=(x)=>{if(y.has(x))return;y.add(x);let E=o.get(x);for(let A of[...E.chunks,...E.lazy])S(A)};for(let x of[...u.chunks,...u.lazy])S(x);M.set(t,[...y].sort())}return{chunks:_,routes:w,reads:M}}catch(e){let{formatBuildFailure:r}=await import("./chunk-
|
|
17
|
-
export{
|
|
16
|
+
})();`);let y=new Set,S=(x)=>{if(y.has(x))return;y.add(x);let E=o.get(x);for(let A of[...E.chunks,...E.lazy])S(A)};for(let x of[...u.chunks,...u.lazy])S(x);M.set(t,[...y].sort())}return{chunks:_,routes:w,reads:M}}catch(e){let{formatBuildFailure:r}=await import("./chunk-0rnfywsx.js");return console.warn(`[stx] could not share the native routes' modules, building each route's alone: ${r(e)}`),null}}
|
|
17
|
+
export{jr,oo,Hg,Tl,io};
|
|
@@ -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};
|