webpack 5.43.0 → 5.46.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.
Potentially problematic release.
This version of webpack might be problematic. Click here for more details.
- package/lib/Compilation.js +5 -2
- package/lib/Compiler.js +4 -4
- package/lib/ExternalModuleFactoryPlugin.js +1 -1
- package/lib/FileSystemInfo.js +14 -15
- package/lib/MultiCompiler.js +10 -8
- package/lib/NormalModule.js +8 -6
- package/lib/SourceMapDevToolPlugin.js +1 -1
- package/lib/Template.js +1 -0
- package/lib/Watching.js +12 -0
- package/lib/asset/AssetGenerator.js +28 -15
- package/lib/asset/AssetModulesPlugin.js +23 -18
- package/lib/esm/ExportWebpackRequireRuntimeModule.js +29 -0
- package/lib/esm/ModuleChunkFormatPlugin.js +91 -11
- package/lib/esm/ModuleChunkLoadingPlugin.js +13 -0
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +46 -37
- package/lib/hmr/HotModuleReplacement.runtime.js +66 -60
- package/lib/hmr/lazyCompilationBackend.js +5 -2
- package/lib/javascript/JavascriptModulesPlugin.js +3 -1
- package/lib/library/SystemLibraryPlugin.js +1 -1
- package/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js +5 -4
- package/lib/runtime/OnChunksLoadedRuntimeModule.js +5 -1
- package/lib/schemes/DataUriPlugin.js +7 -6
- package/lib/stats/DefaultStatsFactoryPlugin.js +32 -2
- package/lib/stats/DefaultStatsPresetPlugin.js +6 -2
- package/lib/stats/DefaultStatsPrinterPlugin.js +51 -9
- package/lib/util/StackedCacheMap.js +110 -0
- package/lib/webpack.js +1 -1
- package/package.json +21 -15
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +8 -0
- package/types.d.ts +20 -7
- package/lib/util/StackedSetMap.js +0 -166
@@ -4210,6 +4210,10 @@
|
|
4210
4210
|
"description": "Group modules by their type.",
|
4211
4211
|
"type": "boolean"
|
4212
4212
|
},
|
4213
|
+
"groupReasonsByOrigin": {
|
4214
|
+
"description": "Group reasons by their origin module.",
|
4215
|
+
"type": "boolean"
|
4216
|
+
},
|
4213
4217
|
"hash": {
|
4214
4218
|
"description": "Add the hash of the compilation.",
|
4215
4219
|
"type": "boolean"
|
@@ -4314,6 +4318,10 @@
|
|
4314
4318
|
"description": "Add information about the reasons why modules are included.",
|
4315
4319
|
"type": "boolean"
|
4316
4320
|
},
|
4321
|
+
"reasonsSpace": {
|
4322
|
+
"description": "Space to display reasons (groups will be collapsed to fit this space).",
|
4323
|
+
"type": "number"
|
4324
|
+
},
|
4317
4325
|
"relatedAssets": {
|
4318
4326
|
"description": "Add information about assets that are related to other assets (like SourceMaps for assets).",
|
4319
4327
|
"type": "boolean"
|
package/types.d.ts
CHANGED
@@ -80,7 +80,8 @@ import {
|
|
80
80
|
WithStatement,
|
81
81
|
YieldExpression
|
82
82
|
} from "estree";
|
83
|
-
import {
|
83
|
+
import { validate as validateFunction } from "schema-utils";
|
84
|
+
import { default as ValidationError } from "schema-utils/declarations/ValidationError";
|
84
85
|
import { ValidationErrorConfiguration } from "schema-utils/declarations/validate";
|
85
86
|
import {
|
86
87
|
AsArray,
|
@@ -1865,10 +1866,10 @@ declare class Compiler {
|
|
1865
1866
|
records: object;
|
1866
1867
|
managedPaths: Set<string>;
|
1867
1868
|
immutablePaths: Set<string>;
|
1868
|
-
modifiedFiles:
|
1869
|
-
removedFiles:
|
1870
|
-
fileTimestamps:
|
1871
|
-
contextTimestamps:
|
1869
|
+
modifiedFiles: ReadonlySet<string>;
|
1870
|
+
removedFiles: ReadonlySet<string>;
|
1871
|
+
fileTimestamps: ReadonlyMap<string, null | FileSystemInfoEntry | "ignore">;
|
1872
|
+
contextTimestamps: ReadonlyMap<string, null | FileSystemInfoEntry | "ignore">;
|
1872
1873
|
fsStartTime: number;
|
1873
1874
|
resolverFactory: ResolverFactory;
|
1874
1875
|
infrastructureLogger: any;
|
@@ -3966,10 +3967,12 @@ declare abstract class FileSystemInfo {
|
|
3966
3967
|
logStatistics(): void;
|
3967
3968
|
clear(): void;
|
3968
3969
|
addFileTimestamps(
|
3969
|
-
map:
|
3970
|
+
map: ReadonlyMap<string, null | FileSystemInfoEntry | "ignore">,
|
3971
|
+
immutable?: boolean
|
3970
3972
|
): void;
|
3971
3973
|
addContextTimestamps(
|
3972
|
-
map:
|
3974
|
+
map: ReadonlyMap<string, null | FileSystemInfoEntry | "ignore">,
|
3975
|
+
immutable?: boolean
|
3973
3976
|
): void;
|
3974
3977
|
getFileTimestamp(
|
3975
3978
|
path: string,
|
@@ -10896,6 +10899,11 @@ declare interface StatsOptions {
|
|
10896
10899
|
*/
|
10897
10900
|
groupModulesByType?: boolean;
|
10898
10901
|
|
10902
|
+
/**
|
10903
|
+
* Group reasons by their origin module.
|
10904
|
+
*/
|
10905
|
+
groupReasonsByOrigin?: boolean;
|
10906
|
+
|
10899
10907
|
/**
|
10900
10908
|
* Add the hash of the compilation.
|
10901
10909
|
*/
|
@@ -11001,6 +11009,11 @@ declare interface StatsOptions {
|
|
11001
11009
|
*/
|
11002
11010
|
reasons?: boolean;
|
11003
11011
|
|
11012
|
+
/**
|
11013
|
+
* Space to display reasons (groups will be collapsed to fit this space).
|
11014
|
+
*/
|
11015
|
+
reasonsSpace?: number;
|
11016
|
+
|
11004
11017
|
/**
|
11005
11018
|
* Add information about assets that are related to other assets (like SourceMaps for assets).
|
11006
11019
|
*/
|
@@ -1,166 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
-
Author Tobias Koppers @sokra
|
4
|
-
*/
|
5
|
-
|
6
|
-
"use strict";
|
7
|
-
|
8
|
-
const TOMBSTONE = Symbol("tombstone");
|
9
|
-
const UNDEFINED_MARKER = Symbol("undefined");
|
10
|
-
|
11
|
-
/**
|
12
|
-
* @template T
|
13
|
-
* @typedef {T | undefined} Cell<T>
|
14
|
-
*/
|
15
|
-
|
16
|
-
/**
|
17
|
-
* @template T
|
18
|
-
* @typedef {T | typeof TOMBSTONE | typeof UNDEFINED_MARKER} InternalCell<T>
|
19
|
-
*/
|
20
|
-
|
21
|
-
/**
|
22
|
-
* @template K
|
23
|
-
* @template V
|
24
|
-
* @param {[K, InternalCell<V>]} pair the internal cell
|
25
|
-
* @returns {[K, Cell<V>]} its “safe” representation
|
26
|
-
*/
|
27
|
-
const extractPair = pair => {
|
28
|
-
const key = pair[0];
|
29
|
-
const val = pair[1];
|
30
|
-
if (val === UNDEFINED_MARKER || val === TOMBSTONE) {
|
31
|
-
return [key, undefined];
|
32
|
-
} else {
|
33
|
-
return /** @type {[K, Cell<V>]} */ (pair);
|
34
|
-
}
|
35
|
-
};
|
36
|
-
|
37
|
-
/**
|
38
|
-
* @template K
|
39
|
-
* @template V
|
40
|
-
*/
|
41
|
-
class StackedMap {
|
42
|
-
/**
|
43
|
-
* @param {Map<K, InternalCell<V>>[]=} parentStack an optional parent
|
44
|
-
*/
|
45
|
-
constructor(parentStack) {
|
46
|
-
/** @type {Map<K, InternalCell<V>>} */
|
47
|
-
this.map = new Map();
|
48
|
-
/** @type {Map<K, InternalCell<V>>[]} */
|
49
|
-
this.stack = parentStack === undefined ? [] : parentStack.slice();
|
50
|
-
this.stack.push(this.map);
|
51
|
-
}
|
52
|
-
|
53
|
-
/**
|
54
|
-
* @param {K} item the key of the element to add
|
55
|
-
* @param {V} value the value of the element to add
|
56
|
-
* @returns {void}
|
57
|
-
*/
|
58
|
-
set(item, value) {
|
59
|
-
this.map.set(item, value === undefined ? UNDEFINED_MARKER : value);
|
60
|
-
}
|
61
|
-
|
62
|
-
/**
|
63
|
-
* @param {K} item the item to delete
|
64
|
-
* @returns {void}
|
65
|
-
*/
|
66
|
-
delete(item) {
|
67
|
-
if (this.stack.length > 1) {
|
68
|
-
this.map.set(item, TOMBSTONE);
|
69
|
-
} else {
|
70
|
-
this.map.delete(item);
|
71
|
-
}
|
72
|
-
}
|
73
|
-
|
74
|
-
/**
|
75
|
-
* @param {K} item the item to test
|
76
|
-
* @returns {boolean} true if the item exists in this set
|
77
|
-
*/
|
78
|
-
has(item) {
|
79
|
-
const topValue = this.map.get(item);
|
80
|
-
if (topValue !== undefined) {
|
81
|
-
return topValue !== TOMBSTONE;
|
82
|
-
}
|
83
|
-
if (this.stack.length > 1) {
|
84
|
-
for (let i = this.stack.length - 2; i >= 0; i--) {
|
85
|
-
const value = this.stack[i].get(item);
|
86
|
-
if (value !== undefined) {
|
87
|
-
this.map.set(item, value);
|
88
|
-
return value !== TOMBSTONE;
|
89
|
-
}
|
90
|
-
}
|
91
|
-
this.map.set(item, TOMBSTONE);
|
92
|
-
}
|
93
|
-
return false;
|
94
|
-
}
|
95
|
-
|
96
|
-
/**
|
97
|
-
* @param {K} item the key of the element to return
|
98
|
-
* @returns {Cell<V>} the value of the element
|
99
|
-
*/
|
100
|
-
get(item) {
|
101
|
-
const topValue = this.map.get(item);
|
102
|
-
if (topValue !== undefined) {
|
103
|
-
return topValue === TOMBSTONE || topValue === UNDEFINED_MARKER
|
104
|
-
? undefined
|
105
|
-
: topValue;
|
106
|
-
}
|
107
|
-
if (this.stack.length > 1) {
|
108
|
-
for (let i = this.stack.length - 2; i >= 0; i--) {
|
109
|
-
const value = this.stack[i].get(item);
|
110
|
-
if (value !== undefined) {
|
111
|
-
this.map.set(item, value);
|
112
|
-
return value === TOMBSTONE || value === UNDEFINED_MARKER
|
113
|
-
? undefined
|
114
|
-
: value;
|
115
|
-
}
|
116
|
-
}
|
117
|
-
this.map.set(item, TOMBSTONE);
|
118
|
-
}
|
119
|
-
return undefined;
|
120
|
-
}
|
121
|
-
|
122
|
-
_compress() {
|
123
|
-
if (this.stack.length === 1) return;
|
124
|
-
this.map = new Map();
|
125
|
-
for (const data of this.stack) {
|
126
|
-
for (const pair of data) {
|
127
|
-
if (pair[1] === TOMBSTONE) {
|
128
|
-
this.map.delete(pair[0]);
|
129
|
-
} else {
|
130
|
-
this.map.set(pair[0], pair[1]);
|
131
|
-
}
|
132
|
-
}
|
133
|
-
}
|
134
|
-
this.stack = [this.map];
|
135
|
-
}
|
136
|
-
|
137
|
-
asArray() {
|
138
|
-
this._compress();
|
139
|
-
return Array.from(this.map.keys());
|
140
|
-
}
|
141
|
-
|
142
|
-
asSet() {
|
143
|
-
this._compress();
|
144
|
-
return new Set(this.map.keys());
|
145
|
-
}
|
146
|
-
|
147
|
-
asPairArray() {
|
148
|
-
this._compress();
|
149
|
-
return Array.from(this.map.entries(), extractPair);
|
150
|
-
}
|
151
|
-
|
152
|
-
asMap() {
|
153
|
-
return new Map(this.asPairArray());
|
154
|
-
}
|
155
|
-
|
156
|
-
get size() {
|
157
|
-
this._compress();
|
158
|
-
return this.map.size;
|
159
|
-
}
|
160
|
-
|
161
|
-
createChild() {
|
162
|
-
return new StackedMap(this.stack);
|
163
|
-
}
|
164
|
-
}
|
165
|
-
|
166
|
-
module.exports = StackedMap;
|