@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,80 @@
1
+ /**
2
+ * Live Editor Types
3
+ *
4
+ * Domain types for live editor with Git integration
5
+ */
6
+
7
+ /**
8
+ * Editor mode
9
+ */
10
+ export type EditorMode = "preview" | "edit" | "split";
11
+
12
+ /**
13
+ * File content
14
+ */
15
+ export interface FileContent {
16
+ /** File path */
17
+ path: string;
18
+ /** File content */
19
+ content: string;
20
+ /** Language (for syntax highlighting) */
21
+ language?: string;
22
+ /** Last modified timestamp */
23
+ mtimeMs?: number;
24
+ }
25
+
26
+ /**
27
+ * Git status
28
+ */
29
+ export interface GitStatus {
30
+ /** Current branch */
31
+ branch: string;
32
+ /** Has uncommitted changes */
33
+ hasChanges: boolean;
34
+ /** Untracked files */
35
+ untracked: string[];
36
+ /** Modified files */
37
+ modified: string[];
38
+ /** Staged files */
39
+ staged: string[];
40
+ }
41
+
42
+ /**
43
+ * Commit options
44
+ */
45
+ export interface CommitOptions {
46
+ /** Commit message */
47
+ message: string;
48
+ /** Author name */
49
+ author?: string;
50
+ /** Author email */
51
+ email?: string;
52
+ }
53
+
54
+ /**
55
+ * Push options
56
+ */
57
+ export interface PushOptions {
58
+ /** Remote name (default: origin) */
59
+ remote?: string;
60
+ /** Branch name (default: current branch) */
61
+ branch?: string;
62
+ /** Force push */
63
+ force?: boolean;
64
+ }
65
+
66
+ /**
67
+ * Editor state
68
+ */
69
+ export interface EditorState {
70
+ /** Current mode */
71
+ mode: EditorMode;
72
+ /** Current file */
73
+ currentFile: FileContent | null;
74
+ /** Git status */
75
+ gitStatus: GitStatus | null;
76
+ /** Is loading */
77
+ loading: boolean;
78
+ /** Error message */
79
+ error?: string;
80
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Vite preview adapter implementation.
3
+ * Provides WebSocket-based live preview integration.
4
+ */
5
+
6
+ import type { PreviewPort } from "../ports/preview-port";
7
+
8
+ export const createVitePreviewAdapter = (): PreviewPort => ({
9
+ start: async (_config?: unknown) => {
10
+ // This will integrate with Vite HMR
11
+ },
12
+
13
+ stop: async () => {
14
+ // This will stop the preview server
15
+ },
16
+
17
+ update: async (_content: string) => {
18
+ // This will send content update via WebSocket
19
+ },
20
+ });
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Pure live preview operations.
3
+ * No I/O. No exceptions thrown. Returns Result types.
4
+ */
5
+
6
+ import type { Result } from "@create-docs/shared/types";
7
+ import { err, ok } from "@create-docs/shared/types";
8
+ import type { PreviewConfig, PreviewState } from "../../types/preview";
9
+
10
+ export type PreviewError = {
11
+ readonly kind: "preview-error";
12
+ readonly message: string;
13
+ };
14
+
15
+ /**
16
+ * Update preview state with new content.
17
+ */
18
+ export const updatePreview = (
19
+ state: PreviewState,
20
+ content: string,
21
+ ): Result<PreviewState, PreviewError> => {
22
+ try {
23
+ return ok({
24
+ ...state,
25
+ content,
26
+ error: null,
27
+ });
28
+ } catch (error) {
29
+ return err({
30
+ kind: "preview-error",
31
+ message: error instanceof Error ? error.message : "Unknown error",
32
+ });
33
+ }
34
+ };
35
+
36
+ /**
37
+ * Set preview error.
38
+ */
39
+ export const setPreviewError = (
40
+ state: PreviewState,
41
+ error: Error,
42
+ ): PreviewState => ({
43
+ ...state,
44
+ error,
45
+ });
46
+
47
+ /**
48
+ * Toggle preview mode.
49
+ */
50
+ export const togglePreview = (
51
+ state: PreviewState,
52
+ _config: PreviewConfig,
53
+ ): PreviewState => ({
54
+ ...state,
55
+ isPreviewing: !state.isPreviewing,
56
+ });
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Public API for the live-preview module.
3
+ */
4
+
5
+ export { createVitePreviewAdapter } from "./application/vite-preview-adapter";
6
+ export * from "./domain/operations/preview-operations";
7
+ export * from "./ports/preview-port";
8
+ export * from "./types/preview";
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Port for live preview operations.
3
+ */
4
+
5
+ export type PreviewPort = {
6
+ /**
7
+ * Start preview server.
8
+ */
9
+ readonly start: (config: unknown) => Promise<void>;
10
+
11
+ /**
12
+ * Stop preview server.
13
+ */
14
+ readonly stop: () => Promise<void>;
15
+
16
+ /**
17
+ * Send content update via WebSocket.
18
+ */
19
+ readonly update: (content: string) => Promise<void>;
20
+ };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Live preview types for real-time markdown preview.
3
+ */
4
+
5
+ export type PreviewState = {
6
+ readonly isPreviewing: boolean;
7
+ readonly currentPath: string;
8
+ readonly content: string;
9
+ readonly error: Error | null;
10
+ };
11
+
12
+ export type PreviewConfig = {
13
+ readonly enabled: boolean;
14
+ readonly splitView: boolean;
15
+ readonly syncScroll: boolean;
16
+ };
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @mdx-js/mdx adapter implementation.
3
+ * Provides MDX parsing and compilation.
4
+ */
5
+
6
+ import { pluginError } from "@create-docs/shared/errors";
7
+ import { compile } from "@mdx-js/mdx";
8
+ import type { MdxParserPort } from "../ports/mdx-parser-port";
9
+
10
+ export const createMdxJsAdapter = (): MdxParserPort => ({
11
+ parse: async (raw: string, options?: unknown) => {
12
+ try {
13
+ const result = await compile(raw, {
14
+ ...(options as Record<string, unknown>),
15
+ outputFormat: "function-body",
16
+ });
17
+ return result.toString();
18
+ } catch (error) {
19
+ throw pluginError("MDX parsing failed", {
20
+ context: { options, error: String(error) },
21
+ });
22
+ }
23
+ },
24
+
25
+ compile: async (raw: string, options?: unknown) => {
26
+ try {
27
+ const result = await compile(raw, {
28
+ ...(options as Record<string, unknown>),
29
+ outputFormat: "function-body",
30
+ });
31
+ return result.toString();
32
+ } catch (error) {
33
+ throw pluginError("MDX compilation failed", {
34
+ context: { options, error: String(error) },
35
+ });
36
+ }
37
+ },
38
+ });
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Pure MDX parser operations.
3
+ * No I/O. No exceptions thrown. Returns Result types.
4
+ */
5
+
6
+ import type { Result } from "@create-docs/shared/types";
7
+ import { err, ok } from "@create-docs/shared/types";
8
+ import type { MdxOptions } from "../../types/mdx";
9
+
10
+ export type MdxParseError = {
11
+ readonly kind: "mdx-parse-error";
12
+ readonly message: string;
13
+ readonly line?: number;
14
+ readonly column?: number;
15
+ };
16
+
17
+ /**
18
+ * Parse MDX string to component code.
19
+ * Uses @mdx-js/mdx adapter.
20
+ */
21
+ export const parseMdx = (
22
+ raw: string,
23
+ _options: MdxOptions = {},
24
+ ): Result<string, MdxParseError> => {
25
+ try {
26
+ // This will be implemented via adapter
27
+ // For now, return the raw content as-is
28
+ return ok(raw);
29
+ } catch (error) {
30
+ return err({
31
+ kind: "mdx-parse-error",
32
+ message: error instanceof Error ? error.message : "Unknown error",
33
+ });
34
+ }
35
+ };
36
+
37
+ /**
38
+ * Determine if a file is an MDX file.
39
+ */
40
+ export const isMdxFile = (fileName: string): boolean =>
41
+ fileName.endsWith(".mdx") ||
42
+ fileName.endsWith(".mdx.tsx") ||
43
+ fileName.endsWith(".mdx.jsx");
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Public API for the mdx module.
3
+ */
4
+
5
+ export { createMdxJsAdapter } from "./application/mdx-js-adapter";
6
+ export * from "./domain/operations/parse-mdx";
7
+ export * from "./ports/mdx-parser-port";
8
+ export * from "./types/mdx";
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Port for MDX parsing operations.
3
+ */
4
+
5
+ export type MdxParserPort = {
6
+ /**
7
+ * Parse MDX string to component code.
8
+ */
9
+ readonly parse: (raw: string, options?: unknown) => Promise<string>;
10
+
11
+ /**
12
+ * Compile MDX to JavaScript.
13
+ */
14
+ readonly compile: (raw: string, options?: unknown) => Promise<string>;
15
+ };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * MDX types for MDX support.
3
+ */
4
+
5
+ export type MdxComponent = {
6
+ readonly name: string;
7
+ readonly source: string;
8
+ };
9
+
10
+ export type MdxOptions = {
11
+ readonly components?: Readonly<Record<string, MdxComponent>>;
12
+ readonly remarkPlugins?: readonly unknown[];
13
+ readonly rehypePlugins?: readonly unknown[];
14
+ };
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Use case: select or fallback to the navigation structure.
3
+ * Pure: depends only on config input.
4
+ */
5
+
6
+ import type { AppError } from "@create-docs/shared/errors";
7
+ import { ok, type Result } from "@create-docs/shared/types/result";
8
+ import { sortNavSections } from "../../domain/operations/sort";
9
+ import type { NavSection } from "../../types";
10
+
11
+ export type BuildNav = (
12
+ sections: readonly NavSection[],
13
+ ) => Result<readonly NavSection[], AppError>;
14
+
15
+ export const buildNav: BuildNav = (sections) => ok(sortNavSections(sections));
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Use case: build the sidebar from either a user-defined config or
3
+ * the scanned docs directory.
4
+ */
5
+
6
+ import type { DocFile, DocPage } from "@create-docs/modules/content";
7
+ import type { AppError } from "@create-docs/shared/errors";
8
+ import type { Result } from "@create-docs/shared/types/result";
9
+ import { ok } from "@create-docs/shared/types/result";
10
+ import {
11
+ groupDocsByFolder,
12
+ type SidebarSource,
13
+ } from "../../domain/operations/group";
14
+ import {
15
+ sortSidebarGroups,
16
+ sortSidebarItems,
17
+ } from "../../domain/operations/sort";
18
+ import type { SidebarGroup } from "../../types";
19
+
20
+ export interface BuildSidebarInput {
21
+ /** Explicit sidebar from config (overrides auto-generation). */
22
+ readonly configured?: readonly SidebarGroup[];
23
+ /** All scanned doc files (used when no explicit sidebar). */
24
+ readonly docs?: readonly DocFile[];
25
+ /** All built doc pages (used as a richer source when available). */
26
+ readonly pages?: readonly DocPage[];
27
+ }
28
+
29
+ export type BuildSidebar = (
30
+ input: BuildSidebarInput,
31
+ ) => Result<readonly SidebarGroup[], AppError>;
32
+
33
+ export const buildSidebar: BuildSidebar = ({ configured, docs, pages }) => {
34
+ if (configured && configured.length > 0) {
35
+ const sorted = configured.map((g) => ({
36
+ ...g,
37
+ items: sortSidebarItems(g.items),
38
+ }));
39
+ return ok(sortSidebarGroups(sorted));
40
+ }
41
+ const sources: readonly SidebarSource[] =
42
+ pages !== undefined && pages.length > 0 ? pages : (docs ?? []);
43
+ if (sources.length === 0) return ok([]);
44
+ return ok(sortSidebarGroups(groupDocsByFolder(sources)));
45
+ };
@@ -0,0 +1,2 @@
1
+ export { buildNav } from "./buildNav";
2
+ export { buildSidebar } from "./buildSidebar";
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Domain events for the navigation module.
3
+ * Pure event types — no handlers.
4
+ */
5
+ import type { SidebarGroup } from "../../types";
6
+
7
+ export type NavigationEvent =
8
+ | { readonly type: "nav.generated"; readonly groupsCount: number }
9
+ | {
10
+ readonly type: "nav.rebuilt";
11
+ readonly reason: "config_changed" | "content_changed" | "manual";
12
+ }
13
+ | { readonly type: "sidebar.group_built"; readonly group: SidebarGroup };
14
+
15
+ export const navGenerated = (groupsCount: number): NavigationEvent => ({
16
+ type: "nav.generated",
17
+ groupsCount,
18
+ });
19
+
20
+ export const navRebuilt = (
21
+ reason: "config_changed" | "content_changed" | "manual",
22
+ ): NavigationEvent => ({
23
+ type: "nav.rebuilt",
24
+ reason,
25
+ });
26
+
27
+ export const sidebarGroupBuilt = (group: SidebarGroup): NavigationEvent => ({
28
+ type: "sidebar.group_built",
29
+ group,
30
+ });
@@ -0,0 +1,7 @@
1
+ export type {
2
+ NavItem,
3
+ NavSection,
4
+ Sidebar,
5
+ SidebarGroup,
6
+ SidebarItem,
7
+ } from "../../types";
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Pure operations for generating and formatting navigation structures.
3
+ * No I/O. No mutation of inputs.
4
+ */
5
+
6
+ import type { DocFile, DocPage } from "@create-docs/modules/content";
7
+ import { SIDEBAR_DEFAULT_GROUP_TITLE } from "@create-docs/shared/constants";
8
+ import { capitalize, titleCase } from "@create-docs/shared/utils/string";
9
+ import type { SidebarGroup, SidebarItem } from "../../types";
10
+ import { groupBy, sortBy } from "../shared/utils/array";
11
+
12
+ export interface GroupInput {
13
+ readonly slug: string;
14
+ readonly title: string;
15
+ readonly order: number;
16
+ readonly group?: string;
17
+ readonly badge?: string;
18
+ readonly badgeVariant?: SidebarItem["badgeVariant"];
19
+ }
20
+
21
+ /** Structural subset needed to derive a sidebar item. Both DocFile and DocPage satisfy it. */
22
+ export interface SidebarSource {
23
+ readonly slug: DocFile["slug"] | DocPage["slug"];
24
+ readonly group?: string;
25
+ readonly order: number;
26
+ readonly frontmatter: DocFile["frontmatter"];
27
+ }
28
+
29
+ /** Format a folder name into a human-readable group title. */
30
+ export const formatGroupTitle = (name: string): string => {
31
+ if (name === "root") return SIDEBAR_DEFAULT_GROUP_TITLE;
32
+ return titleCase(name);
33
+ };
34
+
35
+ /** Group doc files by their first path segment, sorting each by `order`. */
36
+ export const groupDocsByFolder = (
37
+ docs: readonly SidebarSource[],
38
+ ): readonly SidebarGroup[] => {
39
+ const grouped = groupBy(docs, (d) => d.group ?? "root");
40
+ const groups: SidebarGroup[] = [];
41
+ for (const [key, items] of Object.entries(grouped)) {
42
+ const sorted = sortBy(items, (i) => i.order);
43
+ groups.push({
44
+ title: formatGroupTitle(key),
45
+ items: sorted.map(toSidebarItem),
46
+ });
47
+ }
48
+ return groups.sort((a, b) => a.title.localeCompare(b.title));
49
+ };
50
+
51
+ const toSidebarItem = (doc: SidebarSource): SidebarItem => {
52
+ const fm = doc.frontmatter as Record<string, unknown>;
53
+ const item: SidebarItem = {
54
+ title: deriveTitle(doc),
55
+ slug: typeof doc.slug === "string" ? doc.slug : String(doc.slug),
56
+ };
57
+ if (typeof fm.badge === "string") {
58
+ const withBadge: SidebarItem = { ...item, badge: fm.badge };
59
+ if (isBadgeVariant(fm.badgeVariant)) {
60
+ return { ...withBadge, badgeVariant: fm.badgeVariant };
61
+ }
62
+ return withBadge;
63
+ }
64
+ return item;
65
+ };
66
+
67
+ const deriveTitle = (doc: SidebarSource): string => {
68
+ const fm = doc.frontmatter as Record<string, unknown>;
69
+ if (typeof fm.title === "string" && fm.title.trim().length > 0)
70
+ return fm.title;
71
+ const slugStr = typeof doc.slug === "string" ? doc.slug : String(doc.slug);
72
+ const last = slugStr.split("/").pop();
73
+ return last ? capitalize(last) : slugStr;
74
+ };
75
+
76
+ const isBadgeVariant = (
77
+ v: unknown,
78
+ ): v is NonNullable<SidebarItem["badgeVariant"]> =>
79
+ v === "default" || v === "success" || v === "warning" || v === "danger";
@@ -0,0 +1,10 @@
1
+ export {
2
+ formatGroupTitle,
3
+ groupDocsByFolder,
4
+ } from "./group";
5
+ export {
6
+ sortNavItems,
7
+ sortNavSections,
8
+ sortSidebarGroups,
9
+ sortSidebarItems,
10
+ } from "./sort";
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Pure operations for sorting/ordering nav items.
3
+ */
4
+
5
+ import type {
6
+ NavItem,
7
+ NavSection,
8
+ SidebarGroup,
9
+ SidebarItem,
10
+ } from "../../types";
11
+ import { sortByString } from "../shared/utils/array";
12
+
13
+ export const sortNavSections = (
14
+ sections: readonly NavSection[],
15
+ ): readonly NavSection[] =>
16
+ [...sections].sort((a, b) => a.title.localeCompare(b.title));
17
+
18
+ export const sortNavItems = (items: readonly NavItem[]): readonly NavItem[] =>
19
+ sortByString(items, (i) => i.label);
20
+
21
+ export const sortSidebarGroups = (
22
+ groups: readonly SidebarGroup[],
23
+ ): readonly SidebarGroup[] => sortByString(groups, (g) => g.title);
24
+
25
+ export const sortSidebarItems = (
26
+ items: readonly SidebarItem[],
27
+ ): readonly SidebarItem[] => sortByString(items, (i) => i.title);
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Pure array helpers used by navigation domain operations.
3
+ */
4
+
5
+ export const sortBy = <T, K extends number | string>(
6
+ items: readonly T[],
7
+ keyFn: (item: T) => K,
8
+ ): T[] => {
9
+ return [...items].sort((a, b) => {
10
+ const ka = keyFn(a);
11
+ const kb = keyFn(b);
12
+ if (typeof ka === "number" && typeof kb === "number") {
13
+ return ka - kb;
14
+ }
15
+ return String(ka).localeCompare(String(kb));
16
+ });
17
+ };
18
+
19
+ export const sortByString = <T>(
20
+ items: readonly T[],
21
+ keyFn: (item: T) => string,
22
+ ): T[] => {
23
+ return [...items].sort((a, b) => keyFn(a).localeCompare(keyFn(b)));
24
+ };
25
+
26
+ export const groupBy = <T, K extends string | number>(
27
+ items: readonly T[],
28
+ keyFn: (item: T) => K,
29
+ ): Record<string, T[]> => {
30
+ const result: Record<string, T[]> = {};
31
+ for (const item of items) {
32
+ const key = String(keyFn(item));
33
+ if (!result[key]) {
34
+ result[key] = [];
35
+ }
36
+ result[key].push(item);
37
+ }
38
+ return result;
39
+ };
@@ -0,0 +1,88 @@
1
+ // Navigation Domain Schemas - Arktype validation schemas
2
+ // Following /follow-arktype workflow for type-safe runtime validation
3
+
4
+ import { validationError } from "@create-docs/shared/errors";
5
+ import { err, ok, type Result } from "@create-docs/shared/types/result";
6
+ import { type Type, type } from "arktype";
7
+ import type {
8
+ NavItem,
9
+ NavSection,
10
+ SidebarGroup,
11
+ SidebarItem,
12
+ } from "../../types";
13
+
14
+ /**
15
+ * Nav Item Schema
16
+ */
17
+ export const navItemSchema: Type = type({
18
+ label: "string >= 1",
19
+ "href?": "string >= 1",
20
+ });
21
+
22
+ /**
23
+ * Nav Section Schema
24
+ */
25
+ export const navSectionSchema: Type = type({
26
+ title: "string >= 1",
27
+ items: "unknown[]",
28
+ });
29
+
30
+ /**
31
+ * Sidebar Item Schema
32
+ */
33
+ export const sidebarItemSchema: Type = type({
34
+ title: "string >= 1",
35
+ slug: "string >= 1",
36
+ });
37
+
38
+ /**
39
+ * Sidebar Group Schema
40
+ */
41
+ export const sidebarGroupSchema: Type = type({
42
+ title: "string >= 1",
43
+ items: "unknown[]",
44
+ });
45
+
46
+ export const validateNavItem = (
47
+ i: NavItem,
48
+ path: string,
49
+ ): Result<NavItem, ReturnType<typeof validationError>> => {
50
+ const result = navItemSchema(i);
51
+ if (result instanceof type.errors) {
52
+ return err(validationError(result.summary, { path }));
53
+ }
54
+ return ok(i);
55
+ };
56
+
57
+ export const validateNavSection = (
58
+ s: NavSection,
59
+ path: string,
60
+ ): Result<NavSection, ReturnType<typeof validationError>> => {
61
+ const result = navSectionSchema(s);
62
+ if (result instanceof type.errors) {
63
+ return err(validationError(result.summary, { path }));
64
+ }
65
+ return ok(s);
66
+ };
67
+
68
+ export const validateSidebarItem = (
69
+ i: SidebarItem,
70
+ path: string,
71
+ ): Result<SidebarItem, ReturnType<typeof validationError>> => {
72
+ const result = sidebarItemSchema(i);
73
+ if (result instanceof type.errors) {
74
+ return err(validationError(result.summary, { path }));
75
+ }
76
+ return ok(i);
77
+ };
78
+
79
+ export const validateSidebarGroup = (
80
+ g: SidebarGroup,
81
+ path: string,
82
+ ): Result<SidebarGroup, ReturnType<typeof validationError>> => {
83
+ const result = sidebarGroupSchema(g);
84
+ if (result instanceof type.errors) {
85
+ return err(validationError(result.summary, { path }));
86
+ }
87
+ return ok(g);
88
+ };