2022-04-30 13:19:27 +02:00
|
|
|
import { webpack5 } from 'next/dist/compiled/webpack/webpack'
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A getter for module build info that casts to the type it should have.
|
|
|
|
* We also expose here types to make easier to use it.
|
|
|
|
*/
|
|
|
|
export function getModuleBuildInfo(webpackModule: webpack5.Module) {
|
|
|
|
return webpackModule.buildInfo as {
|
|
|
|
nextEdgeMiddleware?: EdgeMiddlewareMeta
|
2022-06-13 20:17:44 +02:00
|
|
|
nextEdgeApiFunction?: EdgeMiddlewareMeta
|
2022-04-30 13:19:27 +02:00
|
|
|
nextEdgeSSR?: EdgeSSRMeta
|
|
|
|
nextUsedEnvVars?: Set<string>
|
|
|
|
nextWasmMiddlewareBinding?: WasmBinding
|
|
|
|
usingIndirectEval?: boolean | Set<string>
|
2022-05-13 19:48:53 +02:00
|
|
|
route?: RouteMeta
|
2022-04-30 13:19:27 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-13 19:48:53 +02:00
|
|
|
export interface RouteMeta {
|
|
|
|
page: string
|
|
|
|
absolutePagePath: string
|
|
|
|
}
|
|
|
|
|
2022-04-30 13:19:27 +02:00
|
|
|
export interface EdgeMiddlewareMeta {
|
|
|
|
page: string
|
2022-06-03 18:35:44 +02:00
|
|
|
matcherRegexp?: string
|
2022-04-30 13:19:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface EdgeSSRMeta {
|
|
|
|
isServerComponent: boolean
|
|
|
|
page: string
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface WasmBinding {
|
|
|
|
filePath: string
|
|
|
|
name: string
|
|
|
|
}
|