File size: 1,115 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
import { denormalizePagePath } from '../shared/lib/page-path/denormalize-page-path'
import { normalizePagePath } from '../shared/lib/page-path/normalize-page-path'
export type BuildManifest = {
devFiles: readonly string[]
ampDevFiles: readonly string[]
polyfillFiles: readonly string[]
lowPriorityFiles: readonly string[]
rootMainFiles: readonly string[]
// this is a separate field for flying shuttle to allow
// different root main files per entries/build (ideally temporary)
// until we can stitch the runtime chunks together safely
rootMainFilesTree: { [appRoute: string]: readonly string[] }
pages: {
'/_app': readonly string[]
[page: string]: readonly string[]
}
ampFirstPages: readonly string[]
}
export function getPageFiles(
buildManifest: BuildManifest,
page: string
): readonly string[] {
const normalizedPage = denormalizePagePath(normalizePagePath(page))
let files = buildManifest.pages[normalizedPage]
if (!files) {
console.warn(
`Could not find files for ${normalizedPage} in .next/build-manifest.json`
)
return []
}
return files
}
|