@patternslib/dev 2.2.1 → 2.3.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/CHANGES.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
 
4
4
 
5
+ ## [2.3.0](https://github.com/patternslib/dev/compare/2.2.1...2.3.0) (2022-07-07)
6
+
7
+
8
+ ### Features
9
+
10
+
11
+ * **Module Federation:** Add a shared parameter for MF config factory. ([22e4b5e](https://github.com/patternslib/dev/commit/22e4b5e0a4d933a61008c5f203c90ad94d6b084f))The shared parameter allows to directly provide the shared object for the Webpack Module Federation Plugin.
12
+ It extends generated shared definitions from the dependencies object and will overwrite existing entries.
13
+
5
14
  ## [2.2.1](https://github.com/patternslib/dev/compare/2.2.0...2.2.1) (2022-07-06)
6
15
 
7
16
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternslib/dev",
3
- "version": "2.2.1",
3
+ "version": "2.3.0",
4
4
  "description": "Development base files for working with Patternslib and add-ons.",
5
5
  "license": "MIT",
6
6
  "dependencies": {
@@ -37,9 +37,16 @@ function shared_from_dependencies(...dependencies) {
37
37
  * @param {String} remote_entry - Path to which the new remote entry file is written to.
38
38
  * @param {String} filename - Name of the generated remote entry file. Default ``remote.min.js``.
39
39
  * @param {Object} dependencies - Object with dependency name - version specifier pairs. Is used to set up the shared dependencies including their version requirements.
40
+ * @param {Object} shared - Directly provide the shared object for the Webpack Module Federation Plugin. Extends generated shared definitions from the dependencies object and will overwrite existing entries.
40
41
  * @returns {Object} - Webpack config partial with instantiated module federation plugins.
41
42
  */
42
- function config({ name, remote_entry, filename = "remote.min.js", dependencies = {} }) {
43
+ function config({
44
+ name,
45
+ remote_entry,
46
+ filename = "remote.min.js",
47
+ dependencies = {},
48
+ shared = {},
49
+ }) {
43
50
  // Create a JS-variable compatible name and add a prefix.
44
51
  const normalized_bundle_name =
45
52
  MF_NAME_PREFIX + name.match(/([_$A-Za-z0-9])/g).join("");
@@ -52,7 +59,10 @@ function config({ name, remote_entry, filename = "remote.min.js", dependencies =
52
59
  "./main": remote_entry,
53
60
  },
54
61
  }),
55
- shared: shared_from_dependencies(dependencies),
62
+ shared: {
63
+ ...shared_from_dependencies(dependencies),
64
+ ...shared,
65
+ },
56
66
  });
57
67
  }
58
68