@xtandard/kit 0.0.0-stage → 0.1.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 (402) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +71 -2
  3. package/bin/xtandard-kit.mjs +3 -0
  4. package/dist/base-path-BJugWLNO.cjs +42 -0
  5. package/dist/base-path-BJugWLNO.cjs.map +1 -0
  6. package/dist/base-path-CDb4In5E.mjs +31 -0
  7. package/dist/base-path-CDb4In5E.mjs.map +1 -0
  8. package/dist/basic-Qtriv0xS.mjs +176 -0
  9. package/dist/basic-Qtriv0xS.mjs.map +1 -0
  10. package/dist/basic-ZaO92-lB.cjs +199 -0
  11. package/dist/basic-ZaO92-lB.cjs.map +1 -0
  12. package/dist/bin.cjs +126 -0
  13. package/dist/bin.cjs.map +1 -0
  14. package/dist/bin.d.cts +20 -0
  15. package/dist/bin.d.mts +20 -0
  16. package/dist/bin.mjs +125 -0
  17. package/dist/bin.mjs.map +1 -0
  18. package/dist/cas-CuPSaXBV.cjs +23 -0
  19. package/dist/cas-CuPSaXBV.cjs.map +1 -0
  20. package/dist/cas-CzA-yECx.mjs +18 -0
  21. package/dist/cas-CzA-yECx.mjs.map +1 -0
  22. package/dist/chunk-DakpK96I.cjs +43 -0
  23. package/dist/contract-B3UPXXLx.d.cts +30 -0
  24. package/dist/contract-B3UPXXLx.d.mts +30 -0
  25. package/dist/contract-BDPNvjtp.d.mts +64 -0
  26. package/dist/contract-BEdfGTPs.mjs +85 -0
  27. package/dist/contract-BEdfGTPs.mjs.map +1 -0
  28. package/dist/contract-BIVzAn4f.d.cts +64 -0
  29. package/dist/contract-BvgtswLX.d.cts +75 -0
  30. package/dist/contract-BvgtswLX.d.mts +75 -0
  31. package/dist/contract-DUj9P3Vt.d.cts +72 -0
  32. package/dist/contract-DUj9P3Vt.d.mts +72 -0
  33. package/dist/contract-wAEMDmYG.cjs +132 -0
  34. package/dist/contract-wAEMDmYG.cjs.map +1 -0
  35. package/dist/drizzle-BElCHWri.d.mts +115 -0
  36. package/dist/drizzle-BXaQXCr0.cjs +232 -0
  37. package/dist/drizzle-BXaQXCr0.cjs.map +1 -0
  38. package/dist/drizzle-CEpahWQB.d.cts +115 -0
  39. package/dist/drizzle-DxnelsPT.mjs +197 -0
  40. package/dist/drizzle-DxnelsPT.mjs.map +1 -0
  41. package/dist/duration-7WpAK-xe.mjs +52 -0
  42. package/dist/duration-7WpAK-xe.mjs.map +1 -0
  43. package/dist/duration-DVA0Fzkx.cjs +63 -0
  44. package/dist/duration-DVA0Fzkx.cjs.map +1 -0
  45. package/dist/duration-FPwbmWIU.d.cts +35 -0
  46. package/dist/duration-FPwbmWIU.d.mts +35 -0
  47. package/dist/entry-adapters-bun.cjs +10 -0
  48. package/dist/entry-adapters-bun.cjs.map +1 -0
  49. package/dist/entry-adapters-bun.d.cts +10 -0
  50. package/dist/entry-adapters-bun.d.mts +10 -0
  51. package/dist/entry-adapters-bun.mjs +9 -0
  52. package/dist/entry-adapters-bun.mjs.map +1 -0
  53. package/dist/entry-adapters-elysia.cjs +54 -0
  54. package/dist/entry-adapters-elysia.cjs.map +1 -0
  55. package/dist/entry-adapters-elysia.d.cts +38 -0
  56. package/dist/entry-adapters-elysia.d.mts +38 -0
  57. package/dist/entry-adapters-elysia.mjs +53 -0
  58. package/dist/entry-adapters-elysia.mjs.map +1 -0
  59. package/dist/entry-adapters-express.cjs +27 -0
  60. package/dist/entry-adapters-express.cjs.map +1 -0
  61. package/dist/entry-adapters-express.d.cts +24 -0
  62. package/dist/entry-adapters-express.d.mts +24 -0
  63. package/dist/entry-adapters-express.mjs +26 -0
  64. package/dist/entry-adapters-express.mjs.map +1 -0
  65. package/dist/entry-adapters-hono.cjs +33 -0
  66. package/dist/entry-adapters-hono.cjs.map +1 -0
  67. package/dist/entry-adapters-hono.d.cts +36 -0
  68. package/dist/entry-adapters-hono.d.mts +36 -0
  69. package/dist/entry-adapters-hono.mjs +30 -0
  70. package/dist/entry-adapters-hono.mjs.map +1 -0
  71. package/dist/entry-adapters-next.cjs +19 -0
  72. package/dist/entry-adapters-next.cjs.map +1 -0
  73. package/dist/entry-adapters-next.d.cts +35 -0
  74. package/dist/entry-adapters-next.d.mts +35 -0
  75. package/dist/entry-adapters-next.mjs +18 -0
  76. package/dist/entry-adapters-next.mjs.map +1 -0
  77. package/dist/entry-adapters-node.cjs +7 -0
  78. package/dist/entry-adapters-node.d.cts +2 -0
  79. package/dist/entry-adapters-node.d.mts +2 -0
  80. package/dist/entry-adapters-node.mjs +2 -0
  81. package/dist/entry-auth-basic.cjs +5 -0
  82. package/dist/entry-auth-basic.d.cts +83 -0
  83. package/dist/entry-auth-basic.d.mts +83 -0
  84. package/dist/entry-auth-basic.mjs +2 -0
  85. package/dist/entry-auth-delegated.cjs +28 -0
  86. package/dist/entry-auth-delegated.cjs.map +1 -0
  87. package/dist/entry-auth-delegated.d.cts +36 -0
  88. package/dist/entry-auth-delegated.d.mts +36 -0
  89. package/dist/entry-auth-delegated.mjs +27 -0
  90. package/dist/entry-auth-delegated.mjs.map +1 -0
  91. package/dist/entry-auth-none.cjs +4 -0
  92. package/dist/entry-auth-none.d.cts +25 -0
  93. package/dist/entry-auth-none.d.mts +25 -0
  94. package/dist/entry-auth-none.mjs +2 -0
  95. package/dist/entry-auth.cjs +0 -0
  96. package/dist/entry-auth.d.cts +2 -0
  97. package/dist/entry-auth.d.mts +2 -0
  98. package/dist/entry-auth.mjs +1 -0
  99. package/dist/entry-authorization-delegated.cjs +27 -0
  100. package/dist/entry-authorization-delegated.cjs.map +1 -0
  101. package/dist/entry-authorization-delegated.d.cts +31 -0
  102. package/dist/entry-authorization-delegated.d.mts +31 -0
  103. package/dist/entry-authorization-delegated.mjs +26 -0
  104. package/dist/entry-authorization-delegated.mjs.map +1 -0
  105. package/dist/entry-authorization-none.cjs +3 -0
  106. package/dist/entry-authorization-none.d.cts +18 -0
  107. package/dist/entry-authorization-none.d.mts +18 -0
  108. package/dist/entry-authorization-none.mjs +2 -0
  109. package/dist/entry-authorization-roles.cjs +3 -0
  110. package/dist/entry-authorization-roles.d.cts +2 -0
  111. package/dist/entry-authorization-roles.d.mts +2 -0
  112. package/dist/entry-authorization-roles.mjs +2 -0
  113. package/dist/entry-authorization.cjs +35 -0
  114. package/dist/entry-authorization.cjs.map +1 -0
  115. package/dist/entry-authorization.d.cts +2 -0
  116. package/dist/entry-authorization.d.mts +2 -0
  117. package/dist/entry-authorization.mjs +34 -0
  118. package/dist/entry-authorization.mjs.map +1 -0
  119. package/dist/entry-build.cjs +481 -0
  120. package/dist/entry-build.cjs.map +1 -0
  121. package/dist/entry-build.d.cts +355 -0
  122. package/dist/entry-build.d.mts +355 -0
  123. package/dist/entry-build.mjs +460 -0
  124. package/dist/entry-build.mjs.map +1 -0
  125. package/dist/entry-cli.cjs +368 -0
  126. package/dist/entry-cli.cjs.map +1 -0
  127. package/dist/entry-cli.d.cts +275 -0
  128. package/dist/entry-cli.d.mts +275 -0
  129. package/dist/entry-cli.mjs +355 -0
  130. package/dist/entry-cli.mjs.map +1 -0
  131. package/dist/entry-drizzle-mysql.cjs +36 -0
  132. package/dist/entry-drizzle-mysql.cjs.map +1 -0
  133. package/dist/entry-drizzle-mysql.d.cts +55 -0
  134. package/dist/entry-drizzle-mysql.d.mts +55 -0
  135. package/dist/entry-drizzle-mysql.mjs +34 -0
  136. package/dist/entry-drizzle-mysql.mjs.map +1 -0
  137. package/dist/entry-drizzle-pg.cjs +38 -0
  138. package/dist/entry-drizzle-pg.cjs.map +1 -0
  139. package/dist/entry-drizzle-pg.d.cts +78 -0
  140. package/dist/entry-drizzle-pg.d.mts +78 -0
  141. package/dist/entry-drizzle-pg.mjs +36 -0
  142. package/dist/entry-drizzle-pg.mjs.map +1 -0
  143. package/dist/entry-drizzle-sqlite.cjs +20 -0
  144. package/dist/entry-drizzle-sqlite.cjs.map +1 -0
  145. package/dist/entry-drizzle-sqlite.d.cts +22 -0
  146. package/dist/entry-drizzle-sqlite.d.mts +22 -0
  147. package/dist/entry-drizzle-sqlite.mjs +19 -0
  148. package/dist/entry-drizzle-sqlite.mjs.map +1 -0
  149. package/dist/entry-hooks-log.cjs +32 -0
  150. package/dist/entry-hooks-log.cjs.map +1 -0
  151. package/dist/entry-hooks-log.d.cts +36 -0
  152. package/dist/entry-hooks-log.d.mts +36 -0
  153. package/dist/entry-hooks-log.mjs +31 -0
  154. package/dist/entry-hooks-log.mjs.map +1 -0
  155. package/dist/entry-hooks.cjs +10 -0
  156. package/dist/entry-hooks.d.cts +2 -0
  157. package/dist/entry-hooks.d.mts +2 -0
  158. package/dist/entry-hooks.mjs +2 -0
  159. package/dist/entry-server-router.cjs +235 -0
  160. package/dist/entry-server-router.cjs.map +1 -0
  161. package/dist/entry-server-router.d.cts +193 -0
  162. package/dist/entry-server-router.d.mts +193 -0
  163. package/dist/entry-server-router.mjs +228 -0
  164. package/dist/entry-server-router.mjs.map +1 -0
  165. package/dist/entry-server.cjs +344 -0
  166. package/dist/entry-server.cjs.map +1 -0
  167. package/dist/entry-server.d.cts +230 -0
  168. package/dist/entry-server.d.mts +230 -0
  169. package/dist/entry-server.mjs +322 -0
  170. package/dist/entry-server.mjs.map +1 -0
  171. package/dist/entry-site.cjs +1083 -0
  172. package/dist/entry-site.cjs.map +1 -0
  173. package/dist/entry-site.d.cts +336 -0
  174. package/dist/entry-site.d.mts +336 -0
  175. package/dist/entry-site.mjs +1060 -0
  176. package/dist/entry-site.mjs.map +1 -0
  177. package/dist/entry-storage-cloudflare-kv.cjs +51 -0
  178. package/dist/entry-storage-cloudflare-kv.cjs.map +1 -0
  179. package/dist/entry-storage-cloudflare-kv.d.cts +52 -0
  180. package/dist/entry-storage-cloudflare-kv.d.mts +52 -0
  181. package/dist/entry-storage-cloudflare-kv.mjs +50 -0
  182. package/dist/entry-storage-cloudflare-kv.mjs.map +1 -0
  183. package/dist/entry-storage-drizzle-internals.cjs +6 -0
  184. package/dist/entry-storage-drizzle-internals.d.cts +2 -0
  185. package/dist/entry-storage-drizzle-internals.d.mts +2 -0
  186. package/dist/entry-storage-drizzle-internals.mjs +2 -0
  187. package/dist/entry-storage-drizzle.cjs +4 -0
  188. package/dist/entry-storage-drizzle.d.cts +3 -0
  189. package/dist/entry-storage-drizzle.d.mts +3 -0
  190. package/dist/entry-storage-drizzle.mjs +2 -0
  191. package/dist/entry-storage-file.cjs +306 -0
  192. package/dist/entry-storage-file.cjs.map +1 -0
  193. package/dist/entry-storage-file.d.cts +76 -0
  194. package/dist/entry-storage-file.d.mts +76 -0
  195. package/dist/entry-storage-file.mjs +301 -0
  196. package/dist/entry-storage-file.mjs.map +1 -0
  197. package/dist/entry-storage-libsql-internals.cjs +7 -0
  198. package/dist/entry-storage-libsql-internals.d.cts +3 -0
  199. package/dist/entry-storage-libsql-internals.d.mts +3 -0
  200. package/dist/entry-storage-libsql-internals.mjs +3 -0
  201. package/dist/entry-storage-libsql.cjs +3 -0
  202. package/dist/entry-storage-libsql.d.cts +2 -0
  203. package/dist/entry-storage-libsql.d.mts +2 -0
  204. package/dist/entry-storage-libsql.mjs +2 -0
  205. package/dist/entry-storage-memory.cjs +78 -0
  206. package/dist/entry-storage-memory.cjs.map +1 -0
  207. package/dist/entry-storage-memory.d.cts +35 -0
  208. package/dist/entry-storage-memory.d.mts +35 -0
  209. package/dist/entry-storage-memory.mjs +77 -0
  210. package/dist/entry-storage-memory.mjs.map +1 -0
  211. package/dist/entry-storage-mongodb-internals.cjs +5 -0
  212. package/dist/entry-storage-mongodb-internals.d.cts +2 -0
  213. package/dist/entry-storage-mongodb-internals.d.mts +2 -0
  214. package/dist/entry-storage-mongodb-internals.mjs +2 -0
  215. package/dist/entry-storage-mongodb.cjs +3 -0
  216. package/dist/entry-storage-mongodb.d.cts +2 -0
  217. package/dist/entry-storage-mongodb.d.mts +2 -0
  218. package/dist/entry-storage-mongodb.mjs +2 -0
  219. package/dist/entry-storage-postgres-internals.cjs +6 -0
  220. package/dist/entry-storage-postgres-internals.d.cts +2 -0
  221. package/dist/entry-storage-postgres-internals.d.mts +2 -0
  222. package/dist/entry-storage-postgres-internals.mjs +2 -0
  223. package/dist/entry-storage-postgres.cjs +4 -0
  224. package/dist/entry-storage-postgres.d.cts +2 -0
  225. package/dist/entry-storage-postgres.d.mts +2 -0
  226. package/dist/entry-storage-postgres.mjs +2 -0
  227. package/dist/entry-storage-redis-internals.cjs +7 -0
  228. package/dist/entry-storage-redis-internals.d.cts +2 -0
  229. package/dist/entry-storage-redis-internals.d.mts +2 -0
  230. package/dist/entry-storage-redis-internals.mjs +2 -0
  231. package/dist/entry-storage-redis.cjs +4 -0
  232. package/dist/entry-storage-redis.d.cts +2 -0
  233. package/dist/entry-storage-redis.d.mts +2 -0
  234. package/dist/entry-storage-redis.mjs +2 -0
  235. package/dist/entry-storage-sqlite-internals.cjs +7 -0
  236. package/dist/entry-storage-sqlite-internals.d.cts +3 -0
  237. package/dist/entry-storage-sqlite-internals.d.mts +3 -0
  238. package/dist/entry-storage-sqlite-internals.mjs +3 -0
  239. package/dist/entry-storage-sqlite.cjs +3 -0
  240. package/dist/entry-storage-sqlite.d.cts +2 -0
  241. package/dist/entry-storage-sqlite.d.mts +2 -0
  242. package/dist/entry-storage-sqlite.mjs +2 -0
  243. package/dist/entry-storage-testing.cjs +801 -0
  244. package/dist/entry-storage-testing.cjs.map +1 -0
  245. package/dist/entry-storage-testing.d.cts +150 -0
  246. package/dist/entry-storage-testing.d.mts +150 -0
  247. package/dist/entry-storage-testing.mjs +790 -0
  248. package/dist/entry-storage-testing.mjs.map +1 -0
  249. package/dist/entry-storage-unstorage.cjs +78 -0
  250. package/dist/entry-storage-unstorage.cjs.map +1 -0
  251. package/dist/entry-storage-unstorage.d.cts +30 -0
  252. package/dist/entry-storage-unstorage.d.mts +30 -0
  253. package/dist/entry-storage-unstorage.mjs +77 -0
  254. package/dist/entry-storage-unstorage.mjs.map +1 -0
  255. package/dist/entry-storage.cjs +114 -0
  256. package/dist/entry-storage.cjs.map +1 -0
  257. package/dist/entry-storage.d.cts +152 -0
  258. package/dist/entry-storage.d.mts +152 -0
  259. package/dist/entry-storage.mjs +91 -0
  260. package/dist/entry-storage.mjs.map +1 -0
  261. package/dist/entry-testing.cjs +79 -0
  262. package/dist/entry-testing.cjs.map +1 -0
  263. package/dist/entry-testing.d.cts +55 -0
  264. package/dist/entry-testing.d.mts +55 -0
  265. package/dist/entry-testing.mjs +77 -0
  266. package/dist/entry-testing.mjs.map +1 -0
  267. package/dist/entry-tokens.cjs +4 -0
  268. package/dist/entry-tokens.d.cts +85 -0
  269. package/dist/entry-tokens.d.mts +85 -0
  270. package/dist/entry-tokens.mjs +2 -0
  271. package/dist/entry-ui-embed.cjs +131 -0
  272. package/dist/entry-ui-embed.cjs.map +1 -0
  273. package/dist/entry-ui-embed.d.cts +87 -0
  274. package/dist/entry-ui-embed.d.mts +87 -0
  275. package/dist/entry-ui-embed.mjs +127 -0
  276. package/dist/entry-ui-embed.mjs.map +1 -0
  277. package/dist/entry-ui.cjs +795 -0
  278. package/dist/entry-ui.cjs.map +1 -0
  279. package/dist/entry-ui.d.cts +574 -0
  280. package/dist/entry-ui.d.mts +574 -0
  281. package/dist/entry-ui.mjs +731 -0
  282. package/dist/entry-ui.mjs.map +1 -0
  283. package/dist/entry-util.cjs +145 -0
  284. package/dist/entry-util.cjs.map +1 -0
  285. package/dist/entry-util.d.cts +85 -0
  286. package/dist/entry-util.d.mts +85 -0
  287. package/dist/entry-util.mjs +130 -0
  288. package/dist/entry-util.mjs.map +1 -0
  289. package/dist/http-B_rTnLW9.cjs +235 -0
  290. package/dist/http-B_rTnLW9.cjs.map +1 -0
  291. package/dist/http-CxYM7kPT.d.mts +133 -0
  292. package/dist/http-DVdVI6kJ.mjs +164 -0
  293. package/dist/http-DVdVI6kJ.mjs.map +1 -0
  294. package/dist/http-XBVRk8uo.d.cts +133 -0
  295. package/dist/index.cjs +8 -0
  296. package/dist/index.cjs.map +1 -0
  297. package/dist/index.d.cts +6 -0
  298. package/dist/index.d.mts +6 -0
  299. package/dist/index.mjs +7 -0
  300. package/dist/index.mjs.map +1 -0
  301. package/dist/json-CCyzstIm.d.cts +44 -0
  302. package/dist/json-CCyzstIm.d.mts +44 -0
  303. package/dist/json-CM7TwYQ7.cjs +92 -0
  304. package/dist/json-CM7TwYQ7.cjs.map +1 -0
  305. package/dist/json-CmM1M5Kz.mjs +63 -0
  306. package/dist/json-CmM1M5Kz.mjs.map +1 -0
  307. package/dist/keys-Bwubabk0.mjs +73 -0
  308. package/dist/keys-Bwubabk0.mjs.map +1 -0
  309. package/dist/keys-DQrwxDKI.cjs +126 -0
  310. package/dist/keys-DQrwxDKI.cjs.map +1 -0
  311. package/dist/kv-sqlite-B6iTLOx2.d.cts +20 -0
  312. package/dist/kv-sqlite-CHOdIMJ-.cjs +77 -0
  313. package/dist/kv-sqlite-CHOdIMJ-.cjs.map +1 -0
  314. package/dist/kv-sqlite-DIIPfflJ.mjs +66 -0
  315. package/dist/kv-sqlite-DIIPfflJ.mjs.map +1 -0
  316. package/dist/kv-sqlite-Tx4UedJs.d.mts +20 -0
  317. package/dist/libsql-0160BubR.d.mts +65 -0
  318. package/dist/libsql-BZmRZIqt.d.cts +65 -0
  319. package/dist/libsql-CiBfVtbS.cjs +103 -0
  320. package/dist/libsql-CiBfVtbS.cjs.map +1 -0
  321. package/dist/libsql-CkOjQINi.mjs +86 -0
  322. package/dist/libsql-CkOjQINi.mjs.map +1 -0
  323. package/dist/mongodb--Cuj7V_9.cjs +150 -0
  324. package/dist/mongodb--Cuj7V_9.cjs.map +1 -0
  325. package/dist/mongodb-DGtsolQ2.d.cts +61 -0
  326. package/dist/mongodb-JMizy4Wg.mjs +127 -0
  327. package/dist/mongodb-JMizy4Wg.mjs.map +1 -0
  328. package/dist/mongodb-xGEU5Gwz.d.mts +61 -0
  329. package/dist/node-B1Djcwfi.d.cts +57 -0
  330. package/dist/node-B1Djcwfi.d.mts +57 -0
  331. package/dist/node-BYjocCbU.mjs +167 -0
  332. package/dist/node-BYjocCbU.mjs.map +1 -0
  333. package/dist/node-DFFqYRk-.cjs +201 -0
  334. package/dist/node-DFFqYRk-.cjs.map +1 -0
  335. package/dist/none-BEY7Kc_-.mjs +33 -0
  336. package/dist/none-BEY7Kc_-.mjs.map +1 -0
  337. package/dist/none-BoQ6-30P.cjs +33 -0
  338. package/dist/none-BoQ6-30P.cjs.map +1 -0
  339. package/dist/none-CHwVkQL-.cjs +49 -0
  340. package/dist/none-CHwVkQL-.cjs.map +1 -0
  341. package/dist/none-yu3qC47E.mjs +23 -0
  342. package/dist/none-yu3qC47E.mjs.map +1 -0
  343. package/dist/peer-BIjBFzwQ.cjs +56 -0
  344. package/dist/peer-BIjBFzwQ.cjs.map +1 -0
  345. package/dist/peer-CTHMzOdn.mjs +40 -0
  346. package/dist/peer-CTHMzOdn.mjs.map +1 -0
  347. package/dist/portal-container-CJIcau3B.mjs +610 -0
  348. package/dist/portal-container-CJIcau3B.mjs.map +1 -0
  349. package/dist/portal-container-Ca1NxrLE.cjs +774 -0
  350. package/dist/portal-container-Ca1NxrLE.cjs.map +1 -0
  351. package/dist/postgres-BJzxKBk0.d.cts +72 -0
  352. package/dist/postgres-CA8_XcAE.cjs +164 -0
  353. package/dist/postgres-CA8_XcAE.cjs.map +1 -0
  354. package/dist/postgres-RfQMgAsj.d.mts +72 -0
  355. package/dist/postgres-aDiBmNzr.mjs +135 -0
  356. package/dist/postgres-aDiBmNzr.mjs.map +1 -0
  357. package/dist/redis-B2AS4xAQ.cjs +259 -0
  358. package/dist/redis-B2AS4xAQ.cjs.map +1 -0
  359. package/dist/redis-B362ofBw.d.cts +159 -0
  360. package/dist/redis-CahNAVTW.d.mts +159 -0
  361. package/dist/redis-hdoKymfG.mjs +218 -0
  362. package/dist/redis-hdoKymfG.mjs.map +1 -0
  363. package/dist/roles-7JPrQXZa.mjs +46 -0
  364. package/dist/roles-7JPrQXZa.mjs.map +1 -0
  365. package/dist/roles-B_8QqJ3j.cjs +56 -0
  366. package/dist/roles-B_8QqJ3j.cjs.map +1 -0
  367. package/dist/roles-DLISB4T3.d.mts +41 -0
  368. package/dist/roles-DQbbtUPW.d.cts +41 -0
  369. package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
  370. package/dist/scope-css-BN3jf0ly.cjs +315 -0
  371. package/dist/scope-css-BN3jf0ly.cjs.map +1 -0
  372. package/dist/scope-css-BuJfRCsE.mjs +256 -0
  373. package/dist/scope-css-BuJfRCsE.mjs.map +1 -0
  374. package/dist/scoped-BRoE1W1x.cjs +175 -0
  375. package/dist/scoped-BRoE1W1x.cjs.map +1 -0
  376. package/dist/scoped-cFBbotCh.mjs +164 -0
  377. package/dist/scoped-cFBbotCh.mjs.map +1 -0
  378. package/dist/sqlite-B2g1JJz1.d.cts +47 -0
  379. package/dist/sqlite-BIPIlxfj.d.mts +47 -0
  380. package/dist/sqlite-BntoYaXZ.cjs +79 -0
  381. package/dist/sqlite-BntoYaXZ.cjs.map +1 -0
  382. package/dist/sqlite-DYJDcu7p.mjs +62 -0
  383. package/dist/sqlite-DYJDcu7p.mjs.map +1 -0
  384. package/dist/table-BrioFSra.d.cts +11 -0
  385. package/dist/table-BrioFSra.d.mts +11 -0
  386. package/dist/theme-context-DzZ1otaD.d.cts +270 -0
  387. package/dist/theme-context-J65pythD.d.mts +270 -0
  388. package/dist/ui/styles.css +239 -0
  389. package/dist/util-Dnj5T-yw.mjs +39 -0
  390. package/dist/util-Dnj5T-yw.mjs.map +1 -0
  391. package/dist/util-dAnTK9x-.cjs +74 -0
  392. package/dist/util-dAnTK9x-.cjs.map +1 -0
  393. package/dist/validation-B-atP968.mjs +191 -0
  394. package/dist/validation-B-atP968.mjs.map +1 -0
  395. package/dist/validation-BJifGoB2.d.mts +122 -0
  396. package/dist/validation-DLnzBVJr.cjs +258 -0
  397. package/dist/validation-DLnzBVJr.cjs.map +1 -0
  398. package/dist/validation-tfV2qhbD.d.cts +122 -0
  399. package/package.json +715 -4
  400. package/tsconfig/assets.d.ts +21 -0
  401. package/tsconfig/base.json +21 -0
  402. package/tsconfig/react.json +9 -0
package/dist/bin.cjs ADDED
@@ -0,0 +1,126 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_scope_css = require("./scope-css-BN3jf0ly.cjs");
3
+ let node_fs_promises = require("node:fs/promises");
4
+ //#region src/bin.ts
5
+ /**
6
+ * The `xtandard-kit` command: build-time helpers for the xtandard products.
7
+ *
8
+ * - `scope-embed-css --scope .xtandard-x [--css dist/react.css]`
9
+ * - `fix-elysia2-types [--dir dist/types-elysia2]`
10
+ * - `api-surface <dist-or-pkg-dir> [--out file]` and `api-surface --diff before.json after.json`
11
+ *
12
+ * @module
13
+ */
14
+ const HELP = `xtandard-kit <command> [options]
15
+
16
+ Commands:
17
+ scope-embed-css --scope <.class> [--css <file>]
18
+ Scope the React-embed stylesheet (default dist/react.css) under the wrapper class,
19
+ then fail if any rule still leaks onto the host page.
20
+ fix-elysia2-types [--dir <dir>]
21
+ Rewrite "elysia-v2" specifiers to "elysia" in the Elysia 2 declarations
22
+ (default dist/types-elysia2).
23
+ api-surface <dist-or-pkg-dir> [--out <file>]
24
+ Print (or write) every exports subpath's runtime and declaration names as JSON.
25
+ api-surface --diff <before.json> <after.json>
26
+ Compare two snapshots; exits 1 when anything was removed.
27
+ help
28
+ Show this help.
29
+ `;
30
+ const processIo = {
31
+ out: (t) => void process.stdout.write(t),
32
+ err: (t) => void process.stderr.write(t)
33
+ };
34
+ /** `--name value` → value; flags without a value or missing → undefined. */
35
+ function option(argv, name) {
36
+ const i = argv.indexOf(name);
37
+ if (i === -1) return void 0;
38
+ const value = argv[i + 1];
39
+ return value && !value.startsWith("--") ? value : void 0;
40
+ }
41
+ function positionals(argv, valued) {
42
+ const out = [];
43
+ for (let i = 0; i < argv.length; i++) {
44
+ const a = argv[i];
45
+ if (valued.includes(a)) i++;
46
+ else if (!a.startsWith("--")) out.push(a);
47
+ }
48
+ return out;
49
+ }
50
+ async function scopeEmbedCss(argv, io) {
51
+ const scope = option(argv, "--scope");
52
+ if (!scope) {
53
+ io.err("scope-embed-css: --scope <.class> is required (e.g. --scope .xtandard-flags)\n");
54
+ return 1;
55
+ }
56
+ const css = option(argv, "--css") ?? "dist/react.css";
57
+ const { leaks } = await require_scope_css.scopeCssFile(css, scope);
58
+ if (leaks.length > 0) {
59
+ io.err(`[scope-embed-css] ${leaks.length} unscoped rule(s) leaked:\n${leaks.slice(0, 3).join("\n")}\n`);
60
+ return 1;
61
+ }
62
+ io.out(`[scope-embed-css] scoped ${css} under ${scope}\n`);
63
+ return 0;
64
+ }
65
+ async function fixTypes(argv, io) {
66
+ const n = await require_scope_css.fixElysia2Types({ dir: option(argv, "--dir") ?? "dist/types-elysia2" });
67
+ io.out(`fix-elysia2-types: rewrote elysia-v2 → elysia in ${n} file(s)\n`);
68
+ return 0;
69
+ }
70
+ async function surface(argv, io) {
71
+ if (argv.includes("--diff")) {
72
+ const [before, after] = positionals(argv, ["--out"]);
73
+ if (!before || !after) {
74
+ io.err("api-surface --diff <before.json> <after.json>\n");
75
+ return 1;
76
+ }
77
+ const read = async (f) => JSON.parse(await (0, node_fs_promises.readFile)(f, "utf8"));
78
+ const diff = require_scope_css.diffApiSurface(await read(before), await read(after));
79
+ for (const line of diff.added) io.out(`+ ${line}\n`);
80
+ for (const line of diff.removed) io.err(`- ${line}\n`);
81
+ io.out(`api-surface: ${diff.added.length} added, ${diff.removed.length} removed\n`);
82
+ return diff.removed.length > 0 ? 1 : 0;
83
+ }
84
+ const [dir] = positionals(argv, ["--out"]);
85
+ if (!dir) {
86
+ io.err("api-surface <dist-or-pkg-dir> [--out <file>]\n");
87
+ return 1;
88
+ }
89
+ const snapshot = await require_scope_css.apiSurface(dir);
90
+ const json = `${JSON.stringify(snapshot, null, 2)}\n`;
91
+ const out = option(argv, "--out");
92
+ if (out) {
93
+ await (0, node_fs_promises.writeFile)(out, json);
94
+ io.out(`api-surface: wrote ${Object.keys(snapshot.subpaths).length} subpath(s) to ${out}\n`);
95
+ } else io.out(json);
96
+ const failed = Object.entries(snapshot.subpaths).filter(([, s]) => s.error);
97
+ for (const [subpath, s] of failed) io.err(`! ${subpath}: ${s.error}\n`);
98
+ return 0;
99
+ }
100
+ /** Run the CLI with `argv` (without the node/bin prefix); resolves to the exit code. */
101
+ async function run(argv, io = processIo) {
102
+ const [command, ...rest] = argv;
103
+ try {
104
+ switch (command) {
105
+ case "scope-embed-css": return await scopeEmbedCss(rest, io);
106
+ case "fix-elysia2-types": return await fixTypes(rest, io);
107
+ case "api-surface": return await surface(rest, io);
108
+ case void 0:
109
+ case "help":
110
+ case "--help":
111
+ case "-h":
112
+ io.out(HELP);
113
+ return 0;
114
+ default:
115
+ io.err(`Unknown command "${command}".\n\n${HELP}`);
116
+ return 1;
117
+ }
118
+ } catch (error) {
119
+ io.err(`${command}: ${error instanceof Error ? error.message : String(error)}\n`);
120
+ return 1;
121
+ }
122
+ }
123
+ //#endregion
124
+ exports.run = run;
125
+
126
+ //# sourceMappingURL=bin.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.cjs","names":["scopeCssFile","fixElysia2Types","diffApiSurface","apiSurface"],"sources":["../src/bin.ts"],"sourcesContent":["/**\n * The `xtandard-kit` command: build-time helpers for the xtandard products.\n *\n * - `scope-embed-css --scope .xtandard-x [--css dist/react.css]`\n * - `fix-elysia2-types [--dir dist/types-elysia2]`\n * - `api-surface <dist-or-pkg-dir> [--out file]` and `api-surface --diff before.json after.json`\n *\n * @module\n */\n\nimport { readFile, writeFile } from \"node:fs/promises\";\nimport { apiSurface, diffApiSurface, type ApiSurface } from \"./build/api-surface.ts\";\nimport { fixElysia2Types } from \"./build/fix-elysia2-types.ts\";\nimport { scopeCssFile } from \"./build/scope-css.ts\";\n\nconst HELP = `xtandard-kit <command> [options]\n\nCommands:\n scope-embed-css --scope <.class> [--css <file>]\n Scope the React-embed stylesheet (default dist/react.css) under the wrapper class,\n then fail if any rule still leaks onto the host page.\n fix-elysia2-types [--dir <dir>]\n Rewrite \"elysia-v2\" specifiers to \"elysia\" in the Elysia 2 declarations\n (default dist/types-elysia2).\n api-surface <dist-or-pkg-dir> [--out <file>]\n Print (or write) every exports subpath's runtime and declaration names as JSON.\n api-surface --diff <before.json> <after.json>\n Compare two snapshots; exits 1 when anything was removed.\n help\n Show this help.\n`;\n\n/** Where the CLI writes; injectable for tests. */\nexport interface CliIo {\n out: (text: string) => void;\n err: (text: string) => void;\n}\n\nconst processIo: CliIo = {\n out: (t) => void process.stdout.write(t),\n err: (t) => void process.stderr.write(t),\n};\n\n/** `--name value` → value; flags without a value or missing → undefined. */\nfunction option(argv: string[], name: string): string | undefined {\n const i = argv.indexOf(name);\n if (i === -1) return undefined;\n const value = argv[i + 1];\n return value && !value.startsWith(\"--\") ? value : undefined;\n}\n\nfunction positionals(argv: string[], valued: string[]): string[] {\n const out: string[] = [];\n for (let i = 0; i < argv.length; i++) {\n const a = argv[i]!;\n if (valued.includes(a)) i++;\n else if (!a.startsWith(\"--\")) out.push(a);\n }\n return out;\n}\n\nasync function scopeEmbedCss(argv: string[], io: CliIo): Promise<number> {\n const scope = option(argv, \"--scope\");\n if (!scope) {\n io.err(\"scope-embed-css: --scope <.class> is required (e.g. --scope .xtandard-flags)\\n\");\n return 1;\n }\n const css = option(argv, \"--css\") ?? \"dist/react.css\";\n const { leaks } = await scopeCssFile(css, scope);\n if (leaks.length > 0) {\n io.err(\n `[scope-embed-css] ${leaks.length} unscoped rule(s) leaked:\\n${leaks.slice(0, 3).join(\"\\n\")}\\n`,\n );\n return 1;\n }\n io.out(`[scope-embed-css] scoped ${css} under ${scope}\\n`);\n return 0;\n}\n\nasync function fixTypes(argv: string[], io: CliIo): Promise<number> {\n const dir = option(argv, \"--dir\") ?? \"dist/types-elysia2\";\n const n = await fixElysia2Types({ dir });\n io.out(`fix-elysia2-types: rewrote elysia-v2 → elysia in ${n} file(s)\\n`);\n return 0;\n}\n\nasync function surface(argv: string[], io: CliIo): Promise<number> {\n if (argv.includes(\"--diff\")) {\n const [before, after] = positionals(argv, [\"--out\"]);\n if (!before || !after) {\n io.err(\"api-surface --diff <before.json> <after.json>\\n\");\n return 1;\n }\n const read = async (f: string) => JSON.parse(await readFile(f, \"utf8\")) as ApiSurface;\n const diff = diffApiSurface(await read(before), await read(after));\n for (const line of diff.added) io.out(`+ ${line}\\n`);\n for (const line of diff.removed) io.err(`- ${line}\\n`);\n io.out(`api-surface: ${diff.added.length} added, ${diff.removed.length} removed\\n`);\n return diff.removed.length > 0 ? 1 : 0;\n }\n const [dir] = positionals(argv, [\"--out\"]);\n if (!dir) {\n io.err(\"api-surface <dist-or-pkg-dir> [--out <file>]\\n\");\n return 1;\n }\n const snapshot = await apiSurface(dir);\n const json = `${JSON.stringify(snapshot, null, 2)}\\n`;\n const out = option(argv, \"--out\");\n if (out) {\n await writeFile(out, json);\n io.out(`api-surface: wrote ${Object.keys(snapshot.subpaths).length} subpath(s) to ${out}\\n`);\n } else io.out(json);\n const failed = Object.entries(snapshot.subpaths).filter(([, s]) => s.error);\n for (const [subpath, s] of failed) io.err(`! ${subpath}: ${s.error}\\n`);\n return 0;\n}\n\n/** Run the CLI with `argv` (without the node/bin prefix); resolves to the exit code. */\nexport async function run(argv: string[], io: CliIo = processIo): Promise<number> {\n const [command, ...rest] = argv;\n try {\n switch (command) {\n case \"scope-embed-css\":\n return await scopeEmbedCss(rest, io);\n case \"fix-elysia2-types\":\n return await fixTypes(rest, io);\n case \"api-surface\":\n return await surface(rest, io);\n case undefined:\n case \"help\":\n case \"--help\":\n case \"-h\":\n io.out(HELP);\n return 0;\n default:\n io.err(`Unknown command \"${command}\".\\n\\n${HELP}`);\n return 1;\n }\n } catch (error) {\n io.err(`${command}: ${error instanceof Error ? error.message : String(error)}\\n`);\n return 1;\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAeA,MAAM,OAAO;;;;;;;;;;;;;;;;AAuBb,MAAM,YAAmB;CACvB,MAAM,MAAM,KAAK,QAAQ,OAAO,MA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CAChF,MAAM,CAAC,SAAS,GAAG,QAAQ;CAC3B,IAAI;EACF,QAAQ,SAAR;GACE,KAAK,mBACH,OAAO,MAAM,cAAc,MAAM,EAAE;GACrC,KAAK,qBACH,OAAO,MAAM,SAAS,MAAM,EAAE;GAChC,KAAK,eACH,OAAO,MAAM,QAAQ,MAAM,EAAE;GAC/B,KAAK,KAAA;GACL,KAAK;GACL,KAAK;GACL,KAAK;IACH,GAAG,IAAI,IAAI;IACX,OAAO;GACT;IACE,GAAG,IAAI,oBAAoB,QAAQ,QAAQ,MAAM;IACjD,OAAO;EACX;CACF,SAAS,OAAO;EACd,GAAG,IAAI,GAAG,QAAQ,IAAI,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,EAAE,GAAG;EAChF,OAAO;CACT;AACF"}
package/dist/bin.d.cts ADDED
@@ -0,0 +1,20 @@
1
+ //#region src/bin.d.ts
2
+ /**
3
+ * The `xtandard-kit` command: build-time helpers for the xtandard products.
4
+ *
5
+ * - `scope-embed-css --scope .xtandard-x [--css dist/react.css]`
6
+ * - `fix-elysia2-types [--dir dist/types-elysia2]`
7
+ * - `api-surface <dist-or-pkg-dir> [--out file]` and `api-surface --diff before.json after.json`
8
+ *
9
+ * @module
10
+ */
11
+ /** Where the CLI writes; injectable for tests. */
12
+ interface CliIo {
13
+ out: (text: string) => void;
14
+ err: (text: string) => void;
15
+ }
16
+ /** Run the CLI with `argv` (without the node/bin prefix); resolves to the exit code. */
17
+ declare function run(argv: string[], io?: CliIo): Promise<number>;
18
+ //#endregion
19
+ export { CliIo, run };
20
+ //# sourceMappingURL=bin.d.cts.map
package/dist/bin.d.mts ADDED
@@ -0,0 +1,20 @@
1
+ //#region src/bin.d.ts
2
+ /**
3
+ * The `xtandard-kit` command: build-time helpers for the xtandard products.
4
+ *
5
+ * - `scope-embed-css --scope .xtandard-x [--css dist/react.css]`
6
+ * - `fix-elysia2-types [--dir dist/types-elysia2]`
7
+ * - `api-surface <dist-or-pkg-dir> [--out file]` and `api-surface --diff before.json after.json`
8
+ *
9
+ * @module
10
+ */
11
+ /** Where the CLI writes; injectable for tests. */
12
+ interface CliIo {
13
+ out: (text: string) => void;
14
+ err: (text: string) => void;
15
+ }
16
+ /** Run the CLI with `argv` (without the node/bin prefix); resolves to the exit code. */
17
+ declare function run(argv: string[], io?: CliIo): Promise<number>;
18
+ //#endregion
19
+ export { CliIo, run };
20
+ //# sourceMappingURL=bin.d.mts.map
package/dist/bin.mjs ADDED
@@ -0,0 +1,125 @@
1
+ import { a as fixElysia2Types, c as diffApiSurface, i as scopeCssFile, s as apiSurface } from "./scope-css-BuJfRCsE.mjs";
2
+ import { readFile, writeFile } from "node:fs/promises";
3
+ //#region src/bin.ts
4
+ /**
5
+ * The `xtandard-kit` command: build-time helpers for the xtandard products.
6
+ *
7
+ * - `scope-embed-css --scope .xtandard-x [--css dist/react.css]`
8
+ * - `fix-elysia2-types [--dir dist/types-elysia2]`
9
+ * - `api-surface <dist-or-pkg-dir> [--out file]` and `api-surface --diff before.json after.json`
10
+ *
11
+ * @module
12
+ */
13
+ const HELP = `xtandard-kit <command> [options]
14
+
15
+ Commands:
16
+ scope-embed-css --scope <.class> [--css <file>]
17
+ Scope the React-embed stylesheet (default dist/react.css) under the wrapper class,
18
+ then fail if any rule still leaks onto the host page.
19
+ fix-elysia2-types [--dir <dir>]
20
+ Rewrite "elysia-v2" specifiers to "elysia" in the Elysia 2 declarations
21
+ (default dist/types-elysia2).
22
+ api-surface <dist-or-pkg-dir> [--out <file>]
23
+ Print (or write) every exports subpath's runtime and declaration names as JSON.
24
+ api-surface --diff <before.json> <after.json>
25
+ Compare two snapshots; exits 1 when anything was removed.
26
+ help
27
+ Show this help.
28
+ `;
29
+ const processIo = {
30
+ out: (t) => void process.stdout.write(t),
31
+ err: (t) => void process.stderr.write(t)
32
+ };
33
+ /** `--name value` → value; flags without a value or missing → undefined. */
34
+ function option(argv, name) {
35
+ const i = argv.indexOf(name);
36
+ if (i === -1) return void 0;
37
+ const value = argv[i + 1];
38
+ return value && !value.startsWith("--") ? value : void 0;
39
+ }
40
+ function positionals(argv, valued) {
41
+ const out = [];
42
+ for (let i = 0; i < argv.length; i++) {
43
+ const a = argv[i];
44
+ if (valued.includes(a)) i++;
45
+ else if (!a.startsWith("--")) out.push(a);
46
+ }
47
+ return out;
48
+ }
49
+ async function scopeEmbedCss(argv, io) {
50
+ const scope = option(argv, "--scope");
51
+ if (!scope) {
52
+ io.err("scope-embed-css: --scope <.class> is required (e.g. --scope .xtandard-flags)\n");
53
+ return 1;
54
+ }
55
+ const css = option(argv, "--css") ?? "dist/react.css";
56
+ const { leaks } = await scopeCssFile(css, scope);
57
+ if (leaks.length > 0) {
58
+ io.err(`[scope-embed-css] ${leaks.length} unscoped rule(s) leaked:\n${leaks.slice(0, 3).join("\n")}\n`);
59
+ return 1;
60
+ }
61
+ io.out(`[scope-embed-css] scoped ${css} under ${scope}\n`);
62
+ return 0;
63
+ }
64
+ async function fixTypes(argv, io) {
65
+ const n = await fixElysia2Types({ dir: option(argv, "--dir") ?? "dist/types-elysia2" });
66
+ io.out(`fix-elysia2-types: rewrote elysia-v2 → elysia in ${n} file(s)\n`);
67
+ return 0;
68
+ }
69
+ async function surface(argv, io) {
70
+ if (argv.includes("--diff")) {
71
+ const [before, after] = positionals(argv, ["--out"]);
72
+ if (!before || !after) {
73
+ io.err("api-surface --diff <before.json> <after.json>\n");
74
+ return 1;
75
+ }
76
+ const read = async (f) => JSON.parse(await readFile(f, "utf8"));
77
+ const diff = diffApiSurface(await read(before), await read(after));
78
+ for (const line of diff.added) io.out(`+ ${line}\n`);
79
+ for (const line of diff.removed) io.err(`- ${line}\n`);
80
+ io.out(`api-surface: ${diff.added.length} added, ${diff.removed.length} removed\n`);
81
+ return diff.removed.length > 0 ? 1 : 0;
82
+ }
83
+ const [dir] = positionals(argv, ["--out"]);
84
+ if (!dir) {
85
+ io.err("api-surface <dist-or-pkg-dir> [--out <file>]\n");
86
+ return 1;
87
+ }
88
+ const snapshot = await apiSurface(dir);
89
+ const json = `${JSON.stringify(snapshot, null, 2)}\n`;
90
+ const out = option(argv, "--out");
91
+ if (out) {
92
+ await writeFile(out, json);
93
+ io.out(`api-surface: wrote ${Object.keys(snapshot.subpaths).length} subpath(s) to ${out}\n`);
94
+ } else io.out(json);
95
+ const failed = Object.entries(snapshot.subpaths).filter(([, s]) => s.error);
96
+ for (const [subpath, s] of failed) io.err(`! ${subpath}: ${s.error}\n`);
97
+ return 0;
98
+ }
99
+ /** Run the CLI with `argv` (without the node/bin prefix); resolves to the exit code. */
100
+ async function run(argv, io = processIo) {
101
+ const [command, ...rest] = argv;
102
+ try {
103
+ switch (command) {
104
+ case "scope-embed-css": return await scopeEmbedCss(rest, io);
105
+ case "fix-elysia2-types": return await fixTypes(rest, io);
106
+ case "api-surface": return await surface(rest, io);
107
+ case void 0:
108
+ case "help":
109
+ case "--help":
110
+ case "-h":
111
+ io.out(HELP);
112
+ return 0;
113
+ default:
114
+ io.err(`Unknown command "${command}".\n\n${HELP}`);
115
+ return 1;
116
+ }
117
+ } catch (error) {
118
+ io.err(`${command}: ${error instanceof Error ? error.message : String(error)}\n`);
119
+ return 1;
120
+ }
121
+ }
122
+ //#endregion
123
+ export { run };
124
+
125
+ //# sourceMappingURL=bin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.mjs","names":[],"sources":["../src/bin.ts"],"sourcesContent":["/**\n * The `xtandard-kit` command: build-time helpers for the xtandard products.\n *\n * - `scope-embed-css --scope .xtandard-x [--css dist/react.css]`\n * - `fix-elysia2-types [--dir dist/types-elysia2]`\n * - `api-surface <dist-or-pkg-dir> [--out file]` and `api-surface --diff before.json after.json`\n *\n * @module\n */\n\nimport { readFile, writeFile } from \"node:fs/promises\";\nimport { apiSurface, diffApiSurface, type ApiSurface } from \"./build/api-surface.ts\";\nimport { fixElysia2Types } from \"./build/fix-elysia2-types.ts\";\nimport { scopeCssFile } from \"./build/scope-css.ts\";\n\nconst HELP = `xtandard-kit <command> [options]\n\nCommands:\n scope-embed-css --scope <.class> [--css <file>]\n Scope the React-embed stylesheet (default dist/react.css) under the wrapper class,\n then fail if any rule still leaks onto the host page.\n fix-elysia2-types [--dir <dir>]\n Rewrite \"elysia-v2\" specifiers to \"elysia\" in the Elysia 2 declarations\n (default dist/types-elysia2).\n api-surface <dist-or-pkg-dir> [--out <file>]\n Print (or write) every exports subpath's runtime and declaration names as JSON.\n api-surface --diff <before.json> <after.json>\n Compare two snapshots; exits 1 when anything was removed.\n help\n Show this help.\n`;\n\n/** Where the CLI writes; injectable for tests. */\nexport interface CliIo {\n out: (text: string) => void;\n err: (text: string) => void;\n}\n\nconst processIo: CliIo = {\n out: (t) => void process.stdout.write(t),\n err: (t) => void process.stderr.write(t),\n};\n\n/** `--name value` → value; flags without a value or missing → undefined. */\nfunction option(argv: string[], name: string): string | undefined {\n const i = argv.indexOf(name);\n if (i === -1) return undefined;\n const value = argv[i + 1];\n return value && !value.startsWith(\"--\") ? value : undefined;\n}\n\nfunction positionals(argv: string[], valued: string[]): string[] {\n const out: string[] = [];\n for (let i = 0; i < argv.length; i++) {\n const a = argv[i]!;\n if (valued.includes(a)) i++;\n else if (!a.startsWith(\"--\")) out.push(a);\n }\n return out;\n}\n\nasync function scopeEmbedCss(argv: string[], io: CliIo): Promise<number> {\n const scope = option(argv, \"--scope\");\n if (!scope) {\n io.err(\"scope-embed-css: --scope <.class> is required (e.g. --scope .xtandard-flags)\\n\");\n return 1;\n }\n const css = option(argv, \"--css\") ?? \"dist/react.css\";\n const { leaks } = await scopeCssFile(css, scope);\n if (leaks.length > 0) {\n io.err(\n `[scope-embed-css] ${leaks.length} unscoped rule(s) leaked:\\n${leaks.slice(0, 3).join(\"\\n\")}\\n`,\n );\n return 1;\n }\n io.out(`[scope-embed-css] scoped ${css} under ${scope}\\n`);\n return 0;\n}\n\nasync function fixTypes(argv: string[], io: CliIo): Promise<number> {\n const dir = option(argv, \"--dir\") ?? \"dist/types-elysia2\";\n const n = await fixElysia2Types({ dir });\n io.out(`fix-elysia2-types: rewrote elysia-v2 → elysia in ${n} file(s)\\n`);\n return 0;\n}\n\nasync function surface(argv: string[], io: CliIo): Promise<number> {\n if (argv.includes(\"--diff\")) {\n const [before, after] = positionals(argv, [\"--out\"]);\n if (!before || !after) {\n io.err(\"api-surface --diff <before.json> <after.json>\\n\");\n return 1;\n }\n const read = async (f: string) => JSON.parse(await readFile(f, \"utf8\")) as ApiSurface;\n const diff = diffApiSurface(await read(before), await read(after));\n for (const line of diff.added) io.out(`+ ${line}\\n`);\n for (const line of diff.removed) io.err(`- ${line}\\n`);\n io.out(`api-surface: ${diff.added.length} added, ${diff.removed.length} removed\\n`);\n return diff.removed.length > 0 ? 1 : 0;\n }\n const [dir] = positionals(argv, [\"--out\"]);\n if (!dir) {\n io.err(\"api-surface <dist-or-pkg-dir> [--out <file>]\\n\");\n return 1;\n }\n const snapshot = await apiSurface(dir);\n const json = `${JSON.stringify(snapshot, null, 2)}\\n`;\n const out = option(argv, \"--out\");\n if (out) {\n await writeFile(out, json);\n io.out(`api-surface: wrote ${Object.keys(snapshot.subpaths).length} subpath(s) to ${out}\\n`);\n } else io.out(json);\n const failed = Object.entries(snapshot.subpaths).filter(([, s]) => s.error);\n for (const [subpath, s] of failed) io.err(`! ${subpath}: ${s.error}\\n`);\n return 0;\n}\n\n/** Run the CLI with `argv` (without the node/bin prefix); resolves to the exit code. */\nexport async function run(argv: string[], io: CliIo = processIo): Promise<number> {\n const [command, ...rest] = argv;\n try {\n switch (command) {\n case \"scope-embed-css\":\n return await scopeEmbedCss(rest, io);\n case \"fix-elysia2-types\":\n return await fixTypes(rest, io);\n case \"api-surface\":\n return await surface(rest, io);\n case undefined:\n case \"help\":\n case \"--help\":\n case \"-h\":\n io.out(HELP);\n return 0;\n default:\n io.err(`Unknown command \"${command}\".\\n\\n${HELP}`);\n return 1;\n }\n } catch (error) {\n io.err(`${command}: ${error instanceof Error ? error.message : String(error)}\\n`);\n return 1;\n }\n}\n"],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AAO;AACT;;AAGA,eAAsB,IAAI,MAAgB,KAAY,WAA4B;CAChF,MAAM,CAAC,SAAS,GAAG,QAAQ;CAC3B,IAAI;EACF,QAAQ,SAAR;GACE,KAAK,mBACH,OAAO,MAAM,cAAc,MAAM,EAAE;GACrC,KAAK,qBACH,OAAO,MAAM,SAAS,MAAM,EAAE;GAChC,KAAK,eACH,OAAO,MAAM,QAAQ,MAAM,EAAE;GAC/B,KAAK,KAAA;GACL,KAAK;GACL,KAAK;GACL,KAAK;IACH,GAAG,IAAI,IAAI;IACX,OAAO;GACT;IACE,GAAG,IAAI,oBAAoB,QAAQ,QAAQ,MAAM;IACjD,OAAO;EACX;CACF,SAAS,OAAO;EACd,GAAG,IAAI,GAAG,QAAQ,IAAI,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,EAAE,GAAG;EAChF,OAAO;CACT;AACF"}
@@ -0,0 +1,23 @@
1
+ const require_json = require("./json-CM7TwYQ7.cjs");
2
+ /**
3
+ * Swap a present value (`expected !== null`): the fast path first, then, on a miss, the structural
4
+ * fallback. Resolves `false` as soon as the stored value is absent or structurally different.
5
+ */
6
+ async function swapWithFallback(expected, steps) {
7
+ if (await steps.fast()) return true;
8
+ for (let attempt = 0; attempt < 16; attempt++) {
9
+ const current = await steps.read();
10
+ if (current === null || !require_json.deepEqual(current.value, expected)) return false;
11
+ if (await steps.swapRaw(current.raw)) return true;
12
+ }
13
+ return false;
14
+ }
15
+ //#endregion
16
+ Object.defineProperty(exports, "swapWithFallback", {
17
+ enumerable: true,
18
+ get: function() {
19
+ return swapWithFallback;
20
+ }
21
+ });
22
+
23
+ //# sourceMappingURL=cas-CuPSaXBV.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cas-CuPSaXBV.cjs","names":["deepEqual"],"sources":["../src/storage/cas.ts"],"sourcesContent":["/**\n * The compare-and-swap algorithm shared by drivers whose stored form can predate canonical JSON\n * (ADR 0005): a canonical single-statement fast path, then a structural fallback that reads the\n * stored value, compares it with `deepEqual` and swaps conditionally on the **raw** stored form,\n * with bounded retries. Internal.\n *\n * @module\n */\n\nimport { deepEqual } from \"../internal/json.ts\";\n\n/** How many read → compare → raw-swap rounds the fallback tries before giving up. */\nexport const CAS_RETRIES = 16;\n\n/** The driver-specific steps of {@link swapWithFallback}. */\nexport interface FallbackSteps<Raw> {\n /** The fast path: swap when the stored form equals the canonical form of `expected`. */\n fast(): Promise<boolean>;\n /** Read the stored value as `{ raw, value }`, or `null` when the key is absent. */\n read(): Promise<{ raw: Raw; value: unknown } | null>;\n /** Swap when the stored form still equals `raw` exactly. */\n swapRaw(raw: Raw): Promise<boolean>;\n}\n\n/**\n * Swap a present value (`expected !== null`): the fast path first, then, on a miss, the structural\n * fallback. Resolves `false` as soon as the stored value is absent or structurally different.\n */\nexport async function swapWithFallback<Raw>(\n expected: unknown,\n steps: FallbackSteps<Raw>,\n): Promise<boolean> {\n if (await steps.fast()) return true;\n for (let attempt = 0; attempt < CAS_RETRIES; attempt++) {\n const current = await steps.read();\n if (current === null || !deepEqual(current.value, expected)) return false;\n if (await steps.swapRaw(current.raw)) return true;\n }\n return false;\n}\n"],"mappings":";;;;;AA4BA,eAAsB,iBACpB,UACA,OACkB;CAClB,IAAI,MAAM,MAAM,KAAK,GAAG,OAAO;CAC/B,KAAK,IAAI,UAAU,GAAG,UAAA,IAAuB,WAAW;EACtD,MAAM,UAAU,MAAM,MAAM,KAAK;EACjC,IAAI,YAAY,QAAQ,CAACA,aAAAA,UAAU,QAAQ,OAAO,QAAQ,GAAG,OAAO;EACpE,IAAI,MAAM,MAAM,QAAQ,QAAQ,GAAG,GAAG,OAAO;CAC/C;CACA,OAAO;AACT"}
@@ -0,0 +1,18 @@
1
+ import { i as deepEqual } from "./json-CmM1M5Kz.mjs";
2
+ /**
3
+ * Swap a present value (`expected !== null`): the fast path first, then, on a miss, the structural
4
+ * fallback. Resolves `false` as soon as the stored value is absent or structurally different.
5
+ */
6
+ async function swapWithFallback(expected, steps) {
7
+ if (await steps.fast()) return true;
8
+ for (let attempt = 0; attempt < 16; attempt++) {
9
+ const current = await steps.read();
10
+ if (current === null || !deepEqual(current.value, expected)) return false;
11
+ if (await steps.swapRaw(current.raw)) return true;
12
+ }
13
+ return false;
14
+ }
15
+ //#endregion
16
+ export { swapWithFallback as t };
17
+
18
+ //# sourceMappingURL=cas-CzA-yECx.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cas-CzA-yECx.mjs","names":[],"sources":["../src/storage/cas.ts"],"sourcesContent":["/**\n * The compare-and-swap algorithm shared by drivers whose stored form can predate canonical JSON\n * (ADR 0005): a canonical single-statement fast path, then a structural fallback that reads the\n * stored value, compares it with `deepEqual` and swaps conditionally on the **raw** stored form,\n * with bounded retries. Internal.\n *\n * @module\n */\n\nimport { deepEqual } from \"../internal/json.ts\";\n\n/** How many read → compare → raw-swap rounds the fallback tries before giving up. */\nexport const CAS_RETRIES = 16;\n\n/** The driver-specific steps of {@link swapWithFallback}. */\nexport interface FallbackSteps<Raw> {\n /** The fast path: swap when the stored form equals the canonical form of `expected`. */\n fast(): Promise<boolean>;\n /** Read the stored value as `{ raw, value }`, or `null` when the key is absent. */\n read(): Promise<{ raw: Raw; value: unknown } | null>;\n /** Swap when the stored form still equals `raw` exactly. */\n swapRaw(raw: Raw): Promise<boolean>;\n}\n\n/**\n * Swap a present value (`expected !== null`): the fast path first, then, on a miss, the structural\n * fallback. Resolves `false` as soon as the stored value is absent or structurally different.\n */\nexport async function swapWithFallback<Raw>(\n expected: unknown,\n steps: FallbackSteps<Raw>,\n): Promise<boolean> {\n if (await steps.fast()) return true;\n for (let attempt = 0; attempt < CAS_RETRIES; attempt++) {\n const current = await steps.read();\n if (current === null || !deepEqual(current.value, expected)) return false;\n if (await steps.swapRaw(current.raw)) return true;\n }\n return false;\n}\n"],"mappings":";;;;;AA4BA,eAAsB,iBACpB,UACA,OACkB;CAClB,IAAI,MAAM,MAAM,KAAK,GAAG,OAAO;CAC/B,KAAK,IAAI,UAAU,GAAG,UAAA,IAAuB,WAAW;EACtD,MAAM,UAAU,MAAM,MAAM,KAAK;EACjC,IAAI,YAAY,QAAQ,CAAC,UAAU,QAAQ,OAAO,QAAQ,GAAG,OAAO;EACpE,IAAI,MAAM,MAAM,QAAQ,QAAQ,GAAG,GAAG,OAAO;CAC/C;CACA,OAAO;AACT"}
@@ -0,0 +1,43 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __exportAll = (all, no_symbols) => {
9
+ let target = {};
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: true
13
+ });
14
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
15
+ return target;
16
+ };
17
+ var __copyProps = (to, from, except, desc) => {
18
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
19
+ key = keys[i];
20
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
21
+ get: ((k) => from[k]).bind(null, key),
22
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
23
+ });
24
+ }
25
+ return to;
26
+ };
27
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
+ value: mod,
29
+ enumerable: true
30
+ }) : target, mod));
31
+ //#endregion
32
+ Object.defineProperty(exports, "__exportAll", {
33
+ enumerable: true,
34
+ get: function() {
35
+ return __exportAll;
36
+ }
37
+ });
38
+ Object.defineProperty(exports, "__toESM", {
39
+ enumerable: true,
40
+ get: function() {
41
+ return __toESM;
42
+ }
43
+ });
@@ -0,0 +1,30 @@
1
+ //#region src/auth/contract.d.ts
2
+ /**
3
+ * Authentication contract. Answers: "Who is this request from?"
4
+ *
5
+ * The kit ships `none`/`basic`/`delegated` implementations, but any
6
+ * object satisfying {@link AuthProvider} works — bring your own.
7
+ *
8
+ * @module
9
+ */
10
+ /** An authenticated identity. */
11
+ interface Principal {
12
+ id: string;
13
+ email?: string;
14
+ name?: string;
15
+ roles?: string[];
16
+ metadata?: unknown;
17
+ }
18
+ /** Authenticates an incoming web-standard {@link Request}. */
19
+ interface AuthProvider {
20
+ /** Resolve the principal, or `null` if the request is unauthenticated. */
21
+ authenticate(request: Request): Promise<Principal | null>;
22
+ /**
23
+ * Optional: build a `Response` that prompts for credentials (e.g. a 401 with a
24
+ * `WWW-Authenticate` header). When omitted, the server returns a plain 401.
25
+ */
26
+ challenge?(request: Request): Response | undefined;
27
+ }
28
+ //#endregion
29
+ export { Principal as n, AuthProvider as t };
30
+ //# sourceMappingURL=contract-B3UPXXLx.d.cts.map
@@ -0,0 +1,30 @@
1
+ //#region src/auth/contract.d.ts
2
+ /**
3
+ * Authentication contract. Answers: "Who is this request from?"
4
+ *
5
+ * The kit ships `none`/`basic`/`delegated` implementations, but any
6
+ * object satisfying {@link AuthProvider} works — bring your own.
7
+ *
8
+ * @module
9
+ */
10
+ /** An authenticated identity. */
11
+ interface Principal {
12
+ id: string;
13
+ email?: string;
14
+ name?: string;
15
+ roles?: string[];
16
+ metadata?: unknown;
17
+ }
18
+ /** Authenticates an incoming web-standard {@link Request}. */
19
+ interface AuthProvider {
20
+ /** Resolve the principal, or `null` if the request is unauthenticated. */
21
+ authenticate(request: Request): Promise<Principal | null>;
22
+ /**
23
+ * Optional: build a `Response` that prompts for credentials (e.g. a 401 with a
24
+ * `WWW-Authenticate` header). When omitted, the server returns a plain 401.
25
+ */
26
+ challenge?(request: Request): Response | undefined;
27
+ }
28
+ //#endregion
29
+ export { Principal as n, AuthProvider as t };
30
+ //# sourceMappingURL=contract-B3UPXXLx.d.mts.map
@@ -0,0 +1,64 @@
1
+ import { n as Principal } from "./contract-B3UPXXLx.mjs";
2
+
3
+ //#region src/authorization/contract.d.ts
4
+ /** Input passed to {@link AuthorizationProvider.authorize}. */
5
+ interface AuthorizeInput<Action extends string = string, Resource = unknown> {
6
+ /** The authenticated principal, or `null` for an anonymous request. */
7
+ principal: Principal | null;
8
+ /** The action the request performs (e.g. `"endpoint:write"`). */
9
+ action: Action;
10
+ /** The resource the action targets (a product's discriminated union). */
11
+ resource: Resource;
12
+ /** The incoming request. */
13
+ request: Request;
14
+ }
15
+ /** Decides whether an action is permitted. */
16
+ interface AuthorizationProvider<Action extends string = string, Resource = unknown> {
17
+ authorize(input: AuthorizeInput<Action, Resource>): Promise<boolean>;
18
+ }
19
+ /** Input to {@link defineActions}. */
20
+ interface ActionsDefinition<A extends string> {
21
+ /** Every action, in a stable order (role presets, docs, the UI). */
22
+ all: readonly A[];
23
+ /**
24
+ * Actions that write state. They are blocked when the panel, or the roles
25
+ * provider, is readonly. Leave out actions that must keep working in a
26
+ * readonly panel (e.g. runtime metering).
27
+ */
28
+ mutating: readonly A[];
29
+ /** Actions a scoped (portal / viewer) token may be granted, when the product has such tokens. */
30
+ portal?: readonly A[];
31
+ }
32
+ /** What {@link defineActions} returns. */
33
+ interface ActionsDefinitionResult<A extends string> {
34
+ /** Every action, in the order given. */
35
+ ALL_ACTIONS: readonly A[];
36
+ /** The mutating actions. */
37
+ MUTATING_ACTIONS: ReadonlySet<A>;
38
+ /** True if `action` writes state. */
39
+ isMutatingAction: (action: A) => boolean;
40
+ /** The actions a scoped token may be granted (empty when `portal` is not given). */
41
+ PORTAL_ACTIONS: readonly A[];
42
+ }
43
+ /**
44
+ * Build a product's action constants from its lists. The `const` type
45
+ * parameter keeps the literal union, so a product can derive its action type
46
+ * from the list instead of writing it twice.
47
+ *
48
+ * Throws if `mutating` or `portal` names an action that is not in `all`.
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * import { defineActions } from "@xtandard/kit/authorization";
53
+ *
54
+ * export const { ALL_ACTIONS, MUTATING_ACTIONS, isMutatingAction } = defineActions({
55
+ * all: ["endpoint:read", "endpoint:write", "message:read", "message:send"],
56
+ * mutating: ["endpoint:write", "message:send"],
57
+ * });
58
+ * export type WebhooksAction = (typeof ALL_ACTIONS)[number];
59
+ * ```
60
+ */
61
+ declare function defineActions<const A extends string>(definition: ActionsDefinition<A>): ActionsDefinitionResult<A>;
62
+ //#endregion
63
+ export { defineActions as a, AuthorizeInput as i, ActionsDefinitionResult as n, AuthorizationProvider as r, ActionsDefinition as t };
64
+ //# sourceMappingURL=contract-BDPNvjtp.d.mts.map
@@ -0,0 +1,85 @@
1
+ //#region src/hooks/contract.ts
2
+ /**
3
+ * The hooks runner shared by every product: `before` hooks run before a write
4
+ * commits and may deny it, `after` hooks run once it has committed.
5
+ *
6
+ * - `before` runs **sequentially**. Throw to deny (e.g. {@link HookDeniedError});
7
+ * the first throw aborts the remaining hooks and propagates to the caller.
8
+ * - `after` runs **concurrently**. Errors are isolated and reported through a
9
+ * {@link HookErrorReporter}; they never reach the caller.
10
+ *
11
+ * The event unions are product data: the runner is generic over
12
+ * `Before extends { type: string }` and `After extends { type: string }`.
13
+ *
14
+ * @module
15
+ */
16
+ /** Throw from a `before` hook to deny with a status (default 403). */
17
+ var HookDeniedError = class extends Error {
18
+ /** HTTP status the API layer should respond with. Default `403`. */
19
+ status;
20
+ constructor(message, options) {
21
+ super(message, options?.cause !== void 0 ? { cause: options.cause } : void 0);
22
+ this.name = "HookDeniedError";
23
+ this.status = options?.status ?? 403;
24
+ }
25
+ };
26
+ /** Normalize the `hooks` option into a flat array (empty when unset). */
27
+ function normalizeHooks(input) {
28
+ if (!input) return [];
29
+ return Array.isArray(input) ? [...input] : [input];
30
+ }
31
+ /** Run `before` hooks sequentially; the first throw denies. */
32
+ async function runBefore(hooks, event) {
33
+ for (const hook of hooks) if (hook.before) await hook.before(event);
34
+ }
35
+ /** Run `after` hooks concurrently; errors go to `onError`, never to the caller. */
36
+ async function runAfter(hooks, event, onError) {
37
+ await Promise.all(hooks.map(async (hook) => {
38
+ if (!hook.after) return;
39
+ try {
40
+ await hook.after(event);
41
+ } catch (error) {
42
+ onError(error, event);
43
+ }
44
+ }));
45
+ }
46
+ /**
47
+ * Build an `after`-hook error reporter that warns with `[source]` as the log
48
+ * prefix and never throws. Products pass their package name:
49
+ * `createHookErrorReporter("@xtandard/webhooks")`.
50
+ */
51
+ function createHookErrorReporter(source) {
52
+ return (error, event) => {
53
+ console.warn(`[${source}] after-hook for "${event.type}" threw:`, error);
54
+ };
55
+ }
56
+ /** Default `after`-hook error reporter: warns with the `[@xtandard/kit]` prefix, never throws. */
57
+ const defaultHookErrorReporter = createHookErrorReporter("@xtandard/kit");
58
+ /**
59
+ * True when `error` is an error object whose `name` is `name`. Use it instead
60
+ * of `instanceof` to map domain errors to HTTP statuses: an error class loaded
61
+ * from a separate bundle (another subpath's copy of the class, or another
62
+ * realm) fails `instanceof` but keeps its `name`.
63
+ *
64
+ * @example
65
+ * ```ts
66
+ * if (isNamed(err, "NotFoundError")) return error(404, err.message, { code: "NOT_FOUND" });
67
+ * ```
68
+ */
69
+ function isNamed(error, name) {
70
+ return typeof error === "object" && error !== null && error.name === name;
71
+ }
72
+ /**
73
+ * The status of a hook denial — a {@link HookDeniedError}, or a foreign-bundle
74
+ * copy of it recognised by name (default 403 when it carries no numeric
75
+ * `status`) — or `null` when `error` is not a denial.
76
+ */
77
+ function hookDeniedStatus(error) {
78
+ if (!isNamed(error, "HookDeniedError")) return null;
79
+ const status = error.status;
80
+ return typeof status === "number" ? status : 403;
81
+ }
82
+ //#endregion
83
+ export { isNamed as a, runBefore as c, hookDeniedStatus as i, createHookErrorReporter as n, normalizeHooks as o, defaultHookErrorReporter as r, runAfter as s, HookDeniedError as t };
84
+
85
+ //# sourceMappingURL=contract-BEdfGTPs.mjs.map