/opt/canhelp/node_modules/next/dist/esm/server/app-render
Edit: /opt/canhelp/node_modules/next/dist/esm/server/app-render/collect-segment-data.js.map (22398B)
{"version":3,"sources":["../../../src/server/app-render/collect-segment-data.tsx"],"sourcesContent":["import type {\n CacheNodeSeedData,\n FlightRouterState,\n InitialRSCPayload,\n DynamicParamTypesShort,\n} from './types'\nimport type { ManifestNode } from '../../build/webpack/plugins/flight-manifest-plugin'\n\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { createFromReadableStream } from 'react-server-dom-webpack/client'\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { unstable_prerender as prerender } from 'react-server-dom-webpack/static'\n\nimport {\n streamFromBuffer,\n streamToBuffer,\n} from '../stream-utils/node-web-streams-helper'\nimport { waitAtLeastOneReactRenderTask } from '../../lib/scheduler'\nimport type {\n HeadData,\n LoadingModuleData,\n} from '../../shared/lib/app-router-context.shared-runtime'\nimport {\n type SegmentRequestKey,\n createSegmentRequestKeyPart,\n appendSegmentRequestKeyPart,\n ROOT_SEGMENT_REQUEST_KEY,\n} from '../../shared/lib/segment-cache/segment-value-encoding'\nimport { getDigestForWellKnownError } from './create-error-handler'\n\n// Contains metadata about the route tree. The client must fetch this before\n// it can fetch any actual segment data.\nexport type RootTreePrefetch = {\n buildId: string\n tree: TreePrefetch\n head: HeadData\n isHeadPartial: boolean\n staleTime: number\n}\n\nexport type TreePrefetch = {\n name: string\n paramType: DynamicParamTypesShort | null\n // TODO: When clientParamParsing is enabled, this field is always null.\n // Instead we parse the param on the client, allowing us to omit it from\n // the prefetch response and increase its cacheability. Remove this field\n // once clientParamParsing is enabled everywhere.\n paramKey: string | null\n\n // Child segments.\n slots: null | {\n [parallelRouteKey: string]: TreePrefetch\n }\n\n // Extra fields that only exist so we can reconstruct a FlightRouterState on\n // the client. We may be able to unify TreePrefetch and FlightRouterState\n // after some refactoring, but in the meantime it would be wasteful to add a\n // bunch of new prefetch-only fields to FlightRouterState. So think of\n // TreePrefetch as a superset of FlightRouterState.\n isRootLayout: boolean\n}\n\nexport type SegmentPrefetch = {\n buildId: string\n rsc: React.ReactNode | null\n loading: LoadingModuleData | Promise
\n isPartial: boolean\n}\n\nconst filterStackFrame =\n process.env.NODE_ENV !== 'production'\n ? (require('../lib/source-maps') as typeof import('../lib/source-maps'))\n .filterStackFrameDEV\n : undefined\nconst findSourceMapURL =\n process.env.NODE_ENV !== 'production'\n ? (require('../lib/source-maps') as typeof import('../lib/source-maps'))\n .findSourceMapURLDEV\n : undefined\n\nfunction onSegmentPrerenderError(error: unknown) {\n const digest = getDigestForWellKnownError(error)\n if (digest) {\n return digest\n }\n // We don't need to log the errors because we would have already done that\n // when generating the original Flight stream for the whole page.\n}\n\nexport async function collectSegmentData(\n isClientParamParsingEnabled: boolean,\n fullPageDataBuffer: Buffer,\n staleTime: number,\n clientModules: ManifestNode,\n serverConsumerManifest: any\n): Promise