@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
@@ -3,7 +3,7 @@ export function generateServiceWorker(options, outputDir) {
3
3
  const pwa = options.pwa;
4
4
  if (!pwa?.enabled)
5
5
  return "";
6
- const swConfig = pwa.serviceWorker || {}, routes = pwa.routes || [], cacheVersion = swConfig.cacheVersion || "1.0.0", offlineConfig = pwa.offline, offlinePage = offlineConfig?.page ? "/offline.html" : "/offline.html", pushConfig = pwa.push, syncConfig = pwa.backgroundSync, cacheStorageConfig = pwa.cacheStorage, precacheManifest = outputDir ? generatePrecacheManifest(outputDir, options) : null, precacheManifestJs = precacheManifest ? generatePrecacheManifestJs(precacheManifest) : "[]", precacheAssets = [
6
+ const swConfig = pwa.serviceWorker || {}, routes = pwa.routes || [], cacheVersion = swConfig.cacheVersion || "1.0.0", offlineConfig = pwa.offline, offlinePage = offlineConfig?.page ? "/offline.html" : "/offline.html", { push: pushConfig, backgroundSync: syncConfig, cacheStorage: cacheStorageConfig } = pwa, precacheManifest = outputDir ? generatePrecacheManifest(outputDir, options) : null, precacheManifestJs = precacheManifest ? generatePrecacheManifestJs(precacheManifest) : "[]", precacheAssets = [
7
7
  "/",
8
8
  "/manifest.json",
9
9
  ...offlineConfig?.enabled ? [offlinePage] : [],
@@ -66,7 +66,7 @@ export function generateWorkboxServiceWorker(options, outputDir) {
66
66
  const pwa = options.pwa;
67
67
  if (!pwa?.enabled)
68
68
  return "";
69
- const config = generateWorkboxConfig(options, outputDir), swConfig = pwa.serviceWorker || {}, pushConfig = pwa.push, syncConfig = pwa.backgroundSync, precacheManifest = outputDir ? generatePrecacheManifest(outputDir, options) : null, precacheManifestJs = precacheManifest ? generatePrecacheManifestJs(precacheManifest) : "[]", imports = generateWorkboxImports(config.modules), runtimeCaching = generateRuntimeCachingCode(options);
69
+ const config = generateWorkboxConfig(options, outputDir), swConfig = pwa.serviceWorker || {}, { push: pushConfig, backgroundSync: syncConfig } = pwa, precacheManifest = outputDir ? generatePrecacheManifest(outputDir, options) : null, precacheManifestJs = precacheManifest ? generatePrecacheManifestJs(precacheManifest) : "[]", imports = generateWorkboxImports(config.modules), runtimeCaching = generateRuntimeCachingCode(options);
70
70
  return `/**
71
71
  * Service Worker - Generated by stx with Workbox
72
72
  * Cache Version: ${config.cacheVersion}
package/dist/pwa.js CHANGED
@@ -1,15 +1,15 @@
1
1
  // @bun
2
- import{Rk as wq,Sk as dq,Tk as Cq,Uk as mq,Vk as gq}from"./chunk-kmsyvaex.js";import{$k as P,Wk as S,Xk as Tq,Yk as _q,Zk as z,_k as D,al as kq,bl as vq,cl as w,dl as Iq,el as d,fl as Hq,gl as Oq,hl as Mq}from"./chunk-1ws3xcea.js";import{$w as Dq,Xw as Aq,Yw as bq,Zw as Sq,_w as zq,ax as Pq}from"./chunk-vx86cf4r.js";import"./chunk-563shnkz.js";import{ix as N}from"./chunk-2fw05hs2.js";import p from"fs";import E from"path";import C from"fs";import L from"path";var k=[72,96,128,144,152,192,384,512],v=[120,152,167,180],I=[16,32];async function H(G,B){let q={success:!0,generatedFiles:[],errors:[],warnings:[]},K=G.pwa?.icons;if(!K?.src)return q.errors.push("No source icon specified in pwa.icons.src"),q.success=!1,q;let Y=L.isAbsolute(K.src)?K.src:L.resolve(process.cwd(),K.src);if(!await Bun.file(Y).exists())return q.errors.push(`Source icon not found: ${Y}`),q.success=!1,q;let Q=L.resolve(B,K.outputDir||"pwa-icons");try{C.mkdirSync(Q,{recursive:!0})}catch{return q.errors.push(`Failed to create output directory: ${Q}`),q.success=!1,q}let X=K.sizes||k,j=K.generateWebP??!0,J=K.generateAppleIcons??!0;try{let y;try{y=await import("sharp")}catch{return q.errors.push(`sharp is not installed. Install it with: bun add sharp
3
- Icon generation requires the sharp package for image processing.`),q.success=!1,q}let R=await y.default(Y).metadata();if(R.width&&R.width<512)q.warnings.push(`Source icon is ${R.width}x${R.height}. Recommend using at least 512x512 for best quality.`);for(let $ of X){let x=L.join(Q,`icon-${$}x${$}.png`);if(await y.default(Y).resize($,$,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(x),q.generatedFiles.push(x),j){let F=L.join(Q,`icon-${$}x${$}.webp`);await y.default(Y).resize($,$,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(F),q.generatedFiles.push(F)}}if(J){for(let x of v){let F=L.join(Q,`apple-touch-icon-${x}x${x}.png`);await y.default(Y).resize(x,x,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(F),q.generatedFiles.push(F)}let $=L.join(Q,"apple-touch-icon.png");await y.default(Y).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile($),q.generatedFiles.push($)}for(let $ of I){let x=L.join(Q,`favicon-${$}x${$}.png`);await y.default(Y).resize($,$,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(x),q.generatedFiles.push(x)}let U=512,T=L.join(Q,`icon-maskable-${U}x${U}.png`),Z=Math.floor(U*0.1),_=U-Z*2;await y.default(Y).resize(_,_,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:Z,bottom:Z,left:Z,right:Z,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(T),q.generatedFiles.push(T)}catch(y){let V=y instanceof Error?y.message:String(y);q.errors.push(`Icon generation failed: ${V}`),q.success=!1}return q}function n(G){let B=G.sizes||k,q=G.outputDir?`/${G.outputDir}`:"/pwa-icons",K=G.generateWebP??!0,Y=G.generateAppleIcons??!0,Q=[];for(let X of B)if(Q.push(`${q}/icon-${X}x${X}.png`),K)Q.push(`${q}/icon-${X}x${X}.webp`);if(Y){Q.push(`${q}/apple-touch-icon.png`);for(let X of v)Q.push(`${q}/apple-touch-icon-${X}x${X}.png`)}for(let X of I)Q.push(`${q}/favicon-${X}x${X}.png`);return Q.push(`${q}/icon-maskable-512x512.png`),Q}async function O(){try{return await import("sharp"),!0}catch{return!1}}function m(G,B,q,K){let Y=[],Q=K.join(" ");for(let X of G)if(Y.push({src:`${B}/icon-${X}x${X}.png`,sizes:`${X}x${X}`,type:"image/png",purpose:Q}),q)Y.push({src:`${B}/icon-${X}x${X}.webp`,sizes:`${X}x${X}`,type:"image/webp",purpose:Q});return Y}function g(G){return G.map((B)=>({name:B.name,short_name:B.shortName,description:B.description,url:B.url,icons:B.icons?.map((q)=>({src:q.src,sizes:q.sizes,type:q.type}))}))}function h(G){let B=G.pwa?.shareTarget;if(!B?.enabled)return;let q={action:B.action||"/share",method:B.method||"POST",enctype:B.enctype||"multipart/form-data",params:{title:B.params?.title||"title",text:B.params?.text||"text",url:B.params?.url||"url"}};if(B.acceptFiles&&B.acceptFiles.length>0)q.params.files=B.acceptFiles.map((K)=>({name:K.name,accept:K.accept}));return q}function c(G){let B=G.pwa?.fileHandlers;if(!B?.enabled||!B.accept)return;let q=[{action:B.action||"/",accept:B.accept,launch_type:B.launchType||"single-client"}];if(B.icons)q[0].icons=B.icons.map((K)=>({src:K.src,sizes:K.sizes,type:K.type}));return q}function l(G){let B=G.pwa?.protocolHandlers;if(!B||B.length===0)return;return B.map((q)=>({protocol:q.protocol,url:q.url}))}function u(G){let B=G.pwa;if(!B?.enabled||!B.manifest)return null;let{manifest:q,icons:K}=B,Y=K?.sizes||[72,96,128,144,152,192,384,512],Q=K?.outputDir?`/${K.outputDir}`:"/pwa-icons",X=K?.generateWebP??!0,j=K?.purpose||["any","maskable"],J={name:q.name,short_name:q.shortName||q.name,description:q.description,start_url:q.startUrl||"/",display:q.display||"standalone",display_override:q.displayOverride,orientation:q.orientation,theme_color:q.themeColor,background_color:q.backgroundColor,scope:q.scope||"/",lang:q.lang,dir:q.dir,id:q.id,categories:q.categories,icons:m(Y,Q,X,j)};if(q.shortcuts&&q.shortcuts.length>0)J.shortcuts=g(q.shortcuts);if(q.screenshots&&q.screenshots.length>0)J.screenshots=q.screenshots.map((U)=>({src:U.src,sizes:U.sizes,type:U.type,label:U.label,form_factor:U.platform}));let y=h(G);if(y)J.share_target=y;let V=c(G);if(V)J.file_handlers=V;let R=l(G);if(R)J.protocol_handlers=R;if(q.launchHandler)J.launch_handler={client_mode:q.launchHandler};if(q.handleLinks)J.handle_links=q.handleLinks;if(q.edgeSidePanel?.enabled)J.edge_side_panel={preferred_width:q.edgeSidePanel.preferredWidth};return J}function M(G){let B=u(G);if(!B)return"";let q=JSON.parse(JSON.stringify(B));return JSON.stringify(q,null,2)}function i(G,B){return{...B,...G,shortcuts:G.shortcuts||B.shortcuts,screenshots:G.screenshots||B.screenshots,categories:G.categories||B.categories}}function s(G){let B=[],q=G.pwa;if(!q?.enabled)return B;let K=q.manifest;if(!K)return B.push("PWA manifest configuration is missing"),B;if(!K.name)B.push("Manifest name is required");let Y=["fullscreen","standalone","minimal-ui","browser"];if(K.display&&!Y.includes(K.display))B.push(`Invalid display mode: ${K.display}. Must be one of: ${Y.join(", ")}`);let Q=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(K.orientation&&!Q.includes(K.orientation))B.push(`Invalid orientation: ${K.orientation}`);let X=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(K.themeColor&&!X.test(K.themeColor))B.push(`Invalid theme color: ${K.themeColor}. Must be a valid hex color.`);if(K.backgroundColor&&!X.test(K.backgroundColor))B.push(`Invalid background color: ${K.backgroundColor}. Must be a valid hex color.`);if(q.shareTarget?.enabled){if(!q.shareTarget.action)B.push("Share target action URL is required")}if(q.fileHandlers?.enabled){if(!q.fileHandlers.accept||Object.keys(q.fileHandlers.accept).length===0)B.push("File handlers must specify accepted MIME types")}if(q.protocolHandlers)for(let j of q.protocolHandlers){if(!j.protocol)B.push("Protocol handler missing protocol");if(!j.url||!j.url.includes("%s"))B.push(`Protocol handler URL must contain %s placeholder: ${j.protocol}`)}return B}import A from"path";async function b(G){let B=G.pwa?.offline;if(!B?.enabled)return"";if(B.page){let q=A.isAbsolute(B.page)?B.page:A.resolve(process.cwd(),B.page);if(await Bun.file(q).exists())try{let{processDirectives:K}=await import("./chunk-2tbez006.js"),Y=await Bun.file(q).text();return await K(Y,{},q,G,new Set)}catch(K){console.warn(`[PWA] Failed to process custom offline page: ${K}`)}else console.warn(`[PWA] Custom offline page not found: ${q}`)}return f(G)}function f(G){let B=G.pwa?.offline,q=G.pwa?.manifest,K=B?.fallbackTitle||"You are offline",Y=B?.fallbackMessage||"Please check your internet connection and try again.",Q=q?.themeColor||"#4f46e5",X=q?.shortName||q?.name||"App";return`<!DOCTYPE html>
2
+ import{Mn,Oe,Ii,Ba}from"./chunk-fr2txj8q.js";import{On,zr,Na,La,ja}from"./chunk-b84h16er.js";import{Ri,Ai,Pi,Oa,Ma}from"./chunk-q9bdh4s5.js";import{ae,pt,Hr}from"./chunk-thyt8ed8.js";import{jc,Bc,Fc,zc,dr,od}from"./chunk-ft4p6d28.js";import B from"fs";import w from"path";import O from"fs";import u from"path";var v=[72,96,128,144,152,192,384,512],S=[120,152,167,180],P=[16,32];async function M(n,t){let e={success:!0,generatedFiles:[],errors:[],warnings:[]},r=n.pwa?.icons;if(!r?.src)return e.errors.push("No source icon specified in pwa.icons.src"),e.success=!1,e;let o=u.isAbsolute(r.src)?r.src:u.resolve(process.cwd(),r.src);if(!await Bun.file(o).exists())return e.errors.push(`Source icon not found: ${o}`),e.success=!1,e;let a=u.resolve(t,r.outputDir||"pwa-icons");try{O.mkdirSync(a,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${a}`),e.success=!1,e}let s=r.sizes||v,l=r.generateWebP??!0,p=r.generateAppleIcons??!0;try{let c;try{c=await import("sharp")}catch{return e.errors.push(`sharp is not installed. Install it with: bun add sharp
3
+ Icon generation requires the sharp package for image processing.`),e.success=!1,e}let g=await c.default(o).metadata();if(g.width&&g.width<512)e.warnings.push(`Source icon is ${g.width}x${g.height}. Recommend using at least 512x512 for best quality.`);for(let i of s){let d=u.join(a,`icon-${i}x${i}.png`);if(await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d),l){let x=u.join(a,`icon-${i}x${i}.webp`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(x),e.generatedFiles.push(x)}}if(p){for(let d of S){let x=u.join(a,`apple-touch-icon-${d}x${d}.png`);await c.default(o).resize(d,d,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(x),e.generatedFiles.push(x)}let i=u.join(a,"apple-touch-icon.png");await c.default(o).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(i),e.generatedFiles.push(i)}for(let i of P){let d=u.join(a,`favicon-${i}x${i}.png`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d)}let f=512,y=u.join(a,`icon-maskable-${f}x${f}.png`),m=Math.floor(f*0.1),k=f-m*2;await c.default(o).resize(k,k,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:m,bottom:m,left:m,right:m,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(y),e.generatedFiles.push(y)}catch(c){let h=c instanceof Error?c.message:String(c);e.errors.push(`Icon generation failed: ${h}`),e.success=!1}return e}function N(n){let t=n.sizes||v,e=n.outputDir?`/${n.outputDir}`:"/pwa-icons",r=n.generateWebP??!0,o=n.generateAppleIcons??!0,a=[];for(let s of t)if(a.push(`${e}/icon-${s}x${s}.png`),r)a.push(`${e}/icon-${s}x${s}.webp`);if(o){a.push(`${e}/apple-touch-icon.png`);for(let s of S)a.push(`${e}/apple-touch-icon-${s}x${s}.png`)}for(let s of P)a.push(`${e}/favicon-${s}x${s}.png`);return a.push(`${e}/icon-maskable-512x512.png`),a}async function I(){try{return await import("sharp"),!0}catch{return!1}}function A(n,t,e,r){let o=[],a=r.join(" ");for(let s of n)if(o.push({src:`${t}/icon-${s}x${s}.png`,sizes:`${s}x${s}`,type:"image/png",purpose:a}),e)o.push({src:`${t}/icon-${s}x${s}.webp`,sizes:`${s}x${s}`,type:"image/webp",purpose:a});return o}function C(n){return n.map((t)=>({name:t.name,short_name:t.shortName,description:t.description,url:t.url,icons:t.icons?.map((e)=>({src:e.src,sizes:e.sizes,type:e.type}))}))}function T(n){let t=n.pwa?.shareTarget;if(!t?.enabled)return;let e={action:t.action||"/share",method:t.method||"POST",enctype:t.enctype||"multipart/form-data",params:{title:t.params?.title||"title",text:t.params?.text||"text",url:t.params?.url||"url"}};if(t.acceptFiles&&t.acceptFiles.length>0)e.params.files=t.acceptFiles.map((r)=>({name:r.name,accept:r.accept}));return e}function H(n){let t=n.pwa?.fileHandlers;if(!t?.enabled||!t.accept)return;let e=[{action:t.action||"/",accept:t.accept,launch_type:t.launchType||"single-client"}];if(t.icons)e[0].icons=t.icons.map((r)=>({src:r.src,sizes:r.sizes,type:r.type}));return e}function W(n){let t=n.pwa?.protocolHandlers;if(!t||t.length===0)return;return t.map((e)=>({protocol:e.protocol,url:e.url}))}function j(n){let t=n.pwa;if(!t?.enabled||!t.manifest)return null;let{manifest:e,icons:r}=t,o=r?.sizes||[72,96,128,144,152,192,384,512],a=r?.outputDir?`/${r.outputDir}`:"/pwa-icons",s=r?.generateWebP??!0,l=r?.purpose||["any","maskable"],p={name:e.name,short_name:e.shortName||e.name,description:e.description,start_url:e.startUrl||"/",display:e.display||"standalone",display_override:e.displayOverride,orientation:e.orientation,theme_color:e.themeColor,background_color:e.backgroundColor,scope:e.scope||"/",lang:e.lang,dir:e.dir,id:e.id,categories:e.categories,icons:A(o,a,s,l)};if(e.shortcuts&&e.shortcuts.length>0)p.shortcuts=C(e.shortcuts);if(e.screenshots&&e.screenshots.length>0)p.screenshots=e.screenshots.map((f)=>({src:f.src,sizes:f.sizes,type:f.type,label:f.label,form_factor:f.platform}));let c=T(n);if(c)p.share_target=c;let h=H(n);if(h)p.file_handlers=h;let g=W(n);if(g)p.protocol_handlers=g;if(e.launchHandler)p.launch_handler={client_mode:e.launchHandler};if(e.handleLinks)p.handle_links=e.handleLinks;if(e.edgeSidePanel?.enabled)p.edge_side_panel={preferred_width:e.edgeSidePanel.preferredWidth};return p}function _(n){let t=j(n);if(!t)return"";let e=JSON.parse(JSON.stringify(t));return JSON.stringify(e,null,2)}function q(n,t){return{...t,...n,shortcuts:n.shortcuts||t.shortcuts,screenshots:n.screenshots||t.screenshots,categories:n.categories||t.categories}}function D(n){let t=[],e=n.pwa;if(!e?.enabled)return t;let r=e.manifest;if(!r)return t.push("PWA manifest configuration is missing"),t;if(!r.name)t.push("Manifest name is required");let o=["fullscreen","standalone","minimal-ui","browser"];if(r.display&&!o.includes(r.display))t.push(`Invalid display mode: ${r.display}. Must be one of: ${o.join(", ")}`);let a=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(r.orientation&&!a.includes(r.orientation))t.push(`Invalid orientation: ${r.orientation}`);let s=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(r.themeColor&&!s.test(r.themeColor))t.push(`Invalid theme color: ${r.themeColor}. Must be a valid hex color.`);if(r.backgroundColor&&!s.test(r.backgroundColor))t.push(`Invalid background color: ${r.backgroundColor}. Must be a valid hex color.`);if(e.shareTarget?.enabled){if(!e.shareTarget.action)t.push("Share target action URL is required")}if(e.fileHandlers?.enabled){if(!e.fileHandlers.accept||Object.keys(e.fileHandlers.accept).length===0)t.push("File handlers must specify accepted MIME types")}if(e.protocolHandlers)for(let l of e.protocolHandlers){if(!l.protocol)t.push("Protocol handler missing protocol");if(!l.url||!l.url.includes("%s"))t.push(`Protocol handler URL must contain %s placeholder: ${l.protocol}`)}return t}import z from"path";async function F(n){let t=n.pwa?.offline;if(!t?.enabled)return"";if(t.page){let e=z.isAbsolute(t.page)?t.page:z.resolve(process.cwd(),t.page);if(await Bun.file(e).exists())try{let{processDirectives:r}=await import("./chunk-se7mwqd1.js"),o=await Bun.file(e).text();return await r(o,{},e,n,new Set)}catch(r){console.warn(`[PWA] Failed to process custom offline page: ${r}`)}else console.warn(`[PWA] Custom offline page not found: ${e}`)}return E(n)}function E(n){let t=n.pwa?.offline,e=n.pwa?.manifest,r=t?.fallbackTitle||"You are offline",o=t?.fallbackMessage||"Please check your internet connection and try again.",a=e?.themeColor||"#4f46e5",s=e?.shortName||e?.name||"App";return`<!DOCTYPE html>
4
4
  <html lang="en">
5
5
  <head>
6
6
  <meta charset="UTF-8">
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
8
- <meta name="theme-color" content="${Q}">
9
- <title>${W(K)} - ${W(X)}</title>
8
+ <meta name="theme-color" content="${a}">
9
+ <title>${b(r)} - ${b(s)}</title>
10
10
  <style>
11
11
  :root {
12
- --theme-color: ${Q};
12
+ --theme-color: ${a};
13
13
  --text-primary: #1a1a2e;
14
14
  --text-secondary: #666;
15
15
  --bg-gradient-start: #f5f7fa;
@@ -176,8 +176,8 @@ Icon generation requires the sharp package for image processing.`),q.success=!1,
176
176
  <circle cx="12" cy="20" r="1"/>
177
177
  </svg>
178
178
 
179
- <h1>${W(K)}</h1>
180
- <p>${W(Y)}</p>
179
+ <h1>${b(r)}</h1>
180
+ <p>${b(o)}</p>
181
181
 
182
182
  <button class="retry-btn" onclick="window.location.reload()">
183
183
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
@@ -233,4 +233,4 @@ Icon generation requires the sharp package for image processing.`),q.success=!1,
233
233
  }, 5000);
234
234
  </script>
235
235
  </body>
236
- </html>`}function W(G){return G.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}z();w();z();w();async function jq(G,B){let q={success:!0,files:{icons:[]},errors:[],warnings:[]},K=G.pwa;if(!K?.enabled)return q;try{p.mkdirSync(B,{recursive:!0})}catch{return q.errors.push(`Failed to create output directory: ${B}`),q.success=!1,q}try{let Q=M(G);if(Q){let X=E.join(B,"manifest.json");await Bun.write(X,Q),q.files.manifest=X}}catch(Q){let X=Q instanceof Error?Q.message:String(Q);q.errors.push(`Failed to generate manifest.json: ${X}`),q.success=!1}if(K.icons?.src)if(await O()){let X=await H(G,B);if(q.files.icons=X.generatedFiles,q.warnings.push(...X.warnings),!X.success)q.errors.push(...X.errors),q.success=!1}else q.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(K.offline?.enabled)try{let Q=await b(G);if(Q){let X=E.join(B,"offline.html");await Bun.write(X,Q),q.files.offlinePage=X}}catch(Q){let X=Q instanceof Error?Q.message:String(Q);q.errors.push(`Failed to generate offline page: ${X}`),q.success=!1}let Y;if(K.precache?.enabled){let Q=S(B,G);Y={fileCount:Q.fileCount,totalSize:Q.totalSize},q.precacheStats=Y}try{let Q=D(G,B);if(Q){let X=P(G),j=E.join(B,X);await Bun.write(j,Q),q.files.serviceWorker=j}}catch(Q){let X=Q instanceof Error?Q.message:String(Q);q.errors.push(`Failed to generate service worker: ${X}`),q.success=!1}return q}function Jq(G,B){return d(G,B)}function Uq(G){return G.pwa?.enabled===!0}export{s as validateManifest,mq as runPwaAudit,Pq as registerPwaDirectives,bq as pwaUpdateDirective,zq as pwaPushDirective,Sq as pwaOfflineDirective,Aq as pwaInstallDirective,Dq as pwaDirectives,Jq as processPwaHtml,i as mergeManifestConfig,kq as isWorkboxEnabled,O as isSharpAvailable,Uq as isPwaEnabled,d as injectPwaTags,P as getServiceWorkerFileName,n as getExpectedIconPaths,Mq as generateThemeColorMeta,Hq as generateSwRegistrationScript,vq as generateServiceWorkerAuto,D as generateServiceWorker,Iq as generatePwaTags,H as generatePwaIcons,Tq as generatePrecacheManifestJs,S as generatePrecacheManifest,b as generateOfflinePage,Oq as generateManifestLink,M as generateManifestJson,u as generateManifest,_q as formatSize,gq as formatAuditResult,Cq as calculateAuditResult,jq as buildPwaAssets,wq as auditConfig,dq as auditBuildOutput,I as FAVICON_SIZES,k as DEFAULT_ICON_SIZES,v as APPLE_TOUCH_ICON_SIZES};
236
+ </html>`}function b(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}async function re(n,t){let e={success:!0,files:{icons:[]},errors:[],warnings:[]},r=n.pwa;if(!r?.enabled)return e;try{B.mkdirSync(t,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${t}`),e.success=!1,e}try{let a=_(n);if(a){let s=w.join(t,"manifest.json");await Bun.write(s,a),e.files.manifest=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate manifest.json: ${s}`),e.success=!1}if(r.icons?.src)if(await I()){let s=await M(n,t);if(e.files.icons=s.generatedFiles,e.warnings.push(...s.warnings),!s.success)e.errors.push(...s.errors),e.success=!1}else e.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(r.offline?.enabled)try{let a=await F(n);if(a){let s=w.join(t,"offline.html");await Bun.write(s,a),e.files.offlinePage=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate offline page: ${s}`),e.success=!1}let o;if(r.precache?.enabled){let a=ae(t,n);o={fileCount:a.fileCount,totalSize:a.totalSize},e.precacheStats=o}try{let a=Mn(n,t);if(a){let s=Oe(n),l=w.join(t,s);await Bun.write(l,a),e.files.serviceWorker=l}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate service worker: ${s}`),e.success=!1}return e}function se(n,t){return zr(n,t)}function oe(n){return n.pwa?.enabled===!0}export{S as APPLE_TOUCH_ICON_SIZES,v as DEFAULT_ICON_SIZES,P as FAVICON_SIZES,Ai as auditBuildOutput,Ri as auditConfig,re as buildPwaAssets,Pi as calculateAuditResult,Ma as formatAuditResult,Hr as formatSize,j as generateManifest,_ as generateManifestJson,La as generateManifestLink,F as generateOfflinePage,ae as generatePrecacheManifest,pt as generatePrecacheManifestJs,M as generatePwaIcons,On as generatePwaTags,Mn as generateServiceWorker,Ba as generateServiceWorkerAuto,Na as generateSwRegistrationScript,ja as generateThemeColorMeta,N as getExpectedIconPaths,Oe as getServiceWorkerFileName,zr as injectPwaTags,oe as isPwaEnabled,I as isSharpAvailable,Ii as isWorkboxEnabled,q as mergeManifestConfig,se as processPwaHtml,dr as pwaDirectives,jc as pwaInstallDirective,Fc as pwaOfflineDirective,zc as pwaPushDirective,Bc as pwaUpdateDirective,od as registerPwaDirectives,Oa as runPwaAudit,D as validateManifest};
@@ -8,7 +8,7 @@
8
8
  * from the build's point of view nothing failed (stacksjs/stx#1866).
9
9
  *
10
10
  * The URL is looked for in the places apps actually declare it, because there
11
- * is more than one: `stx.config.ts` for stx-native apps, `site.config.ts` for
11
+ * is more than one: `stx.config.ts` for stx native apps, `site.config.ts` for
12
12
  * the site-builder path (which has had `site.url` all along — that generator
13
13
  * was never wired to this one), and the deploy-platform env vars, which are the
14
14
  * only source available in CI where neither file knows the preview domain.
package/dist/ssg.js CHANGED
@@ -1,58 +1,58 @@
1
1
  // @bun
2
- import{Ik as Uq,Jk as Iq,Nk as wq}from"./chunk-kxc2h5vn.js";import{Ok as Eq,Pk as Tq,Qk as Dq}from"./chunk-anydpa34.js";import{jl as _q,ml as zq,nl as Aq}from"./chunk-de8t7sc9.js";import"./chunk-cs54ek9m.js";import"./chunk-s8jd13nb.js";import{Or as n,aq as C,dn as Oq,vo as l,yo as Hq}from"./chunk-wc66mcn4.js";import"./chunk-aq1xq0r4.js";import"./chunk-zcz9rs6p.js";import"./chunk-v3nwkveg.js";import"./chunk-9fqp72ze.js";import"./chunk-0btmm4m2.js";import{Et as Xq}from"./chunk-24w86pek.js";import{Jt as d}from"./chunk-tkyrk66a.js";import"./chunk-213jwgpx.js";import"./chunk-4q1c6fw2.js";import"./chunk-1te8k8gp.js";import{ou as Bq}from"./chunk-zpcnbdhn.js";import"./chunk-rz9f3zqz.js";import"./chunk-bn1edb1y.js";import"./chunk-cj3adc77.js";import"./chunk-t1htzg9e.js";import"./chunk-gbmeh7jg.js";import{Kw as Yq,Lw as Vq,Mw as jq,Nw as Gq,Ow as Lq,Pw as Nq}from"./chunk-8wp64mym.js";import"./chunk-vx86cf4r.js";import"./chunk-563shnkz.js";import{ix as P}from"./chunk-2fw05hs2.js";import X from"fs";import j from"path";import{createHash as xq}from"crypto";function yq(q){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(q).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return q}}var Pq=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function Cq(q){return Bun.hash(q).toString(16)}function Qq(q,Z={}){if(!q.includes('type="stx/island"'))return{html:q,chunks:[]};let $=new Map,Q=q.replace(Pq,(J,W,_,z)=>{let L=z.trim();if(!L)return J;if(/\bdata-stx-src=/.test(_))return J;if(Z.minify)L=yq(L);let A=Cq(L);if(!$.has(A))$.set(A,L);let B=Z.integrity?` data-stx-integrity="sha384-${xq("sha384").update(L).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${W}" data-stx-src="/_stx/islands/${A}.js"${B}${_}></script>`}),K=Array.from($,([J,W])=>({hash:J,code:W}));return{html:Q,chunks:K}}var gq=new Set(["visible","idle"]);function Zq(q){if(!q.includes("data-stx-src="))return q;let Z=new Map,$=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,Q;while((Q=$.exec(q))!==null)Z.set(Q[1],Q[2]);let K=new Set,J=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,W;while((W=J.exec(q))!==null)if(gq.has(Z.get(W[1])||""))K.add(W[2]);let _=q.lastIndexOf("</head>");if(K.size===0||_===-1)return q;let z=Array.from(K).filter((L)=>!q.includes(`rel="prefetch" href="${L}"`)).map((L)=>`<link rel="prefetch" href="${L}" as="script">`).join("");if(!z)return q;return q.slice(0,_)+z+q.slice(_)}var fq=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function h(q){let Z=q.trim();if(!Z)return null;let $=/^https?:\/\//i.test(Z)?Z:`https://${Z}`;try{return new URL($).origin+new URL($).pathname.replace(/\/$/,"")}catch{return null}}function mq(q){for(let Z of fq){let $=q[Z];if(!$)continue;let Q=h($);if(Q)return{url:Q,source:"env",via:Z}}return null}function $q(q){if(!q||typeof q!=="object")return null;let Z=q,$=Z.site?.url??Z.url??Z.app?.url;return typeof $==="string"?h($):null}async function dq(q){let{existsSync:Z}=await import("fs"),$=await import("path");for(let Q of["site.config.ts","site.config.js",".config/site.config.ts"]){let K=$.resolve(q,Q);if(!Z(K))continue;try{let J=await import(K),W=$q(J.default??J);if(W)return W}catch{}}return null}async function Kq(q={}){let Z=q.cwd??process.cwd(),$=q.env??process.env;if(q.explicit){let W=h(q.explicit);if(W)return{url:W,source:"option"}}let Q=$q(q.stxConfig);if(Q)return{url:Q,source:"stx.config",via:"site.url"};let K=await dq(Z);if(K)return{url:K,source:"site.config",via:"url"};let J=mq($);if(J)return J;return{url:"http://localhost",source:"fallback"}}function Wq(){return["No site URL configured \u2014 sitemap.xml and robots.txt will point at http://localhost."," Set one in stx.config.ts (site: { url: 'https://example.com' }), in site.config.ts,"," via --domain, or with SITE_URL in the build environment."].join(`
3
- `)}class Fq{cacheDir;cache=new Map;loaded=!1;salt;constructor(q,Z=""){this.cacheDir=q,this.salt=Z}async load(){if(this.loaded)return;let q=j.join(this.cacheDir,"build-cache.json");if(await Bun.file(q).exists())try{let Z=JSON.parse(await Bun.file(q).text());for(let[$,Q]of Object.entries(Z))this.cache.set($,Q)}catch{}this.loaded=!0}async save(){await X.promises.mkdir(this.cacheDir,{recursive:!0});let q=j.join(this.cacheDir,"build-cache.json"),Z={};for(let[$,Q]of this.cache)Z[$]=Q;await Bun.write(q,JSON.stringify(Z))}getHash(q,Z){let $=X.statSync(q),Q=`${this.salt}|${q}:${$.mtimeMs}`;for(let J of Z)if(X.existsSync(J)){let W=X.statSync(J);Q+=`:${J}:${W.mtimeMs}`}let K=0;for(let J=0;J<Q.length;J++){let W=Q.charCodeAt(J);K=(K<<5)-K+W,K=K&K}return Math.abs(K).toString(36)}get(q,Z){let $=this.cache.get(q);if(!$)return null;let Q=this.getHash(Z,$.dependencies??[]);if($.hash!==Q)return this.cache.delete(q),null;return $.html}set(q,Z,$,Q){let K=this.getHash(Z,$);this.cache.set(q,{hash:K,html:Q,generatedAt:Date.now(),dependencies:$})}}class Rq{cacheDir;constructor(q){this.cacheDir=q}getFilePath(q){let Z=q.replace(/[^a-zA-Z0-9]/g,"_")+".json";return j.join(this.cacheDir,"isr",Z)}async get(q){let Z=this.getFilePath(q);if(!await Bun.file(Z).exists())return null;try{return JSON.parse(await Bun.file(Z).text())}catch{return null}}async set(q,Z){let $=this.getFilePath(q);await X.promises.mkdir(j.dirname($),{recursive:!0}),await Bun.write($,JSON.stringify(Z))}async invalidate(q){let Z=this.getFilePath(q);if(await Bun.file(Z).exists())await X.promises.unlink(Z)}async invalidatePattern(q){let Z=j.join(this.cacheDir,"isr");if(!X.existsSync(Z))return;let $=await X.promises.readdir(Z);for(let Q of $){let K=Q.replace(/_/g,"/").replace(".json","");if(q.test(K))await X.promises.unlink(j.join(Z,Q))}}async needsRevalidation(q){let Z=await this.get(q);if(!Z)return!0;return Date.now()>Z.revalidateAfter}}async function pq(q){try{let $=(await Bun.file(q).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!$)return null;let Q=$[1];if(!Q.includes("getStaticPaths"))return null;let K=Q.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!K)return null;return await Function(`
2
+ import"./chunk-z0g9jvv0.js";import"./chunk-shr559s7.js";import{Qe,et,tt,nt,rt,st}from"./chunk-czxt605c.js";import"./chunk-ce1sejr3.js";import"./chunk-8nhshfz6.js";import{je,M,X,r,i}from"./chunk-69mc2np8.js";import{f}from"./chunk-h0atqq82.js";import"./chunk-m4sk62wb.js";import{nr}from"./chunk-xfp7k0v8.js";import"./chunk-ngc2wke4.js";import"./chunk-2gr351s0.js";import"./chunk-7gkv67ky.js";import"./chunk-ak1cgcah.js";import"./chunk-xtdw3692.js";import{ce,ft,gt}from"./chunk-mepdnezf.js";import{Ei,Ti,_i}from"./chunk-r3f9jcf7.js";import{dt,en,tn}from"./chunk-020xyn9q.js";import"./chunk-752hw7cd.js";import{o}from"./chunk-fzapbw9p.js";import x from"fs";import g from"path";import{createHash as $t}from"crypto";function Dt(t){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return t}}var Rt=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function kt(t){return Bun.hash(t).toString(16)}function lt(t,s={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let a=new Map,n=t.replace(Rt,(e,l,w,y)=>{let h=y.trim();if(!h)return e;if(/\bdata-stx-src=/.test(w))return e;if(s.minify)h=Dt(h);let S=kt(h);if(!a.has(S))a.set(S,h);let P=s.integrity?` data-stx-integrity="sha384-${$t("sha384").update(h).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${l}" data-stx-src="/_stx/islands/${S}.js"${P}${w}></script>`}),c=Array.from(a,([e,l])=>({hash:e,code:l}));return{html:n,chunks:c}}var Ct=new Set(["visible","idle"]);function ut(t){if(!t.includes("data-stx-src="))return t;let s=new Map,a=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,n;while((n=a.exec(t))!==null)s.set(n[1],n[2]);let c=new Set,e=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,l;while((l=e.exec(t))!==null)if(Ct.has(s.get(l[1])||""))c.add(l[2]);let w=t.lastIndexOf("</head>");if(c.size===0||w===-1)return t;let y=Array.from(c).filter((h)=>!t.includes(`rel="prefetch" href="${h}"`)).map((h)=>`<link rel="prefetch" href="${h}" as="script">`).join("");if(!y)return t;return t.slice(0,w)+y+t.slice(w)}var Et=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function q(t){let s=t.trim();if(!s)return null;let a=/^https?:\/\//i.test(s)?s:`https://${s}`;try{return new URL(a).origin+new URL(a).pathname.replace(/\/$/,"")}catch{return null}}function It(t){for(let s of Et){let a=t[s];if(!a)continue;let n=q(a);if(n)return{url:n,source:"env",via:s}}return null}function pt(t){if(!t||typeof t!=="object")return null;let s=t,a=s.site?.url??s.url??s.app?.url;return typeof a==="string"?q(a):null}async function Bt(t){let{existsSync:s}=await import("fs"),a=await import("path");for(let n of["site.config.ts","site.config.js",".config/site.config.ts"]){let c=a.resolve(t,n);if(!s(c))continue;try{let e=await import(c),l=pt(e.default??e);if(l)return l}catch{}}return null}async function ht(t={}){let s=t.cwd??process.cwd(),a=t.env??process.env;if(t.explicit){let l=q(t.explicit);if(l)return{url:l,source:"option"}}let n=pt(t.stxConfig);if(n)return{url:n,source:"stx.config",via:"site.url"};let c=await Bt(s);if(c)return{url:c,source:"site.config",via:"url"};let e=It(a);if(e)return e;return{url:"http://localhost",source:"fallback"}}function mt(){return["No site URL configured \u2014 sitemap.xml and robots.txt will point at http://localhost."," Set one in stx.config.ts (site: { url: 'https://example.com' }), in site.config.ts,"," via --domain, or with SITE_URL in the build environment."].join(`
3
+ `)}class wt{cacheDir;cache=new Map;loaded=!1;salt;constructor(t,s=""){this.cacheDir=t,this.salt=s}async load(){if(this.loaded)return;let t=g.join(this.cacheDir,"build-cache.json");if(await Bun.file(t).exists())try{let s=JSON.parse(await Bun.file(t).text());for(let[a,n]of Object.entries(s))this.cache.set(a,n)}catch{}this.loaded=!0}async save(){await x.promises.mkdir(this.cacheDir,{recursive:!0});let t=g.join(this.cacheDir,"build-cache.json"),s={};for(let[a,n]of this.cache)s[a]=n;await Bun.write(t,JSON.stringify(s))}getHash(t,s){let a=x.statSync(t),n=`${this.salt}|${t}:${a.mtimeMs}`;for(let e of s)if(x.existsSync(e)){let l=x.statSync(e);n+=`:${e}:${l.mtimeMs}`}let c=0;for(let e=0;e<n.length;e++){let l=n.charCodeAt(e);c=(c<<5)-c+l,c=c&c}return Math.abs(c).toString(36)}get(t,s){let a=this.cache.get(t);if(!a)return null;let n=this.getHash(s,a.dependencies??[]);if(a.hash!==n)return this.cache.delete(t),null;return a.html}set(t,s,a,n){let c=this.getHash(s,a);this.cache.set(t,{hash:c,html:n,generatedAt:Date.now(),dependencies:a})}}class yt{cacheDir;constructor(t){this.cacheDir=t}getFilePath(t){let s=t.replace(/[^a-zA-Z0-9]/g,"_")+".json";return g.join(this.cacheDir,"isr",s)}async get(t){let s=this.getFilePath(t);if(!await Bun.file(s).exists())return null;try{return JSON.parse(await Bun.file(s).text())}catch{return null}}async set(t,s){let a=this.getFilePath(t);await x.promises.mkdir(g.dirname(a),{recursive:!0}),await Bun.write(a,JSON.stringify(s))}async invalidate(t){let s=this.getFilePath(t);if(await Bun.file(s).exists())await x.promises.unlink(s)}async invalidatePattern(t){let s=g.join(this.cacheDir,"isr");if(!x.existsSync(s))return;let a=await x.promises.readdir(s);for(let n of a){let c=n.replace(/_/g,"/").replace(".json","");if(t.test(c))await x.promises.unlink(g.join(s,n))}}async needsRevalidation(t){let s=await this.get(t);if(!s)return!0;return Date.now()>s.revalidateAfter}}async function jt(t){try{let a=(await Bun.file(t).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!a)return null;let n=a[1];if(!n.includes("getStaticPaths"))return null;let c=n.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!c)return null;return await Function(`
4
4
  return (async function getStaticPaths() {
5
- ${K[1]}
5
+ ${c[1]}
6
6
  })()
7
- `)()}catch(Z){return console.error(`Error extracting static paths from ${q}:`,Z),null}}async function uq(q){let Z=[];if(!q.isDynamic)Z.push({url:q.pattern,params:{}});else{let $=await pq(q.filePath);if(!$||$.paths.length===0)return console.warn(`Warning: Dynamic route ${q.pattern} has no getStaticPaths or returned empty paths`),Z;for(let Q of $.paths){let K=q.pattern;for(let[J,W]of Object.entries(Q.params))K=K.replace(`:${J}`,W).replace(`:${J}*`,W);Z.push({url:K,params:Q.params,props:Q.props,revalidate:Q.revalidate})}}return Z}async function hq(q){let Z=[q.replace(/\.stx$/,".data.ts"),q.replace(/\.stx$/,".data.js"),q+".data.ts",q+".data.js"];for(let $ of Z)if(await Bun.file($).exists())try{let Q=await import($);if(typeof Q.default==="function")return await Q.default();else if(typeof Q.default==="object")return Q.default;else if(typeof Q.getData==="function")return await Q.getData();else{let{default:K,...J}=Q;return J}}catch(Q){console.error(`Error loading data file ${$}:`,Q)}return null}async function cq(q,Z,$){let Q=q.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!Q)return null;let K=Q[1];if(!K.includes("getStaticProps"))return null;try{let J=K.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!J)return null;return await Function("params",`
7
+ `)()}catch(s){return console.error(`Error extracting static paths from ${t}:`,s),null}}async function Ft(t){let s=[];if(!t.isDynamic)s.push({url:t.pattern,params:{}});else{let a=await jt(t.filePath);if(!a||a.paths.length===0)return console.warn(`Warning: Dynamic route ${t.pattern} has no getStaticPaths or returned empty paths`),s;for(let n of a.paths){let c=t.pattern;for(let[e,l]of Object.entries(n.params))c=c.replace(`:${e}`,l).replace(`:${e}*`,l);s.push({url:c,params:n.params,props:n.props,revalidate:n.revalidate})}}return s}async function Ot(t){let s=[t.replace(/\.stx$/,".data.ts"),t.replace(/\.stx$/,".data.js"),t+".data.ts",t+".data.js"];for(let a of s)if(await Bun.file(a).exists())try{let n=await import(a);if(typeof n.default==="function")return await n.default();else if(typeof n.default==="object")return n.default;else if(typeof n.getData==="function")return await n.getData();else{let{default:c,...e}=n;return e}}catch(n){console.error(`Error loading data file ${a}:`,n)}return null}async function Tt(t,s,a){let n=t.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!n)return null;let c=n[1];if(!c.includes("getStaticProps"))return null;try{let e=c.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!e)return null;return await Function("params",`
8
8
  return (async function getStaticProps() {
9
- ${J[1]}
9
+ ${e[1]}
10
10
  })()
11
- `)(Z)}catch(J){return console.error(`Error executing getStaticProps in ${$}:`,J),null}}function lq(q){return/(?:^|[^\w$.])(?:export\s+)?(?:async\s+)?function\s+action\s*\(/.test(q)||/(?:^|[^\w$.])(?:export\s+)?(?:const|let|var)\s+action\s*=/.test(q)}async function Mq(q,Z,$={},Q,K){let J=await Bun.file(q.filePath).text(),W=await hq(q.filePath),_=await cq(J,Z,q.filePath),z={...W||{},..._||{},...$,params:Z,$route:{path:q.pattern,params:Z}},L=new Set,A=[],B=[],U={...K,...Q.partialsDir?{partialsDir:Q.partialsDir}:{},...Q.componentsDir?{componentsDir:Q.componentsDir}:{},debug:!1,cache:!1,autoShell:!0,onIncludeError:(H)=>{A.push(`${j.relative(process.cwd(),H.templatePath)}: ${H.message}
12
- resolved against partialsDir: ${H.partialsDir}`)},onServerScriptError:(H)=>{B.push(`${j.relative(process.cwd(),H.sourcePath)} (${H.kind}): ${H.message}`)}};if(lq(J))console.warn(`Warning: ${q.pattern} exports a page action, which cannot run in a static build. Its form will submit to a file. Serve this route with the production server, or point the form's action at a route handler.`);let G=await C(J,z,q.filePath,U,L);for(let H of[q.filePath,...L])for(let F of _q(H))L.add(F);if(Object.keys(Z).length>0){let H=`<script>if(window.stx)window.stx._rp=${JSON.stringify(Z)};else window.__stx_rp=${JSON.stringify(Z)};</script>`;if(G.includes("</head>"))G=G.replace("</head>",`${H}
13
- </head>`);else G=`${H}
14
- ${G}`}if(G=await Hq(G,{router:Q.router}),G=await Xq(G),Q.minify!==!1)return{html:nq(G),dependencies:Array.from(L),includeFailures:A,serverScriptFailures:B};return{html:G,dependencies:Array.from(L),includeFailures:A,serverScriptFailures:B}}function nq(q){let Z=[],$=0,Q=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,K;while((K=Q.exec(q))!==null){let W=q.slice($,K.index);Z.push(W.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let _=K[1],z=K[2],L=K[3];z=z.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),Z.push(_+z+L),$=K.index+K[0].length}let J=q.slice($);return Z.push(J.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),Z.join("").trim()}function iq(q){let Z=0;for(let $=0;$<q.length;$++){let Q=q.charCodeAt($);Z=(Z<<5)-Z+Q,Z=Z&Z}return`"${Math.abs(Z).toString(36)}"`}function sq(q,Z,$,Q){if($?.sitemap===!1)return!0;if(/<meta[^>]+name=["']robots["'][^>]+content=["'][^"']*noindex/i.test(Z))return!0;return Q.some((K)=>{if(K instanceof RegExp)return K.test(q);return K.endsWith("/")?q===K.slice(0,-1)||q.startsWith(K):q===K})}function oq(q,Z){return`<?xml version="1.0" encoding="UTF-8"?>
11
+ `)(s)}catch(e){return console.error(`Error executing getStaticProps in ${a}:`,e),null}}function At(t){return/(?:^|[^\w$.])(?:export\s+)?(?:async\s+)?function\s+action\s*\(/.test(t)||/(?:^|[^\w$.])(?:export\s+)?(?:const|let|var)\s+action\s*=/.test(t)}async function St(t,s,a={},n,c){let e=await Bun.file(t.filePath).text(),l=await Ot(t.filePath),w=await Tt(e,s,t.filePath),y={...l||{},...w||{},...a,params:s,$route:{path:t.pattern,params:s}},h=new Set,S=[],P=[],D={...c,...n.partialsDir?{partialsDir:n.partialsDir}:{},...n.componentsDir?{componentsDir:n.componentsDir}:{},debug:!1,cache:!1,autoShell:!0,onIncludeError:(b)=>{S.push(`${g.relative(process.cwd(),b.templatePath)}: ${b.message}
12
+ resolved against partialsDir: ${b.partialsDir}`)},onServerScriptError:(b)=>{P.push(`${g.relative(process.cwd(),b.sourcePath)} (${b.kind}): ${b.message}`)}};if(At(e))console.warn(`Warning: ${t.pattern} exports a page action, which cannot run in a static build. Its form will submit to a file. Serve this route with the production server, or point the form's action at a route handler.`);let p=await r(e,y,t.filePath,D,h);for(let b of[t.filePath,...h])for(let B of ce(b))h.add(B);if(Object.keys(s).length>0){let b=`<script>if(window.stx)window.stx._rp=${JSON.stringify(s)};else window.__stx_rp=${JSON.stringify(s)};</script>`;if(p.includes("</head>"))p=p.replace("</head>",`${b}
13
+ </head>`);else p=`${b}
14
+ ${p}`}if(p=await X(p,{router:n.router}),p=await f(p),n.minify!==!1)return{html:Lt(p),dependencies:Array.from(h),includeFailures:S,serverScriptFailures:P};return{html:p,dependencies:Array.from(h),includeFailures:S,serverScriptFailures:P}}function Lt(t){let s=[],a=0,n=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,c;while((c=n.exec(t))!==null){let l=t.slice(a,c.index);s.push(l.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let w=c[1],y=c[2],h=c[3];y=y.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),s.push(w+y+h),a=c.index+c[0].length}let e=t.slice(a);return s.push(e.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),s.join("").trim()}function Mt(t){let s=0;for(let a=0;a<t.length;a++){let n=t.charCodeAt(a);s=(s<<5)-s+n,s=s&s}return`"${Math.abs(s).toString(36)}"`}function Ut(t,s,a,n){if(a?.sitemap===!1)return!0;if(/<meta[^>]+name=["']robots["'][^>]+content=["'][^"']*noindex/i.test(s))return!0;return n.some((c)=>{if(c instanceof RegExp)return c.test(t);return c.endsWith("/")?t===c.slice(0,-1)||t.startsWith(c):t===c})}function _t(t,s){return`<?xml version="1.0" encoding="UTF-8"?>
15
15
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
16
- ${q.map((Q)=>{let K=new URL(Q.loc,Z).href,J=` <url>
17
- <loc>${w(K)}</loc>`;if(Q.lastmod)J+=`
18
- <lastmod>${Q.lastmod}</lastmod>`;if(Q.changefreq)J+=`
19
- <changefreq>${Q.changefreq}</changefreq>`;if(Q.priority!==void 0)J+=`
20
- <priority>${Q.priority}</priority>`;return J+=`
21
- </url>`,J}).join(`
16
+ ${t.map((n)=>{let c=new URL(n.loc,s).href,e=` <url>
17
+ <loc>${I(c)}</loc>`;if(n.lastmod)e+=`
18
+ <lastmod>${n.lastmod}</lastmod>`;if(n.changefreq)e+=`
19
+ <changefreq>${n.changefreq}</changefreq>`;if(n.priority!==void 0)e+=`
20
+ <priority>${n.priority}</priority>`;return e+=`
21
+ </url>`,e}).join(`
22
22
  `)}
23
- </urlset>`}function w(q){return q.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function aq(q,Z){let $=Z.map((Q)=>{let K=" <item>";if(K+=`
24
- <title>${w(Q.title)}</title>`,K+=`
25
- <link>${w(Q.link)}</link>`,Q.description)K+=`
26
- <description>${w(Q.description)}</description>`;if(Q.pubDate)K+=`
27
- <pubDate>${Q.pubDate.toUTCString()}</pubDate>`;if(Q.author)K+=`
28
- <author>${w(Q.author)}</author>`;if(Q.categories)for(let J of Q.categories)K+=`
29
- <category>${w(J)}</category>`;if(Q.guid)K+=`
30
- <guid>${w(Q.guid)}</guid>`;return K+=`
31
- </item>`,K});return`<?xml version="1.0" encoding="UTF-8"?>
23
+ </urlset>`}function I(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function Gt(t,s){let a=s.map((n)=>{let c=" <item>";if(c+=`
24
+ <title>${I(n.title)}</title>`,c+=`
25
+ <link>${I(n.link)}</link>`,n.description)c+=`
26
+ <description>${I(n.description)}</description>`;if(n.pubDate)c+=`
27
+ <pubDate>${n.pubDate.toUTCString()}</pubDate>`;if(n.author)c+=`
28
+ <author>${I(n.author)}</author>`;if(n.categories)for(let e of n.categories)c+=`
29
+ <category>${I(e)}</category>`;if(n.guid)c+=`
30
+ <guid>${I(n.guid)}</guid>`;return c+=`
31
+ </item>`,c});return`<?xml version="1.0" encoding="UTF-8"?>
32
32
  <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
33
33
  <channel>
34
- <title>${w(q.title)}</title>
35
- <link>${w(q.link)}</link>
36
- <description>${w(q.description)}</description>
37
- ${q.language?`<language>${q.language}</language>`:""}
38
- ${q.copyright?`<copyright>${w(q.copyright)}</copyright>`:""}
34
+ <title>${I(t.title)}</title>
35
+ <link>${I(t.link)}</link>
36
+ <description>${I(t.description)}</description>
37
+ ${t.language?`<language>${t.language}</language>`:""}
38
+ ${t.copyright?`<copyright>${I(t.copyright)}</copyright>`:""}
39
39
  <lastBuildDate>${new Date().toUTCString()}</lastBuildDate>
40
- <atom:link href="${q.link}/rss.xml" rel="self" type="application/rss+xml"/>
41
- ${$.join(`
40
+ <atom:link href="${t.link}/rss.xml" rel="self" type="application/rss+xml"/>
41
+ ${a.join(`
42
42
  `)}
43
43
  </channel>
44
- </rss>`}async function rq(q={}){let Z=Date.now();Aq();let $=await n(process.cwd()),Q=$.build||{},K=await Kq({explicit:q.domain||Q.domain,stxConfig:$});if(K.source==="fallback"&&(q.sitemap??Q.sitemap??!0))console.warn(Wq());let J={router:q.router??$?.router??{},pagesDir:q.pagesDir||Q.pagesDir||"pages",outputDir:q.outputDir||Q.outputDir||"dist",baseUrl:q.baseUrl||Q.baseUrl||"/",domain:K.url,revalidate:q.revalidate??Q.revalidate??!1,sitemap:q.sitemap??Q.sitemap??!0,sitemapExclude:q.sitemapExclude||Q.sitemapExclude||[],robots:q.robots??Q.robots??!0,rss:q.rss??Q.rss??!1,concurrency:q.concurrency||Q.concurrency||10,cache:q.cache??Q.cache??!0,cacheDir:q.cacheDir||Q.cacheDir||d(process.cwd(),"ssg-cache"),contentLoaders:q.contentLoaders||[],hooks:q.hooks||{},minify:q.minify??Q.minify??!0,generate404:q.generate404??Q.generate404??!0,publicDir:q.publicDir||Q.publicDir||"public",trailingSlash:q.trailingSlash??Q.trailingSlash??!1,cleanOutput:q.cleanOutput??Q.cleanOutput??!0,cacheSalt:q.cacheSalt??"",partialsDir:q.partialsDir||$?.partialsDir||"",componentsDir:q.componentsDir||$?.componentsDir||"",failOnIncludeError:q.failOnIncludeError??!0,failOnServerScriptError:q.failOnServerScriptError??!0,chunkIslands:q.chunkIslands===!0,prefetchIslands:q.prefetchIslands===!0,integrityIslands:q.integrityIslands===!0},W={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},_=new Set,z=0,L={},A={};await J.hooks.onBuildStart?.();try{if(J.cleanOutput&&X.existsSync(J.outputDir))await X.promises.rm(J.outputDir,{recursive:!0});await X.promises.mkdir(J.outputDir,{recursive:!0});let U=J.cacheSalt;if(!U){let{resolveUserCssConfig:Y,fingerprintConfig:N}=await import("./chunk-s6g8wksg.js");try{U=N(await Y(process.cwd()))}catch{}}let{prepareImageDelivery:G}=await import("./chunk-mgrckqww.js"),H=await G(J.publicDir,J.outputDir);if(H.count>0)console.log(`Optimized ${H.count} image(s) for responsive delivery`),U=[U,H.fingerprint].filter(Boolean).join(":");let F=new Fq(J.cacheDir,U);if(J.cache)await F.load();try{let{generateCss:Y}=await import("./chunk-s6g8wksg.js");await Y('<div class="bg-black"></div>')}catch{}Yq();let kq=$?.routeMiddleware?.dir||"middleware";await jq(process.cwd(),kq);let p=Vq();if(p.length>0)console.log(`Loaded ${p.length} middleware: ${p.join(", ")}`);let bq=$?.routeMiddleware?.global||[];wq($?.layoutsDir,d(process.cwd()));let i=l(".",{pagesDir:J.pagesDir,pagesDirs:$?._layerPageDirs});console.log(`Found ${i.length} routes`);let g=[];for(let Y of i){let N=await uq(Y);for(let O of N)g.push({route:Y,url:O.url,params:O.params,props:O.props,revalidate:O.revalidate??J.revalidate})}W.totalPages=g.length,console.log(`Generating ${W.totalPages} pages...`);let S=[],s=[];for(let Y=0;Y<g.length;Y+=J.concurrency)s.push(g.slice(Y,Y+J.concurrency));for(let Y of s)await Promise.all(Y.map(async(N)=>{let{route:O,url:V,params:v,props:Sq,revalidate:r}=N;try{await J.hooks.onPageStart?.(V);let R=await Bun.file(O.filePath).text(),M=JJ(R),vq=M?.middleware?Array.isArray(M.middleware)?M.middleware:[M.middleware]:[],t=[...bq,...vq];if(t.length>0){let T=Gq(V,v,M||{}),k=Lq(T,null,void 0,{isServer:!0}),D=await Nq(t,k);if(D.redirect){let I=typeof D.redirect==="string"?D.redirect:D.redirect.path||D.redirect,y=QJ(String(I),V),b=ZJ(V,J);await X.promises.mkdir(j.dirname(b),{recursive:!0}),await Bun.write(b,y),W.successCount++,W.pages.push({route:V,outputPath:b,size:Buffer.byteLength(y),cached:!1}),S.push({loc:V,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${V} \u2192 redirect to ${I}`);return}if(D.abort){let I=typeof D.abort==="string"?D.abort:D.abort?.error?.message||"aborted";console.warn(` \u21B3 ${V} \u2014 middleware aborted: ${I}`);return}}let e=R.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(e)try{if(!await Function("route",`
45
- const validate = ${e[1]};
44
+ </rss>`}async function Nt(t={}){let s=Date.now();gt();let a=await i(process.cwd()),n=a.build||{},c=await ht({explicit:t.domain||n.domain,stxConfig:a});if(c.source==="fallback"&&(t.sitemap??n.sitemap??!0))console.warn(mt());let e={router:t.router??a?.router??{},pagesDir:t.pagesDir||n.pagesDir||"pages",outputDir:t.outputDir||n.outputDir||"dist",baseUrl:t.baseUrl||n.baseUrl||"/",domain:c.url,revalidate:t.revalidate??n.revalidate??!1,sitemap:t.sitemap??n.sitemap??!0,sitemapExclude:t.sitemapExclude||n.sitemapExclude||[],robots:t.robots??n.robots??!0,rss:t.rss??n.rss??!1,concurrency:t.concurrency||n.concurrency||10,cache:t.cache??n.cache??!0,cacheDir:t.cacheDir||n.cacheDir||o(process.cwd(),"ssg-cache"),contentLoaders:t.contentLoaders||[],hooks:t.hooks||{},minify:t.minify??n.minify??!0,generate404:t.generate404??n.generate404??!0,publicDir:t.publicDir||n.publicDir||"public",trailingSlash:t.trailingSlash??n.trailingSlash??!1,cleanOutput:t.cleanOutput??n.cleanOutput??!0,cacheSalt:t.cacheSalt??"",partialsDir:t.partialsDir||a?.partialsDir||"",componentsDir:t.componentsDir||a?.componentsDir||"",failOnIncludeError:t.failOnIncludeError??!0,failOnServerScriptError:t.failOnServerScriptError??!0,chunkIslands:t.chunkIslands===!0,prefetchIslands:t.prefetchIslands===!0,integrityIslands:t.integrityIslands===!0},l={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},w=new Set,y=0,h={},S={};await e.hooks.onBuildStart?.();try{if(e.cleanOutput&&x.existsSync(e.outputDir))await x.promises.rm(e.outputDir,{recursive:!0});await x.promises.mkdir(e.outputDir,{recursive:!0});let D=e.cacheSalt;if(!D){let{resolveUserCssConfig:u,fingerprintConfig:m}=await import("./chunk-1chw8xsw.js");try{D=m(await u(process.cwd()))}catch{}}let{prepareImageDelivery:p}=await import("./chunk-2mkcjw08.js"),b=await p(e.publicDir,e.outputDir);if(b.count>0)console.log(`Optimized ${b.count} image(s) for responsive delivery`),D=[D,b.fingerprint].filter(Boolean).join(":");let B=new wt(e.cacheDir,D);if(e.cache)await B.load();try{let{generateCss:u}=await import("./chunk-1chw8xsw.js");await u('<div class="bg-black"></div>')}catch{}Qe();let xt=a?.routeMiddleware?.dir||"middleware";await tt(process.cwd(),xt);let H=et();if(H.length>0)console.log(`Loaded ${H.length} middleware: ${H.join(", ")}`);let vt=a?.routeMiddleware?.global||[];_i(a?.layoutsDir,o(process.cwd()));let V=M(".",{pagesDir:e.pagesDir,pagesDirs:a?._layerPageDirs});console.log(`Found ${V.length} routes`);let G=[];for(let u of V){let m=await Ft(u);for(let v of m)G.push({route:u,url:v.url,params:v.params,props:v.props,revalidate:v.revalidate??e.revalidate})}l.totalPages=G.length,console.log(`Generating ${l.totalPages} pages...`);let A=[],K=[];for(let u=0;u<G.length;u+=e.concurrency)K.push(G.slice(u,u+e.concurrency));for(let u of K)await Promise.all(u.map(async(m)=>{let{route:v,url:d,params:L,props:bt,revalidate:Q}=m;try{await e.hooks.onPageStart?.(d);let j=await Bun.file(v.filePath).text(),F=qt(j),Pt=F?.middleware?Array.isArray(F.middleware)?F.middleware:[F.middleware]:[],it=[...vt,...Pt];if(it.length>0){let C=nt(d,L,F||{}),O=rt(C,null,void 0,{isServer:!0}),E=await st(it,O);if(E.redirect){let R=typeof E.redirect==="string"?E.redirect:E.redirect.path||E.redirect,_=Jt(String(R),d),T=Vt(d,e);await x.promises.mkdir(g.dirname(T),{recursive:!0}),await Bun.write(T,_),l.successCount++,l.pages.push({route:d,outputPath:T,size:Buffer.byteLength(_),cached:!1}),A.push({loc:d,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${d} \u2192 redirect to ${R}`);return}if(E.abort){let R=typeof E.abort==="string"?E.abort:E.abort?.error?.message||"aborted";console.warn(` \u21B3 ${d} \u2014 middleware aborted: ${R}`);return}}let at=j.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(at)try{if(!await Function("route",`
45
+ const validate = ${at[1]};
46
46
  return validate(route);
47
- `)({params:v})){console.warn(`Validation failed for ${V}, skipping...`);return}}catch{}let E=null,qq=!1;if(J.cache){if(E=F.get(V,O.filePath),E)qq=!0,W.cachedCount++}if(!E){let T=await Mq(O,v,Sq,J,$);if(E=T.html,J.failOnIncludeError&&T.includeFailures.length>0)throw Error(`${T.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
48
- ${T.includeFailures.join(`
47
+ `)({params:L})){console.warn(`Validation failed for ${d}, skipping...`);return}}catch{}let k=null,ot=!1;if(e.cache){if(k=B.get(d,v.filePath),k)ot=!0,l.cachedCount++}if(!k){let C=await St(v,L,bt,e,a);if(k=C.html,e.failOnIncludeError&&C.includeFailures.length>0)throw Error(`${C.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
48
+ ${C.includeFailures.join(`
49
49
  `)}
50
- Set ssg.failOnIncludeError to false to build anyway.`);if(J.failOnServerScriptError&&T.serverScriptFailures.length>0)throw Error(`${T.serverScriptFailures.length} <script server> block(s) failed, so this page would have shipped with the content they produce missing:
51
- ${T.serverScriptFailures.join(`
50
+ Set ssg.failOnIncludeError to false to build anyway.`);if(e.failOnServerScriptError&&C.serverScriptFailures.length>0)throw Error(`${C.serverScriptFailures.length} <script server> block(s) failed, so this page would have shipped with the content they produce missing:
51
+ ${C.serverScriptFailures.join(`
52
52
  `)}
53
- Set ssg.failOnServerScriptError to false to build anyway.`);if(J.cache)F.set(V,O.filePath,T.dependencies,E)}let x;if(J.trailingSlash)x=j.join(J.outputDir,V,"index.html");else x=V==="/"?j.join(J.outputDir,"index.html"):j.join(J.outputDir,`${V}.html`);if(J.chunkIslands){let{html:T,chunks:k}=Qq(E,{integrity:J.integrityIslands,minify:J.minify});if(k.length>0){let D=j.join(J.outputDir,"_stx","islands");await X.promises.mkdir(D,{recursive:!0});for(let I of k){let y=j.join(D,`${I.hash}.js`);if(!await Bun.file(y).exists())await Bun.write(y,I.code);if(!_.has(I.hash)){_.add(I.hash);let b=Buffer.byteLength(I.code,"utf8");z+=b,L[I.hash]={bytes:b,file:`/_stx/islands/${I.hash}.js`}}}if(A[V]=k.map((I)=>I.hash),E=T,J.prefetchIslands)E=Zq(E)}}if(await X.promises.mkdir(j.dirname(x),{recursive:!0}),await Bun.write(x,E),!sq(V,E,M,J.sitemapExclude))S.push({loc:V,lastmod:new Date().toISOString().split("T")[0],priority:V==="/"?1:0.8});let Jq={route:V,outputPath:x,size:Buffer.byteLength(E,"utf8"),cached:qq};if(r!==!1)Jq.revalidateAt=Date.now()+r*1000;W.pages.push(Jq),W.successCount++,await J.hooks.onPageEnd?.(V,E)}catch(R){W.failedCount++,W.errors.push({route:V,error:R}),await J.hooks.onError?.(R,V),console.error(`Error generating ${V}:`,R)}}));let o=zq();if(o.length>0){let Y=o.map((N)=>`${N.filePath}: ${N.message}`).join(`
53
+ Set ssg.failOnServerScriptError to false to build anyway.`);if(e.cache)B.set(d,v.filePath,C.dependencies,k)}let U;if(e.trailingSlash)U=g.join(e.outputDir,d,"index.html");else U=d==="/"?g.join(e.outputDir,"index.html"):g.join(e.outputDir,`${d}.html`);if(e.chunkIslands){let{html:C,chunks:O}=lt(k,{integrity:e.integrityIslands,minify:e.minify});if(O.length>0){let E=g.join(e.outputDir,"_stx","islands");await x.promises.mkdir(E,{recursive:!0});for(let R of O){let _=g.join(E,`${R.hash}.js`);if(!await Bun.file(_).exists())await Bun.write(_,R.code);if(!w.has(R.hash)){w.add(R.hash);let T=Buffer.byteLength(R.code,"utf8");y+=T,h[R.hash]={bytes:T,file:`/_stx/islands/${R.hash}.js`}}}if(S[d]=O.map((R)=>R.hash),k=C,e.prefetchIslands)k=ut(k)}}if(await x.promises.mkdir(g.dirname(U),{recursive:!0}),await Bun.write(U,k),!Ut(d,k,F,e.sitemapExclude))A.push({loc:d,lastmod:new Date().toISOString().split("T")[0],priority:d==="/"?1:0.8});let ct={route:d,outputPath:U,size:Buffer.byteLength(k,"utf8"),cached:ot};if(Q!==!1)ct.revalidateAt=Date.now()+Q*1000;l.pages.push(ct),l.successCount++,await e.hooks.onPageEnd?.(d,k)}catch(j){l.failedCount++,l.errors.push({route:d,error:j}),await e.hooks.onError?.(j,d),console.error(`Error generating ${d}:`,j)}}));let Y=ft();if(Y.length>0){let u=Y.map((m)=>`${m.filePath}: ${m.message}`).join(`
54
54
  `);throw Error(`Client script bundling failed:
55
- ${Y}`)}if(J.cache)await F.save();if(J.generate404){let Y=j.join(J.pagesDir,"404.stx");if(await Bun.file(Y).exists()){let N=new Set,O={...$,debug:!1,cache:!1},V=await C(await Bun.file(Y).text(),{},Y,O,N);await Bun.write(j.join(J.outputDir,"404.html"),V)}else await Bun.write(j.join(J.outputDir,"404.html"),`<!DOCTYPE html>
55
+ ${u}`)}if(e.cache)await B.save();if(e.generate404){let u=g.join(e.pagesDir,"404.stx");if(await Bun.file(u).exists()){let m=new Set,v={...a,debug:!1,cache:!1},d=await r(await Bun.file(u).text(),{},u,v,m);await Bun.write(g.join(e.outputDir,"404.html"),d)}else await Bun.write(g.join(e.outputDir,"404.html"),`<!DOCTYPE html>
56
56
  <html lang="en">
57
57
  <head>
58
58
  <meta charset="UTF-8">
@@ -73,25 +73,25 @@ ${Y}`)}if(J.cache)await F.save();if(J.generate404){let Y=j.join(J.pagesDir,"404.
73
73
  <a href="/">Go home</a>
74
74
  </div>
75
75
  </body>
76
- </html>`)}for(let Y of[500]){let N=j.join(J.pagesDir,`${Y}.stx`);if(await Bun.file(N).exists()){let O=new Set,V={...$,debug:!1,cache:!1},v=await C(await Bun.file(N).text(),{},N,V,O);await Bun.write(j.join(J.outputDir,`${Y}.html`),v)}}let u=j.join(J.pagesDir,"error.stx");if(await Bun.file(u).exists()){let Y=new Set,N={...$,debug:!1,cache:!1},O=await C(await Bun.file(u).text(),{},u,N,Y);await Bun.write(j.join(J.outputDir,"error.html"),O)}if(J.sitemap&&S.length>0){let Y=oq(S,J.domain),N=j.join(J.outputDir,"sitemap.xml");await Bun.write(N,Y),W.sitemapPath=N,console.log(`Generated sitemap.xml with ${S.length} URLs`)}if(J.robots!==!1){let Y=typeof J.robots==="object"?J.robots:{},N=[...J.sitemapExclude.filter((V)=>typeof V==="string"),...Y.disallow||[]],O=Bq({rules:[{userAgent:Y.userAgent||"*",allow:Y.allow||["/"],...N.length>0?{disallow:N}:{}}],...Y.sitemap!==!1&&W.sitemapPath?{sitemap:new URL("/sitemap.xml",J.domain).href}:{}});await Bun.write(j.join(J.outputDir,"robots.txt"),O),console.log("Generated robots.txt")}if(J.rss){let Y=typeof J.rss==="object"?J.rss:{title:"Site Feed",description:"Latest updates",link:J.domain},N=[];if(Y.getItems)N=await Y.getItems();let O=aq(Y,N),V=j.join(J.outputDir,"rss.xml");await Bun.write(V,O),W.rssPath=V,console.log(`Generated rss.xml with ${N.length} items`)}let f=Uq(J.outputDir);if(f.assets>0)console.log(`Externalized ${f.assets} asset(s) from ${f.pages} page(s) (${(f.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);let m=Iq(J.outputDir);if(m.assets>0)console.log(`Externalized ${m.assets} repeated asset(s) from ${m.pages} page(s) (${(m.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);if(J.publicDir&&X.existsSync(J.publicDir))await c(J.publicDir,J.outputDir),console.log(`Copied public assets from ${J.publicDir}`);let a=Dq();if(a)await c(a,j.join(J.outputDir,Tq)),console.log(`Copied assets from ${Eq}`)}catch(U){throw await J.hooks.onError?.(U),U}if(W.buildTime=Date.now()-Z,_.size>0){W.islandChunks={count:_.size,totalBytes:z};let U={generatedChunks:_.size,totalBytes:z,chunks:L,pages:A};await Bun.write(j.join(J.outputDir,"_stx","islands-manifest.json"),JSON.stringify(U,null,2))}await J.hooks.onBuildEnd?.(W);let B=W.islandChunks?`
77
- Island chunks: ${W.islandChunks.count} (${(W.islandChunks.totalBytes/1024).toFixed(1)} KB lifted out of inline HTML)`:"";return console.log(`
76
+ </html>`)}for(let u of[500]){let m=g.join(e.pagesDir,`${u}.stx`);if(await Bun.file(m).exists()){let v=new Set,d={...a,debug:!1,cache:!1},L=await r(await Bun.file(m).text(),{},m,d,v);await Bun.write(g.join(e.outputDir,`${u}.html`),L)}}let W=g.join(e.pagesDir,"error.stx");if(await Bun.file(W).exists()){let u=new Set,m={...a,debug:!1,cache:!1},v=await r(await Bun.file(W).text(),{},W,m,u);await Bun.write(g.join(e.outputDir,"error.html"),v)}if(e.sitemap&&A.length>0){let u=_t(A,e.domain),m=g.join(e.outputDir,"sitemap.xml");await Bun.write(m,u),l.sitemapPath=m,console.log(`Generated sitemap.xml with ${A.length} URLs`)}if(e.robots!==!1){let u=typeof e.robots==="object"?e.robots:{},m=[...e.sitemapExclude.filter((d)=>typeof d==="string"),...u.disallow||[]],v=nr({rules:[{userAgent:u.userAgent||"*",allow:u.allow||["/"],...m.length>0?{disallow:m}:{}}],...u.sitemap!==!1&&l.sitemapPath?{sitemap:new URL("/sitemap.xml",e.domain).href}:{}});await Bun.write(g.join(e.outputDir,"robots.txt"),v),console.log("Generated robots.txt")}if(e.rss){let u=typeof e.rss==="object"?e.rss:{title:"Site Feed",description:"Latest updates",link:e.domain},m=[];if(u.getItems)m=await u.getItems();let v=Gt(u,m),d=g.join(e.outputDir,"rss.xml");await Bun.write(d,v),l.rssPath=d,console.log(`Generated rss.xml with ${m.length} items`)}let N=Ei(e.outputDir);if(N.assets>0)console.log(`Externalized ${N.assets} asset(s) from ${N.pages} page(s) (${(N.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);let z=Ti(e.outputDir);if(z.assets>0)console.log(`Externalized ${z.assets} repeated asset(s) from ${z.pages} page(s) (${(z.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);if(e.publicDir&&x.existsSync(e.publicDir))await J(e.publicDir,e.outputDir),console.log(`Copied public assets from ${e.publicDir}`);let Z=tn();if(Z)await J(Z,g.join(e.outputDir,en)),console.log(`Copied assets from ${dt}`)}catch(D){throw await e.hooks.onError?.(D),D}if(l.buildTime=Date.now()-s,w.size>0){l.islandChunks={count:w.size,totalBytes:y};let D={generatedChunks:w.size,totalBytes:y,chunks:h,pages:S};await Bun.write(g.join(e.outputDir,"_stx","islands-manifest.json"),JSON.stringify(D,null,2))}await e.hooks.onBuildEnd?.(l);let P=l.islandChunks?`
77
+ Island chunks: ${l.islandChunks.count} (${(l.islandChunks.totalBytes/1024).toFixed(1)} KB lifted out of inline HTML)`:"";return console.log(`
78
78
  Build complete!
79
- Total: ${W.totalPages} pages
80
- Success: ${W.successCount}
81
- Cached: ${W.cachedCount}
82
- Failed: ${W.failedCount}
83
- Time: ${W.buildTime}ms${B}
84
- `),W}async function c(q,Z){await X.promises.mkdir(Z,{recursive:!0});let $=await X.promises.readdir(q,{withFileTypes:!0});for(let Q of $){let K=j.join(q,Q.name),J=j.join(Z,Q.name);if(Q.isDirectory())await X.promises.mkdir(J,{recursive:!0}),await c(K,J);else await X.promises.copyFile(K,J)}}function tq(q={}){let Z=q.cacheDir||d(process.cwd(),"ssg-cache"),$=new Rq(Z),Q=q.revalidate||3600;return{async get(K){let J=await $.get(K);if(!J)return null;if(Date.now()>J.revalidateAfter)this.revalidate(K).catch(console.error);return{html:J.html,headers:{"Cache-Control":`public, max-age=${Q}, stale-while-revalidate=${Q*2}`,ETag:J.etag,"X-ISR-Generated":new Date(J.generatedAt).toISOString(),...J.headers}}},async revalidate(K){let W=l(".",{pagesDir:q.pagesDir||"pages"}).find((B)=>{return K.match(B.regex)!==null});if(!W){console.warn(`Route not found for revalidation: ${K}`);return}let _=K.match(W.regex),z={};if(_)W.params.forEach((B,U)=>{z[B]=_[U+1]});let L=await n(),{html:A}=await Mq(W,z,{},q,L);await $.set(K,{html:A,generatedAt:Date.now(),revalidateAfter:Date.now()+Q*1000,etag:iq(A)}),console.log(`Revalidated: ${K}`)},async invalidate(K){if(typeof K==="string")await $.invalidate(K);else await $.invalidatePattern(K)}}}function eq(q){return async()=>{return{paths:await q(),fallback:!1}}}function qJ(){return{name:"markdown",extensions:[".md",".mdx"],async load(q){let Z=await Bun.file(q).text(),$=Z.match(/^---\n([\s\S]*?)\n---/),Q={},K=Z;if($){let L=$[1];K=Z.slice($[0].length).trim();for(let A of L.split(`
85
- `)){let B=A.indexOf(":");if(B>0){let U=A.slice(0,B).trim(),G=A.slice(B+1).trim();if(G==="true")G=!0;else if(G==="false")G=!1;else if(/^\d+$/.test(G))G=parseInt(G,10);else if(/^\d+\.\d+$/.test(G))G=parseFloat(G);else if(G.startsWith("[")&&G.endsWith("]"))G=G.slice(1,-1).split(",").map((H)=>H.trim().replace(/^['"]|['"]$/g,""));Q[U]=G}}}let J=K.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/`([^`]+)`/gim,"<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/gim,'<a href="$2">$1</a>').replace(/\n/gim,"<br>"),W=[],_=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,z;while((z=_.exec(J))!==null){let L=parseInt(z[1],10),A=z[2],B=A.toLowerCase().replace(/[^a-z0-9]+/g,"-");W.push({id:B,text:A,level:L})}return{content:J,data:Q,toc:W}}}}function JJ(q){return Oq(q)}function QJ(q,Z){return`<!DOCTYPE html>
79
+ Total: ${l.totalPages} pages
80
+ Success: ${l.successCount}
81
+ Cached: ${l.cachedCount}
82
+ Failed: ${l.failedCount}
83
+ Time: ${l.buildTime}ms${P}
84
+ `),l}async function J(t,s){await x.promises.mkdir(s,{recursive:!0});let a=await x.promises.readdir(t,{withFileTypes:!0});for(let n of a){let c=g.join(t,n.name),e=g.join(s,n.name);if(n.isDirectory())await x.promises.mkdir(e,{recursive:!0}),await J(c,e);else await x.promises.copyFile(c,e)}}function zt(t={}){let s=t.cacheDir||o(process.cwd(),"ssg-cache"),a=new yt(s),n=t.revalidate||3600;return{async get(c){let e=await a.get(c);if(!e)return null;if(Date.now()>e.revalidateAfter)this.revalidate(c).catch(console.error);return{html:e.html,headers:{"Cache-Control":`public, max-age=${n}, stale-while-revalidate=${n*2}`,ETag:e.etag,"X-ISR-Generated":new Date(e.generatedAt).toISOString(),...e.headers}}},async revalidate(c){let l=M(".",{pagesDir:t.pagesDir||"pages"}).find((P)=>c.match(P.regex)!==null);if(!l){console.warn(`Route not found for revalidation: ${c}`);return}let w=c.match(l.regex),y={};if(w)l.params.forEach((P,D)=>{y[P]=w[D+1]});let h=await i(),{html:S}=await St(l,y,{},t,h);await a.set(c,{html:S,generatedAt:Date.now(),revalidateAfter:Date.now()+n*1000,etag:Mt(S)}),console.log(`Revalidated: ${c}`)},async invalidate(c){if(typeof c==="string")await a.invalidate(c);else await a.invalidatePattern(c)}}}function Ht(t){return async()=>({paths:await t(),fallback:!1})}function Wt(){return{name:"markdown",extensions:[".md",".mdx"],async load(t){let s=await Bun.file(t).text(),a=s.match(/^---\n([\s\S]*?)\n---/),n={},c=s;if(a){let h=a[1];c=s.slice(a[0].length).trim();for(let S of h.split(`
85
+ `)){let P=S.indexOf(":");if(P>0){let D=S.slice(0,P).trim(),p=S.slice(P+1).trim();if(p==="true")p=!0;else if(p==="false")p=!1;else if(/^\d+$/.test(p))p=parseInt(p,10);else if(/^\d+\.\d+$/.test(p))p=parseFloat(p);else if(p.startsWith("[")&&p.endsWith("]"))p=p.slice(1,-1).split(",").map((b)=>b.trim().replace(/^['"]|['"]$/g,""));n[D]=p}}}let e=c.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/`([^`]+)`/gim,"<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/gim,'<a href="$2">$1</a>').replace(/\n/gim,"<br>"),l=[],w=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,y;while((y=w.exec(e))!==null){let h=parseInt(y[1],10),S=y[2],P=S.toLowerCase().replace(/[^a-z0-9]+/g,"-");l.push({id:P,text:S,level:h})}return{content:e,data:n,toc:l}}}}function qt(t){return je(t)}function Jt(t,s){return`<!DOCTYPE html>
86
86
  <html>
87
87
  <head>
88
88
  <meta charset="utf-8">
89
- <meta http-equiv="refresh" content="0; url=${q}">
90
- <link rel="canonical" href="${q}">
89
+ <meta http-equiv="refresh" content="0; url=${t}">
90
+ <link rel="canonical" href="${t}">
91
91
  <title>Redirecting...</title>
92
92
  </head>
93
93
  <body>
94
- <p>Redirecting to <a href="${q}">${q}</a>...</p>
95
- <script>window.location.replace('${q}')</script>
94
+ <p>Redirecting to <a href="${t}">${t}</a>...</p>
95
+ <script>window.location.replace('${t}')</script>
96
96
  </body>
97
- </html>`}function ZJ(q,Z){if(q==="/"||q==="")return j.join(Z.outputDir,"index.html");let $=q.replace(/^\/|\/$/g,"");if(Z.trailingSlash)return j.join(Z.outputDir,$,"index.html");return j.join(Z.outputDir,`${$}.html`)}var wJ={generateStaticSite:rq,createISRHandler:tq,defineStaticPaths:eq,createMarkdownLoader:qJ};export{sq as isExcludedFromSitemap,rq as generateStaticSite,eq as defineStaticPaths,wJ as default,lq as declaresPageAction,qJ as createMarkdownLoader,tq as createISRHandler};
97
+ </html>`}function Vt(t,s){if(t==="/"||t==="")return g.join(s.outputDir,"index.html");let a=t.replace(/^\/|\/$/g,"");if(s.trailingSlash)return g.join(s.outputDir,a,"index.html");return g.join(s.outputDir,`${a}.html`)}var we={generateStaticSite:Nt,createISRHandler:zt,defineStaticPaths:Ht,createMarkdownLoader:Wt};export{zt as createISRHandler,Wt as createMarkdownLoader,At as declaresPageAction,we as default,Ht as defineStaticPaths,Nt as generateStaticSite,Ut as isExcludedFromSitemap};