webpack 5.98.0 → 5.99.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.
- package/README.md +7 -3
- package/lib/AsyncDependenciesBlock.js +3 -1
- package/lib/BannerPlugin.js +1 -1
- package/lib/Cache.js +9 -7
- package/lib/CacheFacade.js +5 -5
- package/lib/Chunk.js +2 -2
- package/lib/ChunkGraph.js +21 -16
- package/lib/ChunkTemplate.js +6 -6
- package/lib/CleanPlugin.js +10 -10
- package/lib/CodeGenerationResults.js +4 -3
- package/lib/CompatibilityPlugin.js +4 -1
- package/lib/Compilation.js +326 -152
- package/lib/Compiler.js +13 -18
- package/lib/ConditionalInitFragment.js +1 -1
- package/lib/ConstPlugin.js +5 -3
- package/lib/ContextModule.js +4 -2
- package/lib/ContextModuleFactory.js +3 -3
- package/lib/ContextReplacementPlugin.js +43 -16
- package/lib/DefinePlugin.js +25 -24
- package/lib/DelegatedModule.js +4 -2
- package/lib/DelegatedModuleFactoryPlugin.js +2 -1
- package/lib/Dependency.js +19 -13
- package/lib/DependencyTemplates.js +4 -3
- package/lib/DllModule.js +4 -2
- package/lib/DllModuleFactory.js +2 -2
- package/lib/DllReferencePlugin.js +2 -1
- package/lib/DynamicEntryPlugin.js +1 -1
- package/lib/EnvironmentPlugin.js +4 -2
- package/lib/ExportsInfo.js +72 -40
- package/lib/ExternalModule.js +14 -5
- package/lib/ExternalModuleFactoryPlugin.js +24 -12
- package/lib/FileSystemInfo.js +129 -94
- package/lib/FlagDependencyExportsPlugin.js +6 -4
- package/lib/FlagDependencyUsagePlugin.js +1 -1
- package/lib/Generator.js +29 -1
- package/lib/HookWebpackError.js +2 -2
- package/lib/HotModuleReplacementPlugin.js +3 -9
- package/lib/IgnoreErrorModuleFactory.js +2 -2
- package/lib/IgnorePlugin.js +0 -5
- package/lib/InitFragment.js +1 -1
- package/lib/LoaderOptionsPlugin.js +8 -5
- package/lib/MainTemplate.js +7 -7
- package/lib/Module.js +40 -17
- package/lib/ModuleBuildError.js +3 -1
- package/lib/ModuleDependencyError.js +4 -3
- package/lib/ModuleDependencyWarning.js +4 -3
- package/lib/ModuleFactory.js +9 -3
- package/lib/ModuleFilenameHelpers.js +13 -13
- package/lib/ModuleGraph.js +20 -14
- package/lib/ModuleGraphConnection.js +7 -13
- package/lib/ModuleNotFoundError.js +1 -1
- package/lib/ModuleParseError.js +2 -1
- package/lib/ModuleSourceTypesConstants.js +11 -0
- package/lib/ModuleTemplate.js +5 -5
- package/lib/ModuleTypeConstants.js +15 -0
- package/lib/MultiCompiler.js +4 -4
- package/lib/MultiStats.js +1 -1
- package/lib/NormalModule.js +101 -54
- package/lib/NormalModuleFactory.js +38 -33
- package/lib/NormalModuleReplacementPlugin.js +3 -2
- package/lib/NullFactory.js +2 -2
- package/lib/Parser.js +4 -3
- package/lib/ProgressPlugin.js +1 -2
- package/lib/RawModule.js +4 -2
- package/lib/RecordIdsPlugin.js +6 -2
- package/lib/RequestShortener.js +3 -1
- package/lib/ResolverFactory.js +12 -9
- package/lib/RuntimeModule.js +4 -2
- package/lib/RuntimeTemplate.js +2 -1
- package/lib/SelfModuleFactory.js +2 -2
- package/lib/SourceMapDevToolPlugin.js +0 -8
- package/lib/Template.js +6 -5
- package/lib/TemplatedPathPlugin.js +15 -12
- package/lib/WebpackOptionsApply.js +1 -1
- package/lib/asset/AssetGenerator.js +237 -170
- package/lib/asset/AssetModulesPlugin.js +50 -8
- package/lib/asset/AssetSourceGenerator.js +18 -0
- package/lib/asset/RawDataUrlModule.js +4 -2
- package/lib/buildChunkGraph.js +14 -4
- package/lib/cache/MemoryWithGcCachePlugin.js +6 -2
- package/lib/cache/PackFileCacheStrategy.js +137 -121
- package/lib/cache/ResolverCachePlugin.js +15 -7
- package/lib/cache/getLazyHashedEtag.js +4 -3
- package/lib/cli.js +23 -15
- package/lib/config/defaults.js +93 -26
- package/lib/config/normalization.js +14 -13
- package/lib/config/target.js +8 -8
- package/lib/container/ContainerEntryModule.js +4 -2
- package/lib/container/ContainerEntryModuleFactory.js +2 -2
- package/lib/container/FallbackModule.js +4 -2
- package/lib/container/FallbackModuleFactory.js +2 -2
- package/lib/container/RemoteModule.js +4 -2
- package/lib/container/options.js +5 -5
- package/lib/css/CssGenerator.js +71 -9
- package/lib/css/CssModulesPlugin.js +30 -5
- package/lib/css/CssParser.js +37 -17
- package/lib/css/walkCssTokens.js +17 -17
- package/lib/debug/ProfilingPlugin.js +98 -38
- package/lib/dependencies/AMDDefineDependencyParserPlugin.js +10 -4
- package/lib/dependencies/AMDPlugin.js +5 -2
- package/lib/dependencies/AMDRequireArrayDependency.js +4 -3
- package/lib/dependencies/AMDRequireContextDependency.js +2 -1
- package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +15 -7
- package/lib/dependencies/AMDRuntimeModules.js +3 -1
- package/lib/dependencies/CommonJsExportRequireDependency.js +4 -5
- package/lib/dependencies/CommonJsExportsParserPlugin.js +3 -3
- package/lib/dependencies/CommonJsImportsParserPlugin.js +8 -7
- package/lib/dependencies/CommonJsRequireContextDependency.js +2 -1
- package/lib/dependencies/ContextDependencyHelpers.js +13 -6
- package/lib/dependencies/CssIcssExportDependency.js +15 -12
- package/lib/dependencies/CssIcssImportDependency.js +4 -1
- package/lib/dependencies/CssLocalIdentifierDependency.js +17 -14
- package/lib/dependencies/ExportsInfoDependency.js +6 -1
- package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +5 -5
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +22 -15
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +23 -8
- package/lib/dependencies/HarmonyExportSpecifierDependency.js +2 -2
- package/lib/dependencies/HarmonyImportDependency.js +8 -6
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +19 -14
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +5 -5
- package/lib/dependencies/ImportContextDependency.js +2 -1
- package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +8 -4
- package/lib/dependencies/JsonExportsDependency.js +24 -8
- package/lib/dependencies/LoaderPlugin.js +4 -14
- package/lib/dependencies/RequireContextDependency.js +2 -1
- package/lib/dependencies/RequireContextDependencyParserPlugin.js +6 -3
- package/lib/dependencies/RequireEnsureDependenciesBlock.js +3 -2
- package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +11 -5
- package/lib/dependencies/RequireResolveContextDependency.js +1 -1
- package/lib/dependencies/WebAssemblyExportImportedDependency.js +1 -1
- package/lib/dependencies/WorkerDependency.js +6 -3
- package/lib/dependencies/WorkerPlugin.js +100 -41
- package/lib/esm/ModuleChunkFormatPlugin.js +5 -0
- package/lib/hmr/HotModuleReplacement.runtime.js +1 -0
- package/lib/hmr/JavascriptHotModuleReplacement.runtime.js +1 -0
- package/lib/hmr/LazyCompilationPlugin.js +32 -24
- package/lib/hmr/lazyCompilationBackend.js +1 -1
- package/lib/ids/DeterministicModuleIdsPlugin.js +1 -1
- package/lib/ids/HashedModuleIdsPlugin.js +2 -1
- package/lib/ids/IdHelpers.js +15 -14
- package/lib/ids/SyncModuleIdsPlugin.js +9 -5
- package/lib/index.js +5 -5
- package/lib/javascript/BasicEvaluatedExpression.js +6 -6
- package/lib/javascript/JavascriptGenerator.js +11 -1
- package/lib/javascript/JavascriptModulesPlugin.js +51 -31
- package/lib/javascript/JavascriptParser.js +287 -188
- package/lib/javascript/JavascriptParserHelpers.js +10 -9
- package/lib/javascript/StartupHelpers.js +4 -1
- package/lib/json/JsonData.js +4 -4
- package/lib/json/JsonGenerator.js +54 -22
- package/lib/json/JsonModulesPlugin.js +16 -2
- package/lib/json/JsonParser.js +8 -4
- package/lib/library/AbstractLibraryPlugin.js +7 -3
- package/lib/library/AssignLibraryPlugin.js +29 -1
- package/lib/library/EnableLibraryPlugin.js +7 -10
- package/lib/library/ExportPropertyLibraryPlugin.js +4 -1
- package/lib/library/ModuleLibraryPlugin.js +121 -15
- package/lib/logging/Logger.js +2 -2
- package/lib/logging/createConsoleLogger.js +4 -4
- package/lib/node/NodeEnvironmentPlugin.js +6 -2
- package/lib/node/ReadFileCompileAsyncWasmPlugin.js +1 -2
- package/lib/node/ReadFileCompileWasmPlugin.js +1 -2
- package/lib/node/nodeConsole.js +3 -1
- package/lib/optimize/AggressiveSplittingPlugin.js +1 -1
- package/lib/optimize/ConcatenatedModule.js +19 -12
- package/lib/optimize/InnerGraph.js +3 -2
- package/lib/optimize/InnerGraphPlugin.js +13 -7
- package/lib/optimize/LimitChunkCountPlugin.js +20 -0
- package/lib/optimize/ModuleConcatenationPlugin.js +10 -7
- package/lib/optimize/RealContentHashPlugin.js +8 -4
- package/lib/optimize/SideEffectsFlagPlugin.js +4 -2
- package/lib/optimize/SplitChunksPlugin.js +87 -65
- package/lib/rules/BasicEffectRulePlugin.js +9 -1
- package/lib/rules/BasicMatcherRulePlugin.js +15 -4
- package/lib/rules/ObjectMatcherRulePlugin.js +12 -3
- package/lib/rules/RuleSetCompiler.js +25 -14
- package/lib/rules/UseEffectRulePlugin.js +47 -17
- package/lib/runtime/GetChunkFilenameRuntimeModule.js +6 -6
- package/lib/schemes/HttpUriPlugin.js +38 -17
- package/lib/serialization/BinaryMiddleware.js +52 -19
- package/lib/serialization/FileMiddleware.js +78 -48
- package/lib/serialization/ObjectMiddleware.js +78 -29
- package/lib/serialization/PlainObjectSerializer.js +1 -1
- package/lib/serialization/Serializer.js +15 -10
- package/lib/serialization/SerializerMiddleware.js +80 -41
- package/lib/serialization/SingleItemMiddleware.js +10 -7
- package/lib/serialization/types.js +1 -1
- package/lib/sharing/ConsumeSharedModule.js +4 -2
- package/lib/sharing/ProvideSharedModule.js +4 -2
- package/lib/sharing/ProvideSharedModuleFactory.js +5 -3
- package/lib/sharing/utils.js +2 -2
- package/lib/stats/DefaultStatsFactoryPlugin.js +80 -78
- package/lib/stats/DefaultStatsPresetPlugin.js +43 -23
- package/lib/stats/DefaultStatsPrinterPlugin.js +85 -43
- package/lib/stats/StatsFactory.js +11 -11
- package/lib/stats/StatsPrinter.js +7 -7
- package/lib/util/ArrayHelpers.js +2 -4
- package/lib/util/ArrayQueue.js +1 -1
- package/lib/util/AsyncQueue.js +4 -4
- package/lib/util/IterableHelpers.js +1 -1
- package/lib/util/LazyBucketSortedSet.js +41 -23
- package/lib/util/LazySet.js +3 -2
- package/lib/util/MapHelpers.js +1 -1
- package/lib/util/ParallelismFactorCalculator.js +1 -1
- package/lib/util/Semaphore.js +3 -3
- package/lib/util/SetHelpers.js +1 -1
- package/lib/util/SortableSet.js +9 -7
- package/lib/util/TupleQueue.js +9 -8
- package/lib/util/TupleSet.js +2 -2
- package/lib/util/WeakTupleMap.js +12 -11
- package/lib/util/binarySearchBounds.js +2 -1
- package/lib/util/cleverMerge.js +84 -54
- package/lib/util/comparators.js +22 -21
- package/lib/util/compileBooleanMatcher.js +3 -3
- package/lib/util/concatenate.js +6 -4
- package/lib/util/create-schema-validation.js +4 -4
- package/lib/util/createHash.js +2 -2
- package/lib/util/deprecation.js +35 -33
- package/lib/util/deterministicGrouping.js +6 -6
- package/lib/util/findGraphRoots.js +1 -1
- package/lib/util/fs.js +39 -39
- package/lib/util/hash/wasm-hash.js +2 -2
- package/lib/util/identifier.js +15 -18
- package/lib/util/makeSerializable.js +1 -1
- package/lib/util/memoize.js +4 -1
- package/lib/util/objectToMap.js +3 -2
- package/lib/util/processAsyncTree.js +2 -2
- package/lib/util/propertyName.js +0 -1
- package/lib/util/registerExternalSerializer.js +15 -18
- package/lib/util/removeBOM.js +25 -0
- package/lib/util/runtime.js +34 -27
- package/lib/util/serialization.js +5 -16
- package/lib/util/smartGrouping.js +3 -3
- package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +3 -3
- package/lib/wasm-async/AsyncWebAssemblyGenerator.js +11 -0
- package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +10 -0
- package/lib/wasm-async/UniversalCompileAsyncWasmPlugin.js +4 -0
- package/lib/wasm-sync/WebAssemblyGenerator.js +28 -12
- package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +10 -0
- package/lib/wasm-sync/WebAssemblyParser.js +9 -4
- package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +3 -0
- package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +30 -25
- package/package.json +19 -17
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +48 -13
- package/schemas/plugins/JsonModulesPluginGenerator.check.d.ts +7 -0
- package/schemas/plugins/JsonModulesPluginGenerator.check.js +6 -0
- package/schemas/plugins/JsonModulesPluginGenerator.json +11 -0
- package/schemas/plugins/SourceMapDevToolPlugin.json +2 -2
- package/types.d.ts +918 -615
- package/lib/library/ModernModuleLibraryPlugin.js +0 -144
package/lib/Generator.js
CHANGED
@@ -32,7 +32,15 @@
|
|
32
32
|
* @property {ConcatenationScope=} concatenationScope when in concatenated module, information about other concatenated modules
|
33
33
|
* @property {CodeGenerationResults=} codeGenerationResults code generation results of other modules (need to have a codeGenerationDependency to use that)
|
34
34
|
* @property {string} type which kind of code should be generated
|
35
|
-
* @property {
|
35
|
+
* @property {() => Map<string, TODO>=} getData get access to the code generation data
|
36
|
+
*/
|
37
|
+
|
38
|
+
/**
|
39
|
+
* @callback GenerateErrorFn
|
40
|
+
* @param {Error} error the error
|
41
|
+
* @param {NormalModule} module module for which the code should be generated
|
42
|
+
* @param {GenerateContext} generateContext context for generate
|
43
|
+
* @returns {Source | null} generated code
|
36
44
|
*/
|
37
45
|
|
38
46
|
/**
|
@@ -108,6 +116,24 @@ class Generator {
|
|
108
116
|
}
|
109
117
|
}
|
110
118
|
|
119
|
+
/**
|
120
|
+
* @this {ByTypeGenerator}
|
121
|
+
* @type {GenerateErrorFn}
|
122
|
+
*/
|
123
|
+
function generateError(error, module, generateContext) {
|
124
|
+
const type = generateContext.type;
|
125
|
+
const generator =
|
126
|
+
/** @type {Generator & { generateError?: GenerateErrorFn }} */
|
127
|
+
(this.map[type]);
|
128
|
+
if (!generator) {
|
129
|
+
throw new Error(`Generator.byType: no generator specified for ${type}`);
|
130
|
+
}
|
131
|
+
if (typeof generator.generateError === "undefined") {
|
132
|
+
return null;
|
133
|
+
}
|
134
|
+
return generator.generateError(error, module, generateContext);
|
135
|
+
}
|
136
|
+
|
111
137
|
class ByTypeGenerator extends Generator {
|
112
138
|
/**
|
113
139
|
* @param {Record<string, Generator>} map map of types
|
@@ -116,6 +142,8 @@ class ByTypeGenerator extends Generator {
|
|
116
142
|
super();
|
117
143
|
this.map = map;
|
118
144
|
this._types = new Set(Object.keys(map));
|
145
|
+
/** @type {GenerateErrorFn | undefined} */
|
146
|
+
this.generateError = generateError.bind(this);
|
119
147
|
}
|
120
148
|
|
121
149
|
/**
|
package/lib/HookWebpackError.js
CHANGED
@@ -51,7 +51,7 @@ module.exports.makeWebpackError = makeWebpackError;
|
|
51
51
|
|
52
52
|
/**
|
53
53
|
* @template T
|
54
|
-
* @param {
|
54
|
+
* @param {(err: WebpackError | null, result?: T) => void} callback webpack error callback
|
55
55
|
* @param {string} hook name of hook
|
56
56
|
* @returns {Callback<T>} generic callback
|
57
57
|
*/
|
@@ -71,7 +71,7 @@ module.exports.makeWebpackErrorCallback = makeWebpackErrorCallback;
|
|
71
71
|
|
72
72
|
/**
|
73
73
|
* @template T
|
74
|
-
* @param {
|
74
|
+
* @param {() => T} fn function which will be wrapping in try catch
|
75
75
|
* @param {string} hook name of hook
|
76
76
|
* @returns {T} the result
|
77
77
|
*/
|
@@ -50,6 +50,7 @@ const {
|
|
50
50
|
/** @typedef {import("./Chunk").ChunkId} ChunkId */
|
51
51
|
/** @typedef {import("./ChunkGraph").ModuleId} ModuleId */
|
52
52
|
/** @typedef {import("./Compilation").AssetInfo} AssetInfo */
|
53
|
+
/** @typedef {import("./Compilation").Records} Records */
|
53
54
|
/** @typedef {import("./Compiler")} Compiler */
|
54
55
|
/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
|
55
56
|
/** @typedef {import("./Module")} Module */
|
@@ -95,13 +96,6 @@ class HotModuleReplacementPlugin {
|
|
95
96
|
return hooks;
|
96
97
|
}
|
97
98
|
|
98
|
-
/**
|
99
|
-
* @param {object=} options options
|
100
|
-
*/
|
101
|
-
constructor(options) {
|
102
|
-
this.options = options || {};
|
103
|
-
}
|
104
|
-
|
105
99
|
/**
|
106
100
|
* Apply the plugin
|
107
101
|
* @param {Compiler} compiler the compiler instance
|
@@ -390,7 +384,7 @@ class HotModuleReplacementPlugin {
|
|
390
384
|
const nonCodeGeneratedModules = new TupleSet();
|
391
385
|
compilation.hooks.fullHash.tap(PLUGIN_NAME, hash => {
|
392
386
|
const chunkGraph = compilation.chunkGraph;
|
393
|
-
const records = compilation.records;
|
387
|
+
const records = /** @type {Records} */ (compilation.records);
|
394
388
|
for (const chunk of compilation.chunks) {
|
395
389
|
/**
|
396
390
|
* @param {Module} module module
|
@@ -484,7 +478,7 @@ class HotModuleReplacementPlugin {
|
|
484
478
|
},
|
485
479
|
() => {
|
486
480
|
const chunkGraph = compilation.chunkGraph;
|
487
|
-
const records = compilation.records;
|
481
|
+
const records = /** @type {Records} */ (compilation.records);
|
488
482
|
if (records.hash === compilation.hash) return;
|
489
483
|
if (
|
490
484
|
!records.chunkModuleHashes ||
|
@@ -7,8 +7,8 @@
|
|
7
7
|
|
8
8
|
const ModuleFactory = require("./ModuleFactory");
|
9
9
|
|
10
|
+
/** @typedef {import("./ModuleFactory").ModuleFactoryCallback} ModuleFactoryCallback */
|
10
11
|
/** @typedef {import("./ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */
|
11
|
-
/** @typedef {import("./ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */
|
12
12
|
/** @typedef {import("./NormalModuleFactory")} NormalModuleFactory */
|
13
13
|
|
14
14
|
/**
|
@@ -26,7 +26,7 @@ class IgnoreErrorModuleFactory extends ModuleFactory {
|
|
26
26
|
|
27
27
|
/**
|
28
28
|
* @param {ModuleFactoryCreateData} data data object
|
29
|
-
* @param {
|
29
|
+
* @param {ModuleFactoryCallback} callback callback
|
30
30
|
* @returns {void}
|
31
31
|
*/
|
32
32
|
create(data, callback) {
|
package/lib/IgnorePlugin.js
CHANGED
package/lib/InitFragment.js
CHANGED
@@ -64,7 +64,7 @@ class InitFragment {
|
|
64
64
|
|
65
65
|
/**
|
66
66
|
* @param {GenerateContext} context context
|
67
|
-
* @returns {string|Source=} the source code that will be included at the end of the module
|
67
|
+
* @returns {string | Source=} the source code that will be included at the end of the module
|
68
68
|
*/
|
69
69
|
getEndContent(context) {
|
70
70
|
return this.endContent;
|
@@ -11,8 +11,14 @@ const createSchemaValidation = require("./util/create-schema-validation");
|
|
11
11
|
|
12
12
|
/** @typedef {import("../declarations/plugins/LoaderOptionsPlugin").LoaderOptionsPluginOptions} LoaderOptionsPluginOptions */
|
13
13
|
/** @typedef {import("./Compiler")} Compiler */
|
14
|
+
/** @typedef {import("./ModuleFilenameHelpers").Matcher} Matcher */
|
14
15
|
/** @typedef {import("./ModuleFilenameHelpers").MatchObject} MatchObject */
|
15
16
|
|
17
|
+
/**
|
18
|
+
* @template T
|
19
|
+
* @typedef {import("../declarations/LoaderContext").LoaderContext<T>} LoaderContext
|
20
|
+
*/
|
21
|
+
|
16
22
|
const validate = createSchemaValidation(
|
17
23
|
require("../schemas/plugins/LoaderOptionsPlugin.check.js"),
|
18
24
|
() => require("../schemas/plugins/LoaderOptionsPlugin.json"),
|
@@ -31,10 +37,7 @@ class LoaderOptionsPlugin {
|
|
31
37
|
// If no options are set then generate empty options object
|
32
38
|
if (typeof options !== "object") options = {};
|
33
39
|
if (!options.test) {
|
34
|
-
|
35
|
-
// TODO: Figure out how to do `as unknown as RegExp` for this line
|
36
|
-
// in JSDoc equivalent
|
37
|
-
/** @type {any} */
|
40
|
+
/** @type {TODO} */
|
38
41
|
const defaultTrueMockRegExp = {
|
39
42
|
test: () => true
|
40
43
|
};
|
@@ -70,7 +73,7 @@ class LoaderOptionsPlugin {
|
|
70
73
|
continue;
|
71
74
|
}
|
72
75
|
|
73
|
-
/** @type {
|
76
|
+
/** @type {TODO} */
|
74
77
|
(context)[key] = options[key];
|
75
78
|
}
|
76
79
|
}
|
package/lib/MainTemplate.js
CHANGED
@@ -62,7 +62,7 @@ class MainTemplate {
|
|
62
62
|
/**
|
63
63
|
* @template AdditionalOptions
|
64
64
|
* @param {string | Tap & IfSet<AdditionalOptions>} options options
|
65
|
-
* @param {
|
65
|
+
* @param {(renderManifestEntries: RenderManifestEntry[], renderManifestOptions: RenderManifestOptions) => RenderManifestEntry[]} fn fn
|
66
66
|
*/
|
67
67
|
(options, fn) => {
|
68
68
|
compilation.hooks.renderManifest.tap(
|
@@ -96,7 +96,7 @@ class MainTemplate {
|
|
96
96
|
/**
|
97
97
|
* @template AdditionalOptions
|
98
98
|
* @param {string | Tap & IfSet<AdditionalOptions>} options options
|
99
|
-
* @param {
|
99
|
+
* @param {(value: string, renderBootstrapContext: RenderBootstrapContext) => string} fn fn
|
100
100
|
*/
|
101
101
|
(options, fn) => {
|
102
102
|
getJavascriptModulesPlugin()
|
@@ -133,7 +133,7 @@ class MainTemplate {
|
|
133
133
|
/**
|
134
134
|
* @template AdditionalOptions
|
135
135
|
* @param {string | Tap & IfSet<AdditionalOptions>} options options
|
136
|
-
* @param {
|
136
|
+
* @param {(source: Source, chunk: Chunk, hash: string | undefined, moduleTemplate: ModuleTemplate, dependencyTemplates: DependencyTemplates) => Source} fn fn
|
137
137
|
*/
|
138
138
|
(options, fn) => {
|
139
139
|
getJavascriptModulesPlugin()
|
@@ -165,7 +165,7 @@ class MainTemplate {
|
|
165
165
|
/**
|
166
166
|
* @template AdditionalOptions
|
167
167
|
* @param {string | Tap & IfSet<AdditionalOptions>} options options
|
168
|
-
* @param {
|
168
|
+
* @param {(source: Source, chunk: Chunk, hash: string | undefined) => Source} fn fn
|
169
169
|
*/
|
170
170
|
(options, fn) => {
|
171
171
|
getJavascriptModulesPlugin()
|
@@ -191,7 +191,7 @@ class MainTemplate {
|
|
191
191
|
/**
|
192
192
|
* @template AdditionalOptions
|
193
193
|
* @param {string | Tap & IfSet<AdditionalOptions>} options options
|
194
|
-
* @param {
|
194
|
+
* @param {(value: string, path: PathData, assetInfo: AssetInfo | undefined) => string} fn fn
|
195
195
|
*/
|
196
196
|
(options, fn) => {
|
197
197
|
compilation.hooks.assetPath.tap(options, fn);
|
@@ -215,7 +215,7 @@ class MainTemplate {
|
|
215
215
|
/**
|
216
216
|
* @template AdditionalOptions
|
217
217
|
* @param {string | Tap & IfSet<AdditionalOptions>} options options
|
218
|
-
* @param {
|
218
|
+
* @param {(hash: Hash) => void} fn fn
|
219
219
|
*/
|
220
220
|
(options, fn) => {
|
221
221
|
compilation.hooks.fullHash.tap(options, fn);
|
@@ -229,7 +229,7 @@ class MainTemplate {
|
|
229
229
|
/**
|
230
230
|
* @template AdditionalOptions
|
231
231
|
* @param {string | Tap & IfSet<AdditionalOptions>} options options
|
232
|
-
* @param {
|
232
|
+
* @param {(hash: Hash, chunk: Chunk) => void} fn fn
|
233
233
|
*/
|
234
234
|
(options, fn) => {
|
235
235
|
getJavascriptModulesPlugin()
|
package/lib/Module.js
CHANGED
@@ -24,6 +24,7 @@ const makeSerializable = require("./util/makeSerializable");
|
|
24
24
|
/** @typedef {import("./CodeGenerationResults")} CodeGenerationResults */
|
25
25
|
/** @typedef {import("./Compilation")} Compilation */
|
26
26
|
/** @typedef {import("./Compilation").AssetInfo} AssetInfo */
|
27
|
+
/** @typedef {import("./Compilation").UnsafeCacheData} UnsafeCacheData */
|
27
28
|
/** @typedef {import("./ConcatenationScope")} ConcatenationScope */
|
28
29
|
/** @typedef {import("./Dependency")} Dependency */
|
29
30
|
/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */
|
@@ -44,6 +45,7 @@ const makeSerializable = require("./util/makeSerializable");
|
|
44
45
|
/** @template T @typedef {import("./util/LazySet")<T>} LazySet<T> */
|
45
46
|
/** @template T @typedef {import("./util/SortableSet")<T>} SortableSet<T> */
|
46
47
|
/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */
|
48
|
+
/** @typedef {import("./util/identifier").AssociatedObjectForCache} AssociatedObjectForCache */
|
47
49
|
/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */
|
48
50
|
|
49
51
|
/**
|
@@ -84,7 +86,7 @@ const makeSerializable = require("./util/makeSerializable");
|
|
84
86
|
/**
|
85
87
|
* @typedef {object} CodeGenerationResult
|
86
88
|
* @property {Map<string, Source>} sources the resulting sources for all source types
|
87
|
-
* @property {Map<string,
|
89
|
+
* @property {Map<string, TODO>=} data the resulting data for all source types
|
88
90
|
* @property {ReadOnlyRuntimeRequirements | null} runtimeRequirements the runtime requirements
|
89
91
|
* @property {string=} hash a hash of the code generation result (will be automatically calculated from sources and runtimeRequirements if not provided)
|
90
92
|
*/
|
@@ -92,7 +94,7 @@ const makeSerializable = require("./util/makeSerializable");
|
|
92
94
|
/**
|
93
95
|
* @typedef {object} LibIdentOptions
|
94
96
|
* @property {string} context absolute context path to which lib ident is relative to
|
95
|
-
* @property {
|
97
|
+
* @property {AssociatedObjectForCache=} associatedObjectForCache object for caching
|
96
98
|
*/
|
97
99
|
|
98
100
|
/**
|
@@ -103,6 +105,7 @@ const makeSerializable = require("./util/makeSerializable");
|
|
103
105
|
* @property {boolean=} async
|
104
106
|
* @property {boolean=} sideEffectFree
|
105
107
|
* @property {Record<string, string>=} exportsFinalName
|
108
|
+
* @property {boolean=} isCSSModule
|
106
109
|
*/
|
107
110
|
|
108
111
|
/**
|
@@ -133,16 +136,18 @@ const makeSerializable = require("./util/makeSerializable");
|
|
133
136
|
* @property {ValueCacheVersions} valueCacheVersions
|
134
137
|
*/
|
135
138
|
|
136
|
-
/** @typedef {
|
137
|
-
|
139
|
+
/** @typedef {(err?: WebpackError | null, needBuild?: boolean) => void} NeedBuildCallback */
|
140
|
+
|
141
|
+
/** @typedef {(err?: WebpackError) => void} BuildCallback */
|
142
|
+
|
143
|
+
/** @typedef {KnownBuildMeta & Record<string, EXPECTED_ANY>} BuildMeta */
|
144
|
+
/** @typedef {KnownBuildInfo & Record<string, EXPECTED_ANY>} BuildInfo */
|
138
145
|
|
139
146
|
/**
|
140
147
|
* @typedef {object} FactoryMeta
|
141
148
|
* @property {boolean=} sideEffectFree
|
142
149
|
*/
|
143
150
|
|
144
|
-
/** @typedef {{ factoryMeta: FactoryMeta | undefined, resolveOptions: ResolveOptions | undefined }} UnsafeCacheData */
|
145
|
-
|
146
151
|
const EMPTY_RESOLVE_OPTIONS = {};
|
147
152
|
|
148
153
|
let debugId = 1000;
|
@@ -201,6 +206,7 @@ class Module extends DependenciesBlock {
|
|
201
206
|
this.useSimpleSourceMap = false;
|
202
207
|
|
203
208
|
// Is in hot context, i.e. HotModuleReplacementPlugin.js enabled
|
209
|
+
// TODO do we need hot here?
|
204
210
|
/** @type {boolean} */
|
205
211
|
this.hot = false;
|
206
212
|
// Info from Build
|
@@ -778,7 +784,7 @@ class Module extends DependenciesBlock {
|
|
778
784
|
|
779
785
|
/**
|
780
786
|
* @param {NeedBuildContext} context context info
|
781
|
-
* @param {
|
787
|
+
* @param {NeedBuildCallback} callback callback function, returns true, if the module needs a rebuild
|
782
788
|
* @returns {void}
|
783
789
|
*/
|
784
790
|
needBuild(context, callback) {
|
@@ -861,7 +867,7 @@ class Module extends DependenciesBlock {
|
|
861
867
|
* @param {Compilation} compilation the compilation
|
862
868
|
* @param {ResolverWithOptions} resolver the resolver
|
863
869
|
* @param {InputFileSystem} fs the file system
|
864
|
-
* @param {
|
870
|
+
* @param {BuildCallback} callback callback function
|
865
871
|
* @returns {void}
|
866
872
|
*/
|
867
873
|
build(options, compilation, resolver, fs, callback) {
|
@@ -1030,7 +1036,7 @@ class Module extends DependenciesBlock {
|
|
1030
1036
|
|
1031
1037
|
/**
|
1032
1038
|
* restore unsafe cache data
|
1033
|
-
* @param {
|
1039
|
+
* @param {UnsafeCacheData} unsafeCacheData data from getUnsafeCacheData
|
1034
1040
|
* @param {NormalModuleFactory} normalModuleFactory the normal module factory handling the unsafe caching
|
1035
1041
|
*/
|
1036
1042
|
_restoreFromUnsafeCache(unsafeCacheData, normalModuleFactory) {
|
@@ -1122,9 +1128,11 @@ class Module extends DependenciesBlock {
|
|
1122
1128
|
makeSerializable(Module, "webpack/lib/Module");
|
1123
1129
|
|
1124
1130
|
// TODO remove in webpack 6
|
1125
|
-
// eslint-disable-next-line no-warning-comments
|
1126
|
-
// @ts-ignore https://github.com/microsoft/TypeScript/issues/42919
|
1127
1131
|
Object.defineProperty(Module.prototype, "hasEqualsChunks", {
|
1132
|
+
/**
|
1133
|
+
* @deprecated
|
1134
|
+
* @returns {EXPECTED_ANY} throw an error
|
1135
|
+
*/
|
1128
1136
|
get() {
|
1129
1137
|
throw new Error(
|
1130
1138
|
"Module.hasEqualsChunks was renamed (use hasEqualChunks instead)"
|
@@ -1133,9 +1141,11 @@ Object.defineProperty(Module.prototype, "hasEqualsChunks", {
|
|
1133
1141
|
});
|
1134
1142
|
|
1135
1143
|
// TODO remove in webpack 6
|
1136
|
-
// eslint-disable-next-line no-warning-comments
|
1137
|
-
// @ts-ignore https://github.com/microsoft/TypeScript/issues/42919
|
1138
1144
|
Object.defineProperty(Module.prototype, "isUsed", {
|
1145
|
+
/**
|
1146
|
+
* @deprecated
|
1147
|
+
* @returns {EXPECTED_ANY} throw an error
|
1148
|
+
*/
|
1139
1149
|
get() {
|
1140
1150
|
throw new Error(
|
1141
1151
|
"Module.isUsed was renamed (use getUsedName, isExportUsed or isModuleUsed instead)"
|
@@ -1145,10 +1155,14 @@ Object.defineProperty(Module.prototype, "isUsed", {
|
|
1145
1155
|
|
1146
1156
|
// TODO remove in webpack 6
|
1147
1157
|
Object.defineProperty(Module.prototype, "errors", {
|
1158
|
+
/**
|
1159
|
+
* @deprecated
|
1160
|
+
* @returns {WebpackError[]} errors
|
1161
|
+
*/
|
1148
1162
|
get: util.deprecate(
|
1149
1163
|
/**
|
1150
1164
|
* @this {Module}
|
1151
|
-
* @returns {WebpackError[]}
|
1165
|
+
* @returns {WebpackError[]} errors
|
1152
1166
|
*/
|
1153
1167
|
function () {
|
1154
1168
|
if (this._errors === undefined) {
|
@@ -1163,10 +1177,14 @@ Object.defineProperty(Module.prototype, "errors", {
|
|
1163
1177
|
|
1164
1178
|
// TODO remove in webpack 6
|
1165
1179
|
Object.defineProperty(Module.prototype, "warnings", {
|
1180
|
+
/**
|
1181
|
+
* @deprecated
|
1182
|
+
* @returns {WebpackError[]} warnings
|
1183
|
+
*/
|
1166
1184
|
get: util.deprecate(
|
1167
1185
|
/**
|
1168
1186
|
* @this {Module}
|
1169
|
-
* @returns {WebpackError[]}
|
1187
|
+
* @returns {WebpackError[]} warnings
|
1170
1188
|
*/
|
1171
1189
|
function () {
|
1172
1190
|
if (this._warnings === undefined) {
|
@@ -1180,14 +1198,19 @@ Object.defineProperty(Module.prototype, "warnings", {
|
|
1180
1198
|
});
|
1181
1199
|
|
1182
1200
|
// TODO remove in webpack 6
|
1183
|
-
// eslint-disable-next-line no-warning-comments
|
1184
|
-
// @ts-ignore https://github.com/microsoft/TypeScript/issues/42919
|
1185
1201
|
Object.defineProperty(Module.prototype, "used", {
|
1202
|
+
/**
|
1203
|
+
* @deprecated
|
1204
|
+
* @returns {EXPECTED_ANY} throw an error
|
1205
|
+
*/
|
1186
1206
|
get() {
|
1187
1207
|
throw new Error(
|
1188
1208
|
"Module.used was refactored (use ModuleGraph.getUsedExports instead)"
|
1189
1209
|
);
|
1190
1210
|
},
|
1211
|
+
/**
|
1212
|
+
* @param {EXPECTED_ANY} value value
|
1213
|
+
*/
|
1191
1214
|
set(value) {
|
1192
1215
|
throw new Error(
|
1193
1216
|
"Module.used was refactored (use ModuleGraph.setUsedExports instead)"
|
package/lib/ModuleBuildError.js
CHANGED
@@ -12,9 +12,11 @@ const makeSerializable = require("./util/makeSerializable");
|
|
12
12
|
/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
13
13
|
/** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
14
14
|
|
15
|
+
/** @typedef {Error & { hideStack?: boolean }} ErrorWithHideStack */
|
16
|
+
|
15
17
|
class ModuleBuildError extends WebpackError {
|
16
18
|
/**
|
17
|
-
* @param {string |
|
19
|
+
* @param {string | ErrorWithHideStack} err error thrown
|
18
20
|
* @param {{from?: string|null}} info additional info
|
19
21
|
*/
|
20
22
|
constructor(err, { from = null } = {}) {
|
@@ -9,12 +9,13 @@ const WebpackError = require("./WebpackError");
|
|
9
9
|
|
10
10
|
/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
|
11
11
|
/** @typedef {import("./Module")} Module */
|
12
|
+
/** @typedef {import("./ModuleBuildError").ErrorWithHideStack} ErrorWithHideStack */
|
12
13
|
|
13
14
|
class ModuleDependencyError extends WebpackError {
|
14
15
|
/**
|
15
16
|
* Creates an instance of ModuleDependencyError.
|
16
17
|
* @param {Module} module module tied to dependency
|
17
|
-
* @param {
|
18
|
+
* @param {ErrorWithHideStack} err error thrown
|
18
19
|
* @param {DependencyLocation} loc location of dependency
|
19
20
|
*/
|
20
21
|
constructor(module, err, loc) {
|
@@ -22,7 +23,7 @@ class ModuleDependencyError extends WebpackError {
|
|
22
23
|
|
23
24
|
this.name = "ModuleDependencyError";
|
24
25
|
this.details =
|
25
|
-
err && !
|
26
|
+
err && !err.hideStack
|
26
27
|
? /** @type {string} */ (err.stack).split("\n").slice(1).join("\n")
|
27
28
|
: undefined;
|
28
29
|
this.module = module;
|
@@ -30,7 +31,7 @@ class ModuleDependencyError extends WebpackError {
|
|
30
31
|
/** error is not (de)serialized, so it might be undefined after deserialization */
|
31
32
|
this.error = err;
|
32
33
|
|
33
|
-
if (err &&
|
34
|
+
if (err && err.hideStack && err.stack) {
|
34
35
|
this.stack = /** @type {string} */ `${err.stack
|
35
36
|
.split("\n")
|
36
37
|
.slice(1)
|
@@ -10,11 +10,12 @@ const makeSerializable = require("./util/makeSerializable");
|
|
10
10
|
|
11
11
|
/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
|
12
12
|
/** @typedef {import("./Module")} Module */
|
13
|
+
/** @typedef {import("./ModuleDependencyError").ErrorWithHideStack} ErrorWithHideStack */
|
13
14
|
|
14
15
|
class ModuleDependencyWarning extends WebpackError {
|
15
16
|
/**
|
16
17
|
* @param {Module} module module tied to dependency
|
17
|
-
* @param {
|
18
|
+
* @param {ErrorWithHideStack} err error thrown
|
18
19
|
* @param {DependencyLocation} loc location of dependency
|
19
20
|
*/
|
20
21
|
constructor(module, err, loc) {
|
@@ -22,7 +23,7 @@ class ModuleDependencyWarning extends WebpackError {
|
|
22
23
|
|
23
24
|
this.name = "ModuleDependencyWarning";
|
24
25
|
this.details =
|
25
|
-
err && !
|
26
|
+
err && !err.hideStack
|
26
27
|
? /** @type {string} */ (err.stack).split("\n").slice(1).join("\n")
|
27
28
|
: undefined;
|
28
29
|
this.module = module;
|
@@ -30,7 +31,7 @@ class ModuleDependencyWarning extends WebpackError {
|
|
30
31
|
/** error is not (de)serialized, so it might be undefined after deserialization */
|
31
32
|
this.error = err;
|
32
33
|
|
33
|
-
if (err &&
|
34
|
+
if (err && err.hideStack && err.stack) {
|
34
35
|
this.stack = /** @type {string} */ `${err.stack
|
35
36
|
.split("\n")
|
36
37
|
.slice(1)
|
package/lib/ModuleFactory.js
CHANGED
@@ -18,11 +18,13 @@
|
|
18
18
|
* @property {boolean=} cacheable allow to use the unsafe cache
|
19
19
|
*/
|
20
20
|
|
21
|
+
/** @typedef {string | null} IssuerLayer */
|
22
|
+
|
21
23
|
/**
|
22
24
|
* @typedef {object} ModuleFactoryCreateDataContextInfo
|
23
25
|
* @property {string} issuer
|
24
|
-
* @property {
|
25
|
-
* @property {string} compiler
|
26
|
+
* @property {IssuerLayer=} issuerLayer
|
27
|
+
* @property {string=} compiler
|
26
28
|
*/
|
27
29
|
|
28
30
|
/**
|
@@ -33,12 +35,16 @@
|
|
33
35
|
* @property {Dependency[]} dependencies
|
34
36
|
*/
|
35
37
|
|
38
|
+
/**
|
39
|
+
* @typedef {(err?: Error | null, result?: ModuleFactoryResult) => void} ModuleFactoryCallback
|
40
|
+
*/
|
41
|
+
|
36
42
|
class ModuleFactory {
|
37
43
|
/* istanbul ignore next */
|
38
44
|
/**
|
39
45
|
* @abstract
|
40
46
|
* @param {ModuleFactoryCreateData} data data object
|
41
|
-
* @param {
|
47
|
+
* @param {ModuleFactoryCallback} callback callback
|
42
48
|
* @returns {void}
|
43
49
|
*/
|
44
50
|
create(data, callback) {
|
@@ -6,6 +6,7 @@
|
|
6
6
|
"use strict";
|
7
7
|
|
8
8
|
const NormalModule = require("./NormalModule");
|
9
|
+
const { DEFAULTS } = require("./config/defaults");
|
9
10
|
const createHash = require("./util/createHash");
|
10
11
|
const memoize = require("./util/memoize");
|
11
12
|
|
@@ -15,7 +16,7 @@ const memoize = require("./util/memoize");
|
|
15
16
|
/** @typedef {typeof import("./util/Hash")} Hash */
|
16
17
|
|
17
18
|
/** @typedef {string | RegExp | (string | RegExp)[]} Matcher */
|
18
|
-
/** @typedef {{test?: Matcher, include?: Matcher, exclude?: Matcher }} MatchObject */
|
19
|
+
/** @typedef {{ test?: Matcher, include?: Matcher, exclude?: Matcher }} MatchObject */
|
19
20
|
|
20
21
|
const ModuleFilenameHelpers = module.exports;
|
21
22
|
|
@@ -79,7 +80,7 @@ const getBefore = (strFn, token) => () => {
|
|
79
80
|
* @returns {ReturnStringCallback} a function that returns the hash of the string
|
80
81
|
*/
|
81
82
|
const getHash =
|
82
|
-
(strFn, hashFunction =
|
83
|
+
(strFn, hashFunction = DEFAULTS.HASH_FUNCTION) =>
|
83
84
|
() => {
|
84
85
|
const hash = createHash(hashFunction);
|
85
86
|
hash.update(strFn());
|
@@ -92,10 +93,10 @@ const getHash =
|
|
92
93
|
* Returns a lazy object. The object is lazy in the sense that the properties are
|
93
94
|
* only evaluated when they are accessed. This is only obtained by setting a function as the value for each key.
|
94
95
|
* @param {Record<string, () => T>} obj the object to convert to a lazy access object
|
95
|
-
* @returns {
|
96
|
+
* @returns {T} the lazy access object
|
96
97
|
*/
|
97
98
|
const lazyObject = obj => {
|
98
|
-
const newObj = {};
|
99
|
+
const newObj = /** @type {T} */ ({});
|
99
100
|
for (const key of Object.keys(obj)) {
|
100
101
|
const fn = obj[key];
|
101
102
|
Object.defineProperty(newObj, key, {
|
@@ -118,18 +119,15 @@ const SQUARE_BRACKET_TAG_REGEXP = /\[\\*([\w-]+)\\*\]/gi;
|
|
118
119
|
|
119
120
|
/**
|
120
121
|
* @param {Module | string} module the module
|
121
|
-
* @param {TODO} options options
|
122
|
-
* @param {
|
123
|
-
* @param {RequestShortener} contextInfo.requestShortener requestShortener
|
124
|
-
* @param {ChunkGraph} contextInfo.chunkGraph chunk graph
|
125
|
-
* @param {string | Hash=} contextInfo.hashFunction the hash function to use
|
122
|
+
* @param {{ namespace?: string, moduleFilenameTemplate?: string | TODO }} options options
|
123
|
+
* @param {{ requestShortener: RequestShortener, chunkGraph: ChunkGraph, hashFunction?: string | Hash }} contextInfo context info
|
126
124
|
* @returns {string} the filename
|
127
125
|
*/
|
128
126
|
ModuleFilenameHelpers.createFilename = (
|
129
127
|
// eslint-disable-next-line default-param-last
|
130
128
|
module = "",
|
131
129
|
options,
|
132
|
-
{ requestShortener, chunkGraph, hashFunction =
|
130
|
+
{ requestShortener, chunkGraph, hashFunction = DEFAULTS.HASH_FUNCTION }
|
133
131
|
) => {
|
134
132
|
const opts = {
|
135
133
|
namespace: "",
|
@@ -141,6 +139,7 @@ ModuleFilenameHelpers.createFilename = (
|
|
141
139
|
})
|
142
140
|
};
|
143
141
|
|
142
|
+
/** @type {ReturnStringCallback} */
|
144
143
|
let absoluteResourcePath;
|
145
144
|
let hash;
|
146
145
|
/** @type {ReturnStringCallback} */
|
@@ -155,7 +154,8 @@ ModuleFilenameHelpers.createFilename = (
|
|
155
154
|
(memoize(() => requestShortener.shorten(module)));
|
156
155
|
identifier = shortIdentifier;
|
157
156
|
moduleId = () => "";
|
158
|
-
absoluteResourcePath = () =>
|
157
|
+
absoluteResourcePath = () =>
|
158
|
+
/** @type {string} */ (module.split("!").pop());
|
159
159
|
hash = getHash(identifier, hashFunction);
|
160
160
|
} else {
|
161
161
|
shortIdentifier = memoize(() =>
|
@@ -170,7 +170,7 @@ ModuleFilenameHelpers.createFilename = (
|
|
170
170
|
absoluteResourcePath = () =>
|
171
171
|
module instanceof NormalModule
|
172
172
|
? module.resource
|
173
|
-
: module.identifier().split("!").pop();
|
173
|
+
: /** @type {string} */ (module.identifier().split("!").pop());
|
174
174
|
hash = getHash(identifier, hashFunction);
|
175
175
|
}
|
176
176
|
const resource =
|
@@ -203,7 +203,7 @@ ModuleFilenameHelpers.createFilename = (
|
|
203
203
|
}
|
204
204
|
|
205
205
|
// TODO webpack 6: consider removing alternatives without dashes
|
206
|
-
/** @type {Map<string,
|
206
|
+
/** @type {Map<string, () => string>} */
|
207
207
|
const replacements = new Map([
|
208
208
|
["identifier", identifier],
|
209
209
|
["short-identifier", shortIdentifier],
|