| 1 | /** |
| 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. |
| 3 | * |
| 4 | * This source code is licensed under the MIT license found in the |
| 5 | * LICENSE file in the root directory of this source tree. |
| 6 | * |
| 7 | * @flow |
| 8 | */ |
| 9 | |
| 10 | // This is a host config that's used for the `react-server` package on npm. |
| 11 | // It is only used by third-party renderers. |
| 12 | // |
| 13 | // Its API lets you pass the host config as an argument. |
| 14 | // However, inside the `react-server` we treat host config as a module. |
| 15 | // This file is a shim between two worlds. |
| 16 | // |
| 17 | // It works because the `react-server` bundle is wrapped in something like: |
| 18 | // |
| 19 | // module.exports = function ($$$config) { |
| 20 | // /* renderer code */ |
| 21 | // } |
| 22 | // |
| 23 | // So `$$$config` looks like a global variable, but it's |
| 24 | // really an argument to a top-level wrapping function. |
| 25 | |
| 26 | declare const $$$config: any; |
| 27 | export opaque type Destination = mixed; |
| 28 | |
| 29 | export opaque type PrecomputedChunk = mixed; |
| 30 | export opaque type Chunk = mixed; |
| 31 | export opaque type BinaryChunk = mixed; |
| 32 | |
| 33 | export const scheduleWork = $$$config.scheduleWork; |
| 34 | export const scheduleMicrotask = $$$config.scheduleMicrotask; |
| 35 | export const beginWriting = $$$config.beginWriting; |
| 36 | export const writeChunk = $$$config.writeChunk; |
| 37 | export const writeChunkAndReturn = $$$config.writeChunkAndReturn; |
| 38 | export const completeWriting = $$$config.completeWriting; |
| 39 | export const flushBuffered = $$$config.flushBuffered; |
| 40 | export const close = $$$config.close; |
| 41 | export const closeWithError = $$$config.closeWithError; |
| 42 | export const stringToChunk = $$$config.stringToChunk; |
| 43 | export const stringToPrecomputedChunk = $$$config.stringToPrecomputedChunk; |
| 44 | export const typedArrayToBinaryChunk = $$$config.typedArrayToBinaryChunk; |
| 45 | export const byteLengthOfChunk = $$$config.byteLengthOfChunk; |
| 46 | export const byteLengthOfBinaryChunk = $$$config.byteLengthOfBinaryChunk; |
| 47 | export const createFastHash = $$$config.createFastHash; |
| 48 | export const readAsDataURL = $$$config.readAsDataURL; |