@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,36 @@
1
+ /**
2
+ * Domain models for code block enhancements
3
+ */
4
+ export interface CodeBlock {
5
+ readonly id: string;
6
+ readonly language: string;
7
+ readonly code: string;
8
+ readonly lineNumbers: boolean;
9
+ readonly syntaxHighlighting: boolean;
10
+ }
11
+
12
+ export interface CodeEnhancement {
13
+ readonly type: "copy" | "download" | "fullscreen" | "line-highlight";
14
+ readonly enabled: boolean;
15
+ }
16
+
17
+ export const createCodeBlock = (
18
+ id: string,
19
+ language: string,
20
+ code: string,
21
+ options?: { lineNumbers?: boolean; syntaxHighlighting?: boolean },
22
+ ): CodeBlock => ({
23
+ id,
24
+ language,
25
+ code,
26
+ lineNumbers: options?.lineNumbers ?? true,
27
+ syntaxHighlighting: options?.syntaxHighlighting ?? true,
28
+ });
29
+
30
+ export const createCodeEnhancement = (
31
+ type: CodeEnhancement["type"],
32
+ enabled: boolean,
33
+ ): CodeEnhancement => ({
34
+ type,
35
+ enabled,
36
+ });
@@ -0,0 +1,50 @@
1
+ // Code Block Enhancements Domain Schemas - Arktype validation schemas
2
+ // Following /follow-arktype workflow for type-safe runtime validation
3
+
4
+ import { type Type, type } from "arktype";
5
+
6
+ /**
7
+ * Language Schema
8
+ */
9
+ export const languageSchema: Type = type("string >= 1");
10
+
11
+ export type Language = typeof languageSchema.infer;
12
+
13
+ /**
14
+ * Code Schema
15
+ */
16
+ export const codeSchema: Type = type("string");
17
+
18
+ export type Code = typeof codeSchema.infer;
19
+
20
+ /**
21
+ * Validation errors
22
+ */
23
+ export class ValidationError extends Error {
24
+ constructor(message: string) {
25
+ super(message);
26
+ this.name = "ValidationError";
27
+ }
28
+ }
29
+
30
+ /**
31
+ * Validate language using Arktype
32
+ */
33
+ export const validateLanguage = (language: unknown): Language => {
34
+ const result = languageSchema(language);
35
+ if (result instanceof type.errors) {
36
+ throw new ValidationError("Language must be a non-empty string");
37
+ }
38
+ return result as Language;
39
+ };
40
+
41
+ /**
42
+ * Validate code using Arktype
43
+ */
44
+ export const validateCode = (code: unknown): Code => {
45
+ const result = codeSchema(code);
46
+ if (result instanceof type.errors) {
47
+ throw new ValidationError("Code must be a string");
48
+ }
49
+ return result as Code;
50
+ };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Code Block Enhancements Module
3
+ *
4
+ * Code block enhancements for documentation
5
+ */
6
+
7
+ export { enhanceCodeBlocks } from "./application/usecases";
8
+ export * from "./domain";
9
+ export * from "./ports";
10
+ export * from "./types";
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Code Block Enhancements Ports
3
+ *
4
+ * Module-specific interfaces for code block enhancements
5
+ */
6
+
7
+ import type { CodeBlock, CodeBlockOptions } from "../types";
8
+
9
+ /**
10
+ * Syntax highlighter interface
11
+ */
12
+ export interface SyntaxHighlighter {
13
+ /** Highlight code with language */
14
+ highlight(code: string, language: string): Promise<string>;
15
+ }
16
+
17
+ // Re-export types for convenience
18
+ export type { CodeBlock, CodeBlockOptions };
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Code Block Enhancements Types
3
+ *
4
+ * Domain types for code block enhancements
5
+ */
6
+
7
+ /**
8
+ * Code block
9
+ */
10
+ export interface CodeBlock {
11
+ /** Code content */
12
+ code: string;
13
+ /** Language */
14
+ language?: string;
15
+ /** Line numbers */
16
+ lineNumbers?: boolean;
17
+ /** Highlight lines */
18
+ highlightLines?: number[];
19
+ /** File name */
20
+ filename?: string;
21
+ }
22
+
23
+ /**
24
+ * Code block options
25
+ */
26
+ export interface CodeBlockOptions {
27
+ /** Enable line numbers */
28
+ lineNumbers?: boolean;
29
+ /** Highlight lines */
30
+ highlightLines?: number[];
31
+ /** Add copy button */
32
+ copyButton?: boolean;
33
+ /** Add filename */
34
+ filename?: string;
35
+ /** Theme */
36
+ theme?: "light" | "dark" | "auto";
37
+ }
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Sandbox adapter implementation.
3
+ * Provides a safe placeholder for isolated code execution.
4
+ */
5
+
6
+ import { configError, pluginError } from "@create-docs/shared/errors";
7
+ import type { ExecutionPort } from "../ports/execution-port";
8
+ import type { CodeExecutionConfig } from "../types/execution";
9
+
10
+ const SANDBOX_MISSING_ERROR =
11
+ "Sandbox dependency is not installed. Isolated code execution requires a sandbox package such as vm2 or isolated-vm.";
12
+
13
+ export const createSandboxAdapter = (): ExecutionPort => ({
14
+ execute: async (code: string, _config?: unknown) => {
15
+ const cfg = _config as Partial<CodeExecutionConfig> | undefined;
16
+
17
+ if (cfg?.enabled === false) {
18
+ throw configError("Code execution is disabled", {
19
+ context: { enabled: false },
20
+ });
21
+ }
22
+
23
+ if (!cfg?.sandbox) {
24
+ throw configError("Code execution config requires sandbox: true", {
25
+ context: { config: cfg },
26
+ hint: "Enable sandbox in the execution config, or install a sandbox package.",
27
+ });
28
+ }
29
+
30
+ throw pluginError(SANDBOX_MISSING_ERROR, {
31
+ context: { codeLength: code.length },
32
+ hint: "Install an isolated execution sandbox and configure it before running code.",
33
+ });
34
+ },
35
+
36
+ validate: async (_code: string) => {
37
+ throw pluginError(
38
+ "Code validation cannot be performed safely without an isolated sandbox environment.",
39
+ {
40
+ hint: "Install a sandbox package and configure it before validating code.",
41
+ },
42
+ );
43
+ },
44
+ });
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Domain events for code execution
3
+ */
4
+ export interface ExecutionStartedEvent {
5
+ readonly type: "EXECUTION_STARTED";
6
+ readonly timestamp: number;
7
+ readonly executionId: string;
8
+ }
9
+
10
+ export interface ExecutionCompletedEvent {
11
+ readonly type: "EXECUTION_COMPLETED";
12
+ readonly timestamp: number;
13
+ readonly executionId: string;
14
+ readonly output: string;
15
+ }
16
+
17
+ export interface ExecutionFailedEvent {
18
+ readonly type: "EXECUTION_FAILED";
19
+ readonly timestamp: number;
20
+ readonly executionId: string;
21
+ readonly error: string;
22
+ }
23
+
24
+ export type CodeExecutionDomainEvent =
25
+ | ExecutionStartedEvent
26
+ | ExecutionCompletedEvent
27
+ | ExecutionFailedEvent;
28
+
29
+ export const createExecutionStartedEvent = (
30
+ executionId: string,
31
+ now: number = Date.now(),
32
+ ): ExecutionStartedEvent => ({
33
+ type: "EXECUTION_STARTED",
34
+ timestamp: now,
35
+ executionId,
36
+ });
37
+
38
+ export const createExecutionCompletedEvent = (
39
+ executionId: string,
40
+ output: string,
41
+ now: number = Date.now(),
42
+ ): ExecutionCompletedEvent => ({
43
+ type: "EXECUTION_COMPLETED",
44
+ timestamp: now,
45
+ executionId,
46
+ output,
47
+ });
48
+
49
+ export const createExecutionFailedEvent = (
50
+ executionId: string,
51
+ error: string,
52
+ now: number = Date.now(),
53
+ ): ExecutionFailedEvent => ({
54
+ type: "EXECUTION_FAILED",
55
+ timestamp: now,
56
+ executionId,
57
+ error,
58
+ });
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Domain models for code execution
3
+ */
4
+ export interface CodeExecution {
5
+ readonly id: string;
6
+ readonly language: string;
7
+ readonly code: string;
8
+ readonly output?: string;
9
+ readonly error?: string;
10
+ readonly status: "pending" | "running" | "completed" | "failed";
11
+ readonly timestamp: number;
12
+ }
13
+
14
+ export const createCodeExecution = (
15
+ id: string,
16
+ language: string,
17
+ code: string,
18
+ options?: {
19
+ output?: string;
20
+ error?: string;
21
+ status?: CodeExecution["status"];
22
+ timestamp?: number;
23
+ },
24
+ now: number = Date.now(),
25
+ ): CodeExecution => ({
26
+ id,
27
+ language,
28
+ code,
29
+ output: options?.output,
30
+ error: options?.error,
31
+ status: options?.status ?? "pending",
32
+ timestamp: options?.timestamp ?? now,
33
+ });
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Pure code execution 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 {
9
+ CodeExecutionConfig,
10
+ ExecutionResult,
11
+ } from "../../types/execution";
12
+
13
+ export type ExecutionError = {
14
+ readonly kind: "execution-error";
15
+ readonly message: string;
16
+ };
17
+
18
+ /**
19
+ * Execute code in sandbox.
20
+ */
21
+ export const executeCode = (
22
+ _code: string,
23
+ _config: CodeExecutionConfig,
24
+ ): Result<ExecutionResult, ExecutionError> => {
25
+ try {
26
+ // This will be implemented via adapter
27
+ // For now, return a basic result
28
+ return ok({
29
+ output: "",
30
+ error: null,
31
+ exitCode: 0,
32
+ });
33
+ } catch (error) {
34
+ return err({
35
+ kind: "execution-error",
36
+ message: error instanceof Error ? error.message : "Unknown error",
37
+ });
38
+ }
39
+ };
40
+
41
+ /**
42
+ * Validate code before execution.
43
+ */
44
+ export const validateCode = (code: string): boolean => {
45
+ // Basic validation - check for dangerous operations
46
+ const dangerousPatterns = [
47
+ /require\s*\(\s*['"]child_process['"]\s*\)/,
48
+ /require\s*\(\s*['"]fs['"]\s*\)/,
49
+ /eval\s*\(/,
50
+ /Function\s*\(/,
51
+ ];
52
+
53
+ for (const pattern of dangerousPatterns) {
54
+ if (pattern.test(code)) {
55
+ return false;
56
+ }
57
+ }
58
+
59
+ return true;
60
+ };
@@ -0,0 +1,50 @@
1
+ // Code Execution Domain Schemas - Arktype validation schemas
2
+ // Following /follow-arktype workflow for type-safe runtime validation
3
+
4
+ import { type Type, type } from "arktype";
5
+
6
+ /**
7
+ * Language Schema
8
+ */
9
+ export const languageSchema: Type = type("string >= 1");
10
+
11
+ export type Language = typeof languageSchema.infer;
12
+
13
+ /**
14
+ * Code Schema
15
+ */
16
+ export const codeSchema: Type = type("string >= 1");
17
+
18
+ export type Code = typeof codeSchema.infer;
19
+
20
+ /**
21
+ * Validation errors
22
+ */
23
+ export class ValidationError extends Error {
24
+ constructor(message: string) {
25
+ super(message);
26
+ this.name = "ValidationError";
27
+ }
28
+ }
29
+
30
+ /**
31
+ * Validate language using Arktype
32
+ */
33
+ export const validateLanguage = (language: unknown): Language => {
34
+ const result = languageSchema(language);
35
+ if (result instanceof type.errors) {
36
+ throw new ValidationError("Language must be a non-empty string");
37
+ }
38
+ return result as Language;
39
+ };
40
+
41
+ /**
42
+ * Validate code using Arktype
43
+ */
44
+ export const validateCode = (code: unknown): Code => {
45
+ const result = codeSchema(code);
46
+ if (result instanceof type.errors) {
47
+ throw new ValidationError("Code must be a non-empty string");
48
+ }
49
+ return result as Code;
50
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Public API for the code-execution module.
3
+ */
4
+
5
+ export { createSandboxAdapter } from "./application/sandbox-adapter";
6
+ export * from "./domain/operations/execution-operations";
7
+ export * from "./ports/execution-port";
8
+ export * from "./types/execution";
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Port for code execution operations.
3
+ */
4
+
5
+ export type ExecutionPort = {
6
+ /**
7
+ * Execute code in sandbox.
8
+ */
9
+ readonly execute: (code: string, config: unknown) => Promise<unknown>;
10
+
11
+ /**
12
+ * Validate code for safety.
13
+ */
14
+ readonly validate: (code: string) => Promise<boolean>;
15
+ };
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Code execution types for interactive code blocks.
3
+ */
4
+
5
+ export type CodeExecutionConfig = {
6
+ readonly enabled: boolean;
7
+ readonly timeout: number;
8
+ readonly sandbox: boolean;
9
+ };
10
+
11
+ export type ExecutionResult = {
12
+ readonly output: string;
13
+ readonly error: string | null;
14
+ readonly exitCode: number;
15
+ };
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Giscus adapter implementation.
3
+ * Provides a safe server-side placeholder for Giscus comment integration.
4
+ */
5
+
6
+ import { configError, pluginError } from "@create-docs/shared/errors";
7
+ import type { CommentPort } from "../ports/comment-port";
8
+
9
+ type GiscusConfig = {
10
+ readonly category?: string;
11
+ readonly categoryId?: string;
12
+ };
13
+
14
+ export const createGiscusAdapter = (
15
+ repo: string,
16
+ repoId: string,
17
+ ): CommentPort => {
18
+ if (!repo.trim() || !repoId.trim()) {
19
+ throw configError("Giscus repo and repoId are required", {
20
+ context: { repo, repoId },
21
+ hint: "Pass a GitHub repo identifier and giscus repoId.",
22
+ });
23
+ }
24
+
25
+ return {
26
+ load: async (pageId: string, config?: unknown) => {
27
+ const cfg = config as GiscusConfig | undefined;
28
+
29
+ if (!cfg?.category && !cfg?.categoryId) {
30
+ throw configError("Giscus category or categoryId is required", {
31
+ context: { repo, repoId, pageId },
32
+ hint: "Set category and categoryId in the comment config.",
33
+ });
34
+ }
35
+
36
+ throw pluginError(
37
+ "Giscus comments require the @giscus/react client component and a GitHub Discussions repository.",
38
+ {
39
+ context: { repo, repoId, pageId },
40
+ hint: "Install and configure @giscus/react, or switch to a different comment provider.",
41
+ },
42
+ );
43
+ },
44
+
45
+ submit: async (_comment: unknown, _config?: unknown) => {
46
+ throw pluginError(
47
+ "Giscus submission requires the @giscus/react client component.",
48
+ {
49
+ context: { repo, repoId },
50
+ hint: "Install and configure @giscus/react, or switch to a different comment provider.",
51
+ },
52
+ );
53
+ },
54
+ };
55
+ };
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Domain events for comments
3
+ */
4
+ export interface CommentAddedEvent {
5
+ readonly type: "COMMENT_ADDED";
6
+ readonly timestamp: number;
7
+ readonly commentId: string;
8
+ readonly author: string;
9
+ }
10
+
11
+ export interface CommentUpdatedEvent {
12
+ readonly type: "COMMENT_UPDATED";
13
+ readonly timestamp: number;
14
+ readonly commentId: string;
15
+ }
16
+
17
+ export interface CommentDeletedEvent {
18
+ readonly type: "COMMENT_DELETED";
19
+ readonly timestamp: number;
20
+ readonly commentId: string;
21
+ }
22
+
23
+ export type CommentsDomainEvent =
24
+ | CommentAddedEvent
25
+ | CommentUpdatedEvent
26
+ | CommentDeletedEvent;
27
+
28
+ export const createCommentAddedEvent = (
29
+ commentId: string,
30
+ author: string,
31
+ now: number = Date.now(),
32
+ ): CommentAddedEvent => ({
33
+ type: "COMMENT_ADDED",
34
+ timestamp: now,
35
+ commentId,
36
+ author,
37
+ });
38
+
39
+ export const createCommentUpdatedEvent = (
40
+ commentId: string,
41
+ now: number = Date.now(),
42
+ ): CommentUpdatedEvent => ({
43
+ type: "COMMENT_UPDATED",
44
+ timestamp: now,
45
+ commentId,
46
+ });
47
+
48
+ export const createCommentDeletedEvent = (
49
+ commentId: string,
50
+ now: number = Date.now(),
51
+ ): CommentDeletedEvent => ({
52
+ type: "COMMENT_DELETED",
53
+ timestamp: now,
54
+ commentId,
55
+ });
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Domain models for comments
3
+ */
4
+ export interface Comment {
5
+ readonly id: string;
6
+ readonly author: string;
7
+ readonly content: string;
8
+ readonly timestamp: number;
9
+ readonly parentId?: string;
10
+ readonly replies?: readonly Comment[];
11
+ }
12
+
13
+ export const createComment = (
14
+ id: string,
15
+ author: string,
16
+ content: string,
17
+ options?: {
18
+ parentId?: string;
19
+ replies?: readonly Comment[];
20
+ timestamp?: number;
21
+ },
22
+ now: number = Date.now(),
23
+ ): Comment => ({
24
+ id,
25
+ author,
26
+ content,
27
+ parentId: options?.parentId,
28
+ replies: options?.replies,
29
+ timestamp: options?.timestamp ?? now,
30
+ });
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Pure comment 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 { Comment, CommentConfig } from "../../types/comments";
9
+
10
+ export type CommentError = {
11
+ readonly kind: "comment-error";
12
+ readonly message: string;
13
+ };
14
+
15
+ /**
16
+ * Validate comment content.
17
+ */
18
+ export const validateComment = (content: string): boolean => {
19
+ if (content.length === 0) return false;
20
+ if (content.length > 5000) return false;
21
+ return true;
22
+ };
23
+
24
+ /**
25
+ * Format comment for display.
26
+ */
27
+ export const formatComment = (comment: Comment): string => {
28
+ return comment.content;
29
+ };
30
+
31
+ /**
32
+ * Get comment widget config.
33
+ */
34
+ export const getCommentWidgetConfig = (
35
+ _config: CommentConfig,
36
+ ): Result<unknown, CommentError> => {
37
+ try {
38
+ // This will be implemented via adapter
39
+ return ok({});
40
+ } catch (error) {
41
+ return err({
42
+ kind: "comment-error",
43
+ message: error instanceof Error ? error.message : "Unknown error",
44
+ });
45
+ }
46
+ };
@@ -0,0 +1,50 @@
1
+ // Comments Domain Schemas - Arktype validation schemas
2
+ // Following /follow-arktype workflow for type-safe runtime validation
3
+
4
+ import { type Type, type } from "arktype";
5
+
6
+ /**
7
+ * Author Schema
8
+ */
9
+ export const authorSchema: Type = type("string >= 1");
10
+
11
+ export type Author = typeof authorSchema.infer;
12
+
13
+ /**
14
+ * Content Schema
15
+ */
16
+ export const contentSchema: Type = type("string >= 1");
17
+
18
+ export type Content = typeof contentSchema.infer;
19
+
20
+ /**
21
+ * Validation errors
22
+ */
23
+ export class ValidationError extends Error {
24
+ constructor(message: string) {
25
+ super(message);
26
+ this.name = "ValidationError";
27
+ }
28
+ }
29
+
30
+ /**
31
+ * Validate author using Arktype
32
+ */
33
+ export const validateAuthor = (author: unknown): Author => {
34
+ const result = authorSchema(author);
35
+ if (result instanceof type.errors) {
36
+ throw new ValidationError("Author must be a non-empty string");
37
+ }
38
+ return result as Author;
39
+ };
40
+
41
+ /**
42
+ * Validate content using Arktype
43
+ */
44
+ export const validateContent = (content: unknown): Content => {
45
+ const result = contentSchema(content);
46
+ if (result instanceof type.errors) {
47
+ throw new ValidationError("Content must be a non-empty string");
48
+ }
49
+ return result as Content;
50
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Public API for the comments module.
3
+ */
4
+
5
+ export { createGiscusAdapter } from "./application/giscus-adapter";
6
+ export * from "./domain/operations/comment-operations";
7
+ export * from "./ports/comment-port";
8
+ export * from "./types/comments";