@patternslib/dev 2.2.0 → 2.4.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 +36 -0
- package/package.json +14 -14
- package/webpack/webpack.config.js +18 -6
- package/webpack/webpack.mf.js +13 -3
package/CHANGES.md
CHANGED
|
@@ -2,6 +2,42 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
+
## [2.4.0](https://github.com/patternslib/dev/compare/2.3.0...2.4.0) (2022-08-11)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
* **Webpack:** Add bundle name and version to the banner. ([1058b6d](https://github.com/patternslib/dev/commit/1058b6d58b6e05c0c841a02a753a7fd823688595))For this, you have to pass your project's package.json as argument to the webpack config factory.
|
|
12
|
+
Both values - name and version - are taken from the package.json data.
|
|
13
|
+
|
|
14
|
+
* **Webpack:** Add config export with named parameters. ([f7b2471](https://github.com/patternslib/dev/commit/f7b24711ce223eaa51e0ea819643a656cae846f3))Add config export along with the default export to support named parameters via parameter destructuring.
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Maintenance
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
* Upgrade dependencies. ([9039642](https://github.com/patternslib/dev/commit/90396428d8b00dc6d60137387280e26f335d6128))
|
|
21
|
+
|
|
22
|
+
* **Webpack:** Correct API doc for shared_from_dependencies. ([f2b0031](https://github.com/patternslib/dev/commit/f2b003193312a332a100b8e1f6939dedcdc0e23d))
|
|
23
|
+
|
|
24
|
+
## [2.3.0](https://github.com/patternslib/dev/compare/2.2.1...2.3.0) (2022-07-07)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Features
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
* **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.
|
|
31
|
+
It extends generated shared definitions from the dependencies object and will overwrite existing entries.
|
|
32
|
+
|
|
33
|
+
## [2.2.1](https://github.com/patternslib/dev/compare/2.2.0...2.2.1) (2022-07-06)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Maintenance
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
* Upgrade dependencies. ([41adefd](https://github.com/patternslib/dev/commit/41adefd711a2ba68ba7327236a365889b4f76205))
|
|
40
|
+
|
|
5
41
|
## [2.2.0](https://github.com/patternslib/dev/compare/2.1.0...2.2.0) (2022-06-27)
|
|
6
42
|
|
|
7
43
|
|
package/package.json
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternslib/dev",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "Development base files for working with Patternslib and add-ons.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@babel/core": "^7.18.
|
|
8
|
-
"@babel/eslint-parser": "^7.18.
|
|
9
|
-
"@babel/preset-env": "^7.18.
|
|
7
|
+
"@babel/core": "^7.18.10",
|
|
8
|
+
"@babel/eslint-parser": "^7.18.9",
|
|
9
|
+
"@babel/preset-env": "^7.18.10",
|
|
10
10
|
"@commitlint/cli": "^17.0.3",
|
|
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.
|
|
14
|
+
"core-js": "3.24.1",
|
|
15
15
|
"css-loader": "^6.7.1",
|
|
16
|
-
"eslint": "^8.
|
|
16
|
+
"eslint": "^8.21.0",
|
|
17
17
|
"eslint-config-prettier": "^8.5.0",
|
|
18
18
|
"husky": "^8.0.1",
|
|
19
19
|
"identity-obj-proxy": "^3.0.0",
|
|
20
20
|
"imports-loader": "^4.0.0",
|
|
21
|
-
"jest": "^28.1.
|
|
22
|
-
"jest-environment-jsdom": "^28.1.
|
|
23
|
-
"jest-watch-typeahead": "^
|
|
21
|
+
"jest": "^28.1.3",
|
|
22
|
+
"jest-environment-jsdom": "^28.1.3",
|
|
23
|
+
"jest-watch-typeahead": "^2.0.0",
|
|
24
24
|
"prettier": "^2.7.1",
|
|
25
25
|
"regenerator-runtime": "^0.13.9",
|
|
26
|
-
"release-it": "^15.
|
|
27
|
-
"sass": "^1.
|
|
26
|
+
"release-it": "^15.3.0",
|
|
27
|
+
"sass": "^1.54.4",
|
|
28
28
|
"sass-loader": "^13.0.2",
|
|
29
29
|
"style-loader": "^3.3.0",
|
|
30
30
|
"terser-webpack-plugin": "^5.3.3",
|
|
31
|
-
"timezone-mock": "^1.3.
|
|
32
|
-
"webpack": "^5.
|
|
31
|
+
"timezone-mock": "^1.3.4",
|
|
32
|
+
"webpack": "^5.74.0",
|
|
33
33
|
"webpack-bundle-analyzer": "^4.4.2",
|
|
34
34
|
"webpack-cli": "^4.10.0",
|
|
35
|
-
"webpack-dev-server": "^4.
|
|
35
|
+
"webpack-dev-server": "^4.10.0",
|
|
36
36
|
"whybundled": "^2.0.0",
|
|
37
37
|
"yarn": "^1.22.19"
|
|
38
38
|
},
|
|
@@ -5,7 +5,7 @@ const webpack_helpers = require("./webpack-helpers");
|
|
|
5
5
|
// plugins
|
|
6
6
|
const TerserPlugin = require("terser-webpack-plugin");
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
const config_factory = (env, argv, config, babel_include = [], package_json) => {
|
|
9
9
|
// Webpack config
|
|
10
10
|
|
|
11
11
|
// Packages in node_modules to NOT exclude from babel processing.
|
|
@@ -96,6 +96,15 @@ module.exports = (env, argv, config, babel_include = []) => {
|
|
|
96
96
|
],
|
|
97
97
|
};
|
|
98
98
|
|
|
99
|
+
if (package_json && package_json.version && package_json.name) {
|
|
100
|
+
// Add a banner to generated chunks with the bundle name and version.
|
|
101
|
+
base_config.plugins.push(
|
|
102
|
+
new webpack.BannerPlugin({
|
|
103
|
+
banner: `${package_json.name} ${package_json.version}`,
|
|
104
|
+
})
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
99
108
|
// Override base_config with entries from config.
|
|
100
109
|
// Most useful the ``entry`` entry.
|
|
101
110
|
config = Object.assign(base_config, config);
|
|
@@ -124,14 +133,17 @@ module.exports = (env, argv, config, babel_include = []) => {
|
|
|
124
133
|
new TerserPlugin({
|
|
125
134
|
include: /(\.js$)/,
|
|
126
135
|
extractComments: false,
|
|
127
|
-
terserOptions: {
|
|
128
|
-
output: {
|
|
129
|
-
comments: false,
|
|
130
|
-
},
|
|
131
|
-
},
|
|
132
136
|
}),
|
|
133
137
|
];
|
|
134
138
|
config.devtool = "source-map"; // Slowest option. False for no source maps.
|
|
135
139
|
}
|
|
136
140
|
return config;
|
|
137
141
|
};
|
|
142
|
+
|
|
143
|
+
// Default export
|
|
144
|
+
const module_exports = (module.exports = config_factory);
|
|
145
|
+
|
|
146
|
+
// Named exports
|
|
147
|
+
module_exports.config = ({ env, argv, config, babel_include = [], package_json }) => {
|
|
148
|
+
return config_factory(env, argv, config, babel_include, package_json);
|
|
149
|
+
};
|
package/webpack/webpack.mf.js
CHANGED
|
@@ -33,13 +33,20 @@ function shared_from_dependencies(...dependencies) {
|
|
|
33
33
|
*
|
|
34
34
|
* Use this to extend your webpack configuration for module federation support.
|
|
35
35
|
*
|
|
36
|
-
* @param {String} name - Bundle/remote name.
|
|
36
|
+
* @param {String} name - Bundle/remote name.
|
|
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({
|
|
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:
|
|
62
|
+
shared: {
|
|
63
|
+
...shared_from_dependencies(dependencies),
|
|
64
|
+
...shared,
|
|
65
|
+
},
|
|
56
66
|
});
|
|
57
67
|
}
|
|
58
68
|
|