gemi 0.52.0 → 0.54.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 (244) hide show
  1. package/dist/app/index.js +2 -2
  2. package/dist/app/index.js.map +1 -1
  3. package/dist/bin/gemi.js +1456 -5
  4. package/dist/bin/gemi.js.map +9 -5
  5. package/dist/broadcasting/index.js +1 -1
  6. package/dist/bun/plugin.js +2 -2
  7. package/dist/bun/plugin.js.map +1 -1
  8. package/dist/bun/preload.js +2 -2
  9. package/dist/bun/preload.js.map +1 -1
  10. package/dist/{chunk-msz8rngs.js → chunk-004bcmsa.js} +2 -2
  11. package/dist/chunk-004bcmsa.js.map +10 -0
  12. package/dist/chunk-07t0dmdg.js +4 -0
  13. package/dist/{chunk-faa987e4.js.map → chunk-07t0dmdg.js.map} +2 -2
  14. package/dist/{chunk-4t6a82fh.js → chunk-0weeq0ke.js} +2 -2
  15. package/dist/{chunk-4t6a82fh.js.map → chunk-0weeq0ke.js.map} +1 -1
  16. package/dist/chunk-113khwbw.js +5 -0
  17. package/dist/{chunk-2qn472j4.js.map → chunk-113khwbw.js.map} +1 -1
  18. package/dist/{chunk-tmk4zfz9.js → chunk-1sh6kqjn.js} +3 -3
  19. package/dist/{chunk-tmk4zfz9.js.map → chunk-1sh6kqjn.js.map} +1 -1
  20. package/dist/{chunk-2gw6cyyj.js → chunk-1snh7yc4.js} +2 -2
  21. package/dist/{chunk-2gw6cyyj.js.map → chunk-1snh7yc4.js.map} +1 -1
  22. package/dist/chunk-26r8dcxd.js +6 -0
  23. package/dist/{chunk-hbycemy5.js.map → chunk-26r8dcxd.js.map} +2 -2
  24. package/dist/{chunk-ebcgdv00.js → chunk-2pt6kyn9.js} +3 -3
  25. package/dist/{chunk-ebcgdv00.js.map → chunk-2pt6kyn9.js.map} +1 -1
  26. package/dist/{chunk-jdfe4dmh.js → chunk-2zmz3pjk.js} +3 -3
  27. package/dist/{chunk-jdfe4dmh.js.map → chunk-2zmz3pjk.js.map} +1 -1
  28. package/dist/{chunk-zhsaz9cr.js → chunk-3bw1jk21.js} +1 -1
  29. package/dist/chunk-4qkzdyj7.js +4 -0
  30. package/dist/{chunk-4e61qbp4.js.map → chunk-4qkzdyj7.js.map} +1 -1
  31. package/dist/{chunk-d1ahbza9.js → chunk-50vm7x98.js} +3 -3
  32. package/dist/{chunk-d1ahbza9.js.map → chunk-50vm7x98.js.map} +1 -1
  33. package/dist/{chunk-qyaqg07q.js → chunk-6j1z2cqt.js} +2 -2
  34. package/dist/{chunk-qyaqg07q.js.map → chunk-6j1z2cqt.js.map} +1 -1
  35. package/dist/chunk-6rhebm18.js +5 -0
  36. package/dist/chunk-6rhebm18.js.map +10 -0
  37. package/dist/{chunk-rq770c71.js → chunk-71m47kad.js} +2 -2
  38. package/dist/{chunk-rq770c71.js.map → chunk-71m47kad.js.map} +1 -1
  39. package/dist/{chunk-0h3jr9d9.js → chunk-7f5ad759.js} +2 -2
  40. package/dist/{chunk-8p6rqegw.js.map → chunk-7f5ad759.js.map} +1 -1
  41. package/dist/{chunk-qj4mmner.js → chunk-85av4ncy.js} +2 -2
  42. package/dist/{chunk-qj4mmner.js.map → chunk-85av4ncy.js.map} +1 -1
  43. package/dist/{chunk-23g7qdpg.js → chunk-9taz1h3t.js} +3 -3
  44. package/dist/{chunk-23g7qdpg.js.map → chunk-9taz1h3t.js.map} +1 -1
  45. package/dist/{chunk-ppt296ye.js → chunk-agabw2w1.js} +2 -2
  46. package/dist/{chunk-ppt296ye.js.map → chunk-agabw2w1.js.map} +1 -1
  47. package/dist/{chunk-092pj2j2.js → chunk-bb3zvxsf.js} +3 -3
  48. package/dist/{chunk-092pj2j2.js.map → chunk-bb3zvxsf.js.map} +1 -1
  49. package/dist/{chunk-h7jv3ame.js → chunk-br8ten26.js} +2 -2
  50. package/dist/{chunk-h7jv3ame.js.map → chunk-br8ten26.js.map} +1 -1
  51. package/dist/{chunk-4e61qbp4.js → chunk-bzhtymvv.js} +2 -2
  52. package/dist/{chunk-0h3jr9d9.js.map → chunk-bzhtymvv.js.map} +1 -1
  53. package/dist/{chunk-68w225rv.js → chunk-c0wcsmpj.js} +2 -2
  54. package/dist/{chunk-68w225rv.js.map → chunk-c0wcsmpj.js.map} +1 -1
  55. package/dist/{chunk-xsmt86n3.js → chunk-c22vcxty.js} +2 -2
  56. package/dist/{chunk-xsmt86n3.js.map → chunk-c22vcxty.js.map} +1 -1
  57. package/dist/{chunk-a0sy9f9x.js → chunk-c2pv3ah8.js} +2 -2
  58. package/dist/{chunk-a0sy9f9x.js.map → chunk-c2pv3ah8.js.map} +2 -2
  59. package/dist/{chunk-q09mmr05.js → chunk-cz3szqhq.js} +2 -2
  60. package/dist/{chunk-q09mmr05.js.map → chunk-cz3szqhq.js.map} +1 -1
  61. package/dist/{chunk-69w4egkg.js → chunk-dwx2y7br.js} +4 -4
  62. package/dist/{chunk-69w4egkg.js.map → chunk-dwx2y7br.js.map} +1 -1
  63. package/dist/{chunk-2sfz64xh.js → chunk-dxw8k6f1.js} +2 -2
  64. package/dist/{chunk-2sfz64xh.js.map → chunk-dxw8k6f1.js.map} +1 -1
  65. package/dist/chunk-e3mggavt.js +5 -0
  66. package/dist/chunk-e3mggavt.js.map +11 -0
  67. package/dist/{chunk-j1knf8gv.js → chunk-efsk1wy0.js} +3 -3
  68. package/dist/{chunk-j1knf8gv.js.map → chunk-efsk1wy0.js.map} +1 -1
  69. package/dist/{chunk-t4n25km9.js → chunk-f13f68c0.js} +2 -2
  70. package/dist/{chunk-t4n25km9.js.map → chunk-f13f68c0.js.map} +1 -1
  71. package/dist/{chunk-vv72kw74.js → chunk-f418jh9k.js} +2 -2
  72. package/dist/{chunk-vv72kw74.js.map → chunk-f418jh9k.js.map} +1 -1
  73. package/dist/chunk-f4e7fh95.js +17 -0
  74. package/dist/chunk-f4e7fh95.js.map +14 -0
  75. package/dist/{chunk-ewgv1j8q.js → chunk-fcqc3e3r.js} +2 -2
  76. package/dist/{chunk-ewgv1j8q.js.map → chunk-fcqc3e3r.js.map} +1 -1
  77. package/dist/{chunk-3y9nf09k.js → chunk-g5tj10p8.js} +2 -2
  78. package/dist/{chunk-3y9nf09k.js.map → chunk-g5tj10p8.js.map} +1 -1
  79. package/dist/chunk-gn9zjgep.js +5 -0
  80. package/dist/chunk-gn9zjgep.js.map +10 -0
  81. package/dist/{chunk-5s45prj5.js → chunk-h7mcwfg5.js} +4 -4
  82. package/dist/{chunk-5s45prj5.js.map → chunk-h7mcwfg5.js.map} +1 -1
  83. package/dist/chunk-hk067634.js +4 -0
  84. package/dist/{chunk-vnjvd82s.js.map → chunk-hk067634.js.map} +2 -2
  85. package/dist/{chunk-qx6sahe0.js → chunk-hrrmxreg.js} +2 -2
  86. package/dist/{chunk-qx6sahe0.js.map → chunk-hrrmxreg.js.map} +1 -1
  87. package/dist/{chunk-p22rkf1g.js → chunk-jb022m7n.js} +2 -2
  88. package/dist/{chunk-p22rkf1g.js.map → chunk-jb022m7n.js.map} +1 -1
  89. package/dist/chunk-jb2nst6v.js +4 -0
  90. package/dist/{chunk-6scjrbw7.js.map → chunk-jb2nst6v.js.map} +2 -2
  91. package/dist/{chunk-kxzwem3g.js → chunk-jdgvdddd.js} +2 -2
  92. package/dist/{chunk-kxzwem3g.js.map → chunk-jdgvdddd.js.map} +1 -1
  93. package/dist/{chunk-2yth3kk2.js → chunk-jp4pf3yt.js} +4 -4
  94. package/dist/{chunk-2yth3kk2.js.map → chunk-jp4pf3yt.js.map} +1 -1
  95. package/dist/{chunk-0tbwn6er.js → chunk-k14dmqwh.js} +3 -3
  96. package/dist/{chunk-0tbwn6er.js.map → chunk-k14dmqwh.js.map} +1 -1
  97. package/dist/{chunk-1ce7veh9.js → chunk-k8endm5j.js} +3 -3
  98. package/dist/{chunk-1ce7veh9.js.map → chunk-k8endm5j.js.map} +1 -1
  99. package/dist/chunk-kkkqyvwv.js +81 -0
  100. package/dist/{chunk-km6x37ws.js.map → chunk-kkkqyvwv.js.map} +5 -5
  101. package/dist/{chunk-cmq5t8p9.js → chunk-kv2ep453.js} +3 -3
  102. package/dist/{chunk-cmq5t8p9.js.map → chunk-kv2ep453.js.map} +1 -1
  103. package/dist/{chunk-z4q1ty6w.js → chunk-kz39hphm.js} +3 -3
  104. package/dist/{chunk-z4q1ty6w.js.map → chunk-kz39hphm.js.map} +1 -1
  105. package/dist/{chunk-kaxvw75w.js → chunk-ms8qd7da.js} +3 -3
  106. package/dist/{chunk-kaxvw75w.js.map → chunk-ms8qd7da.js.map} +1 -1
  107. package/dist/{chunk-ttzkn1qd.js → chunk-n1tkn8gv.js} +2 -2
  108. package/dist/{chunk-ttzkn1qd.js.map → chunk-n1tkn8gv.js.map} +1 -1
  109. package/dist/chunk-nncwsdzz.js +5 -0
  110. package/dist/chunk-nncwsdzz.js.map +10 -0
  111. package/dist/{chunk-et0j6jx8.js → chunk-pgjk5ft3.js} +3 -3
  112. package/dist/{chunk-et0j6jx8.js.map → chunk-pgjk5ft3.js.map} +1 -1
  113. package/dist/{chunk-tztqkat2.js → chunk-r06rxn19.js} +2 -2
  114. package/dist/{chunk-tztqkat2.js.map → chunk-r06rxn19.js.map} +1 -1
  115. package/dist/chunk-r9z5rrk0.js +4 -0
  116. package/dist/{chunk-1ab1ptq5.js.map → chunk-r9z5rrk0.js.map} +2 -2
  117. package/dist/{chunk-h5g05qwb.js → chunk-s6e7cvek.js} +2 -2
  118. package/dist/{chunk-h5g05qwb.js.map → chunk-s6e7cvek.js.map} +1 -1
  119. package/dist/{chunk-53e48ce8.js → chunk-sqp7kn7h.js} +3 -3
  120. package/dist/{chunk-53e48ce8.js.map → chunk-sqp7kn7h.js.map} +1 -1
  121. package/dist/{chunk-mt2755rs.js → chunk-w6gb9gc5.js} +3 -3
  122. package/dist/{chunk-mt2755rs.js.map → chunk-w6gb9gc5.js.map} +1 -1
  123. package/dist/{chunk-ha7n1c94.js → chunk-xxw0gz4q.js} +2 -2
  124. package/dist/{chunk-ha7n1c94.js.map → chunk-xxw0gz4q.js.map} +1 -1
  125. package/dist/chunk-ywr2vd5r.js +5 -0
  126. package/dist/{chunk-f29vd5mc.js.map → chunk-ywr2vd5r.js.map} +2 -2
  127. package/dist/{chunk-38ma6gg3.js → chunk-zckj6bs6.js} +3 -3
  128. package/dist/{chunk-38ma6gg3.js.map → chunk-zckj6bs6.js.map} +1 -1
  129. package/dist/chunks/ThemeProvider-Bk1eZymb.js +2901 -0
  130. package/dist/chunks/ThemeProvider-Bk1eZymb.js.map +1 -0
  131. package/dist/client/ComponentContext.d.ts.map +1 -1
  132. package/dist/client/DictionarySinkContext.d.ts +10 -0
  133. package/dist/client/DictionarySinkContext.d.ts.map +1 -0
  134. package/dist/client/Mutation.d.ts +1 -1
  135. package/dist/client/Mutation.d.ts.map +1 -1
  136. package/dist/client/ThemeProvider.d.ts +7 -0
  137. package/dist/client/ThemeProvider.d.ts.map +1 -1
  138. package/dist/client/createRoot.d.ts.map +1 -1
  139. package/dist/client/index.d.ts +2 -0
  140. package/dist/client/index.d.ts.map +1 -1
  141. package/dist/client/index.js +242 -2629
  142. package/dist/client/index.js.map +1 -1
  143. package/dist/client/useDictionary.d.ts +34 -0
  144. package/dist/client/useDictionary.d.ts.map +1 -0
  145. package/dist/client/useDictionary.test-d.d.ts +2 -0
  146. package/dist/client/useDictionary.test-d.d.ts.map +1 -0
  147. package/dist/client/useIsNavigationPending.d.ts.map +1 -1
  148. package/dist/client/useMutate.d.ts.map +1 -1
  149. package/dist/client/useTranslator.d.ts +8 -0
  150. package/dist/client/useTranslator.d.ts.map +1 -1
  151. package/dist/config/index.js +1 -1
  152. package/dist/console/run.js +2 -2
  153. package/dist/console/run.js.map +1 -1
  154. package/dist/container/index.js +2 -2
  155. package/dist/container/index.js.map +1 -1
  156. package/dist/database/index.js +2 -2
  157. package/dist/database/index.js.map +1 -1
  158. package/dist/email/index.js +2 -2
  159. package/dist/email/index.js.map +1 -1
  160. package/dist/facades/Lang.d.ts.map +1 -1
  161. package/dist/facades/index.js +2 -2
  162. package/dist/facades/index.js.map +1 -1
  163. package/dist/foundation/index.js +2 -2
  164. package/dist/foundation/index.js.map +1 -1
  165. package/dist/http/index.js +2 -2
  166. package/dist/http/index.js.map +1 -1
  167. package/dist/i18n/Dictionary.d.ts +7 -0
  168. package/dist/i18n/Dictionary.d.ts.map +1 -1
  169. package/dist/i18n/Translator.d.ts +12 -0
  170. package/dist/i18n/Translator.d.ts.map +1 -1
  171. package/dist/i18n/config.d.ts +6 -0
  172. package/dist/i18n/config.d.ts.map +1 -1
  173. package/dist/i18n/defineDictionary.d.ts +65 -0
  174. package/dist/i18n/defineDictionary.d.ts.map +1 -0
  175. package/dist/i18n/dictionaryRegistry.d.ts +85 -0
  176. package/dist/i18n/dictionaryRegistry.d.ts.map +1 -0
  177. package/dist/i18n/dictionaryRuntime.d.ts +16 -0
  178. package/dist/i18n/dictionaryRuntime.d.ts.map +1 -0
  179. package/dist/i18n/dictionaryRuntime.js +4 -0
  180. package/dist/i18n/dictionaryRuntime.js.map +9 -0
  181. package/dist/i18n/dictionaryShape.d.ts +66 -0
  182. package/dist/i18n/dictionaryShape.d.ts.map +1 -0
  183. package/dist/i18n/dictionarySink.d.ts +31 -0
  184. package/dist/i18n/dictionarySink.d.ts.map +1 -0
  185. package/dist/i18n/index.d.ts +3 -0
  186. package/dist/i18n/index.d.ts.map +1 -1
  187. package/dist/i18n/index.js +2 -2
  188. package/dist/i18n/index.js.map +5 -4
  189. package/dist/i18n/translate.d.ts +21 -0
  190. package/dist/i18n/translate.d.ts.map +1 -0
  191. package/dist/internal/gemiExternals.d.ts +1 -1
  192. package/dist/internal/gemiExternals.d.ts.map +1 -1
  193. package/dist/kernel/index.js +2 -2
  194. package/dist/kernel/index.js.map +2 -2
  195. package/dist/orm/index.js +2 -2
  196. package/dist/orm/index.js.map +2 -2
  197. package/dist/server/index.js +2 -2
  198. package/dist/server/index.js.map +1 -1
  199. package/dist/services/index.js +4 -4
  200. package/dist/services/index.js.map +2 -2
  201. package/dist/services/router/ViewRouteDispatcher.d.ts.map +1 -1
  202. package/dist/services/router/streamQueryInjection.d.ts +9 -1
  203. package/dist/services/router/streamQueryInjection.d.ts.map +1 -1
  204. package/dist/support/index.js +2 -2
  205. package/dist/support/index.js.map +1 -1
  206. package/dist/testing/Page.d.ts +166 -0
  207. package/dist/testing/Page.d.ts.map +1 -0
  208. package/dist/testing/index.d.ts +3 -0
  209. package/dist/testing/index.d.ts.map +1 -0
  210. package/dist/testing/index.js +352 -0
  211. package/dist/testing/index.js.map +1 -0
  212. package/dist/utils/Subject.d.ts.map +1 -1
  213. package/dist/utils/variantKey.d.ts +19 -0
  214. package/dist/utils/variantKey.d.ts.map +1 -0
  215. package/dist/vite/__vite-browser-external-S5EYS4bz.mjs +7 -0
  216. package/dist/vite/api_vite-DSBC5Nzy.mjs +5 -0
  217. package/dist/vite/browser-DFEUWTkA.mjs +6086 -0
  218. package/dist/vite/build-C0lmnz6d.mjs +5326 -0
  219. package/dist/vite/index.mjs +1349 -1
  220. package/dist/vite/lib-TT6NqN6b.mjs +363 -0
  221. package/dist/vite/lib-U4DF62jt.mjs +48846 -0
  222. package/dist/vite/main-Drp2rSLR.mjs +2123 -0
  223. package/dist/vite/node-BgyIm-M7.mjs +17799 -0
  224. package/dist/vite/node-yGkKTK1d.mjs +789 -0
  225. package/dist/vite/postcss-hCXrlC4m.mjs +3515 -0
  226. package/dist/vite/postcss-import-rYEe0OKc.mjs +448 -0
  227. package/dist/vite/prompt--dNycKSZ-BmZ8jzP_.mjs +889 -0
  228. package/dist/vite/rolldown-runtime-B4lejLz5.mjs +37 -0
  229. package/package.json +4 -1
  230. package/dist/chunk-1ab1ptq5.js +0 -4
  231. package/dist/chunk-2qn472j4.js +0 -5
  232. package/dist/chunk-6scjrbw7.js +0 -4
  233. package/dist/chunk-88pq4gmf.js +0 -5
  234. package/dist/chunk-88pq4gmf.js.map +0 -10
  235. package/dist/chunk-8p6rqegw.js +0 -4
  236. package/dist/chunk-f29vd5mc.js +0 -5
  237. package/dist/chunk-faa987e4.js +0 -4
  238. package/dist/chunk-hbycemy5.js +0 -6
  239. package/dist/chunk-km6x37ws.js +0 -81
  240. package/dist/chunk-msz8rngs.js.map +0 -10
  241. package/dist/chunk-vnjvd82s.js +0 -4
  242. package/dist/chunk-xw44bwnh.js +0 -5
  243. package/dist/chunk-xw44bwnh.js.map +0 -11
  244. /package/dist/{chunk-zhsaz9cr.js.map → chunk-3bw1jk21.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dictionaryRuntime.d.ts","sourceRoot":"","sources":["../../i18n/dictionaryRuntime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,KAAK,gBAAgB,GACtB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,0BAA0B,EAC1B,eAAe,EACf,eAAe,EACf,yBAAyB,EACzB,KAAK,aAAa,GACnB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,oBAAoB,EACpB,KAAK,cAAc,EACnB,KAAK,aAAa,GACnB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,KAAK,sBAAsB,GAC5B,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,4 @@
1
+ // @bun
2
+ import{e as y,f as p}from"../chunk-6rhebm18.js";import{n as c,o as d,q as l}from"../chunk-gn9zjgep.js";import{rd as e,sd as i,ud as t,vd as r,wd as o,xd as n,yd as a,zd as s}from"../chunk-e3mggavt.js";import"../chunk-7f5ad759.js";export{o as setActiveLocale,r as seedDictionaries,t as preloadDictionaries,d as localeStrings,i as loadDictionary,n as getActiveLocale,e as dictionaryRegistrationMark,c as dictionaryLocales,l as dictionaryId,y as defineDictionary,s as createDictionarySink,a as __resetDictionaryRegistry,p as __gemi_dict__};
3
+
4
+ //# debugId=1D3A8957C964E4AC64756E2164756E21
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [
5
+ ],
6
+ "mappings": "",
7
+ "debugId": "1D3A8957C964E4AC64756E2164756E21",
8
+ "names": []
9
+ }
@@ -0,0 +1,66 @@
1
+ /**
2
+ * The one implementation of "what is a dictionary literal, and what is its id",
3
+ * shared by the runtime (`defineDictionary`) and the Vite plugin.
4
+ *
5
+ * Both sides must agree exactly. A dictionary's id is a hash of its own
6
+ * contents rather than of its file path, so a module that is bundled on one
7
+ * side and evaluated raw on the other still lands on the same id — which is
8
+ * what lets the SSR payload seed the client registry.
9
+ */
10
+ export type DictionaryTranslations = Record<string, Record<string, string>>;
11
+ export type LocaleStrings = Record<string, string>;
12
+ /**
13
+ * Locales the dictionary declares, source language first.
14
+ *
15
+ * The order is meaningful: the first locale is the source language, and a key
16
+ * missing from some other locale falls back along this list.
17
+ *
18
+ * `sourceLocale` pins that choice. Without it the source language is whichever
19
+ * locale is seen first while walking the literal, which makes it an emergent
20
+ * property of key order — adding a key at the top of a dictionary whose other
21
+ * keys happen to lack `en-US` would silently re-point every fallback in it. Any
22
+ * dictionary that is not uniformly translated should say which locale it is
23
+ * authored in.
24
+ */
25
+ export declare function dictionaryLocales(translations: DictionaryTranslations, sourceLocale?: string): string[];
26
+ /**
27
+ * Flatten one locale out of a dictionary.
28
+ *
29
+ * A key with no string for `locale` falls back along the declared locale order
30
+ * rather than vanishing, so a half-translated dictionary degrades one string at
31
+ * a time instead of rendering the whole component as raw keys.
32
+ */
33
+ export declare function localeStrings(translations: DictionaryTranslations, locale: string, fallbackOrder?: string[]): LocaleStrings;
34
+ export interface SourceDisagreement {
35
+ key: string;
36
+ first: string;
37
+ againstKey: string;
38
+ againstFirst: string;
39
+ }
40
+ /**
41
+ * Whether the inferred source language survives reordering the literal.
42
+ *
43
+ * `dictionaryLocales` collects locales entry by entry, so `locales[0]` is the
44
+ * first locale of the first entry. That is invariant under key reordering
45
+ * exactly when every entry lists the same locale first — and order-dependent
46
+ * the moment two entries disagree, because then whichever happens to be written
47
+ * first decides what the *whole* dictionary falls back to. Adding one key at
48
+ * the top can flip every other key's fallback language, from a diff that reads
49
+ * as an addition.
50
+ *
51
+ * Returns the disagreement so the build can name both keys; `null` when the
52
+ * inference is stable. `sourceLocale` settles it and makes the question moot.
53
+ */
54
+ export declare function findSourceDisagreement(translations: DictionaryTranslations): SourceDisagreement | null;
55
+ /**
56
+ * Canonical serialization — key order in the source file must not change the
57
+ * id, or an innocuous reordering would break the payload/registry match.
58
+ */
59
+ export declare function canonicalizeDictionary(translations: DictionaryTranslations): string;
60
+ /**
61
+ * FNV-1a, run twice with different offsets for a 64-bit-wide id. No crypto
62
+ * import, and it has to work identically in the browser bundle, under Bun on
63
+ * the server, and inside the Vite plugin.
64
+ */
65
+ export declare function dictionaryId(translations: DictionaryTranslations): string;
66
+ //# sourceMappingURL=dictionaryShape.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dictionaryShape.d.ts","sourceRoot":"","sources":["../../i18n/dictionaryShape.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAE5E,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEnD;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,sBAAsB,EACpC,YAAY,CAAC,EAAE,MAAM,GACpB,MAAM,EAAE,CAgBV;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,YAAY,EAAE,sBAAsB,EACpC,MAAM,EAAE,MAAM,EACd,aAAa,GAAE,MAAM,EAAoC,GACxD,aAAa,CAkBf;AAED,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,sBAAsB,GACnC,kBAAkB,GAAG,IAAI,CAmB3B;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,sBAAsB,GACnC,MAAM,CASR;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,YAAY,EAAE,sBAAsB,GAAG,MAAM,CAWzE"}
@@ -0,0 +1,31 @@
1
+ import type { LocaleStrings } from "./dictionaryShape";
2
+ /**
3
+ * Collects the dictionaries one SSR render actually read.
4
+ *
5
+ * Scoped per request by living in React context rather than in module state: a
6
+ * streaming server has several renders in flight at once, so a module-level
7
+ * collector would mix one page's dictionaries into another's payload. Context
8
+ * is per render tree, which is exactly the boundary wanted, and it needs no
9
+ * async-local storage to survive React's internal scheduling.
10
+ *
11
+ * Why stream these rather than put them in `__GEMI_DATA__`: that snapshot is
12
+ * serialized before `renderToReadableStream` is even called, and which
13
+ * dictionaries a page reads is only known once it has rendered. A suspended
14
+ * segment reveals later still, long after the shell has flushed.
15
+ *
16
+ * The sink deliberately emits data, not markup — `streamQueryInjection` owns
17
+ * script formatting and the `</script>`-safe encoding that goes with it.
18
+ */
19
+ export interface DictionaryUse {
20
+ id: string;
21
+ locale: string;
22
+ strings: LocaleStrings;
23
+ }
24
+ export interface DictionarySink {
25
+ /** Called during render, the first time a dictionary is read. */
26
+ use(id: string, locale: string, strings: LocaleStrings): void;
27
+ /** The response injector subscribes to receive uses as they happen. */
28
+ onUse(cb: (use: DictionaryUse) => void): void;
29
+ }
30
+ export declare function createDictionarySink(): DictionarySink;
31
+ //# sourceMappingURL=dictionarySink.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dictionarySink.d.ts","sourceRoot":"","sources":["../../i18n/dictionarySink.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,aAAa,CAAC;CACxB;AAED,MAAM,WAAW,cAAc;IAC7B,iEAAiE;IACjE,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI,CAAC;IAC9D,uEAAuE;IACvE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,EAAE,aAAa,KAAK,IAAI,GAAG,IAAI,CAAC;CAC/C;AAED,wBAAgB,oBAAoB,IAAI,cAAc,CA0BrD"}
@@ -2,4 +2,7 @@ export { TranslationServiceProvider } from "./TranslationServiceProvider";
2
2
  export { Translator } from "./Translator";
3
3
  export { defineTranslationConfig, translationConfigDefaults, type TranslationConfig, } from "./config";
4
4
  export { Dictionary } from "./Dictionary";
5
+ export { defineDictionary, type DictionaryHandle, } from "./defineDictionary";
6
+ export { translate } from "./translate";
7
+ export type { DictionaryTranslations, LocaleStrings } from "./dictionaryShape";
5
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../i18n/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,KAAK,iBAAiB,GACvB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../i18n/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,KAAK,iBAAiB,GACvB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAK1C,OAAO,EACL,gBAAgB,EAChB,KAAK,gBAAgB,GACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{M as E}from"../chunk-2qn472j4.js";import{Ab as D,zb as $}from"../chunk-msz8rngs.js";import"../chunk-ttzkn1qd.js";import{Kb as U}from"../chunk-km6x37ws.js";import"../chunk-et0j6jx8.js";import"../chunk-1ce7veh9.js";import"../chunk-qj4mmner.js";import"../chunk-0tbwn6er.js";import"../chunk-4t6a82fh.js";import"../chunk-3y9nf09k.js";import{Ie as K}from"../chunk-88pq4gmf.js";import"../chunk-mt2755rs.js";import"../chunk-qyaqg07q.js";import"../chunk-0h3jr9d9.js";import{createElement as x,Fragment as C,isValidElement as R}from"react";function y(r,n){let s=Object.values(n).some((o)=>typeof o==="function"&&R(o(""))),g=/{{([^{}]+?)(?::([^{}\[\]]+?))?(?:\[(.*?)\])?}}/g;if(!s)return r.replace(g,(T,t,w,d)=>{let P=t.includes(":")?t.split(":")[0]:t,i=n[P];if(i===void 0)return T;if(typeof i==="function"){let e=i(d!==void 0?d:"");if(R(e))throw Error("JSX returned in string context");return String(e)}if(w)switch(w.toLowerCase()){case"number":return Number(i).toString();case"string":return String(i);case"boolean":return Boolean(i).toString();default:return String(i)}return String(i)});else{let o=[],T=0,t=null;while((t=g.exec(r))!==null){let[w,d,P,i]=t,c=t.index,e=d.includes(":")?d.split(":")[0]:d;if(c>T)o.push(r.substring(T,c));let f=n[e];if(f===void 0)o.push(w);else if(typeof f==="function"){let b=f(i!==void 0?i:"");o.push(b)}else if(P)switch(P.toLowerCase()){case"number":o.push(Number(f).toString());break;case"string":o.push(String(f));break;case"boolean":o.push(Boolean(f).toString());break;default:o.push(String(f))}else o.push(String(f));T=c+w.length}if(T<r.length)o.push(r.substring(T));return x(C,{},...o)}}class S{name;dictionary;constructor(r,n){this.name=r;this.dictionary=n}reference(r){if(typeof window<"u")throw Error("Cannot use reference in the browser");if(!this.dictionary?.[r])throw Error(`Translation not found for ${String(r)}`);return this.dictionary[r]}render(r,...n){let{locale:s=U.locale(),params:g}={params:{},...n[0]};if(typeof window<"u")throw Error("Cannot use render in the browser");if(!this.dictionary?.[r]?.[s])throw Error(`Translation not found for ${String(r)} in ${String(s)}`);return y(this.dictionary[r][s],g??{})}static create(r,n){return new S(r,n)}static text(r,...n){let{locale:s=U.locale(),params:g}={params:{},...n?.[0]};if(!r?.[s])throw Error(`Translation not found for ${String(s)}`);return y(r[s],g??{})}}export{D as translationConfigDefaults,$ as defineTranslationConfig,K as Translator,E as TranslationServiceProvider,S as Dictionary};
2
+ import{e as R}from"../chunk-6rhebm18.js";import"../chunk-gn9zjgep.js";import{S as L}from"../chunk-113khwbw.js";import{Jb as E,Kb as V}from"../chunk-004bcmsa.js";import"../chunk-n1tkn8gv.js";import{Qb as j}from"../chunk-kkkqyvwv.js";import"../chunk-pgjk5ft3.js";import"../chunk-k8endm5j.js";import"../chunk-e3mggavt.js";import"../chunk-85av4ncy.js";import"../chunk-k14dmqwh.js";import"../chunk-0weeq0ke.js";import"../chunk-g5tj10p8.js";import{Ye as X}from"../chunk-nncwsdzz.js";import"../chunk-w6gb9gc5.js";import"../chunk-6j1z2cqt.js";import"../chunk-7f5ad759.js";import{createElement as J,Fragment as M,isValidElement as U}from"react";function $(q,B){let G=Object.values(B).some((z)=>typeof z==="function"&&U(z(""))),Q=/{{([^{}]+?)(?::([^{}\[\]]+?))?(?:\[(.*?)\])?}}/g;if(!G)return q.replace(Q,(W,O,_,Z)=>{let C=O.includes(":")?O.split(":")[0]:O,H=B[C];if(H===void 0)return W;if(typeof H==="function"){let K=H(Z!==void 0?Z:"");if(U(K))throw Error("JSX returned in string context");return String(K)}if(_)switch(_.toLowerCase()){case"number":return Number(H).toString();case"string":return String(H);case"boolean":return Boolean(H).toString();default:return String(H)}return String(H)});else{let z=[],W=0,O=null;while((O=Q.exec(q))!==null){let[_,Z,C,H]=O,F=O.index,K=Z.includes(":")?Z.split(":")[0]:Z;if(F>W)z.push(q.substring(W,F));let Y=B[K];if(Y===void 0)z.push(_);else if(typeof Y==="function"){let A=Y(H!==void 0?H:"");z.push(A)}else if(C)switch(C.toLowerCase()){case"number":z.push(Number(Y).toString());break;case"string":z.push(String(Y));break;case"boolean":z.push(Boolean(Y).toString());break;default:z.push(String(Y))}else z.push(String(Y));W=F+_.length}if(W<q.length)z.push(q.substring(W));return J(M,{},...z)}}class P{name;dictionary;constructor(q,B){this.name=q;this.dictionary=B}reference(q){if(typeof window<"u")throw Error("Cannot use reference in the browser");if(!this.dictionary?.[q])throw Error(`Translation not found for ${String(q)}`);return this.dictionary[q]}render(q,...B){let{locale:G=j.locale(),params:Q}={params:{},...B[0]};if(typeof window<"u")throw Error("Cannot use render in the browser");if(!this.dictionary?.[q]?.[G])throw Error(`Translation not found for ${String(q)} in ${String(G)}`);return $(this.dictionary[q][G],Q??{})}static create(q,B){return new P(q,B)}static text(q,...B){let{locale:G=j.locale(),params:Q}={params:{},...B?.[0]};if(!q?.[G])throw Error(`Translation not found for ${String(G)}`);return $(q[G],Q??{})}}async function N(q,B,...G){let{locale:Q=j.locale(),params:z}={params:{},...G[0]},O=(await q.load(String(Q)))[B];if(typeof O!=="string")throw Error(`Translation not found for "${B}" in "${String(Q)}" (dictionary ${q.id})`);return $(O,z??{})}export{V as translationConfigDefaults,N as translate,E as defineTranslationConfig,R as defineDictionary,X as Translator,L as TranslationServiceProvider,P as Dictionary};
3
3
 
4
- //# debugId=511117DD1C2130E664756E2164756E21
4
+ //# debugId=5587364033EADA2664756E2164756E21
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../utils/parseTranslation.tsx", "../i18n/Dictionary.ts"],
3
+ "sources": ["../utils/parseTranslation.tsx", "../i18n/Dictionary.ts", "../i18n/translate.ts"],
4
4
  "sourcesContent": [
5
5
  "import { createElement, Fragment, isValidElement, type JSX } from \"react\";\n\ntype TemplateParams = Record<\n string,\n string | ((p: unknown) => string | JSX.Element)\n>;\n\nexport function parseTranslation(template: string, params: TemplateParams) {\n // Check if we have any JSX in our parameters\n const hasJSX = Object.values(params).some(\n (value) =>\n typeof value === \"function\" &&\n isValidElement((value as (p: unknown) => unknown)(\"\")),\n );\n\n // Regular expression to match template variables:\n // {{name}} - simple variable\n // {{name:type}} - variable with type casting\n // {{name:[content]}} - variable with interpolated content\n const regex = /{{([^{}]+?)(?::([^{}\\[\\]]+?))?(?:\\[(.*?)\\])?}}/g;\n\n if (!hasJSX) {\n // Simple string replacement\n const result = template.replace(regex, (match, name, type, content) => {\n // Clean the name part by removing any colon if present\n const cleanName = name.includes(\":\") ? name.split(\":\")[0] : name;\n\n const value = params[cleanName];\n if (value === undefined) {\n return match; // Return original match if no parameter found\n }\n\n if (typeof value === \"function\") {\n // If value is a function, call it with the content if available\n const functionParam = content !== undefined ? content : \"\";\n const functionResult = value(functionParam);\n // Check if function returned JSX - this shouldn't happen in the string branch\n if (isValidElement(functionResult)) {\n throw new Error(\"JSX returned in string context\");\n }\n return String(functionResult);\n }\n\n // Handle type casting if specified\n if (type) {\n switch (type.toLowerCase()) {\n case \"number\":\n return Number(value).toString();\n case \"string\":\n return String(value);\n case \"boolean\":\n return Boolean(value).toString();\n default:\n return String(value);\n }\n }\n return String(value);\n });\n return result as any;\n } else {\n // JSX replacement - we'll split the template into parts\n const parts: Array<string | JSX.Element> = [];\n let lastIndex = 0;\n let match: RegExpExecArray | null = null;\n\n while ((match = regex.exec(template)) !== null) {\n const [fullMatch, name, type, content] = match;\n const matchIndex = match.index;\n\n // Clean the name part by removing any colon if present\n const cleanName = name.includes(\":\") ? name.split(\":\")[0] : name;\n\n // Add text before the match\n if (matchIndex > lastIndex) {\n parts.push(template.substring(lastIndex, matchIndex));\n }\n\n const value = params[cleanName];\n if (value === undefined) {\n // Keep original template variable if no parameter found\n parts.push(fullMatch);\n } else if (typeof value === \"function\") {\n // If value is a function, call it with the content if available\n const functionParam = content !== undefined ? content : \"\";\n const functionResult = value(functionParam);\n parts.push(functionResult);\n } else if (type) {\n // Handle type casting if specified\n switch (type.toLowerCase()) {\n case \"number\":\n parts.push(Number(value).toString());\n break;\n case \"string\":\n parts.push(String(value));\n break;\n case \"boolean\":\n parts.push(Boolean(value).toString());\n break;\n default:\n parts.push(String(value));\n }\n } else {\n parts.push(String(value));\n }\n\n lastIndex = matchIndex + fullMatch.length;\n }\n\n // Add any remaining text\n if (lastIndex < template.length) {\n parts.push(template.substring(lastIndex));\n }\n\n // Convert the parts array to JSX\n return createElement(Fragment, {}, ...parts) as any;\n }\n}\n",
6
- "import { Lang } from \"../facades\";\nimport { parseTranslation } from \"../utils/parseTranslation\";\nimport type {\n ParseTranslationParams,\n ParseTranslationParamsServer,\n Prettify,\n} from \"../utils/type\";\n\ntype Translations = Record<string, Record<string, string>>;\n\nexport class Dictionary<T extends Translations> {\n constructor(\n public name: string,\n public dictionary: T,\n ) {}\n\n reference(key: keyof T) {\n if (typeof window !== \"undefined\") {\n throw new Error(\"Cannot use reference in the browser\");\n }\n if (!this.dictionary?.[key]) {\n throw new Error(`Translation not found for ${String(key)}`);\n }\n return this.dictionary[key];\n }\n\n render<\n K extends keyof T,\n U extends keyof T[K],\n R = Prettify<ParseTranslationParams<T[K][U]>>,\n >(\n key: K,\n ...args: R extends Record<string, never>\n ? [args?: { locale?: U | (string & {}) }]\n : [args: { locale?: U | (string & {}); params: R }]\n ) {\n const { locale = Lang.locale(), params } = {\n params: {},\n ...args[0],\n };\n\n if (typeof window !== \"undefined\") {\n throw new Error(\"Cannot use render in the browser\");\n }\n\n if (!this.dictionary?.[key]?.[locale]) {\n throw new Error(\n `Translation not found for ${String(key)} in ${String(locale)}`,\n );\n }\n return parseTranslation(this.dictionary[key][locale], params ?? {});\n }\n\n static create<const T extends Translations>(name: string, translations: T) {\n return new Dictionary<T>(name, translations);\n }\n\n static text<const T extends Record<string, string>, U extends keyof T>(\n content: T,\n ...args: Prettify<ParseTranslationParamsServer<T[U]>> extends Record<\n string,\n never\n >\n ? [args?: { locale?: U | (string & {}) }]\n : [\n args: {\n locale?: U | (string & {});\n params: Prettify<ParseTranslationParamsServer<T[U]>>;\n },\n ]\n ): string {\n const { locale = Lang.locale(), params } = { params: {}, ...args?.[0] };\n\n if (!content?.[locale]) {\n throw new Error(`Translation not found for ${String(locale)}`);\n }\n\n return parseTranslation(content[locale], params ?? {});\n }\n}\n"
6
+ "// The module, not the `../facades` barrel. A dictionary is the one server-side\n// artifact a *component* test has to import — `<Page dictionaries={[…]}>` takes\n// the app's real `app/i18n/index.ts` — and the barrel drags the whole facade\n// set in behind it, including `Redis` and its `import { RedisClient } from\n// \"bun\"`. Under a browser-targeted runner (vitest/jsdom) that specifier does\n// not resolve, so importing the app's dictionaries failed to collect before it\n// rendered anything. `Lang` itself only needs the translator and the request\n// context.\nimport { Lang } from \"../facades/Lang\";\nimport { parseTranslation } from \"../utils/parseTranslation\";\nimport type {\n ParseTranslationParams,\n ParseTranslationParamsServer,\n Prettify,\n} from \"../utils/type\";\n\ntype Translations = Record<string, Record<string, string>>;\n\nexport class Dictionary<T extends Translations> {\n constructor(\n public name: string,\n public dictionary: T,\n ) {}\n\n reference(key: keyof T) {\n if (typeof window !== \"undefined\") {\n throw new Error(\"Cannot use reference in the browser\");\n }\n if (!this.dictionary?.[key]) {\n throw new Error(`Translation not found for ${String(key)}`);\n }\n return this.dictionary[key];\n }\n\n render<\n K extends keyof T,\n U extends keyof T[K],\n R = Prettify<ParseTranslationParams<T[K][U]>>,\n >(\n key: K,\n ...args: R extends Record<string, never>\n ? [args?: { locale?: U | (string & {}) }]\n : [args: { locale?: U | (string & {}); params: R }]\n ) {\n const { locale = Lang.locale(), params } = {\n params: {},\n ...args[0],\n };\n\n if (typeof window !== \"undefined\") {\n throw new Error(\"Cannot use render in the browser\");\n }\n\n if (!this.dictionary?.[key]?.[locale]) {\n throw new Error(\n `Translation not found for ${String(key)} in ${String(locale)}`,\n );\n }\n return parseTranslation(this.dictionary[key][locale], params ?? {});\n }\n\n /**\n * @deprecated Use `defineDictionary` from `gemi/client`, declared next to the\n * component that reads it. A dictionary made here has to be re-exported from\n * `app/i18n/index.ts` and listed against a route in the `prefetch` config,\n * and every locale of it stays resident whether a page uses it or not. Still\n * supported; see `docs/i18n.md`.\n */\n static create<const T extends Translations>(name: string, translations: T) {\n return new Dictionary<T>(name, translations);\n }\n\n static text<const T extends Record<string, string>, U extends keyof T>(\n content: T,\n ...args: Prettify<ParseTranslationParamsServer<T[U]>> extends Record<\n string,\n never\n >\n ? [args?: { locale?: U | (string & {}) }]\n : [\n args: {\n locale?: U | (string & {});\n params: Prettify<ParseTranslationParamsServer<T[U]>>;\n },\n ]\n ): string {\n const { locale = Lang.locale(), params } = { params: {}, ...args?.[0] };\n\n if (!content?.[locale]) {\n throw new Error(`Translation not found for ${String(locale)}`);\n }\n\n return parseTranslation(content[locale], params ?? {});\n }\n}\n",
7
+ "import { Lang } from \"../facades\";\nimport { parseTranslation } from \"../utils/parseTranslation\";\nimport type { ParseTranslationParamsServer, Prettify } from \"../utils/type\";\nimport type { DictionaryHandle } from \"./defineDictionary\";\nimport type { DictionaryTranslations } from \"./dictionaryShape\";\n\n/**\n * Read one string from a `defineDictionary` dictionary outside React — a\n * controller, a job, an email template.\n *\n * Async because a bundled dictionary loads its locale on demand. Server code\n * does not go through the bundler, so in practice this resolves without ever\n * yielding; the `await` is what makes the same call work either way.\n *\n * Kept out of `defineDictionary.ts` on purpose: that module is imported by\n * components and has to stay free of the server facades this one needs.\n */\nexport async function translate<\n T extends DictionaryTranslations,\n K extends keyof T & string,\n U extends keyof T[K],\n R = Prettify<ParseTranslationParamsServer<T[K][U] & string>>,\n>(\n dictionary: DictionaryHandle<T>,\n key: K,\n ...args: R extends Record<string, never>\n ? [args?: { locale?: U | (string & {}) }]\n : [args: { locale?: U | (string & {}); params: R }]\n): Promise<string> {\n const { locale = Lang.locale(), params } = { params: {}, ...args[0] };\n const strings = await dictionary.load(String(locale));\n const template = strings[key];\n\n if (typeof template !== \"string\") {\n throw new Error(\n `Translation not found for \"${key}\" in \"${String(locale)}\" (dictionary ${dictionary.id})`,\n );\n }\n\n return parseTranslation(template, (params ?? {}) as any) as string;\n}\n"
7
8
  ],
8
- "mappings": ";khBAAA,mBAAS,SAAe,eAAU,SAO3B,IAAS,JAAgB,JAAC,HAAkB,HAAwB,JAEzE,DAAM,HAAS,EAAO,OAAO,CAAM,EAAE,KACnC,CAAC,IACC,OAAO,IAAU,YACjB,EAAgB,EAAkC,EAAE,CAAC,CACzD,EAMM,EAAQ,kDAEd,GAAI,CAAC,EAqCH,OAnCe,EAAS,QAAQ,EAAO,CAAC,EAAO,EAAM,EAAM,IAAY,CAErE,IAAM,EAAY,EAAK,SAAS,GAAG,EAAI,EAAK,MAAM,GAAG,EAAE,GAAK,EAEtD,EAAQ,EAAO,GACrB,GAAI,IAAU,OACZ,OAAO,EAGT,GAAI,OAAO,IAAU,WAAY,CAG/B,IAAM,EAAiB,EADD,IAAY,OAAY,EAAU,EACd,EAE1C,GAAI,EAAe,CAAc,EAC/B,MAAU,MAAM,gCAAgC,EAElD,OAAO,OAAO,CAAc,EAI9B,GAAI,EACF,OAAQ,EAAK,YAAY,OAClB,SACH,OAAO,OAAO,CAAK,EAAE,SAAS,MAC3B,SACH,OAAO,OAAO,CAAK,MAChB,UACH,OAAO,QAAQ,CAAK,EAAE,SAAS,UAE/B,OAAO,OAAO,CAAK,EAGzB,OAAO,OAAO,CAAK,EACpB,EAEI,KAEL,IAAM,EAAqC,CAAC,EACxC,EAAY,EACZ,EAAgC,KAEpC,OAAQ,EAAQ,EAAM,K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,CAAC,KACN,EAAK,EACV,EAEA,GAAI,OAAO,OAAW,IACpB,MAAU,MAAM,kCAAkC,EAGpD,GAAI,CAAC,KAAK,aAAa,KAAO,GAC5B,MAAU,MACR,6BAA6B,OAAO,CAAG,QAAQ,OAAO,CAAM,GAC9D,EAEF,OAAO,EAAiB,KAAK,WAAW,GAAK,GAAS,GAAU,CAAC,CAAC,QAU7D,OAAoC,CAAC,EAAc,EAAiB,CACzE,OAAO,IAAI,EAAc,EAAM,CAAY,QAGtC,KAA+D,CACpE,KACG,EAWK,CACR,IAAQ,SAAS,EAAK,OAAO,EAAG,UAAW,CAAE,OAAQ,CAAC,KAAM,IAAO,EAAG,EAEtE,GAAI,CAAC,IAAU,GACb,MAAU,MAAM,6BAA6B,OAAO,CAAM,GAAG,EAG/D,OAAO,EAAiB,EAAQ,GAAS,GAAU,CAAC,CAAC,EAEzD,CC7EA,eAAsB,CAKrB,CACC,EACA,KACG,EAGc,CACjB,IAAQ,SAAS,EAAK,OAAO,EAAG,UAAW,CAAE,OAAQ,CAAC,KAAM,EAAK,EAAG,EAE9D,GADU,MAAM,EAAW,KAAK,OAAO,CAAM,CAAC,GAC3B,GAEzB,GAAI,OAAO,IAAa,SACtB,MAAU,MACR,8BAA8B,UAAY,OAAO,CAAM,kBAAkB,EAAW,KACtF,EAGF,OAAO,EAAiB,EAAW,GAAU,CAAC,CAAS",
10
+ "debugId": "5587364033EADA2664756E2164756E21",
10
11
  "names": []
11
12
  }
@@ -0,0 +1,21 @@
1
+ import type { ParseTranslationParamsServer, Prettify } from "../utils/type";
2
+ import type { DictionaryHandle } from "./defineDictionary";
3
+ import type { DictionaryTranslations } from "./dictionaryShape";
4
+ /**
5
+ * Read one string from a `defineDictionary` dictionary outside React — a
6
+ * controller, a job, an email template.
7
+ *
8
+ * Async because a bundled dictionary loads its locale on demand. Server code
9
+ * does not go through the bundler, so in practice this resolves without ever
10
+ * yielding; the `await` is what makes the same call work either way.
11
+ *
12
+ * Kept out of `defineDictionary.ts` on purpose: that module is imported by
13
+ * components and has to stay free of the server facades this one needs.
14
+ */
15
+ export declare function translate<T extends DictionaryTranslations, K extends keyof T & string, U extends keyof T[K], R = Prettify<ParseTranslationParamsServer<T[K][U] & string>>>(dictionary: DictionaryHandle<T>, key: K, ...args: R extends Record<string, never> ? [args?: {
16
+ locale?: U | (string & {});
17
+ }] : [args: {
18
+ locale?: U | (string & {});
19
+ params: R;
20
+ }]): Promise<string>;
21
+ //# sourceMappingURL=translate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"translate.d.ts","sourceRoot":"","sources":["../../i18n/translate.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,4BAA4B,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAEhE;;;;;;;;;;GAUG;AACH,wBAAsB,SAAS,CAC7B,CAAC,SAAS,sBAAsB,EAChC,CAAC,SAAS,MAAM,CAAC,GAAG,MAAM,EAC1B,CAAC,SAAS,MAAM,CAAC,CAAC,CAAC,CAAC,EACpB,CAAC,GAAG,QAAQ,CAAC,4BAA4B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,EAE5D,UAAU,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAC/B,GAAG,EAAE,CAAC,EACN,GAAG,IAAI,EAAE,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GACpC,CAAC,IAAI,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;CAAE,CAAC,GACvC,CAAC,IAAI,EAAE;IAAE,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IAAC,MAAM,EAAE,CAAC,CAAA;CAAE,CAAC,GACpD,OAAO,CAAC,MAAM,CAAC,CAYjB"}
@@ -1,3 +1,3 @@
1
- export declare const GEMI_EXTERNAL_SPECIFIERS: readonly ["gemi", "gemi/client", "gemi/http", "gemi/app", "gemi/facades", "gemi/email", "gemi/kernel", "gemi/services", "gemi/broadcasting", "gemi/i18n"];
1
+ export declare const GEMI_EXTERNAL_SPECIFIERS: readonly ["gemi", "gemi/client", "gemi/http", "gemi/app", "gemi/facades", "gemi/email", "gemi/kernel", "gemi/services", "gemi/broadcasting", "gemi/i18n", "gemi/dictionary"];
2
2
  export declare function isGemiExternal(id: string): boolean;
3
3
  //# sourceMappingURL=gemiExternals.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gemiExternals.d.ts","sourceRoot":"","sources":["../../internal/gemiExternals.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,wBAAwB,2JAW3B,CAAC;AAIX,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAElD"}
1
+ {"version":3,"file":"gemiExternals.d.ts","sourceRoot":"","sources":["../../internal/gemiExternals.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,wBAAwB,8KAe3B,CAAC;AAIX,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAElD"}
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{p as X}from"../chunk-53e48ce8.js";import{L as m}from"../chunk-38ma6gg3.js";import{M as Y}from"../chunk-2qn472j4.js";import{Ma as H,Na as W,Oa as Z,Pa as _,Qa as $,Ra as F,Sa as T,Va as V,Wa as y,Za as K,_a as L,fb as Q,ib as U,jb as B}from"../chunk-jdfe4dmh.js";import{mb as k}from"../chunk-tmk4zfz9.js";import"../chunk-msz8rngs.js";import"../chunk-ha7n1c94.js";import"../chunk-ttzkn1qd.js";import{Hb as I,dc as b,ec as f}from"../chunk-km6x37ws.js";import"../chunk-et0j6jx8.js";import"../chunk-1ce7veh9.js";import{Qd as w}from"../chunk-qj4mmner.js";import{ee as D}from"../chunk-0tbwn6er.js";import"../chunk-4t6a82fh.js";import"../chunk-3y9nf09k.js";import"../chunk-cmq5t8p9.js";import"../chunk-88pq4gmf.js";import{Je as G,Le as x}from"../chunk-mt2755rs.js";import"../chunk-qyaqg07q.js";import"../chunk-0h3jr9d9.js";var E=[T,y,X,B,W,_,V,$,L,U,K,F,Y,Q,Z];class M{config={};providers=[];services=[];serviceInstances=[];serviceTokens=new Set;servicesBooted=!1;models=[];app=new x;boot(){if(this.models.length>0)m(...this.models);else R();this.app.config.merge(this.config),x.setInstance(this.app),this.app.registerMany([...E,...this.providers]),this.registerServices()}registerServices(){let q=this.serviceTokens;this.serviceInstances=[],this.serviceTokens=new Set,this.servicesBooted=!1;let J=new Map;for(let z of this.services){let C=typeof z==="function"?new z:z,j=C.constructor;if(!j.token)throw Error(`Service [${j.name}] is listed in \`services\` but does not declare a \`static token\`.`);let N=J.get(j.token);if(N)throw Error(`Services [${N}] and [${j.name}] both declare the token "${j.token}". Tokens are the container's keys, so they must be unique.`);J.set(j.token,j.name);let O=j;if(!q.has(j.token)&&this.app.bound(O))throw Error(`Service [${j.name}] declares the token "${j.token}", which is already bound in the container by the framework or a provider. Binding it would replace that service everywhere, so pick a token nothing else owns.`);this.app.instance(O,C),this.serviceInstances.push(C),this.serviceTokens.add(j.token)}}async waitForBoot(){await this.app.boot(),await this.bootServices()}async bootServices(){if(this.servicesBooted)return;for(let q of this.serviceInstances)await q.boot();this.servicesBooted=!0}run(q){return G.run(this.app,q)}resolve(q){return this.app.make(q)}apiRoutes(){return this.app.make(f)}viewRoutes(){return this.app.make(b)}broadcast(){return this.app.make(I)}queue(){return this.app.make(k)}destroy(){if(this.app.resolved(H))this.app.make(H).stop();if(this.app.flush(),x.getInstance()===this.app)x.setInstance(void 0);G.disable()}}function R(){if(Bun.env.NODE_ENV==="production")return;let q=D();if(q.length===0)return;console.warn(`[gemi] ${q.length} model${q.length===1?" is":"s are"} registered, but Kernel.models is empty.
2
+ import{v as X}from"../chunk-sqp7kn7h.js";import{R as m}from"../chunk-zckj6bs6.js";import{S as Y}from"../chunk-113khwbw.js";import{$a as V,Sa as H,Ta as W,Ua as Z,Va as _,Wa as $,Xa as F,Ya as T,ab as y,db as K,eb as L,lb as Q,ob as U,pb as B}from"../chunk-2zmz3pjk.js";import{sb as k}from"../chunk-1sh6kqjn.js";import"../chunk-xxw0gz4q.js";import"../chunk-004bcmsa.js";import"../chunk-n1tkn8gv.js";import{Nb as I,jc as b,kc as f}from"../chunk-kkkqyvwv.js";import"../chunk-pgjk5ft3.js";import"../chunk-k8endm5j.js";import"../chunk-e3mggavt.js";import{ee as w}from"../chunk-85av4ncy.js";import{ue as D}from"../chunk-k14dmqwh.js";import"../chunk-0weeq0ke.js";import"../chunk-g5tj10p8.js";import"../chunk-kv2ep453.js";import"../chunk-nncwsdzz.js";import{$e as x,Ze as G}from"../chunk-w6gb9gc5.js";import"../chunk-6j1z2cqt.js";import"../chunk-7f5ad759.js";var E=[T,y,X,B,W,_,V,$,L,U,K,F,Y,Q,Z];class M{config={};providers=[];services=[];serviceInstances=[];serviceTokens=new Set;servicesBooted=!1;models=[];app=new x;boot(){if(this.models.length>0)m(...this.models);else R();this.app.config.merge(this.config),x.setInstance(this.app),this.app.registerMany([...E,...this.providers]),this.registerServices()}registerServices(){let q=this.serviceTokens;this.serviceInstances=[],this.serviceTokens=new Set,this.servicesBooted=!1;let J=new Map;for(let z of this.services){let C=typeof z==="function"?new z:z,j=C.constructor;if(!j.token)throw Error(`Service [${j.name}] is listed in \`services\` but does not declare a \`static token\`.`);let N=J.get(j.token);if(N)throw Error(`Services [${N}] and [${j.name}] both declare the token "${j.token}". Tokens are the container's keys, so they must be unique.`);J.set(j.token,j.name);let O=j;if(!q.has(j.token)&&this.app.bound(O))throw Error(`Service [${j.name}] declares the token "${j.token}", which is already bound in the container by the framework or a provider. Binding it would replace that service everywhere, so pick a token nothing else owns.`);this.app.instance(O,C),this.serviceInstances.push(C),this.serviceTokens.add(j.token)}}async waitForBoot(){await this.app.boot(),await this.bootServices()}async bootServices(){if(this.servicesBooted)return;for(let q of this.serviceInstances)await q.boot();this.servicesBooted=!0}run(q){return G.run(this.app,q)}resolve(q){return this.app.make(q)}apiRoutes(){return this.app.make(f)}viewRoutes(){return this.app.make(b)}broadcast(){return this.app.make(I)}queue(){return this.app.make(k)}destroy(){if(this.app.resolved(H))this.app.make(H).stop();if(this.app.flush(),x.getInstance()===this.app)x.setInstance(void 0);G.disable()}}function R(){if(Bun.env.NODE_ENV==="production")return;let q=D();if(q.length===0)return;console.warn(`[gemi] ${q.length} model${q.length===1?" is":"s are"} registered, but Kernel.models is empty.
3
3
  Nested relation reads resolve a model by name, so a policy on a subclass that does not own its
4
4
  `+" name is skipped inside every include \u2014 scoped at the root, "+`unscoped in an include, with nothing
5
5
  to notice it. Declaring the modules registers each class under its own name and audits the set:
@@ -13,4 +13,4 @@ import{p as X}from"../chunk-53e48ce8.js";import{L as m}from"../chunk-38ma6gg3.js
13
13
 
14
14
  See docs/orm.md#your-model-class. Development only; this never prints in production.`)}export{E as frameworkProviders,w as UserProvider,M as Kernel};
15
15
 
16
- //# debugId=24A6314572A1246F64756E2164756E21
16
+ //# debugId=B6247DD650F3060864756E2164756E21
@@ -5,7 +5,7 @@
5
5
  "import type { ServiceProviderConstructor } from \"../foundation/Application\";\nimport { AuthServiceProvider } from \"../auth/AuthServiceProvider\";\nimport { DatabaseServiceProvider } from \"../database/DatabaseServiceProvider\";\nimport { TranslationServiceProvider } from \"../i18n/TranslationServiceProvider\";\nimport { ScheduleServiceProvider } from \"../services/cron/ScheduleServiceProvider\";\nimport { MailServiceProvider } from \"../services/email/MailServiceProvider\";\nimport { FilesystemServiceProvider } from \"../services/file-storage/FilesystemServiceProvider\";\nimport { ImageServiceProvider } from \"../services/image-optimization/ImageServiceProvider\";\nimport { KernelIdServiceProvider } from \"../services/kernel-id/KernelIdServiceProvider\";\nimport { LogServiceProvider } from \"../services/logging/LogServiceProvider\";\nimport { MiddlewareServiceProvider } from \"../services/middleware/MiddlewareServiceProvider\";\nimport { BroadcastServiceProvider } from \"../services/pubsub/BroadcastServiceProvider\";\nimport { QueueServiceProvider } from \"../services/queue/QueueServiceProvider\";\nimport { RateLimiterServiceProvider } from \"../services/rate-limiter/RateLimiterServiceProvider\";\nimport { RedisServiceProvider } from \"../services/redis/RedisServiceProvider\";\nimport { RouteServiceProvider } from \"../services/router/RouteServiceProvider\";\n\n/**\n * The providers every gemi app boots with, in registration order. Fifteen\n * providers for sixteen services — `RouteServiceProvider` owns both the api and\n * the view dispatcher, the way Laravel's does.\n *\n * Order only matters for `boot()`; `register()` binds factories and resolves\n * nothing, so no provider here depends on an earlier one having run.\n */\nexport const frameworkProviders: ServiceProviderConstructor[] = [\n KernelIdServiceProvider,\n MiddlewareServiceProvider,\n DatabaseServiceProvider,\n RouteServiceProvider,\n AuthServiceProvider,\n MailServiceProvider,\n LogServiceProvider,\n FilesystemServiceProvider,\n QueueServiceProvider,\n RedisServiceProvider,\n BroadcastServiceProvider,\n ImageServiceProvider,\n TranslationServiceProvider,\n RateLimiterServiceProvider,\n ScheduleServiceProvider,\n];\n",
6
6
  "import { Application } from \"../foundation/Application\";\nimport type { ServiceProviderConstructor } from \"../foundation/Application\";\nimport type { ServiceToken } from \"../container/Container\";\nimport type { ConfigItems } from \"../support/Repository\";\nimport type { Service, ServiceConstructor } from \"../support/Service\";\nimport { registerModels } from \"../orm/registration\";\nimport { registeredNames } from \"../orm/registry\";\nimport { Scheduler } from \"../services/cron/Scheduler\";\nimport { BroadcastManager } from \"../services/pubsub/BroadcastManager\";\nimport { QueueManager } from \"../services/queue/QueueManager\";\nimport { ApiRouteDispatcher } from \"../services/router/ApiRouteDispatcher\";\nimport { ViewRouteDispatcher } from \"../services/router/ViewRouteDispatcher\";\nimport { kernelContext } from \"./context\";\nimport { frameworkProviders } from \"./providers\";\n\n/**\n * The app's entry point into the framework. A Kernel subclass declares what the\n * app adds — its `config` slices and any extra `providers` — and everything\n * else lives in the Application container it owns.\n */\nexport class Kernel {\n /**\n * App-level config, merged over the framework defaults. Each key is a config\n * slice: `{ mail: { ... }, route: { ... } }`, normally the modules under\n * `app/config`.\n */\n protected config: ConfigItems = {};\n\n /**\n * App-level providers, registered after the framework's own so they can\n * rebind anything the framework bound.\n */\n protected providers: ServiceProviderConstructor[] = [];\n\n /**\n * The app's own singleton services. Each is constructed during the\n * synchronous boot phase and its `boot()` awaited during the asynchronous\n * one, in the order listed — so a service whose `boot()` depends on another\n * goes after it.\n *\n * An entry is either the class itself or a configured instance from\n * `Service.with({ ... })`. Listing is explicit rather than discovered because\n * the order is load-bearing here, and because a service is always imported by\n * whatever injects it — there is no file the import graph would miss.\n */\n protected services: Array<ServiceConstructor | Service> = [];\n\n private serviceInstances: Service[] = [];\n private serviceTokens = new Set<string>();\n private servicesBooted = false;\n\n /**\n * The modules holding the app's model classes — normally\n * `[generated, models]`, the generated namespace and the barrel of subclasses\n * written over it. Every model class they export is registered under the name\n * its schema carries, later modules winning, and the whole set is audited\n * before anything else boots.\n *\n * ### Why this is a Kernel field and not a line in a file somewhere\n *\n * Registration used to be `register(\"User\", User)` next to each subclass, and\n * the failure mode of forgetting it is an authorization hole that nothing\n * reports: a relation read resolves its target by name, so an unregistered\n * policied subclass leaves the generated base owning the name and every\n * nested `include` of that model comes back unscoped. No error at the root\n * either, because `$exec`'s divergence guard begins `registered !== this` and\n * the base it is running on *is* the registered one. A model only ever read\n * through an include — a membership, a pivot, the kind that carries a tenant\n * scope — never trips anything.\n *\n * Listing the modules here says it once, in the same place the app already\n * declares its config slices and providers, and turns the mistake into a\n * failure to boot rather than a quiet cross-tenant read.\n *\n * It sees the modules it is given, so a model class in a file that no barrel\n * re-exports is still invisible. That is the residual, and it is a smaller\n * one: a barrel is a place to notice an omission, and thirteen `register`\n * lines scattered across thirteen files is not.\n */\n protected models: Array<Record<string, unknown>> = [];\n\n readonly app = new Application();\n\n /**\n * Phase one, synchronous: every provider is constructed and its `register()`\n * runs. Only bindings are recorded here — no service is instantiated, so this\n * is safe to call from a synchronous constructor (`new App({ kernel })`).\n * Phase two is `waitForBoot()`.\n */\n boot() {\n // Before the container, deliberately. This throws on a model whose policies\n // would be skipped, and the useful moment for that is the one where nothing\n // has been constructed and no request can be in flight.\n if (this.models.length > 0) registerModels(...this.models);\n else warnIfModelsAreRegisteredButUndeclared();\n\n this.app.config.merge(this.config);\n Application.setInstance(this.app);\n this.app.registerMany([...frameworkProviders, ...this.providers]);\n this.registerServices();\n }\n\n /**\n * Constructs every listed service and binds it into the container. Runs after\n * the providers have registered, so a provider's `boot()` can `inject()` one;\n * a `Service` constructor does no I/O, so doing this synchronously costs\n * nothing beyond the field initializers.\n */\n private registerServices() {\n // What a previous pass bound, so re-running this on the same kernel is not\n // mistaken for a collision with something else.\n const ours = this.serviceTokens;\n\n this.serviceInstances = [];\n this.serviceTokens = new Set();\n this.servicesBooted = false;\n\n const owners = new Map<string, string>();\n\n for (const declaration of this.services) {\n const instance =\n typeof declaration === \"function\" ? new declaration() : declaration;\n const ctor = instance.constructor as ServiceConstructor;\n\n if (!ctor.token) {\n throw new Error(\n `Service [${ctor.name}] is listed in \\`services\\` but does not declare a \\`static token\\`.`,\n );\n }\n\n // Two services under one token is the failure this refuses to have\n // silently: the second would replace the first in the container, and\n // every `inject()` written against either would hand back whichever was\n // listed last.\n const owner = owners.get(ctor.token);\n if (owner) {\n throw new Error(\n `Services [${owner}] and [${ctor.name}] both declare the token \"${ctor.token}\". Tokens are the container's keys, so they must be unique.`,\n );\n }\n owners.set(ctor.token, ctor.name);\n\n // The same failure one level out. `Container.instance()` writes into\n // `instances`, which `make()` consults before `bindings`, so a token that\n // is already spoken for is not shared with its owner — it replaces it, for\n // every `app()` and `inject()` in the process. An app service that named\n // itself \"mail\" would leave `Mail.send()` resolving to an object with no\n // `send`, and the boot that caused it would report nothing. Providers have\n // all registered by now, so anything bound here belongs to somebody else.\n const token = ctor as unknown as ServiceToken<Service>;\n if (!ours.has(ctor.token) && this.app.bound(token)) {\n throw new Error(\n `Service [${ctor.name}] declares the token \"${ctor.token}\", which is already bound in the container by the framework or a provider. Binding it would replace that service everywhere, so pick a token nothing else owns.`,\n );\n }\n\n this.app.instance(token, instance);\n this.serviceInstances.push(instance);\n this.serviceTokens.add(ctor.token);\n }\n }\n\n /**\n * Phase two, asynchronous: every provider's `boot()` runs, in registration\n * order, after all of them have registered. Idempotent.\n */\n async waitForBoot() {\n await this.app.boot();\n await this.bootServices();\n }\n\n /**\n * Phase two for services, after every provider's `boot()` — so a service may\n * use the facades and anything else a provider owns. Idempotent, like the\n * provider phase it follows.\n */\n private async bootServices() {\n if (this.servicesBooted) {\n return;\n }\n for (const service of this.serviceInstances) {\n await service.boot();\n }\n this.servicesBooted = true;\n }\n\n run<T>(cb: () => T) {\n return kernelContext.run(this.app, cb);\n }\n\n /**\n * Resolve a service by token. Callers outside this module should prefer the\n * named accessors below or `app()`; this exists for tooling that holds a\n * Kernel but no ambient context.\n */\n resolve<T>(token: ServiceToken<T>): T {\n return this.app.make(token);\n }\n\n // Named accessors. `app/App.ts` goes through these rather than importing the\n // service classes itself — see the note in that file about the two copies of\n // gemi that coexist at build time.\n apiRoutes(): ApiRouteDispatcher {\n return this.app.make(ApiRouteDispatcher);\n }\n\n viewRoutes(): ViewRouteDispatcher {\n return this.app.make(ViewRouteDispatcher);\n }\n\n broadcast(): BroadcastManager {\n return this.app.make(BroadcastManager);\n }\n\n queue(): QueueManager {\n return this.app.make(QueueManager);\n }\n\n destroy() {\n // Only touch services that were actually resolved — resolving one here\n // would construct it purely to tear it down.\n if (this.app.resolved(Scheduler)) {\n this.app.make(Scheduler).stop();\n }\n\n this.app.flush();\n\n if (Application.getInstance() === this.app) {\n Application.setInstance(undefined);\n }\n\n kernelContext.disable();\n }\n}\n\n/**\n * Says something to an application that has models and has not declared them.\n *\n * Without this the fix for #316 defaults to off. `models` is `[]`, `boot()`\n * no-ops, and an app upgrading from 0.48 is in exactly the state the issue\n * describes until somebody edits their Kernel by hand — while the only place\n * that says to is the **Setup** section of `docs/orm.md`, which an existing app\n * read once and will not read again. #316 was filed by an app mid-migration\n * with a 79-model schema, which is precisely the reader who never sees it.\n *\n * The condition is what makes this worth printing. A populated registry with an\n * empty `models` means the generated `index.ts` was imported and its bases are\n * what every nested read resolves to — so if any policy lives on a subclass, it\n * is being skipped inside includes right now. A Kernel with no ORM at all has\n * an empty registry and hears nothing.\n *\n * Development only, and a warning rather than a throw: an app in this state is\n * running today, and turning a working deploy into a failure to start over an\n * arrangement that *might* be fine is not a patch-level thing to do. The\n * failure it points at is silent, so the fix for it has to be noisy somewhere,\n * and the terminal an author is already looking at is the cheapest somewhere\n * there is.\n */\nfunction warnIfModelsAreRegisteredButUndeclared(): void {\n if (process.env.NODE_ENV === \"production\") return;\n\n const registered = registeredNames();\n if (registered.length === 0) return;\n\n console.warn(\n `[gemi] ${registered.length} model${registered.length === 1 ? \" is\" : \"s are\"} ` +\n `registered, but Kernel.models is empty.\\n` +\n ` Nested relation reads resolve a model by name, so a policy on a ` +\n `subclass that does not own its\\n` +\n ` name is skipped inside every include — scoped at the root, ` +\n `unscoped in an include, with nothing\\n` +\n ` to notice it. Declaring the modules registers each class under ` +\n `its own name and audits the set:\\n\\n` +\n ` import * as generated from \"../models/generated\"\\n` +\n ` import * as models from \"../models\"\\n\\n` +\n ` export default class extends Kernel {\\n` +\n ` models = [generated, models]\\n` +\n ` }\\n\\n` +\n ` See docs/orm.md#your-model-class. Development only; this never ` +\n `prints in production.`,\n );\n}\n"
7
7
  ],
8
- "mappings": ";q5BAyBO,DAAM,HAAmD,JAC9D,HACA,HACA,HACA,HACA,HACA,HACA,HACA,HACA,HACA,HACA,HACA,HACA,HACA,HACA,JACF,HCrBO,MAAM,CAAO,CAMR,OAAsB,CAAC,EAMvB,UAA0C,CAAC,EAa3C,SAAgD,CAAC,EAEnD,iBAA8B,CAAC,EAC/B,cAAgB,IAAI,IACpB,eAAiB,G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