Home / File/ dynamicImportCache.js — react Source File

dynamicImportCache.js — react Source File

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

File javascript BabelCompiler Validation 3 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  e06c21c4_23a1_b306_b037_a812d4ef0a06["dynamicImportCache.js"]
  55d27179_f566_db64_927b_e95655abee00["constants"]
  e06c21c4_23a1_b306_b037_a812d4ef0a06 --> 55d27179_f566_db64_927b_e95655abee00
  d8f20c67_f5fa_0f0a_c967_c41fd9ffce07["ReactTypes"]
  e06c21c4_23a1_b306_b037_a812d4ef0a06 --> d8f20c67_f5fa_0f0a_c967_c41fd9ffce07
  ac587885_e294_a1e9_b13f_5e7b920fdb42["react"]
  e06c21c4_23a1_b306_b037_a812d4ef0a06 --> ac587885_e294_a1e9_b13f_5e7b920fdb42
  style e06c21c4_23a1_b306_b037_a812d4ef0a06 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 {__DEBUG__} from 'react-devtools-shared/src/constants';

import type {
  Thenable,
  FulfilledThenable,
  RejectedThenable,
} from 'shared/ReactTypes';

import * as React from 'react';

const TIMEOUT = 30000;

type Module = any;
type ModuleLoaderFunction = () => Thenable<Module>;

// This is intentionally a module-level Map, rather than a React-managed one.
// Otherwise, refreshing the inspected element cache would also clear this cache.
// Modules are static anyway.
const moduleLoaderFunctionToModuleMap: Map<ModuleLoaderFunction, Module> =
  new Map();
function readRecord<T>(record: Thenable<T>): T | null {
  if (typeof React.use === 'function') {
    try {
      // eslint-disable-next-line react-hooks-published/rules-of-hooks
      return React.use(record);
    } catch (x) {
      if (x === null) {
        return null;
      }
      throw x;
    }
  }
  if (record.status === 'fulfilled') {
    return record.value;
  } else if (record.status === 'rejected') {
    return null;
  } else {
    throw record;
  }
}

// TODO Flow type
export function loadModule(moduleLoaderFunction: ModuleLoaderFunction): Module {
  let record = moduleLoaderFunctionToModuleMap.get(moduleLoaderFunction);

  if (__DEBUG__) {
    console.log(
      `[dynamicImportCache] loadModule("${moduleLoaderFunction.name}")`,
    );
  }

// ... (109 more lines)

Domain

Subdomains

Dependencies

  • ReactTypes
  • constants
  • react

Frequently Asked Questions

What does dynamicImportCache.js do?
dynamicImportCache.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in dynamicImportCache.js?
dynamicImportCache.js defines 2 function(s): ModuleLoaderFunction, callbacks.
What does dynamicImportCache.js depend on?
dynamicImportCache.js imports 3 module(s): ReactTypes, constants, react.
Where is dynamicImportCache.js in the architecture?
dynamicImportCache.js is located at packages/react-devtools-shared/src/dynamicImportCache.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-shared/src).

Analyze Your Own Codebase

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

Try Supermodel Free