Home / File/ compat.ts — react Source File

compat.ts — react Source File

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

File typescript BabelCompiler Validation 2 imports 1 dependents 2 functions

Entity Profile

Dependency Diagram

graph LR
  ec0eb7b0_81a8_ca23_bcdc_96f2fc710cb4["compat.ts"]
  33e3aca7_66ee_ce27_72ad_b6d7fb17e06c["babel-plugin-react-compiler"]
  ec0eb7b0_81a8_ca23_bcdc_96f2fc710cb4 --> 33e3aca7_66ee_ce27_72ad_b6d7fb17e06c
  8c147e19_34ad_2329_ddb4_ba2347346658["vscode-languageserver"]
  ec0eb7b0_81a8_ca23_bcdc_96f2fc710cb4 --> 8c147e19_34ad_2329_ddb4_ba2347346658
  45729896_cc85_f8cb_a3e3_efc08e3b01a6["index.ts"]
  45729896_cc85_f8cb_a3e3_efc08e3b01a6 --> ec0eb7b0_81a8_ca23_bcdc_96f2fc710cb4
  style ec0eb7b0_81a8_ca23_bcdc_96f2fc710cb4 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 {type SourceLocation} from 'babel-plugin-react-compiler';
import {type Range} from 'vscode-languageserver';

export function babelLocationToRange(loc: SourceLocation): Range | null {
  if (typeof loc === 'symbol') {
    return null;
  }
  return {
    start: {line: loc.start.line - 1, character: loc.start.column},
    end: {line: loc.end.line - 1, character: loc.end.column},
  };
}

/**
 * Refine range to only the first character.
 */
export function getRangeFirstCharacter(range: Range): Range {
  return {
    start: range.start,
    end: range.start,
  };
}

Domain

Subdomains

Dependencies

  • babel-plugin-react-compiler
  • vscode-languageserver

Frequently Asked Questions

What does compat.ts do?
compat.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 compat.ts?
compat.ts defines 2 function(s): babelLocationToRange, getRangeFirstCharacter.
What does compat.ts depend on?
compat.ts imports 2 module(s): babel-plugin-react-compiler, vscode-languageserver.
What files import compat.ts?
compat.ts is imported by 1 file(s): index.ts.
Where is compat.ts in the architecture?
compat.ts is located at compiler/packages/react-forgive/server/src/compiler/compat.ts (domain: BabelCompiler, subdomain: Validation, directory: compiler/packages/react-forgive/server/src/compiler).

Analyze Your Own Codebase

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

Try Supermodel Free