feat(enhanced): support shared module layers#3276
Conversation
# Conflicts: # pnpm-lock.yaml
# Conflicts: # pnpm-lock.yaml
# Conflicts: # pnpm-lock.yaml
🦋 Changeset detectedLatest commit: 6905c82 The changes in this PR will be included in the next version bump. This PR includes changesets to release 31 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.
Summary
Here is a concise summary of the changes in the pull request:
The key changes focus on enhancing the module sharing functionality in the enhanced package by introducing support for module layers. This includes:
- Updating the
ConsumeSharedModuleandConsumeSharedPluginclasses to handle layer-specific requests and module factorization, introducing new properties likelayer,issuerLayer, andrequiredLayer. - Enhancing the
ConsumeSharedPluginclass to manage layer-specific configurations and provide better support for layer-based module sharing. - Adding a new Jest command to the
package.jsonfile to run specific test cases for module layer support. - Implementing TypeScript-based validation functions for the
ConsumeSharedPluginschema to ensure proper validation of the new layer-related properties.
These changes aim to improve the module sharing capabilities in the enhanced package by providing more flexibility and control over how modules are consumed and shared, particularly in the context of layered module architectures.
File Summaries
| File | Summary |
|---|---|
| packages/enhanced/src/declarations/plugins/sharing/ConsumeSharedModule.d.ts | Here is a short and concise technical summary of the changes: |
The code changes introduce support for module layers in the ConsumeSharedModule and ConsumeSharedPlugin classes. This includes adding new properties (layer, issuerLayer, requiredLayer) to the ConsumeOptions type to specify and resolve module layers. Additionally, the ConsumeSharedPlugin class was updated to handle layer-specific requests and factorize modules based on the layer context. The changes also include updates to the package.json file, such as adding a new Jest command and updating the webpack-cli dependency, as well as adding TypeScript-based validation functions for the ConsumeSharedPlugin schema. |
| packages/enhanced/src/declarations/plugins/sharing/ConsumeSharedPlugin.d.ts | The changes in this pull request focus on enhancing the module sharing functionality in the enhanced package. The key modifications are:
-
The
ConsumeSharedModuleandConsumeSharedPluginclasses were updated to support module layers, allowing for more granular control over how modules are shared and consumed. New properties likelayer,issuerLayer, andrequiredLayerwere added to theConsumeOptionstype and the plugin options. -
The
ConsumeSharedPluginclass was updated to handle layer-specific requests and factorize modules based on the layer context, improving the overall module sharing capabilities. -
The
package.jsonfile was updated to add a new Jest command for testing theConfigTestCases.basictest.jsfile, and thewebpack-clidependency was updated to version^5.1.4. -
TypeScript-based validation functions were added to the
ConsumeSharedPlugin.check.tsfile to ensure proper validation of the new properties introduced for module layer support. |
| packages/enhanced/src/declarations/plugins/sharing/ProvideSharedPlugin.d.ts | The key changes in this pull request are focused on enhancing the module sharing functionality in theenhancedpackage. The main highlights are: -
Added support for specifying and resolving module layers in the
ConsumeSharedModuleandConsumeSharedPluginclasses. This includes introducing new properties likelayer,issuerLayer, andrequiredLayerto handle layer-specific requests and module factorization. -
Updated the
ConsumeSharedPluginclass to manage layer-specific configurations and provide better support for layer-based module sharing. -
Added a new Jest command to the
package.jsonfile to run specific test cases for theConfigTestCases.basictest.jsfile. -
Implemented TypeScript-based validation functions for the
ConsumeSharedPluginschema to ensure proper validation of the new layer-related properties.
Overall, these changes aim to enhance the module sharing capabilities in the enhanced package by introducing support for module layers, which is a key requirement for managing complex module dependencies and sharing scenarios. |
| packages/enhanced/src/declarations/plugins/sharing/SharePlugin.d.ts | The code changes in this pull request focus on enhancing the module sharing functionality in the enhanced package. The key modifications are:
-
The
ConsumeSharedModuleandConsumeSharedPluginclasses have been updated to support module layers, allowing for more granular control over module resolution and sharing. New properties likelayer,issuerLayer, andrequiredLayerhave been added to handle layer-specific requests and module factorization. -
The
package.jsonfile has been updated to include a new Jest command for running a specific test case, and thewebpack-clidependency has been updated to version^5.1.4. -
TypeScript-based validation functions have been added to the
ConsumeSharedPluginschema to ensure proper validation of the new layer-related properties.
These changes aim to improve the module sharing capabilities in the enhanced package, providing more flexibility and control over how modules are consumed and shared across different layers or contexts. |
| packages/enhanced/src/lib/sharing/ConsumeSharedModule.ts | The code changes in this pull request focus on enhancing the module sharing functionality in the enhanced package. The key modifications are:
- Updates to the
ConsumeSharedModuleandConsumeSharedPluginclasses to support module layers, including the addition of new properties likelayer,issuerLayer, andrequiredLayerto handle layer-specific requests and module factorization. - Addition of a new Jest command in the
package.jsonfile to run a specific test case for theConfigTestCases.basictest.jsfile. - Updates to the schema validation for the
ConsumeSharedPluginto ensure proper validation of the new layer-related properties.
These changes aim to improve the module sharing capabilities by introducing support for module layers, which allows for more granular control and management of shared modules within the application. |
| packages/enhanced/src/lib/sharing/ConsumeSharedPlugin.ts | The code changes in this pull request focus on enhancing the module sharing functionality in the enhanced package. The key modifications are:
-
The
ConsumeSharedModuleandConsumeSharedPluginclasses have been updated to support module layers, allowing for more granular control over how modules are shared and consumed. This includes adding new properties likelayer,issuerLayer, andrequiredLayerto theConsumeOptionstype and updating the corresponding logic in the plugin. -
The
package.jsonfile has been updated to add a new Jest command for testing theConfigTestCases.basictest.jsfile, and thewebpack-clidependency has been updated to version^5.1.4. -
The schema validation for the
ConsumeSharedPluginhas been improved by adding TypeScript-based validation functions to ensure proper validation of the new layer-related properties.
Overall, these changes aim to enhance the module sharing capabilities of the enhanced package, particularly by introducing support for module layers, which can help with more complex module management and sharing scenarios. |
| packages/enhanced/src/lib/sharing/ProvideSharedDependency.ts | The code changes in this pull request focus on enhancing the module sharing functionality in the enhanced package. The key modifications are:
-
The
ConsumeSharedModuleandConsumeSharedPluginclasses were updated to support module layers, allowing for more granular control over how modules are consumed and shared. This includes adding new properties likelayer,issuerLayer, andrequiredLayerto handle layer-specific requests and module factorization. -
The
ProvideSharedDependencyclass was updated to include a newlayerproperty, which allows for specifying layer information when providing shared modules. -
The
package.jsonfile was updated to add a new Jest command for testing theConfigTestCases.basictest.jsfile, and thewebpack-clidependency was updated to version^5.1.4. -
TypeScript-based validation functions were added to the
ConsumeSharedPluginschema to ensure proper validation of the new layer-related properties.
Overall, these changes aim to enhance the module sharing capabilities in the enhanced package, particularly by introducing support for module layers and improving the related configuration and validation mechanisms. |
| packages/enhanced/src/lib/sharing/ProvideSharedModule.ts | The code changes in this pull request focus on enhancing the module sharing functionality in the enhanced package. The key modifications are:
-
Updated the
ConsumeSharedModuleandConsumeSharedPluginclasses to support module layers, allowing for more granular control over module consumption and sharing. This includes adding new properties likelayer,issuerLayer, andrequiredLayerto handle layer-specific requests and module factorization. -
Added a new Jest command to the
package.jsonfile to run a specific test case for theConfigTestCases.basictest.jsfile, and updated thewebpack-clidependency to version^5.1.4. -
Implemented TypeScript-based validation functions for the
ConsumeSharedPluginschema to ensure proper validation of the new layer-related properties.
The overall purpose of these changes is to enhance the module sharing capabilities in the enhanced package, allowing for more flexible and granular control over module consumption and sharing, particularly in the context of module layers. |
| packages/enhanced/src/lib/sharing/ProvideSharedModuleFactory.ts | The code changes introduce several enhancements and fixes to the module sharing functionality in the enhanced package. The key modifications include:
-
Adding support for specifying and resolving module layers in the
ConsumeSharedModuleandConsumeSharedPluginclasses. This includes introducing new properties likelayer,issuerLayer, andrequiredLayerto handle layer-specific requests and factorize modules based on the layer context. -
Updating the
package.jsonfile to add a new Jest command for running a specific test case and updating thewebpack-clidependency to version^5.1.4. -
Implementing TypeScript-based validation functions for the
ConsumeSharedPluginschema to ensure proper validation of the new layer-related properties.
The changes aim to enhance the module sharing functionality by introducing support for module layers, which allows for more granular control and management of shared modules within the application. |
| packages/enhanced/src/lib/sharing/ProvideSharedPlugin.ts | The code changes in this pull request focus on enhancing the module sharing functionality in the enhanced package. The key modifications are:
-
Added support for specifying and resolving module layers in the
ConsumeSharedModuleandConsumeSharedPluginclasses. This includes introducing new properties likelayer,issuerLayer, andrequiredLayerto handle layer-specific requests and factorize modules based on the layer context. -
Updated the
ProvideSharedPluginclass to handle layer-specific requests and create composite keys for module lookup based on the layer information. This allows for better management and resolution of shared modules across different layers. -
Added TypeScript-based validation functions for the
ConsumeSharedPluginschema to ensure proper validation of the new layer-related properties. -
Updated the
package.jsonfile by adding a new Jest command to run specific test cases and bumping thewebpack-clidependency to version^5.1.4.
The primary purpose of these changes is to enhance the module sharing capabilities in the enhanced package, particularly by introducing support for module layers. This will allow for more granular control and management of shared modules, enabling better isolation and flexibility in the application's architecture. |
| packages/enhanced/src/lib/sharing/SharePlugin.ts | Here is a short and concise technical summary of the changes:
The code changes introduce support for module layers in the ConsumeSharedModule and ConsumeSharedPlugin classes. This includes adding new properties like layer, issuerLayer, and requiredLayer to handle layer-specific module requests and factorize modules based on the layer context. Additionally, the package.json file was updated to include a new Jest command for testing the ConfigTestCases.basictest.js file, and TypeScript-based validation functions were added to ensure proper validation of the new properties in the ConsumeSharedPlugin schema. |
| packages/enhanced/src/lib/sharing/ShareRuntimeModule.ts | The code changes in this pull request focus on enhancing the module sharing functionality in the enhanced package. The key modifications are:
-
Updated the
ConsumeSharedModuleandConsumeSharedPluginclasses to support module layers, allowing for more granular control over module sharing and consumption. This includes adding new properties likelayer,issuerLayer, andrequiredLayerto handle layer-specific requests and module factorization. -
Added a new Jest command to the
package.jsonfile to run a specific test case for theConfigTestCases.basictest.jsfile, along with an update to thewebpack-clidependency. -
Implemented TypeScript-based validation functions for the
ConsumeSharedPluginschema to ensure proper validation of the new layer-related properties.
The overall purpose of these changes is to improve the module sharing capabilities within the enhanced package, providing more flexibility and control over how modules are shared and consumed, particularly when dealing with module layers. |
| packages/enhanced/src/lib/sharing/resolveMatchedConfigs.ts | The code changes in this pull request focus on enhancing the module sharing functionality in the enhanced package. The key modifications are:
-
Updated the
ConsumeSharedModuleandConsumeSharedPluginto support module layers, allowing for more granular control over module sharing and resolution. This includes adding new properties likelayer,issuerLayer, andrequiredLayerto handle layer-specific requests and factorize modules based on the layer context. -
Added a new Jest command to the
package.jsonfile to run a specific test case for theConfigTestCases.basictest.jsfile, and updated thewebpack-clidependency to version^5.1.4. -
Implemented TypeScript-based validation functions for the
ConsumeSharedPluginschema to ensure proper validation of the new layer-related properties.
The overall goal of these changes is to enhance the module sharing capabilities in the enhanced package, providing more flexibility and control over how modules are shared and consumed across different layers or contexts. |
| packages/enhanced/src/lib/sharing/utils.ts | The code changes in this pull request focus on enhancing the module sharing functionality in the enhanced package. The key modifications are:
-
The
ConsumeSharedModuleandConsumeSharedPluginclasses have been updated to support module layers, allowing for more granular control over how modules are shared and consumed. This includes adding new properties likelayer,issuerLayer, andrequiredLayerto theConsumeOptionstype and updating the corresponding logic in the classes. -
The
package.jsonfile has been updated to add a new Jest command for testing theConfigTestCases.basictest.jsfile, and thewebpack-clidependency has been updated to version^5.1.4. -
The
ConsumeSharedPluginschema validation has been enhanced with TypeScript-based validation functions to ensure proper validation of the new layer-related properties.
Overall, these changes aim to improve the module sharing capabilities in the enhanced package, particularly by introducing support for module layers and updating the related tooling and validation. |
| packages/enhanced/src/schemas/sharing/ConsumeSharedPlugin.check.ts | The changes in this file focus on enhancing the schema validation for the ConsumeSharedPlugin in the enhanced package. The key modifications are:
- Added support for validating new properties related to module layers, such as
issuerLayer,requiredLayer, andlayer. These properties are now checked for their existence and type (string) in the plugin options. - Expanded the validation to ensure that the
import,packageName,requiredVersion,shareKey,shareScope, andlayerproperties are properly defined and meet the expected criteria (e.g., non-empty string). - Introduced additional checks to ensure that the
eagerandsingletonproperties are of the correct type (boolean). - Factored out the validation logic into separate functions (
r,e,t,n) to improve code organization and readability.
Overall, these changes aim to provide a more robust and comprehensive schema validation for the ConsumeSharedPlugin, ensuring that the plugin options are properly configured and meet the expected requirements. |
| packages/enhanced/src/schemas/sharing/ConsumeSharedPlugin.ts | The code changes in this pull request focus on enhancing the module sharing functionality in the enhanced package. The key modifications are:
-
The
ConsumeSharedModuleandConsumeSharedPluginclasses have been updated to support module layers, allowing for more granular control over how modules are consumed and shared. This includes the addition of new properties likelayer,issuerLayer, andrequiredLayerto handle layer-specific requests and module factorization. -
The
package.jsonfile has been updated to add a new Jest command for running a specific test case, and thewebpack-clidependency has been updated to version^5.1.4. -
The schema validation for the
ConsumeSharedPluginhas been improved by adding TypeScript-based validation functions to ensure proper validation of the new layer-related properties.
These changes aim to provide more flexibility and control over the module sharing functionality in the enhanced package, allowing for better support of layered module architectures. |
| packages/enhanced/src/schemas/sharing/ProviderSharedPlugin.check.ts | The code changes in this pull request focus on enhancing the module sharing functionality in the enhanced package. The key modifications are:
-
Added support for specifying and resolving module layers in the
ConsumeSharedModuleandConsumeSharedPluginclasses. This includes new properties likelayer,issuerLayer, andrequiredLayerto handle layer-specific requests and module factorization. -
Updated the
package.jsonfile by adding a new Jest command to run a specific test case and updating thewebpack-clidependency to version^5.1.4. -
Implemented TypeScript-based validation functions for the
ConsumeSharedPluginschema to ensure proper validation of the new layer-related properties.
The changes aim to enhance the module sharing functionality by introducing support for module layers, which allows for more granular control and management of shared modules within the application. |
| packages/enhanced/src/schemas/sharing/ProviderSharedPlugin.ts | The code changes in this pull request focus on enhancing the module sharing functionality in the enhanced package. The key modifications are:
-
Updated the
ConsumeSharedModuleandConsumeSharedPluginclasses to support module layers, adding new properties likelayer,issuerLayer, andrequiredLayerto handle layer-specific requests and factorize modules based on the layer context. -
Added a new Jest command to the
package.jsonfile to run a specific test case for theConfigTestCases.basictest.jsfile, and updated thewebpack-clidependency to version^5.1.4. -
Introduced TypeScript-based validation functions for the
ConsumeSharedPluginschema to ensure proper validation of the new properties related to module layers. |
| packages/enhanced/test/configCases/sharing/layers-consume-loader/src/index.js | The code changes in this pull request focus on enhancing the module sharing functionality in theenhancedpackage. The key modifications are: -
The
ConsumeSharedModuleandConsumeSharedPluginclasses were updated to support module layers, allowing for more granular control over module sharing and resolution. This includes adding new properties likelayer,issuerLayer, andrequiredLayerto handle layer-specific requests. -
The
package.jsonfile was updated to add a new Jest command for testing theConfigTestCases.basictest.jsfile, and thewebpack-clidependency was updated to version^5.1.4. -
The
ConsumeSharedPluginschema validation was enhanced with TypeScript-based validation functions to ensure proper validation of the new layer-related properties.
These changes aim to improve the module sharing capabilities in the enhanced package, particularly by introducing support for module layers and enhancing the related configuration and testing. |
| packages/enhanced/test/configCases/sharing/layers-provides-loader/src/index.js | The changes in this file introduce several enhancements and fixes to the module sharing functionality in the enhanced package. The key modifications are:
- Added support for specifying and resolving module layers in the
ConsumeSharedModuleandConsumeSharedPluginclasses, including new properties likelayer,issuerLayer, andrequiredLayer. - Updated the
ConsumeSharedPluginclass to handle layer-specific requests and factorize modules based on the layer context. - Added a new Jest command to the
package.jsonfile to run a specific test case, and updated thewebpack-clidependency. - Added TypeScript-based validation functions for the
ConsumeSharedPluginschema to ensure proper validation of the new properties.
The primary purpose of these changes is to enhance the module sharing capabilities of the enhanced package, particularly by introducing support for module layers, which allows for more granular control and management of shared modules. |
| packages/enhanced/test/configCases/sharing/layers-share-plugin/src/index.js | The code changes in this pull request focus on enhancing the module sharing functionality in the enhanced package. The key modifications are:
- Updates to the
ConsumeSharedModuleandConsumeSharedPluginclasses to support module layers, including the addition of new properties likelayer,issuerLayer, andrequiredLayerto handle layer-specific requests and module factorization. - Addition of a new Jest command in the
package.jsonfile to run a specific test case for theConfigTestCases.basictest.jsfile. - Addition of TypeScript-based validation functions in the
ConsumeSharedPlugin.check.tsfile to ensure proper validation of the new properties introduced for module layer support.
The primary purpose of these changes is to extend the module sharing capabilities in the enhanced package by introducing support for module layers, allowing for more granular control and management of shared modules across different layers or contexts. |
There was a problem hiding this comment.
Incremental Review
Comments posted: 11
Configuration
Squadron Mode: essential
Commits Reviewed
e26d10712d98c450b9ae57babdfab27dee9e1dad...24ef6d05e48f9cb5f128479f515714e50028e780
Files Reviewed
- packages/enhanced/src/declarations/plugins/sharing/ConsumeSharedPlugin.d.ts
- packages/enhanced/src/declarations/plugins/sharing/SharePlugin.d.ts
- packages/enhanced/src/lib/sharing/ConsumeSharedModule.ts
- packages/enhanced/src/lib/sharing/ConsumeSharedPlugin.ts
- packages/enhanced/src/lib/sharing/SharePlugin.ts
Files Ignored
These files were ignored due to the filter in the squadron.yaml file.
- package.json
- packages/enhanced/test/configCases/sharing/layers-consume-entry/.gitignore
- packages/enhanced/test/configCases/sharing/layers-consume-entry/async-boundary.js
- packages/enhanced/test/configCases/sharing/layers-consume-entry/index-test.js
- packages/enhanced/test/configCases/sharing/layers-consume-entry/index.js
- packages/enhanced/test/configCases/sharing/layers-consume-entry/layer-exporter.js
- packages/enhanced/test/configCases/sharing/layers-consume-entry/node_modules/react/index.js
- packages/enhanced/test/configCases/sharing/layers-consume-entry/node_modules/react/index2.js
- packages/enhanced/test/configCases/sharing/layers-consume-entry/package.json
- packages/enhanced/test/configCases/sharing/layers-consume-entry/test.config.js
- packages/enhanced/test/configCases/sharing/layers-consume-entry/webpack.config.js
- packages/enhanced/test/configCases/sharing/layers-consume-loader/.gitignore
- packages/enhanced/test/configCases/sharing/layers-consume-loader/loaders/different-layer-loader.js
- packages/enhanced/test/configCases/sharing/layers-consume-loader/loaders/explicit-layer-loader.js
- packages/enhanced/test/configCases/sharing/layers-consume-loader/loaders/react-layer-loader.js
- packages/enhanced/test/configCases/sharing/layers-consume-loader/node_modules/react/index.js
- packages/enhanced/test/configCases/sharing/layers-consume-loader/node_modules/react/index2.js
- packages/enhanced/test/configCases/sharing/layers-consume-loader/package.json
- packages/enhanced/test/configCases/sharing/layers-consume-loader/shared/react-boundary.js
- packages/enhanced/test/configCases/sharing/layers-consume-loader/test.config.js
- packages/enhanced/test/configCases/sharing/layers-consume-loader/tests/different-layers.test.js
- packages/enhanced/test/configCases/sharing/layers-consume-loader/tests/layer-inheritance.test.js
- packages/enhanced/test/configCases/sharing/layers-consume-loader/tests/unlayered-share.test.js
- packages/enhanced/test/configCases/sharing/layers-consume-loader/webpack.config.js
- pnpm-lock.yaml
Co-authored-by: Hanric <hanric.zhang@gmail.com>
# Conflicts: # pnpm-lock.yaml
# Conflicts: # pnpm-lock.yaml
# Conflicts: # pnpm-lock.yaml
|
need to update changeset , current can not be consumed... https://github.com/module-federation/core/actions/runs/14100100380/job/39494613362 |
|
Sure thing, doing it now! |
# Conflicts: # .cursorignore # pnpm-lock.yaml
5ca6558 to
7aa14e5
Compare
7aa14e5 to
daa8d98
Compare
Description
This pull request enhances the module sharing functionality in the
enhancedpackage by implementing comprehensive layer support and improving schema validation. The changes focus on the compiler mechanics for module layers, with runtime updates planned for a future PR.#3153
Key Changes
Schema Validation Enhancements
ConsumeSharedPluginschemaProvideSharedPluginschema with layer supportModule Resolution Improvements
Share Configuration Updates
normalizeConsumeShareOptionsExample Configuration
Technical Implementation Details
utils.ts]: Enhanced module resolution with layer supportConsumeSharedPlugin.check.ts]: Added comprehensive schema validationProviderSharedPlugin.ts]: Updated schema with layer propertiesNote
This PR focuses on the compiler mechanics for module layers. Runtime module aspects will be updated in a subsequent PR.
Types of changes
Checklist