rsnext/packages/next/build/webpack/loaders/get-module-build-info.ts
JJ Kasper 6fd2a7fa31
Remove webpack4 types (#39631)
These types are no longer needed as we are only leveraging webpack 5 so this finishes migrating our types away from webpack 4's types.
2022-08-16 09:55:37 +00:00

39 lines
963 B
TypeScript

import { webpack } 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: webpack.Module) {
return webpackModule.buildInfo as {
nextEdgeMiddleware?: EdgeMiddlewareMeta
nextEdgeApiFunction?: EdgeMiddlewareMeta
nextEdgeSSR?: EdgeSSRMeta
nextUsedEnvVars?: Set<string>
nextWasmMiddlewareBinding?: AssetBinding
nextAssetMiddlewareBinding?: AssetBinding
usingIndirectEval?: boolean | Set<string>
route?: RouteMeta
importLocByPath?: Map<string, any>
}
}
export interface RouteMeta {
page: string
absolutePagePath: string
}
export interface EdgeMiddlewareMeta {
page: string
matcherRegexp?: string
}
export interface EdgeSSRMeta {
isServerComponent: boolean
page: string
}
export interface AssetBinding {
filePath: string
name: string
}