blodemd 0.1.0 → 0.2.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 (289) hide show
  1. package/dist/cli.mjs +50 -174
  2. package/dist/cli.mjs.map +1 -1
  3. package/package.json +3 -36
  4. package/dev-server/app/[[...slug]]/page.tsx +0 -140
  5. package/dev-server/app/blodemd-dev/invalidate/route.ts +0 -12
  6. package/dev-server/app/blodemd-dev/static/[...path]/route.ts +0 -32
  7. package/dev-server/app/blodemd-dev/version/route.ts +0 -14
  8. package/dev-server/app/blodemd-internal/proxy/route.ts +0 -86
  9. package/dev-server/app/error.tsx +0 -24
  10. package/dev-server/app/favicon.ico +0 -0
  11. package/dev-server/app/globals.css +0 -4
  12. package/dev-server/app/layout.tsx +0 -38
  13. package/dev-server/app/not-found.tsx +0 -18
  14. package/dev-server/app/search/route.ts +0 -17
  15. package/dev-server/components/dev-reload-script.tsx +0 -86
  16. package/dev-server/components/providers.tsx +0 -15
  17. package/dev-server/lib/dev-state.ts +0 -8
  18. package/dev-server/lib/local-content-source.ts +0 -103
  19. package/dev-server/lib/local-runtime.tsx +0 -555
  20. package/dev-server/next-env.d.ts +0 -5
  21. package/dev-server/next.config.js +0 -54
  22. package/dev-server/package.json +0 -61
  23. package/dev-server/postcss.config.mjs +0 -7
  24. package/dev-server/public/glide-variable.woff2 +0 -0
  25. package/dev-server/tsconfig.json +0 -50
  26. package/docs/app/globals.css +0 -471
  27. package/docs/components/animate-ui/primitives/buttons/button.tsx +0 -14
  28. package/docs/components/api/api-playground.tsx +0 -467
  29. package/docs/components/api/api-reference.tsx +0 -157
  30. package/docs/components/content/collection-index.tsx +0 -114
  31. package/docs/components/docs/contextual-menu.tsx +0 -495
  32. package/docs/components/docs/copy-page-menu.tsx +0 -364
  33. package/docs/components/docs/doc-header.tsx +0 -223
  34. package/docs/components/docs/doc-shell.tsx +0 -355
  35. package/docs/components/docs/doc-sidebar.tsx +0 -256
  36. package/docs/components/docs/doc-toc.tsx +0 -46
  37. package/docs/components/docs/mobile-nav.tsx +0 -195
  38. package/docs/components/docs/sidebar-active-highlight.tsx +0 -34
  39. package/docs/components/docs/sidebar-scroll-area.tsx +0 -63
  40. package/docs/components/git/repo-picker.tsx +0 -529
  41. package/docs/components/icons/doc-icon.tsx +0 -96
  42. package/docs/components/mdx/accordion.tsx +0 -83
  43. package/docs/components/mdx/agent-instructions.tsx +0 -17
  44. package/docs/components/mdx/badge.tsx +0 -79
  45. package/docs/components/mdx/callout.tsx +0 -88
  46. package/docs/components/mdx/card.tsx +0 -110
  47. package/docs/components/mdx/code-block.tsx +0 -80
  48. package/docs/components/mdx/code-group.tsx +0 -203
  49. package/docs/components/mdx/color.tsx +0 -87
  50. package/docs/components/mdx/columns.tsx +0 -25
  51. package/docs/components/mdx/expandable.tsx +0 -45
  52. package/docs/components/mdx/field-layout.tsx +0 -77
  53. package/docs/components/mdx/frame.tsx +0 -23
  54. package/docs/components/mdx/get-text-content.ts +0 -18
  55. package/docs/components/mdx/icon.tsx +0 -12
  56. package/docs/components/mdx/iframe.tsx +0 -62
  57. package/docs/components/mdx/index.tsx +0 -121
  58. package/docs/components/mdx/installer.tsx +0 -20
  59. package/docs/components/mdx/panel.tsx +0 -11
  60. package/docs/components/mdx/param-field.tsx +0 -56
  61. package/docs/components/mdx/preview.tsx +0 -36
  62. package/docs/components/mdx/prompt.tsx +0 -63
  63. package/docs/components/mdx/request-example.tsx +0 -27
  64. package/docs/components/mdx/response-field.tsx +0 -42
  65. package/docs/components/mdx/steps.tsx +0 -92
  66. package/docs/components/mdx/tabs.tsx +0 -193
  67. package/docs/components/mdx/tile.tsx +0 -43
  68. package/docs/components/mdx/tooltip.tsx +0 -71
  69. package/docs/components/mdx/tree.tsx +0 -120
  70. package/docs/components/mdx/type-table.tsx +0 -71
  71. package/docs/components/mdx/update.tsx +0 -44
  72. package/docs/components/mdx/video.tsx +0 -45
  73. package/docs/components/mdx/view.tsx +0 -66
  74. package/docs/components/posthog-provider.tsx +0 -42
  75. package/docs/components/providers.tsx +0 -15
  76. package/docs/components/tenant-analytics.tsx +0 -49
  77. package/docs/components/third-parties.tsx +0 -32
  78. package/docs/components/ui/badge.tsx +0 -61
  79. package/docs/components/ui/breadcrumb.tsx +0 -112
  80. package/docs/components/ui/button-group.tsx +0 -83
  81. package/docs/components/ui/button.tsx +0 -65
  82. package/docs/components/ui/card.tsx +0 -92
  83. package/docs/components/ui/command.tsx +0 -167
  84. package/docs/components/ui/copy-button.tsx +0 -129
  85. package/docs/components/ui/dialog.tsx +0 -146
  86. package/docs/components/ui/field.tsx +0 -237
  87. package/docs/components/ui/input.tsx +0 -23
  88. package/docs/components/ui/kbd.tsx +0 -98
  89. package/docs/components/ui/label.tsx +0 -22
  90. package/docs/components/ui/morph-icon.tsx +0 -79
  91. package/docs/components/ui/popover.tsx +0 -267
  92. package/docs/components/ui/search-dialog.tsx +0 -431
  93. package/docs/components/ui/search.tsx +0 -101
  94. package/docs/components/ui/separator.tsx +0 -26
  95. package/docs/components/ui/sheet.tsx +0 -133
  96. package/docs/components/ui/sidebar.tsx +0 -758
  97. package/docs/components/ui/skeleton.tsx +0 -11
  98. package/docs/components/ui/switch.tsx +0 -32
  99. package/docs/components/ui/tabs.tsx +0 -138
  100. package/docs/components/ui/theme-toggle.tsx +0 -62
  101. package/docs/components/ui/tooltip.tsx +0 -53
  102. package/docs/components/web-mcp.tsx +0 -115
  103. package/docs/lib/agent-skills.ts +0 -48
  104. package/docs/lib/api-client.ts +0 -72
  105. package/docs/lib/config.ts +0 -6
  106. package/docs/lib/content-root.ts +0 -33
  107. package/docs/lib/content-source.ts +0 -70
  108. package/docs/lib/contextual-options.ts +0 -222
  109. package/docs/lib/dashboard-session.ts +0 -167
  110. package/docs/lib/db.ts +0 -13
  111. package/docs/lib/docs-collection.ts +0 -7
  112. package/docs/lib/docs-runtime.tsx +0 -745
  113. package/docs/lib/edge-config.ts +0 -95
  114. package/docs/lib/env.ts +0 -23
  115. package/docs/lib/etag.ts +0 -22
  116. package/docs/lib/github-install.ts +0 -33
  117. package/docs/lib/llms-full.ts +0 -82
  118. package/docs/lib/marketing-markdown.ts +0 -79
  119. package/docs/lib/marketing-site.ts +0 -31
  120. package/docs/lib/mdx.ts +0 -98
  121. package/docs/lib/navigation.ts +0 -288
  122. package/docs/lib/openapi-proxy.ts +0 -88
  123. package/docs/lib/openapi.ts +0 -158
  124. package/docs/lib/platform-config.ts +0 -6
  125. package/docs/lib/project-authz.ts +0 -46
  126. package/docs/lib/routes.ts +0 -103
  127. package/docs/lib/server-cache.ts +0 -83
  128. package/docs/lib/shiki.ts +0 -44
  129. package/docs/lib/supabase.ts +0 -37
  130. package/docs/lib/tenancy.ts +0 -364
  131. package/docs/lib/tenant-headers.ts +0 -43
  132. package/docs/lib/tenant-static.ts +0 -705
  133. package/docs/lib/tenant-utility-context.ts +0 -62
  134. package/docs/lib/tenants.ts +0 -72
  135. package/docs/lib/theme.ts +0 -29
  136. package/docs/lib/time-ago.ts +0 -24
  137. package/docs/lib/toc.ts +0 -2
  138. package/docs/lib/use-mobile.ts +0 -19
  139. package/docs/lib/use-tab-observer.ts +0 -71
  140. package/docs/lib/utils.ts +0 -5
  141. package/packages/@repo/common/dist/index.d.ts +0 -16
  142. package/packages/@repo/common/dist/index.d.ts.map +0 -1
  143. package/packages/@repo/common/dist/index.js +0 -84
  144. package/packages/@repo/common/package.json +0 -34
  145. package/packages/@repo/common/src/index.ts +0 -101
  146. package/packages/@repo/contracts/dist/analytics.d.ts +0 -21
  147. package/packages/@repo/contracts/dist/analytics.d.ts.map +0 -1
  148. package/packages/@repo/contracts/dist/analytics.js +0 -18
  149. package/packages/@repo/contracts/dist/api-key.d.ts +0 -27
  150. package/packages/@repo/contracts/dist/api-key.d.ts.map +0 -1
  151. package/packages/@repo/contracts/dist/api-key.js +0 -20
  152. package/packages/@repo/contracts/dist/dates.d.ts +0 -4
  153. package/packages/@repo/contracts/dist/dates.d.ts.map +0 -1
  154. package/packages/@repo/contracts/dist/dates.js +0 -2
  155. package/packages/@repo/contracts/dist/deployment.d.ts +0 -71
  156. package/packages/@repo/contracts/dist/deployment.d.ts.map +0 -1
  157. package/packages/@repo/contracts/dist/deployment.js +0 -46
  158. package/packages/@repo/contracts/dist/domain.d.ts +0 -94
  159. package/packages/@repo/contracts/dist/domain.d.ts.map +0 -1
  160. package/packages/@repo/contracts/dist/domain.js +0 -36
  161. package/packages/@repo/contracts/dist/git.d.ts +0 -28
  162. package/packages/@repo/contracts/dist/git.d.ts.map +0 -1
  163. package/packages/@repo/contracts/dist/git.js +0 -24
  164. package/packages/@repo/contracts/dist/ids.d.ts +0 -14
  165. package/packages/@repo/contracts/dist/ids.d.ts.map +0 -1
  166. package/packages/@repo/contracts/dist/ids.js +0 -11
  167. package/packages/@repo/contracts/dist/index.d.ts +0 -12
  168. package/packages/@repo/contracts/dist/index.d.ts.map +0 -1
  169. package/packages/@repo/contracts/dist/index.js +0 -13
  170. package/packages/@repo/contracts/dist/pagination.d.ts +0 -23
  171. package/packages/@repo/contracts/dist/pagination.d.ts.map +0 -1
  172. package/packages/@repo/contracts/dist/pagination.js +0 -15
  173. package/packages/@repo/contracts/dist/project.d.ts +0 -42
  174. package/packages/@repo/contracts/dist/project.d.ts.map +0 -1
  175. package/packages/@repo/contracts/dist/project.js +0 -25
  176. package/packages/@repo/contracts/dist/tenant.d.ts +0 -147
  177. package/packages/@repo/contracts/dist/tenant.d.ts.map +0 -1
  178. package/packages/@repo/contracts/dist/tenant.js +0 -58
  179. package/packages/@repo/contracts/dist/user.d.ts +0 -9
  180. package/packages/@repo/contracts/dist/user.d.ts.map +0 -1
  181. package/packages/@repo/contracts/dist/user.js +0 -9
  182. package/packages/@repo/contracts/package.json +0 -37
  183. package/packages/@repo/contracts/src/analytics.ts +0 -33
  184. package/packages/@repo/contracts/src/api-key.ts +0 -27
  185. package/packages/@repo/contracts/src/dates.ts +0 -4
  186. package/packages/@repo/contracts/src/deployment.ts +0 -73
  187. package/packages/@repo/contracts/src/domain.ts +0 -51
  188. package/packages/@repo/contracts/src/git.ts +0 -31
  189. package/packages/@repo/contracts/src/ids.ts +0 -23
  190. package/packages/@repo/contracts/src/index.ts +0 -13
  191. package/packages/@repo/contracts/src/pagination.ts +0 -21
  192. package/packages/@repo/contracts/src/project.ts +0 -32
  193. package/packages/@repo/contracts/src/tenant.ts +0 -94
  194. package/packages/@repo/contracts/src/user.ts +0 -12
  195. package/packages/@repo/models/dist/docs-config.d.ts +0 -961
  196. package/packages/@repo/models/dist/docs-config.d.ts.map +0 -1
  197. package/packages/@repo/models/dist/docs-config.js +0 -531
  198. package/packages/@repo/models/dist/index.d.ts +0 -3
  199. package/packages/@repo/models/dist/index.d.ts.map +0 -1
  200. package/packages/@repo/models/dist/index.js +0 -3
  201. package/packages/@repo/models/dist/tenant.d.ts +0 -37
  202. package/packages/@repo/models/dist/tenant.d.ts.map +0 -1
  203. package/packages/@repo/models/dist/tenant.js +0 -1
  204. package/packages/@repo/models/package.json +0 -37
  205. package/packages/@repo/models/src/docs-config.ts +0 -629
  206. package/packages/@repo/models/src/index.ts +0 -3
  207. package/packages/@repo/models/src/tenant.ts +0 -44
  208. package/packages/@repo/prebuild/dist/index.d.ts +0 -2
  209. package/packages/@repo/prebuild/dist/index.d.ts.map +0 -1
  210. package/packages/@repo/prebuild/dist/index.js +0 -2
  211. package/packages/@repo/prebuild/dist/openapi.d.ts +0 -43
  212. package/packages/@repo/prebuild/dist/openapi.d.ts.map +0 -1
  213. package/packages/@repo/prebuild/dist/openapi.js +0 -86
  214. package/packages/@repo/prebuild/package.json +0 -39
  215. package/packages/@repo/prebuild/src/index.ts +0 -2
  216. package/packages/@repo/prebuild/src/openapi.ts +0 -154
  217. package/packages/@repo/previewing/dist/blob-source.d.ts +0 -16
  218. package/packages/@repo/previewing/dist/blob-source.d.ts.map +0 -1
  219. package/packages/@repo/previewing/dist/blob-source.js +0 -128
  220. package/packages/@repo/previewing/dist/config-loader.d.ts +0 -134
  221. package/packages/@repo/previewing/dist/config-loader.d.ts.map +0 -1
  222. package/packages/@repo/previewing/dist/config-loader.js +0 -231
  223. package/packages/@repo/previewing/dist/constants.d.ts +0 -15
  224. package/packages/@repo/previewing/dist/constants.d.ts.map +0 -1
  225. package/packages/@repo/previewing/dist/constants.js +0 -14
  226. package/packages/@repo/previewing/dist/content-index.d.ts +0 -7
  227. package/packages/@repo/previewing/dist/content-index.d.ts.map +0 -1
  228. package/packages/@repo/previewing/dist/content-index.js +0 -291
  229. package/packages/@repo/previewing/dist/content-source.d.ts +0 -12
  230. package/packages/@repo/previewing/dist/content-source.d.ts.map +0 -1
  231. package/packages/@repo/previewing/dist/content-source.js +0 -1
  232. package/packages/@repo/previewing/dist/fs-source.d.ts +0 -11
  233. package/packages/@repo/previewing/dist/fs-source.d.ts.map +0 -1
  234. package/packages/@repo/previewing/dist/fs-source.js +0 -71
  235. package/packages/@repo/previewing/dist/index.d.ts +0 -16
  236. package/packages/@repo/previewing/dist/index.d.ts.map +0 -1
  237. package/packages/@repo/previewing/dist/index.js +0 -13
  238. package/packages/@repo/previewing/dist/markdown/agent-markdown.d.ts +0 -3
  239. package/packages/@repo/previewing/dist/markdown/agent-markdown.d.ts.map +0 -1
  240. package/packages/@repo/previewing/dist/markdown/agent-markdown.js +0 -176
  241. package/packages/@repo/previewing/dist/markdown/format.d.ts +0 -8
  242. package/packages/@repo/previewing/dist/markdown/format.d.ts.map +0 -1
  243. package/packages/@repo/previewing/dist/markdown/format.js +0 -43
  244. package/packages/@repo/previewing/dist/markdown/links.d.ts +0 -3
  245. package/packages/@repo/previewing/dist/markdown/links.d.ts.map +0 -1
  246. package/packages/@repo/previewing/dist/markdown/links.js +0 -31
  247. package/packages/@repo/previewing/dist/openapi-pages.d.ts +0 -7
  248. package/packages/@repo/previewing/dist/openapi-pages.d.ts.map +0 -1
  249. package/packages/@repo/previewing/dist/openapi-pages.js +0 -200
  250. package/packages/@repo/previewing/dist/search-index.d.ts +0 -4
  251. package/packages/@repo/previewing/dist/search-index.d.ts.map +0 -1
  252. package/packages/@repo/previewing/dist/search-index.js +0 -23
  253. package/packages/@repo/previewing/dist/serialization.d.ts +0 -13
  254. package/packages/@repo/previewing/dist/serialization.d.ts.map +0 -1
  255. package/packages/@repo/previewing/dist/serialization.js +0 -108
  256. package/packages/@repo/previewing/dist/toc-index.d.ts +0 -5
  257. package/packages/@repo/previewing/dist/toc-index.d.ts.map +0 -1
  258. package/packages/@repo/previewing/dist/toc-index.js +0 -53
  259. package/packages/@repo/previewing/dist/types.d.ts +0 -92
  260. package/packages/@repo/previewing/dist/types.d.ts.map +0 -1
  261. package/packages/@repo/previewing/dist/types.js +0 -1
  262. package/packages/@repo/previewing/dist/utility-index.d.ts +0 -7
  263. package/packages/@repo/previewing/dist/utility-index.d.ts.map +0 -1
  264. package/packages/@repo/previewing/dist/utility-index.js +0 -201
  265. package/packages/@repo/previewing/package.json +0 -41
  266. package/packages/@repo/previewing/src/blob-source.ts +0 -185
  267. package/packages/@repo/previewing/src/config-loader.ts +0 -316
  268. package/packages/@repo/previewing/src/constants.ts +0 -16
  269. package/packages/@repo/previewing/src/content-index.ts +0 -384
  270. package/packages/@repo/previewing/src/content-source.ts +0 -12
  271. package/packages/@repo/previewing/src/fs-source.ts +0 -103
  272. package/packages/@repo/previewing/src/index.ts +0 -71
  273. package/packages/@repo/previewing/src/markdown/agent-markdown.ts +0 -254
  274. package/packages/@repo/previewing/src/markdown/format.ts +0 -63
  275. package/packages/@repo/previewing/src/markdown/links.ts +0 -46
  276. package/packages/@repo/previewing/src/openapi-pages.ts +0 -319
  277. package/packages/@repo/previewing/src/search-index.ts +0 -38
  278. package/packages/@repo/previewing/src/serialization.ts +0 -191
  279. package/packages/@repo/previewing/src/toc-index.ts +0 -72
  280. package/packages/@repo/previewing/src/types.ts +0 -105
  281. package/packages/@repo/previewing/src/utility-index.ts +0 -304
  282. package/packages/@repo/validation/dist/index.d.ts +0 -12
  283. package/packages/@repo/validation/dist/index.d.ts.map +0 -1
  284. package/packages/@repo/validation/dist/index.js +0 -30
  285. package/packages/@repo/validation/package.json +0 -38
  286. package/packages/@repo/validation/src/blodemd-docs-schema.json +0 -3575
  287. package/packages/@repo/validation/src/index.ts +0 -59
  288. package/scripts/prepare-package.mjs +0 -53
  289. package/scripts/repo-packages.mjs +0 -8
@@ -1,555 +0,0 @@
1
- import { createPreviewContentSource } from "@dev/lib/local-content-source";
2
- import { normalizePath } from "@repo/common";
3
- import type { PageMode, SiteConfig } from "@repo/models";
4
- import {
5
- buildContentIndex,
6
- buildPageMetadataMap,
7
- loadSiteConfig,
8
- } from "@repo/previewing";
9
- import type {
10
- ContentIndex,
11
- ContentSource,
12
- PageMetadata,
13
- } from "@repo/previewing";
14
- import { cache } from "react";
15
-
16
- import {
17
- getDocsCollection,
18
- getDocsCollectionWithNavigation,
19
- getDocsNavigation,
20
- } from "@/lib/docs-collection";
21
- import { renderMdx } from "@/lib/mdx";
22
- import {
23
- buildNavigation,
24
- buildTabbedNavigation,
25
- enrichNavWithMetadata,
26
- findActiveTabIndex,
27
- findBreadcrumbs,
28
- flattenNav,
29
- getVisibleNavigation,
30
- } from "@/lib/navigation";
31
- import type { NavEntry, NavPage, NavTab } from "@/lib/navigation";
32
- import { buildOpenApiRegistry } from "@/lib/openapi";
33
- import type { OpenApiRegistry } from "@/lib/openapi";
34
- import { createTimedPromiseCache } from "@/lib/server-cache";
35
- import { extractToc } from "@/lib/toc";
36
-
37
- interface SearchItem {
38
- href?: string;
39
- path: string;
40
- title: string;
41
- }
42
-
43
- interface ConfigErrorResult {
44
- configErrors: string[];
45
- configWarnings: string[];
46
- }
47
-
48
- interface RenderedPageData {
49
- content: Awaited<ReturnType<typeof renderMdx>>["content"];
50
- frontmatter: Awaited<ReturnType<typeof renderMdx>>["frontmatter"];
51
- rawContent: string;
52
- toc: ReturnType<typeof extractToc>;
53
- }
54
-
55
- interface PreviewArtifacts {
56
- anchors: { href: string; label: string }[];
57
- config: SiteConfig;
58
- contentIndex: ContentIndex;
59
- contentSource: ContentSource;
60
- flatNav: NavPage[];
61
- pageMetadataMap: Map<string, PageMetadata>;
62
- registry: OpenApiRegistry;
63
- searchItems: SearchItem[];
64
- tabs: NavTab[] | null;
65
- visibleFlatNav: NavPage[];
66
- visibleNav: NavEntry[];
67
- }
68
-
69
- type PreviewArtifactsResult = ConfigErrorResult | PreviewArtifacts | null;
70
-
71
- const ARTIFACT_CACHE_TTL_MS = 5 * 60 * 1000;
72
- const PAGE_RENDER_CACHE_TTL_MS = 5 * 60 * 1000;
73
- const USE_LOCAL_RUNTIME_CACHE = false;
74
-
75
- const artifactsCache = createTimedPromiseCache<string, PreviewArtifactsResult>({
76
- maxEntries: 32,
77
- ttlMs: ARTIFACT_CACHE_TTL_MS,
78
- });
79
-
80
- const renderedPageCache = createTimedPromiseCache<string, RenderedPageData>({
81
- maxEntries: 512,
82
- ttlMs: PAGE_RENDER_CACHE_TTL_MS,
83
- });
84
-
85
- const ABSOLUTE_URL_REGEX = /^https?:\/\//i;
86
-
87
- const isConfigErrorResult = (
88
- value: PreviewArtifactsResult
89
- ): value is ConfigErrorResult => Boolean(value && "configErrors" in value);
90
-
91
- const resolveAssetUrl = async (
92
- source: ContentSource,
93
- value?: string
94
- ): Promise<string | undefined> => {
95
- if (!value || value.startsWith("/") || ABSOLUTE_URL_REGEX.test(value)) {
96
- return value;
97
- }
98
-
99
- const resolved = await source.resolveUrl?.(value);
100
- return resolved ?? value;
101
- };
102
-
103
- const resolveSiteConfigAssets = async (
104
- config: SiteConfig,
105
- source: ContentSource
106
- ): Promise<SiteConfig> => ({
107
- ...config,
108
- favicon: await resolveAssetUrl(source, config.favicon),
109
- fonts: config.fonts
110
- ? {
111
- ...config.fonts,
112
- cssUrl: await resolveAssetUrl(source, config.fonts.cssUrl),
113
- }
114
- : config.fonts,
115
- logo: config.logo
116
- ? {
117
- ...config.logo,
118
- dark: await resolveAssetUrl(source, config.logo.dark),
119
- light: await resolveAssetUrl(source, config.logo.light),
120
- }
121
- : config.logo,
122
- metadata: config.metadata
123
- ? {
124
- ...config.metadata,
125
- ogImage: await resolveAssetUrl(source, config.metadata.ogImage),
126
- }
127
- : config.metadata,
128
- });
129
-
130
- const buildSearchItems = ({
131
- config,
132
- contentIndex,
133
- flatNav,
134
- pageMetadataMap,
135
- visibleFlatNav,
136
- }: {
137
- config: SiteConfig;
138
- contentIndex: ContentIndex;
139
- flatNav: NavPage[];
140
- pageMetadataMap: Map<string, PageMetadata>;
141
- visibleFlatNav: NavPage[];
142
- }): SearchItem[] => {
143
- const indexAll = config.seo?.indexing === "all";
144
- const searchItems = new Map<string, SearchItem>();
145
-
146
- const shouldAddSearchItem = (
147
- entry: (typeof contentIndex.entries)[number]
148
- ): boolean => {
149
- const pageMeta = pageMetadataMap.get(entry.slug);
150
-
151
- if (pageMeta?.hidden || pageMeta?.noindex) {
152
- return false;
153
- }
154
-
155
- if (!indexAll && entry.kind === "entry" && entry.hidden) {
156
- return false;
157
- }
158
-
159
- return true;
160
- };
161
-
162
- for (const item of visibleFlatNav) {
163
- searchItems.set(item.path, {
164
- href: item.url,
165
- path: item.path,
166
- title: item.sidebarTitle ?? item.title,
167
- });
168
- }
169
-
170
- for (const entry of contentIndex.entries) {
171
- if (!shouldAddSearchItem(entry)) {
172
- continue;
173
- }
174
-
175
- const pageMeta = pageMetadataMap.get(entry.slug);
176
- searchItems.set(entry.slug, {
177
- href: pageMeta?.url,
178
- path: entry.slug,
179
- title: pageMeta?.sidebarTitle ?? entry.title,
180
- });
181
- }
182
-
183
- if (indexAll) {
184
- for (const item of flatNav) {
185
- if (!searchItems.has(item.path)) {
186
- searchItems.set(item.path, {
187
- href: item.url,
188
- path: item.path,
189
- title: item.sidebarTitle ?? item.title,
190
- });
191
- }
192
- }
193
- }
194
-
195
- return [...searchItems.values()];
196
- };
197
-
198
- const buildArtifacts = async (): Promise<PreviewArtifactsResult> => {
199
- const contentSource = createPreviewContentSource();
200
- const configResult = await loadSiteConfig(contentSource);
201
-
202
- if (!configResult.ok) {
203
- return {
204
- configErrors: configResult.errors,
205
- configWarnings: [],
206
- };
207
- }
208
-
209
- const rawConfig = configResult.config;
210
- const docsCollection = getDocsCollection(rawConfig);
211
- const docsNavigation = getDocsNavigation(rawConfig);
212
- const docsCollectionWithNavigation =
213
- getDocsCollectionWithNavigation(rawConfig);
214
-
215
- const [config, contentIndex, registryResult] = await Promise.all([
216
- resolveSiteConfigAssets(rawConfig, contentSource),
217
- buildContentIndex(contentSource, rawConfig),
218
- buildOpenApiRegistry(docsCollectionWithNavigation, contentSource)
219
- .then((registry) => ({ ok: true as const, registry }))
220
- .catch((error: unknown) => ({ error, ok: false as const })),
221
- ]);
222
-
223
- if (contentIndex.errors.length) {
224
- return {
225
- configErrors: contentIndex.errors,
226
- configWarnings: configResult.warnings,
227
- };
228
- }
229
-
230
- if (!registryResult.ok) {
231
- return {
232
- configErrors: [
233
- registryResult.error instanceof Error
234
- ? registryResult.error.message
235
- : "OpenAPI parsing failed.",
236
- ],
237
- configWarnings: configResult.warnings,
238
- };
239
- }
240
-
241
- const pageMetadataMap = buildPageMetadataMap(contentIndex);
242
- const slugPrefix = docsCollection?.slugPrefix ?? "";
243
- const rawNav = docsNavigation
244
- ? buildNavigation(docsNavigation, registryResult.registry, slugPrefix)
245
- : [];
246
- const nav = enrichNavWithMetadata(rawNav, pageMetadataMap);
247
- const visibleNav = getVisibleNavigation(nav);
248
- const flatNav = flattenNav(nav);
249
- const visibleFlatNav = flattenNav(visibleNav);
250
- const rawTabs = buildTabbedNavigation(
251
- docsNavigation,
252
- registryResult.registry,
253
- slugPrefix
254
- );
255
- const tabs =
256
- rawTabs?.map((tab) => ({
257
- ...tab,
258
- entries: enrichNavWithMetadata(tab.entries, pageMetadataMap),
259
- })) ?? null;
260
-
261
- return {
262
- anchors: docsNavigation?.global?.anchors ?? [],
263
- config,
264
- contentIndex,
265
- contentSource,
266
- flatNav,
267
- pageMetadataMap,
268
- registry: registryResult.registry,
269
- searchItems: buildSearchItems({
270
- config,
271
- contentIndex,
272
- flatNav,
273
- pageMetadataMap,
274
- visibleFlatNav,
275
- }),
276
- tabs,
277
- visibleFlatNav,
278
- visibleNav,
279
- };
280
- };
281
-
282
- // Memoized per request so metadata + page render + content fetch share one
283
- // artifact build instead of rebuilding it on each call within a request.
284
- const getArtifacts = cache(async () =>
285
- USE_LOCAL_RUNTIME_CACHE
286
- ? await artifactsCache.getOrCreate("preview", buildArtifacts)
287
- : await buildArtifacts()
288
- );
289
-
290
- const buildRenderedPageData = async ({
291
- artifacts,
292
- relativePath,
293
- useToc,
294
- }: {
295
- artifacts: PreviewArtifacts;
296
- relativePath: string;
297
- useToc: boolean;
298
- }): Promise<RenderedPageData> => {
299
- const rawContent = await artifacts.contentSource.readFile(relativePath);
300
- const { content, frontmatter } = await renderMdx(rawContent);
301
-
302
- return {
303
- content,
304
- frontmatter,
305
- rawContent,
306
- toc: useToc ? extractToc(rawContent) : [],
307
- };
308
- };
309
-
310
- const getRenderedPageData = async ({
311
- artifacts,
312
- currentPath,
313
- relativePath,
314
- useToc,
315
- }: {
316
- artifacts: PreviewArtifacts;
317
- currentPath: string;
318
- relativePath: string;
319
- useToc: boolean;
320
- }) =>
321
- USE_LOCAL_RUNTIME_CACHE
322
- ? await renderedPageCache.getOrCreate(
323
- currentPath,
324
- async () =>
325
- await buildRenderedPageData({
326
- artifacts,
327
- relativePath,
328
- useToc,
329
- })
330
- )
331
- : await buildRenderedPageData({
332
- artifacts,
333
- relativePath,
334
- useToc,
335
- });
336
-
337
- const computePrevNext = (
338
- flatNav: NavPage[],
339
- currentPath: string
340
- ): {
341
- nextPage: { path: string; title: string } | undefined;
342
- prevPage: { path: string; title: string } | undefined;
343
- } => {
344
- const currentIndex = flatNav.findIndex((page) => page.path === currentPath);
345
-
346
- return {
347
- nextPage:
348
- currentIndex !== -1 && currentIndex < flatNav.length - 1
349
- ? flatNav[currentIndex + 1]
350
- : undefined,
351
- prevPage: currentIndex > 0 ? flatNav[currentIndex - 1] : undefined,
352
- };
353
- };
354
-
355
- export const clearLocalRuntimeCaches = () => {
356
- if (!USE_LOCAL_RUNTIME_CACHE) {
357
- return;
358
- }
359
-
360
- artifactsCache.clear();
361
- renderedPageCache.clear();
362
- };
363
-
364
- export const getSearchItems = async () => {
365
- const artifacts = await getArtifacts();
366
-
367
- if (!artifacts || isConfigErrorResult(artifacts)) {
368
- return [];
369
- }
370
-
371
- return artifacts.searchItems;
372
- };
373
-
374
- export const getOpenApiProxyContext = async (): Promise<{
375
- config: SiteConfig;
376
- registry: OpenApiRegistry;
377
- } | null> => {
378
- const artifacts = await getArtifacts();
379
-
380
- if (!artifacts || isConfigErrorResult(artifacts)) {
381
- return null;
382
- }
383
-
384
- return {
385
- config: artifacts.config,
386
- registry: artifacts.registry,
387
- };
388
- };
389
-
390
- // oxlint-disable-next-line eslint/complexity
391
- export const getDocShellData = cache(async (slugKey: string) => {
392
- const artifacts = await getArtifacts();
393
-
394
- if (!artifacts || isConfigErrorResult(artifacts)) {
395
- return artifacts;
396
- }
397
-
398
- const currentPath = normalizePath(slugKey) || "index";
399
- const activeTabIndex = artifacts.tabs
400
- ? findActiveTabIndex(artifacts.tabs, currentPath)
401
- : 0;
402
- const activeTabNav = artifacts.tabs
403
- ? getVisibleNavigation(artifacts.tabs[activeTabIndex]?.entries ?? [])
404
- : null;
405
- const activeTabFlatNav = activeTabNav ? flattenNav(activeTabNav) : null;
406
- const effectiveFlatNav = activeTabFlatNav ?? artifacts.visibleFlatNav;
407
-
408
- const openApiEntry = artifacts.registry.bySlug.get(currentPath);
409
- if (openApiEntry) {
410
- const isHidden = artifacts.flatNav.some(
411
- (page) => page.path === currentPath && page.hidden
412
- );
413
-
414
- return {
415
- activeTabIndex,
416
- anchors: artifacts.anchors,
417
- breadcrumbs: findBreadcrumbs(
418
- activeTabNav ?? artifacts.visibleNav,
419
- currentPath
420
- ),
421
- config: artifacts.config,
422
- currentPath,
423
- deprecated: false,
424
- hidden: isHidden,
425
- hideFooterPagination: false,
426
- kind: "openapi" as const,
427
- mode: undefined as PageMode | undefined,
428
- nav: activeTabNav ?? artifacts.visibleNav,
429
- nextPage: computePrevNext(effectiveFlatNav, currentPath).nextPage,
430
- noindex: false,
431
- openApiEntry,
432
- openapiProxyEnabled: artifacts.config.openapiProxy?.enabled ?? false,
433
- pageDescription: openApiEntry.operation.description,
434
- pageTitle: openApiEntry.operation.summary ?? openApiEntry.identifier,
435
- prevPage: computePrevNext(effectiveFlatNav, currentPath).prevPage,
436
- tabs: artifacts.tabs,
437
- };
438
- }
439
-
440
- const entry = artifacts.contentIndex.bySlug.get(currentPath) ?? null;
441
- if (!entry) {
442
- return null;
443
- }
444
-
445
- if (entry.kind === "index") {
446
- const collectionEntries =
447
- artifacts.contentIndex.byCollection
448
- .get(entry.collectionId)
449
- ?.filter(
450
- (
451
- collectionEntry
452
- ): collectionEntry is Extract<
453
- (typeof artifacts.contentIndex.entries)[number],
454
- { kind: "entry" }
455
- > =>
456
- collectionEntry.kind === "entry" &&
457
- collectionEntry.hidden !== true &&
458
- !artifacts.pageMetadataMap.get(collectionEntry.slug)?.hidden &&
459
- !artifacts.pageMetadataMap.get(collectionEntry.slug)?.noindex
460
- ) ?? [];
461
- const showDocsNav = entry.type === "docs";
462
-
463
- return {
464
- activeTabIndex,
465
- anchors: showDocsNav ? artifacts.anchors : [],
466
- breadcrumbs: [] as { label: string; path: string }[],
467
- collectionIndex: { entries: collectionEntries },
468
- config: artifacts.config,
469
- currentPath,
470
- deprecated: false,
471
- hidden: false,
472
- hideFooterPagination: false,
473
- kind: "index" as const,
474
- mode: undefined as PageMode | undefined,
475
- nav: showDocsNav ? (activeTabNav ?? artifacts.visibleNav) : [],
476
- nextPage: computePrevNext(effectiveFlatNav, currentPath).nextPage,
477
- noindex: false,
478
- pageDescription: entry.description,
479
- pageTitle: entry.title,
480
- prevPage: computePrevNext(effectiveFlatNav, currentPath).prevPage,
481
- tabs: artifacts.tabs,
482
- };
483
- }
484
-
485
- const showDocsNav = entry.type === "docs";
486
- const breadcrumbs = showDocsNav
487
- ? findBreadcrumbs(activeTabNav ?? artifacts.visibleNav, currentPath)
488
- : [];
489
- const pageMeta = artifacts.pageMetadataMap.get(currentPath);
490
- const isHiddenByNav = artifacts.flatNav.some(
491
- (page) => page.path === currentPath && page.hidden
492
- );
493
- const useToc =
494
- entry.type === "docs" && artifacts.config.features?.toc !== false;
495
-
496
- let rawContent = "";
497
- let toc: ReturnType<typeof extractToc> = [];
498
-
499
- try {
500
- rawContent = await artifacts.contentSource.readFile(entry.relativePath);
501
-
502
- if (useToc) {
503
- toc = extractToc(rawContent);
504
- }
505
- } catch {
506
- // The page rendering path handles read failures.
507
- }
508
-
509
- return {
510
- activeTabIndex,
511
- anchors: showDocsNav ? artifacts.anchors : [],
512
- breadcrumbs,
513
- config: artifacts.config,
514
- currentPath,
515
- deprecated: pageMeta?.deprecated ?? false,
516
- hidden: isHiddenByNav || entry.hidden === true,
517
- hideFooterPagination: pageMeta?.hideFooterPagination ?? false,
518
- kind: "page" as const,
519
- mode: pageMeta?.mode,
520
- nav: showDocsNav ? (activeTabNav ?? artifacts.visibleNav) : [],
521
- nextPage: computePrevNext(effectiveFlatNav, currentPath).nextPage,
522
- noindex: pageMeta?.noindex ?? false,
523
- pageDescription: entry.description,
524
- pageTitle: entry.title,
525
- prevPage: computePrevNext(effectiveFlatNav, currentPath).prevPage,
526
- rawContent,
527
- tabs: artifacts.tabs,
528
- toc,
529
- };
530
- });
531
-
532
- export const getDocPageContent = cache(async (slugKey: string) => {
533
- const artifacts = await getArtifacts();
534
-
535
- if (!artifacts || isConfigErrorResult(artifacts)) {
536
- return null;
537
- }
538
-
539
- const currentPath = normalizePath(slugKey) || "index";
540
- const entry = artifacts.contentIndex.bySlug.get(currentPath) ?? null;
541
-
542
- if (!entry || entry.kind !== "entry") {
543
- return null;
544
- }
545
-
546
- const useToc =
547
- entry.type === "docs" && artifacts.config.features?.toc !== false;
548
-
549
- return await getRenderedPageData({
550
- artifacts,
551
- currentPath,
552
- relativePath: entry.relativePath,
553
- useToc,
554
- });
555
- });
@@ -1,5 +0,0 @@
1
- /// <reference types="next" />
2
- /// <reference types="next/image-types/global" />
3
-
4
- // NOTE: This file should not be edited
5
- // see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
@@ -1,54 +0,0 @@
1
- import path from "node:path";
2
- import { fileURLToPath } from "node:url";
3
-
4
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
5
- const packagesDir = process.env.BLODEMD_PACKAGES_DIR;
6
- const isStandalone = Boolean(packagesDir);
7
- const turbopackRoot =
8
- process.env.BLODEMD_TURBOPACK_ROOT ||
9
- (isStandalone
10
- ? path.resolve(__dirname, "..")
11
- : path.resolve(__dirname, "../.."));
12
-
13
- // In monorepo mode we transpile @repo/* from source so edits to the
14
- // package src/ files hot-reload. In standalone mode the @repo packages
15
- // ship pre-built `dist/` via their package.json `exports`; transpiling
16
- // their `src/` would make Turbopack miss the `.js` → `.ts` resolution
17
- // for same-package imports, so we let Next consume the compiled output.
18
- const repoTranspilePackages = isStandalone
19
- ? []
20
- : [
21
- "@repo/common",
22
- "@repo/contracts",
23
- "@repo/models",
24
- "@repo/prebuild",
25
- "@repo/previewing",
26
- "@repo/validation",
27
- ];
28
-
29
- /** @type {import('next').NextConfig} */
30
- const nextConfig = {
31
- allowedDevOrigins: ["127.0.0.1"],
32
- experimental: {
33
- optimizePackageImports: [
34
- "blode-icons-react",
35
- "radix-ui",
36
- "@base-ui/react",
37
- "cmdk",
38
- "@repo/previewing",
39
- "@repo/models",
40
- "@repo/common",
41
- ],
42
- },
43
- images: {
44
- unoptimized: true,
45
- },
46
- transpilePackages: repoTranspilePackages,
47
- turbopack: {
48
- // The dev server consumes sibling docs/ and workspace packages/
49
- // directories, so Turbopack needs a root that includes them.
50
- root: turbopackRoot,
51
- },
52
- };
53
-
54
- export default nextConfig;
@@ -1,61 +0,0 @@
1
- {
2
- "name": "dev-server",
3
- "version": "0.0.0",
4
- "private": true,
5
- "type": "module",
6
- "scripts": {
7
- "dev": "next dev --turbopack",
8
- "build": "next build",
9
- "start": "next start",
10
- "lint": "oxlint .",
11
- "lint:fix": "oxlint --fix .",
12
- "format": "oxfmt --write .",
13
- "format:check": "oxfmt .",
14
- "check-types": "next typegen && tsc --noEmit"
15
- },
16
- "dependencies": {
17
- "@base-ui/react": "^1.3.0",
18
- "@mdx-js/mdx": "^3.1.1",
19
- "@repo/common": "*",
20
- "@repo/contracts": "*",
21
- "@repo/models": "*",
22
- "@repo/prebuild": "*",
23
- "@repo/previewing": "*",
24
- "@shikijs/rehype": "^4.0.2",
25
- "@tailwindcss/postcss": "^4.2.2",
26
- "blode-icons-react": "^0.3.10",
27
- "class-variance-authority": "^0.7.1",
28
- "clsx": "^2.1.1",
29
- "cmdk": "^1.1.1",
30
- "geist": "^1.7.0",
31
- "next": "16.2.1",
32
- "next-mdx-remote": "^6.0.0",
33
- "next-themes": "^0.4.6",
34
- "radix-ui": "^1.4.3",
35
- "react": "^19.2.0",
36
- "react-dom": "^19.2.0",
37
- "rehype-autolink-headings": "^7.1.0",
38
- "rehype-slug": "^6.0.0",
39
- "remark-gfm": "^4.0.0",
40
- "shadcn": "^4.1.1",
41
- "shiki": "^4.0.2",
42
- "tailwind-merge": "^3.5.0",
43
- "tailwindcss": "^4.2.2",
44
- "tw-animate-css": "^1.4.0"
45
- },
46
- "devDependencies": {
47
- "@repo/typescript-config": "*",
48
- "@types/mdx": "^2.0.13",
49
- "@types/node": "^24.12.2",
50
- "@types/react": "19.2.14",
51
- "@types/react-dom": "19.2.3",
52
- "oxfmt": "^0.42.0",
53
- "oxlint": "^1.57.0",
54
- "postcss": "^8.5.3",
55
- "typescript": "6.0.2",
56
- "ultracite": "^7.3.2"
57
- },
58
- "engines": {
59
- "node": "24.x"
60
- }
61
- }
@@ -1,7 +0,0 @@
1
- const config = {
2
- plugins: {
3
- "@tailwindcss/postcss": {},
4
- },
5
- };
6
-
7
- export default config;