Home / Function/ normalizeSourcePath() — react Function Reference

normalizeSourcePath() — react Function Reference

Architecture documentation for the normalizeSourcePath() function in SourceMapMetadataConsumer.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  320a3b4e_798e_d179_0b68_c45b971d0001["normalizeSourcePath()"]
  5751162b_425a_76d9_4373_4cf5cde09b49["SourceMapMetadataConsumer.js"]
  320a3b4e_798e_d179_0b68_c45b971d0001 -->|defined in| 5751162b_425a_76d9_4373_4cf5cde09b49
  8436bb82_dab4_7302_5fc5_eff8d217773c["_getMetadataObjectsBySourceNames()"]
  8436bb82_dab4_7302_5fc5_eff8d217773c -->|calls| 320a3b4e_798e_d179_0b68_c45b971d0001
  8363e8e9_bb7f_f116_6160_65e0851ee4a9["_getHookMapForSource()"]
  8363e8e9_bb7f_f116_6160_65e0851ee4a9 -->|calls| 320a3b4e_798e_d179_0b68_c45b971d0001
  style 320a3b4e_798e_d179_0b68_c45b971d0001 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-devtools-shared/src/hooks/SourceMapMetadataConsumer.js lines 34–55

function normalizeSourcePath(
  sourceInput: string,
  map: {+sourceRoot?: ?string, ...},
): string {
  const {sourceRoot} = map;
  let source = sourceInput;

  source = String(source);
  // Some source maps produce relative source paths like "./foo.js" instead of
  // "foo.js".  Normalize these first so that future comparisons will succeed.
  // See bugzil.la/1090768.
  source = util.normalize(source);
  // Always ensure that absolute sources are internally stored relative to
  // the source root, if the source root is absolute. Not doing this would
  // be particularly problematic when the source root is a prefix of the
  // source (valid, but why??). See github issue #199 and bugzil.la/1188982.
  source =
    sourceRoot != null && util.isAbsolute(sourceRoot) && util.isAbsolute(source)
      ? util.relative(sourceRoot, source)
      : source;
  return util.computeSourceURL(sourceRoot, source);
}

Domain

Subdomains

Frequently Asked Questions

What does normalizeSourcePath() do?
normalizeSourcePath() is a function in the react codebase, defined in packages/react-devtools-shared/src/hooks/SourceMapMetadataConsumer.js.
Where is normalizeSourcePath() defined?
normalizeSourcePath() is defined in packages/react-devtools-shared/src/hooks/SourceMapMetadataConsumer.js at line 34.
What calls normalizeSourcePath()?
normalizeSourcePath() is called by 2 function(s): _getHookMapForSource, _getMetadataObjectsBySourceNames.

Analyze Your Own Codebase

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

Try Supermodel Free