Repository navigation
fix(renamer): keep generated top-level names off inner bindings - #11121
Merged
Merged
Conversation
✅ Deploy Preview for rolldown-rs canceled.
|
IWANABETHATGUY
force-pushed
the
refactor/hygienic-renamer
branch
from
October 6, 2026 06:10
9b2caff to
d114c59
Compare
IWANABETHATGUY
force-pushed
the
refactor/hygienic-renamer
branch
from
October 6, 2026 07:20
d114c59 to
2ad8ba0
Compare
IWANABETHATGUY
changed the base branch from
main
to
fix/renamer-printed-name-captures
October 6, 2026 07:20
IWANABETHATGUY
force-pushed
the
refactor/hygienic-renamer
branch
from
October 6, 2026 17:56
2ad8ba0 to
9ef0dd3
Compare
IWANABETHATGUY
force-pushed
the
refactor/hygienic-renamer
branch
from
October 7, 2026 08:55
e3108d5 to
cc8ad8e
Compare
IWANABETHATGUY
force-pushed
the
refactor/hygienic-renamer
branch
3 times, most recently
from
October 7, 2026 12:46
42a7e8a to
91ee941
Compare
IWANABETHATGUY
added a commit
that referenced
this pull request
Oct 7, 2026
…aptures (#11129) A local named like a namespace binding captured imports printed through it (`node_path.join`, `import_x.default`), even in a module that reaches the external only through a re-export. #11121 also depends on it: it drops the captured-names list that covered the IIFE factory param case of #9375. refs #10970 **before this pr** https://repl.rolldown.rs/#eNplUk1vgzAM/StWLrQSSu/sNPW267RTqUYGBtKBg0LohxD/fU5oKdtOSWznPb9nj6IUyShapUmeen8lkSzPWOT82u3ggwq0sH97BzO4bnAxZCejKQPdg0VVgKutGaqaTwS8OrSkmqgHUi32ncoRvjQVmirYZGQK/OyUq2WA2MYpMQOekaBGizFc/AGhLvF1gcVQc/NUeY1PtswiXjtjHTebSXiFTllmZPrAXATkJ2EG7dA7IOMgV50bmEU7mZJuPQaM4BuCCUprWojkboUevaSU0vyEcqDcaUNB+maB38KYEnCQkQkO7tahKQNmzJz3oiMDTSmxtSgSZwecYrHieUxgHZqncOf+0+Rikm9QeCzTNIW5kMwNlbqS7gn5PzMjL/ILLDXhPqQXhse3aGUAF6qhCefyYRPEa+LtSGCGlDwKJUOIhwzLYiRwWDV+DLl5rxLuojS2VXyLcrYdJs5O21kbL9K3qpA9MSxoVvUrNusJjaSiwA55bSnX2KeCkdl27/zESGcua5TD3onpB1lYDb0=
IWANABETHATGUY
force-pushed
the
refactor/hygienic-renamer
branch
2 times, most recently
from
October 7, 2026 17:06
dae4452 to
cdf10ca
Compare
IWANABETHATGUY
marked this pull request as ready for review
October 8, 2026 02:10
Merging this PR will not alter performance
Comparing Footnotes
|
hyfdev
approved these changes
Oct 8, 2026
A CJS-wrapped module's top-level locals are printed inside its `__commonJS` closure, so they stay out of the chunk namespace (#7425). When one shadowed a name rolldown generates, the root-scope loop renamed it against the chunk's top-level names only, which could land it on a sibling local the resolver never saw (#10970, cases 1 and 3). Every kind of generated reference (wrapper calls, namespace objects, `import_x`, runtime helpers, `require_<chunk>` bindings, IIFE/UMD factory params) also needed its own shadowing pass. Names rolldown invents now never take a name that a nested-scope binding or a CJS-closure binding of the chunk uses (`InnerBindingNames`), so no source binding can capture a reference the finalizer prints. Source-named top-level bindings (`RootBindingKind::Authored`) keep the old rules. CJS closure locals are no longer named at the chunk level at all; the nested-scope passes rename one only when it would capture a source reference. This removes `collect_chunk_scope_captured_names`, `rename_cjs_locals_shadowing_referenced_chunk_bindings` and `override_root_scope_binding`. It also fixes captures the old passes missed: a wrapper renamed onto an importer's parameter, a nested `require_dep`, `import_dep` or `__toESM` param, a CJS local named like a runtime helper, and a `require_<chunk>` binding under CJS output. The four CJS-shadowing fixtures now suffix the generated wrapper or namespace instead of the source's local.
IWANABETHATGUY
force-pushed
the
refactor/hygienic-renamer
branch
from
October 8, 2026 04:02
cdf10ca to
2d9308f
Compare
Merged
shulaoda
added a commit
that referenced
this pull request
Oct 14, 2026
## [1.2.14] - 2026-10-14 ### 🚀 Features - add `output.charset` option (#11194) by @sapphi-red - code-splitting: route independent ESM re-exports per consumer (#11177) by @hyfdev ### 🐛 Bug Fixes - handle `output.charset: 'ascii'` + `output.minify: false` (#11207) by @sapphi-red - tree-shaking: preserve initialization of wrapped ESM re-exports (#11167) by @hyfdev - sourcemap: preserve boundaries when tracing has no mapping (#11170) by @sapphi-red - strict-execution-order: account for init imports during code splitting (#11162) by @hyfdev - strict-execution-order: avoid eager loading through mixed re-exports (#11151) by @hyfdev - tree-shake expression statements that coerce known constants (#10825) by @IWANABETHATGUY - shim-missing-exports: shim deep namespace reads through default imports (#11184) by @IWANABETHATGUY - shim-missing-exports: shim missing static namespace members (#11179) by @hyfdev - preserve-entry-signatures: keep internal bindings out of entry exports (#11094) by @hyfdev - report ASSIGN_TO_IMPORT for writes to re-exported namespace members (#11148) by @IWANABETHATGUY - dev: keep files loaded by the HMR stage watched when the same task rebuilds (#11154) by @Brooooooklyn - dev: watch lazily compiled files even when a build starts first (#11152) by @Brooooooklyn - cjs: print a CommonJS module's top-level `this` as a wrapper parameter rolldown names (#11135) by @IWANABETHATGUY - renamer: keep fixed names off the bindings that would capture them (#11134) by @IWANABETHATGUY - renamer: keep an external `require()` local in a CJS module off the top-level names (#11133) by @IWANABETHATGUY - rolldown: make a repeated `close()` a no-op (#11142) by @Brooooooklyn - avoid renaming entry top-level bindings onto their nested bindings (#11122) by @IWANABETHATGUY - renamer: keep generated top-level names off inner bindings (#11121) by @IWANABETHATGUY ### 🚜 Refactor - renamer: treat a CJS-wrapped module's root scope as an inner scope (#11130) by @IWANABETHATGUY ### 📚 Documentation - add renaming design and implementation docs (#11131) by @IWANABETHATGUY ### ⚡ Performance - ci: overlap independent setup, checks, and artifacts (#11169) by @hyfdev ### 🧪 Testing - dev: use dunce::canonicalize so dev engine tests pass on Windows (#11192) by @shulaoda - preserve-entry-signatures: cover nested dynamic imports (#11164) by @hyfdev ### ⚙️ Miscellaneous Tasks - deps: upgrade oxc to 0.154.0 (#11209) by @shulaoda - make Security Analysis pass again (security-action v1.0.10, serde_yaml -> saphyr) (#11197) by @Brooooooklyn - deps: update rollup submodule for tests to v4.64.5 (#11190) by @rolldown-guard[bot] - deps: update test262 submodule for tests (#11191) by @rolldown-guard[bot] - deps: update crate-ci/typos action to v1.51.1 (#11174) by @renovate[bot] - vite-tests: link the workspace rolldown into the Vite clone again (#11147) by @Brooooooklyn Co-authored-by: shulaoda <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Renaming could redeclare a sibling local inside a
__commonJSMinclosure, or let a local capture a reference rolldown generates (require_x(),__toESM,import_x,require_<chunk>), because CJS closure locals and generated references were invisible to most renaming passes. Generated names now take the$Nsuffix instead of the source's locals, which is why four existing snapshots changed.fixes #10970
refs #10971 (its fixtures are included)