3d1a287207
## Feature This PR introduces the ability to provide `runtime: "edge"` in API endpoints, the same as the experimental RSC runtime configurations. - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes by running `yarn lint`
36 lines
853 B
TypeScript
36 lines
853 B
TypeScript
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
|
|
nextEdgeApiFunction?: EdgeMiddlewareMeta
|
|
nextEdgeSSR?: EdgeSSRMeta
|
|
nextUsedEnvVars?: Set<string>
|
|
nextWasmMiddlewareBinding?: WasmBinding
|
|
usingIndirectEval?: boolean | Set<string>
|
|
route?: RouteMeta
|
|
}
|
|
}
|
|
|
|
export interface RouteMeta {
|
|
page: string
|
|
absolutePagePath: string
|
|
}
|
|
|
|
export interface EdgeMiddlewareMeta {
|
|
page: string
|
|
}
|
|
|
|
export interface EdgeSSRMeta {
|
|
isServerComponent: boolean
|
|
page: string
|
|
}
|
|
|
|
export interface WasmBinding {
|
|
filePath: string
|
|
name: string
|
|
}
|