[Pkg-javascript-devel] Bug#1032994: unblock: node-webpack/5.76.1+dfsg1+~cs17.16.16-1

Yadd yadd at debian.org
Wed Mar 15 12:38:42 GMT 2023


Package: release.debian.org
Severity: normal
User: release.debian.org at packages.debian.org
Usertags: unblock
X-Debbugs-Cc: node-webpack at packages.debian.org
Control: affects -1 + src:node-webpack

Please unblock package node-webpack

[ Reason ]
node-webpack is vulnerable to cross-realm object access
(#1032904, CVE-2023-28154).

[ Impact ]
Medium security issue

[ Tests ]
Test updated, passed

[ Risks ]
Low risk, autopkgtest passed on all reverse dependencies

[ Checklist ]
  [X] all changes are documented in the d/changelog
  [X] I reviewed all changes and I approve them
  [X] attach debdiff against the package in testing

[ Other info ]
The attached debdiff doesn't show the doc and test snapshot updates,
else debdiff is really big and not relevant.

Cheers,
Yadd

unblock node-webpack/5.76.1+dfsg1+~cs17.16.16-1
-------------- next part --------------
diff --git a/README.md b/README.md
index c712d27f..a6549c1c 100644
--- a/README.md
+++ b/README.md
@@ -158,11 +158,11 @@ or are automatically applied via regex from your webpack configuration.
 
 #### Transpiling
 
-|                                                                            Name                                                                            |    Status     |  Install Size  | Description                                                                                       |
-| :--------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------: | :------------: | :------------------------------------------------------------------------------------------------ |
-| <a href="https://github.com/babel/babel-loader"><img width="48" height="48" title="babel-loader" src="https://worldvectorlogo.com/logos/babel-10.svg"></a> | ![babel-npm]  | ![babel-size]  | Loads ES2015+ code and transpiles to ES5 using <a href="https://github.com/babel/babel">Babel</a> |
-|  <a href="https://github.com/TypeStrong/ts-loader"><img width="48" height="48" src="https://cdn.rawgit.com/Microsoft/TypeScript/master/doc/logo.svg"></a>  |  ![type-npm]  |  ![type-size]  | Loads TypeScript like JavaScript                                                                  |
-|    <a href="https://github.com/webpack-contrib/coffee-loader"><img width="48" height="48" src="https://worldvectorlogo.com/logos/coffeescript.svg"></a>    | ![coffee-npm] | ![coffee-size] | Loads CoffeeScript like JavaScript                                                                |
+|                                                                                                                             Name                                                                                                                             |    Status     |  Install Size  | Description                                                                                       |
+| :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------: | :------------: | :------------------------------------------------------------------------------------------------ |
+|                                                  <a href="https://github.com/babel/babel-loader"><img width="48" height="48" title="babel-loader" src="https://worldvectorlogo.com/logos/babel-10.svg"></a>                                                  | ![babel-npm]  | ![babel-size]  | Loads ES2015+ code and transpiles to ES5 using <a href="https://github.com/babel/babel">Babel</a> |
+| <a href="https://github.com/TypeStrong/ts-loader"><img width="48" height="48" src="https://raw.githubusercontent.com/microsoft/TypeScript-Website/f407e1ae19e5e990d9901ac8064a32a8cc60edf0/packages/typescriptlang-org/static/branding/ts-logo-128.svg"></a> |  ![type-npm]  |  ![type-size]  | Loads TypeScript like JavaScript                                                                  |
+|                                                     <a href="https://github.com/webpack-contrib/coffee-loader"><img width="48" height="48" src="https://worldvectorlogo.com/logos/coffeescript.svg"></a>                                                     | ![coffee-npm] | ![coffee-size] | Loads CoffeeScript like JavaScript                                                                |
 
 [babel-npm]: https://img.shields.io/npm/v/babel-loader.svg
 [babel-size]: https://packagephobia.com/badge?p=babel-loader
@@ -175,7 +175,7 @@ or are automatically applied via regex from your webpack configuration.
 
 |                                                                                   Name                                                                                    |     Status      |   Install Size   | Description                                                                             |
 | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-------------: | :--------------: | :-------------------------------------------------------------------------------------- |
-|                <a href="https://github.com/webpack-contrib/html-loader"><img width="48" height="48" src="https://worldvectorlogo.com/logos/html5.svg"></a>                |   ![html-npm]   |   ![html-size]   | Exports HTML as string, requires references to static resources                         |
+|               <a href="https://github.com/webpack-contrib/html-loader"><img width="48" height="48" src="https://worldvectorlogo.com/logos/html5-2.svg"></a>               |   ![html-npm]   |   ![html-size]   | Exports HTML as string, requires references to static resources                         |
 |   <a href="https://github.com/pugjs/pug-loader"><img width="48" height="48" src="https://cdn.rawgit.com/pugjs/pug-logo/master/SVG/pug-final-logo-_-colour-128.svg"></a>   |   ![pug-npm]    |   ![pug-size]    | Loads Pug templates and returns a function                                              |
 | <a href="https://github.com/webdiscus/pug-loader"><img width="48" height="48" src="https://cdn.rawgit.com/pugjs/pug-logo/master/SVG/pug-final-logo-_-colour-128.svg"></a> |   ![pug3-npm]   |   ![pug3-size]   | Compiles Pug to a function or HTML string, useful for use with Vue, React, Angular      |
 |                <a href="https://github.com/peerigon/markdown-loader"><img width="48" height="48" src="https://worldvectorlogo.com/logos/markdown.svg"></a>                |    ![md-npm]    |    ![md-size]    | Compiles Markdown to HTML                                                               |
diff --git a/debian/changelog b/debian/changelog
index 0053d7ee..67eebb8b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,19 @@
+node-webpack (5.76.1+dfsg1+~cs17.16.16-1) unstable; urgency=medium
+
+  * Team upload
+  * Install webpack-cli
+  * Update lintian override info format in d/source/lintian-overrides
+    on line 5-8, 14, 17-22.
+  * Update standards version to 4.6.2, no changes needed.
+  * Exclude discoveryjs-json-ext/benchmarks from import
+  * New upstream version (Closes: #1032904, CVE-2023-28154), updates:
+    +webpack from 5.75.0 to 5.76.1
+    + envinfo from 7.8.0 to 7.8.1
+    + terser-webpack-plugin from 5.3.6 to 5.3.7
+    + @webpack-cli/configtest from 2.0.0 to 2.0.1
+
+ -- Yadd <yadd at debian.org>  Tue, 14 Mar 2023 06:48:56 +0400
+
 node-webpack (5.75.0+dfsg+~cs17.16.14-1) unstable; urgency=medium
 
   * Team upload
diff --git a/debian/control b/debian/control
index ad1875ed..4ab1d8f5 100644
--- a/debian/control
+++ b/debian/control
@@ -47,7 +47,7 @@ Build-Depends: debhelper-compat (= 13)
  , node-yargs <!nocheck>
  , rollup
  , terser <!nocheck>
-Standards-Version: 4.6.1
+Standards-Version: 4.6.2
 Vcs-Browser: https://salsa.debian.org/js-team/node-webpack
 Vcs-Git: https://salsa.debian.org/js-team/node-webpack.git
 Homepage: https://github.com/webpack/webpack
diff --git a/debian/copyright b/debian/copyright
index 17fa8f37..a48969c6 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -9,6 +9,7 @@ Source: https://github.com/webpack/webpack/tags
 Files-Excluded: .husky
  examples/build-http/webpack.lock.data
  test/statsCases
+Files-Excluded-discoveryjs-json-ext: benchmarks
 
 Files: *
 Copyright: JS Foundation and other contributors
diff --git a/debian/links b/debian/links
deleted file mode 100644
index bbb53552..00000000
--- a/debian/links
+++ /dev/null
@@ -1 +0,0 @@
-usr/share/nodejs/webpack/bin/webpack.js usr/bin/webpack
diff --git a/debian/nodejs/links b/debian/nodejs/links
new file mode 100644
index 00000000..155355c6
--- /dev/null
+++ b/debian/nodejs/links
@@ -0,0 +1,2 @@
+webpack-cli/bin/cli.js	/usr/bin/webpack-cli
+webpack/bin/webpack.js	/usr/bin/webpack
diff --git a/debian/source/lintian-overrides b/debian/source/lintian-overrides
index 340a0230..ca535421 100644
--- a/debian/source/lintian-overrides
+++ b/debian/source/lintian-overrides
@@ -2,21 +2,21 @@
 add-component-copyright terser-webpack-plugin *
 
 # False positive, example/test data
-source-is-missing examples/*
-source-is-missing test/*
-source-contains-prebuilt-javascript-object examples/*
-source-contains-prebuilt-javascript-object test/*
+source-is-missing [examples/*]
+source-is-missing [test/*]
+source-contains-prebuilt-javascript-object [examples/*]
+source-contains-prebuilt-javascript-object [test/*]
 very-long-line-length-in-source-file examples/*
 very-long-line-length-in-source-file test/*
 very-long-line-length-in-source-file terser-webpack-plugin/test/__snapshots__/*
 
 # Markdown
-very-long-line-length-in-source-file *.md line *
+very-long-line-length-in-source-file * [*.md:*]
 
 # Data
-source-is-missing lib/optimize/ModuleConcatenationPlugin.js
-source-is-missing lib/util/semver.js
-source-contains-prebuilt-javascript-object lib/optimize/ModuleConcatenationPlugin.js
-source-contains-prebuilt-javascript-object lib/util/semver.js
-very-long-line-length-in-source-file lib/optimize/ModuleConcatenationPlugin.js *
-very-long-line-length-in-source-file lib/util/semver.js *
+source-is-missing [lib/optimize/ModuleConcatenationPlugin.js]
+source-is-missing [lib/util/semver.js]
+source-contains-prebuilt-javascript-object [lib/optimize/ModuleConcatenationPlugin.js]
+source-contains-prebuilt-javascript-object [lib/util/semver.js]
+very-long-line-length-in-source-file * [lib/optimize/ModuleConcatenationPlugin.js:*]
+very-long-line-length-in-source-file * [lib/util/semver.js:*]
diff --git a/declarations/LoaderContext.d.ts b/declarations/LoaderContext.d.ts
index 3e934142..f93a0890 100644
--- a/declarations/LoaderContext.d.ts
+++ b/declarations/LoaderContext.d.ts
@@ -212,6 +212,12 @@ export interface LoaderRunnerLoaderContext<OptionsType> {
 	 * Example: "/abc/resource.js?query#frag"
 	 */
 	resource: string;
+
+	/**
+	 * Target of compilation.
+	 * Example: "web"
+	 */
+	target: string;
 }
 
diff --git a/lib/NormalModule.js b/lib/NormalModule.js
index 4d1264f9..b3fababd 100644
--- a/lib/NormalModule.js
+++ b/lib/NormalModule.js
@@ -330,6 +330,8 @@ class NormalModule extends Module {
 		this._isEvaluatingSideEffects = false;
 		/** @type {WeakSet<ModuleGraph> | undefined} */
 		this._addedSideEffectsBailout = undefined;
+		/** @type {Map<string, any>} */
+		this._codeGeneratorData = new Map();
 	}
 
 	/**
@@ -1188,11 +1190,9 @@ class NormalModule extends Module {
 			runtimeRequirements.add(RuntimeGlobals.thisAsExports);
 		}
 
-		/** @type {Map<string, any>} */
-		let data;
+		/** @type {function(): Map<string, any>} */
 		const getData = () => {
-			if (data === undefined) data = new Map();
-			return data;
+			return this._codeGeneratorData;
 		};
 
 		const sources = new Map();
@@ -1223,7 +1223,7 @@ class NormalModule extends Module {
 		const resultEntry = {
 			sources,
 			runtimeRequirements,
-			data
+			data: this._codeGeneratorData
 		};
 		return resultEntry;
 	}
@@ -1371,6 +1371,7 @@ class NormalModule extends Module {
 		write(this.error);
 		write(this._lastSuccessfulBuildMeta);
 		write(this._forceBuild);
+		write(this._codeGeneratorData);
 		super.serialize(context);
 	}
 
@@ -1403,6 +1404,7 @@ class NormalModule extends Module {
 		this.error = read();
 		this._lastSuccessfulBuildMeta = read();
 		this._forceBuild = read();
+		this._codeGeneratorData = read();
 		super.deserialize(context);
 	}
 }
diff --git a/lib/dependencies/ImportParserPlugin.js b/lib/dependencies/ImportParserPlugin.js
index 151ff89a..718b0482 100644
--- a/lib/dependencies/ImportParserPlugin.js
+++ b/lib/dependencies/ImportParserPlugin.js
@@ -137,7 +137,7 @@ class ImportParserPlugin {
 				if (importOptions.webpackInclude !== undefined) {
 					if (
 						!importOptions.webpackInclude ||
-						importOptions.webpackInclude.constructor.name !== "RegExp"
+						!(importOptions.webpackInclude instanceof RegExp)
 					) {
 						parser.state.module.addWarning(
 							new UnsupportedFeatureWarning(
@@ -146,13 +146,13 @@ class ImportParserPlugin {
 							)
 						);
 					} else {
-						include = new RegExp(importOptions.webpackInclude);
+						include = importOptions.webpackInclude;
 					}
 				}
 				if (importOptions.webpackExclude !== undefined) {
 					if (
 						!importOptions.webpackExclude ||
-						importOptions.webpackExclude.constructor.name !== "RegExp"
+						!(importOptions.webpackExclude instanceof RegExp)
 					) {
 						parser.state.module.addWarning(
 							new UnsupportedFeatureWarning(
@@ -161,7 +161,7 @@ class ImportParserPlugin {
 							)
 						);
 					} else {
-						exclude = new RegExp(importOptions.webpackExclude);
+						exclude = importOptions.webpackExclude;
 					}
 				}
 				if (importOptions.webpackExports !== undefined) {
diff --git a/lib/javascript/JavascriptParser.js b/lib/javascript/JavascriptParser.js
index c10c7b16..58bcc4a6 100644
--- a/lib/javascript/JavascriptParser.js
+++ b/lib/javascript/JavascriptParser.js
@@ -3635,17 +3635,27 @@ class JavascriptParser extends Parser {
 			return EMPTY_COMMENT_OPTIONS;
 		}
 		let options = {};
+		/** @type {unknown[]} */
 		let errors = [];
 		for (const comment of comments) {
 			const { value } = comment;
 			if (value && webpackCommentRegExp.test(value)) {
 				// try compile only if webpack options comment is present
 				try {
-					const val = vm.runInNewContext(`(function(){return {${value}};})()`);
-					Object.assign(options, val);
+					for (let [key, val] of Object.entries(
+						vm.runInNewContext(`(function(){return {${value}};})()`)
+					)) {
+						if (typeof val === "object" && val !== null) {
+							if (val.constructor.name === "RegExp") val = new RegExp(val);
+							else val = JSON.parse(JSON.stringify(val));
+						}
+						options[key] = val;
+					}
 				} catch (e) {
-					e.comment = comment;
-					errors.push(e);
+					const newErr = new Error(String(e.message));
+					newErr.stack = String(e.stack);
+					Object.assign(newErr, { comment });
+					errors.push(newErr);
 				}
 			}
 		}
diff --git a/lib/node/NodeTargetPlugin.js b/lib/node/NodeTargetPlugin.js
index 33f785ba..adea6ab7 100644
--- a/lib/node/NodeTargetPlugin.js
+++ b/lib/node/NodeTargetPlugin.js
@@ -11,6 +11,7 @@ const ExternalsPlugin = require("../ExternalsPlugin");
 
 const builtins = [
 	"assert",
+	"assert/strict",
 	"async_hooks",
 	"buffer",
 	"child_process",
diff --git a/lib/optimize/RealContentHashPlugin.js b/lib/optimize/RealContentHashPlugin.js
index 39493200..9ceb1577 100644
--- a/lib/optimize/RealContentHashPlugin.js
+++ b/lib/optimize/RealContentHashPlugin.js
@@ -342,7 +342,6 @@ ${referencingAssets
 					for (const oldHash of hashesInOrder) {
 						const assets = hashToAssets.get(oldHash);
 						assets.sort(comparator);
-						const hash = createHash(this._hashFunction);
 						await Promise.all(
 							assets.map(asset =>
 								asset.ownHashes.has(oldHash)
@@ -363,6 +362,10 @@ ${referencingAssets
 						});
 						let newHash = hooks.updateHash.call(assetsContent, oldHash);
 						if (!newHash) {
+							const hash = createHash(this._hashFunction);
+							if (compilation.outputOptions.hashSalt) {
+								hash.update(compilation.outputOptions.hashSalt);
+							}
 							for (const content of assetsContent) {
 								hash.update(content);
 							}
diff --git a/package.json b/package.json
index 112ccc56..5e3ff54f 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "webpack",
-  "version": "5.75.0",
+  "version": "5.76.1",
   "author": "Tobias Koppers @sokra",
   "description": "Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.",
   "license": "MIT",
@@ -76,7 +76,7 @@
     "less": "^4.0.0",
     "less-loader": "^8.0.0",
     "lint-staged": "^11.0.0",
-    "loader-utils": "^2.0.0",
+    "loader-utils": "^2.0.3",
     "lodash": "^4.17.19",
     "lodash-es": "^4.17.15",
     "memfs": "^3.2.0",
diff --git a/terser-webpack-plugin/CHANGELOG.md b/terser-webpack-plugin/CHANGELOG.md
index 879e4823..847a7bef 100644
--- a/terser-webpack-plugin/CHANGELOG.md
+++ b/terser-webpack-plugin/CHANGELOG.md
@@ -2,6 +2,13 @@
 
 All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
 
+### [5.3.7](https://github.com/webpack-contrib/terser-webpack-plugin/compare/v5.3.6...v5.3.7) (2023-03-08)
+
+
+### Bug Fixes
+
+* esbuild warning output ([#550](https://github.com/webpack-contrib/terser-webpack-plugin/issues/550)) ([2e54869](https://github.com/webpack-contrib/terser-webpack-plugin/commit/2e54869a9f38cbaedd4d783ac81e1ac66e074809))
+
 ### [5.3.6](https://github.com/webpack-contrib/terser-webpack-plugin/compare/v5.3.5...v5.3.6) (2022-08-29)
 
 
diff --git a/terser-webpack-plugin/package.json b/terser-webpack-plugin/package.json
index e0cc051d..602e42a1 100644
--- a/terser-webpack-plugin/package.json
+++ b/terser-webpack-plugin/package.json
@@ -1,6 +1,6 @@
 {
   "name": "terser-webpack-plugin",
-  "version": "5.3.6",
+  "version": "5.3.7",
   "description": "Terser plugin for webpack",
   "license": "MIT",
   "repository": "webpack-contrib/terser-webpack-plugin",
@@ -26,6 +26,7 @@
     "security": "npm audit --production",
     "lint:prettier": "prettier --list-different .",
     "lint:js": "eslint --cache .",
+    "lint:spelling": "cspell \"**/*.*\"",
     "lint:types": "tsc --pretty --noEmit",
     "lint": "npm-run-all -l -p \"lint:**\"",
     "test:only": "cross-env NODE_ENV=test jest",
@@ -55,42 +56,44 @@
     }
   },
   "dependencies": {
-    "@jridgewell/trace-mapping": "^0.3.14",
+    "@jridgewell/trace-mapping": "^0.3.17",
     "jest-worker": "^27.4.5",
     "schema-utils": "^3.1.1",
-    "serialize-javascript": "^6.0.0",
-    "terser": "^5.14.1"
+    "serialize-javascript": "^6.0.1",
+    "terser": "^5.16.5"
   },
   "devDependencies": {
-    "@babel/cli": "^7.18.6",
-    "@babel/core": "^7.18.6",
-    "@babel/preset-env": "^7.18.6",
-    "@commitlint/cli": "^17.0.3",
-    "@commitlint/config-conventional": "^17.0.3",
-    "@swc/core": "^1.2.220",
+    "@babel/cli": "^7.21.0",
+    "@babel/core": "^7.21.0",
+    "@babel/preset-env": "^7.20.2",
+    "@commitlint/cli": "^17.4.4",
+    "@commitlint/config-conventional": "^17.4.4",
+    "@swc/core": "^1.3.37",
+    "@types/node": "^18.14.4",
     "@types/serialize-javascript": "^5.0.2",
-    "@types/uglify-js": "^3.16.0",
+    "@types/uglify-js": "^3.17.1",
     "@webpack-contrib/eslint-config-webpack": "^3.0.0",
     "babel-jest": "^28.1.2",
     "copy-webpack-plugin": "^9.0.1",
     "cross-env": "^7.0.3",
+    "cspell": "^6.27.0",
     "del": "^6.0.0",
     "del-cli": "^3.0.1",
     "esbuild": "^0.14.51",
     "eslint": "^7.32.0",
-    "eslint-config-prettier": "^8.3.0",
-    "eslint-plugin-import": "^2.25.4",
+    "eslint-config-prettier": "^8.6.0",
+    "eslint-plugin-import": "^2.27.5",
     "file-loader": "^6.2.0",
     "husky": "^7.0.2",
     "jest": "^27.5.1",
-    "lint-staged": "^13.0.3",
-    "memfs": "^3.4.7",
+    "lint-staged": "^13.1.2",
+    "memfs": "^3.4.13",
     "npm-run-all": "^4.1.5",
-    "prettier": "^2.7.1",
+    "prettier": "^2.8.4",
     "standard-version": "^9.3.1",
-    "typescript": "^4.7.4",
-    "uglify-js": "^3.16.1",
-    "webpack": "^5.73.0",
+    "typescript": "^4.9.5",
+    "uglify-js": "^3.17.4",
+    "webpack": "^5.75.0",
     "webpack-cli": "^4.10.0",
     "worker-loader": "^3.0.8"
   },
diff --git a/terser-webpack-plugin/src/utils.js b/terser-webpack-plugin/src/utils.js
index 1c7c3d56..55ebcea5 100644
--- a/terser-webpack-plugin/src/utils.js
+++ b/terser-webpack-plugin/src/utils.js
@@ -23,7 +23,7 @@ const notSettled = Symbol(`not-settled`);
  */
 
 /**
- * Run tasks with limited concurency.
+ * Run tasks with limited concurrency.
  * @template T
  * @param {number} limit - Limit of tasks that run at once.
  * @param {Task<T>[]} tasks - List of tasks to run.
@@ -703,37 +703,37 @@ async function esbuildMinify(input, sourceMap, minimizerOptions) {
     warnings:
       result.warnings.length > 0
         ? result.warnings.map((item) => {
-            return {
-              name: "Warning",
-              source: item.location && item.location.file,
-              line: item.location && item.location.line,
-              column: item.location && item.location.column,
-              plugin: item.pluginName,
-              message: `${item.text}${
-                item.detail ? `\nDetails:\n${item.detail}` : ""
-              }${
-                item.notes.length > 0
-                  ? `\n\nNotes:\n${item.notes
-                      .map(
-                        (note) =>
-                          `${
-                            note.location
-                              ? `[${note.location.file}:${note.location.line}:${note.location.column}] `
-                              : ""
-                          }${note.text}${
-                            note.location
-                              ? `\nSuggestion: ${note.location.suggestion}`
-                              : ""
-                          }${
-                            note.location
-                              ? `\nLine text:\n${note.location.lineText}\n`
-                              : ""
-                          }`
-                      )
-                      .join("\n")}`
-                  : ""
-              }`,
-            };
+            const plugin = item.pluginName
+              ? `\nPlugin Name: ${item.pluginName}`
+              : "";
+            const location = item.location
+              ? `\n\n${item.location.file}:${item.location.line}:${item.location.column}:\n  ${item.location.line} | ${item.location.lineText}\n\nSuggestion: ${item.location.suggestion}`
+              : "";
+            const notes =
+              item.notes.length > 0
+                ? `\n\nNotes:\n${item.notes
+                    .map(
+                      (note) =>
+                        `${
+                          note.location
+                            ? `[${note.location.file}:${note.location.line}:${note.location.column}] `
+                            : ""
+                        }${note.text}${
+                          note.location
+                            ? `\nSuggestion: ${note.location.suggestion}`
+                            : ""
+                        }${
+                          note.location
+                            ? `\nLine text:\n${note.location.lineText}\n`
+                            : ""
+                        }`
+                    )
+                    .join("\n")}`
+                : "";
+
+            return `${item.text} [${item.id}]${plugin}${location}${
+              item.detail ? `\nDetails:\n${item.detail}` : ""
+            }${notes}`;
           })
         : [],
   };
diff --git a/terser-webpack-plugin/types/utils.d.ts b/terser-webpack-plugin/types/utils.d.ts
index 5212b394..5e0196e7 100644
--- a/terser-webpack-plugin/types/utils.d.ts
+++ b/terser-webpack-plugin/types/utils.d.ts
@@ -20,7 +20,7 @@ export type ExtractedComments = Array<string>;
  * @typedef {() => Promise<T>} Task
  */
 /**
- * Run tasks with limited concurency.
+ * Run tasks with limited concurrency.
  * @template T
  * @param {number} limit - Limit of tasks that run at once.
  * @param {Task<T>[]} tasks - List of tasks to run.
diff --git a/types.d.ts b/types.d.ts
index 251d0adf..78da415c 100644
--- a/types.d.ts
+++ b/types.d.ts
@@ -6595,6 +6595,12 @@ declare interface LoaderRunnerLoaderContext<OptionsType> {
 	 * Example: "/abc/resource.js?query#frag"
 	 */
 	resource: string;
+
+	/**
+	 * Target of compilation.
+	 * Example: "web"
+	 */
+	target: string;
 }
 declare class LoaderTargetPlugin {
 	constructor(target: string);
diff --git a/webpack-cli/OPTIONS.md b/webpack-cli/OPTIONS.md
index c41e92ee..4e4c4158 100644
--- a/webpack-cli/OPTIONS.md
+++ b/webpack-cli/OPTIONS.md
@@ -10,7 +10,8 @@ Options:
   -m, --merge                                                                        Merge two or more configurations using 'webpack-merge'.
   --disable-interpret                                                                Disable interpret for loading the config file.
   --env <value...>                                                                   Environment passed to the configuration when it is a function.
-  --define-process-env-node-env <value>                                              Sets process.env.NODE_ENV to the specified value.
+  --node-env <value>                                                                 Sets process.env.NODE_ENV to the specified value.
+  --define-process-env-node-env <value>                                              Sets process.env.NODE_ENV to the specified value. (Currently an alias for `--node-env`)
   --analyze                                                                          It invokes webpack-bundle-analyzer plugin to get bundle information.
   --progress [value]                                                                 Print compilation progress during build.
   -j, --json [value]                                                                 Prints result as JSON or store it in a file.
diff --git a/webpack-cli/SERVE-OPTIONS-v4.md b/webpack-cli/SERVE-OPTIONS-v4.md
index 4d13e484..e366b278 100644
--- a/webpack-cli/SERVE-OPTIONS-v4.md
+++ b/webpack-cli/SERVE-OPTIONS-v4.md
@@ -9,7 +9,8 @@ Options:
   -m, --merge                                         Merge two or more configurations using 'webpack-merge'.
   --disable-interpret                                 Disable interpret for loading the config file.
   --env <value...>                                    Environment passed to the configuration when it is a function.
-  --define-process-env-node-env <value>               Sets process.env.NODE_ENV to the specified value.
+  --node-env <value>                                  Sets process.env.NODE_ENV to the specified value.
+  --define-process-env-node-env <value>               Sets process.env.NODE_ENV to the specified value. (Currently an alias for `--node-env`)
   --analyze                                           It invokes webpack-bundle-analyzer plugin to get bundle information.
   --progress [value]                                  Print compilation progress during build.
   -j, --json [value]                                  Prints result as JSON or store it in a file.
diff --git a/webpack-cli/lint-staged.config.js b/webpack-cli/lint-staged.config.js
index a3b4af38..61861fac 100644
--- a/webpack-cli/lint-staged.config.js
+++ b/webpack-cli/lint-staged.config.js
@@ -1,4 +1,4 @@
 module.exports = {
-  "*": ["prettier --write --ignore-unknown", "cspell"],
+  "*": ["prettier --write --ignore-unknown", "cspell --no-must-find-files"],
   "*.{js,ts}": ["eslint --cache --fix"],
 };
diff --git a/webpack-cli/package.json b/webpack-cli/package.json
index 52310f34..bba320f4 100644
--- a/webpack-cli/package.json
+++ b/webpack-cli/package.json
@@ -56,10 +56,10 @@
     "@commitlint/cli": "^17.1.2",
     "@commitlint/config-conventional": "^17.1.0",
     "@types/jest": "^29.0.3",
-    "@types/node": "^17.0.31",
+    "@types/node": "^18.11.9",
     "@types/rechoir": "^0.6.1",
-    "@typescript-eslint/eslint-plugin": "^5.22.0",
-    "@typescript-eslint/parser": "^5.22.0",
+    "@typescript-eslint/eslint-plugin": "^5.43.0",
+    "@typescript-eslint/parser": "^5.43.0",
     "coffeescript": "^2.7.0",
     "colorette": "^2.0.16",
     "concat-stream": "^2.0.0",
@@ -89,7 +89,7 @@
     "ts-jest": "^29.0.1",
     "ts-loader": "^9.3.1",
     "ts-node": "^10.8.0",
-    "typescript": "^4.7.2",
+    "typescript": "^4.9.3",
     "webpack": "^5.72.0",
     "webpack-bundle-analyzer": "^4.5.0",
     "webpack-dev-server": "^4.8.1"
diff --git a/webpack-cli/packages/configtest/CHANGELOG.md b/webpack-cli/packages/configtest/CHANGELOG.md
index 0a7f5a6c..9aa36188 100644
--- a/webpack-cli/packages/configtest/CHANGELOG.md
+++ b/webpack-cli/packages/configtest/CHANGELOG.md
@@ -3,6 +3,10 @@
 All notable changes to this project will be documented in this file.
 See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
 
+## [2.0.1](https://github.com/webpack/webpack-cli/compare/@webpack-cli/configtest@2.0.0...@webpack-cli/configtest@2.0.1) (2022-12-05)
+
+**Note:** Version bump only for package @webpack-cli/configtest
+
 # [2.0.0](https://github.com/webpack/webpack-cli/compare/@webpack-cli/configtest@1.2.0...@webpack-cli/configtest@2.0.0) (2022-11-17)
 
 ### BREAKING CHANGES
diff --git a/webpack-cli/packages/configtest/package.json b/webpack-cli/packages/configtest/package.json
index 6a7df709..a56214ac 100644
--- a/webpack-cli/packages/configtest/package.json
+++ b/webpack-cli/packages/configtest/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@webpack-cli/configtest",
-  "version": "2.0.0",
+  "version": "2.0.1",
   "description": "Validate a webpack configuration.",
   "main": "lib/index.js",
   "types": "lib/index.d.ts",
diff --git a/webpack-cli/packages/generators/CHANGELOG.md b/webpack-cli/packages/generators/CHANGELOG.md
index 026344a3..3267cab1 100644
--- a/webpack-cli/packages/generators/CHANGELOG.md
+++ b/webpack-cli/packages/generators/CHANGELOG.md
@@ -3,6 +3,12 @@
 All notable changes to this project will be documented in this file.
 See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
 
+## [3.0.1](https://github.com/webpack/webpack-cli/compare/@webpack-cli/generators@3.0.0...@webpack-cli/generators@3.0.1) (2022-12-05)
+
+### Bug Fixes
+
+- make define-process-env-node-env alias node-env ([#3514](https://github.com/webpack/webpack-cli/issues/3514)) ([346a518](https://github.com/webpack/webpack-cli/commit/346a518dd7423a726810ef1012031f92d318c9c5))
+
 # [3.0.0](https://github.com/webpack/webpack-cli/compare/@webpack-cli/generators@2.5.0...@webpack-cli/generators@3.0.0) (2022-11-17)
 
 ### Bug Fixes
diff --git a/webpack-cli/packages/generators/init-template/default/package.json.js b/webpack-cli/packages/generators/init-template/default/package.json.js
index 27af3fd3..79d967eb 100644
--- a/webpack-cli/packages/generators/init-template/default/package.json.js
+++ b/webpack-cli/packages/generators/init-template/default/package.json.js
@@ -1,8 +1,8 @@
 module.exports = (isUsingDevServer) => {
   const scripts = {
-    build: "webpack --mode=production --define-process-env-node-env=production",
+    build: "webpack --mode=production --node-env=production",
     "build:dev": "webpack --mode=development",
-    "build:prod": "webpack --mode=production --define-process-env-node-env=production",
+    "build:prod": "webpack --mode=production --node-env=production",
     watch: "webpack --watch",
   };
   if (isUsingDevServer) {
diff --git a/webpack-cli/packages/generators/init-template/react/package.json.tpl b/webpack-cli/packages/generators/init-template/react/package.json.tpl
index 87282af1..14aebb6b 100644
--- a/webpack-cli/packages/generators/init-template/react/package.json.tpl
+++ b/webpack-cli/packages/generators/init-template/react/package.json.tpl
@@ -3,9 +3,9 @@
   "description": "My webpack project",
   "name": "my-webpack-project",
   "scripts": {
-    "build": "webpack --mode=production --define-process-env-node-env=production",
+    "build": "webpack --mode=production --node-env=production",
     "build:dev": "webpack --mode=development",
-    "build:prod": "webpack --mode=production --define-process-env-node-env=production",
+    "build:prod": "webpack --mode=production --node-env=production",
     "watch": "webpack --watch",
     "serve": "webpack serve"
   }
diff --git a/webpack-cli/packages/generators/package.json b/webpack-cli/packages/generators/package.json
index da45e0cf..e704accd 100644
--- a/webpack-cli/packages/generators/package.json
+++ b/webpack-cli/packages/generators/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@webpack-cli/generators",
-  "version": "3.0.0",
+  "version": "3.0.1",
   "description": "Webpack-CLI generators",
   "main": "lib/index.js",
   "types": "lib/index.d.ts",
@@ -25,7 +25,7 @@
     "plugin-template"
   ],
   "dependencies": {
-    "webpack-cli": "^5.0.0",
+    "webpack-cli": "^5.0.1",
     "yeoman-environment": "^3.9.1",
     "yeoman-generator": "^5.7.0"
   },
diff --git a/webpack-cli/packages/info/CHANGELOG.md b/webpack-cli/packages/info/CHANGELOG.md
index 4fb508bf..f52d7ac8 100644
--- a/webpack-cli/packages/info/CHANGELOG.md
+++ b/webpack-cli/packages/info/CHANGELOG.md
@@ -3,6 +3,10 @@
 All notable changes to this project will be documented in this file.
 See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
 
+## [2.0.1](https://github.com/webpack/webpack-cli/compare/@webpack-cli/info@2.0.0...@webpack-cli/info@2.0.1) (2022-12-05)
+
+**Note:** Version bump only for package @webpack-cli/info
+
 # [2.0.0](https://github.com/webpack/webpack-cli/compare/@webpack-cli/info@1.5.0...@webpack-cli/info@2.0.0) (2022-11-17)
 
 ### Features
diff --git a/webpack-cli/packages/info/package.json b/webpack-cli/packages/info/package.json
index ed631825..617bf872 100644
--- a/webpack-cli/packages/info/package.json
+++ b/webpack-cli/packages/info/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@webpack-cli/info",
-  "version": "2.0.0",
+  "version": "2.0.1",
   "description": "Outputs info about system and webpack config",
   "main": "lib/index.js",
   "types": "lib/index.d.ts",
diff --git a/webpack-cli/packages/serve/CHANGELOG.md b/webpack-cli/packages/serve/CHANGELOG.md
index a75242b1..703da747 100644
--- a/webpack-cli/packages/serve/CHANGELOG.md
+++ b/webpack-cli/packages/serve/CHANGELOG.md
@@ -3,6 +3,10 @@
 All notable changes to this project will be documented in this file.
 See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
 
+## [2.0.1](https://github.com/webpack/webpack-cli/compare/@webpack-cli/serve@2.0.0...@webpack-cli/serve@2.0.1) (2022-12-05)
+
+**Note:** Version bump only for package @webpack-cli/serve
+
 # [2.0.0](https://github.com/webpack/webpack-cli/compare/@webpack-cli/serve@1.7.0...@webpack-cli/serve@2.0.0) (2022-11-17)
 
 ### BREAKING CHANGES
diff --git a/webpack-cli/packages/serve/package.json b/webpack-cli/packages/serve/package.json
index aac17909..a16aa712 100644
--- a/webpack-cli/packages/serve/package.json
+++ b/webpack-cli/packages/serve/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@webpack-cli/serve",
-  "version": "2.0.0",
+  "version": "2.0.1",
   "description": "",
   "main": "lib/index.js",
   "types": "lib/index.d.ts",
diff --git a/webpack-cli/packages/webpack-cli/CHANGELOG.md b/webpack-cli/packages/webpack-cli/CHANGELOG.md
index 3ca67f2a..10c013c0 100644
--- a/webpack-cli/packages/webpack-cli/CHANGELOG.md
+++ b/webpack-cli/packages/webpack-cli/CHANGELOG.md
@@ -3,6 +3,12 @@
 All notable changes to this project will be documented in this file.
 See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
 
+## [5.0.1](https://github.com/webpack/webpack-cli/compare/webpack-cli@5.0.0...webpack-cli@5.0.1) (2022-12-05)
+
+### Bug Fixes
+
+- make define-process-env-node-env alias node-env ([#3514](https://github.com/webpack/webpack-cli/issues/3514)) ([346a518](https://github.com/webpack/webpack-cli/commit/346a518dd7423a726810ef1012031f92d318c9c5))
+
 # [5.0.0](https://github.com/webpack/webpack-cli/compare/webpack-cli@4.10.0...webpack-cli@5.0.0) (2022-11-17)
 
 ### Bug Fixes
diff --git a/webpack-cli/packages/webpack-cli/README.md b/webpack-cli/packages/webpack-cli/README.md
index bdb0e382..430d7f08 100644
--- a/webpack-cli/packages/webpack-cli/README.md
+++ b/webpack-cli/packages/webpack-cli/README.md
@@ -84,7 +84,8 @@ Options:
   -m, --merge                                      Merge two or more configurations using 'webpack-merge'.
   --disable-interpret                              Disable interpret for loading the config file.
   --env <value...>                                 Environment passed to the configuration when it is a function.
-  --define-process-env-node-env <value>            Sets process.env.NODE_ENV to the specified value.
+  --node-env <value>                               Sets process.env.NODE_ENV to the specified value.
+  --define-process-env-node-env <value>            Sets process.env.NODE_ENV to the specified value. (Currently an alias for `--node-env`)
   --analyze                                        It invokes webpack-bundle-analyzer plugin to get bundle information.
   --progress [value]                               Print compilation progress during build.
   -j, --json [value]                               Prints result as JSON or store it in a file.
diff --git a/webpack-cli/packages/webpack-cli/package.json b/webpack-cli/packages/webpack-cli/package.json
index 346ee60f..3af26597 100644
--- a/webpack-cli/packages/webpack-cli/package.json
+++ b/webpack-cli/packages/webpack-cli/package.json
@@ -1,6 +1,6 @@
 {
   "name": "webpack-cli",
-  "version": "5.0.0",
+  "version": "5.0.1",
   "description": "CLI for webpack & friends",
   "license": "MIT",
   "repository": {
@@ -35,9 +35,9 @@
   ],
   "dependencies": {
     "@discoveryjs/json-ext": "^0.5.0",
-    "@webpack-cli/configtest": "^2.0.0",
-    "@webpack-cli/info": "^2.0.0",
-    "@webpack-cli/serve": "^2.0.0",
+    "@webpack-cli/configtest": "^2.0.1",
+    "@webpack-cli/info": "^2.0.1",
+    "@webpack-cli/serve": "^2.0.1",
     "colorette": "^2.0.14",
     "commander": "^9.4.1",
     "cross-spawn": "^7.0.3",
diff --git a/webpack-cli/packages/webpack-cli/src/webpack-cli.ts b/webpack-cli/packages/webpack-cli/src/webpack-cli.ts
index 868ffbb9..72eea48b 100644
--- a/webpack-cli/packages/webpack-cli/src/webpack-cli.ts
+++ b/webpack-cli/packages/webpack-cli/src/webpack-cli.ts
@@ -890,7 +890,7 @@ class WebpackCLI implements IWebpackCLI {
         description: "Environment passed to the configuration when it is a function.",
       },
       {
-        name: "define-process-env-node-env",
+        name: "node-env",
         configs: [
           {
             type: "string",
@@ -899,6 +899,17 @@ class WebpackCLI implements IWebpackCLI {
         multiple: false,
         description: "Sets process.env.NODE_ENV to the specified value.",
       },
+      {
+        name: "define-process-env-node-env",
+        configs: [
+          {
+            type: "string",
+          },
+        ],
+        multiple: false,
+        description:
+          "Sets process.env.NODE_ENV to the specified value. (Currently an alias for `--node-env`)",
+      },
 
       // Adding more plugins
       {
@@ -2176,7 +2187,10 @@ class WebpackCLI implements IWebpackCLI {
     callback?: Callback<[Error | undefined, WebpackCLIStats | undefined]>,
   ): Promise<WebpackCompiler> {
     if (typeof options.defineProcessEnvNodeEnv === "string") {
+      // TODO: This should only set NODE_ENV for the runtime not for the config too. Change this during next breaking change.
       process.env.NODE_ENV = options.defineProcessEnvNodeEnv;
+    } else if (typeof options.nodeEnv === "string") {
+      process.env.NODE_ENV = options.nodeEnv;
     }
 
     let config = await this.loadConfig(options);


More information about the Pkg-javascript-devel mailing list