Home / Function/ load() — supabase Function Reference

load() — supabase Function Reference

Architecture documentation for the load() function in lint-warnings-guide.ts from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  81cc75d8_cb5c_251b_9a50_8a85908b9dab["load()"]
  4ece67f8_a76b_e033_4b54_15035a2ff69c["fetchDartLibReferenceSource()"]
  4ece67f8_a76b_e033_4b54_15035a2ff69c -->|calls| 81cc75d8_cb5c_251b_9a50_8a85908b9dab
  163ff3fb_61d2_c6bb_e787_a0eb99927123["fetchPythonLibReferenceSource()"]
  163ff3fb_61d2_c6bb_e787_a0eb99927123 -->|calls| 81cc75d8_cb5c_251b_9a50_8a85908b9dab
  beddf0e8_87d0_174b_84b5_725905bdddbe["fetchCSharpLibReferenceSource()"]
  beddf0e8_87d0_174b_84b5_725905bdddbe -->|calls| 81cc75d8_cb5c_251b_9a50_8a85908b9dab
  f0f83592_ac01_4ddc_d46c_d935aa3e313c["fetchSwiftLibReferenceSource()"]
  f0f83592_ac01_4ddc_d46c_d935aa3e313c -->|calls| 81cc75d8_cb5c_251b_9a50_8a85908b9dab
  ba4ea701_0457_693f_1dc2_833f4dfea95c["fetchKtLibReferenceSource()"]
  ba4ea701_0457_693f_1dc2_833f4dfea95c -->|calls| 81cc75d8_cb5c_251b_9a50_8a85908b9dab
  f56f1d51_fe77_17a0_0249_0324b2c3b81c["fetchCliLibReferenceSource()"]
  f56f1d51_fe77_17a0_0249_0324b2c3b81c -->|calls| 81cc75d8_cb5c_251b_9a50_8a85908b9dab
  d35c9802_6c84_4b7d_7fa0_907f4c6a0275["fetchLintWarningsGuideSources()"]
  d35c9802_6c84_4b7d_7fa0_907f4c6a0275 -->|calls| 81cc75d8_cb5c_251b_9a50_8a85908b9dab
  bb2c79de_bc44_4879_8e44_cbf11b580212["fetchAllSources()"]
  bb2c79de_bc44_4879_8e44_cbf11b580212 -->|calls| 81cc75d8_cb5c_251b_9a50_8a85908b9dab
  70fa37bf_6a28_44d9_84be_e5024f1a8899["getBasename()"]
  81cc75d8_cb5c_251b_9a50_8a85908b9dab -->|calls| 70fa37bf_6a28_44d9_84be_e5024f1a8899
  style 81cc75d8_cb5c_251b_9a50_8a85908b9dab fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/docs/scripts/search/sources/lint-warnings-guide.ts lines 21–77

  async load() {
    const octokit = new Octokit()

    const response = await octokit.request('GET /repos/{owner}/{repo}/contents/{path}', {
      owner: this.org,
      repo: this.repo,
      path: this.docsDir,
      ref: this.branch,
      headers: {
        'X-GitHub-Api-Version': '2022-11-28',
      },
    })

    if (response.status >= 400) {
      throw Error(`Could not get contents of repo ${this.org}/${this.repo}`)
    }

    if (!Array.isArray(response.data)) {
      throw Error(
        'Reading a directory, not a file. Should not reach this, solely to appease Typescript.'
      )
    }

    const lintsList = response.data.filter(({ path }) => /docs\/\d+.+\.md$/.test(path))

    // Fetch all lint files and combine them into a single guide
    const lints = await Promise.all(
      lintsList.map(async ({ path }) => {
        const fileResponse = await fetch(
          `https://raw.githubusercontent.com/${this.org}/${this.repo}/${this.branch}/${path}`
        )

        if (fileResponse.status >= 400) {
          throw Error(`Could not get contents of file ${this.org}/${this.repo}/${path}`)
        }

        const content = await fileResponse.text()
        const basename = getBasename(path)

        return {
          path: basename,
          content,
          originalPath: path,
        }
      })
    )

    // Create a separate source for each lint file
    return lints.map(
      (lint) =>
        new LintWarningsGuideSource(
          this.source,
          `${this.path}?queryGroups=lint&lint=${lint.path}`,
          lint
        )
    )
  }

Subdomains

Frequently Asked Questions

What does load() do?
load() is a function in the supabase codebase.
What does load() call?
load() calls 1 function(s): getBasename.
What calls load()?
load() is called by 8 function(s): fetchAllSources, fetchCSharpLibReferenceSource, fetchCliLibReferenceSource, fetchDartLibReferenceSource, fetchKtLibReferenceSource, fetchLintWarningsGuideSources, fetchPythonLibReferenceSource, fetchSwiftLibReferenceSource.

Analyze Your Own Codebase

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

Try Supermodel Free