webpack 5.85.0 → 5.88.1
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/README.md +5 -2
- package/lib/APIPlugin.js +150 -99
- package/lib/AsyncDependenciesBlock.js +3 -3
- package/lib/BannerPlugin.js +2 -1
- package/lib/CaseSensitiveModulesWarning.js +3 -1
- package/lib/Chunk.js +35 -17
- package/lib/ChunkGraph.js +4 -4
- package/lib/ChunkGroup.js +20 -9
- package/lib/CompatibilityPlugin.js +50 -30
- package/lib/Compilation.js +2 -1
- package/lib/Compiler.js +10 -9
- package/lib/ConcatenationScope.js +2 -2
- package/lib/ConditionalInitFragment.js +11 -1
- package/lib/ConstPlugin.js +73 -32
- package/lib/ContextModule.js +8 -3
- package/lib/ContextModuleFactory.js +1 -0
- package/lib/ContextReplacementPlugin.js +13 -0
- package/lib/DelegatedModule.js +15 -3
- package/lib/DelegatedModuleFactoryPlugin.js +6 -0
- package/lib/DependenciesBlock.js +1 -1
- package/lib/Dependency.js +11 -5
- package/lib/DependencyTemplates.js +1 -1
- package/lib/DllEntryPlugin.js +11 -1
- package/lib/DllModule.js +6 -0
- package/lib/DllReferencePlugin.js +13 -1
- package/lib/Entrypoint.js +1 -1
- package/lib/ErrorHelpers.js +1 -0
- package/lib/EvalSourceMapDevToolPlugin.js +6 -1
- package/lib/ExportsInfo.js +22 -4
- package/lib/ExportsInfoApiPlugin.js +14 -5
- package/lib/ExternalModule.js +20 -8
- package/lib/FileSystemInfo.js +52 -24
- package/lib/FlagAllModulesAsUsedPlugin.js +6 -1
- package/lib/FlagDependencyUsagePlugin.js +3 -1
- package/lib/FlagEntryExportAsUsedPlugin.js +4 -0
- package/lib/Generator.js +7 -0
- package/lib/HotModuleReplacementPlugin.js +8 -0
- package/lib/InitFragment.js +28 -5
- package/lib/JavascriptMetaInfoPlugin.js +11 -6
- package/lib/LibManifestPlugin.js +20 -4
- package/lib/Module.js +14 -3
- package/lib/ModuleDependencyError.js +4 -2
- package/lib/ModuleDependencyWarning.js +4 -2
- package/lib/ModuleGraph.js +31 -24
- package/lib/ModuleGraphConnection.js +19 -6
- package/lib/ModuleInfoHeaderPlugin.js +9 -2
- package/lib/ModuleNotFoundError.js +5 -2
- package/lib/ModuleProfile.js +1 -0
- package/lib/ModuleRestoreError.js +2 -0
- package/lib/ModuleStoreError.js +2 -1
- package/lib/ModuleTypeConstants.js +7 -0
- package/lib/MultiWatching.js +4 -0
- package/lib/NodeStuffPlugin.js +32 -6
- package/lib/ProgressPlugin.js +71 -15
- package/lib/ProvidePlugin.js +13 -4
- package/lib/RawModule.js +3 -1
- package/lib/RequireJsStuffPlugin.js +7 -0
- package/lib/RuntimeGlobals.js +5 -0
- package/lib/RuntimeModule.js +3 -3
- package/lib/RuntimePlugin.js +6 -3
- package/lib/RuntimeTemplate.js +22 -4
- package/lib/SourceMapDevToolModuleOptionsPlugin.js +4 -0
- package/lib/SourceMapDevToolPlugin.js +7 -2
- package/lib/UseStrictPlugin.js +10 -3
- package/lib/Watching.js +62 -25
- package/lib/WebpackError.js +6 -5
- package/lib/WebpackIsIncludedPlugin.js +6 -4
- package/lib/WebpackOptionsApply.js +4 -2
- package/lib/WebpackOptionsDefaulter.js +10 -3
- package/lib/asset/AssetGenerator.js +2 -1
- package/lib/asset/AssetParser.js +11 -6
- package/lib/asset/AssetSourceParser.js +8 -3
- package/lib/async-modules/AwaitDependenciesInitFragment.js +4 -0
- package/lib/buildChunkGraph.js +37 -21
- package/lib/cache/IdleFileCachePlugin.js +2 -1
- package/lib/cache/PackFileCacheStrategy.js +53 -22
- package/lib/config/browserslistTargetHandler.js +7 -7
- package/lib/config/defaults.js +43 -26
- package/lib/container/RemoteRuntimeModule.js +1 -1
- package/lib/css/CssExportsGenerator.js +9 -0
- package/lib/css/CssGenerator.js +1 -1
- package/lib/css/CssLoadingRuntimeModule.js +43 -19
- package/lib/css/CssModulesPlugin.js +42 -14
- package/lib/css/CssParser.js +22 -0
- package/lib/dependencies/AMDDefineDependency.js +34 -4
- package/lib/dependencies/AMDDefineDependencyParserPlugin.js +5 -0
- package/lib/dependencies/AMDRuntimeModules.js +2 -2
- package/lib/dependencies/CommonJsExportsParserPlugin.js +14 -4
- package/lib/dependencies/CommonJsImportsParserPlugin.js +169 -59
- package/lib/dependencies/CommonJsPlugin.js +13 -8
- package/lib/dependencies/CommonJsRequireContextDependency.js +2 -2
- package/lib/dependencies/ConstDependency.js +2 -2
- package/lib/dependencies/ContextDependency.js +7 -2
- package/lib/dependencies/CssImportDependency.js +1 -1
- package/lib/dependencies/CssLocalIdentifierDependency.js +5 -0
- package/lib/dependencies/CssUrlDependency.js +3 -3
- package/lib/dependencies/DllEntryDependency.js +5 -0
- package/lib/dependencies/DynamicExports.js +10 -6
- package/lib/dependencies/ExportsInfoDependency.js +14 -4
- package/lib/dependencies/HarmonyCompatibilityDependency.js +2 -1
- package/lib/dependencies/HarmonyDetectionParserPlugin.js +3 -1
- package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +12 -5
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +2 -0
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +4 -4
- package/lib/dependencies/HarmonyExports.js +9 -5
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +40 -27
- package/lib/dependencies/HarmonyImportSideEffectDependency.js +1 -2
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +31 -21
- package/lib/dependencies/HarmonyTopLevelThisParserPlugin.js +15 -3
- package/lib/dependencies/ImportDependency.js +5 -3
- package/lib/dependencies/ImportEagerDependency.js +5 -3
- package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +19 -0
- package/lib/dependencies/ImportMetaPlugin.js +31 -15
- package/lib/dependencies/ImportParserPlugin.js +62 -25
- package/lib/dependencies/ImportWeakDependency.js +5 -3
- package/lib/dependencies/JsonExportsDependency.js +1 -1
- package/lib/dependencies/ModuleDependency.js +1 -1
- package/lib/dependencies/ModuleDependencyTemplateAsId.js +2 -1
- package/lib/dependencies/ProvidedDependency.js +4 -1
- package/lib/dependencies/RequireContextDependencyParserPlugin.js +13 -5
- package/lib/dependencies/RequireEnsureDependenciesBlock.js +5 -2
- package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +6 -1
- package/lib/dependencies/RequireHeaderDependency.js +4 -0
- package/lib/dependencies/RequireIncludeDependencyParserPlugin.js +26 -5
- package/lib/dependencies/RequireResolveHeaderDependency.js +9 -0
- package/lib/dependencies/SystemPlugin.js +17 -5
- package/lib/dependencies/SystemRuntimeModule.js +1 -1
- package/lib/dependencies/URLDependency.js +2 -2
- package/lib/dependencies/URLPlugin.js +9 -4
- package/lib/dependencies/WebAssemblyImportDependency.js +1 -1
- package/lib/dependencies/WorkerPlugin.js +59 -22
- package/lib/esm/ExportWebpackRequireRuntimeModule.js +1 -1
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +1 -1
- package/lib/hmr/HotModuleReplacementRuntimeModule.js +1 -1
- package/lib/ids/HashedModuleIdsPlugin.js +1 -1
- package/lib/ids/SyncModuleIdsPlugin.js +1 -0
- package/lib/javascript/BasicEvaluatedExpression.js +28 -19
- package/lib/javascript/CommonJsChunkFormatPlugin.js +6 -2
- package/lib/javascript/JavascriptModulesPlugin.js +25 -5
- package/lib/javascript/JavascriptParser.js +157 -85
- package/lib/javascript/JavascriptParserHelpers.js +37 -15
- package/lib/json/JsonData.js +2 -2
- package/lib/json/JsonParser.js +25 -12
- package/lib/library/AmdLibraryPlugin.js +2 -2
- package/lib/library/AssignLibraryPlugin.js +13 -1
- package/lib/library/EnableLibraryPlugin.js +4 -0
- package/lib/library/SystemLibraryPlugin.js +1 -1
- package/lib/library/UmdLibraryPlugin.js +20 -2
- package/lib/logging/runtime.js +1 -1
- package/lib/logging/truncateArgs.js +4 -0
- package/lib/node/ReadFileChunkLoadingRuntimeModule.js +10 -6
- package/lib/node/ReadFileCompileAsyncWasmPlugin.js +2 -1
- package/lib/node/RequireChunkLoadingRuntimeModule.js +10 -6
- package/lib/optimize/AggressiveMergingPlugin.js +8 -0
- package/lib/optimize/AggressiveSplittingPlugin.js +9 -2
- package/lib/optimize/EnsureChunkConditionsPlugin.js +3 -0
- package/lib/optimize/FlagIncludedChunksPlugin.js +11 -5
- package/lib/optimize/InnerGraph.js +5 -5
- package/lib/optimize/InnerGraphPlugin.js +2 -1
- package/lib/optimize/LimitChunkCountPlugin.js +29 -4
- package/lib/optimize/MangleExportsPlugin.js +1 -1
- package/lib/optimize/MinMaxSizeWarning.js +5 -0
- package/lib/optimize/ModuleConcatenationPlugin.js +59 -2
- package/lib/optimize/RealContentHashPlugin.js +80 -30
- package/lib/optimize/RemoveParentModulesPlugin.js +6 -0
- package/lib/optimize/RuntimeChunkPlugin.js +9 -1
- package/lib/optimize/SideEffectsFlagPlugin.js +10 -1
- package/lib/optimize/SplitChunksPlugin.js +71 -31
- package/lib/performance/SizeLimitsPlugin.js +7 -4
- package/lib/prefetch/ChunkPrefetchFunctionRuntimeModule.js +4 -2
- package/lib/prefetch/ChunkPrefetchPreloadPlugin.js +3 -1
- package/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js +6 -3
- package/lib/prefetch/ChunkPrefetchTriggerRuntimeModule.js +4 -2
- package/lib/prefetch/ChunkPreloadTriggerRuntimeModule.js +4 -2
- package/lib/rules/BasicEffectRulePlugin.js +4 -0
- package/lib/rules/BasicMatcherRulePlugin.js +5 -0
- package/lib/rules/RuleSetCompiler.js +3 -3
- package/lib/rules/UseEffectRulePlugin.js +6 -4
- package/lib/runtime/AsyncModuleRuntimeModule.js +8 -5
- package/lib/runtime/AutoPublicPathRuntimeModule.js +4 -2
- package/lib/runtime/BaseUriRuntimeModule.js +3 -3
- package/lib/runtime/ChunkNameRuntimeModule.js +1 -1
- package/lib/runtime/CompatGetDefaultExportRuntimeModule.js +5 -2
- package/lib/runtime/CompatRuntimeModule.js +7 -2
- package/lib/runtime/CreateFakeNamespaceObjectRuntimeModule.js +5 -2
- package/lib/runtime/CreateScriptRuntimeModule.js +4 -2
- package/lib/runtime/CreateScriptUrlRuntimeModule.js +4 -2
- package/lib/runtime/DefinePropertyGettersRuntimeModule.js +5 -2
- package/lib/runtime/EnsureChunkRuntimeModule.js +15 -4
- package/lib/runtime/GetChunkFilenameRuntimeModule.js +6 -10
- package/lib/runtime/GetFullHashRuntimeModule.js +4 -3
- package/lib/runtime/GetMainFilenameRuntimeModule.js +5 -2
- package/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +4 -2
- package/lib/runtime/GlobalRuntimeModule.js +1 -1
- package/lib/runtime/HasOwnPropertyRuntimeModule.js +5 -2
- package/lib/runtime/LoadScriptRuntimeModule.js +64 -48
- package/lib/runtime/MakeNamespaceObjectRuntimeModule.js +5 -2
- package/lib/runtime/NonceRuntimeModule.js +1 -1
- package/lib/runtime/OnChunksLoadedRuntimeModule.js +4 -2
- package/lib/runtime/PublicPathRuntimeModule.js +4 -2
- package/lib/runtime/RelativeUrlRuntimeModule.js +5 -2
- package/lib/runtime/RuntimeIdRuntimeModule.js +6 -2
- package/lib/runtime/StartupChunkDependenciesRuntimeModule.js +9 -3
- package/lib/runtime/StartupEntrypointRuntimeModule.js +3 -2
- package/lib/runtime/SystemContextRuntimeModule.js +1 -1
- package/lib/serialization/BinaryMiddleware.js +143 -1
- package/lib/serialization/ErrorObjectSerializer.js +3 -0
- package/lib/serialization/ObjectMiddleware.js +9 -3
- package/lib/serialization/types.js +1 -1
- package/lib/sharing/ConsumeSharedFallbackDependency.js +3 -0
- package/lib/sharing/ConsumeSharedRuntimeModule.js +14 -5
- package/lib/sharing/ProvideSharedDependency.js +11 -0
- package/lib/sharing/ProvideSharedModule.js +4 -0
- package/lib/sharing/ProvideSharedPlugin.js +22 -21
- package/lib/sharing/ShareRuntimeModule.js +12 -5
- package/lib/sharing/resolveMatchedConfigs.js +1 -1
- package/lib/sharing/utils.js +32 -5
- package/lib/util/AsyncQueue.js +4 -2
- package/lib/util/ParallelismFactorCalculator.js +10 -0
- package/lib/util/Semaphore.js +1 -1
- package/lib/util/StackedCacheMap.js +1 -1
- package/lib/util/URLAbsoluteSpecifier.js +1 -1
- package/lib/util/createHash.js +30 -9
- package/lib/util/deprecation.js +10 -3
- package/lib/util/deterministicGrouping.js +50 -11
- package/lib/util/findGraphRoots.js +4 -2
- package/lib/util/memoize.js +3 -3
- package/lib/util/processAsyncTree.js +7 -1
- package/lib/util/registerExternalSerializer.js +1 -1
- package/lib/util/runtime.js +84 -21
- package/lib/util/semver.js +1 -0
- package/lib/util/smartGrouping.js +1 -1
- package/lib/validateSchema.js +6 -2
- package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +6 -2
- package/lib/wasm-async/AsyncWebAssemblyParser.js +7 -3
- package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +14 -7
- package/lib/wasm-sync/WasmFinalizeExportsPlugin.js +3 -1
- package/lib/wasm-sync/WebAssemblyGenerator.js +1 -0
- package/lib/wasm-sync/WebAssemblyParser.js +6 -2
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +14 -4
- package/lib/webpack.js +11 -2
- package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +15 -16
- package/module.d.ts +1 -0
- package/package.json +5 -4
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +52 -6
- package/schemas/plugins/css/CssGeneratorOptions.json +1 -1
- package/schemas/plugins/css/CssParserOptions.json +1 -1
- package/types.d.ts +606 -292
package/lib/Generator.js
CHANGED
@@ -45,6 +45,10 @@
|
|
45
45
|
*
|
46
46
|
*/
|
47
47
|
class Generator {
|
48
|
+
/**
|
49
|
+
* @param {Record<string, Generator>} map map of types
|
50
|
+
* @returns {ByTypeGenerator} generator by type
|
51
|
+
*/
|
48
52
|
static byType(map) {
|
49
53
|
return new ByTypeGenerator(map);
|
50
54
|
}
|
@@ -106,6 +110,9 @@ class Generator {
|
|
106
110
|
}
|
107
111
|
|
108
112
|
class ByTypeGenerator extends Generator {
|
113
|
+
/**
|
114
|
+
* @param {Record<string, Generator>} map map of types
|
115
|
+
*/
|
109
116
|
constructor(map) {
|
110
117
|
super();
|
111
118
|
this.map = map;
|
@@ -189,6 +189,10 @@ class HotModuleReplacementPlugin {
|
|
189
189
|
return true;
|
190
190
|
};
|
191
191
|
|
192
|
+
/**
|
193
|
+
* @param {JavascriptParser} parser the parser
|
194
|
+
* @returns {void}
|
195
|
+
*/
|
192
196
|
const applyModuleHot = parser => {
|
193
197
|
parser.hooks.evaluateIdentifier.for("module.hot").tap(
|
194
198
|
{
|
@@ -221,6 +225,10 @@ class HotModuleReplacementPlugin {
|
|
221
225
|
.tap(PLUGIN_NAME, createHMRExpressionHandler(parser));
|
222
226
|
};
|
223
227
|
|
228
|
+
/**
|
229
|
+
* @param {JavascriptParser} parser the parser
|
230
|
+
* @returns {void}
|
231
|
+
*/
|
224
232
|
const applyImportMetaHot = parser => {
|
225
233
|
parser.hooks.evaluateIdentifier
|
226
234
|
.for("import.meta.webpackHot")
|
package/lib/InitFragment.js
CHANGED
@@ -10,17 +10,21 @@ const makeSerializable = require("./util/makeSerializable");
|
|
10
10
|
|
11
11
|
/** @typedef {import("webpack-sources").Source} Source */
|
12
12
|
/** @typedef {import("./Generator").GenerateContext} GenerateContext */
|
13
|
+
/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
14
|
+
/** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
13
15
|
|
14
16
|
/**
|
15
|
-
* @
|
17
|
+
* @template T
|
18
|
+
* @param {InitFragment<T>} fragment the init fragment
|
16
19
|
* @param {number} index index
|
17
|
-
* @returns {[InitFragment
|
20
|
+
* @returns {[InitFragment<T>, number]} tuple with both
|
18
21
|
*/
|
19
22
|
const extractFragmentIndex = (fragment, index) => [fragment, index];
|
20
23
|
|
21
24
|
/**
|
22
|
-
* @
|
23
|
-
* @param {[InitFragment
|
25
|
+
* @template T
|
26
|
+
* @param {[InitFragment<T>, number]} a first pair
|
27
|
+
* @param {[InitFragment<T>, number]} b second pair
|
24
28
|
* @returns {number} sort value
|
25
29
|
*/
|
26
30
|
const sortFragmentWithIndex = ([a, i], [b, j]) => {
|
@@ -66,6 +70,14 @@ class InitFragment {
|
|
66
70
|
return this.endContent;
|
67
71
|
}
|
68
72
|
|
73
|
+
/**
|
74
|
+
* @template Context
|
75
|
+
* @template T
|
76
|
+
* @param {Source} source sources
|
77
|
+
* @param {InitFragment<T>[]} initFragments init fragments
|
78
|
+
* @param {Context} context context
|
79
|
+
* @returns {Source} source
|
80
|
+
*/
|
69
81
|
static addToSource(source, initFragments, context) {
|
70
82
|
if (initFragments.length > 0) {
|
71
83
|
// Sort fragments by position. If 2 fragments have the same position,
|
@@ -77,7 +89,12 @@ class InitFragment {
|
|
77
89
|
// Deduplicate fragments. If a fragment has no key, it is always included.
|
78
90
|
const keyedFragments = new Map();
|
79
91
|
for (const [fragment] of sortedFragments) {
|
80
|
-
if (
|
92
|
+
if (
|
93
|
+
typeof (
|
94
|
+
/** @type {InitFragment<T> & { mergeAll?: (fragments: InitFragment[]) => InitFragment[] }} */
|
95
|
+
(fragment).mergeAll
|
96
|
+
) === "function"
|
97
|
+
) {
|
81
98
|
if (!fragment.key) {
|
82
99
|
throw new Error(
|
83
100
|
`InitFragment with mergeAll function must have a valid key: ${fragment.constructor.name}`
|
@@ -125,6 +142,9 @@ class InitFragment {
|
|
125
142
|
}
|
126
143
|
}
|
127
144
|
|
145
|
+
/**
|
146
|
+
* @param {ObjectSerializerContext} context context
|
147
|
+
*/
|
128
148
|
serialize(context) {
|
129
149
|
const { write } = context;
|
130
150
|
|
@@ -135,6 +155,9 @@ class InitFragment {
|
|
135
155
|
write(this.endContent);
|
136
156
|
}
|
137
157
|
|
158
|
+
/**
|
159
|
+
* @param {ObjectDeserializerContext} context context
|
160
|
+
*/
|
138
161
|
deserialize(context) {
|
139
162
|
const { read } = context;
|
140
163
|
|
@@ -13,6 +13,7 @@ const {
|
|
13
13
|
const InnerGraph = require("./optimize/InnerGraph");
|
14
14
|
|
15
15
|
/** @typedef {import("./Compiler")} Compiler */
|
16
|
+
/** @typedef {import("./Module").BuildInfo} BuildInfo */
|
16
17
|
/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */
|
17
18
|
|
18
19
|
const PLUGIN_NAME = "JavascriptMetaInfoPlugin";
|
@@ -33,8 +34,11 @@ class JavascriptMetaInfoPlugin {
|
|
33
34
|
*/
|
34
35
|
const handler = parser => {
|
35
36
|
parser.hooks.call.for("eval").tap(PLUGIN_NAME, () => {
|
36
|
-
|
37
|
-
|
37
|
+
const buildInfo =
|
38
|
+
/** @type {BuildInfo} */
|
39
|
+
(parser.state.module.buildInfo);
|
40
|
+
buildInfo.moduleConcatenationBailout = "eval()";
|
41
|
+
buildInfo.usingEval = true;
|
38
42
|
const currentSymbol = InnerGraph.getTopLevelSymbol(parser.state);
|
39
43
|
if (currentSymbol) {
|
40
44
|
InnerGraph.addUsage(parser.state, null, currentSymbol);
|
@@ -43,11 +47,12 @@ class JavascriptMetaInfoPlugin {
|
|
43
47
|
}
|
44
48
|
});
|
45
49
|
parser.hooks.finish.tap(PLUGIN_NAME, () => {
|
46
|
-
|
47
|
-
|
50
|
+
const buildInfo =
|
51
|
+
/** @type {BuildInfo} */
|
52
|
+
(parser.state.module.buildInfo);
|
53
|
+
let topLevelDeclarations = buildInfo.topLevelDeclarations;
|
48
54
|
if (topLevelDeclarations === undefined) {
|
49
|
-
topLevelDeclarations =
|
50
|
-
parser.state.module.buildInfo.topLevelDeclarations = new Set();
|
55
|
+
topLevelDeclarations = buildInfo.topLevelDeclarations = new Set();
|
51
56
|
}
|
52
57
|
for (const name of parser.scope.definitions.asSet()) {
|
53
58
|
const freeInfo = parser.getFreeInfoFromVariable(name);
|
package/lib/LibManifestPlugin.js
CHANGED
@@ -12,15 +12,29 @@ const { compareModulesById } = require("./util/comparators");
|
|
12
12
|
const { dirname, mkdirp } = require("./util/fs");
|
13
13
|
|
14
14
|
/** @typedef {import("./Compiler")} Compiler */
|
15
|
+
/** @typedef {import("./Module").BuildMeta} BuildMeta */
|
15
16
|
|
16
17
|
/**
|
17
18
|
* @typedef {Object} ManifestModuleData
|
18
19
|
* @property {string | number} id
|
19
|
-
* @property {
|
20
|
-
* @property {boolean | string[]} exports
|
20
|
+
* @property {BuildMeta} buildMeta
|
21
|
+
* @property {boolean | string[] | undefined} exports
|
22
|
+
*/
|
23
|
+
|
24
|
+
/**
|
25
|
+
* @typedef {Object} LibManifestPluginOptions
|
26
|
+
* @property {string=} context Context of requests in the manifest file (defaults to the webpack context).
|
27
|
+
* @property {boolean=} entryOnly If true, only entry points will be exposed (default: true).
|
28
|
+
* @property {boolean=} format If true, manifest json file (output) will be formatted.
|
29
|
+
* @property {string=} name Name of the exposed dll function (external name, use value of 'output.library').
|
30
|
+
* @property {string} path Absolute path to the manifest json file (output).
|
31
|
+
* @property {string=} type Type of the dll bundle (external type, use value of 'output.libraryTarget').
|
21
32
|
*/
|
22
33
|
|
23
34
|
class LibManifestPlugin {
|
35
|
+
/**
|
36
|
+
* @param {LibManifestPluginOptions} options the options
|
37
|
+
*/
|
24
38
|
constructor(options) {
|
25
39
|
this.options = options;
|
26
40
|
}
|
@@ -67,7 +81,9 @@ class LibManifestPlugin {
|
|
67
81
|
continue;
|
68
82
|
}
|
69
83
|
const ident = module.libIdent({
|
70
|
-
context:
|
84
|
+
context:
|
85
|
+
this.options.context ||
|
86
|
+
/** @type {string} */ (compiler.options.context),
|
71
87
|
associatedObjectForCache: compiler.root
|
72
88
|
});
|
73
89
|
if (ident) {
|
@@ -76,7 +92,7 @@ class LibManifestPlugin {
|
|
76
92
|
/** @type {ManifestModuleData} */
|
77
93
|
const data = {
|
78
94
|
id: chunkGraph.getModuleId(module),
|
79
|
-
buildMeta: module.buildMeta,
|
95
|
+
buildMeta: /** @type {BuildMeta} */ (module.buildMeta),
|
80
96
|
exports: Array.isArray(providedExports)
|
81
97
|
? providedExports
|
82
98
|
: undefined
|
package/lib/Module.js
CHANGED
@@ -107,6 +107,12 @@ const makeSerializable = require("./util/makeSerializable");
|
|
107
107
|
*/
|
108
108
|
|
109
109
|
/** @typedef {KnownBuildMeta & Record<string, any>} BuildMeta */
|
110
|
+
/** @typedef {Record<string, any>} BuildInfo */
|
111
|
+
|
112
|
+
/**
|
113
|
+
* @typedef {Object} FactoryMeta
|
114
|
+
* @property {boolean=} sideEffectFree
|
115
|
+
*/
|
110
116
|
|
111
117
|
const EMPTY_RESOLVE_OPTIONS = {};
|
112
118
|
|
@@ -116,6 +122,11 @@ const DEFAULT_TYPES_UNKNOWN = new Set(["unknown"]);
|
|
116
122
|
const DEFAULT_TYPES_JS = new Set(["javascript"]);
|
117
123
|
|
118
124
|
const deprecatedNeedRebuild = util.deprecate(
|
125
|
+
/**
|
126
|
+
* @param {Module} module the module
|
127
|
+
* @param {NeedBuildContext} context context info
|
128
|
+
* @returns {boolean} true, when rebuild is needed
|
129
|
+
*/
|
119
130
|
(module, context) => {
|
120
131
|
return module.needRebuild(
|
121
132
|
context.fileSystemInfo.getDeprecatedFileTimestamps(),
|
@@ -153,7 +164,7 @@ class Module extends DependenciesBlock {
|
|
153
164
|
// Info from Factory
|
154
165
|
/** @type {ResolveOptions | undefined} */
|
155
166
|
this.resolveOptions = EMPTY_RESOLVE_OPTIONS;
|
156
|
-
/** @type {
|
167
|
+
/** @type {FactoryMeta | undefined} */
|
157
168
|
this.factoryMeta = undefined;
|
158
169
|
// TODO refactor this -> options object filled from Factory
|
159
170
|
// TODO webpack 6: use an enum
|
@@ -169,7 +180,7 @@ class Module extends DependenciesBlock {
|
|
169
180
|
this._errors = undefined;
|
170
181
|
/** @type {BuildMeta | undefined} */
|
171
182
|
this.buildMeta = undefined;
|
172
|
-
/** @type {
|
183
|
+
/** @type {BuildInfo | undefined} */
|
173
184
|
this.buildInfo = undefined;
|
174
185
|
/** @type {Dependency[] | undefined} */
|
175
186
|
this.presentationalDependencies = undefined;
|
@@ -433,7 +444,7 @@ class Module extends DependenciesBlock {
|
|
433
444
|
|
434
445
|
/**
|
435
446
|
* @param {ModuleGraph} moduleGraph the module graph
|
436
|
-
* @param {boolean} strict the importing module is strict
|
447
|
+
* @param {boolean | undefined} strict the importing module is strict
|
437
448
|
* @returns {"namespace" | "default-only" | "default-with-named" | "dynamic"} export type
|
438
449
|
* "namespace": Exports is already a namespace object. namespace = exports.
|
439
450
|
* "dynamic": Check at runtime if __esModule is set. When set: namespace = { ...exports, default: exports }. When not set: namespace = { default: exports }.
|
@@ -23,7 +23,7 @@ class ModuleDependencyError extends WebpackError {
|
|
23
23
|
this.name = "ModuleDependencyError";
|
24
24
|
this.details =
|
25
25
|
err && !(/** @type {any} */ (err).hideStack)
|
26
|
-
? err.stack.split("\n").slice(1).join("\n")
|
26
|
+
? /** @type {string} */ (err.stack).split("\n").slice(1).join("\n")
|
27
27
|
: undefined;
|
28
28
|
this.module = module;
|
29
29
|
this.loc = loc;
|
@@ -32,7 +32,9 @@ class ModuleDependencyError extends WebpackError {
|
|
32
32
|
|
33
33
|
if (err && /** @type {any} */ (err).hideStack) {
|
34
34
|
this.stack =
|
35
|
-
err.stack.split("\n").slice(1).join("\n") +
|
35
|
+
/** @type {string} */ (err.stack).split("\n").slice(1).join("\n") +
|
36
|
+
"\n\n" +
|
37
|
+
this.stack;
|
36
38
|
}
|
37
39
|
}
|
38
40
|
}
|
@@ -23,7 +23,7 @@ class ModuleDependencyWarning extends WebpackError {
|
|
23
23
|
this.name = "ModuleDependencyWarning";
|
24
24
|
this.details =
|
25
25
|
err && !(/** @type {any} */ (err).hideStack)
|
26
|
-
? err.stack.split("\n").slice(1).join("\n")
|
26
|
+
? /** @type {string} */ (err.stack).split("\n").slice(1).join("\n")
|
27
27
|
: undefined;
|
28
28
|
this.module = module;
|
29
29
|
this.loc = loc;
|
@@ -32,7 +32,9 @@ class ModuleDependencyWarning extends WebpackError {
|
|
32
32
|
|
33
33
|
if (err && /** @type {any} */ (err).hideStack) {
|
34
34
|
this.stack =
|
35
|
-
err.stack.split("\n").slice(1).join("\n") +
|
35
|
+
/** @type {string} */ (err.stack).split("\n").slice(1).join("\n") +
|
36
|
+
"\n\n" +
|
37
|
+
this.stack;
|
36
38
|
}
|
37
39
|
}
|
38
40
|
}
|
package/lib/ModuleGraph.js
CHANGED
@@ -35,14 +35,15 @@ const getConnectionsByOriginModule = set => {
|
|
35
35
|
const map = new Map();
|
36
36
|
/** @type {Module | 0} */
|
37
37
|
let lastModule = 0;
|
38
|
-
/** @type {ModuleGraphConnection[]} */
|
38
|
+
/** @type {ModuleGraphConnection[] | undefined} */
|
39
39
|
let lastList = undefined;
|
40
40
|
for (const connection of set) {
|
41
41
|
const { originModule } = connection;
|
42
42
|
if (lastModule === originModule) {
|
43
|
-
|
43
|
+
/** @type {ModuleGraphConnection[]} */
|
44
|
+
(lastList).push(connection);
|
44
45
|
} else {
|
45
|
-
lastModule = originModule;
|
46
|
+
lastModule = /** @type {Module} */ (originModule);
|
46
47
|
const list = map.get(originModule);
|
47
48
|
if (list !== undefined) {
|
48
49
|
lastList = list;
|
@@ -65,12 +66,13 @@ const getConnectionsByModule = set => {
|
|
65
66
|
const map = new Map();
|
66
67
|
/** @type {Module | 0} */
|
67
68
|
let lastModule = 0;
|
68
|
-
/** @type {ModuleGraphConnection[]} */
|
69
|
+
/** @type {ModuleGraphConnection[] | undefined} */
|
69
70
|
let lastList = undefined;
|
70
71
|
for (const connection of set) {
|
71
72
|
const { module } = connection;
|
72
73
|
if (lastModule === module) {
|
73
|
-
|
74
|
+
/** @type {ModuleGraphConnection[]} */
|
75
|
+
(lastList).push(connection);
|
74
76
|
} else {
|
75
77
|
lastModule = module;
|
76
78
|
const list = map.get(module);
|
@@ -99,13 +101,13 @@ class ModuleGraphModule {
|
|
99
101
|
this.optimizationBailout = [];
|
100
102
|
/** @type {ExportsInfo} */
|
101
103
|
this.exports = new ExportsInfo();
|
102
|
-
/** @type {number} */
|
104
|
+
/** @type {number | null} */
|
103
105
|
this.preOrderIndex = null;
|
104
|
-
/** @type {number} */
|
106
|
+
/** @type {number | null} */
|
105
107
|
this.postOrderIndex = null;
|
106
|
-
/** @type {number} */
|
108
|
+
/** @type {number | null} */
|
107
109
|
this.depth = null;
|
108
|
-
/** @type {ModuleProfile} */
|
110
|
+
/** @type {ModuleProfile | undefined | null} */
|
109
111
|
this.profile = undefined;
|
110
112
|
/** @type {boolean} */
|
111
113
|
this.async = false;
|
@@ -116,20 +118,20 @@ class ModuleGraphModule {
|
|
116
118
|
|
117
119
|
class ModuleGraph {
|
118
120
|
constructor() {
|
119
|
-
/** @type {WeakMap<Dependency, ModuleGraphConnection>} */
|
121
|
+
/** @type {WeakMap<Dependency, ModuleGraphConnection | null>} */
|
120
122
|
this._dependencyMap = new WeakMap();
|
121
123
|
/** @type {Map<Module, ModuleGraphModule>} */
|
122
124
|
this._moduleMap = new Map();
|
123
125
|
/** @type {WeakMap<any, Object>} */
|
124
126
|
this._metaMap = new WeakMap();
|
125
127
|
|
126
|
-
/** @type {WeakTupleMap<any[], any>} */
|
128
|
+
/** @type {WeakTupleMap<any[], any> | undefined} */
|
127
129
|
this._cache = undefined;
|
128
130
|
|
129
131
|
/** @type {Map<Module, WeakTupleMap<any, any>>} */
|
130
132
|
this._moduleMemCaches = undefined;
|
131
133
|
|
132
|
-
/** @type {string} */
|
134
|
+
/** @type {string | undefined} */
|
133
135
|
this._cacheStage = undefined;
|
134
136
|
}
|
135
137
|
|
@@ -221,7 +223,9 @@ class ModuleGraph {
|
|
221
223
|
* @returns {void}
|
222
224
|
*/
|
223
225
|
updateModule(dependency, module) {
|
224
|
-
const connection =
|
226
|
+
const connection =
|
227
|
+
/** @type {ModuleGraphConnection} */
|
228
|
+
(this.getConnection(dependency));
|
225
229
|
if (connection.module === module) return;
|
226
230
|
const newConnection = connection.clone();
|
227
231
|
newConnection.module = module;
|
@@ -375,7 +379,7 @@ class ModuleGraph {
|
|
375
379
|
|
376
380
|
/**
|
377
381
|
* @param {Dependency} dependency the dependency to look for a referenced module
|
378
|
-
* @returns {Module} the referenced module
|
382
|
+
* @returns {Module | null} the referenced module
|
379
383
|
*/
|
380
384
|
getResolvedModule(dependency) {
|
381
385
|
const connection = this.getConnection(dependency);
|
@@ -398,7 +402,10 @@ class ModuleGraph {
|
|
398
402
|
) {
|
399
403
|
let foundConnection;
|
400
404
|
for (const connection of mgm._unassignedConnections) {
|
401
|
-
this._dependencyMap.set(
|
405
|
+
this._dependencyMap.set(
|
406
|
+
/** @type {Dependency} */ (connection.dependency),
|
407
|
+
connection
|
408
|
+
);
|
402
409
|
if (connection.dependency === dependency)
|
403
410
|
foundConnection = connection;
|
404
411
|
}
|
@@ -416,7 +423,7 @@ class ModuleGraph {
|
|
416
423
|
|
417
424
|
/**
|
418
425
|
* @param {Dependency} dependency the dependency to look for a referenced module
|
419
|
-
* @returns {Module} the referenced module
|
426
|
+
* @returns {Module | null} the referenced module
|
420
427
|
*/
|
421
428
|
getModule(dependency) {
|
422
429
|
const connection = this.getConnection(dependency);
|
@@ -425,7 +432,7 @@ class ModuleGraph {
|
|
425
432
|
|
426
433
|
/**
|
427
434
|
* @param {Dependency} dependency the dependency to look for a referencing module
|
428
|
-
* @returns {Module} the referencing module
|
435
|
+
* @returns {Module | null} the referencing module
|
429
436
|
*/
|
430
437
|
getOrigin(dependency) {
|
431
438
|
const connection = this.getConnection(dependency);
|
@@ -434,7 +441,7 @@ class ModuleGraph {
|
|
434
441
|
|
435
442
|
/**
|
436
443
|
* @param {Dependency} dependency the dependency to look for a referencing module
|
437
|
-
* @returns {Module} the original referencing module
|
444
|
+
* @returns {Module | null} the original referencing module
|
438
445
|
*/
|
439
446
|
getResolvedOrigin(dependency) {
|
440
447
|
const connection = this.getConnection(dependency);
|
@@ -604,7 +611,7 @@ class ModuleGraph {
|
|
604
611
|
|
605
612
|
/**
|
606
613
|
* @param {Module} module the module
|
607
|
-
* @returns {number} the index of the module
|
614
|
+
* @returns {number | null} the index of the module
|
608
615
|
*/
|
609
616
|
getPreOrderIndex(module) {
|
610
617
|
const mgm = this._getModuleGraphModule(module);
|
@@ -613,7 +620,7 @@ class ModuleGraph {
|
|
613
620
|
|
614
621
|
/**
|
615
622
|
* @param {Module} module the module
|
616
|
-
* @returns {number} the index of the module
|
623
|
+
* @returns {number | null} the index of the module
|
617
624
|
*/
|
618
625
|
getPostOrderIndex(module) {
|
619
626
|
const mgm = this._getModuleGraphModule(module);
|
@@ -670,7 +677,7 @@ class ModuleGraph {
|
|
670
677
|
|
671
678
|
/**
|
672
679
|
* @param {Module} module the module
|
673
|
-
* @returns {number} the depth of the module
|
680
|
+
* @returns {number | null} the depth of the module
|
674
681
|
*/
|
675
682
|
getDepth(module) {
|
676
683
|
const mgm = this._getModuleGraphModule(module);
|
@@ -727,14 +734,14 @@ class ModuleGraph {
|
|
727
734
|
let meta = this._metaMap.get(thing);
|
728
735
|
if (meta === undefined) {
|
729
736
|
meta = Object.create(null);
|
730
|
-
this._metaMap.set(thing, meta);
|
737
|
+
this._metaMap.set(thing, /** @type {Object} */ (meta));
|
731
738
|
}
|
732
|
-
return meta;
|
739
|
+
return /** @type {Object} */ (meta);
|
733
740
|
}
|
734
741
|
|
735
742
|
/**
|
736
743
|
* @param {any} thing any thing
|
737
|
-
* @returns {Object} metadata
|
744
|
+
* @returns {Object | undefined} metadata
|
738
745
|
*/
|
739
746
|
getMetaIfExisting(thing) {
|
740
747
|
return this._metaMap.get(thing);
|
@@ -74,9 +74,9 @@ class ModuleGraphConnection {
|
|
74
74
|
this.weak = weak;
|
75
75
|
this.conditional = !!condition;
|
76
76
|
this._active = condition !== false;
|
77
|
-
/** @type {function(ModuleGraphConnection, RuntimeSpec): ConnectionState} */
|
77
|
+
/** @type {(function(ModuleGraphConnection, RuntimeSpec): ConnectionState) | undefined} */
|
78
78
|
this.condition = condition || undefined;
|
79
|
-
/** @type {Set<string>} */
|
79
|
+
/** @type {Set<string> | undefined} */
|
80
80
|
this.explanations = undefined;
|
81
81
|
if (explanation) {
|
82
82
|
this.explanations = new Set();
|
@@ -107,7 +107,9 @@ class ModuleGraphConnection {
|
|
107
107
|
*/
|
108
108
|
addCondition(condition) {
|
109
109
|
if (this.conditional) {
|
110
|
-
const old =
|
110
|
+
const old =
|
111
|
+
/** @type {(function(ModuleGraphConnection, RuntimeSpec): ConnectionState)} */
|
112
|
+
(this.condition);
|
111
113
|
this.condition = (c, r) =>
|
112
114
|
intersectConnectionStates(old(c, r), condition(c, r));
|
113
115
|
} else if (this._active) {
|
@@ -143,7 +145,12 @@ class ModuleGraphConnection {
|
|
143
145
|
*/
|
144
146
|
isActive(runtime) {
|
145
147
|
if (!this.conditional) return this._active;
|
146
|
-
|
148
|
+
|
149
|
+
return (
|
150
|
+
/** @type {(function(ModuleGraphConnection, RuntimeSpec): ConnectionState)} */ (
|
151
|
+
this.condition
|
152
|
+
)(this, runtime) !== false
|
153
|
+
);
|
147
154
|
}
|
148
155
|
|
149
156
|
/**
|
@@ -152,7 +159,11 @@ class ModuleGraphConnection {
|
|
152
159
|
*/
|
153
160
|
isTargetActive(runtime) {
|
154
161
|
if (!this.conditional) return this._active;
|
155
|
-
return
|
162
|
+
return (
|
163
|
+
/** @type {(function(ModuleGraphConnection, RuntimeSpec): ConnectionState)} */ (
|
164
|
+
this.condition
|
165
|
+
)(this, runtime) === true
|
166
|
+
);
|
156
167
|
}
|
157
168
|
|
158
169
|
/**
|
@@ -161,7 +172,9 @@ class ModuleGraphConnection {
|
|
161
172
|
*/
|
162
173
|
getActiveState(runtime) {
|
163
174
|
if (!this.conditional) return this._active;
|
164
|
-
return
|
175
|
+
return /** @type {(function(ModuleGraphConnection, RuntimeSpec): ConnectionState)} */ (
|
176
|
+
this.condition
|
177
|
+
)(this, runtime);
|
165
178
|
}
|
166
179
|
|
167
180
|
/**
|
@@ -15,10 +15,16 @@ const JavascriptModulesPlugin = require("./javascript/JavascriptModulesPlugin");
|
|
15
15
|
/** @typedef {import("./ExportsInfo")} ExportsInfo */
|
16
16
|
/** @typedef {import("./ExportsInfo").ExportInfo} ExportInfo */
|
17
17
|
/** @typedef {import("./Module")} Module */
|
18
|
+
/** @typedef {import("./Module").BuildMeta} BuildMeta */
|
18
19
|
/** @typedef {import("./ModuleGraph")} ModuleGraph */
|
19
20
|
/** @typedef {import("./ModuleTemplate")} ModuleTemplate */
|
20
21
|
/** @typedef {import("./RequestShortener")} RequestShortener */
|
21
22
|
|
23
|
+
/**
|
24
|
+
* @template T
|
25
|
+
* @param {Iterable<T>} iterable iterable
|
26
|
+
* @returns {string} joined with comma
|
27
|
+
*/
|
22
28
|
const joinIterableWithComma = iterable => {
|
23
29
|
// This is more performant than Array.from().join(", ")
|
24
30
|
// as it doesn't create an array
|
@@ -139,7 +145,7 @@ const printExportsInfoToSource = (
|
|
139
145
|
}
|
140
146
|
};
|
141
147
|
|
142
|
-
/** @type {WeakMap<RequestShortener, WeakMap<Module, { header: RawSource, full: WeakMap<Source, CachedSource> }>>} */
|
148
|
+
/** @type {WeakMap<RequestShortener, WeakMap<Module, { header: RawSource | undefined, full: WeakMap<Source, CachedSource> }>>} */
|
143
149
|
const caches = new WeakMap();
|
144
150
|
|
145
151
|
class ModuleInfoHeaderPlugin {
|
@@ -197,7 +203,8 @@ class ModuleInfoHeaderPlugin {
|
|
197
203
|
}
|
198
204
|
source.add(header);
|
199
205
|
if (verbose) {
|
200
|
-
const exportsType = module.buildMeta
|
206
|
+
const exportsType = /** @type {BuildMeta} */ (module.buildMeta)
|
207
|
+
.exportsType;
|
201
208
|
source.add(
|
202
209
|
Template.toComment(
|
203
210
|
exportsType
|
@@ -43,7 +43,7 @@ const previouslyPolyfilledBuiltinModules = {
|
|
43
43
|
|
44
44
|
class ModuleNotFoundError extends WebpackError {
|
45
45
|
/**
|
46
|
-
* @param {Module} module module tied to dependency
|
46
|
+
* @param {Module | null} module module tied to dependency
|
47
47
|
* @param {Error&any} err error thrown
|
48
48
|
* @param {DependencyLocation} loc location of dependency
|
49
49
|
*/
|
@@ -54,7 +54,10 @@ class ModuleNotFoundError extends WebpackError {
|
|
54
54
|
const match = err.message.match(/Can't resolve '([^']+)'/);
|
55
55
|
if (match) {
|
56
56
|
const request = match[1];
|
57
|
-
const alias =
|
57
|
+
const alias =
|
58
|
+
previouslyPolyfilledBuiltinModules[
|
59
|
+
/** @type {keyof previouslyPolyfilledBuiltinModules} */ (request)
|
60
|
+
];
|
58
61
|
if (alias) {
|
59
62
|
const pathIndex = alias.indexOf("/");
|
60
63
|
const dependency = pathIndex > 0 ? alias.slice(0, pathIndex) : alias;
|
package/lib/ModuleProfile.js
CHANGED
@@ -34,6 +34,7 @@ class ModuleProfile {
|
|
34
34
|
this.storing = 0;
|
35
35
|
this.storingParallelismFactor = 0;
|
36
36
|
|
37
|
+
/** @type {{ start: number, end: number }[] | undefined } */
|
37
38
|
this.additionalFactoryTimes = undefined;
|
38
39
|
this.additionalFactories = 0;
|
39
40
|
this.additionalFactoriesParallelismFactor = 0;
|
@@ -16,6 +16,7 @@ class ModuleRestoreError extends WebpackError {
|
|
16
16
|
*/
|
17
17
|
constructor(module, err) {
|
18
18
|
let message = "Module restore failed: ";
|
19
|
+
/** @type {string | undefined} */
|
19
20
|
let details = undefined;
|
20
21
|
if (err !== null && typeof err === "object") {
|
21
22
|
if (typeof err.stack === "string" && err.stack) {
|
@@ -33,6 +34,7 @@ class ModuleRestoreError extends WebpackError {
|
|
33
34
|
super(message);
|
34
35
|
|
35
36
|
this.name = "ModuleRestoreError";
|
37
|
+
/** @type {string | undefined} */
|
36
38
|
this.details = details;
|
37
39
|
this.module = module;
|
38
40
|
this.error = err;
|
package/lib/ModuleStoreError.js
CHANGED
@@ -16,6 +16,7 @@ class ModuleStoreError extends WebpackError {
|
|
16
16
|
*/
|
17
17
|
constructor(module, err) {
|
18
18
|
let message = "Module storing failed: ";
|
19
|
+
/** @type {string | undefined} */
|
19
20
|
let details = undefined;
|
20
21
|
if (err !== null && typeof err === "object") {
|
21
22
|
if (typeof err.stack === "string" && err.stack) {
|
@@ -33,7 +34,7 @@ class ModuleStoreError extends WebpackError {
|
|
33
34
|
super(message);
|
34
35
|
|
35
36
|
this.name = "ModuleStoreError";
|
36
|
-
this.details = details;
|
37
|
+
this.details = /** @type {string | undefined} */ (details);
|
37
38
|
this.module = module;
|
38
39
|
this.error = err;
|
39
40
|
}
|
@@ -60,6 +60,12 @@ const CSS_MODULE_TYPE_GLOBAL = "css/global";
|
|
60
60
|
*/
|
61
61
|
const CSS_MODULE_TYPE_MODULE = "css/module";
|
62
62
|
|
63
|
+
/**
|
64
|
+
* @type {Readonly<"css/auto">}
|
65
|
+
* This is the module type used for CSS files, the module will be parsed as CSS modules if it's filename contains `.module.` or `.modules.`.
|
66
|
+
*/
|
67
|
+
const CSS_MODULE_TYPE_AUTO = "css/auto";
|
68
|
+
|
63
69
|
/**
|
64
70
|
* @type {Readonly<"asset">}
|
65
71
|
* This is the module type used for automatically choosing between `asset/inline`, `asset/resource` based on asset size limit (8096).
|
@@ -152,6 +158,7 @@ exports.WEBASSEMBLY_MODULE_TYPE_SYNC = WEBASSEMBLY_MODULE_TYPE_SYNC;
|
|
152
158
|
exports.CSS_MODULE_TYPE = CSS_MODULE_TYPE;
|
153
159
|
exports.CSS_MODULE_TYPE_GLOBAL = CSS_MODULE_TYPE_GLOBAL;
|
154
160
|
exports.CSS_MODULE_TYPE_MODULE = CSS_MODULE_TYPE_MODULE;
|
161
|
+
exports.CSS_MODULE_TYPE_AUTO = CSS_MODULE_TYPE_AUTO;
|
155
162
|
exports.WEBPACK_MODULE_TYPE_RUNTIME = WEBPACK_MODULE_TYPE_RUNTIME;
|
156
163
|
exports.WEBPACK_MODULE_TYPE_FALLBACK = WEBPACK_MODULE_TYPE_FALLBACK;
|
157
164
|
exports.WEBPACK_MODULE_TYPE_REMOTE = WEBPACK_MODULE_TYPE_REMOTE;
|
package/lib/MultiWatching.js
CHANGED