Home / File/ ReactFlightESMReferences.js — react Source File

ReactFlightESMReferences.js — react Source File

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

File javascript BabelCompiler Validation 1 imports 1 dependents 2 functions

Entity Profile

Dependency Diagram

graph LR
  006877d7_a75e_d976_c4b5_6a427ff547d6["ReactFlightESMReferences.js"]
  0cf33a2a_6fe6_7412_bf8d_09664538a80f["ReactFlightServer"]
  006877d7_a75e_d976_c4b5_6a427ff547d6 --> 0cf33a2a_6fe6_7412_bf8d_09664538a80f
  049ecc6f_7430_8206_8ba3_e37668a7aec9["ReactFlightServerConfigESMBundler.js"]
  049ecc6f_7430_8206_8ba3_e37668a7aec9 --> 006877d7_a75e_d976_c4b5_6a427ff547d6
  style 006877d7_a75e_d976_c4b5_6a427ff547d6 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';

export type ServerReference<T: Function> = T & {
  $$typeof: symbol,
  $$id: string,
  $$bound: null | Array<ReactClientValue>,
  $$location?: Error,
};

// eslint-disable-next-line no-unused-vars
export type ClientReference<T> = {
  $$typeof: symbol,
  $$id: string,
};

const CLIENT_REFERENCE_TAG = Symbol.for('react.client.reference');
const SERVER_REFERENCE_TAG = Symbol.for('react.server.reference');

export function isClientReference(reference: Object): boolean {
  return reference.$$typeof === CLIENT_REFERENCE_TAG;
}

export function isServerReference(reference: Object): boolean {
  return reference.$$typeof === SERVER_REFERENCE_TAG;
}

export function registerClientReference<T>(
  proxyImplementation: any,
  id: string,
  exportName: string,
): ClientReference<T> {
  return Object.defineProperties(proxyImplementation, {
    $$typeof: {value: CLIENT_REFERENCE_TAG},
    $$id: {value: id + '#' + exportName},
  });
}

// $FlowFixMe[method-unbinding]
const FunctionBind = Function.prototype.bind;
// $FlowFixMe[method-unbinding]
const ArraySlice = Array.prototype.slice;
function bind(this: ServerReference<any>): any {
  // $FlowFixMe[incompatible-call]
  const newFn = FunctionBind.apply(this, arguments);
  if (this.$$typeof === SERVER_REFERENCE_TAG) {
    if (__DEV__) {
      const thisBind = arguments[0];
      if (thisBind != null) {
        console.error(
          'Cannot bind "this" of a Server Action. Pass null or undefined as the first argument to .bind().',
        );
// ... (71 more lines)

Domain

Subdomains

Dependencies

  • ReactFlightServer

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free