Home / File/ ReactFlightServerConfigESMBundler.js — react Source File

ReactFlightServerConfigESMBundler.js — react Source File

Architecture documentation for ReactFlightServerConfigESMBundler.js, a javascript file in the react codebase. 2 imports, 1 dependents.

File javascript BabelCompiler Validation 2 imports 1 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  049ecc6f_7430_8206_8ba3_e37668a7aec9["ReactFlightServerConfigESMBundler.js"]
  006877d7_a75e_d976_c4b5_6a427ff547d6["ReactFlightESMReferences.js"]
  049ecc6f_7430_8206_8ba3_e37668a7aec9 --> 006877d7_a75e_d976_c4b5_6a427ff547d6
  0cf33a2a_6fe6_7412_bf8d_09664538a80f["ReactFlightServer"]
  049ecc6f_7430_8206_8ba3_e37668a7aec9 --> 0cf33a2a_6fe6_7412_bf8d_09664538a80f
  f68d21c1_26f5_81b5_1298_3ce0f9f65bd2["ReactFlightDOMServerNode.js"]
  f68d21c1_26f5_81b5_1298_3ce0f9f65bd2 --> 049ecc6f_7430_8206_8ba3_e37668a7aec9
  style 049ecc6f_7430_8206_8ba3_e37668a7aec9 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 {
  ClientReference,
  ServerReference,
} from '../ReactFlightESMReferences';

export type {ClientReference, ServerReference};

export type ClientManifest = string; // base URL on the file system

export type ServerReferenceId = string;

export type ClientReferenceMetadata = [
  string, // module path
  string, // export name
];

export type ClientReferenceKey = string;

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

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

export function resolveClientReferenceMetadata<T>(
  config: ClientManifest,
  clientReference: ClientReference<T>,
): ClientReferenceMetadata {
  const baseURL: string = config;
  const id = clientReference.$$id;
  const idx = id.lastIndexOf('#');
  const exportName = id.slice(idx + 1);
  const fullURL = id.slice(0, idx);
  if (!fullURL.startsWith(baseURL)) {
    throw new Error(
      'Attempted to load a Client Module outside the hosted root.',
    );
  }
  // Relative URL
  const modulePath = fullURL.slice(baseURL.length);
  return [modulePath, exportName];
}

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

Dependencies

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free