Conversation
✅ Deploy Preview for rolldown-rs canceled.
|
Contributor
There was a problem hiding this comment.
Pull Request Overview
This pull request refactors the HMR module registration to use the __esModule flag to mark ESM exports, ensuring consistency with Babel semantics for module federation and improved interoperation with other bundlers.
- Updated snapshot files to reflect changes in module filename hashes and __esModule flags.
- Removed the meta parameter from the registerModule function and added a new canonical_exports_len method in linking_metadata.
- Updated HMR-related module finalizers to include __esModule property when building export objects.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| crates/rolldown/tests/snapshots/integration_rolldown__filename_with_hash.snap | Updated filename hash in snapshot to accommodate refactored module exports. |
| crates/rolldown/tests/rolldown/topics/hmr/register_exports/artifacts.snap | Adjusted module export registration by adding __esModule flag. |
| crates/rolldown/tests/rolldown/issues/4129/artifacts.snap | Updated module registration for lib.js and main.js to include __esModule flag. |
| crates/rolldown/src/types/linking_metadata.rs | Added a helper method to compute the length of canonical exports. |
| crates/rolldown/src/runtime/runtime-extra-dev.js | Removed the meta parameter from registerModule to simplify module export handling. |
| crates/rolldown/src/module_finalizers/scope_hoisting/hmr.rs | Updated object builder with reserved capacity and appended __esModule flag. |
| crates/rolldown/src/hmr/hmr_ast_finalizer.rs | Adjusted export object construction to include __esModule flag. |
Comments suppressed due to low confidence (1)
crates/rolldown/src/runtime/runtime-extra-dev.js:91
- The meta parameter has been removed from registerModule, which eliminates the separate handling for CommonJS modules. Please update the function documentation and ensure tests cover both ESM and CJS scenarios, confirming that this behavior is intentional.
registerModule(id, esmExportGettersOrCjsExports) {
Contributor
Benchmarks Rust |
hyf0
approved these changes
May 8, 2025
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.

Description
Here should follow the babel semantics to mark esm module exports. it will make sure our module exports is compat to other bundlers, eg module federation moduels.