From 703d9acfe7d40b5c4ea5e140d88d4519c31d4659 Mon Sep 17 00:00:00 2001
From: Alexander Akait <4567934+alexander-akait@users.noreply.github.com>
Date: Wed, 16 Jul 2025 19:13:14 +0300
Subject: [PATCH] style: set `arrowParens` to `true` (#19706)
---
.prettierrc.js | 2 +-
bin/webpack.js | 14 +-
eslint.config.mjs | 4 -
lib/APIPlugin.js | 18 +-
lib/AutomaticPrefetchPlugin.js | 4 +-
lib/BannerPlugin.js | 8 +-
lib/Cache.js | 2 +-
lib/CacheFacade.js | 14 +-
lib/CaseSensitiveModulesWarning.js | 4 +-
lib/Chunk.js | 6 +-
lib/ChunkGraph.js | 39 +--
lib/ChunkGroup.js | 8 +-
lib/CleanPlugin.js | 28 +-
lib/CodeGenerationResults.js | 6 +-
lib/CompatibilityPlugin.js | 12 +-
lib/Compilation.js | 241 +++++++++---------
lib/Compiler.js | 74 +++---
lib/ConstPlugin.js | 22 +-
lib/ContextExclusionPlugin.js | 6 +-
lib/ContextModule.js | 23 +-
lib/ContextModuleFactory.js | 22 +-
lib/ContextReplacementPlugin.js | 10 +-
lib/DefinePlugin.js | 46 ++--
lib/DelegatedModuleFactoryPlugin.js | 2 +-
lib/DllEntryPlugin.js | 2 +-
lib/DllReferencePlugin.js | 2 +-
lib/DynamicEntryPlugin.js | 6 +-
lib/EntryPlugin.js | 2 +-
lib/EnvironmentPlugin.js | 2 +-
lib/ErrorHelpers.js | 4 +-
lib/EvalDevToolModulePlugin.js | 4 +-
lib/EvalSourceMapDevToolPlugin.js | 10 +-
lib/ExportsInfo.js | 18 +-
lib/ExportsInfoApiPlugin.js | 4 +-
lib/ExternalModule.js | 6 +-
lib/ExternalModuleFactoryPlugin.js | 4 +-
lib/FileSystemInfo.js | 114 ++++-----
lib/FlagAllModulesAsUsedPlugin.js | 4 +-
lib/FlagDependencyExportsPlugin.js | 14 +-
lib/FlagDependencyUsagePlugin.js | 8 +-
lib/FlagEntryExportAsUsedPlugin.js | 2 +-
lib/HotModuleReplacementPlugin.js | 54 ++--
lib/IgnorePlugin.js | 6 +-
lib/IgnoreWarningsPlugin.js | 8 +-
lib/InvalidDependenciesModuleWarning.js | 2 +-
lib/JavascriptMetaInfoPlugin.js | 2 +-
lib/LibManifestPlugin.js | 4 +-
lib/LoaderOptionsPlugin.js | 2 +-
lib/LoaderTargetPlugin.js | 4 +-
lib/MainTemplate.js | 2 +-
lib/Module.js | 2 +-
lib/ModuleFilenameHelpers.js | 6 +-
lib/ModuleGraph.js | 6 +-
lib/ModuleInfoHeaderPlugin.js | 6 +-
lib/ModuleParseError.js | 8 +-
lib/MultiCompiler.js | 48 ++--
lib/MultiStats.js | 20 +-
lib/MultiWatching.js | 2 +-
lib/NoEmitOnErrorsPlugin.js | 4 +-
lib/NodeStuffPlugin.js | 20 +-
lib/NormalModule.js | 46 ++--
lib/NormalModuleFactory.js | 44 ++--
lib/NormalModuleReplacementPlugin.js | 6 +-
lib/PrefetchPlugin.js | 2 +-
lib/ProgressPlugin.js | 22 +-
lib/ProvidePlugin.js | 4 +-
lib/RecordIdsPlugin.js | 6 +-
lib/ResolverFactory.js | 6 +-
lib/RuntimePlugin.js | 32 +--
lib/RuntimeTemplate.js | 26 +-
lib/SizeFormatHelpers.js | 2 +-
lib/SourceMapDevToolModuleOptionsPlugin.js | 8 +-
lib/SourceMapDevToolPlugin.js | 18 +-
lib/Stats.js | 4 +-
lib/Template.js | 2 +-
lib/TemplatedPathPlugin.js | 4 +-
lib/UseStrictPlugin.js | 2 +-
lib/WarnCaseSensitiveModulesPlugin.js | 2 +-
lib/WarnDeprecatedOptionPlugin.js | 2 +-
lib/WarnNoModeSetPlugin.js | 2 +-
lib/WatchIgnorePlugin.js | 4 +-
lib/Watching.js | 24 +-
lib/WebpackIsIncludedPlugin.js | 4 +-
lib/WebpackOptionsApply.js | 6 +-
lib/asset/AssetGenerator.js | 2 +-
lib/asset/AssetModulesPlugin.js | 12 +-
lib/async-modules/AsyncModuleHelpers.js | 2 +-
lib/async-modules/InferAsyncModulesPlugin.js | 6 +-
lib/buildChunkGraph.js | 10 +-
lib/cache/AddBuildDependenciesPlugin.js | 2 +-
lib/cache/IdleFileCachePlugin.js | 10 +-
lib/cache/PackFileCacheStrategy.js | 40 +--
lib/cache/ResolverCachePlugin.js | 8 +-
lib/cli.js | 28 +-
lib/config/browserslistTargetHandler.js | 12 +-
lib/config/defaults.js | 24 +-
lib/config/normalization.js | 79 +++---
lib/config/target.js | 8 +-
lib/container/ContainerEntryModule.js | 6 +-
lib/container/ContainerPlugin.js | 6 +-
lib/container/ContainerReferencePlugin.js | 6 +-
lib/container/FallbackModule.js | 2 +-
.../HoistContainerReferencesPlugin.js | 14 +-
lib/container/options.js | 8 +-
lib/css/CssGenerator.js | 2 +-
lib/css/CssLoadingRuntimeModule.js | 2 +-
lib/css/CssModulesPlugin.js | 45 ++--
lib/css/CssParser.js | 10 +-
lib/css/walkCssTokens.js | 18 +-
lib/debug/ProfilingPlugin.js | 10 +-
.../AMDDefineDependencyParserPlugin.js | 8 +-
lib/dependencies/AMDPlugin.js | 6 +-
lib/dependencies/AMDRequireArrayDependency.js | 2 +-
...AMDRequireDependenciesBlockParserPlugin.js | 6 +-
.../CommonJsExportRequireDependency.js | 4 +-
.../CommonJsExportsParserPlugin.js | 22 +-
.../CommonJsImportsParserPlugin.js | 40 +--
lib/dependencies/CommonJsPlugin.js | 4 +-
lib/dependencies/ContextDependency.js | 2 +-
lib/dependencies/ContextDependencyHelpers.js | 6 +-
lib/dependencies/CssIcssExportDependency.js | 4 +-
.../CssLocalIdentifierDependency.js | 4 +-
lib/dependencies/CssUrlDependency.js | 8 +-
lib/dependencies/DynamicExports.js | 10 +-
lib/dependencies/HarmonyAcceptDependency.js | 2 +-
.../HarmonyDetectionParserPlugin.js | 4 +-
.../HarmonyExportDependencyParserPlugin.js | 4 +-
...armonyExportImportedSpecifierDependency.js | 8 +-
lib/dependencies/HarmonyExportInitFragment.js | 2 +-
lib/dependencies/HarmonyExports.js | 2 +-
lib/dependencies/HarmonyImportDependency.js | 10 +-
.../HarmonyImportDependencyParserPlugin.js | 68 ++---
.../HarmonyImportSideEffectDependency.js | 2 +-
.../HarmonyTopLevelThisParserPlugin.js | 2 +-
...ImportMetaContextDependencyParserPlugin.js | 8 +-
lib/dependencies/ImportMetaPlugin.js | 14 +-
lib/dependencies/ImportParserPlugin.js | 8 +-
lib/dependencies/JsonExportsDependency.js | 2 +-
lib/dependencies/LoaderPlugin.js | 8 +-
lib/dependencies/ProvidedDependency.js | 4 +-
lib/dependencies/PureExpressionDependency.js | 2 +-
.../RequireContextDependencyParserPlugin.js | 2 +-
...uireEnsureDependenciesBlockParserPlugin.js | 2 +-
.../RequireIncludeDependencyParserPlugin.js | 6 +-
lib/dependencies/SystemPlugin.js | 6 +-
lib/dependencies/WorkerPlugin.js | 10 +-
lib/dependencies/getFunctionExpression.js | 2 +-
lib/esm/ModuleChunkFormatPlugin.js | 2 +-
lib/esm/ModuleChunkLoadingPlugin.js | 4 +-
lib/esm/ModuleChunkLoadingRuntimeModule.js | 2 +-
lib/formatLocation.js | 4 +-
.../JavascriptHotModuleReplacementHelper.js | 2 +-
lib/hmr/LazyCompilationPlugin.js | 12 +-
lib/hmr/lazyCompilationBackend.js | 12 +-
lib/ids/ChunkModuleIdRangePlugin.js | 8 +-
lib/ids/DeterministicChunkIdsPlugin.js | 9 +-
lib/ids/DeterministicModuleIdsPlugin.js | 4 +-
lib/ids/HashedModuleIdsPlugin.js | 2 +-
lib/ids/IdHelpers.js | 18 +-
lib/ids/NamedChunkIdsPlugin.js | 10 +-
lib/ids/NamedModuleIdsPlugin.js | 4 +-
lib/ids/NaturalChunkIdsPlugin.js | 4 +-
lib/ids/NaturalModuleIdsPlugin.js | 2 +-
lib/ids/OccurrenceChunkIdsPlugin.js | 4 +-
lib/ids/OccurrenceModuleIdsPlugin.js | 8 +-
lib/ids/SyncModuleIdsPlugin.js | 8 +-
lib/index.js | 6 +-
.../ArrayPushCallbackChunkFormatPlugin.js | 2 +-
lib/javascript/BasicEvaluatedExpression.js | 6 +-
lib/javascript/CommonJsChunkFormatPlugin.js | 2 +-
lib/javascript/EnableChunkLoadingPlugin.js | 2 +-
lib/javascript/JavascriptGenerator.js | 2 +-
lib/javascript/JavascriptModulesPlugin.js | 30 +--
lib/javascript/JavascriptParser.js | 156 ++++++------
lib/javascript/JavascriptParserHelpers.js | 6 +-
lib/javascript/StartupHelpers.js | 4 +-
lib/json/JsonGenerator.js | 4 +-
lib/json/JsonModulesPlugin.js | 4 +-
lib/library/AbstractLibraryPlugin.js | 6 +-
lib/library/AmdLibraryPlugin.js | 6 +-
lib/library/AssignLibraryPlugin.js | 4 +-
lib/library/EnableLibraryPlugin.js | 4 +-
lib/library/ModuleLibraryPlugin.js | 4 +-
lib/library/SystemLibraryPlugin.js | 10 +-
lib/library/UmdLibraryPlugin.js | 28 +-
lib/logging/createConsoleLogger.js | 8 +-
lib/logging/runtime.js | 6 +-
lib/logging/truncateArgs.js | 8 +-
lib/node/CommonJsChunkLoadingPlugin.js | 4 +-
lib/node/NodeEnvironmentPlugin.js | 2 +-
lib/node/ReadFileChunkLoadingRuntimeModule.js | 2 +-
lib/node/ReadFileCompileAsyncWasmPlugin.js | 10 +-
lib/node/ReadFileCompileWasmPlugin.js | 10 +-
lib/node/RequireChunkLoadingRuntimeModule.js | 2 +-
lib/node/nodeConsole.js | 4 +-
lib/optimize/AggressiveMergingPlugin.js | 4 +-
lib/optimize/AggressiveSplittingPlugin.js | 20 +-
lib/optimize/ConcatenatedModule.js | 23 +-
lib/optimize/EnsureChunkConditionsPlugin.js | 4 +-
lib/optimize/FlagIncludedChunksPlugin.js | 4 +-
lib/optimize/InnerGraph.js | 10 +-
lib/optimize/InnerGraphPlugin.js | 26 +-
lib/optimize/LimitChunkCountPlugin.js | 10 +-
lib/optimize/MangleExportsPlugin.js | 10 +-
lib/optimize/MergeDuplicateChunksPlugin.js | 4 +-
lib/optimize/MinChunkSizePlugin.js | 6 +-
lib/optimize/ModuleConcatenationPlugin.js | 80 +++---
lib/optimize/RealContentHashPlugin.js | 46 ++--
lib/optimize/RemoveEmptyChunksPlugin.js | 4 +-
lib/optimize/RemoveParentModulesPlugin.js | 6 +-
lib/optimize/RuntimeChunkPlugin.js | 4 +-
lib/optimize/SideEffectsFlagPlugin.js | 10 +-
lib/optimize/SplitChunksPlugin.js | 40 +--
lib/performance/AssetsOverSizeLimitWarning.js | 2 +-
.../EntrypointsOverSizeLimitWarning.js | 4 +-
lib/performance/SizeLimitsPlugin.js | 8 +-
lib/prefetch/ChunkPrefetchPreloadPlugin.js | 2 +-
.../ChunkPrefetchStartupRuntimeModule.js | 6 +-
lib/rules/BasicMatcherRulePlugin.js | 2 +-
lib/rules/RuleSetCompiler.js | 20 +-
lib/rules/UseEffectRulePlugin.js | 4 +-
lib/runtime/GetChunkFilenameRuntimeModule.js | 30 +--
lib/runtime/GetMainFilenameRuntimeModule.js | 2 +-
.../GetTrustedTypesPolicyRuntimeModule.js | 2 +-
.../MakeDeferredNamespaceObjectRuntime.js | 2 +-
lib/runtime/StartupChunkDependenciesPlugin.js | 4 +-
.../StartupChunkDependenciesRuntimeModule.js | 6 +-
lib/schemes/DataUriPlugin.js | 6 +-
lib/schemes/FileUriPlugin.js | 2 +-
lib/schemes/HttpUriPlugin.js | 76 +++---
lib/schemes/VirtualUrlPlugin.js | 2 +-
lib/serialization/BinaryMiddleware.js | 22 +-
lib/serialization/FileMiddleware.js | 34 +--
lib/serialization/ObjectMiddleware.js | 16 +-
lib/serialization/Serializer.js | 4 +-
lib/serialization/SerializerMiddleware.js | 4 +-
lib/sharing/ConsumeSharedPlugin.js | 8 +-
lib/sharing/ProvideSharedPlugin.js | 8 +-
lib/sharing/SharePlugin.js | 2 +-
lib/sharing/resolveMatchedConfigs.js | 2 +-
lib/stats/DefaultStatsFactoryPlugin.js | 163 ++++++------
lib/stats/DefaultStatsPresetPlugin.js | 20 +-
lib/stats/DefaultStatsPrinterPlugin.js | 174 ++++++-------
lib/stats/StatsFactory.js | 14 +-
lib/stats/StatsPrinter.js | 18 +-
lib/url/URLParserPlugin.js | 10 +-
lib/util/AsyncQueue.js | 8 +-
lib/util/IterableHelpers.js | 4 +-
lib/util/LazyBucketSortedSet.js | 6 +-
lib/util/SetHelpers.js | 4 +-
lib/util/StackedCacheMap.js | 2 +-
lib/util/StackedMap.js | 2 +-
lib/util/TupleSet.js | 2 +-
lib/util/WeakTupleMap.js | 2 +-
lib/util/cleverMerge.js | 16 +-
lib/util/comparators.js | 20 +-
lib/util/compileBooleanMatcher.js | 40 +--
lib/util/concatenate.js | 6 +-
lib/util/conventions.js | 8 +-
lib/util/create-schema-validation.js | 2 +-
lib/util/createHash.js | 2 +-
lib/util/deprecation.js | 8 +-
lib/util/deterministicGrouping.js | 14 +-
lib/util/findGraphRoots.js | 2 +-
lib/util/fs.js | 6 +-
lib/util/identifier.js | 28 +-
lib/util/memoize.js | 2 +-
lib/util/processAsyncTree.js | 4 +-
lib/util/propertyName.js | 2 +-
lib/util/removeBOM.js | 2 +-
lib/util/runtime.js | 12 +-
lib/util/semver.js | 32 +--
lib/util/serialization.js | 10 +-
lib/util/smartGrouping.js | 2 +-
lib/validateSchema.js | 4 +-
.../AsyncWasmLoadingRuntimeModule.js | 2 +-
.../AsyncWebAssemblyJavascriptGenerator.js | 2 +-
.../UniversalCompileAsyncWasmPlugin.js | 8 +-
.../WasmChunkLoadingRuntimeModule.js | 22 +-
lib/wasm-sync/WasmFinalizeExportsPlugin.js | 4 +-
lib/wasm-sync/WebAssemblyGenerator.js | 28 +-
.../WebAssemblyInInitialChunkError.js | 6 +-
lib/wasm-sync/WebAssemblyParser.js | 4 +-
lib/wasm/EnableWasmLoadingPlugin.js | 2 +-
lib/web/FetchCompileAsyncWasmPlugin.js | 8 +-
lib/web/FetchCompileWasmPlugin.js | 8 +-
lib/web/JsonpChunkLoadingPlugin.js | 4 +-
lib/web/JsonpChunkLoadingRuntimeModule.js | 2 +-
lib/webpack.js | 9 +-
.../ImportScriptsChunkLoadingPlugin.js | 4 +-
.../ImportScriptsChunkLoadingRuntimeModule.js | 2 +-
setup/setup.js | 16 +-
test/ArrayHelpers.unittest.js | 7 +-
test/BannerPlugin.test.js | 18 +-
test/BenchmarkTestCases.benchmark.mjs | 34 +--
test/BinaryMiddleware.unittest.js | 6 +-
test/BuildDependencies.longtest.js | 12 +-
test/ChangesAndRemovals.test.js | 28 +-
test/Cli.basictest.js | 30 +--
test/Compiler-caching.test.js | 10 +-
test/Compiler-filesystem-caching.test.js | 14 +-
test/Compiler.test.js | 90 +++----
test/ConfigTestCases.template.js | 34 +--
test/ContextModuleFactory.unittest.js | 16 +-
test/Defaults.unittest.js | 91 +++----
test/Errors.test.js | 2 +-
test/Examples.test.js | 4 +-
test/FileSystemInfo.unittest.js | 34 +--
test/HotModuleReplacementPlugin.test.js | 12 +-
test/HotTestCases.template.js | 14 +-
test/JavascriptParser.unittest.js | 44 ++--
test/MemoryLimitTestCases.test.js | 8 +-
test/MultiCompiler.test.js | 52 ++--
test/MultiItemCache.unittest.js | 2 +-
test/MultiStats.test.js | 2 +-
test/MultiWatching.unittest.js | 2 +-
test/NodeTemplatePlugin.test.js | 12 +-
test/PersistentCaching.test.js | 12 +-
test/ProfilingPlugin.test.js | 6 +-
test/ProgressPlugin.test.js | 18 +-
test/SemVer.unittest.js | 2 +-
test/Stats.test.js | 2 +-
test/StatsTestCases.basictest.js | 16 +-
test/TestCases.template.js | 38 +--
test/TestCasesAllCombined.longtest.js | 2 +-
test/Validation.test.js | 78 +++---
test/Watch.test.js | 4 +-
test/WatchClose.test.js | 2 +-
test/WatchDetection.test.js | 4 +-
test/WatchSuspend.test.js | 12 +-
test/WatchTestCases.template.js | 26 +-
test/WatcherEvents.test.js | 6 +-
test/cases/chunks/runtime/test.filter.js | 2 +-
test/cases/esm/import-meta/test.filter.js | 2 +-
test/cases/loaders/context/test.filter.js | 2 +-
test/cases/loaders/emit-file/test.filter.js | 2 +-
.../loaders/import-module/test.filter.js | 2 +-
test/cases/loaders/pug-loader/test.filter.js | 2 +-
.../test.filter.js | 2 +-
.../side-effects-all-used/test.filter.js | 2 +-
.../test.filter.js | 2 +-
.../test.filter.js | 2 +-
.../side-effects-root-unused/test.filter.js | 2 +-
.../side-effects-simple-unused/test.filter.js | 2 +-
.../test.filter.js | 2 +-
.../test.filter.js | 2 +-
test/cases/parsing/iife/test.filter.js | 2 +-
.../issue-4608-1-non-strict/test.filter.js | 2 +-
test/cases/parsing/issue-7519/test.filter.js | 2 +-
.../parsing/typeof-non-module/test.filter.js | 2 +-
test/cases/parsing/using/test.filter.js | 2 +-
test/checkArrayExpectation.js | 14 +-
test/compareLocations.unittest.js | 2 +-
test/compareSourceOrder.unittest.js | 14 +-
test/compileBooleanMatcher.unittest.js | 18 +-
.../additional-pass/simple/webpack.config.js | 2 +-
.../asset-emitted/normal/webpack.config.js | 2 +-
.../data-url-broken/infrastructure-log.js | 2 +-
.../entry-with-runtimeChunk/webpack.config.js | 18 +-
.../errored/infrastructure-log.js | 2 +-
.../keep-source-maps/webpack.config.js | 2 +-
.../only-entry/webpack.config.js | 2 +-
.../assets/delete-asset/webpack.config.js | 4 +-
.../webpack.config.js | 4 +-
.../webpack.config.js | 2 +-
.../managed-items/webpack.config.js | 2 +-
.../chunk-index/issue-18008/webpack.config.js | 2 +-
.../order-multiple-entries/webpack.config.js | 10 +-
.../recalc-index/webpack.config.js | 2 +-
test/configCases/clean/dry/webpack.config.js | 8 +-
.../clean/enabled/webpack.config.js | 8 +-
.../clean/ignore-fn/webpack.config.js | 8 +-
.../clean/ignore-hook/webpack.config.js | 10 +-
.../clean/ignore-rx/webpack.config.js | 8 +-
.../lib-manifest-plugin/webpack.config.js | 6 +-
test/configCases/clean/link/webpack.config.js | 4 +-
.../container-reference/test.config.js | 4 +-
.../module-federation/test.config.js | 4 +-
.../css-generator-options/webpack.config.js | 2 +-
.../webpack.config.js | 4 +-
.../css/css-modules-in-node/webpack.config.js | 4 +-
.../css/css-modules/webpack.config.js | 4 +-
.../css/exports-convention/webpack.config.js | 2 +-
.../webpack.config.js | 8 +-
.../runtime-data-webpack/webpack.config.js | 4 +-
.../webpack.config.js | 4 +-
.../localization/webpack.config.js | 4 +-
.../webpack.config.js | 6 +-
.../remove-export/webpack.config.js | 6 +-
.../chunk-and-module/webpack.config.js | 4 +-
.../chunk-files/webpack.config.js | 2 +-
.../invalid-dependencies/webpack.config.js | 6 +-
.../non-unique-hash/webpack.config.js | 4 +-
.../browserslist-config-env/webpack.config.js | 4 +-
.../browserslist-config/webpack.config.js | 4 +-
.../browserslist-missing/test.filter.js | 2 +-
.../browserslist-query/webpack.config.js | 4 +-
.../browserslist/webpack.config.js | 4 +-
.../depend-on-advanced/webpack.config.js | 2 +-
.../entry/depend-on-simple/webpack.config.js | 2 +-
.../webpack.config.js | 2 +-
.../infrastructure-log.js | 2 +-
.../concatenated-module/webpack.config.js | 2 +-
.../import-assertion/webpack.config.js | 2 +-
.../import-attributes/webpack.config.js | 2 +-
.../filename-function/webpack.config.js | 6 +-
.../finish-modules/simple/webpack.config.js | 2 +-
.../output-filename/test.config.js | 2 +-
.../issues/issue-3596/webpack.config.js | 2 +-
.../issues/issue-7563/test.config.js | 2 +-
.../define-multiple-entries/webpack.config.js | 2 +-
.../define-single-entry/webpack.config.js | 2 +-
.../configCases/layer/rules/webpack.config.js | 2 +-
.../0-create-library/webpack.config.js | 4 +-
.../library/1-use-library/test.config.js | 2 +-
.../library/1-use-library/webpack.config.js | 4 +-
.../disable-provided-export/webpack.config.js | 2 +-
.../webpack.config.js | 4 +-
.../module-reexport-type/webpack.config.js | 6 +-
.../css/webpack.config.js | 4 +-
.../webpack.config.js | 2 +-
.../module/check-defaults/test.filter.js | 2 +-
.../circular-externals/webpack.config.js | 2 +-
.../non-webpack-require/webpack.config.js | 2 +-
.../output/function/webpack.config.js | 2 +-
.../output/publicPath-web/webpack.config.js | 2 +-
.../dead-code-elimination/webpack.config.js | 2 +-
.../mini-css-extract-plugin/webpack.config.js | 6 +-
.../plugins/progress-plugin/webpack.config.js | 4 +-
.../virtual-url-plugin/webpack.config.js | 2 +-
.../html-plugin/webpack.config.js | 28 +-
.../update-info/webpack.config.js | 8 +-
.../rebuild/finishModules/webpack.config.js | 8 +-
.../webpack.config.js | 8 +-
.../prefer-absolute/webpack.config.js | 2 +-
.../resolving/prefer-root/webpack.config.js | 2 +-
.../simple-use-fn-array/webpack.config.js | 2 +-
.../webpack.config.js | 2 +-
.../webpack.config.js | 2 +-
.../webpack.config.js | 2 +-
.../webpack.config.js | 2 +-
.../webpack.config.js | 2 +-
.../no-source-map/webpack.config.js | 4 +-
.../target-node/webpack.config.js | 2 +-
.../webpack.config.js | 4 +-
.../runtime-chunk-no-async/test.config.js | 2 +-
.../types/filesystems/webpack.config.js | 2 +-
.../utils/lazy-set/webpack.config.js | 4 +-
test/configCases/wasm/fetch/test.config.js | 2 +-
.../wasm/identical/webpack.config.js | 4 +-
.../configCases/wasm/universal/test.config.js | 2 +-
.../webpack.config.js | 4 +-
.../worker/issue-17489/test.config.js | 2 +-
.../configCases/worker/worklet/test.config.js | 8 +-
test/deterministicGrouping.unittest.js | 5 +-
test/helpers/EventSourceForNode.js | 6 +-
test/helpers/FakeDocument.js | 2 +-
test/helpers/LogTestPlugin.js | 4 +-
test/helpers/PluginEnvironment.js | 2 +-
test/helpers/asModule.js | 2 +-
test/helpers/createFakeWorker.js | 2 +-
test/helpers/createLazyTestEnv.js | 8 +-
test/helpers/expectWarningFactory.js | 8 +-
test/helpers/fakeSystem.js | 10 +-
test/helpers/findOutputFiles.js | 2 +-
test/helpers/prepareOptions.js | 4 +-
test/helpers/warmup-webpack.js | 6 +-
test/hotCases/css/imported-css/test.filter.js | 2 +-
.../css/single-css-entry/test.filter.js | 2 +-
.../css/single-css-entry/webpack.config.js | 2 +-
.../css/with-lazy-compilation/test.filter.js | 2 +-
.../module-test/webpack.config.js | 2 +-
.../css/webpack.config.js | 4 +-
.../test.filter.js | 2 +-
.../runtime/add-runtime/test.filter.js | 2 +-
.../worker/remove-add-worker/test.filter.js | 2 +-
test/runner/index.js | 22 +-
test/setupTestFramework.js | 10 +-
.../webpack.config.js | 2 +-
.../webpack.config.js | 2 +-
test/statsCases/cause-error/webpack.config.js | 4 +-
.../details-error/webpack.config.js | 6 +-
.../ignore-warnings/webpack.config.js | 2 +-
.../webpack.config.js | 2 +-
.../real-content-hash/test.config.js | 4 +-
.../related-assets/webpack.config.js | 6 +-
.../statsCases/split-chunks/webpack.config.js | 4 +-
test/walkCssTokens.unittest.js | 6 +-
.../cache/add-defines/test.filter.js | 2 +-
.../cache/add-defines/webpack.config.js | 2 +-
.../cache/asset-concat/test.filter.js | 2 +-
.../unsafe-cache-duplicates/webpack.config.js | 6 +-
.../esm-async-chunks-hmr/webpack.config.js | 2 +-
.../side-effects/issue-7400/test.filter.js | 2 +-
tooling/generate-runtime-code.js | 2 +-
tooling/generate-wasm-code.js | 2 +-
tooling/print-cache-file.js | 4 +-
497 files changed, 2679 insertions(+), 2595 deletions(-)
diff --git a/.prettierrc.js b/.prettierrc.js
index b8110f9cd..04b93b8c6 100644
--- a/.prettierrc.js
+++ b/.prettierrc.js
@@ -5,7 +5,7 @@ module.exports = {
useTabs: true,
tabWidth: 2,
trailingComma: "none",
- arrowParens: "avoid",
+ arrowParens: "always",
overrides: [
{
files: "*.json",
diff --git a/bin/webpack.js b/bin/webpack.js
index 26273bdbc..ba71ec29e 100755
--- a/bin/webpack.js
+++ b/bin/webpack.js
@@ -16,11 +16,11 @@ const runCommand = (command, args) => {
shell: true
});
- executedCommand.on("error", error => {
+ executedCommand.on("error", (error) => {
reject(error);
});
- executedCommand.on("exit", code => {
+ executedCommand.on("exit", (code) => {
if (code === 0) {
resolve();
} else {
@@ -34,7 +34,7 @@ const runCommand = (command, args) => {
* @param {string} packageName name of the package
* @returns {boolean} is the package installed?
*/
-const isInstalled = packageName => {
+const isInstalled = (packageName) => {
if (process.versions.pnp) {
return true;
}
@@ -76,7 +76,7 @@ const isInstalled = packageName => {
* @param {CliOption} cli options
* @returns {void}
*/
-const runCli = cli => {
+const runCli = (cli) => {
const path = require("path");
const pkgPath = require.resolve(`${cli.package}/package.json`);
@@ -85,7 +85,7 @@ const runCli = cli => {
if (pkg.type === "module" || /\.mjs/i.test(pkg.bin[cli.binName])) {
import(path.resolve(path.dirname(pkgPath), pkg.bin[cli.binName])).catch(
- err => {
+ (err) => {
console.error(err);
process.exitCode = 1;
}
@@ -152,7 +152,7 @@ if (!cli.installed) {
// executed. Setting the exit code here to ensure the script exits correctly in those cases. The callback
// function is responsible for clearing the exit code if the user wishes to install webpack-cli.
process.exitCode = 1;
- questionInterface.question(question, answer => {
+ questionInterface.question(question, (answer) => {
questionInterface.close();
const normalizedAnswer = answer.toLowerCase().startsWith("y");
@@ -183,7 +183,7 @@ if (!cli.installed) {
.then(() => {
runCli(cli);
})
- .catch(err => {
+ .catch((err) => {
console.error(err);
process.exitCode = 1;
});
diff --git a/eslint.config.mjs b/eslint.config.mjs
index fa24432ab..a2fe9268c 100644
--- a/eslint.config.mjs
+++ b/eslint.config.mjs
@@ -137,9 +137,6 @@ export default defineConfig([
"id-length": "off",
- "unicorn/no-array-for-each": "off",
- "unicorn/prefer-includes": "off",
-
"jsdoc/require-jsdoc": "off",
// Revisit it in future
@@ -205,7 +202,6 @@ export default defineConfig([
{
files: [
"test/configCases/{dll-plugin-entry,dll-plugin-side-effects,dll-plugin}/**/webpack.config.js",
- "examples/**/*.js",
"test/NodeTemplatePlugin.test.js",
"test/PersistentCaching.test.js"
],
diff --git a/lib/APIPlugin.js b/lib/APIPlugin.js
index b8978e337..7a3719198 100644
--- a/lib/APIPlugin.js
+++ b/lib/APIPlugin.js
@@ -169,7 +169,7 @@ class APIPlugin {
compilation.hooks.runtimeRequirementInTree
.for(RuntimeGlobals.chunkName)
- .tap(PLUGIN_NAME, chunk => {
+ .tap(PLUGIN_NAME, (chunk) => {
compilation.addRuntimeModule(
chunk,
new ChunkNameRuntimeModule(/** @type {string} */ (chunk.name))
@@ -213,10 +213,10 @@ class APIPlugin {
/**
* @param {JavascriptParser} parser the parser
*/
- const handler = parser => {
+ const handler = (parser) => {
for (const key of Object.keys(REPLACEMENTS)) {
const info = REPLACEMENTS[key];
- parser.hooks.expression.for(key).tap(PLUGIN_NAME, expression => {
+ parser.hooks.expression.for(key).tap(PLUGIN_NAME, (expression) => {
const dep = toConstantDependency(parser, info.expr, info.req);
if (key === "__non_webpack_require__" && this.options.module) {
@@ -227,7 +227,7 @@ class APIPlugin {
return dep(expression);
});
if (info.assign === false) {
- parser.hooks.assign.for(key).tap(PLUGIN_NAME, expr => {
+ parser.hooks.assign.for(key).tap(PLUGIN_NAME, (expr) => {
const err = new WebpackError(`${key} must not be assigned`);
err.loc = /** @type {DependencyLocation} */ (expr.loc);
throw err;
@@ -242,7 +242,7 @@ class APIPlugin {
parser.hooks.expression
.for("__webpack_layer__")
- .tap(PLUGIN_NAME, expr => {
+ .tap(PLUGIN_NAME, (expr) => {
const dep = new ConstDependency(
JSON.stringify(parser.state.module.layer),
/** @type {Range} */ (expr.range)
@@ -253,7 +253,7 @@ class APIPlugin {
});
parser.hooks.evaluateIdentifier
.for("__webpack_layer__")
- .tap(PLUGIN_NAME, expr =>
+ .tap(PLUGIN_NAME, (expr) =>
(parser.state.module.layer === null
? new BasicEvaluatedExpression().setNull()
: new BasicEvaluatedExpression().setString(
@@ -263,7 +263,7 @@ class APIPlugin {
);
parser.hooks.evaluateTypeof
.for("__webpack_layer__")
- .tap(PLUGIN_NAME, expr =>
+ .tap(PLUGIN_NAME, (expr) =>
new BasicEvaluatedExpression()
.setString(
parser.state.module.layer === null ? "object" : "string"
@@ -273,7 +273,7 @@ class APIPlugin {
parser.hooks.expression
.for("__webpack_module__.id")
- .tap(PLUGIN_NAME, expr => {
+ .tap(PLUGIN_NAME, (expr) => {
/** @type {BuildInfo} */
(parser.state.module.buildInfo).moduleConcatenationBailout =
"__webpack_module__.id";
@@ -289,7 +289,7 @@ class APIPlugin {
parser.hooks.expression
.for("__webpack_module__")
- .tap(PLUGIN_NAME, expr => {
+ .tap(PLUGIN_NAME, (expr) => {
/** @type {BuildInfo} */
(parser.state.module.buildInfo).moduleConcatenationBailout =
"__webpack_module__";
diff --git a/lib/AutomaticPrefetchPlugin.js b/lib/AutomaticPrefetchPlugin.js
index b0926614e..1295f8245 100644
--- a/lib/AutomaticPrefetchPlugin.js
+++ b/lib/AutomaticPrefetchPlugin.js
@@ -31,7 +31,7 @@ class AutomaticPrefetchPlugin {
);
/** @type {{context: string | null, request: string}[] | null} */
let lastModules = null;
- compiler.hooks.afterCompile.tap(PLUGIN_NAME, compilation => {
+ compiler.hooks.afterCompile.tap(PLUGIN_NAME, (compilation) => {
lastModules = [];
for (const m of compilation.modules) {
@@ -54,7 +54,7 @@ class AutomaticPrefetchPlugin {
callback
);
},
- err => {
+ (err) => {
lastModules = null;
callback(err);
}
diff --git a/lib/BannerPlugin.js b/lib/BannerPlugin.js
index 22ec021f6..b45256e4f 100644
--- a/lib/BannerPlugin.js
+++ b/lib/BannerPlugin.js
@@ -32,7 +32,7 @@ const validate = createSchemaValidation(
* @param {string} str string to wrap
* @returns {string} wrapped string
*/
-const wrapComment = str => {
+const wrapComment = (str) => {
if (!str.includes("\n")) {
return Template.toComment(str);
}
@@ -67,7 +67,7 @@ class BannerPlugin {
/** @type {BannerFunction} */
this.banner = this.options.raw
? getBanner
- : /** @type {BannerFunction} */ data => wrapComment(getBanner(data));
+ : /** @type {BannerFunction} */ (data) => wrapComment(getBanner(data));
} else {
const banner = this.options.raw
? bannerOption
@@ -93,7 +93,7 @@ class BannerPlugin {
const stage =
this.options.stage || Compilation.PROCESS_ASSETS_STAGE_ADDITIONS;
- compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
+ compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
compilation.hooks.processAssets.tap({ name: PLUGIN_NAME, stage }, () => {
for (const chunk of compilation.chunks) {
if (options.entryOnly && !chunk.canBeInitial()) {
@@ -114,7 +114,7 @@ class BannerPlugin {
data
);
- compilation.updateAsset(file, old => {
+ compilation.updateAsset(file, (old) => {
const cached = cache.get(old);
if (!cached || cached.comment !== comment) {
const source = options.footer
diff --git a/lib/Cache.js b/lib/Cache.js
index 757119c9d..f807055e9 100644
--- a/lib/Cache.js
+++ b/lib/Cache.js
@@ -40,7 +40,7 @@ const {
* @param {(err?: Error) => void} callback callback
* @returns {(err?: Error) => void} callback
*/
-const needCalls = (times, callback) => err => {
+const needCalls = (times, callback) => (err) => {
if (--times === 0) {
return callback(err);
}
diff --git a/lib/CacheFacade.js b/lib/CacheFacade.js
index 190de11dc..8887d3d95 100644
--- a/lib/CacheFacade.js
+++ b/lib/CacheFacade.js
@@ -61,8 +61,8 @@ class MultiItemCache {
* @param {number} i index
* @returns {Promise} promise with the data
*/
- const next = i =>
- this._items[i].getPromise().then(result => {
+ const next = (i) =>
+ this._items[i].getPromise().then((result) => {
if (result !== undefined) return result;
if (++i < this._items.length) return next(i);
});
@@ -89,7 +89,7 @@ class MultiItemCache {
* @returns {Promise} promise signals when the value is stored
*/
storePromise(data) {
- return Promise.all(this._items.map(item => item.storePromise(data))).then(
+ return Promise.all(this._items.map((item) => item.storePromise(data))).then(
() => {}
);
}
@@ -149,7 +149,7 @@ class ItemCacheFacade {
*/
storePromise(data) {
return new Promise((resolve, reject) => {
- this._cache.store(this._name, this._etag, data, err => {
+ this._cache.store(this._name, this._etag, data, (err) => {
if (err) {
reject(err);
} else {
@@ -171,7 +171,7 @@ class ItemCacheFacade {
if (cacheEntry !== undefined) return cacheEntry;
computer((err, result) => {
if (err) return callback(err);
- this.store(result, err => {
+ this.store(result, (err) => {
if (err) return callback(err);
callback(null, result);
});
@@ -297,7 +297,7 @@ class CacheFacade {
*/
storePromise(identifier, etag, data) {
return new Promise((resolve, reject) => {
- this._cache.store(`${this._name}|${identifier}`, etag, data, err => {
+ this._cache.store(`${this._name}|${identifier}`, etag, data, (err) => {
if (err) {
reject(err);
} else {
@@ -321,7 +321,7 @@ class CacheFacade {
if (cacheEntry !== undefined) return cacheEntry;
computer((err, result) => {
if (err) return callback(err);
- this.store(identifier, etag, result, err => {
+ this.store(identifier, etag, result, (err) => {
if (err) return callback(err);
callback(null, result);
});
diff --git a/lib/CaseSensitiveModulesWarning.js b/lib/CaseSensitiveModulesWarning.js
index 2680753fa..0ee17aa56 100644
--- a/lib/CaseSensitiveModulesWarning.js
+++ b/lib/CaseSensitiveModulesWarning.js
@@ -14,7 +14,7 @@ const WebpackError = require("./WebpackError");
* @param {Module[]} modules the modules to be sorted
* @returns {Module[]} sorted version of original modules
*/
-const sortModules = modules =>
+const sortModules = (modules) =>
modules.sort((a, b) => {
const aIdent = a.identifier();
const bIdent = b.identifier();
@@ -33,7 +33,7 @@ const sortModules = modules =>
*/
const createModulesListMessage = (modules, moduleGraph) =>
modules
- .map(m => {
+ .map((m) => {
let message = `* ${m.identifier()}`;
const validReasons = [
...moduleGraph.getIncomingConnectionsByOriginModule(m).keys()
diff --git a/lib/Chunk.js b/lib/Chunk.js
index b19d06b6b..21fdaba9b 100644
--- a/lib/Chunk.js
+++ b/lib/Chunk.js
@@ -583,7 +583,7 @@ class Chunk {
const chunks = new Set();
const initialChunks = intersect(
- Array.from(this.groupsIterable, g => new Set(g.chunks))
+ Array.from(this.groupsIterable, (g) => new Set(g.chunks))
);
const initialQueue = new Set(this.groupsIterable);
@@ -672,7 +672,7 @@ class Chunk {
const queue = new Set();
const initialChunks = intersect(
- Array.from(this.groupsIterable, g => new Set(g.chunks))
+ Array.from(this.groupsIterable, (g) => new Set(g.chunks))
);
for (const chunkGroup of this.groupsIterable) {
@@ -812,7 +812,7 @@ class Chunk {
* @param {Chunk} chunk a chunk
* @returns {void}
*/
- const addChildIdsByOrdersToMap = chunk => {
+ const addChildIdsByOrdersToMap = (chunk) => {
const data = chunk.getChildIdsByOrders(chunkGraph, filterFn);
for (const key of Object.keys(data)) {
let chunkMap = chunkMaps[key];
diff --git a/lib/ChunkGraph.js b/lib/ChunkGraph.js
index 0998125b2..f30cfb13d 100644
--- a/lib/ChunkGraph.js
+++ b/lib/ChunkGraph.js
@@ -76,13 +76,13 @@ class ModuleHashInfo {
* @param {SortableSet} set the set
* @returns {T[]} set as array
*/
-const getArray = set => [...set];
+const getArray = (set) => [...set];
/**
* @param {SortableSet} chunks the chunks
* @returns {RuntimeSpecSet} runtimes
*/
-const getModuleRuntimes = chunks => {
+const getModuleRuntimes = (chunks) => {
const runtimes = new RuntimeSpecSet();
for (const chunk of chunks) {
runtimes.add(chunk.runtime);
@@ -94,7 +94,7 @@ const getModuleRuntimes = chunks => {
* @param {WeakMap> | undefined} sourceTypesByModule sourceTypesByModule
* @returns {(set: SortableSet) => Map>} modules by source type
*/
-const modulesBySourceType = sourceTypesByModule => set => {
+const modulesBySourceType = (sourceTypesByModule) => (set) => {
/** @type {Map>} */
const map = new Map();
for (const module of set) {
@@ -136,10 +136,10 @@ const createOrderedArrayFunctionMap = new WeakMap();
* @param {ModuleComparator} comparator comparator function
* @returns {ModuleSetToArrayFunction} set as ordered array
*/
-const createOrderedArrayFunction = comparator => {
+const createOrderedArrayFunction = (comparator) => {
let fn = createOrderedArrayFunctionMap.get(comparator);
if (fn !== undefined) return fn;
- fn = set => {
+ fn = (set) => {
set.sortWith(comparator);
return [...set];
};
@@ -151,7 +151,7 @@ const createOrderedArrayFunction = comparator => {
* @param {Iterable} modules the modules to get the count/size of
* @returns {number} the size of the modules
*/
-const getModulesSize = modules => {
+const getModulesSize = (modules) => {
let size = 0;
for (const module of modules) {
for (const type of module.getSourceTypes()) {
@@ -165,7 +165,7 @@ const getModulesSize = modules => {
* @param {Iterable} modules the sortable Set to get the size of
* @returns {Record} the sizes of the modules
*/
-const getModulesSizes = modules => {
+const getModulesSizes = (modules) => {
const sizes = Object.create(null);
for (const module of modules) {
for (const type of module.getSourceTypes()) {
@@ -311,13 +311,13 @@ class ChunkGraph {
_getGraphRoots(set) {
const { moduleGraph } = this;
return [
- ...findGraphRoots(set, module => {
+ ...findGraphRoots(set, (module) => {
/** @type {Set} */
const set = new Set();
/**
* @param {Module} module module
*/
- const addDependencies = module => {
+ const addDependencies = (module) => {
for (const connection of moduleGraph.getOutgoingConnections(module)) {
if (!connection.module) continue;
const activeState = connection.getActiveState(undefined);
@@ -1272,7 +1272,10 @@ class ChunkGraph {
const array = [...cgc.runtimeModules];
array.sort(
concatComparators(
- compareSelect(r => /** @type {RuntimeModule} */ (r).stage, compareIds),
+ compareSelect(
+ (r) => /** @type {RuntimeModule} */ (r).stage,
+ compareIds
+ ),
compareModulesByIdentifier
)
);
@@ -1401,7 +1404,7 @@ class ChunkGraph {
throw new Error(
`No unique hash info entry for unspecified runtime for ${module.identifier()} (existing runtimes: ${Array.from(
hashes.keys(),
- r => runtimeToString(r)
+ (r) => runtimeToString(r)
).join(", ")}).
Caller might not support runtime-dependent code generation (opt-out via optimization.usedExports: "global").`
);
@@ -1493,7 +1496,7 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza
cgm.runtimeRequirements = map;
return;
}
- runtimeRequirementsMap.update(runtime, runtimeRequirements => {
+ runtimeRequirementsMap.update(runtime, (runtimeRequirements) => {
if (runtimeRequirements === undefined) {
return transferOwnership ? items : new Set(items);
} else if (!transferOwnership || runtimeRequirements.size >= items.size) {
@@ -1623,7 +1626,7 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza
* @param {ConnectionState} state state
* @returns {"F" | "T" | "O"} result
*/
- const activeStateToString = state => {
+ const activeStateToString = (state) => {
if (state === false) return "F";
if (state === true) return "T";
if (state === ModuleGraphConnection.TRANSITIVE_ONLY) return "O";
@@ -1675,7 +1678,7 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza
let stateInfo = "";
forEachRuntime(
runtime,
- runtime => {
+ (runtime) => {
const state = connection.getActiveState(runtime);
states.add(state);
stateInfo += activeStateToString(state) + runtime;
@@ -1702,7 +1705,7 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza
/**
* @param {Module} module module
*/
- const addModuleToHash = module => {
+ const addModuleToHash = (module) => {
hash.update(
this._getModuleGraphHashBigInt(
this._getChunkGraphModule(module),
@@ -1714,7 +1717,7 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza
/**
* @param {Set} modules modules
*/
- const addModulesToHash = modules => {
+ const addModulesToHash = (modules) => {
let xor = ZERO_BIG_INT;
for (const m of modules) {
xor ^= this._getModuleGraphHashBigInt(
@@ -1769,7 +1772,7 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza
* @param {Module} module the module
* @returns {ChunkGraph} the chunk graph
*/
- module => {
+ (module) => {
const chunkGraph = chunkGraphForModuleMap.get(module);
if (!chunkGraph) {
throw new Error(
@@ -1821,7 +1824,7 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza
* @param {Chunk} chunk the chunk
* @returns {ChunkGraph} the chunk graph
*/
- chunk => {
+ (chunk) => {
const chunkGraph = chunkGraphForChunkMap.get(chunk);
if (!chunkGraph) {
throw new Error(
diff --git a/lib/ChunkGroup.js b/lib/ChunkGroup.js
index 5306625a6..36d7389d2 100644
--- a/lib/ChunkGroup.js
+++ b/lib/ChunkGroup.js
@@ -40,7 +40,7 @@ let debugId = 5000;
* @param {SortableSet} set set to convert to array.
* @returns {T[]} the array format of existing set
*/
-const getArray = set => [...set];
+const getArray = (set) => [...set];
/**
* A convenience method used to sort chunks based on their id's
@@ -165,7 +165,7 @@ class ChunkGroup {
* @returns {string} a unique concatenation of chunk debugId's
*/
get debugId() {
- return Array.from(this.chunks, x => x.debugId).join("+");
+ return Array.from(this.chunks, (x) => x.debugId).join("+");
}
/**
@@ -173,7 +173,7 @@ class ChunkGroup {
* @returns {string} a unique concatenation of chunk ids
*/
get id() {
- return Array.from(this.chunks, x => x.id).join("+");
+ return Array.from(this.chunks, (x) => x.id).join("+");
}
/**
@@ -533,7 +533,7 @@ class ChunkGroup {
if (cmp !== 0) return cmp;
return a.group.compareTo(chunkGraph, b.group);
});
- result[name] = list.map(i => i.group);
+ result[name] = list.map((i) => i.group);
}
return result;
}
diff --git a/lib/CleanPlugin.js b/lib/CleanPlugin.js
index cdc392010..219e23dca 100644
--- a/lib/CleanPlugin.js
+++ b/lib/CleanPlugin.js
@@ -72,7 +72,7 @@ function getDirectories(assets) {
/**
* @param {string} filename asset filename
*/
- const addDirectory = filename => {
+ const addDirectory = (filename) => {
directories.add(path.dirname(filename));
};
@@ -158,7 +158,7 @@ const getDiffToFs = (fs, outputPath, currentAssets, callback) => {
callback();
});
},
- err => {
+ (err) => {
if (err) return callback(err);
callback(null, diff);
@@ -210,7 +210,7 @@ const applyDiff = (fs, outputPath, dry, logger, diff, isKept, callback) => {
/**
* @param {string} msg message
*/
- const log = msg => {
+ const log = (msg) => {
if (dry) {
logger.info(msg);
} else {
@@ -219,7 +219,7 @@ const applyDiff = (fs, outputPath, dry, logger, diff, isKept, callback) => {
};
/** @typedef {{ type: "check" | "unlink" | "rmdir", filename: string, parent: { remaining: number, job: Job } | undefined }} Job */
/** @type {Job[]} */
- const jobs = Array.from(diff.keys(), filename => ({
+ const jobs = Array.from(diff.keys(), (filename) => ({
type: "check",
filename,
parent: undefined
@@ -235,15 +235,15 @@ const applyDiff = (fs, outputPath, dry, logger, diff, isKept, callback) => {
* @param {Error & { code?: string }} err error
* @returns {void}
*/
- const handleError = err => {
+ const handleError = (err) => {
const isAlreadyRemoved = () =>
- new Promise(resolve => {
+ new Promise((resolve) => {
if (err.code === "ENOENT") {
resolve(true);
} else if (err.code === "EPERM") {
// https://github.com/isaacs/rimraf/blob/main/src/fix-eperm.ts#L37
// fs.existsSync(path) === false https://github.com/webpack/webpack/actions/runs/15493412975/job/43624272783?pr=19586
- doStat(fs, path, err => {
+ doStat(fs, path, (err) => {
if (err) {
resolve(err.code === "ENOENT");
} else {
@@ -255,7 +255,7 @@ const applyDiff = (fs, outputPath, dry, logger, diff, isKept, callback) => {
}
});
- isAlreadyRemoved().then(isRemoved => {
+ isAlreadyRemoved().then((isRemoved) => {
if (isRemoved) {
log(`${filename} was removed during cleaning by something else`);
handleParent();
@@ -334,7 +334,7 @@ const applyDiff = (fs, outputPath, dry, logger, diff, isKept, callback) => {
);
return process.nextTick(callback);
}
- fs.rmdir(path, err => {
+ fs.rmdir(path, (err) => {
if (err) return handleError(err);
handleParent();
callback();
@@ -352,7 +352,7 @@ const applyDiff = (fs, outputPath, dry, logger, diff, isKept, callback) => {
);
return process.nextTick(callback);
}
- fs.unlink(path, err => {
+ fs.unlink(path, (err) => {
if (err) return handleError(err);
handleParent();
callback();
@@ -360,7 +360,7 @@ const applyDiff = (fs, outputPath, dry, logger, diff, isKept, callback) => {
break;
}
},
- err => {
+ (err) => {
if (err) return callback(err);
callback(undefined, keptAssets);
}
@@ -412,9 +412,9 @@ class CleanPlugin {
typeof keep === "function"
? keep
: typeof keep === "string"
- ? path => path.startsWith(keep)
+ ? (path) => path.startsWith(keep)
: typeof keep === "object" && keep.test
- ? path => keep.test(path)
+ ? (path) => keep.test(path)
: () => false;
// We assume that no external modification happens while the compiler is active
@@ -470,7 +470,7 @@ class CleanPlugin {
* @param {string} path path
* @returns {boolean | void} true, if needs to be kept
*/
- const isKept = path => {
+ const isKept = (path) => {
const result = hooks.keep.call(path);
if (result !== undefined) return result;
return keepFn(path);
diff --git a/lib/CodeGenerationResults.js b/lib/CodeGenerationResults.js
index 3ba4e8028..fe2097ea5 100644
--- a/lib/CodeGenerationResults.js
+++ b/lib/CodeGenerationResults.js
@@ -39,7 +39,7 @@ class CodeGenerationResults {
throw new Error(
`No code generation entry for ${module.identifier()} (existing entries: ${Array.from(
this.map.keys(),
- m => m.identifier()
+ (m) => m.identifier()
).join(", ")})`
);
}
@@ -50,7 +50,7 @@ class CodeGenerationResults {
throw new Error(
`No unique code generation entry for unspecified runtime for ${module.identifier()} (existing runtimes: ${Array.from(
entry.keys(),
- r => runtimeToString(r)
+ (r) => runtimeToString(r)
).join(", ")}).
Caller might not support runtime-dependent code generation (opt-out via optimization.usedExports: "global").`
);
@@ -66,7 +66,7 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza
runtime
)} for ${module.identifier()} (existing runtimes: ${Array.from(
entry.keys(),
- r => runtimeToString(r)
+ (r) => runtimeToString(r)
).join(", ")})`
);
}
diff --git a/lib/CompatibilityPlugin.js b/lib/CompatibilityPlugin.js
index 759d6a8c5..d5ce18725 100644
--- a/lib/CompatibilityPlugin.js
+++ b/lib/CompatibilityPlugin.js
@@ -54,7 +54,7 @@ class CompatibilityPlugin {
* @param {CallExpression} expr call expression
* @returns {boolean | void} true when need to handle
*/
- expr => {
+ (expr) => {
// support for browserify style require delegator: "require(o, !0)"
if (expr.arguments.length !== 2) return;
const second = parser.evaluateExpression(expr.arguments[1]);
@@ -90,9 +90,9 @@ class CompatibilityPlugin {
* @param {JavascriptParser} parser the parser
* @returns {void}
*/
- const handler = parser => {
+ const handler = (parser) => {
// Handle nested requires
- parser.hooks.preStatement.tap(PLUGIN_NAME, statement => {
+ parser.hooks.preStatement.tap(PLUGIN_NAME, (statement) => {
if (
statement.type === "FunctionDeclaration" &&
statement.id &&
@@ -118,7 +118,7 @@ class CompatibilityPlugin {
});
parser.hooks.pattern
.for(RuntimeGlobals.require)
- .tap(PLUGIN_NAME, pattern => {
+ .tap(PLUGIN_NAME, (pattern) => {
const newName = `__nested_webpack_require_${
/** @type {Range} */ (pattern.range)[0]
}__`;
@@ -134,7 +134,7 @@ class CompatibilityPlugin {
});
parser.hooks.pattern
.for(RuntimeGlobals.exports)
- .tap(PLUGIN_NAME, pattern => {
+ .tap(PLUGIN_NAME, (pattern) => {
parser.tagVariable(pattern.name, nestedWebpackIdentifierTag, {
name: "__nested_webpack_exports__",
declaration: {
@@ -147,7 +147,7 @@ class CompatibilityPlugin {
});
parser.hooks.expression
.for(nestedWebpackIdentifierTag)
- .tap(PLUGIN_NAME, expr => {
+ .tap(PLUGIN_NAME, (expr) => {
const { name, declaration } =
/** @type {TagData} */
(parser.currentTagData);
diff --git a/lib/Compilation.js b/lib/Compilation.js
index b5f7558ac..b1c739780 100644
--- a/lib/Compilation.js
+++ b/lib/Compilation.js
@@ -403,7 +403,7 @@ const deprecatedNormalModuleLoaderHook = util.deprecate(
* @param {Compilation} compilation compilation
* @returns {NormalModuleCompilationHooks["loader"]} hooks
*/
- compilation =>
+ (compilation) =>
require("./NormalModule").getCompilationHooks(compilation).loader,
"Compilation.hooks.normalModuleLoader was moved to NormalModule.getCompilationHooks(compilation).loader",
"DEP_WEBPACK_COMPILATION_NORMAL_MODULE_LOADER_HOOK"
@@ -413,7 +413,7 @@ const deprecatedNormalModuleLoaderHook = util.deprecate(
/**
* @param {ModuleTemplates | undefined} moduleTemplates module templates
*/
-const defineRemovedModuleTemplates = moduleTemplates => {
+const defineRemovedModuleTemplates = (moduleTemplates) => {
Object.defineProperties(moduleTemplates, {
asset: {
enumerable: false,
@@ -437,21 +437,24 @@ const defineRemovedModuleTemplates = moduleTemplates => {
moduleTemplates = undefined;
};
-const byId = compareSelect(c => c.id, compareIds);
+const byId = compareSelect((c) => c.id, compareIds);
const byNameOrHash = concatComparators(
- compareSelect(c => c.name, compareIds),
- compareSelect(c => c.fullHash, compareIds)
+ compareSelect((c) => c.name, compareIds),
+ compareSelect((c) => c.fullHash, compareIds)
);
-const byMessage = compareSelect(err => `${err.message}`, compareStringsNumeric);
-
-const byModule = compareSelect(
- err => (err.module && err.module.identifier()) || "",
+const byMessage = compareSelect(
+ (err) => `${err.message}`,
compareStringsNumeric
);
-const byLocation = compareSelect(err => err.loc, compareLocations);
+const byModule = compareSelect(
+ (err) => (err.module && err.module.identifier()) || "",
+ compareStringsNumeric
+);
+
+const byLocation = compareSelect((err) => err.loc, compareLocations);
const compareErrors = concatComparators(byModule, byLocation, byMessage);
@@ -497,7 +500,7 @@ class Compilation {
* @param {CompilationAssets} assets assets
* @returns {CompilationAssets} new assets
*/
- const popNewAssets = assets => {
+ const popNewAssets = (assets) => {
let newAssets;
for (const file of Object.keys(assets)) {
if (savedAssets.has(file)) continue;
@@ -514,7 +517,7 @@ class Compilation {
call: () => {
savedAssets = new Set(Object.keys(this.assets));
},
- register: tap => {
+ register: (tap) => {
const { type, name } = tap;
const { fn, additionalAssets, ...remainingTap } = tap;
const additionalAssetsFn =
@@ -526,7 +529,7 @@ class Compilation {
switch (type) {
case "sync":
if (additionalAssetsFn) {
- this.hooks.processAdditionalAssets.tap(name, assets => {
+ this.hooks.processAdditionalAssets.tap(name, (assets) => {
if (
/** @type {ProcessedAssets} */
(processedAssets).has(this.assets)
@@ -592,7 +595,7 @@ class Compilation {
* @param {Error} err err
* @returns {void}
*/
- err => {
+ (err) => {
if (err) return callback(err);
if (processedAssets !== undefined) {
processedAssets.add(this.assets);
@@ -612,7 +615,7 @@ class Compilation {
};
case "promise":
if (additionalAssetsFn) {
- this.hooks.processAdditionalAssets.tapPromise(name, assets => {
+ this.hooks.processAdditionalAssets.tapPromise(name, (assets) => {
if (
/** @type {ProcessedAssets} */
(processedAssets).has(this.assets)
@@ -628,7 +631,7 @@ class Compilation {
* @param {CompilationAssets} assets assets
* @returns {Promise} result
*/
- fn: assets => {
+ fn: (assets) => {
const p = fn(assets);
if (!p || !p.then) return p;
return p.then(() => {
@@ -665,14 +668,15 @@ class Compilation {
* @param {string} reason reason
* @returns {string} error message
*/
- const errorMessage =
- reason => `Can't automatically convert plugin using Compilation.hooks.${name} to Compilation.hooks.processAssets because ${reason}.
+ const errorMessage = (
+ reason
+ ) => `Can't automatically convert plugin using Compilation.hooks.${name} to Compilation.hooks.processAssets because ${reason}.
BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a single Compilation.hooks.processAssets hook.`;
/**
* @param {string | (import("tapable").TapOptions & { name: string; } & ProcessAssetsAdditionalOptions)} options hook options
* @returns {import("tapable").TapOptions & { name: string; } & ProcessAssetsAdditionalOptions} modified options
*/
- const getOptions = options => {
+ const getOptions = (options) => {
if (typeof options === "string") options = { name: options };
if (options.stage) {
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
this.addModuleQueue = new AsyncQueue({
name: "addModule",
parent: this.processDependenciesQueue,
- getKey: module => module.identifier(),
+ getKey: (module) => module.identifier(),
processor: this._addModule.bind(this)
});
/** @type {AsyncQueue} */
@@ -1199,7 +1203,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
* @param {string} item item
* @returns {LazySet} file dependencies
*/
- item => this.fileDependencies.add(item),
+ (item) => this.fileDependencies.add(item),
"Compilation.compilationDependencies is deprecated (used Compilation.fileDependencies instead)",
"DEP_WEBPACK_COMPILATION_COMPILATION_DEPENDENCIES"
)
@@ -1351,7 +1355,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
/* eslint-enable no-console */
}
},
- childName => {
+ (childName) => {
if (typeof name === "function") {
if (typeof childName === "function") {
return this.getLogger(() => {
@@ -1527,7 +1531,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
this.resolverFactory.get("normal", module.resolveOptions),
/** @type {InputFileSystem} */
(this.inputFileSystem),
- err => {
+ (err) => {
if (currentProfile !== undefined) {
currentProfile.markBuildingEnd();
}
@@ -1538,20 +1542,25 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
if (currentProfile !== undefined) {
currentProfile.markStoringStart();
}
- this._modulesCache.store(module.identifier(), null, module, err => {
- if (currentProfile !== undefined) {
- currentProfile.markStoringEnd();
+ this._modulesCache.store(
+ module.identifier(),
+ null,
+ module,
+ (err) => {
+ if (currentProfile !== undefined) {
+ currentProfile.markStoringEnd();
+ }
+ if (err) {
+ this.hooks.failedModule.call(
+ module,
+ /** @type {WebpackError} */ (err)
+ );
+ return callback(new ModuleStoreError(module, err));
+ }
+ this.hooks.succeedModule.call(module);
+ return callback();
}
- if (err) {
- this.hooks.failedModule.call(
- module,
- /** @type {WebpackError} */ (err)
- );
- return callback(new ModuleStoreError(module, err));
- }
- this.hooks.succeedModule.call(module);
- return callback();
- });
+ );
}
);
}
@@ -1575,7 +1584,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
/**
* @param {DependenciesBlock} block block
*/
- const processDependenciesBlock = block => {
+ const processDependenciesBlock = (block) => {
if (block.dependencies) {
let i = 0;
for (const dep of block.dependencies) {
@@ -1625,7 +1634,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
* @param {WebpackError=} err error
* @returns {void}
*/
- const onDependenciesSorted = err => {
+ const onDependenciesSorted = (err) => {
if (err) return callback(err);
// 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
for (const item of sortedDependencies) {
inProgressTransitive++;
// eslint-disable-next-line no-loop-func
- this.handleModuleCreation(item, err => {
+ this.handleModuleCreation(item, (err) => {
// In V8, the Error objects keep a reference to the functions on the stack. These warnings &
// errors are created inside closures that keep a reference to the Compilation, so errors are
// leaking the Compilation object.
@@ -1661,7 +1670,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
* @param {WebpackError=} err error
* @returns {void}
*/
- const onTransitiveTasksFinished = err => {
+ const onTransitiveTasksFinished = (err) => {
if (err) return callback(err);
this.processDependenciesQueue.decreaseParallelism();
@@ -1738,7 +1747,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
module,
dep,
cachedModule,
- err => {
+ (err) => {
if (err) {
if (inProgressTransitive <= 0) return;
inProgressTransitive = -1;
@@ -1783,7 +1792,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
* @param {Dependency} dep dependency
* @returns {void}
*/
- const processDependencyForResolving = dep => {
+ const processDependencyForResolving = (dep) => {
const resourceIdent = dep.getResourceIdentifier();
if (resourceIdent !== undefined && resourceIdent !== null) {
const category = dep.category;
@@ -1982,7 +1991,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
};
if (err) {
if (factoryResult) applyFactoryResultDependencies();
- if (dependencies.every(d => d.optional)) {
+ if (dependencies.every((d) => d.optional)) {
this.warnings.push(err);
return callback();
}
@@ -2136,7 +2145,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
}
}
- this.buildModule(module, err => {
+ this.buildModule(module, (err) => {
if (creatingModuleDuringBuildSet !== undefined) {
creatingModuleDuringBuildSet.delete(module);
}
@@ -2160,7 +2169,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
return callback(null, module);
}
- this.processModuleDependencies(module, err => {
+ this.processModuleDependencies(module, (err) => {
if (err) {
return callback(err);
}
@@ -2238,7 +2247,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
originModule,
err,
/** @type {DependencyLocation} */
- (dependencies.map(d => d.loc).find(Boolean))
+ (dependencies.map((d) => d.loc).find(Boolean))
);
return callback(notFoundError, factoryResult ? result : undefined);
}
@@ -2453,9 +2462,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
const oldBlocks = [...module.blocks];
module.invalidateBuild();
this.buildQueue.invalidate(module);
- this.buildModule(module, err => {
+ this.buildModule(module, (err) => {
if (err) {
- return this.hooks.finishRebuildingModule.callAsync(module, err2 => {
+ return this.hooks.finishRebuildingModule.callAsync(module, (err2) => {
if (err2) {
callback(
makeWebpackError(err2, "Compilation.hooks.finishRebuildingModule")
@@ -2468,13 +2477,13 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
this.processDependenciesQueue.invalidate(module);
this.moduleGraph.unfreeze();
- this.processModuleDependencies(module, err => {
+ this.processModuleDependencies(module, (err) => {
if (err) return callback(err);
this.removeReasonsOfDependencyBlock(module, {
dependencies: oldDependencies,
blocks: oldBlocks
});
- this.hooks.finishRebuildingModule.callAsync(module, err2 => {
+ this.hooks.finishRebuildingModule.callAsync(module, (err2) => {
if (err2) {
callback(
makeWebpackError(err2, "Compilation.hooks.finishRebuildingModule")
@@ -2511,7 +2520,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
* @param {Module} module module
* @returns {WeakReferences | undefined} references
*/
- const computeReferences = module => {
+ const computeReferences = (module) => {
/** @type {WeakReferences | undefined} */
let references;
for (const connection of moduleGraph.getOutgoingConnections(module)) {
@@ -2604,7 +2613,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
* @param {readonly ModuleGraphConnection[]} connections connections
* @returns {symbol|boolean} result
*/
- const reduceAffectType = connections => {
+ const reduceAffectType = (connections) => {
let affected = false;
for (const { dependency } of connections) {
if (!dependency) continue;
@@ -2684,7 +2693,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
* @param {Module} module module
* @returns {References} references
*/
- const computeReferences = module => {
+ const computeReferences = (module) => {
const id = /** @type {ModuleId} */ (chunkGraph.getModuleId(module));
/** @type {Map | undefined} */
let modules;
@@ -2804,27 +2813,27 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
p.range(
profile.buildingStartTime,
profile.buildingEndTime,
- f => (profile.buildingParallelismFactor = f)
+ (f) => (profile.buildingParallelismFactor = f)
);
p.range(
profile.factoryStartTime,
profile.factoryEndTime,
- f => (profile.factoryParallelismFactor = f)
+ (f) => (profile.factoryParallelismFactor = f)
);
p.range(
profile.integrationStartTime,
profile.integrationEndTime,
- f => (profile.integrationParallelismFactor = f)
+ (f) => (profile.integrationParallelismFactor = f)
);
p.range(
profile.storingStartTime,
profile.storingEndTime,
- f => (profile.storingParallelismFactor = f)
+ (f) => (profile.storingParallelismFactor = f)
);
p.range(
profile.restoringStartTime,
profile.restoringEndTime,
- f => (profile.restoringParallelismFactor = f)
+ (f) => (profile.restoringParallelismFactor = f)
);
if (profile.additionalFactoryTimes) {
for (const { start, end } of profile.additionalFactoryTimes) {
@@ -2832,7 +2841,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
p.range(
start,
end,
- f =>
+ (f) =>
(profile.additionalFactoriesParallelismFactor += f * influence)
);
}
@@ -2955,33 +2964,33 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
};
logNormalSummary(
"resolve to new modules",
- p => p.factory,
- p => p.factoryParallelismFactor
+ (p) => p.factory,
+ (p) => p.factoryParallelismFactor
);
logNormalSummary(
"resolve to existing modules",
- p => p.additionalFactories,
- p => p.additionalFactoriesParallelismFactor
+ (p) => p.additionalFactories,
+ (p) => p.additionalFactoriesParallelismFactor
);
logNormalSummary(
"integrate modules",
- p => p.restoring,
- p => p.restoringParallelismFactor
+ (p) => p.restoring,
+ (p) => p.restoringParallelismFactor
);
logByLoadersSummary(
"build modules",
- p => p.building,
- p => p.buildingParallelismFactor
+ (p) => p.building,
+ (p) => p.buildingParallelismFactor
);
logNormalSummary(
"store modules",
- p => p.storing,
- p => p.storingParallelismFactor
+ (p) => p.storing,
+ (p) => p.storingParallelismFactor
);
logNormalSummary(
"restore modules",
- p => p.restoring,
- p => p.restoringParallelismFactor
+ (p) => p.restoring,
+ (p) => p.restoringParallelismFactor
);
this.logger.timeEnd("finish module profiles");
}
@@ -2990,7 +2999,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
this.logger.timeEnd("compute affected modules");
this.logger.time("finish modules");
const { modules, moduleMemCaches } = this;
- this.hooks.finishModules.callAsync(modules, err => {
+ this.hooks.finishModules.callAsync(modules, (err) => {
this.logger.timeEnd("finish modules");
if (err) return callback(/** @type {WebpackError} */ (err));
@@ -3061,7 +3070,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
* @param {WebpackError=} err err
* @returns {void}
*/
- const finalCallback = err => {
+ const finalCallback = (err) => {
this.factorizeQueue.clear();
this.buildQueue.clear();
this.rebuildQueue.clear();
@@ -3139,11 +3148,11 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
* @param {Dependency[]} deps deps
* @returns {Module[]} sorted deps
*/
- const mapAndSort = deps =>
+ const mapAndSort = (deps) =>
/** @type {Module[]} */
- (deps.map(dep => this.moduleGraph.getModule(dep)).filter(Boolean)).sort(
- compareModulesByIdentifier
- );
+ (
+ deps.map((dep) => this.moduleGraph.getModule(dep)).filter(Boolean)
+ ).sort(compareModulesByIdentifier);
const includedModules = [
...mapAndSort(this.globalEntry.includeDependencies),
...mapAndSort(includeDependencies)
@@ -3250,7 +3259,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
}
this.hooks.afterOptimizeChunks.call(this.chunks, this.chunkGroups);
- this.hooks.optimizeTree.callAsync(this.chunks, this.modules, err => {
+ this.hooks.optimizeTree.callAsync(this.chunks, this.modules, (err) => {
if (err) {
return finalCallback(
makeWebpackError(err, "Compilation.hooks.optimizeTree")
@@ -3262,7 +3271,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
this.hooks.optimizeChunkModules.callAsync(
this.chunks,
this.modules,
- err => {
+ (err) => {
if (err) {
return finalCallback(
makeWebpackError(err, "Compilation.hooks.optimizeChunkModules")
@@ -3325,7 +3334,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
this.logger.time("code generation");
this.hooks.beforeCodeGeneration.call();
- this.codeGeneration(err => {
+ this.codeGeneration((err) => {
if (err) {
return finalCallback(err);
}
@@ -3344,7 +3353,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
this.hooks.afterHash.call();
this.logger.timeEnd("hashing");
- this._runCodeGenerationJobs(codeGenerationJobs, err => {
+ this._runCodeGenerationJobs(codeGenerationJobs, (err) => {
if (err) {
return finalCallback(err);
}
@@ -3367,7 +3376,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
const cont = () => {
this.logger.time("process assets");
- this.hooks.processAssets.callAsync(this.assets, err => {
+ this.hooks.processAssets.callAsync(this.assets, (err) => {
if (err) {
return finalCallback(
makeWebpackError(err, "Compilation.hooks.processAssets")
@@ -3403,7 +3412,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
this.unseal();
return this.seal(callback);
}
- return this.hooks.afterSeal.callAsync(err => {
+ return this.hooks.afterSeal.callAsync((err) => {
if (err) {
return finalCallback(
makeWebpackError(err, "Compilation.hooks.afterSeal")
@@ -3418,7 +3427,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
this.logger.time("create chunk assets");
if (this.hooks.shouldGenerateChunkAssets.call() !== false) {
this.hooks.beforeChunkAssets.call();
- this.createChunkAssets(err => {
+ this.createChunkAssets((err) => {
this.logger.timeEnd("create chunk assets");
if (err) {
return finalCallback(err);
@@ -3542,7 +3551,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
if (
codeGenerationDependencies !== undefined &&
(notCodeGeneratedModules === undefined ||
- codeGenerationDependencies.some(dep => {
+ codeGenerationDependencies.some((dep) => {
const referencedModule = /** @type {Module} */ (
moduleGraph.getModule(dep)
);
@@ -3574,7 +3583,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
}
);
},
- err => {
+ (err) => {
if (err) return callback(err);
if (delayedJobs.length > 0) {
if (delayedJobs.length === jobs.length) {
@@ -3583,7 +3592,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
new Error(
`Unable to make progress during code generation because of circular code generation dependency: ${Array.from(
delayedModules,
- m => m.identifier()
+ (m) => m.identifier()
).join(", ")}`
)
)
@@ -3597,7 +3606,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
}
if (errors.length > 0) {
errors.sort(
- compareSelect(err => err.module, compareModulesByIdentifier)
+ compareSelect((err) => err.module, compareModulesByIdentifier)
);
for (const error of errors) {
this.errors.push(error);
@@ -3644,7 +3653,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
) {
let codeGenerated = false;
const cache = new MultiItemCache(
- runtimes.map(runtime =>
+ runtimes.map((runtime) =>
this._codeGenerationCache.getItemCache(
`${module.identifier()}|${getRuntimeKey(runtime)}`,
`${hash}|${dependencyTemplates.getHash()}`
@@ -3683,7 +3692,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
results.add(module, runtime, result);
}
if (!cachedResult) {
- cache.store(result, err =>
+ cache.store(result, (err) =>
callback(/** @type {WebpackError} */ (err), codeGenerated)
);
} else {
@@ -4031,7 +4040,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
* @param {Module} module module for processing
* @returns {void}
*/
- const processModule = module => {
+ const processModule = (module) => {
if (!moduleGraph.setDepthIfLower(module, depth)) return;
queue.add(module);
};
@@ -4157,7 +4166,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
/**
* @param {Dependency} d dependency to (maybe) patch up
*/
- const iteratorDependency = d => {
+ const iteratorDependency = (d) => {
const depModule = this.moduleGraph.getModule(d);
if (!depModule) {
return;
@@ -4190,7 +4199,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
/**
* @param {Entrypoint} ep an entrypoint
*/
- const processEntrypoint = ep => {
+ const processEntrypoint = (ep) => {
const runtime = /** @type {string} */ (ep.options.runtime || ep.name);
const chunk = /** @type {Chunk} */ (ep.getRuntimeChunk());
chunkGraph.setRuntimeId(runtime, /** @type {ChunkId} */ (chunk.id));
@@ -4273,7 +4282,9 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
}
}
if (errors.length > 0) {
- errors.sort(compareSelect(err => err.module, compareModulesByIdentifier));
+ errors.sort(
+ compareSelect((err) => err.module, compareModulesByIdentifier)
+ );
for (const error of errors) {
this.errors.push(error);
}
@@ -4410,7 +4421,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
for (const info of runtimeChunksMap.values()) {
for (const other of new Set(
[...info.chunk.getAllReferencedAsyncEntrypoints()].map(
- e => e.chunks[e.chunks.length - 1]
+ (e) => e.chunks[e.chunks.length - 1]
)
)) {
const otherInfo =
@@ -4463,11 +4474,11 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
circularRuntimeChunkInfo.push(info);
}
}
- circularRuntimeChunkInfo.sort(compareSelect(i => i.chunk, byId));
+ circularRuntimeChunkInfo.sort(compareSelect((i) => i.chunk, byId));
const err =
new WebpackError(`Circular dependency between chunks with runtime (${Array.from(
circularRuntimeChunkInfo,
- c => c.chunk.name || c.chunk.id
+ (c) => c.chunk.name || c.chunk.id
).join(", ")})
This prevents using hashes of each other and should be avoided.`);
err.chunk = circularRuntimeChunkInfo[0].chunk;
@@ -4487,7 +4498,7 @@ This prevents using hashes of each other and should be avoided.`);
/**
* @param {Chunk} chunk chunk
*/
- const processChunk = chunk => {
+ const processChunk = (chunk) => {
// Last minute module hash generation for modules that depend on chunk hashes
this.logger.time("hashing: hash runtime modules");
const runtime = chunk.runtime;
@@ -4564,7 +4575,9 @@ This prevents using hashes of each other and should be avoided.`);
for (const chunk of runtimeChunks) processChunk(chunk);
for (const chunk of initialChunks) processChunk(chunk);
if (errors.length > 0) {
- errors.sort(compareSelect(err => err.module, compareModulesByIdentifier));
+ errors.sort(
+ compareSelect((err) => err.module, compareModulesByIdentifier)
+ );
for (const error of errors) {
this.errors.push(error);
}
@@ -4671,7 +4684,7 @@ This prevents using hashes of each other and should be avoided.`);
/**
* @param {string} name name
*/
- const remove = name => {
+ const remove = (name) => {
const relatedIn = this._assetsRelatedIn.get(name);
if (relatedIn === undefined) return;
const entry = relatedIn.get(key);
@@ -4696,7 +4709,7 @@ This prevents using hashes of each other and should be avoided.`);
/**
* @param {string} name name
*/
- const add = name => {
+ const add = (name) => {
let relatedIn = this._assetsRelatedIn.get(name);
if (relatedIn === undefined) {
this._assetsRelatedIn.set(name, (relatedIn = new Map()));
@@ -4783,7 +4796,7 @@ This prevents using hashes of each other and should be avoided.`);
const entry = related[key];
let newEntry;
if (Array.isArray(entry)) {
- newEntry = entry.map(x => (x === file ? newFile : x));
+ newEntry = entry.map((x) => (x === file ? newFile : x));
} else if (entry === file) {
newEntry = newFile;
} else {
@@ -4837,7 +4850,7 @@ This prevents using hashes of each other and should be avoided.`);
/**
* @param {string} file file
*/
- const checkUsedAndDelete = file => {
+ const checkUsedAndDelete = (file) => {
if (!this._assetsRelatedIn.has(file)) {
this.deleteAsset(file);
}
@@ -4987,7 +5000,7 @@ This prevents using hashes of each other and should be avoided.`);
* @param {Error} err error
* @returns {void}
*/
- const errorAndCallback = err => {
+ const errorAndCallback = (err) => {
const filename =
file ||
(typeof file === "string"
@@ -5068,7 +5081,7 @@ This prevents using hashes of each other and should be avoided.`);
chunk
});
if (source !== sourceFromCache) {
- assetCacheItem.store(source, err => {
+ assetCacheItem.store(source, (err) => {
if (err) return errorAndCallback(err);
inTry = false;
return callback();
@@ -5190,9 +5203,9 @@ This prevents using hashes of each other and should be avoided.`);
modules,
10,
(module, push, callback) => {
- this.buildQueue.waitFor(module, err => {
+ this.buildQueue.waitFor(module, (err) => {
if (err) return callback(err);
- this.processDependenciesQueue.waitFor(module, err => {
+ this.processDependenciesQueue.waitFor(module, (err) => {
if (err) return callback(err);
for (const { module: m } of this.moduleGraph.getOutgoingConnections(
module
@@ -5205,7 +5218,7 @@ This prevents using hashes of each other and should be avoided.`);
});
});
},
- err => {
+ (err) => {
if (err) return callback(/** @type {WebpackError} */ (err));
// 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.`);
const reportErrors = () => {
if (errors.length > 0) {
errors.sort(
- compareSelect(err => err.module, compareModulesByIdentifier)
+ compareSelect((err) => err.module, compareModulesByIdentifier)
);
for (const error of errors) {
this.errors.push(error);
@@ -5298,7 +5311,7 @@ This prevents using hashes of each other and should be avoided.`);
};
// Generate code for all aggregated modules
- asyncLib.eachLimit(modules, 10, codeGen, err => {
+ asyncLib.eachLimit(modules, 10, codeGen, (err) => {
if (err) return callback(err);
reportErrors();
@@ -5334,7 +5347,7 @@ This prevents using hashes of each other and should be avoided.`);
}
// Generate code for all runtime modules
- asyncLib.eachLimit(runtimeModules, 10, codeGen, err => {
+ asyncLib.eachLimit(runtimeModules, 10, codeGen, (err) => {
if (err) return callback(err);
reportErrors();
@@ -5410,7 +5423,7 @@ This prevents using hashes of each other and should be avoided.`);
callback
);
},
- err => {
+ (err) => {
if (err) return callback(err);
/** @type {ExecuteModuleExports | undefined} */
@@ -5422,7 +5435,7 @@ This prevents using hashes of each other and should be avoided.`);
} = this.outputOptions;
/** @type {WebpackRequire} */
- const __webpack_require__ = id => {
+ const __webpack_require__ = (id) => {
const cached = moduleCache[id];
if (cached !== undefined) {
if (cached.error) throw cached.error;
@@ -5656,7 +5669,7 @@ Object.defineProperty(compilationPrototype, "cache", {
/**
* @param {EXPECTED_ANY} _v value
*/
- _v => {},
+ (_v) => {},
"Compilation.cache was removed in favor of Compilation.getCache()",
"DEP_WEBPACK_COMPILATION_CACHE"
)
diff --git a/lib/Compiler.js b/lib/Compiler.js
index fb509a8dc..f87921e81 100644
--- a/lib/Compiler.js
+++ b/lib/Compiler.js
@@ -125,7 +125,7 @@ const webpack = require(".");
* @param {string[]} array an array
* @returns {boolean} true, if the array is sorted
*/
-const isSorted = array => {
+const isSorted = (array) => {
for (let i = 1; i < array.length; i++) {
if (array[i - 1] > array[i]) return false;
}
@@ -154,7 +154,7 @@ const sortObject = (obj, keys) => {
const includesHash = (filename, hashes) => {
if (!hashes) return false;
if (Array.isArray(hashes)) {
- return hashes.some(hash => filename.includes(hash));
+ return hashes.some((hash) => filename.includes(hash));
}
return filename.includes(hashes);
};
@@ -388,7 +388,7 @@ class Compiler {
this.infrastructureLogger(name, type, args);
}
},
- childName => {
+ (childName) => {
if (typeof name === "function") {
if (typeof childName === "function") {
return this.getInfrastructureLogger(() => {
@@ -540,7 +540,7 @@ class Compiler {
compilation.startTime = startTime;
compilation.endTime = Date.now();
const stats = new Stats(compilation);
- this.hooks.done.callAsync(stats, err => {
+ this.hooks.done.callAsync(stats, (err) => {
if (err) return finalCallback(err);
return finalCallback(null, stats);
});
@@ -550,7 +550,7 @@ class Compiler {
process.nextTick(() => {
logger = compilation.getLogger("webpack.Compiler");
logger.time("emitAssets");
- this.emitAssets(compilation, err => {
+ this.emitAssets(compilation, (err) => {
/** @type {Logger} */
(logger).timeEnd("emitAssets");
if (err) return finalCallback(err);
@@ -563,12 +563,12 @@ class Compiler {
/** @type {Logger} */
(logger).time("done hook");
const stats = new Stats(compilation);
- this.hooks.done.callAsync(stats, err => {
+ this.hooks.done.callAsync(stats, (err) => {
/** @type {Logger} */
(logger).timeEnd("done hook");
if (err) return finalCallback(err);
- this.hooks.additionalPass.callAsync(err => {
+ this.hooks.additionalPass.callAsync((err) => {
if (err) return finalCallback(err);
this.compile(onCompiled);
});
@@ -578,7 +578,7 @@ class Compiler {
/** @type {Logger} */
(logger).time("emitRecords");
- this.emitRecords(err => {
+ this.emitRecords((err) => {
/** @type {Logger} */
(logger).timeEnd("emitRecords");
if (err) return finalCallback(err);
@@ -588,13 +588,13 @@ class Compiler {
/** @type {Logger} */
(logger).time("done hook");
const stats = new Stats(compilation);
- this.hooks.done.callAsync(stats, err => {
+ this.hooks.done.callAsync(stats, (err) => {
/** @type {Logger} */
(logger).timeEnd("done hook");
if (err) return finalCallback(err);
this.cache.storeBuildDependencies(
compilation.buildDependencies,
- err => {
+ (err) => {
if (err) return finalCallback(err);
return finalCallback(null, stats);
}
@@ -606,13 +606,13 @@ class Compiler {
};
const run = () => {
- this.hooks.beforeRun.callAsync(this, err => {
+ this.hooks.beforeRun.callAsync(this, (err) => {
if (err) return finalCallback(err);
- this.hooks.run.callAsync(this, err => {
+ this.hooks.run.callAsync(this, (err) => {
if (err) return finalCallback(err);
- this.readRecords(err => {
+ this.readRecords((err) => {
if (err) return finalCallback(err);
this.compile(onCompiled);
@@ -622,7 +622,7 @@ class Compiler {
};
if (this.idle) {
- this.cache.endIdle(err => {
+ this.cache.endIdle((err) => {
if (err) return finalCallback(err);
this.idle = false;
@@ -706,7 +706,7 @@ class Compiler {
* @param {Error=} err error
* @returns {void}
*/
- const emitFiles = err => {
+ const emitFiles = (err) => {
if (err) return callback(err);
const assets = compilation.getAssets();
@@ -739,7 +739,7 @@ class Compiler {
* @param {Error=} err error
* @returns {void}
*/
- const writeOut = err => {
+ const writeOut = (err) => {
if (err) return callback(err);
const targetPath = join(
/** @type {OutputFileSystem} */
@@ -838,9 +838,9 @@ ${other}`);
* @param {Buffer} content content to be written
* @returns {void}
*/
- const doWrite = content => {
+ const doWrite = (content) => {
/** @type {OutputFileSystem} */
- (this.outputFileSystem).writeFile(targetPath, content, err => {
+ (this.outputFileSystem).writeFile(targetPath, content, (err) => {
if (err) return callback(err);
// information marker that the asset has been emitted
@@ -871,7 +871,7 @@ ${other}`);
/**
* @param {number} size size
*/
- const updateWithReplacementSource = size => {
+ const updateWithReplacementSource = (size) => {
updateFileWithReplacementSource(
file,
/** @type {CacheEntry} */ (cacheEntry),
@@ -915,7 +915,7 @@ ${other}`);
* @param {IStats} stats stats
* @returns {void}
*/
- const processExistingFile = stats => {
+ const processExistingFile = (stats) => {
// skip emitting if it's already there and an immutable file
if (immutable) {
updateWithReplacementSource(/** @type {number} */ (stats.size));
@@ -1015,7 +1015,7 @@ ${other}`);
writeOut();
}
},
- err => {
+ (err) => {
// Clear map to free up memory
caseInsensitiveMap.clear();
if (err) {
@@ -1025,7 +1025,7 @@ ${other}`);
this._assetEmittingPreviousFiles = allTargetPaths;
- this.hooks.afterEmit.callAsync(compilation, err => {
+ this.hooks.afterEmit.callAsync(compilation, (err) => {
if (err) return callback(err);
return callback();
@@ -1034,7 +1034,7 @@ ${other}`);
);
};
- this.hooks.emit.callAsync(compilation, err => {
+ this.hooks.emit.callAsync(compilation, (err) => {
if (err) return callback(err);
outputPath = compilation.getPath(this.outputPath, {});
mkdirp(
@@ -1054,10 +1054,10 @@ ${other}`);
if (this.recordsOutputPath) {
asyncLib.parallel(
[
- cb => this.hooks.emitRecords.callAsync(cb),
+ (cb) => this.hooks.emitRecords.callAsync(cb),
this._emitRecords.bind(this)
],
- err => callback(err)
+ (err) => callback(err)
);
} else {
this.hooks.emitRecords.callAsync(callback);
@@ -1111,7 +1111,7 @@ ${other}`);
mkdirp(
/** @type {OutputFileSystem} */ (this.outputFileSystem),
recordsOutputPathDirectory,
- err => {
+ (err) => {
if (err) return callback(err);
writeFile();
}
@@ -1127,10 +1127,10 @@ ${other}`);
if (this.recordsInputPath) {
asyncLib.parallel(
[
- cb => this.hooks.readRecords.callAsync(cb),
+ (cb) => this.hooks.readRecords.callAsync(cb),
this._readRecords.bind(this)
],
- err => callback(err)
+ (err) => callback(err)
);
} else {
this.records = {};
@@ -1154,7 +1154,7 @@ ${other}`);
return callback();
}
/** @type {InputFileSystem} */
- (this.inputFileSystem).stat(this.recordsInputPath, err => {
+ (this.inputFileSystem).stat(this.recordsInputPath, (err) => {
// It doesn't exist
// We can ignore this.
if (err) return callback();
@@ -1339,7 +1339,7 @@ ${other}`);
*/
compile(callback) {
const params = this.newCompilationParams();
- this.hooks.beforeCompile.callAsync(params, err => {
+ this.hooks.beforeCompile.callAsync(params, (err) => {
if (err) return callback(err);
this.hooks.compile.call(params);
@@ -1349,28 +1349,28 @@ ${other}`);
const logger = compilation.getLogger("webpack.Compiler");
logger.time("make hook");
- this.hooks.make.callAsync(compilation, err => {
+ this.hooks.make.callAsync(compilation, (err) => {
logger.timeEnd("make hook");
if (err) return callback(err);
logger.time("finish make hook");
- this.hooks.finishMake.callAsync(compilation, err => {
+ this.hooks.finishMake.callAsync(compilation, (err) => {
logger.timeEnd("finish make hook");
if (err) return callback(err);
process.nextTick(() => {
logger.time("finish compilation");
- compilation.finish(err => {
+ compilation.finish((err) => {
logger.timeEnd("finish compilation");
if (err) return callback(err);
logger.time("seal compilation");
- compilation.seal(err => {
+ compilation.seal((err) => {
logger.timeEnd("seal compilation");
if (err) return callback(err);
logger.time("afterCompile hook");
- this.hooks.afterCompile.callAsync(compilation, err => {
+ this.hooks.afterCompile.callAsync(compilation, (err) => {
logger.timeEnd("afterCompile hook");
if (err) return callback(err);
@@ -1391,12 +1391,12 @@ ${other}`);
close(callback) {
if (this.watching) {
// When there is still an active watching, close this first
- this.watching.close(_err => {
+ this.watching.close((_err) => {
this.close(callback);
});
return;
}
- this.hooks.shutdown.callAsync(err => {
+ this.hooks.shutdown.callAsync((err) => {
if (err) return callback(err);
// Get rid of reference to last compilation to avoid leaking memory
// We can't run this._cleanupLastCompilation() as the Stats to this compilation
diff --git a/lib/ConstPlugin.js b/lib/ConstPlugin.js
index 04cca9430..82ac18cac 100644
--- a/lib/ConstPlugin.js
+++ b/lib/ConstPlugin.js
@@ -159,9 +159,9 @@ class ConstPlugin {
/**
* @param {JavascriptParser} parser the parser
*/
- const handler = parser => {
- parser.hooks.terminate.tap(PLUGIN_NAME, _statement => true);
- parser.hooks.statementIf.tap(PLUGIN_NAME, statement => {
+ const handler = (parser) => {
+ parser.hooks.terminate.tap(PLUGIN_NAME, (_statement) => true);
+ parser.hooks.statementIf.tap(PLUGIN_NAME, (statement) => {
if (parser.scope.isAsmJs) return;
const param = parser.evaluateExpression(statement.test);
const bool = param.asBool();
@@ -185,7 +185,7 @@ class ConstPlugin {
return bool;
}
});
- parser.hooks.unusedStatement.tap(PLUGIN_NAME, statement => {
+ parser.hooks.unusedStatement.tap(PLUGIN_NAME, (statement) => {
if (
parser.scope.isAsmJs ||
// Check top level scope here again
@@ -198,7 +198,7 @@ class ConstPlugin {
});
parser.hooks.expressionConditionalOperator.tap(
PLUGIN_NAME,
- expression => {
+ (expression) => {
if (parser.scope.isAsmJs) return;
const param = parser.evaluateExpression(expression.test);
const bool = param.asBool();
@@ -239,7 +239,7 @@ class ConstPlugin {
);
parser.hooks.expressionLogicalOperator.tap(
PLUGIN_NAME,
- expression => {
+ (expression) => {
if (parser.scope.isAsmJs) return;
if (
expression.operator === "&&" ||
@@ -381,7 +381,7 @@ class ConstPlugin {
}
}
);
- parser.hooks.optionalChaining.tap(PLUGIN_NAME, expr => {
+ parser.hooks.optionalChaining.tap(PLUGIN_NAME, (expr) => {
/** @type {Expression[]} */
const optionalExpressionsStack = [];
/** @type {Expression | Super} */
@@ -441,7 +441,7 @@ class ConstPlugin {
});
parser.hooks.evaluateIdentifier
.for("__resourceQuery")
- .tap(PLUGIN_NAME, expr => {
+ .tap(PLUGIN_NAME, (expr) => {
if (parser.scope.isAsmJs) return;
if (!parser.state.module) return;
return evaluateToString(
@@ -450,7 +450,7 @@ class ConstPlugin {
});
parser.hooks.expression
.for("__resourceQuery")
- .tap(PLUGIN_NAME, expr => {
+ .tap(PLUGIN_NAME, (expr) => {
if (parser.scope.isAsmJs) return;
if (!parser.state.module) return;
const dep = new CachedConstDependency(
@@ -467,7 +467,7 @@ class ConstPlugin {
parser.hooks.evaluateIdentifier
.for("__resourceFragment")
- .tap(PLUGIN_NAME, expr => {
+ .tap(PLUGIN_NAME, (expr) => {
if (parser.scope.isAsmJs) return;
if (!parser.state.module) return;
return evaluateToString(
@@ -476,7 +476,7 @@ class ConstPlugin {
});
parser.hooks.expression
.for("__resourceFragment")
- .tap(PLUGIN_NAME, expr => {
+ .tap(PLUGIN_NAME, (expr) => {
if (parser.scope.isAsmJs) return;
if (!parser.state.module) return;
const dep = new CachedConstDependency(
diff --git a/lib/ContextExclusionPlugin.js b/lib/ContextExclusionPlugin.js
index c9ad952e1..6bd57c6e0 100644
--- a/lib/ContextExclusionPlugin.js
+++ b/lib/ContextExclusionPlugin.js
@@ -23,9 +23,9 @@ class ContextExclusionPlugin {
* @returns {void}
*/
apply(compiler) {
- compiler.hooks.contextModuleFactory.tap(PLUGIN_NAME, cmf => {
- cmf.hooks.contextModuleFiles.tap(PLUGIN_NAME, files =>
- files.filter(filePath => !this.negativeMatcher.test(filePath))
+ compiler.hooks.contextModuleFactory.tap(PLUGIN_NAME, (cmf) => {
+ cmf.hooks.contextModuleFiles.tap(PLUGIN_NAME, (files) =>
+ files.filter((filePath) => !this.negativeMatcher.test(filePath))
);
});
}
diff --git a/lib/ContextModule.js b/lib/ContextModule.js
index 6cbbc7aa0..207854d4d 100644
--- a/lib/ContextModule.js
+++ b/lib/ContextModule.js
@@ -283,7 +283,7 @@ class ContextModule extends Module {
identifier = `${requestShortener.shorten(`${this.options.resource}`)}/`;
} else {
identifier = this.options.resource
- .map(r => `${requestShortener.shorten(r)}/`)
+ .map((r) => `${requestShortener.shorten(r)}/`)
.join(" ");
}
if (this.options.resourceQuery) {
@@ -309,7 +309,7 @@ class ContextModule extends Module {
}
if (this.options.referencedExports) {
identifier += ` referencedExports: ${this.options.referencedExports
- .map(e => e.join("."))
+ .map((e) => e.join("."))
.join(", ")}`;
}
if (this.options.chunkName) {
@@ -355,7 +355,7 @@ class ContextModule extends Module {
identifier = "false";
} else {
identifier = this.options.resource
- .map(res =>
+ .map((res) =>
contextify(options.context, res, options.associatedObjectForCache)
)
.join(" ");
@@ -386,7 +386,7 @@ class ContextModule extends Module {
}
if (this.options.referencedExports) {
identifier += ` referencedExports: ${this.options.referencedExports
- .map(e => e.join("."))
+ .map((e) => e.join("."))
.join(", ")}`;
}
@@ -466,7 +466,7 @@ class ContextModule extends Module {
}
dependencies.sort(
concatComparators(
- compareSelect(a => a.loc, compareLocations),
+ compareSelect((a) => a.loc, compareLocations),
keepOriginalOrder(this.dependencies)
)
);
@@ -588,7 +588,7 @@ class ContextModule extends Module {
const sortedDependencies =
/** @type {ContextElementDependency[]} */
(dependencies)
- .filter(dependency => moduleGraph.getModule(dependency))
+ .filter((dependency) => moduleGraph.getModule(dependency))
.sort((a, b) => {
if (a.userRequest === b.userRequest) {
return 0;
@@ -621,7 +621,8 @@ class ContextModule extends Module {
// therefore the order of this is !important!
const sortedModules = dependencies
.map(
- dependency => /** @type {Module} */ (moduleGraph.getModule(dependency))
+ (dependency) =>
+ /** @type {Module} */ (moduleGraph.getModule(dependency))
)
.filter(Boolean)
.sort(comparator);
@@ -945,7 +946,7 @@ module.exports = webpackAsyncContext;`;
let hasMultipleOrNoChunks = false;
let hasNoChunk = true;
const fakeMap = this.getFakeMap(
- blocks.map(b => b.dependencies[0]),
+ blocks.map((b) => b.dependencies[0]),
chunkGraph
);
const hasFakeMap = typeof fakeMap === "object";
@@ -954,7 +955,7 @@ module.exports = webpackAsyncContext;`;
* @type {Item[]}
*/
const items = blocks
- .map(block => {
+ .map((block) => {
const dependency =
/** @type {ContextElementDependency} */
(block.dependencies[0]);
@@ -966,7 +967,7 @@ module.exports = webpackAsyncContext;`;
chunks: undefined
};
})
- .filter(item => item.module);
+ .filter((item) => item.module);
for (const item of items) {
const chunkGroup = chunkGraph.getBlockChunkGroup(item.block);
const chunks = (chunkGroup && chunkGroup.chunks) || [];
@@ -1000,7 +1001,7 @@ module.exports = webpackAsyncContext;`;
map[item.userRequest] = [
...arrayStart,
.../** @type {Chunk[]} */
- (item.chunks).map(chunk => /** @type {ChunkId} */ (chunk.id))
+ (item.chunks).map((chunk) => /** @type {ChunkId} */ (chunk.id))
];
}
}
diff --git a/lib/ContextModuleFactory.js b/lib/ContextModuleFactory.js
index 77a7bf591..03e9b3e3a 100644
--- a/lib/ContextModuleFactory.js
+++ b/lib/ContextModuleFactory.js
@@ -56,7 +56,7 @@ module.exports = class ContextModuleFactory extends ModuleFactory {
{
name: "alternatives",
/** @type {AsyncSeriesWaterfallHook<[ContextAlternativeRequest[]]>["intercept"]} */
- intercept: interceptor => {
+ intercept: (interceptor) => {
throw new Error(
"Intercepting fake hook ContextModuleFactory.hooks.alternatives is not possible, use ContextModuleFactory.hooks.alternativeRequests instead"
);
@@ -169,13 +169,13 @@ module.exports = class ContextModuleFactory extends ModuleFactory {
asyncLib.parallel(
[
- callback => {
+ (callback) => {
const results = /** @type ResolveRequest[] */ ([]);
/**
* @param {ResolveRequest} obj obj
* @returns {void}
*/
- const yield_ = obj => {
+ const yield_ = (obj) => {
results.push(obj);
};
@@ -189,13 +189,13 @@ module.exports = class ContextModuleFactory extends ModuleFactory {
contextDependencies,
yield: yield_
},
- err => {
+ (err) => {
if (err) return callback(err);
callback(null, results);
}
);
},
- callback => {
+ (callback) => {
asyncLib.map(
loaders,
(loader, callback) => {
@@ -230,7 +230,7 @@ module.exports = class ContextModuleFactory extends ModuleFactory {
/** @type {[ResolveRequest[], string[]]} */ (result);
if (contextResult.length > 1) {
const first = contextResult[0];
- contextResult = contextResult.filter(r => r.path);
+ contextResult = contextResult.filter((r) => r.path);
if (contextResult.length === 0) contextResult.push(first);
}
this.hooks.afterResolve.callAsync(
@@ -241,7 +241,7 @@ module.exports = class ContextModuleFactory extends ModuleFactory {
(loaderResult.length > 0 ? "!" : ""),
resource:
contextResult.length > 1
- ? contextResult.map(r => r.path)
+ ? contextResult.map((r) => r.path)
: contextResult[0].path,
resolveDependencies: this.resolveDependencies.bind(this),
resourceQuery: contextResult[0].query,
@@ -342,13 +342,13 @@ module.exports = class ContextModuleFactory extends ModuleFactory {
fs.readdir(directory, (err, files) => {
if (err) return callback(err);
const processedFiles = cmf.hooks.contextModuleFiles.call(
- /** @type {string[]} */ (files).map(file => file.normalize("NFC"))
+ /** @type {string[]} */ (files).map((file) => file.normalize("NFC"))
);
if (!processedFiles || processedFiles.length === 0) {
return callback(null, []);
}
asyncLib.map(
- processedFiles.filter(p => p.indexOf(".") !== 0),
+ processedFiles.filter((p) => p.indexOf(".") !== 0),
(segment, callback) => {
const subResource = join(fs, directory, segment);
@@ -387,10 +387,10 @@ module.exports = class ContextModuleFactory extends ModuleFactory {
null,
/** @type {ContextAlternativeRequest[]} */
(alternatives)
- .filter(obj =>
+ .filter((obj) =>
regExp.test(/** @type {string} */ (obj.request))
)
- .map(obj => {
+ .map((obj) => {
const dep = new ContextElementDependency(
`${obj.request}${resourceQuery}${resourceFragment}`,
obj.request,
diff --git a/lib/ContextReplacementPlugin.js b/lib/ContextReplacementPlugin.js
index 828b8192e..76188c29c 100644
--- a/lib/ContextReplacementPlugin.js
+++ b/lib/ContextReplacementPlugin.js
@@ -97,8 +97,8 @@ class ContextReplacementPlugin {
const newContentRegExp = this.newContentRegExp;
const newContentCreateContextMap = this.newContentCreateContextMap;
- compiler.hooks.contextModuleFactory.tap(PLUGIN_NAME, cmf => {
- cmf.hooks.beforeResolve.tap(PLUGIN_NAME, result => {
+ compiler.hooks.contextModuleFactory.tap(PLUGIN_NAME, (cmf) => {
+ cmf.hooks.beforeResolve.tap(PLUGIN_NAME, (result) => {
if (!result) return;
if (resourceRegExp.test(result.request)) {
if (newContentResource !== undefined) {
@@ -120,7 +120,7 @@ class ContextReplacementPlugin {
}
return result;
});
- cmf.hooks.afterResolve.tap(PLUGIN_NAME, result => {
+ cmf.hooks.afterResolve.tap(PLUGIN_NAME, (result) => {
if (!result) return;
if (resourceRegExp.test(result.resource)) {
if (newContentResource !== undefined) {
@@ -183,11 +183,11 @@ class ContextReplacementPlugin {
* @returns {(fs: InputFileSystem, options: ContextModuleOptions, callback: (err: null | Error, dependencies?: ContextElementDependency[]) => void) => void} resolve resolve dependencies from context map function
*/
const createResolveDependenciesFromContextMap =
- createContextMap => (fs, options, callback) => {
+ (createContextMap) => (fs, options, callback) => {
createContextMap(fs, (err, map) => {
if (err) return callback(err);
const dependencies = Object.keys(map).map(
- key =>
+ (key) =>
new ContextElementDependency(
map[key] + options.resourceQuery + options.resourceFragment,
key,
diff --git a/lib/DefinePlugin.js b/lib/DefinePlugin.js
index f60d68f00..e3d75973f 100644
--- a/lib/DefinePlugin.js
+++ b/lib/DefinePlugin.js
@@ -130,7 +130,7 @@ class RuntimeValue {
*/
function getObjKeys(properties) {
if (!properties) return;
- return new Set([...properties].map(p => p.id));
+ return new Set([...properties].map((p) => p.id));
}
/** @typedef {Set | null} ObjKeys */
@@ -161,7 +161,7 @@ const stringifyObj = (
const arr = Array.isArray(obj);
if (arr) {
code = `[${obj
- .map(code =>
+ .map((code) =>
toCode(
code,
parser,
@@ -176,10 +176,10 @@ const stringifyObj = (
} else {
let keys = Object.keys(obj);
if (objKeys) {
- keys = objKeys.size === 0 ? [] : keys.filter(k => objKeys.has(k));
+ keys = objKeys.size === 0 ? [] : keys.filter((k) => objKeys.has(k));
}
code = `{${keys
- .map(key => {
+ .map((key) => {
const code = obj[key];
return `${JSON.stringify(key)}:${toCode(
code,
@@ -286,7 +286,7 @@ const toCode = (
* @param {CodeValue} code code
* @returns {string | undefined} result
*/
-const toCacheVersion = code => {
+const toCacheVersion = (code) => {
if (code === null) {
return "null";
}
@@ -306,7 +306,7 @@ const toCacheVersion = code => {
return `(${code.toString()})`;
}
if (typeof code === "object") {
- const items = Object.keys(code).map(key => ({
+ const items = Object.keys(code).map((key) => ({
key,
value: toCacheVersion(
/** @type {Record} */
@@ -390,7 +390,7 @@ class DefinePlugin {
* @param {JavascriptParser} parser Parser
* @returns {void}
*/
- const handler = parser => {
+ const handler = (parser) => {
const hooked = new Set();
const mainValue =
/** @type {ValueCacheVersion} */
@@ -408,7 +408,7 @@ class DefinePlugin {
/**
* @param {string} key key
*/
- const addValueDependency = key => {
+ const addValueDependency = (key) => {
const buildInfo =
/** @type {BuildInfo} */
(parser.state.module.buildInfo);
@@ -495,7 +495,7 @@ class DefinePlugin {
// why 100? Ensures it runs after object define
stage: 100
},
- expr => {
+ (expr) => {
const destructed =
parser.destructuringAssignmentPropertiesFor(expr);
if (destructed === undefined) {
@@ -557,7 +557,7 @@ class DefinePlugin {
});
parser.hooks.evaluateIdentifier
.for(key)
- .tap(PLUGIN_NAME, expr => {
+ .tap(PLUGIN_NAME, (expr) => {
/**
* this is needed in case there is a recursion in the DefinePlugin
* to prevent an endless recursion
@@ -584,7 +584,7 @@ class DefinePlugin {
res.setRange(/** @type {Range} */ (expr.range));
return res;
});
- parser.hooks.expression.for(key).tap(PLUGIN_NAME, expr => {
+ parser.hooks.expression.for(key).tap(PLUGIN_NAME, (expr) => {
addValueDependency(originalKey);
let strCode = toCode(
code,
@@ -613,7 +613,7 @@ class DefinePlugin {
return toConstantDependency(parser, strCode)(expr);
});
}
- parser.hooks.evaluateTypeof.for(key).tap(PLUGIN_NAME, expr => {
+ parser.hooks.evaluateTypeof.for(key).tap(PLUGIN_NAME, (expr) => {
/**
* this is needed in case there is a recursion in the DefinePlugin
* to prevent an endless recursion
@@ -640,7 +640,7 @@ class DefinePlugin {
res.setRange(/** @type {Range} */ (expr.range));
return res;
});
- parser.hooks.typeof.for(key).tap(PLUGIN_NAME, expr => {
+ parser.hooks.typeof.for(key).tap(PLUGIN_NAME, (expr) => {
addValueDependency(originalKey);
const codeCode = toCode(
code,
@@ -672,20 +672,22 @@ class DefinePlugin {
addValueDependency(key);
return true;
});
- parser.hooks.evaluateIdentifier.for(key).tap(PLUGIN_NAME, expr => {
- addValueDependency(key);
- return new BasicEvaluatedExpression()
- .setTruthy()
- .setSideEffects(false)
- .setRange(/** @type {Range} */ (expr.range));
- });
+ parser.hooks.evaluateIdentifier
+ .for(key)
+ .tap(PLUGIN_NAME, (expr) => {
+ addValueDependency(key);
+ return new BasicEvaluatedExpression()
+ .setTruthy()
+ .setSideEffects(false)
+ .setRange(/** @type {Range} */ (expr.range));
+ });
parser.hooks.evaluateTypeof
.for(key)
.tap(
PLUGIN_NAME,
withValueDependency(key, evaluateToString("object"))
);
- parser.hooks.expression.for(key).tap(PLUGIN_NAME, expr => {
+ parser.hooks.expression.for(key).tap(PLUGIN_NAME, (expr) => {
addValueDependency(key);
let strCode = stringifyObj(
obj,
@@ -778,7 +780,7 @@ class DefinePlugin {
* @param {Record} definitions Definitions map
* @returns {void}
*/
- const walkDefinitionsForKeys = definitions => {
+ const walkDefinitionsForKeys = (definitions) => {
/**
* @param {Map>} map Map
* @param {string} key key
diff --git a/lib/DelegatedModuleFactoryPlugin.js b/lib/DelegatedModuleFactoryPlugin.js
index c12c27bd9..32d80a005 100644
--- a/lib/DelegatedModuleFactoryPlugin.js
+++ b/lib/DelegatedModuleFactoryPlugin.js
@@ -92,7 +92,7 @@ class DelegatedModuleFactoryPlugin {
}
);
} else {
- normalModuleFactory.hooks.module.tap(PLUGIN_NAME, module => {
+ normalModuleFactory.hooks.module.tap(PLUGIN_NAME, (module) => {
const request = module.libIdent(this.options);
if (request && request in this.options.content) {
const resolved = this.options.content[request];
diff --git a/lib/DllEntryPlugin.js b/lib/DllEntryPlugin.js
index 3bbafb0c6..a63946cf9 100644
--- a/lib/DllEntryPlugin.js
+++ b/lib/DllEntryPlugin.js
@@ -64,7 +64,7 @@ class DllEntryPlugin {
this.options.name
),
this.options,
- error => {
+ (error) => {
if (error) return callback(error);
callback();
}
diff --git a/lib/DllReferencePlugin.js b/lib/DllReferencePlugin.js
index 0cec5bdcf..927feb570 100644
--- a/lib/DllReferencePlugin.js
+++ b/lib/DllReferencePlugin.js
@@ -102,7 +102,7 @@ class DllReferencePlugin {
return callback();
});
- compiler.hooks.compile.tap(PLUGIN_NAME, params => {
+ compiler.hooks.compile.tap(PLUGIN_NAME, (params) => {
let name = this.options.name;
let sourceType = this.options.sourceType;
let resolvedContent =
diff --git a/lib/DynamicEntryPlugin.js b/lib/DynamicEntryPlugin.js
index 796005420..d30acbae1 100644
--- a/lib/DynamicEntryPlugin.js
+++ b/lib/DynamicEntryPlugin.js
@@ -43,9 +43,9 @@ class DynamicEntryPlugin {
}
);
- compiler.hooks.make.tapPromise(PLUGIN_NAME, compilation =>
+ compiler.hooks.make.tapPromise(PLUGIN_NAME, (compilation) =>
Promise.resolve(this.entry())
- .then(entry => {
+ .then((entry) => {
const promises = [];
for (const name of Object.keys(entry)) {
const desc = entry[name];
@@ -68,7 +68,7 @@ class DynamicEntryPlugin {
this.context,
EntryPlugin.createDependency(entry, options),
options,
- err => {
+ (err) => {
if (err) return reject(err);
resolve();
}
diff --git a/lib/EntryPlugin.js b/lib/EntryPlugin.js
index 5031b6d07..35392d871 100644
--- a/lib/EntryPlugin.js
+++ b/lib/EntryPlugin.js
@@ -45,7 +45,7 @@ class EntryPlugin {
const dep = EntryPlugin.createDependency(entry, options);
compiler.hooks.make.tapAsync(PLUGIN_NAME, (compilation, callback) => {
- compilation.addEntry(context, dep, options, err => {
+ compilation.addEntry(context, dep, options, (err) => {
callback(err);
});
});
diff --git a/lib/EnvironmentPlugin.js b/lib/EnvironmentPlugin.js
index 078cdf67c..3bf01f096 100644
--- a/lib/EnvironmentPlugin.js
+++ b/lib/EnvironmentPlugin.js
@@ -48,7 +48,7 @@ class EnvironmentPlugin {
: this.defaultValues[key];
if (value === undefined) {
- compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => {
+ compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
const error = new WebpackError(
`${PLUGIN_NAME} - ${key} environment variable is undefined.\n\n` +
"You can pass an object with default values to suppress this warning.\n" +
diff --git a/lib/ErrorHelpers.js b/lib/ErrorHelpers.js
index af5801786..b23d1f1b4 100644
--- a/lib/ErrorHelpers.js
+++ b/lib/ErrorHelpers.js
@@ -28,13 +28,13 @@ const cutOffByFlag = (stack, flag) => {
* @param {string} stack stack trace
* @returns {string} stack trace without the loader execution flag included
*/
-const cutOffLoaderExecution = stack => cutOffByFlag(stack, loaderFlag);
+const cutOffLoaderExecution = (stack) => cutOffByFlag(stack, loaderFlag);
/**
* @param {string} stack stack trace
* @returns {string} stack trace without the webpack options flag included
*/
-const cutOffWebpackOptions = stack => cutOffByFlag(stack, webpackOptionsFlag);
+const cutOffWebpackOptions = (stack) => cutOffByFlag(stack, webpackOptionsFlag);
/**
* @param {string} stack stack trace
diff --git a/lib/EvalDevToolModulePlugin.js b/lib/EvalDevToolModulePlugin.js
index bde4bb646..f5ca3d195 100644
--- a/lib/EvalDevToolModulePlugin.js
+++ b/lib/EvalDevToolModulePlugin.js
@@ -55,7 +55,7 @@ class EvalDevToolModulePlugin {
* @returns {void}
*/
apply(compiler) {
- compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
+ compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
const hooks = JavascriptModulesPlugin.getCompilationHooks(compilation);
hooks.renderModuleContent.tap(
PLUGIN_NAME,
@@ -110,7 +110,7 @@ class EvalDevToolModulePlugin {
);
hooks.render.tap(
PLUGIN_NAME,
- source => new ConcatSource(devtoolWarning, source)
+ (source) => new ConcatSource(devtoolWarning, source)
);
hooks.chunkHash.tap(PLUGIN_NAME, (chunk, hash) => {
hash.update(PLUGIN_NAME);
diff --git a/lib/EvalSourceMapDevToolPlugin.js b/lib/EvalSourceMapDevToolPlugin.js
index 386f8ae4f..a8c6ce318 100644
--- a/lib/EvalSourceMapDevToolPlugin.js
+++ b/lib/EvalSourceMapDevToolPlugin.js
@@ -69,7 +69,7 @@ class EvalSourceMapDevToolPlugin {
*/
apply(compiler) {
const options = this.options;
- compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
+ compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
const hooks = JavascriptModulesPlugin.getCompilationHooks(compilation);
new SourceMapDevToolModuleOptionsPlugin(options).apply(compilation);
const matchModule = ModuleFilenameHelpers.matchObject.bind(
@@ -88,7 +88,7 @@ class EvalSourceMapDevToolPlugin {
* @param {Source} r result
* @returns {Source} result
*/
- const result = r => {
+ const result = (r) => {
cache.set(source, r);
return r;
};
@@ -136,13 +136,13 @@ class EvalSourceMapDevToolPlugin {
sourceMap = { ...sourceMap };
const context = /** @type {string} */ (compiler.options.context);
const root = compiler.root;
- const modules = sourceMap.sources.map(source => {
+ const modules = sourceMap.sources.map((source) => {
if (!source.startsWith("webpack://")) return source;
source = makePathsAbsolute(context, source.slice(10), root);
const module = compilation.findModule(source);
return module || source;
});
- let moduleFilenames = modules.map(module =>
+ let moduleFilenames = modules.map((module) =>
ModuleFilenameHelpers.createFilename(
module,
{
@@ -205,7 +205,7 @@ class EvalSourceMapDevToolPlugin {
);
hooks.render.tap(
PLUGIN_NAME,
- source => new ConcatSource(devtoolWarning, source)
+ (source) => new ConcatSource(devtoolWarning, source)
);
hooks.chunkHash.tap(PLUGIN_NAME, (chunk, hash) => {
hash.update(PLUGIN_NAME);
diff --git a/lib/ExportsInfo.js b/lib/ExportsInfo.js
index e8fb81d01..695511ba8 100644
--- a/lib/ExportsInfo.js
+++ b/lib/ExportsInfo.js
@@ -142,7 +142,7 @@ class ExportsInfo {
if (this._redirectTo !== undefined) {
/** @type {Exports} */
const map = new Map(
- Array.from(this._redirectTo.orderedExports, item => [item.name, item])
+ Array.from(this._redirectTo.orderedExports, (item) => [item.name, item])
);
for (const [key, value] of this._exports) {
map.set(key, value);
@@ -402,7 +402,7 @@ class ExportsInfo {
} else {
if (
this._otherExportsInfo.setUsedConditionally(
- used => used < UsageState.Unknown,
+ (used) => used < UsageState.Unknown,
UsageState.Unknown,
runtime
)
@@ -465,7 +465,7 @@ class ExportsInfo {
*/
setUsedForSideEffectsOnly(runtime) {
return this._sideEffectsOnlyInfo.setUsedConditionally(
- used => used === UsageState.Unused,
+ (used) => used === UsageState.Unused,
UsageState.Used,
runtime
);
@@ -988,7 +988,7 @@ class ExportInfo {
let changed = false;
if (
this.setUsedConditionally(
- used => used < UsageState.Unknown,
+ (used) => used < UsageState.Unknown,
UsageState.Unknown,
runtime
)
@@ -1050,7 +1050,7 @@ class ExportInfo {
} else if (this._usedInRuntime === undefined) {
if (newValue !== UsageState.Unused && condition(UsageState.Unused)) {
this._usedInRuntime = new Map();
- forEachRuntime(runtime, runtime =>
+ forEachRuntime(runtime, (runtime) =>
/** @type {UsedInRuntime} */
(this._usedInRuntime).set(/** @type {string} */ (runtime), newValue)
);
@@ -1058,7 +1058,7 @@ class ExportInfo {
}
} else {
let changed = false;
- forEachRuntime(runtime, _runtime => {
+ forEachRuntime(runtime, (_runtime) => {
const runtime = /** @type {string} */ (_runtime);
const usedInRuntime =
/** @type {UsedInRuntime} */
@@ -1098,7 +1098,7 @@ class ExportInfo {
} else if (this._usedInRuntime === undefined) {
if (newValue !== UsageState.Unused) {
this._usedInRuntime = new Map();
- forEachRuntime(runtime, runtime =>
+ forEachRuntime(runtime, (runtime) =>
/** @type {UsedInRuntime} */
(this._usedInRuntime).set(/** @type {string} */ (runtime), newValue)
);
@@ -1106,7 +1106,7 @@ class ExportInfo {
}
} else {
let changed = false;
- forEachRuntime(runtime, _runtime => {
+ forEachRuntime(runtime, (_runtime) => {
const runtime = /** @type {string} */ (_runtime);
const usedInRuntime =
/** @type {UsedInRuntime} */
@@ -1247,7 +1247,7 @@ class ExportInfo {
} else if (
runtime !== undefined &&
[...runtime].every(
- runtime =>
+ (runtime) =>
!(/** @type {UsedInRuntime} */ (this._usedInRuntime).has(runtime))
)
) {
diff --git a/lib/ExportsInfoApiPlugin.js b/lib/ExportsInfoApiPlugin.js
index faf4594bb..2fdf8bdbe 100644
--- a/lib/ExportsInfoApiPlugin.js
+++ b/lib/ExportsInfoApiPlugin.js
@@ -38,7 +38,7 @@ class ExportsInfoApiPlugin {
* @param {JavascriptParser} parser the parser
* @returns {void}
*/
- const handler = parser => {
+ const handler = (parser) => {
parser.hooks.expressionMemberChain
.for("__webpack_exports_info__")
.tap(PLUGIN_NAME, (expr, members) => {
@@ -60,7 +60,7 @@ class ExportsInfoApiPlugin {
});
parser.hooks.expression
.for("__webpack_exports_info__")
- .tap(PLUGIN_NAME, expr => {
+ .tap(PLUGIN_NAME, (expr) => {
const dep = new ConstDependency(
"true",
/** @type {Range} */ (expr.range)
diff --git a/lib/ExternalModule.js b/lib/ExternalModule.js
index 66edc91de..9726d6398 100644
--- a/lib/ExternalModule.js
+++ b/lib/ExternalModule.js
@@ -96,7 +96,9 @@ const getSourceForGlobalVariableExternal = (variableName, type) => {
}
// needed for e.g. window["some"]["thing"]
- const objectLookup = variableName.map(r => `[${JSON.stringify(r)}]`).join("");
+ const objectLookup = variableName
+ .map((r) => `[${JSON.stringify(r)}]`)
+ .join("");
return {
iife: type === "this",
expression: `${type}${objectLookup}`
@@ -107,7 +109,7 @@ const getSourceForGlobalVariableExternal = (variableName, type) => {
* @param {string|string[]} moduleAndSpecifiers the module request
* @returns {SourceData} the generated source
*/
-const getSourceForCommonJsExternal = moduleAndSpecifiers => {
+const getSourceForCommonJsExternal = (moduleAndSpecifiers) => {
if (!Array.isArray(moduleAndSpecifiers)) {
return {
expression: `require(${JSON.stringify(moduleAndSpecifiers)})`
diff --git a/lib/ExternalModuleFactoryPlugin.js b/lib/ExternalModuleFactoryPlugin.js
index 85b95b95d..e011ae0e9 100644
--- a/lib/ExternalModuleFactoryPlugin.js
+++ b/lib/ExternalModuleFactoryPlugin.js
@@ -264,7 +264,7 @@ class ExternalModuleFactoryPlugin {
request: dependency.request,
dependencyType,
contextInfo,
- getResolve: options => (context, request, callback) => {
+ getResolve: (options) => (context, request, callback) => {
const resolveContext = {
fileDependencies: data.fileDependencies,
missingDependencies: data.missingDependencies,
@@ -307,7 +307,7 @@ class ExternalModuleFactoryPlugin {
},
cb
);
- if (promise && promise.then) promise.then(r => cb(null, r), cb);
+ if (promise && promise.then) promise.then((r) => cb(null, r), cb);
}
return;
} else if (typeof externals === "object") {
diff --git a/lib/FileSystemInfo.js b/lib/FileSystemInfo.js
index f295078b6..883bb9d17 100644
--- a/lib/FileSystemInfo.js
+++ b/lib/FileSystemInfo.js
@@ -550,7 +550,7 @@ class Snapshot {
*/
getFileIterable() {
if (this._cachedFileIterable === undefined) {
- this._cachedFileIterable = this._createIterable(s => [
+ this._cachedFileIterable = this._createIterable((s) => [
s.fileTimestamps,
s.fileHashes,
s.fileTshs,
@@ -565,7 +565,7 @@ class Snapshot {
*/
getContextIterable() {
if (this._cachedContextIterable === undefined) {
- this._cachedContextIterable = this._createIterable(s => [
+ this._cachedContextIterable = this._createIterable((s) => [
s.contextTimestamps,
s.contextHashes,
s.contextTshs,
@@ -580,7 +580,7 @@ class Snapshot {
*/
getMissingIterable() {
if (this._cachedMissingIterable === undefined) {
- this._cachedMissingIterable = this._createIterable(s => [
+ this._cachedMissingIterable = this._createIterable((s) => [
s.missingExistence,
s.managedMissing
]);
@@ -661,7 +661,7 @@ class SnapshotOptimization {
* @param {SnapshotOptimizationEntry} entry optimization entry
* @returns {void}
*/
- const increaseSharedAndStoreOptimizationEntry = entry => {
+ const increaseSharedAndStoreOptimizationEntry = (entry) => {
if (entry.children !== undefined) {
for (const child of entry.children) {
increaseSharedAndStoreOptimizationEntry(child);
@@ -674,7 +674,7 @@ class SnapshotOptimization {
* @param {SnapshotOptimizationEntry} entry optimization entry
* @returns {void}
*/
- const storeOptimizationEntry = entry => {
+ const storeOptimizationEntry = (entry) => {
for (const path of /** @type {SnapshotContent} */ (
entry.snapshotContent
)) {
@@ -872,7 +872,7 @@ class SnapshotOptimization {
* @param {string} str input
* @returns {string} result
*/
-const parseString = str => {
+const parseString = (str) => {
if (str[0] === "'" || str[0] === "`") {
str = `"${str.slice(1, -1).replace(/"/g, '\\"')}"`;
}
@@ -883,7 +883,7 @@ const parseString = str => {
/**
* @param {number} mtime mtime
*/
-const applyMtime = mtime => {
+const applyMtime = (mtime) => {
if (FS_ACCURACY > 1 && mtime % 2 !== 0) FS_ACCURACY = 1;
else if (FS_ACCURACY > 10 && mtime % 20 !== 0) FS_ACCURACY = 10;
else if (FS_ACCURACY > 100 && mtime % 200 !== 0) FS_ACCURACY = 100;
@@ -1014,7 +1014,7 @@ const getManagedItem = (managedPath, path) => {
* @param {T | null} entry entry
* @returns {T["resolved"] | null | undefined} the resolved entry
*/
-const getResolvedTimestamp = entry => {
+const getResolvedTimestamp = (entry) => {
if (entry === null) return null;
if (entry.resolved !== undefined) return entry.resolved;
return entry.symlinks === undefined ? entry : undefined;
@@ -1024,7 +1024,7 @@ const getResolvedTimestamp = entry => {
* @param {ContextHash | null} entry entry
* @returns {string | null | undefined} the resolved entry
*/
-const getResolvedHash = entry => {
+const getResolvedHash = (entry) => {
if (entry === null) return null;
if (entry.resolved !== undefined) return entry.resolved;
return entry.symlinks === undefined ? entry.hash : undefined;
@@ -1079,66 +1079,66 @@ class FileSystemInfo {
/** @type {WeakMap} */
this._snapshotCache = new WeakMap();
this._fileTimestampsOptimization = new SnapshotOptimization(
- s => s.hasFileTimestamps(),
- s => s.fileTimestamps,
+ (s) => s.hasFileTimestamps(),
+ (s) => s.fileTimestamps,
(s, v) => s.setFileTimestamps(v)
);
this._fileHashesOptimization = new SnapshotOptimization(
- s => s.hasFileHashes(),
- s => s.fileHashes,
+ (s) => s.hasFileHashes(),
+ (s) => s.fileHashes,
(s, v) => s.setFileHashes(v),
false
);
this._fileTshsOptimization = new SnapshotOptimization(
- s => s.hasFileTshs(),
- s => s.fileTshs,
+ (s) => s.hasFileTshs(),
+ (s) => s.fileTshs,
(s, v) => s.setFileTshs(v)
);
this._contextTimestampsOptimization = new SnapshotOptimization(
- s => s.hasContextTimestamps(),
- s => s.contextTimestamps,
+ (s) => s.hasContextTimestamps(),
+ (s) => s.contextTimestamps,
(s, v) => s.setContextTimestamps(v)
);
this._contextHashesOptimization = new SnapshotOptimization(
- s => s.hasContextHashes(),
- s => s.contextHashes,
+ (s) => s.hasContextHashes(),
+ (s) => s.contextHashes,
(s, v) => s.setContextHashes(v),
false
);
this._contextTshsOptimization = new SnapshotOptimization(
- s => s.hasContextTshs(),
- s => s.contextTshs,
+ (s) => s.hasContextTshs(),
+ (s) => s.contextTshs,
(s, v) => s.setContextTshs(v)
);
this._missingExistenceOptimization = new SnapshotOptimization(
- s => s.hasMissingExistence(),
- s => s.missingExistence,
+ (s) => s.hasMissingExistence(),
+ (s) => s.missingExistence,
(s, v) => s.setMissingExistence(v),
false
);
this._managedItemInfoOptimization = new SnapshotOptimization(
- s => s.hasManagedItemInfo(),
- s => s.managedItemInfo,
+ (s) => s.hasManagedItemInfo(),
+ (s) => s.managedItemInfo,
(s, v) => s.setManagedItemInfo(v),
false
);
this._managedFilesOptimization = new SnapshotOptimization(
- s => s.hasManagedFiles(),
- s => s.managedFiles,
+ (s) => s.hasManagedFiles(),
+ (s) => s.managedFiles,
(s, v) => s.setManagedFiles(v),
false,
true
);
this._managedContextsOptimization = new SnapshotOptimization(
- s => s.hasManagedContexts(),
- s => s.managedContexts,
+ (s) => s.hasManagedContexts(),
+ (s) => s.managedContexts,
(s, v) => s.setManagedContexts(v),
false,
true
);
this._managedMissingOptimization = new SnapshotOptimization(
- s => s.hasManagedMissing(),
- s => s.managedMissing,
+ (s) => s.hasManagedMissing(),
+ (s) => s.managedMissing,
(s, v) => s.setManagedMissing(v),
false,
true
@@ -1202,32 +1202,32 @@ class FileSystemInfo {
const _unmanagedPaths = [...unmanagedPaths];
this.unmanagedPathsWithSlash =
/** @type {string[]} */
- (_unmanagedPaths.filter(p => typeof p === "string")).map(p =>
+ (_unmanagedPaths.filter((p) => typeof p === "string")).map((p) =>
join(fs, p, "_").slice(0, -1)
);
this.unmanagedPathsRegExps =
/** @type {RegExp[]} */
- (_unmanagedPaths.filter(p => typeof p !== "string"));
+ (_unmanagedPaths.filter((p) => typeof p !== "string"));
this.managedPaths = [...managedPaths];
this.managedPathsWithSlash =
/** @type {string[]} */
- (this.managedPaths.filter(p => typeof p === "string")).map(p =>
+ (this.managedPaths.filter((p) => typeof p === "string")).map((p) =>
join(fs, p, "_").slice(0, -1)
);
this.managedPathsRegExps =
/** @type {RegExp[]} */
- (this.managedPaths.filter(p => typeof p !== "string"));
+ (this.managedPaths.filter((p) => typeof p !== "string"));
this.immutablePaths = [...immutablePaths];
this.immutablePathsWithSlash =
/** @type {string[]} */
- (this.immutablePaths.filter(p => typeof p === "string")).map(p =>
+ (this.immutablePaths.filter((p) => typeof p === "string")).map((p) =>
join(fs, p, "_").slice(0, -1)
);
this.immutablePathsRegExps =
/** @type {RegExp[]} */
- (this.immutablePaths.filter(p => typeof p !== "string"));
+ (this.immutablePaths.filter((p) => typeof p !== "string"));
this._cachedDeprecatedFileTimestamps = undefined;
this._cachedDeprecatedContextTimestamps = undefined;
@@ -1605,7 +1605,7 @@ class FileSystemInfo {
* @param {undefined | boolean | string} expected expected result
* @returns {string} expected result
*/
- const expectedToString = expected =>
+ const expectedToString = (expected) =>
expected ? ` (expected ${expected})` : "";
/** @typedef {{ type: JobType, context: string | undefined, path: string, issuer: Job | undefined, expected: undefined | boolean | string }} Job */
@@ -1613,7 +1613,7 @@ class FileSystemInfo {
* @param {Job} job job
* @returns {`resolve commonjs file ${string}${string}`|`resolve esm file ${string}${string}`|`resolve esm ${string}${string}`|`resolve directory ${string}`|`file ${string}`|`unknown ${string} ${string}`|`resolve commonjs ${string}${string}`|`directory ${string}`|`file dependencies ${string}`|`directory dependencies ${string}`} result
*/
- const jobToString = job => {
+ const jobToString = (job) => {
switch (job.type) {
case RBDT_RESOLVE_CJS:
return `resolve commonjs ${job.path}${expectedToString(
@@ -1646,7 +1646,7 @@ class FileSystemInfo {
* @param {Job} job job
* @returns {string} string value
*/
- const pathToString = job => {
+ const pathToString = (job) => {
let result = ` at ${jobToString(job)}`;
/** @type {Job | undefined} */
(job) = job.issuer;
@@ -1660,7 +1660,7 @@ class FileSystemInfo {
processAsyncTree(
Array.from(
deps,
- dep =>
+ (dep) =>
/** @type {Job} */ ({
type: RBDT_RESOLVE_CJS,
context,
@@ -1676,7 +1676,7 @@ class FileSystemInfo {
* @param {string} path path
* @returns {void}
*/
- const resolveDirectory = path => {
+ const resolveDirectory = (path) => {
const key = `d\n${context}\n${path}`;
if (resolveResults.has(key)) {
return callback();
@@ -2071,7 +2071,7 @@ class FileSystemInfo {
}
}
},
- err => {
+ (err) => {
if (err) return callback(err);
for (const l of fileSymlinks) files.delete(l);
for (const l of directorySymlinks) directories.delete(l);
@@ -2158,7 +2158,7 @@ class FileSystemInfo {
* @param {Error | typeof INVALID=} err error or invalid flag
* @returns {void}
*/
- err => {
+ (err) => {
if (err === INVALID) {
return callback(null, false);
}
@@ -2332,7 +2332,7 @@ class FileSystemInfo {
/**
* @param {ManagedFiles} capturedFiles captured files
*/
- const processCapturedFiles = capturedFiles => {
+ const processCapturedFiles = (capturedFiles) => {
switch (mode) {
case 3:
this._fileTshsOptimization.optimize(snapshot, capturedFiles);
@@ -2420,7 +2420,7 @@ class FileSystemInfo {
/**
* @param {ManagedContexts} capturedDirectories captured directories
*/
- const processCapturedDirectories = capturedDirectories => {
+ const processCapturedDirectories = (capturedDirectories) => {
switch (mode) {
case 3:
this._contextTshsOptimization.optimize(snapshot, capturedDirectories);
@@ -2565,7 +2565,7 @@ class FileSystemInfo {
/**
* @param {ManagedMissing} capturedMissing captured missing
*/
- const processCapturedMissing = capturedMissing => {
+ const processCapturedMissing = (capturedMissing) => {
this._missingExistenceOptimization.optimize(snapshot, capturedMissing);
for (const path of capturedMissing) {
const cache = this._fileTimestamps.get(path);
@@ -3345,7 +3345,7 @@ class FileSystemInfo {
* @param {string} hash hash
* @returns {void}
*/
- const continueWithHash = hash => {
+ const continueWithHash = (hash) => {
const cache = this._fileTimestamps.get(path);
if (cache !== undefined) {
if (cache !== "ignore") {
@@ -3421,8 +3421,8 @@ class FileSystemInfo {
return callback(err);
}
const files = /** @type {string[]} */ (_files)
- .map(file => file.normalize("NFC"))
- .filter(file => !/^\./.test(file))
+ .map((file) => file.normalize("NFC"))
+ .filter((file) => !/^\./.test(file))
.sort();
asyncLib.map(
files,
@@ -3510,7 +3510,7 @@ class FileSystemInfo {
fromImmutablePath: () =>
/** @type {ContextFileSystemInfoEntry | FileSystemInfoEntry | "ignore" | null} */
(null),
- fromManagedItem: info => ({
+ fromManagedItem: (info) => ({
safeTime: 0,
timestampHash: info
}),
@@ -3643,7 +3643,7 @@ class FileSystemInfo {
callback();
});
},
- err => {
+ (err) => {
if (err) return callback(/** @type {WebpackError} */ (err));
const hash = createHash(this._hashFunction);
hash.update(/** @type {string} */ (entry.timestampHash));
@@ -3674,7 +3674,7 @@ class FileSystemInfo {
{
path,
fromImmutablePath: () => /** @type {ContextHash | ""} */ (""),
- fromManagedItem: info => info || "",
+ fromManagedItem: (info) => info || "",
fromSymlink: (file, target, callback) => {
callback(
null,
@@ -3759,7 +3759,7 @@ class FileSystemInfo {
callback();
});
},
- err => {
+ (err) => {
if (err) return callback(/** @type {WebpackError} */ (err));
const hash = createHash(this._hashFunction);
hash.update(entry.hash);
@@ -3817,7 +3817,7 @@ class FileSystemInfo {
path,
fromImmutablePath: () =>
/** @type {ContextTimestampAndHash | null} */ (null),
- fromManagedItem: info => ({
+ fromManagedItem: (info) => ({
safeTime: 0,
timestampHash: info,
hash: info || ""
@@ -3937,7 +3937,7 @@ class FileSystemInfo {
callback();
});
},
- err => {
+ (err) => {
if (err) return callback(/** @type {WebpackError} */ (err));
const hash = createHash(this._hashFunction);
const tsHash = createHash(this._hashFunction);
@@ -3979,7 +3979,7 @@ class FileSystemInfo {
return callback(/** @type {WebpackError} */ (err));
}
const set = new Set(
- /** @type {string[]} */ (elements).map(element =>
+ /** @type {string[]} */ (elements).map((element) =>
join(this.fs, path, element)
)
);
diff --git a/lib/FlagAllModulesAsUsedPlugin.js b/lib/FlagAllModulesAsUsedPlugin.js
index eb3ee4cf4..0f5969cac 100644
--- a/lib/FlagAllModulesAsUsedPlugin.js
+++ b/lib/FlagAllModulesAsUsedPlugin.js
@@ -26,9 +26,9 @@ class FlagAllModulesAsUsedPlugin {
* @returns {void}
*/
apply(compiler) {
- compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
+ compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
const moduleGraph = compilation.moduleGraph;
- compilation.hooks.optimizeDependencies.tap(PLUGIN_NAME, modules => {
+ compilation.hooks.optimizeDependencies.tap(PLUGIN_NAME, (modules) => {
/** @type {RuntimeSpec} */
let runtime;
for (const [name, { options }] of compilation.entries) {
diff --git a/lib/FlagDependencyExportsPlugin.js b/lib/FlagDependencyExportsPlugin.js
index abb93846c..b26e3b03f 100644
--- a/lib/FlagDependencyExportsPlugin.js
+++ b/lib/FlagDependencyExportsPlugin.js
@@ -28,7 +28,7 @@ class FlagDependencyExportsPlugin {
* @returns {void}
*/
apply(compiler) {
- compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
+ compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
const moduleGraph = compilation.moduleGraph;
const cache = compilation.getCache(PLUGIN_NAME);
compilation.hooks.finishModules.tapAsync(
@@ -103,7 +103,7 @@ class FlagDependencyExportsPlugin {
}
);
},
- err => {
+ (err) => {
logger.timeEnd("restore cached provided exports");
if (err) return callback(err);
@@ -129,7 +129,7 @@ class FlagDependencyExportsPlugin {
* @param {DependenciesBlock} depBlock the dependencies block
* @returns {void}
*/
- const processDependenciesBlock = depBlock => {
+ const processDependenciesBlock = (depBlock) => {
for (const dep of depBlock.dependencies) {
processDependency(dep);
}
@@ -142,7 +142,7 @@ class FlagDependencyExportsPlugin {
* @param {Dependency} dep the dependency
* @returns {void}
*/
- const processDependency = dep => {
+ const processDependency = (dep) => {
const exportDesc = dep.getExports(moduleGraph);
if (!exportDesc) return;
exportsSpecsFromDependencies.set(dep, exportDesc);
@@ -399,7 +399,7 @@ class FlagDependencyExportsPlugin {
callback
);
},
- err => {
+ (err) => {
logger.timeEnd("store provided exports into cache");
callback(err);
}
@@ -411,13 +411,13 @@ class FlagDependencyExportsPlugin {
/** @type {WeakMap} */
const providedExportsCache = new WeakMap();
- compilation.hooks.rebuildModule.tap(PLUGIN_NAME, module => {
+ compilation.hooks.rebuildModule.tap(PLUGIN_NAME, (module) => {
providedExportsCache.set(
module,
moduleGraph.getExportsInfo(module).getRestoreProvidedData()
);
});
- compilation.hooks.finishRebuildingModule.tap(PLUGIN_NAME, module => {
+ compilation.hooks.finishRebuildingModule.tap(PLUGIN_NAME, (module) => {
moduleGraph.getExportsInfo(module).restoreProvided(
/** @type {RestoreProvidedData} */
(providedExportsCache.get(module))
diff --git a/lib/FlagDependencyUsagePlugin.js b/lib/FlagDependencyUsagePlugin.js
index bce1dbe40..9f6e761f0 100644
--- a/lib/FlagDependencyUsagePlugin.js
+++ b/lib/FlagDependencyUsagePlugin.js
@@ -41,11 +41,11 @@ class FlagDependencyUsagePlugin {
* @returns {void}
*/
apply(compiler) {
- compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
+ compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
const moduleGraph = compilation.moduleGraph;
compilation.hooks.optimizeDependencies.tap(
{ name: PLUGIN_NAME, stage: STAGE_DEFAULT },
- modules => {
+ (modules) => {
if (compilation.moduleMemCaches) {
throw new Error(
"optimization.usedExports can't be used with cacheUnaffected as export usage is a global effect"
@@ -108,7 +108,7 @@ class FlagDependencyUsagePlugin {
if (nestedInfo) {
if (
exportInfo.setUsedConditionally(
- used => used === UsageState.Unused,
+ (used) => used === UsageState.Unused,
UsageState.OnlyPropertiesUsed,
runtime
)
@@ -127,7 +127,7 @@ class FlagDependencyUsagePlugin {
}
if (
exportInfo.setUsedConditionally(
- v => v !== UsageState.Used,
+ (v) => v !== UsageState.Used,
UsageState.Used,
runtime
)
diff --git a/lib/FlagEntryExportAsUsedPlugin.js b/lib/FlagEntryExportAsUsedPlugin.js
index d2826d12f..71e770d92 100644
--- a/lib/FlagEntryExportAsUsedPlugin.js
+++ b/lib/FlagEntryExportAsUsedPlugin.js
@@ -27,7 +27,7 @@ class FlagEntryExportAsUsedPlugin {
* @returns {void}
*/
apply(compiler) {
- compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => {
+ compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
const moduleGraph = compilation.moduleGraph;
compilation.hooks.seal.tap(PLUGIN_NAME, () => {
for (const [
diff --git a/lib/HotModuleReplacementPlugin.js b/lib/HotModuleReplacementPlugin.js
index 9e63892ad..9d8fd2d46 100644
--- a/lib/HotModuleReplacementPlugin.js
+++ b/lib/HotModuleReplacementPlugin.js
@@ -123,7 +123,7 @@ class HotModuleReplacementPlugin {
const { hotAcceptCallback, hotAcceptWithoutCallback } =
HotModuleReplacementPlugin.getParserHooks(parser);
- return expr => {
+ return (expr) => {
const module = parser.state.module;
const dep = new ConstDependency(
`${module.moduleArgument}.hot.accept`,
@@ -145,7 +145,7 @@ class HotModuleReplacementPlugin {
} else if (arg.isArray()) {
params =
/** @type {BasicEvaluatedExpression[]} */
- (arg.items).filter(param => param.isString());
+ (arg.items).filter((param) => param.isString());
}
/** @type {string[]} */
const requests = [];
@@ -185,7 +185,7 @@ class HotModuleReplacementPlugin {
* @param {typeof ModuleHotDeclineDependency} ParamDependency dependency
* @returns {(expr: CallExpression) => boolean | undefined} callback
*/
- const createDeclineHandler = (parser, ParamDependency) => expr => {
+ const createDeclineHandler = (parser, ParamDependency) => (expr) => {
const module = parser.state.module;
const dep = new ConstDependency(
`${module.moduleArgument}.hot.decline`,
@@ -205,7 +205,7 @@ class HotModuleReplacementPlugin {
} else if (arg.isArray()) {
params =
/** @type {BasicEvaluatedExpression[]} */
- (arg.items).filter(param => param.isString());
+ (arg.items).filter((param) => param.isString());
}
for (const [idx, param] of params.entries()) {
const dep = new ParamDependency(
@@ -225,7 +225,7 @@ class HotModuleReplacementPlugin {
* @param {JavascriptParser} parser the parser
* @returns {(expr: Expression) => boolean | undefined} callback
*/
- const createHMRExpressionHandler = parser => expr => {
+ const createHMRExpressionHandler = (parser) => (expr) => {
const module = parser.state.module;
const dep = new ConstDependency(
`${module.moduleArgument}.hot`,
@@ -243,13 +243,13 @@ class HotModuleReplacementPlugin {
* @param {JavascriptParser} parser the parser
* @returns {void}
*/
- const applyModuleHot = parser => {
+ const applyModuleHot = (parser) => {
parser.hooks.evaluateIdentifier.for("module.hot").tap(
{
name: PLUGIN_NAME,
before: "NodeStuffPlugin"
},
- expr =>
+ (expr) =>
evaluateToIdentifier(
"module.hot",
"module",
@@ -278,10 +278,10 @@ class HotModuleReplacementPlugin {
* @param {JavascriptParser} parser the parser
* @returns {void}
*/
- const applyImportMetaHot = parser => {
+ const applyImportMetaHot = (parser) => {
parser.hooks.evaluateIdentifier
.for("import.meta.webpackHot")
- .tap(PLUGIN_NAME, expr =>
+ .tap(PLUGIN_NAME, (expr) =>
evaluateToIdentifier(
"import.meta.webpackHot",
"import.meta",
@@ -381,7 +381,7 @@ class HotModuleReplacementPlugin {
chunk,
compareModulesById(chunkGraph)
),
- m => /** @type {ModuleId} */ (chunkGraph.getModuleId(m))
+ (m) => /** @type {ModuleId} */ (chunkGraph.getModuleId(m))
);
}
});
@@ -391,7 +391,7 @@ class HotModuleReplacementPlugin {
const fullHashModules = new TupleSet();
/** @type {TupleSet} */
const nonCodeGeneratedModules = new TupleSet();
- compilation.hooks.fullHash.tap(PLUGIN_NAME, hash => {
+ compilation.hooks.fullHash.tap(PLUGIN_NAME, (hash) => {
const chunkGraph = compilation.chunkGraph;
const records = /** @type {Records} */ (compilation.records);
for (const chunk of compilation.chunks) {
@@ -399,7 +399,7 @@ class HotModuleReplacementPlugin {
* @param {Module} module module
* @returns {string} module hash
*/
- const getModuleHash = module => {
+ const getModuleHash = (module) => {
if (
compilation.codeGenerationResults.has(module, chunk.runtime)
) {
@@ -524,7 +524,7 @@ class HotModuleReplacementPlugin {
const runtime = keyToRuntime(chunkRuntime[key]);
allOldRuntime = mergeRuntimeOwned(allOldRuntime, runtime);
}
- forEachRuntime(allOldRuntime, runtime => {
+ forEachRuntime(allOldRuntime, (runtime) => {
const { path: filename, info: assetInfo } =
compilation.getPathWithInfo(
/** @type {NonNullable} */
@@ -588,7 +588,7 @@ class HotModuleReplacementPlugin {
let removedFromRuntime;
const currentChunk = find(
compilation.chunks,
- chunk => `${chunk.id}` === key
+ (chunk) => `${chunk.id}` === key
);
if (currentChunk) {
chunkId = currentChunk.id;
@@ -599,22 +599,22 @@ class HotModuleReplacementPlugin {
if (newRuntime === undefined) continue;
newModules = chunkGraph
.getChunkModules(currentChunk)
- .filter(module => updatedModules.has(module, currentChunk));
+ .filter((module) => updatedModules.has(module, currentChunk));
newRuntimeModules = [
...chunkGraph.getChunkRuntimeModulesIterable(currentChunk)
- ].filter(module => updatedModules.has(module, currentChunk));
+ ].filter((module) => updatedModules.has(module, currentChunk));
const fullHashModules =
chunkGraph.getChunkFullHashModulesIterable(currentChunk);
newFullHashModules =
fullHashModules &&
- [...fullHashModules].filter(module =>
+ [...fullHashModules].filter((module) =>
updatedModules.has(module, currentChunk)
);
const dependentHashModules =
chunkGraph.getChunkDependentHashModulesIterable(currentChunk);
newDependentHashModules =
dependentHashModules &&
- [...dependentHashModules].filter(module =>
+ [...dependentHashModules].filter((module) =>
updatedModules.has(module, currentChunk)
);
removedFromRuntime = subtractRuntime(oldRuntime, newRuntime);
@@ -626,7 +626,7 @@ class HotModuleReplacementPlugin {
}
if (removedFromRuntime) {
// chunk was removed from some runtimes
- forEachRuntime(removedFromRuntime, runtime => {
+ forEachRuntime(removedFromRuntime, (runtime) => {
const item =
/** @type {HotUpdateMainContentByRuntimeItem} */
(
@@ -665,7 +665,7 @@ class HotModuleReplacementPlugin {
// module is no longer in this runtime combination
// We (incorrectly) assume that it's not in an overlapping runtime combination
// and dispose it from the main runtimes the chunk was removed from
- forEachRuntime(removedFromRuntime, runtime => {
+ forEachRuntime(removedFromRuntime, (runtime) => {
// If the module is still used in this runtime, do not dispose it
// This could create a bad runtime state where the module is still loaded,
// but no chunk which contains it. This means we don't receive further HMR updates
@@ -764,7 +764,7 @@ class HotModuleReplacementPlugin {
compilation.hooks.chunkAsset.call(currentChunk, filename);
}
}
- forEachRuntime(newRuntime, runtime => {
+ forEachRuntime(newRuntime, (runtime) => {
const item =
/** @type {HotUpdateMainContentByRuntimeItem} */ (
hotUpdateMainContentByRuntime.get(
@@ -829,7 +829,7 @@ To fix this, make sure to include [runtime] in the output.hotUpdateMainFilename
...completelyRemovedModulesArray,
...Array.from(
removedModules,
- m =>
+ (m) =>
/** @type {ModuleId} */ (chunkGraph.getModuleId(m))
)
]
@@ -863,28 +863,28 @@ To fix this, make sure to include [runtime] in the output.hotUpdateMainFilename
normalModuleFactory.hooks.parser
.for(JAVASCRIPT_MODULE_TYPE_AUTO)
- .tap(PLUGIN_NAME, parser => {
+ .tap(PLUGIN_NAME, (parser) => {
applyModuleHot(parser);
applyImportMetaHot(parser);
});
normalModuleFactory.hooks.parser
.for(JAVASCRIPT_MODULE_TYPE_DYNAMIC)
- .tap(PLUGIN_NAME, parser => {
+ .tap(PLUGIN_NAME, (parser) => {
applyModuleHot(parser);
});
normalModuleFactory.hooks.parser
.for(JAVASCRIPT_MODULE_TYPE_ESM)
- .tap(PLUGIN_NAME, parser => {
+ .tap(PLUGIN_NAME, (parser) => {
applyImportMetaHot(parser);
});
- normalModuleFactory.hooks.module.tap(PLUGIN_NAME, module => {
+ normalModuleFactory.hooks.module.tap(PLUGIN_NAME, (module) => {
module.hot = true;
return module;
});
NormalModule.getCompilationHooks(compilation).loader.tap(
PLUGIN_NAME,
- context => {
+ (context) => {
context.hot = true;
}
);
diff --git a/lib/IgnorePlugin.js b/lib/IgnorePlugin.js
index 004aa8d8c..310af5ee2 100644
--- a/lib/IgnorePlugin.js
+++ b/lib/IgnorePlugin.js
@@ -71,8 +71,8 @@ class IgnorePlugin {
* @returns {void}
*/
apply(compiler) {
- compiler.hooks.normalModuleFactory.tap(PLUGIN_NAME, nmf => {
- nmf.hooks.beforeResolve.tap(PLUGIN_NAME, resolveData => {
+ compiler.hooks.normalModuleFactory.tap(PLUGIN_NAME, (nmf) => {
+ nmf.hooks.beforeResolve.tap(PLUGIN_NAME, (resolveData) => {
const result = this.checkIgnore(resolveData);
if (
@@ -93,7 +93,7 @@ class IgnorePlugin {
return result;
});
});
- compiler.hooks.contextModuleFactory.tap(PLUGIN_NAME, cmf => {
+ compiler.hooks.contextModuleFactory.tap(PLUGIN_NAME, (cmf) => {
cmf.hooks.beforeResolve.tap(PLUGIN_NAME, this.checkIgnore);
});
}
diff --git a/lib/IgnoreWarningsPlugin.js b/lib/IgnoreWarningsPlugin.js
index 5518b648d..de5fd35e2 100644
--- a/lib/IgnoreWarningsPlugin.js
+++ b/lib/IgnoreWarningsPlugin.js
@@ -24,11 +24,11 @@ class IgnoreWarningsPlugin {
* @returns {void}
*/
apply(compiler) {
- compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
- compilation.hooks.processWarnings.tap(PLUGIN_NAME, warnings =>
+ compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
+ compilation.hooks.processWarnings.tap(PLUGIN_NAME, (warnings) =>
warnings.filter(
- warning =>
- !this._ignoreWarnings.some(ignore => ignore(warning, compilation))
+ (warning) =>
+ !this._ignoreWarnings.some((ignore) => ignore(warning, compilation))
)
);
});
diff --git a/lib/InvalidDependenciesModuleWarning.js b/lib/InvalidDependenciesModuleWarning.js
index b77d991b3..7fb7d3c6c 100644
--- a/lib/InvalidDependenciesModuleWarning.js
+++ b/lib/InvalidDependenciesModuleWarning.js
@@ -18,7 +18,7 @@ class InvalidDependenciesModuleWarning extends WebpackError {
*/
constructor(module, deps) {
const orderedDeps = deps ? [...deps].sort() : [];
- const depsList = orderedDeps.map(dep => ` * ${JSON.stringify(dep)}`);
+ const depsList = orderedDeps.map((dep) => ` * ${JSON.stringify(dep)}`);
super(`Invalid dependencies have been reported by plugins or loaders for this module. All reported dependencies need to be absolute paths.
Invalid dependencies may lead to broken watching and caching.
As best effort we try to convert all invalid values to absolute paths and converting globs into context dependencies, but this is deprecated behavior.
diff --git a/lib/JavascriptMetaInfoPlugin.js b/lib/JavascriptMetaInfoPlugin.js
index 35fcb68c1..e3d9ffa8b 100644
--- a/lib/JavascriptMetaInfoPlugin.js
+++ b/lib/JavascriptMetaInfoPlugin.js
@@ -32,7 +32,7 @@ class JavascriptMetaInfoPlugin {
* @param {JavascriptParser} parser the parser
* @returns {void}
*/
- const handler = parser => {
+ const handler = (parser) => {
parser.hooks.call.for("eval").tap(PLUGIN_NAME, () => {
const buildInfo =
/** @type {BuildInfo} */
diff --git a/lib/LibManifestPlugin.js b/lib/LibManifestPlugin.js
index b364564dd..4d6a1e8e1 100644
--- a/lib/LibManifestPlugin.js
+++ b/lib/LibManifestPlugin.js
@@ -86,7 +86,7 @@ class LibManifestPlugin {
this.options.entryOnly &&
!someInIterable(
moduleGraph.getIncomingConnections(module),
- c => c.dependency instanceof EntryDependency
+ (c) => c.dependency instanceof EntryDependency
)
) {
continue;
@@ -129,7 +129,7 @@ class LibManifestPlugin {
mkdirp(
intermediateFileSystem,
dirname(intermediateFileSystem, targetPath),
- err => {
+ (err) => {
if (err) return callback(err);
intermediateFileSystem.writeFile(targetPath, buffer, callback);
}
diff --git a/lib/LoaderOptionsPlugin.js b/lib/LoaderOptionsPlugin.js
index 2d5ae8847..4c803f92e 100644
--- a/lib/LoaderOptionsPlugin.js
+++ b/lib/LoaderOptionsPlugin.js
@@ -59,7 +59,7 @@ class LoaderOptionsPlugin {
*/
apply(compiler) {
const options = this.options;
- compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
+ compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
NormalModule.getCompilationHooks(compilation).loader.tap(
PLUGIN_NAME,
(context, module) => {
diff --git a/lib/LoaderTargetPlugin.js b/lib/LoaderTargetPlugin.js
index e6ea9810d..8f3664122 100644
--- a/lib/LoaderTargetPlugin.js
+++ b/lib/LoaderTargetPlugin.js
@@ -25,10 +25,10 @@ class LoaderTargetPlugin {
* @returns {void}
*/
apply(compiler) {
- compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
+ compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
NormalModule.getCompilationHooks(compilation).loader.tap(
PLUGIN_NAME,
- loaderContext => {
+ (loaderContext) => {
loaderContext.target = this.target;
}
);
diff --git a/lib/MainTemplate.js b/lib/MainTemplate.js
index 599f4fe1c..a793b1a83 100644
--- a/lib/MainTemplate.js
+++ b/lib/MainTemplate.js
@@ -323,7 +323,7 @@ class MainTemplate {
/**
* @param {PathData} options context data
* @returns {string} interpolated path
- */ options =>
+ */ (options) =>
compilation.getAssetPath(
/** @type {string} */
(compilation.outputOptions.publicPath),
diff --git a/lib/Module.js b/lib/Module.js
index 9e325a250..899b26a84 100644
--- a/lib/Module.js
+++ b/lib/Module.js
@@ -775,7 +775,7 @@ class Module extends DependenciesBlock {
fromModule,
connections
] of moduleGraph.getIncomingConnectionsByOriginModule(this)) {
- if (!connections.some(c => c.isTargetActive(chunk.runtime))) continue;
+ if (!connections.some((c) => c.isTargetActive(chunk.runtime))) continue;
for (const originChunk of chunkGraph.getModuleChunksIterable(
/** @type {Module} */ (fromModule)
)) {
diff --git a/lib/ModuleFilenameHelpers.js b/lib/ModuleFilenameHelpers.js
index 0abb1220e..0ef302e13 100644
--- a/lib/ModuleFilenameHelpers.js
+++ b/lib/ModuleFilenameHelpers.js
@@ -96,13 +96,13 @@ const getHash =
* @param {Record T>} obj the object to convert to a lazy access object
* @returns {T} the lazy access object
*/
-const lazyObject = obj => {
+const lazyObject = (obj) => {
const newObj = /** @type {T} */ ({});
for (const key of Object.keys(obj)) {
const fn = obj[key];
Object.defineProperty(newObj, key, {
get: () => fn(),
- set: v => {
+ set: (v) => {
Object.defineProperty(newObj, key, {
value: v,
enumerable: true,
@@ -320,7 +320,7 @@ ModuleFilenameHelpers.replaceDuplicates = (array, fn, comparator) => {
const matchPart = (str, test) => {
if (!test) return true;
if (Array.isArray(test)) {
- return test.some(test => matchPart(str, test));
+ return test.some((test) => matchPart(str, test));
}
if (typeof test === "string") {
return str.startsWith(test);
diff --git a/lib/ModuleGraph.js b/lib/ModuleGraph.js
index 554bbde04..2ebcebd61 100644
--- a/lib/ModuleGraph.js
+++ b/lib/ModuleGraph.js
@@ -36,7 +36,7 @@ const EMPTY_SET = new Set();
* @param {SortableSet} set input
* @returns {readonly Map} mapped by origin module
*/
-const getConnectionsByOriginModule = set => {
+const getConnectionsByOriginModule = (set) => {
const map = new Map();
/** @type {Module | 0} */
let lastModule = 0;
@@ -67,7 +67,7 @@ const getConnectionsByOriginModule = set => {
* @param {SortableSet} set input
* @returns {readonly Map} mapped by module
*/
-const getConnectionsByModule = set => {
+const getConnectionsByModule = (set) => {
const map = new Map();
/** @type {Module | 0} */
let lastModule = 0;
@@ -956,7 +956,7 @@ class ModuleGraph {
* @param {Module} module the module
* @returns {ModuleGraph} the module graph
*/
- module => {
+ (module) => {
const moduleGraph = moduleGraphForModuleMap.get(module);
if (!moduleGraph) {
throw new Error(
diff --git a/lib/ModuleInfoHeaderPlugin.js b/lib/ModuleInfoHeaderPlugin.js
index 58ad847d3..5aecdb2ca 100644
--- a/lib/ModuleInfoHeaderPlugin.js
+++ b/lib/ModuleInfoHeaderPlugin.js
@@ -26,7 +26,7 @@ const JavascriptModulesPlugin = require("./javascript/JavascriptModulesPlugin");
* @param {Iterable} iterable iterable
* @returns {string} joined with comma
*/
-const joinIterableWithComma = iterable => {
+const joinIterableWithComma = (iterable) => {
// This is more performant than Array.from().join(", ")
// as it doesn't create an array
let str = "";
@@ -94,7 +94,7 @@ const printExportsInfoToSource = (
? ` -> ${target.module.readableIdentifier(requestShortener)}${
target.export
? ` .${target.export
- .map(e => JSON.stringify(e).slice(1, -1))
+ .map((e) => JSON.stringify(e).slice(1, -1))
.join(".")}`
: ""
}`
@@ -165,7 +165,7 @@ class ModuleInfoHeaderPlugin {
*/
apply(compiler) {
const { _verbose: verbose } = this;
- compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
+ compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
const javascriptHooks =
JavascriptModulesPlugin.getCompilationHooks(compilation);
javascriptHooks.renderModulePackage.tap(
diff --git a/lib/ModuleParseError.js b/lib/ModuleParseError.js
index dae44e058..54774bb57 100644
--- a/lib/ModuleParseError.js
+++ b/lib/ModuleParseError.js
@@ -43,7 +43,7 @@ class ModuleParseError extends WebpackError {
"\nYou may need an appropriate loader to handle this file type.";
} else if (loaders.length >= 1) {
message += `\nFile was processed with these loaders:${loaders
- .map(loader => `\n * ${loader}`)
+ .map((loader) => `\n * ${loader}`)
.join("")}`;
message +=
"\nYou may need an additional loader to handle the result of these loaders.";
@@ -75,8 +75,10 @@ class ModuleParseError extends WebpackError {
const linesAfter = sourceLines.slice(lineNumber, lineNumber + 2);
message += `${linesBefore
- .map(l => `\n| ${l}`)
- .join("")}\n> ${theLine}${linesAfter.map(l => `\n| ${l}`).join("")}`;
+ .map((l) => `\n| ${l}`)
+ .join(
+ ""
+ )}\n> ${theLine}${linesAfter.map((l) => `\n| ${l}`).join("")}`;
}
loc = { start: err.loc };
diff --git a/lib/MultiCompiler.js b/lib/MultiCompiler.js
index 6e0c4e9f0..dfec39920 100644
--- a/lib/MultiCompiler.js
+++ b/lib/MultiCompiler.js
@@ -54,7 +54,7 @@ module.exports = class MultiCompiler {
constructor(compilers, options) {
if (!Array.isArray(compilers)) {
/** @type {Compiler[]} */
- compilers = Object.keys(compilers).map(name => {
+ compilers = Object.keys(compilers).map((name) => {
/** @type {Record} */
(compilers)[name].name = name;
return /** @type {Record} */ (compilers)[name];
@@ -65,16 +65,16 @@ module.exports = class MultiCompiler {
/** @type {SyncHook<[MultiStats]>} */
done: new SyncHook(["stats"]),
/** @type {MultiHook>} */
- invalid: new MultiHook(compilers.map(c => c.hooks.invalid)),
+ invalid: new MultiHook(compilers.map((c) => c.hooks.invalid)),
/** @type {MultiHook>} */
- run: new MultiHook(compilers.map(c => c.hooks.run)),
+ run: new MultiHook(compilers.map((c) => c.hooks.run)),
/** @type {SyncHook<[]>} */
watchClose: new SyncHook([]),
/** @type {MultiHook>} */
- watchRun: new MultiHook(compilers.map(c => c.hooks.watchRun)),
+ watchRun: new MultiHook(compilers.map((c) => c.hooks.watchRun)),
/** @type {MultiHook>} */
infrastructureLog: new MultiHook(
- compilers.map(c => c.hooks.infrastructureLog)
+ compilers.map((c) => c.hooks.infrastructureLog)
)
});
this.compilers = compilers;
@@ -94,7 +94,7 @@ module.exports = class MultiCompiler {
const compilerIndex = index;
let compilerDone = false;
// eslint-disable-next-line no-loop-func
- compiler.hooks.done.tap(CLASS_NAME, stats => {
+ compiler.hooks.done.tap(CLASS_NAME, (stats) => {
if (!compilerDone) {
compilerDone = true;
doneCompilers++;
@@ -124,7 +124,7 @@ module.exports = class MultiCompiler {
* @param {WebpackError} warning warning
*/
const addWarning = (compiler, warning) => {
- compiler.hooks.thisCompilation.tap(CLASS_NAME, compilation => {
+ compiler.hooks.thisCompilation.tap(CLASS_NAME, (compilation) => {
compilation.warnings.push(warning);
});
};
@@ -152,7 +152,7 @@ module.exports = class MultiCompiler {
get options() {
return Object.assign(
- this.compilers.map(c => c.options),
+ this.compilers.map((c) => c.options),
this._options
);
}
@@ -254,7 +254,7 @@ module.exports = class MultiCompiler {
* @param {Compiler} compiler compiler
* @returns {boolean} target was found
*/
- const targetFound = compiler => {
+ const targetFound = (compiler) => {
for (const edge of edges) {
if (edge.target === compiler) {
return true;
@@ -276,7 +276,7 @@ module.exports = class MultiCompiler {
const dependencies = this.dependencies.get(source);
if (dependencies) {
for (const dep of dependencies) {
- const target = this.compilers.find(c => c.name === dep);
+ const target = this.compilers.find((c) => c.name === dep);
if (!target) {
missing.push(dep);
} else {
@@ -289,8 +289,10 @@ module.exports = class MultiCompiler {
}
}
/** @type {string[]} */
- const errors = missing.map(m => `Compiler dependency \`${m}\` not found.`);
- const stack = this.compilers.filter(c => !targetFound(c));
+ const errors = missing.map(
+ (m) => `Compiler dependency \`${m}\` not found.`
+ );
+ const stack = this.compilers.filter((c) => !targetFound(c));
while (stack.length > 0) {
const current = stack.pop();
for (const edge of edges) {
@@ -307,7 +309,7 @@ module.exports = class MultiCompiler {
/** @type {string[]} */
const lines = [...edges]
.sort(sortEdges)
- .map(edge => `${edge.source.name} -> ${edge.target.name}`);
+ .map((edge) => `${edge.source.name} -> ${edge.target.name}`);
lines.unshift("Circular dependency found in compiler dependencies.");
errors.unshift(lines.join("\n"));
}
@@ -334,7 +336,7 @@ module.exports = class MultiCompiler {
* @param {string} d dependency
* @returns {boolean} when dependency was fulfilled
*/
- const isDependencyFulfilled = d => fulfilledNames.has(d);
+ const isDependencyFulfilled = (d) => fulfilledNames.has(d);
/**
* @returns {Compiler[]} compilers
*/
@@ -358,12 +360,12 @@ module.exports = class MultiCompiler {
* @param {Callback} callback callback
* @returns {void}
*/
- const runCompilers = callback => {
+ const runCompilers = (callback) => {
if (remainingCompilers.length === 0) return callback(null);
asyncLib.map(
getReadyCompilers(),
(compiler, callback) => {
- fn(compiler, err => {
+ fn(compiler, (err) => {
if (err) return callback(err);
fulfilledNames.add(compiler.name);
runCompilers(callback);
@@ -400,7 +402,7 @@ module.exports = class MultiCompiler {
// running-outdated -> blocked [running--] (when compilation is done)
/** @type {Node[]} */
- const nodes = this.compilers.map(compiler => ({
+ const nodes = this.compilers.map((compiler) => ({
compiler,
setupResult: undefined,
result: undefined,
@@ -472,7 +474,7 @@ module.exports = class MultiCompiler {
* @param {Node} node node
* @returns {void}
*/
- const nodeInvalidFromParent = node => {
+ const nodeInvalidFromParent = (node) => {
if (node.state === "done") {
node.state = "blocked";
} else if (node.state === "running") {
@@ -486,7 +488,7 @@ module.exports = class MultiCompiler {
* @param {Node} node node
* @returns {void}
*/
- const nodeInvalid = node => {
+ const nodeInvalid = (node) => {
if (node.state === "done") {
node.state = "pending";
} else if (node.state === "running") {
@@ -500,7 +502,7 @@ module.exports = class MultiCompiler {
* @param {Node} node node
* @returns {void}
*/
- const nodeChange = node => {
+ const nodeChange = (node) => {
nodeInvalid(node);
if (node.state === "pending") {
node.state = "blocked";
@@ -538,7 +540,7 @@ module.exports = class MultiCompiler {
if (
node.state === "queued" ||
(node.state === "blocked" &&
- node.parents.every(p => p.state === "done"))
+ node.parents.every((p) => p.state === "done"))
) {
running++;
node.state = "starting";
@@ -554,7 +556,7 @@ module.exports = class MultiCompiler {
if (
!errored &&
running === 0 &&
- nodes.every(node => node.state === "done")
+ nodes.every((node) => node.state === "done")
) {
const stats = [];
for (const node of nodes) {
@@ -653,7 +655,7 @@ module.exports = class MultiCompiler {
(compiler, callback) => {
compiler.close(callback);
},
- error => {
+ (error) => {
callback(error);
}
);
diff --git a/lib/MultiStats.js b/lib/MultiStats.js
index 73ab80794..50571cdf4 100644
--- a/lib/MultiStats.js
+++ b/lib/MultiStats.js
@@ -36,21 +36,21 @@ class MultiStats {
}
get hash() {
- return this.stats.map(stat => stat.hash).join("");
+ return this.stats.map((stat) => stat.hash).join("");
}
/**
* @returns {boolean} true if a child compilation encountered an error
*/
hasErrors() {
- return this.stats.some(stat => stat.hasErrors());
+ return this.stats.some((stat) => stat.hasErrors());
}
/**
* @returns {boolean} true if a child compilation had a warning
*/
hasWarnings() {
- return this.stats.some(stat => stat.hasWarnings());
+ return this.stats.some((stat) => stat.hasWarnings());
}
/**
@@ -93,12 +93,12 @@ class MultiStats {
);
});
return {
- version: children.every(o => o.version),
- hash: children.every(o => o.hash),
- errorsCount: children.every(o => o.errorsCount),
- warningsCount: children.every(o => o.warningsCount),
- errors: children.every(o => o.errors),
- warnings: children.every(o => o.warnings),
+ version: children.every((o) => o.version),
+ hash: children.every((o) => o.hash),
+ errorsCount: children.every((o) => o.errorsCount),
+ warningsCount: children.every((o) => o.warningsCount),
+ errors: children.every((o) => o.errors),
+ warnings: children.every((o) => o.warnings),
children
};
}
@@ -130,7 +130,7 @@ class MultiStats {
obj.version = obj.children[0].version;
}
if (childOptions.hash) {
- obj.hash = obj.children.map(j => j.hash).join("");
+ obj.hash = obj.children.map((j) => j.hash).join("");
}
/**
* @param {StatsCompilation} j stats error
diff --git a/lib/MultiWatching.js b/lib/MultiWatching.js
index cfe95f17b..448ac9620 100644
--- a/lib/MultiWatching.js
+++ b/lib/MultiWatching.js
@@ -67,7 +67,7 @@ class MultiWatching {
(watching, finishedCallback) => {
watching.close(finishedCallback);
},
- err => {
+ (err) => {
this.compiler.hooks.watchClose.call();
if (typeof callback === "function") {
this.compiler.running = false;
diff --git a/lib/NoEmitOnErrorsPlugin.js b/lib/NoEmitOnErrorsPlugin.js
index dfcde9309..f0a7f0033 100644
--- a/lib/NoEmitOnErrorsPlugin.js
+++ b/lib/NoEmitOnErrorsPlugin.js
@@ -16,10 +16,10 @@ class NoEmitOnErrorsPlugin {
* @returns {void}
*/
apply(compiler) {
- compiler.hooks.shouldEmit.tap(PLUGIN_NAME, compilation => {
+ compiler.hooks.shouldEmit.tap(PLUGIN_NAME, (compilation) => {
if (compilation.getStats().hasErrors()) return false;
});
- compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
+ compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
compilation.hooks.shouldRecord.tap(PLUGIN_NAME, () => {
if (compilation.getStats().hasErrors()) return false;
});
diff --git a/lib/NodeStuffPlugin.js b/lib/NodeStuffPlugin.js
index 87a5cd614..a5a794135 100644
--- a/lib/NodeStuffPlugin.js
+++ b/lib/NodeStuffPlugin.js
@@ -74,7 +74,7 @@ class NodeStuffPlugin {
if (localOptions.global !== false) {
const withWarning = localOptions.global === "warn";
- parser.hooks.expression.for("global").tap(PLUGIN_NAME, expr => {
+ parser.hooks.expression.for("global").tap(PLUGIN_NAME, (expr) => {
const dep = new ConstDependency(
RuntimeGlobals.global,
/** @type {Range} */ (expr.range),
@@ -94,7 +94,7 @@ class NodeStuffPlugin {
);
}
});
- parser.hooks.rename.for("global").tap(PLUGIN_NAME, expr => {
+ parser.hooks.rename.for("global").tap(PLUGIN_NAME, (expr) => {
const dep = new ConstDependency(
RuntimeGlobals.global,
/** @type {Range} */ (expr.range),
@@ -115,7 +115,7 @@ class NodeStuffPlugin {
const setModuleConstant = (expressionName, fn, warning) => {
parser.hooks.expression
.for(expressionName)
- .tap(PLUGIN_NAME, expr => {
+ .tap(PLUGIN_NAME, (expr) => {
const dep = new CachedConstDependency(
JSON.stringify(fn(parser.state.module)),
/** @type {Range} */ (expr.range),
@@ -143,7 +143,7 @@ class NodeStuffPlugin {
const setUrlModuleConstant = (expressionName, fn) => {
parser.hooks.expression
.for(expressionName)
- .tap(PLUGIN_NAME, expr => {
+ .tap(PLUGIN_NAME, (expr) => {
const dep = new ExternalModuleDependency(
"url",
[
@@ -189,11 +189,11 @@ class NodeStuffPlugin {
case "node-module":
setUrlModuleConstant(
"__filename",
- functionName => `${functionName}(import.meta.url)`
+ (functionName) => `${functionName}(import.meta.url)`
);
break;
case true:
- setModuleConstant("__filename", module =>
+ setModuleConstant("__filename", (module) =>
relative(
/** @type {InputFileSystem} */ (compiler.inputFileSystem),
context,
@@ -205,7 +205,7 @@ class NodeStuffPlugin {
parser.hooks.evaluateIdentifier
.for("__filename")
- .tap(PLUGIN_NAME, expr => {
+ .tap(PLUGIN_NAME, (expr) => {
if (!parser.state.module) return;
const resource = parseResource(parser.state.module.resource);
return evaluateToString(resource.path)(expr);
@@ -226,12 +226,12 @@ class NodeStuffPlugin {
case "node-module":
setUrlModuleConstant(
"__dirname",
- functionName =>
+ (functionName) =>
`${functionName}(import.meta.url + "/..").slice(0, -1)`
);
break;
case true:
- setModuleConstant("__dirname", module =>
+ setModuleConstant("__dirname", (module) =>
relative(
/** @type {InputFileSystem} */ (compiler.inputFileSystem),
context,
@@ -243,7 +243,7 @@ class NodeStuffPlugin {
parser.hooks.evaluateIdentifier
.for("__dirname")
- .tap(PLUGIN_NAME, expr => {
+ .tap(PLUGIN_NAME, (expr) => {
if (!parser.state.module) return;
return evaluateToString(
/** @type {string} */ (parser.state.module.context)
diff --git a/lib/NormalModule.js b/lib/NormalModule.js
index 20ff21b3b..f9d4c2d95 100644
--- a/lib/NormalModule.js
+++ b/lib/NormalModule.js
@@ -163,17 +163,17 @@ const contextifySourceMap = (context, sourceMap, associatedObjectForCache) => {
const { sourceRoot } = sourceMap;
/** @type {(source: string) => string} */
const mapper = !sourceRoot
- ? source => source
+ ? (source) => source
: sourceRoot.endsWith("/")
- ? source =>
+ ? (source) =>
source.startsWith("/")
? `${sourceRoot.slice(0, -1)}${source}`
: `${sourceRoot}${source}`
- : source =>
+ : (source) =>
source.startsWith("/")
? `${sourceRoot}${source}`
: `${sourceRoot}/${source}`;
- const newSources = sourceMap.sources.map(source =>
+ const newSources = sourceMap.sources.map((source) =>
contextifySourceUrl(context, mapper(source), associatedObjectForCache)
);
return {
@@ -188,7 +188,7 @@ const contextifySourceMap = (context, sourceMap, associatedObjectForCache) => {
* @param {string | Buffer} input the input
* @returns {string} the converted string
*/
-const asString = input => {
+const asString = (input) => {
if (Buffer.isBuffer(input)) {
return input.toString("utf8");
}
@@ -199,7 +199,7 @@ const asString = input => {
* @param {string | Buffer} input the input
* @returns {Buffer} the converted buffer
*/
-const asBuffer = input => {
+const asBuffer = (input) => {
if (!Buffer.isBuffer(input)) {
return Buffer.from(input, "utf8");
}
@@ -279,14 +279,14 @@ class NormalModule extends Module {
beforeParse: new SyncHook(["module"]),
beforeSnapshot: new SyncHook(["module"]),
// TODO webpack 6 deprecate
- readResourceForScheme: new HookMap(scheme => {
+ readResourceForScheme: new HookMap((scheme) => {
const hook =
/** @type {NormalModuleCompilationHooks} */
(hooks).readResource.for(scheme);
return createFakeHook(
/** @type {AsyncSeriesBailHook<[string, NormalModule], string | Buffer | null>} */ ({
tap: (options, fn) =>
- hook.tap(options, loaderContext =>
+ hook.tap(options, (loaderContext) =>
fn(
loaderContext.resource,
/** @type {NormalModule} */ (loaderContext._module)
@@ -301,7 +301,7 @@ class NormalModule extends Module {
)
),
tapPromise: (options, fn) =>
- hook.tapPromise(options, loaderContext =>
+ hook.tapPromise(options, (loaderContext) =>
fn(
loaderContext.resource,
/** @type {NormalModule} */ (loaderContext._module)
@@ -599,19 +599,19 @@ class NormalModule extends Module {
*/
const getResolveContext = () => ({
fileDependencies: {
- add: d =>
+ add: (d) =>
/** @type {LoaderContext} */ (
loaderContext
).addDependency(d)
},
contextDependencies: {
- add: d =>
+ add: (d) =>
/** @type {LoaderContext} */ (
loaderContext
).addContextDependency(d)
},
missingDependencies: {
- add: d =>
+ add: (d) =>
/** @type {LoaderContext} */ (
loaderContext
).addMissingDependency(d)
@@ -660,7 +660,7 @@ class NormalModule extends Module {
* @param {HashFunction=} type type
* @returns {Hash} hash
*/
- createHash: type =>
+ createHash: (type) =>
createHash(
type ||
/** @type {HashFunction} */
@@ -674,7 +674,7 @@ class NormalModule extends Module {
* @param {import("../declarations/LoaderContext").Schema=} schema schema
* @returns {T} options
*/
- getOptions: schema => {
+ getOptions: (schema) => {
const loader = this.getCurrentLoader(
/** @type {LoaderContext} */ (loaderContext)
);
@@ -716,7 +716,7 @@ class NormalModule extends Module {
return /** @type {T} */ (options);
},
- emitWarning: warning => {
+ emitWarning: (warning) => {
if (!(warning instanceof Error)) {
warning = new NonErrorEmittedError(warning);
}
@@ -726,7 +726,7 @@ class NormalModule extends Module {
})
);
},
- emitError: error => {
+ emitError: (error) => {
if (!(error instanceof Error)) {
error = new NonErrorEmittedError(error);
}
@@ -736,7 +736,7 @@ class NormalModule extends Module {
})
);
},
- getLogger: name => {
+ getLogger: (name) => {
const currentLoader = this.getCurrentLoader(
/** @type {LoaderContext} */ (loaderContext)
);
@@ -802,7 +802,7 @@ class NormalModule extends Module {
);
assetsInfo.set(name, assetInfo);
},
- addBuildDependency: dep => {
+ addBuildDependency: (dep) => {
const buildInfo = /** @type {BuildInfo} */ (this.buildInfo);
if (buildInfo.buildDependencies === undefined) {
@@ -1190,7 +1190,7 @@ class NormalModule extends Module {
const hooks = NormalModule.getCompilationHooks(compilation);
- return this._doBuild(options, compilation, resolver, fs, hooks, err => {
+ return this._doBuild(options, compilation, resolver, fs, hooks, (err) => {
// if we have an error mark module as failed and exit
if (err) {
this.markModuleAsErrored(err);
@@ -1202,9 +1202,9 @@ class NormalModule extends Module {
* @param {Error} e error
* @returns {void}
*/
- const handleParseError = e => {
+ const handleParseError = (e) => {
const source = /** @type {Source} */ (this._source).source();
- const loaders = this.loaders.map(item =>
+ const loaders = this.loaders.map((item) =>
contextify(
/** @type {string} */ (options.context),
item.loader,
@@ -1220,7 +1220,7 @@ class NormalModule extends Module {
const handleParseResult = () => {
this.dependencies.sort(
concatComparators(
- compareSelect(a => a.loc, compareLocations),
+ compareSelect((a) => a.loc, compareLocations),
keepOriginalOrder(this.dependencies)
)
);
@@ -1252,7 +1252,7 @@ class NormalModule extends Module {
/**
* @param {LazySet} deps deps
*/
- const checkDependencies = deps => {
+ const checkDependencies = (deps) => {
for (const dep of deps) {
if (!ABSOLUTE_PATH_REGEX.test(dep)) {
if (nonAbsoluteDependencies === undefined) {
diff --git a/lib/NormalModuleFactory.js b/lib/NormalModuleFactory.js
index c585ace43..93dc8129b 100644
--- a/lib/NormalModuleFactory.js
+++ b/lib/NormalModuleFactory.js
@@ -124,7 +124,7 @@ const LEADING_DOT_EXTENSION_REGEX = /^[^.]/;
* @param {LoaderItem} data data
* @returns {string} ident
*/
-const loaderToIdent = data => {
+const loaderToIdent = (data) => {
if (!data.options) {
return data.loader;
}
@@ -158,7 +158,7 @@ const stringifyLoadersAndResource = (loaders, resource) => {
* @param {(err?: null | Error) => void} callback callback
* @returns {(err?: null | Error) => void} callback
*/
-const needCalls = (times, callback) => err => {
+const needCalls = (times, callback) => (err) => {
if (--times === 0) {
return callback(err);
}
@@ -204,7 +204,7 @@ const mergeGlobalOptions = (globalOptions, type, localOptions) => {
* @returns {string} result
*/
const deprecationChangedHookMessage = (name, hook) => {
- const names = hook.taps.map(tapped => tapped.name).join(", ");
+ const names = hook.taps.map((tapped) => tapped.name).join(", ");
return (
`NormalModuleFactory.${name} (${names}) is no longer a waterfall hook, but a bailing hook instead. ` +
@@ -227,7 +227,7 @@ const ruleSetCompiler = new RuleSetCompiler([
new BasicMatcherRulePlugin("issuer"),
new BasicMatcherRulePlugin("compiler"),
new BasicMatcherRulePlugin("issuerLayer"),
- new ObjectMatcherRulePlugin("assert", "assertions", value => {
+ new ObjectMatcherRulePlugin("assert", "assertions", (value) => {
if (value) {
return (
/** @type {ImportAttributes} */ (value)._isLegacyAssert !== undefined
@@ -236,7 +236,7 @@ const ruleSetCompiler = new RuleSetCompiler([
return false;
}),
- new ObjectMatcherRulePlugin("with", "assertions", value => {
+ new ObjectMatcherRulePlugin("with", "assertions", (value) => {
if (value) {
return !(/** @type {ImportAttributes} */ (value)._isLegacyAssert);
}
@@ -498,7 +498,7 @@ class NormalModuleFactory extends ModuleFactory {
)
.split(/!+/);
unresolvedResource = /** @type {string} */ (rawElements.pop());
- elements = rawElements.map(el => {
+ elements = rawElements.map((el) => {
const { path, query } = cachedParseResourceWithoutFragment(el);
return {
loader: path,
@@ -528,7 +528,7 @@ class NormalModuleFactory extends ModuleFactory {
/** @type {undefined | LoaderItem[]} */
let loaders;
- const continueCallback = needCalls(2, err => {
+ const continueCallback = needCalls(2, (err) => {
if (err) return callback(err);
// translate option idents
@@ -656,7 +656,7 @@ class NormalModuleFactory extends ModuleFactory {
/** @type {undefined | LoaderItem[]} */
let preLoaders;
- const continueCallback = needCalls(3, err => {
+ const continueCallback = needCalls(3, (err) => {
if (err) {
return callback(err);
}
@@ -775,7 +775,7 @@ class NormalModuleFactory extends ModuleFactory {
/**
* @param {string} context context
*/
- const defaultResolve = context => {
+ const defaultResolve = (context) => {
if (/^($|\?)/.test(unresolvedResource)) {
resourceData = {
...cacheParseResource(unresolvedResource),
@@ -835,7 +835,7 @@ class NormalModuleFactory extends ModuleFactory {
};
this.hooks.resolveForScheme
.for(scheme)
- .callAsync(resourceData, data, err => {
+ .callAsync(resourceData, data, (err) => {
if (err) return continueCallback(err);
continueCallback();
});
@@ -1016,13 +1016,15 @@ ${hints.join("\n\n")}`;
// Check if the extension is missing a leading dot (e.g. "js" instead of ".js")
let appendResolveExtensionsHint = false;
const specifiedExtensions = [...resolver.options.extensions];
- const expectedExtensions = specifiedExtensions.map(extension => {
- if (LEADING_DOT_EXTENSION_REGEX.test(extension)) {
- appendResolveExtensionsHint = true;
- return `.${extension}`;
+ const expectedExtensions = specifiedExtensions.map(
+ (extension) => {
+ if (LEADING_DOT_EXTENSION_REGEX.test(extension)) {
+ appendResolveExtensionsHint = true;
+ return `.${extension}`;
+ }
+ return extension;
}
- return extension;
- });
+ );
if (appendResolveExtensionsHint) {
err.message += `\nDid you miss the leading dot in 'resolve.extensions'? Did you mean '${JSON.stringify(
expectedExtensions
@@ -1059,7 +1061,7 @@ ${hints.join("\n\n")}`;
) {
asyncLib.parallel(
[
- callback => {
+ (callback) => {
if (!resolver.options.fullySpecified) return callback();
resolver
.withOptions({
@@ -1089,7 +1091,7 @@ Add the extension to the request.`
}
);
},
- callback => {
+ (callback) => {
if (!resolver.options.enforceExtension) return callback();
resolver
.withOptions({
@@ -1128,7 +1130,7 @@ Including the extension in the request is no longer possible. Did you mean to en
}
);
},
- callback => {
+ (callback) => {
if (
/^\.\.?\//.test(unresolvedResource) ||
resolver.options.preferRelative
@@ -1143,7 +1145,7 @@ Including the extension in the request is no longer possible. Did you mean to en
(err, resolvedResource) => {
if (err || !resolvedResource) return callback();
const moduleDirectories = resolver.options.modules
- .map(m => (Array.isArray(m) ? m.join(", ") : m))
+ .map((m) => (Array.isArray(m) ? m.join(", ") : m))
.join(", ");
callback(
null,
@@ -1201,7 +1203,7 @@ If changing the source code is not an option there is also a resolve options cal
context,
`${item.loader}-loader`,
resolveContext,
- err2 => {
+ (err2) => {
if (!err2) {
err.message =
`${err.message}\n` +
diff --git a/lib/NormalModuleReplacementPlugin.js b/lib/NormalModuleReplacementPlugin.js
index 80206f26a..aa7eea7d6 100644
--- a/lib/NormalModuleReplacementPlugin.js
+++ b/lib/NormalModuleReplacementPlugin.js
@@ -34,8 +34,8 @@ class NormalModuleReplacementPlugin {
apply(compiler) {
const resourceRegExp = this.resourceRegExp;
const newResource = this.newResource;
- compiler.hooks.normalModuleFactory.tap(PLUGIN_NAME, nmf => {
- nmf.hooks.beforeResolve.tap(PLUGIN_NAME, result => {
+ compiler.hooks.normalModuleFactory.tap(PLUGIN_NAME, (nmf) => {
+ nmf.hooks.beforeResolve.tap(PLUGIN_NAME, (result) => {
if (resourceRegExp.test(result.request)) {
if (typeof newResource === "function") {
newResource(result);
@@ -44,7 +44,7 @@ class NormalModuleReplacementPlugin {
}
}
});
- nmf.hooks.afterResolve.tap(PLUGIN_NAME, result => {
+ nmf.hooks.afterResolve.tap(PLUGIN_NAME, (result) => {
const createData = result.createData;
if (resourceRegExp.test(/** @type {string} */ (createData.resource))) {
if (typeof newResource === "function") {
diff --git a/lib/PrefetchPlugin.js b/lib/PrefetchPlugin.js
index ce5d802ef..52cf9647b 100644
--- a/lib/PrefetchPlugin.js
+++ b/lib/PrefetchPlugin.js
@@ -45,7 +45,7 @@ class PrefetchPlugin {
compilation.addModuleChain(
this.context || compiler.context,
new PrefetchDependency(this.request),
- err => {
+ (err) => {
callback(err);
}
);
diff --git a/lib/ProgressPlugin.js b/lib/ProgressPlugin.js
index 65d6dacd1..9577f93a8 100644
--- a/lib/ProgressPlugin.js
+++ b/lib/ProgressPlugin.js
@@ -74,7 +74,7 @@ const createDefaultHandler = (profile, logger) => {
lastStateInfo.length = 0;
}
const fullState = [msg, ...args];
- const state = fullState.map(s => s.replace(/\d+\/\d+ /g, ""));
+ const state = fullState.map((s) => s.replace(/\d+\/\d+ /g, ""));
const now = Date.now();
const len = Math.max(state.length, lastStateInfo.length);
for (let i = len; i >= 0; i--) {
@@ -354,7 +354,7 @@ class ProgressPlugin {
/**
* @param {Module} module the module
*/
- const moduleBuild = module => {
+ const moduleBuild = (module) => {
const ident = module.identifier();
if (ident) {
activeModules.add(ident);
@@ -375,7 +375,7 @@ class ProgressPlugin {
/**
* @param {Module} module the module
*/
- const moduleDone = module => {
+ const moduleDone = (module) => {
doneModules++;
if (showActiveModules) {
const ident = module.identifier();
@@ -411,7 +411,7 @@ class ProgressPlugin {
compiler.hooks.beforeCompile.tap(PLUGIN_NAME, () => {
if (!cacheGetPromise) {
cacheGetPromise = cache.getPromise().then(
- data => {
+ (data) => {
if (data) {
lastModulesCount = lastModulesCount || data.modulesCount;
lastDependenciesCount =
@@ -419,17 +419,17 @@ class ProgressPlugin {
}
return data;
},
- _err => {
+ (_err) => {
// Ignore error
}
);
}
});
- compiler.hooks.afterCompile.tapPromise(PLUGIN_NAME, compilation => {
+ compiler.hooks.afterCompile.tapPromise(PLUGIN_NAME, (compilation) => {
if (compilation.compiler.isChild()) return Promise.resolve();
return /** @type {Promise} */ (cacheGetPromise).then(
- async oldData => {
+ async (oldData) => {
const realModulesCount = modulesCount - skippedModulesCount;
const realDependenciesCount =
dependenciesCount - skippedDependenciesCount;
@@ -448,7 +448,7 @@ class ProgressPlugin {
);
});
- compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
+ compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
if (compilation.compiler.isChild()) return;
lastModulesCount = modulesCount;
lastEntriesCount = entriesCount;
@@ -461,12 +461,12 @@ class ProgressPlugin {
0;
doneModules = doneDependencies = doneEntries = 0;
- compilation.factorizeQueue.hooks.added.tap(PLUGIN_NAME, item =>
+ compilation.factorizeQueue.hooks.added.tap(PLUGIN_NAME, (item) =>
factorizeAdd(compilation.factorizeQueue, item)
);
compilation.factorizeQueue.hooks.result.tap(PLUGIN_NAME, factorizeDone);
- compilation.addModuleQueue.hooks.added.tap(PLUGIN_NAME, item =>
+ compilation.addModuleQueue.hooks.added.tap(PLUGIN_NAME, (item) =>
moduleAdd(compilation.addModuleQueue, item)
);
compilation.processDependenciesQueue.hooks.result.tap(
@@ -487,7 +487,7 @@ class ProgressPlugin {
const requiredLoaders = new Set();
NormalModule.getCompilationHooks(compilation).beforeLoaders.tap(
PLUGIN_NAME,
- loaders => {
+ (loaders) => {
for (const loader of loaders) {
if (
loader.type !== "module" &&
diff --git a/lib/ProvidePlugin.js b/lib/ProvidePlugin.js
index dbf98a69a..898bd0d08 100644
--- a/lib/ProvidePlugin.js
+++ b/lib/ProvidePlugin.js
@@ -74,7 +74,7 @@ class ProvidePlugin {
}
}
- parser.hooks.expression.for(name).tap(PLUGIN_NAME, expr => {
+ parser.hooks.expression.for(name).tap(PLUGIN_NAME, (expr) => {
const nameIdentifier = name.includes(".")
? `__webpack_provided_${name.replace(/\./g, "_dot_")}`
: name;
@@ -89,7 +89,7 @@ class ProvidePlugin {
return true;
});
- parser.hooks.call.for(name).tap(PLUGIN_NAME, expr => {
+ parser.hooks.call.for(name).tap(PLUGIN_NAME, (expr) => {
const nameIdentifier = name.includes(".")
? `__webpack_provided_${name.replace(/\./g, "_dot_")}`
: name;
diff --git a/lib/RecordIdsPlugin.js b/lib/RecordIdsPlugin.js
index f3e114439..fa7cb8ce2 100644
--- a/lib/RecordIdsPlugin.js
+++ b/lib/RecordIdsPlugin.js
@@ -63,14 +63,14 @@ class RecordIdsPlugin {
* @param {Module} module the module
* @returns {string} the (portable) identifier
*/
- const getModuleIdentifier = module => {
+ const getModuleIdentifier = (module) => {
if (portableIds) {
return makePathsRelative(module.identifier());
}
return module.identifier();
};
- compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
+ compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
compilation.hooks.recordModules.tap(PLUGIN_NAME, (modules, records) => {
const chunkGraph = compilation.chunkGraph;
if (!records.modules) records.modules = {};
@@ -112,7 +112,7 @@ class RecordIdsPlugin {
* @param {Chunk} chunk the chunk
* @returns {string[]} sources of the chunk
*/
- const getChunkSources = chunk => {
+ const getChunkSources = (chunk) => {
/** @type {string[]} */
const sources = [];
for (const chunkGroup of chunk.groupsIterable) {
diff --git a/lib/ResolverFactory.js b/lib/ResolverFactory.js
index 61bb42ebd..697fdee5c 100644
--- a/lib/ResolverFactory.js
+++ b/lib/ResolverFactory.js
@@ -36,7 +36,7 @@ const EMPTY_RESOLVE_OPTIONS = {};
* @param {ResolveOptionsWithDependencyType} resolveOptionsWithDepType enhanced options
* @returns {ResolveOptions} merged options
*/
-const convertToResolveOptions = resolveOptionsWithDepType => {
+const convertToResolveOptions = (resolveOptionsWithDepType) => {
const { dependencyType, plugins, ...remaining } = resolveOptionsWithDepType;
// check type compat
@@ -46,7 +46,7 @@ const convertToResolveOptions = resolveOptionsWithDepType => {
plugins:
plugins &&
/** @type {ResolvePluginInstance[]} */ (
- plugins.filter(item => item !== "...")
+ plugins.filter((item) => item !== "...")
)
};
@@ -142,7 +142,7 @@ module.exports = class ResolverFactory {
}
/** @type {WeakMap, ResolverWithOptions>} */
const childCache = new WeakMap();
- resolver.withOptions = options => {
+ resolver.withOptions = (options) => {
const cacheEntry = childCache.get(options);
if (cacheEntry !== undefined) return cacheEntry;
const mergedOptions = cachedCleverMerge(originalResolveOptions, options);
diff --git a/lib/RuntimePlugin.js b/lib/RuntimePlugin.js
index d4eeb5b86..6e9e30959 100644
--- a/lib/RuntimePlugin.js
+++ b/lib/RuntimePlugin.js
@@ -118,13 +118,13 @@ class RuntimePlugin {
* @returns {void}
*/
apply(compiler) {
- compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
+ compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
const globalChunkLoading = compilation.outputOptions.chunkLoading;
/**
* @param {Chunk} chunk chunk
* @returns {boolean} true, when chunk loading is disabled for the chunk
*/
- const isChunkLoadingDisabledForChunk = chunk => {
+ const isChunkLoadingDisabledForChunk = (chunk) => {
const options = chunk.getEntryOptions();
const chunkLoading =
options && options.chunkLoading !== undefined
@@ -168,7 +168,7 @@ class RuntimePlugin {
}
compilation.hooks.runtimeRequirementInTree
.for(RuntimeGlobals.definePropertyGetters)
- .tap(PLUGIN_NAME, chunk => {
+ .tap(PLUGIN_NAME, (chunk) => {
compilation.addRuntimeModule(
chunk,
new DefinePropertyGettersRuntimeModule()
@@ -177,7 +177,7 @@ class RuntimePlugin {
});
compilation.hooks.runtimeRequirementInTree
.for(RuntimeGlobals.makeNamespaceObject)
- .tap(PLUGIN_NAME, chunk => {
+ .tap(PLUGIN_NAME, (chunk) => {
compilation.addRuntimeModule(
chunk,
new MakeNamespaceObjectRuntimeModule()
@@ -186,7 +186,7 @@ class RuntimePlugin {
});
compilation.hooks.runtimeRequirementInTree
.for(RuntimeGlobals.createFakeNamespaceObject)
- .tap(PLUGIN_NAME, chunk => {
+ .tap(PLUGIN_NAME, (chunk) => {
compilation.addRuntimeModule(
chunk,
new CreateFakeNamespaceObjectRuntimeModule()
@@ -206,7 +206,7 @@ class RuntimePlugin {
});
compilation.hooks.runtimeRequirementInTree
.for(RuntimeGlobals.hasOwnProperty)
- .tap(PLUGIN_NAME, chunk => {
+ .tap(PLUGIN_NAME, (chunk) => {
compilation.addRuntimeModule(
chunk,
new HasOwnPropertyRuntimeModule()
@@ -215,7 +215,7 @@ class RuntimePlugin {
});
compilation.hooks.runtimeRequirementInTree
.for(RuntimeGlobals.compatGetDefaultExport)
- .tap(PLUGIN_NAME, chunk => {
+ .tap(PLUGIN_NAME, (chunk) => {
compilation.addRuntimeModule(
chunk,
new CompatGetDefaultExportRuntimeModule()
@@ -224,7 +224,7 @@ class RuntimePlugin {
});
compilation.hooks.runtimeRequirementInTree
.for(RuntimeGlobals.runtimeId)
- .tap(PLUGIN_NAME, chunk => {
+ .tap(PLUGIN_NAME, (chunk) => {
compilation.addRuntimeModule(chunk, new RuntimeIdRuntimeModule());
return true;
});
@@ -259,13 +259,13 @@ class RuntimePlugin {
});
compilation.hooks.runtimeRequirementInTree
.for(RuntimeGlobals.global)
- .tap(PLUGIN_NAME, chunk => {
+ .tap(PLUGIN_NAME, (chunk) => {
compilation.addRuntimeModule(chunk, new GlobalRuntimeModule());
return true;
});
compilation.hooks.runtimeRequirementInTree
.for(RuntimeGlobals.asyncModule)
- .tap(PLUGIN_NAME, chunk => {
+ .tap(PLUGIN_NAME, (chunk) => {
const experiments = compilation.options.experiments;
compilation.addRuntimeModule(
chunk,
@@ -275,7 +275,7 @@ class RuntimePlugin {
});
compilation.hooks.runtimeRequirementInTree
.for(RuntimeGlobals.systemContext)
- .tap(PLUGIN_NAME, chunk => {
+ .tap(PLUGIN_NAME, (chunk) => {
const entryOptions = chunk.getEntryOptions();
const libraryType =
entryOptions && entryOptions.library !== undefined
@@ -308,7 +308,7 @@ class RuntimePlugin {
"javascript",
"javascript",
RuntimeGlobals.getChunkScriptFilename,
- chunk =>
+ (chunk) =>
getJavascriptModulesPlugin().chunkHasJs(chunk, chunkGraph) &&
/** @type {TemplatePath} */ (
chunk.filenameTemplate ||
@@ -338,7 +338,7 @@ class RuntimePlugin {
"css",
"css",
RuntimeGlobals.getChunkCssFilename,
- chunk =>
+ (chunk) =>
getCssModulesPlugin().chunkHasCss(chunk, chunkGraph) &&
getChunkFilenameTemplate(chunk, compilation.outputOptions),
set.has(RuntimeGlobals.hmrDownloadUpdateHandlers)
@@ -363,7 +363,7 @@ class RuntimePlugin {
"javascript",
"javascript update",
RuntimeGlobals.getChunkUpdateScriptFilename,
- _chunk =>
+ (_chunk) =>
/** @type {NonNullable} */
(compilation.outputOptions.hotUpdateChunkFilename),
true
@@ -480,7 +480,7 @@ class RuntimePlugin {
});
compilation.hooks.runtimeRequirementInTree
.for(RuntimeGlobals.baseURI)
- .tap(PLUGIN_NAME, chunk => {
+ .tap(PLUGIN_NAME, (chunk) => {
if (isChunkLoadingDisabledForChunk(chunk)) {
compilation.addRuntimeModule(chunk, new BaseUriRuntimeModule());
return true;
@@ -488,7 +488,7 @@ class RuntimePlugin {
});
compilation.hooks.runtimeRequirementInTree
.for(RuntimeGlobals.scriptNonce)
- .tap(PLUGIN_NAME, chunk => {
+ .tap(PLUGIN_NAME, (chunk) => {
compilation.addRuntimeModule(chunk, new NonceRuntimeModule());
return true;
});
diff --git a/lib/RuntimeTemplate.js b/lib/RuntimeTemplate.js
index ac1b2d358..44f68a3e4 100644
--- a/lib/RuntimeTemplate.js
+++ b/lib/RuntimeTemplate.js
@@ -49,12 +49,12 @@ This should not happen.
It's in these chunks: ${
Array.from(
chunkGraph.getModuleChunksIterable(module),
- c => c.name || c.id || c.debugId
+ (c) => c.name || c.id || c.debugId
).join(", ") || "none"
} (If module is in no chunk this indicates a bug in some chunk/module optimization logic)
Module has these incoming connections: ${Array.from(
chunkGraph.moduleGraph.getIncomingConnections(module),
- connection =>
+ (connection) =>
`\n - ${
connection.originModule && connection.originModule.identifier()
} ${connection.dependency && connection.dependency.type} ${
@@ -229,7 +229,7 @@ class RuntimeTemplate {
if (concatenationCost <= templateCost) return this._es5Concatenation(args);
return `\`${args
- .map(arg => (typeof arg === "string" ? arg : `\${${arg.expr}}`))
+ .map((arg) => (typeof arg === "string" ? arg : `\${${arg.expr}}`))
.join("")}\``;
}
@@ -240,7 +240,7 @@ class RuntimeTemplate {
*/
_es5Concatenation(args) {
const str = args
- .map(arg => (typeof arg === "string" ? JSON.stringify(arg) : arg.expr))
+ .map((arg) => (typeof arg === "string" ? JSON.stringify(arg) : arg.expr))
.join(" + ");
// when the first two args are expression, we need to prepend "" + to force string
@@ -290,7 +290,9 @@ class RuntimeTemplate {
return this.supportsDestructuring()
? `var {${items.join(", ")}} = ${value};`
: Template.asString(
- items.map(item => `var ${item} = ${value}${propertyAccess([item])};`)
+ items.map(
+ (item) => `var ${item} = ${value}${propertyAccess([item])};`
+ )
);
}
@@ -332,12 +334,12 @@ class RuntimeTemplate {
if (this.outputOptions.pathinfo) {
content = [message, request, chunkName, chunkReason]
.filter(Boolean)
- .map(item => this.requestShortener.shorten(item))
+ .map((item) => this.requestShortener.shorten(item))
.join(" | ");
} else {
content = [message, chunkName, chunkReason]
.filter(Boolean)
- .map(item => this.requestShortener.shorten(item))
+ .map((item) => this.requestShortener.shorten(item))
.join(" | ");
}
if (!content) return "";
@@ -763,14 +765,14 @@ class RuntimeTemplate {
if (typeof runtimeCondition === "boolean") return `${runtimeCondition}`;
/** @type {Set} */
const positiveRuntimeIds = new Set();
- forEachRuntime(runtimeCondition, runtime =>
+ forEachRuntime(runtimeCondition, (runtime) =>
positiveRuntimeIds.add(
`${chunkGraph.getRuntimeId(/** @type {string} */ (runtime))}`
)
);
/** @type {Set} */
const negativeRuntimeIds = new Set();
- forEachRuntime(subtractRuntime(runtime, runtimeCondition), runtime =>
+ forEachRuntime(subtractRuntime(runtime, runtimeCondition), (runtime) =>
negativeRuntimeIds.add(
`${chunkGraph.getRuntimeId(/** @type {string} */ (runtime))}`
)
@@ -865,7 +867,7 @@ class RuntimeTemplate {
this,
exportsType,
moduleId,
- Array.from(outgoingAsyncModules, mod => chunkGraph.getModuleId(mod))
+ Array.from(outgoingAsyncModules, (mod) => chunkGraph.getModuleId(mod))
)};\n`;
return [importContent, ""];
@@ -1087,7 +1089,7 @@ class RuntimeTemplate {
return `Promise.resolve(${comment.trim()})`;
}
const chunks = chunkGroup.chunks.filter(
- chunk => !chunk.hasRuntime() && chunk.id !== null
+ (chunk) => !chunk.hasRuntime() && chunk.id !== null
);
const comment = this.comment({
message,
@@ -1119,7 +1121,7 @@ class RuntimeTemplate {
* @param {Chunk} chunk chunk
* @returns {string} require chunk id code
*/
- const requireChunkId = chunk =>
+ const requireChunkId = (chunk) =>
`${RuntimeGlobals.ensureChunk}(${JSON.stringify(chunk.id)}${
fetchPriority ? `, ${JSON.stringify(fetchPriority)}` : ""
})`;
diff --git a/lib/SizeFormatHelpers.js b/lib/SizeFormatHelpers.js
index 4c6a748f0..e233d5fa6 100644
--- a/lib/SizeFormatHelpers.js
+++ b/lib/SizeFormatHelpers.js
@@ -9,7 +9,7 @@
* @param {number} size the size in bytes
* @returns {string} the formatted size
*/
-module.exports.formatSize = size => {
+module.exports.formatSize = (size) => {
if (typeof size !== "number" || Number.isNaN(size) === true) {
return "unknown size";
}
diff --git a/lib/SourceMapDevToolModuleOptionsPlugin.js b/lib/SourceMapDevToolModuleOptionsPlugin.js
index ae62b0379..c024125bd 100644
--- a/lib/SourceMapDevToolModuleOptionsPlugin.js
+++ b/lib/SourceMapDevToolModuleOptionsPlugin.js
@@ -27,17 +27,17 @@ class SourceMapDevToolModuleOptionsPlugin {
apply(compilation) {
const options = this.options;
if (options.module !== false) {
- compilation.hooks.buildModule.tap(PLUGIN_NAME, module => {
+ compilation.hooks.buildModule.tap(PLUGIN_NAME, (module) => {
module.useSourceMap = true;
});
- compilation.hooks.runtimeModule.tap(PLUGIN_NAME, module => {
+ compilation.hooks.runtimeModule.tap(PLUGIN_NAME, (module) => {
module.useSourceMap = true;
});
} else {
- compilation.hooks.buildModule.tap(PLUGIN_NAME, module => {
+ compilation.hooks.buildModule.tap(PLUGIN_NAME, (module) => {
module.useSimpleSourceMap = true;
});
- compilation.hooks.runtimeModule.tap(PLUGIN_NAME, module => {
+ compilation.hooks.runtimeModule.tap(PLUGIN_NAME, (module) => {
module.useSimpleSourceMap = true;
});
}
diff --git a/lib/SourceMapDevToolPlugin.js b/lib/SourceMapDevToolPlugin.js
index f5f28efd5..913dad027 100644
--- a/lib/SourceMapDevToolPlugin.js
+++ b/lib/SourceMapDevToolPlugin.js
@@ -65,7 +65,7 @@ const URL_FORMATTING_REGEXP = /^\n\/\/(.*)$/;
* @param {RegExp} regexp Stateful Regular Expression to be reset
* @returns {void}
*/
-const resetRegexpState = regexp => {
+const resetRegexpState = (regexp) => {
regexp.lastIndex = -1;
};
@@ -74,7 +74,7 @@ const resetRegexpState = regexp => {
* @param {string} str String to quote
* @returns {string} Escaped string
*/
-const quoteMeta = str => str.replace(METACHARACTERS_REGEXP, "\\$&");
+const quoteMeta = (str) => str.replace(METACHARACTERS_REGEXP, "\\$&");
/**
* Creating {@link SourceMapTask} for given file
@@ -112,7 +112,7 @@ const getTaskForFile = (
const context = /** @type {string} */ (compilation.options.context);
const root = compilation.compiler.root;
const cachedAbsolutify = makePathsAbsolute.bindContextCache(context, root);
- const modules = sourceMap.sources.map(source => {
+ const modules = sourceMap.sources.map((source) => {
if (!source.startsWith("webpack://")) return source;
source = cachedAbsolutify(source.slice(10));
const module = compilation.findModule(source);
@@ -179,7 +179,7 @@ class SourceMapDevToolPlugin {
options
);
- compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
+ compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
new SourceMapDevToolModuleOptionsPlugin(options).apply(compilation);
compilation.hooks.processAssets.tapAsync(
@@ -348,7 +348,7 @@ class SourceMapDevToolPlugin {
callback();
});
},
- err => {
+ (err) => {
if (err) {
return callback(err);
}
@@ -431,7 +431,7 @@ class SourceMapDevToolPlugin {
"attach SourceMap"
);
- const moduleFilenames = modules.map(m =>
+ const moduleFilenames = modules.map((m) =>
moduleToSourceNameMapping.get(m)
);
sourceMap.sources = /** @type {string[]} */ (moduleFilenames);
@@ -454,7 +454,7 @@ class SourceMapDevToolPlugin {
: quoteMeta(contenthash);
sourceMap.file = sourceMap.file.replace(
new RegExp(pattern, "g"),
- m => "x".repeat(m.length)
+ (m) => "x".repeat(m.length)
);
}
@@ -584,7 +584,7 @@ class SourceMapDevToolPlugin {
compilation.updateAsset(file, asset);
}
- task.cacheItem.store({ assets, assetsInfo }, err => {
+ task.cacheItem.store({ assets, assetsInfo }, (err) => {
reportProgress(
0.5 + (0.5 * ++taskIndex) / tasks.length,
task.file,
@@ -597,7 +597,7 @@ class SourceMapDevToolPlugin {
callback();
});
},
- err => {
+ (err) => {
reportProgress(1);
callback(err);
}
diff --git a/lib/Stats.js b/lib/Stats.js
index 22a36632a..2a8837962 100644
--- a/lib/Stats.js
+++ b/lib/Stats.js
@@ -36,7 +36,7 @@ class Stats {
hasWarnings() {
return (
this.compilation.getWarnings().length > 0 ||
- this.compilation.children.some(child => child.getStats().hasWarnings())
+ this.compilation.children.some((child) => child.getStats().hasWarnings())
);
}
@@ -46,7 +46,7 @@ class Stats {
hasErrors() {
return (
this.compilation.errors.length > 0 ||
- this.compilation.children.some(child => child.getStats().hasErrors())
+ this.compilation.children.some((child) => child.getStats().hasErrors())
);
}
diff --git a/lib/Template.js b/lib/Template.js
index 9b91ac0f0..f8b60e3be 100644
--- a/lib/Template.js
+++ b/lib/Template.js
@@ -296,7 +296,7 @@ class Template {
return null;
}
/** @type {{id: string|number, source: Source|string}[]} */
- const allModules = modules.map(module => ({
+ const allModules = modules.map((module) => ({
id: /** @type {ModuleId} */ (chunkGraph.getModuleId(module)),
source: renderModule(module) || "false"
}));
diff --git a/lib/TemplatedPathPlugin.js b/lib/TemplatedPathPlugin.js
index 3439bfd4b..0afb5aff2 100644
--- a/lib/TemplatedPathPlugin.js
+++ b/lib/TemplatedPathPlugin.js
@@ -24,7 +24,7 @@ const REGEXP = /\[\\*([\w:]+)\\*\]/gi;
* @param {string | number} id id
* @returns {string | number} result
*/
-const prepareId = id => {
+const prepareId = (id) => {
if (typeof id !== "string") return id;
if (/^"\s\+*.*\+\s*"$/.test(id)) {
@@ -389,7 +389,7 @@ class TemplatedPathPlugin {
* @returns {void}
*/
apply(compiler) {
- compiler.hooks.compilation.tap(plugin, compilation => {
+ compiler.hooks.compilation.tap(plugin, (compilation) => {
compilation.hooks.assetPath.tap(plugin, replacePathVariables);
});
}
diff --git a/lib/UseStrictPlugin.js b/lib/UseStrictPlugin.js
index 3db3daa8f..ea1d87fbe 100644
--- a/lib/UseStrictPlugin.js
+++ b/lib/UseStrictPlugin.js
@@ -36,7 +36,7 @@ class UseStrictPlugin {
* @param {JavascriptParserOptions} parserOptions the javascript parser options
*/
const handler = (parser, parserOptions) => {
- parser.hooks.program.tap(PLUGIN_NAME, ast => {
+ parser.hooks.program.tap(PLUGIN_NAME, (ast) => {
const firstNode = ast.body[0];
if (
firstNode &&
diff --git a/lib/WarnCaseSensitiveModulesPlugin.js b/lib/WarnCaseSensitiveModulesPlugin.js
index 5badc2229..a272cff05 100644
--- a/lib/WarnCaseSensitiveModulesPlugin.js
+++ b/lib/WarnCaseSensitiveModulesPlugin.js
@@ -20,7 +20,7 @@ class WarnCaseSensitiveModulesPlugin {
* @returns {void}
*/
apply(compiler) {
- compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
+ compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
compilation.hooks.seal.tap(PLUGIN_NAME, () => {
/** @type {Map>} */
const moduleWithoutCase = new Map();
diff --git a/lib/WarnDeprecatedOptionPlugin.js b/lib/WarnDeprecatedOptionPlugin.js
index 961837687..5afe80e9c 100644
--- a/lib/WarnDeprecatedOptionPlugin.js
+++ b/lib/WarnDeprecatedOptionPlugin.js
@@ -30,7 +30,7 @@ class WarnDeprecatedOptionPlugin {
* @returns {void}
*/
apply(compiler) {
- compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => {
+ compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
compilation.warnings.push(
new DeprecatedOptionWarning(this.option, this.value, this.suggestion)
);
diff --git a/lib/WarnNoModeSetPlugin.js b/lib/WarnNoModeSetPlugin.js
index 7eaee450b..3eaae89bc 100644
--- a/lib/WarnNoModeSetPlugin.js
+++ b/lib/WarnNoModeSetPlugin.js
@@ -18,7 +18,7 @@ class WarnNoModeSetPlugin {
* @returns {void}
*/
apply(compiler) {
- compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => {
+ compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
compilation.warnings.push(new NoModeWarning());
});
}
diff --git a/lib/WatchIgnorePlugin.js b/lib/WatchIgnorePlugin.js
index 0840575fc..b47b1cdef 100644
--- a/lib/WatchIgnorePlugin.js
+++ b/lib/WatchIgnorePlugin.js
@@ -45,8 +45,8 @@ class IgnoringWatchFileSystem {
* @param {string} path path to check
* @returns {boolean} true, if path is ignored
*/
- const ignored = path =>
- this.paths.some(p =>
+ const ignored = (path) =>
+ this.paths.some((p) =>
p instanceof RegExp ? p.test(path) : path.indexOf(p) === 0
);
diff --git a/lib/Watching.js b/lib/Watching.js
index a047f257b..c3e9bc915 100644
--- a/lib/Watching.js
+++ b/lib/Watching.js
@@ -159,14 +159,14 @@ class Watching {
const run = () => {
if (this.compiler.idle) {
- return this.compiler.cache.endIdle(err => {
+ return this.compiler.cache.endIdle((err) => {
if (err) return this._done(err);
this.compiler.idle = false;
run();
});
}
if (this._needRecords) {
- return this.compiler.readRecords(err => {
+ return this.compiler.readRecords((err) => {
if (err) return this._done(err);
this._needRecords = false;
@@ -175,7 +175,7 @@ class Watching {
}
this.invalid = false;
this._invalidReported = false;
- this.compiler.hooks.watchRun.callAsync(this.compiler, err => {
+ this.compiler.hooks.watchRun.callAsync(this.compiler, (err) => {
if (err) return this._done(err);
/**
* @param {Error | null} err error
@@ -196,13 +196,13 @@ class Watching {
process.nextTick(() => {
const logger = compilation.getLogger("webpack.Compiler");
logger.time("emitAssets");
- this.compiler.emitAssets(compilation, err => {
+ this.compiler.emitAssets(compilation, (err) => {
logger.timeEnd("emitAssets");
if (err) return this._done(err, compilation);
if (this.invalid) return this._done(null, compilation);
logger.time("emitRecords");
- this.compiler.emitRecords(err => {
+ this.compiler.emitRecords((err) => {
logger.timeEnd("emitRecords");
if (err) return this._done(err, compilation);
@@ -215,11 +215,11 @@ class Watching {
compilation.endTime = Date.now();
logger.time("done hook");
const stats = new Stats(compilation);
- this.compiler.hooks.done.callAsync(stats, err => {
+ this.compiler.hooks.done.callAsync(stats, (err) => {
logger.timeEnd("done hook");
if (err) return this._done(err, compilation);
- this.compiler.hooks.additionalPass.callAsync(err => {
+ this.compiler.hooks.additionalPass.callAsync((err) => {
if (err) return this._done(err, compilation);
this.compiler.compile(onCompiled);
});
@@ -288,7 +288,7 @@ class Watching {
logger.time("storeBuildDependencies");
this.compiler.cache.storeBuildDependencies(
compilation.buildDependencies,
- err => {
+ (err) => {
logger.timeEnd("storeBuildDependencies");
if (err) return handleError(err);
this._go();
@@ -311,7 +311,7 @@ class Watching {
const cbs = this.callbacks;
this.callbacks = [];
logger.time("done hook");
- this.compiler.hooks.done.callAsync(/** @type {Stats} */ (stats), err => {
+ this.compiler.hooks.done.callAsync(/** @type {Stats} */ (stats), (err) => {
logger.timeEnd("done hook");
if (err) return handleError(err, cbs);
this.handler(null, stats);
@@ -319,7 +319,7 @@ class Watching {
this.compiler.cache.storeBuildDependencies(
/** @type {Compilation} */
(compilation).buildDependencies,
- err => {
+ (err) => {
logger.timeEnd("storeBuildDependencies");
if (err) return handleError(err, cbs);
logger.time("beginIdle");
@@ -480,7 +480,7 @@ class Watching {
/**
* @param {WebpackError | null} err error if any
*/
- const shutdown = err => {
+ const shutdown = (err) => {
this.compiler.hooks.watchClose.call();
const closeCallbacks =
/** @type {Callback[]} */
@@ -493,7 +493,7 @@ class Watching {
logger.time("storeBuildDependencies");
this.compiler.cache.storeBuildDependencies(
compilation.buildDependencies,
- err2 => {
+ (err2) => {
logger.timeEnd("storeBuildDependencies");
shutdown(err || err2);
}
diff --git a/lib/WebpackIsIncludedPlugin.js b/lib/WebpackIsIncludedPlugin.js
index 4b18790b2..362590114 100644
--- a/lib/WebpackIsIncludedPlugin.js
+++ b/lib/WebpackIsIncludedPlugin.js
@@ -47,10 +47,10 @@ class WebpackIsIncludedPlugin {
* @param {JavascriptParser} parser the parser
* @returns {void}
*/
- const handler = parser => {
+ const handler = (parser) => {
parser.hooks.call
.for("__webpack_is_included__")
- .tap(PLUGIN_NAME, expr => {
+ .tap(PLUGIN_NAME, (expr) => {
if (
expr.type !== "CallExpression" ||
expr.arguments.length !== 1 ||
diff --git a/lib/WebpackOptionsApply.js b/lib/WebpackOptionsApply.js
index 9ebdaa6dc..906451d35 100644
--- a/lib/WebpackOptionsApply.js
+++ b/lib/WebpackOptionsApply.js
@@ -858,7 +858,7 @@ class WebpackOptionsApply extends OptionsApply {
}
compiler.resolverFactory.hooks.resolveOptions
.for("normal")
- .tap(CLASS_NAME, resolveOptions => {
+ .tap(CLASS_NAME, (resolveOptions) => {
resolveOptions = cleverMerge(options.resolve, resolveOptions);
resolveOptions.fileSystem =
/** @type {InputFileSystem} */
@@ -867,7 +867,7 @@ class WebpackOptionsApply extends OptionsApply {
});
compiler.resolverFactory.hooks.resolveOptions
.for("context")
- .tap(CLASS_NAME, resolveOptions => {
+ .tap(CLASS_NAME, (resolveOptions) => {
resolveOptions = cleverMerge(options.resolve, resolveOptions);
resolveOptions.fileSystem =
/** @type {InputFileSystem} */
@@ -877,7 +877,7 @@ class WebpackOptionsApply extends OptionsApply {
});
compiler.resolverFactory.hooks.resolveOptions
.for("loader")
- .tap(CLASS_NAME, resolveOptions => {
+ .tap(CLASS_NAME, (resolveOptions) => {
resolveOptions = cleverMerge(options.resolveLoader, resolveOptions);
resolveOptions.fileSystem =
/** @type {InputFileSystem} */
diff --git a/lib/asset/AssetGenerator.js b/lib/asset/AssetGenerator.js
index 90cb71b23..f1e1c0250 100644
--- a/lib/asset/AssetGenerator.js
+++ b/lib/asset/AssetGenerator.js
@@ -152,7 +152,7 @@ const encodeDataUri = (encoding, source) => {
(encodedContent)
).replace(
/[!'()*]/g,
- character =>
+ (character) =>
`%${/** @type {number} */ (character.codePointAt(0)).toString(16)}`
);
break;
diff --git a/lib/asset/AssetModulesPlugin.js b/lib/asset/AssetModulesPlugin.js
index 7ee4370e0..7b317cf55 100644
--- a/lib/asset/AssetModulesPlugin.js
+++ b/lib/asset/AssetModulesPlugin.js
@@ -31,7 +31,7 @@ const memoize = require("../util/memoize");
* @param {string} name name of definitions
* @returns {Schema} definition
*/
-const getSchema = name => {
+const getSchema = (name) => {
const { definitions } = require("../../schemas/WebpackOptions.json");
return {
@@ -93,7 +93,7 @@ class AssetModulesPlugin {
(compilation, { normalModuleFactory }) => {
normalModuleFactory.hooks.createParser
.for(ASSET_MODULE_TYPE)
- .tap(PLUGIN_NAME, parserOptions => {
+ .tap(PLUGIN_NAME, (parserOptions) => {
validateParserOptions(parserOptions);
parserOptions = cleverMerge(
/** @type {AssetParserOptions} */
@@ -115,21 +115,21 @@ class AssetModulesPlugin {
});
normalModuleFactory.hooks.createParser
.for(ASSET_MODULE_TYPE_INLINE)
- .tap(PLUGIN_NAME, _parserOptions => {
+ .tap(PLUGIN_NAME, (_parserOptions) => {
const AssetParser = getAssetParser();
return new AssetParser(true);
});
normalModuleFactory.hooks.createParser
.for(ASSET_MODULE_TYPE_RESOURCE)
- .tap(PLUGIN_NAME, _parserOptions => {
+ .tap(PLUGIN_NAME, (_parserOptions) => {
const AssetParser = getAssetParser();
return new AssetParser(false);
});
normalModuleFactory.hooks.createParser
.for(ASSET_MODULE_TYPE_SOURCE)
- .tap(PLUGIN_NAME, _parserOptions => {
+ .tap(PLUGIN_NAME, (_parserOptions) => {
const AssetSourceParser = getAssetSourceParser();
return new AssetSourceParser();
@@ -142,7 +142,7 @@ class AssetModulesPlugin {
]) {
normalModuleFactory.hooks.createGenerator
.for(type)
- .tap(PLUGIN_NAME, generatorOptions => {
+ .tap(PLUGIN_NAME, (generatorOptions) => {
validateGeneratorOptions[type](generatorOptions);
let dataUrl;
diff --git a/lib/async-modules/AsyncModuleHelpers.js b/lib/async-modules/AsyncModuleHelpers.js
index e0c69bb60..df45deca5 100644
--- a/lib/async-modules/AsyncModuleHelpers.js
+++ b/lib/async-modules/AsyncModuleHelpers.js
@@ -32,7 +32,7 @@ const getOutgoingAsyncModules = (moduleGraph, module) => {
for (const [module, connections] of outgoingConnectionMap) {
if (
connections.some(
- c =>
+ (c) =>
c.dependency instanceof HarmonyImportDependency &&
c.isTargetActive(undefined)
) &&
diff --git a/lib/async-modules/InferAsyncModulesPlugin.js b/lib/async-modules/InferAsyncModulesPlugin.js
index f585aac5c..3ced0bcc6 100644
--- a/lib/async-modules/InferAsyncModulesPlugin.js
+++ b/lib/async-modules/InferAsyncModulesPlugin.js
@@ -19,9 +19,9 @@ class InferAsyncModulesPlugin {
* @returns {void}
*/
apply(compiler) {
- compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
+ compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
const { moduleGraph } = compilation;
- compilation.hooks.finishModules.tap(PLUGIN_NAME, modules => {
+ compilation.hooks.finishModules.tap(PLUGIN_NAME, (modules) => {
/** @type {Set} */
const queue = new Set();
for (const module of modules) {
@@ -37,7 +37,7 @@ class InferAsyncModulesPlugin {
] of moduleGraph.getIncomingConnectionsByOriginModule(module)) {
if (
connections.some(
- c =>
+ (c) =>
c.dependency instanceof HarmonyImportDependency &&
c.isTargetActive(undefined)
)
diff --git a/lib/buildChunkGraph.js b/lib/buildChunkGraph.js
index 9cd54164b..117e98ed3 100644
--- a/lib/buildChunkGraph.js
+++ b/lib/buildChunkGraph.js
@@ -269,7 +269,7 @@ const visitModules = (
* @param {Module} module The module to look up
* @returns {number} The ordinal of the module in masks
*/
- const getModuleOrdinal = module => {
+ const getModuleOrdinal = (module) => {
let ordinal = ordinalByModule.get(module);
if (ordinal === undefined) {
ordinal = ordinalByModule.size;
@@ -486,7 +486,7 @@ const visitModules = (
* @param {AsyncDependenciesBlock} b iterating over each Async DepBlock
* @returns {void}
*/
- const iteratorBlock = b => {
+ const iteratorBlock = (b) => {
// 1. We create a chunk group with single chunk in it for this Block
// but only once (blockChunkGroups map)
/** @type {ChunkGroupInfo | undefined} */
@@ -673,7 +673,7 @@ const visitModules = (
* @param {DependenciesBlock} block the block
* @returns {void}
*/
- const processBlock = block => {
+ const processBlock = (block) => {
statProcessedBlocks++;
// get prepared block info
const blockModules = getBlockModules(block, chunkGroupInfo.runtime);
@@ -765,7 +765,7 @@ const visitModules = (
* @param {DependenciesBlock} block the block
* @returns {void}
*/
- const processEntryBlock = block => {
+ const processEntryBlock = (block) => {
statProcessedBlocks++;
// get prepared block info
const blockModules = getBlockModules(block, chunkGroupInfo.runtime);
@@ -892,7 +892,7 @@ const visitModules = (
* @param {ChunkGroupInfo} chunkGroupInfo The info object for the chunk group
* @returns {bigint} The mask of available modules after the chunk group
*/
- const calculateResultingAvailableModules = chunkGroupInfo => {
+ const calculateResultingAvailableModules = (chunkGroupInfo) => {
if (chunkGroupInfo.resultingAvailableModules !== undefined) {
return chunkGroupInfo.resultingAvailableModules;
}
diff --git a/lib/cache/AddBuildDependenciesPlugin.js b/lib/cache/AddBuildDependenciesPlugin.js
index 7d8b1d077..7d271e26a 100644
--- a/lib/cache/AddBuildDependenciesPlugin.js
+++ b/lib/cache/AddBuildDependenciesPlugin.js
@@ -23,7 +23,7 @@ class AddBuildDependenciesPlugin {
* @returns {void}
*/
apply(compiler) {
- compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
+ compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
compilation.buildDependencies.addAll(this.buildDependencies);
});
}
diff --git a/lib/cache/IdleFileCachePlugin.js b/lib/cache/IdleFileCachePlugin.js
index 907080765..78ef83b99 100644
--- a/lib/cache/IdleFileCachePlugin.js
+++ b/lib/cache/IdleFileCachePlugin.js
@@ -68,7 +68,7 @@ class IdleFileCachePlugin {
{ name: PLUGIN_NAME, stage: Cache.STAGE_DISK },
(identifier, etag, gotHandlers) => {
const restore = () =>
- strategy.restore(identifier, etag).then(cacheEntry => {
+ strategy.restore(identifier, etag).then((cacheEntry) => {
if (cacheEntry === undefined) {
gotHandlers.push((result, callback) => {
if (result !== undefined) {
@@ -93,7 +93,7 @@ class IdleFileCachePlugin {
compiler.cache.hooks.storeBuildDependencies.tap(
{ name: PLUGIN_NAME, stage: Cache.STAGE_DISK },
- dependencies => {
+ (dependencies) => {
pendingIdleTasks.set(BUILD_DEPENDENCIES_KEY, () =>
Promise.resolve().then(() =>
strategy.storeBuildDependencies(dependencies)
@@ -113,7 +113,7 @@ class IdleFileCachePlugin {
const reportProgress = ProgressPlugin.getReporter(compiler);
const jobs = [...pendingIdleTasks.values()];
if (reportProgress) reportProgress(0, "process pending cache items");
- const promises = jobs.map(fn => fn());
+ const promises = jobs.map((fn) => fn());
pendingIdleTasks.clear();
promises.push(currentIdlePromise);
const promise = Promise.all(promises);
@@ -168,7 +168,7 @@ class IdleFileCachePlugin {
timeSpendInStore = 0;
timeSpendInBuild = 0;
})
- .catch(err => {
+ .catch((err) => {
const logger = compiler.getInfrastructureLogger(PLUGIN_NAME);
logger.warn(`Background tasks during idle failed: ${err.message}`);
logger.debug(err.stack);
@@ -229,7 +229,7 @@ class IdleFileCachePlugin {
isIdle = false;
}
);
- compiler.hooks.done.tap(PLUGIN_NAME, stats => {
+ compiler.hooks.done.tap(PLUGIN_NAME, (stats) => {
// 10% build overhead is ignored, as it's not cacheable
timeSpendInBuild *= 0.9;
timeSpendInBuild +=
diff --git a/lib/cache/PackFileCacheStrategy.js b/lib/cache/PackFileCacheStrategy.js
index 29bcf18e5..0c8ab23e9 100644
--- a/lib/cache/PackFileCacheStrategy.js
+++ b/lib/cache/PackFileCacheStrategy.js
@@ -330,7 +330,7 @@ class Pack {
`${itemsCount} fresh items in cache put into pack ${
packs.length > 1
? packs
- .map(pack => `${pack.loc} (${pack.items.size} items)`)
+ .map((pack) => `${pack.loc} (${pack.items.size} items)`)
.join(", ")
: packs[0].loc
}`
@@ -407,7 +407,7 @@ class Pack {
for (const identifier of content.used) {
mergedUsedItems.add(identifier);
}
- addToMergedMap.push(async map => {
+ addToMergedMap.push(async (map) => {
// unpack existing content
// after that values are accessible in .content
await content.unpack(
@@ -433,7 +433,7 @@ class Pack {
memoize(async () => {
/** @type {Content} */
const map = new Map();
- await Promise.all(addToMergedMap.map(fn => fn(map)));
+ await Promise.all(addToMergedMap.map((fn) => fn(map)));
return new PackContentItems(map);
})
);
@@ -603,7 +603,7 @@ class Pack {
const content = this.content[i];
if (content !== undefined) {
write(content.items);
- content.writeLazy(lazy =>
+ content.writeLazy((lazy) =>
/** @type {NonNullable} */
(writeSeparate)(lazy, { name: `${i}` })
);
@@ -627,7 +627,7 @@ class Pack {
item = read();
}
this.itemInfo.clear();
- const infoItems = items.map(identifier => {
+ const infoItems = items.map((identifier) => {
const info = new PackItemInfo(identifier, undefined, undefined);
this.itemInfo.set(identifier, info);
return info;
@@ -875,7 +875,7 @@ class PackContent {
}
const value = /** @type {LazyFunction} */ (this.lazy)();
if ("then" in value) {
- return value.then(data => {
+ return value.then((data) => {
const map = data.map;
if (timeMessage) {
logger.timeEnd(timeMessage);
@@ -927,7 +927,7 @@ class PackContent {
/** @type {PackContentItems | Promise} */
(this.lazy());
if ("then" in value) {
- return value.then(data => {
+ return value.then((data) => {
if (timeMessage) {
logger.timeEnd(timeMessage);
}
@@ -1022,7 +1022,7 @@ class PackContent {
if ("then" in value) {
// Move to state B1
this.lazy = write(() =>
- value.then(data => {
+ value.then((data) => {
if (timeMessage) {
logger.timeEnd(timeMessage);
}
@@ -1060,7 +1060,7 @@ class PackContent {
* @param {Buffer} buf buffer
* @returns {Buffer} buffer that can be collected
*/
-const allowCollectingMemory = buf => {
+const allowCollectingMemory = (buf) => {
const wasted = buf.buffer.byteLength - buf.byteLength;
if (wasted > 8192 && (wasted > 1048576 || wasted > buf.byteLength)) {
return Buffer.from(buf);
@@ -1178,7 +1178,7 @@ class PackFileCacheStrategy {
? allowCollectingMemory
: undefined
})
- .catch(err => {
+ .catch((err) => {
if (err.code !== "ENOENT") {
logger.warn(
`Restoring pack failed from ${cacheLocation}${this._extension}: ${err}`
@@ -1191,7 +1191,7 @@ class PackFileCacheStrategy {
}
return undefined;
})
- .then(packContainer => {
+ .then((packContainer) => {
logger.timeEnd("restore cache container");
if (!packContainer) return;
if (!(packContainer instanceof PackContainer)) {
@@ -1277,7 +1277,7 @@ class PackFileCacheStrategy {
);
})
])
- .catch(err => {
+ .catch((err) => {
logger.timeEnd("check build dependencies");
throw err;
})
@@ -1292,7 +1292,7 @@ class PackFileCacheStrategy {
return undefined;
});
})
- .then(pack => {
+ .then((pack) => {
if (pack) {
pack.maxAge = this.maxAge;
this.buildSnapshot = buildSnapshot;
@@ -1307,7 +1307,7 @@ class PackFileCacheStrategy {
}
return new Pack(logger, this.maxAge);
})
- .catch(err => {
+ .catch((err) => {
this.logger.warn(
`Restoring pack from ${cacheLocation}${this._extension} failed: ${err}`
);
@@ -1325,7 +1325,7 @@ class PackFileCacheStrategy {
store(identifier, etag, data) {
if (this.readonly) return Promise.resolve();
- return this._getPack().then(pack => {
+ return this._getPack().then((pack) => {
pack.set(identifier, etag === null ? null : etag.toString(), data);
});
}
@@ -1337,10 +1337,10 @@ class PackFileCacheStrategy {
*/
restore(identifier, etag) {
return this._getPack()
- .then(pack =>
+ .then((pack) =>
pack.get(identifier, etag === null ? null : etag.toString())
)
- .catch(err => {
+ .catch((err) => {
if (err && err.code !== "ENOENT") {
this.logger.warn(
`Restoring failed for ${identifier} from pack: ${err}`
@@ -1363,7 +1363,7 @@ class PackFileCacheStrategy {
if (packPromise === undefined) return Promise.resolve();
const reportProgress = ProgressPlugin.getReporter(this.compiler);
return (this.storePromise = packPromise
- .then(pack => {
+ .then((pack) => {
pack.stopCapturingRequests();
if (!pack.invalid) return;
this.packPromise = undefined;
@@ -1526,14 +1526,14 @@ class PackFileCacheStrategy {
Math.round(stats.size / 1024 / 1024)
);
})
- .catch(err => {
+ .catch((err) => {
this.logger.timeEnd("store pack");
this.logger.warn(`Caching failed for pack: ${err}`);
this.logger.debug(err.stack);
});
});
})
- .catch(err => {
+ .catch((err) => {
this.logger.warn(`Caching failed for pack: ${err}`);
this.logger.debug(err.stack);
}));
diff --git a/lib/cache/ResolverCachePlugin.js b/lib/cache/ResolverCachePlugin.js
index 8e918546a..e28a8896c 100644
--- a/lib/cache/ResolverCachePlugin.js
+++ b/lib/cache/ResolverCachePlugin.js
@@ -115,7 +115,7 @@ class ResolverCachePlugin {
let cachedResolves = 0;
let cacheInvalidResolves = 0;
let concurrentResolves = 0;
- compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => {
+ compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
snapshotOptions = compilation.options.snapshot.resolve;
fileSystemInfo = compilation.fileSystemInfo;
compilation.hooks.finishModules.tap(PLUGIN_NAME, () => {
@@ -176,14 +176,14 @@ class ResolverCachePlugin {
if (typeof newResolveContext.yield === "function") {
yieldResult = [];
withYield = true;
- newResolveContext.yield = obj =>
+ newResolveContext.yield = (obj) =>
/** @type {ResolveRequest[]} */
(yieldResult).push(obj);
}
/**
* @param {"fileDependencies" | "contextDependencies" | "missingDependencies"} key key
*/
- const propagate = key => {
+ const propagate = (key) => {
if (resolveContext[key]) {
addAllToSet(
/** @type {Set} */ (resolveContext[key]),
@@ -239,7 +239,7 @@ class ResolverCachePlugin {
(resolveResult),
snapshot
),
- storeErr => {
+ (storeErr) => {
if (storeErr) return callback(storeErr);
if (resolveResult) {
return callback(
diff --git a/lib/cli.js b/lib/cli.js
index 642bde742..b52562b2e 100644
--- a/lib/cli.js
+++ b/lib/cli.js
@@ -82,7 +82,7 @@ const getArguments = (schema = webpackSchema) => {
* @param {string} input input
* @returns {string} result
*/
- const pathToArgumentName = input =>
+ const pathToArgumentName = (input) =>
input
.replace(/\./g, "-")
.replace(/\[\]/g, "")
@@ -97,7 +97,7 @@ const getArguments = (schema = webpackSchema) => {
* @param {string} path path
* @returns {Schema} schema part
*/
- const getSchemaPart = path => {
+ const getSchemaPart = (path) => {
const newPath = path.split("/");
let schemaPart = schema;
@@ -119,7 +119,7 @@ const getArguments = (schema = webpackSchema) => {
* @param {PathItem[]} path path in the schema
* @returns {string | undefined} description
*/
- const getDescription = path => {
+ const getDescription = (path) => {
for (const { schema } of path) {
if (schema.cli) {
if (schema.cli.helper) continue;
@@ -133,7 +133,7 @@ const getArguments = (schema = webpackSchema) => {
* @param {PathItem[]} path path in the schema
* @returns {string | undefined} negative description
*/
- const getNegatedDescription = path => {
+ const getNegatedDescription = (path) => {
for (const { schema } of path) {
if (schema.cli) {
if (schema.cli.helper) continue;
@@ -146,7 +146,7 @@ const getArguments = (schema = webpackSchema) => {
* @param {PathItem[]} path path in the schema
* @returns {string | undefined} reset description
*/
- const getResetDescription = path => {
+ const getResetDescription = (path) => {
for (const { schema } of path) {
if (schema.cli) {
if (schema.cli.helper) continue;
@@ -159,7 +159,7 @@ const getArguments = (schema = webpackSchema) => {
* @param {Schema} schemaPart schema
* @returns {Pick | undefined} partial argument config
*/
- const schemaToArgumentConfig = schemaPart => {
+ const schemaToArgumentConfig = (schemaPart) => {
if (schemaPart.enum) {
return {
type: "enum",
@@ -192,7 +192,7 @@ const getArguments = (schema = webpackSchema) => {
* @param {PathItem[]} path path in the schema
* @returns {void}
*/
- const addResetFlag = path => {
+ const addResetFlag = (path) => {
const schemaPath = path[0].path;
const name = pathToArgumentName(`${schemaPath}.reset`);
const description =
@@ -253,7 +253,7 @@ const getArguments = (schema = webpackSchema) => {
if (
flags[name].configs.some(
- item => JSON.stringify(item) === JSON.stringify(argConfig)
+ (item) => JSON.stringify(item) === JSON.stringify(argConfig)
)
) {
return 0;
@@ -261,7 +261,7 @@ const getArguments = (schema = webpackSchema) => {
if (
flags[name].configs.some(
- item => item.type === argConfig.type && item.multiple !== multiple
+ (item) => item.type === argConfig.type && item.multiple !== multiple
)
) {
if (multiple) {
@@ -411,8 +411,8 @@ const getArguments = (schema = webpackSchema) => {
/** @type {NonNullable} */
(argConfig.values);
- if (values.every(v => typeof v === "boolean")) type = "boolean";
- if (values.every(v => typeof v === "number")) type = "number";
+ if (values.every((v) => typeof v === "boolean")) type = "boolean";
+ if (values.every((v) => typeof v === "number")) type = "number";
break;
}
}
@@ -420,7 +420,7 @@ const getArguments = (schema = webpackSchema) => {
return t === type ? t : "string";
}, /** @type {SimpleType | undefined} */ (undefined))
);
- argument.multiple = argument.configs.some(c => c.multiple);
+ argument.multiple = argument.configs.some((c) => c.multiple);
}
return flags;
@@ -580,7 +580,7 @@ const processArgumentConfig = (argConfig, config, value, index) => {
* @param {ArgumentConfig} argConfig processing instructions
* @returns {string | undefined} expected message
*/
-const getExpectedValue = argConfig => {
+const getExpectedValue = (argConfig) => {
switch (argConfig.type) {
case "boolean":
return "true | false";
@@ -590,7 +590,7 @@ const getExpectedValue = argConfig => {
return /** @type {NonNullable} */ (
argConfig.values
)
- .map(v => `${v}`)
+ .map((v) => `${v}`)
.join(" | ");
case "reset":
return "true (will reset the previous value to an empty array)";
diff --git a/lib/config/browserslistTargetHandler.js b/lib/config/browserslistTargetHandler.js
index 09bf23dd3..196cfa143 100644
--- a/lib/config/browserslistTargetHandler.js
+++ b/lib/config/browserslistTargetHandler.js
@@ -74,14 +74,14 @@ const load = (input, context) => {
* @param {string[]} browsers supported browsers list
* @returns {EcmaTargetProperties & PlatformTargetProperties & ApiTargetProperties} target properties
*/
-const resolve = browsers => {
+const resolve = (browsers) => {
/**
* Checks all against a version number
* @param {Record} versions first supported version
* @returns {boolean} true if supports
*/
- const rawChecker = versions =>
- browsers.every(v => {
+ const rawChecker = (versions) =>
+ browsers.every((v) => {
const [name, parsedVersion] = v.split(" ");
if (!name) return false;
const requiredVersion = versions[name];
@@ -100,8 +100,8 @@ const resolve = browsers => {
? Number(parserMinor) >= requiredVersion[1]
: Number(parsedMajor) > requiredVersion[0];
});
- const anyNode = browsers.some(b => b.startsWith("node "));
- const anyBrowser = browsers.some(b => /^(?!node)/.test(b));
+ const anyNode = browsers.some((b) => b.startsWith("node "));
+ const anyBrowser = browsers.some((b) => /^(?!node)/.test(b));
const browserProperty = !anyBrowser ? false : anyNode ? null : true;
const nodeProperty = !anyNode ? false : anyBrowser ? null : true;
// Internet Explorer Mobile, Blackberry browser and Opera Mini are very old browsers, they do not support new features
@@ -349,7 +349,7 @@ const resolve = browsers => {
nodeBuiltins: nodeProperty,
nodePrefixForCoreModules:
nodeProperty &&
- !browsers.some(b => b.startsWith("node 15")) &&
+ !browsers.some((b) => b.startsWith("node 15")) &&
rawChecker({
node: [14, 18]
}),
diff --git a/lib/config/defaults.js b/lib/config/defaults.js
index 3f4c4618a..0c07d8742 100644
--- a/lib/config/defaults.js
+++ b/lib/config/defaults.js
@@ -159,7 +159,7 @@ const A = (obj, prop, factory) => {
* @param {WebpackOptionsNormalized} options options to be modified
* @returns {void}
*/
-const applyWebpackOptionsBaseDefaults = options => {
+const applyWebpackOptionsBaseDefaults = (options) => {
F(options, "context", () => process.cwd());
applyInfrastructureLoggingDefaults(options.infrastructureLogging);
};
@@ -242,7 +242,7 @@ const applyWebpackOptionsDefaults = (options, compilerIndex) => {
target === undefined ||
(typeof target === "string" && target.startsWith("browserslist")) ||
(Array.isArray(target) &&
- target.some(target => target.startsWith("browserslist"))),
+ target.some((target) => target.startsWith("browserslist"))),
outputModule:
/** @type {NonNullable} */
(options.experiments.outputModule),
@@ -594,7 +594,7 @@ const applyJavascriptParserOptionsDefaults = (
* @param {JsonGeneratorOptions} generatorOptions generator options
* @returns {void}
*/
-const applyJsonGeneratorOptionsDefaults = generatorOptions => {
+const applyJsonGeneratorOptionsDefaults = (generatorOptions) => {
D(generatorOptions, "JSONParse", true);
};
@@ -652,7 +652,7 @@ const applyModuleDefaults = (
* @param {Module} module module
* @returns {boolean} true, if we want to cache the module
*/
- module => {
+ (module) => {
const name = module.nameForCondition();
if (!name) {
return false;
@@ -964,7 +964,7 @@ const applyOutputDefaults = (
* @param {Library=} library the library option
* @returns {string} a readable library name
*/
- const getLibraryName = library => {
+ const getLibraryName = (library) => {
const libraryName =
typeof library === "object" &&
library &&
@@ -1015,7 +1015,7 @@ const applyOutputDefaults = (
* @param {boolean | undefined} v value
* @returns {boolean} true, when v is truthy or undefined
*/
- const optimistic = v => v || v === undefined;
+ const optimistic = (v) => v || v === undefined;
/**
* @param {boolean | undefined} v value
* @param {boolean | undefined} c condition
@@ -1322,7 +1322,7 @@ const applyOutputDefaults = (
* @param {(entryDescription: EntryDescription) => void} fn iterator
* @returns {void}
*/
- const forEachEntry = fn => {
+ const forEachEntry = (fn) => {
for (const name of Object.keys(entry)) {
fn(/** @type {{[k: string] : EntryDescription}} */ (entry)[name]);
}
@@ -1333,7 +1333,7 @@ const applyOutputDefaults = (
if (output.library) {
enabledLibraryTypes.push(output.library.type);
}
- forEachEntry(desc => {
+ forEachEntry((desc) => {
if (desc.library) {
enabledLibraryTypes.push(desc.library.type);
}
@@ -1349,7 +1349,7 @@ const applyOutputDefaults = (
if (output.workerChunkLoading) {
enabledChunkLoadingTypes.add(output.workerChunkLoading);
}
- forEachEntry(desc => {
+ forEachEntry((desc) => {
if (desc.chunkLoading) {
enabledChunkLoadingTypes.add(desc.chunkLoading);
}
@@ -1365,7 +1365,7 @@ const applyOutputDefaults = (
if (output.workerWasmLoading) {
enabledWasmLoadingTypes.add(output.workerWasmLoading);
}
- forEachEntry(desc => {
+ forEachEntry((desc) => {
if (desc.wasmLoading) {
enabledWasmLoadingTypes.add(desc.wasmLoading);
}
@@ -1553,7 +1553,7 @@ const applyOptimizationDefaults = (
D(optimization, "minimize", production);
A(optimization, "minimizer", () => [
{
- apply: compiler => {
+ apply: (compiler) => {
// Lazy load the Terser plugin
const TerserPlugin = require("terser-webpack-plugin");
@@ -1735,7 +1735,7 @@ const getResolveLoaderDefaults = ({ cache }) => {
* @param {InfrastructureLogging} infrastructureLogging options
* @returns {void}
*/
-const applyInfrastructureLoggingDefaults = infrastructureLogging => {
+const applyInfrastructureLoggingDefaults = (infrastructureLogging) => {
F(infrastructureLogging, "stream", () => process.stderr);
const tty =
/** @type {NonNullable} */
diff --git a/lib/config/normalization.js b/lib/config/normalization.js
index 04a7a2d4a..fbd001c34 100644
--- a/lib/config/normalization.js
+++ b/lib/config/normalization.js
@@ -57,7 +57,7 @@ const nestedConfig = (value, fn) =>
* @param {T|undefined} value value or not
* @returns {T} result value
*/
-const cloneObject = value => /** @type {T} */ ({ ...value });
+const cloneObject = (value) => /** @type {T} */ ({ ...value });
/**
* @template T
* @template R
@@ -124,13 +124,13 @@ const keyedNestedConfig = (value, fn, customKeys) => {
* @param {WebpackOptions} config input config
* @returns {WebpackOptionsNormalized} normalized options
*/
-const getNormalizedWebpackOptions = config => ({
+const getNormalizedWebpackOptions = (config) => ({
amd: config.amd,
bail: config.bail,
cache:
/** @type {NonNullable} */
(
- optionalNestedConfig(config.cache, cache => {
+ optionalNestedConfig(config.cache, (cache) => {
if (cache === false) return false;
if (cache === true) {
return {
@@ -173,7 +173,7 @@ const getNormalizedWebpackOptions = config => ({
),
context: config.context,
dependencies: config.dependencies,
- devServer: optionalNestedConfig(config.devServer, devServer => {
+ devServer: optionalNestedConfig(config.devServer, (devServer) => {
if (devServer === false) return false;
return { ...devServer };
}),
@@ -183,25 +183,25 @@ const getNormalizedWebpackOptions = config => ({
? { main: {} }
: typeof config.entry === "function"
? (
- fn => () =>
+ (fn) => () =>
Promise.resolve().then(fn).then(getNormalizedEntryStatic)
)(config.entry)
: getNormalizedEntryStatic(config.entry),
- experiments: nestedConfig(config.experiments, experiments => ({
+ experiments: nestedConfig(config.experiments, (experiments) => ({
...experiments,
- buildHttp: optionalNestedConfig(experiments.buildHttp, options =>
+ buildHttp: optionalNestedConfig(experiments.buildHttp, (options) =>
Array.isArray(options) ? { allowedUris: options } : options
),
lazyCompilation: optionalNestedConfig(
experiments.lazyCompilation,
- options => (options === true ? {} : options)
+ (options) => (options === true ? {} : options)
)
})),
externals: /** @type {NonNullable} */ (config.externals),
externalsPresets: cloneObject(config.externalsPresets),
externalsType: config.externalsType,
ignoreWarnings: config.ignoreWarnings
- ? config.ignoreWarnings.map(ignore => {
+ ? config.ignoreWarnings.map((ignore) => {
if (typeof ignore === "function") return ignore;
const i = ignore instanceof RegExp ? { message: ignore } : ignore;
return (warning, { requestShortener }) => {
@@ -236,11 +236,11 @@ const getNormalizedWebpackOptions = config => ({
module:
/** @type {ModuleOptionsNormalized} */
(
- nestedConfig(config.module, module => ({
+ nestedConfig(config.module, (module) => ({
noParse: module.noParse,
unsafeCache: module.unsafeCache,
parser: keyedNestedConfig(module.parser, cloneObject, {
- javascript: parserOptions => ({
+ javascript: (parserOptions) => ({
unknownContextRequest: module.unknownContextRequest,
unknownContextRegExp: module.unknownContextRegExp,
unknownContextRecursive: module.unknownContextRecursive,
@@ -259,26 +259,26 @@ const getNormalizedWebpackOptions = config => ({
})
}),
generator: cloneObject(module.generator),
- defaultRules: optionalNestedArray(module.defaultRules, r => [...r]),
- rules: nestedArray(module.rules, r => [...r])
+ defaultRules: optionalNestedArray(module.defaultRules, (r) => [...r]),
+ rules: nestedArray(module.rules, (r) => [...r])
}))
),
name: config.name,
node: nestedConfig(
config.node,
- node =>
+ (node) =>
node && {
...node
}
),
- optimization: nestedConfig(config.optimization, optimization => ({
+ optimization: nestedConfig(config.optimization, (optimization) => ({
...optimization,
runtimeChunk: getNormalizedOptimizationRuntimeChunk(
optimization.runtimeChunk
),
splitChunks: nestedConfig(
optimization.splitChunks,
- splitChunks =>
+ (splitChunks) =>
splitChunks && {
...splitChunks,
defaultSizeTypes: splitChunks.defaultSizeTypes
@@ -295,7 +295,7 @@ const getNormalizedWebpackOptions = config => ({
)
: optimization.emitOnErrors
})),
- output: nestedConfig(config.output, output => {
+ output: nestedConfig(config.output, (output) => {
const { library } = output;
const libraryAsName = /** @type {LibraryName} */ (library);
const libraryBase =
@@ -384,13 +384,16 @@ const getNormalizedWebpackOptions = config => ({
sourcePrefix: output.sourcePrefix,
strictModuleErrorHandling: output.strictModuleErrorHandling,
strictModuleExceptionHandling: output.strictModuleExceptionHandling,
- trustedTypes: optionalNestedConfig(output.trustedTypes, trustedTypes => {
- if (trustedTypes === true) return {};
- if (typeof trustedTypes === "string") {
- return { policyName: trustedTypes };
+ trustedTypes: optionalNestedConfig(
+ output.trustedTypes,
+ (trustedTypes) => {
+ if (trustedTypes === true) return {};
+ if (typeof trustedTypes === "string") {
+ return { policyName: trustedTypes };
+ }
+ return { ...trustedTypes };
}
- return { ...trustedTypes };
- }),
+ ),
uniqueName: output.uniqueName,
wasmLoading: output.wasmLoading,
webassemblyModuleFilename: output.webassemblyModuleFilename,
@@ -401,13 +404,13 @@ const getNormalizedWebpackOptions = config => ({
return result;
}),
parallelism: config.parallelism,
- performance: optionalNestedConfig(config.performance, performance => {
+ performance: optionalNestedConfig(config.performance, (performance) => {
if (performance === false) return false;
return {
...performance
};
}),
- plugins: /** @type {Plugins} */ (nestedArray(config.plugins, p => [...p])),
+ plugins: /** @type {Plugins} */ (nestedArray(config.plugins, (p) => [...p])),
profile: config.profile,
recordsInputPath:
config.recordsInputPath !== undefined
@@ -417,39 +420,39 @@ const getNormalizedWebpackOptions = config => ({
config.recordsOutputPath !== undefined
? config.recordsOutputPath
: config.recordsPath,
- resolve: nestedConfig(config.resolve, resolve => ({
+ resolve: nestedConfig(config.resolve, (resolve) => ({
...resolve,
byDependency: keyedNestedConfig(resolve.byDependency, cloneObject)
})),
resolveLoader: cloneObject(config.resolveLoader),
- snapshot: nestedConfig(config.snapshot, snapshot => ({
+ snapshot: nestedConfig(config.snapshot, (snapshot) => ({
resolveBuildDependencies: optionalNestedConfig(
snapshot.resolveBuildDependencies,
- resolveBuildDependencies => ({
+ (resolveBuildDependencies) => ({
timestamp: resolveBuildDependencies.timestamp,
hash: resolveBuildDependencies.hash
})
),
buildDependencies: optionalNestedConfig(
snapshot.buildDependencies,
- buildDependencies => ({
+ (buildDependencies) => ({
timestamp: buildDependencies.timestamp,
hash: buildDependencies.hash
})
),
- resolve: optionalNestedConfig(snapshot.resolve, resolve => ({
+ resolve: optionalNestedConfig(snapshot.resolve, (resolve) => ({
timestamp: resolve.timestamp,
hash: resolve.hash
})),
- module: optionalNestedConfig(snapshot.module, module => ({
+ module: optionalNestedConfig(snapshot.module, (module) => ({
timestamp: module.timestamp,
hash: module.hash
})),
- immutablePaths: optionalNestedArray(snapshot.immutablePaths, p => [...p]),
- managedPaths: optionalNestedArray(snapshot.managedPaths, p => [...p]),
- unmanagedPaths: optionalNestedArray(snapshot.unmanagedPaths, p => [...p])
+ immutablePaths: optionalNestedArray(snapshot.immutablePaths, (p) => [...p]),
+ managedPaths: optionalNestedArray(snapshot.managedPaths, (p) => [...p]),
+ unmanagedPaths: optionalNestedArray(snapshot.unmanagedPaths, (p) => [...p])
})),
- stats: nestedConfig(config.stats, stats => {
+ stats: nestedConfig(config.stats, (stats) => {
if (stats === false) {
return {
preset: "none"
@@ -478,7 +481,7 @@ const getNormalizedWebpackOptions = config => ({
* @param {EntryStatic} entry static entry options
* @returns {EntryStaticNormalized} normalized static entry options
*/
-const getNormalizedEntryStatic = entry => {
+const getNormalizedEntryStatic = (entry) => {
if (typeof entry === "string") {
return {
main: {
@@ -540,7 +543,7 @@ const getNormalizedEntryStatic = entry => {
* @param {OptimizationRuntimeChunk=} runtimeChunk runtimeChunk option
* @returns {OptimizationRuntimeChunkNormalized=} normalized runtimeChunk option
*/
-const getNormalizedOptimizationRuntimeChunk = runtimeChunk => {
+const getNormalizedOptimizationRuntimeChunk = (runtimeChunk) => {
if (runtimeChunk === undefined) return;
if (runtimeChunk === false) return false;
if (runtimeChunk === "single") {
@@ -550,7 +553,7 @@ const getNormalizedOptimizationRuntimeChunk = runtimeChunk => {
}
if (runtimeChunk === true || runtimeChunk === "multiple") {
return {
- name: entrypoint => `runtime~${entrypoint.name}`
+ name: (entrypoint) => `runtime~${entrypoint.name}`
};
}
const { name } = runtimeChunk;
diff --git a/lib/config/target.js b/lib/config/target.js
index 235019d66..e8bb48d00 100644
--- a/lib/config/target.js
+++ b/lib/config/target.js
@@ -15,7 +15,7 @@ const getBrowserslistTargetHandler = memoize(() =>
* @param {string} context the context directory
* @returns {string} default target
*/
-const getDefaultTarget = context => {
+const getDefaultTarget = (context) => {
const browsers = getBrowserslistTargetHandler().load(null, context);
return browsers ? "browserslist" : "web";
};
@@ -287,7 +287,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
"esX",
"EcmaScript in this version. Examples: es2020, es5.",
/^es(\d+)$/,
- version => {
+ (version) => {
let v = Number(version);
if (v < 1000) v += 2009;
return {
@@ -333,7 +333,7 @@ const getTargetProperties = (target, context) => {
* @param {TargetProperties[]} targetProperties array of target properties
* @returns {TargetProperties} merged target properties
*/
-const mergeTargetProperties = targetProperties => {
+const mergeTargetProperties = (targetProperties) => {
/** @type {Set} */
const keys = new Set();
for (const tp of targetProperties) {
@@ -371,7 +371,7 @@ const mergeTargetProperties = targetProperties => {
* @returns {TargetProperties} target properties
*/
const getTargetsProperties = (targets, context) =>
- mergeTargetProperties(targets.map(t => getTargetProperties(t, context)));
+ mergeTargetProperties(targets.map((t) => getTargetProperties(t, context)));
module.exports.getDefaultTarget = getDefaultTarget;
module.exports.getTargetProperties = getTargetProperties;
diff --git a/lib/container/ContainerEntryModule.js b/lib/container/ContainerEntryModule.js
index 0395372e8..37a229849 100644
--- a/lib/container/ContainerEntryModule.js
+++ b/lib/container/ContainerEntryModule.js
@@ -159,7 +159,7 @@ class ContainerEntryModule extends Module {
for (const block of this.blocks) {
const { dependencies } = block;
- const modules = dependencies.map(dependency => {
+ const modules = dependencies.map((dependency) => {
const dep = /** @type {ContainerExposedDependency} */ (dependency);
return {
name: dep.exposedName,
@@ -170,9 +170,9 @@ class ContainerEntryModule extends Module {
let str;
- if (modules.some(m => !m.module)) {
+ if (modules.some((m) => !m.module)) {
str = runtimeTemplate.throwMissingModuleErrorBlock({
- request: modules.map(m => m.request).join(", ")
+ request: modules.map((m) => m.request).join(", ")
});
} else {
str = `return ${runtimeTemplate.blockPromise({
diff --git a/lib/container/ContainerPlugin.js b/lib/container/ContainerPlugin.js
index 9a497fc5a..7a725dc84 100644
--- a/lib/container/ContainerPlugin.js
+++ b/lib/container/ContainerPlugin.js
@@ -51,11 +51,11 @@ class ContainerPlugin {
exposes: /** @type {ExposesList} */ (
parseOptions(
options.exposes,
- item => ({
+ (item) => ({
import: Array.isArray(item) ? item : [item],
name: undefined
}),
- item => ({
+ (item) => ({
import: Array.isArray(item.import) ? item.import : [item.import],
name: item.name || undefined
})
@@ -91,7 +91,7 @@ class ContainerPlugin {
runtime,
library
},
- error => {
+ (error) => {
if (error) return callback(error);
hooks.addContainerEntryDependency.call(dep);
callback();
diff --git a/lib/container/ContainerReferencePlugin.js b/lib/container/ContainerReferencePlugin.js
index 207329afe..95efc51b9 100644
--- a/lib/container/ContainerReferencePlugin.js
+++ b/lib/container/ContainerReferencePlugin.js
@@ -43,11 +43,11 @@ class ContainerReferencePlugin {
this._remoteType = options.remoteType;
this._remotes = parseOptions(
options.remotes,
- item => ({
+ (item) => ({
external: Array.isArray(item) ? item : [item],
shareScope: options.shareScope || "default"
}),
- item => ({
+ (item) => ({
external: Array.isArray(item.external)
? item.external
: [item.external],
@@ -97,7 +97,7 @@ class ContainerReferencePlugin {
new FallbackModuleFactory()
);
- normalModuleFactory.hooks.factorize.tap(PLUGIN_NAME, data => {
+ normalModuleFactory.hooks.factorize.tap(PLUGIN_NAME, (data) => {
if (!data.request.includes("!")) {
for (const [key, config] of remotes) {
if (
diff --git a/lib/container/FallbackModule.js b/lib/container/FallbackModule.js
index 7e0be846a..be757f0e0 100644
--- a/lib/container/FallbackModule.js
+++ b/lib/container/FallbackModule.js
@@ -131,7 +131,7 @@ class FallbackModule extends Module {
* @returns {CodeGenerationResult} result
*/
codeGeneration({ runtimeTemplate, moduleGraph, chunkGraph }) {
- const ids = this.dependencies.map(dep =>
+ const ids = this.dependencies.map((dep) =>
chunkGraph.getModuleId(/** @type {Module} */ (moduleGraph.getModule(dep)))
);
const code = Template.asString([
diff --git a/lib/container/HoistContainerReferencesPlugin.js b/lib/container/HoistContainerReferencesPlugin.js
index 669dcccdd..238bb3280 100644
--- a/lib/container/HoistContainerReferencesPlugin.js
+++ b/lib/container/HoistContainerReferencesPlugin.js
@@ -31,19 +31,19 @@ class HoistContainerReferences {
* @param {Compiler} compiler The webpack compiler instance.
*/
apply(compiler) {
- compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => {
+ compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
const hooks =
getModuleFederationPlugin().getCompilationHooks(compilation);
const depsToTrace = new Set();
const entryExternalsToHoist = new Set();
- hooks.addContainerEntryDependency.tap(PLUGIN_NAME, dep => {
+ hooks.addContainerEntryDependency.tap(PLUGIN_NAME, (dep) => {
depsToTrace.add(dep);
});
- hooks.addFederationRuntimeDependency.tap(PLUGIN_NAME, dep => {
+ hooks.addFederationRuntimeDependency.tap(PLUGIN_NAME, (dep) => {
depsToTrace.add(dep);
});
- compilation.hooks.addEntry.tap(PLUGIN_NAME, entryDep => {
+ compilation.hooks.addEntry.tap(PLUGIN_NAME, (entryDep) => {
if (entryDep.type === "entry") {
entryExternalsToHoist.add(entryDep);
}
@@ -56,7 +56,7 @@ class HoistContainerReferences {
// advanced stage is where SplitChunksPlugin runs.
stage: STAGE_ADVANCED + 1
},
- _chunks => {
+ (_chunks) => {
this.hoistModulesInChunks(
compilation,
depsToTrace,
@@ -92,7 +92,7 @@ class HoistContainerReferences {
const runtimes = new Set();
for (const runtimeSpec of containerRuntimes) {
- forEachRuntime(runtimeSpec, runtimeKey => {
+ forEachRuntime(runtimeSpec, (runtimeKey) => {
if (runtimeKey) {
runtimes.add(runtimeKey);
}
@@ -139,7 +139,7 @@ class HoistContainerReferences {
const runtimes = new Set();
for (const runtimeSpec of containerRuntimes) {
- forEachRuntime(runtimeSpec, runtimeKey => {
+ forEachRuntime(runtimeSpec, (runtimeKey) => {
if (runtimeKey) {
runtimes.add(runtimeKey);
}
diff --git a/lib/container/options.js b/lib/container/options.js
index 367d62261..953aea64c 100644
--- a/lib/container/options.js
+++ b/lib/container/options.js
@@ -28,7 +28,7 @@ const process = (options, normalizeSimple, normalizeOptions, fn) => {
/**
* @param {(string | Item)[]} items items
*/
- const array = items => {
+ const array = (items) => {
for (const item of items) {
if (typeof item === "string") {
fn(item, normalizeSimple(item, item));
@@ -42,7 +42,7 @@ const process = (options, normalizeSimple, normalizeOptions, fn) => {
/**
* @param {Item} obj an object
*/
- const object = obj => {
+ const object = (obj) => {
for (const [key, value] of Object.entries(obj)) {
if (typeof value === "string" || Array.isArray(value)) {
fn(key, normalizeSimple(value, key));
@@ -90,8 +90,8 @@ const scope = (scope, options) => {
const obj = {};
process(
options,
- item => /** @type {string | string[] | T} */ (item),
- item => /** @type {string | string[] | T} */ (item),
+ (item) => /** @type {string | string[] | T} */ (item),
+ (item) => /** @type {string | string[] | T} */ (item),
(key, value) => {
obj[
key.startsWith("./") ? `${scope}${key.slice(1)}` : `${scope}/${key}`
diff --git a/lib/css/CssGenerator.js b/lib/css/CssGenerator.js
index a40ca9ad5..97ce9f345 100644
--- a/lib/css/CssGenerator.js
+++ b/lib/css/CssGenerator.js
@@ -119,7 +119,7 @@ class CssGenerator extends Generator {
/**
* @param {Dependency} dependency dependency
*/
- const handleDependency = dependency => {
+ const handleDependency = (dependency) => {
const constructor =
/** @type {new (...args: EXPECTED_ANY[]) => Dependency} */
(dependency.constructor);
diff --git a/lib/css/CssLoadingRuntimeModule.js b/lib/css/CssLoadingRuntimeModule.js
index 1c46eebe5..ce2a9b13d 100644
--- a/lib/css/CssLoadingRuntimeModule.js
+++ b/lib/css/CssLoadingRuntimeModule.js
@@ -181,7 +181,7 @@ class CssLoadingRuntimeModule extends RuntimeModule {
stateExpression ? `${stateExpression} = ${stateExpression} || ` : ""
}{`,
Template.indent(
- Array.from(initialChunkIds, id => `${JSON.stringify(id)}: 0`).join(
+ Array.from(initialChunkIds, (id) => `${JSON.stringify(id)}: 0`).join(
",\n"
)
),
diff --git a/lib/css/CssModulesPlugin.js b/lib/css/CssModulesPlugin.js
index 9dfc70d89..9c5be4c13 100644
--- a/lib/css/CssModulesPlugin.js
+++ b/lib/css/CssModulesPlugin.js
@@ -98,7 +98,7 @@ const getCssLoadingRuntimeModule = memoize(() =>
* @param {string} name name
* @returns {{ oneOf: [{ $ref: string }], definitions: import("../../schemas/WebpackOptions.json")["definitions"] }} schema
*/
-const getSchema = name => {
+const getSchema = (name) => {
const { definitions } = require("../../schemas/WebpackOptions.json");
return {
@@ -264,7 +264,7 @@ class CssModulesPlugin {
]) {
normalModuleFactory.hooks.createParser
.for(type)
- .tap(PLUGIN_NAME, parserOptions => {
+ .tap(PLUGIN_NAME, (parserOptions) => {
validateParserOptions[type](parserOptions);
const { url, import: importOption, namedExports } = parserOptions;
@@ -300,7 +300,7 @@ class CssModulesPlugin {
});
normalModuleFactory.hooks.createGenerator
.for(type)
- .tap(PLUGIN_NAME, generatorOptions => {
+ .tap(PLUGIN_NAME, (generatorOptions) => {
validateGeneratorOptions[type](generatorOptions);
return new CssGenerator(
@@ -442,7 +442,7 @@ class CssModulesPlugin {
compilation.hooks.chunkHash.tap(PLUGIN_NAME, (chunk, hash, context) => {
hooks.chunkHash.call(chunk, hash, context);
});
- compilation.hooks.contentHash.tap(PLUGIN_NAME, chunk => {
+ compilation.hooks.contentHash.tap(PLUGIN_NAME, (chunk) => {
const {
chunkGraph,
codeGenerationResults,
@@ -533,7 +533,7 @@ class CssModulesPlugin {
* @param {Chunk} chunk the chunk
* @returns {boolean} true, when enabled
*/
- const isEnabledForChunk = chunk => {
+ const isEnabledForChunk = (chunk) => {
const options = chunk.getEntryOptions();
const chunkLoading =
options && options.chunkLoading !== undefined
@@ -566,7 +566,7 @@ class CssModulesPlugin {
if (
!chunkGraph.hasModuleInGraph(
chunk,
- m =>
+ (m) =>
m.type === CSS_MODULE_TYPE ||
m.type === CSS_MODULE_TYPE_GLOBAL ||
m.type === CSS_MODULE_TYPE_MODULE ||
@@ -587,7 +587,7 @@ class CssModulesPlugin {
if (
!chunkGraph.hasModuleInGraph(
chunk,
- m =>
+ (m) =>
m.type === CSS_MODULE_TYPE ||
m.type === CSS_MODULE_TYPE_GLOBAL ||
m.type === CSS_MODULE_TYPE_MODULE ||
@@ -617,21 +617,24 @@ class CssModulesPlugin {
// Get ordered list of modules per chunk group
// Lists are in reverse order to allow to use Array.pop()
- const modulesByChunkGroup = Array.from(chunk.groupsIterable, chunkGroup => {
- const sortedModules = modulesList
- .map(module => ({
- module,
- index: chunkGroup.getModulePostOrderIndex(module)
- }))
- .filter(item => item.index !== undefined)
- .sort(
- (a, b) =>
- /** @type {number} */ (b.index) - /** @type {number} */ (a.index)
- )
- .map(item => item.module);
+ const modulesByChunkGroup = Array.from(
+ chunk.groupsIterable,
+ (chunkGroup) => {
+ const sortedModules = modulesList
+ .map((module) => ({
+ module,
+ index: chunkGroup.getModulePostOrderIndex(module)
+ }))
+ .filter((item) => item.index !== undefined)
+ .sort(
+ (a, b) =>
+ /** @type {number} */ (b.index) - /** @type {number} */ (a.index)
+ )
+ .map((item) => item.module);
- return { list: sortedModules, set: new Set(sortedModules) };
- });
+ return { list: sortedModules, set: new Set(sortedModules) };
+ }
+ );
if (modulesByChunkGroup.length === 1) {
return modulesByChunkGroup[0].list.reverse();
diff --git a/lib/css/CssParser.js b/lib/css/CssParser.js
index 7d19ba4de..b8b430bc7 100644
--- a/lib/css/CssParser.js
+++ b/lib/css/CssParser.js
@@ -76,7 +76,7 @@ const normalizeUrl = (str, isString) => {
// Remove unnecessary spaces from `url(" img.png ")`
.replace(TRIM_WHITE_SPACES, "")
// Unescape
- .replace(UNESCAPE, match => {
+ .replace(UNESCAPE, (match) => {
if (match.length > 2) {
return String.fromCharCode(Number.parseInt(match.slice(1).trim(), 16));
}
@@ -108,7 +108,7 @@ const regexExcessiveSpaces =
* @param {string} str string
* @returns {string} escaped identifier
*/
-const escapeIdentifier = str => {
+const escapeIdentifier = (str) => {
let output = "";
let counter = 0;
@@ -161,7 +161,7 @@ const CONTAINS_ESCAPE = /\\/;
* @param {string} str string
* @returns {[string, number] | undefined} hex
*/
-const gobbleHex = str => {
+const gobbleHex = (str) => {
const lower = str.toLowerCase();
let hex = "";
let spaceTerminated = false;
@@ -198,7 +198,7 @@ const gobbleHex = str => {
* @param {string} str string
* @returns {string} unescaped string
*/
-const unescapeIdentifier = str => {
+const unescapeIdentifier = (str) => {
const needToProcess = CONTAINS_ESCAPE.test(str);
if (!needToProcess) return str;
let ret = "";
@@ -646,7 +646,7 @@ class CssParser extends Parser {
/**
* @param {string} input input
*/
- const processDeclarationValueDone = input => {
+ const processDeclarationValueDone = (input) => {
if (inAnimationProperty && lastIdentifier) {
const { line: sl, column: sc } = locConverter.get(lastIdentifier[0]);
const { line: el, column: ec } = locConverter.get(lastIdentifier[1]);
diff --git a/lib/css/walkCssTokens.js b/lib/css/walkCssTokens.js
index f6b8b042b..bfdc05b10 100644
--- a/lib/css/walkCssTokens.js
+++ b/lib/css/walkCssTokens.js
@@ -98,7 +98,7 @@ const consumeSpace = (input, pos, _callbacks) => {
* @param {number} cc char code
* @returns {boolean} true, if cc is a newline
*/
-const _isNewline = cc =>
+const _isNewline = (cc) =>
cc === CC_LINE_FEED || cc === CC_CARRIAGE_RETURN || cc === CC_FORM_FEED;
/**
@@ -119,13 +119,13 @@ const consumeExtraNewline = (cc, input, pos) => {
* @param {number} cc char code
* @returns {boolean} true, if cc is a space (U+0009 CHARACTER TABULATION or U+0020 SPACE)
*/
-const _isSpace = cc => cc === CC_TAB || cc === CC_SPACE;
+const _isSpace = (cc) => cc === CC_TAB || cc === CC_SPACE;
/**
* @param {number} cc char code
* @returns {boolean} true, if cc is a whitespace
*/
-const _isWhiteSpace = cc => _isNewline(cc) || _isSpace(cc);
+const _isWhiteSpace = (cc) => _isNewline(cc) || _isSpace(cc);
/**
* ident-start code point
@@ -134,7 +134,7 @@ const _isWhiteSpace = cc => _isNewline(cc) || _isSpace(cc);
* @param {number} cc char code
* @returns {boolean} true, if cc is a start code point of an identifier
*/
-const isIdentStartCodePoint = cc =>
+const isIdentStartCodePoint = (cc) =>
(cc >= CC_LOWER_A && cc <= CC_LOWER_Z) ||
(cc >= CC_UPPER_A && cc <= CC_UPPER_Z) ||
cc === CC_LOW_LINE ||
@@ -189,7 +189,7 @@ const consumeComments = (input, pos, callbacks) => {
* @param {number} cc char code
* @returns {boolean} true, if cc is a hex digit
*/
-const _isHexDigit = cc =>
+const _isHexDigit = (cc) =>
_isDigit(cc) ||
(cc >= CC_UPPER_A && cc <= CC_UPPER_F) ||
(cc >= CC_LOWER_A && cc <= CC_LOWER_F);
@@ -325,7 +325,7 @@ const isNonASCIICodePoint = (cc, q) =>
* @param {number} cc char code
* @returns {boolean} is letter
*/
-const isLetter = cc =>
+const isLetter = (cc) =>
(cc >= CC_LOWER_A && cc <= CC_LOWER_Z) ||
(cc >= CC_UPPER_A && cc <= CC_UPPER_Z);
@@ -348,7 +348,7 @@ const _isIdentCodePoint = (cc, q) =>
* @param {number} cc char code
* @returns {boolean} is digit
*/
-const _isDigit = cc => cc >= CC_0 && cc <= CC_9;
+const _isDigit = (cc) => cc >= CC_0 && cc <= CC_9;
/**
* @param {string} input input
@@ -799,7 +799,7 @@ const _consumeAnIdentSequence = (input, pos) => {
* @param {number} cc char code
* @returns {boolean} true, when cc is the non-printable code point, otherwise false
*/
-const _isNonPrintableCodePoint = cc =>
+const _isNonPrintableCodePoint = (cc) =>
(cc >= 0x00 && cc <= 0x08) ||
cc === 0x0b ||
(cc >= 0x0e && cc <= 0x1f) ||
@@ -1584,7 +1584,7 @@ const eatIdentSequenceOrString = (input, pos) => {
* @param {string} chars characters
* @returns {(input: string, pos: number) => number} function to eat characters
*/
-const eatUntil = chars => {
+const eatUntil = (chars) => {
const charCodes = Array.from({ length: chars.length }, (_, i) =>
chars.charCodeAt(i)
);
diff --git a/lib/debug/ProfilingPlugin.js b/lib/debug/ProfilingPlugin.js
index 7a0f64821..eff5240ae 100644
--- a/lib/debug/ProfilingPlugin.js
+++ b/lib/debug/ProfilingPlugin.js
@@ -203,7 +203,7 @@ const createTrace = (fs, outputPath) => {
trace,
counter,
profiler,
- end: callback => {
+ end: (callback) => {
trace.push("]");
// Wait until the write stream finishes.
fsStream.on("close", () => {
@@ -288,7 +288,7 @@ class ProfilingPlugin {
},
(stats, callback) => {
if (compiler.watchMode) return callback();
- tracer.profiler.stopProfiling().then(parsedResults => {
+ tracer.profiler.stopProfiling().then((parsedResults) => {
if (parsedResults === undefined) {
tracer.profiler.destroy();
tracer.end(callback);
@@ -443,12 +443,12 @@ const interceptAllCssModulesPluginHooks = (compilation, tracer) => {
* @param {Trace} tracer tracer
* @returns {(hookName: string) => TODO} interceptor
*/
-const makeInterceptorFor = (instance, tracer) => hookName => ({
+const makeInterceptorFor = (instance, tracer) => (hookName) => ({
/**
* @param {FullTap} tapInfo tap info
* @returns {FullTap} modified full tap
*/
- register: tapInfo => {
+ register: (tapInfo) => {
const { name, type, fn: internalFn } = tapInfo;
const newFn =
// Don't tap our own hooks to ensure stream can close cleanly
@@ -487,7 +487,7 @@ const makeNewProfiledTapFn = (hookName, tracer, { name, type, fn }) => {
const promise =
/** @type {Promise<(...args: EXPECTED_ANY[]) => EXPECTED_ANY>} */
(fn(...args));
- return promise.then(r => {
+ return promise.then((r) => {
tracer.trace.end({
name,
id,
diff --git a/lib/dependencies/AMDDefineDependencyParserPlugin.js b/lib/dependencies/AMDDefineDependencyParserPlugin.js
index 43bb2763e..56cab2a82 100644
--- a/lib/dependencies/AMDDefineDependencyParserPlugin.js
+++ b/lib/dependencies/AMDDefineDependencyParserPlugin.js
@@ -36,7 +36,7 @@ const { addLocalModule, getLocalModule } = require("./LocalModulesHelpers");
* @param {Expression | SpreadElement} expr expression
* @returns {expr is CallExpression} true if it's a bound function expression
*/
-const isBoundFunctionExpression = expr => {
+const isBoundFunctionExpression = (expr) => {
if (expr.type !== "CallExpression") return false;
if (expr.callee.type !== "MemberExpression") return false;
if (expr.callee.computed) return false;
@@ -52,7 +52,7 @@ const isBoundFunctionExpression = expr => {
* @param {Expression | SpreadElement} expr expression
* @returns {expr is FunctionExpression | ArrowFunctionExpression} true when unbound function expression
*/
-const isUnboundFunctionExpression = expr => {
+const isUnboundFunctionExpression = (expr) => {
if (expr.type === "FunctionExpression") return true;
if (expr.type === "ArrowFunctionExpression") return true;
return false;
@@ -62,7 +62,7 @@ const isUnboundFunctionExpression = expr => {
* @param {Expression | SpreadElement} expr expression
* @returns {expr is FunctionExpression | ArrowFunctionExpression | CallExpression} true when callable
*/
-const isCallable = expr => {
+const isCallable = (expr) => {
if (isUnboundFunctionExpression(expr)) return true;
if (isBoundFunctionExpression(expr)) return true;
return false;
@@ -410,7 +410,7 @@ class AMDDefineDependencyParserPlugin {
parser.inScope(
/** @type {Identifier[]} */
(object.params).filter(
- i => !["require", "module", "exports"].includes(i.name)
+ (i) => !["require", "module", "exports"].includes(i.name)
),
() => {
for (const [name, varInfo] of fnRenames) {
diff --git a/lib/dependencies/AMDPlugin.js b/lib/dependencies/AMDPlugin.js
index 9c8a12f6a..add34161d 100644
--- a/lib/dependencies/AMDPlugin.js
+++ b/lib/dependencies/AMDPlugin.js
@@ -156,7 +156,7 @@ class AMDPlugin {
);
parser.hooks.evaluateIdentifier
.for(optionExpr)
- .tap(PLUGIN_NAME, expr =>
+ .tap(PLUGIN_NAME, (expr) =>
evaluateToIdentifier(
optionExpr,
rootName,
@@ -188,7 +188,7 @@ class AMDPlugin {
() => []
);
- parser.hooks.expression.for("define").tap(PLUGIN_NAME, expr => {
+ parser.hooks.expression.for("define").tap(PLUGIN_NAME, (expr) => {
const dep = new ConstDependency(
RuntimeGlobals.amdDefine,
/** @type {Range} */ (expr.range),
@@ -208,7 +208,7 @@ class AMDPlugin {
.for("define")
.tap(PLUGIN_NAME, evaluateToString("function"));
parser.hooks.canRename.for("define").tap(PLUGIN_NAME, approve);
- parser.hooks.rename.for("define").tap(PLUGIN_NAME, expr => {
+ parser.hooks.rename.for("define").tap(PLUGIN_NAME, (expr) => {
const dep = new ConstDependency(
RuntimeGlobals.amdDefine,
/** @type {Range} */ (expr.range),
diff --git a/lib/dependencies/AMDRequireArrayDependency.js b/lib/dependencies/AMDRequireArrayDependency.js
index 1df80723d..0740025fe 100644
--- a/lib/dependencies/AMDRequireArrayDependency.js
+++ b/lib/dependencies/AMDRequireArrayDependency.js
@@ -89,7 +89,7 @@ AMDRequireArrayDependency.Template = class AMDRequireArrayDependencyTemplate ext
* @returns {string} content
*/
getContent(dep, templateContext) {
- const requires = dep.depsArray.map(dependency =>
+ const requires = dep.depsArray.map((dependency) =>
this.contentForDependency(dependency, templateContext)
);
return `[${requires.join(", ")}]`;
diff --git a/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js b/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js
index e0bbf60b9..0d28b8b9f 100644
--- a/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js
+++ b/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js
@@ -52,7 +52,7 @@ class AMDRequireDependenciesBlockParserPlugin {
if (fnData) {
parser.inScope(
fnData.fn.params.filter(
- i =>
+ (i) =>
!["require", "module", "exports"].includes(
/** @type {Identifier} */ (i).name
)
@@ -236,7 +236,7 @@ class AMDRequireDependenciesBlockParserPlugin {
if (param.isArray()) {
const result =
/** @type {BasicEvaluatedExpression[]} */
- (param.items).map(item => this.processItemForRequestString(item));
+ (param.items).map((item) => this.processItemForRequestString(item));
if (result.every(Boolean)) return result.join(" ");
} else if (param.isConstArray()) {
return /** @type {string[]} */ (param.array).join(" ");
@@ -251,7 +251,7 @@ class AMDRequireDependenciesBlockParserPlugin {
if (param.isConditional()) {
const result =
/** @type {BasicEvaluatedExpression[]} */
- (param.options).map(item => this.processItemForRequestString(item));
+ (param.options).map((item) => this.processItemForRequestString(item));
if (result.every(Boolean)) return result.join("|");
} else if (param.isString()) {
return param.string;
diff --git a/lib/dependencies/CommonJsExportRequireDependency.js b/lib/dependencies/CommonJsExportRequireDependency.js
index 3f7c66cf3..fc16baab9 100644
--- a/lib/dependencies/CommonJsExportRequireDependency.js
+++ b/lib/dependencies/CommonJsExportRequireDependency.js
@@ -131,7 +131,7 @@ class CommonJsExportRequireDependency extends ModuleDependency {
false
);
}
- return referencedExports.map(name => ({
+ return referencedExports.map((name) => ({
name,
canMangle: false
}));
@@ -190,7 +190,7 @@ class CommonJsExportRequireDependency extends ModuleDependency {
exports: Array.from(
/** @type {Set} */
(reexportInfo.exports),
- name => ({
+ (name) => ({
name,
from,
export: [...ids, name],
diff --git a/lib/dependencies/CommonJsExportsParserPlugin.js b/lib/dependencies/CommonJsExportsParserPlugin.js
index 400882c29..2592aa981 100644
--- a/lib/dependencies/CommonJsExportsParserPlugin.js
+++ b/lib/dependencies/CommonJsExportsParserPlugin.js
@@ -47,7 +47,7 @@ const ModuleDecoratorDependency = require("./ModuleDecoratorDependency");
* @param {Expression} expr expression
* @returns {Expression | undefined} returns the value of property descriptor
*/
-const getValueOfPropertyDescription = expr => {
+const getValueOfPropertyDescription = (expr) => {
if (expr.type !== "ObjectExpression") return;
for (const property of expr.properties) {
if (property.type === "SpreadElement" || property.computed) continue;
@@ -64,7 +64,7 @@ const getValueOfPropertyDescription = expr => {
* @param {Expression} expr expression being checked
* @returns {boolean} true, when the expression is a truthy literal
*/
-const isTruthyLiteral = expr => {
+const isTruthyLiteral = (expr) => {
switch (expr.type) {
case "Literal":
return Boolean(expr.value);
@@ -81,7 +81,7 @@ const isTruthyLiteral = expr => {
* @param {Expression} expr expression being checked
* @returns {boolean} true, when the expression is a falsy literal
*/
-const isFalsyLiteral = expr => {
+const isFalsyLiteral = (expr) => {
switch (expr.type) {
case "Literal":
return !expr.value;
@@ -163,14 +163,14 @@ class CommonJsExportsParserPlugin {
/**
* @param {string=} reason reason
*/
- const bailout = reason => {
+ const bailout = (reason) => {
DynamicExports.bailout(parser.state);
if (reason) bailoutHint(reason);
};
/**
* @param {string} reason reason
*/
- const bailoutHint = reason => {
+ const bailoutHint = (reason) => {
this.moduleGraph
.getOptimizationBailout(parser.state.module)
.push(`CommonJS bailout: ${reason}`);
@@ -258,7 +258,7 @@ class CommonJsExportsParserPlugin {
});
parser.hooks.call
.for("Object.defineProperty")
- .tap(PLUGIN_NAME, expression => {
+ .tap(PLUGIN_NAME, (expression) => {
const expr = /** @type {CallExpression} */ (expression);
if (!parser.isStatementLevelExpression(expr)) return;
if (expr.arguments.length !== 3) return;
@@ -350,7 +350,7 @@ class CommonJsExportsParserPlugin {
);
parser.hooks.expression
.for("exports")
- .tap(PLUGIN_NAME, expr => handleAccessExport(expr, "exports", []));
+ .tap(PLUGIN_NAME, (expr) => handleAccessExport(expr, "exports", []));
parser.hooks.callMemberChain
.for("module")
.tap(PLUGIN_NAME, (expr, members) => {
@@ -370,7 +370,9 @@ class CommonJsExportsParserPlugin {
});
parser.hooks.expression
.for("module.exports")
- .tap(PLUGIN_NAME, expr => handleAccessExport(expr, "module.exports", []));
+ .tap(PLUGIN_NAME, (expr) =>
+ handleAccessExport(expr, "module.exports", [])
+ );
parser.hooks.callMemberChain
.for("this")
.tap(PLUGIN_NAME, (expr, members) => {
@@ -383,13 +385,13 @@ class CommonJsExportsParserPlugin {
if (!parser.scope.topLevelScope) return;
return handleAccessExport(expr, "this", members);
});
- parser.hooks.expression.for("this").tap(PLUGIN_NAME, expr => {
+ parser.hooks.expression.for("this").tap(PLUGIN_NAME, (expr) => {
if (!parser.scope.topLevelScope) return;
return handleAccessExport(expr, "this", []);
});
// Bailouts //
- parser.hooks.expression.for("module").tap(PLUGIN_NAME, expr => {
+ parser.hooks.expression.for("module").tap(PLUGIN_NAME, (expr) => {
bailout();
const isHarmony = HarmonyExports.isEnabled(parser.state);
const dep = new ModuleDecoratorDependency(
diff --git a/lib/dependencies/CommonJsImportsParserPlugin.js b/lib/dependencies/CommonJsImportsParserPlugin.js
index 82962ce7c..9bb81115c 100644
--- a/lib/dependencies/CommonJsImportsParserPlugin.js
+++ b/lib/dependencies/CommonJsImportsParserPlugin.js
@@ -91,7 +91,7 @@ class CommonJsImportsParserPlugin {
/**
* @param {string | symbol} tag tag
*/
- const tapRequireExpressionTag = tag => {
+ const tapRequireExpressionTag = (tag) => {
parser.hooks.typeof
.for(tag)
.tap(
@@ -108,7 +108,7 @@ class CommonJsImportsParserPlugin {
// #endregion
// Weird stuff //
- parser.hooks.assign.for("require").tap(PLUGIN_NAME, expr => {
+ parser.hooks.assign.for("require").tap(PLUGIN_NAME, (expr) => {
// to not leak to global "require", we need to define a local require here.
const dep = new ConstDependency("var require;", 0);
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
@@ -160,7 +160,7 @@ class CommonJsImportsParserPlugin {
* @param {Expression} expr expression
* @returns {boolean} true when set undefined
*/
- const defineUndefined = expr => {
+ const defineUndefined = (expr) => {
// To avoid "not defined" error, replace the value with undefined
const dep = new ConstDependency(
"undefined",
@@ -193,7 +193,7 @@ class CommonJsImportsParserPlugin {
* @param {Expression} expr expression
* @returns {boolean} true when handled
*/
- const requireAsExpressionHandler = expr => {
+ const requireAsExpressionHandler = (expr) => {
const dep = new CommonJsRequireContextDependency(
{
request: /** @type {string} */ (options.unknownContextRequest),
@@ -267,7 +267,7 @@ class CommonJsImportsParserPlugin {
* @param {boolean} callNew true, when require is called with new
* @returns {(expr: CallExpression | NewExpression) => (boolean | void)} handler
*/
- const createRequireHandler = callNew => expr => {
+ const createRequireHandler = (callNew) => (expr) => {
if (options.commonjsMagicComments) {
const { options: requireOptions, errors: commentErrors } =
parser.parseCommentOptions(/** @type {Range} */ (expr.range));
@@ -567,10 +567,10 @@ class CommonJsImportsParserPlugin {
parser.hooks.call
.for("require.resolve")
- .tap(PLUGIN_NAME, expr => processResolve(expr, false));
+ .tap(PLUGIN_NAME, (expr) => processResolve(expr, false));
parser.hooks.call
.for("require.resolveWeak")
- .tap(PLUGIN_NAME, expr => processResolve(expr, true));
+ .tap(PLUGIN_NAME, (expr) => processResolve(expr, true));
// #endregion
// #region Create require
@@ -607,7 +607,7 @@ class CommonJsImportsParserPlugin {
tapRequireExpressionTag(createRequireSpecifierTag);
parser.hooks.evaluateCallExpression
.for(createRequireSpecifierTag)
- .tap(PLUGIN_NAME, expr => {
+ .tap(PLUGIN_NAME, (expr) => {
const context = parseCreateRequireArguments(expr);
if (context === undefined) return;
const ident = parser.evaluatedVariable({
@@ -648,7 +648,7 @@ class CommonJsImportsParserPlugin {
* @param {CallExpression} expr call expression
* @returns {string | void} context
*/
- const parseCreateRequireArguments = expr => {
+ const parseCreateRequireArguments = (expr) => {
const args = expr.arguments;
if (args.length !== 1) {
const err = new WebpackError(
@@ -715,7 +715,7 @@ class CommonJsImportsParserPlugin {
return true;
}
);
- parser.hooks.preDeclarator.tap(PLUGIN_NAME, declarator => {
+ parser.hooks.preDeclarator.tap(PLUGIN_NAME, (declarator) => {
if (
declarator.id.type !== "Identifier" ||
!declarator.init ||
@@ -784,15 +784,17 @@ class CommonJsImportsParserPlugin {
return processResolve(expr, false);
}
});
- parser.hooks.call.for(createRequireSpecifierTag).tap(PLUGIN_NAME, expr => {
- const clearDep = new ConstDependency(
- "/* createRequire() */ undefined",
- /** @type {Range} */ (expr.range)
- );
- clearDep.loc = /** @type {DependencyLocation} */ (expr.loc);
- parser.state.module.addPresentationalDependency(clearDep);
- return true;
- });
+ parser.hooks.call
+ .for(createRequireSpecifierTag)
+ .tap(PLUGIN_NAME, (expr) => {
+ const clearDep = new ConstDependency(
+ "/* createRequire() */ undefined",
+ /** @type {Range} */ (expr.range)
+ );
+ clearDep.loc = /** @type {DependencyLocation} */ (expr.loc);
+ parser.state.module.addPresentationalDependency(clearDep);
+ return true;
+ });
// #endregion
}
}
diff --git a/lib/dependencies/CommonJsPlugin.js b/lib/dependencies/CommonJsPlugin.js
index 97b869587..194a16c77 100644
--- a/lib/dependencies/CommonJsPlugin.js
+++ b/lib/dependencies/CommonJsPlugin.js
@@ -200,7 +200,7 @@ class CommonJsPlugin {
);
parser.hooks.expression
.for(RuntimeGlobals.moduleLoaded)
- .tap(PLUGIN_NAME, expr => {
+ .tap(PLUGIN_NAME, (expr) => {
/** @type {BuildInfo} */
(parser.state.module.buildInfo).moduleConcatenationBailout =
RuntimeGlobals.moduleLoaded;
@@ -214,7 +214,7 @@ class CommonJsPlugin {
parser.hooks.expression
.for(RuntimeGlobals.moduleId)
- .tap(PLUGIN_NAME, expr => {
+ .tap(PLUGIN_NAME, (expr) => {
/** @type {BuildInfo} */
(parser.state.module.buildInfo).moduleConcatenationBailout =
RuntimeGlobals.moduleId;
diff --git a/lib/dependencies/ContextDependency.js b/lib/dependencies/ContextDependency.js
index e1d94b5ec..bcec13d18 100644
--- a/lib/dependencies/ContextDependency.js
+++ b/lib/dependencies/ContextDependency.js
@@ -27,7 +27,7 @@ const getCriticalDependencyWarning = memoize(() =>
* @param {RegExp | null | undefined} r regexp
* @returns {string} stringified regexp
*/
-const regExpToString = r => (r ? String(r) : "");
+const regExpToString = (r) => (r ? String(r) : "");
class ContextDependency extends Dependency {
/**
diff --git a/lib/dependencies/ContextDependencyHelpers.js b/lib/dependencies/ContextDependencyHelpers.js
index 6f18e062c..a0e713bff 100644
--- a/lib/dependencies/ContextDependencyHelpers.js
+++ b/lib/dependencies/ContextDependencyHelpers.js
@@ -22,13 +22,13 @@ const { parseResource } = require("../util/identifier");
* @param {string} str String to quote
* @returns {string} Escaped string
*/
-const quoteMeta = str => str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&");
+const quoteMeta = (str) => str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&");
/**
* @param {string} prefix prefix
* @returns {{prefix: string, context: string}} result
*/
-const splitContextFromPrefix = prefix => {
+const splitContextFromPrefix = (prefix) => {
const idx = prefix.lastIndexOf("/");
let context = ".";
if (idx >= 0) {
@@ -87,7 +87,7 @@ module.exports.create = (
/** @type {RegExp} */ (options.wrappedContextRegExp).source +
innerQuasis
.map(
- q =>
+ (q) =>
quoteMeta(/** @type {string} */ (q.string)) +
/** @type {RegExp} */ (options.wrappedContextRegExp).source
)
diff --git a/lib/dependencies/CssIcssExportDependency.js b/lib/dependencies/CssIcssExportDependency.js
index 5b03b9ff6..a4bb379c9 100644
--- a/lib/dependencies/CssIcssExportDependency.js
+++ b/lib/dependencies/CssIcssExportDependency.js
@@ -65,7 +65,7 @@ class CssIcssExportDependency extends NullDependency {
(generator.convention)
);
return {
- exports: names.map(name => ({
+ exports: names.map((name) => ({
name,
canMangle: true
})),
@@ -139,7 +139,7 @@ CssIcssExportDependency.Template = class CssIcssExportDependencyTemplate extends
/** @type {string[]} */
(
names
- .map(name =>
+ .map((name) =>
moduleGraph.getExportInfo(module, name).getUsedName(name, runtime)
)
.filter(Boolean)
diff --git a/lib/dependencies/CssLocalIdentifierDependency.js b/lib/dependencies/CssLocalIdentifierDependency.js
index 4592c45b1..3be3ef038 100644
--- a/lib/dependencies/CssLocalIdentifierDependency.js
+++ b/lib/dependencies/CssLocalIdentifierDependency.js
@@ -127,7 +127,7 @@ class CssLocalIdentifierDependency extends NullDependency {
/** @type {CssGeneratorExportsConvention} */ (generator.convention)
);
return {
- exports: names.map(name => ({
+ exports: names.map((name) => ({
name,
canMangle: true
})),
@@ -225,7 +225,7 @@ CssLocalIdentifierDependency.Template = class CssLocalIdentifierDependencyTempla
/** @type {string[]} */
(
names
- .map(name =>
+ .map((name) =>
moduleGraph.getExportInfo(module, name).getUsedName(name, runtime)
)
.filter(Boolean)
diff --git a/lib/dependencies/CssUrlDependency.js b/lib/dependencies/CssUrlDependency.js
index ad3ec31fe..a7cb4349c 100644
--- a/lib/dependencies/CssUrlDependency.js
+++ b/lib/dependencies/CssUrlDependency.js
@@ -82,7 +82,7 @@ class CssUrlDependency extends ModuleDependency {
* @param {string} str string
* @returns {string} string in quotes if needed
*/
-const cssEscapeString = str => {
+const cssEscapeString = (str) => {
let countWhiteOrBracket = 0;
let countQuotation = 0;
let countApostrophe = 0;
@@ -105,11 +105,11 @@ const cssEscapeString = str => {
}
}
if (countWhiteOrBracket < 2) {
- return str.replace(/[\n\t ()'"\\]/g, m => `\\${m}`);
+ return str.replace(/[\n\t ()'"\\]/g, (m) => `\\${m}`);
} else if (countQuotation <= countApostrophe) {
- return `"${str.replace(/[\n"\\]/g, m => `\\${m}`)}"`;
+ return `"${str.replace(/[\n"\\]/g, (m) => `\\${m}`)}"`;
}
- return `'${str.replace(/[\n'\\]/g, m => `\\${m}`)}'`;
+ return `'${str.replace(/[\n'\\]/g, (m) => `\\${m}`)}'`;
};
CssUrlDependency.Template = class CssUrlDependencyTemplate extends (
diff --git a/lib/dependencies/DynamicExports.js b/lib/dependencies/DynamicExports.js
index 4e983ddbd..1d97fa5a9 100644
--- a/lib/dependencies/DynamicExports.js
+++ b/lib/dependencies/DynamicExports.js
@@ -15,7 +15,7 @@ const parserStateExportsState = new WeakMap();
* @param {ParserState} parserState parser state
* @returns {void}
*/
-module.exports.bailout = parserState => {
+module.exports.bailout = (parserState) => {
const value = parserStateExportsState.get(parserState);
parserStateExportsState.set(parserState, false);
if (value === true) {
@@ -29,7 +29,7 @@ module.exports.bailout = parserState => {
* @param {ParserState} parserState parser state
* @returns {void}
*/
-module.exports.enable = parserState => {
+module.exports.enable = (parserState) => {
const value = parserStateExportsState.get(parserState);
if (value === false) return;
parserStateExportsState.set(parserState, true);
@@ -44,7 +44,7 @@ module.exports.enable = parserState => {
* @param {ParserState} parserState parser state
* @returns {boolean} true, when enabled
*/
-module.exports.isEnabled = parserState => {
+module.exports.isEnabled = (parserState) => {
const value = parserStateExportsState.get(parserState);
return value === true;
};
@@ -53,7 +53,7 @@ module.exports.isEnabled = parserState => {
* @param {ParserState} parserState parser state
* @returns {void}
*/
-module.exports.setDynamic = parserState => {
+module.exports.setDynamic = (parserState) => {
const value = parserStateExportsState.get(parserState);
if (value !== true) return;
/** @type {BuildMeta} */
@@ -64,7 +64,7 @@ module.exports.setDynamic = parserState => {
* @param {ParserState} parserState parser state
* @returns {void}
*/
-module.exports.setFlagged = parserState => {
+module.exports.setFlagged = (parserState) => {
const value = parserStateExportsState.get(parserState);
if (value !== true) return;
const buildMeta = /** @type {BuildMeta} */ (parserState.module.buildMeta);
diff --git a/lib/dependencies/HarmonyAcceptDependency.js b/lib/dependencies/HarmonyAcceptDependency.js
index 4817b722d..24ee759ed 100644
--- a/lib/dependencies/HarmonyAcceptDependency.js
+++ b/lib/dependencies/HarmonyAcceptDependency.js
@@ -83,7 +83,7 @@ HarmonyAcceptDependency.Template = class HarmonyAcceptDependencyTemplate extends
chunkGraph
} = templateContext;
const content = dep.dependencies
- .map(dependency => {
+ .map((dependency) => {
const referencedModule = moduleGraph.getModule(dependency);
return {
dependency,
diff --git a/lib/dependencies/HarmonyDetectionParserPlugin.js b/lib/dependencies/HarmonyDetectionParserPlugin.js
index dcb2d145c..7edd8dd5d 100644
--- a/lib/dependencies/HarmonyDetectionParserPlugin.js
+++ b/lib/dependencies/HarmonyDetectionParserPlugin.js
@@ -31,13 +31,13 @@ module.exports = class HarmonyDetectionParserPlugin {
* @returns {void}
*/
apply(parser) {
- parser.hooks.program.tap(PLUGIN_NAME, ast => {
+ parser.hooks.program.tap(PLUGIN_NAME, (ast) => {
const isStrictHarmony =
parser.state.module.type === JAVASCRIPT_MODULE_TYPE_ESM;
const isHarmony =
isStrictHarmony ||
ast.body.some(
- statement =>
+ (statement) =>
statement.type === "ImportDeclaration" ||
statement.type === "ExportDefaultDeclaration" ||
statement.type === "ExportNamedDeclaration" ||
diff --git a/lib/dependencies/HarmonyExportDependencyParserPlugin.js b/lib/dependencies/HarmonyExportDependencyParserPlugin.js
index 4349b0b26..dfb9f5463 100644
--- a/lib/dependencies/HarmonyExportDependencyParserPlugin.js
+++ b/lib/dependencies/HarmonyExportDependencyParserPlugin.js
@@ -53,7 +53,7 @@ module.exports = class HarmonyExportDependencyParserPlugin {
*/
apply(parser) {
const { exportPresenceMode } = this;
- parser.hooks.export.tap(PLUGIN_NAME, statement => {
+ parser.hooks.export.tap(PLUGIN_NAME, (statement) => {
const dep = new HarmonyExportHeaderDependency(
/** @type {Range | false} */ (
statement.declaration && statement.declaration.range
@@ -107,7 +107,7 @@ module.exports = class HarmonyExportDependencyParserPlugin {
exprRange,
statementRange,
comments
- .map(c => {
+ .map((c) => {
switch (c.type) {
case "Block":
return `/*${c.value}*/`;
diff --git a/lib/dependencies/HarmonyExportImportedSpecifierDependency.js b/lib/dependencies/HarmonyExportImportedSpecifierDependency.js
index 07fad95cc..4fff1a164 100644
--- a/lib/dependencies/HarmonyExportImportedSpecifierDependency.js
+++ b/lib/dependencies/HarmonyExportImportedSpecifierDependency.js
@@ -334,7 +334,7 @@ const getMode = (moduleGraph, dep, runtimeKey) => {
mode.items = Array.from(
exports,
- exportName =>
+ (exportName) =>
new NormalReexportItem(
exportName,
[exportName],
@@ -722,7 +722,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
return {
exports: Array.from(
/** @type {NormalReexportItem[]} */ (mode.items),
- item => ({
+ (item) => ({
name: item.name,
from,
export: item.ids,
@@ -930,7 +930,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
}' contains conflicting star exports for the ${
exports.length > 1 ? "names" : "name"
} ${exports
- .map(e => `'${e}'`)
+ .map((e) => `'${e}'`)
.join(", ")} with the previous requested module '${request}'`
)
);
@@ -1190,7 +1190,7 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS
const runtimeCondition = dep.weak
? false
: connection
- ? filterRuntime(runtime, r => connection.isTargetActive(r))
+ ? filterRuntime(runtime, (r) => connection.isTargetActive(r))
: true;
initFragments.push(
new ConditionalInitFragment(
diff --git a/lib/dependencies/HarmonyExportInitFragment.js b/lib/dependencies/HarmonyExportInitFragment.js
index 9b4b025c1..d81cbad92 100644
--- a/lib/dependencies/HarmonyExportInitFragment.js
+++ b/lib/dependencies/HarmonyExportInitFragment.js
@@ -17,7 +17,7 @@ const { propertyName } = require("../util/propertyName");
* @param {Iterable} iterable iterable strings
* @returns {string} result
*/
-const joinIterableWithComma = iterable => {
+const joinIterableWithComma = (iterable) => {
// This is more performant than Array.from().join(", ")
// as it doesn't create an array
let str = "";
diff --git a/lib/dependencies/HarmonyExports.js b/lib/dependencies/HarmonyExports.js
index 1f6e6d4ac..fe1b28d4e 100644
--- a/lib/dependencies/HarmonyExports.js
+++ b/lib/dependencies/HarmonyExports.js
@@ -40,7 +40,7 @@ module.exports.enable = (parserState, isStrictHarmony) => {
* @param {ParserState} parserState parser state
* @returns {boolean} true, when enabled
*/
-module.exports.isEnabled = parserState => {
+module.exports.isEnabled = (parserState) => {
const value = parserStateExportsState.get(parserState);
return value === true;
};
diff --git a/lib/dependencies/HarmonyImportDependency.js b/lib/dependencies/HarmonyImportDependency.js
index 4ac805c80..22b6cdb33 100644
--- a/lib/dependencies/HarmonyImportDependency.js
+++ b/lib/dependencies/HarmonyImportDependency.js
@@ -183,7 +183,7 @@ class HarmonyImportDependency extends ModuleDependency {
new HarmonyLinkingError(
`export ${ids
.slice(0, pos)
- .map(id => `'${id}'`)
+ .map((id) => `'${id}'`)
.join(".")} ${additionalMessage} was not found in '${
this.userRequest
}'${moreInfo}`
@@ -199,7 +199,7 @@ class HarmonyImportDependency extends ModuleDependency {
return [
new HarmonyLinkingError(
`export ${ids
- .map(id => `'${id}'`)
+ .map((id) => `'${id}'`)
.join(".")} ${additionalMessage} was not found in '${
this.userRequest
}'`
@@ -215,7 +215,7 @@ class HarmonyImportDependency extends ModuleDependency {
return [
new HarmonyLinkingError(
`Can't import the named export ${ids
- .map(id => `'${id}'`)
+ .map((id) => `'${id}'`)
.join(
"."
)} ${additionalMessage} from default-exporting module (only default export is available)`
@@ -236,7 +236,7 @@ class HarmonyImportDependency extends ModuleDependency {
return [
new HarmonyLinkingError(
`Should not import the named export ${ids
- .map(id => `'${id}'`)
+ .map((id) => `'${id}'`)
.join(
"."
)} ${additionalMessage} from default-exporting module (only default export is available soon)`
@@ -310,7 +310,7 @@ HarmonyImportDependency.Template = class HarmonyImportDependencyTemplate extends
const runtimeCondition = dep.weak
? false
: connection
- ? filterRuntime(runtime, r => connection.isTargetActive(r))
+ ? filterRuntime(runtime, (r) => connection.isTargetActive(r))
: true;
if (module && referencedModule) {
diff --git a/lib/dependencies/HarmonyImportDependencyParserPlugin.js b/lib/dependencies/HarmonyImportDependencyParserPlugin.js
index 007c4261f..4e131dda3 100644
--- a/lib/dependencies/HarmonyImportDependencyParserPlugin.js
+++ b/lib/dependencies/HarmonyImportDependencyParserPlugin.js
@@ -102,7 +102,7 @@ module.exports = class HarmonyImportDependencyParserPlugin {
return node;
}
- parser.hooks.isPure.for("Identifier").tap(PLUGIN_NAME, expression => {
+ parser.hooks.isPure.for("Identifier").tap(PLUGIN_NAME, (expression) => {
const expr = /** @type {Identifier} */ (expression);
if (
parser.isVariableDefined(expr.name) ||
@@ -162,7 +162,7 @@ module.exports = class HarmonyImportDependencyParserPlugin {
return true;
}
);
- parser.hooks.binaryExpression.tap(PLUGIN_NAME, expression => {
+ parser.hooks.binaryExpression.tap(PLUGIN_NAME, (expression) => {
if (expression.operator !== "in") return;
const leftPartEvaluated = parser.evaluateExpression(expression.left);
@@ -204,34 +204,38 @@ module.exports = class HarmonyImportDependencyParserPlugin {
);
dep.loc = /** @type {DependencyLocation} */ (expression.loc);
parser.state.module.addDependency(dep);
- InnerGraph.onUsage(parser.state, e => (dep.usedByExports = e));
- return true;
- });
- parser.hooks.expression.for(harmonySpecifierTag).tap(PLUGIN_NAME, expr => {
- const settings = /** @type {HarmonySettings} */ (parser.currentTagData);
- const dep = new HarmonyImportSpecifierDependency(
- settings.source,
- settings.sourceOrder,
- settings.ids,
- settings.name,
- /** @type {Range} */
- (expr.range),
- exportPresenceMode,
- settings.attributes,
- [],
- settings.defer
- );
- dep.referencedPropertiesInDestructuring =
- parser.destructuringAssignmentPropertiesFor(expr);
- dep.shorthand = parser.scope.inShorthand;
- dep.directImport = true;
- dep.asiSafe = !parser.isAsiPosition(/** @type {Range} */ (expr.range)[0]);
- dep.loc = /** @type {DependencyLocation} */ (expr.loc);
- dep.call = parser.scope.inTaggedTemplateTag;
- parser.state.module.addDependency(dep);
- InnerGraph.onUsage(parser.state, e => (dep.usedByExports = e));
+ InnerGraph.onUsage(parser.state, (e) => (dep.usedByExports = e));
return true;
});
+ parser.hooks.expression
+ .for(harmonySpecifierTag)
+ .tap(PLUGIN_NAME, (expr) => {
+ const settings = /** @type {HarmonySettings} */ (parser.currentTagData);
+ const dep = new HarmonyImportSpecifierDependency(
+ settings.source,
+ settings.sourceOrder,
+ settings.ids,
+ settings.name,
+ /** @type {Range} */
+ (expr.range),
+ exportPresenceMode,
+ settings.attributes,
+ [],
+ settings.defer
+ );
+ dep.referencedPropertiesInDestructuring =
+ parser.destructuringAssignmentPropertiesFor(expr);
+ dep.shorthand = parser.scope.inShorthand;
+ dep.directImport = true;
+ dep.asiSafe = !parser.isAsiPosition(
+ /** @type {Range} */ (expr.range)[0]
+ );
+ dep.loc = /** @type {DependencyLocation} */ (expr.loc);
+ dep.call = parser.scope.inTaggedTemplateTag;
+ parser.state.module.addDependency(dep);
+ InnerGraph.onUsage(parser.state, (e) => (dep.usedByExports = e));
+ return true;
+ });
parser.hooks.expressionMemberChain
.for(harmonySpecifierTag)
.tap(
@@ -277,7 +281,7 @@ module.exports = class HarmonyImportDependencyParserPlugin {
);
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.module.addDependency(dep);
- InnerGraph.onUsage(parser.state, e => (dep.usedByExports = e));
+ InnerGraph.onUsage(parser.state, (e) => (dep.usedByExports = e));
return true;
}
);
@@ -331,7 +335,7 @@ module.exports = class HarmonyImportDependencyParserPlugin {
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.module.addDependency(dep);
if (args) parser.walkExpressions(args);
- InnerGraph.onUsage(parser.state, e => (dep.usedByExports = e));
+ InnerGraph.onUsage(parser.state, (e) => (dep.usedByExports = e));
return true;
}
);
@@ -342,7 +346,7 @@ module.exports = class HarmonyImportDependencyParserPlugin {
// This is not a harmony module, skip it
return;
}
- const dependencies = requests.map(request => {
+ const dependencies = requests.map((request) => {
const dep = new HarmonyAcceptImportDependency(request);
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.module.addDependency(dep);
@@ -364,7 +368,7 @@ module.exports = class HarmonyImportDependencyParserPlugin {
// This is not a harmony module, skip it
return;
}
- const dependencies = requests.map(request => {
+ const dependencies = requests.map((request) => {
const dep = new HarmonyAcceptImportDependency(request);
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.module.addDependency(dep);
diff --git a/lib/dependencies/HarmonyImportSideEffectDependency.js b/lib/dependencies/HarmonyImportSideEffectDependency.js
index 5911c5b33..efa708db0 100644
--- a/lib/dependencies/HarmonyImportSideEffectDependency.js
+++ b/lib/dependencies/HarmonyImportSideEffectDependency.js
@@ -42,7 +42,7 @@ class HarmonyImportSideEffectDependency extends HarmonyImportDependency {
* @returns {null | false | GetConditionFn} function to determine if the connection is active
*/
getCondition(moduleGraph) {
- return connection => {
+ return (connection) => {
const refModule = connection.resolvedModule;
if (!refModule) return true;
return refModule.getSideEffectsConnectionState(moduleGraph);
diff --git a/lib/dependencies/HarmonyTopLevelThisParserPlugin.js b/lib/dependencies/HarmonyTopLevelThisParserPlugin.js
index c8a3061a0..5039eb9da 100644
--- a/lib/dependencies/HarmonyTopLevelThisParserPlugin.js
+++ b/lib/dependencies/HarmonyTopLevelThisParserPlugin.js
@@ -20,7 +20,7 @@ class HarmonyTopLevelThisParserPlugin {
* @returns {void}
*/
apply(parser) {
- parser.hooks.expression.for("this").tap(PLUGIN_NAME, node => {
+ parser.hooks.expression.for("this").tap(PLUGIN_NAME, (node) => {
if (!parser.scope.topLevelScope) return;
if (HarmonyExports.isEnabled(parser.state)) {
const dep = new ConstDependency(
diff --git a/lib/dependencies/ImportMetaContextDependencyParserPlugin.js b/lib/dependencies/ImportMetaContextDependencyParserPlugin.js
index 6b5c2bb6a..d52c09d5c 100644
--- a/lib/dependencies/ImportMetaContextDependencyParserPlugin.js
+++ b/lib/dependencies/ImportMetaContextDependencyParserPlugin.js
@@ -62,7 +62,7 @@ module.exports = class ImportMetaContextDependencyParserPlugin {
apply(parser) {
parser.hooks.evaluateIdentifier
.for("import.meta.webpackContext")
- .tap(PLUGIN_NAME, expr =>
+ .tap(PLUGIN_NAME, (expr) =>
evaluateToIdentifier(
"import.meta.webpackContext",
"import.meta",
@@ -72,7 +72,7 @@ module.exports = class ImportMetaContextDependencyParserPlugin {
);
parser.hooks.call
.for("import.meta.webpackContext")
- .tap(PLUGIN_NAME, expr => {
+ .tap(PLUGIN_NAME, (expr) => {
if (expr.arguments.length < 1 || expr.arguments.length > 2) return;
const [directoryNode, optionsNode] = expr.arguments;
if (optionsNode && optionsNode.type !== "ObjectExpression") return;
@@ -178,11 +178,11 @@ module.exports = class ImportMetaContextDependencyParserPlugin {
/** @type {BasicEvaluatedExpression[]} */
(expr.items);
if (
- items.every(i => {
+ items.every((i) => {
if (!i.isArray()) return false;
const innerItems =
/** @type {BasicEvaluatedExpression[]} */ (i.items);
- return innerItems.every(i => i.isString());
+ return innerItems.every((i) => i.isString());
})
) {
exports = [];
diff --git a/lib/dependencies/ImportMetaPlugin.js b/lib/dependencies/ImportMetaPlugin.js
index 779f44b92..17817f7de 100644
--- a/lib/dependencies/ImportMetaPlugin.js
+++ b/lib/dependencies/ImportMetaPlugin.js
@@ -49,7 +49,7 @@ class ImportMetaPlugin {
* @param {NormalModule} module module
* @returns {string} file url
*/
- const getUrl = module => pathToFileURL(module.resource).toString();
+ const getUrl = (module) => pathToFileURL(module.resource).toString();
/**
* @param {Parser} parser parser parser
* @param {JavascriptParserOptions} parserOptions parserOptions
@@ -62,7 +62,7 @@ class ImportMetaPlugin {
parser.hooks.expression
.for("import.meta")
- .tap(PLUGIN_NAME, metaProperty => {
+ .tap(PLUGIN_NAME, (metaProperty) => {
const dep = new ConstDependency(
/** @type {string} */ (importMetaName),
/** @type {Range} */ (metaProperty.range)
@@ -86,7 +86,7 @@ class ImportMetaPlugin {
* @param {string[]} members members
* @returns {string} error message
*/
- const importMetaUnknownProperty = members =>
+ const importMetaUnknownProperty = (members) =>
`${Template.toNormalComment(
`unsupported import.meta.${members.join(".")}`
)} undefined${propertyAccess(members, 1)}`;
@@ -98,7 +98,7 @@ class ImportMetaPlugin {
);
parser.hooks.expression
.for("import.meta")
- .tap(PLUGIN_NAME, metaProperty => {
+ .tap(PLUGIN_NAME, (metaProperty) => {
const referencedPropertiesInDestructuring =
parser.destructuringAssignmentPropertiesFor(metaProperty);
if (!referencedPropertiesInDestructuring) {
@@ -169,7 +169,7 @@ class ImportMetaPlugin {
);
parser.hooks.expression
.for("import.meta.url")
- .tap(PLUGIN_NAME, expr => {
+ .tap(PLUGIN_NAME, (expr) => {
const dep = new ConstDependency(
importMetaUrl(),
/** @type {Range} */ (expr.range)
@@ -183,7 +183,7 @@ class ImportMetaPlugin {
.tap(PLUGIN_NAME, evaluateToString("string"));
parser.hooks.evaluateIdentifier
.for("import.meta.url")
- .tap(PLUGIN_NAME, expr =>
+ .tap(PLUGIN_NAME, (expr) =>
new BasicEvaluatedExpression()
.setString(getUrl(parser.state.module))
.setRange(/** @type {Range} */ (expr.range))
@@ -223,7 +223,7 @@ class ImportMetaPlugin {
});
parser.hooks.evaluate
.for("MemberExpression")
- .tap(PLUGIN_NAME, expression => {
+ .tap(PLUGIN_NAME, (expression) => {
const expr = /** @type {MemberExpression} */ (expression);
if (
expr.object.type === "MetaProperty" &&
diff --git a/lib/dependencies/ImportParserPlugin.js b/lib/dependencies/ImportParserPlugin.js
index b41e43dd6..8ad5da34b 100644
--- a/lib/dependencies/ImportParserPlugin.js
+++ b/lib/dependencies/ImportParserPlugin.js
@@ -44,9 +44,9 @@ class ImportParserPlugin {
* @param {Iterable} enumerable enumerable
* @returns {T[][]} array of array
*/
- const exportsFromEnumerable = enumerable =>
- Array.from(enumerable, e => [e]);
- parser.hooks.importCall.tap(PLUGIN_NAME, expr => {
+ const exportsFromEnumerable = (enumerable) =>
+ Array.from(enumerable, (e) => [e]);
+ parser.hooks.importCall.tap(PLUGIN_NAME, (expr) => {
const param = parser.evaluateExpression(expr.source);
let chunkName = null;
@@ -240,7 +240,7 @@ class ImportParserPlugin {
typeof importOptions.webpackExports === "string" ||
(Array.isArray(importOptions.webpackExports) &&
/** @type {string[]} */ (importOptions.webpackExports).every(
- item => typeof item === "string"
+ (item) => typeof item === "string"
))
)
) {
diff --git a/lib/dependencies/JsonExportsDependency.js b/lib/dependencies/JsonExportsDependency.js
index 08e062ab3..b283eb741 100644
--- a/lib/dependencies/JsonExportsDependency.js
+++ b/lib/dependencies/JsonExportsDependency.js
@@ -30,7 +30,7 @@ const NullDependency = require("./NullDependency");
* @param {number} exportsDepth exportsDepth
* @returns {GetExportsFromDataFn} value
*/
-const getExportsWithDepth = exportsDepth =>
+const getExportsWithDepth = (exportsDepth) =>
/** @type {GetExportsFromDataFn} */
function getExportsFromData(data, curDepth = 1) {
if (curDepth > exportsDepth) {
diff --git a/lib/dependencies/LoaderPlugin.js b/lib/dependencies/LoaderPlugin.js
index b61bfa303..c57250eae 100644
--- a/lib/dependencies/LoaderPlugin.js
+++ b/lib/dependencies/LoaderPlugin.js
@@ -54,11 +54,11 @@ class LoaderPlugin {
}
);
- compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
+ compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
const moduleGraph = compilation.moduleGraph;
NormalModule.getCompilationHooks(compilation).loader.tap(
PLUGIN_NAME,
- loaderContext => {
+ (loaderContext) => {
loaderContext.loadModule = (request, callback) => {
const dep = new LoaderDependency(request);
dep.loc = {
@@ -91,7 +91,7 @@ class LoaderPlugin {
context: loaderContext.context,
recursive: false
},
- err => {
+ (err) => {
compilation.factorizeQueue.setContext(oldFactorizeQueueContext);
compilation.addModuleQueue.setContext(oldAddModuleQueueContext);
compilation.buildQueue.decreaseParallelism();
@@ -196,7 +196,7 @@ class LoaderPlugin {
connectOrigin: false,
checkCycle: true
},
- err => {
+ (err) => {
compilation.factorizeQueue.setContext(oldFactorizeQueueContext);
compilation.addModuleQueue.setContext(oldAddModuleQueueContext);
compilation.buildQueue.decreaseParallelism();
diff --git a/lib/dependencies/ProvidedDependency.js b/lib/dependencies/ProvidedDependency.js
index 9f1d3f6e7..422e1b63d 100644
--- a/lib/dependencies/ProvidedDependency.js
+++ b/lib/dependencies/ProvidedDependency.js
@@ -29,9 +29,9 @@ const ModuleDependency = require("./ModuleDependency");
* @param {string[]|null} path the property path array
* @returns {string} the converted path
*/
-const pathToString = path =>
+const pathToString = (path) =>
path !== null && path.length > 0
- ? path.map(part => `[${JSON.stringify(part)}]`).join("")
+ ? path.map((part) => `[${JSON.stringify(part)}]`).join("")
: "";
class ProvidedDependency extends ModuleDependency {
diff --git a/lib/dependencies/PureExpressionDependency.js b/lib/dependencies/PureExpressionDependency.js
index 3c4312c98..1df2517db 100644
--- a/lib/dependencies/PureExpressionDependency.js
+++ b/lib/dependencies/PureExpressionDependency.js
@@ -47,7 +47,7 @@ class PureExpressionDependency extends NullDependency {
/** @type {Module} */
(moduleGraph.getParentModule(this));
const exportsInfo = moduleGraph.getExportsInfo(selfModule);
- const runtimeCondition = filterRuntime(runtime, runtime => {
+ const runtimeCondition = filterRuntime(runtime, (runtime) => {
for (const exportName of usedByExports) {
if (exportsInfo.getUsed(exportName, runtime) !== UsageState.Unused) {
return true;
diff --git a/lib/dependencies/RequireContextDependencyParserPlugin.js b/lib/dependencies/RequireContextDependencyParserPlugin.js
index 9f794ba6d..08ac21631 100644
--- a/lib/dependencies/RequireContextDependencyParserPlugin.js
+++ b/lib/dependencies/RequireContextDependencyParserPlugin.js
@@ -20,7 +20,7 @@ module.exports = class RequireContextDependencyParserPlugin {
* @returns {void}
*/
apply(parser) {
- parser.hooks.call.for("require.context").tap(PLUGIN_NAME, expr => {
+ parser.hooks.call.for("require.context").tap(PLUGIN_NAME, (expr) => {
let regExp = /^\.\/.*$/;
let recursive = true;
/** @type {ContextMode} */
diff --git a/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js b/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js
index 9f9bc0c0a..9c9a9c686 100644
--- a/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js
+++ b/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js
@@ -25,7 +25,7 @@ module.exports = class RequireEnsureDependenciesBlockParserPlugin {
* @returns {void}
*/
apply(parser) {
- parser.hooks.call.for("require.ensure").tap(PLUGIN_NAME, expr => {
+ parser.hooks.call.for("require.ensure").tap(PLUGIN_NAME, (expr) => {
/** @type {string | GroupOptions | null} */
let chunkName = null;
let errorExpressionArg = null;
diff --git a/lib/dependencies/RequireIncludeDependencyParserPlugin.js b/lib/dependencies/RequireIncludeDependencyParserPlugin.js
index ede50250d..d6f59bf72 100644
--- a/lib/dependencies/RequireIncludeDependencyParserPlugin.js
+++ b/lib/dependencies/RequireIncludeDependencyParserPlugin.js
@@ -33,7 +33,7 @@ module.exports = class RequireIncludeDependencyParserPlugin {
*/
apply(parser) {
const { warn } = this;
- parser.hooks.call.for("require.include").tap(PLUGIN_NAME, expr => {
+ parser.hooks.call.for("require.include").tap(PLUGIN_NAME, (expr) => {
if (expr.arguments.length !== 1) return;
const param = parser.evaluateExpression(expr.arguments[0]);
if (!param.isString()) return;
@@ -57,7 +57,7 @@ module.exports = class RequireIncludeDependencyParserPlugin {
});
parser.hooks.evaluateTypeof
.for("require.include")
- .tap(PLUGIN_NAME, expr => {
+ .tap(PLUGIN_NAME, (expr) => {
if (warn) {
parser.state.module.addWarning(
new RequireIncludeDeprecationWarning(
@@ -67,7 +67,7 @@ module.exports = class RequireIncludeDependencyParserPlugin {
}
return evaluateToString("function")(expr);
});
- parser.hooks.typeof.for("require.include").tap(PLUGIN_NAME, expr => {
+ parser.hooks.typeof.for("require.include").tap(PLUGIN_NAME, (expr) => {
if (warn) {
parser.state.module.addWarning(
new RequireIncludeDeprecationWarning(
diff --git a/lib/dependencies/SystemPlugin.js b/lib/dependencies/SystemPlugin.js
index b0e09fd1b..bd0ca2558 100644
--- a/lib/dependencies/SystemPlugin.js
+++ b/lib/dependencies/SystemPlugin.js
@@ -63,7 +63,7 @@ class SystemPlugin {
/**
* @param {string} name name
*/
- const setNotSupported = name => {
+ const setNotSupported = (name) => {
parser.hooks.evaluateTypeof
.for(name)
.tap(PLUGIN_NAME, evaluateToString("undefined"));
@@ -101,7 +101,7 @@ class SystemPlugin {
setNotSupported("System.get");
setNotSupported("System.register");
- parser.hooks.expression.for("System").tap(PLUGIN_NAME, expr => {
+ parser.hooks.expression.for("System").tap(PLUGIN_NAME, (expr) => {
const dep = new ConstDependency(
RuntimeGlobals.system,
/** @type {Range} */ (expr.range),
@@ -112,7 +112,7 @@ class SystemPlugin {
return true;
});
- parser.hooks.call.for("System.import").tap(PLUGIN_NAME, expr => {
+ parser.hooks.call.for("System.import").tap(PLUGIN_NAME, (expr) => {
parser.state.module.addWarning(
new SystemImportDeprecationWarning(
/** @type {DependencyLocation} */ (expr.loc)
diff --git a/lib/dependencies/WorkerPlugin.js b/lib/dependencies/WorkerPlugin.js
index 8aea2db26..6d28cfbe0 100644
--- a/lib/dependencies/WorkerPlugin.js
+++ b/lib/dependencies/WorkerPlugin.js
@@ -54,7 +54,7 @@ const WorkerDependency = require("./WorkerDependency");
* @param {NormalModule} module module
* @returns {string} url
*/
-const getUrl = module => pathToFileURL(module.resource).toString();
+const getUrl = (module) => pathToFileURL(module.resource).toString();
const WorkerSpecifierTag = Symbol("worker specifier tag");
@@ -253,7 +253,7 @@ class WorkerPlugin {
* @param {CallExpression} expr expression
* @returns {boolean | void} true when handled
*/
- const handleNewWorker = expr => {
+ const handleNewWorker = (expr) => {
if (expr.arguments.length === 0 || expr.arguments.length > 2) {
return;
}
@@ -483,7 +483,7 @@ class WorkerPlugin {
/**
* @param {string} item item
*/
- const processItem = item => {
+ const processItem = (item) => {
if (
item.startsWith("*") &&
item.includes(".") &&
@@ -505,7 +505,7 @@ class WorkerPlugin {
}
}
);
- parser.hooks.pattern.for(pattern).tap(PLUGIN_NAME, pattern => {
+ parser.hooks.pattern.for(pattern).tap(PLUGIN_NAME, (pattern) => {
parser.tagVariable(pattern.name, WorkerSpecifierTag);
return true;
});
@@ -530,7 +530,7 @@ class WorkerPlugin {
const source = match[3];
(call ? parser.hooks.call : parser.hooks.new)
.for(harmonySpecifierTag)
- .tap(PLUGIN_NAME, expr => {
+ .tap(PLUGIN_NAME, (expr) => {
const settings = /** @type {HarmonySettings} */ (
parser.currentTagData
);
diff --git a/lib/dependencies/getFunctionExpression.js b/lib/dependencies/getFunctionExpression.js
index f4495b500..e213fa6ce 100644
--- a/lib/dependencies/getFunctionExpression.js
+++ b/lib/dependencies/getFunctionExpression.js
@@ -14,7 +14,7 @@
* @param {Expression | SpreadElement} expr expressions
* @returns {{fn: FunctionExpression | ArrowFunctionExpression, expressions: (Expression | SpreadElement)[], needThis: boolean | undefined } | undefined} function expression with additional information
*/
-module.exports = expr => {
+module.exports = (expr) => {
//
if (
expr.type === "FunctionExpression" ||
diff --git a/lib/esm/ModuleChunkFormatPlugin.js b/lib/esm/ModuleChunkFormatPlugin.js
index 61c18ed15..f6a6331b4 100644
--- a/lib/esm/ModuleChunkFormatPlugin.js
+++ b/lib/esm/ModuleChunkFormatPlugin.js
@@ -119,7 +119,7 @@ class ModuleChunkFormatPlugin {
* @returns {void}
*/
apply(compiler) {
- compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => {
+ compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
compilation.hooks.additionalChunkRuntimeRequirements.tap(
PLUGIN_NAME,
(chunk, set) => {
diff --git a/lib/esm/ModuleChunkLoadingPlugin.js b/lib/esm/ModuleChunkLoadingPlugin.js
index a34f990a2..01ff5ae05 100644
--- a/lib/esm/ModuleChunkLoadingPlugin.js
+++ b/lib/esm/ModuleChunkLoadingPlugin.js
@@ -21,13 +21,13 @@ class ModuleChunkLoadingPlugin {
* @returns {void}
*/
apply(compiler) {
- compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => {
+ compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
const globalChunkLoading = compilation.outputOptions.chunkLoading;
/**
* @param {Chunk} chunk chunk to check
* @returns {boolean} true, when the plugin is enabled for the chunk
*/
- const isEnabledForChunk = chunk => {
+ const isEnabledForChunk = (chunk) => {
const options = chunk.getEntryOptions();
const chunkLoading =
options && options.chunkLoading !== undefined
diff --git a/lib/esm/ModuleChunkLoadingRuntimeModule.js b/lib/esm/ModuleChunkLoadingRuntimeModule.js
index 7c3e94d13..cd2b8e61b 100644
--- a/lib/esm/ModuleChunkLoadingRuntimeModule.js
+++ b/lib/esm/ModuleChunkLoadingRuntimeModule.js
@@ -159,7 +159,7 @@ class ModuleChunkLoadingRuntimeModule extends RuntimeModule {
stateExpression ? `${stateExpression} = ${stateExpression} || ` : ""
}{`,
Template.indent(
- Array.from(initialChunkIds, id => `${JSON.stringify(id)}: 0`).join(
+ Array.from(initialChunkIds, (id) => `${JSON.stringify(id)}: 0`).join(
",\n"
)
),
diff --git a/lib/formatLocation.js b/lib/formatLocation.js
index 780d4a475..f75bc73ed 100644
--- a/lib/formatLocation.js
+++ b/lib/formatLocation.js
@@ -12,7 +12,7 @@
* @param {SourcePosition} pos position
* @returns {string} formatted position
*/
-const formatPosition = pos => {
+const formatPosition = (pos) => {
if (pos && typeof pos === "object") {
if ("line" in pos && "column" in pos) {
return `${pos.line}:${pos.column}`;
@@ -27,7 +27,7 @@ const formatPosition = pos => {
* @param {DependencyLocation} loc location
* @returns {string} formatted location
*/
-const formatLocation = loc => {
+const formatLocation = (loc) => {
if (loc && typeof loc === "object") {
if ("start" in loc && loc.start && "end" in loc && loc.end) {
if (
diff --git a/lib/hmr/JavascriptHotModuleReplacementHelper.js b/lib/hmr/JavascriptHotModuleReplacementHelper.js
index 997473573..935fce0cc 100644
--- a/lib/hmr/JavascriptHotModuleReplacementHelper.js
+++ b/lib/hmr/JavascriptHotModuleReplacementHelper.js
@@ -13,7 +13,7 @@ const Template = require("../Template");
* @param {string} type unique identifier used for HMR runtime properties
* @returns {string} HMR runtime code
*/
-const generateJavascriptHMR = type =>
+const generateJavascriptHMR = (type) =>
Template.getFunctionContent(
require("../hmr/JavascriptHotModuleReplacement.runtime")
)
diff --git a/lib/hmr/LazyCompilationPlugin.js b/lib/hmr/LazyCompilationPlugin.js
index e4b4edc6d..b37ff4b59 100644
--- a/lib/hmr/LazyCompilationPlugin.js
+++ b/lib/hmr/LazyCompilationPlugin.js
@@ -382,7 +382,7 @@ class LazyCompilationPlugin {
callback();
});
if (promise && promise.then) {
- promise.then(b => {
+ promise.then((b) => {
backend = b;
callback();
}, callback);
@@ -395,7 +395,7 @@ class LazyCompilationPlugin {
PLUGIN_NAME,
(module, createData, resolveData) => {
if (
- resolveData.dependencies.every(dep =>
+ resolveData.dependencies.every((dep) =>
HMR_DEPENDENCY_TYPES.has(dep.type)
)
) {
@@ -406,9 +406,9 @@ class LazyCompilationPlugin {
/** @type {Module} */
(compilation.moduleGraph.getParentModule(hmrDep));
const isReferringToDynamicImport = originModule.blocks.some(
- block =>
+ (block) =>
block.dependencies.some(
- dep =>
+ (dep) =>
dep.type === "import()" &&
/** @type {HarmonyImportDependency} */ (dep).request ===
hmrDep.request
@@ -417,7 +417,7 @@ class LazyCompilationPlugin {
if (!isReferringToDynamicImport) return module;
} else if (
!resolveData.dependencies.every(
- dep =>
+ (dep) =>
HMR_DEPENDENCY_TYPES.has(dep.type) ||
(this.imports &&
(dep.type === "import()" ||
@@ -455,7 +455,7 @@ class LazyCompilationPlugin {
);
}
);
- compiler.hooks.shutdown.tapAsync(PLUGIN_NAME, callback => {
+ compiler.hooks.shutdown.tapAsync(PLUGIN_NAME, (callback) => {
backend.dispose(callback);
});
}
diff --git a/lib/hmr/lazyCompilationBackend.js b/lib/hmr/lazyCompilationBackend.js
index 31b8ced3b..c5fbbbf72 100644
--- a/lib/hmr/lazyCompilationBackend.js
+++ b/lib/hmr/lazyCompilationBackend.js
@@ -22,7 +22,7 @@
* @param {Omit & { client: NonNullable}} options additional options for the backend
* @returns {BackendHandler} backend
*/
-module.exports = options => (compiler, callback) => {
+module.exports = (options) => (compiler, callback) => {
const logger = compiler.getInfrastructureLogger("LazyCompilationBackend");
const activeModules = new Map();
const prefix = "/lazy-compilation-using-";
@@ -47,7 +47,7 @@ module.exports = options => (compiler, callback) => {
const listen =
typeof options.listen === "function"
? options.listen
- : server => {
+ : (server) => {
let listen = options.listen;
if (typeof listen === "object" && !("port" in listen)) {
listen = { ...listen, port: undefined };
@@ -100,14 +100,14 @@ module.exports = options => (compiler, callback) => {
let isClosing = false;
/** @type {Set} */
const sockets = new Set();
- server.on("connection", socket => {
+ server.on("connection", (socket) => {
sockets.add(socket);
socket.on("close", () => {
sockets.delete(socket);
});
if (isClosing) socket.destroy();
});
- server.on("clientError", e => {
+ server.on("clientError", (e) => {
if (e.message !== "Server is disposing") logger.warn(e);
});
@@ -117,7 +117,7 @@ module.exports = options => (compiler, callback) => {
* @param {Error} err error
* @returns {void}
*/
- err => {
+ (err) => {
if (err) return callback(err);
const _addr = server.address();
if (typeof _addr === "string") {
@@ -138,7 +138,7 @@ module.exports = options => (compiler, callback) => {
isClosing = true;
// Removing the listener is a workaround for a memory leak in node.js
server.off("request", requestListener);
- server.close(err => {
+ server.close((err) => {
callback(err);
});
for (const socket of sockets) {
diff --git a/lib/ids/ChunkModuleIdRangePlugin.js b/lib/ids/ChunkModuleIdRangePlugin.js
index 3a62447d0..a3233bb96 100644
--- a/lib/ids/ChunkModuleIdRangePlugin.js
+++ b/lib/ids/ChunkModuleIdRangePlugin.js
@@ -39,13 +39,13 @@ class ChunkModuleIdRangePlugin {
*/
apply(compiler) {
const options = this.options;
- compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
+ compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
const moduleGraph = compilation.moduleGraph;
- compilation.hooks.moduleIds.tap(PLUGIN_NAME, modules => {
+ compilation.hooks.moduleIds.tap(PLUGIN_NAME, (modules) => {
const chunkGraph = compilation.chunkGraph;
const chunk = find(
compilation.chunks,
- chunk => chunk.name === options.name
+ (chunk) => chunk.name === options.name
);
if (!chunk) {
throw new Error(
@@ -72,7 +72,7 @@ class ChunkModuleIdRangePlugin {
chunkModules = chunkGraph.getOrderedChunkModules(chunk, cmpFn);
} else {
chunkModules = [...modules]
- .filter(m => chunkGraph.isModuleInChunk(m, chunk))
+ .filter((m) => chunkGraph.isModuleInChunk(m, chunk))
.sort(compareModulesByPreOrderIndexOrIdentifier(moduleGraph));
}
diff --git a/lib/ids/DeterministicChunkIdsPlugin.js b/lib/ids/DeterministicChunkIdsPlugin.js
index b4fa8ca21..d06b7b3a7 100644
--- a/lib/ids/DeterministicChunkIdsPlugin.js
+++ b/lib/ids/DeterministicChunkIdsPlugin.js
@@ -37,8 +37,8 @@ class DeterministicChunkIdsPlugin {
* @returns {void}
*/
apply(compiler) {
- compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
- compilation.hooks.chunkIds.tap(PLUGIN_NAME, chunks => {
+ compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
+ compilation.hooks.chunkIds.tap(PLUGIN_NAME, (chunks) => {
const chunkGraph = compilation.chunkGraph;
const context = this.options.context
? this.options.context
@@ -49,8 +49,9 @@ class DeterministicChunkIdsPlugin {
const usedIds = getUsedChunkIds(compilation);
assignDeterministicIds(
- [...chunks].filter(chunk => chunk.id === null),
- chunk => getFullChunkName(chunk, chunkGraph, context, compiler.root),
+ [...chunks].filter((chunk) => chunk.id === null),
+ (chunk) =>
+ getFullChunkName(chunk, chunkGraph, context, compiler.root),
compareNatural,
(chunk, id) => {
const size = usedIds.size;
diff --git a/lib/ids/DeterministicModuleIdsPlugin.js b/lib/ids/DeterministicModuleIdsPlugin.js
index 813ab8729..7ed80a67e 100644
--- a/lib/ids/DeterministicModuleIdsPlugin.js
+++ b/lib/ids/DeterministicModuleIdsPlugin.js
@@ -43,7 +43,7 @@ class DeterministicModuleIdsPlugin {
* @returns {void}
*/
apply(compiler) {
- compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
+ compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
compilation.hooks.moduleIds.tap(PLUGIN_NAME, () => {
const chunkGraph = compilation.chunkGraph;
const context = this.options.context
@@ -61,7 +61,7 @@ class DeterministicModuleIdsPlugin {
);
assignDeterministicIds(
modules,
- module => getFullModuleName(module, context, compiler.root),
+ (module) => getFullModuleName(module, context, compiler.root),
failOnConflict
? () => 0
: compareModulesByPreOrderIndexOrIdentifier(
diff --git a/lib/ids/HashedModuleIdsPlugin.js b/lib/ids/HashedModuleIdsPlugin.js
index a67f6e382..3944f8d27 100644
--- a/lib/ids/HashedModuleIdsPlugin.js
+++ b/lib/ids/HashedModuleIdsPlugin.js
@@ -54,7 +54,7 @@ class HashedModuleIdsPlugin {
*/
apply(compiler) {
const options = this.options;
- compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
+ compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
compilation.hooks.moduleIds.tap(PLUGIN_NAME, () => {
const chunkGraph = compilation.chunkGraph;
const context = this.options.context
diff --git a/lib/ids/IdHelpers.js b/lib/ids/IdHelpers.js
index 2e97a015e..142af991b 100644
--- a/lib/ids/IdHelpers.js
+++ b/lib/ids/IdHelpers.js
@@ -33,7 +33,7 @@ const getHash = (str, len, hashFunction) => {
* @param {string} str the string
* @returns {string} string prefixed by an underscore if it is a number
*/
-const avoidNumber = str => {
+const avoidNumber = (str) => {
// max length of a number is 21 chars, bigger numbers a written as "...e+xx"
if (str.length > 21) return str;
const firstChar = str.charCodeAt(0);
@@ -54,7 +54,7 @@ const avoidNumber = str => {
* @param {string} request the request
* @returns {string} id representation
*/
-const requestToId = request =>
+const requestToId = (request) =>
request.replace(/^(\.\.?\/)+/, "").replace(/(^[.-]|[^a-zA-Z0-9_-])+/g, "_");
/**
@@ -136,7 +136,7 @@ const getShortChunkName = (
associatedObjectForCache
) => {
const modules = chunkGraph.getChunkRootModules(chunk);
- const shortModuleNames = modules.map(m =>
+ const shortModuleNames = modules.map((m) =>
requestToId(getShortModuleName(m, context, associatedObjectForCache))
);
chunk.idNameHints.sort();
@@ -164,10 +164,10 @@ const getLongChunkName = (
associatedObjectForCache
) => {
const modules = chunkGraph.getChunkRootModules(chunk);
- const shortModuleNames = modules.map(m =>
+ const shortModuleNames = modules.map((m) =>
requestToId(getShortModuleName(m, context, associatedObjectForCache))
);
- const longModuleNames = modules.map(m =>
+ const longModuleNames = modules.map((m) =>
requestToId(
getLongModuleName("", m, context, hashFunction, associatedObjectForCache)
)
@@ -198,7 +198,7 @@ const getFullChunkName = (
) => {
if (chunk.name) return chunk.name;
const modules = chunkGraph.getChunkRootModules(chunk);
- const fullModuleNames = modules.map(m =>
+ const fullModuleNames = modules.map((m) =>
makePathsRelative(context, m.identifier(), associatedObjectForCache)
);
return fullModuleNames.join();
@@ -259,7 +259,7 @@ const getUsedModuleIdsAndModules = (compilation, filter) => {
* @param {Compilation} compilation the compilation
* @returns {Set} used chunk ids as strings
*/
-const getUsedChunkIds = compilation => {
+const getUsedChunkIds = (compilation) => {
/** @type {Set} */
const usedIds = new Set();
if (compilation.usedChunkIds) {
@@ -413,7 +413,7 @@ const assignAscendingModuleIds = (usedIds, modules, compilation) => {
/**
* @param {Module} module the module
*/
- assignId = module => {
+ assignId = (module) => {
if (chunkGraph.getModuleId(module) === null) {
while (usedIds.has(String(nextId))) nextId++;
chunkGraph.setModuleId(module, nextId++);
@@ -423,7 +423,7 @@ const assignAscendingModuleIds = (usedIds, modules, compilation) => {
/**
* @param {Module} module the module
*/
- assignId = module => {
+ assignId = (module) => {
if (chunkGraph.getModuleId(module) === null) {
chunkGraph.setModuleId(module, nextId++);
}
diff --git a/lib/ids/NamedChunkIdsPlugin.js b/lib/ids/NamedChunkIdsPlugin.js
index 7d4337d45..139d47933 100644
--- a/lib/ids/NamedChunkIdsPlugin.js
+++ b/lib/ids/NamedChunkIdsPlugin.js
@@ -42,24 +42,24 @@ class NamedChunkIdsPlugin {
* @returns {void}
*/
apply(compiler) {
- compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
+ compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
const hashFunction =
/** @type {NonNullable
${magenta(x)}`),
"loggingEntry(time).loggingEntry.message": (message, { magenta }) =>
- mapLines(message, x => ` ${magenta(x)}`),
+ mapLines(message, (x) => ` ${magenta(x)}`),
"loggingEntry(group).loggingEntry.message": (message, { cyan }) =>
- mapLines(message, x => `<-> ${cyan(x)}`),
+ mapLines(message, (x) => `<-> ${cyan(x)}`),
"loggingEntry(groupCollapsed).loggingEntry.message": (message, { cyan }) =>
- mapLines(message, x => `<+> ${cyan(x)}`),
+ mapLines(message, (x) => `<+> ${cyan(x)}`),
"loggingEntry(clear).loggingEntry": () => " -------",
"loggingEntry(groupCollapsed).loggingEntry.children": () => "",
- "loggingEntry.trace[]": trace =>
- trace ? mapLines(trace, x => `| ${x}`) : undefined,
+ "loggingEntry.trace[]": (trace) =>
+ trace ? mapLines(trace, (x) => `| ${x}`) : undefined,
- loggingGroup: loggingGroup =>
+ loggingGroup: (loggingGroup) =>
loggingGroup.entries.length === 0 ? "" : undefined,
"loggingGroup.debug": (flag, { red }) => (flag ? red("DEBUG") : undefined),
"loggingGroup.name": (name, { bold }) => bold(`LOG from ${name}`),
"loggingGroup.separator!": () => "\n",
- "loggingGroup.filteredEntries": filteredEntries =>
+ "loggingGroup.filteredEntries": (filteredEntries) =>
filteredEntries > 0 ? `+ ${filteredEntries} hidden lines` : undefined
};
@@ -888,14 +888,14 @@ const LOG_ENTRY_PRINTERS = {
/** @type {ModuleTraceItemPrinters} */
const MODULE_TRACE_ITEM_PRINTERS = {
- "moduleTraceItem.originName": originName => originName
+ "moduleTraceItem.originName": (originName) => originName
};
/** @typedef {Printers} ModuleTraceDependencyPrinters */
/** @type {ModuleTraceDependencyPrinters} */
const MODULE_TRACE_DEPENDENCY_PRINTERS = {
- "moduleTraceDependency.loc": loc => loc
+ "moduleTraceDependency.loc": (loc) => loc
};
/**
@@ -932,9 +932,9 @@ const ITEM_NAMES = {
"module.issuerPath[]": "moduleIssuer",
"chunk.origins[]": "chunkOrigin",
"chunk.modules[]": "module",
- "loggingGroup.entries[]": logEntry =>
+ "loggingGroup.entries[]": (logEntry) =>
`loggingEntry(${logEntry.type}).loggingEntry`,
- "loggingEntry.children[]": logEntry =>
+ "loggingEntry.children[]": (logEntry) =>
`loggingEntry(${logEntry.type}).loggingEntry`,
"error.moduleTrace[]": "moduleTraceItem",
"error.errors[]": "error",
@@ -1135,19 +1135,19 @@ const PREFERRED_ORDERS = {
/** @typedef {(items: string[]) => string | undefined} SimpleItemsJoiner */
/** @type {SimpleItemsJoiner} */
-const itemsJoinOneLine = items => items.filter(Boolean).join(" ");
+const itemsJoinOneLine = (items) => items.filter(Boolean).join(" ");
/** @type {SimpleItemsJoiner} */
-const itemsJoinOneLineBrackets = items =>
+const itemsJoinOneLineBrackets = (items) =>
items.length > 0 ? `(${items.filter(Boolean).join(" ")})` : undefined;
/** @type {SimpleItemsJoiner} */
-const itemsJoinMoreSpacing = items => items.filter(Boolean).join("\n\n");
+const itemsJoinMoreSpacing = (items) => items.filter(Boolean).join("\n\n");
/** @type {SimpleItemsJoiner} */
-const itemsJoinComma = items => items.filter(Boolean).join(", ");
+const itemsJoinComma = (items) => items.filter(Boolean).join(", ");
/** @type {SimpleItemsJoiner} */
-const itemsJoinCommaBrackets = items =>
+const itemsJoinCommaBrackets = (items) =>
items.length > 0 ? `(${items.filter(Boolean).join(", ")})` : undefined;
/** @type {(item: string) => SimpleItemsJoiner} */
-const itemsJoinCommaBracketsWithName = name => items =>
+const itemsJoinCommaBracketsWithName = (name) => (items) =>
items.length > 0
? `(${name}: ${items.filter(Boolean).join(", ")})`
: undefined;
@@ -1176,18 +1176,18 @@ const SIMPLE_ITEMS_JOINER = {
"asset.auxiliaryChunkIdHints":
itemsJoinCommaBracketsWithName("auxiliary id hint"),
"module.chunks": itemsJoinOneLine,
- "module.issuerPath": items =>
+ "module.issuerPath": (items) =>
items
.filter(Boolean)
- .map(item => `${item} ->`)
+ .map((item) => `${item} ->`)
.join(" "),
"compilation.errors": itemsJoinMoreSpacing,
"compilation.warnings": itemsJoinMoreSpacing,
"compilation.logging": itemsJoinMoreSpacing,
- "compilation.children": items =>
+ "compilation.children": (items) =>
indent(/** @type {string} */ (itemsJoinMoreSpacing(items)), " "),
"moduleTraceItem.dependencies": itemsJoinOneLine,
- "loggingEntry.children": items =>
+ "loggingEntry.children": (items) =>
indent(items.filter(Boolean).join("\n"), " ", false)
};
@@ -1195,9 +1195,9 @@ const SIMPLE_ITEMS_JOINER = {
* @param {Item[]} items items
* @returns {string} result
*/
-const joinOneLine = items =>
+const joinOneLine = (items) =>
items
- .map(item => item.content)
+ .map((item) => item.content)
.filter(Boolean)
.join(" ");
@@ -1205,7 +1205,7 @@ const joinOneLine = items =>
* @param {Item[]} items items
* @returns {string} result
*/
-const joinInBrackets = items => {
+const joinInBrackets = (items) => {
const res = [];
let mode = 0;
for (const item of items) {
@@ -1269,7 +1269,7 @@ const joinExplicitNewLine = (items, indenter) => {
let firstInLine = true;
let first = true;
return items
- .map(item => {
+ .map((item) => {
if (!item || !item.content) return;
let content = indent(item.content, first ? "" : indenter, !firstInLine);
if (firstInLine) {
@@ -1291,7 +1291,7 @@ const joinExplicitNewLine = (items, indenter) => {
* @returns {SimpleElementJoiner} joiner
*/
const joinError =
- error =>
+ (error) =>
/**
* @param {Item[]} items items
* @param {StatsPrinterContextWithExtra} ctx context
@@ -1308,7 +1308,7 @@ const joinError =
/** @type {Record} */
const SIMPLE_ELEMENT_JOINERS = {
- compilation: items => {
+ compilation: (items) => {
const result = [];
let lastNeedMore = false;
for (const item of items) {
@@ -1328,9 +1328,9 @@ const SIMPLE_ELEMENT_JOINERS = {
if (lastNeedMore) result.push("\n");
return result.join("");
},
- asset: items =>
+ asset: (items) =>
joinExplicitNewLine(
- items.map(item => {
+ items.map((item) => {
if (
(item.element === "related" || item.element === "children") &&
item.content
@@ -1348,7 +1348,7 @@ const SIMPLE_ELEMENT_JOINERS = {
module: (items, { module }) => {
let hasName = false;
return joinExplicitNewLine(
- items.map(item => {
+ items.map((item) => {
switch (item.element) {
case "id":
if (module.id === module.name) {
@@ -1381,10 +1381,10 @@ const SIMPLE_ELEMENT_JOINERS = {
" "
);
},
- chunk: items => {
+ chunk: (items) => {
let hasEntry = false;
return `chunk ${joinExplicitNewLine(
- items.filter(item => {
+ items.filter((item) => {
switch (item.element) {
case "entry":
if (item.content) hasEntry = true;
@@ -1398,15 +1398,15 @@ const SIMPLE_ELEMENT_JOINERS = {
" "
)}`;
},
- "chunk.childrenByOrder[]": items => `(${joinOneLine(items)})`,
- chunkGroup: items => joinExplicitNewLine(items, " "),
+ "chunk.childrenByOrder[]": (items) => `(${joinOneLine(items)})`,
+ chunkGroup: (items) => joinExplicitNewLine(items, " "),
chunkGroupAsset: joinOneLine,
chunkGroupChildGroup: joinOneLine,
chunkGroupChild: joinOneLine,
moduleReason: (items, { moduleReason }) => {
let hasName = false;
return joinExplicitNewLine(
- items.map(item => {
+ items.map((item) => {
switch (item.element) {
case "moduleId":
if (moduleReason.moduleId === moduleReason.module && item.content) {
@@ -1437,14 +1437,14 @@ const SIMPLE_ELEMENT_JOINERS = {
},
"module.profile": joinInBrackets,
moduleIssuer: joinOneLine,
- chunkOrigin: items => `> ${joinOneLine(items)}`,
+ chunkOrigin: (items) => `> ${joinOneLine(items)}`,
"errors[].error": joinError(true),
"warnings[].error": joinError(false),
- error: items => joinExplicitNewLine(items, ""),
- "error.errors[].error": items =>
+ error: (items) => joinExplicitNewLine(items, ""),
+ "error.errors[].error": (items) =>
indent(`[errors]: ${joinExplicitNewLine(items, "")}`, " "),
- loggingGroup: items => joinExplicitNewLine(items, "").trimEnd(),
- moduleTraceItem: items => ` @ ${joinOneLine(items)}`,
+ loggingGroup: (items) => joinExplicitNewLine(items, "").trimEnd(),
+ moduleTraceItem: (items) => ` @ ${joinOneLine(items)}`,
moduleTraceDependency: joinOneLine
};
@@ -1479,11 +1479,11 @@ const AVAILABLE_FORMATS = {
return `{${yellow(id)}}`;
}
},
- formatModuleId: id => `[${id}]`,
+ formatModuleId: (id) => `[${id}]`,
formatFilename: (filename, { green, yellow }, oversize) =>
(oversize ? yellow : green)(filename),
- formatFlag: flag => `[${flag}]`,
- formatLayer: layer => `(in ${layer})`,
+ formatFlag: (flag) => `[${flag}]`,
+ formatLayer: (layer) => `(in ${layer})`,
formatSize: require("../SizeFormatHelpers").formatSize,
formatDateTime: (dateTime, { bold }) => {
const d = new Date(dateTime);
@@ -1559,7 +1559,7 @@ const AVAILABLE_FORMATS = {
/** @typedef {(result: string) => string} ResultModifierFn */
/** @type {Record} */
const RESULT_MODIFIER = {
- "module.modules": result => indent(result, "| ")
+ "module.modules": (result) => indent(result, "| ")
};
/**
@@ -1597,7 +1597,7 @@ class DefaultStatsPrinterPlugin {
* @returns {void}
*/
apply(compiler) {
- compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
+ compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
compilation.hooks.statsPrinter.tap(PLUGIN_NAME, (stats, options) => {
// Put colors into context
stats.hooks.print
@@ -1621,7 +1621,7 @@ class DefaultStatsPrinterPlugin {
}
if (start) {
/** @type {ColorFunction} */
- context[color] = str =>
+ context[color] = (str) =>
`${start}${
typeof str === "string"
? str.replace(
@@ -1636,7 +1636,7 @@ class DefaultStatsPrinterPlugin {
* @param {string} str string
* @returns {string} str string
*/
- context[color] = str => str;
+ context[color] = (str) => str;
}
}
for (const _format of Object.keys(AVAILABLE_FORMATS)) {
diff --git a/lib/stats/StatsFactory.js b/lib/stats/StatsFactory.js
index c59d660ea..4a3ada223 100644
--- a/lib/stats/StatsFactory.js
+++ b/lib/stats/StatsFactory.js
@@ -273,7 +273,7 @@ class StatsFactory {
// sort items
/** @type {Comparator[]} */
const comparators = [];
- this._forEachLevel(this.hooks.sort, this._caches.sort, type, h =>
+ this._forEachLevel(this.hooks.sort, this._caches.sort, type, (h) =>
h.call(comparators, context)
);
if (comparators.length > 0) {
@@ -306,7 +306,7 @@ class StatsFactory {
this.hooks.getItemName,
this._caches.getItemName,
`${type}[]`,
- h => h.call(item, itemContext)
+ (h) => h.call(item, itemContext)
);
if (itemName) itemContext[itemName] = item;
const innerType = itemName ? `${type}[].${itemName}` : `${type}[]`;
@@ -317,7 +317,7 @@ class StatsFactory {
this.hooks.getItemFactory,
this._caches.getItemFactory,
innerType,
- h => h.call(item, itemContext)
+ (h) => h.call(item, itemContext)
) || this;
// run item factory
@@ -331,7 +331,7 @@ class StatsFactory {
this.hooks.sortResults,
this._caches.sortResults,
type,
- h => h.call(comparators2, context)
+ (h) => h.call(comparators2, context)
);
if (comparators2.length > 0) {
resultItems.sort(
@@ -347,7 +347,7 @@ class StatsFactory {
this.hooks.groupResults,
this._caches.groupResults,
type,
- h => h.call(groupConfigs, context)
+ (h) => h.call(groupConfigs, context)
);
if (groupConfigs.length > 0) {
resultItems = smartGrouping(resultItems, groupConfigs);
@@ -368,7 +368,7 @@ class StatsFactory {
this.hooks.merge,
this._caches.merge,
type,
- h => h.call(finalResultItems, context)
+ (h) => h.call(finalResultItems, context)
);
if (result === undefined) result = finalResultItems;
@@ -385,7 +385,7 @@ class StatsFactory {
const object = {};
// run extract on value
- this._forEachLevel(this.hooks.extract, this._caches.extract, type, h =>
+ this._forEachLevel(this.hooks.extract, this._caches.extract, type, (h) =>
h.call(object, data, context)
);
diff --git a/lib/stats/StatsPrinter.js b/lib/stats/StatsPrinter.js
index 3672ed1fe..621dd9a2d 100644
--- a/lib/stats/StatsPrinter.js
+++ b/lib/stats/StatsPrinter.js
@@ -210,13 +210,13 @@ class StatsPrinter {
};
/** @type {string | undefined} */
- let printResult = this._forEachLevel(this.hooks.print, type, hook =>
+ let printResult = this._forEachLevel(this.hooks.print, type, (hook) =>
hook.call(object, context)
);
if (printResult === undefined) {
if (Array.isArray(object)) {
const sortedItems = [...object];
- this._forEachLevel(this.hooks.sortItems, type, h =>
+ this._forEachLevel(this.hooks.sortItems, type, (h) =>
h.call(
sortedItems,
/** @type {StatsPrinterContextWithExtra} */
@@ -233,7 +233,7 @@ class StatsPrinter {
const itemName = this._forEachLevel(
this.hooks.getItemName,
`${type}[]`,
- h => h.call(item, itemContext)
+ (h) => h.call(item, itemContext)
);
if (itemName) itemContext[itemName] = item;
return this.print(
@@ -242,7 +242,7 @@ class StatsPrinter {
itemContext
);
});
- printResult = this._forEachLevel(this.hooks.printItems, type, h =>
+ printResult = this._forEachLevel(this.hooks.printItems, type, (h) =>
h.call(
/** @type {string[]} */ (printedItems),
/** @type {StatsPrinterContextWithExtra} */
@@ -255,16 +255,16 @@ class StatsPrinter {
}
} else if (object !== null && typeof object === "object") {
const elements = Object.keys(object).filter(
- key => object[key] !== undefined
+ (key) => object[key] !== undefined
);
- this._forEachLevel(this.hooks.sortElements, type, h =>
+ this._forEachLevel(this.hooks.sortElements, type, (h) =>
h.call(
elements,
/** @type {StatsPrinterContextWithExtra} */
(context)
)
);
- const printedElements = elements.map(element => {
+ const printedElements = elements.map((element) => {
const content = this.print(`${type}.${element}`, object[element], {
...context,
_parent: object,
@@ -273,7 +273,7 @@ class StatsPrinter {
});
return { element, content };
});
- printResult = this._forEachLevel(this.hooks.printElements, type, h =>
+ printResult = this._forEachLevel(this.hooks.printElements, type, (h) =>
h.call(
printedElements,
/** @type {StatsPrinterContextWithExtra} */
@@ -281,7 +281,7 @@ class StatsPrinter {
)
);
if (printResult === undefined) {
- const result = printedElements.map(e => e.content).filter(Boolean);
+ const result = printedElements.map((e) => e.content).filter(Boolean);
if (result.length > 0) printResult = result.join("\n");
}
}
diff --git a/lib/url/URLParserPlugin.js b/lib/url/URLParserPlugin.js
index 24c6eab2a..7a864134e 100644
--- a/lib/url/URLParserPlugin.js
+++ b/lib/url/URLParserPlugin.js
@@ -33,7 +33,7 @@ const PLUGIN_NAME = "URLParserPlugin";
* @param {NormalModule} module module
* @returns {URL} file url
*/
-const getUrl = module => pathToFileURL(module.resource);
+const getUrl = (module) => pathToFileURL(module.resource);
/**
* @param {Parser} parser parser parser
@@ -108,7 +108,7 @@ class URLParserPlugin {
const relative = this.options.url === "relative";
parser.hooks.canRename.for("URL").tap(PLUGIN_NAME, approve);
- parser.hooks.evaluateNewExpression.for("URL").tap(PLUGIN_NAME, expr => {
+ parser.hooks.evaluateNewExpression.for("URL").tap(PLUGIN_NAME, (expr) => {
const evaluatedExpr = getEvaluatedExpr(expr, parser);
const request = evaluatedExpr && evaluatedExpr.asString();
@@ -119,7 +119,7 @@ class URLParserPlugin {
.setString(url.toString())
.setRange(/** @type {Range} */ (expr.range));
});
- parser.hooks.new.for("URL").tap(PLUGIN_NAME, _expr => {
+ parser.hooks.new.for("URL").tap(PLUGIN_NAME, (_expr) => {
const expr = /** @type {NewExpressionNode} */ (_expr);
const { options: importOptions, errors: commentErrors } =
parser.parseCommentOptions(/** @type {Range} */ (expr.range));
@@ -185,7 +185,7 @@ class URLParserPlugin {
);
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.current.addDependency(dep);
- InnerGraph.onUsage(parser.state, e => (dep.usedByExports = e));
+ InnerGraph.onUsage(parser.state, (e) => (dep.usedByExports = e));
return true;
}
@@ -248,7 +248,7 @@ class URLParserPlugin {
parser.state.current.addDependency(dep);
return true;
});
- parser.hooks.isPure.for("NewExpression").tap(PLUGIN_NAME, _expr => {
+ parser.hooks.isPure.for("NewExpression").tap(PLUGIN_NAME, (_expr) => {
const expr = /** @type {NewExpressionNode} */ (_expr);
const { callee } = expr;
if (callee.type !== "Identifier") return;
diff --git a/lib/util/AsyncQueue.js b/lib/util/AsyncQueue.js
index 2ae918b74..1bbdc8a52 100644
--- a/lib/util/AsyncQueue.js
+++ b/lib/util/AsyncQueue.js
@@ -80,7 +80,7 @@ class AsyncQueue {
this._processor = processor;
this._getKey =
getKey ||
- /** @type {getKey} */ (item => /** @type {T & K} */ (item));
+ /** @type {getKey} */ ((item) => /** @type {T & K} */ (item));
/** @type {Map>} */
this._entries = new Map();
/** @type {ArrayQueue>} */
@@ -138,7 +138,7 @@ class AsyncQueue {
*/
add(item, callback) {
if (this._stopped) return callback(new WebpackError("Queue was stopped"));
- this.hooks.beforeAdd.callAsync(item, err => {
+ this.hooks.beforeAdd.callAsync(item, (err) => {
if (err) {
callback(
makeWebpackError(err, `AsyncQueue(${this._name}).hooks.beforeAdd`)
@@ -327,7 +327,7 @@ class AsyncQueue {
* @returns {void}
*/
_startProcessing(entry) {
- this.hooks.beforeStart.callAsync(entry.item, err => {
+ this.hooks.beforeStart.callAsync(entry.item, (err) => {
if (err) {
this._handleResult(
entry,
@@ -356,7 +356,7 @@ class AsyncQueue {
* @returns {void}
*/
_handleResult(entry, err, result) {
- this.hooks.result.callAsync(entry.item, err, result, hookError => {
+ this.hooks.result.callAsync(entry.item, err, result, (hookError) => {
const error = hookError
? makeWebpackError(hookError, `AsyncQueue(${this._name}).hooks.result`)
: err;
diff --git a/lib/util/IterableHelpers.js b/lib/util/IterableHelpers.js
index c90f64e21..ef56089fb 100644
--- a/lib/util/IterableHelpers.js
+++ b/lib/util/IterableHelpers.js
@@ -10,7 +10,7 @@
* @param {Iterable} set a set
* @returns {T | undefined} last item
*/
-const last = set => {
+const last = (set) => {
let last;
for (const item of set) last = item;
return last;
@@ -34,7 +34,7 @@ const someInIterable = (iterable, filter) => {
* @param {Iterable} iterable an iterable
* @returns {number} count of items
*/
-const countIterable = iterable => {
+const countIterable = (iterable) => {
let i = 0;
for (const _ of iterable) i++;
return i;
diff --git a/lib/util/LazyBucketSortedSet.js b/lib/util/LazyBucketSortedSet.js
index 74030ce92..26188756a 100644
--- a/lib/util/LazyBucketSortedSet.js
+++ b/lib/util/LazyBucketSortedSet.js
@@ -162,7 +162,7 @@ class LazyBucketSortedSet {
*/
startUpdate(item) {
if (this._unsortedItems.has(item)) {
- return remove => {
+ return (remove) => {
if (remove) {
this._unsortedItems.delete(item);
this.size--;
@@ -172,7 +172,7 @@ class LazyBucketSortedSet {
const key = this._getKey(item);
if (this._leaf) {
const oldEntry = /** @type {SortableSet} */ (this._map.get(key));
- return remove => {
+ return (remove) => {
if (remove) {
this.size--;
oldEntry.delete(item);
@@ -198,7 +198,7 @@ class LazyBucketSortedSet {
/** @type {LazyBucketSortedSet} */
(this._map.get(key));
const finishUpdate = oldEntry.startUpdate(item);
- return remove => {
+ return (remove) => {
if (remove) {
this.size--;
finishUpdate(true);
diff --git a/lib/util/SetHelpers.js b/lib/util/SetHelpers.js
index aa5753c25..9691d9ab7 100644
--- a/lib/util/SetHelpers.js
+++ b/lib/util/SetHelpers.js
@@ -11,7 +11,7 @@
* @param {Set[]} sets an array of sets being checked for shared elements
* @returns {Set} returns a new Set containing the intersecting items
*/
-const intersect = sets => {
+const intersect = (sets) => {
if (sets.length === 0) return new Set();
if (sets.length === 1) return new Set(sets[0]);
let minSize = Infinity;
@@ -68,7 +68,7 @@ const find = (set, fn) => {
* @param {Set | ReadonlySet} set a set
* @returns {T | undefined} first item
*/
-const first = set => {
+const first = (set) => {
const entry = set.values().next();
return entry.done ? undefined : entry.value;
};
diff --git a/lib/util/StackedCacheMap.js b/lib/util/StackedCacheMap.js
index 735573610..781aa86d6 100644
--- a/lib/util/StackedCacheMap.js
+++ b/lib/util/StackedCacheMap.js
@@ -124,7 +124,7 @@ class StackedCacheMap {
* @returns {Iterator<[K, V]>} iterator
*/
[Symbol.iterator]() {
- const iterators = this.stack.map(map => map[Symbol.iterator]());
+ const iterators = this.stack.map((map) => map[Symbol.iterator]());
let current = this.map[Symbol.iterator]();
return {
next() {
diff --git a/lib/util/StackedMap.js b/lib/util/StackedMap.js
index 9797713b4..d515db217 100644
--- a/lib/util/StackedMap.js
+++ b/lib/util/StackedMap.js
@@ -24,7 +24,7 @@ const UNDEFINED_MARKER = Symbol("undefined");
* @param {[K, InternalCell]} pair the internal cell
* @returns {[K, Cell]} its “safe” representation
*/
-const extractPair = pair => {
+const extractPair = (pair) => {
const key = pair[0];
const val = pair[1];
if (val === UNDEFINED_MARKER || val === TOMBSTONE) {
diff --git a/lib/util/TupleSet.js b/lib/util/TupleSet.js
index 3fba7f7a4..1916ff4d9 100644
--- a/lib/util/TupleSet.js
+++ b/lib/util/TupleSet.js
@@ -125,7 +125,7 @@ class TupleSet {
* @param {MapIterator<[T, InnerMap | Set]>} it iterator
* @returns {boolean} result
*/
- const next = it => {
+ const next = (it) => {
const result = it.next();
if (result.done) {
if (iteratorStack.length === 0) return false;
diff --git a/lib/util/WeakTupleMap.js b/lib/util/WeakTupleMap.js
index 5e0068f98..563a8dd70 100644
--- a/lib/util/WeakTupleMap.js
+++ b/lib/util/WeakTupleMap.js
@@ -21,7 +21,7 @@
* @param {EXPECTED_ANY} thing thing
* @returns {boolean} true if is weak
*/
-const isWeakKey = thing => typeof thing === "object" && thing !== null;
+const isWeakKey = (thing) => typeof thing === "object" && thing !== null;
/**
* @template {unknown[]} T
diff --git a/lib/util/cleverMerge.js b/lib/util/cleverMerge.js
index 88d0b8b06..7e3fbbb71 100644
--- a/lib/util/cleverMerge.js
+++ b/lib/util/cleverMerge.js
@@ -123,7 +123,7 @@ const parseCache = new WeakMap();
* @param {T} obj the object
* @returns {ParsedObject} parsed object
*/
-const cachedParseObject = obj => {
+const cachedParseObject = (obj) => {
const entry = parseCache.get(/** @type {EXPECTED_OBJECT} */ (obj));
if (entry !== undefined) return entry;
const result = parseObject(obj);
@@ -138,7 +138,7 @@ const cachedParseObject = obj => {
* @param {T} obj the object
* @returns {ParsedObject} parsed object
*/
-const parseObject = obj => {
+const parseObject = (obj) => {
/** @type {ParsedObjectStatic} */
const info = new Map();
/** @type {ParsedObjectDynamic | undefined} */
@@ -147,7 +147,7 @@ const parseObject = obj => {
* @param {keyof T} p path
* @returns {Partial>} object parsed property entry
*/
- const getInfo = p => {
+ const getInfo = (p) => {
const entry = info.get(p);
if (entry !== undefined) return entry;
const newEntry = {
@@ -275,7 +275,7 @@ const VALUE_TYPE_DELETE = 4;
* @param {T} value a single value
* @returns {VALUE_TYPE_UNDEFINED | VALUE_TYPE_ATOM | VALUE_TYPE_ARRAY_EXTEND | VALUE_TYPE_OBJECT | VALUE_TYPE_DELETE} value type
*/
-const getValueType = value => {
+const getValueType = (value) => {
if (value === undefined) {
return VALUE_TYPE_UNDEFINED;
} else if (value === DELETE) {
@@ -457,7 +457,7 @@ const mergeEntries = (firstEntry, secondEntry, internalCaching) => {
}
if (
[.../** @type {ByValues} */ (firstEntry.byValues).values()].every(
- value => {
+ (value) => {
const type = getValueType(value);
return type === VALUE_TYPE_ATOM || type === VALUE_TYPE_DELETE;
}
@@ -555,7 +555,7 @@ const mergeSingleValue = (a, b, internalCaching) => {
case VALUE_TYPE_UNDEFINED:
return b;
case VALUE_TYPE_DELETE:
- return /** @type {B[]} */ (b).filter(item => item !== "...");
+ return /** @type {B[]} */ (b).filter((item) => item !== "...");
case VALUE_TYPE_ARRAY_EXTEND: {
/** @type {(A | B)[]} */
const newArray = [];
@@ -571,7 +571,7 @@ const mergeSingleValue = (a, b, internalCaching) => {
return newArray;
}
case VALUE_TYPE_OBJECT:
- return /** @type {(A | B)[]} */ (b).map(item =>
+ return /** @type {(A | B)[]} */ (b).map((item) =>
item === "..." ? /** @type {A} */ (a) : item
);
default:
@@ -618,7 +618,7 @@ const removeOperations = (obj, keysToKeepOriginalValue = []) => {
/** @type {T[keyof T]} */
(
/** @type {EXPECTED_ANY[]} */
- (value).filter(i => i !== "...")
+ (value).filter((i) => i !== "...")
);
break;
default:
diff --git a/lib/util/comparators.js b/lib/util/comparators.js
index 034a17404..5e8004c83 100644
--- a/lib/util/comparators.js
+++ b/lib/util/comparators.js
@@ -46,10 +46,10 @@ const { compareRuntime } = require("./runtime");
* @param {RawParameterizedComparator} fn comparator with argument
* @returns {ParameterizedComparator} comparator
*/
-const createCachedParameterizedComparator = fn => {
+const createCachedParameterizedComparator = (fn) => {
/** @type {WeakMap>} */
const map = new WeakMap();
- return arg => {
+ return (arg) => {
const cachedResult = map.get(/** @type {EXPECTED_OBJECT} */ (arg));
if (cachedResult !== undefined) return cachedResult;
/**
@@ -82,7 +82,7 @@ const compareIds = (a, b) => {
* @param {Comparator} elementComparator comparator for elements
* @returns {Comparator>} comparator for iterables of elements
*/
-const compareIterables = elementComparator => {
+const compareIterables = (elementComparator) => {
const cacheEntry = compareIteratorsCache.get(elementComparator);
if (cacheEntry !== undefined) return cacheEntry;
/**
@@ -468,7 +468,7 @@ const compareIteratorsCache = new WeakMap();
* @param {Iterable} iterable original ordered list
* @returns {Comparator} comparator
*/
-const keepOriginalOrder = iterable => {
+const keepOriginalOrder = (iterable) => {
/** @type {Map} */
const map = new Map();
let i = 0;
@@ -486,21 +486,21 @@ const keepOriginalOrder = iterable => {
* @param {ChunkGraph} chunkGraph the chunk graph
* @returns {Comparator} comparator
*/
-const compareChunksNatural = chunkGraph => {
+const compareChunksNatural = (chunkGraph) => {
const cmpFn = module.exports.compareModulesById(chunkGraph);
const cmpIterableFn = compareIterables(cmpFn);
return concatComparators(
compareSelect(
- chunk => /** @type {string|number} */ (chunk.name),
+ (chunk) => /** @type {string|number} */ (chunk.name),
compareIds
),
- compareSelect(chunk => chunk.runtime, compareRuntime),
+ compareSelect((chunk) => chunk.runtime, compareRuntime),
compareSelect(
/**
* @param {Chunk} chunk a chunk
* @returns {Iterable} modules
*/
- chunk => chunkGraph.getOrderedChunkModulesIterable(chunk, cmpFn),
+ (chunk) => chunkGraph.getOrderedChunkModulesIterable(chunk, cmpFn),
cmpIterableFn
)
);
@@ -519,7 +519,7 @@ const sortWithSourceOrder = (dependencies, dependencySourceOrderMap) => {
* @param {Dependency} dep dependency
* @returns {number} source order
*/
- const getSourceOrder = dep => {
+ const getSourceOrder = (dep) => {
if (dependencySourceOrderMap.has(dep)) {
const { main } = /** @type {DependencySourceOrder} */ (
dependencySourceOrderMap.get(dep)
@@ -536,7 +536,7 @@ const sortWithSourceOrder = (dependencies, dependencySourceOrderMap) => {
* @param {number | undefined} sourceOrder sourceOrder
* @returns {boolean} needReSort
*/
- const needReSort = sourceOrder => {
+ const needReSort = (sourceOrder) => {
if (typeof sourceOrder === "number") {
return true;
}
diff --git a/lib/util/compileBooleanMatcher.js b/lib/util/compileBooleanMatcher.js
index ca17d55b2..551675d76 100644
--- a/lib/util/compileBooleanMatcher.js
+++ b/lib/util/compileBooleanMatcher.js
@@ -9,13 +9,13 @@
* @param {string} str string
* @returns {string} quoted meta
*/
-const quoteMeta = str => str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&");
+const quoteMeta = (str) => str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&");
/**
* @param {string} str string
* @returns {string} string
*/
-const toSimpleString = str => {
+const toSimpleString = (str) => {
if (`${Number(str)}` === str) {
return str;
}
@@ -26,9 +26,9 @@ const toSimpleString = str => {
* @param {Record} map value map
* @returns {boolean | ((value: string) => string)} true/false, when unconditionally true/false, or a template function to determine the value at runtime
*/
-const compileBooleanMatcher = map => {
- const positiveItems = Object.keys(map).filter(i => map[i]);
- const negativeItems = Object.keys(map).filter(i => !map[i]);
+const compileBooleanMatcher = (map) => {
+ const positiveItems = Object.keys(map).filter((i) => map[i]);
+ const negativeItems = Object.keys(map).filter((i) => !map[i]);
if (positiveItems.length === 0) return false;
if (negativeItems.length === 0) return true;
return compileBooleanMatcherFromLists(positiveItems, negativeItems);
@@ -43,17 +43,17 @@ const compileBooleanMatcherFromLists = (positiveItems, negativeItems) => {
if (positiveItems.length === 0) return () => "false";
if (negativeItems.length === 0) return () => "true";
if (positiveItems.length === 1) {
- return value => `${toSimpleString(positiveItems[0])} == ${value}`;
+ return (value) => `${toSimpleString(positiveItems[0])} == ${value}`;
}
if (negativeItems.length === 1) {
- return value => `${toSimpleString(negativeItems[0])} != ${value}`;
+ return (value) => `${toSimpleString(negativeItems[0])} != ${value}`;
}
const positiveRegexp = itemsToRegexp(positiveItems);
const negativeRegexp = itemsToRegexp(negativeItems);
if (positiveRegexp.length <= negativeRegexp.length) {
- return value => `/^${positiveRegexp}$/.test(${value})`;
+ return (value) => `/^${positiveRegexp}$/.test(${value})`;
}
- return value => `!/^${negativeRegexp}$/.test(${value})`;
+ return (value) => `!/^${negativeRegexp}$/.test(${value})`;
};
/**
@@ -94,7 +94,7 @@ const popCommonItems = (itemsSet, getKey, condition) => {
* @param {Array} items items
* @returns {string} common prefix
*/
-const getCommonPrefix = items => {
+const getCommonPrefix = (items) => {
let prefix = items[0];
for (let i = 1; i < items.length; i++) {
const item = items[i];
@@ -112,7 +112,7 @@ const getCommonPrefix = items => {
* @param {Array} items items
* @returns {string} common suffix
*/
-const getCommonSuffix = items => {
+const getCommonSuffix = (items) => {
let suffix = items[0];
for (let i = 1; i < items.length; i++) {
const item = items[i];
@@ -130,7 +130,7 @@ const getCommonSuffix = items => {
* @param {Array} itemsArr array of items
* @returns {string} regexp
*/
-const itemsToRegexp = itemsArr => {
+const itemsToRegexp = (itemsArr) => {
if (itemsArr.length === 1) {
return quoteMeta(itemsArr[0]);
}
@@ -165,11 +165,11 @@ const itemsToRegexp = itemsArr => {
if (finishedItems.length === 0 && items.size === 2) {
const prefix = getCommonPrefix(itemsArr);
const suffix = getCommonSuffix(
- itemsArr.map(item => item.slice(prefix.length))
+ itemsArr.map((item) => item.slice(prefix.length))
);
if (prefix.length > 0 || suffix.length > 0) {
return `${quoteMeta(prefix)}${itemsToRegexp(
- itemsArr.map(i => i.slice(prefix.length, -suffix.length || undefined))
+ itemsArr.map((i) => i.slice(prefix.length, -suffix.length || undefined))
)}${quoteMeta(suffix)}`;
}
}
@@ -190,8 +190,8 @@ const itemsToRegexp = itemsArr => {
// find common prefix: (a1|a2|a3|a4|b5) => (a(1|2|3|4)|b5)
const prefixed = popCommonItems(
items,
- item => (item.length >= 1 ? item[0] : false),
- list => {
+ (item) => (item.length >= 1 ? item[0] : false),
+ (list) => {
if (list.length >= 3) return true;
if (list.length <= 1) return false;
return list[0][1] === list[1][1];
@@ -201,7 +201,7 @@ const itemsToRegexp = itemsArr => {
const prefix = getCommonPrefix(prefixedItems);
finishedItems.push(
`${quoteMeta(prefix)}${itemsToRegexp(
- prefixedItems.map(i => i.slice(prefix.length))
+ prefixedItems.map((i) => i.slice(prefix.length))
)}`
);
}
@@ -209,8 +209,8 @@ const itemsToRegexp = itemsArr => {
// find common suffix: (a1|b1|c1|d1|e2) => ((a|b|c|d)1|e2)
const suffixed = popCommonItems(
items,
- item => (item.length >= 1 ? item.slice(-1) : false),
- list => {
+ (item) => (item.length >= 1 ? item.slice(-1) : false),
+ (list) => {
if (list.length >= 3) return true;
if (list.length <= 1) return false;
return list[0].slice(-2) === list[1].slice(-2);
@@ -220,7 +220,7 @@ const itemsToRegexp = itemsArr => {
const suffix = getCommonSuffix(suffixedItems);
finishedItems.push(
`${itemsToRegexp(
- suffixedItems.map(i => i.slice(0, -suffix.length))
+ suffixedItems.map((i) => i.slice(0, -suffix.length))
)}${quoteMeta(suffix)}`
);
}
diff --git a/lib/util/concatenate.js b/lib/util/concatenate.js
index db799b889..7dc16cf13 100644
--- a/lib/util/concatenate.js
+++ b/lib/util/concatenate.js
@@ -22,13 +22,13 @@ const NAMESPACE_OBJECT_EXPORT = "__WEBPACK_NAMESPACE_OBJECT__";
* @param {Variable} variable variable
* @returns {Reference[]} references
*/
-const getAllReferences = variable => {
+const getAllReferences = (variable) => {
let set = variable.references;
// Look for inner scope variables too (like in class Foo { t() { Foo } })
const identifiers = new Set(variable.identifiers);
for (const scope of variable.scope.childScopes) {
for (const innerVar of scope.variables) {
- if (innerVar.identifiers.some(id => identifiers.has(id))) {
+ if (innerVar.identifiers.some((id) => identifiers.has(id))) {
set = [...set, ...innerVar.references];
break;
}
@@ -53,7 +53,7 @@ const getPathInAst = (ast, node) => {
* @param {Node} n node
* @returns {Node[] | undefined} result
*/
- const enterNode = n => {
+ const enterNode = (n) => {
if (!n) return;
const r = n.range;
if (r && r[0] <= nr[0] && r[1] >= nr[1]) {
diff --git a/lib/util/conventions.js b/lib/util/conventions.js
index b1ad4ea9e..f60517870 100644
--- a/lib/util/conventions.js
+++ b/lib/util/conventions.js
@@ -11,7 +11,7 @@
* @param {string} string string
* @returns {string} result
*/
-const preserveCamelCase = string => {
+const preserveCamelCase = (string) => {
let result = string;
let isLastCharLower = false;
let isLastCharUpper = false;
@@ -54,7 +54,7 @@ const preserveCamelCase = string => {
* @param {string} input input
* @returns {string} result
*/
-module.exports.camelCase = input => {
+module.exports.camelCase = (input) => {
let result = input.trim();
if (result.length === 0) {
@@ -75,7 +75,7 @@ module.exports.camelCase = input => {
.replace(/^[_.\- ]+/, "")
.toLowerCase()
.replace(/[_.\- ]+([\p{Alpha}\p{N}_]|$)/gu, (_, p1) => p1.toUpperCase())
- .replace(/\d+([\p{Alpha}\p{N}_]|$)/gu, m => m.toUpperCase());
+ .replace(/\d+([\p{Alpha}\p{N}_]|$)/gu, (m) => m.toUpperCase());
};
/**
@@ -121,5 +121,5 @@ module.exports.cssExportConvention = (input, convention) => {
* @param {string} input input
* @returns {string} result
*/
-module.exports.dashesCamelCase = input =>
+module.exports.dashesCamelCase = (input) =>
input.replace(/-+(\w)/g, (match, firstLetter) => firstLetter.toUpperCase());
diff --git a/lib/util/create-schema-validation.js b/lib/util/create-schema-validation.js
index be9f38ca3..6364eda65 100644
--- a/lib/util/create-schema-validation.js
+++ b/lib/util/create-schema-validation.js
@@ -22,7 +22,7 @@ const getValidate = memoize(() => require("schema-utils").validate);
*/
const createSchemaValidation = (check, getSchema, options) => {
getSchema = memoize(getSchema);
- return value => {
+ return (value) => {
if (check && value && !check(value)) {
getValidate()(
getSchema(),
diff --git a/lib/util/createHash.js b/lib/util/createHash.js
index a3ad731cb..2ff475af8 100644
--- a/lib/util/createHash.js
+++ b/lib/util/createHash.js
@@ -154,7 +154,7 @@ let BatchedHash;
* @param {HashFunction} algorithm the algorithm name or a constructor creating a hash
* @returns {Hash} the hash
*/
-module.exports = algorithm => {
+module.exports = (algorithm) => {
if (typeof algorithm === "function") {
// eslint-disable-next-line new-cap
return new BulkUpdateDecorator(() => new algorithm());
diff --git a/lib/util/deprecation.js b/lib/util/deprecation.js
index 68537a721..5d3b61b31 100644
--- a/lib/util/deprecation.js
+++ b/lib/util/deprecation.js
@@ -146,7 +146,7 @@ module.exports.arrayToSetDeprecation = (set, name) => {
* @param {number} index index
* @returns {() => T | undefined} value
*/
- const createIndexGetter = index => {
+ const createIndexGetter = (index) => {
/**
* @this {Set} a Set
* @returns {T | undefined} the value at this location
@@ -164,7 +164,7 @@ module.exports.arrayToSetDeprecation = (set, name) => {
/**
* @param {number} index index
*/
- const defineIndexGetter = index => {
+ const defineIndexGetter = (index) => {
Object.defineProperty(set, index, {
get: createIndexGetter(index),
set(value) {
@@ -199,7 +199,7 @@ module.exports.arrayToSetDeprecation = (set, name) => {
* @param {string} name name
* @returns {{ new (values?: readonly T[] | null): SetDeprecatedArray }} SetDeprecatedArray
*/
-module.exports.createArrayToSetDeprecationSet = name => {
+module.exports.createArrayToSetDeprecationSet = (name) => {
let initialized = false;
/**
@@ -275,7 +275,7 @@ const deprecateAllProperties = (obj, message, code) => {
* @param {T} v value
* @returns {T} result
*/
- v => (value = v),
+ (v) => (value = v),
message,
code
)
diff --git a/lib/util/deterministicGrouping.js b/lib/util/deterministicGrouping.js
index ea289983b..4331a3e47 100644
--- a/lib/util/deterministicGrouping.js
+++ b/lib/util/deterministicGrouping.js
@@ -97,7 +97,7 @@ const subtractSizeFrom = (total, size) => {
* @param {Iterable>} nodes some nodes
* @returns {Record} total size
*/
-const sumSize = nodes => {
+const sumSize = (nodes) => {
const sum = Object.create(null);
for (const node of nodes) {
addSizeTo(sum, node.size);
@@ -249,7 +249,7 @@ class Group {
* @param {Iterable>} nodes nodes
* @returns {number[]} similarities
*/
-const getSimilarities = nodes => {
+const getSimilarities = (nodes) => {
// calculate similarities between lexically adjacent nodes
/** @type {number[]} */
const similarities = [];
@@ -292,7 +292,7 @@ module.exports = ({ maxSize, minSize, items, getSize, getKey }) => {
const nodes = Array.from(
items,
- item => new Node(item, getKey(item), getSize(item))
+ (item) => new Node(item, getKey(item), getSize(item))
);
/** @type {Node[]} */
@@ -329,12 +329,12 @@ module.exports = ({ maxSize, minSize, items, getSize, getKey }) => {
// We hit an edge case where the working set is already smaller than minSize
// We merge problematic nodes with the smallest result node to keep minSize intact
const problemNodes = group.popNodes(
- n => getNumberOfMatchingSizeTypes(n.size, problemTypes) > 0
+ (n) => getNumberOfMatchingSizeTypes(n.size, problemTypes) > 0
);
if (problemNodes === undefined) return false;
// Only merge it with result nodes that have the problematic size type
const possibleResultGroups = result.filter(
- n => getNumberOfMatchingSizeTypes(n.size, problemTypes) > 0
+ (n) => getNumberOfMatchingSizeTypes(n.size, problemTypes) > 0
);
if (possibleResultGroups.length > 0) {
const bestGroup = possibleResultGroups.reduce((min, group) => {
@@ -531,11 +531,11 @@ module.exports = ({ maxSize, minSize, items, getSize, getKey }) => {
// return the results
return result.map(
- group =>
+ (group) =>
/** @type {GroupedItems} */
({
key: group.key,
- items: group.nodes.map(node => node.item),
+ items: group.nodes.map((node) => node.item),
size: group.size
})
);
diff --git a/lib/util/findGraphRoots.js b/lib/util/findGraphRoots.js
index 8b674a8c7..d7d02e49f 100644
--- a/lib/util/findGraphRoots.js
+++ b/lib/util/findGraphRoots.js
@@ -224,7 +224,7 @@ module.exports = (items, getDependencies) => {
// When roots were found, return them
if (roots.size > 0) {
- return Array.from(roots, r => r.item);
+ return Array.from(roots, (r) => r.item);
}
throw new Error("Implementation of findGraphRoots is broken");
diff --git a/lib/util/fs.js b/lib/util/fs.js
index f6646ddb6..267e1d14a 100644
--- a/lib/util/fs.js
+++ b/lib/util/fs.js
@@ -523,7 +523,7 @@ const dirname = (fs, absPath) => {
* @returns {void}
*/
const mkdirp = (fs, p, callback) => {
- fs.mkdir(p, err => {
+ fs.mkdir(p, (err) => {
if (err) {
if (err.code === "ENOENT") {
const dir = dirname(fs, p);
@@ -531,12 +531,12 @@ const mkdirp = (fs, p, callback) => {
callback(err);
return;
}
- mkdirp(fs, dir, err => {
+ mkdirp(fs, dir, (err) => {
if (err) {
callback(err);
return;
}
- fs.mkdir(p, err => {
+ fs.mkdir(p, (err) => {
if (err) {
if (err.code === "EEXIST") {
callback();
diff --git a/lib/util/identifier.js b/lib/util/identifier.js
index b53efcd84..1bcdc51a0 100644
--- a/lib/util/identifier.js
+++ b/lib/util/identifier.js
@@ -14,7 +14,7 @@ const WINDOWS_PATH_SEPARATOR_REGEXP = /\\/g;
* @param {string} relativePath relative path
* @returns {string} request
*/
-const relativePathToRequest = relativePath => {
+const relativePathToRequest = (relativePath) => {
if (relativePath === "") return "./.";
if (relativePath === "..") return "../.";
if (relativePath.startsWith("../")) return relativePath;
@@ -103,7 +103,7 @@ const requestToAbsolute = (context, relativePath) => {
* @param {((value: string) => T)} realFn real function
* @returns {MakeCacheableResult & { bindCache: BindCache }} cacheable function
*/
-const makeCacheable = realFn => {
+const makeCacheable = (realFn) => {
/**
* @template T
* @typedef {Map} CacheItem
@@ -115,7 +115,7 @@ const makeCacheable = realFn => {
* @param {AssociatedObjectForCache} associatedObjectForCache an object to which the cache will be attached
* @returns {CacheItem} cache item
*/
- const getCache = associatedObjectForCache => {
+ const getCache = (associatedObjectForCache) => {
const entry = cache.get(associatedObjectForCache);
if (entry !== undefined) return entry;
/** @type {Map} */
@@ -136,13 +136,13 @@ const makeCacheable = realFn => {
};
/** @type {BindCache} */
- fn.bindCache = associatedObjectForCache => {
+ fn.bindCache = (associatedObjectForCache) => {
const cache = getCache(associatedObjectForCache);
/**
* @param {string} str string
* @returns {T} value
*/
- return str => {
+ return (str) => {
const entry = cache.get(str);
if (entry !== undefined) return entry;
const result = realFn(str);
@@ -164,7 +164,7 @@ const makeCacheable = realFn => {
* @param {(context: string, identifier: string) => string} fn function
* @returns {MakeCacheableWithContextResult & { bindCache: BindCacheForContext, bindContextCache: BindContextCacheForContext }} cacheable function with context
*/
-const makeCacheableWithContext = fn => {
+const makeCacheableWithContext = (fn) => {
/** @type {WeakMap>>} */
const cache = new WeakMap();
@@ -195,7 +195,7 @@ const makeCacheableWithContext = fn => {
};
/** @type {BindCacheForContext} */
- cachedFn.bindCache = associatedObjectForCache => {
+ cachedFn.bindCache = (associatedObjectForCache) => {
let innerCache;
if (associatedObjectForCache) {
innerCache = cache.get(associatedObjectForCache);
@@ -254,7 +254,7 @@ const makeCacheableWithContext = fn => {
* @param {string} identifier identifier used to create relative path
* @returns {string} the returned relative path
*/
- const boundFn = identifier => {
+ const boundFn = (identifier) => {
const cachedResult = innerSubCache.get(identifier);
if (cachedResult !== undefined) {
return cachedResult;
@@ -278,7 +278,7 @@ const makeCacheableWithContext = fn => {
const _makePathsRelative = (context, identifier) =>
identifier
.split(SEGMENTS_SPLIT_REGEXP)
- .map(str => absoluteToRequest(context, str))
+ .map((str) => absoluteToRequest(context, str))
.join("");
/**
@@ -289,7 +289,7 @@ const _makePathsRelative = (context, identifier) =>
const _makePathsAbsolute = (context, identifier) =>
identifier
.split(SEGMENTS_SPLIT_REGEXP)
- .map(str => requestToAbsolute(context, str))
+ .map((str) => requestToAbsolute(context, str))
.join("");
/**
@@ -300,7 +300,7 @@ const _makePathsAbsolute = (context, identifier) =>
const _contextify = (context, request) =>
request
.split("!")
- .map(r => absoluteToRequest(context, r))
+ .map((r) => absoluteToRequest(context, r))
.join("!");
const contextify = makeCacheableWithContext(_contextify);
@@ -313,7 +313,7 @@ const contextify = makeCacheableWithContext(_contextify);
const _absolutify = (context, request) =>
request
.split("!")
- .map(r => requestToAbsolute(context, r))
+ .map((r) => requestToAbsolute(context, r))
.join("!");
const absolutify = makeCacheableWithContext(_absolutify);
@@ -329,7 +329,7 @@ const PATH_QUERY_REGEXP = /^((?:\0.|[^?\0])*)(\?.*)?$/;
* @param {string} str the path with query and fragment
* @returns {ParsedResource} parsed parts
*/
-const _parseResource = str => {
+const _parseResource = (str) => {
const match =
/** @type {[string, string, string | undefined, string | undefined]} */
(/** @type {unknown} */ (PATH_QUERY_FRAGMENT_REGEXP.exec(str)));
@@ -346,7 +346,7 @@ const _parseResource = str => {
* @param {string} str the path with query and fragment
* @returns {ParsedResourceWithoutFragment} parsed parts
*/
-const _parseResourceWithoutFragment = str => {
+const _parseResourceWithoutFragment = (str) => {
const match =
/** @type {[string, string, string | undefined]} */
(/** @type {unknown} */ (PATH_QUERY_REGEXP.exec(str)));
diff --git a/lib/util/memoize.js b/lib/util/memoize.js
index 5c58015f9..478d67096 100644
--- a/lib/util/memoize.js
+++ b/lib/util/memoize.js
@@ -14,7 +14,7 @@
* @param {FunctionReturning} fn memorized function
* @returns {FunctionReturning} new function
*/
-const memoize = fn => {
+const memoize = (fn) => {
let cache = false;
/** @type {T | undefined} */
let result;
diff --git a/lib/util/processAsyncTree.js b/lib/util/processAsyncTree.js
index 41980c63a..de3cf2aee 100644
--- a/lib/util/processAsyncTree.js
+++ b/lib/util/processAsyncTree.js
@@ -24,7 +24,7 @@ const processAsyncTree = (items, concurrency, processor, callback) => {
/**
* @param {T} item item
*/
- const push = item => {
+ const push = (item) => {
queue.push(item);
if (!processScheduled && processing < concurrency) {
processScheduled = true;
@@ -35,7 +35,7 @@ const processAsyncTree = (items, concurrency, processor, callback) => {
/**
* @param {E | null | undefined} err error
*/
- const processorCallback = err => {
+ const processorCallback = (err) => {
processing--;
if (err && !finished) {
finished = true;
diff --git a/lib/util/propertyName.js b/lib/util/propertyName.js
index a5dab1581..b2d8a8f72 100644
--- a/lib/util/propertyName.js
+++ b/lib/util/propertyName.js
@@ -66,7 +66,7 @@ const RESERVED_IDENTIFIER = new Set([
* @param {string} prop property name to analyze
* @returns {string} valid JS property name
*/
-const propertyName = prop => {
+const propertyName = (prop) => {
if (SAFE_IDENTIFIER.test(prop) && !RESERVED_IDENTIFIER.has(prop)) {
return prop;
}
diff --git a/lib/util/removeBOM.js b/lib/util/removeBOM.js
index 6ac60dfbd..55cd64aac 100644
--- a/lib/util/removeBOM.js
+++ b/lib/util/removeBOM.js
@@ -9,7 +9,7 @@
* @param {string | Buffer} strOrBuffer string or buffer
* @returns {string | Buffer} result without BOM
*/
-module.exports = strOrBuffer => {
+module.exports = (strOrBuffer) => {
if (typeof strOrBuffer === "string" && strOrBuffer.charCodeAt(0) === 0xfeff) {
return strOrBuffer.slice(1);
} else if (
diff --git a/lib/util/runtime.js b/lib/util/runtime.js
index d3c9ec2c4..5a0a5078f 100644
--- a/lib/util/runtime.js
+++ b/lib/util/runtime.js
@@ -74,7 +74,7 @@ const forEachRuntime = (runtime, fn, deterministicOrder = false) => {
* @param {SortableSet} set set
* @returns {string} runtime key
*/
-const getRuntimesKey = set => {
+const getRuntimesKey = (set) => {
set.sort();
return [...set].join("\n");
};
@@ -83,7 +83,7 @@ const getRuntimesKey = set => {
* @param {RuntimeSpec} runtime runtime(s)
* @returns {string} key of runtimes
*/
-const getRuntimeKey = runtime => {
+const getRuntimeKey = (runtime) => {
if (runtime === undefined) return "*";
if (typeof runtime === "string") return runtime;
return runtime.getFromUnorderedCache(getRuntimesKey);
@@ -93,7 +93,7 @@ const getRuntimeKey = runtime => {
* @param {string} key key of runtimes
* @returns {RuntimeSpec} runtime(s)
*/
-const keyToRuntime = key => {
+const keyToRuntime = (key) => {
if (key === "*") return;
const items = key.split("\n");
if (items.length === 1) return items[0];
@@ -105,7 +105,7 @@ const keyToRuntime = key => {
* @param {SortableSet} set set
* @returns {string} runtime string
*/
-const getRuntimesString = set => {
+const getRuntimesString = (set) => {
set.sort();
return [...set].join("+");
};
@@ -114,7 +114,7 @@ const getRuntimesString = set => {
* @param {RuntimeSpec} runtime runtime(s)
* @returns {string} readable version
*/
-const runtimeToString = runtime => {
+const runtimeToString = (runtime) => {
if (runtime === undefined) return "*";
if (typeof runtime === "string") return runtime;
return runtime.getFromUnorderedCache(getRuntimesString);
@@ -124,7 +124,7 @@ const runtimeToString = runtime => {
* @param {RuntimeCondition} runtimeCondition runtime condition
* @returns {string} readable version
*/
-const runtimeConditionToString = runtimeCondition => {
+const runtimeConditionToString = (runtimeCondition) => {
if (runtimeCondition === true) return "true";
if (runtimeCondition === false) return "false";
return runtimeToString(runtimeCondition);
diff --git a/lib/util/semver.js b/lib/util/semver.js
index d52fe5ce7..f64af49fa 100644
--- a/lib/util/semver.js
+++ b/lib/util/semver.js
@@ -13,7 +13,7 @@
* @param {string} str version string
* @returns {SemVerRange} parsed version
*/
-const parseVersion = str => {
+const parseVersion = (str) => {
/**
* @param {str} str str
* @returns {(string | number)[]} result
@@ -100,15 +100,15 @@ module.exports.versionLt = versionLt;
* @param {string} str range string
* @returns {SemVerRange} parsed range
*/
-module.exports.parseRange = str => {
+module.exports.parseRange = (str) => {
/**
* @param {string} str str
* @returns {(string | number)[]} result
*/
- const splitAndConvert = str => {
+ const splitAndConvert = (str) => {
return str
.split(".")
- .map(item => (item !== "NaN" && `${+item}` === item ? +item : item));
+ .map((item) => (item !== "NaN" && `${+item}` === item ? +item : item));
};
// see https://docs.npmjs.com/misc/semver#range-grammar for grammar
@@ -116,7 +116,7 @@ module.exports.parseRange = str => {
* @param {string} str str
* @returns {SemVerRangeItem[]}
*/
- const parsePartial = str => {
+ const parsePartial = (str) => {
const match =
/** @type {RegExpExecArray} */
(/^([^-+]+)?(?:-([^+]+))?(?:\+(.+))?$/.exec(str));
@@ -146,7 +146,7 @@ module.exports.parseRange = str => {
* @param {SemVerRangeItem[]} range range
* @returns {SemVerRangeItem[]}
*/
- const toFixed = range => {
+ const toFixed = (range) => {
if (range.length === 1) {
// Special case for "*" is "x.x.x" instead of "="
return [0];
@@ -166,7 +166,7 @@ module.exports.parseRange = str => {
* @param {SemVerRangeItem[]} range
* @returns {SemVerRangeItem[]} result
*/
- const negate = range => {
+ const negate = (range) => {
return [-(/** @type { [number]} */ (range)[0]) - 1, ...range.slice(1)];
};
@@ -174,7 +174,7 @@ module.exports.parseRange = str => {
* @param {string} str str
* @returns {SemVerRange}
*/
- const parseSimple = str => {
+ const parseSimple = (str) => {
// simple ::= primitive | partial | tilde | caret
// primitive ::= ( '<' | '>' | '>=' | '<=' | '=' | '!' ) ( ' ' ) * partial
// tilde ::= '~' ( ' ' ) * partial
@@ -253,7 +253,7 @@ module.exports.parseRange = str => {
* @param {string} str str
* @returns {SemVerRange}
*/
- const parseRange = str => {
+ const parseRange = (str) => {
// range ::= hyphen | simple ( ' ' ( ' ' ) * simple ) * | ''
// hyphen ::= partial ( ' ' ) * ' - ' ( ' ' ) * partial
const items = str.split(/\s+-\s+/);
@@ -292,7 +292,7 @@ module.exports.parseRange = str => {
* @param {string} str str
* @returns {SemVerRange}
*/
- const parseLogicalOr = str => {
+ const parseLogicalOr = (str) => {
// range-set ::= range ( logical-or range ) *
// logical-or ::= ( ' ' ) * '||' ( ' ' ) *
const items =
@@ -310,7 +310,7 @@ module.exports.parseRange = str => {
* @param {SemVerRange} range
* @returns {string}
*/
-const rangeToString = range => {
+const rangeToString = (range) => {
var fixCount = /** @type {number} */ (range[0]);
var str = "";
if (range.length === 1) {
@@ -532,7 +532,7 @@ module.exports.satisfy = satisfy;
* @param {SemVerRange | string | number | false | undefined} json
* @returns {string}
*/
-module.exports.stringifyHoley = json => {
+module.exports.stringifyHoley = (json) => {
switch (typeof json) {
case "undefined":
return "";
@@ -558,7 +558,7 @@ module.exports.stringifyHoley = json => {
* @param {RuntimeTemplate} runtimeTemplate
* @returns {string}
*/
-exports.parseVersionRuntimeCode = runtimeTemplate =>
+exports.parseVersionRuntimeCode = (runtimeTemplate) =>
`var parseVersion = ${runtimeTemplate.basicFunction("str", [
"// see webpack/lib/util/semver.js for original code",
`var p=${runtimeTemplate.supportsArrowFunction() ? "p=>" : "function(p)"}{return p.split(".").map(${runtimeTemplate.supportsArrowFunction() ? "p=>" : "function(p)"}{return+p==p?+p:p})},n=/^([^-+]+)?(?:-([^+]+))?(?:\\+(.+))?$/.exec(str),r=n[1]?p(n[1]):[];return n[2]&&(r.length++,r.push.apply(r,p(n[2]))),n[3]&&(r.push([]),r.push.apply(r,p(n[3]))),r;`
@@ -570,7 +570,7 @@ exports.parseVersionRuntimeCode = runtimeTemplate =>
* @param {RuntimeTemplate} runtimeTemplate
* @returns {string}
*/
-exports.versionLtRuntimeCode = runtimeTemplate =>
+exports.versionLtRuntimeCode = (runtimeTemplate) =>
`var versionLt = ${runtimeTemplate.basicFunction("a, b", [
"// see webpack/lib/util/semver.js for original code",
'a=parseVersion(a),b=parseVersion(b);for(var r=0;;){if(r>=a.length)return r=b.length)return"u"==n;var t=b[r],f=(typeof t)[0];if(n!=f)return"o"==n&&"n"==f||("s"==f||"u"==n);if("o"!=n&&"u"!=n&&e!=t)return e
* @param {RuntimeTemplate} runtimeTemplate
* @returns {string}
*/
-exports.rangeToStringRuntimeCode = runtimeTemplate =>
+exports.rangeToStringRuntimeCode = (runtimeTemplate) =>
`var rangeToString = ${runtimeTemplate.basicFunction("range", [
"// see webpack/lib/util/semver.js for original code",
'var r=range[0],n="";if(1===range.length)return"*";if(r+.5){n+=0==r?">=":-1==r?"<":1==r?"^":2==r?"~":r>0?"=":"!=";for(var e=1,a=1;a0?".":"")+(e=2,t)}return n}var g=[];for(a=1;a
* @param {RuntimeTemplate} runtimeTemplate
* @returns {string}
*/
-exports.satisfyRuntimeCode = runtimeTemplate =>
+exports.satisfyRuntimeCode = (runtimeTemplate) =>
`var satisfy = ${runtimeTemplate.basicFunction("range, version", [
"// see webpack/lib/util/semver.js for original code",
'if(0 in range){version=parseVersion(version);var e=range[0],r=e<0;r&&(e=-e-1);for(var n=0,i=1,a=!0;;i++,n++){var f,s,g=i=version.length||"o"==(s=(typeof(f=version[n]))[0]))return!a||("u"==g?i>e&&!r:""==g!=r);if("u"==s){if(!a||"u"!=g)return!1}else if(a)if(g==s)if(i<=e){if(f!=range[i])return!1}else{if(r?f>range[i]:f {
// This allows bundling all internal serializers
const internalSerializables = require("./internalSerializables");
- getObjectMiddleware().registerLoader(/^webpack\/lib\//, req => {
+ getObjectMiddleware().registerLoader(/^webpack\/lib\//, (req) => {
const loader =
internalSerializables[
/** @type {keyof import("./internalSerializables")} */
@@ -95,9 +95,9 @@ module.exports = {
return /** @type {Serializer} */ (
buffersSerializer = new Serializer([
new SingleItemMiddleware(),
- new (getObjectMiddleware())(context => {
+ new (getObjectMiddleware())((context) => {
if ("write" in context) {
- context.writeLazy = value => {
+ context.writeLazy = (value) => {
context.write(
SerializerMiddleware.createLazy(value, binaryMiddleware)
);
@@ -127,9 +127,9 @@ module.exports = {
return /** @type {Serializer} */ (
new Serializer([
new SingleItemMiddleware(),
- new (getObjectMiddleware())(context => {
+ new (getObjectMiddleware())((context) => {
if ("write" in context) {
- context.writeLazy = value => {
+ context.writeLazy = (value) => {
context.write(
SerializerMiddleware.createLazy(value, binaryMiddleware)
);
diff --git a/lib/util/smartGrouping.js b/lib/util/smartGrouping.js
index 7be36a5c6..7b6360a7f 100644
--- a/lib/util/smartGrouping.js
+++ b/lib/util/smartGrouping.js
@@ -81,7 +81,7 @@ const smartGrouping = (items, groupConfigs) => {
* @param {Set>} itemsWithGroups input items with groups
* @returns {(T | R)[]} groups items
*/
- const runGrouping = itemsWithGroups => {
+ const runGrouping = (itemsWithGroups) => {
const totalSize = itemsWithGroups.size;
for (const entry of itemsWithGroups) {
for (const group of entry.groups) {
diff --git a/lib/validateSchema.js b/lib/validateSchema.js
index d10f3454b..7091887e9 100644
--- a/lib/validateSchema.js
+++ b/lib/validateSchema.js
@@ -85,7 +85,7 @@ const validateSchema = (schema, options, validationConfiguration) => {
if (
children &&
children.some(
- child =>
+ (child) =>
child.keyword === "absolutePath" &&
child.instancePath === "/output/filename"
)
@@ -96,7 +96,7 @@ const validateSchema = (schema, options, validationConfiguration) => {
if (
children &&
children.some(
- child =>
+ (child) =>
child.keyword === "pattern" && child.instancePath === "/devtool"
)
) {
diff --git a/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js b/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js
index 472b7513e..20a65973e 100644
--- a/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js
+++ b/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js
@@ -50,7 +50,7 @@ class AsyncWasmLoadingRuntimeModule extends RuntimeModule {
JSON.stringify(outputOptions.webassemblyModuleFilename),
{
hash: `" + ${RuntimeGlobals.getFullHash}() + "`,
- hashWithLength: length =>
+ hashWithLength: (length) =>
`" + ${RuntimeGlobals.getFullHash}}().slice(0, ${length}) + "`,
module: {
id: '" + wasmModuleId + "',
diff --git a/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js b/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js
index cb8b47108..ab15a20ec 100644
--- a/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js
+++ b/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js
@@ -120,7 +120,7 @@ class AsyncWebAssemblyJavascriptGenerator extends Generator {
const importObjRequestItems = Array.from(
wasmDepsByRequest,
([request, deps]) => {
- const exportItems = deps.map(dep => {
+ const exportItems = deps.map((dep) => {
const importedModule =
/** @type {Module} */
(moduleGraph.getModule(dep));
diff --git a/lib/wasm-async/UniversalCompileAsyncWasmPlugin.js b/lib/wasm-async/UniversalCompileAsyncWasmPlugin.js
index 7d5fedf8b..043888c0e 100644
--- a/lib/wasm-async/UniversalCompileAsyncWasmPlugin.js
+++ b/lib/wasm-async/UniversalCompileAsyncWasmPlugin.js
@@ -22,13 +22,13 @@ class UniversalCompileAsyncWasmPlugin {
* @returns {void}
*/
apply(compiler) {
- compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => {
+ compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
const globalWasmLoading = compilation.outputOptions.wasmLoading;
/**
* @param {Chunk} chunk chunk
* @returns {boolean} true, if wasm loading is enabled for the chunk
*/
- const isEnabledForChunk = chunk => {
+ const isEnabledForChunk = (chunk) => {
const options = chunk.getEntryOptions();
const wasmLoading =
options && options.wasmLoading !== undefined
@@ -46,7 +46,7 @@ class UniversalCompileAsyncWasmPlugin {
* @param {string} path path
* @returns {string} code
*/
- const generateBeforeLoadBinaryCode = path =>
+ const generateBeforeLoadBinaryCode = (path) =>
Template.asString([
"var useFetch = typeof document !== 'undefined' || typeof self !== 'undefined';",
`var wasmUrl = ${path};`
@@ -85,7 +85,7 @@ class UniversalCompileAsyncWasmPlugin {
if (
!chunkGraph.hasModuleInGraph(
chunk,
- m => m.type === WEBASSEMBLY_MODULE_TYPE_ASYNC
+ (m) => m.type === WEBASSEMBLY_MODULE_TYPE_ASYNC
)
) {
return;
diff --git a/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js b/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js
index 4cd532043..6be078888 100644
--- a/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js
+++ b/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js
@@ -139,7 +139,9 @@ const generateImportObject = (
importObject = [
"return {",
Template.indent([
- properties.map(p => `${JSON.stringify(p.name)}: ${p.value}`).join(",\n")
+ properties
+ .map((p) => `${JSON.stringify(p.name)}: ${p.value}`)
+ .join(",\n")
]),
"};"
];
@@ -160,7 +162,9 @@ const generateImportObject = (
Template.asString([
`${JSON.stringify(module)}: {`,
Template.indent([
- list.map(p => `${JSON.stringify(p.name)}: ${p.value}`).join(",\n")
+ list
+ .map((p) => `${JSON.stringify(p.name)}: ${p.value}`)
+ .join(",\n")
]),
"}"
])
@@ -187,7 +191,7 @@ const generateImportObject = (
} else if (waitForInstances.size > 0) {
const promises = Array.from(
waitForInstances.values(),
- id => `installedWasmModules[${JSON.stringify(id)}]`
+ (id) => `installedWasmModules[${JSON.stringify(id)}]`
).join(", ");
const variables = Array.from(
waitForInstances.keys(),
@@ -251,7 +255,7 @@ class WasmChunkLoadingRuntimeModule extends RuntimeModule {
const { mangleImports } = this;
/** @type {string[]} */
const declarations = [];
- const importObjects = wasmModules.map(module =>
+ const importObjects = wasmModules.map((module) =>
generateImportObject(
chunkGraph,
module,
@@ -260,14 +264,14 @@ class WasmChunkLoadingRuntimeModule extends RuntimeModule {
chunk.runtime
)
);
- const chunkModuleIdMap = chunkGraph.getChunkModuleIdMap(chunk, m =>
+ const chunkModuleIdMap = chunkGraph.getChunkModuleIdMap(chunk, (m) =>
m.type.startsWith("webassembly")
);
/**
* @param {string} content content
* @returns {string} created import object
*/
- const createImportObject = content =>
+ const createImportObject = (content) =>
mangleImports
? `{ ${JSON.stringify(WebAssemblyUtils.MANGLED_MODULE)}: ${content} }`
: content;
@@ -275,12 +279,12 @@ class WasmChunkLoadingRuntimeModule extends RuntimeModule {
JSON.stringify(outputOptions.webassemblyModuleFilename),
{
hash: `" + ${RuntimeGlobals.getFullHash}() + "`,
- hashWithLength: length =>
+ hashWithLength: (length) =>
`" + ${RuntimeGlobals.getFullHash}}().slice(0, ${length}) + "`,
module: {
id: '" + wasmModuleId + "',
hash: `" + ${JSON.stringify(
- chunkGraph.getChunkModuleRenderedHashMap(chunk, m =>
+ chunkGraph.getChunkModuleRenderedHashMap(chunk, (m) =>
m.type.startsWith("webassembly")
)
)}[chunkId][wasmModuleId] + "`,
@@ -288,7 +292,7 @@ class WasmChunkLoadingRuntimeModule extends RuntimeModule {
return `" + ${JSON.stringify(
chunkGraph.getChunkModuleRenderedHashMap(
chunk,
- m => m.type.startsWith("webassembly"),
+ (m) => m.type.startsWith("webassembly"),
length
)
)}[chunkId][wasmModuleId] + "`;
diff --git a/lib/wasm-sync/WasmFinalizeExportsPlugin.js b/lib/wasm-sync/WasmFinalizeExportsPlugin.js
index c274b02fd..4980ec47e 100644
--- a/lib/wasm-sync/WasmFinalizeExportsPlugin.js
+++ b/lib/wasm-sync/WasmFinalizeExportsPlugin.js
@@ -22,8 +22,8 @@ class WasmFinalizeExportsPlugin {
* @returns {void}
*/
apply(compiler) {
- compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
- compilation.hooks.finishModules.tap(PLUGIN_NAME, modules => {
+ compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
+ compilation.hooks.finishModules.tap(PLUGIN_NAME, (modules) => {
for (const module of modules) {
// 1. if a WebAssembly module
if (module.type.startsWith("webassembly") === true) {
diff --git a/lib/wasm-sync/WebAssemblyGenerator.js b/lib/wasm-sync/WebAssemblyGenerator.js
index 5028a622e..5f97e0bdf 100644
--- a/lib/wasm-sync/WebAssemblyGenerator.js
+++ b/lib/wasm-sync/WebAssemblyGenerator.js
@@ -47,8 +47,8 @@ const WebAssemblyUtils = require("./WebAssemblyUtils");
*/
const compose = (...fns) =>
fns.reduce(
- (prevFn, nextFn) => value => nextFn(prevFn(value)),
- value => value
+ (prevFn, nextFn) => (value) => nextFn(prevFn(value)),
+ (value) => value
);
/**
@@ -57,7 +57,7 @@ const compose = (...fns) =>
* @param {AST} state.ast Module's ast
* @returns {ArrayBufferTransform} transform
*/
-const removeStartFunc = state => bin =>
+const removeStartFunc = (state) => (bin) =>
editWithAST(state.ast, bin, {
Start(path) {
path.remove();
@@ -69,7 +69,7 @@ const removeStartFunc = state => bin =>
* @param {AST} ast Module's AST
* @returns {t.ModuleImport[]} - nodes
*/
-const getImportedGlobals = ast => {
+const getImportedGlobals = (ast) => {
/** @type {t.ModuleImport[]} */
const importedGlobals = [];
@@ -89,7 +89,7 @@ const getImportedGlobals = ast => {
* @param {AST} ast Module's AST
* @returns {number} - count
*/
-const getCountImportedFunc = ast => {
+const getCountImportedFunc = (ast) => {
let count = 0;
t.traverse(ast, {
@@ -108,7 +108,7 @@ const getCountImportedFunc = ast => {
* @param {AST} ast Module's AST
* @returns {t.Index} - index
*/
-const getNextTypeIndex = ast => {
+const getNextTypeIndex = (ast) => {
const typeSectionMetadata = t.getSectionMetadata(ast, "type");
if (typeSectionMetadata === undefined) {
@@ -144,7 +144,7 @@ const getNextFuncIndex = (ast, countImportedFunc) => {
* @param {t.GlobalType} globalType the global type
* @returns {t.Instruction} init expression
*/
-const createDefaultInitForGlobal = globalType => {
+const createDefaultInitForGlobal = (globalType) => {
if (globalType.valtype[0] === "i") {
// create NumberLiteral global initializer
return t.objectInstruction("const", globalType.valtype, [
@@ -173,7 +173,7 @@ const createDefaultInitForGlobal = globalType => {
* @param {t.Instruction[]} state.additionalInitCode list of addition instructions for the init function
* @returns {ArrayBufferTransform} transform
*/
-const rewriteImportedGlobals = state => bin => {
+const rewriteImportedGlobals = (state) => (bin) => {
const additionalInitCode = state.additionalInitCode;
/** @type {Array} */
const newGlobals = [];
@@ -250,7 +250,7 @@ const rewriteImportedGlobals = state => bin => {
*/
const rewriteExportNames =
({ ast, moduleGraph, module, externalExports, runtime }) =>
- bin =>
+ (bin) =>
editWithAST(ast, bin, {
/**
* @param {NodePath} path path
@@ -281,7 +281,7 @@ const rewriteExportNames =
*/
const rewriteImports =
({ ast, usedDependencyMap }) =>
- bin =>
+ (bin) =>
editWithAST(ast, bin, {
/**
* @param {NodePath} path path
@@ -322,8 +322,8 @@ const addInitFunction =
nextFuncIndex,
nextTypeIndex
}) =>
- bin => {
- const funcParams = importedGlobals.map(importedGlobal => {
+ (bin) => {
+ const funcParams = importedGlobals.map((importedGlobal) => {
// used for debugging
const id = t.identifier(
`${importedGlobal.module}.${importedGlobal.name}`
@@ -473,8 +473,8 @@ class WebAssemblyGenerator extends Generator {
);
const externalExports = new Set(
module.dependencies
- .filter(d => d instanceof WebAssemblyExportImportedDependency)
- .map(d => {
+ .filter((d) => d instanceof WebAssemblyExportImportedDependency)
+ .map((d) => {
const wasmDep = /** @type {WebAssemblyExportImportedDependency} */ (
d
);
diff --git a/lib/wasm-sync/WebAssemblyInInitialChunkError.js b/lib/wasm-sync/WebAssemblyInInitialChunkError.js
index 1c09c4a2b..099c82173 100644
--- a/lib/wasm-sync/WebAssemblyInInitialChunkError.js
+++ b/lib/wasm-sync/WebAssemblyInInitialChunkError.js
@@ -42,7 +42,9 @@ const getInitialModuleChains = (
for (const connection of moduleGraph.getIncomingConnections(head)) {
const newHead = connection.originModule;
if (newHead) {
- if (!chunkGraph.getModuleChunks(newHead).some(c => c.canBeInitial())) {
+ if (
+ !chunkGraph.getModuleChunks(newHead).some((c) => c.canBeInitial())
+ ) {
continue;
}
final = false;
@@ -97,7 +99,7 @@ module.exports = class WebAssemblyInInitialChunkError extends WebpackError {
const message = `WebAssembly module is included in initial chunk.
This is not allowed, because WebAssembly download and compilation must happen asynchronous.
Add an async split point (i. e. import()) somewhere between your entrypoint and the WebAssembly module:
-${moduleChains.map(s => `* ${s}`).join("\n")}`;
+${moduleChains.map((s) => `* ${s}`).join("\n")}`;
super(message);
this.name = "WebAssemblyInInitialChunkError";
diff --git a/lib/wasm-sync/WebAssemblyParser.js b/lib/wasm-sync/WebAssemblyParser.js
index 5dd887dfd..8e980ad82 100644
--- a/lib/wasm-sync/WebAssemblyParser.js
+++ b/lib/wasm-sync/WebAssemblyParser.js
@@ -27,7 +27,7 @@ const JS_COMPAT_TYPES = new Set(["i32", "i64", "f32", "f64", "externref"]);
* @param {t.Signature} signature the func signature
* @returns {null | string} the type incompatible with js types
*/
-const getJsIncompatibleType = signature => {
+const getJsIncompatibleType = (signature) => {
for (const param of signature.params) {
if (!JS_COMPAT_TYPES.has(param.valtype)) {
return `${param.valtype} as parameter`;
@@ -44,7 +44,7 @@ const getJsIncompatibleType = signature => {
* @param {t.FuncSignature} signature the func signature
* @returns {null | string} the type incompatible with js types
*/
-const getJsIncompatibleTypeOfFuncSignature = signature => {
+const getJsIncompatibleTypeOfFuncSignature = (signature) => {
for (const param of signature.args) {
if (!JS_COMPAT_TYPES.has(param)) {
return `${param} as parameter`;
diff --git a/lib/wasm/EnableWasmLoadingPlugin.js b/lib/wasm/EnableWasmLoadingPlugin.js
index dc0b314bd..365438d07 100644
--- a/lib/wasm/EnableWasmLoadingPlugin.js
+++ b/lib/wasm/EnableWasmLoadingPlugin.js
@@ -16,7 +16,7 @@ const enabledTypes = new WeakMap();
* @param {Compiler} compiler compiler instance
* @returns {Set} enabled types
*/
-const getEnabledTypes = compiler => {
+const getEnabledTypes = (compiler) => {
let set = enabledTypes.get(compiler);
if (set === undefined) {
set = new Set();
diff --git a/lib/web/FetchCompileAsyncWasmPlugin.js b/lib/web/FetchCompileAsyncWasmPlugin.js
index dca39338c..088b7b583 100644
--- a/lib/web/FetchCompileAsyncWasmPlugin.js
+++ b/lib/web/FetchCompileAsyncWasmPlugin.js
@@ -21,13 +21,13 @@ class FetchCompileAsyncWasmPlugin {
* @returns {void}
*/
apply(compiler) {
- compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => {
+ compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
const globalWasmLoading = compilation.outputOptions.wasmLoading;
/**
* @param {Chunk} chunk chunk
* @returns {boolean} true, if wasm loading is enabled for the chunk
*/
- const isEnabledForChunk = chunk => {
+ const isEnabledForChunk = (chunk) => {
const options = chunk.getEntryOptions();
const wasmLoading =
options && options.wasmLoading !== undefined
@@ -39,7 +39,7 @@ class FetchCompileAsyncWasmPlugin {
* @param {string} path path to the wasm file
* @returns {string} code to load the wasm file
*/
- const generateLoadBinaryCode = path =>
+ const generateLoadBinaryCode = (path) =>
`fetch(${RuntimeGlobals.publicPath} + ${path})`;
compilation.hooks.runtimeRequirementInTree
@@ -49,7 +49,7 @@ class FetchCompileAsyncWasmPlugin {
if (
!chunkGraph.hasModuleInGraph(
chunk,
- m => m.type === WEBASSEMBLY_MODULE_TYPE_ASYNC
+ (m) => m.type === WEBASSEMBLY_MODULE_TYPE_ASYNC
)
) {
return;
diff --git a/lib/web/FetchCompileWasmPlugin.js b/lib/web/FetchCompileWasmPlugin.js
index d9461ef71..91edf0928 100644
--- a/lib/web/FetchCompileWasmPlugin.js
+++ b/lib/web/FetchCompileWasmPlugin.js
@@ -35,13 +35,13 @@ class FetchCompileWasmPlugin {
* @returns {void}
*/
apply(compiler) {
- compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => {
+ compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
const globalWasmLoading = compilation.outputOptions.wasmLoading;
/**
* @param {Chunk} chunk chunk
* @returns {boolean} true, if wasm loading is enabled for the chunk
*/
- const isEnabledForChunk = chunk => {
+ const isEnabledForChunk = (chunk) => {
const options = chunk.getEntryOptions();
const wasmLoading =
options && options.wasmLoading !== undefined
@@ -53,7 +53,7 @@ class FetchCompileWasmPlugin {
* @param {string} path path to the wasm file
* @returns {string} code to load the wasm file
*/
- const generateLoadBinaryCode = path =>
+ const generateLoadBinaryCode = (path) =>
`fetch(${RuntimeGlobals.publicPath} + ${path})`;
compilation.hooks.runtimeRequirementInTree
@@ -63,7 +63,7 @@ class FetchCompileWasmPlugin {
if (
!chunkGraph.hasModuleInGraph(
chunk,
- m => m.type === WEBASSEMBLY_MODULE_TYPE_SYNC
+ (m) => m.type === WEBASSEMBLY_MODULE_TYPE_SYNC
)
) {
return;
diff --git a/lib/web/JsonpChunkLoadingPlugin.js b/lib/web/JsonpChunkLoadingPlugin.js
index 6bc1f6d06..49fbd33f3 100644
--- a/lib/web/JsonpChunkLoadingPlugin.js
+++ b/lib/web/JsonpChunkLoadingPlugin.js
@@ -20,13 +20,13 @@ class JsonpChunkLoadingPlugin {
* @returns {void}
*/
apply(compiler) {
- compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => {
+ compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
const globalChunkLoading = compilation.outputOptions.chunkLoading;
/**
* @param {Chunk} chunk chunk
* @returns {boolean} true, if wasm loading is enabled for the chunk
*/
- const isEnabledForChunk = chunk => {
+ const isEnabledForChunk = (chunk) => {
const options = chunk.getEntryOptions();
const chunkLoading =
options && options.chunkLoading !== undefined
diff --git a/lib/web/JsonpChunkLoadingRuntimeModule.js b/lib/web/JsonpChunkLoadingRuntimeModule.js
index b4fc76d4a..d043dd93e 100644
--- a/lib/web/JsonpChunkLoadingRuntimeModule.js
+++ b/lib/web/JsonpChunkLoadingRuntimeModule.js
@@ -139,7 +139,7 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule {
stateExpression ? `${stateExpression} = ${stateExpression} || ` : ""
}{`,
Template.indent(
- Array.from(initialChunkIds, id => `${JSON.stringify(id)}: 0`).join(
+ Array.from(initialChunkIds, (id) => `${JSON.stringify(id)}: 0`).join(
",\n"
)
),
diff --git a/lib/webpack.js b/lib/webpack.js
index 3b45001de..f6e56f2e3 100644
--- a/lib/webpack.js
+++ b/lib/webpack.js
@@ -115,7 +115,8 @@ const createCompiler = (rawOptions, compilerIndex) => {
* @param {Array | T} options options
* @returns {Array} array of options
*/
-const asArray = options => (Array.isArray(options) ? [...options] : [options]);
+const asArray = (options) =>
+ Array.isArray(options) ? [...options] : [options];
const webpack = /** @type {WebpackFunctionSingle & WebpackFunctionMulti} */ (
/**
@@ -145,8 +146,8 @@ const webpack = /** @type {WebpackFunctionSingle & WebpackFunctionMulti} */ (
options,
/** @type {MultiCompilerOptions} */ (options)
);
- watch = options.some(options => options.watch);
- watchOptions = options.map(options => options.watchOptions || {});
+ watch = options.some((options) => options.watch);
+ watchOptions = options.map((options) => options.watchOptions || {});
} else {
const webpackOptions = /** @type {WebpackOptions} */ (options);
/** @type {Compiler} */
@@ -163,7 +164,7 @@ const webpack = /** @type {WebpackFunctionSingle & WebpackFunctionMulti} */ (
compiler.watch(watchOptions, callback);
} else {
compiler.run((err, stats) => {
- compiler.close(err2 => {
+ compiler.close((err2) => {
callback(
err || err2,
/** @type {options extends WebpackOptions ? Stats : MultiStats} */
diff --git a/lib/webworker/ImportScriptsChunkLoadingPlugin.js b/lib/webworker/ImportScriptsChunkLoadingPlugin.js
index 60b15ce27..661df2961 100644
--- a/lib/webworker/ImportScriptsChunkLoadingPlugin.js
+++ b/lib/webworker/ImportScriptsChunkLoadingPlugin.js
@@ -25,13 +25,13 @@ class ImportScriptsChunkLoadingPlugin {
chunkLoading: "import-scripts",
asyncChunkLoading: true
}).apply(compiler);
- compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => {
+ compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
const globalChunkLoading = compilation.outputOptions.chunkLoading;
/**
* @param {Chunk} chunk chunk
* @returns {boolean} true, if wasm loading is enabled for the chunk
*/
- const isEnabledForChunk = chunk => {
+ const isEnabledForChunk = (chunk) => {
const options = chunk.getEntryOptions();
const chunkLoading =
options && options.chunkLoading !== undefined
diff --git a/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js b/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js
index 81ab1923c..4ec9b34b1 100644
--- a/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js
+++ b/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js
@@ -107,7 +107,7 @@ class ImportScriptsChunkLoadingRuntimeModule extends RuntimeModule {
stateExpression ? `${stateExpression} = ${stateExpression} || ` : ""
}{`,
Template.indent(
- Array.from(initialChunkIds, id => `${JSON.stringify(id)}: 1`).join(
+ Array.from(initialChunkIds, (id) => `${JSON.stringify(id)}: 1`).join(
",\n"
)
),
diff --git a/setup/setup.js b/setup/setup.js
index 83373e617..0a67a2b28 100644
--- a/setup/setup.js
+++ b/setup/setup.js
@@ -12,7 +12,7 @@ const webpackDependencyFolder = path.resolve(root, "node_modules/webpack");
*/
function setup() {
return checkSymlinkExistsAsync()
- .then(async hasSymlink => {
+ .then(async (hasSymlink) => {
if (!hasSymlink) {
await ensureYarnInstalledAsync();
await runSetupSymlinkAsync();
@@ -24,7 +24,7 @@ function setup() {
.then(() => {
process.exitCode = 0;
})
- .catch(err => {
+ .catch((err) => {
console.error(err);
process.exitCode = 1;
});
@@ -43,7 +43,7 @@ async function runSetupSymlinkAsync() {
* @returns {Promise} result
*/
function checkSymlinkExistsAsync() {
- return new Promise(resolve => {
+ return new Promise((resolve) => {
if (
fs.existsSync(nodeModulesFolder) &&
fs.existsSync(webpackDependencyFolder) &&
@@ -94,10 +94,10 @@ function exec(command, args, description) {
shell: true
});
- cp.on("error", error => {
+ cp.on("error", (error) => {
reject(new Error(`${description} failed with ${error}`));
});
- cp.on("exit", exitCode => {
+ cp.on("exit", (exitCode) => {
if (exitCode) {
reject(new Error(`${description} failed with exit code ${exitCode}`));
} else {
@@ -122,10 +122,10 @@ function execGetOutput(command, args, description) {
shell: true
});
- cp.on("error", error => {
+ cp.on("error", (error) => {
reject(new Error(`${description} failed with ${error}`));
});
- cp.on("exit", exitCode => {
+ cp.on("exit", (exitCode) => {
if (exitCode) {
reject(new Error(`${description} failed with exit code ${exitCode}`));
} else {
@@ -134,7 +134,7 @@ function execGetOutput(command, args, description) {
});
/** @type {Buffer[]} */
const buffers = [];
- cp.stdout.on("data", data => buffers.push(data));
+ cp.stdout.on("data", (data) => buffers.push(data));
});
}
diff --git a/test/ArrayHelpers.unittest.js b/test/ArrayHelpers.unittest.js
index d34c6f9ec..ea8de6bb0 100644
--- a/test/ArrayHelpers.unittest.js
+++ b/test/ArrayHelpers.unittest.js
@@ -5,7 +5,7 @@ const ArrayHelpers = require("../lib/util/ArrayHelpers");
describe("ArrayHelpers", () => {
it("groupBy should partition into two arrays", () => {
expect(
- ArrayHelpers.groupBy([1, 2, 3, 4, 5, 6], x => x % 2 === 0)
+ ArrayHelpers.groupBy([1, 2, 3, 4, 5, 6], (x) => x % 2 === 0)
).toStrictEqual([
[2, 4, 6],
[1, 3, 5]
@@ -13,6 +13,9 @@ describe("ArrayHelpers", () => {
});
it("groupBy works with empty array", () => {
- expect(ArrayHelpers.groupBy([], x => x % 2 === 0)).toStrictEqual([[], []]);
+ expect(ArrayHelpers.groupBy([], (x) => x % 2 === 0)).toStrictEqual([
+ [],
+ []
+ ]);
});
});
diff --git a/test/BannerPlugin.test.js b/test/BannerPlugin.test.js
index 0395467e0..8f6f31419 100644
--- a/test/BannerPlugin.test.js
+++ b/test/BannerPlugin.test.js
@@ -9,7 +9,7 @@ const pluginDir = path.join(__dirname, "js", "BannerPlugin");
const outputDir = path.join(pluginDir, "output");
describe("BannerPlugin", () => {
- it("should cache assets", done => {
+ it("should cache assets", (done) => {
const entry1File = path.join(pluginDir, "entry1.js");
const entry2File = path.join(pluginDir, "entry2.js");
const outputFile = path.join(outputDir, "entry1.js");
@@ -33,21 +33,23 @@ describe("BannerPlugin", () => {
});
fs.writeFileSync(entry1File, "1", "utf8");
fs.writeFileSync(entry2File, "1", "utf8");
- compiler.run(err => {
+ compiler.run((err) => {
if (err) return done(err);
const footerFileResults = fs.readFileSync(outputFile, "utf8").split("\n");
expect(footerFileResults[0]).toBe("/*! banner is a string */");
fs.writeFileSync(entry2File, "2", "utf8");
compiler.run((err, stats) => {
const { assets } = stats.toJson();
- expect(assets.find(as => as.name === "entry1.js").emitted).toBe(false);
- expect(assets.find(as => as.name === "entry2.js").emitted).toBe(true);
+ expect(assets.find((as) => as.name === "entry1.js").emitted).toBe(
+ false
+ );
+ expect(assets.find((as) => as.name === "entry2.js").emitted).toBe(true);
done(err);
});
});
});
- it("can place banner as footer", done => {
+ it("can place banner as footer", (done) => {
const footerFile = path.join(pluginDir, "footerFile.js");
const outputFile = path.join(outputDir, "footerFile.js");
try {
@@ -73,7 +75,7 @@ describe("BannerPlugin", () => {
]
});
fs.writeFileSync(footerFile, "footer", "utf8");
- compiler.run(err => {
+ compiler.run((err) => {
if (err) return done(err);
const footerFileResults = fs.readFileSync(outputFile, "utf8").split("\n");
expect(footerFileResults.pop()).toBe("/*! banner is a string */");
@@ -81,7 +83,7 @@ describe("BannerPlugin", () => {
});
});
- it("should allow to change stage", done => {
+ it("should allow to change stage", (done) => {
const entryFile = path.join(pluginDir, "entry3.js");
const outputFile = path.join(outputDir, "entry3.js");
try {
@@ -108,7 +110,7 @@ describe("BannerPlugin", () => {
]
});
fs.writeFileSync(entryFile, "console.log(1 + 1);", "utf8");
- compiler.run(err => {
+ compiler.run((err) => {
if (err) return done(err);
const fileResult = fs.readFileSync(outputFile, "utf8").split("\n");
expect(fileResult[0]).toBe("/* banner is a string */");
diff --git a/test/BenchmarkTestCases.benchmark.mjs b/test/BenchmarkTestCases.benchmark.mjs
index 16ef2b112..1755c6ff9 100644
--- a/test/BenchmarkTestCases.benchmark.mjs
+++ b/test/BenchmarkTestCases.benchmark.mjs
@@ -42,7 +42,7 @@ const checkV8Flags = () => {
const requiredFlags = getV8Flags();
const actualFlags = process.execArgv;
const missingFlags = requiredFlags.filter(
- flag => !actualFlags.includes(flag)
+ (flag) => !actualFlags.includes(flag)
);
if (missingFlags.length > 0) {
console.warn(`Missing required flags: ${missingFlags.join(", ")}`);
@@ -364,11 +364,11 @@ async function registerSuite(bench, test, baselines) {
).default;
await Promise.all(
- baselines.map(async baseline => {
+ baselines.map(async (baseline) => {
const webpack = await baseline.webpack();
await Promise.all(
- scenarios.map(async scenario => {
+ scenarios.map(async (scenario) => {
const config = buildConfiguration(
test,
baseline,
@@ -393,7 +393,7 @@ async function registerSuite(bench, test, baselines) {
bench.add(
benchName,
async () => {
- const watchingPromise = new Promise(res => {
+ const watchingPromise = new Promise((res) => {
watchingResolve = res;
});
@@ -401,12 +401,12 @@ async function registerSuite(bench, test, baselines) {
writeFile(
entry,
`${originalEntryContent};console.log('watch test')`,
- err => {
+ (err) => {
if (err) {
reject(err);
}
- watchingPromise.then(stats => {
+ watchingPromise.then((stats) => {
// Construct and print stats to be more accurate with real life projects
stats.toString();
@@ -423,7 +423,7 @@ async function registerSuite(bench, test, baselines) {
watching = await runWatch(webpack(config));
watching.compiler.hooks.afterDone.tap(
"WatchingBenchmarkPlugin",
- stats => {
+ (stats) => {
if (watchingResolve) {
watchingResolve(stats);
}
@@ -432,7 +432,7 @@ async function registerSuite(bench, test, baselines) {
},
async afterEach() {
await new Promise((resolve, reject) => {
- writeFile(entry, originalEntryContent, err => {
+ writeFile(entry, originalEntryContent, (err) => {
if (err) {
reject(err);
return;
@@ -445,7 +445,7 @@ async function registerSuite(bench, test, baselines) {
async afterAll() {
await new Promise((resolve, reject) => {
if (watching) {
- watching.close(closeErr => {
+ watching.close((closeErr) => {
if (closeErr) {
reject(closeErr);
return;
@@ -475,7 +475,7 @@ async function registerSuite(bench, test, baselines) {
throw new Error(stats.toString());
}
- baseCompiler.close(closeErr => {
+ baseCompiler.close((closeErr) => {
if (closeErr) {
reject(closeErr);
return;
@@ -517,15 +517,15 @@ const NEGATIVE_FILTER =
const casesPath = path.join(__dirname, "benchmarkCases");
const allBenchmarks = (await fs.readdir(casesPath))
.filter(
- item =>
+ (item) =>
!item.includes("_") &&
(FILTER ? FILTER.test(item) : true) &&
(NEGATIVE_FILTER ? !NEGATIVE_FILTER.test(item) : true)
)
.sort((a, b) => a.localeCompare(b));
-const benchmarks = allBenchmarks.filter(item => !item.includes("-long"));
-const longBenchmarks = allBenchmarks.filter(item => item.includes("-long"));
+const benchmarks = allBenchmarks.filter((item) => !item.includes("-long"));
+const longBenchmarks = allBenchmarks.filter((item) => item.includes("-long"));
const i = Math.floor(benchmarks.length / longBenchmarks.length);
for (const [index, value] of longBenchmarks.entries()) {
@@ -534,7 +534,7 @@ for (const [index, value] of longBenchmarks.entries()) {
const shard =
typeof process.env.SHARD !== "undefined"
- ? process.env.SHARD.split("/").map(item => Number.parseInt(item, 10))
+ ? process.env.SHARD.split("/").map((item) => Number.parseInt(item, 10))
: [1, 1];
if (
@@ -568,7 +568,7 @@ if (countOfBenchmarks < shard[1]) {
}
await Promise.all(
- splitToNChunks(benchmarks, shard[1])[shard[0] - 1].map(benchmark =>
+ splitToNChunks(benchmarks, shard[1])[shard[0] - 1].map((benchmark) =>
registerSuite(bench, benchmark, baselines)
)
);
@@ -607,7 +607,7 @@ function formatTime(value) {
const statsByTests = new Map();
-bench.addEventListener("cycle", event => {
+bench.addEventListener("cycle", (event) => {
const task = event.task;
const runs = task.runs;
const nSqrt = Math.sqrt(runs);
@@ -647,7 +647,7 @@ bench.addEventListener("cycle", event => {
});
// Fix for https://github.com/CodSpeedHQ/codspeed-node/issues/44
-for (const name of bench.tasks.map(task => task.name)) {
+for (const name of bench.tasks.map((task) => task.name)) {
const task = bench.getTask(name);
task.opts = task.fnOpts;
diff --git a/test/BinaryMiddleware.unittest.js b/test/BinaryMiddleware.unittest.js
index 92aa6b513..f7132ced9 100644
--- a/test/BinaryMiddleware.unittest.js
+++ b/test/BinaryMiddleware.unittest.js
@@ -14,7 +14,7 @@ const cont = (base, count) => {
const mw = new BinaryMiddleware();
const other = { other: true };
-const resolveLazy = item => {
+const resolveLazy = (item) => {
if (SerializerMiddleware.isLazy(item)) {
const data = item();
if (Array.isArray(data)) return { resolvesTo: data.map(resolveLazy) };
@@ -68,7 +68,7 @@ describe("BinaryMiddleware", () => {
items.push(undefined);
const cases = [
- ...itemsWithLazy.map(item => [item]),
+ ...itemsWithLazy.map((item) => [item]),
[(true, true)],
[false, true],
[true, false],
@@ -109,7 +109,7 @@ describe("BinaryMiddleware", () => {
for (const append of items) {
if (c > 1 && append !== undefined) continue;
const data = [prepend, ...caseData, append].filter(
- x => x !== undefined
+ (x) => x !== undefined
);
if (data.length * c > 200000) continue;
if (data.length === 0) continue;
diff --git a/test/BuildDependencies.longtest.js b/test/BuildDependencies.longtest.js
index f3e12faf6..7deb97f74 100644
--- a/test/BuildDependencies.longtest.js
+++ b/test/BuildDependencies.longtest.js
@@ -37,9 +37,9 @@ const exec = (n, options = {}) =>
}
);
const chunks = [];
- p.stderr.on("data", chunk => chunks.push(chunk));
- p.stdout.on("data", chunk => chunks.push(chunk));
- p.once("exit", code => {
+ p.stderr.on("data", (chunk) => chunks.push(chunk));
+ p.stdout.on("data", (chunk) => chunks.push(chunk));
+ p.once("exit", (code) => {
const errors = [];
const warnings = [];
const rawStdout = chunks.join("");
@@ -61,7 +61,7 @@ const exec = (n, options = {}) =>
);
}
for (const regexp of options.warnings || []) {
- const idx = warnings.findIndex(w => regexp.test(w));
+ const idx = warnings.findIndex((w) => regexp.test(w));
if (idx < 0) {
return reject(
new Error(
@@ -89,7 +89,7 @@ const exec = (n, options = {}) =>
reject(new Error(`Code ${code}: ${stdout}`));
}
});
- p.once("error", err => {
+ p.once("error", (err) => {
const stdout = chunks.join("");
console.log(stdout);
reject(err);
@@ -99,7 +99,7 @@ const exec = (n, options = {}) =>
const supportsEsm = Number(process.versions.modules) >= 83;
describe("BuildDependencies", () => {
- beforeEach(done => {
+ beforeEach((done) => {
rimraf(cacheDirectory, () => {
rimraf(outputDirectory, () => {
rimraf(inputDirectory, () => {
diff --git a/test/ChangesAndRemovals.test.js b/test/ChangesAndRemovals.test.js
index 64fca1015..11c3761ee 100644
--- a/test/ChangesAndRemovals.test.js
+++ b/test/ChangesAndRemovals.test.js
@@ -7,7 +7,7 @@ const fs = require("graceful-fs");
const { Volume, createFsFromVolume } = require("memfs");
const rimraf = require("rimraf");
-const createCompiler = config => {
+const createCompiler = (config) => {
const webpack = require("..");
const compiler = webpack(config);
@@ -37,7 +37,7 @@ const onceDone = (compiler, action) => {
});
};
-const getChanges = compiler => {
+const getChanges = (compiler) => {
const modifiedFiles = compiler.modifiedFiles;
const removedFiles = compiler.removedFiles;
return {
@@ -75,8 +75,8 @@ function createFiles() {
jest.setTimeout(30000);
describe("ChangesAndRemovals", () => {
- beforeEach(done => {
- cleanup(err => {
+ beforeEach((done) => {
+ cleanup((err) => {
if (err) return done(err);
createFiles();
// Wait 2.5s after creating the files,
@@ -94,10 +94,10 @@ describe("ChangesAndRemovals", () => {
return;
}
- it("should not track modified/removed files during initial watchRun", done => {
+ it("should not track modified/removed files during initial watchRun", (done) => {
const compiler = createSingleCompiler();
- const watchRunFinished = new Promise(resolve => {
- compiler.hooks.watchRun.tap("ChangesAndRemovalsTest", compiler => {
+ const watchRunFinished = new Promise((resolve) => {
+ compiler.hooks.watchRun.tap("ChangesAndRemovalsTest", (compiler) => {
expect(getChanges(compiler)).toEqual({
removed: undefined,
modified: undefined
@@ -105,7 +105,7 @@ describe("ChangesAndRemovals", () => {
resolve();
});
});
- const watcher = compiler.watch({ aggregateTimeout: 200 }, err => {
+ const watcher = compiler.watch({ aggregateTimeout: 200 }, (err) => {
if (err) done(err);
});
@@ -114,11 +114,11 @@ describe("ChangesAndRemovals", () => {
});
});
- it("should track modified files when they've been modified", done => {
+ it("should track modified files when they've been modified", (done) => {
const compiler = createSingleCompiler();
let watcher;
- compiler.hooks.watchRun.tap("ChangesAndRemovalsTest", compiler => {
+ compiler.hooks.watchRun.tap("ChangesAndRemovalsTest", (compiler) => {
if (!watcher) return;
if (!compiler.modifiedFiles) return;
expect(getChanges(compiler)).toEqual({
@@ -129,7 +129,7 @@ describe("ChangesAndRemovals", () => {
watcher = null;
});
- watcher = compiler.watch({ aggregateTimeout: 200 }, err => {
+ watcher = compiler.watch({ aggregateTimeout: 200 }, (err) => {
if (err) done(err);
});
@@ -138,11 +138,11 @@ describe("ChangesAndRemovals", () => {
});
});
- it("should track removed file when removing file", done => {
+ it("should track removed file when removing file", (done) => {
const compiler = createSingleCompiler();
let watcher;
- compiler.hooks.watchRun.tap("ChangesAndRemovalsTest", compiler => {
+ compiler.hooks.watchRun.tap("ChangesAndRemovalsTest", (compiler) => {
if (!watcher) return;
if (!compiler.modifiedFiles) return;
expect(getChanges(compiler)).toEqual({
@@ -153,7 +153,7 @@ describe("ChangesAndRemovals", () => {
watcher = null;
});
- watcher = compiler.watch({ aggregateTimeout: 200 }, err => {
+ watcher = compiler.watch({ aggregateTimeout: 200 }, (err) => {
if (err) done(err);
});
diff --git a/test/Cli.basictest.js b/test/Cli.basictest.js
index 78bb0ca76..ff06ea4b7 100644
--- a/test/Cli.basictest.js
+++ b/test/Cli.basictest.js
@@ -59,9 +59,9 @@ describe("Cli", () => {
});
};
- test("none", {}, {}, e => e.toMatchInlineSnapshot("Object {}"));
+ test("none", {}, {}, (e) => e.toMatchInlineSnapshot("Object {}"));
- test("root boolean", { bail: true }, {}, e =>
+ test("root boolean", { bail: true }, {}, (e) =>
e.toMatchInlineSnapshot(`
Object {
"bail": true,
@@ -69,7 +69,7 @@ describe("Cli", () => {
`)
);
- test("root single item of multiple", { entry: "./a.js" }, {}, e =>
+ test("root single item of multiple", { entry: "./a.js" }, {}, (e) =>
e.toMatchInlineSnapshot(`
Object {
"entry": Array [
@@ -83,7 +83,7 @@ describe("Cli", () => {
"root single item of multiple with existing item",
{ entry: "./a.js" },
{ entry: "./old.js" },
- e =>
+ (e) =>
e.toMatchInlineSnapshot(`
Object {
"entry": Array [
@@ -98,7 +98,7 @@ describe("Cli", () => {
"root single item of multiple with existing items",
{ entry: "./a.js" },
{ entry: ["./old1.js", "./old2.js"] },
- e =>
+ (e) =>
e.toMatchInlineSnapshot(`
Object {
"entry": Array [
@@ -110,7 +110,7 @@ describe("Cli", () => {
`)
);
- test("root multiple items", { entry: ["./a.js", "./b.js"] }, {}, e =>
+ test("root multiple items", { entry: ["./a.js", "./b.js"] }, {}, (e) =>
e.toMatchInlineSnapshot(`
Object {
"entry": Array [
@@ -125,7 +125,7 @@ describe("Cli", () => {
"root multiple items with existing item",
{ entry: ["./a.js", "./b.js"] },
{ entry: "./old.js" },
- e =>
+ (e) =>
e.toMatchInlineSnapshot(`
Object {
"entry": Array [
@@ -141,7 +141,7 @@ describe("Cli", () => {
"root multiple items with existing items",
{ entry: ["./a.js", "./b.js"] },
{ entry: ["./old1.js", "./old2.js"] },
- e =>
+ (e) =>
e.toMatchInlineSnapshot(`
Object {
"entry": Array [
@@ -154,7 +154,7 @@ describe("Cli", () => {
`)
);
- test("nested boolean", { "experiments-top-level-await": true }, {}, e =>
+ test("nested boolean", { "experiments-top-level-await": true }, {}, (e) =>
e.toMatchInlineSnapshot(`
Object {
"experiments": Object {
@@ -168,7 +168,7 @@ describe("Cli", () => {
"nested regexp",
{ "stats-warnings-filter": ["/module/", "path"] },
{},
- e =>
+ (e) =>
e.toMatchInlineSnapshot(`
Object {
"stats": Object {
@@ -188,7 +188,7 @@ describe("Cli", () => {
"module-rules-use": ["css-loader", "babel-loader"]
},
{},
- e =>
+ (e) =>
e.toMatchInlineSnapshot(`
Object {
"module": Object {
@@ -227,7 +227,7 @@ describe("Cli", () => {
]
}
},
- e =>
+ (e) =>
e.toMatchInlineSnapshot(`
Object {
"module": Object {
@@ -259,7 +259,7 @@ describe("Cli", () => {
"output-chunk-load-timeout": "20000"
},
{},
- e =>
+ (e) =>
e.toMatchInlineSnapshot(`
Object {
"output": Object {
@@ -285,7 +285,7 @@ describe("Cli", () => {
amd: "false"
},
{},
- e =>
+ (e) =>
e.toMatchInlineSnapshot(`
Object {
"amd": false,
@@ -328,7 +328,7 @@ describe("Cli", () => {
library: "hello"
}
},
- e =>
+ (e) =>
e.toMatchInlineSnapshot(`
Array [
Object {
diff --git a/test/Compiler-caching.test.js b/test/Compiler-caching.test.js
index 69f0a9986..859c3f089 100644
--- a/test/Compiler-caching.test.js
+++ b/test/Compiler-caching.test.js
@@ -49,7 +49,7 @@ describe("Compiler (caching)", () => {
};
c.hooks.compilation.tap(
"CompilerCachingTest",
- compilation => (compilation.bail = true)
+ (compilation) => (compilation.bail = true)
);
let compilerIteration = 1;
@@ -129,7 +129,7 @@ describe("Compiler (caching)", () => {
};
}
- it("should cache single file (with manual 1s wait)", done => {
+ it("should cache single file (with manual 1s wait)", (done) => {
const options = {};
const tempFixture = createTempFixture();
@@ -163,7 +163,7 @@ describe("Compiler (caching)", () => {
});
});
- it("should cache single file (even with no timeout)", done => {
+ it("should cache single file (even with no timeout)", (done) => {
const options = {};
const tempFixture = createTempFixture();
@@ -199,7 +199,7 @@ describe("Compiler (caching)", () => {
});
});
- it("should only build when modified (with manual 2s wait)", done => {
+ it("should only build when modified (with manual 2s wait)", (done) => {
const options = {};
const tempFixture = createTempFixture();
@@ -244,7 +244,7 @@ describe("Compiler (caching)", () => {
});
});
- it("should build when modified (even with no timeout)", done => {
+ it("should build when modified (even with no timeout)", (done) => {
const options = {};
const tempFixture = createTempFixture();
diff --git a/test/Compiler-filesystem-caching.test.js b/test/Compiler-filesystem-caching.test.js
index 484d8b168..2958d4109 100644
--- a/test/Compiler-filesystem-caching.test.js
+++ b/test/Compiler-filesystem-caching.test.js
@@ -53,7 +53,7 @@ describe("Compiler (filesystem caching)", () => {
apply(compiler) {
const name = "TestCachePlugin";
- compiler.hooks.thisCompilation.tap(name, compilation => {
+ compiler.hooks.thisCompilation.tap(name, (compilation) => {
compilation.hooks.processAssets.tapPromise(
{
name,
@@ -158,7 +158,7 @@ describe("Compiler (filesystem caching)", () => {
const c = webpack(options);
c.hooks.compilation.tap(
"CompilerCachingTest",
- compilation => (compilation.bail = true)
+ (compilation) => (compilation.bail = true)
);
c.run((err, stats) => {
if (err) throw err;
@@ -224,14 +224,14 @@ describe("Compiler (filesystem caching)", () => {
};
}
- it("should compile again when cached asset has changed but loader output remains the same", done => {
+ it("should compile again when cached asset has changed but loader output remains the same", (done) => {
const tempFixture = createTempFixture();
- const onError = error => done(error);
+ const onError = (error) => done(error);
const helper = compile(
tempFixture.usesAssetFilepath,
- stats => {
+ (stats) => {
// Not cached the first time
expect(stats.assets[0].name).toBe("bundle.js");
expect(stats.assets[0].emitted).toBe(true);
@@ -239,7 +239,7 @@ describe("Compiler (filesystem caching)", () => {
expect(stats.assets[1].name).toMatch(/\w+\.svg$/);
expect(stats.assets[0].emitted).toBe(true);
- helper.runAgain(stats => {
+ helper.runAgain((stats) => {
// Cached the second run
expect(stats.assets[0].name).toBe("bundle.js");
expect(stats.assets[0].emitted).toBe(false);
@@ -254,7 +254,7 @@ describe("Compiler (filesystem caching)", () => {
fs.writeFileSync(tempFixture.svgFilepath, svgContent);
- helper.runAgain(stats => {
+ helper.runAgain((stats) => {
// Still cached after file modification because loader always returns empty
expect(stats.assets[0].name).toBe("bundle.js");
expect(stats.assets[0].emitted).toBe(false);
diff --git a/test/Compiler.test.js b/test/Compiler.test.js
index 7eabfa723..44b6b23c9 100644
--- a/test/Compiler.test.js
+++ b/test/Compiler.test.js
@@ -49,7 +49,7 @@ describe("Compiler", () => {
};
c.hooks.compilation.tap(
"CompilerTest",
- compilation => (compilation.bail = true)
+ (compilation) => (compilation.bail = true)
);
c.run((err, stats) => {
if (err) throw err;
@@ -67,7 +67,7 @@ describe("Compiler", () => {
throw stats.errors[0];
}
stats.logs = logs;
- c.close(err => {
+ c.close((err) => {
if (err) return callback(err);
callback(stats, files, compilation);
});
@@ -76,7 +76,7 @@ describe("Compiler", () => {
let compiler;
- afterEach(callback => {
+ afterEach((callback) => {
if (compiler) {
compiler.close(callback);
compiler = undefined;
@@ -85,7 +85,7 @@ describe("Compiler", () => {
}
});
- it("should compile a single file to deep output", done => {
+ it("should compile a single file to deep output", (done) => {
compile(
"./c",
{
@@ -101,7 +101,7 @@ describe("Compiler", () => {
);
});
- it("should compile a single file", done => {
+ it("should compile a single file", (done) => {
compile("./c", {}, (stats, files) => {
expect(Object.keys(files)).toEqual(["/main.js"]);
const bundle = files["/main.js"];
@@ -119,7 +119,7 @@ describe("Compiler", () => {
});
});
- it("should compile a complex file", done => {
+ it("should compile a complex file", (done) => {
compile("./main1", {}, (stats, files) => {
expect(Object.keys(files)).toEqual(["/main.js"]);
const bundle = files["/main.js"];
@@ -140,7 +140,7 @@ describe("Compiler", () => {
});
});
- it("should compile a file with transitive dependencies", done => {
+ it("should compile a file with transitive dependencies", (done) => {
compile("./abc", {}, (stats, files) => {
expect(Object.keys(files)).toEqual(["/main.js"]);
const bundle = files["/main.js"];
@@ -163,7 +163,7 @@ describe("Compiler", () => {
});
});
- it("should compile a file with multiple chunks", done => {
+ it("should compile a file with multiple chunks", (done) => {
compile("./chunks", {}, (stats, files) => {
expect(stats.chunks).toHaveLength(2);
expect(Object.keys(files)).toEqual(["/main.js", "/78.js"]);
@@ -189,7 +189,7 @@ describe("Compiler", () => {
});
// cspell:word asmjs
- it("should not evaluate constants in asm.js", done => {
+ it("should not evaluate constants in asm.js", (done) => {
compile("./asmjs", {}, (stats, files) => {
expect(Object.keys(files)).toEqual(["/main.js"]);
const bundle = files["/main.js"];
@@ -224,7 +224,7 @@ describe("Compiler", () => {
});
});
- afterEach(callback => {
+ afterEach((callback) => {
if (compiler) {
compiler.close(callback);
compiler = undefined;
@@ -233,7 +233,7 @@ describe("Compiler", () => {
}
});
- it("default platform info", done => {
+ it("default platform info", (done) => {
const platform = compiler.platform;
expect(platform.web).toBe(true);
expect(platform.node).toBe(false);
@@ -241,7 +241,7 @@ describe("Compiler", () => {
});
describe("purgeInputFileSystem", () => {
- it("invokes purge() if inputFileSystem.purge", done => {
+ it("invokes purge() if inputFileSystem.purge", (done) => {
const mockPurge = jest.fn();
compiler.inputFileSystem = {
purge: mockPurge
@@ -251,7 +251,7 @@ describe("Compiler", () => {
done();
});
- it("does NOT invoke purge() if !inputFileSystem.purge", done => {
+ it("does NOT invoke purge() if !inputFileSystem.purge", (done) => {
const mockPurge = jest.fn();
compiler.inputFileSystem = null;
compiler.purgeInputFileSystem();
@@ -261,7 +261,7 @@ describe("Compiler", () => {
});
describe("isChild", () => {
- it("returns booleanized this.parentCompilation", done => {
+ it("returns booleanized this.parentCompilation", (done) => {
compiler.parentCompilation = "stringyStringString";
const response1 = compiler.isChild();
expect(response1).toBe(true);
@@ -304,7 +304,7 @@ describe("Compiler", () => {
});
});
- it("platformPlugin", done => {
+ it("platformPlugin", (done) => {
const webpack = require("..");
const compiler = webpack({
@@ -315,7 +315,7 @@ describe("Compiler", () => {
},
plugins: [
new (require("../lib/PlatformPlugin"))({ node: true }),
- compiler => {
+ (compiler) => {
compiler.hooks.afterEnvironment.tap("test", () => {
const platform = compiler.platform;
expect(platform.node).toBe(true);
@@ -327,7 +327,7 @@ describe("Compiler", () => {
compiler.close(done);
});
- it("should not emit on errors", done => {
+ it("should not emit on errors", (done) => {
const webpack = require("..");
compiler = webpack({
@@ -352,7 +352,7 @@ describe("Compiler", () => {
it("should bubble up errors when wrapped in a promise and bail is true", async () => {
let errored;
try {
- const createCompiler = options =>
+ const createCompiler = (options) =>
new Promise((resolve, reject) => {
const webpack = require("..");
@@ -392,7 +392,7 @@ describe("Compiler", () => {
});
it("should not emit compilation errors in async (watch)", async () => {
- const createStats = options =>
+ const createStats = (options) =>
new Promise((resolve, reject) => {
const webpack = require("..");
@@ -417,7 +417,7 @@ describe("Compiler", () => {
expect(stats).toBeInstanceOf(Stats);
});
- it("should not emit on errors (watch)", done => {
+ it("should not emit on errors (watch)", (done) => {
const webpack = require("..");
compiler = webpack({
@@ -440,7 +440,7 @@ describe("Compiler", () => {
});
});
- it("should not be running twice at a time (run)", done => {
+ it("should not be running twice at a time (run)", (done) => {
const webpack = require("..");
compiler = webpack({
@@ -461,7 +461,7 @@ describe("Compiler", () => {
});
});
- it("should not be running twice at a time (watch)", done => {
+ it("should not be running twice at a time (watch)", (done) => {
const webpack = require("..");
compiler = webpack({
@@ -482,7 +482,7 @@ describe("Compiler", () => {
});
});
- it("should not be running twice at a time (run - watch)", done => {
+ it("should not be running twice at a time (run - watch)", (done) => {
const webpack = require("..");
compiler = webpack({
@@ -503,7 +503,7 @@ describe("Compiler", () => {
});
});
- it("should not be running twice at a time (watch - run)", done => {
+ it("should not be running twice at a time (watch - run)", (done) => {
const webpack = require("..");
compiler = webpack({
@@ -524,7 +524,7 @@ describe("Compiler", () => {
});
});
- it("should not be running twice at a time (instance cb)", done => {
+ it("should not be running twice at a time (instance cb)", (done) => {
const webpack = require("..");
compiler = webpack(
@@ -545,7 +545,7 @@ describe("Compiler", () => {
});
});
- it("should run again correctly after first compilation", done => {
+ it("should run again correctly after first compilation", (done) => {
const webpack = require("..");
compiler = webpack({
@@ -569,7 +569,7 @@ describe("Compiler", () => {
});
});
- it("should watch again correctly after first compilation", done => {
+ it("should watch again correctly after first compilation", (done) => {
const webpack = require("..");
compiler = webpack({
@@ -592,7 +592,7 @@ describe("Compiler", () => {
});
});
- it("should run again correctly after first closed watch", done => {
+ it("should run again correctly after first closed watch", (done) => {
const webpack = require("..");
compiler = webpack({
@@ -616,7 +616,7 @@ describe("Compiler", () => {
});
});
- it("should set compiler.watching correctly", done => {
+ it("should set compiler.watching correctly", (done) => {
const webpack = require("..");
compiler = webpack({
@@ -636,7 +636,7 @@ describe("Compiler", () => {
expect(compiler.watching).toBe(watching);
});
- it("should watch again correctly after first closed watch", done => {
+ it("should watch again correctly after first closed watch", (done) => {
const webpack = require("..");
compiler = webpack({
@@ -660,7 +660,7 @@ describe("Compiler", () => {
});
});
- it("should run again correctly inside afterDone hook", done => {
+ it("should run again correctly inside afterDone hook", (done) => {
const webpack = require("..");
compiler = webpack({
@@ -687,7 +687,7 @@ describe("Compiler", () => {
});
});
- it("should call afterDone hook after other callbacks (run)", done => {
+ it("should call afterDone hook after other callbacks (run)", (done) => {
const webpack = require("..");
compiler = webpack({
@@ -714,7 +714,7 @@ describe("Compiler", () => {
});
});
- it("should call afterDone hook after other callbacks (instance cb)", done => {
+ it("should call afterDone hook after other callbacks (instance cb)", (done) => {
const instanceCb = jest.fn();
const webpack = require("..");
@@ -744,7 +744,7 @@ describe("Compiler", () => {
});
});
- it("should call afterDone hook after other callbacks (watch)", done => {
+ it("should call afterDone hook after other callbacks (watch)", (done) => {
const webpack = require("..");
compiler = webpack({
@@ -779,7 +779,7 @@ describe("Compiler", () => {
});
});
- it("should call afterDone hook after other callbacks (watch close)", done => {
+ it("should call afterDone hook after other callbacks (watch close)", (done) => {
const webpack = require("..");
compiler = webpack({
@@ -814,7 +814,7 @@ describe("Compiler", () => {
});
});
- it("should flag watchMode as true in watch", done => {
+ it("should flag watchMode as true in watch", (done) => {
const webpack = require("..");
compiler = webpack({
@@ -829,7 +829,7 @@ describe("Compiler", () => {
compiler.outputFileSystem = createFsFromVolume(new Volume());
- const watch = compiler.watch({}, err => {
+ const watch = compiler.watch({}, (err) => {
if (err) return done(err);
expect(compiler.watchMode).toBeTruthy();
watch.close(() => {
@@ -839,7 +839,7 @@ describe("Compiler", () => {
});
});
- it("should use cache on second run call", done => {
+ it("should use cache on second run call", (done) => {
const webpack = require("..");
compiler = webpack({
@@ -864,7 +864,7 @@ describe("Compiler", () => {
});
});
- it("should call the failed-hook on error", done => {
+ it("should call the failed-hook on error", (done) => {
const failedSpy = jest.fn();
const webpack = require("..");
@@ -916,7 +916,7 @@ describe("Compiler", () => {
capture.restore();
});
- const escapeAnsi = stringRaw =>
+ const escapeAnsi = (stringRaw) =>
stringRaw
.replace(/\u001B\[1m\u001B\[([0-9;]*)m/g, "")
.replace(/\u001B\[1m/g, "")
@@ -940,7 +940,7 @@ describe("Compiler", () => {
}
}
- it("should log to the console (verbose)", done => {
+ it("should log to the console (verbose)", (done) => {
const webpack = require("..");
compiler = webpack({
@@ -973,7 +973,7 @@ describe("Compiler", () => {
});
});
- it("should log to the console (debug mode)", done => {
+ it("should log to the console (debug mode)", (done) => {
const webpack = require("..");
compiler = webpack({
@@ -1008,7 +1008,7 @@ describe("Compiler", () => {
});
});
- it("should log to the console (none)", done => {
+ it("should log to the console (none)", (done) => {
const webpack = require("..");
compiler = webpack({
@@ -1030,7 +1030,7 @@ describe("Compiler", () => {
});
});
- it("should log to the console with colors (verbose)", done => {
+ it("should log to the console with colors (verbose)", (done) => {
const webpack = require("..");
compiler = webpack({
@@ -1064,7 +1064,7 @@ describe("Compiler", () => {
});
});
- it("should log to the console with colors (debug mode)", done => {
+ it("should log to the console with colors (debug mode)", (done) => {
const webpack = require("..");
compiler = webpack({
diff --git a/test/ConfigTestCases.template.js b/test/ConfigTestCases.template.js
index edaa2f8bd..de6b8691b 100644
--- a/test/ConfigTestCases.template.js
+++ b/test/ConfigTestCases.template.js
@@ -18,19 +18,19 @@ const prepareOptions = require("./helpers/prepareOptions");
const { TestRunner } = require("./runner");
const casesPath = path.join(__dirname, "configCases");
-const categories = fs.readdirSync(casesPath).map(cat => ({
+const categories = fs.readdirSync(casesPath).map((cat) => ({
name: cat,
tests: fs
.readdirSync(path.join(casesPath, cat))
- .filter(folder => !folder.startsWith("_"))
+ .filter((folder) => !folder.startsWith("_"))
.sort()
}));
-const createLogger = appendTarget => ({
- log: l => appendTarget.push(l),
- debug: l => appendTarget.push(l),
- trace: l => appendTarget.push(l),
- info: l => appendTarget.push(l),
+const createLogger = (appendTarget) => ({
+ log: (l) => appendTarget.push(l),
+ debug: (l) => appendTarget.push(l),
+ trace: (l) => appendTarget.push(l),
+ info: (l) => appendTarget.push(l),
warn: console.warn.bind(console),
error: console.error.bind(console),
logTime: () => {},
@@ -43,7 +43,7 @@ const createLogger = appendTarget => ({
status: () => {}
});
-const describeCases = config => {
+const describeCases = (config) => {
describe(config.name, () => {
let stderr;
@@ -203,7 +203,7 @@ const describeCases = config => {
setTimeout(done, 200);
};
if (config.cache) {
- it(`${testName} should pre-compile to fill disk cache (1st)`, done => {
+ it(`${testName} should pre-compile to fill disk cache (1st)`, (done) => {
rimraf.sync(outputDirectory);
fs.mkdirSync(outputDirectory, { recursive: true });
infraStructureLog.length = 0;
@@ -211,7 +211,7 @@ const describeCases = config => {
const compiler = require("..")(options);
- compiler.run(err => {
+ compiler.run((err) => {
deprecationTracker();
if (err) return handleFatalError(err, done);
const infrastructureLogging = stderr.toString();
@@ -245,14 +245,14 @@ const describeCases = config => {
) {
return;
}
- compiler.close(closeErr => {
+ compiler.close((closeErr) => {
if (closeErr) return handleFatalError(closeErr, done);
done();
});
});
}, 60000);
- it(`${testName} should pre-compile to fill disk cache (2nd)`, done => {
+ it(`${testName} should pre-compile to fill disk cache (2nd)`, (done) => {
rimraf.sync(outputDirectory);
fs.mkdirSync(outputDirectory, { recursive: true });
infraStructureLog.length = 0;
@@ -287,7 +287,7 @@ const describeCases = config => {
: modules;
if (
allModules.some(
- m => m.type !== "cached modules" && !m.cached
+ (m) => m.type !== "cached modules" && !m.cached
)
) {
return done(
@@ -322,7 +322,7 @@ const describeCases = config => {
) {
return;
}
- compiler.close(closeErr => {
+ compiler.close((closeErr) => {
if (closeErr) return handleFatalError(closeErr, done);
done();
});
@@ -330,7 +330,7 @@ const describeCases = config => {
}, 40000);
}
- it(`${testName} should compile`, done => {
+ it(`${testName} should compile`, (done) => {
rimraf.sync(outputDirectory);
fs.mkdirSync(outputDirectory, { recursive: true });
infraStructureLog.length = 0;
@@ -494,10 +494,10 @@ const describeCases = config => {
try {
const compiler = require("..")(options);
- compiler.run(err => {
+ compiler.run((err) => {
if (err) return handleFatalError(err, done);
compiler.run((error, stats) => {
- compiler.close(err => {
+ compiler.close((err) => {
if (err) return handleFatalError(err, done);
onCompiled(error, stats);
});
diff --git a/test/ContextModuleFactory.unittest.js b/test/ContextModuleFactory.unittest.js
index 4841dc6f8..c4d8e2c0b 100644
--- a/test/ContextModuleFactory.unittest.js
+++ b/test/ContextModuleFactory.unittest.js
@@ -13,7 +13,7 @@ describe("ContextModuleFactory", () => {
memfs = createFsFromVolume(new Volume());
});
- it("should not report an error when ENOENT errors happen", done => {
+ it("should not report an error when ENOENT errors happen", (done) => {
memfs.readdir = (dir, callback) => {
setTimeout(() => callback(null, ["/file"]));
};
@@ -38,7 +38,7 @@ describe("ContextModuleFactory", () => {
);
});
- it("should report an error when non-ENOENT errors happen", done => {
+ it("should report an error when non-ENOENT errors happen", (done) => {
memfs.readdir = (dir, callback) => {
setTimeout(() => callback(null, ["/file"]));
};
@@ -62,7 +62,7 @@ describe("ContextModuleFactory", () => {
);
});
- it("should return callback with [] if circular symlinks exist", done => {
+ it("should return callback with [] if circular symlinks exist", (done) => {
let statDirStatus = 0;
memfs.readdir = (dir, callback) => {
statDirStatus++;
@@ -93,7 +93,7 @@ describe("ContextModuleFactory", () => {
);
});
- it("should not return callback with [] if there are no circular symlinks", done => {
+ it("should not return callback with [] if there are no circular symlinks", (done) => {
let statDirStatus = 0;
memfs.readdir = (dir, callback) => {
statDirStatus++;
@@ -126,7 +126,7 @@ describe("ContextModuleFactory", () => {
);
});
- it("should resolve correctly several resources", done => {
+ it("should resolve correctly several resources", (done) => {
memfs.readdir = (dir, callback) => {
if (dir === "/a") setTimeout(() => callback(null, ["/B"]));
if (dir === "/b") setTimeout(() => callback(null, ["/A"]));
@@ -153,12 +153,12 @@ describe("ContextModuleFactory", () => {
(err, res) => {
expect(res).not.toStrictEqual([]);
expect(Array.isArray(res)).toBe(true);
- expect(res.map(r => r.request)).toEqual([
+ expect(res.map((r) => r.request)).toEqual([
"./B/a?query#hash",
"./A/b?query#hash"
]);
- expect(res.map(r => r.getContext())).toEqual(["/a", "/b"]);
- expect(res.map(r => r.userRequest)).toEqual(["./B/a", "./A/b"]);
+ expect(res.map((r) => r.getContext())).toEqual(["/a", "/b"]);
+ expect(res.map((r) => r.userRequest)).toEqual(["./B/a", "./A/b"]);
done();
}
);
diff --git a/test/Defaults.unittest.js b/test/Defaults.unittest.js
index 4308700a9..d92a9c7b1 100644
--- a/test/Defaults.unittest.js
+++ b/test/Defaults.unittest.js
@@ -11,7 +11,7 @@ const stripVTControlCharacters = require("strip-ansi");
* @param {string} str String to quote
* @returns {string} Escaped string
*/
-const quoteMeta = str => str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&");
+const quoteMeta = (str) => str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&");
const cwd = process.cwd();
const cwdRegExp = new RegExp(
@@ -23,7 +23,7 @@ const escapedCwdRegExp = new RegExp(
`${quoteMeta(escapedCwd)}((?:\\\\\\\\)?(?:[a-zA-Z.\\-_]+\\\\\\\\)*)`,
"g"
);
-const normalize = str => {
+const normalize = (str) => {
if (cwd.startsWith("/")) {
str = str.replace(new RegExp(quoteMeta(cwd), "g"), "");
} else {
@@ -61,7 +61,7 @@ expect.addSnapshotSerializer({
}
});
-const getDefaultConfig = config => {
+const getDefaultConfig = (config) => {
const { applyWebpackOptionsDefaults, getNormalizedWebpackOptions } =
require("..").config;
@@ -693,15 +693,15 @@ describe("snapshots", () => {
});
};
- test("empty config", {}, e =>
+ test("empty config", {}, (e) =>
e.toMatchInlineSnapshot("Compared values have no visual difference.")
);
- test("none mode", { mode: "none" }, e =>
+ test("none mode", { mode: "none" }, (e) =>
e.toMatchInlineSnapshot("Compared values have no visual difference.")
);
- test("no mode provided", { mode: undefined }, e =>
+ test("no mode provided", { mode: undefined }, (e) =>
e.toMatchInlineSnapshot(`
- Expected
+ Received
@@ -771,7 +771,7 @@ describe("snapshots", () => {
`)
);
- test("production", { mode: "production" }, e =>
+ test("production", { mode: "production" }, (e) =>
e.toMatchInlineSnapshot(`
- Expected
+ Received
@@ -841,7 +841,7 @@ describe("snapshots", () => {
`)
);
- test("development", { mode: "development" }, e =>
+ test("development", { mode: "development" }, (e) =>
e.toMatchInlineSnapshot(`
- Expected
+ Received
@@ -891,7 +891,7 @@ describe("snapshots", () => {
`)
);
- test("sync wasm", { experiments: { syncWebAssembly: true } }, e =>
+ test("sync wasm", { experiments: { syncWebAssembly: true } }, (e) =>
e.toMatchInlineSnapshot(`
- Expected
+ Received
@@ -931,7 +931,7 @@ describe("snapshots", () => {
`)
);
- test("output module", { experiments: { outputModule: true } }, e =>
+ test("output module", { experiments: { outputModule: true } }, (e) =>
e.toMatchInlineSnapshot(`
- Expected
+ Received
@@ -994,7 +994,7 @@ describe("snapshots", () => {
`)
);
- test("async wasm", { experiments: { asyncWebAssembly: true } }, e =>
+ test("async wasm", { experiments: { asyncWebAssembly: true } }, (e) =>
e.toMatchInlineSnapshot(`
- Expected
+ Received
@@ -1037,7 +1037,7 @@ describe("snapshots", () => {
test(
"both wasm",
{ experiments: { syncWebAssembly: true, asyncWebAssembly: true } },
- e =>
+ (e) =>
e.toMatchInlineSnapshot(`
- Expected
+ Received
@@ -1080,7 +1080,7 @@ describe("snapshots", () => {
`)
);
- test("const filename", { output: { filename: "bundle.js" } }, e =>
+ test("const filename", { output: { filename: "bundle.js" } }, (e) =>
e.toMatchInlineSnapshot(`
- Expected
+ Received
@@ -1099,7 +1099,7 @@ describe("snapshots", () => {
`)
);
- test("function filename", { output: { filename: () => "bundle.js" } }, e =>
+ test("function filename", { output: { filename: () => "bundle.js" } }, (e) =>
e.toMatchInlineSnapshot(`
- Expected
+ Received
@@ -1118,7 +1118,7 @@ describe("snapshots", () => {
`)
);
- test("library", { output: { library: ["myLib", "awesome"] } }, e =>
+ test("library", { output: { library: ["myLib", "awesome"] } }, (e) =>
e.toMatchInlineSnapshot(`
- Expected
+ Received
@@ -1163,7 +1163,7 @@ describe("snapshots", () => {
library: ["myLib", "[name]"]
}
},
- e =>
+ (e) =>
e.toMatchInlineSnapshot(`
- Expected
+ Received
@@ -1211,7 +1211,7 @@ describe("snapshots", () => {
}
}
},
- e =>
+ (e) =>
e.toMatchInlineSnapshot(`
- Expected
+ Received
@@ -1262,7 +1262,7 @@ describe("snapshots", () => {
}
}
},
- e =>
+ (e) =>
e.toMatchInlineSnapshot(`
- Expected
+ Received
@@ -1314,7 +1314,7 @@ describe("snapshots", () => {
}
}
},
- e =>
+ (e) =>
e.toMatchInlineSnapshot(`
- Expected
+ Received
@@ -1355,7 +1355,7 @@ describe("snapshots", () => {
`)
);
- test("target node", { target: "node" }, e =>
+ test("target node", { target: "node" }, (e) =>
e.toMatchInlineSnapshot(`
- Expected
+ Received
@@ -1485,7 +1485,7 @@ describe("snapshots", () => {
`)
);
- test("target webworker", { target: "webworker" }, e =>
+ test("target webworker", { target: "webworker" }, (e) =>
e.toMatchInlineSnapshot(`
- Expected
+ Received
@@ -1509,7 +1509,7 @@ describe("snapshots", () => {
`)
);
- test("target electron-main", { target: "electron-main" }, e =>
+ test("target electron-main", { target: "electron-main" }, (e) =>
e.toMatchInlineSnapshot(`
- Expected
+ Received
@@ -1645,7 +1645,7 @@ describe("snapshots", () => {
`)
);
- test("target electron-main", { target: "electron-preload" }, e =>
+ test("target electron-main", { target: "electron-preload" }, (e) =>
e.toMatchInlineSnapshot(`
- Expected
+ Received
@@ -1779,7 +1779,7 @@ describe("snapshots", () => {
`)
);
- test("records", { recordsPath: "some-path" }, e =>
+ test("records", { recordsPath: "some-path" }, (e) =>
e.toMatchInlineSnapshot(`
- Expected
+ Received
@@ -1795,12 +1795,15 @@ describe("snapshots", () => {
`)
);
- test("ecmaVersion", { output: { ecmaVersion: 2020 } }, e =>
+ test("ecmaVersion", { output: { ecmaVersion: 2020 } }, (e) =>
e.toMatchInlineSnapshot("Compared values have no visual difference.")
);
- test("single runtimeChunk", { optimization: { runtimeChunk: "single" } }, e =>
- e.toMatchInlineSnapshot(`
+ test(
+ "single runtimeChunk",
+ { optimization: { runtimeChunk: "single" } },
+ (e) =>
+ e.toMatchInlineSnapshot(`
- Expected
+ Received
@@ -1815,7 +1818,7 @@ describe("snapshots", () => {
test(
"single runtimeChunk",
{ optimization: { runtimeChunk: "multiple" } },
- e =>
+ (e) =>
e.toMatchInlineSnapshot(`
- Expected
+ Received
@@ -1828,7 +1831,7 @@ describe("snapshots", () => {
`)
);
- test("single runtimeChunk", { optimization: { runtimeChunk: true } }, e =>
+ test("single runtimeChunk", { optimization: { runtimeChunk: true } }, (e) =>
e.toMatchInlineSnapshot(`
- Expected
+ Received
@@ -1841,7 +1844,7 @@ describe("snapshots", () => {
`)
);
- test("cache true", { cache: true }, e =>
+ test("cache true", { cache: true }, (e) =>
e.toMatchInlineSnapshot(`
- Expected
+ Received
@@ -1865,7 +1868,7 @@ describe("snapshots", () => {
`)
);
- test("cache filesystem", { cache: { type: "filesystem" } }, e =>
+ test("cache filesystem", { cache: { type: "filesystem" } }, (e) =>
e.toMatchInlineSnapshot(`
- Expected
+ Received
@@ -1911,7 +1914,7 @@ describe("snapshots", () => {
test(
"cache filesystem development",
{ mode: "development", cache: { type: "filesystem" } },
- e =>
+ (e) =>
e.toMatchInlineSnapshot(`
- Expected
+ Received
@@ -1983,7 +1986,7 @@ describe("snapshots", () => {
test(
"cache filesystem and futureDefaults",
{ cache: { type: "filesystem" }, experiments: { futureDefaults: true } },
- e =>
+ (e) =>
e.toMatchInlineSnapshot(`
- Expected
+ Received
@@ -2162,7 +2165,7 @@ describe("snapshots", () => {
amd: false,
optimization: { splitChunks: false }
},
- e =>
+ (e) =>
e.toMatchInlineSnapshot(`
- Expected
+ Received
@@ -2220,7 +2223,7 @@ describe("snapshots", () => {
trustedTypes: true
}
},
- e =>
+ (e) =>
e.toMatchInlineSnapshot(`
- Expected
+ Received
@@ -2245,7 +2248,7 @@ describe("snapshots", () => {
`)
);
- test("stats true", { stats: true }, e =>
+ test("stats true", { stats: true }, (e) =>
e.toMatchInlineSnapshot(`
- Expected
+ Received
@@ -2258,7 +2261,7 @@ describe("snapshots", () => {
`)
);
- test("stats false", { stats: false }, e =>
+ test("stats false", { stats: false }, (e) =>
e.toMatchInlineSnapshot(`
- Expected
+ Received
@@ -2271,7 +2274,7 @@ describe("snapshots", () => {
`)
);
- test("stats string", { stats: "minimal" }, e =>
+ test("stats string", { stats: "minimal" }, (e) =>
e.toMatchInlineSnapshot(`
- Expected
+ Received
@@ -2287,7 +2290,7 @@ describe("snapshots", () => {
test(
"browserslist",
{ context: path.resolve(__dirname, "fixtures/browserslist") },
- e =>
+ (e) =>
e.toMatchInlineSnapshot(`
- Expected
+ Received
@@ -2379,7 +2382,7 @@ describe("snapshots", () => {
type: "filesystem"
}
},
- e =>
+ (e) =>
e.toMatchInlineSnapshot(`
- Expected
+ Received
@@ -2456,7 +2459,7 @@ describe("snapshots", () => {
enabledWasmLoadingTypes: ["...", "async-node"]
}
},
- e =>
+ (e) =>
e.toMatchInlineSnapshot(`
- Expected
+ Received
@@ -2475,7 +2478,7 @@ describe("snapshots", () => {
futureDefaults: true
}
},
- e =>
+ (e) =>
e.toMatchInlineSnapshot(`
- Expected
+ Received
@@ -2621,7 +2624,7 @@ describe("snapshots", () => {
futureDefaults: true
}
},
- e =>
+ (e) =>
e.toMatchInlineSnapshot(`
- Expected
+ Received
@@ -2694,7 +2697,7 @@ describe("snapshots", () => {
test(
"target node with ESM output",
{ target: "node14", experiments: { outputModule: true } },
- e =>
+ (e) =>
e.toMatchInlineSnapshot(`
- Expected
+ Received
diff --git a/test/Errors.test.js b/test/Errors.test.js
index 3f657464a..91e4d91af 100644
--- a/test/Errors.test.js
+++ b/test/Errors.test.js
@@ -120,7 +120,7 @@ async function compile(options) {
if (bailedError) {
return reject(bailedError);
}
- compiler.close(closeError => {
+ compiler.close((closeError) => {
if (closeError) {
return reject(closeError);
}
diff --git a/test/Examples.test.js b/test/Examples.test.js
index 4ae464388..d31e1092e 100644
--- a/test/Examples.test.js
+++ b/test/Examples.test.js
@@ -18,7 +18,7 @@ describe("Examples", () => {
if (fs.existsSync(filterPath) && !require(filterPath)()) {
// eslint-disable-next-line jest/no-disabled-tests, jest/valid-describe-callback
describe.skip(relativePath, () =>
- it("filtered", done => {
+ it("filtered", (done) => {
done();
})
);
@@ -26,7 +26,7 @@ describe("Examples", () => {
continue;
}
- it(`should compile ${relativePath}`, done => {
+ it(`should compile ${relativePath}`, (done) => {
let options = {};
let webpackConfigPath = path.join(examplePath, "webpack.config.js");
webpackConfigPath =
diff --git a/test/FileSystemInfo.unittest.js b/test/FileSystemInfo.unittest.js
index f0c7d3c0c..b76b0eb94 100644
--- a/test/FileSystemInfo.unittest.js
+++ b/test/FileSystemInfo.unittest.js
@@ -132,7 +132,7 @@ describe("FileSystemInfo", () => {
return fs;
};
- const createFsInfo = fs => {
+ const createFsInfo = (fs) => {
const logger = {
error: (...args) => {
throw new Error(util.format(...args));
@@ -154,7 +154,7 @@ describe("FileSystemInfo", () => {
fsInfo.logs.push(`[${method}] ${msg}`);
};
}
- fsInfo.addFileTimestamps(new Map(ignored.map(i => [i, "ignore"])));
+ fsInfo.addFileTimestamps(new Map(ignored.map((i) => [i, "ignore"])));
return fsInfo;
};
@@ -186,7 +186,7 @@ describe("FileSystemInfo", () => {
);
};
- const clone = object => {
+ const clone = (object) => {
const serialized = buffersSerializer.serialize(object, {});
return buffersSerializer.deserialize(serialized, {});
};
@@ -198,7 +198,7 @@ describe("FileSystemInfo", () => {
expected,
callback
) => {
- expectSnapshotState(fs, snapshot, expected, err => {
+ expectSnapshotState(fs, snapshot, expected, (err) => {
if (err) return callback(err);
if (!snapshot2) return callback();
expectSnapshotState(fs, snapshot2, expected, callback);
@@ -207,7 +207,7 @@ describe("FileSystemInfo", () => {
const expectSnapshotState = (fs, snapshot, expected, callback) => {
const fsInfo = createFsInfo(fs);
- const details = snapshot => `${fsInfo.logs.join("\n")}
+ const details = (snapshot) => `${fsInfo.logs.join("\n")}
${util.inspect(snapshot, false, Infinity, true)}`;
fsInfo.checkSnapshotValid(snapshot, (err, valid) => {
if (err) return callback(err);
@@ -265,7 +265,7 @@ ${details(snapshot)}`)
["tsh", { timestamp: true, hash: true }]
]) {
describe(`${name} mode`, () => {
- it("should always accept an empty snapshot", done => {
+ it("should always accept an empty snapshot", (done) => {
const fs = createFs();
const fsInfo = createFsInfo(fs);
fsInfo.createSnapshot(
@@ -282,7 +282,7 @@ ${details(snapshot)}`)
);
});
- it("should accept a snapshot when fs is unchanged", done => {
+ it("should accept a snapshot when fs is unchanged", (done) => {
const fs = createFs();
createSnapshot(fs, options, (err, snapshot, snapshot2) => {
if (err) return done(err);
@@ -319,7 +319,7 @@ ${details(snapshot)}`)
...(name !== "timestamp" ? ignoredFileChanges : []),
...(name === "hash" ? ["/path/context/sub/ignored.txt"] : [])
]) {
- it(`should invalidate the snapshot when ${fileChange} is changed`, done => {
+ it(`should invalidate the snapshot when ${fileChange} is changed`, (done) => {
const fs = createFs();
createSnapshot(fs, options, (err, snapshot, snapshot2) => {
if (err) return done(err);
@@ -338,7 +338,7 @@ ${details(snapshot)}`)
...(name === "timestamp" ? ignoredFileChanges : []),
...(name !== "hash" ? ["/path/context/sub/ignored.txt"] : [])
]) {
- it(`should not invalidate the snapshot when ${fileChange} is changed`, done => {
+ it(`should not invalidate the snapshot when ${fileChange} is changed`, (done) => {
const fs = createFs();
createSnapshot(fs, options, (err, snapshot, snapshot2) => {
if (err) return done(err);
@@ -354,7 +354,7 @@ ${details(snapshot)}`)
"/path/context+files/file2.txt",
"/path/node_modules/package.txt"
]) {
- it(`should invalidate the snapshot when ${newFile} is created`, done => {
+ it(`should invalidate the snapshot when ${newFile} is created`, (done) => {
const fs = createFs();
createSnapshot(fs, options, (err, snapshot, snapshot2) => {
if (err) return done(err);
@@ -370,7 +370,7 @@ ${details(snapshot)}`)
"/path/cache/package-2345",
"/path/ignored.txt"
]) {
- it(`should not invalidate the snapshot when ${newFile} is created`, done => {
+ it(`should not invalidate the snapshot when ${newFile} is created`, (done) => {
const fs = createFs();
createSnapshot(fs, options, (err, snapshot, snapshot2) => {
if (err) return done(err);
@@ -381,7 +381,7 @@ ${details(snapshot)}`)
}
if (name !== "timestamp") {
- it("should not invalidate snapshot when only timestamps have changed", done => {
+ it("should not invalidate snapshot when only timestamps have changed", (done) => {
const fs = createFs();
createSnapshot(fs, options, (err, snapshot, snapshot2) => {
if (err) return done(err);
@@ -412,7 +412,7 @@ ${details(snapshot)}`)
);
}
- it("should return same iterable for getFileIterable()", done => {
+ it("should return same iterable for getFileIterable()", (done) => {
getSnapshot((err, snapshot) => {
if (err) done(err);
expect(snapshot.getFileIterable()).toEqual(snapshot.getFileIterable());
@@ -420,7 +420,7 @@ ${details(snapshot)}`)
});
});
- it("should return same iterable for getContextIterable()", done => {
+ it("should return same iterable for getContextIterable()", (done) => {
getSnapshot((err, snapshot) => {
if (err) done(err);
expect(snapshot.getContextIterable()).toEqual(
@@ -430,7 +430,7 @@ ${details(snapshot)}`)
});
});
- it("should return same iterable for getMissingIterable()", done => {
+ it("should return same iterable for getMissingIterable()", (done) => {
getSnapshot((err, snapshot) => {
if (err) done(err);
expect(snapshot.getFileIterable()).toEqual(snapshot.getFileIterable());
@@ -440,7 +440,7 @@ ${details(snapshot)}`)
});
describe("symlinks", () => {
- it("should work with symlinks with errors", done => {
+ it("should work with symlinks with errors", (done) => {
const fs = createFs();
fs.symlinkSync(
@@ -473,7 +473,7 @@ ${details(snapshot)}`)
);
});
- it("should work with symlinks with errors #1", done => {
+ it("should work with symlinks with errors #1", (done) => {
const fs = createFs();
fs.symlinkSync(
diff --git a/test/HotModuleReplacementPlugin.test.js b/test/HotModuleReplacementPlugin.test.js
index fce2e387d..43f0ccfc1 100644
--- a/test/HotModuleReplacementPlugin.test.js
+++ b/test/HotModuleReplacementPlugin.test.js
@@ -8,7 +8,7 @@ const webpack = require("..");
describe("HotModuleReplacementPlugin", () => {
jest.setTimeout(20000);
- it("should not have circular hashes but equal if unmodified", done => {
+ it("should not have circular hashes but equal if unmodified", (done) => {
const entryFile = path.join(
__dirname,
"js",
@@ -100,7 +100,7 @@ describe("HotModuleReplacementPlugin", () => {
});
}, 120000);
- it("output.clean=true should keep 1 last update", done => {
+ it("output.clean=true should keep 1 last update", (done) => {
const outputPath = path.join(__dirname, "js", "HotModuleReplacementPlugin");
const entryFile = path.join(outputPath, "entry.js");
const recordsFile = path.join(outputPath, "records.json");
@@ -113,7 +113,7 @@ describe("HotModuleReplacementPlugin", () => {
}
fs.writeFileSync(entryFile, `${++step}`, "utf8");
const updates = new Set();
- const hasFile = file => {
+ const hasFile = (file) => {
try {
fs.statSync(path.join(outputPath, file));
return true;
@@ -157,7 +157,7 @@ describe("HotModuleReplacementPlugin", () => {
}
return setTimeout(() => {
fs.writeFileSync(entryFile, `${++step}`, "utf8");
- compiler.run(err => {
+ compiler.run((err) => {
if (err) return done(err);
for (const file of updates) {
expect(hasFile(file)).toBe(false);
@@ -175,7 +175,7 @@ describe("HotModuleReplacementPlugin", () => {
compiler.run(callback);
}, 20000);
- it("should correct working when entry is Object and key is a number", done => {
+ it("should correct working when entry is Object and key is a number", (done) => {
const outputPath = path.join(__dirname, "js", "HotModuleReplacementPlugin");
const entryFile = path.join(outputPath, "entry.js");
const statsFile3 = path.join(
@@ -239,7 +239,7 @@ describe("HotModuleReplacementPlugin", () => {
});
});
- it("should handle entryFile that contains path variable", done => {
+ it("should handle entryFile that contains path variable", (done) => {
const entryFile = path.join(
__dirname,
"js",
diff --git a/test/HotTestCases.template.js b/test/HotTestCases.template.js
index e1b1468a7..659d44acb 100644
--- a/test/HotTestCases.template.js
+++ b/test/HotTestCases.template.js
@@ -12,15 +12,15 @@ const { TestRunner } = require("./runner");
const casesPath = path.join(__dirname, "hotCases");
let categories = fs
.readdirSync(casesPath)
- .filter(dir => fs.statSync(path.join(casesPath, dir)).isDirectory());
-categories = categories.map(cat => ({
+ .filter((dir) => fs.statSync(path.join(casesPath, dir)).isDirectory());
+categories = categories.map((cat) => ({
name: cat,
tests: fs
.readdirSync(path.join(casesPath, cat))
- .filter(folder => !folder.includes("_"))
+ .filter((folder) => !folder.includes("_"))
}));
-const describeCases = config => {
+const describeCases = (config) => {
describe(config.name, () => {
for (const category of categories) {
describe(category.name, () => {
@@ -39,12 +39,12 @@ const describeCases = config => {
describe(testName, () => {
let compiler;
- afterAll(callback => {
+ afterAll((callback) => {
compiler.close(callback);
compiler = undefined;
});
- it(`${testName} should compile`, done => {
+ it(`${testName} should compile`, (done) => {
const webpack = require("..");
const outputDirectory = path.join(
@@ -252,7 +252,7 @@ const describeCases = config => {
done();
},
- err => {
+ (err) => {
console.log(err);
done(err);
}
diff --git a/test/JavascriptParser.unittest.js b/test/JavascriptParser.unittest.js
index c34c545cd..40aca5dd4 100644
--- a/test/JavascriptParser.unittest.js
+++ b/test/JavascriptParser.unittest.js
@@ -270,23 +270,27 @@ describe("JavascriptParser", () => {
const testParser = new JavascriptParser({});
testParser.hooks.canRename
.for("abc")
- .tap("JavascriptParserTest", _expr => true);
+ .tap("JavascriptParserTest", (_expr) => true);
testParser.hooks.canRename
.for("ijk")
- .tap("JavascriptParserTest", _expr => true);
- testParser.hooks.call.for("abc").tap("JavascriptParserTest", expr => {
+ .tap("JavascriptParserTest", (_expr) => true);
+ testParser.hooks.call.for("abc").tap("JavascriptParserTest", (expr) => {
if (!testParser.state.abc) testParser.state.abc = [];
testParser.state.abc.push(testParser.parseString(expr.arguments[0]));
return true;
});
- testParser.hooks.call.for("cde.abc").tap("JavascriptParserTest", expr => {
- if (!testParser.state.cdeabc) testParser.state.cdeabc = [];
- testParser.state.cdeabc.push(testParser.parseString(expr.arguments[0]));
- return true;
- });
+ testParser.hooks.call
+ .for("cde.abc")
+ .tap("JavascriptParserTest", (expr) => {
+ if (!testParser.state.cdeabc) testParser.state.cdeabc = [];
+ testParser.state.cdeabc.push(
+ testParser.parseString(expr.arguments[0])
+ );
+ return true;
+ });
testParser.hooks.call
.for("cde.ddd.abc")
- .tap("JavascriptParserTest", expr => {
+ .tap("JavascriptParserTest", (expr) => {
if (!testParser.state.cdedddabc) testParser.state.cdedddabc = [];
testParser.state.cdedddabc.push(
testParser.parseString(expr.arguments[0])
@@ -295,7 +299,7 @@ describe("JavascriptParser", () => {
});
testParser.hooks.expression
.for("fgh")
- .tap("JavascriptParserTest", _expr => {
+ .tap("JavascriptParserTest", (_expr) => {
if (!testParser.state.fgh) testParser.state.fgh = [];
testParser.state.fgh.push(
[...testParser.scope.definitions.asSet()].join(" ")
@@ -304,7 +308,7 @@ describe("JavascriptParser", () => {
});
testParser.hooks.expression
.for("fgh.sub")
- .tap("JavascriptParserTest", _expr => {
+ .tap("JavascriptParserTest", (_expr) => {
if (!testParser.state.fghsub) testParser.state.fghsub = [];
testParser.state.fghsub.push(
testParser.scope.inTry ? "try" : "notry"
@@ -313,19 +317,19 @@ describe("JavascriptParser", () => {
});
testParser.hooks.expression
.for("ijk.sub")
- .tap("JavascriptParserTest", _expr => {
+ .tap("JavascriptParserTest", (_expr) => {
if (!testParser.state.ijksub) testParser.state.ijksub = [];
testParser.state.ijksub.push("test");
return true;
});
testParser.hooks.expression
.for("memberExpr")
- .tap("JavascriptParserTest", expr => {
+ .tap("JavascriptParserTest", (expr) => {
if (!testParser.state.expressions) testParser.state.expressions = [];
testParser.state.expressions.push(expr.name);
return true;
});
- testParser.hooks.new.for("xyz").tap("JavascriptParserTest", expr => {
+ testParser.hooks.new.for("xyz").tap("JavascriptParserTest", (expr) => {
if (!testParser.state.xyz) testParser.state.xyz = [];
testParser.state.xyz.push(testParser.parseString(expr.arguments[0]));
return true;
@@ -374,19 +378,19 @@ describe("JavascriptParser", () => {
*/
function evaluateInParser(source) {
const parser = new JavascriptParser();
- parser.hooks.call.for("test").tap("JavascriptParserTest", expr => {
+ parser.hooks.call.for("test").tap("JavascriptParserTest", (expr) => {
parser.state.result = parser.evaluateExpression(expr.arguments[0]);
});
parser.hooks.evaluateIdentifier
.for("aString")
- .tap("JavascriptParserTest", expr =>
+ .tap("JavascriptParserTest", (expr) =>
new BasicEvaluatedExpression()
.setString("aString")
.setRange(expr.range)
);
parser.hooks.evaluateIdentifier
.for("b.Number")
- .tap("JavascriptParserTest", expr =>
+ .tap("JavascriptParserTest", (expr) =>
new BasicEvaluatedExpression().setNumber(123).setRange(expr.range)
);
return parser.parse(`test(${source});`, {}).result;
@@ -671,11 +675,11 @@ describe("JavascriptParser", () => {
};
const parser = new JavascriptParser();
- parser.hooks.call.for("require").tap("JavascriptParserTest", expr => {
+ parser.hooks.call.for("require").tap("JavascriptParserTest", (expr) => {
const param = parser.evaluateExpression(expr.arguments[0]);
parser.state.param = param.string;
});
- parser.hooks.importCall.tap("JavascriptParserTest", expr => {
+ parser.hooks.importCall.tap("JavascriptParserTest", (expr) => {
const param = parser.evaluateExpression(expr.source);
parser.state.param = param.string;
});
@@ -710,7 +714,7 @@ describe("JavascriptParser", () => {
const parser = new JavascriptParser();
- parser.hooks.statement.tap("JavascriptParserTest", _expr => {
+ parser.hooks.statement.tap("JavascriptParserTest", (_expr) => {
definitions = parser.scope.definitions;
return true;
});
diff --git a/test/MemoryLimitTestCases.test.js b/test/MemoryLimitTestCases.test.js
index c44d54400..9e361207e 100644
--- a/test/MemoryLimitTestCases.test.js
+++ b/test/MemoryLimitTestCases.test.js
@@ -8,17 +8,17 @@ const rimraf = require("rimraf");
const webpack = require("..");
const captureStdio = require("./helpers/captureStdio");
-const toMiB = bytes => `${Math.round(bytes / 1024 / 1024)}MiB`;
+const toMiB = (bytes) => `${Math.round(bytes / 1024 / 1024)}MiB`;
const base = path.join(__dirname, "memoryLimitCases");
const outputBase = path.join(__dirname, "js", "memoryLimit");
const tests = fs
.readdirSync(base)
.filter(
- testName =>
+ (testName) =>
fs.existsSync(path.join(base, testName, "index.js")) ||
fs.existsSync(path.join(base, testName, "webpack.config.js"))
)
- .filter(testName => {
+ .filter((testName) => {
const testDirectory = path.join(base, testName);
const filterPath = path.join(testDirectory, "test.filter.js");
if (fs.existsSync(filterPath) && !require(filterPath)()) {
@@ -62,7 +62,7 @@ describe("MemoryLimitTestCases", () => {
const size = toMiB(testConfig.heapSizeLimitBytes);
// eslint-disable-next-line no-loop-func
- it(`should build ${JSON.stringify(testName)} with heap limit of ${size}`, done => {
+ it(`should build ${JSON.stringify(testName)} with heap limit of ${size}`, (done) => {
const outputDirectory = path.join(outputBase, testName);
rimraf.sync(outputDirectory);
fs.mkdirSync(outputDirectory, { recursive: true });
diff --git a/test/MultiCompiler.test.js b/test/MultiCompiler.test.js
index 3571d6cea..306f3dc61 100644
--- a/test/MultiCompiler.test.js
+++ b/test/MultiCompiler.test.js
@@ -6,7 +6,7 @@ const path = require("path");
const { Volume, createFsFromVolume } = require("memfs");
const webpack = require("..");
-const createMultiCompiler = options => {
+const createMultiCompiler = (options) => {
const compiler = webpack(
Object.assign(
[
@@ -34,12 +34,12 @@ const createMultiCompiler = options => {
describe("MultiCompiler", () => {
jest.setTimeout(20000);
- it("should trigger 'run' for each child compiler", done => {
+ it("should trigger 'run' for each child compiler", (done) => {
const compiler = createMultiCompiler();
let called = 0;
compiler.hooks.run.tap("MultiCompiler test", () => called++);
- compiler.run(err => {
+ compiler.run((err) => {
if (err) {
throw err;
}
@@ -48,12 +48,12 @@ describe("MultiCompiler", () => {
});
});
- it("should trigger 'watchRun' for each child compiler", done => {
+ it("should trigger 'watchRun' for each child compiler", (done) => {
const compiler = createMultiCompiler();
let called = 0;
compiler.hooks.watchRun.tap("MultiCompiler test", () => called++);
- compiler.watch(1000, err => {
+ compiler.watch(1000, (err) => {
if (err) {
throw err;
}
@@ -62,7 +62,7 @@ describe("MultiCompiler", () => {
});
});
- it("should not be running twice at a time (run)", done => {
+ it("should not be running twice at a time (run)", (done) => {
const compiler = createMultiCompiler();
compiler.run((err, _stats) => {
if (err) return done(err);
@@ -74,7 +74,7 @@ describe("MultiCompiler", () => {
});
});
- it("should not be running twice at a time (watch)", done => {
+ it("should not be running twice at a time (watch)", (done) => {
const compiler = createMultiCompiler();
compiler.watch({}, (err, _stats) => {
if (err) return done(err);
@@ -86,7 +86,7 @@ describe("MultiCompiler", () => {
});
});
- it("should not be running twice at a time (run - watch)", done => {
+ it("should not be running twice at a time (run - watch)", (done) => {
const compiler = createMultiCompiler();
compiler.run((err, _stats) => {
if (err) return done(err);
@@ -98,7 +98,7 @@ describe("MultiCompiler", () => {
});
});
- it("should not be running twice at a time (watch - run)", done => {
+ it("should not be running twice at a time (watch - run)", (done) => {
const compiler = createMultiCompiler();
compiler.watch({}, (err, _stats) => {
if (err) return done(err);
@@ -110,7 +110,7 @@ describe("MultiCompiler", () => {
});
});
- it("should not be running twice at a time (instance cb)", done => {
+ it("should not be running twice at a time (instance cb)", (done) => {
const compiler = webpack(
{
context: __dirname,
@@ -131,7 +131,7 @@ describe("MultiCompiler", () => {
});
});
- it("should run again correctly after first compilation", done => {
+ it("should run again correctly after first compilation", (done) => {
const compiler = createMultiCompiler();
compiler.run((err, _stats) => {
if (err) return done(err);
@@ -143,7 +143,7 @@ describe("MultiCompiler", () => {
});
});
- it("should watch again correctly after first compilation", done => {
+ it("should watch again correctly after first compilation", (done) => {
const compiler = createMultiCompiler();
compiler.run((err, _stats) => {
if (err) return done(err);
@@ -155,7 +155,7 @@ describe("MultiCompiler", () => {
});
});
- it("should run again correctly after first closed watch", done => {
+ it("should run again correctly after first closed watch", (done) => {
const compiler = createMultiCompiler();
const watching = compiler.watch({}, (err, _stats) => {
if (err) return done(err);
@@ -168,7 +168,7 @@ describe("MultiCompiler", () => {
});
});
- it("should watch again correctly after first closed watch", done => {
+ it("should watch again correctly after first closed watch", (done) => {
const compiler = createMultiCompiler();
const watching = compiler.watch({}, (err, _stats) => {
if (err) return done(err);
@@ -181,7 +181,7 @@ describe("MultiCompiler", () => {
});
});
- it("should respect parallelism and dependencies for running", done => {
+ it("should respect parallelism and dependencies for running", (done) => {
const compiler = createMultiCompiler({
parallelism: 1,
2: {
@@ -218,7 +218,7 @@ describe("MultiCompiler", () => {
});
});
- it("should respect parallelism and dependencies for watching", done => {
+ it("should respect parallelism and dependencies for watching", (done) => {
const compiler = webpack(
Object.assign(
[
@@ -390,7 +390,7 @@ describe("MultiCompiler", () => {
});
});
- it("should respect parallelism when using invalidate", done => {
+ it("should respect parallelism when using invalidate", (done) => {
const configs = [
{
name: "a",
@@ -425,7 +425,7 @@ describe("MultiCompiler", () => {
compiler.outputFileSystem = createFsFromVolume(new Volume());
let state = 0;
- const watching = compiler.watch({}, error => {
+ const watching = compiler.watch({}, (error) => {
if (error) {
done(error);
return;
@@ -443,7 +443,7 @@ describe("MultiCompiler", () => {
`);
events.length = 0;
- watching.invalidate(err => {
+ watching.invalidate((err) => {
try {
if (err) return done(err);
@@ -470,7 +470,7 @@ describe("MultiCompiler", () => {
});
}, 2000);
- it("should respect dependencies when using invalidate", done => {
+ it("should respect dependencies when using invalidate", (done) => {
const compiler = webpack([
{
name: "a",
@@ -504,7 +504,7 @@ describe("MultiCompiler", () => {
compiler.outputFileSystem = createFsFromVolume(new Volume());
let state = 0;
- const watching = compiler.watch({}, error => {
+ const watching = compiler.watch({}, (error) => {
if (error) {
done(error);
return;
@@ -522,7 +522,7 @@ describe("MultiCompiler", () => {
`);
events.length = 0;
- watching.invalidate(err => {
+ watching.invalidate((err) => {
try {
if (err) return done(err);
@@ -549,7 +549,7 @@ describe("MultiCompiler", () => {
});
}, 2000);
- it("shouldn't hang when invalidating watchers", done => {
+ it("shouldn't hang when invalidating watchers", (done) => {
const entriesA = { a: "./a.js" };
const entriesB = { b: "./b.js" };
const compiler = webpack([
@@ -570,7 +570,7 @@ describe("MultiCompiler", () => {
compiler.watchFileSystem = { watch() {} };
compiler.outputFileSystem = createFsFromVolume(new Volume());
- const watching = compiler.watch({}, error => {
+ const watching = compiler.watch({}, (error) => {
if (error) {
done(error);
return;
@@ -579,14 +579,14 @@ describe("MultiCompiler", () => {
entriesA.b = "./b.js";
entriesB.a = "./a.js";
- watching.invalidate(err => {
+ watching.invalidate((err) => {
if (err) return done(err);
compiler.close(done);
});
});
}, 2000);
- it("shouldn't hang when invalidating during build", done => {
+ it("shouldn't hang when invalidating during build", (done) => {
const compiler = webpack(
Object.assign([
{
diff --git a/test/MultiItemCache.unittest.js b/test/MultiItemCache.unittest.js
index 55fe56d37..bee6e419f 100644
--- a/test/MultiItemCache.unittest.js
+++ b/test/MultiItemCache.unittest.js
@@ -6,7 +6,7 @@ const { ItemCacheFacade, MultiItemCache } = require("../lib/CacheFacade");
describe("MultiItemCache", () => {
it("throws when getting items from an empty Cache", () => {
const multiItemCache = new MultiItemCache(generateItemCaches(0));
- expect(() => multiItemCache.get(_ => _())).toThrow(/_ is not a function/);
+ expect(() => multiItemCache.get((_) => _())).toThrow(/_ is not a function/);
});
it("returns the single ItemCacheFacade when passed an array of length 1", () => {
diff --git a/test/MultiStats.test.js b/test/MultiStats.test.js
index d1757423b..6fcb31376 100644
--- a/test/MultiStats.test.js
+++ b/test/MultiStats.test.js
@@ -5,7 +5,7 @@ require("./helpers/warmup-webpack");
const { Volume, createFsFromVolume } = require("memfs");
describe("MultiStats", () => {
- it("should create JSON of children stats", done => {
+ it("should create JSON of children stats", (done) => {
const webpack = require("..");
const compiler = webpack([
diff --git a/test/MultiWatching.unittest.js b/test/MultiWatching.unittest.js
index d8f502be5..968d285b6 100644
--- a/test/MultiWatching.unittest.js
+++ b/test/MultiWatching.unittest.js
@@ -57,7 +57,7 @@ describe("MultiWatching", () => {
describe("close", () => {
let callback;
- const callClosedFinishedCallback = watching => {
+ const callClosedFinishedCallback = (watching) => {
watching.close.mock.calls[0][0]();
};
diff --git a/test/NodeTemplatePlugin.test.js b/test/NodeTemplatePlugin.test.js
index dadf60954..bbe758092 100644
--- a/test/NodeTemplatePlugin.test.js
+++ b/test/NodeTemplatePlugin.test.js
@@ -8,7 +8,7 @@ const path = require("path");
describe("NodeTemplatePlugin", () => {
jest.setTimeout(20000);
- it("should compile and run a simple module", done => {
+ it("should compile and run a simple module", (done) => {
const webpack = require("..");
webpack(
@@ -34,9 +34,9 @@ describe("NodeTemplatePlugin", () => {
expect(result.nextTick).toBe(process.nextTick);
expect(result.fs).toBe(require("fs"));
- result.loadChunk(456, chunk => {
+ result.loadChunk(456, (chunk) => {
expect(chunk).toBe(123);
- result.loadChunk(567, chunk => {
+ result.loadChunk(567, (chunk) => {
expect(chunk).toEqual({
a: 1
});
@@ -47,7 +47,7 @@ describe("NodeTemplatePlugin", () => {
);
});
- it("should compile and run a simple module in single mode", done => {
+ it("should compile and run a simple module in single mode", (done) => {
const webpack = require("..");
webpack(
@@ -79,10 +79,10 @@ describe("NodeTemplatePlugin", () => {
expect(result.nextTick).toBe(process.nextTick);
expect(result.fs).toBe(require("fs"));
const sameTick = true;
- result.loadChunk(456, chunk => {
+ result.loadChunk(456, (chunk) => {
expect(chunk).toBe(123);
expect(sameTick).toBe(true);
- result.loadChunk(567, chunk => {
+ result.loadChunk(567, (chunk) => {
expect(chunk).toEqual({
a: 1
});
diff --git a/test/PersistentCaching.test.js b/test/PersistentCaching.test.js
index cc6fddc81..b2dd5ac17 100644
--- a/test/PersistentCaching.test.js
+++ b/test/PersistentCaching.test.js
@@ -48,11 +48,11 @@ describe("Persistent Caching", () => {
}
};
- beforeEach(done => {
+ beforeEach((done) => {
rimraf(tempPath, done);
});
- const updateSrc = async data => {
+ const updateSrc = async (data) => {
const ts = new Date(Date.now() - 10000);
await mkdir(srcPath, { recursive: true });
for (const key of Object.keys(data)) {
@@ -84,7 +84,7 @@ describe("Persistent Caching", () => {
const execute = () => {
const cache = {};
- const require = name => {
+ const require = (name) => {
if (cache[name]) return cache[name].exports;
if (!name.endsWith(".js")) name += ".js";
const p = path.resolve(outputPath, name);
@@ -161,7 +161,7 @@ export { style };
"e.js": 'import "lodash";'
};
await updateSrc(data);
- const c = items => {
+ const c = (items) => {
const entry = {};
for (const item of items) entry[item] = `./src/${item}.js`;
return compile({ entry, cache: { compression: false } });
@@ -233,7 +233,7 @@ sum([1,2,3])
const firstCacheFiles = (await readdir(cachePath)).sort();
// cSpell:words Mtimes
const firstMtimes = firstCacheFiles.map(
- f => fs.statSync(path.join(cachePath, f)).mtime
+ (f) => fs.statSync(path.join(cachePath, f)).mtime
);
await updateSrc({
@@ -251,7 +251,7 @@ import 'lodash';
const cacheFiles = (await readdir(cachePath)).sort();
expect(cacheFiles).toStrictEqual(firstCacheFiles);
expect(
- firstCacheFiles.map(f => fs.statSync(path.join(cachePath, f)).mtime)
+ firstCacheFiles.map((f) => fs.statSync(path.join(cachePath, f)).mtime)
// cSpell:words Mtimes
).toStrictEqual(firstMtimes);
}, 20000);
diff --git a/test/ProfilingPlugin.test.js b/test/ProfilingPlugin.test.js
index 1af33d26c..9609e9f2e 100644
--- a/test/ProfilingPlugin.test.js
+++ b/test/ProfilingPlugin.test.js
@@ -9,7 +9,7 @@ const rimraf = require("rimraf");
describe("Profiling Plugin", () => {
jest.setTimeout(120000);
- it("should handle output path with folder creation", done => {
+ it("should handle output path with folder creation", (done) => {
const webpack = require("../");
const outputPath = path.join(__dirname, "js/profilingPath");
@@ -53,7 +53,7 @@ describe("Profiling Plugin", () => {
backCompat: false
}
});
- compiler.run(err => {
+ compiler.run((err) => {
if (err) return done(err);
const testDuration = process.hrtime(startTime);
if (!fs.existsSync(outputPath)) {
@@ -68,7 +68,7 @@ describe("Profiling Plugin", () => {
expect(duration).toBeLessThan(
testDuration[0] * 1000000 + testDuration[1] / 1000
);
- const cpuProfile = data.find(entry => entry.name === "CpuProfile");
+ const cpuProfile = data.find((entry) => entry.name === "CpuProfile");
expect(cpuProfile).toBeTypeOf("object");
const profile = cpuProfile.args.data.cpuProfile;
expect(profile.startTime).toBeGreaterThanOrEqual(minTs);
diff --git a/test/ProgressPlugin.test.js b/test/ProgressPlugin.test.js
index 5834bb42e..965af1d60 100644
--- a/test/ProgressPlugin.test.js
+++ b/test/ProgressPlugin.test.js
@@ -31,7 +31,7 @@ const createMultiCompiler = (progressOptions, configOptions) => {
return compiler;
};
-const createSimpleCompiler = progressOptions => {
+const createSimpleCompiler = (progressOptions) => {
const compiler = webpack({
context: path.join(__dirname, "fixtures"),
entry: "./a.js",
@@ -51,7 +51,7 @@ const createSimpleCompiler = progressOptions => {
return compiler;
};
-const createSimpleCompilerWithCustomHandler = options => {
+const createSimpleCompilerWithCustomHandler = (options) => {
const compiler = webpack({
context: path.join(__dirname, "fixtures"),
entry: "./a.js"
@@ -68,11 +68,11 @@ const createSimpleCompilerWithCustomHandler = options => {
return compiler;
};
-const getLogs = logsStr => logsStr.split(/\r/).filter(v => v !== " ");
+const getLogs = (logsStr) => logsStr.split(/\r/).filter((v) => v !== " ");
-const runCompilerAsync = compiler =>
+const runCompilerAsync = (compiler) =>
new Promise((resolve, reject) => {
- compiler.run(err => {
+ compiler.run((err) => {
if (err) {
reject(err);
} else {
@@ -97,7 +97,7 @@ describe("ProgressPlugin", () => {
stdout && stdout.restore();
});
- const nanTest = createCompiler => () => {
+ const nanTest = (createCompiler) => () => {
const compiler = createCompiler();
return runCompilerAsync(compiler).then(() => {
@@ -121,7 +121,7 @@ describe("ProgressPlugin", () => {
nanTest(() => createMultiCompiler(undefined, { parallelism: 1 }))
);
- it("should start print only on call run/watch", done => {
+ it("should start print only on call run/watch", (done) => {
const compiler = createSimpleCompiler();
const logs = getLogs(stderr.toString());
@@ -162,7 +162,7 @@ describe("ProgressPlugin", () => {
});
});
- const monotonicTest = createCompiler => () => {
+ const monotonicTest = (createCompiler) => () => {
const handlerCalls = [];
const compiler = createCompiler({
handler: (p, ...args) => {
@@ -195,7 +195,7 @@ describe("ProgressPlugin", () => {
it(
"should have monotonic increasing progress (multi compiler, parallelism)",
- monotonicTest(o => createMultiCompiler(o, { parallelism: 1 }))
+ monotonicTest((o) => createMultiCompiler(o, { parallelism: 1 }))
);
it("should not print lines longer than stderr.columns", () => {
diff --git a/test/SemVer.unittest.js b/test/SemVer.unittest.js
index 7b8da21c9..9842e8c0d 100644
--- a/test/SemVer.unittest.js
+++ b/test/SemVer.unittest.js
@@ -13,7 +13,7 @@ const {
} = require("../lib/util/semver");
describe("SemVer", () => {
- const createRuntimeFunction = runtimeCodeFunction => {
+ const createRuntimeFunction = (runtimeCodeFunction) => {
const runtimeFunction = runtimeCodeFunction({
basicFunction: (args, body) => `(${args}) => {\n${body.join("\n")}\n}`,
supportsArrowFunction: () => true
diff --git a/test/Stats.test.js b/test/Stats.test.js
index 3bb9b8f76..009b5eb42 100644
--- a/test/Stats.test.js
+++ b/test/Stats.test.js
@@ -4,7 +4,7 @@ require("./helpers/warmup-webpack");
const { Volume, createFsFromVolume } = require("memfs");
-const compile = options =>
+const compile = (options) =>
new Promise((resolve, reject) => {
const webpack = require("..");
diff --git a/test/StatsTestCases.basictest.js b/test/StatsTestCases.basictest.js
index 97f1380dd..61a4df2d9 100644
--- a/test/StatsTestCases.basictest.js
+++ b/test/StatsTestCases.basictest.js
@@ -13,18 +13,18 @@ const captureStdio = require("./helpers/captureStdio");
* @param {string} str String to quote
* @returns {string} Escaped string
*/
-const quoteMeta = str => str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&");
+const quoteMeta = (str) => str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&");
const base = path.join(__dirname, "statsCases");
const outputBase = path.join(__dirname, "js", "stats");
const tests = fs
.readdirSync(base)
.filter(
- testName =>
+ (testName) =>
fs.existsSync(path.join(base, testName, "index.js")) ||
fs.existsSync(path.join(base, testName, "webpack.config.js"))
)
- .filter(testName => {
+ .filter((testName) => {
const testDirectory = path.join(base, testName);
const filterPath = path.join(testDirectory, "test.filter.js");
if (fs.existsSync(filterPath) && !require(filterPath)()) {
@@ -50,7 +50,7 @@ describe("StatsTestCases", () => {
for (const testName of tests) {
// eslint-disable-next-line no-loop-func
- it(`should print correct stats for ${testName}`, done => {
+ it(`should print correct stats for ${testName}`, (done) => {
const outputDirectory = path.join(outputBase, testName);
rimraf.sync(outputDirectory);
fs.mkdirSync(outputDirectory, { recursive: true });
@@ -118,7 +118,7 @@ describe("StatsTestCases", () => {
}
]);
};
- c.hooks.compilation.tap("StatsTestCasesTest", compilation => {
+ c.hooks.compilation.tap("StatsTestCasesTest", (compilation) => {
for (const hook of [
"optimize",
"optimizeModules",
@@ -137,7 +137,7 @@ describe("StatsTestCases", () => {
if (err) return done(err);
for (const compilation of [
...(stats.stats ? stats.stats : [stats])
- ].map(s => s.compilation)) {
+ ].map((s) => s.compilation)) {
compilation.logging.delete("webpack.Compilation.ModuleProfile");
}
expect(stats.hasErrors()).toBe(testName.endsWith("error"));
@@ -179,7 +179,7 @@ describe("StatsTestCases", () => {
hasColorSetting = typeof toStringOptions.colors !== "undefined";
}
if (Array.isArray(c.options) && !toStringOptions.children) {
- toStringOptions.children = c.options.map(o => o.stats);
+ toStringOptions.children = c.options.map((o) => o.stats);
}
// mock timestamps
for (const { compilation: s } of stats.stats ? stats.stats : [stats]) {
@@ -216,7 +216,7 @@ describe("StatsTestCases", () => {
.replace(/[.0-9]+(\s?(bytes|KiB|MiB|GiB))/g, "X$1")
.replace(
/ms\s\([0-9a-f]{6,32}\)|(?![0-9]+-)[0-9a-f-]{6,32}\./g,
- match => `${match.replace(/[0-9a-f]/g, "X")}`
+ (match) => `${match.replace(/[0-9a-f]/g, "X")}`
)
// Normalize stack traces between Jest v27 and v30
// Jest v27: at Object..module.exports
diff --git a/test/TestCases.template.js b/test/TestCases.template.js
index f035711c5..d85092dec 100644
--- a/test/TestCases.template.js
+++ b/test/TestCases.template.js
@@ -14,18 +14,18 @@ const { TestRunner } = require("./runner/index");
const casesPath = path.join(__dirname, "cases");
let categories = fs.readdirSync(casesPath);
-categories = categories.map(cat => ({
+categories = categories.map((cat) => ({
name: cat,
tests: fs
.readdirSync(path.join(casesPath, cat))
- .filter(folder => !folder.includes("_"))
+ .filter((folder) => !folder.includes("_"))
}));
-const createLogger = appendTarget => ({
- log: l => appendTarget.push(l),
- debug: l => appendTarget.push(l),
- trace: l => appendTarget.push(l),
- info: l => appendTarget.push(l),
+const createLogger = (appendTarget) => ({
+ log: (l) => appendTarget.push(l),
+ debug: (l) => appendTarget.push(l),
+ trace: (l) => appendTarget.push(l),
+ info: (l) => appendTarget.push(l),
warn: console.warn.bind(console),
error: console.error.bind(console),
logTime: () => {},
@@ -38,7 +38,7 @@ const createLogger = appendTarget => ({
status: () => {}
});
-const describeCases = config => {
+const describeCases = (config) => {
describe(config.name, () => {
let stderr;
@@ -55,7 +55,7 @@ const describeCases = config => {
describe(category.name, () => {
jest.setTimeout(30000);
- for (const testName of category.tests.filter(test => {
+ for (const testName of category.tests.filter((test) => {
const testDirectory = path.join(casesPath, category.name, test);
const filterPath = path.join(testDirectory, "test.filter.js");
if (fs.existsSync(filterPath) && !require(filterPath)(config)) {
@@ -190,7 +190,7 @@ const describeCases = config => {
plugins: [
...(config.plugins || []),
function testCasesTest() {
- this.hooks.compilation.tap("TestCasesTest", compilation => {
+ this.hooks.compilation.tap("TestCasesTest", (compilation) => {
for (const hook of [
"optimize",
"optimizeModules",
@@ -217,7 +217,7 @@ const describeCases = config => {
}
};
- beforeAll(done => {
+ beforeAll((done) => {
rimraf(cacheDirectory, done);
});
@@ -232,7 +232,7 @@ const describeCases = config => {
if (config.cache) {
it(
`${testName} should pre-compile to fill disk cache (1st)`,
- done => {
+ (done) => {
const oldPath = options.output.path;
options.output.path = path.join(
options.output.path,
@@ -243,7 +243,7 @@ const describeCases = config => {
const webpack = require("..");
- webpack(options, err => {
+ webpack(options, (err) => {
deprecationTracker();
options.output.path = oldPath;
if (err) return done(err);
@@ -276,7 +276,7 @@ const describeCases = config => {
it(
`${testName} should pre-compile to fill disk cache (2nd)`,
- done => {
+ (done) => {
const oldPath = options.output.path;
options.output.path = path.join(
options.output.path,
@@ -287,7 +287,7 @@ const describeCases = config => {
const webpack = require("..");
- webpack(options, err => {
+ webpack(options, (err) => {
deprecationTracker();
options.output.path = oldPath;
if (err) return done(err);
@@ -321,7 +321,7 @@ const describeCases = config => {
it(
`${testName} should compile`,
- done => {
+ (done) => {
infraStructureLog.length = 0;
const webpack = require("..");
@@ -353,7 +353,7 @@ const describeCases = config => {
) {
return;
}
- compiler.close(err => {
+ compiler.close((err) => {
if (err) return done(err);
const statOptions = {
preset: "verbose",
@@ -417,7 +417,7 @@ const describeCases = config => {
if (config.cache) {
// pre-compile to fill memory cache
const deprecationTracker = deprecationTracking.start();
- compiler.run(err => {
+ compiler.run((err) => {
deprecationTracker();
if (err) return done(err);
run();
@@ -431,7 +431,7 @@ const describeCases = config => {
(config.cache ? 20000 : 60000)
);
- it(`${testName} should load the compiled tests`, done => {
+ it(`${testName} should load the compiled tests`, (done) => {
const runner = new TestRunner({
target: options.target,
outputDirectory,
diff --git a/test/TestCasesAllCombined.longtest.js b/test/TestCasesAllCombined.longtest.js
index 08f0a1c56..802c1e058 100644
--- a/test/TestCasesAllCombined.longtest.js
+++ b/test/TestCasesAllCombined.longtest.js
@@ -13,7 +13,7 @@ describe("TestCases", () => {
chunkIds: "named"
},
plugins: [
- c => {
+ (c) => {
const webpack = require("..");
new webpack.HotModuleReplacementPlugin().apply(c);
diff --git a/test/Validation.test.js b/test/Validation.test.js
index 22bc34fa6..313f1fe28 100644
--- a/test/Validation.test.js
+++ b/test/Validation.test.js
@@ -51,7 +51,7 @@ describe("Validation", () => {
});
};
- createTestCase("undefined configuration", undefined, msg =>
+ createTestCase("undefined configuration", undefined, (msg) =>
expect(msg).toMatchInlineSnapshot(`
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration should be an object:
@@ -60,7 +60,7 @@ describe("Validation", () => {
`)
);
- createTestCase("null configuration", null, msg =>
+ createTestCase("null configuration", null, (msg) =>
expect(msg).toMatchInlineSnapshot(`
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration should be an object:
@@ -74,7 +74,7 @@ describe("Validation", () => {
{
entry: ""
},
- msg =>
+ (msg) =>
expect(msg).toMatchInlineSnapshot(`
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration.entry should be a non-empty string.
@@ -89,7 +89,7 @@ describe("Validation", () => {
bundle: []
}
},
- msg =>
+ (msg) =>
expect(msg).toMatchInlineSnapshot(`
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration.entry.bundle should be a non-empty array.
@@ -105,7 +105,7 @@ describe("Validation", () => {
wrappedContextRegExp: 1337
}
},
- msg =>
+ (msg) =>
expect(msg).toMatchInlineSnapshot(`
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration.module.wrappedContextRegExp should be an instance of RegExp.
@@ -119,7 +119,7 @@ describe("Validation", () => {
entry: "a",
parallelism: 0
},
- msg =>
+ (msg) =>
expect(msg).toMatchInlineSnapshot(`
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration.parallelism should be >= 1.
@@ -132,7 +132,7 @@ describe("Validation", () => {
{
entry: ["abc", "def", "abc"]
},
- msg =>
+ (msg) =>
expect(msg).toMatchInlineSnapshot(`
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration.entry should not contain the item 'abc' twice.
@@ -148,7 +148,7 @@ describe("Validation", () => {
filename: /a/
}
},
- msg =>
+ (msg) =>
expect(msg).toMatchInlineSnapshot(`
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration.entry[0] should be a non-empty string.
@@ -175,7 +175,7 @@ describe("Validation", () => {
}
}
],
- msg =>
+ (msg) =>
expect(msg).toMatchInlineSnapshot(`
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration[0].entry[0] should be a non-empty string.
@@ -208,7 +208,7 @@ describe("Validation", () => {
]
}
},
- msg =>
+ (msg) =>
expect(msg).toMatchInlineSnapshot(`
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration.module.rules[0].oneOf[0] has an unknown property 'passer'. These properties are valid:
@@ -223,7 +223,7 @@ describe("Validation", () => {
entry: "a",
postcss: () => {}
},
- msg =>
+ (msg) =>
expect(msg).toMatchInlineSnapshot(`
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration has an unknown property 'postcss'. These properties are valid:
@@ -250,7 +250,7 @@ describe("Validation", () => {
entry: "a",
devtool: true
},
- msg =>
+ (msg) =>
expect(msg).toMatchInlineSnapshot(`
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration.devtool should be one of these:
@@ -272,7 +272,7 @@ describe("Validation", () => {
filename: "bar"
}
},
- msg =>
+ (msg) =>
expect(msg).toMatchInlineSnapshot(`
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration.output.path: The provided value \\"/somepath/!test\\" contains exclamation mark (!) which is not allowed because it's reserved for loader syntax.
@@ -288,7 +288,7 @@ describe("Validation", () => {
filename: "/bar"
}
},
- msg =>
+ (msg) =>
expect(msg).toMatchInlineSnapshot(`
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration.output.filename: A relative path is expected. However, the provided value \\"/bar\\" is an absolute path!
@@ -305,7 +305,7 @@ describe("Validation", () => {
},
context: "baz"
},
- msg =>
+ (msg) =>
expect(msg).toMatchInlineSnapshot(`
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration.context: The provided value \\"baz\\" is not an absolute path!
@@ -321,7 +321,7 @@ describe("Validation", () => {
foobar: true
}
},
- msg => {
+ (msg) => {
expect(
msg
.replace(/object \{ .* \}/g, "object {...}")
@@ -341,7 +341,7 @@ describe("Validation", () => {
entry: "foo.js",
plugins: [true]
},
- msg =>
+ (msg) =>
expect(msg).toMatchInlineSnapshot(`
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration.plugins[0] should be one of these:
@@ -365,7 +365,7 @@ describe("Validation", () => {
entry: "foo.js",
plugins: [[]]
},
- msg =>
+ (msg) =>
expect(msg).toMatchInlineSnapshot(`
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration.plugins[0] should be one of these:
@@ -389,7 +389,7 @@ describe("Validation", () => {
entry: "foo.js",
plugins: ["abc123"]
},
- msg =>
+ (msg) =>
expect(msg).toMatchInlineSnapshot(`
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration.plugins[0] should be one of these:
@@ -413,7 +413,7 @@ describe("Validation", () => {
entry: "foo.js",
plugins: [12]
},
- msg =>
+ (msg) =>
expect(msg).toMatchInlineSnapshot(`
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration.plugins[0] should be one of these:
@@ -437,7 +437,7 @@ describe("Validation", () => {
entry: "foo.js",
plugins: [{}]
},
- msg =>
+ (msg) =>
expect(msg).toMatchInlineSnapshot(`
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration.plugins[0] misses the property 'apply'. Should be:
@@ -452,7 +452,7 @@ describe("Validation", () => {
{
mode: "protuction"
},
- msg =>
+ (msg) =>
expect(msg).toMatchInlineSnapshot(`
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration.mode should be one of these:
@@ -466,7 +466,7 @@ describe("Validation", () => {
{
debug: true
},
- msg =>
+ (msg) =>
expect(msg).toMatchInlineSnapshot(`
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration has an unknown property 'debug'. These properties are valid:
@@ -494,7 +494,7 @@ describe("Validation", () => {
}
}
},
- msg =>
+ (msg) =>
expect(msg).toMatchInlineSnapshot(`
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration.optimization.splitChunks.cacheGroups should not be object { test, … }.
@@ -514,7 +514,7 @@ describe("Validation", () => {
"holey array",
// eslint-disable-next-line no-sparse-arrays
[{ mode: "production" }, , { mode: "development" }],
- msg =>
+ (msg) =>
expect(msg).toMatchInlineSnapshot(`
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration[1] should be an object:
@@ -528,7 +528,7 @@ describe("Validation", () => {
{
output: { ecmaVersion: 2015 }
},
- msg =>
+ (msg) =>
expect(msg).toMatchInlineSnapshot(`
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration.output has an unknown property 'ecmaVersion'. These properties are valid:
@@ -543,7 +543,7 @@ describe("Validation", () => {
{
devtool: "sourcemap"
},
- msg =>
+ (msg) =>
expect(msg).toMatchInlineSnapshot(`
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration.devtool should match pattern \\"^(inline-|hidden-|eval-)?(nosources-)?(cheap-(module-)?)?source-map(-debugids)?$\\".
@@ -557,7 +557,7 @@ describe("Validation", () => {
{
devtool: "source-maps"
},
- msg =>
+ (msg) =>
expect(msg).toMatchInlineSnapshot(`
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration.devtool should match pattern \\"^(inline-|hidden-|eval-)?(nosources-)?(cheap-(module-)?)?source-map(-debugids)?$\\".
@@ -571,7 +571,7 @@ describe("Validation", () => {
{
watchOptions: true
},
- msg =>
+ (msg) =>
expect(msg).toMatchInlineSnapshot(`
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration.watchOptions should be an object:
@@ -585,7 +585,7 @@ describe("Validation", () => {
{
devtool: "cheap-eval-nosource-source-map"
},
- msg =>
+ (msg) =>
expect(msg).toMatchInlineSnapshot(`
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration.devtool should match pattern \\"^(inline-|hidden-|eval-)?(nosources-)?(cheap-(module-)?)?source-map(-debugids)?$\\".
@@ -599,7 +599,7 @@ describe("Validation", () => {
{
devtool: "cheap-eval-nosource-source-map"
},
- msg =>
+ (msg) =>
expect(msg).toMatchInlineSnapshot(`
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration.devtool should match pattern \\"^(inline-|hidden-|eval-)?(nosources-)?(cheap-(module-)?)?source-map(-debugids)?$\\".
@@ -618,7 +618,7 @@ describe("Validation", () => {
devtool: "unknown"
}
],
- msg =>
+ (msg) =>
expect(msg).toMatchInlineSnapshot(`
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration[0].devtool should match pattern \\"^(inline-|hidden-|eval-)?(nosources-)?(cheap-(module-)?)?source-map(-debugids)?$\\".
@@ -632,7 +632,7 @@ describe("Validation", () => {
{
rules: []
},
- msg =>
+ (msg) =>
expect(msg).toMatchInlineSnapshot(`
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration has an unknown property 'rules'. These properties are valid:
@@ -646,7 +646,7 @@ describe("Validation", () => {
{
splitChunks: false
},
- msg =>
+ (msg) =>
expect(msg).toMatchInlineSnapshot(`
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration has an unknown property 'splitChunks'. These properties are valid:
@@ -660,7 +660,7 @@ describe("Validation", () => {
{
noParse: /a/
},
- msg =>
+ (msg) =>
expect(msg).toMatchInlineSnapshot(`
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration has an unknown property 'noParse'. These properties are valid:
@@ -676,7 +676,7 @@ describe("Validation", () => {
hashedModuleIds: true
}
},
- msg =>
+ (msg) =>
expect(msg).toMatchInlineSnapshot(`
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration.optimization has an unknown property 'hashedModuleIds'. These properties are valid:
@@ -692,7 +692,7 @@ describe("Validation", () => {
namedChunks: true
}
},
- msg =>
+ (msg) =>
expect(msg).toMatchInlineSnapshot(`
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration.optimization has an unknown property 'namedChunks'. These properties are valid:
@@ -708,7 +708,7 @@ describe("Validation", () => {
occurrenceOrder: true
}
},
- msg =>
+ (msg) =>
expect(msg).toMatchInlineSnapshot(`
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration.optimization has an unknown property 'occurrenceOrder'. These properties are valid:
@@ -726,7 +726,7 @@ describe("Validation", () => {
}
}
},
- msg =>
+ (msg) =>
expect(msg).toMatchInlineSnapshot(`
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration.optimization.splitChunks has an unknown property 'automaticNamePrefix'. These properties are valid:
diff --git a/test/Watch.test.js b/test/Watch.test.js
index f7d13c2a0..bb865a94b 100644
--- a/test/Watch.test.js
+++ b/test/Watch.test.js
@@ -9,7 +9,7 @@ const webpack = require("..");
jest.setTimeout(10000);
describe("Watch", () => {
- it("should only compile a single time", done => {
+ it("should only compile a single time", (done) => {
let counterBeforeCompile = 0;
let counterDone = 0;
let counterHandler = 0;
@@ -34,7 +34,7 @@ describe("Watch", () => {
]
},
plugins: [
- c => {
+ (c) => {
c.hooks.beforeCompile.tap("test", () => {
counterBeforeCompile++;
});
diff --git a/test/WatchClose.test.js b/test/WatchClose.test.js
index bc590fb26..8ad845f09 100644
--- a/test/WatchClose.test.js
+++ b/test/WatchClose.test.js
@@ -40,7 +40,7 @@ describe("WatchClose", () => {
* @returns {Promise}
*/
function close(watcher, callback) {
- return new Promise(res => {
+ return new Promise((res) => {
const onClose = () => {
callback();
res();
diff --git a/test/WatchDetection.test.js b/test/WatchDetection.test.js
index e59ea707b..1dcb195c3 100644
--- a/test/WatchDetection.test.js
+++ b/test/WatchDetection.test.js
@@ -53,7 +53,7 @@ describe("WatchDetection", () => {
fs.writeFileSync(file2Path, "original", "utf8");
});
- afterAll(done => {
+ afterAll((done) => {
setTimeout(() => {
try {
fs.unlinkSync(filePath);
@@ -74,7 +74,7 @@ describe("WatchDetection", () => {
}, 100); // cool down a bit
});
- it("should build the bundle correctly", done => {
+ it("should build the bundle correctly", (done) => {
const compiler = webpack({
mode: "development",
entry: `${loaderPath}!${filePath}`,
diff --git a/test/WatchSuspend.test.js b/test/WatchSuspend.test.js
index 4f62156e8..f40982e80 100644
--- a/test/WatchSuspend.test.js
+++ b/test/WatchSuspend.test.js
@@ -76,7 +76,7 @@ describe("WatchSuspend", () => {
}
});
- it("should compile successfully", done => {
+ it("should compile successfully", (done) => {
onChange = () => {
expect(fs.readFileSync(outputFile, "utf8")).toContain("'foo'");
onChange = null;
@@ -84,7 +84,7 @@ describe("WatchSuspend", () => {
};
});
- it("should suspend compilation", done => {
+ it("should suspend compilation", (done) => {
onChange = jest.fn();
watching.suspend();
fs.writeFileSync(filePath, "'bar'", "utf8");
@@ -95,7 +95,7 @@ describe("WatchSuspend", () => {
}, 1000);
});
- it("should resume compilation", done => {
+ it("should resume compilation", (done) => {
onChange = () => {
expect(fs.readFileSync(outputFile, "utf8")).toContain("'bar'");
onChange = null;
@@ -110,14 +110,14 @@ describe("WatchSuspend", () => {
it(`should not ignore changes during resumed compilation (changeBefore: ${changeBefore}, delay: ${delay}ms)`, async () => {
// aggregateTimeout must be long enough for this test
// So set-up new watcher and wait when initial compilation is done
- await new Promise(resolve => {
+ await new Promise((resolve) => {
watching.close(() => {
watching = compiler.watch({ aggregateTimeout: 1000 }, () => {
resolve();
});
});
});
- return new Promise(resolve => {
+ return new Promise((resolve) => {
if (changeBefore) fs.writeFileSync(filePath, "'bar'", "utf8");
setTimeout(() => {
watching.suspend();
@@ -146,7 +146,7 @@ describe("WatchSuspend", () => {
}
}
- it("should not drop changes when suspended", done => {
+ it("should not drop changes when suspended", (done) => {
const aggregateTimeout = 50;
// Trigger initial compilation with file2.js (assuming correct)
fs.writeFileSync(
diff --git a/test/WatchTestCases.template.js b/test/WatchTestCases.template.js
index 449b7f605..c027b336c 100644
--- a/test/WatchTestCases.template.js
+++ b/test/WatchTestCases.template.js
@@ -50,7 +50,7 @@ function copyDiff(src, dest, initial) {
}
}
-const describeCases = config => {
+const describeCases = (config) => {
describe(config.name, () => {
beforeAll(() => {
let dest = path.join(__dirname, "js");
@@ -67,12 +67,12 @@ const describeCases = config => {
}
const casesPath = path.join(__dirname, "watchCases");
- const categories = fs.readdirSync(casesPath).map(cat => ({
+ const categories = fs.readdirSync(casesPath).map((cat) => ({
name: cat,
tests: fs
.readdirSync(path.join(casesPath, cat))
- .filter(folder => !folder.includes("_"))
- .filter(testName => {
+ .filter((folder) => !folder.includes("_"))
+ .filter((testName) => {
const testDirectory = path.join(casesPath, cat, testName);
const filterPath = path.join(testDirectory, "test.filter.js");
if (fs.existsSync(filterPath) && !require(filterPath)(config)) {
@@ -113,16 +113,16 @@ const describeCases = config => {
const runs = fs
.readdirSync(testDirectory)
.sort()
- .filter(name =>
+ .filter((name) =>
fs.statSync(path.join(testDirectory, name)).isDirectory()
)
- .map(name => ({ name }));
+ .map((name) => ({ name }));
- beforeAll(done => {
+ beforeAll((done) => {
rimraf(tempDirectory, done);
});
- it(`${testName} should compile`, done => {
+ it(`${testName} should compile`, (done) => {
const outputDirectory = path.join(
__dirname,
"js",
@@ -323,14 +323,14 @@ const describeCases = config => {
});
const getBundle = (outputDirectory, module) => {
if (Array.isArray(module)) {
- return module.map(arg =>
+ return module.map((arg) =>
path.join(outputDirectory, arg)
);
} else if (module instanceof RegExp) {
return fs
.readdirSync(outputDirectory)
- .filter(f => module.test(f))
- .map(f => path.join(outputDirectory, f));
+ .filter((f) => module.test(f))
+ .map((f) => path.join(outputDirectory, f));
}
return [path.join(outputDirectory, module)];
};
@@ -356,7 +356,7 @@ const describeCases = config => {
run.it(
"should compile the next step",
- done => {
+ (done) => {
runIdx++;
if (runIdx < runs.length) {
run = runs[runIdx];
@@ -406,7 +406,7 @@ const describeCases = config => {
run.it = _it;
run.getNumberOfTests = getNumberOfTests;
- it(`${run.name} should allow to read stats`, done => {
+ it(`${run.name} should allow to read stats`, (done) => {
if (run.stats) {
run.stats.toString({ all: true });
run.stats = undefined;
diff --git a/test/WatcherEvents.test.js b/test/WatcherEvents.test.js
index 2db8e930b..059c6f0da 100644
--- a/test/WatcherEvents.test.js
+++ b/test/WatcherEvents.test.js
@@ -4,7 +4,7 @@ const path = require("path");
const { Volume, createFsFromVolume } = require("memfs");
const webpack = require("..");
-const createCompiler = config => {
+const createCompiler = (config) => {
const compiler = webpack(config);
compiler.outputFileSystem = createFsFromVolume(new Volume());
return compiler;
@@ -34,7 +34,7 @@ describe("WatcherEvents", () => {
jest.setTimeout(10000);
- it("should emit 'watch-close' when using single-compiler mode and the compiler is not running", done => {
+ it("should emit 'watch-close' when using single-compiler mode and the compiler is not running", (done) => {
let called = false;
const compiler = createSingleCompiler();
@@ -52,7 +52,7 @@ describe("WatcherEvents", () => {
});
});
- it("should emit 'watch-close' when using multi-compiler mode and the compiler is not running", done => {
+ it("should emit 'watch-close' when using multi-compiler mode and the compiler is not running", (done) => {
let called = false;
const compiler = createMultiCompiler();
diff --git a/test/cases/chunks/runtime/test.filter.js b/test/cases/chunks/runtime/test.filter.js
index 998e27ce0..1a40a4d93 100644
--- a/test/cases/chunks/runtime/test.filter.js
+++ b/test/cases/chunks/runtime/test.filter.js
@@ -1,5 +1,5 @@
"use strict";
-module.exports = config =>
+module.exports = (config) =>
// This test can't run in development mode as it depends on the flagIncludedChunks optimization
config.mode !== "development";
diff --git a/test/cases/esm/import-meta/test.filter.js b/test/cases/esm/import-meta/test.filter.js
index c628302b5..7b29ebe00 100644
--- a/test/cases/esm/import-meta/test.filter.js
+++ b/test/cases/esm/import-meta/test.filter.js
@@ -2,4 +2,4 @@
const supportsRequireInModule = require("../../../helpers/supportsRequireInModule");
-module.exports = config => !config.module || supportsRequireInModule();
+module.exports = (config) => !config.module || supportsRequireInModule();
diff --git a/test/cases/loaders/context/test.filter.js b/test/cases/loaders/context/test.filter.js
index c628302b5..7b29ebe00 100644
--- a/test/cases/loaders/context/test.filter.js
+++ b/test/cases/loaders/context/test.filter.js
@@ -2,4 +2,4 @@
const supportsRequireInModule = require("../../../helpers/supportsRequireInModule");
-module.exports = config => !config.module || supportsRequireInModule();
+module.exports = (config) => !config.module || supportsRequireInModule();
diff --git a/test/cases/loaders/emit-file/test.filter.js b/test/cases/loaders/emit-file/test.filter.js
index 77aeb868d..49d755d43 100644
--- a/test/cases/loaders/emit-file/test.filter.js
+++ b/test/cases/loaders/emit-file/test.filter.js
@@ -1,3 +1,3 @@
"use strict";
-module.exports = config => !config.module;
+module.exports = (config) => !config.module;
diff --git a/test/cases/loaders/import-module/test.filter.js b/test/cases/loaders/import-module/test.filter.js
index 77aeb868d..49d755d43 100644
--- a/test/cases/loaders/import-module/test.filter.js
+++ b/test/cases/loaders/import-module/test.filter.js
@@ -1,3 +1,3 @@
"use strict";
-module.exports = config => !config.module;
+module.exports = (config) => !config.module;
diff --git a/test/cases/loaders/pug-loader/test.filter.js b/test/cases/loaders/pug-loader/test.filter.js
index c628302b5..7b29ebe00 100644
--- a/test/cases/loaders/pug-loader/test.filter.js
+++ b/test/cases/loaders/pug-loader/test.filter.js
@@ -2,4 +2,4 @@
const supportsRequireInModule = require("../../../helpers/supportsRequireInModule");
-module.exports = config => !config.module || supportsRequireInModule();
+module.exports = (config) => !config.module || supportsRequireInModule();
diff --git a/test/cases/optimize/side-effects-all-chain-unused/test.filter.js b/test/cases/optimize/side-effects-all-chain-unused/test.filter.js
index 24f50b1aa..f6354eef9 100644
--- a/test/cases/optimize/side-effects-all-chain-unused/test.filter.js
+++ b/test/cases/optimize/side-effects-all-chain-unused/test.filter.js
@@ -1,3 +1,3 @@
"use strict";
-module.exports = config => config.mode !== "development";
+module.exports = (config) => config.mode !== "development";
diff --git a/test/cases/optimize/side-effects-all-used/test.filter.js b/test/cases/optimize/side-effects-all-used/test.filter.js
index 24f50b1aa..f6354eef9 100644
--- a/test/cases/optimize/side-effects-all-used/test.filter.js
+++ b/test/cases/optimize/side-effects-all-used/test.filter.js
@@ -1,3 +1,3 @@
"use strict";
-module.exports = config => config.mode !== "development";
+module.exports = (config) => config.mode !== "development";
diff --git a/test/cases/optimize/side-effects-immediate-unused/test.filter.js b/test/cases/optimize/side-effects-immediate-unused/test.filter.js
index 24f50b1aa..f6354eef9 100644
--- a/test/cases/optimize/side-effects-immediate-unused/test.filter.js
+++ b/test/cases/optimize/side-effects-immediate-unused/test.filter.js
@@ -1,3 +1,3 @@
"use strict";
-module.exports = config => config.mode !== "development";
+module.exports = (config) => config.mode !== "development";
diff --git a/test/cases/optimize/side-effects-reexport-start-unknown/test.filter.js b/test/cases/optimize/side-effects-reexport-start-unknown/test.filter.js
index 24f50b1aa..f6354eef9 100644
--- a/test/cases/optimize/side-effects-reexport-start-unknown/test.filter.js
+++ b/test/cases/optimize/side-effects-reexport-start-unknown/test.filter.js
@@ -1,3 +1,3 @@
"use strict";
-module.exports = config => config.mode !== "development";
+module.exports = (config) => config.mode !== "development";
diff --git a/test/cases/optimize/side-effects-root-unused/test.filter.js b/test/cases/optimize/side-effects-root-unused/test.filter.js
index 24f50b1aa..f6354eef9 100644
--- a/test/cases/optimize/side-effects-root-unused/test.filter.js
+++ b/test/cases/optimize/side-effects-root-unused/test.filter.js
@@ -1,3 +1,3 @@
"use strict";
-module.exports = config => config.mode !== "development";
+module.exports = (config) => config.mode !== "development";
diff --git a/test/cases/optimize/side-effects-simple-unused/test.filter.js b/test/cases/optimize/side-effects-simple-unused/test.filter.js
index 24f50b1aa..f6354eef9 100644
--- a/test/cases/optimize/side-effects-simple-unused/test.filter.js
+++ b/test/cases/optimize/side-effects-simple-unused/test.filter.js
@@ -1,3 +1,3 @@
"use strict";
-module.exports = config => config.mode !== "development";
+module.exports = (config) => config.mode !== "development";
diff --git a/test/cases/optimize/side-effects-transitive-unused/test.filter.js b/test/cases/optimize/side-effects-transitive-unused/test.filter.js
index 24f50b1aa..f6354eef9 100644
--- a/test/cases/optimize/side-effects-transitive-unused/test.filter.js
+++ b/test/cases/optimize/side-effects-transitive-unused/test.filter.js
@@ -1,3 +1,3 @@
"use strict";
-module.exports = config => config.mode !== "development";
+module.exports = (config) => config.mode !== "development";
diff --git a/test/cases/parsing/harmony-destructuring-assignment/test.filter.js b/test/cases/parsing/harmony-destructuring-assignment/test.filter.js
index 3952ef072..ed0f0aa0f 100644
--- a/test/cases/parsing/harmony-destructuring-assignment/test.filter.js
+++ b/test/cases/parsing/harmony-destructuring-assignment/test.filter.js
@@ -1,5 +1,5 @@
"use strict";
-module.exports = config =>
+module.exports = (config) =>
// This test can't run in development mode
config.mode !== "development";
diff --git a/test/cases/parsing/iife/test.filter.js b/test/cases/parsing/iife/test.filter.js
index f1fbc3fab..28f2f5414 100644
--- a/test/cases/parsing/iife/test.filter.js
+++ b/test/cases/parsing/iife/test.filter.js
@@ -1,5 +1,5 @@
"use strict";
-module.exports = config =>
+module.exports = (config) =>
// TODO fails due to minimizer bug: https://github.com/terser/terser/issues/880
!config.minimize;
diff --git a/test/cases/parsing/issue-4608-1-non-strict/test.filter.js b/test/cases/parsing/issue-4608-1-non-strict/test.filter.js
index 77aeb868d..49d755d43 100644
--- a/test/cases/parsing/issue-4608-1-non-strict/test.filter.js
+++ b/test/cases/parsing/issue-4608-1-non-strict/test.filter.js
@@ -1,3 +1,3 @@
"use strict";
-module.exports = config => !config.module;
+module.exports = (config) => !config.module;
diff --git a/test/cases/parsing/issue-7519/test.filter.js b/test/cases/parsing/issue-7519/test.filter.js
index 24f50b1aa..f6354eef9 100644
--- a/test/cases/parsing/issue-7519/test.filter.js
+++ b/test/cases/parsing/issue-7519/test.filter.js
@@ -1,3 +1,3 @@
"use strict";
-module.exports = config => config.mode !== "development";
+module.exports = (config) => config.mode !== "development";
diff --git a/test/cases/parsing/typeof-non-module/test.filter.js b/test/cases/parsing/typeof-non-module/test.filter.js
index 77aeb868d..49d755d43 100644
--- a/test/cases/parsing/typeof-non-module/test.filter.js
+++ b/test/cases/parsing/typeof-non-module/test.filter.js
@@ -1,3 +1,3 @@
"use strict";
-module.exports = config => !config.module;
+module.exports = (config) => !config.module;
diff --git a/test/cases/parsing/using/test.filter.js b/test/cases/parsing/using/test.filter.js
index e52a5171f..1e4b52cd2 100644
--- a/test/cases/parsing/using/test.filter.js
+++ b/test/cases/parsing/using/test.filter.js
@@ -2,7 +2,7 @@
const supportsUsing = require("../../../helpers/supportsUsing");
-module.exports = config => {
+module.exports = (config) => {
// TODO https://github.com/terser/terser/issues/1625
if (config.minimize) {
return false;
diff --git a/test/checkArrayExpectation.js b/test/checkArrayExpectation.js
index 0b93c73fb..6b082499e 100644
--- a/test/checkArrayExpectation.js
+++ b/test/checkArrayExpectation.js
@@ -8,9 +8,9 @@ const check = (expected, actual) => {
expected = { message: expected };
}
if (Array.isArray(expected)) {
- return expected.every(e => check(e, actual));
+ return expected.every((e) => check(e, actual));
}
- return Object.keys(expected).every(key => {
+ return Object.keys(expected).every((key) => {
let value = actual[key];
if (typeof value === "object") {
value = JSON.stringify(value);
@@ -19,12 +19,12 @@ const check = (expected, actual) => {
});
};
-const explain = object => {
+const explain = (object) => {
if (object instanceof RegExp) {
object = { message: object };
}
return Object.keys(object)
- .map(key => {
+ .map((key) => {
let value = object[key];
if (typeof value === "object" && !(value instanceof RegExp)) {
value = JSON.stringify(value);
@@ -55,11 +55,11 @@ const diffItems = (actual, expected, kind) => {
const diff = [];
if (missing.length > 0) {
diff.push(`The following expected ${kind}s are missing:
-${missing.map(item => `${explain(item)}`).join("\n\n")}`);
+${missing.map((item) => `${explain(item)}`).join("\n\n")}`);
}
if (tooMuch.length > 0) {
diff.push(`The following ${kind}s are unexpected:
-${tooMuch.map(item => `${explain(item)}`).join("\n\n")}`);
+${tooMuch.map((item) => `${explain(item)}`).join("\n\n")}`);
}
return diff.join("\n\n");
};
@@ -81,7 +81,7 @@ module.exports = function checkArrayExpectation(
}
let array = object[`${kind}s`];
if (Array.isArray(array) && kind === "warning") {
- array = array.filter(item => !/from Terser/.test(item));
+ array = array.filter((item) => !/from Terser/.test(item));
}
if (fs.existsSync(path.join(testDirectory, `${filename}.js`))) {
const expectedFilename = path.join(testDirectory, `${filename}.js`);
diff --git a/test/compareLocations.unittest.js b/test/compareLocations.unittest.js
index b5b4d4623..c9d09555a 100644
--- a/test/compareLocations.unittest.js
+++ b/test/compareLocations.unittest.js
@@ -2,7 +2,7 @@
const { compareLocations } = require("../lib/util/comparators");
-const createPosition = overrides => ({
+const createPosition = (overrides) => ({
line: 10,
column: 5,
...overrides
diff --git a/test/compareSourceOrder.unittest.js b/test/compareSourceOrder.unittest.js
index 06974832e..966a086f7 100644
--- a/test/compareSourceOrder.unittest.js
+++ b/test/compareSourceOrder.unittest.js
@@ -23,7 +23,7 @@ describe("sortWithSourceOrder", () => {
sortWithSourceOrder(deps, dependencySourceOrderMap);
- expect(deps.map(d => d.name)).toEqual(["c", "a", "d", "b"]);
+ expect(deps.map((d) => d.name)).toEqual(["c", "a", "d", "b"]);
});
it("should sort dependencies by main order when both in map", () => {
@@ -40,7 +40,7 @@ describe("sortWithSourceOrder", () => {
sortWithSourceOrder(deps, dependencySourceOrderMap);
- expect(deps.map(d => d.name)).toEqual(["c", "b", "a"]);
+ expect(deps.map((d) => d.name)).toEqual(["c", "b", "a"]);
});
it("should sort by sub order when main order is same", () => {
@@ -57,7 +57,7 @@ describe("sortWithSourceOrder", () => {
sortWithSourceOrder(deps, dependencySourceOrderMap);
- expect(deps.map(d => d.name)).toEqual(["a", "c", "b"]);
+ expect(deps.map((d) => d.name)).toEqual(["a", "c", "b"]);
});
it("should sort mixed dependencies - some in map, some not", () => {
@@ -72,7 +72,7 @@ describe("sortWithSourceOrder", () => {
sortWithSourceOrder(deps, dependencySourceOrderMap);
- expect(deps.map(d => d.name)).toEqual(["a", "b", "c"]);
+ expect(deps.map((d) => d.name)).toEqual(["a", "b", "c"]);
});
it("should sort by sourceOrder when none in map", () => {
@@ -84,7 +84,7 @@ describe("sortWithSourceOrder", () => {
sortWithSourceOrder(deps, dependencySourceOrderMap);
- expect(deps.map(d => d.name)).toEqual(["a", "b", "c"]);
+ expect(deps.map((d) => d.name)).toEqual(["a", "b", "c"]);
});
it("should sort complex scenario with negative and decimal values", () => {
@@ -106,7 +106,7 @@ describe("sortWithSourceOrder", () => {
sortWithSourceOrder(deps, dependencySourceOrderMap);
- expect(deps.map(d => d.name)).toEqual(["a", "b", "e", "c", "f", "d"]);
+ expect(deps.map((d) => d.name)).toEqual(["a", "b", "e", "c", "f", "d"]);
});
it("should maintain stable sort for equal values", () => {
@@ -118,6 +118,6 @@ describe("sortWithSourceOrder", () => {
sortWithSourceOrder(deps, dependencySourceOrderMap);
- expect(deps.map(d => d.name)).toEqual(["b", "a", "c"]);
+ expect(deps.map((d) => d.name)).toEqual(["b", "a", "c"]);
});
});
diff --git a/test/compileBooleanMatcher.unittest.js b/test/compileBooleanMatcher.unittest.js
index b2af43e6e..c01a70b61 100644
--- a/test/compileBooleanMatcher.unittest.js
+++ b/test/compileBooleanMatcher.unittest.js
@@ -24,38 +24,38 @@ describe("itemsToRegexp", () => {
}
});
- expectCompiled("basic", ["abc", "def", "123", "45", "6"], e =>
+ expectCompiled("basic", ["abc", "def", "123", "45", "6"], (e) =>
e.toMatchInlineSnapshot("(123|45|6|abc|def)")
);
- expectCompiled("single chars", ["a", "b", "c", "1", "2", "3"], e =>
+ expectCompiled("single chars", ["a", "b", "c", "1", "2", "3"], (e) =>
e.toMatchInlineSnapshot("[123abc]")
);
expectCompiled(
"prefixes",
["ab1", "ab2", "ab3", "ab4", "de5", "de6", "de7", "ef8", "ef9", "gh0"],
- e => e.toMatchInlineSnapshot("(ab[1234]|de[567]|ef[89]|gh0)")
+ (e) => e.toMatchInlineSnapshot("(ab[1234]|de[567]|ef[89]|gh0)")
);
- expectCompiled("short prefixes", "a,ab", e =>
+ expectCompiled("short prefixes", "a,ab", (e) =>
e.toMatchInlineSnapshot("a(|b)")
);
expectCompiled(
"nested prefixes",
["a", "ab", "abc", "abcd", "abcde", "abcdef"],
- e => e.toMatchInlineSnapshot("a(b(c(d(|e|ef)|)|)|)")
+ (e) => e.toMatchInlineSnapshot("a(b(c(d(|e|ef)|)|)|)")
);
- expectCompiled("suffixes", "a1,b1,c1,d1,e1,a2,b2,c2", e =>
+ expectCompiled("suffixes", "a1,b1,c1,d1,e1,a2,b2,c2", (e) =>
e.toMatchInlineSnapshot("([abcde]1|[abc]2)")
);
expectCompiled(
"common prod",
"674,542,965,12,942,483,445,943,423,995,434,122,995,248,432,165,436,86,435,221",
- e =>
+ (e) =>
e.toMatchInlineSnapshot(
"(1(2|22|65)|4(3[2456]|23|45|83)|9(42|43|65|95)|221|248|542|674|86)"
)
@@ -73,7 +73,7 @@ describe("itemsToRegexp", () => {
"./path/to/directory/with/module.css",
"webpack/runtime/module"
],
- e =>
+ (e) =>
e.toMatchInlineSnapshot(
"(\\.\\/path\\/to\\/(directory\\/with\\/(file\\.(js(|on)|css)|module\\.css)|file\\.(|m)js|other\\-file\\.js)|webpack\\/runtime\\/module)"
)
@@ -85,7 +85,7 @@ describe("itemsToRegexp", () => {
"webpack_sharing_consume_default_react_react",
"webpack_sharing_consume_default_classnames_classnames-webpack_sharing_consume_default_react_react"
],
- e =>
+ (e) =>
e.toMatchInlineSnapshot(
"webpack_sharing_consume_default_(|classnames_classnames\\-webpack_sharing_consume_default_)react_react"
)
diff --git a/test/configCases/additional-pass/simple/webpack.config.js b/test/configCases/additional-pass/simple/webpack.config.js
index 722184268..fcb12991f 100644
--- a/test/configCases/additional-pass/simple/webpack.config.js
+++ b/test/configCases/additional-pass/simple/webpack.config.js
@@ -3,7 +3,7 @@
/** @type {import("../../../../").WebpackPluginFunction} */
function testPlugin() {
let counter = 1;
- this.hooks.compilation.tap("TestPlugin", compilation => {
+ this.hooks.compilation.tap("TestPlugin", (compilation) => {
const nr = counter++;
compilation.hooks.needAdditionalPass.tap("TestPlugin", () => {
if (nr < 5) return true;
diff --git a/test/configCases/asset-emitted/normal/webpack.config.js b/test/configCases/asset-emitted/normal/webpack.config.js
index 1b290a41b..0d60896cf 100644
--- a/test/configCases/asset-emitted/normal/webpack.config.js
+++ b/test/configCases/asset-emitted/normal/webpack.config.js
@@ -6,7 +6,7 @@ const Compilation = require("../../../../").Compilation;
/** @type {import("../../../../").Configuration} */
module.exports = {
plugins: [
- compiler => {
+ (compiler) => {
/** @type {Record} */
const files = {};
compiler.hooks.assetEmitted.tap(
diff --git a/test/configCases/asset-modules/data-url-broken/infrastructure-log.js b/test/configCases/asset-modules/data-url-broken/infrastructure-log.js
index b687f5038..951fafae2 100644
--- a/test/configCases/asset-modules/data-url-broken/infrastructure-log.js
+++ b/test/configCases/asset-modules/data-url-broken/infrastructure-log.js
@@ -1,6 +1,6 @@
"use strict";
-module.exports = options => {
+module.exports = (options) => {
if (options.cache && options.cache.type === "filesystem") {
return [/Pack got invalid because of write to/];
}
diff --git a/test/configCases/asset-modules/entry-with-runtimeChunk/webpack.config.js b/test/configCases/asset-modules/entry-with-runtimeChunk/webpack.config.js
index 5f613eb50..2e88fc30b 100644
--- a/test/configCases/asset-modules/entry-with-runtimeChunk/webpack.config.js
+++ b/test/configCases/asset-modules/entry-with-runtimeChunk/webpack.config.js
@@ -20,7 +20,7 @@ const common = {
plugins: [
{
apply(compiler) {
- compiler.hooks.compilation.tap("Test", compilation => {
+ compiler.hooks.compilation.tap("Test", (compilation) => {
compilation.hooks.processAssets.tap(
{
name: "copy-webpack-plugin",
@@ -44,7 +44,7 @@ const common = {
],
optimization: {
runtimeChunk: {
- name: entrypoint => `runtime~${entrypoint.name}`
+ name: (entrypoint) => `runtime~${entrypoint.name}`
}
}
};
@@ -53,7 +53,7 @@ const common = {
* @param {number} i index
* @returns {import("../../../../").Configuration | undefined} configuration
*/
-const entry = i => {
+const entry = (i) => {
switch (i % 4) {
case 0:
return {
@@ -91,7 +91,7 @@ const entry = i => {
* @param {number} i index
* @returns {import("../../../../").Configuration} configuration
*/
-const esm = i => ({
+const esm = (i) => ({
...common,
...entry(i),
output: {
@@ -112,7 +112,7 @@ const esm = i => ({
* @param {number} i index
* @returns {import("../../../../").Configuration} configuration
*/
-const node = i => ({
+const node = (i) => ({
...common,
...entry(i),
output: {
@@ -129,7 +129,7 @@ const node = i => ({
* @param {number} i index
* @returns {import("../../../../").Configuration} configuration
*/
-const web = i => ({
+const web = (i) => ({
...common,
...entry(i),
output: {
@@ -145,9 +145,9 @@ const web = i => ({
/** @type {import("../../../../").Configuration[]} */
module.exports = [
// web
- ...[0, 1, 2, 3].map(i => web(i)),
+ ...[0, 1, 2, 3].map((i) => web(i)),
// node
- ...[4, 5, 6, 7].map(i => node(i)),
+ ...[4, 5, 6, 7].map((i) => node(i)),
// ESM
- ...[8, 9, 10, 11].map(i => esm(i))
+ ...[8, 9, 10, 11].map((i) => esm(i))
];
diff --git a/test/configCases/asset-modules/errored/infrastructure-log.js b/test/configCases/asset-modules/errored/infrastructure-log.js
index b687f5038..951fafae2 100644
--- a/test/configCases/asset-modules/errored/infrastructure-log.js
+++ b/test/configCases/asset-modules/errored/infrastructure-log.js
@@ -1,6 +1,6 @@
"use strict";
-module.exports = options => {
+module.exports = (options) => {
if (options.cache && options.cache.type === "filesystem") {
return [/Pack got invalid because of write to/];
}
diff --git a/test/configCases/asset-modules/keep-source-maps/webpack.config.js b/test/configCases/asset-modules/keep-source-maps/webpack.config.js
index 34b0a1137..a162586fe 100644
--- a/test/configCases/asset-modules/keep-source-maps/webpack.config.js
+++ b/test/configCases/asset-modules/keep-source-maps/webpack.config.js
@@ -25,7 +25,7 @@ module.exports = {
/** @type {GeneratorOptionsByModuleTypeKnown['asset/resource']} */
generator: {
binary: false,
- filename: pathInfo =>
+ filename: (pathInfo) =>
/** @type {string} */
(pathInfo.filename).replace(/\.scss/gi, ".css")
},
diff --git a/test/configCases/asset-modules/only-entry/webpack.config.js b/test/configCases/asset-modules/only-entry/webpack.config.js
index a331cf923..e956df2d3 100644
--- a/test/configCases/asset-modules/only-entry/webpack.config.js
+++ b/test/configCases/asset-modules/only-entry/webpack.config.js
@@ -30,7 +30,7 @@ const common = (i, options) => ({
plugins: [
{
apply(compiler) {
- compiler.hooks.compilation.tap("Test", compilation => {
+ compiler.hooks.compilation.tap("Test", (compilation) => {
compilation.hooks.processAssets.tap(
{
name: "copy-webpack-plugin",
diff --git a/test/configCases/assets/delete-asset/webpack.config.js b/test/configCases/assets/delete-asset/webpack.config.js
index 5dd201c35..8e35fcccc 100644
--- a/test/configCases/assets/delete-asset/webpack.config.js
+++ b/test/configCases/assets/delete-asset/webpack.config.js
@@ -21,8 +21,8 @@ module.exports = {
new BannerPlugin({
banner: "Test"
}),
- compiler => {
- compiler.hooks.compilation.tap("Test", compilation => {
+ (compiler) => {
+ compiler.hooks.compilation.tap("Test", (compilation) => {
compilation.hooks.processAssets.tap(
{
name: "Test",
diff --git a/test/configCases/assets/prevent-related-deletion/webpack.config.js b/test/configCases/assets/prevent-related-deletion/webpack.config.js
index 23079f46d..b2d41131e 100644
--- a/test/configCases/assets/prevent-related-deletion/webpack.config.js
+++ b/test/configCases/assets/prevent-related-deletion/webpack.config.js
@@ -11,8 +11,8 @@ module.exports = {
},
devtool: "source-map",
plugins: [
- compiler => {
- compiler.hooks.compilation.tap("Test", compilation => {
+ (compiler) => {
+ compiler.hooks.compilation.tap("Test", (compilation) => {
compilation.hooks.processAssets.tap(
{
name: "Test",
diff --git a/test/configCases/cache-dependencies/managed-items-unsafe-cache/webpack.config.js b/test/configCases/cache-dependencies/managed-items-unsafe-cache/webpack.config.js
index 568f4a943..042d1e75a 100644
--- a/test/configCases/cache-dependencies/managed-items-unsafe-cache/webpack.config.js
+++ b/test/configCases/cache-dependencies/managed-items-unsafe-cache/webpack.config.js
@@ -8,7 +8,7 @@ module.exports = {
managedPaths: [path.resolve(__dirname, "node_modules")]
},
plugins: [
- compiler => {
+ (compiler) => {
compiler.hooks.done.tap("Test", ({ compilation }) => {
const fileDeps = [...compilation.fileDependencies];
expect(fileDeps).toContain(
diff --git a/test/configCases/cache-dependencies/managed-items/webpack.config.js b/test/configCases/cache-dependencies/managed-items/webpack.config.js
index 98dca6365..5e5b9f15f 100644
--- a/test/configCases/cache-dependencies/managed-items/webpack.config.js
+++ b/test/configCases/cache-dependencies/managed-items/webpack.config.js
@@ -8,7 +8,7 @@ module.exports = {
managedPaths: [path.resolve(__dirname, "node_modules")]
},
plugins: [
- compiler => {
+ (compiler) => {
compiler.hooks.done.tap("Test", ({ compilation }) => {
const fileDeps = [...compilation.fileDependencies];
expect(fileDeps).toContain(
diff --git a/test/configCases/chunk-index/issue-18008/webpack.config.js b/test/configCases/chunk-index/issue-18008/webpack.config.js
index 06497a8ec..3a338ae71 100644
--- a/test/configCases/chunk-index/issue-18008/webpack.config.js
+++ b/test/configCases/chunk-index/issue-18008/webpack.config.js
@@ -20,7 +20,7 @@ module.exports = {
* @param {Compilation} compilation compilation
* @returns {void}
*/
- const handler = compilation => {
+ const handler = (compilation) => {
compilation.hooks.afterSeal.tap("testcase", () => {
/** @type {Record} */
const data = {};
diff --git a/test/configCases/chunk-index/order-multiple-entries/webpack.config.js b/test/configCases/chunk-index/order-multiple-entries/webpack.config.js
index 67667ee83..a2c54eb02 100644
--- a/test/configCases/chunk-index/order-multiple-entries/webpack.config.js
+++ b/test/configCases/chunk-index/order-multiple-entries/webpack.config.js
@@ -21,7 +21,7 @@ module.exports = {
* @param {Compilation} compilation compilation
* @returns {void}
*/
- const handler = compilation => {
+ const handler = (compilation) => {
const moduleGraph = compilation.moduleGraph;
compilation.hooks.afterSeal.tap("testcase", () => {
/** @type {Record} */
@@ -80,13 +80,13 @@ module.exports = {
});
const indices = [...compilation.modules]
.map(
- m =>
+ (m) =>
/** @type {[number, Module]} */ ([
moduleGraph.getPreOrderIndex(m),
m
])
)
- .filter(p => typeof p[0] === "number")
+ .filter((p) => typeof p[0] === "number")
.sort((a, b) => a[0] - b[0])
.map(
([i, m]) =>
@@ -95,13 +95,13 @@ module.exports = {
.join(", ");
const indices2 = [...compilation.modules]
.map(
- m =>
+ (m) =>
/** @type {[number, Module]} */ ([
moduleGraph.getPostOrderIndex(m),
m
])
)
- .filter(p => typeof p[0] === "number")
+ .filter((p) => typeof p[0] === "number")
.sort((a, b) => a[0] - b[0])
.map(
([i, m]) =>
diff --git a/test/configCases/chunk-index/recalc-index/webpack.config.js b/test/configCases/chunk-index/recalc-index/webpack.config.js
index b8c597084..540a4b9a2 100644
--- a/test/configCases/chunk-index/recalc-index/webpack.config.js
+++ b/test/configCases/chunk-index/recalc-index/webpack.config.js
@@ -16,7 +16,7 @@ module.exports = {
* @param {Compilation} compilation compilation
* @returns {void}
*/
- const handler = compilation => {
+ const handler = (compilation) => {
compilation.hooks.afterSeal.tap("testcase", () => {
/** @type {Record} */
const data = {};
diff --git a/test/configCases/clean/dry/webpack.config.js b/test/configCases/clean/dry/webpack.config.js
index 227c33bdf..353ae5cff 100644
--- a/test/configCases/clean/dry/webpack.config.js
+++ b/test/configCases/clean/dry/webpack.config.js
@@ -13,9 +13,9 @@ module.exports = {
}
},
plugins: [
- compiler => {
- compiler.hooks.thisCompilation.tap("Test", compilation => {
- compilation.hooks.processAssets.tap("Test", assets => {
+ (compiler) => {
+ compiler.hooks.thisCompilation.tap("Test", (compilation) => {
+ compilation.hooks.processAssets.tap("Test", (assets) => {
const outputPath = compilation.getPath(compiler.outputPath, {});
const customDir = path.join(outputPath, "this/dir/should/be/removed");
fs.mkdirSync(customDir, { recursive: true });
@@ -23,7 +23,7 @@ module.exports = {
assets["this/dir/should/not/be/removed/file.ext"] = new RawSource("");
});
});
- compiler.hooks.afterEmit.tap("Test", compilation => {
+ compiler.hooks.afterEmit.tap("Test", (compilation) => {
const outputPath = compilation.getPath(compiler.outputPath, {});
expect(readDir(outputPath)).toMatchInlineSnapshot(`
Object {
diff --git a/test/configCases/clean/enabled/webpack.config.js b/test/configCases/clean/enabled/webpack.config.js
index 3e1a0946f..66e6fb82e 100644
--- a/test/configCases/clean/enabled/webpack.config.js
+++ b/test/configCases/clean/enabled/webpack.config.js
@@ -11,10 +11,10 @@ module.exports = {
clean: true
},
plugins: [
- compiler => {
+ (compiler) => {
let once = true;
- compiler.hooks.thisCompilation.tap("Test", compilation => {
- compilation.hooks.processAssets.tap("Test", assets => {
+ compiler.hooks.thisCompilation.tap("Test", (compilation) => {
+ compilation.hooks.processAssets.tap("Test", (assets) => {
if (once) {
const outputPath = compilation.getPath(compiler.outputPath, {});
const customDir = path.join(
@@ -28,7 +28,7 @@ module.exports = {
assets["this/dir/should/not/be/removed/file.ext"] = new RawSource("");
});
});
- compiler.hooks.afterEmit.tap("Test", compilation => {
+ compiler.hooks.afterEmit.tap("Test", (compilation) => {
const outputPath = compilation.getPath(compiler.outputPath, {});
expect(readDir(outputPath)).toMatchInlineSnapshot(`
Object {
diff --git a/test/configCases/clean/ignore-fn/webpack.config.js b/test/configCases/clean/ignore-fn/webpack.config.js
index 13daf6c5f..778d0ad40 100644
--- a/test/configCases/clean/ignore-fn/webpack.config.js
+++ b/test/configCases/clean/ignore-fn/webpack.config.js
@@ -15,10 +15,10 @@ module.exports = {
}
},
plugins: [
- compiler => {
+ (compiler) => {
let once = true;
- compiler.hooks.thisCompilation.tap("Test", compilation => {
- compilation.hooks.processAssets.tap("Test", assets => {
+ compiler.hooks.thisCompilation.tap("Test", (compilation) => {
+ compilation.hooks.processAssets.tap("Test", (assets) => {
if (once) {
const outputPath = compilation.getPath(compiler.outputPath, {});
const customDir = path.join(
@@ -38,7 +38,7 @@ module.exports = {
assets["this/dir/should/not/be/removed/file.ext"] = new RawSource("");
});
});
- compiler.hooks.afterEmit.tap("Test", compilation => {
+ compiler.hooks.afterEmit.tap("Test", (compilation) => {
const outputPath = compilation.getPath(compiler.outputPath, {});
expect(readDir(outputPath)).toMatchInlineSnapshot(`
Object {
diff --git a/test/configCases/clean/ignore-hook/webpack.config.js b/test/configCases/clean/ignore-hook/webpack.config.js
index 7bf527d5b..458b92cef 100644
--- a/test/configCases/clean/ignore-hook/webpack.config.js
+++ b/test/configCases/clean/ignore-hook/webpack.config.js
@@ -12,17 +12,17 @@ module.exports = {
clean: true
},
plugins: [
- compiler => {
+ (compiler) => {
let once = true;
- compiler.hooks.thisCompilation.tap("Test", compilation => {
+ compiler.hooks.thisCompilation.tap("Test", (compilation) => {
webpack.CleanPlugin.getCompilationHooks(compilation).keep.tap(
"Test",
- asset => {
+ (asset) => {
if (/[/\\]ignored[/\\]dir[/\\]/.test(asset)) return true;
if (asset.includes("ignored/too")) return true;
}
);
- compilation.hooks.processAssets.tap("Test", assets => {
+ compilation.hooks.processAssets.tap("Test", (assets) => {
if (once) {
const outputPath = compilation.getPath(compiler.outputPath, {});
const customDir = path.join(
@@ -48,7 +48,7 @@ module.exports = {
assets["this/dir/should/not/be/removed/file.ext"] = new RawSource("");
});
});
- compiler.hooks.afterEmit.tap("Test", compilation => {
+ compiler.hooks.afterEmit.tap("Test", (compilation) => {
const outputPath = compilation.getPath(compiler.outputPath, {});
expect(readDir(outputPath)).toMatchInlineSnapshot(`
Object {
diff --git a/test/configCases/clean/ignore-rx/webpack.config.js b/test/configCases/clean/ignore-rx/webpack.config.js
index c0c1e5f1d..5b4291ed3 100644
--- a/test/configCases/clean/ignore-rx/webpack.config.js
+++ b/test/configCases/clean/ignore-rx/webpack.config.js
@@ -13,10 +13,10 @@ module.exports = {
}
},
plugins: [
- compiler => {
+ (compiler) => {
let once = true;
- compiler.hooks.thisCompilation.tap("Test", compilation => {
- compilation.hooks.processAssets.tap("Test", assets => {
+ compiler.hooks.thisCompilation.tap("Test", (compilation) => {
+ compilation.hooks.processAssets.tap("Test", (assets) => {
if (once) {
const outputPath = compilation.getPath(compiler.outputPath, {});
const customDir = path.join(
@@ -36,7 +36,7 @@ module.exports = {
assets["this/dir/should/not/be/removed/file.ext"] = new RawSource("");
});
});
- compiler.hooks.afterEmit.tap("Test", compilation => {
+ compiler.hooks.afterEmit.tap("Test", (compilation) => {
const outputPath = compilation.getPath(compiler.outputPath, {});
expect(readDir(outputPath)).toMatchInlineSnapshot(`
Object {
diff --git a/test/configCases/clean/lib-manifest-plugin/webpack.config.js b/test/configCases/clean/lib-manifest-plugin/webpack.config.js
index c491fd7be..1e3ae36ea 100644
--- a/test/configCases/clean/lib-manifest-plugin/webpack.config.js
+++ b/test/configCases/clean/lib-manifest-plugin/webpack.config.js
@@ -10,15 +10,15 @@ module.exports = {
clean: true
},
plugins: [
- compiler => {
- compiler.hooks.thisCompilation.tap("Test", compilation => {
+ (compiler) => {
+ compiler.hooks.thisCompilation.tap("Test", (compilation) => {
const outputPath = compilation.getPath(compiler.outputPath, {});
new webpack.DllPlugin({
name: "[name]_dll",
path: path.resolve(outputPath, "manifest.json")
}).apply(compiler);
});
- compiler.hooks.afterEmit.tap("Test", compilation => {
+ compiler.hooks.afterEmit.tap("Test", (compilation) => {
const outputPath = compilation.getPath(compiler.outputPath, {});
expect(readDir(outputPath)).toMatchInlineSnapshot(`
Object {
diff --git a/test/configCases/clean/link/webpack.config.js b/test/configCases/clean/link/webpack.config.js
index b713ae082..db7deb809 100644
--- a/test/configCases/clean/link/webpack.config.js
+++ b/test/configCases/clean/link/webpack.config.js
@@ -10,7 +10,7 @@ module.exports = {
clean: true
},
plugins: [
- compiler => {
+ (compiler) => {
let once = true;
compiler.hooks.environment.tap("Test", () => {
if (once) {
@@ -29,7 +29,7 @@ module.exports = {
once = false;
}
});
- compiler.hooks.afterEmit.tap("Test", compilation => {
+ compiler.hooks.afterEmit.tap("Test", (compilation) => {
const outputPath = compilation.getPath(compiler.outputPath, {});
expect(readDir(outputPath)).toMatchInlineSnapshot(`
Object {
diff --git a/test/configCases/container/container-reference/test.config.js b/test/configCases/container/container-reference/test.config.js
index 8af93b270..86191d988 100644
--- a/test/configCases/container/container-reference/test.config.js
+++ b/test/configCases/container/container-reference/test.config.js
@@ -4,7 +4,7 @@ module.exports = {
moduleScope(scope) {
scope.ABC = {
get(module) {
- return new Promise(resolve => {
+ return new Promise((resolve) => {
setTimeout(() => {
resolve(() => `abc ${module}`);
}, 100);
@@ -13,7 +13,7 @@ module.exports = {
};
scope.DEF = {
get(module) {
- return new Promise(resolve => {
+ return new Promise((resolve) => {
setTimeout(() => {
resolve(() => ({
__esModule: true,
diff --git a/test/configCases/container/module-federation/test.config.js b/test/configCases/container/module-federation/test.config.js
index 17fbc3ff3..0801dbda3 100644
--- a/test/configCases/container/module-federation/test.config.js
+++ b/test/configCases/container/module-federation/test.config.js
@@ -11,7 +11,7 @@ module.exports = {
scope.System = System;
System.set("ABC", {
get(module) {
- return new Promise(resolve => {
+ return new Promise((resolve) => {
setTimeout(() => {
resolve(() => `abc ${module}`);
}, 100);
@@ -20,7 +20,7 @@ module.exports = {
});
System.set("DEF", {
get(module) {
- return new Promise(resolve => {
+ return new Promise((resolve) => {
setTimeout(() => {
resolve(() => ({
__esModule: true,
diff --git a/test/configCases/contenthash/css-generator-options/webpack.config.js b/test/configCases/contenthash/css-generator-options/webpack.config.js
index 435b50ff9..8b27cfb96 100644
--- a/test/configCases/contenthash/css-generator-options/webpack.config.js
+++ b/test/configCases/contenthash/css-generator-options/webpack.config.js
@@ -83,7 +83,7 @@ module.exports = [
type: "css/module",
/** @type {GeneratorOptionsByModuleTypeKnown["css/module"]} */
generator: {
- exportsConvention: name => name.toUpperCase()
+ exportsConvention: (name) => name.toUpperCase()
}
}
]
diff --git a/test/configCases/css/css-modules-broken-keyframes/webpack.config.js b/test/configCases/css/css-modules-broken-keyframes/webpack.config.js
index abf224096..7a17c20ad 100644
--- a/test/configCases/css/css-modules-broken-keyframes/webpack.config.js
+++ b/test/configCases/css/css-modules-broken-keyframes/webpack.config.js
@@ -18,10 +18,10 @@ module.exports = (env, { testPath }) => ({
maxLength: 3,
failOnConflict: true,
fixedLength: true,
- test: m => m.type.startsWith("css")
+ test: (m) => m.type.startsWith("css")
}),
new webpack.experiments.ids.SyncModuleIdsPlugin({
- test: m => m.type.startsWith("css"),
+ test: (m) => m.type.startsWith("css"),
path: path.resolve(testPath, "module-ids.json"),
mode: "create"
})
diff --git a/test/configCases/css/css-modules-in-node/webpack.config.js b/test/configCases/css/css-modules-in-node/webpack.config.js
index 634c5d00f..8490401ce 100644
--- a/test/configCases/css/css-modules-in-node/webpack.config.js
+++ b/test/configCases/css/css-modules-in-node/webpack.config.js
@@ -42,7 +42,7 @@ module.exports = (env, { testPath }) => [
maxLength: 3,
failOnConflict: true,
fixedLength: true,
- test: m => m.type.startsWith("css")
+ test: (m) => m.type.startsWith("css")
})
],
module: {
@@ -71,7 +71,7 @@ module.exports = (env, { testPath }) => [
},
plugins: [
new webpack.experiments.ids.SyncModuleIdsPlugin({
- test: m => m.type.startsWith("css"),
+ test: (m) => m.type.startsWith("css"),
path: path.resolve(testPath, "../css-modules/module-ids.json"),
mode: "read"
})
diff --git a/test/configCases/css/css-modules/webpack.config.js b/test/configCases/css/css-modules/webpack.config.js
index 0e9185729..78c7a2864 100644
--- a/test/configCases/css/css-modules/webpack.config.js
+++ b/test/configCases/css/css-modules/webpack.config.js
@@ -58,10 +58,10 @@ module.exports = (env, { testPath }) => [
maxLength: 3,
failOnConflict: true,
fixedLength: true,
- test: m => m.type.startsWith("css")
+ test: (m) => m.type.startsWith("css")
}),
new webpack.experiments.ids.SyncModuleIdsPlugin({
- test: m => m.type.startsWith("css"),
+ test: (m) => m.type.startsWith("css"),
path: path.resolve(testPath, "module-ids.json"),
mode: "create"
})
diff --git a/test/configCases/css/exports-convention/webpack.config.js b/test/configCases/css/exports-convention/webpack.config.js
index afca53522..a2f12652a 100644
--- a/test/configCases/css/exports-convention/webpack.config.js
+++ b/test/configCases/css/exports-convention/webpack.config.js
@@ -48,7 +48,7 @@ const common = {
resourceQuery: /\?upper$/,
/** @type {GeneratorOptionsByModuleTypeKnown["css/module"]} */
generator: {
- exportsConvention: name => name.toUpperCase()
+ exportsConvention: (name) => name.toUpperCase()
}
}
]
diff --git a/test/configCases/css/no-extra-js-exports-output/webpack.config.js b/test/configCases/css/no-extra-js-exports-output/webpack.config.js
index dfe0f6a22..a86425699 100644
--- a/test/configCases/css/no-extra-js-exports-output/webpack.config.js
+++ b/test/configCases/css/no-extra-js-exports-output/webpack.config.js
@@ -8,7 +8,7 @@ const webpack = require("../../../../");
* @param {0 | 1 | 2} i index
* @returns {{ main: string[] }} entry
*/
-const entry = i => {
+const entry = (i) => {
switch (i) {
case 0:
return {
@@ -29,7 +29,7 @@ const entry = i => {
* @param {0 | 1 | 2} i param
* @returns {import("../../../../").Configuration} return
*/
-const common = i => ({
+const common = (i) => ({
entry: {
...entry(i)
},
@@ -47,7 +47,7 @@ const common = i => ({
plugins: [
{
apply(compiler) {
- compiler.hooks.compilation.tap("Test", compilation => {
+ compiler.hooks.compilation.tap("Test", (compilation) => {
compilation.hooks.processAssets.tap(
{
name: "copy-webpack-plugin",
@@ -72,4 +72,4 @@ const common = i => ({
});
/** @type {import("../../../../").Configuration[]} */
-module.exports = /** @type {(0 | 1 | 2)[]} */ ([0, 1]).map(i => common(i));
+module.exports = /** @type {(0 | 1 | 2)[]} */ ([0, 1]).map((i) => common(i));
diff --git a/test/configCases/css/runtime-data-webpack/webpack.config.js b/test/configCases/css/runtime-data-webpack/webpack.config.js
index a8ec0c7f8..b32aedd15 100644
--- a/test/configCases/css/runtime-data-webpack/webpack.config.js
+++ b/test/configCases/css/runtime-data-webpack/webpack.config.js
@@ -10,14 +10,14 @@ module.exports = {
plugins: [
{
apply(compiler) {
- compiler.hooks.compilation.tap("Test", compilation => {
+ compiler.hooks.compilation.tap("Test", (compilation) => {
compilation.hooks.processAssets.tap(
{
name: "Test",
stage:
compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE
},
- assets => {
+ (assets) => {
const name = "bundle0.css";
const code = /** @type {string} */ (assets[name].source());
diff --git a/test/configCases/css/runtime-document-head-get-computed-style/webpack.config.js b/test/configCases/css/runtime-document-head-get-computed-style/webpack.config.js
index 0f364991f..35e121e56 100644
--- a/test/configCases/css/runtime-document-head-get-computed-style/webpack.config.js
+++ b/test/configCases/css/runtime-document-head-get-computed-style/webpack.config.js
@@ -10,14 +10,14 @@ module.exports = {
plugins: [
{
apply(compiler) {
- compiler.hooks.compilation.tap("Test", compilation => {
+ compiler.hooks.compilation.tap("Test", (compilation) => {
compilation.hooks.processAssets.tap(
{
name: "Test",
stage:
compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE
},
- assets => {
+ (assets) => {
const name = "bundle0.css";
const code = assets[name].source();
diff --git a/test/configCases/custom-source-type/localization/webpack.config.js b/test/configCases/custom-source-type/localization/webpack.config.js
index abd3bd2f7..f5e1c48ee 100644
--- a/test/configCases/custom-source-type/localization/webpack.config.js
+++ b/test/configCases/custom-source-type/localization/webpack.config.js
@@ -135,7 +135,7 @@ module.exports = definitions.map((defs, i) => ({
/**
* @param {Compiler} compiler the compiler
*/
- compiler => {
+ (compiler) => {
compiler.hooks.thisCompilation.tap(
"LocalizationPlugin",
(compilation, { normalModuleFactory }) => {
@@ -192,7 +192,7 @@ module.exports = definitions.map((defs, i) => ({
.tap("LocalizationPlugin", (chunk, set) => {
const chunkGraph = compilation.chunkGraph;
if (
- !chunkGraph.hasModuleInGraph(chunk, m =>
+ !chunkGraph.hasModuleInGraph(chunk, (m) =>
m.type.startsWith("localization")
)
) {
diff --git a/test/configCases/deep-scope-analysis/remove-export-scope-hoisting/webpack.config.js b/test/configCases/deep-scope-analysis/remove-export-scope-hoisting/webpack.config.js
index 3fbee2391..9ff9ba31e 100644
--- a/test/configCases/deep-scope-analysis/remove-export-scope-hoisting/webpack.config.js
+++ b/test/configCases/deep-scope-analysis/remove-export-scope-hoisting/webpack.config.js
@@ -18,7 +18,7 @@ module.exports = {
* @param {Compilation} compilation the compilation
* @returns {void}
*/
- compilation => {
+ (compilation) => {
compilation.hooks.dependencyReferencedExports.tap(
"Test",
(referencedExports, dep) => {
@@ -33,14 +33,14 @@ module.exports = {
refModule &&
refModule.identifier().endsWith("reference.js") &&
referencedExports.some(
- names =>
+ (names) =>
Array.isArray(names) &&
names.length === 1 &&
names[0] === "unused"
)
) {
return referencedExports.filter(
- names =>
+ (names) =>
(Array.isArray(names) && names.length !== 1) ||
/** @type {string[]} */
(names)[0] !== "unused"
diff --git a/test/configCases/deep-scope-analysis/remove-export/webpack.config.js b/test/configCases/deep-scope-analysis/remove-export/webpack.config.js
index 7a18c143b..33ca6f79a 100644
--- a/test/configCases/deep-scope-analysis/remove-export/webpack.config.js
+++ b/test/configCases/deep-scope-analysis/remove-export/webpack.config.js
@@ -12,7 +12,7 @@ module.exports = {
},
plugins: [
function apply() {
- this.hooks.compilation.tap("Test", compilation => {
+ this.hooks.compilation.tap("Test", (compilation) => {
compilation.hooks.dependencyReferencedExports.tap(
"Test",
(referencedExports, dep) => {
@@ -27,14 +27,14 @@ module.exports = {
refModule &&
refModule.identifier().endsWith("reference.js") &&
referencedExports.some(
- names =>
+ (names) =>
Array.isArray(names) &&
names.length === 1 &&
names[0] === "unused"
)
) {
return referencedExports.filter(
- names =>
+ (names) =>
(Array.isArray(names) && names.length !== 1) ||
/** @type {string[]} */
(names)[0] !== "unused"
diff --git a/test/configCases/deprecations/chunk-and-module/webpack.config.js b/test/configCases/deprecations/chunk-and-module/webpack.config.js
index 36bbf2ea4..8b22b0b08 100644
--- a/test/configCases/deprecations/chunk-and-module/webpack.config.js
+++ b/test/configCases/deprecations/chunk-and-module/webpack.config.js
@@ -7,7 +7,7 @@ const { ChunkGraph, ExternalModule } = require("../../../../");
/** @type {import("../../../../").Configuration} */
module.exports = {
plugins: [
- compiler => {
+ (compiler) => {
compiler.hooks.done.tap("Test", ({ compilation }) => {
const { chunkGraph } = compilation;
for (const chunk of compilation.chunks) {
@@ -23,7 +23,7 @@ module.exports = {
expect(chunk.getNumberOfModules()).toBe(4);
expect(new Set(chunk.modulesIterable)).toContain(module);
expect(new Set(chunk.getModules())).toContain(chunk.entryModule);
- expect(chunk.hasModuleInGraph(m => m === module)).toBe(true);
+ expect(chunk.hasModuleInGraph((m) => m === module)).toBe(true);
expect(chunk.containsModule(module)).toBe(true);
chunk.removeModule(module);
module.removeChunk(chunk);
diff --git a/test/configCases/deprecations/chunk-files/webpack.config.js b/test/configCases/deprecations/chunk-files/webpack.config.js
index b64154006..23db54e0b 100644
--- a/test/configCases/deprecations/chunk-files/webpack.config.js
+++ b/test/configCases/deprecations/chunk-files/webpack.config.js
@@ -3,7 +3,7 @@
/** @type {import("../../../../").Configuration} */
module.exports = {
plugins: [
- compiler => {
+ (compiler) => {
compiler.hooks.done.tap("Test", ({ compilation }) => {
for (const c of compilation.chunks) {
const chunk =
diff --git a/test/configCases/deprecations/invalid-dependencies/webpack.config.js b/test/configCases/deprecations/invalid-dependencies/webpack.config.js
index 8df1a7140..ad91963f4 100644
--- a/test/configCases/deprecations/invalid-dependencies/webpack.config.js
+++ b/test/configCases/deprecations/invalid-dependencies/webpack.config.js
@@ -14,9 +14,9 @@ module.exports = {
]
},
plugins: [
- compiler => {
- compiler.hooks.compilation.tap("Test", compilation => {
- compilation.hooks.succeedModule.tap("Test", module => {
+ (compiler) => {
+ compiler.hooks.compilation.tap("Test", (compilation) => {
+ compilation.hooks.succeedModule.tap("Test", (module) => {
const fileDeps = new webpack.util.LazySet();
const contextDeps = new webpack.util.LazySet();
const missingDeps = new webpack.util.LazySet();
diff --git a/test/configCases/deprecations/non-unique-hash/webpack.config.js b/test/configCases/deprecations/non-unique-hash/webpack.config.js
index ef7f8aa4e..10d7d445c 100644
--- a/test/configCases/deprecations/non-unique-hash/webpack.config.js
+++ b/test/configCases/deprecations/non-unique-hash/webpack.config.js
@@ -17,8 +17,8 @@ module.exports = {
concatenateModules: false
},
plugins: [
- compiler => {
- compiler.hooks.compilation.tap("Test", compilation => {
+ (compiler) => {
+ compiler.hooks.compilation.tap("Test", (compilation) => {
compilation.hooks.afterModuleHash.tap("Test", () => {
const hashes = [];
expect(() => {
diff --git a/test/configCases/ecmaVersion/browserslist-config-env/webpack.config.js b/test/configCases/ecmaVersion/browserslist-config-env/webpack.config.js
index 14d737371..ae92dffb9 100644
--- a/test/configCases/ecmaVersion/browserslist-config-env/webpack.config.js
+++ b/test/configCases/ecmaVersion/browserslist-config-env/webpack.config.js
@@ -6,8 +6,8 @@ const path = require("path");
module.exports = {
target: `browserslist:${path.join(__dirname, ".browserslistrc")}:modern`,
plugins: [
- compiler => {
- compiler.hooks.compilation.tap("Test", compilation => {
+ (compiler) => {
+ compiler.hooks.compilation.tap("Test", (compilation) => {
expect(compilation.outputOptions.environment).toMatchInlineSnapshot(`
Object {
"arrowFunction": false,
diff --git a/test/configCases/ecmaVersion/browserslist-config/webpack.config.js b/test/configCases/ecmaVersion/browserslist-config/webpack.config.js
index 1ff200a0c..ab3cae79d 100644
--- a/test/configCases/ecmaVersion/browserslist-config/webpack.config.js
+++ b/test/configCases/ecmaVersion/browserslist-config/webpack.config.js
@@ -6,8 +6,8 @@ const path = require("path");
module.exports = {
target: `browserslist:${path.join(__dirname, ".browserslistrc")}`,
plugins: [
- compiler => {
- compiler.hooks.compilation.tap("Test", compilation => {
+ (compiler) => {
+ compiler.hooks.compilation.tap("Test", (compilation) => {
expect(compilation.outputOptions.environment).toMatchInlineSnapshot(`
Object {
"arrowFunction": false,
diff --git a/test/configCases/ecmaVersion/browserslist-missing/test.filter.js b/test/configCases/ecmaVersion/browserslist-missing/test.filter.js
index a0e90a191..96ddb2717 100644
--- a/test/configCases/ecmaVersion/browserslist-missing/test.filter.js
+++ b/test/configCases/ecmaVersion/browserslist-missing/test.filter.js
@@ -1,3 +1,3 @@
"use strict";
-module.exports = config => !config.cache;
+module.exports = (config) => !config.cache;
diff --git a/test/configCases/ecmaVersion/browserslist-query/webpack.config.js b/test/configCases/ecmaVersion/browserslist-query/webpack.config.js
index fa4e2b863..f8a453518 100644
--- a/test/configCases/ecmaVersion/browserslist-query/webpack.config.js
+++ b/test/configCases/ecmaVersion/browserslist-query/webpack.config.js
@@ -4,8 +4,8 @@
module.exports = {
target: "browserslist: ie 9",
plugins: [
- compiler => {
- compiler.hooks.compilation.tap("Test", compilation => {
+ (compiler) => {
+ compiler.hooks.compilation.tap("Test", (compilation) => {
expect(compilation.outputOptions.environment).toMatchInlineSnapshot(`
Object {
"arrowFunction": false,
diff --git a/test/configCases/ecmaVersion/browserslist/webpack.config.js b/test/configCases/ecmaVersion/browserslist/webpack.config.js
index 1885bdfaa..310967020 100644
--- a/test/configCases/ecmaVersion/browserslist/webpack.config.js
+++ b/test/configCases/ecmaVersion/browserslist/webpack.config.js
@@ -4,8 +4,8 @@
module.exports = {
target: ["browserslist"],
plugins: [
- compiler => {
- compiler.hooks.compilation.tap("Test", compilation => {
+ (compiler) => {
+ compiler.hooks.compilation.tap("Test", (compilation) => {
expect(compilation.outputOptions.environment).toMatchInlineSnapshot(`
Object {
"arrowFunction": true,
diff --git a/test/configCases/entry/depend-on-advanced/webpack.config.js b/test/configCases/entry/depend-on-advanced/webpack.config.js
index c38883dc9..03d6b515e 100644
--- a/test/configCases/entry/depend-on-advanced/webpack.config.js
+++ b/test/configCases/entry/depend-on-advanced/webpack.config.js
@@ -34,7 +34,7 @@ module.exports = {
* @param {Compilation} compilation compilation
* @returns {void}
*/
- const handler = compilation => {
+ const handler = (compilation) => {
compilation.hooks.afterSeal.tap("testcase", () => {
const { chunkGraph } = compilation;
/** @type {Record>} */
diff --git a/test/configCases/entry/depend-on-simple/webpack.config.js b/test/configCases/entry/depend-on-simple/webpack.config.js
index 723dc6c5a..4314a7d1d 100644
--- a/test/configCases/entry/depend-on-simple/webpack.config.js
+++ b/test/configCases/entry/depend-on-simple/webpack.config.js
@@ -24,7 +24,7 @@ module.exports = {
* @param {Compilation} compilation compilation
* @returns {void}
*/
- const handler = compilation => {
+ const handler = (compilation) => {
compilation.hooks.afterSeal.tap("testcase", () => {
const { chunkGraph } = compilation;
/** @type {Record>} */
diff --git a/test/configCases/errors/exception-in-chunk-renderer/webpack.config.js b/test/configCases/errors/exception-in-chunk-renderer/webpack.config.js
index 640f63f32..ad222c151 100644
--- a/test/configCases/errors/exception-in-chunk-renderer/webpack.config.js
+++ b/test/configCases/errors/exception-in-chunk-renderer/webpack.config.js
@@ -7,7 +7,7 @@ class ThrowsExceptionInRender {
* @param {Compiler} compiler compiler
*/
apply(compiler) {
- compiler.hooks.compilation.tap("ThrowsException", compilation => {
+ compiler.hooks.compilation.tap("ThrowsException", (compilation) => {
compilation.mainTemplate.hooks.requireExtensions.tap(
"ThrowsException",
() => {
diff --git a/test/configCases/errors/generator-generate-error/infrastructure-log.js b/test/configCases/errors/generator-generate-error/infrastructure-log.js
index b687f5038..951fafae2 100644
--- a/test/configCases/errors/generator-generate-error/infrastructure-log.js
+++ b/test/configCases/errors/generator-generate-error/infrastructure-log.js
@@ -1,6 +1,6 @@
"use strict";
-module.exports = options => {
+module.exports = (options) => {
if (options.cache && options.cache.type === "filesystem") {
return [/Pack got invalid because of write to/];
}
diff --git a/test/configCases/externals/concatenated-module/webpack.config.js b/test/configCases/externals/concatenated-module/webpack.config.js
index 6b2d95536..9ddd5aed3 100644
--- a/test/configCases/externals/concatenated-module/webpack.config.js
+++ b/test/configCases/externals/concatenated-module/webpack.config.js
@@ -1,7 +1,7 @@
"use strict";
/** @type {(variant: boolean) => import("../../../../").Configuration} */
-const config = o => ({
+const config = (o) => ({
externals: {
"module-fs": o ? "module fs" : "module fs/promises",
fs: o ? "node-commonjs fs" : "node-commonjs fs/promises",
diff --git a/test/configCases/externals/import-assertion/webpack.config.js b/test/configCases/externals/import-assertion/webpack.config.js
index d4a4306b1..0da4f8359 100644
--- a/test/configCases/externals/import-assertion/webpack.config.js
+++ b/test/configCases/externals/import-assertion/webpack.config.js
@@ -21,7 +21,7 @@ module.exports = {
plugins: [
{
apply(compiler) {
- compiler.hooks.compilation.tap("html-plugin", compilation => {
+ compiler.hooks.compilation.tap("html-plugin", (compilation) => {
compilation.hooks.processAssets.tap(
{
name: "copy-plugin",
diff --git a/test/configCases/externals/import-attributes/webpack.config.js b/test/configCases/externals/import-attributes/webpack.config.js
index d4a4306b1..0da4f8359 100644
--- a/test/configCases/externals/import-attributes/webpack.config.js
+++ b/test/configCases/externals/import-attributes/webpack.config.js
@@ -21,7 +21,7 @@ module.exports = {
plugins: [
{
apply(compiler) {
- compiler.hooks.compilation.tap("html-plugin", compilation => {
+ compiler.hooks.compilation.tap("html-plugin", (compilation) => {
compilation.hooks.processAssets.tap(
{
name: "copy-plugin",
diff --git a/test/configCases/filename-template/filename-function/webpack.config.js b/test/configCases/filename-template/filename-function/webpack.config.js
index f221e314d..eac0922a8 100644
--- a/test/configCases/filename-template/filename-function/webpack.config.js
+++ b/test/configCases/filename-template/filename-function/webpack.config.js
@@ -14,7 +14,7 @@ module.exports = {
* @param {PathData} data data
* @returns {string} filename
*/
- filename: data =>
+ filename: (data) =>
`${data.chunk.name + data.chunk.name + data.chunk.name}.js`
}
},
@@ -23,11 +23,11 @@ module.exports = {
* @param {PathData} data data
* @returns {string} filename
*/
- filename: data => `${data.chunk.name + data.chunk.name}.js`,
+ filename: (data) => `${data.chunk.name + data.chunk.name}.js`,
/**
* @param {PathData} data data
* @returns {string} filename
*/
- chunkFilename: data => `${data.chunk.name + data.chunk.name}.js`
+ chunkFilename: (data) => `${data.chunk.name + data.chunk.name}.js`
}
};
diff --git a/test/configCases/finish-modules/simple/webpack.config.js b/test/configCases/finish-modules/simple/webpack.config.js
index dda9d6f10..0b4b1decf 100644
--- a/test/configCases/finish-modules/simple/webpack.config.js
+++ b/test/configCases/finish-modules/simple/webpack.config.js
@@ -4,7 +4,7 @@
* @this {import("../../../../").Compiler} the compiler
*/
function testPlugin() {
- this.hooks.compilation.tap("TestPlugin", compilation => {
+ this.hooks.compilation.tap("TestPlugin", (compilation) => {
compilation.hooks.finishModules.tapAsync(
"TestPlugin",
(_modules, callback) => {
diff --git a/test/configCases/hash-length/output-filename/test.config.js b/test/configCases/hash-length/output-filename/test.config.js
index c395e88b2..5b50bd070 100644
--- a/test/configCases/hash-length/output-filename/test.config.js
+++ b/test/configCases/hash-length/output-filename/test.config.js
@@ -3,7 +3,7 @@
const fs = require("fs");
const findFile = (files, regex) =>
- files.find(file => {
+ files.find((file) => {
if (regex.test(file)) {
return true;
}
diff --git a/test/configCases/issues/issue-3596/webpack.config.js b/test/configCases/issues/issue-3596/webpack.config.js
index cedab8509..6f82711b3 100644
--- a/test/configCases/issues/issue-3596/webpack.config.js
+++ b/test/configCases/issues/issue-3596/webpack.config.js
@@ -11,7 +11,7 @@ module.exports = {
},
plugins: [
function apply() {
- this.hooks.compilation.tap("TestPlugin", compilation => {
+ this.hooks.compilation.tap("TestPlugin", (compilation) => {
compilation.hooks.processAssets.tap("TestPlugin", () => {
delete compilation.assets["b.js"];
});
diff --git a/test/configCases/issues/issue-7563/test.config.js b/test/configCases/issues/issue-7563/test.config.js
index b7d31a34e..b8044de7c 100644
--- a/test/configCases/issues/issue-7563/test.config.js
+++ b/test/configCases/issues/issue-7563/test.config.js
@@ -7,7 +7,7 @@ module.exports = {
findBundle(i, options) {
const regex = new RegExp(`^bundle.${options.name}`, "i");
const files = fs.readdirSync(options.output.path);
- const bundle = files.find(file => regex.test(file));
+ const bundle = files.find((file) => regex.test(file));
if (!bundle) {
throw new Error(
diff --git a/test/configCases/layer/define-multiple-entries/webpack.config.js b/test/configCases/layer/define-multiple-entries/webpack.config.js
index 3f811347d..a609acadc 100644
--- a/test/configCases/layer/define-multiple-entries/webpack.config.js
+++ b/test/configCases/layer/define-multiple-entries/webpack.config.js
@@ -32,7 +32,7 @@ module.exports = {
plugins: [
new DefinePlugin({
FREE_VERSION: DefinePlugin.runtimeValue(
- ctx => ctx.module.layer === "free"
+ (ctx) => ctx.module.layer === "free"
)
})
]
diff --git a/test/configCases/layer/define-single-entry/webpack.config.js b/test/configCases/layer/define-single-entry/webpack.config.js
index 72d532eb4..6d7f8802a 100644
--- a/test/configCases/layer/define-single-entry/webpack.config.js
+++ b/test/configCases/layer/define-single-entry/webpack.config.js
@@ -30,7 +30,7 @@ module.exports = {
plugins: [
new DefinePlugin({
FREE_VERSION: DefinePlugin.runtimeValue(
- ctx => ctx.module.layer === "free"
+ (ctx) => ctx.module.layer === "free"
)
})
]
diff --git a/test/configCases/layer/rules/webpack.config.js b/test/configCases/layer/rules/webpack.config.js
index 41dd12643..46fd920a1 100644
--- a/test/configCases/layer/rules/webpack.config.js
+++ b/test/configCases/layer/rules/webpack.config.js
@@ -65,7 +65,7 @@ module.exports = {
},
{
external2: "var 42",
- byLayer: layer => {
+ byLayer: (layer) => {
if (layer === "layer") {
return {
external2: "var 43"
diff --git a/test/configCases/library/0-create-library/webpack.config.js b/test/configCases/library/0-create-library/webpack.config.js
index 13d9f9db0..e406cdc41 100644
--- a/test/configCases/library/0-create-library/webpack.config.js
+++ b/test/configCases/library/0-create-library/webpack.config.js
@@ -429,7 +429,7 @@ module.exports = (env, { testPath }) => [
"external-named": "./non-external-named"
}
},
- ignoreWarnings: [error => error.name === "FalseIIFEUmdWarning"]
+ ignoreWarnings: [(error) => error.name === "FalseIIFEUmdWarning"]
},
{
output: {
@@ -446,7 +446,7 @@ module.exports = (env, { testPath }) => [
"external-named": "./non-external-named"
}
},
- ignoreWarnings: [error => error.name === "FalseIIFEUmdWarning"]
+ ignoreWarnings: [(error) => error.name === "FalseIIFEUmdWarning"]
},
{
output: {
diff --git a/test/configCases/library/1-use-library/test.config.js b/test/configCases/library/1-use-library/test.config.js
index dcbe73872..a24102c43 100644
--- a/test/configCases/library/1-use-library/test.config.js
+++ b/test/configCases/library/1-use-library/test.config.js
@@ -2,7 +2,7 @@
module.exports = {
moduleScope(scope) {
- scope.define = factory => {
+ scope.define = (factory) => {
scope.module.exports = factory();
};
},
diff --git a/test/configCases/library/1-use-library/webpack.config.js b/test/configCases/library/1-use-library/webpack.config.js
index e28b8c106..a54358c14 100644
--- a/test/configCases/library/1-use-library/webpack.config.js
+++ b/test/configCases/library/1-use-library/webpack.config.js
@@ -31,8 +31,8 @@ module.exports = (env, { testPath }) => [
* @param {Compilation} compilation compilation
* @returns {void}
*/
- const handler = compilation => {
- compilation.hooks.afterProcessAssets.tap("testcase", assets => {
+ const handler = (compilation) => {
+ compilation.hooks.afterProcessAssets.tap("testcase", (assets) => {
for (const asset of Object.keys(assets)) {
const source = assets[asset].source();
expect(source).not.toContain('"a"');
diff --git a/test/configCases/library/disable-provided-export/webpack.config.js b/test/configCases/library/disable-provided-export/webpack.config.js
index d78d32fa2..1575a3337 100644
--- a/test/configCases/library/disable-provided-export/webpack.config.js
+++ b/test/configCases/library/disable-provided-export/webpack.config.js
@@ -75,7 +75,7 @@ module.exports = [
() => {
expect(
compiler.hooks.compilation.taps.filter(
- tap => tap.name === "FlagDependencyExportsPlugin"
+ (tap) => tap.name === "FlagDependencyExportsPlugin"
)
).toHaveLength(1);
}
diff --git a/test/configCases/library/module-reexport-external/webpack.config.js b/test/configCases/library/module-reexport-external/webpack.config.js
index 0c8aabde2..80bef5274 100644
--- a/test/configCases/library/module-reexport-external/webpack.config.js
+++ b/test/configCases/library/module-reexport-external/webpack.config.js
@@ -30,8 +30,8 @@ module.exports = {
/**
* @param {Compilation} compilation compilation
*/
- const handler = compilation => {
- compilation.hooks.afterProcessAssets.tap("testcase", assets => {
+ const handler = (compilation) => {
+ compilation.hooks.afterProcessAssets.tap("testcase", (assets) => {
const source = assets["test.js"].source();
expect(source).toContain("export const value");
});
diff --git a/test/configCases/library/module-reexport-type/webpack.config.js b/test/configCases/library/module-reexport-type/webpack.config.js
index 8954135f8..3d1d555d3 100644
--- a/test/configCases/library/module-reexport-type/webpack.config.js
+++ b/test/configCases/library/module-reexport-type/webpack.config.js
@@ -7,7 +7,7 @@ module.exports = {
mode: "none",
entry: { main: "./index.ts" },
ignoreWarnings: [
- warning => {
+ (warning) => {
// when using swc-loader or `transpileOnly: true` with ts-loader, the warning is expected
expect(warning.message).toContain(
"export 'T' (reexported as 'T') was not found in './re-export' (possible exports: value)"
@@ -51,8 +51,8 @@ module.exports = {
/**
* @param {Compilation} compilation compilation
*/
- const handler = compilation => {
- compilation.hooks.afterProcessAssets.tap("testcase", assets => {
+ const handler = (compilation) => {
+ compilation.hooks.afterProcessAssets.tap("testcase", (assets) => {
const source = assets["bundle0.mjs"].source();
expect(source).toContain(
"export { file_namespaceObject as logo, value };"
diff --git a/test/configCases/loader-import-module/css/webpack.config.js b/test/configCases/loader-import-module/css/webpack.config.js
index cdee8c284..896a19a6f 100644
--- a/test/configCases/loader-import-module/css/webpack.config.js
+++ b/test/configCases/loader-import-module/css/webpack.config.js
@@ -49,8 +49,8 @@ module.exports = {
]
},
plugins: [
- compiler =>
- compiler.hooks.done.tap("test case", stats => {
+ (compiler) =>
+ compiler.hooks.done.tap("test case", (stats) => {
try {
expect(stats.compilation.getAsset("assets/file.png")).toHaveProperty(
"info",
diff --git a/test/configCases/mangle/mangle-with-destructuring-assignment/webpack.config.js b/test/configCases/mangle/mangle-with-destructuring-assignment/webpack.config.js
index 083f7913a..251afe9f7 100644
--- a/test/configCases/mangle/mangle-with-destructuring-assignment/webpack.config.js
+++ b/test/configCases/mangle/mangle-with-destructuring-assignment/webpack.config.js
@@ -22,7 +22,7 @@ module.exports = {
function getJsonCodeGeneratedSource(compiler) {
compiler.hooks.compilation.tap(
getJsonCodeGeneratedSource.name,
- compilation => {
+ (compilation) => {
compilation.hooks.processAssets.tap(
getJsonCodeGeneratedSource.name,
() => {
diff --git a/test/configCases/module/check-defaults/test.filter.js b/test/configCases/module/check-defaults/test.filter.js
index a0e90a191..96ddb2717 100644
--- a/test/configCases/module/check-defaults/test.filter.js
+++ b/test/configCases/module/check-defaults/test.filter.js
@@ -1,3 +1,3 @@
"use strict";
-module.exports = config => !config.cache;
+module.exports = (config) => !config.cache;
diff --git a/test/configCases/module/circular-externals/webpack.config.js b/test/configCases/module/circular-externals/webpack.config.js
index afe834ef6..beb34577a 100644
--- a/test/configCases/module/circular-externals/webpack.config.js
+++ b/test/configCases/module/circular-externals/webpack.config.js
@@ -30,7 +30,7 @@ module.exports = {
apply(compiler) {
compiler.hooks.thisCompilation.tap(
"copy-external-files",
- compilation => {
+ (compilation) => {
compilation.hooks.processAssets.tap(
{
name: "copy-external-files",
diff --git a/test/configCases/module/non-webpack-require/webpack.config.js b/test/configCases/module/non-webpack-require/webpack.config.js
index 3a6d55cf9..715f62d98 100644
--- a/test/configCases/module/non-webpack-require/webpack.config.js
+++ b/test/configCases/module/non-webpack-require/webpack.config.js
@@ -22,7 +22,7 @@ module.exports = {
plugins: [
{
apply(compiler) {
- compiler.hooks.compilation.tap("Test", compilation => {
+ compiler.hooks.compilation.tap("Test", (compilation) => {
compilation.hooks.processAssets.tap(
{
name: "copy-webpack-plugin",
diff --git a/test/configCases/output/function/webpack.config.js b/test/configCases/output/function/webpack.config.js
index fa6bf5597..c1b6ec86a 100644
--- a/test/configCases/output/function/webpack.config.js
+++ b/test/configCases/output/function/webpack.config.js
@@ -11,7 +11,7 @@ module.exports = {
};
},
output: {
- filename: data =>
+ filename: (data) =>
/** @type {Chunk} */
(data.chunk).name === "a"
? `${/** @type {Chunk} */ (data.chunk).name}.js`
diff --git a/test/configCases/output/publicPath-web/webpack.config.js b/test/configCases/output/publicPath-web/webpack.config.js
index 4420c7b70..ef6e2ab0b 100644
--- a/test/configCases/output/publicPath-web/webpack.config.js
+++ b/test/configCases/output/publicPath-web/webpack.config.js
@@ -21,7 +21,7 @@ module.exports = {
};
},
output: {
- filename: data =>
+ filename: (data) =>
/^[ac]$/.test(
/** @type {string} */ (
/** @type {Chunk} */
diff --git a/test/configCases/parsing/dead-code-elimination/webpack.config.js b/test/configCases/parsing/dead-code-elimination/webpack.config.js
index e171abc51..213510c47 100644
--- a/test/configCases/parsing/dead-code-elimination/webpack.config.js
+++ b/test/configCases/parsing/dead-code-elimination/webpack.config.js
@@ -25,7 +25,7 @@ module.exports = [
plugins: [
{
apply(compiler) {
- compiler.hooks.compilation.tap("Test", compilation => {
+ compiler.hooks.compilation.tap("Test", (compilation) => {
compilation.hooks.processAssets.tap(
{
name: "copy-webpack-plugin",
diff --git a/test/configCases/plugins/mini-css-extract-plugin/webpack.config.js b/test/configCases/plugins/mini-css-extract-plugin/webpack.config.js
index 8505b5baa..b4b704c22 100644
--- a/test/configCases/plugins/mini-css-extract-plugin/webpack.config.js
+++ b/test/configCases/plugins/mini-css-extract-plugin/webpack.config.js
@@ -39,12 +39,12 @@ const config = (i, options) => ({
},
plugins: [
new MCEP(options),
- compiler => {
- compiler.hooks.done.tap("Test", stats => {
+ (compiler) => {
+ compiler.hooks.done.tap("Test", (stats) => {
const chunkIds =
/** @type {NonNullable} */
(stats.toJson({ all: false, chunks: true, ids: true }).chunks)
- .map(c => c.id)
+ .map((c) => c.id)
.sort();
expect(chunkIds).toEqual([
"a",
diff --git a/test/configCases/plugins/progress-plugin/webpack.config.js b/test/configCases/plugins/progress-plugin/webpack.config.js
index 32e252d18..0f0633cf5 100644
--- a/test/configCases/plugins/progress-plugin/webpack.config.js
+++ b/test/configCases/plugins/progress-plugin/webpack.config.js
@@ -16,8 +16,8 @@ module.exports = {
data.push(messages.join("|"));
}),
{
- apply: compiler => {
- compiler.hooks.compilation.tap("CustomPlugin", compilation => {
+ apply: (compiler) => {
+ compiler.hooks.compilation.tap("CustomPlugin", (compilation) => {
compilation.hooks.optimize.tap("CustomPlugin", () => {
const reportProgress =
/** @type {NonNullable>} */
diff --git a/test/configCases/plugins/virtual-url-plugin/webpack.config.js b/test/configCases/plugins/virtual-url-plugin/webpack.config.js
index 2198f4fdf..e5dd99bf2 100644
--- a/test/configCases/plugins/virtual-url-plugin/webpack.config.js
+++ b/test/configCases/plugins/virtual-url-plugin/webpack.config.js
@@ -16,7 +16,7 @@ const config = {
const files = fs.readdirSync(watchDir);
return `
export const routes = {
- ${files.map(key => `${key.split(".")[0]}: () => import('./routes/${key}')`).join(",\n")}
+ ${files.map((key) => `${key.split(".")[0]}: () => import('./routes/${key}')`).join(",\n")}
}
`;
},
diff --git a/test/configCases/process-assets/html-plugin/webpack.config.js b/test/configCases/process-assets/html-plugin/webpack.config.js
index 0d65460f0..b8cb54806 100644
--- a/test/configCases/process-assets/html-plugin/webpack.config.js
+++ b/test/configCases/process-assets/html-plugin/webpack.config.js
@@ -26,7 +26,7 @@ class VerifyAdditionalAssetsPlugin {
apply(compiler) {
compiler.hooks.compilation.tap(
"VerifyAdditionalAssetsPlugin",
- compilation => {
+ (compilation) => {
const alreadySeenAssets = new Set();
compilation.hooks.processAssets.tap(
{
@@ -34,7 +34,7 @@ class VerifyAdditionalAssetsPlugin {
stage: this.stage,
additionalAssets: true
},
- assets => {
+ (assets) => {
for (const asset of Object.keys(assets)) {
expect(alreadySeenAssets).not.toContain(asset);
alreadySeenAssets.add(asset);
@@ -58,7 +58,7 @@ class HtmlPlugin {
* @param {Compiler} compiler compiler
*/
apply(compiler) {
- compiler.hooks.compilation.tap("html-plugin", compilation => {
+ compiler.hooks.compilation.tap("html-plugin", (compilation) => {
compilation.hooks.processAssets.tap(
{
name: "html-plugin",
@@ -78,19 +78,19 @@ class HtmlPlugin {
* @param {string} file file
* @returns {string} content of script tag
*/
- const toScriptTag = file => {
+ const toScriptTag = (file) => {
const asset = /** @type {Asset} */ (compilation.getAsset(file));
const hash = createHash("sha512");
hash.update(asset.source.source());
const integrity = `sha512-${hash.digest("base64")}`;
compilation.updateAsset(
file,
- x => x,
+ (x) => x,
/**
* @param {AssetInfo} assetInfo asset info
* @returns {AssetInfo} new asset info
*/
- assetInfo => ({
+ (assetInfo) => ({
...assetInfo,
contenthash: Array.isArray(assetInfo.contenthash)
? [...new Set([...assetInfo.contenthash, integrity])]
@@ -108,7 +108,7 @@ class HtmlPlugin {
new OriginalSource(
`
-${files.map(file => ` ${toScriptTag(file)}`).join("\n")}
+${files.map((file) => ` ${toScriptTag(file)}`).join("\n")}
`,
"index.html"
@@ -132,14 +132,14 @@ class HtmlInlinePlugin {
* @param {Compiler} compiler compiler
*/
apply(compiler) {
- compiler.hooks.compilation.tap("html-inline-plugin", compilation => {
+ compiler.hooks.compilation.tap("html-inline-plugin", (compilation) => {
compilation.hooks.processAssets.tap(
{
name: "html-inline-plugin",
stage: Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE,
additionalAssets: true
},
- assets => {
+ (assets) => {
const publicPath =
/** @type {string} */
(compilation.outputOptions.publicPath);
@@ -193,7 +193,7 @@ class SriHashSupportPlugin {
* @param {Compiler} compiler compiler
*/
apply(compiler) {
- compiler.hooks.compilation.tap("sri-hash-support-plugin", compilation => {
+ compiler.hooks.compilation.tap("sri-hash-support-plugin", (compilation) => {
RealContentHashPlugin.getCompilationHooks(compilation).updateHash.tap(
"sri-hash-support-plugin",
(input, oldHash) => {
@@ -213,24 +213,24 @@ class HtmlMinimizePlugin {
* @param {Compiler} compiler compiler
*/
apply(compiler) {
- compiler.hooks.compilation.tap("html-minimize-plugin", compilation => {
+ compiler.hooks.compilation.tap("html-minimize-plugin", (compilation) => {
compilation.hooks.processAssets.tap(
{
name: "html-minimize-plugin",
stage: Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE,
additionalAssets: true
},
- assets => {
+ (assets) => {
for (const name of Object.keys(assets)) {
if (/\.html$/.test(name)) {
compilation.updateAsset(
name,
- source =>
+ (source) =>
new RawSource(
/** @type {string} */
(source.source()).replace(/\s+/g, " ")
),
- assetInfo => ({
+ (assetInfo) => ({
...assetInfo,
minimized: true
})
diff --git a/test/configCases/process-assets/update-info/webpack.config.js b/test/configCases/process-assets/update-info/webpack.config.js
index 25dd27d5e..8704cf675 100644
--- a/test/configCases/process-assets/update-info/webpack.config.js
+++ b/test/configCases/process-assets/update-info/webpack.config.js
@@ -9,14 +9,14 @@ module.exports = {
},
plugins: [
{
- apply: compiler => {
- compiler.hooks.compilation.tap("TestPlugin", compilation => {
+ apply: (compiler) => {
+ compiler.hooks.compilation.tap("TestPlugin", (compilation) => {
compilation.hooks.processAssets.tap(
{
name: "TestPlugin",
additionalAssets: true
},
- assets => {
+ (assets) => {
for (const asset of Object.keys(assets)) {
switch (asset) {
case "images/file.svg": {
@@ -24,7 +24,7 @@ module.exports = {
custom: true,
related: { first: ["first"] }
});
- compilation.updateAsset(asset, assets[asset], info => ({
+ compilation.updateAsset(asset, assets[asset], (info) => ({
...info,
related: {
.../** @type {{ related: Record }} */ (
diff --git a/test/configCases/rebuild/finishModules/webpack.config.js b/test/configCases/rebuild/finishModules/webpack.config.js
index 738e06f1c..fd5c08344 100644
--- a/test/configCases/rebuild/finishModules/webpack.config.js
+++ b/test/configCases/rebuild/finishModules/webpack.config.js
@@ -10,12 +10,12 @@ const { NormalModule } = require("../../../../");
/**
* @param {import("../../../../").Compiler} compiler the compiler
*/
-const testPlugin = compiler => {
- compiler.hooks.compilation.tap("TestPlugin", compilation => {
+const testPlugin = (compiler) => {
+ compiler.hooks.compilation.tap("TestPlugin", (compilation) => {
let shouldReplace = false;
NormalModule.getCompilationHooks(compilation).loader.tap(
"TestPlugin",
- loaderContext => {
+ (loaderContext) => {
/** @type {EXPECTED_ANY} */
(loaderContext).shouldReplace = shouldReplace;
}
@@ -52,7 +52,7 @@ const testPlugin = compiler => {
}
shouldReplace = true;
- compilation.rebuildModule(module, err => {
+ compilation.rebuildModule(module, (err) => {
shouldReplace = false;
callback(err);
});
diff --git a/test/configCases/rebuild/rebuildWithNewDependencies/webpack.config.js b/test/configCases/rebuild/rebuildWithNewDependencies/webpack.config.js
index 675026ca4..bf6344543 100644
--- a/test/configCases/rebuild/rebuildWithNewDependencies/webpack.config.js
+++ b/test/configCases/rebuild/rebuildWithNewDependencies/webpack.config.js
@@ -8,12 +8,12 @@ const { NormalModule } = require("../../../../");
/**
* @param {import("../../../../").Compiler} compiler the compiler
*/
-const testPlugin = compiler => {
- compiler.hooks.compilation.tap("TestPlugin", compilation => {
+const testPlugin = (compiler) => {
+ compiler.hooks.compilation.tap("TestPlugin", (compilation) => {
let shouldReplace = false;
NormalModule.getCompilationHooks(compilation).loader.tap(
"TestPlugin",
- loaderContext => {
+ (loaderContext) => {
/** @type {EXPECTED_ANY} */
(loaderContext).shouldReplace = shouldReplace;
}
@@ -50,7 +50,7 @@ const testPlugin = compiler => {
}
shouldReplace = true;
- compilation.rebuildModule(module, err => {
+ compilation.rebuildModule(module, (err) => {
shouldReplace = false;
callback(err);
});
diff --git a/test/configCases/resolving/prefer-absolute/webpack.config.js b/test/configCases/resolving/prefer-absolute/webpack.config.js
index ce6c32af7..53fd23234 100644
--- a/test/configCases/resolving/prefer-absolute/webpack.config.js
+++ b/test/configCases/resolving/prefer-absolute/webpack.config.js
@@ -20,7 +20,7 @@ module.exports = {
* @param {Resolver & { hooks: { file: SyncBailHook<[ResolveRequest, ResolveContext], void> } }} resolver resolver
*/
apply(resolver) {
- resolver.hooks.file.tap("Test", request => {
+ resolver.hooks.file.tap("Test", (request) => {
if (
/test.configCases.*test.configCases/.test(
/** @type {string} */
diff --git a/test/configCases/resolving/prefer-root/webpack.config.js b/test/configCases/resolving/prefer-root/webpack.config.js
index d4f006fe6..363f998c5 100644
--- a/test/configCases/resolving/prefer-root/webpack.config.js
+++ b/test/configCases/resolving/prefer-root/webpack.config.js
@@ -18,7 +18,7 @@ module.exports = {
* @param {Resolver & { hooks: { file: SyncBailHook<[ResolveRequest, ResolveContext], void> } }} resolver resolver
*/
apply(resolver) {
- resolver.hooks.file.tap("Test", request => {
+ resolver.hooks.file.tap("Test", (request) => {
if (request.path === "/index.js") {
throw new Error("Trying to resolve as absolute path");
}
diff --git a/test/configCases/rule-set/simple-use-fn-array/webpack.config.js b/test/configCases/rule-set/simple-use-fn-array/webpack.config.js
index 2f4fb0cfd..6713b5dbe 100644
--- a/test/configCases/rule-set/simple-use-fn-array/webpack.config.js
+++ b/test/configCases/rule-set/simple-use-fn-array/webpack.config.js
@@ -6,7 +6,7 @@
*/
function createFunctionArrayFromUseArray(useArray) {
return useArray.map(
- useItem =>
+ (useItem) =>
function fn() {
return useItem;
}
diff --git a/test/configCases/runtime/dynamic-nested-with-deep-entries-commonjs/webpack.config.js b/test/configCases/runtime/dynamic-nested-with-deep-entries-commonjs/webpack.config.js
index 7de81447f..57e2eeb16 100644
--- a/test/configCases/runtime/dynamic-nested-with-deep-entries-commonjs/webpack.config.js
+++ b/test/configCases/runtime/dynamic-nested-with-deep-entries-commonjs/webpack.config.js
@@ -16,7 +16,7 @@ module.exports = {
},
optimization: {
runtimeChunk: {
- name: entrypoint =>
+ name: (entrypoint) =>
`dir5/dir6/runtime~${entrypoint.name.split("/").pop()}`
}
}
diff --git a/test/configCases/runtime/dynamic-nested-with-deep-entries-esm/webpack.config.js b/test/configCases/runtime/dynamic-nested-with-deep-entries-esm/webpack.config.js
index 92dded63e..95b14621d 100644
--- a/test/configCases/runtime/dynamic-nested-with-deep-entries-esm/webpack.config.js
+++ b/test/configCases/runtime/dynamic-nested-with-deep-entries-esm/webpack.config.js
@@ -17,7 +17,7 @@ module.exports = {
},
optimization: {
runtimeChunk: {
- name: entrypoint =>
+ name: (entrypoint) =>
`dir5/dir6/runtime~${entrypoint.name.split("/").pop()}`
}
},
diff --git a/test/configCases/runtime/dynamic-with-deep-entries-commonjs/webpack.config.js b/test/configCases/runtime/dynamic-with-deep-entries-commonjs/webpack.config.js
index 1444e3be0..415ab9ef7 100644
--- a/test/configCases/runtime/dynamic-with-deep-entries-commonjs/webpack.config.js
+++ b/test/configCases/runtime/dynamic-with-deep-entries-commonjs/webpack.config.js
@@ -16,7 +16,7 @@ module.exports = {
},
optimization: {
runtimeChunk: {
- name: entrypoint => `runtime/${entrypoint.name.replace(/^\/+/g, "")}`
+ name: (entrypoint) => `runtime/${entrypoint.name.replace(/^\/+/g, "")}`
}
}
};
diff --git a/test/configCases/runtime/dynamic-with-deep-entries-esm/webpack.config.js b/test/configCases/runtime/dynamic-with-deep-entries-esm/webpack.config.js
index 95825edf4..4e6a39a8b 100644
--- a/test/configCases/runtime/dynamic-with-deep-entries-esm/webpack.config.js
+++ b/test/configCases/runtime/dynamic-with-deep-entries-esm/webpack.config.js
@@ -17,7 +17,7 @@ module.exports = {
},
optimization: {
runtimeChunk: {
- name: entrypoint => `runtime/${entrypoint.name.replace(/^\/+/g, "")}`
+ name: (entrypoint) => `runtime/${entrypoint.name.replace(/^\/+/g, "")}`
}
},
experiments: {
diff --git a/test/configCases/side-effects/side-effects-unsorted-modules/webpack.config.js b/test/configCases/side-effects/side-effects-unsorted-modules/webpack.config.js
index 62d7a93c2..776754b14 100644
--- a/test/configCases/side-effects/side-effects-unsorted-modules/webpack.config.js
+++ b/test/configCases/side-effects/side-effects-unsorted-modules/webpack.config.js
@@ -8,7 +8,7 @@ class ReorderModulesPlugin {
* @param {Compiler} compiler compiler
*/
apply(compiler) {
- compiler.hooks.compilation.tap("ReorderModulesPlugin", compilation => {
+ compiler.hooks.compilation.tap("ReorderModulesPlugin", (compilation) => {
compilation.hooks.seal.tap("ReorderModulesPlugin", () => {
const sortedModules = [...compilation.modules].sort((a, _b) =>
/** @type {NormalModule} */
diff --git a/test/configCases/source-map/no-source-map/webpack.config.js b/test/configCases/source-map/no-source-map/webpack.config.js
index e13df0733..67bfd694a 100644
--- a/test/configCases/source-map/no-source-map/webpack.config.js
+++ b/test/configCases/source-map/no-source-map/webpack.config.js
@@ -4,8 +4,8 @@
/** @type {WebpackPluginFunction[]} */
const plugins = [
- compiler => {
- compiler.hooks.emit.tap("Test", compilation => {
+ (compiler) => {
+ compiler.hooks.emit.tap("Test", (compilation) => {
for (const asset of compilation.getAssets()) {
const result = asset.source.sourceAndMap();
try {
diff --git a/test/configCases/split-chunks-common/target-node/webpack.config.js b/test/configCases/split-chunks-common/target-node/webpack.config.js
index 096d24296..eb0584ded 100644
--- a/test/configCases/split-chunks-common/target-node/webpack.config.js
+++ b/test/configCases/split-chunks-common/target-node/webpack.config.js
@@ -35,7 +35,7 @@ module.exports = [
defaultVendors: false,
vendors: {
test: /node_modules/,
- name: m => {
+ name: (m) => {
const match =
/** @type {string} */
(m.nameForCondition()).match(/([b-d]+)\.js$/);
diff --git a/test/configCases/split-chunks/custom-filename-function/webpack.config.js b/test/configCases/split-chunks/custom-filename-function/webpack.config.js
index 11448210b..49010b32a 100644
--- a/test/configCases/split-chunks/custom-filename-function/webpack.config.js
+++ b/test/configCases/split-chunks/custom-filename-function/webpack.config.js
@@ -9,7 +9,7 @@ module.exports = {
b: "./b"
},
output: {
- filename: data =>
+ filename: (data) =>
`${/** @type {Chunk} */ (data.chunk).name || /** @type {Chunk} */ (data.chunk).id}.js`,
libraryTarget: "commonjs2"
},
@@ -20,7 +20,7 @@ module.exports = {
shared: {
chunks: "all",
test: /shared/,
- filename: data =>
+ filename: (data) =>
`shared-${/** @type {Chunk} */ (data.chunk).name || /** @type {Chunk} */ (data.chunk).id}.js`,
enforce: true
},
diff --git a/test/configCases/split-chunks/runtime-chunk-no-async/test.config.js b/test/configCases/split-chunks/runtime-chunk-no-async/test.config.js
index bf34849b5..7381dcffa 100644
--- a/test/configCases/split-chunks/runtime-chunk-no-async/test.config.js
+++ b/test/configCases/split-chunks/runtime-chunk-no-async/test.config.js
@@ -5,6 +5,6 @@ const fs = require("fs");
module.exports = {
findBundle(i, options) {
const files = fs.readdirSync(options.output.path);
- return ["runtime.js", files.find(f => f.startsWith("main"))];
+ return ["runtime.js", files.find((f) => f.startsWith("main"))];
}
};
diff --git a/test/configCases/types/filesystems/webpack.config.js b/test/configCases/types/filesystems/webpack.config.js
index b525ea8a6..db6324733 100644
--- a/test/configCases/types/filesystems/webpack.config.js
+++ b/test/configCases/types/filesystems/webpack.config.js
@@ -6,7 +6,7 @@ const memfs = require("memfs");
/** @type {import("../../../../").Configuration} */
module.exports = {
plugins: [
- compiler => {
+ (compiler) => {
// eslint-disable-next-line no-warning-comments
// @ts-ignore
compiler.outputFileSystem = memfs.fs;
diff --git a/test/configCases/utils/lazy-set/webpack.config.js b/test/configCases/utils/lazy-set/webpack.config.js
index dc7c87f72..8f202cf8e 100644
--- a/test/configCases/utils/lazy-set/webpack.config.js
+++ b/test/configCases/utils/lazy-set/webpack.config.js
@@ -3,7 +3,7 @@
/** @type {import("../../../../").Configuration} */
module.exports = {
plugins: [
- compiler => {
+ (compiler) => {
compiler.hooks.done.tap("Test", ({ compilation }) => {
const items1 = [...compilation.fileDependencies];
const items2 = new Set(compilation.fileDependencies.keys());
@@ -19,7 +19,7 @@ module.exports = {
const items1Set = new Set(items1);
expect(items2).toEqual(items1Set);
expect(items3).toEqual(items1Set);
- expect(items4).toEqual(new Set(items1.map(x => [x, x])));
+ expect(items4).toEqual(new Set(items1.map((x) => [x, x])));
});
}
]
diff --git a/test/configCases/wasm/fetch/test.config.js b/test/configCases/wasm/fetch/test.config.js
index 443050989..5d01d9569 100644
--- a/test/configCases/wasm/fetch/test.config.js
+++ b/test/configCases/wasm/fetch/test.config.js
@@ -18,7 +18,7 @@ module.exports = {
}
},
moduleScope(scope, options) {
- scope.fetch = resource =>
+ scope.fetch = (resource) =>
new Promise((resolve, reject) => {
const file = /^file:/i.test(resource)
? url.fileURLToPath(resource)
diff --git a/test/configCases/wasm/identical/webpack.config.js b/test/configCases/wasm/identical/webpack.config.js
index 8042a8da6..8c81af56f 100644
--- a/test/configCases/wasm/identical/webpack.config.js
+++ b/test/configCases/wasm/identical/webpack.config.js
@@ -27,12 +27,12 @@ module.exports = {
* @this {Compiler} compiler
*/
function test() {
- this.hooks.compilation.tap("Test", compilation => {
+ this.hooks.compilation.tap("Test", (compilation) => {
AsyncWebAssemblyModulesPlugin.getCompilationHooks(
compilation
).renderModuleContent.tap(
"Test",
- source =>
+ (source) =>
// this is important to make each returned value a new instance
new CachedSource(source)
);
diff --git a/test/configCases/wasm/universal/test.config.js b/test/configCases/wasm/universal/test.config.js
index 1d22a7c2a..09adae703 100644
--- a/test/configCases/wasm/universal/test.config.js
+++ b/test/configCases/wasm/universal/test.config.js
@@ -10,7 +10,7 @@ module.exports = {
delete scope.document;
delete scope.self;
} else {
- scope.fetch = resource =>
+ scope.fetch = (resource) =>
new Promise((resolve, reject) => {
fs.readFile(url.fileURLToPath(resource), (err, data) => {
if (err) {
diff --git a/test/configCases/web/prefetch-preload-module-only-js/webpack.config.js b/test/configCases/web/prefetch-preload-module-only-js/webpack.config.js
index 42a723fe6..af281cf79 100644
--- a/test/configCases/web/prefetch-preload-module-only-js/webpack.config.js
+++ b/test/configCases/web/prefetch-preload-module-only-js/webpack.config.js
@@ -22,14 +22,14 @@ module.exports = {
plugins: [
{
apply(compiler) {
- compiler.hooks.compilation.tap("Test", compilation => {
+ compiler.hooks.compilation.tap("Test", (compilation) => {
compilation.hooks.processAssets.tap(
{
name: "Test",
stage:
compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE
},
- assets => {
+ (assets) => {
if (
assets["bundle0.mjs"]
.source()
diff --git a/test/configCases/worker/issue-17489/test.config.js b/test/configCases/worker/issue-17489/test.config.js
index ec8d736c2..43f179d66 100644
--- a/test/configCases/worker/issue-17489/test.config.js
+++ b/test/configCases/worker/issue-17489/test.config.js
@@ -12,7 +12,7 @@ module.exports = {
scope.AudioContext = class AudioContext {
constructor() {
this.audioWorklet = {
- addModule: url => Promise.resolve(FakeWorker.bind(null, url))
+ addModule: (url) => Promise.resolve(FakeWorker.bind(null, url))
};
}
};
diff --git a/test/configCases/worker/worklet/test.config.js b/test/configCases/worker/worklet/test.config.js
index cf0f40709..23fbd56e8 100644
--- a/test/configCases/worker/worklet/test.config.js
+++ b/test/configCases/worker/worklet/test.config.js
@@ -12,19 +12,19 @@ module.exports = {
scope.AudioContext = class AudioContext {
constructor() {
this.audioWorklet = {
- addModule: url => Promise.resolve(FakeWorker.bind(null, url))
+ addModule: (url) => Promise.resolve(FakeWorker.bind(null, url))
};
}
};
scope.CSS = {
paintWorklet: {
- addModule: url => Promise.resolve(FakeWorker.bind(null, url))
+ addModule: (url) => Promise.resolve(FakeWorker.bind(null, url))
},
layoutWorklet: {
- addModule: url => Promise.resolve(FakeWorker.bind(null, url))
+ addModule: (url) => Promise.resolve(FakeWorker.bind(null, url))
},
animationWorklet: {
- addModule: url => Promise.resolve(FakeWorker.bind(null, url))
+ addModule: (url) => Promise.resolve(FakeWorker.bind(null, url))
}
};
},
diff --git a/test/deterministicGrouping.unittest.js b/test/deterministicGrouping.unittest.js
index 86685f8a2..e91d65c48 100644
--- a/test/deterministicGrouping.unittest.js
+++ b/test/deterministicGrouping.unittest.js
@@ -10,7 +10,10 @@ describe("deterministicGrouping", () => {
maxSize,
getKey: ([key]) => `${100000 + key}`,
getSize: ([, size]) => size
- }).map(group => ({ items: group.items.map(([i]) => i), size: group.size }));
+ }).map((group) => ({
+ items: group.items.map(([i]) => i),
+ size: group.size
+ }));
it("should split large chunks with different size types", () => {
expect(
diff --git a/test/helpers/EventSourceForNode.js b/test/helpers/EventSourceForNode.js
index c9e21fdeb..a05f1e55c 100644
--- a/test/helpers/EventSourceForNode.js
+++ b/test/helpers/EventSourceForNode.js
@@ -17,14 +17,14 @@ module.exports = class EventSource {
rejectUnauthorized: false,
headers: { accept: "text/event-stream" }
},
- res => {
+ (res) => {
this.response = res;
- res.on("error", err => {
+ res.on("error", (err) => {
if (this.onerror) this.onerror(err);
});
}
);
- request.on("error", err => {
+ request.on("error", (err) => {
if (this.onerror) this.onerror({ message: err });
});
request.end();
diff --git a/test/helpers/FakeDocument.js b/test/helpers/FakeDocument.js
index 38ea9cacd..bad1d4e81 100644
--- a/test/helpers/FakeDocument.js
+++ b/test/helpers/FakeDocument.js
@@ -214,7 +214,7 @@ class FakeSheet {
let currentRule = { getPropertyValue };
let selector;
let last = 0;
- const processDeclaration = str => {
+ const processDeclaration = (str) => {
const colon = str.indexOf(":");
if (colon > 0) {
const property = str.slice(0, colon).trim();
diff --git a/test/helpers/LogTestPlugin.js b/test/helpers/LogTestPlugin.js
index 361115e41..18b80e102 100644
--- a/test/helpers/LogTestPlugin.js
+++ b/test/helpers/LogTestPlugin.js
@@ -18,7 +18,7 @@ module.exports = class LogTestPlugin {
/**
* @param {ReturnType} logger logger
*/
- const logSome = logger => {
+ const logSome = (logger) => {
logger.group("Group");
if (!this.noTraced) {
logger.error("Error");
@@ -38,7 +38,7 @@ module.exports = class LogTestPlugin {
logger.log("End");
};
logSome(compiler.getInfrastructureLogger("LogTestPlugin"));
- compiler.hooks.compilation.tap("LogTestPlugin", compilation => {
+ compiler.hooks.compilation.tap("LogTestPlugin", (compilation) => {
const logger = compilation.getLogger("LogTestPlugin");
logSome(logger);
diff --git a/test/helpers/PluginEnvironment.js b/test/helpers/PluginEnvironment.js
index b4286c8b3..2dbca35c9 100644
--- a/test/helpers/PluginEnvironment.js
+++ b/test/helpers/PluginEnvironment.js
@@ -24,7 +24,7 @@ module.exports = function PluginEnvironment() {
function getEventName(hookName) {
// Convert a hook name to an event name.
// e.g. `buildModule` -> `build-module`
- return hookName.replace(/[A-Z]/g, c => `-${c.toLowerCase()}`);
+ return hookName.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`);
}
this.getEnvironmentStub = function getEnvironmentStub() {
diff --git a/test/helpers/asModule.js b/test/helpers/asModule.js
index e3ae68421..bc974d781 100644
--- a/test/helpers/asModule.js
+++ b/test/helpers/asModule.js
@@ -15,7 +15,7 @@ module.exports = async (something, context, unlinked) => {
context[SYNTHETIC_MODULES_STORE].push(something);
const code = [...new Set(["default", ...Object.keys(something)])]
.map(
- name =>
+ (name) =>
`const _${name} = ${SYNTHETIC_MODULES_STORE}[${i}]${
name === "default" ? "" : `[${JSON.stringify(name)}]`
}; export { _${name} as ${name}};`
diff --git a/test/helpers/createFakeWorker.js b/test/helpers/createFakeWorker.js
index c7d58f193..52b0ec613 100644
--- a/test/helpers/createFakeWorker.js
+++ b/test/helpers/createFakeWorker.js
@@ -104,7 +104,7 @@ if (${options.type === "module"}) {
if (this._onmessage) this.worker.off("message", this._onmessage);
this.worker.on(
"message",
- (this._onmessage = data => {
+ (this._onmessage = (data) => {
value({
data
});
diff --git a/test/helpers/createLazyTestEnv.js b/test/helpers/createLazyTestEnv.js
index eed49f0aa..f538d852b 100644
--- a/test/helpers/createLazyTestEnv.js
+++ b/test/helpers/createLazyTestEnv.js
@@ -13,7 +13,7 @@ module.exports = (globalTimeout = 2000, nameSuffix = "") => {
if (!fn) return null;
const rfn =
fn.length >= 1
- ? done => {
+ ? (done) => {
fn((...args) => {
if (isTest) runTests++;
done(...args);
@@ -37,7 +37,7 @@ module.exports = (globalTimeout = 2000, nameSuffix = "") => {
it("should run the exported tests", () => {
runTests++;
});
- afterAll(done => {
+ afterAll((done) => {
for (const dispose of disposables) {
dispose();
}
@@ -48,7 +48,7 @@ module.exports = (globalTimeout = 2000, nameSuffix = "") => {
}
);
let numberOfTests = 0;
- const inSuite = fn => {
+ const inSuite = (fn) => {
const {
currentDescribeBlock: oldCurrentDescribeBlock,
currentlyRunningTest: oldCurrentlyRunningTest,
@@ -71,7 +71,7 @@ module.exports = (globalTimeout = 2000, nameSuffix = "") => {
state.currentlyRunningTest = oldCurrentlyRunningTest;
state.hasStarted = oldHasStarted;
};
- const fixAsyncError = block => {
+ const fixAsyncError = (block) => {
// By default jest leaks memory as it stores asyncError
// for each "it" call to track the origin test suite
// We want to evaluate this early here to avoid leaking memory
diff --git a/test/helpers/expectWarningFactory.js b/test/helpers/expectWarningFactory.js
index f3f858549..21522235f 100644
--- a/test/helpers/expectWarningFactory.js
+++ b/test/helpers/expectWarningFactory.js
@@ -4,20 +4,20 @@ module.exports = () => {
const warnings = [];
let oldWarn;
- beforeEach(done => {
+ beforeEach((done) => {
oldWarn = console.warn;
- console.warn = m => warnings.push(m);
+ console.warn = (m) => warnings.push(m);
done();
});
- afterEach(done => {
+ afterEach((done) => {
expectWarning();
console.warn = oldWarn;
done();
});
const expectWarning = (...regexp) => {
- expect(warnings).toEqual(regexp.map(r => expect.stringMatching(r)));
+ expect(warnings).toEqual(regexp.map((r) => expect.stringMatching(r)));
warnings.length = 0;
};
diff --git a/test/helpers/fakeSystem.js b/test/helpers/fakeSystem.js
index daa194583..0964685c7 100644
--- a/test/helpers/fakeSystem.js
+++ b/test/helpers/fakeSystem.js
@@ -14,7 +14,7 @@ const System = {
fn = deps;
deps = [];
}
- const dynamicExport = result => {
+ const dynamicExport = (result) => {
if (System.registry[name] !== entry) {
throw new Error(`Module ${name} calls dynamicExport too late`);
}
@@ -74,10 +74,10 @@ const System = {
registry: undefined,
_require: undefined,
_nextName: "(anonym)",
- setRequire: req => {
+ setRequire: (req) => {
System._require = req;
},
- init: modules => {
+ init: (modules) => {
System.registry = {};
if (modules) {
for (const name of Object.keys(modules)) {
@@ -88,13 +88,13 @@ const System = {
}
}
},
- execute: name => {
+ execute: (name) => {
const m = System.registry[name];
if (!m) throw new Error(`Module ${name} not registered`);
if (m.executed) throw new Error(`Module ${name} was already executed`);
return System.ensureExecuted(name);
},
- ensureExecuted: name => {
+ ensureExecuted: (name) => {
let m = System.registry[name];
if (!m && System._require) {
const oldName = System._nextName;
diff --git a/test/helpers/findOutputFiles.js b/test/helpers/findOutputFiles.js
index 4bbe2b01b..cae5037fc 100644
--- a/test/helpers/findOutputFiles.js
+++ b/test/helpers/findOutputFiles.js
@@ -14,5 +14,5 @@ module.exports = function findOutputFiles(options, regexp, subpath) {
subpath ? path.join(options.output.path, subpath) : options.output.path
);
- return files.filter(file => regexp.test(file));
+ return files.filter((file) => regexp.test(file));
};
diff --git a/test/helpers/prepareOptions.js b/test/helpers/prepareOptions.js
index 637f69d9c..f25929eff 100644
--- a/test/helpers/prepareOptions.js
+++ b/test/helpers/prepareOptions.js
@@ -1,6 +1,6 @@
"use strict";
-const handleExport = options => {
+const handleExport = (options) => {
const isES6DefaultExported =
typeof options === "object" &&
options !== null &&
@@ -22,7 +22,7 @@ module.exports = (options, argv) => {
options = handleExport(options);
options = Array.isArray(options)
- ? options.map(_options => handleFunction(_options, argv))
+ ? options.map((_options) => handleFunction(_options, argv))
: handleFunction(options, argv);
return options;
};
diff --git a/test/helpers/warmup-webpack.js b/test/helpers/warmup-webpack.js
index 53457807d..92942e72b 100644
--- a/test/helpers/warmup-webpack.js
+++ b/test/helpers/warmup-webpack.js
@@ -1,7 +1,7 @@
"use strict";
describe("warmup", () => {
- it("should warmup webpack", done => {
+ it("should warmup webpack", (done) => {
/** @type {typeof import("../../") | undefined} */
let webpack = require("../../");
@@ -10,13 +10,13 @@ describe("warmup", () => {
{
entry: "data:text/javascript,import 'data:text/javascript,'",
plugins: [
- c =>
+ (c) =>
c.hooks.emit.tap("Warmup", () => {
throw END;
})
]
},
- err => {
+ (err) => {
webpack = undefined;
try {
expect(err).toBe(END);
diff --git a/test/hotCases/css/imported-css/test.filter.js b/test/hotCases/css/imported-css/test.filter.js
index cb28cd46b..94e49e42d 100644
--- a/test/hotCases/css/imported-css/test.filter.js
+++ b/test/hotCases/css/imported-css/test.filter.js
@@ -1,3 +1,3 @@
"use strict";
-module.exports = config => config.target === "web";
+module.exports = (config) => config.target === "web";
diff --git a/test/hotCases/css/single-css-entry/test.filter.js b/test/hotCases/css/single-css-entry/test.filter.js
index cb28cd46b..94e49e42d 100644
--- a/test/hotCases/css/single-css-entry/test.filter.js
+++ b/test/hotCases/css/single-css-entry/test.filter.js
@@ -1,3 +1,3 @@
"use strict";
-module.exports = config => config.target === "web";
+module.exports = (config) => config.target === "web";
diff --git a/test/hotCases/css/single-css-entry/webpack.config.js b/test/hotCases/css/single-css-entry/webpack.config.js
index 8989ac114..37a9505b5 100644
--- a/test/hotCases/css/single-css-entry/webpack.config.js
+++ b/test/hotCases/css/single-css-entry/webpack.config.js
@@ -13,7 +13,7 @@ module.exports = {
plugins: [
{
apply(compiler) {
- compiler.hooks.compilation.tap("Test", compilation => {
+ compiler.hooks.compilation.tap("Test", (compilation) => {
compilation.hooks.additionalTreeRuntimeRequirements.tap(
"Test",
(module, set, _context) => {
diff --git a/test/hotCases/css/with-lazy-compilation/test.filter.js b/test/hotCases/css/with-lazy-compilation/test.filter.js
index cb28cd46b..94e49e42d 100644
--- a/test/hotCases/css/with-lazy-compilation/test.filter.js
+++ b/test/hotCases/css/with-lazy-compilation/test.filter.js
@@ -1,3 +1,3 @@
"use strict";
-module.exports = config => config.target === "web";
+module.exports = (config) => config.target === "web";
diff --git a/test/hotCases/lazy-compilation/module-test/webpack.config.js b/test/hotCases/lazy-compilation/module-test/webpack.config.js
index cae5d0692..d39a24d20 100644
--- a/test/hotCases/lazy-compilation/module-test/webpack.config.js
+++ b/test/hotCases/lazy-compilation/module-test/webpack.config.js
@@ -5,7 +5,7 @@ module.exports = {
experiments: {
lazyCompilation: {
entries: false,
- test: module =>
+ test: (module) =>
!/moduleB/.test(/** @type {string} */ (module.nameForCondition()))
}
}
diff --git a/test/hotCases/loader-import-module/css/webpack.config.js b/test/hotCases/loader-import-module/css/webpack.config.js
index 9b4a51b1d..9faedce41 100644
--- a/test/hotCases/loader-import-module/css/webpack.config.js
+++ b/test/hotCases/loader-import-module/css/webpack.config.js
@@ -23,8 +23,8 @@ module.exports = {
]
},
plugins: [
- compiler =>
- compiler.hooks.done.tap("test case", stats => {
+ (compiler) =>
+ compiler.hooks.done.tap("test case", (stats) => {
const png = stats.compilation.getAsset("assets/file.png");
const jpg = stats.compilation.getAsset("assets/file.jpg");
if (png) {
diff --git a/test/hotCases/recover/recover-after-css-loader-error/test.filter.js b/test/hotCases/recover/recover-after-css-loader-error/test.filter.js
index cb28cd46b..94e49e42d 100644
--- a/test/hotCases/recover/recover-after-css-loader-error/test.filter.js
+++ b/test/hotCases/recover/recover-after-css-loader-error/test.filter.js
@@ -1,3 +1,3 @@
"use strict";
-module.exports = config => config.target === "web";
+module.exports = (config) => config.target === "web";
diff --git a/test/hotCases/runtime/add-runtime/test.filter.js b/test/hotCases/runtime/add-runtime/test.filter.js
index 7cbaceb7f..6cca85b2e 100644
--- a/test/hotCases/runtime/add-runtime/test.filter.js
+++ b/test/hotCases/runtime/add-runtime/test.filter.js
@@ -2,7 +2,7 @@
const supportsWorker = require("../../../helpers/supportsWorker");
-module.exports = config => {
+module.exports = (config) => {
if (config.target !== "web") {
return false;
}
diff --git a/test/hotCases/worker/remove-add-worker/test.filter.js b/test/hotCases/worker/remove-add-worker/test.filter.js
index 91bee18f0..b12cf7ef5 100644
--- a/test/hotCases/worker/remove-add-worker/test.filter.js
+++ b/test/hotCases/worker/remove-add-worker/test.filter.js
@@ -2,4 +2,4 @@
const supportsWorker = require("../../../helpers/supportsWorker");
-module.exports = config => supportsWorker() && config.target !== "async-node";
+module.exports = (config) => supportsWorker() && config.target !== "async-node";
diff --git a/test/runner/index.js b/test/runner/index.js
index bba41a76a..b9f4e3bc6 100644
--- a/test/runner/index.js
+++ b/test/runner/index.js
@@ -10,7 +10,7 @@ const vm = require("vm");
* @param {string} path path
* @returns {string} subPath
*/
-const getSubPath = path => {
+const getSubPath = (path) => {
let subPath = "";
const lastSlash = path.lastIndexOf("/");
let firstSlash = path.indexOf("/");
@@ -34,7 +34,7 @@ const getSubPath = path => {
* @param {string} path path
* @returns {boolean} whether path is a relative path
*/
-const isRelativePath = path => /^\.\.?\//.test(path);
+const isRelativePath = (path) => /^\.\.?\//.test(path);
/**
* @param {string} url url
@@ -51,7 +51,7 @@ const urlToPath = (url, outputDirectory) => {
* @param {string} url url
* @returns {string} relative path
*/
-const urlToRelativePath = url => {
+const urlToRelativePath = (url) => {
if (url.startsWith("https://test.cases/path/")) url = url.slice(24);
else if (url.startsWith("https://test.cases/")) url = url.slice(19);
return `./${url}`;
@@ -191,7 +191,7 @@ class TestRunner {
console,
expect,
jest,
- nsObj: m => {
+ nsObj: (m) => {
Object.defineProperty(m, Symbol.toStringTag, {
value: "Module"
});
@@ -248,7 +248,7 @@ class TestRunner {
subPath: "",
modulePath: path.join(currentDirectory, ".array-require.js"),
content: `module.exports = (${module
- .map(arg => `require(${JSON.stringify(`./${arg}`)})`)
+ .map((arg) => `require(${JSON.stringify(`./${arg}`)})`)
.join(", ")});`
};
}
@@ -340,7 +340,7 @@ class TestRunner {
this.require.bind(this, path.dirname(modulePath)),
this.require
),
- importScripts: url => {
+ importScripts: (url) => {
expect(url).toMatch(/^https:\/\/test\.cases\/path\//);
this.require(this.outputDirectory, urlToRelativePath(url));
},
@@ -358,7 +358,7 @@ class TestRunner {
_content = `Object.assign(global, _globalAssign); ${content}`;
}
const args = Object.keys(moduleScope);
- const argValues = args.map(arg => moduleScope[arg]);
+ const argValues = args.map((arg) => moduleScope[arg]);
const code = `(function(${args.join(", ")}) {${_content}\n})`;
const document = this._moduleScope.document;
const fn = this._runInNewContext
@@ -484,14 +484,14 @@ class TestRunner {
* @returns {(moduleInfo: ModuleInfo, context: RequireContext) => EXPECTED_ANY} json runner
*/
createJSONRunner() {
- return moduleInfo => JSON.parse(moduleInfo.content);
+ return (moduleInfo) => JSON.parse(moduleInfo.content);
}
/**
* @returns {(moduleInfo: ModuleInfo, context: RequireContext) => EXPECTED_ANY} raw runner
*/
createRawRunner() {
- return moduleInfo => moduleInfo.content;
+ return (moduleInfo) => moduleInfo.content;
}
/**
@@ -507,11 +507,11 @@ class TestRunner {
const document = new FakeDocument(outputDirectory);
if (this.testConfig.evaluateScriptOnAttached) {
- document.onScript = src => {
+ document.onScript = (src) => {
this.require(outputDirectory, urlToRelativePath(src));
};
}
- const fetch = async url => {
+ const fetch = async (url) => {
try {
const buffer = await new Promise((resolve, reject) => {
fs.readFile(urlToPath(url, this.outputDirectory), (err, b) =>
diff --git a/test/setupTestFramework.js b/test/setupTestFramework.js
index 3a63c7579..df09512a7 100644
--- a/test/setupTestFramework.js
+++ b/test/setupTestFramework.js
@@ -72,7 +72,7 @@ if (process.env.ALTERNATIVE_SORT) {
// Setup debugging info for tests
if (process.env.DEBUG_INFO) {
- const addDebugInfo = it => (name, fn, timeout) => {
+ const addDebugInfo = (it) => (name, fn, timeout) => {
if (fn.length === 0) {
it(
name,
@@ -82,11 +82,11 @@ if (process.env.DEBUG_INFO) {
const promise = fn();
if (promise && promise.then) {
return promise.then(
- r => {
+ (r) => {
process.stdout.write(`DONE OK ${name}\n`);
return r;
},
- err => {
+ (err) => {
process.stdout.write(`DONE FAIL ${name}\n`);
throw err;
}
@@ -104,9 +104,9 @@ if (process.env.DEBUG_INFO) {
} else {
it(
name,
- done => {
+ (done) => {
process.stdout.write(`START2 ${name}\n`);
- return fn(err => {
+ return fn((err) => {
if (err) {
process.stdout.write(`DONE FAIL ${name}\n`);
} else {
diff --git a/test/statsCases/aggressive-splitting-entry/webpack.config.js b/test/statsCases/aggressive-splitting-entry/webpack.config.js
index b31164a00..3c8fdede5 100644
--- a/test/statsCases/aggressive-splitting-entry/webpack.config.js
+++ b/test/statsCases/aggressive-splitting-entry/webpack.config.js
@@ -4,7 +4,7 @@ const path = require("path");
const webpack = require("../../../");
/** @type {import("../../../").Configuration[]} */
-module.exports = ["fitting", "content-change"].map(type => ({
+module.exports = ["fitting", "content-change"].map((type) => ({
name: type,
mode: "production",
cache: true, // AggressiveSplittingPlugin rebuilds multiple times, we need to cache the assets
diff --git a/test/statsCases/async-commons-chunk-auto/webpack.config.js b/test/statsCases/async-commons-chunk-auto/webpack.config.js
index 79a9fda46..9e396791b 100644
--- a/test/statsCases/async-commons-chunk-auto/webpack.config.js
+++ b/test/statsCases/async-commons-chunk-auto/webpack.config.js
@@ -95,7 +95,7 @@ module.exports = [
minSize: 0, // enforce all
chunks: "all",
cacheGroups: {
- libs: module => {
+ libs: (module) => {
const name = module.nameForCondition();
if (!name) return;
const match = /[\\/](xyz|x)\.js/.exec(name);
diff --git a/test/statsCases/cause-error/webpack.config.js b/test/statsCases/cause-error/webpack.config.js
index 6518a665d..95b332988 100644
--- a/test/statsCases/cause-error/webpack.config.js
+++ b/test/statsCases/cause-error/webpack.config.js
@@ -73,8 +73,8 @@ module.exports = {
mode: "development",
entry: "./index.js",
plugins: [
- compiler => {
- compiler.hooks.compilation.tap("Test", compilation => {
+ (compiler) => {
+ compiler.hooks.compilation.tap("Test", (compilation) => {
const errCauseErr = createErrorWithCause("error with case", {
cause: new Error("error case")
});
diff --git a/test/statsCases/details-error/webpack.config.js b/test/statsCases/details-error/webpack.config.js
index c58a7e821..5bdc9fa63 100644
--- a/test/statsCases/details-error/webpack.config.js
+++ b/test/statsCases/details-error/webpack.config.js
@@ -3,7 +3,7 @@
const { WebpackError } = require("../../../");
/** @type {import("../../../").Configuration[]} */
-module.exports = [0, 1, 10, 2, 20, 11, 12, 13, 3, 30].map(n => ({
+module.exports = [0, 1, 10, 2, 20, 11, 12, 13, 3, 30].map((n) => ({
name: `${n % 10} errors ${(n / 10) | 0} warnings`,
mode: "development",
output: {
@@ -11,8 +11,8 @@ module.exports = [0, 1, 10, 2, 20, 11, 12, 13, 3, 30].map(n => ({
},
entry: "./index.js",
plugins: [
- compiler => {
- compiler.hooks.compilation.tap("Test", compilation => {
+ (compiler) => {
+ compiler.hooks.compilation.tap("Test", (compilation) => {
const err = new WebpackError("Test");
err.details = "Error details";
for (let i = n % 10; i > 0; i--) compilation.errors.push(err);
diff --git a/test/statsCases/ignore-warnings/webpack.config.js b/test/statsCases/ignore-warnings/webpack.config.js
index 8caa2264a..9324d4468 100644
--- a/test/statsCases/ignore-warnings/webpack.config.js
+++ b/test/statsCases/ignore-warnings/webpack.config.js
@@ -15,7 +15,7 @@ module.exports = {
message: /homepage/
},
/The 'mode' option has not been set/,
- warning =>
+ (warning) =>
/** @type {Module} */
(/** @type {WebpackError} */ (warning).module).identifier().endsWith("?2")
]
diff --git a/test/statsCases/limit-chunk-count-plugin/webpack.config.js b/test/statsCases/limit-chunk-count-plugin/webpack.config.js
index c392ba3a0..1cd9d5e6f 100644
--- a/test/statsCases/limit-chunk-count-plugin/webpack.config.js
+++ b/test/statsCases/limit-chunk-count-plugin/webpack.config.js
@@ -3,7 +3,7 @@
const webpack = require("../../../");
/** @type {import("../../../").Configuration[]} */
-module.exports = [1, 2, 3, 4].map(n => ({
+module.exports = [1, 2, 3, 4].map((n) => ({
name: `${n} chunks`,
mode: "production",
entry: "./index",
diff --git a/test/statsCases/real-content-hash/test.config.js b/test/statsCases/real-content-hash/test.config.js
index 793c811c9..55cbd0f04 100644
--- a/test/statsCases/real-content-hash/test.config.js
+++ b/test/statsCases/real-content-hash/test.config.js
@@ -5,8 +5,8 @@ const path = require("path");
const createHash = require("../../../lib/util/createHash");
const hashedFiles = {
- "file.jpg": a => a.name.endsWith(".jpg"),
- "file.png": a => a.name.endsWith(".png")
+ "file.jpg": (a) => a.name.endsWith(".jpg"),
+ "file.png": (a) => a.name.endsWith(".png")
};
module.exports = {
diff --git a/test/statsCases/related-assets/webpack.config.js b/test/statsCases/related-assets/webpack.config.js
index 2b964ee62..a73dad288 100644
--- a/test/statsCases/related-assets/webpack.config.js
+++ b/test/statsCases/related-assets/webpack.config.js
@@ -10,8 +10,8 @@ const { Compilation } = require("../../../");
* @param {string[]} exts extensions
* @returns {(compiler: Compiler) => void} callback for comperssion
*/
-const compression = exts => compiler => {
- compiler.hooks.thisCompilation.tap("Test", compilation => {
+const compression = (exts) => (compiler) => {
+ compiler.hooks.thisCompilation.tap("Test", (compilation) => {
compilation.hooks.processAssets.tap(
{
name: "Test",
@@ -41,7 +41,7 @@ const compression = exts => compiler => {
* @param {string} name name
* @returns {Configuration} configuration
*/
-const base = name => ({
+const base = (name) => ({
name,
mode: "development",
devtool: "source-map",
diff --git a/test/statsCases/split-chunks/webpack.config.js b/test/statsCases/split-chunks/webpack.config.js
index 92959f193..0a9be3137 100644
--- a/test/statsCases/split-chunks/webpack.config.js
+++ b/test/statsCases/split-chunks/webpack.config.js
@@ -120,7 +120,7 @@ module.exports = [
optimization: {
splitChunks: {
minSize: 0,
- chunks: chunk => chunk.name !== "a"
+ chunks: (chunk) => chunk.name !== "a"
}
},
stats
@@ -148,7 +148,7 @@ module.exports = [
test: /[\\/]node_modules[\\/]/,
name: "vendors",
enforce: true,
- chunks: chunk => chunk.name !== "a"
+ chunks: (chunk) => chunk.name !== "a"
}
}
}
diff --git a/test/walkCssTokens.unittest.js b/test/walkCssTokens.unittest.js
index 433570973..6cd3450cb 100644
--- a/test/walkCssTokens.unittest.js
+++ b/test/walkCssTokens.unittest.js
@@ -77,13 +77,13 @@ describe("walkCssTokens", () => {
const casesPath = path.resolve(__dirname, "./configCases/css/parsing/cases");
const tests = fs
.readdirSync(casesPath)
- .filter(test => /\.css/.test(test))
- .map(item => [
+ .filter((test) => /\.css/.test(test))
+ .map((item) => [
item,
fs.readFileSync(path.resolve(casesPath, item), "utf8")
]);
for (const [name, code] of tests) {
- test(name, code, e => e.toMatchSnapshot());
+ test(name, code, (e) => e.toMatchSnapshot());
}
});
diff --git a/test/watchCases/cache/add-defines/test.filter.js b/test/watchCases/cache/add-defines/test.filter.js
index 5995446f5..02701fcf4 100644
--- a/test/watchCases/cache/add-defines/test.filter.js
+++ b/test/watchCases/cache/add-defines/test.filter.js
@@ -1,4 +1,4 @@
"use strict";
-module.exports = config =>
+module.exports = (config) =>
!(config.experiments && config.experiments.cacheUnaffected);
diff --git a/test/watchCases/cache/add-defines/webpack.config.js b/test/watchCases/cache/add-defines/webpack.config.js
index 1bc91e317..ea24eef6b 100644
--- a/test/watchCases/cache/add-defines/webpack.config.js
+++ b/test/watchCases/cache/add-defines/webpack.config.js
@@ -12,7 +12,7 @@ module.exports = {
cacheUnaffected: false
},
plugins: [
- compiler => {
+ (compiler) => {
const base = {
DEFINE: "{}",
RUN: DefinePlugin.runtimeValue(
diff --git a/test/watchCases/cache/asset-concat/test.filter.js b/test/watchCases/cache/asset-concat/test.filter.js
index 5995446f5..02701fcf4 100644
--- a/test/watchCases/cache/asset-concat/test.filter.js
+++ b/test/watchCases/cache/asset-concat/test.filter.js
@@ -1,4 +1,4 @@
"use strict";
-module.exports = config =>
+module.exports = (config) =>
!(config.experiments && config.experiments.cacheUnaffected);
diff --git a/test/watchCases/cache/unsafe-cache-duplicates/webpack.config.js b/test/watchCases/cache/unsafe-cache-duplicates/webpack.config.js
index 563912d6a..a39dcc12a 100644
--- a/test/watchCases/cache/unsafe-cache-duplicates/webpack.config.js
+++ b/test/watchCases/cache/unsafe-cache-duplicates/webpack.config.js
@@ -13,17 +13,17 @@ module.exports = (env, { srcPath }) => ({
idleTimeout: 1
},
module: {
- unsafeCache: module =>
+ unsafeCache: (module) =>
/module\.js/.test(/** @type {NormalModule} */ (module).resource)
},
plugins: [
- compiler => {
+ (compiler) => {
compiler.cache.hooks.get.tap(
{
name: "webpack.config.js",
stage: -1000
},
- identifier => {
+ (identifier) => {
if (identifier.includes(path.join(srcPath, "module.js"))) {
return null;
}
diff --git a/test/watchCases/chunks/esm-async-chunks-hmr/webpack.config.js b/test/watchCases/chunks/esm-async-chunks-hmr/webpack.config.js
index 63b9e6ddb..e6f9663d7 100644
--- a/test/watchCases/chunks/esm-async-chunks-hmr/webpack.config.js
+++ b/test/watchCases/chunks/esm-async-chunks-hmr/webpack.config.js
@@ -23,7 +23,7 @@ module.exports = {
* @param {import("../../../../").Entrypoint} entrypoint The entrypoint to generate runtime chunk name for
* @returns {string} The generated runtime chunk name
*/
- name: entrypoint => `runtime-${entrypoint.name}`
+ name: (entrypoint) => `runtime-${entrypoint.name}`
}
},
output: {
diff --git a/test/watchCases/side-effects/issue-7400/test.filter.js b/test/watchCases/side-effects/issue-7400/test.filter.js
index 5995446f5..02701fcf4 100644
--- a/test/watchCases/side-effects/issue-7400/test.filter.js
+++ b/test/watchCases/side-effects/issue-7400/test.filter.js
@@ -1,4 +1,4 @@
"use strict";
-module.exports = config =>
+module.exports = (config) =>
!(config.experiments && config.experiments.cacheUnaffected);
diff --git a/tooling/generate-runtime-code.js b/tooling/generate-runtime-code.js
index 696e36536..2804c7ce2 100644
--- a/tooling/generate-runtime-code.js
+++ b/tooling/generate-runtime-code.js
@@ -85,7 +85,7 @@ exports.${name}RuntimeCode = runtimeTemplate => \`var ${name} = \${runtimeTempla
const prettierConfig = await prettier.resolveConfig(filePath);
const newContent = await prettier.format(
- content.replace(regexp, match => replaces.get(match)),
+ content.replace(regexp, (match) => replaces.get(match)),
{ filepath: filePath, ...prettierConfig }
);
diff --git a/tooling/generate-wasm-code.js b/tooling/generate-wasm-code.js
index 863f5789d..3aa5c9639 100644
--- a/tooling/generate-wasm-code.js
+++ b/tooling/generate-wasm-code.js
@@ -77,7 +77,7 @@ const ${identifier} = new WebAssembly.Module(
match = regexp.exec(content);
}
- const newContent = content.replace(regexp, match => replaces.get(match));
+ const newContent = content.replace(regexp, (match) => replaces.get(match));
if (newContent !== content) {
if (doWrite) {
diff --git a/tooling/print-cache-file.js b/tooling/print-cache-file.js
index e0c6bbd38..cd7389712 100644
--- a/tooling/print-cache-file.js
+++ b/tooling/print-cache-file.js
@@ -22,7 +22,7 @@ const lazySizes = [];
* @param {(Buffer | (() => Promise))[]} data data
* @returns {Promise} size info
*/
-const captureSize = async data => {
+const captureSize = async (data) => {
let size = 0;
let lazySize = 0;
for (const b of data) {
@@ -78,7 +78,7 @@ const printData = async (data, indent) => {
/**
* @param {string} content content
*/
- const printLine = content => {
+ const printLine = (content) => {
console.log(`${indent}${content}`);
};
printLine(`Version: ${read()}`);