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 var $$$config: any;
    
  27. export opaque type Destination = mixed; // eslint-disable-line no-undef
    
  28. 
    
  29. export opaque type PrecomputedChunk = mixed; // eslint-disable-line no-undef
    
  30. export opaque type Chunk = mixed; // eslint-disable-line no-undef
    
  31. export opaque type BinaryChunk = mixed; // eslint-disable-line no-undef
    
  32. 
    
  33. export const scheduleWork = $$$config.scheduleWork;
    
  34. export const beginWriting = $$$config.beginWriting;
    
  35. export const writeChunk = $$$config.writeChunk;
    
  36. export const writeChunkAndReturn = $$$config.writeChunkAndReturn;
    
  37. export const completeWriting = $$$config.completeWriting;
    
  38. export const flushBuffered = $$$config.flushBuffered;
    
  39. export const close = $$$config.close;
    
  40. export const closeWithError = $$$config.closeWithError;
    
  41. export const stringToChunk = $$$config.stringToChunk;
    
  42. export const stringToPrecomputedChunk = $$$config.stringToPrecomputedChunk;
    
  43. export const typedArrayToBinaryChunk = $$$config.typedArrayToBinaryChunk;
    
  44. export const clonePrecomputedChunk = $$$config.clonePrecomputedChunk;
    
  45. export const byteLengthOfChunk = $$$config.byteLengthOfChunk;
    
  46. export const byteLengthOfBinaryChunk = $$$config.byteLengthOfBinaryChunk;
    
  47. export const createFastHash = $$$config.createFastHash;