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/Compilation.js
CHANGED
|
@@ -372,7 +372,7 @@ const { isSourceEqual } = require("./util/source");
|
|
|
372
372
|
* @property {false | "none" | "error" | "warn" | "info" | "log" | "verbose"} logging
|
|
373
373
|
* @property {((value: string) => boolean)[]} loggingDebug
|
|
374
374
|
* @property {boolean} loggingTrace
|
|
375
|
-
* @property {
|
|
375
|
+
* @property {EXPECTED_ANY} _env
|
|
376
376
|
*/
|
|
377
377
|
|
|
378
378
|
/** @typedef {KnownNormalizedStatsOptions & Omit<StatsOptions, keyof KnownNormalizedStatsOptions> & Record<string, EXPECTED_ANY>} NormalizedStatsOptions */
|
|
@@ -403,7 +403,7 @@ const deprecatedNormalModuleLoaderHook = util.deprecate(
|
|
|
403
403
|
* @param {Compilation} compilation compilation
|
|
404
404
|
* @returns {NormalModuleCompilationHooks["loader"]} hooks
|
|
405
405
|
*/
|
|
406
|
-
compilation =>
|
|
406
|
+
(compilation) =>
|
|
407
407
|
require("./NormalModule").getCompilationHooks(compilation).loader,
|
|
408
408
|
"Compilation.hooks.normalModuleLoader was moved to NormalModule.getCompilationHooks(compilation).loader",
|
|
409
409
|
"DEP_WEBPACK_COMPILATION_NORMAL_MODULE_LOADER_HOOK"
|
|
@@ -413,7 +413,7 @@ const deprecatedNormalModuleLoaderHook = util.deprecate(
|
|
|
413
413
|
/**
|
|
414
414
|
* @param {ModuleTemplates | undefined} moduleTemplates module templates
|
|
415
415
|
*/
|
|
416
|
-
const defineRemovedModuleTemplates = moduleTemplates => {
|
|
416
|
+
const defineRemovedModuleTemplates = (moduleTemplates) => {
|
|
417
417
|
Object.defineProperties(moduleTemplates, {
|
|
418
418
|
asset: {
|
|
419
419
|
enumerable: false,
|
|
@@ -437,21 +437,24 @@ const defineRemovedModuleTemplates = moduleTemplates => {
|
|
|
437
437
|
moduleTemplates = undefined;
|
|
438
438
|
};
|
|
439
439
|
|
|
440
|
-
const byId = compareSelect(c => c.id, compareIds);
|
|
440
|
+
const byId = compareSelect((c) => c.id, compareIds);
|
|
441
441
|
|
|
442
442
|
const byNameOrHash = concatComparators(
|
|
443
|
-
compareSelect(c => c.name, compareIds),
|
|
444
|
-
compareSelect(c => c.fullHash, compareIds)
|
|
443
|
+
compareSelect((c) => c.name, compareIds),
|
|
444
|
+
compareSelect((c) => c.fullHash, compareIds)
|
|
445
445
|
);
|
|
446
446
|
|
|
447
|
-
const byMessage = compareSelect(
|
|
447
|
+
const byMessage = compareSelect(
|
|
448
|
+
(err) => `${err.message}`,
|
|
449
|
+
compareStringsNumeric
|
|
450
|
+
);
|
|
448
451
|
|
|
449
452
|
const byModule = compareSelect(
|
|
450
|
-
err => (err.module && err.module.identifier()) || "",
|
|
453
|
+
(err) => (err.module && err.module.identifier()) || "",
|
|
451
454
|
compareStringsNumeric
|
|
452
455
|
);
|
|
453
456
|
|
|
454
|
-
const byLocation = compareSelect(err => err.loc, compareLocations);
|
|
457
|
+
const byLocation = compareSelect((err) => err.loc, compareLocations);
|
|
455
458
|
|
|
456
459
|
const compareErrors = concatComparators(byModule, byLocation, byMessage);
|
|
457
460
|
|
|
@@ -497,7 +500,7 @@ class Compilation {
|
|
|
497
500
|
* @param {CompilationAssets} assets assets
|
|
498
501
|
* @returns {CompilationAssets} new assets
|
|
499
502
|
*/
|
|
500
|
-
const popNewAssets = assets => {
|
|
503
|
+
const popNewAssets = (assets) => {
|
|
501
504
|
let newAssets;
|
|
502
505
|
for (const file of Object.keys(assets)) {
|
|
503
506
|
if (savedAssets.has(file)) continue;
|
|
@@ -514,7 +517,7 @@ class Compilation {
|
|
|
514
517
|
call: () => {
|
|
515
518
|
savedAssets = new Set(Object.keys(this.assets));
|
|
516
519
|
},
|
|
517
|
-
register: tap => {
|
|
520
|
+
register: (tap) => {
|
|
518
521
|
const { type, name } = tap;
|
|
519
522
|
const { fn, additionalAssets, ...remainingTap } = tap;
|
|
520
523
|
const additionalAssetsFn =
|
|
@@ -526,7 +529,7 @@ class Compilation {
|
|
|
526
529
|
switch (type) {
|
|
527
530
|
case "sync":
|
|
528
531
|
if (additionalAssetsFn) {
|
|
529
|
-
this.hooks.processAdditionalAssets.tap(name, assets => {
|
|
532
|
+
this.hooks.processAdditionalAssets.tap(name, (assets) => {
|
|
530
533
|
if (
|
|
531
534
|
/** @type {ProcessedAssets} */
|
|
532
535
|
(processedAssets).has(this.assets)
|
|
@@ -592,7 +595,7 @@ class Compilation {
|
|
|
592
595
|
* @param {Error} err err
|
|
593
596
|
* @returns {void}
|
|
594
597
|
*/
|
|
595
|
-
err => {
|
|
598
|
+
(err) => {
|
|
596
599
|
if (err) return callback(err);
|
|
597
600
|
if (processedAssets !== undefined) {
|
|
598
601
|
processedAssets.add(this.assets);
|
|
@@ -612,7 +615,7 @@ class Compilation {
|
|
|
612
615
|
};
|
|
613
616
|
case "promise":
|
|
614
617
|
if (additionalAssetsFn) {
|
|
615
|
-
this.hooks.processAdditionalAssets.tapPromise(name, assets => {
|
|
618
|
+
this.hooks.processAdditionalAssets.tapPromise(name, (assets) => {
|
|
616
619
|
if (
|
|
617
620
|
/** @type {ProcessedAssets} */
|
|
618
621
|
(processedAssets).has(this.assets)
|
|
@@ -628,7 +631,7 @@ class Compilation {
|
|
|
628
631
|
* @param {CompilationAssets} assets assets
|
|
629
632
|
* @returns {Promise<CompilationAssets>} result
|
|
630
633
|
*/
|
|
631
|
-
fn: assets => {
|
|
634
|
+
fn: (assets) => {
|
|
632
635
|
const p = fn(assets);
|
|
633
636
|
if (!p || !p.then) return p;
|
|
634
637
|
return p.then(() => {
|
|
@@ -665,14 +668,15 @@ class Compilation {
|
|
|
665
668
|
* @param {string} reason reason
|
|
666
669
|
* @returns {string} error message
|
|
667
670
|
*/
|
|
668
|
-
const errorMessage =
|
|
669
|
-
reason
|
|
671
|
+
const errorMessage = (
|
|
672
|
+
reason
|
|
673
|
+
) => `Can't automatically convert plugin using Compilation.hooks.${name} to Compilation.hooks.processAssets because ${reason}.
|
|
670
674
|
BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a single Compilation.hooks.processAssets hook.`;
|
|
671
675
|
/**
|
|
672
676
|
* @param {string | (import("tapable").TapOptions & { name: string; } & ProcessAssetsAdditionalOptions)} options hook options
|
|
673
677
|
* @returns {import("tapable").TapOptions & { name: string; } & ProcessAssetsAdditionalOptions} modified options
|
|
674
678
|
*/
|
|
675
|
-
const getOptions = options => {
|
|
679
|
+
const getOptions = (options) => {
|
|
676
680
|
if (typeof options === "string") options = { name: options };
|
|
677
681
|
if (options.stage) {
|
|
678
682
|
throw new Error(errorMessage("it's using the 'stage' option"));
|
|
@@ -1075,7 +1079,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
1075
1079
|
this.addModuleQueue = new AsyncQueue({
|
|
1076
1080
|
name: "addModule",
|
|
1077
1081
|
parent: this.processDependenciesQueue,
|
|
1078
|
-
getKey: module => module.identifier(),
|
|
1082
|
+
getKey: (module) => module.identifier(),
|
|
1079
1083
|
processor: this._addModule.bind(this)
|
|
1080
1084
|
});
|
|
1081
1085
|
/** @type {AsyncQueue<FactorizeModuleOptions, string, Module | ModuleFactoryResult>} */
|
|
@@ -1199,7 +1203,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
1199
1203
|
* @param {string} item item
|
|
1200
1204
|
* @returns {LazySet<string>} file dependencies
|
|
1201
1205
|
*/
|
|
1202
|
-
item => this.fileDependencies.add(item),
|
|
1206
|
+
(item) => this.fileDependencies.add(item),
|
|
1203
1207
|
"Compilation.compilationDependencies is deprecated (used Compilation.fileDependencies instead)",
|
|
1204
1208
|
"DEP_WEBPACK_COMPILATION_COMPILATION_DEPENDENCIES"
|
|
1205
1209
|
)
|
|
@@ -1351,7 +1355,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
1351
1355
|
/* eslint-enable no-console */
|
|
1352
1356
|
}
|
|
1353
1357
|
},
|
|
1354
|
-
childName => {
|
|
1358
|
+
(childName) => {
|
|
1355
1359
|
if (typeof name === "function") {
|
|
1356
1360
|
if (typeof childName === "function") {
|
|
1357
1361
|
return this.getLogger(() => {
|
|
@@ -1527,7 +1531,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
1527
1531
|
this.resolverFactory.get("normal", module.resolveOptions),
|
|
1528
1532
|
/** @type {InputFileSystem} */
|
|
1529
1533
|
(this.inputFileSystem),
|
|
1530
|
-
err => {
|
|
1534
|
+
(err) => {
|
|
1531
1535
|
if (currentProfile !== undefined) {
|
|
1532
1536
|
currentProfile.markBuildingEnd();
|
|
1533
1537
|
}
|
|
@@ -1538,20 +1542,25 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
1538
1542
|
if (currentProfile !== undefined) {
|
|
1539
1543
|
currentProfile.markStoringStart();
|
|
1540
1544
|
}
|
|
1541
|
-
this._modulesCache.store(
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
)
|
|
1550
|
-
|
|
1545
|
+
this._modulesCache.store(
|
|
1546
|
+
module.identifier(),
|
|
1547
|
+
null,
|
|
1548
|
+
module,
|
|
1549
|
+
(err) => {
|
|
1550
|
+
if (currentProfile !== undefined) {
|
|
1551
|
+
currentProfile.markStoringEnd();
|
|
1552
|
+
}
|
|
1553
|
+
if (err) {
|
|
1554
|
+
this.hooks.failedModule.call(
|
|
1555
|
+
module,
|
|
1556
|
+
/** @type {WebpackError} */ (err)
|
|
1557
|
+
);
|
|
1558
|
+
return callback(new ModuleStoreError(module, err));
|
|
1559
|
+
}
|
|
1560
|
+
this.hooks.succeedModule.call(module);
|
|
1561
|
+
return callback();
|
|
1551
1562
|
}
|
|
1552
|
-
|
|
1553
|
-
return callback();
|
|
1554
|
-
});
|
|
1563
|
+
);
|
|
1555
1564
|
}
|
|
1556
1565
|
);
|
|
1557
1566
|
}
|
|
@@ -1575,7 +1584,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
1575
1584
|
/**
|
|
1576
1585
|
* @param {DependenciesBlock} block block
|
|
1577
1586
|
*/
|
|
1578
|
-
const processDependenciesBlock = block => {
|
|
1587
|
+
const processDependenciesBlock = (block) => {
|
|
1579
1588
|
if (block.dependencies) {
|
|
1580
1589
|
let i = 0;
|
|
1581
1590
|
for (const dep of block.dependencies) {
|
|
@@ -1625,7 +1634,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
1625
1634
|
* @param {WebpackError=} err error
|
|
1626
1635
|
* @returns {void}
|
|
1627
1636
|
*/
|
|
1628
|
-
const onDependenciesSorted = err => {
|
|
1637
|
+
const onDependenciesSorted = (err) => {
|
|
1629
1638
|
if (err) return callback(err);
|
|
1630
1639
|
|
|
1631
1640
|
// early exit without changing parallelism back and forth
|
|
@@ -1639,7 +1648,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
1639
1648
|
for (const item of sortedDependencies) {
|
|
1640
1649
|
inProgressTransitive++;
|
|
1641
1650
|
// eslint-disable-next-line no-loop-func
|
|
1642
|
-
this.handleModuleCreation(item, err => {
|
|
1651
|
+
this.handleModuleCreation(item, (err) => {
|
|
1643
1652
|
// In V8, the Error objects keep a reference to the functions on the stack. These warnings &
|
|
1644
1653
|
// errors are created inside closures that keep a reference to the Compilation, so errors are
|
|
1645
1654
|
// leaking the Compilation object.
|
|
@@ -1661,7 +1670,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
1661
1670
|
* @param {WebpackError=} err error
|
|
1662
1671
|
* @returns {void}
|
|
1663
1672
|
*/
|
|
1664
|
-
const onTransitiveTasksFinished = err => {
|
|
1673
|
+
const onTransitiveTasksFinished = (err) => {
|
|
1665
1674
|
if (err) return callback(err);
|
|
1666
1675
|
this.processDependenciesQueue.decreaseParallelism();
|
|
1667
1676
|
|
|
@@ -1738,7 +1747,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
1738
1747
|
module,
|
|
1739
1748
|
dep,
|
|
1740
1749
|
cachedModule,
|
|
1741
|
-
err => {
|
|
1750
|
+
(err) => {
|
|
1742
1751
|
if (err) {
|
|
1743
1752
|
if (inProgressTransitive <= 0) return;
|
|
1744
1753
|
inProgressTransitive = -1;
|
|
@@ -1783,7 +1792,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
1783
1792
|
* @param {Dependency} dep dependency
|
|
1784
1793
|
* @returns {void}
|
|
1785
1794
|
*/
|
|
1786
|
-
const processDependencyForResolving = dep => {
|
|
1795
|
+
const processDependencyForResolving = (dep) => {
|
|
1787
1796
|
const resourceIdent = dep.getResourceIdentifier();
|
|
1788
1797
|
if (resourceIdent !== undefined && resourceIdent !== null) {
|
|
1789
1798
|
const category = dep.category;
|
|
@@ -1982,7 +1991,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
1982
1991
|
};
|
|
1983
1992
|
if (err) {
|
|
1984
1993
|
if (factoryResult) applyFactoryResultDependencies();
|
|
1985
|
-
if (dependencies.every(d => d.optional)) {
|
|
1994
|
+
if (dependencies.every((d) => d.optional)) {
|
|
1986
1995
|
this.warnings.push(err);
|
|
1987
1996
|
return callback();
|
|
1988
1997
|
}
|
|
@@ -2136,7 +2145,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
2136
2145
|
}
|
|
2137
2146
|
}
|
|
2138
2147
|
|
|
2139
|
-
this.buildModule(module, err => {
|
|
2148
|
+
this.buildModule(module, (err) => {
|
|
2140
2149
|
if (creatingModuleDuringBuildSet !== undefined) {
|
|
2141
2150
|
creatingModuleDuringBuildSet.delete(module);
|
|
2142
2151
|
}
|
|
@@ -2160,7 +2169,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
2160
2169
|
return callback(null, module);
|
|
2161
2170
|
}
|
|
2162
2171
|
|
|
2163
|
-
this.processModuleDependencies(module, err => {
|
|
2172
|
+
this.processModuleDependencies(module, (err) => {
|
|
2164
2173
|
if (err) {
|
|
2165
2174
|
return callback(err);
|
|
2166
2175
|
}
|
|
@@ -2238,7 +2247,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
2238
2247
|
originModule,
|
|
2239
2248
|
err,
|
|
2240
2249
|
/** @type {DependencyLocation} */
|
|
2241
|
-
(dependencies.map(d => d.loc).find(Boolean))
|
|
2250
|
+
(dependencies.map((d) => d.loc).find(Boolean))
|
|
2242
2251
|
);
|
|
2243
2252
|
return callback(notFoundError, factoryResult ? result : undefined);
|
|
2244
2253
|
}
|
|
@@ -2453,9 +2462,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
2453
2462
|
const oldBlocks = [...module.blocks];
|
|
2454
2463
|
module.invalidateBuild();
|
|
2455
2464
|
this.buildQueue.invalidate(module);
|
|
2456
|
-
this.buildModule(module, err => {
|
|
2465
|
+
this.buildModule(module, (err) => {
|
|
2457
2466
|
if (err) {
|
|
2458
|
-
return this.hooks.finishRebuildingModule.callAsync(module, err2 => {
|
|
2467
|
+
return this.hooks.finishRebuildingModule.callAsync(module, (err2) => {
|
|
2459
2468
|
if (err2) {
|
|
2460
2469
|
callback(
|
|
2461
2470
|
makeWebpackError(err2, "Compilation.hooks.finishRebuildingModule")
|
|
@@ -2468,13 +2477,13 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
2468
2477
|
|
|
2469
2478
|
this.processDependenciesQueue.invalidate(module);
|
|
2470
2479
|
this.moduleGraph.unfreeze();
|
|
2471
|
-
this.processModuleDependencies(module, err => {
|
|
2480
|
+
this.processModuleDependencies(module, (err) => {
|
|
2472
2481
|
if (err) return callback(err);
|
|
2473
2482
|
this.removeReasonsOfDependencyBlock(module, {
|
|
2474
2483
|
dependencies: oldDependencies,
|
|
2475
2484
|
blocks: oldBlocks
|
|
2476
2485
|
});
|
|
2477
|
-
this.hooks.finishRebuildingModule.callAsync(module, err2 => {
|
|
2486
|
+
this.hooks.finishRebuildingModule.callAsync(module, (err2) => {
|
|
2478
2487
|
if (err2) {
|
|
2479
2488
|
callback(
|
|
2480
2489
|
makeWebpackError(err2, "Compilation.hooks.finishRebuildingModule")
|
|
@@ -2511,7 +2520,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
2511
2520
|
* @param {Module} module module
|
|
2512
2521
|
* @returns {WeakReferences | undefined} references
|
|
2513
2522
|
*/
|
|
2514
|
-
const computeReferences = module => {
|
|
2523
|
+
const computeReferences = (module) => {
|
|
2515
2524
|
/** @type {WeakReferences | undefined} */
|
|
2516
2525
|
let references;
|
|
2517
2526
|
for (const connection of moduleGraph.getOutgoingConnections(module)) {
|
|
@@ -2604,7 +2613,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
2604
2613
|
* @param {readonly ModuleGraphConnection[]} connections connections
|
|
2605
2614
|
* @returns {symbol|boolean} result
|
|
2606
2615
|
*/
|
|
2607
|
-
const reduceAffectType = connections => {
|
|
2616
|
+
const reduceAffectType = (connections) => {
|
|
2608
2617
|
let affected = false;
|
|
2609
2618
|
for (const { dependency } of connections) {
|
|
2610
2619
|
if (!dependency) continue;
|
|
@@ -2684,7 +2693,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
2684
2693
|
* @param {Module} module module
|
|
2685
2694
|
* @returns {References} references
|
|
2686
2695
|
*/
|
|
2687
|
-
const computeReferences = module => {
|
|
2696
|
+
const computeReferences = (module) => {
|
|
2688
2697
|
const id = /** @type {ModuleId} */ (chunkGraph.getModuleId(module));
|
|
2689
2698
|
/** @type {Map<Module, string | number | undefined> | undefined} */
|
|
2690
2699
|
let modules;
|
|
@@ -2804,27 +2813,27 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
2804
2813
|
p.range(
|
|
2805
2814
|
profile.buildingStartTime,
|
|
2806
2815
|
profile.buildingEndTime,
|
|
2807
|
-
f => (profile.buildingParallelismFactor = f)
|
|
2816
|
+
(f) => (profile.buildingParallelismFactor = f)
|
|
2808
2817
|
);
|
|
2809
2818
|
p.range(
|
|
2810
2819
|
profile.factoryStartTime,
|
|
2811
2820
|
profile.factoryEndTime,
|
|
2812
|
-
f => (profile.factoryParallelismFactor = f)
|
|
2821
|
+
(f) => (profile.factoryParallelismFactor = f)
|
|
2813
2822
|
);
|
|
2814
2823
|
p.range(
|
|
2815
2824
|
profile.integrationStartTime,
|
|
2816
2825
|
profile.integrationEndTime,
|
|
2817
|
-
f => (profile.integrationParallelismFactor = f)
|
|
2826
|
+
(f) => (profile.integrationParallelismFactor = f)
|
|
2818
2827
|
);
|
|
2819
2828
|
p.range(
|
|
2820
2829
|
profile.storingStartTime,
|
|
2821
2830
|
profile.storingEndTime,
|
|
2822
|
-
f => (profile.storingParallelismFactor = f)
|
|
2831
|
+
(f) => (profile.storingParallelismFactor = f)
|
|
2823
2832
|
);
|
|
2824
2833
|
p.range(
|
|
2825
2834
|
profile.restoringStartTime,
|
|
2826
2835
|
profile.restoringEndTime,
|
|
2827
|
-
f => (profile.restoringParallelismFactor = f)
|
|
2836
|
+
(f) => (profile.restoringParallelismFactor = f)
|
|
2828
2837
|
);
|
|
2829
2838
|
if (profile.additionalFactoryTimes) {
|
|
2830
2839
|
for (const { start, end } of profile.additionalFactoryTimes) {
|
|
@@ -2832,7 +2841,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
2832
2841
|
p.range(
|
|
2833
2842
|
start,
|
|
2834
2843
|
end,
|
|
2835
|
-
f =>
|
|
2844
|
+
(f) =>
|
|
2836
2845
|
(profile.additionalFactoriesParallelismFactor += f * influence)
|
|
2837
2846
|
);
|
|
2838
2847
|
}
|
|
@@ -2955,33 +2964,33 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
2955
2964
|
};
|
|
2956
2965
|
logNormalSummary(
|
|
2957
2966
|
"resolve to new modules",
|
|
2958
|
-
p => p.factory,
|
|
2959
|
-
p => p.factoryParallelismFactor
|
|
2967
|
+
(p) => p.factory,
|
|
2968
|
+
(p) => p.factoryParallelismFactor
|
|
2960
2969
|
);
|
|
2961
2970
|
logNormalSummary(
|
|
2962
2971
|
"resolve to existing modules",
|
|
2963
|
-
p => p.additionalFactories,
|
|
2964
|
-
p => p.additionalFactoriesParallelismFactor
|
|
2972
|
+
(p) => p.additionalFactories,
|
|
2973
|
+
(p) => p.additionalFactoriesParallelismFactor
|
|
2965
2974
|
);
|
|
2966
2975
|
logNormalSummary(
|
|
2967
2976
|
"integrate modules",
|
|
2968
|
-
p => p.restoring,
|
|
2969
|
-
p => p.restoringParallelismFactor
|
|
2977
|
+
(p) => p.restoring,
|
|
2978
|
+
(p) => p.restoringParallelismFactor
|
|
2970
2979
|
);
|
|
2971
2980
|
logByLoadersSummary(
|
|
2972
2981
|
"build modules",
|
|
2973
|
-
p => p.building,
|
|
2974
|
-
p => p.buildingParallelismFactor
|
|
2982
|
+
(p) => p.building,
|
|
2983
|
+
(p) => p.buildingParallelismFactor
|
|
2975
2984
|
);
|
|
2976
2985
|
logNormalSummary(
|
|
2977
2986
|
"store modules",
|
|
2978
|
-
p => p.storing,
|
|
2979
|
-
p => p.storingParallelismFactor
|
|
2987
|
+
(p) => p.storing,
|
|
2988
|
+
(p) => p.storingParallelismFactor
|
|
2980
2989
|
);
|
|
2981
2990
|
logNormalSummary(
|
|
2982
2991
|
"restore modules",
|
|
2983
|
-
p => p.restoring,
|
|
2984
|
-
p => p.restoringParallelismFactor
|
|
2992
|
+
(p) => p.restoring,
|
|
2993
|
+
(p) => p.restoringParallelismFactor
|
|
2985
2994
|
);
|
|
2986
2995
|
this.logger.timeEnd("finish module profiles");
|
|
2987
2996
|
}
|
|
@@ -2990,7 +2999,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
2990
2999
|
this.logger.timeEnd("compute affected modules");
|
|
2991
3000
|
this.logger.time("finish modules");
|
|
2992
3001
|
const { modules, moduleMemCaches } = this;
|
|
2993
|
-
this.hooks.finishModules.callAsync(modules, err => {
|
|
3002
|
+
this.hooks.finishModules.callAsync(modules, (err) => {
|
|
2994
3003
|
this.logger.timeEnd("finish modules");
|
|
2995
3004
|
if (err) return callback(/** @type {WebpackError} */ (err));
|
|
2996
3005
|
|
|
@@ -3061,7 +3070,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
3061
3070
|
* @param {WebpackError=} err err
|
|
3062
3071
|
* @returns {void}
|
|
3063
3072
|
*/
|
|
3064
|
-
const finalCallback = err => {
|
|
3073
|
+
const finalCallback = (err) => {
|
|
3065
3074
|
this.factorizeQueue.clear();
|
|
3066
3075
|
this.buildQueue.clear();
|
|
3067
3076
|
this.rebuildQueue.clear();
|
|
@@ -3139,11 +3148,11 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
3139
3148
|
* @param {Dependency[]} deps deps
|
|
3140
3149
|
* @returns {Module[]} sorted deps
|
|
3141
3150
|
*/
|
|
3142
|
-
const mapAndSort = deps =>
|
|
3151
|
+
const mapAndSort = (deps) =>
|
|
3143
3152
|
/** @type {Module[]} */
|
|
3144
|
-
(
|
|
3145
|
-
|
|
3146
|
-
);
|
|
3153
|
+
(
|
|
3154
|
+
deps.map((dep) => this.moduleGraph.getModule(dep)).filter(Boolean)
|
|
3155
|
+
).sort(compareModulesByIdentifier);
|
|
3147
3156
|
const includedModules = [
|
|
3148
3157
|
...mapAndSort(this.globalEntry.includeDependencies),
|
|
3149
3158
|
...mapAndSort(includeDependencies)
|
|
@@ -3250,7 +3259,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|
|
3250
3259
|
}
|
|
3251
3260
|
this.hooks.afterOptimizeChunks.call(this.chunks, this.chunkGroups);
|
|
3252
3261
|
|
|
3253
|
-
this.hooks.optimizeTree.callAsync(this.chunks, this.modules, err => {
|
|
3262
|
+
this.hooks.optimizeTree.callAsync(this.chunks, this.modules, (err) => {
|
|
3254
3263
|
if (err) {
|
|
3255
3264
|
return finalCallback(
|
|
3256
3265
|
makeWebpackError(err, "Compilation.hooks.optimizeTree")
|
|
@@ -3262,7 +3271,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|
|
3262
3271
|
this.hooks.optimizeChunkModules.callAsync(
|
|
3263
3272
|
this.chunks,
|
|
3264
3273
|
this.modules,
|
|
3265
|
-
err => {
|
|
3274
|
+
(err) => {
|
|
3266
3275
|
if (err) {
|
|
3267
3276
|
return finalCallback(
|
|
3268
3277
|
makeWebpackError(err, "Compilation.hooks.optimizeChunkModules")
|
|
@@ -3325,7 +3334,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|
|
3325
3334
|
|
|
3326
3335
|
this.logger.time("code generation");
|
|
3327
3336
|
this.hooks.beforeCodeGeneration.call();
|
|
3328
|
-
this.codeGeneration(err => {
|
|
3337
|
+
this.codeGeneration((err) => {
|
|
3329
3338
|
if (err) {
|
|
3330
3339
|
return finalCallback(err);
|
|
3331
3340
|
}
|
|
@@ -3344,7 +3353,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|
|
3344
3353
|
this.hooks.afterHash.call();
|
|
3345
3354
|
this.logger.timeEnd("hashing");
|
|
3346
3355
|
|
|
3347
|
-
this._runCodeGenerationJobs(codeGenerationJobs, err => {
|
|
3356
|
+
this._runCodeGenerationJobs(codeGenerationJobs, (err) => {
|
|
3348
3357
|
if (err) {
|
|
3349
3358
|
return finalCallback(err);
|
|
3350
3359
|
}
|
|
@@ -3367,7 +3376,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|
|
3367
3376
|
|
|
3368
3377
|
const cont = () => {
|
|
3369
3378
|
this.logger.time("process assets");
|
|
3370
|
-
this.hooks.processAssets.callAsync(this.assets, err => {
|
|
3379
|
+
this.hooks.processAssets.callAsync(this.assets, (err) => {
|
|
3371
3380
|
if (err) {
|
|
3372
3381
|
return finalCallback(
|
|
3373
3382
|
makeWebpackError(err, "Compilation.hooks.processAssets")
|
|
@@ -3403,7 +3412,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|
|
3403
3412
|
this.unseal();
|
|
3404
3413
|
return this.seal(callback);
|
|
3405
3414
|
}
|
|
3406
|
-
return this.hooks.afterSeal.callAsync(err => {
|
|
3415
|
+
return this.hooks.afterSeal.callAsync((err) => {
|
|
3407
3416
|
if (err) {
|
|
3408
3417
|
return finalCallback(
|
|
3409
3418
|
makeWebpackError(err, "Compilation.hooks.afterSeal")
|
|
@@ -3418,7 +3427,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|
|
3418
3427
|
this.logger.time("create chunk assets");
|
|
3419
3428
|
if (this.hooks.shouldGenerateChunkAssets.call() !== false) {
|
|
3420
3429
|
this.hooks.beforeChunkAssets.call();
|
|
3421
|
-
this.createChunkAssets(err => {
|
|
3430
|
+
this.createChunkAssets((err) => {
|
|
3422
3431
|
this.logger.timeEnd("create chunk assets");
|
|
3423
3432
|
if (err) {
|
|
3424
3433
|
return finalCallback(err);
|
|
@@ -3542,7 +3551,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|
|
3542
3551
|
if (
|
|
3543
3552
|
codeGenerationDependencies !== undefined &&
|
|
3544
3553
|
(notCodeGeneratedModules === undefined ||
|
|
3545
|
-
codeGenerationDependencies.some(dep => {
|
|
3554
|
+
codeGenerationDependencies.some((dep) => {
|
|
3546
3555
|
const referencedModule = /** @type {Module} */ (
|
|
3547
3556
|
moduleGraph.getModule(dep)
|
|
3548
3557
|
);
|
|
@@ -3574,7 +3583,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|
|
3574
3583
|
}
|
|
3575
3584
|
);
|
|
3576
3585
|
},
|
|
3577
|
-
err => {
|
|
3586
|
+
(err) => {
|
|
3578
3587
|
if (err) return callback(err);
|
|
3579
3588
|
if (delayedJobs.length > 0) {
|
|
3580
3589
|
if (delayedJobs.length === jobs.length) {
|
|
@@ -3583,7 +3592,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|
|
3583
3592
|
new Error(
|
|
3584
3593
|
`Unable to make progress during code generation because of circular code generation dependency: ${Array.from(
|
|
3585
3594
|
delayedModules,
|
|
3586
|
-
m => m.identifier()
|
|
3595
|
+
(m) => m.identifier()
|
|
3587
3596
|
).join(", ")}`
|
|
3588
3597
|
)
|
|
3589
3598
|
)
|
|
@@ -3597,7 +3606,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|
|
3597
3606
|
}
|
|
3598
3607
|
if (errors.length > 0) {
|
|
3599
3608
|
errors.sort(
|
|
3600
|
-
compareSelect(err => err.module, compareModulesByIdentifier)
|
|
3609
|
+
compareSelect((err) => err.module, compareModulesByIdentifier)
|
|
3601
3610
|
);
|
|
3602
3611
|
for (const error of errors) {
|
|
3603
3612
|
this.errors.push(error);
|
|
@@ -3644,7 +3653,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|
|
3644
3653
|
) {
|
|
3645
3654
|
let codeGenerated = false;
|
|
3646
3655
|
const cache = new MultiItemCache(
|
|
3647
|
-
runtimes.map(runtime =>
|
|
3656
|
+
runtimes.map((runtime) =>
|
|
3648
3657
|
this._codeGenerationCache.getItemCache(
|
|
3649
3658
|
`${module.identifier()}|${getRuntimeKey(runtime)}`,
|
|
3650
3659
|
`${hash}|${dependencyTemplates.getHash()}`
|
|
@@ -3683,7 +3692,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|
|
3683
3692
|
results.add(module, runtime, result);
|
|
3684
3693
|
}
|
|
3685
3694
|
if (!cachedResult) {
|
|
3686
|
-
cache.store(result, err =>
|
|
3695
|
+
cache.store(result, (err) =>
|
|
3687
3696
|
callback(/** @type {WebpackError} */ (err), codeGenerated)
|
|
3688
3697
|
);
|
|
3689
3698
|
} else {
|
|
@@ -4031,7 +4040,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|
|
4031
4040
|
* @param {Module} module module for processing
|
|
4032
4041
|
* @returns {void}
|
|
4033
4042
|
*/
|
|
4034
|
-
const processModule = module => {
|
|
4043
|
+
const processModule = (module) => {
|
|
4035
4044
|
if (!moduleGraph.setDepthIfLower(module, depth)) return;
|
|
4036
4045
|
queue.add(module);
|
|
4037
4046
|
};
|
|
@@ -4157,7 +4166,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|
|
4157
4166
|
/**
|
|
4158
4167
|
* @param {Dependency} d dependency to (maybe) patch up
|
|
4159
4168
|
*/
|
|
4160
|
-
const iteratorDependency = d => {
|
|
4169
|
+
const iteratorDependency = (d) => {
|
|
4161
4170
|
const depModule = this.moduleGraph.getModule(d);
|
|
4162
4171
|
if (!depModule) {
|
|
4163
4172
|
return;
|
|
@@ -4190,7 +4199,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|
|
4190
4199
|
/**
|
|
4191
4200
|
* @param {Entrypoint} ep an entrypoint
|
|
4192
4201
|
*/
|
|
4193
|
-
const processEntrypoint = ep => {
|
|
4202
|
+
const processEntrypoint = (ep) => {
|
|
4194
4203
|
const runtime = /** @type {string} */ (ep.options.runtime || ep.name);
|
|
4195
4204
|
const chunk = /** @type {Chunk} */ (ep.getRuntimeChunk());
|
|
4196
4205
|
chunkGraph.setRuntimeId(runtime, /** @type {ChunkId} */ (chunk.id));
|
|
@@ -4273,7 +4282,9 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|
|
4273
4282
|
}
|
|
4274
4283
|
}
|
|
4275
4284
|
if (errors.length > 0) {
|
|
4276
|
-
errors.sort(
|
|
4285
|
+
errors.sort(
|
|
4286
|
+
compareSelect((err) => err.module, compareModulesByIdentifier)
|
|
4287
|
+
);
|
|
4277
4288
|
for (const error of errors) {
|
|
4278
4289
|
this.errors.push(error);
|
|
4279
4290
|
}
|
|
@@ -4410,7 +4421,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|
|
4410
4421
|
for (const info of runtimeChunksMap.values()) {
|
|
4411
4422
|
for (const other of new Set(
|
|
4412
4423
|
[...info.chunk.getAllReferencedAsyncEntrypoints()].map(
|
|
4413
|
-
e => e.chunks[e.chunks.length - 1]
|
|
4424
|
+
(e) => e.chunks[e.chunks.length - 1]
|
|
4414
4425
|
)
|
|
4415
4426
|
)) {
|
|
4416
4427
|
const otherInfo =
|
|
@@ -4463,11 +4474,11 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|
|
4463
4474
|
circularRuntimeChunkInfo.push(info);
|
|
4464
4475
|
}
|
|
4465
4476
|
}
|
|
4466
|
-
circularRuntimeChunkInfo.sort(compareSelect(i => i.chunk, byId));
|
|
4477
|
+
circularRuntimeChunkInfo.sort(compareSelect((i) => i.chunk, byId));
|
|
4467
4478
|
const err =
|
|
4468
4479
|
new WebpackError(`Circular dependency between chunks with runtime (${Array.from(
|
|
4469
4480
|
circularRuntimeChunkInfo,
|
|
4470
|
-
c => c.chunk.name || c.chunk.id
|
|
4481
|
+
(c) => c.chunk.name || c.chunk.id
|
|
4471
4482
|
).join(", ")})
|
|
4472
4483
|
This prevents using hashes of each other and should be avoided.`);
|
|
4473
4484
|
err.chunk = circularRuntimeChunkInfo[0].chunk;
|
|
@@ -4487,7 +4498,7 @@ This prevents using hashes of each other and should be avoided.`);
|
|
|
4487
4498
|
/**
|
|
4488
4499
|
* @param {Chunk} chunk chunk
|
|
4489
4500
|
*/
|
|
4490
|
-
const processChunk = chunk => {
|
|
4501
|
+
const processChunk = (chunk) => {
|
|
4491
4502
|
// Last minute module hash generation for modules that depend on chunk hashes
|
|
4492
4503
|
this.logger.time("hashing: hash runtime modules");
|
|
4493
4504
|
const runtime = chunk.runtime;
|
|
@@ -4564,7 +4575,9 @@ This prevents using hashes of each other and should be avoided.`);
|
|
|
4564
4575
|
for (const chunk of runtimeChunks) processChunk(chunk);
|
|
4565
4576
|
for (const chunk of initialChunks) processChunk(chunk);
|
|
4566
4577
|
if (errors.length > 0) {
|
|
4567
|
-
errors.sort(
|
|
4578
|
+
errors.sort(
|
|
4579
|
+
compareSelect((err) => err.module, compareModulesByIdentifier)
|
|
4580
|
+
);
|
|
4568
4581
|
for (const error of errors) {
|
|
4569
4582
|
this.errors.push(error);
|
|
4570
4583
|
}
|
|
@@ -4671,7 +4684,7 @@ This prevents using hashes of each other and should be avoided.`);
|
|
|
4671
4684
|
/**
|
|
4672
4685
|
* @param {string} name name
|
|
4673
4686
|
*/
|
|
4674
|
-
const remove = name => {
|
|
4687
|
+
const remove = (name) => {
|
|
4675
4688
|
const relatedIn = this._assetsRelatedIn.get(name);
|
|
4676
4689
|
if (relatedIn === undefined) return;
|
|
4677
4690
|
const entry = relatedIn.get(key);
|
|
@@ -4696,7 +4709,7 @@ This prevents using hashes of each other and should be avoided.`);
|
|
|
4696
4709
|
/**
|
|
4697
4710
|
* @param {string} name name
|
|
4698
4711
|
*/
|
|
4699
|
-
const add = name => {
|
|
4712
|
+
const add = (name) => {
|
|
4700
4713
|
let relatedIn = this._assetsRelatedIn.get(name);
|
|
4701
4714
|
if (relatedIn === undefined) {
|
|
4702
4715
|
this._assetsRelatedIn.set(name, (relatedIn = new Map()));
|
|
@@ -4783,7 +4796,7 @@ This prevents using hashes of each other and should be avoided.`);
|
|
|
4783
4796
|
const entry = related[key];
|
|
4784
4797
|
let newEntry;
|
|
4785
4798
|
if (Array.isArray(entry)) {
|
|
4786
|
-
newEntry = entry.map(x => (x === file ? newFile : x));
|
|
4799
|
+
newEntry = entry.map((x) => (x === file ? newFile : x));
|
|
4787
4800
|
} else if (entry === file) {
|
|
4788
4801
|
newEntry = newFile;
|
|
4789
4802
|
} else {
|
|
@@ -4837,7 +4850,7 @@ This prevents using hashes of each other and should be avoided.`);
|
|
|
4837
4850
|
/**
|
|
4838
4851
|
* @param {string} file file
|
|
4839
4852
|
*/
|
|
4840
|
-
const checkUsedAndDelete = file => {
|
|
4853
|
+
const checkUsedAndDelete = (file) => {
|
|
4841
4854
|
if (!this._assetsRelatedIn.has(file)) {
|
|
4842
4855
|
this.deleteAsset(file);
|
|
4843
4856
|
}
|
|
@@ -4987,7 +5000,7 @@ This prevents using hashes of each other and should be avoided.`);
|
|
|
4987
5000
|
* @param {Error} err error
|
|
4988
5001
|
* @returns {void}
|
|
4989
5002
|
*/
|
|
4990
|
-
const errorAndCallback = err => {
|
|
5003
|
+
const errorAndCallback = (err) => {
|
|
4991
5004
|
const filename =
|
|
4992
5005
|
file ||
|
|
4993
5006
|
(typeof file === "string"
|
|
@@ -5068,7 +5081,7 @@ This prevents using hashes of each other and should be avoided.`);
|
|
|
5068
5081
|
chunk
|
|
5069
5082
|
});
|
|
5070
5083
|
if (source !== sourceFromCache) {
|
|
5071
|
-
assetCacheItem.store(source, err => {
|
|
5084
|
+
assetCacheItem.store(source, (err) => {
|
|
5072
5085
|
if (err) return errorAndCallback(err);
|
|
5073
5086
|
inTry = false;
|
|
5074
5087
|
return callback();
|
|
@@ -5190,9 +5203,9 @@ This prevents using hashes of each other and should be avoided.`);
|
|
|
5190
5203
|
modules,
|
|
5191
5204
|
10,
|
|
5192
5205
|
(module, push, callback) => {
|
|
5193
|
-
this.buildQueue.waitFor(module, err => {
|
|
5206
|
+
this.buildQueue.waitFor(module, (err) => {
|
|
5194
5207
|
if (err) return callback(err);
|
|
5195
|
-
this.processDependenciesQueue.waitFor(module, err => {
|
|
5208
|
+
this.processDependenciesQueue.waitFor(module, (err) => {
|
|
5196
5209
|
if (err) return callback(err);
|
|
5197
5210
|
for (const { module: m } of this.moduleGraph.getOutgoingConnections(
|
|
5198
5211
|
module
|
|
@@ -5205,7 +5218,7 @@ This prevents using hashes of each other and should be avoided.`);
|
|
|
5205
5218
|
});
|
|
5206
5219
|
});
|
|
5207
5220
|
},
|
|
5208
|
-
err => {
|
|
5221
|
+
(err) => {
|
|
5209
5222
|
if (err) return callback(/** @type {WebpackError} */ (err));
|
|
5210
5223
|
|
|
5211
5224
|
// Create new chunk graph, chunk and entrypoint for the build time execution
|
|
@@ -5288,7 +5301,7 @@ This prevents using hashes of each other and should be avoided.`);
|
|
|
5288
5301
|
const reportErrors = () => {
|
|
5289
5302
|
if (errors.length > 0) {
|
|
5290
5303
|
errors.sort(
|
|
5291
|
-
compareSelect(err => err.module, compareModulesByIdentifier)
|
|
5304
|
+
compareSelect((err) => err.module, compareModulesByIdentifier)
|
|
5292
5305
|
);
|
|
5293
5306
|
for (const error of errors) {
|
|
5294
5307
|
this.errors.push(error);
|
|
@@ -5298,7 +5311,7 @@ This prevents using hashes of each other and should be avoided.`);
|
|
|
5298
5311
|
};
|
|
5299
5312
|
|
|
5300
5313
|
// Generate code for all aggregated modules
|
|
5301
|
-
asyncLib.eachLimit(modules, 10, codeGen, err => {
|
|
5314
|
+
asyncLib.eachLimit(modules, 10, codeGen, (err) => {
|
|
5302
5315
|
if (err) return callback(err);
|
|
5303
5316
|
reportErrors();
|
|
5304
5317
|
|
|
@@ -5334,7 +5347,7 @@ This prevents using hashes of each other and should be avoided.`);
|
|
|
5334
5347
|
}
|
|
5335
5348
|
|
|
5336
5349
|
// Generate code for all runtime modules
|
|
5337
|
-
asyncLib.eachLimit(runtimeModules, 10, codeGen, err => {
|
|
5350
|
+
asyncLib.eachLimit(runtimeModules, 10, codeGen, (err) => {
|
|
5338
5351
|
if (err) return callback(err);
|
|
5339
5352
|
reportErrors();
|
|
5340
5353
|
|
|
@@ -5410,7 +5423,7 @@ This prevents using hashes of each other and should be avoided.`);
|
|
|
5410
5423
|
callback
|
|
5411
5424
|
);
|
|
5412
5425
|
},
|
|
5413
|
-
err => {
|
|
5426
|
+
(err) => {
|
|
5414
5427
|
if (err) return callback(err);
|
|
5415
5428
|
|
|
5416
5429
|
/** @type {ExecuteModuleExports | undefined} */
|
|
@@ -5422,7 +5435,7 @@ This prevents using hashes of each other and should be avoided.`);
|
|
|
5422
5435
|
} = this.outputOptions;
|
|
5423
5436
|
|
|
5424
5437
|
/** @type {WebpackRequire} */
|
|
5425
|
-
const __webpack_require__ = id => {
|
|
5438
|
+
const __webpack_require__ = (id) => {
|
|
5426
5439
|
const cached = moduleCache[id];
|
|
5427
5440
|
if (cached !== undefined) {
|
|
5428
5441
|
if (cached.error) throw cached.error;
|
|
@@ -5656,7 +5669,7 @@ Object.defineProperty(compilationPrototype, "cache", {
|
|
|
5656
5669
|
/**
|
|
5657
5670
|
* @param {EXPECTED_ANY} _v value
|
|
5658
5671
|
*/
|
|
5659
|
-
_v => {},
|
|
5672
|
+
(_v) => {},
|
|
5660
5673
|
"Compilation.cache was removed in favor of Compilation.getCache()",
|
|
5661
5674
|
"DEP_WEBPACK_COMPILATION_CACHE"
|
|
5662
5675
|
)
|