next.js
07189c52 - Expose edge runtime fields in build-complete (#91239)

Commit
1 day ago
Expose edge runtime fields in build-complete (#91239) ### What? - Add canonical edge entrypoint metadata to edge function definitions in the middleware manifest. - Surface that canonical entrypoint through `build-complete` as `edgeRuntime` metadata in adapter outputs. - Update middleware and adapter tests to assert the new metadata instead of relying on bundler-specific emitted file names. ### Why? Adapter consumers need a stable way to load and invoke edge outputs without depending on `next-server`'s sandbox handling or guessing which emitted file is the executable entrypoint. The existing checks were also brittle across webpack and Turbopack because the emitted file lists can differ. ### How? - Add an optional `entrypoint` field to `EdgeFunctionDefinition` and populate it in both the webpack middleware manifest generator and the Turbopack manifest emitters for app, pages, and middleware edge functions. - In `packages/next/src/build/adapter/build-complete.ts`, use that canonical entrypoint for `filePath` and expose `edgeRuntime.modulePath`, `edgeRuntime.entryKey`, and `edgeRuntime.handlerExport` for edge outputs. - Adjust the middleware manifest tests to validate cross-bundler invariants and add adapter-config coverage for the new `edgeRuntime` fields.
Author
Parents
Loading