feat(managers): resolve runtime families atomically - #5093
ScriptedAlchemy wants to merge 14 commits into
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
🦋 Changeset detectedLatest commit: 00b53e3 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 |
@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 Report14 package(s) changed, 29 unchanged. Package dist + ESM entry
Bundle targets
Consumer scenarios
Total dist (raw): 23.66 MB (+260.9 kB (+1.1%)) Bundle sizes are generated with rslib (Rspack). Package-root metrics preserve the historical report. Tracked subpath exports such as |
85929d0 to
335ca42
Compare
Resolve each family edge from its issuer. Reject split roots, malformed metadata, and missing members. Export parser and selection state from runtime-selection. Keep package conditions inactive.
335ca42 to
d52545d
Compare
One plugin with `remotes` and `disableRemote: true` (or `shared` and `disableShared: true`) used to throw `capability-conflict`. On main the disable flag wins and sets the matching FEDERATION_OPTIMIZE_* define. Restore that: within one participant the explicit disable flag wins. Different participants that disagree still throw.
npm nesting can install the same runtime package at the same version under two parents. In legacy-defines mode that build works on main, so the resolver now treats members with the same name and version as one member. Condition-mode families keep strict root identity.
`experiments.optimization.target` with a null or unrecognized value used to throw `invalid-target`. Main ignores such values and sets no ENV_TARGET define. Fall back to compiler target inference instead.
A `split-family` error from the compiler slot now names both requested implementations and their resolved roots. A `dependsOn` that is present but not an array is a malformed contract instead of an empty list. A role that no `dependsOn` edge reaches from runtime-tools is a malformed topology, not a missing member. The slot test builds its own fixture instead of resolving the workspace runtime-tools package.
Remove `resolverVisibleRoots` (nothing reads it), the `hasExposes` and `isPresentRecord` duplicates of `hasConfiguredRecord` and `isRecord`, a no-op spread of the parsed selectors, and the unused `sdkDir` parameter of the test fixture helper.
Inheriting the parent selection used to overwrite the child's own participants, so a plugin applied to a child compiler was dropped without an error.
The remote handler's loadEntry hook typed `resourceContext` as `ResourceLoadContext` without importing it. The emitted `dist/remote/index.d.ts` then referenced an undeclared name, so consumers with `skipLibCheck: false` got TS2304.
Add a config case where a runtime plugin imports an unused export of a sideEffects: false package. The runtime chunk must not contain that module while a used package stays in it. Fails on main.
getAllReferencedModules followed every outgoing connection, so modules webpack had pruned were forced back into the runtime chunk. Skip a connection whose active state is false in every runtime.
Add a node:test case for createDualFormatConfig's outExtensions mapper
that calls it with rolldown's format names ('es' and 'cjs') and expects
distinct declaration paths per format. It fails on the current helper,
which only matches 'esm'.
Add tools/scripts/check-dts.mjs, run at the end of build:packages. It
parses every packages/*/dist declaration file with the TypeScript
compiler and fails on syntax diagnostics, so a torn .d.ts fails in the
package that emitted it instead of in a downstream build.
tsdown calls outExtensions with rolldown's format name, 'es', while createModernOutExtensions matched 'esm'. The ESM pass therefore got no mapping and fell back to dist/<entry>.d.ts, the same path the CJS mapping named. Both passes run at once and their writes interleaved, which left packages/runtime/dist/core.d.ts torn on a CI runner. The mapper now matches 'es' and gives each declaration the extension of its JavaScript sibling: .js gets .d.ts, .cjs gets .d.cts, .mjs gets .d.mts. The sdk config no longer bypasses the mapper, since tsdown's own default also wrote one .d.ts for both passes in a type: module package. The require types condition in runtime, runtime-core, runtime-tools, webpack-bundler-runtime, sdk, error-codes, and assemble-release-plan now points at the .d.cts file, which also clears the publint warning about ESM-typed declarations under require.
Deploying with ☁️ Zephyr CloudThe latest preview deployments for this pull request.
Affected deployment targets
|
1db1ede to
00b53e3
Compare
Part of RFC #5036. An alternate proposal is open at #5128 with its own stack. This PR stays open until the decision on #5036 is made.
Stack: 1 of 7. Base:
main. Next: #5094.Landing order: #5093 → #5094 → #5095 → #5096 → #5097 → #5098 → #5107.
What changes
The resolver changes nothing for users yet, because nothing calls it. Maintainers get a
@module-federation/managers/runtime-selectionsubpath that checks one runtime family as a whole before compiler plugins select capabilities. The old per-package lookup can mix copies when a custom implementation is incomplete.The resolver walks each family dependency from the package that requested it and records each member's real root. It rejects bad metadata, missing entries, unreachable roles, late participants, and a federation plugin applied directly to a child compiler. That last case used to be dropped silently.
A package without family metadata stays on the old path. There, two copies of a member at the same version count as one, because npm nesting produces that layout today. Copies at different versions are rejected. A package that opts into conditions must declare its layout, allowed requests, selectors, facade, and entry loader.
Capability reduction matches
mainfor a single plugin.remoteswithdisableRemote: true, orsharedwithdisableShared: true, sets the disable define and is not a conflict. Only participants that disagree raisecapability-conflict. An unknownexperiments.optimization.targetis ignored, as onmain.The branch also carries two fixes that change output today. Runtime-chunk hoisting skips connections webpack has pruned (#5116). CommonJS declarations are emitted as
.d.cts, and therequiretypes condition in seven packages points at them (#5124). The file list also shows theResourceLoadContextimport fix, which is already onmainas #5114.Verification
The branch history was rewritten on 2026-09-26 to remove attribution trailers from commit messages only. Every tree and patch is identical to the verified head;
00b53e387is the rewritten tip.The managers build, 43 managers tests, managers lint, and Prettier pass.
The carried fixes bring their own tests. A config case that fails on
mainkeeps a pruned import out of the runtime chunk. Anode:testcase checks one declaration path per format.tools/scripts/check-dts.mjsparses every built declaration at the end ofbuild:packages.CI at
00b53e387passed all 26 checks, including every end-to-end suite.No build calls the resolver here, so only the managers unit tests exercise it. feat(enhanced): coordinate runtime family selection #5094 wires it into Enhanced and Rspack.
Deviations from the RFC
None noted.
Overlaps with open PRs
File overlaps with 6 other open PRs
package.json. This PR does not include that change..github/workflows/build-and-test.ymlandpackage.json. This PR does not include those changes.package.json. This PR does not include that change.package.json. This PR does not include that change.package.json. This PR does not include that change.packages/enhanced/src/lib/container/HoistContainerReferencesPlugin.ts. This PR does not include that change.