@wrikka/create-docs 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 (380) hide show
  1. package/README.md +137 -0
  2. package/bin/cli.js +408 -0
  3. package/dist/index.cjs +20 -0
  4. package/dist/index.d.cts +475 -0
  5. package/dist/index.d.ts +475 -0
  6. package/dist/index.js +20 -0
  7. package/docs/_dir.yml +2 -0
  8. package/docs/config.md +75 -0
  9. package/docs/data-sources.md +88 -0
  10. package/docs/deploy.md +38 -0
  11. package/docs/features.md +51 -0
  12. package/docs/getting-started.md +42 -0
  13. package/docs/index.md +34 -0
  14. package/docs/markdown.md +154 -0
  15. package/docs/theming.md +53 -0
  16. package/package.json +142 -0
  17. package/scripts/generate-docs-index.ts +111 -0
  18. package/scripts/github-pull.ts +124 -0
  19. package/src/adapters/config/index.ts +1 -0
  20. package/src/adapters/config/node-config-loader.ts +36 -0
  21. package/src/adapters/fs/fs-docs-loader.ts +31 -0
  22. package/src/adapters/fs/index.ts +12 -0
  23. package/src/adapters/fs/memory-fs.ts +60 -0
  24. package/src/adapters/fs/node-fs.ts +116 -0
  25. package/src/adapters/git/index.ts +164 -0
  26. package/src/adapters/github/github-pull.ts +340 -0
  27. package/src/adapters/index.ts +6 -0
  28. package/src/adapters/velite.ts +112 -0
  29. package/src/adapters/vite/docs-watcher.ts +36 -0
  30. package/src/adapters/vite/index.ts +2 -0
  31. package/src/adapters/vite/polling-watcher.ts +89 -0
  32. package/src/code-block-enhancements/index.ts +3 -0
  33. package/src/config/index.ts +15 -0
  34. package/src/content/index.ts +11 -0
  35. package/src/content-validation/index.ts +5 -0
  36. package/src/index.ts +174 -0
  37. package/src/live-editor/index.ts +7 -0
  38. package/src/modules/analytics/application/plausible-adapter.ts +103 -0
  39. package/src/modules/analytics/application/umami-adapter.ts +109 -0
  40. package/src/modules/analytics/domain/events/index.ts +37 -0
  41. package/src/modules/analytics/domain/models/index.ts +35 -0
  42. package/src/modules/analytics/domain/operations/analytics-operations.ts +67 -0
  43. package/src/modules/analytics/domain/validators/index.ts +50 -0
  44. package/src/modules/analytics/index.ts +9 -0
  45. package/src/modules/analytics/ports/analytics-port.ts +17 -0
  46. package/src/modules/analytics/types/analytics.ts +16 -0
  47. package/src/modules/api-docs/application/type-docs-adapter.ts +34 -0
  48. package/src/modules/api-docs/domain/events/index.ts +42 -0
  49. package/src/modules/api-docs/domain/models/index.ts +40 -0
  50. package/src/modules/api-docs/domain/operations/api-docs-operations.ts +59 -0
  51. package/src/modules/api-docs/domain/validators/index.ts +56 -0
  52. package/src/modules/api-docs/index.ts +8 -0
  53. package/src/modules/api-docs/ports/api-docs-port.ts +21 -0
  54. package/src/modules/api-docs/types/api-docs.ts +15 -0
  55. package/src/modules/api-reference/openapi.ts +166 -0
  56. package/src/modules/api-reference/orpc.ts +94 -0
  57. package/src/modules/code-block-enhancements/application/usecases/index.ts +39 -0
  58. package/src/modules/code-block-enhancements/domain/code-operations.ts +72 -0
  59. package/src/modules/code-block-enhancements/domain/events/index.ts +58 -0
  60. package/src/modules/code-block-enhancements/domain/index.ts +11 -0
  61. package/src/modules/code-block-enhancements/domain/models/index.ts +36 -0
  62. package/src/modules/code-block-enhancements/domain/validators/index.ts +50 -0
  63. package/src/modules/code-block-enhancements/index.ts +10 -0
  64. package/src/modules/code-block-enhancements/ports/index.ts +18 -0
  65. package/src/modules/code-block-enhancements/types/index.ts +37 -0
  66. package/src/modules/code-execution/application/sandbox-adapter.ts +44 -0
  67. package/src/modules/code-execution/domain/events/index.ts +58 -0
  68. package/src/modules/code-execution/domain/models/index.ts +33 -0
  69. package/src/modules/code-execution/domain/operations/execution-operations.ts +60 -0
  70. package/src/modules/code-execution/domain/validators/index.ts +50 -0
  71. package/src/modules/code-execution/index.ts +8 -0
  72. package/src/modules/code-execution/ports/execution-port.ts +15 -0
  73. package/src/modules/code-execution/types/execution.ts +15 -0
  74. package/src/modules/comments/application/giscus-adapter.ts +55 -0
  75. package/src/modules/comments/domain/events/index.ts +55 -0
  76. package/src/modules/comments/domain/models/index.ts +30 -0
  77. package/src/modules/comments/domain/operations/comment-operations.ts +46 -0
  78. package/src/modules/comments/domain/validators/index.ts +50 -0
  79. package/src/modules/comments/index.ts +8 -0
  80. package/src/modules/comments/ports/comment-port.ts +18 -0
  81. package/src/modules/comments/types/comments.ts +19 -0
  82. package/src/modules/config/application/usecases/index.ts +1 -0
  83. package/src/modules/config/application/usecases/loadConfig.ts +38 -0
  84. package/src/modules/config/application/workflows/index.ts +1 -0
  85. package/src/modules/config/application/workflows/validateConfig.ts +14 -0
  86. package/src/modules/config/domain/events/index.ts +50 -0
  87. package/src/modules/config/domain/models/index.ts +9 -0
  88. package/src/modules/config/domain/operations/defaults.ts +74 -0
  89. package/src/modules/config/domain/operations/index.ts +2 -0
  90. package/src/modules/config/domain/operations/resolve.ts +40 -0
  91. package/src/modules/config/domain/validators/index.ts +152 -0
  92. package/src/modules/config/index.ts +23 -0
  93. package/src/modules/config/ports/index.ts +15 -0
  94. package/src/modules/config/types/index.ts +113 -0
  95. package/src/modules/config/types/public.ts +19 -0
  96. package/src/modules/content/application/cache/index.ts +6 -0
  97. package/src/modules/content/application/cache/parse-cache.ts +6 -0
  98. package/src/modules/content/application/cache/parseCache.ts +56 -0
  99. package/src/modules/content/application/usecases/index.ts +2 -0
  100. package/src/modules/content/application/usecases/load-doc-page.ts +1 -0
  101. package/src/modules/content/application/usecases/loadDocPage.ts +111 -0
  102. package/src/modules/content/application/usecases/scanDocsDir.ts +105 -0
  103. package/src/modules/content/application/workflows/index.ts +1 -0
  104. package/src/modules/content/application/workflows/processDocs.ts +51 -0
  105. package/src/modules/content/domain/events/index.ts +61 -0
  106. package/src/modules/content/domain/models/index.ts +13 -0
  107. package/src/modules/content/domain/operations/build-page.ts +146 -0
  108. package/src/modules/content/domain/operations/buildPage.ts +93 -0
  109. package/src/modules/content/domain/operations/index.ts +17 -0
  110. package/src/modules/content/domain/operations/parse.ts +241 -0
  111. package/src/modules/content/domain/validators/frontmatter.ts +82 -0
  112. package/src/modules/content/domain/validators/index.ts +6 -0
  113. package/src/modules/content/index.ts +27 -0
  114. package/src/modules/content/ports/index.ts +45 -0
  115. package/src/modules/content/ports/velite.ts +134 -0
  116. package/src/modules/content/types/index.ts +76 -0
  117. package/src/modules/content/types/public.ts +1 -0
  118. package/src/modules/content-linting/application/builtin-linting-adapter.ts +82 -0
  119. package/src/modules/content-linting/domain/events/index.ts +58 -0
  120. package/src/modules/content-linting/domain/models/index.ts +46 -0
  121. package/src/modules/content-linting/domain/operations/linting-operations.ts +82 -0
  122. package/src/modules/content-linting/domain/validators/index.ts +50 -0
  123. package/src/modules/content-linting/index.ts +8 -0
  124. package/src/modules/content-linting/ports/linting-port.ts +21 -0
  125. package/src/modules/content-linting/types/linting.ts +18 -0
  126. package/src/modules/content-validation/application/usecases/index.ts +18 -0
  127. package/src/modules/content-validation/domain/events/index.ts +7 -0
  128. package/src/modules/content-validation/domain/index.ts +16 -0
  129. package/src/modules/content-validation/domain/models/index.ts +33 -0
  130. package/src/modules/content-validation/domain/operations/index.ts +157 -0
  131. package/src/modules/content-validation/domain/types/index.ts +17 -0
  132. package/src/modules/content-validation/domain/validators/index.ts +8 -0
  133. package/src/modules/content-validation/index.ts +9 -0
  134. package/src/modules/content-validation/ports/index.ts +15 -0
  135. package/src/modules/content-validation/types/index.ts +5 -0
  136. package/src/modules/export/application/puppeteer-export-adapter.ts +63 -0
  137. package/src/modules/export/domain/events/index.ts +55 -0
  138. package/src/modules/export/domain/models/index.ts +38 -0
  139. package/src/modules/export/domain/operations/export-operations.ts +56 -0
  140. package/src/modules/export/domain/validators/index.ts +52 -0
  141. package/src/modules/export/index.ts +8 -0
  142. package/src/modules/export/ports/export-port.ts +15 -0
  143. package/src/modules/export/types/export.ts +15 -0
  144. package/src/modules/external-search/application/algolia-adapter.ts +182 -0
  145. package/src/modules/external-search/application/meilisearch-adapter.ts +161 -0
  146. package/src/modules/external-search/domain/events/index.ts +42 -0
  147. package/src/modules/external-search/domain/models/index.ts +42 -0
  148. package/src/modules/external-search/domain/operations/search-operations.ts +53 -0
  149. package/src/modules/external-search/domain/validators/index.ts +55 -0
  150. package/src/modules/external-search/index.ts +9 -0
  151. package/src/modules/external-search/ports/external-search-port.ts +23 -0
  152. package/src/modules/external-search/types/search.ts +19 -0
  153. package/src/modules/git-history/application/simple-git-adapter.ts +46 -0
  154. package/src/modules/git-history/domain/events/index.ts +34 -0
  155. package/src/modules/git-history/domain/models/index.ts +25 -0
  156. package/src/modules/git-history/domain/operations/git-history-operations.ts +56 -0
  157. package/src/modules/git-history/domain/validators/index.ts +52 -0
  158. package/src/modules/git-history/index.ts +8 -0
  159. package/src/modules/git-history/ports/git-history-port.ts +21 -0
  160. package/src/modules/git-history/types/git-history.ts +15 -0
  161. package/src/modules/i18n/application/fs-locale-loader.ts +39 -0
  162. package/src/modules/i18n/domain/events/index.ts +34 -0
  163. package/src/modules/i18n/domain/models/index.ts +34 -0
  164. package/src/modules/i18n/domain/operations/locale-operations.ts +74 -0
  165. package/src/modules/i18n/domain/validators/index.ts +52 -0
  166. package/src/modules/i18n/index.ts +8 -0
  167. package/src/modules/i18n/ports/locale-loader-port.ts +18 -0
  168. package/src/modules/i18n/types/locale.ts +17 -0
  169. package/src/modules/image-optimization/application/sharp-adapter.ts +58 -0
  170. package/src/modules/image-optimization/domain/events/index.ts +39 -0
  171. package/src/modules/image-optimization/domain/models/index.ts +27 -0
  172. package/src/modules/image-optimization/domain/operations/image-operations.ts +65 -0
  173. package/src/modules/image-optimization/domain/validators/index.ts +52 -0
  174. package/src/modules/image-optimization/index.ts +8 -0
  175. package/src/modules/image-optimization/ports/image-optimizer-port.ts +15 -0
  176. package/src/modules/image-optimization/types/image.ts +17 -0
  177. package/src/modules/live-editor/application/usecases/index.ts +60 -0
  178. package/src/modules/live-editor/domain/events/index.ts +37 -0
  179. package/src/modules/live-editor/domain/gitOperations.ts +110 -0
  180. package/src/modules/live-editor/domain/index.ts +15 -0
  181. package/src/modules/live-editor/domain/models/index.ts +21 -0
  182. package/src/modules/live-editor/domain/validators/index.ts +55 -0
  183. package/src/modules/live-editor/index.ts +14 -0
  184. package/src/modules/live-editor/ports/index.ts +49 -0
  185. package/src/modules/live-editor/types/index.ts +80 -0
  186. package/src/modules/live-preview/application/vite-preview-adapter.ts +20 -0
  187. package/src/modules/live-preview/domain/operations/preview-operations.ts +56 -0
  188. package/src/modules/live-preview/index.ts +8 -0
  189. package/src/modules/live-preview/ports/preview-port.ts +20 -0
  190. package/src/modules/live-preview/types/preview.ts +16 -0
  191. package/src/modules/mdx/application/mdx-js-adapter.ts +38 -0
  192. package/src/modules/mdx/domain/operations/parse-mdx.ts +43 -0
  193. package/src/modules/mdx/index.ts +8 -0
  194. package/src/modules/mdx/ports/mdx-parser-port.ts +15 -0
  195. package/src/modules/mdx/types/mdx.ts +14 -0
  196. package/src/modules/navigation/application/usecases/buildNav.ts +15 -0
  197. package/src/modules/navigation/application/usecases/buildSidebar.ts +45 -0
  198. package/src/modules/navigation/application/usecases/index.ts +2 -0
  199. package/src/modules/navigation/domain/events/index.ts +30 -0
  200. package/src/modules/navigation/domain/models/index.ts +7 -0
  201. package/src/modules/navigation/domain/operations/group.ts +79 -0
  202. package/src/modules/navigation/domain/operations/index.ts +10 -0
  203. package/src/modules/navigation/domain/operations/sort.ts +27 -0
  204. package/src/modules/navigation/domain/shared/utils/array.ts +39 -0
  205. package/src/modules/navigation/domain/validators/index.ts +88 -0
  206. package/src/modules/navigation/index.ts +15 -0
  207. package/src/modules/navigation/ports/index.ts +9 -0
  208. package/src/modules/navigation/types/index.ts +38 -0
  209. package/src/modules/navigation/types/public.ts +9 -0
  210. package/src/modules/openapi/application/swagger-parser-adapter.ts +178 -0
  211. package/src/modules/openapi/domain/operations/parse-openapi.ts +46 -0
  212. package/src/modules/openapi/index.ts +8 -0
  213. package/src/modules/openapi/ports/openapi-parser-port.ts +15 -0
  214. package/src/modules/openapi/types/openapi.ts +37 -0
  215. package/src/modules/plugin/application/usecases/build-virtual-modules.ts +53 -0
  216. package/src/modules/plugin/application/usecases/index.ts +1 -0
  217. package/src/modules/plugin/application/workflows/build-docs.ts +79 -0
  218. package/src/modules/plugin/application/workflows/index.ts +1 -0
  219. package/src/modules/plugin/domain/events/index.ts +62 -0
  220. package/src/modules/plugin/domain/models/index.ts +1 -0
  221. package/src/modules/plugin/domain/operations/build-virtual.ts +76 -0
  222. package/src/modules/plugin/domain/operations/index.ts +11 -0
  223. package/src/modules/plugin/domain/validators/index.ts +30 -0
  224. package/src/modules/plugin/index.ts +14 -0
  225. package/src/modules/plugin/ports/index.ts +21 -0
  226. package/src/modules/plugin/types/index.ts +27 -0
  227. package/src/modules/plugin/types/public.ts +1 -0
  228. package/src/modules/search/application/usecases/index.ts +1 -0
  229. package/src/modules/search/application/usecases/indexPages.ts +15 -0
  230. package/src/modules/search/domain/events/index.ts +32 -0
  231. package/src/modules/search/domain/models/index.ts +1 -0
  232. package/src/modules/search/domain/operations/build-index.ts +6 -0
  233. package/src/modules/search/domain/operations/buildIndex.ts +70 -0
  234. package/src/modules/search/domain/operations/index.ts +7 -0
  235. package/src/modules/search/domain/operations/query.ts +186 -0
  236. package/src/modules/search/domain/validators/index.ts +32 -0
  237. package/src/modules/search/index.ts +9 -0
  238. package/src/modules/search/types/index.ts +22 -0
  239. package/src/modules/search/types/public.ts +1 -0
  240. package/src/modules/search-analytics/application/local-storage-adapter.ts +68 -0
  241. package/src/modules/search-analytics/domain/operations/search-analytics-operations.ts +74 -0
  242. package/src/modules/search-analytics/index.ts +8 -0
  243. package/src/modules/search-analytics/ports/search-analytics-port.ts +20 -0
  244. package/src/modules/search-analytics/types/search-analytics.ts +16 -0
  245. package/src/modules/search-highlighting/application/dom-highlighting-adapter.ts +36 -0
  246. package/src/modules/search-highlighting/domain/operations/highlighting-operations.ts +72 -0
  247. package/src/modules/search-highlighting/index.ts +8 -0
  248. package/src/modules/search-highlighting/ports/highlighting-port.ts +14 -0
  249. package/src/modules/search-highlighting/types/highlighting.ts +15 -0
  250. package/src/modules/seo-optimization/application/usecases/index.ts +18 -0
  251. package/src/modules/seo-optimization/domain/index.ts +12 -0
  252. package/src/modules/seo-optimization/domain/seoOperations.ts +92 -0
  253. package/src/modules/seo-optimization/index.ts +8 -0
  254. package/src/modules/seo-optimization/ports/index.ts +18 -0
  255. package/src/modules/seo-optimization/types/index.ts +41 -0
  256. package/src/modules/theme/application/css-theme-adapter.ts +50 -0
  257. package/src/modules/theme/domain/operations/theme-operations.ts +68 -0
  258. package/src/modules/theme/index.ts +8 -0
  259. package/src/modules/theme/ports/theme-port.ts +8 -0
  260. package/src/modules/theme/types/theme.ts +12 -0
  261. package/src/modules/toc/application/markdown-toc-adapter.ts +106 -0
  262. package/src/modules/toc/domain/operations/toc-operations.ts +92 -0
  263. package/src/modules/toc/index.ts +8 -0
  264. package/src/modules/toc/ports/toc-port.ts +21 -0
  265. package/src/modules/toc/types/toc.ts +17 -0
  266. package/src/modules/toc-generator/application/usecases/index.ts +30 -0
  267. package/src/modules/toc-generator/domain/index.ts +12 -0
  268. package/src/modules/toc-generator/domain/tocOperations.ts +104 -0
  269. package/src/modules/toc-generator/index.ts +9 -0
  270. package/src/modules/toc-generator/ports/index.ts +20 -0
  271. package/src/modules/toc-generator/types/index.ts +50 -0
  272. package/src/modules/version-control/domain/events/index.ts +39 -0
  273. package/src/modules/version-control/domain/models/index.ts +25 -0
  274. package/src/modules/version-control/domain/validators/index.ts +50 -0
  275. package/src/modules/versioning/application/fs-version-loader.ts +44 -0
  276. package/src/modules/versioning/domain/operations/versioning-operations.ts +80 -0
  277. package/src/modules/versioning/index.ts +8 -0
  278. package/src/modules/versioning/ports/version-loader-port.ts +18 -0
  279. package/src/modules/versioning/types/versioning.ts +17 -0
  280. package/src/modules/workflow/domain/events/index.ts +55 -0
  281. package/src/modules/workflow/domain/models/index.ts +40 -0
  282. package/src/modules/workflow/domain/validators/index.ts +50 -0
  283. package/src/modules/yaml-parser/application/js-yaml-adapter.ts +34 -0
  284. package/src/modules/yaml-parser/domain/operations/parse-yaml.ts +58 -0
  285. package/src/modules/yaml-parser/index.ts +7 -0
  286. package/src/modules/yaml-parser/ports/yaml-parser-port.ts +18 -0
  287. package/src/navigation/index.ts +9 -0
  288. package/src/plugin/index.ts +4 -0
  289. package/src/presentation/index.ts +1 -0
  290. package/src/presentation/live-editor/index.ts +22 -0
  291. package/src/presentation/live-editor/live-editor-component.ts +219 -0
  292. package/src/presentation/live-editor/virtual-module.ts +16 -0
  293. package/src/presentation/solid/CodeBlock.tsx +120 -0
  294. package/src/presentation/solid/Toc.tsx +58 -0
  295. package/src/presentation/solid/index.ts +11 -0
  296. package/src/presentation/vite-plugin/docs-plugin.ts +212 -0
  297. package/src/presentation/vite-plugin/index.ts +9 -0
  298. package/src/presentation/vite-plugin/transform-markdown.ts +26 -0
  299. package/src/runtime/analytics.ts +59 -0
  300. package/src/runtime/api-diff.ts +115 -0
  301. package/src/runtime/app.tsx +32 -0
  302. package/src/runtime/components/AccentPicker.tsx +114 -0
  303. package/src/runtime/components/ApiPlayground.tsx +332 -0
  304. package/src/runtime/components/AskAiDialog.tsx +127 -0
  305. package/src/runtime/components/BackToTop.tsx +38 -0
  306. package/src/runtime/components/Banner.tsx +75 -0
  307. package/src/runtime/components/Breadcrumbs.tsx +42 -0
  308. package/src/runtime/components/CollectionDropdown.tsx +85 -0
  309. package/src/runtime/components/CustomizeDrawer.tsx +195 -0
  310. package/src/runtime/components/DocMarkdown.tsx +579 -0
  311. package/src/runtime/components/DocPrevNext.tsx +54 -0
  312. package/src/runtime/components/DocToc.tsx +147 -0
  313. package/src/runtime/components/DocsDropdown.tsx +184 -0
  314. package/src/runtime/components/Footer.tsx +52 -0
  315. package/src/runtime/components/GitHubAuth.tsx +82 -0
  316. package/src/runtime/components/GitHubStats.tsx +73 -0
  317. package/src/runtime/components/Head.tsx +225 -0
  318. package/src/runtime/components/LocaleDropdown.tsx +75 -0
  319. package/src/runtime/components/MobileBottomNav.tsx +111 -0
  320. package/src/runtime/components/NotFound.tsx +139 -0
  321. package/src/runtime/components/PageActions.tsx +144 -0
  322. package/src/runtime/components/RelatedDocs.tsx +50 -0
  323. package/src/runtime/components/ScrollProgress.tsx +32 -0
  324. package/src/runtime/components/SearchPalette.tsx +333 -0
  325. package/src/runtime/components/ShowcaseCard.tsx +87 -0
  326. package/src/runtime/components/SidebarNav.tsx +237 -0
  327. package/src/runtime/components/Skeleton.tsx +39 -0
  328. package/src/runtime/components/ThemeToggle.tsx +26 -0
  329. package/src/runtime/components/TopNav.tsx +270 -0
  330. package/src/runtime/components/VersionDropdown.tsx +189 -0
  331. package/src/runtime/components/markdown/components.ts +280 -0
  332. package/src/runtime/config.ts +225 -0
  333. package/src/runtime/content.ts +451 -0
  334. package/src/runtime/context.tsx +30 -0
  335. package/src/runtime/data.ts +93 -0
  336. package/src/runtime/github.ts +226 -0
  337. package/src/runtime/icons.ts +32 -0
  338. package/src/runtime/index.ts +153 -0
  339. package/src/runtime/layouts/DocsLayout.tsx +144 -0
  340. package/src/runtime/markdown-content.css +996 -0
  341. package/src/runtime/pages/AbTestPage.tsx +88 -0
  342. package/src/runtime/pages/AnalyticsPage.tsx +90 -0
  343. package/src/runtime/pages/ApiDiffPage.tsx +86 -0
  344. package/src/runtime/pages/ApiEndpointPage.tsx +248 -0
  345. package/src/runtime/pages/BuilderPage.tsx +150 -0
  346. package/src/runtime/pages/ChangelogPage.tsx +210 -0
  347. package/src/runtime/pages/CollectionPage.tsx +140 -0
  348. package/src/runtime/pages/CommunityPage.tsx +384 -0
  349. package/src/runtime/pages/CreatePage.tsx +448 -0
  350. package/src/runtime/pages/DocPage.tsx +193 -0
  351. package/src/runtime/pages/EditPage.tsx +201 -0
  352. package/src/runtime/pages/HomePage.tsx +187 -0
  353. package/src/runtime/pages/IssuesPage.tsx +140 -0
  354. package/src/runtime/pages/OAuthCallbackPage.tsx +80 -0
  355. package/src/runtime/pages/PluginsPage.tsx +249 -0
  356. package/src/runtime/pages/ShowcasePage.tsx +202 -0
  357. package/src/runtime/pwa.ts +39 -0
  358. package/src/runtime/router.tsx +192 -0
  359. package/src/runtime/seo.ts +192 -0
  360. package/src/runtime/theme.css +175 -0
  361. package/src/runtime/theme.ts +224 -0
  362. package/src/runtime/types.ts +217 -0
  363. package/src/search/index.ts +6 -0
  364. package/src/seo-optimization/index.ts +4 -0
  365. package/src/shared/constants/index.ts +26 -0
  366. package/src/shared/errors/index.ts +195 -0
  367. package/src/shared/index.ts +27 -0
  368. package/src/shared/types/brand.ts +14 -0
  369. package/src/shared/types/client.d.ts +45 -0
  370. package/src/shared/types/either.ts +38 -0
  371. package/src/shared/types/index.ts +42 -0
  372. package/src/shared/types/option.ts +52 -0
  373. package/src/shared/types/result.ts +81 -0
  374. package/src/shared/utils/array.ts +97 -0
  375. package/src/shared/utils/index.ts +46 -0
  376. package/src/shared/utils/object.ts +47 -0
  377. package/src/shared/utils/string.ts +74 -0
  378. package/src/toc-generator/index.ts +1 -0
  379. package/src/types/js-yaml.d.ts +42 -0
  380. package/src/worker.ts +462 -0
@@ -0,0 +1,226 @@
1
+ import { getGitHubToken } from "./components/GitHubAuth";
2
+ import type { GitHubConfig } from "./config";
3
+
4
+ export interface ReleaseInfo {
5
+ id: number;
6
+ tag_name: string;
7
+ name: string;
8
+ body: string;
9
+ published_at: string;
10
+ html_url: string;
11
+ author: { login: string; avatar_url: string };
12
+ }
13
+
14
+ export interface RepoStats {
15
+ stars: number;
16
+ forks: number;
17
+ openIssues: number;
18
+ openPRs: number;
19
+ }
20
+
21
+ export interface Contributor {
22
+ login: string;
23
+ avatar_url: string;
24
+ html_url: string;
25
+ contributions: number;
26
+ }
27
+
28
+ export interface CommitInfo {
29
+ sha: string;
30
+ message: string;
31
+ author: string;
32
+ date: string;
33
+ html_url: string;
34
+ }
35
+
36
+ function githubBaseUrl(): string {
37
+ // In production builds, use the Cloudflare Worker proxy so a GITHUB_TOKEN
38
+ // can be attached server-side. In dev, call the GitHub API directly.
39
+ return import.meta.env.PROD ? "/api/github" : "https://api.github.com";
40
+ }
41
+
42
+ export function githubApiUrl(config: GitHubConfig, path: string): string {
43
+ return `${githubBaseUrl()}/repos/${config.owner}/${config.repo}${path}`;
44
+ }
45
+
46
+ export class GitHubFetchError extends Error {
47
+ status: number;
48
+ payload?: string;
49
+ constructor(status: number, message: string, payload?: string) {
50
+ super(message);
51
+ this.status = status;
52
+ this.payload = payload;
53
+ }
54
+ }
55
+
56
+ async function fetchJson<T>(url: string): Promise<T> {
57
+ const token = getGitHubToken();
58
+ const res = await fetch(url, {
59
+ headers: {
60
+ Accept: "application/vnd.github+json",
61
+ ...(token ? { Authorization: `Bearer ${token}` } : {}),
62
+ },
63
+ });
64
+ const text = await res.text();
65
+ if (!res.ok) {
66
+ throw new GitHubFetchError(
67
+ res.status,
68
+ `GitHub API error ${res.status}`,
69
+ text,
70
+ );
71
+ }
72
+ try {
73
+ return JSON.parse(text) as T;
74
+ } catch {
75
+ throw new GitHubFetchError(res.status, "Invalid JSON from GitHub", text);
76
+ }
77
+ }
78
+
79
+ export async function fetchReleases(
80
+ config: GitHubConfig,
81
+ ): Promise<ReleaseInfo[]> {
82
+ return fetchJson<ReleaseInfo[]>(
83
+ githubApiUrl(config, "/releases?per_page=30"),
84
+ );
85
+ }
86
+
87
+ export async function fetchRepoStats(config: GitHubConfig): Promise<RepoStats> {
88
+ const [repo, pulls] = await Promise.all([
89
+ fetchJson<{
90
+ stargazers_count: number;
91
+ forks_count: number;
92
+ open_issues_count: number;
93
+ }>(githubApiUrl(config, "")),
94
+ fetchJson<{ total_count: number }>(
95
+ `${githubBaseUrl()}/search/issues?q=repo:${config.owner}/${config.repo}+type:pr+state:open&per_page=1`,
96
+ ),
97
+ ]);
98
+ return {
99
+ stars: repo.stargazers_count,
100
+ forks: repo.forks_count,
101
+ openIssues: repo.open_issues_count,
102
+ openPRs: pulls.total_count,
103
+ };
104
+ }
105
+
106
+ export async function fetchContributors(
107
+ config: GitHubConfig,
108
+ ): Promise<Contributor[]> {
109
+ return fetchJson<Contributor[]>(
110
+ githubApiUrl(config, "/contributors?per_page=100"),
111
+ );
112
+ }
113
+
114
+ export async function fetchCommits(
115
+ config: GitHubConfig,
116
+ branch?: string,
117
+ ): Promise<CommitInfo[]> {
118
+ const ref = branch ?? "main";
119
+ const raw = await fetchJson<
120
+ {
121
+ sha: string;
122
+ commit: { message: string; author: { name: string; date: string } };
123
+ html_url: string;
124
+ }[]
125
+ >(githubApiUrl(config, `/commits?sha=${ref}&per_page=20`));
126
+ return raw.map((r) => ({
127
+ sha: r.sha.slice(0, 7),
128
+ message: r.commit.message.split("\n")[0] ?? "",
129
+ author: r.commit.author.name,
130
+ date: r.commit.author.date,
131
+ html_url: r.html_url,
132
+ }));
133
+ }
134
+
135
+ export interface TagInfo {
136
+ name: string;
137
+ sha: string;
138
+ commit: { sha: string; url: string };
139
+ }
140
+
141
+ export interface BranchInfo {
142
+ name: string;
143
+ commit: { sha: string };
144
+ }
145
+
146
+ export interface IssueInfo {
147
+ number: number;
148
+ title: string;
149
+ state: string;
150
+ html_url: string;
151
+ created_at: string;
152
+ updated_at: string;
153
+ comments: number;
154
+ user: { login: string; avatar_url: string };
155
+ labels: { name: string; color: string }[];
156
+ }
157
+
158
+ export interface MilestoneInfo {
159
+ number: number;
160
+ title: string;
161
+ description: string | null;
162
+ state: string;
163
+ open_issues: number;
164
+ closed_issues: number;
165
+ due_on: string | null;
166
+ html_url: string;
167
+ }
168
+
169
+ export async function fetchMilestones(
170
+ config: GitHubConfig,
171
+ ): Promise<MilestoneInfo[]> {
172
+ return fetchJson<MilestoneInfo[]>(
173
+ githubApiUrl(config, "/milestones?state=all&per_page=50"),
174
+ );
175
+ }
176
+
177
+ export async function fetchTags(config: GitHubConfig): Promise<TagInfo[]> {
178
+ return fetchJson<TagInfo[]>(githubApiUrl(config, "/tags?per_page=30"));
179
+ }
180
+
181
+ export async function fetchBranches(
182
+ config: GitHubConfig,
183
+ ): Promise<BranchInfo[]> {
184
+ return fetchJson<BranchInfo[]>(githubApiUrl(config, "/branches?per_page=30"));
185
+ }
186
+
187
+ export async function fetchLatestCommit(
188
+ config: GitHubConfig,
189
+ branch?: string,
190
+ ): Promise<CommitInfo> {
191
+ const ref = branch ?? config.branch ?? "main";
192
+ const raw = await fetchJson<{
193
+ sha: string;
194
+ commit: { message: string; author: { name: string; date: string } };
195
+ html_url: string;
196
+ }>(githubApiUrl(config, `/commits/${ref}`));
197
+ return {
198
+ sha: raw.sha.slice(0, 7),
199
+ message: raw.commit.message.split("\n")[0] ?? "",
200
+ author: raw.commit.author.name,
201
+ date: raw.commit.author.date,
202
+ html_url: raw.html_url,
203
+ };
204
+ }
205
+
206
+ export async function fetchIssues(config: GitHubConfig): Promise<IssueInfo[]> {
207
+ return fetchJson<IssueInfo[]>(
208
+ githubApiUrl(config, "/issues?state=open&sort=updated&per_page=30"),
209
+ );
210
+ }
211
+
212
+ export function shieldsBadge(
213
+ owner: string,
214
+ repo: string,
215
+ type: "stars" | "forks" | "issues" | "prs",
216
+ ): string {
217
+ const label =
218
+ type === "stars"
219
+ ? "stars"
220
+ : type === "forks"
221
+ ? "forks"
222
+ : type === "issues"
223
+ ? "issues"
224
+ : "prs";
225
+ return `https://img.shields.io/github/${type === "prs" ? "issues-pr" : type}/${owner}/${repo}?style=flat-square&label=${label}`;
226
+ }
@@ -0,0 +1,32 @@
1
+ const categoryIcons: Record<string, string> = {
2
+ Root: "i-mdi:file-tree-outline",
3
+ "CLI Apps": "i-mdi:console",
4
+ "Desktop Apps": "i-mdi:application-outline",
5
+ "TUI Apps": "i-mdi:monitor",
6
+ "WASM Apps": "i-mdi:application-braces-outline",
7
+ "Web Apps": "i-mdi:web",
8
+ Domain: "i-mdi:domain",
9
+ Infra: "i-mdi:server-outline",
10
+ Tools: "i-mdi:tools",
11
+ Foundation: "i-mdi:layers-outline",
12
+ Libraries: "i-mdi:bookshelf",
13
+ "TUI Lib": "i-mdi:console-line",
14
+ "Tauri Plugin": "i-mdi:power-plug-outline",
15
+ "Services Apps": "i-mdi:cloud-outline",
16
+ "Toolkits Apps": "i-mdi:toolbox-outline",
17
+ };
18
+
19
+ export function categoryIcon(category: string): string {
20
+ return categoryIcons[category] ?? "i-mdi:folder-outline";
21
+ }
22
+
23
+ const typeIcons: Record<string, string> = {
24
+ rust: "i-mdi:language-rust",
25
+ npm: "i-mdi:nodejs",
26
+ api: "i-mdi:api",
27
+ md: "i-mdi:language-markdown-outline",
28
+ };
29
+
30
+ export function typeIcon(type: string): string {
31
+ return typeIcons[type] ?? "i-mdi:file-document-outline";
32
+ }
@@ -0,0 +1,153 @@
1
+ /**
2
+ * create-docs runtime — SolidJS app shell (VitePress-style layouts,
3
+ * Scalar-style API reference) driven by an injected data source.
4
+ */
5
+
6
+ export type { PageViewRecord } from "./analytics";
7
+ export {
8
+ getPageViews,
9
+ resetPageViews,
10
+ trackPageView,
11
+ } from "./analytics";
12
+ export type { EndpointChange } from "./api-diff";
13
+ export { diffApiCollections } from "./api-diff";
14
+ export { createDocsApp, mountDocsApp } from "./app";
15
+ // Components (for custom pages/layouts)
16
+ export { AccentPicker } from "./components/AccentPicker";
17
+ export { ApiPlayground } from "./components/ApiPlayground";
18
+ export { AskAiDialog } from "./components/AskAiDialog";
19
+ export { BackToTop } from "./components/BackToTop";
20
+ export { Breadcrumbs } from "./components/Breadcrumbs";
21
+ export { CollectionDropdown } from "./components/CollectionDropdown";
22
+ export { DocMarkdown } from "./components/DocMarkdown";
23
+ export { DocPrevNext } from "./components/DocPrevNext";
24
+ export { DocsDropdown } from "./components/DocsDropdown";
25
+ export { DocToc } from "./components/DocToc";
26
+ export {
27
+ clearGitHubToken,
28
+ GitHubAuthButton,
29
+ getGitHubToken,
30
+ setGitHubToken,
31
+ } from "./components/GitHubAuth";
32
+ export { GitHubStats } from "./components/GitHubStats";
33
+ export { Head } from "./components/Head";
34
+ export { LocaleDropdown } from "./components/LocaleDropdown";
35
+ export { PageActions } from "./components/PageActions";
36
+ export { RelatedDocs } from "./components/RelatedDocs";
37
+ export { ScrollProgress } from "./components/ScrollProgress";
38
+ export {
39
+ SearchPalette,
40
+ searchOpen,
41
+ setSearchOpen,
42
+ } from "./components/SearchPalette";
43
+ export { SidebarNav } from "./components/SidebarNav";
44
+ export {
45
+ SkeletonBlock,
46
+ SkeletonPage,
47
+ SkeletonText,
48
+ } from "./components/Skeleton";
49
+ export { ThemeToggle } from "./components/ThemeToggle";
50
+ export { TopNav } from "./components/TopNav";
51
+ export { VersionDropdown } from "./components/VersionDropdown";
52
+ export type {
53
+ ApiCollection,
54
+ DocsAppConfig,
55
+ DocsAppFeatures,
56
+ DocsVersion,
57
+ GitHubConfig,
58
+ GitHubOAuthConfig,
59
+ HomeConfig,
60
+ HomeFeature,
61
+ I18nConfig,
62
+ LocaleInfo,
63
+ MarkdownConfig,
64
+ PluginInfo,
65
+ ShowcaseInfo,
66
+ VersionsConfig,
67
+ } from "./config";
68
+ export type { DirMeta, StaticSourceOptions } from "./content";
69
+ export {
70
+ createCompositeDataSource,
71
+ createRemoteDataSource,
72
+ createStaticDataSource,
73
+ parseFrontmatter,
74
+ queryDocs,
75
+ relatedDocs,
76
+ } from "./content";
77
+ export { DocsProvider, useDocs } from "./context";
78
+ export { createDocsList, useCollections } from "./data";
79
+ export type {
80
+ BranchInfo,
81
+ CommitInfo,
82
+ Contributor,
83
+ IssueInfo,
84
+ MilestoneInfo,
85
+ ReleaseInfo,
86
+ RepoStats,
87
+ TagInfo,
88
+ } from "./github";
89
+ export {
90
+ fetchBranches,
91
+ fetchCommits,
92
+ fetchContributors,
93
+ fetchIssues,
94
+ fetchLatestCommit,
95
+ fetchMilestones,
96
+ fetchReleases,
97
+ fetchRepoStats,
98
+ fetchTags,
99
+ GitHubFetchError,
100
+ githubApiUrl,
101
+ shieldsBadge,
102
+ } from "./github";
103
+ // Pages & layouts
104
+ export { DocsLayout } from "./layouts/DocsLayout";
105
+ export { AnalyticsPage } from "./pages/AnalyticsPage";
106
+ export { ApiDiffPage } from "./pages/ApiDiffPage";
107
+ export { ApiEndpointPage } from "./pages/ApiEndpointPage";
108
+ export { ChangelogPage } from "./pages/ChangelogPage";
109
+ export { CollectionPage } from "./pages/CollectionPage";
110
+ export { CommunityPage } from "./pages/CommunityPage";
111
+ export { CreatePage } from "./pages/CreatePage";
112
+ export { DocPage } from "./pages/DocPage";
113
+ export { HomePage } from "./pages/HomePage";
114
+ export { IssuesPage } from "./pages/IssuesPage";
115
+ export { OAuthCallbackPage } from "./pages/OAuthCallbackPage";
116
+ export { PluginsPage } from "./pages/PluginsPage";
117
+ export { ShowcasePage } from "./pages/ShowcasePage";
118
+ export { setupPwa } from "./pwa";
119
+ export { createDocsRouter } from "./router";
120
+ export type { SeoInput } from "./seo";
121
+ export {
122
+ generateAtom,
123
+ generateJsonFeed,
124
+ generateLlmsTxt,
125
+ generateRobots,
126
+ generateRss,
127
+ generateSitemap,
128
+ } from "./seo";
129
+ export {
130
+ type AccentSetting,
131
+ accentIndex,
132
+ DAILY_ACCENTS,
133
+ type DailyAccent,
134
+ initTheme,
135
+ setAccent,
136
+ useAccent,
137
+ useTheme,
138
+ } from "./theme";
139
+ export type {
140
+ ApiEndpoint,
141
+ ApiParameter,
142
+ AskInput,
143
+ AskResult,
144
+ CliArg,
145
+ CliEndpoint,
146
+ CollectionMeta,
147
+ DocContent,
148
+ DocEntry,
149
+ DocsDataSource,
150
+ GraphQlEndpoint,
151
+ HttpMethod,
152
+ SearchResult,
153
+ } from "./types";
@@ -0,0 +1,144 @@
1
+ import {
2
+ Outlet,
3
+ useLocation,
4
+ useNavigate,
5
+ useParams,
6
+ } from "@tanstack/solid-router";
7
+ import { createEffect, createSignal, onCleanup, onMount, Show } from "solid-js";
8
+ import { BackToTop } from "../components/BackToTop";
9
+ import { Banner } from "../components/Banner";
10
+ import { Footer } from "../components/Footer";
11
+ import { Head } from "../components/Head";
12
+ import { MobileBottomNav } from "../components/MobileBottomNav";
13
+ import { ScrollProgress } from "../components/ScrollProgress";
14
+ import { SearchPalette, setSearchOpen } from "../components/SearchPalette";
15
+ import { SidebarNav } from "../components/SidebarNav";
16
+ import { TopNav } from "../components/TopNav";
17
+ import { createDocsList } from "../data";
18
+
19
+ export function DocsLayout() {
20
+ const [navOpen, setNavOpen] = createSignal(false);
21
+ const params = useParams({ strict: false });
22
+ const inCollection = () => !!params().collection;
23
+ const navigate = useNavigate();
24
+ const [docs] = createDocsList(() => params().collection ?? "");
25
+ const location = useLocation();
26
+ let mainRef: HTMLElement | undefined;
27
+
28
+ createEffect(() => {
29
+ location().pathname;
30
+ const el = mainRef;
31
+ if (!el) return;
32
+ el.classList.remove("docs-page-enter");
33
+ void el.offsetWidth;
34
+ el.classList.add("docs-page-enter");
35
+ });
36
+
37
+ const focusable = (target: EventTarget | null) => {
38
+ if (!(target instanceof HTMLElement)) return false;
39
+ const tag = target.tagName.toLowerCase();
40
+ return (
41
+ tag === "input" ||
42
+ tag === "textarea" ||
43
+ tag === "select" ||
44
+ target.isContentEditable
45
+ );
46
+ };
47
+
48
+ const docsPath = () => {
49
+ const list = docs() ?? [];
50
+ const id = params().docId;
51
+ if (!id) return null;
52
+ const idx = list.findIndex((d) => d.id === id);
53
+ if (idx < 0) return null;
54
+ return { list, idx };
55
+ };
56
+
57
+ const goDoc = (nextIdx: number) => {
58
+ const p = docsPath();
59
+ const collection = params().collection;
60
+ if (!p || !collection) return;
61
+ const next = p.list[nextIdx];
62
+ if (!next) return;
63
+ navigate({
64
+ to: "/$collection/$docId",
65
+ params: { collection, docId: next.id },
66
+ });
67
+ };
68
+
69
+ const onKey = (e: KeyboardEvent) => {
70
+ if (focusable(e.target)) {
71
+ if (e.key === "Escape") {
72
+ (e.target as HTMLElement).blur();
73
+ }
74
+ return;
75
+ }
76
+
77
+ if (e.key === "/") {
78
+ e.preventDefault();
79
+ setSearchOpen(true);
80
+ return;
81
+ }
82
+
83
+ if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "k") {
84
+ e.preventDefault();
85
+ setSearchOpen((v) => !v);
86
+ return;
87
+ }
88
+
89
+ if (e.key === "j" || e.key === "J") {
90
+ e.preventDefault();
91
+ const p = docsPath();
92
+ if (p) goDoc(Math.min(p.idx + 1, p.list.length - 1));
93
+ return;
94
+ }
95
+
96
+ if (e.key === "k" || e.key === "K") {
97
+ e.preventDefault();
98
+ const p = docsPath();
99
+ if (p) goDoc(Math.max(p.idx - 1, 0));
100
+ return;
101
+ }
102
+
103
+ if (e.key === "Escape") {
104
+ setSearchOpen(false);
105
+ }
106
+ };
107
+
108
+ onMount(() => document.addEventListener("keydown", onKey));
109
+ onCleanup(() => document.removeEventListener("keydown", onKey));
110
+
111
+ return (
112
+ <div class="min-h-screen flex flex-col bg-background text-foreground">
113
+ <Head />
114
+ <ScrollProgress />
115
+ <Banner />
116
+ <TopNav onMenuToggle={() => setNavOpen(!navOpen())} />
117
+ <div class="flex flex-1 min-h-0">
118
+ <Show when={inCollection()}>
119
+ <SidebarNav open={navOpen()} onNavigate={() => setNavOpen(false)} />
120
+ </Show>
121
+ <Show when={navOpen()}>
122
+ <button
123
+ type="button"
124
+ aria-label="Close sidebar"
125
+ class="fixed inset-0 top-[var(--docs-banner-height,0px)] z-20 bg-overlay lg:hidden cursor-default"
126
+ onClick={() => setNavOpen(false)}
127
+ />
128
+ </Show>
129
+ <main
130
+ ref={(el) => {
131
+ mainRef = el;
132
+ }}
133
+ class={`flex-1 min-w-0 pb-16 lg:pb-0 ${inCollection() ? "lg:pl-72" : ""}`}
134
+ >
135
+ <Outlet />
136
+ </main>
137
+ </div>
138
+ <MobileBottomNav onMenuToggle={() => setNavOpen(!navOpen())} />
139
+ <Footer />
140
+ <SearchPalette />
141
+ <BackToTop />
142
+ </div>
143
+ );
144
+ }