gemi 0.108.0 → 0.110.0

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 (280) hide show
  1. package/dist/ai/index.js +2 -2
  2. package/dist/ai/index.js.map +1 -1
  3. package/dist/app/index.js +2 -2
  4. package/dist/app/index.js.map +1 -1
  5. package/dist/bin/gemi.js +535 -55
  6. package/dist/bin/gemi.js.map +11 -6
  7. package/dist/bun/plugin.js +2 -2
  8. package/dist/bun/plugin.js.map +1 -1
  9. package/dist/bun/preload.js +2 -2
  10. package/dist/bun/preload.js.map +1 -1
  11. package/dist/{chunk-xpyhmg45.js → chunk-09ypnhjv.js} +3 -3
  12. package/dist/{chunk-3s3awh38.js.map → chunk-09ypnhjv.js.map} +1 -1
  13. package/dist/{chunk-rjernda5.js → chunk-0d9qsmx2.js} +3 -3
  14. package/dist/{chunk-rjernda5.js.map → chunk-0d9qsmx2.js.map} +1 -1
  15. package/dist/{chunk-xg9vye7c.js → chunk-0sjh5v1n.js} +1 -1
  16. package/dist/{chunk-2mhx4e4g.js → chunk-11fsn5mr.js} +3 -3
  17. package/dist/{chunk-2mhx4e4g.js.map → chunk-11fsn5mr.js.map} +1 -1
  18. package/dist/{chunk-wzqkdmjd.js → chunk-1c1d0e60.js} +3 -3
  19. package/dist/{chunk-wzqkdmjd.js.map → chunk-1c1d0e60.js.map} +1 -1
  20. package/dist/{chunk-wedwkqe7.js → chunk-1kr25rcg.js} +3 -3
  21. package/dist/{chunk-wedwkqe7.js.map → chunk-1kr25rcg.js.map} +1 -1
  22. package/dist/{chunk-6wrhc9bq.js → chunk-1pem26zc.js} +3 -3
  23. package/dist/{chunk-6wrhc9bq.js.map → chunk-1pem26zc.js.map} +1 -1
  24. package/dist/{chunk-ydkjf626.js → chunk-1va15sfq.js} +2 -2
  25. package/dist/{chunk-ydkjf626.js.map → chunk-1va15sfq.js.map} +2 -2
  26. package/dist/{chunk-3s3awh38.js → chunk-1yx2e0bh.js} +2 -2
  27. package/dist/{chunk-xpyhmg45.js.map → chunk-1yx2e0bh.js.map} +1 -1
  28. package/dist/{chunk-9r3znmqq.js → chunk-303mprnv.js} +2 -2
  29. package/dist/{chunk-9r3znmqq.js.map → chunk-303mprnv.js.map} +1 -1
  30. package/dist/{chunk-sbyqs03h.js → chunk-30xjcyzh.js} +2 -2
  31. package/dist/{chunk-sbyqs03h.js.map → chunk-30xjcyzh.js.map} +1 -1
  32. package/dist/{chunk-k17prwhx.js → chunk-358sdcx9.js} +3 -3
  33. package/dist/{chunk-k17prwhx.js.map → chunk-358sdcx9.js.map} +1 -1
  34. package/dist/{chunk-2gmgd05c.js → chunk-3cg7y62b.js} +2 -2
  35. package/dist/{chunk-2gmgd05c.js.map → chunk-3cg7y62b.js.map} +1 -1
  36. package/dist/{chunk-t26n9vzw.js → chunk-3y8q8x11.js} +2 -2
  37. package/dist/{chunk-t26n9vzw.js.map → chunk-3y8q8x11.js.map} +1 -1
  38. package/dist/chunk-4mfrgd5m.js +34 -0
  39. package/dist/chunk-4mfrgd5m.js.map +10 -0
  40. package/dist/chunk-5cygrbxv.js +4 -0
  41. package/dist/{chunk-vj2t77x1.js.map → chunk-5cygrbxv.js.map} +2 -2
  42. package/dist/{chunk-tvy2fqza.js → chunk-5stgtwqw.js} +2 -2
  43. package/dist/{chunk-tvy2fqza.js.map → chunk-5stgtwqw.js.map} +1 -1
  44. package/dist/chunk-61f4m5px.js +6 -0
  45. package/dist/chunk-61f4m5px.js.map +12 -0
  46. package/dist/chunk-6chz1ktz.js +9 -0
  47. package/dist/chunk-6chz1ktz.js.map +13 -0
  48. package/dist/{chunk-1rs13253.js → chunk-6vr7f5fq.js} +4 -4
  49. package/dist/{chunk-1rs13253.js.map → chunk-6vr7f5fq.js.map} +1 -1
  50. package/dist/{chunk-2q7m8a16.js → chunk-7tx5y712.js} +2 -2
  51. package/dist/{chunk-2q7m8a16.js.map → chunk-7tx5y712.js.map} +1 -1
  52. package/dist/{chunk-eytdyahy.js → chunk-8afxrmdc.js} +3 -3
  53. package/dist/{chunk-eytdyahy.js.map → chunk-8afxrmdc.js.map} +1 -1
  54. package/dist/{chunk-anp4kv3w.js → chunk-8b2tw2yp.js} +1 -1
  55. package/dist/{chunk-kqff894s.js → chunk-9rchedr4.js} +2 -2
  56. package/dist/{chunk-kqff894s.js.map → chunk-9rchedr4.js.map} +1 -1
  57. package/dist/{chunk-6rz8kyqb.js → chunk-9s851qz8.js} +2 -2
  58. package/dist/{chunk-6rz8kyqb.js.map → chunk-9s851qz8.js.map} +1 -1
  59. package/dist/{chunk-8pynv9rw.js → chunk-a6453d9s.js} +3 -3
  60. package/dist/{chunk-8pynv9rw.js.map → chunk-a6453d9s.js.map} +1 -1
  61. package/dist/{chunk-5wt25tyd.js → chunk-bn5yn731.js} +2 -2
  62. package/dist/{chunk-5wt25tyd.js.map → chunk-bn5yn731.js.map} +1 -1
  63. package/dist/{chunk-zrdbytx4.js → chunk-c098fzvk.js} +2 -2
  64. package/dist/{chunk-zrdbytx4.js.map → chunk-c098fzvk.js.map} +1 -1
  65. package/dist/{chunk-mhq2bd9c.js → chunk-cttmy1jp.js} +4 -4
  66. package/dist/{chunk-mhq2bd9c.js.map → chunk-cttmy1jp.js.map} +2 -2
  67. package/dist/{chunk-331s9wqr.js → chunk-cy5qp6mz.js} +3 -3
  68. package/dist/{chunk-331s9wqr.js.map → chunk-cy5qp6mz.js.map} +1 -1
  69. package/dist/{chunk-kh273hj0.js → chunk-ddr4qvvt.js} +3 -3
  70. package/dist/{chunk-kh273hj0.js.map → chunk-ddr4qvvt.js.map} +1 -1
  71. package/dist/chunk-e1n8zs3h.js +58 -0
  72. package/dist/chunk-e1n8zs3h.js.map +14 -0
  73. package/dist/{chunk-2xqrh6d0.js → chunk-et4pv1b1.js} +1 -1
  74. package/dist/{chunk-a1g0bahx.js → chunk-frerzsxq.js} +2 -2
  75. package/dist/{chunk-a1g0bahx.js.map → chunk-frerzsxq.js.map} +1 -1
  76. package/dist/{chunk-pj2e1p07.js → chunk-gb37722w.js} +3 -3
  77. package/dist/{chunk-pj2e1p07.js.map → chunk-gb37722w.js.map} +1 -1
  78. package/dist/chunk-h3864a8z.js +17 -0
  79. package/dist/{chunk-ncfxmtd5.js.map → chunk-h3864a8z.js.map} +14 -11
  80. package/dist/{chunk-661wezaf.js → chunk-h4sw6nt3.js} +3 -3
  81. package/dist/{chunk-661wezaf.js.map → chunk-h4sw6nt3.js.map} +1 -1
  82. package/dist/{chunk-m31pfz1s.js → chunk-he7z7y9j.js} +2 -2
  83. package/dist/{chunk-m31pfz1s.js.map → chunk-he7z7y9j.js.map} +1 -1
  84. package/dist/{chunk-kstvyvr0.js → chunk-hf7a51s3.js} +2 -2
  85. package/dist/{chunk-kstvyvr0.js.map → chunk-hf7a51s3.js.map} +1 -1
  86. package/dist/chunk-hn67spz6.js +5 -0
  87. package/dist/{chunk-mrvcaakf.js.map → chunk-hn67spz6.js.map} +1 -1
  88. package/dist/{chunk-fq3sb3xt.js → chunk-jbrwt3cs.js} +4 -4
  89. package/dist/{chunk-fq3sb3xt.js.map → chunk-jbrwt3cs.js.map} +1 -1
  90. package/dist/{chunk-jnw73s8c.js → chunk-k1vw22t2.js} +2 -2
  91. package/dist/{chunk-jnw73s8c.js.map → chunk-k1vw22t2.js.map} +1 -1
  92. package/dist/chunk-k1xt2tw7.js +4 -0
  93. package/dist/{chunk-hdhahvd4.js.map → chunk-k1xt2tw7.js.map} +2 -2
  94. package/dist/chunk-k9wgtrc5.js +24 -0
  95. package/dist/{chunk-h2hdpm70.js.map → chunk-k9wgtrc5.js.map} +4 -4
  96. package/dist/{chunk-00y49jcf.js → chunk-kf71mjxa.js} +3 -3
  97. package/dist/{chunk-00y49jcf.js.map → chunk-kf71mjxa.js.map} +1 -1
  98. package/dist/{chunk-kqz8jp6v.js → chunk-m6ystvtk.js} +2 -2
  99. package/dist/{chunk-kqz8jp6v.js.map → chunk-m6ystvtk.js.map} +1 -1
  100. package/dist/{chunk-ftgd68se.js → chunk-mb7q7s0a.js} +3 -3
  101. package/dist/{chunk-ftgd68se.js.map → chunk-mb7q7s0a.js.map} +1 -1
  102. package/dist/{chunk-rh9j8cwv.js → chunk-mn5xw79b.js} +3 -3
  103. package/dist/{chunk-rh9j8cwv.js.map → chunk-mn5xw79b.js.map} +1 -1
  104. package/dist/{chunk-wsftnxzs.js → chunk-mwqg079k.js} +2 -2
  105. package/dist/{chunk-wsftnxzs.js.map → chunk-mwqg079k.js.map} +1 -1
  106. package/dist/{chunk-yebaheh7.js → chunk-nncz308h.js} +3 -3
  107. package/dist/{chunk-yebaheh7.js.map → chunk-nncz308h.js.map} +1 -1
  108. package/dist/{chunk-82hpq0bq.js → chunk-nsvktvp4.js} +2 -2
  109. package/dist/{chunk-82hpq0bq.js.map → chunk-nsvktvp4.js.map} +1 -1
  110. package/dist/{chunk-h7pafjej.js → chunk-nvv9wej6.js} +3 -3
  111. package/dist/{chunk-h7pafjej.js.map → chunk-nvv9wej6.js.map} +1 -1
  112. package/dist/chunk-p1aqq0ga.js +16 -0
  113. package/dist/{chunk-q7y9v2v5.js.map → chunk-p1aqq0ga.js.map} +5 -8
  114. package/dist/chunk-p7r2w4qw.js +5 -0
  115. package/dist/{chunk-h3t4n0bn.js.map → chunk-p7r2w4qw.js.map} +2 -2
  116. package/dist/{chunk-fwympxqk.js → chunk-pwmgqq7z.js} +2 -2
  117. package/dist/{chunk-fwympxqk.js.map → chunk-pwmgqq7z.js.map} +1 -1
  118. package/dist/chunk-pyj7cd9t.js +4 -0
  119. package/dist/{chunk-q2fyp44f.js.map → chunk-pyj7cd9t.js.map} +2 -2
  120. package/dist/{chunk-9mqqr05d.js → chunk-q9s7kwgt.js} +3 -3
  121. package/dist/{chunk-9mqqr05d.js.map → chunk-q9s7kwgt.js.map} +1 -1
  122. package/dist/{chunk-9hbwvcxn.js → chunk-qd2v93y4.js} +2 -2
  123. package/dist/{chunk-9hbwvcxn.js.map → chunk-qd2v93y4.js.map} +1 -1
  124. package/dist/{chunk-tyhrrnp5.js → chunk-rfcygmf5.js} +3 -3
  125. package/dist/{chunk-tyhrrnp5.js.map → chunk-rfcygmf5.js.map} +1 -1
  126. package/dist/{chunk-4rr9wmh8.js → chunk-s6jjy4y9.js} +2 -2
  127. package/dist/{chunk-4rr9wmh8.js.map → chunk-s6jjy4y9.js.map} +1 -1
  128. package/dist/{chunk-njkk498k.js → chunk-sq2wkynk.js} +2 -2
  129. package/dist/{chunk-njkk498k.js.map → chunk-sq2wkynk.js.map} +1 -1
  130. package/dist/{chunk-kda25fn4.js → chunk-td8tha3j.js} +3 -3
  131. package/dist/{chunk-kda25fn4.js.map → chunk-td8tha3j.js.map} +1 -1
  132. package/dist/{chunk-cfsscms3.js → chunk-tk5q8hkv.js} +4 -4
  133. package/dist/{chunk-cfsscms3.js.map → chunk-tk5q8hkv.js.map} +2 -2
  134. package/dist/{chunk-1npdp1w2.js → chunk-tq85n8zh.js} +2 -2
  135. package/dist/{chunk-1npdp1w2.js.map → chunk-tq85n8zh.js.map} +1 -1
  136. package/dist/{chunk-gqpge54c.js → chunk-twnn7r66.js} +2 -2
  137. package/dist/{chunk-gqpge54c.js.map → chunk-twnn7r66.js.map} +1 -1
  138. package/dist/chunk-w7jsh3xd.js +5 -0
  139. package/dist/{chunk-9jz4rggd.js.map → chunk-w7jsh3xd.js.map} +2 -2
  140. package/dist/{chunk-we2sj339.js → chunk-wsttx9rg.js} +2 -2
  141. package/dist/{chunk-we2sj339.js.map → chunk-wsttx9rg.js.map} +1 -1
  142. package/dist/{chunk-47rgq59q.js → chunk-wvsv1jgg.js} +2 -2
  143. package/dist/{chunk-47rgq59q.js.map → chunk-wvsv1jgg.js.map} +1 -1
  144. package/dist/chunk-x78jrs4y.js +4 -0
  145. package/dist/{chunk-ffagkj3x.js.map → chunk-x78jrs4y.js.map} +2 -2
  146. package/dist/chunk-xk930yaw.js +5 -0
  147. package/dist/{chunk-rn2kgbg4.js.map → chunk-xk930yaw.js.map} +2 -2
  148. package/dist/chunk-xkc7ftnq.js +9 -0
  149. package/dist/chunk-xkc7ftnq.js.map +10 -0
  150. package/dist/{chunk-564zfdd1.js → chunk-yer1r3t3.js} +2 -2
  151. package/dist/{chunk-564zfdd1.js.map → chunk-yer1r3t3.js.map} +1 -1
  152. package/dist/{chunk-v52dyw0q.js → chunk-yqavgpwd.js} +3 -3
  153. package/dist/{chunk-v52dyw0q.js.map → chunk-yqavgpwd.js.map} +1 -1
  154. package/dist/{chunk-hyfzw1fk.js → chunk-z10cas5r.js} +2 -2
  155. package/dist/{chunk-hyfzw1fk.js.map → chunk-z10cas5r.js.map} +1 -1
  156. package/dist/{chunk-h4x7cba0.js → chunk-zhs1r1z0.js} +3 -3
  157. package/dist/{chunk-h4x7cba0.js.map → chunk-zhs1r1z0.js.map} +1 -1
  158. package/dist/chunks/{ThemeProvider-Cqfwr6dk.js → ThemeProvider-BgLyzzOL.js} +8 -2
  159. package/dist/chunks/ThemeProvider-BgLyzzOL.js.map +1 -0
  160. package/dist/client/ClientRouterContext.d.ts.map +1 -1
  161. package/dist/client/ServerDataProvider.d.ts +2 -0
  162. package/dist/client/ServerDataProvider.d.ts.map +1 -1
  163. package/dist/client/createRoot.d.ts.map +1 -1
  164. package/dist/client/index.d.ts +2 -0
  165. package/dist/client/index.d.ts.map +1 -1
  166. package/dist/client/index.js +127 -4
  167. package/dist/client/index.js.map +1 -1
  168. package/dist/client/islands.d.ts +127 -0
  169. package/dist/client/islands.d.ts.map +1 -0
  170. package/dist/config/index.d.ts +8 -1
  171. package/dist/config/index.d.ts.map +1 -1
  172. package/dist/config/index.js +1 -1
  173. package/dist/config/index.js.map +2 -2
  174. package/dist/console/run.js +2 -2
  175. package/dist/console/run.js.map +1 -1
  176. package/dist/container/index.js +2 -2
  177. package/dist/container/index.js.map +1 -1
  178. package/dist/database/index.js +2 -2
  179. package/dist/database/index.js.map +1 -1
  180. package/dist/email/index.js +2 -2
  181. package/dist/email/index.js.map +1 -1
  182. package/dist/facades/Lang.d.ts +7 -1
  183. package/dist/facades/Lang.d.ts.map +1 -1
  184. package/dist/facades/index.js +2 -2
  185. package/dist/facades/index.js.map +1 -1
  186. package/dist/foundation/index.js +2 -2
  187. package/dist/foundation/index.js.map +1 -1
  188. package/dist/http/CorsMiddleware.d.ts +13 -0
  189. package/dist/http/CorsMiddleware.d.ts.map +1 -1
  190. package/dist/http/Middleware.d.ts +11 -0
  191. package/dist/http/Middleware.d.ts.map +1 -1
  192. package/dist/http/ViewRouter.d.ts +67 -0
  193. package/dist/http/ViewRouter.d.ts.map +1 -1
  194. package/dist/http/index.d.ts +1 -1
  195. package/dist/http/index.d.ts.map +1 -1
  196. package/dist/http/index.js +2 -2
  197. package/dist/http/index.js.map +1 -1
  198. package/dist/i18n/dictionaryRuntime.js +2 -2
  199. package/dist/i18n/dictionaryRuntime.js.map +1 -1
  200. package/dist/i18n/index.js +2 -2
  201. package/dist/i18n/index.js.map +1 -1
  202. package/dist/internal/islandRuntime.d.ts +45 -0
  203. package/dist/internal/islandRuntime.d.ts.map +1 -0
  204. package/dist/kernel/index.js +2 -2
  205. package/dist/kernel/index.js.map +1 -1
  206. package/dist/orm/context.d.ts +24 -0
  207. package/dist/orm/context.d.ts.map +1 -1
  208. package/dist/orm/index.d.ts +1 -1
  209. package/dist/orm/index.d.ts.map +1 -1
  210. package/dist/orm/index.js +3 -3
  211. package/dist/orm/index.js.map +2 -2
  212. package/dist/server/devFetch.d.ts.map +1 -1
  213. package/dist/server/httpDev.d.ts.map +1 -1
  214. package/dist/server/httpProd.d.ts.map +1 -1
  215. package/dist/server/idleTimeout.d.ts +24 -0
  216. package/dist/server/idleTimeout.d.ts.map +1 -0
  217. package/dist/server/index.js +2 -2
  218. package/dist/server/index.js.map +1 -1
  219. package/dist/server/modulePreloads.d.ts +18 -0
  220. package/dist/server/modulePreloads.d.ts.map +1 -1
  221. package/dist/server/styles.d.ts +3 -1
  222. package/dist/server/styles.d.ts.map +1 -1
  223. package/dist/services/index.d.ts +1 -0
  224. package/dist/services/index.d.ts.map +1 -1
  225. package/dist/services/index.js +3 -3
  226. package/dist/services/index.js.map +2 -2
  227. package/dist/services/middleware/MiddlewareRegistry.d.ts +13 -2
  228. package/dist/services/middleware/MiddlewareRegistry.d.ts.map +1 -1
  229. package/dist/services/queue/work.js +2 -2
  230. package/dist/services/queue/work.js.map +1 -1
  231. package/dist/services/router/DomainRouter.d.ts +10 -0
  232. package/dist/services/router/DomainRouter.d.ts.map +1 -1
  233. package/dist/services/router/ViewRouteDispatcher.d.ts +30 -2
  234. package/dist/services/router/ViewRouteDispatcher.d.ts.map +1 -1
  235. package/dist/services/router/createFlatViewRoutes.d.ts +13 -1
  236. package/dist/services/router/createFlatViewRoutes.d.ts.map +1 -1
  237. package/dist/services/router/staticCache.d.ts +23 -0
  238. package/dist/services/router/staticCache.d.ts.map +1 -0
  239. package/dist/services/router/staticDocument.d.ts +66 -0
  240. package/dist/services/router/staticDocument.d.ts.map +1 -0
  241. package/dist/stats/bundleStats.d.ts +104 -0
  242. package/dist/stats/bundleStats.d.ts.map +1 -0
  243. package/dist/stats/route-table.d.ts +2 -0
  244. package/dist/stats/route-table.d.ts.map +1 -0
  245. package/dist/stats/route-table.js +4 -0
  246. package/dist/stats/route-table.js.map +11 -0
  247. package/dist/stats/routeTable.d.ts +25 -0
  248. package/dist/stats/routeTable.d.ts.map +1 -0
  249. package/dist/stats/run.d.ts +43 -0
  250. package/dist/stats/run.d.ts.map +1 -0
  251. package/dist/support/index.js +2 -2
  252. package/dist/support/index.js.map +1 -1
  253. package/dist/testing/index.js +1 -1
  254. package/dist/vite/index.mjs +173 -2
  255. package/dist/vitest/index.d.ts +18 -0
  256. package/dist/vitest/index.d.ts.map +1 -1
  257. package/dist/vitest/index.js +2 -2
  258. package/dist/vitest/index.js.map +3 -3
  259. package/package.json +2 -1
  260. package/dist/chunk-9jz4rggd.js +0 -5
  261. package/dist/chunk-b9av1sgb.js +0 -58
  262. package/dist/chunk-b9av1sgb.js.map +0 -14
  263. package/dist/chunk-cewyag0d.js +0 -6
  264. package/dist/chunk-cewyag0d.js.map +0 -11
  265. package/dist/chunk-ffagkj3x.js +0 -4
  266. package/dist/chunk-h2hdpm70.js +0 -24
  267. package/dist/chunk-h3t4n0bn.js +0 -5
  268. package/dist/chunk-hdhahvd4.js +0 -4
  269. package/dist/chunk-k9qmr2wa.js +0 -9
  270. package/dist/chunk-k9qmr2wa.js.map +0 -10
  271. package/dist/chunk-mrvcaakf.js +0 -5
  272. package/dist/chunk-ncfxmtd5.js +0 -17
  273. package/dist/chunk-q2fyp44f.js +0 -4
  274. package/dist/chunk-q7y9v2v5.js +0 -18
  275. package/dist/chunk-rn2kgbg4.js +0 -5
  276. package/dist/chunk-vj2t77x1.js +0 -4
  277. package/dist/chunks/ThemeProvider-Cqfwr6dk.js.map +0 -1
  278. /package/dist/{chunk-xg9vye7c.js.map → chunk-0sjh5v1n.js.map} +0 -0
  279. /package/dist/{chunk-anp4kv3w.js.map → chunk-8b2tw2yp.js.map} +0 -0
  280. /package/dist/{chunk-2xqrh6d0.js.map → chunk-et4pv1b1.js.map} +0 -0
@@ -0,0 +1,14 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../server/httpDev.ts", "../server/devFetch.ts", "../server/renderErrorPage.ts", "../server/hmrPort.ts", "../server/hmrRelay.ts"],
4
+ "sourcesContent": [
5
+ "import { join } from \"node:path\";\n\nimport { createServer } from \"vite\";\n\nimport { App } from \"../app\";\nimport gemiVite from \"../vite\";\nimport { Instrumentation } from \"./types\";\nimport { printStartupBanner } from \"./banner\";\nimport { GEMI_EXTERNAL_SPECIFIERS } from \"../internal/gemiExternals\";\nimport { createDevFetch, sendErrorToClient, ssrRunner } from \"./devFetch\";\nimport { resolveHmrPort } from \"./hmrPort\";\nimport { serverIdleTimeout } from \"./idleTimeout\";\nimport {\n type HmrRelayData,\n hmrRelayHandler,\n hmrRelayPort,\n isHmrUpgrade,\n listenHmrServer,\n upgradeHmr,\n} from \"./hmrRelay\";\n\nexport { viteErrorPayload } from \"./devFetch\";\n\nconst rootDir = process.cwd();\nconst appDir = join(rootDir, \"app\");\n\n// `bun --hot` re-evaluates the module graph on every server-code change. A\n// syntax error or top-level throw in app code therefore fails during *module\n// load* — outside any request, and before `httpDev` re-runs — so Bun only\n// prints it to the console. Bun surfaces these as `unhandledRejection` (the\n// reload re-imports the entry and the failing dynamic import rejects), so hook\n// that here and forward it to the client. Registered once; process listeners\n// persist across reloads.\nif (!globalThis.__gemiErrorHooked) {\n globalThis.__gemiErrorHooked = true;\n process.on(\"unhandledRejection\", (reason) => {\n console.error(reason);\n sendErrorToClient(reason);\n });\n process.on(\"uncaughtException\", (err) => {\n console.error(err);\n sendErrorToClient(err);\n });\n}\n\nexport async function httpDev(app: App, instrumentation: Instrumentation) {\n // Same override the prod server honors (`httpProd.ts`). Read here rather than\n // inline at `Bun.serve` because the HMR port is derived from it.\n const httpPort = Number(process.env.PORT) || 5173;\n // The same `SERVER_IDLE_TIMEOUT` `gemi start` honours (#787), so a long-poll\n // that works in production is not cut at Bun's 10s here. Read before Vite\n // starts so a bad value fails the boot first. Upgraded sockets, the HMR relay\n // among them, are not subject to it.\n const idleTimeout = serverIdleTimeout();\n\n // `bun --hot` re-runs this module on every server-code change, so keep a\n // single Vite server on `globalThis` instead of spawning a new one (and a new\n // HMR socket) on each reload.\n const isReload = Boolean(globalThis.__gemiVite);\n const vite = (globalThis.__gemiVite ??= await createServer({\n // gemi owns the Vite setup — the app has no `vite.config.mjs` to discover.\n // Register the gemi plugin explicitly instead; it loads `gemi.config.ts` and\n // appends the app's Vite plugins (e.g. `@vitejs/plugin-react`, which serves\n // `/@react-refresh` and the HMR preamble referenced below).\n configFile: false,\n plugins: [gemiVite()],\n server: {\n middlewareMode: true,\n // The page's own port, so the HMR client's fallback (\"direct\") socket\n // also targets this server rather than Vite's default 5173.\n port: httpPort,\n // In middleware mode Vite would stand up a second HTTP server for the HMR\n // websocket on a fixed port — so two `gemi dev` processes fought over one\n // socket, and a proxy or tunnel, which carries only the page's port,\n // could not reach it at all. Hand Vite a loopback server instead, on a\n // port of this process's own (see `hmrPort.ts` for how it is chosen):\n // given a server, Vite tells the browser to connect to the page's origin,\n // and `Bun.serve` below relays that socket to it (see `hmrRelay.ts`).\n // `ws` and not the older `hmr`: `server.hmr.{port,host,…}` is\n // deprecated in Vite 8 and warns. An app overriding either one in\n // `gemi.config.ts` still wins — plugin config (where `gemi.config.ts`'s\n // `vite` block is applied) is merged over this inline config, and Vite's\n // own `hmr`→`ws` compat shim forwards the deprecated spelling here.\n ws: { server: await listenHmrServer(resolveHmrPort(httpPort)) },\n // Vite answers any host other than `localhost` and `*.localhost` with a\n // 403, which would block a `route.domains` root such as `lvh.me` and\n // every custom domain pointed here from `/etc/hosts`.\n allowedHosts: app.devAllowedHosts.call(app),\n // gemi reloads `.env` into process.env itself (see `watchEnv`). Stop Vite\n // from *also* watching env files: Vite's env-change handler restarts the\n // dev server, which closes the SSR module runner — but gemi keeps a single\n // Vite instance across `bun --hot` reloads, so an in-flight view import\n // hits the closed runner (\"Vite module runner has been closed\"). Ignoring\n // env files here only disables the restart; env *loading* at startup (and\n // `import.meta.env`) is unaffected.\n watch: {\n ignored: (file: string) => {\n const base = file.split(/[/\\\\]/).pop() ?? \"\";\n return base === \".env\" || base.startsWith(\".env.\");\n },\n },\n },\n appType: \"custom\",\n // Views are loaded through this SSR graph while the renderer\n // (react-dom/server in ViewRouteDispatcher) is imported by Bun.\n // Dedupe so Vite can never resolve a second React copy — a mismatch makes\n // the SSR dispatcher null (\"Invalid hook call\") after an HMR reload.\n resolve: { dedupe: [\"react\", \"react-dom\"] },\n // Pre-bundle the whole React surface the client uses in one pass. The client\n // imports `react-dom/client` (`init.tsx`) and `react-dom` (`createPortal` in\n // `HttpReload.tsx`); if only the first is discovered at startup, the first\n // request to a module using the second triggers a *second* optimize pass,\n // and the already-served page ends up importing a now-stale dep — surfacing\n // as \"does not provide an export named 't'\". Listing them up front bundles\n // them together so no re-optimization (and no version skew) happens.\n optimizeDeps: { include: [\"react\", \"react-dom\", \"react-dom/client\"] },\n // `gemi` is a linked package, so Vite would otherwise compile its own copy\n // into this graph — giving views a *different* `RouteStateContext` (and\n // other module-level singletons) than the Bun-loaded renderer's `Root`\n // provider, so `useRouteData()` reads the empty default (`i18n` undefined).\n // Externalizing makes view imports of `gemi/*` resolve to the one Bun\n // instance. Vite's `ssr.external` matches exact specifiers (subpaths are NOT\n // covered by the bare name, and regexes are ignored here), so every subpath\n // a view might import must be listed — see `internal/gemiExternals`, the\n // shared source of truth this and the SSR build (`vite/index.ts`) both use.\n ssr: {\n external: [...GEMI_EXTERNAL_SPECIFIERS],\n },\n }));\n\n process.env.ROOT_DIR = rootDir;\n process.env.APP_DIR = appDir;\n\n const devFetch = createDevFetch(app, instrumentation, vite);\n // `null` when an app's own `server.ws` in `gemi.config.ts` sent Vite's\n // websocket elsewhere; the browser then connects there directly.\n const relayPort = hmrRelayPort(vite.config?.server?.ws);\n const server = Bun.serve<HmrRelayData>({\n port: httpPort,\n idleTimeout,\n fetch: (req, server) => {\n if (relayPort !== null && isHmrUpgrade(req)) {\n return upgradeHmr(req, server, relayPort);\n }\n return devFetch(req);\n },\n websocket: hmrRelayHandler,\n });\n\n // `bun --hot` re-evaluates its *whole* module graph on a server-code change —\n // node_modules included — so after a reload `react`, `react-dom/server` and the\n // Bun-loaded `gemi` are all fresh instances. This Vite server is not reloaded\n // with them (it is deliberately kept on `globalThis` above), and its SSR runner\n // still holds every view module it has evaluated — each bound, through the\n // externalized `gemi/*` imports, to the *previous* `gemi` and therefore the\n // previous `react`. The next render then sets the dispatcher on the new React\n // while a cached view calls hooks on the old one: \"Invalid hook call\", a null\n // `dispatcher.useContext` thrown from `useRouteData` inside a view nobody\n // touched. Editing a *view* never showed it — Vite's own watcher invalidates\n // that module, so it re-evaluates against the new instances. Editing a\n // server-only file (`app/config/*`, a feature declaration, a controller) is\n // the case with nothing to invalidate the views, so drop the evaluated\n // modules here, once per reload.\n //\n // Here and not before `Bun.serve`, with nothing awaited in between, because\n // both sides of the swap have to see a consistent pair. Until that call\n // returns the *previous* fetch handler is still serving — old dispatcher, old\n // `react-dom/server` — and a request landing there after an early clear would\n // re-evaluate its views against the *new* `gemi`: the same mismatch, reversed.\n // After it, the new handler is live and must not be given the stale ones. The\n // two statements are synchronous neighbours, so no request can be dispatched\n // between them.\n //\n // Only the *evaluated* modules go: the server-side transform cache is\n // untouched, so this costs a re-evaluation and not a re-transform. Clearing\n // the module graph as well would not have been enough anyway — externalized\n // deps (`gemi`, and React through it) are cached in the runner by URL and\n // carry no invalidation flag, which is exactly where the stale React hides.\n if (isReload) {\n ssrRunner(vite).clearCache();\n }\n\n // On a reload `app` has already been rebuilt with the new code and Bun.serve\n // above has swapped in the new fetch handler, so the updated controllers are\n // live *now*. Tell the client to re-run its queries only at this point —\n // firing it from Vite's file watcher instead races Bun's reload and leaves\n // the UI one change behind.\n if (isReload) {\n // We got here, so the reload succeeded. Recover from any error that was\n // showing: a standalone error page must be fully reloaded to get the app\n // back, whereas an overlay pushed onto a live page is cleared by the\n // client's `http-reload` handler (no jarring full-page reload). A normal\n // reload just re-runs client queries against the now-live controllers.\n if (globalThis.__gemiErrorActive && globalThis.__gemiErrorPageServed) {\n globalThis.__gemiErrorActive = false;\n globalThis.__gemiErrorPageServed = false;\n vite.ws.send({ type: \"full-reload\" });\n } else {\n globalThis.__gemiErrorActive = false;\n vite.ws.send({ type: \"custom\", event: \"http-reload\" });\n }\n } else {\n // First start (not a `bun --hot` reload) — print the startup banner once.\n printStartupBanner({ port: server.port, rootDir });\n }\n\n return server;\n}\n",
6
+ "import { stringEraRefusal } from \"../http/Error\";\nimport { join } from \"node:path\";\nimport { IncomingMessage, ServerResponse } from \"node:http\";\nimport { Socket } from \"node:net\";\n\nimport type { RunnableDevEnvironment, ViteDevServer } from \"vite\";\n\nimport type { App } from \"../app\";\nimport { isApiPath } from \"../services/router/apiPath\";\nimport { renderErrorPage } from \"./renderErrorPage\";\nimport { createDevStyles } from \"./styles\";\nimport type { Instrumentation } from \"./types\";\nimport { ISLAND_ENTRY_QUERY } from \"../internal/islandRuntime\";\n\n// Run a Web `Request` through Vite's Connect middleware.\n// Resolves to a `Response` when Vite handles the request (module transforms,\n// assets, the HMR client, ...), or `null` when it calls `next()` — which, with\n// `appType: \"custom\"`, it does for everything it doesn't own.\nfunction viteMiddleware(vite: ViteDevServer, request: Request): Promise<Response | null> {\n const url = new URL(request.url);\n\n const req = new IncomingMessage(new Socket());\n req.url = url.pathname + url.search;\n req.method = request.method;\n req.headers = Object.fromEntries(request.headers);\n\n const res = new ServerResponse(req);\n const chunks: Buffer[] = [];\n\n return new Promise((resolve) => {\n res.write = ((chunk: any) => {\n if (chunk) chunks.push(Buffer.from(chunk));\n return true;\n }) as typeof res.write;\n\n res.end = ((chunk?: any) => {\n if (chunk && typeof chunk !== \"function\") chunks.push(Buffer.from(chunk));\n\n const headers = new Headers();\n for (const [key, value] of Object.entries(res.getHeaders())) {\n if (value == null) continue;\n for (const v of Array.isArray(value) ? value : [value]) {\n headers.append(key, String(v));\n }\n }\n\n resolve(\n new Response(chunks.length ? Buffer.concat(chunks) : null, {\n status: res.statusCode,\n headers,\n }),\n );\n return res;\n }) as typeof res.end;\n\n vite.middlewares(req, res, () => resolve(null));\n });\n}\n\ndeclare global {\n // Created once and reused across `bun --hot` reloads (see below).\n var __gemiVite: ViteDevServer | undefined;\n // Guards one-time registration of the process error hooks across reloads.\n var __gemiErrorHooked: boolean | undefined;\n // An error overlay is currently showing on the client (clear it on recovery).\n var __gemiErrorActive: boolean | undefined;\n // We served a standalone error *page* (not just a pushed overlay), so the\n // visible document has no live app — recovery needs a full page reload.\n var __gemiErrorPageServed: boolean | undefined;\n}\n\n// Build the `> 1 | ...\\n | ^` codeframe Vite's overlay renders — must\n// match its `codeframeRE` (a `<line> | <text>` line followed by a `| ^` line,\n// each ending in a newline).\nfunction codeFrame(lineText: string, line: number, column: number) {\n const gutter = String(line);\n const pad = \" \".repeat(gutter.length);\n const caret = \" \".repeat(Math.max(0, column - 1)) + \"^\";\n return `${gutter} | ${lineText}\\n${pad} | ${caret}\\n`;\n}\n\n// Normalize whatever Bun/JS throws into the { message, stack, frame, loc }\n// shape Vite's error overlay consumes. Two cases matter:\n// - a real `Error` (runtime top-level throw) carries a proper `.stack`;\n// - a Bun `BuildMessage` (syntax error) has NO `.stack`, only a `.position`\n// ({ file, line, column, lineText }) — so synthesize a codeframe + loc from\n// it, otherwise the overlay shows a bare message with no location.\n// (An `Error` instance also JSON-stringifies to `{}`, so fields are copied by\n// hand either way.)\nexport function viteErrorPayload(err: any) {\n if (err && typeof err === \"object\") {\n const pos = err.position;\n if (pos && typeof pos === \"object\" && typeof pos.file === \"string\") {\n return {\n message: typeof err.message === \"string\" ? err.message : String(err),\n stack: \"\",\n frame:\n typeof pos.lineText === \"string\"\n ? codeFrame(pos.lineText, pos.line, pos.column)\n : undefined,\n loc: { file: pos.file, line: pos.line, column: pos.column },\n };\n }\n return {\n message: typeof err.message === \"string\" ? err.message : String(err),\n stack: typeof err.stack === \"string\" ? err.stack : \"\",\n };\n }\n return { message: String(err), stack: \"\" };\n}\n\n// Push an error into the browser via Vite's HMR socket. `__gemiVite` persists\n// across `bun --hot` reloads, so this works even when the reload that produced\n// the error never got far enough to (re)run `httpDev`.\nexport function sendErrorToClient(err: any) {\n const vite = globalThis.__gemiVite;\n if (!vite) return;\n vite.ws.send({ type: \"error\", err: viteErrorPayload(err) as any });\n globalThis.__gemiErrorActive = true;\n}\n\n/**\n * The SSR environment's module runner — what `vite.ssrLoadModule` is a thin\n * (and, in Vite 8, deprecated) wrapper over. Going through it directly is what\n * gives `httpDev` a handle on the evaluated-module cache it has to drop after a\n * `bun --hot` reload; `ssrLoadModule` keeps its own runner private.\n *\n * Duck-typed rather than `isRunnableDevEnvironment(environment)`: this server\n * outlives the module instance that created it, and after a reload the freshly\n * evaluated `vite` brings a *new* `RunnableDevEnvironment` class object, so the\n * `instanceof` that predicate performs is false for a perfectly runnable\n * environment. (The same one-copy-per-reload rule this whole dance is about.)\n */\nexport function ssrRunner(vite: ViteDevServer) {\n const environment = vite.environments.ssr as RunnableDevEnvironment;\n if (typeof environment?.runner?.import !== \"function\") {\n throw new Error(\"gemi dev requires a runnable Vite SSR environment.\");\n }\n return environment.runner;\n}\n\n/**\n * The dev document's single bootstrap module. It loads, in this order:\n *\n * 1. `/refresh.js` — the React Refresh preamble;\n * 2. `/@vite/client` — the HMR client;\n * 3. `/app/client.tsx` — the app.\n *\n * One module, because React emits every `bootstrapModules` entry as\n * `<script type=\"module\" async>`, and async module scripts run in whatever\n * order they finish loading. The preamble has to have installed\n * `window.$RefreshReg$` before any component module evaluates, or\n * `@vitejs/plugin-react`'s transform throws \"can't detect preamble\" and the\n * app never hydrates. Awaiting each `import()` is what makes the order a\n * guarantee rather than a race.\n *\n * The preamble and the HMR client are each caught: an app without\n * `@vitejs/plugin-react` has no `/@react-refresh` and needs no preamble, and a\n * broken HMR client must not stop the app from booting. The app's own import\n * is not caught, so its errors surface as they would from a script tag.\n */\nexport const DEV_ENTRY_PATH = \"/@gemi/dev-entry.js\";\n\nexport const DEV_ENTRY_SOURCE = `const report = (error) => console.error(error);\nawait import(\"/refresh.js\").catch(report);\nawait import(\"/@vite/client\").catch(report);\nawait import(\"/app/client.tsx\");\n`;\n\n/**\n * Installs the React Refresh preamble, as `@vitejs/plugin-react`'s own\n * `index.html` transform would.\n *\n * The runtime is imported by an origin-relative URL. An absolute one, built\n * from the request URL the server sees, breaks behind a TLS-terminating proxy\n * or tunnel: the browser is on `https://<tunnel>` while the server sees\n * `http://localhost:5173`, so the import is blocked as mixed content or points\n * at a host the browser cannot reach.\n */\nexport const REFRESH_PREAMBLE_SOURCE = `import RefreshRuntime from \"/@react-refresh\";\nRefreshRuntime.injectIntoGlobalHook(window);\nwindow.$RefreshReg$ = () => {};\nwindow.$RefreshSig$ = () => (type) => type;\nwindow.__vite_plugin_react_preamble_installed__ = true;\n`;\n\n/**\n * The scripts the dev document loads that nothing on disk backs: the\n * bootstrap entry above, `/refresh.js` with the React Refresh preamble, and\n * `/render-error.js`, which the dev error page loads. `null` for any other\n * path.\n *\n * Answered inside the global middleware, not in front of it as they were. They\n * have no production counterpart, but a gate that must hold in dev as well,\n * one that refuses traffic without a header, is only complete if nothing the\n * dev server answers goes around it.\n */\nfunction devScript(req: Request): Response | null {\n const { pathname } = new URL(req.url);\n const script = (source: string) =>\n new Response(source, {\n headers: {\n \"Content-Type\": \"application/javascript\",\n },\n });\n if (pathname === DEV_ENTRY_PATH) {\n return script(DEV_ENTRY_SOURCE);\n }\n if (pathname.startsWith(\"/render-error.js\")) {\n return script(\"window.render_error = true\");\n }\n if (pathname.startsWith(\"/refresh.js\")) {\n return script(REFRESH_PREAMBLE_SOURCE);\n }\n return null;\n}\n\n/**\n * The dev server's `fetch` handler, apart from `Bun.serve` and from creating\n * Vite, so a test can hand it a stub Vite server and drive it with plain\n * `Request`s. `httpDev` is the only other caller. This module has no import\n * side effects, unlike `httpDev.ts`, which installs process-wide error hooks.\n */\nexport function createDevFetch(\n app: App,\n instrumentation: Instrumentation,\n vite: ViteDevServer,\n): (req: Request) => Promise<Response> {\n const appDir = join(process.cwd(), \"app\");\n\n return async (req) => {\n const { pathname } = new URL(req.url);\n const errorResponse = (err: any): Response => {\n // Errors thrown *while handling a request* (a controller throwing, a\n // failing view import, ...) never hit `httpDev`'s module-load hooks,\n // so surface them here: forward to the overlay for any already-open\n // page, and render an error page for this response so a fresh load\n // (which has no live HMR socket yet) still shows the failure.\n console.error(err);\n vite.ssrFixStacktrace?.(err);\n sendErrorToClient(err);\n\n if (isApiPath(pathname)) {\n return new Response(\n JSON.stringify({\n error: stringEraRefusal(\"server_error\", err?.message ?? String(err), 500),\n }),\n {\n status: 500,\n headers: { \"Content-Type\": \"application/json\" },\n },\n );\n }\n\n // This document has no live app (so no HttpReload listener to clear the\n // overlay) — remember that, so recovery forces a full page reload.\n globalThis.__gemiErrorPageServed = true;\n return new Response(renderErrorPage(viteErrorPayload(err)), {\n status: 500,\n headers: { \"Content-Type\": \"text/html\" },\n });\n };\n const requestHandler = async (req: Request): Promise<Response> => {\n const script = devScript(req);\n if (script) {\n return script;\n }\n try {\n const handler = app.fetch.bind(app);\n const result = (await viteMiddleware(vite, req)) ?? (await handler(req));\n if (result instanceof Response) {\n return result;\n }\n\n const viewImportMap = {};\n const ogMap = {};\n const viewModules = {};\n const template = (viewName: string, path: string) =>\n `\"${viewName}\": () => import(\"${path}\")`;\n const templates = [];\n\n for (const fileName of [\"404\", ...app.getFlatComponentTree.call(app)]) {\n if (process.env.NODE_ENV === \"test\") {\n break;\n }\n const appDir = `${process.env.APP_DIR}`;\n const mod = await ssrRunner(vite).import(`${appDir}/views/${fileName}.tsx`);\n\n viewImportMap[fileName] = mod.default;\n ogMap[fileName] = mod?.OpenGraph;\n // The whole module, so a streaming render can put the view's\n // `Loading`/`Error` exports into the shell it sends.\n viewModules[fileName] = mod;\n // Emit a root-relative URL (`/app/views/Foo.tsx`), NOT the absolute\n // filesystem path the runner import above uses. The browser's\n // `window.loaders` preload and `client.tsx`'s `import.meta.glob` map\n // must import the exact same URL — otherwise Vite serves the module\n // under two URLs (`/app/views/Foo.tsx` vs `/Users/.../app/views/Foo.tsx`)\n // and loads/instantiates the view twice.\n templates.push(template(fileName, `/app/views/${fileName}.tsx`));\n }\n\n const loaders = `{${templates.join(\",\")}}`;\n\n return await result({\n getStyles: async (currentViews: string[], options?: { static?: boolean; layout?: string }) =>\n await createDevStyles(appDir, vite, currentViews, options?.layout),\n // Vite serves app files by their root-relative path; the island\n // entry is that path plus the plugin's query.\n resolveIsland: (moduleKey: string) => ({\n src: `/${moduleKey}${ISLAND_ENTRY_QUERY}`,\n preload: [],\n }),\n bootstrapModules: [DEV_ENTRY_PATH],\n viewImportMap,\n viewModules,\n ogMap,\n loaders,\n cssManifest: {},\n });\n } catch (err: any) {\n return errorResponse(err);\n }\n };\n\n // In front of Vite's middleware, the dev scripts and the app, as\n // `httpProd` puts the global middleware in front of its static files, so a\n // check that passes here passes there. A throw from it is answered like\n // one from a route. Vite's HMR websocket is the one thing it cannot cover:\n // its upgrade is relayed to Vite by `Bun.serve` (see `hmrRelay.ts`) before\n // this handler runs, and Vite checks the token and host itself.\n return await instrumentation(req, (req) =>\n app.withGlobalMiddleware(req, requestHandler, errorResponse),\n );\n };\n}\n",
7
+ "function cleanupTerminalText(text) {\n return (\n text\n // Remove ANSI escape sequences (colors, formatting)\n .replace(/\\x1b\\[[0-9;]*m/g, \"\")\n // Remove ANSI escape sequences with different format\n .replace(/\\[[0-9;]*m/g, \"\")\n // Remove excessive whitespace and normalize line breaks\n .replace(/\\n\\s*\\n/g, \"\\n\")\n // Trim each line\n .split(\"\\n\")\n .map((line) => line.trim())\n .filter((line) => line.length > 0)\n .join(\"\\n\")\n .trim()\n );\n}\n\nexport function renderErrorPage(err: any) {\n return `\n<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta\n name=\"viewport\"\n content=\"width=device-width, initial-scale=1.0\"\n />\n\n <title>Error</title>\n <style>\n body {\n font-family: Arial, sans-serif;\n padding: 20px;\n }\n h1 {\n color: red;\n }\n </style>\n </head>\n <body>\n <div id=\"overlay\"></div>\n <script type=\"module\" src=\"/refresh.js\"></script>\n <script type=\"module\" src=\"/@vite/client\"></script>\n <script>\n ${cleanupTerminalText.toString()}\n const err = ${JSON.stringify(err, Object.getOwnPropertyNames(err), 2)}\n\n window.addEventListener('load', () => {\n const container = document.getElementById('overlay')\n const ErrorOverlay = customElements.get('vite-error-overlay')\n if (ErrorOverlay) {\n const overlay = new ErrorOverlay({ ...err, message: cleanupTerminalText(err.message) });\n container.appendChild(overlay)\n }\n })\n </script>\n </body>\n</html>\n`;\n}\n",
8
+ "// Vite's HMR websocket needs a port of its own, and in middleware mode Vite\n// always picks the same one.\n//\n// `httpDev` runs Vite with `middlewareMode: true`, so Vite has no HTTP server of\n// its own to hang the websocket off — it stands up a second HTTP server just for\n// the upgrade. When nothing names a port, that server binds Vite's default 24678\n// in *every* `gemi dev` process. `PORT` moves the Bun server and nothing else, so\n// a second dev server logs\n//\n// WebSocket server error: Port undefined is already in use\n//\n// and carries on with a dead socket. (Vite logs that failure rather than throwing\n// — which is why the symptom is not a crash but pages that hot-reload on the\n// *other* checkout's edits: their `/@vite/client` was told 24678, and 24678 is\n// the first server's.) So gemi names the port instead of letting Vite default it.\n//\n// Why derive from the HTTP port rather than just scan for a free one: two dev\n// servers must already differ in `PORT` to run at all, so deriving makes their\n// HMR ports differ *before* either one binds anything. A scan alone would hand\n// both the same port when they start at the same moment, each having probed\n// before the other bound. The scan is still here, for the port being taken by\n// something that is not a gemi dev server.\n\nconst VITE_DEFAULT_HTTP_PORT = 5173;\nconst VITE_DEFAULT_HMR_PORT = 24678;\n\n// A port is 16 bits.\nconst MAX_PORT = 65535;\n\n// How far to walk up from the derived port before giving up. Large enough that\n// only a pathological machine exhausts it, small enough to fail in well under a\n// second rather than appearing to hang.\nconst SEARCH_WINDOW = 64;\n\n/**\n * Bind-test a port the same way Vite will.\n *\n * Vite calls `wsHttpServer.listen(port, host)` with no host unless one is\n * configured, so its websocket server takes the wildcard address — which is what\n * this binds too. The match matters: a wildcard bind collides with a wildcard\n * *or* a loopback holder, while a loopback bind only collides with loopback. A\n * process holding `127.0.0.1:P` alone therefore reads as free here, correctly —\n * Vite would fail to bind `*:P` against it, but nothing in gemi makes Vite bind\n * loopback-only, so that case cannot arise from a second `gemi dev`.\n *\n * Only `EADDRINUSE` counts as taken. Any other failure — a permission error, an\n * unroutable address — is not something a different port would fix, so it is\n * reported free and left for Vite to surface.\n */\nfunction isPortFree(port: number): boolean {\n try {\n const listener = Bun.listen({\n hostname: \"0.0.0.0\",\n port,\n socket: { data() {} },\n });\n // `true` closes active connections too. There are none — nothing has been\n // told this port exists yet — but it also makes the close synchronous, so\n // the port is released before the next probe or before Vite binds it.\n listener.stop(true);\n return true;\n } catch (error) {\n return (error as { code?: string })?.code !== \"EADDRINUSE\";\n }\n}\n\n/**\n * Pick the port for Vite's HMR websocket, given the port the dev server's HTTP\n * side is on.\n *\n * `5173` returns `24678` — Vite's two defaults stay paired, so a single dev\n * server behaves exactly as it did before, and anything pointed at 24678 (a\n * firewall rule, a container port mapping, a note in a README) keeps working.\n * Every other HTTP port is offset by the same distance, so distinct `PORT`s\n * always yield distinct HMR ports.\n *\n * @param isFree Injected for tests. Production callers use the bind test above.\n */\nexport function resolveHmrPort(\n httpPort: number,\n isFree: (port: number) => boolean = isPortFree,\n): number {\n let start = VITE_DEFAULT_HMR_PORT + (httpPort - VITE_DEFAULT_HTTP_PORT);\n\n // A high `PORT` can push the derived port past the top of the range — or so\n // close to it that the walk would run off the end. Fall back to the default\n // and let the scan sort it out; being *adjacent* to another server's port is\n // fine, landing *on* it is what has to be avoided, and the scan does that.\n //\n // There is deliberately no matching floor. The offset is only -5173, so the\n // lowest a real HTTP port can derive is 19505 (from `PORT=0`) — a guard for\n // the bottom of the range would be a branch no input can take.\n if (start > MAX_PORT - SEARCH_WINDOW) {\n start = VITE_DEFAULT_HMR_PORT;\n }\n\n for (let port = start; port < start + SEARCH_WINDOW; port++) {\n if (isFree(port)) return port;\n }\n\n throw new Error(\n `Could not find a free port for Vite's HMR websocket: tried ${start}-${\n start + SEARCH_WINDOW - 1\n }. Set one explicitly in gemi.config.ts as \\`vite: { server: { ws: { port } } }\\`.`,\n );\n}\n",
9
+ "import { createServer, type Server as NodeServer } from \"node:http\";\n\nimport type { Server, ServerWebSocket, WebSocketHandler } from \"bun\";\n\n// Vite's HMR websocket, carried on the dev server's own port.\n//\n// In middleware mode Vite has no HTTP server of its own, so by default it\n// stands up a second one for the websocket, on a second port (see\n// `hmrPort.ts`), and tells the browser to connect to `<page host>:<that port>`.\n// A reverse proxy or tunnel (ngrok, a container port mapping, a phone on the\n// LAN through https) only carries the port the page came from, so HMR could\n// not connect there, and the client logged connection failures forever.\n//\n// Vite can attach its websocket to a server it is handed (`server.ws.server`)\n// instead, and then tells the browser to connect to the page's own origin. That\n// server has to be a Node `http.Server`; the dev server is `Bun.serve`. So:\n//\n// - the Node server Vite is handed listens on loopback only, on the port\n// `resolveHmrPort` picked, and answers nothing but websocket upgrades;\n// - `Bun.serve` accepts the browser's upgrade on the page's origin and relays\n// frames both ways to that loopback server.\n//\n// The relay forwards the browser's `Host` and `Origin` and the request's query\n// (the `token`), so Vite still runs its own host and token checks against what\n// the browser actually sent.\n\n/** The subprotocols Vite's client opens its sockets with. */\nconst VITE_PROTOCOLS = new Set([\"vite-hmr\", \"vite-ping\"]);\n\n/**\n * Start the loopback Node server Vite attaches its HMR websocket to.\n * Everything but an upgrade gets `426 Upgrade Required`, as Vite's own\n * websocket server answers.\n */\nexport async function listenHmrServer(port: number): Promise<NodeServer> {\n const server = createServer((_req, res) => {\n res.writeHead(426, { \"Content-Type\": \"text/plain\" });\n res.end(\"Upgrade Required\");\n });\n await new Promise<void>((resolve, reject) => {\n server.once(\"error\", reject);\n server.listen(port, \"127.0.0.1\", () => {\n server.off(\"error\", reject);\n resolve();\n });\n });\n return server;\n}\n\n/**\n * The loopback port to relay to, read from the config Vite actually resolved,\n * so an app that set its own `server.ws` in `gemi.config.ts` is relayed to\n * where Vite really is, or not relayed at all. `null` when Vite was not given\n * a server (its websocket is then on a port of its own, and the client goes\n * there directly) or when HMR is off.\n */\nexport function hmrRelayPort(wsConfig: unknown): number | null {\n if (!wsConfig || typeof wsConfig !== \"object\") return null;\n const server = (wsConfig as { server?: { address?: () => unknown } }).server;\n const address = server?.address?.();\n if (address && typeof address === \"object\" && \"port\" in address) {\n return Number((address as { port: number }).port) || null;\n }\n return null;\n}\n\n/** Whether a request is the Vite client opening its HMR (or ping) socket. */\nexport function isHmrUpgrade(req: Request): boolean {\n if (req.headers.get(\"upgrade\")?.toLowerCase() !== \"websocket\") return false;\n return VITE_PROTOCOLS.has(req.headers.get(\"sec-websocket-protocol\") ?? \"\");\n}\n\nexport type HmrRelayData = {\n /** The socket to Vite, already open when the browser's is accepted. */\n upstream: WebSocket;\n /** Frames Vite sent before the browser's socket opened (its `connected`). */\n early: (string | Uint8Array)[];\n browser?: ServerWebSocket<HmrRelayData>;\n};\n\ntype Frame = string | Uint8Array;\n\nconst frameOf = (data: unknown): Frame =>\n typeof data === \"string\" ? data : new Uint8Array(data as ArrayBuffer);\n\n/**\n * Open the socket to Vite first, and accept the browser's upgrade only once\n * Vite has accepted it. Returns `undefined` once Bun has taken the request\n * over, or a refusal.\n *\n * The order matters. Vite refuses a socket whose host is not in\n * `allowedHosts`, or a cross-origin one without its token. Had the browser's\n * socket been accepted first and closed when Vite refused, the client would\n * read that as \"server connection lost\", ping (which Vite always answers),\n * and reload the page, forever. Refused before it opens, the client logs one\n * \"failed to connect to websocket\" and the page keeps working.\n */\nexport async function upgradeHmr(\n req: Request,\n server: Server<HmrRelayData>,\n port: number,\n): Promise<Response | undefined> {\n const url = new URL(req.url);\n const protocol = req.headers.get(\"sec-websocket-protocol\") ?? \"vite-hmr\";\n // `Host` is what Vite's `allowedHosts` check reads; the URL's host is the\n // same value `Bun.serve` derived it from.\n const headers: Record<string, string> = {\n host: req.headers.get(\"host\") ?? url.host,\n };\n const origin = req.headers.get(\"origin\");\n if (origin) headers.origin = origin;\n\n const upstream = new WebSocket(\n `ws://127.0.0.1:${port}${url.pathname}${url.search}`,\n {\n protocols: [protocol],\n headers,\n } as any,\n );\n upstream.binaryType = \"arraybuffer\";\n const data: HmrRelayData = { upstream, early: [] };\n\n upstream.onmessage = (event) => {\n const frame = frameOf(event.data);\n if (data.browser) data.browser.send(frame);\n else data.early.push(frame);\n };\n upstream.onclose = (event) => {\n data.browser?.close(sendableCloseCode(event.code), event.reason);\n };\n upstream.onerror = () => {\n // A `close` follows; it ends the browser's socket if there is one.\n };\n\n const opened = await new Promise<boolean>((resolve) => {\n upstream.addEventListener(\"open\", () => resolve(true), { once: true });\n upstream.addEventListener(\"close\", () => resolve(false), { once: true });\n });\n if (!opened) {\n return new Response(\"Vite refused the HMR websocket\", { status: 403 });\n }\n\n const upgraded = server.upgrade(req, {\n // The browser fails a connection whose response does not echo the\n // subprotocol it asked for.\n headers: { \"Sec-WebSocket-Protocol\": protocol },\n data,\n });\n if (!upgraded) {\n upstream.close();\n return new Response(\"WebSocket upgrade failed\", { status: 400 });\n }\n return undefined;\n}\n\n// A close code that may be sent in a close frame. 1005, 1006 and 1015 are\n// reported locally and never sent.\nfunction sendableCloseCode(code: number): number {\n if (\n code === 1000 ||\n (code >= 1001 && code <= 1003) ||\n (code >= 1007 && code <= 1014)\n ) {\n return code;\n }\n if (code >= 3000 && code <= 4999) return code;\n return 1000;\n}\n\n/** `Bun.serve`'s `websocket` option: relays frames to and from Vite. */\nexport const hmrRelayHandler: WebSocketHandler<HmrRelayData> = {\n open(ws: ServerWebSocket<HmrRelayData>) {\n const data = ws.data;\n for (const frame of data.early) ws.send(frame);\n data.early = [];\n data.browser = ws;\n // Vite may have hung up while the upgrade was in flight.\n if (data.upstream.readyState !== WebSocket.OPEN) ws.close(1000);\n },\n message(ws: ServerWebSocket<HmrRelayData>, message) {\n if (ws.data.upstream.readyState === WebSocket.OPEN) {\n ws.data.upstream.send(message);\n }\n },\n close(ws: ServerWebSocket<HmrRelayData>) {\n const { upstream } = ws.data;\n if (upstream.readyState <= WebSocket.OPEN) upstream.close();\n },\n};\n"
10
+ ],
11
+ "mappings": ";weAAA,SAAS,QAET,iBAAS,QCDT,SAAS,OACT,oBAAS,cAAiB,OAC1B,WAAS,MCHT,SAAS,CAAmB,CAAC,EAAM,CACjC,OACE,EAEG,QAAQ,kBAAmB,EAAE,EAE7B,QAAQ,cAAe,EAAE,EAEzB,QAAQ,WAAY;AAAA,CAAI,EAExB,MAAM;AAAA,CAAI,EACV,IAAI,CAAC,IAAS,EAAK,KAAK,CAAC,EACzB,OAAO,CAAC,IAAS,EAAK,OAAS,CAAC,EAChC,KAAK;AAAA,CAAI,EACT,KAAK,EAIL,SAAS,CAAe,CAAC,EAAU,CACxC,MAAO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e,EAAK,EAAiB,CAAI,EAGpD,EAAY,EAAa,EAAK,QAAQ,QAAQ,EAAE,EAChD,EAAS,IAAI,MAAoB,CACrC,KAAM,EACN,cACA,MAAO,CAAC,EAAK,IAAW,CACtB,GAAI,IAAc,MAAQ,EAAa,CAAG,EACxC,OAAO,EAAW,EAAK,EAAQ,CAAS,EAE1C,OAAO,EAAS,CAAG,GAErB,UAAW,CACb,CAAC,EA+BD,GAAI,EACF,EAAU,CAAI,EAAE,WAAW,EAQ7B,GAAI,EAMF,GAAI,WAAW,mBAAqB,WAAW,sBAC7C,WAAW,kBAAoB,GAC/B,WAAW,sBAAwB,GACnC,EAAK,GAAG,KAAK,CAAE,KAAM,aAAc,CAAC,EAEpC,gBAAW,kBAAoB,GAC/B,EAAK,GAAG,KAAK,CAAE,KAAM,SAAU,MAAO,aAAc,CAAC,EAIvD,OAAmB,CAAE,KAAM,EAAO,KAAM,SAAQ,CAAC,EAGnD,OAAO",
12
+ "debugId": "C4BD7D0F6372987464756E2164756E21",
13
+ "names": []
14
+ }
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import"./chunk-3s3awh38.js";function R(f,D){let P=new Map;for(let p of[...D.tables].sort())P.set(p,{name:p,columns:[],primaryKey:[],relations:[]});for(let{table:p,...s}of D.columns)P.get(p)?.columns.push(s);for(let{table:p,column:s}of D.primaryKeys)P.get(p)?.primaryKey.push(s);let d=new Map;for(let p of D.foreignKeys){let s=P.get(p.table);if(!s)continue;let M=`${p.table}\x00${p.key}`,q=d.get(M);if(!q)q={name:p.name,columns:[],referencedTable:p.referencedTable,referencedColumns:[],onDelete:p.onDelete,onUpdate:p.onUpdate},d.set(M,q),s.relations.push(q);q.columns.push(p.column),q.referencedColumns.push(p.referencedColumn)}return{dialect:f,tables:[...P.values()]}}async function h(f,D){let P=await f.unsafe(`
2
+ import"./chunk-1yx2e0bh.js";function R(f,D){let P=new Map;for(let p of[...D.tables].sort())P.set(p,{name:p,columns:[],primaryKey:[],relations:[]});for(let{table:p,...s}of D.columns)P.get(p)?.columns.push(s);for(let{table:p,column:s}of D.primaryKeys)P.get(p)?.primaryKey.push(s);let d=new Map;for(let p of D.foreignKeys){let s=P.get(p.table);if(!s)continue;let M=`${p.table}\x00${p.key}`,q=d.get(M);if(!q)q={name:p.name,columns:[],referencedTable:p.referencedTable,referencedColumns:[],onDelete:p.onDelete,onUpdate:p.onUpdate},d.set(M,q),s.relations.push(q);q.columns.push(p.column),q.referencedColumns.push(p.referencedColumn)}return{dialect:f,tables:[...P.values()]}}async function h(f,D){let P=await f.unsafe(`
3
3
  select TABLE_NAME as name
4
4
  from information_schema.TABLES
5
5
  where TABLE_SCHEMA = database() and TABLE_TYPE = 'BASE TABLE'
@@ -1,5 +1,5 @@
1
1
  // @bun
2
2
  import{readFile as P}from"fs/promises";import{join as Q}from"path";var K="/",W=".vite/gemi.json";function N(H){let q=H?.trim()??"";if(q==="")return K;if(!q.startsWith("/")&&!/^[a-z][a-z\d+.-]*:\/\//i.test(q))throw Error(`Asset base ${JSON.stringify(H)} is neither an absolute URL nor a path starting with "/". The server-rendered document links the build's chunks by this prefix, and a relative one would resolve against each page's URL instead of the build's.`);return q.endsWith("/")?q:`${q}/`}function Z(H,q=process.env.GEMI_ASSET_BASE){let J=q?.trim()?q:H;return J?.trim()?N(J):void 0}function $(H,q=K){return`${q}${H}`}async function x(H){let q;try{q=await P(Q(H,W),"utf8")}catch(J){if(J?.code==="ENOENT")return K;throw J}return N(JSON.parse(q).assetBase)}
3
- export{K as ma,W as na,N as oa,Z as pa,$ as qa,x as ra};
3
+ export{K as na,W as oa,N as pa,Z as qa,$ as ra,x as sa};
4
4
 
5
- //# debugId=E450B93BA958ADF364756E2164756E21
5
+ //# debugId=8F0BA2209A3C744764756E2164756E21
@@ -5,6 +5,6 @@
5
5
  "import { readFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\n\n/**\n * Where the browser fetches the client build from — the prefix every URL gemi\n * builds out of a Vite manifest entry starts with. `/` unless the app sets one,\n * which is the root-relative `/assets/...` every gemi app has always served.\n */\nexport const DEFAULT_ASSET_BASE = \"/\";\n\n/**\n * The file the client build records its base in, relative to `dist/client`.\n * Next to Vite's own `manifest.json`, and like it outside anything the static\n * handler serves.\n */\nexport const ASSET_BASE_RECORD = \".vite/gemi.json\";\n\n/**\n * The base as a URL prefix: trimmed, `/` when empty, and always ending in `/`\n * so `${base}${file}` never needs to know which way round the caller wrote it.\n *\n * Only an absolute URL (`https://cdn.example.com/r42/`) or an absolute path\n * (`/static/`) is accepted. Vite also takes a relative base (`./`, `\"\"`), which\n * resolves each chunk against the module that imports it — but the document\n * has no importing module: a relative `<link rel=\"modulepreload\">` in the SSR\n * head resolves against the page's own URL, so `/users/7` would ask for\n * `/users/assets/...`. Refused here rather than served broken.\n */\nexport function normalizeAssetBase(value: string | undefined): string {\n const base = value?.trim() ?? \"\";\n if (base === \"\") {\n return DEFAULT_ASSET_BASE;\n }\n if (!base.startsWith(\"/\") && !/^[a-z][a-z\\d+.-]*:\\/\\//i.test(base)) {\n throw new Error(\n `Asset base ${JSON.stringify(value)} is neither an absolute URL nor a path starting with \"/\". ` +\n `The server-rendered document links the build's chunks by this prefix, and a relative one would ` +\n `resolve against each page's URL instead of the build's.`,\n );\n }\n return base.endsWith(\"/\") ? base : `${base}/`;\n}\n\n/**\n * The asset base the build should use, from `GEMI_ASSET_BASE` or the\n * `assetBase` field of `gemi.config.ts`, in that order. `undefined` when\n * neither is set, which leaves Vite's own default in place.\n *\n * The variable wins because the thing it usually carries — a release id in the\n * path — is known to the CI job running the build, not to a file checked in\n * beside the code.\n */\nexport function resolveAssetBase(\n configured: string | undefined,\n env: string | undefined = process.env.GEMI_ASSET_BASE,\n): string | undefined {\n const value = env?.trim() ? env : configured;\n return value?.trim() ? normalizeAssetBase(value) : undefined;\n}\n\n/** A manifest entry's `file` (`assets/client-abc.js`) as a URL under `base`. */\nexport function assetUrl(file: string, base: string = DEFAULT_ASSET_BASE): string {\n return `${base}${file}`;\n}\n\n/**\n * The base the client build in `clientDir` was built with, as the build\n * recorded it.\n *\n * Read from the build output rather than from `GEMI_ASSET_BASE` at boot: the\n * base is baked into the bundle — Vite writes it into every preload helper and\n * CSS `url()` — so the only value the document can safely use is the one the\n * bundle already has. An environment read here could differ from the build's\n * (a variable set on the CI job and not on the container is the ordinary case),\n * and the document would then link chunks the bundle does not import.\n *\n * `/` when there is no record, which is a build from before the record existed\n * and therefore one built without a base.\n */\nexport async function readBuiltAssetBase(clientDir: string): Promise<string> {\n let raw: string;\n try {\n raw = await readFile(join(clientDir, ASSET_BASE_RECORD), \"utf8\");\n } catch (error) {\n if ((error as NodeJS.ErrnoException)?.code === \"ENOENT\") {\n return DEFAULT_ASSET_BASE;\n }\n throw error;\n }\n return normalizeAssetBase(JSON.parse(raw).assetBase);\n}\n"
6
6
  ],
7
7
  "mappings": ";AAAA,mBAAS,oBACT,eAAS,aAOF,IAAM,EAAqB,IAOrB,EAAoB,kBAa1B,SAAS,CAAkB,CAAC,EAAmC,CACpE,IAAM,EAAO,GAAO,KAAK,GAAK,GAC9B,GAAI,IAAS,GACX,OAAO,EAET,GAAI,CAAC,EAAK,WAAW,GAAG,GAAK,CAAC,0BAA0B,KAAK,CAAI,EAC/D,MAAU,MACR,cAAc,KAAK,UAAU,CAAK,mNAGpC,EAEF,OAAO,EAAK,SAAS,GAAG,EAAI,EAAO,GAAG,KAYjC,SAAS,CAAgB,CAC9B,EACA,EAA0B,QAAQ,IAAI,gBAClB,CACpB,IAAM,EAAQ,GAAK,KAAK,EAAI,EAAM,EAClC,OAAO,GAAO,KAAK,EAAI,EAAmB,CAAK,EAAI,OAI9C,SAAS,CAAQ,CAAC,EAAc,EAAe,EAA4B,CAChF,MAAO,GAAG,IAAO,IAiBnB,eAAsB,CAAkB,CAAC,EAAoC,CAC3E,IAAI,EACJ,GAAI,CACF,EAAM,MAAM,EAAS,EAAK,EAAW,CAAiB,EAAG,MAAM,EAC/D,MAAO,EAAO,CACd,GAAK,GAAiC,OAAS,SAC7C,OAAO,EAET,MAAM,EAER,OAAO,EAAmB,KAAK,MAAM,CAAG,EAAE,SAAS",
8
- "debugId": "E450B93BA958ADF364756E2164756E21",
8
+ "debugId": "8F0BA2209A3C744764756E2164756E21",
9
9
  "names": []
10
10
  }
@@ -1,11 +1,11 @@
1
1
  // @bun
2
- import{rh as n}from"./chunk-3s3awh38.js";var w=n((p)=>{var r={warningEmitted:!1},a=(e)=>{if(e&&!r.warningEmitted&&parseInt(e.substring(1,e.indexOf(".")))<20)r.warningEmitted=!0,process.emitWarning(`NodeDeprecationWarning: The AWS SDK for JavaScript (v3) will
2
+ import{Bh as n}from"./chunk-1yx2e0bh.js";var w=n((p)=>{var r={warningEmitted:!1},a=(e)=>{if(e&&!r.warningEmitted&&parseInt(e.substring(1,e.indexOf(".")))<20)r.warningEmitted=!0,process.emitWarning(`NodeDeprecationWarning: The AWS SDK for JavaScript (v3) will
3
3
  no longer support Node.js ${e} in January 2026.
4
4
 
5
5
  To continue receiving updates to AWS services, bug fixes, and security
6
6
  updates please upgrade to a supported Node.js LTS version.
7
7
 
8
8
  More information can be found at: https://a.co/c895JFp`)};function o(e,t,s){if(!e.$source)e.$source={};return e.$source[t]=s,e}function u(e,t,s){if(!e.__aws_sdk_context)e.__aws_sdk_context={features:{}};else if(!e.__aws_sdk_context.features)e.__aws_sdk_context.features={};e.__aws_sdk_context.features[t]=s}function i(e,t,s){if(!e.$source)e.$source={};return e.$source[t]=s,e}p.emitWarningIfUnsupportedVersion=a;p.setCredentialFeature=o;p.setFeature=u;p.setTokenFeature=i;p.state=r});
9
- export{w as V};
9
+ export{w as W};
10
10
 
11
- //# debugId=BCA3C21CDC56D68864756E2164756E21
11
+ //# debugId=7F7AB060664D3DE464756E2164756E21
@@ -5,6 +5,6 @@
5
5
  "'use strict';\n\nconst state = {\n warningEmitted: false,\n};\nconst emitWarningIfUnsupportedVersion = (version) => {\n if (version && !state.warningEmitted && parseInt(version.substring(1, version.indexOf(\".\"))) < 20) {\n state.warningEmitted = true;\n process.emitWarning(`NodeDeprecationWarning: The AWS SDK for JavaScript (v3) will\nno longer support Node.js ${version} in January 2026.\n\nTo continue receiving updates to AWS services, bug fixes, and security\nupdates please upgrade to a supported Node.js LTS version.\n\nMore information can be found at: https://a.co/c895JFp`);\n }\n};\n\nfunction setCredentialFeature(credentials, feature, value) {\n if (!credentials.$source) {\n credentials.$source = {};\n }\n credentials.$source[feature] = value;\n return credentials;\n}\n\nfunction setFeature(context, feature, value) {\n if (!context.__aws_sdk_context) {\n context.__aws_sdk_context = {\n features: {},\n };\n }\n else if (!context.__aws_sdk_context.features) {\n context.__aws_sdk_context.features = {};\n }\n context.__aws_sdk_context.features[feature] = value;\n}\n\nfunction setTokenFeature(token, feature, value) {\n if (!token.$source) {\n token.$source = {};\n }\n token.$source[feature] = value;\n return token;\n}\n\nexports.emitWarningIfUnsupportedVersion = emitWarningIfUnsupportedVersion;\nexports.setCredentialFeature = setCredentialFeature;\nexports.setFeature = setFeature;\nexports.setTokenFeature = setTokenFeature;\nexports.state = state;\n"
6
6
  ],
7
7
  "mappings": ";uDAEA,IAAM,EAAQ,CACV,eAAgB,EACpB,EACM,EAAkC,CAAC,IAAY,CACjD,GAAI,GAAW,CAAC,EAAM,gBAAkB,SAAS,EAAQ,UAAU,EAAG,EAAQ,QAAQ,GAAG,CAAC,CAAC,EAAI,GAC3F,EAAM,eAAiB,GACvB,QAAQ,YAAY;AAAA,4BACA;AAAA;AAAA;AAAA;AAAA;AAAA,uDAK2B,GAIvD,SAAS,CAAoB,CAAC,EAAa,EAAS,EAAO,CACvD,GAAI,CAAC,EAAY,QACb,EAAY,QAAU,CAAC,EAG3B,OADA,EAAY,QAAQ,GAAW,EACxB,EAGX,SAAS,CAAU,CAAC,EAAS,EAAS,EAAO,CACzC,GAAI,CAAC,EAAQ,kBACT,EAAQ,kBAAoB,CACxB,SAAU,CAAC,CACf,EAEC,QAAI,CAAC,EAAQ,kBAAkB,SAChC,EAAQ,kBAAkB,SAAW,CAAC,EAE1C,EAAQ,kBAAkB,SAAS,GAAW,EAGlD,SAAS,CAAe,CAAC,EAAO,EAAS,EAAO,CAC5C,GAAI,CAAC,EAAM,QACP,EAAM,QAAU,CAAC,EAGrB,OADA,EAAM,QAAQ,GAAW,EAClB,EAGH,kCAAkC,EAClC,uBAAuB,EACvB,aAAa,EACb,kBAAkB,EAClB,QAAQ",
8
- "debugId": "BCA3C21CDC56D68864756E2164756E21",
8
+ "debugId": "7F7AB060664D3DE464756E2164756E21",
9
9
  "names": []
10
10
  }