Home / File/ ValidateNoUntransformedReferences.ts — react Source File

ValidateNoUntransformedReferences.ts — react Source File

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

File typescript BabelCompiler Validation 13 imports 1 dependents 10 functions

Entity Profile

Dependency Diagram

graph LR
  93f3a2c7_a7ce_3c94_87fe_ee7d66d9b64b["ValidateNoUntransformedReferences.ts"]
  eb9d33f9_42c1_205c_93e6_8e1365a31839["utils.ts"]
  93f3a2c7_a7ce_3c94_87fe_ee7d66d9b64b --> eb9d33f9_42c1_205c_93e6_8e1365a31839
  4663af75_e270_25e3_3415_1230be609d66["getOrInsertWith"]
  93f3a2c7_a7ce_3c94_87fe_ee7d66d9b64b --> 4663af75_e270_25e3_3415_1230be609d66
  0423f759_97e0_9101_4634_ed555abc5ca9["index.ts"]
  93f3a2c7_a7ce_3c94_87fe_ee7d66d9b64b --> 0423f759_97e0_9101_4634_ed555abc5ca9
  1b971013_8a90_0d8d_1fcc_f31581cd66aa["Environment.ts"]
  93f3a2c7_a7ce_3c94_87fe_ee7d66d9b64b --> 1b971013_8a90_0d8d_1fcc_f31581cd66aa
  9aa4477d_960b_1ea1_b6d9_36076aaa70bd["Program.ts"]
  93f3a2c7_a7ce_3c94_87fe_ee7d66d9b64b --> 9aa4477d_960b_1ea1_b6d9_36076aaa70bd
  8c2daf87_35aa_62e2_8c08_641a5ca7d116["CompileProgramMetadata"]
  93f3a2c7_a7ce_3c94_87fe_ee7d66d9b64b --> 8c2daf87_35aa_62e2_8c08_641a5ca7d116
  e96f281e_f381_272d_2359_3e6a091c9a1d["CompilerError.ts"]
  93f3a2c7_a7ce_3c94_87fe_ee7d66d9b64b --> e96f281e_f381_272d_2359_3e6a091c9a1d
  0fda7f86_b7a3_c1f2_f0d9_8d13eed4f042["CompilerDiagnostic"]
  93f3a2c7_a7ce_3c94_87fe_ee7d66d9b64b --> 0fda7f86_b7a3_c1f2_f0d9_8d13eed4f042
  82189fb8_5dd3_f6ad_c455_ff76612a23bd["CompilerDiagnosticOptions"]
  93f3a2c7_a7ce_3c94_87fe_ee7d66d9b64b --> 82189fb8_5dd3_f6ad_c455_ff76612a23bd
  a2b91621_58d3_1d04_4663_00cd808f1034["ErrorCategory"]
  93f3a2c7_a7ce_3c94_87fe_ee7d66d9b64b --> a2b91621_58d3_1d04_4663_00cd808f1034
  102f7d62_f771_0080_dd43_d867f5a8bd55["core"]
  93f3a2c7_a7ce_3c94_87fe_ee7d66d9b64b --> 102f7d62_f771_0080_dd43_d867f5a8bd55
  52e3d8d7_abf4_7343_1f98_3f701ec04082["types"]
  93f3a2c7_a7ce_3c94_87fe_ee7d66d9b64b --> 52e3d8d7_abf4_7343_1f98_3f701ec04082
  2ed45bcd_6c82_3ccd_0e20_fa96b5111055[".."]
  93f3a2c7_a7ce_3c94_87fe_ee7d66d9b64b --> 2ed45bcd_6c82_3ccd_0e20_fa96b5111055
  f3b73a1d_8eeb_a8b2_a886_c8b8c2f58490["BabelPlugin.ts"]
  f3b73a1d_8eeb_a8b2_a886_c8b8c2f58490 --> 93f3a2c7_a7ce_3c94_87fe_ee7d66d9b64b
  style 93f3a2c7_a7ce_3c94_87fe_ee7d66d9b64b 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 {NodePath} from '@babel/core';
import * as t from '@babel/types';

import {CompilerError, EnvironmentConfig, Logger} from '..';
import {getOrInsertWith} from '../Utils/utils';
import {Environment, GeneratedSource} from '../HIR';
import {DEFAULT_EXPORT} from '../HIR/Environment';
import {CompileProgramMetadata} from './Program';
import {
  CompilerDiagnostic,
  CompilerDiagnosticOptions,
  ErrorCategory,
} from '../CompilerError';

function throwInvalidReact(
  options: CompilerDiagnosticOptions,
  {logger, filename}: TraversalState,
): never {
  logger?.logEvent(filename, {
    kind: 'CompileError',
    fnLoc: null,
    detail: new CompilerDiagnostic(options),
  });
  CompilerError.throwDiagnostic(options);
}

function isAutodepsSigil(
  arg: NodePath<t.ArgumentPlaceholder | t.SpreadElement | t.Expression>,
): boolean {
  // Check for AUTODEPS identifier imported from React
  if (arg.isIdentifier() && arg.node.name === 'AUTODEPS') {
    const binding = arg.scope.getBinding(arg.node.name);
    if (binding && binding.path.isImportSpecifier()) {
      const importSpecifier = binding.path.node as t.ImportSpecifier;
      if (importSpecifier.imported.type === 'Identifier') {
        return (importSpecifier.imported as t.Identifier).name === 'AUTODEPS';
      }
    }
    return false;
  }

  // Check for React.AUTODEPS member expression
  if (arg.isMemberExpression() && !arg.node.computed) {
    const object = arg.get('object');
    const property = arg.get('property');

    if (
      object.isIdentifier() &&
      object.node.name === 'React' &&
      property.isIdentifier() &&
      property.node.name === 'AUTODEPS'
    ) {
      return true;
// ... (268 more lines)

Domain

Subdomains

Frequently Asked Questions

What does ValidateNoUntransformedReferences.ts do?
ValidateNoUntransformedReferences.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 ValidateNoUntransformedReferences.ts?
ValidateNoUntransformedReferences.ts defines 10 function(s): assertValidEffectImportReference, assertValidFireImportReference, isAutodepsSigil, matchCompilerDiagnostic, paths, throwInvalidReact, transformProgram, validateImportSpecifier, validateNamespacedImport, validateNoUntransformedReferences.
What does ValidateNoUntransformedReferences.ts depend on?
ValidateNoUntransformedReferences.ts imports 13 module(s): .., CompileProgramMetadata, CompilerDiagnostic, CompilerDiagnosticOptions, CompilerError.ts, Environment.ts, ErrorCategory, Program.ts, and 5 more.
What files import ValidateNoUntransformedReferences.ts?
ValidateNoUntransformedReferences.ts is imported by 1 file(s): BabelPlugin.ts.
Where is ValidateNoUntransformedReferences.ts in the architecture?
ValidateNoUntransformedReferences.ts is located at compiler/packages/babel-plugin-react-compiler/src/Entrypoint/ValidateNoUntransformedReferences.ts (domain: BabelCompiler, subdomain: Validation, directory: compiler/packages/babel-plugin-react-compiler/src/Entrypoint).

Analyze Your Own Codebase

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

Try Supermodel Free