Home / Function/ groupByAuthor() — vite Function Reference

groupByAuthor() — vite Function Reference

Architecture documentation for the groupByAuthor() function in acknowledgements.data.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  d7069f79_7d30_d2c5_f382_fb13a52cd6f7["groupByAuthor()"]
  217bc23a_2c54_8ca5_016d_7cb941ca23b7["acknowledgements.data.ts"]
  d7069f79_7d30_d2c5_f382_fb13a52cd6f7 -->|defined in| 217bc23a_2c54_8ca5_016d_7cb941ca23b7
  a724534b_0754_d646_5276_8ce434497095["loadData()"]
  a724534b_0754_d646_5276_8ce434497095 -->|calls| d7069f79_7d30_d2c5_f382_fb13a52cd6f7
  style d7069f79_7d30_d2c5_f382_fb13a52cd6f7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

docs/_data/acknowledgements.data.ts lines 221–264

function groupByAuthor(dependencies: Dependency[]): Author[] {
  const authorMap = new Map<
    string,
    { url?: string; packages: AuthorPackage[] }
  >()

  for (const dep of dependencies) {
    if (dep.author) {
      const existing = authorMap.get(dep.author)
      if (existing) {
        existing.packages.push({ name: dep.name, funding: dep.funding })
        if (!existing.url && dep.authorUrl) {
          existing.url = dep.authorUrl
        }
      } else {
        authorMap.set(dep.author, {
          url: dep.authorUrl,
          packages: [{ name: dep.name, funding: dep.funding }],
        })
      }
    }
  }

  return Array.from(authorMap.entries())
    .map(([name, info]) => {
      const sortedPackages = info.packages.sort((a, b) =>
        a.name.localeCompare(b.name),
      )
      const fundingUrls = new Set(
        sortedPackages.map((p) => p.funding).filter(Boolean),
      )
      const sharedFunding =
        fundingUrls.size === 1 ? [...fundingUrls][0] : undefined
      return {
        name,
        url: info.url,
        funding: sharedFunding,
        packages: sharedFunding
          ? sortedPackages.map((p) => ({ name: p.name }))
          : sortedPackages,
      }
    })
    .sort((a, b) => a.name.localeCompare(b.name))
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does groupByAuthor() do?
groupByAuthor() is a function in the vite codebase, defined in docs/_data/acknowledgements.data.ts.
Where is groupByAuthor() defined?
groupByAuthor() is defined in docs/_data/acknowledgements.data.ts at line 221.
What calls groupByAuthor()?
groupByAuthor() is called by 1 function(s): loadData.

Analyze Your Own Codebase

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

Try Supermodel Free