Unverified Commit ed12b552 authored by Wyatt Johnson's avatar Wyatt Johnson Committed by GitHub

Page Info Cleanup (#59430)

This updates the some of the logic around updating `PageInfo` entries in
the `pageInfos` map. This is a followup to #59420.

Closes NEXT-1838
parent d397b39d
......@@ -14,7 +14,7 @@ import {
import path from 'path'
import fs from 'fs/promises'
import type { PageInfo } from './utils'
import type { PageInfo } from './page-info'
import { loadBindings } from './swc'
import { nonNullable } from '../lib/non-nullable'
import * as ciEnvironment from '../telemetry/ci-info'
......@@ -79,7 +79,7 @@ export async function collectBuildTraces({
staticPages: string[]
hasSsrAmpPages: boolean
outputFileTracingRoot: string
pageInfos: [string, PageInfo][]
pageInfos: Map<string, PageInfo> | undefined
nextBuildSpan?: Span
config: NextConfigComplete
buildTraceContext?: BuildTraceContext
......@@ -642,10 +642,8 @@ export async function collectBuildTraces({
}
// edge routes have no trace files
const [, pageInfo] = pageInfos.find((item) => item[0] === route) || []
if (pageInfo?.runtime === 'edge') {
return
}
const pageInfo = pageInfos?.get(route)
if (pageInfo?.runtime === 'edge') return
const combinedIncludes = new Set<string>()
const combinedExcludes = new Set<string>()
......
This diff is collapsed.
import type { ServerRuntime } from '../../types'
export interface PageInfo {
isHybridAmp?: boolean
size: number
totalSize: number
isStatic: boolean
isSSG: boolean
isPPR: boolean
ssgPageRoutes: string[] | null
initialRevalidateSeconds: number | false
pageDuration: number | undefined
ssgPageDurations: number[] | undefined
runtime: ServerRuntime
hasEmptyPrelude?: boolean
hasPostponed?: boolean
isDynamicAppRoute?: boolean
}
......@@ -23,6 +23,7 @@ import type { AppPageModule } from '../server/future/route-modules/app-page/modu
import type { RouteModule } from '../server/future/route-modules/route-module'
import type { LoaderTree } from '../server/lib/app-dir-module'
import type { NextComponentType } from '../shared/lib/utils'
import type { PageInfo } from './page-info'
import '../server/require-hook'
import '../server/node-polyfill-crypto'
......@@ -326,23 +327,6 @@ const filterAndSortList = (
return pages.sort((a, b) => a.localeCompare(b))
}
export interface PageInfo {
isHybridAmp?: boolean
size: number
totalSize: number
isStatic: boolean
isSSG: boolean
isPPR: boolean
ssgPageRoutes: string[] | null
initialRevalidateSeconds: number | false
pageDuration: number | undefined
ssgPageDurations: number[] | undefined
runtime: ServerRuntime
hasEmptyPrelude?: boolean
hasPostponed?: boolean
isDynamicAppRoute?: boolean
}
export async function printTreeView(
lists: {
pages: ReadonlyArray<string>
......@@ -647,10 +631,15 @@ export async function printTreeView(
messages.push(['', '', ''])
}
pageInfos.set('/404', {
...(pageInfos.get('/404') || pageInfos.get('/_error'))!,
isStatic: useStaticPages404,
})
// We should update the `isStatic` part of the pageInfo for the /404 page.
// When we're using experimental compile, this won't be available.
const pageInfo = pageInfos.get('/404') || pageInfos.get('/_error')
if (pageInfo) {
pageInfos.set('/404', {
...pageInfo,
isStatic: useStaticPages404,
})
}
// If there's no app /_notFound page present, then the 404 is still using the pages/404
if (!lists.pages.includes('/404') && !lists.app?.includes('/_not-found')) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment