Home / File/ shared-runtime.ts — react Source File

shared-runtime.ts — react Source File

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

File typescript BabelCompiler Entrypoint 2 imports 1 dependents 51 functions 1 classes

Entity Profile

Dependency Diagram

graph LR
  9afdd6fb_14c3_0a52_8105_2d82e58c5c28["shared-runtime.ts"]
  2db15464_200a_540f_8671_b62de113ab09["fbt"]
  9afdd6fb_14c3_0a52_8105_2d82e58c5c28 --> 2db15464_200a_540f_8671_b62de113ab09
  ac587885_e294_a1e9_b13f_5e7b920fdb42["react"]
  9afdd6fb_14c3_0a52_8105_2d82e58c5c28 --> ac587885_e294_a1e9_b13f_5e7b920fdb42
  e04df78a_8312_1a6c_3ce1_ea408e44a1d7["evaluator.ts"]
  e04df78a_8312_1a6c_3ce1_ea408e44a1d7 --> 9afdd6fb_14c3_0a52_8105_2d82e58c5c28
  style 9afdd6fb_14c3_0a52_8105_2d82e58c5c28 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 {IntlVariations, IntlViewerContext, init} from 'fbt';
import React, {FunctionComponent} from 'react';

/**
 * This file is meant for use by `runner-evaluator` and fixture tests.
 *
 * Any fixture test can import constants or functions exported here.
 * However, the import path must be the relative path from `runner-evaluator`
 * (which calls `eval` on each fixture) to this file.
 *
 * ```js
 * // test.js
 * import {CONST_STRING0} from './shared-runtime';
 *
 * // ...
 * ```
 */

export type StringKeyedObject = {[key: string]: unknown};

export const CONST_STRING0 = 'global string 0';
export const CONST_STRING1 = 'global string 1';
export const CONST_STRING2 = 'global string 2';

export const CONST_NUMBER0 = 0;
export const CONST_NUMBER1 = 1;
export const CONST_NUMBER2 = 2;

export const CONST_TRUE = true;
export const CONST_FALSE = false;

export function initFbt(): void {
  const viewerContext: IntlViewerContext = {
    GENDER: IntlVariations.GENDER_UNKNOWN,
    locale: 'en_US',
  };

  init({
    translations: {},
    hooks: {
      getViewerContext: () => viewerContext,
    },
  });
}

export function mutate(arg: any): void {
  // don't mutate primitive
  if (arg == null || typeof arg !== 'object') {
    return;
  } else if (Array.isArray(arg)) {
    arg.push('joe');
  }

// ... (365 more lines)

Domain

Subdomains

Classes

Dependencies

  • fbt
  • react

Frequently Asked Questions

What does shared-runtime.ts do?
shared-runtime.ts is a source file in the react codebase, written in typescript. It belongs to the BabelCompiler domain, Entrypoint subdomain.
What functions are defined in shared-runtime.ts?
shared-runtime.ts defines 51 function(s): ObjectWithHooks.useFoo, ObjectWithHooks.useIdentity, ObjectWithHooks.useMakeArray, RenderPropAsChild, StaticText1, StaticText2, Stringify, Text, Throw, ValidateMemoization, and 41 more.
What does shared-runtime.ts depend on?
shared-runtime.ts imports 2 module(s): fbt, react.
What files import shared-runtime.ts?
shared-runtime.ts is imported by 1 file(s): evaluator.ts.
Where is shared-runtime.ts in the architecture?
shared-runtime.ts is located at compiler/packages/snap/src/sprout/shared-runtime.ts (domain: BabelCompiler, subdomain: Entrypoint, directory: compiler/packages/snap/src/sprout).

Analyze Your Own Codebase

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

Try Supermodel Free