@stacksjs/stx 0.2.706 → 0.2.707

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.
Files changed (260) hide show
  1. package/dist/app-shell.d.ts +2 -1
  2. package/dist/app-shell.js +5 -2
  3. package/dist/{chunk-e3yhx053.js → chunk-029qng4p.js} +5 -5
  4. package/dist/chunk-0dve54ne.js +3 -0
  5. package/dist/chunk-0f12mv0z.js +2 -0
  6. package/dist/{chunk-m4j9gedb.js → chunk-0myrwz84.js} +48 -8
  7. package/dist/{chunk-5bgkb4vm.js → chunk-0v5nfhwg.js} +3 -3
  8. package/dist/chunk-12vjp2gr.js +2 -0
  9. package/dist/chunk-18fr730w.js +2 -0
  10. package/dist/{chunk-p4czdmrr.js → chunk-1f4e06c2.js} +2 -2
  11. package/dist/{chunk-n2ema4wf.js → chunk-1xjv71dw.js} +2 -2
  12. package/dist/chunk-29sapda2.js +2 -0
  13. package/dist/{chunk-d597d0dp.js → chunk-2aarvd3a.js} +6 -6
  14. package/dist/chunk-2dgbme86.js +2 -0
  15. package/dist/{chunk-ah5ch04j.js → chunk-2gny5jdt.js} +2 -2
  16. package/dist/chunk-2qf6kd9r.js +2 -0
  17. package/dist/chunk-2snfd93r.js +2 -0
  18. package/dist/chunk-2tqekz3d.js +3 -0
  19. package/dist/{chunk-y91rz3rq.js → chunk-3457kk19.js} +7 -7
  20. package/dist/chunk-3hhcea1p.js +54 -0
  21. package/dist/chunk-3t3p2c1t.js +65 -0
  22. package/dist/{chunk-3850m7ab.js → chunk-3wkgd883.js} +1 -1
  23. package/dist/chunk-42t97n9v.js +2 -0
  24. package/dist/{chunk-t27fecet.js → chunk-42w6snem.js} +4 -4
  25. package/dist/chunk-46s9ma3t.js +2 -0
  26. package/dist/chunk-4c1fbthr.js +2 -0
  27. package/dist/{chunk-zggdhtmn.js → chunk-4ckxs446.js} +3 -3
  28. package/dist/chunk-4fxg20je.js +2 -0
  29. package/dist/chunk-4m9qn8ps.js +4 -0
  30. package/dist/chunk-4y73c35z.js +33 -0
  31. package/dist/{chunk-jkywbfb0.js → chunk-533g1b9b.js} +2 -2
  32. package/dist/chunk-58v34kba.js +2 -0
  33. package/dist/{chunk-9p452mq6.js → chunk-59g266vc.js} +114 -114
  34. package/dist/{chunk-2gzrx4ma.js → chunk-59k5ntkt.js} +56 -56
  35. package/dist/chunk-5n4qg8za.js +3 -0
  36. package/dist/{chunk-1kr1mpft.js → chunk-67abad76.js} +1 -1
  37. package/dist/{chunk-7smgebdq.js → chunk-6cz1sbb1.js} +3 -3
  38. package/dist/{chunk-eb3xg8an.js → chunk-6ms7rtqt.js} +1 -1
  39. package/dist/{chunk-4sesw88b.js → chunk-6n11z33h.js} +5 -5
  40. package/dist/chunk-6ndeycxk.js +2 -0
  41. package/dist/{chunk-tp4eqfxq.js → chunk-6ts3sthp.js} +2 -2
  42. package/dist/{chunk-8w4y3dx3.js → chunk-768evhvm.js} +2 -2
  43. package/dist/{chunk-0qtygx7m.js → chunk-79p5580k.js} +4 -4
  44. package/dist/chunk-79vj1txq.js +4 -0
  45. package/dist/chunk-7c7jnph2.js +20 -0
  46. package/dist/chunk-7dc3n69c.js +3 -0
  47. package/dist/chunk-7hpwcwwh.js +2 -0
  48. package/dist/chunk-7ppbv5bc.js +14 -0
  49. package/dist/{chunk-ccqe741j.js → chunk-83p5k4eb.js} +2 -2
  50. package/dist/{chunk-b1a79hgk.js → chunk-89s38bat.js} +2 -2
  51. package/dist/chunk-8s4rxgs8.js +2 -0
  52. package/dist/chunk-8ss2v7sw.js +2 -0
  53. package/dist/chunk-8t9em8md.js +2 -0
  54. package/dist/{chunk-vfjenjez.js → chunk-8v2vbc4y.js} +1 -1
  55. package/dist/chunk-921gb49g.js +2 -0
  56. package/dist/chunk-9736003n.js +2 -0
  57. package/dist/chunk-97r557ws.js +2 -0
  58. package/dist/{chunk-x7rtrdqq.js → chunk-998zvkzr.js} +3 -3
  59. package/dist/{chunk-5w1erc2m.js → chunk-9dg5ja4w.js} +1 -1
  60. package/dist/chunk-9frqh3bj.js +2 -0
  61. package/dist/{chunk-ygtfjnqj.js → chunk-9v1t47d2.js} +2 -2
  62. package/dist/chunk-a35m0g7z.js +2 -0
  63. package/dist/{chunk-3hxd5td3.js → chunk-am4wadh7.js} +2 -2
  64. package/dist/{chunk-wqe98032.js → chunk-an387127.js} +2 -2
  65. package/dist/{chunk-bsr9wnq4.js → chunk-ap30qs8p.js} +2 -2
  66. package/dist/chunk-avr65xra.js +2 -0
  67. package/dist/chunk-b2ajtmvk.js +2 -0
  68. package/dist/chunk-b6318vv3.js +2 -0
  69. package/dist/{chunk-7kn0d1f1.js → chunk-b7j48bq9.js} +2 -2
  70. package/dist/chunk-bcr8sq50.js +2 -0
  71. package/dist/chunk-bd9p1xmr.js +2 -0
  72. package/dist/chunk-c5tky2vf.js +32 -0
  73. package/dist/{chunk-qef5mz20.js → chunk-cam9je83.js} +105 -105
  74. package/dist/{chunk-njhd845r.js → chunk-ckrmrdjp.js} +5 -5
  75. package/dist/{chunk-epnpst9q.js → chunk-cm8m2ygc.js} +11 -11
  76. package/dist/{chunk-k296qq0p.js → chunk-cwhzk2n3.js} +2 -2
  77. package/dist/{chunk-rcdjse0z.js → chunk-czy6hs6g.js} +5 -5
  78. package/dist/{chunk-y7xsjr28.js → chunk-d21twmm2.js} +1 -1
  79. package/dist/chunk-d22sgyg2.js +3 -0
  80. package/dist/chunk-dhdt7e54.js +2 -0
  81. package/dist/chunk-dmcjap96.js +20 -0
  82. package/dist/chunk-dxqvv686.js +3 -0
  83. package/dist/chunk-dzkg6cy5.js +3 -0
  84. package/dist/{chunk-b3sw5ykg.js → chunk-edka95zp.js} +3 -3
  85. package/dist/chunk-enssxcpa.js +2 -0
  86. package/dist/chunk-eqz0g5c5.js +25 -0
  87. package/dist/chunk-f7a6nzx6.js +2 -0
  88. package/dist/{chunk-44c1mbye.js → chunk-fcbd7kwj.js} +3 -3
  89. package/dist/chunk-fen5nnc4.js +2 -0
  90. package/dist/chunk-fvk1xr5a.js +2 -0
  91. package/dist/chunk-g03tkxds.js +2 -0
  92. package/dist/{chunk-b2j7s1a2.js → chunk-g1tq4xdb.js} +2 -2
  93. package/dist/chunk-g6wd49b5.js +2 -0
  94. package/dist/chunk-gbkcc96c.js +2 -0
  95. package/dist/chunk-gk0nq2ky.js +2 -0
  96. package/dist/chunk-h8kbcz9t.js +2 -0
  97. package/dist/chunk-hs2sbkvk.js +2 -0
  98. package/dist/{chunk-yn9kvsk1.js → chunk-j2mpqa4p.js} +2 -2
  99. package/dist/chunk-j3emvkjb.js +2 -0
  100. package/dist/{chunk-a8erwxng.js → chunk-j9mpwt71.js} +3 -3
  101. package/dist/{chunk-gp9k0t3g.js → chunk-jb5sftzz.js} +2 -2
  102. package/dist/chunk-jef9mn1h.js +2 -0
  103. package/dist/chunk-jx7q5cnv.js +11 -0
  104. package/dist/chunk-jztsks2y.js +2 -0
  105. package/dist/{chunk-t8d33x9w.js → chunk-khrckvwn.js} +4 -4
  106. package/dist/{chunk-3ja845kw.js → chunk-km5dpg5v.js} +171 -171
  107. package/dist/chunk-kqdzjgm6.js +421 -0
  108. package/dist/chunk-ktf42hmd.js +2 -0
  109. package/dist/{chunk-4x2gnvz1.js → chunk-kxf8z7vp.js} +2 -2
  110. package/dist/chunk-mzwa2478.js +2 -0
  111. package/dist/chunk-n6carvxa.js +2 -0
  112. package/dist/chunk-ncs2j5kc.js +3 -0
  113. package/dist/chunk-nzyr320e.js +2 -0
  114. package/dist/{chunk-z9csfarm.js → chunk-p4s8hq38.js} +11 -11
  115. package/dist/chunk-pank9g6n.js +2 -0
  116. package/dist/chunk-pf427myt.js +2 -0
  117. package/dist/chunk-pfjsyvmj.js +21 -0
  118. package/dist/chunk-pgjqx3kg.js +42 -0
  119. package/dist/{chunk-3ys3sa08.js → chunk-qa9t9k6z.js} +1 -1
  120. package/dist/chunk-qf0bs4a5.js +2 -0
  121. package/dist/chunk-qprjkz11.js +18 -0
  122. package/dist/{chunk-j9h41w8b.js → chunk-qy1ss1en.js} +2 -2
  123. package/dist/chunk-r6bc2q44.js +2 -0
  124. package/dist/{chunk-2e2qnce5.js → chunk-r96wcqs6.js} +2 -2
  125. package/dist/{chunk-sxf17xfc.js → chunk-rb2a1qxb.js} +6 -6
  126. package/dist/chunk-rwjgpmrw.js +2 -0
  127. package/dist/{chunk-416jy1m5.js → chunk-s9b6abkb.js} +2 -2
  128. package/dist/chunk-sdpzaase.js +2 -0
  129. package/dist/{chunk-2p34qf9c.js → chunk-stvw8y3c.js} +2 -2
  130. package/dist/chunk-sy1btryy.js +2 -0
  131. package/dist/{chunk-66cfnzem.js → chunk-t21ae4rx.js} +5 -5
  132. package/dist/{chunk-9ra3ne11.js → chunk-t63f15yh.js} +3 -3
  133. package/dist/{chunk-2v7t87n8.js → chunk-t6ayy0t5.js} +2 -2
  134. package/dist/{chunk-11mjqfde.js → chunk-t7ezw8cj.js} +45 -45
  135. package/dist/chunk-t7mbaf69.js +2 -0
  136. package/dist/chunk-taste5sr.js +2 -0
  137. package/dist/chunk-txjx2xd6.js +2 -0
  138. package/dist/chunk-txr51pkd.js +2 -0
  139. package/dist/chunk-vjyrwvz0.js +24 -0
  140. package/dist/chunk-vstvadc2.js +12 -0
  141. package/dist/chunk-w2h6nn70.js +2 -0
  142. package/dist/chunk-w4vxhedk.js +2 -0
  143. package/dist/{chunk-ktkmv1j8.js → chunk-wbfg7p3k.js} +4 -4
  144. package/dist/{chunk-nv886zy6.js → chunk-wevcmbn6.js} +10 -10
  145. package/dist/{chunk-gxtmq5r2.js → chunk-wj235n59.js} +7 -7
  146. package/dist/{chunk-3392k9vm.js → chunk-wp6q0geg.js} +2 -2
  147. package/dist/chunk-x8zekavj.js +2 -0
  148. package/dist/{chunk-xc03cdet.js → chunk-xyyt8v1r.js} +28 -28
  149. package/dist/chunk-ykmcnk3x.js +2 -0
  150. package/dist/chunk-yw66yks2.js +43 -0
  151. package/dist/chunk-z05dbey1.js +2 -0
  152. package/dist/{chunk-w7e28p74.js → chunk-zav8yrtp.js} +9 -9
  153. package/dist/{chunk-2nqt1m3m.js → chunk-zdpd29xd.js} +2 -2
  154. package/dist/{chunk-ywzh979k.js → chunk-zecgd1wz.js} +4 -4
  155. package/dist/{chunk-c3hr5mm2.js → chunk-zjaw79zp.js} +2 -2
  156. package/dist/{chunk-fgr56q3w.js → chunk-zjw6j2x0.js} +4 -4
  157. package/dist/{chunk-k7pmzreg.js → chunk-zn3c0ew5.js} +3 -3
  158. package/dist/cli.js +46 -46
  159. package/dist/craft-entry.js +2 -2
  160. package/dist/craft.js +2 -2
  161. package/dist/dev-server/serve-app.js +1 -1
  162. package/dist/expressions.js +6 -2
  163. package/dist/index.d.ts +1 -0
  164. package/dist/index.js +1 -0
  165. package/dist/island-chunking.js +5 -1
  166. package/dist/page-head.d.ts +2 -0
  167. package/dist/page-head.js +35 -0
  168. package/dist/production-builder.js +1 -1
  169. package/dist/production-server.js +2 -2
  170. package/dist/pwa.js +3 -3
  171. package/dist/site-builder/i18n.js +1 -1
  172. package/dist/ssg.js +36 -36
  173. package/dist/template-compiler.js +2 -1
  174. package/package.json +5 -5
  175. package/dist/chunk-09801kkv.js +0 -2
  176. package/dist/chunk-0s55c880.js +0 -2
  177. package/dist/chunk-0ys97vq8.js +0 -2
  178. package/dist/chunk-13jg9qpq.js +0 -2
  179. package/dist/chunk-1e79xcc8.js +0 -2
  180. package/dist/chunk-1yt4ynxh.js +0 -2
  181. package/dist/chunk-2whqx2c0.js +0 -2
  182. package/dist/chunk-2xtzzx00.js +0 -2
  183. package/dist/chunk-4t9cggwf.js +0 -2
  184. package/dist/chunk-5g7m27e1.js +0 -21
  185. package/dist/chunk-5h1ahj7m.js +0 -2
  186. package/dist/chunk-5zqxzyxk.js +0 -2
  187. package/dist/chunk-68wezwr7.js +0 -2
  188. package/dist/chunk-7gw96jpj.js +0 -2
  189. package/dist/chunk-7w2mrg3s.js +0 -2
  190. package/dist/chunk-8hhyp9p6.js +0 -2
  191. package/dist/chunk-926fs6g7.js +0 -2
  192. package/dist/chunk-93ft5jea.js +0 -3
  193. package/dist/chunk-94gp1g2f.js +0 -2
  194. package/dist/chunk-983zpa57.js +0 -3
  195. package/dist/chunk-98yf0aq9.js +0 -4
  196. package/dist/chunk-9wq145yr.js +0 -2
  197. package/dist/chunk-a4r93m1q.js +0 -2
  198. package/dist/chunk-aea12k73.js +0 -2
  199. package/dist/chunk-b378jpbp.js +0 -2
  200. package/dist/chunk-b7e07ybq.js +0 -3
  201. package/dist/chunk-bfhks7zf.js +0 -43
  202. package/dist/chunk-bhnq6xr5.js +0 -2
  203. package/dist/chunk-bksjh409.js +0 -2
  204. package/dist/chunk-c4sskkv6.js +0 -421
  205. package/dist/chunk-ca0vn95n.js +0 -18
  206. package/dist/chunk-cbdyns7r.js +0 -3
  207. package/dist/chunk-cknbhyw6.js +0 -2
  208. package/dist/chunk-csx3zne1.js +0 -3
  209. package/dist/chunk-d7vmzkjy.js +0 -2
  210. package/dist/chunk-djwat8vn.js +0 -2
  211. package/dist/chunk-dm7am3p3.js +0 -2
  212. package/dist/chunk-dpjs0ajs.js +0 -2
  213. package/dist/chunk-e41h5yrz.js +0 -11
  214. package/dist/chunk-f498cdg5.js +0 -2
  215. package/dist/chunk-fazw6sxz.js +0 -2
  216. package/dist/chunk-ffddd2t8.js +0 -14
  217. package/dist/chunk-fk71r3h6.js +0 -2
  218. package/dist/chunk-g1bed7se.js +0 -2
  219. package/dist/chunk-gbgbhpms.js +0 -2
  220. package/dist/chunk-h1fpjmr8.js +0 -2
  221. package/dist/chunk-ha4vb9a6.js +0 -2
  222. package/dist/chunk-hadbgke6.js +0 -2
  223. package/dist/chunk-hkmewh5h.js +0 -12
  224. package/dist/chunk-hmnj2hrh.js +0 -20
  225. package/dist/chunk-htyee0b7.js +0 -3
  226. package/dist/chunk-hz5vabap.js +0 -25
  227. package/dist/chunk-j10dhha2.js +0 -2
  228. package/dist/chunk-kjc1f6af.js +0 -2
  229. package/dist/chunk-m28d7w2s.js +0 -54
  230. package/dist/chunk-mv4wfsc5.js +0 -2
  231. package/dist/chunk-mwwd425n.js +0 -33
  232. package/dist/chunk-nbzy9m6a.js +0 -2
  233. package/dist/chunk-nmcgyxcg.js +0 -2
  234. package/dist/chunk-p4e7x4f6.js +0 -2
  235. package/dist/chunk-p6sdrq1y.js +0 -2
  236. package/dist/chunk-p78v88ng.js +0 -65
  237. package/dist/chunk-pbtr7w5e.js +0 -2
  238. package/dist/chunk-q13cp39b.js +0 -42
  239. package/dist/chunk-qfk2gh5y.js +0 -20
  240. package/dist/chunk-qqj8n8s9.js +0 -4
  241. package/dist/chunk-qtr1660m.js +0 -2
  242. package/dist/chunk-r0nm6sz0.js +0 -2
  243. package/dist/chunk-rb8g9nnc.js +0 -2
  244. package/dist/chunk-rhm7wg6p.js +0 -2
  245. package/dist/chunk-tjf1eajh.js +0 -2
  246. package/dist/chunk-ttn2hvze.js +0 -24
  247. package/dist/chunk-w42v5j1j.js +0 -2
  248. package/dist/chunk-w9kak6aj.js +0 -2
  249. package/dist/chunk-wr6z8z70.js +0 -2
  250. package/dist/chunk-xy3p6d2m.js +0 -2
  251. package/dist/chunk-yfppczrm.js +0 -2
  252. package/dist/chunk-yhf7pj12.js +0 -2
  253. package/dist/chunk-ympp4tja.js +0 -2
  254. package/dist/chunk-yyx89zxs.js +0 -2
  255. package/dist/chunk-z00ysspf.js +0 -31
  256. package/dist/chunk-z0x54ynx.js +0 -3
  257. package/dist/chunk-za6teyn1.js +0 -2
  258. package/dist/chunk-zgyw04pj.js +0 -2
  259. package/dist/chunk-zmnqha0x.js +0 -2
  260. package/dist/chunk-zw924mfr.js +0 -2
@@ -0,0 +1,24 @@
1
+ // @bun
2
+ import{S}from"./chunk-kqdzjgm6.js";import{i}from"./chunk-cam9je83.js";import p from"fs";import g from"path";import*as y from"readline";var e={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m"},u={help:{description:"Show available commands",usage:"help [command]",handler:async(t,o)=>{if(t[0]&&u[t[0]]){let n=u[t[0]];console.log(`
3
+ ${e.bold}${t[0]}${e.reset} - ${n.description}`),console.log(` Usage: ${e.cyan}${n.usage}${e.reset}
4
+ `)}else{console.log(`
5
+ ${e.bold}Available Commands:${e.reset}
6
+ `);for(let[n,r]of Object.entries(u))console.log(` ${e.cyan}${n.padEnd(12)}${e.reset} ${r.description}`);console.log(`
7
+ ${e.dim}Type 'help <command>' for more details${e.reset}
8
+ `)}}},render:{description:"Render a template file",usage:"render <file> [--raw]",handler:async(t,o)=>{if(!t[0]){console.log(`${e.red}Error: Please specify a file to render${e.reset}`);return}let n=g.resolve(o.cwd,t[0]);if(!await Bun.file(n).exists()){console.log(`${e.red}Error: File not found: ${n}${e.reset}`);return}try{let r=await Bun.file(n).text(),s=t.includes("--raw");console.log(`
9
+ ${e.dim}Rendering ${n}...${e.reset}
10
+ `);let l=await i(r,o.context,n,{},new Set);if(o.lastResult=l,s)console.log(l);else l.split(`
11
+ `).forEach((d,c)=>{let f=String(c+1).padStart(3," ");console.log(`${e.dim}${f}${e.reset} ${d}`)});console.log()}catch(r){console.log(`${e.red}Error rendering template:${e.reset}`,r)}}},eval:{description:"Evaluate an expression",usage:"eval <expression>",handler:async(t,o)=>{if(!t.length){console.log(`${e.red}Error: Please provide an expression to evaluate${e.reset}`);return}let n=t.join(" ");try{let r=`{{ ${n} }}`,l=(await S(r,o.context,"eval")).trim();o.lastResult=l,console.log(`${e.green}\u2192${e.reset} ${l}`)}catch(r){console.log(`${e.red}Error:${e.reset}`,r)}}},set:{description:"Set a context variable",usage:"set <key> <value>",handler:async(t,o)=>{if(t.length<2){console.log(`${e.red}Error: Usage: set <key> <value>${e.reset}`);return}let n=t[0],r=t.slice(1).join(" "),s;try{s=JSON.parse(r)}catch{s=r}o.context[n]=s,console.log(`${e.green}\u2713${e.reset} ${n} = ${JSON.stringify(s)}`)}},unset:{description:"Remove a context variable",usage:"unset <key>",handler:async(t,o)=>{if(!t[0]){console.log(`${e.red}Error: Please specify a variable to remove${e.reset}`);return}if(t[0]in o.context)delete o.context[t[0]],console.log(`${e.green}\u2713${e.reset} Removed ${t[0]}`);else console.log(`${e.yellow}Variable not found: ${t[0]}${e.reset}`)}},context:{description:"Show current context variables",usage:"context",handler:async(t,o)=>{let n=Object.keys(o.context);if(n.length===0){console.log(`${e.dim}Context is empty${e.reset}`);return}console.log(`
12
+ ${e.bold}Context Variables:${e.reset}
13
+ `);for(let r of n){let s=o.context[r],l=Array.isArray(s)?"array":typeof s,a=JSON.stringify(s).slice(0,50);console.log(` ${e.cyan}${r}${e.reset} ${e.dim}(${l})${e.reset}: ${a}${a.length>=50?"...":""}`)}console.log()}},clear:{description:"Clear context or screen",usage:"clear [context|screen]",handler:async(t,o)=>{if(t[0]==="context"||!t[0])o.context={},console.log(`${e.green}\u2713${e.reset} Context cleared`);if(t[0]==="screen"||!t[0])console.clear()}},cd:{description:"Change working directory",usage:"cd <directory>",handler:async(t,o)=>{if(!t[0]){console.log(`${e.cyan}${o.cwd}${e.reset}`);return}let n=g.resolve(o.cwd,t[0]);if(!p.existsSync(n)){console.log(`${e.red}Error: Directory not found: ${n}${e.reset}`);return}if(!p.statSync(n).isDirectory()){console.log(`${e.red}Error: Not a directory: ${n}${e.reset}`);return}o.cwd=n,console.log(`${e.green}\u2713${e.reset} ${n}`)}},ls:{description:"List files in current directory",usage:"ls [pattern]",handler:async(t,o)=>{let n=t[0]||"*",r=new Bun.Glob(n),s=[];for await(let c of r.scan({cwd:o.cwd,onlyFiles:!1}))s.push(c);if(s.length===0){console.log(`${e.dim}No files found${e.reset}`);return}s.sort();let l=s.filter((c)=>c.endsWith(".stx")),a=s.filter((c)=>c.endsWith(".md")),d=s.filter((c)=>!c.endsWith(".stx")&&!c.endsWith(".md"));if(l.length>0)console.log(`
14
+ ${e.bold}Templates:${e.reset}`),l.forEach((c)=>console.log(` ${e.green}${c}${e.reset}`));if(a.length>0)console.log(`
15
+ ${e.bold}Markdown:${e.reset}`),a.forEach((c)=>console.log(` ${e.blue}${c}${e.reset}`));if(d.length>0)console.log(`
16
+ ${e.bold}Other:${e.reset}`),d.forEach((c)=>console.log(` ${e.dim}${c}${e.reset}`));console.log()}},cat:{description:"Show file contents",usage:"cat <file>",handler:async(t,o)=>{if(!t[0]){console.log(`${e.red}Error: Please specify a file${e.reset}`);return}let n=g.resolve(o.cwd,t[0]);if(!await Bun.file(n).exists()){console.log(`${e.red}Error: File not found: ${n}${e.reset}`);return}let s=(await Bun.file(n).text()).split(`
17
+ `);console.log(),s.forEach((l,a)=>{let d=String(a+1).padStart(3," ");console.log(`${e.dim}${d}${e.reset} ${l}`)}),console.log()}},load:{description:"Load context from JSON file",usage:"load <file.json>",handler:async(t,o)=>{if(!t[0]){console.log(`${e.red}Error: Please specify a JSON file${e.reset}`);return}let n=g.resolve(o.cwd,t[0]);if(!await Bun.file(n).exists()){console.log(`${e.red}Error: File not found: ${n}${e.reset}`);return}try{let r=await Bun.file(n).text(),s=JSON.parse(r);o.context={...o.context,...s},console.log(`${e.green}\u2713${e.reset} Loaded ${Object.keys(s).length} variables from ${t[0]}`)}catch(r){console.log(`${e.red}Error parsing JSON:${e.reset}`,r)}}},save:{description:"Save context to JSON file",usage:"save <file.json>",handler:async(t,o)=>{if(!t[0]){console.log(`${e.red}Error: Please specify a file name${e.reset}`);return}let n=g.resolve(o.cwd,t[0]);try{await Bun.write(n,JSON.stringify(o.context,null,2)),console.log(`${e.green}\u2713${e.reset} Context saved to ${t[0]}`)}catch(r){console.log(`${e.red}Error saving file:${e.reset}`,r)}}},history:{description:"Show command history",usage:"history [count]",handler:async(t,o)=>{let n=t[0]?Number.parseInt(t[0],10):20,r=o.history.slice(-n);if(r.length===0){console.log(`${e.dim}No history${e.reset}`);return}console.log(),r.forEach((s,l)=>{let a=String(o.history.length-r.length+l+1).padStart(3," ");console.log(`${e.dim}${a}${e.reset} ${s}`)}),console.log()}},exit:{description:"Exit interactive mode",usage:"exit",handler:async(t,o)=>{o.running=!1,console.log(`
18
+ ${e.dim}Goodbye!${e.reset}
19
+ `)}},quit:{description:"Exit interactive mode (alias for exit)",usage:"quit",handler:async(t,o)=>u.exit.handler(t,o)}};function h(t,o){let n=t.split(" "),r=n[0];if(n.length===1)return Object.keys(u).filter((s)=>s.startsWith(r));if(["render","cat","load","cd"].includes(r)){let s=n.slice(1).join(" "),l=g.dirname(s)||".",a=g.basename(s),d=g.resolve(o.cwd,l);if(p.existsSync(d)&&p.statSync(d).isDirectory())try{return p.readdirSync(d).filter((f)=>f.startsWith(a)).map((f)=>`${r} ${l==="."?"":`${l}/`}${f}`)}catch{return[]}}if(["unset","eval","set"].includes(r)){let s=n[1]||"";return Object.keys(o.context).filter((l)=>l.startsWith(s)).map((l)=>`${r} ${l}`)}return[]}async function bg(t={}){let o={context:t.context||{},cwd:t.cwd||process.cwd(),history:[],running:!0,lastResult:null},n=y.createInterface({input:process.stdin,output:process.stdout,completer:(s)=>[h(s,o),s],historySize:t.maxHistory||100});console.log(`
20
+ ${e.bold}${e.blue}stx Interactive Mode${e.reset}
21
+ ${e.dim}Type 'help' for available commands, 'exit' to quit${e.reset}
22
+ `);let r=()=>{let s=o.cwd.replace(process.env.HOME||"","~");n.question(`${e.cyan}stx${e.reset} ${e.dim}${s}${e.reset} ${e.green}>${e.reset} `,async(l)=>{let a=l.trim();if(!a){if(o.running)r();return}o.history.push(a);let d=a.match(/(?:[^\s"]|"[^"]*")+/g)||[],c=d[0]?.toLowerCase(),f=d.slice(1).map((m)=>m.replace(/^"|"$/g,""));if(c&&u[c])try{await u[c].handler(f,o)}catch(m){console.log(`${e.red}Error:${e.reset}`,m)}else if(c)if(a.includes("{{")||a.includes("}}"))try{let m=await S(a,o.context,"eval");console.log(`${e.green}\u2192${e.reset} ${m}`)}catch{console.log(`${e.red}Unknown command: ${c}${e.reset}`),console.log(`${e.dim}Type 'help' for available commands${e.reset}`)}else console.log(`${e.red}Unknown command: ${c}${e.reset}`),console.log(`${e.dim}Type 'help' for available commands${e.reset}`);if(o.running)r();else n.close()})};n.on("SIGINT",()=>{console.log(`
23
+ ${e.dim}(Use 'exit' to quit)${e.reset}`),r()}),r()}
24
+ export{bg};
@@ -0,0 +1,12 @@
1
+ // @bun
2
+ function o(t,i){let n=t[i],e=i+1;while(e<t.length){if(t[e]==="\\"){e+=2;continue}if(t[e]===n)return e+1;e++}return t.length}function b(t,i){let n=i+1;while(n<t.length){if(t[n]==="\\"){n+=2;continue}if(t[n]==="`")return n+1;if(t[n]==="$"&&t[n+1]==="{"){if(n=Lc(t,n+2),n<t.length)n++;continue}n++}return t.length}function Lc(t,i){let n=1,e=i,r="{",f="";while(e<t.length){let l=t[e];if(l==="\\"){e+=2;continue}if(l==='"'||l==="'"){e=o(t,e),r=h,f="";continue}if(l==="`"){e=b(t,e),r=h,f="";continue}if(l==="/"&&t[e+1]==="/"){while(e<t.length&&t[e]!==`
3
+ `)e++;continue}if(l==="/"&&t[e+1]==="*"){e+=2;while(e<t.length&&t.slice(e,e+2)!=="*/")e++;e+=2;continue}if(l==="/"&&a(r,f)){let u=w(t,e);if(u!==-1){e=u,r=h,f="";continue}}if(l==="{")n++;else if(l==="}"){if(n--,n===0)return e}if(/[\w$]/.test(l))f=/[\w$]/.test(r)?f+l:l,r=l;else if(!/\s/.test(l))r=l,f="";e++}return t.length}var m=new Set(["return","typeof","instanceof","in","of","new","delete","void","throw","case","do","else","yield","await"]);function a(t,i){if(i)return m.has(i);return!(t===")"||t==="]"||t===h)}var h="\x00";function w(t,i){let n=i+1,e=!1;while(n<t.length){let r=t[n];if(r===`
4
+ `)return-1;if(r==="\\"){n+=2;continue}if(r==="[")e=!0;else if(r==="]")e=!1;else if(r==="/"&&!e){n++;while(n<t.length&&/[a-z]/i.test(t[n]))n++;return n}n++}return-1}function s(t){let i="",n=0,e="",r="";while(n<t.length){let f=t.slice(n,n+2);if(f==="//"){while(n<t.length&&t[n]!==`
5
+ `)i+=" ",n++;continue}if(f==="/*"){while(n<t.length&&t.slice(n,n+2)!=="*/")i+=t[n]===`
6
+ `?`
7
+ `:" ",n++;i+=" ",n+=2;continue}let l=t[n];if(l==='"'||l==="'"){let u=l;i+=" ",n++;while(n<t.length&&t[n]!==u){if(t[n]==="\\"){i+=" ",n+=2;continue}i+=t[n]===`
8
+ `?`
9
+ `:" ",n++}i+=" ",n++,e=h,r="";continue}if(l==="/"&&a(e,r)){let u=w(t,n);if(u!==-1){i+=`/${" ".repeat(u-n-2)}/`,n=u,e=h,r="";continue}}if(l==="`"){i+=" ",n++;while(n<t.length&&t[n]!=="`"){if(t[n]==="\\"){i+=" ",n+=2;continue}if(t[n]==="$"&&t[n+1]==="{"){let u=n+2,g=Lc(t,u);if(i+=" ",i+=s(t.slice(u,g)),g<t.length)i+=" ";n=g+1;continue}i+=t[n]===`
10
+ `?`
11
+ `:" ",n++}i+=" ",n++,e=h,r="";continue}if(i+=l,n++,/[\w$]/.test(l))r=/[\w$]/.test(e)?r+l:l,e=l;else if(!/\s/.test(l))e=l,r=""}return i}function ge(t){let i=new Uint16Array(t.length),n=0,e=!0;for(let r=0;r<t.length;r++){let f=t[r];if(f===")"||f==="]"||f==="}")if(n===0)e=!1;else n--;if(i[r]=n,f==="("||f==="["||f==="{")n++}return{depths:i,balanced:e&&n===0}}
12
+ export{Lc,s,ge};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{om,im}from"./chunk-4ckxs446.js";export{im as ensureTeleportTargets,om as processTeleportDirectives};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{bg}from"./chunk-vjyrwvz0.js";import"./chunk-cam9je83.js";import"./chunk-cm8m2ygc.js";import"./chunk-ap30qs8p.js";import"./chunk-eqz0g5c5.js";import"./chunk-3hhcea1p.js";import"./chunk-pgjqx3kg.js";import"./chunk-d22sgyg2.js";import"./chunk-7dc3n69c.js";import"./chunk-pfjsyvmj.js";import"./chunk-7ppbv5bc.js";import"./chunk-8v2vbc4y.js";import"./chunk-dzkg6cy5.js";import"./chunk-59g266vc.js";import"./chunk-j9mpwt71.js";import"./chunk-stvw8y3c.js";import"./chunk-zjw6j2x0.js";import"./chunk-3t3p2c1t.js";import"./chunk-0myrwz84.js";import"./chunk-kqdzjgm6.js";import"./chunk-1f4e06c2.js";import"./chunk-wp6q0geg.js";import"./chunk-xyyt8v1r.js";import"./chunk-zn3c0ew5.js";import"./chunk-zdpd29xd.js";export{bg as startInteractive};
@@ -1,8 +1,8 @@
1
1
  // @bun
2
- import{r}from"./chunk-hkmewh5h.js";function y(e,n,i=240){return e.slice(n,n+i)}var v=[{rule:"route-params",pattern:/\blocation\s*\.\s*pathname\s*\.\s*(?:match|split)\s*\(/g,primitive:"useRoute() / useRouteParams() / useRouteParam(name)",why:"parsing the URL by hand re-implements the router and does not update on SPA navigation"},{rule:"alert",pattern:/(?<![.#\w$])(?:(?:window|globalThis)\s*\.\s*)?alert\s*\(/g,primitive:"stxAlert(message)",why:"themed, focus-trapped and non-blocking \u2014 but `await` it if the code after it "+"depended on the native dialog blocking until dismissal",reject:(e)=>/\b(?:async\s+)?function\s+alert\s*\(/.test(e)||/\b(?:const|let|var)\s+alert\s*=/.test(e)},{rule:"search-params",pattern:/new\s+URLSearchParams\s*\(/g,primitive:"useSearchParams()",why:"reactive, and writes back through the router instead of history.replaceState",reject:(e,n)=>{let i=e.indexOf("(",n);if(i===-1)return!0;let o=e.slice(i+1,e.indexOf(")",i)+1);return!/\b(?:location|search|href|url)\b/i.test(o)}},{rule:"navigate",pattern:/\blocation\s*\.\s*(?:assign|replace)\s*\(|\blocation\s*\.\s*href\s*=/g,primitive:"navigate(path) / goBack()",why:"a full document load throws away every store and the scroll position; navigate() is an SPA transition",reject:(e,n)=>/^[^\n]*?(?:['"`]\s*)?(?:mailto:|tel:|sms:|https?:\/\/|\/\/)/.test(y(e,n,160))},{rule:"fetch",pattern:/new\s+AbortController\s*\(/g,primitive:"useFetch(url) / useAsyncData(key, fn)",why:"cancellation, loading and error state are already wired; hand-rolling them is where the races live"},{rule:"polling",pattern:/setInterval\s*\(/g,primitive:"useEventSource() / useSSE() / useWebSocket() / useChannel()",why:"polling burns requests and lags; the push primitives are delivered",reject:(e,n)=>!/\bfetch\s*\(|\$fetch\b|useFetch\b|\.get\s*\(|axios\b/.test(y(e,n))},{rule:"debounce",pattern:/\bclearTimeout\s*\(/g,primitive:"useDebounce(fn, ms) / useThrottle(fn, ms)",why:"a hand-held timer handle per call site is the usual source of stale-result bugs",requires:(e)=>/setTimeout\s*\(/.test(e)},{rule:"click-outside",pattern:/document\s*\.\s*addEventListener\s*\(\s*['"](?:click|mousedown|pointerdown)['"]/g,primitive:"useClickOutside(ref, fn)",why:"the document-level listener plus the blur race is exactly what this composable exists to remove"},{rule:"focus",pattern:/\.\s*(?:getElementById|querySelector)\s*\([^)]*\)\s*(?:\?\.)?\s*\.?focus\s*\(/g,primitive:"useFocus(ref) with x-ref",why:"a query by id breaks under nested scopes and SPA navigation; a ref does not"},{rule:"clipboard",pattern:/navigator\s*\.\s*(?:clipboard|share)\b/g,primitive:"useClipboard() / useShare()",why:"permission state, the copied flag and the unsupported-browser fallback are already handled"},{rule:"watch",pattern:/\beffect\s*\(\s*\(\s*\)\s*=>\s*\{[^}]*\bvoid\s+\w+\s*\(\s*\)/g,primitive:"watch(source, cb) / watchMultiple([...], cb)",why:"the `void a(); void b()` dance is a manual dependency list; watch takes one directly"}],C=["confirm","tooltip",...v.map((e)=>e.rule)];function g(e,n){let i=1;for(let o=0;o<n;o++)if(e[o]===`
2
+ import{s}from"./chunk-vstvadc2.js";function y(e,n,i=240){return e.slice(n,n+i)}var v=[{rule:"route-params",pattern:/\blocation\s*\.\s*pathname\s*\.\s*(?:match|split)\s*\(/g,primitive:"useRoute() / useRouteParams() / useRouteParam(name)",why:"parsing the URL by hand re-implements the router and does not update on SPA navigation"},{rule:"alert",pattern:/(?<![.#\w$])(?:(?:window|globalThis)\s*\.\s*)?alert\s*\(/g,primitive:"stxAlert(message)",why:"themed, focus-trapped and non-blocking \u2014 but `await` it if the code after it "+"depended on the native dialog blocking until dismissal",reject:(e)=>/\b(?:async\s+)?function\s+alert\s*\(/.test(e)||/\b(?:const|let|var)\s+alert\s*=/.test(e)},{rule:"search-params",pattern:/new\s+URLSearchParams\s*\(/g,primitive:"useSearchParams()",why:"reactive, and writes back through the router instead of history.replaceState",reject:(e,n)=>{let i=e.indexOf("(",n);if(i===-1)return!0;let o=e.slice(i+1,e.indexOf(")",i)+1);return!/\b(?:location|search|href|url)\b/i.test(o)}},{rule:"navigate",pattern:/\blocation\s*\.\s*(?:assign|replace)\s*\(|\blocation\s*\.\s*href\s*=/g,primitive:"navigate(path) / goBack()",why:"a full document load throws away every store and the scroll position; navigate() is an SPA transition",reject:(e,n)=>/^[^\n]*?(?:['"`]\s*)?(?:mailto:|tel:|sms:|https?:\/\/|\/\/)/.test(y(e,n,160))},{rule:"fetch",pattern:/new\s+AbortController\s*\(/g,primitive:"useFetch(url) / useAsyncData(key, fn)",why:"cancellation, loading and error state are already wired; hand-rolling them is where the races live"},{rule:"polling",pattern:/setInterval\s*\(/g,primitive:"useEventSource() / useSSE() / useWebSocket() / useChannel()",why:"polling burns requests and lags; the push primitives are delivered",reject:(e,n)=>!/\bfetch\s*\(|\$fetch\b|useFetch\b|\.get\s*\(|axios\b/.test(y(e,n))},{rule:"debounce",pattern:/\bclearTimeout\s*\(/g,primitive:"useDebounce(fn, ms) / useThrottle(fn, ms)",why:"a hand-held timer handle per call site is the usual source of stale-result bugs",requires:(e)=>/setTimeout\s*\(/.test(e)},{rule:"click-outside",pattern:/document\s*\.\s*addEventListener\s*\(\s*['"](?:click|mousedown|pointerdown)['"]/g,primitive:"useClickOutside(ref, fn)",why:"the document-level listener plus the blur race is exactly what this composable exists to remove"},{rule:"focus",pattern:/\.\s*(?:getElementById|querySelector)\s*\([^)]*\)\s*(?:\?\.)?\s*\.?focus\s*\(/g,primitive:"useFocus(ref) with x-ref",why:"a query by id breaks under nested scopes and SPA navigation; a ref does not"},{rule:"clipboard",pattern:/navigator\s*\.\s*(?:clipboard|share)\b/g,primitive:"useClipboard() / useShare()",why:"permission state, the copied flag and the unsupported-browser fallback are already handled"},{rule:"watch",pattern:/\beffect\s*\(\s*\(\s*\)\s*=>\s*\{[^}]*\bvoid\s+\w+\s*\(\s*\)/g,primitive:"watch(source, cb) / watchMultiple([...], cb)",why:"the `void a(); void b()` dance is a manual dependency list; watch takes one directly"}],C=["confirm","tooltip",...v.map((e)=>e.rule)];function g(e,n){let i=1;for(let o=0;o<n;o++)if(e[o]===`
3
3
  `)i++;return i}function b(e,n){let i=e.lastIndexOf(`
4
4
  `,n)+1,o=e.indexOf(`
5
- `,n);return e.slice(i,o===-1?e.length:o).trim().slice(0,120)}function S(e,n){let i=e.slice(0,n),o=i.lastIndexOf("function"),l=i.lastIndexOf("=>"),s=Math.max(o,l);if(s===-1)return!1;let t=e.slice(Math.max(0,s-120),s);return/\basync\b[^;{}]*$/.test(t)}function k(e){return/\b(?:async\s+)?function\s+confirm\s*\(/.test(e)||/\b(?:const|let|var)\s+confirm\s*=/.test(e)||/\bimport\s*\{[^}]*\bconfirm\b[^}]*\}/.test(e)}function A(e,n,i){if(k(e))return e;let o=/(^|[^\w$.])(?:(?:window|globalThis)\s*\.\s*)?confirm\s*\(/g,l=m(e),s="",t=0,a;while((a=o.exec(l))!==null){let c=a.index+a[1].length,u=g(e,c),d=b(e,c);if(/stxConfirm\s*\($/.test(e.slice(0,c+8)))continue;let p=S(e,c);if(i.push({file:n,line:u,rule:"confirm",applied:p,snippet:d,reason:p?void 0:"stxConfirm() returns a Promise and native confirm() is synchronous, so this needs `await` inside an async function. Rewriting it here would make the condition always true."}),p)s+=e.slice(t,c)+"await stxConfirm(",t=c+(a[0].length-a[1].length)}return s+e.slice(t)}function E(e,n,i){let o=/(<[a-z][\w-]*\b[^>]*?)\stitle=(["'])(.*?)\2/gis,l=R(e),s="",t=0,a;while((a=o.exec(l))!==null){let[c,u,d,p]=a,h=g(e,a.index),f=b(e,a.index),w=u.match(/^<([A-Za-z][\w-]*)/)?.[1]??"";if(/^[A-Z]/.test(w)){i.push({file:n,line:h,rule:"tooltip",applied:!1,snippet:f,reason:`\`title\` on <${w}> is a component prop, not an HTML attribute \u2014 `+"adding x-tooltip here would put a tooltip on a component and may duplicate text it already renders."});continue}if(/\bx-tooltip[=\s]/.test(u)||p.trim()===""){i.push({file:n,line:h,rule:"tooltip",applied:!1,snippet:f,reason:/\bx-tooltip[=\s]/.test(u)?"already has x-tooltip":"empty title"});continue}i.push({file:n,line:h,rule:"tooltip",applied:!0,snippet:f}),s+=e.slice(t,a.index)+`${u} x-tooltip=${d}${p}${d} title=${d}${p}${d}`,t=a.index+c.length}return s+e.slice(t)}function R(e){return e.replace(/<!--[\s\S]*?-->/g,(n)=>n.replace(/[^\n]/g," ")).replace(/\{\{--[\s\S]*?--\}\}/g,(n)=>n.replace(/[^\n]/g," "))}function F(e){let n=(i)=>i.replace(/[^\n]/g," ");return e.replace(/\/\*[\s\S]*?\*\//g,n).replace(/\/\/[^\n]*/g,n)}function m(e,n=!1){let i=R(e);return(n?F(i):r(i)).replace(/<script\b([^>]*)>([\s\S]*?)<\/script\s*>/gi,(l,s)=>/\bclient\b/i.test(s)?l:l.replace(/[^\n]/g," "))}function O(e,n,i,o){let l=m(e),s=m(e,!0);for(let t of v){if(!i.includes(t.rule))continue;if(t.requires&&!t.requires(e))continue;t.pattern.lastIndex=0;let a,c=/['"]/.test(t.pattern.source)?s:l;t.pattern.lastIndex=0;while((a=t.pattern.exec(c))!==null){if(t.reject?.(e,a.index))continue;o.push({file:n,line:g(e,a.index),rule:t.rule,applied:!1,snippet:b(e,a.index),reason:`${t.primitive} \u2014 ${t.why}`})}}}function q(e,n={}){let i=n.rules??C,o=n.file??"<source>",l=[];O(e,o,i,l);let s=e;if(i.includes("confirm"))s=A(s,o,l);if(i.includes("tooltip"))s=E(s,o,l);l.sort((c,u)=>c.line-u.line);let t=new Set,a=l.filter((c)=>{let u=`${c.rule}:${c.line}`;if(t.has(u))return!1;return t.add(u),!0});return{code:s,findings:a}}var x=new Set(["confirm","tooltip"]);function I(e,n){if(e.length===0)return"No hand-rolled equivalents found.";let i=e.filter((t)=>t.applied),o=e.filter((t)=>!t.applied&&x.has(t.rule)),l=e.filter((t)=>!t.applied&&!x.has(t.rule)),s=[];if(i.length>0){s.push(n?`Rewrote ${i.length} site(s):`:`Would rewrite ${i.length} site(s) (pass --fix):`);for(let t of i)s.push(` ${t.file}:${t.line} [${t.rule}] ${t.snippet}`)}if(o.length>0){s.push("",`Needs a human \u2014 ${o.length} site(s):`);for(let t of o)s.push(` ${t.file}:${t.line} [${t.rule}] ${t.snippet}
6
- ${t.reason}`)}if(l.length>0){s.push("",`An stx primitive already covers this \u2014 ${l.length} site(s):`);for(let t of l)s.push(` ${t.file}:${t.line} [${t.rule}] ${t.snippet}
7
- use ${t.reason}`)}return s.join(`
5
+ `,n);return e.slice(i,o===-1?e.length:o).trim().slice(0,120)}function S(e,n){let i=e.slice(0,n),o=i.lastIndexOf("function"),l=i.lastIndexOf("=>"),r=Math.max(o,l);if(r===-1)return!1;let t=e.slice(Math.max(0,r-120),r);return/\basync\b[^;{}]*$/.test(t)}function k(e){return/\b(?:async\s+)?function\s+confirm\s*\(/.test(e)||/\b(?:const|let|var)\s+confirm\s*=/.test(e)||/\bimport\s*\{[^}]*\bconfirm\b[^}]*\}/.test(e)}function A(e,n,i){if(k(e))return e;let o=/(^|[^\w$.])(?:(?:window|globalThis)\s*\.\s*)?confirm\s*\(/g,l=m(e),r="",t=0,a;while((a=o.exec(l))!==null){let c=a.index+a[1].length,u=g(e,c),d=b(e,c);if(/stxConfirm\s*\($/.test(e.slice(0,c+8)))continue;let p=S(e,c);if(i.push({file:n,line:u,rule:"confirm",applied:p,snippet:d,reason:p?void 0:"stxConfirm() returns a Promise and native confirm() is synchronous, so this needs `await` inside an async function. Rewriting it here would make the condition always true."}),p)r+=e.slice(t,c)+"await stxConfirm(",t=c+(a[0].length-a[1].length)}return r+e.slice(t)}function E(e,n,i){let o=/(<[a-z][\w-]*\b[^>]*?)\stitle=(["'])(.*?)\2/gis,l=R(e),r="",t=0,a;while((a=o.exec(l))!==null){let[c,u,d,p]=a,h=g(e,a.index),f=b(e,a.index),w=u.match(/^<([A-Za-z][\w-]*)/)?.[1]??"";if(/^[A-Z]/.test(w)){i.push({file:n,line:h,rule:"tooltip",applied:!1,snippet:f,reason:`\`title\` on <${w}> is a component prop, not an HTML attribute \u2014 `+"adding x-tooltip here would put a tooltip on a component and may duplicate text it already renders."});continue}if(/\bx-tooltip[=\s]/.test(u)||p.trim()===""){i.push({file:n,line:h,rule:"tooltip",applied:!1,snippet:f,reason:/\bx-tooltip[=\s]/.test(u)?"already has x-tooltip":"empty title"});continue}i.push({file:n,line:h,rule:"tooltip",applied:!0,snippet:f}),r+=e.slice(t,a.index)+`${u} x-tooltip=${d}${p}${d} title=${d}${p}${d}`,t=a.index+c.length}return r+e.slice(t)}function R(e){return e.replace(/<!--[\s\S]*?-->/g,(n)=>n.replace(/[^\n]/g," ")).replace(/\{\{--[\s\S]*?--\}\}/g,(n)=>n.replace(/[^\n]/g," "))}function F(e){let n=(i)=>i.replace(/[^\n]/g," ");return e.replace(/\/\*[\s\S]*?\*\//g,n).replace(/\/\/[^\n]*/g,n)}function m(e,n=!1){let i=R(e);return(n?F(i):s(i)).replace(/<script\b([^>]*)>([\s\S]*?)<\/script\s*>/gi,(l,r)=>/\bclient\b/i.test(r)?l:l.replace(/[^\n]/g," "))}function O(e,n,i,o){let l=m(e),r=m(e,!0);for(let t of v){if(!i.includes(t.rule))continue;if(t.requires&&!t.requires(e))continue;t.pattern.lastIndex=0;let a,c=/['"]/.test(t.pattern.source)?r:l;t.pattern.lastIndex=0;while((a=t.pattern.exec(c))!==null){if(t.reject?.(e,a.index))continue;o.push({file:n,line:g(e,a.index),rule:t.rule,applied:!1,snippet:b(e,a.index),reason:`${t.primitive} \u2014 ${t.why}`})}}}function q(e,n={}){let i=n.rules??C,o=n.file??"<source>",l=[];O(e,o,i,l);let r=e;if(i.includes("confirm"))r=A(r,o,l);if(i.includes("tooltip"))r=E(r,o,l);l.sort((c,u)=>c.line-u.line);let t=new Set,a=l.filter((c)=>{let u=`${c.rule}:${c.line}`;if(t.has(u))return!1;return t.add(u),!0});return{code:r,findings:a}}var x=new Set(["confirm","tooltip"]);function I(e,n){if(e.length===0)return"No hand-rolled equivalents found.";let i=e.filter((t)=>t.applied),o=e.filter((t)=>!t.applied&&x.has(t.rule)),l=e.filter((t)=>!t.applied&&!x.has(t.rule)),r=[];if(i.length>0){r.push(n?`Rewrote ${i.length} site(s):`:`Would rewrite ${i.length} site(s) (pass --fix):`);for(let t of i)r.push(` ${t.file}:${t.line} [${t.rule}] ${t.snippet}`)}if(o.length>0){r.push("",`Needs a human \u2014 ${o.length} site(s):`);for(let t of o)r.push(` ${t.file}:${t.line} [${t.rule}] ${t.snippet}
6
+ ${t.reason}`)}if(l.length>0){r.push("",`An stx primitive already covers this \u2014 ${l.length} site(s):`);for(let t of l)r.push(` ${t.file}:${t.line} [${t.rule}] ${t.snippet}
7
+ use ${t.reason}`)}return r.join(`
8
8
  `)}export{q as codemodSource,I as formatCodemodFindings};
@@ -1,7 +1,7 @@
1
1
  // @bun
2
- import{g,m,d}from"./chunk-c4sskkv6.js";import{N}from"./chunk-9p452mq6.js";import{o}from"./chunk-qef5mz20.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=[],i=0,n;M.lastIndex=0;while((n=M.exec(e))!==null){if(n.index>i){let a=e.slice(i,n.index);if(a.trim())t.push({type:t.length===0?"shell":"content",content:a})}let s=n[1],r=n[2];t.push({type:"suspense",name:s,content:r}),i=n.index+n[0].length}if(i<e.length){let s=e.slice(i);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 qg(e,t={},i={}){let n={...N,...i,streaming:{...q,...i.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(r){try{let a=await Bun.file(e).text(),S=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),f=S?S[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),h={...t,__filename:e,__dirname:k.dirname(e)};if(f.trim())await g(f,h,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 o(c,h,e,n,u);for(let b=0;b<p.length;b+=s)r.enqueue(p.slice(b,b+s)),await new Promise((y)=>setTimeout(y,0))}else{let p=[],b=new RegExp(T.source,"g"),y;while((y=b.exec(c))!==null)p.push({name:y[1],content:y[2],start:y.index,end:y.index+y[0].length});let v=0;for(let _ of p){if(_.start>v){let I=c.slice(v,_.start);if(I.trim()){let O=await o(I,h,e,n,u);r.enqueue(O),await new Promise((D)=>setTimeout(D,0))}}let C=await o(_.content,h,e,n,u);r.enqueue(C),await new Promise((I)=>setTimeout(I,0)),v=_.end}if(v<c.length){let _=c.slice(v);if(_.trim()){let C=await o(_,h,e,n,u);r.enqueue(C)}}}}else{let w=new Map;for(let l of E)if(l.type==="shell"||l.type==="content"){let p=await o(l.content,h,e,n,u);r.enqueue(p)}else if(l.type==="suspense"&&l.name){let p=`stx-suspense-${l.name}`;r.enqueue(`<div id="${p}" data-suspense="${l.name}" style="display:contents;">
2
+ import{m,h,p}from"./chunk-kqdzjgm6.js";import{L}from"./chunk-59g266vc.js";import{i}from"./chunk-cam9je83.js";import k from"path";var q={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},T=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var M=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function H(e){let t=[],o=0,n;M.lastIndex=0;while((n=M.exec(e))!==null){if(n.index>o){let a=e.slice(o,n.index);if(a.trim())t.push({type:t.length===0?"shell":"content",content:a})}let s=n[1],r=n[2];t.push({type:"suspense",name:s,content:r}),o=n.index+n[0].length}if(o<e.length){let s=e.slice(o);if(s.trim())t.push({type:t.length===0?"shell":"content",content:s})}if(t.length===0)t.push({type:"shell",content:e});return t}async function Kg(e,t={},o={}){let n={...L,...o,streaming:{...q,...o.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(r){try{let a=await Bun.file(e).text(),S=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),g=S?S[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),y={...t,__filename:e,__dirname:k.dirname(e)};if(g.trim())await m(g,y,e);let E=H(c),l=new Set;if(!E.some((w)=>w.type==="suspense")){let w=n.streaming?.strategy||"auto",x=new RegExp(T.source,"g");if(!(w!=="manual"&&x.test(c))){let u=await i(c,y,e,n,l);for(let b=0;b<u.length;b+=s)r.enqueue(u.slice(b,b+s)),await new Promise((f)=>setTimeout(f,0))}else{let u=[],b=new RegExp(T.source,"g"),f;while((f=b.exec(c))!==null)u.push({name:f[1],content:f[2],start:f.index,end:f.index+f[0].length});let v=0;for(let _ of u){if(_.start>v){let I=c.slice(v,_.start);if(I.trim()){let O=await i(I,y,e,n,l);r.enqueue(O),await new Promise((D)=>setTimeout(D,0))}}let C=await i(_.content,y,e,n,l);r.enqueue(C),await new Promise((I)=>setTimeout(I,0)),v=_.end}if(v<c.length){let _=c.slice(v);if(_.trim()){let C=await i(_,y,e,n,l);r.enqueue(C)}}}}else{let w=new Map;for(let d of E)if(d.type==="shell"||d.type==="content"){let u=await i(d.content,y,e,n,l);r.enqueue(u)}else if(d.type==="suspense"&&d.name){let u=`stx-suspense-${d.name}`;r.enqueue(`<div id="${u}" data-suspense="${d.name}" style="display:contents;">
3
3
  <template data-suspense-fallback>Loading...</template>
4
- </div>`),w.set(l.name,o(l.content,h,e,n,u))}r.enqueue(`
4
+ </div>`),w.set(d.name,i(d.content,y,e,n,l))}r.enqueue(`
5
5
  <script>
6
6
  (function() {
7
7
  window.__stxSuspense = window.__stxSuspense || {
@@ -17,13 +17,13 @@ import{g,m,d}from"./chunk-c4sskkv6.js";import{N}from"./chunk-9p452mq6.js";import
17
17
  }
18
18
  };
19
19
  })();
20
- </script>`);let x=Array.from(w.entries()).map(async([l,p])=>{r.enqueue(await ta(l,p))});await Promise.all(x)}r.close()}catch(a){r.error(a)}}})}async function ta(e,t){try{let n=(await t).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
20
+ </script>`);let x=Array.from(w.entries()).map(async([d,u])=>{r.enqueue(await ra(d,u))});await Promise.all(x)}r.close()}catch(a){r.error(a)}}})}async function ra(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
- </script>`}catch(i){let n=i instanceof Error?i.message:String(i);return`
23
+ </script>`}catch(o){let n=o instanceof Error?o.message:String(o);return`
24
24
  <script>
25
- window.__stxSuspense.resolve('${e}', '<div class="stx-error">Error loading content: ${d(n)}</div>');
26
- </script>`}}var Ul=`
25
+ window.__stxSuspense.resolve('${e}', '<div class="stx-error">Error loading content: ${p(n)}</div>');
26
+ </script>`}}var ql=`
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,i){if(!t||t<=0)return e;let n,s=new Promise((r,a)=>{n=setTimeout(()=>a(Error(`streaming boundary "${i}" timed out after ${t}ms`)),t)});return Promise.race([e,s]).finally(()=>clearTimeout(n))}function Gg(e,t=[],i={}){let n=i.timeoutMs??0;return new ReadableStream({async start(s){try{if(s.enqueue(e),t.length>0)s.enqueue(Ul),await Promise.all(t.map(async(r)=>{let a=z(r.render(),n,r.id);s.enqueue(await ta(r.id,a))}));s.close()}catch(r){s.error(r)}}})}var A=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;function Kg(e,t){return e.replace(A,(i,n,s)=>{let r=n.trim(),a=s.split(/@fallback/i),S=a[0].trim(),f=a.length>1?a.slice(1).join("@fallback").trim():"";if(!t.__streamTemplates)t.__streamTemplates={};return t.__streamTemplates[r]=S,`<div data-suspense="${r}">${f}</div>`})}function Xg(e){let t=e?.streamBoundaries;if(!t||typeof t!=="object")return;let i=Object.entries(t).filter(([,n])=>typeof n==="function");return i.length>0?i.map(([n,s])=>({id:n,render:s})):void 0}async function Jg(e,t={},i={}){let n={...N,...i,streaming:{...q,...i.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(r){try{let a=await Bun.file(e).text(),S=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),f=S?S[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),h={...t,__filename:e,__dirname:k.dirname(e)};if(f.trim())await g(f,h,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 o(c,h,e,n,E);for(let l=0;l<x.length;l+=s)r.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 y of x){if(y.start>b){let _=c.slice(b,y.start);if(_.trim()){let C=await o(_,h,e,n,E);r.enqueue(C)}}let v=await o(y.content,h,e,n,E);r.enqueue(v),b=y.end}if(b<c.length){let y=c.slice(b);if(y.trim()){let v=await o(y,h,e,n,E);r.enqueue(v)}}}r.close()}catch(a){r.error(a)}}})}async function Yg(e,t={}){let i={...N,...t,streaming:{...q,...t.streaming}},n=await Bun.file(e).text(),s=n.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),r=s?s[1]:"",a=n.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),S=a,f={},c;T.lastIndex=0;while((c=T.exec(a))!==null){let u=c[1],R=c[2];f[u]=R}let h=a.replace(T,"");return{renderShell:async(u={})=>{let R={...u,__filename:e,__dirname:k.dirname(e)};return await g(r,R,e),o(h,R,e,i,new Set)},renderSection:async(u,R={})=>{try{if(!f[u])return`<div class="error-message">Section "${d(u)}" not found in template "${d(e)}"</div>`;let w={...R,__filename:e,__dirname:k.dirname(e)};await g(r,w,e);let x=new Set;return await o(f[u],w,e,i,x)}catch(w){let x=w instanceof Error?w.message:String(w);return m("Expression",x,e,f[u]||"",0,f[u]||"")}},getSections:()=>Object.keys(f),getTemplate:()=>S}}var Wl={name:"suspense",hasEndTag:!0,handler:(e,t,i,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} -->`}},ql={name:"island",hasEndTag:!0,handler:(e,t,i,n)=>{if(!t||t.length===0)throw Error("Island directive requires a name parameter");let s=t[0].replace(/['"`]/g,""),r=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),f=S?S[1].trim():"",c=S?e.replace(S[0],""):e;return`<div data-island="${s}" data-island-id="${a}" data-priority="${r}">
46
+ </script>`;function z(e,t,o){if(!t||t<=0)return e;let n,s=new Promise((r,a)=>{n=setTimeout(()=>a(Error(`streaming boundary "${o}" timed out after ${t}ms`)),t)});return Promise.race([e,s]).finally(()=>clearTimeout(n))}function Xg(e,t=[],o={}){let n=o.timeoutMs??0;return new ReadableStream({async start(s){try{if(s.enqueue(e),t.length>0)s.enqueue(ql),await Promise.all(t.map(async(r)=>{let a=z(r.render(),n,r.id);s.enqueue(await ra(r.id,a))}));s.close()}catch(r){s.error(r)}}})}var A=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;function Jg(e,t){return e.replace(A,(o,n,s)=>{let r=n.trim(),a=s.split(/@fallback/i),S=a[0].trim(),g=a.length>1?a.slice(1).join("@fallback").trim():"";if(!t.__streamTemplates)t.__streamTemplates={};return t.__streamTemplates[r]=S,`<div data-suspense="${r}">${g}</div>`})}function Yg(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 Zg(e,t={},o={}){let n={...L,...o,streaming:{...q,...o.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(r){try{let a=await Bun.file(e).text(),S=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),g=S?S[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),y={...t,__filename:e,__dirname:k.dirname(e)};if(g.trim())await m(g,y,e);let E=new Set,l=n.streaming?.strategy||"auto",R=new RegExp(T.source,"g");if(!(l!=="manual"&&R.test(c))){let x=await i(c,y,e,n,E);for(let d=0;d<x.length;d+=s)r.enqueue(x.slice(d,d+s))}else{let x=[],d=new RegExp(T.source,"g"),u;while((u=d.exec(c))!==null)x.push({name:u[1],content:u[2],start:u.index,end:u.index+u[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 i(_,y,e,n,E);r.enqueue(C)}}let v=await i(f.content,y,e,n,E);r.enqueue(v),b=f.end}if(b<c.length){let f=c.slice(b);if(f.trim()){let v=await i(f,y,e,n,E);r.enqueue(v)}}}r.close()}catch(a){r.error(a)}}})}async function Qg(e,t={}){let o={...L,...t,streaming:{...q,...t.streaming}},n=await Bun.file(e).text(),s=n.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),r=s?s[1]:"",a=n.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),S=a,g={},c;T.lastIndex=0;while((c=T.exec(a))!==null){let l=c[1],R=c[2];g[l]=R}let y=a.replace(T,"");return{renderShell:async(l={})=>{let R={...l,__filename:e,__dirname:k.dirname(e)};return await m(r,R,e),i(y,R,e,o,new Set)},renderSection:async(l,R={})=>{try{if(!g[l])return`<div class="error-message">Section "${p(l)}" not found in template "${p(e)}"</div>`;let w={...R,__filename:e,__dirname:k.dirname(e)};await m(r,w,e);let x=new Set;return await i(g[l],w,e,o,x)}catch(w){let x=w instanceof Error?w.message:String(w);return h("Expression",x,e,g[l]||"",0,g[l]||"")}},getSections:()=>Object.keys(g),getTemplate:()=>S}}var Gl={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} -->`}},Kl={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,""),r=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),g=S?S[1].trim():"",c=S?e.replace(S[0],""):e;return`<div data-island="${s}" data-island-id="${a}" data-priority="${r}">
47
47
  ${c}
48
48
  <script type="application/json" data-island-props="${a}">
49
- ${f?`{${f}}`:"{}"}
49
+ ${g?`{${g}}`:"{}"}
50
50
  </script>
51
- </div>`}};function Zg(e={}){let t=[];if(e.streaming?.enabled)t.push(Wl);if(e.hydration?.enabled)t.push(ql);return t}async function Qg(e,t,i,n={}){return e}function em(e,t={}){let i=new TextEncoder,n=e.pipeThrough(new TransformStream({transform(r,a){a.enqueue(i.encode(r))}})),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 tm(e={mode:"full"}){let{mode:t,components:i={},dynamicImports:n=!0}=e,s=Object.entries(i).map(([r,a])=>`'${r}': ${n?`() => import('${a}')`:`require('${a}')`}`).join(`,
51
+ </div>`}};function em(e={}){let t=[];if(e.streaming?.enabled)t.push(Gl);if(e.hydration?.enabled)t.push(Kl);return t}async function tm(e,t,o,n={}){return e}function nm(e,t={}){let o=new TextEncoder,n=e.pipeThrough(new TransformStream({transform(r,a){a.enqueue(o.encode(r))}})),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 rm(e={mode:"full"}){let{mode:t,components:o={},dynamicImports:n=!0}=e,s=Object.entries(o).map(([r,a])=>`'${r}': ${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{qg,ta,Ul,Gg,Kg,Xg,Jg,Yg,Wl,ql,Zg,Qg,em,tm};
194
+ export{Kg,ra,ql,Xg,Jg,Yg,Zg,Qg,Gl,Kl,em,tm,nm,rm};