Home / File/ OutlineJsx.ts — react Source File

OutlineJsx.ts — react Source File

Architecture documentation for OutlineJsx.ts, a typescript file in the react codebase. 27 imports, 1 dependents.

File typescript BabelCompiler Optimization 27 imports 1 dependents 10 functions

Entity Profile

Dependency Diagram

graph LR
  158befb1_050c_87d2_b4ec_54305bac5a4f["OutlineJsx.ts"]
  0423f759_97e0_9101_4634_ed555abc5ca9["index.ts"]
  158befb1_050c_87d2_b4ec_54305bac5a4f --> 0423f759_97e0_9101_4634_ed555abc5ca9
  18a78965_f593_105b_e5e8_07001321c2ec["HIR.ts"]
  158befb1_050c_87d2_b4ec_54305bac5a4f --> 18a78965_f593_105b_e5e8_07001321c2ec
  5b3acd48_6f52_d332_a26f_b7cb0f74b86e["BasicBlock"]
  158befb1_050c_87d2_b4ec_54305bac5a4f --> 5b3acd48_6f52_d332_a26f_b7cb0f74b86e
  9241c5c1_a9a7_17bc_e41c_e967225008dd["HIRFunction"]
  158befb1_050c_87d2_b4ec_54305bac5a4f --> 9241c5c1_a9a7_17bc_e41c_e967225008dd
  e3a6ca26_1f1a_c7f8_fbf3_804737192775["IdentifierId"]
  158befb1_050c_87d2_b4ec_54305bac5a4f --> e3a6ca26_1f1a_c7f8_fbf3_804737192775
  02d16d8e_0a17_fa6f_eeef_ee0c7d25bd36["Instruction"]
  158befb1_050c_87d2_b4ec_54305bac5a4f --> 02d16d8e_0a17_fa6f_eeef_ee0c7d25bd36
  23767d65_9554_fcd2_f2aa_7de7634389f9["InstructionId"]
  158befb1_050c_87d2_b4ec_54305bac5a4f --> 23767d65_9554_fcd2_f2aa_7de7634389f9
  03aa18e2_bd2c_e9cb_5973_bae3ec02373c["InstructionKind"]
  158befb1_050c_87d2_b4ec_54305bac5a4f --> 03aa18e2_bd2c_e9cb_5973_bae3ec02373c
  026bcf93_6461_49ba_fdb3_665900604415["JsxAttribute"]
  158befb1_050c_87d2_b4ec_54305bac5a4f --> 026bcf93_6461_49ba_fdb3_665900604415
  62b6648e_619f_15f3_d971_91f28077ca4d["JsxExpression"]
  158befb1_050c_87d2_b4ec_54305bac5a4f --> 62b6648e_619f_15f3_d971_91f28077ca4d
  00df2033_3822_12dc_2916_203a62ec7365["LoadGlobal"]
  158befb1_050c_87d2_b4ec_54305bac5a4f --> 00df2033_3822_12dc_2916_203a62ec7365
  11080cce_bbf7_2d34_25af_532ed4173235["makeBlockId"]
  158befb1_050c_87d2_b4ec_54305bac5a4f --> 11080cce_bbf7_2d34_25af_532ed4173235
  dcb26d23_8970_206b_e5d8_91b588c501b5["makeIdentifierName"]
  158befb1_050c_87d2_b4ec_54305bac5a4f --> dcb26d23_8970_206b_e5d8_91b588c501b5
  d0270ab6_a621_bd55_a1b9_a5cad8b406b2["makeInstructionId"]
  158befb1_050c_87d2_b4ec_54305bac5a4f --> d0270ab6_a621_bd55_a1b9_a5cad8b406b2
  style 158befb1_050c_87d2_b4ec_54305bac5a4f 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.
 */

import invariant from 'invariant';
import {Environment} from '../HIR';
import {
  BasicBlock,
  GeneratedSource,
  HIRFunction,
  IdentifierId,
  Instruction,
  InstructionId,
  InstructionKind,
  JsxAttribute,
  JsxExpression,
  LoadGlobal,
  makeBlockId,
  makeIdentifierName,
  makeInstructionId,
  ObjectProperty,
  Place,
  promoteTemporary,
  promoteTemporaryJsxTag,
} from '../HIR/HIR';
import {createTemporaryPlace} from '../HIR/HIRBuilder';
import {printIdentifier} from '../HIR/PrintHIR';
import {deadCodeElimination} from './DeadCodeElimination';
import {assertExhaustive} from '../Utils/utils';

export function outlineJSX(fn: HIRFunction): void {
  const outlinedFns: Array<HIRFunction> = [];
  outlineJsxImpl(fn, outlinedFns);

  for (const outlinedFn of outlinedFns) {
    fn.env.outlineFunction(outlinedFn, 'Component');
  }
}

type JsxInstruction = Instruction & {value: JsxExpression};
type LoadGlobalInstruction = Instruction & {value: LoadGlobal};
type LoadGlobalMap = Map<IdentifierId, LoadGlobalInstruction>;

type State = {
  jsx: Array<JsxInstruction>;
  children: Set<IdentifierId>;
};

function outlineJsxImpl(
  fn: HIRFunction,
  outlinedFns: Array<HIRFunction>,
): void {
  const globals: LoadGlobalMap = new Map();

  function processAndOutlineJSX(
    state: State,
    rewriteInstr: Map<InstructionId, Array<Instruction>>,
// ... (469 more lines)

Domain

Subdomains

Frequently Asked Questions

What does OutlineJsx.ts do?
OutlineJsx.ts is a source file in the react codebase, written in typescript. It belongs to the BabelCompiler domain, Optimization subdomain.
What functions are defined in OutlineJsx.ts?
OutlineJsx.ts defines 10 function(s): collectProps, createOldToNewPropsMapping, emitDestructureProps, emitLoadGlobals, emitOutlinedFn, emitOutlinedJsx, emitUpdatedJsx, outlineJSX, outlineJsxImpl, process.
What does OutlineJsx.ts depend on?
OutlineJsx.ts imports 27 module(s): BasicBlock, DeadCodeElimination.ts, HIR.ts, HIRBuilder.ts, HIRFunction, IdentifierId, Instruction, InstructionId, and 19 more.
What files import OutlineJsx.ts?
OutlineJsx.ts is imported by 1 file(s): Pipeline.ts.
Where is OutlineJsx.ts in the architecture?
OutlineJsx.ts is located at compiler/packages/babel-plugin-react-compiler/src/Optimization/OutlineJsx.ts (domain: BabelCompiler, subdomain: Optimization, directory: compiler/packages/babel-plugin-react-compiler/src/Optimization).

Analyze Your Own Codebase

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

Try Supermodel Free