refactor(es/module): Align module transform records with spec terms - #11992
Merged
Conversation
🦋 Changeset detectedLatest commit: 5b7f556 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
magic-akari
marked this pull request as ready for review
July 5, 2026 17:59
Merging this PR will not alter performance
Comparing Footnotes
|
magic-akari
force-pushed
the
refactor/es-module-records
branch
from
July 6, 2026 15:02
898a2d1 to
5b7f556
Compare
Donny/강동윤 (kdy1)
pushed a commit
that referenced
this pull request
Jul 9, 2026
**Description:** <!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? --> Rewrites the SystemJS module transform around a structured lowering/emission pipeline. This preserves SystemJS live bindings across imported re-exports, exported local mutations, destructuring assignments, update expressions, and `for-in` / `for-of` heads. It also keeps `export default class` evaluation order inside `execute` and emits import attribute metadata for System.register dependencies. Note: this PR is currently stacked on #11992, a related refactor PR. The SystemJS changes here do not semantically depend on it, but the branch is based on that work for now. **Related issue:** - Closes: #4895 - Closes: #5288 - Closes: #5649 - Closes: #6986 - Closes: #8122 - Closes: #8123
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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:
This PR refactors the shared CommonJS/AMD/UMD module-lowering collection layer to use terminology and boundaries closer to ECMAScript module records.
The old
ModuleDeclStripabstraction mixed declaration stripping, module request collection, export collection, and emitter-facing naming. This change renames and reshapes that layer intomodule_record.rswith clearer concepts:ModuleRecordCollectorRequestedModules/RequestedModuleModuleRecordEntryModuleRequestUsageLocalExportEntriesModuleRecordEntryReducerExportBindingCJS, AMD, and UMD now consume the same module-record-oriented data model while preserving their existing emit behavior. The format-specific passes still own wrapper shape, dependency emission, interop helper application,
export =handling, and import-reference rewriting.This is intended to be a behavior-preserving refactor. The main goal is to make the transform pipeline easier to reason about and maintain before future module interop work.
The README was also expanded with diagrams and a short walkthrough of the transform flow.
Verification:
cargo fmt --allcargo test -p swc_ecma_transforms_modulecargo clippy --all --all-targets -- -D warningsBREAKING CHANGE:
None.
Related issue (if exists):
N/A