Home / File/ RunReactCompiler.ts — react Source File

RunReactCompiler.ts — react Source File

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

File typescript BabelCompiler Validation 8 imports 1 dependents 3 functions 1 classes

Entity Profile

Dependency Diagram

graph LR
  93161a4a_8836_f386_2264_41352eee2303["RunReactCompiler.ts"]
  102f7d62_f771_0080_dd43_d867f5a8bd55["core"]
  93161a4a_8836_f386_2264_41352eee2303 --> 102f7d62_f771_0080_dd43_d867f5a8bd55
  ba38a3cc_fa9d_cd5d_0746_ec93bcb397e1["parser"]
  93161a4a_8836_f386_2264_41352eee2303 --> ba38a3cc_fa9d_cd5d_0746_ec93bcb397e1
  52e3d8d7_abf4_7343_1f98_3f701ec04082["types"]
  93161a4a_8836_f386_2264_41352eee2303 --> 52e3d8d7_abf4_7343_1f98_3f701ec04082
  6532b592_e173_3956_4bd1_d55d91adeefe["src"]
  93161a4a_8836_f386_2264_41352eee2303 --> 6532b592_e173_3956_4bd1_d55d91adeefe
  3d96d43f_3b5e_656b_d955_c4fbf4f8a2d6["Entrypoint"]
  93161a4a_8836_f386_2264_41352eee2303 --> 3d96d43f_3b5e_656b_d955_c4fbf4f8a2d6
  e023ae51_0bf7_c8b1_0545_8e7304e4bb72["eslint"]
  93161a4a_8836_f386_2264_41352eee2303 --> e023ae51_0bf7_c8b1_0545_8e7304e4bb72
  78f0dea0_5a25_0652_2a88_959a2ce71a1f["hermes-parser"]
  93161a4a_8836_f386_2264_41352eee2303 --> 78f0dea0_5a25_0652_2a88_959a2ce71a1f
  e38503ff_90ab_2fd6_8dbb_f5a5a0bd5a1b["util"]
  93161a4a_8836_f386_2264_41352eee2303 --> e38503ff_90ab_2fd6_8dbb_f5a5a0bd5a1b
  cc8eb92a_b0c5_c461_8a5e_7435585bbc6e["ReactCompilerRule.ts"]
  cc8eb92a_b0c5_c461_8a5e_7435585bbc6e --> 93161a4a_8836_f386_2264_41352eee2303
  style 93161a4a_8836_f386_2264_41352eee2303 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 {transformFromAstSync} from '@babel/core';
import {parse as babelParse} from '@babel/parser';
import {File} from '@babel/types';
import BabelPluginReactCompiler, {
  parsePluginOptions,
  validateEnvironmentConfig,
  type PluginOptions,
} from 'babel-plugin-react-compiler/src';
import {Logger, LoggerEvent} from 'babel-plugin-react-compiler/src/Entrypoint';
import type {SourceCode} from 'eslint';
// @ts-expect-error: no types available
import * as HermesParser from 'hermes-parser';
import {isDeepStrictEqual} from 'util';
import type {ParseResult} from '@babel/parser';

const COMPILER_OPTIONS: PluginOptions = {
  outputMode: 'lint',
  panicThreshold: 'none',
  // Don't emit errors on Flow suppressions--Flow already gave a signal
  flowSuppressions: false,
  environment: validateEnvironmentConfig({
    validateRefAccessDuringRender: true,
    validateNoSetStateInRender: true,
    validateNoSetStateInEffects: true,
    validateNoJSXInTryStatements: true,
    validateNoImpureFunctionsInRender: true,
    validateStaticComponents: true,
    validateNoFreezingKnownMutableFunctions: true,
    validateNoVoidUseMemo: true,
    // TODO: remove, this should be in the type system
    validateNoCapitalizedCalls: [],
    validateHooksUsage: true,
    validateNoDerivedComputationsInEffects: true,
  }),
};

export type RunCacheEntry = {
  sourceCode: string;
  filename: string;
  userOpts: PluginOptions;
  flowSuppressions: Array<{line: number; code: string}>;
  events: Array<LoggerEvent>;
};

type RunParams = {
  sourceCode: SourceCode;
  filename: string;
  userOpts: PluginOptions;
};
const FLOW_SUPPRESSION_REGEX = /\$FlowFixMe\[([^\]]*)\]/g;

function getFlowSuppressions(
  sourceCode: SourceCode,
// ... (172 more lines)

Domain

Subdomains

Classes

Dependencies

  • Entrypoint
  • core
  • eslint
  • hermes-parser
  • parser
  • src
  • types
  • util

Frequently Asked Questions

What does RunReactCompiler.ts do?
RunReactCompiler.ts is a source file in the react codebase, written in typescript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in RunReactCompiler.ts?
RunReactCompiler.ts defines 3 function(s): getFlowSuppressions, runReactCompiler, runReactCompilerImpl.
What does RunReactCompiler.ts depend on?
RunReactCompiler.ts imports 8 module(s): Entrypoint, core, eslint, hermes-parser, parser, src, types, util.
What files import RunReactCompiler.ts?
RunReactCompiler.ts is imported by 1 file(s): ReactCompilerRule.ts.
Where is RunReactCompiler.ts in the architecture?
RunReactCompiler.ts is located at compiler/packages/eslint-plugin-react-compiler/src/shared/RunReactCompiler.ts (domain: BabelCompiler, subdomain: Validation, directory: compiler/packages/eslint-plugin-react-compiler/src/shared).

Analyze Your Own Codebase

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

Try Supermodel Free