Home / Function/ readPackageInfo() — vite Function Reference

readPackageInfo() — vite Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  c7fe79cf_90ff_1266_2969_1631fc185db0["readPackageInfo()"]
  217bc23a_2c54_8ca5_016d_7cb941ca23b7["acknowledgements.data.ts"]
  c7fe79cf_90ff_1266_2969_1631fc185db0 -->|defined in| 217bc23a_2c54_8ca5_016d_7cb941ca23b7
  a724534b_0754_d646_5276_8ce434497095["loadData()"]
  a724534b_0754_d646_5276_8ce434497095 -->|calls| c7fe79cf_90ff_1266_2969_1631fc185db0
  15e14359_4c4c_e47c_5c7b_a51bc2275a03["parseAuthor()"]
  c7fe79cf_90ff_1266_2969_1631fc185db0 -->|calls| 15e14359_4c4c_e47c_5c7b_a51bc2275a03
  a85b907b_5d08_2d87_8ec2_a2cca3c7d2c0["normalizeRepository()"]
  c7fe79cf_90ff_1266_2969_1631fc185db0 -->|calls| a85b907b_5d08_2d87_8ec2_a2cca3c7d2c0
  f436df71_e9b7_3ffa_08cd_b9e4f8a20848["normalizeFunding()"]
  c7fe79cf_90ff_1266_2969_1631fc185db0 -->|calls| f436df71_e9b7_3ffa_08cd_b9e4f8a20848
  style c7fe79cf_90ff_1266_2969_1631fc185db0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

docs/_data/acknowledgements.data.ts lines 195–219

function readPackageInfo(
  packageName: string,
  nodeModulesDir: string,
): Dependency | null {
  const packagePath = path.join(nodeModulesDir, packageName, 'package.json')

  try {
    const content = fs.readFileSync(packagePath, 'utf-8')
    const pkg: PackageJson = JSON.parse(content)
    const authorInfo = parseAuthor(pkg.author)

    return {
      name: pkg.name,
      version: pkg.version,
      description: pkg.description,
      author: authorInfo.name,
      authorUrl: authorInfo.url,
      repository: normalizeRepository(pkg.repository),
      funding: normalizeFunding(pkg.funding),
    }
  } catch {
    // Package might not exist in node_modules (optional peer dep, etc.)
    return null
  }
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does readPackageInfo() do?
readPackageInfo() is a function in the vite codebase, defined in docs/_data/acknowledgements.data.ts.
Where is readPackageInfo() defined?
readPackageInfo() is defined in docs/_data/acknowledgements.data.ts at line 195.
What does readPackageInfo() call?
readPackageInfo() calls 3 function(s): normalizeFunding, normalizeRepository, parseAuthor.
What calls readPackageInfo()?
readPackageInfo() 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