rsnext/packages/next-server/server/get-page-files.ts
Tim Neutkens 8873242b0b
Move getPageFiles and convert to ts (#5841)
* Move getPageFiles and convert to ts

# Conflicts:
#	packages/next-server/server/render.js

* Fix unit tests
2018-12-07 13:35:01 +01:00

19 lines
447 B
TypeScript

import {normalizePagePath} from './require'
type BuildManifest = {
pages: {
[page: string]: string[]
}
}
export function getPageFiles (buildManifest: BuildManifest, page: string): string[] {
const normalizedPage = normalizePagePath(page)
const files = buildManifest.pages[normalizedPage]
if (!files) {
console.warn(`Could not find files for ${normalizedPage} in .next/build-manifest.json`)
return []
}
return files
}