Home / Function/ urlTransform() — supabase Function Reference

urlTransform() — supabase Function Reference

Architecture documentation for the urlTransform() function in page.tsx from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  9b44d37a_ebc5_9665_3a54_03c066977c7f["urlTransform()"]
  cc5c129d_acf8_c4f4_faa0_5127ca121e21["DatabaseAdvisorDocs()"]
  cc5c129d_acf8_c4f4_faa0_5127ca121e21 -->|calls| 9b44d37a_ebc5_9665_3a54_03c066977c7f
  f2c9d510_78e4_916b_9413_99c971c4b5e9["getBasename()"]
  9b44d37a_ebc5_9665_3a54_03c066977c7f -->|calls| f2c9d510_78e4_916b_9413_99c971c4b5e9
  style 9b44d37a_ebc5_9665_3a54_03c066977c7f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/docs/app/guides/database/database-advisors/page.tsx lines 116–141

const urlTransform: (lints: Array<{ path: string }>) => UrlTransformFunction = (lints) => (url) => {
  try {
    const placeholderHostname = 'placeholder'
    const { hostname, pathname, hash } = new URL(url, `http://${placeholderHostname}`)

    // Don't modify a url with a FQDN or a url that's only a hash
    if (hostname !== placeholderHostname || pathname === '/') {
      return url
    }

    const relativePath = getBasename(pathname)
    const section = lints.find(({ path }) => path === relativePath)

    if (section) {
      const url = new URL(window.location.href)
      url.searchParams.set('lint', relativePath)
      return url.toString()
    }

    // If we don't have this page in our docs, link to GitHub repo
    return `https://github.com/${org}/${repo}/blob/${branch}${pathname}${hash}`
  } catch (err) {
    console.error('Error transforming markdown URL', err)
    return url
  }
}

Subdomains

Frequently Asked Questions

What does urlTransform() do?
urlTransform() is a function in the supabase codebase.
What does urlTransform() call?
urlTransform() calls 1 function(s): getBasename.
What calls urlTransform()?
urlTransform() is called by 1 function(s): DatabaseAdvisorDocs.

Analyze Your Own Codebase

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

Try Supermodel Free