20486c159d
* [edge] allow importing blob assets * Fix test * extract to a new file, to make it easier to read and review * Use webpack asset discovery and transform with a loader * fix tests * don't prefix assets * use emitFile * rename assets to blobs to be more specific * rename blobs to assets and use webpack's hashing algo * Dedupe correctly * Add a Node.js dep test * Update packages/next/server/next-server.ts Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com> * [code review] test remote URL fetches * [code review] use `import type` for type-only imports * Update packages/next/server/next-server.ts Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com> * Apply suggestions from code review Co-authored-by: JJ Kasper <jj@jjsweb.site> Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com> Co-authored-by: JJ Kasper <jj@jjsweb.site>
39 lines
965 B
TypeScript
39 lines
965 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?: 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
|
|
}
|