fix: add null checks to parsers and fix docs path

This commit is contained in:
2026-03-18 16:13:57 +08:00
parent ff48936402
commit 4898ee5434
8 changed files with 20 additions and 4 deletions

View File

@@ -5,12 +5,13 @@ import { parseMarkdown, buildFileTree } from '@/lib/parser'
import type { DocFile, ParsedDoc } from '@/lib/types'
import { config } from '@/config'
const modules = import.meta.glob('../docs/**/*.md', { as: 'raw', eager: true })
const modules = import.meta.glob('../docs/api/**/*.md', { as: 'raw', eager: true })
const DOCS_FILES: Record<string, string> = Object.fromEntries(
Object.entries(modules).map(([path, content]) => {
const relativePath = path.replace('../docs/', '')
return [relativePath, content as string]
const relativePath = path.replace('../docs/api/', '')
const fileContent = typeof content === 'string' ? content : ''
return [relativePath, fileContent]
})
)