fromFs() — supabase Function Reference
Architecture documentation for the fromFs() function in guideModelLoader.ts from the supabase codebase.
Entity Profile
Dependency Diagram
graph TD eb1b33c7_935b_b61a_962a_2e11b76d01bc["fromFs()"] e3f6760d_3d29_5416_665c_9614b409ec69["getGuidesMarkdownInternal()"] e3f6760d_3d29_5416_665c_9614b409ec69 -->|calls| eb1b33c7_935b_b61a_962a_2e11b76d01bc cb5b1bc9_56b5_9240_6bd2_f1b8c5f0e6a7["loadGuides()"] cb5b1bc9_56b5_9240_6bd2_f1b8c5f0e6a7 -->|calls| eb1b33c7_935b_b61a_962a_2e11b76d01bc bf1f3be5_d6c4_1236_be03_471a96aba509["load()"] bf1f3be5_d6c4_1236_be03_471a96aba509 -->|calls| eb1b33c7_935b_b61a_962a_2e11b76d01bc a7b13147_1b94_5dbe_3036_8c86489e129c["tryCatch()"] eb1b33c7_935b_b61a_962a_2e11b76d01bc -->|calls| a7b13147_1b94_5dbe_3036_8c86489e129c 2ba77918_c71f_00b4_2b40_c0b152543573["join()"] eb1b33c7_935b_b61a_962a_2e11b76d01bc -->|calls| 2ba77918_c71f_00b4_2b40_c0b152543573 67a945e1_7550_1b68_2ba7_665ba0ff6278["preprocessMdxWithDefaults()"] eb1b33c7_935b_b61a_962a_2e11b76d01bc -->|calls| 67a945e1_7550_1b68_2ba7_665ba0ff6278 7920f0ed_264a_f954_6f8a_ec73ded46618["processMdx()"] eb1b33c7_935b_b61a_962a_2e11b76d01bc -->|calls| 7920f0ed_264a_f954_6f8a_ec73ded46618 040a5796_eb59_9ff7_60d0_b127fcaa25c2["map()"] eb1b33c7_935b_b61a_962a_2e11b76d01bc -->|calls| 040a5796_eb59_9ff7_60d0_b127fcaa25c2 f0cb3c6d_e823_6f6f_b9a4_ab144fc70aa5["extractMessageFromAnyError()"] eb1b33c7_935b_b61a_962a_2e11b76d01bc -->|calls| f0cb3c6d_e823_6f6f_b9a4_ab144fc70aa5 style eb1b33c7_935b_b61a_962a_2e11b76d01bc fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
apps/docs/resources/guide/guideModelLoader.ts lines 104–153
static async fromFs(relPath: string): Promise<Result<GuideModel, Error>> {
return Result.tryCatch(
async () => {
// Read the markdown file from the guides directory
const filePath = join(GUIDES_DIRECTORY, relPath)
const fileContent = await fs.readFile(filePath, 'utf-8')
// Parse frontmatter using gray-matter
const { data: metadata, content: rawContent } = matter(fileContent)
// Replace partials and code samples using directives
const processedContent = await preprocessMdxWithDefaults(rawContent)
// Process MDX to get chunked sections for embedding
const { sections } = await processMdx(processedContent)
// Create subsections from the chunked sections
const subsections = sections.map((section) => ({
title: section.heading,
href: section.slug,
content: section.content,
}))
// Extract title from metadata or first heading
const title = metadata.title || sections.find((s) => s.heading)?.heading
// Create href from relative path (remove .mdx extension)
const href = `https://supabase.com/docs/guides/${relPath.replace(/\.mdx?$/, '')}`
return new GuideModel({
title,
href,
content: processedContent,
metadata,
subsections,
})
},
(error) => {
if (error instanceof Error && 'code' in error && error.code === 'ENOENT') {
return new FileNotFoundError('', error)
}
return new Error(
`Failed to load guide from ${relPath}: ${extractMessageFromAnyError(error)}`,
{
cause: error,
}
)
}
)
}
Domain
Subdomains
Source
Frequently Asked Questions
What does fromFs() do?
fromFs() is a function in the supabase codebase.
What does fromFs() call?
fromFs() calls 6 function(s): extractMessageFromAnyError, join, map, preprocessMdxWithDefaults, processMdx, tryCatch.
What calls fromFs()?
fromFs() is called by 3 function(s): getGuidesMarkdownInternal, load, loadGuides.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free