feat(managers): plan the runtime composition and resolve one runtime family - #5134
ScriptedAlchemy wants to merge 18 commits into
Conversation
🦋 Changeset detectedLatest commit: a3a65b4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 48 packages
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 |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
@module-federation/devtools
@module-federation/cli
create-module-federation
@module-federation/dts-plugin
@module-federation/enhanced
@module-federation/error-codes
@module-federation/esbuild
@module-federation/managers
@module-federation/manifest
@module-federation/metro
@module-federation/metro-plugin-rnc-cli
@module-federation/metro-plugin-rnef
@module-federation/metro-plugin-rock
@module-federation/modern-js
@module-federation/modern-js-v3
@module-federation/native-federation-tests
@module-federation/native-federation-typescript
@module-federation/nextjs-mf
@module-federation/node
@module-federation/observability-plugin
@module-federation/playground
@module-federation/retry-plugin
@module-federation/rsbuild-plugin
@module-federation/rspack
@module-federation/rspress-plugin
@module-federation/rstest
@module-federation/runtime
@module-federation/runtime-core
@module-federation/runtime-tools
@module-federation/sdk
@module-federation/storybook-addon
@module-federation/third-party-dts-extractor
@module-federation/treeshake-frontend
@module-federation/treeshake-server
@module-federation/typescript
@module-federation/utilities
@module-federation/webpack-bundler-runtime
@module-federation/bridge-react
@module-federation/bridge-react-webpack-plugin
@module-federation/bridge-shared
@module-federation/bridge-vue3
@module-federation/inject-external-runtime-core-plugin
commit: |
Bundle Size Report17 package(s) changed, 26 unchanged. Package dist + ESM entry
Bundle targets
Tree-shakable entrypoints
Consumer scenarios
Total dist (raw): 23.44 MB (+40.5 kB (+0.2%)) Bundle sizes are generated with rslib (Rspack). Package-root metrics preserve the historical report. Tracked subpath exports such as |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 95cc87ed64
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| '@module-federation/managers': minor | ||
| --- | ||
|
|
||
| Add pure helpers that plan a composed federation runtime: `planComposition`, `resolveRuntimeFamily`, `selectMode`, `resolveImports`, `renderComposition`, and `checkFederationGraph`. |
There was a problem hiding this comment.
Remove nonexistent helpers from the release note
When this changeset is consumed during a release, the generated changelog will advertise five APIs that users cannot import: a repository-wide search finds no implementations of resolveRuntimeFamily, selectMode, resolveImports, renderComposition, or checkFederationGraph, and packages/managers/src/index.ts exports only planComposition and ADAPTERS from this change. Either include and export those helpers or limit the release note to the API actually added.
Useful? React with 👍 / 👎.
…nd check the composition
Deploying with ☁️ Zephyr CloudThe latest preview deployments for this pull request.
Affected deployment targets
|
… into rfc5128/04-managers-composition
… into rfc5128/04-managers-composition
… into rfc5128/04-managers-composition
… into rfc5128/04-managers-composition
… into rfc5128/04-managers-composition
… into rfc5128/04-managers-composition
… into rfc5128/04-managers-composition
… into rfc5128/04-managers-composition
… into rfc5128/04-managers-composition
Part of RFC #5128 (alternate proposal to #5036).
Stack: 4 of 7. Base: #5139 (
rfc5128/03-node-esbuild-runtime). Next: #5140.Landing order: #5135 → #5137 → #5139 → #5134 → #5140 → #5141 → #5142.
Companions on main: #5143 (disabled remote loadEntry), #5144 (enhanced duplicate serializer keys). #5126 (@rspack/core 2) is on main. PR 6 and 7 include it.
What changes
No build changes behavior in this PR.
@module-federation/managersgains the pure build-side functions that decide how a federation build composes its runtime. Enhanced and rspack call them behindexperiments.composedRuntimein #5140 and #5141, so both bundlers share one planner.planCompositionturns the plugin participants into the handlers and adapters a build needs.resolveRuntimeFamilyandselectModefind the installed runtime packages. They pick composed mode only when every needed subpath is exported and nothing externalizes or aliases the runtime.resolveImportsandrenderCompositionproduce the generated bootstrap text.checkFederationGraphreports missing adapters and family mismatches.Verification
pnpm --filter @module-federation/managers testcovers each function with synthetic package fixtures and a real older runtime-tools from the pnpm store. The suite passes 103/103.packages/managers.1d75f2f40(gates 95/95, red checks and mutations, built-dist bootstraps evaluate with the planned keys, runtime-tools 2.9.1 selects legacy, audit). Five follow-ups (byLayer, thecontextInfostub, a callback default parameter, theuserRequestcontract, and test types) each landed red-first and passed a delta review at0568c389e. The patch is unchanged through0576af69cand the live heada3a65b4be.a3a65b4bewith 19 checks. e2e-metro-ios failed once in teardown after its Maestro flow passed. The serve process exited on SIGTERM and the harness counted that exit as a failure. The rerun passed.Deviations from the RFC
export default federation;, which the RFC examples omit. The rspack alias target and the enhanced entry need the federation object as the default export.Overlaps with open PRs
This PR carries none of the spun-out main fixes and no code from other open PRs. The PRs below change files this PR also changes. This PR does not include their changes.
managers/src/index.ts.managers/__tests__/ContainerManager.spec.tsandpnpm-lock.yaml.managers/package.json.