Home / File/ strictMode.ts — react Source File

strictMode.ts — react Source File

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

File typescript BabelCompiler Validation 1 imports 1 dependents 2 functions

Entity Profile

Dependency Diagram

graph LR
  5488ec04_9215_52f6_1b36_7bc71dca8f3c["strictMode.ts"]
  178fc52d_e7f8_dce1_75f6_f388c2223069["chalk"]
  5488ec04_9215_52f6_1b36_7bc71dca8f3c --> 178fc52d_e7f8_dce1_75f6_f388c2223069
  62c6ef48_b6c1_13e9_0d99_fe0a9fcba79a["index.ts"]
  62c6ef48_b6c1_13e9_0d99_fe0a9fcba79a --> 5488ec04_9215_52f6_1b36_7bc71dca8f3c
  style 5488ec04_9215_52f6_1b36_7bc71dca8f3c 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';

const JsFileExtensionRE = /(js|ts|jsx|tsx)$/;
const NextConfigFileRE = /^next\.config\.(js|mjs)$/;
const StrictModeRE = /<(React\.StrictMode|StrictMode)>/;
const NextStrictModeRE = /reactStrictMode:\s*true/;
let StrictModeUsage = false;

export default {
  run(source: string, path: string): void {
    if (StrictModeUsage) {
      return;
    }

    if (NextConfigFileRE.exec(path) !== null) {
      StrictModeUsage = NextStrictModeRE.exec(source) !== null;
    } else if (JsFileExtensionRE.exec(path) !== null) {
      StrictModeUsage = StrictModeRE.exec(source) !== null;
    }
  },

  report(): void {
    if (StrictModeUsage) {
      console.log(chalk.green('StrictMode usage found.'));
    } else {
      console.log(chalk.red('StrictMode usage not found.'));
    }
  },
};

Domain

Subdomains

Dependencies

  • chalk

Frequently Asked Questions

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