-
-
Notifications
You must be signed in to change notification settings - Fork 254
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): support layers in consume share plugin #3276
base: main
Are you sure you want to change the base?
Conversation
# Conflicts: # pnpm-lock.yaml
# Conflicts: # pnpm-lock.yaml
# Conflicts: # pnpm-lock.yaml
🦋 Changeset detectedLatest commit: 243f1bc 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
Here is a concise summary of the pull request:
This pull request introduces several enhancements to the module sharing functionality in the enhanced
package. The key changes include:
- Added support for specifying and resolving module layers in the
ConsumeSharedModule
andConsumeSharedPlugin
classes, allowing for more granular control over how modules are shared and consumed. This includes new properties likelayer
,issuerLayer
, andrequiredLayer
. - Updated the
ConsumeSharedPlugin
class to handle layer-specific requests and factorize modules based on the layer context. - Added a new Jest command to the
package.json
file to run specific test cases for the layer-related functionality, and updated thewebpack-cli
dependency. - Implemented TypeScript-based validation functions for the
ConsumeSharedPlugin
schema to ensure proper validation of the new layer-related properties.
These changes aim to enhance the module sharing capabilities in the enhanced
package by introducing support for module layers, improving the overall module management and resolution process.
File Summaries
File | Summary |
---|---|
packages/enhanced/src/declarations/plugins/sharing/ConsumeSharedModule.d.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
ConsumeSharedModule
class, including new properties likelayer
,issuerLayer
, andrequiredLayer
in theConsumeOptions
type. This allows for more granular control over how modules are shared and consumed. -
Updated the
ConsumeSharedPlugin
class to handle layer-specific requests and factorize modules based on the layer context. New properties likeissuerLayer
andrequiredLayer
were added to the plugin options to facilitate this functionality. -
Added a new Jest command to the
package.json
file to run specific test cases for theConfigTestCases.basictest.js
file, and updated thewebpack-cli
dependency to version^5.1.4
. -
Implemented TypeScript-based validation functions for the
ConsumeSharedPlugin
schema to ensure proper validation of the new properties related to module layers.
Overall, these changes aim to enhance the module sharing capabilities in the enhanced
package by introducing support for module layers, which allows for more flexible and granular control over how modules are shared and consumed within the application. |
| packages/enhanced/src/declarations/plugins/sharing/ConsumeSharedPlugin.d.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 ConsumeSharedModule
and ConsumeSharedPlugin
classes, updating the package.json
file to include a new Jest command, and adding TypeScript-based validation functions for the ConsumeSharedPlugin
schema to ensure proper validation of the new properties. |
| packages/enhanced/src/declarations/plugins/sharing/ProvideSharedPlugin.d.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
ConsumeSharedModule
andConsumeSharedPlugin
classes, with new properties likelayer
,issuerLayer
, andrequiredLayer
. -
Updating the
ConsumeSharedPlugin
class to handle layer-specific requests and factorize modules based on the layer context. -
Adding a new Jest command to the
package.json
file to run a specific test case, and updating thewebpack-cli
dependency. -
Introducing TypeScript-based validation functions for the
ConsumeSharedPlugin
schema to ensure proper validation of the new properties. |
| packages/enhanced/src/declarations/plugins/sharing/SharePlugin.d.ts | The code changes introduce several enhancements and fixes to the module sharing functionality in theenhanced
package. The key modifications include adding support for specifying and resolving module layers in theConsumeSharedModule
andConsumeSharedPlugin
classes, updating thepackage.json
file to include a new Jest command, and adding TypeScript-based validation functions for theConsumeSharedPlugin
schema to ensure proper validation of the new properties. |
| packages/enhanced/src/lib/sharing/ConsumeSharedModule.ts | The changes in this pull request focus on enhancing the module sharing functionality in theenhanced
package. The key modifications are: -
Added support for specifying and resolving module layers in the
ConsumeSharedModule
andConsumeSharedPlugin
classes. This includes introducing new properties likelayer
,issuerLayer
, andrequiredLayer
to handle layer-specific requests and factorize modules based on the layer context. -
Updated the
package.json
file by adding a new Jest command to run specific test cases for theConfigTestCases.basictest.js
file, and also updated thewebpack-cli
dependency to version^5.1.4
. -
Implemented TypeScript-based validation functions for the
ConsumeSharedPlugin
schema to ensure proper validation of the new layer-related properties. |
| packages/enhanced/src/lib/sharing/ConsumeSharedPlugin.ts | The code changes in this pull request focus on enhancing the module sharing functionality in theenhanced
package. The key modifications are: -
Updated the
ConsumeSharedModule
andConsumeSharedPlugin
classes to support module layers, adding new properties likelayer
,issuerLayer
, andrequiredLayer
to handle layer-specific requests and factorize modules based on the layer context. -
Added a new Jest command to the
package.json
file to run a specific test case for theConfigTestCases.basictest.js
file. -
Updated the schema validation for the
ConsumeSharedPlugin
to ensure proper validation of the new layer-related properties. |
| packages/enhanced/src/lib/sharing/ProvideSharedDependency.ts | The code changes introduce support for module layers in theConsumeSharedModule
andConsumeSharedPlugin
classes. The key modifications are: -
Added new properties (
layer
,issuerLayer
,requiredLayer
) to theConsumeOptions
type and updated theConsumeSharedModule
class to handle layer-specific requests and factorize modules based on layer context. -
Updated the
ConsumeSharedPlugin
class to support layer-specific requests and addedissuerLayer
andrequiredLayer
properties to the plugin options. -
Added TypeScript-based validation functions for the
ConsumeSharedPlugin
schema to ensure proper validation of the new properties. -
Added a new Jest command to the
package.json
file and updated thewebpack-cli
dependency to version^5.1.4
. |
| packages/enhanced/src/lib/sharing/ProvideSharedModule.ts | The code changes in this pull request focus on enhancing the module sharing functionality in theenhanced
package. The key modifications are: -
Updated the
ConsumeSharedModule
andConsumeSharedPlugin
classes to support module layers, adding new properties likelayer
,issuerLayer
, andrequiredLayer
to handle layer-specific requests and factorize modules based on the layer context. -
Added a new Jest command to the
package.json
file to run a specific test case for theConfigTestCases.basictest.js
file, and updated thewebpack-cli
dependency to version^5.1.4
. -
Added TypeScript-based validation functions for the
ConsumeSharedPlugin
schema to ensure proper validation of the new properties related to module layers. |
| packages/enhanced/src/lib/sharing/ProvideSharedPlugin.ts | The key changes in this file are: -
The
ProvideSharedPlugin
class has been updated to support module layers. This includes adding new properties likelayer
andrequest
to theProvidesConfig
type, and introducing acreateLookupKey
function to handle layer-specific requests. -
The plugin's
apply
method has been modified to maintain aresolvedProvideMap
that tracks the provided modules, their configurations, and associated versions. This map is now keyed by a composite key that includes the layer information. -
The
provideSharedModule
function has been updated to store theresource
information in theresolvedProvideMap
in addition to the configuration and version. -
The
normalModuleFactory.hooks.module
tap has been modified to check theresolvedProvideMap
using the layer-aware lookup key, and provide the shared module if a match is found. -
The
compilation.addInclude
call in theafterCompile
hook has been updated to use theresource
or the composite lookup key, depending on whether the resource information is available.
Overall, these changes aim to enhance the module sharing functionality in the ProvideSharedPlugin
by introducing support for module layers, improving the resolution and tracking of provided modules, and ensuring that the plugin can handle layer-specific requests. |
| packages/enhanced/src/lib/sharing/SharePlugin.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
ConsumeSharedModule
class, with new properties likelayer
,issuerLayer
, andrequiredLayer
added to theConsumeOptions
type. -
Updating the
ConsumeSharedPlugin
class to handle layer-specific requests and factorize modules based on the layer context, with the addition ofissuerLayer
andrequiredLayer
properties to the plugin options. -
Adding a new Jest command to the
package.json
file to run a specific test case, and updating thewebpack-cli
dependency to version^5.1.4
. -
Implementing TypeScript-based validation functions for the
ConsumeSharedPlugin
schema to ensure proper validation of the new properties. |
| packages/enhanced/src/lib/sharing/resolveMatchedConfigs.ts | The code changes in this pull request focus on enhancing the module sharing functionality in theenhanced
package. The key modifications are: -
Updated the
ConsumeSharedModule
andConsumeSharedPlugin
classes to support module layers, adding new properties (layer
,issuerLayer
,requiredLayer
) to handle layer-specific requests and factorize modules based on the layer context. -
Added a new Jest command to the
package.json
file to run a specific test case for theConfigTestCases.basictest.js
file. -
Added TypeScript-based validation functions for the
ConsumeSharedPlugin
schema to ensure proper validation of the new properties.
The 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/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 (
layer
,issuerLayer
,requiredLayer
) in theConsumeOptions
type, which were introduced to enable module layer handling in theConsumeSharedModule
andConsumeSharedPlugin
classes. - Implemented TypeScript-based validation functions to ensure proper validation of the new properties, along with the existing properties like
import
,packageName
,requiredVersion
,shareKey
,shareScope
,singleton
, andstrictVersion
. - The validation logic covers checking the data types, lengths, and presence of the required properties to ensure the
ConsumeSharedPlugin
configuration is valid.
Overall, these changes aim to provide a robust schema validation mechanism for the module sharing functionality in the enhanced
package, particularly with the introduction of module layer support. |
| packages/enhanced/src/schemas/sharing/ConsumeSharedPlugin.ts | The changes in this pull request focus on enhancing the module sharing functionality in the enhanced
package. The key modifications are:
-
Updated the
ConsumeSharedModule
andConsumeSharedPlugin
classes to support module layers, adding new properties likelayer
,issuerLayer
, andrequiredLayer
to handle layer-specific requests and factorize modules based on the layer context. -
Added a new Jest command to the
package.json
file to run a specific test case for theConfigTestCases.basictest.js
file, and updated thewebpack-cli
dependency to version^5.1.4
. -
Introduced TypeScript-based validation functions for the
ConsumeSharedPlugin
schema to ensure proper validation of the new layer-related properties. |
| packages/enhanced/src/schemas/sharing/ProviderSharedPlugin.check.ts | The code changes introduce several enhancements and fixes to the module sharing functionality in theenhanced
package. The key modifications are: -
Added support for specifying and resolving module layers in the
ConsumeSharedModule
andConsumeSharedPlugin
classes, including new properties likelayer
,issuerLayer
, andrequiredLayer
. -
Updated the
ConsumeSharedPlugin
class to handle layer-specific requests and factorize modules based on the layer context. -
Added a new Jest command to the
package.json
file to run a specific test case for theConfigTestCases.basictest.js
file. -
Added TypeScript-based validation functions for the
ConsumeSharedPlugin
schema to ensure proper validation of the new properties. |
| packages/enhanced/src/schemas/sharing/ProviderSharedPlugin.ts | The code changes introduce several enhancements and fixes to the module sharing functionality in theenhanced
package. The key modifications include: -
Adding support for specifying and resolving module layers in the
ConsumeSharedModule
andConsumeSharedPlugin
classes, with new properties likelayer
,issuerLayer
, andrequiredLayer
to handle layer-specific requests and factorize modules based on layer context. -
Updating the
package.json
file to add a new Jest command for testing theConfigTestCases.basictest.js
file and upgrading thewebpack-cli
dependency. -
Implementing TypeScript-based validation functions for the
ConsumeSharedPlugin
schema to ensure proper validation of the new properties. |
| packages/enhanced/test/configCases/sharing/layers-consume-loader/src/index.js | The code changes introduce several enhancements and fixes to the module sharing functionality in theenhanced
package. The key modifications include: -
Adding support for specifying and resolving module layers in the
ConsumeSharedModule
andConsumeSharedPlugin
classes, allowing for more granular control over module sharing and consumption. -
Updating the
ConsumeSharedPlugin
class to handle layer-specific requests and factorize modules based on the layer context, improving the overall module sharing experience. -
Adding a new Jest command to the
package.json
file to facilitate testing of the layer-related functionality, and updating thewebpack-cli
dependency to the latest version. -
Implementing TypeScript-based validation functions for the
ConsumeSharedPlugin
schema to ensure proper validation of the new layer-related properties. |
| packages/enhanced/test/configCases/sharing/layers-provides-loader/src/index.js | The code changes introduce several enhancements and fixes to the module sharing functionality in theenhanced
package. The key modifications include: -
Adding support for specifying and resolving module layers in the
ConsumeSharedModule
andConsumeSharedPlugin
classes, allowing for more granular control over module sharing. -
Updating the
package.json
file to include a new Jest command for testing the layer-specific functionality, and bumping thewebpack-cli
dependency to a newer version. -
Implementing TypeScript-based validation functions for the
ConsumeSharedPlugin
schema to ensure proper validation of the new layer-related properties.
These changes aim to improve the module sharing capabilities of the enhanced
package, particularly in scenarios where module layers need to be considered. |
| packages/enhanced/test/configCases/sharing/layers-share-plugin/src/index.js | 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
ConsumeSharedModule
andConsumeSharedPlugin
classes, allowing for more granular control over module sharing. - Updating the
ConsumeSharedPlugin
class to handle layer-specific requests and factorize modules based on the layer context. - Adding a new Jest command to the
package.json
file to run a specific test case for theConfigTestCases.basictest.js
file. - Implementing TypeScript-based validation functions for the
ConsumeSharedPlugin
schema to ensure proper validation of the new properties related to module layers. |
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.
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
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.
Incremental Review
Comments posted: 11
Configuration
Squadron Mode: essential
Commits Reviewed
40ae81768f47bbce75b3d6f88dfb5826a1d94774...04b8ffdd26412715669fa17f9413b0d5b7275d23
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/ConsumeSharedPlugin.ts
- packages/enhanced/src/lib/sharing/SharePlugin.ts
- packages/enhanced/src/schemas/sharing/ConsumeSharedPlugin.check.ts
- packages/enhanced/src/schemas/sharing/ConsumeSharedPlugin.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
e6d565c
to
b8df73e
Compare
# Conflicts: # pnpm-lock.yaml
Description
This pull request introduces several enhancements and fixes to the module sharing functionality in the
enhanced
package. The changes include updating theConsumeSharedModule
andConsumeSharedPlugin
to support module layers, adding a new Jest command to thepackage.json
, and updating schema validation for theConsumeSharedPlugin
.Enhancements to Module Sharing:
packages/enhanced/src/lib/sharing/ConsumeSharedModule.ts
: Added support for specifying and resolving module layers with new properties (layer
,issuerLayer
,requiredLayer
) in theConsumeOptions
type and updated theConsumeSharedModule
class accordingly. [1] [2] [3] [4] [5]packages/enhanced/src/lib/sharing/ConsumeSharedPlugin.ts
: Updated theConsumeSharedPlugin
class to handle layer-specific requests and factorize modules based on layer context. AddedissuerLayer
andrequiredLayer
properties to the plugin options. [1] [2] [3] [4] [5] [6] [7] [8]Updates to
package.json
:package.json
: Added a new Jest command ("enhanced:jest": "pnpm build && cd packages/enhanced && NODE_OPTIONS=--experimental-vm-modules npx jest test/ConfigTestCases.basictest.js"
) and updated thewebpack-cli
dependency to version^5.1.4
. [1] [2]Schema Validation:
packages/enhanced/src/schemas/sharing/ConsumeSharedPlugin.check.ts
: Added TypeScript-based validation functions for theConsumeSharedPlugin
schema to ensure proper validation of the new properties.Note
Runtime module aspects still need to be updated, this is the compiler mechanics only for module. Runtime parts will likely be done once the other half of share plugin has layer support
Related Issue
Types of changes
Checklist