Home / File/ ReactFlightServerConfigWebpackBundler.js — react Source File

ReactFlightServerConfigWebpackBundler.js — react Source File

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

File javascript BabelCompiler Validation 3 imports 3 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  86be9700_4cd0_5399_1f70_90254d1235ad["ReactFlightServerConfigWebpackBundler.js"]
  ecf040cb_2f00_8f57_1b89_0fb87fd99487["ReactFlightImportMetadata.js"]
  86be9700_4cd0_5399_1f70_90254d1235ad --> ecf040cb_2f00_8f57_1b89_0fb87fd99487
  4df02f35_5407_da69_f211_8ce32127320d["ReactFlightWebpackReferences.js"]
  86be9700_4cd0_5399_1f70_90254d1235ad --> 4df02f35_5407_da69_f211_8ce32127320d
  0cf33a2a_6fe6_7412_bf8d_09664538a80f["ReactFlightServer"]
  86be9700_4cd0_5399_1f70_90254d1235ad --> 0cf33a2a_6fe6_7412_bf8d_09664538a80f
  b920bb14_b397_fbbe_3d88_d3964374e1be["ReactFlightDOMServerBrowser.js"]
  b920bb14_b397_fbbe_3d88_d3964374e1be --> 86be9700_4cd0_5399_1f70_90254d1235ad
  7dd4cd8b_d7cd_44db_2cd5_02b2c478b0ca["ReactFlightDOMServerEdge.js"]
  7dd4cd8b_d7cd_44db_2cd5_02b2c478b0ca --> 86be9700_4cd0_5399_1f70_90254d1235ad
  dbfb56d8_4778_a0b6_051b_2e0f3a4de103["ReactFlightDOMServerNode.js"]
  dbfb56d8_4778_a0b6_051b_2e0f3a4de103 --> 86be9700_4cd0_5399_1f70_90254d1235ad
  style 86be9700_4cd0_5399_1f70_90254d1235ad 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 {ReactClientValue} from 'react-server/src/ReactFlightServer';
import type {
  ImportMetadata,
  ImportManifestEntry,
} from '../shared/ReactFlightImportMetadata';

import type {
  ClientReference,
  ServerReference,
} from '../ReactFlightWebpackReferences';

export type {ClientReference, ServerReference};

export type ClientManifest = {
  [id: string]: ClientReferenceManifestEntry,
};

export type ServerReferenceId = string;

export type ClientReferenceMetadata = ImportMetadata;
export opaque type ClientReferenceManifestEntry = ImportManifestEntry;

export type ClientReferenceKey = string;

export {
  isClientReference,
  isServerReference,
} from '../ReactFlightWebpackReferences';

export function getClientReferenceKey(
  reference: ClientReference<any>,
): ClientReferenceKey {
  return reference.$$async ? reference.$$id + '#async' : reference.$$id;
}

export function resolveClientReferenceMetadata<T>(
  config: ClientManifest,
  clientReference: ClientReference<T>,
): ClientReferenceMetadata {
  const modulePath = clientReference.$$id;
  let name = '';
  let resolvedModuleData = config[modulePath];
  if (resolvedModuleData) {
    // The potentially aliased name.
    name = resolvedModuleData.name;
  } else {
    // We didn't find this specific export name but we might have the * export
    // which contains this name as well.
    // TODO: It's unfortunate that we now have to parse this string. We should
    // probably go back to encoding path and name separately on the client reference.
    const idx = modulePath.lastIndexOf('#');
    if (idx !== -1) {
      name = modulePath.slice(idx + 1);
      resolvedModuleData = config[modulePath.slice(0, idx)];
    }
    if (!resolvedModuleData) {
      throw new Error(
        'Could not find the module "' +
          modulePath +
          '" in the React Client Manifest. ' +
          'This is probably a bug in the React Server Components bundler.',
      );
    }
  }
  if (resolvedModuleData.async === true && clientReference.$$async === true) {
    throw new Error(
      'The module "' +
        modulePath +
        '" is marked as an async ESM module but was loaded as a CJS proxy. ' +
        'This is probably a bug in the React Server Components bundler.',
    );
  }
  if (resolvedModuleData.async === true || clientReference.$$async === true) {
    return [resolvedModuleData.id, resolvedModuleData.chunks, name, 1];
  } else {
    return [resolvedModuleData.id, resolvedModuleData.chunks, name];
  }
}

export function getServerReferenceId<T>(
  config: ClientManifest,
  serverReference: ServerReference<T>,
): ServerReferenceId {
  return serverReference.$$id;
}

export function getServerReferenceBoundArguments<T>(
  config: ClientManifest,
  serverReference: ServerReference<T>,
): null | Array<ReactClientValue> {
  return serverReference.$$bound;
}

export function getServerReferenceLocation<T>(
  config: ClientManifest,
  serverReference: ServerReference<T>,
): void | Error {
  return serverReference.$$location;
}

Domain

Subdomains

Frequently Asked Questions

What does ReactFlightServerConfigWebpackBundler.js do?
ReactFlightServerConfigWebpackBundler.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 ReactFlightServerConfigWebpackBundler.js?
ReactFlightServerConfigWebpackBundler.js defines 1 function(s): getClientReferenceKey.
What does ReactFlightServerConfigWebpackBundler.js depend on?
ReactFlightServerConfigWebpackBundler.js imports 3 module(s): ReactFlightImportMetadata.js, ReactFlightServer, ReactFlightWebpackReferences.js.
What files import ReactFlightServerConfigWebpackBundler.js?
ReactFlightServerConfigWebpackBundler.js is imported by 3 file(s): ReactFlightDOMServerBrowser.js, ReactFlightDOMServerEdge.js, ReactFlightDOMServerNode.js.
Where is ReactFlightServerConfigWebpackBundler.js in the architecture?
ReactFlightServerConfigWebpackBundler.js is located at packages/react-server-dom-webpack/src/server/ReactFlightServerConfigWebpackBundler.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-server-dom-webpack/src/server).

Analyze Your Own Codebase

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

Try Supermodel Free