Home / File/ libraryCompat.ts — react Source File

libraryCompat.ts — react Source File

Architecture documentation for libraryCompat.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
  59baec20_252f_875a_e0a2_9e420cfb5db8["libraryCompat.ts"]
  5e9f278e_f7c2_c563_bb1f_013803472d8c["config.ts"]
  59baec20_252f_875a_e0a2_9e420cfb5db8 --> 5e9f278e_f7c2_c563_bb1f_013803472d8c
  178fc52d_e7f8_dce1_75f6_f388c2223069["chalk"]
  59baec20_252f_875a_e0a2_9e420cfb5db8 --> 178fc52d_e7f8_dce1_75f6_f388c2223069
  62c6ef48_b6c1_13e9_0d99_fe0a9fcba79a["index.ts"]
  62c6ef48_b6c1_13e9_0d99_fe0a9fcba79a --> 59baec20_252f_875a_e0a2_9e420cfb5db8
  style 59baec20_252f_875a_e0a2_9e420cfb5db8 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 chalk from 'chalk';
import {config} from '../config';

const packageJsonRE = /package\.json$/;
const knownIncompatibleLibrariesUsage = new Set();

export default {
  run(source: string, path: string): void {
    if (packageJsonRE.exec(path) !== null) {
      const contents = JSON.parse(source);
      const deps = contents.dependencies;
      if (deps != null) {
        for (const library of config.knownIncompatibleLibraries) {
          if (Object.hasOwn(deps, library)) {
            knownIncompatibleLibrariesUsage.add(library);
          }
        }
      }
    }
  },

  report(): void {
    if (knownIncompatibleLibrariesUsage.size > 0) {
      console.log(chalk.red(`Found the following incompatible libraries:`));
      for (const library of knownIncompatibleLibrariesUsage) {
        console.log(library);
      }
    } else {
      console.log(chalk.green(`Found no usage of incompatible libraries.`));
    }
  },
};

Domain

Subdomains

Dependencies

Frequently Asked Questions

What does libraryCompat.ts do?
libraryCompat.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 libraryCompat.ts?
libraryCompat.ts defines 2 function(s): default.report, default.run.
What does libraryCompat.ts depend on?
libraryCompat.ts imports 2 module(s): chalk, config.ts.
What files import libraryCompat.ts?
libraryCompat.ts is imported by 1 file(s): index.ts.
Where is libraryCompat.ts in the architecture?
libraryCompat.ts is located at compiler/packages/react-compiler-healthcheck/src/checks/libraryCompat.ts (domain: BabelCompiler, subdomain: Validation, directory: compiler/packages/react-compiler-healthcheck/src/checks).

Analyze Your Own Codebase

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

Try Supermodel Free