webpack 4.28.0 → 4.28.4

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/lib/Compiler.js CHANGED
@@ -207,6 +207,10 @@ class Compiler extends Tapable {
207
207
  const finalCallback = (err, stats) => {
208
208
  this.running = false;
209
209
 
210
+ if (err) {
211
+ this.hooks.failed.call(err);
212
+ }
213
+
210
214
  if (callback !== undefined) return callback(err, stats);
211
215
  };
212
216
 
@@ -38,12 +38,15 @@ class IgnorePlugin {
38
38
  * @returns {TODO|null} returns result or null if result should be ignored
39
39
  */
40
40
  checkIgnore(result) {
41
+ if (!result) return result;
42
+
41
43
  if (
42
44
  "checkResource" in this.options &&
45
+ this.options.checkResource &&
43
46
  this.options.checkResource(result.request, result.context)
44
47
  ) {
45
48
  // TODO webpack 5 remove checkContext, as checkResource already gets context
46
- if ("checkContext" in this.options) {
49
+ if ("checkContext" in this.options && this.options.checkContext) {
47
50
  if (this.options.checkContext(result.context)) {
48
51
  return null;
49
52
  }
@@ -54,9 +57,10 @@ class IgnorePlugin {
54
57
 
55
58
  if (
56
59
  "resourceRegExp" in this.options &&
60
+ this.options.resourceRegExp &&
57
61
  this.options.resourceRegExp.test(result.request)
58
62
  ) {
59
- if ("contextRegExp" in this.options) {
63
+ if ("contextRegExp" in this.options && this.options.contextRegExp) {
60
64
  // if "contextRegExp" is given,
61
65
  // both the "resourceRegExp" and "contextRegExp" have to match.
62
66
  if (this.options.contextRegExp.test(result.context)) {
@@ -463,7 +463,7 @@ class WebpackOptionsApply extends OptionsApply {
463
463
  if (options.optimization.minimize) {
464
464
  for (const minimizer of options.optimization.minimizer) {
465
465
  if (typeof minimizer === "function") {
466
- minimizer.apply(compiler);
466
+ minimizer.call(compiler, compiler);
467
467
  } else {
468
468
  minimizer.apply(compiler);
469
469
  }
@@ -1,4 +1,6 @@
1
1
  const fs = require("fs");
2
+ const path = require("path");
3
+ const mkdirp = require("mkdirp");
2
4
  const { Tracer } = require("chrome-trace-event");
3
5
  const validateOptions = require("schema-utils");
4
6
  const schema = require("../../schemas/plugins/debug/ProfilingPlugin.json");
@@ -93,6 +95,10 @@ const createTrace = outputPath => {
93
95
  noStream: true
94
96
  });
95
97
  const profiler = new Profiler(inspector);
98
+ if (/\/|\\/.test(outputPath)) {
99
+ const dirPath = path.dirname(outputPath);
100
+ mkdirp.sync(dirPath);
101
+ }
96
102
  const fsStream = fs.createWriteStream(outputPath);
97
103
 
98
104
  let counter = 0;
@@ -36,8 +36,12 @@ module.exports = class AMDRequireDependenciesBlock extends AsyncDependenciesBloc
36
36
  } else {
37
37
  this.range = expr.range;
38
38
  }
39
- const dep = new AMDRequireDependency(this);
39
+ const dep = this.newRequireDependency();
40
40
  dep.loc = loc;
41
41
  this.addDependency(dep);
42
42
  }
43
+
44
+ newRequireDependency() {
45
+ return new AMDRequireDependency(this);
46
+ }
43
47
  };
@@ -13,9 +13,13 @@ module.exports = class HarmonyDetectionParserPlugin {
13
13
  const isStrictHarmony = parser.state.module.type === "javascript/esm";
14
14
  const isHarmony =
15
15
  isStrictHarmony ||
16
- ast.body.some(statement => {
17
- return /^(Import|Export).*Declaration$/.test(statement.type);
18
- });
16
+ ast.body.some(
17
+ statement =>
18
+ statement.type === "ImportDeclaration" ||
19
+ statement.type === "ExportDefaultDeclaration" ||
20
+ statement.type === "ExportNamedDeclaration" ||
21
+ statement.type === "ExportAllDeclaration"
22
+ );
19
23
  if (isHarmony) {
20
24
  const module = parser.state.module;
21
25
  const compatDep = new HarmonyCompatibilityDependency(module);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webpack",
3
- "version": "4.28.0",
3
+ "version": "4.28.4",
4
4
  "author": "Tobias Koppers @sokra",
5
5
  "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.",
6
6
  "license": "MIT",