webpack-federation-types-plugin 1.0.0 → 1.0.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.
- package/FederationTypesPlugin.js +5 -4
- package/package.json +1 -1
package/FederationTypesPlugin.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const validate = require("schema-utils")
|
|
1
|
+
const validate = require("schema-utils").validate
|
|
2
2
|
const ts = require("typescript")
|
|
3
3
|
const axios = require("axios")
|
|
4
4
|
const fs = require("fs-extra")
|
|
@@ -39,7 +39,7 @@ const getAssetData = (content) => {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
class FederationTypesPlugin {
|
|
42
|
-
constructor(options) {
|
|
42
|
+
constructor(options = {}) {
|
|
43
43
|
validate(optionsSchema, options)
|
|
44
44
|
this._options = options
|
|
45
45
|
}
|
|
@@ -159,9 +159,10 @@ class FederationTypesPlugin {
|
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
|
|
162
|
+
const pluginOptions = this._options || {}
|
|
162
163
|
compilation.hooks.beforeCodeGeneration.tap(PLUGIN_NAME, () => {
|
|
163
|
-
if (
|
|
164
|
-
if (compilation.options.mode === "development" &&
|
|
164
|
+
if (pluginOptions.exposeTypes !== false) createTypesDefinitions(compilation)
|
|
165
|
+
if (compilation.options.mode === "development" && pluginOptions.importTypes !== false) {
|
|
165
166
|
getTypesDefinitions()
|
|
166
167
|
// TODO - call getTypesDefinitions using setInterval
|
|
167
168
|
}
|
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.0.
|
|
4
|
+
"version": "1.0.1",
|
|
5
5
|
"main": "FederationTypesPlugin.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"publish:patch": "npm version patch -m \"patch version - %s\" && npm publish",
|