parseStackTrace.js — react Source File
Architecture documentation for parseStackTrace.js, a javascript file in the react codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR c70671e1_42cb_8c92_da33_5303a72f89b1["parseStackTrace.js"] d8f20c67_f5fa_0f0a_c967_c41fd9ffce07["ReactTypes"] c70671e1_42cb_8c92_da33_5303a72f89b1 --> d8f20c67_f5fa_0f0a_c967_c41fd9ffce07 style c70671e1_42cb_8c92_da33_5303a72f89b1 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 type {ReactStackTrace, ReactFunctionLocation} from 'shared/ReactTypes';
function parseStackTraceFromChromeStack(
stack: string,
skipFrames: number,
): ReactStackTrace {
if (stack.startsWith('Error: react-stack-top-frame\n')) {
// V8's default formatting prefixes with the error message which we
// don't want/need.
stack = stack.slice(29);
}
let idx = stack.indexOf('react_stack_bottom_frame');
if (idx === -1) {
idx = stack.indexOf('react-stack-bottom-frame');
}
if (idx !== -1) {
idx = stack.lastIndexOf('\n', idx);
}
if (idx !== -1) {
// Cut off everything after the bottom frame since it'll be internals.
stack = stack.slice(0, idx);
}
const frames = stack.split('\n');
const parsedFrames: ReactStackTrace = [];
// We skip top frames here since they may or may not be parseable but we
// want to skip the same number of frames regardless. I.e. we can't do it
// in the caller.
for (let i = skipFrames; i < frames.length; i++) {
const parsed = chromeFrameRegExp.exec(frames[i]);
if (!parsed) {
continue;
}
let name = parsed[1] || '';
let isAsync = parsed[8] === 'async ';
if (name === '<anonymous>') {
name = '';
} else if (name.startsWith('async ')) {
name = name.slice(5);
isAsync = true;
}
let filename = parsed[2] || parsed[5] || '';
if (filename === '<anonymous>') {
filename = '';
}
const line = +(parsed[3] || parsed[6] || 0);
const col = +(parsed[4] || parsed[7] || 0);
parsedFrames.push([name, filename, line, col, 0, 0, isAsync]);
}
return parsedFrames;
}
// ... (307 more lines)
Domain
Subdomains
Functions
Dependencies
- ReactTypes
Source
Frequently Asked Questions
What does parseStackTrace.js do?
parseStackTrace.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 parseStackTrace.js?
parseStackTrace.js defines 8 function(s): collectStackTrace, extractLocationFromComponentStack, extractLocationFromOwnerStack, getMethodCallName, parseStackTrace, parseStackTraceFromChromeStack, parseStackTraceFromFirefoxStack, parseStackTraceFromString.
What does parseStackTrace.js depend on?
parseStackTrace.js imports 1 module(s): ReactTypes.
Where is parseStackTrace.js in the architecture?
parseStackTrace.js is located at packages/react-devtools-shared/src/backend/utils/parseStackTrace.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-shared/src/backend/utils).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free