webpack-federation-types-plugin 1.0.1 → 1.1.0
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 +3 -3
- package/README.md +2 -2
- package/package.json +2 -1
- package/types.d.ts +12 -0
package/FederationTypesPlugin.js
CHANGED
|
@@ -17,7 +17,7 @@ const tscOptions = {
|
|
|
17
17
|
const optionsSchema = {
|
|
18
18
|
type: "object",
|
|
19
19
|
properties: {
|
|
20
|
-
|
|
20
|
+
excludeRemotes: {
|
|
21
21
|
type: "array",
|
|
22
22
|
},
|
|
23
23
|
exposeTypes: {
|
|
@@ -109,8 +109,8 @@ class FederationTypesPlugin {
|
|
|
109
109
|
const remotes = federationPlugin._options.remotes
|
|
110
110
|
if (!remotes) return
|
|
111
111
|
|
|
112
|
-
const
|
|
113
|
-
const wantedRemotes = Object.entries(remotes).filter((remote) =>
|
|
112
|
+
const excludeRemotes = this._options.excludeRemotes || []
|
|
113
|
+
const wantedRemotes = Object.entries(remotes).filter((remote) => !excludeRemotes.find((c) => c === remote[0]))
|
|
114
114
|
|
|
115
115
|
for (const [remoteName, remoteEntryUri] of wantedRemotes) {
|
|
116
116
|
const {origin, pathname} = new URL(remoteEntryUri.split("@")[1])
|
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ const FederationTypesPlugin = require("webpack-federation-types-plugin")
|
|
|
17
17
|
|
|
18
18
|
module.exports = {
|
|
19
19
|
// ...
|
|
20
|
-
plugins: [new FederationTypesPlugin({
|
|
20
|
+
plugins: [new FederationTypesPlugin({excludeRemotes: ["remoteName"], importTypes: true, exposeTypes: true})],
|
|
21
21
|
}
|
|
22
22
|
```
|
|
23
23
|
|
|
@@ -36,7 +36,7 @@ Type: boolean
|
|
|
36
36
|
Default: true
|
|
37
37
|
Description: fetch the remotes declaration files and add them to the @types directory
|
|
38
38
|
|
|
39
|
-
#####
|
|
39
|
+
##### excludeRemotes
|
|
40
40
|
|
|
41
41
|
Type: string[]
|
|
42
42
|
Default: undefined
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webpack-federation-types-plugin",
|
|
3
3
|
"description": "This plugin adds type definitions for remote modules",
|
|
4
|
-
"version": "1.0
|
|
4
|
+
"version": "1.1.0",
|
|
5
5
|
"main": "FederationTypesPlugin.js",
|
|
6
|
+
"types": "types.d.ts",
|
|
6
7
|
"scripts": {
|
|
7
8
|
"publish:patch": "npm version patch -m \"patch version - %s\" && npm publish",
|
|
8
9
|
"publish:minor": "npm version minor -m \"minor version - %s\" && npm publish",
|
package/types.d.ts
ADDED
|
@@ -0,0 +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
|
+
|
|
12
|
+
export default FederationTypesPlugin
|