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. import type {Request} from 'react-server/src/ReactFizzServer';
    
  27. import type {TransitionStatus} from 'react-reconciler/src/ReactFiberConfig';
    
  28. 
    
  29. declare var $$$config: any;
    
  30. export opaque type Destination = mixed; // eslint-disable-line no-undef
    
  31. export opaque type RenderState = mixed;
    
  32. export opaque type ResumableState = mixed;
    
  33. export opaque type BoundaryResources = mixed;
    
  34. export opaque type FormatContext = mixed;
    
  35. export type {TransitionStatus};
    
  36. 
    
  37. export const isPrimaryRenderer = false;
    
  38. 
    
  39. export const supportsRequestStorage = false;
    
  40. export const requestStorage: AsyncLocalStorage<Request> = (null: any);
    
  41. 
    
  42. export const resetResumableState = $$$config.resetResumableState;
    
  43. export const getChildFormatContext = $$$config.getChildFormatContext;
    
  44. export const makeId = $$$config.makeId;
    
  45. export const pushTextInstance = $$$config.pushTextInstance;
    
  46. export const pushStartInstance = $$$config.pushStartInstance;
    
  47. export const pushEndInstance = $$$config.pushEndInstance;
    
  48. export const pushStartCompletedSuspenseBoundary =
    
  49.   $$$config.pushStartCompletedSuspenseBoundary;
    
  50. export const pushEndCompletedSuspenseBoundary =
    
  51.   $$$config.pushEndCompletedSuspenseBoundary;
    
  52. export const pushSegmentFinale = $$$config.pushSegmentFinale;
    
  53. export const pushFormStateMarkerIsMatching =
    
  54.   $$$config.pushFormStateMarkerIsMatching;
    
  55. export const pushFormStateMarkerIsNotMatching =
    
  56.   $$$config.pushFormStateMarkerIsNotMatching;
    
  57. export const writeCompletedRoot = $$$config.writeCompletedRoot;
    
  58. export const writePlaceholder = $$$config.writePlaceholder;
    
  59. export const writeStartCompletedSuspenseBoundary =
    
  60.   $$$config.writeStartCompletedSuspenseBoundary;
    
  61. export const writeStartPendingSuspenseBoundary =
    
  62.   $$$config.writeStartPendingSuspenseBoundary;
    
  63. export const writeStartClientRenderedSuspenseBoundary =
    
  64.   $$$config.writeStartClientRenderedSuspenseBoundary;
    
  65. export const writeEndCompletedSuspenseBoundary =
    
  66.   $$$config.writeEndCompletedSuspenseBoundary;
    
  67. export const writeEndPendingSuspenseBoundary =
    
  68.   $$$config.writeEndPendingSuspenseBoundary;
    
  69. export const writeEndClientRenderedSuspenseBoundary =
    
  70.   $$$config.writeEndClientRenderedSuspenseBoundary;
    
  71. export const writeStartSegment = $$$config.writeStartSegment;
    
  72. export const writeEndSegment = $$$config.writeEndSegment;
    
  73. export const writeCompletedSegmentInstruction =
    
  74.   $$$config.writeCompletedSegmentInstruction;
    
  75. export const writeCompletedBoundaryInstruction =
    
  76.   $$$config.writeCompletedBoundaryInstruction;
    
  77. export const writeClientRenderBoundaryInstruction =
    
  78.   $$$config.writeClientRenderBoundaryInstruction;
    
  79. export const prepareHostDispatcher = $$$config.prepareHostDispatcher;
    
  80. export const NotPendingTransition = $$$config.NotPendingTransition;
    
  81. 
    
  82. // -------------------------
    
  83. //     Resources
    
  84. // -------------------------
    
  85. export const writePreamble = $$$config.writePreamble;
    
  86. export const writeHoistables = $$$config.writeHoistables;
    
  87. export const writePostamble = $$$config.writePostamble;
    
  88. export const hoistResources = $$$config.hoistResources;
    
  89. export const createResources = $$$config.createResources;
    
  90. export const createBoundaryResources = $$$config.createBoundaryResources;
    
  91. export const setCurrentlyRenderingBoundaryResourcesTarget =
    
  92.   $$$config.setCurrentlyRenderingBoundaryResourcesTarget;
    
  93. export const writeResourcesForBoundary = $$$config.writeResourcesForBoundary;