webpack 4.35.3 → 4.38.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.
@@ -75,6 +75,16 @@ export type ExternalItem =
75
75
  * via the `definition` "ArrayOfStringValues".
76
76
  */
77
77
  export type ArrayOfStringValues = string[];
78
+ /**
79
+ * This interface was referenced by `WebpackOptions`'s JSON-Schema
80
+ * via the `definition` "FilterTypes".
81
+ */
82
+ export type FilterTypes = FilterItemTypes | FilterItemTypes[];
83
+ /**
84
+ * This interface was referenced by `WebpackOptions`'s JSON-Schema
85
+ * via the `definition` "FilterItemTypes".
86
+ */
87
+ export type FilterItemTypes = RegExp | string | ((value: string) => boolean);
78
88
  /**
79
89
  * One or multiple rule conditions
80
90
  *
@@ -235,16 +245,6 @@ export type WebpackPluginFunction = (
235
245
  * via the `definition` "RuleSetRules".
236
246
  */
237
247
  export type RuleSetRules = RuleSetRule[];
238
- /**
239
- * This interface was referenced by `WebpackOptions`'s JSON-Schema
240
- * via the `definition` "FilterTypes".
241
- */
242
- export type FilterTypes = FilterItemTypes | FilterItemTypes[];
243
- /**
244
- * This interface was referenced by `WebpackOptions`'s JSON-Schema
245
- * via the `definition` "FilterItemTypes".
246
- */
247
- export type FilterItemTypes = RegExp | string | Function;
248
248
 
249
249
  export interface WebpackOptions {
250
250
  /**
@@ -293,6 +293,19 @@ export interface WebpackOptions {
293
293
  * Specify dependencies that shouldn't be resolved by webpack, but should become dependencies of the resulting bundle. The kind of the dependency depends on `output.libraryTarget`.
294
294
  */
295
295
  externals?: Externals;
296
+ /**
297
+ * Options for infrastructure level logging
298
+ */
299
+ infrastructureLogging?: {
300
+ /**
301
+ * Enable debug logging for specific loggers
302
+ */
303
+ debug?: FilterTypes | boolean;
304
+ /**
305
+ * Log level
306
+ */
307
+ level?: "none" | "error" | "warn" | "info" | "log" | "verbose";
308
+ };
296
309
  /**
297
310
  * Custom values available in the loader context.
298
311
  */
@@ -1094,7 +1107,7 @@ export interface OutputOptions {
1094
1107
  /**
1095
1108
  * Algorithm used for generation the hash (see node.js crypto package)
1096
1109
  */
1097
- hashFunction?: string | (new () => import("../lib/util/createHash").Hash);
1110
+ hashFunction?: string | import("../lib/util/createHash").HashConstructor;
1098
1111
  /**
1099
1112
  * Any string which is added to the hash to salt it
1100
1113
  */
@@ -1343,6 +1356,18 @@ export interface StatsOptions {
1343
1356
  * add the hash of the compilation
1344
1357
  */
1345
1358
  hash?: boolean;
1359
+ /**
1360
+ * add logging output
1361
+ */
1362
+ logging?: boolean | ("none" | "error" | "warn" | "info" | "log" | "verbose");
1363
+ /**
1364
+ * Include debug logging of specified loggers (i. e. for plugins or loaders). Filters can be Strings, RegExps or Functions
1365
+ */
1366
+ loggingDebug?: FilterTypes | boolean;
1367
+ /**
1368
+ * add stack traces to logging output
1369
+ */
1370
+ loggingTrace?: boolean;
1346
1371
  /**
1347
1372
  * Set the maximum number of modules to be shown
1348
1373
  */
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ const WebpackError = require("./WebpackError");
4
+ const CURRENT_METHOD_REGEXP = /at ([a-zA-Z0-9_.]*)/;
5
+
6
+ /**
7
+ * @param {string=} method method name
8
+ * @returns {string} message
9
+ */
10
+ function createMessage(method) {
11
+ return `Abstract method${method ? " " + method : ""}. Must be overridden.`;
12
+ }
13
+
14
+ /**
15
+ * @constructor
16
+ */
17
+ function Message() {
18
+ this.stack = undefined;
19
+ Error.captureStackTrace(this);
20
+ /** @type {RegExpMatchArray} */
21
+ const match = this.stack.split("\n")[3].match(CURRENT_METHOD_REGEXP);
22
+
23
+ this.message = match && match[1] ? createMessage(match[1]) : createMessage();
24
+ }
25
+
26
+ /**
27
+ * Error for abstract method
28
+ * @example
29
+ * class FooClass {
30
+ * abstractMethod() {
31
+ * throw new AbstractMethodError(); // error message: Abstract method FooClass.abstractMethod. Must be overriden.
32
+ * }
33
+ * }
34
+ *
35
+ */
36
+ class AbstractMethodError extends WebpackError {
37
+ constructor() {
38
+ super(new Message().message);
39
+ this.name = "AbstractMethodError";
40
+ }
41
+ }
42
+
43
+ module.exports = AbstractMethodError;
package/lib/Chunk.js CHANGED
@@ -355,7 +355,11 @@ class Chunk {
355
355
  return this._modules.getFromUnorderedCache(getModulesIdent);
356
356
  }
357
357
 
358
- remove() {
358
+ /**
359
+ * @param {string=} reason reason why chunk is removed
360
+ * @returns {void}
361
+ */
362
+ remove(reason) {
359
363
  // cleanup modules
360
364
  // Array.from is used here to create a clone, because removeChunk modifies this._modules
361
365
  for (const module of Array.from(this._modules)) {
package/lib/ChunkGroup.js CHANGED
@@ -345,7 +345,7 @@ class ChunkGroup {
345
345
  }
346
346
 
347
347
  /**
348
- * @param {ModuleReason} reason reason for removing ChunkGroup
348
+ * @param {string=} reason reason for removing ChunkGroup
349
349
  * @returns {void}
350
350
  */
351
351
  remove(reason) {