Fix lazy dynamic import reloads and module evaluation (#101937)
### What?
Extract the bugfixes from #101873 so they can merge before lazy dynamic
imports are enabled by default. Both defaults remain unchanged.
### Why?
Lazy imports can cause false reloads, return the wrong module namespace,
or fail during loader evaluation when explicitly enabled.
### How?
- Avoid false full-page reloads when lazy compilation advances the HMR
version without a file edit. Each connection checks the version only on
its first versioned `turbopack-subscribe`, which still catches updates
missed through stale HTML or a dropped connection (a reconnect is a new
connection and is checked again). Later mismatches on the same
connection are ignored, since compiling a lazy chunk list advances the
version without the client missing an update.
- Return an ESM namespace when a manifest loader target is already
available instead of returning raw CommonJS exports.
- Include lazily compiled import targets in `this.importModule()`
graphs, because loader evaluation runs in a separate process that cannot
activate lazy imports. The graph is built with a new
`ModuleGraphOptions::assume_activated` that follows the targets of
lazy-import proxies, and those proxies generate their loading code in
such graphs. Modules stay shared with the app instead of being processed
a second time in a copy of the asset context. Explicitly enable both
lazy-import flags in the existing loader fixture so its nested
dynamic-import assertions cover this independently of the defaults, and
check that a module imported by both the app and the loader is processed
only as often as one that only the app imports.
- Fix the runtime navigation HMR test to require the timing-dependent
Fast Refresh log only for webpack.
### Verification
- An earlier version of the combined implementation, with the previous
forked-context importModule fix, passed CI in run 43967218926, attempt
2.
- The standalone bugfix branch passes the importModule suite in
Turbopack development, webpack development, and Turbopack production
modes with the explicit flags.
- Mutation checks: with no eager handling, the importModule suite fails
because loader evaluation returns unsupported values. With the earlier
forked asset context, the new processing-count assertion fails (2 runs
against 1 for the control module).
- `pnpm test-dev-turbo` on the importModule suite and the
`lazy-dynamic-imports`, `lazy-dynamic-nested-imports` and
`lazy-dynamic-chunk-list-collision` suites; `pnpm test-start-turbo` and
`pnpm test-dev-webpack` on the importModule suite.
- Manually: activating a lazy import in the browser doesn't re-run the
loader, editing a lazy target re-runs only the importModule loader, and
a restart with the persistent dev cache re-runs no loaders (checked on
an earlier build of this fix, before the final refactors).
<!-- NEXT_JS_LLM -->