webpack 5.91.0 → 5.92.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/bin/webpack.js +1 -2
- package/lib/APIPlugin.js +6 -2
- package/lib/Cache.js +1 -1
- package/lib/Chunk.js +7 -4
- package/lib/ChunkGraph.js +20 -7
- package/lib/ChunkGroup.js +9 -3
- package/lib/CleanPlugin.js +1 -1
- package/lib/Compilation.js +33 -27
- package/lib/Compiler.js +28 -8
- package/lib/ConcatenationScope.js +3 -3
- package/lib/ContextModule.js +95 -43
- package/lib/DefinePlugin.js +14 -4
- package/lib/Dependency.js +8 -8
- package/lib/DependencyTemplate.js +10 -5
- package/lib/DllReferencePlugin.js +1 -1
- package/lib/EvalDevToolModulePlugin.js +11 -0
- package/lib/ExportsInfo.js +22 -4
- package/lib/ExternalModule.js +49 -18
- package/lib/FileSystemInfo.js +68 -41
- package/lib/FlagDependencyExportsPlugin.js +21 -7
- package/lib/Generator.js +2 -3
- package/lib/HotModuleReplacementPlugin.js +108 -45
- package/lib/IgnorePlugin.js +4 -1
- package/lib/LibManifestPlugin.js +2 -2
- package/lib/Module.js +11 -12
- package/lib/ModuleFactory.js +3 -3
- package/lib/ModuleFilenameHelpers.js +29 -16
- package/lib/ModuleGraph.js +5 -5
- package/lib/MultiCompiler.js +36 -1
- package/lib/NormalModule.js +10 -12
- package/lib/NormalModuleFactory.js +17 -8
- package/lib/Parser.js +1 -1
- package/lib/PlatformPlugin.js +39 -0
- package/lib/ProgressPlugin.js +1 -1
- package/lib/RecordIdsPlugin.js +4 -4
- package/lib/ResolverFactory.js +3 -3
- package/lib/RuntimeTemplate.js +22 -18
- package/lib/Stats.js +1 -1
- package/lib/Template.js +5 -5
- package/lib/TemplatedPathPlugin.js +16 -1
- package/lib/asset/AssetGenerator.js +15 -0
- package/lib/buildChunkGraph.js +3 -3
- package/lib/cache/MemoryWithGcCachePlugin.js +1 -1
- package/lib/cache/PackFileCacheStrategy.js +2 -2
- package/lib/cache/ResolverCachePlugin.js +8 -8
- package/lib/cache/getLazyHashedEtag.js +1 -1
- package/lib/cli.js +5 -5
- package/lib/config/browserslistTargetHandler.js +7 -1
- package/lib/config/defaults.js +85 -34
- package/lib/config/target.js +18 -11
- package/lib/container/ContainerEntryModule.js +1 -1
- package/lib/css/CssExportsGenerator.js +43 -17
- package/lib/css/CssGenerator.js +22 -12
- package/lib/css/CssLoadingRuntimeModule.js +8 -5
- package/lib/css/CssModulesPlugin.js +197 -100
- package/lib/css/CssParser.js +24 -15
- package/lib/css/walkCssTokens.js +1 -1
- package/lib/debug/ProfilingPlugin.js +1 -1
- package/lib/dependencies/ContextElementDependency.js +2 -2
- package/lib/dependencies/CssExportDependency.js +2 -2
- package/lib/dependencies/CssLocalIdentifierDependency.js +9 -2
- package/lib/dependencies/CssUrlDependency.js +5 -4
- package/lib/dependencies/ExportsInfoDependency.js +1 -1
- package/lib/dependencies/ExternalModuleDependency.js +4 -2
- package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +2 -2
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +2 -2
- package/lib/dependencies/HarmonyImportDependency.js +2 -2
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +41 -18
- package/lib/dependencies/HarmonyImportSideEffectDependency.js +2 -2
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +43 -32
- package/lib/dependencies/ImportDependency.js +2 -2
- package/lib/dependencies/ImportEagerDependency.js +2 -2
- package/lib/dependencies/ImportMetaPlugin.js +1 -1
- package/lib/dependencies/ImportParserPlugin.js +3 -1
- package/lib/dependencies/ImportWeakDependency.js +2 -2
- package/lib/dependencies/LoaderPlugin.js +2 -2
- package/lib/dependencies/ModuleDependency.js +2 -2
- package/lib/dependencies/PureExpressionDependency.js +63 -49
- package/lib/dependencies/WorkerDependency.js +1 -1
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +90 -2
- package/lib/hmr/LazyCompilationPlugin.js +2 -2
- package/lib/ids/ChunkModuleIdRangePlugin.js +1 -1
- package/lib/ids/DeterministicChunkIdsPlugin.js +1 -1
- package/lib/ids/DeterministicModuleIdsPlugin.js +1 -1
- package/lib/ids/IdHelpers.js +6 -6
- package/lib/ids/NamedChunkIdsPlugin.js +1 -1
- package/lib/ids/NamedModuleIdsPlugin.js +1 -1
- package/lib/ids/SyncModuleIdsPlugin.js +2 -2
- package/lib/index.js +11 -0
- package/lib/javascript/CommonJsChunkFormatPlugin.js +1 -1
- package/lib/javascript/JavascriptGenerator.js +0 -1
- package/lib/javascript/JavascriptModulesPlugin.js +174 -17
- package/lib/javascript/JavascriptParser.js +37 -16
- package/lib/library/AbstractLibraryPlugin.js +2 -2
- package/lib/library/AmdLibraryPlugin.js +2 -2
- package/lib/library/AssignLibraryPlugin.js +3 -3
- package/lib/library/ExportPropertyLibraryPlugin.js +2 -2
- package/lib/library/JsonpLibraryPlugin.js +2 -2
- package/lib/library/ModuleLibraryPlugin.js +2 -2
- package/lib/library/SystemLibraryPlugin.js +2 -2
- package/lib/library/UmdLibraryPlugin.js +33 -12
- package/lib/logging/createConsoleLogger.js +2 -2
- package/lib/node/CommonJsChunkLoadingPlugin.js +2 -1
- package/lib/node/NodeEnvironmentPlugin.js +1 -1
- package/lib/node/NodeTemplatePlugin.js +1 -1
- package/lib/node/ReadFileCompileWasmPlugin.js +1 -1
- package/lib/node/nodeConsole.js +1 -1
- package/lib/optimize/AggressiveMergingPlugin.js +1 -1
- package/lib/optimize/ConcatenatedModule.js +11 -76
- package/lib/optimize/InnerGraph.js +1 -1
- package/lib/optimize/LimitChunkCountPlugin.js +1 -2
- package/lib/optimize/ModuleConcatenationPlugin.js +1 -1
- package/lib/optimize/RealContentHashPlugin.js +3 -3
- package/lib/optimize/SideEffectsFlagPlugin.js +2 -2
- package/lib/optimize/SplitChunksPlugin.js +8 -8
- package/lib/performance/SizeLimitsPlugin.js +2 -2
- package/lib/rules/ObjectMatcherRulePlugin.js +11 -1
- package/lib/rules/RuleSetCompiler.js +9 -7
- package/lib/runtime/LoadScriptRuntimeModule.js +1 -1
- package/lib/runtime/StartupChunkDependenciesPlugin.js +1 -1
- package/lib/schemes/HttpUriPlugin.js +1 -1
- package/lib/serialization/BinaryMiddleware.js +4 -4
- package/lib/serialization/FileMiddleware.js +3 -3
- package/lib/serialization/NullPrototypeObjectSerializer.js +2 -2
- package/lib/serialization/ObjectMiddleware.js +6 -5
- package/lib/serialization/PlainObjectSerializer.js +2 -2
- package/lib/serialization/SerializerMiddleware.js +2 -2
- package/lib/serialization/SingleItemMiddleware.js +2 -2
- package/lib/serialization/types.js +1 -1
- package/lib/sharing/ConsumeSharedModule.js +1 -1
- package/lib/sharing/ProvideSharedPlugin.js +1 -1
- package/lib/sharing/resolveMatchedConfigs.js +1 -1
- package/lib/stats/DefaultStatsFactoryPlugin.js +20 -20
- package/lib/stats/DefaultStatsPrinterPlugin.js +1 -1
- package/lib/stats/StatsFactory.js +2 -2
- package/lib/stats/StatsPrinter.js +6 -6
- package/lib/util/ArrayQueue.js +14 -21
- package/lib/util/AsyncQueue.js +1 -1
- package/lib/util/Queue.js +8 -2
- package/lib/util/SortableSet.js +16 -4
- package/lib/util/TupleQueue.js +8 -2
- package/lib/util/WeakTupleMap.js +3 -3
- package/lib/util/binarySearchBounds.js +1 -1
- package/lib/util/cleverMerge.js +2 -2
- package/lib/util/comparators.js +4 -2
- package/lib/util/conventions.js +1 -1
- package/lib/util/createHash.js +3 -5
- package/lib/util/deprecation.js +3 -3
- package/lib/util/deterministicGrouping.js +2 -2
- package/lib/util/findGraphRoots.js +1 -1
- package/lib/util/fs.js +15 -15
- package/lib/util/identifier.js +5 -5
- package/lib/util/mergeScope.js +79 -0
- package/lib/util/runtime.js +2 -17
- package/lib/util/semver.js +3 -0
- package/lib/util/smartGrouping.js +3 -3
- package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +4 -2
- package/lib/wasm-async/AsyncWebAssemblyGenerator.js +1 -1
- package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +3 -3
- package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +1 -1
- package/lib/wasm-sync/WebAssemblyGenerator.js +17 -17
- package/lib/wasm-sync/WebAssemblyModulesPlugin.js +1 -1
- package/lib/wasm-sync/WebAssemblyUtils.js +2 -1
- package/lib/web/FetchCompileWasmPlugin.js +1 -1
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +1 -1
- package/lib/webpack.js +12 -3
- package/package.json +20 -18
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +30 -2
- package/schemas/plugins/css/CssAutoGeneratorOptions.check.js +1 -1
- package/schemas/plugins/css/CssGeneratorOptions.check.js +1 -1
- package/schemas/plugins/css/CssGlobalGeneratorOptions.check.js +1 -1
- package/schemas/plugins/css/CssModuleGeneratorOptions.check.js +1 -1
- package/types.d.ts +213 -81
@@ -24,7 +24,7 @@ const validate = createSchemaValidation(
|
|
24
24
|
);
|
25
25
|
|
26
26
|
/**
|
27
|
-
* @typedef {
|
27
|
+
* @typedef {object} ChunkCombination
|
28
28
|
* @property {boolean} deleted this is set to true when combination was removed
|
29
29
|
* @property {number} sizeDiff
|
30
30
|
* @property {number} integratedSize
|
@@ -159,7 +159,6 @@ class LimitChunkCountPlugin {
|
|
159
159
|
const modifiedChunks = new Set();
|
160
160
|
|
161
161
|
let changed = false;
|
162
|
-
// eslint-disable-next-line no-constant-condition
|
163
162
|
loop: while (true) {
|
164
163
|
const combination = combinations.popFirst();
|
165
164
|
if (combination === undefined) break;
|
@@ -28,7 +28,7 @@ const ConcatenatedModule = require("./ConcatenatedModule");
|
|
28
28
|
/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
|
29
29
|
|
30
30
|
/**
|
31
|
-
* @typedef {
|
31
|
+
* @typedef {object} Statistics
|
32
32
|
* @property {number} cached
|
33
33
|
* @property {number} alreadyInConfig
|
34
34
|
* @property {number} invalidModule
|
@@ -87,7 +87,7 @@ const toCachedSource = source => {
|
|
87
87
|
/** @typedef {Set<string>} Hashes */
|
88
88
|
|
89
89
|
/**
|
90
|
-
* @typedef {
|
90
|
+
* @typedef {object} AssetInfoForRealContentHash
|
91
91
|
* @property {string} name
|
92
92
|
* @property {AssetInfo} info
|
93
93
|
* @property {Source} source
|
@@ -102,7 +102,7 @@ const toCachedSource = source => {
|
|
102
102
|
*/
|
103
103
|
|
104
104
|
/**
|
105
|
-
* @typedef {
|
105
|
+
* @typedef {object} CompilationHooks
|
106
106
|
* @property {SyncBailHook<[Buffer[], string], string>} updateHash
|
107
107
|
*/
|
108
108
|
|
@@ -131,7 +131,7 @@ class RealContentHashPlugin {
|
|
131
131
|
}
|
132
132
|
|
133
133
|
/**
|
134
|
-
* @param {
|
134
|
+
* @param {object} options options object
|
135
135
|
* @param {string | Hash} options.hashFunction the hash function to use
|
136
136
|
* @param {string} options.hashDigest the hash digest to use
|
137
137
|
*/
|
@@ -27,14 +27,14 @@ const formatLocation = require("../formatLocation");
|
|
27
27
|
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
28
28
|
|
29
29
|
/**
|
30
|
-
* @typedef {
|
30
|
+
* @typedef {object} ExportInModule
|
31
31
|
* @property {Module} module the module
|
32
32
|
* @property {string} exportName the name of the export
|
33
33
|
* @property {boolean} checked if the export is conditional
|
34
34
|
*/
|
35
35
|
|
36
36
|
/**
|
37
|
-
* @typedef {
|
37
|
+
* @typedef {object} ReexportInfo
|
38
38
|
* @property {Map<string, ExportInModule[]>} static
|
39
39
|
* @property {Map<Module, Set<string>>} dynamic
|
40
40
|
*/
|
@@ -52,7 +52,7 @@ const MinMaxSizeWarning = require("./MinMaxSizeWarning");
|
|
52
52
|
*/
|
53
53
|
|
54
54
|
/**
|
55
|
-
* @typedef {
|
55
|
+
* @typedef {object} CacheGroupSource
|
56
56
|
* @property {string=} key
|
57
57
|
* @property {number=} priority
|
58
58
|
* @property {GetName=} getName
|
@@ -75,7 +75,7 @@ const MinMaxSizeWarning = require("./MinMaxSizeWarning");
|
|
75
75
|
*/
|
76
76
|
|
77
77
|
/**
|
78
|
-
* @typedef {
|
78
|
+
* @typedef {object} CacheGroup
|
79
79
|
* @property {string} key
|
80
80
|
* @property {number=} priority
|
81
81
|
* @property {GetName=} getName
|
@@ -101,7 +101,7 @@ const MinMaxSizeWarning = require("./MinMaxSizeWarning");
|
|
101
101
|
*/
|
102
102
|
|
103
103
|
/**
|
104
|
-
* @typedef {
|
104
|
+
* @typedef {object} FallbackCacheGroup
|
105
105
|
* @property {ChunkFilterFunction} chunksFilter
|
106
106
|
* @property {SplitChunksSizes} minSize
|
107
107
|
* @property {SplitChunksSizes} maxAsyncSize
|
@@ -110,7 +110,7 @@ const MinMaxSizeWarning = require("./MinMaxSizeWarning");
|
|
110
110
|
*/
|
111
111
|
|
112
112
|
/**
|
113
|
-
* @typedef {
|
113
|
+
* @typedef {object} CacheGroupsContext
|
114
114
|
* @property {ModuleGraph} moduleGraph
|
115
115
|
* @property {ChunkGraph} chunkGraph
|
116
116
|
*/
|
@@ -131,7 +131,7 @@ const MinMaxSizeWarning = require("./MinMaxSizeWarning");
|
|
131
131
|
*/
|
132
132
|
|
133
133
|
/**
|
134
|
-
* @typedef {
|
134
|
+
* @typedef {object} SplitChunksOptions
|
135
135
|
* @property {ChunkFilterFunction} chunksFilter
|
136
136
|
* @property {string[]} defaultSizeTypes
|
137
137
|
* @property {SplitChunksSizes} minSize
|
@@ -153,7 +153,7 @@ const MinMaxSizeWarning = require("./MinMaxSizeWarning");
|
|
153
153
|
*/
|
154
154
|
|
155
155
|
/**
|
156
|
-
* @typedef {
|
156
|
+
* @typedef {object} ChunksInfoItem
|
157
157
|
* @property {SortableSet<Module>} modules
|
158
158
|
* @property {CacheGroup} cacheGroup
|
159
159
|
* @property {number} cacheGroupIndex
|
@@ -1023,7 +1023,7 @@ module.exports = class SplitChunksPlugin {
|
|
1023
1023
|
getExportsCombinationsFactory()(key);
|
1024
1024
|
|
1025
1025
|
/**
|
1026
|
-
* @typedef {
|
1026
|
+
* @typedef {object} SelectedChunksResult
|
1027
1027
|
* @property {Chunk[]} chunks the list of chunks
|
1028
1028
|
* @property {bigint | Chunk} key a key of the list
|
1029
1029
|
*/
|
@@ -1322,7 +1322,7 @@ module.exports = class SplitChunksPlugin {
|
|
1322
1322
|
}
|
1323
1323
|
|
1324
1324
|
/**
|
1325
|
-
* @typedef {
|
1325
|
+
* @typedef {object} MaxSizeQueueItem
|
1326
1326
|
* @property {SplitChunksSizes} minSize
|
1327
1327
|
* @property {SplitChunksSizes} maxAsyncSize
|
1328
1328
|
* @property {SplitChunksSizes} maxInitialSize
|
@@ -19,13 +19,13 @@ const NoAsyncChunksWarning = require("./NoAsyncChunksWarning");
|
|
19
19
|
/** @typedef {import("../WebpackError")} WebpackError */
|
20
20
|
|
21
21
|
/**
|
22
|
-
* @typedef {
|
22
|
+
* @typedef {object} AssetDetails
|
23
23
|
* @property {string} name
|
24
24
|
* @property {number} size
|
25
25
|
*/
|
26
26
|
|
27
27
|
/**
|
28
|
-
* @typedef {
|
28
|
+
* @typedef {object} EntrypointDetails
|
29
29
|
* @property {string} name
|
30
30
|
* @property {number} size
|
31
31
|
* @property {string[]} files
|
@@ -7,15 +7,18 @@
|
|
7
7
|
|
8
8
|
/** @typedef {import("./RuleSetCompiler")} RuleSetCompiler */
|
9
9
|
/** @typedef {import("./RuleSetCompiler").RuleCondition} RuleCondition */
|
10
|
+
/** @typedef {import("./RuleSetCompiler").RuleConditionFunction} RuleConditionFunction */
|
10
11
|
|
11
12
|
class ObjectMatcherRulePlugin {
|
12
13
|
/**
|
13
14
|
* @param {string} ruleProperty the rule property
|
14
15
|
* @param {string=} dataProperty the data property
|
16
|
+
* @param {RuleConditionFunction=} additionalConditionFunction need to check
|
15
17
|
*/
|
16
|
-
constructor(ruleProperty, dataProperty) {
|
18
|
+
constructor(ruleProperty, dataProperty, additionalConditionFunction) {
|
17
19
|
this.ruleProperty = ruleProperty;
|
18
20
|
this.dataProperty = dataProperty || ruleProperty;
|
21
|
+
this.additionalConditionFunction = additionalConditionFunction;
|
19
22
|
}
|
20
23
|
|
21
24
|
/**
|
@@ -36,6 +39,13 @@ class ObjectMatcherRulePlugin {
|
|
36
39
|
`${path}.${ruleProperty}.${property}`,
|
37
40
|
value[property]
|
38
41
|
);
|
42
|
+
if (this.additionalConditionFunction) {
|
43
|
+
result.conditions.push({
|
44
|
+
property: [dataProperty],
|
45
|
+
matchWhenEmpty: condition.matchWhenEmpty,
|
46
|
+
fn: this.additionalConditionFunction
|
47
|
+
});
|
48
|
+
}
|
39
49
|
result.conditions.push({
|
40
50
|
property: [dataProperty, ...nestedDataProperties],
|
41
51
|
matchWhenEmpty: condition.matchWhenEmpty,
|
@@ -7,21 +7,23 @@
|
|
7
7
|
|
8
8
|
const { SyncHook } = require("tapable");
|
9
9
|
|
10
|
+
/** @typedef {function(string): boolean} RuleConditionFunction */
|
11
|
+
|
10
12
|
/**
|
11
|
-
* @typedef {
|
13
|
+
* @typedef {object} RuleCondition
|
12
14
|
* @property {string | string[]} property
|
13
15
|
* @property {boolean} matchWhenEmpty
|
14
|
-
* @property {
|
16
|
+
* @property {RuleConditionFunction} fn
|
15
17
|
*/
|
16
18
|
|
17
19
|
/**
|
18
|
-
* @typedef {
|
20
|
+
* @typedef {object} Condition
|
19
21
|
* @property {boolean} matchWhenEmpty
|
20
|
-
* @property {
|
22
|
+
* @property {RuleConditionFunction} fn
|
21
23
|
*/
|
22
24
|
|
23
25
|
/**
|
24
|
-
* @typedef {
|
26
|
+
* @typedef {object} CompiledRule
|
25
27
|
* @property {RuleCondition[]} conditions
|
26
28
|
* @property {(Effect|function(object): Effect[])[]} effects
|
27
29
|
* @property {CompiledRule[]=} rules
|
@@ -29,13 +31,13 @@ const { SyncHook } = require("tapable");
|
|
29
31
|
*/
|
30
32
|
|
31
33
|
/**
|
32
|
-
* @typedef {
|
34
|
+
* @typedef {object} Effect
|
33
35
|
* @property {string} type
|
34
36
|
* @property {any} value
|
35
37
|
*/
|
36
38
|
|
37
39
|
/**
|
38
|
-
* @typedef {
|
40
|
+
* @typedef {object} RuleSet
|
39
41
|
* @property {Map<string, any>} references map of references in the rule set (may grow over time)
|
40
42
|
* @property {function(object): Effect[]} exec execute the rule set
|
41
43
|
*/
|
@@ -14,7 +14,7 @@ const HelperRuntimeModule = require("./HelperRuntimeModule");
|
|
14
14
|
/** @typedef {import("../Compiler")} Compiler */
|
15
15
|
|
16
16
|
/**
|
17
|
-
* @typedef {
|
17
|
+
* @typedef {object} LoadScriptCompilationHooks
|
18
18
|
* @property {SyncWaterfallHook<[string, Chunk]>} createScript
|
19
19
|
*/
|
20
20
|
|
@@ -13,7 +13,7 @@ const StartupEntrypointRuntimeModule = require("./StartupEntrypointRuntimeModule
|
|
13
13
|
/** @typedef {import("../Compiler")} Compiler */
|
14
14
|
|
15
15
|
/**
|
16
|
-
* @typedef {
|
16
|
+
* @typedef {object} Options
|
17
17
|
* @property {ChunkLoadingType} chunkLoading
|
18
18
|
* @property {boolean=} asyncChunkLoading
|
19
19
|
*/
|
@@ -151,7 +151,7 @@ const parseCacheControl = (cacheControl, requestTime) => {
|
|
151
151
|
};
|
152
152
|
|
153
153
|
/**
|
154
|
-
* @typedef {
|
154
|
+
* @typedef {object} LockfileEntry
|
155
155
|
* @property {string} resolved
|
156
156
|
* @property {string} integrity
|
157
157
|
* @property {string} contentType
|
@@ -143,7 +143,7 @@ const identifyBigInt = n => {
|
|
143
143
|
class BinaryMiddleware extends SerializerMiddleware {
|
144
144
|
/**
|
145
145
|
* @param {DeserializedType} data data
|
146
|
-
* @param {
|
146
|
+
* @param {object} context context object
|
147
147
|
* @returns {SerializedType|Promise<SerializedType>} serialized data
|
148
148
|
*/
|
149
149
|
serialize(data, context) {
|
@@ -158,7 +158,7 @@ class BinaryMiddleware extends SerializerMiddleware {
|
|
158
158
|
|
159
159
|
/**
|
160
160
|
* @param {DeserializedType} data data
|
161
|
-
* @param {
|
161
|
+
* @param {object} context context object
|
162
162
|
* @param {{ leftOverBuffer: Buffer | null, allocationSize: number, increaseCounter: number }} allocationScope allocation scope
|
163
163
|
* @returns {SerializedType} serialized data
|
164
164
|
*/
|
@@ -629,7 +629,7 @@ class BinaryMiddleware extends SerializerMiddleware {
|
|
629
629
|
|
630
630
|
/**
|
631
631
|
* @param {SerializedType} data data
|
632
|
-
* @param {
|
632
|
+
* @param {object} context context object
|
633
633
|
* @returns {DeserializedType|Promise<DeserializedType>} deserialized data
|
634
634
|
*/
|
635
635
|
deserialize(data, context) {
|
@@ -653,7 +653,7 @@ class BinaryMiddleware extends SerializerMiddleware {
|
|
653
653
|
|
654
654
|
/**
|
655
655
|
* @param {SerializedType} data data
|
656
|
-
* @param {
|
656
|
+
* @param {object} context context object
|
657
657
|
* @returns {DeserializedType} deserialized data
|
658
658
|
*/
|
659
659
|
_deserialize(data, context) {
|
@@ -79,7 +79,7 @@ const readUInt64LE = Buffer.prototype.readBigUInt64LE
|
|
79
79
|
};
|
80
80
|
|
81
81
|
/**
|
82
|
-
* @typedef {
|
82
|
+
* @typedef {object} SerializeResult
|
83
83
|
* @property {string | false} name
|
84
84
|
* @property {number} size
|
85
85
|
* @property {Promise=} backgroundJob
|
@@ -427,7 +427,7 @@ class FileMiddleware extends SerializerMiddleware {
|
|
427
427
|
}
|
428
428
|
/**
|
429
429
|
* @param {DeserializedType} data data
|
430
|
-
* @param {
|
430
|
+
* @param {object} context context object
|
431
431
|
* @returns {SerializedType|Promise<SerializedType>} serialized data
|
432
432
|
*/
|
433
433
|
serialize(data, context) {
|
@@ -555,7 +555,7 @@ class FileMiddleware extends SerializerMiddleware {
|
|
555
555
|
|
556
556
|
/**
|
557
557
|
* @param {SerializedType} data data
|
558
|
-
* @param {
|
558
|
+
* @param {object} context context object
|
559
559
|
* @returns {DeserializedType|Promise<DeserializedType>} deserialized data
|
560
560
|
*/
|
561
561
|
deserialize(data, context) {
|
@@ -9,7 +9,7 @@
|
|
9
9
|
|
10
10
|
class NullPrototypeObjectSerializer {
|
11
11
|
/**
|
12
|
-
* @template {
|
12
|
+
* @template {object} T
|
13
13
|
* @param {T} obj null object
|
14
14
|
* @param {ObjectSerializerContext} context context
|
15
15
|
*/
|
@@ -25,7 +25,7 @@ class NullPrototypeObjectSerializer {
|
|
25
25
|
}
|
26
26
|
}
|
27
27
|
/**
|
28
|
-
* @template {
|
28
|
+
* @template {object} T
|
29
29
|
* @param {ObjectDeserializerContext} context context
|
30
30
|
* @returns {T} null object
|
31
31
|
*/
|
@@ -44,7 +44,7 @@ Technically any value can be used.
|
|
44
44
|
*/
|
45
45
|
|
46
46
|
/**
|
47
|
-
* @typedef {
|
47
|
+
* @typedef {object} ObjectSerializerContext
|
48
48
|
* @property {function(any): void} write
|
49
49
|
* @property {(function(any): void)=} writeLazy
|
50
50
|
* @property {(function(any, object=): (() => Promise<any> | any))=} writeSeparate
|
@@ -52,13 +52,13 @@ Technically any value can be used.
|
|
52
52
|
*/
|
53
53
|
|
54
54
|
/**
|
55
|
-
* @typedef {
|
55
|
+
* @typedef {object} ObjectDeserializerContext
|
56
56
|
* @property {function(): any} read
|
57
57
|
* @property {function(any): void} setCircularReference
|
58
58
|
*/
|
59
59
|
|
60
60
|
/**
|
61
|
-
* @typedef {
|
61
|
+
* @typedef {object} ObjectSerializer
|
62
62
|
* @property {function(any, ObjectSerializerContext): void} serialize
|
63
63
|
* @property {function(ObjectDeserializerContext): any} deserialize
|
64
64
|
*/
|
@@ -138,6 +138,7 @@ jsTypes.set(TypeError, new ErrorObjectSerializer(TypeError));
|
|
138
138
|
// real Object and Array types to. These types may occur in the wild too, e. g. when
|
139
139
|
// using Structured Clone in postMessage.
|
140
140
|
if (exports.constructor !== Object) {
|
141
|
+
// eslint-disable-next-line jsdoc/check-types
|
141
142
|
const Obj = /** @type {typeof Object} */ (exports.constructor);
|
142
143
|
const Fn = /** @type {typeof Function} */ (Obj.constructor);
|
143
144
|
for (const [type, config] of Array.from(jsTypes)) {
|
@@ -289,7 +290,7 @@ class ObjectMiddleware extends SerializerMiddleware {
|
|
289
290
|
|
290
291
|
/**
|
291
292
|
* @param {DeserializedType} data data
|
292
|
-
* @param {
|
293
|
+
* @param {object} context context object
|
293
294
|
* @returns {SerializedType|Promise<SerializedType>} serialized data
|
294
295
|
*/
|
295
296
|
serialize(data, context) {
|
@@ -593,7 +594,7 @@ class ObjectMiddleware extends SerializerMiddleware {
|
|
593
594
|
|
594
595
|
/**
|
595
596
|
* @param {SerializedType} data data
|
596
|
-
* @param {
|
597
|
+
* @param {object} context context object
|
597
598
|
* @returns {DeserializedType|Promise<DeserializedType>} deserialized data
|
598
599
|
*/
|
599
600
|
deserialize(data, context) {
|
@@ -45,7 +45,7 @@ const getCachedKeys = (keys, cacheAssoc) => {
|
|
45
45
|
|
46
46
|
class PlainObjectSerializer {
|
47
47
|
/**
|
48
|
-
* @param {
|
48
|
+
* @param {object} obj plain object
|
49
49
|
* @param {ObjectSerializerContext} context context
|
50
50
|
*/
|
51
51
|
serialize(obj, context) {
|
@@ -72,7 +72,7 @@ class PlainObjectSerializer {
|
|
72
72
|
}
|
73
73
|
/**
|
74
74
|
* @param {ObjectDeserializerContext} context context
|
75
|
-
* @returns {
|
75
|
+
* @returns {object} plain object
|
76
76
|
*/
|
77
77
|
deserialize(context) {
|
78
78
|
const keys = context.read();
|
@@ -18,7 +18,7 @@ class SerializerMiddleware {
|
|
18
18
|
/**
|
19
19
|
* @abstract
|
20
20
|
* @param {DeserializedType} data data
|
21
|
-
* @param {
|
21
|
+
* @param {object} context context object
|
22
22
|
* @returns {SerializedType|Promise<SerializedType>} serialized data
|
23
23
|
*/
|
24
24
|
serialize(data, context) {
|
@@ -30,7 +30,7 @@ class SerializerMiddleware {
|
|
30
30
|
/**
|
31
31
|
* @abstract
|
32
32
|
* @param {SerializedType} data data
|
33
|
-
* @param {
|
33
|
+
* @param {object} context context object
|
34
34
|
* @returns {DeserializedType|Promise<DeserializedType>} deserialized data
|
35
35
|
*/
|
36
36
|
deserialize(data, context) {
|
@@ -14,7 +14,7 @@ const SerializerMiddleware = require("./SerializerMiddleware");
|
|
14
14
|
class SingleItemMiddleware extends SerializerMiddleware {
|
15
15
|
/**
|
16
16
|
* @param {DeserializedType} data data
|
17
|
-
* @param {
|
17
|
+
* @param {object} context context object
|
18
18
|
* @returns {SerializedType|Promise<SerializedType>} serialized data
|
19
19
|
*/
|
20
20
|
serialize(data, context) {
|
@@ -23,7 +23,7 @@ class SingleItemMiddleware extends SerializerMiddleware {
|
|
23
23
|
|
24
24
|
/**
|
25
25
|
* @param {SerializedType} data data
|
26
|
-
* @param {
|
26
|
+
* @param {object} context context object
|
27
27
|
* @returns {DeserializedType|Promise<DeserializedType>} deserialized data
|
28
28
|
*/
|
29
29
|
deserialize(data, context) {
|
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
"use strict";
|
6
6
|
|
7
|
-
/** @typedef {undefined|null|number|string|boolean|Buffer|
|
7
|
+
/** @typedef {undefined | null | number | string | boolean | Buffer | object | (() => ComplexSerializableType[] | Promise<ComplexSerializableType[]>)} ComplexSerializableType */
|
8
8
|
|
9
9
|
/** @typedef {undefined|null|number|bigint|string|boolean|Buffer|(() => PrimitiveSerializableType[] | Promise<PrimitiveSerializableType[]>)} PrimitiveSerializableType */
|
10
10
|
|
@@ -36,7 +36,7 @@ const ConsumeSharedFallbackDependency = require("./ConsumeSharedFallbackDependen
|
|
36
36
|
/** @typedef {import("../util/semver").SemVerRange} SemVerRange */
|
37
37
|
|
38
38
|
/**
|
39
|
-
* @typedef {
|
39
|
+
* @typedef {object} ConsumeOptions
|
40
40
|
* @property {string=} import fallback request
|
41
41
|
* @property {string=} importResolved resolved fallback request
|
42
42
|
* @property {string} shareKey global share key
|
@@ -13,7 +13,7 @@ const LazySet = require("../util/LazySet");
|
|
13
13
|
|
14
14
|
/**
|
15
15
|
* @template T
|
16
|
-
* @typedef {
|
16
|
+
* @typedef {object} MatchedConfigs
|
17
17
|
* @property {Map<string, T>} resolved
|
18
18
|
* @property {Map<string, T>} unresolved
|
19
19
|
* @property {Map<string, T>} prefixed
|
@@ -48,7 +48,7 @@ const { makePathsRelative, parseResource } = require("../util/identifier");
|
|
48
48
|
|
49
49
|
/** @typedef {KnownStatsCompilation & Record<string, any>} StatsCompilation */
|
50
50
|
/**
|
51
|
-
* @typedef {
|
51
|
+
* @typedef {object} KnownStatsCompilation
|
52
52
|
* @property {any=} env
|
53
53
|
* @property {string=} name
|
54
54
|
* @property {string=} hash
|
@@ -76,7 +76,7 @@ const { makePathsRelative, parseResource } = require("../util/identifier");
|
|
76
76
|
|
77
77
|
/** @typedef {KnownStatsLogging & Record<string, any>} StatsLogging */
|
78
78
|
/**
|
79
|
-
* @typedef {
|
79
|
+
* @typedef {object} KnownStatsLogging
|
80
80
|
* @property {StatsLoggingEntry[]} entries
|
81
81
|
* @property {number} filteredEntries
|
82
82
|
* @property {boolean} debug
|
@@ -84,7 +84,7 @@ const { makePathsRelative, parseResource } = require("../util/identifier");
|
|
84
84
|
|
85
85
|
/** @typedef {KnownStatsLoggingEntry & Record<string, any>} StatsLoggingEntry */
|
86
86
|
/**
|
87
|
-
* @typedef {
|
87
|
+
* @typedef {object} KnownStatsLoggingEntry
|
88
88
|
* @property {string} type
|
89
89
|
* @property {string} message
|
90
90
|
* @property {string[]=} trace
|
@@ -95,7 +95,7 @@ const { makePathsRelative, parseResource } = require("../util/identifier");
|
|
95
95
|
|
96
96
|
/** @typedef {KnownStatsAsset & Record<string, any>} StatsAsset */
|
97
97
|
/**
|
98
|
-
* @typedef {
|
98
|
+
* @typedef {object} KnownStatsAsset
|
99
99
|
* @property {string} type
|
100
100
|
* @property {string} name
|
101
101
|
* @property {AssetInfo} info
|
@@ -116,7 +116,7 @@ const { makePathsRelative, parseResource } = require("../util/identifier");
|
|
116
116
|
|
117
117
|
/** @typedef {KnownStatsChunkGroup & Record<string, any>} StatsChunkGroup */
|
118
118
|
/**
|
119
|
-
* @typedef {
|
119
|
+
* @typedef {object} KnownStatsChunkGroup
|
120
120
|
* @property {string=} name
|
121
121
|
* @property {(string|number)[]=} chunks
|
122
122
|
* @property {({ name: string, size?: number })[]=} assets
|
@@ -132,7 +132,7 @@ const { makePathsRelative, parseResource } = require("../util/identifier");
|
|
132
132
|
|
133
133
|
/** @typedef {KnownStatsModule & Record<string, any>} StatsModule */
|
134
134
|
/**
|
135
|
-
* @typedef {
|
135
|
+
* @typedef {object} KnownStatsModule
|
136
136
|
* @property {string=} type
|
137
137
|
* @property {string=} moduleType
|
138
138
|
* @property {string=} layer
|
@@ -176,7 +176,7 @@ const { makePathsRelative, parseResource } = require("../util/identifier");
|
|
176
176
|
|
177
177
|
/** @typedef {KnownStatsProfile & Record<string, any>} StatsProfile */
|
178
178
|
/**
|
179
|
-
* @typedef {
|
179
|
+
* @typedef {object} KnownStatsProfile
|
180
180
|
* @property {number} total
|
181
181
|
* @property {number} resolving
|
182
182
|
* @property {number} restoring
|
@@ -191,7 +191,7 @@ const { makePathsRelative, parseResource } = require("../util/identifier");
|
|
191
191
|
|
192
192
|
/** @typedef {KnownStatsModuleIssuer & Record<string, any>} StatsModuleIssuer */
|
193
193
|
/**
|
194
|
-
* @typedef {
|
194
|
+
* @typedef {object} KnownStatsModuleIssuer
|
195
195
|
* @property {string=} identifier
|
196
196
|
* @property {string=} name
|
197
197
|
* @property {(string|number)=} id
|
@@ -200,7 +200,7 @@ const { makePathsRelative, parseResource } = require("../util/identifier");
|
|
200
200
|
|
201
201
|
/** @typedef {KnownStatsModuleReason & Record<string, any>} StatsModuleReason */
|
202
202
|
/**
|
203
|
-
* @typedef {
|
203
|
+
* @typedef {object} KnownStatsModuleReason
|
204
204
|
* @property {string=} moduleIdentifier
|
205
205
|
* @property {string=} module
|
206
206
|
* @property {string=} moduleName
|
@@ -217,7 +217,7 @@ const { makePathsRelative, parseResource } = require("../util/identifier");
|
|
217
217
|
|
218
218
|
/** @typedef {KnownStatsChunk & Record<string, any>} StatsChunk */
|
219
219
|
/**
|
220
|
-
* @typedef {
|
220
|
+
* @typedef {object} KnownStatsChunk
|
221
221
|
* @property {boolean} rendered
|
222
222
|
* @property {boolean} initial
|
223
223
|
* @property {boolean} entry
|
@@ -243,7 +243,7 @@ const { makePathsRelative, parseResource } = require("../util/identifier");
|
|
243
243
|
|
244
244
|
/** @typedef {KnownStatsChunkOrigin & Record<string, any>} StatsChunkOrigin */
|
245
245
|
/**
|
246
|
-
* @typedef {
|
246
|
+
* @typedef {object} KnownStatsChunkOrigin
|
247
247
|
* @property {string=} module
|
248
248
|
* @property {string=} moduleIdentifier
|
249
249
|
* @property {string=} moduleName
|
@@ -254,7 +254,7 @@ const { makePathsRelative, parseResource } = require("../util/identifier");
|
|
254
254
|
|
255
255
|
/** @typedef {KnownStatsModuleTraceItem & Record<string, any>} StatsModuleTraceItem */
|
256
256
|
/**
|
257
|
-
* @typedef {
|
257
|
+
* @typedef {object} KnownStatsModuleTraceItem
|
258
258
|
* @property {string=} originIdentifier
|
259
259
|
* @property {string=} originName
|
260
260
|
* @property {string=} moduleIdentifier
|
@@ -266,13 +266,13 @@ const { makePathsRelative, parseResource } = require("../util/identifier");
|
|
266
266
|
|
267
267
|
/** @typedef {KnownStatsModuleTraceDependency & Record<string, any>} StatsModuleTraceDependency */
|
268
268
|
/**
|
269
|
-
* @typedef {
|
269
|
+
* @typedef {object} KnownStatsModuleTraceDependency
|
270
270
|
* @property {string=} loc
|
271
271
|
*/
|
272
272
|
|
273
273
|
/** @typedef {KnownStatsError & Record<string, any>} StatsError */
|
274
274
|
/**
|
275
|
-
* @typedef {
|
275
|
+
* @typedef {object} KnownStatsError
|
276
276
|
* @property {string} message
|
277
277
|
* @property {string=} chunkName
|
278
278
|
* @property {boolean=} chunkEntry
|
@@ -297,7 +297,7 @@ const { makePathsRelative, parseResource } = require("../util/identifier");
|
|
297
297
|
*/
|
298
298
|
|
299
299
|
/**
|
300
|
-
* @typedef {
|
300
|
+
* @typedef {object} SimpleExtractors
|
301
301
|
* @property {ExtractorsByOption<Compilation, StatsCompilation>} compilation
|
302
302
|
* @property {ExtractorsByOption<PreprocessedAsset, StatsAsset>} asset
|
303
303
|
* @property {ExtractorsByOption<PreprocessedAsset, StatsAsset>} asset$visible
|
@@ -1526,7 +1526,7 @@ const FILTER = {
|
|
1526
1526
|
}
|
1527
1527
|
};
|
1528
1528
|
|
1529
|
-
/** @type {Record<string, Record<string, (thing:
|
1529
|
+
/** @type {Record<string, Record<string, (thing: object, context: StatsFactoryContext, options: NormalizedStatsOptions) => boolean | undefined>>} */
|
1530
1530
|
const FILTER_RESULTS = {
|
1531
1531
|
"compilation.warnings": {
|
1532
1532
|
warningsFilter: util.deprecate(
|
@@ -2246,7 +2246,7 @@ const sortOrderRegular = field => {
|
|
2246
2246
|
|
2247
2247
|
/**
|
2248
2248
|
* @param {string} field field name
|
2249
|
-
* @returns {function(
|
2249
|
+
* @returns {function(object, object): number} comparators
|
2250
2250
|
*/
|
2251
2251
|
const sortByField = field => {
|
2252
2252
|
if (!field) {
|
@@ -2361,8 +2361,8 @@ const ITEM_NAMES = {
|
|
2361
2361
|
};
|
2362
2362
|
|
2363
2363
|
/**
|
2364
|
-
* @param {
|
2365
|
-
* @returns {
|
2364
|
+
* @param {object[]} items items to be merged
|
2365
|
+
* @returns {object} an object
|
2366
2366
|
*/
|
2367
2367
|
const mergeToObject = items => {
|
2368
2368
|
const obj = Object.create(null);
|
@@ -2372,7 +2372,7 @@ const mergeToObject = items => {
|
|
2372
2372
|
return obj;
|
2373
2373
|
};
|
2374
2374
|
|
2375
|
-
/** @type {Record<string, (items:
|
2375
|
+
/** @type {Record<string, (items: object[]) => any>} */
|
2376
2376
|
const MERGER = {
|
2377
2377
|
"compilation.entrypoints": mergeToObject,
|
2378
2378
|
"compilation.namedChunkGroups": mergeToObject
|