@stacksjs/stx 0.2.864 → 0.2.865
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-4w8a7f8t.js → chunk-0dyec13e.js} +1 -1
- package/dist/{chunk-az12j7cr.js → chunk-16qzr5ga.js} +1 -1
- package/dist/{chunk-wxng15a3.js → chunk-2hq6mq6r.js} +1 -1
- package/dist/chunk-2qjyzekc.js +3 -0
- package/dist/{chunk-sxdzpv90.js → chunk-46x7a1cj.js} +1 -1
- package/dist/chunk-49r1z20v.js +2 -0
- package/dist/chunk-4b0mjyn7.js +2 -0
- package/dist/{chunk-brs63ht2.js → chunk-4q0rgnw0.js} +2 -2
- package/dist/{chunk-qjbjn6vz.js → chunk-4sfrfag1.js} +4 -4
- package/dist/{chunk-ehd68fc7.js → chunk-5ep1qbjt.js} +1 -1
- package/dist/{chunk-zdrn7wp0.js → chunk-67xreg70.js} +3 -3
- package/dist/{chunk-pghp2tkv.js → chunk-6pqfar3p.js} +1 -1
- package/dist/{chunk-fh8jzm4b.js → chunk-764f1sf1.js} +1 -1
- package/dist/chunk-77km1je8.js +2 -0
- package/dist/{chunk-vkj9fem6.js → chunk-78eyz4ch.js} +1 -1
- package/dist/chunk-822gnnpd.js +2 -0
- package/dist/{chunk-gheba4nb.js → chunk-86xt8cs8.js} +1 -1
- package/dist/{chunk-ndez5ee8.js → chunk-8efn9agz.js} +2 -2
- package/dist/{chunk-ez6e7rh1.js → chunk-97cyjqa5.js} +1 -1
- package/dist/{chunk-cdbmfe7d.js → chunk-98v8smzf.js} +1 -1
- package/dist/{chunk-df0ry01a.js → chunk-9tsp5ytb.js} +1 -1
- package/dist/{chunk-6mhj42gz.js → chunk-a2yk8sw0.js} +4 -4
- package/dist/{chunk-eq40b4n4.js → chunk-ajkqbjbp.js} +1 -1
- package/dist/{chunk-d10cq130.js → chunk-angv3d3s.js} +1 -1
- package/dist/{chunk-8010hzhm.js → chunk-aqn8y42n.js} +1 -1
- package/dist/{chunk-a98jgxkb.js → chunk-bzt73fj0.js} +1 -1
- package/dist/chunk-c2bhc5wg.js +2 -0
- package/dist/{chunk-axkgbc0k.js → chunk-c57g2mtw.js} +1 -1
- package/dist/{chunk-x5n2jc6m.js → chunk-c60qda5c.js} +1 -1
- package/dist/{chunk-t2a6j64z.js → chunk-dx2t73jn.js} +4 -4
- package/dist/{chunk-8yybk485.js → chunk-dy1d7ep7.js} +1 -1
- package/dist/{chunk-epct9fqd.js → chunk-e8y2c1sq.js} +1 -1
- package/dist/{chunk-8ay0nq31.js → chunk-efjmpq6r.js} +2 -2
- package/dist/{chunk-ppfp1w98.js → chunk-et9pa7gr.js} +1 -1
- package/dist/{chunk-q22fpqtr.js → chunk-f57t1bcs.js} +1 -1
- package/dist/{chunk-t9r644tq.js → chunk-f5vdse5a.js} +1 -1
- package/dist/{chunk-wcvzsyf1.js → chunk-fbtm3frc.js} +2 -2
- package/dist/{chunk-7wpk300q.js → chunk-fm9kas0a.js} +1 -1
- package/dist/{chunk-p8x0a0fp.js → chunk-fnha6bbj.js} +2 -2
- package/dist/{chunk-pfs0gv2a.js → chunk-g8zgfmk3.js} +1 -1
- package/dist/{chunk-0zxzcrns.js → chunk-gp7derwj.js} +1 -1
- package/dist/{chunk-mrw6vmqy.js → chunk-gwa31y9x.js} +1 -1
- package/dist/{chunk-tbq6msyc.js → chunk-hdyacfen.js} +1 -1
- package/dist/{chunk-kh7hbgx6.js → chunk-hwqrejq3.js} +1 -1
- package/dist/{chunk-hpfq5qe4.js → chunk-j4mtcbvz.js} +5 -5
- package/dist/{chunk-syzggy76.js → chunk-mkyn95mf.js} +1 -1
- package/dist/{chunk-ptxptv29.js → chunk-p2f308sq.js} +1 -1
- package/dist/{chunk-1smbjj34.js → chunk-p8apfhg9.js} +1 -1
- package/dist/{chunk-f0b3ca2n.js → chunk-razx95wk.js} +1 -1
- package/dist/{chunk-8v8eawjw.js → chunk-rb41t77f.js} +1 -1
- package/dist/{chunk-rme1a5qv.js → chunk-rkd27m4m.js} +6 -6
- package/dist/chunk-tx6t331f.js +2 -0
- package/dist/{chunk-qcvfzskb.js → chunk-v4pswhj1.js} +1 -1
- package/dist/{chunk-jwghpcqn.js → chunk-w19myass.js} +1 -1
- package/dist/{chunk-y69k2fww.js → chunk-w1vk83kx.js} +1 -1
- package/dist/{chunk-18qvx7b0.js → chunk-x1zzy6c7.js} +1 -1
- package/dist/{chunk-yrstc4z4.js → chunk-x95031qg.js} +1 -1
- package/dist/{chunk-6y066pr2.js → chunk-xempkjvd.js} +1 -1
- package/dist/{chunk-83qwwnye.js → chunk-xt1cxmkx.js} +2 -2
- package/dist/{chunk-53797jvm.js → chunk-yq0kcw7h.js} +1 -1
- package/dist/chunk-z4yzk0d4.js +2 -0
- package/dist/{chunk-cwjt04kc.js → chunk-z98qxjne.js} +1 -1
- package/dist/{chunk-ma1tf68v.js → chunk-zacjg4p1.js} +1 -1
- package/dist/{chunk-h4rjzbek.js → chunk-zfd9dmsn.js} +4 -4
- package/dist/cli.js +7 -7
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/pwa.js +1 -1
- package/dist/ssg.js +2 -2
- package/package.json +5 -5
- package/dist/chunk-28nk2zej.js +0 -2
- package/dist/chunk-2mgajzam.js +0 -2
- package/dist/chunk-6nzdsh2c.js +0 -2
- package/dist/chunk-709hfmpj.js +0 -2
- package/dist/chunk-byve4g2y.js +0 -2
- package/dist/chunk-v7jjrz5k.js +0 -2
- package/dist/chunk-w463vqkh.js +0 -2
- package/dist/chunk-xsscsar3.js +0 -3
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{fn,Lo,jo,Bo,Hh,Fo}from"./chunk-
|
|
2
|
+
import{fn,Lo,jo,Bo,Hh,Fo}from"./chunk-764f1sf1.js";import"./chunk-rw5492e2.js";import"./chunk-kh6njq2r.js";import"./chunk-k32q90b2.js";export{jo as buildServerApi,Hh as createServerApi,fn as discoverServerApi,Lo as generateApiTypes,Fo as isServerApiSource,Bo as productionApiDispatcher};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{An}from"./chunk-g0xn80gz.js";import{X,w,Bt,Ft,Pr,h,gl,$i,G,I}from"./chunk-
|
|
2
|
+
import{An}from"./chunk-g0xn80gz.js";import{X,w,Bt,Ft,Pr,h,gl,$i,G,I}from"./chunk-rkd27m4m.js";import{an}from"./chunk-97cyjqa5.js";import{n}from"./chunk-2qjyzekc.js";import{Y}from"./chunk-bwdbj60y.js";import{D,c}from"./chunk-fd1bpv35.js";var J=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function K(t){let s=[],e=/<!--[\s\S]*?(?:-->|$)|<(script|style|textarea|title|template)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,r;while((r=e.exec(t))!==null)s.push({start:r.index,end:r.index+r[0].length});return s}function N(t,s){return s.some((e)=>t>=e.start&&t<e.end)}function Z(t){let s=(t||"").trim();if(!s)return null;if(/[\s>+~,:]/.test(s))return null;let e={},r=s,i=r.match(/^[a-z][\w-]*/i);if(i)e.tag=i[0].toLowerCase(),r=r.slice(i[0].length);while(r.length>0){let o=r.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(o){if(e.attr=o[1],o[3]!==void 0&&o[3]!=="")e.attrValue=o[3];r=r.slice(o[0].length);continue}let l=r.match(/^#([\w-]+)/);if(l){e.id=l[1],r=r.slice(l[0].length);continue}let a=r.match(/^\.([\w-]+)/);if(a){e.className=a[1],r=r.slice(a[0].length);continue}return null}if(!e.tag&&!e.attr&&!e.id&&!e.className)return null;return e}function Q(t,s){if(s.attr){if(!(s.attrValue===void 0?new RegExp(`\\b${s.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${s.attr}\\s*=\\s*(["'])\\s*${s.attrValue}\\s*\\1`,"i")).test(t))return!1}if(s.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${s.id}\\s*\\1`,"i").test(t))return!1}if(s.className){let e=t.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!e)return!1;if(!e[2].split(/\s+/).includes(s.className))return!1}return!0}function P(t,s="main"){let e=Z(s);if(!e)return null;let r=/<([a-z][\w-]*)\b([^>]*)>/gi,i=K(t),o;while((o=r.exec(t))!==null){if(N(o.index,i))continue;let l=o[1].toLowerCase(),a=o[2]||"";if(a.trimEnd().endsWith("/")||J.has(l))continue;if(e.tag&&e.tag!==l)continue;if(!Q(a,e))continue;let u=o[0],g=o.index+u.length,f=new RegExp(`<(/?)${l}\\b([^>]*)>`,"gi");f.lastIndex=g;let d=1,x;while((x=f.exec(t))!==null){if(N(x.index,i))continue;let y=x[1]==="/";if(!y&&(x[2]||"").trimEnd().endsWith("/"))continue;if(d+=y?-1:1,d===0)return{openTag:u,openIndex:o.index,start:g,end:x.index,tagName:l}}return null}return null}var wt="private, no-store";function en(t){return t.replace(/&#(\d+);/g,(s,e)=>F(Number(e),s)).replace(/&#x([0-9a-f]+);/gi,(s,e)=>F(Number.parseInt(e,16),s)).replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/&/g,"&")}function F(t,s){if(!Number.isInteger(t)||t<0||t>1114111)return s;try{return String.fromCodePoint(t)}catch{return s}}function Ae(t){return t.headers.get("X-STX-Router")==="true"}function tt(t,s){if(!t)return s;return t.split(",").some((r)=>r.trim().toLowerCase()===s.toLowerCase())?t:`${t}, ${s}`}function z(t){return{Vary:tt(t,"X-STX-Router")}}function E(t){return t.replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function L(t){let s=/<head\b[^>]*>([\s\S]*?)<\/head\s*>/i.exec(t)?.[1]??"",e=/<(meta|link)\b(?:[^>"']|"[^"]*"|'[^']*')*>|<title\b[^>]*>[\s\S]*?<\/title\s*>/giy;return w(s,(r,i)=>(e.lastIndex=i,e.exec(r)?e.lastIndex:-1)).map(({token:r})=>r)}function H(t){let s=Object.create(null),e=t.replace(/^<\w+\b|>$/g,"");for(let r of e.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g)){let i=r[1].toLowerCase();if(!(i in s))s[i]=r[2]??r[3]??r[4]??""}return s}function Ln(t){let s=[];for(let e of L(t)){if(/^<title\b/i.test(e)){s.push(`<title>${E(e.replace(/^<title\b[^>]*>|<\/title\s*>$/gi,""))}</title>`);continue}let r=H(e);if(/^<meta\b/i.test(e)){let i=r.property?"property":"name",o=en(r[i]??"").toLowerCase();if(o==="description"||/^(?:og|twitter):[\w:]+$/.test(o))s.push(`<meta ${i}="${n(o)}" content="${E(r.content??"")}">`)}else{let i=en(r.rel??"").toLowerCase();if(i==="canonical"||i==="alternate"&&r.hreflang)s.push(`<link rel="${i}" href="${E(r.href??"")}"${i==="alternate"?` hreflang="${E(r.hreflang)}"`:""}>`)}}return`<template data-stx-page-head="1">${s.join("")}</template>
|
|
3
3
|
`}var et=["media","crossorigin","integrity"];function jn(t){let s=[];for(let e of L(t)){if(!/^<link\b/i.test(e))continue;let r=H(e);if(en(r.rel??"").trim().toLowerCase()!=="stylesheet")continue;if(!r.href||"data-css"in r||"disabled"in r)continue;let i=et.filter((o)=>(o in r)).map((o)=>` ${o}="${E(r[o])}"`).join("");s.push(`<link rel="stylesheet" href="${E(r.href)}"${i}>`)}return s.length?`<template data-stx-page-css="1">${s.join("")}</template>
|
|
4
|
-
`:""}import T from"path";var nt="stx-page-head:",rt=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,_={dev:null,prod:null};function st(){let t=Y()?"dev":"prod",s=_[t];if(s!==null)return s;try{let e=import.meta.require("./chunk-5kkq2eqr.js"),r=t==="dev"&&typeof e.getRouterScriptDev==="function"?e.getRouterScriptDev:e.getRouterScript;_[t]=`<script>${r()}</script>`}catch{_[t]=""}return _[t]}async function wa(t,s){if(s===!1)return null;if(s&&typeof s==="string"){let r=T.resolve(t,s);if(await Bun.file(r).exists())return r;return null}let e=T.join(t,"app.stx");if(await Bun.file(e).exists())return e;return null}async function So(t,s){try{let e=await Bun.file(t).text(),r=e,i=e.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if(i)r=i[1].trim();let o=an(e),l=[...o.client.map((p)=>p.fullTag),...o.signals.map((p)=>p.fullTag)],a=[],u=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,g;while((g=u.exec(e))!==null)a.push(g[0]);let f=r;for(let p of o.server)f=f.replace(p.fullTag,"");for(let p of o.client)f=f.replace(p.fullTag,"");f=f.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let d="<!--__STX_PAGE_SLOT__-->";if(f=f.replace(/<slot\s*\/>/gi,d).replace(/<slot\s*>\s*<\/slot>/gi,d),!f.includes(d))return console.warn(`[stx] Shell ${t} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:x,extractVariables:y,defaultConfig:R,loadStxConfig:b}=await import("./chunk-
|
|
4
|
+
`:""}import T from"path";var nt="stx-page-head:",rt=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,_={dev:null,prod:null};function st(){let t=Y()?"dev":"prod",s=_[t];if(s!==null)return s;try{let e=import.meta.require("./chunk-5kkq2eqr.js"),r=t==="dev"&&typeof e.getRouterScriptDev==="function"?e.getRouterScriptDev:e.getRouterScript;_[t]=`<script>${r()}</script>`}catch{_[t]=""}return _[t]}async function wa(t,s){if(s===!1)return null;if(s&&typeof s==="string"){let r=T.resolve(t,s);if(await Bun.file(r).exists())return r;return null}let e=T.join(t,"app.stx");if(await Bun.file(e).exists())return e;return null}async function So(t,s){try{let e=await Bun.file(t).text(),r=e,i=e.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if(i)r=i[1].trim();let o=an(e),l=[...o.client.map((p)=>p.fullTag),...o.signals.map((p)=>p.fullTag)],a=[],u=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,g;while((g=u.exec(e))!==null)a.push(g[0]);let f=r;for(let p of o.server)f=f.replace(p.fullTag,"");for(let p of o.client)f=f.replace(p.fullTag,"");f=f.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let d="<!--__STX_PAGE_SLOT__-->";if(f=f.replace(/<slot\s*\/>/gi,d).replace(/<slot\s*>\s*<\/slot>/gi,d),!f.includes(d))return console.warn(`[stx] Shell ${t} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:x,extractVariables:y,defaultConfig:R,loadStxConfig:b}=await import("./chunk-822gnnpd.js"),k=await b(),m={__filename:t,__dirname:T.dirname(t)};for(let p of l){let A=p.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(A&&!p.includes("client")&&!p.includes('type="module"'))await y(A[1],m,t)}let S=await x(f,m,t,{...R,...k,...s},new Set),C=S.indexOf(d);if(C===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:S.substring(0,C),afterSlot:S.substring(C+d.length),filePath:t,shellScripts:l,shellStyles:a}}catch(e){return console.error(`[stx] Error processing shell ${t}:`,e),null}}function Qr(t,s,e){let r,i="",o=s.match(rt);if(o){s=s.replace(o[0],"");try{let f=Buffer.from(o[1],"base64").toString("utf8"),d=f.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(d)r=d[1].trim();i=f.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let l=e||r||"stx App",a=st(),u="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
|
|
5
5
|
<html lang="en">
|
|
6
6
|
<head>
|
|
7
7
|
<meta charset="UTF-8">
|
|
@@ -29,5 +29,5 @@ ${a}
|
|
|
29
29
|
`));if(o.length>0)m.push(o.filter((S)=>!g.has(S)).join(`
|
|
30
30
|
`));if(R.length>0)m.push(R.filter((S)=>!g.has(S)).join(`
|
|
31
31
|
`));return m.push(y),m.join(`
|
|
32
|
-
`)}import O from"fs";import q from"path";function xa(t,s,e){return{version:1,buildTime:new Date().toISOString(),routes:t,assets:s,outputDir:e}}function Sa(t,s){let e=q.join(s,"manifest.json");O.writeFileSync(e,JSON.stringify(t,null,2))}function ka(t){let s=q.join(t,"manifest.json");if(!O.existsSync(s))return null;try{let e=O.readFileSync(s,"utf-8"),r=JSON.parse(e);if(r.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${r.version}`),null;return r}catch(e){return console.warn("[stx] Failed to load manifest:",e),null}}function M(t,s,e={}){let r=`${encodeURIComponent(t)}=${encodeURIComponent(s)}`;if(e.maxAge!==void 0)r+=`; Max-Age=${e.maxAge}`;if(e.expires)r+=`; Expires=${e.expires.toUTCString()}`;if(e.path)r+=`; Path=${e.path}`;if(e.domain)r+=`; Domain=${e.domain}`;if(e.secure)r+="; Secure";if(e.httpOnly)r+="; HttpOnly";if(e.sameSite)r+=`; SameSite=${e.sameSite}`;return r}async function ot(t){let s=t.headers.get("content-type")||"",e={},r=(i,o)=>{let l=e[i];if(l===void 0)e[i]=o;else if(Array.isArray(l))l.push(o);else e[i]=[l,o]};if(s.includes("multipart/form-data")){let i=await t.formData();for(let[o,l]of i.entries())if(typeof l==="string")r(o,l);return e}if(s.includes("application/x-www-form-urlencoded")){for(let[i,o]of new URLSearchParams(await t.text()).entries())r(i,o);return e}return e}function ko(t){if(!t)return!1;let s=t.toUpperCase();return s!=="GET"&&s!=="HEAD"}async function U(t,s={}){let e=s.request,r=s.method??e?.method;if(!e||!ko(r))return{ran:!1};if(typeof t.action!=="function")return{ran:!1};let i={};try{i=await ot(e)}catch{}let o=await t.action({request:e,form:i,params:s.params??{},query:t.query??{},cookies:s.cookies??{}});if(o&&typeof o==="object"){let l=o,a=at(l.cookies),u=l.redirect;if(typeof u==="string"&&u)return{redirect:u,ran:!0,...a.length>0?{cookies:a}:{}};let{cookies:g,redirect:f,...d}=l;if(Object.assign(t,d),a.length>0)return{ran:!0,cookies:a}}return{ran:!0}}function at(t){if(!t||typeof t!=="object"||Array.isArray(t))return[];let s=[];for(let[e,r]of Object.entries(t)){if(!e)continue;if(typeof r==="string"){s.push(M(e,r));continue}if(r&&typeof r==="object"){let i=r;if(typeof i.value!=="string")continue;s.push(M(e,i.value,i))}}return s}function _a(t,s=[],e){let r=new Headers({Location:t,"Cache-Control":"no-store"});for(let i of s)r.append("Set-Cookie",i);for(let[i,o]of Object.entries(e??{}))if(i.toLowerCase()!=="location")r.set(i,o);return new Response(null,{status:303,headers:r})}async function Bn(t,s={}){let{html:e,context:r,redirect:i,cookies:o}=await ct(t,s),l=Bt(r),a=Ft(r);if(i)return{html:e,redirect:i,cookies:o,status:l,headers:a};let{extractStreamBoundaries:u}=await import("./chunk-
|
|
32
|
+
`)}import O from"fs";import q from"path";function xa(t,s,e){return{version:1,buildTime:new Date().toISOString(),routes:t,assets:s,outputDir:e}}function Sa(t,s){let e=q.join(s,"manifest.json");O.writeFileSync(e,JSON.stringify(t,null,2))}function ka(t){let s=q.join(t,"manifest.json");if(!O.existsSync(s))return null;try{let e=O.readFileSync(s,"utf-8"),r=JSON.parse(e);if(r.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${r.version}`),null;return r}catch(e){return console.warn("[stx] Failed to load manifest:",e),null}}function M(t,s,e={}){let r=`${encodeURIComponent(t)}=${encodeURIComponent(s)}`;if(e.maxAge!==void 0)r+=`; Max-Age=${e.maxAge}`;if(e.expires)r+=`; Expires=${e.expires.toUTCString()}`;if(e.path)r+=`; Path=${e.path}`;if(e.domain)r+=`; Domain=${e.domain}`;if(e.secure)r+="; Secure";if(e.httpOnly)r+="; HttpOnly";if(e.sameSite)r+=`; SameSite=${e.sameSite}`;return r}async function ot(t){let s=t.headers.get("content-type")||"",e={},r=(i,o)=>{let l=e[i];if(l===void 0)e[i]=o;else if(Array.isArray(l))l.push(o);else e[i]=[l,o]};if(s.includes("multipart/form-data")){let i=await t.formData();for(let[o,l]of i.entries())if(typeof l==="string")r(o,l);return e}if(s.includes("application/x-www-form-urlencoded")){for(let[i,o]of new URLSearchParams(await t.text()).entries())r(i,o);return e}return e}function ko(t){if(!t)return!1;let s=t.toUpperCase();return s!=="GET"&&s!=="HEAD"}async function U(t,s={}){let e=s.request,r=s.method??e?.method;if(!e||!ko(r))return{ran:!1};if(typeof t.action!=="function")return{ran:!1};let i={};try{i=await ot(e)}catch{}let o=await t.action({request:e,form:i,params:s.params??{},query:t.query??{},cookies:s.cookies??{}});if(o&&typeof o==="object"){let l=o,a=at(l.cookies),u=l.redirect;if(typeof u==="string"&&u)return{redirect:u,ran:!0,...a.length>0?{cookies:a}:{}};let{cookies:g,redirect:f,...d}=l;if(Object.assign(t,d),a.length>0)return{ran:!0,cookies:a}}return{ran:!0}}function at(t){if(!t||typeof t!=="object"||Array.isArray(t))return[];let s=[];for(let[e,r]of Object.entries(t)){if(!e)continue;if(typeof r==="string"){s.push(M(e,r));continue}if(r&&typeof r==="object"){let i=r;if(typeof i.value!=="string")continue;s.push(M(e,i.value,i))}}return s}function _a(t,s=[],e){let r=new Headers({Location:t,"Cache-Control":"no-store"});for(let i of s)r.append("Set-Cookie",i);for(let[i,o]of Object.entries(e??{}))if(i.toLowerCase()!=="location")r.set(i,o);return new Response(null,{status:303,headers:r})}async function Bn(t,s={}){let{html:e,context:r,redirect:i,cookies:o}=await ct(t,s),l=Bt(r),a=Ft(r);if(i)return{html:e,redirect:i,cookies:o,status:l,headers:a};let{extractStreamBoundaries:u}=await import("./chunk-razx95wk.js"),g=u(r),f=t.streamTemplates;if(f&&Object.keys(f).length>0){let{processDirectives:d}=await import("./chunk-77km1je8.js"),{defaultConfig:x}=await import("./chunk-angv3d3s.js"),y=r.streamBoundaries||{},R={...x,autoShell:!1},b=Object.keys(f).map((m)=>({id:m,render:async()=>{let S=typeof y[m]==="function"?await y[m]():void 0;return d(f[m],{...r,$boundary:S},t.sourceFile,R,new Set)}})),k=new Set(b.map((m)=>m.id));g=[...(g||[]).filter((m)=>!k.has(m.id)),...b]}return{html:e,boundaries:g&&g.length>0?g:void 0,cookies:o,status:l,headers:a}}async function ct(t,s){let e={__filename:t.sourceFile,__dirname:t.sourceFile.replace(/[/\\][^/\\]+$/,""),...s};if(!t.hasServerScripts&&!$i(t.html))return{html:t.html,context:e};for(let l of t.serverScriptContent)try{await h(l,e,t.sourceFile)}catch(a){if(s.__stx_strict_hydration)throw a;console.warn(`[stx] Server script error in ${t.sourceFile}:`,a)}let r=await U(e,{request:s.request,method:s.method,params:s.params??{},cookies:s.cookies??{}}),i=(l)=>{let a=l.replace(/<script\b[^>]*\bdata-stx-server-data\b[^>]*>[\s\S]*?<\/script>/gi,""),u=Pr(e);if(!u)return a;let g=D(a);return g<0?u+a:a.slice(0,g)+u+a.slice(g)};if(r.redirect)return{html:t.html,context:e,redirect:r.redirect,cookies:r.cookies};if(!$i(t.html))return{html:i(t.html),context:e,cookies:r.cookies};let o=new Map;for(let[l,a]of Object.entries(t.placeholders))if(a.expression)try{let u=I(a.expression,e);if(a.type==="raw")o.set(l,u!==void 0&&u!==null?String(u):"");else o.set(l,u!==void 0&&u!==null?G(String(u)):"")}catch(u){if(s.__stx_strict_hydration)throw u;o.set(l,"")}return{html:i(gl(t.html,o)),context:e,cookies:r.cookies}}
|
|
33
33
|
export{wt,en,Ae,z,Ln,jn,wa,So,Qr,Je,va,Ye,Pe,xa,Sa,ka,ko,_a,Bn};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{is,as}from"./chunk-79y9amt1.js";import{w}from"./chunk-
|
|
2
|
+
import{is,as}from"./chunk-79y9amt1.js";import{w}from"./chunk-rkd27m4m.js";import{a}from"./chunk-xt1cxmkx.js";import{Ze,ce}from"./chunk-vvzys1x7.js";import{ac}from"./chunk-8efn9agz.js";import{H}from"./chunk-8s6s6nd0.js";import{b}from"./chunk-94mpe1ny.js";import{f}from"./chunk-fd1bpv35.js";import{existsSync as z,mkdirSync as C,copyFileSync as I,chmodSync as B,rmSync as xe}from"fs";import{join as c,basename as ye,resolve as K}from"path";import{spawn as _}from"child_process";import{platform as Se}from"os";function O(e,r,i){let n=new RegExp(`</${r}\\s*>`,"iy"),s=w(e,(t,o)=>(n.lastIndex=o,n.exec(t)?n.lastIndex:-1))[0];return s?e.slice(0,s.start)+i+e.slice(s.start):null}var Tu=`
|
|
3
3
|
<script>
|
|
4
4
|
(function() {
|
|
5
5
|
'use strict';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import{me}from"./chunk-kh6njq2r.js";import{qe,j}from"./chunk-k32q90b2.js";import{Nc}from"./chunk-rw5492e2.js";import{l}from"./chunk-46pxmpeb.js";import v from"fs";import m from"path";import{pathToFileURL as O}from"url";var P=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],R=new Set;function fn(s,c={}){let o=m.resolve(s,c.dir??"server/api"),i=[],f=new Map;if(!v.existsSync(o))return i;let t=Array.from(new Bun.Glob("**/*.{ts,js,mts,mjs}").scanSync({cwd:o})).sort();for(let e of t){if(e.endsWith(".d.ts"))continue;let p=e.replace(/\.(?:ts|js|mts|mjs)$/,"").split("/"),n=p.pop(),u=n.lastIndexOf("."),d=u>=0?n.slice(u+1):"get",g=d.toUpperCase();if(!P.includes(g)||d!==d.toLowerCase())throw Error(`Unsupported API method suffix in ${e}; use ${P.map((A)=>A.toLowerCase()).join(", ")}`);if(u>=0)n=n.slice(0,u);if(n!=="index")p.push(n);let r=new Set,h=p.map((A,I)=>{let y=/^\[(\.\.\.)?([A-Za-z_]\w*)\]$/.exec(A);if(y){if(r.has(y[2])||y[1]&&I!==p.length-1)throw Error(`Invalid API parameter in ${e}`);return r.add(y[2]),`:${y[2]}${y[1]?"*":""}`}if(!/^[\w-]+$/.test(A))throw Error(`Unsupported API path segment ${A} in ${e}`);return A}),w=`/api${h.length?`/${h.join("/")}`:""}`,S=`${g} ${w.replace(/:\w+/g,":param")}`;if(f.has(S))throw Error(`Ambiguous API route ${g} ${w}: ${f.get(S)} and ${e}`);f.set(S,e);let x=m.join(o,e);R.add(m.resolve(x)),R.add(v.realpathSync(x)),i.push({pattern:w,method:g,filePath:x})}return i.sort((e,a)=>{let p=e.pattern.split("/"),n=a.pattern.split("/"),u=(d)=>d?.endsWith("*")?0:d?.startsWith(":")?1:2;for(let d=0;d<Math.max(p.length,n.length);d++){let g=u(n[d])-u(p[d]);if(g)return g}return e.pattern.localeCompare(a.pattern)||e.method.localeCompare(a.method)})}async function Lo(s,c){let o=l(s,"api-types.d.ts"),i=["// Generated by stx. Include this file in tsconfig.json.","declare module '@stacksjs/stx/api-client' {"," interface KnownApiRoutes {"];for(let t of c){let e=`./${m.relative(m.dirname(o),t.filePath).replace(/\\/g,"/")}`,{params:a}=me(t.pattern);i.push(` ${JSON.stringify(`${t.method} ${t.pattern}`)}: { params: { ${a.map((p)=>`${JSON.stringify(p)}: string`).join("; ")} }; response: Awaited<ReturnType<typeof import(${JSON.stringify(e)}).default>> }`)}i.push(" }","}","export {}","");let f=i.join(`
|
|
3
3
|
`);if(!await Bun.file(o).exists()||await Bun.file(o).text()!==f)await Bun.write(o,f);return o}async function jo(s,c,o={}){let i=fn(s,o);await Lo(s,i);let f=[];for(let t of i){let e=await Bun.build({entrypoints:[t.filePath],target:"bun",format:"esm",minify:!1,splitting:!1});if(!e.success)throw Error(`API build failed for ${t.filePath}: ${e.logs.join(`
|
|
4
|
-
`)}`);let a=e.outputs.find((u)=>u.kind==="entry-point");if(!a)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await a.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(c,n),a),f.push({...t,filePath:n})}return f}function E(s,c){let o=s.map((i)=>({route:i,...me(i.pattern)}));return async(i)=>{let f=new URL(i.url).pathname,t=o.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,a=(r)=>r.replace(/:\w+/g,":param"),p=t.filter((r)=>a(r.route.pattern)===a(e)),n=i.method,u=p.find((r)=>r.route.method===n)??(n==="HEAD"?p.find((r)=>r.route.method==="GET"):void 0);if(!u){let r=new Set(p.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=u.regex.exec(f),g=Object.create(null);try{u.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await c(u.route);if(typeof r!=="function")throw Error(`API endpoint ${u.route.filePath} must default-export a handler`);let h=await r(i,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function Bo(s,c){return E(c,async(o)=>(await import(O(m.resolve(s,o.filePath)).href)).default)}async function Hh(s,c){if(!c)return async()=>null;let o=c===!0?{}:c,i=fn(s,o);return await Lo(s,i),async(f)=>{if(!new URL(f.url).pathname.match(/^\/api(?:\/|$)/))return null;try{let t=fn(s,o);await Lo(s,t);let{loadStxConfig:e}=await import("./chunk-
|
|
4
|
+
`)}`);let a=e.outputs.find((u)=>u.kind==="entry-point");if(!a)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await a.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(c,n),a),f.push({...t,filePath:n})}return f}function E(s,c){let o=s.map((i)=>({route:i,...me(i.pattern)}));return async(i)=>{let f=new URL(i.url).pathname,t=o.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,a=(r)=>r.replace(/:\w+/g,":param"),p=t.filter((r)=>a(r.route.pattern)===a(e)),n=i.method,u=p.find((r)=>r.route.method===n)??(n==="HEAD"?p.find((r)=>r.route.method==="GET"):void 0);if(!u){let r=new Set(p.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=u.regex.exec(f),g=Object.create(null);try{u.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await c(u.route);if(typeof r!=="function")throw Error(`API endpoint ${u.route.filePath} must default-export a handler`);let h=await r(i,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function Bo(s,c){return E(c,async(o)=>(await import(O(m.resolve(s,o.filePath)).href)).default)}async function Hh(s,c){if(!c)return async()=>null;let o=c===!0?{}:c,i=fn(s,o);return await Lo(s,i),async(f)=>{if(!new URL(f.url).pathname.match(/^\/api(?:\/|$)/))return null;try{let t=fn(s,o);await Lo(s,t);let{loadStxConfig:e}=await import("./chunk-angv3d3s.js"),a=j((await e(s)).runtimeConfig);return await qe(a,()=>E(t,async(p)=>{let n=await Bun.build({entrypoints:[p.filePath],target:"bun",format:"esm",splitting:!1});if(!n.success)throw Error(n.logs.join(`
|
|
5
5
|
`));let u=n.outputs.find((d)=>d.kind==="entry-point");if(!u||n.outputs.length!==1)throw Error(`Unsupported API bundle output: ${p.filePath}`);return(await import(`data:text/javascript;base64,${Buffer.from(await u.text()).toString("base64")}`)).default})(f))}catch(t){return console.error("[stx] API discovery failed:",t),Response.json({error:"API discovery failed; check the server log"},{status:500})}}}function Fo(s,c,o){if(Nc(s))return!0;let i=/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/;if(i.test(m.basename(s)))return!0;try{if(i.test(m.basename(v.realpathSync(s))))return!0}catch{}if(R.has(m.resolve(s)))return!0;if(!o)return!1;let f=m.resolve(c,typeof o==="object"?o.dir??"server/api":"server/api"),t=(a)=>{try{return v.realpathSync(a)}catch{return m.resolve(a)}},e=t(s);return[f,m.resolve(c,"server"),m.resolve(c,".output/server")].some((a)=>{let p=t(a);return e===p||e.startsWith(`${p}${m.sep}`)})}
|
|
6
6
|
export{fn,Lo,jo,Bo,Hh,Fo};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{cr,i}from"./chunk-a2yk8sw0.js";import"./chunk-4q0rgnw0.js";import"./chunk-zfd9dmsn.js";import"./chunk-q1wxgw5s.js";import"./chunk-46x7a1cj.js";import"./chunk-2qjyzekc.js";import"./chunk-xempkjvd.js";import"./chunk-jbgj2hph.js";import"./chunk-fbtm3frc.js";import{_e}from"./chunk-dx2t73jn.js";import"./chunk-5dvkphbe.js";import"./chunk-f57t1bcs.js";import"./chunk-xt1cxmkx.js";import"./chunk-w1vk83kx.js";import"./chunk-tnp2ta5q.js";import"./chunk-rw5492e2.js";import"./chunk-83tvkw4y.js";import"./chunk-kh6njq2r.js";import{je,Gs,Xs}from"./chunk-rkd27m4m.js";import"./chunk-0dyec13e.js";import"./chunk-k32q90b2.js";import"./chunk-g0xn80gz.js";import"./chunk-farh4p7f.js";import"./chunk-qjey0jk6.js";export{cr as buildModulesTag,_e as injectRouterScript,i as processDirectives,Gs as processJsonDirective,Xs as processOnceDirective,je as validateClientScript};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{R}from"./chunk-
|
|
2
|
+
import{R}from"./chunk-rkd27m4m.js";import{i}from"./chunk-a2yk8sw0.js";import p from"fs";import g from"path";import*as y from"readline";var e={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m"},u={help:{description:"Show available commands",usage:"help [command]",handler:async(t,o)=>{if(t[0]&&u[t[0]]){let n=u[t[0]];console.log(`
|
|
3
3
|
${e.bold}${t[0]}${e.reset} - ${n.description}`),console.log(` Usage: ${e.cyan}${n.usage}${e.reset}
|
|
4
4
|
`)}else{console.log(`
|
|
5
5
|
${e.bold}Available Commands:${e.reset}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Fl,zl}from"./chunk-j4mtcbvz.js";import"./chunk-v37zmez0.js";import"./chunk-78eyz4ch.js";import"./chunk-hwqrejq3.js";import"./chunk-e8y2c1sq.js";import"./chunk-nack2xs5.js";import"./chunk-mcnwvh06.js";import"./chunk-mkyn95mf.js";import"./chunk-fm9kas0a.js";import"./chunk-67xreg70.js";import"./chunk-6ftee542.js";import"./chunk-gd56arnm.js";import"./chunk-ew5cey88.js";import"./chunk-bzt73fj0.js";import"./chunk-8me8hamk.js";import"./chunk-ysfeg3cn.js";import"./chunk-01mwbg1r.js";import"./chunk-55zq2ha8.js";import"./chunk-hev4t4d5.js";import"./chunk-1mqcttg3.js";import"./chunk-c60qda5c.js";import"./chunk-9tsp5ytb.js";import"./chunk-qcxrcypb.js";import"./chunk-gbtbfg7e.js";import"./chunk-cqhwzd9y.js";import"./chunk-j1efsjsb.js";import"./chunk-dy1d7ep7.js";import"./chunk-w19myass.js";import"./chunk-7xhwqc0c.js";import"./chunk-8efn9agz.js";import"./chunk-vvzys1x7.js";import"./chunk-v4xes880.js";import{an}from"./chunk-97cyjqa5.js";import{Ff}from"./chunk-gwa31y9x.js";import"./chunk-764f1sf1.js";import"./chunk-9zrvh3pz.js";import{Ne,i}from"./chunk-a2yk8sw0.js";import"./chunk-4q0rgnw0.js";import"./chunk-zfd9dmsn.js";import"./chunk-q1wxgw5s.js";import"./chunk-46x7a1cj.js";import"./chunk-2qjyzekc.js";import"./chunk-xempkjvd.js";import"./chunk-jbgj2hph.js";import"./chunk-fbtm3frc.js";import{_e}from"./chunk-dx2t73jn.js";import"./chunk-5dvkphbe.js";import{hr,yr}from"./chunk-f57t1bcs.js";import{$s,V,a}from"./chunk-xt1cxmkx.js";import"./chunk-w1vk83kx.js";import"./chunk-tnp2ta5q.js";import"./chunk-rw5492e2.js";import"./chunk-83tvkw4y.js";import"./chunk-kh6njq2r.js";import{h,He}from"./chunk-rkd27m4m.js";import"./chunk-0dyec13e.js";import"./chunk-k32q90b2.js";import"./chunk-g0xn80gz.js";import"./chunk-farh4p7f.js";import"./chunk-qjey0jk6.js";import{Ui}from"./chunk-fd1bpv35.js";import"./chunk-6m6y9bbx.js";import"./chunk-z512gt4v.js";export{$s as buildWebComponents,yr as cacheTemplate,hr as checkCache,an as classifyAllScripts,Fl as createMiddleware,zl as createRoute,V as defaultConfig,h as extractVariables,_e as injectRouterScript,Ui as insertBeforeBodyClose,a as loadStxConfig,He as processClientScript,i as processDirectives,Ne as readMarkdownFile,Ff as withinBundlerCallback};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Vf,yc,Vh,bc,Uf,Wf,mn,dr,Uh,qf,Kf,Wh,x}from"./chunk-
|
|
2
|
+
import{Vf,yc,Vh,bc,Uf,Wf,mn,dr,Uh,qf,Kf,Wh,x}from"./chunk-4q0rgnw0.js";import"./chunk-f57t1bcs.js";import"./chunk-rkd27m4m.js";import"./chunk-0dyec13e.js";import"./chunk-k32q90b2.js";import"./chunk-g0xn80gz.js";import"./chunk-farh4p7f.js";import"./chunk-qjey0jk6.js";export{mn as buildCss,qf as extractClassNames,Wf as fingerprintConfig,Kf as generateCss,Uh as getCachedCSS,Vf as getCssServeAsset,x as injectCss,yc as loadCssEngine,bc as loadCssEngineConfig,dr as rebuildCss,Vh as resetCssCache,Uf as resolveUserCssConfig,Wh as withLinkedModuleBundles};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{he,Yc,Ks,xn,h,ze,He}from"./chunk-
|
|
2
|
+
import{he,Yc,Ks,xn,h,ze,He}from"./chunk-rkd27m4m.js";import{br,st,V}from"./chunk-xt1cxmkx.js";import{cr,i}from"./chunk-a2yk8sw0.js";import{_e}from"./chunk-dx2t73jn.js";import{Ui}from"./chunk-fd1bpv35.js";function y(s){return s.endsWith(".md")||s.endsWith(".markdown")}function C(s){let e=[];m(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let r=[...e];m(/<code\b[^>]*>[\s\S]*?<\/code>/gi,r);function m(n,p){let g;while((g=n.exec(s))!==null){let t=g.index,o=t+g[0].length;if(p?.some((l)=>t>=l.start&&o<=l.end))continue;e.push({start:t,end:o})}}if(e.length===0)return s;e.sort((n,p)=>n.start-p.start);let c="",a=0;for(let n of e){if(n.start<a)continue;c+=s.slice(a,n.start),c+=`@raw${s.slice(n.start,n.end)}@endraw`,a=n.end}return c+=s.slice(a),c}async function b(s,e={}){let{data:r,content:m}=br(s),a=await(e.renderer??((n)=>st(n)))(m);return{html:C(a),frontmatter:r??{}}}import{dirname as k,resolve as R}from"path";function v(s){let e=s,r=he(s);if(r)e=r.content.trim();let m=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,c=[],a=[],n=[],p=(o)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(o),g;while((g=m.exec(s))!==null){let o=g[1],l=g[2],d=g[0],u=o.includes("server");if(p(l))n.push(d);else if(u)a.push(l);else c.push(d)}let t=e;{let o=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,l,d=[];while((l=o.exec(t))!==null){let u=l.index+l[0].length,f=t.indexOf("</script>",u);if(f===-1)continue;d.push({start:l.index,end:f+9}),o.lastIndex=f+9}for(let u=d.length-1;u>=0;u--)t=t.substring(0,d[u].start)+t.substring(d[u].end)}for(let o of c)t=t.replace(o,"");return{templateContent:t,serverScripts:a,clientScripts:c,signalsScripts:n}}function M(s,e){return`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
@@ -12,5 +12,5 @@ ${s}
|
|
|
12
12
|
</html>`}async function ac(s,e={}){let r=R(s),m=Bun.file(r);if(!await m.exists())throw Error(`Template file not found: ${r}`);let c=await m.text(),a=null;if(y(r)){let n=await b(c,{renderer:e.markdownRenderer});c=n.html,a=n.frontmatter}if(a)e={...e,context:{...a,...e.context||{}}};if(e.layout){let n=R(e.layout),p=Bun.file(n);if(!await p.exists())throw Error(`Layout template not found: ${n}`);let{layout:g,injectCSS:t,...o}=e,l={...e.context||{}};xn(l);let d=await w(c,r,{...o,context:{...l,__stx_defer_server_data:!0},injectCSS:!1}),u=await p.text(),f={...l,content:d},x={...o,context:f,injectCSS:t};return w(u,n,x)}return w(c,r,e)}async function w(s,e,r={}){let{templateContent:m,serverScripts:c,clientScripts:a}=v(s),n={...V,...r.options},p={__filename:e,__dirname:k(e),__stx:{},__stx_options:n,__stx_sfc_mode:!0,__stx_inject_css:r.injectCSS===!0,__stxServeContext:void 0,...Ks(r.context??{}),definePageMeta:()=>{},...r.context||{}};for(let o of c)await h(o,p,e);let g=new Set,t=m;if(t=await i(t,p,e,n,g),Yc(p,r.context),r.templateOnly){if(t=t.replace(/<script data-stx-scoped>[\s\S]*?<\/script>\s*/gi,""),t=t.replace(/<!-- stx SEO Tags -->[\s\S]*?(?=<)/i,""),a.length>0)t+=`
|
|
13
13
|
${a.join(`
|
|
14
14
|
`)}`}else{if(r.processClientScripts!==!1&&a.length>0){let o=p.__stx_event_bindings||[],l=ze(p),d=await Promise.all(a.map(async(x)=>{let _=x.match(/<script\b([^>]*)>/i)?.[1]||"";if(/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(_))return x;let S=x.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!S)return x;return await He(S[1],{eventBindings:o,templateContent:t,serverData:l,filePath:e})})),f=[await cr(d,{...n,buildMode:"compile"}),...d].filter(Boolean).join(`
|
|
15
|
-
`);t=Ui(t,f)}t=await _e(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=M(t,r.title)}if(r.injectCSS)try{let{injectCss:o}=await import("./chunk-
|
|
15
|
+
`);t=Ui(t,f)}t=await _e(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=M(t,r.title)}if(r.injectCSS)try{let{injectCss:o}=await import("./chunk-86xt8cs8.js");t=await o(t)}catch{}return t}
|
|
16
16
|
export{ac};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{X,Be}from"./chunk-
|
|
2
|
+
import{X,Be}from"./chunk-rkd27m4m.js";var o=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function u(t,e,r){let i={fullTag:r,content:e,attrs:t};if(/\bserver\b/.test(t))return{...i,type:"server"};if(/\bdata-stx-scoped\b/.test(t))return{...i,type:"client"};if(o.test(e))return{...i,type:"signals"};if(/\bclient\b/.test(t)||/\btype\s*=\s*["']module["']/.test(t)||/\bsrc\s*=/.test(t))return{...i,type:"client"};return{...i,type:"server"}}var S=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function an(t){let e=[],r=[],i=[],c=0;while(c<t.length){let s=t.indexOf("<",c);if(s===-1)break;let p=Be(t,s);if(p>s){c=p;continue}let a=X(t,s);if(a>s){let f=t.slice(s,a),l=S.exec(f);if(l){let n=u(l[1],l[2],f);switch(n.type){case"signals":e.push(n);break;case"client":r.push(n);break;case"server":i.push(n);break}}c=a;continue}c=s+(t.startsWith("<!--",s)?4:1)}return{signals:e,client:r,server:i}}
|
|
3
3
|
export{an};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ee,Ci,Ei,Sg,zt,al,kg,cl,fy,ze,kn,He}from"./chunk-
|
|
2
|
+
import{Ee,Ci,Ei,Sg,zt,al,kg,cl,fy,ze,kn,He}from"./chunk-rkd27m4m.js";import{ml,r}from"./chunk-x7redxyd.js";import"./chunk-0dyec13e.js";import"./chunk-k32q90b2.js";import"./chunk-g0xn80gz.js";import"./chunk-farh4p7f.js";import"./chunk-qjey0jk6.js";export{Ee as BROWSER_CORE_IMPORTS,Sg as STX_AUTO_IMPORTS,Ci as extractAndStripCssImports,ze as extractBridgeData,ml as findInterpolationEnd,cl as generateAutoImportDestructuring,fy as generateBrowserAutoImportDestructuring,kn as generateServerDataBridge,zt as injectBrowserCoreAutoImports,He as processClientScript,kg as referencesName,Ei as renderVendorStyleTags,r as stripCommentsAndLiterals,al as transformAutoImports};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{h,y,g}from"./chunk-
|
|
2
|
+
import{h,y,g}from"./chunk-rkd27m4m.js";import{V}from"./chunk-xt1cxmkx.js";import{i}from"./chunk-a2yk8sw0.js";import k from"path";var q={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},T=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var M=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function H(e){let t=[],o=0,n;M.lastIndex=0;while((n=M.exec(e))!==null){if(n.index>o){let a=e.slice(o,n.index);if(a.trim())t.push({type:t.length===0?"shell":"content",content:a})}let s=n[1],r=n[2];t.push({type:"suspense",name:s,content:r}),o=n.index+n[0].length}if(o<e.length){let s=e.slice(o);if(s.trim())t.push({type:t.length===0?"shell":"content",content:s})}if(t.length===0)t.push({type:"shell",content:e});return t}async function Ym(e,t={},o={}){let n={...V,...o,streaming:{...q,...o.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(r){try{let a=await Bun.file(e).text(),S=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),p=S?S[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),f={...t,__filename:e,__dirname:k.dirname(e)};if(p.trim())await h(p,f,e);let E=H(c),l=new Set;if(!E.some((w)=>w.type==="suspense")){let w=n.streaming?.strategy||"auto",x=new RegExp(T.source,"g");if(!(w!=="manual"&&x.test(c))){let u=await i(c,f,e,n,l);for(let b=0;b<u.length;b+=s)r.enqueue(u.slice(b,b+s)),await new Promise((m)=>setTimeout(m,0))}else{let u=[],b=new RegExp(T.source,"g"),m;while((m=b.exec(c))!==null)u.push({name:m[1],content:m[2],start:m.index,end:m.index+m[0].length});let v=0;for(let _ of u){if(_.start>v){let I=c.slice(v,_.start);if(I.trim()){let O=await i(I,f,e,n,l);r.enqueue(O),await new Promise((D)=>setTimeout(D,0))}}let C=await i(_.content,f,e,n,l);r.enqueue(C),await new Promise((I)=>setTimeout(I,0)),v=_.end}if(v<c.length){let _=c.slice(v);if(_.trim()){let C=await i(_,f,e,n,l);r.enqueue(C)}}}}else{let w=new Map;for(let d of E)if(d.type==="shell"||d.type==="content"){let u=await i(d.content,f,e,n,l);r.enqueue(u)}else if(d.type==="suspense"&&d.name){let u=`stx-suspense-${d.name}`;r.enqueue(`<div id="${u}" data-suspense="${d.name}" style="display:contents;">
|
|
3
3
|
<template data-suspense-fallback>Loading...</template>
|
|
4
4
|
</div>`),w.set(d.name,i(d.content,f,e,n,l))}r.enqueue(`
|
|
5
5
|
<script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Vt,pe,E,d,m,O,t,re,J,u,$e,Ni,U,Rn,Di,qt,Mi,bl,Dr,wl,pt,vl,Mr,xl,An,Li,Sl,Lr,Br,Re,ji}from"./chunk-g0xn80gz.js";import{hi,Hc,o,T,je,Lt,bn,Be,ye,Q,Er,wn,qs,Zc,Qc,xn,Pr,Gs,Xs,el,ki,tl,nl,rl,sl,ze,He,Js,We,s,_n,y,g,G,ne,Te,R,Ai}from"./chunk-
|
|
2
|
+
import{Vt,pe,E,d,m,O,t,re,J,u,$e,Ni,U,Rn,Di,qt,Mi,bl,Dr,wl,pt,vl,Mr,xl,An,Li,Sl,Lr,Br,Re,ji}from"./chunk-g0xn80gz.js";import{hi,Hc,o,T,je,Lt,bn,Be,ye,Q,Er,wn,qs,Zc,Qc,xn,Pr,Gs,Xs,el,ki,tl,nl,rl,sl,ze,He,Js,We,s,_n,y,g,G,ne,Te,R,Ai}from"./chunk-rkd27m4m.js";import{Ht}from"./chunk-k32q90b2.js";import{Tn}from"./chunk-0dyec13e.js";import{x}from"./chunk-4q0rgnw0.js";import{xr,Ls}from"./chunk-kh6njq2r.js";import{Cc,Ec,br,st,Tc,M}from"./chunk-xt1cxmkx.js";import{ii,ai,ci,li}from"./chunk-83tvkw4y.js";import{vc,bs}from"./chunk-46x7a1cj.js";import{gs,ms,hs}from"./chunk-zfd9dmsn.js";import{xs,Zo,Qo,Ss,ks,ei}from"./chunk-fbtm3frc.js";import{ws,Ko}from"./chunk-xempkjvd.js";import{Vo}from"./chunk-q1wxgw5s.js";import{le,Go,Xo,Jo}from"./chunk-jbgj2hph.js";import{gr,ke,Sc,mr,kc}from"./chunk-dx2t73jn.js";import{H,nt}from"./chunk-8s6s6nd0.js";import{Rc,Ac}from"./chunk-w1vk83kx.js";import{A,Pn,Bi}from"./chunk-bwdbj60y.js";import{D,c,f}from"./chunk-fd1bpv35.js";import Jn from"fs";import ae from"path";function mt(n){let e=Lt(n),l=e.find((S)=>S.closing&&S.name.toLowerCase()==="head");if(!l)return n;let a=new Set(["template","svg","noscript","math","textarea","title","xmp","iframe","noembed","noframes","plaintext"]),h=0,r=[];for(let S=0;S<e.length;S++){let v=e[S];if(v.start<l.end)continue;let k=v.name.toLowerCase();if(a.has(k)){h=Math.max(0,h+(v.closing?-1:v.selfClosing?0:1));continue}if(k!=="style"||v.closing||h>0)continue;let C=e[S+1];if(C?.name.toLowerCase()==="style"&&C.closing){if(/@scope\s*\{/.test(n.slice(v.end,C.start)))continue;r.push({start:v.start,end:C.end}),S++}}if(!r.length)return n;let p=r.map((S)=>n.slice(S.start,S.end)).join(`
|
|
3
3
|
`),w=[n.slice(0,l.start),p,`
|
|
4
4
|
`],b=l.start;for(let S of r)w.push(n.slice(b,S.start)),b=S.end;return w.push(n.slice(b)),w.join("")}function ht(){return`
|
|
5
5
|
// STX Lifecycle Runtime
|
|
@@ -1295,7 +1295,7 @@ ${L}
|
|
|
1295
1295
|
</style>`;a=a.replace(S,j),w.lastIndex=0}catch(L){}}}return a}import lt from"path";var Kn=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,Gn=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function Zn(n,e){if(!e||!n.includes("/"))return n;let l=lt.dirname(e);return n.replace(Kn,(a,h,r,p)=>{let w=lt.resolve(l,p);return`${h}${r}${w.split(lt.sep).join("/")}${r}`})}function fr(n,e){if(!e||!n.includes("<script"))return n;return n.replace(Gn,(l,a,h,r)=>`${a}${Zn(h,e)}${r}`)}var Me="<!--PARENT_CONTENT_PLACEHOLDER-->";function hr(n){return n.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Cr(n,e){let l=n.length,a=e,h=!0,r=[],p=(w)=>w+9<=l&&n[w]==="<"&&n[w+1]==="/"&&(n[w+2]==="s"||n[w+2]==="S")&&(n[w+3]==="c"||n[w+3]==="C")&&(n[w+4]==="r"||n[w+4]==="R")&&(n[w+5]==="i"||n[w+5]==="I")&&(n[w+6]==="p"||n[w+6]==="P")&&(n[w+7]==="t"||n[w+7]==="T")&&(n[w+8]===">"||/\s/.test(n[w+8]));while(a<l){let w=n[a];if(p(a))return a;if(w==="/"&&n[a+1]==="/"){if(a=n.indexOf(`
|
|
1296
1296
|
`,a+2),a===-1)return-1;a+=1,h=!0;continue}if(w==="/"&&n[a+1]==="*"){let b=n.indexOf("*/",a+2);if(b===-1)return-1;a=b+2,h=!0;continue}if(w==="/"&&h){let b=a+1,S=!1;while(b<l){let v=n[b];if(v==="\\"){b+=2;continue}if(v==="[")S=!0;else if(v==="]")S=!1;else if(v==="/"&&!S){b++;break}else if(v===`
|
|
1297
1297
|
`){b=-1;break}b++}if(b===-1){a++,h=!1;continue}while(b<l&&/[a-z]/.test(n[b]))b++;a=b,h=!1;continue}if(w==="'"||w==='"'){let b=w;a++;while(a<l){if(n[a]==="\\"){a+=2;continue}if(n[a]===b){a++;break}if(n[a]===`
|
|
1298
|
-
`)break;a++}h=!1;continue}if(w==="`"){a++;while(a<l){if(n[a]==="\\"){a+=2;continue}if(n[a]==="`"){a++;break}if(n[a]==="$"&&n[a+1]==="{"){r.push(!0),a+=2,h=!0;break}a++}if(r.length===0)h=!1;continue}if(w==="}"&&r.length>0){r.pop(),a++;while(a<l){if(n[a]==="\\"){a+=2;continue}if(n[a]==="`"){a++,h=!1;break}if(n[a]==="$"&&n[a+1]==="{"){r.push(!0),a+=2,h=!0;break}a++}continue}if(/\s/.test(w));else if(/[)\].\w$]/.test(w))h=!1;else h=!0;a++}return-1}function _r(n,e){let l=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`<script\\b(?=[^>]*\\b${l}(?:\\s|=|/?>))[^>]*>`,"i").exec(n);if(!a)return null;let h=a.index+a[0].length,r=n.indexOf("</script>",h);if(r===-1)return null;let p=n.indexOf(">",r);if(p===-1)return null;return{start:a.index,end:p+1}}var Qn=4096;async function ut(n,e,l){if(l.buildMode!=="serve"||e.length<Qn)return null;let{registerServeModuleBundle:a}=await import("./chunk-
|
|
1298
|
+
`)break;a++}h=!1;continue}if(w==="`"){a++;while(a<l){if(n[a]==="\\"){a+=2;continue}if(n[a]==="`"){a++;break}if(n[a]==="$"&&n[a+1]==="{"){r.push(!0),a+=2,h=!0;break}a++}if(r.length===0)h=!1;continue}if(w==="}"&&r.length>0){r.pop(),a++;while(a<l){if(n[a]==="\\"){a+=2;continue}if(n[a]==="`"){a++,h=!1;break}if(n[a]==="$"&&n[a+1]==="{"){r.push(!0),a+=2,h=!0;break}a++}continue}if(/\s/.test(w));else if(/[)\].\w$]/.test(w))h=!1;else h=!0;a++}return-1}function _r(n,e){let l=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`<script\\b(?=[^>]*\\b${l}(?:\\s|=|/?>))[^>]*>`,"i").exec(n);if(!a)return null;let h=a.index+a[0].length,r=n.indexOf("</script>",h);if(r===-1)return null;let p=n.indexOf(">",r);if(p===-1)return null;return{start:a.index,end:p+1}}var Qn=4096;async function ut(n,e,l){if(l.buildMode!=="serve"||e.length<Qn)return null;let{registerServeModuleBundle:a}=await import("./chunk-et9pa7gr.js");return`<script ${n} src="${a(e)}"></script>`}async function cr(n,e,l,a){try{let{registeredModuleIdsIn:h,buildModuleRegistryScript:r}=await o("stx/client-module-registry",()=>import("./chunk-p2f308sq.js")),p=[],w=await r(h(...n),{minify:Bi(e.buildMode,e.minifyClient),collectInputs:p});for(let b of p)l?.add(b);if(a)a.inputs=p,a.code=w??void 0;if(!w)return null;if(e.buildMode==="serve"){let{registerServeModuleBundle:b}=await import("./chunk-et9pa7gr.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${b(w)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${w.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}async function Yn(n,e,l,a){let h={modulesTag:null,modulesCode:null,storeTag:null,storeCode:null,composableTag:null,composableCode:null,frameworkScript:null};try{let{getFrameworkComposableScript:C}=await o("stx/framework-composables",()=>import("./chunk-g8zgfmk3.js"));h.frameworkScript=await C(n)}catch{}let r=null;try{r=await o("stx/store-loader",()=>import("./chunk-z98qxjne.js"))}catch{}let p=e.storesDir,w=!!a.__stx_native_screen||(r?.pageStoresAll()??!0),b=w?"":n.replace(/<script\b[^>]*\bdata-stx-(?:runtime|router|hmr)\b[^>]*>[\s\S]*?<\/script>/gi,""),S=[],v=[],k=null;for(let C=0;C<8;C++){let _=null,P="",I=!1;try{if(r){let q=w?await r.getStoreScript(p).then((W)=>W?{code:W,stores:["*"],functions:null}:null):await r.getStoreScriptFor(p,[b],{reads:r.storesReadInFiles([...S,...v]),runOnce:!0});if(q)_=q.code,P=q.stores.join(","),I=!!q.functions&&!w}}catch{}if(k!==null&&P===k)break;k=P;let L=I?'data-stx-scoped data-stx-run="always" data-stx-stores':"data-stx-stores",j=_?`<script ${L}>${_}</script>`:null;h.storeCode=_,h.storeTag=_?await ut(L,_,e)??j:null;let F={};h.modulesTag=await cr([n,j],e,l,F),h.modulesCode=F.code??null,S=F.inputs??[],h.composableTag=null,h.composableCode=null,v=[];try{let{getComposableScript:q}=await o("stx/composable-loader",()=>import("./chunk-49r1z20v.js")),W=e.composablesDir,N=[h.modulesCode??h.modulesTag,j,h.frameworkScript].filter((V)=>V!==null),B=await q(e._layerComposableDirs??W,n,N,v);if(B)h.composableCode=B,h.composableTag=await ut('data-stx-scoped data-stx-run="always" data-stx-composables',B,e)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${B}</script>`}catch{}if(w||!r)break}return h}async function es(n,e,l,a={}){let{withModuleSubstitutes:h,moduleSubstitutionKey:r}=await import("./chunk-x95031qg.js"),p=await import("./chunk-m9cperj4.js"),{messages:w,webModules:b}=e,S=null,v=null,k=r()===""&&!a.__stx_native_screen;if(w&&p.pageMessagesEnabled(e)&&k)try{S=await p.loadPageMessages(process.cwd(),w)}catch(L){ts(L)}if(b&&Object.keys(b).length&&k)try{v=await(await import("./chunk-8hhhmscy.js")).loadWebModules(process.cwd(),b)}catch(L){rs(L)}let C=new Map([...v??[],...S?.stubs??[]]),_=()=>Yn(n,e,l,a),P=C.size?await h(C,_):await _(),I=null;if(S){let L=p.messageAreasIn(P.modulesCode,P.storeCode,P.composableCode),j=p.pageMessagesScript(S,p.pageLanguages(n,S),L);if(j)I=await ut('data-stx-scoped data-stx-run="always" data-stx-messages',j,e)??`<script data-stx-scoped data-stx-run="always" data-stx-messages>${j.replace(/<\/script/gi,"<\\/script")}</script>`}return[I,P.modulesTag,P.storeTag,P.composableTag,P.frameworkScript].filter((L)=>L!==null)}var yr=!1;function ts(n){if(yr)return;yr=!0,console.warn(`[stx] messages: ${n instanceof Error?n.message:String(n)}; pages ship every language`)}var wr=!1;function rs(n){if(wr)return;wr=!0,console.warn(`[stx] ${n instanceof Error?n.message:String(n)}; pages bundle the real modules`)}function ns(n,e=""){let l=_r(n,"data-stx-runtime");if(!l)return n;let a=gr(n);if(a===-1||a===l.start){if(!e)return n;return n.slice(0,l.end)+e+n.slice(l.end)}if(a<l.start)return n.slice(0,a)+n.slice(l.start,l.end)+e+`
|
|
1299
1299
|
`+n.slice(a,l.start)+n.slice(l.end);let h=n.slice(l.start,l.end),r=n.slice(0,l.start)+n.slice(l.end),p=gr(r);if(p===-1)return h+e+`
|
|
1300
1300
|
`+r;return r.slice(0,p)+h+e+`
|
|
1301
1301
|
`+r.slice(p)}function ss(n){let e=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return n.replace(e,(l,a,h)=>{let r=n.slice(0,h);return r.lastIndexOf("<")>r.lastIndexOf(">")?`{{${a}}}`:`{<!--stx-literal-->{${a}}}`})}async function i(n,e,l,a,h){if(await E(),a.ssr===!1&&!a.autoShell&&a.buildMode==="spa")return n;if(e.__stx_signals_gate===void 0)e.__stx_signals_gate=Te(n,l);let r=!e.__stxProcessingDepth;xn(e);for(let p of a._layerGraph?.configDependencies??[])h.add(p);if(r&&a.runtimeConfig)await Tn(e,l,a.runtimeConfig);if(r)rl(e),e.__stx_scope_seq??={n:0,key:Js(String(e.__filename??l))},e.__stx_head_injections=Mi(),e.__stx_seo_staged=!1;if(!e.__stxProcessingDepth)e.__stxProcessingDepth=0;if(e.__stxProcessingDepth++,!e.__onceStore)e.__onceStore=new Set;if((a.debug||!A()&&!Pn())&&l&&l.endsWith(".stx"))Vo(n,l);try{return await pe.timeAsync("template-processing",async()=>{let p=await is(n,e,l,a,h);if(r)p=ki(p);if(r&&a.autoShell&&a.buildMode!=="compile"){let w=Re(a.app?.head,{known:Br,source:"app.head"}),S=(e.__stx_runtime_head||null)??ji(),v=(e.__stx_head_raw||"").trim(),k,C=v.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(C)k=C[1].trim(),v=v.replace(C[0],"").trim();let _=e.__sections?.title,P=_?R(_,e,l):void 0,I=S.title||k||P,L=!S.title&&(!!k||!!P),j=S.meta||[],F=new Set(j.map((K)=>pt(K)).filter(Boolean)),q={...w,...I&&{title:I},meta:[...(w.meta||[]).filter((K)=>!F.has(pt(K))),...j],link:[...w.link||[],...S.link||[]],script:[...w.script||[],...S.script||[]],headRaw:[w.headRaw,v].filter(Boolean).join(`
|
|
@@ -1310,7 +1310,7 @@ ${b.trim()}
|
|
|
1310
1310
|
@endsection`}}if(j&&b.includes("<script")){let N=Q(b),B=N.scripts.map((V)=>vr(V,l)??V);b=Er(N.output,B)}if(b=b.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(N,B,V)=>(L[B]=V,"")),b=b.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(N,B,V)=>{if(/^(['"]).*\1$/.test(V.trim()))return N;try{let K=d(V.trim(),e);if(K===void 0)return N;let Z=(e.__stx_inline_section_values??=[]).push(K)-1;return L[B]=`{{ __stx_inline_section_values[${Z}] }}`,""}catch{return N}}),b=b.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(N,B,V)=>{if(V.includes("@parent"))L[B]=V.replace("@parent",Me);else L[B]=V.trim();return""}),e.__sections=L,b=b.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(N,B,V)=>L[B]||V||""),!("slot"in e)||e.slot===void 0)b=b.replace(/\{\{\s*slot\s*\}\}/g,()=>L.content||"");if(b=hs(b,I),j){let N=[],B=Q(b),V=ye(B.output,bn,(K,ue)=>`\x00STX_ORPHAN_STYLE_${ue}\x00`);if(b=V.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(K,ue,Z)=>{let de=ue==="SCRIPT"?vr(B.scripts[Number(Z)],l):V.tokens[Number(Z)];if(de)N.push(de);return""}),N.length>0){let K=N.join(`
|
|
1311
1311
|
`);L.content=L.content?`${L.content}
|
|
1312
1312
|
${K}`:K,e.__sections=L}}if(j)try{let N;if(ae.isAbsolute(j))N=j,h.add(j);else N=await $e(()=>_n(j,l,p,h),null,()=>{throw new re(`Failed to resolve layout path: ${j}`,l,void 0,void 0,`Layout referenced from ${l}`)});if(!N){let ce=(Y)=>{if(!Y)return[];try{let ve=ae.isAbsolute(Y)?Y:ae.resolve(process.cwd(),Y);return Jn.readdirSync(ve).filter((Ee)=>Ee.endsWith(".stx")).map((Ee)=>Ee.replace(/\.stx$/,""))}catch{return[]}},se=[...ce(p.layoutsDir),...ce(p.fallbackLayoutsDir)].filter((Y,ve,Ee)=>Ee.indexOf(Y)===ve).sort(),we=[p.layoutsDir,p.fallbackLayoutsDir].filter((Y)=>typeof Y==="string"&&Y.length>0),ge=we.length>0?` Searched: ${we.join(", ")} (set \`layoutsDir\` to look elsewhere).`:"",ie=`Layout not found: ${j} (referenced from ${l})`+(se.length>0?`. Available layouts: ${se.join(", ")}`:p.layoutsDir?`. No .stx layouts found in ${p.layoutsDir}`:"")+ge;if(U.log(Error(ie),{layoutPath:j,filePath:l,available:se},"error"),console.error(`[stx] ${ie}`),p.debug)throw new re(ie,l);return b}let B=await $e(()=>Bun.file(N).text(),"",()=>{throw new re(`Failed to read layout file: ${N}`,l,void 0,void 0,"Layout content could not be loaded")});B=fr(B,N),B=B.replace(/\{\{--[\s\S]*?--\}\}/g,"");let V=Array.isArray(e.__layoutChain)?e.__layoutChain:[];if(V.includes(N)){let ce=[...V.slice(V.indexOf(N)),N];throw new re(ce.length===2?`Circular layout: ${N} extends itself`:`Circular layout: ${ce.join(" -> ")}`,l,void 0,void 0,"Remove the @extends or @layout line that points back at a layout already in use")}let K=B.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(K){if(p.debug)console.log(`Found nested layout: ${K[1]} in ${N}`);let ce={},se=B.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ie,Y,ve)=>(ce[Y]=ve.trim(),""));for(let[ie,Y]of Object.entries(ce))if(L[ie]&&L[ie].includes(Me)){let ve=L[ie].indexOf(Me);L[ie]=L[ie].slice(0,ve)+Y+L[ie].slice(ve+Me.length)}else if(!L[ie])L[ie]=Y;let we={...e,__sections:L,__layoutChain:[...V,N]},ge=`@layout('${K[1]}')${se}`;return await i(ge,we,N,p,h)}let ue=B.replace(/\{\{--[\s\S]*?--\}\}/g,""),Z=ms(ue,I),de={};return Z=Z.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ce,se,we)=>(de[se]=we.trim(),`@slot('${se}')`)),Z=Z.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(ce,se,we)=>{if(L[se]){let ge=L[se];if(ge.includes(Me)){let ie=de[se]||"",Y=ge.indexOf(Me);ge=ge.slice(0,Y)+ie+ge.slice(Y+Me.length)}return ge}return we||""}),Z=os(Z,L),Z=Z.replace(/\{\{\s*slot\s*\}\}/g,()=>L.content||""),Z=hs(Z,I),e.__originalFilePath=l,b=await $r(Z,e,N,p,h),b=`<!-- stx-layout: ${j} -->
|
|
1313
|
-
${b}`,k(b)}catch(N){if(N instanceof J)throw N;throw new re(`Error processing layout ${j}: ${N instanceof Error?N.message:String(N)}`,l)}return k(await $r(b,e,l,p,h))}function os(n,e){return n.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(l,a,h)=>{let r=e[a];if(r!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(r))return r}return h||""})}function as(n,e){if(n.__stx_sfc_mode=!0,n.__stx_options=e,e.buildMode)n.__stx_buildMode=e.buildMode;let l=e.envPrefix||"STX_PUBLIC_",a={};for(let[h,r]of Object.entries(process.env))if(h.startsWith(l)&&r!==void 0)a[h]=r;n.$env=a}async function cs(n,e){await $e(()=>Yt(n,e),void 0,(l)=>{U.log(l,{filePath:n,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${n}: ${l.message}`)})}var dt="data-stx-source";function vr(n,e){if(!n)return n;let l=/^<script\b([^>]*)>/i.exec(n);if(!l||!/\bserver\b/.test(l[1])||l[1].includes(dt))return n;return`<script ${dt}="${encodeURIComponent(e)}"${n.slice(7)}`}function ls(n){let e=new RegExp(`${dt}="([^"]*)"`).exec(n);return e?decodeURIComponent(e[1]):void 0}function kr(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Sr(n,e,l){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a <script server> ${e==="module-resolution"?"imports a module that does not resolve":e==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${kr(n)}</span><span style="display:block;margin-top:4px">${kr(l)}</span></div>`}async function us(n,e,l,a){let{scanScriptTags:h}=await o("stx/signal-processing",()=>import("./chunk-
|
|
1313
|
+
${b}`,k(b)}catch(N){if(N instanceof J)throw N;throw new re(`Error processing layout ${j}: ${N instanceof Error?N.message:String(N)}`,l)}return k(await $r(b,e,l,p,h))}function os(n,e){return n.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(l,a,h)=>{let r=e[a];if(r!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(r))return r}return h||""})}function as(n,e){if(n.__stx_sfc_mode=!0,n.__stx_options=e,e.buildMode)n.__stx_buildMode=e.buildMode;let l=e.envPrefix||"STX_PUBLIC_",a={};for(let[h,r]of Object.entries(process.env))if(h.startsWith(l)&&r!==void 0)a[h]=r;n.$env=a}async function cs(n,e){await $e(()=>Yt(n,e),void 0,(l)=>{U.log(l,{filePath:n,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${n}: ${l.message}`)})}var dt="data-stx-source";function vr(n,e){if(!n)return n;let l=/^<script\b([^>]*)>/i.exec(n);if(!l||!/\bserver\b/.test(l[1])||l[1].includes(dt))return n;return`<script ${dt}="${encodeURIComponent(e)}"${n.slice(7)}`}function ls(n){let e=new RegExp(`${dt}="([^"]*)"`).exec(n);return e?decodeURIComponent(e[1]):void 0}function kr(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Sr(n,e,l){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a <script server> ${e==="module-resolution"?"imports a module that does not resolve":e==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${kr(n)}</span><span style="display:block;margin-top:4px">${kr(l)}</span></div>`}async function us(n,e,l,a){let{scanScriptTags:h}=await o("stx/signal-processing",()=>import("./chunk-f5vdse5a.js")),r=[],p=!A()&&!Pn();for(let b of h(n)){let S=b.attrs;if(!/\bserver\b/.test(S))continue;let v=b.start+b.fullMatch.indexOf(">")+1,k=Cr(n,v);if(k===-1)continue;let C=n.slice(v,k);if(!C.trim())continue;let _=ls(S)??l,P={index:b.start,length:k+9-b.start};try{let{extractVariables:I}=await o("stx/variable-extractor",()=>import("./chunk-hdyacfen.js"));await I(C,e,_,{preserveExisting:!0,onFailure:(L)=>{if(L.kind==="unknown")return;if(a?.onServerScriptError?.({sourcePath:_,kind:L.kind,message:L.message}),!p)return;r.push({...P,markup:Sr(_,L.kind,L.message)})}})}catch(I){let L=I instanceof Error?I:Error(String(I));if(U.log(L,{filePath:_,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${_}: ${L.message}`),p)r.push({...P,markup:Sr(_,"unknown",L.message)})}}if(r.length===0)return n;let w=n;for(let b of r.sort((S,v)=>v.index-S.index))w=w.slice(0,b.index)+b.markup+w.slice(b.index+b.length);return w}async function ds(n,e,l){try{let{interpolateScriptsInTemplate:a}=await o("stx/expressions",()=>import("./chunk-c57g2mtw.js"));return a(n,e,{skipServer:!0})}catch(a){let h=a instanceof Error?a:Error(String(a));return U.log(h,{filePath:l,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${l}: ${h.message}`),n}}async function $r(n,e,l,a,h){let r=n;await E();let p=a;if(r=await us(r,e,l,a),r=await Wt(r,e,l),r=await Xt(r,e,l),r=await ds(r,e,l),await E(),r=await Dt(r,e,l,p),Te(r))r=Zo(r,e),r=ks(r,e),r=Ss(r,e);r=Qo(r),await E();let{processStreamDirectives:w}=await o("stx/streaming",()=>import("./chunk-razx95wk.js"));r=w(r,e),r=await Ko(r,e,l,p,!0),await E(),r=await ir(r,e,l,p,h),r=await bs(r,e,l,p,h),await E(),r=Cc(r,e,l,p);let{processDeferDirectives:b}=await o("stx/defer",()=>import("./chunk-6pczzq5f.js"));r=b(r,e,l);let{processTeleportDirectives:S}=await o("stx/teleport",()=>import("./chunk-ba91r7q9.js"));r=S(r,e,l);let{processTransitionDirectives:v,processTransitionAttributes:k}=await o("stx/transitions",()=>import("./chunk-7wqevtks.js"));r=v(r,e,l),r=k(r);let{processErrorBoundaryDirectives:C,stripRenderFailedMarkers:_}=await o("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));r=C(r,e,l),r=_(r);let{processSuspenseDirectives:P}=await o("stx/suspense",()=>import("./chunk-j4zrq17p.js"));r=P(r,e,l);let{processAsyncDirectives:I}=await o("stx/async-components",()=>import("./chunk-f52b9hjv.js"));r=I(r,e,l);let{processKeepAliveDirectives:L}=await o("stx/keep-alive",()=>import("./chunk-meqsd5bt.js"));r=L(r,e,l);let{processVirtualListDirectives:j,processVirtualGridDirectives:F,processInfiniteListDirectives:q}=await o("stx/virtual-scrolling",()=>import("./chunk-2asyyky3.js"));r=j(r,e,l),r=F(r,e,l),r=q(r,e,l),await E();let{processPartialHydrationDirectives:W,processStaticDirectives:N}=await o("stx/partial-hydration",()=>import("./chunk-3ryp43f3.js"));r=W(r,e,l),r=N(r);let{processComputedDirectives:B,processWatchDirectives:V}=await o("stx/computed",()=>import("./chunk-1xdzcy9d.js"));r=B(r,e,l),r=V(r,e,l);let{processFormValidationDirectives:K}=await o("stx/forms-validation",()=>import("./chunk-ajkqbjbp.js"));r=K(r,e,l);let{processHeadDirective:ue,processTitleDirective:Z,processMetaDirective:de,resetHead:ce}=await o("stx/head",()=>import("./chunk-cjy9cdm0.js"));if(!e.__stx_head_preset&&!e.__stx_runtime_head)ce();let se=ue(r);if(r=se.content,se.headContent)e.__stx_head_raw=`${e.__stx_head_raw||""}${se.headContent}
|
|
1314
1314
|
`;if(r=Z(r,e),r=de(r,e,l),r=Qt(r),r=Go(r,e),r=Mt(r),r=Kt(r),r=await gs(r,e,l,p,h),r=await bs(r,e,l,p,h),await E(),r=r.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),r=ki(r),r=le(r,e,l),r=ws(r),await E(),e.__stxProcessingDepth===1)r=sl(r,e);if(r=Zc(r,e,{filePath:l,buildMode:p.buildMode}),r=Xo(r,e),r=Jo(r,e),r=Ze(r,e),r=Ft(r,e),r=Ut(r,e),r=await St(r,e,l,p),r=await Tc(r,e,l),r=await Rc(r,e,l,p),await E(),r=Ac(r,e,l,p),r=ii(r,e,l,p),r=ai(r,e,l),r=ci(r,e,l,p),r=At(r,e,l,p),r=Gs(r,e),r=Xs(r),r=el(r),!p.skipEventDirectives)r=Hc(r,e,l);if(r=Qc(r,e,l,a.skipSignalsRuntime===!0&&Number(e.__stxProcessingDepth)>0),await E(),p.debug){let X=/\bx-data\s*=/.test(r),z=xs(n);if(X&&z)console.warn(`[stx] ${l}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
1315
1315
|
Both work on the same page, but they manage separate scopes.
|
|
1316
1316
|
Prefer signals (state/derived/effect) for new components.`)}r=vc(r,e),r=await Ai(r,e,l),await E(),r=tl(r),r=nl(r),r=wt(r);let{processXElementDirectives:we}=await o("stx/x-element",()=>import("./chunk-b666d8m6.js"));r=we(r);let ge=e.__originalFilePath||l,ie=ze(e);if(r=await ei(r,p,ge,ie),await E(),r=jt(r,e),r=await Jt(r,e,l,p),await E(),p.media?.image?.autoSiblings){let X=p.publicDir||"public",{rewriteImagesWithSiblings:z}=await o("stx/image-optimization/auto-sibling",()=>import("./chunk-ytzzth34.js"));r=await z(r,{publicDir:X})}if(p.seo?.enabled)r=li(r,e,p);let Y=(X,z,ee=!0)=>{if(!z)return X;let be=z.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),oe=/<head\b[^>]*>[\s\S]*?(?:<\/head\s*>|<body\b|$)/i.exec(X),me=oe?/<title\b[^>]*>[\s\S]*?<\/title>/i.exec(oe[0]):null;if(be&&oe&&me){if(ee){let De=oe.index+me.index;X=X.slice(0,De)+be[0]+X.slice(De+me[0].length)}if(z=z.replace(be[0],"").trim(),!z)return X}if(/<\/head>/i.test(X))return f(X,z);if(/<head\b[^>]*>/i.test(X))return X.replace(/(<head\b[^>]*>)/i,`$1
|
|
@@ -1322,6 +1322,6 @@ ${ht()}
|
|
|
1322
1322
|
</script>`;if(r.includes("</head>")){let ee=D(r),oe=r.slice(0,ee).indexOf("<script");if(oe!==-1){let me=r.slice(0,oe),De=r.slice(oe);r=me+z+`
|
|
1323
1323
|
`+De}else r=f(r,z)}else if(r.includes("<body"))r=r.replace(/<body([^>]*)>/,`<body$1>
|
|
1324
1324
|
${z}`);else r=z+`
|
|
1325
|
-
`+r}{let{scanScriptTags:X}=await o("stx/signal-processing",()=>import("./chunk-
|
|
1325
|
+
`+r}{let{scanScriptTags:X}=await o("stx/signal-processing",()=>import("./chunk-f5vdse5a.js")),z=[];for(let ee of X(r)){if(!/\bserver\b/i.test(ee.attrs))continue;let be=ee.start+ee.fullMatch.indexOf(">")+1,oe=Cr(r,be);if(oe===-1)continue;let me=oe+9;while(me<r.length&&/\s/.test(r[me]))me++;z.push({start:ee.start,end:me})}if(z.length>0){let ee=Array(z.length+1),be=0;for(let oe=0;oe<z.length;oe++){let{start:me,end:De}=z[oe];ee[oe]=r.slice(be,me),be=De}ee[z.length]=r.slice(be),r=ee.join("")}}let ft=qs(r,l);if(ft.hasScoped)r=ft.html;let Ir=e.__stx_event_bindings||[],Qe=!1,gt=[],Or=/\s:[a-z][\w.-]*\s*=/.test(r),{scanScriptTags:jr}=await o("stx/signal-processing",()=>import("./chunk-f5vdse5a.js"));for(let X of jr(r,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))gt.push({match:X.fullMatch,attrs:X.attrs,content:X.body});for(let{match:X,attrs:z,content:ee}of gt){Qe=!0;let be=ee;je(ee,l,a.strict,e.__originalFilePath);let oe=await He(ee,{eventBindings:Ir,attrs:z,hasColonDirectives:Or,templateContent:n,filePath:l,projectRoot:process.cwd(),production:Bi(a.buildMode,a.minifyClient),serverData:ie});r=r.replace(X,()=>oe)}if(Qe)e.__stx_event_bindings=[];if(!Qe&&e.__stxProcessingDepth===1){let X=e.__stx_event_bindings||[];if(X.length>0){let z=hi(X);if(z){let ee=c(r);r=ee===-1?r+z:r.slice(0,ee)+z+`
|
|
1326
1326
|
`+r.slice(ee)}e.__stx_event_bindings=[]}}if(!p.skipSignalsRuntime&&!ke(r)&&Sc(r))r=await mr(r,p);if(r=kc(r),p.csp?.enabled&&p.csp.useNonce&&typeof e.cspNonce==="string")r=Tt(r,e.cspNonce);return r}
|
|
1327
1327
|
export{kt,Ne,hc,ps,zo,Ho,cr,i};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ra,vu,Kn,Xm,xu,Su,ku,Jm}from"./chunk-
|
|
2
|
+
import{Ra,vu,Kn,Xm,xu,Su,ku,Jm}from"./chunk-c60qda5c.js";import"./chunk-rkd27m4m.js";import"./chunk-0dyec13e.js";import"./chunk-k32q90b2.js";import"./chunk-g0xn80gz.js";import"./chunk-farh4p7f.js";import"./chunk-qjey0jk6.js";export{Kn as Validator,vu as defineForm,xu as processErrorDirective,Su as processErrorsDirective,Jm as processFormValidationDirectives,ku as processHasErrorsDirective,Ra as useForm,Xm as v};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{V,rg,ri,$c,a,M,iy,ay}from"./chunk-
|
|
2
|
+
import{V,rg,ri,$c,a,M,iy,ay}from"./chunk-xt1cxmkx.js";import"./chunk-w1vk83kx.js";import"./chunk-tnp2ta5q.js";import"./chunk-rw5492e2.js";import"./chunk-83tvkw4y.js";import"./chunk-kh6njq2r.js";import"./chunk-rkd27m4m.js";import"./chunk-0dyec13e.js";import"./chunk-k32q90b2.js";import"./chunk-g0xn80gz.js";import"./chunk-farh4p7f.js";import"./chunk-qjey0jk6.js";export{M as config,V as defaultConfig,iy as defineStxConfig,ri as discoverConfig,a as loadStxConfig,$c as resolveInstalledPackage,rg as resolveStxDirectories,ay as validateConfig};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Uo,Wo,qo,Gh,ys,Xh}from"./chunk-
|
|
2
|
+
import{Uo,Wo,qo,Gh,ys,Xh}from"./chunk-46x7a1cj.js";export{ys as clearImageDeliveryCatalog,Gh as deliveredImage,qo as efficientDeliverySources,Uo as getImageDelivery,Wo as isTransparentImage,Xh as prepareImageDelivery};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{m,p}from"./chunk-g0xn80gz.js";import{ee,L,g}from"./chunk-
|
|
2
|
+
import{m,p}from"./chunk-g0xn80gz.js";import{ee,L,g}from"./chunk-rkd27m4m.js";function z(t,o){let i=1,r=o,e="<template",n="</template";while(r<t.length&&i>0){let s=t.indexOf("<",r);if(s===-1)break;if(r=s,t.startsWith(e,r)&&(r+e.length>=t.length||/[\s>\/]/.test(t[r+e.length]))){i++,r+=e.length;continue}if(t.startsWith(n,r)){let a=t.indexOf(">",r+n.length);if(a!==-1){if(i--,i===0)return a+1;r=a+1;continue}}r++}return i===0?r:-1}var N=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function k(t,o){let i=null;for(let r=o;r<t.length;r++){let e=t[r];if(i){if(e==="\\"){r++;continue}if(e===i)i=null;continue}if(e==='"'||e==="'"){i=e;continue}if(e===">")return r+1}return-1}function B(t,o,i){let r=o.toLowerCase(),e=1,n=i;while(n<t.length){let s=t.indexOf("<",n);if(s===-1)return-1;if(t.startsWith("<!--",s)){let f=t.indexOf("-->",s+4);n=f===-1?t.length:f+3;continue}let a=k(t,s+1);if(a===-1)return-1;let u=t.slice(s,a),c=u.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(c&&c[2].toLowerCase()===r){if(c[1]==="/"){if(e--,e===0)return a}else if(!/\/\s*>$/.test(u))e++}n=a}return-1}function Z(t){let o=[],i=[],r=/\bslot\s*=\s*(?:"([^"]+)"|'([^']+)')/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let l=t.indexOf("-->",n+4);e=l===-1?t.length:l+3;continue}let s=k(t,n+1);if(s===-1)break;let a=t.slice(n,s),u=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!u){e=s;continue}let c=u[2].toLowerCase();if(u[1]==="/"){let l=i.lastIndexOf(c);if(l!==-1)i.splice(l);e=s;continue}let f=/\/\s*>$/.test(a),d=i.length===0?a.match(r):null;if(d){let l=d[1]||d[2],h=a.replace(r,"").replace(/\s+(?=\/?>$)/,"").replace(/\s{2,}/g," "),S=f||N.has(c)?-1:B(t,c,s);if(S===-1)o.push({start:n,end:s,slotName:l,element:h}),e=s;else o.push({start:n,end:S,slotName:l,element:h+t.slice(s,S)}),e=S;continue}if(!f&&!N.has(c)){if(i.push(c),c==="script"||c==="style"){let l=t.toLowerCase().indexOf(`</${c}>`,s);if(l!==-1){e=l;continue}}}e=s}return o}function j(t){let o=[],i=[],r=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let l=t.indexOf("-->",n+4);e=l===-1?t.length:l+3;continue}let s=k(t,n+1);if(s===-1)break;let a=t.slice(n,s),u=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!u){e=s;continue}let c=u[1]==="/",f=u[2].toLowerCase();if(c){let l=i.lastIndexOf(f);if(l!==-1)i.splice(l);e=s;continue}if(f==="template"&&i.length===0){let l=a.match(r);if(l){let h=z(t,s);if(h!==-1){let S=l[1]||l[2]||l[3];o.push({start:n,end:h,slotName:S,content:t.slice(s,h-11).trim(),propsBinding:l[4]||void 0}),e=h;continue}}}if(!/\/\s*>$/.test(a)&&!N.has(f)){if(i.push(f),f==="script"||f==="style"){let l=t.toLowerCase().indexOf(`</${f}>`,s);if(l!==-1){e=l;continue}}}e=s}return o}function tu(t){let o={default:"",named:new Map},i=t,r=j(t);for(let n of r)o.named.set(n.slotName,{name:n.slotName,content:n.content,propsBinding:n.propsBinding});r.sort((n,s)=>s.start-n.start);for(let n of r)i=i.slice(0,n.start)+i.slice(n.end);let e=Z(i);for(let n of e){let s=o.named.get(n.slotName);if(s)s.content+=n.element;else o.named.set(n.slotName,{name:n.slotName,content:n.element})}for(let n=e.length-1;n>=0;n--){let s=e[n];i=i.slice(0,s.start)+i.slice(s.end)}return o.default=i.trim(),o}function Im(t){let o=t.match(/name\s*=\s*["']([^"']+)["']/),i=o?o[1]:"",r={},e=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,n;while((n=e.exec(t))!==null)r[n[1]]=n[2];let s=t.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),a=s?s[1].trim():"";return{name:i,props:r,defaultContent:a}}async function nu(t,o,i,r){if(!t)return i;let e=t.content;if(t.propsBinding&&Object.keys(o).length>0){let n=t.propsBinding.trim(),s={...r},a=new Set,u=new Set;if(n.startsWith("{")&&n.endsWith("}")){let c=n.slice(1,-1).split(",").map((f)=>f.trim()).filter(Boolean);for(let f of c){let[d,l]=f.split(":").map((S)=>S.trim()),h=l||d;if(s[h]=o[d],o[d]!==void 0)u.add(h);else a.add(h)}}else if(s[n]=o,Object.values(o).some((c)=>c===void 0))a.add(n);else u.add(n);e=I(e,s,a,u)}return e}function I(t,o,i,r){return t.replace(/\{\{\s*([^}]+)\s*\}\}/g,(e,n)=>{try{let s=n.trim();if(L(s,i))return e;if(Array.isArray(o.__stx_preserved_client_expressions)&&o.__stx_preserved_client_expressions.includes(s)&&!L(s,r))return e;let a=_(s,o);if(a===void 0)return e;return g(String(a??""))}catch{return`{{ ${n} }}`}})}function _(t,o){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(t)){let r=t.split("."),e=o;for(let n of r)if(e&&typeof e==="object"&&n in e)e=e[n];else return;return e}let i=t.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(i){let[,r,e,n]=i,s=o[r],a=parseInt(n,10);if(typeof s==="number")switch(e){case"+":return s+a;case"-":return s-a;case"*":return s*a;case"/":return s/a}}try{if(!m(t))return;return p(t,Object.keys(o))(...Object.values(o))}catch{return}}async function ru(t,o,i,r){let e=t;e=await W(e,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(a,u,c,f)=>{let d=o.named.get(u),l=f?.trim()||"",h=c||"",S={},E=[],C=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,b;while((b=C.exec(h))!==null){let w=b[1],x=b[2];S[w]=_(x,i),E.push([w,x])}if(r!==void 0&&d?.propsBinding&&Object.values(S).some((w)=>w===void 0)){let w=d.propsBinding.trim(),x=ee(`${w} in []`),y="__stx_slot_props";while(x.includes(y))y+="_";let M=E.map(([A,P])=>{let O=S[A],R;try{R=O===void 0?void 0:JSON.stringify(O)}catch{}return`${JSON.stringify(A)}:(${R??P})`}).join(","),v=g(JSON.stringify({binding:w,names:x,owner:r}));return`<template :for="${g(`${y} in [{${M}}]`)}" data-stx-slot-binding="${encodeURIComponent(w)}" data-stx-slot-scope="${v}">${d.content}</template>`}return await nu(d,S,l,i)});let s=/<slot\b((?:"[^"]*"|'[^']*'|[^>"'])*?)\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return e=e.replace(s,(a,u,c)=>{if(/\bname\s*=/.test(u||""))return a;let f=c?.trim()||"";return o.default||f}),e}async function W(t,o,i){let r=[],e=[];t.replace(o,(a,...u)=>{let c=u[u.length-2];return e.push({match:a,index:c}),r.push(i(a,...u.slice(0,-2))),a});let n=await Promise.all(r),s=t;for(let a=e.length-1;a>=0;a--){let{match:u,index:c}=e[a];s=s.slice(0,c)+n[a]+s.slice(c+u.length)}return s}function Om(t){let o=tu(t);return{defaultSlot:o.default,namedSlots:o.named}}async function Nm(t,o,i,r,e){return await ru(t,{default:o,named:i},r,e)}
|
|
3
3
|
export{tu,Im,nu,ru,Om,Nm};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{dm}from"./chunk-e8y2c1sq.js";import"./chunk-67xreg70.js";import"./chunk-97cyjqa5.js";import"./chunk-764f1sf1.js";import"./chunk-2qjyzekc.js";import"./chunk-dx2t73jn.js";import"./chunk-xt1cxmkx.js";import"./chunk-w1vk83kx.js";import"./chunk-tnp2ta5q.js";import"./chunk-rw5492e2.js";import"./chunk-83tvkw4y.js";import"./chunk-kh6njq2r.js";import"./chunk-rkd27m4m.js";import"./chunk-0dyec13e.js";import"./chunk-k32q90b2.js";import"./chunk-g0xn80gz.js";import"./chunk-farh4p7f.js";import"./chunk-qjey0jk6.js";export{dm as startProductionServer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ce,Ys,Ig,my,Og,hy,Cn,g,G,ne,En,Te,Ng,Ri,Dg,yy,R,Ai,Mg,by,I,wy}from"./chunk-
|
|
2
|
+
import{Ce,Ys,Ig,my,Og,hy,Cn,g,G,ne,En,Te,Ng,Ri,Dg,yy,R,Ai,Mg,by,I,wy}from"./chunk-rkd27m4m.js";import"./chunk-0dyec13e.js";import"./chunk-k32q90b2.js";import"./chunk-g0xn80gz.js";import"./chunk-farh4p7f.js";import"./chunk-qjey0jk6.js";export{Mg as applyFilters,hy as clearCustomFilters,Ng as clientLoopScopes,Ys as defaultFilters,En as escapeAttributeValue,g as escapeHtml,G as escapeHtmlValue,ne as escapeInterpolatedHtmlValue,I as evaluateExpression,Ce as findMustacheEnd,Og as getAllFilters,Dg as interpolateScriptAttributes,Ri as interpolateScriptExpressions,yy as interpolateScriptsInTemplate,R as processExpressions,Ai as processExpressionsChunked,Ig as registerFilter,my as registerFilters,Cn as replaceInterpolations,by as resetRejectedExpressionWarnings,wy as unescapeHtml,Te as usesSignalsInScript};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{R}from"./chunk-
|
|
2
|
+
import{R}from"./chunk-rkd27m4m.js";import{ge}from"./chunk-67dgp45w.js";function g(e,t){let r={};for(let n of e)r[n]=ge(t(n));return new Proxy({},{get:(n,a)=>r[a]?.(),set:(n,a,o)=>{if(r[a])r[a].set(o);else r[a]=ge(o);return!0},has:(n,a)=>(a in r),deleteProperty:(n,a)=>(delete r[a],!0),ownKeys:()=>Reflect.ownKeys(r),getOwnPropertyDescriptor:(n,a)=>(a in r)?{enumerable:!0,configurable:!0,writable:!0,value:r[a]()}:void 0})}function v(e,t){let r={};for(let n of t)r[n]=e[n];return r}function Ra(e,t){let r=Object.keys(e),n=g(r,(i)=>t?.[i]??e[i].getDefaultValue()),a=g(r,()=>[]),o=g(r,()=>!1),c=g(r,()=>!1),f=g(r,()=>!1),s=ge(!1);async function u(i){f[i]=!0;let d=await e[i].validate(n[i],n);return a[i]=d,f[i]=!1,d.length===0}async function l(){s.set(!0);let i=await Promise.all(r.map(u));return s.set(!1),i.every(Boolean)}function m(){for(let i of r)n[i]=t?.[i]??e[i].getDefaultValue(),a[i]=[],o[i]=!1,c[i]=!1}function h(i){for(let d of r)if(d in i)n[d]=i[d],c[d]=!0}function b(i,d){n[i]=d,c[i]=!0}function y(i,d=!0){if(o[i]=d,d)u(i)}function p(i){return{value:n[i],errors:a[i],touched:o[i],dirty:c[i],valid:a[i].length===0,validating:f[i]}}function V(i){return async(d)=>{d?.preventDefault?.();for(let w of r)o[w]=!0;if(await l())await i(v(n,r))}}return{values:n,errors:a,touched:o,dirty:c,get isValid(){return r.every((i)=>a[i].length===0)},get isValidating(){return s()||r.some((i)=>f[i])},get isDirty(){return r.some((i)=>c[i])},validate:l,validateField:u,reset:m,setValues:h,setFieldValue:b,setFieldTouched:y,getFieldState:p,handleSubmit:V}}var vu=Ra;class Kn{rules=[];defaultValue="";addRule(e){let t=new Kn;return t.rules=[...this.rules,e],t.defaultValue=this.defaultValue,t}required(e="This field is required"){return this.addRule({name:"required",message:e,validate:(t)=>{if(t===null||t===void 0)return e;if(typeof t==="string"&&t.trim()==="")return e;if(Array.isArray(t)&&t.length===0)return e;return!0}})}email(e="Please enter a valid email"){return this.addRule({name:"email",message:e,validate:(t)=>{if(!t)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(t))||e}})}url(e="Please enter a valid URL"){return this.addRule({name:"url",message:e,validate:(t)=>{if(!t)return!0;try{return new URL(String(t)),!0}catch{return e}}})}min(e,t){let r=t||`Must be at least ${e} characters`;return this.addRule({name:"min",message:r,validate:(n)=>{if(!n)return!0;return String(n).length>=e||r}})}max(e,t){let r=t||`Must be no more than ${e} characters`;return this.addRule({name:"max",message:r,validate:(n)=>{if(!n)return!0;return String(n).length<=e||r}})}length(e,t,r){let n=r||`Must be between ${e} and ${t} characters`;return this.addRule({name:"length",message:n,validate:(a)=>{if(!a)return!0;let o=String(a).length;return o>=e&&o<=t||n}})}pattern(e,t="Invalid format"){return this.addRule({name:"pattern",message:t,validate:(r)=>{if(!r)return!0;return e.test(String(r))||t}})}hasUppercase(e="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,e)}hasLowercase(e="Must contain a lowercase letter"){return this.pattern(/[a-z]/,e)}hasNumber(e="Must contain a number"){return this.pattern(/\d/,e)}hasSpecial(e="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,e)}alphanumeric(e="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,e)}startsWithLetter(e="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,e)}noSpaces(e="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:e,validate:(t)=>{if(!t)return!0;return!String(t).includes(" ")||e}})}number(e="Must be a number"){let t=this.addRule({name:"number",message:e,validate:(r)=>{if(!r&&r!==0)return!0;return!Number.isNaN(Number(r))||e}});return t.defaultValue=0,t}integer(e="Must be a whole number"){return this.addRule({name:"integer",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number.isInteger(Number(t))||e}})}positive(e="Must be a positive number"){return this.addRule({name:"positive",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)>0||e}})}negative(e="Must be a negative number"){return this.addRule({name:"negative",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)<0||e}})}minValue(e,t){let r=t||`Must be at least ${e}`;return this.addRule({name:"minValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)>=e||r}})}maxValue(e,t){let r=t||`Must be no more than ${e}`;return this.addRule({name:"maxValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)<=e||r}})}between(e,t,r){let n=r||`Must be between ${e} and ${t}`;return this.addRule({name:"between",message:n,validate:(a)=>{if(!a&&a!==0)return!0;let o=Number(a);return o>=e&&o<=t||n}})}matches(e,t){let r=t||`Must match ${e}`;return this.addRule({name:"matches",message:r,validate:(n,a)=>{if(!a)return!0;return n===a[e]||r}})}oneOf(e,t){let r=t||`Must be one of: ${e.join(", ")}`;return this.addRule({name:"oneOf",message:r,validate:(n)=>{if(!n)return!0;return e.includes(n)||r}})}notOneOf(e,t){let r=t||`Cannot be one of: ${e.join(", ")}`;return this.addRule({name:"notOneOf",message:r,validate:(n)=>{if(!n)return!0;return!e.includes(n)||r}})}date(e="Must be a valid date"){return this.addRule({name:"date",message:e,validate:(t)=>{if(!t)return!0;let r=new Date(String(t));return!Number.isNaN(r.getTime())||e}})}before(e,t){let r=new Date(e),n=t||`Must be before ${r.toLocaleDateString()}`;return this.addRule({name:"before",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))<r||n}})}after(e,t){let r=new Date(e),n=t||`Must be after ${r.toLocaleDateString()}`;return this.addRule({name:"after",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))>r||n}})}custom(e,t="Invalid value"){return this.addRule({name:"custom",message:t,validate:e})}async(e,t="Invalid value"){return this.addRule({name:"async",message:t,async:!0,validate:e})}when(e,t){let r=new Kn;r.rules=[...this.rules],r.defaultValue=this.defaultValue;for(let n of t.getRules())r.rules.push({...n,validate:(a,o)=>{if(!e(a,o||{}))return!0;return n.validate(a,o)}});return r}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default(e){let t=new Kn;return t.rules=[...this.rules],t.defaultValue=e,t}async validate(e,t){let r=[];for(let n of this.rules){let a=await n.validate(e,t);if(a!==!0)r.push(a)}return r}validateSync(e,t){let r=[];for(let n of this.rules){if(n.async)continue;let a=n.validate(e,t);if(a!==!0)r.push(a)}return r}}var Xm=new Kn;function xu(e,t,r){let n=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return u.map((l)=>R(c,{...t,message:l},r)).join(`
|
|
3
3
|
`)}catch{return""}})}function Su(e,t,r){let n=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return u.map((l)=>R(c,{...t,message:l},r)).join(`
|
|
4
4
|
`)}catch{return""}})}function ku(e,t,r){let n=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return c}catch{return""}})}function Jm(e,t,r){let n=e;return n=xu(n,t,r),n=Su(n,t,r),n=ku(n,t,r),n}export{Ra,vu,Kn,Xm,xu,Su,ku,Jm};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{vr}from"./chunk-kh6njq2r.js";import{Nr}from"./chunk-g0xn80gz.js";import{a}from"./chunk-
|
|
2
|
+
import{vr}from"./chunk-kh6njq2r.js";import{Nr}from"./chunk-g0xn80gz.js";import{a}from"./chunk-xt1cxmkx.js";import{H,nt}from"./chunk-8s6s6nd0.js";import{_c}from"./chunk-hmdkf6c6.js";import{D,c}from"./chunk-fd1bpv35.js";var x=/<style\b[^>]*>/iy,R=/<\/style>/gi,b=/<script\b[^>]*>/iy,S=/<template(?=[\s>/])[^>]*>/iy,w=/<\/template\s*>/iy;function gr(e){let r=0,t=0,s=-1;while(r<e.length){let n=e.indexOf("<",r);if(n===-1)return-1;if(e.startsWith("<!--",n)){let g=e.indexOf("-->",n+4);r=g===-1?e.length:g+3;continue}x.lastIndex=n;let u=x.exec(e);if(u){R.lastIndex=n+u[0].length;let g=R.exec(e);r=g===null?e.length:g.index+8;continue}S.lastIndex=n;let o=S.exec(e);if(o){if(t===0)s=n;t++,r=n+o[0].length;continue}w.lastIndex=n;let d=w.exec(e);if(d){if(t>0)t--;r=n+d[0].length;continue}if(b.lastIndex=n,b.test(e))return t>0?s:n;r=n+1}return-1}function Z(e,r={}){return new vr(e,r).routes}import y from"path";var T=new Map;async function h(e,r){let t=e,s=r;if(!t||!s)try{let d=await a();t||=d?.pagesDir||"pages",s||=d?.root||"."}catch{t||="pages",s||="."}let n=y.isAbsolute(t)?t:y.join(s,t),u=T.get(n);if(u)return u;let o=[];try{o=Z(".",{pagesDir:n,emit:!1}).map((d)=>d.regex.source).filter(Boolean)}catch{o=[]}return T.set(n,o),o}function E(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function l(e){return E(JSON.stringify(e))}function ke(e){return e.includes("data-stx-runtime")}function Sc(e){let r=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let t=r.exec(e);t!==null;t=r.exec(e)){let s=e.slice(Math.max(0,t.index-80),t.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(s))continue;return!0}return!1}function p(e,r){let t=gr(e),s=e.search(/<!doctype\b/i);if(t!==-1&&(s===-1||t>s))return e.slice(0,t)+r+`
|
|
3
3
|
`+e.slice(t);let n=Nr(e);if(n!==null)return`${e.slice(0,n)}
|
|
4
4
|
${r}${e.slice(n)}`;if(e.includes("</head>")){let o=D(e);return e.slice(0,o)+r+`
|
|
5
5
|
`+e.slice(o)}if(H(e))return nt(e,(o)=>`${o}
|
|
6
6
|
${r}`);return`${r}
|
|
7
|
-
${e}`}async function mr(e,r){if(e.includes("data-stx-runtime")||e.includes("window.stx.state")||e.includes("STX Signals Runtime"))return e;if(r.buildMode==="serve"){let{getServeClientAsset:n}=await import("./chunk-
|
|
7
|
+
${e}`}async function mr(e,r){if(e.includes("data-stx-runtime")||e.includes("window.stx.state")||e.includes("STX Signals Runtime"))return e;if(r.buildMode==="serve"){let{getServeClientAsset:n}=await import("./chunk-et9pa7gr.js"),{url:u}=await n("runtime",r.debug===!0);return p(e,`<script data-stx-runtime src="${u}"></script>`)}if(r.buildMode==="compile")return p(e,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:t}=await import("./chunk-et9pa7gr.js"),s=await t(r.debug);return p(e,`<script data-stx-scoped data-stx-runtime>${s}</script>`)}function O(e){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(e)}function kc(e){if(e.includes("data-stx-tooltip-runtime")||!O(e))return e;let r=`<script data-stx-scoped data-stx-tooltip-runtime>${_c()}</script>`,t=c(e);if(t===-1)return`${e}
|
|
8
8
|
${r}`;return`${e.slice(0,t)}${r}
|
|
9
|
-
${e.slice(t)}`}var C=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function M(e){return C.test(e)||e.includes("__stxRouter)return")||e.includes("__stxRouter=true")}async function _e(e,r){if(!e.includes("</body>"))return e;if(M(e))return e;let t=r?.router,s="",n="";{let i={};if(t){if(t.container)i.container=t.container;if(t.interceptAllLinks!==void 0)i.interceptAllLinks=t.interceptAllLinks;if(t.progress!==void 0)i.progress=t.progress;if(t.viewTransitions!==void 0)i.viewTransitions=t.viewTransitions;if(t.viewTransitionDuration!==void 0)i.viewTransitionDuration=t.viewTransitionDuration;if(t.viewTransitionEasing!==void 0)i.viewTransitionEasing=t.viewTransitionEasing;if(t.scrollToTop!==void 0)i.scrollToTop=t.scrollToTop;if(t.scrollRestoration!==void 0)i.scrollRestoration=t.scrollRestoration;if(t.prefetch!==void 0)i.prefetch=t.prefetch;if(t.cache!==void 0)i.cache=t.cache;if(t.progressColor!==void 0)i.progressColor=t.progressColor;if(t.progressHeight!==void 0)i.progressHeight=t.progressHeight;if(t.prefetchVisible!==void 0)i.prefetchVisible=t.prefetchVisible;if(t.prefetchVisibleMax!==void 0)i.prefetchVisibleMax=t.prefetchVisibleMax;if(t.prefetchBudgetBytes!==void 0)i.prefetchBudgetBytes=t.prefetchBudgetBytes;if(t.keepOpening!==void 0)i.keepOpening=t.keepOpening}try{let f=await h(r?.pagesDir,r?.root);if(f.length>0)if(r?.buildMode==="serve"){let{registerServeModuleBundle:_}=await import("./chunk-
|
|
9
|
+
${e.slice(t)}`}var C=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function M(e){return C.test(e)||e.includes("__stxRouter)return")||e.includes("__stxRouter=true")}async function _e(e,r){if(!e.includes("</body>"))return e;if(M(e))return e;let t=r?.router,s="",n="";{let i={};if(t){if(t.container)i.container=t.container;if(t.interceptAllLinks!==void 0)i.interceptAllLinks=t.interceptAllLinks;if(t.progress!==void 0)i.progress=t.progress;if(t.viewTransitions!==void 0)i.viewTransitions=t.viewTransitions;if(t.viewTransitionDuration!==void 0)i.viewTransitionDuration=t.viewTransitionDuration;if(t.viewTransitionEasing!==void 0)i.viewTransitionEasing=t.viewTransitionEasing;if(t.scrollToTop!==void 0)i.scrollToTop=t.scrollToTop;if(t.scrollRestoration!==void 0)i.scrollRestoration=t.scrollRestoration;if(t.prefetch!==void 0)i.prefetch=t.prefetch;if(t.cache!==void 0)i.cache=t.cache;if(t.progressColor!==void 0)i.progressColor=t.progressColor;if(t.progressHeight!==void 0)i.progressHeight=t.progressHeight;if(t.prefetchVisible!==void 0)i.prefetchVisible=t.prefetchVisible;if(t.prefetchVisibleMax!==void 0)i.prefetchVisibleMax=t.prefetchVisibleMax;if(t.prefetchBudgetBytes!==void 0)i.prefetchBudgetBytes=t.prefetchBudgetBytes;if(t.keepOpening!==void 0)i.keepOpening=t.keepOpening}try{let f=await h(r?.pagesDir,r?.root);if(f.length>0)if(r?.buildMode==="serve"){let{registerServeModuleBundle:_}=await import("./chunk-et9pa7gr.js");n=`<script data-stx-owned-routes src="${_(`(window.__stxRouterConfig=window.__stxRouterConfig||{}).ownedRoutes=${l(f)};
|
|
10
10
|
`)}"></script>
|
|
11
11
|
`}else i.ownedRoutes=f}catch{}if(Object.keys(i).length>0)s=`<script>window.__stxRouterConfig=${l(i)};</script>
|
|
12
|
-
`}let{getCachedRouterScript:u,getServeClientAsset:o}=await import("./chunk-
|
|
12
|
+
`}let{getCachedRouterScript:u,getServeClientAsset:o}=await import("./chunk-et9pa7gr.js"),d=r?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':r?.buildMode==="serve"?`<script data-stx-router src="${(await o("router")).url}"></script>`:`<script data-stx-router>${await u()}</script>`,g=c(e);return e.slice(0,g)+s+n+d+`
|
|
13
13
|
</body>`+e.slice(g+7)}
|
|
14
14
|
export{gr,Z,ke,Sc,mr,kc,_e};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Le,T,te}from"./chunk-
|
|
2
|
+
import{Le,T,te}from"./chunk-rkd27m4m.js";import{C}from"./chunk-qjey0jk6.js";import{N,On}from"./chunk-farh4p7f.js";import{a}from"./chunk-xt1cxmkx.js";import{xe,un,dn,pn}from"./chunk-gwa31y9x.js";import{Ct}from"./chunk-fbtm3frc.js";import{xt,Gn,nn,fe}from"./chunk-ynkbv9jq.js";import{A,In}from"./chunk-bwdbj60y.js";import v from"fs";import b from"path";import x from"process";function U(s,o){for(let e of s.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(e[1])o.add(e[1]);for(let e of s.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let t of(e[1]??"").split(",")){let r=((t.includes(":")?t.split(":").pop():t)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(r))o.add(r)}for(let e of s.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let t of(e[1]??"").split(",")){let n=t.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(n))o.add(n)}}var h=new Map;async function O(s,o=A()){let e;if(s)e=b.resolve(s);else{let l=await a();e=b.resolve(l.root||x.cwd(),l.storesDir||"stores")}let t=`${e}\x00${dn()}\x00${o?"shared":"inline"}`,n=new Bun.Glob("*.ts"),r=[];try{for await(let l of n.scan({cwd:e,absolute:!0})){let c=b.basename(l,".ts");if(["index","types"].includes(c))continue;if(l.includes(".d.ts"))continue;r.push(l)}}catch{return fe(h,t,"",{chunks:[]}),null}let i=()=>[...new Set([...r,...r.flatMap((l)=>xe(l))])],f=xt(i()),u=nn(h,t,f);if(u!==void 0)return u.chunks.length>0?u:null;if(r.length===0)return fe(h,t,f,{chunks:[]}),null;let m=[];for(let l of r){let c=await Bun.file(l).text();m.push({file:l,hasUseStore:/useStore\s*\(/.test(c)})}m.sort((l,c)=>{if(l.hasUseStore===c.hasUseStore)return 0;return l.hasUseStore?1:-1});let p=m.map((l)=>l.file),g=[],d=te({loader:"ts",target:"browser",define:T()});for(let l of p)try{let c=await Bun.file(l).text(),k=b.basename(l,".ts"),_=new Set;U(c,_);let y=[...c.matchAll(/\bdefineStore\s*(?:<[^>()]*>)?\(\s*(['"`])([^'"`$\\]+)\1/g)].map((I)=>I[2]),E=c.match(/\bdefineStore\s*(?:<[^>()]*>)?\(/g)?.length??0;if(un(c))c=await pn(c,l,{projectRoot:x.cwd(),externalizeUserModules:o});c=Ct(c),c=N(c),c=On(c),c=c.replace(/^export\s+(default\s+)?/gm,""),c=d.transformSync(c),g.push({name:k,ids:y.length===E?y:[],declared:_,code:`// Store: ${k}
|
|
3
3
|
${c.trim()}`})}catch(c){console.warn(`[stx] Failed to load store ${l}:`,c)}if(g.length===0)return fe(h,t,f,{chunks:[]}),null;f=xt(i());let S={chunks:g};return fe(h,t,f,S),S}function R(s){let o=new Set;for(let r of s)for(let i of r.declared)o.add(i);let e=s.map((r)=>r.code).join(`
|
|
4
4
|
|
|
5
5
|
`),n=`;(function(){
|