Skip to content

fix: generate valid bindings for shimmed exports - #11074

Merged
hyfdev merged 1 commit into
fix/export-rendering-diagnosticsfrom
fix/shim-export-identifiers
Oct 2, 2026
Merged

hyfdev merged 1 commit into
fix/export-rendering-diagnosticsfrom
fix/shim-export-identifiers

Conversation

@hyfdev

@hyfdev hyfdev commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

Missing exports named "" or "a-b" can produce invalid declarations when shimMissingExports or the empty loader supplies their values. Generate valid local bindings while preserving the original export names.

For an empty export name, the shim declaration changes from:

var  = void 0;

to:

var _ = void 0;

Normalize the shim's suggested binding name before symbol creation. The existing renamer resolves collisions with other shims and user bindings.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://fix-shim-export-identifiers-rolldown-rs.voidzero-docs.workers.dev (commit 8e4bc0e)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://7d8a06d4-rolldown-rs.voidzero-docs.workers.dev 8e4bc0e 2026-10-02T04:05:51.095Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://cd9f8525-rolldown-rs.voidzero-docs.workers.dev 71f34ab 2026-10-02T03:46:05.644Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://e7c482ed-rolldown-rs.voidzero-docs.workers.dev fc2117b 2026-10-02T03:16:45.114Z Visit the dashboard ↗

@hyfdev
hyfdev added this pull request to stack #11078 October 2, 2026 03:17
@hyfdev
hyfdev marked this pull request as ready for review October 2, 2026 03:28
Copilot AI balanced review requested due to automatic review settings October 2, 2026 03:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@codspeed

codspeed Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Merging this PR will improve performance by 3.71%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 1 improved benchmark
✅ 6 untouched benchmarks
⏩ 10 skipped benchmarks1

Performance Changes

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)

Open in CodSpeed

Footnotes

  1. 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. ↩

@hyfdev
hyfdev force-pushed the fix/shim-export-identifiers branch from fc2117b to 71f34ab Compare October 2, 2026 03:43
@hyfdev
hyfdev force-pushed the fix/shim-export-identifiers branch from 71f34ab to 8e4bc0e Compare October 2, 2026 04:03
@hyfdev
hyfdev merged commit 9a5b179 into fix/export-rendering-diagnostics Oct 2, 2026
33 checks passed
@hyfdev
hyfdev deleted the fix/shim-export-identifiers branch October 2, 2026 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants