Home / Function/ walkMdxFiles() — supabase Function Reference

walkMdxFiles() — supabase Function Reference

Architecture documentation for the walkMdxFiles() function in guideModelLoader.ts from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  46d218d1_4c2d_c813_f0c6_3dc0d7dce1f0["walkMdxFiles()"]
  35b58177_96a8_a8b9_6670_b3063b6cc9c7["allFromFs()"]
  35b58177_96a8_a8b9_6670_b3063b6cc9c7 -->|calls| 46d218d1_4c2d_c813_f0c6_3dc0d7dce1f0
  a7b13147_1b94_5dbe_3036_8c86489e129c["tryCatch()"]
  46d218d1_4c2d_c813_f0c6_3dc0d7dce1f0 -->|calls| a7b13147_1b94_5dbe_3036_8c86489e129c
  57bdb2f8_7248_1024_8cd3_d72f92748498["isHiddenFile()"]
  46d218d1_4c2d_c813_f0c6_3dc0d7dce1f0 -->|calls| 57bdb2f8_7248_1024_8cd3_d72f92748498
  0bf5e20d_de53_c586_d17f_d498453effe0["isDisabledGuide()"]
  46d218d1_4c2d_c813_f0c6_3dc0d7dce1f0 -->|calls| 0bf5e20d_de53_c586_d17f_d498453effe0
  2ba77918_c71f_00b4_2b40_c0b152543573["join()"]
  46d218d1_4c2d_c813_f0c6_3dc0d7dce1f0 -->|calls| 2ba77918_c71f_00b4_2b40_c0b152543573
  6b6adaac_18fc_5147_3872_082ddf2861ce["appendError()"]
  46d218d1_4c2d_c813_f0c6_3dc0d7dce1f0 -->|calls| 6b6adaac_18fc_5147_3872_082ddf2861ce
  f0cb3c6d_e823_6f6f_b9a4_ab144fc70aa5["extractMessageFromAnyError()"]
  46d218d1_4c2d_c813_f0c6_3dc0d7dce1f0 -->|calls| f0cb3c6d_e823_6f6f_b9a4_ab144fc70aa5
  style 46d218d1_4c2d_c813_f0c6_3dc0d7dce1f0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/docs/resources/guide/guideModelLoader.ts lines 44–82

async function walkMdxFiles(
  dir: string,
  multiError: { current: MultiError | null }
): Promise<Array<string>> {
  const readDirResult = await Result.tryCatch(
    () => fs.readdir(dir, { recursive: true }),
    (error) => error
  )

  return readDirResult.match(
    (allPaths) => {
      const mdxFiles: string[] = []

      for (const relativePath of allPaths) {
        if (isHiddenFile(relativePath)) {
          continue
        }

        if (isDisabledGuide(relativePath, dir)) {
          continue
        }

        if (relativePath.endsWith('.mdx')) {
          mdxFiles.push(join(dir, relativePath))
        }
      }

      return mdxFiles
    },
    (error) => {
      // If we can't read the directory, add it to the error collection
      ;(multiError.current ??= new MultiError('Failed to load some guides:')).appendError(
        `Failed to read directory ${dir}: ${extractMessageFromAnyError(error)}`,
        error
      )
      return []
    }
  )
}

Subdomains

Called By

Frequently Asked Questions

What does walkMdxFiles() do?
walkMdxFiles() is a function in the supabase codebase.
What does walkMdxFiles() call?
walkMdxFiles() calls 6 function(s): appendError, extractMessageFromAnyError, isDisabledGuide, isHiddenFile, join, tryCatch.
What calls walkMdxFiles()?
walkMdxFiles() is called by 1 function(s): allFromFs.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free