Home / File/ DevToolsComponentStackFrame.js — react Source File

DevToolsComponentStackFrame.js — react Source File

Architecture documentation for DevToolsComponentStackFrame.js, a javascript file in the react codebase. 4 imports, 2 dependents.

File javascript BabelCompiler Validation 4 imports 2 dependents 5 functions

Entity Profile

Dependency Diagram

graph LR
  c59dc57c_ed0c_b6cd_803d_b7eeab46f99e["DevToolsComponentStackFrame.js"]
  0304bbc8_f110_6643_71c6_d26bddc58fde["types.js"]
  c59dc57c_ed0c_b6cd_803d_b7eeab46f99e --> 0304bbc8_f110_6643_71c6_d26bddc58fde
  9a81e06e_974e_e81d_602d_eef62dec4440["DevToolsConsolePatching.js"]
  c59dc57c_ed0c_b6cd_803d_b7eeab46f99e --> 9a81e06e_974e_e81d_602d_eef62dec4440
  6ad9f549_2ad9_74e1_a410_dcaefa5b42d6["disableLogs"]
  c59dc57c_ed0c_b6cd_803d_b7eeab46f99e --> 6ad9f549_2ad9_74e1_a410_dcaefa5b42d6
  fab04a66_3601_314a_508c_0c0ed218e0c8["reenableLogs"]
  c59dc57c_ed0c_b6cd_803d_b7eeab46f99e --> fab04a66_3601_314a_508c_0c0ed218e0c8
  2bbfa631_5780_6883_1746_b7c42df10b5d["DevToolsFiberComponentStack.js"]
  2bbfa631_5780_6883_1746_b7c42df10b5d --> c59dc57c_ed0c_b6cd_803d_b7eeab46f99e
  aa545f4b_797f_d455_0d48_d21828047895["DevToolsComponentInfoStack.js"]
  aa545f4b_797f_d455_0d48_d21828047895 --> c59dc57c_ed0c_b6cd_803d_b7eeab46f99e
  style c59dc57c_ed0c_b6cd_803d_b7eeab46f99e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow
 */

// This is a DevTools fork of ReactComponentStackFrame.
// This fork enables DevTools to use the same "native" component stack format,
// while still maintaining support for multiple renderer versions
// (which use different values for ReactTypeOfWork).

import type {CurrentDispatcherRef} from '../types';

// The shared console patching code is DEV-only.
// We can't use it since DevTools only ships production builds.
import {disableLogs, reenableLogs} from './DevToolsConsolePatching';

let prefix;
export function describeBuiltInComponentFrame(name: string): string {
  if (prefix === undefined) {
    // Extract the VM specific prefix used by each line.
    try {
      throw Error();
    } catch (x) {
      const match = x.stack.trim().match(/\n( *(at )?)/);
      prefix = (match && match[1]) || '';
    }
  }
  let suffix = '';
  if (__IS_CHROME__ || __IS_EDGE__ || __IS_NATIVE__) {
    suffix = ' (<anonymous>)';
  } else if (__IS_FIREFOX__) {
    suffix = '@unknown:0:0';
  }
  // We use the prefix to ensure our stacks line up with native stack frames.
  // We use a suffix to ensure it gets parsed natively.
  return '\n' + prefix + name + suffix;
}

export function describeDebugInfoFrame(name: string, env: ?string): string {
  return describeBuiltInComponentFrame(name + (env ? ' [' + env + ']' : ''));
}

let reentry = false;
let componentFrameCache;
if (__DEV__) {
  const PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
  componentFrameCache = new PossiblyWeakMap<$FlowFixMe, string>();
}

export function describeNativeComponentFrame(
  fn: Function,
  construct: boolean,
  currentDispatcherRef: CurrentDispatcherRef,
): string {
  // If something asked for a stack inside a fake render, it should get ignored.
  if (!fn || reentry) {
// ... (232 more lines)

Domain

Subdomains

Frequently Asked Questions

What does DevToolsComponentStackFrame.js do?
DevToolsComponentStackFrame.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in DevToolsComponentStackFrame.js?
DevToolsComponentStackFrame.js defines 5 function(s): describeBuiltInComponentFrame, describeClassComponentFrame, describeDebugInfoFrame, describeFunctionComponentFrame, describeNativeComponentFrame.
What does DevToolsComponentStackFrame.js depend on?
DevToolsComponentStackFrame.js imports 4 module(s): DevToolsConsolePatching.js, disableLogs, reenableLogs, types.js.
What files import DevToolsComponentStackFrame.js?
DevToolsComponentStackFrame.js is imported by 2 file(s): DevToolsComponentInfoStack.js, DevToolsFiberComponentStack.js.
Where is DevToolsComponentStackFrame.js in the architecture?
DevToolsComponentStackFrame.js is located at packages/react-devtools-shared/src/backend/shared/DevToolsComponentStackFrame.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-shared/src/backend/shared).

Analyze Your Own Codebase

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

Try Supermodel Free