ReactNoopFlightServer.js — react Source File
Architecture documentation for ReactNoopFlightServer.js, a javascript file in the react codebase. 3 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 4a9a3a09_8260_3d60_9da3_41ce19920ffe["ReactNoopFlightServer.js"] 4ec95780_2443_3a27_6887_ffb751f9c434["ReactFlightServer"] 4a9a3a09_8260_3d60_9da3_41ce19920ffe --> 4ec95780_2443_3a27_6887_ffb751f9c434 4cbc4f4a_3138_5e47_928d_46b36c194aef["flight-modules"] 4a9a3a09_8260_3d60_9da3_41ce19920ffe --> 4cbc4f4a_3138_5e47_928d_46b36c194aef c9c00222_72f4_b77a_3120_560f73da2908["flight"] 4a9a3a09_8260_3d60_9da3_41ce19920ffe --> c9c00222_72f4_b77a_3120_560f73da2908 style 4a9a3a09_8260_3d60_9da3_41ce19920ffe 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
*/
/**
* This is a renderer of React that doesn't have a render target output.
* It is useful to demonstrate the internals of the reconciler in isolation
* and for testing semantics of reconciliation separate from the host
* environment.
*/
import type {ReactClientValue} from 'react-server/src/ReactFlightServer';
import {saveModule} from 'react-noop-renderer/flight-modules';
import ReactFlightServer from 'react-server/flight';
type Destination = Array<Uint8Array>;
const textEncoder = new TextEncoder();
const ReactNoopFlightServer = ReactFlightServer({
scheduleMicrotask(callback: () => void) {
callback();
},
scheduleWork(callback: () => void) {
callback();
},
beginWriting(destination: Destination): void {},
writeChunk(destination: Destination, chunk: string): void {
destination.push(chunk);
},
writeChunkAndReturn(destination: Destination, chunk: string): boolean {
destination.push(chunk);
return true;
},
completeWriting(destination: Destination): void {},
close(destination: Destination): void {},
closeWithError(destination: Destination, error: mixed): void {},
flushBuffered(destination: Destination): void {},
stringToChunk(content: string): Uint8Array {
return textEncoder.encode(content);
},
stringToPrecomputedChunk(content: string): Uint8Array {
return textEncoder.encode(content);
},
isClientReference(reference: Object): boolean {
return reference.$$typeof === Symbol.for('react.client.reference');
},
isServerReference(reference: Object): boolean {
return reference.$$typeof === Symbol.for('react.server.reference');
},
getClientReferenceKey(reference: Object): Object {
return reference;
},
resolveClientReferenceMetadata(
config: void,
reference: {$$typeof: symbol, value: any},
) {
return saveModule(reference.value);
},
});
type Options = {
environmentName?: string | (() => string),
filterStackFrame?: (url: string, functionName: string) => boolean,
identifierPrefix?: string,
signal?: AbortSignal,
debugChannel?: {onMessage?: (message: string) => void},
onError?: (error: mixed) => void,
startTime?: number,
};
function render(model: ReactClientValue, options?: Options): Destination {
const destination: Destination = [];
const bundlerConfig = undefined;
const request = ReactNoopFlightServer.createRequest(
model,
bundlerConfig,
options ? options.onError : undefined,
options ? options.identifierPrefix : undefined,
undefined,
options ? options.startTime : undefined,
__DEV__ && options ? options.environmentName : undefined,
__DEV__ && options ? options.filterStackFrame : undefined,
__DEV__ && options && options.debugChannel !== undefined,
);
const signal = options ? options.signal : undefined;
if (signal) {
if (signal.aborted) {
ReactNoopFlightServer.abort(request, (signal: any).reason);
} else {
const listener = () => {
ReactNoopFlightServer.abort(request, (signal: any).reason);
signal.removeEventListener('abort', listener);
};
signal.addEventListener('abort', listener);
}
}
if (__DEV__ && options && options.debugChannel !== undefined) {
options.debugChannel.onMessage = message => {
ReactNoopFlightServer.resolveDebugMessage(request, message);
};
}
ReactNoopFlightServer.startWork(request);
ReactNoopFlightServer.startFlowing(request, destination);
return destination;
}
export {render};
Domain
Subdomains
Functions
Dependencies
- ReactFlightServer
- flight
- flight-modules
Source
Frequently Asked Questions
What does ReactNoopFlightServer.js do?
ReactNoopFlightServer.js is a source file in the react codebase, written in javascript. It belongs to the CompilerCore domain, Suppression subdomain.
What functions are defined in ReactNoopFlightServer.js?
ReactNoopFlightServer.js defines 3 function(s): Options.onError, ReactNoopFlightServer.scheduleMicrotask, ReactNoopFlightServer.scheduleWork.
What does ReactNoopFlightServer.js depend on?
ReactNoopFlightServer.js imports 3 module(s): ReactFlightServer, flight, flight-modules.
Where is ReactNoopFlightServer.js in the architecture?
ReactNoopFlightServer.js is located at packages/react-noop-renderer/src/ReactNoopFlightServer.js (domain: CompilerCore, subdomain: Suppression, directory: packages/react-noop-renderer/src).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free