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,62 +0,0 @@
1
- import type { TenantResolution } from "@repo/contracts";
2
-
3
- export interface TenantRequestContext {
4
- basePath?: string;
5
- protocol?: string;
6
- requestedHost?: string;
7
- strategy?: TenantResolution["strategy"] | null;
8
- }
9
-
10
- const TENANT_UTILITY_CONTEXT_PARAMS = {
11
- basePath: "__blodemd_base_path",
12
- host: "__blodemd_host",
13
- protocol: "__blodemd_protocol",
14
- strategy: "__blodemd_strategy",
15
- } as const;
16
-
17
- export const applyTenantUtilityContextSearchParams = (
18
- url: URL,
19
- context: TenantRequestContext
20
- ) => {
21
- if (context.requestedHost) {
22
- url.searchParams.set(
23
- TENANT_UTILITY_CONTEXT_PARAMS.host,
24
- context.requestedHost
25
- );
26
- }
27
-
28
- url.searchParams.set(
29
- TENANT_UTILITY_CONTEXT_PARAMS.basePath,
30
- context.basePath ?? ""
31
- );
32
- url.searchParams.set(
33
- TENANT_UTILITY_CONTEXT_PARAMS.protocol,
34
- context.protocol ?? "https"
35
- );
36
- url.searchParams.set(
37
- TENANT_UTILITY_CONTEXT_PARAMS.strategy,
38
- context.strategy ?? ""
39
- );
40
- };
41
-
42
- export const getTenantRequestContextFromUrl = (
43
- url: URL
44
- ): TenantRequestContext | null => {
45
- const requestedHost = url.searchParams.get(
46
- TENANT_UTILITY_CONTEXT_PARAMS.host
47
- );
48
- const basePath = url.searchParams.get(TENANT_UTILITY_CONTEXT_PARAMS.basePath);
49
- const protocol = url.searchParams.get(TENANT_UTILITY_CONTEXT_PARAMS.protocol);
50
- const strategy = url.searchParams.get(TENANT_UTILITY_CONTEXT_PARAMS.strategy);
51
-
52
- if (!(requestedHost || basePath !== null || protocol || strategy)) {
53
- return null;
54
- }
55
-
56
- return {
57
- basePath: basePath ?? undefined,
58
- protocol: protocol || undefined,
59
- requestedHost: requestedHost || undefined,
60
- strategy: (strategy || null) as TenantRequestContext["strategy"],
61
- };
62
- };
@@ -1,72 +0,0 @@
1
- import { TenantSchema } from "@repo/contracts";
2
- import type { Tenant } from "@repo/models";
3
-
4
- import { getTenantDocsPath } from "./content-root";
5
- import { getTenantEdgeSlugRecord, isEdgeConfigEnabled } from "./edge-config";
6
- import { docsApiBase } from "./env";
7
- import { createTimedPromiseCache } from "./server-cache";
8
-
9
- export const getProjectTag = (slug: string) => `project:${slug}`;
10
-
11
- const TENANT_REVALIDATE_SECONDS = 3600;
12
- const TENANT_CACHE_TTL_MS = 5 * 1000;
13
-
14
- const mapTenant = (tenant: {
15
- activeDeploymentId?: string;
16
- activeDeploymentManifestUrl?: string;
17
- id: string;
18
- slug: string;
19
- name: string;
20
- description?: string;
21
- primaryDomain: string;
22
- subdomain: string;
23
- customDomains: string[];
24
- pathPrefix?: string;
25
- status: "active" | "disabled";
26
- }): Tenant => ({
27
- ...tenant,
28
- docsPath: getTenantDocsPath(tenant.slug),
29
- });
30
-
31
- const tenantCache = createTimedPromiseCache<string, Tenant | null>({
32
- maxEntries: 512,
33
- // Keep the process-local cache short. Tag/path revalidation only clears the
34
- // instance that handles the request, so long-lived in-memory entries can pin
35
- // warm instances to an old deployment manifest after a publish.
36
- ttlMs: TENANT_CACHE_TTL_MS,
37
- });
38
-
39
- const fetchTenantFromApi = async (slug: string): Promise<Tenant | null> => {
40
- const url = new URL(`/tenants/${slug}`, docsApiBase);
41
- const response = await fetch(url.toString(), {
42
- next: {
43
- revalidate: TENANT_REVALIDATE_SECONDS,
44
- tags: [getProjectTag(slug), "tenants"],
45
- },
46
- });
47
- if (!response.ok) {
48
- return null;
49
- }
50
- const json = (await response.json()) as unknown;
51
- const parsed = TenantSchema.safeParse(json);
52
- if (!parsed.success) {
53
- return null;
54
- }
55
- return mapTenant(parsed.data);
56
- };
57
-
58
- const fetchTenant = async (slug: string): Promise<Tenant | null> => {
59
- if (isEdgeConfigEnabled()) {
60
- const edgeRecord = await getTenantEdgeSlugRecord(slug);
61
- return edgeRecord ? mapTenant(edgeRecord.tenant) : null;
62
- }
63
-
64
- return await fetchTenantFromApi(slug);
65
- };
66
-
67
- export const clearTenantCache = () => {
68
- tenantCache.clear();
69
- };
70
-
71
- export const getTenantBySlug = async (slug: string) =>
72
- await tenantCache.getOrCreate(slug, async () => await fetchTenant(slug));
package/docs/lib/theme.ts DELETED
@@ -1,29 +0,0 @@
1
- import type { SiteConfig } from "@repo/models";
2
- import type { CSSProperties } from "react";
3
-
4
- export const themeStylesFromConfig = (config: SiteConfig): CSSProperties => {
5
- const { colors } = config;
6
- if (!colors) {
7
- return {};
8
- }
9
-
10
- const styles: Record<string, string> = {};
11
-
12
- if (colors.primary) {
13
- styles["--color-primary"] = colors.primary;
14
- }
15
- if (colors.border) {
16
- styles["--color-border"] = colors.border;
17
- }
18
- if (colors.muted) {
19
- styles["--color-muted"] = colors.muted;
20
- }
21
- if (colors.surface) {
22
- styles["--color-surface"] = colors.surface;
23
- }
24
- if (colors.background) {
25
- styles["--color-background"] = colors.background;
26
- }
27
-
28
- return styles as CSSProperties;
29
- };
@@ -1,24 +0,0 @@
1
- const units: [Intl.RelativeTimeFormatUnit, number][] = [
2
- ["year", 31_536_000],
3
- ["month", 2_592_000],
4
- ["week", 604_800],
5
- ["day", 86_400],
6
- ["hour", 3600],
7
- ["minute", 60],
8
- ["second", 1],
9
- ];
10
-
11
- const rtf = new Intl.RelativeTimeFormat("en", { numeric: "auto" });
12
-
13
- export const timeAgo = (iso: string | null): string => {
14
- if (!iso) {
15
- return "";
16
- }
17
- const seconds = Math.round((Date.now() - new Date(iso).getTime()) / 1000);
18
- for (const [unit, secs] of units) {
19
- if (Math.abs(seconds) >= secs || unit === "second") {
20
- return rtf.format(-Math.round(seconds / secs), unit);
21
- }
22
- }
23
- return "";
24
- };
package/docs/lib/toc.ts DELETED
@@ -1,2 +0,0 @@
1
- export { extractToc } from "@repo/previewing";
2
- export type { TocItem } from "@repo/previewing";
@@ -1,19 +0,0 @@
1
- import { useEffect, useState } from "react";
2
-
3
- const MOBILE_BREAKPOINT = 768;
4
-
5
- export const useIsMobile = () => {
6
- const [isMobile, setIsMobile] = useState<boolean | undefined>();
7
-
8
- useEffect(() => {
9
- const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
10
- const onChange = () => {
11
- setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
12
- };
13
- mql.addEventListener("change", onChange);
14
- setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
15
- return () => mql.removeEventListener("change", onChange);
16
- }, []);
17
-
18
- return !!isMobile;
19
- };
@@ -1,71 +0,0 @@
1
- import React from "react";
2
-
3
- interface TabObserverOptions {
4
- onActiveTabChange?: (index: number, element: HTMLElement) => void;
5
- }
6
-
7
- export const useTabObserver = ({
8
- onActiveTabChange,
9
- }: TabObserverOptions = {}) => {
10
- const listRef = React.useRef<HTMLDivElement>(null);
11
- const onActiveTabChangeRef = React.useRef(onActiveTabChange);
12
-
13
- React.useEffect(() => {
14
- onActiveTabChangeRef.current = onActiveTabChange;
15
- }, [onActiveTabChange]);
16
-
17
- const handleUpdate = React.useCallback(() => {
18
- if (listRef.current) {
19
- const tabs = listRef.current.querySelectorAll('[role="tab"]');
20
- for (let i = 0; i < tabs.length; i += 1) {
21
- const el = tabs[i];
22
- if (!(el instanceof HTMLElement)) {
23
- continue;
24
- }
25
- const isActive =
26
- Object.hasOwn(el.dataset, "active") ||
27
- el.dataset.state === "active" ||
28
- el.getAttribute("aria-selected") === "true";
29
-
30
- if (isActive) {
31
- onActiveTabChangeRef.current?.(i, el);
32
- break;
33
- }
34
- }
35
- }
36
- }, []);
37
-
38
- React.useEffect(() => {
39
- const resizeObserver = new ResizeObserver(handleUpdate);
40
- const mutationObserver = new MutationObserver(handleUpdate);
41
-
42
- if (listRef.current) {
43
- resizeObserver.observe(listRef.current);
44
- mutationObserver.observe(listRef.current, {
45
- attributes: true,
46
- childList: true,
47
- subtree: true,
48
- });
49
- }
50
-
51
- const handleWindowUpdate = () => {
52
- handleUpdate();
53
- };
54
-
55
- window.addEventListener("resize", handleWindowUpdate);
56
- window.addEventListener("orientationchange", handleWindowUpdate);
57
- document.fonts?.addEventListener?.("loadingdone", handleWindowUpdate);
58
-
59
- handleUpdate();
60
-
61
- return () => {
62
- resizeObserver.disconnect();
63
- mutationObserver.disconnect();
64
- window.removeEventListener("resize", handleWindowUpdate);
65
- window.removeEventListener("orientationchange", handleWindowUpdate);
66
- document.fonts?.removeEventListener?.("loadingdone", handleWindowUpdate);
67
- };
68
- }, [handleUpdate]);
69
-
70
- return { listRef };
71
- };
package/docs/lib/utils.ts DELETED
@@ -1,5 +0,0 @@
1
- import { clsx } from "clsx";
2
- import type { ClassValue } from "clsx";
3
- import { twMerge } from "tailwind-merge";
4
-
5
- export const cn = (...inputs: ClassValue[]) => twMerge(clsx(inputs));
@@ -1,16 +0,0 @@
1
- type EnvLike = Record<string, string | undefined>;
2
- export declare const LOCAL_ROOT_HOSTS: readonly ["localhost", "127.0.0.1", "docs.localhost"];
3
- export declare const normalizePath: (value: string) => string;
4
- export declare const normalizeHost: (value: string) => string;
5
- export declare const getPortlessHostFromEnv: (env: EnvLike) => string | null;
6
- export declare const getLocalRootHostsFromEnv: (env: EnvLike) => Set<string>;
7
- export declare const withLeadingSlash: (value: string) => string;
8
- export declare const withoutLeadingSlash: (value: string) => string;
9
- export declare const slugify: (value: string) => string;
10
- export declare const shouldIgnoreRootDocsFile: (value: string) => boolean;
11
- export declare const ensureArray: <T>(value?: T | T[]) => T[];
12
- export declare const uniq: <T>(values: T[]) => T[];
13
- export declare const safeJsonParse: <T>(value: string) => T | null;
14
- export declare const clamp: (value: number, min: number, max: number) => number;
15
- export {};
16
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,KAAK,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;AAElD,eAAO,MAAM,gBAAgB,uDAInB,CAAC;AAEX,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,WAK1C,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,WACS,CAAC;AAErD,eAAO,MAAM,sBAAsB,GAAI,KAAK,OAAO,kBAWlD,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAI,KAAK,OAAO,gBAOpD,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,OAAO,MAAM,WAK7C,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,OAAO,MAAM,WAKhD,CAAC;AAEF,eAAO,MAAM,OAAO,GAAI,OAAO,MAAM,WAKL,CAAC;AAWjC,eAAO,MAAM,wBAAwB,GAAI,OAAO,MAAM,YAMrD,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,EAAE,QAK7C,CAAC;AAEF,eAAO,MAAM,IAAI,GAAI,CAAC,EAAE,QAAQ,CAAC,EAAE,QAAyB,CAAC;AAE7D,eAAO,MAAM,aAAa,GAAI,CAAC,EAAE,OAAO,MAAM,KAAG,CAAC,GAAG,IAMpD,CAAC;AAEF,eAAO,MAAM,KAAK,GAAI,OAAO,MAAM,EAAE,KAAK,MAAM,EAAE,KAAK,MAAM,WACxB,CAAC"}
@@ -1,84 +0,0 @@
1
- const BACKSLASH_TO_SLASH_REGEX = /\\/g;
2
- const TRAILING_SLASHES_REGEX = /\/+$/g;
3
- const LEADING_SLASHES_REGEX = /^\/+/;
4
- const PORT_REGEX = /:\d+$/;
5
- export const LOCAL_ROOT_HOSTS = [
6
- "localhost",
7
- "127.0.0.1",
8
- "docs.localhost",
9
- ];
10
- export const normalizePath = (value) => {
11
- const trimmed = value
12
- .replace(BACKSLASH_TO_SLASH_REGEX, "/")
13
- .replace(TRAILING_SLASHES_REGEX, "");
14
- return trimmed.replace(LEADING_SLASHES_REGEX, "");
15
- };
16
- export const normalizeHost = (value) => value.trim().replace(PORT_REGEX, "").toLowerCase();
17
- export const getPortlessHostFromEnv = (env) => {
18
- const portlessUrl = env.PORTLESS_URL?.trim();
19
- if (!portlessUrl) {
20
- return null;
21
- }
22
- try {
23
- return normalizeHost(new URL(portlessUrl).host);
24
- }
25
- catch {
26
- return normalizeHost(portlessUrl);
27
- }
28
- };
29
- export const getLocalRootHostsFromEnv = (env) => {
30
- const hosts = new Set(LOCAL_ROOT_HOSTS);
31
- const portlessHost = getPortlessHostFromEnv(env);
32
- if (portlessHost) {
33
- hosts.add(portlessHost);
34
- }
35
- return hosts;
36
- };
37
- export const withLeadingSlash = (value) => {
38
- if (!value) {
39
- return "/";
40
- }
41
- return value.startsWith("/") ? value : `/${value}`;
42
- };
43
- export const withoutLeadingSlash = (value) => {
44
- if (!value) {
45
- return "";
46
- }
47
- return value.startsWith("/") ? value.slice(1) : value;
48
- };
49
- export const slugify = (value) => value
50
- .toLowerCase()
51
- .trim()
52
- .replaceAll(/[^a-z0-9]+/g, "-")
53
- .replaceAll(/(^-|-$)+/g, "");
54
- const IGNORED_ROOT_DOCS_FILES = new Set([
55
- ".gitignore",
56
- "AGENTS.md",
57
- "CLAUDE.md",
58
- "LICENSE",
59
- "LICENSE.md",
60
- "README.md",
61
- ]);
62
- export const shouldIgnoreRootDocsFile = (value) => {
63
- const normalized = normalizePath(value);
64
- if (!normalized || normalized.includes("/")) {
65
- return false;
66
- }
67
- return IGNORED_ROOT_DOCS_FILES.has(normalized);
68
- };
69
- export const ensureArray = (value) => {
70
- if (value === undefined) {
71
- return [];
72
- }
73
- return Array.isArray(value) ? value : [value];
74
- };
75
- export const uniq = (values) => [...new Set(values)];
76
- export const safeJsonParse = (value) => {
77
- try {
78
- return JSON.parse(value);
79
- }
80
- catch {
81
- return null;
82
- }
83
- };
84
- export const clamp = (value, min, max) => Math.min(Math.max(value, min), max);
@@ -1,34 +0,0 @@
1
- {
2
- "name": "@repo/common",
3
- "version": "0.0.0",
4
- "private": true,
5
- "type": "module",
6
- "exports": {
7
- ".": {
8
- "types": "./dist/index.d.ts",
9
- "import": "./dist/index.js",
10
- "default": "./dist/index.js"
11
- },
12
- "./*": {
13
- "types": "./dist/*.d.ts",
14
- "import": "./dist/*.js",
15
- "default": "./dist/*.js"
16
- }
17
- },
18
- "scripts": {
19
- "build": "rm -rf dist && tsc",
20
- "check-types": "tsc --noEmit",
21
- "lint": "oxlint .",
22
- "lint:fix": "oxlint --fix .",
23
- "format": "oxfmt --write .",
24
- "format:check": "oxfmt ."
25
- },
26
- "devDependencies": {
27
- "@repo/typescript-config": "*",
28
- "@types/node": "^24.12.2",
29
- "oxfmt": "^0.42.0",
30
- "oxlint": "^1.57.0",
31
- "typescript": "6.0.2",
32
- "ultracite": "^7.3.2"
33
- }
34
- }
@@ -1,101 +0,0 @@
1
- const BACKSLASH_TO_SLASH_REGEX = /\\/g;
2
- const TRAILING_SLASHES_REGEX = /\/+$/g;
3
- const LEADING_SLASHES_REGEX = /^\/+/;
4
- const PORT_REGEX = /:\d+$/;
5
- type EnvLike = Record<string, string | undefined>;
6
-
7
- export const LOCAL_ROOT_HOSTS = [
8
- "localhost",
9
- "127.0.0.1",
10
- "docs.localhost",
11
- ] as const;
12
-
13
- export const normalizePath = (value: string) => {
14
- const trimmed = value
15
- .replace(BACKSLASH_TO_SLASH_REGEX, "/")
16
- .replace(TRAILING_SLASHES_REGEX, "");
17
- return trimmed.replace(LEADING_SLASHES_REGEX, "");
18
- };
19
-
20
- export const normalizeHost = (value: string) =>
21
- value.trim().replace(PORT_REGEX, "").toLowerCase();
22
-
23
- export const getPortlessHostFromEnv = (env: EnvLike) => {
24
- const portlessUrl = env.PORTLESS_URL?.trim();
25
- if (!portlessUrl) {
26
- return null;
27
- }
28
-
29
- try {
30
- return normalizeHost(new URL(portlessUrl).host);
31
- } catch {
32
- return normalizeHost(portlessUrl);
33
- }
34
- };
35
-
36
- export const getLocalRootHostsFromEnv = (env: EnvLike) => {
37
- const hosts = new Set<string>(LOCAL_ROOT_HOSTS);
38
- const portlessHost = getPortlessHostFromEnv(env);
39
- if (portlessHost) {
40
- hosts.add(portlessHost);
41
- }
42
- return hosts;
43
- };
44
-
45
- export const withLeadingSlash = (value: string) => {
46
- if (!value) {
47
- return "/";
48
- }
49
- return value.startsWith("/") ? value : `/${value}`;
50
- };
51
-
52
- export const withoutLeadingSlash = (value: string) => {
53
- if (!value) {
54
- return "";
55
- }
56
- return value.startsWith("/") ? value.slice(1) : value;
57
- };
58
-
59
- export const slugify = (value: string) =>
60
- value
61
- .toLowerCase()
62
- .trim()
63
- .replaceAll(/[^a-z0-9]+/g, "-")
64
- .replaceAll(/(^-|-$)+/g, "");
65
-
66
- const IGNORED_ROOT_DOCS_FILES = new Set([
67
- ".gitignore",
68
- "AGENTS.md",
69
- "CLAUDE.md",
70
- "LICENSE",
71
- "LICENSE.md",
72
- "README.md",
73
- ]);
74
-
75
- export const shouldIgnoreRootDocsFile = (value: string) => {
76
- const normalized = normalizePath(value);
77
- if (!normalized || normalized.includes("/")) {
78
- return false;
79
- }
80
- return IGNORED_ROOT_DOCS_FILES.has(normalized);
81
- };
82
-
83
- export const ensureArray = <T>(value?: T | T[]) => {
84
- if (value === undefined) {
85
- return [] as T[];
86
- }
87
- return Array.isArray(value) ? value : [value];
88
- };
89
-
90
- export const uniq = <T>(values: T[]) => [...new Set(values)];
91
-
92
- export const safeJsonParse = <T>(value: string): T | null => {
93
- try {
94
- return JSON.parse(value) as T;
95
- } catch {
96
- return null;
97
- }
98
- };
99
-
100
- export const clamp = (value: number, min: number, max: number) =>
101
- Math.min(Math.max(value, min), max);
@@ -1,21 +0,0 @@
1
- import { z } from "zod";
2
- export declare const ProjectAnalyticsGa4Schema: z.ZodObject<{
3
- measurementId: z.ZodString;
4
- }, z.core.$strip>;
5
- export type ProjectAnalyticsGa4 = z.infer<typeof ProjectAnalyticsGa4Schema>;
6
- export declare const ProjectAnalyticsPosthogSchema: z.ZodObject<{
7
- host: z.ZodOptional<z.ZodString>;
8
- projectKey: z.ZodString;
9
- }, z.core.$strip>;
10
- export type ProjectAnalyticsPosthog = z.infer<typeof ProjectAnalyticsPosthogSchema>;
11
- export declare const ProjectAnalyticsSchema: z.ZodObject<{
12
- ga4: z.ZodOptional<z.ZodObject<{
13
- measurementId: z.ZodString;
14
- }, z.core.$strip>>;
15
- posthog: z.ZodOptional<z.ZodObject<{
16
- host: z.ZodOptional<z.ZodString>;
17
- projectKey: z.ZodString;
18
- }, z.core.$strip>>;
19
- }, z.core.$strip>;
20
- export type ProjectAnalytics = z.infer<typeof ProjectAnalyticsSchema>;
21
- //# sourceMappingURL=analytics.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../src/analytics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,yBAAyB;;iBAOpC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,eAAO,MAAM,6BAA6B;;;iBAQxC,CAAC;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,6BAA6B,CACrC,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;;iBAGjC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
@@ -1,18 +0,0 @@
1
- import { z } from "zod";
2
- const GA4_MEASUREMENT_ID_REGEX = /^G-[A-Z0-9]{4,20}$/;
3
- const POSTHOG_PROJECT_KEY_REGEX = /^phc_[A-Za-z0-9]{20,}$/;
4
- export const ProjectAnalyticsGa4Schema = z.object({
5
- measurementId: z
6
- .string()
7
- .regex(GA4_MEASUREMENT_ID_REGEX, "GA4 measurement IDs look like G-XXXXXXXXXX."),
8
- });
9
- export const ProjectAnalyticsPosthogSchema = z.object({
10
- host: z.string().url().optional(),
11
- projectKey: z
12
- .string()
13
- .regex(POSTHOG_PROJECT_KEY_REGEX, "PostHog project keys start with phc_. Personal API keys (phx_) are not supported."),
14
- });
15
- export const ProjectAnalyticsSchema = z.object({
16
- ga4: ProjectAnalyticsGa4Schema.optional(),
17
- posthog: ProjectAnalyticsPosthogSchema.optional(),
18
- });
@@ -1,27 +0,0 @@
1
- import { z } from "zod";
2
- export declare const ApiKeySchema: z.ZodObject<{
3
- createdAt: z.ZodString;
4
- id: z.ZodString;
5
- keyPrefix: z.ZodString;
6
- lastUsedAt: z.ZodOptional<z.ZodString>;
7
- name: z.ZodString;
8
- projectId: z.ZodString;
9
- }, z.core.$strip>;
10
- export type ApiKey = z.infer<typeof ApiKeySchema>;
11
- export declare const ApiKeyCreateSchema: z.ZodObject<{
12
- name: z.ZodOptional<z.ZodString>;
13
- }, z.core.$strip>;
14
- export type ApiKeyCreateInput = z.infer<typeof ApiKeyCreateSchema>;
15
- export declare const ApiKeyCreatedSchema: z.ZodObject<{
16
- apiKey: z.ZodObject<{
17
- createdAt: z.ZodString;
18
- id: z.ZodString;
19
- keyPrefix: z.ZodString;
20
- lastUsedAt: z.ZodOptional<z.ZodString>;
21
- name: z.ZodString;
22
- projectId: z.ZodString;
23
- }, z.core.$strip>;
24
- key: z.ZodString;
25
- }, z.core.$strip>;
26
- export type ApiKeyCreated = z.infer<typeof ApiKeyCreatedSchema>;
27
- //# sourceMappingURL=api-key.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api-key.d.ts","sourceRoot":"","sources":["../src/api-key.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,YAAY;;;;;;;iBAOvB,CAAC;AACH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAElD,eAAO,MAAM,kBAAkB;;iBAE7B,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAInE,eAAO,MAAM,mBAAmB;;;;;;;;;;iBAG9B,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
@@ -1,20 +0,0 @@
1
- import { z } from "zod";
2
- import { IsoDateSchema } from "./dates.js";
3
- import { IdSchema } from "./ids.js";
4
- export const ApiKeySchema = z.object({
5
- createdAt: IsoDateSchema,
6
- id: IdSchema,
7
- keyPrefix: z.string().min(1),
8
- lastUsedAt: IsoDateSchema.optional(),
9
- name: z.string().min(1),
10
- projectId: IdSchema,
11
- });
12
- export const ApiKeyCreateSchema = z.object({
13
- name: z.string().min(1).max(100).optional(),
14
- });
15
- // Returned exactly once, at creation time — the only moment the plaintext key
16
- // is available. Callers must store `key`; the server keeps only its hash.
17
- export const ApiKeyCreatedSchema = z.object({
18
- apiKey: ApiKeySchema,
19
- key: z.string().min(1),
20
- });
@@ -1,4 +0,0 @@
1
- import { z } from "zod";
2
- export declare const IsoDateSchema: z.ZodString;
3
- export type IsoDate = z.infer<typeof IsoDateSchema>;
4
- //# sourceMappingURL=dates.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dates.d.ts","sourceRoot":"","sources":["../src/dates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,aAAa,aAAwB,CAAC;AACnD,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- import { z } from "zod";
2
- export const IsoDateSchema = z.string().datetime();