@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
@@ -0,0 +1,1060 @@
1
+ import { t as importPeer } from "./peer-CTHMzOdn.mjs";
2
+ import { copyFileSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
3
+ import { dirname, join, posix, resolve } from "node:path";
4
+ import { pathToFileURL } from "node:url";
5
+ //#region src/site/manifest.ts
6
+ /**
7
+ * A docs site's information architecture: which repository Markdown becomes which page, and the
8
+ * sidebar tree. `syncSite` reads it to write `src/content/docs/`, and `defineXtandardSite` reads it
9
+ * to build the sidebar, so a page and its sidebar entry cannot drift.
10
+ *
11
+ * The Markdown in the repository (README.md, docs/*.md) stays the single source of truth: it is what
12
+ * GitHub and npm render. A page is one of:
13
+ *
14
+ * - a whole repository file (`src`);
15
+ * - some H2 sections of one (`src` + `sections`, optionally `intro` for the text above the first H2).
16
+ * Every H2 of a split guide must land on exactly one page;
17
+ * - a page written for the site only (`site`, relative to `site/content/`).
18
+ *
19
+ * A page marked `pending` is a guide that has not landed yet. While its `src` is missing it is left
20
+ * out of the site, and links to it go to GitHub (with a warning) instead of failing the build.
21
+ *
22
+ * Plain Node APIs only: Astro loads this through Vite, and the sync step runs it directly.
23
+ *
24
+ * @module
25
+ */
26
+ /** Whether a sidebar item is a page. */
27
+ const isPage = (i) => "slug" in i;
28
+ /** Whether a sidebar item is a group. */
29
+ const isGroup = (i) => "items" in i;
30
+ function walk(items, out = []) {
31
+ for (const i of items) if (isPage(i)) out.push(i);
32
+ else if (isGroup(i)) walk(i.items, out);
33
+ return out;
34
+ }
35
+ /**
36
+ * Every public entry point of the package at `repoRoot`, in `exports` order. Skips stylesheets,
37
+ * wildcards, JSON and `./package.json`. A subpath maps to `src/entry-<subpath with dashes>.ts` when
38
+ * that file exists, otherwise to `src/<subpath>.ts(x)`; the root maps to `src/index.ts`.
39
+ */
40
+ function apiEntries(repoRoot, packageName, rootModule) {
41
+ const pkg = JSON.parse(readFileSync(join(repoRoot, "package.json"), "utf8"));
42
+ return Object.keys(pkg.exports ?? {}).filter((key) => key !== "./package.json" && !key.includes("*") && !key.endsWith(".css") && !key.endsWith(".json")).map((key) => {
43
+ const sub = key.replace(/^\.\/?/, "");
44
+ const source = (sub === "" ? ["src/index.ts"] : [
45
+ `src/entry-${sub.replaceAll("/", "-")}.ts`,
46
+ `src/${sub}.ts`,
47
+ `src/${sub}.tsx`
48
+ ]).find((f) => existsSync(join(repoRoot, f)));
49
+ if (!source) throw new Error(`site manifest: no source file for the "${key}" export`);
50
+ return {
51
+ name: sub === "" ? rootModule : sub,
52
+ importPath: sub === "" ? packageName : `${packageName}/${sub}`,
53
+ source
54
+ };
55
+ });
56
+ }
57
+ const DEFAULT_ASSETS = [
58
+ "favicon.svg",
59
+ "favicon.ico",
60
+ "apple-touch-icon.png",
61
+ "social.png"
62
+ ];
63
+ /** Resolve a site manifest from the product's options. */
64
+ function defineSiteManifest(options) {
65
+ const env = options.env ?? process.env;
66
+ const repoRoot = options.repoRoot;
67
+ const repoUrl = `https://github.com/${options.repoSlug}`;
68
+ const rootModule = options.rootModule ?? options.packageName.replace(/^@[^/]+\//, "");
69
+ const home = options.home ?? {
70
+ slug: "",
71
+ site: "index.mdx"
72
+ };
73
+ const present = (p) => !p.pending || !p.src || existsSync(join(repoRoot, p.src));
74
+ const prune = (items) => items.flatMap((i) => {
75
+ if (isPage(i)) return present(i) ? [i] : [];
76
+ if (isGroup(i)) {
77
+ const kept = prune(i.items);
78
+ return kept.length ? [{
79
+ ...i,
80
+ items: kept
81
+ }] : [];
82
+ }
83
+ return [i];
84
+ });
85
+ const sidebar = prune(options.sidebar);
86
+ return {
87
+ repoRoot,
88
+ siteDir: options.siteDir ?? join(repoRoot, "site"),
89
+ repoSlug: options.repoSlug,
90
+ repoUrl,
91
+ npmUrl: `https://www.npmjs.com/package/${options.packageName}`,
92
+ packageName: options.packageName,
93
+ rootModule,
94
+ branch: options.branch ?? "main",
95
+ siteOrigin: (env.SITE_ORIGIN || options.origin || "https://me.xantiagoma.com").replace(/^http:\/\//, "https://").replace(/\/+$/, ""),
96
+ siteBase: (env.SITE_BASE || options.base).replace(/\/+$/, ""),
97
+ home,
98
+ sidebar,
99
+ publicAssets: options.publicAssets ?? DEFAULT_ASSETS,
100
+ ignoreDocs: options.ignoreDocs ?? (() => false),
101
+ pages: () => [home, ...walk(sidebar)],
102
+ pendingPages: () => walk(options.sidebar).filter((p) => !present(p)),
103
+ apiEntries: () => apiEntries(repoRoot, options.packageName, rootModule)
104
+ };
105
+ }
106
+ //#endregion
107
+ //#region src/site/sync.ts
108
+ /**
109
+ * The docs site's pre-build step (`site/scripts/sync.ts` in every product): writes
110
+ * `site/src/content/docs/` (generated, gitignored) from the repository's Markdown and the site-only
111
+ * pages in `site/content/`. The repository files stay the single source of truth and keep rendering
112
+ * on GitHub and npm; this step only adapts copies:
113
+ *
114
+ * - the title and description come from the source: the H1 (or the manifest's `title`) becomes
115
+ * `title`, the first paragraph becomes `description`, and "Edit page" opens the source file;
116
+ * - a long guide is split by its H2 sections into several pages (manifest `sections`); every H2
117
+ * must land on exactly one page;
118
+ * - relative links to files that are pages here (`./STORAGE.md#x`, `#anchor` in a split guide)
119
+ * become site routes, pointing at whichever page holds the anchor;
120
+ * - relative links to other repository files (`../src/x.ts`) become GitHub URLs;
121
+ * - a link to a **pending** guide (one that has not landed yet) goes to GitHub, with a warning;
122
+ * - a relative link to any other missing file fails the build;
123
+ * - GitHub alerts (`> [!WARNING]`) become Starlight asides.
124
+ *
125
+ * It also copies the brand files the site serves as-is (favicons, the social card) from
126
+ * `docs/assets/` into `site/public/` (generated, gitignored), so `docs/assets/` stays their only
127
+ * copy. Fenced code blocks and inline code spans are never rewritten.
128
+ *
129
+ * @module
130
+ */
131
+ /**
132
+ * GitHub's heading anchors (github-slugger): lowercase, punctuation and symbols removed, spaces to
133
+ * `-`, repeats suffixed `-1`, `-2`…
134
+ */
135
+ var Slugger = class {
136
+ seen = /* @__PURE__ */ new Map();
137
+ /** The anchor for `text`, unique within this slugger. */
138
+ slug(text) {
139
+ const base = text.toLowerCase().replace(/[^\p{L}\p{M}\p{N}\p{Pc} -]/gu, "").replace(/ /g, "-");
140
+ let slug = base;
141
+ let n = this.seen.get(base) ?? 0;
142
+ while (this.seen.has(slug)) slug = `${base}-${++n}`;
143
+ this.seen.set(base, n);
144
+ this.seen.set(slug, this.seen.get(slug) ?? 0);
145
+ return slug;
146
+ }
147
+ };
148
+ const fence = /^ {0,3}(`{3,}|~{3,})/;
149
+ /** Calls `fn` on each line outside fenced code blocks; code lines are kept as they are. */
150
+ function mapProse(lines, fn) {
151
+ let open = null;
152
+ return lines.map((line) => {
153
+ const f = fence.exec(line);
154
+ if (open) {
155
+ if (f && f[1][0] === open[0] && f[1].length >= open.length && line.trim() === f[1]) open = null;
156
+ return line;
157
+ }
158
+ if (f) {
159
+ open = f[1];
160
+ return line;
161
+ }
162
+ return fn(line);
163
+ });
164
+ }
165
+ /** Indexes of the lines outside fenced code blocks. */
166
+ function proseLines(lines) {
167
+ const prose = [];
168
+ let open = null;
169
+ for (const line of lines) {
170
+ const f = fence.exec(line);
171
+ if (open) {
172
+ prose.push(false);
173
+ if (f && f[1][0] === open[0] && f[1].length >= open.length && line.trim() === f[1]) open = null;
174
+ continue;
175
+ }
176
+ if (f) {
177
+ open = f[1];
178
+ prose.push(false);
179
+ continue;
180
+ }
181
+ prose.push(true);
182
+ }
183
+ return prose;
184
+ }
185
+ /** Plain text of a Markdown inline string (titles, descriptions, heading slugs). */
186
+ const plain = (s) => s.replace(/!\[[^\]]*\]\([^)]*\)/g, "").replace(/\[([^\]]*)\]\([^)]*\)/g, "$1").replace(/<[^>]+>/g, "").replace(/[`*_]/g, "").replace(/\s+/g, " ").trim();
187
+ /**
188
+ * Replaces the inline code spans of a line with placeholders (CommonMark: a run of n backticks
189
+ * opens a span that the next run of exactly n backticks closes; an unmatched run is literal).
190
+ */
191
+ function maskCode(line, spans) {
192
+ const runs = [...line.matchAll(/`+/g)].map((m) => ({
193
+ at: m.index,
194
+ len: m[0].length
195
+ }));
196
+ let out = "";
197
+ let pos = 0;
198
+ for (let i = 0; i < runs.length; i++) {
199
+ const open = runs[i];
200
+ if (open.at < pos) continue;
201
+ const close = runs.findIndex((r, j) => j > i && r.len === open.len);
202
+ if (close < 0) continue;
203
+ const end = runs[close].at + open.len;
204
+ out += `${line.slice(pos, open.at)}\uE000${spans.push(line.slice(open.at, end)) - 1}\uE000`;
205
+ pos = end;
206
+ i = close;
207
+ }
208
+ return out + line.slice(pos);
209
+ }
210
+ const alertKinds = {
211
+ NOTE: "note",
212
+ TIP: "tip",
213
+ IMPORTANT: "note",
214
+ WARNING: "caution",
215
+ CAUTION: "danger"
216
+ };
217
+ /** GitHub alerts (`> [!WARNING]` + quoted lines) → Starlight asides (`:::caution`). */
218
+ function alerts(lines) {
219
+ const out = [];
220
+ for (let i = 0; i < lines.length; i++) {
221
+ const m = /^> \[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]\s*$/.exec(lines[i]);
222
+ if (!m) {
223
+ out.push(lines[i]);
224
+ continue;
225
+ }
226
+ out.push(`:::${alertKinds[m[1]]}`);
227
+ while (i + 1 < lines.length && lines[i + 1].startsWith(">")) out.push(lines[++i].replace(/^> ?/, ""));
228
+ out.push(":::");
229
+ }
230
+ return out;
231
+ }
232
+ /** The first paragraph of prose, as a meta description of at most ~200 characters. */
233
+ function describeMarkdown(lines) {
234
+ const para = [];
235
+ let inFence = false;
236
+ for (const line of lines) {
237
+ if (fence.test(line)) {
238
+ inFence = !inFence;
239
+ if (para.length) break;
240
+ continue;
241
+ }
242
+ if (inFence) continue;
243
+ if (line.trim() === "") {
244
+ if (para.length) break;
245
+ continue;
246
+ }
247
+ if (para.length === 0 && /^\s*([#>|<:]|[-*+] |\d+\. |!\[)/.test(line)) continue;
248
+ if (para.length === 0 && /^\s*([-*_])(\s*\1){2,}\s*$/.test(line)) continue;
249
+ para.push(line);
250
+ }
251
+ let d = plain(para.join(" "));
252
+ if (!d) return void 0;
253
+ if (d.length > 200) d = `${d.slice(0, 200).replace(/\s+\S*$/, "")}…`;
254
+ return d;
255
+ }
256
+ const yaml$1 = (v) => JSON.stringify(v);
257
+ function frontmatter(fields, extra = "") {
258
+ return `---\n${Object.entries(fields).filter(([, v]) => v !== void 0).map(([k, v]) => `${k}: ${typeof v === "string" ? yaml$1(v) : v}`).join("\n")}${extra}\n---\n`;
259
+ }
260
+ const isExternal = (t) => /^[a-z][a-z0-9+.-]*:/i.test(t) || t.startsWith("//");
261
+ function listMarkdown(dir, prefix) {
262
+ if (!existsSync(dir)) return [];
263
+ return readdirSync(dir, { recursive: true }).filter((f) => f.endsWith(".md")).map((f) => `${prefix}/${f.split("\\").join("/")}`).sort();
264
+ }
265
+ /** Write `site/src/content/docs/` and `site/public/` from the manifest. */
266
+ function syncSite(m) {
267
+ const { repoRoot, siteDir, siteBase, repoUrl, repoSlug, branch } = m;
268
+ const outDir = join(siteDir, "src/content/docs");
269
+ const publicDir = join(siteDir, "public");
270
+ const errors = [];
271
+ const warnings = [];
272
+ const fail = (msg) => errors.push(msg);
273
+ const all = m.pages();
274
+ const pending = new Set(m.pendingPages().flatMap((p) => p.src ? [p.src] : []));
275
+ const route = (slug) => slug === "" ? `${siteBase}/` : `${siteBase}/${slug}/`;
276
+ const docs = /* @__PURE__ */ new Map();
277
+ /** Reads a repository Markdown file into its intro block (null heading) and H2 blocks. */
278
+ function loadDoc(src) {
279
+ const cached = docs.get(src);
280
+ if (cached) return cached;
281
+ const path = join(repoRoot, src);
282
+ if (!existsSync(path)) {
283
+ fail(`manifest: ${src} does not exist`);
284
+ return;
285
+ }
286
+ const lines = readFileSync(path, "utf8").replace(/\r\n/g, "\n").split("\n");
287
+ const prose = proseLines(lines);
288
+ const slugger = new Slugger();
289
+ let h1 = -1;
290
+ const blocks = [{
291
+ heading: null,
292
+ start: 0,
293
+ end: lines.length,
294
+ anchors: /* @__PURE__ */ new Set()
295
+ }];
296
+ lines.forEach((line, i) => {
297
+ if (!prose[i]) return;
298
+ const h = /^(#{1,6}) (.+?)\s*#*\s*$/.exec(line);
299
+ if (!h) return;
300
+ if (h[1] === "#" && h1 < 0) h1 = i;
301
+ if (h[1] === "##") {
302
+ blocks.at(-1).end = i;
303
+ blocks.push({
304
+ heading: h[2],
305
+ start: i,
306
+ end: lines.length,
307
+ anchors: /* @__PURE__ */ new Set()
308
+ });
309
+ }
310
+ blocks.at(-1).anchors.add(slugger.slug(plain(h[2])));
311
+ });
312
+ const doc = {
313
+ lines,
314
+ h1,
315
+ title: h1 >= 0 ? plain(lines[h1].slice(2)) : "",
316
+ blocks
317
+ };
318
+ docs.set(src, doc);
319
+ return doc;
320
+ }
321
+ /** Which page (slug) holds each H2 block of each source file. */
322
+ const blockPage = /* @__PURE__ */ new Map();
323
+ /** Whole-file pages: source → slug. */
324
+ const filePage = /* @__PURE__ */ new Map();
325
+ for (const p of all) {
326
+ if (!p.src) continue;
327
+ const doc = loadDoc(p.src);
328
+ if (!doc) continue;
329
+ if (!p.sections) {
330
+ filePage.set(p.src, p.slug);
331
+ continue;
332
+ }
333
+ const owners = blockPage.get(p.src) ?? /* @__PURE__ */ new Map();
334
+ blockPage.set(p.src, owners);
335
+ if (p.intro) owners.set(doc.blocks[0], p.slug);
336
+ for (const name of p.sections) {
337
+ const block = doc.blocks.find((b) => b.heading === name);
338
+ if (!block) fail(`${p.src}: no "## ${name}" section for /${p.slug}/`);
339
+ else if (owners.has(block)) fail(`${p.src}: "## ${name}" is on two pages`);
340
+ else owners.set(block, p.slug);
341
+ }
342
+ }
343
+ for (const [src, owners] of blockPage) {
344
+ if (src === "README.md" || filePage.has(src)) continue;
345
+ const doc = loadDoc(src);
346
+ for (const b of doc.blocks) if (b.heading === null && !owners.has(b) && b.end - b.start > 0) {
347
+ if (doc.lines.slice(b.start, b.end).filter((l, i) => b.start + i !== doc.h1 && l.trim()).length) fail(`${src}: the text above the first H2 is on no page (set intro on one)`);
348
+ } else if (b.heading !== null && !owners.has(b)) fail(`${src}: "## ${b.heading}" is on no page (add it to a page's sections in the manifest)`);
349
+ }
350
+ /** Pages made of one H2 section: their own H2 is dropped, since the title already says it. */
351
+ const dropsH2 = new Set(all.filter((p) => p.sections && !p.intro && p.sections.length === 1).map((p) => p.slug));
352
+ /** The route of `anchor` (without #) in source `src`, or undefined when no page shows it. */
353
+ function anchorRoute(src, anchor) {
354
+ const whole = filePage.get(src);
355
+ if (whole !== void 0) return `${route(whole)}${anchor ? `#${anchor}` : ""}`;
356
+ const owners = blockPage.get(src);
357
+ const doc = docs.get(src);
358
+ if (!owners || !doc) return void 0;
359
+ if (!anchor) {
360
+ const first = doc.blocks.find((b) => owners.has(b));
361
+ return first ? route(owners.get(first)) : void 0;
362
+ }
363
+ for (const [b, slug] of owners) {
364
+ if (!b.anchors.has(anchor)) continue;
365
+ return b.heading !== null && b.anchors.values().next().value === anchor && dropsH2.has(slug) ? route(slug) : `${route(slug)}#${anchor}`;
366
+ }
367
+ }
368
+ /** Rewrites one link target found in `src`. `image` targets get a URL that serves the bytes. */
369
+ function rewrite(target, src, image) {
370
+ if (target === "" || isExternal(target)) return target;
371
+ if (target.startsWith("#")) {
372
+ if (!blockPage.has(src)) return target;
373
+ return anchorRoute(src, target.slice(1)) ?? `${repoUrl}/blob/${branch}/${src}${target}`;
374
+ }
375
+ const parts = /^([^?#]*)(\?[^#]*)?(#.*)?$/.exec(target);
376
+ let path;
377
+ try {
378
+ path = decodeURIComponent(parts[1]);
379
+ } catch {
380
+ fail(`${src}: malformed link ${target}`);
381
+ return target;
382
+ }
383
+ const hash = parts[3] ?? "";
384
+ const resolved = posix.normalize(path.startsWith("/") ? path.slice(1) : posix.join(posix.dirname(src), path)).replace(/\/$/, "");
385
+ if (resolved.startsWith("..")) {
386
+ fail(`${src}: link ${target} leaves the repository`);
387
+ return target;
388
+ }
389
+ const abs = join(repoRoot, resolved === "." ? "" : resolved);
390
+ if (!existsSync(abs)) {
391
+ if (pending.has(resolved)) {
392
+ warnings.push(`${src}: ${target} is a pending guide; linking to GitHub until it lands`);
393
+ return `${repoUrl}/blob/${branch}/${resolved}${parts[2] ?? ""}${hash}`;
394
+ }
395
+ fail(`${src}: broken link ${target} (${resolved} does not exist)`);
396
+ return target;
397
+ }
398
+ if (image) return `https://raw.githubusercontent.com/${repoSlug}/${branch}/${resolved}`;
399
+ const to = anchorRoute(resolved, hash.slice(1));
400
+ if (to) return to;
401
+ return `${repoUrl}/${statSync(abs).isDirectory() ? "tree" : "blob"}/${branch}/${resolved}${parts[2] ?? ""}${hash}`;
402
+ }
403
+ /** Rewrites the link targets on one prose line, leaving inline code spans alone. */
404
+ function rewriteLine(line, src) {
405
+ const spans = [];
406
+ let text = maskCode(line, spans);
407
+ text = text.replace(/(!?)\[((?:[^[\]]|\[[^\]]*\])*)\]\(\s*(<[^>]*>|[^)\s]+)((?:\s+"[^"]*")?\s*)\)/g, (_s, bang, label, t, title) => {
408
+ const out = rewrite(t.startsWith("<") ? t.slice(1, -1) : t, src, bang === "!");
409
+ return `${bang}[${label}](${t.startsWith("<") ? `<${out}>` : out}${title})`;
410
+ });
411
+ text = text.replace(/^( {0,3}\[[^\]]+\]:\s*)(\S+)/, (_s, head, t) => head + rewrite(t, src, false));
412
+ text = text.replace(/\b(href|src)="([^"]*)"/g, (_s, attr, t) => `${attr}="${rewrite(t, src, attr === "src")}"`);
413
+ return text.replace(/\uE000(\d+)\uE000/g, (_s, i) => spans[Number(i)]);
414
+ }
415
+ const internalBanner = `\nbanner:\n content: ${yaml$1("Contributor documentation: how the project is built and released. Not needed to use the library.")}`;
416
+ function fromRepo(p) {
417
+ const src = p.src;
418
+ const doc = loadDoc(src);
419
+ if (!doc) return "";
420
+ let body;
421
+ let title;
422
+ if (p.sections) {
423
+ const owners = blockPage.get(src);
424
+ body = doc.blocks.filter((b) => owners.get(b) === p.slug).flatMap((b) => {
425
+ const lines = doc.lines.slice(b.start, b.end);
426
+ return b.heading === null && doc.h1 >= 0 ? lines.slice(doc.h1 - b.start + 1) : lines;
427
+ });
428
+ title = p.title ?? (p.intro ? doc.title : p.sections[0] ?? "");
429
+ if (!p.intro && p.sections.length === 1) body = body.slice(1);
430
+ } else {
431
+ if (doc.h1 < 0) {
432
+ fail(`${src}: no H1 to take the title from`);
433
+ return "";
434
+ }
435
+ if (doc.lines.slice(0, doc.h1).filter((l) => l.trim() !== "").some((l) => !/^\s*(<|!\[)/.test(l))) fail(`${src}: unexpected text before the H1`);
436
+ title = p.title ?? doc.title;
437
+ body = doc.lines.slice(doc.h1 + 1);
438
+ }
439
+ const description = p.description ?? describeMarkdown(body);
440
+ const text = mapProse(alerts(body), (l) => rewriteLine(l, src)).join("\n");
441
+ return frontmatter({
442
+ title,
443
+ description,
444
+ editUrl: `${repoUrl}/edit/${branch}/${src}`,
445
+ pagefind: p.internal ? false : void 0
446
+ }, p.internal ? internalBanner : "") + text.replace(/^\n+/, "\n");
447
+ }
448
+ function fromSite(p) {
449
+ const path = join(siteDir, "content", p.site);
450
+ if (!existsSync(path)) {
451
+ fail(`manifest: site/content/${p.site} does not exist`);
452
+ return "";
453
+ }
454
+ let text = readFileSync(path, "utf8").replaceAll("@BASE@", siteBase).replaceAll("@REPO@", repoUrl).replaceAll("@NPM@", m.npmUrl);
455
+ if (!/^---\n[\s\S]*?\neditUrl:/.test(text)) text = text.replace(/^---\n/, `---\neditUrl: ${yaml$1(`${repoUrl}/edit/${branch}/site/content/${p.site}`)}\n`);
456
+ const left = /@[A-Z_]+@/.exec(text.replace(/```[\s\S]*?```/g, ""));
457
+ if (left) fail(`site/content/${p.site}: unreplaced ${left[0]}`);
458
+ return text;
459
+ }
460
+ rmSync(publicDir, {
461
+ recursive: true,
462
+ force: true
463
+ });
464
+ mkdirSync(publicDir, { recursive: true });
465
+ for (const f of m.publicAssets) {
466
+ const from = join(repoRoot, "docs/assets", f);
467
+ if (existsSync(from)) copyFileSync(from, join(publicDir, f));
468
+ else fail(`docs/assets/${f} does not exist (the site serves it)`);
469
+ }
470
+ rmSync(outDir, {
471
+ recursive: true,
472
+ force: true
473
+ });
474
+ let written = 0;
475
+ for (const p of all) {
476
+ const text = p.site ? fromSite(p) : fromRepo(p);
477
+ if (!text) continue;
478
+ const ext = p.site?.endsWith(".mdx") ? "mdx" : "md";
479
+ const file = join(outDir, p.slug === "" ? `index.${ext}` : `${p.slug}.${ext}`);
480
+ mkdirSync(dirname(file), { recursive: true });
481
+ writeFileSync(file, text);
482
+ written++;
483
+ }
484
+ const covered = new Set(all.flatMap((p) => p.src ? [p.src] : []));
485
+ for (const f of listMarkdown(join(repoRoot, "docs"), "docs")) if (!covered.has(f) && !pending.has(f) && !m.ignoreDocs(f)) fail(`${f} is not in the site manifest (add it to the sidebar)`);
486
+ return {
487
+ written,
488
+ errors,
489
+ warnings
490
+ };
491
+ }
492
+ /** Run {@link syncSite} and print the outcome; resolves to the exit code (the sync script's). */
493
+ function runSync(m, io = console) {
494
+ const { written, errors, warnings } = syncSite(m);
495
+ for (const w of warnings) io.log(`sync: warning: ${w}`);
496
+ if (errors.length > 0) {
497
+ for (const e of errors) io.error(`sync: ${e}`);
498
+ io.error(`sync: ${errors.length} error(s)`);
499
+ return 1;
500
+ }
501
+ io.log(`sync: ${written} pages in site/src/content/docs (base ${m.siteBase})`);
502
+ return 0;
503
+ }
504
+ //#endregion
505
+ //#region src/site/resolve.ts
506
+ /**
507
+ * Load a docs-site peer from the **site's** install. The site has its own `package.json` and
508
+ * `node_modules`, and the integrations must be the instances Astro and starlight-typedoc use there
509
+ * (one `typedoc`, one `typescript`). Resolving from the kit's own location would find other
510
+ * copies, or none, whenever the kit is not installed inside `site/node_modules`: a hoisted install,
511
+ * or the kit's own site, whose `file:..` dependency is a tree of symlinks into the repo.
512
+ *
513
+ * @module
514
+ */
515
+ const SUBPATH = "@xtandard/kit/site";
516
+ function pickEntry(value) {
517
+ if (value === void 0 || value === null) return void 0;
518
+ if (typeof value === "string") return value;
519
+ if (Array.isArray(value)) {
520
+ for (const v of value) {
521
+ const hit = pickEntry(v);
522
+ if (hit) return hit;
523
+ }
524
+ return;
525
+ }
526
+ for (const key of [
527
+ "import",
528
+ "node",
529
+ "default"
530
+ ]) {
531
+ const hit = pickEntry(value[key]);
532
+ if (hit) return hit;
533
+ }
534
+ }
535
+ /**
536
+ * The ESM entry file of package `name` as installed for `fromDir` (looking in `node_modules` from
537
+ * `fromDir` upwards), or `undefined` when it isn't installed there.
538
+ */
539
+ function resolvePackageEntry(name, fromDir) {
540
+ let dir = fromDir;
541
+ for (;;) {
542
+ const pkgDir = join(dir, "node_modules", name);
543
+ const pkgFile = join(pkgDir, "package.json");
544
+ if (existsSync(pkgFile)) {
545
+ const pkg = JSON.parse(readFileSync(pkgFile, "utf8"));
546
+ const exp = pkg.exports;
547
+ return join(pkgDir, pickEntry(exp && typeof exp === "object" && !Array.isArray(exp) && "." in exp ? exp["."] : exp) ?? pkg.module ?? pkg.main ?? "index.js");
548
+ }
549
+ const parent = dirname(dir);
550
+ if (parent === dir) return void 0;
551
+ dir = parent;
552
+ }
553
+ }
554
+ /**
555
+ * Import package `name` as installed for the site at `siteDir`; when the site doesn't have it,
556
+ * fall back to a plain `import()` from the kit (and a clear "install it" error when that fails).
557
+ */
558
+ async function importFromSite(name, siteDir) {
559
+ const entry = resolvePackageEntry(name, siteDir);
560
+ if (entry) return await import(pathToFileURL(entry).href);
561
+ return importPeer(name, SUBPATH, () => import(
562
+ /* @vite-ignore */
563
+ name
564
+ ));
565
+ }
566
+ //#endregion
567
+ //#region src/site/typedoc-plugin.ts
568
+ /**
569
+ * The TypeDoc plugin for the API reference (passed to starlight-typedoc by `defineXtandardSite`):
570
+ *
571
+ * 1. A function whose return type is annotated with one of the package's own type aliases is
572
+ * documented with that alias (`webhooksElysia(options): WebhooksElysiaPlugin`), as written.
573
+ * TypeDoc otherwise prints the type the checker resolves the alias to — for the Elysia adapters,
574
+ * the plugin's full inferred `Elysia<…, object & object & …>` generics.
575
+ * 2. Each entry point's module is named after its subpath (`storage/redis`, the root module name
576
+ * for `src/index.ts`), whatever its `@module` comment says, so the API routes match `exports`.
577
+ * 3. A symbol several entry points export is documented once (see `apiOwners`); the others get a
578
+ * reference. Those are recorded in `<site>/.astro/api-reexports.json` so `apiOverviews` can list
579
+ * them on each re-exporting module's page.
580
+ *
581
+ * `typedoc` and `typescript` are loaded from the site's own install when the plugin runs (the
582
+ * compiler instance that parsed the program).
583
+ *
584
+ * @module
585
+ */
586
+ /** Where the plugin writes, and `apiOverviews` reads, the re-exports of a site. */
587
+ function reexportsFile(siteDir) {
588
+ return join(siteDir, ".astro/api-reexports.json");
589
+ }
590
+ /** Read the re-exports the plugin recorded for a site (`[]` before the first API build). */
591
+ function readReexports(siteDir) {
592
+ const file = reexportsFile(siteDir);
593
+ return existsSync(file) ? JSON.parse(readFileSync(file, "utf8")) : [];
594
+ }
595
+ /** Import the site's `typedoc` and `typescript` (the instances starlight-typedoc uses). */
596
+ async function loadSiteModules(siteDir) {
597
+ const [typedoc, tsModule] = await Promise.all([importFromSite("typedoc", siteDir), importFromSite("typescript", siteDir)]);
598
+ return {
599
+ typedoc,
600
+ typescript: tsModule.default ?? tsModule
601
+ };
602
+ }
603
+ /**
604
+ * Create the TypeDoc plugin for the site at `siteDir`. Pass the returned function in TypeDoc's
605
+ * `plugin` option (TypeDoc 0.26+ accepts plugin functions and awaits them).
606
+ */
607
+ function createTypedocPlugin(siteDir, options = {}) {
608
+ const moduleNames = new Map(Object.entries(options.moduleNames ?? {}).map(([file, name]) => [resolve(file), name]));
609
+ return async function load(app) {
610
+ const { typedoc, typescript: ts } = options.modules ?? await loadSiteModules(siteDir);
611
+ const { Converter, ReflectionKind } = typedoc;
612
+ /** The generated folder for each member kind (typedoc-plugin-markdown's defaults). */
613
+ const kindDirs = [
614
+ [ReflectionKind.Function, "functions"],
615
+ [ReflectionKind.Class, "classes"],
616
+ [ReflectionKind.Interface, "interfaces"],
617
+ [ReflectionKind.TypeAlias, "type-aliases"],
618
+ [ReflectionKind.Variable, "variables"],
619
+ [ReflectionKind.Enum, "enumerations"],
620
+ [ReflectionKind.Namespace, "namespaces"]
621
+ ];
622
+ app.converter.on(Converter.EVENT_CREATE_SIGNATURE, (context, signature, node) => {
623
+ const typeNode = node && "type" in node ? node.type : void 0;
624
+ if (!typeNode || !ts.isTypeReferenceNode(typeNode)) return;
625
+ let symbol = context.checker.getSymbolAtLocation(typeNode.typeName);
626
+ if (symbol && symbol.flags & ts.SymbolFlags.Alias) symbol = context.checker.getAliasedSymbol(symbol);
627
+ const declaration = symbol?.declarations?.[0];
628
+ if (!declaration || !ts.isTypeAliasDeclaration(declaration) || declaration.getSourceFile().fileName.includes("/node_modules/")) return;
629
+ signature.type = context.converter.convertType(context, typeNode);
630
+ });
631
+ app.converter.on(Converter.EVENT_RESOLVE_BEGIN, (context) => {
632
+ if (moduleNames.size === 0) return;
633
+ for (const module of context.project.getReflectionsByKind(ReflectionKind.Module)) {
634
+ const file = context.getSymbolFromReflection(module)?.declarations?.find((d) => ts.isSourceFile(d))?.getSourceFile().fileName;
635
+ const name = file && moduleNames.get(resolve(file));
636
+ if (name) module.name = name;
637
+ }
638
+ });
639
+ app.converter.on(Converter.EVENT_RESOLVE_END, (context) => {
640
+ const reexports = [];
641
+ for (const ref of context.project.getReflectionsByKind(ReflectionKind.Reference)) {
642
+ const module = ref.parent;
643
+ const target = ref.tryGetTargetReflectionDeep();
644
+ const owner = target?.parent;
645
+ const kind = target && kindDirs.find(([k]) => target.kindOf(k))?.[1];
646
+ if (!module?.kindOf(ReflectionKind.Module) || !owner?.kindOf(ReflectionKind.Module) || !kind) continue;
647
+ reexports.push({
648
+ module: module.name,
649
+ name: ref.name,
650
+ owner: owner.name,
651
+ kind,
652
+ target: target.name
653
+ });
654
+ }
655
+ const file = reexportsFile(siteDir);
656
+ mkdirSync(dirname(file), { recursive: true });
657
+ writeFileSync(file, JSON.stringify(reexports, null, 2));
658
+ });
659
+ };
660
+ }
661
+ //#endregion
662
+ //#region src/site/api-overviews.ts
663
+ /**
664
+ * A Starlight plugin that runs after starlight-typedoc and writes the API reference's overview
665
+ * pages, which the generator does not emit: `/api/` (every entry point, with its import path and
666
+ * description) and `/api/<module>/` (that entry point's members, grouped by kind, with summaries).
667
+ * The description is the `@module` doc comment at the top of each entry file, so it is written once,
668
+ * next to the code. Modules are listed in `package.json` `exports` order (fl's version).
669
+ *
670
+ * @module
671
+ */
672
+ const kinds = [
673
+ ["functions", "Functions"],
674
+ ["classes", "Classes"],
675
+ ["interfaces", "Interfaces"],
676
+ ["type-aliases", "Type aliases"],
677
+ ["variables", "Variables"],
678
+ ["enumerations", "Enumerations"],
679
+ ["namespaces", "Namespaces"]
680
+ ];
681
+ const yaml = (v) => JSON.stringify(v);
682
+ /** A module's leading doc comment, without the `Import from` line and the tags; `{@link}`s become code spans. */
683
+ function moduleDescription(text) {
684
+ const m = /^\/\*\*([\s\S]*?)\*\//.exec(text);
685
+ if (!m) return "";
686
+ return m[1].split("\n").map((l) => l.replace(/^\s*\* ?/, "")).filter((l) => !l.startsWith("Import from ") && !l.startsWith("@")).join("\n").replace(/\{@link(?:code|plain)?\s+([^}|\s]+)\s*(?:\|\s*([^}]*))?\}/g, (_s, target, label) => `\`${label?.trim() || target.replace(/^.*[./]/, "")}\``).trim().replace(/\n{3,}/g, "\n\n");
687
+ }
688
+ /** A generated member page's title and the first prose paragraph after its "Defined in" line. */
689
+ function member(file, route, fallbackName = "") {
690
+ const text = readFileSync(file, "utf8");
691
+ const title = /^title: (.+)$/m.exec(text)?.[1];
692
+ const name = title ? JSON.parse(title) : fallbackName;
693
+ const lines = text.split("\n");
694
+ const at = lines.findIndex((l) => l.startsWith("Defined in:"));
695
+ let summary = "";
696
+ if (at >= 0) {
697
+ const para = [];
698
+ for (const l of lines.slice(at + 1)) {
699
+ if (l.trim() === "") {
700
+ if (para.length) break;
701
+ continue;
702
+ }
703
+ if (/^(#|```|\||:::|>)/.test(l)) break;
704
+ para.push(l.trim());
705
+ }
706
+ summary = para.join(" ");
707
+ }
708
+ return {
709
+ name,
710
+ route,
711
+ summary
712
+ };
713
+ }
714
+ function collect(ctx, apiDir) {
715
+ const { siteBase, packageName } = ctx;
716
+ const modules = [];
717
+ const walk = (dir, name) => {
718
+ const entries = readdirSync(dir, { withFileTypes: true }).filter((e) => e.isDirectory());
719
+ const kindDirs = new Set(kinds.map(([k]) => k));
720
+ if (name && entries.some((e) => kindDirs.has(e.name))) {
721
+ const entry = ctx.entries.find((e) => e.name === name);
722
+ const source = entry?.source ?? "";
723
+ const members = /* @__PURE__ */ new Map();
724
+ for (const [kind] of kinds) {
725
+ const kdir = join(dir, kind);
726
+ if (!existsSync(kdir)) continue;
727
+ const list = readdirSync(kdir, { withFileTypes: true }).map((e) => e.isDirectory() ? existsSync(join(kdir, e.name, "index.md")) ? member(join(kdir, e.name, "index.md"), `${siteBase}/api/${name}/${kind}/${e.name}/`.toLowerCase(), e.name) : void 0 : e.name.endsWith(".md") ? member(join(kdir, e.name), `${siteBase}/api/${name}/${kind}/${e.name.slice(0, -3)}/`.toLowerCase()) : void 0).filter((x) => x !== void 0).sort((a, b) => a.name.localeCompare(b.name));
728
+ if (list.length) members.set(kind, list);
729
+ }
730
+ modules.push({
731
+ name,
732
+ importPath: entry?.importPath ?? `${packageName}/${name}`,
733
+ source,
734
+ description: source ? moduleDescription(readFileSync(join(ctx.repoRoot, source), "utf8")) : "",
735
+ members
736
+ });
737
+ }
738
+ for (const e of entries) if (!kindDirs.has(e.name)) walk(join(dir, e.name), name ? `${name}/${e.name}` : e.name);
739
+ };
740
+ walk(apiDir, "");
741
+ const order = ctx.entries.map((e) => e.name);
742
+ const rank = (m) => order.includes(m.name) ? order.indexOf(m.name) : order.length;
743
+ return modules.sort((a, b) => rank(a) - rank(b) || a.name.localeCompare(b.name));
744
+ }
745
+ const firstSentence = (s) => {
746
+ const flat = s.replace(/\s+/g, " ").trim();
747
+ const m = /^(.+?\.)(\s|$)/.exec(flat);
748
+ return m ? m[1] : flat;
749
+ };
750
+ function modulePage(ctx, m, reexports) {
751
+ const { siteBase, repoUrl, branch } = ctx;
752
+ const out = [
753
+ "---",
754
+ `title: ${yaml(m.importPath)}`,
755
+ `description: ${yaml(firstSentence(m.description) || `API reference for ${m.importPath}.`)}`,
756
+ m.source ? `editUrl: ${yaml(`${repoUrl}/edit/${branch}/${m.source}`)}` : "editUrl: false",
757
+ "next: false",
758
+ "prev: false",
759
+ "---",
760
+ "",
761
+ m.description,
762
+ "",
763
+ "```ts",
764
+ `import { … } from "${m.importPath}";`,
765
+ "```",
766
+ ""
767
+ ];
768
+ const from = new Set(m.source ? [...readFileSync(join(ctx.repoRoot, m.source), "utf8").matchAll(/^export\s[^;]*?\bfrom\s+"\.\/([^"]+)"/gm)].map((x) => `src/${x[1]}`) : []);
769
+ const others = ctx.entries.filter((e) => e.source !== m.source && from.has(e.source));
770
+ if (others.length) out.push(`Also re-exports symbols of ${others.map((e) => `[\`${e.importPath}\`](${siteBase}/api/${e.name}/)`).join(", ")}, documented on those pages.`, "");
771
+ for (const [kind, label] of kinds) {
772
+ const list = m.members.get(kind);
773
+ if (!list) continue;
774
+ out.push(`## ${label}`, "", "| Name | Summary |", "| --- | --- |");
775
+ for (const x of list) out.push(`| [\`${x.name}\`](${x.route}) | ${x.summary.replaceAll("|", "\\|")} |`);
776
+ out.push("");
777
+ }
778
+ const covered = new Set(others.map((e) => e.name));
779
+ const listed = reexports.filter((r) => r.module === m.name && !covered.has(r.owner)).sort((a, b) => a.name.localeCompare(b.name));
780
+ if (listed.length) {
781
+ out.push("## Re-exports", "", "| Name | Documented on |", "| --- | --- |");
782
+ for (const r of listed) {
783
+ const owner = ctx.entries.find((e) => e.name === r.owner)?.importPath ?? r.owner;
784
+ const route = `${siteBase}/api/${r.owner}/${r.kind}/${r.target}/`.toLowerCase();
785
+ const label = r.name === r.target ? `\`${r.name}\`` : `\`${r.name}\` (\`${r.target}\`)`;
786
+ out.push(`| [${label}](${route}) | [\`${owner}\`](${siteBase}/api/${r.owner}/) |`);
787
+ }
788
+ out.push("");
789
+ }
790
+ return out.join("\n");
791
+ }
792
+ function indexPage(ctx, modules) {
793
+ const { siteBase, packageName } = ctx;
794
+ const out = [
795
+ "---",
796
+ "title: \"API reference\"",
797
+ `description: ${yaml(`Every entry point of ${packageName} and its exports, generated from the TypeScript source and its doc comments.`)}`,
798
+ "editUrl: false",
799
+ "next: false",
800
+ "prev: false",
801
+ "---",
802
+ "",
803
+ "Generated from the source by [TypeDoc](https://typedoc.org/), so it always matches the published",
804
+ "types. Each entry point is a separate import; its optional peer dependencies are listed in its",
805
+ ctx.entryPointsSlug ? `description and on [Entry points](${siteBase}/${ctx.entryPointsSlug}/).` : "description.",
806
+ "",
807
+ "| Import | Exports | Description |",
808
+ "| --- | --- | --- |"
809
+ ];
810
+ for (const m of modules) {
811
+ const count = [...m.members.values()].reduce((n, l) => n + l.length, 0);
812
+ out.push(`| [\`${m.importPath}\`](${siteBase}/api/${m.name}/) | ${count} | ${firstSentence(m.description).replaceAll("|", "\\|")} |`);
813
+ }
814
+ out.push("");
815
+ return out.join("\n");
816
+ }
817
+ /** The overview-pages plugin; add it after starlight-typedoc (plugins run in order). */
818
+ function apiOverviews(manifest, options = {}) {
819
+ return {
820
+ name: "xtandard-api-overviews",
821
+ hooks: { "config:setup"({ astroConfig, command, logger }) {
822
+ if (command === "preview") return;
823
+ const apiDir = join(new URL(astroConfig.srcDir).pathname, "content/docs/api");
824
+ if (!existsSync(apiDir)) {
825
+ logger.warn("no generated API reference to index");
826
+ return;
827
+ }
828
+ logger.info(`API overviews: ${writeApiOverviews(manifest, apiDir, options)} modules`);
829
+ } }
830
+ };
831
+ }
832
+ /**
833
+ * Write `index.md` for `/api/` and each `/api/<module>/` under `apiDir` (starlight-typedoc's
834
+ * output). Resolves to the number of modules.
835
+ */
836
+ function writeApiOverviews(manifest, apiDir, options = {}) {
837
+ const ctx = {
838
+ repoRoot: manifest.repoRoot,
839
+ siteBase: manifest.siteBase,
840
+ repoUrl: manifest.repoUrl,
841
+ branch: manifest.branch,
842
+ packageName: manifest.packageName,
843
+ entries: manifest.apiEntries(),
844
+ entryPointsSlug: options.entryPointsSlug ?? (manifest.pages().some((p) => p.slug === "entry-points") ? "entry-points" : false)
845
+ };
846
+ const modules = collect(ctx, apiDir);
847
+ const reexports = readReexports(manifest.siteDir);
848
+ for (const m of modules) writeFileSync(join(apiDir, m.name, "index.md"), modulePage(ctx, m, reexports));
849
+ writeFileSync(join(apiDir, "index.md"), indexPage(ctx, modules));
850
+ rmSync(join(apiDir, "README.md"), { force: true });
851
+ return modules.length;
852
+ }
853
+ //#endregion
854
+ //#region src/site/define-site.ts
855
+ /**
856
+ * `defineXtandardSite` builds a product docs site's Astro config: Starlight over the synced
857
+ * Markdown, the TypeDoc API reference (starlight-typedoc, with the kit's plugin and overview
858
+ * pages), Mermaid diagrams, the links validator, and the family's head tags (favicons, social
859
+ * card, theme colour). Products pass their copy, palette, API owners and dev port.
860
+ *
861
+ * The integrations are optional peers, loaded from the site's own install, so the function is
862
+ * async: `export default await defineXtandardSite({ … })`.
863
+ *
864
+ * @module
865
+ */
866
+ /** The manifest's sidebar as Starlight sidebar entries. */
867
+ function toStarlightSidebar(items) {
868
+ return items.map((i) => {
869
+ if (isPage(i)) return i.label ? {
870
+ slug: i.slug,
871
+ label: i.label
872
+ } : { slug: i.slug };
873
+ if (isGroup(i)) return {
874
+ label: i.label,
875
+ collapsed: i.collapsed,
876
+ items: toStarlightSidebar(i.items)
877
+ };
878
+ return {
879
+ label: i.label,
880
+ link: i.link
881
+ };
882
+ });
883
+ }
884
+ /**
885
+ * The API entry files in documentation order: `apiOwners` first (a symbol exported by several
886
+ * entry points is documented under the first one TypeDoc meets), then the rest alphabetically — a
887
+ * fixed order, since a glob's order differs between file systems. Throws when an owner is not an
888
+ * entry point.
889
+ */
890
+ function orderedEntryPoints(manifest, apiOwners = []) {
891
+ const sources = manifest.apiEntries().map((e) => e.source);
892
+ for (const o of apiOwners) if (!sources.includes(o)) throw new Error(`defineXtandardSite: ${o} is not an entry point`);
893
+ return [...apiOwners, ...sources.filter((f) => !apiOwners.includes(f)).sort()];
894
+ }
895
+ /** Build the site's Astro config. */
896
+ async function defineXtandardSite(options) {
897
+ const m = options.manifest;
898
+ const peers = options.peers ?? {};
899
+ const fromSite = (name) => importFromSite(name, m.siteDir);
900
+ const [starlight, createStarlightTypeDocPlugin, linksValidator] = await Promise.all([
901
+ peers.starlight ?? fromSite("@astrojs/starlight").then((mod) => mod.default),
902
+ peers.createStarlightTypeDocPlugin ?? fromSite("starlight-typedoc").then((mod) => mod.createStarlightTypeDocPlugin),
903
+ peers.linksValidator ?? fromSite("starlight-links-validator").then((mod) => mod.default)
904
+ ]);
905
+ const typedocModules = peers.typedoc ?? await loadSiteModules(m.siteDir);
906
+ const entryPoints = orderedEntryPoints(m, options.apiOwners);
907
+ const title = options.title ?? m.packageName;
908
+ const socialImage = `${m.siteOrigin}${m.siteBase}/social.png`;
909
+ const serves = (asset) => m.publicAssets.includes(asset);
910
+ const logo = options.logo === false ? void 0 : options.logo ?? (existsSync(join(m.repoRoot, "docs/assets/lockup-horizontal-dark.svg")) && existsSync(join(m.repoRoot, "docs/assets/lockup-horizontal-light.svg")) ? {
911
+ dark: "../docs/assets/lockup-horizontal-dark.svg",
912
+ light: "../docs/assets/lockup-horizontal-light.svg"
913
+ } : void 0);
914
+ const brandCss = options.brandCss ?? "./src/styles/brand.css";
915
+ const [apiReference, apiSidebarGroup] = createStarlightTypeDocPlugin();
916
+ const sidebar = toStarlightSidebar(m.sidebar);
917
+ const integrations = [];
918
+ if (options.mermaid !== false) {
919
+ const mermaid = peers.mermaid ?? (await fromSite("astro-mermaid")).default;
920
+ integrations.push(mermaid({
921
+ theme: "neutral",
922
+ autoTheme: true,
923
+ enableLog: false
924
+ }));
925
+ }
926
+ integrations.push(starlight({
927
+ title,
928
+ description: options.description,
929
+ ...logo ? { logo: {
930
+ ...logo,
931
+ alt: title,
932
+ replacesTitle: true
933
+ } } : {},
934
+ ...serves("favicon.svg") ? { favicon: "/favicon.svg" } : {},
935
+ head: [
936
+ ...serves("favicon.ico") ? [{
937
+ tag: "link",
938
+ attrs: {
939
+ rel: "icon",
940
+ href: `${m.siteBase}/favicon.ico`,
941
+ sizes: "16x16 32x32 48x48"
942
+ }
943
+ }] : [],
944
+ ...serves("apple-touch-icon.png") ? [{
945
+ tag: "link",
946
+ attrs: {
947
+ rel: "apple-touch-icon",
948
+ href: `${m.siteBase}/apple-touch-icon.png`
949
+ }
950
+ }] : [],
951
+ {
952
+ tag: "meta",
953
+ attrs: {
954
+ name: "theme-color",
955
+ content: options.themeColor ?? "#0f1215"
956
+ }
957
+ },
958
+ ...serves("social.png") ? [
959
+ {
960
+ property: "og:image",
961
+ content: socialImage
962
+ },
963
+ {
964
+ property: "og:image:width",
965
+ content: "1280"
966
+ },
967
+ {
968
+ property: "og:image:height",
969
+ content: "640"
970
+ },
971
+ {
972
+ property: "og:image:alt",
973
+ content: `${m.packageName} — ${options.tagline}`
974
+ },
975
+ {
976
+ name: "twitter:card",
977
+ content: "summary_large_image"
978
+ },
979
+ {
980
+ name: "twitter:image",
981
+ content: socialImage
982
+ }
983
+ ].map((attrs) => ({
984
+ tag: "meta",
985
+ attrs
986
+ })) : []
987
+ ],
988
+ social: [{
989
+ icon: "github",
990
+ label: "GitHub",
991
+ href: m.repoUrl
992
+ }, {
993
+ icon: "npm",
994
+ label: "npm",
995
+ href: m.npmUrl
996
+ }],
997
+ editLink: { baseUrl: `${m.repoUrl}/edit/${m.branch}/` },
998
+ lastUpdated: false,
999
+ customCss: Array.isArray(brandCss) ? brandCss : [brandCss],
1000
+ tableOfContents: {
1001
+ minHeadingLevel: 2,
1002
+ maxHeadingLevel: 3
1003
+ },
1004
+ sidebar: [
1005
+ ...sidebar.slice(0, -1),
1006
+ apiSidebarGroup,
1007
+ ...sidebar.slice(-1)
1008
+ ],
1009
+ plugins: [
1010
+ apiReference({
1011
+ entryPoints: entryPoints.map((f) => join(m.repoRoot, f)),
1012
+ tsconfig: options.typedocTsconfig ?? "./typedoc.tsconfig.json",
1013
+ output: "api",
1014
+ sidebar: {
1015
+ label: "API reference",
1016
+ collapsed: true
1017
+ },
1018
+ typeDoc: {
1019
+ plugin: ["typedoc-plugin-missing-exports", createTypedocPlugin(m.siteDir, {
1020
+ modules: typedocModules,
1021
+ moduleNames: Object.fromEntries(m.apiEntries().map((e) => [join(m.repoRoot, e.source), e.name]))
1022
+ })],
1023
+ placeInternalsInOwningModule: true,
1024
+ excludePrivate: true,
1025
+ excludeInternal: true,
1026
+ excludeExternals: true,
1027
+ disableGit: true,
1028
+ skipErrorChecking: true,
1029
+ sourceLinkTemplate: `${m.repoUrl}/blob/${m.branch}/src/{path}#L{line}`,
1030
+ useCodeBlocks: true,
1031
+ parametersFormat: "table",
1032
+ interfacePropertiesFormat: "table",
1033
+ classPropertiesFormat: "table",
1034
+ typeDeclarationFormat: "table",
1035
+ enumMembersFormat: "table",
1036
+ ...options.typeDoc
1037
+ }
1038
+ }),
1039
+ apiOverviews(m, { entryPointsSlug: options.entryPointsSlug }),
1040
+ linksValidator({
1041
+ errorOnRelativeLinks: false,
1042
+ errorOnInvalidHashes: true,
1043
+ errorOnLocalLinks: false
1044
+ })
1045
+ ],
1046
+ ...options.starlight
1047
+ }));
1048
+ return {
1049
+ site: m.siteOrigin,
1050
+ base: m.siteBase,
1051
+ trailingSlash: "ignore",
1052
+ telemetry: false,
1053
+ ...options.devPort ? { server: { port: options.devPort } } : {},
1054
+ integrations
1055
+ };
1056
+ }
1057
+ //#endregion
1058
+ export { Slugger, alerts, apiEntries, apiOverviews, createTypedocPlugin, defineSiteManifest, defineXtandardSite, describeMarkdown, importFromSite, isGroup, isPage, loadSiteModules, mapProse, moduleDescription, orderedEntryPoints, plain, readReexports, reexportsFile, resolvePackageEntry, runSync, syncSite, toStarlightSidebar, writeApiOverviews };
1059
+
1060
+ //# sourceMappingURL=entry-site.mjs.map