-
-
Notifications
You must be signed in to change notification settings - Fork 272
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
feat(enhanced): layers support in module code generation #3371
Conversation
🦋 Changeset detectedLatest commit: 8f94b54 The changes in this PR will be included in the next version bump. This PR includes changesets to release 27 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 |
✅ Deploy Preview for module-federation-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary
This pull request introduces several enhancements to the @module-federation/enhanced
package, focusing on adding support for layers and improving the handling of shared modules. The key changes include:
- Addition of layer support in various plugins and modules, such as
ConsumeSharedModule
,ConsumeSharedPlugin
, andProvideSharedDependency
. This allows for better control and management of shared module dependencies across different layers. - Refactoring of type definitions and serialization methods to accommodate the new layer functionality, ensuring seamless integration with the existing codebase.
- Updates to the
package.json
file, including the addition of a new script for running Jest tests with experimental VM modules and an upgrade to thewebpack-cli
dependency.
These enhancements improve the overall flexibility and functionality of the @module-federation/enhanced
package, allowing for more robust and layer-aware module sharing capabilities in module federation-based applications.
File Summaries
File | Summary |
---|---|
packages/enhanced/src/lib/sharing/ProvideSharedModule.ts | This pull request introduces several enhancements to the @module-federation/enhanced package, focusing on adding support for layers and improving the handling of shared modules. The key changes include the addition of layer support in various plugins and modules, updates to the package.json file, and refactoring of type definitions and serialization methods to accommodate the new layer functionality. |
packages/enhanced/src/lib/sharing/ProvideSharedModuleFactory.ts | This pull request introduces several enhancements to the @module-federation/enhanced package, primarily focused on adding support for layers and improving the handling of shared modules. The key changes include updates to the ConsumeSharedModule , ConsumeSharedPlugin , and ProvideSharedDependency classes to incorporate layer options, as well as refactoring of serialization methods and type definitions to accommodate the new layer functionality. Additionally, the package.json file has been updated with a new script for running Jest tests with experimental VM modules and an updated webpack-cli dependency. |
packages/enhanced/src/lib/sharing/ProvideSharedPlugin.ts | The code changes in this pull request focus on adding support for layers in the @module-federation/enhanced package, particularly in the ConsumeSharedModule , ConsumeSharedPlugin , and ProvideSharedDependency components. The updates include refactoring the serialization methods, enhancing the handling of shared modules, and introducing layer support in various plugins and modules to improve the overall functionality and flexibility of the package. |
packages/enhanced/src/lib/sharing/ShareRuntimeModule.ts | The code changes in this pull request focus on adding support for layers and improving the handling of shared modules in the @module-federation/enhanced package. The key modifications include: |
-
Refactoring the
ConsumeSharedModule
to include layer options and updating the module's serialization methods to handle layers. -
Updating the
ConsumeSharedPlugin
to use the new layer options and improving the handling of composite keys for module resolution. -
Enhancing the
ProvideSharedDependency
to include layer information and updating its serialization methods accordingly. -
Introducing layer support for the
ProvideSharePlugin
. -
Updating the
package.json
file with a new script for running Jest tests with experimental VM modules and upgrading thewebpack-cli
dependency. |
| packages/enhanced/src/lib/sharing/utils.ts | The code changes in this pull request focus on enhancing the@module-federation/enhanced
package by adding support for layers and improving the handling of shared modules. The key modifications include: -
Introducing layer support for the
ProvideSharePlugin
and refactoring theConsumeSharedModule
to include layer options and update the module's serialization methods to handle layers. -
Updating the
ConsumeSharedPlugin
to use the new layer options and improve the handling of composite keys for module resolution. -
Enhancing the
ProvideSharedDependency
to include layer information and updating its serialization methods accordingly. -
Updating the
package.json
file with a new script for running Jest tests with experimental VM modules and upgrading thewebpack-cli
dependency. |
Description
This pull request includes several changes to the
packages/enhanced
module, focusing on adding support for layers in shared modules and updating test cases to verify the new functionality. The most important changes include modifications to various classes to handle thelayer
property, updates to utility functions, and the addition of new test cases.Enhancements to shared module handling:
packages/enhanced/src/lib/sharing/ProvideSharedModule.ts
: Added support for thelayer
property in the shared module configuration.packages/enhanced/src/lib/sharing/ProvideSharedModuleFactory.ts
: Included thelayer
property when creating shared module instances.packages/enhanced/src/lib/sharing/ProvideSharedPlugin.ts
: Updated the plugin to handle thelayer
property in shared module configurations.packages/enhanced/src/lib/sharing/ShareRuntimeModule.ts
: Enhanced the runtime module to group shared modules by scope and layer, and generate the appropriate registration code. [1] [2] [3]Updates to utility functions:
packages/enhanced/src/lib/sharing/utils.ts
: Modified thenormalizeConsumeShareOptions
function to include thelayer
property in the consume options. [1] [2] [3]New test cases:
packages/enhanced/test/configCases/container/3-layers-full
andpackages/enhanced/test/configCases/container/4-layers-full
to verify the correct handling of layers in shared modules. These test cases include new components, configuration files, and scripts to simulate different scenarios. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]Related Issue
Types of changes
Checklist