MCPcopy
hub / github.com/vercel/next.js / renderToStream

Function renderToStream

packages/next/src/server/app-render/app-render.tsx:2878–3629  ·  view source on GitHub ↗
(
  requestStore: RequestStore,
  req: BaseNextRequest,
  res: BaseNextResponse,
  ctx: AppRenderContext,
  tree: LoaderTree,
  formState: any,
  postponedState: PostponedState | null,
  metadata: AppPageRenderResultMetadata,
  createRequestStore: (() => RequestStore) | undefined,
  fallbackParams: OpaqueFallbackRouteParams | null
)

Source from the content-addressed store, hash-verified

2876}
2877
2878async function renderToStream(
2879 requestStore: RequestStore,
2880 req: BaseNextRequest,
2881 res: BaseNextResponse,
2882 ctx: AppRenderContext,
2883 tree: LoaderTree,
2884 formState: any,
2885 postponedState: PostponedState | null,
2886 metadata: AppPageRenderResultMetadata,
2887 createRequestStore: (() => RequestStore) | undefined,
2888 fallbackParams: OpaqueFallbackRouteParams | null
2889): Promise<ReadableStream<Uint8Array>> {
2890 /* eslint-disable @next/internal/no-ambiguous-jsx -- React Client */
2891 const {
2892 assetPrefix,
2893 htmlRequestId,
2894 nonce,
2895 pagePath,
2896 renderOpts,
2897 requestId,
2898 workStore,
2899 } = ctx
2900
2901 const {
2902 basePath,
2903 buildManifest,
2904 ComponentMod: { createElement },
2905 crossOrigin,
2906 experimental,
2907 isBuildTimePrerendering = false,
2908 onInstrumentationRequestError,
2909 page,
2910 reactMaxHeadersLength,
2911 setReactDebugChannel,
2912 shouldWaitOnAllReady,
2913 subresourceIntegrityManifest,
2914 supportsDynamicResponse,
2915 cacheComponents,
2916 } = renderOpts
2917
2918 const { cachedNavigations } = renderOpts.experimental
2919
2920 const { ServerInsertedHTMLProvider, renderServerInsertedHTML } =
2921 createServerInsertedHTML()
2922 const getServerInsertedMetadata = createServerInsertedMetadata(nonce)
2923
2924 const tracingMetadata = getTracedMetadata(
2925 getTracer().getTracePropagationData(),
2926 experimental.clientTraceMetadata
2927 )
2928
2929 const polyfills: JSX.IntrinsicElements['script'][] =
2930 buildManifest.polyfillFiles
2931 .filter(
2932 (polyfill) =>
2933 polyfill.endsWith('.js') && !polyfill.endsWith('.module.js')
2934 )
2935 .map((polyfill) => ({

Callers 1

renderToHTMLOrFlightImplFunction · 0.85

Calls 15

cacheReadyMethod · 0.95
advanceStageMethod · 0.95
createServerInsertedHTMLFunction · 0.90
getTracedMetadataFunction · 0.90
getAssetQueryStringFunction · 0.90
getRequiredScriptsFunction · 0.90
createHTMLErrorHandlerFunction · 0.90
createDebugChannelFunction · 0.90
createSelectStaleTimeFunction · 0.90

Tested by

no test coverage detected