webpack-federation-types-plugin 1.1.0 → 1.2.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.
@@ -3,6 +3,7 @@ const ts = require("typescript")
3
3
  const axios = require("axios")
4
4
  const fs = require("fs-extra")
5
5
  const path = require("path")
6
+ const ms = require("ms")
6
7
 
7
8
  const PLUGIN_NAME = "FederationTypesPlugin"
8
9
  const MF_TYPES_DIR = "federation-types"
@@ -26,6 +27,9 @@ const optionsSchema = {
26
27
  importTypes: {
27
28
  type: "boolean",
28
29
  },
30
+ getTypesInterval: {
31
+ type: "string",
32
+ },
29
33
  },
30
34
  }
31
35
 
@@ -48,6 +52,7 @@ class FederationTypesPlugin {
48
52
  * @param {import("webpack").Compiler} compiler
49
53
  */
50
54
  apply(compiler) {
55
+ let getTypesInterval
51
56
  const federationPlugin =
52
57
  compiler.options.plugins && compiler.options.plugins.find((plugin) => plugin.constructor.name === "ModuleFederationPlugin")
53
58
  if (!federationPlugin) throw new Error("No ModuleFederationPlugin found.")
@@ -164,7 +169,10 @@ class FederationTypesPlugin {
164
169
  if (pluginOptions.exposeTypes !== false) createTypesDefinitions(compilation)
165
170
  if (compilation.options.mode === "development" && pluginOptions.importTypes !== false) {
166
171
  getTypesDefinitions()
167
- // TODO - call getTypesDefinitions using setInterval
172
+ if (pluginOptions.getTypesInterval) {
173
+ clearInterval(getTypesInterval)
174
+ getTypesInterval = setInterval(() => getTypesDefinitions(compilation), ms(pluginOptions.getTypesInterval))
175
+ }
168
176
  }
169
177
  })
170
178
  })
package/README.md CHANGED
@@ -42,3 +42,9 @@ Type: string[]
42
42
  Default: undefined
43
43
  Description: remotes to ignore
44
44
 
45
+ ##### getTypesInterval
46
+
47
+ Type: string
48
+ Default: undefined
49
+ Description: the interval between types requests
50
+ Example: "5 minutes", "30 seconds"
package/TODO ADDED
@@ -0,0 +1,5 @@
1
+ cts\wedding\node_modules\@types\appJAMain\getJAData.d.ts'
2
+ (Use `node --trace-warnings ...` to show where the warning was created)
3
+ (node:10492) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 15)
4
+ (node:10492) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
5
+
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.1.0",
4
+ "version": "1.2.0",
5
5
  "main": "FederationTypesPlugin.js",
6
6
  "types": "types.d.ts",
7
7
  "scripts": {
@@ -26,6 +26,7 @@
26
26
  "dependencies": {
27
27
  "axios": "^1.2.2",
28
28
  "fs-extra": "^11.1.0",
29
+ "ms": "^2.1.3",
29
30
  "schema-utils": "^4.0.0",
30
31
  "typescript": "^4.9.4"
31
32
  }