specra 0.1.13 → 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 (276) hide show
  1. package/LICENSE.MD +25 -4
  2. package/README.md +67 -58
  3. package/config/specra.config.schema.json +16 -0
  4. package/config/svelte-config.js +63 -0
  5. package/dist/api-parser.types.d.ts +59 -0
  6. package/dist/api-parser.types.js +5 -0
  7. package/dist/api.types.d.ts +137 -0
  8. package/dist/api.types.js +5 -0
  9. package/dist/category.d.ts +21 -0
  10. package/dist/category.js +48 -0
  11. package/dist/components/ConfigProvider.svelte +13 -0
  12. package/dist/components/ConfigProvider.svelte.d.ts +31 -0
  13. package/dist/components/docs/Accordion.svelte +18 -0
  14. package/dist/components/docs/Accordion.svelte.d.ts +10 -0
  15. package/dist/components/docs/AccordionItem.svelte +41 -0
  16. package/dist/components/docs/AccordionItem.svelte.d.ts +10 -0
  17. package/dist/components/docs/Badge.svelte +28 -0
  18. package/dist/components/docs/Badge.svelte.d.ts +9 -0
  19. package/dist/components/docs/Breadcrumb.svelte +80 -0
  20. package/dist/components/docs/Breadcrumb.svelte.d.ts +8 -0
  21. package/dist/components/docs/Callout.svelte +96 -0
  22. package/dist/components/docs/Callout.svelte.d.ts +10 -0
  23. package/dist/components/docs/Card.svelte +63 -0
  24. package/dist/components/docs/Card.svelte.d.ts +12 -0
  25. package/dist/components/docs/CardGrid.svelte +24 -0
  26. package/dist/components/docs/CardGrid.svelte.d.ts +8 -0
  27. package/dist/components/docs/CategoryIndex.svelte +110 -0
  28. package/dist/components/docs/CategoryIndex.svelte.d.ts +29 -0
  29. package/dist/components/docs/CodeBlock.svelte +172 -0
  30. package/dist/components/docs/CodeBlock.svelte.d.ts +8 -0
  31. package/dist/components/docs/Column.svelte +25 -0
  32. package/dist/components/docs/Column.svelte.d.ts +8 -0
  33. package/dist/components/docs/Columns.svelte +38 -0
  34. package/dist/components/docs/Columns.svelte.d.ts +13 -0
  35. package/dist/components/docs/DevModeBadge.svelte +15 -0
  36. package/dist/components/docs/DevModeBadge.svelte.d.ts +18 -0
  37. package/dist/components/docs/DocBadge.svelte +28 -0
  38. package/dist/components/docs/DocBadge.svelte.d.ts +9 -0
  39. package/dist/components/docs/DocLayout.svelte +107 -0
  40. package/dist/components/docs/DocLayout.svelte.d.ts +32 -0
  41. package/dist/components/docs/DocLoading.svelte +53 -0
  42. package/dist/components/docs/DocLoading.svelte.d.ts +18 -0
  43. package/dist/components/docs/DocMetadata.svelte +106 -0
  44. package/dist/components/docs/DocMetadata.svelte.d.ts +18 -0
  45. package/dist/components/docs/DocNavigation.svelte +56 -0
  46. package/dist/components/docs/DocNavigation.svelte.d.ts +12 -0
  47. package/dist/components/docs/DocTags.svelte +22 -0
  48. package/dist/components/docs/DocTags.svelte.d.ts +6 -0
  49. package/dist/components/docs/DraftBadge.svelte +10 -0
  50. package/dist/components/docs/DraftBadge.svelte.d.ts +18 -0
  51. package/dist/components/docs/Footer.svelte +72 -0
  52. package/dist/components/docs/Footer.svelte.d.ts +7 -0
  53. package/dist/components/docs/Frame.svelte +27 -0
  54. package/dist/components/docs/Frame.svelte.d.ts +9 -0
  55. package/dist/components/docs/Header.svelte +123 -0
  56. package/dist/components/docs/Header.svelte.d.ts +9 -0
  57. package/dist/components/docs/HeaderWithMenu.svelte +34 -0
  58. package/dist/components/docs/HeaderWithMenu.svelte.d.ts +17 -0
  59. package/dist/components/docs/HotReloadIndicator.svelte +44 -0
  60. package/dist/components/docs/HotReloadIndicator.svelte.d.ts +3 -0
  61. package/dist/components/docs/Icon.svelte +103 -0
  62. package/dist/components/docs/Icon.svelte.d.ts +11 -0
  63. package/dist/components/docs/Image.svelte +88 -0
  64. package/dist/components/docs/Image.svelte.d.ts +11 -0
  65. package/dist/components/docs/ImageCard.svelte +91 -0
  66. package/dist/components/docs/ImageCard.svelte.d.ts +12 -0
  67. package/dist/components/docs/ImageCardGrid.svelte +25 -0
  68. package/dist/components/docs/ImageCardGrid.svelte.d.ts +8 -0
  69. package/dist/components/docs/LayoutProviders.svelte +57 -0
  70. package/dist/components/docs/LayoutProviders.svelte.d.ts +9 -0
  71. package/dist/components/docs/Logo.svelte +25 -0
  72. package/dist/components/docs/Logo.svelte.d.ts +11 -0
  73. package/dist/components/docs/Math.svelte +54 -0
  74. package/dist/components/docs/Math.svelte.d.ts +7 -0
  75. package/dist/components/docs/MdxContent.svelte +41 -0
  76. package/dist/components/docs/MdxHotReload.svelte +78 -0
  77. package/dist/components/docs/MdxHotReload.svelte.d.ts +9 -0
  78. package/dist/components/docs/MdxLayout.svelte +16 -0
  79. package/dist/components/docs/MdxLayout.svelte.d.ts +6 -0
  80. package/dist/components/docs/Mermaid.svelte +88 -0
  81. package/dist/components/docs/Mermaid.svelte.d.ts +7 -0
  82. package/dist/components/docs/MobileDocLayout.svelte +211 -0
  83. package/dist/components/docs/MobileDocLayout.svelte.d.ts +35 -0
  84. package/dist/components/docs/MobileSidebar.svelte +122 -0
  85. package/dist/components/docs/MobileSidebar.svelte.d.ts +31 -0
  86. package/dist/components/docs/MobileSidebarWrapper.svelte +122 -0
  87. package/dist/components/docs/MobileSidebarWrapper.svelte.d.ts +32 -0
  88. package/dist/components/docs/NotFoundContent.svelte +40 -0
  89. package/dist/components/docs/NotFoundContent.svelte.d.ts +6 -0
  90. package/dist/components/docs/SearchHighlight.svelte +116 -0
  91. package/dist/components/docs/SearchHighlight.svelte.d.ts +3 -0
  92. package/dist/components/docs/SearchModal.svelte +239 -0
  93. package/dist/components/docs/SearchModal.svelte.d.ts +9 -0
  94. package/dist/components/docs/Sidebar.svelte +69 -0
  95. package/dist/components/docs/Sidebar.svelte.d.ts +31 -0
  96. package/dist/components/docs/SidebarMenuItems.svelte +344 -0
  97. package/dist/components/docs/SidebarMenuItems.svelte.d.ts +33 -0
  98. package/dist/components/docs/SidebarSkeleton.svelte +50 -0
  99. package/dist/components/docs/SidebarSkeleton.svelte.d.ts +18 -0
  100. package/dist/components/docs/SiteBanner.svelte +92 -0
  101. package/dist/components/docs/SiteBanner.svelte.d.ts +7 -0
  102. package/dist/components/docs/Step.svelte +44 -0
  103. package/dist/components/docs/Step.svelte.d.ts +8 -0
  104. package/dist/components/docs/Steps.svelte +15 -0
  105. package/dist/components/docs/Steps.svelte.d.ts +7 -0
  106. package/dist/components/docs/Tab.svelte +40 -0
  107. package/dist/components/docs/Tab.svelte.d.ts +8 -0
  108. package/dist/components/docs/TabGroups.svelte +183 -0
  109. package/dist/components/docs/TabGroups.svelte.d.ts +25 -0
  110. package/dist/components/docs/TableOfContents.svelte +100 -0
  111. package/dist/components/docs/TableOfContents.svelte.d.ts +9 -0
  112. package/dist/components/docs/Tabs.svelte +69 -0
  113. package/dist/components/docs/Tabs.svelte.d.ts +8 -0
  114. package/dist/components/docs/ThemeToggle.svelte +16 -0
  115. package/dist/components/docs/ThemeToggle.svelte.d.ts +18 -0
  116. package/dist/components/docs/Tooltip.svelte +44 -0
  117. package/dist/components/docs/Tooltip.svelte.d.ts +10 -0
  118. package/dist/components/docs/VersionSwitcher.svelte +95 -0
  119. package/dist/components/docs/VersionSwitcher.svelte.d.ts +7 -0
  120. package/dist/components/docs/Video.svelte +84 -0
  121. package/dist/components/docs/Video.svelte.d.ts +12 -0
  122. package/dist/components/docs/api/ApiEndpoint.svelte +61 -0
  123. package/dist/components/docs/api/ApiEndpoint.svelte.d.ts +11 -0
  124. package/dist/components/docs/api/ApiParams.svelte +80 -0
  125. package/dist/components/docs/api/ApiParams.svelte.d.ts +14 -0
  126. package/dist/components/docs/api/ApiPlayground.svelte +259 -0
  127. package/dist/components/docs/api/ApiPlayground.svelte.d.ts +16 -0
  128. package/dist/components/docs/api/ApiReference.svelte +278 -0
  129. package/dist/components/docs/api/ApiReference.svelte.d.ts +23 -0
  130. package/dist/components/docs/api/ApiResponse.svelte +66 -0
  131. package/dist/components/docs/api/ApiResponse.svelte.d.ts +9 -0
  132. package/dist/components/docs/api/index.d.ts +5 -0
  133. package/dist/components/docs/api/index.js +5 -0
  134. package/dist/components/docs/componentTextProps.d.ts +3 -0
  135. package/dist/components/docs/componentTextProps.js +61 -0
  136. package/dist/components/docs/index.d.ts +54 -0
  137. package/dist/components/docs/index.js +56 -0
  138. package/dist/components/global/VersionNotFound.svelte +48 -0
  139. package/dist/components/global/VersionNotFound.svelte.d.ts +7 -0
  140. package/dist/components/global/index.d.ts +1 -0
  141. package/dist/components/global/index.js +1 -0
  142. package/dist/components/index.d.ts +6 -822
  143. package/dist/components/index.js +11 -3854
  144. package/dist/components/ui/Badge.svelte +48 -0
  145. package/dist/components/ui/Badge.svelte.d.ts +15 -0
  146. package/dist/components/ui/Button.svelte +58 -0
  147. package/dist/components/ui/Button.svelte.d.ts +17 -0
  148. package/dist/components/ui/Dialog.svelte +16 -0
  149. package/dist/components/ui/Dialog.svelte.d.ts +9 -0
  150. package/dist/components/ui/DialogClose.svelte +16 -0
  151. package/dist/components/ui/DialogClose.svelte.d.ts +9 -0
  152. package/dist/components/ui/DialogContent.svelte +43 -0
  153. package/dist/components/ui/DialogContent.svelte.d.ts +10 -0
  154. package/dist/components/ui/DialogDescription.svelte +21 -0
  155. package/dist/components/ui/DialogDescription.svelte.d.ts +9 -0
  156. package/dist/components/ui/DialogFooter.svelte +20 -0
  157. package/dist/components/ui/DialogFooter.svelte.d.ts +9 -0
  158. package/dist/components/ui/DialogHeader.svelte +20 -0
  159. package/dist/components/ui/DialogHeader.svelte.d.ts +9 -0
  160. package/dist/components/ui/DialogTitle.svelte +21 -0
  161. package/dist/components/ui/DialogTitle.svelte.d.ts +9 -0
  162. package/dist/components/ui/Input.svelte +23 -0
  163. package/dist/components/ui/Input.svelte.d.ts +8 -0
  164. package/dist/components/ui/Textarea.svelte +19 -0
  165. package/dist/components/ui/Textarea.svelte.d.ts +7 -0
  166. package/dist/components/ui/index.d.ts +11 -0
  167. package/dist/components/ui/index.js +11 -0
  168. package/dist/config.d.ts +8 -0
  169. package/dist/config.js +9 -0
  170. package/dist/config.schema.json +471 -0
  171. package/dist/config.server.d.ts +46 -0
  172. package/dist/config.server.js +149 -0
  173. package/dist/{mdx-ColN3Cyg.d.mts → config.types.d.ts} +22 -75
  174. package/dist/config.types.js +39 -0
  175. package/dist/dev-utils.d.ts +29 -0
  176. package/dist/dev-utils.js +63 -0
  177. package/dist/index.d.ts +19 -4
  178. package/dist/index.js +25 -4861
  179. package/dist/mdx-cache.d.ts +41 -0
  180. package/dist/mdx-cache.js +160 -0
  181. package/dist/mdx-components.js +50 -1931
  182. package/dist/mdx-security.d.ts +76 -0
  183. package/dist/mdx-security.js +217 -0
  184. package/dist/mdx.d.ts +73 -0
  185. package/dist/mdx.js +1099 -0
  186. package/dist/middleware/index.d.ts +1 -0
  187. package/dist/middleware/index.js +2 -0
  188. package/dist/middleware/security.d.ts +22 -47
  189. package/dist/middleware/security.js +111 -137
  190. package/dist/parsers/base-parser.d.ts +14 -0
  191. package/dist/parsers/base-parser.js +1 -0
  192. package/dist/parsers/index.d.ts +16 -0
  193. package/dist/parsers/index.js +51 -0
  194. package/dist/parsers/openapi-parser.d.ts +18 -0
  195. package/dist/parsers/openapi-parser.js +209 -0
  196. package/dist/parsers/postman-parser.d.ts +20 -0
  197. package/dist/parsers/postman-parser.js +260 -0
  198. package/dist/parsers/specra-parser.d.ts +10 -0
  199. package/dist/parsers/specra-parser.js +18 -0
  200. package/dist/redirects.d.ts +12 -0
  201. package/dist/redirects.js +30 -0
  202. package/dist/remark-code-meta.d.ts +6 -0
  203. package/dist/remark-code-meta.js +21 -0
  204. package/dist/sidebar-utils.d.ts +59 -0
  205. package/dist/sidebar-utils.js +144 -0
  206. package/dist/stores/config.d.ts +20 -0
  207. package/dist/stores/config.js +45 -0
  208. package/dist/stores/index.d.ts +4 -0
  209. package/dist/stores/index.js +4 -0
  210. package/dist/stores/sidebar.d.ts +7 -0
  211. package/dist/stores/sidebar.js +12 -0
  212. package/dist/stores/tabs.d.ts +6 -0
  213. package/dist/stores/tabs.js +41 -0
  214. package/dist/stores/theme.d.ts +7 -0
  215. package/dist/stores/theme.js +75 -0
  216. package/dist/{styles.css → styles/globals.css} +136 -6
  217. package/dist/toc.d.ts +9 -0
  218. package/dist/toc.js +15 -0
  219. package/dist/utils.d.ts +13 -0
  220. package/dist/utils.js +30 -0
  221. package/package.json +47 -90
  222. package/dist/app/api/mdx-watch/route.d.mts +0 -10
  223. package/dist/app/api/mdx-watch/route.d.ts +0 -10
  224. package/dist/app/api/mdx-watch/route.js +0 -118
  225. package/dist/app/api/mdx-watch/route.js.map +0 -1
  226. package/dist/app/api/mdx-watch/route.mjs +0 -91
  227. package/dist/app/api/mdx-watch/route.mjs.map +0 -1
  228. package/dist/chunk-6S3EJVEO.mjs +0 -259
  229. package/dist/chunk-6S3EJVEO.mjs.map +0 -1
  230. package/dist/chunk-BE7EROIW.mjs +0 -212
  231. package/dist/chunk-BE7EROIW.mjs.map +0 -1
  232. package/dist/chunk-CWHRZHZO.mjs +0 -168
  233. package/dist/chunk-CWHRZHZO.mjs.map +0 -1
  234. package/dist/chunk-D5VDVYFY.mjs +0 -1325
  235. package/dist/chunk-D5VDVYFY.mjs.map +0 -1
  236. package/dist/chunk-WMCO2UX5.mjs +0 -585
  237. package/dist/chunk-WMCO2UX5.mjs.map +0 -1
  238. package/dist/chunk-XEMGCPZZ.mjs +0 -475
  239. package/dist/chunk-XEMGCPZZ.mjs.map +0 -1
  240. package/dist/components/index.d.mts +0 -822
  241. package/dist/components/index.js.map +0 -1
  242. package/dist/components/index.mjs +0 -3741
  243. package/dist/components/index.mjs.map +0 -1
  244. package/dist/index.d.mts +0 -4
  245. package/dist/index.js.map +0 -1
  246. package/dist/index.mjs +0 -1897
  247. package/dist/index.mjs.map +0 -1
  248. package/dist/layouts/index.d.mts +0 -34
  249. package/dist/layouts/index.d.ts +0 -34
  250. package/dist/layouts/index.js +0 -453
  251. package/dist/layouts/index.js.map +0 -1
  252. package/dist/layouts/index.mjs +0 -173
  253. package/dist/layouts/index.mjs.map +0 -1
  254. package/dist/lib/index.d.mts +0 -583
  255. package/dist/lib/index.d.ts +0 -583
  256. package/dist/lib/index.js +0 -1595
  257. package/dist/lib/index.js.map +0 -1
  258. package/dist/lib/index.mjs +0 -111
  259. package/dist/lib/index.mjs.map +0 -1
  260. package/dist/mdx-ColN3Cyg.d.ts +0 -352
  261. package/dist/mdx-components.d.mts +0 -86
  262. package/dist/mdx-components.d.ts +0 -86
  263. package/dist/mdx-components.js.map +0 -1
  264. package/dist/mdx-components.mjs +0 -206
  265. package/dist/mdx-components.mjs.map +0 -1
  266. package/dist/middleware/security.d.mts +0 -82
  267. package/dist/middleware/security.js.map +0 -1
  268. package/dist/middleware/security.mjs +0 -84
  269. package/dist/middleware/security.mjs.map +0 -1
  270. package/dist/styles.css.map +0 -1
  271. package/dist/styles.d.mts +0 -2
  272. package/dist/styles.d.ts +0 -2
  273. package/dist/styles.js +0 -2
  274. package/dist/styles.js.map +0 -1
  275. package/dist/styles.mjs +0 -1
  276. package/dist/styles.mjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/lib/index.ts","../../src/lib/mdx.ts","../../src/lib/category.ts","../../src/lib/sidebar-utils.ts","../../src/lib/mdx-security.ts","../../src/lib/config.types.ts","../../src/lib/config.server.ts","../../src/lib/mdx-cache.ts","../../src/lib/dev-utils.ts","../../src/lib/toc.ts","../../src/lib/parsers/specra-parser.ts","../../src/lib/parsers/openapi-parser.ts","../../src/lib/parsers/postman-parser.ts","../../src/lib/parsers/index.ts","../../src/lib/utils.ts","../../src/lib/redirects.ts"],"sourcesContent":["// MDX Processing\nexport * from './mdx'\nexport * from './mdx-cache'\nexport * from './toc'\n\n// Configuration\nexport * from './config.server'\nexport * from './config'\nexport type * from './config.types'\n\n// API Parsers\nexport * from './parsers'\nexport type * from './api.types'\nexport type {\n ApiParam,\n ApiHeader,\n ApiResponse as SpecraApiResponse,\n ApiEndpointSpec,\n SpecraApiSpec\n} from './api-parser.types'\n\n// Utilities\nexport * from './utils'\nexport * from './sidebar-utils'\nexport * from './category'\nexport * from './redirects'\nexport * from './dev-utils'\n\n// Security\nexport * from './mdx-security'","import fs from \"fs\"\nimport path from \"path\"\nimport matter from \"gray-matter\"\nimport { getAllCategoryConfigs } from \"./category\"\nimport { sortSidebarItems, sortSidebarGroups, buildSidebarStructure, type SidebarGroup } from \"./sidebar-utils\"\nimport { sanitizePath, validatePathWithinDirectory, validateMDXSecurity } from \"./mdx-security\"\nimport { getConfig } from \"./config\"\nimport { I18nConfig } from \"./config.types\"\n\nconst DOCS_DIR = path.join(process.cwd(), \"docs\")\n\n/**\n * Calculate reading time based on word count\n * Average reading speed: 200 words per minute\n */\nfunction calculateReadingTime(content: string): { minutes: number; words: number } {\n const words = content.trim().split(/\\s+/).length\n const minutes = Math.ceil(words / 200)\n return { minutes, words }\n}\n\nexport interface DocMeta {\n title: string\n description?: string\n slug?: string\n section?: string\n group?: string\n sidebar?: string\n order?: number\n sidebar_position?: number\n content?: string\n last_updated?: string\n draft?: boolean\n authors?: Array<{ id: string; name?: string }>\n tags?: string[]\n redirect_from?: string[]\n reading_time?: number\n word_count?: number\n icon?: string // Icon name for sidebar display (Lucide icon name)\n tab_group?: string // Tab group ID for organizing docs into tabs\n locale?: string // Locale of the document\n}\n\nexport interface Doc {\n slug: string\n filePath: string // Original file path for sidebar grouping\n title: string\n meta: DocMeta\n content: string\n categoryLabel?: string // Label from _category_.json\n categoryPosition?: number // Position from _category_.json\n categoryCollapsible?: boolean // Collapsible from _category_.json\n categoryCollapsed?: boolean // Default collapsed state from _category_.json\n categoryIcon?: string // Icon from _category_.json\n categoryTabGroup?: string // Tab group from _category_.json\n locale?: string // Locale of the document\n}\n\nexport interface TocItem {\n id: string\n title: string\n level: number\n}\n\nexport function getVersions(): string[] {\n try {\n const versions = fs.readdirSync(DOCS_DIR)\n return versions.filter((v) => fs.statSync(path.join(DOCS_DIR, v)).isDirectory())\n } catch (error) {\n return [\"v1.0.0\"]\n }\n}\n\n/**\n * Recursively find all MDX files in a directory\n */\nfunction findMdxFiles(dir: string, baseDir: string = dir): string[] {\n const files: string[] = []\n\n try {\n const entries = fs.readdirSync(dir, { withFileTypes: true })\n\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name)\n\n if (entry.isDirectory()) {\n files.push(...findMdxFiles(fullPath, baseDir))\n } else if (entry.isFile() && entry.name.endsWith(\".mdx\")) {\n // Get relative path from base directory and normalize to forward slashes\n const relativePath = path.relative(baseDir, fullPath).replace(/\\\\/g, '/')\n files.push(relativePath)\n }\n }\n } catch (error) {\n console.error(`Error reading directory ${dir}:`, error)\n }\n\n return files\n}\n\n/**\n * Internal function to read a doc from file path\n */\nfunction readDocFromFile(filePath: string, originalSlug: string): Doc | null {\n try {\n if (!fs.existsSync(filePath)) {\n return null\n }\n\n // Validate path is within allowed directory\n if (!validatePathWithinDirectory(filePath, DOCS_DIR)) {\n console.error(`[Security] Path traversal attempt blocked: ${filePath}`)\n return null\n }\n\n const fileContents = fs.readFileSync(filePath, \"utf8\")\n const { data, content } = matter(fileContents)\n\n // Security: Validate MDX content for dangerous patterns\n const securityCheck = validateMDXSecurity(content, {\n strictMode: process.env.NODE_ENV === 'production',\n blockDangerousPatterns: true,\n })\n\n if (!securityCheck.valid) {\n console.error(`[Security] MDX validation failed for ${filePath}:`, securityCheck.issues)\n if (process.env.NODE_ENV === 'production') {\n return null\n }\n // In development, log warnings but continue\n console.warn('[Security] Continuing in development mode with sanitized content')\n }\n\n // Use sanitized content if available\n const safeContent = securityCheck.sanitized || content\n\n // Calculate reading time\n const { minutes, words } = calculateReadingTime(safeContent)\n\n // If custom slug provided, replace only the filename part, keep the folder structure\n let finalSlug = originalSlug\n if (data.slug) {\n const customSlug = data.slug.replace(/^\\//, '')\n const parts = originalSlug.split(\"/\")\n\n if (parts.length > 1) {\n // Keep folder structure, replace only filename\n parts[parts.length - 1] = customSlug\n finalSlug = parts.join(\"/\")\n } else {\n // Root level file, use custom slug as-is\n finalSlug = customSlug\n }\n }\n\n return {\n slug: finalSlug,\n filePath: originalSlug, // Keep original file path for sidebar\n title: data.title || originalSlug,\n meta: {\n ...data,\n content: safeContent,\n reading_time: minutes,\n word_count: words,\n } as DocMeta,\n content: safeContent,\n }\n } catch (error) {\n console.error(`Error reading file ${filePath}:`, error)\n return null\n }\n}\n\nexport function getI18nConfig(): I18nConfig | null {\n const config = getConfig()\n const i18n = config.features?.i18n\n\n if (!i18n) return null\n\n if (typeof i18n === 'boolean') {\n return i18n ? {\n defaultLocale: 'en',\n locales: ['en'],\n localeNames: { en: 'English' }\n } : null\n }\n\n return i18n\n}\n\nexport async function getDocBySlug(slug: string, version = \"v1.0.0\", locale?: string): Promise<Doc | null> {\n try {\n // Security: Sanitize and validate slug\n const sanitizedVersion = sanitizePath(version)\n let sanitizedSlug = sanitizePath(slug)\n\n // Get i18n config\n const i18nConfig = getI18nConfig()\n\n // Determine locale from slug if not provided\n let detectedLocale = locale || i18nConfig?.defaultLocale\n\n if (i18nConfig) {\n const parts = sanitizedSlug.split('/')\n if (parts.length > 0 && i18nConfig.locales.includes(parts[0])) {\n detectedLocale = parts[0]\n sanitizedSlug = parts.slice(1).join('/')\n if (sanitizedSlug === \"\") sanitizedSlug = \"index\"\n }\n }\n\n const targetLocale = detectedLocale\n const isDefaultLocale = targetLocale === i18nConfig?.defaultLocale\n\n // Try finding the file in this order:\n // 1. Localized extension: slug.locale.mdx (e.g. guide.fr.mdx)\n // 2. Default file: slug.mdx (only if using default locale and configured to fallback or strictly default)\n\n // Construct potential paths\n const basePath = path.join(DOCS_DIR, sanitizedVersion)\n\n // 1. Try localized file extension\n if (targetLocale) {\n const localizedPath = path.join(basePath, `${sanitizedSlug}.${targetLocale}.mdx`)\n const doc = readDocFromFile(localizedPath, sanitizedSlug) // Keep parsed slug\n if (doc) {\n doc.slug = i18nConfig ? `${targetLocale}/${sanitizedSlug}` : sanitizedSlug\n doc.meta.locale = targetLocale\n return doc\n }\n }\n\n // 2. Try default file\n const defaultPath = path.join(basePath, `${sanitizedSlug}.mdx`)\n const doc = readDocFromFile(defaultPath, sanitizedSlug)\n\n if (doc) {\n // If we found a default file but requested a specific locale using prefix, \n // we might want to return it but with the prefix in slug if we are doing fallback.\n // For now, strict mode: if I request /fr/guide and guide.fr.mdx is missing, \n // should I return guide.mdx? \n // Let's assume explicitly: Yes, but keep the URL /fr/guide ?? \n // No, typically you want 404 if translation missing, OR fallback.\n // Let's stick to: if explicit locale requested and file not found, we fall through to null eventually.\n // BUT if it matches default locale, we return it.\n\n if (isDefaultLocale || !i18nConfig) {\n // For default locale, we might want to prefix if prompt said \"add language to url\"\n // If i18n enabled and prefixDefault is true, ensure slug has prefix.\n // But existing behavior for default locale usually omits prefix.\n // If plan said: /en/docs/... then we probably want prefix even for default?\n // The config I added has `prefixDefault`. Checks that.\n\n const usePrefix = i18nConfig && (i18nConfig.prefixDefault || targetLocale !== i18nConfig.defaultLocale)\n\n if (usePrefix && targetLocale) {\n doc.slug = `${targetLocale}/${doc.slug}`\n }\n doc.meta.locale = targetLocale || 'en'\n return doc\n }\n }\n\n // If still not found, search all docs for a matching custom slug\n // This part is expensive and might need update for i18n, disabling for now or leaving as is for default locale\n // Ideally custom slugs should also be localized? \n // Let's rely on standard file resolution for now for i18n to ensure stability.\n\n return null\n } catch (error) {\n console.error(`Error reading doc ${slug}:`, error)\n return null\n }\n}\n\nexport async function getAllDocs(version = \"v1.0.0\", locale?: string): Promise<Doc[]> {\n try {\n const versionDir = path.join(DOCS_DIR, version)\n\n if (!fs.existsSync(versionDir)) {\n return []\n }\n\n // Get i18n config\n const i18nConfig = getI18nConfig()\n const targetLocale = locale || i18nConfig?.defaultLocale || 'en'\n\n const mdxFiles = findMdxFiles(versionDir)\n const categoryConfigs = getAllCategoryConfigs(version)\n\n const docs = await Promise.all(\n mdxFiles.map(async (file) => {\n // file contains path relative to version dir, e.g. \"getting-started/intro.mdx\" or \"intro.fr.mdx\"\n\n let originalFilePath = file.replace(/\\.mdx$/, \"\")\n\n // Handle localized files\n let isLocalized = false\n let fileLocale = i18nConfig?.defaultLocale || 'en'\n\n if (i18nConfig) {\n // Check for .<locale> suffix\n const parts = originalFilePath.split('.')\n const lastPart = parts[parts.length - 1]\n if (i18nConfig.locales.includes(lastPart)) {\n fileLocale = lastPart\n isLocalized = true\n originalFilePath = parts.slice(0, -1).join('.')\n }\n }\n\n // If we requested a specific locale, filter out others\n // If target is 'fr', we want intro.fr.mdx (if exists) OR intro.mdx (fallback? no, getAllDocs is usually for list)\n // Actually, for sidebar we want the \"best\" version of each doc for the current locale.\n\n // Strategy: Map all files to their logical slug, then group by slug and pick best locale.\n // But getAllDocs is async and parallel.\n\n // Simplified: Just process all files, returning the doc with its true locale.\n // Then filter/merge later? \n // No, current logic returns flat array.\n\n // Let's try to load the doc.\n const doc = await getDocBySlug(originalFilePath, version, isLocalized ? fileLocale : undefined)\n\n if (!doc) return null\n\n // Override filePath properties for sidebar grouping \n // (we want grouped by logical path, not physically localized path if possible)\n doc.filePath = originalFilePath // Use logical path (without .fr) for grouping\n\n const folderPath = path.dirname(originalFilePath).replace(/\\\\/g, '/')\n if (folderPath !== \".\") {\n const categoryConfig = categoryConfigs.get(folderPath)\n if (categoryConfig) {\n doc.categoryLabel = categoryConfig.label\n doc.categoryPosition = categoryConfig.position ?? categoryConfig.sidebar_position\n doc.categoryCollapsible = categoryConfig.collapsible\n doc.categoryCollapsed = categoryConfig.collapsed\n doc.categoryIcon = categoryConfig.icon\n doc.categoryTabGroup = categoryConfig.tab_group\n }\n }\n\n return doc\n }),\n )\n\n const isDevelopment = process.env.NODE_ENV === \"development\"\n\n // Create a map to track unique slugs and avoid duplicates, prioritizing target locale\n const uniqueDocs = new Map<string, Doc>()\n\n // Sort docs such that target locale comes first? No, we need to filter/merge.\n const validDocs = docs.filter((doc): doc is Doc => doc !== null && (isDevelopment || !doc.meta.draft))\n\n // Group by logical slug (we stored logical path in filePath, maybe use that?)\n // Actually doc.slug might differ if custom slug used.\n\n // If we have intro.mdx (en) and intro.fr.mdx (fr)\n // And targetLocale is 'fr'\n // We want the 'fr' one.\n\n validDocs.forEach(doc => {\n // If we want all docs (e.g. for static params generation), return everything unique by slug\n if (locale === 'all') {\n uniqueDocs.set(doc.slug, doc)\n return\n }\n\n // Identify logical slug. \n // If doc.slug already has prefix (e.g. fr/intro), stripped slug is 'intro'.\n let logicalSlug = doc.slug\n if (i18nConfig) {\n const parts = logicalSlug.split('/')\n if (i18nConfig.locales.includes(parts[0])) {\n logicalSlug = parts.slice(1).join('/')\n }\n }\n\n const existing = uniqueDocs.get(logicalSlug)\n\n if (!existing) {\n // If doc matches target locale or is default (and we allow default fallback), take it.\n // For now, take everything, filter later?\n // Better: Only add if it matches target locale OR is default and we don't have target yet.\n if (doc.meta.locale === targetLocale) {\n uniqueDocs.set(logicalSlug, doc)\n } else if (doc.meta.locale === i18nConfig?.defaultLocale) {\n uniqueDocs.set(logicalSlug, doc)\n }\n } else {\n // We have an existing entry. prefer targetLocale\n if (doc.meta.locale === targetLocale && existing.meta.locale !== targetLocale) {\n uniqueDocs.set(logicalSlug, doc)\n }\n }\n })\n\n return Array.from(uniqueDocs.values()).sort((a, b) => {\n const orderA = a.meta.sidebar_position ?? a.meta.order ?? 999\n const orderB = b.meta.sidebar_position ?? b.meta.order ?? 999\n return orderA - orderB\n })\n } catch (error) {\n console.error(`Error getting all docs for version ${version}:`, error)\n return []\n }\n}\n\n// export function getAdjacentDocs(currentSlug: string, allDocs: Doc[]): { previous?: Doc; next?: Doc } {\n// const currentIndex = allDocs.findIndex((doc) => doc.slug === currentSlug)\n\n// if (currentIndex === -1) {\n// return {}\n// }\n\n// return {\n// previous: currentIndex > 0 ? allDocs[currentIndex - 1] : undefined,\n// next: currentIndex < allDocs.length - 1 ? allDocs[currentIndex + 1] : undefined,\n// }\n// }\n\n// Flatten the sidebar structure into a linear order\nfunction flattenSidebarOrder(\n rootGroups: Record<string, SidebarGroup>,\n standalone: Doc[]\n): Doc[] {\n const flatDocs: Doc[] = []\n\n // Recursively flatten groups - intermix folders and files by position\n const flattenGroup = (group: SidebarGroup) => {\n const sortedChildren = sortSidebarGroups(group.children)\n const sortedItems = sortSidebarItems(group.items)\n\n // Merge child groups and items, then sort by position\n const merged: Array<{ type: 'group', group: SidebarGroup, position: number } | { type: 'item', doc: Doc, position: number }> = [\n ...sortedChildren.map(([, childGroup]) => ({\n type: 'group' as const,\n group: childGroup,\n position: childGroup.position\n })),\n ...sortedItems.map((doc) => ({\n type: 'item' as const,\n doc,\n position: doc.meta.sidebar_position ?? doc.meta.order ?? 999\n }))\n ]\n\n // Sort by position\n merged.sort((a, b) => a.position - b.position)\n\n // Process in sorted order\n merged.forEach((item) => {\n if (item.type === 'group') {\n flattenGroup(item.group)\n } else {\n flatDocs.push(item.doc)\n }\n })\n }\n\n // Add standalone items first\n sortSidebarItems(standalone).forEach((doc) => {\n flatDocs.push(doc)\n })\n\n // Then add all grouped items\n const sortedRootGroups = sortSidebarGroups(rootGroups)\n sortedRootGroups.forEach(([, group]) => {\n flattenGroup(group)\n })\n\n return flatDocs\n}\n\nexport function getAdjacentDocs(currentSlug: string, allDocs: Doc[]): { previous?: Doc; next?: Doc } {\n // Build the same sidebar structure\n const { rootGroups, standalone } = buildSidebarStructure(allDocs)\n\n // Flatten into the same order as shown in the sidebar\n const orderedDocs = flattenSidebarOrder(rootGroups, standalone)\n\n // Find current doc in the ordered list\n const currentIndex = orderedDocs.findIndex((doc) => doc.slug === currentSlug)\n\n if (currentIndex === -1) {\n return {}\n }\n\n const currentDoc = orderedDocs[currentIndex]\n\n // Get current doc's tab group (from meta or category)\n const currentTabGroup = currentDoc.meta?.tab_group || currentDoc.categoryTabGroup\n\n // Filter docs to match the current doc's tab group status\n // If current has a tab group, only show docs in the same tab group\n // If current has NO tab group, only show docs with NO tab group\n const filteredDocs = orderedDocs.filter((doc) => {\n const docTabGroup = doc.meta?.tab_group || doc.categoryTabGroup\n\n // If current doc has a tab group, only include docs with the same tab group\n if (currentTabGroup) {\n return docTabGroup === currentTabGroup\n }\n\n // If current doc has no tab group, only include docs with no tab group\n return !docTabGroup\n })\n\n // Find current doc's index within the filtered list\n const filteredIndex = filteredDocs.findIndex((doc) => doc.slug === currentSlug)\n\n if (filteredIndex === -1) {\n return {}\n }\n\n return {\n previous: filteredIndex > 0 ? filteredDocs[filteredIndex - 1] : undefined,\n next: filteredIndex < filteredDocs.length - 1 ? filteredDocs[filteredIndex + 1] : undefined,\n }\n}\n\nexport function extractTableOfContents(content: string): TocItem[] {\n const headingRegex = /^(#{2,3})\\s+(.+)$/gm\n const toc: TocItem[] = []\n let match\n\n while ((match = headingRegex.exec(content)) !== null) {\n const level = match[1].length\n const text = match[2]\n // Generate ID the same way rehype-slug does\n const id = text\n .toLowerCase()\n .replace(/\\s+/g, \"-\") // Replace spaces with hyphens first\n .replace(/[^a-z0-9-]/g, \"\") // Remove special chars (dots, slashes, etc)\n .replace(/^-|-$/g, \"\") // Remove leading/trailing hyphens\n\n toc.push({ id, title: text, level })\n }\n\n return toc\n}\n\n/**\n * Check if a slug represents a category (has child documents)\n */\nexport function isCategoryPage(slug: string, allDocs: Doc[]): boolean {\n return allDocs.some((doc) => {\n const parts = doc.slug.split(\"/\")\n const docParent = parts.slice(0, -1).join(\"/\")\n return docParent === slug && doc.slug !== slug\n })\n}\n\n\n","// Note: This file uses server-only APIs (fs, path) and should only be imported in Server Components\nimport fs from \"fs\"\nimport path from \"path\"\n\nexport interface CategoryConfig {\n label?: string\n position?: number\n sidebar_position?: number // Alternative naming for position\n link?: {\n type: \"generated-index\" | \"doc\"\n slug?: string\n }\n collapsed?: boolean\n collapsible?: boolean\n icon?: string // Icon name for sidebar display (Lucide icon name)\n tab_group?: string // Tab group ID for organizing categories into tabs\n}\n\nconst DOCS_DIR = path.join(process.cwd(), \"docs\")\n\n/**\n * Read category.json from a folder\n */\nexport function getCategoryConfig(folderPath: string): CategoryConfig | null {\n try {\n const categoryPath = path.join(folderPath, \"_category_.json\")\n\n if (!fs.existsSync(categoryPath)) {\n return null\n }\n\n const content = fs.readFileSync(categoryPath, \"utf8\")\n return JSON.parse(content) as CategoryConfig\n } catch (error) {\n console.error(`Error reading category config from ${folderPath}:`, error)\n return null\n }\n}\n\n/**\n * Get all category configs for a version\n */\nexport function getAllCategoryConfigs(version: string): Map<string, CategoryConfig> {\n const configs = new Map<string, CategoryConfig>()\n const versionDir = path.join(DOCS_DIR, version)\n\n if (!fs.existsSync(versionDir)) {\n return configs\n }\n\n function scanDirectory(dir: string, relativePath: string = \"\") {\n const entries = fs.readdirSync(dir, { withFileTypes: true })\n\n for (const entry of entries) {\n if (entry.isDirectory()) {\n const fullPath = path.join(dir, entry.name)\n const relPath = relativePath ? `${relativePath}/${entry.name}` : entry.name\n\n const config = getCategoryConfig(fullPath)\n if (config) {\n configs.set(relPath, config)\n }\n\n // Recursively scan subdirectories\n scanDirectory(fullPath, relPath)\n }\n }\n }\n\n scanDirectory(versionDir)\n return configs\n}\n","/**\n * Unified sidebar sorting and structure building utilities\n * This module provides consistent sidebar logic across the application\n * to ensure ordering is handled the same way everywhere.\n */\n\nexport interface SidebarGroup {\n label: string\n path: string\n icon?: string\n items: any[]\n position: number\n collapsible: boolean\n defaultCollapsed: boolean\n children: Record<string, SidebarGroup>\n}\n\n/**\n * Sort sidebar items by their position.\n * Items with explicit sidebar_position come first (sorted numerically),\n * followed by items without position (sorted by their original order).\n *\n * @param items - Array of items with optional sidebar_position\n * @returns Sorted array of items\n */\nexport function sortSidebarItems<T extends { sidebar_position?: number; meta?: any }>(items: T[]): T[] {\n return [...items].sort((a, b) => {\n const posA = a.sidebar_position ?? a.meta?.sidebar_position ?? a.meta?.order ?? 999\n const posB = b.sidebar_position ?? b.meta?.sidebar_position ?? b.meta?.order ?? 999\n return posA - posB\n })\n}\n\n/**\n * Sort sidebar groups by their position.\n * Groups with explicit position come first (sorted numerically),\n * followed by groups without position at the end (sorted by their original order).\n *\n * @param groups - Record of group key to group object with position\n * @returns Sorted array of [key, group] tuples\n */\nexport function sortSidebarGroups<T extends { position: number }>(\n groups: Record<string, T>\n): [string, T][] {\n return Object.entries(groups).sort(([, a], [, b]) => {\n const posA = a.position ?? 999\n const posB = b.position ?? 999\n return posA - posB\n })\n}\n\n/**\n * Build hierarchical sidebar structure from flat list of documents\n * This is the single source of truth for sidebar structure used by both\n * the sidebar component and navigation (prev/next) links.\n *\n * @param docs - Array of documents with metadata\n * @returns Object containing root groups and standalone items\n */\nexport function buildSidebarStructure<T extends {\n filePath: string\n slug: string\n categoryLabel?: string\n categoryPosition?: number\n categoryIcon?: string\n categoryCollapsible?: boolean\n categoryCollapsed?: boolean\n meta: any\n}>(docs: T[]): {\n rootGroups: Record<string, SidebarGroup>\n standalone: T[]\n} {\n const rootGroups: Record<string, SidebarGroup> = {}\n const standalone: T[] = []\n\n // First pass: collect category metadata from all docs to build complete folder structure\n const categoryMetadata = new Map<string, {\n label?: string\n position?: number\n icon?: string\n collapsible?: boolean\n collapsed?: boolean\n }>()\n\n docs.forEach((doc) => {\n const pathParts = doc.filePath.split(\"/\")\n const folderPath = pathParts.length > 1 ? pathParts.slice(0, -1).join(\"/\") : \"\"\n\n if (folderPath && doc.categoryLabel) {\n categoryMetadata.set(folderPath, {\n label: doc.categoryLabel,\n position: doc.categoryPosition,\n icon: doc.categoryIcon,\n collapsible: doc.categoryCollapsible,\n collapsed: doc.categoryCollapsed\n })\n }\n })\n\n docs.forEach((doc) => {\n const pathParts = doc.filePath.split(\"/\")\n const isIndexFile = doc.filePath.endsWith(\"/index\") ||\n doc.filePath === \"index\" ||\n (pathParts.length > 1 && doc.slug === pathParts.slice(0, -1).join(\"/\"))\n\n const customGroup = doc.meta.sidebar || doc.meta.group\n\n if (customGroup) {\n const groupName = customGroup.charAt(0).toUpperCase() + customGroup.slice(1)\n if (!rootGroups[groupName]) {\n rootGroups[groupName] = {\n label: groupName,\n path: customGroup,\n items: [],\n position: 999,\n collapsible: doc.categoryCollapsible ?? true,\n defaultCollapsed: doc.categoryCollapsed ?? false,\n children: {}\n }\n }\n if (isIndexFile) {\n // Use categoryPosition if available (from _category_.json), otherwise sidebar_position from frontmatter\n rootGroups[groupName].position = doc.categoryPosition ?? doc.meta.sidebar_position ?? 999\n rootGroups[groupName].icon = doc.categoryIcon\n } else {\n rootGroups[groupName].items.push(doc)\n }\n return\n }\n\n if (pathParts.length > 1) {\n const folderParts = pathParts.slice(0, -1)\n let currentLevel = rootGroups\n let currentPath = \"\"\n\n for (let i = 0; i < folderParts.length; i++) {\n const folder = folderParts[i]\n currentPath = currentPath ? `${currentPath}/${folder}` : folder\n const folderLabel = folder.split(\"-\").map(w => w.charAt(0).toUpperCase() + w.slice(1)).join(\" \")\n\n // Get metadata for this specific folder path\n const metadata = categoryMetadata.get(currentPath)\n\n if (!currentLevel[folder]) {\n currentLevel[folder] = {\n label: metadata?.label ?? folderLabel,\n path: currentPath,\n icon: metadata?.icon,\n items: [],\n position: metadata?.position ?? 999,\n collapsible: metadata?.collapsible ?? true,\n defaultCollapsed: metadata?.collapsed ?? false,\n children: {}\n }\n }\n\n if (i === folderParts.length - 1) {\n if (isIndexFile) {\n // Update position, label, and icon if this is the index file for this folder\n currentLevel[folder].position = doc.categoryPosition ?? doc.meta.sidebar_position ?? currentLevel[folder].position\n if (doc.categoryLabel) {\n currentLevel[folder].label = doc.categoryLabel\n }\n if (doc.categoryIcon) {\n currentLevel[folder].icon = doc.categoryIcon\n }\n if (doc.categoryCollapsible !== undefined) {\n currentLevel[folder].collapsible = doc.categoryCollapsible\n }\n if (doc.categoryCollapsed !== undefined) {\n currentLevel[folder].defaultCollapsed = doc.categoryCollapsed\n }\n } else {\n currentLevel[folder].items.push(doc)\n }\n }\n\n currentLevel = currentLevel[folder].children\n }\n } else {\n if (!isIndexFile) {\n standalone.push(doc)\n }\n }\n })\n\n return { rootGroups, standalone }\n}\n","/**\n * MDX Security Layer\n *\n * Protects against:\n * - XSS via malicious MDX expressions\n * - Path traversal attacks\n * - Dangerous component usage\n * - Cross-domain vulnerabilities\n */\n\nimport path from \"path\"\n\n/**\n * Sanitize file paths to prevent path traversal attacks\n * Blocks: ../, ..\\, absolute paths, encoded traversal attempts\n */\nexport function sanitizePath(userPath: string): string {\n // Decode URI components to catch encoded traversal attempts\n const decoded = decodeURIComponent(userPath)\n\n // Block path traversal patterns\n if (\n decoded.includes(\"../\") ||\n decoded.includes(\"..\\\\\") ||\n decoded.includes(\"%2e%2e\") ||\n decoded.includes(\"%252e%252e\") ||\n path.isAbsolute(decoded)\n ) {\n throw new Error(\"Path traversal detected\")\n }\n\n // Normalize and validate the path\n const normalized = path.normalize(decoded).replace(/\\\\/g, \"/\")\n\n // Ensure path doesn't escape after normalization\n if (normalized.startsWith(\"..\") || normalized.includes(\"/../\")) {\n throw new Error(\"Invalid path detected\")\n }\n\n return normalized\n}\n\n/**\n * Validate that a file path is within allowed directory\n */\nexport function validatePathWithinDirectory(filePath: string, allowedDir: string): boolean {\n const resolvedPath = path.resolve(allowedDir, filePath)\n const resolvedDir = path.resolve(allowedDir)\n\n return resolvedPath.startsWith(resolvedDir + path.sep) || resolvedPath === resolvedDir\n}\n\n/**\n * Dangerous MDX patterns that should be blocked\n * These patterns can execute arbitrary code during SSR\n */\nconst DANGEROUS_PATTERNS = [\n // JavaScript execution\n /eval\\s*\\(/gi,\n /Function\\s*\\(/gi,\n /import\\s*\\(/gi,\n /require\\s*\\(/gi,\n\n // File system access\n /fs\\.[a-z]+/gi,\n /readFile/gi,\n /writeFile/gi,\n /process\\.env/gi,\n\n // Network requests during SSR (legitimate client-side usage should use components)\n /fetch\\s*\\(/gi,\n\n // Dangerous Node.js modules\n /child_process/gi,\n /exec\\s*\\(/gi,\n /spawn\\s*\\(/gi,\n\n // Script tag injection\n /<script[>\\s]/gi,\n /javascript:/gi,\n /\\bon(abort|blur|cancel|canplay|canplaythrough|change|click|close|contextmenu|cuechange|dblclick|drag|dragend|dragenter|dragleave|dragover|dragstart|drop|durationchange|emptied|ended|error|focus|input|invalid|keydown|keypress|keyup|load|loadeddata|loadedmetadata|loadstart|mousedown|mouseenter|mouseleave|mousemove|mouseout|mouseover|mouseup|mousewheel|pause|play|playing|progress|ratechange|reset|resize|scroll|seeked|seeking|select|show|stalled|submit|suspend|timeupdate|toggle|volumechange|waiting|wheel)\\s*=/gi, // onclick, onerror, onload, etc.\n]\n\n/**\n * Remove code blocks from content to avoid scanning code examples\n * This prevents false positives from documentation code examples\n */\nfunction removeCodeBlocks(content: string): string {\n // Remove fenced code blocks (```...```)\n let withoutCodeBlocks = content.replace(/```[\\s\\S]*?```/g, '')\n\n // Remove inline code (`...`)\n withoutCodeBlocks = withoutCodeBlocks.replace(/`[^`]*`/g, '')\n\n return withoutCodeBlocks\n}\n\n/**\n * Scan MDX content for dangerous patterns\n * Returns array of detected issues\n * Note: Skips content inside code blocks to avoid false positives\n */\nexport function scanMDXForDangerousPatterns(content: string): string[] {\n const issues: string[] = []\n\n // Remove code blocks before scanning to avoid false positives\n const contentWithoutCode = removeCodeBlocks(content)\n\n for (const pattern of DANGEROUS_PATTERNS) {\n const matches = contentWithoutCode.match(pattern)\n if (matches) {\n issues.push(`Dangerous pattern detected: ${pattern.source}`)\n }\n }\n\n return issues\n}\n\n/**\n * Sanitize MDX content by removing/escaping dangerous patterns\n * This is a defensive measure - ideally content should be rejected if dangerous\n */\nexport function sanitizeMDXContent(content: string, strict: boolean = false): string {\n if (strict) {\n const issues = scanMDXForDangerousPatterns(content)\n if (issues.length > 0) {\n throw new Error(`MDX content contains dangerous patterns: ${issues.join(\", \")}`)\n }\n }\n\n // Remove inline script tags\n let sanitized = content.replace(/<script[^>]*>[\\s\\S]*?<\\/script>/gi, \"\")\n\n // Remove event handlers from HTML tags\n sanitized = sanitized.replace(/\\s+on\\w+\\s*=\\s*[\"'][^\"']*[\"']/gi, \"\")\n\n // Remove javascript: protocol\n sanitized = sanitized.replace(/javascript:/gi, \"\")\n\n return sanitized\n}\n\n/**\n * Content Security Policy configuration\n * Use this in your Next.js middleware or headers config\n */\nexport const CSP_DIRECTIVES = {\n \"default-src\": [\"'self'\"],\n \"script-src\": [\n \"'self'\",\n \"'unsafe-inline'\", // Required for Next.js\n \"'unsafe-eval'\", // Required for dev mode - remove in production\n ],\n \"style-src\": [\"'self'\", \"'unsafe-inline'\"], // Required for styled-components/emotion\n \"img-src\": [\"'self'\", \"data:\", \"https:\"],\n \"font-src\": [\"'self'\", \"data:\"],\n \"connect-src\": [\"'self'\"],\n \"frame-src\": [\"'self'\"],\n \"object-src\": [\"'none'\"],\n \"base-uri\": [\"'self'\"],\n \"form-action\": [\"'self'\"],\n \"frame-ancestors\": [\"'self'\"],\n \"upgrade-insecure-requests\": [],\n} as const\n\n/**\n * Generate CSP header value from directives\n */\nexport function generateCSPHeader(\n customDirectives?: Partial<typeof CSP_DIRECTIVES>,\n production: boolean = true\n): string {\n const directives: Record<string, readonly string[]> = { ...CSP_DIRECTIVES, ...customDirectives }\n\n // Remove unsafe-eval in production\n if (production && directives[\"script-src\"]) {\n directives[\"script-src\"] = directives[\"script-src\"].filter(\n (src) => src !== \"'unsafe-eval'\"\n )\n }\n\n return Object.entries(directives)\n .map(([key, values]) => `${key} ${values.join(\" \")}`)\n .join(\"; \")\n}\n\n/**\n * Allowlist of safe MDX components\n * Only these components can be used in MDX files\n */\nexport const SAFE_MDX_COMPONENTS = new Set([\n // Standard HTML elements (automatically allowed by MDX)\n \"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\",\n \"p\", \"a\", \"ul\", \"ol\", \"li\", \"code\", \"pre\",\n \"blockquote\", \"table\", \"thead\", \"tbody\", \"tr\", \"th\", \"td\",\n \"img\", \"video\", \"audio\", \"br\", \"hr\", \"strong\", \"em\",\n\n // Custom safe components\n \"Callout\", \"CodeBlock\", \"Accordion\", \"AccordionItem\",\n \"Tabs\", \"Tab\", \"Image\", \"Video\", \"Card\", \"CardGrid\",\n \"ImageCard\", \"ImageCardGrid\", \"Steps\", \"Step\",\n \"Icon\", \"Mermaid\", \"Math\", \"Columns\", \"Column\",\n \"Badge\", \"Tooltip\", \"Frame\",\n \"ApiEndpoint\", \"ApiParams\", \"ApiResponse\", \"ApiPlayground\", \"ApiReference\",\n])\n\n/**\n * Validate component usage in MDX\n */\nexport function validateMDXComponents(content: string): { valid: boolean; issues: string[] } {\n const issues: string[] = []\n\n // Find all JSX-like component usage\n const componentRegex = /<([A-Z][a-zA-Z0-9]*)/g\n let match\n\n while ((match = componentRegex.exec(content)) !== null) {\n const componentName = match[1]\n if (!SAFE_MDX_COMPONENTS.has(componentName)) {\n issues.push(`Unsafe component detected: ${componentName}`)\n }\n }\n\n return {\n valid: issues.length === 0,\n issues,\n }\n}\n\n/**\n * Comprehensive MDX security check\n * Use this before processing MDX content\n */\nexport function validateMDXSecurity(\n content: string,\n options: {\n strictMode?: boolean\n allowCustomComponents?: boolean\n blockDangerousPatterns?: boolean\n } = {}\n): { valid: boolean; issues: string[]; sanitized?: string } {\n const {\n strictMode = false,\n allowCustomComponents = true,\n blockDangerousPatterns = true,\n } = options\n\n const issues: string[] = []\n\n // Check for dangerous patterns\n if (blockDangerousPatterns) {\n const patternIssues = scanMDXForDangerousPatterns(content)\n issues.push(...patternIssues)\n }\n\n // Validate components\n if (!allowCustomComponents) {\n const componentValidation = validateMDXComponents(content)\n if (!componentValidation.valid) {\n issues.push(...componentValidation.issues)\n }\n }\n\n // In strict mode, reject any issues\n if (strictMode && issues.length > 0) {\n return { valid: false, issues }\n }\n\n // Otherwise, sanitize and warn\n const sanitized = sanitizeMDXContent(content, false)\n\n return {\n valid: true,\n issues,\n sanitized,\n }\n}\n","/**\n * Configuration schema for Specra documentation system\n */\n\n/**\n * Site metadata and branding\n */\nexport interface SiteConfig {\n /** The title of the documentation site */\n title: string\n /** Short description of the documentation */\n description?: string\n /** URL where the documentation is hosted */\n url?: string\n /** Base URL path for the documentation (e.g., '/docs') */\n baseUrl?: string\n /** Path to the site logo - can be a string or an object with light/dark variants */\n logo?: string | { light: string; dark: string }\n /** Path to the favicon */\n favicon?: string\n /** Default language for the documentation */\n language?: string\n /** Organization or author name */\n organizationName?: string\n /** Project name */\n projectName?: string\n /** Active/default version for the documentation */\n activeVersion?: string\n /** Whether to hide the site title in the header */\n hideTitle?: boolean\n /** Whether to hide the site logo in the header */\n hideLogo?: boolean\n}\n\n/**\n * Theme and appearance settings\n */\nexport interface ThemeConfig {\n /** Primary color for the theme */\n primaryColor?: string\n /** Default theme mode */\n defaultMode?: \"light\" | \"dark\" | \"system\"\n /** Whether to respect system preferences */\n respectPrefersColorScheme?: boolean\n /** Custom CSS file path */\n customCss?: string\n}\n\n/**\n * Tab group for organizing documentation\n */\nexport interface TabGroup {\n /** Unique identifier for the tab group */\n id: string\n /** Display label for the tab */\n label: string\n /** Optional icon name (lucide-react icon) */\n icon?: string\n}\n\n/**\n * Navigation and sidebar configuration\n */\nexport interface NavigationConfig {\n /** Whether to show the sidebar by default */\n showSidebar?: boolean\n /** Whether the sidebar is collapsible */\n collapsibleSidebar?: boolean\n /** Whether to show breadcrumbs */\n showBreadcrumbs?: boolean\n /** Whether to show table of contents */\n showTableOfContents?: boolean\n /** Position of table of contents */\n tocPosition?: \"left\" | \"right\"\n /** Maximum depth for table of contents */\n tocMaxDepth?: number\n /** Tab groups for organizing documentation sections */\n tabGroups?: TabGroup[]\n}\n\n/**\n * Social and external links\n */\nexport interface SocialLinks {\n /** GitHub repository URL */\n github?: string\n /** Twitter/X handle or URL */\n twitter?: string\n /** Discord invite URL */\n discord?: string\n /** LinkedIn profile or company page */\n linkedin?: string\n /** YouTube channel URL */\n youtube?: string\n /** Custom social links */\n custom?: Array<{\n label: string\n url: string\n icon?: string\n }>\n}\n\n/**\n * Search configuration\n */\nexport interface SearchConfig {\n /** Enable/disable search functionality */\n enabled?: boolean\n /** Placeholder text for search input */\n placeholder?: string\n /** Search provider type */\n provider?: \"meilisearch\" | \"algolia\" | \"local\"\n /** Meilisearch configuration */\n meilisearch?: {\n /** Meilisearch server URL */\n host: string\n /** API key for Meilisearch */\n apiKey?: string\n /** Index name */\n indexName: string\n }\n}\n\n/**\n * Analytics configuration\n */\nexport interface AnalyticsConfig {\n /** Google Analytics tracking ID */\n googleAnalytics?: string\n /** Google Tag Manager ID */\n googleTagManager?: string\n /** Plausible Analytics domain */\n plausible?: string\n /** Custom analytics scripts */\n custom?: Array<{\n src: string\n async?: boolean\n defer?: boolean\n }>\n}\n\n/**\n * Footer branding configuration\n */\nexport interface FooterBranding {\n /** Whether to show the branding */\n showBranding?: boolean\n /** Logo for the branding - can be a string or an object with light/dark variants */\n logo?: string | { light: string; dark: string }\n /** Title text for the branding */\n title?: string\n /** URL to link to when branding is clicked */\n url?: string\n}\n\n/**\n * Footer configuration\n */\nexport interface FooterConfig {\n /** Copyright text */\n copyright?: string\n /** Footer links organized by columns */\n links?: Array<{\n title: string\n items: Array<{\n label: string\n href: string\n }>\n }>\n /** Custom footer content */\n customContent?: string\n /** Branding configuration for \"Powered by\" section */\n branding?: FooterBranding\n}\n\n/**\n * Documentation features\n */\nexport interface FeaturesConfig {\n /**\n * Enable/disable edit this page links.\n * Provide a URL template (e.g., \"https://github.com/user/repo/edit/main/docs\") or false to disable\n */\n editUrl?: string | boolean\n /** Show last updated timestamp */\n showLastUpdated?: boolean\n /** Show reading time estimate */\n showReadingTime?: boolean\n /** Show author information */\n showAuthors?: boolean\n /** Show tags */\n showTags?: boolean\n /** Enable version dropdown */\n versioning?: boolean\n /** \n * Internationalization (i18n) configuration\n * Set to true to enable with defaults, or provide configuration object\n */\n i18n?: boolean | I18nConfig\n}\n\n/**\n * Internationalization configuration\n */\nexport interface I18nConfig {\n /** The default locale (e.g. 'en') - used when no locale is present in URL */\n defaultLocale: string\n /** List of supported locales (e.g. ['en', 'fr', 'es']) */\n locales: string[]\n /** Map of locale codes to display names (e.g. { en: \"English\", fr: \"Français\" }) */\n localeNames?: Record<string, string>\n /** Whether to use locale subpaths for default locale (default: false) */\n prefixDefault?: boolean\n}\n\n/**\n * Site-wide banner configuration\n */\nexport interface BannerConfig {\n /** Whether the banner is enabled */\n enabled?: boolean\n /** Banner message */\n message?: string\n /** Banner type */\n type?: \"info\" | \"warning\" | \"success\" | \"error\"\n /** Whether the banner can be dismissed */\n dismissible?: boolean\n}\n\n/**\n * Environment variables that can be used in documentation\n * These will be replaced at build time or runtime\n */\nexport interface EnvironmentVariables {\n /** API base URL */\n API_BASE_URL?: string\n /** API version */\n API_VERSION?: string\n /** CDN URL */\n CDN_URL?: string\n /** Custom environment variables */\n [key: string]: string | undefined\n}\n\n/**\n * Deployment configuration for different hosting scenarios\n */\nexport interface DeploymentConfig {\n /**\n * Deployment target\n * - 'vercel': For Vercel or similar Node.js hosting (uses 'standalone' output)\n * - 'github-pages': For GitHub Pages static hosting (uses 'export' output)\n * - 'static': For any static hosting like Netlify, Cloudflare Pages, etc.\n * - 'custom-domain-static': For static hosting with custom domain (no basePath needed)\n */\n target?: \"vercel\" | \"github-pages\" | \"static\" | \"custom-domain-static\"\n\n /**\n * Base path for assets when deploying to GitHub Pages without custom domain\n * This should be your repository name (e.g., 'my-repo')\n * Only used when target is 'github-pages' and no custom domain is configured\n */\n basePath?: string\n\n /**\n * Whether a custom domain is configured\n * When true, basePath will be ignored even for GitHub Pages\n */\n customDomain?: boolean\n}\n\n/**\n * Main configuration interface\n */\nexport interface SpecraConfig {\n /** JSON Schema reference (for IDE support) */\n $schema?: string\n /** Site metadata and branding */\n site: SiteConfig\n /** Theme and appearance settings */\n theme?: ThemeConfig\n /** Navigation and sidebar configuration */\n navigation?: NavigationConfig\n /** Social and external links */\n social?: SocialLinks\n /** Search configuration */\n search?: SearchConfig\n /** Analytics configuration */\n analytics?: AnalyticsConfig\n /** Footer configuration */\n footer?: FooterConfig\n /** Site-wide banner */\n banner?: BannerConfig\n /** Documentation features */\n features?: FeaturesConfig\n /** Environment variables for use in docs */\n env?: EnvironmentVariables\n /** Deployment configuration */\n deployment?: DeploymentConfig\n}\n\n/**\n * Default configuration values\n */\nexport const defaultConfig: SpecraConfig = {\n site: {\n title: \"Documentation\",\n description: \"Project documentation\",\n baseUrl: \"/\",\n language: \"en\",\n },\n theme: {\n defaultMode: \"system\",\n respectPrefersColorScheme: true,\n },\n navigation: {\n showSidebar: true,\n collapsibleSidebar: true,\n showBreadcrumbs: true,\n showTableOfContents: true,\n tocPosition: \"right\",\n tocMaxDepth: 3,\n },\n search: {\n enabled: true,\n provider: \"local\",\n placeholder: \"Search documentation...\",\n },\n features: {\n showLastUpdated: true,\n showReadingTime: true,\n showAuthors: false,\n showTags: true,\n versioning: true,\n i18n: false,\n },\n}\n","import { SpecraConfig, defaultConfig } from \"./config.types\"\n\n/**\n * Deep merge two objects\n */\nfunction deepMerge<T extends Record<string, any>>(target: T, source: Partial<T>): T {\n const result = { ...target }\n\n for (const key in source) {\n const sourceValue = source[key]\n const targetValue = result[key]\n\n if (sourceValue && typeof sourceValue === \"object\" && !Array.isArray(sourceValue)) {\n result[key] = deepMerge(\n targetValue && typeof targetValue === \"object\" ? targetValue : {},\n sourceValue,\n ) as T[Extract<keyof T, string>]\n } else if (sourceValue !== undefined) {\n result[key] = sourceValue as T[Extract<keyof T, string>]\n }\n }\n\n return result\n}\n\n/**\n * Load and parse the Specra configuration file\n * Falls back to default configuration if file doesn't exist or is invalid\n */\nexport function loadConfig(userConfig: Partial<SpecraConfig>): SpecraConfig {\n try {\n // const userConfig = specraConfigJson as unknown as Partial<SpecraConfig>\n\n // Merge user config with defaults \n const config = deepMerge(defaultConfig, userConfig)\n\n return config\n } catch (error) {\n console.error(`❌ Error loading configuration:`, error)\n console.warn(\"Using default configuration.\")\n return defaultConfig\n }\n}\n\n/**\n * Get a specific configuration value by path (SERVER ONLY)\n * Example: getConfigValue('site.title') or getConfigValue('theme.defaultMode')\n */\nexport function getConfigValue<T = any>(path: string, config?: SpecraConfig): T | undefined {\n const cfg = config || loadConfig({})\n const keys = path.split(\".\")\n let value: any = cfg\n\n for (const key of keys) {\n if (value && typeof value === \"object\" && key in value) {\n value = value[key]\n } else {\n return undefined\n }\n }\n\n return value as T\n}\n\n/**\n * Replace environment variables in a string (SERVER ONLY)\n * Supports ${ENV_VAR} and {{ENV_VAR}} syntax\n */\nexport function replaceEnvVariables(text: string, config?: SpecraConfig): string {\n const cfg = config || loadConfig({})\n const envVars = cfg.env || {}\n\n let result = text\n\n // Replace ${VAR} syntax\n result = result.replace(/\\$\\{([^}]+)\\}/g, (match, varName) => {\n return envVars[varName] || match\n })\n\n // Replace {{VAR}} syntax\n result = result.replace(/\\{\\{([^}]+)\\}\\}/g, (match, varName) => {\n return envVars[varName] || match\n })\n\n return result\n}\n\n/**\n * Process content and replace all environment variables (SERVER ONLY)\n */\nexport function processContentWithEnv(content: string, config?: SpecraConfig): string {\n return replaceEnvVariables(content, config)\n}\n\n/**\n * Validate configuration (basic validation) (SERVER ONLY)\n */\nexport function validateConfig(config: SpecraConfig): { valid: boolean; errors: string[] } {\n const errors: string[] = []\n\n // Required fields\n if (!config.site?.title) {\n errors.push(\"site.title is required\")\n }\n\n // URL validation\n if (config.site?.url) {\n try {\n new URL(config.site.url)\n } catch {\n errors.push(\"site.url must be a valid URL\")\n }\n }\n\n // Social links validation\n if (config.social) {\n const socialKeys = [\"github\", \"twitter\", \"discord\", \"linkedin\", \"youtube\"] as const\n for (const key of socialKeys) {\n const url = config.social[key]\n if (url) {\n try {\n new URL(url)\n } catch {\n errors.push(`social.${key} must be a valid URL`)\n }\n }\n }\n }\n\n return {\n valid: errors.length === 0,\n errors,\n }\n}\n\n// Singleton instance\nlet configInstance: SpecraConfig | null = null\n\n/**\n * Initialize the Specra configuration\n * Can be called multiple times - subsequent calls will update the config\n * @param userConfig - Partial configuration to merge with defaults\n * @returns The initialized configuration\n */\nexport function initConfig(userConfig: Partial<SpecraConfig>): SpecraConfig {\n configInstance = loadConfig(userConfig)\n return configInstance\n}\n\n/**\n * Get the configuration instance (cached) (SERVER ONLY)\n * If not initialized, returns default config\n */\nexport function getConfig(): SpecraConfig {\n if (!configInstance) {\n // Auto-initialize with defaults if not already initialized\n configInstance = loadConfig({})\n }\n return configInstance\n}\n\n/**\n * Reload the configuration (useful for development) (SERVER ONLY)\n */\nexport function reloadConfig(userConfig: Partial<SpecraConfig>): SpecraConfig {\n configInstance = loadConfig(userConfig)\n return configInstance\n}\n\n/**\n * Export the loaded config as default (SERVER ONLY)\n */\n// export default getConfig()\n","/**\n * Caching layer for MDX operations to improve development performance\n *\n * This module provides in-memory caching for expensive file system operations\n * that occur during static generation. In development mode, caches are\n * invalidated automatically when files change.\n */\n\n// Note: This file uses server-only APIs (fs, path) and should only be imported in Server Components\nimport { Doc, getVersions, getAllDocs, getDocBySlug } from './mdx'\nimport { watch } from 'fs'\nimport { join } from 'path'\nimport { PerfTimer, logCacheOperation } from './dev-utils'\n\nconst isDevelopment = process.env.NODE_ENV === 'development'\n\n// Cache stores\nconst versionsCache = {\n data: null as string[] | null,\n timestamp: 0,\n}\n\nconst allDocsCache = new Map<string, {\n data: Doc[]\n timestamp: number\n}>()\n\nconst docBySlugCache = new Map<string, {\n data: Doc | null\n timestamp: number\n}>()\n\n// Cache TTL (time to live) in milliseconds\nconst CACHE_TTL = isDevelopment ? 5000 : 60000 // 5s in dev, 60s in prod\n\n// Track if we've set up file watchers\nlet watchersInitialized = false\n\n/**\n * Initialize file watchers to invalidate cache on changes\n * Only runs in development mode\n */\nfunction initializeWatchers() {\n if (!isDevelopment || watchersInitialized) return\n\n watchersInitialized = true\n const docsPath = join(process.cwd(), 'docs')\n\n try {\n watch(docsPath, { recursive: true }, (eventType, filename) => {\n if (!filename) return\n\n // Invalidate relevant caches when MDX or JSON files change\n if (filename.endsWith('.mdx') || filename.endsWith('.json')) {\n // Extract version from path\n const parts = filename.split(/[/\\\\]/)\n const version = parts[0]\n\n // Clear all docs cache for this version\n allDocsCache.delete(version)\n\n // Clear individual doc caches for this version\n const cacheKeysToDelete: string[] = []\n docBySlugCache.forEach((_, key) => {\n if (key.startsWith(`${version}:`)) {\n cacheKeysToDelete.push(key)\n }\n })\n cacheKeysToDelete.forEach(key => docBySlugCache.delete(key))\n\n // Clear versions cache if directory structure changed\n if (eventType === 'rename') {\n versionsCache.data = null\n }\n\n console.log(`[MDX Cache] Invalidated cache for: ${filename}`)\n }\n })\n\n console.log('[MDX Cache] File watchers initialized')\n } catch (error) {\n console.error('[MDX Cache] Failed to initialize watchers:', error)\n }\n}\n\n/**\n * Check if a cache entry is still valid\n */\nfunction isCacheValid(timestamp: number): boolean {\n return Date.now() - timestamp < CACHE_TTL\n}\n\n/**\n * Cached version of getVersions()\n */\nexport function getCachedVersions(): string[] {\n // Initialize watchers on first use\n initializeWatchers()\n\n if (versionsCache.data && isCacheValid(versionsCache.timestamp)) {\n logCacheOperation('hit', 'versions')\n return versionsCache.data\n }\n\n logCacheOperation('miss', 'versions')\n const timer = new PerfTimer('getVersions')\n const versions = getVersions()\n timer.end()\n\n versionsCache.data = versions\n versionsCache.timestamp = Date.now()\n\n return versions\n}\n\n/**\n * Cached version of getAllDocs()\n */\nexport async function getCachedAllDocs(version = 'v1.0.0', locale?: string): Promise<Doc[]> {\n // Initialize watchers on first use\n initializeWatchers()\n\n const cacheKey = locale ? `${version}:${locale}` : version\n const cached = allDocsCache.get(cacheKey)\n if (cached && isCacheValid(cached.timestamp)) {\n logCacheOperation('hit', `getAllDocs:${cacheKey}`)\n return cached.data\n }\n\n logCacheOperation('miss', `getAllDocs:${cacheKey}`)\n const timer = new PerfTimer(`getAllDocs(${cacheKey})`)\n const docs = await getAllDocs(version, locale)\n timer.end()\n\n allDocsCache.set(cacheKey, {\n data: docs,\n timestamp: Date.now(),\n })\n\n return docs\n}\n\n/**\n * Cached version of getDocBySlug()\n */\nexport async function getCachedDocBySlug(\n slug: string,\n version = 'v1.0.0'\n): Promise<Doc | null> {\n // Initialize watchers on first use\n initializeWatchers()\n\n const cacheKey = `${version}:${slug}`\n const cached = docBySlugCache.get(cacheKey)\n\n if (cached && isCacheValid(cached.timestamp)) {\n logCacheOperation('hit', `getDocBySlug:${cacheKey}`)\n return cached.data\n }\n\n logCacheOperation('miss', `getDocBySlug:${cacheKey}`)\n const timer = new PerfTimer(`getDocBySlug(${slug})`)\n const doc = await getDocBySlug(slug, version)\n timer.end()\n\n docBySlugCache.set(cacheKey, {\n data: doc,\n timestamp: Date.now(),\n })\n\n return doc\n}\n\n/**\n * Manually clear all caches\n * Useful for testing or when you want to force a refresh\n */\nexport function clearAllCaches() {\n versionsCache.data = null\n allDocsCache.clear()\n docBySlugCache.clear()\n console.log('[MDX Cache] All caches cleared')\n}\n\n/**\n * Get cache statistics for debugging\n */\nexport function getCacheStats() {\n return {\n versions: {\n cached: versionsCache.data !== null,\n age: versionsCache.timestamp ? Date.now() - versionsCache.timestamp : 0,\n },\n allDocs: {\n entries: allDocsCache.size,\n versions: Array.from(allDocsCache.keys()),\n },\n docBySlug: {\n entries: docBySlugCache.size,\n },\n }\n}\n","/**\n * Development utilities for debugging and performance monitoring\n * Only active in development mode\n */\n\nconst isDevelopment = process.env.NODE_ENV === 'development'\n\n/**\n * Performance timer for measuring operation duration\n */\nexport class PerfTimer {\n private startTime: number\n private label: string\n\n constructor(label: string) {\n this.label = label\n this.startTime = isDevelopment ? performance.now() : 0\n }\n\n end() {\n if (!isDevelopment) return\n\n const duration = performance.now() - this.startTime\n const color = duration > 1000 ? '\\x1b[31m' : duration > 500 ? '\\x1b[33m' : '\\x1b[32m'\n const reset = '\\x1b[0m'\n\n console.log(`${color}⏱️ ${this.label}: ${duration.toFixed(2)}ms${reset}`)\n }\n}\n\n/**\n * Log file system operations\n */\nexport function logFsOperation(operation: string, path: string, details?: any) {\n if (!isDevelopment) return\n\n console.log(`📁 [FS] ${operation}: ${path}`, details || '')\n}\n\n/**\n * Log cache operations\n */\nexport function logCacheOperation(operation: 'hit' | 'miss' | 'invalidate', key: string) {\n if (!isDevelopment) return\n\n const emoji = operation === 'hit' ? '✅' : operation === 'miss' ? '❌' : '🔄'\n console.log(`${emoji} [Cache] ${operation}: ${key}`)\n}\n\n/**\n * Memory usage reporter\n */\nexport function logMemoryUsage(label?: string) {\n if (!isDevelopment) return\n\n const used = process.memoryUsage()\n const prefix = label ? `[${label}] ` : ''\n\n console.log(`💾 ${prefix}Memory Usage:`, {\n rss: `${Math.round(used.rss / 1024 / 1024)}MB`,\n heapTotal: `${Math.round(used.heapTotal / 1024 / 1024)}MB`,\n heapUsed: `${Math.round(used.heapUsed / 1024 / 1024)}MB`,\n })\n}\n\n/**\n * Pretty print object for debugging\n */\nexport function debugLog(label: string, data: any) {\n if (!isDevelopment) return\n\n console.log(`\\n🔍 ${label}:`)\n console.dir(data, { depth: null, colors: true })\n console.log('')\n}\n","export interface TOCItem {\n id: string\n title: string\n level: number\n}\n\n/**\n * Extract headings from HTML string for table of contents\n */\nexport function extractHeadings(html: string): TOCItem[] {\n const headingRegex = /<h([2-3])[^>]*id=\"([^\"]*)\"[^>]*>(.*?)<\\/h\\1>/g\n const toc: TOCItem[] = []\n let match\n\n while ((match = headingRegex.exec(html)) !== null) {\n const level = Number.parseInt(match[1])\n const id = match[2]\n const title = match[3].replace(/<[^>]*>/g, \"\") // Strip HTML tags\n\n toc.push({ id, title, level })\n }\n\n return toc\n}\n","import type { SpecraApiSpec } from \"../api-parser.types\"\nimport type { ApiSpecParser } from \"./base-parser\"\n\n/**\n * Parser for native Specra API format\n * This is a pass-through parser since the input is already in the correct format\n */\nexport class SpecraParser implements ApiSpecParser {\n validate(input: any): boolean {\n return (\n typeof input === \"object\" &&\n input !== null &&\n \"endpoints\" in input &&\n Array.isArray(input.endpoints)\n )\n }\n\n parse(input: any): SpecraApiSpec {\n if (!this.validate(input)) {\n throw new Error(\"Invalid Specra API spec format\")\n }\n return input as SpecraApiSpec\n }\n}\n","import type { SpecraApiSpec, ApiEndpointSpec, ApiParam, ApiResponse } from \"../api-parser.types\"\nimport type { ApiSpecParser } from \"./base-parser\"\n\n/**\n * Parser for OpenAPI 3.0/3.1 specifications\n */\nexport class OpenApiParser implements ApiSpecParser {\n validate(input: any): boolean {\n return (\n typeof input === \"object\" &&\n input !== null &&\n (\"openapi\" in input || \"swagger\" in input) &&\n \"paths\" in input\n )\n }\n\n parse(input: any): SpecraApiSpec {\n if (!this.validate(input)) {\n throw new Error(\"Invalid OpenAPI spec format\")\n }\n\n const baseUrl = this.extractBaseUrl(input)\n const endpoints: ApiEndpointSpec[] = []\n\n // Parse paths\n for (const [path, pathItem] of Object.entries(input.paths || {})) {\n const methods = [\"get\", \"post\", \"put\", \"patch\", \"delete\"] as const\n\n for (const method of methods) {\n const operation = (pathItem as any)[method]\n if (!operation) continue\n\n const endpoint = this.parseOperation(path, method.toUpperCase() as any, operation, input)\n endpoints.push(endpoint)\n }\n }\n\n return {\n version: input.info?.version,\n title: input.info?.title,\n description: input.info?.description,\n baseUrl,\n auth: this.extractAuth(input),\n endpoints,\n }\n }\n\n private extractBaseUrl(spec: any): string {\n // OpenAPI 3.x servers\n if (spec.servers && spec.servers.length > 0) {\n return spec.servers[0].url\n }\n\n // Swagger 2.0\n if (spec.host) {\n const scheme = spec.schemes?.[0] || \"https\"\n const basePath = spec.basePath || \"\"\n return `${scheme}://${spec.host}${basePath}`\n }\n\n return \"\"\n }\n\n private extractAuth(spec: any): SpecraApiSpec[\"auth\"] {\n const securitySchemes = spec.components?.securitySchemes || spec.securityDefinitions\n\n if (!securitySchemes) return undefined\n\n // Get the first security scheme\n const firstScheme = Object.values(securitySchemes)[0] as any\n if (!firstScheme) return undefined\n\n if (firstScheme.type === \"http\" && firstScheme.scheme === \"bearer\") {\n return {\n type: \"bearer\",\n description: firstScheme.description,\n tokenPrefix: \"Bearer\",\n }\n }\n\n if (firstScheme.type === \"apiKey\") {\n return {\n type: \"apiKey\",\n description: firstScheme.description,\n headerName: firstScheme.name || \"X-API-Key\",\n }\n }\n\n if (firstScheme.type === \"http\" && firstScheme.scheme === \"basic\") {\n return {\n type: \"basic\",\n description: firstScheme.description,\n }\n }\n\n return undefined\n }\n\n private parseOperation(\n path: string,\n method: \"GET\" | \"POST\" | \"PUT\" | \"PATCH\" | \"DELETE\",\n operation: any,\n spec: any\n ): ApiEndpointSpec {\n const endpoint: ApiEndpointSpec = {\n title: operation.summary || operation.operationId || `${method} ${path}`,\n method,\n path: this.convertPathParams(path),\n description: operation.description,\n }\n\n // Parse parameters\n const params = this.parseParameters(operation.parameters || [], spec)\n if (params.path.length > 0) endpoint.pathParams = params.path\n if (params.query.length > 0) endpoint.queryParams = params.query\n if (params.header.length > 0) {\n endpoint.headers = params.header.map((p) => ({\n name: p.name,\n value: p.example || \"\",\n description: p.description,\n }))\n }\n\n // Parse request body\n if (operation.requestBody) {\n endpoint.body = this.parseRequestBody(operation.requestBody, spec)\n }\n\n // Parse responses\n const responses = this.parseResponses(operation.responses || {}, spec)\n if (responses.success) endpoint.successResponse = responses.success\n if (responses.errors.length > 0) endpoint.errorResponses = responses.errors\n\n return endpoint\n }\n\n private convertPathParams(path: string): string {\n // Convert OpenAPI {param} to :param\n return path.replace(/\\{([^}]+)\\}/g, \":$1\")\n }\n\n private parseParameters(\n parameters: any[],\n spec: any\n ): { path: ApiParam[]; query: ApiParam[]; header: ApiParam[] } {\n const result = { path: [] as ApiParam[], query: [] as ApiParam[], header: [] as ApiParam[] }\n\n for (const param of parameters) {\n // Resolve $ref if present\n const resolved = param.$ref ? this.resolveRef(param.$ref, spec) : param\n\n const apiParam: ApiParam = {\n name: resolved.name,\n type: resolved.schema?.type || resolved.type || \"string\",\n required: resolved.required,\n description: resolved.description,\n example: resolved.example || resolved.schema?.example,\n }\n\n if (resolved.in === \"path\") result.path.push(apiParam)\n else if (resolved.in === \"query\") result.query.push(apiParam)\n else if (resolved.in === \"header\") result.header.push(apiParam)\n }\n\n return result\n }\n\n private parseRequestBody(requestBody: any, spec: any): ApiEndpointSpec[\"body\"] {\n const content = requestBody.content?.[\"application/json\"]\n if (!content) return undefined\n\n return {\n description: requestBody.description,\n example: content.example || this.generateExample(content.schema, spec),\n schema: content.schema,\n }\n }\n\n private parseResponses(\n responses: any,\n spec: any\n ): { success?: ApiResponse; errors: ApiResponse[] } {\n const result: { success?: ApiResponse; errors: ApiResponse[] } = { errors: [] }\n\n for (const [statusCode, response] of Object.entries(responses)) {\n const status = parseInt(statusCode)\n if (isNaN(status)) continue\n\n const resolved = (response as any).$ref ? this.resolveRef((response as any).$ref, spec) : response\n const content = (resolved as any).content?.[\"application/json\"]\n\n const apiResponse: ApiResponse = {\n status,\n description: (resolved as any).description,\n example: content?.example || this.generateExample(content?.schema, spec),\n schema: content?.schema,\n }\n\n if (status >= 200 && status < 300) {\n result.success = apiResponse\n } else {\n result.errors.push(apiResponse)\n }\n }\n\n return result\n }\n\n private generateExample(schema: any, spec: any): any {\n if (!schema) return undefined\n if (schema.$ref) schema = this.resolveRef(schema.$ref, spec)\n if (schema.example) return schema.example\n\n // Simple example generation based on schema type\n if (schema.type === \"object\" && schema.properties) {\n const example: any = {}\n for (const [key, prop] of Object.entries(schema.properties)) {\n example[key] = this.generateExample(prop, spec)\n }\n return example\n }\n\n if (schema.type === \"array\" && schema.items) {\n return [this.generateExample(schema.items, spec)]\n }\n\n // Default values by type\n const defaults: any = {\n string: \"string\",\n number: 0,\n integer: 0,\n boolean: false,\n object: {},\n array: [],\n }\n\n return defaults[schema.type] || null\n }\n\n private resolveRef(ref: string, spec: any): any {\n const path = ref.replace(/^#\\//, \"\").split(\"/\")\n let current = spec\n\n for (const segment of path) {\n current = current[segment]\n if (!current) return {}\n }\n\n return current\n }\n}\n","import type { SpecraApiSpec, ApiEndpointSpec, ApiParam, ApiHeader } from \"../api-parser.types\"\nimport type { ApiSpecParser } from \"./base-parser\"\n\n/**\n * Parser for Postman Collection v2.0/v2.1\n */\nexport class PostmanParser implements ApiSpecParser {\n validate(input: any): boolean {\n return (\n typeof input === \"object\" &&\n input !== null &&\n \"info\" in input &&\n input.info?.schema?.includes(\"v2\")\n )\n }\n\n parse(input: any): SpecraApiSpec {\n if (!this.validate(input)) {\n throw new Error(\"Invalid Postman Collection format (requires v2.0 or v2.1)\")\n }\n\n const baseUrl = this.extractBaseUrl(input)\n const endpoints: ApiEndpointSpec[] = []\n\n // Parse items (can be nested in folders)\n this.parseItems(input.item || [], endpoints, baseUrl, input)\n\n return {\n version: input.info?.version,\n title: input.info?.name,\n description: input.info?.description,\n baseUrl,\n auth: this.extractAuth(input.auth),\n globalHeaders: this.extractGlobalHeaders(input),\n endpoints,\n }\n }\n\n private extractBaseUrl(collection: any): string {\n // Try to get from variables\n const baseUrlVar = collection.variable?.find(\n (v: any) => v.key === \"baseUrl\" || v.key === \"base_url\" || v.key === \"url\"\n )\n if (baseUrlVar) return baseUrlVar.value\n\n // Try to extract from first request\n if (collection.item && collection.item.length > 0) {\n const firstRequest = this.findFirstRequest(collection.item)\n if (firstRequest?.request?.url) {\n const url = this.parseUrl(firstRequest.request.url)\n if (url.host) {\n return `${url.protocol}://${url.host.join(\".\")}`\n }\n }\n }\n\n return \"\"\n }\n\n private findFirstRequest(items: any[]): any {\n for (const item of items) {\n if (item.request) return item\n if (item.item) {\n const found = this.findFirstRequest(item.item)\n if (found) return found\n }\n }\n return null\n }\n\n private extractAuth(auth: any): SpecraApiSpec[\"auth\"] {\n if (!auth) return undefined\n\n if (auth.type === \"bearer\") {\n return {\n type: \"bearer\",\n tokenPrefix: \"Bearer\",\n }\n }\n\n if (auth.type === \"apikey\") {\n const keyData = auth.apikey?.find((a: any) => a.key === \"key\")\n const keyName = keyData?.value || \"X-API-Key\"\n\n return {\n type: \"apiKey\",\n headerName: keyName,\n }\n }\n\n if (auth.type === \"basic\") {\n return {\n type: \"basic\",\n }\n }\n\n return undefined\n }\n\n private extractGlobalHeaders(collection: any): ApiHeader[] {\n // Postman doesn't have global headers in the same way, but we can check for common patterns\n return []\n }\n\n private parseItems(items: any[], endpoints: ApiEndpointSpec[], baseUrl: string, collection: any) {\n for (const item of items) {\n // If it's a folder, recurse\n if (item.item && Array.isArray(item.item)) {\n this.parseItems(item.item, endpoints, baseUrl, collection)\n }\n // If it's a request\n else if (item.request) {\n const endpoint = this.parseRequest(item, baseUrl, collection)\n endpoints.push(endpoint)\n }\n }\n }\n\n private parseRequest(item: any, baseUrl: string, collection: any): ApiEndpointSpec {\n const request = item.request\n const url = this.parseUrl(request.url)\n\n const endpoint: ApiEndpointSpec = {\n title: item.name,\n method: request.method.toUpperCase(),\n path: this.buildPath(url, baseUrl),\n description: item.request.description || item.description,\n }\n\n // Parse URL parameters (path and query)\n const params = this.parseUrlParams(url)\n if (params.path.length > 0) endpoint.pathParams = params.path\n if (params.query.length > 0) endpoint.queryParams = params.query\n\n // Parse headers\n if (request.header && request.header.length > 0) {\n endpoint.headers = request.header\n .filter((h: any) => !h.disabled)\n .map((h: any) => ({\n name: h.key,\n value: h.value || \"\",\n description: h.description,\n }))\n }\n\n // Parse request body\n if (request.body) {\n endpoint.body = this.parseBody(request.body)\n }\n\n // Parse response examples\n const responses = this.parseResponses(item.response || [])\n if (responses.success) endpoint.successResponse = responses.success\n if (responses.errors.length > 0) endpoint.errorResponses = responses.errors\n\n return endpoint\n }\n\n private parseUrl(url: any): {\n protocol: string\n host: string[]\n path: string[]\n query: any[]\n variable: any[]\n } {\n if (typeof url === \"string\") {\n // Parse string URL\n const urlObj = new URL(url)\n return {\n protocol: urlObj.protocol.replace(\":\", \"\"),\n host: urlObj.hostname.split(\".\"),\n path: urlObj.pathname.split(\"/\").filter(Boolean),\n query: [],\n variable: [],\n }\n }\n\n return {\n protocol: url.protocol || \"https\",\n host: url.host || [],\n path: url.path || [],\n query: url.query || [],\n variable: url.variable || [],\n }\n }\n\n private buildPath(url: any, baseUrl: string): string {\n let path = \"/\"\n\n if (url.path && url.path.length > 0) {\n path += url.path.join(\"/\")\n }\n\n // Convert Postman :param to our :param format (they're the same!)\n // But we need to handle {{variable}} syntax\n path = path.replace(/\\{\\{([^}]+)\\}\\}/g, \":$1\")\n\n return path\n }\n\n private parseUrlParams(url: any): { path: ApiParam[]; query: ApiParam[] } {\n const result = { path: [] as ApiParam[], query: [] as ApiParam[] }\n\n // Path parameters from variables\n if (url.variable && url.variable.length > 0) {\n for (const v of url.variable) {\n result.path.push({\n name: v.key,\n type: v.type || \"string\",\n description: v.description,\n example: v.value,\n })\n }\n }\n\n // Extract path params from the path itself\n if (url.path && url.path.length > 0) {\n for (const segment of url.path) {\n if (segment.startsWith(\":\")) {\n const paramName = segment.slice(1)\n // Only add if not already added from variables\n if (!result.path.find((p) => p.name === paramName)) {\n result.path.push({\n name: paramName,\n type: \"string\",\n })\n }\n }\n }\n }\n\n // Query parameters\n if (url.query && url.query.length > 0) {\n for (const q of url.query) {\n if (q.disabled) continue\n result.query.push({\n name: q.key,\n type: \"string\",\n description: q.description,\n example: q.value,\n })\n }\n }\n\n return result\n }\n\n private parseBody(body: any): ApiEndpointSpec[\"body\"] {\n if (!body) return undefined\n\n let example: any\n let description = body.description\n\n if (body.mode === \"raw\") {\n try {\n example = JSON.parse(body.raw)\n } catch {\n example = body.raw\n }\n } else if (body.mode === \"formdata\" || body.mode === \"urlencoded\") {\n example = {}\n for (const item of body[body.mode] || []) {\n if (!item.disabled) {\n example[item.key] = item.value\n }\n }\n }\n\n return {\n description,\n example,\n }\n }\n\n private parseResponses(responses: any[]): { success?: any; errors: any[] } {\n const result: { success?: any; errors: any[] } = { errors: [] }\n\n for (const response of responses) {\n let example: any\n try {\n example = JSON.parse(response.body)\n } catch {\n example = response.body\n }\n\n const apiResponse = {\n status: response.code || 200,\n description: response.name,\n example,\n }\n\n if (apiResponse.status >= 200 && apiResponse.status < 300) {\n if (!result.success) result.success = apiResponse\n } else {\n result.errors.push(apiResponse)\n }\n }\n\n return result\n }\n}\n","import type { SpecraApiSpec } from \"../api-parser.types\"\nimport type { ApiSpecParser } from \"./base-parser\"\nimport { SpecraParser } from \"./specra-parser\"\nimport { OpenApiParser } from \"./openapi-parser\"\nimport { PostmanParser } from \"./postman-parser\"\n\nexport type ParserType = \"auto\" | \"specra\" | \"openapi\" | \"postman\"\n\n/**\n * Registry of all available parsers\n */\nconst parsers: Map<string, ApiSpecParser> = new Map([\n [\"specra\", new SpecraParser()],\n [\"openapi\", new OpenApiParser()],\n [\"postman\", new PostmanParser()],\n])\n\n/**\n * Auto-detect the parser type based on the input structure\n */\nexport function detectParserType(input: any): ParserType {\n if (!input || typeof input !== \"object\") {\n throw new Error(\"Invalid API spec: input must be an object\")\n }\n\n // Check for Postman Collection\n if (input.info?.schema?.includes(\"v2\")) {\n return \"postman\"\n }\n\n // Check for OpenAPI/Swagger\n if (input.openapi || input.swagger) {\n return \"openapi\"\n }\n\n // Check for Specra format\n if (input.endpoints && Array.isArray(input.endpoints)) {\n return \"specra\"\n }\n\n throw new Error(\n \"Unable to auto-detect API spec format. Supported formats: Specra, OpenAPI 3.x, Postman Collection v2.x\"\n )\n}\n\n/**\n * Parse an API spec using the specified or auto-detected parser\n */\nexport function parseApiSpec(input: any, parserType: ParserType = \"auto\"): SpecraApiSpec {\n // Auto-detect if needed\n const actualType = parserType === \"auto\" ? detectParserType(input) : parserType\n\n // Get the parser\n const parser = parsers.get(actualType)\n if (!parser) {\n throw new Error(`Unknown parser type: ${actualType}`)\n }\n\n // Validate and parse\n if (!parser.validate(input)) {\n throw new Error(`Input does not match ${actualType} format`)\n }\n\n return parser.parse(input)\n}\n\n// Export parsers for direct use\nexport { SpecraParser, OpenApiParser, PostmanParser }\nexport type { ApiSpecParser }\n","import { clsx, type ClassValue } from 'clsx'\nimport { twMerge } from 'tailwind-merge'\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n\n\n/**\n * Get the correct asset path based on deployment configuration\n * Handles different deployment scenarios:\n * - Vercel/Node.js hosting (standalone build): No basePath needed\n * - GitHub Pages without custom domain: Uses basePath from config\n * - Static hosting with custom domain: No basePath needed\n *\n * @param path - The asset path (can start with or without '/')\n * @returns The properly formatted asset path\n */\nexport function getAssetPath(path: string): string {\n // Get basePath from Next.js config (set during build for static exports)\n const basePath = process.env.NEXT_PUBLIC_BASE_PATH || process.env.__NEXT_ROUTER_BASEPATH || ''\n\n // Normalize the input path: ensure it starts with '/'\n const normalizedPath = path.startsWith('/') ? path : `/${path}`\n\n // If we have a basePath (GitHub Pages without custom domain), prepend it\n if (basePath) {\n // Normalize basePath: remove trailing slash, ensure leading slash\n const normalizedBase = basePath.startsWith('/') ? basePath : `/${basePath}`\n const cleanBase = normalizedBase.replace(/\\/$/, '')\n return `${cleanBase}${normalizedPath}`\n }\n\n // Default: return the normalized path (works for Vercel, custom domains, and dev)\n return normalizedPath\n}","import { getAllDocs, getVersions } from \"./mdx\"\n\nexport interface RedirectMapping {\n from: string\n to: string\n}\n\n/**\n * Build redirect mappings from all docs' redirect_from frontmatter\n */\nexport async function buildRedirectMappings(): Promise<RedirectMapping[]> {\n const versions = getVersions()\n const redirects: RedirectMapping[] = []\n\n for (const version of versions) {\n const docs = await getAllDocs(version)\n \n for (const doc of docs) {\n if (doc.meta.redirect_from && Array.isArray(doc.meta.redirect_from)) {\n for (const oldPath of doc.meta.redirect_from) {\n redirects.push({\n from: oldPath,\n to: `/docs/${version}/${doc.slug}`,\n })\n }\n }\n }\n }\n\n return redirects\n}\n\n/**\n * Find redirect destination for a given path\n */\nexport async function findRedirect(path: string): Promise<string | null> {\n const redirects = await buildRedirectMappings()\n const redirect = redirects.find((r) => r.from === path)\n return redirect ? redirect.to : null\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,aAAe;AACf,IAAAC,eAAiB;AACjB,yBAAmB;;;ACDnB,gBAAe;AACf,kBAAiB;AAgBjB,IAAM,WAAW,YAAAC,QAAK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BAAyB,QAAQ,IAAI,0BAA0B;AAG5F,QAAM,iBAAiBA,MAAK,WAAW,GAAG,IAAIA,QAAO,IAAIA,KAAI;AAG7D,MAAI,UAAU;AAEZ,UAAM,iBAAiB,SAAS,WAAW,GAAG,IAAI,WAAW,IAAI,QAAQ;AACzE,UAAM,YAAY,eAAe,QAAQ,OAAO,EAAE;AAClD,WAAO,GAAG,SAAS,GAAG,cAAc;AAAA,EACtC;AAGA,SAAO;AACT;;;ACzBA,eAAsB,wBAAoD;AACxE,QAAM,WAAW,YAAY;AAC7B,QAAM,YAA+B,CAAC;AAEtC,aAAW,WAAW,UAAU;AAC9B,UAAM,OAAO,MAAM,WAAW,OAAO;AAErC,eAAW,OAAO,MAAM;AACtB,UAAI,IAAI,KAAK,iBAAiB,MAAM,QAAQ,IAAI,KAAK,aAAa,GAAG;AACnE,mBAAW,WAAW,IAAI,KAAK,eAAe;AAC5C,oBAAU,KAAK;AAAA,YACb,MAAM;AAAA,YACN,IAAI,SAAS,OAAO,IAAI,IAAI,IAAI;AAAA,UAClC,CAAC;AAAA,QACH;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;AAKA,eAAsB,aAAaC,OAAsC;AACvE,QAAM,YAAY,MAAM,sBAAsB;AAC9C,QAAM,WAAW,UAAU,KAAK,CAAC,MAAM,EAAE,SAASA,KAAI;AACtD,SAAO,WAAW,SAAS,KAAK;AAClC;","names":["import_fs","import_path","path","fs","import_path","path","path","DOCS_DIR","path","fs","matter","doc","isDevelopment","import_fs","import_path","path","isDevelopment","path","path","path","path"]}
@@ -1,111 +0,0 @@
1
- import {
2
- PerfTimer,
3
- buildRedirectMappings,
4
- clearAllCaches,
5
- debugLog,
6
- extractHeadings,
7
- extractTableOfContents,
8
- findRedirect,
9
- getAdjacentDocs,
10
- getAllCategoryConfigs,
11
- getAllDocs,
12
- getCacheStats,
13
- getCachedAllDocs,
14
- getCachedDocBySlug,
15
- getCachedVersions,
16
- getCategoryConfig,
17
- getDocBySlug,
18
- getI18nConfig,
19
- getVersions,
20
- isCategoryPage,
21
- logCacheOperation,
22
- logFsOperation,
23
- logMemoryUsage
24
- } from "../chunk-WMCO2UX5.mjs";
25
- import {
26
- CSP_DIRECTIVES,
27
- SAFE_MDX_COMPONENTS,
28
- generateCSPHeader,
29
- sanitizeMDXContent,
30
- sanitizePath,
31
- scanMDXForDangerousPatterns,
32
- validateMDXComponents,
33
- validateMDXSecurity,
34
- validatePathWithinDirectory
35
- } from "../chunk-BE7EROIW.mjs";
36
- import {
37
- buildSidebarStructure,
38
- defaultConfig,
39
- getConfig,
40
- getConfigValue,
41
- initConfig,
42
- loadConfig,
43
- processContentWithEnv,
44
- reloadConfig,
45
- replaceEnvVariables,
46
- sortSidebarGroups,
47
- sortSidebarItems,
48
- validateConfig
49
- } from "../chunk-6S3EJVEO.mjs";
50
- import {
51
- OpenApiParser,
52
- PostmanParser,
53
- SpecraParser,
54
- cn,
55
- detectParserType,
56
- getAssetPath,
57
- parseApiSpec
58
- } from "../chunk-XEMGCPZZ.mjs";
59
- export {
60
- CSP_DIRECTIVES,
61
- OpenApiParser,
62
- PerfTimer,
63
- PostmanParser,
64
- SAFE_MDX_COMPONENTS,
65
- SpecraParser,
66
- buildRedirectMappings,
67
- buildSidebarStructure,
68
- clearAllCaches,
69
- cn,
70
- debugLog,
71
- defaultConfig,
72
- detectParserType,
73
- extractHeadings,
74
- extractTableOfContents,
75
- findRedirect,
76
- generateCSPHeader,
77
- getAdjacentDocs,
78
- getAllCategoryConfigs,
79
- getAllDocs,
80
- getAssetPath,
81
- getCacheStats,
82
- getCachedAllDocs,
83
- getCachedDocBySlug,
84
- getCachedVersions,
85
- getCategoryConfig,
86
- getConfig,
87
- getConfigValue,
88
- getDocBySlug,
89
- getI18nConfig,
90
- getVersions,
91
- initConfig,
92
- isCategoryPage,
93
- loadConfig,
94
- logCacheOperation,
95
- logFsOperation,
96
- logMemoryUsage,
97
- parseApiSpec,
98
- processContentWithEnv,
99
- reloadConfig,
100
- replaceEnvVariables,
101
- sanitizeMDXContent,
102
- sanitizePath,
103
- scanMDXForDangerousPatterns,
104
- sortSidebarGroups,
105
- sortSidebarItems,
106
- validateConfig,
107
- validateMDXComponents,
108
- validateMDXSecurity,
109
- validatePathWithinDirectory
110
- };
111
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}