@stacksjs/stx 0.2.859 → 0.2.862

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 (288) hide show
  1. package/dist/analytics.js +3 -2
  2. package/dist/animation.js +3 -3
  3. package/dist/app-shell.js +4 -3
  4. package/dist/{chunk-14cvwsy1.js → chunk-01c16zw4.js} +2 -2
  5. package/dist/chunk-0bfgsv31.js +2 -0
  6. package/dist/chunk-0c9c9v03.js +14 -0
  7. package/dist/{chunk-wjamjgx6.js → chunk-0fh47gp0.js} +2 -2
  8. package/dist/chunk-0fpx3ctt.js +2 -0
  9. package/dist/chunk-0twkeh31.js +2 -0
  10. package/dist/chunk-0xtda6aw.js +2 -0
  11. package/dist/chunk-12sv6b9c.js +2 -0
  12. package/dist/chunk-194t5qat.js +2 -0
  13. package/dist/chunk-1crn4fv0.js +2 -0
  14. package/dist/chunk-1d3swbqw.js +2 -0
  15. package/dist/{chunk-4yfbd8ny.js → chunk-1mqcttg3.js} +6 -6
  16. package/dist/chunk-1qf07v41.js +2 -0
  17. package/dist/chunk-24hq8mka.js +3 -0
  18. package/dist/chunk-2asyyky3.js +2 -0
  19. package/dist/chunk-2dpessnc.js +54 -0
  20. package/dist/{chunk-ews9yzr7.js → chunk-2jgtfjyr.js} +5 -5
  21. package/dist/chunk-2kfayg4t.js +712 -0
  22. package/dist/chunk-2rff5mbj.js +4 -0
  23. package/dist/chunk-2s7rmn9r.js +3 -0
  24. package/dist/{chunk-v9h7s8ce.js → chunk-2srjavsn.js} +2 -2
  25. package/dist/chunk-2zqh7xct.js +2 -0
  26. package/dist/chunk-321fbxnm.js +1327 -0
  27. package/dist/chunk-3gk1e2b1.js +2 -0
  28. package/dist/chunk-3ryp43f3.js +2 -0
  29. package/dist/{chunk-12r22pf0.js → chunk-3z1mmar2.js} +2 -2
  30. package/dist/{chunk-zhxdpzga.js → chunk-46ddesnf.js} +3 -3
  31. package/dist/chunk-46pxmpeb.js +3 -0
  32. package/dist/chunk-4pr29yrx.js +2 -0
  33. package/dist/{chunk-wfd9e224.js → chunk-4xanjv22.js} +125 -126
  34. package/dist/chunk-4ykgjewy.js +16 -0
  35. package/dist/{chunk-ftwdjgzd.js → chunk-55zq2ha8.js} +5 -5
  36. package/dist/{chunk-9a3rv0rj.js → chunk-5a0d3048.js} +3 -3
  37. package/dist/chunk-5ertqfs3.js +2 -0
  38. package/dist/chunk-627hzzs3.js +2 -0
  39. package/dist/chunk-64ebysb4.js +2 -0
  40. package/dist/{chunk-k8pzk8v9.js → chunk-669b2bya.js} +4 -4
  41. package/dist/{chunk-ktnb1j54.js → chunk-67dgp45w.js} +2 -2
  42. package/dist/chunk-6fstz73t.js +2 -0
  43. package/dist/{chunk-gndxakrh.js → chunk-6ftee542.js} +2 -2
  44. package/dist/{chunk-5wr1qqz3.js → chunk-6k4ac74t.js} +2 -2
  45. package/dist/{chunk-astcp7bc.js → chunk-6m63rc7m.js} +8 -8
  46. package/dist/{chunk-q3cyycnh.js → chunk-6m6y9bbx.js} +1 -1
  47. package/dist/chunk-6pczzq5f.js +2 -0
  48. package/dist/{chunk-6t0xy3wk.js → chunk-7ayvybdy.js} +3 -3
  49. package/dist/chunk-7mjf144y.js +2 -0
  50. package/dist/{chunk-9qe4qsc7.js → chunk-7mpqfg98.js} +21 -21
  51. package/dist/chunk-7q5h2cve.js +2 -0
  52. package/dist/chunk-7wqevtks.js +2 -0
  53. package/dist/chunk-84ztb43k.js +2 -0
  54. package/dist/{chunk-6e44f8w8.js → chunk-8502xb4n.js} +39 -39
  55. package/dist/{chunk-ywk6t76q.js → chunk-85j9qh7v.js} +45 -46
  56. package/dist/{chunk-cxpq2zna.js → chunk-8arfg8kp.js} +3 -3
  57. package/dist/{chunk-33x46g87.js → chunk-8hhhmscy.js} +2 -2
  58. package/dist/{chunk-x9c4njvx.js → chunk-8me8hamk.js} +2 -2
  59. package/dist/{chunk-pb09xy77.js → chunk-8s6s6nd0.js} +2 -2
  60. package/dist/chunk-8v1zpdef.js +2 -0
  61. package/dist/chunk-94mpe1ny.js +3 -0
  62. package/dist/chunk-94wnfxnd.js +2 -0
  63. package/dist/chunk-9jxs8sw2.js +2 -0
  64. package/dist/{chunk-2w7csg0c.js → chunk-9y9jecky.js} +1 -1
  65. package/dist/{chunk-mzes9ds7.js → chunk-9zrvh3pz.js} +2 -2
  66. package/dist/{chunk-hf9pvmq2.js → chunk-adb045wf.js} +3 -3
  67. package/dist/{chunk-fpkp0bqf.js → chunk-adqh1gp1.js} +1 -1
  68. package/dist/chunk-az5xw3w8.js +2 -0
  69. package/dist/chunk-ba91r7q9.js +2 -0
  70. package/dist/{chunk-qkcn0exq.js → chunk-brzjass3.js} +6 -6
  71. package/dist/chunk-bv7g3b3b.js +2 -0
  72. package/dist/chunk-bwdbj60y.js +3 -0
  73. package/dist/chunk-bwz2ehq9.js +33 -0
  74. package/dist/{chunk-ts4t2n6b.js → chunk-bx5d87xx.js} +6 -7
  75. package/dist/chunk-bz6dg4k8.js +3 -0
  76. package/dist/chunk-c34qn4k8.js +16 -0
  77. package/dist/{chunk-0es47pwe.js → chunk-cqhwzd9y.js} +5 -5
  78. package/dist/chunk-cvgbtmxp.js +2 -0
  79. package/dist/chunk-czpn3n1p.js +2 -0
  80. package/dist/chunk-dhnw2qwq.js +25 -0
  81. package/dist/{chunk-3w3fxcyx.js → chunk-dpmayc2w.js} +2 -2
  82. package/dist/{chunk-6mza6zr3.js → chunk-dtarm8x9.js} +9 -9
  83. package/dist/chunk-dydy9zrq.js +3 -0
  84. package/dist/chunk-eafqxbr0.js +2 -0
  85. package/dist/{chunk-52b6czss.js → chunk-eeq8k81z.js} +155 -157
  86. package/dist/{chunk-26jt4jvh.js → chunk-ew5cey88.js} +1 -1
  87. package/dist/chunk-fa97kz5j.js +2 -0
  88. package/dist/{chunk-xppm4cs4.js → chunk-farh4p7f.js} +3 -3
  89. package/dist/{chunk-3248qphb.js → chunk-fnxg6134.js} +10 -10
  90. package/dist/chunk-g075cc67.js +2 -0
  91. package/dist/{chunk-618t6hxp.js → chunk-g5xth2yx.js} +6 -6
  92. package/dist/{chunk-xpg52hsz.js → chunk-gbtbfg7e.js} +3 -3
  93. package/dist/{chunk-xytq7q8j.js → chunk-gd56arnm.js} +2 -2
  94. package/dist/chunk-gmm3kffd.js +2 -0
  95. package/dist/{chunk-dbm963p9.js → chunk-gp8hgpt9.js} +4 -4
  96. package/dist/chunk-h2qgqjkn.js +2 -0
  97. package/dist/chunk-h65shwe9.js +2 -0
  98. package/dist/chunk-hdjn7nw9.js +20 -0
  99. package/dist/{chunk-yd6ej23e.js → chunk-hev4t4d5.js} +6 -6
  100. package/dist/chunk-hf5fj7pr.js +2 -0
  101. package/dist/{chunk-cj9rev2p.js → chunk-hmdkf6c6.js} +2 -2
  102. package/dist/chunk-hsp9h3jn.js +2 -0
  103. package/dist/{chunk-p9jfn4yh.js → chunk-j1efsjsb.js} +5 -5
  104. package/dist/chunk-j4zrq17p.js +2 -0
  105. package/dist/chunk-jx5mss16.js +2 -0
  106. package/dist/chunk-jz84z19v.js +2 -0
  107. package/dist/{chunk-5rxks14t.js → chunk-k32q90b2.js} +2 -2
  108. package/dist/{chunk-4a0x737h.js → chunk-kbdz4762.js} +8 -8
  109. package/dist/chunk-kw11yydy.js +2 -0
  110. package/dist/{chunk-v4rrgphj.js → chunk-kwk3kxrx.js} +3 -3
  111. package/dist/chunk-kyer53x3.js +2 -0
  112. package/dist/chunk-m9cperj4.js +2 -0
  113. package/dist/{chunk-fxxh149b.js → chunk-mcnwvh06.js} +6 -6
  114. package/dist/chunk-meqsd5bt.js +2 -0
  115. package/dist/{chunk-s4592dy0.js → chunk-mfa07erx.js} +16 -16
  116. package/dist/chunk-mj4wbrw7.js +2 -0
  117. package/dist/{chunk-0yw86e75.js → chunk-mjy98ppb.js} +9 -9
  118. package/dist/{chunk-jh2v1vvb.js → chunk-mrh08821.js} +3 -3
  119. package/dist/{chunk-gq9h36jf.js → chunk-n058hznh.js} +5 -5
  120. package/dist/{chunk-9n8t7v78.js → chunk-n3jw3xpj.js} +2 -2
  121. package/dist/chunk-nz9z3ct9.js +2 -0
  122. package/dist/chunk-p0tkhd12.js +2 -0
  123. package/dist/chunk-p2etn78y.js +2 -0
  124. package/dist/{chunk-1nankvf6.js → chunk-pbakxcv8.js} +2 -2
  125. package/dist/{chunk-t5q31st4.js → chunk-q1wxgw5s.js} +2 -2
  126. package/dist/chunk-qa5y30sy.js +72 -0
  127. package/dist/{chunk-m1qqqc2j.js → chunk-qbghf76y.js} +4 -4
  128. package/dist/{chunk-a9c3gndq.js → chunk-qcxrcypb.js} +2 -2
  129. package/dist/{chunk-fkh4xece.js → chunk-qjey0jk6.js} +2 -2
  130. package/dist/chunk-rqa92xm4.js +2 -0
  131. package/dist/chunk-rvhrtnv3.js +12 -0
  132. package/dist/{chunk-7m17m22p.js → chunk-s0sad753.js} +2 -2
  133. package/dist/chunk-s92j8k4z.js +2 -0
  134. package/dist/chunk-s9df8srx.js +6 -0
  135. package/dist/{chunk-rgjjt1mb.js → chunk-sb8n32rn.js} +1 -1
  136. package/dist/chunk-snz2cxqv.js +2 -0
  137. package/dist/{chunk-14h4n1sj.js → chunk-srgnevws.js} +2 -2
  138. package/dist/chunk-srgpz94e.js +42 -0
  139. package/dist/{chunk-2sq9pdg3.js → chunk-tnp2ta5q.js} +2 -2
  140. package/dist/{chunk-5t1k0dxm.js → chunk-v37zmez0.js} +2 -2
  141. package/dist/chunk-v408qsze.js +2 -0
  142. package/dist/{chunk-qgxwf9xr.js → chunk-v4xes880.js} +3 -3
  143. package/dist/chunk-vfx1p83g.js +33 -0
  144. package/dist/chunk-vk98r75z.js +2 -0
  145. package/dist/{chunk-ypgegzh2.js → chunk-vvzys1x7.js} +3 -3
  146. package/dist/{chunk-f1vvhbmw.js → chunk-w6pzkcjp.js} +2 -2
  147. package/dist/chunk-x0s68p47.js +2 -0
  148. package/dist/{chunk-g17q4y5k.js → chunk-x512h2gv.js} +4 -4
  149. package/dist/{chunk-shke1fcm.js → chunk-x7redxyd.js} +4 -4
  150. package/dist/chunk-xjxcwrqs.js +2 -0
  151. package/dist/chunk-xsq2jf96.js +2 -0
  152. package/dist/chunk-xymr4ys9.js +3 -0
  153. package/dist/{chunk-wdcz6d20.js → chunk-y3qg95wa.js} +8 -8
  154. package/dist/chunk-y7f2x57s.js +2 -0
  155. package/dist/chunk-ymdw4fhd.js +3 -0
  156. package/dist/chunk-ymjjn9pw.js +20 -0
  157. package/dist/chunk-ynkbv9jq.js +4 -0
  158. package/dist/{chunk-49j3cn9h.js → chunk-ysfeg3cn.js} +2 -2
  159. package/dist/chunk-ytzzth34.js +2 -0
  160. package/dist/chunk-yxpjj003.js +2 -0
  161. package/dist/chunk-z1rs6b4x.js +2 -0
  162. package/dist/{chunk-yehdcjn1.js → chunk-z512gt4v.js} +3 -3
  163. package/dist/chunk-z6ntmv5x.js +2 -0
  164. package/dist/{chunk-5n7m8vqx.js → chunk-zbvfjm4a.js} +2 -2
  165. package/dist/chunk-zsnmk5me.js +2 -0
  166. package/dist/cli.js +35 -35
  167. package/dist/craft-entry.js +2 -2
  168. package/dist/craft.js +2 -2
  169. package/dist/dev-server/serve-app.js +3 -2
  170. package/dist/dev-server/serve-multi.js +3 -4
  171. package/dist/dev-server/ts-css.js +4 -5
  172. package/dist/document-shell.js +4 -3
  173. package/dist/document-tags.d.ts +8 -0
  174. package/dist/document-tags.js +37 -0
  175. package/dist/events.js +2 -1
  176. package/dist/head-injection.js +2 -1
  177. package/dist/heatmap.js +2 -1
  178. package/dist/hot-reload.js +3 -1
  179. package/dist/index.d.ts +1 -0
  180. package/dist/index.js +1 -0
  181. package/dist/native-build.js +3 -3
  182. package/dist/process.js +5 -6
  183. package/dist/production-build.js +3 -3
  184. package/dist/pwa/inject.js +3 -3
  185. package/dist/pwa.js +3 -3
  186. package/dist/reactive-bindings.js +2 -1
  187. package/dist/reactive.js +2 -1
  188. package/dist/render.js +2 -6
  189. package/dist/runtime-injection.js +6 -6
  190. package/dist/serve.js +2 -6
  191. package/dist/site-builder/build.js +2 -2
  192. package/dist/site-builder/i18n.js +2 -2
  193. package/dist/site-builder/router.js +2 -5
  194. package/dist/site-builder/theme.js +2 -2
  195. package/dist/ssg.js +30 -31
  196. package/dist/template-hydrator.js +2 -1
  197. package/dist/web-components/css-scoping.js +3 -3
  198. package/dist/x-element.js +2 -1
  199. package/package.json +5 -5
  200. package/dist/chunk-13fe3avf.js +0 -2
  201. package/dist/chunk-1hebvmaj.js +0 -2
  202. package/dist/chunk-1p47cg0g.js +0 -2
  203. package/dist/chunk-1v95w26e.js +0 -20
  204. package/dist/chunk-1z46g29d.js +0 -2
  205. package/dist/chunk-228cbw2p.js +0 -2
  206. package/dist/chunk-2bggrzv0.js +0 -2
  207. package/dist/chunk-2dnd2s2a.js +0 -3
  208. package/dist/chunk-2kc0vsnb.js +0 -54
  209. package/dist/chunk-34rh88vd.js +0 -2
  210. package/dist/chunk-3cqp0m62.js +0 -2
  211. package/dist/chunk-3dtzcc9j.js +0 -2
  212. package/dist/chunk-3rgqrs3c.js +0 -2
  213. package/dist/chunk-403a4pqm.js +0 -25
  214. package/dist/chunk-51kb36f7.js +0 -2
  215. package/dist/chunk-53ezn1tw.js +0 -2
  216. package/dist/chunk-5va6c7jf.js +0 -14
  217. package/dist/chunk-636j1nmd.js +0 -2
  218. package/dist/chunk-6w5a5ns4.js +0 -18
  219. package/dist/chunk-756rpwn0.js +0 -2
  220. package/dist/chunk-7pq02v7n.js +0 -2
  221. package/dist/chunk-7sht1rkv.js +0 -2
  222. package/dist/chunk-7trdtz0c.js +0 -3
  223. package/dist/chunk-7ycmnsh5.js +0 -2
  224. package/dist/chunk-8mdhencj.js +0 -42
  225. package/dist/chunk-9nh48zvm.js +0 -72
  226. package/dist/chunk-9rgp005c.js +0 -2
  227. package/dist/chunk-9xr628ew.js +0 -3
  228. package/dist/chunk-aq8r4rbs.js +0 -3
  229. package/dist/chunk-azvx5gaa.js +0 -2
  230. package/dist/chunk-b1kc0ka1.js +0 -712
  231. package/dist/chunk-ebk1723c.js +0 -2
  232. package/dist/chunk-emc7zqry.js +0 -2
  233. package/dist/chunk-eppv6knk.js +0 -2
  234. package/dist/chunk-f18rxz70.js +0 -2
  235. package/dist/chunk-f935fec7.js +0 -2
  236. package/dist/chunk-g0v1shhr.js +0 -2
  237. package/dist/chunk-g5pg0pg1.js +0 -2
  238. package/dist/chunk-g8x32bq2.js +0 -2
  239. package/dist/chunk-g978f9qg.js +0 -18
  240. package/dist/chunk-hk7vjyqa.js +0 -2
  241. package/dist/chunk-jd4dr23j.js +0 -3
  242. package/dist/chunk-jhm1228j.js +0 -4
  243. package/dist/chunk-jmaw2cdt.js +0 -2
  244. package/dist/chunk-jw75rmpw.js +0 -2
  245. package/dist/chunk-kgrvvtcy.js +0 -3
  246. package/dist/chunk-kpsxhm4x.js +0 -33
  247. package/dist/chunk-kvc9cwvx.js +0 -12
  248. package/dist/chunk-m3fq72f8.js +0 -2
  249. package/dist/chunk-n54twtm7.js +0 -2
  250. package/dist/chunk-np6y9evb.js +0 -2
  251. package/dist/chunk-p95fsnbk.js +0 -2
  252. package/dist/chunk-pk0mxjxw.js +0 -2
  253. package/dist/chunk-q87hkwfg.js +0 -3
  254. package/dist/chunk-q9r13taa.js +0 -2
  255. package/dist/chunk-qd87dk1d.js +0 -1329
  256. package/dist/chunk-qe6631me.js +0 -2
  257. package/dist/chunk-qqjhq0hb.js +0 -2
  258. package/dist/chunk-qsjkewah.js +0 -2
  259. package/dist/chunk-qttq8cje.js +0 -2
  260. package/dist/chunk-qw80eta1.js +0 -2
  261. package/dist/chunk-r51bfc2y.js +0 -2
  262. package/dist/chunk-rbrvepr3.js +0 -2
  263. package/dist/chunk-rwxg4m3h.js +0 -3
  264. package/dist/chunk-se4ny3q0.js +0 -2
  265. package/dist/chunk-shy2hkvj.js +0 -2
  266. package/dist/chunk-sxvv9w8t.js +0 -2
  267. package/dist/chunk-sy703233.js +0 -2
  268. package/dist/chunk-syzn6mq5.js +0 -2
  269. package/dist/chunk-t2nhr2tc.js +0 -2
  270. package/dist/chunk-tc31my2p.js +0 -20
  271. package/dist/chunk-v3r1wwec.js +0 -2
  272. package/dist/chunk-vd5d1yb9.js +0 -2
  273. package/dist/chunk-vj1bwnvs.js +0 -4
  274. package/dist/chunk-vmdsj8r5.js +0 -2
  275. package/dist/chunk-vmg3f76h.js +0 -2
  276. package/dist/chunk-w1d8t47c.js +0 -33
  277. package/dist/chunk-w1stsxm3.js +0 -3
  278. package/dist/chunk-w63c96ce.js +0 -2
  279. package/dist/chunk-wcgca1q6.js +0 -2
  280. package/dist/chunk-wv8qmwqp.js +0 -2
  281. package/dist/chunk-x90f7h2g.js +0 -2
  282. package/dist/chunk-xhnpgey5.js +0 -2
  283. package/dist/chunk-y54pj23g.js +0 -2
  284. package/dist/chunk-yhrkqcqd.js +0 -2
  285. package/dist/chunk-ykxpzjgy.js +0 -2
  286. package/dist/chunk-zhyrhxdp.js +0 -2
  287. package/dist/chunk-zn5tewws.js +0 -2
  288. package/dist/chunk-zvra3bmk.js +0 -2
@@ -1,3 +1,4 @@
1
+ import { bodyCloseIndex, headCloseIndex, insertBeforeHeadClose } from "./document-tags.js";
1
2
  import { headInsertionPoint } from "./head-injection.js";
2
3
  import { BROWSER_CORE_IMPORTS } from "./browser-core-imports.js";
3
4
  import { getOwnedRouteMatchers } from "./owned-routes.js";
@@ -36,12 +37,11 @@ export function injectBrowserRuntime(template) {
36
37
  import '@stacksjs/browser'
37
38
  </script>`;
38
39
  if (template.includes("</head>")) {
39
- const headEndPos = template.indexOf("</head>"), firstScriptPos = template.slice(0, headEndPos).indexOf("<script");
40
+ const headEndPos = headCloseIndex(template), firstScriptPos = template.slice(0, headEndPos).indexOf("<script");
40
41
  if (firstScriptPos !== -1)
41
42
  return template.slice(0, firstScriptPos) + browserScript + `
42
43
  ` + template.slice(firstScriptPos);
43
- return template.replace("</head>", `${browserScript}
44
- </head>`);
44
+ return insertBeforeHeadClose(template, browserScript);
45
45
  }
46
46
  if (findBodyOpenTag(template))
47
47
  return replaceBodyOpenTag(template, (tag) => `${tag}
@@ -72,7 +72,7 @@ function placeRuntimeTag(template, runtimeScript) {
72
72
  return `${template.slice(0, headAt)}
73
73
  ${runtimeScript}${template.slice(headAt)}`;
74
74
  if (template.includes("</head>")) {
75
- const idx = template.indexOf("</head>");
75
+ const idx = headCloseIndex(template);
76
76
  return template.slice(0, idx) + runtimeScript + `
77
77
  ` + template.slice(idx);
78
78
  }
@@ -100,7 +100,7 @@ export function outputNeedsTooltipRuntime(html) {
100
100
  export function injectTooltipRuntime(html) {
101
101
  if (html.includes("data-stx-tooltip-runtime") || !outputNeedsTooltipRuntime(html))
102
102
  return html;
103
- const tag = `<script data-stx-scoped data-stx-tooltip-runtime>${getTooltipRuntime()}</script>`, bodyIdx = html.lastIndexOf("</body>");
103
+ const tag = `<script data-stx-scoped data-stx-tooltip-runtime>${getTooltipRuntime()}</script>`, bodyIdx = bodyCloseIndex(html);
104
104
  if (bodyIdx === -1)
105
105
  return `${html}
106
106
  ${tag}`;
@@ -169,7 +169,7 @@ export async function injectRouterScript(template, options) {
169
169
  configScript = `<script>window.__stxRouterConfig=${toScriptJson(configObj)};</script>
170
170
  `;
171
171
  }
172
- const { getCachedRouterScript, getServeClientAsset } = await import("./caching.js"), routerScript = options?.buildMode === "compile" ? '<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>' : options?.buildMode === "serve" ? `<script data-stx-router src="${(await getServeClientAsset("router")).url}"></script>` : `<script data-stx-router>${await getCachedRouterScript()}</script>`, bodyCloseIdx = template.lastIndexOf("</body>");
172
+ const { getCachedRouterScript, getServeClientAsset } = await import("./caching.js"), routerScript = options?.buildMode === "compile" ? '<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>' : options?.buildMode === "serve" ? `<script data-stx-router src="${(await getServeClientAsset("router")).url}"></script>` : `<script data-stx-router>${await getCachedRouterScript()}</script>`, bodyCloseIdx = bodyCloseIndex(template);
173
173
  return template.slice(0, bodyCloseIdx) + configScript + ownedRoutesScript + routerScript + `
174
174
  </body>` + template.slice(bodyCloseIdx + 7);
175
175
  }
package/dist/serve.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { insertBeforeBodyClose } from "./document-tags.js";
1
2
  import { serve as bunServe } from "bun";
2
3
  import fs from "node:fs";
3
4
  import path from "node:path";
@@ -76,12 +77,7 @@ $1`);
76
77
  if (clientScripts.length > 0) {
77
78
  const { interpolateScriptsInTemplate } = await import("./expressions.js"), scriptsHtml = interpolateScriptsInTemplate(clientScripts.join(`
78
79
  `), context);
79
- if (output.match(/(<\/body>)/i))
80
- output = output.replace(/(<\/body>)/i, `${scriptsHtml}
81
- $1`);
82
- else
83
- output += `
84
- ${scriptsHtml}`;
80
+ output = insertBeforeBodyClose(output, scriptsHtml);
85
81
  }
86
82
  const status = readResponseStatus(context), headers = readResponseHeaders(context);
87
83
  fileCache.set(cacheKey, { content: output, mtime: stats.mtimeMs, status, headers });
@@ -1,4 +1,5 @@
1
1
  import { Glob } from "bun";
2
+ import { insertBeforeBodyClose } from "../document-tags.js";
2
3
  import {
3
4
  cpSync,
4
5
  existsSync,
@@ -81,8 +82,7 @@ export async function buildStaticSite(options) {
81
82
  html = injectThemeBootstrap(html, options);
82
83
  html = autoWrapContent(html);
83
84
  if (i18n)
84
- html = html.replace(/<\/body>/i, `${buildLangPickerScript(i18n, locale)}
85
- </body>`);
85
+ html = insertBeforeBodyClose(html, buildLangPickerScript(i18n, locale));
86
86
  if (options.spa !== !1)
87
87
  html = await injectRouterScript(html, options.router);
88
88
  const targetFile = i18n ? localePathToFile(basePath, locale, i18n.defaultLocale) : file, targetPath = join(outDir, targetFile);
@@ -1,3 +1,4 @@
1
+ import { insertBeforeHeadClose } from "../document-tags.js";
1
2
  import { existsSync, readFileSync } from "node:fs";
2
3
  import { join, resolve } from "node:path";
3
4
  import process from "node:process";
@@ -129,8 +130,7 @@ export function stampLocaleLayoutGroup(html, locale) {
129
130
  if (/<meta name="stx-layout-group"[^>]*>/i.test(html))
130
131
  return html.replace(/<meta name="stx-layout-group"[^>]*>/i, groupMeta);
131
132
  if (/<\/head>/i.test(html))
132
- return html.replace(/<\/head>/i, `${groupMeta}
133
- </head>`);
133
+ return insertBeforeHeadClose(html, groupMeta);
134
134
  return `${groupMeta}
135
135
  ${html}`;
136
136
  }
@@ -1,3 +1,4 @@
1
+ import { insertBeforeBodyClose } from "../document-tags.js";
1
2
  let _cachedRouterScript = null;
2
3
  async function getRouterScript() {
3
4
  if (_cachedRouterScript !== null)
@@ -19,9 +20,5 @@ export async function injectRouterScript(html, options) {
19
20
  return html;
20
21
  const merged = { interceptAllLinks: !0, container: "main", ...options }, block = `${`<script>window.__stxRouterConfig=${JSON.stringify(merged)};</script>
21
22
  `}<script>${script}</script>`;
22
- if (/<\/body>/i.test(html))
23
- return html.replace(/<\/body>/i, `${block}
24
- </body>`);
25
- return `${html}
26
- ${block}`;
23
+ return insertBeforeBodyClose(html, block);
27
24
  }
@@ -1,3 +1,4 @@
1
+ import { insertBeforeBodyClose } from "../document-tags.js";
1
2
  import { COLOR_MODE_BOOT_MARKER } from "../color-mode-boot.js";
2
3
  const FAVICON_FN = `window.__stxThemeIcon=function(isDark){try{var want=isDark?'dark':'light';var pick=document.querySelector('link[rel~="icon"][media*="prefers-color-scheme: '+want+'"]');if(!pick)return;var live=document.querySelector('link[rel~="icon"]:not([media])');if(!live){live=document.createElement('link');live.setAttribute('rel','icon');document.head.appendChild(live)}if(pick.type)live.setAttribute('type',pick.type);var href=pick.getAttribute('href');if(live.getAttribute('href')!==href)live.setAttribute('href',href)}catch(e){}};`, FOUC_SCRIPT = (defaultTheme, storageKey, lightColor, darkColor) => `(function(){${FAVICON_FN}function read(){try{var k=${JSON.stringify(storageKey)};var t=localStorage.getItem(k);return t===null?(${JSON.stringify(defaultTheme)}==='dark'||(${JSON.stringify(defaultTheme)}==='auto'&&window.matchMedia('(prefers-color-scheme: dark)').matches)):t==='dark'}catch(e){return ${JSON.stringify(defaultTheme)}==='dark'}}function apply(){var isDark=read();var html=document.documentElement;html.classList[isDark?'add':'remove']('dark');var color=isDark?${JSON.stringify(darkColor)}:${JSON.stringify(lightColor)};if(!document.head)return;var tc=document.querySelector('meta[name="theme-color"]:not([media])');if(!tc){tc=document.createElement('meta');tc.setAttribute('name','theme-color');tc.setAttribute('data-stx-theme-meta','1')}tc.setAttribute('content',color);if(tc!==document.head.firstChild){document.head.insertBefore(tc,document.head.firstChild)}if(window.__stxThemeIcon)window.__stxThemeIcon(isDark)}apply();window.addEventListener('stx:navigate',apply);window.addEventListener('popstate',apply)})();`, TOGGLE_HANDLER = (storageKey, lightColor, darkColor) => `document.addEventListener('click',function(e){var t=e.target&&e.target.closest&&e.target.closest('#theme-toggle');if(!t)return;var html=document.documentElement;var isDark=html.classList.toggle('dark');try{localStorage.setItem(${JSON.stringify(storageKey)},isDark?'dark':'light')}catch(e){}var tc=document.querySelector('meta[name="theme-color"]:not([media])');if(tc)tc.setAttribute('content',isDark?${JSON.stringify(darkColor)}:${JSON.stringify(lightColor)});if(window.__stxThemeIcon)window.__stxThemeIcon(isDark)});`;
3
4
  export function injectThemeBootstrap(html, site) {
@@ -31,8 +32,7 @@ export function injectThemeBootstrap(html, site) {
31
32
  }
32
33
  if (!colorModeOwnsTheme && !html.includes("__stxThemeToggle") && /<\/body>/i.test(html)) {
33
34
  const handler = `<script data-stx-theme-toggle="1">${TOGGLE_HANDLER(storageKey, lightColor, darkColor)};window.__stxThemeToggle=1;</script>`;
34
- html = html.replace(/<\/body>/i, `${handler}
35
- </body>`);
35
+ html = insertBeforeBodyClose(html, handler);
36
36
  }
37
37
  return html;
38
38
  }
package/dist/ssg.js CHANGED
@@ -1,51 +1,50 @@
1
1
  // @bun
2
- import"./chunk-mzes9ds7.js";import{x,fl}from"./chunk-9nh48zvm.js";import"./chunk-fkh4xece.js";import"./chunk-xppm4cs4.js";import{It,y}from"./chunk-b1kc0ka1.js";import"./chunk-5rxks14t.js";import"./chunk-wjamjgx6.js";import"./chunk-2sq9pdg3.js";import{Et,Tt,$t,Rt,At,Pt}from"./chunk-g17q4y5k.js";import{a}from"./chunk-wfd9e224.js";import{As}from"./chunk-s4592dy0.js";import"./chunk-k8pzk8v9.js";import"./chunk-gq9h36jf.js";import{be,sn,on}from"./chunk-tc31my2p.js";import"./chunk-w1stsxm3.js";import{b}from"./chunk-6w5a5ns4.js";import{vt,i}from"./chunk-qd87dk1d.js";import"./chunk-8mdhencj.js";import"./chunk-2kc0vsnb.js";import{ys}from"./chunk-3248qphb.js";import"./chunk-403a4pqm.js";import"./chunk-t5q31st4.js";import{oc,ic,ac}from"./chunk-qgxwf9xr.js";import{nn,tr,nr}from"./chunk-q87hkwfg.js";import{rn}from"./chunk-v9h7s8ce.js";import"./chunk-2dnd2s2a.js";import"./chunk-rwxg4m3h.js";import{X,xe}from"./chunk-5va6c7jf.js";import"./chunk-1hebvmaj.js";import"./chunk-hf9pvmq2.js";import{c}from"./chunk-7trdtz0c.js";import{r,he}from"./chunk-shke1fcm.js";import D from"fs";import f from"path";import{createHash as bt}from"crypto";function kt(t){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return t}}var Dt=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function Ct(t){return Bun.hash(t).toString(16)}function ot(t,n={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let s=new Map,o=t.replace(Dt,(e,u,g,v)=>{let w=v.trim();if(!w)return e;if(/\bdata-stx-src=/.test(g))return e;if(n.minify)w=kt(w);let p=Ct(w);if(!s.has(p))s.set(p,w);let P=n.integrity?` data-stx-integrity="sha384-${bt("sha384").update(w).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${u}" data-stx-src="/_stx/islands/${p}.js"${P}${g}></script>`}),l=Array.from(s,([e,u])=>({hash:e,code:u}));return{html:o,chunks:l}}var Bt=new Set(["visible","idle"]);function ct(t){if(!t.includes("data-stx-src="))return t;let n=new Map,s=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,o;while((o=s.exec(t))!==null)n.set(o[1],o[2]);let l=new Set,e=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,u;while((u=e.exec(t))!==null)if(Bt.has(n.get(u[1])||""))l.add(u[2]);let g=/<\/head\s*>/iy,v=y(t,(p,P)=>(g.lastIndex=P,g.exec(p)?g.lastIndex:-1))[0]?.start??-1;if(l.size===0||v===-1)return t;let w=Array.from(l).filter((p)=>!t.includes(`rel="prefetch" href="${p}"`)).map((p)=>`<link rel="prefetch" href="${p}" as="script">`).join("");if(!w)return t;return t.slice(0,v)+w+t.slice(v)}var jt=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function K(t){let n=t.trim();if(!n)return null;let s=/^https?:\/\//i.test(n)?n:`https://${n}`;try{return new URL(s).origin+new URL(s).pathname.replace(/\/$/,"")}catch{return null}}function Ft(t){for(let n of jt){let s=t[n];if(!s)continue;let o=K(s);if(o)return{url:o,source:"env",via:n}}return null}function lt(t){if(!t||typeof t!=="object")return null;let n=t,s=n.site?.url??n.url??n.app?.url;return typeof s==="string"?K(s):null}async function Ot(t){let{existsSync:n}=await import("fs"),s=await import("path");for(let o of["site.config.ts","site.config.js",".config/site.config.ts"]){let l=s.resolve(t,o);if(!n(l))continue;try{let e=await import(l),u=lt(e.default??e);if(u)return u}catch{}}return null}async function ut(t={}){let n=t.cwd??process.cwd(),s=t.env??process.env;if(t.explicit){let u=K(t.explicit);if(u)return{url:u,source:"option"}}let o=lt(t.stxConfig);if(o)return{url:o,source:"stx.config",via:"site.url"};let l=await Ot(n);if(l)return{url:l,source:"site.config",via:"url"};let e=Ft(s);if(e)return e;return{url:"http://localhost",source:"fallback"}}function dt(){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
- `)}function q(t){return async()=>({paths:await t(),fallback:!1})}var Lt;function Ut(t){let n=r(t),{depths:s}=he(n),o=/\b(?:async\s+)?function\s+getStaticPaths\s*\(/g,l;while((l=o.exec(n))!==null){if(s[l.index]!==0)continue;let u=x(n,"(",")",o.lastIndex-1),g=n.indexOf("{",u+1),v=x(n,"{","}",g);if(u<0||g<0||v<0)break;return t.slice(l.index,v+1)}let e=/\b(?:const|let|var)\s+getStaticPaths\s*=/g;while((l=e.exec(n))!==null){if(s[l.index]!==0)continue;let u=fl(n,e.lastIndex).endPos;return t.slice(e.lastIndex,u).trim()}throw SyntaxError("Could not extract getStaticPaths; use a top-level function or const declaration")}async function gt(t){let n="read";try{let s=await Bun.file(t).text();n="parse";let o=rn(s),l=[...o.server,...o.client,...o.signals].filter((e)=>/(?:^|\s)server(?:\s|=|$)/i.test(r(e.attrs))).sort((e,u)=>s.indexOf(e.fullTag)-s.indexOf(u.fullTag));for(let e of l){if(!/\bgetStaticPaths\b/.test(r(e.content)))continue;let u=(Lt??=new Bun.Transpiler({loader:"ts",target:"bun"})).transformSync(e.content);if(!/\bgetStaticPaths\b/.test(r(u)))continue;let g=Ut(u);if(/\bdefineStaticPaths\b/.test(r(g))&&It(u,"defineStaticPaths"))throw SyntaxError("Cannot evaluate a module-local defineStaticPaths binding during isolated hook extraction");n="execute";let v=Function("defineStaticPaths",`return (${g})`)(q);if(typeof v!=="function")throw TypeError("getStaticPaths must be a function");let w=await v();n="result";let p=Array.isArray(w)?{paths:w}:w;if(!p||typeof p!=="object"||!("paths"in p)||!Array.isArray(p.paths))throw TypeError("getStaticPaths must return { paths: [...] } or an array of paths");for(let P of p.paths)if(!P||typeof P!=="object"||!P.params||typeof P.params!=="object"||Array.isArray(P.params))throw TypeError("Each getStaticPaths path must contain a params object");return{kind:"ok",value:p}}return{kind:"absent"}}catch(s){return{kind:"error",phase:n,error:s instanceof Error?s:Error(String(s))}}}class pt{cacheDir;cache=new Map;loaded=!1;salt;constructor(t,n=""){this.cacheDir=t,this.salt=n}async load(){if(this.loaded)return;let t=f.join(this.cacheDir,"build-cache.json");if(await Bun.file(t).exists())try{let n=JSON.parse(await Bun.file(t).text());for(let[s,o]of Object.entries(n))this.cache.set(s,o)}catch{}this.loaded=!0}async save(){await D.promises.mkdir(this.cacheDir,{recursive:!0});let t=f.join(this.cacheDir,"build-cache.json"),n={};for(let[s,o]of this.cache)n[s]=o;await Bun.write(t,JSON.stringify(n))}getHash(t,n){let s=D.statSync(t),o=`${this.salt}|${t}:${s.mtimeMs}`;for(let e of n)if(D.existsSync(e)){let u=D.statSync(e);o+=`:${e}:${u.mtimeMs}`}let l=0;for(let e=0;e<o.length;e++){let u=o.charCodeAt(e);l=(l<<5)-l+u,l=l&l}return Math.abs(l).toString(36)}get(t,n){let s=this.cache.get(t);if(!s)return null;let o=ft(n).some((u)=>D.existsSync(u)),l=[n,...s.dependencies??[]].some((u)=>u.endsWith(".stx")&&D.existsSync(u)&&ys(D.readFileSync(u,"utf8")).some((g)=>/\bserver\b/.test(g.attrs)));if(o||l)return this.cache.delete(t),null;let e=this.getHash(n,s.dependencies??[]);if(s.hash!==e)return this.cache.delete(t),null;return s.html}set(t,n,s,o){let l=this.getHash(n,s);this.cache.set(t,{hash:l,html:o,generatedAt:Date.now(),dependencies:s})}}class ht{cacheDir;constructor(t){this.cacheDir=t}getFilePath(t){let n=t.replace(/[^a-zA-Z0-9]/g,"_")+".json";return f.join(this.cacheDir,"isr",n)}async get(t){let n=this.getFilePath(t);if(!await Bun.file(n).exists())return null;try{return JSON.parse(await Bun.file(n).text())}catch{return null}}async set(t,n){let s=this.getFilePath(t);await D.promises.mkdir(f.dirname(s),{recursive:!0}),await Bun.write(s,JSON.stringify(n))}async invalidate(t){let n=this.getFilePath(t);if(await Bun.file(n).exists())await D.promises.unlink(n)}async invalidatePattern(t){let n=f.join(this.cacheDir,"isr");if(!D.existsSync(n))return;let s=await D.promises.readdir(n);for(let o of s){let l=o.replace(/_/g,"/").replace(".json","");if(t.test(l))await D.promises.unlink(f.join(n,o))}}async needsRevalidation(t){let n=await this.get(t);if(!n)return!0;return Date.now()>n.revalidateAfter}}async function _t(t){let n=[];if(!t.isDynamic)n.push({url:t.pattern,params:{}});else{let s=await gt(t.filePath);if(s.kind==="error")throw Error(`getStaticPaths ${s.phase} failed for ${t.pattern} (${t.filePath}): ${s.error.message}`,{cause:s.error});if(s.kind==="absent")return console.warn(`Warning: Dynamic route ${t.pattern} (${t.filePath}) has no getStaticPaths`),n;let o=s.value;if(o.paths.length===0)return console.info(`getStaticPaths returned no paths for dynamic route ${t.pattern} (${t.filePath})`),n;for(let l of o.paths){let e=t.pattern;for(let[u,g]of Object.entries(l.params))e=e.replace(`:${u}`,g).replace(`:${u}*`,g);n.push({url:e,params:l.params,props:l.props,revalidate:l.revalidate})}}return n}function ft(t){return[t.replace(/\.stx$/,".data.ts"),t.replace(/\.stx$/,".data.js"),t+".data.ts",t+".data.js"]}async function Mt(t){for(let n of ft(t))if(await Bun.file(n).exists())try{let s=await import(n);if(typeof s.default==="function")return await s.default();else if(typeof s.default==="object")return s.default;else if(typeof s.getData==="function")return await s.getData();else{let{default:o,...l}=s;return l}}catch(s){console.error(`Error loading data file ${n}:`,s)}return null}async function Gt(t,n,s){let o=t.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!o)return null;let l=o[1];if(!l.includes("getStaticProps"))return null;try{let e=l.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!e)return null;return await Function("params",`
2
+ import"./chunk-9zrvh3pz.js";import{k,yl}from"./chunk-qa5y30sy.js";import"./chunk-qjey0jk6.js";import"./chunk-farh4p7f.js";import{Mt,w}from"./chunk-2kfayg4t.js";import"./chunk-k32q90b2.js";import"./chunk-0fh47gp0.js";import"./chunk-tnp2ta5q.js";import{Rt,At,Pt,It,Ot,Nt}from"./chunk-x512h2gv.js";import{a}from"./chunk-4xanjv22.js";import{Os}from"./chunk-mfa07erx.js";import"./chunk-669b2bya.js";import"./chunk-n058hznh.js";import{xe,cn,ln}from"./chunk-hdjn7nw9.js";import"./chunk-2s7rmn9r.js";import{x}from"./chunk-4ykgjewy.js";import{kt,i}from"./chunk-321fbxnm.js";import"./chunk-srgpz94e.js";import"./chunk-2dpessnc.js";import{vs}from"./chunk-fnxg6134.js";import"./chunk-dhnw2qwq.js";import"./chunk-q1wxgw5s.js";import{lc,uc,dc}from"./chunk-v4xes880.js";import{on,sr,or}from"./chunk-ymdw4fhd.js";import{an}from"./chunk-2srjavsn.js";import"./chunk-24hq8mka.js";import"./chunk-xymr4ys9.js";import{Z,_e}from"./chunk-0c9c9v03.js";import"./chunk-zsnmk5me.js";import"./chunk-adb045wf.js";import{l}from"./chunk-46pxmpeb.js";import{r,we}from"./chunk-x7redxyd.js";import{f}from"./chunk-s9df8srx.js";import R from"fs";import m from"path";import{createHash as vt}from"crypto";function $t(t){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return t}}var Dt=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function Et(t){return Bun.hash(t).toString(16)}function ct(t,n={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let s=new Map,o=t.replace(Dt,(e,u,g,v)=>{let S=v.trim();if(!S)return e;if(/\bdata-stx-src=/.test(g))return e;if(n.minify)S=$t(S);let p=Et(S);if(!s.has(p))s.set(p,S);let P=n.integrity?` data-stx-integrity="sha384-${vt("sha384").update(S).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${u}" data-stx-src="/_stx/islands/${p}.js"${P}${g}></script>`}),c=Array.from(s,([e,u])=>({hash:e,code:u}));return{html:o,chunks:c}}var Ct=new Set(["visible","idle"]);function lt(t){if(!t.includes("data-stx-src="))return t;let n=new Map,s=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,o;while((o=s.exec(t))!==null)n.set(o[1],o[2]);let c=new Set,e=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,u;while((u=e.exec(t))!==null)if(Ct.has(n.get(u[1])||""))c.add(u[2]);let g=/<\/head\s*>/iy,v=w(t,(p,P)=>(g.lastIndex=P,g.exec(p)?g.lastIndex:-1))[0]?.start??-1;if(c.size===0||v===-1)return t;let S=Array.from(c).filter((p)=>!t.includes(`rel="prefetch" href="${p}"`)).map((p)=>`<link rel="prefetch" href="${p}" as="script">`).join("");if(!S)return t;return t.slice(0,v)+S+t.slice(v)}var Bt=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function X(t){let n=t.trim();if(!n)return null;let s=/^https?:\/\//i.test(n)?n:`https://${n}`;try{return new URL(s).origin+new URL(s).pathname.replace(/\/$/,"")}catch{return null}}function jt(t){for(let n of Bt){let s=t[n];if(!s)continue;let o=X(s);if(o)return{url:o,source:"env",via:n}}return null}function ut(t){if(!t||typeof t!=="object")return null;let n=t,s=n.site?.url??n.url??n.app?.url;return typeof s==="string"?X(s):null}async function Ft(t){let{existsSync:n}=await import("fs"),s=await import("path");for(let o of["site.config.ts","site.config.js",".config/site.config.ts"]){let c=s.resolve(t,o);if(!n(c))continue;try{let e=await import(c),u=ut(e.default??e);if(u)return u}catch{}}return null}async function dt(t={}){let n=t.cwd??process.cwd(),s=t.env??process.env;if(t.explicit){let u=X(t.explicit);if(u)return{url:u,source:"option"}}let o=ut(t.stxConfig);if(o)return{url:o,source:"stx.config",via:"site.url"};let c=await Ft(n);if(c)return{url:c,source:"site.config",via:"url"};let e=jt(s);if(e)return e;return{url:"http://localhost",source:"fallback"}}function gt(){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
+ `)}function J(t){return async()=>({paths:await t(),fallback:!1})}var Tt;function Lt(t){let n=r(t),{depths:s}=we(n),o=/\b(?:async\s+)?function\s+getStaticPaths\s*\(/g,c;while((c=o.exec(n))!==null){if(s[c.index]!==0)continue;let u=k(n,"(",")",o.lastIndex-1),g=n.indexOf("{",u+1),v=k(n,"{","}",g);if(u<0||g<0||v<0)break;return t.slice(c.index,v+1)}let e=/\b(?:const|let|var)\s+getStaticPaths\s*=/g;while((c=e.exec(n))!==null){if(s[c.index]!==0)continue;let u=yl(n,e.lastIndex).endPos;return t.slice(e.lastIndex,u).trim()}throw SyntaxError("Could not extract getStaticPaths; use a top-level function or const declaration")}async function pt(t){let n="read";try{let s=await Bun.file(t).text();n="parse";let o=an(s),c=[...o.server,...o.client,...o.signals].filter((e)=>/(?:^|\s)server(?:\s|=|$)/i.test(r(e.attrs))).sort((e,u)=>s.indexOf(e.fullTag)-s.indexOf(u.fullTag));for(let e of c){if(!/\bgetStaticPaths\b/.test(r(e.content)))continue;let u=(Tt??=new Bun.Transpiler({loader:"ts",target:"bun"})).transformSync(e.content);if(!/\bgetStaticPaths\b/.test(r(u)))continue;let g=Lt(u);if(/\bdefineStaticPaths\b/.test(r(g))&&Mt(u,"defineStaticPaths"))throw SyntaxError("Cannot evaluate a module-local defineStaticPaths binding during isolated hook extraction");n="execute";let v=Function("defineStaticPaths",`return (${g})`)(J);if(typeof v!=="function")throw TypeError("getStaticPaths must be a function");let S=await v();n="result";let p=Array.isArray(S)?{paths:S}:S;if(!p||typeof p!=="object"||!("paths"in p)||!Array.isArray(p.paths))throw TypeError("getStaticPaths must return { paths: [...] } or an array of paths");for(let P of p.paths)if(!P||typeof P!=="object"||!P.params||typeof P.params!=="object"||Array.isArray(P.params))throw TypeError("Each getStaticPaths path must contain a params object");return{kind:"ok",value:p}}return{kind:"absent"}}catch(s){return{kind:"error",phase:n,error:s instanceof Error?s:Error(String(s))}}}class ft{cacheDir;cache=new Map;loaded=!1;salt;constructor(t,n=""){this.cacheDir=t,this.salt=n}async load(){if(this.loaded)return;let t=m.join(this.cacheDir,"build-cache.json");if(await Bun.file(t).exists())try{let n=JSON.parse(await Bun.file(t).text());for(let[s,o]of Object.entries(n))this.cache.set(s,o)}catch{}this.loaded=!0}async save(){await R.promises.mkdir(this.cacheDir,{recursive:!0});let t=m.join(this.cacheDir,"build-cache.json"),n={};for(let[s,o]of this.cache)n[s]=o;await Bun.write(t,JSON.stringify(n))}getHash(t,n){let s=R.statSync(t),o=`${this.salt}|${t}:${s.mtimeMs}`;for(let e of n)if(R.existsSync(e)){let u=R.statSync(e);o+=`:${e}:${u.mtimeMs}`}let c=0;for(let e=0;e<o.length;e++){let u=o.charCodeAt(e);c=(c<<5)-c+u,c=c&c}return Math.abs(c).toString(36)}get(t,n){let s=this.cache.get(t);if(!s)return null;let o=mt(n).some((u)=>R.existsSync(u)),c=[n,...s.dependencies??[]].some((u)=>u.endsWith(".stx")&&R.existsSync(u)&&vs(R.readFileSync(u,"utf8")).some((g)=>/\bserver\b/.test(g.attrs)));if(o||c)return this.cache.delete(t),null;let e=this.getHash(n,s.dependencies??[]);if(s.hash!==e)return this.cache.delete(t),null;return s.html}set(t,n,s,o){let c=this.getHash(n,s);this.cache.set(t,{hash:c,html:o,generatedAt:Date.now(),dependencies:s})}}class ht{cacheDir;constructor(t){this.cacheDir=t}getFilePath(t){let n=t.replace(/[^a-zA-Z0-9]/g,"_")+".json";return m.join(this.cacheDir,"isr",n)}async get(t){let n=this.getFilePath(t);if(!await Bun.file(n).exists())return null;try{return JSON.parse(await Bun.file(n).text())}catch{return null}}async set(t,n){let s=this.getFilePath(t);await R.promises.mkdir(m.dirname(s),{recursive:!0}),await Bun.write(s,JSON.stringify(n))}async invalidate(t){let n=this.getFilePath(t);if(await Bun.file(n).exists())await R.promises.unlink(n)}async invalidatePattern(t){let n=m.join(this.cacheDir,"isr");if(!R.existsSync(n))return;let s=await R.promises.readdir(n);for(let o of s){let c=o.replace(/_/g,"/").replace(".json","");if(t.test(c))await R.promises.unlink(m.join(n,o))}}async needsRevalidation(t){let n=await this.get(t);if(!n)return!0;return Date.now()>n.revalidateAfter}}async function Ut(t){let n=[];if(!t.isDynamic)n.push({url:t.pattern,params:{}});else{let s=await pt(t.filePath);if(s.kind==="error")throw Error(`getStaticPaths ${s.phase} failed for ${t.pattern} (${t.filePath}): ${s.error.message}`,{cause:s.error});if(s.kind==="absent")return console.warn(`Warning: Dynamic route ${t.pattern} (${t.filePath}) has no getStaticPaths`),n;let o=s.value;if(o.paths.length===0)return console.info(`getStaticPaths returned no paths for dynamic route ${t.pattern} (${t.filePath})`),n;for(let c of o.paths){let e=t.pattern;for(let[u,g]of Object.entries(c.params))e=e.replace(`:${u}`,g).replace(`:${u}*`,g);n.push({url:e,params:c.params,props:c.props,revalidate:c.revalidate})}}return n}function mt(t){return[t.replace(/\.stx$/,".data.ts"),t.replace(/\.stx$/,".data.js"),t+".data.ts",t+".data.js"]}async function _t(t){for(let n of mt(t))if(await Bun.file(n).exists())try{let s=await import(n);if(typeof s.default==="function")return await s.default();else if(typeof s.default==="object")return s.default;else if(typeof s.getData==="function")return await s.getData();else{let{default:o,...c}=s;return c}}catch(s){console.error(`Error loading data file ${n}:`,s)}return null}async function Gt(t,n,s){let o=t.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!o)return null;let c=o[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",`
4
4
  return (async function getStaticProps() {
5
5
  ${e[1]}
6
6
  })()
7
- `)(n)}catch(e){return console.error(`Error executing getStaticProps in ${s}:`,e),null}}function Nt(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 mt(t,n,s={},o,l){let e=await Bun.file(t.filePath).text(),u=await Mt(t.filePath),g=await Gt(e,n,t.filePath),v={...u||{},...g||{},...s,params:n,$route:{path:t.pattern,params:n}},w=new Set,p=[],P=[],E={...l,minifyClient:!0,...o.partialsDir?{partialsDir:o.partialsDir}:{},...o.componentsDir?{componentsDir:o.componentsDir}:{},debug:!1,cache:!1,autoShell:!0,onIncludeError:(R)=>{p.push(`${f.relative(process.cwd(),R.templatePath)}: ${R.message}
8
- resolved against partialsDir: ${R.partialsDir}`)},onServerScriptError:(R)=>{P.push(`${f.relative(process.cwd(),R.sourcePath)} (${R.kind}): ${R.message}`)}};if(Nt(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 S=await i(e,v,t.filePath,E,w);for(let R of[t.filePath,...w])for(let A of be(R))w.add(A);if(Object.keys(n).length>0){let R=`<script>if(window.stx)window.stx._rp=${JSON.stringify(n)};else window.__stx_rp=${JSON.stringify(n)};</script>`;if(S.includes("</head>"))S=S.replace("</head>",`${R}
9
- </head>`);else S=`${R}
10
- ${S}`}if(S=await xe(S,{router:o.router}),S=await b(S),o.minify!==!1)return{html:Ht(S),dependencies:Array.from(w),includeFailures:p,serverScriptFailures:P};return{html:S,dependencies:Array.from(w),includeFailures:p,serverScriptFailures:P}}function Ht(t){let n=[],s=0,o=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,l;while((l=o.exec(t))!==null){let u=t.slice(s,l.index);n.push(u.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let g=l[1],v=l[2],w=l[3];v=v.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),n.push(g+v+w),s=l.index+l[0].length}let e=t.slice(s);return n.push(e.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),n.join("").trim()}function zt(t){let n=0;for(let s=0;s<t.length;s++){let o=t.charCodeAt(s);n=(n<<5)-n+o,n=n&n}return`"${Math.abs(n).toString(36)}"`}function Wt(t,n,s,o){if(s?.sitemap===!1)return!0;if(/<meta[^>]+name=["']robots["'][^>]+content=["'][^"']*noindex/i.test(n))return!0;return o.some((l)=>{if(l instanceof RegExp)return l.test(t);return l.endsWith("/")?t===l.slice(0,-1)||t.startsWith(l):t===l})}function qt(t,n){return`<?xml version="1.0" encoding="UTF-8"?>
7
+ `)(n)}catch(e){return console.error(`Error executing getStaticProps in ${s}:`,e),null}}function Ht(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 wt(t,n,s={},o,c){let e=await Bun.file(t.filePath).text(),u=await _t(t.filePath),g=await Gt(e,n,t.filePath),v={...u||{},...g||{},...s,params:n,$route:{path:t.pattern,params:n}},S=new Set,p=[],P=[],C={...c,minifyClient:!0,...o.partialsDir?{partialsDir:o.partialsDir}:{},...o.componentsDir?{componentsDir:o.componentsDir}:{},debug:!1,cache:!1,autoShell:!0,onIncludeError:(E)=>{p.push(`${m.relative(process.cwd(),E.templatePath)}: ${E.message}
8
+ resolved against partialsDir: ${E.partialsDir}`)},onServerScriptError:(E)=>{P.push(`${m.relative(process.cwd(),E.sourcePath)} (${E.kind}): ${E.message}`)}};if(Ht(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 b=await i(e,v,t.filePath,C,S);for(let E of[t.filePath,...S])for(let O of xe(E))S.add(O);if(Object.keys(n).length>0){let E=`<script>if(window.stx)window.stx._rp=${JSON.stringify(n)};else window.__stx_rp=${JSON.stringify(n)};</script>`;if(b.includes("</head>"))b=f(b,E);else b=`${E}
9
+ ${b}`}if(b=await _e(b,{router:o.router}),b=await x(b),o.minify!==!1)return{html:zt(b),dependencies:Array.from(S),includeFailures:p,serverScriptFailures:P};return{html:b,dependencies:Array.from(S),includeFailures:p,serverScriptFailures:P}}function zt(t){let n=[],s=0,o=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,c;while((c=o.exec(t))!==null){let u=t.slice(s,c.index);n.push(u.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let g=c[1],v=c[2],S=c[3];v=v.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),n.push(g+v+S),s=c.index+c[0].length}let e=t.slice(s);return n.push(e.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),n.join("").trim()}function Wt(t){let n=0;for(let s=0;s<t.length;s++){let o=t.charCodeAt(s);n=(n<<5)-n+o,n=n&n}return`"${Math.abs(n).toString(36)}"`}function qt(t,n,s,o){if(s?.sitemap===!1)return!0;if(/<meta[^>]+name=["']robots["'][^>]+content=["'][^"']*noindex/i.test(n))return!0;return o.some((c)=>{if(c instanceof RegExp)return c.test(t);return c.endsWith("/")?t===c.slice(0,-1)||t.startsWith(c):t===c})}function Jt(t,n){return`<?xml version="1.0" encoding="UTF-8"?>
11
10
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
12
- ${t.map((o)=>{let l=new URL(o.loc,n).href,e=` <url>
13
- <loc>${F(l)}</loc>`;if(o.lastmod)e+=`
11
+ ${t.map((o)=>{let c=new URL(o.loc,n).href,e=` <url>
12
+ <loc>${T(c)}</loc>`;if(o.lastmod)e+=`
14
13
  <lastmod>${o.lastmod}</lastmod>`;if(o.changefreq)e+=`
15
14
  <changefreq>${o.changefreq}</changefreq>`;if(o.priority!==void 0)e+=`
16
15
  <priority>${o.priority}</priority>`;return e+=`
17
16
  </url>`,e}).join(`
18
17
  `)}
19
- </urlset>`}function F(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function Jt(t,n){let s=n.map((o)=>{let l=" <item>";if(l+=`
20
- <title>${F(o.title)}</title>`,l+=`
21
- <link>${F(o.link)}</link>`,o.description)l+=`
22
- <description>${F(o.description)}</description>`;if(o.pubDate)l+=`
23
- <pubDate>${o.pubDate.toUTCString()}</pubDate>`;if(o.author)l+=`
24
- <author>${F(o.author)}</author>`;if(o.categories)for(let e of o.categories)l+=`
25
- <category>${F(e)}</category>`;if(o.guid)l+=`
26
- <guid>${F(o.guid)}</guid>`;return l+=`
27
- </item>`,l});return`<?xml version="1.0" encoding="UTF-8"?>
18
+ </urlset>`}function T(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function Vt(t,n){let s=n.map((o)=>{let c=" <item>";if(c+=`
19
+ <title>${T(o.title)}</title>`,c+=`
20
+ <link>${T(o.link)}</link>`,o.description)c+=`
21
+ <description>${T(o.description)}</description>`;if(o.pubDate)c+=`
22
+ <pubDate>${o.pubDate.toUTCString()}</pubDate>`;if(o.author)c+=`
23
+ <author>${T(o.author)}</author>`;if(o.categories)for(let e of o.categories)c+=`
24
+ <category>${T(e)}</category>`;if(o.guid)c+=`
25
+ <guid>${T(o.guid)}</guid>`;return c+=`
26
+ </item>`,c});return`<?xml version="1.0" encoding="UTF-8"?>
28
27
  <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
29
28
  <channel>
30
- <title>${F(t.title)}</title>
31
- <link>${F(t.link)}</link>
32
- <description>${F(t.description)}</description>
29
+ <title>${T(t.title)}</title>
30
+ <link>${T(t.link)}</link>
31
+ <description>${T(t.description)}</description>
33
32
  ${t.language?`<language>${t.language}</language>`:""}
34
- ${t.copyright?`<copyright>${F(t.copyright)}</copyright>`:""}
33
+ ${t.copyright?`<copyright>${T(t.copyright)}</copyright>`:""}
35
34
  <lastBuildDate>${new Date().toUTCString()}</lastBuildDate>
36
35
  <atom:link href="${t.link}/rss.xml" rel="self" type="application/rss+xml"/>
37
36
  ${s.join(`
38
37
  `)}
39
38
  </channel>
40
- </rss>`}async function Vt(t={}){let n=Date.now();on();let s=await a(process.cwd()),o=s.build||{},l=await ut({explicit:t.domain||o.domain,stxConfig:s});if(l.source==="fallback"&&(t.sitemap??o.sitemap??!0))console.warn(dt());let e={router:t.router??s?.router??{},pagesDir:t.pagesDir||o.pagesDir||"pages",outputDir:t.outputDir||o.outputDir||"dist",baseUrl:t.baseUrl||o.baseUrl||"/",domain:l.url,revalidate:t.revalidate??o.revalidate??!1,sitemap:t.sitemap??o.sitemap??!0,sitemapExclude:t.sitemapExclude||o.sitemapExclude||[],robots:t.robots??o.robots??!0,rss:t.rss??o.rss??!1,concurrency:t.concurrency||o.concurrency||10,cache:t.cache??o.cache??!0,cacheDir:t.cacheDir||o.cacheDir||c(process.cwd(),"ssg-cache"),contentLoaders:t.contentLoaders||[],hooks:t.hooks||{},minify:t.minify??o.minify??!0,generate404:t.generate404??o.generate404??!0,publicDir:t.publicDir||o.publicDir||"public",trailingSlash:t.trailingSlash??o.trailingSlash??!1,cleanOutput:t.cleanOutput??o.cleanOutput??!0,cacheSalt:t.cacheSalt??"",partialsDir:t.partialsDir||s?.partialsDir||"",componentsDir:t.componentsDir||s?.componentsDir||"",failOnIncludeError:t.failOnIncludeError??!0,failOnServerScriptError:t.failOnServerScriptError??!0,chunkIslands:t.chunkIslands===!0,prefetchIslands:t.prefetchIslands===!0,integrityIslands:t.integrityIslands===!0},u={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},g=new Set,v=0,w={},p={};await e.hooks.onBuildStart?.();try{if(e.cleanOutput&&D.existsSync(e.outputDir))await D.promises.rm(e.outputDir,{recursive:!0});await D.promises.mkdir(e.outputDir,{recursive:!0});let E=e.cacheSalt;if(!E){let{resolveUserCssConfig:d,fingerprintConfig:m}=await import("./chunk-jmaw2cdt.js");try{E=m(await d(process.cwd()))}catch{}}let{prepareImageDelivery:S}=await import("./chunk-2bggrzv0.js"),R=await S(e.publicDir,e.outputDir);if(R.count>0)console.log(`Optimized ${R.count} image(s) for responsive delivery`),E=[E,R.fingerprint].filter(Boolean).join(":");let A=new pt(e.cacheDir,E);if(e.cache)await A.load();try{let{generateCss:d}=await import("./chunk-jmaw2cdt.js");await d('<div class="bg-black"></div>')}catch{}Et();let wt=s?.routeMiddleware?.dir||"middleware";await $t(process.cwd(),wt);let J=Tt();if(J.length>0)console.log(`Loaded ${J.length} middleware: ${J.join(", ")}`);let yt=s?.routeMiddleware?.global||[];ac(s?.layoutsDir,c(process.cwd()));let Z=X(".",{pagesDir:e.pagesDir,pagesDirs:s?._layerPageDirs});console.log(`Found ${Z.length} routes`);let L=[];for(let d of Z)try{let m=await _t(d);for(let k of m)L.push({route:d,url:k.url,params:k.params,props:k.props,revalidate:k.revalidate??e.revalidate})}catch(m){let k=m instanceof Error?m:Error(String(m));u.failedCount++,u.errors.push({route:d.pattern,error:k}),await e.hooks.onError?.(k,d.pattern),console.error(`Error discovering paths for ${d.pattern}:`,k)}u.totalPages=L.length+u.failedCount,console.log(`Generating ${L.length} pages...`);let U=[],Q=[];for(let d=0;d<L.length;d+=e.concurrency)Q.push(L.slice(d,d+e.concurrency));for(let d of Q)await Promise.all(d.map(async(m)=>{let{route:k,url:h,params:_,props:St,revalidate:rt}=m;try{await e.hooks.onPageStart?.(h);let M=await Bun.file(k.filePath).text(),T=Yt(M),xt=T?.middleware?Array.isArray(T.middleware)?T.middleware:[T.middleware]:[],nt=[...yt,...xt];if(nt.length>0){let B=Rt(h,_,T||{}),N=At(B,null,void 0,{isServer:!0}),j=await Pt(nt,N);if(j.redirect){let C=typeof j.redirect==="string"?j.redirect:j.redirect.path||j.redirect,H=Zt(String(C),h),O=Qt(h,e);await D.promises.mkdir(f.dirname(O),{recursive:!0}),await Bun.write(O,H),u.successCount++,u.pages.push({route:h,outputPath:O,size:Buffer.byteLength(H),cached:!1}),U.push({loc:h,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${h} \u2192 redirect to ${C}`);return}if(j.abort){let C=typeof j.abort==="string"?j.abort:j.abort?.error?.message||"aborted";console.warn(` \u21B3 ${h} \u2014 middleware aborted: ${C}`);return}}let it=T?.validate;if(typeof it==="function")try{if(!await it({params:_})){console.warn(`Validation failed for ${h}, skipping...`);return}}catch{}let I=null,st=!1;if(e.cache){if(I=A.get(h,k.filePath),I)st=!0,u.cachedCount++}if(!I){let B=await mt(k,_,St,e,s);if(I=B.html,e.failOnIncludeError&&B.includeFailures.length>0)throw Error(`${B.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
41
- ${B.includeFailures.join(`
39
+ </rss>`}async function Kt(t={}){let n=Date.now();ln();let s=await a(process.cwd()),o=s.build||{},c=await dt({explicit:t.domain||o.domain,stxConfig:s});if(c.source==="fallback"&&(t.sitemap??o.sitemap??!0))console.warn(gt());let e={router:t.router??s?.router??{},pagesDir:t.pagesDir||o.pagesDir||"pages",outputDir:t.outputDir||o.outputDir||"dist",baseUrl:t.baseUrl||o.baseUrl||"/",domain:c.url,revalidate:t.revalidate??o.revalidate??!1,sitemap:t.sitemap??o.sitemap??!0,sitemapExclude:t.sitemapExclude||o.sitemapExclude||[],robots:t.robots??o.robots??!0,rss:t.rss??o.rss??!1,concurrency:t.concurrency||o.concurrency||10,cache:t.cache??o.cache??!0,cacheDir:t.cacheDir||o.cacheDir||l(process.cwd(),"ssg-cache"),contentLoaders:t.contentLoaders||[],hooks:t.hooks||{},minify:t.minify??o.minify??!0,generate404:t.generate404??o.generate404??!0,publicDir:t.publicDir||o.publicDir||"public",trailingSlash:t.trailingSlash??o.trailingSlash??!1,cleanOutput:t.cleanOutput??o.cleanOutput??!0,cacheSalt:t.cacheSalt??"",partialsDir:t.partialsDir||s?.partialsDir||"",componentsDir:t.componentsDir||s?.componentsDir||"",failOnIncludeError:t.failOnIncludeError??!0,failOnServerScriptError:t.failOnServerScriptError??!0,chunkIslands:t.chunkIslands===!0,prefetchIslands:t.prefetchIslands===!0,integrityIslands:t.integrityIslands===!0},u={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},g=new Set,v=0,S={},p={};await e.hooks.onBuildStart?.();try{if(e.cleanOutput&&R.existsSync(e.outputDir))await R.promises.rm(e.outputDir,{recursive:!0});await R.promises.mkdir(e.outputDir,{recursive:!0});let C=e.cacheSalt;if(!C){let{resolveUserCssConfig:d,fingerprintConfig:y}=await import("./chunk-gmm3kffd.js");try{C=y(await d(process.cwd()))}catch{}}let{prepareImageDelivery:b}=await import("./chunk-1d3swbqw.js"),E=await b(e.publicDir,e.outputDir);if(E.count>0)console.log(`Optimized ${E.count} image(s) for responsive delivery`),C=[C,E.fingerprint].filter(Boolean).join(":");let O=new ft(e.cacheDir,C);if(e.cache)await O.load();try{let{generateCss:d}=await import("./chunk-gmm3kffd.js");await d('<div class="bg-black"></div>')}catch{}Rt();let yt=s?.routeMiddleware?.dir||"middleware";await Pt(process.cwd(),yt);let V=At();if(V.length>0)console.log(`Loaded ${V.length} middleware: ${V.join(", ")}`);let St=s?.routeMiddleware?.global||[];dc(s?.layoutsDir,l(process.cwd()));let Q=Z(".",{pagesDir:e.pagesDir,pagesDirs:s?._layerPageDirs});console.log(`Found ${Q.length} routes`);let U=[];for(let d of Q)try{let y=await Ut(d);for(let D of y)U.push({route:d,url:D.url,params:D.params,props:D.props,revalidate:D.revalidate??e.revalidate})}catch(y){let D=y instanceof Error?y:Error(String(y));u.failedCount++,u.errors.push({route:d.pattern,error:D}),await e.hooks.onError?.(D,d.pattern),console.error(`Error discovering paths for ${d.pattern}:`,D)}u.totalPages=U.length+u.failedCount,console.log(`Generating ${U.length} pages...`);let _=[],tt=[];for(let d=0;d<U.length;d+=e.concurrency)tt.push(U.slice(d,d+e.concurrency));for(let d of tt)await Promise.all(d.map(async(y)=>{let{route:D,url:h,params:M,props:xt,revalidate:nt}=y;try{await e.hooks.onPageStart?.(h);let G=await Bun.file(D.filePath).text(),A=Zt(G),bt=A?.middleware?Array.isArray(A.middleware)?A.middleware:[A.middleware]:[],it=[...St,...bt];if(it.length>0){let j=It(h,M,A||{}),N=Ot(j,null,void 0,{isServer:!0}),F=await Nt(it,N);if(F.redirect){let I=typeof F.redirect==="string"?F.redirect:F.redirect.path||F.redirect,z=Qt(String(I),h),L=te(h,e);await R.promises.mkdir(m.dirname(L),{recursive:!0}),await Bun.write(L,z),u.successCount++,u.pages.push({route:h,outputPath:L,size:Buffer.byteLength(z),cached:!1}),_.push({loc:h,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${h} \u2192 redirect to ${I}`);return}if(F.abort){let I=typeof F.abort==="string"?F.abort:F.abort?.error?.message||"aborted";console.warn(` \u21B3 ${h} \u2014 middleware aborted: ${I}`);return}}let st=A?.validate;if(typeof st==="function")try{if(!await st({params:M})){console.warn(`Validation failed for ${h}, skipping...`);return}}catch{}let B=null,at=!1;if(e.cache){if(B=O.get(h,D.filePath),B)at=!0,u.cachedCount++}if(!B){let j=await wt(D,M,xt,e,s);if(B=j.html,e.failOnIncludeError&&j.includeFailures.length>0)throw Error(`${j.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
40
+ ${j.includeFailures.join(`
42
41
  `)}
43
- Set ssg.failOnIncludeError to false to build anyway.`);if(e.failOnServerScriptError&&B.serverScriptFailures.length>0)throw Error(`${B.serverScriptFailures.length} <script server> block(s) failed, so this page would have shipped with the content they produce missing:
44
- ${B.serverScriptFailures.join(`
42
+ Set ssg.failOnIncludeError to false to build anyway.`);if(e.failOnServerScriptError&&j.serverScriptFailures.length>0)throw Error(`${j.serverScriptFailures.length} <script server> block(s) failed, so this page would have shipped with the content they produce missing:
43
+ ${j.serverScriptFailures.join(`
45
44
  `)}
46
- Set ssg.failOnServerScriptError to false to build anyway.`);if(e.cache)A.set(h,k.filePath,B.dependencies,I)}let G;if(e.trailingSlash)G=f.join(e.outputDir,h,"index.html");else G=h==="/"?f.join(e.outputDir,"index.html"):f.join(e.outputDir,`${h}.html`);if(e.chunkIslands){let{html:B,chunks:N}=ot(I,{integrity:e.integrityIslands,minify:e.minify});if(N.length>0){let j=f.join(e.outputDir,"_stx","islands");await D.promises.mkdir(j,{recursive:!0});for(let C of N){let H=f.join(j,`${C.hash}.js`);if(!await Bun.file(H).exists())await Bun.write(H,C.code);if(!g.has(C.hash)){g.add(C.hash);let O=Buffer.byteLength(C.code,"utf8");v+=O,w[C.hash]={bytes:O,file:`/_stx/islands/${C.hash}.js`}}}if(p[h]=N.map((C)=>C.hash),I=B,e.prefetchIslands)I=ct(I)}}if(await D.promises.mkdir(f.dirname(G),{recursive:!0}),await Bun.write(G,I),!Wt(h,I,T,e.sitemapExclude))U.push({loc:h,lastmod:new Date().toISOString().split("T")[0],priority:h==="/"?1:0.8});let at={route:h,outputPath:G,size:Buffer.byteLength(I,"utf8"),cached:st};if(rt!==!1)at.revalidateAt=Date.now()+rt*1000;u.pages.push(at),u.successCount++,await e.hooks.onPageEnd?.(h,I)}catch(M){u.failedCount++,u.errors.push({route:h,error:M}),await e.hooks.onError?.(M,h),console.error(`Error generating ${h}:`,M)}}));let tt=sn();if(tt.length>0){let d=tt.map((m)=>`${m.filePath}: ${m.message}`).join(`
45
+ Set ssg.failOnServerScriptError to false to build anyway.`);if(e.cache)O.set(h,D.filePath,j.dependencies,B)}let H;if(e.trailingSlash)H=m.join(e.outputDir,h,"index.html");else H=h==="/"?m.join(e.outputDir,"index.html"):m.join(e.outputDir,`${h}.html`);if(e.chunkIslands){let{html:j,chunks:N}=ct(B,{integrity:e.integrityIslands,minify:e.minify});if(N.length>0){let F=m.join(e.outputDir,"_stx","islands");await R.promises.mkdir(F,{recursive:!0});for(let I of N){let z=m.join(F,`${I.hash}.js`);if(!await Bun.file(z).exists())await Bun.write(z,I.code);if(!g.has(I.hash)){g.add(I.hash);let L=Buffer.byteLength(I.code,"utf8");v+=L,S[I.hash]={bytes:L,file:`/_stx/islands/${I.hash}.js`}}}if(p[h]=N.map((I)=>I.hash),B=j,e.prefetchIslands)B=lt(B)}}if(await R.promises.mkdir(m.dirname(H),{recursive:!0}),await Bun.write(H,B),!qt(h,B,A,e.sitemapExclude))_.push({loc:h,lastmod:new Date().toISOString().split("T")[0],priority:h==="/"?1:0.8});let ot={route:h,outputPath:H,size:Buffer.byteLength(B,"utf8"),cached:at};if(nt!==!1)ot.revalidateAt=Date.now()+nt*1000;u.pages.push(ot),u.successCount++,await e.hooks.onPageEnd?.(h,B)}catch(G){u.failedCount++,u.errors.push({route:h,error:G}),await e.hooks.onError?.(G,h),console.error(`Error generating ${h}:`,G)}}));let et=cn();if(et.length>0){let d=et.map((y)=>`${y.filePath}: ${y.message}`).join(`
47
46
  `);throw Error(`Client script bundling failed:
48
- ${d}`)}if(e.cache)await A.save();if(e.generate404){let d=f.join(e.pagesDir,"404.stx");if(await Bun.file(d).exists()){let m=new Set,k={...s,minifyClient:!0,debug:!1,cache:!1},h=await i(await Bun.file(d).text(),{},d,k,m);await Bun.write(f.join(e.outputDir,"404.html"),h)}else await Bun.write(f.join(e.outputDir,"404.html"),`<!DOCTYPE html>
47
+ ${d}`)}if(e.cache)await O.save();if(e.generate404){let d=m.join(e.pagesDir,"404.stx");if(await Bun.file(d).exists()){let y=new Set,D={...s,minifyClient:!0,debug:!1,cache:!1},h=await i(await Bun.file(d).text(),{},d,D,y);await Bun.write(m.join(e.outputDir,"404.html"),h)}else await Bun.write(m.join(e.outputDir,"404.html"),`<!DOCTYPE html>
49
48
  <html lang="en">
50
49
  <head>
51
50
  <meta charset="UTF-8">
@@ -66,7 +65,7 @@ ${d}`)}if(e.cache)await A.save();if(e.generate404){let d=f.join(e.pagesDir,"404.
66
65
  <a href="/">Go home</a>
67
66
  </div>
68
67
  </body>
69
- </html>`)}for(let d of[500]){let m=f.join(e.pagesDir,`${d}.stx`);if(await Bun.file(m).exists()){let k=new Set,h={...s,minifyClient:!0,debug:!1,cache:!1},_=await i(await Bun.file(m).text(),{},m,h,k);await Bun.write(f.join(e.outputDir,`${d}.html`),_)}}let V=f.join(e.pagesDir,"error.stx");if(await Bun.file(V).exists()){let d=new Set,m={...s,minifyClient:!0,debug:!1,cache:!1},k=await i(await Bun.file(V).text(),{},V,m,d);await Bun.write(f.join(e.outputDir,"error.html"),k)}if(e.sitemap&&U.length>0){let d=qt(U,e.domain),m=f.join(e.outputDir,"sitemap.xml");await Bun.write(m,d),u.sitemapPath=m,console.log(`Generated sitemap.xml with ${U.length} URLs`)}if(e.robots!==!1){let d=typeof e.robots==="object"?e.robots:{},m=[...e.sitemapExclude.filter((h)=>typeof h==="string"),...d.disallow||[]],k=As({rules:[{userAgent:d.userAgent||"*",allow:d.allow||["/"],...m.length>0?{disallow:m}:{}}],...d.sitemap!==!1&&u.sitemapPath?{sitemap:new URL("/sitemap.xml",e.domain).href}:{}});await Bun.write(f.join(e.outputDir,"robots.txt"),k),console.log("Generated robots.txt")}if(e.rss){let d=typeof e.rss==="object"?e.rss:{title:"Site Feed",description:"Latest updates",link:e.domain},m=[];if(d.getItems)m=await d.getItems();let k=Jt(d,m),h=f.join(e.outputDir,"rss.xml");await Bun.write(h,k),u.rssPath=h,console.log(`Generated rss.xml with ${m.length} items`)}let z=oc(e.outputDir);if(z.assets>0)console.log(`Externalized ${z.assets} asset(s) from ${z.pages} page(s) (${(z.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);let W=ic(e.outputDir);if(W.assets>0)console.log(`Externalized ${W.assets} repeated asset(s) from ${W.pages} page(s) (${(W.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);if(e.publicDir&&D.existsSync(e.publicDir))await Y(e.publicDir,e.outputDir),console.log(`Copied public assets from ${e.publicDir}`);let et=nr();if(et)await Y(et,f.join(e.outputDir,tr)),console.log(`Copied assets from ${nn}`)}catch(E){throw await e.hooks.onError?.(E),E}if(u.buildTime=Date.now()-n,g.size>0){u.islandChunks={count:g.size,totalBytes:v};let E={generatedChunks:g.size,totalBytes:v,chunks:w,pages:p};await Bun.write(f.join(e.outputDir,"_stx","islands-manifest.json"),JSON.stringify(E,null,2))}await e.hooks.onBuildEnd?.(u);let P=u.islandChunks?`
68
+ </html>`)}for(let d of[500]){let y=m.join(e.pagesDir,`${d}.stx`);if(await Bun.file(y).exists()){let D=new Set,h={...s,minifyClient:!0,debug:!1,cache:!1},M=await i(await Bun.file(y).text(),{},y,h,D);await Bun.write(m.join(e.outputDir,`${d}.html`),M)}}let K=m.join(e.pagesDir,"error.stx");if(await Bun.file(K).exists()){let d=new Set,y={...s,minifyClient:!0,debug:!1,cache:!1},D=await i(await Bun.file(K).text(),{},K,y,d);await Bun.write(m.join(e.outputDir,"error.html"),D)}if(e.sitemap&&_.length>0){let d=Jt(_,e.domain),y=m.join(e.outputDir,"sitemap.xml");await Bun.write(y,d),u.sitemapPath=y,console.log(`Generated sitemap.xml with ${_.length} URLs`)}if(e.robots!==!1){let d=typeof e.robots==="object"?e.robots:{},y=[...e.sitemapExclude.filter((h)=>typeof h==="string"),...d.disallow||[]],D=Os({rules:[{userAgent:d.userAgent||"*",allow:d.allow||["/"],...y.length>0?{disallow:y}:{}}],...d.sitemap!==!1&&u.sitemapPath?{sitemap:new URL("/sitemap.xml",e.domain).href}:{}});await Bun.write(m.join(e.outputDir,"robots.txt"),D),console.log("Generated robots.txt")}if(e.rss){let d=typeof e.rss==="object"?e.rss:{title:"Site Feed",description:"Latest updates",link:e.domain},y=[];if(d.getItems)y=await d.getItems();let D=Vt(d,y),h=m.join(e.outputDir,"rss.xml");await Bun.write(h,D),u.rssPath=h,console.log(`Generated rss.xml with ${y.length} items`)}let W=lc(e.outputDir);if(W.assets>0)console.log(`Externalized ${W.assets} asset(s) from ${W.pages} page(s) (${(W.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);let q=uc(e.outputDir);if(q.assets>0)console.log(`Externalized ${q.assets} repeated asset(s) from ${q.pages} page(s) (${(q.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);if(e.publicDir&&R.existsSync(e.publicDir))await Y(e.publicDir,e.outputDir),console.log(`Copied public assets from ${e.publicDir}`);let rt=or();if(rt)await Y(rt,m.join(e.outputDir,sr)),console.log(`Copied assets from ${on}`)}catch(C){throw await e.hooks.onError?.(C),C}if(u.buildTime=Date.now()-n,g.size>0){u.islandChunks={count:g.size,totalBytes:v};let C={generatedChunks:g.size,totalBytes:v,chunks:S,pages:p};await Bun.write(m.join(e.outputDir,"_stx","islands-manifest.json"),JSON.stringify(C,null,2))}await e.hooks.onBuildEnd?.(u);let P=u.islandChunks?`
70
69
  Island chunks: ${u.islandChunks.count} (${(u.islandChunks.totalBytes/1024).toFixed(1)} KB lifted out of inline HTML)`:"";return console.log(`
71
70
  Build complete!
72
71
  Total: ${u.totalPages} pages
@@ -74,8 +73,8 @@ Build complete!
74
73
  Cached: ${u.cachedCount}
75
74
  Failed: ${u.failedCount}
76
75
  Time: ${u.buildTime}ms${P}
77
- `),u}async function Y(t,n){await D.promises.mkdir(n,{recursive:!0});let s=await D.promises.readdir(t,{withFileTypes:!0});for(let o of s){let l=f.join(t,o.name),e=f.join(n,o.name);if(o.isDirectory())await D.promises.mkdir(e,{recursive:!0}),await Y(l,e);else await D.promises.copyFile(l,e)}}function Kt(t={}){let n=t.cacheDir||c(process.cwd(),"ssg-cache"),s=new ht(n),o=t.revalidate||3600;return{async get(l){let e=await s.get(l);if(!e)return null;if(Date.now()>e.revalidateAfter)this.revalidate(l).catch(console.error);return{html:e.html,headers:{"Cache-Control":`public, max-age=${o}, stale-while-revalidate=${o*2}`,ETag:e.etag,"X-ISR-Generated":new Date(e.generatedAt).toISOString(),...e.headers}}},async revalidate(l){let u=X(".",{pagesDir:t.pagesDir||"pages"}).find((P)=>l.match(P.regex)!==null);if(!u){console.warn(`Route not found for revalidation: ${l}`);return}let g=l.match(u.regex),v={};if(g)u.params.forEach((P,E)=>{v[P]=g[E+1]});let w=await a(),{html:p}=await mt(u,v,{},t,w);await s.set(l,{html:p,generatedAt:Date.now(),revalidateAfter:Date.now()+o*1000,etag:zt(p)}),console.log(`Revalidated: ${l}`)},async invalidate(l){if(typeof l==="string")await s.invalidate(l);else await s.invalidatePattern(l)}}}function Xt(){return{name:"markdown",extensions:[".md",".mdx"],async load(t){let n=await Bun.file(t).text(),s=n.match(/^---\n([\s\S]*?)\n---/),o={},l=n;if(s){let w=s[1];l=n.slice(s[0].length).trim();for(let p of w.split(`
78
- `)){let P=p.indexOf(":");if(P>0){let E=p.slice(0,P).trim(),S=p.slice(P+1).trim();if(S==="true")S=!0;else if(S==="false")S=!1;else if(/^\d+$/.test(S))S=parseInt(S,10);else if(/^\d+\.\d+$/.test(S))S=parseFloat(S);else if(S.startsWith("[")&&S.endsWith("]"))S=S.slice(1,-1).split(",").map((R)=>R.trim().replace(/^['"]|['"]$/g,""));o[E]=S}}}let e=l.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>"),u=[],g=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,v;while((v=g.exec(e))!==null){let w=parseInt(v[1],10),p=v[2],P=p.toLowerCase().replace(/[^a-z0-9]+/g,"-");u.push({id:P,text:p,level:w})}return{content:e,data:o,toc:u}}}}function Yt(t){return vt(t)}function Zt(t,n){return`<!DOCTYPE html>
76
+ `),u}async function Y(t,n){await R.promises.mkdir(n,{recursive:!0});let s=await R.promises.readdir(t,{withFileTypes:!0});for(let o of s){let c=m.join(t,o.name),e=m.join(n,o.name);if(o.isDirectory())await R.promises.mkdir(e,{recursive:!0}),await Y(c,e);else await R.promises.copyFile(c,e)}}function Xt(t={}){let n=t.cacheDir||l(process.cwd(),"ssg-cache"),s=new ht(n),o=t.revalidate||3600;return{async get(c){let e=await s.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=${o}, stale-while-revalidate=${o*2}`,ETag:e.etag,"X-ISR-Generated":new Date(e.generatedAt).toISOString(),...e.headers}}},async revalidate(c){let u=Z(".",{pagesDir:t.pagesDir||"pages"}).find((P)=>c.match(P.regex)!==null);if(!u){console.warn(`Route not found for revalidation: ${c}`);return}let g=c.match(u.regex),v={};if(g)u.params.forEach((P,C)=>{v[P]=g[C+1]});let S=await a(),{html:p}=await wt(u,v,{},t,S);await s.set(c,{html:p,generatedAt:Date.now(),revalidateAfter:Date.now()+o*1000,etag:Wt(p)}),console.log(`Revalidated: ${c}`)},async invalidate(c){if(typeof c==="string")await s.invalidate(c);else await s.invalidatePattern(c)}}}function Yt(){return{name:"markdown",extensions:[".md",".mdx"],async load(t){let n=await Bun.file(t).text(),s=n.match(/^---\n([\s\S]*?)\n---/),o={},c=n;if(s){let S=s[1];c=n.slice(s[0].length).trim();for(let p of S.split(`
77
+ `)){let P=p.indexOf(":");if(P>0){let C=p.slice(0,P).trim(),b=p.slice(P+1).trim();if(b==="true")b=!0;else if(b==="false")b=!1;else if(/^\d+$/.test(b))b=parseInt(b,10);else if(/^\d+\.\d+$/.test(b))b=parseFloat(b);else if(b.startsWith("[")&&b.endsWith("]"))b=b.slice(1,-1).split(",").map((E)=>E.trim().replace(/^['"]|['"]$/g,""));o[C]=b}}}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>"),u=[],g=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,v;while((v=g.exec(e))!==null){let S=parseInt(v[1],10),p=v[2],P=p.toLowerCase().replace(/[^a-z0-9]+/g,"-");u.push({id:P,text:p,level:S})}return{content:e,data:o,toc:u}}}}function Zt(t){return kt(t)}function Qt(t,n){return`<!DOCTYPE html>
79
78
  <html>
80
79
  <head>
81
80
  <meta charset="utf-8">
@@ -87,4 +86,4 @@ Build complete!
87
86
  <p>Redirecting to <a href="${t}">${t}</a>...</p>
88
87
  <script>window.location.replace('${t}')</script>
89
88
  </body>
90
- </html>`}function Qt(t,n){if(t==="/"||t==="")return f.join(n.outputDir,"index.html");let s=t.replace(/^\/|\/$/g,"");if(n.trailingSlash)return f.join(n.outputDir,s,"index.html");return f.join(n.outputDir,`${s}.html`)}var je={generateStaticSite:Vt,createISRHandler:Kt,defineStaticPaths:q,createMarkdownLoader:Xt};export{Kt as createISRHandler,Xt as createMarkdownLoader,Nt as declaresPageAction,je as default,q as defineStaticPaths,Vt as generateStaticSite,Wt as isExcludedFromSitemap};
89
+ </html>`}function te(t,n){if(t==="/"||t==="")return m.join(n.outputDir,"index.html");let s=t.replace(/^\/|\/$/g,"");if(n.trailingSlash)return m.join(n.outputDir,s,"index.html");return m.join(n.outputDir,`${s}.html`)}var Fe={generateStaticSite:Kt,createISRHandler:Xt,defineStaticPaths:J,createMarkdownLoader:Yt};export{Xt as createISRHandler,Yt as createMarkdownLoader,Ht as declaresPageAction,Fe as default,J as defineStaticPaths,Kt as generateStaticSite,qt as isExcludedFromSitemap};
@@ -1,3 +1,4 @@
1
+ import { headCloseIndex } from "./document-tags.js";
1
2
  import { extractVariables } from "./variable-extractor.js";
2
3
  import { evaluateExpression, escapeHtmlValue } from "./expressions.js";
3
4
  import { replacePlaceholders, hasPlaceholders } from "./placeholder.js";
@@ -51,7 +52,7 @@ async function runHydration(compiled, requestContext) {
51
52
  const clean = html.replace(/<script\b[^>]*\bdata-stx-server-data\b[^>]*>[\s\S]*?<\/script>/gi, ""), tag = serverDataTag(context);
52
53
  if (!tag)
53
54
  return clean;
54
- const head = clean.indexOf("</head>");
55
+ const head = headCloseIndex(clean);
55
56
  return head < 0 ? tag + clean : clean.slice(0, head) + tag + clean.slice(head);
56
57
  };
57
58
  if (action.redirect)
@@ -1,3 +1,4 @@
1
+ import { bodyCloseIndex, insertBeforeHeadClose } from "../document-tags.js";
1
2
  export function generateComponentId(componentName, salt = "") {
2
3
  const input = `${componentName}${salt}`;
3
4
  let hash = 0;
@@ -186,8 +187,7 @@ ${scopedCss}
186
187
  switch (position) {
187
188
  case "head":
188
189
  if (template.includes("</head>"))
189
- return template.replace("</head>", `${styleTag}
190
- </head>`);
190
+ return insertBeforeHeadClose(template, styleTag);
191
191
  return styleTag + template;
192
192
  case "body-start":
193
193
  if (template.includes("<body"))
@@ -195,7 +195,7 @@ ${scopedCss}
195
195
  ${styleTag}`);
196
196
  return styleTag + template;
197
197
  case "body-end": {
198
- const csBodyIdx = template.lastIndexOf("</body>");
198
+ const csBodyIdx = bodyCloseIndex(template);
199
199
  if (csBodyIdx !== -1)
200
200
  return template.slice(0, csBodyIdx) + styleTag + `
201
201
  ` + template.slice(csBodyIdx);
package/dist/x-element.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { bodyCloseIndex } from "./document-tags.js";
1
2
  export function generateXElementRuntime() {
2
3
  return `<script data-stx-scoped data-stx-x-element-runtime data-stx-run="always">
3
4
  (function() {
@@ -292,7 +293,7 @@ export function processXElementDirectives(template) {
292
293
  const runtimePattern = /<script\b(?=[^>]*\bdata-stx-x-element-runtime\b)[^>]*>[\s\S]*?<\/script>\s*/gi, existingRuntimes = template.match(runtimePattern) || [], withoutRuntimes = existingRuntimes.length > 0 ? template.replace(runtimePattern, "") : template;
293
294
  if (!hasXElementDirectives(withoutRuntimes))
294
295
  return withoutRuntimes;
295
- const runtime = existingRuntimes[0]?.trim() || generateXElementRuntime(), bodyCloseIdx = withoutRuntimes.lastIndexOf("</body>");
296
+ const runtime = existingRuntimes[0]?.trim() || generateXElementRuntime(), bodyCloseIdx = bodyCloseIndex(withoutRuntimes);
296
297
  if (bodyCloseIdx !== -1)
297
298
  return withoutRuntimes.slice(0, bodyCloseIdx) + runtime + `
298
299
  ` + withoutRuntimes.slice(bodyCloseIdx);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/stx",
3
3
  "type": "module",
4
- "version": "0.2.859",
4
+ "version": "0.2.862",
5
5
  "description": "A performant UI Framework. Powered by Bun.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -127,14 +127,14 @@
127
127
  },
128
128
  "dependencies": {
129
129
  "@stacksjs/clapp": "^0.2.17",
130
- "@stacksjs/desktop": "0.2.859",
131
- "@stacksjs/sanitizer": "0.2.859",
130
+ "@stacksjs/desktop": "0.2.862",
131
+ "@stacksjs/sanitizer": "0.2.862",
132
132
  "@stacksjs/ts-css": "^0.3.21",
133
133
  "@stacksjs/ts-i18n": "^0.1.11",
134
134
  "@types/dom-speech-recognition": "^0.0.12",
135
- "bun-plugin-stx": "0.2.859",
135
+ "bun-plugin-stx": "0.2.862",
136
136
  "bunfig": "^0.15.21",
137
- "stx-router": "0.2.859",
137
+ "stx-router": "0.2.862",
138
138
  "ts-broadcasting": "^0.0.13",
139
139
  "ts-images": "^0.2.22",
140
140
  "ts-syntax-highlighter": "^0.2.1"
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{ih,ah,ch,lh,uh,dh}from"./chunk-0es47pwe.js";export{lh as generateTransitionCSS,uh as generateTransitionRuntime,ih as performEnter,ah as performLeave,dh as processTransitionAttributes,ch as processTransitionDirectives};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{x}from"./chunk-9nh48zvm.js";function et(e,r){let n=y(e,r);return n.ok?{expression:n.expression,endPos:n.endPos}:null}function y(e,r){let n=r;while(n<e.length&&/\s/.test(e[n]))n++;if(e[n]!=="(")return{ok:!1,reason:"missing-open-paren",pos:n};let c=x(e,"(",")",n);if(c===-1)return{ok:!1,reason:"unclosed-paren",pos:n};return{ok:!0,expression:e.slice(n+1,c),endPos:c+1}}function k(e,r){let n=e.lastIndexOf("<",r);if(n===-1)return!1;return n>e.lastIndexOf(">",r)}function kt(e,r,n,c){let o=1,i=c,u=new RegExp(`@${r}\\s*\\(`,"g"),a=new RegExp(`@${n}(?![a-z])`,"g");while(i<e.length&&o>0){u.lastIndex=i,a.lastIndex=i;let p=u.exec(e),t=a.exec(e),s=p?p.index:1/0,f=t?t.index:1/0;if(s<f)o++,i=s+p[0].length;else if(f<1/0){if(o--,o===0)return f;i=f+t[0].length}else break}return-1}function v(e,r){let n=e.slice(r).match(/^@if\s*/);if(!n)return null;let c=r+n[0].length,o=et(e,c);if(!o)return null;let i=o.endPos,u=kt(e,"if","endif",i);if(u===-1)return null;let a=e.slice(i,u),p=[],t=0,s="if",f=o.expression,l=0,g=0;while(t<a.length){let h=a.indexOf("@",t);if(h===-1)break;t=h;let d=a.substring(h);if(k(a,h)){t++;continue}if(/^@if\s*\(/.test(d)){g++,t++;continue}if(/^@endif(?![a-z])/.test(d)){g--,t+=6;continue}if(g===0){let b=d.match(/^@elseif\s*/);if(b){p.push({type:s,condition:f,content:a.substring(l,t),start:i+l,end:i+t});let E=t+b[0].length,m=et(a,E);if(!m){t++;continue}s="elseif",f=m.expression,t=m.endPos,l=t;continue}else if(/^@else(?![a-z])/.test(d)){p.push({type:s,condition:f,content:a.substring(l,t),start:i+l,end:i+t}),s="else",f=void 0,t+=5,l=t;continue}}t++}return p.push({type:s,condition:f,content:a.slice(l),start:i+l,end:i+a.length}),{fullMatch:e.slice(r,u+6),branches:p,start:r,end:u+6}}function fn(e){let r=[],n=/@if\s*\(/g,c=n.exec(e);while(c!==null){if(r.some((u)=>c.index>u.start&&c.index<u.end)){c=n.exec(e);continue}let i=v(e,c.index);if(i)r.push(i),n.lastIndex=i.end;c=n.exec(e)}return r}function Ss(e,r,n){let c=[],o=new RegExp(`@${r}\\s*\\(`,"g"),i=o.exec(e);while(i!==null){if(c.some((d)=>i.index>d.start&&i.index<d.end)){i=o.exec(e);continue}let a=i.index,p=a+i[0].length-1,t=x(e,"(",")",p);if(t===-1){i=o.exec(e);continue}let s=e.slice(p+1,t),f=t+1,l=kt(e,r,n,f);if(l===-1){i=o.exec(e);continue}let g=e.slice(f,l),h=l+`@${n}`.length;c.push({fullMatch:e.slice(a,h),name:r,params:s,content:g,start:a,end:h}),o.lastIndex=h,i=o.exec(e)}return c}function Zo(e,r){let n=e.slice(r).match(/^@switch\s*/);if(!n)return null;let c=r+n[0].length,o=et(e,c);if(!o)return null;let i=o.endPos,u=kt(e,"switch","endswitch",i);if(u===-1)return null;let a=e.slice(i,u),p=[],t=0,s=null,f=0;while(t<a.length){let l=a.slice(t),g=l.match(/^@switch\s*\(/),h=l.match(/^@endswitch(?![a-z])/);if(g){if(f++,s)s.content+=g[0];t+=g[0].length;continue}if(h){if(f--,s)s.content+=h[0];t+=h[0].length;continue}if(f>0){if(s)s.content+=a[t];t++;continue}let d=l.match(/^@case\s*/),b=l.match(/^@default(?![a-z])/),E=l.match(/^@break(?![a-z])/);if(d&&l.startsWith("@case")){if(s)p.push(s);let m=t+d[0].length,P=et(a,m);if(!P){t++;continue}s={type:"case",value:P.expression,content:""},t=P.endPos}else if(b&&l.startsWith("@default")){if(s)p.push(s);s={type:"default",content:""},t+=b[0].length}else if(E&&l.startsWith("@break"))t+=E[0].length;else{if(s)s.content+=a[t];t++}}if(s)p.push(s);return{fullMatch:e.slice(r,u+10),expression:o.expression,cases:p,start:r,end:u+10}}export{et,kt,fn,Ss,Zo};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Hh,Uf,Ze,mc,Vh,us,ds,ps}from"./chunk-2kc0vsnb.js";import"./chunk-8mdhencj.js";import"./chunk-2dnd2s2a.js";import"./chunk-rwxg4m3h.js";import"./chunk-1hebvmaj.js";import"./chunk-b1kc0ka1.js";import"./chunk-wjamjgx6.js";import"./chunk-5rxks14t.js";import"./chunk-9nh48zvm.js";import"./chunk-xppm4cs4.js";import"./chunk-fkh4xece.js";export{Vh as clearOnceStore,mc as onceStore,Ze as partialsCache,us as processIncludes,ds as processStackPushDirectives,ps as processStackReplacements,Hh as resetUnscopedSignalWarnings,Uf as topLevelElements};
@@ -1,20 +0,0 @@
1
- // @bun
2
- import{ke,it,gi,zs,zc,Hc,mi,Vc,Uc,Hs,yi,Wc,qc,bi,wn}from"./chunk-b1kc0ka1.js";import{k}from"./chunk-fkh4xece.js";import{a}from"./chunk-wfd9e224.js";import{ko}from"./chunk-w1d8t47c.js";import{c}from"./chunk-7trdtz0c.js";import{existsSync as B,readFileSync as F}from"fs";import h from"path";var ge=new Set(["module","exports","require","$bool","$num","window","document","console","confirm","alert","fetch"]),te=wn.filter((e)=>!ge.has(e)).sort(),ne=[...k].sort(),he=[...new Set([...te,...ne])].sort(),be=new Set(te),xe=new Set(ne),ye=new Set(he),ee=/\bimport\s+(?!type[\s{])\{([^}]*)\}\s*from\s*(['"])stx\2/g;function Se(e,t){if(t==="server")return`'${e}' is not provided by 'stx' in a <script server> block. The engine binds only its own names there (defineProps, state, useHead, ...); any other name becomes \`await import('stx')\`, which does not resolve, so the whole script fails when the page renders. Import it from '@stacksjs/stx' instead.`;return`'${e}' is not provided by 'stx' in a client <script> block. The import is replaced by the window.stx runtime, which has no '${e}', so it is undefined in the browser.`}function ie(e,t){let s=[];for(let p of t){if(p.offset===void 0)continue;let i=p.kind==="server"?be:xe;ee.lastIndex=0;for(let u of p.code.matchAll(ee)){let f=u.index+u[0].indexOf("{")+1;for(let m of u[1].matchAll(/[^,]+/g)){let b=m[0];if(/^\s*type\s/.test(b))continue;let S=/^\s*([A-Za-z_$][\w$]*)/.exec(b);if(!S)continue;let r=S[1];if(!ye.has(r)||i.has(r))continue;let d=p.offset+f+m.index+S[0].length-r.length,o=e.slice(0,d),w=o.split(`
3
- `).length;s.push({line:w,column:d-(o.lastIndexOf(`
4
- `)+1)+1,offset:d,length:r.length,name:r,kind:p.kind,message:Se(r,p.kind)})}}}return s}import N from"path";var we="@stacksjs/stx-typescript-plugin";function $e(e,t){let s=N.resolve(e);for(;;){let p=N.join(s,"tsconfig.json");if(t(p))return p;let i=N.dirname(s);if(i===s)return;s=i}}function re(e,t,s){let p=$e(e,s);if(!p)return;let i=new Set,u=(f)=>{if(i.has(f))return;i.add(f);let m=t(f);if(!m)return;let b=m.compilerOptions?.plugins;if(Array.isArray(b)){let r=b.find((o)=>o?.name===we),d=Array.isArray(r?.libs)?r.libs.filter((o)=>typeof o==="string"):[];return r?{configPath:f,libs:d.map((o)=>N.resolve(N.dirname(f),o))}:null}let S=typeof m.extends==="string"?[m.extends]:Array.isArray(m.extends)?m.extends:[];for(let r of[...S].reverse()){if(typeof r!=="string"||!r.startsWith("."))continue;let d=N.resolve(N.dirname(f),r.endsWith(".json")?r:`${r}.json`),o=u(d);if(o!==void 0)return o}return};return u(p)??void 0}function fa(e,t="",s="",p=t){let i=e.startLine>1?`
5
- `.repeat(e.startLine-1):"",u=gi(yi(e)+e.code,p),f=zs(u.code),m=e.kind==="client"||e.kind==="plain"?Vc(t,e.code):"",b=(i+f).split(`
6
- `),S=b.length,r=new Map;for(let o of u.declarations)for(let[w,I]of o.text.split(`
7
- `).entries())if(b.push(I),o.origin)r.set(b.length,{...o.origin,line:e.startLine+o.origin.line-1+w,column:w===0?o.origin.column:1});b.push(m,"export {}","");let d=Hs(b.join(`
8
- `),s);return{text:d.code,sourceLineCount:S,lineMap:r,scriptColumns:new Map([...u.columns].map(([o,w])=>[o+e.startLine-1,w])),importColumns:d.columns}}function dm(e,t="",s=""){return fa(e,t,s).text}var ve=new Set(["name","status","length","location","history","origin","closed","close","open","focus","blur","print","scroll","scrollTo","scrollBy","stop","top","parent","self","frames","event","external","menubar","toolbar"]);function Te(e){if(e.length===0)return"";let t=["// Generated \u2014 the composables the runtime publishes as bare globals."],s=new Set(k),p=[];for(let{file:i,names:u}of e){let f=JSON.stringify(i.replace(/\\/g,"/").replace(/\.ts$/,""));p.push(` export * from ${f}`);for(let m of u){if(s.has(m)||ve.has(m))continue;s.add(m),t.push(`declare const ${m}: typeof import(${f})[${JSON.stringify(m)}]`)}}return t.push("declare module '@composables' {",...p,"}"),t.join(`
9
- `)}function ga(e,t,s){return`${e}.__stx_${t}${s}.ts`}function pm(e){return e.replace(/\.__stx_(?:server|client|plain|template)\d+\.ts$/,"")}function Kl(){return oe("stx.d.ts")}function Gl(){return oe("stx-module.d.ts")}function oe(e){for(let t of[h.resolve(import.meta.dir,"..",e),h.resolve(import.meta.dir,"..","..",e)])if(B(t))return t;return null}var De=/^(.*?)\((\d+),(\d+)\):\s+(error|warning)\s+TS(\d+):\s+(.*)$/;function se(e){return e>=1000&&e<2000}function ce(e){let t="",s=!1,p=!1;for(let i=0;i<e.length;i++){let u=e[i];if(s){if(t+=u,p)p=!1;else if(u==="\\")p=!0;else if(u==='"')s=!1;continue}if(u==='"'){s=!0,t+=u;continue}if(u==="/"&&e[i+1]==="/"){while(i<e.length&&e[i]!==`
10
- `)i++;t+=`
11
- `;continue}if(u==="/"&&e[i+1]==="*"){i+=2;while(i<e.length&&!(e[i]==="*"&&e[i+1]==="/"))i++;i++;continue}t+=u}return t.replace(/,(\s*[}\]])/g,"$1")}function Ee(e){try{return JSON.parse(ce(F(e,"utf8")))}catch{return}}function Ne(e){let t=h.resolve(e),s;for(;;){let r=h.join(t,"tsconfig.json");if(B(r)){s=r;break}let d=h.dirname(t);if(d===t)break;t=d}if(!s)return{};let p=new Set,i=s,u,f,m=s;while(i&&!p.has(i)){p.add(i);let r;try{r=JSON.parse(ce(F(i,"utf8")))}catch{break}let d=r?.compilerOptions??{};if(!u&&d.paths&&typeof d.paths==="object")u=d.paths,m=i;if(!f&&typeof d.baseUrl==="string")f=h.resolve(h.dirname(i),d.baseUrl);if(u&&f)break;i=typeof r?.extends==="string"?h.resolve(h.dirname(i),r.extends.endsWith(".json")?r.extends:`${r.extends}.json`):void 0}if(!u)return{};let b=f??h.dirname(m),S={};for(let[r,d]of Object.entries(u)){if(!Array.isArray(d))continue;S[r]=d.map((o)=>typeof o==="string"&&!h.isAbsolute(o)?h.resolve(b,o):o)}return{paths:S}}async function fm(e,t={}){let s=t.client!==!1,p=t.server!==!1,i=t.templates!==!1,u=t.componentsDir??(i?(await a()).componentsDir:void 0),f=new Map,m=new Map,b=[],S=[],r=0,d=0,o=Kl();for(let n of e){let l=await Bun.file(n).text(),y=it(l).filter((g)=>{if(g.kind==="server")return p;return s}),v=it(l).filter((g)=>g.kind==="server").map((g)=>g.code).join(`
12
- `),M=mi(it(l));for(let g of ie(l,y))b.push({file:n,line:g.line,column:g.column,code:0,message:g.message,category:"error",blockKind:g.kind});if(s&&v){let g=y.filter((x)=>x.kind!=="server"),E=[...new Set(g.flatMap((x)=>Uc(v,x.code)))];if(E.length>0)m.set(n,{names:E,line:g[0].startLine,kind:g[0].kind})}let j=h.dirname(h.resolve(n)),D=i?Wc(l,{runtimeGlobals:!o,originDir:j,filePath:h.resolve(n),componentsDir:u}):null,T=D?[...D.lineMap.values()].filter((g)=>g.expression).length:0;if(y.length===0&&T===0)continue;if(S.push(n),r+=y.length,d+=T,y.forEach((g,E)=>{let x=fa(g,v,j,M);f.set(ga(n,g.kind,E),{virtual:x,source:x.text,origin:n,kind:g.kind})}),D&&T>0)f.set(ga(n,"template",0),{source:D.text,origin:n,kind:"template",virtual:D})}if(f.size===0)return{diagnostics:b,checkedFiles:S,blockCount:0,expressionCount:0};let w=(t.extraLibs??[]).map((n)=>h.resolve(n)),I=re(e.length>0?h.dirname(h.resolve(e[0])):process.cwd(),Ee,B);for(let n of I?.libs??[])if(!w.includes(n)&&B(n))w.push(n);if(o)w.push(o);let G=o?Gl():null;if(G)w.push(G);let V=`${c()}/typecheck/__stx_globals.d.ts`,ae=["// Generated \u2014 the context serve.ts injects into <script server> blocks.",zc(o?Hc(F(o,"utf8")):void 0),...o?[]:["declare const window: any",...k.map((n)=>`declare const ${n}: any`)],["// Generated \u2014 the names stx auto-imports from @stacksjs/browser.",...ke.map((n)=>`declare const ${n}: any`)].join(`
13
- `),Te(await ko())].filter(Boolean).join(`
14
- `),_=`${c()}/typecheck`;await Bun.$`rm -rf ${_}`.quiet().nothrow(),await Bun.$`mkdir -p ${_}`.quiet().nothrow(),await Bun.write(V,ae);let C=new Map,le=0;for(let[n,l]of f){let y=`${le++}_${n.replace(/[^\w.-]+/g,"_")}`;await Bun.write(`${_}/${y}`,l.source),C.set(y,l)}let ue={target:"ESNext",module:"ESNext",moduleResolution:"bundler",strict:!0,noEmit:!0,skipLibCheck:!0,allowJs:!0,esModuleInterop:!0,resolveJsonModule:!0,lib:["ESNext","DOM","DOM.Iterable"],types:[],...Ne(e.length>0?h.dirname(h.resolve(e[0])):process.cwd()),...t.compilerOptions??{}},X=async(n,l)=>{let y=`${_}/tsconfig${l===1?"":`.${l}`}.json`;await Bun.write(y,JSON.stringify({compilerOptions:ue,files:n.map((M)=>`${_}/${M}`).concat(V,...w)},null,2));let v=Bun.spawnSync(["bun","x","tsc","-p",y,"--pretty","false"],{stdout:"pipe",stderr:"pipe"});return{output:new TextDecoder().decode(v.stdout)+new TextDecoder().decode(v.stderr),exitCode:v.exitCode??0}},J=await X([...C.keys()],1),U=J.output,R=[],W=J.exitCode,z=0,pe=new Set(w.map((n)=>n.split("/").pop())),q=0,P=new Set,H=(n)=>{for(let l of n.replace(/\n[\t ]+([^\n]*)/g," $1").split(`
15
- `)){let y=l.match(De);if(!y)continue;if(z++,pe.has(y[1].split("/").pop()))q++;let[,v,M,j,D,T,g]=y,E=v.split("/").pop(),x=C.get(E);if(!x)continue;if(se(Number(T)))P.add(E);let A=Number(M),K=Number(j),Y;if(x.virtual){let O=bi(x.virtual,A,K)??(x.kind!=="template"&&se(Number(T))?bi(x.virtual,x.virtual.sourceLineCount,1):null);if(!O||x.kind==="template"&&!O.expression)continue;if(qc(O,Number(T)))continue;A=O.line,K=O.column,Y=O.expression?.code.trim()}R.push({file:x.origin,line:A,column:K,code:Number(T),message:g,category:D==="error"?"error":"warning",blockKind:x.kind,expression:Y})}};H(U);let de=z,fe=q;if(P.size>0&&P.size<C.size){let n=[...C.keys()].filter((l)=>!P.has(l));H((await X(n,2)).output)}if(s)for(let[n,l]of m){if(l.names.length===0)continue;R.push({file:n,line:l.line,column:1,code:0,message:`${l.names.length===1?"1 value reaches":`${l.names.length} values reach`} this block on the implicit bridge and ${l.names.length===1?"is":"are"} untyped: ${l.names.join(", ")}. Declare them with defineClientPayload({ ${l.names.join(", ")} }) in the server block to have them checked.`,category:"warning",blockKind:l.kind})}R.push(...b);let Z=new Set,L=R.filter((n)=>{let l=`${n.file}:${n.line}:${n.column}:${n.code}:${n.message}`;if(Z.has(l))return!1;return Z.add(l),!0});L.sort((n,l)=>n.file.localeCompare(l.file)||n.line-l.line||n.column-l.column);let Q=fe>0&&L.length===0,me=Q||W!==0&&de===0?`${Q?"a file passed with --lib has errors of its own, so nothing in your code was checked":`tsc exited ${W} without reporting any diagnostic, so nothing was checked`}. `+"A syntax error in an ambient declaration file does this \u2014 skipLibCheck suppresses "+`SEMANTIC diagnostics only. tsc said:
16
- ${U.trim().split(`
17
- `).slice(0,12).join(`
18
- `)||"(no output)"}`:void 0;return{diagnostics:L,checkedFiles:S,blockCount:r,expressionCount:d,failure:me}}function gm(e){return e.map((t)=>{let s=t.blockKind==="template"?`[template: ${t.expression??""}]`:`[${t.blockKind==="plain"?"<script>":`<script ${t.blockKind}>`}]`;return`${t.file}:${t.line}:${t.column} ${t.category} TS${t.code} ${t.message} ${s}`}).join(`
19
- `)}
20
- export{fa,dm,ga,pm,Kl,Gl,fm,gm};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Gh,ys,Go,bs,ur,Xo,Jo,Gf,ws,vs,xs,Yo,yc,Xf,St}from"./chunk-3248qphb.js";import"./chunk-5va6c7jf.js";import"./chunk-1hebvmaj.js";import"./chunk-wfd9e224.js";import"./chunk-hf9pvmq2.js";import"./chunk-2sq9pdg3.js";import"./chunk-k8pzk8v9.js";import"./chunk-s4592dy0.js";import"./chunk-g17q4y5k.js";import{V}from"./chunk-b1kc0ka1.js";import"./chunk-wjamjgx6.js";import"./chunk-5rxks14t.js";import"./chunk-9nh48zvm.js";import"./chunk-xppm4cs4.js";import"./chunk-fkh4xece.js";export{Gf as bindLoopInterpolations,Gh as clearScriptScanCache,ws as convertServerLoopAttributesToDirectives,Xo as convertSignalDirectivesToAttributes,vs as convertSignalLoopsToAttributes,ur as extractClientSignalNames,V as extractExports,yc as findMarkupIndexOutsideScripts,bs as hasSignalsSyntax,Go as parseLoopExpression,Jo as preEvalLiteralReactiveIfs,xs as processScriptSetup,Yo as processSignals,Xf as rewriteStxImportSpecifiers,ys as scanScriptTags,St as stripStxRuntimeImports};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Jf,Xh,Jh,Yh,Zh,Yf,Zf,Qh,ey,Qo,ty,fr,gr,ks}from"./chunk-w1stsxm3.js";import{st}from"./chunk-9n8t7v78.js";import"./chunk-b1kc0ka1.js";import"./chunk-wjamjgx6.js";import"./chunk-5rxks14t.js";import"./chunk-9nh48zvm.js";import"./chunk-xppm4cs4.js";import"./chunk-fkh4xece.js";export{Zh as __setSignalsGeneratorsForTest,st as cacheEngineFingerprint,gr as cacheTemplate,fr as checkCache,ty as clearDevCaches,Zf as getCachedRouterScript,Yf as getCachedSignalsRuntime,Qh as getServeClientAsset,Qo as getServeModuleBundle,ks as hashFilePath,Jh as invalidateFileCache,Yh as invalidateFileCacheByDir,Xh as readFileCached,ey as registerServeModuleBundle,Jf as templateCache};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{zo,Ho,Vo,Uh,gs,Wh}from"./chunk-8mdhencj.js";export{gs as clearImageDeliveryCatalog,Uh as deliveredImage,Vo as efficientDeliverySources,zo as getImageDelivery,Ho as isTransparentImage,Wh as prepareImageDelivery};
@@ -1,3 +0,0 @@
1
- // @bun
2
- import{W}from"./chunk-b1kc0ka1.js";function n(t){return W(t)}
3
- export{n};