Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
feat(angular): add withModuleFederation helper (#9289)
* feat(angular): withModuleFederation helper
- Loading branch information
Showing
9 changed files
with
725 additions
and
25 deletions.
There are no files selected for viewing
This file contains 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 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 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
141 changes: 141 additions & 0 deletions
141
packages/angular/src/utils/mfe/__snapshots__/with-module-federation.spec.ts.snap
This file contains 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,141 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`withModuleFederation should collect dependencies correctly 1`] = ` | ||
Array [ | ||
ModuleFederationPlugin { | ||
"_options": Object { | ||
"exposes": Object { | ||
"./Module": "apps/remote1/src/module.ts", | ||
}, | ||
"filename": "remoteEntry.mjs", | ||
"library": Object { | ||
"type": "module", | ||
}, | ||
"name": "remote1", | ||
"remotes": Object {}, | ||
"shared": Object { | ||
"@angular/core": Object { | ||
"requiredVersion": "~13.2.0", | ||
"singleton": true, | ||
"strictVersion": true, | ||
}, | ||
"core": Object { | ||
"eager": undefined, | ||
"requiredVersion": false, | ||
}, | ||
"shared": Object { | ||
"eager": undefined, | ||
"requiredVersion": false, | ||
}, | ||
}, | ||
}, | ||
}, | ||
NormalModuleReplacementPlugin { | ||
"newResource": [Function], | ||
"resourceRegExp": /\\./, | ||
}, | ||
] | ||
`; | ||
|
||
exports[`withModuleFederation should create a host config correctly 1`] = ` | ||
Array [ | ||
ModuleFederationPlugin { | ||
"_options": Object { | ||
"exposes": undefined, | ||
"filename": "remoteEntry.mjs", | ||
"library": Object { | ||
"type": "module", | ||
}, | ||
"name": "host", | ||
"remotes": Object { | ||
"remote1": "http:/localhost:4201/remoteEntry.mjs", | ||
}, | ||
"shared": Object { | ||
"@angular/core": Object { | ||
"requiredVersion": "~13.2.0", | ||
"singleton": true, | ||
"strictVersion": true, | ||
}, | ||
"shared": Object { | ||
"eager": undefined, | ||
"requiredVersion": false, | ||
}, | ||
}, | ||
}, | ||
}, | ||
NormalModuleReplacementPlugin { | ||
"newResource": [Function], | ||
"resourceRegExp": /\\./, | ||
}, | ||
] | ||
`; | ||
|
||
exports[`withModuleFederation should create a remote config correctly 1`] = ` | ||
Array [ | ||
ModuleFederationPlugin { | ||
"_options": Object { | ||
"exposes": Object { | ||
"./Module": "apps/remote1/src/module.ts", | ||
}, | ||
"filename": "remoteEntry.mjs", | ||
"library": Object { | ||
"type": "module", | ||
}, | ||
"name": "remote1", | ||
"remotes": Object {}, | ||
"shared": Object { | ||
"@angular/core": Object { | ||
"requiredVersion": "~13.2.0", | ||
"singleton": true, | ||
"strictVersion": true, | ||
}, | ||
"shared": Object { | ||
"eager": undefined, | ||
"requiredVersion": false, | ||
}, | ||
}, | ||
}, | ||
}, | ||
NormalModuleReplacementPlugin { | ||
"newResource": [Function], | ||
"resourceRegExp": /\\./, | ||
}, | ||
] | ||
`; | ||
|
||
exports[`withModuleFederation should map dependencies from project name to import name 1`] = ` | ||
Array [ | ||
ModuleFederationPlugin { | ||
"_options": Object { | ||
"exposes": Object { | ||
"./Module": "apps/remote1/src/module.ts", | ||
}, | ||
"filename": "remoteEntry.mjs", | ||
"library": Object { | ||
"type": "module", | ||
}, | ||
"name": "remote1", | ||
"remotes": Object {}, | ||
"shared": Object { | ||
"@angular/core": Object { | ||
"requiredVersion": "~13.2.0", | ||
"singleton": true, | ||
"strictVersion": true, | ||
}, | ||
"@myorg/core": Object { | ||
"eager": undefined, | ||
"requiredVersion": false, | ||
}, | ||
"shared": Object { | ||
"eager": undefined, | ||
"requiredVersion": false, | ||
}, | ||
}, | ||
}, | ||
}, | ||
NormalModuleReplacementPlugin { | ||
"newResource": [Function], | ||
"resourceRegExp": /\\./, | ||
}, | ||
] | ||
`; |
This file contains 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 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
Oops, something went wrong.