Home / File/ ReactServerStreamConfigBun.js — react Source File

ReactServerStreamConfigBun.js — react Source File

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

File javascript 1 imports

Entity Profile

Dependency Diagram

graph LR
  285a62b8_db48_7586_5c2a_d24689b223b5["ReactServerStreamConfigBun.js"]
  84cea5a1_779b_9551_2f54_df77f0973a0f["stream"]
  285a62b8_db48_7586_5c2a_d24689b223b5 --> 84cea5a1_779b_9551_2f54_df77f0973a0f
  style 285a62b8_db48_7586_5c2a_d24689b223b5 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
 */

/* global Bun */

import type {Writable} from 'stream';

type BunReadableStreamController = ReadableStreamController & {
  end(): mixed,
  write(data: Chunk | BinaryChunk): void,
  error(error: Error): void,
  flush?: () => void,
};

interface MightBeFlushable {
  flush?: () => void;
}

export type Destination =
  | BunReadableStreamController
  | (Writable & MightBeFlushable);

export type PrecomputedChunk = string;
export opaque type Chunk = string;
export type BinaryChunk = $ArrayBufferView;

export function scheduleWork(callback: () => void) {
  setTimeout(callback, 0);
}

export const scheduleMicrotask = queueMicrotask;

export function flushBuffered(destination: Destination) {
  // Bun direct streams provide a flush function.
  // If we don't have any more data to send right now.
  // Flush whatever is in the buffer to the wire.
  if (typeof destination.flush === 'function') {
    destination.flush();
  }
}

export function beginWriting(destination: Destination) {}

export function writeChunk(
  destination: Destination,
  chunk: PrecomputedChunk | Chunk | BinaryChunk,
): void {
  if (chunk.length === 0) {
    return;
  }

  // $FlowFixMe[incompatible-call]: write() is compatible with both types in Bun
  destination.write(chunk);
}
// ... (76 more lines)

Dependencies

  • stream

Frequently Asked Questions

What does ReactServerStreamConfigBun.js do?
ReactServerStreamConfigBun.js is a source file in the react codebase, written in javascript.
What does ReactServerStreamConfigBun.js depend on?
ReactServerStreamConfigBun.js imports 1 module(s): stream.
Where is ReactServerStreamConfigBun.js in the architecture?
ReactServerStreamConfigBun.js is located at packages/react-server/src/ReactServerStreamConfigBun.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