@patternslib/dev 2.3.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 CHANGED
@@ -2,6 +2,25 @@
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
+
5
24
  ## [2.3.0](https://github.com/patternslib/dev/compare/2.2.1...2.3.0) (2022-07-07)
6
25
 
7
26
 
package/package.json CHANGED
@@ -1,38 +1,38 @@
1
1
  {
2
2
  "name": "@patternslib/dev",
3
- "version": "2.3.0",
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.6",
8
- "@babel/eslint-parser": "^7.18.2",
9
- "@babel/preset-env": "^7.18.6",
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.23.3",
14
+ "core-js": "3.24.1",
15
15
  "css-loader": "^6.7.1",
16
- "eslint": "^8.19.0",
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.2",
22
- "jest-environment-jsdom": "^28.1.2",
23
- "jest-watch-typeahead": "^1.1.0",
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.1.1",
27
- "sass": "^1.53.0",
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
31
  "timezone-mock": "^1.3.4",
32
- "webpack": "^5.73.0",
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.9.3",
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
- module.exports = (env, argv, config, babel_include = []) => {
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
+ };
@@ -33,7 +33,7 @@ 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. If not given, the package.json name is used.
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.