1- import fs from " fs/promises" ;
2- import matter from "gray-matter" ;
3- import { source } from "@/lib/source" ;
4- import { notFound } from "next/navigation" ;
5- import type { HeadingProps } from "@/types" ;
6- import { getMDXComponents } from "@/components/mdx" ;
7- import { API } from " @/components/reference/api-page" ;
8- import { APIPage } from " @/components/openapi/api-page" ;
9- import { Badge } from " @/components/ui/badge" ;
1+ import fs from 'node: fs/promises' ;
2+ import defaultMdxComponents from 'fumadocs-ui/mdx' ;
3+ import matter from 'gray-matter' ;
4+ import * as lucideIcons from 'lucide-react' ;
5+ import { CheckIcon } from 'lucide-react' ;
6+ import { notFound } from 'next/navigation' ;
7+ import { Callout } from ' @/components/callout' ;
8+ import { FeedbackWrapper } from ' @/components/feedback/feedback-wrapper' ;
9+ import { InteractiveHeader , InteractiveLayout } from ' @/components/layouts/interactive' ;
1010import {
1111 DocsPage ,
12- DocsPageLayout ,
13- DocsPageHeader ,
12+ DocsPageBreadcrumb ,
1413 DocsPageContent ,
1514 DocsPageContentWrapper ,
16- DocsPageBreadcrumb ,
17- DocsPageTitle ,
1815 DocsPageDescription ,
16+ DocsPageHeader ,
17+ DocsPageLayout ,
1918 DocsPageProse ,
20- } from "@/components/layouts/page" ;
21- import {
22- InteractiveHeader ,
23- InteractiveLayout ,
24- } from "@/components/layouts/interactive" ;
25- import defaultMdxComponents from "fumadocs-ui/mdx" ;
26- import { LLMShare } from "@/components/llm-share" ;
27- import { CheckIcon } from "lucide-react" ;
28- import { TagFilterSystem } from "@/components/ui/tag-filter-system" ;
29- import { getAllFilterablePages } from "@/lib/source" ;
30- import { Mermaid } from "@/components/mdx/mermaid" ;
31- import { Callout } from "@/components/callout" ;
32- import * as customIcons from "@/components/ui/icon" ;
33- import * as lucideIcons from "lucide-react" ;
34- import { FeedbackWrapper } from "@/components/feedback/feedback-wrapper" ;
19+ DocsPageTitle ,
20+ } from '@/components/layouts/page' ;
21+ import { LLMShare } from '@/components/llm-share' ;
22+ import { getMDXComponents } from '@/components/mdx' ;
23+ import { Mermaid } from '@/components/mdx/mermaid' ;
24+ import { APIPage } from '@/components/openapi/api-page' ;
25+ import { API } from '@/components/reference/api-page' ;
26+ import { Badge } from '@/components/ui/badge' ;
27+ import * as customIcons from '@/components/ui/icon' ;
28+ import { TagFilterSystem } from '@/components/ui/tag-filter-system' ;
29+ import { getAllFilterablePages , source } from '@/lib/source' ;
30+ import type { HeadingProps } from '@/types' ;
3531
36- export default async function Page ( props : {
37- params : Promise < { slug ?: string [ ] } > ;
38- } ) {
32+ export default async function Page ( props : { params : Promise < { slug ?: string [ ] } > } ) {
3933 const params = await props . params ;
4034 const page = source . getPage ( params . slug ) ;
4135 if ( ! page ) notFound ( ) ;
4236
43- const fileContent = await fs . readFile ( page . data . _file . absolutePath , " utf-8" ) ;
37+ const fileContent = await fs . readFile ( page . data . _file . absolutePath , ' utf-8' ) ;
4438 const { content : rawMarkdownContent } = matter ( fileContent ) ;
4539
4640 const LLMContent = rawMarkdownContent
47- . split ( "\n" )
48- . filter ( ( line ) => ! line . trim ( ) . startsWith ( " import" ) )
49- . join ( "\n" )
41+ . split ( '\n' )
42+ . filter ( ( line ) => ! line . trim ( ) . startsWith ( ' import' ) )
43+ . join ( '\n' )
5044 . trim ( ) ;
5145
5246 const MDX = page . data . body ;
5347
5448 if ( ! MDX ) {
55- console . error ( " MDX component is undefined for page:" , page . url ) ;
49+ console . error ( ' MDX component is undefined for page:' , page . url ) ;
5650 notFound ( ) ;
5751 }
5852
5953 // Get all filterable pages for tag filtering
6054 const allFilterablePages = getAllFilterablePages ( ) ;
6155
6256 // Extract section from current page URL for scoped filtering
63- const currentSection = page . url . split ( "/" ) . filter ( Boolean ) [ 1 ] || " general" ;
57+ const currentSection = page . url . split ( '/' ) . filter ( Boolean ) [ 1 ] || ' general' ;
6458
6559 // Helper function to get icon component
6660 const getIconComponent = ( iconName : string ) => {
67- const iconProps = { className : " w-3 h-3 shrink-0" } ;
61+ const iconProps = { className : ' w-3 h-3 shrink-0' } ;
6862
6963 // Check custom icons first
7064 const CustomIcon = ( customIcons as any ) [ iconName ] ;
71- if ( CustomIcon && typeof CustomIcon === " function" ) {
65+ if ( CustomIcon && typeof CustomIcon === ' function' ) {
7266 return < CustomIcon { ...iconProps } /> ;
7367 }
7468
7569 // Try with "Icon" suffix for custom icons
7670 const CustomIconWithSuffix = ( customIcons as any ) [ `${ iconName } Icon` ] ;
77- if ( CustomIconWithSuffix && typeof CustomIconWithSuffix === " function" ) {
71+ if ( CustomIconWithSuffix && typeof CustomIconWithSuffix === ' function' ) {
7872 return < CustomIconWithSuffix { ...iconProps } /> ;
7973 }
8074
@@ -88,7 +82,7 @@ export default async function Page(props: {
8882
8983 for ( const pattern of lucidePatterns ) {
9084 const LucideIcon = ( lucideIcons as any ) [ pattern ] ;
91- if ( LucideIcon && typeof LucideIcon === " function" ) {
85+ if ( LucideIcon && typeof LucideIcon === ' function' ) {
9286 return < LucideIcon { ...iconProps } /> ;
9387 }
9488 }
@@ -140,10 +134,8 @@ export default async function Page(props: {
140134 />
141135 ) ,
142136 h1 : ( { children, ...props } : HeadingProps ) => {
143- const H1 =
144- defaultMdxComponents . h1 as React . ComponentType < HeadingProps > ;
145- const id =
146- typeof children === "string" ? children : undefined ;
137+ const H1 = defaultMdxComponents . h1 as React . ComponentType < HeadingProps > ;
138+ const id = typeof children === 'string' ? children : undefined ;
147139 return (
148140 < H1 id = { id } { ...props } >
149141 { children }
@@ -158,28 +150,21 @@ export default async function Page(props: {
158150 />
159151 ) ,
160152 hr : ( props : React . PropsWithChildren ) => (
161- < hr
162- { ...props }
163- className = "border-t border-border/50 mt-0"
164- />
153+ < hr { ...props } className = "border-t border-border/50 mt-0" />
165154 ) ,
166- input : (
167- props : React . InputHTMLAttributes < HTMLInputElement > ,
168- ) => {
169- if ( props . type === "checkbox" ) {
155+ input : ( props : React . InputHTMLAttributes < HTMLInputElement > ) => {
156+ if ( props . type === 'checkbox' ) {
170157 return (
171158 < div className = "relative inline-flex items-center mr-2" >
172159 < input { ...props } className = "sr-only" />
173160 < div
174161 className = { `w-4 h-4 border-2 rounded-sm flex items-center justify-center ${
175162 props . checked
176- ? " bg-brand-orange border-brand-orange text-white"
177- : " border-border bg-background"
163+ ? ' bg-brand-orange border-brand-orange text-white'
164+ : ' border-border bg-background'
178165 } `}
179166 >
180- { props . checked && (
181- < CheckIcon className = "w-3 h-3" />
182- ) }
167+ { props . checked && < CheckIcon className = "w-3 h-3" /> }
183168 </ div >
184169 </ div >
185170 ) ;
@@ -191,10 +176,7 @@ export default async function Page(props: {
191176 />
192177 </ DocsPageProse >
193178 < div className = "border-b border-border/50" />
194- < FeedbackWrapper
195- pageTitle = { page . data . title }
196- pagePath = { page . url }
197- />
179+ < FeedbackWrapper pageTitle = { page . data . title } pagePath = { page . url } />
198180 </ DocsPageContent >
199181 </ DocsPageContentWrapper >
200182 </ DocsPageLayout >
@@ -243,10 +225,8 @@ export default async function Page(props: {
243225 />
244226 ) ,
245227 h1 : ( { children, ...props } : HeadingProps ) => {
246- const H1 =
247- defaultMdxComponents . h1 as React . ComponentType < HeadingProps > ;
248- const id =
249- typeof children === "string" ? children : undefined ;
228+ const H1 = defaultMdxComponents . h1 as React . ComponentType < HeadingProps > ;
229+ const id = typeof children === 'string' ? children : undefined ;
250230 return (
251231 < H1 id = { id } { ...props } >
252232 { children }
@@ -261,28 +241,21 @@ export default async function Page(props: {
261241 />
262242 ) ,
263243 hr : ( props : React . PropsWithChildren ) => (
264- < hr
265- { ...props }
266- className = "border-t border-border/50 mt-0"
267- />
244+ < hr { ...props } className = "border-t border-border/50 mt-0" />
268245 ) ,
269- input : (
270- props : React . InputHTMLAttributes < HTMLInputElement > ,
271- ) => {
272- if ( props . type === "checkbox" ) {
246+ input : ( props : React . InputHTMLAttributes < HTMLInputElement > ) => {
247+ if ( props . type === 'checkbox' ) {
273248 return (
274249 < div className = "relative inline-flex items-center mr-2" >
275250 < input { ...props } className = "sr-only" />
276251 < div
277252 className = { `w-4 h-4 border-2 rounded-sm flex items-center justify-center ${
278253 props . checked
279- ? " bg-brand-orange border-brand-orange text-white"
280- : " border-border bg-background"
254+ ? ' bg-brand-orange border-brand-orange text-white'
255+ : ' border-border bg-background'
281256 } `}
282257 >
283- { props . checked && (
284- < CheckIcon className = "w-3 h-3" />
285- ) }
258+ { props . checked && < CheckIcon className = "w-3 h-3" /> }
286259 </ div >
287260 </ div >
288261 ) ;
@@ -294,10 +267,7 @@ export default async function Page(props: {
294267 />
295268 </ DocsPageProse >
296269 < div className = "border-b border-border/50" />
297- < FeedbackWrapper
298- pageTitle = { page . data . title }
299- pagePath = { page . url }
300- />
270+ < FeedbackWrapper pageTitle = { page . data . title } pagePath = { page . url } />
301271 </ DocsPageContent >
302272 </ DocsPageContentWrapper >
303273 </ DocsPageLayout >
@@ -314,9 +284,7 @@ export async function generateStaticParams() {
314284 ) ;
315285}
316286
317- export async function generateMetadata ( props : {
318- params : Promise < { slug ?: string [ ] } > ;
319- } ) {
287+ export async function generateMetadata ( props : { params : Promise < { slug ?: string [ ] } > } ) {
320288 const params = await props . params ;
321289 const page = source . getPage ( params . slug ) ;
322290 if ( ! page ) notFound ( ) ;
0 commit comments