Home / Function/ hasWorkspacePackageJSON() — vite Function Reference

hasWorkspacePackageJSON() — vite Function Reference

Architecture documentation for the hasWorkspacePackageJSON() function in searchRoot.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  c4ce9dee_6723_e494_9564_5fb2aa863733["hasWorkspacePackageJSON()"]
  497939be_63aa_81b3_3492_3f2698d33097["searchRoot.ts"]
  c4ce9dee_6723_e494_9564_5fb2aa863733 -->|defined in| 497939be_63aa_81b3_3492_3f2698d33097
  f00607d5_f936_a7c7_9f17_a6349edeac83["searchForWorkspaceRoot()"]
  f00607d5_f936_a7c7_9f17_a6349edeac83 -->|calls| c4ce9dee_6723_e494_9564_5fb2aa863733
  98952751_e0cf_2bf3_c4a0_2fde2526872b["isFileReadable()"]
  c4ce9dee_6723_e494_9564_5fb2aa863733 -->|calls| 98952751_e0cf_2bf3_c4a0_2fde2526872b
  style c4ce9dee_6723_e494_9564_5fb2aa863733 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/node/server/searchRoot.ts lines 25–36

function hasWorkspacePackageJSON(root: string): boolean {
  const path = join(root, 'package.json')
  if (!isFileReadable(path)) {
    return false
  }
  try {
    const content = JSON.parse(fs.readFileSync(path, 'utf-8')) || {}
    return !!content.workspaces
  } catch {
    return false
  }
}

Domain

Subdomains

Frequently Asked Questions

What does hasWorkspacePackageJSON() do?
hasWorkspacePackageJSON() is a function in the vite codebase, defined in packages/vite/src/node/server/searchRoot.ts.
Where is hasWorkspacePackageJSON() defined?
hasWorkspacePackageJSON() is defined in packages/vite/src/node/server/searchRoot.ts at line 25.
What does hasWorkspacePackageJSON() call?
hasWorkspacePackageJSON() calls 1 function(s): isFileReadable.
What calls hasWorkspacePackageJSON()?
hasWorkspacePackageJSON() is called by 1 function(s): searchForWorkspaceRoot.

Analyze Your Own Codebase

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

Try Supermodel Free