@stacksjs/stx 0.2.302 → 0.2.304
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/api-client.d.ts +26 -0
- package/dist/api-client.js +22 -0
- package/dist/api-handler.d.ts +6 -0
- package/dist/api-handler.js +3 -0
- package/dist/app-shell.js +11 -2
- package/dist/application-layers.d.ts +30 -0
- package/dist/application-layers.js +202 -0
- package/dist/build.js +9 -1
- package/dist/chunk-02hm88m5.js +2 -0
- package/dist/{chunk-7eea1cse.js → chunk-09zjty4k.js} +1 -1
- package/dist/{chunk-7nfn7nj9.js → chunk-0gz0rhvs.js} +1 -1
- package/dist/{chunk-jsfch50r.js → chunk-1c2j4eby.js} +1 -1
- package/dist/{chunk-m6wz1hf5.js → chunk-2h94c5hm.js} +2 -2
- package/dist/{chunk-mjpqz66q.js → chunk-2ver2s2y.js} +1 -1
- package/dist/{chunk-2wcd2031.js → chunk-30nbe9hr.js} +2 -2
- package/dist/chunk-39qzhpn6.js +18 -0
- package/dist/chunk-3z6bqqr7.js +2 -0
- package/dist/chunk-43p1qq7g.js +2 -0
- package/dist/{chunk-52rkkkmt.js → chunk-45y8bjrv.js} +287 -352
- package/dist/{chunk-2rp09y5j.js → chunk-4evbx7sz.js} +1 -1
- package/dist/chunk-4jgr954p.js +2 -0
- package/dist/chunk-51j2aqvb.js +2 -0
- package/dist/{chunk-8d15pd4g.js → chunk-54f8bpp6.js} +3 -3
- package/dist/{chunk-cbwp8prr.js → chunk-5k1hznvq.js} +2 -2
- package/dist/chunk-5qfpcgcs.js +2 -0
- package/dist/{chunk-7eg7ep8f.js → chunk-5tefa8qb.js} +2 -2
- package/dist/chunk-5x2fc4vk.js +30 -0
- package/dist/{chunk-683tfkz4.js → chunk-64djh88a.js} +1 -1
- package/dist/{chunk-btrmvj2y.js → chunk-695fkras.js} +1 -1
- package/dist/chunk-6hcc4973.js +2 -0
- package/dist/{chunk-svg37jzs.js → chunk-6vswphz4.js} +2 -2
- package/dist/chunk-7gqbr8nr.js +2 -0
- package/dist/{chunk-x4prtyjs.js → chunk-7kw3grq5.js} +1 -1
- package/dist/{chunk-7jebw3ea.js → chunk-7skk34dh.js} +2 -2
- package/dist/chunk-8215nhej.js +12 -0
- package/dist/chunk-8ee62a9q.js +2 -0
- package/dist/{chunk-jj6yp7gm.js → chunk-8jam44my.js} +1 -1
- package/dist/chunk-8z0n5mtg.js +2 -0
- package/dist/{chunk-3bc8bqw2.js → chunk-9368t9jm.js} +1 -1
- package/dist/chunk-9499k64n.js +6 -0
- package/dist/chunk-976g5qe5.js +2 -0
- package/dist/{chunk-3jwmcf4k.js → chunk-9c835qjn.js} +1 -1
- package/dist/chunk-9px4y692.js +2 -0
- package/dist/{chunk-38t0fxh0.js → chunk-9vqnrcrw.js} +2 -2
- package/dist/chunk-9wrrr7g3.js +4 -0
- package/dist/{chunk-q0y1yxg3.js → chunk-9xzszvn5.js} +1 -1
- package/dist/chunk-a07chbgj.js +2 -0
- package/dist/{chunk-454kar39.js → chunk-ankp4reb.js} +2 -2
- package/dist/{chunk-5d9cy7a0.js → chunk-awj7yy37.js} +1 -1
- package/dist/chunk-b1hd8kvy.js +2 -0
- package/dist/chunk-b4xwbh8a.js +2 -0
- package/dist/{chunk-d6wq91cw.js → chunk-bd9wrcq1.js} +277 -21
- package/dist/{chunk-q25mr70f.js → chunk-c131k3mt.js} +1 -1
- package/dist/chunk-c3tmzx7q.js +2 -0
- package/dist/{chunk-6btbgxh1.js → chunk-c79nfdyj.js} +1 -1
- package/dist/{chunk-cfgpk6bh.js → chunk-cbgh359m.js} +1 -1
- package/dist/chunk-ckzhp09g.js +2 -0
- package/dist/{chunk-weqpt9nt.js → chunk-cr8v8k53.js} +1 -1
- package/dist/{chunk-p3wwm6k4.js → chunk-d19tvdvv.js} +1 -1
- package/dist/{chunk-nb1zdh1y.js → chunk-d3srvh3q.js} +1 -1
- package/dist/{chunk-rqrfq305.js → chunk-d57gb0v2.js} +1 -1
- package/dist/{chunk-1xyhk1wr.js → chunk-d5cqnwdd.js} +1 -1
- package/dist/chunk-dgpjxmhs.js +2 -0
- package/dist/chunk-dvvx1wny.js +3 -0
- package/dist/{chunk-ctz53mbz.js → chunk-ej8mv2k6.js} +1 -1
- package/dist/{chunk-dv3z80gt.js → chunk-env6knrs.js} +1 -1
- package/dist/{chunk-rf10fkrf.js → chunk-ess2pgt5.js} +1 -1
- package/dist/chunk-ez28vck6.js +2 -0
- package/dist/{chunk-0tbgvp70.js → chunk-fczfdsab.js} +21 -5
- package/dist/{chunk-xdq52pwj.js → chunk-fp7ms6e7.js} +1 -1
- package/dist/{chunk-qg6pg6ze.js → chunk-fqq5k9ve.js} +1 -1
- package/dist/chunk-fvtv1s5j.js +3 -0
- package/dist/{chunk-5t0w4h6z.js → chunk-g912mb7x.js} +1 -1
- package/dist/chunk-g97atepq.js +2 -0
- package/dist/{chunk-wj25qt72.js → chunk-gbwhbasw.js} +1 -1
- package/dist/{chunk-38e9wgfc.js → chunk-gfc3qye3.js} +2 -2
- package/dist/{chunk-cratkhhb.js → chunk-ghw5p1yk.js} +1 -1
- package/dist/{chunk-f0g2q51j.js → chunk-gssbag3e.js} +1 -1
- package/dist/{chunk-c9vhtjtr.js → chunk-gt8ja700.js} +2 -2
- package/dist/chunk-hay1rzb0.js +3754 -0
- package/dist/{chunk-q5sw26s7.js → chunk-hg2afckn.js} +1 -1
- package/dist/chunk-hgjjnjas.js +7 -0
- package/dist/{chunk-hhnzd03k.js → chunk-hrcxfvh1.js} +1 -1
- package/dist/chunk-hzav4hyd.js +2 -0
- package/dist/{chunk-29gjwajm.js → chunk-jfzfrmzy.js} +1 -1
- package/dist/chunk-jjq9q9jr.js +2 -0
- package/dist/{chunk-ddqkj56r.js → chunk-jp2f8yzw.js} +1 -1
- package/dist/{chunk-ry3a2674.js → chunk-jsg1rthc.js} +1 -1
- package/dist/chunk-jxxv18a0.js +5 -0
- package/dist/chunk-kbw2qzqx.js +2 -0
- package/dist/chunk-kdxvraec.js +2 -0
- package/dist/chunk-krfjb7b8.js +2 -0
- package/dist/{chunk-6b4k8fay.js → chunk-kxavsh3m.js} +1 -1
- package/dist/{chunk-4tffxxpd.js → chunk-m31n9pkr.js} +1 -1
- package/dist/{chunk-fj6fbqgb.js → chunk-m3a20mmb.js} +1 -1
- package/dist/{chunk-j21csh4j.js → chunk-mbmqpaq1.js} +1 -1
- package/dist/{chunk-y9nyqcha.js → chunk-mwh3ymwc.js} +1 -1
- package/dist/{chunk-51g95yts.js → chunk-mygq61f5.js} +2 -2
- package/dist/chunk-nqq7y7m9.js +3 -0
- package/dist/chunk-nws8fbde.js +2 -0
- package/dist/{chunk-q6xfyasj.js → chunk-pcvayb2f.js} +1 -1
- package/dist/{chunk-nvxv2wxv.js → chunk-ppyz9623.js} +1 -1
- package/dist/chunk-pr14wjkn.js +2 -0
- package/dist/{chunk-jb2r696a.js → chunk-qev11kg8.js} +1 -1
- package/dist/{chunk-6njgsr6w.js → chunk-qeyw5za9.js} +1 -1
- package/dist/chunk-rpfcnq8n.js +2 -0
- package/dist/chunk-rrankpmj.js +3 -0
- package/dist/chunk-rst1rw09.js +2 -0
- package/dist/{chunk-3p0zgfgz.js → chunk-rzevgemj.js} +2 -2
- package/dist/{chunk-aa6kt84c.js → chunk-sart9ehj.js} +1 -1
- package/dist/chunk-sb7ana2z.js +19 -0
- package/dist/chunk-snt2773t.js +2 -0
- package/dist/{chunk-jptkc64r.js → chunk-t3qb9s6s.js} +2 -2
- package/dist/{chunk-w8yac9xp.js → chunk-t41aaehf.js} +1 -1
- package/dist/{chunk-qjkzpd68.js → chunk-t51mwjyq.js} +1 -1
- package/dist/chunk-tt4r8q4v.js +2 -0
- package/dist/chunk-vd3h9z7e.js +2 -0
- package/dist/{chunk-6rzwef28.js → chunk-vd5xvsnv.js} +1 -1
- package/dist/chunk-wbecqx03.js +2 -0
- package/dist/{chunk-dcxtrqfy.js → chunk-wfffa8zm.js} +1 -1
- package/dist/{chunk-22p0ezj6.js → chunk-wx13qmaw.js} +1 -1
- package/dist/chunk-xd5ahrtn.js +2 -0
- package/dist/{chunk-vh0qr8k9.js → chunk-xganfzgn.js} +2 -2
- package/dist/chunk-xq1swv2e.js +2 -0
- package/dist/chunk-xsfwcj6x.js +2 -0
- package/dist/{chunk-91007tan.js → chunk-xwxdwqn9.js} +1 -1
- package/dist/{chunk-634gaa9d.js → chunk-xz3evxqp.js} +1 -1
- package/dist/chunk-xzgvcrnz.js +2 -0
- package/dist/chunk-y2kmm6bt.js +43 -0
- package/dist/{chunk-v8474ah4.js → chunk-y4nzmkea.js} +1 -1
- package/dist/chunk-y7wsk78j.js +3 -0
- package/dist/{chunk-6w8fa3b8.js → chunk-ya5m5vbn.js} +1 -1
- package/dist/{chunk-ps20v1ah.js → chunk-ym3r8ktq.js} +1 -1
- package/dist/chunk-yyebm8q4.js +2 -0
- package/dist/chunk-yyyxt326.js +2 -0
- package/dist/chunk-yz16bgs3.js +28 -0
- package/dist/{chunk-em8p71et.js → chunk-z9ezmjwd.js} +2 -2
- package/dist/chunk-zbtfhxhn.js +2 -0
- package/dist/chunk-zggm7kjd.js +17 -0
- package/dist/{chunk-mdf3jbe6.js → chunk-zhcs8m2a.js} +2 -2
- package/dist/{chunk-f9d27v49.js → chunk-zs5y7xnt.js} +1 -1
- package/dist/cli.js +14 -14
- package/dist/client-script-bundler.js +22 -11
- package/dist/component-contract-checks.d.ts +19 -0
- package/dist/component-contract-checks.js +147 -0
- package/dist/component-contract.d.ts +20 -0
- package/dist/component-contract.js +108 -0
- package/dist/component-model.d.ts +29 -0
- package/dist/component-model.js +59 -0
- package/dist/component-registry.js +7 -64
- package/dist/component-renderer.d.ts +1 -26
- package/dist/component-renderer.js +4 -239
- package/dist/component-resolution.d.ts +21 -0
- package/dist/component-resolution.js +118 -0
- package/dist/component-tags.d.ts +9 -0
- package/dist/component-tags.js +174 -0
- package/dist/composable-loader.d.ts +2 -13
- package/dist/composable-loader.js +15 -26
- package/dist/composables/index.d.ts +1 -0
- package/dist/composables/index.js +1 -0
- package/dist/composables/use-fetch.d.ts +117 -42
- package/dist/composables/use-fetch.js +47 -4
- package/dist/composition-api.d.ts +43 -19
- package/dist/config.d.ts +1 -1
- package/dist/config.js +46 -4
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/database.js +1 -1
- package/dist/dev-server/serve-app.js +57 -17
- package/dist/dev-server/serve-file.js +8 -1
- package/dist/expressions.js +1 -1
- package/dist/imported-signals.js +1 -1
- package/dist/includes.js +8 -2
- package/dist/index.d.ts +11 -0
- package/dist/index.js +7 -0
- package/dist/manifest.d.ts +6 -0
- package/dist/misc-directives.d.ts +2 -0
- package/dist/misc-directives.js +39 -1
- package/dist/process.js +18 -1
- package/dist/production-builder.d.ts +4 -0
- package/dist/production-builder.js +47 -8
- package/dist/production-server.d.ts +4 -1
- package/dist/production-server.js +119 -71
- package/dist/pwa.js +2 -2
- package/dist/render.js +9 -2
- package/dist/route-response-cache.d.ts +7 -0
- package/dist/route-response-cache.js +72 -0
- package/dist/route-rules.d.ts +17 -0
- package/dist/route-rules.js +40 -0
- package/dist/router.d.ts +1 -0
- package/dist/runtime-config-loader.d.ts +5 -0
- package/dist/runtime-config-loader.js +42 -0
- package/dist/runtime-config-server.d.ts +26 -0
- package/dist/runtime-config-server.js +77 -0
- package/dist/runtime-config-types.d.ts +2 -0
- package/dist/runtime-config-types.js +0 -0
- package/dist/runtime-config.d.ts +5 -0
- package/dist/runtime-config.js +9 -0
- package/dist/runtime-globals.js +3 -0
- package/dist/serve.js +32 -10
- package/dist/server-api.d.ts +27 -0
- package/dist/server-api.js +181 -0
- package/dist/server-data.d.ts +17 -0
- package/dist/server-data.js +40 -0
- package/dist/signal-processing.js +2 -2
- package/dist/signals.js +210 -17
- package/dist/ssg.js +2 -2
- package/dist/stx-virtual-ts.d.ts +6 -0
- package/dist/stx-virtual-ts.js +31 -7
- package/dist/stx.d.ts +28 -0
- package/dist/template-compiler.d.ts +1 -0
- package/dist/template-compiler.js +1 -1
- package/dist/template-hydrator.js +15 -4
- package/dist/typecheck.d.ts +1 -0
- package/dist/typecheck.js +4 -3
- package/dist/types/config-types.d.ts +17 -0
- package/dist/utils.js +15 -5
- package/dist/variable-extractor.d.ts +1 -1
- package/dist/variable-extractor.js +12 -1
- package/dist/visual-testing.js +1 -1
- package/dist/vue-template.js +19 -41
- package/package.json +5 -5
- package/stx.d.ts +28 -0
- package/dist/chunk-0p44z42s.js +0 -2
- package/dist/chunk-1na1dvda.js +0 -2
- package/dist/chunk-2yp8ang5.js +0 -2
- package/dist/chunk-35x7s4cr.js +0 -2
- package/dist/chunk-39qnycbc.js +0 -2
- package/dist/chunk-4qj6pq60.js +0 -2
- package/dist/chunk-4r1qdp25.js +0 -19
- package/dist/chunk-4xs545h1.js +0 -2
- package/dist/chunk-70cf5h11.js +0 -2
- package/dist/chunk-7k63nhap.js +0 -28
- package/dist/chunk-7w3dttqh.js +0 -2
- package/dist/chunk-813dt09p.js +0 -2
- package/dist/chunk-9cp3430d.js +0 -2
- package/dist/chunk-ac9vpa5z.js +0 -2
- package/dist/chunk-b26xazrf.js +0 -2
- package/dist/chunk-b2ghmxpj.js +0 -4
- package/dist/chunk-btnky17z.js +0 -12
- package/dist/chunk-c7av0px6.js +0 -2
- package/dist/chunk-cthpzv4p.js +0 -18
- package/dist/chunk-d41b0rqp.js +0 -2
- package/dist/chunk-dkd0bg8g.js +0 -2
- package/dist/chunk-e0s519df.js +0 -2
- package/dist/chunk-ebr2344x.js +0 -3
- package/dist/chunk-ehp6fez3.js +0 -2
- package/dist/chunk-fc5t3cxt.js +0 -2
- package/dist/chunk-g6ttsdz1.js +0 -2
- package/dist/chunk-gd73rpks.js +0 -2
- package/dist/chunk-gv42xz15.js +0 -17
- package/dist/chunk-h3t6fjba.js +0 -2
- package/dist/chunk-h65nep6y.js +0 -2
- package/dist/chunk-h7d01cy7.js +0 -2
- package/dist/chunk-jc57j887.js +0 -2
- package/dist/chunk-k5xtf38q.js +0 -3
- package/dist/chunk-mc4rtf5d.js +0 -2
- package/dist/chunk-me5kq4e6.js +0 -22
- package/dist/chunk-mzf6c0h7.js +0 -2
- package/dist/chunk-n1j7gfe1.js +0 -3
- package/dist/chunk-pczxwdes.js +0 -2
- package/dist/chunk-pq6rabcy.js +0 -3754
- package/dist/chunk-qr59yfq9.js +0 -2
- package/dist/chunk-s454ytp4.js +0 -2
- package/dist/chunk-s4sp78fn.js +0 -2
- package/dist/chunk-shr928nn.js +0 -2
- package/dist/chunk-that7v95.js +0 -2
- package/dist/chunk-vwnnbzsp.js +0 -2
- package/dist/chunk-w63052rn.js +0 -2
- package/dist/chunk-w9kzfesd.js +0 -2
- package/dist/chunk-zwy5e35f.js +0 -30
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Ui as O,Vi as w,Wi as Z}from"./chunk-xwxdwqn9.js";import{gl as R,nl as U,tl as T}from"./chunk-zggm7kjd.js";import{Ho as W,fm as M,gq as k,xr as C}from"./chunk-hay1rzb0.js";import{Nu as E,Ou as L}from"./chunk-kxavsh3m.js";import{Su as B}from"./chunk-rrankpmj.js";import $ from"path";var Y=new Map;function b(Q,z){for(let J of Q.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(J[1])z.add(J[1]);for(let J of Q.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let H of(J[1]??"").split(",")){let K=((H.includes(":")?H.split(":").pop():H)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(K))z.add(K)}for(let J of Q.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let H of(J[1]??"").split(",")){let V=H.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(V))z.add(V)}}async function l(Q){let z;if(Q)z=$.resolve(Q);else{let q=await C();z=$.resolve(q.root||process.cwd(),q.storesDir||"stores")}let J=new Bun.Glob("*.ts"),H=[];try{for await(let q of J.scan({cwd:z,absolute:!0})){let y=$.basename(q,".ts");if(["index","types"].includes(y))continue;if(q.includes(".d.ts"))continue;H.push(q)}}catch{return Z(Y,z,"",""),null}let V=()=>[...new Set([...H,...H.flatMap((q)=>R(q))])],K=O(V()),P=w(Y,z,K);if(P!==void 0)return P||null;if(H.length===0)return Z(Y,z,K,""),null;let A=[];for(let q of H){let y=await Bun.file(q).text();A.push({file:q,hasUseStore:/useStore\s*\(/.test(y)})}A.sort((q,y)=>{if(q.hasUseStore===y.hasUseStore)return 0;return q.hasUseStore?1:-1});let N=A.map((q)=>q.file),G=[],X=new Set,F=k({loader:"ts",target:"browser",define:M()});for(let q of N)try{let y=await Bun.file(q).text(),I=$.basename(q,".ts");if(b(y,X),U(y))y=await T(y,q,{projectRoot:process.cwd(),externalizeUserModules:!1});y=W(y),y=E(y),y=L(y),y=y.replace(/^export\s+(default\s+)?/gm,""),y=F.transformSync(y),G.push(`// Store: ${I}
|
|
3
3
|
${y.trim()}`)}catch(y){console.warn(`[stx] Failed to load store ${q}:`,y)}if(G.length===0)return Z(Y,z,K,""),null;let j=G.join(`
|
|
4
4
|
|
|
5
5
|
`),x=`;(function(){
|
|
@@ -8,4 +8,4 @@ ${B.filter((q)=>!X.has(q)&&new RegExp(`\\b${q}\\b`).test(j)).map((q)=>`var ${q}
|
|
|
8
8
|
`)}
|
|
9
9
|
${j}
|
|
10
10
|
})();`;return K=O(V()),Z(Y,z,K,x),x}function a(){Y.clear()}
|
|
11
|
-
export{l as
|
|
11
|
+
export{l as Pi,a as Qi};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ao as f,Bo as g,Co as h,Do as i,Eo as j,Fo as k,Go as l,Ho as m,vo as a,wo as b,xo as c,yo as d,zo as e}from"./chunk-hay1rzb0.js";import"./chunk-2h94c5hm.js";import"./chunk-8jam44my.js";import"./chunk-t51mwjyq.js";import"./chunk-wfffa8zm.js";import"./chunk-54f8bpp6.js";import"./chunk-4evbx7sz.js";import"./chunk-jxxv18a0.js";import"./chunk-c131k3mt.js";import"./chunk-hgjjnjas.js";import"./chunk-nqq7y7m9.js";import"./chunk-1c2j4eby.js";import"./chunk-kxavsh3m.js";import"./chunk-qev11kg8.js";import"./chunk-rrankpmj.js";import"./chunk-fczfdsab.js";import"./chunk-fp7ms6e7.js";import"./chunk-jp2f8yzw.js";export{m as stripStxRuntimeImports,b as scanScriptTags,l as rewriteStxImportSpecifiers,j as processSignals,h as processScriptSetup,f as preEvalLiteralReactiveIfs,c as parseLoopExpression,d as hasSignalsSyntax,k as findMarkupIndexOutsideScripts,i as extractExports,g as convertSignalLoopsToAttributes,e as convertSignalDirectivesToAttributes,a as clearScriptScanCache};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{$h as a,ai as b,bi as c,ci as d,di as e,ei as f,fi as g,gi as h}from"./chunk-5tefa8qb.js";import"./chunk-t41aaehf.js";import"./chunk-jp2f8yzw.js";export{d as v,a as useForm,g as processHasErrorsDirective,h as processFormValidationDirectives,f as processErrorsDirective,e as processErrorDirective,b as defineForm,c as Validator};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import z from"fs";function B(x){return[...x].sort().map((b)=>{try{let j=z.statSync(b);return`${b}:${j.size}:${j.mtimeMs}`}catch{return`${b}:missing`}}).join(`
|
|
3
3
|
`)}function C(x,b,j){let q=x.get(b);return q!==void 0&&q.signature===j?q.value:void 0}function D(x,b,j,q){return x.set(b,{signature:j,value:q}),q}
|
|
4
|
-
export{B as
|
|
4
|
+
export{B as Ui,C as Vi,D as Wi};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import{Broadcast as D,BroadcastServer as U}from"ts-broadcasting";import{channel as b}from"ts-broadcasting";import{Broadcast as N,BroadcastServer as p}from"ts-broadcasting";var z=null,H=[];function X(){return z}async function Y(j){if(z)return z;let k=j.driver??"bun",q=j.host??"0.0.0.0",G=j.port??6001,J=j.scheme??"ws",E={verbose:j.verbose??!1,driver:k,default:k,connections:{[k]:{driver:k,host:q,port:G,scheme:J}}};return z=new U(E),D.setServer(z),await z.start(),z}async function Z(){for(let j of H)clearInterval(j);if(H.length=0,!z)return;await z.stop(),z=null}async function $(j){let k=await import(j),q=k.default??k;if(typeof q!=="function")throw Error(`routes/channels.ts must export a default function, got ${typeof q}`);let G=0;return q({channel(E,A){if(G++,A.authorize&&z)z.channels.channel(E,A.authorize);if(A.interval&&A.data){let L=A.event??`${E}.updated`,M=A.data,Q=setInterval(async()=>{try{let T=await M();V(E,L,T)}catch{}},A.interval);H.push(Q)}}}),G}var K=!1;function F(){if(z)return!0;if(!K)K=!0,console.warn("[stx] broadcast() called before server started \u2014 messages will be sent once broadcasting is ready");return!1}function V(j,k,q){if(!F())return;D.send(j,k,q)}function x(j,k,q){if(!F())return;D.toUser(j,k,q)}function C(j,k,q){if(!F())return;D.toUsers(j,k,q)}function S(j,k,q){if(!F())return;D.send(`private-${j}`,k,q)}function w(j,k,q){if(!F())return;D.presence(j,k,q)}
|
|
3
|
-
export{X as
|
|
3
|
+
export{X as Jg,Y as Kg,Z as Lg,$ as Mg,V as Ng,x as Og,C as Pg,S as Qg,w as Rg,b as Sg,N as Tg,p as Ug};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{do as f,em as e,eo as h,fo as u,go as l,oo as m}from"./chunk-hay1rzb0.js";import{ht as D}from"./chunk-t51mwjyq.js";import{Su as g}from"./chunk-rrankpmj.js";import JJ from"path";import C from"fs";import S from"path";function k(K,Z,$,J){let Q=0;for(let j=Z;j<K.length;j++)if(K[j]===$)Q++;else if(K[j]===J&&!(J===">"&&K[j-1]==="=")){if(--Q===0)return j}return-1}function WJ(K){let Z=D(K),$=0,J=0,Q=[];for(let j=0;j<Z.length;j++)if("([{".includes(Z[j]))$++;else if(")]}".includes(Z[j]))$--;else if(Z[j]===","&&$===0)Q.push(K.slice(J,j).trim()),J=j+1;return Q.push(K.slice(J).trim()),Q}function R(K,Z){let $=D(K),J=new RegExp(`\\b(?:${Z.map((Q)=>Q.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let Q of $.matchAll(J)){let j=Q.index+Q[0].length,G="";if($[j]==="<"){let U=k($,j,"<",">");if(U<0)continue;G=K.slice(j+1,U),j=U+1;while(/\s/.test($[j]||"")&&j<$.length)j++}if($[j]!=="(")continue;let W=k($,j,"(",")");if(W>=0)return{type:G,args:WJ(K.slice(j+1,W))}}return null}var x=`
|
|
3
|
+
type __StxCtor<T> = T extends StringConstructor ? string : T extends NumberConstructor ? number : T extends BooleanConstructor ? boolean : T extends ArrayConstructor ? unknown[] : T extends ObjectConstructor ? object : T extends readonly unknown[] ? __StxCtor<T[number]> : T extends abstract new (...args: any[]) => infer V ? V : unknown;
|
|
4
|
+
type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
|
|
5
|
+
type __StxOption<T> = T extends { type: infer C } ? __StxCtor<C> : T extends { default: infer D } ? D extends (...args: any[]) => infer V ? V : __StxWiden<D> : __StxCtor<T>;
|
|
6
|
+
type __StxRequired<O> = { [K in keyof O]-?: O[K] extends { required: true } ? K : never }[keyof O];
|
|
7
|
+
type __StxDefaulted<O> = { [K in keyof O]-?: O[K] extends { default: unknown } ? K : never }[keyof O];
|
|
8
|
+
type __StxOptions<O> = { [K in Exclude<__StxRequired<O>, __StxDefaulted<O>>]: __StxOption<O[K]> } & { [K in Exclude<keyof O, Exclude<__StxRequired<O>, __StxDefaulted<O>>>]?: __StxOption<O[K]> };
|
|
9
|
+
type __StxDefaults<P, K> = Omit<P, Extract<keyof P, K>> & Partial<Pick<P, Extract<keyof P, K>>>;
|
|
10
|
+
`;function b(K,Z){let $=[],J={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},Q=D(K),j=K.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(F,H,q,B,Y)=>{if(Q.slice(Y,Y+6)!=="import")return F;if(B.endsWith(".stx"))return"";let N=`${Z}Import${$.length}`;if($.push(`import * as ${N} from ${JSON.stringify(B)};`),H.startsWith("*"))return`import ${H.replace(/^\*\s+as\s+/,"")} = ${N};`;if(!H.startsWith("{"))return`import ${H} = ${N}.default;`;return H.slice(1,-1).split(",").map((M)=>{let[w,O=w]=M.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!w)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(B)&&w in J)J[w].push(O);return`import ${O} = ${N}.${w};`}).join(`
|
|
11
|
+
`)}),G=R(K,J.defineProps),W=R(K,J.defineEmits),U=R(K,J.withDefaults);if(!G&&!W)return{declarations:"",props:null,events:null};let z=[],V=null,X=null;if(G){z.push(`const __options = (${G.args[0]||"{}"}) as const;`),z.push(`const __defaults = (${U?.args[1]||"{}"});`);let F=G.type||"__StxOptions<typeof __options>";z.push(`export type __StxProps = __StxDefaults<${F}, keyof typeof __defaults | __StxDefaulted<typeof __options>>;`),V=`${Z}.__StxProps`}if(W)z.push(`const __events = (${W.args[0]||"[]"}) as const;`),z.push(`export type __StxEvents = ${W.type||"Record<(typeof __events)[number], any[]>"};`),X=`${Z}.__StxEvents`;return{declarations:`${$.join(`
|
|
12
|
+
`)}
|
|
13
|
+
namespace ${Z} {
|
|
14
|
+
${j}
|
|
15
|
+
${z.join(`
|
|
16
|
+
`)}
|
|
17
|
+
}`,props:V,events:X}}function*UJ(K){let Z=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,$;while($=Z.exec(K)){let J=Z.lastIndex,Q=[];while(J<K.length){while(/\s/.test(K[J]||""))J++;if(K[J]===">"||K.slice(J,J+2)==="/>"){J+=K[J]===">"?1:2;break}let j=/^[^\s=/>]+/.exec(K.slice(J))?.[0];if(!j){J++;continue}let G=J;J+=j.length;while(/\s/.test(K[J]||""))J++;if(K[J]!=="="){Q.push({name:j,value:!0,offset:G,braced:!1});continue}J++;while(/\s/.test(K[J]||""))J++;let W=K[J],U=W==="{",z=W==='"'||W==="'";if(z||U)J++;let V=J;if(U){let X=D(K.slice(J)),F=1,H=0;for(;H<X.length;H++){if(X[H]==="{")F++;if(X[H]==="}"&&--F===0)break}J+=H}else if(z)while(J<K.length&&K[J]!==W)J++;else while(J<K.length&&!/[\s/>]/.test(K[J]))J++;if(Q.push({name:j,value:K.slice(V,J),offset:V,braced:U}),z||U)J++}Z.lastIndex=J,yield{name:$[1],offset:$.index,attributes:Q}}}function p(K,Z,$){let J=[],Q=[x,"type __StxAssignedValue<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? T extends () => infer V ? V : T : T;","type __StxProp<P, K> = K extends keyof P ? P[K] : unknown;",'type __StxEvent<E, K> = K extends keyof E ? E[K] extends readonly unknown[] ? Exclude<E[K]["length"], 0 | 1> extends never ? E[K][0] : E[K] : E[K] : any;'],j=new Map,G=new Map,W=new Map,U=$.scriptCode(K,$.filePath),z=D(U);for(let q of U.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(z.slice(q.index,q.index+6)!=="import")continue;let B=q[2],Y=S.isAbsolute(B)||B.startsWith(".")?S.resolve(S.dirname($.filePath),B):h(B,S.dirname($.filePath));if(!Y)continue;let N=Y.endsWith(".stx")?Y:C.existsSync(`${Y}.stx`)?`${Y}.stx`:void 0,M=N?null:f(Y,!1),w=q[1].startsWith("{")?q[1].slice(1,-1).split(","):[q[1]];for(let O of w){let[L,P=L]=O.trim().split(/\s+as\s+/),I=N||M?.get(L)||M?.get(L.toLowerCase());if(I)W.set(P,I),W.set(P.toLowerCase(),I),W.set(P.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),I)}}for(let q of Z.matchAll(/@import\s*\(([^)]+)\)/g))for(let B of q[1].matchAll(/['"]([^'"]+)['"]/g)){let Y=u(B[1],$.filePath,$).find((N)=>C.statSync(N,{throwIfNoEntry:!1})?.isFile());if(Y)W.set(S.basename(B[1]).replace(/\.stx$/,""),Y)}let V={__importedComponents:W},X=new Map,F=(q,B,Y)=>{let N=K.slice(0,q);return{code:B,offset:q,attribute:Y,anchor:!0,kind:"directive",line:N.split(`
|
|
18
|
+
`).length,column:q-N.lastIndexOf(`
|
|
19
|
+
`)}},H=(q,B,Y)=>J.push({expression:q,statement:{text:B+q.code+Y,prefixLength:B.length}});for(let q of UJ(Z)){if(m(q.name)||q.name==="component")continue;let B=l(q.name,$.filePath,$,V);if(!B)continue;let Y=X.get(B);if(!Y){let M;try{M=$.readComponent?$.readComponent(B):C.readFileSync(B,"utf8")}catch{continue}if(M===void 0)continue;G.set(B,M),Y=b($.scriptCode(M,B),`__StxComponent${X.size}`),X.set(B,Y),Q.push(Y.declarations)}let N=[];for(let M of q.attributes){let{name:w,offset:O}=M,L=M.value===!0?"true":M.value;if(w.startsWith("@")||w.startsWith("v-on:")){if(Y.events&&M.value!==!0)j.set(O,`__StxEvent<${Y.events}, ${JSON.stringify(w.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let P=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(w);if(w.startsWith("v-")&&!w.startsWith("v-bind:")&&!P)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(w))continue;let I=(P?P[1]||"modelValue":w.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(TJ,zJ)=>zJ.toUpperCase());if(N.push(I),!Y.props)continue;let jJ=w.startsWith(":")||w.startsWith("v-bind:")||!!P||M.braced?L:M.value!==!0?JSON.stringify(L):"true";H(F(O,jJ,w),";void ((",`) satisfies __StxProp<${Y.props}, ${JSON.stringify(I)}>);`)}if(Y.props){let M=[...new Set(N)].map((O)=>`${JSON.stringify(O)}: undefined as any`).join(", "),w=F(q.offset,`<${q.name}>`);J.push({expression:w,statement:{text:`;void ({ ${M} } satisfies ${Y.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:X.size?Q.join(`
|
|
20
|
+
`):"",checks:J,events:j,dependencies:G}}var d=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function GJ(K){let Z=($)=>$.replace(/[^\n]/g," ");return K.replace(/<!--[\s\S]*?-->/g,Z).replace(/\{\{--[\s\S]*?--\}\}/g,Z)}function c(K){let Z=[],$=GJ(K);d.lastIndex=0;let J;while((J=d.exec($))!==null){let Q=(J[1]||"").trim(),j=(J[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,G=(J[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,W=J.index+j,U=J.index+J[0].length-G,z=K.slice(W,U);if(/\bsrc\s*=/.test(Q))continue;let V=Q.match(/\btype\s*=\s*["']([^"']+)["']/i);if(V&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(V[1]))continue;let X=/\bserver\b/.test(Q)?"server":/\bclient\b/.test(Q)?"client":"plain",F=_(K,W);Z.push({kind:X,code:z,startLine:F,attrs:Q})}return Z}function _(K,Z){let $=1;for(let J=0;J<Z&&J<K.length;J++)if(K.charCodeAt(J)===10)$++;return $}function T(K,Z){let $=K.lastIndexOf(`
|
|
21
|
+
`,Z-1)+1;return Z-$+1}function y(K){let Z=K.split(""),$=(Q,j)=>{for(let G=Q;G<j&&G<Z.length;G++)if(Z[G]!==`
|
|
22
|
+
`)Z[G]=" "},J=[/<script(?:\s[^>]*)?>[\s\S]*?<\/script>/gi,/<style(?:\s[^>]*)?>[\s\S]*?<\/style>/gi,/<!--[\s\S]*?-->/g,/\{\{--[\s\S]*?--\}\}/g,/@verbatim\b[\s\S]*?@endverbatim\b/g];for(let Q of J){Q.lastIndex=0;let j;while((j=Q.exec(K))!==null)$(j.index,j.index+j[0].length)}return Z.join("")}function FJ(K){let Z=0,$="";for(let J=0;J<K.length;J++){let Q=K[J];if($){if(Q==="\\"){J++;continue}if(Q===$)$="";continue}if(Q==='"'||Q==="'"||Q==="`"){$=Q;continue}if(Q==="("||Q==="["||Q==="{"){Z++;continue}if(Q===")"||Q==="]"||Q==="}"){Z--;continue}if(Q==="|"&&Z===0){if(K[J+1]==="|"){J++;continue}if(K[J-1]==="|")continue;return K.slice(0,J)}}return K}var KJ=new Set([":for","x-for","v-for"]),A=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,E="__stx_interpolated",i="__StxElement",QJ="__StxTemplateValue",XJ=`type ${QJ}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function n(K){return K.replace(/\{\{[\s\S]*?\}\}/g,E).replace(/\{!![\s\S]*?!!\}/g,E)}function nJ(K){return K.replace(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/g,(Z)=>{let $=Z.split(`
|
|
23
|
+
`).length-1,J=Z.length-$;return`0${" ".repeat(Math.max(0,J-1))}${`
|
|
24
|
+
`.repeat($)}`})}var VJ=["foreach","endforeach","forelse","endforelse","for","endfor","while","endwhile","empty","if","elseif","else","endif","unless","endunless","isset","endisset","switch","case","default","endswitch","auth","endauth","guest","endguest","env","endenv","once","endonce","break","continue"],HJ=new RegExp(String.raw`^[ \t]*@(?:${VJ.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function rJ(K){return K.replace(HJ,(Z)=>Z.replace(/[^\n]/g," "))}var r=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function YJ(K){let Z=y(K),$=[],J=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,Q;while((Q=J.exec(Z))!==null){if(Q[1]||Q[3])continue;let G=Q[2]??Q[4]??"",W=Q[2]!==void 0?2:3,U=FJ(G);if(!U.trim())continue;let z=Q.index+W+(U.length-U.trimStart().length);$.push({code:U.trim(),line:_(Z,z),column:T(Z,z),offset:z,kind:"interpolation"})}A.lastIndex=0;while((Q=A.exec(Z))!==null){let j=Q[1],G=Q[3]??"",W=j.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(r.has(W)||r.has(j))continue;if(!G.trim())continue;let U=Q.index+Q[0].indexOf(Q[2],Q[0].indexOf(j)+j.length)+1;if(KJ.has(W)){let V=G.match(/\s+(?:in|of)\s+/);if(!V||V.index===void 0)continue;let X=G.slice(V.index+V[0].length),F=V.index+V[0].length+(X.length-X.trimStart().length);$.push({code:n(X.trim()),line:_(Z,U+F),column:T(Z,U+F),offset:U+F,kind:"directive",attribute:W});continue}let z=G.length-G.trimStart().length;$.push({code:n(G.trim()),line:_(Z,U+z),column:T(Z,U+z),offset:U+z,kind:"directive",attribute:W})}return $.sort((j,G)=>j.line-G.line||j.column-G.column),$}var qJ=2000;function BJ(K,Z){let $=0,J=Math.min(K.length,Z+qJ);for(let Q=Z;Q<J;Q++){let j=K[Q];if(j==="(")$++;else if(j===")"){if($--,$===0)return K.slice(Z+1,Q)}}return null}function wJ(K){let Z=new Map,$=(W,U)=>{let z=W.split(/[,[\]{}()\s]+/).filter(Boolean);for(let V of z){let X=V.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(X))continue;let F=z.length===1?U:void 0,H=Z.get(X);if(!H)Z.set(X,{name:X,iterable:F});else if(H.iterable!==F)H.iterable=void 0}},J=/^\$?[A-Z_$][\w$]*$/i,Q=(W)=>{let U=W.trim();return J.test(U)?U:void 0};for(let W of K.matchAll(/@for(?:each|else)\s*\(/g)){let U=BJ(K,W.index+W[0].length-1);if(U===null)continue;let z=U.match(/^([\s\S]*?)\bas\b([\s\S]*)$/);if(!z)continue;$(z[2].replace(/=>/g," "),Q(z[1]))}for(let W of K.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)/g))$(W[1]);let j=y(K);A.lastIndex=0;let G;while((G=A.exec(j))!==null){let W=G[1].replace(/\..*$/,"");if(!KJ.has(W))continue;let U=G[3].match(/\s+(?:in|of)\s+/);if(!U||U.index===void 0)continue;$(G[3].slice(0,U.index),Q(G[3].slice(U.index+U[0].length)))}for(let W of K.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let U of W[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))$(U[1]);return[...Z.values()].sort((W,U)=>W.name.localeCompare(U.name))}function v(K){let Z=new Set;for(let $ of K.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s+([\w$]+)/gm))Z.add($[1]);for(let $ of K.matchAll(/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([\w$]+)/gm))Z.add($[1]);for(let $ of K.matchAll(/^\s*(?:export\s+)?class\s+([\w$]+)/gm))Z.add($[1]);for(let $ of K.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s*[[{]([^\]}]*)[\]}]/gm))for(let J of $[1].split(",")){let Q=J.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(Q))Z.add(Q)}return[...Z].sort()}function MJ(){return["declare var window: any",...g.map((K)=>`declare var ${K}: any`)].join(`
|
|
25
|
+
`)}var NJ=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"];function DJ(){return NJ.map((K)=>`declare var ${K}: any`).join(`
|
|
26
|
+
`)}function ZJ(K){let Z=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,$,J=!1,Q=new Set,j=D(K);while(($=Z.exec(j))!==null){J=!0;for(let G of OJ($[1])){let W=G.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(W))Q.add(W)}}return J?[...Q]:null}function OJ(K){let Z=[],$=0,J="";for(let Q of K){if(Q===","&&$===0){Z.push(J),J="";continue}if(Q==="("||Q==="["||Q==="{")$++;else if(Q===")"||Q==="]"||Q==="}")$--;J+=Q}return Z.push(J),Z.filter((Q)=>Q.trim().length>0)}function PJ(K){let Z=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,$=[],J=K.replace(Z,(Q)=>{return $.push(Q.trim()),Q.split(`
|
|
27
|
+
`).map(()=>"").join(`
|
|
28
|
+
`)});return{imports:$.join(`
|
|
29
|
+
`),body:J}}function $J(K){let Z=D(K),$=Array(Z.length),J=0;for(let W=0;W<Z.length;W++){let U=Z[W];if(U==="}"||U===")"||U==="]")J=Math.max(0,J-1);if($[W]=J,U==="{"||U==="("||U==="[")J++}let Q=[],j=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,G;while((G=j.exec(Z))!==null){if($[G.index]!==0)continue;let W=G[1],U=G[2],z;if(W==="interface"){let V=Z.indexOf("{",G.index);if(V===-1)continue;let X=0;z=-1;for(let F=V;F<Z.length;F++)if(Z[F]==="{")X++;else if(Z[F]==="}"&&--X===0){z=F+1;break}if(z===-1)continue}else{let V=0;z=Z.length;for(let X=Z.indexOf("=",G.index)+1;X<Z.length;X++){let F=Z[X];if(F==="{"||F==="["||F==="("||F==="<")V++;else if(F==="}"||F==="]"||F===")"||F===">")V--;else if(V<=0&&(F===";"||F===`
|
|
30
|
+
`&&!/[=|&,<([{]\s*$/.test(Z.slice(Math.max(0,X-40),X)))){z=F===";"?X+1:X;break}}}Q.push({name:U,text:K.slice(G.index,z).replace(/^[ \t]*export[ \t]+/,"")}),j.lastIndex=z}return Q}function IJ(K){return new Set($J(K).map((Z)=>Z.name))}function aJ(K,Z=""){let $=ZJ(K),J=IJ(Z),Q=$J(K).filter((z)=>!J.has(z.name)).map((z)=>z.text);if(!$){let z=v(K);if(z.length===0&&Q.length===0)return"";return["",`// ${SJ}`,...Q,...z.map((V)=>`declare var ${V}: any`)].join(`
|
|
31
|
+
`)}if($.length===0)return Q.length>0?["",`// ${a}`,...Q].join(`
|
|
32
|
+
`):"";let{imports:j,body:G}=PJ(K),W=G.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),U=["",`// ${a}`];if(j)U.push(j);return U.push(...Q),U.push(`async function ${o}() {`,W,` return { ${$.join(", ")} }`,"}",`type ${t} = Awaited<ReturnType<typeof ${o}>>`,...$.map((z)=>`declare var ${z}: ${t}[${JSON.stringify(z)}]`)),U.join(`
|
|
33
|
+
`)}function LJ(K){let $=D(K).split(""),J=0;for(let Q=0;Q<$.length;Q++){let j=$[Q];if(j==="{"||j==="("||j==="["){J++;continue}if(j==="}"||j===")"||j==="]"){J=Math.max(0,J-1);continue}if(J>0&&j!==`
|
|
34
|
+
`)$[Q]=" "}return v($.join(""))}function oJ(K,Z){if(ZJ(K)!==null)return[];let $=D(Z),J=new Set(g);return LJ(K).filter((Q)=>{if(J.has(Q))return!1;if(v(Z).includes(Q))return!1;return new RegExp(`(?<![.#\\w$])${Q}(?![\\w$])`).test($)})}var a="stx: types for the declared client payload (#1868)",SJ="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",o="__stxServerScope",t="__StxClientPayload";var vJ=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","props","slot"];var _J=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function yJ(K,Z){let $=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,J=[],Q;while((Q=$.exec(K))!==null){if(Q.index>=Z)break;let j=Q[1];if(j==="endif"||j==="endunless"){J.pop();continue}let G="";if(Q[2]==="("){let W=0,U=Q.index+Q[0].length-1,z=U+1;for(;U<K.length;U++){let V=K[U];if(V==="(")W++;else if(V===")"){if(W--,W===0)break}}G=K.slice(z,U).trim(),$.lastIndex=U+1}if(j==="if")J.push({seen:[],current:G});else if(j==="unless")J.push({seen:[],current:`!(${G})`});else if(j==="elseif"||j==="else"){let W=J[J.length-1];if(!W)continue;if(W.current)W.seen.push(W.current);W.current=j==="elseif"?G:null}}return J.flatMap((j)=>[...j.seen.map((G)=>`!(${G})`),...j.current?[j.current]:[]]).filter(Boolean)}function AJ(K){let Z=K.code.trim();if(!Z)return null;if(K.attribute?.startsWith("@")){if(_J.test(Z))return null;let J=";(($event: any): void => { ";return{text:`${J}${Z} });`,prefixLength:J.length}}let $=";void ((";return{text:`${$}${Z}));`,prefixLength:$.length}}var RJ=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function s(K,Z){if(!Z)return K;return K.replace(RJ,($,J,Q,j)=>{let G=JJ.resolve(Z,j).replace(/\\/g,"/");return`${J}${Q}${G}${Q}`})}function tJ(K,Z={}){let $=c(K),J=K.split(`
|
|
35
|
+
`),Q=Array.from({length:J.length},()=>""),j=new Map,G=Z.filePath&&Z.templateExpressions!==!1?p(K,y(K),{filePath:Z.filePath,componentsDir:Z.componentsDir,projectRoot:Z.projectRoot,readComponent:Z.readComponent,scriptCode:(U,z)=>c(U).map((V)=>s(V.code,JJ.dirname(z))).join(`
|
|
36
|
+
`)}):void 0;for(let U of $)s(U.code,Z.originDir??"").split(`
|
|
37
|
+
`).forEach((V,X)=>{let F=U.startLine-1+X;if(F<Q.length)Q[F]=V});let W=(U,z)=>{for(let[V,X]of U.split(`
|
|
38
|
+
`).entries())if(Q.push(X),z)j.set(Q.length,V===0?z:{...z,line:z.line+V,column:1,prefixLength:0})};if(Z.globals!==!1){if(W(""),Z.runtimeGlobals!==!1)for(let z of MJ().split(`
|
|
39
|
+
`))W(z);for(let z of DJ().split(`
|
|
40
|
+
`))W(z);for(let z of e)W(`declare var ${z}: any`);for(let z of vJ)W(`declare var ${z}: any`);W(`declare var ${E}: any`);let U=new Set($.flatMap((z)=>v(z.code)));W(`type ${i}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let z of wJ(K)){if(U.has(z.name))continue;let V=z.iterable&&U.has(z.iterable)?`${i}<typeof ${z.iterable}>`:"any";W(`declare var ${z.name}: ${V}`)}}if(Z.templateExpressions!==!1){if(G?.declarations)for(let z of G.declarations.split(`
|
|
41
|
+
`))W(z);let U=YJ(K).map((z)=>{let V=G?.events.get(z.offset??-1);if(V){z.anchor=!0;let X=z.code.trim(),F=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(X),H=F?`void ((${F[2]}) satisfies __StxAssignedValue<typeof ${F[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(X)?`${X}($event)`:X,q=`;(($event: ${V}): void => { `;return{expression:z,statement:{text:`${q}${H} });`,prefixLength:q.length}}}return{expression:z,statement:AJ(z)}}).filter((z)=>z.statement!==null);if(U.push(...G?.checks||[]),U.length>0){let z=y(K),X=[...new Set($.flatMap((H)=>v(H.code)))].filter((H)=>/^[A-Z_$][\w$]*$/i.test(H)),F=0;if(X.length>0){W(XJ);for(let H of X)W(`type __StxT_${H} = ${QJ}<typeof ${H}>`);W(`;((${X.map((H)=>`${H}: __StxT_${H}`).join(", ")}) => {`),F=1}for(let{expression:H,statement:q}of U){let B=" ".repeat(F),Y=H.offset===void 0?[]:yJ(z,H.offset),N=Y.length>0?`${Y.map((w)=>`if (${w}) `).join("")}{ `:"",M=Y.length>0?" }":"";W(B+N+q.text+M,{line:H.line,column:H.column,expression:H,prefixLength:q.prefixLength+B.length+N.length})}if(F>0)W("});")}}return W("export {}"),{text:Q.join(`
|
|
42
|
+
`),lineMap:j,sourceLineCount:J.length,componentDependencies:G?.dependencies}}function sJ(K,Z,$){let J=K.lineMap.get(Z);if(!J)return Z<=K.sourceLineCount?{line:Z,column:$}:null;let Q=J.expression?.anchor?0:Math.max(0,$-1-(J.prefixLength??0));return{line:J.line,column:J.column+Q,expression:J.expression}}
|
|
43
|
+
export{c as Xf,nJ as Yf,rJ as Zf,YJ as _f,v as $f,DJ as ag,aJ as bg,oJ as cg,s as dg,tJ as eg,sJ as fg};
|
|
@@ -318,4 +318,4 @@ else {
|
|
|
318
318
|
console.log('[stx] Transition runtime initialized');
|
|
319
319
|
})();
|
|
320
320
|
`}function $(b){let j=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return b.replace(j,(B,q,A,z)=>{let F=A||"300",G=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${q}" data-stx-transition-duration="${F}" data-stx-transition-condition="${z}" data-stx-transition-id="${G}"`})}
|
|
321
|
-
export{W as
|
|
321
|
+
export{W as li,X as mi,Y as ni,Z as oi,_ as pi,$ as qi};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Hg as I}from"./chunk-dvvx1wny.js";import{xr as H}from"./chunk-hay1rzb0.js";import{cw as G}from"./chunk-jp2f8yzw.js";import L from"path";async function Q(k={}){let J=performance.now(),A=k.root||process.cwd(),j=await H(A),B=k.ssr?.routeRules??j.routeRules??{};if(I(B),!j.ssr&&Object.keys(B).length)throw Error("routeRules require ssr: true and the production server; flat SSG output cannot apply request/cache policies");if(!j.ssr&&(k.ssr?.serverApi??j.serverApi))throw Error("serverApi requires ssr: true; flat SSG output cannot execute API endpoints");let q=j.ssr?"ssr":"ssg";console.log(`[stx build] Mode: ${q.toUpperCase()}${j.ssr?" (ssr: true in stx.config.ts)":" (default \u2014 ssr is false)"}`);let D,E;if(q==="ssg"){let{generateStaticSite:z}=await import("./ssg.js");D=await z({pagesDir:L.join(j.root||".",j.pagesDir||j.build?.pagesDir||"pages"),publicDir:j.publicDir||j.build?.publicDir||"public",outputDir:j.build?.outputDir||"dist",generate404:j.build?.generate404??!0,minify:j.build?.minify??!0,cleanOutput:j.build?.cleanOutput??!0,router:j.router,...k.ssg})}else{let{buildForProduction:z}=await import("./chunk-kbw2qzqx.js");E=await z({root:A,outputDir:".output",debug:k.debug,...k.ssr})}let K=Math.round(performance.now()-J);return{mode:q,ssg:D,ssr:E,duration:K}}
|
|
3
|
+
export{Q as Ue};
|
|
@@ -27,4 +27,4 @@ Check your site ID or create a new site at https://app.netlify.com`,"SITE_NOT_FO
|
|
|
27
27
|
`))Q+=`
|
|
28
28
|
`}Q+=`NETLIFY_SITE_ID=${K.siteId}
|
|
29
29
|
`,await Bun.write(W,Q)}return{configPath:V,siteId:K.siteId}}class R extends Error{code;constructor(K,L){super(K);this.name="DeployError",this.code=L}}function d(K){let L=process.platform,V=L==="darwin"?"open":L==="win32"?"start":"xdg-open";Bun.spawn([V,K],{stdio:["ignore","ignore","ignore"]})}
|
|
30
|
-
export{D as
|
|
30
|
+
export{D as Ze,h as _e,x as $e,T as af,v as bf,z as cf,N as df,u as ef,j as ff,q as gf,b as hf,P as if,n as jf,i as kf,R as lf};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ue as a}from"./chunk-y7wsk78j.js";import"./chunk-dvvx1wny.js";import"./chunk-hay1rzb0.js";import"./chunk-2h94c5hm.js";import"./chunk-8jam44my.js";import"./chunk-t51mwjyq.js";import"./chunk-wfffa8zm.js";import"./chunk-54f8bpp6.js";import"./chunk-4evbx7sz.js";import"./chunk-jxxv18a0.js";import"./chunk-c131k3mt.js";import"./chunk-hgjjnjas.js";import"./chunk-nqq7y7m9.js";import"./chunk-1c2j4eby.js";import"./chunk-kxavsh3m.js";import"./chunk-qev11kg8.js";import"./chunk-rrankpmj.js";import"./chunk-fczfdsab.js";import"./chunk-fp7ms6e7.js";import"./chunk-jp2f8yzw.js";export{a as buildApp};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ui as x,Vi as F,Wi as R}from"./chunk-xwxdwqn9.js";import{fm as K,gq as T,xr as k}from"./chunk-hay1rzb0.js";import{Nu as y,Ou as N}from"./chunk-kxavsh3m.js";import{Su as v}from"./chunk-rrankpmj.js";import j from"path";var P=new Map,E=new Map,h=["composables","functions"];function D(q){let z=j.basename(q,".ts");return z==="index"||z==="types"||q.endsWith(".d.ts")}async function f(q){if(q)return j.resolve(q);let z=`<default>:${process.cwd()}`,W=E.get(z);if(W!==void 0)return W;let H=await u();if(H!==null)E.set(z,H);return H}async function u(){let q=await k(),z=q.root||process.cwd(),W=q.composablesDir;if(W)return j.resolve(z,W);for(let H of h){let Q=j.resolve(z,H);try{let V=new Bun.Glob("**/*.ts");for await(let Z of V.scan({cwd:Q,absolute:!0}))if(!D(Z))return Q}catch{}}return null}async function b(q){let z=Array.isArray(q)?q:q?[j.resolve(q)]:(await k())._layerComposableDirs??[await f()].filter((H)=>!!H),W=new Map;for(let H of z){let Q=new Bun.Glob("**/*.ts");try{for await(let V of Q.scan({cwd:H,absolute:!0})){let Z=j.relative(H,V);if(!D(V)&&!W.has(Z))W.set(Z,V)}}catch{}}return{key:z.join("\x00"),files:[...W.values()].sort()}}async function o(q){let{files:z}=await b(q),W=T({loader:"ts",target:"browser",define:K()}),H=[];for(let Q of z)try{let V=await Bun.file(Q).text(),Z=W.scan(V).exports.filter(($)=>$!=="default");if(Z.length>0)H.push({file:Q,names:Z})}catch{}return H}function p(q,z){return new RegExp(`\\b${z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(q)}function m(q,z,W){let H=new Map;for(let{file:$,names:G}of q)for(let O of G)if(!H.has(O))H.set(O,$);let Q=($)=>{let G=[];for(let[O,U]of H)if(p($,O))G.push(U);return G},V=new Set,Z=W.flatMap(Q);while(Z.length>0){let $=[];for(let G of Z){if(V.has(G))continue;V.add(G);for(let O of Q(z.get(G)??""))if(!V.has(O))$.push(O)}Z=$}return V}async function e(q,z,W){let{key:H,files:Q}=await b(q);if(!H)return null;let V=x(Q);if(Q.length===0)return R(P,H,V,""),null;Q.sort();let Z=T({loader:"ts",target:"browser",define:K()}),$=new Map,G=[];for(let J of Q)try{let Y=await Bun.file(J).text();$.set(J,Y);let L=Z.scan(Y).exports.filter((X)=>X!=="default");if(L.length>0)G.push({file:J,names:L})}catch{$.set(J,"")}let O=z===void 0?new Set(Q):m(G,$,W?[z,...W]:[z]);if(O.size===0)return null;let U=Q.filter((J)=>O.has(J)),A=`${H}\x00${U.join("\x00")}`,B=F(P,A,V);if(B!==void 0)return B||null;let M=[],w=new Set,I=new Set;for(let J of U)try{let Y=$.get(J)??await Bun.file(J).text(),L=j.basename(J,".ts");for(let X of Y.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(X[1])I.add(X[1]);try{for(let X of Z.scan(Y).exports)if(X!=="default")w.add(X)}catch{}Y=y(Y),Y=N(Y),Y=Y.replace(/^export\s+(default\s+)?/gm,""),Y=Z.transformSync(Y),M.push(`// Composable: ${L}
|
|
3
|
+
${Y.trim()}`)}catch(Y){console.warn(`[stx] Failed to load composable ${J}:`,Y)}if(M.length===0||w.size===0)return R(P,A,V,""),null;let g=[...w].map((J)=>` try { __c[${JSON.stringify(J)}] = ${J}; } catch (e) {}`).join(`
|
|
4
|
+
`),S=JSON.stringify([...w]),C=M.join(`
|
|
5
|
+
|
|
6
|
+
`),_=`;(function(){
|
|
7
|
+
window.__composables = window.__composables || {};
|
|
8
|
+
var __c = window.__composables;
|
|
9
|
+
var __stx = window.stx || {};
|
|
10
|
+
${v.filter((J)=>!I.has(J)&&new RegExp(`\\b${J}\\b`).test(C)).map((J)=>`var ${J} = __stx[${JSON.stringify(J)}];`).join(`
|
|
11
|
+
`)}
|
|
12
|
+
${C}
|
|
13
|
+
${g}
|
|
14
|
+
var __names = ${S};
|
|
15
|
+
for (var __i = 0; __i < __names.length; __i++) {
|
|
16
|
+
var __n = __names[__i];
|
|
17
|
+
if (!(__n in __c)) continue;
|
|
18
|
+
var __takenByBuiltin = !!(window.stx && __n in window.stx);
|
|
19
|
+
if (__takenByBuiltin || __n in window) {
|
|
20
|
+
console.warn('[stx] composable "' + __n + '" is not available as a bare identifier: '
|
|
21
|
+
+ (__takenByBuiltin ? 'a built-in of that name already exists' : 'window already defines that property')
|
|
22
|
+
+ '. Rename it, or use: import { ' + __n + ' } from "@composables"');
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
window[__n] = __c[__n];
|
|
26
|
+
}
|
|
27
|
+
})();`;return R(P,A,V,_),_}function qq(){P.clear(),E.clear()}
|
|
28
|
+
export{o as Ri,e as Si,qq as Ti};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Cm as O,Po as R,_p as H,qq as x,vr as g}from"./chunk-hay1rzb0.js";import b from"path";var v={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},M=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var T=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function f(q){let B=[],Q=0,G;T.lastIndex=0;while((G=T.exec(q))!==null){if(G.index>Q){let X=q.slice(Q,G.index);if(X.trim())B.push({type:B.length===0?"shell":"content",content:X})}let J=G[1],K=G[2];B.push({type:"suspense",name:J,content:K}),Q=G.index+G[0].length}if(Q<q.length){let J=q.slice(Q);if(J.trim())B.push({type:B.length===0?"shell":"content",content:J})}if(B.length===0)B.push({type:"shell",content:q});return B}async function r(q,B={},Q={}){let G={...g,...Q,streaming:{...v,...Q.streaming}},J=G.streaming?.bufferSize||16384;return new ReadableStream({async start(K){try{let X=await Bun.file(q).text(),z=X.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),L=z?z[1]:"",Y=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),j={...B,__filename:q,__dirname:b.dirname(q)};if(L.trim())await R(L,j,q);let D=f(Y),$=new Set;if(!D.some((w)=>w.type==="suspense")){let w=G.streaming?.strategy||"auto",U=new RegExp(M.source,"g");if(!(w!=="manual"&&U.test(Y))){let F=await H(Y,j,q,G,$);for(let V=0;V<F.length;V+=J)K.enqueue(F.slice(V,V+J)),await new Promise((W)=>setTimeout(W,0))}else{let F=[],V=new RegExp(M.source,"g"),W;while((W=V.exec(Y))!==null)F.push({name:W[1],content:W[2],start:W.index,end:W.index+W[0].length});let y=0;for(let A of F){if(A.start>y){let k=Y.slice(y,A.start);if(k.trim()){let E=await H(k,j,q,G,$);K.enqueue(E),await new Promise((S)=>setTimeout(S,0))}}let I=await H(A.content,j,q,G,$);K.enqueue(I),await new Promise((k)=>setTimeout(k,0)),y=A.end}if(y<Y.length){let A=Y.slice(y);if(A.trim()){let I=await H(A,j,q,G,$);K.enqueue(I)}}}}else{let w=new Map;for(let Z of D)if(Z.type==="shell"||Z.type==="content"){let F=await H(Z.content,j,q,G,$);K.enqueue(F)}else if(Z.type==="suspense"&&Z.name){let F=`stx-suspense-${Z.name}`;K.enqueue(`<div id="${F}" data-suspense="${Z.name}" style="display:contents;">
|
|
3
3
|
<template data-suspense-fallback>Loading...</template>
|
|
4
4
|
</div>`),w.set(Z.name,H(Z.content,j,q,G,$))}K.enqueue(`
|
|
5
5
|
<script>
|
|
@@ -191,4 +191,4 @@ else {
|
|
|
191
191
|
stx.hydrate();
|
|
192
192
|
}
|
|
193
193
|
})();`}
|
|
194
|
-
export{r as
|
|
194
|
+
export{r as Xi,N as Yi,C as Zi,s as _i,a as $i,o as aj,n as bj,e as cj,d as dj,h as ej,t as fj,qq as gj,Bq as hj,Gq as ij};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Vg as a,Wg as b,Xg as c,Yg as d,Zg as e,_g as f}from"./chunk-6vswphz4.js";import"./chunk-hay1rzb0.js";import"./chunk-2h94c5hm.js";import"./chunk-8jam44my.js";import"./chunk-t51mwjyq.js";import"./chunk-wfffa8zm.js";import"./chunk-54f8bpp6.js";import"./chunk-4evbx7sz.js";import"./chunk-jxxv18a0.js";import"./chunk-c131k3mt.js";import"./chunk-hgjjnjas.js";import"./chunk-nqq7y7m9.js";import"./chunk-1c2j4eby.js";import"./chunk-kxavsh3m.js";import"./chunk-qev11kg8.js";import"./chunk-rrankpmj.js";import"./chunk-fczfdsab.js";import"./chunk-fp7ms6e7.js";import"./chunk-jp2f8yzw.js";export{c as renderSlot,d as processSlots,a as parseSlots,b as parseSlotElement,e as extractSlotContent,f as applySlots};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Al as GJ}from"./chunk-9499k64n.js";import{fm as $J,xr as HJ,yr as zJ}from"./chunk-hay1rzb0.js";import{ht as KJ,it as ZJ}from"./chunk-t51mwjyq.js";import{vt as WJ,zt as u}from"./chunk-54f8bpp6.js";import{mu as c}from"./chunk-c131k3mt.js";import X from"path";import O from"fs";function OJ(J){if(!J||typeof J!=="object")return!1;let K=J;return typeof K.message==="string"&&(K.name==="BuildMessage"||K.name==="ResolveMessage"||("position"in K))}function wJ(J){if(J&&typeof J==="object"&&Array.isArray(J.errors))return J.errors;return[J]}function b(J,K){let $=[];for(let W of wJ(J)){if(OJ(W)){let H=W.position||void 0;$.push({file:K||H?.file,line:H?.line,column:H?.column,message:W.message??"",lineText:H?.lineText});continue}$.push({file:K,message:W instanceof Error?W.message:String(W)})}return $}function s(J,K){return b(J,K).map(($)=>{let W=$.file?`${$.file}${$.line?`:${$.line}${$.column?`:${$.column}`:""}`:""}`:"",H=$.lineText?`
|
|
3
|
+
${$.lineText.trim()}`:"";return W?`${W}: ${$.message}${H}`:`${$.message}${H}`}).join(`
|
|
4
|
+
`)}var UJ=9;function P(J,K,$){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(X.basename(J))||GJ(J,K,$)}var QJ=1,YJ=new Map,f=600,LJ=100,g=new Map;async function TJ(J){let K=g.get(J)??0;if(K>0&&K<LJ){g.set(J,K+1);return}g.set(J,1);try{let $=(await O.promises.readdir(J)).filter((z)=>z.endsWith(".js"));if($.length<=f)return;let H=(await Promise.all($.map(async(z)=>{try{return{name:z,at:(await O.promises.stat(X.join(J,z))).mtimeMs}}catch{return null}}))).filter((z)=>z!==null);H.sort((z,Y)=>Y.at-z.at);for(let z of H.slice(f)){let Y=z.name.slice(0,-3);await O.promises.rm(X.join(J,`${Y}.js`),{force:!0}),await O.promises.rm(X.join(J,`${Y}.deps.json`),{force:!0})}I("pruned bundle cache to",f,"entries")}catch{}}function mJ(J){return YJ.get(J)??[]}function h(J,K){if(J)YJ.set(J,K)}function AJ(J=process.env){return J.STX_DEBUG==="true"||J.STX_DEBUG==="1"}function I(...J){if(AJ())console.log("[stx:bundler]",...J)}var n=[];function t(J,K,$){n.push({filePath:J||"<inline>",message:K,details:$})}function uJ(){return n.slice()}function hJ(){n.length=0}var p;function pJ(J){p=J}function r(){if(p)return p;try{let J=zJ.strict;return typeof J==="object"&&J!==null?J.bundlerFallback??"warn":"warn"}catch{return"warn"}}var a=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function cJ(J){let K=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,$;while(($=K.exec(J))!==null){let H=$[1];if(!a.some((Y)=>Y.test(H)))return I("detected user import:",H),!0}let W=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while(($=W.exec(J))!==null){let H=$[1];if(/\.css(?:\?.*)?$/.test(H))continue;if(!a.some((Y)=>Y.test(H)))return I("detected side-effect import:",H),!0}return!1}var D="stx-module:",CJ=/\.(?:[cm]?[jt]sx?|json)$/i;function MJ(J,K){return X.relative(J,K).split(X.sep).join("/")}function xJ(J,K){if(K.size===0)return J;return J.replace(/^([ \t]*import\s+(?:[^;"']*?\s+from\s+)?)(["'])([^"']+)\2/gm,($,W,H,z)=>{let Y=K.get(z);return Y&&!z.startsWith(D)?`${W}${H}${Y}${H}`:$})}function IJ(J,K){let $=0,W=(z)=>{let Y=`__stxMod${$++}`,j=JSON.stringify(z);return K.push(`var ${Y} = globalThis.__stxModules && globalThis.__stxModules[${j}];`,`if (${Y} === undefined) throw new Error("[stx] module " + ${JSON.stringify(j)} + " is not registered on this page (#1957)");`),Y},H=(z,Y)=>{for(let j of z.split(",")){let T=j.trim();if(!T)continue;let Q=T.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!Q)continue;let Z=Q[1].startsWith('"')?JSON.parse(Q[1]):Q[1],G=Q[2]??Z;K.push(`var ${G} = ${Y}[${JSON.stringify(Z)}];`)}};return J=J.replace(/^[ \t]*import\s+([^;"']*?)\s+from\s+["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(z,Y,j)=>{let T=j.slice(D.length),Q=W(T),Z=Y.trim(),G=Z.match(/^([\w$]+)\s*(?:,\s*|$)/);if(G&&!Z.startsWith("{")&&!Z.startsWith("*"))K.push(`var ${G[1]} = ${Q}.default;`),Z=Z.slice(G[0].length).trim();let q=Z.match(/^\*\s*as\s+([\w$]+)$/);if(q)K.push(`var ${q[1]} = ${Q};`);else if(Z.startsWith("{"))H(Z.replace(/^\{|\}$/g,""),Q);return""}),J=J.replace(/^[ \t]*import\s+["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(z,Y)=>{return W(Y.slice(D.length)),""}),J}function e(J){let K=[J,`${J}.ts`,`${J}.tsx`,`${J}.js`,`${J}.mjs`,`${J}.jsx`,X.join(J,"index.ts"),X.join(J,"index.tsx"),X.join(J,"index.js"),X.join(J,"index.mjs")];for(let $ of K)try{if(O.existsSync($)&&O.statSync($,{throwIfNoEntry:!1})?.isFile())return $}catch{}return}function NJ(J,K,$,W,H,z=new Map,Y){let j=(Q,Z,G)=>{if(P(Z,J,Y))return null;if(!H||Q!==$||!CJ.test(Z))return null;try{if(!O.statSync(Z,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}W.add(Z);let q=`${D}${MJ(process.cwd(),Z)}`;return z.set(G,q),{path:q,external:!0}},T=(Q,Z)=>{let G=Q===$?K:X.dirname(Q),q=X.resolve(G,Z);return e(q)??q};return{name:"stx-client-bundle",setup(Q){Q.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(Z)=>({path:Z.path,external:!0})),Q.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(Z)=>({path:Z.path,external:!0})),Q.onResolve({filter:/^\//},(Z)=>{let G=e(Z.path);if(G){let q=j(Z.importer,G,Z.path);if(q)return q;if(G!==$)W.add(G);return{path:G}}return{path:Z.path,external:!0}}),Q.onResolve({filter:/^\.\.?\//},(Z)=>{let G=T(Z.importer,Z.path),q=j(Z.importer,G,Z.path);if(q)return q;return W.add(G),{path:G}}),Q.onResolve({filter:/^[@~]\//},(Z)=>{let G=X.resolve(J,Z.path.slice(2)),q=[G,`${G}.ts`,`${G}.tsx`,`${G}.js`,`${G}.mjs`,`${G}.jsx`,X.join(G,"index.ts"),X.join(G,"index.tsx"),X.join(G,"index.js"),X.join(G,"index.mjs")];for(let A of q)if(O.existsSync(A)&&O.statSync(A,{throwIfNoEntry:!1})?.isFile()){let U=j(Z.importer,A,Z.path);if(U)return U;return I(`resolved ${Z.path[0]}/ import:`,Z.path,"\u2192",A),W.add(A),{path:A}}return console.warn(`[stx:bundler] could not resolve ${Z.path[0]}/ import:`,Z.path),{path:G}}),Q.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(Z)=>{if(!H||Z.importer!==$)return;let G=`${D}npm:${Z.path}`;return z.set(Z.path,G),{path:G,external:!0}}),Q.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(Z)=>{if(P(Z.path,J,Y))throw Error(`Server-only API source cannot be imported by a client script: ${Z.path}`);let G=X.extname(Z.path).toLowerCase(),q=G===".json"?"json":G===".tsx"?"tsx":G===".jsx"?"jsx":G===".ts"||G===".mts"||G===".cts"?"ts":"js";if(Z.path!==$)W.add(Z.path);return{contents:O.readFileSync(Z.path,"utf8"),loader:q}})}}}var m=new Map,F=WJ(64),JJ=Symbol.for("stx.client-bundle-build-queue");function _J(J){let K=globalThis,W=(K[JJ]??Promise.resolve()).then(J,J);return K[JJ]=W.then(()=>{return},()=>{return}),W}async function nJ(J,K,$={}){let W=$.projectRoot||process.cwd(),H=(await HJ(W)).serverApi,z=$.minify??!1,Y=$.externalizeUserModules??!0,j=$.cacheDir||c(W,"bundle-cache"),T=new Bun.CryptoHasher("md5");T.update(`${UJ}\x00${JSON.stringify(H??!1)}\x00${Y?"registry":"inline"}\x00${J}\x00${K}`);let Q=T.digest("hex").slice(0,12),Z=X.join(j,`${Q}.js`),G=F.get(Z);if(G){if(u(G.files)&&G.files.every((C)=>!P(C.path,W,H))){I("memo hit:",Q);let C=G.files.map((w)=>w.path);return h(K,C),$.collectInputs?.push(...C),G.code}F.delete(Z),I("memo invalidated by dep change:",Q)}let q=X.join(j,`${Q}.deps.json`),A=Bun.file(Z);if(await A.exists()){let C=Bun.file(q),w=!1,M=null;if(await C.exists())try{let _=JSON.parse(await C.text());if(_.metadataVersion!==QJ||!Array.isArray(_.files))w=!1;else M=_.files,w=!0;if(M&&(!u(M)||M.some((S)=>P(S.path,W,H))))w=!1}catch{w=!1}if(w){if(I("cache hit:",Q),M)h(K,M.map((S)=>S.path)),$.collectInputs?.push(...M.map((S)=>S.path));let _=await A.text();if(M)F.set(Z,{code:_,files:M});return _}I("cache invalidated by dep change:",Q)}let U=m.get(Q);if(U){let C=await U;if($.collectInputs)$.collectInputs.push(...(F.get(Z)?.files??[]).map((w)=>w.path));return C}let v=_J(()=>SJ(J,K,{projectRoot:W,minify:z,cacheDir:j,hash:Q,cachePath:Z,depsPath:q,collectInputs:$.collectInputs,externalizeUserModules:Y,serverApi:H}));m.set(Q,v);try{return await v}finally{m.delete(Q)}}async function SJ(J,K,$){let{projectRoot:W,minify:H,cacheDir:z,hash:Y,cachePath:j,depsPath:T,externalizeUserModules:Q}=$,Z=c(W,"bundle-tmp"),G=X.join(Z,`${Y}.ts`),q=X.join(Z,"out",Y);O.mkdirSync(Z,{recursive:!0}),O.mkdirSync(q,{recursive:!0});let A=X.dirname(K),U=new Set,v=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,C=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,w=KJ(J),{depths:M,balanced:_}=ZJ(w),S=(L)=>!_||M[L]===0,x;while((x=v.exec(w))!==null){if(x[1])continue;if(!S(x.index))continue;if(x[2])x[2].split(",").forEach((L)=>{let k=BJ(L);if(k)U.add(k)});else if(x[3])U.add(x[3])}while((x=C.exec(w))!==null){if(x[1])continue;if(!S(x.index))continue;U.add(x[2])}let XJ=U.size>0?`
|
|
5
|
+
export { ${[...U].join(", ")} }`:"";await Bun.write(G,J+XJ),I("bundling:",Y,"from:",X.basename(K));let o=new Set,l=new Map;try{let L=await Bun.build({entrypoints:[G],outdir:q,target:"browser",format:"esm",minify:H,plugins:[NJ(W,A,G,o,Q,l,$.serverApi)],define:{"process.env.NODE_ENV":H?'"production"':'"development"',...$J()},root:W});if(!L.success){let B=L.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ")||`Unable to bundle ${X.basename(K)}`,R=b(L.logs,K||void 0);if(console.warn("[stx:bundler] build failed:",B),t(K||"",B,R),r()==="error")throw Error(B);return J}let k="";for(let V of L.outputs){k=await V.text();break}let N=[];for(let V of k.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let B of V[1].split(",")){let R=B.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(R){N.push([R[2],R[1]]);continue}let y=B.trim();if(/^[A-Za-z_$][\w$]*$/.test(y))N.push([y,y])}let d=[];k=IJ(xJ(k,l),d);let qJ=k.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];k=k.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let i=`__stxBundle_${Y}`,VJ=N.map(([V,B])=>`${JSON.stringify(V)}: ${B}`).join(", "),kJ=N.map(([V])=>`var ${V} = undefined;`).join(`
|
|
6
|
+
`),jJ=N.map(([V])=>`${V} = ${i}[${JSON.stringify(V)}];`).join(`
|
|
7
|
+
`);if(k=`${qJ.join(`
|
|
8
|
+
`)}
|
|
9
|
+
${kJ}
|
|
10
|
+
var ${i} = (function() {
|
|
11
|
+
${d.join(`
|
|
12
|
+
`)}
|
|
13
|
+
${k}
|
|
14
|
+
return { ${VJ} };
|
|
15
|
+
})();
|
|
16
|
+
${jJ}`.trim(),I("bundled:",Y,"output:",k.length,"bytes"),U.size>0&&N.length===0)return console.warn(`[stx:bundler] dropped every binding for ${X.basename(K)} (${Y}); serving the unbundled source and not caching this result`),J;O.mkdirSync(z,{recursive:!0}),await Bun.write(j,k);let E=Array.from(o).map((V)=>{try{return{path:V,mtimeMs:O.statSync(V).mtimeMs}}catch{return null}}).filter((V)=>V!==null);return await Bun.write(T,JSON.stringify({metadataVersion:QJ,files:E})),h(K,E.map((V)=>V.path)),$.collectInputs?.push(...E.map((V)=>V.path)),F.set(j,{code:k,files:E}),await TJ(z),k}catch(L){let k=b(L,K||void 0),N=s(L,K||void 0);if(console.warn(`[stx:bundler] error: ${N}`),t(K||"",N,k),r()==="error")throw L;return J}finally{try{O.rmSync(G,{force:!0}),O.rmSync(q,{recursive:!0,force:!0})}catch{}}}function BJ(J){let K=J.trim();if(!K)return null;let $=K.indexOf("=");if($!==-1)K=K.slice(0,$).trim();let W=K.indexOf(":");if(W!==-1)K=K.slice(W+1).trim();if(K.startsWith("..."))K=K.slice(3).trim();return/^[A-Za-z_$][\w$]*$/.test(K)?K:null}
|
|
17
|
+
export{s as fl,mJ as gl,AJ as hl,t as il,uJ as jl,hJ as kl,pJ as ll,r as ml,cJ as nl,D as ol,MJ as pl,xJ as ql,IJ as rl,_J as sl,nJ as tl};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Uv as y}from"./chunk-fczfdsab.js";import N from"fs";import B from"path";var Y="_stx";function L(M){return Bun.hash(M).toString(16).slice(0,8)}function T(M){let C=[],v=(q)=>{for(let g of N.readdirSync(q,{withFileTypes:!0})){let j=B.join(q,g.name);if(g.isDirectory())v(j);else if(g.isFile()&&j.endsWith(".html"))C.push(j)}};if(N.existsSync(M))v(M);return C}var S=[{pattern:/<script\b([^>]*\bdata-stx-runtime\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"runtime",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(M)=>`<script data-stx-runtime src="${M}"></script>`},{pattern:/<script\b([^>]*\bdata-stx-router\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"router",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(M)=>`<script data-stx-router src="${M}"></script>`},{pattern:/<style\b([^>]*\bdata-css=(?:"generated"|'generated')[^>]*)>([\s\S]*?)<\/style>/gi,prefix:"css",extension:"css",contentType:"text/css; charset=utf-8",replace:(M)=>`<link data-css="generated" rel="stylesheet" href="${M}">`}];function _(M,C=`/${Y}`){let v=[],q=new Set,g=0,j=M;for(let G of S)j=j.replace(G.pattern,(R,K,W)=>{if(/\b(?:src|href)\s*=/.test(K)||!W.trim())return R;let Q=`${G.prefix}.${L(W)}.${G.extension}`;if(!q.has(Q))q.add(Q),v.push({filename:Q,contents:W,contentType:G.contentType});return g+=W.length,G.replace(`${C}/${Q}`)});return{html:j,assets:v,bytesInlined:g}}function a(M){let C={pages:0,assets:0,bytesInlined:0},v=B.join(M,Y),q=new Set;for(let g of T(M)){let j=N.readFileSync(g,"utf8"),{html:G,assets:R,bytesInlined:K}=_(j);if(G===j)continue;for(let W of R){if(q.has(W.filename))continue;q.add(W.filename),N.mkdirSync(v,{recursive:!0}),N.writeFileSync(B.join(v,W.filename),W.contents),C.assets++}N.writeFileSync(g,G),C.bytesInlined+=K,C.pages++}return C}import z from"fs";import P from"path";var I=1024,E=/<(script|style)\b([^>]*)>([\s\S]*?)<\/\1>/gi,d=new Set(["","module","text/javascript","application/javascript","module/javascript"]);function b(M){return Bun.hash(M).toString(16).slice(0,8)}function p(M){let C=[],v=(q)=>{for(let g of z.readdirSync(q,{withFileTypes:!0})){let j=P.join(q,g.name);if(g.isDirectory())v(j);else if(g.isFile()&&j.endsWith(".html"))C.push(j)}};if(z.existsSync(M))v(M);return C}function D(M,C){let v=M.match(new RegExp(`\\b${C}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i"));if(!v)return;return v[2]??v[3]??v[4]??""}function m(M,C,v){if(v.length<I)return!1;if(/\b(?:src|href)\s*=/i.test(C))return!1;if(M.toLowerCase()==="script"){if(!d.has((D(C,"type")??"").trim().toLowerCase()))return!1;return!0}return!0}function o(M){let C=[];for(let v of M.matchAll(/<template\b[^>]*>[\s\S]*?<\/template>/gi))C.push([v.index,v.index+v[0].length]);return C}function s(M){let C={pages:0,assets:0,bytesInlined:0},v=p(M);if(v.length<2)return C;let q=new Map,g=new Map;for(let Q of v){let O=z.readFileSync(Q,"utf8");q.set(Q,O);let x=o(O);for(let U of O.matchAll(E)){let[w,V,J,$]=U;if(!m(V,J,$))continue;if(x.some(([A,k])=>U.index>=A&&U.index<k))continue;let H=`${V.toLowerCase()}\x00${$}`,X=g.get(H);if(X)X.push({file:Q,whole:w,tag:V,attrs:J,body:$});else g.set(H,[{file:Q,whole:w,tag:V,attrs:J,body:$}])}}let j=[...g.values()].filter((Q)=>new Set(Q.map((O)=>O.file)).size>1);if(j.length===0)return C;let G=P.join(M,Y),R=new Map(q),K=new Map,W=[];for(let Q of j){let{tag:O,body:x}=Q[0],U=O.toLowerCase()==="script",w=`${U?"chunk":"style"}.${b(x)}.${U?"js":"css"}`;W.push({filename:w,contents:x,contentType:U?"text/javascript; charset=utf-8":"text/css; charset=utf-8"});let V=`/${Y}/${w}`;for(let J of Q){let $=U?`<script${J.attrs} src="${V}"></script>`:`<link${J.attrs} rel="stylesheet" href="${V}">`,H=R.get(J.file),X=H.replace(J.whole,()=>$);if(X===H)continue;R.set(J.file,X),K.set(J.file,(K.get(J.file)??0)+J.body.length)}}z.mkdirSync(G,{recursive:!0});for(let Q of W)z.writeFileSync(P.join(G,Q.filename),Q.contents),C.assets++;for(let[Q,O]of R){if(O===q.get(Q))continue;z.writeFileSync(Q,O),C.pages++,C.bytesInlined+=K.get(Q)??0}return C}y();import Z from"fs";import F from"path";var h="layout-types.d.ts";function f(M){let C=[],v=(q,g)=>{let j;try{j=Z.readdirSync(q,{withFileTypes:!0})}catch{return}for(let G of j){if(G.name.startsWith("."))continue;let R=F.join(q,G.name);if(G.isDirectory())v(R,g?`${g}/${G.name}`:G.name);else if(G.isFile()&&G.name.endsWith(".stx")&&G.name!=="_layout.stx"){let K=G.name.slice(0,-4);C.push(g?`${g}/${K}`:K)}}};return v(M,""),C.sort()}function c(M){let C=["// Auto-generated by stx \u2014 do not edit.","//","// Makes `definePageMeta({ layout })` reject a name with no layout behind it.","// Include this file in your tsconfig (it lives in the stx state directory,","// `.stx/` by default) for the check to apply.",""];if(M.length===0)return C.push("// No layouts found \u2014 `layout` stays typed as `string`.","export {}",""),C.join(`
|
|
3
3
|
`);return C.push("declare module '@stacksjs/stx' {"," interface KnownLayouts {",...M.map((v)=>` '${v}': true`)," }","}","","export {}",""),C.join(`
|
|
4
4
|
`)}function HM(M,C){if(!M)return[];let v=F.isAbsolute(M)?M:F.resolve(process.cwd(),M),q=f(v),g=c(q),j=F.join(C,h);try{if(Z.existsSync(j)&&Z.readFileSync(j,"utf8")===g)return q;Z.mkdirSync(C,{recursive:!0}),Z.writeFileSync(j,g)}catch{}return q}
|
|
5
|
-
export{Y as
|
|
5
|
+
export{Y as Dk,_ as Ek,a as Fk,s as Gk,h as Hk,f as Ik,c as Jk,HM as Kk};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Ai as e,wi as a,xi as b,yi as c,zi as d}from"./chunk-c79nfdyj.js";import"./chunk-jp2f8yzw.js";export{a as processAsyncDirectives,c as isAsyncComponent,e as generateAsyncComponentRuntime,d as generateAsyncComponentCSS,b as defineAsyncComponent};
|