@primate/core 0.4.5 → 0.5.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 (412) hide show
  1. package/lib/private/App.d.ts +531 -3
  2. package/lib/private/App.js +8 -3
  3. package/lib/private/Binder.d.ts +2 -2
  4. package/lib/private/Flags.d.ts +3 -3
  5. package/lib/private/Module.d.ts +5 -5
  6. package/lib/private/app/Facade.d.ts +566 -0
  7. package/lib/private/app/Facade.js +33 -0
  8. package/lib/private/asset/Asset.d.ts +1 -1
  9. package/lib/private/backend/Module.d.ts +1 -1
  10. package/lib/private/backend/Module.js +2 -5
  11. package/lib/private/backend/TAG.d.ts +1 -1
  12. package/lib/private/backend/TAG.js +1 -1
  13. package/lib/private/build/App.d.ts +2 -2
  14. package/lib/private/build/App.js +0 -2
  15. package/lib/private/build/client/index.js +12 -7
  16. package/lib/private/build/hook.js +4 -3
  17. package/lib/private/build/index.js +14 -13
  18. package/lib/private/build/presets.d.ts +10 -0
  19. package/lib/private/build/presets.js +39 -0
  20. package/lib/private/build/server/index.js +5 -7
  21. package/lib/private/build/server/plugin/assets.js +9 -7
  22. package/lib/private/build/server/plugin/config.js +11 -4
  23. package/lib/private/build/server/plugin/db-default.d.ts +4 -0
  24. package/lib/private/build/server/plugin/db-default.js +45 -0
  25. package/lib/private/build/server/plugin/frontend.js +4 -2
  26. package/lib/private/build/server/plugin/live-reload.d.ts +4 -0
  27. package/lib/private/build/server/plugin/{hot-reload.js → live-reload.js} +4 -4
  28. package/lib/private/build/server/plugin/native-addons.js +6 -4
  29. package/lib/private/build/server/plugin/node-imports.js +2 -2
  30. package/lib/private/build/server/plugin/route.js +2 -2
  31. package/lib/private/build/server/plugin/store-wrap.js +2 -2
  32. package/lib/private/build/server/plugin/store.js +6 -6
  33. package/lib/private/build/server/plugin/stores.js +4 -5
  34. package/lib/private/build/server/plugin/view.js +4 -4
  35. package/lib/private/build/server/plugin/views.js +4 -4
  36. package/lib/private/build/server/plugin/virtual-pages.js +8 -8
  37. package/lib/private/build/server/plugin/virtual-routes.js +8 -13
  38. package/lib/private/build/server/plugin/wasm.js +2 -3
  39. package/lib/private/bye.js +2 -3
  40. package/lib/private/client/Data.d.ts +1 -1
  41. package/lib/private/client/ValidateInit.d.ts +1 -3
  42. package/lib/private/client/ValidationError.d.ts +1 -1
  43. package/lib/private/client/app.js +2 -1
  44. package/lib/private/client/create-form.d.ts +31 -0
  45. package/lib/private/client/create-form.js +124 -0
  46. package/lib/private/client/extract-issues.d.ts +4 -0
  47. package/lib/private/client/extract-issues.js +20 -0
  48. package/lib/private/client/spa/index.d.ts +1 -1
  49. package/lib/private/client/spa/index.js +4 -5
  50. package/lib/private/client/{toValidated.d.ts → to-validated.d.ts} +2 -4
  51. package/lib/private/client/{toValidated.js → to-validated.js} +1 -1
  52. package/lib/private/client/validate-field.d.ts +3 -0
  53. package/lib/private/client/validate-field.js +41 -0
  54. package/lib/private/config/index.d.ts +2 -21
  55. package/lib/private/config/index.js +3 -1
  56. package/lib/private/config/schema.d.ts +13 -9
  57. package/lib/private/config/schema.js +10 -5
  58. package/lib/private/cookie.d.ts +5 -5
  59. package/lib/private/cookie.js +10 -14
  60. package/lib/private/db/As.d.ts +10 -0
  61. package/lib/private/db/DB.d.ts +33 -0
  62. package/lib/private/db/DB.js +2 -0
  63. package/lib/private/db/DataDict.d.ts +5 -0
  64. package/lib/private/db/DataKey.d.ts +4 -0
  65. package/lib/private/db/DataValue.d.ts +17 -0
  66. package/lib/private/db/MemoryDB.d.ts +35 -0
  67. package/lib/private/db/MemoryDB.js +317 -0
  68. package/lib/private/db/PK.d.ts +3 -0
  69. package/lib/private/db/PK.js +2 -0
  70. package/lib/private/{database → db}/Query.d.ts +2 -2
  71. package/lib/private/{database → db}/QueryBuilder.d.ts +2 -3
  72. package/lib/private/db/ReadArgs.d.ts +9 -0
  73. package/lib/private/db/ReadArgs.js +2 -0
  74. package/lib/private/db/ReadRelationsArgs.d.ts +6 -0
  75. package/lib/private/db/ReadRelationsArgs.js +2 -0
  76. package/lib/private/{database → db}/Schema.d.ts +1 -2
  77. package/lib/private/db/Sort.d.ts +4 -0
  78. package/lib/private/{database → db}/TypeMap.d.ts +2 -3
  79. package/lib/private/{database → db}/Types.d.ts +1 -1
  80. package/lib/private/db/With.d.ts +16 -0
  81. package/lib/private/db/With.js +2 -0
  82. package/lib/private/db/common.d.ts +18 -0
  83. package/lib/private/db/common.js +36 -0
  84. package/lib/private/db/error.d.ts +81 -0
  85. package/lib/private/db/error.js +199 -0
  86. package/lib/private/db/sql.d.ts +28 -0
  87. package/lib/private/db/sql.js +177 -0
  88. package/lib/private/db/storage.d.ts +3 -0
  89. package/lib/private/db/storage.js +3 -0
  90. package/lib/private/db/symbol/wrap.js +2 -0
  91. package/lib/private/db/symbol.js +2 -0
  92. package/lib/private/db/test.d.ts +4 -0
  93. package/lib/private/db/test.js +1384 -0
  94. package/lib/private/frontend/Module.d.ts +6 -6
  95. package/lib/private/frontend/Module.js +28 -23
  96. package/lib/private/frontend/Render.d.ts +1 -2
  97. package/lib/private/frontend/ServerData.d.ts +1 -1
  98. package/lib/private/frontend/ServerView.d.ts +1 -2
  99. package/lib/private/frontend/View.d.ts +1 -1
  100. package/lib/private/frontend/ViewOptions.d.ts +1 -1
  101. package/lib/private/frontend/ViewResponse.d.ts +1 -1
  102. package/lib/private/hash.js +0 -1
  103. package/lib/private/i18n/Catalog.d.ts +5 -2
  104. package/lib/private/i18n/Formatter.js +20 -8
  105. package/lib/private/i18n/Module.d.ts +3 -3
  106. package/lib/private/i18n/Module.js +28 -17
  107. package/lib/private/i18n/format.d.ts +4 -0
  108. package/lib/private/i18n/format.js +95 -0
  109. package/lib/private/i18n/index/client.d.ts +9 -0
  110. package/lib/private/i18n/index/client.js +152 -0
  111. package/lib/private/i18n/index/server.d.ts +9 -0
  112. package/lib/private/i18n/index/server.js +57 -0
  113. package/lib/private/i18n/index/types.d.ts +33 -0
  114. package/lib/private/i18n/index/types.js +2 -0
  115. package/lib/private/i18n/locale.d.ts +9 -3
  116. package/lib/private/i18n/ordinals.d.ts +1 -1
  117. package/lib/private/i18n/resolve.d.ts +7 -0
  118. package/lib/private/i18n/resolve.js +30 -0
  119. package/lib/private/i18n/schema.d.ts +4 -4
  120. package/lib/private/i18n/schema.js +6 -10
  121. package/lib/private/i18n/storage.d.ts +3 -0
  122. package/lib/private/i18n/storage.js +5 -0
  123. package/lib/private/i18n/validate.d.ts +2 -0
  124. package/lib/private/i18n/validate.js +21 -0
  125. package/lib/private/log.d.ts +1 -0
  126. package/lib/private/log.js +10 -10
  127. package/lib/private/module/Hook.d.ts +1 -1
  128. package/lib/private/module/Next.d.ts +1 -1
  129. package/lib/private/orm/ForeignKey.d.ts +11 -0
  130. package/lib/private/orm/ForeignKey.js +22 -0
  131. package/lib/private/orm/PrimaryKey.d.ts +15 -0
  132. package/lib/private/orm/PrimaryKey.js +35 -0
  133. package/lib/private/orm/Set.d.ts +11 -0
  134. package/lib/private/orm/Set.js +2 -0
  135. package/lib/private/orm/Store.d.ts +171 -0
  136. package/lib/private/orm/Store.js +518 -0
  137. package/lib/private/orm/foreign.d.ts +4 -0
  138. package/lib/private/orm/foreign.js +5 -0
  139. package/lib/private/orm/key.d.ts +8 -0
  140. package/lib/private/orm/key.js +4 -0
  141. package/lib/private/orm/parse.d.ts +12 -0
  142. package/lib/private/orm/parse.js +29 -0
  143. package/lib/private/orm/primary.d.ts +5 -0
  144. package/lib/private/orm/primary.js +5 -0
  145. package/lib/private/orm/relation.d.ts +43 -0
  146. package/lib/private/orm/relation.js +26 -0
  147. package/lib/private/orm/types.d.ts +18 -0
  148. package/lib/private/orm/types.js +2 -0
  149. package/lib/private/orm/wrap.d.ts +5 -0
  150. package/lib/private/orm/wrap.js +5 -0
  151. package/lib/private/paths.d.ts +2 -2
  152. package/lib/private/request/RequestBag.d.ts +1 -1
  153. package/lib/private/request/RequestBag.js +11 -7
  154. package/lib/private/request/RequestBody.d.ts +2 -4
  155. package/lib/private/request/RequestBody.js +8 -11
  156. package/lib/private/request/RequestContext.d.ts +12 -0
  157. package/lib/private/request/RequestContext.js +31 -0
  158. package/lib/private/request/RequestFacade.d.ts +16 -6
  159. package/lib/private/request/parse.d.ts +2 -2
  160. package/lib/private/request/parse.js +54 -16
  161. package/lib/private/request/route.js +37 -21
  162. package/lib/private/request/router.d.ts +1 -1
  163. package/lib/private/request/router.js +2 -2
  164. package/lib/private/request/sContext.d.ts +3 -0
  165. package/lib/private/request/sContext.js +2 -0
  166. package/lib/private/response/ResponseFunction.d.ts +1 -2
  167. package/lib/private/response/ResponseLike.d.ts +1 -1
  168. package/lib/private/response/binary.d.ts +1 -1
  169. package/lib/private/response/binary.js +4 -3
  170. package/lib/private/response/json.d.ts +1 -1
  171. package/lib/private/response/json.js +2 -2
  172. package/lib/private/response/redirect.js +1 -1
  173. package/lib/private/response/respond.js +7 -10
  174. package/lib/private/response/sse.d.ts +1 -1
  175. package/lib/private/response/sse.js +2 -2
  176. package/lib/private/response/text.d.ts +1 -1
  177. package/lib/private/response/text.js +3 -3
  178. package/lib/private/response/view.d.ts +2 -2
  179. package/lib/private/response/view.js +3 -3
  180. package/lib/private/response.d.ts +1 -1
  181. package/lib/private/route/Handler.d.ts +1 -1
  182. package/lib/private/route/hook.d.ts +6 -0
  183. package/lib/private/route/hook.js +5 -0
  184. package/lib/private/route/router.d.ts +9 -5
  185. package/lib/private/route/router.js +34 -17
  186. package/lib/private/route/wrap.js +2 -2
  187. package/lib/private/serve/App.d.ts +5 -18
  188. package/lib/private/serve/App.js +91 -82
  189. package/lib/private/serve/Init.d.ts +3 -3
  190. package/lib/private/serve/hook.js +1 -7
  191. package/lib/private/serve/index.js +6 -2
  192. package/lib/private/serve/module/Dev.d.ts +1 -1
  193. package/lib/private/serve/module/Dev.js +9 -5
  194. package/lib/private/serve/module/Handle.js +2 -2
  195. package/lib/private/session/Data.d.ts +1 -2
  196. package/lib/private/session/SessionHandle.d.ts +1 -1
  197. package/lib/private/session/SessionHandle.js +10 -9
  198. package/lib/private/session/SessionModule.js +7 -7
  199. package/lib/private/session/index.d.ts +3 -4
  200. package/lib/private/session/schema.d.ts +6 -6
  201. package/lib/private/session/schema.js +5 -4
  202. package/lib/private/session/storage.d.ts +1 -2
  203. package/lib/private/session/storage.js +2 -2
  204. package/lib/private/tags.js +2 -2
  205. package/lib/private/target/Target.d.ts +1 -1
  206. package/lib/public/AppFacade.d.ts +2 -0
  207. package/lib/public/AppFacade.js +2 -0
  208. package/lib/public/build/presets.d.ts +2 -0
  209. package/lib/public/build/presets.js +2 -0
  210. package/lib/public/build/transform.d.ts +2 -0
  211. package/lib/public/build/transform.js +2 -0
  212. package/lib/public/client.d.ts +14 -0
  213. package/lib/public/client.js +10 -0
  214. package/lib/public/db/MemoryDB.d.ts +2 -0
  215. package/lib/public/db/MemoryDB.js +2 -0
  216. package/lib/public/db/error.d.ts +2 -0
  217. package/lib/public/db/error.js +2 -0
  218. package/lib/public/db/sql.d.ts +2 -0
  219. package/lib/public/db/sql.js +2 -0
  220. package/lib/public/db/test.d.ts +2 -0
  221. package/lib/public/db/test.js +2 -0
  222. package/lib/public/db.d.ts +12 -0
  223. package/lib/public/db.js +2 -0
  224. package/lib/public/orm/Store.d.ts +2 -0
  225. package/lib/public/orm/Store.js +2 -0
  226. package/lib/public/orm/key.d.ts +2 -0
  227. package/lib/public/orm/key.js +2 -0
  228. package/lib/public/orm/relation.d.ts +2 -0
  229. package/lib/public/orm/relation.js +2 -0
  230. package/lib/public/orm/wrap.d.ts +2 -0
  231. package/lib/public/orm/wrap.js +2 -0
  232. package/lib/public/request.d.ts +4 -0
  233. package/lib/public/request.js +2 -0
  234. package/lib/public/response.d.ts +22 -0
  235. package/lib/public/response.js +19 -0
  236. package/lib/public/route/hook.d.ts +2 -0
  237. package/lib/public/route/hook.js +2 -0
  238. package/package.json +28 -23
  239. package/lib/private/build/client/reload.d.ts +0 -7
  240. package/lib/private/build/client/reload.js +0 -6
  241. package/lib/private/build/server/plugin/database-default.d.ts +0 -4
  242. package/lib/private/build/server/plugin/database-default.js +0 -48
  243. package/lib/private/build/server/plugin/hot-reload.d.ts +0 -4
  244. package/lib/private/client/validate.d.ts +0 -3
  245. package/lib/private/client/validate.js +0 -54
  246. package/lib/private/database/As.d.ts +0 -7
  247. package/lib/private/database/Binds.d.ts +0 -4
  248. package/lib/private/database/Binds.js +0 -2
  249. package/lib/private/database/Changes.d.ts +0 -11
  250. package/lib/private/database/Changes.js +0 -2
  251. package/lib/private/database/ColumnTypes.d.ts +0 -11
  252. package/lib/private/database/ColumnTypes.js +0 -2
  253. package/lib/private/database/DataDict.d.ts +0 -5
  254. package/lib/private/database/DataKey.d.ts +0 -4
  255. package/lib/private/database/DataValue.d.ts +0 -5
  256. package/lib/private/database/Database.d.ts +0 -56
  257. package/lib/private/database/Database.js +0 -153
  258. package/lib/private/database/InMemoryDatabase.d.ts +0 -37
  259. package/lib/private/database/InMemoryDatabase.js +0 -181
  260. package/lib/private/database/Sort.d.ts +0 -4
  261. package/lib/private/database/Store.d.ts +0 -172
  262. package/lib/private/database/Store.js +0 -261
  263. package/lib/private/database/storage.d.ts +0 -4
  264. package/lib/private/database/storage.js +0 -3
  265. package/lib/private/database/symbol/wrap.js +0 -2
  266. package/lib/private/database/symbol.js +0 -2
  267. package/lib/private/database/test.d.ts +0 -4
  268. package/lib/private/database/test.js +0 -678
  269. package/lib/private/database/wrap.d.ts +0 -5
  270. package/lib/private/database/wrap.js +0 -5
  271. package/lib/private/i18n/index.d.ts +0 -28
  272. package/lib/private/i18n/index.js +0 -236
  273. package/lib/private/route/guard.d.ts +0 -4
  274. package/lib/private/route/guard.js +0 -22
  275. package/lib/private/wasm/API.d.ts +0 -7
  276. package/lib/private/wasm/API.js +0 -2
  277. package/lib/private/wasm/BufferViewSource.d.ts +0 -4
  278. package/lib/private/wasm/BufferViewSource.js +0 -2
  279. package/lib/private/wasm/Exports.d.ts +0 -23
  280. package/lib/private/wasm/Exports.js +0 -2
  281. package/lib/private/wasm/I32.d.ts +0 -5
  282. package/lib/private/wasm/I32.js +0 -2
  283. package/lib/private/wasm/I32_SIZE.d.ts +0 -3
  284. package/lib/private/wasm/I32_SIZE.js +0 -2
  285. package/lib/private/wasm/Instantiation.d.ts +0 -12
  286. package/lib/private/wasm/Instantiation.js +0 -2
  287. package/lib/private/wasm/Tagged.d.ts +0 -7
  288. package/lib/private/wasm/Tagged.js +0 -2
  289. package/lib/private/wasm/buffersize.d.ts +0 -2
  290. package/lib/private/wasm/buffersize.js +0 -5
  291. package/lib/private/wasm/decode-bytes.d.ts +0 -3
  292. package/lib/private/wasm/decode-bytes.js +0 -5
  293. package/lib/private/wasm/decode-json.d.ts +0 -7
  294. package/lib/private/wasm/decode-json.js +0 -11
  295. package/lib/private/wasm/decode-option.d.ts +0 -5
  296. package/lib/private/wasm/decode-option.js +0 -10
  297. package/lib/private/wasm/decode-response.d.ts +0 -19
  298. package/lib/private/wasm/decode-response.js +0 -90
  299. package/lib/private/wasm/decode-string.d.ts +0 -3
  300. package/lib/private/wasm/decode-string.js +0 -5
  301. package/lib/private/wasm/decode-websocket-close.d.ts +0 -5
  302. package/lib/private/wasm/decode-websocket-close.js +0 -6
  303. package/lib/private/wasm/decode-websocket-send.d.ts +0 -6
  304. package/lib/private/wasm/decode-websocket-send.js +0 -19
  305. package/lib/private/wasm/encode-buffer.d.ts +0 -3
  306. package/lib/private/wasm/encode-buffer.js +0 -6
  307. package/lib/private/wasm/encode-request.d.ts +0 -9
  308. package/lib/private/wasm/encode-request.js +0 -195
  309. package/lib/private/wasm/encode-session.d.ts +0 -3
  310. package/lib/private/wasm/encode-session.js +0 -25
  311. package/lib/private/wasm/encode-string-map.d.ts +0 -5
  312. package/lib/private/wasm/encode-string-map.js +0 -14
  313. package/lib/private/wasm/encode-string.d.ts +0 -13
  314. package/lib/private/wasm/encode-string.js +0 -17
  315. package/lib/private/wasm/encode-url.d.ts +0 -11
  316. package/lib/private/wasm/encode-url.js +0 -14
  317. package/lib/private/wasm/encode-websocket-close.d.ts +0 -2
  318. package/lib/private/wasm/encode-websocket-close.js +0 -7
  319. package/lib/private/wasm/encode-websocket-message.d.ts +0 -4
  320. package/lib/private/wasm/encode-websocket-message.js +0 -30
  321. package/lib/private/wasm/encode-websocket-open.d.ts +0 -2
  322. package/lib/private/wasm/encode-websocket-open.js +0 -7
  323. package/lib/private/wasm/filesize.d.ts +0 -2
  324. package/lib/private/wasm/filesize.js +0 -8
  325. package/lib/private/wasm/instantiate.d.ts +0 -37
  326. package/lib/private/wasm/instantiate.js +0 -408
  327. package/lib/private/wasm/open-websocket.d.ts +0 -4
  328. package/lib/private/wasm/open-websocket.js +0 -26
  329. package/lib/private/wasm/stringsize.d.ts +0 -3
  330. package/lib/private/wasm/stringsize.js +0 -5
  331. package/lib/private/wasm/urlsize.d.ts +0 -2
  332. package/lib/private/wasm/urlsize.js +0 -5
  333. package/lib/public/Database.d.ts +0 -2
  334. package/lib/public/Database.js +0 -2
  335. package/lib/public/client/ValidateInit.d.ts +0 -2
  336. package/lib/public/client/ValidateInit.js +0 -2
  337. package/lib/public/client/ValidateUpdater.d.ts +0 -2
  338. package/lib/public/client/ValidateUpdater.js +0 -2
  339. package/lib/public/client/ValidationError.d.ts +0 -2
  340. package/lib/public/client/ValidationError.js +0 -2
  341. package/lib/public/client/toValidated.d.ts +0 -2
  342. package/lib/public/client/toValidated.js +0 -2
  343. package/lib/public/client/validate.d.ts +0 -2
  344. package/lib/public/client/validate.js +0 -2
  345. package/lib/public/database/As.d.ts +0 -2
  346. package/lib/public/database/As.js +0 -2
  347. package/lib/public/database/DataDict.d.ts +0 -2
  348. package/lib/public/database/DataDict.js +0 -2
  349. package/lib/public/database/InMemoryDatabase.d.ts +0 -2
  350. package/lib/public/database/InMemoryDatabase.js +0 -2
  351. package/lib/public/database/Sort.d.ts +0 -2
  352. package/lib/public/database/Sort.js +0 -2
  353. package/lib/public/database/Store.d.ts +0 -2
  354. package/lib/public/database/Store.js +0 -2
  355. package/lib/public/database/TypeMap.d.ts +0 -2
  356. package/lib/public/database/TypeMap.js +0 -2
  357. package/lib/public/database/Types.d.ts +0 -2
  358. package/lib/public/database/Types.js +0 -2
  359. package/lib/public/database/test.d.ts +0 -2
  360. package/lib/public/database/test.js +0 -2
  361. package/lib/public/database/wrap.d.ts +0 -2
  362. package/lib/public/database/wrap.js +0 -2
  363. package/lib/public/request/RequestBody.d.ts +0 -2
  364. package/lib/public/request/RequestBody.js +0 -2
  365. package/lib/public/request/RequestFacade.d.ts +0 -2
  366. package/lib/public/request/RequestFacade.js +0 -2
  367. package/lib/public/request/Verb.d.ts +0 -2
  368. package/lib/public/request/Verb.js +0 -2
  369. package/lib/public/response/ResponseFunction.d.ts +0 -2
  370. package/lib/public/response/ResponseFunction.js +0 -2
  371. package/lib/public/response/ResponseLike.d.ts +0 -2
  372. package/lib/public/response/ResponseLike.js +0 -2
  373. package/lib/public/response/binary.d.ts +0 -2
  374. package/lib/public/response/binary.js +0 -2
  375. package/lib/public/response/error.d.ts +0 -2
  376. package/lib/public/response/error.js +0 -2
  377. package/lib/public/response/json.d.ts +0 -2
  378. package/lib/public/response/json.js +0 -2
  379. package/lib/public/response/redirect.d.ts +0 -2
  380. package/lib/public/response/redirect.js +0 -2
  381. package/lib/public/response/sse.d.ts +0 -2
  382. package/lib/public/response/sse.js +0 -2
  383. package/lib/public/response/text.d.ts +0 -2
  384. package/lib/public/response/text.js +0 -2
  385. package/lib/public/response/view.d.ts +0 -2
  386. package/lib/public/response/view.js +0 -2
  387. package/lib/public/response/ws.d.ts +0 -2
  388. package/lib/public/response/ws.js +0 -2
  389. package/lib/public/wasm/decode-json.d.ts +0 -5
  390. package/lib/public/wasm/decode-json.js +0 -3
  391. package/lib/public/wasm/decode-response.d.ts +0 -3
  392. package/lib/public/wasm/decode-response.js +0 -3
  393. package/lib/public/wasm/encode-request.d.ts +0 -3
  394. package/lib/public/wasm/encode-request.js +0 -3
  395. package/lib/public/wasm/encode-session.d.ts +0 -3
  396. package/lib/public/wasm/encode-session.js +0 -3
  397. package/lib/public/wasm/instantiate.d.ts +0 -4
  398. package/lib/public/wasm/instantiate.js +0 -3
  399. /package/lib/private/{database → db}/As.js +0 -0
  400. /package/lib/private/{database → db}/DataDict.js +0 -0
  401. /package/lib/private/{database → db}/DataKey.js +0 -0
  402. /package/lib/private/{database → db}/DataValue.js +0 -0
  403. /package/lib/private/{database → db}/Query.js +0 -0
  404. /package/lib/private/{database → db}/QueryBuilder.js +0 -0
  405. /package/lib/private/{database → db}/Schema.js +0 -0
  406. /package/lib/private/{database → db}/Sort.js +0 -0
  407. /package/lib/private/{database → db}/TypeMap.js +0 -0
  408. /package/lib/private/{database → db}/Types.js +0 -0
  409. /package/lib/private/{database → db}/primary.d.ts +0 -0
  410. /package/lib/private/{database → db}/primary.js +0 -0
  411. /package/lib/private/{database → db}/symbol/wrap.d.ts +0 -0
  412. /package/lib/private/{database → db}/symbol.d.ts +0 -0
@@ -1,5 +1,5 @@
1
1
  import type ServeApp from "#serve/App";
2
- import type MaybePromise from "@rcompat/type/MaybePromise";
2
+ import type { MaybePromise } from "@rcompat/type";
3
3
  declare const _default: <T>(mime: string, mapper: (input: T) => BodyInit) => (body: T, init?: ResponseInit) => (app: ServeApp) => MaybePromise<Response>;
4
4
  export default _default;
5
5
  //# sourceMappingURL=response.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import type RequestFacade from "#request/RequestFacade";
2
2
  import type ResponseLike from "#response/ResponseLike";
3
- import type MaybePromise from "@rcompat/type/MaybePromise";
3
+ import type { MaybePromise } from "@rcompat/type";
4
4
  type RouteHandler = (request: RequestFacade) => MaybePromise<ResponseLike>;
5
5
  export { RouteHandler as default };
6
6
  //# sourceMappingURL=Handler.d.ts.map
@@ -0,0 +1,6 @@
1
+ import type NextRoute from "#module/NextRoute";
2
+ import type RequestFacade from "#request/RequestFacade";
3
+ import type ResponseLike from "#response/ResponseLike";
4
+ import type { MaybePromise } from "@rcompat/type";
5
+ export default function hook(fn: (request: RequestFacade, next: NextRoute) => MaybePromise<ResponseLike>): void;
6
+ //# sourceMappingURL=hook.d.ts.map
@@ -0,0 +1,5 @@
1
+ import router from "#route/router";
2
+ export default function hook(fn) {
3
+ router.addHook(fn);
4
+ }
5
+ //# sourceMappingURL=hook.js.map
@@ -1,3 +1,4 @@
1
+ import type RequestHook from "#module/RequestHook";
1
2
  import type Verb from "#request/Verb";
2
3
  import type RouteHandler from "#route/Handler";
3
4
  import type RouteOptions from "#route/Options";
@@ -8,12 +9,15 @@ declare class Router {
8
9
  pop(): void;
9
10
  get active(): string | undefined;
10
11
  add(verb: Verb, handler: RouteHandler, options?: RouteOptions): void;
12
+ addHook(fn: RequestHook): void;
13
+ getHooks(path: string): RequestHook[];
14
+ verifyHook(path: string): void;
11
15
  get(path: string): {
12
- head?: {
16
+ options?: {
13
17
  handler: RouteHandler;
14
18
  options: RouteOptions;
15
19
  } | undefined;
16
- options?: {
20
+ head?: {
17
21
  handler: RouteHandler;
18
22
  options: RouteOptions;
19
23
  } | undefined;
@@ -21,15 +25,15 @@ declare class Router {
21
25
  handler: RouteHandler;
22
26
  options: RouteOptions;
23
27
  } | undefined;
24
- post?: {
28
+ delete?: {
25
29
  handler: RouteHandler;
26
30
  options: RouteOptions;
27
31
  } | undefined;
28
- put?: {
32
+ post?: {
29
33
  handler: RouteHandler;
30
34
  options: RouteOptions;
31
35
  } | undefined;
32
- delete?: {
36
+ put?: {
33
37
  handler: RouteHandler;
34
38
  options: RouteOptions;
35
39
  } | undefined;
@@ -1,29 +1,46 @@
1
+ import fail from "#fail";
1
2
  import assert from "@rcompat/assert";
2
- import is from "@rcompat/assert/is";
3
- import maybe from "@rcompat/assert/maybe";
4
3
  const stack = [];
5
4
  export const routes = stack;
5
+ function is_hook_file(p) {
6
+ const basename = p.split("/").at(-1) ?? p;
7
+ return basename === "+hook" || basename.startsWith("+hook.");
8
+ }
6
9
  class Router {
7
10
  #routes = {};
8
- push(route) {
9
- stack.push(route);
11
+ #hooks = {};
12
+ push(route) { stack.push(route); }
13
+ pop() { stack.pop(); }
14
+ get active() { return stack.at(-1); }
15
+ add(verb, handler, options) {
16
+ assert.string(verb);
17
+ assert.function(handler);
18
+ assert.maybe.dict(options);
19
+ assert.maybe.boolean(options?.parseBody);
20
+ const active = assert.defined(this.active);
21
+ if (is_hook_file(active)) {
22
+ throw fail("route.{0} may not be used inside {1}; use hook(...) instead", verb, active);
23
+ }
24
+ const _routes = this.#routes;
25
+ if (!(active in _routes))
26
+ _routes[active] = {};
27
+ _routes[active][verb] = { handler, options: options ?? {} };
10
28
  }
11
- pop() {
12
- stack.pop();
29
+ addHook(fn) {
30
+ assert.function(fn);
31
+ const active = assert.defined(this.active);
32
+ if (!is_hook_file(active)) {
33
+ throw fail("hook(...) may only be used inside +hook files, got {0}", active);
34
+ }
35
+ (this.#hooks[active] ??= []).push(fn);
13
36
  }
14
- get active() {
15
- return stack.at(-1);
37
+ getHooks(path) {
38
+ return [...(this.#hooks[path] ?? [])];
16
39
  }
17
- add(verb, handler, options = {}) {
18
- assert(this.active !== undefined);
19
- is(handler).function();
20
- maybe(options).object();
21
- const active = this.active;
22
- const routes = this.#routes;
23
- if (!(active in routes)) {
24
- routes[active] = {};
40
+ verifyHook(path) {
41
+ if ((this.#hooks[path] ?? []).length === 0) {
42
+ throw fail("hook file {0} did not register any hooks (call hook(...))", path);
25
43
  }
26
- routes[active][verb] = { handler, options };
27
44
  }
28
45
  get(path) {
29
46
  return { ...this.#routes[path] };
@@ -1,7 +1,7 @@
1
- import dedent from "@rcompat/string/dedent";
1
+ import string from "@rcompat/string";
2
2
  export default function wrap(code, path, build_id) {
3
3
  const router = `ROUTER_${build_id}`;
4
- const prelude = dedent `
4
+ const prelude = string.dedent `
5
5
  import ${router} from "primate/router";
6
6
  ${router}.push("${path}");
7
7
  `;
@@ -4,14 +4,12 @@ import type ServerView from "#frontend/ServerView";
4
4
  import type ViewOptions from "#frontend/ViewOptions";
5
5
  import type ViewResponse from "#frontend/ViewResponse";
6
6
  import type I18NConfig from "#i18n/Config";
7
- import RequestBag from "#request/RequestBag";
8
- import RequestBody from "#request/RequestBody";
9
7
  import type RequestFacade from "#request/RequestFacade";
10
8
  import type RouteHandler from "#route/Handler";
11
9
  import type ServeInit from "#serve/Init";
12
10
  import FileRouter from "@rcompat/fs/FileRouter";
13
11
  import type Actions from "@rcompat/http/Actions";
14
- import type Dict from "@rcompat/type/Dict";
12
+ import type { Dict } from "@rcompat/type";
15
13
  interface FullViewOptions extends ViewOptions {
16
14
  body: string;
17
15
  }
@@ -47,27 +45,16 @@ export default class ServeApp extends App {
47
45
  create_csp(): void;
48
46
  register(extension: string, viewFunction: ViewResponse): void;
49
47
  page(name?: string): string;
50
- serveAsset(pathname: string): Promise<Response | undefined>;
48
+ serve_assets(pathname: string): Promise<Response | undefined>;
51
49
  start(): Promise<void>;
52
50
  stop(): void;
53
51
  upgrade(request: Request, actions: Actions): null;
54
52
  route(request: RequestFacade): Promise<{
55
53
  errors: RouteHandler[];
56
- guards: RouteHandler[];
57
- handler: RouteHandler;
54
+ hooks: import("../module/RequestHook.js").default[];
58
55
  layouts: RouteHandler[];
59
- request: {
60
- body: RequestBody;
61
- path: RequestBag;
62
- context: Dict;
63
- cookies: RequestBag;
64
- forward(to: string, headers?: Dict<string>): Promise<Response>;
65
- headers: RequestBag;
66
- original: Request;
67
- query: RequestBag;
68
- target: string;
69
- url: URL;
70
- };
56
+ handler: RouteHandler;
57
+ request: any;
71
58
  } | undefined>;
72
59
  }
73
60
  export {};
@@ -1,4 +1,5 @@
1
1
  import App from "#App";
2
+ import { s_config } from "#app/Facade";
2
3
  import fail from "#fail";
3
4
  import hash from "#hash";
4
5
  import I18NModule from "#i18n/Module";
@@ -13,19 +14,15 @@ import DevModule from "#serve/module/Dev";
13
14
  import HandleModule from "#serve/module/Handle";
14
15
  import SessionModule from "#session/SessionModule";
15
16
  import tags from "#tags";
16
- import is from "@rcompat/assert/is";
17
- import FileRef from "@rcompat/fs/FileRef";
17
+ import assert from "@rcompat/assert";
18
+ import fs from "@rcompat/fs";
18
19
  import FileRouter from "@rcompat/fs/FileRouter";
19
- import resolve from "@rcompat/http/mime/extension/resolve";
20
- import TEXT_HTML from "@rcompat/http/mime/text/html";
20
+ import MIME from "@rcompat/http/mime";
21
21
  import serve from "@rcompat/http/serve";
22
22
  import Status from "@rcompat/http/Status";
23
- import entries from "@rcompat/record/entries";
24
- import utf8ByteLength from "@rcompat/string/utf8-bytelength";
25
- import pema from "pema";
26
- import record from "pema/record";
27
- import string from "pema/string";
28
- import uint from "pema/uint";
23
+ import is from "@rcompat/is";
24
+ import utf8 from "@rcompat/string/utf8";
25
+ import p from "pema";
29
26
  const deroot = (pathname) => pathname.endsWith("/") && pathname !== "/"
30
27
  ? pathname.slice(0, -1)
31
28
  : pathname;
@@ -67,8 +64,8 @@ export default class ServeApp extends App {
67
64
  #builtins;
68
65
  #i18n_config;
69
66
  constructor(rootfile, init) {
70
- const dir = new FileRef(rootfile).directory;
71
- super(dir, init.config, {
67
+ const dir = fs.ref(rootfile).directory;
68
+ super(dir, init.facade[s_config], {
72
69
  mode: init.mode,
73
70
  target: init.target,
74
71
  dir: dir.path,
@@ -78,7 +75,7 @@ export default class ServeApp extends App {
78
75
  this.#stores = Object.fromEntries((init.stores?.map(([k, s]) => [k, s.default])) ?? []);
79
76
  this.#serve_assets = init.assets;
80
77
  this.#pages = init.pages;
81
- const http = this.#init.config.http;
78
+ const http = this.#init.facade[s_config].http;
82
79
  this.#i18n_config = init.i18n_config;
83
80
  this.set(s_http, {
84
81
  host: http.host,
@@ -92,14 +89,16 @@ export default class ServeApp extends App {
92
89
  extensions: [".js"],
93
90
  specials: {
94
91
  error: { recursive: false },
95
- guard: { recursive: true },
96
92
  layout: { recursive: true },
93
+ hook: { recursive: true },
97
94
  },
98
95
  }, init.routes.map(s => s[0]));
99
96
  this.#builtins = {
100
97
  dev: init.mode === "development" ? new DevModule(this) : undefined,
101
98
  handle: new HandleModule(this),
102
- session: init.session_config ? new SessionModule(this.secure, init.session_config) : undefined,
99
+ session: init.session_config
100
+ ? new SessionModule(this.secure, init.session_config)
101
+ : undefined,
103
102
  i18n: init.i18n_config ? new I18NModule(init.i18n_config) : undefined,
104
103
  };
105
104
  }
@@ -133,7 +132,7 @@ export default class ServeApp extends App {
133
132
  return this.#i18n_config;
134
133
  }
135
134
  loadView(name) {
136
- const f = new FileRef(name).path;
135
+ const f = fs.ref(name).path;
137
136
  const frontends = Object.keys(this.frontends);
138
137
  const extension = frontends.find(frontend => f.endsWith(frontend));
139
138
  const base = extension === undefined ? name : f.slice(0, -extension.length);
@@ -147,18 +146,18 @@ export default class ServeApp extends App {
147
146
  }
148
147
  ;
149
148
  headers(csp = {}) {
150
- const http_csp = Object.entries(this.config("http.csp") ?? {});
149
+ const base = Object.entries(this.config("http.csp") ?? {});
151
150
  return {
152
151
  ...this.config("http.headers") ?? {},
153
- ...http_csp.length === 0 ? {} : {
154
- "Content-Security-Policy": to_csp(http_csp, this.#csp, csp),
152
+ ...base.length === 0 ? {} : {
153
+ "Content-Security-Policy": to_csp(base, this.#csp, csp),
155
154
  },
156
155
  };
157
156
  }
158
157
  ;
159
158
  render(content) {
160
159
  const { body, head, page, partial, placeholders = {} } = content;
161
- ["body", "head"].forEach(key => is(placeholders[key]).undefined());
160
+ ["body", "head"].forEach(key => assert.undefined(placeholders[key]));
162
161
  return partial ? body : Object.entries(placeholders)
163
162
  // replace given placeholders, defaulting to ""
164
163
  .reduce((rendered, [key, value]) => rendered
@@ -170,20 +169,22 @@ export default class ServeApp extends App {
170
169
  .replace("%head%", render_head(this.#assets, head));
171
170
  }
172
171
  body_length(body) {
173
- return typeof body === "string" ? utf8ByteLength(body) : 0;
172
+ return is.string(body) ? utf8.size(body) : 0;
174
173
  }
175
174
  respond(body, init) {
176
- const { headers, status } = pema({
177
- headers: record(string, string),
178
- status: uint.values(Status).default(Status.OK),
175
+ const { headers, status } = p({
176
+ headers: p.dict(),
177
+ status: p.uint.values(Status).default(Status.OK),
179
178
  }).parse(init);
180
179
  const body_length = this.body_length(body);
181
180
  return new Response(body, {
182
181
  headers: {
183
- "Content-Type": TEXT_HTML,
182
+ "Content-Type": MIME.TEXT_HTML,
184
183
  ...this.headers(),
185
- ...body_length ? { ...headers, "Content-Length": String(body_length) } : headers,
186
- }, status: status,
184
+ ...body_length ? {
185
+ ...headers, "Content-Length": String(body_length),
186
+ } : headers,
187
+ }, status,
187
188
  });
188
189
  }
189
190
  ;
@@ -206,7 +207,7 @@ export default class ServeApp extends App {
206
207
  code: inline ? code : "",
207
208
  inline,
208
209
  integrity: await hash(code),
209
- src: FileRef.join(this.#init.config.http.static.root, src ?? "").path,
210
+ src: fs.join(this.config("http.static.root"), src ?? "").path,
210
211
  type,
211
212
  });
212
213
  }
@@ -216,7 +217,10 @@ export default class ServeApp extends App {
216
217
  ;
217
218
  create_csp() {
218
219
  this.#csp = this.#assets.map(({ integrity, type: directive }) => [`${directive === "style" ? "style" : "script"}-src`, integrity])
219
- .reduce((csp, [directive, hash]) => ({ ...csp, [directive]: csp[directive].concat(`'${hash}'`) }), { "script-src": [], "style-src": [] });
220
+ .reduce((csp, [directive, _hash]) => ({
221
+ ...csp,
222
+ [directive]: csp[directive].concat(`'${_hash}'`),
223
+ }), { "script-src": [], "style-src": [] });
220
224
  }
221
225
  ;
222
226
  register(extension, viewFunction) {
@@ -230,18 +234,18 @@ export default class ServeApp extends App {
230
234
  const page_name = name ?? location.app_html;
231
235
  return this.#pages[page_name];
232
236
  }
233
- async #try_serve(file) {
234
- if (await file.exists() && await file.isFile()) {
235
- return new Response(file.stream(), {
237
+ async #try_serve(ref) {
238
+ if (await ref.exists() && await ref.kind() === "file") {
239
+ return new Response(ref.stream(), {
236
240
  headers: {
237
- "Content-Type": resolve(file.name),
238
- "Content-Length": String(await file.byteLength()),
241
+ "Content-Type": MIME.resolve(ref.name),
242
+ "Content-Length": String(await ref.size()),
239
243
  },
240
244
  status: Status.OK,
241
245
  });
242
246
  }
243
247
  }
244
- async serveAsset(pathname) {
248
+ async serve_assets(pathname) {
245
249
  const static_root = this.config("http.static.root");
246
250
  if (!pathname.startsWith(static_root))
247
251
  return undefined;
@@ -256,23 +260,22 @@ export default class ServeApp extends App {
256
260
  return static_response;
257
261
  return undefined;
258
262
  }
259
- const asset = this.#serve_assets.client[pathname] ??
260
- this.#serve_assets.static[pathname];
261
- if (asset) {
262
- const binary = atob(asset.data);
263
- const bytes = new Uint8Array(binary.length);
264
- for (let i = 0; i < binary.length; i++) {
265
- bytes[i] = binary.charCodeAt(i);
266
- }
267
- return new Response(bytes, {
268
- headers: {
269
- "Content-Type": asset.mime,
270
- "Content-Length": String(bytes.length),
271
- },
272
- status: Status.OK,
273
- });
263
+ const assets = this.#serve_assets;
264
+ const asset = assets.client[pathname] ?? assets.static[pathname];
265
+ if (asset === undefined)
266
+ return undefined;
267
+ const binary = atob(asset.data);
268
+ const bytes = new Uint8Array(binary.length);
269
+ for (let i = 0; i < binary.length; i++) {
270
+ bytes[i] = binary.charCodeAt(i);
274
271
  }
275
- return undefined;
272
+ return new Response(bytes, {
273
+ headers: {
274
+ "Content-Type": asset.mime,
275
+ "Content-Length": String(bytes.length),
276
+ },
277
+ status: Status.OK,
278
+ });
276
279
  }
277
280
  async start() {
278
281
  if (this.mode === "production") {
@@ -293,8 +296,10 @@ export default class ServeApp extends App {
293
296
  else {
294
297
  const client_dir = this.root.join(location.client);
295
298
  const files = await client_dir.exists()
296
- ? await client_dir.collect(f => f.extension === ".js"
297
- || f.extension === ".css")
299
+ ? await client_dir.files({
300
+ recursive: true,
301
+ filter: info => info.extension === ".js" || info.extension === ".css",
302
+ })
298
303
  : [];
299
304
  this.#assets = await Promise.all(files.map(async (file) => {
300
305
  const type = file.extension === ".css" ? "style" : "js";
@@ -328,9 +333,14 @@ export default class ServeApp extends App {
328
333
  status: Status.INTERNAL_SERVER_ERROR,
329
334
  });
330
335
  }
331
- }, { ...this.get(s_http),
332
- timeout: this.mode === "development" ? 0 : undefined });
333
- log.system("started {0}", this.url);
336
+ }, {
337
+ ...this.get(s_http),
338
+ timeout: this.mode === "development" ? 0 : undefined,
339
+ });
340
+ function bright(x) {
341
+ return `\x1b[38;2;0;200;255m${x}\x1b[0m`;
342
+ }
343
+ log.print(`» app url ${bright(this.url)}\n`);
334
344
  }
335
345
  ;
336
346
  stop() {
@@ -350,37 +360,36 @@ export default class ServeApp extends App {
350
360
  return;
351
361
  }
352
362
  const verb = original.method.toLowerCase();
353
- const { errors = [], guards = [], layouts = [] } = entries(route.specials)
354
- .map(([key, value]) => [`${key}s`, value ?? []])
355
- .map(([key, value]) => [key, value.map(v => {
356
- const verbs = router.get(v);
357
- const routeHandler = verbs[verb];
358
- return routeHandler?.handler;
359
- }).filter(Boolean).toReversed()])
360
- .get();
363
+ const specials = route.specials;
364
+ const errors = (specials.error ?? [])
365
+ .map(v => router.get(v)[verb]?.handler)
366
+ .filter(Boolean)
367
+ .toReversed();
368
+ const layouts = (specials.layout ?? [])
369
+ .map(v => router.get(v)[verb]?.handler)
370
+ .filter(Boolean)
371
+ .toReversed();
372
+ const hooks = (specials.hook ?? [])
373
+ .toReversed()
374
+ .flatMap(v => router.getHooks(v));
361
375
  const verbs = router.get(route.path);
362
- const routePath = verbs[verb];
363
- if (routePath === undefined) {
376
+ const route_path = verbs[verb];
377
+ if (route_path === undefined) {
364
378
  throw fail("route {0} has no {1} verb", route.path, verb);
365
379
  }
366
- const parseBody = routePath.options.parseBody;
367
- const body = parseBody ?? this.config("request.body.parse")
380
+ const handler = route_path.handler;
381
+ const parse_body = route_path.options.parseBody;
382
+ const body = parse_body ?? this.config("request.body.parse")
368
383
  ? await RequestBody.parse(original, url)
369
384
  : RequestBody.none();
370
- return {
371
- errors,
372
- guards,
373
- handler: routePath.handler,
374
- layouts,
375
- request: {
376
- ...request,
377
- body,
378
- path: new RequestBag(route.params, "path", {
379
- normalize: k => k.toLowerCase(),
380
- raw: url.pathname,
381
- }),
382
- },
383
- };
385
+ const refined = Object.assign(Object.create(request), {
386
+ body,
387
+ path: new RequestBag(route.params, "path", {
388
+ normalize: k => k.toLowerCase(),
389
+ raw: url.pathname,
390
+ }),
391
+ });
392
+ return { errors, hooks, layouts, handler, request: refined };
384
393
  }
385
394
  }
386
395
  //# sourceMappingURL=App.js.map
@@ -1,8 +1,8 @@
1
- import type Config from "#config/Config";
1
+ import type AppFacade from "#app/Facade";
2
2
  import type I18NConfig from "#i18n/Config";
3
3
  import type Mode from "#Mode";
4
4
  import type SessionConfig from "#session/Config";
5
- import type Dict from "@rcompat/type/Dict";
5
+ import type { Dict } from "@rcompat/type";
6
6
  type Import = {
7
7
  default: unknown;
8
8
  } & Dict;
@@ -19,7 +19,7 @@ type ServeInit = {
19
19
  };
20
20
  views?: [string, Import][];
21
21
  stores?: [string, Import][];
22
- config: Config;
22
+ facade: AppFacade;
23
23
  routes: [string, {
24
24
  default: any;
25
25
  }][];
@@ -1,13 +1,7 @@
1
- import log from "#log";
2
1
  import reducer from "#reducer";
3
- function pre(app) {
4
- log.system("in startup");
5
- return app;
6
- }
7
- ;
8
2
  async function post(app) {
9
3
  await app.start();
10
4
  return app;
11
5
  }
12
- export default async (app) => post(await reducer(app.modules, pre(app), "serve"));
6
+ export default async (app) => post(await reducer(app.modules, app, "serve"));
13
7
  //# sourceMappingURL=hook.js.map
@@ -1,6 +1,10 @@
1
+ import { s_attach } from "#app/Facade";
1
2
  import ServeApp from "#serve/App";
2
- import serve from "#serve/hook";
3
+ import serve_hook from "#serve/hook";
3
4
  export default async (root, options) => {
4
- return serve(await new ServeApp(root, options).init());
5
+ const facade = options.facade;
6
+ const app = await new ServeApp(root, options).init();
7
+ facade[s_attach](app);
8
+ return serve_hook(app);
5
9
  };
6
10
  //# sourceMappingURL=index.js.map
@@ -6,6 +6,6 @@ export default class DevModule extends Module {
6
6
  #private;
7
7
  name: string;
8
8
  constructor(app: ServeApp);
9
- handle(request: RequestFacade, next: NextHandle): import("@rcompat/type/MaybePromise").default<Response>;
9
+ handle(request: RequestFacade, next: NextHandle): import("@rcompat/type").MaybePromise<Response>;
10
10
  }
11
11
  //# sourceMappingURL=Dev.d.ts.map
@@ -1,5 +1,6 @@
1
- import reload from "#build/client/reload";
1
+ import log from "#log";
2
2
  import Module from "#Module";
3
+ import c from "@rcompat/cli/color";
3
4
  function pass(address, request) {
4
5
  return fetch(address, {
5
6
  body: request.body,
@@ -8,20 +9,23 @@ function pass(address, request) {
8
9
  method: request.method,
9
10
  });
10
11
  }
12
+ // https://esbuild.github.io/api/#live-reload
11
13
  export default class DevModule extends Module {
12
14
  name = "builtin/dev";
13
15
  #paths;
14
- #reload_url;
16
+ #reload;
15
17
  constructor(app) {
16
18
  super();
17
19
  const assets = app.assets.map(asset => asset.src);
18
- this.#paths = ([reload.path]).concat(assets);
19
- this.#reload_url = `http://${reload.host}:${reload.port}`;
20
+ this.#paths = ["/esbuild"].concat(assets);
21
+ const { host, port } = app.livereload;
22
+ this.#reload = `http://${host}:${port}`;
23
+ log.print(`↻ live reload ${c.dim(this.#reload)}\n`);
20
24
  }
21
25
  handle(request, next) {
22
26
  const { pathname } = new URL(request.url);
23
27
  return this.#paths.includes(pathname)
24
- ? pass(`${this.#reload_url}${pathname}`, request.original)
28
+ ? pass(`${this.#reload}${pathname}`, request.original)
25
29
  : next(request);
26
30
  }
27
31
  }
@@ -1,5 +1,5 @@
1
- import route from "#request/route";
2
1
  import Module from "#Module";
2
+ import route from "#request/route";
3
3
  export default class HandleModule extends Module {
4
4
  name = "builtin/handle";
5
5
  #app;
@@ -8,7 +8,7 @@ export default class HandleModule extends Module {
8
8
  this.#app = app;
9
9
  }
10
10
  async handle(request) {
11
- return await this.#app.serveAsset(request.url.pathname)
11
+ return await this.#app.serve_assets(request.url.pathname)
12
12
  ?? route(this.#app, request);
13
13
  }
14
14
  }
@@ -1,5 +1,4 @@
1
- import type Dict from "@rcompat/type/Dict";
2
- import type JSONValue from "@rcompat/type/JSONValue";
1
+ import type { Dict, JSONValue } from "@rcompat/type";
3
2
  type Data = Dict<JSONValue>;
4
3
  export { Data as default };
5
4
  //# sourceMappingURL=Data.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import kSerialize from "#session/k-serialize";
2
- import type Schema from "@rcompat/type/Schema";
2
+ import type { Schema } from "@rcompat/type";
3
3
  export default class SessionHandle<Data> {
4
4
  #private;
5
5
  [kSerialize]: () => {