Home / Function/ annotate() — react Function Reference

annotate() — react Function Reference

Architecture documentation for the annotate() function in babel-plugin-annotate-react-code.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  5269e169_1dd4_8259_43a8_57511e747ea4["annotate()"]
  90fd4a4d_9742_70a7_9512_f9dd5b565200["babel-plugin-annotate-react-code.ts"]
  5269e169_1dd4_8259_43a8_57511e747ea4 -->|defined in| 90fd4a4d_9742_70a7_9512_f9dd5b565200
  1e625f57_3f99_7494_f708_4360b08cce7e["AnnotateReactCodeBabelPlugin()"]
  1e625f57_3f99_7494_f708_4360b08cce7e -->|calls| 5269e169_1dd4_8259_43a8_57511e747ea4
  885dabed_4ea6_4b50_13ff_6ab9e94c743c["shouldVisit()"]
  5269e169_1dd4_8259_43a8_57511e747ea4 -->|calls| 885dabed_4ea6_4b50_13ff_6ab9e94c743c
  1323d328_ed55_02a1_0f5a_0d3ab078df8e["buildTypeOfReactForget()"]
  5269e169_1dd4_8259_43a8_57511e747ea4 -->|calls| 1323d328_ed55_02a1_0f5a_0d3ab078df8e
  style 5269e169_1dd4_8259_43a8_57511e747ea4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/scripts/babel-plugin-annotate-react-code.ts lines 25–44

function annotate(program: NodePath<t.Program>): void {
  function traverseFn(fn: BabelFn): void {
    if (!shouldVisit(fn)) {
      return;
    }

    fn.skip();

    const body = fn.node.body;
    if (t.isBlockStatement(body)) {
      body.body.unshift(buildTypeOfReactForget());
    }
  }

  program.traverse({
    FunctionDeclaration: traverseFn,
    FunctionExpression: traverseFn,
    ArrowFunctionExpression: traverseFn,
  });
}

Subdomains

Frequently Asked Questions

What does annotate() do?
annotate() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/scripts/babel-plugin-annotate-react-code.ts.
Where is annotate() defined?
annotate() is defined in compiler/packages/babel-plugin-react-compiler/scripts/babel-plugin-annotate-react-code.ts at line 25.
What does annotate() call?
annotate() calls 2 function(s): buildTypeOfReactForget, shouldVisit.
What calls annotate()?
annotate() is called by 1 function(s): AnnotateReactCodeBabelPlugin.

Analyze Your Own Codebase

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

Try Supermodel Free