Repository: vercel/next.js
File: packages/next/src/build/index.ts (TypeScript)

Code before:
                hasPostponed,
                hasEmptyStaticShell,
                initialCacheControl: cacheControl,
              })

              if (cacheControl.revalidate !== 0) {
                const normalizedRoute = normalizePagePath(route.pathname)

                let dataRoute: string | null
                if (isAppRouteHandler) {
                  dataRoute = null
                } else {
                  dataRoute = path.posix.join(`${normalizedRoute}${RSC_SUFFIX}`)
                }

                const meta = collectMeta(metadata)
                const status =
                  route.pathname === UNDERSCORE_NOT_FOUND_ROUTE
                    ? 404
                    : meta.status

                const canUseStaticPrefetchDataRoute =
                  isRoutePPREnabled &&
                  metadata?.postponed == null &&
                  dataRoute &&
                  existsSync(
                    path.join(
                      distDir,
                      'server',
                      'app',
                      dataRoute.replace(/^\//, '')
                    )
                  )

                prerenderManifest.routes[route.pathname] = {
                  initialStatus: status,
                  initialHeaders: meta.headers,
                  renderingMode: isAppPPREnabled
                    ? isRoutePPREnabled
                      ? RenderingMode.PARTIALLY_STATIC
                      : RenderingMode.STATIC
                    : undefined,
                  experimentalPPR: isRoutePPREnabled,
                  experimentalBypassFor: bypassFor,
                  initialRevalidateSeconds: cacheControl.revalidate,
                  initialExpireSeconds: cacheControl.expire,
                  srcRoute: page,
                  dataRoute,
                  prefetchDataRoute: canUseStaticPrefetchDataRoute
                    ? dataRoute
                    : undefined,

Review comment (suggestion):
If we're doing an fs check in here ideally we make this a `Promise.all` and us async fs method, but would be nice if we just have same condition in `export` so we don't need `fs` check

Code after:

              // update the page (eg /blog/[slug]) to also have the postpone metadata
              pageInfos.set(page, {
                ...(pageInfos.get(page) as PageInfo),
                hasPostponed,
                hasEmptyStaticShell,
                initialCacheControl: cacheControl,
              })

              if (cacheControl.revalidate !== 0) {
                const normalizedRoute = normalizePagePath(route.pathname)

                let dataRoute: string | null
                if (isAppRouteHandler) {
                  dataRoute = null
                } else {
                  dataRoute = path.posix.join(`${normalizedRoute}${RSC_SUFFIX}`)
                }
                const prefetchDataRoute =
                  isRoutePPREnabled && dataRoute && hasStaticRsc
                    ? dataRoute
                    : undefined

                const meta = collectMeta(metadata)
                const status =
                  route.pathname === UNDERSCORE_NOT_FOUND_ROUTE
                    ? 404
                    : meta.status

                prerenderManifest.routes[route.pathname] = {
                  initialStatus: status,
                  initialHeaders: meta.headers,
                  renderingMode: isAppPPREnabled
                    ? isRoutePPREnabled
                      ? RenderingMode.PARTIALLY_STATIC
                      : RenderingMode.STATIC
                    : undefined,
                  experimentalPPR: isRoutePPREnabled,
                  experimentalBypassFor: bypassFor,
                  initialRevalidateSeconds: cacheControl.revalidate,
                  initialExpireSeconds: cacheControl.expire,
                  srcRoute: page,
                  dataRoute,
                  prefetchDataRoute,
                  allowHeader: ALLOWED_HEADERS,
                }
              } else {
                hasRevalidateZero = true

                if (ssgPageRoutesSet.has(route.pathname)) {
                  const pageInfo = pageInfos.get(page) as PageInfo