Turbopack: give borrowed exports a shared unmangled view
Turns the wasm-specific fix from the previous commit into an
`EcmascriptExports::borrowed()` helper and applies it to the other two modules
that hand out another module's exports value as their own:
`SideEffectsModule` (forwards `resolved_as`) and `EcmascriptClientReferenceModule`
(forwards the proxy module).
All three are the same hazard. Mangling is decided per module — the producing
side keys on the module whose code generation emits the export object, the
consuming side on the module it imports from — so an exports value shared by two
module identities lets the two sides compute different keys for the same export,
and the import resolves to `undefined`. The helper is the one place that
invariant is written down.
The client-reference and side-effects modules had not been observed failing:
client references are chunk-group entries and back off for that reason anyway,
and the side-effects module only appears with module fragments enabled. Both are
latent rather than reproducible, but they are the same bug.
Co-authored-by: Luke Sandberg <210140+lukesandberg@users.noreply.github.com>
Co-authored-by: Tobias Koppers <1365881+sokra@users.noreply.github.com>