next.js
efbfe559 - Classify namespace member accesses and analyze this-usage of exports

Commit
20 days ago
Classify namespace member accesses and analyze this-usage of exports Prefactor for constant ESM import bindings (#98603). - Add `NamespaceAccess`, which classifies a namespace member access as a read, a call (`ns.f()`, `ns.f?.()`, tagged templates) or a write (assignments, updates, destructuring targets, `delete`). The graph visitor computes it and carries it on `Effect::ImportedBinding`, and `EsmBinding` takes it instead of the `keep_this` flag, so `EsmBinding::new_keep_this` is gone. - Decide whether to call an import through `(0, …)` with `is_this_receiver_position`, which looks through parentheses and also covers optional calls and tagged templates. - Analyze whether each exported local binding may observe `this` when called (`ThisUsage` in the import map), and store it on the new `LocalBinding` struct of `EsmExport::LocalBinding`. Nothing consumes it yet, so code generation stays conservative. - Move `AssignmentScopes` next to its only user in `imports.rs`.
Author
Committer
Parents
Loading