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.
@@ -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(federationPlugin._options, this._options.federationConfig || {})
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
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 Daniel Amenou
3
+ Copyright (c) 2026 Daniel Amenou
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # webpack-federation-types-plugin
2
2
 
3
+ [![License](https://img.shields.io/npm/l/webpack-federation-types-plugin.svg)](https://github.com/DanielAmenou/webpack-federation-types-plugin/blob/main/LICENSE) [![npm downloads](https://img.shields.io/npm/dt/webpack-federation-types-plugin.svg)](https://www.npmjs.com/package/webpack-federation-types-plugin) [![npm version](https://img.shields.io/npm/v/webpack-federation-types-plugin.svg)](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.0",
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.7.9",
28
- "fs-extra": "^11.2.0",
27
+ "axios": "^1.13.2",
28
+ "fs-extra": "^11.3.3",
29
29
  "ms": "^2.1.3",
30
- "schema-utils": "^4.3.0",
31
- "typescript": "^4.9.4",
30
+ "schema-utils": "^4.3.3",
31
+ "typescript": "^5.9.3",
32
32
  "webpack-merge": "^6.0.1"
33
33
  }
34
34
  }