feat(mf): layer-aware sharing and runtime scope-array support#12977
feat(mf): layer-aware sharing and runtime scope-array support#12977ScriptedAlchemy wants to merge 90 commits into
Conversation
Rsdoctor Bundle Diff AnalysisFound 5 projects in monorepo, 5 projects with changes. 📊 Quick Summary
📋 Detailed Reports (Click to expand)📁 react-10kPath:
📁 popular-libsPath:
📁 react-5kPath:
📁 react-1kPath:
📁 ui-componentsPath:
Generated by Rsdoctor GitHub Action |
📦 Binary Size-limit
❌ Size increased by 200.00KB from 66.55MB to 66.75MB (⬆️0.29%) |
Merging this PR will not alter performance
Comparing Footnotes
|
test: retry native watcher watch steps Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Zack Jackson <ScriptedAlchemy@users.noreply.github.com>
Deploying rspack with
|
| Latest commit: |
96618cb
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://010f4784.rspack-v2.pages.dev |
| Branch Preview URL: | https://feat-mf-layers.rspack-v2.pages.dev |
Hydrate consume handler mappings from consumes loading data so bundler-runtime keeps layer-aware share metadata in the enhanced path. Also validate multi-entry share scopes unless enhanced mode is enabled, and emit remote external metadata alongside remote runtime records.
Keep provide shared runtime entries in their original shareScope shape and mark enhanced initializeSharingData as already updated so bundler-runtime does not rebuild downgraded shared registrations from the legacy structure.
Emit consume-shared source data for shared consumers and let the runtime module reuse it when serializing consume metadata. This keeps module-output consume entries callable so layered federation consumers can initialize sharing before resolving shared react. Made-with: Cursor
Made-with: Cursor
Wait for consume share scopes to finish initializing before delegating to the bundler runtime so layered shared modules resolve consistently. Remove the temporary federation debug instrumentation that was added while tracing the runtime flow. Made-with: Cursor
Drop the temporary discovery document now that the parity investigation is captured elsewhere. Made-with: Cursor
Reinstate legacy share-scope validation and restore the enhanced runtime metadata paths needed for layered consume and module remote resolution. Made-with: Cursor
Preserve layer-aware shared metadata across manifest generation, used-exports optimization, and module remote runtime wiring so layered federation outputs stay correct and covered. Made-with: Cursor
Keep layered consume scope initialization in the enhanced runtime while preserving legacy consume version-check behavior and rust lint parity. Made-with: Cursor
# Conflicts: # crates/rspack_plugin_javascript/Cargo.toml # crates/rspack_plugin_mf/src/container/remote_runtime_module.rs # crates/rspack_plugin_mf/src/manifest/mod.rs # crates/rspack_plugin_mf/src/manifest/utils.rs # crates/rspack_plugin_mf/src/sharing/collect_shared_entry_plugin.rs # crates/rspack_plugin_mf/src/sharing/consume_shared_module.rs # crates/rspack_plugin_mf/src/sharing/consume_shared_plugin.rs # crates/rspack_plugin_mf/src/sharing/mod.rs # crates/rspack_plugin_mf/src/sharing/provide_shared_module.rs # crates/rspack_plugin_mf/src/sharing/provide_shared_plugin.rs # crates/rspack_plugin_mf/src/sharing/shared_used_exports_optimizer_runtime_module.rs # packages/rspack/src/runtime/moduleFederationDefaultRuntime.js
Summary
What This Changes
layer/issuerLayermetadata through shared module configuration and runtime registrationcontainer-1-5layer serial cases and the matching sharing/tree-shaking casesWhy This PR Exists
Rspack already supports share scopes as arrays from earlier work. This PR is not re-adding generic array share-scope support.
The purpose of this PR is to add layer-aware federation behavior so layered shared modules and layered exposed modules work the same way as they do in Module Federation core.
Stack
Current stack, bottom to top:
feat(mf): layer-aware sharing and runtime scope-array support<- this PRfeat(mf): emit RSC metadata in federation manifestsfeat(rsbuild): add RSC federation host/remote examplefeat(rsbuild): add RSC federation module patternsfeat(rsc): register federation manifest data at runtime