/opt/canhelp/node_modules/next/dist/server/app-render
NameSizeModeActions
metadata-insertion/-0755rm
module-loading/-0755rm
rsc/-0755rm
action-async-storage-instance.d.ts1440644editdlrm
action-async-storage-instance.js4460644editdlrm
action-async-storage-instance.js.map5020644editdlrm
action-async-storage.external.d.ts3590644editdlrm
action-async-storage.external.js3990644editdlrm
action-async-storage.external.js.map7040644editdlrm
action-handler.d.ts18070644editdlrm
action-handler.js486910644editdlrm
action-handler.js.map683500644editdlrm
action-utils.d.ts5180644editdlrm
action-utils.js38670644editdlrm
action-utils.js.map54880644editdlrm
after-task-async-storage-instance.d.ts1570644editdlrm
after-task-async-storage-instance.js4590644editdlrm
after-task-async-storage-instance.js.map5220644editdlrm
after-task-async-storage.external.d.ts6490644editdlrm
after-task-async-storage.external.js4190644editdlrm
after-task-async-storage.external.js.map9710644editdlrm
app-render-prerender-utils.d.ts18890644editdlrm
app-render-prerender-utils.js72520644editdlrm
app-render-prerender-utils.js.map108830644editdlrm
app-render-render-utils.d.ts3350644editdlrm
app-render-render-utils.js11520644editdlrm
app-render-render-utils.js.map16080644editdlrm
app-render.d.ts41060644editdlrm
app-render.js1659650644editdlrm
app-render.js.map2406730644editdlrm
async-local-storage.d.ts3160644editdlrm
async-local-storage.js20710644editdlrm
async-local-storage.js.map27990644editdlrm
cache-signal.d.ts12790644editdlrm
cache-signal.js59840644editdlrm
cache-signal.js.map81410644editdlrm
collect-segment-data.d.ts11250644editdlrm
collect-segment-data.js133860644editdlrm
collect-segment-data.js.map223820644editdlrm
create-component-styles-and-scripts.d.ts4100644editdlrm
create-component-styles-and-scripts.js16890644editdlrm
create-component-styles-and-scripts.js.map24200644editdlrm
create-component-tree.d.ts10300644editdlrm
create-component-tree.js417000644editdlrm
create-component-tree.js.map593530644editdlrm
create-error-handler.d.ts13900644editdlrm
create-error-handler.js103860644editdlrm
create-error-handler.js.map140970644editdlrm
create-flight-router-state-from-loader-tree.d.ts5000644editdlrm
create-flight-router-state-from-loader-tree.js38210644editdlrm
create-flight-router-state-from-loader-tree.js.map57150644editdlrm
csrf-protection.d.ts1040644editdlrm
csrf-protection.js30210644editdlrm
csrf-protection.js.map39370644editdlrm
dynamic-access-async-storage-instance.d.ts1630644editdlrm
dynamic-access-async-storage-instance.js4750644editdlrm
dynamic-access-async-storage-instance.js.map5360644editdlrm
dynamic-access-async-storage.external.d.ts3930644editdlrm
dynamic-access-async-storage.external.js4430644editdlrm
dynamic-access-async-storage.external.js.map7620644editdlrm
dynamic-rendering.d.ts61740644editdlrm
dynamic-rendering.js331170644editdlrm
dynamic-rendering.js.map458310644editdlrm
encryption-utils-server.d.ts1410644editdlrm
encryption-utils-server.js48230644editdlrm
encryption-utils-server.js.map71530644editdlrm
encryption-utils.d.ts14430644editdlrm
encryption-utils.js78490644editdlrm
encryption-utils.js.map112570644editdlrm
encryption.d.ts2410644editdlrm
encryption.js118560644editdlrm
encryption.js.map166820644editdlrm
entry-base.d.ts21990644editdlrm
entry-base.js84670644editdlrm
entry-base.js.map62570644editdlrm
flight-render-result.d.ts3530644editdlrm
flight-render-result.js7940644editdlrm
flight-render-result.js.map9670644editdlrm
get-asset-query-string.d.ts1530644editdlrm
get-asset-query-string.js9990644editdlrm
get-asset-query-string.js.map15910644editdlrm
get-css-inlined-link-tags.d.ts5240644editdlrm
get-css-inlined-link-tags.js15490644editdlrm
get-css-inlined-link-tags.js.map25760644editdlrm
get-layer-assets.d.ts5990644editdlrm
get-layer-assets.js33290644editdlrm
get-layer-assets.js.map55030644editdlrm
get-preloadable-fonts.d.ts7090644editdlrm
get-preloadable-fonts.js11600644editdlrm
get-preloadable-fonts.js.map23860644editdlrm
get-script-nonce-from-header.d.ts940644editdlrm
get-script-nonce-from-header.js20170644editdlrm
get-script-nonce-from-header.js.map27850644editdlrm
get-segment-param.d.ts2280644editdlrm
get-segment-param.js15240644editdlrm
get-segment-param.js.map23400644editdlrm
get-short-dynamic-param-type.d.ts3620644editdlrm
get-short-dynamic-param-type.js10690644editdlrm
get-short-dynamic-param-type.js.map11990644editdlrm
has-loading-component-in-tree.d.ts1350644editdlrm
has-loading-component-in-tree.js5440644editdlrm
has-loading-component-in-tree.js.map8130644editdlrm
interop-default.d.ts1210644editdlrm
interop-default.js3910644editdlrm
interop-default.js.map4090644editdlrm
make-get-server-inserted-html.d.ts5000644editdlrm
make-get-server-inserted-html.js46410644editdlrm
make-get-server-inserted-html.js.map65180644editdlrm
parse-and-validate-flight-router-state.d.ts3880644editdlrm
parse-and-validate-flight-router-state.js18350644editdlrm
parse-and-validate-flight-router-state.js.map24290644editdlrm
parse-loader-tree.d.ts4300644editdlrm
parse-loader-tree.js10090644editdlrm
parse-loader-tree.js.map14260644editdlrm
postponed-state.d.ts21530644editdlrm
postponed-state.js64250644editdlrm
postponed-state.js.map92110644editdlrm
prospective-render-utils.d.ts1150644editdlrm
prospective-render-utils.js25870644editdlrm
prospective-render-utils.js.map34120644editdlrm
react-large-shell-error.d.ts1070644editdlrm
react-large-shell-error.js5960644editdlrm
react-large-shell-error.js.map7890644editdlrm
react-server.node.d.ts1520644editdlrm
react-server.node.js11110644editdlrm
react-server.node.js.map7140644editdlrm
render-css-resource.d.ts6120644editdlrm
render-css-resource.js24600644editdlrm
render-css-resource.js.map39470644editdlrm
required-scripts.d.ts4440644editdlrm
required-scripts.js28550644editdlrm
required-scripts.js.map42910644editdlrm
segment-explorer-path.d.ts9560644editdlrm
segment-explorer-path.js38540644editdlrm
segment-explorer-path.js.map52930644editdlrm
server-inserted-html.d.ts2930644editdlrm
server-inserted-html.js15030644editdlrm
server-inserted-html.js.map17710644editdlrm
strip-flight-headers.d.ts2450644editdlrm
strip-flight-headers.js4940644editdlrm
strip-flight-headers.js.map7250644editdlrm
types.d.ts101850644editdlrm
types.js29230644editdlrm
types.js.map132650644editdlrm
use-flight-response.d.ts11360644editdlrm
use-flight-response.js68440644editdlrm
use-flight-response.js.map111740644editdlrm
walk-tree-with-flight-router-state.d.ts13940644editdlrm
walk-tree-with-flight-router-state.js111740644editdlrm
walk-tree-with-flight-router-state.js.map173160644editdlrm
work-async-storage-instance.d.ts1360644editdlrm
work-async-storage-instance.js4380644editdlrm
work-async-storage-instance.js.map4900644editdlrm
work-async-storage.external.d.ts37450644editdlrm
work-async-storage.external.js3870644editdlrm
work-async-storage.external.js.map42140644editdlrm
work-unit-async-storage-instance.d.ts1530644editdlrm
work-unit-async-storage-instance.js4550644editdlrm
work-unit-async-storage-instance.js.map5160644editdlrm
work-unit-async-storage.external.d.ts123010644editdlrm
work-unit-async-storage.external.js78220644editdlrm
work-unit-async-storage.external.js.map210370644editdlrm
Edit: /opt/canhelp/node_modules/next/dist/server/app-render/collect-segment-data.js (13386B)
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "collectSegmentData", { enumerable: true, get: function() { return collectSegmentData; } }); const _jsxruntime = require("react/jsx-runtime"); const _client = require("react-server-dom-webpack/client"); const _static = require("react-server-dom-webpack/static"); const _nodewebstreamshelper = require("../stream-utils/node-web-streams-helper"); const _scheduler = require("../../lib/scheduler"); const _segmentvalueencoding = require("../../shared/lib/segment-cache/segment-value-encoding"); const _createerrorhandler = require("./create-error-handler"); const filterStackFrame = process.env.NODE_ENV !== 'production' ? require('../lib/source-maps').filterStackFrameDEV : undefined; const findSourceMapURL = process.env.NODE_ENV !== 'production' ? require('../lib/source-maps').findSourceMapURLDEV : undefined; function onSegmentPrerenderError(error) { const digest = (0, _createerrorhandler.getDigestForWellKnownError)(error); if (digest) { return digest; } // We don't need to log the errors because we would have already done that // when generating the original Flight stream for the whole page. } async function collectSegmentData(isClientParamParsingEnabled, fullPageDataBuffer, staleTime, clientModules, serverConsumerManifest) { // Traverse the router tree and generate a prefetch response for each segment. // A mutable map to collect the results as we traverse the route tree. const resultMap = new Map(); // Before we start, warm up the module cache by decoding the page data once. // Then we can assume that any remaining async tasks that occur the next time // are due to hanging promises caused by dynamic data access. Note we only // have to do this once per page, not per individual segment. // try { await (0, _client.createFromReadableStream)((0, _nodewebstreamshelper.streamFromBuffer)(fullPageDataBuffer), { findSourceMapURL, serverConsumerManifest }); await (0, _scheduler.waitAtLeastOneReactRenderTask)(); } catch {} // Create an abort controller that we'll use to stop the stream. const abortController = new AbortController(); const onCompletedProcessingRouteTree = async ()=>{ // Since all we're doing is decoding and re-encoding a cached prerender, if // serializing the stream takes longer than a microtask, it must because of // hanging promises caused by dynamic data. await (0, _scheduler.waitAtLeastOneReactRenderTask)(); abortController.abort(); }; // Generate a stream for the route tree prefetch. While we're walking the // tree, we'll also spawn additional tasks to generate the segment prefetches. // The promises for these tasks are pushed to a mutable array that we will // await once the route tree is fully rendered. const segmentTasks = []; const { prelude: treeStream } = await (0, _static.unstable_prerender)(// RootTreePrefetch is not a valid return type for a React component, but // we need to use a component so that when we decode the original stream // inside of it, the side effects are transferred to the new stream. // @ts-expect-error /*#__PURE__*/ (0, _jsxruntime.jsx)(PrefetchTreeData, { isClientParamParsingEnabled: isClientParamParsingEnabled, fullPageDataBuffer: fullPageDataBuffer, serverConsumerManifest: serverConsumerManifest, clientModules: clientModules, staleTime: staleTime, segmentTasks: segmentTasks, onCompletedProcessingRouteTree: onCompletedProcessingRouteTree }), clientModules, { filterStackFrame, signal: abortController.signal, onError: onSegmentPrerenderError }); // Write the route tree to a special `/_tree` segment. const treeBuffer = await (0, _nodewebstreamshelper.streamToBuffer)(treeStream); resultMap.set('/_tree', treeBuffer); // Now that we've finished rendering the route tree, all the segment tasks // should have been spawned. Await them in parallel and write the segment // prefetches to the result map. for (const [segmentPath, buffer] of (await Promise.all(segmentTasks))){ resultMap.set(segmentPath, buffer); } return resultMap; } async function PrefetchTreeData({ isClientParamParsingEnabled, fullPageDataBuffer, serverConsumerManifest, clientModules, staleTime, segmentTasks, onCompletedProcessingRouteTree }) { // We're currently rendering a Flight response for the route tree prefetch. // Inside this component, decode the Flight stream for the whole page. This is // a hack to transfer the side effects from the original Flight stream (e.g. // Float preloads) onto the Flight stream for the tree prefetch. // TODO: React needs a better way to do this. Needed for Server Actions, too. const initialRSCPayload = await (0, _client.createFromReadableStream)(createUnclosingPrefetchStream((0, _nodewebstreamshelper.streamFromBuffer)(fullPageDataBuffer)), { findSourceMapURL, serverConsumerManifest }); const buildId = initialRSCPayload.b; // FlightDataPath is an unsound type, hence the additional checks. const flightDataPaths = initialRSCPayload.f; if (flightDataPaths.length !== 1 && flightDataPaths[0].length !== 3) { console.error('Internal Next.js error: InitialRSCPayload does not match the expected ' + 'shape for a prerendered page during segment prefetch generation.'); return null; } const flightRouterState = flightDataPaths[0][0]; const seedData = flightDataPaths[0][1]; const head = flightDataPaths[0][2]; // Compute the route metadata tree by traversing the FlightRouterState. As we // walk the tree, we will also spawn a task to produce a prefetch response for // each segment. const tree = collectSegmentDataImpl(isClientParamParsingEnabled, flightRouterState, buildId, seedData, clientModules, _segmentvalueencoding.ROOT_SEGMENT_REQUEST_KEY, segmentTasks); const isHeadPartial = await isPartialRSCData(head, clientModules); // Notify the abort controller that we're done processing the route tree. // Anything async that happens after this point must be due to hanging // promises in the original stream. onCompletedProcessingRouteTree(); // Render the route tree to a special `/_tree` segment. const treePrefetch = { buildId, tree, head, isHeadPartial, staleTime }; return treePrefetch; } function collectSegmentDataImpl(isClientParamParsingEnabled, route, buildId, seedData, clientModules, requestKey, segmentTasks) { // Metadata about the segment. Sent as part of the tree prefetch. Null if // there are no children. let slotMetadata = null; const children = route[1]; const seedDataChildren = seedData !== null ? seedData[2] : null; for(const parallelRouteKey in children){ const childRoute = children[parallelRouteKey]; const childSegment = childRoute[0]; const childSeedData = seedDataChildren !== null ? seedDataChildren[parallelRouteKey] : null; const childRequestKey = (0, _segmentvalueencoding.appendSegmentRequestKeyPart)(requestKey, parallelRouteKey, (0, _segmentvalueencoding.createSegmentRequestKeyPart)(childSegment)); const childTree = collectSegmentDataImpl(isClientParamParsingEnabled, childRoute, buildId, childSeedData, clientModules, childRequestKey, segmentTasks); if (slotMetadata === null) { slotMetadata = {}; } slotMetadata[parallelRouteKey] = childTree; } if (seedData !== null) { // Spawn a task to write the segment data to a new Flight stream. segmentTasks.push(// Since we're already in the middle of a render, wait until after the // current task to escape the current rendering context. (0, _scheduler.waitAtLeastOneReactRenderTask)().then(()=>renderSegmentPrefetch(buildId, seedData, requestKey, clientModules))); } else { // This segment does not have any seed data. Skip generating a prefetch // response for it. We'll still include it in the route tree, though. // TODO: We should encode in the route tree whether a segment is missing // so we don't attempt to fetch it for no reason. As of now this shouldn't // ever happen in practice, though. } const segment = route[0]; let name; let paramType = null; let paramKey = null; if (typeof segment === 'string') { name = segment; paramKey = segment; paramType = null; } else { name = segment[0]; paramKey = segment[1]; paramType = segment[2]; } // Metadata about the segment. Sent to the client as part of the // tree prefetch. return { name, paramType, // This value is ommitted from the prefetch response when clientParamParsing // is enabled. The flag only exists while we're testing the feature, in // case there's a bug and we need to revert. // TODO: Remove once clientParamParsing is enabled everywhere. paramKey: isClientParamParsingEnabled ? null : paramKey, slots: slotMetadata, isRootLayout: route[4] === true }; } async function renderSegmentPrefetch(buildId, seedData, requestKey, clientModules) { // Render the segment data to a stream. // In the future, this is where we can include additional metadata, like the // stale time and cache tags. const rsc = seedData[1]; const loading = seedData[3]; const segmentPrefetch = { buildId, rsc, loading, isPartial: await isPartialRSCData(rsc, clientModules) }; // Since all we're doing is decoding and re-encoding a cached prerender, if // it takes longer than a microtask, it must because of hanging promises // caused by dynamic data. Abort the stream at the end of the current task. const abortController = new AbortController(); (0, _scheduler.waitAtLeastOneReactRenderTask)().then(()=>abortController.abort()); const { prelude: segmentStream } = await (0, _static.unstable_prerender)(segmentPrefetch, clientModules, { filterStackFrame, signal: abortController.signal, onError: onSegmentPrerenderError }); const segmentBuffer = await (0, _nodewebstreamshelper.streamToBuffer)(segmentStream); if (requestKey === _segmentvalueencoding.ROOT_SEGMENT_REQUEST_KEY) { return [ '/_index', segmentBuffer ]; } else { return [ requestKey, segmentBuffer ]; } } async function isPartialRSCData(rsc, clientModules) { // We can determine if a segment contains only partial data if it takes longer // than a task to encode, because dynamic data is encoded as an infinite // promise. We must do this in a separate Flight prerender from the one that // actually generates the prefetch stream because we need to include // `isPartial` in the stream itself. let isPartial = false; const abortController = new AbortController(); (0, _scheduler.waitAtLeastOneReactRenderTask)().then(()=>{ // If we haven't yet finished the outer task, then it must be because we // accessed dynamic data. isPartial = true; abortController.abort(); }); await (0, _static.unstable_prerender)(rsc, clientModules, { filterStackFrame, signal: abortController.signal, onError () {}, onPostpone () { // If something postponed, i.e. when Cache Components is not enabled, we can // infer that the RSC data is partial. isPartial = true; } }); return isPartial; } function createUnclosingPrefetchStream(originalFlightStream) { // When PPR is enabled, prefetch streams may contain references that never // resolve, because that's how we encode dynamic data access. In the decoded // object returned by the Flight client, these are reified into hanging // promises that suspend during render, which is effectively what we want. // The UI resolves when it switches to the dynamic data stream // (via useDeferredValue(dynamic, static)). // // However, the Flight implementation currently errors if the server closes // the response before all the references are resolved. As a cheat to work // around this, we wrap the original stream in a new stream that never closes, // and therefore doesn't error. const reader = originalFlightStream.getReader(); return new ReadableStream({ async pull (controller) { while(true){ const { done, value } = await reader.read(); if (!done) { // Pass to the target stream and keep consuming the Flight response // from the server. controller.enqueue(value); continue; } // The server stream has closed. Exit, but intentionally do not close // the target stream. return; } } }); } //# sourceMappingURL=collect-segment-data.js.map