[turbopack] Use options object for ESM references (#98680)
### What? Introduce `EsmAssetReferenceOptions`, an explicit options object for ESM asset references. ### Why? `EsmAssetReference::new` and `new_pure` accepted a long positional list of behavioral settings. Call sites were difficult to scan and easy to misconfigure as the reference grows new behavior. This is intentionally a behavior-neutral, independently reviewable base for the two existing tree-shaking PRs above it: 1. This PR centralizes constructor configuration. 2. #96282 uses the options object to configure re-export usage forwarding. 3. #96396 tracks static member reads through namespace-valued re-exports. ### How? Keep the three reference-identity inputs (`module`, `origin`, and `request`) positional, and move behavioral settings—source location, annotations, target part, import usage, externals, module-fragment mode, and resolve override—into a named options struct. The two constructor call sites now declare their settings by field name. The refactor removes the `too_many_arguments` allowances without changing resolution or binding-usage behavior. ### Testing - `cargo check -p turbopack-ecmascript` - Analyzer graph tests: 60/60 - The stacked focused execution/snapshot tests, 2/2 usage-lattice units, `build-all`, and HMR regression are verified on the upper PRs. <!-- NEXT_JS_LLM --> <!-- fleet 993ef5d6-cc80-4082-8e14-ff9ac871ce33 --> Co-authored-by:vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by:
Tobias Koppers <1365881+sokra@users.noreply.github.com> Co-authored-by:
Luke Sandberg <210140+lukesandberg@users.noreply.github.com>
Showing
Please
register
or
sign in
to comment