renderer.js — react Source File
Architecture documentation for renderer.js, a javascript file in the react codebase. 8 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 50ab7512_20ae_29b1_e876_3d07fe8f521c["renderer.js"] 0304bbc8_f110_6643_71c6_d26bddc58fde["types.js"] 50ab7512_20ae_29b1_e876_3d07fe8f521c --> 0304bbc8_f110_6643_71c6_d26bddc58fde aa545f4b_797f_d455_0d48_d21828047895["DevToolsComponentInfoStack.js"] 50ab7512_20ae_29b1_e876_3d07fe8f521c --> aa545f4b_797f_d455_0d48_d21828047895 0d0f5eb3_f682_c269_a97f_22be22717aa0["getOwnerStackByComponentInfoInDev"] 50ab7512_20ae_29b1_e876_3d07fe8f521c --> 0d0f5eb3_f682_c269_a97f_22be22717aa0 ca4a7497_d233_4d3d_e832_e2f96306e9ae["DevToolsOwnerStack.js"] 50ab7512_20ae_29b1_e876_3d07fe8f521c --> ca4a7497_d233_4d3d_e832_e2f96306e9ae a8f4c31f_f504_975a_5ac7_bb83d1cf4164["formatOwnerStack"] 50ab7512_20ae_29b1_e876_3d07fe8f521c --> a8f4c31f_f504_975a_5ac7_bb83d1cf4164 64afd594_47db_a767_1e30_d2aabf1fb1d1["DevToolsServerComponentLogs.js"] 50ab7512_20ae_29b1_e876_3d07fe8f521c --> 64afd594_47db_a767_1e30_d2aabf1fb1d1 d8f20c67_f5fa_0f0a_c967_c41fd9ffce07["ReactTypes"] 50ab7512_20ae_29b1_e876_3d07fe8f521c --> d8f20c67_f5fa_0f0a_c967_c41fd9ffce07 80162ac2_4fc9_259b_04e9_4acc940af136["utils"] 50ab7512_20ae_29b1_e876_3d07fe8f521c --> 80162ac2_4fc9_259b_04e9_4acc940af136 style 50ab7512_20ae_29b1_e876_3d07fe8f521c 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 {ReactComponentInfo} from 'shared/ReactTypes';
import type {DevToolsHook, ReactRenderer, RendererInterface} from '../types';
import {getOwnerStackByComponentInfoInDev} from './DevToolsComponentInfoStack';
import {formatOwnerStack} from '../shared/DevToolsOwnerStack';
import {componentInfoToComponentLogsMap} from '../shared/DevToolsServerComponentLogs';
import {formatConsoleArgumentsToSingleString} from 'react-devtools-shared/src/backend/utils';
function supportsConsoleTasks(componentInfo: ReactComponentInfo): boolean {
// If this ReactComponentInfo supports native console.createTask then we are already running
// inside a native async stack trace if it's active - meaning the DevTools is open.
// Ideally we'd detect if this task was created while the DevTools was open or not.
return !!componentInfo.debugTask;
}
export function attach(
hook: DevToolsHook,
rendererID: number,
renderer: ReactRenderer,
global: Object,
): RendererInterface {
const {getCurrentComponentInfo} = renderer;
function getComponentStack(
topFrame: Error,
): null | {enableOwnerStacks: boolean, componentStack: string} {
if (getCurrentComponentInfo === undefined) {
// Expected this to be part of the renderer. Ignore.
return null;
}
const current = getCurrentComponentInfo();
if (current === null) {
// Outside of our render scope.
return null;
}
if (supportsConsoleTasks(current)) {
// This will be handled natively by console.createTask. No need for
// DevTools to add it.
return null;
}
const enableOwnerStacks = current.debugStack != null;
let componentStack = '';
if (enableOwnerStacks) {
// Prefix the owner stack with the current stack. I.e. what called
// console.error. While this will also be part of the native stack,
// ... (169 more lines)
Domain
Subdomains
Functions
Dependencies
Source
Frequently Asked Questions
What does renderer.js do?
renderer.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 renderer.js?
renderer.js defines 2 function(s): attach, supportsConsoleTasks.
What does renderer.js depend on?
renderer.js imports 8 module(s): DevToolsComponentInfoStack.js, DevToolsOwnerStack.js, DevToolsServerComponentLogs.js, ReactTypes, formatOwnerStack, getOwnerStackByComponentInfoInDev, types.js, utils.
Where is renderer.js in the architecture?
renderer.js is located at packages/react-devtools-shared/src/backend/flight/renderer.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-shared/src/backend/flight).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free