@lickle/docs 0.0.0-dev.1

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 (407) hide show
  1. package/README.md +3 -0
  2. package/dist/esm/_lib/fs/index.js +20 -0
  3. package/dist/esm/_lib/fs/index.js.map +1 -0
  4. package/dist/esm/_lib/fs/watch.js +30 -0
  5. package/dist/esm/_lib/fs/watch.js.map +1 -0
  6. package/dist/esm/_lib/index.js +9 -0
  7. package/dist/esm/_lib/index.js.map +1 -0
  8. package/dist/esm/_lib/jiti/index.js +16 -0
  9. package/dist/esm/_lib/jiti/index.js.map +1 -0
  10. package/dist/esm/_lib/path/index.js +42 -0
  11. package/dist/esm/_lib/path/index.js.map +1 -0
  12. package/dist/esm/_lib/pkg/index.js +128 -0
  13. package/dist/esm/_lib/pkg/index.js.map +1 -0
  14. package/dist/esm/_lib/repo/index.js +100 -0
  15. package/dist/esm/_lib/repo/index.js.map +1 -0
  16. package/dist/esm/_lib/slug/index.js +23 -0
  17. package/dist/esm/_lib/slug/index.js.map +1 -0
  18. package/dist/esm/_lib/t.js +2 -0
  19. package/dist/esm/_lib/t.js.map +1 -0
  20. package/dist/esm/_lib/tsconfig/index.js +12 -0
  21. package/dist/esm/_lib/tsconfig/index.js.map +1 -0
  22. package/dist/esm/_lib/util/index.js +54 -0
  23. package/dist/esm/_lib/util/index.js.map +1 -0
  24. package/dist/esm/cli/cmd/dev.js +74 -0
  25. package/dist/esm/cli/cmd/dev.js.map +1 -0
  26. package/dist/esm/cli/cmd/index.js +4 -0
  27. package/dist/esm/cli/cmd/index.js.map +1 -0
  28. package/dist/esm/cli/cmd/init.js +74 -0
  29. package/dist/esm/cli/cmd/init.js.map +1 -0
  30. package/dist/esm/cli/cmd/json.js +28 -0
  31. package/dist/esm/cli/cmd/json.js.map +1 -0
  32. package/dist/esm/cli/env.js +5 -0
  33. package/dist/esm/cli/env.js.map +1 -0
  34. package/dist/esm/cli/index.js +13 -0
  35. package/dist/esm/cli/index.js.map +1 -0
  36. package/dist/esm/cli/vite/client/index.jsx +20 -0
  37. package/dist/esm/cli/vite/client/index.jsx.map +1 -0
  38. package/dist/esm/cli/vite/index.js +100 -0
  39. package/dist/esm/cli/vite/index.js.map +1 -0
  40. package/dist/esm/cli.js +5 -0
  41. package/dist/esm/cli.js.map +1 -0
  42. package/dist/esm/config/defaults.js +32 -0
  43. package/dist/esm/config/defaults.js.map +1 -0
  44. package/dist/esm/config/file.js +48 -0
  45. package/dist/esm/config/file.js.map +1 -0
  46. package/dist/esm/config/index.js +7 -0
  47. package/dist/esm/config/index.js.map +1 -0
  48. package/dist/esm/config/load.js +79 -0
  49. package/dist/esm/config/load.js.map +1 -0
  50. package/dist/esm/config/types.js +2 -0
  51. package/dist/esm/config/types.js.map +1 -0
  52. package/dist/esm/core/index.js +3 -0
  53. package/dist/esm/core/index.js.map +1 -0
  54. package/dist/esm/core/project/debug.js +26 -0
  55. package/dist/esm/core/project/debug.js.map +1 -0
  56. package/dist/esm/core/project/index.js +39 -0
  57. package/dist/esm/core/project/index.js.map +1 -0
  58. package/dist/esm/core/project/naming.js +39 -0
  59. package/dist/esm/core/project/naming.js.map +1 -0
  60. package/dist/esm/core/project/routing.js +173 -0
  61. package/dist/esm/core/project/routing.js.map +1 -0
  62. package/dist/esm/core/project/types.js +4 -0
  63. package/dist/esm/core/project/types.js.map +1 -0
  64. package/dist/esm/core/reflect/index.js +10 -0
  65. package/dist/esm/core/reflect/index.js.map +1 -0
  66. package/dist/esm/core/reflect/indexed.js +195 -0
  67. package/dist/esm/core/reflect/indexed.js.map +1 -0
  68. package/dist/esm/core/reflect/resolve.js +157 -0
  69. package/dist/esm/core/reflect/resolve.js.map +1 -0
  70. package/dist/esm/core/reflect/scan.js +787 -0
  71. package/dist/esm/core/reflect/scan.js.map +1 -0
  72. package/dist/esm/core/reflect/state.js +29 -0
  73. package/dist/esm/core/reflect/state.js.map +1 -0
  74. package/dist/esm/core/reflect/types.js +16 -0
  75. package/dist/esm/core/reflect/types.js.map +1 -0
  76. package/dist/esm/core/reflect/walk.js +106 -0
  77. package/dist/esm/core/reflect/walk.js.map +1 -0
  78. package/dist/esm/solidjs/index.js +2 -0
  79. package/dist/esm/solidjs/index.js.map +1 -0
  80. package/dist/esm/solidjs/jsx-runtime.js +2 -0
  81. package/dist/esm/solidjs/jsx-runtime.js.map +1 -0
  82. package/dist/esm/ui/App.jsx +71 -0
  83. package/dist/esm/ui/App.jsx.map +1 -0
  84. package/dist/esm/ui/components/Breadcrumb.jsx +45 -0
  85. package/dist/esm/ui/components/Breadcrumb.jsx.map +1 -0
  86. package/dist/esm/ui/components/Code/index.jsx +89 -0
  87. package/dist/esm/ui/components/Code/index.jsx.map +1 -0
  88. package/dist/esm/ui/components/Comment.jsx +176 -0
  89. package/dist/esm/ui/components/Comment.jsx.map +1 -0
  90. package/dist/esm/ui/components/Declaration.jsx +147 -0
  91. package/dist/esm/ui/components/Declaration.jsx.map +1 -0
  92. package/dist/esm/ui/components/Header.jsx +66 -0
  93. package/dist/esm/ui/components/Header.jsx.map +1 -0
  94. package/dist/esm/ui/components/Layout.jsx +44 -0
  95. package/dist/esm/ui/components/Layout.jsx.map +1 -0
  96. package/dist/esm/ui/components/Link.jsx +34 -0
  97. package/dist/esm/ui/components/Link.jsx.map +1 -0
  98. package/dist/esm/ui/components/LivePreview/Example.jsx +76 -0
  99. package/dist/esm/ui/components/LivePreview/Example.jsx.map +1 -0
  100. package/dist/esm/ui/components/LivePreview/Sandbox.jsx +25 -0
  101. package/dist/esm/ui/components/LivePreview/Sandbox.jsx.map +1 -0
  102. package/dist/esm/ui/components/LivePreview/index.js +4 -0
  103. package/dist/esm/ui/components/LivePreview/index.js.map +1 -0
  104. package/dist/esm/ui/components/LivePreview/transform.js +16 -0
  105. package/dist/esm/ui/components/LivePreview/transform.js.map +1 -0
  106. package/dist/esm/ui/components/Markdown.jsx +14 -0
  107. package/dist/esm/ui/components/Markdown.jsx.map +1 -0
  108. package/dist/esm/ui/components/Page.jsx +121 -0
  109. package/dist/esm/ui/components/Page.jsx.map +1 -0
  110. package/dist/esm/ui/components/References.jsx +32 -0
  111. package/dist/esm/ui/components/References.jsx.map +1 -0
  112. package/dist/esm/ui/components/SearchPalette.jsx +178 -0
  113. package/dist/esm/ui/components/SearchPalette.jsx.map +1 -0
  114. package/dist/esm/ui/components/Sidebar.jsx +63 -0
  115. package/dist/esm/ui/components/Sidebar.jsx.map +1 -0
  116. package/dist/esm/ui/components/Syntax.jsx +10 -0
  117. package/dist/esm/ui/components/Syntax.jsx.map +1 -0
  118. package/dist/esm/ui/components/ThemeToggle.jsx +25 -0
  119. package/dist/esm/ui/components/ThemeToggle.jsx.map +1 -0
  120. package/dist/esm/ui/components/Type.jsx +444 -0
  121. package/dist/esm/ui/components/Type.jsx.map +1 -0
  122. package/dist/esm/ui/components/index.js +16 -0
  123. package/dist/esm/ui/components/index.js.map +1 -0
  124. package/dist/esm/ui/context/components.jsx +30 -0
  125. package/dist/esm/ui/context/components.jsx.map +1 -0
  126. package/dist/esm/ui/context/global.js +15 -0
  127. package/dist/esm/ui/context/global.js.map +1 -0
  128. package/dist/esm/ui/context/index.js +5 -0
  129. package/dist/esm/ui/context/index.js.map +1 -0
  130. package/dist/esm/ui/context/markup/index.jsx +25 -0
  131. package/dist/esm/ui/context/markup/index.jsx.map +1 -0
  132. package/dist/esm/ui/context/markup/markdown.js +34 -0
  133. package/dist/esm/ui/context/markup/markdown.js.map +1 -0
  134. package/dist/esm/ui/context/markup/shiki.js +58 -0
  135. package/dist/esm/ui/context/markup/shiki.js.map +1 -0
  136. package/dist/esm/ui/context/markup/util.js +22 -0
  137. package/dist/esm/ui/context/markup/util.js.map +1 -0
  138. package/dist/esm/ui/context/project/index.jsx +27 -0
  139. package/dist/esm/ui/context/project/index.jsx.map +1 -0
  140. package/dist/esm/ui/context/project/indexed.js +47 -0
  141. package/dist/esm/ui/context/project/indexed.js.map +1 -0
  142. package/dist/esm/ui/context/project/types.js +2 -0
  143. package/dist/esm/ui/context/project/types.js.map +1 -0
  144. package/dist/esm/ui/context/theme.jsx +36 -0
  145. package/dist/esm/ui/context/theme.jsx.map +1 -0
  146. package/dist/esm/ui/hooks/index.js +94 -0
  147. package/dist/esm/ui/hooks/index.js.map +1 -0
  148. package/dist/esm/ui/index.js +5 -0
  149. package/dist/esm/ui/index.js.map +1 -0
  150. package/dist/esm/ui/renderer.jsx +21 -0
  151. package/dist/esm/ui/renderer.jsx.map +1 -0
  152. package/dist/esm/ui/util/comment.js +14 -0
  153. package/dist/esm/ui/util/comment.js.map +1 -0
  154. package/dist/esm/ui/util/kind.js +85 -0
  155. package/dist/esm/ui/util/kind.js.map +1 -0
  156. package/dist/esm/ui/util/markdown.js +66 -0
  157. package/dist/esm/ui/util/markdown.js.map +1 -0
  158. package/dist/esm/ui/util/search.js +75 -0
  159. package/dist/esm/ui/util/search.js.map +1 -0
  160. package/dist/ts/_lib/fs/index.d.ts +6 -0
  161. package/dist/ts/_lib/fs/index.d.ts.map +1 -0
  162. package/dist/ts/_lib/fs/watch.d.ts +14 -0
  163. package/dist/ts/_lib/fs/watch.d.ts.map +1 -0
  164. package/dist/ts/_lib/index.d.ts +10 -0
  165. package/dist/ts/_lib/index.d.ts.map +1 -0
  166. package/dist/ts/_lib/jiti/index.d.ts +2 -0
  167. package/dist/ts/_lib/jiti/index.d.ts.map +1 -0
  168. package/dist/ts/_lib/path/index.d.ts +12 -0
  169. package/dist/ts/_lib/path/index.d.ts.map +1 -0
  170. package/dist/ts/_lib/pkg/index.d.ts +28 -0
  171. package/dist/ts/_lib/pkg/index.d.ts.map +1 -0
  172. package/dist/ts/_lib/repo/index.d.ts +30 -0
  173. package/dist/ts/_lib/repo/index.d.ts.map +1 -0
  174. package/dist/ts/_lib/slug/index.d.ts +4 -0
  175. package/dist/ts/_lib/slug/index.d.ts.map +1 -0
  176. package/dist/ts/_lib/t.d.ts +11 -0
  177. package/dist/ts/_lib/t.d.ts.map +1 -0
  178. package/dist/ts/_lib/tsconfig/index.d.ts +8 -0
  179. package/dist/ts/_lib/tsconfig/index.d.ts.map +1 -0
  180. package/dist/ts/_lib/util/index.d.ts +9 -0
  181. package/dist/ts/_lib/util/index.d.ts.map +1 -0
  182. package/dist/ts/cli/cmd/dev.d.ts +27 -0
  183. package/dist/ts/cli/cmd/dev.d.ts.map +1 -0
  184. package/dist/ts/cli/cmd/index.d.ts +4 -0
  185. package/dist/ts/cli/cmd/index.d.ts.map +1 -0
  186. package/dist/ts/cli/cmd/init.d.ts +14 -0
  187. package/dist/ts/cli/cmd/init.d.ts.map +1 -0
  188. package/dist/ts/cli/cmd/json.d.ts +12 -0
  189. package/dist/ts/cli/cmd/json.d.ts.map +1 -0
  190. package/dist/ts/cli/env.d.ts +2 -0
  191. package/dist/ts/cli/env.d.ts.map +1 -0
  192. package/dist/ts/cli/index.d.ts +78 -0
  193. package/dist/ts/cli/index.d.ts.map +1 -0
  194. package/dist/ts/cli/vite/client/index.d.ts +10 -0
  195. package/dist/ts/cli/vite/client/index.d.ts.map +1 -0
  196. package/dist/ts/cli/vite/index.d.ts +12 -0
  197. package/dist/ts/cli/vite/index.d.ts.map +1 -0
  198. package/dist/ts/cli.d.ts +3 -0
  199. package/dist/ts/cli.d.ts.map +1 -0
  200. package/dist/ts/config/defaults.d.ts +10 -0
  201. package/dist/ts/config/defaults.d.ts.map +1 -0
  202. package/dist/ts/config/file.d.ts +3 -0
  203. package/dist/ts/config/file.d.ts.map +1 -0
  204. package/dist/ts/config/index.d.ts +6 -0
  205. package/dist/ts/config/index.d.ts.map +1 -0
  206. package/dist/ts/config/load.d.ts +36 -0
  207. package/dist/ts/config/load.d.ts.map +1 -0
  208. package/dist/ts/config/types.d.ts +56 -0
  209. package/dist/ts/config/types.d.ts.map +1 -0
  210. package/dist/ts/core/index.d.ts +3 -0
  211. package/dist/ts/core/index.d.ts.map +1 -0
  212. package/dist/ts/core/project/debug.d.ts +3 -0
  213. package/dist/ts/core/project/debug.d.ts.map +1 -0
  214. package/dist/ts/core/project/index.d.ts +17 -0
  215. package/dist/ts/core/project/index.d.ts.map +1 -0
  216. package/dist/ts/core/project/naming.d.ts +23 -0
  217. package/dist/ts/core/project/naming.d.ts.map +1 -0
  218. package/dist/ts/core/project/routing.d.ts +61 -0
  219. package/dist/ts/core/project/routing.d.ts.map +1 -0
  220. package/dist/ts/core/project/types.d.ts +56 -0
  221. package/dist/ts/core/project/types.d.ts.map +1 -0
  222. package/dist/ts/core/reflect/index.d.ts +22 -0
  223. package/dist/ts/core/reflect/index.d.ts.map +1 -0
  224. package/dist/ts/core/reflect/indexed.d.ts +83 -0
  225. package/dist/ts/core/reflect/indexed.d.ts.map +1 -0
  226. package/dist/ts/core/reflect/resolve.d.ts +3 -0
  227. package/dist/ts/core/reflect/resolve.d.ts.map +1 -0
  228. package/dist/ts/core/reflect/scan.d.ts +218 -0
  229. package/dist/ts/core/reflect/scan.d.ts.map +1 -0
  230. package/dist/ts/core/reflect/state.d.ts +44 -0
  231. package/dist/ts/core/reflect/state.d.ts.map +1 -0
  232. package/dist/ts/core/reflect/types.d.ts +289 -0
  233. package/dist/ts/core/reflect/types.d.ts.map +1 -0
  234. package/dist/ts/core/reflect/walk.d.ts +28 -0
  235. package/dist/ts/core/reflect/walk.d.ts.map +1 -0
  236. package/dist/ts/solidjs/index.d.ts +2 -0
  237. package/dist/ts/solidjs/index.d.ts.map +1 -0
  238. package/dist/ts/solidjs/jsx-runtime.d.ts +2 -0
  239. package/dist/ts/solidjs/jsx-runtime.d.ts.map +1 -0
  240. package/dist/ts/ui/App.d.ts +17 -0
  241. package/dist/ts/ui/App.d.ts.map +1 -0
  242. package/dist/ts/ui/components/Breadcrumb.d.ts +4 -0
  243. package/dist/ts/ui/components/Breadcrumb.d.ts.map +1 -0
  244. package/dist/ts/ui/components/Code/index.d.ts +17 -0
  245. package/dist/ts/ui/components/Code/index.d.ts.map +1 -0
  246. package/dist/ts/ui/components/Comment.d.ts +49 -0
  247. package/dist/ts/ui/components/Comment.d.ts.map +1 -0
  248. package/dist/ts/ui/components/Declaration.d.ts +122 -0
  249. package/dist/ts/ui/components/Declaration.d.ts.map +1 -0
  250. package/dist/ts/ui/components/Header.d.ts +5 -0
  251. package/dist/ts/ui/components/Header.d.ts.map +1 -0
  252. package/dist/ts/ui/components/Layout.d.ts +5 -0
  253. package/dist/ts/ui/components/Layout.d.ts.map +1 -0
  254. package/dist/ts/ui/components/Link.d.ts +15 -0
  255. package/dist/ts/ui/components/Link.d.ts.map +1 -0
  256. package/dist/ts/ui/components/LivePreview/Example.d.ts +16 -0
  257. package/dist/ts/ui/components/LivePreview/Example.d.ts.map +1 -0
  258. package/dist/ts/ui/components/LivePreview/Sandbox.d.ts +20 -0
  259. package/dist/ts/ui/components/LivePreview/Sandbox.d.ts.map +1 -0
  260. package/dist/ts/ui/components/LivePreview/index.d.ts +4 -0
  261. package/dist/ts/ui/components/LivePreview/index.d.ts.map +1 -0
  262. package/dist/ts/ui/components/LivePreview/transform.d.ts +19 -0
  263. package/dist/ts/ui/components/LivePreview/transform.d.ts.map +1 -0
  264. package/dist/ts/ui/components/Markdown.d.ts +11 -0
  265. package/dist/ts/ui/components/Markdown.d.ts.map +1 -0
  266. package/dist/ts/ui/components/Page.d.ts +21 -0
  267. package/dist/ts/ui/components/Page.d.ts.map +1 -0
  268. package/dist/ts/ui/components/References.d.ts +2 -0
  269. package/dist/ts/ui/components/References.d.ts.map +1 -0
  270. package/dist/ts/ui/components/SearchPalette.d.ts +5 -0
  271. package/dist/ts/ui/components/SearchPalette.d.ts.map +1 -0
  272. package/dist/ts/ui/components/Sidebar.d.ts +5 -0
  273. package/dist/ts/ui/components/Sidebar.d.ts.map +1 -0
  274. package/dist/ts/ui/components/Syntax.d.ts +15 -0
  275. package/dist/ts/ui/components/Syntax.d.ts.map +1 -0
  276. package/dist/ts/ui/components/ThemeToggle.d.ts +2 -0
  277. package/dist/ts/ui/components/ThemeToggle.d.ts.map +1 -0
  278. package/dist/ts/ui/components/Type.d.ts +82 -0
  279. package/dist/ts/ui/components/Type.d.ts.map +1 -0
  280. package/dist/ts/ui/components/index.d.ts +15 -0
  281. package/dist/ts/ui/components/index.d.ts.map +1 -0
  282. package/dist/ts/ui/context/components.d.ts +124 -0
  283. package/dist/ts/ui/context/components.d.ts.map +1 -0
  284. package/dist/ts/ui/context/global.d.ts +210 -0
  285. package/dist/ts/ui/context/global.d.ts.map +1 -0
  286. package/dist/ts/ui/context/index.d.ts +5 -0
  287. package/dist/ts/ui/context/index.d.ts.map +1 -0
  288. package/dist/ts/ui/context/markup/index.d.ts +20 -0
  289. package/dist/ts/ui/context/markup/index.d.ts.map +1 -0
  290. package/dist/ts/ui/context/markup/markdown.d.ts +4 -0
  291. package/dist/ts/ui/context/markup/markdown.d.ts.map +1 -0
  292. package/dist/ts/ui/context/markup/shiki.d.ts +17 -0
  293. package/dist/ts/ui/context/markup/shiki.d.ts.map +1 -0
  294. package/dist/ts/ui/context/markup/util.d.ts +11 -0
  295. package/dist/ts/ui/context/markup/util.d.ts.map +1 -0
  296. package/dist/ts/ui/context/project/index.d.ts +25 -0
  297. package/dist/ts/ui/context/project/index.d.ts.map +1 -0
  298. package/dist/ts/ui/context/project/indexed.d.ts +4 -0
  299. package/dist/ts/ui/context/project/indexed.d.ts.map +1 -0
  300. package/dist/ts/ui/context/project/types.d.ts +13 -0
  301. package/dist/ts/ui/context/project/types.d.ts.map +1 -0
  302. package/dist/ts/ui/context/theme.d.ts +12 -0
  303. package/dist/ts/ui/context/theme.d.ts.map +1 -0
  304. package/dist/ts/ui/hooks/index.d.ts +29 -0
  305. package/dist/ts/ui/hooks/index.d.ts.map +1 -0
  306. package/dist/ts/ui/index.d.ts +5 -0
  307. package/dist/ts/ui/index.d.ts.map +1 -0
  308. package/dist/ts/ui/renderer.d.ts +200 -0
  309. package/dist/ts/ui/renderer.d.ts.map +1 -0
  310. package/dist/ts/ui/util/comment.d.ts +4 -0
  311. package/dist/ts/ui/util/comment.d.ts.map +1 -0
  312. package/dist/ts/ui/util/kind.d.ts +15 -0
  313. package/dist/ts/ui/util/kind.d.ts.map +1 -0
  314. package/dist/ts/ui/util/markdown.d.ts +8 -0
  315. package/dist/ts/ui/util/markdown.d.ts.map +1 -0
  316. package/dist/ts/ui/util/search.d.ts +20 -0
  317. package/dist/ts/ui/util/search.d.ts.map +1 -0
  318. package/package.json +89 -0
  319. package/src/_lib/fs/index.ts +23 -0
  320. package/src/_lib/fs/watch.ts +40 -0
  321. package/src/_lib/index.ts +9 -0
  322. package/src/_lib/jiti/index.ts +18 -0
  323. package/src/_lib/path/index.ts +44 -0
  324. package/src/_lib/pkg/index.ts +165 -0
  325. package/src/_lib/repo/index.ts +138 -0
  326. package/src/_lib/slug/index.ts +26 -0
  327. package/src/_lib/t.ts +17 -0
  328. package/src/_lib/tsconfig/index.ts +20 -0
  329. package/src/_lib/util/index.ts +53 -0
  330. package/src/cli/cmd/dev.ts +86 -0
  331. package/src/cli/cmd/index.ts +3 -0
  332. package/src/cli/cmd/init.ts +80 -0
  333. package/src/cli/cmd/json.ts +28 -0
  334. package/src/cli/env.ts +6 -0
  335. package/src/cli/index.ts +14 -0
  336. package/src/cli/vite/client/index.html +27 -0
  337. package/src/cli/vite/client/index.tsx +30 -0
  338. package/src/cli/vite/client/public/apple-touch-icon.png +0 -0
  339. package/src/cli/vite/client/public/favicon-96x96.png +0 -0
  340. package/src/cli/vite/client/public/favicon.ico +0 -0
  341. package/src/cli/vite/client/public/favicon.svg +1 -0
  342. package/src/cli/vite/client/public/site.webmanifest +21 -0
  343. package/src/cli/vite/client/public/web-app-manifest-192x192.png +0 -0
  344. package/src/cli/vite/client/public/web-app-manifest-512x512.png +0 -0
  345. package/src/cli/vite/index.ts +115 -0
  346. package/src/cli.ts +6 -0
  347. package/src/config/defaults.ts +36 -0
  348. package/src/config/file.ts +53 -0
  349. package/src/config/index.ts +11 -0
  350. package/src/config/load.ts +95 -0
  351. package/src/config/types.ts +59 -0
  352. package/src/core/index.ts +2 -0
  353. package/src/core/project/debug.ts +30 -0
  354. package/src/core/project/index.ts +58 -0
  355. package/src/core/project/naming.ts +49 -0
  356. package/src/core/project/routing.ts +234 -0
  357. package/src/core/project/types.ts +47 -0
  358. package/src/core/reflect/index.ts +18 -0
  359. package/src/core/reflect/indexed.ts +242 -0
  360. package/src/core/reflect/resolve.ts +159 -0
  361. package/src/core/reflect/scan.ts +816 -0
  362. package/src/core/reflect/state.ts +75 -0
  363. package/src/core/reflect/types.ts +164 -0
  364. package/src/core/reflect/walk.ts +121 -0
  365. package/src/solidjs/index.ts +1 -0
  366. package/src/solidjs/jsx-runtime.ts +1 -0
  367. package/src/ui/App.tsx +115 -0
  368. package/src/ui/components/Breadcrumb.tsx +53 -0
  369. package/src/ui/components/Code/index.tsx +112 -0
  370. package/src/ui/components/Comment.tsx +221 -0
  371. package/src/ui/components/Declaration.tsx +210 -0
  372. package/src/ui/components/Header.tsx +99 -0
  373. package/src/ui/components/Layout.tsx +62 -0
  374. package/src/ui/components/Link.tsx +43 -0
  375. package/src/ui/components/LivePreview/Example.tsx +104 -0
  376. package/src/ui/components/LivePreview/Sandbox.tsx +36 -0
  377. package/src/ui/components/LivePreview/index.ts +3 -0
  378. package/src/ui/components/LivePreview/transform.ts +28 -0
  379. package/src/ui/components/Markdown.tsx +16 -0
  380. package/src/ui/components/Page.tsx +162 -0
  381. package/src/ui/components/References.tsx +34 -0
  382. package/src/ui/components/SearchPalette.tsx +266 -0
  383. package/src/ui/components/Sidebar.tsx +107 -0
  384. package/src/ui/components/Syntax.tsx +10 -0
  385. package/src/ui/components/ThemeToggle.tsx +50 -0
  386. package/src/ui/components/Type.tsx +583 -0
  387. package/src/ui/components/index.ts +15 -0
  388. package/src/ui/context/components.tsx +103 -0
  389. package/src/ui/context/global.ts +33 -0
  390. package/src/ui/context/index.ts +4 -0
  391. package/src/ui/context/markup/index.tsx +39 -0
  392. package/src/ui/context/markup/markdown.ts +37 -0
  393. package/src/ui/context/markup/shiki.ts +72 -0
  394. package/src/ui/context/markup/util.ts +20 -0
  395. package/src/ui/context/project/index.tsx +47 -0
  396. package/src/ui/context/project/indexed.ts +52 -0
  397. package/src/ui/context/project/types.ts +14 -0
  398. package/src/ui/context/theme.tsx +45 -0
  399. package/src/ui/hooks/index.ts +116 -0
  400. package/src/ui/index.ts +4 -0
  401. package/src/ui/renderer.tsx +31 -0
  402. package/src/ui/util/comment.ts +12 -0
  403. package/src/ui/util/kind.ts +120 -0
  404. package/src/ui/util/markdown.ts +74 -0
  405. package/src/ui/util/search.ts +84 -0
  406. package/theme.css +301 -0
  407. package/tsconfig.client.json +12 -0
@@ -0,0 +1,234 @@
1
+ import type { RouteNode, PageType } from './types.ts'
2
+ import * as reflect from '../reflect/index.ts'
3
+ import * as config from '../../config/load.ts'
4
+ import * as naming from './naming.ts'
5
+
6
+ type Page = 'declaration' | 'module'
7
+
8
+ export type Options = {
9
+ rootName: string
10
+ entrypoints?: config.Entry[]
11
+ /** Override how routes are named / grouped / shown. Defaults to {@link createRouteProvider}. */
12
+ provider?: RouteProvider
13
+ /**
14
+ * `'exposed'` (default) routes only the public API reachable through exports.
15
+ * `'full'` routes every scanned declaration, grouped under its own module —
16
+ * including internal, non-exported ones.
17
+ */
18
+ mode?: 'exposed' | 'full'
19
+ /** Slugs already taken by routes built elsewhere (e.g. a README home page). */
20
+ reserved?: Iterable<string>
21
+ }
22
+
23
+ // ----------------------------------------------------------------------------
24
+ // Provider abstraction
25
+ // ----------------------------------------------------------------------------
26
+
27
+ /** Everything a provider needs to decide a single route, computed top-down. */
28
+ export type RouteContext = {
29
+ /** The declaration this route points at. */
30
+ decl: reflect.Declaration
31
+ /** Exposure alias on this path (set by renames / `export * as`). */
32
+ alias?: string
33
+ /** Resolved parts of the parent route; `undefined` at an entry module. */
34
+ parent?: naming.Parts
35
+ /** The reflect index, for providers that need to inspect the graph. */
36
+ index: reflect.Index
37
+ /** Naming options (project name, entry aliases, common dir). */
38
+ options: naming.NameOptions
39
+ }
40
+
41
+ /**
42
+ * Customisation seam for the route tree. The traversal, de-duplication and
43
+ * page wiring stay in {@link buildRoutes}; a provider only decides per-route
44
+ * presentation. Build one with {@link createRouteProvider} and override the
45
+ * parts you care about.
46
+ */
47
+ export interface RouteProvider {
48
+ /** Label, slug and qualified name for the route. */
49
+ name(cx: RouteContext): naming.Parts
50
+ /** Whether the route appears in navigation (the sidebar). */
51
+ nav(cx: RouteContext): boolean
52
+ /** Optional group heading rendered above the route in navigation. */
53
+ group(cx: RouteContext): string | undefined
54
+ }
55
+
56
+ /** Default naming: entry modules from their path/alias, everything else nested under its parent. */
57
+ const defaultName = (cx: RouteContext): naming.Parts =>
58
+ cx.parent === undefined
59
+ ? naming.rootParts(cx.decl as reflect.Declaration<'module'>, cx.options)
60
+ : naming.childParts(cx.alias ?? cx.decl.name, cx.parent)
61
+
62
+ /**
63
+ * Compose a provider from optional overrides; unset hooks fall back to the
64
+ * stock behaviour (path-derived names, everything navigable, no groups).
65
+ */
66
+ export const createRouteProvider = (overrides: Partial<RouteProvider> = {}): RouteProvider => ({
67
+ name: overrides.name ?? defaultName,
68
+ nav: overrides.nav ?? (() => true),
69
+ group: overrides.group ?? (() => undefined),
70
+ })
71
+
72
+ // ----------------------------------------------------------------------------
73
+ // Build
74
+ // ----------------------------------------------------------------------------
75
+
76
+ /**
77
+ * Build the navigation tree from the reflect index. The shape mirrors the
78
+ * exposure graph (`index.exposed`) rather than the raw declaration tree, so
79
+ * `export * from`, `export * as ns`, renames and namespaces are already
80
+ * resolved. Each declaration is routed once — the first exposure path wins —
81
+ * which keeps slugs unique and avoids duplicate pages.
82
+ */
83
+ export const buildRoutes = (index: reflect.Index, opts: Options): RouteNode<Page>[] => {
84
+ const options: naming.NameOptions = {
85
+ rootName: opts.rootName,
86
+ aliases: new Map((opts.entrypoints ?? []).map((e) => [e.path, e.as.replace(/^\.\//, '')])),
87
+ commonDir: index.commonDir(),
88
+ }
89
+ const provider = opts.provider ?? createRouteProvider()
90
+ const full = opts.mode === 'full'
91
+ const seen = new Set<number>()
92
+
93
+ // Keep slugs unique across the whole tree (and any reserved/README slugs).
94
+ // The empty root slug falls back to `index` so a README can own `/`.
95
+ const usedSlugs = new Set<string>(opts.reserved ?? [])
96
+ const uniqueSlug = (slug: string): string => {
97
+ if (!usedSlugs.has(slug)) return (usedSlugs.add(slug), slug)
98
+ const base = slug || 'index'
99
+ let next = base
100
+ for (let n = 2; usedSlugs.has(next); n++) next = `${base}-${n}`
101
+ return (usedSlugs.add(next), next)
102
+ }
103
+
104
+ // Children of a route: the exposure graph in `exposed` mode, the raw
105
+ // declaration tree (minus re-export clauses) in `full` mode.
106
+ const childrenOf = (id: number): Iterable<{ id: number; alias?: string }> => {
107
+ if (!full) return index.exposed(id)
108
+ const out: { id: number }[] = []
109
+ for (const c of index.children(id)) if (c.kind !== 'export') out.push({ id: c.id })
110
+ return out
111
+ }
112
+
113
+ // Canonical parts for every routed declaration, so a page re-exposed
114
+ // elsewhere can link back to where it actually lives. Seeded with the roots
115
+ // up front (below) so a root re-exported by another resolves to its own slug.
116
+ const routed = new Map<number, naming.Parts>()
117
+
118
+ const nameOf = (id: number, parent?: naming.Parts, alias?: string): naming.Parts => {
119
+ const named = provider.name({ decl: index.get(id)!, alias, parent, index, options })
120
+ return { ...named, slug: uniqueSlug(named.slug) }
121
+ }
122
+
123
+ const makePage = (id: number, parts: naming.Parts): PageType<Page> => ({
124
+ kind: index.get(id)!.kind === 'module' ? 'module' : 'declaration',
125
+ id,
126
+ alias: parts.label,
127
+ qualified: parts.qualified,
128
+ referencedIn: [...index.referencedIn(id)],
129
+ })
130
+
131
+ // A page already owned by another route, surfaced here as a link only: it
132
+ // shows in the parent's child list but stays out of the sidebar and carries
133
+ // no subtree, so clicking it lands on the canonical route.
134
+ const linkNode = (
135
+ id: number,
136
+ parent: naming.Parts,
137
+ alias: string | undefined,
138
+ canon: naming.Parts,
139
+ ): RouteNode<Page> => {
140
+ const cx: RouteContext = { decl: index.get(id)!, alias, parent, index, options }
141
+ const group = provider.group(cx)
142
+ return {
143
+ label: provider.name(cx).label,
144
+ slug: canon.slug,
145
+ page: makePage(id, canon),
146
+ children: [],
147
+ sidebar: false,
148
+ ...(group ? { group } : {}),
149
+ }
150
+ }
151
+
152
+ const buildRoute = (id: number, parent?: naming.Parts, alias?: string): RouteNode<Page> => {
153
+ const decl = index.get(id)!
154
+ const cx: RouteContext = { decl, alias, parent, index, options }
155
+ const parts = routed.get(id) ?? nameOf(id, parent, alias)
156
+ routed.set(id, parts)
157
+
158
+ seen.add(id)
159
+ const children: RouteNode<Page>[] = []
160
+ for (const e of childrenOf(id)) {
161
+ if (e.id === id) continue
162
+ if (seen.has(e.id)) {
163
+ const canon = routed.get(e.id)
164
+ if (canon) children.push(linkNode(e.id, parts, e.alias, canon))
165
+ continue
166
+ }
167
+ children.push(buildRoute(e.id, parts, e.alias))
168
+ }
169
+
170
+ const group = provider.group(cx)
171
+ return {
172
+ label: parts.label,
173
+ slug: parts.slug,
174
+ page: makePage(id, parts),
175
+ children,
176
+ sidebar: provider.nav(cx),
177
+ ...(group ? { group } : {}),
178
+ }
179
+ }
180
+
181
+ // `full` lists every module; `exposed` only the entrypoints. Name (and slug-
182
+ // reserve) every root up front so one re-exported by another stays top-level
183
+ // and re-exposures resolve to its canonical slug.
184
+ const roots = full ? [...index.declarations()].filter((d) => d.kind === 'module') : [...index.roots()]
185
+ for (const r of roots) (seen.add(r.id), routed.set(r.id, nameOf(r.id)))
186
+
187
+ // Build a root *after* any entrypoint modules it re-exports, so a declaration
188
+ // reachable both directly (a barrel `export *`) and through its own module is
189
+ // owned by the module — the barrel only links to it. Display order is kept as
190
+ // the config order regardless.
191
+ const built = new Map<number, RouteNode<Page>>()
192
+ for (const id of buildOrder(roots, index)) built.set(id, buildRoute(id))
193
+ return roots.map((root) => built.get(root.id)!)
194
+ }
195
+
196
+ /**
197
+ * Roots topologically sorted so an entrypoint module is built before any other
198
+ * root that re-exports its declarations (a barrel `export *`). That way each
199
+ * declaration is owned by the module that defines it, and the barrel only links.
200
+ */
201
+ const buildOrder = (roots: reflect.Declaration[], index: reflect.Index): number[] => {
202
+ const rootIds = new Set(roots.map((r) => r.id))
203
+
204
+ // The entrypoint module a declaration is defined in (walk to its module ancestor).
205
+ const moduleOf = (id: number): number | undefined => {
206
+ let d = index.get(id)
207
+ while (d && d.kind !== 'module') d = index.get(d.parent)
208
+ return d?.id
209
+ }
210
+
211
+ // Roots whose declarations `rootId` re-exposes from elsewhere.
212
+ const deps = (rootId: number): Iterable<number> => {
213
+ const out = new Set<number>()
214
+ for (const e of index.exposed(rootId)) {
215
+ const m = moduleOf(e.id)
216
+ if (m !== undefined && m !== rootId && rootIds.has(m)) out.add(m)
217
+ }
218
+ return out
219
+ }
220
+
221
+ const order: number[] = []
222
+ const placed = new Set<number>()
223
+ const stack = new Set<number>()
224
+ const visit = (id: number): void => {
225
+ if (placed.has(id) || stack.has(id)) return
226
+ stack.add(id)
227
+ for (const dep of deps(id)) visit(dep)
228
+ stack.delete(id)
229
+ placed.add(id)
230
+ order.push(id)
231
+ }
232
+ for (const r of roots) visit(r.id)
233
+ return order
234
+ }
@@ -0,0 +1,47 @@
1
+ import { type t } from '../../_lib/index.ts'
2
+
3
+ import * as reflect from '../reflect/index.ts'
4
+ import * as config from '../../config/load.ts'
5
+
6
+ /** Description of the project persisted to json used to generate the site */
7
+ export interface ProjectJson {
8
+ /** The name of the project. */
9
+ name: string
10
+ /** The version of the project. */
11
+ version?: string
12
+ /** Repository information */
13
+ repository?: config.Repo
14
+ /** Links for the project. */
15
+ links: config.Link[]
16
+ /** Entrypoints — relative source paths reachable from `main` / `exports`. */
17
+ entrypoints: config.Entry[]
18
+ /** Routes of the project. */
19
+ routes: RouteNode[]
20
+ /** Flat list of every declaration in the project, source order. */
21
+ declarations: reflect.Declaration[]
22
+ }
23
+
24
+ /** Used to generate navigation, for now all declarations are pages */
25
+ export type BaseRoute<P> = {
26
+ /** Label used in the navigation */
27
+ label: string
28
+ /** Slug of the page, used in the URL */
29
+ slug: string
30
+ /** Page type to display */
31
+ page: P
32
+ /** sub pages */
33
+ children: BaseRoute<P>[]
34
+ /** Whether the page should be displayed in the navigation */
35
+ sidebar: boolean
36
+ /** Adds a label above in navigation*/
37
+ group?: string
38
+ }
39
+
40
+ type PageTypeMap = t.MapKind<{
41
+ markdown: { content: string }
42
+ module: { id: number; alias?: string; qualified: string; referencedIn: number[] }
43
+ declaration: { id: number; alias?: string; qualified: string; referencedIn: number[] }
44
+ }>
45
+
46
+ export type PageType<K extends keyof PageTypeMap = keyof PageTypeMap> = PageTypeMap[K]
47
+ export type RouteNode<K extends keyof PageTypeMap = keyof PageTypeMap> = BaseRoute<PageType<K>>
@@ -0,0 +1,18 @@
1
+ import type { ScanOptions } from './state.ts'
2
+
3
+ import * as indexed from './indexed.ts'
4
+ import { resolve } from './resolve.ts'
5
+ import { scan } from './scan.ts'
6
+
7
+ export type { ScanOptions } from './state.ts'
8
+ export { type Index } from './indexed.ts'
9
+ export type * from './types.ts'
10
+
11
+ export const generate = (rootFiles: { as: string; path: string }[], options: ScanOptions) => {
12
+ const s = scan(
13
+ rootFiles.map((r) => r.path),
14
+ options,
15
+ )
16
+ const r = resolve(s)
17
+ return indexed.create(r, rootFiles)
18
+ }
@@ -0,0 +1,242 @@
1
+ import { path, type t } from '../../_lib/index.ts'
2
+ import type { ScanState } from './state.ts'
3
+ import * as T from './types.ts'
4
+
5
+ export const create = (s: ScanState, entries: { as: string; path: string }[]) =>
6
+ index(s, [roots(entries), treeIndex, referenceIndex, exposerIndex])
7
+
8
+ export type Index = Roots & TreeIndex & ReferenceIndex & ExposerIndex
9
+
10
+ /** */
11
+ export type Roots = {
12
+ roots(): Iterable<T.Declaration<'module'>>
13
+ commonDir: () => string
14
+ modules: () => T.Declaration<'module'>[]
15
+ }
16
+ export const roots =
17
+ (entries: { as: string; path: string }[]): Indexer<Roots> =>
18
+ (b): Roots => {
19
+ const roots = new Map<string, T.Declaration<'module'>>()
20
+ const modules: T.Declaration<'module'>[] = []
21
+ const byPath = new Map<string, number>()
22
+ let commonDir = ''
23
+ b.init((d) => {
24
+ if (d.kind === 'module' && d.path) {
25
+ modules.push(d)
26
+ byPath.set(d.path, d.id)
27
+ for (const entry of entries) {
28
+ if (d.path === entry.path) {
29
+ roots.set(entry.as, d)
30
+ break
31
+ }
32
+ }
33
+ }
34
+ })
35
+ b.after(() => {
36
+ commonDir = path.common(Array.from(byPath.keys()))
37
+ })
38
+ return { roots: () => roots.values(), commonDir: () => commonDir, modules: () => modules }
39
+ }
40
+
41
+ export type TreeIndex = {
42
+ get: (id: number) => T.Declaration | undefined
43
+ children: (id: number) => Iterable<T.Declaration>
44
+ declarations: () => Iterable<T.Declaration>
45
+ }
46
+ export const treeIndex: Indexer<TreeIndex> = (s): TreeIndex => {
47
+ const byId = new Map<number, T.Declaration>()
48
+ const byParent = new Map<number, Set<number>>()
49
+ s.init((d) => {
50
+ byId.set(d.id, d)
51
+ const parent = d.parent
52
+ let children = byParent.get(parent)
53
+ if (!children) byParent.set(parent, (children = new Set()))
54
+ children.add(d.id)
55
+ })
56
+ const EMPTY = new Set<number>()
57
+ return {
58
+ get: (id) => byId.get(id),
59
+ *children(id) {
60
+ for (const child of byParent.get(id) ?? EMPTY) yield byId.get(child)!
61
+ },
62
+ declarations: () => byId.values(),
63
+ }
64
+ }
65
+
66
+ /** */
67
+ export type ReferenceIndex = { referencedIn: (id: number) => Iterable<number> }
68
+ export const referenceIndex: Indexer<ReferenceIndex> = (s): ReferenceIndex => {
69
+ const referencedIn = new Map<number, Set<number>>()
70
+ for (const ref of s.references) {
71
+ if (ref.type === 'internal') {
72
+ let refs = referencedIn.get(ref.targetId)
73
+ if (!refs) referencedIn.set(ref.targetId, (refs = new Set()))
74
+ refs.add(ref.owner)
75
+ }
76
+ }
77
+ const EMPTY = new Set<number>()
78
+ return { referencedIn: (id) => referencedIn.get(id) ?? EMPTY }
79
+ }
80
+
81
+ /** Depends on Roots + TreeIndex. */
82
+ export type Exposure = { exposer: number; alias?: string }
83
+ export type Exposed = { id: number; alias?: string }
84
+ export type ExposedModule =
85
+ | { id: number; kind: 'star' }
86
+ | { id: number; kind: 'namespace'; alias: string }
87
+ | { id: number; kind: 'named'; names: {}[] }
88
+
89
+ export type ExposerIndex = {
90
+ exposedBy: (id: number) => Iterable<Exposure>
91
+ exposes: (id: number) => Iterable<Exposed>
92
+ /** Declarations exposed directly (one level) by `exposer`, in exposure order. */
93
+ exposed: (exposer: number) => Iterable<Exposed>
94
+ /**
95
+ * Exposed modules / namespaces. With no argument, every one (deduped by id);
96
+ * with an exposer id, only those exposed directly by that module/namespace.
97
+ */
98
+ exposedModules: (exposer?: number) => Iterable<ExposedModule>
99
+ }
100
+ export const exposerIndex: Indexer<ExposerIndex, Roots & TreeIndex> = (b, deps) => {
101
+ const exposedBy = new Map<number, Exposure[]>()
102
+ const direct = new Map<number, Exposed[]>()
103
+ const exposedModules = new Map<number, ExposedModule>()
104
+ const modulesByExposer = new Map<number, Map<number, ExposedModule>>()
105
+
106
+ const setModule = (exposer: number, m: ExposedModule): void => {
107
+ exposedModules.set(m.id, m)
108
+ let g = modulesByExposer.get(exposer)
109
+ if (!g) modulesByExposer.set(exposer, (g = new Map()))
110
+ g.set(m.id, m)
111
+ }
112
+
113
+ // Records id under exposer/alias. Returns whether this (exposer → id) edge
114
+ // is new — used to stop infinite recursion on cycles, NOT to globally
115
+ // dedup, since the same id can be exposed by many exposers.
116
+ const seenEdge = new Set<string>()
117
+ const record = (id: number, exposer: number, alias?: string): boolean => {
118
+ const edge = exposer + ':' + id
119
+ if (seenEdge.has(edge)) return false
120
+ seenEdge.add(edge)
121
+
122
+ let by = exposedBy.get(id)
123
+ if (!by) exposedBy.set(id, (by = []))
124
+ by.push({ exposer, alias })
125
+
126
+ let list = direct.get(exposer)
127
+ if (!list) direct.set(exposer, (list = []))
128
+ list.push({ id, alias })
129
+ return true
130
+ }
131
+
132
+ // Public members of a module / namespace: exported declarations plus the
133
+ // `export …` statements themselves (which carry re-exports). Internal,
134
+ // non-exported helpers are left out of the exposure graph.
135
+ const members = function* (id: number): Iterable<T.Declaration> {
136
+ for (const child of deps.children(id)) if (child.exported) yield child
137
+ }
138
+
139
+ const expose = (id: number, exposer: number, alias?: string): void => {
140
+ const d = deps.get(id)
141
+ if (!d) return
142
+ if (d.kind === 'export') {
143
+ for (const name of d.names) {
144
+ if (d.star && name.name) {
145
+ const target = deps.get(name.ref)
146
+ if (target?.kind === 'module' || target?.kind === 'namespace') {
147
+ setModule(exposer, { id: name.ref, kind: 'namespace', alias: name.name })
148
+ }
149
+ if (record(name.ref, exposer, name.name)) {
150
+ for (const child of members(name.ref)) expose(child.id, name.ref)
151
+ }
152
+ } else if (d.star) {
153
+ if (deps.get(name.ref)?.kind === 'module') setModule(exposer, { id: name.ref, kind: 'star' })
154
+ for (const child of members(name.ref)) expose(child.id, exposer)
155
+ } else {
156
+ if (deps.get(name.ref)?.kind === 'module') addNamed(exposer, name.ref, name.name)
157
+ expose(name.ref, exposer, name.name)
158
+ }
159
+ }
160
+ return
161
+ }
162
+ if (d.kind === 'namespace') {
163
+ setModule(exposer, { id, kind: 'namespace', alias: alias ?? d.name })
164
+ if (record(id, exposer, alias ?? d.name)) {
165
+ for (const child of members(id)) expose(child.id, id)
166
+ }
167
+ return
168
+ }
169
+ // A re-exported module (`export * as ns from './m'`) nests its members.
170
+ if (d.kind === 'module') {
171
+ if (record(id, exposer, alias ?? d.name)) {
172
+ for (const child of members(id)) expose(child.id, id)
173
+ }
174
+ return
175
+ }
176
+ record(id, exposer, alias ?? d.name)
177
+ }
178
+
179
+ // A module pulled in by a plain `export { … }` accumulates its named members.
180
+ const addNamed = (exposer: number, id: number, name: string): void => {
181
+ const m = exposedModules.get(id)
182
+ if (m?.kind === 'named') {
183
+ m.names.push({ name })
184
+ setModule(exposer, m)
185
+ } else {
186
+ setModule(exposer, { id, kind: 'named', names: [{ name }] })
187
+ }
188
+ }
189
+
190
+ b.after(() => {
191
+ for (const root of deps.roots()) {
192
+ for (const child of members(root.id)) expose(child.id, root.id)
193
+ }
194
+ })
195
+
196
+ const EMPTY_BY: Exposure[] = []
197
+ const EMPTY_EXP: Exposed[] = []
198
+ const exposes = function* (id: number): Iterable<Exposed> {
199
+ for (const e of direct.get(id) ?? EMPTY_EXP) {
200
+ yield e
201
+ yield* exposes(e.id)
202
+ }
203
+ }
204
+ const EMPTY_MODULES = new Map<number, ExposedModule>()
205
+ return {
206
+ exposedBy: (id) => exposedBy.get(id) ?? EMPTY_BY,
207
+ exposes: (id) => exposes(id),
208
+ exposed: (id) => direct.get(id) ?? EMPTY_EXP,
209
+ exposedModules: (exposer) =>
210
+ exposer === undefined ? exposedModules.values() : (modulesByExposer.get(exposer) ?? EMPTY_MODULES).values(),
211
+ }
212
+ }
213
+
214
+ // -------------------------------------------
215
+ // -- Little abstraction ----------------
216
+ // -------------------------------------------
217
+ interface IndexBuilder {
218
+ references: T.Type<'reference'>[]
219
+
220
+ init: (cb: (d: T.Declaration) => void) => void
221
+ after: (cb: () => void) => void
222
+ }
223
+
224
+ // An indexer declares its dependencies (Deps) and produces an output (Out).
225
+ type Indexer<Out extends {} = {}, Deps extends {} = {}> = (b: IndexBuilder, deps: Deps) => Out
226
+
227
+ export const index = <const T extends Indexer<any, any>[]>(
228
+ s: ScanState,
229
+ indexers: T,
230
+ ): t.Compute<t.UnionToIntersection<ReturnType<T[number]>>> => {
231
+ const inits: ((d: T.Declaration) => void)[] = []
232
+ const afters: (() => void)[] = []
233
+ const builder: IndexBuilder = { ...s, init: (cb) => inits.push(cb), after: (cb) => afters.push(cb) }
234
+
235
+ // `acc` accumulates results and is passed as `deps` to each subsequent indexer.
236
+ const acc = {} as any
237
+ for (const indexer of indexers) Object.assign(acc, indexer(builder, acc))
238
+ for (const d of s.declarations) for (const init of inits) init(d)
239
+ for (const after of afters) after()
240
+
241
+ return acc
242
+ }