webpack-federation-types-plugin 1.2.5 → 1.3.1

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.
@@ -1,196 +1,207 @@
1
- const validate = require("schema-utils").validate
2
- const ts = require("typescript")
3
- const axios = require("axios")
4
- const fs = require("fs-extra")
5
- const path = require("path")
6
- const ms = require("ms")
7
-
8
- let isFirstCompilation = true
9
- const PLUGIN_NAME = "FederationTypesPlugin"
10
- const MF_TYPES_DIR = "federation-types"
11
- const DECLARATION_FILE_EXT = ".d.ts"
12
-
13
- const tscOptions = {
14
- allowJs: true,
15
- declaration: true,
16
- emitDeclarationOnly: true,
17
- }
18
-
19
- const optionsSchema = {
20
- type: "object",
21
- properties: {
22
- excludeRemotes: {
23
- type: "array",
24
- },
25
- exposeTypes: {
26
- type: "boolean",
27
- },
28
- importTypes: {
29
- type: "boolean",
30
- },
31
- getTypesInterval: {
32
- type: "string",
33
- },
34
- },
35
- }
36
-
37
- const getAssetData = (content) => {
38
- const fileBuffer = Buffer.from(content, "utf-8")
39
- const fileData = {
40
- source: () => fileBuffer,
41
- size: () => fileBuffer.length,
42
- }
43
- return fileData
44
- }
45
-
46
- class FederationTypesPlugin {
47
- constructor(options = {}) {
48
- validate(optionsSchema, options)
49
- this._options = options
50
- }
51
-
52
- /**
53
- * @param {import("webpack").Compiler} compiler
54
- */
55
- apply(compiler) {
56
- let getTypesInterval
57
- const federationPlugin =
58
- compiler.options.plugins && compiler.options.plugins.find((plugin) => plugin.constructor.name === "ModuleFederationPlugin")
59
- if (!federationPlugin) throw new Error("No ModuleFederationPlugin found.")
60
- const logger = compiler.getInfrastructureLogger(PLUGIN_NAME)
61
-
62
- const exposes = Object.fromEntries(Object.entries(federationPlugin._options.exposes || {}).map(([moduleName, currentPath]) => {
63
- let isIndexFile = false
64
- const absPath = path.resolve(process.cwd(), currentPath)
65
- const hasExtension = !!path.extname(currentPath)
66
- const extension = hasExtension ? "" : fs.existsSync(absPath + ".jsx") ? ".jsx" : fs.existsSync(absPath + ".js") ? ".js" : ""
67
- if (!hasExtension && extension === "") {
68
- if ( fs.existsSync(path.resolve(absPath, "index.js"))) {
69
- isIndexFile = true
70
- }
71
- else logger.error(`Couldn't find ${currentPath}`)
72
- }
73
-
74
- return [moduleName.replace("./", ""), currentPath + (isIndexFile ? "/index.js" : "") + extension]
75
- }
76
- ))
77
-
78
- const modulesPathsMap = Object.fromEntries(
79
- Object.entries(exposes).map(([name, currentPath]) => {
80
- return [name, path.join(process.cwd(), currentPath).replace(/\\/g, "/")]
81
- })
82
- )
83
-
84
- const declarationFileToExposeNameMap = Object.entries(modulesPathsMap).reduce(
85
- (result, [key, val]) => Object.assign(result, {[val.replace(/\.jsx?$/, DECLARATION_FILE_EXT)]: key}),
86
- {}
87
- )
88
-
89
- const modulesPaths = Object.values(modulesPathsMap)
90
-
91
- const createTypesDefinitions = (compilation) => {
92
- const host = ts.createCompilerHost(tscOptions)
93
-
94
- const createdFiles = {}
95
- host.writeFile = (fileName, fileContent) => {
96
- const isExposedModules = modulesPaths.some((current) => current.startsWith(fileName.replace(/\.d\.ts/, "")))
97
- if (isExposedModules) {
98
- createdFiles[fileName] = fileContent
99
- }
100
- }
101
-
102
- const program = ts.createProgram(modulesPaths, tscOptions, host)
103
- program.emit()
104
-
105
- // create definitions files
106
- modulesPaths.forEach((modulePath) => {
107
- const typeDefFilePath = modulePath.replace(/\.jsx?$/, DECLARATION_FILE_EXT)
108
- const typeDefFileContent = createdFiles[typeDefFilePath]
109
- if (typeDefFileContent) {
110
- compilation.emitAsset(
111
- path.join(MF_TYPES_DIR, declarationFileToExposeNameMap[typeDefFilePath] + DECLARATION_FILE_EXT),
112
- getAssetData(typeDefFileContent)
113
- )
114
- } else {
115
- logger.warn(`failed to create ${typeDefFilePath}`)
116
- }
117
- })
118
-
119
- // create index.json
120
- const modulesNames = Object.keys(exposes).map((moduleName) => moduleName + DECLARATION_FILE_EXT)
121
- compilation.emitAsset(path.join(MF_TYPES_DIR, "index.json"), getAssetData(JSON.stringify(modulesNames)))
122
- }
123
-
124
- const getRemoteDeclareDirPath = (remoteName) => path.resolve(process.cwd(), "node_modules", "@types", remoteName)
125
-
126
- const getTypesDefinitions = async () => {
127
- const remotes = federationPlugin._options.remotes
128
- if (!remotes) return
129
-
130
- const excludeRemotes = this._options.excludeRemotes || []
131
- const wantedRemotes = Object.entries(remotes).filter((remote) => !excludeRemotes.find((c) => c === remote[0]))
132
-
133
- for (const [remoteName, remoteEntryUri] of wantedRemotes) {
134
- const {origin, pathname} = new URL(remoteEntryUri.split("@")[1])
135
- const remotePublicUrl = origin + pathname.slice(0, pathname.lastIndexOf("/") + 1)
136
- const remoteDeclareDirPath = getRemoteDeclareDirPath(remoteName)
137
- const federationTypesUrl = remotePublicUrl + MF_TYPES_DIR + "/"
138
-
139
- axios
140
- // get types index from the current remote
141
- .get(federationTypesUrl + "index.json")
142
- .catch((error) => {
143
- if (error.response?.status === 404) logger.warn(`WARNING: The remote ${remoteName} has no types`)
144
- else logger.warn(`Failed to get remote types from ${remotePublicUrl}.`, error.message)
145
- })
146
- .then((response) => response?.data)
147
- .then((modulesNames) => {
148
- if (!modulesNames) return
149
- // for each remote module get his types
150
- modulesNames.forEach((moduleName) => {
151
- const moduleDeclarationFileUrl = federationTypesUrl + moduleName
152
- axios
153
- .get(moduleDeclarationFileUrl)
154
- .catch((error) => {
155
- logger.warn(`Failed to get ${moduleDeclarationFileUrl} ${error.message}`)
156
- })
157
- .then((declarationFileResponse) => {
158
- if (!declarationFileResponse) return
159
- const declarationFileContent = declarationFileResponse.data
160
- const decFilePath = path.join(remoteDeclareDirPath, moduleName)
161
- fs.promises
162
- .mkdir(path.dirname(decFilePath), {recursive: true})
163
- .catch((error) => logger.error(`Failed to write dir: ${decFilePath}`, error))
164
- .then(() => fs.writeFile(decFilePath, declarationFileContent, {recursive: true}))
165
- .catch((error) => logger.error(`Failed to write declaration file: ${decFilePath}`, error))
166
- })
167
- .catch((error) => {
168
- logger.warn(`Failed to get ${moduleDeclarationFileUrl} ${error.message}`)
169
- })
170
- })
171
- })
172
- .catch((error) => {
173
- logger.error("Failed to add declaration file", error.message)
174
- })
175
- }
176
- }
177
-
178
- compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
179
- const pluginOptions = this._options || {}
180
- compilation.hooks.beforeCodeGeneration.tap(PLUGIN_NAME, () => {
181
- if (!isFirstCompilation) return
182
- isFirstCompilation = false
183
- if (pluginOptions.exposeTypes !== false) createTypesDefinitions(compilation)
184
- if (compilation.options.mode === "development" && pluginOptions.importTypes !== false) {
185
- getTypesDefinitions()
186
- if (pluginOptions.getTypesInterval) {
187
- clearInterval(getTypesInterval)
188
- getTypesInterval = setInterval(() => getTypesDefinitions(compilation), ms(pluginOptions.getTypesInterval))
189
- }
190
- }
191
- })
192
- })
193
- }
194
- }
195
-
196
- module.exports = FederationTypesPlugin
1
+ const validate = require("schema-utils").validate
2
+ const {merge} = require("webpack-merge")
3
+ const ts = require("typescript")
4
+ const axios = require("axios")
5
+ const fs = require("fs-extra")
6
+ const path = require("path")
7
+ const ms = require("ms")
8
+
9
+ let isFirstCompilation = true
10
+ const PLUGIN_NAME = "FederationTypesPlugin"
11
+ const MF_TYPES_DIR = "federation-types"
12
+ const DECLARATION_FILE_EXT = ".d.ts"
13
+
14
+ const tscOptions = {
15
+ allowJs: true,
16
+ declaration: true,
17
+ emitDeclarationOnly: true,
18
+ }
19
+
20
+ const optionsSchema = {
21
+ type: "object",
22
+ properties: {
23
+ excludeRemotes: {
24
+ type: "array",
25
+ },
26
+ exposeTypes: {
27
+ type: "boolean",
28
+ },
29
+ importTypes: {
30
+ type: "boolean",
31
+ },
32
+ getTypesInterval: {
33
+ type: "string",
34
+ },
35
+ federationConfig: {
36
+ type: "object",
37
+ properties: {
38
+ exposes: {type: "object"},
39
+ remotes: {type: "object"},
40
+ },
41
+ additionalProperties: false,
42
+ },
43
+ },
44
+ }
45
+
46
+ const getAssetData = (content) => {
47
+ const fileBuffer = Buffer.from(content, "utf-8")
48
+ const fileData = {
49
+ source: () => fileBuffer,
50
+ size: () => fileBuffer.length,
51
+ }
52
+ return fileData
53
+ }
54
+
55
+ class FederationTypesPlugin {
56
+ constructor(options = {}) {
57
+ validate(optionsSchema, options)
58
+ this._options = options
59
+ }
60
+
61
+ /**
62
+ * @param {import("webpack").Compiler} compiler
63
+ */
64
+ apply(compiler) {
65
+ let getTypesInterval
66
+ const federationPlugin =
67
+ compiler.options.plugins && compiler.options.plugins.find((plugin) => plugin.constructor.name === "ModuleFederationPlugin")
68
+ if (!federationPlugin) throw new Error("No ModuleFederationPlugin found.")
69
+
70
+ const federationsOptions = merge(federationPlugin._options, this._options.federationConfig || {})
71
+ const logger = compiler.getInfrastructureLogger(PLUGIN_NAME)
72
+
73
+ const exposes = Object.fromEntries(
74
+ Object.entries(federationsOptions.exposes || {}).map(([moduleName, currentPath]) => {
75
+ let isIndexFile = false
76
+ const absPath = path.resolve(process.cwd(), currentPath)
77
+ const hasExtension = !!path.extname(currentPath)
78
+ const extension = hasExtension ? "" : fs.existsSync(absPath + ".jsx") ? ".jsx" : fs.existsSync(absPath + ".js") ? ".js" : ""
79
+ if (!hasExtension && extension === "") {
80
+ if (fs.existsSync(path.resolve(absPath, "index.js"))) {
81
+ isIndexFile = true
82
+ } else logger.error(`Couldn't find ${currentPath}`)
83
+ }
84
+
85
+ return [moduleName.replace("./", ""), currentPath + (isIndexFile ? "/index.js" : "") + extension]
86
+ }),
87
+ )
88
+
89
+ const modulesPathsMap = Object.fromEntries(
90
+ Object.entries(exposes).map(([name, currentPath]) => {
91
+ return [name, path.join(process.cwd(), currentPath).replace(/\\/g, "/")]
92
+ }),
93
+ )
94
+
95
+ const declarationFileToExposeNameMap = Object.entries(modulesPathsMap).reduce(
96
+ (result, [key, val]) => Object.assign(result, {[val.replace(/\.jsx?$/, DECLARATION_FILE_EXT)]: key}),
97
+ {},
98
+ )
99
+
100
+ const modulesPaths = Object.values(modulesPathsMap)
101
+
102
+ const createTypesDefinitions = (compilation) => {
103
+ const host = ts.createCompilerHost(tscOptions)
104
+
105
+ const createdFiles = {}
106
+ host.writeFile = (fileName, fileContent) => {
107
+ const isExposedModules = modulesPaths.some((current) => current.startsWith(fileName.replace(/\.d\.ts/, "")))
108
+ if (isExposedModules) {
109
+ createdFiles[fileName] = fileContent
110
+ }
111
+ }
112
+
113
+ const program = ts.createProgram(modulesPaths, tscOptions, host)
114
+ program.emit()
115
+
116
+ // create definitions files
117
+ modulesPaths.forEach((modulePath) => {
118
+ const typeDefFilePath = modulePath.replace(/\.jsx?$/, DECLARATION_FILE_EXT)
119
+ const typeDefFileContent = createdFiles[typeDefFilePath]
120
+ if (typeDefFileContent) {
121
+ compilation.emitAsset(
122
+ path.join(MF_TYPES_DIR, declarationFileToExposeNameMap[typeDefFilePath] + DECLARATION_FILE_EXT),
123
+ getAssetData(typeDefFileContent),
124
+ )
125
+ } else {
126
+ logger.warn(`failed to create ${typeDefFilePath}`)
127
+ }
128
+ })
129
+
130
+ // create index.json
131
+ const modulesNames = Object.keys(exposes).map((moduleName) => moduleName + DECLARATION_FILE_EXT)
132
+ compilation.emitAsset(path.join(MF_TYPES_DIR, "index.json"), getAssetData(JSON.stringify(modulesNames)))
133
+ }
134
+
135
+ const getRemoteDeclareDirPath = (remoteName) => path.resolve(process.cwd(), "node_modules", "@types", remoteName)
136
+
137
+ const getTypesDefinitions = async () => {
138
+ const remotes = federationsOptions.remotes
139
+ if (!remotes) return
140
+
141
+ const excludeRemotes = this._options.excludeRemotes || []
142
+ const wantedRemotes = Object.entries(remotes).filter((remote) => !excludeRemotes.find((c) => c === remote[0]))
143
+
144
+ for (const [remoteName, remoteEntryUri] of wantedRemotes) {
145
+ const {origin, pathname} = new URL(remoteEntryUri.split("@")[1])
146
+ const remotePublicUrl = origin + pathname.slice(0, pathname.lastIndexOf("/") + 1)
147
+ const remoteDeclareDirPath = getRemoteDeclareDirPath(remoteName)
148
+ const federationTypesUrl = remotePublicUrl + MF_TYPES_DIR + "/"
149
+
150
+ axios
151
+ // get types index from the current remote
152
+ .get(federationTypesUrl + "index.json")
153
+ .catch((error) => {
154
+ if (error.response?.status === 404) logger.warn(`WARNING: The remote ${remoteName} has no types`)
155
+ else logger.warn(`Failed to get remote types from ${remotePublicUrl}.`, error.message)
156
+ })
157
+ .then((response) => response?.data)
158
+ .then((modulesNames) => {
159
+ if (!modulesNames) return
160
+ // for each remote module get his types
161
+ modulesNames.forEach((moduleName) => {
162
+ const moduleDeclarationFileUrl = federationTypesUrl + moduleName
163
+ axios
164
+ .get(moduleDeclarationFileUrl)
165
+ .catch((error) => {
166
+ logger.warn(`Failed to get ${moduleDeclarationFileUrl} ${error.message}`)
167
+ })
168
+ .then((declarationFileResponse) => {
169
+ if (!declarationFileResponse) return
170
+ const declarationFileContent = declarationFileResponse.data
171
+ const decFilePath = path.join(remoteDeclareDirPath, moduleName)
172
+ fs.promises
173
+ .mkdir(path.dirname(decFilePath), {recursive: true})
174
+ .catch((error) => logger.error(`Failed to write dir: ${decFilePath}`, error))
175
+ .then(() => fs.writeFile(decFilePath, declarationFileContent, {recursive: true}))
176
+ .catch((error) => logger.error(`Failed to write declaration file: ${decFilePath}`, error))
177
+ })
178
+ .catch((error) => {
179
+ logger.warn(`Failed to get ${moduleDeclarationFileUrl} ${error.message}`)
180
+ })
181
+ })
182
+ })
183
+ .catch((error) => {
184
+ logger.error("Failed to add declaration file", error.message)
185
+ })
186
+ }
187
+ }
188
+
189
+ compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
190
+ const pluginOptions = this._options || {}
191
+ compilation.hooks.beforeCodeGeneration.tap(PLUGIN_NAME, () => {
192
+ if (!isFirstCompilation) return
193
+ isFirstCompilation = false
194
+ if (pluginOptions.exposeTypes !== false) createTypesDefinitions(compilation)
195
+ if (compilation.options.mode === "development" && pluginOptions.importTypes !== false) {
196
+ getTypesDefinitions()
197
+ if (pluginOptions.getTypesInterval) {
198
+ clearInterval(getTypesInterval)
199
+ getTypesInterval = setInterval(() => getTypesDefinitions(compilation), ms(pluginOptions.getTypesInterval))
200
+ }
201
+ }
202
+ })
203
+ })
204
+ }
205
+ }
206
+
207
+ module.exports = FederationTypesPlugin
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2023 Daniel Amenou
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Daniel Amenou
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,58 +1,62 @@
1
- # webpack-federation-types-plugin
2
-
3
- This plugin generates TypeScript type declaration files for the modules that are exposed by a remote application.
4
- With this plugin, you can get type definitions for your modules and use them in your consuming applications without having to manually import and maintain them.
5
-
6
- It compiles the exposed files into type declaration files and shares them as public files
7
- On the consumer side, the plugin fetches the remote types declaration files and adds them to the "node_modules/@types" directory. This is the standard location for TypeScript type definitions that are used by the consuming application. By placing the generated type declaration files in this directory, the plugin makes them available to the consuming application without the need for any additional configuration.
8
-
9
- ## Installation
10
-
11
- You can install the plugin by running the following command in your terminal:
12
-
13
- `npm i --save-dev webpack-federation-types-plugin`
14
-
15
- `yarn add --dev webpack-federation-types-plugin`
16
-
17
- ## Usage
18
-
19
- After installing the plugin, you can use it in your webpack configuration file as follows:
20
-
21
- ```javascript
22
- const FederationTypesPlugin = require("webpack-federation-types-plugin")
23
-
24
- module.exports = {
25
- // ...
26
- plugins: [new FederationTypesPlugin({excludeRemotes: ["remoteName"], importTypes: true, exposeTypes: true})],
27
- }
28
- ```
29
-
30
- - This plugin should be added to the browser config
31
-
32
- ## Plugin Options
33
-
34
- The plugin takes an options object with the following properties:
35
-
36
- ##### exposeTypes
37
-
38
- Type: boolean
39
- Default: true
40
- Description: create and share the declaration files
41
- ##### importTypes
42
-
43
- Type: boolean
44
- Default: true
45
- Description: fetch the remotes declaration files and add them to the @types directory
46
-
47
- ##### excludeRemotes
48
-
49
- Type: string[]
50
- Default: undefined
51
- Description: remotes to ignore
52
-
53
- ##### getTypesInterval
54
-
55
- Type: string
56
- Default: undefined
57
- Description: the interval between types requests
58
- Example: "5 minutes", "30 seconds"
1
+ # webpack-federation-types-plugin
2
+
3
+ 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
+
5
+ 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.
6
+
7
+ ## Installation
8
+
9
+ You can install the plugin by running the following command in your terminal:
10
+
11
+ `npm i --save-dev webpack-federation-types-plugin`
12
+
13
+ `yarn add --dev webpack-federation-types-plugin`
14
+
15
+ ## Usage
16
+
17
+ After installing the plugin, you can use it in your webpack configuration file as follows:
18
+
19
+ ```javascript
20
+ const FederationTypesPlugin = require("webpack-federation-types-plugin")
21
+
22
+ module.exports = {
23
+ // ...
24
+ plugins: [new FederationTypesPlugin({excludeRemotes: ["remoteName"], importTypes: true, exposeTypes: true})],
25
+ }
26
+ ```
27
+
28
+ - This plugin should be added to the browser config
29
+
30
+ ## Plugin Options
31
+
32
+ The plugin takes an options object with the following properties:
33
+
34
+ ##### exposeTypes
35
+
36
+ Type: boolean
37
+ Default: true
38
+ Description: create and share the declaration files
39
+
40
+ ##### importTypes
41
+
42
+ Type: boolean
43
+ Default: true
44
+ Description: fetch the remotes declaration files and add them to the @types directory
45
+
46
+ ##### excludeRemotes
47
+
48
+ Type: string[]
49
+ Default: undefined
50
+ Description: remotes to ignore
51
+
52
+ ##### getTypesInterval
53
+
54
+ Type: string
55
+ Default: undefined
56
+ Description: the interval between types requests
57
+ Example: "5 minutes", "30 seconds"
58
+
59
+ ##### federationConfig
60
+
61
+ Type: object
62
+ Description: Allows you to override certain configurations from the ModuleFederationPlugin. You can specify properties such as exposes and remotes to merge or replace the original settings.
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.2.5",
4
+ "version": "1.3.1",
5
5
  "main": "FederationTypesPlugin.js",
6
6
  "types": "types.d.ts",
7
7
  "scripts": {
@@ -28,6 +28,7 @@
28
28
  "fs-extra": "^11.1.0",
29
29
  "ms": "^2.1.3",
30
30
  "schema-utils": "^4.0.0",
31
- "typescript": "^4.9.4"
31
+ "typescript": "^4.9.4",
32
+ "webpack-merge": "^6.0.1"
32
33
  }
33
34
  }
package/types.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- declare interface FederationTypesPluginOptions {
2
- exposeTypes?: boolean
3
- importTypes?: boolean
4
- excludeRemotes?: string[]
5
- }
6
-
7
- declare class FederationTypesPlugin {
8
- constructor(options?: FederationTypesPluginOptions)
9
- apply(compiler: any): void
10
- }
11
-
1
+ declare interface FederationTypesPluginOptions {
2
+ exposeTypes?: boolean
3
+ importTypes?: boolean
4
+ excludeRemotes?: string[]
5
+ }
6
+
7
+ declare class FederationTypesPlugin {
8
+ constructor(options?: FederationTypesPluginOptions)
9
+ apply(compiler: any): void
10
+ }
11
+
12
12
  export default FederationTypesPlugin