Home / File/ ReactComponentStackFrame.js — react Source File

ReactComponentStackFrame.js — react Source File

Architecture documentation for ReactComponentStackFrame.js, a javascript file in the react codebase. 5 imports, 0 dependents.

File javascript BabelCompiler Entrypoint 5 imports 5 functions

Entity Profile

Dependency Diagram

graph LR
  823a67e4_24d9_f152_2b72_4a49ef93fd70["ReactComponentStackFrame.js"]
  75e6c571_72a9_6770_1d7a_bda63166dba5["ReactOwnerStackFrames.js"]
  823a67e4_24d9_f152_2b72_4a49ef93fd70 --> 75e6c571_72a9_6770_1d7a_bda63166dba5
  49d3bba9_cc0c_dc58_ea41_76e571ea2c0b["formatOwnerStack"]
  823a67e4_24d9_f152_2b72_4a49ef93fd70 --> 49d3bba9_cc0c_dc58_ea41_76e571ea2c0b
  cd71c240_9521_6e7e_d3a7_569162b4bbe0["ConsolePatchingDev"]
  823a67e4_24d9_f152_2b72_4a49ef93fd70 --> cd71c240_9521_6e7e_d3a7_569162b4bbe0
  1c5695a6_6806_ba54_2074_efc779e66da4["ReactSharedInternals"]
  823a67e4_24d9_f152_2b72_4a49ef93fd70 --> 1c5695a6_6806_ba54_2074_efc779e66da4
  ce7f6081_62bc_1c40_b730_35e812e5376d["DefaultPrepareStackTrace"]
  823a67e4_24d9_f152_2b72_4a49ef93fd70 --> ce7f6081_62bc_1c40_b730_35e812e5376d
  style 823a67e4_24d9_f152_2b72_4a49ef93fd70 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
 */

import {disableLogs, reenableLogs} from 'shared/ConsolePatchingDev';

import ReactSharedInternals from 'shared/ReactSharedInternals';

import DefaultPrepareStackTrace from 'shared/DefaultPrepareStackTrace';

import {formatOwnerStack} from './ReactOwnerStackFrames';

let prefix;
let suffix;
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]) || '';
      suffix =
        x.stack.indexOf('\n    at') > -1
          ? // V8
            ' (<anonymous>)'
          : // JSC/Spidermonkey
            x.stack.indexOf('@') > -1
            ? '@unknown:0:0'
            : // Other
              '';
    }
  }
  // We use the prefix to ensure our stacks line up with native stack frames.
  return '\n' + prefix + name + suffix;
}

export function describeDebugInfoFrame(
  name: string,
  env: ?string,
  location: ?Error,
): string {
  if (location != null) {
    // If we have a location, it's the child's owner stack. Treat the bottom most frame as
    // the location of this function.
    const childStack = formatOwnerStack(location);
    const idx = childStack.lastIndexOf('\n');
    const lastLine = idx === -1 ? childStack : childStack.slice(idx + 1);
    if (lastLine.indexOf(name) !== -1) {
      // For async stacks it's possible we don't have the owner on it. As a precaution only
      // use this frame if it has the name of the function in it.
      return '\n' + lastLine;
    }
  }

// ... (249 more lines)

Domain

Subdomains

Dependencies

Frequently Asked Questions

What does ReactComponentStackFrame.js do?
ReactComponentStackFrame.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Entrypoint subdomain.
What functions are defined in ReactComponentStackFrame.js?
ReactComponentStackFrame.js defines 5 function(s): describeBuiltInComponentFrame, describeClassComponentFrame, describeDebugInfoFrame, describeFunctionComponentFrame, describeNativeComponentFrame.
What does ReactComponentStackFrame.js depend on?
ReactComponentStackFrame.js imports 5 module(s): ConsolePatchingDev, DefaultPrepareStackTrace, ReactOwnerStackFrames.js, ReactSharedInternals, formatOwnerStack.
Where is ReactComponentStackFrame.js in the architecture?
ReactComponentStackFrame.js is located at packages/shared/ReactComponentStackFrame.js (domain: BabelCompiler, subdomain: Entrypoint, directory: packages/shared).

Analyze Your Own Codebase

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

Try Supermodel Free