webpack 5.100.2 → 5.101.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.
- package/README.md +12 -10
- package/bin/webpack.js +7 -7
- package/lib/APIPlugin.js +12 -14
- package/lib/AutomaticPrefetchPlugin.js +2 -2
- package/lib/BannerPlugin.js +4 -4
- package/lib/Cache.js +1 -1
- package/lib/CacheFacade.js +7 -7
- package/lib/CaseSensitiveModulesWarning.js +2 -2
- package/lib/Chunk.js +3 -3
- package/lib/ChunkGraph.js +21 -18
- package/lib/ChunkGroup.js +4 -4
- package/lib/CleanPlugin.js +19 -53
- package/lib/CodeGenerationResults.js +3 -3
- package/lib/CompatibilityPlugin.js +6 -6
- package/lib/Compilation.js +126 -113
- package/lib/Compiler.js +37 -37
- package/lib/ConcatenationScope.js +39 -1
- package/lib/ConstPlugin.js +11 -11
- package/lib/ContextExclusionPlugin.js +3 -3
- package/lib/ContextModule.js +12 -11
- package/lib/ContextModuleFactory.js +11 -11
- package/lib/ContextReplacementPlugin.js +5 -5
- package/lib/DefinePlugin.js +24 -22
- package/lib/DelegatedModuleFactoryPlugin.js +1 -1
- package/lib/DllEntryPlugin.js +1 -1
- package/lib/DllReferencePlugin.js +1 -1
- package/lib/DynamicEntryPlugin.js +3 -3
- package/lib/EntryPlugin.js +1 -1
- package/lib/EnvironmentPlugin.js +1 -1
- package/lib/ErrorHelpers.js +2 -2
- package/lib/EvalDevToolModulePlugin.js +2 -2
- package/lib/EvalSourceMapDevToolPlugin.js +5 -5
- package/lib/ExportsInfo.js +9 -9
- package/lib/ExportsInfoApiPlugin.js +2 -2
- package/lib/ExternalModule.js +163 -48
- package/lib/ExternalModuleFactoryPlugin.js +2 -2
- package/lib/ExternalsPlugin.js +45 -0
- package/lib/FileSystemInfo.js +64 -61
- package/lib/FlagAllModulesAsUsedPlugin.js +2 -2
- package/lib/FlagDependencyExportsPlugin.js +7 -7
- package/lib/FlagDependencyUsagePlugin.js +4 -4
- package/lib/FlagEntryExportAsUsedPlugin.js +1 -1
- package/lib/HotModuleReplacementPlugin.js +27 -27
- package/lib/IgnorePlugin.js +3 -3
- package/lib/IgnoreWarningsPlugin.js +4 -4
- package/lib/InitFragment.js +6 -0
- package/lib/InvalidDependenciesModuleWarning.js +1 -1
- package/lib/JavascriptMetaInfoPlugin.js +1 -1
- package/lib/LibManifestPlugin.js +2 -2
- package/lib/LoaderOptionsPlugin.js +1 -1
- package/lib/LoaderTargetPlugin.js +2 -2
- package/lib/MainTemplate.js +1 -1
- package/lib/Module.js +1 -1
- package/lib/ModuleFilenameHelpers.js +3 -3
- package/lib/ModuleGraph.js +9 -5
- package/lib/ModuleInfoHeaderPlugin.js +3 -3
- package/lib/ModuleParseError.js +5 -3
- package/lib/MultiCompiler.js +29 -24
- package/lib/MultiStats.js +18 -13
- package/lib/MultiWatching.js +1 -1
- package/lib/NoEmitOnErrorsPlugin.js +2 -2
- package/lib/NodeStuffPlugin.js +27 -15
- package/lib/NormalModule.js +23 -23
- package/lib/NormalModuleFactory.js +23 -21
- package/lib/NormalModuleReplacementPlugin.js +3 -3
- package/lib/PrefetchPlugin.js +1 -1
- package/lib/ProgressPlugin.js +11 -11
- package/lib/ProvidePlugin.js +2 -2
- package/lib/RecordIdsPlugin.js +3 -3
- package/lib/ResolverFactory.js +3 -3
- package/lib/RuntimeGlobals.js +20 -0
- package/lib/RuntimePlugin.js +16 -16
- package/lib/RuntimeTemplate.js +35 -26
- package/lib/SizeFormatHelpers.js +1 -1
- package/lib/SourceMapDevToolModuleOptionsPlugin.js +4 -4
- package/lib/SourceMapDevToolPlugin.js +9 -9
- package/lib/Stats.js +2 -2
- package/lib/Template.js +1 -1
- package/lib/TemplatedPathPlugin.js +2 -2
- package/lib/UseStrictPlugin.js +1 -1
- package/lib/WarnCaseSensitiveModulesPlugin.js +1 -1
- package/lib/WarnDeprecatedOptionPlugin.js +1 -1
- package/lib/WarnNoModeSetPlugin.js +1 -1
- package/lib/WatchIgnorePlugin.js +2 -2
- package/lib/Watching.js +12 -12
- package/lib/WebpackIsIncludedPlugin.js +2 -2
- package/lib/WebpackOptionsApply.js +3 -3
- package/lib/asset/AssetGenerator.js +1 -1
- package/lib/asset/AssetModulesPlugin.js +6 -6
- package/lib/async-modules/AsyncModuleHelpers.js +1 -1
- package/lib/async-modules/AwaitDependenciesInitFragment.js +36 -24
- package/lib/async-modules/InferAsyncModulesPlugin.js +3 -3
- package/lib/buildChunkGraph.js +5 -5
- package/lib/cache/AddBuildDependenciesPlugin.js +1 -1
- package/lib/cache/IdleFileCachePlugin.js +5 -5
- package/lib/cache/PackFileCacheStrategy.js +20 -20
- package/lib/cache/ResolverCachePlugin.js +4 -4
- package/lib/cli.js +196 -14
- package/lib/config/browserslistTargetHandler.js +6 -6
- package/lib/config/defaults.js +23 -14
- package/lib/config/normalization.js +41 -38
- package/lib/config/target.js +4 -4
- package/lib/container/ContainerEntryModule.js +3 -3
- package/lib/container/ContainerPlugin.js +3 -3
- package/lib/container/ContainerReferencePlugin.js +3 -3
- package/lib/container/FallbackModule.js +1 -1
- package/lib/container/HoistContainerReferencesPlugin.js +7 -7
- package/lib/container/options.js +4 -4
- package/lib/css/CssGenerator.js +5 -3
- package/lib/css/CssLoadingRuntimeModule.js +1 -1
- package/lib/css/CssModulesPlugin.js +25 -22
- package/lib/css/CssParser.js +5 -5
- package/lib/css/walkCssTokens.js +9 -9
- package/lib/debug/ProfilingPlugin.js +5 -5
- package/lib/dependencies/AMDDefineDependencyParserPlugin.js +4 -4
- package/lib/dependencies/AMDPlugin.js +3 -3
- package/lib/dependencies/AMDRequireArrayDependency.js +1 -1
- package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +3 -3
- package/lib/dependencies/CommonJsExportRequireDependency.js +2 -2
- package/lib/dependencies/CommonJsExportsParserPlugin.js +12 -10
- package/lib/dependencies/CommonJsImportsParserPlugin.js +21 -19
- package/lib/dependencies/CommonJsPlugin.js +2 -2
- package/lib/dependencies/ContextDependency.js +1 -1
- package/lib/dependencies/ContextDependencyHelpers.js +3 -3
- package/lib/dependencies/CssIcssExportDependency.js +2 -2
- package/lib/dependencies/CssLocalIdentifierDependency.js +2 -2
- package/lib/dependencies/CssUrlDependency.js +4 -4
- package/lib/dependencies/DynamicExports.js +5 -5
- package/lib/dependencies/HarmonyAcceptDependency.js +39 -5
- package/lib/dependencies/HarmonyDetectionParserPlugin.js +2 -2
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +17 -13
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +7 -8
- package/lib/dependencies/HarmonyExportInitFragment.js +1 -1
- package/lib/dependencies/HarmonyExports.js +1 -1
- package/lib/dependencies/HarmonyImportDependency.js +28 -9
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +56 -48
- package/lib/dependencies/HarmonyImportSideEffectDependency.js +4 -5
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +3 -4
- package/lib/dependencies/HarmonyModulesPlugin.js +2 -8
- package/lib/dependencies/HarmonyTopLevelThisParserPlugin.js +1 -1
- package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +4 -4
- package/lib/dependencies/ImportMetaPlugin.js +7 -7
- package/lib/dependencies/ImportParserPlugin.js +4 -4
- package/lib/dependencies/JsonExportsDependency.js +1 -1
- package/lib/dependencies/LoaderPlugin.js +4 -4
- package/lib/dependencies/ProvidedDependency.js +2 -2
- package/lib/dependencies/PureExpressionDependency.js +1 -1
- package/lib/dependencies/RequireContextDependencyParserPlugin.js +1 -1
- package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +1 -1
- package/lib/dependencies/RequireIncludeDependencyParserPlugin.js +3 -3
- package/lib/dependencies/SystemPlugin.js +3 -3
- package/lib/dependencies/WorkerPlugin.js +5 -5
- package/lib/dependencies/getFunctionExpression.js +1 -1
- package/lib/esm/ModuleChunkFormatPlugin.js +5 -5
- package/lib/esm/ModuleChunkLoadingPlugin.js +2 -2
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +15 -11
- package/lib/formatLocation.js +2 -2
- package/lib/hmr/HotModuleReplacement.runtime.js +39 -27
- package/lib/hmr/JavascriptHotModuleReplacement.runtime.js +43 -32
- package/lib/hmr/JavascriptHotModuleReplacementHelper.js +1 -1
- package/lib/hmr/LazyCompilationPlugin.js +6 -6
- package/lib/hmr/lazyCompilationBackend.js +6 -6
- package/lib/ids/ChunkModuleIdRangePlugin.js +4 -4
- package/lib/ids/DeterministicChunkIdsPlugin.js +5 -4
- package/lib/ids/DeterministicModuleIdsPlugin.js +2 -2
- package/lib/ids/HashedModuleIdsPlugin.js +1 -1
- package/lib/ids/IdHelpers.js +9 -9
- package/lib/ids/NamedChunkIdsPlugin.js +5 -5
- package/lib/ids/NamedModuleIdsPlugin.js +2 -2
- package/lib/ids/NaturalChunkIdsPlugin.js +2 -2
- package/lib/ids/NaturalModuleIdsPlugin.js +1 -1
- package/lib/ids/OccurrenceChunkIdsPlugin.js +2 -2
- package/lib/ids/OccurrenceModuleIdsPlugin.js +4 -4
- package/lib/ids/SyncModuleIdsPlugin.js +4 -4
- package/lib/index.js +10 -6
- package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +1 -1
- package/lib/javascript/BasicEvaluatedExpression.js +3 -3
- package/lib/javascript/CommonJsChunkFormatPlugin.js +1 -1
- package/lib/javascript/EnableChunkLoadingPlugin.js +1 -1
- package/lib/javascript/JavascriptGenerator.js +1 -1
- package/lib/javascript/JavascriptModulesPlugin.js +16 -16
- package/lib/javascript/JavascriptParser.js +80 -78
- package/lib/javascript/JavascriptParserHelpers.js +3 -3
- package/lib/javascript/StartupHelpers.js +2 -2
- package/lib/json/JsonGenerator.js +2 -2
- package/lib/json/JsonModulesPlugin.js +2 -2
- package/lib/library/AbstractLibraryPlugin.js +3 -3
- package/lib/library/AmdLibraryPlugin.js +3 -3
- package/lib/library/AssignLibraryPlugin.js +2 -2
- package/lib/library/EnableLibraryPlugin.js +2 -2
- package/lib/library/ModuleLibraryPlugin.js +7 -2
- package/lib/library/SystemLibraryPlugin.js +6 -4
- package/lib/library/UmdLibraryPlugin.js +14 -14
- package/lib/logging/createConsoleLogger.js +4 -4
- package/lib/logging/runtime.js +3 -3
- package/lib/logging/truncateArgs.js +4 -4
- package/lib/node/CommonJsChunkLoadingPlugin.js +2 -2
- package/lib/node/NodeEnvironmentPlugin.js +1 -1
- package/lib/node/ReadFileChunkLoadingRuntimeModule.js +16 -14
- package/lib/node/ReadFileCompileAsyncWasmPlugin.js +7 -7
- package/lib/node/ReadFileCompileWasmPlugin.js +7 -7
- package/lib/node/RequireChunkLoadingRuntimeModule.js +6 -4
- package/lib/node/nodeConsole.js +2 -2
- package/lib/optimize/AggressiveMergingPlugin.js +2 -2
- package/lib/optimize/AggressiveSplittingPlugin.js +10 -10
- package/lib/optimize/ConcatenatedModule.js +161 -52
- package/lib/optimize/EnsureChunkConditionsPlugin.js +2 -2
- package/lib/optimize/FlagIncludedChunksPlugin.js +2 -2
- package/lib/optimize/InnerGraph.js +5 -5
- package/lib/optimize/InnerGraphPlugin.js +14 -12
- package/lib/optimize/LimitChunkCountPlugin.js +5 -5
- package/lib/optimize/MangleExportsPlugin.js +5 -5
- package/lib/optimize/MergeDuplicateChunksPlugin.js +2 -2
- package/lib/optimize/MinChunkSizePlugin.js +3 -3
- package/lib/optimize/ModuleConcatenationPlugin.js +45 -38
- package/lib/optimize/RealContentHashPlugin.js +23 -23
- package/lib/optimize/RemoveEmptyChunksPlugin.js +2 -2
- package/lib/optimize/RemoveParentModulesPlugin.js +3 -3
- package/lib/optimize/RuntimeChunkPlugin.js +2 -2
- package/lib/optimize/SideEffectsFlagPlugin.js +5 -5
- package/lib/optimize/SplitChunksPlugin.js +20 -20
- package/lib/performance/AssetsOverSizeLimitWarning.js +1 -1
- package/lib/performance/EntrypointsOverSizeLimitWarning.js +2 -2
- package/lib/performance/SizeLimitsPlugin.js +4 -4
- package/lib/prefetch/ChunkPrefetchPreloadPlugin.js +1 -1
- package/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js +3 -3
- package/lib/rules/BasicMatcherRulePlugin.js +1 -1
- package/lib/rules/RuleSetCompiler.js +10 -10
- package/lib/rules/UseEffectRulePlugin.js +2 -2
- package/lib/runtime/GetChunkFilenameRuntimeModule.js +15 -15
- package/lib/runtime/GetMainFilenameRuntimeModule.js +1 -1
- package/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +1 -1
- package/lib/runtime/MakeDeferredNamespaceObjectRuntime.js +1 -1
- package/lib/runtime/StartupChunkDependenciesPlugin.js +2 -2
- package/lib/runtime/StartupChunkDependenciesRuntimeModule.js +3 -3
- package/lib/schemes/DataUriPlugin.js +3 -3
- package/lib/schemes/FileUriPlugin.js +1 -1
- package/lib/schemes/HttpUriPlugin.js +40 -36
- package/lib/schemes/VirtualUrlPlugin.js +1 -1
- package/lib/serialization/BinaryMiddleware.js +11 -11
- package/lib/serialization/FileMiddleware.js +17 -17
- package/lib/serialization/ObjectMiddleware.js +8 -8
- package/lib/serialization/Serializer.js +2 -2
- package/lib/serialization/SerializerMiddleware.js +2 -2
- package/lib/sharing/ConsumeSharedPlugin.js +4 -4
- package/lib/sharing/ProvideSharedPlugin.js +4 -4
- package/lib/sharing/SharePlugin.js +1 -1
- package/lib/sharing/resolveMatchedConfigs.js +1 -1
- package/lib/stats/DefaultStatsFactoryPlugin.js +85 -80
- package/lib/stats/DefaultStatsPresetPlugin.js +15 -15
- package/lib/stats/DefaultStatsPrinterPlugin.js +87 -87
- package/lib/stats/StatsFactory.js +7 -7
- package/lib/stats/StatsPrinter.js +9 -9
- package/lib/url/URLParserPlugin.js +5 -5
- package/lib/util/AsyncQueue.js +4 -4
- package/lib/util/IterableHelpers.js +2 -2
- package/lib/util/LazyBucketSortedSet.js +3 -3
- package/lib/util/SetHelpers.js +2 -2
- package/lib/util/StackedCacheMap.js +1 -1
- package/lib/util/StackedMap.js +1 -1
- package/lib/util/TupleSet.js +1 -1
- package/lib/util/WeakTupleMap.js +1 -1
- package/lib/util/cleverMerge.js +8 -8
- package/lib/util/comparators.js +10 -10
- package/lib/util/compileBooleanMatcher.js +20 -20
- package/lib/util/concatenate.js +3 -3
- package/lib/util/conventions.js +4 -4
- package/lib/util/create-schema-validation.js +1 -1
- package/lib/util/createHash.js +1 -1
- package/lib/util/deprecation.js +4 -4
- package/lib/util/deterministicGrouping.js +7 -7
- package/lib/util/findGraphRoots.js +1 -1
- package/lib/util/fs.js +3 -3
- package/lib/util/identifier.js +14 -14
- package/lib/util/magicComment.js +5 -1
- package/lib/util/memoize.js +1 -1
- package/lib/util/processAsyncTree.js +2 -2
- package/lib/util/propertyName.js +1 -1
- package/lib/util/removeBOM.js +1 -1
- package/lib/util/runtime.js +6 -6
- package/lib/util/semver.js +16 -16
- package/lib/util/serialization.js +5 -5
- package/lib/util/smartGrouping.js +1 -1
- package/lib/validateSchema.js +2 -2
- package/lib/wasm/EnableWasmLoadingPlugin.js +1 -1
- package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +1 -1
- package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +1 -1
- package/lib/wasm-async/UniversalCompileAsyncWasmPlugin.js +4 -4
- package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +13 -9
- package/lib/wasm-sync/WasmFinalizeExportsPlugin.js +2 -2
- package/lib/wasm-sync/WebAssemblyGenerator.js +14 -14
- package/lib/wasm-sync/WebAssemblyInInitialChunkError.js +4 -2
- package/lib/wasm-sync/WebAssemblyParser.js +2 -2
- package/lib/web/FetchCompileAsyncWasmPlugin.js +4 -4
- package/lib/web/FetchCompileWasmPlugin.js +4 -4
- package/lib/web/JsonpChunkLoadingPlugin.js +2 -2
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +1 -1
- package/lib/webpack.js +17 -12
- package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +2 -2
- package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +1 -1
- package/package.json +13 -13
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +4 -0
- package/types.d.ts +151 -44
package/lib/RuntimeTemplate.js
CHANGED
|
@@ -49,12 +49,12 @@ This should not happen.
|
|
|
49
49
|
It's in these chunks: ${
|
|
50
50
|
Array.from(
|
|
51
51
|
chunkGraph.getModuleChunksIterable(module),
|
|
52
|
-
c => c.name || c.id || c.debugId
|
|
52
|
+
(c) => c.name || c.id || c.debugId
|
|
53
53
|
).join(", ") || "none"
|
|
54
54
|
} (If module is in no chunk this indicates a bug in some chunk/module optimization logic)
|
|
55
55
|
Module has these incoming connections: ${Array.from(
|
|
56
56
|
chunkGraph.moduleGraph.getIncomingConnections(module),
|
|
57
|
-
connection =>
|
|
57
|
+
(connection) =>
|
|
58
58
|
`\n - ${
|
|
59
59
|
connection.originModule && connection.originModule.identifier()
|
|
60
60
|
} ${connection.dependency && connection.dependency.type} ${
|
|
@@ -162,6 +162,16 @@ class RuntimeTemplate {
|
|
|
162
162
|
return this.outputOptions.environment.nodePrefixForCoreModules;
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
+
/**
|
|
166
|
+
* @param {string} mod a module
|
|
167
|
+
* @returns {string} a module with `node:` prefix when supported, otherwise an original name
|
|
168
|
+
*/
|
|
169
|
+
renderNodePrefixForCoreModule(mod) {
|
|
170
|
+
return this.outputOptions.environment.nodePrefixForCoreModules
|
|
171
|
+
? `"node:${mod}"`
|
|
172
|
+
: `"${mod}"`;
|
|
173
|
+
}
|
|
174
|
+
|
|
165
175
|
/**
|
|
166
176
|
* @param {string} returnValue return value
|
|
167
177
|
* @param {string} args arguments
|
|
@@ -229,7 +239,7 @@ class RuntimeTemplate {
|
|
|
229
239
|
if (concatenationCost <= templateCost) return this._es5Concatenation(args);
|
|
230
240
|
|
|
231
241
|
return `\`${args
|
|
232
|
-
.map(arg => (typeof arg === "string" ? arg : `\${${arg.expr}}`))
|
|
242
|
+
.map((arg) => (typeof arg === "string" ? arg : `\${${arg.expr}}`))
|
|
233
243
|
.join("")}\``;
|
|
234
244
|
}
|
|
235
245
|
|
|
@@ -240,7 +250,7 @@ class RuntimeTemplate {
|
|
|
240
250
|
*/
|
|
241
251
|
_es5Concatenation(args) {
|
|
242
252
|
const str = args
|
|
243
|
-
.map(arg => (typeof arg === "string" ? JSON.stringify(arg) : arg.expr))
|
|
253
|
+
.map((arg) => (typeof arg === "string" ? JSON.stringify(arg) : arg.expr))
|
|
244
254
|
.join(" + ");
|
|
245
255
|
|
|
246
256
|
// when the first two args are expression, we need to prepend "" + to force string
|
|
@@ -290,7 +300,9 @@ class RuntimeTemplate {
|
|
|
290
300
|
return this.supportsDestructuring()
|
|
291
301
|
? `var {${items.join(", ")}} = ${value};`
|
|
292
302
|
: Template.asString(
|
|
293
|
-
items.map(
|
|
303
|
+
items.map(
|
|
304
|
+
(item) => `var ${item} = ${value}${propertyAccess([item])};`
|
|
305
|
+
)
|
|
294
306
|
);
|
|
295
307
|
}
|
|
296
308
|
|
|
@@ -332,12 +344,12 @@ class RuntimeTemplate {
|
|
|
332
344
|
if (this.outputOptions.pathinfo) {
|
|
333
345
|
content = [message, request, chunkName, chunkReason]
|
|
334
346
|
.filter(Boolean)
|
|
335
|
-
.map(item => this.requestShortener.shorten(item))
|
|
347
|
+
.map((item) => this.requestShortener.shorten(item))
|
|
336
348
|
.join(" | ");
|
|
337
349
|
} else {
|
|
338
350
|
content = [message, chunkName, chunkReason]
|
|
339
351
|
.filter(Boolean)
|
|
340
|
-
.map(item => this.requestShortener.shorten(item))
|
|
352
|
+
.map((item) => this.requestShortener.shorten(item))
|
|
341
353
|
.join(" | ");
|
|
342
354
|
}
|
|
343
355
|
if (!content) return "";
|
|
@@ -763,14 +775,14 @@ class RuntimeTemplate {
|
|
|
763
775
|
if (typeof runtimeCondition === "boolean") return `${runtimeCondition}`;
|
|
764
776
|
/** @type {Set<string>} */
|
|
765
777
|
const positiveRuntimeIds = new Set();
|
|
766
|
-
forEachRuntime(runtimeCondition, runtime =>
|
|
778
|
+
forEachRuntime(runtimeCondition, (runtime) =>
|
|
767
779
|
positiveRuntimeIds.add(
|
|
768
780
|
`${chunkGraph.getRuntimeId(/** @type {string} */ (runtime))}`
|
|
769
781
|
)
|
|
770
782
|
);
|
|
771
783
|
/** @type {Set<string>} */
|
|
772
784
|
const negativeRuntimeIds = new Set();
|
|
773
|
-
forEachRuntime(subtractRuntime(runtime, runtimeCondition), runtime =>
|
|
785
|
+
forEachRuntime(subtractRuntime(runtime, runtimeCondition), (runtime) =>
|
|
774
786
|
negativeRuntimeIds.add(
|
|
775
787
|
`${chunkGraph.getRuntimeId(/** @type {string} */ (runtime))}`
|
|
776
788
|
)
|
|
@@ -817,13 +829,6 @@ class RuntimeTemplate {
|
|
|
817
829
|
];
|
|
818
830
|
}
|
|
819
831
|
|
|
820
|
-
defer = defer && (module.buildMeta ? !module.buildMeta.async : true);
|
|
821
|
-
|
|
822
|
-
/** @type {Set<Module>} */
|
|
823
|
-
const outgoingAsyncModules = defer
|
|
824
|
-
? getOutgoingAsyncModules(moduleGraph, module)
|
|
825
|
-
: new Set();
|
|
826
|
-
|
|
827
832
|
if (chunkGraph.getModuleId(module) === null) {
|
|
828
833
|
if (weak) {
|
|
829
834
|
// only weak referenced modules don't get an id
|
|
@@ -860,12 +865,15 @@ class RuntimeTemplate {
|
|
|
860
865
|
);
|
|
861
866
|
runtimeRequirements.add(RuntimeGlobals.require);
|
|
862
867
|
let importContent;
|
|
863
|
-
if (defer) {
|
|
868
|
+
if (defer && !(/** @type {BuildMeta} */ (module.buildMeta).async)) {
|
|
869
|
+
/** @type {Set<Module>} */
|
|
870
|
+
const outgoingAsyncModules = getOutgoingAsyncModules(moduleGraph, module);
|
|
871
|
+
|
|
864
872
|
importContent = `/* deferred harmony import */ ${optDeclaration}${importVar} = ${getOptimizedDeferredModule(
|
|
865
873
|
this,
|
|
866
874
|
exportsType,
|
|
867
875
|
moduleId,
|
|
868
|
-
Array.from(outgoingAsyncModules, mod => chunkGraph.getModuleId(mod))
|
|
876
|
+
Array.from(outgoingAsyncModules, (mod) => chunkGraph.getModuleId(mod))
|
|
869
877
|
)};\n`;
|
|
870
878
|
|
|
871
879
|
return [importContent, ""];
|
|
@@ -924,8 +932,6 @@ class RuntimeTemplate {
|
|
|
924
932
|
request
|
|
925
933
|
});
|
|
926
934
|
}
|
|
927
|
-
|
|
928
|
-
defer = defer && (module.buildMeta ? !module.buildMeta.async : true);
|
|
929
935
|
if (!Array.isArray(exportName)) {
|
|
930
936
|
exportName = exportName ? [exportName] : [];
|
|
931
937
|
}
|
|
@@ -935,10 +941,13 @@ class RuntimeTemplate {
|
|
|
935
941
|
(originModule.buildMeta).strictHarmonyModule
|
|
936
942
|
);
|
|
937
943
|
|
|
944
|
+
const isDeferred =
|
|
945
|
+
defer && !(/** @type {BuildMeta} */ (module.buildMeta).async);
|
|
946
|
+
|
|
938
947
|
if (defaultInterop) {
|
|
939
948
|
// when the defaultInterop is used (when a ESM imports a CJS module),
|
|
940
949
|
if (exportName.length > 0 && exportName[0] === "default") {
|
|
941
|
-
if (
|
|
950
|
+
if (isDeferred && exportsType !== "namespace") {
|
|
942
951
|
const access = `${importVar}.a${propertyAccess(exportName, 1)}`;
|
|
943
952
|
if (isCall || asiSafe === undefined) {
|
|
944
953
|
return access;
|
|
@@ -983,7 +992,7 @@ class RuntimeTemplate {
|
|
|
983
992
|
) {
|
|
984
993
|
return "/* __esModule */true";
|
|
985
994
|
}
|
|
986
|
-
} else if (
|
|
995
|
+
} else if (isDeferred) {
|
|
987
996
|
// now exportName.length is 0
|
|
988
997
|
// fall through to the end of this function, create the namespace there.
|
|
989
998
|
} else if (
|
|
@@ -1026,7 +1035,7 @@ class RuntimeTemplate {
|
|
|
1026
1035
|
? ""
|
|
1027
1036
|
: `${Template.toNormalComment(propertyAccess(exportName))} `;
|
|
1028
1037
|
const access = `${importVar}${
|
|
1029
|
-
|
|
1038
|
+
isDeferred ? ".a" : ""
|
|
1030
1039
|
}${comment}${propertyAccess(used)}`;
|
|
1031
1040
|
if (isCall && callContext === false) {
|
|
1032
1041
|
return asiSafe
|
|
@@ -1037,7 +1046,7 @@ class RuntimeTemplate {
|
|
|
1037
1046
|
}
|
|
1038
1047
|
return access;
|
|
1039
1048
|
}
|
|
1040
|
-
if (
|
|
1049
|
+
if (isDeferred) {
|
|
1041
1050
|
initFragments.push(
|
|
1042
1051
|
new InitFragment(
|
|
1043
1052
|
`var ${importVar}_deferred_namespace_cache;\n`,
|
|
@@ -1087,7 +1096,7 @@ class RuntimeTemplate {
|
|
|
1087
1096
|
return `Promise.resolve(${comment.trim()})`;
|
|
1088
1097
|
}
|
|
1089
1098
|
const chunks = chunkGroup.chunks.filter(
|
|
1090
|
-
chunk => !chunk.hasRuntime() && chunk.id !== null
|
|
1099
|
+
(chunk) => !chunk.hasRuntime() && chunk.id !== null
|
|
1091
1100
|
);
|
|
1092
1101
|
const comment = this.comment({
|
|
1093
1102
|
message,
|
|
@@ -1119,7 +1128,7 @@ class RuntimeTemplate {
|
|
|
1119
1128
|
* @param {Chunk} chunk chunk
|
|
1120
1129
|
* @returns {string} require chunk id code
|
|
1121
1130
|
*/
|
|
1122
|
-
const requireChunkId = chunk =>
|
|
1131
|
+
const requireChunkId = (chunk) =>
|
|
1123
1132
|
`${RuntimeGlobals.ensureChunk}(${JSON.stringify(chunk.id)}${
|
|
1124
1133
|
fetchPriority ? `, ${JSON.stringify(fetchPriority)}` : ""
|
|
1125
1134
|
})`;
|
package/lib/SizeFormatHelpers.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @param {number} size the size in bytes
|
|
10
10
|
* @returns {string} the formatted size
|
|
11
11
|
*/
|
|
12
|
-
module.exports.formatSize = size => {
|
|
12
|
+
module.exports.formatSize = (size) => {
|
|
13
13
|
if (typeof size !== "number" || Number.isNaN(size) === true) {
|
|
14
14
|
return "unknown size";
|
|
15
15
|
}
|
|
@@ -27,17 +27,17 @@ class SourceMapDevToolModuleOptionsPlugin {
|
|
|
27
27
|
apply(compilation) {
|
|
28
28
|
const options = this.options;
|
|
29
29
|
if (options.module !== false) {
|
|
30
|
-
compilation.hooks.buildModule.tap(PLUGIN_NAME, module => {
|
|
30
|
+
compilation.hooks.buildModule.tap(PLUGIN_NAME, (module) => {
|
|
31
31
|
module.useSourceMap = true;
|
|
32
32
|
});
|
|
33
|
-
compilation.hooks.runtimeModule.tap(PLUGIN_NAME, module => {
|
|
33
|
+
compilation.hooks.runtimeModule.tap(PLUGIN_NAME, (module) => {
|
|
34
34
|
module.useSourceMap = true;
|
|
35
35
|
});
|
|
36
36
|
} else {
|
|
37
|
-
compilation.hooks.buildModule.tap(PLUGIN_NAME, module => {
|
|
37
|
+
compilation.hooks.buildModule.tap(PLUGIN_NAME, (module) => {
|
|
38
38
|
module.useSimpleSourceMap = true;
|
|
39
39
|
});
|
|
40
|
-
compilation.hooks.runtimeModule.tap(PLUGIN_NAME, module => {
|
|
40
|
+
compilation.hooks.runtimeModule.tap(PLUGIN_NAME, (module) => {
|
|
41
41
|
module.useSimpleSourceMap = true;
|
|
42
42
|
});
|
|
43
43
|
}
|
|
@@ -65,7 +65,7 @@ const URL_FORMATTING_REGEXP = /^\n\/\/(.*)$/;
|
|
|
65
65
|
* @param {RegExp} regexp Stateful Regular Expression to be reset
|
|
66
66
|
* @returns {void}
|
|
67
67
|
*/
|
|
68
|
-
const resetRegexpState = regexp => {
|
|
68
|
+
const resetRegexpState = (regexp) => {
|
|
69
69
|
regexp.lastIndex = -1;
|
|
70
70
|
};
|
|
71
71
|
|
|
@@ -74,7 +74,7 @@ const resetRegexpState = regexp => {
|
|
|
74
74
|
* @param {string} str String to quote
|
|
75
75
|
* @returns {string} Escaped string
|
|
76
76
|
*/
|
|
77
|
-
const quoteMeta = str => str.replace(METACHARACTERS_REGEXP, "\\$&");
|
|
77
|
+
const quoteMeta = (str) => str.replace(METACHARACTERS_REGEXP, "\\$&");
|
|
78
78
|
|
|
79
79
|
/**
|
|
80
80
|
* Creating {@link SourceMapTask} for given file
|
|
@@ -112,7 +112,7 @@ const getTaskForFile = (
|
|
|
112
112
|
const context = /** @type {string} */ (compilation.options.context);
|
|
113
113
|
const root = compilation.compiler.root;
|
|
114
114
|
const cachedAbsolutify = makePathsAbsolute.bindContextCache(context, root);
|
|
115
|
-
const modules = sourceMap.sources.map(source => {
|
|
115
|
+
const modules = sourceMap.sources.map((source) => {
|
|
116
116
|
if (!source.startsWith("webpack://")) return source;
|
|
117
117
|
source = cachedAbsolutify(source.slice(10));
|
|
118
118
|
const module = compilation.findModule(source);
|
|
@@ -179,7 +179,7 @@ class SourceMapDevToolPlugin {
|
|
|
179
179
|
options
|
|
180
180
|
);
|
|
181
181
|
|
|
182
|
-
compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
|
|
182
|
+
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
|
|
183
183
|
new SourceMapDevToolModuleOptionsPlugin(options).apply(compilation);
|
|
184
184
|
|
|
185
185
|
compilation.hooks.processAssets.tapAsync(
|
|
@@ -348,7 +348,7 @@ class SourceMapDevToolPlugin {
|
|
|
348
348
|
callback();
|
|
349
349
|
});
|
|
350
350
|
},
|
|
351
|
-
err => {
|
|
351
|
+
(err) => {
|
|
352
352
|
if (err) {
|
|
353
353
|
return callback(err);
|
|
354
354
|
}
|
|
@@ -431,7 +431,7 @@ class SourceMapDevToolPlugin {
|
|
|
431
431
|
"attach SourceMap"
|
|
432
432
|
);
|
|
433
433
|
|
|
434
|
-
const moduleFilenames = modules.map(m =>
|
|
434
|
+
const moduleFilenames = modules.map((m) =>
|
|
435
435
|
moduleToSourceNameMapping.get(m)
|
|
436
436
|
);
|
|
437
437
|
sourceMap.sources = /** @type {string[]} */ (moduleFilenames);
|
|
@@ -454,7 +454,7 @@ class SourceMapDevToolPlugin {
|
|
|
454
454
|
: quoteMeta(contenthash);
|
|
455
455
|
sourceMap.file = sourceMap.file.replace(
|
|
456
456
|
new RegExp(pattern, "g"),
|
|
457
|
-
m => "x".repeat(m.length)
|
|
457
|
+
(m) => "x".repeat(m.length)
|
|
458
458
|
);
|
|
459
459
|
}
|
|
460
460
|
|
|
@@ -584,7 +584,7 @@ class SourceMapDevToolPlugin {
|
|
|
584
584
|
compilation.updateAsset(file, asset);
|
|
585
585
|
}
|
|
586
586
|
|
|
587
|
-
task.cacheItem.store({ assets, assetsInfo }, err => {
|
|
587
|
+
task.cacheItem.store({ assets, assetsInfo }, (err) => {
|
|
588
588
|
reportProgress(
|
|
589
589
|
0.5 + (0.5 * ++taskIndex) / tasks.length,
|
|
590
590
|
task.file,
|
|
@@ -597,7 +597,7 @@ class SourceMapDevToolPlugin {
|
|
|
597
597
|
callback();
|
|
598
598
|
});
|
|
599
599
|
},
|
|
600
|
-
err => {
|
|
600
|
+
(err) => {
|
|
601
601
|
reportProgress(1);
|
|
602
602
|
callback(err);
|
|
603
603
|
}
|
package/lib/Stats.js
CHANGED
|
@@ -36,7 +36,7 @@ class Stats {
|
|
|
36
36
|
hasWarnings() {
|
|
37
37
|
return (
|
|
38
38
|
this.compilation.getWarnings().length > 0 ||
|
|
39
|
-
this.compilation.children.some(child => child.getStats().hasWarnings())
|
|
39
|
+
this.compilation.children.some((child) => child.getStats().hasWarnings())
|
|
40
40
|
);
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -46,7 +46,7 @@ class Stats {
|
|
|
46
46
|
hasErrors() {
|
|
47
47
|
return (
|
|
48
48
|
this.compilation.errors.length > 0 ||
|
|
49
|
-
this.compilation.children.some(child => child.getStats().hasErrors())
|
|
49
|
+
this.compilation.children.some((child) => child.getStats().hasErrors())
|
|
50
50
|
);
|
|
51
51
|
}
|
|
52
52
|
|
package/lib/Template.js
CHANGED
|
@@ -296,7 +296,7 @@ class Template {
|
|
|
296
296
|
return null;
|
|
297
297
|
}
|
|
298
298
|
/** @type {{id: string|number, source: Source|string}[]} */
|
|
299
|
-
const allModules = modules.map(module => ({
|
|
299
|
+
const allModules = modules.map((module) => ({
|
|
300
300
|
id: /** @type {ModuleId} */ (chunkGraph.getModuleId(module)),
|
|
301
301
|
source: renderModule(module) || "false"
|
|
302
302
|
}));
|
|
@@ -24,7 +24,7 @@ const REGEXP = /\[\\*([\w:]+)\\*\]/gi;
|
|
|
24
24
|
* @param {string | number} id id
|
|
25
25
|
* @returns {string | number} result
|
|
26
26
|
*/
|
|
27
|
-
const prepareId = id => {
|
|
27
|
+
const prepareId = (id) => {
|
|
28
28
|
if (typeof id !== "string") return id;
|
|
29
29
|
|
|
30
30
|
if (/^"\s\+*.*\+\s*"$/.test(id)) {
|
|
@@ -389,7 +389,7 @@ class TemplatedPathPlugin {
|
|
|
389
389
|
* @returns {void}
|
|
390
390
|
*/
|
|
391
391
|
apply(compiler) {
|
|
392
|
-
compiler.hooks.compilation.tap(plugin, compilation => {
|
|
392
|
+
compiler.hooks.compilation.tap(plugin, (compilation) => {
|
|
393
393
|
compilation.hooks.assetPath.tap(plugin, replacePathVariables);
|
|
394
394
|
});
|
|
395
395
|
}
|
package/lib/UseStrictPlugin.js
CHANGED
|
@@ -36,7 +36,7 @@ class UseStrictPlugin {
|
|
|
36
36
|
* @param {JavascriptParserOptions} parserOptions the javascript parser options
|
|
37
37
|
*/
|
|
38
38
|
const handler = (parser, parserOptions) => {
|
|
39
|
-
parser.hooks.program.tap(PLUGIN_NAME, ast => {
|
|
39
|
+
parser.hooks.program.tap(PLUGIN_NAME, (ast) => {
|
|
40
40
|
const firstNode = ast.body[0];
|
|
41
41
|
if (
|
|
42
42
|
firstNode &&
|
|
@@ -20,7 +20,7 @@ class WarnCaseSensitiveModulesPlugin {
|
|
|
20
20
|
* @returns {void}
|
|
21
21
|
*/
|
|
22
22
|
apply(compiler) {
|
|
23
|
-
compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
|
|
23
|
+
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
|
|
24
24
|
compilation.hooks.seal.tap(PLUGIN_NAME, () => {
|
|
25
25
|
/** @type {Map<string, Map<string, Module>>} */
|
|
26
26
|
const moduleWithoutCase = new Map();
|
|
@@ -30,7 +30,7 @@ class WarnDeprecatedOptionPlugin {
|
|
|
30
30
|
* @returns {void}
|
|
31
31
|
*/
|
|
32
32
|
apply(compiler) {
|
|
33
|
-
compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => {
|
|
33
|
+
compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
|
|
34
34
|
compilation.warnings.push(
|
|
35
35
|
new DeprecatedOptionWarning(this.option, this.value, this.suggestion)
|
|
36
36
|
);
|
|
@@ -18,7 +18,7 @@ class WarnNoModeSetPlugin {
|
|
|
18
18
|
* @returns {void}
|
|
19
19
|
*/
|
|
20
20
|
apply(compiler) {
|
|
21
|
-
compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => {
|
|
21
|
+
compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
|
|
22
22
|
compilation.warnings.push(new NoModeWarning());
|
|
23
23
|
});
|
|
24
24
|
}
|
package/lib/WatchIgnorePlugin.js
CHANGED
|
@@ -45,8 +45,8 @@ class IgnoringWatchFileSystem {
|
|
|
45
45
|
* @param {string} path path to check
|
|
46
46
|
* @returns {boolean} true, if path is ignored
|
|
47
47
|
*/
|
|
48
|
-
const ignored = path =>
|
|
49
|
-
this.paths.some(p =>
|
|
48
|
+
const ignored = (path) =>
|
|
49
|
+
this.paths.some((p) =>
|
|
50
50
|
p instanceof RegExp ? p.test(path) : path.indexOf(p) === 0
|
|
51
51
|
);
|
|
52
52
|
|
package/lib/Watching.js
CHANGED
|
@@ -159,14 +159,14 @@ class Watching {
|
|
|
159
159
|
|
|
160
160
|
const run = () => {
|
|
161
161
|
if (this.compiler.idle) {
|
|
162
|
-
return this.compiler.cache.endIdle(err => {
|
|
162
|
+
return this.compiler.cache.endIdle((err) => {
|
|
163
163
|
if (err) return this._done(err);
|
|
164
164
|
this.compiler.idle = false;
|
|
165
165
|
run();
|
|
166
166
|
});
|
|
167
167
|
}
|
|
168
168
|
if (this._needRecords) {
|
|
169
|
-
return this.compiler.readRecords(err => {
|
|
169
|
+
return this.compiler.readRecords((err) => {
|
|
170
170
|
if (err) return this._done(err);
|
|
171
171
|
|
|
172
172
|
this._needRecords = false;
|
|
@@ -175,7 +175,7 @@ class Watching {
|
|
|
175
175
|
}
|
|
176
176
|
this.invalid = false;
|
|
177
177
|
this._invalidReported = false;
|
|
178
|
-
this.compiler.hooks.watchRun.callAsync(this.compiler, err => {
|
|
178
|
+
this.compiler.hooks.watchRun.callAsync(this.compiler, (err) => {
|
|
179
179
|
if (err) return this._done(err);
|
|
180
180
|
/**
|
|
181
181
|
* @param {Error | null} err error
|
|
@@ -196,13 +196,13 @@ class Watching {
|
|
|
196
196
|
process.nextTick(() => {
|
|
197
197
|
const logger = compilation.getLogger("webpack.Compiler");
|
|
198
198
|
logger.time("emitAssets");
|
|
199
|
-
this.compiler.emitAssets(compilation, err => {
|
|
199
|
+
this.compiler.emitAssets(compilation, (err) => {
|
|
200
200
|
logger.timeEnd("emitAssets");
|
|
201
201
|
if (err) return this._done(err, compilation);
|
|
202
202
|
if (this.invalid) return this._done(null, compilation);
|
|
203
203
|
|
|
204
204
|
logger.time("emitRecords");
|
|
205
|
-
this.compiler.emitRecords(err => {
|
|
205
|
+
this.compiler.emitRecords((err) => {
|
|
206
206
|
logger.timeEnd("emitRecords");
|
|
207
207
|
if (err) return this._done(err, compilation);
|
|
208
208
|
|
|
@@ -215,11 +215,11 @@ class Watching {
|
|
|
215
215
|
compilation.endTime = Date.now();
|
|
216
216
|
logger.time("done hook");
|
|
217
217
|
const stats = new Stats(compilation);
|
|
218
|
-
this.compiler.hooks.done.callAsync(stats, err => {
|
|
218
|
+
this.compiler.hooks.done.callAsync(stats, (err) => {
|
|
219
219
|
logger.timeEnd("done hook");
|
|
220
220
|
if (err) return this._done(err, compilation);
|
|
221
221
|
|
|
222
|
-
this.compiler.hooks.additionalPass.callAsync(err => {
|
|
222
|
+
this.compiler.hooks.additionalPass.callAsync((err) => {
|
|
223
223
|
if (err) return this._done(err, compilation);
|
|
224
224
|
this.compiler.compile(onCompiled);
|
|
225
225
|
});
|
|
@@ -288,7 +288,7 @@ class Watching {
|
|
|
288
288
|
logger.time("storeBuildDependencies");
|
|
289
289
|
this.compiler.cache.storeBuildDependencies(
|
|
290
290
|
compilation.buildDependencies,
|
|
291
|
-
err => {
|
|
291
|
+
(err) => {
|
|
292
292
|
logger.timeEnd("storeBuildDependencies");
|
|
293
293
|
if (err) return handleError(err);
|
|
294
294
|
this._go();
|
|
@@ -311,7 +311,7 @@ class Watching {
|
|
|
311
311
|
const cbs = this.callbacks;
|
|
312
312
|
this.callbacks = [];
|
|
313
313
|
logger.time("done hook");
|
|
314
|
-
this.compiler.hooks.done.callAsync(/** @type {Stats} */ (stats), err => {
|
|
314
|
+
this.compiler.hooks.done.callAsync(/** @type {Stats} */ (stats), (err) => {
|
|
315
315
|
logger.timeEnd("done hook");
|
|
316
316
|
if (err) return handleError(err, cbs);
|
|
317
317
|
this.handler(null, stats);
|
|
@@ -319,7 +319,7 @@ class Watching {
|
|
|
319
319
|
this.compiler.cache.storeBuildDependencies(
|
|
320
320
|
/** @type {Compilation} */
|
|
321
321
|
(compilation).buildDependencies,
|
|
322
|
-
err => {
|
|
322
|
+
(err) => {
|
|
323
323
|
logger.timeEnd("storeBuildDependencies");
|
|
324
324
|
if (err) return handleError(err, cbs);
|
|
325
325
|
logger.time("beginIdle");
|
|
@@ -480,7 +480,7 @@ class Watching {
|
|
|
480
480
|
/**
|
|
481
481
|
* @param {WebpackError | null} err error if any
|
|
482
482
|
*/
|
|
483
|
-
const shutdown = err => {
|
|
483
|
+
const shutdown = (err) => {
|
|
484
484
|
this.compiler.hooks.watchClose.call();
|
|
485
485
|
const closeCallbacks =
|
|
486
486
|
/** @type {Callback<void>[]} */
|
|
@@ -493,7 +493,7 @@ class Watching {
|
|
|
493
493
|
logger.time("storeBuildDependencies");
|
|
494
494
|
this.compiler.cache.storeBuildDependencies(
|
|
495
495
|
compilation.buildDependencies,
|
|
496
|
-
err2 => {
|
|
496
|
+
(err2) => {
|
|
497
497
|
logger.timeEnd("storeBuildDependencies");
|
|
498
498
|
shutdown(err || err2);
|
|
499
499
|
}
|
|
@@ -47,10 +47,10 @@ class WebpackIsIncludedPlugin {
|
|
|
47
47
|
* @param {JavascriptParser} parser the parser
|
|
48
48
|
* @returns {void}
|
|
49
49
|
*/
|
|
50
|
-
const handler = parser => {
|
|
50
|
+
const handler = (parser) => {
|
|
51
51
|
parser.hooks.call
|
|
52
52
|
.for("__webpack_is_included__")
|
|
53
|
-
.tap(PLUGIN_NAME, expr => {
|
|
53
|
+
.tap(PLUGIN_NAME, (expr) => {
|
|
54
54
|
if (
|
|
55
55
|
expr.type !== "CallExpression" ||
|
|
56
56
|
expr.arguments.length !== 1 ||
|
|
@@ -858,7 +858,7 @@ class WebpackOptionsApply extends OptionsApply {
|
|
|
858
858
|
}
|
|
859
859
|
compiler.resolverFactory.hooks.resolveOptions
|
|
860
860
|
.for("normal")
|
|
861
|
-
.tap(CLASS_NAME, resolveOptions => {
|
|
861
|
+
.tap(CLASS_NAME, (resolveOptions) => {
|
|
862
862
|
resolveOptions = cleverMerge(options.resolve, resolveOptions);
|
|
863
863
|
resolveOptions.fileSystem =
|
|
864
864
|
/** @type {InputFileSystem} */
|
|
@@ -867,7 +867,7 @@ class WebpackOptionsApply extends OptionsApply {
|
|
|
867
867
|
});
|
|
868
868
|
compiler.resolverFactory.hooks.resolveOptions
|
|
869
869
|
.for("context")
|
|
870
|
-
.tap(CLASS_NAME, resolveOptions => {
|
|
870
|
+
.tap(CLASS_NAME, (resolveOptions) => {
|
|
871
871
|
resolveOptions = cleverMerge(options.resolve, resolveOptions);
|
|
872
872
|
resolveOptions.fileSystem =
|
|
873
873
|
/** @type {InputFileSystem} */
|
|
@@ -877,7 +877,7 @@ class WebpackOptionsApply extends OptionsApply {
|
|
|
877
877
|
});
|
|
878
878
|
compiler.resolverFactory.hooks.resolveOptions
|
|
879
879
|
.for("loader")
|
|
880
|
-
.tap(CLASS_NAME, resolveOptions => {
|
|
880
|
+
.tap(CLASS_NAME, (resolveOptions) => {
|
|
881
881
|
resolveOptions = cleverMerge(options.resolveLoader, resolveOptions);
|
|
882
882
|
resolveOptions.fileSystem =
|
|
883
883
|
/** @type {InputFileSystem} */
|
|
@@ -31,7 +31,7 @@ const memoize = require("../util/memoize");
|
|
|
31
31
|
* @param {string} name name of definitions
|
|
32
32
|
* @returns {Schema} definition
|
|
33
33
|
*/
|
|
34
|
-
const getSchema = name => {
|
|
34
|
+
const getSchema = (name) => {
|
|
35
35
|
const { definitions } = require("../../schemas/WebpackOptions.json");
|
|
36
36
|
|
|
37
37
|
return {
|
|
@@ -93,7 +93,7 @@ class AssetModulesPlugin {
|
|
|
93
93
|
(compilation, { normalModuleFactory }) => {
|
|
94
94
|
normalModuleFactory.hooks.createParser
|
|
95
95
|
.for(ASSET_MODULE_TYPE)
|
|
96
|
-
.tap(PLUGIN_NAME, parserOptions => {
|
|
96
|
+
.tap(PLUGIN_NAME, (parserOptions) => {
|
|
97
97
|
validateParserOptions(parserOptions);
|
|
98
98
|
parserOptions = cleverMerge(
|
|
99
99
|
/** @type {AssetParserOptions} */
|
|
@@ -115,21 +115,21 @@ class AssetModulesPlugin {
|
|
|
115
115
|
});
|
|
116
116
|
normalModuleFactory.hooks.createParser
|
|
117
117
|
.for(ASSET_MODULE_TYPE_INLINE)
|
|
118
|
-
.tap(PLUGIN_NAME, _parserOptions => {
|
|
118
|
+
.tap(PLUGIN_NAME, (_parserOptions) => {
|
|
119
119
|
const AssetParser = getAssetParser();
|
|
120
120
|
|
|
121
121
|
return new AssetParser(true);
|
|
122
122
|
});
|
|
123
123
|
normalModuleFactory.hooks.createParser
|
|
124
124
|
.for(ASSET_MODULE_TYPE_RESOURCE)
|
|
125
|
-
.tap(PLUGIN_NAME, _parserOptions => {
|
|
125
|
+
.tap(PLUGIN_NAME, (_parserOptions) => {
|
|
126
126
|
const AssetParser = getAssetParser();
|
|
127
127
|
|
|
128
128
|
return new AssetParser(false);
|
|
129
129
|
});
|
|
130
130
|
normalModuleFactory.hooks.createParser
|
|
131
131
|
.for(ASSET_MODULE_TYPE_SOURCE)
|
|
132
|
-
.tap(PLUGIN_NAME, _parserOptions => {
|
|
132
|
+
.tap(PLUGIN_NAME, (_parserOptions) => {
|
|
133
133
|
const AssetSourceParser = getAssetSourceParser();
|
|
134
134
|
|
|
135
135
|
return new AssetSourceParser();
|
|
@@ -142,7 +142,7 @@ class AssetModulesPlugin {
|
|
|
142
142
|
]) {
|
|
143
143
|
normalModuleFactory.hooks.createGenerator
|
|
144
144
|
.for(type)
|
|
145
|
-
.tap(PLUGIN_NAME, generatorOptions => {
|
|
145
|
+
.tap(PLUGIN_NAME, (generatorOptions) => {
|
|
146
146
|
validateGeneratorOptions[type](generatorOptions);
|
|
147
147
|
|
|
148
148
|
let dataUrl;
|
|
@@ -32,7 +32,7 @@ const getOutgoingAsyncModules = (moduleGraph, module) => {
|
|
|
32
32
|
for (const [module, connections] of outgoingConnectionMap) {
|
|
33
33
|
if (
|
|
34
34
|
connections.some(
|
|
35
|
-
c =>
|
|
35
|
+
(c) =>
|
|
36
36
|
c.dependency instanceof HarmonyImportDependency &&
|
|
37
37
|
c.isTargetActive(undefined)
|
|
38
38
|
) &&
|