Repository navigation
feat(mf): support layered container exposes #14912
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ScriptedAlchemy
wants to merge
80
commits into
codex/mf-share-scope-runtime
from
codex/mf-layered-container-exposes
+1,585
−66
Open
Changes from 2 commits
Commits
Show all changes
80 commits
Select commit
Hold shift + click to select a range
c4d3c04
feat(mf): support layered container exposes
ScriptedAlchemy b3a3fed
Merge remote-tracking branch 'origin/codex/mf-share-scope-runtime' in…
ScriptedAlchemy c0f445d
Merge commit '2a348f967f' into codex/work-pr14912
ScriptedAlchemy f16f215
Merge commit 'e0a975ff10' into codex/work-pr14912
ScriptedAlchemy 7ee5128
Merge commit '223f6e860f' into codex/work-pr14912
ScriptedAlchemy 6c1af2c
Merge commit '3e4af0cb5f' into codex/work-pr14912
ScriptedAlchemy 1c3eb05
perf(mf): use unstable sorts for deterministic strings
ScriptedAlchemy bce2884
perf(mf): patch shared exports without typed stats
ScriptedAlchemy 53b1f7e
perf(mf): compact optional exposed layers
ScriptedAlchemy b21cf1d
Merge commit '9392c3bb75' into codex/work-pr14912
ScriptedAlchemy b1722dc
Merge commit 'ffd6b71541' into codex/work-pr14912
ScriptedAlchemy 4f1eef5
Merge commit '72c9492ee4' into codex/work-pr14912
ScriptedAlchemy 27771aa
Merge commit 'cbaca67ee4' into codex/work-pr14912
ScriptedAlchemy 9c461fa
Merge commit 'fefd61d32e' into codex/work-pr14912
ScriptedAlchemy 84a127a
Merge commit '2119bde04f' into codex/work-pr14912
ScriptedAlchemy 2476c02
Merge commit '2c0d2b7210' into codex/work-pr14912
ScriptedAlchemy 1a74f7d
fix(mf): preserve layered option compatibility
ScriptedAlchemy c20131b
Merge commit '982bd52e2c' into codex/work-pr14912
ScriptedAlchemy aa1d9ec
Merge commit '46a22cb771' into codex/work-pr14912
ScriptedAlchemy f592033
Merge commit 'd540607a38' into codex/work-pr14912
ScriptedAlchemy 668cfee
fix(mf): preserve expose option compatibility
ScriptedAlchemy 1326aca
fix(mf): preserve v1 option extensibility
ScriptedAlchemy bfa3a15
Merge commit '4aad05beae' into codex/work-pr14912
ScriptedAlchemy ef0f210
Merge commit '1656d1bec8' into codex/work-pr14912
ScriptedAlchemy 3dee67e
fix(mf): preserve container option extensibility
ScriptedAlchemy a45c54d
fix(mf): retain exposed dependency constructor
ScriptedAlchemy 11e4a2f
Merge remote-tracking branch 'origin/codex/mf-share-scope-runtime' in…
ScriptedAlchemy aecfa8e
fix(mf): export enhanced container options
ScriptedAlchemy 04c9206
Merge remote-tracking branch 'origin/codex/mf-share-scope-runtime' in…
ScriptedAlchemy cabc390
Merge remote-tracking branch 'origin/codex/mf-share-scope-runtime' in…
ScriptedAlchemy c7a248b
Merge remote-tracking branch 'origin/codex/mf-share-scope-runtime' in…
ScriptedAlchemy bfe4fa5
Merge remote-tracking branch 'origin/codex/mf-share-scope-runtime' in…
ScriptedAlchemy ace9d2e
test(mf): check the legacy expose constructor signature without const…
ScriptedAlchemy e07cb23
Merge remote-tracking branch 'origin/codex/mf-share-scope-runtime' in…
ScriptedAlchemy 22d1a17
Merge remote-tracking branch 'origin/codex/mf-share-scope-runtime' in…
ScriptedAlchemy 789d856
Merge remote-tracking branch 'origin/codex/mf-share-scope-runtime' in…
ScriptedAlchemy b108343
fix(mf): carry expose layers inside the container identifier payload
ScriptedAlchemy 7a95005
Merge remote-tracking branch 'origin/codex/mf-share-scope-runtime' in…
ScriptedAlchemy 533028a
docs(mf): explain and exercise expose layers
ScriptedAlchemy 089b02c
Merge refreshed shared runtime into layered exposes
ScriptedAlchemy e8b02d0
Merge branch 'codex/work-pr14911' into codex/work-pr14912
ScriptedAlchemy 73c90ee
test(mf): cover layered exposes through config cases
ScriptedAlchemy 5cee2d5
Merge branch 'codex/work-pr14911' into codex/work-pr14912
ScriptedAlchemy 4b9a1e2
fix(mf): retain container hooks after test cleanup
ScriptedAlchemy d1d45c6
Merge branch 'codex/work-pr14911' into codex/work-pr14912
ScriptedAlchemy b3ca943
Merge branch 'codex/work-pr14911' into codex/work-pr14912
ScriptedAlchemy 60e794b
refactor(mf): remove redundant expose layer truncation
ScriptedAlchemy 0454b2f
chore: sync layered exposes with runtime base
ScriptedAlchemy f979f70
chore: sync layered exposes with runtime base
ScriptedAlchemy dc5faf4
chore: sync layered exposes with runtime base
ScriptedAlchemy 960481d
chore: sync layered exposes with runtime review fixes
ScriptedAlchemy e30e940
fix(mf): export enhanced V1 federation options
ScriptedAlchemy 4724c6b
Merge branch 'codex/mf-share-scope-runtime' into codex/mf-layered-con…
ScriptedAlchemy a00b374
Merge branch 'codex/mf-share-scope-runtime' into codex/mf-layered-con…
ScriptedAlchemy fca6e72
Merge branch 'codex/mf-share-scope-runtime' into codex/mf-layered-con…
ScriptedAlchemy 1ae37ab
Merge branch 'codex/mf-share-scope-runtime' into codex/mf-layered-con…
ScriptedAlchemy e3dab88
Merge branch 'codex/mf-share-scope-runtime' into codex/mf-layered-con…
ScriptedAlchemy b55df4a
Merge branch 'stack-refresh/14911' into stack-refresh/14912
ScriptedAlchemy 4605029
Merge branch 'stack-refresh2/14911' into stack-refresh2/14912
ScriptedAlchemy 2e2ec31
Merge branch 'stack-refresh2/14911' into stack-refresh2/14912
ScriptedAlchemy 12bd007
refactor(mf): carry the expose layer on ExposeOptions
ScriptedAlchemy 5acd724
Merge branch 'stack-refresh2/14911' into stack-refresh2/14912
ScriptedAlchemy e4eb5ba
chore(mf): reject empty expose layer names and clean the layered fixt…
ScriptedAlchemy fc9224a
Merge branch 'stack-refresh2/14911' into stack-refresh2/14912
ScriptedAlchemy a47cc84
Merge branch 'stack-refresh2/14911' into stack-refresh2/14912
ScriptedAlchemy ef7c751
Merge branch 'stack-refresh2/14911' into stack-refresh2/14912
ScriptedAlchemy 6fb8b6b
Merge ordered share scope runtime into layered container exposes
ScriptedAlchemy b0bf215
Merge corrected workspace lockfile into layered container exposes
ScriptedAlchemy 3c0aed3
fix(mf): preserve unnamed consumers after base refresh
ScriptedAlchemy c9cb2be
fix(mf): enforce reusable expose map types and relocate Rust coverage
ScriptedAlchemy f65fa5e
Merge reviewed MF runtime fixes and format test dependency
ScriptedAlchemy 046f3b2
fix(mf): preserve Rust container options source compatibility
ScriptedAlchemy baf20fb
Merge Rust sharing API compatibility into layered containers
ScriptedAlchemy 1dbc84d
test(mf): retain enhanced expose serialization coverage
ScriptedAlchemy acf8939
Merge branch 'api-compat-runtime' into HEAD
ScriptedAlchemy d0d70ae
Merge branch 'api-compat-runtime' into HEAD
ScriptedAlchemy 27c7890
Merge branch 'api-compat-runtime' into HEAD
ScriptedAlchemy 1162106
chore: update layered exposes stack base
ScriptedAlchemy 27998da
chore: propagate federation lockfile fix
ScriptedAlchemy 728b7a9
chore: propagate combined preview build
ScriptedAlchemy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
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
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
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
1 change: 1 addition & 0 deletions
1
...pack-test/configCases/container-1-0/enhanced-option-direct-container-validation/errors.js
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| module.exports = [/\[ContainerPlugin\] layer requires enhanced=true/]; |
3 changes: 3 additions & 0 deletions
3
...spack-test/configCases/container-1-0/enhanced-option-direct-container-validation/index.js
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| it('should reject enhanced expose options in legacy mode', () => { | ||
| expect(true).toBe(true); | ||
| }); |
16 changes: 16 additions & 0 deletions
16
...st/configCases/container-1-0/enhanced-option-direct-container-validation/rspack.config.js
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| const { ContainerPlugin } = require('@rspack/core').container; | ||
|
|
||
| module.exports = { | ||
| entry: './index.js', | ||
| plugins: [ | ||
| new ContainerPlugin({ | ||
| name: 'container', | ||
| exposes: { | ||
| './entry': { | ||
| import: './index.js', | ||
| layer: 'server', | ||
| }, | ||
| }, | ||
| }), | ||
| ], | ||
| }; |
9 changes: 9 additions & 0 deletions
9
tests/rspack-test/serialCases/container-1-5/1-layers-full/App.js
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import React, { layeredComponentsReact } from 'react'; | ||
| import ComponentA from 'containerA/ComponentA'; | ||
| import ComponentALayers from 'containerA/ComponentALayers'; | ||
| import LocalComponentALayers from './ComponentALayers'; | ||
| import LocalComponentA from './ComponentA'; | ||
|
|
||
| export default () => { | ||
| return `App rendered with [${React()}] ${layeredComponentsReact()}, ${LocalComponentALayers()}, ${LocalComponentA()}, [${ComponentA()}] and [${ComponentALayers()}]`; | ||
| }; |
5 changes: 5 additions & 0 deletions
5
tests/rspack-test/serialCases/container-1-5/1-layers-full/ComponentA.js
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import React, { layeredComponentsReact } from 'react'; | ||
|
|
||
| export default () => { | ||
| return `ComponentA rendered with [${React()}]${layeredComponentsReact()}`; | ||
| }; |
6 changes: 6 additions & 0 deletions
6
tests/rspack-test/serialCases/container-1-5/1-layers-full/ComponentALayers.js
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| import React, { layeredComponentsReact } from 'react'; | ||
|
|
||
| export default () => { | ||
| return `ComponentALayers ${React()} rendered with [${layeredComponentsReact()}]`; | ||
| }; | ||
| export { React }; |
8 changes: 8 additions & 0 deletions
8
tests/rspack-test/serialCases/container-1-5/1-layers-full/index.js
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| it('should load the component from container', () => { | ||
| return import('./App').then(({ default: App }) => { | ||
| const rendered = App(); | ||
| expect(rendered).toBe( | ||
| 'App rendered with [This is react 0.1.2] No Layer (1-layers-full), ComponentALayers This is react 0.1.2 rendered with [This is layered react (1-layers-full)], ComponentA rendered with [This is react 0.1.2]No Layer (1-layers-full), [ComponentA rendered with [This is react 0.1.2]No Layer (1-layers-full)] and [ComponentALayers This is react 0.1.2 rendered with [This is layered react (1-layers-full)]]', | ||
| ); | ||
| }); | ||
| }); |
4 changes: 4 additions & 0 deletions
4
tests/rspack-test/serialCases/container-1-5/1-layers-full/layered-react-loader.js
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| // DO NOT EDIT | ||
| module.exports = function (source) { | ||
| return source.replace('No Layer', 'This is layered react'); | ||
| }; |
10 changes: 10 additions & 0 deletions
10
tests/rspack-test/serialCases/container-1-5/1-layers-full/layered-upgrade-react.js
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import React from 'react'; | ||
|
|
||
| // This file will be processed by the layered loader | ||
| export default function initializeLayeredReactVersion() { | ||
| // Set the layered React version | ||
| React.setVersion('1.2.3'); | ||
| } | ||
|
|
||
| // Initialize version immediately | ||
| initializeLayeredReactVersion(); |
4 changes: 4 additions & 0 deletions
4
tests/rspack-test/serialCases/container-1-5/1-layers-full/node_modules/react.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
106 changes: 106 additions & 0 deletions
106
tests/rspack-test/serialCases/container-1-5/1-layers-full/rspack.config.js
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| const { ModuleFederationPlugin } = require('@rspack/core').container; | ||
| const path = require('path'); | ||
|
|
||
| const common = { | ||
| name: 'layer_container', | ||
| exposes: { | ||
| './ComponentA': { | ||
| import: './ComponentA', | ||
| }, | ||
| './ComponentALayers': { | ||
| import: './ComponentALayers', | ||
| }, | ||
|
ScriptedAlchemy marked this conversation as resolved.
|
||
| }, | ||
| shared: { | ||
| react: { | ||
| version: '18.0.0', | ||
| requiredVersion: '^18.0.0', | ||
| singleton: true, | ||
| }, | ||
| 'layered-react': { | ||
| request: 'react', | ||
| import: 'react', | ||
| shareKey: 'react', | ||
| version: '16.0.0', | ||
| requiredVersion: '^16.0.0', | ||
| singleton: true, | ||
| layer: 'layered-components', | ||
| issuerLayer: 'layered-components', | ||
| shareScope: 'layered-components', | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| const commonConfig = { | ||
| devtool: false, | ||
| experiments: { | ||
| layers: true, | ||
| }, | ||
| entry: './index.js', | ||
| mode: 'development', | ||
| module: { | ||
| rules: [ | ||
| { | ||
| test: /ComponentALayers\.js$/, | ||
| layer: 'layered-components', | ||
| }, | ||
| { | ||
| test: /react\.js$/, | ||
| issuerLayer: 'layered-components', | ||
| layer: 'layered-components', | ||
| use: [ | ||
| { | ||
| loader: path.resolve(__dirname, './layered-react-loader.js'), | ||
| }, | ||
| ], | ||
| }, | ||
| ], | ||
| }, | ||
| }; | ||
|
|
||
| module.exports = [ | ||
| { | ||
| ...commonConfig, | ||
| output: { | ||
| filename: '[name].js', | ||
| uniqueName: '1-layers-full', | ||
| }, | ||
| plugins: [ | ||
| new ModuleFederationPlugin({ | ||
| library: { type: 'commonjs-module' }, | ||
| filename: 'container.js', | ||
| remotes: { | ||
| containerA: { | ||
| external: './container.js', | ||
| }, | ||
| }, | ||
| ...common, | ||
| }), | ||
| ], | ||
| }, | ||
| { | ||
| ...commonConfig, | ||
| experiments: { | ||
| ...commonConfig.experiments, | ||
| outputModule: true, | ||
| }, | ||
| output: { | ||
| module: true, | ||
| filename: 'module/[name].mjs', | ||
| uniqueName: '1-layers-full-mjs', | ||
| }, | ||
| plugins: [ | ||
| new ModuleFederationPlugin({ | ||
| library: { type: 'module' }, | ||
| filename: 'module/container.mjs', | ||
| remotes: { | ||
| containerA: { | ||
| external: './container.mjs', | ||
| }, | ||
| }, | ||
| ...common, | ||
| }), | ||
| ], | ||
| target: 'node14', | ||
| }, | ||
| ]; | ||
5 changes: 5 additions & 0 deletions
5
tests/rspack-test/serialCases/container-1-5/1-layers-full/test.config.js
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| module.exports = { | ||
| findBundle: function (i, options) { | ||
| return i === 0 ? './main.js' : './module/main.mjs'; | ||
| }, | ||
| }; |
10 changes: 10 additions & 0 deletions
10
tests/rspack-test/serialCases/container-1-5/2-layers-full/App.js
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import React, { layeredComponentsReact } from 'react'; | ||
| import ComponentA from 'containerA/ComponentA'; | ||
| import ComponentB from 'containerB/ComponentB'; | ||
| import ComponentALayers from 'containerB/ComponentALayers'; | ||
| import LocalComponentB from './ComponentB'; | ||
| import LocalComponentALayers from './ComponentALayers'; | ||
|
|
||
| export default () => { | ||
| return `App rendered with [${React()}] ${layeredComponentsReact()} and ${ComponentALayers()} and ${LocalComponentALayers()} and [${ComponentA()}] and [${ComponentB()}] and ${LocalComponentB()}`; | ||
| }; |
5 changes: 5 additions & 0 deletions
5
tests/rspack-test/serialCases/container-1-5/2-layers-full/ComponentALayers.js
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import React, { layeredComponentsReact } from 'react'; | ||
|
|
||
| export default function ComponentALayers() { | ||
| return `LocalComponentALayers ${React()} (Layered React: ${layeredComponentsReact()})`; | ||
| } |
5 changes: 5 additions & 0 deletions
5
tests/rspack-test/serialCases/container-1-5/2-layers-full/ComponentB.js
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import React, { layeredComponentsReact } from 'react'; | ||
|
|
||
| export default () => { | ||
| return `LocalComponentB rendered with [${React()}] ${layeredComponentsReact()}`; | ||
| }; |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.