@buenojs/bueno 0.8.10 → 0.8.11

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 (699) hide show
  1. package/dist/cache/index.d.ts +187 -0
  2. package/dist/cache/index.d.ts.map +1 -0
  3. package/dist/cache/index.js +595 -0
  4. package/dist/cache/index.js.map +1 -0
  5. package/dist/cli/bin.d.ts +8 -0
  6. package/dist/cli/bin.d.ts.map +1 -0
  7. package/dist/cli/bin.js +9 -9
  8. package/dist/cli/bin.js.map +1 -0
  9. package/dist/cli/commands/add-frontend.d.ts +7 -0
  10. package/dist/cli/commands/add-frontend.d.ts.map +1 -0
  11. package/dist/cli/commands/add-frontend.js +376 -0
  12. package/dist/cli/commands/add-frontend.js.map +1 -0
  13. package/dist/cli/commands/build.d.ts +7 -0
  14. package/dist/cli/commands/build.d.ts.map +1 -0
  15. package/dist/cli/commands/build.js +347 -0
  16. package/dist/cli/commands/build.js.map +1 -0
  17. package/dist/cli/commands/dev.d.ts +7 -0
  18. package/dist/cli/commands/dev.d.ts.map +1 -0
  19. package/dist/cli/commands/dev.js +205 -0
  20. package/dist/cli/commands/dev.js.map +1 -0
  21. package/dist/cli/commands/generate.d.ts +7 -0
  22. package/dist/cli/commands/generate.d.ts.map +1 -0
  23. package/dist/cli/commands/generate.js +491 -0
  24. package/dist/cli/commands/generate.js.map +1 -0
  25. package/dist/cli/commands/help.d.ts +7 -0
  26. package/dist/cli/commands/help.d.ts.map +1 -0
  27. package/dist/cli/commands/help.js +51 -0
  28. package/dist/cli/commands/help.js.map +1 -0
  29. package/dist/cli/commands/index.d.ts +59 -0
  30. package/dist/cli/commands/index.d.ts.map +1 -0
  31. package/dist/cli/commands/index.js +77 -0
  32. package/dist/cli/commands/index.js.map +1 -0
  33. package/dist/cli/commands/migration.d.ts +7 -0
  34. package/dist/cli/commands/migration.d.ts.map +1 -0
  35. package/dist/cli/commands/migration.js +295 -0
  36. package/dist/cli/commands/migration.js.map +1 -0
  37. package/dist/cli/commands/new.d.ts +7 -0
  38. package/dist/cli/commands/new.d.ts.map +1 -0
  39. package/dist/cli/commands/new.js +641 -0
  40. package/dist/cli/commands/new.js.map +1 -0
  41. package/dist/cli/commands/start.d.ts +7 -0
  42. package/dist/cli/commands/start.d.ts.map +1 -0
  43. package/dist/cli/commands/start.js +171 -0
  44. package/dist/cli/commands/start.js.map +1 -0
  45. package/dist/cli/core/args.d.ts +61 -0
  46. package/dist/cli/core/args.d.ts.map +1 -0
  47. package/dist/cli/core/args.js +224 -0
  48. package/dist/cli/core/args.js.map +1 -0
  49. package/dist/cli/core/console.d.ts +135 -0
  50. package/dist/cli/core/console.d.ts.map +1 -0
  51. package/dist/cli/core/console.js +268 -0
  52. package/dist/cli/core/console.js.map +1 -0
  53. package/dist/cli/core/index.d.ts +10 -0
  54. package/dist/cli/core/index.d.ts.map +1 -0
  55. package/dist/cli/core/index.js +10 -0
  56. package/dist/cli/core/index.js.map +1 -0
  57. package/dist/cli/core/prompt.d.ts +63 -0
  58. package/dist/cli/core/prompt.d.ts.map +1 -0
  59. package/dist/cli/core/prompt.js +338 -0
  60. package/dist/cli/core/prompt.js.map +1 -0
  61. package/dist/cli/core/spinner.d.ts +111 -0
  62. package/dist/cli/core/spinner.d.ts.map +1 -0
  63. package/dist/cli/core/spinner.js +208 -0
  64. package/dist/cli/core/spinner.js.map +1 -0
  65. package/dist/cli/index.d.ts +47 -0
  66. package/dist/cli/index.d.ts.map +1 -0
  67. package/dist/cli/index.js +127 -0
  68. package/dist/cli/index.js.map +1 -0
  69. package/dist/cli/templates/database/index.d.ts +24 -0
  70. package/dist/cli/templates/database/index.d.ts.map +1 -0
  71. package/dist/cli/templates/database/index.js +49 -0
  72. package/dist/cli/templates/database/index.js.map +1 -0
  73. package/dist/cli/templates/database/mysql.d.ts +6 -0
  74. package/dist/cli/templates/database/mysql.d.ts.map +1 -0
  75. package/dist/cli/templates/database/mysql.js +12 -0
  76. package/dist/cli/templates/database/mysql.js.map +1 -0
  77. package/dist/cli/templates/database/none.d.ts +8 -0
  78. package/dist/cli/templates/database/none.d.ts.map +1 -0
  79. package/dist/cli/templates/database/none.js +14 -0
  80. package/dist/cli/templates/database/none.js.map +1 -0
  81. package/dist/cli/templates/database/postgresql.d.ts +6 -0
  82. package/dist/cli/templates/database/postgresql.d.ts.map +1 -0
  83. package/dist/cli/templates/database/postgresql.js +12 -0
  84. package/dist/cli/templates/database/postgresql.js.map +1 -0
  85. package/dist/cli/templates/database/sqlite.d.ts +6 -0
  86. package/dist/cli/templates/database/sqlite.d.ts.map +1 -0
  87. package/dist/cli/templates/database/sqlite.js +12 -0
  88. package/dist/cli/templates/database/sqlite.js.map +1 -0
  89. package/dist/cli/templates/deploy.d.ts +41 -0
  90. package/dist/cli/templates/deploy.d.ts.map +1 -0
  91. package/dist/cli/templates/deploy.js +278 -0
  92. package/dist/cli/templates/deploy.js.map +1 -0
  93. package/dist/cli/templates/docker.d.ts +30 -0
  94. package/dist/cli/templates/docker.d.ts.map +1 -0
  95. package/dist/cli/templates/docker.js +298 -0
  96. package/dist/cli/templates/docker.js.map +1 -0
  97. package/dist/cli/templates/frontend/index.d.ts +25 -0
  98. package/dist/cli/templates/frontend/index.d.ts.map +1 -0
  99. package/dist/cli/templates/frontend/index.js +40 -0
  100. package/dist/cli/templates/frontend/index.js.map +1 -0
  101. package/dist/cli/templates/frontend/none.d.ts +8 -0
  102. package/dist/cli/templates/frontend/none.d.ts.map +1 -0
  103. package/dist/cli/templates/frontend/none.js +15 -0
  104. package/dist/cli/templates/frontend/none.js.map +1 -0
  105. package/dist/cli/templates/frontend/react.d.ts +6 -0
  106. package/dist/cli/templates/frontend/react.d.ts.map +1 -0
  107. package/dist/cli/templates/frontend/react.js +139 -0
  108. package/dist/cli/templates/frontend/react.js.map +1 -0
  109. package/dist/cli/templates/frontend/solid.d.ts +6 -0
  110. package/dist/cli/templates/frontend/solid.d.ts.map +1 -0
  111. package/dist/cli/templates/frontend/solid.js +133 -0
  112. package/dist/cli/templates/frontend/solid.js.map +1 -0
  113. package/dist/cli/templates/frontend/svelte.d.ts +6 -0
  114. package/dist/cli/templates/frontend/svelte.d.ts.map +1 -0
  115. package/dist/cli/templates/frontend/svelte.js +130 -0
  116. package/dist/cli/templates/frontend/svelte.js.map +1 -0
  117. package/dist/cli/templates/frontend/vue.d.ts +6 -0
  118. package/dist/cli/templates/frontend/vue.d.ts.map +1 -0
  119. package/dist/cli/templates/frontend/vue.js +129 -0
  120. package/dist/cli/templates/frontend/vue.js.map +1 -0
  121. package/dist/cli/templates/generators/index.d.ts +29 -0
  122. package/dist/cli/templates/generators/index.d.ts.map +1 -0
  123. package/dist/cli/templates/generators/index.js +308 -0
  124. package/dist/cli/templates/generators/index.js.map +1 -0
  125. package/dist/cli/templates/generators/types.d.ts +32 -0
  126. package/dist/cli/templates/generators/types.d.ts.map +1 -0
  127. package/dist/cli/templates/generators/types.js +21 -0
  128. package/dist/cli/templates/generators/types.js.map +1 -0
  129. package/dist/cli/templates/index.d.ts +12 -0
  130. package/dist/cli/templates/index.d.ts.map +1 -0
  131. package/dist/cli/templates/index.js +18 -0
  132. package/dist/cli/templates/index.js.map +1 -0
  133. package/dist/cli/templates/project/api.d.ts +6 -0
  134. package/dist/cli/templates/project/api.d.ts.map +1 -0
  135. package/dist/cli/templates/project/api.js +79 -0
  136. package/dist/cli/templates/project/api.js.map +1 -0
  137. package/dist/cli/templates/project/default.d.ts +6 -0
  138. package/dist/cli/templates/project/default.d.ts.map +1 -0
  139. package/dist/cli/templates/project/default.js +136 -0
  140. package/dist/cli/templates/project/default.js.map +1 -0
  141. package/dist/cli/templates/project/fullstack.d.ts +14 -0
  142. package/dist/cli/templates/project/fullstack.d.ts.map +1 -0
  143. package/dist/cli/templates/project/fullstack.js +19 -0
  144. package/dist/cli/templates/project/fullstack.js.map +1 -0
  145. package/dist/cli/templates/project/index.d.ts +26 -0
  146. package/dist/cli/templates/project/index.d.ts.map +1 -0
  147. package/dist/cli/templates/project/index.js +60 -0
  148. package/dist/cli/templates/project/index.js.map +1 -0
  149. package/dist/cli/templates/project/minimal.d.ts +6 -0
  150. package/dist/cli/templates/project/minimal.d.ts.map +1 -0
  151. package/dist/cli/templates/project/minimal.js +43 -0
  152. package/dist/cli/templates/project/minimal.js.map +1 -0
  153. package/dist/cli/templates/project/types.d.ts +80 -0
  154. package/dist/cli/templates/project/types.d.ts.map +1 -0
  155. package/dist/cli/templates/project/types.js +7 -0
  156. package/dist/cli/templates/project/types.js.map +1 -0
  157. package/dist/cli/templates/project/website.d.ts +8 -0
  158. package/dist/cli/templates/project/website.d.ts.map +1 -0
  159. package/dist/cli/templates/project/website.js +312 -0
  160. package/dist/cli/templates/project/website.js.map +1 -0
  161. package/dist/cli/utils/fs.d.ts +137 -0
  162. package/dist/cli/utils/fs.d.ts.map +1 -0
  163. package/dist/cli/utils/fs.js +350 -0
  164. package/dist/cli/utils/fs.js.map +1 -0
  165. package/dist/cli/utils/index.d.ts +9 -0
  166. package/dist/cli/utils/index.d.ts.map +1 -0
  167. package/dist/cli/utils/index.js +9 -0
  168. package/dist/cli/utils/index.js.map +1 -0
  169. package/dist/cli/utils/strings.d.ts +86 -0
  170. package/dist/cli/utils/strings.d.ts.map +1 -0
  171. package/dist/cli/utils/strings.js +190 -0
  172. package/dist/cli/utils/strings.js.map +1 -0
  173. package/dist/cli/utils/version.d.ts +15 -0
  174. package/dist/cli/utils/version.d.ts.map +1 -0
  175. package/dist/cli/utils/version.js +38 -0
  176. package/dist/cli/utils/version.js.map +1 -0
  177. package/dist/config/env-validation.d.ts +49 -0
  178. package/dist/config/env-validation.d.ts.map +1 -0
  179. package/dist/config/env-validation.js +77 -0
  180. package/dist/config/env-validation.js.map +1 -0
  181. package/dist/config/env.d.ts +167 -0
  182. package/dist/config/env.d.ts.map +1 -0
  183. package/dist/config/env.js +392 -0
  184. package/dist/config/env.js.map +1 -0
  185. package/dist/config/index.d.ts +168 -0
  186. package/dist/config/index.d.ts.map +1 -0
  187. package/dist/config/index.js +329 -0
  188. package/dist/config/index.js.map +1 -0
  189. package/dist/config/loader.d.ts +81 -0
  190. package/dist/config/loader.d.ts.map +1 -0
  191. package/dist/config/loader.js +242 -0
  192. package/dist/config/loader.js.map +1 -0
  193. package/dist/config/merge.d.ts +66 -0
  194. package/dist/config/merge.d.ts.map +1 -0
  195. package/dist/config/merge.js +226 -0
  196. package/dist/config/merge.js.map +1 -0
  197. package/dist/config/types.d.ts +322 -0
  198. package/dist/config/types.d.ts.map +1 -0
  199. package/dist/config/types.js +443 -0
  200. package/dist/config/types.js.map +1 -0
  201. package/dist/config/validation.d.ts +100 -0
  202. package/dist/config/validation.d.ts.map +1 -0
  203. package/dist/config/validation.js +548 -0
  204. package/dist/config/validation.js.map +1 -0
  205. package/dist/container/forward-ref.d.ts +116 -0
  206. package/dist/container/forward-ref.d.ts.map +1 -0
  207. package/dist/container/forward-ref.js +105 -0
  208. package/dist/container/forward-ref.js.map +1 -0
  209. package/dist/container/index.d.ts +95 -0
  210. package/dist/container/index.d.ts.map +1 -0
  211. package/dist/container/index.js.map +1 -0
  212. package/dist/context/index.d.ts +143 -0
  213. package/dist/context/index.d.ts.map +1 -0
  214. package/dist/context/index.js.map +1 -0
  215. package/dist/database/index.d.ts +219 -0
  216. package/dist/database/index.d.ts.map +1 -0
  217. package/dist/database/index.js.map +1 -0
  218. package/dist/database/migrations/index.d.ts +151 -0
  219. package/dist/database/migrations/index.d.ts.map +1 -0
  220. package/dist/database/migrations/index.js +258 -0
  221. package/dist/database/migrations/index.js.map +1 -0
  222. package/dist/database/orm/builder.d.ts +122 -0
  223. package/dist/database/orm/builder.d.ts.map +1 -0
  224. package/dist/database/orm/builder.js +355 -0
  225. package/dist/database/orm/builder.js.map +1 -0
  226. package/dist/database/orm/casts/index.d.ts +16 -0
  227. package/dist/database/orm/casts/index.d.ts.map +1 -0
  228. package/dist/database/orm/casts/index.js +131 -0
  229. package/dist/database/orm/casts/index.js.map +1 -0
  230. package/dist/database/orm/casts/types.d.ts +16 -0
  231. package/dist/database/orm/casts/types.d.ts.map +1 -0
  232. package/dist/database/orm/casts/types.js +5 -0
  233. package/dist/database/orm/casts/types.js.map +1 -0
  234. package/dist/database/orm/compiler.d.ts +90 -0
  235. package/dist/database/orm/compiler.d.ts.map +1 -0
  236. package/dist/database/orm/compiler.js +218 -0
  237. package/dist/database/orm/compiler.js.map +1 -0
  238. package/dist/database/orm/hooks/index.d.ts +53 -0
  239. package/dist/database/orm/hooks/index.d.ts.map +1 -0
  240. package/dist/database/orm/hooks/index.js +81 -0
  241. package/dist/database/orm/hooks/index.js.map +1 -0
  242. package/dist/database/orm/index.d.ts +21 -0
  243. package/dist/database/orm/index.d.ts.map +1 -0
  244. package/dist/database/orm/index.js +23 -0
  245. package/dist/database/orm/index.js.map +1 -0
  246. package/dist/database/orm/model-registry.d.ts +33 -0
  247. package/dist/database/orm/model-registry.d.ts.map +1 -0
  248. package/dist/database/orm/model-registry.js +49 -0
  249. package/dist/database/orm/model-registry.js.map +1 -0
  250. package/dist/database/orm/model.d.ts +245 -0
  251. package/dist/database/orm/model.d.ts.map +1 -0
  252. package/dist/database/orm/model.js +599 -0
  253. package/dist/database/orm/model.js.map +1 -0
  254. package/dist/database/orm/relationships/base.d.ts +69 -0
  255. package/dist/database/orm/relationships/base.d.ts.map +1 -0
  256. package/dist/database/orm/relationships/base.js +84 -0
  257. package/dist/database/orm/relationships/base.js.map +1 -0
  258. package/dist/database/orm/relationships/belongs-to-many.d.ts +47 -0
  259. package/dist/database/orm/relationships/belongs-to-many.d.ts.map +1 -0
  260. package/dist/database/orm/relationships/belongs-to-many.js +136 -0
  261. package/dist/database/orm/relationships/belongs-to-many.js.map +1 -0
  262. package/dist/database/orm/relationships/belongs-to.d.ts +17 -0
  263. package/dist/database/orm/relationships/belongs-to.d.ts.map +1 -0
  264. package/dist/database/orm/relationships/belongs-to.js +38 -0
  265. package/dist/database/orm/relationships/belongs-to.js.map +1 -0
  266. package/dist/database/orm/relationships/has-many.d.ts +14 -0
  267. package/dist/database/orm/relationships/has-many.d.ts.map +1 -0
  268. package/dist/database/orm/relationships/has-many.js +35 -0
  269. package/dist/database/orm/relationships/has-many.js.map +1 -0
  270. package/dist/database/orm/relationships/has-one.d.ts +14 -0
  271. package/dist/database/orm/relationships/has-one.d.ts.map +1 -0
  272. package/dist/database/orm/relationships/has-one.js +32 -0
  273. package/dist/database/orm/relationships/has-one.js.map +1 -0
  274. package/dist/database/orm/relationships/index.d.ts +10 -0
  275. package/dist/database/orm/relationships/index.d.ts.map +1 -0
  276. package/dist/database/orm/relationships/index.js +9 -0
  277. package/dist/database/orm/relationships/index.js.map +1 -0
  278. package/dist/database/orm/scopes/index.d.ts +36 -0
  279. package/dist/database/orm/scopes/index.d.ts.map +1 -0
  280. package/dist/database/orm/scopes/index.js +47 -0
  281. package/dist/database/orm/scopes/index.js.map +1 -0
  282. package/dist/database/schema/index.d.ts +155 -0
  283. package/dist/database/schema/index.d.ts.map +1 -0
  284. package/dist/database/schema/index.js +401 -0
  285. package/dist/database/schema/index.js.map +1 -0
  286. package/dist/frontend/api-routes.d.ts +189 -0
  287. package/dist/frontend/api-routes.d.ts.map +1 -0
  288. package/dist/frontend/api-routes.js +548 -0
  289. package/dist/frontend/api-routes.js.map +1 -0
  290. package/dist/frontend/bundler.d.ts +99 -0
  291. package/dist/frontend/bundler.d.ts.map +1 -0
  292. package/dist/frontend/bundler.js +555 -0
  293. package/dist/frontend/bundler.js.map +1 -0
  294. package/dist/frontend/console-client.d.ts +11 -0
  295. package/dist/frontend/console-client.d.ts.map +1 -0
  296. package/dist/frontend/console-client.js +414 -0
  297. package/dist/frontend/console-client.js.map +1 -0
  298. package/dist/frontend/console-stream.d.ts +138 -0
  299. package/dist/frontend/console-stream.d.ts.map +1 -0
  300. package/dist/frontend/console-stream.js +535 -0
  301. package/dist/frontend/console-stream.js.map +1 -0
  302. package/dist/frontend/dev-server.d.ts +174 -0
  303. package/dist/frontend/dev-server.d.ts.map +1 -0
  304. package/dist/frontend/dev-server.js +735 -0
  305. package/dist/frontend/dev-server.js.map +1 -0
  306. package/dist/frontend/file-router.d.ts +170 -0
  307. package/dist/frontend/file-router.d.ts.map +1 -0
  308. package/dist/frontend/file-router.js +531 -0
  309. package/dist/frontend/file-router.js.map +1 -0
  310. package/dist/frontend/frameworks/index.d.ts +41 -0
  311. package/dist/frontend/frameworks/index.d.ts.map +1 -0
  312. package/dist/frontend/frameworks/index.js +87 -0
  313. package/dist/frontend/frameworks/index.js.map +1 -0
  314. package/dist/frontend/frameworks/react.d.ts +32 -0
  315. package/dist/frontend/frameworks/react.d.ts.map +1 -0
  316. package/dist/frontend/frameworks/react.js +66 -0
  317. package/dist/frontend/frameworks/react.js.map +1 -0
  318. package/dist/frontend/frameworks/solid.d.ts +42 -0
  319. package/dist/frontend/frameworks/solid.d.ts.map +1 -0
  320. package/dist/frontend/frameworks/solid.js +84 -0
  321. package/dist/frontend/frameworks/solid.js.map +1 -0
  322. package/dist/frontend/frameworks/svelte.d.ts +57 -0
  323. package/dist/frontend/frameworks/svelte.d.ts.map +1 -0
  324. package/dist/frontend/frameworks/svelte.js +90 -0
  325. package/dist/frontend/frameworks/svelte.js.map +1 -0
  326. package/dist/frontend/frameworks/vue.d.ts +36 -0
  327. package/dist/frontend/frameworks/vue.d.ts.map +1 -0
  328. package/dist/frontend/frameworks/vue.js +72 -0
  329. package/dist/frontend/frameworks/vue.js.map +1 -0
  330. package/dist/frontend/hmr-client.d.ts +22 -0
  331. package/dist/frontend/hmr-client.d.ts.map +1 -0
  332. package/dist/frontend/hmr-client.js +654 -0
  333. package/dist/frontend/hmr-client.js.map +1 -0
  334. package/dist/frontend/hmr.d.ts +185 -0
  335. package/dist/frontend/hmr.d.ts.map +1 -0
  336. package/dist/frontend/hmr.js +619 -0
  337. package/dist/frontend/hmr.js.map +1 -0
  338. package/dist/frontend/index.d.ts +34 -0
  339. package/dist/frontend/index.d.ts.map +1 -0
  340. package/dist/frontend/index.js.map +1 -0
  341. package/dist/frontend/islands.d.ts +135 -0
  342. package/dist/frontend/islands.d.ts.map +1 -0
  343. package/dist/frontend/islands.js +455 -0
  344. package/dist/frontend/islands.js.map +1 -0
  345. package/dist/frontend/isr.d.ts +143 -0
  346. package/dist/frontend/isr.d.ts.map +1 -0
  347. package/dist/frontend/isr.js +440 -0
  348. package/dist/frontend/isr.js.map +1 -0
  349. package/dist/frontend/layout.d.ts +140 -0
  350. package/dist/frontend/layout.d.ts.map +1 -0
  351. package/dist/frontend/layout.js +392 -0
  352. package/dist/frontend/layout.js.map +1 -0
  353. package/dist/frontend/ssr/react.d.ts +118 -0
  354. package/dist/frontend/ssr/react.d.ts.map +1 -0
  355. package/dist/frontend/ssr/react.js +373 -0
  356. package/dist/frontend/ssr/react.js.map +1 -0
  357. package/dist/frontend/ssr/solid.d.ts +141 -0
  358. package/dist/frontend/ssr/solid.d.ts.map +1 -0
  359. package/dist/frontend/ssr/solid.js +440 -0
  360. package/dist/frontend/ssr/solid.js.map +1 -0
  361. package/dist/frontend/ssr/svelte.d.ts +158 -0
  362. package/dist/frontend/ssr/svelte.d.ts.map +1 -0
  363. package/dist/frontend/ssr/svelte.js +439 -0
  364. package/dist/frontend/ssr/svelte.js.map +1 -0
  365. package/dist/frontend/ssr/vue.d.ts +161 -0
  366. package/dist/frontend/ssr/vue.d.ts.map +1 -0
  367. package/dist/frontend/ssr/vue.js +385 -0
  368. package/dist/frontend/ssr/vue.js.map +1 -0
  369. package/dist/frontend/ssr.d.ts +147 -0
  370. package/dist/frontend/ssr.d.ts.map +1 -0
  371. package/dist/frontend/ssr.js +609 -0
  372. package/dist/frontend/ssr.js.map +1 -0
  373. package/dist/frontend/types.d.ts +1902 -0
  374. package/dist/frontend/types.d.ts.map +1 -0
  375. package/dist/frontend/types.js +8 -0
  376. package/dist/frontend/types.js.map +1 -0
  377. package/dist/graphql/built-in-engine.d.ts +36 -0
  378. package/dist/graphql/built-in-engine.d.ts.map +1 -0
  379. package/dist/graphql/built-in-engine.js +443 -0
  380. package/dist/graphql/built-in-engine.js.map +1 -0
  381. package/dist/graphql/context-builder.d.ts +44 -0
  382. package/dist/graphql/context-builder.d.ts.map +1 -0
  383. package/dist/graphql/context-builder.js +91 -0
  384. package/dist/graphql/context-builder.js.map +1 -0
  385. package/dist/graphql/decorators.d.ts +162 -0
  386. package/dist/graphql/decorators.d.ts.map +1 -0
  387. package/dist/graphql/decorators.js +291 -0
  388. package/dist/graphql/decorators.js.map +1 -0
  389. package/dist/graphql/execution-pipeline.d.ts +67 -0
  390. package/dist/graphql/execution-pipeline.d.ts.map +1 -0
  391. package/dist/graphql/execution-pipeline.js +127 -0
  392. package/dist/graphql/execution-pipeline.js.map +1 -0
  393. package/dist/graphql/graphql-module.d.ts +70 -0
  394. package/dist/graphql/graphql-module.d.ts.map +1 -0
  395. package/dist/graphql/graphql-module.js +442 -0
  396. package/dist/graphql/graphql-module.js.map +1 -0
  397. package/dist/graphql/index.d.ts +48 -0
  398. package/dist/graphql/index.d.ts.map +1 -0
  399. package/dist/graphql/index.js.map +1 -0
  400. package/dist/graphql/metadata.d.ts +37 -0
  401. package/dist/graphql/metadata.d.ts.map +1 -0
  402. package/dist/graphql/metadata.js +130 -0
  403. package/dist/graphql/metadata.js.map +1 -0
  404. package/dist/graphql/schema-builder.d.ts +34 -0
  405. package/dist/graphql/schema-builder.d.ts.map +1 -0
  406. package/dist/graphql/schema-builder.js +251 -0
  407. package/dist/graphql/schema-builder.js.map +1 -0
  408. package/dist/graphql/subscription-handler.d.ts +47 -0
  409. package/dist/graphql/subscription-handler.d.ts.map +1 -0
  410. package/dist/graphql/subscription-handler.js +201 -0
  411. package/dist/graphql/subscription-handler.js.map +1 -0
  412. package/dist/graphql/types.d.ts +252 -0
  413. package/dist/graphql/types.d.ts.map +1 -0
  414. package/dist/graphql/types.js +28 -0
  415. package/dist/graphql/types.js.map +1 -0
  416. package/dist/health/index.d.ts +176 -0
  417. package/dist/health/index.d.ts.map +1 -0
  418. package/dist/health/index.js.map +1 -0
  419. package/dist/i18n/engine.d.ts +105 -0
  420. package/dist/i18n/engine.d.ts.map +1 -0
  421. package/dist/i18n/engine.js +248 -0
  422. package/dist/i18n/engine.js.map +1 -0
  423. package/dist/i18n/index.d.ts +13 -0
  424. package/dist/i18n/index.d.ts.map +1 -0
  425. package/dist/i18n/index.js.map +1 -0
  426. package/dist/i18n/loader.d.ts +79 -0
  427. package/dist/i18n/loader.d.ts.map +1 -0
  428. package/dist/i18n/loader.js +192 -0
  429. package/dist/i18n/loader.js.map +1 -0
  430. package/dist/i18n/middleware.d.ts +96 -0
  431. package/dist/i18n/middleware.d.ts.map +1 -0
  432. package/dist/i18n/middleware.js +126 -0
  433. package/dist/i18n/middleware.js.map +1 -0
  434. package/dist/i18n/negotiator.d.ts +84 -0
  435. package/dist/i18n/negotiator.d.ts.map +1 -0
  436. package/dist/i18n/negotiator.js +139 -0
  437. package/dist/i18n/negotiator.js.map +1 -0
  438. package/dist/i18n/types.d.ts +129 -0
  439. package/dist/i18n/types.d.ts.map +1 -0
  440. package/dist/i18n/types.js +8 -0
  441. package/dist/i18n/types.js.map +1 -0
  442. package/dist/index.d.ts +48 -0
  443. package/dist/index.d.ts.map +1 -0
  444. package/dist/index.js.map +1 -0
  445. package/dist/jobs/drivers/memory.d.ts +38 -0
  446. package/dist/jobs/drivers/memory.d.ts.map +1 -0
  447. package/dist/jobs/drivers/memory.js +246 -0
  448. package/dist/jobs/drivers/memory.js.map +1 -0
  449. package/dist/jobs/drivers/redis.d.ts +34 -0
  450. package/dist/jobs/drivers/redis.d.ts.map +1 -0
  451. package/dist/jobs/drivers/redis.js +355 -0
  452. package/dist/jobs/drivers/redis.js.map +1 -0
  453. package/dist/jobs/index.d.ts +12 -0
  454. package/dist/jobs/index.d.ts.map +1 -0
  455. package/dist/jobs/index.js.map +1 -0
  456. package/dist/jobs/queue.d.ts +93 -0
  457. package/dist/jobs/queue.d.ts.map +1 -0
  458. package/dist/jobs/queue.js +233 -0
  459. package/dist/jobs/queue.js.map +1 -0
  460. package/dist/jobs/types.d.ts +193 -0
  461. package/dist/jobs/types.d.ts.map +1 -0
  462. package/dist/jobs/types.js +8 -0
  463. package/dist/jobs/types.js.map +1 -0
  464. package/dist/jobs/worker.d.ts +91 -0
  465. package/dist/jobs/worker.d.ts.map +1 -0
  466. package/dist/jobs/worker.js +300 -0
  467. package/dist/jobs/worker.js.map +1 -0
  468. package/dist/lock/index.d.ts +141 -0
  469. package/dist/lock/index.d.ts.map +1 -0
  470. package/dist/lock/index.js.map +1 -0
  471. package/dist/logger/index.d.ts +156 -0
  472. package/dist/logger/index.d.ts.map +1 -0
  473. package/dist/logger/index.js.map +1 -0
  474. package/dist/logger/transports/index.d.ts +371 -0
  475. package/dist/logger/transports/index.d.ts.map +1 -0
  476. package/dist/logger/transports/index.js +740 -0
  477. package/dist/logger/transports/index.js.map +1 -0
  478. package/dist/metrics/index.d.ts +163 -0
  479. package/dist/metrics/index.d.ts.map +1 -0
  480. package/dist/metrics/index.js.map +1 -0
  481. package/dist/middleware/built-in.d.ts +50 -0
  482. package/dist/middleware/built-in.d.ts.map +1 -0
  483. package/dist/middleware/built-in.js +220 -0
  484. package/dist/middleware/built-in.js.map +1 -0
  485. package/dist/middleware/index.d.ts +40 -0
  486. package/dist/middleware/index.d.ts.map +1 -0
  487. package/dist/middleware/index.js.map +1 -0
  488. package/dist/migrations/index.d.ts +48 -0
  489. package/dist/migrations/index.d.ts.map +1 -0
  490. package/dist/migrations/index.js +3 -0
  491. package/dist/migrations/index.js.map +1 -0
  492. package/dist/modules/filters.d.ts +150 -0
  493. package/dist/modules/filters.d.ts.map +1 -0
  494. package/dist/modules/filters.js +338 -0
  495. package/dist/modules/filters.js.map +1 -0
  496. package/dist/modules/guards.d.ts +188 -0
  497. package/dist/modules/guards.d.ts.map +1 -0
  498. package/dist/modules/guards.js +278 -0
  499. package/dist/modules/guards.js.map +1 -0
  500. package/dist/modules/index.d.ts +266 -0
  501. package/dist/modules/index.d.ts.map +1 -0
  502. package/dist/modules/index.js.map +1 -0
  503. package/dist/modules/interceptors.d.ts +242 -0
  504. package/dist/modules/interceptors.d.ts.map +1 -0
  505. package/dist/modules/interceptors.js +407 -0
  506. package/dist/modules/interceptors.js.map +1 -0
  507. package/dist/modules/lazy.d.ts +187 -0
  508. package/dist/modules/lazy.d.ts.map +1 -0
  509. package/dist/modules/lazy.js +305 -0
  510. package/dist/modules/lazy.js.map +1 -0
  511. package/dist/modules/lifecycle.d.ts +221 -0
  512. package/dist/modules/lifecycle.d.ts.map +1 -0
  513. package/dist/modules/lifecycle.js +314 -0
  514. package/dist/modules/lifecycle.js.map +1 -0
  515. package/dist/modules/metadata.d.ts +32 -0
  516. package/dist/modules/metadata.d.ts.map +1 -0
  517. package/dist/modules/metadata.js +59 -0
  518. package/dist/modules/metadata.js.map +1 -0
  519. package/dist/modules/pipes.d.ts +287 -0
  520. package/dist/modules/pipes.d.ts.map +1 -0
  521. package/dist/modules/pipes.js +443 -0
  522. package/dist/modules/pipes.js.map +1 -0
  523. package/dist/notification/channels/base.d.ts +32 -0
  524. package/dist/notification/channels/base.d.ts.map +1 -0
  525. package/dist/notification/channels/base.js +37 -0
  526. package/dist/notification/channels/base.js.map +1 -0
  527. package/dist/notification/channels/email.d.ts +37 -0
  528. package/dist/notification/channels/email.d.ts.map +1 -0
  529. package/dist/notification/channels/email.js +85 -0
  530. package/dist/notification/channels/email.js.map +1 -0
  531. package/dist/notification/channels/push.d.ts +37 -0
  532. package/dist/notification/channels/push.d.ts.map +1 -0
  533. package/dist/notification/channels/push.js +84 -0
  534. package/dist/notification/channels/push.js.map +1 -0
  535. package/dist/notification/channels/sms.d.ts +37 -0
  536. package/dist/notification/channels/sms.d.ts.map +1 -0
  537. package/dist/notification/channels/sms.js +83 -0
  538. package/dist/notification/channels/sms.js.map +1 -0
  539. package/dist/notification/channels/whatsapp.d.ts +37 -0
  540. package/dist/notification/channels/whatsapp.d.ts.map +1 -0
  541. package/dist/notification/channels/whatsapp.js +81 -0
  542. package/dist/notification/channels/whatsapp.js.map +1 -0
  543. package/dist/notification/index.d.ts +15 -0
  544. package/dist/notification/index.d.ts.map +1 -0
  545. package/dist/notification/index.js.map +1 -0
  546. package/dist/notification/service.d.ts +100 -0
  547. package/dist/notification/service.d.ts.map +1 -0
  548. package/dist/notification/service.js +279 -0
  549. package/dist/notification/service.js.map +1 -0
  550. package/dist/notification/types.d.ts +253 -0
  551. package/dist/notification/types.d.ts.map +1 -0
  552. package/dist/notification/types.js +14 -0
  553. package/dist/notification/types.js.map +1 -0
  554. package/dist/observability/__tests__/observability.test.d.ts +2 -0
  555. package/dist/observability/__tests__/observability.test.d.ts.map +1 -0
  556. package/dist/observability/__tests__/observability.test.js +404 -0
  557. package/dist/observability/__tests__/observability.test.js.map +1 -0
  558. package/dist/observability/breadcrumbs.d.ts +48 -0
  559. package/dist/observability/breadcrumbs.d.ts.map +1 -0
  560. package/dist/observability/breadcrumbs.js +97 -0
  561. package/dist/observability/breadcrumbs.js.map +1 -0
  562. package/dist/observability/index.d.ts +95 -0
  563. package/dist/observability/index.d.ts.map +1 -0
  564. package/dist/observability/index.js.map +1 -0
  565. package/dist/observability/interceptor.d.ts +19 -0
  566. package/dist/observability/interceptor.d.ts.map +1 -0
  567. package/dist/observability/interceptor.js +67 -0
  568. package/dist/observability/interceptor.js.map +1 -0
  569. package/dist/observability/service.d.ts +101 -0
  570. package/dist/observability/service.d.ts.map +1 -0
  571. package/dist/observability/service.js +249 -0
  572. package/dist/observability/service.js.map +1 -0
  573. package/dist/observability/trace.d.ts +21 -0
  574. package/dist/observability/trace.d.ts.map +1 -0
  575. package/dist/observability/trace.js +35 -0
  576. package/dist/observability/trace.js.map +1 -0
  577. package/dist/observability/types.d.ts +172 -0
  578. package/dist/observability/types.d.ts.map +1 -0
  579. package/dist/observability/types.js +8 -0
  580. package/dist/observability/types.js.map +1 -0
  581. package/dist/openapi/decorators.d.ts +173 -0
  582. package/dist/openapi/decorators.d.ts.map +1 -0
  583. package/dist/openapi/decorators.js +276 -0
  584. package/dist/openapi/decorators.js.map +1 -0
  585. package/dist/openapi/document-builder.d.ts +82 -0
  586. package/dist/openapi/document-builder.d.ts.map +1 -0
  587. package/dist/openapi/document-builder.js +228 -0
  588. package/dist/openapi/document-builder.js.map +1 -0
  589. package/dist/openapi/index.d.ts +48 -0
  590. package/dist/openapi/index.d.ts.map +1 -0
  591. package/dist/openapi/index.js.map +1 -0
  592. package/dist/openapi/metadata.d.ts +36 -0
  593. package/dist/openapi/metadata.d.ts.map +1 -0
  594. package/dist/openapi/metadata.js +78 -0
  595. package/dist/openapi/metadata.js.map +1 -0
  596. package/dist/openapi/route-scanner.d.ts +34 -0
  597. package/dist/openapi/route-scanner.d.ts.map +1 -0
  598. package/dist/openapi/route-scanner.js +174 -0
  599. package/dist/openapi/route-scanner.js.map +1 -0
  600. package/dist/openapi/schema-generator.d.ts +53 -0
  601. package/dist/openapi/schema-generator.d.ts.map +1 -0
  602. package/dist/openapi/schema-generator.js +236 -0
  603. package/dist/openapi/schema-generator.js.map +1 -0
  604. package/dist/openapi/swagger-module.d.ts +57 -0
  605. package/dist/openapi/swagger-module.d.ts.map +1 -0
  606. package/dist/openapi/swagger-module.js +143 -0
  607. package/dist/openapi/swagger-module.js.map +1 -0
  608. package/dist/openapi/types.d.ts +344 -0
  609. package/dist/openapi/types.d.ts.map +1 -0
  610. package/dist/openapi/types.js +7 -0
  611. package/dist/openapi/types.js.map +1 -0
  612. package/dist/orm/index.d.ts +10 -0
  613. package/dist/orm/index.d.ts.map +1 -0
  614. package/dist/orm/index.js.map +1 -0
  615. package/dist/router/index.d.ts +73 -0
  616. package/dist/router/index.d.ts.map +1 -0
  617. package/dist/router/index.js.map +1 -0
  618. package/dist/router/linear.d.ts +54 -0
  619. package/dist/router/linear.d.ts.map +1 -0
  620. package/dist/router/linear.js +261 -0
  621. package/dist/router/linear.js.map +1 -0
  622. package/dist/router/regex.d.ts +49 -0
  623. package/dist/router/regex.d.ts.map +1 -0
  624. package/dist/router/regex.js +201 -0
  625. package/dist/router/regex.js.map +1 -0
  626. package/dist/router/tree.d.ts +112 -0
  627. package/dist/router/tree.d.ts.map +1 -0
  628. package/dist/router/tree.js +360 -0
  629. package/dist/router/tree.js.map +1 -0
  630. package/dist/rpc/index.d.ts +321 -0
  631. package/dist/rpc/index.d.ts.map +1 -0
  632. package/dist/rpc/index.js.map +1 -0
  633. package/dist/schema/index.d.ts +10 -0
  634. package/dist/schema/index.d.ts.map +1 -0
  635. package/dist/schema/index.js.map +1 -0
  636. package/dist/security/index.d.ts +126 -0
  637. package/dist/security/index.d.ts.map +1 -0
  638. package/dist/security/index.js +309 -0
  639. package/dist/security/index.js.map +1 -0
  640. package/dist/ssg/index.d.ts +73 -0
  641. package/dist/ssg/index.d.ts.map +1 -0
  642. package/dist/ssg/index.js +464 -0
  643. package/dist/ssg/index.js.map +1 -0
  644. package/dist/storage/index.d.ts +99 -0
  645. package/dist/storage/index.d.ts.map +1 -0
  646. package/dist/storage/index.js +338 -0
  647. package/dist/storage/index.js.map +1 -0
  648. package/dist/telemetry/index.d.ts +376 -0
  649. package/dist/telemetry/index.d.ts.map +1 -0
  650. package/dist/telemetry/index.js.map +1 -0
  651. package/dist/template/index.d.ts +7 -0
  652. package/dist/template/index.d.ts.map +1 -0
  653. package/dist/template/index.js.map +1 -0
  654. package/dist/templates/engine.d.ts +60 -0
  655. package/dist/templates/engine.d.ts.map +1 -0
  656. package/dist/templates/engine.js +177 -0
  657. package/dist/templates/engine.js.map +1 -0
  658. package/dist/templates/index.d.ts +9 -0
  659. package/dist/templates/index.d.ts.map +1 -0
  660. package/dist/templates/index.js.map +1 -0
  661. package/dist/templates/loader.d.ts +45 -0
  662. package/dist/templates/loader.d.ts.map +1 -0
  663. package/dist/templates/loader.js +274 -0
  664. package/dist/templates/loader.js.map +1 -0
  665. package/dist/templates/renderers/markdown.d.ts +46 -0
  666. package/dist/templates/renderers/markdown.d.ts.map +1 -0
  667. package/dist/templates/renderers/markdown.js +181 -0
  668. package/dist/templates/renderers/markdown.js.map +1 -0
  669. package/dist/templates/renderers/simple.d.ts +35 -0
  670. package/dist/templates/renderers/simple.d.ts.map +1 -0
  671. package/dist/templates/renderers/simple.js +245 -0
  672. package/dist/templates/renderers/simple.js.map +1 -0
  673. package/dist/templates/types.d.ts +138 -0
  674. package/dist/templates/types.d.ts.map +1 -0
  675. package/dist/templates/types.js +8 -0
  676. package/dist/templates/types.js.map +1 -0
  677. package/dist/testing/index.d.ts +539 -0
  678. package/dist/testing/index.d.ts.map +1 -0
  679. package/dist/testing/index.js.map +1 -0
  680. package/dist/types/index.d.ts +116 -0
  681. package/dist/types/index.d.ts.map +1 -0
  682. package/dist/types/index.js.map +1 -0
  683. package/dist/validation/index.d.ts +89 -0
  684. package/dist/validation/index.d.ts.map +1 -0
  685. package/dist/validation/index.js +276 -0
  686. package/dist/validation/index.js.map +1 -0
  687. package/dist/validation/schemas.d.ts +283 -0
  688. package/dist/validation/schemas.d.ts.map +1 -0
  689. package/dist/validation/schemas.js +407 -0
  690. package/dist/validation/schemas.js.map +1 -0
  691. package/dist/websocket/index.d.ts +252 -0
  692. package/dist/websocket/index.d.ts.map +1 -0
  693. package/dist/websocket/index.js +749 -0
  694. package/dist/websocket/index.js.map +1 -0
  695. package/package.json +3 -3
  696. package/src/database/migrations/index.ts +8 -0
  697. package/src/migrations/index.ts +40 -1
  698. package/src/types/index.ts +1 -1
  699. package/tsconfig.json +2 -6
@@ -0,0 +1,654 @@
1
+ /**
2
+ * HMR Client Script
3
+ *
4
+ * This script is injected into HTML pages to enable Hot Module Replacement.
5
+ * It handles WebSocket communication, module updates, and framework-specific HMR.
6
+ *
7
+ * The script is kept minimal (< 5KB) for fast injection.
8
+ *
9
+ * @module frontend/hmr-client
10
+ */
11
+ // Client script as a string for injection into HTML
12
+ export const HMR_CLIENT_SCRIPT = `
13
+ (function() {
14
+ 'use strict';
15
+
16
+ // ============= Configuration =============
17
+ const HMR_CONFIG = {
18
+ reconnectInterval: 1000,
19
+ maxReconnectAttempts: 10,
20
+ heartbeatInterval: 30000,
21
+ };
22
+
23
+ // ============= State =============
24
+ let ws = null;
25
+ let clientId = null;
26
+ let reconnectAttempts = 0;
27
+ let reconnectTimer = null;
28
+ let heartbeatTimer = null;
29
+ let subscribedFiles = new Set();
30
+ let moduleCache = new Map();
31
+ let isConnecting = false;
32
+
33
+ // ============= Framework Detection =============
34
+ const framework = detectFramework();
35
+
36
+ function detectFramework() {
37
+ if (typeof window === 'undefined') return 'unknown';
38
+
39
+ // Check for React
40
+ if (window.React || document.querySelector('[data-reactroot]') ||
41
+ document.querySelector('[data-reactid]')) {
42
+ return 'react';
43
+ }
44
+
45
+ // Check for Vue
46
+ if (window.Vue || document.querySelector('[data-v-]') ||
47
+ document.querySelector('[data-vue-app]')) {
48
+ return 'vue';
49
+ }
50
+
51
+ // Check for Svelte
52
+ if (window.__SVELTE_HMR__ || document.querySelector('[data-svelte]')) {
53
+ return 'svelte';
54
+ }
55
+
56
+ // Check for Solid
57
+ if (window.Solid$$ || document.querySelector('[data-solid]')) {
58
+ return 'solid';
59
+ }
60
+
61
+ return 'unknown';
62
+ }
63
+
64
+ // ============= WebSocket Connection =============
65
+ function connect() {
66
+ if (isConnecting || (ws && ws.readyState === WebSocket.OPEN)) {
67
+ return;
68
+ }
69
+
70
+ isConnecting = true;
71
+
72
+ // Build WebSocket URL
73
+ const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
74
+ const host = window.location.hostname;
75
+ const port = getHMRPort();
76
+ const url = protocol + '//' + host + ':' + port + '/_hmr';
77
+
78
+ try {
79
+ ws = new WebSocket(url);
80
+
81
+ ws.onopen = handleOpen;
82
+ ws.onclose = handleClose;
83
+ ws.onerror = handleError;
84
+ ws.onmessage = handleMessage;
85
+ } catch (e) {
86
+ console.error('[HMR] Failed to create WebSocket:', e);
87
+ isConnecting = false;
88
+ scheduleReconnect();
89
+ }
90
+ }
91
+
92
+ function getHMRPort() {
93
+ // Try to get port from script tag or default to dev server port + 1
94
+ const scripts = document.querySelectorAll('script[data-hmr-port]');
95
+ if (scripts.length > 0) {
96
+ return parseInt(scripts[0].getAttribute('data-hmr-port'), 10);
97
+ }
98
+ return parseInt(window.location.port || '3000', 10) + 1;
99
+ }
100
+
101
+ function handleOpen() {
102
+ isConnecting = false;
103
+ reconnectAttempts = 0;
104
+ console.log('[HMR] Connected');
105
+
106
+ // Start heartbeat
107
+ startHeartbeat();
108
+
109
+ // Re-subscribe to files
110
+ subscribedFiles.forEach(function(fileId) {
111
+ sendMessage({ type: 'subscribe', fileId: fileId });
112
+ });
113
+ }
114
+
115
+ function handleClose(event) {
116
+ isConnecting = false;
117
+ stopHeartbeat();
118
+
119
+ if (event.code !== 1000) {
120
+ console.log('[HMR] Connection closed, attempting to reconnect...');
121
+ scheduleReconnect();
122
+ }
123
+ }
124
+
125
+ function handleError(error) {
126
+ isConnecting = false;
127
+ console.error('[HMR] WebSocket error:', error);
128
+ }
129
+
130
+ function scheduleReconnect() {
131
+ if (reconnectTimer) {
132
+ clearTimeout(reconnectTimer);
133
+ }
134
+
135
+ if (reconnectAttempts >= HMR_CONFIG.maxReconnectAttempts) {
136
+ console.error('[HMR] Max reconnect attempts reached. Please refresh the page.');
137
+ showOverlay({
138
+ message: 'HMR connection lost. Please refresh the page.',
139
+ type: 'error'
140
+ });
141
+ return;
142
+ }
143
+
144
+ reconnectAttempts++;
145
+ var delay = HMR_CONFIG.reconnectInterval * reconnectAttempts;
146
+
147
+ reconnectTimer = setTimeout(function() {
148
+ console.log('[HMR] Reconnecting... (attempt ' + reconnectAttempts + ')');
149
+ connect();
150
+ }, delay);
151
+ }
152
+
153
+ // ============= Heartbeat =============
154
+ function startHeartbeat() {
155
+ stopHeartbeat();
156
+ heartbeatTimer = setInterval(function() {
157
+ if (ws && ws.readyState === WebSocket.OPEN) {
158
+ sendMessage({ type: 'ping' });
159
+ }
160
+ }, HMR_CONFIG.heartbeatInterval);
161
+ }
162
+
163
+ function stopHeartbeat() {
164
+ if (heartbeatTimer) {
165
+ clearInterval(heartbeatTimer);
166
+ heartbeatTimer = null;
167
+ }
168
+ }
169
+
170
+ // ============= Message Handling =============
171
+ function sendMessage(message) {
172
+ if (ws && ws.readyState === WebSocket.OPEN) {
173
+ ws.send(JSON.stringify(message));
174
+ }
175
+ }
176
+
177
+ function handleMessage(event) {
178
+ try {
179
+ var message = JSON.parse(event.data);
180
+
181
+ switch (message.type) {
182
+ case 'connected':
183
+ clientId = message.clientId;
184
+ console.log('[HMR] Client ID:', clientId);
185
+ break;
186
+
187
+ case 'pong':
188
+ // Heartbeat response
189
+ break;
190
+
191
+ case 'update':
192
+ handleUpdate(message);
193
+ break;
194
+
195
+ case 'reload':
196
+ handleReload(message);
197
+ break;
198
+
199
+ case 'error':
200
+ handleError(message);
201
+ break;
202
+ }
203
+ } catch (e) {
204
+ console.error('[HMR] Failed to parse message:', e);
205
+ }
206
+ }
207
+
208
+ // ============= Update Handling =============
209
+ function handleUpdate(message) {
210
+ console.log('[HMR] Update received:', message.fileId);
211
+
212
+ // Hide any existing error overlay
213
+ hideOverlay();
214
+
215
+ var changes = message.changes || [];
216
+ var hasCSSUpdate = changes.some(function(file) {
217
+ return file.endsWith('.css') || file.endsWith('.scss') ||
218
+ file.endsWith('.sass') || file.endsWith('.less');
219
+ });
220
+
221
+ if (hasCSSUpdate) {
222
+ // Handle CSS updates without flash
223
+ updateCSS(changes);
224
+ }
225
+
226
+ // Check if we can do hot update
227
+ if (canHotUpdate(changes)) {
228
+ performHotUpdate(message);
229
+ } else {
230
+ // Fall back to full reload
231
+ console.log('[HMR] Cannot hot update, reloading page...');
232
+ window.location.reload();
233
+ }
234
+ }
235
+
236
+ function handleReload(message) {
237
+ console.log('[HMR] Full reload requested');
238
+ hideOverlay();
239
+ window.location.reload();
240
+ }
241
+
242
+ function handleError(message) {
243
+ console.error('[HMR] Error:', message.error);
244
+ showOverlay({
245
+ message: message.error.message,
246
+ stack: message.error.stack,
247
+ file: message.error.file,
248
+ line: message.error.line,
249
+ column: message.error.column,
250
+ type: 'error'
251
+ });
252
+ }
253
+
254
+ // ============= CSS Hot Update =============
255
+ function updateCSS(changedFiles) {
256
+ var links = document.querySelectorAll('link[rel="stylesheet"]');
257
+
258
+ links.forEach(function(link) {
259
+ var href = link.getAttribute('href');
260
+ if (!href) return;
261
+
262
+ // Check if this stylesheet is affected
263
+ var isAffected = changedFiles.some(function(file) {
264
+ return href.includes(file.replace(/^.*\\//, '')) ||
265
+ file.includes(href.replace(/^.*\\//, ''));
266
+ });
267
+
268
+ if (isAffected) {
269
+ // Add timestamp to force reload
270
+ var newHref = href.split('?')[0] + '?v=' + Date.now();
271
+
272
+ // Create new link and swap
273
+ var newLink = document.createElement('link');
274
+ newLink.rel = 'stylesheet';
275
+ newLink.href = newHref;
276
+
277
+ newLink.onload = function() {
278
+ link.remove();
279
+ };
280
+
281
+ newLink.onerror = function() {
282
+ console.error('[HMR] Failed to reload CSS:', newHref);
283
+ link.remove();
284
+ };
285
+
286
+ link.parentNode.insertBefore(newLink, link);
287
+ }
288
+ });
289
+ }
290
+
291
+ // ============= Hot Update Logic =============
292
+ function canHotUpdate(changes) {
293
+ // Check if all changed files can be hot updated
294
+ return changes.every(function(file) {
295
+ var ext = file.split('.').pop().toLowerCase();
296
+
297
+ // CSS files can always be hot updated
298
+ if (ext === 'css' || ext === 'scss' || ext === 'sass' || ext === 'less') {
299
+ return true;
300
+ }
301
+
302
+ // JS/TS files need HMR boundary
303
+ if (ext === 'js' || ext === 'jsx' || ext === 'ts' || ext === 'tsx') {
304
+ return hasHMRBoundary(file);
305
+ }
306
+
307
+ // Framework-specific files
308
+ if (ext === 'vue' || ext === 'svelte') {
309
+ return true; // Vue and Svelte have built-in HMR
310
+ }
311
+
312
+ return false;
313
+ });
314
+ }
315
+
316
+ function hasHMRBoundary(file) {
317
+ // Check if the module accepts hot updates
318
+ // This is a simplified check - in production, we'd track this from the server
319
+ return true; // For now, assume all modules can be hot updated
320
+ }
321
+
322
+ function performHotUpdate(message) {
323
+ var changes = message.changes || [];
324
+
325
+ // Framework-specific update handling
326
+ switch (framework) {
327
+ case 'react':
328
+ performReactUpdate(message);
329
+ break;
330
+ case 'vue':
331
+ performVueUpdate(message);
332
+ break;
333
+ case 'svelte':
334
+ performSvelteUpdate(message);
335
+ break;
336
+ case 'solid':
337
+ performSolidUpdate(message);
338
+ break;
339
+ default:
340
+ // Generic update - reload scripts
341
+ performGenericUpdate(message);
342
+ }
343
+ }
344
+
345
+ // ============= React Fast Refresh =============
346
+ function performReactUpdate(message) {
347
+ if (!window.__HMR_REACT_REFRESH__) {
348
+ // React Refresh not available, fall back to reload
349
+ window.location.reload();
350
+ return;
351
+ }
352
+
353
+ console.log('[HMR] Applying React Fast Refresh...');
354
+
355
+ // Signal to React Refresh that an update is coming
356
+ if (window.__REACT_REFRESH__) {
357
+ try {
358
+ changes.forEach(function(file) {
359
+ // Invalidate the module
360
+ invalidateModule(file);
361
+ });
362
+
363
+ // Trigger React Refresh
364
+ window.__REACT_REFRESH__.performReactRefresh();
365
+ } catch (e) {
366
+ console.error('[HMR] React Fast Refresh failed:', e);
367
+ window.location.reload();
368
+ }
369
+ } else {
370
+ // Fallback: reload the page
371
+ window.location.reload();
372
+ }
373
+ }
374
+
375
+ // ============= Vue HMR =============
376
+ function performVueUpdate(message) {
377
+ console.log('[HMR] Applying Vue HMR...');
378
+
379
+ // Vue's HMR is handled by vue-loader and vue-hot-reload-api
380
+ if (window.__VUE_HMR__) {
381
+ try {
382
+ message.changes.forEach(function(file) {
383
+ if (file.endsWith('.vue')) {
384
+ window.__VUE_HMR__.rerender(file);
385
+ }
386
+ });
387
+ } catch (e) {
388
+ console.error('[HMR] Vue HMR failed:', e);
389
+ window.location.reload();
390
+ }
391
+ } else {
392
+ window.location.reload();
393
+ }
394
+ }
395
+
396
+ // ============= Svelte HMR =============
397
+ function performSvelteUpdate(message) {
398
+ console.log('[HMR] Applying Svelte HMR...');
399
+
400
+ if (window.__SVELTE_HMR__) {
401
+ try {
402
+ message.changes.forEach(function(file) {
403
+ if (file.endsWith('.svelte')) {
404
+ // Svelte HMR preserves component state
405
+ window.__SVELTE_HMR__.update(file);
406
+ }
407
+ });
408
+ } catch (e) {
409
+ console.error('[HMR] Svelte HMR failed:', e);
410
+ window.location.reload();
411
+ }
412
+ } else {
413
+ window.location.reload();
414
+ }
415
+ }
416
+
417
+ // ============= Solid HMR =============
418
+ function performSolidUpdate(message) {
419
+ console.log('[HMR] Applying Solid HMR...');
420
+
421
+ if (window.__SOLID_HMR__) {
422
+ try {
423
+ message.changes.forEach(function(file) {
424
+ invalidateModule(file);
425
+ });
426
+
427
+ window.__SOLID_HMR__.update();
428
+ } catch (e) {
429
+ console.error('[HMR] Solid HMR failed:', e);
430
+ window.location.reload();
431
+ }
432
+ } else {
433
+ window.location.reload();
434
+ }
435
+ }
436
+
437
+ // ============= Generic Update =============
438
+ function performGenericUpdate(message) {
439
+ console.log('[HMR] Performing generic update...');
440
+
441
+ // For unknown frameworks, reload scripts
442
+ message.changes.forEach(function(file) {
443
+ invalidateModule(file);
444
+ });
445
+
446
+ // Reload the page as a fallback
447
+ window.location.reload();
448
+ }
449
+
450
+ // ============= Module Management =============
451
+ function invalidateModule(fileId) {
452
+ moduleCache.delete(fileId);
453
+
454
+ // Find and reload script tags
455
+ var scripts = document.querySelectorAll('script[src]');
456
+ scripts.forEach(function(script) {
457
+ var src = script.getAttribute('src');
458
+ if (src && src.includes(fileId)) {
459
+ reloadScript(script);
460
+ }
461
+ });
462
+ }
463
+
464
+ function reloadScript(oldScript) {
465
+ var src = oldScript.getAttribute('src');
466
+ var newSrc = src.split('?')[0] + '?v=' + Date.now();
467
+
468
+ var newScript = document.createElement('script');
469
+ newScript.src = newSrc;
470
+ newScript.type = oldScript.type || 'text/javascript';
471
+ newScript.async = false;
472
+
473
+ // Copy attributes
474
+ Array.from(oldScript.attributes).forEach(function(attr) {
475
+ if (attr.name !== 'src') {
476
+ newScript.setAttribute(attr.name, attr.value);
477
+ }
478
+ });
479
+
480
+ oldScript.parentNode.replaceChild(newScript, oldScript);
481
+ }
482
+
483
+ // ============= Error Overlay =============
484
+ function showOverlay(options) {
485
+ // Remove existing overlay
486
+ hideOverlay();
487
+
488
+ var overlay = document.createElement('div');
489
+ overlay.id = '__hmr-overlay__';
490
+ overlay.style.cssText = [
491
+ 'position: fixed',
492
+ 'top: 0',
493
+ 'left: 0',
494
+ 'right: 0',
495
+ 'bottom: 0',
496
+ 'background: rgba(0, 0, 0, 0.85)',
497
+ 'z-index: 99999',
498
+ 'display: flex',
499
+ 'align-items: center',
500
+ 'justify-content: center',
501
+ 'font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
502
+ 'color: white',
503
+ 'padding: 20px'
504
+ ].join(';');
505
+
506
+ var content = document.createElement('div');
507
+ content.style.cssText = [
508
+ 'max-width: 800px',
509
+ 'max-height: 80vh',
510
+ 'overflow: auto',
511
+ 'background: #1a1a1a',
512
+ 'border-radius: 8px',
513
+ 'padding: 20px',
514
+ 'box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5)'
515
+ ].join(';');
516
+
517
+ var title = document.createElement('h2');
518
+ title.style.cssText = 'color: #ff5555; margin: 0 0 15px 0; font-size: 18px;';
519
+ title.textContent = 'HMR Error';
520
+
521
+ var message = document.createElement('pre');
522
+ message.style.cssText = [
523
+ 'background: #282828',
524
+ 'padding: 15px',
525
+ 'border-radius: 4px',
526
+ 'overflow-x: auto',
527
+ 'font-size: 13px',
528
+ 'line-height: 1.5',
529
+ 'white-space: pre-wrap',
530
+ 'word-break: break-word'
531
+ ].join(';');
532
+ message.textContent = options.message;
533
+
534
+ content.appendChild(title);
535
+ content.appendChild(message);
536
+
537
+ if (options.stack) {
538
+ var stack = document.createElement('pre');
539
+ stack.style.cssText = [
540
+ 'background: #282828',
541
+ 'padding: 15px',
542
+ 'border-radius: 4px',
543
+ 'margin-top: 10px',
544
+ 'font-size: 12px',
545
+ 'color: #888',
546
+ 'overflow-x: auto'
547
+ ].join(';');
548
+ stack.textContent = options.stack;
549
+ content.appendChild(stack);
550
+ }
551
+
552
+ if (options.file) {
553
+ var file = document.createElement('div');
554
+ file.style.cssText = 'margin-top: 15px; color: #888; font-size: 12px;';
555
+ file.textContent = 'File: ' + options.file +
556
+ (options.line ? ':' + options.line + (options.column ? ':' + options.column : '') : '');
557
+ content.appendChild(file);
558
+ }
559
+
560
+ var closeBtn = document.createElement('button');
561
+ closeBtn.style.cssText = [
562
+ 'position: absolute',
563
+ 'top: 10px',
564
+ 'right: 10px',
565
+ 'background: transparent',
566
+ 'border: none',
567
+ 'color: #888',
568
+ 'font-size: 20px',
569
+ 'cursor: pointer',
570
+ 'padding: 5px'
571
+ ].join(';');
572
+ closeBtn.textContent = '×';
573
+ closeBtn.onclick = hideOverlay;
574
+
575
+ overlay.style.position = 'relative';
576
+ overlay.appendChild(closeBtn);
577
+ overlay.appendChild(content);
578
+
579
+ document.body.appendChild(overlay);
580
+ }
581
+
582
+ function hideOverlay() {
583
+ var overlay = document.getElementById('__hmr-overlay__');
584
+ if (overlay) {
585
+ overlay.remove();
586
+ }
587
+ }
588
+
589
+ // ============= Subscription Management =============
590
+ function subscribe(fileId) {
591
+ subscribedFiles.add(fileId);
592
+ sendMessage({ type: 'subscribe', fileId: fileId });
593
+ }
594
+
595
+ function unsubscribe(fileId) {
596
+ subscribedFiles.delete(fileId);
597
+ sendMessage({ type: 'unsubscribe', fileId: fileId });
598
+ }
599
+
600
+ // ============= Initialization =============
601
+ function init() {
602
+ // Connect to HMR server
603
+ connect();
604
+
605
+ // Subscribe to current page
606
+ var currentFile = window.location.pathname;
607
+ subscribe(currentFile);
608
+
609
+ // Expose HMR API
610
+ window.__HMR__ = {
611
+ subscribe: subscribe,
612
+ unsubscribe: unsubscribe,
613
+ connect: connect,
614
+ clientId: function() { return clientId; },
615
+ framework: framework
616
+ };
617
+
618
+ console.log('[HMR] Client initialized (framework: ' + framework + ')');
619
+ }
620
+
621
+ // Start when DOM is ready
622
+ if (document.readyState === 'complete') {
623
+ init();
624
+ } else {
625
+ document.addEventListener('DOMContentLoaded', init);
626
+ }
627
+ })();
628
+ `;
629
+ /**
630
+ * Get the HMR client script with optional configuration
631
+ */
632
+ export function getHMRClientScript(options) {
633
+ if (options?.port) {
634
+ return HMR_CLIENT_SCRIPT.replace("return parseInt(window.location.port || '3000', 10) + 1;", `return ${options.port};`);
635
+ }
636
+ return HMR_CLIENT_SCRIPT;
637
+ }
638
+ /**
639
+ * Inject HMR client script into HTML content
640
+ */
641
+ export function injectHMRScript(html, port) {
642
+ const script = getHMRClientScript({ port });
643
+ // Find the </head> or </body> tag to inject before
644
+ const headMatch = html.match(/<\/head>/i);
645
+ const bodyMatch = html.match(/<\/body>/i);
646
+ const injectionPoint = headMatch
647
+ ? headMatch.index + headMatch[0].length
648
+ : bodyMatch
649
+ ? bodyMatch.index + bodyMatch[0].length
650
+ : html.length;
651
+ const scriptTag = `<script data-hmr-port="${port || ""}">${script}</script>`;
652
+ return html.slice(0, injectionPoint) + scriptTag + html.slice(injectionPoint);
653
+ }
654
+ //# sourceMappingURL=hmr-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hmr-client.js","sourceRoot":"","sources":["../../src/frontend/hmr-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,oDAAoD;AACpD,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwmBhC,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAElC;IACA,IAAI,OAAO,EAAE,IAAI,EAAE,CAAC;QACnB,OAAO,iBAAiB,CAAC,OAAO,CAC/B,0DAA0D,EAC1D,UAAU,OAAO,CAAC,IAAI,GAAG,CACzB,CAAC;IACH,CAAC;IACD,OAAO,iBAAiB,CAAC;AAC1B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,IAAa;IAC1D,MAAM,MAAM,GAAG,kBAAkB,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;IAE5C,mDAAmD;IACnD,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAC1C,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAE1C,MAAM,cAAc,GAAG,SAAS;QAC/B,CAAC,CAAC,SAAS,CAAC,KAAM,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM;QACxC,CAAC,CAAC,SAAS;YACV,CAAC,CAAC,SAAS,CAAC,KAAM,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM;YACxC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;IAEhB,MAAM,SAAS,GAAG,0BAA0B,IAAI,IAAI,EAAE,KAAK,MAAM,WAAW,CAAC;IAE7E,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;AAC/E,CAAC"}