Home / Function/ runReactCompiler() — react Function Reference

runReactCompiler() — react Function Reference

Architecture documentation for the runReactCompiler() function in RunReactCompiler.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  a175348c_963a_8fa3_863b_f233ca6a33b6["runReactCompiler()"]
  0e801e17_9dc9_7a83_ce0f_d28b56e090f5["RunReactCompiler.ts"]
  a175348c_963a_8fa3_863b_f233ca6a33b6 -->|defined in| 0e801e17_9dc9_7a83_ce0f_d28b56e090f5
  8306012b_adca_1994_63fd_18327ea13f3a["getReactCompilerResult()"]
  8306012b_adca_1994_63fd_18327ea13f3a -->|calls| a175348c_963a_8fa3_863b_f233ca6a33b6
  0007f882_7308_290b_3dd1_9555b9f99d4f["get()"]
  a175348c_963a_8fa3_863b_f233ca6a33b6 -->|calls| 0007f882_7308_290b_3dd1_9555b9f99d4f
  09651b5c_6fe0_bfb1_3cb6_67768201b6de["mayContainReactCode()"]
  a175348c_963a_8fa3_863b_f233ca6a33b6 -->|calls| 09651b5c_6fe0_bfb1_3cb6_67768201b6de
  14b7faa8_3b52_8cd7_c4d1_996ed950dc7f["push()"]
  a175348c_963a_8fa3_863b_f233ca6a33b6 -->|calls| 14b7faa8_3b52_8cd7_c4d1_996ed950dc7f
  a65ef042_f6cf_f635_9ce4_aa7d8d0ecb18["runReactCompilerImpl()"]
  a175348c_963a_8fa3_863b_f233ca6a33b6 -->|calls| a65ef042_f6cf_f635_9ce4_aa7d8d0ecb18
  style a175348c_963a_8fa3_863b_f233ca6a33b6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/eslint-plugin-react-hooks/src/shared/RunReactCompiler.ts lines 302–346

export default function runReactCompiler({
  sourceCode,
  filename,
  userOpts,
}: RunParams): RunCacheEntry {
  const entry = cache.get(filename);
  if (
    entry != null &&
    entry.sourceCode === sourceCode.text &&
    isDeepStrictEqual(entry.userOpts, userOpts)
  ) {
    return entry;
  }

  // Quick heuristic: skip files that don't appear to contain React code.
  // We still cache the empty result so subsequent rules don't re-run the check.
  if (!mayContainReactCode(sourceCode)) {
    const emptyResult: RunCacheEntry = {
      sourceCode: sourceCode.text,
      filename,
      userOpts,
      flowSuppressions: [],
      events: [],
    };
    if (entry != null) {
      Object.assign(entry, emptyResult);
    } else {
      cache.push(filename, emptyResult);
    }
    return {...emptyResult};
  }

  const runEntry = runReactCompilerImpl({
    sourceCode,
    filename,
    userOpts,
  });
  // If we have a cache entry, we can update it
  if (entry != null) {
    Object.assign(entry, runEntry);
  } else {
    cache.push(filename, runEntry);
  }
  return {...runEntry};
}

Domain

Subdomains

Frequently Asked Questions

What does runReactCompiler() do?
runReactCompiler() is a function in the react codebase, defined in packages/eslint-plugin-react-hooks/src/shared/RunReactCompiler.ts.
Where is runReactCompiler() defined?
runReactCompiler() is defined in packages/eslint-plugin-react-hooks/src/shared/RunReactCompiler.ts at line 302.
What does runReactCompiler() call?
runReactCompiler() calls 4 function(s): get, mayContainReactCode, push, runReactCompilerImpl.
What calls runReactCompiler()?
runReactCompiler() is called by 1 function(s): getReactCompilerResult.

Analyze Your Own Codebase

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

Try Supermodel Free