Home / File/ PruneAllReactiveScopes.ts — react Source File

PruneAllReactiveScopes.ts — react Source File

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

File typescript BabelCompiler Validation 8 imports 1 functions 1 classes

Entity Profile

Dependency Diagram

graph LR
  745af7cc_abf6_a69f_776c_e9dacf9bcfc0["PruneAllReactiveScopes.ts"]
  18a78965_f593_105b_e5e8_07001321c2ec["HIR.ts"]
  745af7cc_abf6_a69f_776c_e9dacf9bcfc0 --> 18a78965_f593_105b_e5e8_07001321c2ec
  c0555545_1ea3_9d37_62ad_521eafe2daa8["ReactiveFunction"]
  745af7cc_abf6_a69f_776c_e9dacf9bcfc0 --> c0555545_1ea3_9d37_62ad_521eafe2daa8
  0fba6722_c385_0076_d75b_47ee3ff87ee3["ReactiveScopeBlock"]
  745af7cc_abf6_a69f_776c_e9dacf9bcfc0 --> 0fba6722_c385_0076_d75b_47ee3ff87ee3
  d2571adf_c2aa_1e5e_5c56_f26810a3829e["ReactiveStatement"]
  745af7cc_abf6_a69f_776c_e9dacf9bcfc0 --> d2571adf_c2aa_1e5e_5c56_f26810a3829e
  21609915_b03a_fd75_b58a_4cb86ef9315b["visitors.ts"]
  745af7cc_abf6_a69f_776c_e9dacf9bcfc0 --> 21609915_b03a_fd75_b58a_4cb86ef9315b
  af3ace55_db6d_865e_92b9_81486f6af1e7["ReactiveFunctionTransform"]
  745af7cc_abf6_a69f_776c_e9dacf9bcfc0 --> af3ace55_db6d_865e_92b9_81486f6af1e7
  da7ad665_d709_433d_facd_dc3b2c4d34f5["Transformed"]
  745af7cc_abf6_a69f_776c_e9dacf9bcfc0 --> da7ad665_d709_433d_facd_dc3b2c4d34f5
  2435b5f8_41a6_0458_ba88_4479b965455f["visitReactiveFunction"]
  745af7cc_abf6_a69f_776c_e9dacf9bcfc0 --> 2435b5f8_41a6_0458_ba88_4479b965455f
  style 745af7cc_abf6_a69f_776c_e9dacf9bcfc0 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 {
  ReactiveFunction,
  ReactiveScopeBlock,
  ReactiveStatement,
} from '../HIR/HIR';
import {
  ReactiveFunctionTransform,
  Transformed,
  visitReactiveFunction,
} from './visitors';

/*
 * Removes *all* reactive scopes. Intended for experimentation only, to allow
 * accurately removing memoization using the compiler pipeline to get a baseline
 * for performance of a product without memoization applied.
 */
export function pruneAllReactiveScopes(fn: ReactiveFunction): void {
  visitReactiveFunction(fn, new Transform(), undefined);
}

class Transform extends ReactiveFunctionTransform<void> {
  override transformScope(
    scopeBlock: ReactiveScopeBlock,
    state: void,
  ): Transformed<ReactiveStatement> {
    this.visitScope(scopeBlock, state);
    return {kind: 'replace-many', value: scopeBlock.instructions};
  }
}

Domain

Subdomains

Classes

Frequently Asked Questions

What does PruneAllReactiveScopes.ts do?
PruneAllReactiveScopes.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 PruneAllReactiveScopes.ts?
PruneAllReactiveScopes.ts defines 1 function(s): pruneAllReactiveScopes.
What does PruneAllReactiveScopes.ts depend on?
PruneAllReactiveScopes.ts imports 8 module(s): HIR.ts, ReactiveFunction, ReactiveFunctionTransform, ReactiveScopeBlock, ReactiveStatement, Transformed, visitReactiveFunction, visitors.ts.
Where is PruneAllReactiveScopes.ts in the architecture?
PruneAllReactiveScopes.ts is located at compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/PruneAllReactiveScopes.ts (domain: BabelCompiler, subdomain: Validation, directory: compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes).

Analyze Your Own Codebase

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

Try Supermodel Free