Repository navigation
fix: generate valid bindings for shimmed exports - #11074
Conversation
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The normalization is correctly scoped and the regression test comprehensively exercises the affected output paths.
Review effort: Balanced
Findings: None
What changed in this PR
Ensures shimmed missing exports with arbitrary names produce valid JavaScript bindings while retaining their original export names.
Changes:
- Normalizes shimmed export names before creating symbols.
- Adds coverage for empty, invalid, colliding, escaped, and reserved names across formats and minification modes.
| File | Description |
|---|---|
crates/rolldown/src/stages/link_stage/bind_imports_and_exports.rs |
Creates valid local symbols for shimmed exports. |
packages/rolldown/tests/behaviors/shim-missing-export-names.test.ts |
Verifies names and values across shim modes, formats, and minification settings. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Merging this PR will improve performance by 3.71%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ⚡ | bundle@multi-duplicated-top-level-symbol |
582.4 ms | 561.6 ms | +3.71% |
Tip
Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.
Comparing fix/shim-export-identifiers (8e4bc0e) with fix/export-rendering-diagnostics (5dc1a20)
Footnotes
-
10 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
fc2117b to
71f34ab
Compare
71f34ab to
8e4bc0e
Compare
Missing exports named
""or"a-b"can produce invalid declarations whenshimMissingExportsor theemptyloader supplies their values. Generate valid local bindings while preserving the original export names.For an empty export name, the shim declaration changes from:
to:
Normalize the shim's suggested binding name before symbol creation. The existing renamer resolves collisions with other shims and user bindings.