mirror of
https://github.com/luxfi/go-bip32.git
synced 2026-09-24 00:24:44 +00:00
Three things it could not see. loader is generic, so annotating the source memo with ReturnType<typeof loader> instantiated it with no type arguments and collapsed the page data to its base type — body, toc and full all went missing while fumadocs exported them the whole time; a wrapper's return type is the instantiated generic, so they survive and the memo still prevents the circular reference it was written for. mdx-components imports MDXComponents from mdx/types, which nothing declared. And the sans face is Zen: ZenSans has never been exported by @hanzo/font. Co-authored-by: Hanzo Dev <[email protected]>
29 lines
945 B
TypeScript
29 lines
945 B
TypeScript
import { docs } from "@/.source"
|
|
import { loader } from "fumadocs-core/source"
|
|
|
|
// Create a single source instance that is reused
|
|
// This prevents circular references and stack overflow issues
|
|
// The wrapper is what keeps the TYPE. `loader` is generic, so annotating the
|
|
// cache with ReturnType<typeof loader> instantiates it with no type arguments
|
|
// and collapses the page data to its base — which is why body, toc and full
|
|
// were all reported as missing while fumadocs exported them the whole time. A
|
|
// wrapper's return type is the INSTANTIATED generic, so the concrete page data
|
|
// survives and the memo below still does its job.
|
|
function createSource() {
|
|
return loader({
|
|
baseUrl: "/docs",
|
|
source: docs.toFumadocsSource(),
|
|
})
|
|
}
|
|
|
|
let _source: ReturnType<typeof createSource> | null = null
|
|
|
|
export function getSource() {
|
|
if (!_source) {
|
|
_source = createSource()
|
|
}
|
|
return _source
|
|
}
|
|
|
|
export const source = getSource()
|