ReactServerStreamConfigEdge.js — react Source File
Architecture documentation for ReactServerStreamConfigEdge.js, a javascript file in the react codebase.
Entity Profile
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
*/
export type Destination = ReadableStreamController;
export type PrecomputedChunk = Uint8Array;
export opaque type Chunk = Uint8Array;
export type BinaryChunk = Uint8Array;
function handleErrorInNextTick(error: any) {
setTimeout(() => {
throw error;
});
}
const LocalPromise = Promise;
export const scheduleMicrotask: (callback: () => void) => void =
typeof queueMicrotask === 'function'
? queueMicrotask
: callback => {
LocalPromise.resolve(null).then(callback).catch(handleErrorInNextTick);
};
export function scheduleWork(callback: () => void) {
setTimeout(callback, 0);
}
export function flushBuffered(destination: Destination) {
// WHATWG Streams do not yet have a way to flush the underlying
// transform streams. https://github.com/whatwg/streams/issues/960
}
// Chunks larger than VIEW_SIZE are written directly, without copying into the
// internal view buffer. This must be at least half of Node's internal Buffer
// pool size (8192) to avoid corrupting the pool when using
// renderToReadableStream, which uses a byte stream that detaches ArrayBuffers.
const VIEW_SIZE = 4096;
let currentView = null;
let writtenBytes = 0;
export function beginWriting(destination: Destination) {
currentView = new Uint8Array(VIEW_SIZE);
writtenBytes = 0;
}
export function writeChunk(
destination: Destination,
chunk: PrecomputedChunk | Chunk | BinaryChunk,
): void {
if (chunk.byteLength === 0) {
return;
}
// ... (133 more lines)
Source
Frequently Asked Questions
What does ReactServerStreamConfigEdge.js do?
ReactServerStreamConfigEdge.js is a source file in the react codebase, written in javascript.
Where is ReactServerStreamConfigEdge.js in the architecture?
ReactServerStreamConfigEdge.js is located at packages/react-server/src/ReactServerStreamConfigEdge.js (directory: packages/react-server/src).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free