Home / Function/ shouldSkipCompilation() — react Function Reference

shouldSkipCompilation() — react Function Reference

Architecture documentation for the shouldSkipCompilation() function in Program.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  9e49688f_6b43_84fe_0dd2_18e5142c1f71["shouldSkipCompilation()"]
  9aa4477d_960b_1ea1_b6d9_36076aaa70bd["Program.ts"]
  9e49688f_6b43_84fe_0dd2_18e5142c1f71 -->|defined in| 9aa4477d_960b_1ea1_b6d9_36076aaa70bd
  1c9af54b_10e9_8985_e772_1f517e46c560["compileProgram()"]
  1c9af54b_10e9_8985_e772_1f517e46c560 -->|calls| 9e49688f_6b43_84fe_0dd2_18e5142c1f71
  825ba705_282a_7031_34fa_49b26f1c9bed["pushErrorDetail()"]
  9e49688f_6b43_84fe_0dd2_18e5142c1f71 -->|calls| 825ba705_282a_7031_34fa_49b26f1c9bed
  4f591349_3d90_e4e5_51a6_a3b7ad077584["handleError()"]
  9e49688f_6b43_84fe_0dd2_18e5142c1f71 -->|calls| 4f591349_3d90_e4e5_51a6_a3b7ad077584
  586eb021_f5b7_f117_c3a5_c4b46ba97b61["isFilePartOfSources()"]
  9e49688f_6b43_84fe_0dd2_18e5142c1f71 -->|calls| 586eb021_f5b7_f117_c3a5_c4b46ba97b61
  36291a8f_e44c_5f09_4a36_e0708d0af350["hasMemoCacheFunctionImport()"]
  9e49688f_6b43_84fe_0dd2_18e5142c1f71 -->|calls| 36291a8f_e44c_5f09_4a36_e0708d0af350
  78d6080e_8c56_4f2c_6894_efdb15a87a5c["getReactCompilerRuntimeModule()"]
  9e49688f_6b43_84fe_0dd2_18e5142c1f71 -->|calls| 78d6080e_8c56_4f2c_6894_efdb15a87a5c
  style 9e49688f_6b43_84fe_0dd2_18e5142c1f71 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Program.ts lines 843–877

function shouldSkipCompilation(
  program: NodePath<t.Program>,
  pass: CompilerPass,
): boolean {
  if (pass.opts.sources) {
    if (pass.filename === null) {
      const error = new CompilerError();
      error.pushErrorDetail(
        new CompilerErrorDetail({
          reason: `Expected a filename but found none.`,
          description:
            "When the 'sources' config options is specified, the React compiler will only compile files with a name",
          category: ErrorCategory.Config,
          loc: null,
        }),
      );
      handleError(error, pass, null);
      return true;
    }

    if (!isFilePartOfSources(pass.opts.sources, pass.filename)) {
      return true;
    }
  }

  if (
    hasMemoCacheFunctionImport(
      program,
      getReactCompilerRuntimeModule(pass.opts.target),
    )
  ) {
    return true;
  }
  return false;
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does shouldSkipCompilation() do?
shouldSkipCompilation() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Program.ts.
Where is shouldSkipCompilation() defined?
shouldSkipCompilation() is defined in compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Program.ts at line 843.
What does shouldSkipCompilation() call?
shouldSkipCompilation() calls 5 function(s): getReactCompilerRuntimeModule, handleError, hasMemoCacheFunctionImport, isFilePartOfSources, pushErrorDetail.
What calls shouldSkipCompilation()?
shouldSkipCompilation() is called by 1 function(s): compileProgram.

Analyze Your Own Codebase

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

Try Supermodel Free