2ba352da39
* Initial move * Make emitting work * Update paths * Remove leftover files * Add correct externals configuration * Import correct path * Update path to work with ts-server test * Update lib directory * Compile next-server/lib
30 lines
636 B
TypeScript
30 lines
636 B
TypeScript
import { normalizePagePath } from './normalize-page-path'
|
|
|
|
export type BuildManifest = {
|
|
devFiles: string[]
|
|
pages: {
|
|
[page: string]: string[]
|
|
}
|
|
}
|
|
|
|
export function getPageFiles(
|
|
buildManifest: BuildManifest,
|
|
page: string
|
|
): string[] {
|
|
const normalizedPage = normalizePagePath(page)
|
|
let files = buildManifest.pages[normalizedPage]
|
|
|
|
if (!files) {
|
|
files = buildManifest.pages[normalizedPage.replace(/\/index$/, '') || '/']
|
|
}
|
|
|
|
if (!files) {
|
|
// tslint:disable-next-line
|
|
console.warn(
|
|
`Could not find files for ${normalizedPage} in .next/build-manifest.json`
|
|
)
|
|
return []
|
|
}
|
|
|
|
return files
|
|
}
|