feat: tree-shake export default <namespace> re-exports#9574
feat: tree-shake export default <namespace> re-exports#9574IWANABETHATGUY wants to merge 1 commit into
export default <namespace> re-exports#9574Conversation
How to use the Graphite Merge QueueAdd the label graphite: merge-when-ready to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
✅ Deploy Preview for rolldown-rs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for rolldown-rs canceled.
|
9ba18a0 to
77d0d8c
Compare
77d0d8c to
b4a0ce1
Compare
export default <namespace> re-exports
Merging this PR will not alter performance
Comparing Footnotes
|
Concern:
|
@rolldown/browser
@rolldown/debug
rolldown
@rolldown/binding-android-arm64
@rolldown/binding-darwin-arm64
@rolldown/binding-darwin-x64
@rolldown/binding-freebsd-x64
@rolldown/binding-linux-arm-gnueabihf
@rolldown/binding-linux-arm64-gnu
@rolldown/binding-linux-arm64-musl
@rolldown/binding-linux-ppc64-gnu
@rolldown/binding-linux-s390x-gnu
@rolldown/binding-linux-x64-gnu
@rolldown/binding-linux-x64-musl
@rolldown/binding-openharmony-arm64
@rolldown/binding-wasm32-wasi
@rolldown/binding-win32-arm64-msvc
@rolldown/binding-win32-x64-msvc
commit: |

Summary
Extends the existing namespace re-export tree-shaking so that
export default ns(wherensisimport * as ns from '...') chains through the underlying module, just like the namedexport { ns as default }shape already does. In the scanner,LocalExport["default"].referencedis rewired to the namespace local, lettingbind_imports_and_exports's re-export chain propagate and member-expression resolution descend into only the accessed exports.Before
bundled to:
After
Test plan
crates/rolldown/tests/rolldown/tree_shaking/:default_export_namespace— primary casedefault_export_namespace_with_star— combined withexport * fromdefault_export_namespace_cjs— CJS importeedefault_export_namespace_member_write— write through the chaindefault_export_namespace_aliased— bothexport default nsandexport { ns as foo }cargo clippy -p rolldown --testsclean