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,95 +0,0 @@
1
- import type {
2
- TenantEdgeHostRecord,
3
- TenantEdgeSlugRecord,
4
- } from "@repo/contracts";
5
- import {
6
- TenantEdgeHostRecordSchema,
7
- TenantEdgeSlugRecordSchema,
8
- getTenantEdgeHostKeys,
9
- getTenantEdgeHostKey,
10
- getTenantEdgeSlugKeys,
11
- getTenantEdgeSlugKey,
12
- } from "@repo/contracts";
13
- import { createClient } from "@vercel/edge-config";
14
-
15
- import { createTimedPromiseCache } from "./server-cache";
16
-
17
- const EDGE_CONFIG_CACHE_TTL_MS = 30 * 1000;
18
-
19
- const readTrimmedEnv = (name: string) => {
20
- const value = process.env[name];
21
- if (typeof value !== "string") {
22
- return;
23
- }
24
- const trimmed = value.trim();
25
- if (!trimmed) {
26
- return;
27
- }
28
- return trimmed;
29
- };
30
-
31
- const edgeConfigConnectionString = readTrimmedEnv("EDGE_CONFIG");
32
- const edgeConfigClient = edgeConfigConnectionString
33
- ? createClient(edgeConfigConnectionString)
34
- : null;
35
-
36
- export { getTenantEdgeHostKey, getTenantEdgeSlugKey };
37
-
38
- const hostRecordCache = createTimedPromiseCache<
39
- string,
40
- TenantEdgeHostRecord | null
41
- >({
42
- maxEntries: 512,
43
- ttlMs: EDGE_CONFIG_CACHE_TTL_MS,
44
- });
45
-
46
- const slugRecordCache = createTimedPromiseCache<
47
- string,
48
- TenantEdgeSlugRecord | null
49
- >({
50
- maxEntries: 512,
51
- ttlMs: EDGE_CONFIG_CACHE_TTL_MS,
52
- });
53
-
54
- const getEdgeConfigValue = async (key: string) => {
55
- if (!edgeConfigClient) {
56
- return null;
57
- }
58
-
59
- try {
60
- return (await edgeConfigClient.get(key)) as unknown;
61
- } catch {
62
- return null;
63
- }
64
- };
65
-
66
- export const isEdgeConfigEnabled = () => Boolean(edgeConfigClient);
67
-
68
- export const clearTenantEdgeConfigCaches = () => {
69
- hostRecordCache.clear();
70
- slugRecordCache.clear();
71
- };
72
-
73
- export const getTenantEdgeHostRecord = async (host: string) =>
74
- await hostRecordCache.getOrCreate(getTenantEdgeHostKey(host), async () => {
75
- for (const key of getTenantEdgeHostKeys(host)) {
76
- const value = await getEdgeConfigValue(key);
77
- const parsed = TenantEdgeHostRecordSchema.safeParse(value);
78
- if (parsed.success) {
79
- return parsed.data;
80
- }
81
- }
82
- return null;
83
- });
84
-
85
- export const getTenantEdgeSlugRecord = async (slug: string) =>
86
- await slugRecordCache.getOrCreate(getTenantEdgeSlugKey(slug), async () => {
87
- for (const key of getTenantEdgeSlugKeys(slug)) {
88
- const value = await getEdgeConfigValue(key);
89
- const parsed = TenantEdgeSlugRecordSchema.safeParse(value);
90
- if (parsed.success) {
91
- return parsed.data;
92
- }
93
- }
94
- return null;
95
- });
package/docs/lib/env.ts DELETED
@@ -1,23 +0,0 @@
1
- const readTrimmedEnv = (name: string) => {
2
- const value = process.env[name];
3
- if (typeof value !== "string") {
4
- return;
5
- }
6
- const trimmed = value.trim();
7
- if (!trimmed) {
8
- return;
9
- }
10
- return trimmed;
11
- };
12
-
13
- // Must reference process.env.NEXT_PUBLIC_API_URL as a literal so Next.js
14
- // inlines it into the client bundle. Dynamic access via readTrimmedEnv is
15
- // not replaced at build time and would always be undefined on the client.
16
- export const docsApiBase =
17
- process.env.NEXT_PUBLIC_API_URL?.trim() || "http://localhost:4000";
18
-
19
- export const platformAssetPrefix =
20
- readTrimmedEnv("PLATFORM_ASSET_PREFIX") ?? "";
21
-
22
- export const platformRootDomain =
23
- readTrimmedEnv("PLATFORM_ROOT_DOMAIN") ?? "blode.md";
package/docs/lib/etag.ts DELETED
@@ -1,22 +0,0 @@
1
- import { createHash } from "node:crypto";
2
-
3
- import { NextResponse } from "next/server";
4
-
5
- export const computeETag = (content: string): string => {
6
- const hash = createHash("sha256").update(content).digest("hex").slice(0, 16);
7
- return `"${hash}"`;
8
- };
9
-
10
- export const handleIfNoneMatch = (
11
- request: Request,
12
- etag: string
13
- ): NextResponse | null => {
14
- const ifNoneMatch = request.headers.get("if-none-match");
15
- if (ifNoneMatch && ifNoneMatch === etag) {
16
- return new NextResponse(null, {
17
- headers: { ETag: etag },
18
- status: 304,
19
- });
20
- }
21
- return null;
22
- };
@@ -1,33 +0,0 @@
1
- import { apiFetch } from "@/lib/api-client";
2
-
3
- export const GITHUB_INSTALL_STATE_KEY = "blodemd:install-state";
4
-
5
- export interface PendingGithubInstall {
6
- projectId: string;
7
- projectSlug: string;
8
- state: string;
9
- }
10
-
11
- export const startGithubInstall = async ({
12
- accessToken,
13
- projectId,
14
- projectSlug,
15
- }: {
16
- accessToken: string;
17
- projectId: string;
18
- projectSlug: string;
19
- }): Promise<void> => {
20
- const result = await apiFetch<{ url: string; state: string }>(
21
- `/projects/${projectId}/git/install-url`,
22
- { accessToken, method: "POST" }
23
- );
24
- sessionStorage.setItem(
25
- GITHUB_INSTALL_STATE_KEY,
26
- JSON.stringify({
27
- projectId,
28
- projectSlug,
29
- state: result.state,
30
- })
31
- );
32
- window.location.assign(result.url);
33
- };
@@ -1,82 +0,0 @@
1
- export const LLMS_FULL_CHAR_LIMIT = 80_000;
2
-
3
- const FENCE_LINE_REGEX = /^ {0,3}(`{3,}|~{3,})/;
4
-
5
- const getTruncationFooter = (indexUrl: string) =>
6
- [
7
- "",
8
- "---",
9
- "",
10
- "Content truncated to keep this response under crawler size limits.",
11
- `Use ${indexUrl} for the full page index and fetch individual .md pages for uncapped content.`,
12
- ].join("\n");
13
-
14
- const findOpenFence = (source: string) => {
15
- let openFence: string | null = null;
16
-
17
- for (const line of source.split(/\r?\n/)) {
18
- const marker = FENCE_LINE_REGEX.exec(line)?.[1];
19
- if (!marker) {
20
- continue;
21
- }
22
-
23
- if (!openFence) {
24
- openFence = marker;
25
- continue;
26
- }
27
-
28
- if (marker[0] === openFence[0] && marker.length >= openFence.length) {
29
- openFence = null;
30
- }
31
- }
32
-
33
- return openFence;
34
- };
35
-
36
- const closeOpenFence = (source: string) => {
37
- const openFence = findOpenFence(source);
38
- return openFence ? `${source}\n${openFence}` : source;
39
- };
40
-
41
- const findTruncationBoundary = (source: string, minimum: number) => {
42
- const sectionBoundary = source.lastIndexOf("\n# ");
43
- if (sectionBoundary > minimum) {
44
- return sectionBoundary;
45
- }
46
-
47
- const paragraphBoundary = source.lastIndexOf("\n\n");
48
- if (paragraphBoundary > minimum) {
49
- return paragraphBoundary;
50
- }
51
-
52
- const lineBoundary = source.lastIndexOf("\n");
53
- return lineBoundary > 0 ? lineBoundary : source.length;
54
- };
55
-
56
- export const capLlmsFullContent = (
57
- content: string,
58
- indexUrl: string,
59
- limit = LLMS_FULL_CHAR_LIMIT
60
- ) => {
61
- const trimmed = content.trim();
62
- if (trimmed.length <= limit) {
63
- return trimmed;
64
- }
65
-
66
- const footer = getTruncationFooter(indexUrl);
67
- let room = limit - footer.length - 16;
68
- while (room > 0) {
69
- const draft = trimmed.slice(0, room);
70
- const boundary = findTruncationBoundary(draft, Math.floor(room / 2));
71
- const capped = closeOpenFence(draft.slice(0, boundary).trimEnd());
72
- const result = `${capped}${footer}`;
73
-
74
- if (result.length <= limit) {
75
- return result;
76
- }
77
-
78
- room -= result.length - limit + 16;
79
- }
80
-
81
- return footer.trim().slice(0, limit);
82
- };
@@ -1,79 +0,0 @@
1
- const MARKETING_MARKDOWN: Record<string, string> = {
2
- "/": `# Blode.md
3
-
4
- Docs your users love. And their AI understands.
5
-
6
- Write MDX, commit, push. blode.md ships a fast, beautiful docs site in one git push, wired up for the LLMs your users ask too.
7
-
8
- ## How it works
9
-
10
- 1. Install the GitHub app at github.com/apps/blodemd
11
- 2. Pick a repo and a docs folder
12
- 3. Push to \`main\`, deployed to \`acme.blode.md\`
13
-
14
- Or use the CLI:
15
-
16
- \`\`\`
17
- npm i -g blodemd
18
- blodemd login
19
- blodemd new docs
20
- blodemd push docs
21
- \`\`\`
22
-
23
- ## What you get
24
-
25
- - **GitHub auto-deploy** — Install once. Every push to your branch deploys in seconds.
26
- - **Custom domains** — Point a domain, get SSL. Or proxy docs at yourdomain.com/docs.
27
- - **MDX components** — 30+ components out of the box: callouts, tabs, code groups, API refs.
28
- - **Search** — Full-text search across every page. No plugin, no config.
29
- - **Content types** — Docs, blogs, changelogs, and courses in one project, one domain.
30
- - **API reference** — Point at an OpenAPI spec, ship an interactive API reference.
31
-
32
- ## Links
33
-
34
- - [About](https://blode.md/about)
35
- - [Blog](https://blode.md/blog)
36
- - [Changelog](https://blode.md/changelog)
37
- - [Privacy](https://blode.md/privacy)
38
- - [Terms](https://blode.md/terms)
39
- - [Security](https://blode.md/security)
40
- - [Docs](https://blode.md/docs)
41
- - [GitHub](https://github.com/mblode/blodemd)
42
- `,
43
- "/about": `# About Blode.md
44
-
45
- blode.md is a docs platform that lives in your git repo. Write MDX, push to main, ship docs.
46
- `,
47
- "/blog": `# Blog
48
-
49
- Notes from the team building blode.md.
50
- `,
51
- "/changelog": `# Changelog
52
-
53
- Latest updates to the blode.md platform.
54
- `,
55
- "/pricing": `# Pricing
56
-
57
- Blode.md is currently free for hosted projects and MIT licensed for self-hosting.
58
- `,
59
- "/privacy": `# Privacy Policy
60
-
61
- How blode.md collects, uses, and protects your information.
62
- `,
63
- "/security": `# Security
64
-
65
- Security practices at blode.md.
66
- `,
67
- "/terms": `# Terms of Service
68
-
69
- Terms governing your use of blode.md.
70
- `,
71
- };
72
-
73
- export const getMarketingMarkdown = (pathname: string): string | null => {
74
- const normalized = pathname.replace(/\/+$/, "") || "/";
75
- return MARKETING_MARKDOWN[normalized] ?? null;
76
- };
77
-
78
- export const hasMarketingMarkdown = (pathname: string): boolean =>
79
- getMarketingMarkdown(pathname) !== null;
@@ -1,31 +0,0 @@
1
- import { platformRootDomain } from "./env";
2
-
3
- export const MARKETING_ORIGIN = `https://${platformRootDomain}`;
4
-
5
- export const MARKETING_CANONICAL_PATHS = [
6
- "/",
7
- "/about",
8
- "/blog",
9
- "/changelog",
10
- "/pricing",
11
- "/privacy",
12
- "/security",
13
- "/terms",
14
- ] as const;
15
-
16
- export const MARKETING_API_CATALOG_PATH = "/.well-known/api-catalog";
17
- export const MARKETING_SKILLS_INDEX_PATH =
18
- "/.well-known/agent-skills/index.json";
19
- export const MARKETING_MCP_SERVER_CARD_PATH =
20
- "/.well-known/mcp/server-card.json";
21
- export const MARKETING_OAUTH_AUTHORIZATION_SERVER_PATH =
22
- "/.well-known/oauth-authorization-server";
23
- export const MARKETING_OAUTH_PROTECTED_RESOURCE_PATH =
24
- "/.well-known/oauth-protected-resource";
25
- export const MARKETING_OPENID_CONFIGURATION_PATH =
26
- "/.well-known/openid-configuration";
27
- export const MARKETING_API_DOCS_PATH = "/docs/api/overview";
28
- export const MARKETING_API_STATUS_PATH = "/api/health";
29
- export const MARKETING_API_SERVICE_DESC_PATH = "/api/openapi.json";
30
-
31
- export const marketingUrl = (path: string) => `${MARKETING_ORIGIN}${path}`;
package/docs/lib/mdx.ts DELETED
@@ -1,98 +0,0 @@
1
- import { run } from "@mdx-js/mdx";
2
- import rehypeShikiFromHighlighter from "@shikijs/rehype/core";
3
- import { compileMDX } from "next-mdx-remote/rsc";
4
- import { createElement } from "react";
5
- import type { ComponentType } from "react";
6
- import * as jsxRuntime from "react/jsx-runtime";
7
- import rehypeAutolinkHeadings from "rehype-autolink-headings";
8
- import rehypeSlug from "rehype-slug";
9
- import remarkGfm from "remark-gfm";
10
-
11
- import { createMdxComponents } from "@/components/mdx";
12
-
13
- import { getHighlighter, SHIKI_THEME_PAIR } from "./shiki";
14
-
15
- const FRONTMATTER_REGEX = /^---\s*\n[\s\S]*?\n---\s*\n?/;
16
-
17
- const stripFrontmatter = (source: string) => ({
18
- body: source.replace(FRONTMATTER_REGEX, ""),
19
- frontmatter: {} as Record<string, unknown>,
20
- });
21
-
22
- /**
23
- * Renders pre-compiled MDX content. The `compiledSource` is a JS function body
24
- * produced by `@repo/mdx-compiler` at deploy time via `compile()` with
25
- * `outputFormat: 'function-body'`. This is the fast path — no parsing,
26
- * no plugin execution, no Shiki. Sub-millisecond execution.
27
- */
28
- export const renderFromCompiled = async (
29
- compiledSource: string,
30
- basePath = "",
31
- currentPath = ""
32
- ) => {
33
- const components = createMdxComponents(basePath, currentPath);
34
- const mdxModule = await run(compiledSource, {
35
- ...jsxRuntime,
36
- baseUrl: import.meta.url,
37
- });
38
- const Content = mdxModule.default as ComponentType<{
39
- components?: ReturnType<typeof createMdxComponents>;
40
- }>;
41
-
42
- return {
43
- content: createElement(Content, { components }),
44
- frontmatter: {} as Record<string, unknown>,
45
- };
46
- };
47
-
48
- /**
49
- * Full MDX compilation + rendering. Used as fallback for local development
50
- * (FsContentSource) and any content that wasn't pre-compiled at deploy time.
51
- */
52
- export const renderMdx = async (
53
- source: string,
54
- basePath = "",
55
- currentPath = ""
56
- ) => {
57
- const { body, frontmatter } = stripFrontmatter(source);
58
- const components = createMdxComponents(basePath, currentPath);
59
- const highlighter = await getHighlighter();
60
- const shikiTransformer = rehypeShikiFromHighlighter(highlighter, {
61
- defaultColor: false,
62
- fallbackLanguage: "text",
63
- themes: SHIKI_THEME_PAIR,
64
- });
65
- const shikiPlugin = () => shikiTransformer;
66
-
67
- const result = await compileMDX({
68
- components,
69
- options: {
70
- blockDangerousJS: false,
71
- blockJS: false,
72
- mdxOptions: {
73
- rehypePlugins: [
74
- rehypeSlug,
75
- [
76
- rehypeAutolinkHeadings,
77
- {
78
- behavior: "append",
79
- properties: {
80
- className: [
81
- "ml-2 text-[0.9em] opacity-0 transition-opacity hover:opacity-100",
82
- ],
83
- },
84
- },
85
- ],
86
- shikiPlugin,
87
- ],
88
- remarkPlugins: [remarkGfm],
89
- },
90
- },
91
- source: body,
92
- });
93
-
94
- return {
95
- content: result.content,
96
- frontmatter,
97
- };
98
- };