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 { ...@@ -14,7 +14,7 @@ import {
import path from 'path' import path from 'path'
import fs from 'fs/promises' import fs from 'fs/promises'
import type { PageInfo } from './utils' import type { PageInfo } from './page-info'
import { loadBindings } from './swc' import { loadBindings } from './swc'
import { nonNullable } from '../lib/non-nullable' import { nonNullable } from '../lib/non-nullable'
import * as ciEnvironment from '../telemetry/ci-info' import * as ciEnvironment from '../telemetry/ci-info'
...@@ -79,7 +79,7 @@ export async function collectBuildTraces({ ...@@ -79,7 +79,7 @@ export async function collectBuildTraces({
staticPages: string[] staticPages: string[]
hasSsrAmpPages: boolean hasSsrAmpPages: boolean
outputFileTracingRoot: string outputFileTracingRoot: string
pageInfos: [string, PageInfo][] pageInfos: Map<string, PageInfo> | undefined
nextBuildSpan?: Span nextBuildSpan?: Span
config: NextConfigComplete config: NextConfigComplete
buildTraceContext?: BuildTraceContext buildTraceContext?: BuildTraceContext
...@@ -642,10 +642,8 @@ export async function collectBuildTraces({ ...@@ -642,10 +642,8 @@ export async function collectBuildTraces({
} }
// edge routes have no trace files // edge routes have no trace files
const [, pageInfo] = pageInfos.find((item) => item[0] === route) || [] const pageInfo = pageInfos?.get(route)
if (pageInfo?.runtime === 'edge') { if (pageInfo?.runtime === 'edge') return
return
}
const combinedIncludes = new Set<string>() const combinedIncludes = new Set<string>()
const combinedExcludes = 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 ...@@ -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 { RouteModule } from '../server/future/route-modules/route-module'
import type { LoaderTree } from '../server/lib/app-dir-module' import type { LoaderTree } from '../server/lib/app-dir-module'
import type { NextComponentType } from '../shared/lib/utils' import type { NextComponentType } from '../shared/lib/utils'
import type { PageInfo } from './page-info'
import '../server/require-hook' import '../server/require-hook'
import '../server/node-polyfill-crypto' import '../server/node-polyfill-crypto'
...@@ -326,23 +327,6 @@ const filterAndSortList = ( ...@@ -326,23 +327,6 @@ const filterAndSortList = (
return pages.sort((a, b) => a.localeCompare(b)) 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( export async function printTreeView(
lists: { lists: {
pages: ReadonlyArray<string> pages: ReadonlyArray<string>
...@@ -647,10 +631,15 @@ export async function printTreeView( ...@@ -647,10 +631,15 @@ export async function printTreeView(
messages.push(['', '', '']) messages.push(['', '', ''])
} }
pageInfos.set('/404', { // We should update the `isStatic` part of the pageInfo for the /404 page.
...(pageInfos.get('/404') || pageInfos.get('/_error'))!, // When we're using experimental compile, this won't be available.
isStatic: useStaticPages404, 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 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')) { 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