@stacksjs/stx 0.2.880 → 0.2.882
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-ec5q4nnw.js → chunk-0k7khseq.js} +2 -2
- package/dist/{chunk-h2tq6cbr.js → chunk-0rdh8bw3.js} +1 -1
- package/dist/{chunk-0m4c42qt.js → chunk-22mdphq2.js} +2 -2
- package/dist/{chunk-86nsbxep.js → chunk-295bykzd.js} +26 -26
- package/dist/{chunk-3wb82rxw.js → chunk-30z4s1n3.js} +2 -2
- package/dist/{chunk-pm4rpc4a.js → chunk-3869n9nd.js} +1 -1
- package/dist/chunk-3abd3gw8.js +2 -0
- package/dist/{chunk-p55a910x.js → chunk-3jndqseh.js} +6 -6
- package/dist/{chunk-v3747589.js → chunk-47bsv8xy.js} +1 -1
- package/dist/{chunk-qd9v1v8z.js → chunk-4adb8bmp.js} +1 -1
- package/dist/{chunk-7dq6ebvp.js → chunk-4hfsbdqa.js} +1 -1
- package/dist/chunk-5508z01x.js +2 -0
- package/dist/chunk-5v93fj91.js +2 -0
- package/dist/{chunk-ew3vs3jq.js → chunk-5yga68j4.js} +1 -1
- package/dist/chunk-65899mj8.js +2 -0
- package/dist/{chunk-5p3825qw.js → chunk-678nhepd.js} +1 -1
- package/dist/{chunk-a5gnxdfe.js → chunk-6vr0yfbt.js} +1 -1
- package/dist/{chunk-7bsrnpmh.js → chunk-75yst7df.js} +3 -3
- package/dist/{chunk-w2kdhm7k.js → chunk-7z94thkd.js} +1 -1
- package/dist/chunk-8s365b62.js +2 -0
- package/dist/{chunk-nysbdr4r.js → chunk-8vb1m3t3.js} +1 -1
- package/dist/{chunk-9cbf0seq.js → chunk-93b6syb0.js} +1 -1
- package/dist/chunk-93fvjs6g.js +2 -0
- package/dist/{chunk-cjv89tnb.js → chunk-99spzsmw.js} +1 -1
- package/dist/{chunk-3zds0gmd.js → chunk-9zc1cnw8.js} +1 -1
- package/dist/{chunk-qfwk93fk.js → chunk-9zqggj7t.js} +1 -1
- package/dist/{chunk-y7e61pz3.js → chunk-a81bwn7b.js} +1 -1
- package/dist/{chunk-kn9tqjgv.js → chunk-a852vdv3.js} +1 -1
- package/dist/{chunk-awp8a3t4.js → chunk-bgddx531.js} +1 -1
- package/dist/{chunk-19k15mfc.js → chunk-c3413bgh.js} +1 -1
- package/dist/{chunk-v1s838fe.js → chunk-cb0c6959.js} +1 -1
- package/dist/{chunk-k6c5t9we.js → chunk-cekzqze8.js} +1 -1
- package/dist/{chunk-5eftxrvv.js → chunk-cn2bgt0w.js} +1 -1
- package/dist/chunk-cn6dqyfh.js +2 -0
- package/dist/{chunk-93jhfbeg.js → chunk-d0c5q7b7.js} +1 -1
- package/dist/{chunk-t94y8g35.js → chunk-d2pexm3z.js} +1 -1
- package/dist/chunk-ddws4zp2.js +3 -0
- package/dist/{chunk-az8b0726.js → chunk-e44br2vs.js} +2 -2
- package/dist/{chunk-z9ffr9gy.js → chunk-e9hm254p.js} +4 -4
- package/dist/{chunk-1avy0p8v.js → chunk-h0nsb8b0.js} +1 -1
- package/dist/{chunk-qxcc0aar.js → chunk-j58b7xen.js} +1 -1
- package/dist/{chunk-tgzs1kbj.js → chunk-j7bkrvey.js} +1 -1
- package/dist/{chunk-kna1bdm2.js → chunk-kjz7g83q.js} +4 -4
- package/dist/chunk-ktk4eg8c.js +2 -0
- package/dist/{chunk-ce0zbpr5.js → chunk-kx4svden.js} +1 -1
- package/dist/chunk-kzagptvq.js +2 -0
- package/dist/{chunk-rdxph1tp.js → chunk-mhdkk9a4.js} +1 -1
- package/dist/{chunk-k206d3pn.js → chunk-n163nwke.js} +1 -1
- package/dist/{chunk-1r612xxs.js → chunk-nghybhas.js} +1 -1
- package/dist/{chunk-t9hxyvvc.js → chunk-nmz9j39s.js} +2 -2
- package/dist/{chunk-1jk46ve0.js → chunk-p5qac909.js} +1 -1
- package/dist/{chunk-2d68p12e.js → chunk-pxemb9dg.js} +1 -1
- package/dist/{chunk-f7znj9xg.js → chunk-qjqvhke7.js} +1 -1
- package/dist/{chunk-egjmb32c.js → chunk-qpybh7ss.js} +5 -5
- package/dist/{chunk-mygsektn.js → chunk-qxthb2a1.js} +1 -1
- package/dist/chunk-radvtjwt.js +16 -0
- package/dist/{chunk-4r2rfdmr.js → chunk-rn2kk4r8.js} +1 -1
- package/dist/{chunk-cad7e5q1.js → chunk-s9xavhdb.js} +1 -1
- package/dist/chunk-sb93fb2w.js +2 -0
- package/dist/chunk-twewtvyt.js +2 -0
- package/dist/{chunk-vm42j29z.js → chunk-v65efeh1.js} +1 -1
- package/dist/{chunk-g83ph305.js → chunk-v99zjh93.js} +1 -1
- package/dist/{chunk-k40e0ete.js → chunk-vtgqgx8t.js} +1 -1
- package/dist/{chunk-hmntqqyd.js → chunk-whmk0m8x.js} +4 -4
- package/dist/{chunk-rzcdwybt.js → chunk-x5608pnk.js} +1 -1
- package/dist/chunk-x7asbgvc.js +2 -0
- package/dist/chunk-xc6w4x0w.js +2 -0
- package/dist/{chunk-xf0xacc9.js → chunk-yfphz58r.js} +5 -5
- package/dist/{chunk-78zgmqhd.js → chunk-ywnqjqns.js} +1 -1
- package/dist/chunk-zen0ef4k.js +2 -0
- package/dist/cli.js +7 -7
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/dev-server/ts-css.js +3 -3
- package/dist/pwa.js +1 -1
- package/dist/safe-evaluator.d.ts +0 -8
- package/dist/safe-evaluator.js +14 -1
- package/dist/ssg.js +2 -2
- package/package.json +5 -5
- package/dist/chunk-2haf7t5h.js +0 -2
- package/dist/chunk-3jp5z1qj.js +0 -2
- package/dist/chunk-3q0w0bzd.js +0 -16
- package/dist/chunk-83b9k17j.js +0 -2
- package/dist/chunk-b7d3n4aw.js +0 -2
- package/dist/chunk-gm67jt8p.js +0 -2
- package/dist/chunk-hkx51atf.js +0 -2
- package/dist/chunk-p746twww.js +0 -2
- package/dist/chunk-qn6y5ttj.js +0 -2
- package/dist/chunk-rnrdngnn.js +0 -2
- package/dist/chunk-swz0xprw.js +0 -2
- package/dist/chunk-tka73egx.js +0 -2
- package/dist/chunk-v9h2bbhf.js +0 -2
- package/dist/chunk-v9mxhch2.js +0 -2
- package/dist/chunk-ws9kr80x.js +0 -2
- package/dist/chunk-xz4v9tg1.js +0 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Fl,zl}from"./chunk-00tq7ghn.js";import{X,Ar,Ks,Gs,_i,Ei,Xs,Pe,We,xe,re,Or,Nr,me,se,B,gt,Mr,Ai,jr,Je,s,g,Y,In}from"./chunk-p55a910x.js";import{m,N,ht,p}from"./chunk-86nsbxep.js";import{r}from"./chunk-xz4v9tg1.js";import{fe}from"./chunk-t94y8g35.js";import{br}from"./chunk-7mcs59pr.js";import{b}from"./chunk-94mpe1ny.js";import{t}from"./chunk-yh2hnt3m.js";import{createHash as At}from"crypto";import J from"fs";import G from"path";import Le from"fs";function Ae(e,i,n){let o=Buffer.alloc(n),a=Le.readSync(e,o,0,n,i);return o.subarray(0,a)}function ze(e){if(e.length<25)return!1;let i=(o,a)=>String.fromCharCode(...e.subarray(o,a));if(i(0,4)!=="RIFF"||i(8,12)!=="WEBP")return!1;let n=i(12,16);if(n==="VP8X")return(e[20]&16)!==0;if(n==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function Ue(e){let i;try{i=Le.openSync(e,"r");let n=Ae(i,0,33);if(n.length>=3&&n[0]===255&&n[1]===216&&n[2]===255)return"none";if(n.length>=26&&n[0]===137&&n.toString("latin1",1,4)==="PNG"){let o=n[25];if(o===4||o===6)return"possible";let a=8;for(let c=0;c<64;c++){let l=Ae(i,a,8);if(l.length<8)return"unknown";let u=l.toString("latin1",4,8);if(u==="tRNS")return"possible";if(u==="IDAT"||u==="IEND")return"none";a+=12+l.readUInt32BE(0)}return"unknown"}if(n.length>=25&&n.toString("latin1",0,4)==="RIFF"&&n.toString("latin1",8,12)==="WEBP"){if(ze(n))return"possible";let o=n.toString("latin1",12,16);return o==="VP8 "||o==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(i!==void 0)Le.closeSync(i)}}import rn from"fs";import Fe from"os";import{fileURLToPath as bt}from"url";var Ee=Symbol("stx.image-worker.unavailable");function sn(e=typeof Fe.availableParallelism==="function"?Fe.availableParallelism():Fe.cpus().length){return Math.max(1,Math.min(2,e-1))}var _e=0,vt=[];async function on(){if(_e<sn()){_e++;return}await new Promise((e)=>vt.push(e)),_e++}function an(){_e--,vt.shift()?.()}var cn="@stacksjs/stx/builtins/image-warmup-worker";function ln(e=process.cwd()){let i=import.meta.url.endsWith(".ts")?"ts":"js";try{let n=new URL(`./image-warmup-worker.${i}`,import.meta.url);if(n.protocol==="file:"&&rn.existsSync(bt(n)))return bt(n)}catch{}return br(cn,e)}var xt=!1;function ue(e){if(!xt)xt=!0,console.warn(`[stx] image worker unavailable (${e}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return Ee}function Ie(e){return e instanceof Error?e.message:String(e)}async function He(e,i){let n;try{n=(await import("worker_threads")).Worker}catch(a){return ue(`could not load node:worker_threads: ${Ie(a)}`)}if(typeof n!=="function")return ue("node:worker_threads has no Worker in this runtime");let o=ln();if(!o)return ue("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await on();try{return await new Promise((a,c)=>{let l;try{l=new n(o)}catch(h){a(ue(`could not start ${o}: ${Ie(h)}`));return}let u=!1,f=!1,x=(h)=>{if(f)return;f=!0,h(),l.terminate()};l.on("message",(h)=>{if(h.type==="ready"){u=!0,l.postMessage({task:e,args:i});return}if(h.type==="result"){x(()=>a(h.value));return}let d=Error(h.error?.message??"image worker failed");if(h.error?.name)d.name=h.error.name;if(h.error?.stack)d.stack=h.error.stack;x(()=>c(d))}),l.on("error",(h)=>{x(()=>u?c(h instanceof Error?h:Error(Ie(h)||"image worker crashed")):a(ue(`the worker failed before it was ready: ${Ie(h)}`)))}),l.on("exit",(h)=>{x(()=>u?c(Error("image worker exited before it finished")):a(ue(`the worker exited with code ${h} before it was ready`)))})})}finally{an()}}var un=new Set([".avif",".jpeg",".jpg",".png",".webp"]),fn=[320,640,960,1280,1920],ve="/_stx/images",dn=`stx:${ve}:alpha-1`,gn=`stx:${ve}:opaque-1`,pn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Ne;function mn(e,i){let n=G.dirname(Bun.resolveSync(e,i));while(n!==G.dirname(n)){let o=G.join(n,"package.json");if(J.existsSync(o)){let a=JSON.parse(J.readFileSync(o,"utf8"));if(a.name===e)return a.version}n=G.dirname(n)}return}function wt(){if(Ne!==void 0)return Ne;let e;try{e=G.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Ne=pn.map((i)=>{let n;try{n=e?mn(i,e):void 0}catch{}return`${i.replace("@stacksjs/","")}@${n??"unknown"}`}).join("+"),Ne}var $t=Symbol.for("stx.image-delivery");function we(){let e=globalThis;return e[$t]??={catalog:new Map,transparent:new Set},e[$t]}var St=new Set;function hn(e){return`/${e.split(G.sep).map(encodeURIComponent).join("/")}`}function yn(e){let i=G.extname(e),n=e.slice(0,-i.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),o=At("sha256").update(e).digest("hex").slice(0,8);return`${n||"image"}-${o}`}function Ct(e,i=`stx:${ve}`){let n=(o)=>`${ve}/${o.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:i,async stat(o){let a=G.join(e,o);try{let c=await J.promises.stat(a);return c.size>0?{bytes:c.size,path:a,url:n(o)}:null}catch{return null}},async write(o,a){let c=G.join(e,o);await J.promises.mkdir(G.dirname(c),{recursive:!0});let l=`${c}.${process.pid}.tmp`;return await J.promises.writeFile(l,a),await J.promises.rename(l,c),{bytes:a.byteLength,path:c,url:n(o)}},url:n}}async function It(e,i=e){let n=await J.promises.readdir(i,{withFileTypes:!0});n.sort((a,c)=>a.name.localeCompare(c.name));let o=[];for(let a of n){let c=G.join(i,a.name);if(a.isDirectory()){o.push(...await It(e,c));continue}if(!a.isFile()||!un.has(G.extname(a.name).toLowerCase()))continue;o.push({absolutePath:c,relativePath:G.relative(e,c)})}return o}function Rt(e,i){return e.map((n)=>({key:hn(n.relativePath),input:n.absolutePath,name:yn(n.relativePath),...bn(n.absolutePath)?{options:{storage:i}}:{}}))}function bn(e){return Ue(e)==="possible"}function xn(e){for(let i=3;i<e.length;i+=4)if(e[i]!==255)return!0;return!1}async function vn(e){let i=Object.entries(e).filter(([,c])=>c.fallback.format==="png"),n=new Set,o=8;if(i.length===0)return n;let{decode:a}=await import("ts-images");for(let c=0;c<i.length;c+=8)await Promise.all(i.slice(c,c+8).map(async([l,u])=>{let f=u.variants.filter((x)=>x.format==="png").sort((x,h)=>x.width-h.width)[0];try{let x=await a(new Uint8Array(await J.promises.readFile(f?.path??u.fallback.path)));if(xn(x.data))n.add(l)}catch{n.add(l)}}));return n}function wn(e,i){let n=[];for(let o of i){let a=e[o],c=a?.variants.filter((u)=>u.format==="webp")??[];if(!a||c.length===0)continue;if(!c.some((u)=>{let f;try{return f=J.openSync(u.path,"r"),!ze(Ae(f,0,32))}catch{return!0}finally{if(f!==void 0)J.closeSync(f)}}))continue;if(a.variants=a.variants.filter((u)=>u.format!=="webp"),delete a.sources.webp,n.push(o),!St.has(o))St.add(o),console.warn(`[stx-images] ${o} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return n}async function $n(e){let i=[],n=8;if(e.length===0)return i;let{generateThumbHash:o}=await import("ts-images");for(let a=0;a<e.length;a+=8){let c=e.slice(a,a+8),l=await Promise.all(c.map(async(u)=>{try{return await o(u.absolutePath),u}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${u.relativePath}`),null}}));i.push(...l.filter((u)=>u!==null))}return i}function qe(e){return G.join(e,"undecodable.json")}function Sn(e){try{let i=J.readFileSync(qe(e),"utf-8"),n=JSON.parse(i);return n&&typeof n==="object"?n:{}}catch{return{}}}function Cn(e,i){try{J.mkdirSync(G.dirname(qe(e)),{recursive:!0}),J.writeFileSync(qe(e),JSON.stringify(i))}catch{}}function kt(e){try{let i=J.statSync(e);return{mtimeMs:i.mtimeMs,size:i.size}}catch{return}}function Pt(e){if(!e||e.startsWith("data:")||e.startsWith("blob:")||/^https?:\/\//i.test(e)||e.startsWith("//"))return;let i=e.split(/[?#]/,1)[0];if(!i)return;try{return`/${i.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function ti(e){let i=Pt(e);return i?we().catalog.get(i):void 0}function ni(e){let i=Pt(e);return i?we().transparent.has(i):!1}function ri(e){let i=(o)=>e.variants.filter((a)=>a.format===o).reduce((a,c)=>a+c.bytes,0),n=i(e.fallback.format);return["avif","webp"].map((o)=>({format:o,srcset:e.sources[o]||"",bytes:i(o)})).filter((o)=>o.srcset&&o.bytes>0&&o.bytes<n).sort((o,a)=>o.bytes-a.bytes).map(({format:o,srcset:a})=>({format:o,srcset:a}))}function iy(e){let i=ti(e);if(!i)return;return{src:i.fallback.url,srcset:i.sources[i.fallback.format]||"",sources:ri(i).map(({format:n,srcset:o})=>({type:`image/${n}`,srcset:o})),width:i.source.width,height:i.source.height,placeholder:ni(e)?void 0:i.placeholder?.dataUrl}}function _s(){let e=we();e.catalog=new Map,e.transparent=new Set}function Rn(e){let i=we();i.catalog=new Map(e.entries),i.transparent=new Set(e.transparent)}async function ay(e,i,n={}){if(!e||!J.existsSync(e))return _s(),{count:0,fingerprint:""};if(n.offThread){let y=await He("delivery",{publicDir:e,outputDir:i});if(y!==Ee)return Rn(y.state),y.result}let o=await It(e);if(o.length===0)return _s(),{count:0,fingerprint:""};let a=Sn(i),c=o.filter((y)=>{let w=a[y.relativePath];if(!w)return!0;let A=kt(y.absolutePath);return!A||A.mtimeMs!==w.mtimeMs||A.size!==w.size});if(c.length===0)return _s(),{count:0,fingerprint:""};let l=Ct(G.join(i,"_stx","images"),`${dn}:${wt()}`),u={outDir:G.join(i,"_stx","images"),storage:Ct(G.join(i,"_stx","images"),`${gn}:${wt()}`),baseUrl:ve,widths:fn,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},{createImageDeliveryCatalog:f}=await import("ts-images/delivery"),x=c,h;try{h=await f({...u,entries:Rt(c,l)})}catch(y){if(x=await $n(c),x.length===c.length)throw y;let w=new Set(x.map((k)=>k.relativePath)),A=!1;for(let k of c){if(w.has(k.relativePath))continue;let R=kt(k.absolutePath);if(!R)continue;a[k.relativePath]=R,A=!0}if(A)Cn(i,a);if(x.length===0)return _s(),{count:0,fingerprint:""};h=await f({...u,entries:Rt(x,l)})}let d=await vn(h.entries),C=wn(h.entries,d),v=we();v.catalog=new Map(Object.entries(h.entries)),v.transparent=d;let S=d.size===0&&C.length===0?h.fingerprint:At("sha256").update(h.fingerprint).update(JSON.stringify({transparent:[...d].sort(),droppedWebp:C.sort()})).digest("hex");return{count:x.length,fingerprint:S}}class _t{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let i of e.aliases)this.builtins.set(i.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,i,n,o){let a=_i(e,o);if(a!==void 0)return a;for(let c of Ei(e,i,n,o))if(await s(c))return c;return null}}var de=new _t;var ne="\x00stx-boolean-attribute";function Xe(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var kn=new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","role","slot","spellcheck","style","tabindex","title","translate","accept","action","alt","autocomplete","capture","cite","cols","colspan","content","controls","datetime","default","download","enctype","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","href","hreflang","kind","label","loading","loop","max","maxlength","media","method","min","minlength","multiple","muted","name","open","pattern","placeholder","playsinline","poster","preload","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","scope","selected","shape","size","span","src","srcdoc","srclang","srcset","start","step","target","type","usemap","value","width","wrap"]);function Ve(e){let i=e.toLowerCase();return i.startsWith("aria-")||i.startsWith("data-")||kn.has(i)}function ie(e,i){let n=[];for(let[o,a]of Object.entries(e.static)){if(i.has(o))continue;let c=e.staticNames?.[o]??o;if(typeof a==="boolean"){if(a)n.push(g(c));continue}if(a===ne){n.push(g(c));continue}n.push(`${g(c)}="${In(c,Xe(String(a)))}"`)}return n}function oe(e,i){let n=[];for(let[o,a]of Object.entries(e.serverDynamic??{})){if(i.has(o))continue;if(a===null||a===void 0||a===!1)continue;let c=e.serverDynamicNames?.[o]??o;if(a===!0){n.push(g(c));continue}if(typeof a==="object")continue;n.push(`${g(c)}="${In(c,Xe(String(a)))}"`)}return n}function An(e){if(e.clientReactive.to)return{value:e.clientReactive.to,reactive:!0};if(e.serverDynamic.to!==void 0)return{value:String(e.serverDynamic.to),reactive:!1};if(typeof e.static.to==="string")return{value:e.static.to,reactive:!1};return{value:"#",reactive:!1}}var Ze={name:"StxLink",aliases:["stx-link"],render(e,i,n){let o=An(e),a=(typeof e.static.class==="string"?e.static.class:"")||(typeof e.static.className==="string"?e.static.className:""),c=typeof e.static.activeClass==="string"?e.static.activeClass:"active",l=typeof e.static.exactActiveClass==="string"?e.static.exactActiveClass:"exact-active",u=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,f=[];if(o.reactive)f.push(`:href="${r(o.value)}"`);else f.push(`href="${r(Or(o.value,"navigable"))}"`);if(a)f.push(`class="${r(a)}"`);if(f.push("data-stx-link"),f.push(`data-stx-active-class="${r(c)}"`),f.push(`data-stx-exact-active-class="${r(l)}"`),u)f.push("data-stx-prefetch");let x=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(x)f.push(`data-stx-active-match="${r(x)}"`);let h=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return f.push(...ie(e,h)),f.push(...oe(e,h)),`<a ${f.join(" ")}>${i}</a>`}};var Pn=new Map;function Ge(e){if(!e)return;let i=e.split("?")[0].split("#")[0];return Pn.get(i)}var _n={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Ke=[320,640,768,1024,1280,1536,1920];function H(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let n=e.static[i];if(typeof n==="string")return n;return}function Oe(e,i,n=!1){let o=e.serverDynamic[i];if(o!==void 0)return o!==!1&&o!=="false";let a=e.static[i];if(a!==void 0)return a!=="false"&&a!==!1;return n}function Ye(e){if(e.includes("(")||e.includes(","))return e;let i=e.trim().split(/\s+/),n=[];for(let o of i)if(o.includes(":")){let[a,c]=o.split(":"),l=_n[a];if(l)n.push(`(max-width: ${l}px) ${c}`);else{let u=Number.parseInt(a);if(!Number.isNaN(u))n.push(`(max-width: ${u}px) ${c}`)}}else n.push(o);return n.join(", ")}function Qe(e,i,n,o){return i.map((a)=>`${$e(e,a,void 0,n,o)} ${a}w`).join(", ")}function En(e,i,n,o,a){return i.map((c)=>{let l=n?n*c:void 0;return`${$e(e,l,void 0,o,a)} ${c}x`}).join(", ")}function $e(e,i,n,o,a){if(!o||o==="local"||o==="static")return e;if(o==="cloudinary"){let c=[];if(i)c.push(`w_${i}`);if(n)c.push(`h_${n}`);if(a)c.push(`f_${a}`);c.push("q_auto");let l=c.join(",");return e.replace("/upload/",`/upload/${l}/`)}if(o==="imgix"){let c=new URLSearchParams;if(i)c.set("w",String(i));if(n)c.set("h",String(n));if(a)c.set("fm",a);c.set("auto","format");let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}if(o==="bunny"){let c=new URLSearchParams;if(i)c.set("width",String(i));if(n)c.set("height",String(n));if(a)c.set("format",a);let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}return e}function Nn(e){return`var s=this.style;${e.map((i)=>`s.${i}=''`).join(";")}`}function On(e,i,n="#e5e7eb"){let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${i}"><rect width="100%" height="100%" fill="${n}"/></svg>`;return`data:image/svg+xml;base64,${btoa(o)}`}var et={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,i,n){let o=H(e,"src")||"",a=ti(o),c=H(e,"alt")||"",l=H(e,"width")||(a?String(a.source.width):void 0),u=H(e,"height")||(a?String(a.source.height):void 0),f=H(e,"sizes"),x=H(e,"srcset"),h=H(e,"densities"),d=H(e,"format"),C=ni(o)||Ge(o)?.transparent===!0,v=H(e,"placeholder")||(a&&!C?"thumbhash":void 0),S=H(e,"placeholderColor")||"#e5e7eb",y=H(e,"provider"),w=H(e,"class")||H(e,"className")||"",A=H(e,"style")||"",k=H(e,"objectFit")||H(e,"fit"),R=H(e,"objectPosition")||H(e,"position"),E=H(e,"quality"),K=Oe(e,"lazy",!0),L=Oe(e,"preload",!1),U=Oe(e,"priority",!1),z=H(e,"loading"),O=H(e,"decoding")||"async",q=!!a||Oe(e,"picture",!1)||!!d,I=l?Number.parseInt(l):void 0,_=u?Number.parseInt(u):void 0,D=x||"",F="";if(a)D=a.sources[a.fallback.format]||"",F=f?Ye(f):"100vw";else if(!D&&f&&y&&y!=="local"&&y!=="static")D=Qe(o,Ke,y,d),F=Ye(f);else if(!D&&h){let Z=h.split(/\s+/).map((P)=>Number.parseFloat(P.replace("x","")));D=En(o,Z,I,y,d)}else if(f)F=Ye(f);let j=[];if(A)j.push(A);if(k)j.push(`object-fit:${k}`);if(R)j.push(`object-position:${R}`);if(I&&_)j.push(`aspect-ratio:${I}/${_}`);let te=[],ae=v==="blur"||v==="color"||v==="thumbhash";if(ae&&!C){let Z=a?.placeholder?{dataUrl:a.placeholder.dataUrl,color:S}:Ge(o);if(Z&&v==="color")j.push(`background-color:${Z.color}`),te.push("backgroundColor");else if(Z)j.push(`background-color:${Z.color}`),j.push(`background-image:url(${Z.dataUrl})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),te.push("backgroundColor","backgroundImage");else{let P=On(I||16,_||9,S);j.push(`background-image:url(${P})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),te.push("backgroundImage")}}else if(!ae&&v&&v!=="empty"&&v!=="none")j.push(`background-image:url(${r(v)})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),te.push("backgroundImage");let M=a?.fallback.url||$e(o,I,_,y,d),V=[];if(V.push(`src="${r(Or(M,"fetched"))}"`),V.push(`alt="${r(c)}"`),l)V.push(`width="${r(l)}"`);if(u)V.push(`height="${r(u)}"`);let Re=z||(U||L?"eager":K?"lazy":"");if(Re)V.push(`loading="${r(Re)}"`);if(U)V.push('fetchpriority="high"');if(V.push(`decoding="${r(O)}"`),w)V.push(`class="${r(w)}"`);if(j.length>0)V.push(`style="${r(j.join(";"))}"`);if(D)V.push(`srcset="${r(Or(D,"fetched"))}"`);if(F)V.push(`sizes="${r(F)}"`);let be=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","objectFit","objectPosition","fit","position","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(te.length>0){let Z=typeof e.static.onload==="string"?e.static.onload:"",P=Nn(te)+(Z?`;${Z}`:"");V.push(`onload="${r(P)}"`),be.add("onload")}V.push(...ie(e,be)),V.push(...oe(e,be));let le=`<img ${V.join(" ")} />`,Q="";if(L){let P=d==="webp"?"image/webp":d==="avif"?"image/avif":"";Q=`<link rel="preload" as="image" href="${r(M)}"${P?` type="${P}"`:""}${D?` imagesrcset="${r(D)}"`:""}${F?` imagesizes="${r(F)}"`:""} />
|
|
2
|
+
import{Fl,zl}from"./chunk-00tq7ghn.js";import{X,Ar,Ks,Gs,_i,Ei,Xs,Pe,We,xe,re,Or,Nr,me,se,B,gt,Mr,Ai,jr,Je,s,g,Y,In}from"./chunk-3jndqseh.js";import{m,N,ht,p}from"./chunk-295bykzd.js";import{r}from"./chunk-ddws4zp2.js";import{fe}from"./chunk-d2pexm3z.js";import{br}from"./chunk-7mcs59pr.js";import{b}from"./chunk-94mpe1ny.js";import{t}from"./chunk-yh2hnt3m.js";import{createHash as At}from"crypto";import J from"fs";import G from"path";import Le from"fs";function Ae(e,i,n){let o=Buffer.alloc(n),a=Le.readSync(e,o,0,n,i);return o.subarray(0,a)}function ze(e){if(e.length<25)return!1;let i=(o,a)=>String.fromCharCode(...e.subarray(o,a));if(i(0,4)!=="RIFF"||i(8,12)!=="WEBP")return!1;let n=i(12,16);if(n==="VP8X")return(e[20]&16)!==0;if(n==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function Ue(e){let i;try{i=Le.openSync(e,"r");let n=Ae(i,0,33);if(n.length>=3&&n[0]===255&&n[1]===216&&n[2]===255)return"none";if(n.length>=26&&n[0]===137&&n.toString("latin1",1,4)==="PNG"){let o=n[25];if(o===4||o===6)return"possible";let a=8;for(let c=0;c<64;c++){let l=Ae(i,a,8);if(l.length<8)return"unknown";let u=l.toString("latin1",4,8);if(u==="tRNS")return"possible";if(u==="IDAT"||u==="IEND")return"none";a+=12+l.readUInt32BE(0)}return"unknown"}if(n.length>=25&&n.toString("latin1",0,4)==="RIFF"&&n.toString("latin1",8,12)==="WEBP"){if(ze(n))return"possible";let o=n.toString("latin1",12,16);return o==="VP8 "||o==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(i!==void 0)Le.closeSync(i)}}import rn from"fs";import Fe from"os";import{fileURLToPath as bt}from"url";var Ee=Symbol("stx.image-worker.unavailable");function sn(e=typeof Fe.availableParallelism==="function"?Fe.availableParallelism():Fe.cpus().length){return Math.max(1,Math.min(2,e-1))}var _e=0,vt=[];async function on(){if(_e<sn()){_e++;return}await new Promise((e)=>vt.push(e)),_e++}function an(){_e--,vt.shift()?.()}var cn="@stacksjs/stx/builtins/image-warmup-worker";function ln(e=process.cwd()){let i=import.meta.url.endsWith(".ts")?"ts":"js";try{let n=new URL(`./image-warmup-worker.${i}`,import.meta.url);if(n.protocol==="file:"&&rn.existsSync(bt(n)))return bt(n)}catch{}return br(cn,e)}var xt=!1;function ue(e){if(!xt)xt=!0,console.warn(`[stx] image worker unavailable (${e}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return Ee}function Ie(e){return e instanceof Error?e.message:String(e)}async function He(e,i){let n;try{n=(await import("worker_threads")).Worker}catch(a){return ue(`could not load node:worker_threads: ${Ie(a)}`)}if(typeof n!=="function")return ue("node:worker_threads has no Worker in this runtime");let o=ln();if(!o)return ue("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await on();try{return await new Promise((a,c)=>{let l;try{l=new n(o)}catch(h){a(ue(`could not start ${o}: ${Ie(h)}`));return}let u=!1,f=!1,x=(h)=>{if(f)return;f=!0,h(),l.terminate()};l.on("message",(h)=>{if(h.type==="ready"){u=!0,l.postMessage({task:e,args:i});return}if(h.type==="result"){x(()=>a(h.value));return}let d=Error(h.error?.message??"image worker failed");if(h.error?.name)d.name=h.error.name;if(h.error?.stack)d.stack=h.error.stack;x(()=>c(d))}),l.on("error",(h)=>{x(()=>u?c(h instanceof Error?h:Error(Ie(h)||"image worker crashed")):a(ue(`the worker failed before it was ready: ${Ie(h)}`)))}),l.on("exit",(h)=>{x(()=>u?c(Error("image worker exited before it finished")):a(ue(`the worker exited with code ${h} before it was ready`)))})})}finally{an()}}var un=new Set([".avif",".jpeg",".jpg",".png",".webp"]),fn=[320,640,960,1280,1920],ve="/_stx/images",dn=`stx:${ve}:alpha-1`,gn=`stx:${ve}:opaque-1`,pn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Ne;function mn(e,i){let n=G.dirname(Bun.resolveSync(e,i));while(n!==G.dirname(n)){let o=G.join(n,"package.json");if(J.existsSync(o)){let a=JSON.parse(J.readFileSync(o,"utf8"));if(a.name===e)return a.version}n=G.dirname(n)}return}function wt(){if(Ne!==void 0)return Ne;let e;try{e=G.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Ne=pn.map((i)=>{let n;try{n=e?mn(i,e):void 0}catch{}return`${i.replace("@stacksjs/","")}@${n??"unknown"}`}).join("+"),Ne}var $t=Symbol.for("stx.image-delivery");function we(){let e=globalThis;return e[$t]??={catalog:new Map,transparent:new Set},e[$t]}var St=new Set;function hn(e){return`/${e.split(G.sep).map(encodeURIComponent).join("/")}`}function yn(e){let i=G.extname(e),n=e.slice(0,-i.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),o=At("sha256").update(e).digest("hex").slice(0,8);return`${n||"image"}-${o}`}function Ct(e,i=`stx:${ve}`){let n=(o)=>`${ve}/${o.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:i,async stat(o){let a=G.join(e,o);try{let c=await J.promises.stat(a);return c.size>0?{bytes:c.size,path:a,url:n(o)}:null}catch{return null}},async write(o,a){let c=G.join(e,o);await J.promises.mkdir(G.dirname(c),{recursive:!0});let l=`${c}.${process.pid}.tmp`;return await J.promises.writeFile(l,a),await J.promises.rename(l,c),{bytes:a.byteLength,path:c,url:n(o)}},url:n}}async function It(e,i=e){let n=await J.promises.readdir(i,{withFileTypes:!0});n.sort((a,c)=>a.name.localeCompare(c.name));let o=[];for(let a of n){let c=G.join(i,a.name);if(a.isDirectory()){o.push(...await It(e,c));continue}if(!a.isFile()||!un.has(G.extname(a.name).toLowerCase()))continue;o.push({absolutePath:c,relativePath:G.relative(e,c)})}return o}function Rt(e,i){return e.map((n)=>({key:hn(n.relativePath),input:n.absolutePath,name:yn(n.relativePath),...bn(n.absolutePath)?{options:{storage:i}}:{}}))}function bn(e){return Ue(e)==="possible"}function xn(e){for(let i=3;i<e.length;i+=4)if(e[i]!==255)return!0;return!1}async function vn(e){let i=Object.entries(e).filter(([,c])=>c.fallback.format==="png"),n=new Set,o=8;if(i.length===0)return n;let{decode:a}=await import("ts-images");for(let c=0;c<i.length;c+=8)await Promise.all(i.slice(c,c+8).map(async([l,u])=>{let f=u.variants.filter((x)=>x.format==="png").sort((x,h)=>x.width-h.width)[0];try{let x=await a(new Uint8Array(await J.promises.readFile(f?.path??u.fallback.path)));if(xn(x.data))n.add(l)}catch{n.add(l)}}));return n}function wn(e,i){let n=[];for(let o of i){let a=e[o],c=a?.variants.filter((u)=>u.format==="webp")??[];if(!a||c.length===0)continue;if(!c.some((u)=>{let f;try{return f=J.openSync(u.path,"r"),!ze(Ae(f,0,32))}catch{return!0}finally{if(f!==void 0)J.closeSync(f)}}))continue;if(a.variants=a.variants.filter((u)=>u.format!=="webp"),delete a.sources.webp,n.push(o),!St.has(o))St.add(o),console.warn(`[stx-images] ${o} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return n}async function $n(e){let i=[],n=8;if(e.length===0)return i;let{generateThumbHash:o}=await import("ts-images");for(let a=0;a<e.length;a+=8){let c=e.slice(a,a+8),l=await Promise.all(c.map(async(u)=>{try{return await o(u.absolutePath),u}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${u.relativePath}`),null}}));i.push(...l.filter((u)=>u!==null))}return i}function qe(e){return G.join(e,"undecodable.json")}function Sn(e){try{let i=J.readFileSync(qe(e),"utf-8"),n=JSON.parse(i);return n&&typeof n==="object"?n:{}}catch{return{}}}function Cn(e,i){try{J.mkdirSync(G.dirname(qe(e)),{recursive:!0}),J.writeFileSync(qe(e),JSON.stringify(i))}catch{}}function kt(e){try{let i=J.statSync(e);return{mtimeMs:i.mtimeMs,size:i.size}}catch{return}}function Pt(e){if(!e||e.startsWith("data:")||e.startsWith("blob:")||/^https?:\/\//i.test(e)||e.startsWith("//"))return;let i=e.split(/[?#]/,1)[0];if(!i)return;try{return`/${i.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function ti(e){let i=Pt(e);return i?we().catalog.get(i):void 0}function ni(e){let i=Pt(e);return i?we().transparent.has(i):!1}function ri(e){let i=(o)=>e.variants.filter((a)=>a.format===o).reduce((a,c)=>a+c.bytes,0),n=i(e.fallback.format);return["avif","webp"].map((o)=>({format:o,srcset:e.sources[o]||"",bytes:i(o)})).filter((o)=>o.srcset&&o.bytes>0&&o.bytes<n).sort((o,a)=>o.bytes-a.bytes).map(({format:o,srcset:a})=>({format:o,srcset:a}))}function iy(e){let i=ti(e);if(!i)return;return{src:i.fallback.url,srcset:i.sources[i.fallback.format]||"",sources:ri(i).map(({format:n,srcset:o})=>({type:`image/${n}`,srcset:o})),width:i.source.width,height:i.source.height,placeholder:ni(e)?void 0:i.placeholder?.dataUrl}}function _s(){let e=we();e.catalog=new Map,e.transparent=new Set}function Rn(e){let i=we();i.catalog=new Map(e.entries),i.transparent=new Set(e.transparent)}async function ay(e,i,n={}){if(!e||!J.existsSync(e))return _s(),{count:0,fingerprint:""};if(n.offThread){let y=await He("delivery",{publicDir:e,outputDir:i});if(y!==Ee)return Rn(y.state),y.result}let o=await It(e);if(o.length===0)return _s(),{count:0,fingerprint:""};let a=Sn(i),c=o.filter((y)=>{let w=a[y.relativePath];if(!w)return!0;let A=kt(y.absolutePath);return!A||A.mtimeMs!==w.mtimeMs||A.size!==w.size});if(c.length===0)return _s(),{count:0,fingerprint:""};let l=Ct(G.join(i,"_stx","images"),`${dn}:${wt()}`),u={outDir:G.join(i,"_stx","images"),storage:Ct(G.join(i,"_stx","images"),`${gn}:${wt()}`),baseUrl:ve,widths:fn,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},{createImageDeliveryCatalog:f}=await import("ts-images/delivery"),x=c,h;try{h=await f({...u,entries:Rt(c,l)})}catch(y){if(x=await $n(c),x.length===c.length)throw y;let w=new Set(x.map((k)=>k.relativePath)),A=!1;for(let k of c){if(w.has(k.relativePath))continue;let R=kt(k.absolutePath);if(!R)continue;a[k.relativePath]=R,A=!0}if(A)Cn(i,a);if(x.length===0)return _s(),{count:0,fingerprint:""};h=await f({...u,entries:Rt(x,l)})}let d=await vn(h.entries),C=wn(h.entries,d),v=we();v.catalog=new Map(Object.entries(h.entries)),v.transparent=d;let S=d.size===0&&C.length===0?h.fingerprint:At("sha256").update(h.fingerprint).update(JSON.stringify({transparent:[...d].sort(),droppedWebp:C.sort()})).digest("hex");return{count:x.length,fingerprint:S}}class _t{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let i of e.aliases)this.builtins.set(i.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,i,n,o){let a=_i(e,o);if(a!==void 0)return a;for(let c of Ei(e,i,n,o))if(await s(c))return c;return null}}var de=new _t;var ne="\x00stx-boolean-attribute";function Xe(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var kn=new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","role","slot","spellcheck","style","tabindex","title","translate","accept","action","alt","autocomplete","capture","cite","cols","colspan","content","controls","datetime","default","download","enctype","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","href","hreflang","kind","label","loading","loop","max","maxlength","media","method","min","minlength","multiple","muted","name","open","pattern","placeholder","playsinline","poster","preload","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","scope","selected","shape","size","span","src","srcdoc","srclang","srcset","start","step","target","type","usemap","value","width","wrap"]);function Ve(e){let i=e.toLowerCase();return i.startsWith("aria-")||i.startsWith("data-")||kn.has(i)}function ie(e,i){let n=[];for(let[o,a]of Object.entries(e.static)){if(i.has(o))continue;let c=e.staticNames?.[o]??o;if(typeof a==="boolean"){if(a)n.push(g(c));continue}if(a===ne){n.push(g(c));continue}n.push(`${g(c)}="${In(c,Xe(String(a)))}"`)}return n}function oe(e,i){let n=[];for(let[o,a]of Object.entries(e.serverDynamic??{})){if(i.has(o))continue;if(a===null||a===void 0||a===!1)continue;let c=e.serverDynamicNames?.[o]??o;if(a===!0){n.push(g(c));continue}if(typeof a==="object")continue;n.push(`${g(c)}="${In(c,Xe(String(a)))}"`)}return n}function An(e){if(e.clientReactive.to)return{value:e.clientReactive.to,reactive:!0};if(e.serverDynamic.to!==void 0)return{value:String(e.serverDynamic.to),reactive:!1};if(typeof e.static.to==="string")return{value:e.static.to,reactive:!1};return{value:"#",reactive:!1}}var Ze={name:"StxLink",aliases:["stx-link"],render(e,i,n){let o=An(e),a=(typeof e.static.class==="string"?e.static.class:"")||(typeof e.static.className==="string"?e.static.className:""),c=typeof e.static.activeClass==="string"?e.static.activeClass:"active",l=typeof e.static.exactActiveClass==="string"?e.static.exactActiveClass:"exact-active",u=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,f=[];if(o.reactive)f.push(`:href="${r(o.value)}"`);else f.push(`href="${r(Or(o.value,"navigable"))}"`);if(a)f.push(`class="${r(a)}"`);if(f.push("data-stx-link"),f.push(`data-stx-active-class="${r(c)}"`),f.push(`data-stx-exact-active-class="${r(l)}"`),u)f.push("data-stx-prefetch");let x=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(x)f.push(`data-stx-active-match="${r(x)}"`);let h=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return f.push(...ie(e,h)),f.push(...oe(e,h)),`<a ${f.join(" ")}>${i}</a>`}};var Pn=new Map;function Ge(e){if(!e)return;let i=e.split("?")[0].split("#")[0];return Pn.get(i)}var _n={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Ke=[320,640,768,1024,1280,1536,1920];function H(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let n=e.static[i];if(typeof n==="string")return n;return}function Oe(e,i,n=!1){let o=e.serverDynamic[i];if(o!==void 0)return o!==!1&&o!=="false";let a=e.static[i];if(a!==void 0)return a!=="false"&&a!==!1;return n}function Ye(e){if(e.includes("(")||e.includes(","))return e;let i=e.trim().split(/\s+/),n=[];for(let o of i)if(o.includes(":")){let[a,c]=o.split(":"),l=_n[a];if(l)n.push(`(max-width: ${l}px) ${c}`);else{let u=Number.parseInt(a);if(!Number.isNaN(u))n.push(`(max-width: ${u}px) ${c}`)}}else n.push(o);return n.join(", ")}function Qe(e,i,n,o){return i.map((a)=>`${$e(e,a,void 0,n,o)} ${a}w`).join(", ")}function En(e,i,n,o,a){return i.map((c)=>{let l=n?n*c:void 0;return`${$e(e,l,void 0,o,a)} ${c}x`}).join(", ")}function $e(e,i,n,o,a){if(!o||o==="local"||o==="static")return e;if(o==="cloudinary"){let c=[];if(i)c.push(`w_${i}`);if(n)c.push(`h_${n}`);if(a)c.push(`f_${a}`);c.push("q_auto");let l=c.join(",");return e.replace("/upload/",`/upload/${l}/`)}if(o==="imgix"){let c=new URLSearchParams;if(i)c.set("w",String(i));if(n)c.set("h",String(n));if(a)c.set("fm",a);c.set("auto","format");let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}if(o==="bunny"){let c=new URLSearchParams;if(i)c.set("width",String(i));if(n)c.set("height",String(n));if(a)c.set("format",a);let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}return e}function Nn(e){return`var s=this.style;${e.map((i)=>`s.${i}=''`).join(";")}`}function On(e,i,n="#e5e7eb"){let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${i}"><rect width="100%" height="100%" fill="${n}"/></svg>`;return`data:image/svg+xml;base64,${btoa(o)}`}var et={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,i,n){let o=H(e,"src")||"",a=ti(o),c=H(e,"alt")||"",l=H(e,"width")||(a?String(a.source.width):void 0),u=H(e,"height")||(a?String(a.source.height):void 0),f=H(e,"sizes"),x=H(e,"srcset"),h=H(e,"densities"),d=H(e,"format"),C=ni(o)||Ge(o)?.transparent===!0,v=H(e,"placeholder")||(a&&!C?"thumbhash":void 0),S=H(e,"placeholderColor")||"#e5e7eb",y=H(e,"provider"),w=H(e,"class")||H(e,"className")||"",A=H(e,"style")||"",k=H(e,"objectFit")||H(e,"fit"),R=H(e,"objectPosition")||H(e,"position"),E=H(e,"quality"),K=Oe(e,"lazy",!0),L=Oe(e,"preload",!1),U=Oe(e,"priority",!1),z=H(e,"loading"),O=H(e,"decoding")||"async",q=!!a||Oe(e,"picture",!1)||!!d,I=l?Number.parseInt(l):void 0,_=u?Number.parseInt(u):void 0,D=x||"",F="";if(a)D=a.sources[a.fallback.format]||"",F=f?Ye(f):"100vw";else if(!D&&f&&y&&y!=="local"&&y!=="static")D=Qe(o,Ke,y,d),F=Ye(f);else if(!D&&h){let Z=h.split(/\s+/).map((P)=>Number.parseFloat(P.replace("x","")));D=En(o,Z,I,y,d)}else if(f)F=Ye(f);let j=[];if(A)j.push(A);if(k)j.push(`object-fit:${k}`);if(R)j.push(`object-position:${R}`);if(I&&_)j.push(`aspect-ratio:${I}/${_}`);let te=[],ae=v==="blur"||v==="color"||v==="thumbhash";if(ae&&!C){let Z=a?.placeholder?{dataUrl:a.placeholder.dataUrl,color:S}:Ge(o);if(Z&&v==="color")j.push(`background-color:${Z.color}`),te.push("backgroundColor");else if(Z)j.push(`background-color:${Z.color}`),j.push(`background-image:url(${Z.dataUrl})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),te.push("backgroundColor","backgroundImage");else{let P=On(I||16,_||9,S);j.push(`background-image:url(${P})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),te.push("backgroundImage")}}else if(!ae&&v&&v!=="empty"&&v!=="none")j.push(`background-image:url(${r(v)})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),te.push("backgroundImage");let M=a?.fallback.url||$e(o,I,_,y,d),V=[];if(V.push(`src="${r(Or(M,"fetched"))}"`),V.push(`alt="${r(c)}"`),l)V.push(`width="${r(l)}"`);if(u)V.push(`height="${r(u)}"`);let Re=z||(U||L?"eager":K?"lazy":"");if(Re)V.push(`loading="${r(Re)}"`);if(U)V.push('fetchpriority="high"');if(V.push(`decoding="${r(O)}"`),w)V.push(`class="${r(w)}"`);if(j.length>0)V.push(`style="${r(j.join(";"))}"`);if(D)V.push(`srcset="${r(Or(D,"fetched"))}"`);if(F)V.push(`sizes="${r(F)}"`);let be=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","objectFit","objectPosition","fit","position","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(te.length>0){let Z=typeof e.static.onload==="string"?e.static.onload:"",P=Nn(te)+(Z?`;${Z}`:"");V.push(`onload="${r(P)}"`),be.add("onload")}V.push(...ie(e,be)),V.push(...oe(e,be));let le=`<img ${V.join(" ")} />`,Q="";if(L){let P=d==="webp"?"image/webp":d==="avif"?"image/avif":"";Q=`<link rel="preload" as="image" href="${r(M)}"${P?` type="${P}"`:""}${D?` imagesrcset="${r(D)}"`:""}${F?` imagesizes="${r(F)}"`:""} />
|
|
3
3
|
`}if(q){let Z=[];if(a)for(let P of ri(a))Z.push(`<source type="image/${P.format}" srcset="${r(P.srcset)}"${F?` sizes="${r(F)}"`:""} />`);if(!a&&(d==="avif"||d==="auto")){let P=$e(o,I,_,y,"avif"),T=D?Qe(o,Ke,y,"avif"):`${P}`;Z.push(`<source type="image/avif" srcset="${r(T)}"${F?` sizes="${r(F)}"`:""} />`)}if(!a&&(d==="webp"||d==="auto")){let P=$e(o,I,_,y,"webp"),T=D?Qe(o,Ke,y,"webp"):`${P}`;Z.push(`<source type="image/webp" srcset="${r(T)}"${F?` sizes="${r(F)}"`:""} />`)}return`${Q}<picture>
|
|
4
4
|
${Z.join(`
|
|
5
5
|
`)}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ql,eu}from"./chunk-yfphz58r.js";import"./chunk-94ctmp0j.js";import"./chunk-rn2kk4r8.js";import"./chunk-v99zjh93.js";import"./chunk-8vb1m3t3.js";import"./chunk-4n45qa0b.js";import"./chunk-czcx3nbx.js";import"./chunk-x5608pnk.js";import"./chunk-vtgqgx8t.js";import"./chunk-75yst7df.js";import"./chunk-2r0nrvqe.js";import"./chunk-q1mb0fbt.js";import"./chunk-pdprhg5k.js";import"./chunk-bgddx531.js";import"./chunk-q74affc4.js";import"./chunk-gbncp2gp.js";import"./chunk-yp4tn4zn.js";import"./chunk-8va3fs07.js";import"./chunk-sv7fdqmc.js";import"./chunk-a7ryj8z8.js";import"./chunk-qjqvhke7.js";import"./chunk-d0c5q7b7.js";import"./chunk-aaea157p.js";import"./chunk-8e1cv1hh.js";import"./chunk-ybjgnnyf.js";import"./chunk-a0q0kb0s.js";import"./chunk-5yga68j4.js";import"./chunk-cekzqze8.js";import"./chunk-4fkcn6z5.js";import"./chunk-nmz9j39s.js";import"./chunk-kee5a3ce.js";import"./chunk-59er0fc7.js";import{fn}from"./chunk-93b6syb0.js";import{Qf}from"./chunk-99spzsmw.js";import"./chunk-j7bkrvey.js";import"./chunk-9f31gs4m.js";import{ze,i}from"./chunk-qpybh7ss.js";import"./chunk-radvtjwt.js";import"./chunk-kjz7g83q.js";import"./chunk-c0g30cjs.js";import"./chunk-s9xavhdb.js";import"./chunk-ddws4zp2.js";import"./chunk-a852vdv3.js";import"./chunk-d2pexm3z.js";import"./chunk-22mdphq2.js";import{$e}from"./chunk-whmk0m8x.js";import"./chunk-cb0c6959.js";import{Sr,kr}from"./chunk-cn2bgt0w.js";import"./chunk-nb6erf75.js";import{Ms,W,a}from"./chunk-0k7khseq.js";import"./chunk-qxthb2a1.js";import"./chunk-h63ma36g.js";import"./chunk-ssg6ne5b.js";import"./chunk-0rdh8bw3.js";import"./chunk-agd2b928.js";import{j,h,Ke}from"./chunk-3jndqseh.js";import"./chunk-c3413bgh.js";import"./chunk-6t04tqvh.js";import"./chunk-295bykzd.js";import"./chunk-hxhmhw23.js";import"./chunk-a60ztvnp.js";import"./chunk-s29hp1qw.js";import"./chunk-00tq7ghn.js";import{ra}from"./chunk-xpbakn6t.js";import"./chunk-463weehv.js";import"./chunk-shcnt6aa.js";export{Ms as buildWebComponents,kr as cacheTemplate,Sr as checkCache,fn as classifyAllScripts,Ql as createMiddleware,eu as createRoute,W as defaultConfig,h as extractVariables,j as findSfcTemplateBlock,$e as injectRouterScript,ra as insertBeforeBodyClose,a as loadStxConfig,Ke as processClientScript,i as processDirectives,ze as readMarkdownFile,Qf as withinBundlerCallback};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{gr,i}from"./chunk-qpybh7ss.js";import"./chunk-radvtjwt.js";import"./chunk-kjz7g83q.js";import"./chunk-c0g30cjs.js";import"./chunk-s9xavhdb.js";import"./chunk-ddws4zp2.js";import"./chunk-a852vdv3.js";import"./chunk-d2pexm3z.js";import"./chunk-22mdphq2.js";import{$e}from"./chunk-whmk0m8x.js";import"./chunk-cb0c6959.js";import"./chunk-cn2bgt0w.js";import"./chunk-nb6erf75.js";import"./chunk-0k7khseq.js";import"./chunk-qxthb2a1.js";import"./chunk-h63ma36g.js";import"./chunk-ssg6ne5b.js";import"./chunk-0rdh8bw3.js";import"./chunk-agd2b928.js";import{Ue,ro,so}from"./chunk-3jndqseh.js";import"./chunk-c3413bgh.js";import"./chunk-6t04tqvh.js";import"./chunk-295bykzd.js";import"./chunk-hxhmhw23.js";import"./chunk-a60ztvnp.js";import"./chunk-s29hp1qw.js";import"./chunk-00tq7ghn.js";export{gr as buildModulesTag,$e as injectRouterScript,i as processDirectives,ro as processJsonDirective,so as processOnceDirective,Ue as validateClientScript};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{mt,Tg,$g,Rg,Ag,Pg,h,Ig,Di,Og,hl,yl}from"./chunk-
|
|
2
|
+
import{mt,Tg,$g,Rg,Ag,Pg,h,Ig,Di,Og,hl,yl}from"./chunk-3jndqseh.js";import"./chunk-c3413bgh.js";import"./chunk-6t04tqvh.js";import"./chunk-295bykzd.js";import"./chunk-hxhmhw23.js";import"./chunk-a60ztvnp.js";import"./chunk-s29hp1qw.js";import"./chunk-00tq7ghn.js";export{mt as STX_ENGINE_BINDING_NAMES,Di as convertToCommonJS,hl as extractScriptFromTemplate,h as extractVariables,yl as hasVariables,Ig as isCompleteImport,Pg as isMissingBindingFailure,Rg as isModuleResolutionFailure,Ag as isSyntaxFailure,Og as splitDeclaration,Tg as stripTypeScript,$g as withoutStxReferrer};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{a}from"./chunk-
|
|
2
|
+
import{a}from"./chunk-0k7khseq.js";import{Mo}from"./chunk-c73c0wf9.js";import p from"path";async function Sm(t={}){let l=performance.now(),s=t.root||process.cwd(),e=await a(s),o=t.ssr?.routeRules??e.routeRules??{};if(Mo(o),!e.ssr&&Object.keys(o).length)throw Error("routeRules require ssr: true and the production server; flat SSG output cannot apply request/cache policies");if(!e.ssr&&(t.ssr?.serverApi??e.serverApi))throw Error("serverApi requires ssr: true; flat SSG output cannot execute API endpoints");let r=e.ssr?"ssr":"ssg";console.log(`[stx build] Mode: ${r.toUpperCase()}${e.ssr?" (ssr: true in stx.config.ts)":" (default \u2014 ssr is false)"}`);let u,n;if(r==="ssg"){let{generateStaticSite:i}=await import("./ssg.js");u=await i({pagesDir:p.join(e.root||".",e.pagesDir||e.build?.pagesDir||"pages"),publicDir:e.publicDir||e.build?.publicDir||"public",outputDir:e.build?.outputDir||"dist",generate404:e.build?.generate404??!0,minify:e.build?.minify??!0,cleanOutput:e.build?.cleanOutput??!0,router:e.router,...t.ssg})}else{let{buildForProduction:i}=await import("./chunk-cn6dqyfh.js");n=await i({root:s,outputDir:".output",debug:t.debug,...t.ssr})}let d=Math.round(performance.now()-l);return{mode:r,ssg:u,ssr:n,duration:d}}
|
|
3
3
|
export{Sm};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{pt}from"./chunk-agd2b928.js";import{$t,tr}from"./chunk-4fkcn6z5.js";import{he,Tn,kl,_l}from"./chunk-
|
|
2
|
+
import{pt}from"./chunk-agd2b928.js";import{$t,tr}from"./chunk-4fkcn6z5.js";import{he,Tn,kl,_l}from"./chunk-3jndqseh.js";import{zr,Hr,Vr,Wr,Me}from"./chunk-295bykzd.js";import{F}from"./chunk-6t04tqvh.js";import{Vi}from"./chunk-c3413bgh.js";import{x}from"./chunk-radvtjwt.js";import{i}from"./chunk-qpybh7ss.js";import{W,a}from"./chunk-0k7khseq.js";import{Kc}from"./chunk-ssg6ne5b.js";import{Vn,Un,nt,je,Ia,Oa,Wn}from"./chunk-75yst7df.js";import{wn,Xo}from"./chunk-j7bkrvey.js";import{qn}from"./chunk-c73c0wf9.js";import{pn,ur,dr}from"./chunk-p6hcrg3r.js";import{ne}from"./chunk-whmk0m8x.js";import m from"fs";import c from"path";import{createHash as Y}from"crypto";function I(n){return Y("sha256").update(n).digest("hex").slice(0,8)}function J(n=!1){let l=n?tr():$t(),o=I(l);return{content:l,filename:`runtime.${o}.js`,hash:o}}function U(){let n=pt(),l=I(n);return{content:n,filename:`router.${l}.js`,hash:l}}import V from"path";import{createHash as Q}from"crypto";function ee(n={}){let l=new Set;return{context:new Proxy(n,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function q(n,l,o={}){let r=V.resolve(n),e=await Bun.file(r).text(),S=Q("sha256").update(e).digest("hex").slice(0,16);kl();let _={};try{_=await a(o.configDir)}catch{}let y=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))y.push(g[2])}let u=new Set(y.flatMap((R)=>he(R))),{context:D}=ee({__filename:r,__dirname:V.dirname(r),__stx_serverDeclared:u}),A=new Set,T={...W,..._,...o,buildMode:"compile",strict:!1},f=await i(e,D,r,T,A),w=Vn(f)+Un(f)+nt(f),j=_l();return{route:l,sourceFile:n,html:f,fragment:w,placeholders:j,hasServerScripts:y.length>0,serverScriptContent:y,dependencies:Array.from(A),contentHash:S,status:Tn(e),streamTemplates:D.__streamTemplates}}var te=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function X(n,l){let o=0,r=0;if(!m.existsSync(n))return{copied:o,bytes:r};m.mkdirSync(l,{recursive:!0});function e(S,_){let y=m.readdirSync(S,{withFileTypes:!0});for(let d of y){if(te.has(d.name))continue;let g=c.join(S,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(g,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(g,u),o++,r+=m.statSync(u).size}}}return e(n,l),{copied:o,bytes:r}}async function Pm(n={}){let l=Date.now(),o=c.resolve(n.root||process.cwd()),r=c.resolve(o,n.outputDir||".output");console.log("[stx build] Starting production build...");let e=await a(o),S=c.resolve(o,n.componentsDir??e.componentsDir??"components"),_=c.resolve(o,n.partialsDir??e.partialsDir??"partials"),y=c.resolve(o,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",g=Me(e.app?.head,{known:Wr,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",A=n.routeRules??e.routeRules??{},T=qn(A),f=n.serverApi??e.serverApi,w=typeof f==="object"?f:{};if(f)wn(o,w);if(e.runtimeConfig)F(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let j=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of j)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=ne(o,{pagesDirs:e._layerPageDirs}),Z=["components","layouts","partials"],P=R.filter((s)=>!Z.some((h)=>s.pattern.startsWith(`/${h}/`)||s.pattern===`/${h}`));console.log(`[stx build] Found ${P.length} page routes (${R.length-P.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=J(n.debug),b=U();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",b.filename),b.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${b.filename} (${(b.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let B=[],O=[];for(let s of P){let h=T(s.pattern),M=h.rendering==="prerender";if(M&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await q(s.filePath,s.pattern,{configDir:o,componentsDir:S,partialsDir:_,layoutsDir:y,debug:n.debug});if(B.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,b.filename),t.html=Vr(t.html,g,{bodyScripts:[`<script src="/__stx/${b.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=zr(t.html,u);if(g.htmlAttrs)t.html=Hr(t.html,g.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let G=p[1];t.html=t.html.replace(" "+G,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${G}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await x(t.html),M){let p=await Wn(t,{params:{},request:new Request(`http://stx.build${s.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${s.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=je(t.html,D,!0);let K=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),L=c.join("server","pages",`${K}.compiled.json`),z=c.join("server","fragments",`${K}.html`);await Bun.write(c.join(r,L),JSON.stringify(t,null,2)),await Bun.write(c.join(r,z),t.fragment),O.push({pattern:s.pattern,compiledPath:L,fragmentPath:z,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:M}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(h).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let H=c.resolve(o,d);if(m.existsSync(H)){let{copied:s,bytes:h}=X(H,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${d}/`)}let k=dr(o);if(k){let{copied:s,bytes:h}=X(k,c.join(r,"public",ur));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${pn}/`)}let E={runtime:v.filename,router:b.filename},C=Ia(O,E,r);if(C.routeRules=A,C.routerContainer=D,f)C.apiRoutes=await Xo(o,r,w);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await Vi(o,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(Kc(e._layerGraph),null,2));Oa(C,r);let N=Date.now()-l;return console.log(`
|
|
3
3
|
[stx build] Done in ${N}ms \u2014 ${B.length} pages compiled`),{pageCount:B.length,assets:E,outputDir:r,duration:N}}
|
|
4
4
|
export{Pm};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Er}from"./chunk-agd2b928.js";import{Fr}from"./chunk-
|
|
2
|
+
import{Er}from"./chunk-agd2b928.js";import{Fr}from"./chunk-295bykzd.js";import{a}from"./chunk-0k7khseq.js";import{U,ct}from"./chunk-care745q.js";import{Mc}from"./chunk-ezna4dhj.js";import{D,c}from"./chunk-xpbakn6t.js";var x=/<style\b[^>]*>/iy,R=/<\/style>/gi,b=/<script\b[^>]*>/iy,S=/<template(?=[\s>/])[^>]*>/iy,w=/<\/template\s*>/iy;function vr(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 ne(e,r={}){return new Er(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=ne(".",{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 Te(e){return e.includes("data-stx-runtime")}function Oc(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=vr(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=Fr(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(U(e))return ct(e,(o)=>`${o}
|
|
6
6
|
${r}`);return`${r}
|
|
7
|
-
${e}`}async function xr(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 xr(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-4adb8bmp.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-4adb8bmp.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 Nc(e){if(e.includes("data-stx-tooltip-runtime")||!O(e))return e;let r=`<script data-stx-scoped data-stx-tooltip-runtime>${Mc()}</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-4adb8bmp.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-4adb8bmp.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{vr,ne,Te,Oc,xr,Nc,$e};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ae,mt,Ut,Ys,Zs,Se,$i,Cn,rl,sl,Ri,ol,il,eo,Pi,Ii,al,Oi}from"./chunk-
|
|
2
|
+
import{Ae,mt,Ut,Ys,Zs,Se,$i,Cn,rl,sl,Ri,ol,il,eo,Pi,Ii,al,Oi}from"./chunk-3jndqseh.js";import{E}from"./chunk-00tq7ghn.js";import{a}from"./chunk-0k7khseq.js";import{Lo}from"./chunk-cekzqze8.js";import{l}from"./chunk-s7xywsqd.js";import{existsSync as G,readFileSync as U}from"fs";import h from"path";var ke=new Set(["module","exports","require","$bool","$num","window","document","console","confirm","alert","fetch"]),oe=mt.filter((e)=>!ke.has(e)).sort(),ce=[...E].sort(),ve=[...new Set([...oe,...ce])].sort(),$e=new Set(oe),De=new Set(ce),Te=new Set(ve),re=/\bimport\s+(?!type[\s{])\{([^}]*)\}\s*from\s*(['"])stx\2/g;function Ce(e,t){if(t==="server")return`'${e}' is not provided by 'stx' in a <script server> block. The engine binds only its own names there (defineProps, state, useHead, ...); any other name becomes \`await import('stx')\`, which does not resolve, so the whole script fails when the page renders. Import it from '@stacksjs/stx' instead.`;return`'${e}' is not provided by 'stx' in a client <script> block. The import is replaced by the window.stx runtime, which has no '${e}', so it is undefined in the browser.`}function ae(e,t){let o=[];for(let d of t){if(d.offset===void 0)continue;let i=d.kind==="server"?$e:De;re.lastIndex=0;for(let c of d.code.matchAll(re)){let m=c.index+c[0].indexOf("{")+1;for(let f of c[1].matchAll(/[^,]+/g)){let k=f[0];if(/^\s*type\s/.test(k))continue;let S=/^\s*([A-Za-z_$][\w$]*)/.exec(k);if(!S)continue;let s=S[1];if(!Te.has(s)||i.has(s))continue;let u=d.offset+m+f.index+S[0].length-s.length,g=e.slice(0,u),v=g.split(`
|
|
3
3
|
`).length;o.push({line:v,column:u-(g.lastIndexOf(`
|
|
4
4
|
`)+1)+1,offset:u,length:s.length,name:s,kind:d.kind,message:Ce(s,d.kind)})}}}return o}import M from"path";var Ee="@stacksjs/stx-typescript-plugin";function Oe(e,t){let o=M.resolve(e);for(;;){let d=M.join(o,"tsconfig.json");if(t(d))return d;let i=M.dirname(o);if(i===o)return;o=i}}function le(e,t,o){let d=Oe(e,o);if(!d)return;let i=new Set,c=(m)=>{if(i.has(m))return;i.add(m);let f=t(m);if(!f)return;let k=f.compilerOptions?.plugins;if(Array.isArray(k)){let s=k.find((g)=>g?.name===Ee),u=Array.isArray(s?.libs)?s.libs.filter((g)=>typeof g==="string"):[];return s?{configPath:m,libs:u.map((g)=>M.resolve(M.dirname(m),g))}:null}let S=typeof f.extends==="string"?[f.extends]:Array.isArray(f.extends)?f.extends:[];for(let s of[...S].reverse()){if(typeof s!=="string"||!s.startsWith("."))continue;let u=M.resolve(M.dirname(m),s.endsWith(".json")?s:`${s}.json`),g=c(u);if(g!==void 0)return g}return};return c(d)??void 0}function Ra(e,t="",o="",d=t,i){let c=e.startLine>1?`
|
|
5
5
|
`.repeat(e.startLine-1):"",m=$i(Pi(e)+e.code,d),f=e.kind==="client"&&i?i.project(m.code):void 0,k=Cn(f?.code??m.code),S=e.kind==="client"||e.kind==="plain"?ol(t,e.code):"",s=(c+k).split(`
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{km}from"./chunk-8vb1m3t3.js";import"./chunk-75yst7df.js";import"./chunk-93b6syb0.js";import"./chunk-j7bkrvey.js";import"./chunk-ddws4zp2.js";import"./chunk-whmk0m8x.js";import"./chunk-0k7khseq.js";import"./chunk-qxthb2a1.js";import"./chunk-h63ma36g.js";import"./chunk-ssg6ne5b.js";import"./chunk-0rdh8bw3.js";import"./chunk-agd2b928.js";import"./chunk-3jndqseh.js";import"./chunk-c3413bgh.js";import"./chunk-6t04tqvh.js";import"./chunk-295bykzd.js";import"./chunk-hxhmhw23.js";import"./chunk-a60ztvnp.js";import"./chunk-s29hp1qw.js";import"./chunk-00tq7ghn.js";export{km as startProductionServer};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{xm}from"./chunk-rn2kk4r8.js";import"./chunk-qpybh7ss.js";import"./chunk-radvtjwt.js";import"./chunk-kjz7g83q.js";import"./chunk-c0g30cjs.js";import"./chunk-s9xavhdb.js";import"./chunk-ddws4zp2.js";import"./chunk-a852vdv3.js";import"./chunk-d2pexm3z.js";import"./chunk-22mdphq2.js";import"./chunk-whmk0m8x.js";import"./chunk-cb0c6959.js";import"./chunk-cn2bgt0w.js";import"./chunk-nb6erf75.js";import"./chunk-0k7khseq.js";import"./chunk-qxthb2a1.js";import"./chunk-h63ma36g.js";import"./chunk-ssg6ne5b.js";import"./chunk-0rdh8bw3.js";import"./chunk-agd2b928.js";import"./chunk-3jndqseh.js";import"./chunk-c3413bgh.js";import"./chunk-6t04tqvh.js";import"./chunk-295bykzd.js";import"./chunk-hxhmhw23.js";import"./chunk-a60ztvnp.js";import"./chunk-s29hp1qw.js";import"./chunk-00tq7ghn.js";export{xm as startInteractive};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{j,Tn,Wt,qt,h,s,ke,g}from"./chunk-
|
|
2
|
+
import{j,Tn,Wt,qt,h,s,ke,g}from"./chunk-3jndqseh.js";import{Rt,ze,Tc,vs,Zo,Qo,i}from"./chunk-qpybh7ss.js";import{ye}from"./chunk-s29hp1qw.js";import{ae,Br,Ne,q,Mn}from"./chunk-295bykzd.js";import{Nt,Cr,zs,Hs,Vs,Mt,Dt,Lt,jt,Bt,Ft,dt}from"./chunk-agd2b928.js";import{Ms,a,L}from"./chunk-0k7khseq.js";import{Ct,an,Le,V,Aa,Oo,is,nt,Pa,rt,je}from"./chunk-75yst7df.js";import{Sr,kr}from"./chunk-cn2bgt0w.js";import{e,xn,yr,x}from"./chunk-radvtjwt.js";import{at}from"./chunk-kjz7g83q.js";import{Fe}from"./chunk-9f31gs4m.js";import{zn}from"./chunk-8vb1m3t3.js";import{ne,Te,$e}from"./chunk-whmk0m8x.js";import{l}from"./chunk-s7xywsqd.js";import{te}from"./chunk-ws2h92mm.js";import{c,f}from"./chunk-xpbakn6t.js";async function Pn(n){try{let t=await Bun.file(n).text(),o=En(t),d=On(t,n),r=An(t,o),p=Dn(t,o);return{file:n,metrics:o,issues:d,suggestions:r,performance:p}}catch(t){throw Error(`Failed to analyze template ${n}: ${t instanceof Error?t.message:String(t)}`)}}function En(n){let t=n.split(`
|
|
3
3
|
`),o=n.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),r=(o?o[1]:"").split(`
|
|
4
4
|
`).length,p={conditionals:(n.match(/@(if|unless|elseif|else|endif|endunless)\b/g)||[]).length,loops:(n.match(/@(foreach|for|endforeach|endfor|while|endwhile)\b/g)||[]).length,includes:(n.match(/@(include|component|extends|section|yield)\b/g)||[]).length,custom:0,total:0};p.total=p.conditionals+p.loops+p.includes+p.custom;let u=(n.match(/\{\{[\s\S]*?\}\}/g)||[]).length,m=(n.match(/\{!![\s\S]*?!!\}/g)||[]).length,b=(n.match(/@(?:if|unless|elseif|foreach|for|while)\s*\([^)]+\)/g)||[]).length,y=u+m+b,v=(n.match(/<[A-Z][^>]*>/g)||[]).length,C=(n.match(/@(?:layout|extends)\(/g)||[]).length,R=0,O=0;for(let A of t)if(/@(?:if|unless|foreach|for|while|section)\b/.test(A)&&!/@end/.test(A)&&!/@else/.test(A))O++,R=Math.max(R,O);else if(/@end(?:if|unless|foreach|for|while|section)\b/.test(A))O--;let w=R>=4?3:0,S=Math.min(10,Math.ceil(p.total*0.5+y*0.1+v*0.3+(r>10?r*0.05:0)+w));return{lines:t.length,characters:n.length,directives:p,expressions:y,components:v,layouts:C,scriptLines:r,complexity:S}}function On(n,t){let o=[],d=Ut(n,"if","endif");if(d>0)o.push({type:"error",category:"syntax",message:`Found ${d} unmatched @if directive(s)`,suggestion:"Ensure every @if has a corresponding @endif"});let r=Ut(n,"foreach","endforeach");if(r>0)o.push({type:"error",category:"syntax",message:`Found ${r} unmatched @foreach directive(s)`,suggestion:"Ensure every @foreach has a corresponding @endforeach"});let p=n.match(/@foreach[\s\S]*?@foreach[\s\S]*?@endforeach[\s\S]*?@endforeach/g);if(p&&p.length>0)o.push({type:"warning",category:"performance",message:"Nested loops detected which may impact performance",suggestion:"Consider preprocessing data or using more efficient data structures"});let u=(n.match(/\{!![\s\S]*?!!\}/g)||[]).length;if(u>0)o.push({type:"warning",category:"security",message:`Found ${u} raw output expression(s) {!! !!}`,suggestion:"Ensure raw outputs are properly sanitized to prevent XSS"});let m=n.match(/<img[^>]*>/g);if(m){let v=m.filter((C)=>!C.includes("alt="));if(v.length>0)o.push({type:"warning",category:"accessibility",message:`Found ${v.length} image(s) without alt attributes`,suggestion:"Add alt attributes to all images for screen reader accessibility"})}let b=n.split(`
|
|
5
5
|
`).filter((v)=>v.length>120);if(b.length>0)o.push({type:"info",category:"maintainability",message:`Found ${b.length} line(s) longer than 120 characters`,suggestion:"Consider breaking long lines for better readability"});let y=(n.match(/style\s*=\s*["'][^"']*["']/g)||[]).length;if(y>3)o.push({type:"info",category:"maintainability",message:`Found ${y} inline style attributes`,suggestion:"Consider moving styles to CSS classes for better maintainability"});return o}function An(n,t){let o=[];if(t.complexity>7)o.push({type:"refactor",message:"Template complexity is high. Consider breaking into smaller components.",impact:"high",effort:"medium"});else if(t.complexity>5&&t.directives.total>8)o.push({type:"optimization",message:"Template has moderate complexity. Consider component extraction for reusability.",impact:"medium",effort:"low"});if(t.lines>100&&t.components===0)o.push({type:"refactor",message:"Large template with no components. Consider extracting reusable parts into components.",impact:"medium",effort:"medium"});if(t.expressions>20)o.push({type:"optimization",message:"Many template expressions detected. Consider preprocessing some data in the script section.",impact:"medium",effort:"low"});let d=n.match(/@foreach[\s\S]*?@foreach[\s\S]*?@endforeach[\s\S]*?@endforeach/g);if(d&&d.length>0)o.push({type:"optimization",message:"Nested loops detected. Consider preprocessing data or optimizing data structures.",impact:"high",effort:"medium"});if(t.directives.total===0&&t.expressions<5)o.push({type:"optimization",message:"Template appears static. Consider enabling aggressive caching.",impact:"high",effort:"low"});if(t.scriptLines>50)o.push({type:"refactor",message:"Large script section. Consider moving complex logic to external modules.",impact:"medium",effort:"medium"});return o}function Dn(n,t){let o=1;if(o+=t.directives.conditionals*0.1,o+=t.directives.loops*0.5,o+=t.directives.includes*2,o+=t.expressions*0.05,o+=t.components*1,t.scriptLines>10)o+=t.scriptLines*0.1;let d;if(t.expressions===0&&t.directives.total===0)d="high";else if(t.expressions<5&&t.directives.total<3)d="medium";else d="low";let r=[];if(o>10)r.push("Consider optimizing template complexity");if(d==="low"&&t.directives.total>5)r.push("Reduce dynamic content for better caching");if(t.components===0&&t.lines>40)r.push("Extract components to improve reusability and performance");return{estimatedRenderTime:Math.round(o*100)/100,complexityScore:t.complexity,cacheability:d,recommendations:r}}function Ut(n,t,o){let d=n.replace(/<!--[\s\S]*?-->/g,""),r=(d.match(new RegExp(`@${t}\\b`,"g"))||[]).length,p=(d.match(new RegExp(`@${o}\\b`,"g"))||[]).length;return Math.abs(r-p)}async function wa(n=["**/*.stx"],t){let o=[],d=[];for(let p of n){let u=await Array.fromAsync(new Bun.Glob(p).scan({cwd:t||process.cwd(),onlyFiles:!0,absolute:!0}));d.push(...u.filter((m)=>m.endsWith(".stx")))}for(let p of d)try{let u=await Pn(p);o.push(u)}catch(u){console.warn(`Failed to analyze ${p}:`,u)}let r=_n(o);return{results:o,summary:r}}function _n(n){let t=n.length,o=n.reduce((y,v)=>y+v.metrics.lines,0),d=t>0?n.reduce((y,v)=>y+v.metrics.complexity,0)/t:0,r=n.reduce((y,v)=>y+v.issues.length,0),p={};n.forEach((y)=>{y.issues.forEach((v)=>{p[v.category]=(p[v.category]||0)+1})});let u=t>0?n.reduce((y,v)=>y+v.performance.estimatedRenderTime,0)/t:0,m=Math.max(1,Math.min(10,Math.round(10-u/2-d/2))),b=[];if(d>6)b.push("Project has high average complexity. Consider refactoring complex templates.");if(r>t*2)b.push("High number of issues detected. Run detailed analysis on individual files.");if(p.security>0)b.push("Security issues found. Review raw output usage and input sanitization.");return{totalFiles:t,totalLines:o,avgComplexity:Math.round(d*100)/100,totalIssues:r,issuesByCategory:p,performanceScore:m,recommendations:b}}var{serve:Wn}=globalThis.Bun;import Pt from"fs";import Qe from"path";function pt(){return`
|
|
@@ -454,7 +454,7 @@ else {
|
|
|
454
454
|
};
|
|
455
455
|
})();
|
|
456
456
|
</script>
|
|
457
|
-
`}function Ue(n,t,o={}){let d=qn(t,o),r=c(n);if(r!==-1)return n.slice(0,r)+d+n.slice(r);if(n.includes("</html>"))return n.replace("</html>",`${d}</html>`);return n+d}function ht(n){let t=n.toLowerCase();return t.endsWith(".css")||t.endsWith(".scss")||t.endsWith(".sass")||t.endsWith(".less")}function yt(n){let t=n.toLowerCase();return[".stx",".html",".htm",".md",".js",".ts",".jsx",".tsx",".json"].some((d)=>t.endsWith(d))}function xt(n){return[/^\./,/node_modules/,/\.stx\/output/,/\.stx\/cache/,/~$/,/\.swp$/,/\.swo$/].some((o)=>o.test(n))}var Ze=null;function bt(n){if(!Ze)Ze=new Vt(n);return Ze}function st(){if(Ze)Ze.stop(),Ze=null}import vt from"path";var et={name:"bun-plugin-stx",async setup(n){let o={...await a(),...n.config?.stx},d=new Set,r=o.webComponents?.enabled?`./${vt.relative(vt.dirname(n.config?.outdir||"dist"),o.webComponents.outputDir||"dist/web-components")}`:"/web-components",p=[];if(o.webComponents?.enabled)try{let u=await Ms(o,d);if(p.push(...u),o.debug&&u.length>0)console.log(`Successfully built ${u.length} web components`)}catch(u){console.error("Failed to build web components:",u)}n.onLoad({filter:/\.stx$/},async({path:u})=>{try{let m=new Set;if(o.cache&&o.cachePath){let S=await Sr(u,o);if(S){if(o.debug)console.log(`Using cached version of ${u}`);return{contents:S,loader:"html"}}}let b=await Ne(()=>Bun.file(u).text(),"",(S)=>{throw new Br(`Failed to read stx file: ${u}`,u,void 0,void 0,`File read error: ${S.message}`)});if(!b)throw new Br(`stx file is empty: ${u}`,u);let{scriptContent:y,templateContent:v,allScripts:C}=ye.time("script-extraction",()=>{let S=b,A=j(b);if(A)S=A.content.trim();let U=b.match(/<script\b[^>]*>[\s\S]*?<\/script>/gi)||[],oe="",H=[];for(let k of U){let P=k.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i)?.[1]||"",D=k.match(/<script\b([^>]*)>/i),K=D?D[1]:"";if(/\bserver\b/i.test(K))oe=P;else H.push(k)}let I=S.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"");return{scriptContent:oe,templateContent:I,allScripts:H}}),R={__filename:u,__dirname:vt.dirname(u),__stx:{webComponentsPath:r,builtComponents:p}};await Ne(()=>h(y,R,u),void 0,(S)=>{let A=new ae(`Script execution failed in ${u}: ${S.message}`,u,void 0,void 0,y.substring(0,100));if(q.log(A,{filePath:u,scriptContent:y}),o.debug)throw A});let w=await ye.timeAsync("directive-processing",async()=>await i(v,R,u,o,m));if(C.length>0){let{interpolateScriptsInTemplate:S}=await import("./chunk-
|
|
457
|
+
`}function Ue(n,t,o={}){let d=qn(t,o),r=c(n);if(r!==-1)return n.slice(0,r)+d+n.slice(r);if(n.includes("</html>"))return n.replace("</html>",`${d}</html>`);return n+d}function ht(n){let t=n.toLowerCase();return t.endsWith(".css")||t.endsWith(".scss")||t.endsWith(".sass")||t.endsWith(".less")}function yt(n){let t=n.toLowerCase();return[".stx",".html",".htm",".md",".js",".ts",".jsx",".tsx",".json"].some((d)=>t.endsWith(d))}function xt(n){return[/^\./,/node_modules/,/\.stx\/output/,/\.stx\/cache/,/~$/,/\.swp$/,/\.swo$/].some((o)=>o.test(n))}var Ze=null;function bt(n){if(!Ze)Ze=new Vt(n);return Ze}function st(){if(Ze)Ze.stop(),Ze=null}import vt from"path";var et={name:"bun-plugin-stx",async setup(n){let o={...await a(),...n.config?.stx},d=new Set,r=o.webComponents?.enabled?`./${vt.relative(vt.dirname(n.config?.outdir||"dist"),o.webComponents.outputDir||"dist/web-components")}`:"/web-components",p=[];if(o.webComponents?.enabled)try{let u=await Ms(o,d);if(p.push(...u),o.debug&&u.length>0)console.log(`Successfully built ${u.length} web components`)}catch(u){console.error("Failed to build web components:",u)}n.onLoad({filter:/\.stx$/},async({path:u})=>{try{let m=new Set;if(o.cache&&o.cachePath){let S=await Sr(u,o);if(S){if(o.debug)console.log(`Using cached version of ${u}`);return{contents:S,loader:"html"}}}let b=await Ne(()=>Bun.file(u).text(),"",(S)=>{throw new Br(`Failed to read stx file: ${u}`,u,void 0,void 0,`File read error: ${S.message}`)});if(!b)throw new Br(`stx file is empty: ${u}`,u);let{scriptContent:y,templateContent:v,allScripts:C}=ye.time("script-extraction",()=>{let S=b,A=j(b);if(A)S=A.content.trim();let U=b.match(/<script\b[^>]*>[\s\S]*?<\/script>/gi)||[],oe="",H=[];for(let k of U){let P=k.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i)?.[1]||"",D=k.match(/<script\b([^>]*)>/i),K=D?D[1]:"";if(/\bserver\b/i.test(K))oe=P;else H.push(k)}let I=S.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"");return{scriptContent:oe,templateContent:I,allScripts:H}}),R={__filename:u,__dirname:vt.dirname(u),__stx:{webComponentsPath:r,builtComponents:p}};await Ne(()=>h(y,R,u),void 0,(S)=>{let A=new ae(`Script execution failed in ${u}: ${S.message}`,u,void 0,void 0,y.substring(0,100));if(q.log(A,{filePath:u,scriptContent:y}),o.debug)throw A});let w=await ye.timeAsync("directive-processing",async()=>await i(v,R,u,o,m));if(C.length>0){let{interpolateScriptsInTemplate:S}=await import("./chunk-j58b7xen.js"),A=S(C.join(`
|
|
458
458
|
`),R),U=w.search(/<\/body>/i);if(U!==-1)w=w.slice(0,U)+A+`
|
|
459
459
|
`+w.slice(U);else w+=`
|
|
460
460
|
${A}`}if(w=await $e(w),m.forEach((S)=>d.add(S)),o.cache&&o.cachePath){if(await kr(u,w,m,o),o.debug)console.log(`Cached template ${u} with ${m.size} dependencies`)}return{contents:w,loader:"html"}}catch(m){let b=m instanceof Error?m:new ae(`Plugin processing failed: ${String(m)}`,u);if(q.log(b,{filePath:u,buildConfig:n.config}),Mn.logDetailedError(b,{filePath:u,plugin:"bun-plugin-stx"}),o.debug)console.error("stx Plugin Error:",b);let y=b,v=y.line||null,C=y.context||null;return{contents:o.debug||te()?`<!DOCTYPE html>
|
|
@@ -517,7 +517,7 @@ ${A}`}if(w=await $e(w),m.forEach((S)=>d.add(S)),o.cache&&o.cachePath){if(await k
|
|
|
517
517
|
<h1>Something went wrong</h1>
|
|
518
518
|
<p>An internal error occurred. Please try again later.</p>
|
|
519
519
|
</body>
|
|
520
|
-
</html>`,loader:"html"}}})}};async function es(n,t={}){let o=t.port||3000,d=t.watch!==!1,r=t.hotReload!==!1&&d,p=null,u=t.hmrPort||o+1,m=ge.resolve(n);if(!Ie.existsSync(m))return console.error(`${e.red}Error: File not found: ${e.bright}${m}${e.reset}`),!1;if(m.endsWith(".md"))return Et(m,t);else if(!m.endsWith(".stx"))return console.error(`${e.red}Error: Unsupported file type: ${e.bright}${m}${e.reset}. Only .stx and .md files are supported.`),!1;let b=l(process.cwd(),"output");Ie.mkdirSync(b,{recursive:!0}),console.log(`${e.blue}Building ${e.bright}${n}${e.reset}...`);let y=null,v=async()=>{try{let P={name:"public-assets",setup(be){be.onResolve({filter:/^\/(images|fonts|assets|public)\//},(pe)=>({path:pe.path,external:!0}))}},D=await Bun.build({entrypoints:[m],outdir:b,plugins:[P,et],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...t.stxOptions});if(!D.success)return console.error(`${e.red}Build failed:${e.reset}`,D.logs),!1;let K=D.outputs.find((be)=>be.path.endsWith(".html"));if(!K)return console.error(`${e.red}No HTML output found${e.reset}`),!1;return y=await Bun.file(K.path).text(),!0}catch(P){return console.error(`${e.red}Error building stx file:${e.reset}`,P),!1}};if(!await v())return!1;let R=ge.dirname(m);await xn(R);let O=o;try{if(O=await Ve(o),O!==o)console.log(`${e.yellow}Port ${o} is busy, using port ${O} instead${e.reset}`)}catch{return console.error(`${e.red}Could not find an available port${e.reset}`),!1}if(r){let P=t.hmrPort||O+1;p=bt({wsPort:P,verbose:!1}),u=p.start(P)}let w={},S=null,A;try{let{loadStxConfig:P}=await import("./chunk-
|
|
520
|
+
</html>`,loader:"html"}}})}};async function es(n,t={}){let o=t.port||3000,d=t.watch!==!1,r=t.hotReload!==!1&&d,p=null,u=t.hmrPort||o+1,m=ge.resolve(n);if(!Ie.existsSync(m))return console.error(`${e.red}Error: File not found: ${e.bright}${m}${e.reset}`),!1;if(m.endsWith(".md"))return Et(m,t);else if(!m.endsWith(".stx"))return console.error(`${e.red}Error: Unsupported file type: ${e.bright}${m}${e.reset}. Only .stx and .md files are supported.`),!1;let b=l(process.cwd(),"output");Ie.mkdirSync(b,{recursive:!0}),console.log(`${e.blue}Building ${e.bright}${n}${e.reset}...`);let y=null,v=async()=>{try{let P={name:"public-assets",setup(be){be.onResolve({filter:/^\/(images|fonts|assets|public)\//},(pe)=>({path:pe.path,external:!0}))}},D=await Bun.build({entrypoints:[m],outdir:b,plugins:[P,et],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...t.stxOptions});if(!D.success)return console.error(`${e.red}Build failed:${e.reset}`,D.logs),!1;let K=D.outputs.find((be)=>be.path.endsWith(".html"));if(!K)return console.error(`${e.red}No HTML output found${e.reset}`),!1;return y=await Bun.file(K.path).text(),!0}catch(P){return console.error(`${e.red}Error building stx file:${e.reset}`,P),!1}};if(!await v())return!1;let R=ge.dirname(m);await xn(R);let O=o;try{if(O=await Ve(o),O!==o)console.log(`${e.yellow}Port ${o} is busy, using port ${O} instead${e.reset}`)}catch{return console.error(`${e.red}Could not find an available port${e.reset}`),!1}if(r){let P=t.hmrPort||O+1;p=bt({wsPort:P,verbose:!1}),u=p.start(P)}let w={},S=null,A;try{let{loadStxConfig:P}=await import("./chunk-sb93fb2w.js"),D=await P();if(A=t.stxOptions?.serverApi??D.serverApi,D?.apiRouter)S=D?.apiRouter,console.log(`${e.blue}Using custom router for API handling${e.reset}`);if(D?.apiRoutes){w=D.apiRoutes;let K=Object.keys(w).length;if(K>0)console.log(`${e.blue}Loaded ${e.bright}${K} API route${K>1?"s":""}${e.reset}`)}if(D?.broadcasting?.enabled)try{let{startBroadcasting:K,loadChannels:Y}=await import("./chunk-5rd0an89.js"),be=D.broadcasting;await K(be);let pe=be.port??6001;console.log(`${e.magenta}Broadcasting on ${e.cyan}ws://localhost:${pe}/ws${e.reset}`);let Ce=ge.join(process.cwd(),"channels.ts");if(Ie.existsSync(Ce))try{let se=await Y(Ce);console.log(`${e.blue}Loaded ${e.bright}${se} broadcast channel${se!==1?"s":""}${e.blue} from channels.ts${e.reset}`)}catch(se){console.warn(`${e.yellow}Failed to load channels.ts: ${se.message}${e.reset}`)}}catch(K){console.warn(`${e.yellow}Broadcasting failed to start: ${K.message}${e.reset}`)}}catch{}let{createServerApi:U,isServerApiSource:oe}=await import("./chunk-kx4svden.js"),H=await U(process.cwd(),A);if(console.log(`${e.blue}Starting server on ${e.cyan}http://localhost:${O}/${e.reset}...`),r)console.log(`${e.magenta}Hot reload enabled on ws://localhost:${u}${e.reset}`);let I=Kn({port:O,async fetch(P){return zn(P,await(async()=>{let D=new URL(P.url);if([b,ge.dirname(m),ge.join(process.cwd(),"public")].some((se)=>oe(ge.join(se,D.pathname),process.cwd(),A)))return new Response("Not Found",{status:404});if(S)try{let se=await S.handleRequest(P);if(se.status!==404)return se}catch{}if(w[D.pathname])try{return await w[D.pathname](P)}catch(se){return new Response(JSON.stringify({error:se.message}),{status:500,headers:{"Content-Type":"application/json"}})}let K=await H(P);if(K)return K;if(D.pathname==="/")return(async()=>{let F=await x(y||"");if(r)F=Ue(F,u);if(t.native)if(F.includes("<head>"))F=F.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else if(F.includes("<html"))F=F.replace(/(<html[^>]*>)/,"$1<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>");else F="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+F;if(t.titlebarHidden)if(F.includes("<head>"))F=F.replace("<head>","<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script>");else if(F.includes("<html"))F=F.replace(/(<html[^>]*>)/,"$1<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>");else F=`<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>${F}`;return F})().then((F)=>new Response(F,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}}));let Y=ge.join(b,D.pathname);if(Ie.existsSync(Y)&&Ie.statSync(Y).isFile()){let se=Bun.file(Y),F=ge.extname(Y).toLowerCase(),E="text/plain";if(F===".ts"||F===".tsx"){let He=new Bun.Transpiler({loader:F===".tsx"?"tsx":"ts"}),Be=await se.text(),Ge=He.transformSync(Be);return new Response(Ge,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(F){case".html":E="text/html";break;case".css":E="text/css";break;case".js":E="text/javascript";break;case".json":E="application/json";break;case".png":E="image/png";break;case".jpg":case".jpeg":E="image/jpeg";break;case".gif":E="image/gif";break;case".woff":E="font/woff";break;case".woff2":E="font/woff2";break;case".ttf":E="font/ttf";break;case".otf":E="font/otf";break;case".eot":E="application/vnd.ms-fontobject";break}return new Response(se,{headers:{"Content-Type":E}})}let be=ge.dirname(m),pe=ge.join(be,D.pathname);if(Ie.existsSync(pe)&&Ie.statSync(pe).isFile()){let se=Bun.file(pe),F=ge.extname(pe).toLowerCase(),E="text/plain";if(F===".ts"||F===".tsx"){let He=new Bun.Transpiler({loader:F===".tsx"?"tsx":"ts"}),Be=await se.text(),Ge=He.transformSync(Be);return new Response(Ge,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(F){case".html":E="text/html";break;case".css":E="text/css";break;case".js":E="text/javascript";break;case".json":E="application/json";break;case".png":E="image/png";break;case".jpg":case".jpeg":E="image/jpeg";break;case".gif":E="image/gif";break;case".svg":E="image/svg+xml";break;case".ico":E="image/x-icon";break;case".woff":E="font/woff";break;case".woff2":E="font/woff2";break;case".ttf":E="font/ttf";break;case".otf":E="font/otf";break;case".eot":E="application/vnd.ms-fontobject";break}return new Response(se,{headers:{"Content-Type":E}})}let Ce=ge.join(process.cwd(),"public",D.pathname);if(Ie.existsSync(Ce)&&Ie.statSync(Ce).isFile()){let se=Bun.file(Ce),F=ge.extname(Ce).toLowerCase(),E="application/octet-stream";if(F===".ts"||F===".tsx"){let He=new Bun.Transpiler({loader:F===".tsx"?"tsx":"ts"}),Be=await se.text(),Ge=He.transformSync(Be);return new Response(Ge,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(F){case".html":E="text/html";break;case".css":E="text/css";break;case".js":E="text/javascript";break;case".json":E="application/json";break;case".png":E="image/png";break;case".jpg":case".jpeg":E="image/jpeg";break;case".gif":E="image/gif";break;case".svg":E="image/svg+xml";break;case".ico":E="image/x-icon";break;case".woff":E="font/woff";break;case".woff2":E="font/woff2";break;case".ttf":E="font/ttf";break;case".otf":E="font/otf";break;case".eot":E="application/vnd.ms-fontobject";break}return new Response(se,{headers:{"Content-Type":E}})}return new Response("Not Found",{status:404})})())},error(P){return new Response(`<pre>${P}
|
|
521
521
|
${P.stack}</pre>`,{headers:{"Content-Type":"text/html"}})}});console.clear(),console.log(`
|
|
522
522
|
${e.blue}stx${e.reset} ${e.green}${process.env.stx_VERSION||"v0.0.10"}${e.reset} ${e.dim}ready in ${Math.random()*10+5|0}.${Math.random()*90+10|0} ms${e.reset}`),console.log(`
|
|
523
523
|
${e.bright}\u2192 ${e.cyan}http://localhost:${O}/${e.reset}`),console.log(`
|
|
@@ -1002,12 +1002,12 @@ ${w.stack}</pre>`,{headers:{"Content-Type":"text/html"}})}});console.clear(),con
|
|
|
1002
1002
|
${e.blue}stx${e.reset} ${e.green}${process.env.stx_VERSION||"v0.0.10"}${e.reset} ${e.dim}ready in ${Math.random()*10+5|0}.${Math.random()*90+10|0} ms${e.reset}`),console.log(`
|
|
1003
1003
|
${e.bright}\u2192 ${e.cyan}http://localhost:${v}/${e.reset}`),console.log(`
|
|
1004
1004
|
${e.yellow}Routes:${e.reset}`);let R=new Set(m.map((w)=>w.routeTemplate)),O=Object.entries(u).filter(([w])=>!R.has(w)).sort(([w],[S])=>w.localeCompare(S)).map(([w,S])=>({route:w==="/"?"/":w,filePath:Se.relative(process.cwd(),S.filePath),fileType:S.fileType}));for(let w of m){let S=w.routeTemplate.replace(/\[([^\]]+)\]/g,":$1");O.push({route:S,filePath:Se.relative(process.cwd(),w.filePath),fileType:"stx"})}if(O.sort((w,S)=>w.route.localeCompare(S.route)),O.forEach((w,S)=>{let U=S===O.length-1?"\u2514\u2500 ":"\u251C\u2500 ",oe=w.fileType==="md"?`${e.magenta}(markdown)${e.reset}`:"";console.log(` ${e.green}${U}${w.route}${e.reset} \u2192 ${e.bright}${w.filePath}${e.reset} ${oe}`)}),console.log(`
|
|
1005
|
-
Press ${e.cyan}h${e.reset} + ${e.cyan}Enter${e.reset} to show shortcuts`),qe(C.url.toString(),()=>{if(d)Ke.watch(p,{recursive:!0}).close();C.stop()}),d){console.log(`${e.blue}Watching for changes...${e.reset}`);let w=Ke.watch(p,{recursive:!0},async(S,A)=>{if(!A)return;if(A.endsWith(".stx")||A.endsWith(".js")||A.endsWith(".ts")||A.endsWith(".md"))console.log(`${e.yellow}File ${e.bright}${A}${e.yellow} changed, rebuilding...${e.reset}`),at.clear(),ke(),await b()});process.on("SIGINT",()=>{w.close(),C.stop(),process.exit(0)})}return!0}function Xt(n){return String(n??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}var{serve:Gn}=globalThis.Bun;import me from"fs";import re from"path";async function Jt(n){try{return Tn(await Bun.file(n).text())}catch{return}}function Ot(n){let t=Bun.file(n),o=re.extname(n).toLowerCase(),d={".html":"text/html",".css":"text/css",".js":"text/javascript",".json":"application/json",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".ico":"image/x-icon",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"},p=[".js",".css",".json"].includes(o)?{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}:{};return new Response(t,{headers:{"Content-Type":d[o]||"application/octet-stream",...p}})}async function ns(n=".",t={}){let o=t.port||3000,d=t.watch!==!1,r=t.hotReload!==!1&&d,p=null,u=t.hmrPort||o+1,m=re.resolve(n),{loadStxConfig:b}=await import("./chunk-v9mxhch2.js"),y=await b(m),{createServerApi:v,isServerApiSource:C}=await import("./chunk-ce0zbpr5.js"),R=t.stxOptions?.serverApi??y.serverApi,O=await v(m,R),w=y.root&&y.root!=="."?re.join(m,y.root):m,S=t.pagesDir||y.pagesDir||"pages",A=re.join(w,S);if(!me.existsSync(A)&&!y._layerPageDirs?.some((T)=>me.existsSync(T)))return console.error(`${e.red}Error: No '${S}' directory found${e.reset}`),console.log(`${e.dim}Looked in: ${e.bright}${A}${e.reset}`),console.log(`${e.dim}Run stx dev from the app directory, pass it as an argument (stx dev <dir>),${e.reset}`),console.log(`${e.dim}point at another directory with --pages <dir>, or set pagesDir in stx.config.ts.${e.reset}`),console.log(`${e.dim}Starting fresh? Create ${S}/index.stx for the homepage.${e.reset}`),!1;let U=ne(w,{pagesDir:S,pagesDirs:y._layerPageDirs?[A,...y._layerPageDirs.slice(1)]:void 0});if(U.length===0)return console.error(`${e.red}Error: No page files found in ${e.bright}${A}${e.reset}`),!1;console.log(`${e.blue}Found ${e.bright}${U.length}${e.blue} routes${e.reset}`);let oe=y?._pluginPageDirs||[],H=[];for(let{dir:T,prefix:M}of oe)if(me.existsSync(T)){let z=ne(re.dirname(T),{pagesDir:re.basename(T)});for(let Q of z){let X=M==="/"?Q.pattern:`${M}${Q.pattern==="/"?"":Q.pattern}`;H.push({route:{...Q,pattern:X},prefix:M})}if(z.length>0)console.log(`${e.blue}Plugin pages: ${e.bright}${z.length}${e.blue} routes at ${e.cyan}${M}${e.reset}`)}let I=new Map,k=null,P=null;if(t.stxOptions?.shell!==!1){if(P=await Aa(m,t.stxOptions?.shell),P){if(k=await Oo(P,t.stxOptions||{}),k)console.log(`${e.blue}Using app shell: ${e.bright}${re.relative(m,P)}${e.reset} ${e.dim}(deprecated: use layouts/default.stx instead)${e.reset}`)}}Mt(),await Lt(m);let D=Dt();if(D.length>0)console.log(`${e.blue}Loaded ${e.bright}${D.length}${e.blue} middleware: ${e.dim}${D.join(", ")}${e.reset}`);let K={},Y=null;try{let{loadStxConfig:T}=await import("./chunk-v9mxhch2.js"),M=await T(m);if(M?.apiRouter)Y=M?.apiRouter,console.log(`${e.blue}Using custom router for API handling${e.reset}`);if(M?.apiRoutes){K=M.apiRoutes;let z=Object.keys(K).length;if(z>0)console.log(`${e.blue}Loaded ${e.bright}${z} API route${z>1?"s":""}${e.reset}`)}if(M?.broadcasting?.enabled)try{let{startBroadcasting:z,loadChannels:Q}=await import("./chunk-5rd0an89.js"),X=M.broadcasting;await z(X);let Re=X.port??6001;console.log(`${e.magenta}Broadcasting on ${e.cyan}ws://localhost:${Re}/ws${e.reset}`);let ve=re.join(process.cwd(),"channels.ts");if(me.existsSync(ve))try{let N=await Q(ve);console.log(`${e.blue}Loaded ${e.bright}${N} broadcast channel${N!==1?"s":""}${e.blue} from channels.ts${e.reset}`)}catch(N){console.warn(`${e.yellow}Failed to load channels.ts: ${N.message}${e.reset}`)}}catch(z){console.warn(`${e.yellow}Broadcasting failed to start: ${z.message}${e.reset}`)}}catch{}let be=l(m,"output");me.mkdirSync(be,{recursive:!0});let pe=new Map,Ce=new Set,se=async(T)=>{let M=Hs(A,T);if(!M)return null;try{let z=await Bun.build({entrypoints:[M],outdir:be,plugins:[et],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...t.stxOptions});if(!z.success)return null;let Q=z.outputs.find((X)=>X.path.endsWith(".html"));if(!Q)return null;return await Bun.file(Q.path).text()}catch{return null}},F=new Map,E=async(T,M)=>{try{let{processDirectives:z,extractVariables:Q,defaultConfig:X,loadStxConfig:Re,injectRouterScript:ve}=await import("./chunk-v9mxhch2.js"),{checkCache:N,cacheTemplate:J,readFileCached:W,templateCache:ue}=await import("./chunk-qd9v1v8z.js"),G=await Re(m),We=(le)=>{if(!le)return le;if(re.isAbsolute(le))return le;return re.resolve(m,le)},de={...X,...G,...t.stxOptions,autoShell:!0};if(t.debugDirectives)de.debug=!0;de.partialsDir=We(de.partialsDir),de.componentsDir=We(de.componentsDir),de.layoutsDir=We(de.layoutsDir),de.storesDir=We(de.storesDir||"stores"),de.cachePath=We(de.cachePath)??l(m,"cache");let _=!M&&!t.profile,ie=de.cache!==!1;if(ie&&_){let le=ue.get(T.filePath);if(le)try{if((await me.promises.stat(T.filePath)).mtime.getTime()<=le.mtime){let _e=!0;for(let we of le.dependencies){if(!me.existsSync(we)){_e=!1;break}if((await me.promises.stat(we)).mtime.getTime()>le.mtime){_e=!1;break}}if(_e){let we=le.output;if(k)we=nt(we,{preserveHead:!0});let ot=F.get(T.filePath);return{route:T,content:we,status:ot?.status??await Jt(T.filePath),headers:ot?.headers}}}}catch{}let De=await N(T.filePath,de);if(De){let Me=De;if(k)Me=nt(Me,{preserveHead:!0});let _e=F.get(T.filePath);return{route:T,content:Me,status:_e?.status??await Jt(T.filePath),headers:_e?.headers}}}let Z=ie?await W(T.filePath):await Bun.file(T.filePath).text(),ce=Tn(Z),{classifyAllScripts:fe}=await import("./chunk-v9mxhch2.js"),B=fe(Z),Ae=B.server.map((le)=>le.content),Ee=Z;for(let le of B.server)Ee=Ee.replace(le.fullTag,"");let ee={__filename:T.filePath,__dirname:re.dirname(T.filePath),__stx_options:de,params:M??{},__stx_runtime_head:{}};for(let le of Ae)try{await Q(le,ee,T.filePath)}catch(De){if(t.stxOptions?.debug)console.error("[stx] variable extraction error",T.filePath,De?.message||De)}let Pe=new Set,he;if(t.profile){let le=performance.now();he=await z(Ee,ee,T.filePath,de,Pe);let De=performance.now()-le,Me=re.relative(m,T.filePath)||T.filePath;console.log(`[stx:profile] ${Me} \u2192 ${De.toFixed(2)}ms`)}else he=await z(Ee,ee,T.filePath,de,Pe);if(!k)he=await ve(he,{router:de.router});{let{interpolateScriptExpressions:le}=await import("./chunk-qxcc0aar.js");he=he.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/g,(De,Me,_e)=>{if(!/function\s+__stx_setup_/.test(_e))return De;return`<script${Me}>${le(_e,ee)}</script>`})}if(k)he=nt(he,{preserveHead:!0});if(ie&&_)await J(T.filePath,he,Pe,de);let{extractStreamBoundaries:lt}=await import("./chunk-hkx51atf.js"),Je=lt(ee),tt=ee.__streamTemplates;if(tt&&typeof tt==="object"&&Object.keys(tt).length>0){let le=ee.streamBoundaries||{},De={...de,autoShell:!1},Me=Object.keys(tt).map((we)=>({id:we,render:async()=>{let ot=typeof le[we]==="function"?await le[we]():void 0;return z(tt[we],{...ee,$boundary:ot},T.filePath,De,new Set)}})),_e=new Set(Me.map((we)=>we.id));Je=[...(Je||[]).filter((we)=>!_e.has(we.id)),...Me]}if(Je&&Je.length>0)Ce.add(T.pattern);else Je=void 0;let It=Wt(ee),Ht=qt(ee);if(_)F.set(T.filePath,{status:It,headers:Ht});return{route:T,content:he,status:It??ce,headers:Ht,boundaries:Je}}catch(z){return console.error(`${e.red}Error building ${e.bright}${T.pattern}${e.reset}:`,z),null}},He=8,Be=async()=>{let T=new Set(pe.keys()),M=new Set(I.keys());pe.clear(),I.clear();let z=t.prebuild===!1?U.filter((X)=>T.has(X.pattern)):U,Q=t.prebuild===!1?H.filter(({route:X})=>M.has(X.pattern)):H;for(let X=0;X<z.length;X+=He){let Re=z.slice(X,X+He),ve=await Promise.all(Re.map((N)=>E(N)));for(let N of ve)if(N)pe.set(N.route.pattern,N)}for(let X=0;X<Q.length;X+=He){let Re=Q.slice(X,X+He),ve=await Promise.all(Re.map(({route:N})=>E(N)));for(let N of ve)if(N)I.set(N.route.pattern,N)}return pe.size>0};if(console.log(`${e.blue}${t.prebuild===!1?"Rendering pages on request...":"Building pages..."}${e.reset}`),!(t.prebuild===!1?U.length+H.length>0:await Be()))return console.error(`${e.red}No pages were successfully built${e.reset}`),!1;await xn(m);let Xe=o;try{if(Xe=await Ve(o),Xe!==o)console.log(`${e.yellow}Port ${o} is busy, using port ${Xe} instead${e.reset}`)}catch{return console.error(`${e.red}Could not find an available port${e.reset}`),!1}if(r){let T=t.hmrPort||Xe+1;p=bt({wsPort:T,verbose:!1}),u=p.start(T)}let St=(T,M)=>{let Q=`<script data-stx-route-params>(function(){var p=${JSON.stringify(M).replace(/</g,"\\u003C").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")};window.__stx_rp=p;if(window.stx){window.stx._rp=p;if(window.stx.setRouteParams)window.stx.setRouteParams(p)}})()</script>`;if(T.includes("</head>"))return f(T,Q,"");if(T.includes("<body"))return T.replace(/<body([^>]*)>/,`<body$1>${Q}`);return Q+T};console.log(`${e.blue}Starting server...${e.reset}`);let kt=Gn({port:Xe,hostname:t.hostname,async fetch(T){let M=new URL(T.url),z=t.stxOptions?.offline??y.offline;if(M.pathname===Zo&&z?.enabled){if(!["GET","HEAD"].includes(T.method))return new Response("Method Not Allowed",{status:405,headers:{Allow:"GET, HEAD"}});return new Response(T.method==="HEAD"?null:Qo(z,vs()),{headers:{"Content-Type":"application/javascript; charset=utf-8","Cache-Control":"no-store","Service-Worker-Allowed":"/"}})}let Q=y?.publicDir||"public",X=re.join(m,Q,M.pathname),Re=re.join(m,M.pathname),ve=re.join(be,M.pathname);if([X,Re,ve].some((_)=>C(_,m,R)))return new Response("Not Found",{status:404});let[N,J,W]=await Promise.all([me.promises.stat(X).catch(()=>null),me.promises.stat(Re).catch(()=>null),me.promises.stat(ve).catch(()=>null)]);if(N?.isFile()&&!C(X,m,R))return Ot(X);if(J?.isFile()&&!C(Re,m,R))return Ot(Re);if(W?.isFile()&&!C(ve,m,R))return Ot(ve);if(M.pathname.startsWith("/_stx/component/")){let _=decodeURIComponent(M.pathname.slice(16));if(_)try{let ie=`<${_} />`,Z={...buildConfig,autoShell:!1},ce=await processDirectives(ie,{},re.join(m,"components",`${_}.stx`),Z,new Set);return new Response(ce,{headers:{"Content-Type":"text/html"}})}catch(ie){return new Response(`<div class="stx-async-error">${ie.message}</div>`,{status:500,headers:{"Content-Type":"text/html"}})}}if(M.pathname==="/_stx/img"){let{handleImageRequest:_}=await import("./chunk-53cc06w7.js"),ie=await _(T,{publicDir:re.join(m,Q),cacheDir:l(m,"cache","img")});if(ie)return ie}if(Y)try{let _=await Y.handleRequest(T);if(_.status!==404)return _}catch{}if(K[M.pathname])try{return await K[M.pathname](T)}catch(_){return new Response(JSON.stringify({error:_.message}),{status:500,headers:{"Content-Type":"application/json"}})}let ue=await O(T);if(ue)return ue;let G=Cr(M.pathname,U);if(G){let _=pe.get(G.route.pattern),ie=Ce.has(G.route.pattern);if(!_||G.route.isDynamic&&Object.keys(G.params).length>0||ie){let Z=await E(G.route,G.params);if(Z){if(_=Z,!G.route.isDynamic&&!ie)pe.set(G.route.pattern,Z)}}if(_){let Z=_.status??200,ce=_.headers??{},fe=(G.route.filePath?Rt(await Bun.file(G.route.filePath).text().catch(()=>"")):null)??{};if(fe.validate){if(!await fe.validate({params:G.params})){let Ee=await se(404);if(Ee){let ee=Ee;if(ee=await x(ee,m),r)ee=Ue(ee,u);return new Response(ee,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})}}if(fe.middleware){let Ae=jt(M.pathname,G.params,fe,M.search),Ee=Bt(Ae,null,T,{isServer:!0}),ee=await Ft(fe.middleware,Ee);if(ee.redirect){let Pe=ee.redirect.path,he=ee.redirect.options.redirectCode||302,lt=new Headers(ee.responseHeaders);return lt.set("Location",Pe),new Response(null,{status:he,headers:lt})}if(ee.abort){let{statusCode:Pe,message:he}=ee.abort.error;return new Response(`<!DOCTYPE html><html><head><title>Error ${Pe}</title></head><body><h1>Error ${Pe}</h1><p>${he}</p></body></html>`,{status:Pe,headers:{"Content-Type":"text/html"}})}if(Object.keys(ee.state).length>0){let Pe=`<script>(function(){var s=typeof stx!=='undefined'?stx:{};s._ms=${JSON.stringify(ee.state)};if(s.setMiddlewareState)s.setMiddlewareState(s._ms);})()</script>`;_.content=f(_.content,Pe,"")}}let B=_.content;if(k&&Pa(T)&&rt(B,y?.router?.container||"main")){let Ae=dt(B),Ee=Te(B),ee=B.match(/<title[^>]*>([\s\S]*?)<\/title>/i),Pe=ee?an(ee[1].trim()):"";if(Object.keys(G.params).length>0)B=St(B,G.params);B=await x(B,m);let he=y?.router?.container||"main";return B=je(B,he,!0),new Response(B,{status:Z,headers:{"Content-Type":"text/html","X-STX-Fragment":"true","X-STX-Layout":Ae.layout,"X-STX-Layout-Group":Ae.group,"X-STX-Runtime":Ee?"true":"false",...Pe&&{"X-STX-Title":encodeURIComponent(Pe)},[Tc]:vs(),...V(),"Cache-Control":Ct}})}if(k)B=is(k,B);if(Object.keys(G.params).length>0)B=St(B,G.params);if(B=await x(B,m),r)B=Ue(B,u);if(t.native)if(B.includes("<head>"))B=B.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else B="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+B;if(t.titlebarHidden)if(B.includes("<head>"))B=B.replace("<head>","<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script>");else B=`<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>${B}`;if(_.boundaries&&_.boundaries.length>0){let{renderStreamingPage:Ae,streamToResponse:Ee}=await import("./chunk-hkx51atf.js");return Ee(Ae(B,_.boundaries,{timeoutMs:30000}),{status:Z,headers:{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}return new Response(B,{status:Z,headers:{"Content-Type":"text/html",...V(),"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0",...ce}})}}if(H.length>0){let _=H.map((Z)=>Z.route),ie=Cr(M.pathname,_);if(ie){let Z=I.get(ie.route.pattern);if(!Z||ie.route.isDynamic){let ce=await E(ie.route,ie.params);if(ce){if(Z=ce,!ie.route.isDynamic)I.set(ie.route.pattern,ce)}}if(Z){let ce=Z.content;if(k)ce=is(k,ce);if(Object.keys(ie.params).length>0)ce=St(ce,ie.params);if(ce=await x(ce,m),r)ce=Ue(ce,u);return new Response(ce,{status:Z.status??200,headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}for(let{prefix:Z}of oe)if(Z!=="/"&&M.pathname.startsWith(Z)){let ce=I.get(Z)||I.get(Z+"/");if(!ce){let fe=H.find(({route:B})=>B.pattern===Z||B.pattern===`${Z}/`);if(fe){let B=await E(fe.route);if(B)ce=B,I.set(fe.route.pattern,B)}}if(ce){let fe=ce.content;if(k)fe=is(k,fe);if(fe=await x(fe,m),r)fe=Ue(fe,u);return new Response(fe,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}}if(Nt(M.pathname))return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}});let We=pe.get("/");if(We){let _=We.content;if(_=await x(_,m),r)_=Ue(_,u);if(t.native)if(_.includes("<head>"))_=_.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else _="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+_;return new Response(_,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}let de=await se(404);if(de){let _=de;if(_=await x(_,m),r)_=Ue(_,u);return new Response(_,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})},async error(T){let M=await se(500);if(M)return new Response(M,{status:500,headers:{"Content-Type":"text/html"}});return new Response(`<pre>${T}
|
|
1005
|
+
Press ${e.cyan}h${e.reset} + ${e.cyan}Enter${e.reset} to show shortcuts`),qe(C.url.toString(),()=>{if(d)Ke.watch(p,{recursive:!0}).close();C.stop()}),d){console.log(`${e.blue}Watching for changes...${e.reset}`);let w=Ke.watch(p,{recursive:!0},async(S,A)=>{if(!A)return;if(A.endsWith(".stx")||A.endsWith(".js")||A.endsWith(".ts")||A.endsWith(".md"))console.log(`${e.yellow}File ${e.bright}${A}${e.yellow} changed, rebuilding...${e.reset}`),at.clear(),ke(),await b()});process.on("SIGINT",()=>{w.close(),C.stop(),process.exit(0)})}return!0}function Xt(n){return String(n??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}var{serve:Gn}=globalThis.Bun;import me from"fs";import re from"path";async function Jt(n){try{return Tn(await Bun.file(n).text())}catch{return}}function Ot(n){let t=Bun.file(n),o=re.extname(n).toLowerCase(),d={".html":"text/html",".css":"text/css",".js":"text/javascript",".json":"application/json",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".ico":"image/x-icon",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"},p=[".js",".css",".json"].includes(o)?{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}:{};return new Response(t,{headers:{"Content-Type":d[o]||"application/octet-stream",...p}})}async function ns(n=".",t={}){let o=t.port||3000,d=t.watch!==!1,r=t.hotReload!==!1&&d,p=null,u=t.hmrPort||o+1,m=re.resolve(n),{loadStxConfig:b}=await import("./chunk-sb93fb2w.js"),y=await b(m),{createServerApi:v,isServerApiSource:C}=await import("./chunk-kx4svden.js"),R=t.stxOptions?.serverApi??y.serverApi,O=await v(m,R),w=y.root&&y.root!=="."?re.join(m,y.root):m,S=t.pagesDir||y.pagesDir||"pages",A=re.join(w,S);if(!me.existsSync(A)&&!y._layerPageDirs?.some((T)=>me.existsSync(T)))return console.error(`${e.red}Error: No '${S}' directory found${e.reset}`),console.log(`${e.dim}Looked in: ${e.bright}${A}${e.reset}`),console.log(`${e.dim}Run stx dev from the app directory, pass it as an argument (stx dev <dir>),${e.reset}`),console.log(`${e.dim}point at another directory with --pages <dir>, or set pagesDir in stx.config.ts.${e.reset}`),console.log(`${e.dim}Starting fresh? Create ${S}/index.stx for the homepage.${e.reset}`),!1;let U=ne(w,{pagesDir:S,pagesDirs:y._layerPageDirs?[A,...y._layerPageDirs.slice(1)]:void 0});if(U.length===0)return console.error(`${e.red}Error: No page files found in ${e.bright}${A}${e.reset}`),!1;console.log(`${e.blue}Found ${e.bright}${U.length}${e.blue} routes${e.reset}`);let oe=y?._pluginPageDirs||[],H=[];for(let{dir:T,prefix:M}of oe)if(me.existsSync(T)){let z=ne(re.dirname(T),{pagesDir:re.basename(T)});for(let Q of z){let X=M==="/"?Q.pattern:`${M}${Q.pattern==="/"?"":Q.pattern}`;H.push({route:{...Q,pattern:X},prefix:M})}if(z.length>0)console.log(`${e.blue}Plugin pages: ${e.bright}${z.length}${e.blue} routes at ${e.cyan}${M}${e.reset}`)}let I=new Map,k=null,P=null;if(t.stxOptions?.shell!==!1){if(P=await Aa(m,t.stxOptions?.shell),P){if(k=await Oo(P,t.stxOptions||{}),k)console.log(`${e.blue}Using app shell: ${e.bright}${re.relative(m,P)}${e.reset} ${e.dim}(deprecated: use layouts/default.stx instead)${e.reset}`)}}Mt(),await Lt(m);let D=Dt();if(D.length>0)console.log(`${e.blue}Loaded ${e.bright}${D.length}${e.blue} middleware: ${e.dim}${D.join(", ")}${e.reset}`);let K={},Y=null;try{let{loadStxConfig:T}=await import("./chunk-sb93fb2w.js"),M=await T(m);if(M?.apiRouter)Y=M?.apiRouter,console.log(`${e.blue}Using custom router for API handling${e.reset}`);if(M?.apiRoutes){K=M.apiRoutes;let z=Object.keys(K).length;if(z>0)console.log(`${e.blue}Loaded ${e.bright}${z} API route${z>1?"s":""}${e.reset}`)}if(M?.broadcasting?.enabled)try{let{startBroadcasting:z,loadChannels:Q}=await import("./chunk-5rd0an89.js"),X=M.broadcasting;await z(X);let Re=X.port??6001;console.log(`${e.magenta}Broadcasting on ${e.cyan}ws://localhost:${Re}/ws${e.reset}`);let ve=re.join(process.cwd(),"channels.ts");if(me.existsSync(ve))try{let N=await Q(ve);console.log(`${e.blue}Loaded ${e.bright}${N} broadcast channel${N!==1?"s":""}${e.blue} from channels.ts${e.reset}`)}catch(N){console.warn(`${e.yellow}Failed to load channels.ts: ${N.message}${e.reset}`)}}catch(z){console.warn(`${e.yellow}Broadcasting failed to start: ${z.message}${e.reset}`)}}catch{}let be=l(m,"output");me.mkdirSync(be,{recursive:!0});let pe=new Map,Ce=new Set,se=async(T)=>{let M=Hs(A,T);if(!M)return null;try{let z=await Bun.build({entrypoints:[M],outdir:be,plugins:[et],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...t.stxOptions});if(!z.success)return null;let Q=z.outputs.find((X)=>X.path.endsWith(".html"));if(!Q)return null;return await Bun.file(Q.path).text()}catch{return null}},F=new Map,E=async(T,M)=>{try{let{processDirectives:z,extractVariables:Q,defaultConfig:X,loadStxConfig:Re,injectRouterScript:ve}=await import("./chunk-sb93fb2w.js"),{checkCache:N,cacheTemplate:J,readFileCached:W,templateCache:ue}=await import("./chunk-4adb8bmp.js"),G=await Re(m),We=(le)=>{if(!le)return le;if(re.isAbsolute(le))return le;return re.resolve(m,le)},de={...X,...G,...t.stxOptions,autoShell:!0};if(t.debugDirectives)de.debug=!0;de.partialsDir=We(de.partialsDir),de.componentsDir=We(de.componentsDir),de.layoutsDir=We(de.layoutsDir),de.storesDir=We(de.storesDir||"stores"),de.cachePath=We(de.cachePath)??l(m,"cache");let _=!M&&!t.profile,ie=de.cache!==!1;if(ie&&_){let le=ue.get(T.filePath);if(le)try{if((await me.promises.stat(T.filePath)).mtime.getTime()<=le.mtime){let _e=!0;for(let we of le.dependencies){if(!me.existsSync(we)){_e=!1;break}if((await me.promises.stat(we)).mtime.getTime()>le.mtime){_e=!1;break}}if(_e){let we=le.output;if(k)we=nt(we,{preserveHead:!0});let ot=F.get(T.filePath);return{route:T,content:we,status:ot?.status??await Jt(T.filePath),headers:ot?.headers}}}}catch{}let De=await N(T.filePath,de);if(De){let Me=De;if(k)Me=nt(Me,{preserveHead:!0});let _e=F.get(T.filePath);return{route:T,content:Me,status:_e?.status??await Jt(T.filePath),headers:_e?.headers}}}let Z=ie?await W(T.filePath):await Bun.file(T.filePath).text(),ce=Tn(Z),{classifyAllScripts:fe}=await import("./chunk-sb93fb2w.js"),B=fe(Z),Ae=B.server.map((le)=>le.content),Ee=Z;for(let le of B.server)Ee=Ee.replace(le.fullTag,"");let ee={__filename:T.filePath,__dirname:re.dirname(T.filePath),__stx_options:de,params:M??{},__stx_runtime_head:{}};for(let le of Ae)try{await Q(le,ee,T.filePath)}catch(De){if(t.stxOptions?.debug)console.error("[stx] variable extraction error",T.filePath,De?.message||De)}let Pe=new Set,he;if(t.profile){let le=performance.now();he=await z(Ee,ee,T.filePath,de,Pe);let De=performance.now()-le,Me=re.relative(m,T.filePath)||T.filePath;console.log(`[stx:profile] ${Me} \u2192 ${De.toFixed(2)}ms`)}else he=await z(Ee,ee,T.filePath,de,Pe);if(!k)he=await ve(he,{router:de.router});{let{interpolateScriptExpressions:le}=await import("./chunk-j58b7xen.js");he=he.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/g,(De,Me,_e)=>{if(!/function\s+__stx_setup_/.test(_e))return De;return`<script${Me}>${le(_e,ee)}</script>`})}if(k)he=nt(he,{preserveHead:!0});if(ie&&_)await J(T.filePath,he,Pe,de);let{extractStreamBoundaries:lt}=await import("./chunk-3abd3gw8.js"),Je=lt(ee),tt=ee.__streamTemplates;if(tt&&typeof tt==="object"&&Object.keys(tt).length>0){let le=ee.streamBoundaries||{},De={...de,autoShell:!1},Me=Object.keys(tt).map((we)=>({id:we,render:async()=>{let ot=typeof le[we]==="function"?await le[we]():void 0;return z(tt[we],{...ee,$boundary:ot},T.filePath,De,new Set)}})),_e=new Set(Me.map((we)=>we.id));Je=[...(Je||[]).filter((we)=>!_e.has(we.id)),...Me]}if(Je&&Je.length>0)Ce.add(T.pattern);else Je=void 0;let It=Wt(ee),Ht=qt(ee);if(_)F.set(T.filePath,{status:It,headers:Ht});return{route:T,content:he,status:It??ce,headers:Ht,boundaries:Je}}catch(z){return console.error(`${e.red}Error building ${e.bright}${T.pattern}${e.reset}:`,z),null}},He=8,Be=async()=>{let T=new Set(pe.keys()),M=new Set(I.keys());pe.clear(),I.clear();let z=t.prebuild===!1?U.filter((X)=>T.has(X.pattern)):U,Q=t.prebuild===!1?H.filter(({route:X})=>M.has(X.pattern)):H;for(let X=0;X<z.length;X+=He){let Re=z.slice(X,X+He),ve=await Promise.all(Re.map((N)=>E(N)));for(let N of ve)if(N)pe.set(N.route.pattern,N)}for(let X=0;X<Q.length;X+=He){let Re=Q.slice(X,X+He),ve=await Promise.all(Re.map(({route:N})=>E(N)));for(let N of ve)if(N)I.set(N.route.pattern,N)}return pe.size>0};if(console.log(`${e.blue}${t.prebuild===!1?"Rendering pages on request...":"Building pages..."}${e.reset}`),!(t.prebuild===!1?U.length+H.length>0:await Be()))return console.error(`${e.red}No pages were successfully built${e.reset}`),!1;await xn(m);let Xe=o;try{if(Xe=await Ve(o),Xe!==o)console.log(`${e.yellow}Port ${o} is busy, using port ${Xe} instead${e.reset}`)}catch{return console.error(`${e.red}Could not find an available port${e.reset}`),!1}if(r){let T=t.hmrPort||Xe+1;p=bt({wsPort:T,verbose:!1}),u=p.start(T)}let St=(T,M)=>{let Q=`<script data-stx-route-params>(function(){var p=${JSON.stringify(M).replace(/</g,"\\u003C").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")};window.__stx_rp=p;if(window.stx){window.stx._rp=p;if(window.stx.setRouteParams)window.stx.setRouteParams(p)}})()</script>`;if(T.includes("</head>"))return f(T,Q,"");if(T.includes("<body"))return T.replace(/<body([^>]*)>/,`<body$1>${Q}`);return Q+T};console.log(`${e.blue}Starting server...${e.reset}`);let kt=Gn({port:Xe,hostname:t.hostname,async fetch(T){let M=new URL(T.url),z=t.stxOptions?.offline??y.offline;if(M.pathname===Zo&&z?.enabled){if(!["GET","HEAD"].includes(T.method))return new Response("Method Not Allowed",{status:405,headers:{Allow:"GET, HEAD"}});return new Response(T.method==="HEAD"?null:Qo(z,vs()),{headers:{"Content-Type":"application/javascript; charset=utf-8","Cache-Control":"no-store","Service-Worker-Allowed":"/"}})}let Q=y?.publicDir||"public",X=re.join(m,Q,M.pathname),Re=re.join(m,M.pathname),ve=re.join(be,M.pathname);if([X,Re,ve].some((_)=>C(_,m,R)))return new Response("Not Found",{status:404});let[N,J,W]=await Promise.all([me.promises.stat(X).catch(()=>null),me.promises.stat(Re).catch(()=>null),me.promises.stat(ve).catch(()=>null)]);if(N?.isFile()&&!C(X,m,R))return Ot(X);if(J?.isFile()&&!C(Re,m,R))return Ot(Re);if(W?.isFile()&&!C(ve,m,R))return Ot(ve);if(M.pathname.startsWith("/_stx/component/")){let _=decodeURIComponent(M.pathname.slice(16));if(_)try{let ie=`<${_} />`,Z={...buildConfig,autoShell:!1},ce=await processDirectives(ie,{},re.join(m,"components",`${_}.stx`),Z,new Set);return new Response(ce,{headers:{"Content-Type":"text/html"}})}catch(ie){return new Response(`<div class="stx-async-error">${ie.message}</div>`,{status:500,headers:{"Content-Type":"text/html"}})}}if(M.pathname==="/_stx/img"){let{handleImageRequest:_}=await import("./chunk-53cc06w7.js"),ie=await _(T,{publicDir:re.join(m,Q),cacheDir:l(m,"cache","img")});if(ie)return ie}if(Y)try{let _=await Y.handleRequest(T);if(_.status!==404)return _}catch{}if(K[M.pathname])try{return await K[M.pathname](T)}catch(_){return new Response(JSON.stringify({error:_.message}),{status:500,headers:{"Content-Type":"application/json"}})}let ue=await O(T);if(ue)return ue;let G=Cr(M.pathname,U);if(G){let _=pe.get(G.route.pattern),ie=Ce.has(G.route.pattern);if(!_||G.route.isDynamic&&Object.keys(G.params).length>0||ie){let Z=await E(G.route,G.params);if(Z){if(_=Z,!G.route.isDynamic&&!ie)pe.set(G.route.pattern,Z)}}if(_){let Z=_.status??200,ce=_.headers??{},fe=(G.route.filePath?Rt(await Bun.file(G.route.filePath).text().catch(()=>"")):null)??{};if(fe.validate){if(!await fe.validate({params:G.params})){let Ee=await se(404);if(Ee){let ee=Ee;if(ee=await x(ee,m),r)ee=Ue(ee,u);return new Response(ee,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})}}if(fe.middleware){let Ae=jt(M.pathname,G.params,fe,M.search),Ee=Bt(Ae,null,T,{isServer:!0}),ee=await Ft(fe.middleware,Ee);if(ee.redirect){let Pe=ee.redirect.path,he=ee.redirect.options.redirectCode||302,lt=new Headers(ee.responseHeaders);return lt.set("Location",Pe),new Response(null,{status:he,headers:lt})}if(ee.abort){let{statusCode:Pe,message:he}=ee.abort.error;return new Response(`<!DOCTYPE html><html><head><title>Error ${Pe}</title></head><body><h1>Error ${Pe}</h1><p>${he}</p></body></html>`,{status:Pe,headers:{"Content-Type":"text/html"}})}if(Object.keys(ee.state).length>0){let Pe=`<script>(function(){var s=typeof stx!=='undefined'?stx:{};s._ms=${JSON.stringify(ee.state)};if(s.setMiddlewareState)s.setMiddlewareState(s._ms);})()</script>`;_.content=f(_.content,Pe,"")}}let B=_.content;if(k&&Pa(T)&&rt(B,y?.router?.container||"main")){let Ae=dt(B),Ee=Te(B),ee=B.match(/<title[^>]*>([\s\S]*?)<\/title>/i),Pe=ee?an(ee[1].trim()):"";if(Object.keys(G.params).length>0)B=St(B,G.params);B=await x(B,m);let he=y?.router?.container||"main";return B=je(B,he,!0),new Response(B,{status:Z,headers:{"Content-Type":"text/html","X-STX-Fragment":"true","X-STX-Layout":Ae.layout,"X-STX-Layout-Group":Ae.group,"X-STX-Runtime":Ee?"true":"false",...Pe&&{"X-STX-Title":encodeURIComponent(Pe)},[Tc]:vs(),...V(),"Cache-Control":Ct}})}if(k)B=is(k,B);if(Object.keys(G.params).length>0)B=St(B,G.params);if(B=await x(B,m),r)B=Ue(B,u);if(t.native)if(B.includes("<head>"))B=B.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else B="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+B;if(t.titlebarHidden)if(B.includes("<head>"))B=B.replace("<head>","<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script>");else B=`<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>${B}`;if(_.boundaries&&_.boundaries.length>0){let{renderStreamingPage:Ae,streamToResponse:Ee}=await import("./chunk-3abd3gw8.js");return Ee(Ae(B,_.boundaries,{timeoutMs:30000}),{status:Z,headers:{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}return new Response(B,{status:Z,headers:{"Content-Type":"text/html",...V(),"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0",...ce}})}}if(H.length>0){let _=H.map((Z)=>Z.route),ie=Cr(M.pathname,_);if(ie){let Z=I.get(ie.route.pattern);if(!Z||ie.route.isDynamic){let ce=await E(ie.route,ie.params);if(ce){if(Z=ce,!ie.route.isDynamic)I.set(ie.route.pattern,ce)}}if(Z){let ce=Z.content;if(k)ce=is(k,ce);if(Object.keys(ie.params).length>0)ce=St(ce,ie.params);if(ce=await x(ce,m),r)ce=Ue(ce,u);return new Response(ce,{status:Z.status??200,headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}for(let{prefix:Z}of oe)if(Z!=="/"&&M.pathname.startsWith(Z)){let ce=I.get(Z)||I.get(Z+"/");if(!ce){let fe=H.find(({route:B})=>B.pattern===Z||B.pattern===`${Z}/`);if(fe){let B=await E(fe.route);if(B)ce=B,I.set(fe.route.pattern,B)}}if(ce){let fe=ce.content;if(k)fe=is(k,fe);if(fe=await x(fe,m),r)fe=Ue(fe,u);return new Response(fe,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}}if(Nt(M.pathname))return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}});let We=pe.get("/");if(We){let _=We.content;if(_=await x(_,m),r)_=Ue(_,u);if(t.native)if(_.includes("<head>"))_=_.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else _="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+_;return new Response(_,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}let de=await se(404);if(de){let _=de;if(_=await x(_,m),r)_=Ue(_,u);return new Response(_,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})},async error(T){let M=await se(500);if(M)return new Response(M,{status:500,headers:{"Content-Type":"text/html"}});return new Response(`<pre>${T}
|
|
1006
1006
|
${T.stack}</pre>`,{headers:{"Content-Type":"text/html"}})}});if(console.clear(),console.log(`
|
|
1007
1007
|
${e.blue}stx${e.reset} ${e.green}${process.env.stx_VERSION||"v0.0.10"}${e.reset} ${e.dim}ready in ${Math.random()*10+5|0}.${Math.random()*90+10|0} ms${e.reset}`),console.log(`
|
|
1008
1008
|
${e.bright}\u2192 ${e.cyan}http://localhost:${Xe}/${e.reset}`),r)console.log(`${e.dim} HMR: ws://localhost:${u}${e.reset}`);console.log(`
|
|
1009
1009
|
${e.yellow}Routes:${e.reset}`);let Tt=[...Vs(U,m)];for(let{route:T}of H)Tt.push(`${T.pattern}`);if(Tt.forEach((T,M)=>{let Q=M===Tt.length-1?"\u2514\u2500 ":"\u251C\u2500 ";console.log(` ${e.green}${Q}${e.reset}${T}`)}),console.log(`
|
|
1010
|
-
Press ${e.cyan}h${e.reset} + ${e.cyan}Enter${e.reset} to show shortcuts`),qe(kt.url.toString(),()=>{if(p)st();kt.stop()}),t.native){let T,M=re.join(A,"index.stx");if(me.existsSync(M)){let Q=await Bun.file(M).text();T=gt(Q)}let z=y?.app?.window??{};await Ye(Xe,{title:y?.app?.head?.title||re.basename(m)||"stx App",width:z.width,height:z.height,darkMode:z.darkMode,hotReload:z.hotReload,titlebarHidden:z.titlebarHidden??t.titlebarHidden===!0,nativeSidebar:!!T,sidebarConfig:T})}if(d){console.log(`${e.blue}Watching for changes...${e.reset}`);let T=(N)=>N.startsWith("public/")||N.startsWith("public\\"),M=(N)=>{let J=N.toLowerCase();return J.endsWith(".stx")||J.endsWith(".html")||J.endsWith(".md")},z=new Map,Q=()=>{let N=new Set([m,...y._layerGraph?.layers.map((J)=>J.root)??[],...y._layerGraph?.configDependencies.map((J)=>re.dirname(J))??[]].filter((J)=>me.existsSync(J)).map((J)=>me.realpathSync(J)));for(let J of y._layerGraph?.layers??[])for(let W of Object.values(J.resources)){if(!me.existsSync(W))continue;let ue=me.realpathSync(W);if(![...N].some((G)=>ue===G||ue.startsWith(`${G}${re.sep}`)))N.add(ue)}for(let[J,W]of z)if(!N.has(J))W.close(),z.delete(J);for(let J of N)if(!z.has(J)&&me.existsSync(J))z.set(J,me.watch(J,{recursive:!0},(W,ue)=>{Re(J,W,ue).catch((G)=>console.error("[stx] Layer rebuild failed:",G))}))},X=Promise.resolve(),Re=(N,J,W)=>(X=X.catch(()=>{}).then(()=>ve(N,J,W)),X),ve=async(N,J,W)=>{if(!W||xt(W))return;if(yt(W)){if(y._layerGraph){let ue=await b(m);Object.assign(y,ue),U.splice(0,U.length,...ne(w,{pagesDir:S,pagesDirs:ue._layerPageDirs?[A,...ue._layerPageDirs.slice(1)]:void 0})),Q()}if(T(W)){if(console.log(`${e.cyan}${W} changed${e.reset}`),r&&p)p.reload(W)}else if(M(W)){console.log(`${e.yellow}${W} changed, rebuilding...${e.reset}`),at.clear(),ke();try{let{invalidateFileCache:ue,templateCache:G}=await import("./chunk-
|
|
1010
|
+
Press ${e.cyan}h${e.reset} + ${e.cyan}Enter${e.reset} to show shortcuts`),qe(kt.url.toString(),()=>{if(p)st();kt.stop()}),t.native){let T,M=re.join(A,"index.stx");if(me.existsSync(M)){let Q=await Bun.file(M).text();T=gt(Q)}let z=y?.app?.window??{};await Ye(Xe,{title:y?.app?.head?.title||re.basename(m)||"stx App",width:z.width,height:z.height,darkMode:z.darkMode,hotReload:z.hotReload,titlebarHidden:z.titlebarHidden??t.titlebarHidden===!0,nativeSidebar:!!T,sidebarConfig:T})}if(d){console.log(`${e.blue}Watching for changes...${e.reset}`);let T=(N)=>N.startsWith("public/")||N.startsWith("public\\"),M=(N)=>{let J=N.toLowerCase();return J.endsWith(".stx")||J.endsWith(".html")||J.endsWith(".md")},z=new Map,Q=()=>{let N=new Set([m,...y._layerGraph?.layers.map((J)=>J.root)??[],...y._layerGraph?.configDependencies.map((J)=>re.dirname(J))??[]].filter((J)=>me.existsSync(J)).map((J)=>me.realpathSync(J)));for(let J of y._layerGraph?.layers??[])for(let W of Object.values(J.resources)){if(!me.existsSync(W))continue;let ue=me.realpathSync(W);if(![...N].some((G)=>ue===G||ue.startsWith(`${G}${re.sep}`)))N.add(ue)}for(let[J,W]of z)if(!N.has(J))W.close(),z.delete(J);for(let J of N)if(!z.has(J)&&me.existsSync(J))z.set(J,me.watch(J,{recursive:!0},(W,ue)=>{Re(J,W,ue).catch((G)=>console.error("[stx] Layer rebuild failed:",G))}))},X=Promise.resolve(),Re=(N,J,W)=>(X=X.catch(()=>{}).then(()=>ve(N,J,W)),X),ve=async(N,J,W)=>{if(!W||xt(W))return;if(yt(W)){if(y._layerGraph){let ue=await b(m);Object.assign(y,ue),U.splice(0,U.length,...ne(w,{pagesDir:S,pagesDirs:ue._layerPageDirs?[A,...ue._layerPageDirs.slice(1)]:void 0})),Q()}if(T(W)){if(console.log(`${e.cyan}${W} changed${e.reset}`),r&&p)p.reload(W)}else if(M(W)){console.log(`${e.yellow}${W} changed, rebuilding...${e.reset}`),at.clear(),ke();try{let{invalidateFileCache:ue,templateCache:G}=await import("./chunk-4adb8bmp.js");ue(re.resolve(N,W)),G.delete(re.resolve(N,W))}catch{}if(P&&W){if(re.resolve(N,W)===P||re.basename(P)===W){let G=await Oo(P,t.stxOptions||{});if(G)k=G}}if(await Be(),await yr(m),r&&p)p.reload(W)}else{console.log(`${e.yellow}${W} changed, rebuilding...${e.reset}`),at.clear(),ke();try{let{invalidateFileCache:ue,templateCache:G}=await import("./chunk-4adb8bmp.js");ue(re.resolve(N,W)),G.delete(re.resolve(N,W))}catch{}if(await Be(),r&&p)p.reload(W)}}else if(ht(W)){if(console.log(`${e.cyan}CSS ${W} changed${e.reset}`),r&&p)p.updateCss(W)}};Q(),process.on("SIGINT",()=>{for(let N of z.values())N.close();if(p)st();kt.stop(),process.exit(0)})}return!0}import At from"fs";import it from"path";async function Jn(n){try{let o=(await Bun.file(n).text()).match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(!o)return[];let d=o[1],r=[],p=/\/\*\*\s*([\s\S]*?)\s*\*\/\s*(?:(?:const|let|var)\s*)?(?:([\w$]+)\s*=|module\.exports\.([\w$]+)\s*=|\s*([\w$]+)\s*:)/g,u;while((u=p.exec(d))!==null){let m=u[1],b=u[2]||u[3]||u[4];if(!b)continue;let y={name:b},v=m.match(/@type\s+\{([^}]+)\}/i);if(v)y.type=v[1].trim();if(m.match(/@required/i))y.required=!0;let R=m.match(/@default\s+(.+?)(?:\s+|$)/i);if(R)y.default=R[1].trim();let O=m.split(`
|
|
1011
1011
|
`).map((w)=>w.trim().replace(/^\*\s*/,"")).filter((w)=>!w.startsWith("@")&&w.length>0);y.description=O.join(" ").trim(),r.push(y)}if(r.length===0){let m=d.match(/module\.exports\s*=\s*\{([^}]+)\}/i);if(m){let y=m[1].split(",").map((v)=>v.trim()).filter(Boolean);for(let v of y){let[C]=v.split(":").map((R)=>R.trim());if(C)r.push({name:C})}}}return r}catch(t){return console.error(`Error extracting props from ${n}:`,t),[]}}async function Yn(n){try{let t=await Bun.file(n).text(),o=t.match(/^\s*<!--\s*([\s\S]*?)\s*-->/)||t.match(/^\s*\/\*\*\s*([\s\S]*?)\s*\*\//);if(o)return o[1].split(`
|
|
1012
1012
|
`).map((d)=>d.trim().replace(/^\*\s*/,"")).join(" ").trim();return""}catch{return""}}async function Qn(n,t=!1,o){let d=it.basename(n,".stx"),r=await Jn(n),p=await Yn(n),u="";if(t&&o)u=`<${o}></${o}>`;else{let m=r.map((b)=>{if(b.type==="boolean")return`:${b.name}="true"`;return`${b.name}="value"`}).join(`
|
|
1013
1013
|
`);u=`<${d}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{yi,bi,wi,vi,js,Bs,vy,xy,Sy,ky,Fs,_y}from"./chunk-
|
|
2
|
+
import{yi,bi,wi,vi,js,Bs,vy,xy,Sy,ky,Fs,_y}from"./chunk-0rdh8bw3.js";import"./chunk-295bykzd.js";import"./chunk-s29hp1qw.js";export{_y as generateDefaultRobotsTxt,Fs as generateRobotsTxt,xy as generateSitemap,Sy as generateSitemapIndex,vi as injectSeoTags,js as metaDirective,yi as processMetaDirectives,wi as processSeoDirective,bi as processStructuredData,vy as registerSeoDirectives,ky as scanForSitemapEntries,Bs as structuredDataDirective};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Es,lg,si,ug}from"./chunk-a852vdv3.js";import"./chunk-d2pexm3z.js";import"./chunk-22mdphq2.js";import"./chunk-whmk0m8x.js";import"./chunk-cb0c6959.js";import"./chunk-0k7khseq.js";import"./chunk-qxthb2a1.js";import"./chunk-h63ma36g.js";import"./chunk-ssg6ne5b.js";import"./chunk-0rdh8bw3.js";import"./chunk-agd2b928.js";import{Vt}from"./chunk-3jndqseh.js";import"./chunk-c3413bgh.js";import"./chunk-6t04tqvh.js";import"./chunk-295bykzd.js";import"./chunk-hxhmhw23.js";import"./chunk-a60ztvnp.js";import"./chunk-s29hp1qw.js";import"./chunk-00tq7ghn.js";export{ug as declareBareLoopHead,Vt as parseLoopBinding,lg as processLoops,si as processLoopsAsync,Es as reportDeferredLoopWarnings};
|