Home / Function/ getValidFilePath() — react Function Reference

getValidFilePath() — react Function Reference

Architecture documentation for the getValidFilePath() function in editor.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  8f292aac_c808_e1ff_4d0a_3a933ef58bee["getValidFilePath()"]
  39f6c195_7b6b_6f87_7437_5d782daf3565["editor.js"]
  8f292aac_c808_e1ff_4d0a_3a933ef58bee -->|defined in| 39f6c195_7b6b_6f87_7437_5d782daf3565
  d352faa0_4c41_77cb_45d0_6c9536117f37["doesFilePathExist()"]
  d352faa0_4c41_77cb_45d0_6c9536117f37 -->|calls| 8f292aac_c808_e1ff_4d0a_3a933ef58bee
  e8507b55_91a3_8bd9_66bd_762108bb46c6["launchEditor()"]
  e8507b55_91a3_8bd9_66bd_762108bb46c6 -->|calls| 8f292aac_c808_e1ff_4d0a_3a933ef58bee
  style 8f292aac_c808_e1ff_4d0a_3a933ef58bee fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-devtools-core/src/editor.js lines 112–134

export function getValidFilePath(
  maybeRelativePath: string,
  absoluteProjectRoots: Array<string>,
): string | null {
  // We use relative paths at Facebook with deterministic builds.
  // This is why our internal tooling calls React DevTools with absoluteProjectRoots.
  // If the filename is absolute then we don't need to care about this.
  if (isAbsolute(maybeRelativePath)) {
    if (existsSync(maybeRelativePath)) {
      return maybeRelativePath;
    }
  } else {
    for (let i = 0; i < absoluteProjectRoots.length; i++) {
      const projectRoot = absoluteProjectRoots[i];
      const joinedPath = join(projectRoot, maybeRelativePath);
      if (existsSync(joinedPath)) {
        return joinedPath;
      }
    }
  }

  return null;
}

Domain

Subdomains

Frequently Asked Questions

What does getValidFilePath() do?
getValidFilePath() is a function in the react codebase, defined in packages/react-devtools-core/src/editor.js.
Where is getValidFilePath() defined?
getValidFilePath() is defined in packages/react-devtools-core/src/editor.js at line 112.
What calls getValidFilePath()?
getValidFilePath() is called by 2 function(s): doesFilePathExist, launchEditor.

Analyze Your Own Codebase

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

Try Supermodel Free