@stacksjs/stx 0.2.342 → 0.2.343
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/caching.js +1 -0
- package/dist/{chunk-48x5bsqv.js → chunk-0dpgh7a6.js} +1 -1
- package/dist/{chunk-evtrctj9.js → chunk-0fp16c1x.js} +1 -1
- package/dist/{chunk-p5d8sb50.js → chunk-0s3ry262.js} +1 -1
- package/dist/{chunk-tmj45xq5.js → chunk-12qteqk8.js} +1 -1
- package/dist/chunk-160g7ynw.js +2 -0
- package/dist/chunk-16hr5y08.js +2 -0
- package/dist/{chunk-anf2y2h5.js → chunk-1bfvdjpy.js} +1 -1
- package/dist/{chunk-y956wapy.js → chunk-1h1c2048.js} +1 -1
- package/dist/{chunk-bt8w146r.js → chunk-1qtd4ex2.js} +2 -2
- package/dist/{chunk-2swnc8kg.js → chunk-1zav2sf1.js} +1 -1
- package/dist/{chunk-gbkq5qnw.js → chunk-2853ye06.js} +2 -2
- package/dist/{chunk-4vcyf1kh.js → chunk-36j9qset.js} +2 -2
- package/dist/{chunk-74r1zw2h.js → chunk-3d3x7dwy.js} +1 -1
- package/dist/chunk-3h97y3n3.js +2 -0
- package/dist/chunk-3j915h2d.js +2 -0
- package/dist/{chunk-1gwbw81h.js → chunk-45ydb29q.js} +1 -1
- package/dist/{chunk-ts3wfjh9.js → chunk-4fafxr8d.js} +1 -1
- package/dist/chunk-4hkg6kx4.js +2 -0
- package/dist/{chunk-8tsr51hj.js → chunk-4pg6wbt6.js} +1 -1
- package/dist/{chunk-saqbtgqr.js → chunk-4vd0rqfs.js} +1 -1
- package/dist/{chunk-wv8h3d68.js → chunk-53sjbp3z.js} +1 -1
- package/dist/chunk-57494khk.js +2 -0
- package/dist/{chunk-4wpxbkbe.js → chunk-57dxdvjh.js} +1 -1
- package/dist/{chunk-k3w3gwm3.js → chunk-5azeswj2.js} +1 -1
- package/dist/{chunk-k5b9471y.js → chunk-5hq25yky.js} +1 -1
- package/dist/chunk-5xavmr4t.js +2 -0
- package/dist/{chunk-kznb3hdj.js → chunk-5zemhhwe.js} +1 -1
- package/dist/{chunk-ghd80w8a.js → chunk-62vng8g8.js} +2 -2
- package/dist/{chunk-reskzmsb.js → chunk-649dfqqz.js} +1 -1
- package/dist/{chunk-6nxq8rcw.js → chunk-6g8rvnhc.js} +1 -1
- package/dist/chunk-6rsfkms1.js +2 -0
- package/dist/{chunk-xe93ae3r.js → chunk-6xs80tka.js} +3 -3
- package/dist/{chunk-s4mmmwj4.js → chunk-7mc1k1tq.js} +1 -1
- package/dist/{chunk-25b8z7xa.js → chunk-7r79j1hs.js} +1 -1
- package/dist/{chunk-drs93sry.js → chunk-7yfk9393.js} +1 -1
- package/dist/{chunk-r46cg4qa.js → chunk-7zxv2631.js} +1 -1
- package/dist/{chunk-d389vyyz.js → chunk-8ah5mhst.js} +2 -2
- package/dist/{chunk-zv4gb3wb.js → chunk-905j49fe.js} +1 -1
- package/dist/chunk-9czj483k.js +2 -0
- package/dist/chunk-9kv0qavn.js +2 -0
- package/dist/{chunk-m39hb2a2.js → chunk-a0ajg9z5.js} +1 -1
- package/dist/{chunk-mznr9nyp.js → chunk-ag8gdk51.js} +1 -1
- package/dist/{chunk-gwc54hjc.js → chunk-amfq5rnz.js} +2 -2
- package/dist/{chunk-rh7mwwb4.js → chunk-aqxwwq6w.js} +2 -2
- package/dist/{chunk-hk8j3eps.js → chunk-ay336sqb.js} +1 -1
- package/dist/chunk-bcz8yp2g.js +2 -0
- package/dist/{chunk-rr49zrz6.js → chunk-brjfzbq9.js} +1 -1
- package/dist/chunk-bxefsc7k.js +2 -0
- package/dist/chunk-c4kv3r8t.js +2 -0
- package/dist/{chunk-yzv702kk.js → chunk-c7qdnc5d.js} +1 -1
- package/dist/{chunk-ys56ecvx.js → chunk-daxr6p6q.js} +1 -1
- package/dist/{chunk-yhvrq2qd.js → chunk-dj5mqnp1.js} +1 -1
- package/dist/{chunk-da0tfpa2.js → chunk-e53pwshq.js} +1 -1
- package/dist/{chunk-k9ep24bd.js → chunk-e6rxvz3p.js} +1 -1
- package/dist/{chunk-x7dv5rq7.js → chunk-ec18ftcg.js} +1 -1
- package/dist/chunk-eh3meyd3.js +64 -0
- package/dist/{chunk-yq7fc8sa.js → chunk-em8cr7wy.js} +1 -1
- package/dist/{chunk-thrv2nbz.js → chunk-ey1tsk22.js} +1 -1
- package/dist/{chunk-e0kzyf1g.js → chunk-fbmjw0bh.js} +1 -1
- package/dist/chunk-fytemc96.js +2 -0
- package/dist/{chunk-zv4nf0x2.js → chunk-g0dbtyk7.js} +1 -1
- package/dist/chunk-g7gc0ten.js +2 -0
- package/dist/chunk-gqsxxd81.js +2 -0
- package/dist/{chunk-sytwy0mg.js → chunk-grnmr3y1.js} +1 -1
- package/dist/{chunk-4ecv1e3w.js → chunk-gvfgrve8.js} +1 -1
- package/dist/chunk-gx9z0wmm.js +2 -0
- package/dist/{chunk-3b0mgxbk.js → chunk-h6y99nak.js} +1 -1
- package/dist/chunk-hq3phk1a.js +3 -0
- package/dist/{chunk-01ggk8k8.js → chunk-hrdd26r4.js} +1 -1
- package/dist/{chunk-567g1ttv.js → chunk-hzbty7hz.js} +1 -1
- package/dist/{chunk-6nvm939g.js → chunk-jagf7h9y.js} +1 -1
- package/dist/{chunk-xec226zb.js → chunk-jh6f1a9y.js} +1 -1
- package/dist/chunk-jnxzzzm4.js +2 -0
- package/dist/chunk-jy6jwxhs.js +2 -0
- package/dist/{chunk-r1rfwm01.js → chunk-k3dtvay1.js} +1 -1
- package/dist/chunk-k8skvm0d.js +2 -0
- package/dist/{chunk-1xwfws06.js → chunk-kbah2k8e.js} +2 -2
- package/dist/{chunk-beextc84.js → chunk-kgbz86sa.js} +2 -2
- package/dist/chunk-khqn40gv.js +2 -0
- package/dist/{chunk-fx29n4vc.js → chunk-m0xaw0qw.js} +1 -1
- package/dist/chunk-mhbzrh5y.js +2 -0
- package/dist/{chunk-mbstfjnj.js → chunk-mwvxhv0r.js} +1 -1
- package/dist/{chunk-cqw3c1xg.js → chunk-p3awq80d.js} +1 -1
- package/dist/chunk-p8anntjb.js +2 -0
- package/dist/chunk-pwe51myj.js +2 -0
- package/dist/{chunk-gkq323fg.js → chunk-pwhf5kte.js} +1 -1
- package/dist/{chunk-25f0s8t1.js → chunk-q6825wwz.js} +1 -1
- package/dist/{chunk-f2qbjr3z.js → chunk-q9ckfwhh.js} +1 -1
- package/dist/{chunk-ytx17bg2.js → chunk-rns7wjy9.js} +1 -1
- package/dist/chunk-rqqdvnp5.js +2 -0
- package/dist/chunk-rzg9pars.js +7 -0
- package/dist/{chunk-yr7camcd.js → chunk-s60eccqk.js} +1 -1
- package/dist/{chunk-ntm1761b.js → chunk-s7qbba8r.js} +10 -10
- package/dist/{chunk-hrmxxs0w.js → chunk-safmgrq5.js} +1 -1
- package/dist/{chunk-ebd3z4j9.js → chunk-stqm4brp.js} +1 -1
- package/dist/{chunk-1t3j8a0q.js → chunk-t00ga194.js} +1 -1
- package/dist/{chunk-fm5211ec.js → chunk-tqw1yean.js} +1 -1
- package/dist/{chunk-hnffkdzc.js → chunk-tz68qv47.js} +1 -1
- package/dist/{chunk-1spzqjve.js → chunk-vaggjvsm.js} +1 -1
- package/dist/{chunk-q4cemvkw.js → chunk-vj3nx26v.js} +1 -1
- package/dist/chunk-w1mbrq1g.js +2 -0
- package/dist/chunk-w84qe2m6.js +2 -0
- package/dist/{chunk-c33y19bn.js → chunk-wdaf98ya.js} +1 -1
- package/dist/chunk-wjm7hv5e.js +2 -0
- package/dist/{chunk-byjy9far.js → chunk-wnmegbw0.js} +1 -1
- package/dist/{chunk-0sq5mdrh.js → chunk-wyhb3nb0.js} +1 -1
- package/dist/{chunk-j82hfkcf.js → chunk-xgw269cf.js} +234 -236
- package/dist/{chunk-jcbj3xp4.js → chunk-y5sxa2sq.js} +1 -1
- package/dist/{chunk-mkgbrbr9.js → chunk-yefnrr5z.js} +1 -1
- package/dist/chunk-yr7s02f7.js +2 -0
- package/dist/{chunk-p52cm7ch.js → chunk-z9hb80mk.js} +1 -1
- package/dist/{chunk-c73pyeak.js → chunk-zcytk5w9.js} +1 -1
- package/dist/chunk-zq3tm2c2.js +2 -0
- package/dist/{chunk-5g9vbhbt.js → chunk-zr1x54bt.js} +1 -1
- package/dist/cli.js +14 -14
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/custom-directives.js +21 -8
- package/dist/database.js +1 -1
- package/dist/directive-arguments.d.ts +107 -0
- package/dist/directive-arguments.js +171 -0
- package/dist/head.d.ts +7 -30
- package/dist/head.js +15 -5
- package/dist/meta-arguments.d.ts +52 -0
- package/dist/meta-arguments.js +55 -0
- package/dist/process.js +1 -1
- package/dist/pwa.js +2 -2
- package/dist/seo.d.ts +39 -17
- package/dist/seo.js +221 -255
- package/dist/ssg.js +2 -2
- package/dist/types/directive-types.d.ts +12 -0
- package/dist/visual-testing.js +1 -1
- package/package.json +5 -5
- package/dist/chunk-025z2btp.js +0 -2
- package/dist/chunk-19fp0z9s.js +0 -2
- package/dist/chunk-23sv24cm.js +0 -2
- package/dist/chunk-2p68bkza.js +0 -2
- package/dist/chunk-5grrqaqs.js +0 -2
- package/dist/chunk-6jx4r94x.js +0 -2
- package/dist/chunk-6p6b01kp.js +0 -4
- package/dist/chunk-a1rt1fms.js +0 -2
- package/dist/chunk-ahpmjg3f.js +0 -64
- package/dist/chunk-akp89n3w.js +0 -2
- package/dist/chunk-bqhrryqs.js +0 -2
- package/dist/chunk-czvzaa42.js +0 -3
- package/dist/chunk-de2cfcf5.js +0 -2
- package/dist/chunk-exhbc57n.js +0 -2
- package/dist/chunk-fhhp6pmx.js +0 -2
- package/dist/chunk-fqsrft0a.js +0 -2
- package/dist/chunk-gqzccw30.js +0 -2
- package/dist/chunk-h47e1c03.js +0 -2
- package/dist/chunk-kbemcvp1.js +0 -2
- package/dist/chunk-ks4j8fjz.js +0 -2
- package/dist/chunk-pbct6nxk.js +0 -2
- package/dist/chunk-peerbcwj.js +0 -2
- package/dist/chunk-pt1w6vq2.js +0 -2
- package/dist/chunk-rgda0gwf.js +0 -2
- package/dist/chunk-rwa10jm4.js +0 -2
- package/dist/chunk-snsh9ye4.js +0 -2
- package/dist/chunk-td39mtts.js +0 -2
- package/dist/chunk-trncnwem.js +0 -2
- package/dist/chunk-vk2j3vvs.js +0 -2
- package/dist/chunk-vph6zpeq.js +0 -2
- package/dist/chunk-wa3ks5zv.js +0 -2
- package/dist/chunk-xer5kn26.js +0 -2
- package/dist/chunk-zx2krbqf.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Fw as v$,Gw as G}from"./chunk-0s3ry262.js";function y($){return $.split(/[\\/]/).filter(Boolean).slice(0,-1).some((O)=>F.includes(O))}function A($){return y($.replace(/^\//,""))}var F;var C=G(()=>{F=["components","layouts","partials","emails"]});import W from"fs";import E from"path";function H($,U){let O=$.filter((K)=>!A(K.pattern)),I=["// Auto-generated by STX - do not edit"];if(O.length===0)I.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{I.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let K of O){let V=[];for(let X of K.params){let Y=K.pattern.includes(`:${X}?`)?"?":"";V.push(`${X}${Y}: string`)}let J=V.join("; ");I.push(` '${K.pattern}': { ${J} }`)}I.push(" }","}","","export {}","")}let B=I.join(`
|
|
3
3
|
`),L=E.join(U,"route-types.d.ts");try{if(W.existsSync(L)&&W.readFileSync(L,"utf8")===B)return;W.mkdirSync(U,{recursive:!0}),W.writeFileSync(L,B)}catch{}}function q($,U,O){let I=process.cwd(),B=E.relative(I,O),L=$.filter((V)=>!A(V.pattern)),K=["// Auto-generated by stx \u2014 do not edit",`// Source: ${B||"pages"}/`,"","export const routes = ["];for(let V of L){let J=E.relative(I,V.filePath).replace(/\\/g,"/"),X=JSON.stringify(V.params),Y=V.layout?`, layout: '${E.relative(I,V.layout).replace(/\\/g,"/")}'`:"";K.push(` { pattern: '${V.pattern}', filePath: '${J}', isDynamic: ${V.isDynamic}, params: ${X}${Y} },`)}K.push("] as const",""),K.push("export type RouteName = typeof routes[number]['pattern']",""),W.mkdirSync(U,{recursive:!0}),W.writeFileSync(E.join(U,"routes.ts"),K.join(`
|
|
4
4
|
`))}var f=G(()=>{C()});import i from"path";function N($,U){let I=i.relative(U,$).replace(/\.(stx|md)$/,"");if(I=I.split(i.sep).join("/"),I==="index")return"/";if(I.endsWith("/index"))I=I.slice(0,-6);return I=I.replace(/\[\[([^\]]+)\]\]/g,":$1?"),I=I.replace(/\[([^\]]+)\]/g,":$1"),I=I.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${I}`}function j($){let U=[],O="",I=0;while(I<$.length){let B=$.slice(I),L=/^\/:([^/?*]+)\?/.exec(B);if(L){U.push(L[1]),O+="(?:/([^/]+))?",I+=L[0].length;continue}let K=/^:([^/?*]+)\*/.exec(B);if(K){U.push(K[1]),O+="(.+)",I+=K[0].length;continue}let V=/^:([^/?*]+)/.exec(B);if(V){U.push(V[1]),O+="([^/]+)",I+=V[0].length;continue}O+=$[I].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),I+=1}return{regex:new RegExp(`^${O}$`),params:U}}function o($,U){let O=$===""?"/":$;for(let I of U){let B=O.match(I.regex);if(B){let L={};return I.params.forEach((K,V)=>{L[K]=B[V+1]}),{route:I,params:L}}}return null}function r($){let U=$.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return j(U)}var g=()=>{};import b$ from"fs";import d from"path";function R($,U){let O=[],I=d.dirname($);while(I.startsWith(U)||I===U){let B=d.join(I,"_layout.stx");if(b$.existsSync(B))O.unshift(B);if(I===U)break;I=d.dirname(I)}return O}var m=()=>{};import S from"fs";import Q from"path";function t($,U){let O=[];if(!S.existsSync($))return O;let I=S.readdirSync($,{withFileTypes:!0});for(let B of I){let L=Q.join($,B.name);if(B.isDirectory()){if(B.name.startsWith("."))continue;if(F.includes(B.name))continue;O.push(...t(L,U))}else if(B.isFile()){let K=Q.extname(B.name);if(U.includes(K)){if(B.name.startsWith("_")&&B.name!=="_layout.stx")continue;if(B.name==="_layout.stx")continue;O.push(L)}}}return O}class b{routes;pagesDir;pagesDirs;config;constructor($,U={}){this.config=U;let O=U.pagesDirs&&U.pagesDirs.length>0?U.pagesDirs:[U.pagesDir||"pages"];this.pagesDirs=O.map((J)=>Q.resolve($,J)),this.pagesDir=this.pagesDirs[0];let I=U.extensions||[".stx"],B=(J)=>{let X=Q.resolve($,J);try{return S.realpathSync(X)}catch{return X}},L=(U.exclude??[]).filter((J)=>typeof J==="string"&&J.trim()!=="").map(B),K=(J)=>{if(L.length===0)return!1;let X=B(J);return L.some((Y)=>X===Y||X.startsWith(`${Y}${Q.sep}`))},V=new Set;this.routes=[];for(let J of this.pagesDirs){let X=t(J,I).filter((Z)=>!K(Z)),Y=new Map;for(let Z of X){let _=N(Z,J),z=U.pagesDirs?_.replace(/:[\w]+/g,":param"):_;if(U.pagesDirs&&Y.has(z))throw Error(`Conflicting layer pages for ${_}: ${Y.get(z)} and ${Z}`);if(Y.set(z,Z),V.has(z))continue;V.add(z);let{regex:S$,params:s}=j(_),D=U.layouts!==!1?R(Z,J):[];this.routes.push({pattern:_,regex:S$,params:s,filePath:Z,isDynamic:s.length>0,layout:D.length>0?D[D.length-1]:void 0})}}if(this.routes.sort((J,X)=>{if(!J.isDynamic&&X.isDynamic)return-1;if(J.isDynamic&&!X.isDynamic)return 1;let Y=J.pattern.split("/").length,Z=X.pattern.split("/").length;if(Y!==Z)return Z-Y;return J.pattern.localeCompare(X.pattern)}),U.emit!==!1){let J=Q.resolve($,U.stateDir||process.env.STX_DIR?.trim()||".stx");H(this.routes,J),q(this.routes,J,this.pagesDir)}}match($){let U=$===""?"/":$;for(let O of this.routes){let I=U.match(O.regex);if(I){let B={};return O.params.forEach((L,K)=>{B[L]=I[K+1]}),{route:O,params:B}}}return null}resolve($,U){let O=this.routes.find((B)=>B.pattern===$||B.filePath.includes($));if(!O)return"#not-found";let I=O.pattern;if(U)for(let[B,L]of Object.entries(U))I=I.replace(`:${B}`,encodeURIComponent(L));return I}addRoute($){this.routes.push($),this.routes.sort((U,O)=>{if(!U.isDynamic&&O.isDynamic)return-1;if(U.isDynamic&&!O.isDynamic)return 1;return U.pattern.localeCompare(O.pattern)})}getLayout($){return $.layout??null}}function a($,U){return new b($,U)}function e($,U){let O=[`${U}.stx`,"error.stx"];for(let I of O){let B=Q.join($,I);if(S.existsSync(B))return B}return null}function $$($,U){return $.map((O)=>{let I=Q.relative(U,O.filePath),B=O.isDynamic?" (dynamic)":"";return`${O.pattern} \u2192 ${I}${B}`})}var U$=G(()=>{f();g();m();C()});function I$($){x=$.replace(/\/$/,"")}function O$($,U,O={}){M[$]={path:U,name:$,params:O}}function B$($){for(let[U,O]of Object.entries($))if(typeof O==="string")M[U]={path:O,name:U};else M[U]={...O,name:U}}function J$($,U={},O=!1){let I=M[$];if(!I)return console.warn(`Route [${$}] not defined.`),"#undefined-route";let B={...I.params,...U},L=I.path;L=L.replace(/:(\w+)/g,(V,J)=>{let X=B[J];if(X===void 0)return console.warn(`Missing parameter [${J}] for route [${$}].`),`:${J}`;return delete B[J],encodeURIComponent(String(X))});let K=Object.entries(B);if(K.length>0){let V=K.map(([J,X])=>`${encodeURIComponent(J)}=${encodeURIComponent(String(X))}`).join("&");L+=(L.includes("?")?"&":"?")+V}return O&&x?`${x}${L}`:L}function K$(){for(let $ of Object.keys(M))delete M[$];x=""}var M,x="";var L$=G(()=>{M={}});import V$ from"fs";import X$ from"path";function Y$($,U={}){return{type:"redirect",path:$,options:{replace:U.replace??!1,external:U.external??!1,redirectCode:U.redirectCode??302}}}function Z$($){return{type:"abort",error:typeof $==="string"?{statusCode:500,message:$}:$}}function G$($,U={}){return{handler:$,mode:U.mode??"universal"}}function h($){let U={};if(!$)return U;let O=$.split(";");for(let I of O){let[B,...L]=I.split("=");if(B){let K=B.trim(),V=L.join("=").trim();if(K)U[K]=decodeURIComponent(V)}}return U}function k($,U,O={}){let I=`${encodeURIComponent($)}=${encodeURIComponent(U)}`;if(O.expires){let B=typeof O.expires==="number"?new Date(Date.now()+O.expires*1000):O.expires;I+=`; Expires=${B.toUTCString()}`}if(O.path)I+=`; Path=${O.path}`;if(O.domain)I+=`; Domain=${O.domain}`;if(O.secure)I+="; Secure";if(O.httpOnly)I+="; HttpOnly";if(O.sameSite)I+=`; SameSite=${O.sameSite}`;return I}function c($,U){let O=$.headers.get("cookie")||"",I=h(O);return{get(B){return I[B]},set(B,L,K={}){I[B]=L,U.append("Set-Cookie",k(B,L,K))},delete(B){delete I[B],U.append("Set-Cookie",k(B,"",{expires:new Date(0),path:"/"}))},getAll(){return{...I}}}}function l(){return{get($){if(typeof document>"u")return;return h(document.cookie)[$]},set($,U,O={}){if(typeof document>"u")return;document.cookie=k($,U,O)},delete($){if(typeof document>"u")return;document.cookie=k($,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return h(document.cookie)}}}function u(){let $=typeof window<"u"&&typeof window.localStorage<"u";return{get(U){if(!$)return null;try{return window.localStorage.getItem(U)}catch{return null}},set(U,O){if(!$)return;try{window.localStorage.setItem(U,O)}catch{}},remove(U){if(!$)return;try{window.localStorage.removeItem(U)}catch{}},isAvailable(){return $}}}function v($,U){T.set($,U)}function p($){return T.get($)}function Q$($){return T.has($)}function W$(){T.clear()}function M$(){return Array.from(T.keys())}async function _$($,U="middleware"){let O=X$.resolve($,U);if(!V$.existsSync(O))return;let I=V$.readdirSync(O);for(let B of I){if(!B.endsWith(".ts")&&!B.endsWith(".js"))continue;if(B.includes(".test.")||B.includes(".spec."))continue;let L=B.replace(/\.(ts|js)$/,""),K=X$.join(O,B);try{let J=(await import(K)).default;if(J&&typeof J.handler==="function")v(L,J);else if(typeof J==="function")v(L,{handler:J,mode:"universal"})}catch(V){console.warn(`Failed to load middleware '${L}' from ${K}:`,V)}}}function x$($){let U={};if(!$)return U;let O=new URLSearchParams($);for(let[I,B]of O)U[I]=B;return U}function z$($,U,O,I=""){return{path:$,params:U,query:x$(I),fullPath:I?`${$}?${I}`:$,meta:O}}function F$($,U,O,I){let B=I?.isServer??typeof window>"u",L=!B,K=new Headers;return{to:$,from:U,isClient:L,isServer:B,cookies:B&&O?c(O,K):l(),storage:u(),state:{},request:O,responseHeaders:K}}async function A$($,U){let O=Array.isArray($)?$:[$],I=U.isServer;for(let B of O){let L=p(B);if(!L)return console.error(`Route middleware '${B}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${B}' is not registered`}},state:U.state,responseHeaders:U.responseHeaders};if(L.mode==="server"&&!I)continue;try{let K=await L.handler(U);if(K){if(K.type==="redirect")return{passed:!1,redirect:K,state:U.state,responseHeaders:U.responseHeaders};if(K.type==="abort")return{passed:!1,abort:K,state:U.state,responseHeaders:U.responseHeaders}}}catch(K){return console.error(`Error in middleware '${B}':`,K),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:K instanceof Error?K.message:"Middleware error"}},state:U.state,responseHeaders:U.responseHeaders}}}return{passed:!0,state:U.state,responseHeaders:U.responseHeaders}}var T;var E$=G(()=>{T=new Map});function n($){let O=$.replace(/\\/g,"/").split("/").filter(Boolean),I=O.lastIndexOf("layouts"),B=I>=0?O[I+1]:O.at(-1);if(!B)return"app";return B.replace(/\.stx$/i,"")||"app"}function j$($){let U=$.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),O=$.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),I=$.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),B=U?.[1]||I?.[1]||"";return{layout:B,group:O?.[1]||n(B)}}var T$=()=>{};function k$($){let U=[],O="log(",I=0;while(I<$.length){let B=$.indexOf("log(",I);if(B===-1){U.push($.slice(I));break}let L=B>0?$[B-1]:" ",K=/\bfunction\s+$/.test($.slice(Math.max(0,B-16),B));if(/[\w$.]/.test(L)||K){U.push($.slice(I,B+4)),I=B+4;continue}U.push($.slice(I,B));let V=1,J=B+4;while(J<$.length&&V>0){let X=$[J];if(X==='"'||X==="'"||X==="`"){let Y=X;J++;while(J<$.length&&$[J]!==Y){if($[J]==="\\")J++;J++}J++;continue}if(X==="(")V++;else if(X===")")V--;J++}U.push("0"),I=J}return U.join("")}function C$($){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return $}}function H$(){return`
|
|
5
5
|
;(function(){
|
|
@@ -2251,4 +2251,4 @@ else {
|
|
|
2251
2251
|
if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);else init();
|
|
2252
2252
|
})();
|
|
2253
2253
|
`}function q$(){if(w)return w;return w=C$(k$(H$())),w}function N$(){if(P)return P;return P=C$(H$()),P}var w,P;var R$=()=>{};var w$={};v$(w$,{setAppUrl:()=>I$,runMiddleware:()=>A$,route:()=>J$,resolveLayoutChain:()=>R,resetRoutes:()=>K$,registerMiddleware:()=>v,patternToRegex:()=>j,navigateTo:()=>Y$,matchRoute:()=>o,loadMiddlewareFromDirectory:()=>_$,isNonPageRoutePattern:()=>A,isNonPageRoutePath:()=>y,hasMiddleware:()=>Q$,getRouterScriptDev:()=>N$,getRouterScript:()=>q$,getMiddlewareNames:()=>M$,getMiddleware:()=>p,generateRouteTypes:()=>H,generateRouteManifest:()=>q,formatRoutes:()=>$$,findErrorPage:()=>e,filePathToPattern:()=>N,extractLayoutMetadata:()=>j$,deriveLayoutGroup:()=>n,defineRoutes:()=>B$,defineRoute:()=>O$,defineMiddleware:()=>G$,createStorageManager:()=>u,createServerCookieManager:()=>c,createRouter:()=>a,createRouteLocation:()=>z$,createMiddlewareContext:()=>F$,createClientCookieManager:()=>l,clearMiddleware:()=>W$,bracketPathToRegex:()=>r,abortNavigation:()=>Z$,Router:()=>b,NON_PAGE_DIRS:()=>F});var P$=G(()=>{U$();g();L$();E$();m();T$();f();C();R$()});
|
|
2254
|
-
export{F as
|
|
2254
|
+
export{F as Lv,y as Mv,A as Nv,H as Ov,q as Pv,N as Qv,j as Rv,o as Sv,r as Tv,R as Uv,b as Vv,a as Wv,e as Xv,$$ as Yv,I$ as Zv,O$ as _v,B$ as $v,J$ as aw,K$ as bw,Y$ as cw,Z$ as dw,G$ as ew,c as fw,l as gw,u as hw,v as iw,p as jw,Q$ as kw,W$ as lw,M$ as mw,_$ as nw,z$ as ow,F$ as pw,A$ as qw,n as rw,j$ as sw,T$ as tw,q$ as uw,N$ as vw,w$ as ww,P$ as xw};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{_r as Q}from"./chunk-aqxwwq6w.js";import"./chunk-t00ga194.js";import{mt as R}from"./chunk-vaggjvsm.js";import"./chunk-1qtd4ex2.js";import"./chunk-0s3ry262.js";import O from"fs";import U from"path";async function W(j,b={}){let q=Date.now(),z={total:0,passed:0,failed:0,new:0,failures:[],duration:0},K=b.snapshotDir||R(j.root,"story","snapshots");await O.promises.mkdir(K,{recursive:!0});let B=j.storyFiles;if(b.filter&&b.filter.length>0)B=B.filter((J)=>b.filter.some((G)=>J.fileName.toLowerCase().includes(G.toLowerCase())));for(let J of B)await X(J,K,b,z);return z.duration=Date.now()-q,z}async function X(j,b,q,z){let K=j.story;if(!K)return;for(let B of K.variants){z.total++;let J=U.join(b,`${j.id}-${B.id}.snap`),G=Y(B.source||""),L=await _(J);if(q.update||!L){let M={storyId:j.id,variantId:B.id,component:j.fileName,timestamp:Date.now(),hash:G};if(await O.promises.writeFile(J,JSON.stringify(M,null,2)),!L)z.new++;z.passed++}else try{let M=await O.promises.readFile(J,"utf-8"),N=JSON.parse(M);if(N.hash===G)z.passed++;else z.failed++,z.failures.push({storyId:j.id,variantId:B.id,component:j.fileName,message:"Snapshot mismatch",difference:Z(N.hash,G)})}catch(M){z.failed++,z.failures.push({storyId:j.id,variantId:B.id,component:j.fileName,message:`Error reading snapshot: ${M}`})}}}async function A(j,b={}){return(await W(j,{...b,update:!0})).total}function Y(j){let b=0;for(let q=0;q<j.length;q++){let z=j.charCodeAt(q);b=(b<<5)-b+z,b=b&b}return b.toString(16)}function Z(j,b){if(j===b)return 0;let q=Math.abs(Number.parseInt(j,16)-Number.parseInt(b,16));return Math.min(q/1e6,1)}async function _(j){try{return await O.promises.access(j),!0}catch{return!1}}function I(j){let b=[];if(b.push(""),b.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),b.push(" STX Story Visual Regression Tests"),b.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),b.push(""),j.failures.length>0){b.push(" \u274C Failures:"),b.push("");for(let q of j.failures){if(b.push(` \u2022 ${q.component} / ${q.variantId}`),b.push(` ${q.message}`),q.difference!==void 0)b.push(` Difference: ${(q.difference*100).toFixed(2)}%`);b.push("")}}if(b.push(" Summary:"),b.push(` Total: ${j.total}`),b.push(` Passed: ${j.passed} \u2713`),b.push(` Failed: ${j.failed} \u2717`),j.new>0)b.push(` New: ${j.new} \u26A1`);return b.push(` Time: ${j.duration}ms`),b.push(""),b.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),b.push(""),b.join(`
|
|
3
3
|
`)}async function S(j,b={}){let q=performance.now(),z=[],K=0,B=0;for(let G of j.storyFiles)try{let L=await Bun.file(G.path).text(),M=await Q(L,G.path);if(M.length>0){for(let N of M)z.push({storyId:G.id,variantId:"default",component:G.component,message:`A11y: ${N.message}`,expected:"No accessibility violations",actual:`${N.type}: ${N.message} (impact: ${N.impact})`});B++}else K++}catch(L){z.push({storyId:G.id,variantId:"default",component:G.component,message:`Failed to check a11y: ${L instanceof Error?L.message:String(L)}`,expected:"File readable for a11y check",actual:"File read error"}),B++}let J=performance.now()-q;return{total:j.storyFiles.length,passed:K,failed:B,new:0,failures:z,duration:J}}export{A as updateSnapshots,W as runVisualTests,S as runA11yTests,I as formatTestResults};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Te as a}from"./chunk-stqm4brp.js";import"./chunk-xgw269cf.js";import"./chunk-aqxwwq6w.js";import"./chunk-t00ga194.js";import"./chunk-hrdd26r4.js";import"./chunk-7r79j1hs.js";import"./chunk-ay336sqb.js";import"./chunk-6xs80tka.js";import"./chunk-vaggjvsm.js";import"./chunk-q9ckfwhh.js";import"./chunk-kbah2k8e.js";import"./chunk-k3dtvay1.js";import"./chunk-eh3meyd3.js";import"./chunk-rzg9pars.js";import"./chunk-1qtd4ex2.js";import"./chunk-ec18ftcg.js";import"./chunk-fbmjw0bh.js";import"./chunk-53sjbp3z.js";import"./chunk-kgbz86sa.js";import"./chunk-s60eccqk.js";import"./chunk-0s3ry262.js";export{a as startInteractive};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Fk as a,Gk as b,Hk as c,Ik as d,Jk as e}from"./chunk-wvc7t11n.js";import"./chunk-
|
|
2
|
+
import{Fk as a,Gk as b,Hk as c,Ik as d,Jk as e}from"./chunk-wvc7t11n.js";import"./chunk-0s3ry262.js";export{d as runPwaAudit,e as formatAuditResult,c as calculateAuditResult,a as auditConfig,b as auditBuildOutput};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$v as
|
|
2
|
+
import{$v as q,Lv as a,Mv as b,Nv as c,Ov as d,Pv as e,Qv as f,Rv as g,Sv as h,Tv as i,Uv as j,Vv as k,Wv as l,Xv as m,Yv as n,Zv as o,_v as p,aw as r,bw as s,cw as t,dw as u,ew as v,fw as w,gw as x,hw as y,iw as z,jw as A,kw as B,lw as C,mw as D,nw as E,ow as F,pw as G,qw as H,rw as I,sw as J,uw as K,vw as L,xw as M}from"./chunk-kgbz86sa.js";import"./chunk-0s3ry262.js";M();export{o as setAppUrl,H as runMiddleware,r as route,j as resolveLayoutChain,s as resetRoutes,z as registerMiddleware,g as patternToRegex,t as navigateTo,h as matchRoute,E as loadMiddlewareFromDirectory,c as isNonPageRoutePattern,b as isNonPageRoutePath,B as hasMiddleware,L as getRouterScriptDev,K as getRouterScript,D as getMiddlewareNames,A as getMiddleware,d as generateRouteTypes,e as generateRouteManifest,n as formatRoutes,m as findErrorPage,f as filePathToPattern,J as extractLayoutMetadata,I as deriveLayoutGroup,q as defineRoutes,p as defineRoute,v as defineMiddleware,y as createStorageManager,w as createServerCookieManager,l as createRouter,F as createRouteLocation,G as createMiddlewareContext,x as createClientCookieManager,C as clearMiddleware,i as bracketPathToRegex,u as abortNavigation,k as Router,a as NON_PAGE_DIRS};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{kk as a,lk as b,mk as c,nk as d}from"./chunk-q6825wwz.js";import"./chunk-62vng8g8.js";import"./chunk-xgw269cf.js";import"./chunk-aqxwwq6w.js";import"./chunk-t00ga194.js";import"./chunk-hrdd26r4.js";import"./chunk-7r79j1hs.js";import"./chunk-ay336sqb.js";import"./chunk-6xs80tka.js";import"./chunk-vaggjvsm.js";import"./chunk-q9ckfwhh.js";import"./chunk-kbah2k8e.js";import"./chunk-k3dtvay1.js";import"./chunk-eh3meyd3.js";import"./chunk-rzg9pars.js";import"./chunk-1qtd4ex2.js";import"./chunk-ec18ftcg.js";import"./chunk-fbmjw0bh.js";import"./chunk-53sjbp3z.js";import"./chunk-kgbz86sa.js";import"./chunk-s60eccqk.js";import"./chunk-0s3ry262.js";export{b as getAvailableTargets,c as getAvailableFormats,d as default,a as buildNative};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Jj as b,Kj as c,Lj as d,Mj as e,Nj as f,Oj as g,Pj as h,Qj as i,Rj as j,Sj as k,Tj as l,Uj as m,Vj as n,Wj as o}from"./chunk-hq3phk1a.js";import{tl as a}from"./chunk-fvsefztj.js";import"./chunk-xgw269cf.js";import"./chunk-aqxwwq6w.js";import"./chunk-t00ga194.js";import"./chunk-hrdd26r4.js";import"./chunk-7r79j1hs.js";import"./chunk-ay336sqb.js";import"./chunk-6xs80tka.js";import"./chunk-vaggjvsm.js";import"./chunk-q9ckfwhh.js";import"./chunk-kbah2k8e.js";import"./chunk-k3dtvay1.js";import"./chunk-eh3meyd3.js";import"./chunk-rzg9pars.js";import"./chunk-1qtd4ex2.js";import"./chunk-ec18ftcg.js";import"./chunk-fbmjw0bh.js";import"./chunk-53sjbp3z.js";import"./chunk-kgbz86sa.js";import"./chunk-s60eccqk.js";import"./chunk-0s3ry262.js";export{b as templateCache,j as registerServeModuleBundle,c as readFileCached,e as invalidateFileCacheByDir,d as invalidateFileCache,o as hashFilePath,k as getServeModuleBundle,i as getServeClientAsset,g as getCachedSignalsRuntime,h as getCachedRouterScript,l as clearDevCaches,m as checkCache,n as cacheTemplate,a as cacheEngineFingerprint,f as __setSignalsGeneratorsForTest};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{$s as d,Ys as a,Zs as b,_s as c,at as e,bt as f,ct as g,dt as h,et as i,ft as j,gt as k,ht as l}from"./chunk-6xs80tka.js";import"./chunk-vaggjvsm.js";import"./chunk-0s3ry262.js";export{e as resolveUserCssConfig,c as resetCssCache,h as rebuildCss,d as loadCssEngineConfig,b as loadCssEngine,l as injectCss,a as getCssServeAsset,i as getCachedCSS,k as generateCss,f as fingerprintConfig,j as extractClassNames,g as buildCss};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{rk as m}from"./chunk-
|
|
2
|
+
import{rk as m}from"./chunk-62vng8g8.js";import{Hw as z}from"./chunk-0s3ry262.js";import{existsSync as s,mkdirSync as T,copyFileSync as F,chmodSync as A}from"fs";import{join as Z,basename as Yq}from"path";import{spawn as j,execSync as Zq}from"child_process";import{tmpdir as c,homedir as P,platform as Lq}from"os";var Iq=`
|
|
3
3
|
<script>
|
|
4
4
|
(function() {
|
|
5
5
|
'use strict';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import{createHash as n}from"crypto";import x from"fs";import K from"path";import{decode as $Q,generateThumbHash as JQ}from"ts-images";import{createImageDeliveryCatalog as f}from"ts-images/delivery";import R from"fs";function T(Q,$,Z){let M=Buffer.alloc(Z),J=R.readSync(Q,M,0,Z,$);return M.subarray(0,J)}function P(Q){if(Q.length<25)return!1;let $=(M,J)=>String.fromCharCode(...Q.subarray(M,J));if($(0,4)!=="RIFF"||$(8,12)!=="WEBP")return!1;let Z=$(12,16);if(Z==="VP8X")return(Q[20]&16)!==0;if(Z==="VP8L")return((Q[21]|Q[22]<<8|Q[23]<<16|Q[24]<<24)>>>28&1)===1;return!1}function m(Q){let $;try{$=R.openSync(Q,"r");let Z=T($,0,33);if(Z.length>=3&&Z[0]===255&&Z[1]===216&&Z[2]===255)return"none";if(Z.length>=26&&Z[0]===137&&Z.toString("latin1",1,4)==="PNG"){let M=Z[25];if(M===4||M===6)return"possible";let J=8;for(let X=0;X<64;X++){let G=T($,J,8);if(G.length<8)return"unknown";let Y=G.toString("latin1",4,8);if(Y==="tRNS")return"possible";if(Y==="IDAT"||Y==="IEND")return"none";J+=12+G.readUInt32BE(0)}return"unknown"}if(Z.length>=25&&Z.toString("latin1",0,4)==="RIFF"&&Z.toString("latin1",8,12)==="WEBP"){if(P(Z))return"possible";let M=Z.toString("latin1",12,16);return M==="VP8 "||M==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if($!==void 0)R.closeSync($)}}import i from"fs";import O from"os";import{join as k}from"path";import{fileURLToPath as b}from"url";import{Worker as v}from"worker_threads";var I=Symbol("stx.image-worker.unavailable");function t(Q=typeof O.availableParallelism==="function"?O.availableParallelism():O.cpus().length){return Math.max(1,Math.min(2,Q-1))}var C=0,y=[];async function a(){if(C<t()){C++;return}await new Promise((Q)=>y.push(Q)),C++}function r(){C--,y.shift()?.()}var e="@stacksjs/stx/builtins/image-warmup-worker";function QQ(Q=process.cwd()){let $=import.meta.url.endsWith(".ts")?"ts":"js";try{let Z=new URL(`./image-warmup-worker.${$}`,import.meta.url);if(Z.protocol==="file:"&&i.existsSync(b(Z)))return b(Z)}catch{}try{let Z=typeof Bun<"u"?Bun.resolveSync(e,Q):void 0;return Z&&ZQ(Z)?Z:void 0}catch{return}}function ZQ(Q,$=process.env){let Z=Q.replace(/\\/g,"/");if(Z.split("/").some((J)=>/@\d[^/]*@@@\d+$/.test(J)))return!1;return![$.BUN_INSTALL_CACHE_DIR,k($.BUN_INSTALL||k(O.homedir(),".bun"),"install","cache")].filter((J)=>!!J).map((J)=>`${J.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((J)=>Z.startsWith(J))}var g=!1;function N(Q){if(!g)g=!0,console.warn(`[stx] image worker unavailable (${Q}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return I}function A(Q){return Q instanceof Error?Q.message:String(Q)}async function u(Q,$){if(typeof v!=="function")return N("node:worker_threads has no Worker in this runtime");let Z=QQ();if(!Z)return N("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await a();try{return await new Promise((M,J)=>{let X;try{X=new v(Z)}catch(B){M(N(`could not start ${Z}: ${A(B)}`));return}let G=!1,Y=!1,q=(B)=>{if(Y)return;Y=!0,B(),X.terminate()};X.on("message",(B)=>{if(B.type==="ready"){G=!0,X.postMessage({task:Q,args:$});return}if(B.type==="result"){q(()=>M(B.value));return}let j=Error(B.error?.message??"image worker failed");if(B.error?.name)j.name=B.error.name;if(B.error?.stack)j.stack=B.error.stack;q(()=>J(j))}),X.on("error",(B)=>{q(()=>G?J(B instanceof Error?B:Error(A(B)||"image worker crashed")):M(N(`the worker failed before it was ready: ${A(B)}`)))}),X.on("exit",(B)=>{q(()=>G?J(Error("image worker exited before it finished")):M(N(`the worker exited with code ${B} before it was ready`)))})})}finally{r()}}var MQ=new Set([".avif",".jpeg",".jpg",".png",".webp"]),XQ=[320,640,960,1280,1920],L="/_stx/images",BQ=`stx:${L}:alpha-1`,GQ=["@stacksjs/ts-webp","@stacksjs/ts-avif"],W;function qQ(Q,$){let Z=K.dirname(Bun.resolveSync(Q,$));while(Z!==K.dirname(Z)){let M=K.join(Z,"package.json");if(x.existsSync(M)){let J=JSON.parse(x.readFileSync(M,"utf8"));if(J.name===Q)return J.version}Z=K.dirname(Z)}return}function bQ(Q){W=Q}function KQ(){if(W!==void 0)return W;let Q;try{Q=K.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return W=GQ.map(($)=>{let Z;try{Z=Q?qQ($,Q):void 0}catch{}return`${$.replace("@stacksjs/","")}@${Z??"unknown"}`}).join("+"),W}var U=new Map,_=new Set,c=new Set;function YQ(Q){return`/${Q.split(K.sep).map(encodeURIComponent).join("/")}`}function xQ(Q){let $=K.extname(Q),Z=Q.slice(0,-$.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),M=n("sha256").update(Q).digest("hex").slice(0,8);return`${Z||"image"}-${M}`}function h(Q,$=`stx:${L}`){let Z=(M)=>`${L}/${M.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:$,async stat(M){let J=K.join(Q,M);try{let X=await x.promises.stat(J);return X.size>0?{bytes:X.size,path:J,url:Z(M)}:null}catch{return null}},async write(M,J){let X=K.join(Q,M);await x.promises.mkdir(K.dirname(X),{recursive:!0});let G=`${X}.${process.pid}.tmp`;return await x.promises.writeFile(G,J),await x.promises.rename(G,X),{bytes:J.byteLength,path:X,url:Z(M)}},url:Z}}async function l(Q,$=Q){let Z=await x.promises.readdir($,{withFileTypes:!0});Z.sort((J,X)=>J.name.localeCompare(X.name));let M=[];for(let J of Z){let X=K.join($,J.name);if(J.isDirectory()){M.push(...await l(Q,X));continue}if(!J.isFile()||!MQ.has(K.extname(J.name).toLowerCase()))continue;M.push({absolutePath:X,relativePath:K.relative(Q,X)})}return M}function p(Q,$){return Q.map((Z)=>({key:YQ(Z.relativePath),input:Z.absolutePath,name:xQ(Z.relativePath),...jQ(Z.absolutePath)?{options:{storage:$}}:{}}))}function jQ(Q){return m(Q)==="possible"}function zQ(Q){for(let $=3;$<Q.length;$+=4)if(Q[$]!==255)return!0;return!1}async function FQ(Q){let $=Object.entries(Q).filter(([,J])=>J.fallback.format==="png"),Z=new Set,M=8;for(let J=0;J<$.length;J+=8)await Promise.all($.slice(J,J+8).map(async([X,G])=>{let Y=G.variants.filter((q)=>q.format==="png").sort((q,B)=>q.width-B.width)[0];try{let q=await $Q(new Uint8Array(await x.promises.readFile(Y?.path??G.fallback.path)));if(zQ(q.data))Z.add(X)}catch{Z.add(X)}}));return Z}function VQ(Q,$){let Z=[];for(let M of $){let J=Q[M],X=J?.variants.filter((Y)=>Y.format==="webp")??[];if(!J||X.length===0)continue;if(!X.some((Y)=>{let q;try{return q=x.openSync(Y.path,"r"),!P(T(q,0,32))}catch{return!0}finally{if(q!==void 0)x.closeSync(q)}}))continue;if(J.variants=J.variants.filter((Y)=>Y.format!=="webp"),delete J.sources.webp,Z.push(M),!c.has(M))c.add(M),console.warn(`[stx-images] ${M} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return Z}async function HQ(Q){let $=[],Z=8;for(let M=0;M<Q.length;M+=8){let J=Q.slice(M,M+8),X=await Promise.all(J.map(async(G)=>{try{return await JQ(G.absolutePath),G}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${G.relativePath}`),null}}));$.push(...X.filter((G)=>G!==null))}return $}function E(Q){return K.join(Q,"undecodable.json")}function NQ(Q){try{let $=x.readFileSync(E(Q),"utf-8"),Z=JSON.parse($);return Z&&typeof Z==="object"?Z:{}}catch{return{}}}function OQ(Q,$){try{x.mkdirSync(K.dirname(E(Q)),{recursive:!0}),x.writeFileSync(E(Q),JSON.stringify($))}catch{}}function d(Q){try{let $=x.statSync(Q);return{mtimeMs:$.mtimeMs,size:$.size}}catch{return}}function o(Q){if(!Q||Q.startsWith("data:")||Q.startsWith("blob:")||/^https?:\/\//i.test(Q)||Q.startsWith("//"))return;let $=Q.split(/[?#]/,1)[0];if(!$)return;try{return`/${$.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function vQ(Q){let $=o(Q);return $?U.get($):void 0}function gQ(Q){let $=o(Q);return $?_.has($):!1}function S(){U=new Map,_=new Set}function yQ(){return{entries:[...U],transparent:[..._]}}function WQ(Q){U=new Map(Q.entries),_=new Set(Q.transparent)}async function uQ(Q,$,Z={}){if(!Q||!x.existsSync(Q))return S(),{count:0,fingerprint:""};if(Z.offThread){let z=await u("delivery",{publicDir:Q,outputDir:$});if(z!==I)return WQ(z.state),z.result}let M=await l(Q);if(M.length===0)return S(),{count:0,fingerprint:""};let J=NQ($),X=M.filter((z)=>{let V=J[z.relativePath];if(!V)return!0;let F=d(z.absolutePath);return!F||F.mtimeMs!==V.mtimeMs||F.size!==V.size});if(X.length===0)return S(),{count:0,fingerprint:""};let G=h(K.join($,"_stx","images"),`${BQ}:${KQ()}`),Y={outDir:K.join($,"_stx","images"),storage:h(K.join($,"_stx","images")),baseUrl:L,widths:XQ,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},q=X,B;try{B=await f({...Y,entries:p(X,G)})}catch(z){if(q=await HQ(X),q.length===X.length)throw z;let V=new Set(q.map((H)=>H.relativePath)),F=!1;for(let H of X){if(V.has(H.relativePath))continue;let D=d(H.absolutePath);if(!D)continue;J[H.relativePath]=D,F=!0}if(F)OQ($,J);if(q.length===0)return S(),{count:0,fingerprint:""};B=await f({...Y,entries:p(q,G)})}let j=await FQ(B.entries),w=VQ(B.entries,j);U=new Map(Object.entries(B.entries)),_=j;let s=j.size===0&&w.length===0?B.fingerprint:n("sha256").update(B.fingerprint).update(JSON.stringify({transparent:[...j].sort(),droppedWebp:w.sort()})).digest("hex");return{count:q.length,fingerprint:s}}
|
|
3
|
-
export{P as
|
|
3
|
+
export{P as ot,m as pt,I as qt,u as rt,bQ as st,KQ as tt,vQ as ut,gQ as vt,S as wt,yQ as xt,WQ as yt,uQ as zt};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Am as O,
|
|
2
|
+
import{Am as O,Ho as R,Jp as H,kq as x,pr as g}from"./chunk-xgw269cf.js";import b from"path";var v={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},M=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var T=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function f(q){let B=[],Q=0,G;T.lastIndex=0;while((G=T.exec(q))!==null){if(G.index>Q){let X=q.slice(Q,G.index);if(X.trim())B.push({type:B.length===0?"shell":"content",content:X})}let J=G[1],K=G[2];B.push({type:"suspense",name:J,content:K}),Q=G.index+G[0].length}if(Q<q.length){let J=q.slice(Q);if(J.trim())B.push({type:B.length===0?"shell":"content",content:J})}if(B.length===0)B.push({type:"shell",content:q});return B}async function r(q,B={},Q={}){let G={...g,...Q,streaming:{...v,...Q.streaming}},J=G.streaming?.bufferSize||16384;return new ReadableStream({async start(K){try{let X=await Bun.file(q).text(),z=X.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),L=z?z[1]:"",Y=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),j={...B,__filename:q,__dirname:b.dirname(q)};if(L.trim())await R(L,j,q);let D=f(Y),$=new Set;if(!D.some((w)=>w.type==="suspense")){let w=G.streaming?.strategy||"auto",U=new RegExp(M.source,"g");if(!(w!=="manual"&&U.test(Y))){let F=await H(Y,j,q,G,$);for(let V=0;V<F.length;V+=J)K.enqueue(F.slice(V,V+J)),await new Promise((W)=>setTimeout(W,0))}else{let F=[],V=new RegExp(M.source,"g"),W;while((W=V.exec(Y))!==null)F.push({name:W[1],content:W[2],start:W.index,end:W.index+W[0].length});let y=0;for(let A of F){if(A.start>y){let k=Y.slice(y,A.start);if(k.trim()){let E=await H(k,j,q,G,$);K.enqueue(E),await new Promise((S)=>setTimeout(S,0))}}let I=await H(A.content,j,q,G,$);K.enqueue(I),await new Promise((k)=>setTimeout(k,0)),y=A.end}if(y<Y.length){let A=Y.slice(y);if(A.trim()){let I=await H(A,j,q,G,$);K.enqueue(I)}}}}else{let w=new Map;for(let Z of D)if(Z.type==="shell"||Z.type==="content"){let F=await H(Z.content,j,q,G,$);K.enqueue(F)}else if(Z.type==="suspense"&&Z.name){let F=`stx-suspense-${Z.name}`;K.enqueue(`<div id="${F}" data-suspense="${Z.name}" style="display:contents;">
|
|
3
3
|
<template data-suspense-fallback>Loading...</template>
|
|
4
4
|
</div>`),w.set(Z.name,H(Z.content,j,q,G,$))}K.enqueue(`
|
|
5
5
|
<script>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Cu as Y,Su as y,fv as A,hv as H,lv as q,nv as b}from"./chunk-1qtd4ex2.js";import M from"path";class S{source;pos=0;line=1;column=0;tokens=[];constructor(K){this.source=K}tokenize(){this.tokens=[],this.pos=0,this.line=1,this.column=0;while(this.pos<this.source.length){let K=this.nextToken();if(K)this.tokens.push(K)}return this.tokens.push({type:"EOF",value:"",start:this.pos,end:this.pos,line:this.line,column:this.column}),this.tokens}nextToken(){if(this.pos>=this.source.length)return null;let K=this.pos,Q=this.line,Z=this.column,$=this.source[this.pos];if(/\s/.test($))return this.readWhitespace(K,Q,Z);if($==="/"&&this.peek(1)==="/")return this.readLineComment(K,Q,Z);if($==="/"&&this.peek(1)==="*")return this.readBlockComment(K,Q,Z);if($==='"'||$==="'")return this.readString($,K,Q,Z);if($==="`")return this.readTemplateString(K,Q,Z);if(/\d/.test($)||$==="."&&/\d/.test(this.peek(1)||""))return this.readNumber(K,Q,Z);if(/[a-z_$]/i.test($))return this.readIdentifier(K,Q,Z);if($==="{"){if(this.peek(1)==="{"&&this.peek(2)==="{")return this.advance(3),{type:"RAW_START",value:"{{{",start:K,end:this.pos,line:Q,column:Z};if(this.peek(1)==="{")return this.advance(2),{type:"EXPRESSION_START",value:"{{",start:K,end:this.pos,line:Q,column:Z};if(this.peek(1)==="!"&&this.peek(2)==="!")return this.advance(3),{type:"RAW_START",value:"{!!",start:K,end:this.pos,line:Q,column:Z}}if($==="}"){if(this.peek(1)==="}"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"}}}",start:K,end:this.pos,line:Q,column:Z};if(this.peek(1)==="}")return this.advance(2),{type:"EXPRESSION_END",value:"}}",start:K,end:this.pos,line:Q,column:Z}}if($==="!"&&this.peek(1)==="!"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"!!}",start:K,end:this.pos,line:Q,column:Z};if($==="@"&&/[a-z]/i.test(this.peek(1)||""))return this.readDirective(K,Q,Z);let z=["===","!==","==","!=","<=",">=","&&","||","??","++","--","+=","-=","*=","/=","%=","**","=>","?.","...","<<",">>",">>>","&=","|=","^="];for(let j of z)if(this.source.slice(this.pos,this.pos+j.length)===j)return this.advance(j.length),{type:"OPERATOR",value:j,start:K,end:this.pos,line:Q,column:Z};if(/[+\-*/%<>=!&|^~?:]/.test($))return this.advance(),{type:"OPERATOR",value:$,start:K,end:this.pos,line:Q,column:Z};if(/[()[\]{},;.]/.test($))return this.advance(),{type:"PUNCTUATION",value:$,start:K,end:this.pos,line:Q,column:Z};return this.advance(),{type:"PUNCTUATION",value:$,start:K,end:this.pos,line:Q,column:Z}}readWhitespace(K,Q,Z){while(this.pos<this.source.length&&/\s/.test(this.source[this.pos]))this.advance();return{type:"WHITESPACE",value:this.source.slice(K,this.pos),start:K,end:this.pos,line:Q,column:Z}}readLineComment(K,Q,Z){this.advance(2);while(this.pos<this.source.length&&this.source[this.pos]!==`
|
|
3
|
+
`)this.advance();return{type:"COMMENT",value:this.source.slice(K,this.pos),start:K,end:this.pos,line:Q,column:Z}}readBlockComment(K,Q,Z){this.advance(2);while(this.pos<this.source.length-1){if(this.source[this.pos]==="*"&&this.source[this.pos+1]==="/"){this.advance(2);break}this.advance()}return{type:"COMMENT",value:this.source.slice(K,this.pos),start:K,end:this.pos,line:Q,column:Z}}readString(K,Q,Z,$){this.advance();while(this.pos<this.source.length){let z=this.source[this.pos];if(z==="\\"){this.advance(2);continue}if(z===K){this.advance();break}this.advance()}return{type:"STRING",value:this.source.slice(Q,this.pos),start:Q,end:this.pos,line:Z,column:$}}readTemplateString(K,Q,Z){this.advance();let $=0,z=256;while(this.pos<this.source.length){let j=this.source[this.pos];if(j==="\\"){this.advance(2);continue}if(j==="$"&&this.peek(1)==="{"){if($>=z){this.pos=this.source.length;break}this.advance(2),$++;continue}if(j==="{"&&$>0){$++,this.advance();continue}if(j==="}"&&$>0){$--,this.advance();continue}if(j==="`"&&$===0){this.advance();break}this.advance()}return{type:"TEMPLATE_STRING",value:this.source.slice(K,this.pos),start:K,end:this.pos,line:Q,column:Z}}readNumber(K,Q,Z){if(this.source[this.pos]==="0"){let $=this.peek(1)?.toLowerCase();if($==="x"||$==="o"||$==="b"){this.advance(2);while(this.pos<this.source.length&&/[\da-f_]/i.test(this.source[this.pos]))this.advance();return{type:"NUMBER",value:this.source.slice(K,this.pos),start:K,end:this.pos,line:Q,column:Z}}}while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance();if(this.source[this.pos]==="."&&/\d/.test(this.peek(1)||"")){this.advance();while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance()}if(/e/i.test(this.source[this.pos]||"")){if(this.advance(),/[+-]/.test(this.source[this.pos]||""))this.advance();while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance()}if(this.source[this.pos]==="n")this.advance();return{type:"NUMBER",value:this.source.slice(K,this.pos),start:K,end:this.pos,line:Q,column:Z}}readIdentifier(K,Q,Z){while(this.pos<this.source.length&&/[\w$]/.test(this.source[this.pos]))this.advance();return{type:"IDENTIFIER",value:this.source.slice(K,this.pos),start:K,end:this.pos,line:Q,column:Z}}readDirective(K,Q,Z){this.advance();while(this.pos<this.source.length&&/[a-z]/i.test(this.source[this.pos]))this.advance();return{type:"DIRECTIVE",value:this.source.slice(K,this.pos),start:K,end:this.pos,line:Q,column:Z}}advance(K=1){for(let Q=0;Q<K&&this.pos<this.source.length;Q++){if(this.source[this.pos]===`
|
|
4
|
+
`)this.line++,this.column=0;else this.column++;this.pos++}}peek(K){return this.source[this.pos+K]}saveState(){return{pos:this.pos,line:this.line,column:this.column}}restoreState(K){this.pos=K.pos,this.line=K.line,this.column=K.column}}function D(K,Q,Z,$=0){let z=0,j=$,J=null,W=0,X=!1;while(j<K.length){let B=K[j];if(J&&X){X=!1,j++;continue}if(J&&B==="\\"){X=!0,j++;continue}if(X=!1,(B==='"'||B==="'"||B==="`")&&!J){J=B,j++;continue}if(B===J&&J!=="`"){J=null,j++;continue}if(J==="`"&&B==="$"&&K[j+1]==="{"){W++,j+=2;continue}if(W>0&&B==="}"){W--,j++;continue}if(B==="`"&&J==="`"&&W===0){J=null,j++;continue}if(J){j++;continue}if(B===Q)z++;else if(B===Z){if(z--,z===0)return j}j++}return-1}function g(K,Q){let Z=Q,$={paren:0,bracket:0,brace:0},z=null,j=0;while(Z<K.length){let J=K[Z];if((Z>0?K[Z-1]:"")==="\\"&&z){Z++;continue}if((J==='"'||J==="'")&&!z){z=J,Z++;continue}if(J===z&&z!=="`"){z=null,Z++;continue}if(J==="`"&&!z){z="`",Z++;continue}if(J==="`"&&z==="`"&&j===0){z=null,Z++;continue}if(z==="`"&&J==="$"&&K[Z+1]==="{"){j++,Z+=2;continue}if(j>0){if(J==="{")j++;else if(J==="}")j--;Z++;continue}if(z){Z++;continue}if($.paren===0&&$.bracket===0&&$.brace===0){if(K.slice(Z,Z+2)==="}}"||K.slice(Z,Z+3)==="!!}")break;if(J===","||J===";")break}if(J==="(")$.paren++;else if(J===")"){if($.paren--,$.paren<0)break}else if(J==="[")$.bracket++;else if(J==="]"){if($.bracket--,$.bracket<0)break}else if(J==="{")$.brace++;else if(J==="}"){if($.brace--,$.brace<0)break}Z++}return{expression:K.slice(Q,Z),endPos:Z}}function l(K){let Q=[],Z="",$={paren:0,bracket:0,brace:0},z=null,j=0;for(let J=0;J<K.length;J++){let W=K[J];if((J>0?K[J-1]:"")==="\\"&&z){Z+=W;continue}if((W==='"'||W==="'")&&!z){z=W,Z+=W;continue}if(W===z&&z!=="`"){z=null,Z+=W;continue}if(W==="`"&&!z){z="`",Z+=W;continue}if(W==="`"&&z==="`"&&j===0){z=null,Z+=W;continue}if(z==="`"&&W==="$"&&K[J+1]==="{"){j++,Z+=W+K[J+1],J++;continue}if(j>0&&W==="{"){j++,Z+=W;continue}if(j>0&&W==="}"){j--,Z+=W;continue}if(z){Z+=W;continue}if(W==="(")$.paren++;else if(W===")")$.paren--;else if(W==="[")$.bracket++;else if(W==="]")$.bracket--;else if(W==="{")$.brace++;else if(W==="}")$.brace--;if(W==="|"&&K[J+1]!=="|"&&(J===0||K[J-1]!=="|")&&K[J-1]!=="\\"&&$.paren===0&&$.bracket===0&&$.brace===0){Q.push(Z.trim()),Z="";continue}if(W==="|"&&K[J-1]==="\\"&&!z){Z=Z.slice(0,-1)+W;continue}Z+=W}if(Z.trim())Q.push(Z.trim());return Q}function C(K,Q){let Z=[];Q.lastIndex=0;let $;while(($=Q.exec(K))!==null){let z=$.index,j=z+$[0].length-1,J=D(K,"(",")",j);if(J===-1){Z.push({start:z,end:-1,args:"",call:K.slice(z,Math.min(K.length,z+80))}),Q.lastIndex=j+1;continue}Z.push({start:z,end:J+1,args:K.slice(j+1,J),call:K.slice(z,J+1)}),Q.lastIndex=J+1}return Z}function w(K,Q,Z,$){let z="",j=0;for(let J of C(K,Q)){if(z+=K.slice(j,J.start),J.end===-1){z+=$(J.call),j=J.start;continue}z+=Z(J.args,J.call),j=J.end}return z+K.slice(j)}function k(K){let Q=[],Z=0,$=null,z="";for(let j=0;j<K.length;j++){let J=K[j];if($){if(z+=J,J==="\\"&&j+1<K.length){z+=K[++j];continue}if(J===$)$=null;continue}if(J==="'"||J==='"'||J==="`")$=J;else if(J==="("||J==="["||J==="{")Z++;else if(J===")"||J==="]"||J==="}")Z--;else if(J===","&&Z===0){Q.push(z.trim()),z="";continue}z+=J}if(z.trim())Q.push(z.trim());return Q}function V(K){let Q=K.trim(),Z=Q[0];if(Z!=="'"&&Z!=='"'&&Z!=="`"||Q.length<2||Q.at(-1)!==Z)return null;let $="";for(let z=1;z<Q.length-1;z++){let j=Q[z];if(j==="\\"&&z+1<Q.length-1){let J=Q[++z];$+=J==="n"?`
|
|
5
|
+
`:J==="t"?"\t":J;continue}if(j===Z)return null;if(Z==="`"&&j==="$"&&Q[z+1]==="{")return null;$+=j}return $}var x=new Set(["true","false","null","undefined","typeof","void","new","in","of","instanceof","this","delete","await","async","function","return","NaN","Infinity"]);function N(K,Q){let Z=K.trim();if(!Z)return{ok:!1,message:"the argument is empty",code:Y.INVALID_DIRECTIVE_SYNTAX};let $=A(Z);if($)return{ok:!1,message:`the expression is not allowed (${$})`,code:Y.UNSAFE_EXPRESSION};let z=H(Q),j;try{j=b(Z,Object.keys(z))(...Object.values(z))}catch(W){return{ok:!1,message:`the expression could not be evaluated: ${W instanceof Error?W.message:String(W)}`,code:Y.EVALUATION_ERROR}}if(j!==void 0&&j!==null)return{ok:!0,value:j};let J=[...new Set(q(Z))].filter((W)=>!x.has(W)&&!(W in z)&&!(W in globalThis));if(J.length>0)return{ok:!1,message:`${J.map((X)=>`"${X}"`).join(", ")} ${J.length===1?"is":"are"} not defined here. Values a directive reads must come from <script server> or the render context; a plain <script> runs in the browser. To pass literal text, quote it.`,code:Y.UNDEFINED_VARIABLE};if(j===void 0&&(Z.startsWith("{")||Z.startsWith("[")))return{ok:!1,message:"the expression threw while it was evaluated",code:Y.EVALUATION_ERROR};return{ok:!0,value:j}}function _(K){if(K===null)return"null";if(Array.isArray(K))return"an array";if(typeof K==="object")return"an object";if(typeof K==="string")return`a string ("${K.length>40?`${K.slice(0,40)}...`:K}")`;return`${/^[aeiou]/.test(typeof K)?"an":"a"} ${typeof K}`}function T(K){return typeof K==="object"&&K!==null&&!Array.isArray(K)}function L(K){if(!K)return"";return M.isAbsolute(K)?M.relative(process.cwd(),K)||K:K}function G(K){let Q=K.replace(/\s+/g," ").trim();return Q.length>80?`${Q.slice(0,77)}...`:Q}function I(K,Q,Z,$,z=Y.EVALUATION_ERROR){let j=$?` in ${L($)}`:"";return console.warn(`[stx] ${G(Q)}${j}: ${Z}`),y(K,`${G(Q)}: ${Z}`,z)}function a(K,Q,Z){let $=Z?` in ${L(Z)}`:"";console.warn(`[stx] ${G(K)}${$}: ${Q}`)}var v=["og:","article:","book:","profile:","fb:","music:","video:"],d=/^[a-z][\w-]*(?::[\w:-]+)?$/i;function E(K,Q){if(K.length<1)return{kind:"error",message:"meta directive requires at least the meta name",code:Y.INVALID_DIRECTIVE_SYNTAX};if(K.length>2)return{kind:"error",message:`@meta takes a name and a value, got ${K.length} arguments`,code:Y.INVALID_DIRECTIVE_SYNTAX};let Z=m(K[0],Q);if(typeof Z!=="string")return Z;let $;if(K.length===2){let j=h(K[1],Q);if(typeof j!=="string")return j;$=j}else{let j=Z.includes(":")?Z.slice(Z.indexOf(":")+1):Z,J=Q.openGraph,W=Q[j]??(T(J)?J[j]:void 0);$=W===void 0||W===null||typeof W==="object"?"":String(W)}if(!$)return{kind:"empty"};return{kind:"tag",tag:v.some((j)=>Z.startsWith(j))?{property:Z,content:$}:{name:Z,content:$}}}function m(K,Q){let Z=V(K);if(Z!==null)return Z.trim()?Z:{kind:"error",message:"the meta name is empty",code:Y.INVALID_DIRECTIVE_SYNTAX};if(d.test(K.trim()))return K.trim();let $=N(K,Q);if(!$.ok)return{kind:"error",message:`meta name: ${$.message}`,code:$.code};if(typeof $.value!=="string"||!$.value.trim())return{kind:"error",message:`the meta name must be a non-empty string, got ${_($.value)}`,code:Y.TYPE_ERROR};return $.value}function h(K,Q){let Z=V(K);if(Z!==null)return Z;let $=N(K,Q);if(!$.ok)return{kind:"error",message:$.message,code:$.code};let z=$.value;if(z===void 0||z===null||z===!1)return"";if(Array.isArray(z))return z.filter((j)=>j!==void 0&&j!==null&&j!=="").map(String).join(", ");if(typeof z==="object"&&!(z instanceof Date))return{kind:"error",message:`the content must be text, got ${_(z)}`,code:Y.TYPE_ERROR};return String(z)}var O={},p=[],F={};function jK(){return O}function zK(){return F}function JK(){O={},p.length=0,F={}}function P(K){O=R(O,K)}function R(K,Q){return{title:Q.title??K.title,titleTemplate:Q.titleTemplate??K.titleTemplate,base:Q.base??K.base,meta:[...K.meta||[],...Q.meta||[]],link:[...K.link||[],...Q.link||[]],script:[...K.script||[],...Q.script||[]],style:[...K.style||[],...Q.style||[]],htmlAttrs:{...K.htmlAttrs,...Q.htmlAttrs},bodyAttrs:{...K.bodyAttrs,...Q.bodyAttrs}}}function u(K){P(f(K))}function f(K){let Q=[];if(K.description)Q.push({name:"description",content:K.description});if(K.keywords){let X=Array.isArray(K.keywords)?K.keywords.join(", "):K.keywords;Q.push({name:"keywords",content:X})}if(K.author)Q.push({name:"author",content:K.author});if(K.robots)Q.push({name:"robots",content:K.robots});let Z=K.ogTitle??K.title,$=K.ogDescription??K.description;if(Z)Q.push({property:"og:title",content:Z});if($)Q.push({property:"og:description",content:$});if(K.ogImage){if(Q.push({property:"og:image",content:K.ogImage}),K.ogImageType)Q.push({property:"og:image:type",content:K.ogImageType});if(K.ogImageWidth)Q.push({property:"og:image:width",content:String(K.ogImageWidth)});if(K.ogImageHeight)Q.push({property:"og:image:height",content:String(K.ogImageHeight)});if(K.ogImageAlt)Q.push({property:"og:image:alt",content:K.ogImageAlt})}if(K.ogUrl)Q.push({property:"og:url",content:K.ogUrl});if(K.ogType)Q.push({property:"og:type",content:K.ogType});if(K.ogSiteName)Q.push({property:"og:site_name",content:K.ogSiteName});if(K.ogLocale)Q.push({property:"og:locale",content:K.ogLocale});if(K.profileFirstName)Q.push({property:"profile:first_name",content:K.profileFirstName});if(K.profileLastName)Q.push({property:"profile:last_name",content:K.profileLastName});if(K.profileUsername)Q.push({property:"profile:username",content:K.profileUsername});let z=K.twitterTitle??K.title,j=K.twitterDescription??K.description,J=K.twitterImage??K.ogImage;if(K.twitterCard)Q.push({name:"twitter:card",content:K.twitterCard});if(z)Q.push({name:"twitter:title",content:z});if(j)Q.push({name:"twitter:description",content:j});if(J){Q.push({name:"twitter:image",content:J});let X=K.twitterImageAlt??(K.twitterImage?void 0:K.ogImageAlt);if(X)Q.push({name:"twitter:image:alt",content:X})}if(K.twitterSite)Q.push({name:"twitter:site",content:K.twitterSite});if(K.twitterCreator)Q.push({name:"twitter:creator",content:K.twitterCreator});if(K.articleAuthor)Q.push({property:"article:author",content:K.articleAuthor});if(K.articlePublishedTime)Q.push({property:"article:published_time",content:K.articlePublishedTime});if(K.articleModifiedTime)Q.push({property:"article:modified_time",content:K.articleModifiedTime});if(K.articleSection)Q.push({property:"article:section",content:K.articleSection});if(K.articleTags)for(let X of K.articleTags)Q.push({property:"article:tag",content:X});let W=[];if(K.canonical)W.push({rel:"canonical",href:K.canonical});return{title:K.title,titleTemplate:K.titleTemplate,meta:Q,link:W}}function WK(K){if(F={...F,...K},K.title||K.description)u({title:K.title,description:K.description})}function XK(K){let Q=typeof K==="function"?K():K;P({title:Q})}function YK(K=O){let Q=[];if(K.title){let Z=K.title;if(K.titleTemplate)Z=typeof K.titleTemplate==="function"?K.titleTemplate(Z):K.titleTemplate.replace("%s",Z);Q.push(`<title>${U(Z)}</title>`)}if(K.base){let Z=Object.entries(K.base).map(([$,z])=>`${$}="${U(z)}"`).join(" ");Q.push(`<base ${Z}>`)}for(let Z of K.meta||[]){let $=Object.entries(Z).filter(([z,j])=>j!==void 0).map(([z,j])=>{return`${z==="httpEquiv"?"http-equiv":z}="${U(String(j))}"`}).join(" ");Q.push(`<meta ${$}>`)}for(let Z of K.link||[]){let $=Object.entries(Z).filter(([z,j])=>j!==void 0).map(([z,j])=>`${z}="${U(String(j))}"`).join(" ");Q.push(`<link ${$}>`)}for(let Z of K.script||[]){let{content:$,...z}=Z,j=Object.entries(z).filter(([J,W])=>W!==void 0).map(([J,W])=>{if(typeof W==="boolean")return W?J:"";return`${J}="${U(String(W))}"`}).filter(Boolean).join(" ");if($)Q.push(`<script ${j}>${$}</script>`);else Q.push(`<script ${j}></script>`)}for(let Z of K.style||[]){let $=Z.type?` type="${Z.type}"`:"";Q.push(`<style${$}>${Z.content}</style>`)}return Q.join(`
|
|
6
|
+
`)}function BK(K=O){if(!K.htmlAttrs)return"";return Object.entries(K.htmlAttrs).map(([Q,Z])=>`${Q}="${U(Z)}"`).join(" ")}function OK(K=O){if(!K.bodyAttrs)return"";return Object.entries(K.bodyAttrs).map(([Q,Z])=>`${Q}="${U(Z)}"`).join(" ")}function U(K){return K.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function UK(K=O){if(typeof document>"u")return;if(K.title){let Q=K.title;if(K.titleTemplate)Q=typeof K.titleTemplate==="function"?K.titleTemplate(Q):K.titleTemplate.replace("%s",Q);document.title=Q}for(let Q of K.meta||[]){let Z=Q.name?`meta[name="${Q.name}"]`:Q.property?`meta[property="${Q.property}"]`:null;if(Z){let $=document.querySelector(Z);if(!$){if($=document.createElement("meta"),Q.name)$.setAttribute("name",Q.name);if(Q.property)$.setAttribute("property",Q.property);document.head.appendChild($)}$.setAttribute("content",Q.content)}}for(let Q of K.link||[]){let Z=`link[rel="${Q.rel}"]${Q.href?`[href="${Q.href}"]`:""}`,$=document.querySelector(Z);if(!$)$=document.createElement("link"),document.head.appendChild($);for(let[z,j]of Object.entries(Q))if(j!==void 0)$.setAttribute(z,String(j))}if(K.htmlAttrs)for(let[Q,Z]of Object.entries(K.htmlAttrs))if(Q==="class")for(let $ of String(Z).split(/\s+/).filter(Boolean))document.documentElement.classList.add($);else document.documentElement.setAttribute(Q,Z);if(K.bodyAttrs)for(let[Q,Z]of Object.entries(K.bodyAttrs))document.body.setAttribute(Q,Z)}function FK(K){let Q="";return{content:K.replace(/@head\s*([\s\S]*?)@endhead/g,($,z)=>{return Q+=z.trim()+`
|
|
7
|
+
`,""}),headContent:Q.trim()}}function GK(K,Q){return K.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Z,$,z,j)=>{let J=$?z:Q[(j||"").trim()]??j,W=Q.__stx_runtime_head??{};return Q.__stx_runtime_head=R(W,{title:J}),""})}function VK(K,Q,Z=""){if(!K.includes("@meta"))return K;return w(K,/(?<![\w$@])@meta\s*\(/g,($,z)=>{let j=E(k($),Q);if(j.kind==="error")return I("Meta",z,j.message,Z,j.code);if(j.kind==="tag"){let J=Q.__stx_runtime_head??{};Q.__stx_runtime_head=R(J,{meta:[j.tag]})}return""},($)=>I("Meta",$,"the call has no closing parenthesis",Z,Y.INVALID_DIRECTIVE_SYNTAX))}export{S as Vt,D as Wt,g as Xt,l as Yt,C as Zt,w as _t,k as $t,N as au,_ as bu,T as cu,I as du,a as eu,E as fu,jK as gu,zK as hu,JK as iu,P as ju,R as ku,u as lu,f as mu,WK as nu,XK as ou,YK as pu,BK as qu,OK as ru,UK as su,FK as tu,GK as uu,VK as vu};
|
|
@@ -299,4 +299,4 @@ catch (error) {
|
|
|
299
299
|
}
|
|
300
300
|
})();
|
|
301
301
|
</script>`}var N={name:"pwa.installButton",handler:(j,z,k,E)=>{let q=k.__stx_options||{};return H(j,q)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},Q={name:"pwa.updatePrompt",handler:(j,z,k,E)=>{let q=k.__stx_options||{};return J(j,q)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},T={name:"pwa.offlineIndicator",handler:(j,z,k,E)=>{let q=k.__stx_options||{};return L(j,q)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},V={name:"pwa.pushSubscribe",handler:(j,z,k,E)=>{let q=k.__stx_options||{};return M(j,q)},hasEndTag:!0,description:"Renders a push notification subscription button"},X=[N,Q,T,V];function Z(j){return[...j,...X]}
|
|
302
|
-
export{N as
|
|
302
|
+
export{N as yw,Q as zw,T as Aw,V as Bw,X as Cw,Z as Dw};
|