webpack 5.23.0 → 5.24.3

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.

Potentially problematic release.


This version of webpack might be problematic. Click here for more details.

@@ -28,6 +28,27 @@ const addToList = (itemOrItems, list) => {
28
28
  }
29
29
  };
30
30
 
31
+ /**
32
+ * @template T
33
+ * @param {T[]} input list
34
+ * @param {function(T): Buffer} fn map function
35
+ * @returns {Buffer[]} buffers without duplicates
36
+ */
37
+ const mapAndDeduplicateBuffers = (input, fn) => {
38
+ // Buffer.equals compares size first so this should be efficient enough
39
+ // If it becomes a performance problem we can use a map and group by size
40
+ // instead of looping over all assets.
41
+ const result = [];
42
+ outer: for (const value of input) {
43
+ const buf = fn(value);
44
+ for (const other of result) {
45
+ if (buf.equals(other)) continue outer;
46
+ }
47
+ result.push(buf);
48
+ }
49
+ return result;
50
+ };
51
+
31
52
  /**
32
53
  * Escapes regular expression metacharacters
33
54
  * @param {string} str String to quote
@@ -331,7 +352,7 @@ ${referencingAssets
331
352
  : computeNewContent(asset)
332
353
  )
333
354
  );
334
- const assetsContent = assets.map(asset => {
355
+ const assetsContent = mapAndDeduplicateBuffers(assets, asset => {
335
356
  if (asset.ownHashes.has(oldHash)) {
336
357
  return asset.newSourceWithoutOwn
337
358
  ? asset.newSourceWithoutOwn.buffer()
@@ -264,8 +264,24 @@ class SideEffectsFlagPlugin {
264
264
  moduleGraph,
265
265
  ({ module }) =>
266
266
  module.getSideEffectsConnectionState(moduleGraph) ===
267
- false
267
+ false,
268
+ ({ module: newModule, export: exportName }) => {
269
+ moduleGraph.updateModule(dep, newModule);
270
+ moduleGraph.addExplanation(
271
+ dep,
272
+ "(skipped side-effect-free modules)"
273
+ );
274
+ const ids = dep.getIds(moduleGraph);
275
+ dep.setIds(
276
+ moduleGraph,
277
+ exportName
278
+ ? [...exportName, ...ids.slice(1)]
279
+ : ids.slice(1)
280
+ );
281
+ return moduleGraph.getConnection(dep);
282
+ }
268
283
  );
284
+ continue;
269
285
  }
270
286
  // TODO improve for nested imports
271
287
  const ids = dep.getIds(moduleGraph);
@@ -460,7 +460,7 @@ const EXTRACT_ERROR = {
460
460
  /** @type {SimpleExtractors} */
461
461
  const SIMPLE_EXTRACTORS = {
462
462
  compilation: {
463
- _: (object, compilation, context) => {
463
+ _: (object, compilation, context, options) => {
464
464
  if (!context.makePathsRelative) {
465
465
  context.makePathsRelative = makePathsRelative.bindContextCache(
466
466
  compilation.compiler.context,
@@ -495,6 +495,144 @@ const SIMPLE_EXTRACTORS = {
495
495
  if (compilation.needAdditionalPass) {
496
496
  object.needAdditionalPass = true;
497
497
  }
498
+
499
+ const { logging, loggingDebug, loggingTrace } = options;
500
+ if (logging || (loggingDebug && loggingDebug.length > 0)) {
501
+ const util = require("util");
502
+ object.logging = {};
503
+ let acceptedTypes;
504
+ let collapsedGroups = false;
505
+ switch (logging) {
506
+ default:
507
+ acceptedTypes = new Set();
508
+ break;
509
+ case "error":
510
+ acceptedTypes = new Set([LogType.error]);
511
+ break;
512
+ case "warn":
513
+ acceptedTypes = new Set([LogType.error, LogType.warn]);
514
+ break;
515
+ case "info":
516
+ acceptedTypes = new Set([
517
+ LogType.error,
518
+ LogType.warn,
519
+ LogType.info
520
+ ]);
521
+ break;
522
+ case "log":
523
+ acceptedTypes = new Set([
524
+ LogType.error,
525
+ LogType.warn,
526
+ LogType.info,
527
+ LogType.log,
528
+ LogType.group,
529
+ LogType.groupEnd,
530
+ LogType.groupCollapsed,
531
+ LogType.clear
532
+ ]);
533
+ break;
534
+ case "verbose":
535
+ acceptedTypes = new Set([
536
+ LogType.error,
537
+ LogType.warn,
538
+ LogType.info,
539
+ LogType.log,
540
+ LogType.group,
541
+ LogType.groupEnd,
542
+ LogType.groupCollapsed,
543
+ LogType.profile,
544
+ LogType.profileEnd,
545
+ LogType.time,
546
+ LogType.status,
547
+ LogType.clear
548
+ ]);
549
+ collapsedGroups = true;
550
+ break;
551
+ }
552
+ const cachedMakePathsRelative = makePathsRelative.bindContextCache(
553
+ options.context,
554
+ compilation.compiler.root
555
+ );
556
+ let depthInCollapsedGroup = 0;
557
+ for (const [origin, logEntries] of compilation.logging) {
558
+ const debugMode = loggingDebug.some(fn => fn(origin));
559
+ if (logging === false && !debugMode) continue;
560
+ /** @type {KnownStatsLoggingEntry[]} */
561
+ const groupStack = [];
562
+ /** @type {KnownStatsLoggingEntry[]} */
563
+ const rootList = [];
564
+ let currentList = rootList;
565
+ let processedLogEntries = 0;
566
+ for (const entry of logEntries) {
567
+ let type = entry.type;
568
+ if (!debugMode && !acceptedTypes.has(type)) continue;
569
+
570
+ // Expand groups in verbose and debug modes
571
+ if (
572
+ type === LogType.groupCollapsed &&
573
+ (debugMode || collapsedGroups)
574
+ )
575
+ type = LogType.group;
576
+
577
+ if (depthInCollapsedGroup === 0) {
578
+ processedLogEntries++;
579
+ }
580
+
581
+ if (type === LogType.groupEnd) {
582
+ groupStack.pop();
583
+ if (groupStack.length > 0) {
584
+ currentList = groupStack[groupStack.length - 1].children;
585
+ } else {
586
+ currentList = rootList;
587
+ }
588
+ if (depthInCollapsedGroup > 0) depthInCollapsedGroup--;
589
+ continue;
590
+ }
591
+ let message = undefined;
592
+ if (entry.type === LogType.time) {
593
+ message = `${entry.args[0]}: ${
594
+ entry.args[1] * 1000 + entry.args[2] / 1000000
595
+ } ms`;
596
+ } else if (entry.args && entry.args.length > 0) {
597
+ message = util.format(entry.args[0], ...entry.args.slice(1));
598
+ }
599
+ /** @type {KnownStatsLoggingEntry} */
600
+ const newEntry = {
601
+ ...entry,
602
+ type,
603
+ message,
604
+ trace: loggingTrace ? entry.trace : undefined,
605
+ children:
606
+ type === LogType.group || type === LogType.groupCollapsed
607
+ ? []
608
+ : undefined
609
+ };
610
+ currentList.push(newEntry);
611
+ if (newEntry.children) {
612
+ groupStack.push(newEntry);
613
+ currentList = newEntry.children;
614
+ if (depthInCollapsedGroup > 0) {
615
+ depthInCollapsedGroup++;
616
+ } else if (type === LogType.groupCollapsed) {
617
+ depthInCollapsedGroup = 1;
618
+ }
619
+ }
620
+ }
621
+ let name = cachedMakePathsRelative(origin).replace(/\|/g, " ");
622
+ if (name in object.logging) {
623
+ let i = 1;
624
+ while (`${name}#${i}` in object.logging) {
625
+ i++;
626
+ }
627
+ name = `${name}#${i}`;
628
+ }
629
+ object.logging[name] = {
630
+ entries: rootList,
631
+ filteredEntries: logEntries.length - processedLogEntries,
632
+ debug: debugMode
633
+ };
634
+ }
635
+ }
498
636
  },
499
637
  hash: (object, compilation) => {
500
638
  object.hash = compilation.hash;
@@ -738,135 +876,6 @@ const SIMPLE_EXTRACTORS = {
738
876
  }
739
877
  }
740
878
  },
741
- logging: (object, compilation, _context, options, factory) => {
742
- const util = require("util");
743
- const { loggingDebug, loggingTrace, context } = options;
744
- object.logging = {};
745
- let acceptedTypes;
746
- let collapsedGroups = false;
747
- switch (options.logging) {
748
- case "none":
749
- acceptedTypes = new Set([]);
750
- break;
751
- case "error":
752
- acceptedTypes = new Set([LogType.error]);
753
- break;
754
- case "warn":
755
- acceptedTypes = new Set([LogType.error, LogType.warn]);
756
- break;
757
- case "info":
758
- acceptedTypes = new Set([LogType.error, LogType.warn, LogType.info]);
759
- break;
760
- case "log":
761
- acceptedTypes = new Set([
762
- LogType.error,
763
- LogType.warn,
764
- LogType.info,
765
- LogType.log,
766
- LogType.group,
767
- LogType.groupEnd,
768
- LogType.groupCollapsed,
769
- LogType.clear
770
- ]);
771
- break;
772
- case "verbose":
773
- acceptedTypes = new Set([
774
- LogType.error,
775
- LogType.warn,
776
- LogType.info,
777
- LogType.log,
778
- LogType.group,
779
- LogType.groupEnd,
780
- LogType.groupCollapsed,
781
- LogType.profile,
782
- LogType.profileEnd,
783
- LogType.time,
784
- LogType.status,
785
- LogType.clear
786
- ]);
787
- collapsedGroups = true;
788
- break;
789
- }
790
- const cachedMakePathsRelative = makePathsRelative.bindContextCache(
791
- context,
792
- compilation.compiler.root
793
- );
794
- let depthInCollapsedGroup = 0;
795
- for (const [origin, logEntries] of compilation.logging) {
796
- const debugMode = loggingDebug.some(fn => fn(origin));
797
- /** @type {KnownStatsLoggingEntry[]} */
798
- const groupStack = [];
799
- /** @type {KnownStatsLoggingEntry[]} */
800
- const rootList = [];
801
- let currentList = rootList;
802
- let processedLogEntries = 0;
803
- for (const entry of logEntries) {
804
- let type = entry.type;
805
- if (!debugMode && !acceptedTypes.has(type)) continue;
806
-
807
- // Expand groups in verbose and debug modes
808
- if (type === LogType.groupCollapsed && (debugMode || collapsedGroups))
809
- type = LogType.group;
810
-
811
- if (depthInCollapsedGroup === 0) {
812
- processedLogEntries++;
813
- }
814
-
815
- if (type === LogType.groupEnd) {
816
- groupStack.pop();
817
- if (groupStack.length > 0) {
818
- currentList = groupStack[groupStack.length - 1].children;
819
- } else {
820
- currentList = rootList;
821
- }
822
- if (depthInCollapsedGroup > 0) depthInCollapsedGroup--;
823
- continue;
824
- }
825
- let message = undefined;
826
- if (entry.type === LogType.time) {
827
- message = `${entry.args[0]}: ${
828
- entry.args[1] * 1000 + entry.args[2] / 1000000
829
- } ms`;
830
- } else if (entry.args && entry.args.length > 0) {
831
- message = util.format(entry.args[0], ...entry.args.slice(1));
832
- }
833
- /** @type {KnownStatsLoggingEntry} */
834
- const newEntry = {
835
- ...entry,
836
- type,
837
- message,
838
- trace: loggingTrace ? entry.trace : undefined,
839
- children:
840
- type === LogType.group || type === LogType.groupCollapsed
841
- ? []
842
- : undefined
843
- };
844
- currentList.push(newEntry);
845
- if (newEntry.children) {
846
- groupStack.push(newEntry);
847
- currentList = newEntry.children;
848
- if (depthInCollapsedGroup > 0) {
849
- depthInCollapsedGroup++;
850
- } else if (type === LogType.groupCollapsed) {
851
- depthInCollapsedGroup = 1;
852
- }
853
- }
854
- }
855
- let name = cachedMakePathsRelative(origin).replace(/\|/g, " ");
856
- if (name in object.logging) {
857
- let i = 1;
858
- while (`${name}#${i}` in object.logging) {
859
- i++;
860
- }
861
- name = `${name}#${i}`;
862
- }
863
- object.logging[name] = {
864
- entries: rootList,
865
- filteredEntries: logEntries.length - processedLogEntries,
866
- debug: debugMode
867
- };
868
- }
869
- },
870
879
  children: (object, compilation, context, options, factory) => {
871
880
  const { type } = context;
872
881
  object.children = factory.create(
@@ -1895,7 +1904,7 @@ const ASSETS_GROUPERS = {
1895
1904
  }
1896
1905
  };
1897
1906
 
1898
- /** @type {function(string): Record<string, (groupConfigs: GroupConfig[], context: StatsFactoryContext, options: NormalizedStatsOptions) => void>} */
1907
+ /** @type {function("module" | "chunk" | "root-of-chunk" | "nested"): Record<string, (groupConfigs: GroupConfig[], context: StatsFactoryContext, options: NormalizedStatsOptions) => void>} */
1899
1908
  const MODULES_GROUPERS = type => ({
1900
1909
  _: (groupConfigs, context, options) => {
1901
1910
  const groupByFlag = (name, type, exclude) => {
@@ -73,7 +73,22 @@ const first = set => {
73
73
  return entry.done ? undefined : entry.value;
74
74
  };
75
75
 
76
+ /**
77
+ * @template T
78
+ * @param {Set<T>} a first
79
+ * @param {Set<T>} b second
80
+ * @returns {Set<T>} combined set, may be identical to a or b
81
+ */
82
+ const combine = (a, b) => {
83
+ if (b.size === 0) return a;
84
+ if (a.size === 0) return b;
85
+ const set = new Set(a);
86
+ for (const item of b) set.add(item);
87
+ return set;
88
+ };
89
+
76
90
  exports.intersect = intersect;
77
91
  exports.isSubset = isSubset;
78
92
  exports.find = find;
79
93
  exports.first = first;
94
+ exports.combine = combine;
package/lib/util/fs.js CHANGED
@@ -64,6 +64,8 @@ const path = require("path");
64
64
  * @typedef {Object} Watcher
65
65
  * @property {function(): void} close closes the watcher and all underlying file watchers
66
66
  * @property {function(): void} pause closes the watcher, but keeps underlying file watchers alive until the next watch call
67
+ * @property {function(): Set<string>=} getAggregatedChanges get current aggregated changes that have not yet send to callback
68
+ * @property {function(): Set<string>=} getAggregatedRemovals get current aggregated removals that have not yet send to callback
67
69
  * @property {function(): Map<string, FileSystemInfoEntry | "ignore">} getFileTimeInfoEntries get info about files
68
70
  * @property {function(): Map<string, FileSystemInfoEntry | "ignore">} getContextTimeInfoEntries get info about directories
69
71
  */
@@ -215,11 +215,11 @@ exports.parseRange = str => {
215
215
 
216
216
  /* eslint-disable eqeqeq */
217
217
  const rangeToString = range => {
218
+ var fixCount = range[0];
219
+ var str = "";
218
220
  if (range.length === 1) {
219
221
  return "*";
220
- } else if (0 in range) {
221
- var str = "";
222
- var fixCount = range[0];
222
+ } else if (fixCount + 0.5) {
223
223
  str +=
224
224
  fixCount == 0
225
225
  ? ">="
@@ -464,7 +464,7 @@ exports.versionLtRuntimeCode = runtimeTemplate =>
464
464
  exports.rangeToStringRuntimeCode = runtimeTemplate =>
465
465
  `var rangeToString = ${runtimeTemplate.basicFunction("range", [
466
466
  "// see webpack/lib/util/semver.js for original code",
467
- 'if(1===range.length)return"*";if(0 in range){var r="",n=range[0];r+=0==n?">=":-1==n?"<":1==n?"^":2==n?"~":n>0?"=":"!=";for(var e=1,a=1;a<range.length;a++){e--,r+="u"==(typeof(t=range[a]))[0]?"-":(e>0?".":"")+(e=2,t)}return r}var g=[];for(a=1;a<range.length;a++){var t=range[a];g.push(0===t?"not("+o()+")":1===t?"("+o()+" || "+o()+")":2===t?g.pop()+" "+g.pop():rangeToString(t))}return o();function o(){return g.pop().replace(/^\\((.+)\\)$/,"$1")}'
467
+ 'var r=range[0],n="";if(1===range.length)return"*";if(r+.5){n+=0==r?">=":-1==r?"<":1==r?"^":2==r?"~":r>0?"=":"!=";for(var e=1,a=1;a<range.length;a++){e--,n+="u"==(typeof(t=range[a]))[0]?"-":(e>0?".":"")+(e=2,t)}return n}var g=[];for(a=1;a<range.length;a++){var t=range[a];g.push(0===t?"not("+o()+")":1===t?"("+o()+" || "+o()+")":2===t?g.pop()+" "+g.pop():rangeToString(t))}return o();function o(){return g.pop().replace(/^\\((.+)\\)$/,"$1")}'
468
468
  ])}`;
469
469
  //#endregion
470
470
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webpack",
3
- "version": "5.23.0",
3
+ "version": "5.24.3",
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",
@@ -14,7 +14,7 @@
14
14
  "browserslist": "^4.14.5",
15
15
  "chrome-trace-event": "^1.0.2",
16
16
  "enhanced-resolve": "^5.7.0",
17
- "es-module-lexer": "^0.3.26",
17
+ "es-module-lexer": "^0.4.0",
18
18
  "eslint-scope": "^5.1.1",
19
19
  "events": "^3.2.0",
20
20
  "glob-to-regexp": "^0.4.1",
@@ -60,7 +60,7 @@
60
60
  "eslint-plugin-prettier": "^3.1.4",
61
61
  "file-loader": "^6.0.0",
62
62
  "fork-ts-checker-webpack-plugin": "^6.0.5",
63
- "husky": "^5.0.9",
63
+ "husky": "^5.1.2",
64
64
  "is-ci": "^2.0.0",
65
65
  "istanbul": "^0.4.5",
66
66
  "jest": "^26.6.3",
@@ -154,6 +154,7 @@
154
154
  "special-lint": "node node_modules/tooling/lockfile-lint && node node_modules/tooling/schemas-lint && node node_modules/tooling/inherit-types && node node_modules/tooling/format-schemas && node tooling/generate-runtime-code.js && node node_modules/tooling/format-file-header && node node_modules/tooling/compile-to-definitions && node node_modules/tooling/generate-types --no-template-literals",
155
155
  "special-lint-fix": "node node_modules/tooling/inherit-types --write && node node_modules/tooling/format-schemas --write && node tooling/generate-runtime-code.js --write && node node_modules/tooling/format-file-header --write && node node_modules/tooling/compile-to-definitions --write && node node_modules/tooling/generate-types --no-template-literals --write",
156
156
  "fix": "yarn code-lint --fix && yarn special-lint-fix && yarn pretty-lint-fix",
157
+ "prepare": "husky install",
157
158
  "pretty-lint-base": "prettier \"*.{ts,json,yml,yaml,md}\" \"{setup,lib,bin,hot,benchmark,tooling,schemas}/**/*.json\" \"examples/*.md\"",
158
159
  "pretty-lint-base-all": "yarn pretty-lint-base \"*.js\" \"{setup,lib,bin,hot,benchmark,tooling,schemas}/**/*.js\" \"test/*.js\" \"test/helpers/*.js\" \"test/{configCases,watchCases,statsCases,hotCases,benchmarkCases}/**/webpack.config.js\" \"examples/**/webpack.config.js\"",
159
160
  "pretty-lint-fix": "yarn pretty-lint-base-all --loglevel warn --write",
@@ -169,11 +170,6 @@
169
170
  "cover:types": "node node_modules/tooling/type-coverage",
170
171
  "cover:report": "istanbul report"
171
172
  },
172
- "husky": {
173
- "hooks": {
174
- "pre-commit": "lint-staged"
175
- }
176
- },
177
173
  "lint-staged": {
178
174
  "*.js|{lib,setup,bin,hot,tooling,schemas}/**/*.js|test/*.js|{test,examples}/**/webpack.config.js}": [
179
175
  "eslint --cache"
@@ -13,6 +13,51 @@
13
13
  }
14
14
  ]
15
15
  },
16
+ "AssetFilterItemTypes": {
17
+ "description": "Filtering value, regexp or function.",
18
+ "cli": {
19
+ "helper": true
20
+ },
21
+ "anyOf": [
22
+ {
23
+ "instanceof": "RegExp",
24
+ "tsType": "RegExp"
25
+ },
26
+ {
27
+ "type": "string",
28
+ "absolutePath": false
29
+ },
30
+ {
31
+ "instanceof": "Function",
32
+ "tsType": "((name: string, asset: import('../lib/stats/DefaultStatsFactoryPlugin').StatsAsset) => boolean)"
33
+ }
34
+ ]
35
+ },
36
+ "AssetFilterTypes": {
37
+ "description": "Filtering modules.",
38
+ "cli": {
39
+ "helper": true
40
+ },
41
+ "anyOf": [
42
+ {
43
+ "type": "array",
44
+ "items": {
45
+ "description": "Rule to filter.",
46
+ "cli": {
47
+ "helper": true
48
+ },
49
+ "oneOf": [
50
+ {
51
+ "$ref": "#/definitions/AssetFilterItemTypes"
52
+ }
53
+ ]
54
+ }
55
+ },
56
+ {
57
+ "$ref": "#/definitions/AssetFilterItemTypes"
58
+ }
59
+ ]
60
+ },
16
61
  "AssetGeneratorDataUrl": {
17
62
  "description": "The options for data url generator.",
18
63
  "anyOf": [
@@ -1498,6 +1543,51 @@
1498
1543
  "description": "Enable production optimizations or development hints.",
1499
1544
  "enum": ["development", "production", "none"]
1500
1545
  },
1546
+ "ModuleFilterItemTypes": {
1547
+ "description": "Filtering value, regexp or function.",
1548
+ "cli": {
1549
+ "helper": true
1550
+ },
1551
+ "anyOf": [
1552
+ {
1553
+ "instanceof": "RegExp",
1554
+ "tsType": "RegExp"
1555
+ },
1556
+ {
1557
+ "type": "string",
1558
+ "absolutePath": false
1559
+ },
1560
+ {
1561
+ "instanceof": "Function",
1562
+ "tsType": "((name: string, module: import('../lib/stats/DefaultStatsFactoryPlugin').StatsModule, type: 'module' | 'chunk' | 'root-of-chunk' | 'nested') => boolean)"
1563
+ }
1564
+ ]
1565
+ },
1566
+ "ModuleFilterTypes": {
1567
+ "description": "Filtering modules.",
1568
+ "cli": {
1569
+ "helper": true
1570
+ },
1571
+ "anyOf": [
1572
+ {
1573
+ "type": "array",
1574
+ "items": {
1575
+ "description": "Rule to filter.",
1576
+ "cli": {
1577
+ "helper": true
1578
+ },
1579
+ "oneOf": [
1580
+ {
1581
+ "$ref": "#/definitions/ModuleFilterItemTypes"
1582
+ }
1583
+ ]
1584
+ }
1585
+ },
1586
+ {
1587
+ "$ref": "#/definitions/ModuleFilterItemTypes"
1588
+ }
1589
+ ]
1590
+ },
1501
1591
  "ModuleOptions": {
1502
1592
  "description": "Options affecting the normal modules (`NormalModuleFactory`).",
1503
1593
  "type": "object",
@@ -3920,7 +4010,7 @@
3920
4010
  "type": "boolean"
3921
4011
  },
3922
4012
  {
3923
- "$ref": "#/definitions/FilterTypes"
4013
+ "$ref": "#/definitions/ModuleFilterTypes"
3924
4014
  }
3925
4015
  ]
3926
4016
  },
@@ -3928,7 +4018,7 @@
3928
4018
  "description": "Suppress assets that match the specified filters. Filters can be Strings, RegExps or Functions.",
3929
4019
  "oneOf": [
3930
4020
  {
3931
- "$ref": "#/definitions/FilterTypes"
4021
+ "$ref": "#/definitions/AssetFilterTypes"
3932
4022
  }
3933
4023
  ]
3934
4024
  },
@@ -3939,7 +4029,7 @@
3939
4029
  "type": "boolean"
3940
4030
  },
3941
4031
  {
3942
- "$ref": "#/definitions/FilterTypes"
4032
+ "$ref": "#/definitions/ModuleFilterTypes"
3943
4033
  }
3944
4034
  ]
3945
4035
  },
@@ -4127,7 +4217,7 @@
4127
4217
  "description": "Suppress listing warnings that match the specified filters (they will still be counted). Filters can be Strings, RegExps or Functions.",
4128
4218
  "oneOf": [
4129
4219
  {
4130
- "$ref": "#/definitions/FilterTypes"
4220
+ "$ref": "#/definitions/WarningFilterTypes"
4131
4221
  }
4132
4222
  ]
4133
4223
  }
@@ -4190,6 +4280,51 @@
4190
4280
  "type": "string",
4191
4281
  "minLength": 1
4192
4282
  },
4283
+ "WarningFilterItemTypes": {
4284
+ "description": "Filtering value, regexp or function.",
4285
+ "cli": {
4286
+ "helper": true
4287
+ },
4288
+ "anyOf": [
4289
+ {
4290
+ "instanceof": "RegExp",
4291
+ "tsType": "RegExp"
4292
+ },
4293
+ {
4294
+ "type": "string",
4295
+ "absolutePath": false
4296
+ },
4297
+ {
4298
+ "instanceof": "Function",
4299
+ "tsType": "((warning: import('../lib/stats/DefaultStatsFactoryPlugin').StatsError, value: string) => boolean)"
4300
+ }
4301
+ ]
4302
+ },
4303
+ "WarningFilterTypes": {
4304
+ "description": "Filtering warnings.",
4305
+ "cli": {
4306
+ "helper": true
4307
+ },
4308
+ "anyOf": [
4309
+ {
4310
+ "type": "array",
4311
+ "items": {
4312
+ "description": "Rule to filter.",
4313
+ "cli": {
4314
+ "helper": true
4315
+ },
4316
+ "oneOf": [
4317
+ {
4318
+ "$ref": "#/definitions/WarningFilterItemTypes"
4319
+ }
4320
+ ]
4321
+ }
4322
+ },
4323
+ {
4324
+ "$ref": "#/definitions/WarningFilterItemTypes"
4325
+ }
4326
+ ]
4327
+ },
4193
4328
  "WasmLoading": {
4194
4329
  "description": "The method of loading WebAssembly Modules (methods included by default are 'fetch' (web/WebWorker), 'async-node' (node.js), but others might be added by plugins).",
4195
4330
  "anyOf": [