@stacksjs/stx 0.2.412 → 0.2.414

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 (350) hide show
  1. package/dist/appearance-bootstrap.js +1 -1
  2. package/dist/binding-manifest.d.ts +1 -1
  3. package/dist/builtins/image-delivery.d.ts +38 -0
  4. package/dist/builtins/image-delivery.js +17 -0
  5. package/dist/builtins/stx-image.js +1 -5
  6. package/dist/bundle-analyzer.js +20 -20
  7. package/dist/chunk-020xyn9q.js +3 -0
  8. package/dist/chunk-04jhmfbz.js +2 -0
  9. package/dist/chunk-10957mcb.js +2 -0
  10. package/dist/chunk-1098mas0.js +2 -0
  11. package/dist/chunk-169n1vpx.js +12 -0
  12. package/dist/chunk-1b6t12hd.js +2 -0
  13. package/dist/chunk-1chw8xsw.js +2 -0
  14. package/dist/chunk-1xdzcy9d.js +14 -0
  15. package/dist/chunk-2ce7f416.js +2 -0
  16. package/dist/chunk-2gr351s0.js +7 -0
  17. package/dist/chunk-2mkcjw08.js +2 -0
  18. package/dist/chunk-2v8wztd5.js +2 -0
  19. package/dist/chunk-340a824p.js +2 -0
  20. package/dist/chunk-39g1134q.js +2 -0
  21. package/dist/chunk-3c74vag1.js +2 -0
  22. package/dist/chunk-3kthfs03.js +3 -0
  23. package/dist/chunk-3qn1wcdg.js +2 -0
  24. package/dist/chunk-3s2vnqcf.js +2 -0
  25. package/dist/chunk-48bwk47q.js +2 -0
  26. package/dist/chunk-4bjravgk.js +2 -0
  27. package/dist/chunk-4jjme6a5.js +2 -0
  28. package/dist/chunk-5g3y8kym.js +2 -0
  29. package/dist/chunk-5gsxpaqk.js +2 -0
  30. package/dist/{chunk-bwsxym3d.js → chunk-5qns2sdz.js} +17 -17
  31. package/dist/chunk-69mc2np8.js +2785 -0
  32. package/dist/chunk-6cfa3g0r.js +2 -0
  33. package/dist/{chunk-bjar18jd.js → chunk-6h38kkjf.js} +46 -52
  34. package/dist/chunk-6hc5vz20.js +3 -0
  35. package/dist/chunk-6q6g76vg.js +499 -0
  36. package/dist/{chunk-dbc5awz9.js → chunk-6sgswrqw.js} +29 -29
  37. package/dist/chunk-6y8hnymb.js +2 -0
  38. package/dist/chunk-74j18qk0.js +930 -0
  39. package/dist/chunk-752hw7cd.js +4 -0
  40. package/dist/{chunk-t5ja7qkn.js → chunk-765e1s44.js} +11 -76
  41. package/dist/chunk-7gkv67ky.js +4 -0
  42. package/dist/chunk-7z2ra0yf.js +2 -0
  43. package/dist/chunk-866n724v.js +2 -0
  44. package/dist/chunk-8nhshfz6.js +5 -0
  45. package/dist/chunk-92ps1xpk.js +2 -0
  46. package/dist/chunk-9g27ybyr.js +3 -0
  47. package/dist/{chunk-xq1acw1r.js → chunk-9pt8fd2n.js} +13 -13
  48. package/dist/{chunk-qvnbnsv9.js → chunk-9vrja6vp.js} +4 -4
  49. package/dist/chunk-9xrbve19.js +2 -0
  50. package/dist/chunk-a688m6js.js +3 -0
  51. package/dist/chunk-afhxw2t8.js +2 -0
  52. package/dist/chunk-ak1cgcah.js +5 -0
  53. package/dist/{chunk-4m7ajama.js → chunk-amd6ey3t.js} +14 -14
  54. package/dist/chunk-apg16xcn.js +2 -0
  55. package/dist/chunk-b52s5z0c.js +2 -0
  56. package/dist/chunk-b84h16er.js +61 -0
  57. package/dist/{chunk-hx998w7n.js → chunk-bay9s6rs.js} +13 -13
  58. package/dist/chunk-bmt7w2pk.js +2 -0
  59. package/dist/chunk-btmhj5t7.js +2 -0
  60. package/dist/chunk-ce1sejr3.js +3 -0
  61. package/dist/chunk-cg8hg6cs.js +3 -0
  62. package/dist/{chunk-8wp64mym.js → chunk-czxt605c.js} +4 -5
  63. package/dist/chunk-d44b9ktb.js +4 -0
  64. package/dist/chunk-daz5aqcf.js +24 -0
  65. package/dist/chunk-dgdm3hy3.js +2 -0
  66. package/dist/chunk-dvgv8nry.js +11 -0
  67. package/dist/chunk-dx7n22ed.js +2 -0
  68. package/dist/chunk-e57rhf65.js +3 -0
  69. package/dist/chunk-eed4fwps.js +3 -0
  70. package/dist/chunk-ej9j6k1q.js +3 -0
  71. package/dist/chunk-et0rr8c7.js +3 -0
  72. package/dist/chunk-f46qsp4m.js +4 -0
  73. package/dist/chunk-f6az0xj5.js +2 -0
  74. package/dist/{chunk-bjcsc6wx.js → chunk-fh1qrp68.js} +21 -21
  75. package/dist/chunk-fjs0a8h7.js +2 -0
  76. package/dist/chunk-fr2txj8q.js +829 -0
  77. package/dist/{chunk-vx86cf4r.js → chunk-ft4p6d28.js} +14 -14
  78. package/dist/chunk-fyzajkrx.js +2 -0
  79. package/dist/chunk-fzapbw9p.js +3 -0
  80. package/dist/chunk-g578mcb0.js +194 -0
  81. package/dist/chunk-gawrg4gb.js +216 -0
  82. package/dist/chunk-gw07qmjk.js +2 -0
  83. package/dist/chunk-h0atqq82.js +32 -0
  84. package/dist/chunk-h6zsqb9r.js +3 -0
  85. package/dist/{chunk-hdysywd8.js → chunk-h85hrwkq.js} +13 -13
  86. package/dist/chunk-hbxz85wy.js +2 -0
  87. package/dist/chunk-hjg3ndgh.js +2 -0
  88. package/dist/chunk-hkxsewzk.js +2 -0
  89. package/dist/chunk-hrbbbtbn.js +2 -0
  90. package/dist/chunk-j03revz2.js +8 -0
  91. package/dist/chunk-j9qcrwbg.js +2 -0
  92. package/dist/chunk-jk4njz0w.js +2 -0
  93. package/dist/chunk-jmabeqfq.js +2 -0
  94. package/dist/chunk-jt0n43mk.js +2 -0
  95. package/dist/chunk-kjbv8a3m.js +2 -0
  96. package/dist/chunk-m1vdghnx.js +2 -0
  97. package/dist/chunk-m4sk62wb.js +5 -0
  98. package/dist/chunk-md8rqn48.js +30 -0
  99. package/dist/chunk-mepdnezf.js +17 -0
  100. package/dist/chunk-mhq0pjws.js +2 -0
  101. package/dist/chunk-mp6hy8g4.js +2 -0
  102. package/dist/chunk-ngc2wke4.js +3 -0
  103. package/dist/chunk-nn2vstke.js +2 -0
  104. package/dist/chunk-p2v2a68k.js +2 -0
  105. package/dist/{chunk-qn5srnj3.js → chunk-pbh4smw3.js} +16 -16
  106. package/dist/chunk-pdt69hpb.js +2 -0
  107. package/dist/chunk-pgzvyrv6.js +29 -0
  108. package/dist/chunk-pj1wg7jg.js +2 -0
  109. package/dist/chunk-pqxzp1bb.js +3 -0
  110. package/dist/chunk-px7fvbj6.js +3 -0
  111. package/dist/chunk-q4c06e8x.js +20 -0
  112. package/dist/chunk-q6vrb2pe.js +2 -0
  113. package/dist/chunk-q7qchkvk.js +2 -0
  114. package/dist/chunk-q9bdh4s5.js +8 -0
  115. package/dist/chunk-qet5gc6s.js +2033 -0
  116. package/dist/chunk-qz519eyp.js +2 -0
  117. package/dist/chunk-r3f9jcf7.js +5 -0
  118. package/dist/chunk-rs4v4fha.js +4 -0
  119. package/dist/chunk-s2x4wcrz.js +2 -0
  120. package/dist/chunk-s5xezjps.js +3 -0
  121. package/dist/chunk-scezfp0w.js +30 -0
  122. package/dist/chunk-sd321bn3.js +2 -0
  123. package/dist/{chunk-eenk6s3t.js → chunk-sd47dzs0.js} +79 -79
  124. package/dist/chunk-se7mwqd1.js +2 -0
  125. package/dist/chunk-shr559s7.js +3 -0
  126. package/dist/chunk-syaw6b75.js +2 -0
  127. package/dist/chunk-t4hzprsm.js +3 -0
  128. package/dist/{chunk-s9za1vvd.js → chunk-t61vdbje.js} +89 -89
  129. package/dist/chunk-tfexmdkt.js +3 -0
  130. package/dist/chunk-thyt8ed8.js +6 -0
  131. package/dist/chunk-v091jft4.js +12 -0
  132. package/dist/chunk-v4vaqxrf.js +33 -0
  133. package/dist/chunk-vgvtnwxa.js +4 -0
  134. package/dist/chunk-x0q32ees.js +3 -0
  135. package/dist/chunk-x5bpeb4a.js +2 -0
  136. package/dist/chunk-x72tv2cg.js +3 -0
  137. package/dist/chunk-xfp7k0v8.js +64 -0
  138. package/dist/chunk-xtdw3692.js +6 -0
  139. package/dist/chunk-y1cmjvk3.js +43 -0
  140. package/dist/chunk-y5310237.js +311 -0
  141. package/dist/chunk-ya0qecph.js +27 -0
  142. package/dist/chunk-yazk54jr.js +8 -0
  143. package/dist/chunk-ydjfar14.js +2 -0
  144. package/dist/chunk-ym95v4nc.js +3 -0
  145. package/dist/chunk-ynvdvbat.js +18 -0
  146. package/dist/chunk-yvx1ap9b.js +3 -0
  147. package/dist/chunk-z0g9jvv0.js +40 -0
  148. package/dist/chunk-z6d0jmjb.js +2 -0
  149. package/dist/{chunk-fpwzacpm.js → chunk-zhxdpzga.js} +4 -4
  150. package/dist/cli.js +110 -110
  151. package/dist/craft-entry.js +7 -7
  152. package/dist/craft.js +7 -7
  153. package/dist/database.js +2 -2
  154. package/dist/image-optimization/component.js +4 -4
  155. package/dist/index.d.ts +2 -0
  156. package/dist/index.js +1 -0
  157. package/dist/media/image/component.js +5 -5
  158. package/dist/media/protected/component.js +2 -2
  159. package/dist/media/video/index.js +4 -4
  160. package/dist/native/bridge/protocol.d.ts +325 -0
  161. package/dist/native/bridge/protocol.js +219 -0
  162. package/dist/native/cli.d.ts +24 -0
  163. package/dist/native/cli.js +52 -0
  164. package/dist/native/compiler/bundle.d.ts +41 -0
  165. package/dist/native/compiler/bundle.js +90 -0
  166. package/dist/native/compiler/client-script.d.ts +8 -0
  167. package/dist/native/compiler/client-script.js +31 -0
  168. package/dist/native/compiler/codegen.d.ts +10 -0
  169. package/dist/native/compiler/codegen.js +145 -0
  170. package/dist/native/compiler/headwind-to-style.d.ts +395 -0
  171. package/dist/native/compiler/headwind-to-style.js +1163 -0
  172. package/dist/native/compiler/html-to-ir.d.ts +41 -0
  173. package/dist/native/compiler/html-to-ir.js +411 -0
  174. package/dist/native/compiler/icons.d.ts +220 -0
  175. package/dist/native/compiler/icons.js +208 -0
  176. package/dist/native/compiler/ir.d.ts +234 -0
  177. package/dist/native/compiler/ir.js +15 -0
  178. package/dist/native/compiler/parser.d.ts +88 -0
  179. package/dist/native/compiler/parser.js +753 -0
  180. package/dist/native/compiler/render-screen.d.ts +26 -0
  181. package/dist/native/compiler/render-screen.js +31 -0
  182. package/dist/native/components/primitives.d.ts +291 -0
  183. package/dist/native/components/primitives.js +22 -0
  184. package/dist/native/hot-reload/client.d.ts +62 -0
  185. package/dist/native/hot-reload/client.js +324 -0
  186. package/dist/native/index.d.ts +90 -0
  187. package/dist/native/index.js +34 -0
  188. package/dist/native/primitives/ActivityIndicator.stx +5 -0
  189. package/dist/native/primitives/Button.stx +5 -0
  190. package/dist/native/primitives/DatePicker.stx +5 -0
  191. package/dist/native/primitives/FlatList.stx +5 -0
  192. package/dist/native/primitives/Image.stx +5 -0
  193. package/dist/native/primitives/ImageBackground.stx +5 -0
  194. package/dist/native/primitives/KeyboardAvoidingView.stx +5 -0
  195. package/dist/native/primitives/Modal.stx +5 -0
  196. package/dist/native/primitives/Picker.stx +5 -0
  197. package/dist/native/primitives/Pressable.stx +5 -0
  198. package/dist/native/primitives/RefreshControl.stx +5 -0
  199. package/dist/native/primitives/SafeAreaView.stx +5 -0
  200. package/dist/native/primitives/ScrollView.stx +5 -0
  201. package/dist/native/primitives/SectionList.stx +5 -0
  202. package/dist/native/primitives/Slider.stx +5 -0
  203. package/dist/native/primitives/StatusBar.stx +5 -0
  204. package/dist/native/primitives/Switch.stx +5 -0
  205. package/dist/native/primitives/Text.stx +5 -0
  206. package/dist/native/primitives/TextInput.stx +5 -0
  207. package/dist/native/primitives/TouchableHighlight.stx +5 -0
  208. package/dist/native/primitives/TouchableOpacity.stx +5 -0
  209. package/dist/native/primitives/View.stx +5 -0
  210. package/dist/native/runtime/craft.d.ts +75 -0
  211. package/dist/native/runtime/craft.js +0 -0
  212. package/dist/native/runtime/entry.d.ts +1 -0
  213. package/dist/native/runtime/entry.js +3 -0
  214. package/dist/native/runtime/index.d.ts +45 -0
  215. package/dist/native/runtime/index.js +165 -0
  216. package/dist/native/runtime/native-host.d.ts +33 -0
  217. package/dist/native/runtime/native-host.js +184 -0
  218. package/dist/native/runtime/screen.d.ts +43 -0
  219. package/dist/native/runtime/screen.js +808 -0
  220. package/dist/pwa/service-worker.js +1 -1
  221. package/dist/pwa/workbox.js +1 -1
  222. package/dist/pwa.js +8 -8
  223. package/dist/site-url.d.ts +1 -1
  224. package/dist/ssg.js +53 -53
  225. package/dist/visual-testing.js +42 -42
  226. package/dist/web-components/reactive-generator.js +2 -2
  227. package/package.json +9 -5
  228. package/dist/chunk-00g9x6w2.js +0 -2
  229. package/dist/chunk-04tgatyy.js +0 -2
  230. package/dist/chunk-097jnwd5.js +0 -2
  231. package/dist/chunk-0btmm4m2.js +0 -147
  232. package/dist/chunk-0c2h69k2.js +0 -4
  233. package/dist/chunk-0pkk226n.js +0 -2
  234. package/dist/chunk-0we9nw1d.js +0 -3
  235. package/dist/chunk-0y46fbkx.js +0 -3
  236. package/dist/chunk-18n1ftn0.js +0 -33
  237. package/dist/chunk-1a0v39k5.js +0 -3
  238. package/dist/chunk-1fs9jvpb.js +0 -2
  239. package/dist/chunk-1qq26zt0.js +0 -2
  240. package/dist/chunk-1te8k8gp.js +0 -3
  241. package/dist/chunk-1ws3xcea.js +0 -1199
  242. package/dist/chunk-213jwgpx.js +0 -3
  243. package/dist/chunk-24w86pek.js +0 -32
  244. package/dist/chunk-27fgag95.js +0 -4
  245. package/dist/chunk-2fw05hs2.js +0 -3
  246. package/dist/chunk-2tbez006.js +0 -2
  247. package/dist/chunk-38wvkv3s.js +0 -2
  248. package/dist/chunk-3rkejwjp.js +0 -2
  249. package/dist/chunk-3t65wb35.js +0 -2
  250. package/dist/chunk-3w6z6tw9.js +0 -2
  251. package/dist/chunk-4q1c6fw2.js +0 -7
  252. package/dist/chunk-50pszj17.js +0 -2
  253. package/dist/chunk-563shnkz.js +0 -3
  254. package/dist/chunk-5h104qh1.js +0 -2
  255. package/dist/chunk-5qjk7drw.js +0 -20
  256. package/dist/chunk-603x5gb2.js +0 -2
  257. package/dist/chunk-6kd5jjwc.js +0 -2
  258. package/dist/chunk-6kdrncsx.js +0 -30
  259. package/dist/chunk-6zggmce7.js +0 -4422
  260. package/dist/chunk-72rwcbp6.js +0 -3
  261. package/dist/chunk-76w34xne.js +0 -3
  262. package/dist/chunk-7dmgt8at.js +0 -2
  263. package/dist/chunk-82pd4b5w.js +0 -2
  264. package/dist/chunk-8d7nf67s.js +0 -2
  265. package/dist/chunk-8w2mqdnv.js +0 -2
  266. package/dist/chunk-90b2vt2n.js +0 -2
  267. package/dist/chunk-9e8t0twa.js +0 -3
  268. package/dist/chunk-9fqp72ze.js +0 -5
  269. package/dist/chunk-9xew0kgf.js +0 -2
  270. package/dist/chunk-a7bnvz91.js +0 -24
  271. package/dist/chunk-akwd34xt.js +0 -29
  272. package/dist/chunk-anydpa34.js +0 -3
  273. package/dist/chunk-aq1xq0r4.js +0 -16
  274. package/dist/chunk-bbt3tp6f.js +0 -499
  275. package/dist/chunk-bn1edb1y.js +0 -47
  276. package/dist/chunk-btd7ds3x.js +0 -2
  277. package/dist/chunk-c4511wng.js +0 -2
  278. package/dist/chunk-c4h579e3.js +0 -2
  279. package/dist/chunk-cj3adc77.js +0 -5
  280. package/dist/chunk-cs54ek9m.js +0 -6
  281. package/dist/chunk-ct1jwd4r.js +0 -2
  282. package/dist/chunk-cxrgxzxc.js +0 -2
  283. package/dist/chunk-de8t7sc9.js +0 -17
  284. package/dist/chunk-fcnrgxck.js +0 -2
  285. package/dist/chunk-fqzcft9d.js +0 -2
  286. package/dist/chunk-gbmeh7jg.js +0 -3
  287. package/dist/chunk-gc06g35w.js +0 -2
  288. package/dist/chunk-gs18069g.js +0 -194
  289. package/dist/chunk-gvbf1mhs.js +0 -930
  290. package/dist/chunk-h564hgzt.js +0 -2
  291. package/dist/chunk-h83jrhfq.js +0 -3
  292. package/dist/chunk-hj4vpyhp.js +0 -2
  293. package/dist/chunk-hrkvsj5c.js +0 -11
  294. package/dist/chunk-hyr4ag1k.js +0 -2
  295. package/dist/chunk-jxvmf02k.js +0 -2
  296. package/dist/chunk-k5ptvy0b.js +0 -4
  297. package/dist/chunk-k80sn8d1.js +0 -2
  298. package/dist/chunk-k8t2cmyd.js +0 -2
  299. package/dist/chunk-kmsyvaex.js +0 -8
  300. package/dist/chunk-kq4b6cwj.js +0 -2
  301. package/dist/chunk-kvmx7dnb.js +0 -2
  302. package/dist/chunk-kxc2h5vn.js +0 -5
  303. package/dist/chunk-mbxehgrq.js +0 -2
  304. package/dist/chunk-mgnq5de2.js +0 -2
  305. package/dist/chunk-mgrckqww.js +0 -2
  306. package/dist/chunk-mq5ewmz6.js +0 -2
  307. package/dist/chunk-mrahwn5v.js +0 -8
  308. package/dist/chunk-n2swas11.js +0 -3
  309. package/dist/chunk-n4299xgy.js +0 -2
  310. package/dist/chunk-naw4jt7j.js +0 -2
  311. package/dist/chunk-ny67c03k.js +0 -3
  312. package/dist/chunk-p4jb9v0w.js +0 -2
  313. package/dist/chunk-p4zrvt5f.js +0 -14
  314. package/dist/chunk-p5wp0ce6.js +0 -43
  315. package/dist/chunk-pcxp4r9n.js +0 -3
  316. package/dist/chunk-pjrn29gg.js +0 -2
  317. package/dist/chunk-prxwsp7n.js +0 -2
  318. package/dist/chunk-py2r6wtv.js +0 -2
  319. package/dist/chunk-q738pwv6.js +0 -2
  320. package/dist/chunk-q9n5swx7.js +0 -3
  321. package/dist/chunk-qmmp5kb5.js +0 -2
  322. package/dist/chunk-qqpqgwvb.js +0 -30
  323. package/dist/chunk-rcv2ehpq.js +0 -18
  324. package/dist/chunk-rq414kn5.js +0 -3
  325. package/dist/chunk-rz9f3zqz.js +0 -7
  326. package/dist/chunk-s6g8wksg.js +0 -2
  327. package/dist/chunk-s8jd13nb.js +0 -3
  328. package/dist/chunk-spxsw4mp.js +0 -2
  329. package/dist/chunk-strcy64y.js +0 -2
  330. package/dist/chunk-t1htzg9e.js +0 -4
  331. package/dist/chunk-t1tdjjht.js +0 -216
  332. package/dist/chunk-tat1cjec.js +0 -2
  333. package/dist/chunk-td08rnk3.js +0 -3
  334. package/dist/chunk-tgadbsd4.js +0 -2
  335. package/dist/chunk-tgrpp58r.js +0 -2
  336. package/dist/chunk-tkyrk66a.js +0 -3
  337. package/dist/chunk-tp8pzf94.js +0 -3
  338. package/dist/chunk-twz64kvy.js +0 -2
  339. package/dist/chunk-v3nwkveg.js +0 -12
  340. package/dist/chunk-vsbmc9kt.js +0 -2
  341. package/dist/chunk-vzgzaw66.js +0 -12
  342. package/dist/chunk-wc66mcn4.js +0 -4367
  343. package/dist/chunk-wkanrfb3.js +0 -2
  344. package/dist/chunk-x8f6wqxd.js +0 -2
  345. package/dist/chunk-xsng1mtq.js +0 -3
  346. package/dist/chunk-xwts5yky.js +0 -4
  347. package/dist/chunk-z5rwnnk1.js +0 -3
  348. package/dist/chunk-zcz9rs6p.js +0 -3
  349. package/dist/chunk-zpcnbdhn.js +0 -64
  350. package/dist/chunk-zq4ssxj9.js +0 -8
@@ -1,499 +0,0 @@
1
- // @bun
2
- import"./chunk-2fw05hs2.js";import v from"fs";import H from"path";import{gzipSync as z}from"zlib";import{createHash as g}from"crypto";var D={".js":"js",".mjs":"js",".cjs":"js",".ts":"js",".jsx":"js",".tsx":"js",".css":"css",".scss":"css",".sass":"css",".less":"css",".html":"html",".htm":"html",".png":"image",".jpg":"image",".jpeg":"image",".gif":"image",".svg":"image",".webp":"image",".avif":"image",".ico":"image",".woff":"font",".woff2":"font",".ttf":"font",".eot":"font",".otf":"font"},b=[/node_modules/,/vendor/,/bower_components/,/\.min\./],B=[/index\.(js|ts|html)$/,/main\.(js|ts)$/,/app\.(js|ts)$/,/entry\.(js|ts)$/];async function L(X,Z={}){let{includeSourceMaps:Q=!1,parseImports:$=!0,detectDuplicates:U=!0,topModulesCount:K=20}=Z;if(!v.existsSync(X))throw Error(`Build directory not found: ${X}`);if(!v.statSync(X).isDirectory())throw Error(`Not a directory: ${X}`);let q=await k(X,Q),J=[],F=[];for(let A of q)try{let O=await f(A,X,$);J.push(O)}catch(O){F.push(`Failed to process ${A}: ${O}`)}let Y=c(J,X),V=J.reduce((A,O)=>A+O.size,0),_=J.reduce((A,O)=>A+O.gzipSize,0),w=m(J),G=U?p(J):[],C=[...J].sort((A,O)=>O.size-A.size).slice(0,K);return{timestamp:Date.now(),buildDir:H.resolve(X),chunks:Y,totalSize:V,totalGzipSize:_,moduleCount:J.length,duplicates:G,byType:w,largestModules:C,warnings:F}}async function k(X,Z){let Q=[];async function $(U){let K=await v.promises.readdir(U,{withFileTypes:!0});for(let j of K){let q=H.join(U,j.name);if(j.isDirectory()){if(!j.name.startsWith(".")&&j.name!=="node_modules")await $(q)}else if(j.isFile()){if(!Z&&j.name.endsWith(".map"))continue;Q.push(q)}}}return await $(X),Q}async function f(X,Z,Q){let $=await v.promises.readFile(X),U=H.relative(Z,X),K=H.extname(X).toLowerCase(),j=$.length,q=y($),J=h($,K),F=g("md5").update($).digest("hex").slice(0,8),Y=D[K]||"other",V=[];if(Q&&Y==="js")V.push(...d($.toString("utf-8")));return{id:U,path:U,size:j,gzipSize:q,parsedSize:J,extension:K,type:Y,imports:V,importedBy:[],hash:F}}function y(X){try{let Z=z(X,{level:9}).length;return Math.min(Z,X.length)}catch{return X.length}}function h(X,Z){if(Z.includes(".min.")||X.length<1000)return X.length;let $=D[Z];if($==="js")return Math.round(X.length*0.6);if($==="css")return Math.round(X.length*0.7);return X.length}function d(X){let Z=[],Q=/import\s+(?:[\w*{}\s,]+\s+from\s+)?['"]([^'"]+)['"]/g,$;while(($=Q.exec(X))!==null)Z.push($[1]);let U=/import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;while(($=U.exec(X))!==null)Z.push($[1]);let K=/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g;while(($=K.exec(X))!==null)Z.push($[1]);return[...new Set(Z)]}function c(X,Z){let Q=new Map;for(let U of X){let K=U.path.split(H.sep),j;if(K.length===1)j=H.basename(U.path,U.extension);else j=K[0];let q=Q.get(j)||[];q.push(U),Q.set(j,q)}let $=[];for(let[U,K]of Q){let j=K.reduce((Y,V)=>Y+V.size,0),q=K.reduce((Y,V)=>Y+V.gzipSize,0),J=K.some((Y)=>B.some((V)=>V.test(Y.path))),F=K.some((Y)=>b.some((V)=>V.test(Y.path)));$.push({name:U,files:K.map((Y)=>Y.path),modules:K,size:j,gzipSize:q,isEntry:J,isVendor:F})}return $.sort((U,K)=>K.size-U.size)}function m(X){let Z={js:{count:0,size:0,gzipSize:0},css:{count:0,size:0,gzipSize:0},html:{count:0,size:0,gzipSize:0},image:{count:0,size:0,gzipSize:0},font:{count:0,size:0,gzipSize:0},other:{count:0,size:0,gzipSize:0}};for(let Q of X)Z[Q.type].count++,Z[Q.type].size+=Q.size,Z[Q.type].gzipSize+=Q.gzipSize;return Z}function p(X){let Z=new Map;for(let $ of X){let U=Z.get($.hash)||[];U.push($),Z.set($.hash,U)}let Q=[];for(let[,$]of Z)if($.length>1){let U=$[0];Q.push({path:U.path,count:$.length,wastedBytes:U.size*($.length-1),locations:$.map((K)=>K.path)})}return Q.sort(($,U)=>U.wastedBytes-$.wastedBytes)}function W(X){if(X<1024)return`${X} B`;if(X<1048576)return`${(X/1024).toFixed(2)} KB`;return`${(X/1048576).toFixed(2)} MB`}function I(X){let Z=X.match(/^([\d.]+)\s*(B|KB|MB|GB)?$/i);if(!Z)return 0;let Q=Number.parseFloat(Z[1]);switch((Z[2]||"B").toUpperCase()){case"KB":return Q*1024;case"MB":return Q*1024*1024;case"GB":return Q*1024*1024*1024;default:return Q}}function E(X,Z){if(Z===0)return"0%";return`${(X/Z*100).toFixed(1)}%`}function R(X,Z){switch(Z.format){case"json":return u(X,Z);case"markdown":return l(X,Z);case"text":default:return r(X,Z)}}function u(X,Z){let Q=N(X,Z);return JSON.stringify({timestamp:X.timestamp,buildDir:X.buildDir,summary:{totalSize:X.totalSize,totalSizeFormatted:W(X.totalSize),totalGzipSize:X.totalGzipSize,totalGzipSizeFormatted:W(X.totalGzipSize),moduleCount:X.moduleCount,chunkCount:X.chunks.length,duplicateCount:X.duplicates.length},byType:Object.fromEntries(Object.entries(X.byType).map(([$,U])=>[$,{...U,sizeFormatted:W(U.size),gzipSizeFormatted:W(U.gzipSize)}])),chunks:X.chunks.map(($)=>({name:$.name,size:$.size,sizeFormatted:W($.size),gzipSize:$.gzipSize,gzipSizeFormatted:W($.gzipSize),moduleCount:$.modules.length,isEntry:$.isEntry,isVendor:$.isVendor})),largestModules:X.largestModules.slice(0,Z.topModules||10).map(($)=>({path:$.path,size:$.size,sizeFormatted:W($.size),gzipSize:$.gzipSize,gzipSizeFormatted:W($.gzipSize),type:$.type})),duplicates:X.duplicates,analysis:Q,warnings:X.warnings},null,2)}function r(X,Z){let Q=[],$=Z.showGzip!==!1;if(Q.push(""),Q.push("Bundle Analysis Report"),Q.push("\u2550".repeat(50)),Q.push(""),Q.push("Summary"),Q.push("\u2500".repeat(50)),$)Q.push(`Total Size: ${W(X.totalSize)} (${W(X.totalGzipSize)} gzip)`);else Q.push(`Total Size: ${W(X.totalSize)}`);if(Q.push(`Modules: ${X.moduleCount}`),Q.push(`Chunks: ${X.chunks.length}`),X.duplicates.length>0)Q.push(`Duplicates: ${X.duplicates.length}`);if(Q.push(""),Z.threshold&&X.totalSize>Z.threshold)Q.push(`\u26A0\uFE0F Bundle exceeds threshold of ${W(Z.threshold)}!`),Q.push("");Q.push("Size by Type"),Q.push("\u2500".repeat(50));let U=["js","css","html","image","font","other"];for(let j of U){let q=X.byType[j];if(q.count>0){let J=E(q.size,X.totalSize),F=$?` (${W(q.gzipSize)} gzip)`:"";Q.push(` ${j.padEnd(8)} ${W(q.size).padStart(12)}${F} ${J.padStart(6)} (${q.count} files)`)}}Q.push(""),Q.push("Chunks"),Q.push("\u2500".repeat(50));for(let j of X.chunks.slice(0,10)){let q=[];if(j.isEntry)q.push("entry");if(j.isVendor)q.push("vendor");let J=q.length>0?` [${q.join(", ")}]`:"",F=$?` (${W(j.gzipSize)} gzip)`:"";Q.push(` ${j.name.padEnd(20)} ${W(j.size).padStart(12)}${F}${J}`)}if(X.chunks.length>10)Q.push(` ... and ${X.chunks.length-10} more chunks`);Q.push("");let K=Z.topModules||10;Q.push(`Largest Modules (Top ${K})`),Q.push("\u2500".repeat(50));for(let j=0;j<Math.min(K,X.largestModules.length);j++){let q=X.largestModules[j],J=$?` (${W(q.gzipSize)} gzip)`:"";Q.push(` ${(j+1).toString().padStart(2)}. ${q.path}`),Q.push(` ${W(q.size)}${J}`)}if(Q.push(""),X.duplicates.length>0){Q.push("Duplicate Modules"),Q.push("\u2500".repeat(50));for(let j of X.duplicates.slice(0,5))Q.push(` ${j.path}`),Q.push(` ${j.count} copies, wasting ${W(j.wastedBytes)}`);if(X.duplicates.length>5)Q.push(` ... and ${X.duplicates.length-5} more duplicates`);Q.push("")}if(Z.recommendations!==!1){let j=N(X,Z);if(j.recommendations.length>0){Q.push("Recommendations"),Q.push("\u2500".repeat(50));for(let q of j.recommendations.slice(0,5)){let J=q.impact==="high"?"\u26A1":q.impact==="medium"?"\uD83D\uDCCA":"\uD83D\uDCA1";Q.push(` ${J} ${q.title}`),Q.push(` ${q.description}`)}Q.push("")}}if(X.warnings.length>0){Q.push("Warnings"),Q.push("\u2500".repeat(50));for(let j of X.warnings)Q.push(` \u26A0\uFE0F ${j}`);Q.push("")}return Q.join(`
3
- `)}function l(X,Z){let Q=[],$=Z.showGzip!==!1;if(Q.push("# Bundle Analysis Report"),Q.push(""),Q.push(`Generated: ${new Date(X.timestamp).toISOString()}`),Q.push(""),Q.push("## Summary"),Q.push(""),Q.push("| Metric | Value |"),Q.push("|--------|-------|"),Q.push(`| Total Size | ${W(X.totalSize)} |`),$)Q.push(`| Gzip Size | ${W(X.totalGzipSize)} |`);Q.push(`| Modules | ${X.moduleCount} |`),Q.push(`| Chunks | ${X.chunks.length} |`),Q.push(`| Duplicates | ${X.duplicates.length} |`),Q.push(""),Q.push("## Size by Type"),Q.push(""),Q.push("| Type | Size | Gzip | % | Files |"),Q.push("|------|------|------|---|-------|");let U=["js","css","html","image","font","other"];for(let j of U){let q=X.byType[j];if(q.count>0)Q.push(`| ${j} | ${W(q.size)} | ${W(q.gzipSize)} | ${E(q.size,X.totalSize)} | ${q.count} |`)}Q.push(""),Q.push("## Chunks"),Q.push(""),Q.push("| Name | Size | Gzip | Modules | Type |"),Q.push("|------|------|------|---------|------|");for(let j of X.chunks.slice(0,15)){let q=j.isEntry?"Entry":j.isVendor?"Vendor":"-";Q.push(`| ${j.name} | ${W(j.size)} | ${W(j.gzipSize)} | ${j.modules.length} | ${q} |`)}Q.push("");let K=Z.topModules||10;Q.push(`## Largest Modules (Top ${K})`),Q.push(""),Q.push("| # | Path | Size | Gzip |"),Q.push("|---|------|------|------|");for(let j=0;j<Math.min(K,X.largestModules.length);j++){let q=X.largestModules[j];Q.push(`| ${j+1} | \`${q.path}\` | ${W(q.size)} | ${W(q.gzipSize)} |`)}if(Q.push(""),X.duplicates.length>0){Q.push("## Duplicates"),Q.push(""),Q.push("| Path | Copies | Wasted |"),Q.push("|------|--------|--------|");for(let j of X.duplicates.slice(0,10))Q.push(`| \`${j.path}\` | ${j.count} | ${W(j.wastedBytes)} |`);Q.push("")}if(Z.recommendations!==!1){let j=N(X,Z);if(j.recommendations.length>0){Q.push("## Recommendations"),Q.push("");for(let q of j.recommendations)Q.push(`### ${q.title}`),Q.push(""),Q.push(q.description),Q.push(""),Q.push(`- **Impact:** ${q.impact}`),Q.push(`- **Effort:** ${q.effort}`),Q.push("")}}return Q.join(`
4
- `)}function N(X,Z){let Q=[],$=[];if(Z.threshold&&X.totalSize>Z.threshold)Q.push({severity:"error",message:`Bundle size (${W(X.totalSize)}) exceeds threshold (${W(Z.threshold)})`});if(X.totalSize>1048576)Q.push({severity:"warning",message:`Bundle is over 1MB (${W(X.totalSize)})`,details:"Large bundles can significantly impact load time"});if(X.duplicates.length>0){let q=X.duplicates.reduce((J,F)=>J+F.wastedBytes,0);Q.push({severity:"warning",message:`${X.duplicates.length} duplicate modules found, wasting ${W(q)}`}),$.push({title:"Remove Duplicate Modules",description:"Consider using import aliases or ensuring consistent package versions to eliminate duplicates.",impact:"medium",effort:"low"})}if(X.byType.js.size/X.totalSize>0.8&&X.totalSize>512000)$.push({title:"Code Splitting",description:"Over 80% of your bundle is JavaScript. Consider splitting code by route or feature.",impact:"high",effort:"medium"});let K=X.largestModules.filter((q)=>q.size>102400);if(K.length>0){Q.push({severity:"info",message:`${K.length} modules are over 100KB`});for(let q of K){if(q.path.includes("lodash")&&!q.path.includes("lodash-es"))$.push({title:"Use lodash-es instead of lodash",description:"lodash-es supports tree-shaking and can significantly reduce bundle size.",impact:"high",effort:"low"});if(q.path.includes("moment"))$.push({title:"Replace moment.js",description:"Consider using date-fns or dayjs for smaller date handling libraries.",impact:"high",effort:"medium"})}}if(X.byType.image.size>512000)$.push({title:"Optimize Images",description:`Images account for ${W(X.byType.image.size)}. Consider using WebP/AVIF formats and responsive images.`,impact:"high",effort:"low"});let j=100;if(X.totalSize>1048576)j-=20;else if(X.totalSize>512000)j-=10;if(j-=Math.min(20,X.duplicates.length*2),j-=Math.min(15,K.length*3),Z.threshold&&X.totalSize>Z.threshold)j-=25;return{score:Math.max(0,j),issues:Q,recommendations:$}}var i={lodash:{alternative:"lodash-es or individual imports",savings:"~70%"},moment:{alternative:"date-fns or dayjs",savings:"~90%"},"chart.js":{alternative:"chart.js with tree-shaking",savings:"~50%"},"highlight.js":{alternative:"Selective language imports",savings:"~80%"},fontawesome:{alternative:"Individual icon imports",savings:"~90%"},"material-ui":{alternative:"Named imports from @mui/*",savings:"~60%"}};function n(X){for(let[Z,Q]of Object.entries(i))if(X.includes(Z))return{title:`Optimize ${Z}`,description:`Consider using ${Q.alternative}. Potential savings: ${Q.savings}`,impact:"high",effort:"low"};return null}var o={default:{js:"#f7df1e",css:"#264de4",html:"#e34c26",image:"#4caf50",font:"#9c27b0",other:"#607d8b",vendor:"#ff5722"},pastel:{js:"#fff3b0",css:"#b0d4ff",html:"#ffb0b0",image:"#b0ffb0",font:"#e0b0ff",other:"#d0d0d0",vendor:"#ffcfb0"},monochrome:{js:"#333333",css:"#555555",html:"#777777",image:"#999999",font:"#bbbbbb",other:"#dddddd",vendor:"#444444"}};function x(X,Z={}){let{title:Q="Bundle Analysis",gzip:$=!0,colorScheme:U="default"}=Z,K=o[U],j=a(X),q=JSON.stringify(j);return`<!DOCTYPE html>
5
- <html lang="en">
6
- <head>
7
- <meta charset="UTF-8">
8
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
9
- <title>${M(Q)}</title>
10
- <style>
11
- * {
12
- box-sizing: border-box;
13
- margin: 0;
14
- padding: 0;
15
- }
16
-
17
- body {
18
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
19
- background: #1a1a2e;
20
- color: #eee;
21
- min-height: 100vh;
22
- }
23
-
24
- .header {
25
- background: #16213e;
26
- padding: 1rem 2rem;
27
- display: flex;
28
- justify-content: space-between;
29
- align-items: center;
30
- border-bottom: 1px solid #0f3460;
31
- }
32
-
33
- .header h1 {
34
- font-size: 1.5rem;
35
- font-weight: 500;
36
- }
37
-
38
- .stats {
39
- display: flex;
40
- gap: 2rem;
41
- }
42
-
43
- .stat {
44
- text-align: center;
45
- }
46
-
47
- .stat-value {
48
- font-size: 1.25rem;
49
- font-weight: bold;
50
- color: #e94560;
51
- }
52
-
53
- .stat-label {
54
- font-size: 0.75rem;
55
- color: #888;
56
- text-transform: uppercase;
57
- }
58
-
59
- .controls {
60
- background: #16213e;
61
- padding: 0.75rem 2rem;
62
- display: flex;
63
- gap: 1rem;
64
- align-items: center;
65
- border-bottom: 1px solid #0f3460;
66
- }
67
-
68
- .controls label {
69
- display: flex;
70
- align-items: center;
71
- gap: 0.5rem;
72
- cursor: pointer;
73
- }
74
-
75
- .controls input[type="checkbox"] {
76
- width: 1rem;
77
- height: 1rem;
78
- }
79
-
80
- .search-box {
81
- flex: 1;
82
- max-width: 300px;
83
- }
84
-
85
- .search-box input {
86
- width: 100%;
87
- padding: 0.5rem 1rem;
88
- border: 1px solid #0f3460;
89
- border-radius: 4px;
90
- background: #1a1a2e;
91
- color: #eee;
92
- font-size: 0.875rem;
93
- }
94
-
95
- .search-box input:focus {
96
- outline: none;
97
- border-color: #e94560;
98
- }
99
-
100
- .breadcrumb {
101
- background: #16213e;
102
- padding: 0.5rem 2rem;
103
- display: flex;
104
- gap: 0.5rem;
105
- align-items: center;
106
- font-size: 0.875rem;
107
- border-bottom: 1px solid #0f3460;
108
- }
109
-
110
- .breadcrumb-item {
111
- color: #888;
112
- cursor: pointer;
113
- }
114
-
115
- .breadcrumb-item:hover {
116
- color: #e94560;
117
- }
118
-
119
- .breadcrumb-item.active {
120
- color: #eee;
121
- cursor: default;
122
- }
123
-
124
- .breadcrumb-sep {
125
- color: #444;
126
- }
127
-
128
- #treemap {
129
- width: 100%;
130
- height: calc(100vh - 180px);
131
- min-height: 400px;
132
- }
133
-
134
- .tooltip {
135
- position: fixed;
136
- background: #16213e;
137
- border: 1px solid #0f3460;
138
- border-radius: 4px;
139
- padding: 0.75rem 1rem;
140
- pointer-events: none;
141
- z-index: 1000;
142
- max-width: 400px;
143
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
144
- }
145
-
146
- .tooltip-title {
147
- font-weight: bold;
148
- margin-bottom: 0.5rem;
149
- word-break: break-all;
150
- }
151
-
152
- .tooltip-row {
153
- display: flex;
154
- justify-content: space-between;
155
- gap: 2rem;
156
- font-size: 0.875rem;
157
- color: #888;
158
- }
159
-
160
- .tooltip-row span:last-child {
161
- color: #eee;
162
- font-weight: 500;
163
- }
164
-
165
- .legend {
166
- position: fixed;
167
- bottom: 1rem;
168
- right: 1rem;
169
- background: #16213e;
170
- border: 1px solid #0f3460;
171
- border-radius: 4px;
172
- padding: 0.75rem 1rem;
173
- }
174
-
175
- .legend-title {
176
- font-size: 0.75rem;
177
- color: #888;
178
- margin-bottom: 0.5rem;
179
- text-transform: uppercase;
180
- }
181
-
182
- .legend-item {
183
- display: flex;
184
- align-items: center;
185
- gap: 0.5rem;
186
- font-size: 0.75rem;
187
- margin-bottom: 0.25rem;
188
- }
189
-
190
- .legend-color {
191
- width: 12px;
192
- height: 12px;
193
- border-radius: 2px;
194
- }
195
-
196
- .node {
197
- cursor: pointer;
198
- transition: opacity 0.2s;
199
- }
200
-
201
- .node:hover {
202
- opacity: 0.8;
203
- }
204
-
205
- .node-label {
206
- font-size: 11px;
207
- fill: #000;
208
- pointer-events: none;
209
- text-anchor: middle;
210
- }
211
- </style>
212
- </head>
213
- <body>
214
- <div class="header">
215
- <h1>${M(Q)}</h1>
216
- <div class="stats">
217
- <div class="stat">
218
- <div class="stat-value" id="total-size">${W(X.totalSize)}</div>
219
- <div class="stat-label">Total Size</div>
220
- </div>
221
- <div class="stat">
222
- <div class="stat-value" id="gzip-size">${W(X.totalGzipSize)}</div>
223
- <div class="stat-label">Gzip Size</div>
224
- </div>
225
- <div class="stat">
226
- <div class="stat-value">${X.moduleCount}</div>
227
- <div class="stat-label">Modules</div>
228
- </div>
229
- <div class="stat">
230
- <div class="stat-value">${X.chunks.length}</div>
231
- <div class="stat-label">Chunks</div>
232
- </div>
233
- </div>
234
- </div>
235
-
236
- <div class="controls">
237
- <div class="search-box">
238
- <input type="text" id="search" placeholder="Search modules...">
239
- </div>
240
- <label>
241
- <input type="checkbox" id="show-gzip" ${$?"checked":""}>
242
- Show Gzip Size
243
- </label>
244
- </div>
245
-
246
- <div class="breadcrumb" id="breadcrumb">
247
- <span class="breadcrumb-item active">root</span>
248
- </div>
249
-
250
- <div id="treemap"></div>
251
-
252
- <div class="tooltip" id="tooltip" style="display: none;"></div>
253
-
254
- <div class="legend">
255
- <div class="legend-title">File Types</div>
256
- <div class="legend-item">
257
- <div class="legend-color" style="background: ${K.js}"></div>
258
- <span>JavaScript</span>
259
- </div>
260
- <div class="legend-item">
261
- <div class="legend-color" style="background: ${K.css}"></div>
262
- <span>CSS</span>
263
- </div>
264
- <div class="legend-item">
265
- <div class="legend-color" style="background: ${K.html}"></div>
266
- <span>HTML</span>
267
- </div>
268
- <div class="legend-item">
269
- <div class="legend-color" style="background: ${K.image}"></div>
270
- <span>Images</span>
271
- </div>
272
- <div class="legend-item">
273
- <div class="legend-color" style="background: ${K.font}"></div>
274
- <span>Fonts</span>
275
- </div>
276
- <div class="legend-item">
277
- <div class="legend-color" style="background: ${K.other}"></div>
278
- <span>Other</span>
279
- </div>
280
- </div>
281
-
282
- <script src="https://d3js.org/d3.v7.min.js"></script>
283
- <script>
284
- const data = ${q};
285
- const colors = ${JSON.stringify(K)};
286
-
287
- let showGzip = ${$};
288
- let currentRoot = data;
289
- let searchTerm = '';
290
-
291
- const container = document.getElementById('treemap');
292
- const tooltip = document.getElementById('tooltip');
293
- const breadcrumb = document.getElementById('breadcrumb');
294
- const searchInput = document.getElementById('search');
295
- const showGzipCheckbox = document.getElementById('show-gzip');
296
-
297
- function formatSize(bytes) {
298
- if (bytes < 1024) return bytes + ' B';
299
- if (bytes < 1024 * 1024) return (bytes / 1024).toFixed(2) + ' KB';
300
- return (bytes / (1024 * 1024)).toFixed(2) + ' MB';
301
- }
302
-
303
- function getColor(d) {
304
- if (d.data.type) {
305
- return colors[d.data.type] || colors.other;
306
- }
307
- if (d.data.name.includes('node_modules') || d.data.name.includes('vendor')) {
308
- return colors.vendor;
309
- }
310
- return colors.other;
311
- }
312
-
313
- function getSizeValue(d) {
314
- return showGzip ? d.data.gzipSize : d.data.size;
315
- }
316
-
317
- function render() {
318
- container.innerHTML = '';
319
-
320
- const width = container.clientWidth;
321
- const height = container.clientHeight;
322
-
323
- const hierarchy = d3.hierarchy(currentRoot)
324
- .sum(d => {
325
- if (searchTerm && d.name && !d.name.toLowerCase().includes(searchTerm.toLowerCase())) {
326
- return 0;
327
- }
328
- return d.children ? 0 : getSizeValue({ data: d });
329
- })
330
- .sort((a, b) => getSizeValue(b) - getSizeValue(a));
331
-
332
- const treemap = d3.treemap()
333
- .size([width, height])
334
- .paddingOuter(3)
335
- .paddingTop(19)
336
- .paddingInner(1)
337
- .round(true);
338
-
339
- const root = treemap(hierarchy);
340
-
341
- const svg = d3.select(container)
342
- .append('svg')
343
- .attr('width', width)
344
- .attr('height', height);
345
-
346
- const node = svg.selectAll('g')
347
- .data(root.descendants().filter(d => d.depth > 0))
348
- .join('g')
349
- .attr('transform', d => \`translate(\${d.x0},\${d.y0})\`);
350
-
351
- node.append('rect')
352
- .attr('class', 'node')
353
- .attr('width', d => Math.max(0, d.x1 - d.x0))
354
- .attr('height', d => Math.max(0, d.y1 - d.y0))
355
- .attr('fill', d => getColor(d))
356
- .attr('stroke', '#1a1a2e')
357
- .attr('stroke-width', 1)
358
- .on('click', (event, d) => {
359
- if (d.children) {
360
- zoomIn(d.data);
361
- }
362
- })
363
- .on('mouseover', (event, d) => showTooltip(event, d))
364
- .on('mousemove', (event) => moveTooltip(event))
365
- .on('mouseout', hideTooltip);
366
-
367
- node.append('text')
368
- .attr('class', 'node-label')
369
- .attr('x', d => (d.x1 - d.x0) / 2)
370
- .attr('y', d => (d.y1 - d.y0) / 2 + 4)
371
- .text(d => {
372
- const width = d.x1 - d.x0;
373
- const height = d.y1 - d.y0;
374
- if (width < 40 || height < 20) return '';
375
- const name = d.data.name;
376
- const maxLen = Math.floor(width / 7);
377
- return name.length > maxLen ? name.slice(0, maxLen - 2) + '..' : name;
378
- });
379
-
380
- // Group headers
381
- node.filter(d => d.children)
382
- .append('text')
383
- .attr('x', 4)
384
- .attr('y', 14)
385
- .attr('fill', '#000')
386
- .attr('font-size', '12px')
387
- .attr('font-weight', 'bold')
388
- .text(d => {
389
- const width = d.x1 - d.x0;
390
- const name = d.data.name;
391
- const maxLen = Math.floor(width / 7);
392
- return name.length > maxLen ? name.slice(0, maxLen - 2) + '..' : name;
393
- });
394
- }
395
-
396
- function showTooltip(event, d) {
397
- const size = d.data.size || d.value;
398
- const gzipSize = d.data.gzipSize || Math.round(size * 0.3);
399
- const path = d.data.path || d.data.name;
400
-
401
- tooltip.innerHTML = \`
402
- <div class="tooltip-title">\${path}</div>
403
- <div class="tooltip-row">
404
- <span>Size</span>
405
- <span>\${formatSize(size)}</span>
406
- </div>
407
- <div class="tooltip-row">
408
- <span>Gzip</span>
409
- <span>\${formatSize(gzipSize)}</span>
410
- </div>
411
- \${d.data.type ? \`<div class="tooltip-row"><span>Type</span><span>\${d.data.type}</span></div>\` : ''}
412
- \${d.children ? \`<div class="tooltip-row"><span>Children</span><span>\${d.children.length}</span></div>\` : ''}
413
- \`;
414
- tooltip.style.display = 'block';
415
- moveTooltip(event);
416
- }
417
-
418
- function moveTooltip(event) {
419
- const x = event.clientX + 10;
420
- const y = event.clientY + 10;
421
- tooltip.style.left = x + 'px';
422
- tooltip.style.top = y + 'px';
423
- }
424
-
425
- function hideTooltip() {
426
- tooltip.style.display = 'none';
427
- }
428
-
429
- function zoomIn(node) {
430
- currentRoot = node;
431
- updateBreadcrumb();
432
- render();
433
- }
434
-
435
- function zoomOut(index) {
436
- let node = data;
437
- const parts = getBreadcrumbParts();
438
- for (let i = 1; i <= index; i++) {
439
- const child = node.children?.find(c => c.name === parts[i]);
440
- if (child) node = child;
441
- }
442
- currentRoot = node;
443
- updateBreadcrumb();
444
- render();
445
- }
446
-
447
- function getBreadcrumbParts() {
448
- const parts = ['root'];
449
- let node = currentRoot;
450
- const path = [];
451
-
452
- function findPath(current, target, currentPath) {
453
- if (current === target) {
454
- path.push(...currentPath);
455
- return true;
456
- }
457
- if (current.children) {
458
- for (const child of current.children) {
459
- if (findPath(child, target, [...currentPath, child.name])) {
460
- return true;
461
- }
462
- }
463
- }
464
- return false;
465
- }
466
-
467
- if (currentRoot !== data) {
468
- findPath(data, currentRoot, []);
469
- parts.push(...path);
470
- }
471
-
472
- return parts;
473
- }
474
-
475
- function updateBreadcrumb() {
476
- const parts = getBreadcrumbParts();
477
- breadcrumb.innerHTML = parts.map((part, i) => {
478
- const isLast = i === parts.length - 1;
479
- const sep = i > 0 ? '<span class="breadcrumb-sep">/</span>' : '';
480
- return \`\${sep}<span class="breadcrumb-item \${isLast ? 'active' : ''}" onclick="zoomOut(\${i})">\${part}</span>\`;
481
- }).join('');
482
- }
483
-
484
- searchInput.addEventListener('input', (e) => {
485
- searchTerm = e.target.value;
486
- render();
487
- });
488
-
489
- showGzipCheckbox.addEventListener('change', (e) => {
490
- showGzip = e.target.checked;
491
- render();
492
- });
493
-
494
- window.addEventListener('resize', render);
495
-
496
- render();
497
- </script>
498
- </body>
499
- </html>`}function a(X){let Z={name:"root",size:X.totalSize,gzipSize:X.totalGzipSize,children:[]};for(let Q of X.chunks){let $={name:Q.name,size:Q.size,gzipSize:Q.gzipSize,children:[]};for(let U of Q.modules)e($,U);Z.children.push($)}return Z}function e(X,Z){let Q=Z.path.split("/"),$=X;for(let K=0;K<Q.length-1;K++){let j=Q[K],q=$.children?.find((J)=>J.name===j);if(!q){if(q={name:j,size:0,gzipSize:0,children:[]},!$.children)$.children=[];$.children.push(q)}$=q}let U=Q[Q.length-1];if(!$.children)$.children=[];$.children.push({name:U,path:Z.path,size:Z.size,gzipSize:Z.gzipSize,type:Z.type}),s(X,Z.size,Z.gzipSize)}function s(X,Z,Q){}function M(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function T(X){let Z=process.platform,Q=Z==="darwin"?"open":Z==="win32"?"start":"xdg-open";Bun.spawn([Q,X],{stdio:["ignore","ignore","ignore"]})}import P from"fs";import S from"path";async function CQ(X={}){let{directory:Z="dist",output:Q,format:$="html",open:U=!0,gzip:K=!0,threshold:j,recommendations:q=!0,topModules:J=20,parseImports:F=!0}=X,V=await L(Z,{parseImports:F,detectDuplicates:!0,topModulesCount:J}),_=j?typeof j==="string"?I(j):j:void 0,w=_?V.totalSize>_:!1,G,C;if($==="html"){let A={title:`Bundle Analysis - ${S.basename(S.resolve(Z))}`,gzip:K};if(G=x(V,A),C=Q||S.join(Z,"bundle-report.html"),await P.promises.writeFile(C,G),U)T(C)}else if(G=R(V,{format:$,threshold:_,recommendations:q,topModules:J,showGzip:K}),Q)C=Q,await P.promises.writeFile(C,G);return{stats:V,report:G,outputPath:C,exceedsThreshold:w}}async function GQ(X){let Z=await L(X,{parseImports:!1,detectDuplicates:!1,topModulesCount:0});return{totalSize:Z.totalSize,totalSizeFormatted:W(Z.totalSize),gzipSize:Z.totalGzipSize,gzipSizeFormatted:W(Z.totalGzipSize),moduleCount:Z.moduleCount,chunkCount:Z.chunks.length}}export{E as percentage,I as parseSize,T as openInBrowser,n as getModuleRecommendation,GQ as getBundleSummary,x as generateTreemap,R as generateReport,W as formatBytes,L as collectBundleStats,N as analyzeBundle,CQ as analyze};
@@ -1,47 +0,0 @@
1
- // @bun
2
- import{cx as O,ex as x}from"./chunk-563shnkz.js";import{ix as z}from"./chunk-2fw05hs2.js";var Gq={1001:{message:"Unclosed directive: {{directive}}",help:"Make sure to close the directive with the appropriate end tag"},1002:{message:"Unclosed expression at position {{position}}",help:"Check for missing closing braces }}"},1003:{message:"Invalid directive syntax: {{directive}}",help:"Review the directive documentation for correct syntax"},1004:{message:"Malformed expression: {{expression}}",help:"Check for syntax errors in your expression"},1005:{message:"Unexpected token: {{token}}",help:"Remove or fix the unexpected token"},1101:{message:"Undefined variable: {{variable}}",help:"Make sure the variable is defined in the template context"},1102:{message:"Type error: {{details}}",help:"Check that you are using the correct types"},1103:{message:"Evaluation error: {{details}}",help:"Review the expression for errors"},1104:{message:"Infinite loop detected in {{location}}",help:"Check your loop conditions"},1105:{message:"Circular reference detected: {{path}}",help:"Remove the circular dependency"},1201:{message:"Unsafe expression blocked: {{expression}}",help:"This expression contains potentially dangerous code"},1202:{message:"Path traversal attempt blocked: {{path}}",help:"Use only relative paths within allowed directories"},1203:{message:"Potential XSS attempt blocked",help:"Sanitize user input before rendering"},1204:{message:"Code injection attempt blocked: {{code}}",help:"Avoid executing dynamic code"},1205:{message:"Prohibited DOM API usage: {{api}}",help:"Use STX.useRefs(), STX.useRef(), STX.el() and other STX helpers instead of direct DOM manipulation"},1301:{message:"File not found: {{path}}",help:"Check that the file exists and the path is correct"},1302:{message:"Error reading file: {{path}}",help:"Check file permissions and encoding"},1303:{message:"Invalid file path: {{path}}",help:"Use a valid file path"},1304:{message:"Permission denied: {{path}}",help:"Check file permissions"},1401:{message:"Invalid configuration: {{details}}",help:"Review your stx.config.ts file"},1402:{message:"Missing required configuration: {{key}}",help:"Add the required configuration option"},1403:{message:"Deprecated configuration: {{key}}",help:"Update to the new configuration format"},1501:{message:"Component not found: {{name}}",help:"Check that the component exists in your components directory"},1502:{message:"Invalid props for component {{name}}: {{details}}",help:"Check the component prop requirements"},1503:{message:"Error rendering component {{name}}: {{details}}",help:"Check the component template for errors"},1601:{message:"Filter not found: {{filter}}",help:"Register the filter or check the filter name"},1602:{message:"Invalid arguments for filter {{filter}}: {{details}}",help:"Check the filter documentation for correct arguments"},1603:{message:"Expression evaluation timed out",help:"Simplify the expression or increase the timeout"}},L={},u="en";function Hq(q){u=q}function Bq(){return u}function Wq(q){L={...L,...q}}function Mq(){L={}}function f(q,J={}){let Q=L[q]||Gq[q]||{message:`Unknown error (code: ${q})`},Z=Q.message,$=Q.help;for(let[Y,V]of Object.entries(J)){let X=`{{${Y}}}`;if(Z=Z.replace(new RegExp(X,"g"),V),$)$=$.replace(new RegExp(X,"g"),V)}return{message:Z,help:$}}function Iq(q,J={}){let{message:Q,help:Z}=f(q,J);return Z?`${Q}
3
- Help: ${Z}`:Q}var w={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603};function S(q){for(let[J,Q]of Object.entries(w))if(Q===q)return J;return}x();import wq from"path";var m={showRelativePaths:!1,enableAutoRecovery:O(),logRecoveryWarnings:!0},D={...m};function Fq(q){D={...D,...q}}function _(){return{...D}}function jq(){D={...m}}function T(q){if(!D.showRelativePaths||!q)return q;let J=D.baseDir||process.cwd();try{let Q=wq.relative(J,q);return Q.startsWith("..")?q:Q}catch{return q}}class U extends Error{code;filePath;line;column;context;numericCode;constructor(q,J,Q,Z,$,Y,V){super(q);this.code=J;this.filePath=Q;this.line=Z;this.column=$;this.context=Y;if(this.name="StxError",this.numericCode=V||w.EVALUATION_ERROR,this.filePath)this.filePath=T(this.filePath)}}class c extends U{constructor(q,J,Q,Z,$,Y){super(q,"stx_SYNTAX_ERROR",J,Q,Z,$,Y||w.INVALID_DIRECTIVE_SYNTAX);this.name="StxSyntaxError"}}class d extends U{constructor(q,J,Q,Z,$,Y){super(q,"stx_RUNTIME_ERROR",J,Q,Z,$,Y||w.EVALUATION_ERROR);this.name="StxRuntimeError"}}class p extends U{constructor(q,J,Q,Z,$,Y){super(q,"stx_SECURITY_ERROR",J,Q,Z,$,Y||w.UNSAFE_EXPRESSION);this.name="StxSecurityError"}}class l extends U{constructor(q,J,Q,Z,$,Y){super(q,"stx_FILE_ERROR",J,Q,Z,$,Y||w.FILE_NOT_FOUND);this.name="StxFileError"}}class o extends U{isFatal=!0;constructor(q,J,Q,Z,$,Y){super(q,"stx_VALIDATION_ERROR",J,Q,Z,$,Y||w.DOM_API_VIOLATION);this.name="StxValidationError"}}function C(q){let{type:J,message:Q,code:Z,filePath:$,line:Y,column:V,template:X,offset:H,snippet:G,suggestion:B,format:W="text"}=q,M=Y,I=V;if(!M&&X&&H!==void 0){let E=r(X,H);M=E.line,I=E.column}let j=$?T($):void 0,Vq=Z?S(Z):void 0,K={type:J,code:Z,codeName:Vq,message:Q,filePath:j,line:M,column:I,snippet:G,suggestion:B,timestamp:new Date().toISOString()},k;switch(W){case"html":k=Dq(K);break;case"json":k=JSON.stringify(K,null,2);break;case"console":k=Kq(K,X,H);break;case"text":default:k=Uq(K,X,H);break}return{formatted:k,data:K}}function Uq(q,J,Q){let Z=[],$=q.code?` [${q.codeName||q.code}]`:"";if(Z.push(`[${q.type} Error${$}]`),q.filePath){let Y=q.filePath;if(q.line){if(Y+=`:${q.line}`,q.column)Y+=`:${q.column}`}Z.push(`at ${Y}`)}if(Z.push(`
4
- ${q.message}`),J&&q.line){let Y=kq(J,q.line,2);if(Y)Z.push(`
5
- ${Y}`)}if(q.snippet)Z.push(`
6
- Snippet: ${q.snippet}`);if(q.suggestion)Z.push(`
7
- Suggestion: ${q.suggestion}`);return Z.join(" ")}function Dq(q){let J=q.code?` [${q.code}]`:"",Q=q.filePath?` in ${q.filePath}${q.line?`:${q.line}`:""}`:"",Z=`<!-- [${q.type} Error${J}]${Q}: ${s(q.message)}`;if(q.suggestion)Z+=` | Suggestion: ${s(q.suggestion)}`;return Z+=" -->",Z}function Kq(q,J,Q){let G=[],B=q.code?` [${q.codeName||q.code}]`:"";if(G.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${q.type} Error${B} \u2501\u2501\u2501${"\x1B[0m"}`),q.filePath){let W=`\x1B[36m${q.filePath}\x1B[0m`;if(q.line){if(W+=`\x1B[90m:${q.line}\x1B[0m`,q.column)W+=`\x1B[90m:${q.column}\x1B[0m`}G.push(`
8
- \x1B[90mat\x1B[0m ${W}`)}if(G.push(`
9
-
10
- ${q.message}`),J&&q.line){let W=Oq(J,q.line,2);if(W)G.push(`
11
-
12
- \x1B[90mContext:\x1B[0m
13
- ${W}`)}if(q.suggestion)G.push(`
14
-
15
- \x1B[33mSuggestion:\x1B[0m ${q.suggestion}`);return G.push(`
16
- ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),G.join("")}function kq(q,J,Q){let Z=q.split(`
17
- `),$=Math.max(0,J-Q-1),Y=Math.min(Z.length-1,J+Q-1),V=[];for(let X=$;X<=Y;X++){let H=(X+1).toString().padStart(4),G=X===J-1?">":" ";V.push(`${G}${H} | ${Z[X]}`)}return V.join(`
18
- `)}function Oq(q,J,Q){let Z=q.split(`
19
- `),$=Math.max(0,J-Q-1),Y=Math.min(Z.length-1,J+Q-1),V="\x1B[90m",X="\x1B[31m",H="\x1B[0m",G=[];for(let B=$;B<=Y;B++){let W=(B+1).toString().padStart(4),M=B===J-1,I=M?"\x1B[31m>\x1B[0m":" ",j=M?`\x1B[31m${Z[B]}\x1B[0m`:`\x1B[90m${Z[B]}\x1B[0m`;G.push(`${I}\x1B[90m${W}\x1B[0m | ${j}`)}return G.join(`
20
- `)}function s(q){return q.replace(/--/g,"- -").replace(/>/g,"&gt;")}function r(q,J){let Z=q.substring(0,J).split(`
21
- `);return{line:Z.length,column:Z[Z.length-1].length}}function zq(q,J,Q){return C({type:q,message:J,code:Q,format:"html"}).formatted}function Lq(q,J,Q,Z,$){return C({type:q,message:J,code:$,filePath:Q,line:Z,format:"console"}).formatted}function _q(q,J,Q){let Z=Q.template.split(`
22
- `),$=r(Q.template,Q.offset),Y=`[${q} Error at line ${$.line} in ${Q.filePath}]: ${J}
23
-
24
- `,V=Math.max(0,$.line-3),X=Math.min(Z.length-1,$.line+2);Y+=`Context:
25
- `;for(let H=V;H<=X;H++){let G=H+1,B=Z[H]||"",W=H===$.line-1?">":" ";Y+=`${W} ${G.toString().padStart(3)}: ${B}
26
- `}if($.line-1<Z.length){let H=" ".repeat($.column+5);Y+=`${H}^
27
- `}return Y}function Tq(q,J,Q){try{return q()}catch(Z){if(Q&&Z instanceof Error)Q(Z);return J}}async function Nq(q,J,Q){try{return await q()}catch(Z){if(Q&&Z instanceof Error)Q(Z);return J}}x();var Aq={isEnabled(){return _().enableAutoRecovery},fixCommonSyntaxErrors(q){let J=_();if(!J.enableAutoRecovery)return{fixed:q,fixes:[]};let Q=q,Z=[],$=(Q.match(/\{\{/g)||[]).length,Y=(Q.match(/\}\}/g)||[]).length;if($>Y){let X=$-Y;Q+="}}".repeat(X),Z.push(`Added ${X} missing closing braces '}}'`)}let V=["if","foreach","for","switch","section"];for(let X of V){let H=(Q.match(new RegExp(`@${X}\\b`,"g"))||[]).length,G=(Q.match(new RegExp(`@end${X}\\b`,"g"))||[]).length;if(H>G){let B=H-G;for(let W=0;W<B;W++)Q+=`
28
- @end${X}`;Z.push(`Added ${B} missing @end${X}`)}}if(Z.length>0&&J.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),Z.forEach((X)=>console.warn(` - ${X}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Q,fixes:Z}},createFallbackContent(q,J){if(O())return`<!-- ${q} failed: ${J.message} -->`;return"<!-- stx rendering error -->"}};class P{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor(q={}){this.maxErrors=q.maxErrors??1000,this.enableFileLogging=q.enableFileLogging??!1,this.logFilePath=q.logFilePath??".stx/errors.log",this.logFormat=q.logFormat??"json",this.maxFileSize=q.maxFileSize??10485760,this.maxLogFiles=q.maxLogFiles??5,this.minLevel=q.minLevel??"all"}configure(q){if(q.maxErrors!==void 0)this.maxErrors=q.maxErrors;if(q.enableFileLogging!==void 0)this.enableFileLogging=q.enableFileLogging;if(q.logFilePath!==void 0)this.logFilePath=q.logFilePath;if(q.logFormat!==void 0)this.logFormat=q.logFormat;if(q.maxFileSize!==void 0)this.maxFileSize=q.maxFileSize;if(q.maxLogFiles!==void 0)this.maxLogFiles=q.maxLogFiles;if(q.minLevel!==void 0)this.minLevel=q.minLevel}log(q,J,Q="error"){let Z={timestamp:new Date,error:q,context:J,level:Q};if(this.errors.push(Z),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(Q))this.writeToFile(Z)}shouldLog(q){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return q==="error"||q==="warning";if(this.minLevel==="error")return q==="error";return!0}formatEntry(q){if(this.logFormat==="json")return JSON.stringify({timestamp:q.timestamp.toISOString(),level:q.level||"error",type:q.error.constructor.name,message:q.error.message,stack:q.error.stack,context:q.context});let J=[`[${q.timestamp.toISOString()}] [${(q.level||"error").toUpperCase()}] ${q.error.constructor.name}: ${q.error.message}`];if(q.error.stack)J.push(` Stack: ${q.error.stack.split(`
29
- `).slice(1).join(`
30
- `)}`);if(q.context)J.push(` Context: ${JSON.stringify(q.context)}`);return J.join(`
31
- `)}writeToFile(q){this.writeQueue=this.writeQueue.then(async()=>{try{let J=await import("fs"),Z=(await import("path")).dirname(this.logFilePath);if(!J.existsSync(Z))J.mkdirSync(Z,{recursive:!0});await this.rotateIfNeeded(J);let $=`${this.formatEntry(q)}
32
- `;J.appendFileSync(this.logFilePath,$,"utf-8")}catch(J){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",J)}})}async rotateIfNeeded(q){try{if(!q.existsSync(this.logFilePath))return;if(q.statSync(this.logFilePath).size<this.maxFileSize)return;for(let Q=this.maxLogFiles-1;Q>=1;Q--){let Z=`${this.logFilePath}.${Q}`,$=`${this.logFilePath}.${Q+1}`;if(q.existsSync(Z))if(Q>=this.maxLogFiles-1)q.unlinkSync(Z);else q.renameSync(Z,$)}if(this.maxLogFiles<=1)q.writeFileSync(this.logFilePath,"");else q.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch(J){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",J)}}getRecentErrors(q=10){return this.errors.slice(-q)}getErrorsByType(q){return this.errors.filter((J)=>J.error.constructor.name===q)}getErrorsByLevel(q){return this.errors.filter((J)=>J.level===q)}clear(){this.errors.length=0}async clearLogFile(){try{let q=await import("fs");if(q.existsSync(this.logFilePath))q.writeFileSync(this.logFilePath,"","utf-8")}catch(q){if(process.env.STX_DEBUG==="true")console.error("Failed to clear error log:",q)}}getStats(){let q={},J={error:0,warning:0,info:0};for(let Q of this.errors){let Z=Q.error.constructor.name;q[Z]=(q[Z]||0)+1;let $=Q.level||"error";J[$]=(J[$]||0)+1}return{total:this.errors.length,byType:q,byLevel:J}}async exportToFile(q,J="json"){let Q=await import("fs"),$=(await import("path")).dirname(q);if(!Q.existsSync($))Q.mkdirSync($,{recursive:!0});if(J==="json"){let Y=this.errors.map((V)=>({timestamp:V.timestamp.toISOString(),level:V.level||"error",type:V.error.constructor.name,message:V.error.message,stack:V.error.stack,context:V.context}));Q.writeFileSync(q,JSON.stringify(Y,null,2),"utf-8")}else{let Y=this.errors.map((V)=>this.formatEntry(V));Q.writeFileSync(q,Y.join(`
33
-
34
- `),"utf-8")}}async flush(){await this.writeQueue}}var Rq=new P,bq={isDevelopment(){return O()},logDetailedError(q,J){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",q.message),console.error("Stack:",q.stack),J)console.error("Context:",J);console.error("========================")},createErrorReport(q,J){let Q=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${q.message}`,`Type: ${q.constructor.name}`,`Stack: ${q.stack}`];if(J)Q.push(`Context: ${JSON.stringify(J,null,2)}`);return Q.push("========================"),Q.join(`
35
- `)}};import g from"path";var v={isValidFilePath(q,J){let Q=q.replace(/\\/g,"/");if(Q.includes("\x00"))return!1;if(Q.includes("../")||Q.includes("..\\")||Q===".."||Q.startsWith("../")||Q.endsWith("/..")||Q.includes("/..\\")||Q.includes("\\../"))return!1;if(/^[a-z][a-z0-9+.-]*:/i.test(Q))return!1;if(Q.startsWith("/")){if(["/etc/","/root/","/var/","/usr/","/bin/","/sbin/","/proc/","/sys/","/dev/","/boot/","/home/","/private/","/Library/","/System/"].some((Y)=>Q===Y.slice(0,-1)||Q.startsWith(Y)))return!1}if(/^[a-z]:/i.test(Q)){if(["Windows/","Windows\\","System32/","System32\\","Program Files/","Program Files\\"].some((Y)=>Q.includes(Y)))return!1}if(J){let $=g.resolve(J,q),Y=g.resolve(J);if(!$.startsWith(Y+g.sep)&&$!==Y)return!1}return!0},isValidVariableName(q){return/^[a-z_$]\w*$/i.test(q)},isValidDirectiveName(q){return/^[a-z][\w-]*$/i.test(q)},isSafeContent(q){return![/<script[^>]*>[\s\S]*?<\/script>/i,/javascript:/i,/data:text\/html/i,/vbscript:/i,/on\w+\s*=/i].some((Q)=>Q.test(q))}};function Sq(q){let J={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};return q.replace(/[&<>"']/g,(Q)=>J[Q]||Q)}function N(q,J={}){let{allowHtml:Q=!1,maxLength:Z=1e4,allowSpecialChars:$=!0,customSanitizer:Y}=J,V=[],X=q,H=!1;if(Y){let B=Y(X);if(B!==X)X=B,H=!0}if(X.includes("\x00"))X=X.replace(/\0/g,""),H=!0,V.push("Null bytes removed from parameter");if(X.length>Z)X=X.substring(0,Z),H=!0,V.push(`Parameter truncated to ${Z} characters`);if(!Q&&/<[^>]+>/.test(X))X=Sq(X),H=!0,V.push("HTML content was escaped");let G=[{pattern:/javascript:/gi,replacement:"",name:"javascript: URI"},{pattern:/vbscript:/gi,replacement:"",name:"vbscript: URI"},{pattern:/data:text\/html/gi,replacement:"",name:"data:text/html URI"}];for(let{pattern:B,replacement:W,name:M}of G)if(B.test(X))X=X.replace(B,W),H=!0,V.push(`Removed ${M} from parameter`);if(!$){let B=X;if(X=X.split("").filter((W)=>{let M=W.charCodeAt(0);return M>=32&&M!==127}).join(""),X!==B)H=!0,V.push("Control characters removed")}return{value:X,modified:H,warnings:V}}function Cq(q,J){let Q=q.replace(/\0/g,"");Q=Q.replace(/\\/g,"/"),Q=Q.replace(/^[a-z][a-z0-9+.-]*:/i,"");while(Q.includes("../")||Q.includes("./"))Q=Q.replace(/\.\.\//g,"").replace(/\.\//g,"");if(!v.isValidFilePath(Q,J))return null;return Q}function Pq(q){let J=[],Q=q.trim(),Z=Q!==q,$=[{pattern:/\beval\s*\(/gi,name:"eval()"},{pattern:/\bFunction\s*\(/gi,name:"Function()"},{pattern:/\bsetTimeout\s*\(/gi,name:"setTimeout()"},{pattern:/\bsetInterval\s*\(/gi,name:"setInterval()"},{pattern:/\bimport\s*\(/gi,name:"dynamic import()"},{pattern:/\brequire\s*\(/gi,name:"require()"},{pattern:/\b__proto__\b/gi,name:"__proto__"},{pattern:/\bconstructor\b/gi,name:"constructor"},{pattern:/\bprototype\b/gi,name:"prototype"}];for(let{pattern:Y,name:V}of $)if(Y.test(Q))J.push(`Potentially dangerous pattern detected: ${V}`);if(Q.includes("\x00"))Q=Q.replace(/\0/g,""),Z=!0,J.push("Null bytes removed from expression");return{value:Q,modified:Z,warnings:J}}function gq(q,J={}){return q.map((Q)=>N(Q,J))}function n(q){let J={};for(let[Q,Z]of Object.entries(q)){if(!v.isValidVariableName(Q))continue;if(typeof Z==="string"){let $=N(Z);J[Q]=$.value}else if(Array.isArray(Z))J[Q]=Z.map(($)=>typeof $==="string"?N($).value:$);else if(typeof Z==="object"&&Z!==null)J[Q]=n(Z);else J[Q]=Z}return J}var vq={maxSanitizeDepth:10,allowBracketNotation:!1},qq={...vq};var R=/\bnew\s+/,b="__stx_safe_ctors",Jq=[/\b(eval|Function|setTimeout|setInterval|setImmediate)\b/,/\b(process|require|import|exports|module)\b/,/\b(window|document|global|globalThis)\b/,/\b(constructor|prototype|__proto__)\b/,/\b(Reflect|Proxy)\b/,/\bSymbol\b/,/\b(WeakMap|WeakSet|WeakRef|FinalizationRegistry)\b/,/\b(Generator|AsyncGenerator)\b/,/__\w+__/,/\.(bind|call|apply)\s*\(/,R,/\bdelete\s+/,/\bthis\b/],hq=new Set(["eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this",b]),Qq=new Set(["__proto__","constructor","prototype"]),yq=/[\w)\]]\s*\[\s*['"]/;function Zq(q){let J="",Q=[],Z=null,$=!1;for(let Y=0;Y<q.length;Y++){let V=q[Y];if($){$=!1;continue}if(V==="\\"&&Z){$=!0;continue}if(Z){if(Z==="`"&&V==="$"&&Y+1<q.length&&q[Y+1]==="{"){let X=1;Y+=2;while(Y<q.length&&X>0){if(q[Y]==="{")X++;else if(q[Y]==="}")X--;if(X>0)J+=q[Y],Q.push(Y),Y++}continue}if(V===Z)Z=null;continue}if(V==='"'||V==="'"||V==="`"){Z=V;continue}J+=V,Q.push(Y)}return{text:J,map:Q}}function Eq(q){return Zq(q).text}var $q=["Collator","DateTimeFormat","DisplayNames","ListFormat","Locale","NumberFormat","PluralRules","RelativeTimeFormat","Segmenter"],Yq=(()=>{let q={Date,URL,URLSearchParams},J=Intl;for(let Q of $q)if(typeof J[Q]==="function")q[`Intl_${Q}`]=J[Q];return Object.freeze(Object.assign(Object.create(null),q))})(),uq=/^new(\s+)(Date|URLSearchParams|URL|Intl\s*\.\s*([A-Z_a-z]\w*))\s*\(/,i=/(?<![\w$])new(?![\w$])/g,a=`only new Date(), new URL(), new URLSearchParams() and new Intl.{${$q.join(",")}}() are allowed`;function fq(q){let{text:J,map:Q}=Zq(q),Z=[];i.lastIndex=0;let $;while(($=i.exec(J))!==null){let V=$.index;if(/(?<!\.)\.\s*$/.test(J.slice(0,V)))continue;let X=uq.exec(J.slice(V)),H=X?.[3],G=!X?null:H?`Intl_${H}`:X[2];if(!X||!G||!(G in Yq))throw new F(`matched /${R.source}/; ${a}`,q);let B=V+X[0].length,W=Q[V],M=Q[B-1]+1;if(q.slice(W,M)!==J.slice(V,B))throw new F(`matched /${R.source}/; ${a}`,q);let I=W+3+X[1].length;Z.push({start:I,end:I+X[2].length,key:G})}let Y=q;for(let V=Z.length-1;V>=0;V--){let X=Z[V];Y=`${Y.slice(0,X.start)}${b}.${X.key}${Y.slice(X.end)}`}return{source:Y,usesSafeConstructors:Z.length>0}}class F extends Error{rule;expression;constructor(q,J,Q){super(Q??`Potentially unsafe expression (${q}): ${J}`);this.name="UnsafeExpressionError",this.rule=q,this.expression=J}}function UJ(q){try{return y(q),null}catch(J){return J instanceof F?J.rule:J instanceof Error?J.message:String(J)}}function xq(q,J){let Q=/[$A-Z_a-z][$\w]*/g,Z;while((Z=Q.exec(q))!==null){let $=Z[0],Y=q[Z.index-1];if(hq.has($))throw new F(`matched /\\b${$}\\b/; identifier ${$}`,J);if(Y==="."&&Qq.has($))throw new F(`matched /.${$}/; property ${$}`,J)}}function mq(q){let J=/\[\s*(['"])(.*?)\1\s*\]/g,Q;while((Q=J.exec(q))!==null){let Z=Q[2];if(!Qq.has(Z))continue;let $=q.slice(0,Q.index).match(/\S(?=\s*$)/)?.[0],Y=q.slice(Q.index+Q[0].length).match(/^\s*(\S)/)?.[1];if(!(($==="{"||$===",")&&Y===":"))throw new F(`bracket key ${Q[2]}`,q)}}function y(q){let J=q.trim(),Q=Eq(J);xq(Q,J),mq(J);for(let Z of Jq){if(Z===R)continue;if(Z.test(Q))throw new F(`matched /${Z.source}/`,J)}if(!qq.allowBracketNotation&&yq.test(J))throw new F("bracket notation with a string key; enable with configureSafeEvaluator({ allowBracketNotation: true })",J,`Bracket notation with strings not allowed: ${J}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return fq(J)}function cq(q){return y(q),q.trim()}function dq(q){let J={};J.Math=Math,J.JSON=JSON,J.Date=Date,J.String=String,J.Number=Number,J.Boolean=Boolean,J.Array=Array,J.parseInt=Number.parseInt,J.parseFloat=Number.parseFloat,J.isNaN=Number.isNaN,J.isFinite=Number.isFinite,J.encodeURIComponent=encodeURIComponent,J.decodeURIComponent=decodeURIComponent;for(let[Q,Z]of Object.entries(q)){if(Q.startsWith("__")||Jq.some(($)=>$.test(Q)))continue;if(Z&&typeof Z==="object"&&!Array.isArray(Z))J[Q]=h(Z);else J[Q]=Z}return J}function h(q,J=0){if(J>=qq.maxSanitizeDepth)return"[Object too deep]";if(q===null||typeof q!=="object")return q;if(Array.isArray(q))return q.map((Z)=>h(Z,J+1));if(q instanceof Date||q instanceof RegExp||q instanceof Map||q instanceof Set||q instanceof Error)return q;let Q={};for(let[Z,$]of Object.entries(q)){if(Z.startsWith("__")||Z==="constructor"||Z==="prototype")continue;if($&&typeof $==="object")Q[Z]=h($,J+1);else Q[Z]=$}return Q}function pq(q,J){try{let Q=dq(J),Z=Object.keys(Q),$=Object.values(Q);return rq(q,Z)(...$)}catch{return}}function DJ(q){try{return cq(q),!0}catch{return!1}}function KJ(q,J){try{let Q=pq(q,J);if(Q&&typeof Q==="object"&&!Array.isArray(Q))return Q;return{}}catch{return{}}}var Xq=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","implements","interface","package","private","protected","public","arguments","eval","await"]),lq=2000,A=new Map;function t(q,J){let Q=`${q.join(",")}\x00${J}`,Z=A.get(Q);if(Z)return Z;let $=Function(...q,J);if(A.size>=lq)A.clear();return A.set(Q,$),$}function kJ(q){return q.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:)/g,"$1$2").match(/\b[a-zA-Z_$][\w$]*\b/g)||[]}var oq=/^[A-Za-z_$][\w$]*$/;function sq(q){return oq.test(q)&&!Xq.has(q)}function rq(q,J){let{source:Q,usesSafeConstructors:Z}=y(q),$=[];for(let G=0;G<J.length;G++){if(!sq(J[G]))continue;if(J[G]===b)continue;$.push({key:J[G],index:G})}$.sort((G,B)=>G.key.localeCompare(B.key));let Y=$.map((G)=>G.key),V=$.map((G)=>G.index),X=`
36
- 'use strict';
37
- try {
38
- return ${Q};
39
- }
40
- catch (e) {
41
- if (e instanceof TypeError) {
42
- return undefined;
43
- }
44
- throw e;
45
- }
46
- `;return nq(Z?(G)=>{let B=t([b,...Y,...G],X);return(...W)=>B(Yq,...W)}:(G)=>t([...Y,...G],X),Y,J,$,V)}function nq(q,J,Q,Z,$){let Y=q([]),V=Z.every((H,G)=>H.index===G);if(J.length===Q.length&&V)return e(Y,J,q);return e((...H)=>{let G=Array($.length);for(let B=0;B<$.length;B++)G[B]=H[$[B]];return Y(...G)},J,q,(H)=>{Y=q(H)})}function e(q,J,Q,Z){let Y=/^(\w+) is not defined$/,V=q,X=[],H=new Set(J);return(...G)=>{for(let B=0;B<=8;B++)try{return V(...G)}catch(W){let M=W instanceof Error?W.message:"",I=Y.exec(M);if(!(W instanceof ReferenceError)||!I)return;let j=I[1];if(H.has(j)||Xq.has(j))return;if(H.add(j),X.push(j),Z)Z(X);else V=Q(X)}return}}function OJ(q){let J=q.trim(),Q=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let Z of Q)if(Z.test(J))return!1;return!0}
47
- export{Hq as Tu,Bq as Uu,Wq as Vu,Mq as Wu,f as Xu,Iq as Yu,w as Zu,S as _u,Fq as $u,_ as av,jq as bv,T as cv,U as dv,c as ev,d as fv,p as gv,l as hv,o as iv,C as jv,zq as kv,Lq as lv,_q as mv,Tq as nv,Nq as ov,Aq as pv,P as qv,Rq as rv,bq as sv,v as tv,N as uv,Cq as vv,Pq as wv,gq as xv,n as yv,UJ as zv,cq as Av,dq as Bv,pq as Cv,DJ as Dv,KJ as Ev,kJ as Fv,sq as Gv,rq as Hv,OJ as Iv};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Jh as a,Kh as b,Lh as c,Mh as d,Nh as e,Oh as f,Ph as g}from"./chunk-t1tdjjht.js";import"./chunk-2fw05hs2.js";export{d as useVirtualList,b as processVirtualListDirectives,f as processVirtualGridDirectives,e as processInfiniteListDirectives,c as generateVirtualListCSS,g as default,a as createVirtualList};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{wk as a,xk as b,yk as c,zk as d}from"./chunk-eenk6s3t.js";import"./chunk-rcv2ehpq.js";import"./chunk-wc66mcn4.js";import"./chunk-aq1xq0r4.js";import"./chunk-zcz9rs6p.js";import"./chunk-v3nwkveg.js";import"./chunk-9fqp72ze.js";import"./chunk-0btmm4m2.js";import"./chunk-24w86pek.js";import"./chunk-tkyrk66a.js";import"./chunk-213jwgpx.js";import"./chunk-4q1c6fw2.js";import"./chunk-1te8k8gp.js";import"./chunk-zpcnbdhn.js";import"./chunk-rz9f3zqz.js";import"./chunk-bn1edb1y.js";import"./chunk-cj3adc77.js";import"./chunk-t1htzg9e.js";import"./chunk-gbmeh7jg.js";import"./chunk-8wp64mym.js";import"./chunk-vx86cf4r.js";import"./chunk-563shnkz.js";import"./chunk-2fw05hs2.js";export{b as getAvailableTargets,c as getAvailableFormats,d as default,a as buildNative};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Sg as a,Tg as b,Ug as c,Vg as d,Wg as e,Xg as f}from"./chunk-tp8pzf94.js";import"./chunk-wc66mcn4.js";import"./chunk-aq1xq0r4.js";import"./chunk-zcz9rs6p.js";import"./chunk-v3nwkveg.js";import"./chunk-9fqp72ze.js";import"./chunk-0btmm4m2.js";import"./chunk-24w86pek.js";import"./chunk-tkyrk66a.js";import"./chunk-213jwgpx.js";import"./chunk-4q1c6fw2.js";import"./chunk-1te8k8gp.js";import"./chunk-zpcnbdhn.js";import"./chunk-rz9f3zqz.js";import"./chunk-bn1edb1y.js";import"./chunk-cj3adc77.js";import"./chunk-t1htzg9e.js";import"./chunk-gbmeh7jg.js";import"./chunk-8wp64mym.js";import"./chunk-vx86cf4r.js";import"./chunk-563shnkz.js";import"./chunk-2fw05hs2.js";export{c as renderSlot,d as processSlots,a as parseSlots,b as parseSlotElement,e as extractSlotContent,f as applySlots};
@@ -1,5 +0,0 @@
1
- // @bun
2
- function A(h){let q=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;h=h.replace(q,(w,j)=>{return`const { ${j.split(",").map((k)=>k.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
3
- `});let v=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return h=h.replace(v,(w,j)=>{return`const { ${j.split(",").map((k)=>k.trim()).filter(Boolean).join(", ")} } = window.__composables
4
- `}),h}function B(h){return h.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}
5
- export{A as Jv,B as Kv};