@patternslib/dev 2.1.0 → 2.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.
package/CHANGES.md CHANGED
@@ -2,6 +2,38 @@
2
2
 
3
3
 
4
4
 
5
+ ## [2.2.0](https://github.com/patternslib/dev/compare/2.1.0...2.2.0) (2022-06-27)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+
11
+ * Fix missing parentheses in release-zip. ([72d435d](https://github.com/patternslib/dev/commit/72d435d500cbf9ec460bf4f5961027025e554221))
12
+
13
+
14
+ ### Breaking Changes
15
+
16
+
17
+ * **webpack module federation:** Make wepack module federation config factory more explicit. ([efd266c](https://github.com/patternslib/dev/commit/efd266cfc82372c467eb6a8b470360b72647b9bd))Change signature of the webpack mf config factory to make it simpler, more flexible and more explicit at the cost of having to pass more options.
18
+
19
+ - Remove parameters ``package_json`` and ``shared`` in favor of ``dependencies``.
20
+ - Explicitly pass all dependencies via ``dependencies``, also the base ones from @patternslib/patternslib if wanted.
21
+ - Always explicitly pass the module federation name (e.g. the package.json's package name).
22
+
23
+ This makes the MF config factory simpler although you probably have to pass more options.
24
+ You now can easily just add the dependencies you want instead of having
25
+ always @patternslib/patternslib dependencies added.
26
+
27
+
28
+ ### Maintenance
29
+
30
+
31
+ * Add [@plone](https://github.com/plone) to jest and webpack transform ignores. ([678bf09](https://github.com/patternslib/dev/commit/678bf090be043c90c462075980db5ac1a9470d39))
32
+
33
+ * Remove unnecessary import from webpack.config.js. ([6658497](https://github.com/patternslib/dev/commit/6658497746e9fd948dbbacd5ad6cfa42b98168af))
34
+
35
+ * Upgrade dependencies. ([e1e423e](https://github.com/patternslib/dev/commit/e1e423eb3371f5c4792ad246e9df8ed2d3d434d9))
36
+
5
37
  ## [2.1.0](https://github.com/patternslib/dev/compare/2.0.0...2.1.0) (2022-06-25)
6
38
 
7
39
 
package/Makefile CHANGED
@@ -52,7 +52,7 @@ endif
52
52
  release-zip: clean-dist bundle
53
53
  ifneq "$(PACKAGE_NAME)" "$(PACKAGE_DEV)"
54
54
  @# Do not create a zip release for @patternslib/dev
55
- $(eval BUNDLE_NAME := $(subst @patternslib/,,$(subst @plone/,,$(PACKAGE_NAME)))
55
+ $(eval BUNDLE_NAME := $(subst @patternslib/,,$(subst @plone/,,$(PACKAGE_NAME))))
56
56
  $(eval PACKAGE_VERSION := $(shell node -p "require('./package.json').version"))
57
57
  @echo Creating $(BUNDLE_NAME)-bundle-$(PACKAGE_VERSION).zip
58
58
  mkdir -p dist/$(BUNDLE_NAME)-bundle-$(PACKAGE_VERSION)
package/jest.config.js CHANGED
@@ -17,6 +17,6 @@ module.exports = {
17
17
  },
18
18
  testEnvironment: "jsdom",
19
19
  transformIgnorePatterns: [
20
- "/node_modules/(?!@patternslib/)(?!preact/)(?!screenfull/).+\\.[t|j]sx?$",
20
+ "/node_modules/(?!@patternslib/)(?!@plone/)(?!preact/)(?!screenfull/).+\\.[t|j]sx?$",
21
21
  ],
22
22
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternslib/dev",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "Development base files for working with Patternslib and add-ons.",
5
5
  "license": "MIT",
6
6
  "dependencies": {
@@ -11,7 +11,7 @@
11
11
  "@commitlint/config-conventional": "^17.0.3",
12
12
  "@release-it/conventional-changelog": "^5.0.0",
13
13
  "babel-loader": "^8.2.5",
14
- "core-js": "3.23.2",
14
+ "core-js": "3.23.3",
15
15
  "css-loader": "^6.7.1",
16
16
  "eslint": "^8.18.0",
17
17
  "eslint-config-prettier": "^8.5.0",
@@ -25,7 +25,7 @@
25
25
  "regenerator-runtime": "^0.13.9",
26
26
  "release-it": "^15.1.0",
27
27
  "sass": "^1.53.0",
28
- "sass-loader": "^13.0.1",
28
+ "sass-loader": "^13.0.2",
29
29
  "style-loader": "^3.3.0",
30
30
  "terser-webpack-plugin": "^5.3.3",
31
31
  "timezone-mock": "^1.3.3",
@@ -36,9 +36,6 @@
36
36
  "whybundled": "^2.0.0",
37
37
  "yarn": "^1.22.19"
38
38
  },
39
- "peerDependencies": {
40
- "@patternslib/patternslib": "*"
41
- },
42
39
  "devDependencies": {
43
40
  "@patternslib/patternslib": "*",
44
41
  "jquery": "^3.6.0"
@@ -1,5 +1,4 @@
1
1
  process.traceDeprecation = true;
2
- const path = require("path");
3
2
  const webpack = require("webpack");
4
3
  const webpack_helpers = require("./webpack-helpers");
5
4
 
@@ -14,7 +13,13 @@ module.exports = (env, argv, config, babel_include = []) => {
14
13
  // babel_include, like any packages within `@patternslib`, any other
15
14
  // `pat-*` and other packges which need babel processing so that node can
16
15
  // make sense of it when compiling.
17
- babel_include = new Set(["patternslib", "pat-.*", "screenfull", ...babel_include]);
16
+ babel_include = new Set([
17
+ "@patternslib/.*",
18
+ "@plone/.*",
19
+ "pat-.*",
20
+ "screenfull",
21
+ ...babel_include,
22
+ ]);
18
23
  let babel_exclude = "";
19
24
  for (const it of babel_include) {
20
25
  babel_exclude += `(?!(${it})/)`;
@@ -1,5 +1,4 @@
1
1
  const { ModuleFederationPlugin } = require("webpack").container;
2
- const patternslib_package_json = require("@patternslib/patternslib/package.json");
3
2
 
4
3
  // Patternslib Module Federation bundle prefix.
5
4
  // This is used to filter for module federation enabled bundles.
@@ -35,35 +34,16 @@ function shared_from_dependencies(...dependencies) {
35
34
  * Use this to extend your webpack configuration for module federation support.
36
35
  *
37
36
  * @param {String} name - Bundle/remote name. If not given, the package.json name is used.
38
- * @param {String} filename - Name of the generated remote entry file. Default ``remote.min.js``.
39
- * @param {Object} package_json - Your imported project's package.json file. This is to automatically set the shared dependencies.
40
37
  * @param {String} remote_entry - Path to which the new remote entry file is written to.
41
- * @param {Object} shared - Object with dependency name - version specifier pairs. Can be used instead of the package_json parameter.
38
+ * @param {String} filename - Name of the generated remote entry file. Default ``remote.min.js``.
39
+ * @param {Object} dependencies - Object with dependency name - version specifier pairs. Is used to set up the shared dependencies including their version requirements.
42
40
  * @returns {Object} - Webpack config partial with instantiated module federation plugins.
43
41
  */
44
- function config({
45
- name,
46
- filename = "remote.min.js",
47
- package_json,
48
- remote_entry,
49
- shared = {},
50
- }) {
51
- // If no name is given, use the package name.
52
- name = name || package_json?.name || patternslib_package_json.name;
53
-
42
+ function config({ name, remote_entry, filename = "remote.min.js", dependencies = {} }) {
54
43
  // Create a JS-variable compatible name and add a prefix.
55
44
  const normalized_bundle_name =
56
45
  MF_NAME_PREFIX + name.match(/([_$A-Za-z0-9])/g).join("");
57
46
 
58
- shared = {
59
- ...(!Object.keys(shared).length && // only include package.json depenencies, if shared is empty.
60
- shared_from_dependencies(
61
- patternslib_package_json.dependencies,
62
- package_json?.dependencies
63
- )),
64
- ...shared,
65
- };
66
-
67
47
  return new ModuleFederationPlugin({
68
48
  name: normalized_bundle_name,
69
49
  ...(remote_entry && {
@@ -72,7 +52,7 @@ function config({
72
52
  "./main": remote_entry,
73
53
  },
74
54
  }),
75
- shared: shared,
55
+ shared: shared_from_dependencies(dependencies),
76
56
  });
77
57
  }
78
58