Home / File/ runner-worker.ts — react Source File

runner-worker.ts — react Source File

Architecture documentation for runner-worker.ts, a typescript file in the react codebase. 19 imports, 1 dependents.

File typescript BabelCompiler Optimization 19 imports 1 dependents 3 functions

Entity Profile

Dependency Diagram

graph LR
  49c99dfe_ec8f_3cb7_769b_a3b735b82b82["runner-worker.ts"]
  f294d5ab_dd3b_6bca_e120_e970909a7dc8["compiler.ts"]
  49c99dfe_ec8f_3cb7_769b_a3b735b82b82 --> f294d5ab_dd3b_6bca_e120_e970909a7dc8
  ad68e610_c63c_cfa2_7a20_f8e3090b5142["TransformResult"]
  49c99dfe_ec8f_3cb7_769b_a3b735b82b82 --> ad68e610_c63c_cfa2_7a20_f8e3090b5142
  34f68e46_4ab8_f2b5_b44f_59f14d4d25b8["transformFixtureInput"]
  49c99dfe_ec8f_3cb7_769b_a3b735b82b82 --> 34f68e46_4ab8_f2b5_b44f_59f14d4d25b8
  dc3fd0be_e038_0596_3080_c93d9784f34e["constants.ts"]
  49c99dfe_ec8f_3cb7_769b_a3b735b82b82 --> dc3fd0be_e038_0596_3080_c93d9784f34e
  4d76833e_f078_3b83_e453_82ab13e17c43["fixture-utils.ts"]
  49c99dfe_ec8f_3cb7_769b_a3b735b82b82 --> 4d76833e_f078_3b83_e453_82ab13e17c43
  2878c292_382a_f6bd_8ef9_ede582ea0470["TestFixture"]
  49c99dfe_ec8f_3cb7_769b_a3b735b82b82 --> 2878c292_382a_f6bd_8ef9_ede582ea0470
  c681c19b_5647_fd2d_e194_c12d81c722da["getBasename"]
  49c99dfe_ec8f_3cb7_769b_a3b735b82b82 --> c681c19b_5647_fd2d_e194_c12d81c722da
  bf1ae175_0a76_7aa4_ad79_8ea2236e3b0a["isExpectError"]
  49c99dfe_ec8f_3cb7_769b_a3b735b82b82 --> bf1ae175_0a76_7aa4_ad79_8ea2236e3b0a
  0e6b4c6b_7bcc_eac7_3f6d_ff9990f24223["reporter.ts"]
  49c99dfe_ec8f_3cb7_769b_a3b735b82b82 --> 0e6b4c6b_7bcc_eac7_3f6d_ff9990f24223
  18584f0a_8c4b_c703_29df_c6de9a566519["TestResult"]
  49c99dfe_ec8f_3cb7_769b_a3b735b82b82 --> 18584f0a_8c4b_c703_29df_c6de9a566519
  84944777_d7ed_3ce5_35bb_d71af47d5891["writeOutputToString"]
  49c99dfe_ec8f_3cb7_769b_a3b735b82b82 --> 84944777_d7ed_3ce5_35bb_d71af47d5891
  f8b6e051_0f7f_6e15_4727_f99783e05cbb["index.ts"]
  49c99dfe_ec8f_3cb7_769b_a3b735b82b82 --> f8b6e051_0f7f_6e15_4727_f99783e05cbb
  81e68010_37f1_e748_b452_7cc28e601cad["runSprout"]
  49c99dfe_ec8f_3cb7_769b_a3b735b82b82 --> 81e68010_37f1_e748_b452_7cc28e601cad
  102f7d62_f771_0080_dd43_d867f5a8bd55["core"]
  49c99dfe_ec8f_3cb7_769b_a3b735b82b82 --> 102f7d62_f771_0080_dd43_d867f5a8bd55
  style 49c99dfe_ec8f_3cb7_769b_a3b735b82b82 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 {PluginObj} from '@babel/core';
import type {parseConfigPragmaForTests as ParseConfigPragma} from 'babel-plugin-react-compiler/src/Utils/TestUtils';
import type {printFunctionWithOutlined as PrintFunctionWithOutlined} from 'babel-plugin-react-compiler/src/HIR/PrintHIR';
import type {printReactiveFunctionWithOutlined as PrintReactiveFunctionWithOutlined} from 'babel-plugin-react-compiler/src/ReactiveScopes/PrintReactiveFunction';
import {TransformResult, transformFixtureInput} from './compiler';
import {
  PARSE_CONFIG_PRAGMA_IMPORT,
  PRINT_HIR_IMPORT,
  PRINT_REACTIVE_IR_IMPORT,
  BABEL_PLUGIN_SRC,
} from './constants';
import {TestFixture, getBasename, isExpectError} from './fixture-utils';
import {TestResult, writeOutputToString} from './reporter';
import {runSprout} from './sprout';
import type {
  CompilerPipelineValue,
  Effect,
  ValueKind,
  ValueReason,
} from 'babel-plugin-react-compiler/src';
import chalk from 'chalk';

const originalConsoleError = console.error;

// Try to avoid clearing the entire require cache, which (as of this PR)
// contains ~1250 files. This assumes that no dependencies have global caches
// that may need to be invalidated across Forget reloads.
const invalidationSubpath = 'packages/babel-plugin-react-compiler/dist';
let version: number | null = null;
export function clearRequireCache() {
  Object.keys(require.cache).forEach(function (path) {
    if (path.includes(invalidationSubpath)) {
      delete require.cache[path];
    }
  });
}

async function compile(
  input: string,
  fixturePath: string,
  compilerVersion: number,
  shouldLog: boolean,
  includeEvaluator: boolean,
): Promise<{
  error: string | null;
  compileResult: TransformResult | null;
}> {
  const seenConsoleErrors: Array<string> = [];
  console.error = (...messages: Array<string>) => {
    seenConsoleErrors.push(...messages);
  };
  if (version !== null && compilerVersion !== version) {
    clearRequireCache();
// ... (178 more lines)

Domain

Subdomains

Frequently Asked Questions

What does runner-worker.ts do?
runner-worker.ts is a source file in the react codebase, written in typescript. It belongs to the BabelCompiler domain, Optimization subdomain.
What functions are defined in runner-worker.ts?
runner-worker.ts defines 3 function(s): clearRequireCache, compile, transformFixture.
What does runner-worker.ts depend on?
runner-worker.ts imports 19 module(s): PrintHIR, PrintReactiveFunction, TestFixture, TestResult, TestUtils, TransformResult, chalk, compiler.ts, and 11 more.
What files import runner-worker.ts?
runner-worker.ts is imported by 1 file(s): runner.ts.
Where is runner-worker.ts in the architecture?
runner-worker.ts is located at compiler/packages/snap/src/runner-worker.ts (domain: BabelCompiler, subdomain: Optimization, directory: compiler/packages/snap/src).

Analyze Your Own Codebase

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

Try Supermodel Free