@stacksjs/stx 0.2.418 → 0.2.420
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-3senpdjt.js → chunk-014gmm8w.js} +2 -2
- package/dist/{chunk-wweasgq9.js → chunk-09hhrjk9.js} +6 -6
- package/dist/chunk-0n76c3g8.js +2 -0
- package/dist/{chunk-w5zmvn7b.js → chunk-0varh725.js} +3 -3
- package/dist/{chunk-wpkxbggq.js → chunk-0y7x0hvr.js} +1 -1
- package/dist/{chunk-9r5ycpdg.js → chunk-10967rws.js} +3 -3
- package/dist/chunk-10fh9qhe.js +2 -0
- package/dist/{chunk-xvn3sv3v.js → chunk-11ra3sbc.js} +3 -3
- package/dist/{chunk-e83j8xe9.js → chunk-12b8akfg.js} +4 -4
- package/dist/{chunk-68rq2fqt.js → chunk-1336h4sv.js} +1 -1
- package/dist/chunk-18awnp9d.js +2 -0
- package/dist/{chunk-hm2k9a04.js → chunk-20tdz0zs.js} +7 -7
- package/dist/{chunk-mj9yv1vb.js → chunk-21a7p956.js} +1 -1
- package/dist/{chunk-5fwy3xap.js → chunk-2ewa2sg5.js} +3 -3
- package/dist/chunk-2hswgxpb.js +2 -0
- package/dist/{chunk-g947brd0.js → chunk-2tfe2g58.js} +6 -6
- package/dist/{chunk-0xgf3xgy.js → chunk-32y3767j.js} +7 -7
- package/dist/{chunk-3wmxb126.js → chunk-34gy5zjm.js} +2 -2
- package/dist/{chunk-hg3tyzn5.js → chunk-3kmhv1kf.js} +11 -11
- package/dist/{chunk-yrbzsrde.js → chunk-3ynkg5dz.js} +2 -2
- package/dist/chunk-3zye6eh1.js +2 -0
- package/dist/chunk-4488r5j1.js +2 -0
- package/dist/chunk-4amznxaq.js +2 -0
- package/dist/{chunk-vepc9rbt.js → chunk-4e101kjp.js} +2 -2
- package/dist/{chunk-psmdbcbc.js → chunk-4mew0ae3.js} +3 -3
- package/dist/{chunk-865xvpp2.js → chunk-4n6c5rp5.js} +2 -2
- package/dist/chunk-5akd7qsb.js +2 -0
- package/dist/chunk-5eqd40k0.js +2 -0
- package/dist/{chunk-dw961rvn.js → chunk-5vfyxxrp.js} +2 -2
- package/dist/{chunk-7q1yy18q.js → chunk-62r4fa4q.js} +2 -2
- package/dist/{chunk-76japd6k.js → chunk-66k7yxnr.js} +4 -4
- package/dist/{chunk-jgsgd6rt.js → chunk-6aqcgrhw.js} +5 -5
- package/dist/chunk-6r9y4p81.js +2 -0
- package/dist/{chunk-bk5ndwv3.js → chunk-757ec865.js} +2 -2
- package/dist/chunk-75zcwcrt.js +2 -0
- package/dist/{chunk-xwkdv585.js → chunk-802pr252.js} +2 -2
- package/dist/chunk-89e1d0rz.js +4 -0
- package/dist/{chunk-ev8bhsc0.js → chunk-8drvzsk1.js} +2 -2
- package/dist/{chunk-y9t55tv7.js → chunk-8j8k27xb.js} +6 -6
- package/dist/{chunk-q8swb7na.js → chunk-8jqy69td.js} +3 -3
- package/dist/chunk-8nsqac4z.js +2 -0
- package/dist/chunk-8ttvazck.js +2 -0
- package/dist/{chunk-sjjc670z.js → chunk-8vq0qjq9.js} +9 -9
- package/dist/chunk-8y4bqsxz.js +2 -0
- package/dist/{chunk-v15g9jjh.js → chunk-a4r19yxm.js} +6 -6
- package/dist/chunk-ac033b93.js +2 -0
- package/dist/chunk-aj43359g.js +2 -0
- package/dist/chunk-aj8yq228.js +2 -0
- package/dist/{chunk-vyfg2qd2.js → chunk-ap6fehea.js} +5 -5
- package/dist/chunk-as72dvvm.js +2 -0
- package/dist/{chunk-ka8x4sw6.js → chunk-awtrcb5m.js} +5 -5
- package/dist/chunk-ax58cds3.js +5 -0
- package/dist/{chunk-qmzwhtr2.js → chunk-aync8qmk.js} +2 -2
- package/dist/chunk-b01jqb5f.js +2 -0
- package/dist/{chunk-3aqe7wy7.js → chunk-b1fg9vg7.js} +2 -2
- package/dist/chunk-b7z2yegr.js +2 -0
- package/dist/chunk-bfvaxrq0.js +2 -0
- package/dist/{chunk-jfjym18d.js → chunk-bh4x090w.js} +3 -3
- package/dist/chunk-bkaw7sgz.js +2 -0
- package/dist/chunk-bmk0s261.js +2 -0
- package/dist/chunk-bvbank3z.js +2 -0
- package/dist/{chunk-bt11a8z4.js → chunk-csjw5esc.js} +3 -3
- package/dist/chunk-cvzkbsds.js +2 -0
- package/dist/{chunk-d6h9rpm4.js → chunk-cw6j75ck.js} +5 -5
- package/dist/chunk-d2c5727w.js +2 -0
- package/dist/chunk-d5amzers.js +2 -0
- package/dist/{chunk-kds79hq3.js → chunk-debz86rr.js} +10 -10
- package/dist/chunk-dfchrqw5.js +2 -0
- package/dist/{chunk-47h689h6.js → chunk-dhxbjw6k.js} +2 -2
- package/dist/chunk-dscsvkfa.js +2 -0
- package/dist/chunk-eav0pt6d.js +2 -0
- package/dist/{chunk-9yt899e7.js → chunk-ep5jnqdb.js} +6 -6
- package/dist/{chunk-e2m674vf.js → chunk-g1fxmp9z.js} +4 -4
- package/dist/{chunk-h8f18cc5.js → chunk-h1h6xe1k.js} +5 -5
- package/dist/chunk-hahzjyxc.js +2 -0
- package/dist/chunk-hgqcqg1h.js +2 -0
- package/dist/chunk-hjdwf9gp.js +2 -0
- package/dist/{chunk-94ky725r.js → chunk-hjp990p8.js} +2 -2
- package/dist/{chunk-d0ynfema.js → chunk-hy9e3ny6.js} +1 -1
- package/dist/{chunk-9bq4w4d6.js → chunk-hyak4dzg.js} +3 -3
- package/dist/chunk-j9aberz0.js +2 -0
- package/dist/chunk-jjm0ekw8.js +2 -0
- package/dist/chunk-jjnfj9nf.js +3 -0
- package/dist/chunk-jjtzm6dn.js +3 -0
- package/dist/chunk-k1am0dyg.js +2 -0
- package/dist/{chunk-c8p4v1rd.js → chunk-k31fwm2w.js} +5 -5
- package/dist/{chunk-5vzamjf6.js → chunk-kea18wnc.js} +3 -3
- package/dist/{chunk-pb0fgdvn.js → chunk-kjkwycce.js} +4 -4
- package/dist/{chunk-85bm5xrm.js → chunk-krr2vb0s.js} +3 -3
- package/dist/{chunk-3f5td68v.js → chunk-m16h8ea0.js} +2 -2
- package/dist/chunk-m2jphkdv.js +2 -0
- package/dist/{chunk-25n4gmek.js → chunk-mg13q1kd.js} +2 -2
- package/dist/chunk-mk7b3qdz.js +2 -0
- package/dist/chunk-ncvfjcr2.js +2 -0
- package/dist/chunk-p083sckk.js +2 -0
- package/dist/chunk-p7b17yr0.js +2 -0
- package/dist/chunk-pc178389.js +2 -0
- package/dist/{chunk-gfm7g98y.js → chunk-pzngjk81.js} +39 -39
- package/dist/chunk-q1v0jwr4.js +2 -0
- package/dist/{chunk-fr8jq2ys.js → chunk-qby6wxat.js} +2 -2
- package/dist/{chunk-dym1eteb.js → chunk-qx3js9tk.js} +1 -1
- package/dist/{chunk-ayd5r3se.js → chunk-qxre7vw6.js} +2 -2
- package/dist/chunk-r5gjb55x.js +2 -0
- package/dist/{chunk-vfdwvt23.js → chunk-r8wze9ym.js} +2 -2
- package/dist/{chunk-1680nbq4.js → chunk-rj3hyqff.js} +302 -301
- package/dist/chunk-rj8rdd8n.js +2 -0
- package/dist/{chunk-wgzxmh7w.js → chunk-rsxvbnp4.js} +3 -3
- package/dist/chunk-s0pmn48x.js +2 -0
- package/dist/chunk-s58yz9q0.js +2 -0
- package/dist/chunk-srdzwtsq.js +2 -0
- package/dist/{chunk-vdqa5gt7.js → chunk-tafebmtg.js} +2 -2
- package/dist/chunk-tf44jyrh.js +2 -0
- package/dist/chunk-tfypkw4y.js +3 -0
- package/dist/{chunk-hkxxfzfd.js → chunk-th9s15es.js} +2 -2
- package/dist/{chunk-xt6d3zws.js → chunk-tqnysw0k.js} +4 -4
- package/dist/{chunk-5f3k2mke.js → chunk-tspmynvh.js} +1 -1
- package/dist/chunk-vwxasbtx.js +2 -0
- package/dist/{chunk-08p07eq7.js → chunk-wg1ttvs5.js} +2 -2
- package/dist/chunk-wynvh7dc.js +2 -0
- package/dist/{chunk-fxhvkenf.js → chunk-x5ks23vx.js} +2 -2
- package/dist/chunk-x8rckpyz.js +2 -0
- package/dist/{chunk-9af8qbwb.js → chunk-xvzxrt9a.js} +5 -5
- package/dist/chunk-y4xs4m7p.js +2 -0
- package/dist/chunk-y8rpk1b9.js +2 -0
- package/dist/chunk-y9m93qkk.js +2 -0
- package/dist/chunk-ya9c8nec.js +2 -0
- package/dist/chunk-yvq1f313.js +2 -0
- package/dist/chunk-yy3dgwfm.js +2 -0
- package/dist/{chunk-mj6fme15.js → chunk-z0ck9t6j.js} +5 -5
- package/dist/{chunk-072mzamc.js → chunk-z521cyfv.js} +5 -5
- package/dist/chunk-zpcz2kh6.js +2 -0
- package/dist/{chunk-kkj5x9rp.js → chunk-zvh2nnzr.js} +1 -1
- package/dist/cli.js +21 -21
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/dev-server/ts-css.js +2 -2
- package/dist/head-keys.d.ts +41 -0
- package/dist/head-keys.js +78 -0
- package/dist/head.js +2 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/native/runtime/craft.d.ts +1 -0
- package/dist/process.js +2 -1
- package/dist/production-builder.js +2 -1
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +15 -15
- package/dist/ts-css-config.d.ts +21 -0
- package/dist/ts-css-config.js +12 -4
- package/dist/variable-extractor.js +2 -1
- package/package.json +5 -5
- package/dist/chunk-072f6hnz.js +0 -2
- package/dist/chunk-0x076wz1.js +0 -2
- package/dist/chunk-2gfj59pt.js +0 -2
- package/dist/chunk-2gntnw7e.js +0 -2
- package/dist/chunk-2hvvwhmv.js +0 -2
- package/dist/chunk-31a8eh0j.js +0 -5
- package/dist/chunk-4bhertga.js +0 -2
- package/dist/chunk-4s9dypby.js +0 -2
- package/dist/chunk-5z56g0n4.js +0 -2
- package/dist/chunk-6ad0nseq.js +0 -2
- package/dist/chunk-7eazcxzf.js +0 -2
- package/dist/chunk-7hy29tcy.js +0 -2
- package/dist/chunk-8fyqbq14.js +0 -2
- package/dist/chunk-92xzpt6p.js +0 -2
- package/dist/chunk-9kmmafp4.js +0 -2
- package/dist/chunk-atgwc7r7.js +0 -2
- package/dist/chunk-bs6y5wy2.js +0 -2
- package/dist/chunk-ccg6xjr1.js +0 -2
- package/dist/chunk-ckv4aty5.js +0 -2
- package/dist/chunk-dbh7h0kt.js +0 -2
- package/dist/chunk-dhqkg0ph.js +0 -2
- package/dist/chunk-ettat5ah.js +0 -2
- package/dist/chunk-f4ws0qcd.js +0 -2
- package/dist/chunk-f97v10zr.js +0 -2
- package/dist/chunk-fe5st320.js +0 -2
- package/dist/chunk-fet3hce8.js +0 -2
- package/dist/chunk-fq7128p1.js +0 -2
- package/dist/chunk-fwy2h1ms.js +0 -2
- package/dist/chunk-gtkhykc4.js +0 -2
- package/dist/chunk-h8pkm7c5.js +0 -2
- package/dist/chunk-hneg0155.js +0 -2
- package/dist/chunk-hs90en70.js +0 -2
- package/dist/chunk-jn3njpxs.js +0 -2
- package/dist/chunk-mcqn70v8.js +0 -3
- package/dist/chunk-mcs7p3fy.js +0 -2
- package/dist/chunk-mmtg0jxd.js +0 -2
- package/dist/chunk-mrsxwd0h.js +0 -2
- package/dist/chunk-mscky0ww.js +0 -2
- package/dist/chunk-mtphm33a.js +0 -2
- package/dist/chunk-p2jbc71s.js +0 -2
- package/dist/chunk-pvd9k3kx.js +0 -2
- package/dist/chunk-pz1jc3db.js +0 -2
- package/dist/chunk-qvr6e2ve.js +0 -3
- package/dist/chunk-ra0pkkvd.js +0 -2
- package/dist/chunk-rcbtd4w3.js +0 -2
- package/dist/chunk-rd2r9jvn.js +0 -2
- package/dist/chunk-s8srb8bg.js +0 -2
- package/dist/chunk-snf2b68p.js +0 -2
- package/dist/chunk-t2bfwr9v.js +0 -2
- package/dist/chunk-tbmwdahm.js +0 -2
- package/dist/chunk-vpv896zx.js +0 -2
- package/dist/chunk-w6h63b48.js +0 -2
- package/dist/chunk-wrk3gkgg.js +0 -2
- package/dist/chunk-wtd71jsa.js +0 -2
- package/dist/chunk-wymf1ek6.js +0 -2
- package/dist/chunk-wz8hyh8h.js +0 -4
- package/dist/chunk-x32wpjs0.js +0 -2
- package/dist/chunk-x4q2eyt0.js +0 -2
- package/dist/chunk-x95ejws0.js +0 -2
- package/dist/chunk-xket8ejt.js +0 -2
- package/dist/chunk-ypfzy1mq.js +0 -2
- package/dist/chunk-zg68pwy8.js +0 -2
- package/dist/chunk-zs58fnme.js +0 -2
- package/dist/chunk-zy3p0vmx.js +0 -3
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{y,
|
|
2
|
+
import{y,Oe,I,Jt,i,T}from"./chunk-rj3hyqff.js";import{zr}from"./chunk-z0ck9t6j.js";import{s,be}from"./chunk-12b8akfg.js";import{a}from"./chunk-tfypkw4y.js";import f from"path";import b from"fs";function de(e){if(!e||typeof e!=="object")return!1;let t=e;return typeof t.message==="string"&&(t.name==="BuildMessage"||t.name==="ResolveMessage"||("position"in t))}function pe(e){if(e&&typeof e==="object"&&Array.isArray(e.errors))return e.errors;return[e]}function z(e,t){let r=[];for(let l of pe(e)){if(de(l)){let u=l.position||void 0;r.push({file:t||u?.file,line:u?.line,column:u?.column,message:l.message??"",lineText:u?.lineText});continue}r.push({file:t,message:l instanceof Error?l.message:String(l)})}return r}function Ie(e,t){return z(e,t).map((r)=>{let l=r.file?`${r.file}${r.line?`:${r.line}${r.column?`:${r.column}`:""}`:""}`:"",u=r.lineText?`
|
|
3
3
|
${r.lineText.trim()}`:"";return l?`${l}: ${r.message}${u}`:`${r.message}${u}`}).join(`
|
|
4
|
-
`)}var me=9;function J(e,t,r){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(f.basename(e))||
|
|
5
|
-
export { ${[..._].join(", ")} }`:"";await Bun.write(m,e+ie),F("bundling:",d,"from:",f.basename(t));let Z=new Set,Y=new Map;try{let j=await Bun.build({entrypoints:[m],outdir:w,target:"browser",format:"esm",minify:u,plugins:[xe(l,N,m,Z,c,Y,r.serverApi)],define:{"process.env.NODE_ENV":u?'"production"':'"development"',...y()},root:l});if(!j.success){let R=j.logs.filter((C)=>C.level==="error").map((C)=>C.message).join(", ")||`Unable to bundle ${f.basename(t)}`,L=z(j.logs,t||void 0);if(console.warn("[stx:bundler] build failed:",R)
|
|
4
|
+
`)}var me=9;function J(e,t,r){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(f.basename(e))||zr(e,t,r)}var re=1,se=new Map,P=600,fe=100,V=new Map;async function ge(e){let t=V.get(e)??0;if(t>0&&t<fe){V.set(e,t+1);return}V.set(e,1);try{let r=(await b.promises.readdir(e)).filter((p)=>p.endsWith(".js"));if(r.length<=P)return;let u=(await Promise.all(r.map(async(p)=>{try{return{name:p,at:(await b.promises.stat(f.join(e,p))).mtimeMs}}catch{return null}}))).filter((p)=>p!==null);u.sort((p,d)=>d.at-p.at);for(let p of u.slice(P)){let d=p.name.slice(0,-3);await b.promises.rm(f.join(e,`${d}.js`),{force:!0}),await b.promises.rm(f.join(e,`${d}.deps.json`),{force:!0})}F("pruned bundle cache to",P,"entries")}catch{}}function oe(e){return se.get(e)??[]}function G(e,t){if(e)se.set(e,t)}function Aa(e=process.env){return e.STX_DEBUG==="true"||e.STX_DEBUG==="1"}function F(...e){if(Aa())console.log("[stx:bundler]",...e)}var q=[];function _i(e,t,r){q.push({filePath:e||"<inline>",message:t,details:r})}function pt(){return q.slice()}function ft(){q.length=0}var X;function du(e){X=e}function Ri(){if(X)return X;try{let e=T.strict;return typeof e==="object"&&e!==null?e.bundlerFallback??"warn":"warn"}catch{return"warn"}}var ee=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function gt(e){let t=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,r;while((r=t.exec(e))!==null){let u=r[1];if(!ee.some((d)=>d.test(u)))return F("detected user import:",u),!0}let l=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((r=l.exec(e))!==null){let u=r[1];if(/\.css(?:\?.*)?$/.test(u))continue;if(!ee.some((d)=>d.test(u)))return F("detected side-effect import:",u),!0}return!1}var Gt="stx-module:",he=/\.(?:[cm]?[jt]sx?|json)$/i;function Pa(e,t){return f.relative(e,t).split(f.sep).join("/")}function Ia(e,t){if(t.size===0)return e;return e.replace(/^([ \t]*import\s+(?:[^;"']*?\s+from\s+)?)(["'])([^"']+)\2/gm,(r,l,u,p)=>{let d=t.get(p);return d&&!p.startsWith(Gt)?`${l}${u}${d}${u}`:r})}function Da(e,t){let r=0,l=(p)=>{let d=`__stxMod${r++}`,x=JSON.stringify(p);return t.push(`var ${d} = globalThis.__stxModules && globalThis.__stxModules[${x}];`,`if (${d} === undefined) throw new Error("[stx] module " + ${JSON.stringify(x)} + " is not registered on this page (#1957)");`),d},u=(p,d)=>{for(let x of p.split(",")){let v=x.trim();if(!v)continue;let c=v.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!c)continue;let n=c[1].startsWith('"')?JSON.parse(c[1]):c[1],o=c[2]??n;t.push(`var ${o} = ${d}[${JSON.stringify(n)}];`)}};return e=e.replace(/^[ \t]*import\s+([^;"']*?)\s+from\s+["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,d,x)=>{let v=x.slice(Gt.length),c=l(v),n=d.trim(),o=n.match(/^([\w$]+)\s*(?:,\s*|$)/);if(o&&!n.startsWith("{")&&!n.startsWith("*"))t.push(`var ${o[1]} = ${c}.default;`),n=n.slice(o[0].length).trim();let m=n.match(/^\*\s*as\s+([\w$]+)$/);if(m)t.push(`var ${m[1]} = ${c};`);else if(n.startsWith("{"))u(n.replace(/^\{|\}$/g,""),c);return""}),e=e.replace(/^[ \t]*import\s+["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,d)=>(l(d.slice(Gt.length)),"")),e}function te(e){let t=[e,`${e}.ts`,`${e}.tsx`,`${e}.js`,`${e}.mjs`,`${e}.jsx`,f.join(e,"index.ts"),f.join(e,"index.tsx"),f.join(e,"index.js"),f.join(e,"index.mjs")];for(let r of t)try{if(b.existsSync(r)&&b.statSync(r,{throwIfNoEntry:!1})?.isFile())return r}catch{}return}function xe(e,t,r,l,u,p=new Map,d){let x=(c,n,o)=>{if(J(n,e,d))return null;if(!u||c!==r||!he.test(n))return null;try{if(!b.statSync(n,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}l.add(n);let m=`${Gt}${Pa(process.cwd(),n)}`;return p.set(o,m),{path:m,external:!0}},v=(c,n)=>{let o=c===r?t:f.dirname(c),m=f.resolve(o,n);return te(m)??m};return{name:"stx-client-bundle",setup(c){if(c.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(n)=>({path:n.path,external:!0})),c.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(n)=>({path:n.path,external:!0})),c.onResolve({filter:/^\//},(n)=>{let o=te(n.path);if(o){let m=x(n.importer,o,n.path);if(m)return m;if(o!==r)l.add(o);return{path:o}}return{path:n.path,external:!0}}),c.onResolve({filter:/^\.\.?\//},(n)=>{let o=v(n.importer,n.path),m=x(n.importer,o,n.path);if(m)return m;return l.add(o),{path:o}}),c.onResolve({filter:/^[@~]\//},(n)=>{let o=f.resolve(e,n.path.slice(2)),m=[o,`${o}.ts`,`${o}.tsx`,`${o}.js`,`${o}.mjs`,`${o}.jsx`,f.join(o,"index.ts"),f.join(o,"index.tsx"),f.join(o,"index.js"),f.join(o,"index.mjs")];for(let w of m)if(b.existsSync(w)&&b.statSync(w,{throwIfNoEntry:!1})?.isFile()){let N=x(n.importer,w,n.path);if(N)return N;return F(`resolved ${n.path[0]}/ import:`,n.path,"\u2192",w),l.add(w),{path:w}}return console.warn(`[stx:bundler] could not resolve ${n.path[0]}/ import:`,n.path),{path:o}}),u)c.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(n)=>{if(n.importer!==r)return;let o=`${Gt}npm:${n.path}`;return p.set(n.path,o),{path:o,external:!0}});c.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(n)=>{if(J(n.path,e,d))throw Error(`Server-only API source cannot be imported by a client script: ${n.path}`);let o=f.extname(n.path).toLowerCase(),m=o===".json"?"json":o===".tsx"?"tsx":o===".jsx"?"jsx":o===".ts"||o===".mts"||o===".cts"?"ts":"js";if(n.path!==r)l.add(n.path);return{contents:b.readFileSync(n.path,"utf8"),loader:m}})}}}var W=new Map,O=I(64),ne=Symbol.for("stx.client-bundle-build-queue");function Oa(e){let t=globalThis,l=(t[ne]??Promise.resolve()).then(e,e);return t[ne]=l.then(()=>{return},()=>{return}),l}async function mt(e,t,r={}){let l=r.projectRoot||process.cwd(),u=(await i(l)).serverApi,p=r.minify??!1,d=r.externalizeUserModules??!0,x=r.cacheDir||a(l,"bundle-cache"),v=new Bun.CryptoHasher("md5");v.update(`${me}\x00${Oe()}\x00${JSON.stringify(u??!1)}\x00${d?"registry":"inline"}\x00${e}\x00${t}`);let c=v.digest("hex").slice(0,12),n=f.join(x,`${c}.js`),o=O.get(n);if(o){if(Jt(o.files)&&o.files.every((E)=>!J(E.path,l,u))){F("memo hit:",c);let E=o.files.map((S)=>S.path);return G(t,E),r.collectInputs?.push(...E),o.code}O.delete(n),F("memo invalidated by dep change:",c)}let m=f.join(x,`${c}.deps.json`),w=Bun.file(n);if(await w.exists()){let E=Bun.file(m),S=!1,B=null;if(await E.exists())try{let D=JSON.parse(await E.text());if(D.metadataVersion!==re||!Array.isArray(D.files))S=!1;else B=D.files,S=!0;if(B&&(!Jt(B)||B.some((k)=>J(k.path,l,u))))S=!1}catch{S=!1}if(S){if(F("cache hit:",c),B)G(t,B.map((k)=>k.path)),r.collectInputs?.push(...B.map((k)=>k.path));let D=await w.text();if(B)O.set(n,{code:D,files:B});return D}F("cache invalidated by dep change:",c)}let N=W.get(c);if(N){let E=await N;if(r.collectInputs)r.collectInputs.push(...(O.get(n)?.files??[]).map((S)=>S.path));return E}let _=Oa(()=>ye(e,t,{projectRoot:l,minify:p,cacheDir:x,hash:c,cachePath:n,depsPath:m,collectInputs:r.collectInputs,externalizeUserModules:d,serverApi:u}));W.set(c,_);try{return await _}finally{W.delete(c)}}var $e=0;function Ma(e){return`${e}-${process.pid}-${++$e}`}async function ye(e,t,r){let{projectRoot:l,minify:u,cacheDir:p,hash:d,cachePath:x,depsPath:v,externalizeUserModules:c}=r,n=a(l,"bundle-tmp"),o=Ma(d),m=f.join(n,`${o}.ts`),w=f.join(n,"out",o);b.mkdirSync(n,{recursive:!0}),b.mkdirSync(w,{recursive:!0});let N=f.dirname(t),_=new Set,E=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,S=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,B=s(e),{depths:D,balanced:k}=be(B),H=(j)=>!k||D[j]===0,M;while((M=E.exec(B))!==null){if(M[1])continue;if(!H(M.index))continue;if(M[2])M[2].split(",").forEach((j)=>{let h=we(j);if(h)_.add(h)});else if(M[3])_.add(M[3])}while((M=S.exec(B))!==null){if(M[1])continue;if(!H(M.index))continue;_.add(M[2])}let ie=_.size>0?`
|
|
5
|
+
export { ${[..._].join(", ")} }`:"";await Bun.write(m,e+ie),F("bundling:",d,"from:",f.basename(t));let Z=new Set,Y=new Map;try{let j=await Bun.build({entrypoints:[m],outdir:w,target:"browser",format:"esm",minify:u,plugins:[xe(l,N,m,Z,c,Y,r.serverApi)],define:{"process.env.NODE_ENV":u?'"production"':'"development"',...y()},root:l});if(!j.success){let R=j.logs.filter((C)=>C.level==="error").map((C)=>C.message).join(", ")||`Unable to bundle ${f.basename(t)}`,L=z(j.logs,t||void 0);if(console.warn("[stx:bundler] build failed:",R),_i(t||"",R,L),Ri()==="error")throw Error(R);return e}let h="";for(let g of j.outputs){h=await g.text();break}let A=[];for(let g of h.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let R of g[1].split(",")){let L=R.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(L){A.push([L[2],L[1]]);continue}let C=R.trim();if(/^[A-Za-z_$][\w$]*$/.test(C))A.push([C,C])}let Q=[];h=Da(Ia(h,Y),Q);let ae=h.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];h=h.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let K=`__stxBundle_${d}`,le=A.map(([g,R])=>`${JSON.stringify(g)}: ${R}`).join(", "),ce=A.map(([g])=>`var ${g} = undefined;`).join(`
|
|
6
6
|
`),ue=A.map(([g])=>`${g} = ${K}[${JSON.stringify(g)}];`).join(`
|
|
7
7
|
`);if(h=`${ae.join(`
|
|
8
8
|
`)}
|
|
@@ -13,5 +13,5 @@ ${Q.join(`
|
|
|
13
13
|
${h}
|
|
14
14
|
return { ${le} };
|
|
15
15
|
})();
|
|
16
|
-
${ue}`.trim(),F("bundled:",d,"output:",h.length,"bytes"),_.size>0&&A.length===0)return console.warn(`[stx:bundler] dropped every binding for ${f.basename(t)} (${d}); serving the unbundled source and not caching this result`),e;b.mkdirSync(p,{recursive:!0}),await Bun.write(x,h);let U=Array.from(Z).map((g)=>{try{return{path:g,mtimeMs:b.statSync(g).mtimeMs}}catch{return null}}).filter((g)=>g!==null);return await Bun.write(v,JSON.stringify({metadataVersion:re,files:U})),G(t,U.map((g)=>g.path)),r.collectInputs?.push(...U.map((g)=>g.path)),O.set(x,{code:h,files:U}),await ge(p),h}catch(j){let h=z(j,t||void 0),A=
|
|
17
|
-
export{
|
|
16
|
+
${ue}`.trim(),F("bundled:",d,"output:",h.length,"bytes"),_.size>0&&A.length===0)return console.warn(`[stx:bundler] dropped every binding for ${f.basename(t)} (${d}); serving the unbundled source and not caching this result`),e;b.mkdirSync(p,{recursive:!0}),await Bun.write(x,h);let U=Array.from(Z).map((g)=>{try{return{path:g,mtimeMs:b.statSync(g).mtimeMs}}catch{return null}}).filter((g)=>g!==null);return await Bun.write(v,JSON.stringify({metadataVersion:re,files:U})),G(t,U.map((g)=>g.path)),r.collectInputs?.push(...U.map((g)=>g.path)),O.set(x,{code:h,files:U}),await ge(p),h}catch(j){let h=z(j,t||void 0),A=Ie(j,t||void 0);if(console.warn(`[stx:bundler] error: ${A}`),_i(t||"",A,h),Ri()==="error")throw j;return e}finally{try{b.rmSync(m,{force:!0}),b.rmSync(w,{recursive:!0,force:!0})}catch{}}}function we(e){let t=e.trim();if(!t)return null;let r=t.indexOf("=");if(r!==-1)t=t.slice(0,r).trim();let l=t.indexOf(":");if(l!==-1)t=t.slice(l+1).trim();if(t.startsWith("..."))t=t.slice(3).trim();return/^[A-Za-z_$][\w$]*$/.test(t)?t:null}
|
|
17
|
+
export{Ie,oe,Aa,_i,pt,ft,du,Ri,gt,Gt,Pa,Ia,Da,Oa,mt,Ma};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{_o,Ro}from"./chunk-pzngjk81.js";import"./chunk-8vq0qjq9.js";import"./chunk-h1h6xe1k.js";import"./chunk-debz86rr.js";import"./chunk-aync8qmk.js";import"./chunk-bh4x090w.js";import"./chunk-89e1d0rz.js";import"./chunk-qby6wxat.js";import"./chunk-m16h8ea0.js";import"./chunk-3ynkg5dz.js";import"./chunk-014gmm8w.js";import{Js}from"./chunk-cw6j75ck.js";import"./chunk-qx3js9tk.js";import"./chunk-r8wze9ym.js";import"./chunk-hjp990p8.js";import"./chunk-hy9e3ny6.js";import"./chunk-rsxvbnp4.js";import"./chunk-ep5jnqdb.js";import"./chunk-2tfe2g58.js";import"./chunk-10967rws.js";import"./chunk-b1fg9vg7.js";import"./chunk-kea18wnc.js";import"./chunk-34gy5zjm.js";import"./chunk-0varh725.js";import"./chunk-ap6fehea.js";import"./chunk-xvzxrt9a.js";import"./chunk-tqnysw0k.js";import"./chunk-k31fwm2w.js";import"./chunk-4mew0ae3.js";import"./chunk-8j8k27xb.js";import"./chunk-a4r19yxm.js";import"./chunk-awtrcb5m.js";import"./chunk-2ewa2sg5.js";import"./chunk-6aqcgrhw.js";import"./chunk-z0ck9t6j.js";import{me,Yt,Zt,q,d,r,Vn,A,i,ce}from"./chunk-rj3hyqff.js";import"./chunk-11ra3sbc.js";import"./chunk-x5ks23vx.js";import"./chunk-g1fxmp9z.js";import"./chunk-4e101kjp.js";import"./chunk-62r4fa4q.js";import"./chunk-32y3767j.js";import"./chunk-ax58cds3.js";import"./chunk-09hhrjk9.js";import"./chunk-tafebmtg.js";import"./chunk-757ec865.js";import"./chunk-66k7yxnr.js";import"./chunk-4n6c5rp5.js";export{Vn as buildWebComponents,Zt as cacheTemplate,Yt as checkCache,Js as classifyAllScripts,_o as createMiddleware,Ro as createRoute,A as defaultConfig,d as extractVariables,q as injectRouterScript,i as loadStxConfig,me as processClientScript,r as processDirectives,ce as readMarkdownFile};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import u from"fs";import l from"path";var g=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^<>()]*>)?\s*\(/,x=/(?:^|\n)\s*(?:import|export)\s+(?:[^'"]*?\sfrom\s+)?['"](\.[^'"]*)['"]/g,b=["",".ts",".tsx",".js",".jsx",".mts",".mjs","/index.ts","/index.js"],h=3;function y(e,t){let r=l.resolve(l.dirname(t),e);for(let o of b){let s=r+o;try{if(u.statSync(s).isFile())return s}catch{}}return null}function
|
|
3
|
-
export{
|
|
2
|
+
import u from"fs";import l from"path";var g=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^<>()]*>)?\s*\(/,x=/(?:^|\n)\s*(?:import|export)\s+(?:[^'"]*?\sfrom\s+)?['"](\.[^'"]*)['"]/g,b=["",".ts",".tsx",".js",".jsx",".mts",".mjs","/index.ts","/index.js"],h=3;function y(e,t){let r=l.resolve(l.dirname(t),e);for(let o of b){let s=r+o;try{if(u.statSync(s).isFile())return s}catch{}}return null}function pn(e,t,r=0,o=new Set){if(!t||r>=h)return!1;for(let s of e.matchAll(x)){let n=y(s[1],t);if(!n||o.has(n))continue;o.add(n);let i;try{i=u.readFileSync(n,"utf8")}catch{continue}if(g.test(i))return!0;if(pn(i,n,r+1,o))return!0}return!1}var m=["batch","cachedQuery","clearServerData","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","flushKeptState","forgetKeptState","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","keptState","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refresh","registerStoresClient","setKeptScope","setRouteParams","state","untrack","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useDocumentVisibility","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useModel","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],ho=["onMount","onDestroy"];function Tt(e="const",t=[],r){let o=t.length?m.filter((s)=>!t.includes(s)):m;if(r!==void 0)o=o.filter((s)=>{let n=s.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${n}(?![\\w$])`).test(r)});return`${e} { ${o.join(", ")} } = window.stx;`}var E=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"];var S=m.filter((e)=>!E.includes(e));function Ts(e){if(!e)return!1;return S.some((t)=>new RegExp(`\\b${t}\\s*(?:<[^>]*>)?\\s*\\(`).test(e))}var v=[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\s:[a-z][\w-]*\s*=\s*["']/i,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/],T=/\s@[a-z][\w.:-]*\s*=/i;function yo(e,t){if(!e)return!1;let r=f(e);return d(r,t)}function d(e,t){if(v.some((r)=>r.test(e)))return!0;if(Ts(e))return!0;return R(e,t)}function R(e,t){if(!t)return!1;for(let r of e.matchAll(/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script\s*>/gi))if(pn(r[1],t))return!0;return!1}function bo(e,t){if(!e)return!1;let r=f(e);return T.test(r)||d(r,t)}var _=["if","else-if","elseif","else","for","show","key","text","html","model","ref"];function wo(e){return _.includes(e.toLowerCase())}var p=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],w=["x-init","x-transition","x-effect","x-on"],vo=[...p,...w];function xo(){return`{${p.map((e)=>`'${e}':1`).join(",")}}`}var A=["class","style","text","html","show","model","if","ref"];function So(){return`{${A.map((e)=>e==="if"?"'if':1":`${e}:1`).join(",")}}`}var N=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","keydown","keyup","keypress","input","change","submit","focus","blur","scroll","resize","touchstart","touchend","touchmove","contextmenu","wheel","pointerdown","pointerup","pointermove"];function ko(){return`/^(${N.join("|")})/`}var M=65536,L=4,c=new Map;function f(e){if(!e)return e;if(!e.includes("<!--")&&!/<(?:pre|code)\b/i.test(e))return e;let t=e.length>=M;if(t){let s=c.get(e);if(s!==void 0)return s}let r=(s)=>s.replace(/(<[^>]*>)|([^<]+)/g,(n,i,a)=>i??" ".repeat(a.length)),o=e.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(s,n,i,a)=>n+r(i)+a).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(s,n,i,a)=>n+r(i)+a).replace(/<!--[\s\S]*?-->/g,(s)=>" ".repeat(s.length));if(t){while(c.size>=L){let s=c.keys().next();if(s.done)break;c.delete(s.value)}c.set(e,o)}return o}
|
|
3
|
+
export{pn,m,ho,Tt,Ts,yo,bo,wo,vo,xo,So,ko};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Oe,Ua,wu,vu,xu,Su,Va,Wa,ku,Cu,Ni,$u,Yt,Zt,On}from"./chunk-rj3hyqff.js";import"./chunk-11ra3sbc.js";import"./chunk-x5ks23vx.js";import"./chunk-g1fxmp9z.js";import"./chunk-4e101kjp.js";import"./chunk-62r4fa4q.js";import"./chunk-32y3767j.js";import"./chunk-ax58cds3.js";import"./chunk-09hhrjk9.js";import"./chunk-tafebmtg.js";import"./chunk-757ec865.js";import"./chunk-66k7yxnr.js";import"./chunk-4n6c5rp5.js";export{Su as __setSignalsGeneratorsForTest,Oe as cacheEngineFingerprint,Zt as cacheTemplate,Yt as checkCache,$u as clearDevCaches,Wa as getCachedRouterScript,Va as getCachedSignalsRuntime,ku as getServeClientAsset,Ni as getServeModuleBundle,On as hashFilePath,vu as invalidateFileCache,xu as invalidateFileCacheByDir,wu as readFileCached,Cu as registerServeModuleBundle,Ua as templateCache};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var l=new Map,u=new Map;function m(t){if(l.set(t.name,t),t.client)u.set(t.name,t.client)}function
|
|
3
|
-
export{
|
|
2
|
+
var l=new Map,u=new Map;function m(t){if(l.set(t.name,t),t.client)u.set(t.name,t.client)}function We(t){return m(t),{name:t.name,hasEndTag:t.hasEndTag??!0,description:t.description,handler:async(r,o,a,s)=>{let n=f(o,t.defaults);if(t.validate){let e=t.validate(n);if(e!==!0){let d=typeof e==="string"?e:`Invalid parameters for @${t.name}`;throw Error(d)}}let i=r;if(t.transform)i=await t.transform(r,n,a,s);if(t.clientScript){let e=t.clientScript(n);i+=`<script>${e}</script>`}if(t.css){let e=t.css(n);i+=`<style>${e}</style>`}return i}}}function f(t,c){let r={...c};for(let o of t){let a=o.indexOf(":"),s=o.indexOf("="),n=a>=0&&(s<0||a<s)?a:s;if(n>=0){let i=o.slice(0,n).trim(),e=o.slice(n+1).trim();if(e==="true")e=!0;else if(e==="false")e=!1;else if(e==="null")e=null;else if(!Number.isNaN(Number(e)))e=Number(e);else if(typeof e==="string"&&e.startsWith("{"))try{e=JSON.parse(e)}catch{}r[i]=e}else{let i=Object.keys(r).filter((e)=>!c||!(e in c)).length;r[i===0?"value":`arg${i}`]=o}}return r}
|
|
3
|
+
export{We};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Se}from"./chunk-66k7yxnr.js";import{$n,Ut}from"./chunk-8j8k27xb.js";import{Di,Oi,f,vt,M,jn,Bn,Fn,r,Q,A,i}from"./chunk-rj3hyqff.js";import{S}from"./chunk-62r4fa4q.js";import{hs}from"./chunk-4e101kjp.js";import{cn,de}from"./chunk-ax58cds3.js";import{fo}from"./chunk-g1fxmp9z.js";import{ge,re,ei,ti,At}from"./chunk-cw6j75ck.js";import{ht,Br}from"./chunk-z0ck9t6j.js";import{Pt}from"./chunk-mg13q1kd.js";import{ut,Kt,Xt}from"./chunk-jjtzm6dn.js";import m from"fs";import c from"path";import{createHash as ee}from"crypto";function J(o){return ee("sha256").update(o).digest("hex").slice(0,8)}function U(o=!1){let l=o?Ut():$n(),a=J(l);return{content:l,filename:`runtime.${a}.js`,hash:a}}function V(){let o=Se(),l=J(o);return{content:o,filename:`router.${l}.js`,hash:l}}import q from"path";import{createHash as te}from"crypto";function se(o={}){let l=new Set;return{context:new Proxy(o,{get(s,e){if(e in s)return s[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(s,e){if(e in s)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function X(o,l,a={}){let s=q.resolve(o),e=await Bun.file(s).text(),_=te("sha256").update(e).digest("hex").slice(0,16);Di();let R={};try{R=await i(a.configDir)}catch{}let y=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let v=g[1];if(/\bserver\b/.test(v))y.push(g[2])}let u=new Set(y.flatMap((v)=>Q(v))),{context:w}=se({__filename:s,__dirname:q.dirname(s),__stx_serverDeclared:u}),C=new Set,P={...A,...R,...a,buildMode:"compile",strict:!1},b=await r(e,w,s,P,C),T=ge(b),B=Oi();return{route:l,sourceFile:o,html:b,fragment:T,placeholders:B,hasServerScripts:y.length>0,serverScriptContent:y,dependencies:Array.from(C),contentHash:_,status:vt(e),streamTemplates:w.__streamTemplates}}var ne=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function Z(o,l){let a=0,s=0;if(!m.existsSync(o))return{copied:a,bytes:s};m.mkdirSync(l,{recursive:!0});function e(_,R){let y=m.readdirSync(_,{withFileTypes:!0});for(let d of y){if(ne.has(d.name))continue;let g=c.join(_,d.name),u=c.join(R,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),a++,s+=m.statSync(u).size}}}return e(o,l),{copied:a,bytes:s}}async function Vc(o={}){let l=Date.now(),a=c.resolve(o.root||process.cwd()),s=c.resolve(a,o.outputDir||".output");console.log("[stx build] Starting production build...");let e=await i(a),_=c.resolve(a,o.componentsDir??e.componentsDir??"components"),R=c.resolve(a,o.partialsDir??e.partialsDir??"partials"),y=c.resolve(a,o.layoutsDir??e.layoutsDir??"layouts"),d=o.publicDir??e.publicDir??"public",g=de(e.app?.head,{known:cn,source:"app.head"}),u=e.app?.colorMode,w=e.router?.container||"main",C=o.routeRules??e.routeRules??{},P=Pt(C),b=o.serverApi??e.serverApi,T=typeof b==="object"?b:{};if(b)ht(a,T);if(e.runtimeConfig)S(e.runtimeConfig,{});if(m.existsSync(s))m.rmSync(s,{recursive:!0});let B=[c.join(s,"public","__stx"),c.join(s,"public","assets"),c.join(s,"server","pages"),c.join(s,"server","fragments")];for(let n of B)m.mkdirSync(n,{recursive:!0});console.log("[stx build] Discovering routes...");let v=M(a,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],O=v.filter((n)=>!Y.some((h)=>n.pattern.startsWith(`/${h}/`)||n.pattern===`/${h}`));console.log(`[stx build] Found ${O.length} page routes (${v.length-O.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let D=U(o.debug),x=V();await Bun.write(c.join(s,"public","__stx",D.filename),D.content),await Bun.write(c.join(s,"public","__stx",x.filename),x.content),console.log(`[stx build] Runtime: ${D.filename} (${(D.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${x.filename} (${(x.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let k=[],H=[];for(let n of O){let h=P(n.pattern),E=h.rendering==="prerender";if(E&&(n.pattern.includes(":")||n.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${n.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await X(n.filePath,n.pattern,{configDir:a,componentsDir:_,partialsDir:R,layoutsDir:y,debug:o.debug});if(k.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,D.filename).replace(/router\.__STX_HASH__\.js/g,x.filename),t.html=Fn(t.html,g,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=jn(t.html,u);if(g.htmlAttrs)t.html=Bn(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 W=p[1];t.html=t.html.replace(" "+W,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${W}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await f(t.html),E){let p=await At(t,{params:{},request:new Request(`http://stx.build${n.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 ${n.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=re(t.html,w);let z=n.pattern==="/"?"index":n.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),G=c.join("server","pages",`${z}.compiled.json`),I=c.join("server","fragments",`${z}.html`);await Bun.write(c.join(s,G),JSON.stringify(t,null,2)),await Bun.write(c.join(s,I),t.fragment),H.push({pattern:n.pattern,compiledPath:G,fragmentPath:I,isDynamic:t.hasServerScripts,hasParams:n.pattern.includes(":")||n.pattern.includes("["),prerendered:E}),console.log(`[stx build] \u2713 ${n.pattern}`)}catch(t){if(Object.keys(h).length)throw t;console.error(`[stx build] \u2717 ${n.pattern}:`,t instanceof Error?t.message:t)}}let F=c.resolve(a,d);if(m.existsSync(F)){let{copied:n,bytes:h}=Z(F,c.join(s,"public"));if(n>0)console.log(`[stx build] Copied ${n} public asset${n===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${d}/`)}let N=Xt(a);if(N){let{copied:n,bytes:h}=Z(N,c.join(s,"public",Kt));if(n>0)console.log(`[stx build] Copied ${n} asset${n===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${ut}/`)}let K={runtime:D.filename,router:x.filename},j=ei(H,K,s);if(j.routeRules=C,j.routerContainer=w,b)j.apiRoutes=await Br(a,s,T);if(e.runtimeConfig)await Bun.write(c.join(s,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await hs(a,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(s,"server/layers.json"),JSON.stringify(fo(e._layerGraph),null,2));ti(j,s);let L=Date.now()-l;return console.log(`
|
|
3
|
+
[stx build] Done in ${L}ms \u2014 ${k.length} pages compiled`),{pageCount:k.length,assets:K,outputDir:s,duration:L}}
|
|
4
|
+
export{Vc};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var l=null,k=[],a=0,p=new Set;function v(){return l}function b(e){let i=l;return k.push(e),l=e,i}function T(e){k.pop(),l=e}function y(){return a>0}function g(e){p.add(e)}function m(e){a++;try{e()}finally{if(a--,a===0){let i=[...p];p.clear();for(let n of i)n()}}}function D(e){let i=l;l=null;try{return e()}finally{l=i}}var h=[],f=[];function z(e){let i=e,n=new Set,r=new Set,o=()=>{let t=v();if(t)r.add(t);return i};return o.set=(t)=>{if(!Object.is(t,i)){let c=i;if(i=t,n.forEach((s)=>{try{s(i,c)}catch(u){console.error("[stx] subscriber error:",u)}}),y())r.forEach((s)=>g(s));else r.forEach((s)=>s())}},o.update=(t)=>{o.set(t(i))},o.subscribe=(t)=>(n.add(t),()=>n.delete(t)),Object.defineProperty(o,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(o,"value",{get:()=>o(),set:(t)=>o.set(t),configurable:!0}),o}function
|
|
3
|
-
export{z,
|
|
2
|
+
var l=null,k=[],a=0,p=new Set;function v(){return l}function b(e){let i=l;return k.push(e),l=e,i}function T(e){k.pop(),l=e}function y(){return a>0}function g(e){p.add(e)}function m(e){a++;try{e()}finally{if(a--,a===0){let i=[...p];p.clear();for(let n of i)n()}}}function D(e){let i=l;l=null;try{return e()}finally{l=i}}var h=[],f=[];function z(e){let i=e,n=new Set,r=new Set,o=()=>{let t=v();if(t)r.add(t);return i};return o.set=(t)=>{if(!Object.is(t,i)){let c=i;if(i=t,n.forEach((s)=>{try{s(i,c)}catch(u){console.error("[stx] subscriber error:",u)}}),y())r.forEach((s)=>g(s));else r.forEach((s)=>s())}},o.update=(t)=>{o.set(t(i))},o.subscribe=(t)=>(n.add(t),()=>n.delete(t)),Object.defineProperty(o,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(o,"value",{get:()=>o(),set:(t)=>o.set(t),configurable:!0}),o}function En(e){let i,n=!0,r=new Set,o=()=>{if(!n)if(n=!0,y())r.forEach((c)=>g(c));else r.forEach((c)=>c())},t=()=>{let c=v();if(c)r.add(c);if(n){let s=b(o);try{i=e()}finally{T(s)}n=!1}return i};return Object.defineProperty(t,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(t,"value",{get:()=>t(),configurable:!0}),t}function Vt(e,i={}){let n,r=!1,o=()=>{if(r)return;if(n){let c=n;n=void 0;try{c()}catch(s){console.error("[stx] effect cleanup error:",s)}}let t=b(o);try{let c=e();n=typeof c==="function"?c:void 0}catch(c){r=!0,console.error("[stx] effect error (the effect is disposed):",c)}finally{T(t)}};if(i.immediate!==!1)o();return()=>{if(r=!0,n){let t=n;n=void 0,t()}}}function Pr(e){m(e)}function Ir(e){h.push(e)}function Tn(e){f.push(e)}function Ul(){C(h,"onMount",f)}function Vl(){C(f,"onDestroy")}function C(e,i,n){let r=e.splice(0,e.length);for(let o of r)try{let t=o();if(n&&typeof t==="function")n.push(t)}catch(t){console.error(`[stx] ${i} callback threw:`,t)}}function Wl(){return{mount:h.length,destroy:f.length}}function Wt(e){return typeof e==="function"&&e._isSignal===!0}function qt(e){return typeof e==="function"&&e._isDerived===!0}function Dr(e){if(Wt(e)||qt(e))return e();return e}function _n(e){return D(e)}function ql(e,i){let n=typeof e==="function"?e:()=>e,r=z([]),o=En(()=>r().reduce((s,u)=>i(s,u.action),n())),t=!1;return Vt(()=>{if(n(),!t){t=!0;return}if(_n(()=>r().length))r.set([])}),[o,(s,u)=>{let x={action:s};r.set([...r(),x]);let d=()=>{let S=r().filter((A)=>A!==x);if(S.length!==r().length)r.set(S)};if(u&&typeof u.then==="function")Promise.resolve(u).then(d,d);return d}]}
|
|
3
|
+
export{z,En,Vt,Pr,Ir,Tn,Ul,Vl,Wl,Wt,qt,Dr,_n,ql};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{xo,So,ko}from"./chunk-757ec865.js";import{z,En,Vt,Pr,Ir,Tn,Wt,qt,Dr,_n}from"./chunk-8drvzsk1.js";function W(r,d,u,s,i){let y=!0,f=new Set,h=(a)=>s.get?s.get(a):a,l=()=>h(r());return Object.defineProperty(l,"_isSignal",{value:!0}),Object.defineProperty(l,"modifiers",{get:d}),l.set=(a)=>{if(!y)return;let v=d(),g=s.set?s.set(a,v):a;if(v.trim&&typeof g==="string")g=g.trim();if(v.number&&typeof g==="string"&&g!==""){let t=Number(g);if(!Number.isNaN(t))g=t}if(Object.is(r(),g))return;r.set(g),u(g)},l.update=(a)=>l.set(a(l())),l.input=(a)=>{if(!d().lazy)l.set(a)},l.change=(a)=>{if(d().lazy)l.set(a)},l.subscribe=(a)=>{if(!y)return()=>{};let v=r.subscribe((g,t)=>a(h(g),h(t)));return f.add(v),()=>{v(),f.delete(v)}},Object.defineProperty(l,"value",{get:l,set:l.set}),i(()=>{y=!1,f.forEach((a)=>a()),f.clear()}),l}function X(r,d=!0,u){if(!d||!r||typeof window>"u")return;let s=window;if(!s.__STX_DATA__){let y=document.querySelector("script[data-stx-server-data]");try{let f=JSON.parse(y?.textContent||"{}");s.__STX_DATA__=f&&typeof f==="object"&&!Array.isArray(f)?f:{}}catch{s.__STX_DATA__={}}}let i=s.__STX_DATA__;if(i&&Object.prototype.hasOwnProperty.call(i,r))try{return{data:u?u(i[r]):i[r]}}catch(y){return{data:null,error:y instanceof Error?y:Error(String(y))}}return}function Q(r){if(typeof window>"u")return;let d=window;if(r===void 0)d.__STX_DATA__={};else{if(!d.__STX_DATA__)try{let u=JSON.parse(document.querySelector("script[data-stx-server-data]")?.textContent||"{}");d.__STX_DATA__=u&&typeof u==="object"&&!Array.isArray(u)?u:{}}catch{d.__STX_DATA__={}}if(d.__STX_DATA__)delete d.__STX_DATA__[r]}}function G(r){let d=null;try{d=typeof indexedDB<"u"?indexedDB:null}catch{d=null}if(!d)return null;let u=d,s=r||"stx-kept",i=null,y=()=>{if(!i)i=new Promise((h,l)=>{let a=u.open(s,1);a.onupgradeneeded=()=>{a.result.createObjectStore("kv")},a.onsuccess=()=>h(a.result),a.onerror=()=>l(a.error),a.onblocked=()=>l(Error("blocked"))}),i.catch(()=>{i=null});return i},f=(h,l)=>y().then((a)=>new Promise((v,g)=>{let t=a.transaction("kv",h),o=l(t.objectStore("kv"));t.oncomplete=()=>v(o?o.result:void 0),t.onerror=()=>g(t.error),t.onabort=()=>g(t.error)}));return{get:(h)=>f("readonly",(l)=>l.get(h)),set:(h,l)=>f("readwrite",(a)=>{a.put(l,h)}),remove:(h)=>f("readwrite",(l)=>{l.delete(h)}),removePrefix:(h)=>f("readwrite",(l)=>{l.delete(IDBKeyRange.bound(h,`${h}\uFFFF`))})}}function J(r,d){let u=r||{},s=null;if(u.storage!==void 0)s=u.storage;else try{s=typeof localStorage<"u"?localStorage:null}catch{s=null}let i=null,y=u.backend!==void 0;if(y)i=u.backend||null;let f=()=>{if(y)return i;y=!0;try{i=d?d():null}catch{i=null}if(i){let e=i;e.get("__stx_probe__").catch(()=>{if(i===e)i=null})}return i},h=u.limit||32768,l=u.defer||((e)=>{let n=typeof requestIdleCallback==="function"?requestIdleCallback:null;if(n)n(e,{timeout:200});else setTimeout(e,16)}),a=new Map,v=new Set,g=new Map,t=!1,o=Promise.resolve(),m=(e)=>{try{return JSON.parse(e)}catch{return e}},p=(e,n)=>{if(!s)return!1;try{return s.setItem(e,n),!0}catch{return!1}},T=(e)=>{try{if(s)s.removeItem(e)}catch{}},S=()=>{if(t=!1,!g.size)return o;let e=Array.from(g.entries());return g.clear(),o=o.then(()=>Promise.all(e.map(([n,c])=>{if(!i){v.delete(n);try{p(n,JSON.stringify(c===void 0?null:c))}catch{}return}let _;try{return _={v:c},i.set(n,_).catch(()=>{let w;try{w=JSON.stringify(c)}catch{return}return i?i.set(n,{j:w}).catch(()=>{p(n,w)}):void 0})}catch{return}}))).then(()=>{}),o},R=(e,n)=>{if(g.set(e,n),v.add(e),t)return;t=!0,l(()=>{S()})},I=(e)=>{if(!e||typeof e!=="object")return;let n=e;if("v"in n)return{value:n.v};if(typeof n.j==="string")return{value:m(n.j)};return},E={peek(e){if(a.has(e))return{value:a.get(e)};let n=null;try{n=s?s.getItem(e):null}catch{n=null}if(n===null||n===void 0)return;let c=m(n);return a.set(e,c),{value:c}},load(e){let n=E.peek(e),c=n?null:f();if(n||!c)return Promise.resolve(n);return c.get(e).then((_)=>{if(a.has(e))return{value:a.get(e)};let w=I(_);if(w)a.set(e,w.value),v.add(e);return w},()=>{return})},set(e,n){if(a.set(e,n),i&&v.has(e)){R(e,n);return}let c;try{c=JSON.stringify(n===void 0?null:n)}catch{return}if(c.length<=h&&p(e,c))return;if(!f()){if(c.length>h)p(e,c);return}T(e),R(e,n)},forget(e){for(let c of Array.from(a.keys()))if(c.indexOf(e)===0)a.delete(c);for(let c of Array.from(g.keys()))if(c.indexOf(e)===0)g.delete(c);for(let c of Array.from(v))if(c.indexOf(e)===0)v.delete(c);try{if(s)for(let c=s.length-1;c>=0;c--){let _=s.key(c);if(_&&_.indexOf(e)===0)s.removeItem(_)}}catch{}let n=f();if(!n)return o;return o=o.then(()=>n.removePrefix(e)).catch(()=>{}),o},flush(){return S()}};try{if(typeof document<"u"&&document.addEventListener)document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden")S()});if(typeof addEventListener==="function")addEventListener("pagehide",()=>{S()})}catch{}return E}function Y(r,d){if(!r)return!1;if(r===d.key)return!0;if(!d.url)return!1;if(r===d.url)return!0;try{let u=typeof location<"u"&&location.origin&&location.origin!=="null"?location.origin:"http://localhost",s=new URL(r,u),i=new URL(d.url,u);if(s.origin!==i.origin||s.pathname!==i.pathname)return!1;return!s.search||s.search===i.search}catch{return!1}}function Z(r){let d=r.prefix||"stx:kept:",u=r.matches||((t,o)=>t===o.key||t===o.url),s=new Set,i=new Map,y,f=(t)=>t===void 0?y:t,h=(t,o)=>{let m=f(o);if(m===!1||m===null||m==="")return null;return`${d}${m===void 0?"":`${m}:`}query:${t}`},l=(t)=>{let o=t&&t.value;if(!o||typeof o!=="object"||!("d"in o))return;return{data:o.d,at:Number(o.at)||0}},a=()=>{let t=globalThis;return t.__stx_outboxes instanceof Map?t.__stx_outboxes:null},v={setScope(t){y=t},scope:()=>y,keyFor:h,seed(t,o){let m=h(t,o);return m?l(r.kept.peek(m)):void 0},restore(t,o){let m=h(t,o);return m?r.kept.load(m).then(l):Promise.resolve(void 0)},persist(t,o,m){let p=h(t,m);if(p)r.kept.set(p,{d:o,at:Date.now()})},overlay(t,o,m){let p=a();if(!p||!p.size)return o;let T=o;return p.forEach((S)=>{try{T=S.overlay(t,T,m)}catch{}}),T},watch(t){return s.add(t),()=>{s.delete(t)}},cachedQuery(t,o){let m=i.get(t);if(m){if(o&&m.__options)m.__options(o);return m}let p=o||{},T=p.initial===void 0?null:p.initial,S=()=>typeof p.scope==="function"?p.scope():p.scope,R=()=>(typeof p.url==="function"?p.url():p.url)||null,I=()=>({key:t,url:R()}),E=S(),e=T,n=0,c=null,_=v.seed(t,E);if(_)e=_.data;let w=r.state(v.overlay(I(),e)),H=r.state(!1),V=r.state(!1),q=r.state(null),O=r.state(_?_.at:0),N=0,M=()=>{w.set(v.overlay(I(),e))},K=(b)=>{let x=N;v.restore(t,b).then((C)=>{if(!C||x!==N||n)return;e=C.data,O.set(C.at),M()})};if(!_)K(E);let ee=()=>{let b=S();if(b===E)return;E=b,N++,c=null,n=0;let x=v.seed(t,E);if(e=x?x.data:T,O.set(x?x.at:0),M(),!x)K(E)},te=(b)=>{let x=R(),C=p.timeoutMs||15000,A=typeof AbortController<"u"?new AbortController:null,k=null,ne=new Promise((D,L)=>{k=setTimeout(()=>{if(A)A.abort();L(Error("The request took too long."))},C)}),U;if(p.load)U=p.load({force:b,url:x,signal:A?A.signal:void 0});else if(x){let D=p.fetch||((P,F)=>fetch(P,F)),L={method:"GET",headers:{Accept:"application/json"}};if(b)L.cache="no-cache";if(A)L.signal=A.signal;U=D(x,L).then((P)=>{if(!P.ok)return P.json().catch(()=>null).then((F)=>{throw Error(F&&(F.error||F.message)||`Request failed (${P.status})`)});return P.json()})}else return Promise.resolve(w());return Promise.race([U,ne]).then((D)=>{if(k)clearTimeout(k);return p.transform?p.transform(D):D},(D)=>{if(k)clearTimeout(k);throw D})},B=(b)=>{if(c)return c;let x=N;if(V.set(!0),n===0&&!O())H.set(!0);let C=()=>{if(x!==N)return;c=null,V.set(!1),H.set(!1)},A=te(b).then((k)=>{if(x!==N)return w();return e=k,n=Date.now(),O.set(n),q.set(null),v.persist(t,k,E),M(),C(),w()},(k)=>{if(x===N)q.set(k&&k.message?k.message:"Could not load.");return C(),w()});return c=A,A},j={data:w,loading:H,isFetching:V,error:q,updatedAt:O,get key(){return t},load(b){if(ee(),!b&&n&&Date.now()-n<(p.staleTime||0))return Promise.resolve(w());return B(!!b)},refresh(){return j.load(!0)},set(b){e=typeof b==="function"?b(e):b,v.persist(t,e,E),M()},invalidate(){n=0},__options(b){p={...p,...b}}};if(s.add({target:I,updated:()=>{if(n||O())B(!1)},outbox:(b)=>{if(b)e=v.overlay(I(),e,b.id),n=0,B(!0);M()}}),i.set(t,j),p.immediate)j.load();return j}},g=typeof window<"u"?window:typeof addEventListener==="function"?globalThis:null;if(r.listen!==!1&&g&&typeof g.addEventListener==="function")g.addEventListener("stx:updated",(t)=>{let o=t.detail||{};if(o.kind!=="api"||typeof o.url!=="string")return;s.forEach((m)=>{if(u(o.url,m.target()))m.updated()})}),g.addEventListener("stx:outbox",(t)=>{let o=t.detail||{},m=o.sent&&typeof o.sent.id==="string"?o.sent:null;s.forEach((p)=>{if(m){let T=Array.isArray(m.affects)?m.affects:[],S=p.target();if(!T.some((R)=>u(R,S)))return}p.outbox(m)})});return v}function $n(){let r=re(Ut());try{let u=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(r);return u=u.replace(/\}(var |let |const |function )/g,"};$1"),u}catch{return r}}function re(r){let d=[],u=0,s="console.log(";while(u<r.length){let i=r.indexOf(s,u);if(i===-1){d.push(r.slice(u));break}d.push(r.slice(u,i));let y=1,f=i+s.length;while(f<r.length&&y>0){let h=r[f];if(h==='"'||h==="'"||h==="`"){let l=h;f++;while(f<r.length&&r[f]!==l){if(r[f]==="\\")f++;f++}f++;continue}if(h==="(")y++;else if(h===")")y--;f++}d.push("0"),u=f}return d.join("")}function Ut(){return`
|
|
3
3
|
// STX Signals Runtime (Development Build)
|
|
4
4
|
console.log('[stx] signals runtime loading');
|
|
5
5
|
// Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
|
|
@@ -3052,7 +3052,7 @@ catch (e2) {
|
|
|
3052
3052
|
};
|
|
3053
3053
|
|
|
3054
3054
|
// Known directive names to exclude from generic :attr binding
|
|
3055
|
-
var DIRECTIVE_NAMES = ${
|
|
3055
|
+
var DIRECTIVE_NAMES = ${So()};
|
|
3056
3056
|
|
|
3057
3057
|
// A bound value cannot introduce a URL scheme the page did not ask for.
|
|
3058
3058
|
// This is the client half of url-safety.ts: the server refuses a scheme
|
|
@@ -3087,7 +3087,7 @@ catch (e2) {
|
|
|
3087
3087
|
// a dead duplicate attribute and the real viewBox never updates.
|
|
3088
3088
|
var SVG_ATTR_CASE = {attributename:'attributeName', attributetype:'attributeType', basefrequency:'baseFrequency', baseprofile:'baseProfile', calcmode:'calcMode', clippathunits:'clipPathUnits', diffuseconstant:'diffuseConstant', edgemode:'edgeMode', filterunits:'filterUnits', glyphref:'glyphRef', gradienttransform:'gradientTransform', gradientunits:'gradientUnits', kernelmatrix:'kernelMatrix', kernelunitlength:'kernelUnitLength', keypoints:'keyPoints', keysplines:'keySplines', keytimes:'keyTimes', lengthadjust:'lengthAdjust', limitingconeangle:'limitingConeAngle', markerheight:'markerHeight', markerunits:'markerUnits', markerwidth:'markerWidth', maskcontentunits:'maskContentUnits', maskunits:'maskUnits', numoctaves:'numOctaves', pathlength:'pathLength', patterncontentunits:'patternContentUnits', patterntransform:'patternTransform', patternunits:'patternUnits', pointsatx:'pointsAtX', pointsaty:'pointsAtY', pointsatz:'pointsAtZ', preservealpha:'preserveAlpha', preserveaspectratio:'preserveAspectRatio', primitiveunits:'primitiveUnits', refx:'refX', refy:'refY', repeatcount:'repeatCount', repeatdur:'repeatDur', requiredextensions:'requiredExtensions', requiredfeatures:'requiredFeatures', specularconstant:'specularConstant', specularexponent:'specularExponent', spreadmethod:'spreadMethod', startoffset:'startOffset', stddeviation:'stdDeviation', stitchtiles:'stitchTiles', surfacescale:'surfaceScale', systemlanguage:'systemLanguage', tablevalues:'tableValues', targetx:'targetX', targety:'targetY', textlength:'textLength', viewbox:'viewBox', viewtarget:'viewTarget', xchannelselector:'xChannelSelector', ychannelselector:'yChannelSelector', zoomandpan:'zoomAndPan'};
|
|
3089
3089
|
var SVG_NS = 'http://www.w3.org/2000/svg';
|
|
3090
|
-
var EVENT_RE = ${
|
|
3090
|
+
var EVENT_RE = ${ko()};
|
|
3091
3091
|
var KEY_MAP = {enter:'Enter', tab:'Tab', escape:'Escape', space:' ', up:'ArrowUp', down:'ArrowDown', left:'ArrowLeft', right:'ArrowRight', 'delete':'Delete', backspace:'Backspace'};
|
|
3092
3092
|
|
|
3093
3093
|
// Handle attributes
|
|
@@ -3123,7 +3123,7 @@ catch (e2) {
|
|
|
3123
3123
|
// :attr still works for backward compat but is reserved for structural directives.
|
|
3124
3124
|
// x-text, x-html, x-model, x-show, x-if, x-for, x-cloak, x-ref, x-data are
|
|
3125
3125
|
// handled by their own code paths below \u2014 exclude them here.
|
|
3126
|
-
var X_HANDLED = ${
|
|
3126
|
+
var X_HANDLED = ${xo()};
|
|
3127
3127
|
if (name.startsWith('@bind:') || name.startsWith('x-bind:')
|
|
3128
3128
|
|| (name.startsWith(':') && !name.startsWith('::') && !DIRECTIVE_NAMES[name.slice(1).split('.')[0]] && !EVENT_RE.test(name.slice(1)))
|
|
3129
3129
|
|| (name.startsWith('x-') && !X_HANDLED[name.split('.')[0]] && !X_HANDLED[name])) {
|
|
@@ -9242,5 +9242,5 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
|
|
|
9242
9242
|
}
|
|
9243
9243
|
}
|
|
9244
9244
|
})();
|
|
9245
|
-
`}var
|
|
9246
|
-
export{
|
|
9245
|
+
`}var Hl={state:z,derived:En,effect:Vt,batch:Pr,onMount:Ir,onDestroy:Tn,isSignal:Wt,isDerived:qt,untrack:Dr,peek:_n,generateSignalsRuntime:$n,generateSignalsRuntimeDev:Ut};
|
|
9246
|
+
export{$n,Ut,Hl};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import i from"fs";function
|
|
3
|
-
`)}function
|
|
4
|
-
export{
|
|
2
|
+
import i from"fs";function Ae(e){return[...e].sort().map((n)=>{try{let t=i.statSync(n);return`${n}:${t.size}:${t.mtimeMs}`}catch{return`${n}:missing`}}).join(`
|
|
3
|
+
`)}function Ht(e,n,t){let r=e.get(n);return r!==void 0&&r.signature===t?r.value:void 0}function J(e,n,t,r){return e.set(n,{signature:t,value:r}),r}
|
|
4
|
+
export{Ae,Ht,J};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{pr,Us,wn,fr,gr,_t,ct,Vs,vn,xn,mr,hr,Nc,Lc,Te}from"./chunk-8vq0qjq9.js";export{Te as DeployError,Us as calculateSha1,wn as collectDeployFiles,xn as createDefaultNetlifyConfig,fr as createFileManifest,pr as createNetlifyClient,Nc as deploy,vn as detectProjectConfig,gr as filterRequiredFiles,_t as formatSize,Vs as generateNetlifyToml,ct as getTotalSize,hr as hasNetlifyConfig,Lc as initNetlify,mr as writeNetlifyConfig};
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import S from"fs";import _ from"path";function
|
|
2
|
+
import S from"fs";import _ from"path";function pr(e){let{token:t,baseUrl:i="https://api.netlify.com/api/v1"}=e;async function s(n,r,l={}){let p=`${i}${r}`,f={Authorization:`Bearer ${t}`,"User-Agent":"stx-deploy/1.0"},u;if(l.rawBody)f["Content-Type"]=l.contentType||"application/octet-stream",u=l.rawBody;else if(l.body)f["Content-Type"]="application/json",u=JSON.stringify(l.body);let o=await fetch(p,{method:n,headers:f,body:u});if(!o.ok){let g=Error(`Netlify API error: ${o.status} ${o.statusText}`);g.status=o.status;try{let b=await o.json();g.message=b.message||g.message,g.code=b.code,g.details=b}catch{}throw g}let a=await o.text();if(!a)return{};return JSON.parse(a)}return{async getSite(n){return s("GET",`/sites/${n}`)},async listSites(){return s("GET","/sites")},async createSite(n){let r={};if(n)r.name=n;return s("POST","/sites",{body:r})},async createDeploy(n,r){let l={files:r.files,draft:r.draft??!0,async:r.async??!0};if(r.title)l.title=r.title;if(r.branch)l.branch=r.branch;if(r.functions)l.functions=r.functions;return s("POST",`/sites/${n}/deploys`,{body:l})},async uploadFile(n,r,l){let p=r.startsWith("/")?r.slice(1):r;await s("PUT",`/deploys/${n}/files/${p}`,{rawBody:l,contentType:"application/octet-stream"})},async uploadFiles(n,r){let p=[...r],f=async()=>{while(p.length>0){let o=p.shift();if(o)await this.uploadFile(n,o.path,o.content)}},u=Array.from({length:Math.min(5,r.length)},()=>f());await Promise.all(u)},async getDeploy(n){return s("GET",`/deploys/${n}`)},async waitForDeploy(n,r={}){let{timeout:l=300000,pollInterval:p=2000,onProgress:f}=r,u=Date.now();while(!0){let o=await this.getDeploy(n);if(f)f(o);if(o.state==="ready")return o;if(o.state==="error"){let a=Error(`Deploy failed: ${o.error_message||"Unknown error"}`);throw a.status=500,a.details=o,a}if(Date.now()-u>l){let a=Error(`Deploy timed out after ${l}ms`);throw a.status=408,a.details=o,a}await new Promise((a)=>setTimeout(a,p))}},async lockDeploy(n){return s("POST",`/deploys/${n}/lock`)},async unlockDeploy(n){return s("POST",`/deploys/${n}/unlock`)}}}async function Us(e){let t=await crypto.subtle.digest("SHA-1",e);return Array.from(new Uint8Array(t)).map((s)=>s.toString(16).padStart(2,"0")).join("")}async function wn(e,t={}){let{ignore:i=["node_modules",".git",".env*","*.map"]}=t,s=[],n=new Bun.Glob("**/*");for await(let r of n.scan({cwd:e,onlyFiles:!0,dot:!1})){if(i.some((a)=>{if(a.includes("*"))return new RegExp(`^${a.replace(/\*/g,".*")}$`).test(r);return r.includes(a)}))continue;let p=`${e}/${r}`,u=await Bun.file(p).arrayBuffer(),o=await Us(u);s.push({path:r,content:new Uint8Array(u),sha1:o})}return s}function fr(e){let t={};for(let i of e)t[`/${i.path}`]=i.sha1;return t}function gr(e,t){let i=new Set(t.map((s)=>s.startsWith("/")?s.slice(1):s));return e.filter((s)=>i.has(s.path))}function _t(e){if(e<1024)return`${e} B`;if(e<1048576)return`${(e/1024).toFixed(1)} KB`;if(e<1073741824)return`${(e/1048576).toFixed(1)} MB`;return`${(e/1073741824).toFixed(1)} GB`}function ct(e){return e.reduce((t,i)=>t+i.content.byteLength,0)}import m from"fs";import y from"path";function Vs(e){let t=[];if(t.push("[build]"),t.push(` command = "${d(e.build.command)}"`),t.push(` publish = "${d(e.build.publish)}"`),e.build.functions)t.push(` functions = "${d(e.build.functions)}"`);if(e.build.edge_functions)t.push(` edge_functions = "${d(e.build.edge_functions)}"`);if(e.build.environment&&Object.keys(e.build.environment).length>0){t.push(""),t.push("[build.environment]");for(let[i,s]of Object.entries(e.build.environment))t.push(` ${i} = "${d(s)}"`)}if(e.functions){if(t.push(""),t.push("[functions]"),e.functions.directory)t.push(` directory = "${d(e.functions.directory)}"`);if(e.functions.node_bundler)t.push(` node_bundler = "${e.functions.node_bundler}"`);if(e.functions.external_node_modules&&e.functions.external_node_modules.length>0)t.push(` external_node_modules = [${e.functions.external_node_modules.map((i)=>`"${i}"`).join(", ")}]`)}if(e.edge_functions&&e.edge_functions.length>0){t.push("");for(let i of e.edge_functions)t.push("[[edge_functions]]"),t.push(` function = "${d(i.function)}"`),t.push(` path = "${d(i.path)}"`)}if(e.redirects&&e.redirects.length>0){t.push("");for(let i of e.redirects){if(t.push("[[redirects]]"),t.push(` from = "${d(i.from)}"`),t.push(` to = "${d(i.to)}"`),i.status!==void 0)t.push(` status = ${i.status}`);if(i.force!==void 0)t.push(` force = ${i.force}`);if(i.conditions&&Object.keys(i.conditions).length>0){t.push(" [redirects.conditions]");for(let[s,n]of Object.entries(i.conditions))t.push(` ${s} = "${d(n)}"`)}}}if(e.headers&&e.headers.length>0){t.push("");for(let i of e.headers){t.push("[[headers]]"),t.push(` for = "${d(i.for)}"`),t.push(" [headers.values]");for(let[s,n]of Object.entries(i.values))t.push(` ${s} = "${d(n)}"`)}}if(e.plugins&&e.plugins.length>0){t.push("");for(let i of e.plugins)if(t.push("[[plugins]]"),t.push(` package = "${d(i.package)}"`),i.inputs&&Object.keys(i.inputs).length>0){t.push(" [plugins.inputs]");for(let[s,n]of Object.entries(i.inputs))if(typeof n==="string")t.push(` ${s} = "${d(n)}"`);else if(typeof n==="boolean"||typeof n==="number")t.push(` ${s} = ${n}`)}}if(e.context&&Object.keys(e.context).length>0)for(let[i,s]of Object.entries(e.context)){if(t.push(""),t.push(`[context.${i}]`),s.command)t.push(` command = "${d(s.command)}"`);if(s.publish)t.push(` publish = "${d(s.publish)}"`);if(s.environment&&Object.keys(s.environment).length>0){t.push(` [context.${i}.environment]`);for(let[n,r]of Object.entries(s.environment))t.push(` ${n} = "${d(r)}"`)}}return t.join(`
|
|
3
3
|
`)+`
|
|
4
|
-
`}function d(e){return e.replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}async function
|
|
4
|
+
`}function d(e){return e.replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}async function vn(e){let t={framework:"stx",buildCommand:"bun run build",outputDir:"dist"},i=y.join(e,"package.json");if(await Bun.file(i).exists())try{let u=JSON.parse(await Bun.file(i).text());if(u.scripts?.build)t.buildCommand="bun run build";let o={...u.dependencies,...u.devDependencies};if(o["@stacksjs/stx"]||o.stx)t.framework="stx"}catch{}let s=y.join(e,"stx.config.ts"),n=y.join(e,".config","stx.config.ts");if(await Bun.file(s).exists()||await Bun.file(n).exists())t.framework="stx";let r=["dist","build","out","public",".output"];for(let u of r){let o=y.join(e,u);if(m.existsSync(o)&&m.statSync(o).isDirectory()){t.outputDir=u;break}}let l=["functions","netlify/functions","api"];for(let u of l){let o=y.join(e,u);if(m.existsSync(o)&&m.statSync(o).isDirectory()){t.functionsDir=u;break}}let p=y.join(e,"netlify","edge-functions");if(m.existsSync(p))t.edgeFunctionsDir="netlify/edge-functions";let f=y.join(e,t.outputDir||"dist");if(m.existsSync(f)){let u=m.existsSync(y.join(f,"index.html")),o=m.readdirSync(f).filter((a)=>a.endsWith(".html"));t.isSPA=u&&o.length===1}return t}function xn(e={}){let t={build:{command:e.buildCommand||"bun run build",publish:e.outputDir||"dist"}};if(e.functionsDir)t.build.functions=e.functionsDir,t.functions={directory:e.functionsDir,node_bundler:"esbuild"};if(e.edgeFunctionsDir)t.build.edge_functions=e.edgeFunctionsDir;if(t.headers=[{for:"/*",values:{"X-Frame-Options":"DENY","X-Content-Type-Options":"nosniff","X-XSS-Protection":"1; mode=block","Referrer-Policy":"strict-origin-when-cross-origin"}},{for:"/assets/*",values:{"Cache-Control":"public, max-age=31536000, immutable"}}],e.isSPA!==!1)t.redirects=[{from:"/*",to:"/index.html",status:200}];return t.context={production:{environment:{NODE_ENV:"production"}},"deploy-preview":{environment:{NODE_ENV:"development"}}},t}async function mr(e,t){let i=await vn(e),s=t||xn(i),n=Vs(s),r=y.join(e,"netlify.toml");return await Bun.write(r,n),r}function hr(e){return m.existsSync(y.join(e,"netlify.toml"))}async function Nc(e={}){let t=Date.now(),i=[],s=e.cwd||process.cwd(),n=(c)=>{i.push(c)},r=(c)=>{if(e.onProgress)e.onProgress(c)},l=_.resolve(s,e.directory||"dist"),p=e.token||process.env.NETLIFY_AUTH_TOKEN,f=e.siteId||process.env.NETLIFY_SITE_ID;if(!p)throw new Te(`No Netlify auth token found.
|
|
5
5
|
|
|
6
6
|
To deploy to Netlify:
|
|
7
7
|
1. Create account at https://app.netlify.com
|
|
8
8
|
2. Get token at https://app.netlify.com/user/applications#personal-access-tokens
|
|
9
9
|
3. Set NETLIFY_AUTH_TOKEN environment variable
|
|
10
10
|
|
|
11
|
-
export NETLIFY_AUTH_TOKEN=your_token_here`,"NO_TOKEN");if(!f)throw new
|
|
11
|
+
export NETLIFY_AUTH_TOKEN=your_token_here`,"NO_TOKEN");if(!f)throw new Te(`No Netlify site ID found.
|
|
12
12
|
|
|
13
13
|
Either:
|
|
14
14
|
1. Set NETLIFY_SITE_ID environment variable
|
|
15
15
|
2. Pass --site-id option
|
|
16
16
|
3. Run \`stx deploy --init\` to set up
|
|
17
17
|
|
|
18
|
-
Find your site ID at: https://app.netlify.com/sites/YOUR_SITE/settings/general`,"NO_SITE_ID");if(!S.existsSync(l))throw new
|
|
18
|
+
Find your site ID at: https://app.netlify.com/sites/YOUR_SITE/settings/general`,"NO_SITE_ID");if(!S.existsSync(l))throw new Te(`Build directory not found: ${l}
|
|
19
19
|
|
|
20
|
-
Run \`stx build\` first or specify a different directory with --directory`,"NO_BUILD_DIR");if(!(S.readdirSync(l).length>0))throw new
|
|
20
|
+
Run \`stx build\` first or specify a different directory with --directory`,"NO_BUILD_DIR");if(!(S.readdirSync(l).length>0))throw new Te(`Build directory is empty: ${l}
|
|
21
21
|
|
|
22
|
-
Run \`stx build\` to generate files`,"EMPTY_BUILD_DIR");if(e.dryRun){r({stage:"collect",message:"Collecting files..."});let c=await
|
|
22
|
+
Run \`stx build\` to generate files`,"EMPTY_BUILD_DIR");if(e.dryRun){r({stage:"collect",message:"Collecting files..."});let c=await wn(l),w=ct(c);return n(`Would deploy ${c.length} files (${_t(w)})`),n(`From: ${l}`),n(`To: Site ${f}`),n(`Mode: ${e.production?"production":"draft"}`),{success:!0,url:`https://${f}.netlify.app (dry-run)`,deployId:"dry-run",logs:i,duration:Date.now()-t,filesUploaded:c.length,totalSize:w}}let o=pr({token:p});r({stage:"collect",message:"Verifying site..."});try{let c=await o.getSite(f);n(`Deploying to: ${c.name} (${c.url})`)}catch(c){if(c.status===404)throw new Te(`Site not found: ${f}
|
|
23
23
|
|
|
24
|
-
Check your site ID or create a new site at https://app.netlify.com`,"SITE_NOT_FOUND");throw c}r({stage:"collect",message:"Collecting files..."});let a=await
|
|
24
|
+
Check your site ID or create a new site at https://app.netlify.com`,"SITE_NOT_FOUND");throw c}r({stage:"collect",message:"Collecting files..."});let a=await wn(l),g=ct(a);if(n(`Found ${a.length} files (${_t(g)})`),a.length===0)throw new Te(`No files found in ${l}`,"NO_FILES");let b=fr(a);r({stage:"upload",message:"Creating deploy...",percent:0});let D=await o.createDeploy(f,{title:e.message||"Deploy from stx CLI",draft:!e.production,files:b});n(`Created deploy: ${D.id}`);let h=gr(a,D.required||[]);if(n(`Uploading ${h.length} files...`),h.length>0){let c=0,w=ct(h);for(let x of h){await o.uploadFile(D.id,x.path,x.content),c++;let C=Math.round(c/h.length*100);r({stage:"upload",message:`Uploading: ${x.path}`,percent:C,details:{uploaded:c,total:h.length}})}n(`Uploaded ${_t(w)}`)}else n("All files already on CDN (no upload needed)");r({stage:"process",message:"Processing deploy..."});let N=await o.waitForDeploy(D.id,{onProgress:(c)=>{r({stage:"process",message:`Status: ${c.state}`,details:c})}}),P=Date.now()-t;if(r({stage:"done",message:"Deploy complete!"}),n(`Deploy complete in ${(P/1000).toFixed(1)}s`),n(`URL: ${N.deploy_ssl_url}`),e.production)n(`Site: ${N.ssl_url}`);if(e.open){let c=e.production?N.ssl_url:N.deploy_ssl_url;I(c)}return{success:!0,url:N.deploy_ssl_url,siteUrl:e.production?N.ssl_url:void 0,deployId:N.id,logs:i,duration:P,filesUploaded:h.length,totalSize:ct(h)}}async function Lc(e={}){let t=e.directory||process.cwd(),i;if(hr(t))i=_.join(t,"netlify.toml");else{let s=await vn(t);i=await mr(t,xn(s))}if(e.siteId){let s=_.join(t,".env.local"),n="";if(await Bun.file(s).exists()){if(n=await Bun.file(s).text(),n=n.split(`
|
|
25
25
|
`).filter((r)=>!r.startsWith("NETLIFY_SITE_ID=")).join(`
|
|
26
26
|
`),n&&!n.endsWith(`
|
|
27
27
|
`))n+=`
|
|
28
28
|
`}n+=`NETLIFY_SITE_ID=${e.siteId}
|
|
29
|
-
`,await Bun.write(s,n)}return{configPath:i,siteId:e.siteId}}class
|
|
30
|
-
export{
|
|
29
|
+
`,await Bun.write(s,n)}return{configPath:i,siteId:e.siteId}}class Te extends Error{code;constructor(e,t){super(e);this.name="DeployError",this.code=t}}function I(e){let t=process.platform,i=t==="darwin"?"open":t==="win32"?"start":"xdg-open";Bun.spawn([i,e],{stdio:["ignore","ignore","ignore"]})}
|
|
30
|
+
export{pr,Us,wn,fr,gr,_t,ct,Vs,vn,xn,mr,hr,Nc,Lc,Te};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{oa,aa,ca,la,ua,da,pa,fa,ga,ma,ll}from"./chunk-2tfe2g58.js";export{oa as createIslandRegistry,ll as default,ma as generateIslandManifest,ca as generatePartialHydrationCSS,da as hydrateAll,ua as hydrateByStrategy,la as hydrateIsland,pa as isHydrated,fa as onHydrated,aa as processPartialHydrationDirectives,ga as processStaticDirectives};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{h,d,r,g,A}from"./chunk-
|
|
2
|
+
import{h,d,r,g,A}from"./chunk-rj3hyqff.js";import k from"path";var q={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},T=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var M=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function H(e){let t=[],o=0,n;M.lastIndex=0;while((n=M.exec(e))!==null){if(n.index>o){let a=e.slice(o,n.index);if(a.trim())t.push({type:t.length===0?"shell":"content",content:a})}let s=n[1],i=n[2];t.push({type:"suspense",name:s,content:i}),o=n.index+n[0].length}if(o<e.length){let s=e.slice(o);if(s.trim())t.push({type:t.length===0?"shell":"content",content:s})}if(t.length===0)t.push({type:"shell",content:e});return t}async function Kl(e,t={},o={}){let n={...A,...o,streaming:{...q,...o.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(i){try{let a=await Bun.file(e).text(),S=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),m=S?S[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),y={...t,__filename:e,__dirname:k.dirname(e)};if(m.trim())await d(m,y,e);let E=H(c),u=new Set;if(!E.some((w)=>w.type==="suspense")){let w=n.streaming?.strategy||"auto",x=new RegExp(T.source,"g");if(!(w!=="manual"&&x.test(c))){let p=await r(c,y,e,n,u);for(let b=0;b<p.length;b+=s)i.enqueue(p.slice(b,b+s)),await new Promise((f)=>setTimeout(f,0))}else{let p=[],b=new RegExp(T.source,"g"),f;while((f=b.exec(c))!==null)p.push({name:f[1],content:f[2],start:f.index,end:f.index+f[0].length});let v=0;for(let _ of p){if(_.start>v){let I=c.slice(v,_.start);if(I.trim()){let O=await r(I,y,e,n,u);i.enqueue(O),await new Promise((D)=>setTimeout(D,0))}}let C=await r(_.content,y,e,n,u);i.enqueue(C),await new Promise((I)=>setTimeout(I,0)),v=_.end}if(v<c.length){let _=c.slice(v);if(_.trim()){let C=await r(_,y,e,n,u);i.enqueue(C)}}}}else{let w=new Map;for(let l of E)if(l.type==="shell"||l.type==="content"){let p=await r(l.content,y,e,n,u);i.enqueue(p)}else if(l.type==="suspense"&&l.name){let p=`stx-suspense-${l.name}`;i.enqueue(`<div id="${p}" data-suspense="${l.name}" style="display:contents;">
|
|
3
3
|
<template data-suspense-fallback>Loading...</template>
|
|
4
4
|
</div>`),w.set(l.name,r(l.content,y,e,n,u))}i.enqueue(`
|
|
5
5
|
<script>
|
|
@@ -17,13 +17,13 @@ import{h,d,r,g,A}from"./chunk-1680nbq4.js";import k from"path";var q={enabled:!0
|
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
})();
|
|
20
|
-
</script>`);let x=Array.from(w.entries()).map(async([l,p])=>{i.enqueue(await
|
|
20
|
+
</script>`);let x=Array.from(w.entries()).map(async([l,p])=>{i.enqueue(await ui(l,p))});await Promise.all(x)}i.close()}catch(a){i.error(a)}}})}async function ui(e,t){try{let n=(await t).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
|
|
21
21
|
<script>
|
|
22
22
|
window.__stxSuspense.resolve('${e}', \`${n}\`);
|
|
23
23
|
</script>`}catch(o){let n=o instanceof Error?o.message:String(o);return`
|
|
24
24
|
<script>
|
|
25
25
|
window.__stxSuspense.resolve('${e}', '<div class="stx-error">Error loading content: ${h(n)}</div>');
|
|
26
|
-
</script>`}}var
|
|
26
|
+
</script>`}}var xa=`
|
|
27
27
|
<script>
|
|
28
28
|
(function(){
|
|
29
29
|
window.__stxSuspense = window.__stxSuspense || {
|
|
@@ -43,12 +43,12 @@ window.__stxSuspense.resolve('${e}', '<div class="stx-error">Error loading conte
|
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
})();
|
|
46
|
-
</script>`;function z(e,t,o){if(!t||t<=0)return e;let n,s=new Promise((i,a)=>{n=setTimeout(()=>a(Error(`streaming boundary "${o}" timed out after ${t}ms`)),t)});return Promise.race([e,s]).finally(()=>clearTimeout(n))}function
|
|
46
|
+
</script>`;function z(e,t,o){if(!t||t<=0)return e;let n,s=new Promise((i,a)=>{n=setTimeout(()=>a(Error(`streaming boundary "${o}" timed out after ${t}ms`)),t)});return Promise.race([e,s]).finally(()=>clearTimeout(n))}function Xl(e,t=[],o={}){let n=o.timeoutMs??0;return new ReadableStream({async start(s){try{if(s.enqueue(e),t.length>0)s.enqueue(xa),await Promise.all(t.map(async(i)=>{let a=z(i.render(),n,i.id);s.enqueue(await ui(i.id,a))}));s.close()}catch(i){s.error(i)}}})}var B=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;function Gl(e,t){return e.replace(B,(o,n,s)=>{let i=n.trim(),a=s.split(/@fallback/i),S=a[0].trim(),m=a.length>1?a.slice(1).join("@fallback").trim():"";if(!t.__streamTemplates)t.__streamTemplates={};return t.__streamTemplates[i]=S,`<div data-suspense="${i}">${m}</div>`})}function Jl(e){let t=e?.streamBoundaries;if(!t||typeof t!=="object")return;let o=Object.entries(t).filter(([,n])=>typeof n==="function");return o.length>0?o.map(([n,s])=>({id:n,render:s})):void 0}async function Yl(e,t={},o={}){let n={...A,...o,streaming:{...q,...o.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(i){try{let a=await Bun.file(e).text(),S=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),m=S?S[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),y={...t,__filename:e,__dirname:k.dirname(e)};if(m.trim())await d(m,y,e);let E=new Set,u=n.streaming?.strategy||"auto",R=new RegExp(T.source,"g");if(!(u!=="manual"&&R.test(c))){let x=await r(c,y,e,n,E);for(let l=0;l<x.length;l+=s)i.enqueue(x.slice(l,l+s))}else{let x=[],l=new RegExp(T.source,"g"),p;while((p=l.exec(c))!==null)x.push({name:p[1],content:p[2],start:p.index,end:p.index+p[0].length});let b=0;for(let f of x){if(f.start>b){let _=c.slice(b,f.start);if(_.trim()){let C=await r(_,y,e,n,E);i.enqueue(C)}}let v=await r(f.content,y,e,n,E);i.enqueue(v),b=f.end}if(b<c.length){let f=c.slice(b);if(f.trim()){let v=await r(f,y,e,n,E);i.enqueue(v)}}}i.close()}catch(a){i.error(a)}}})}async function Zl(e,t={}){let o={...A,...t,streaming:{...q,...t.streaming}},n=await Bun.file(e).text(),s=n.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),i=s?s[1]:"",a=n.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),S=a,m={},c;T.lastIndex=0;while((c=T.exec(a))!==null){let u=c[1],R=c[2];m[u]=R}let y=a.replace(T,"");return{renderShell:async(u={})=>{let R={...u,__filename:e,__dirname:k.dirname(e)};return await d(i,R,e),r(y,R,e,o,new Set)},renderSection:async(u,R={})=>{try{if(!m[u])return`<div class="error-message">Section "${h(u)}" not found in template "${h(e)}"</div>`;let w={...R,__filename:e,__dirname:k.dirname(e)};await d(i,w,e);let x=new Set;return await r(m[u],w,e,o,x)}catch(w){let x=w instanceof Error?w.message:String(w);return g("Expression",x,e,m[u]||"",0,m[u]||"")}},getSections:()=>Object.keys(m),getTemplate:()=>S}}var Sa={name:"suspense",hasEndTag:!0,handler:(e,t,o,n)=>{if(!t||t.length===0)throw Error("Suspense directive requires a name parameter");let s=t[0].replace(/['"`]/g,"");return`<!-- @suspense:${s} -->${e}<!-- @endsuspense:${s} -->`}},ka={name:"island",hasEndTag:!0,handler:(e,t,o,n)=>{if(!t||t.length===0)throw Error("Island directive requires a name parameter");let s=t[0].replace(/['"`]/g,""),i=t[1]?t[1].replace(/['"`]/g,""):"lazy",a=`island-${s}-${Math.random().toString(36).substring(2,9)}`,S=e.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),m=S?S[1].trim():"",c=S?e.replace(S[0],""):e;return`<div data-island="${s}" data-island-id="${a}" data-priority="${i}">
|
|
47
47
|
${c}
|
|
48
48
|
<script type="application/json" data-island-props="${a}">
|
|
49
49
|
${m?`{${m}}`:"{}"}
|
|
50
50
|
</script>
|
|
51
|
-
</div>`}};function
|
|
51
|
+
</div>`}};function Ql(e={}){let t=[];if(e.streaming?.enabled)t.push(Sa);if(e.hydration?.enabled)t.push(ka);return t}async function eu(e,t,o,n={}){return e}function tu(e,t={}){let o=new TextEncoder,n=e.pipeThrough(new TransformStream({transform(i,a){a.enqueue(o.encode(i))}})),s=new Headers(t.headers);if(!s.has("Content-Type"))s.set("Content-Type","text/html; charset=utf-8");if(!s.has("Transfer-Encoding"))s.set("Transfer-Encoding","chunked");if(!s.has("X-Content-Type-Options"))s.set("X-Content-Type-Options","nosniff");if(!s.has("X-Accel-Buffering"))s.set("X-Accel-Buffering","no");return new Response(n,{...t,headers:s})}function nu(e={mode:"full"}){let{mode:t,components:o={},dynamicImports:n=!0}=e,s=Object.entries(o).map(([i,a])=>`'${i}': ${n?`() => import('${a}')`:`require('${a}')`}`).join(`,
|
|
52
52
|
`);if(t==="loader")return`
|
|
53
53
|
(function() {
|
|
54
54
|
window.__stx = window.__stx || {};
|
|
@@ -191,4 +191,4 @@ else {
|
|
|
191
191
|
stx.hydrate();
|
|
192
192
|
}
|
|
193
193
|
})();`}
|
|
194
|
-
export{
|
|
194
|
+
export{Kl,ui,xa,Xl,Gl,Jl,Yl,Zl,Sa,ka,Ql,eu,tu,nu};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{_s,Rs,Ye,X,fn,nr,gn,rr,sr,kc,Cc,$c,mn,Ec,Tc,_c,Rc,Co,$o,Eo,As,To,Ac,Ze,Qe,et,tt,nt,rt,Se,Pc}from"./chunk-66k7yxnr.js";export{gn as Router,_c as abortNavigation,nr as bracketPathToRegex,Ze as clearMiddleware,$o as createClientCookieManager,nt as createMiddlewareContext,tt as createRouteLocation,Co as createServerCookieManager,Eo as createStorageManager,Rc as defineMiddleware,Cc as defineRoute,$c as defineRoutes,rr as findErrorPage,sr as formatRoutes,Rs as generateRouteManifest,_s as generateRouteTypes,To as getMiddleware,Qe as getMiddlewareNames,Se as getRouterScript,Pc as getRouterScriptDev,Ac as hasMiddleware,Ye as isFileRequestPath,et as loadMiddlewareFromDirectory,fn as matchRoute,Tc as navigateTo,X as patternToRegex,As as registerMiddleware,Ec as resetRoutes,mn as route,rt as runMiddleware,kc as setAppUrl};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
function m(e,t={}){return{enterFrom:t.enterClass||`${e}-enter-from`,enterActive:t.enterActiveClass||`${e}-enter-active`,enterTo:t.enterToClass||`${e}-enter-to`,leaveFrom:t.leaveClass||`${e}-leave-from`,leaveActive:t.leaveActiveClass||`${e}-leave-active`,leaveTo:t.leaveToClass||`${e}-leave-to`}}function u(e){let t=getComputedStyle(e),o=t.transitionDuration||"0s",n=t.animationDuration||"0s",s=(a)=>{let i=a.match(/^([\d.]+)(s|ms)?$/);if(!i)return 0;let r=parseFloat(i[1]);return(i[2]||"s")==="ms"?r:r*1000};return Math.max(s(o),s(n))}function v(e,t){return new Promise((o)=>{let n=t??u(e);if(n===0){o();return}let s=!1,a=()=>{if(s)return;s=!0,e.removeEventListener("transitionend",i),e.removeEventListener("animationend",i),o()},i=(r)=>{if(r.target===e)a()};e.addEventListener("transitionend",i),e.addEventListener("animationend",i),setTimeout(a,n+50)})}function f(e){e.offsetHeight}async function
|
|
2
|
+
function m(e,t={}){return{enterFrom:t.enterClass||`${e}-enter-from`,enterActive:t.enterActiveClass||`${e}-enter-active`,enterTo:t.enterToClass||`${e}-enter-to`,leaveFrom:t.leaveClass||`${e}-leave-from`,leaveActive:t.leaveActiveClass||`${e}-leave-active`,leaveTo:t.leaveToClass||`${e}-leave-to`}}function u(e){let t=getComputedStyle(e),o=t.transitionDuration||"0s",n=t.animationDuration||"0s",s=(a)=>{let i=a.match(/^([\d.]+)(s|ms)?$/);if(!i)return 0;let r=parseFloat(i[1]);return(i[2]||"s")==="ms"?r:r*1000};return Math.max(s(o),s(n))}function v(e,t){return new Promise((o)=>{let n=t??u(e);if(n===0){o();return}let s=!1,a=()=>{if(s)return;s=!0,e.removeEventListener("transitionend",i),e.removeEventListener("animationend",i),o()},i=(r)=>{if(r.target===e)a()};e.addEventListener("transitionend",i),e.addEventListener("animationend",i),setTimeout(a,n+50)})}function f(e){e.offsetHeight}async function yl(e,t={}){let o=t.name||"stx",n=m(o,t),s=typeof t.duration==="object"?t.duration.enter:t.duration;if(t.onBeforeEnter?.(e),e.classList.add(n.enterFrom),e.classList.add(n.enterActive),f(e),e.classList.remove(n.enterFrom),e.classList.add(n.enterTo),t.onEnter)await new Promise((a)=>{t.onEnter(e,a)});else await v(e,s);e.classList.remove(n.enterActive),e.classList.remove(n.enterTo),t.onAfterEnter?.(e)}async function bl(e,t={}){let o=t.name||"stx",n=m(o,t),s=typeof t.duration==="object"?t.duration.leave:t.duration;if(t.onBeforeLeave?.(e),e.classList.add(n.leaveFrom),e.classList.add(n.leaveActive),f(e),e.classList.remove(n.leaveFrom),e.classList.add(n.leaveTo),t.onLeave)await new Promise((a)=>{t.onLeave(e,a)});else await v(e,s);e.classList.remove(n.leaveActive),e.classList.remove(n.leaveTo),t.onAfterLeave?.(e)}function wl(e,t={},o){let n=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return e.replace(n,(s,a,i)=>{let r=p(a),l=r.name||"stx",c=r.duration||300,d=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
|
|
3
3
|
<div
|
|
4
4
|
class="stx-transition-wrapper"
|
|
5
5
|
data-transition="${l}"
|
|
@@ -41,7 +41,7 @@ function m(e,t={}){return{enterFrom:t.enterClass||`${e}-enter-from`,enterActive:
|
|
|
41
41
|
});
|
|
42
42
|
})();
|
|
43
43
|
</script>
|
|
44
|
-
`})}function p(e){let t={},o=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,n;while((n=o.exec(e))!==null){let s=n[1],a=n[2]||n[3]||n[4]||n[5];switch(s){case"name":t.name=a;break;case"duration":t.duration=parseInt(a,10);break;case"mode":t.mode=a;break;case"easing":t.easing=a;break}}return t}function
|
|
44
|
+
`})}function p(e){let t={},o=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,n;while((n=o.exec(e))!==null){let s=n[1],a=n[2]||n[3]||n[4]||n[5];switch(s){case"name":t.name=a;break;case"duration":t.duration=parseInt(a,10);break;case"mode":t.mode=a;break;case"easing":t.easing=a;break}}return t}function vl(){return`
|
|
45
45
|
/* STX Transition Presets */
|
|
46
46
|
|
|
47
47
|
/* Fade */
|
|
@@ -228,7 +228,7 @@ function m(e,t={}){return{enterFrom:t.enterClass||`${e}-enter-from`,enterActive:
|
|
|
228
228
|
opacity: 1;
|
|
229
229
|
max-height: 1000px;
|
|
230
230
|
}
|
|
231
|
-
`}function
|
|
231
|
+
`}function xl(){return`
|
|
232
232
|
// STX Transition Runtime
|
|
233
233
|
(function() {
|
|
234
234
|
if (typeof window === 'undefined') return;
|
|
@@ -317,5 +317,5 @@ else {
|
|
|
317
317
|
|
|
318
318
|
console.log('[stx] Transition runtime initialized');
|
|
319
319
|
})();
|
|
320
|
-
`}function
|
|
321
|
-
export{
|
|
320
|
+
`}function Sl(e){let t=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return e.replace(t,(o,n,s,a)=>{let i=s||"300",r=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${n}" data-stx-transition-duration="${i}" data-stx-transition-condition="${a}" data-stx-transition-id="${r}"`})}
|
|
321
|
+
export{yl,bl,wl,vl,xl,Sl};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Pn,De,Me,me,Bi,Mn,Z,q,tn,d,r,A}from"./chunk-rj3hyqff.js";function h(o){return o.endsWith(".md")||o.endsWith(".markdown")}function _(o){let e=[];m(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let n=[...e];m(/<code\b[^>]*>[\s\S]*?<\/code>/gi,n);function m(s,p){let u;while((u=s.exec(o))!==null){let t=u.index,i=t+u[0].length;if(p?.some((l)=>t>=l.start&&i<=l.end))continue;e.push({start:t,end:i})}}if(e.length===0)return o;e.sort((s,p)=>s.start-p.start);let a="",c=0;for(let s of e){if(s.start<c)continue;a+=o.slice(c,s.start),a+=`@raw${o.slice(s.start,s.end)}@endraw`,c=s.end}return a+=o.slice(c),a}async function b(o,e={}){let{data:n,content:m}=Pn(o),c=await(e.renderer??((s)=>De(s)))(m);return{html:_(c),frontmatter:n??{}}}import{dirname as C,resolve as R}from"path";function k(o){let e=o,n=Z(o);if(n)e=n.content.trim();let m=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,a=[],c=[],s=[],p=(i)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(i),u;while((u=m.exec(o))!==null){let i=u[1],l=u[2],f=u[0],g=i.includes("server");if(p(l))s.push(f);else if(g)c.push(l);else a.push(f)}let t=e;{let i=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,l,f=[];while((l=i.exec(t))!==null){let g=l.index+l[0].length,x=t.indexOf("</script>",g);if(x===-1)continue;f.push({start:l.index,end:x+9}),i.lastIndex=x+9}for(let g=f.length-1;g>=0;g--)t=t.substring(0,f[g].start)+t.substring(f[g].end)}for(let i of a)t=t.replace(i,"");return{templateContent:t,serverScripts:c,clientScripts:a,signalsScripts:s}}function v(o,e){return`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
@@ -9,10 +9,10 @@ import{Rn,Ie,Oe,ge,Ni,Dn,Z,q,en,d,r,A}from"./chunk-1680nbq4.js";function h(o){re
|
|
|
9
9
|
<body>
|
|
10
10
|
${o}
|
|
11
11
|
</body>
|
|
12
|
-
</html>`}async function
|
|
12
|
+
</html>`}async function vi(o,e={}){let n=R(o),m=Bun.file(n);if(!await m.exists())throw Error(`Template file not found: ${n}`);let a=await m.text(),c=null;if(h(n)){let s=await b(a,{renderer:e.markdownRenderer});a=s.html,c=s.frontmatter}if(c)e={...e,context:{...c,...e.context||{}}};if(e.layout){let s=R(e.layout),p=Bun.file(s);if(!await p.exists())throw Error(`Layout template not found: ${s}`);let{layout:u,injectCSS:t,...i}=e,l={...e.context||{}};tn(l);let f=await S(a,n,{...i,context:{...l,__stx_defer_server_data:!0},injectCSS:!1}),g=await p.text(),x={...l,content:f},w={...i,context:x,injectCSS:t};return S(g,s,w)}return S(a,n,e)}async function S(o,e,n={}){let{templateContent:m,serverScripts:a,clientScripts:c}=k(o),s={...A,...n.options},p={__filename:e,__dirname:C(e),__stx:{},__stx_options:s,__stx_sfc_mode:!0,__stx_inject_css:n.injectCSS===!0,__stxServeContext:void 0,...Mn(n.context??{}),definePageMeta:()=>{},...n.context||{}};for(let i of a)await d(i,p,e);let u=new Set,t=m;if(t=await r(t,p,e,s,u),Bi(p,n.context),n.templateOnly){if(t=t.replace(/<script data-stx-scoped>[\s\S]*?<\/script>\s*/gi,""),t=t.replace(/<!-- stx SEO Tags -->[\s\S]*?(?=<)/i,""),c.length>0)t+=`
|
|
13
13
|
${c.join(`
|
|
14
|
-
`)}`}else{if(n.processClientScripts!==!1&&c.length>0){let i=p.__stx_event_bindings||[],l=
|
|
14
|
+
`)}`}else{if(n.processClientScripts!==!1&&c.length>0){let i=p.__stx_event_bindings||[],l=Me(p),g=(await Promise.all(c.map(async(w)=>{let y=w.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!y)return w;return await me(y[1],{eventBindings:i,templateContent:t,serverData:l,filePath:e})}))).join(`
|
|
15
15
|
`);if(t.match(/(<\/body>)/i))t=t.replace(/(<\/body>)/i,`${g}
|
|
16
16
|
$1`);else t+=`
|
|
17
|
-
${g}`}t=await q(t)}if(n.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=v(t,n.title)}if(n.injectCSS)try{let{injectCss:i}=await import("./chunk-
|
|
18
|
-
export{
|
|
17
|
+
${g}`}t=await q(t)}if(n.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=v(t,n.title)}if(n.injectCSS)try{let{injectCss:i}=await import("./chunk-4488r5j1.js");t=await i(t)}catch{}return t}
|
|
18
|
+
export{vi};
|