webpack-federation-types-plugin 1.4.0 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/FederationTypesPlugin.js +9 -1
- package/LICENSE +1 -1
- package/README.md +2 -0
- package/package.json +5 -5
package/FederationTypesPlugin.js
CHANGED
|
@@ -70,7 +70,10 @@ class FederationTypesPlugin {
|
|
|
70
70
|
compiler.options.plugins && compiler.options.plugins.find((plugin) => plugin.constructor.name === "ModuleFederationPlugin")
|
|
71
71
|
if (!federationPlugin) throw new Error("No ModuleFederationPlugin found.")
|
|
72
72
|
|
|
73
|
-
const federationsOptions = merge(
|
|
73
|
+
const federationsOptions = merge(
|
|
74
|
+
federationPlugin._options ?? federationPlugin.userOptions ?? {},
|
|
75
|
+
this._options.federationConfig ?? {},
|
|
76
|
+
)
|
|
74
77
|
const logger = compiler.getInfrastructureLogger(PLUGIN_NAME)
|
|
75
78
|
|
|
76
79
|
const exposes = Object.fromEntries(
|
|
@@ -162,6 +165,11 @@ class FederationTypesPlugin {
|
|
|
162
165
|
.then((response) => response?.data)
|
|
163
166
|
.then((modulesNames) => {
|
|
164
167
|
if (!modulesNames) return
|
|
168
|
+
// Ensure modulesNames is an array
|
|
169
|
+
if (!Array.isArray(modulesNames)) {
|
|
170
|
+
logger.warn(`Expected array but got ${typeof modulesNames} for remote ${remoteName}`)
|
|
171
|
+
return
|
|
172
|
+
}
|
|
165
173
|
// for each remote module get his types
|
|
166
174
|
modulesNames.forEach((moduleName) => {
|
|
167
175
|
const moduleDeclarationFileUrl = federationTypesUrl + moduleName
|
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# webpack-federation-types-plugin
|
|
2
2
|
|
|
3
|
+
[](https://github.com/DanielAmenou/webpack-federation-types-plugin/blob/main/LICENSE) [](https://www.npmjs.com/package/webpack-federation-types-plugin) [](https://www.npmjs.com/package/webpack-federation-types-plugin)
|
|
4
|
+
|
|
3
5
|
This plugin generates TypeScript type declaration files for the modules exposed by a remote application. It enables the automatic creation, sharing, and fetching of type definitions for your modules across different applications in a Webpack Module Federation setup.
|
|
4
6
|
|
|
5
7
|
The plugin compiles the exposed modules into TypeScript declaration files and shares them as public assets. On the consumer side, it automatically fetches these remote type declaration files and places them in the standard node_modules/@types directory. This ensures that the consuming application can seamlessly access the type definitions without any additional setup, making the integration of remote types effortless and transparent.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webpack-federation-types-plugin",
|
|
3
3
|
"description": "This plugin adds type definitions for remote modules",
|
|
4
|
-
"version": "1.4.
|
|
4
|
+
"version": "1.4.2",
|
|
5
5
|
"main": "FederationTypesPlugin.js",
|
|
6
6
|
"types": "types.d.ts",
|
|
7
7
|
"scripts": {
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
"author": "Daniel Amenou <amenou.daniel@gmail.com>",
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"axios": "^1.
|
|
28
|
-
"fs-extra": "^11.
|
|
27
|
+
"axios": "^1.13.2",
|
|
28
|
+
"fs-extra": "^11.3.3",
|
|
29
29
|
"ms": "^2.1.3",
|
|
30
|
-
"schema-utils": "^4.3.
|
|
31
|
-
"typescript": "^
|
|
30
|
+
"schema-utils": "^4.3.3",
|
|
31
|
+
"typescript": "^5.9.3",
|
|
32
32
|
"webpack-merge": "^6.0.1"
|
|
33
33
|
}
|
|
34
34
|
}
|