Home / Function/ buildReexportMap() — supabase Function Reference

buildReexportMap() — supabase Function Reference

Architecture documentation for the buildReexportMap() function in find-undocumented.ts from the supabase codebase.

Entity Profile

Relationship Graph

Source Code

apps/docs/scripts/find-undocumented.ts lines 64–95

function buildReexportMap(typeSpecModules: TypeSpecModule[]): Map<string, string> {
  const classToPackages = new Map<string, Set<string>>()

  for (const mod of typeSpecModules) {
    for (const methodPath of Object.keys(mod.methods)) {
      const parts = methodPath.split('.')
      const pkg = parts[0]
      const className = parts[1]
      if (pkg?.startsWith('@supabase/') && className) {
        if (!classToPackages.has(className)) {
          classToPackages.set(className, new Set())
        }
        classToPackages.get(className)!.add(pkg)
      }
    }
  }

  // For classes in multiple packages, map supabase-js to the original package
  const reexportMap = new Map<string, string>()
  for (const [className, packages] of classToPackages) {
    if (packages.has('@supabase/supabase-js') && packages.size > 1) {
      // Find the original package (not supabase-js)
      for (const pkg of packages) {
        if (pkg !== '@supabase/supabase-js') {
          reexportMap.set(className, pkg)
          break
        }
      }
    }
  }
  return reexportMap
}

Subdomains

Analyze Your Own Codebase

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

Try Supermodel Free