Home / File/ ReactFreshRuntime.js — react Source File

ReactFreshRuntime.js — react Source File

Architecture documentation for ReactFreshRuntime.js, a javascript file in the react codebase. 4 imports, 0 dependents.

File javascript 4 imports

Entity Profile

Dependency Diagram

graph LR
  521e125c_bdef_861a_2a72_3d8420794425["ReactFreshRuntime.js"]
  42892443_e223_3da0_aeb9_e1b32a408fb0["ReactInternalTypes"]
  521e125c_bdef_861a_2a72_3d8420794425 --> 42892443_e223_3da0_aeb9_e1b32a408fb0
  f18f8743_e2f0_ce9e_55bc_b90dd064aba0["ReactFiberHotReloading"]
  521e125c_bdef_861a_2a72_3d8420794425 --> f18f8743_e2f0_ce9e_55bc_b90dd064aba0
  d8f20c67_f5fa_0f0a_c967_c41fd9ffce07["ReactTypes"]
  521e125c_bdef_861a_2a72_3d8420794425 --> d8f20c67_f5fa_0f0a_c967_c41fd9ffce07
  e1e1de60_2be4_0643_45fb_e2c306735427["ReactSymbols"]
  521e125c_bdef_861a_2a72_3d8420794425 --> e1e1de60_2be4_0643_45fb_e2c306735427
  style 521e125c_bdef_861a_2a72_3d8420794425 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.
 *
 * @flow
 */

import type {FiberRoot} from 'react-reconciler/src/ReactInternalTypes';
import type {
  Family,
  RefreshUpdate,
  ScheduleRefresh,
  ScheduleRoot,
  SetRefreshHandler,
} from 'react-reconciler/src/ReactFiberHotReloading';
import type {ReactNodeList} from 'shared/ReactTypes';

import {REACT_MEMO_TYPE, REACT_FORWARD_REF_TYPE} from 'shared/ReactSymbols';

type Signature = {
  ownKey: string,
  forceReset: boolean,
  fullKey: string | null, // Contains keys of nested Hooks. Computed lazily.
  getCustomHooks: () => Array<Function>,
};

type RendererHelpers = {
  scheduleRefresh: ScheduleRefresh,
  scheduleRoot: ScheduleRoot,
  setRefreshHandler: SetRefreshHandler,
};

if (!__DEV__) {
  throw new Error(
    'React Refresh runtime should not be included in the production bundle.',
  );
}

// In old environments, we'll leak previous types after every edit.
const PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;

// We never remove these associations.
// It's OK to reference families, but use WeakMap/Set for types.
const allFamiliesByID: Map<string, Family> = new Map();
const allFamiliesByType: WeakMap<any, Family> | Map<any, Family> =
  new PossiblyWeakMap();
const allSignaturesByType: WeakMap<any, Signature> | Map<any, Signature> =
  new PossiblyWeakMap();
// This WeakMap is read by React, so we only put families
// that have actually been edited here. This keeps checks fast.
const updatedFamiliesByType: WeakMap<any, Family> | Map<any, Family> =
  new PossiblyWeakMap();

// This is cleared on every performReactRefresh() call.
// It is an array of [Family, NextType] tuples.
let pendingUpdates: Array<[Family, any]> = [];

// This is injected by the renderer via DevTools global hook.
// ... (651 more lines)

Dependencies

  • ReactFiberHotReloading
  • ReactInternalTypes
  • ReactSymbols
  • ReactTypes

Frequently Asked Questions

What does ReactFreshRuntime.js do?
ReactFreshRuntime.js is a source file in the react codebase, written in javascript.
What does ReactFreshRuntime.js depend on?
ReactFreshRuntime.js imports 4 module(s): ReactFiberHotReloading, ReactInternalTypes, ReactSymbols, ReactTypes.
Where is ReactFreshRuntime.js in the architecture?
ReactFreshRuntime.js is located at packages/react-refresh/src/ReactFreshRuntime.js (directory: packages/react-refresh/src).

Analyze Your Own Codebase

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

Try Supermodel Free