Skip to content

fix: use computed access for arbitrary import names - #11075

Merged
hyfdev merged 1 commit into
fix/shim-export-identifiersfrom
fix/arbitrary-import-properties
Oct 2, 2026
Merged

hyfdev merged 1 commit into
fix/shim-export-identifiersfrom
fix/arbitrary-import-properties

Conversation

@hyfdev

@hyfdev hyfdev commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

Imported names such as "" and "a-b" can produce invalid or incorrect dot accesses. Use computed property access when the imported name is not a valid identifier.

For import { "a-b" as value } from "dep", a read can be emitted as:

console.log(dep.a-b);

The corrected access is:

console.log(dep["a-b"]);

Apply the existing property access helpers to imported expressions and chunk re-exports. Imported calls retain their unbound this, and property reads remain live.

@hyfdev
hyfdev added this pull request to stack #11078 October 2, 2026 03:17
@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-arbitrary-import-properties-rolldown-rs.voidzero-docs.workers.dev (commit d2b4b4f)

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://20394b87-rolldown-rs.voidzero-docs.workers.dev d2b4b4f 2026-10-02T04:06:11.372Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://71497b00-rolldown-rs.voidzero-docs.workers.dev aad31cd 2026-10-02T03:45:57.877Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://5da361db-rolldown-rs.voidzero-docs.workers.dev 45ce087 2026-10-02T03:17:32.528Z Visit the dashboard ↗

@hyfdev
hyfdev force-pushed the fix/arbitrary-import-properties branch from 45ce087 to aad31cd Compare October 2, 2026 03:43
@hyfdev
hyfdev force-pushed the fix/arbitrary-import-properties branch from aad31cd to d2b4b4f Compare October 2, 2026 04:03
@hyfdev
hyfdev marked this pull request as ready for review October 2, 2026 04:21
Copilot AI balanced review requested due to automatic review settings October 2, 2026 04:21

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 implementation consistently handles arbitrary names and includes comprehensive regression coverage.

Review effort: Balanced
Findings: None

What changed in this PR

Fixes invalid property access generation for arbitrary import names while preserving live bindings, call semantics, and source maps.

Changes:

  • Uses computed access for non-identifier import names.
  • Updates chunk re-export rendering.
  • Adds behavior, minification, chunking, and source-map coverage.
File Description
packages/​rolldown/​tests/​behaviors/​arbitrary-import-names.test.ts Adds regression coverage.
crates/​rolldown/​tests/​esbuild/​default/​inject/​artifacts.snap Updates expected computed access.
crates/​rolldown/​src/​utils/​chunk/​render_chunk_exports.rs Safely renders namespace property accesses.
crates/​rolldown/​src/​module_finalizers/​rename.rs Preserves spans for computed accesses.
crates/​rolldown/​src/​module_finalizers/​mod.rs Builds valid static or computed member expressions.

💡 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 not alter performance

✅ 7 untouched benchmarks
⏩ 10 skipped benchmarks1


Comparing fix/arbitrary-import-properties (d2b4b4f) with fix/shim-export-identifiers (8e4bc0e)

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 merged commit 632653c into fix/export-rendering-diagnostics Oct 2, 2026
53 of 64 checks passed
@hyfdev
hyfdev deleted the fix/arbitrary-import-properties 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