webpack 5.100.2 → 5.101.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -10
- package/bin/webpack.js +7 -7
- package/lib/APIPlugin.js +12 -14
- package/lib/AutomaticPrefetchPlugin.js +2 -2
- package/lib/BannerPlugin.js +4 -4
- package/lib/Cache.js +1 -1
- package/lib/CacheFacade.js +7 -7
- package/lib/CaseSensitiveModulesWarning.js +2 -2
- package/lib/Chunk.js +3 -3
- package/lib/ChunkGraph.js +63 -18
- package/lib/ChunkGroup.js +4 -4
- package/lib/CleanPlugin.js +19 -53
- package/lib/CodeGenerationResults.js +3 -3
- package/lib/CompatibilityPlugin.js +6 -6
- package/lib/Compilation.js +168 -116
- package/lib/Compiler.js +37 -37
- package/lib/ConcatenationScope.js +39 -1
- package/lib/ConstPlugin.js +11 -11
- package/lib/ContextExclusionPlugin.js +3 -3
- package/lib/ContextModule.js +12 -11
- package/lib/ContextModuleFactory.js +11 -11
- package/lib/ContextReplacementPlugin.js +5 -5
- package/lib/DefinePlugin.js +24 -22
- package/lib/DelegatedModuleFactoryPlugin.js +1 -1
- package/lib/Dependency.js +2 -1
- package/lib/DllEntryPlugin.js +1 -1
- package/lib/DllReferencePlugin.js +1 -1
- package/lib/DynamicEntryPlugin.js +3 -3
- package/lib/EntryPlugin.js +1 -1
- package/lib/EnvironmentPlugin.js +1 -1
- package/lib/ErrorHelpers.js +2 -2
- package/lib/EvalDevToolModulePlugin.js +2 -2
- package/lib/EvalSourceMapDevToolPlugin.js +5 -5
- package/lib/ExportsInfo.js +9 -9
- package/lib/ExportsInfoApiPlugin.js +2 -2
- package/lib/ExternalModule.js +163 -48
- package/lib/ExternalModuleFactoryPlugin.js +2 -2
- package/lib/ExternalsPlugin.js +45 -0
- package/lib/FileSystemInfo.js +64 -61
- package/lib/FlagAllModulesAsUsedPlugin.js +2 -2
- package/lib/FlagDependencyExportsPlugin.js +7 -7
- package/lib/FlagDependencyUsagePlugin.js +4 -4
- package/lib/FlagEntryExportAsUsedPlugin.js +1 -1
- package/lib/HotModuleReplacementPlugin.js +27 -27
- package/lib/IgnorePlugin.js +3 -3
- package/lib/IgnoreWarningsPlugin.js +4 -4
- package/lib/InitFragment.js +6 -0
- package/lib/InvalidDependenciesModuleWarning.js +1 -1
- package/lib/JavascriptMetaInfoPlugin.js +1 -1
- package/lib/LibManifestPlugin.js +2 -2
- package/lib/LoaderOptionsPlugin.js +1 -1
- package/lib/LoaderTargetPlugin.js +2 -2
- package/lib/MainTemplate.js +1 -1
- package/lib/Module.js +3 -2
- package/lib/ModuleFilenameHelpers.js +3 -3
- package/lib/ModuleGraph.js +23 -38
- package/lib/ModuleInfoHeaderPlugin.js +3 -3
- package/lib/ModuleParseError.js +5 -3
- package/lib/ModuleTemplate.js +3 -2
- package/lib/MultiCompiler.js +29 -24
- package/lib/MultiStats.js +18 -13
- package/lib/MultiWatching.js +1 -1
- package/lib/NoEmitOnErrorsPlugin.js +2 -2
- package/lib/NodeStuffPlugin.js +27 -15
- package/lib/NormalModule.js +23 -23
- package/lib/NormalModuleFactory.js +23 -21
- package/lib/NormalModuleReplacementPlugin.js +3 -3
- package/lib/PrefetchPlugin.js +1 -1
- package/lib/ProgressPlugin.js +11 -11
- package/lib/ProvidePlugin.js +2 -2
- package/lib/RecordIdsPlugin.js +3 -3
- package/lib/ResolverFactory.js +3 -3
- package/lib/RuntimeGlobals.js +20 -0
- package/lib/RuntimePlugin.js +16 -16
- package/lib/RuntimeTemplate.js +35 -26
- package/lib/SizeFormatHelpers.js +1 -1
- package/lib/SourceMapDevToolModuleOptionsPlugin.js +4 -4
- package/lib/SourceMapDevToolPlugin.js +9 -9
- package/lib/Stats.js +2 -2
- package/lib/Template.js +1 -1
- package/lib/TemplatedPathPlugin.js +2 -2
- package/lib/UseStrictPlugin.js +1 -1
- package/lib/WarnCaseSensitiveModulesPlugin.js +1 -1
- package/lib/WarnDeprecatedOptionPlugin.js +1 -1
- package/lib/WarnNoModeSetPlugin.js +1 -1
- package/lib/WatchIgnorePlugin.js +2 -2
- package/lib/Watching.js +12 -14
- package/lib/WebpackIsIncludedPlugin.js +2 -2
- package/lib/WebpackOptionsApply.js +3 -3
- package/lib/asset/AssetGenerator.js +1 -1
- package/lib/asset/AssetModulesPlugin.js +6 -6
- package/lib/async-modules/AsyncModuleHelpers.js +1 -1
- package/lib/async-modules/AwaitDependenciesInitFragment.js +36 -24
- package/lib/async-modules/InferAsyncModulesPlugin.js +3 -3
- package/lib/buildChunkGraph.js +5 -5
- package/lib/cache/AddBuildDependenciesPlugin.js +1 -1
- package/lib/cache/IdleFileCachePlugin.js +5 -5
- package/lib/cache/PackFileCacheStrategy.js +20 -20
- package/lib/cache/ResolverCachePlugin.js +4 -4
- package/lib/cli.js +196 -14
- package/lib/config/browserslistTargetHandler.js +6 -6
- package/lib/config/defaults.js +23 -14
- package/lib/config/normalization.js +41 -38
- package/lib/config/target.js +4 -4
- package/lib/container/ContainerEntryModule.js +3 -3
- package/lib/container/ContainerPlugin.js +3 -3
- package/lib/container/ContainerReferencePlugin.js +3 -3
- package/lib/container/FallbackModule.js +1 -1
- package/lib/container/HoistContainerReferencesPlugin.js +7 -7
- package/lib/container/options.js +4 -4
- package/lib/css/CssGenerator.js +5 -3
- package/lib/css/CssLoadingRuntimeModule.js +1 -1
- package/lib/css/CssModulesPlugin.js +25 -22
- package/lib/css/CssParser.js +5 -5
- package/lib/css/walkCssTokens.js +9 -9
- package/lib/debug/ProfilingPlugin.js +5 -5
- package/lib/dependencies/AMDDefineDependencyParserPlugin.js +4 -4
- package/lib/dependencies/AMDPlugin.js +3 -3
- package/lib/dependencies/AMDRequireArrayDependency.js +1 -1
- package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +3 -3
- package/lib/dependencies/CommonJsExportRequireDependency.js +2 -2
- package/lib/dependencies/CommonJsExportsParserPlugin.js +12 -10
- package/lib/dependencies/CommonJsImportsParserPlugin.js +21 -19
- package/lib/dependencies/CommonJsPlugin.js +2 -2
- package/lib/dependencies/ContextDependency.js +1 -1
- package/lib/dependencies/ContextDependencyHelpers.js +3 -3
- package/lib/dependencies/CssIcssExportDependency.js +2 -2
- package/lib/dependencies/CssLocalIdentifierDependency.js +2 -2
- package/lib/dependencies/CssUrlDependency.js +4 -4
- package/lib/dependencies/DynamicExports.js +5 -5
- package/lib/dependencies/HarmonyAcceptDependency.js +91 -5
- package/lib/dependencies/HarmonyDetectionParserPlugin.js +2 -2
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +17 -13
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +7 -8
- package/lib/dependencies/HarmonyExportInitFragment.js +1 -1
- package/lib/dependencies/HarmonyExports.js +1 -1
- package/lib/dependencies/HarmonyImportDependency.js +28 -9
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +56 -48
- package/lib/dependencies/HarmonyImportSideEffectDependency.js +4 -5
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +3 -4
- package/lib/dependencies/HarmonyModulesPlugin.js +2 -8
- package/lib/dependencies/HarmonyTopLevelThisParserPlugin.js +1 -1
- package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +4 -4
- package/lib/dependencies/ImportMetaPlugin.js +7 -7
- package/lib/dependencies/ImportParserPlugin.js +4 -4
- package/lib/dependencies/JsonExportsDependency.js +7 -2
- package/lib/dependencies/LoaderPlugin.js +4 -4
- package/lib/dependencies/ModuleDependency.js +2 -1
- package/lib/dependencies/ProvidedDependency.js +2 -2
- package/lib/dependencies/PureExpressionDependency.js +1 -1
- package/lib/dependencies/RequireContextDependencyParserPlugin.js +1 -1
- package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +1 -1
- package/lib/dependencies/RequireIncludeDependencyParserPlugin.js +3 -3
- package/lib/dependencies/SystemPlugin.js +3 -3
- package/lib/dependencies/WorkerPlugin.js +5 -5
- package/lib/dependencies/getFunctionExpression.js +1 -1
- package/lib/esm/ExportWebpackRequireRuntimeModule.js +8 -1
- package/lib/esm/ModuleChunkFormatPlugin.js +35 -69
- package/lib/esm/ModuleChunkLoadingPlugin.js +3 -6
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +15 -11
- package/lib/formatLocation.js +2 -2
- package/lib/hmr/HotModuleReplacement.runtime.js +39 -27
- package/lib/hmr/JavascriptHotModuleReplacement.runtime.js +43 -32
- package/lib/hmr/JavascriptHotModuleReplacementHelper.js +1 -1
- package/lib/hmr/LazyCompilationPlugin.js +6 -6
- package/lib/hmr/lazyCompilationBackend.js +6 -6
- package/lib/ids/ChunkModuleIdRangePlugin.js +4 -4
- package/lib/ids/DeterministicChunkIdsPlugin.js +5 -4
- package/lib/ids/DeterministicModuleIdsPlugin.js +2 -2
- package/lib/ids/HashedModuleIdsPlugin.js +1 -1
- package/lib/ids/IdHelpers.js +9 -9
- package/lib/ids/NamedChunkIdsPlugin.js +5 -5
- package/lib/ids/NamedModuleIdsPlugin.js +2 -2
- package/lib/ids/NaturalChunkIdsPlugin.js +2 -2
- package/lib/ids/NaturalModuleIdsPlugin.js +1 -1
- package/lib/ids/OccurrenceChunkIdsPlugin.js +2 -2
- package/lib/ids/OccurrenceModuleIdsPlugin.js +4 -4
- package/lib/ids/SyncModuleIdsPlugin.js +4 -4
- package/lib/index.js +18 -6
- package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +1 -1
- package/lib/javascript/BasicEvaluatedExpression.js +3 -3
- package/lib/javascript/ChunkFormatHelpers.js +70 -0
- package/lib/javascript/CommonJsChunkFormatPlugin.js +10 -21
- package/lib/javascript/EnableChunkLoadingPlugin.js +1 -1
- package/lib/javascript/JavascriptGenerator.js +1 -1
- package/lib/javascript/JavascriptModulesPlugin.js +108 -54
- package/lib/javascript/JavascriptParser.js +80 -78
- package/lib/javascript/JavascriptParserHelpers.js +3 -3
- package/lib/javascript/StartupHelpers.js +2 -2
- package/lib/json/JsonGenerator.js +2 -2
- package/lib/json/JsonModulesPlugin.js +2 -2
- package/lib/library/AbstractLibraryPlugin.js +30 -3
- package/lib/library/AmdLibraryPlugin.js +3 -3
- package/lib/library/AssignLibraryPlugin.js +2 -2
- package/lib/library/EnableLibraryPlugin.js +2 -2
- package/lib/library/ModuleLibraryPlugin.js +49 -31
- package/lib/library/SystemLibraryPlugin.js +6 -4
- package/lib/library/UmdLibraryPlugin.js +14 -14
- package/lib/logging/createConsoleLogger.js +4 -4
- package/lib/logging/runtime.js +3 -3
- package/lib/logging/truncateArgs.js +4 -4
- package/lib/node/CommonJsChunkLoadingPlugin.js +2 -2
- package/lib/node/NodeEnvironmentPlugin.js +1 -1
- package/lib/node/ReadFileChunkLoadingRuntimeModule.js +16 -14
- package/lib/node/ReadFileCompileAsyncWasmPlugin.js +7 -7
- package/lib/node/ReadFileCompileWasmPlugin.js +7 -7
- package/lib/node/RequireChunkLoadingRuntimeModule.js +13 -6
- package/lib/node/nodeConsole.js +2 -2
- package/lib/optimize/AggressiveMergingPlugin.js +2 -2
- package/lib/optimize/AggressiveSplittingPlugin.js +10 -10
- package/lib/optimize/ConcatenatedModule.js +186 -77
- package/lib/optimize/EnsureChunkConditionsPlugin.js +2 -2
- package/lib/optimize/FlagIncludedChunksPlugin.js +2 -2
- package/lib/optimize/InnerGraph.js +5 -5
- package/lib/optimize/InnerGraphPlugin.js +14 -12
- package/lib/optimize/LimitChunkCountPlugin.js +5 -5
- package/lib/optimize/MangleExportsPlugin.js +5 -5
- package/lib/optimize/MergeDuplicateChunksPlugin.js +2 -2
- package/lib/optimize/MinChunkSizePlugin.js +3 -3
- package/lib/optimize/ModuleConcatenationPlugin.js +45 -38
- package/lib/optimize/RealContentHashPlugin.js +23 -23
- package/lib/optimize/RemoveEmptyChunksPlugin.js +2 -2
- package/lib/optimize/RemoveParentModulesPlugin.js +3 -3
- package/lib/optimize/RuntimeChunkPlugin.js +2 -2
- package/lib/optimize/SideEffectsFlagPlugin.js +5 -5
- package/lib/optimize/SplitChunksPlugin.js +20 -20
- package/lib/performance/AssetsOverSizeLimitWarning.js +1 -1
- package/lib/performance/EntrypointsOverSizeLimitWarning.js +2 -2
- package/lib/performance/SizeLimitsPlugin.js +4 -4
- package/lib/prefetch/ChunkPrefetchPreloadPlugin.js +1 -1
- package/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js +3 -3
- package/lib/rules/BasicMatcherRulePlugin.js +1 -1
- package/lib/rules/RuleSetCompiler.js +10 -10
- package/lib/rules/UseEffectRulePlugin.js +2 -2
- package/lib/runtime/GetChunkFilenameRuntimeModule.js +19 -15
- package/lib/runtime/GetMainFilenameRuntimeModule.js +1 -1
- package/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +1 -1
- package/lib/runtime/MakeDeferredNamespaceObjectRuntime.js +1 -1
- package/lib/runtime/StartupChunkDependenciesPlugin.js +2 -2
- package/lib/runtime/StartupChunkDependenciesRuntimeModule.js +3 -3
- package/lib/schemes/DataUriPlugin.js +3 -3
- package/lib/schemes/FileUriPlugin.js +1 -1
- package/lib/schemes/HttpUriPlugin.js +40 -36
- package/lib/schemes/VirtualUrlPlugin.js +1 -1
- package/lib/serialization/BinaryMiddleware.js +11 -11
- package/lib/serialization/FileMiddleware.js +18 -17
- package/lib/serialization/ObjectMiddleware.js +8 -8
- package/lib/serialization/Serializer.js +2 -2
- package/lib/serialization/SerializerMiddleware.js +2 -2
- package/lib/sharing/ConsumeSharedPlugin.js +4 -4
- package/lib/sharing/ProvideSharedPlugin.js +4 -4
- package/lib/sharing/SharePlugin.js +1 -1
- package/lib/sharing/resolveMatchedConfigs.js +1 -1
- package/lib/stats/DefaultStatsFactoryPlugin.js +85 -80
- package/lib/stats/DefaultStatsPresetPlugin.js +15 -15
- package/lib/stats/DefaultStatsPrinterPlugin.js +87 -87
- package/lib/stats/StatsFactory.js +7 -7
- package/lib/stats/StatsPrinter.js +9 -9
- package/lib/url/URLParserPlugin.js +5 -5
- package/lib/util/AsyncQueue.js +4 -4
- package/lib/util/IterableHelpers.js +2 -2
- package/lib/util/LazyBucketSortedSet.js +3 -3
- package/lib/util/SetHelpers.js +2 -2
- package/lib/util/StackedCacheMap.js +1 -1
- package/lib/util/StackedMap.js +1 -1
- package/lib/util/TupleSet.js +1 -1
- package/lib/util/WeakTupleMap.js +1 -1
- package/lib/util/cleverMerge.js +8 -8
- package/lib/util/comparators.js +10 -10
- package/lib/util/compileBooleanMatcher.js +20 -20
- package/lib/util/concatenate.js +3 -3
- package/lib/util/conventions.js +4 -4
- package/lib/util/create-schema-validation.js +1 -1
- package/lib/util/createHash.js +1 -1
- package/lib/util/deprecation.js +4 -4
- package/lib/util/deterministicGrouping.js +7 -7
- package/lib/util/findGraphRoots.js +1 -1
- package/lib/util/fs.js +4 -4
- package/lib/util/identifier.js +14 -14
- package/lib/util/magicComment.js +5 -1
- package/lib/util/memoize.js +1 -1
- package/lib/util/processAsyncTree.js +2 -2
- package/lib/util/propertyName.js +1 -1
- package/lib/util/removeBOM.js +1 -1
- package/lib/util/runtime.js +6 -6
- package/lib/util/semver.js +16 -16
- package/lib/util/serialization.js +5 -5
- package/lib/util/smartGrouping.js +1 -1
- package/lib/validateSchema.js +2 -2
- package/lib/wasm/EnableWasmLoadingPlugin.js +1 -1
- package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +1 -1
- package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +1 -1
- package/lib/wasm-async/UniversalCompileAsyncWasmPlugin.js +4 -4
- package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +13 -9
- package/lib/wasm-sync/WasmFinalizeExportsPlugin.js +2 -2
- package/lib/wasm-sync/WebAssemblyGenerator.js +16 -17
- package/lib/wasm-sync/WebAssemblyInInitialChunkError.js +4 -2
- package/lib/wasm-sync/WebAssemblyParser.js +2 -2
- package/lib/web/FetchCompileAsyncWasmPlugin.js +4 -4
- package/lib/web/FetchCompileWasmPlugin.js +4 -4
- package/lib/web/JsonpChunkLoadingPlugin.js +2 -2
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +1 -1
- package/lib/webpack.js +17 -12
- package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +2 -2
- package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +1 -1
- package/package.json +16 -16
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +4 -0
- package/types.d.ts +275 -64
|
@@ -33,7 +33,7 @@ const PLUGIN_NAME = "URLParserPlugin";
|
|
|
33
33
|
* @param {NormalModule} module module
|
|
34
34
|
* @returns {URL} file url
|
|
35
35
|
*/
|
|
36
|
-
const getUrl = module => pathToFileURL(module.resource);
|
|
36
|
+
const getUrl = (module) => pathToFileURL(module.resource);
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* @param {Parser} parser parser parser
|
|
@@ -108,7 +108,7 @@ class URLParserPlugin {
|
|
|
108
108
|
const relative = this.options.url === "relative";
|
|
109
109
|
|
|
110
110
|
parser.hooks.canRename.for("URL").tap(PLUGIN_NAME, approve);
|
|
111
|
-
parser.hooks.evaluateNewExpression.for("URL").tap(PLUGIN_NAME, expr => {
|
|
111
|
+
parser.hooks.evaluateNewExpression.for("URL").tap(PLUGIN_NAME, (expr) => {
|
|
112
112
|
const evaluatedExpr = getEvaluatedExpr(expr, parser);
|
|
113
113
|
const request = evaluatedExpr && evaluatedExpr.asString();
|
|
114
114
|
|
|
@@ -119,7 +119,7 @@ class URLParserPlugin {
|
|
|
119
119
|
.setString(url.toString())
|
|
120
120
|
.setRange(/** @type {Range} */ (expr.range));
|
|
121
121
|
});
|
|
122
|
-
parser.hooks.new.for("URL").tap(PLUGIN_NAME, _expr => {
|
|
122
|
+
parser.hooks.new.for("URL").tap(PLUGIN_NAME, (_expr) => {
|
|
123
123
|
const expr = /** @type {NewExpressionNode} */ (_expr);
|
|
124
124
|
const { options: importOptions, errors: commentErrors } =
|
|
125
125
|
parser.parseCommentOptions(/** @type {Range} */ (expr.range));
|
|
@@ -185,7 +185,7 @@ class URLParserPlugin {
|
|
|
185
185
|
);
|
|
186
186
|
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
|
|
187
187
|
parser.state.current.addDependency(dep);
|
|
188
|
-
InnerGraph.onUsage(parser.state, e => (dep.usedByExports = e));
|
|
188
|
+
InnerGraph.onUsage(parser.state, (e) => (dep.usedByExports = e));
|
|
189
189
|
return true;
|
|
190
190
|
}
|
|
191
191
|
|
|
@@ -248,7 +248,7 @@ class URLParserPlugin {
|
|
|
248
248
|
parser.state.current.addDependency(dep);
|
|
249
249
|
return true;
|
|
250
250
|
});
|
|
251
|
-
parser.hooks.isPure.for("NewExpression").tap(PLUGIN_NAME, _expr => {
|
|
251
|
+
parser.hooks.isPure.for("NewExpression").tap(PLUGIN_NAME, (_expr) => {
|
|
252
252
|
const expr = /** @type {NewExpressionNode} */ (_expr);
|
|
253
253
|
const { callee } = expr;
|
|
254
254
|
if (callee.type !== "Identifier") return;
|
package/lib/util/AsyncQueue.js
CHANGED
|
@@ -80,7 +80,7 @@ class AsyncQueue {
|
|
|
80
80
|
this._processor = processor;
|
|
81
81
|
this._getKey =
|
|
82
82
|
getKey ||
|
|
83
|
-
/** @type {getKey<T, K>} */ (item => /** @type {T & K} */ (item));
|
|
83
|
+
/** @type {getKey<T, K>} */ ((item) => /** @type {T & K} */ (item));
|
|
84
84
|
/** @type {Map<K, AsyncQueueEntry<T, K, R>>} */
|
|
85
85
|
this._entries = new Map();
|
|
86
86
|
/** @type {ArrayQueue<AsyncQueueEntry<T, K, R>>} */
|
|
@@ -138,7 +138,7 @@ class AsyncQueue {
|
|
|
138
138
|
*/
|
|
139
139
|
add(item, callback) {
|
|
140
140
|
if (this._stopped) return callback(new WebpackError("Queue was stopped"));
|
|
141
|
-
this.hooks.beforeAdd.callAsync(item, err => {
|
|
141
|
+
this.hooks.beforeAdd.callAsync(item, (err) => {
|
|
142
142
|
if (err) {
|
|
143
143
|
callback(
|
|
144
144
|
makeWebpackError(err, `AsyncQueue(${this._name}).hooks.beforeAdd`)
|
|
@@ -327,7 +327,7 @@ class AsyncQueue {
|
|
|
327
327
|
* @returns {void}
|
|
328
328
|
*/
|
|
329
329
|
_startProcessing(entry) {
|
|
330
|
-
this.hooks.beforeStart.callAsync(entry.item, err => {
|
|
330
|
+
this.hooks.beforeStart.callAsync(entry.item, (err) => {
|
|
331
331
|
if (err) {
|
|
332
332
|
this._handleResult(
|
|
333
333
|
entry,
|
|
@@ -356,7 +356,7 @@ class AsyncQueue {
|
|
|
356
356
|
* @returns {void}
|
|
357
357
|
*/
|
|
358
358
|
_handleResult(entry, err, result) {
|
|
359
|
-
this.hooks.result.callAsync(entry.item, err, result, hookError => {
|
|
359
|
+
this.hooks.result.callAsync(entry.item, err, result, (hookError) => {
|
|
360
360
|
const error = hookError
|
|
361
361
|
? makeWebpackError(hookError, `AsyncQueue(${this._name}).hooks.result`)
|
|
362
362
|
: err;
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* @param {Iterable<T>} set a set
|
|
11
11
|
* @returns {T | undefined} last item
|
|
12
12
|
*/
|
|
13
|
-
const last = set => {
|
|
13
|
+
const last = (set) => {
|
|
14
14
|
let last;
|
|
15
15
|
for (const item of set) last = item;
|
|
16
16
|
return last;
|
|
@@ -34,7 +34,7 @@ const someInIterable = (iterable, filter) => {
|
|
|
34
34
|
* @param {Iterable<T>} iterable an iterable
|
|
35
35
|
* @returns {number} count of items
|
|
36
36
|
*/
|
|
37
|
-
const countIterable = iterable => {
|
|
37
|
+
const countIterable = (iterable) => {
|
|
38
38
|
let i = 0;
|
|
39
39
|
for (const _ of iterable) i++;
|
|
40
40
|
return i;
|
|
@@ -162,7 +162,7 @@ class LazyBucketSortedSet {
|
|
|
162
162
|
*/
|
|
163
163
|
startUpdate(item) {
|
|
164
164
|
if (this._unsortedItems.has(item)) {
|
|
165
|
-
return remove => {
|
|
165
|
+
return (remove) => {
|
|
166
166
|
if (remove) {
|
|
167
167
|
this._unsortedItems.delete(item);
|
|
168
168
|
this.size--;
|
|
@@ -172,7 +172,7 @@ class LazyBucketSortedSet {
|
|
|
172
172
|
const key = this._getKey(item);
|
|
173
173
|
if (this._leaf) {
|
|
174
174
|
const oldEntry = /** @type {SortableSet<T>} */ (this._map.get(key));
|
|
175
|
-
return remove => {
|
|
175
|
+
return (remove) => {
|
|
176
176
|
if (remove) {
|
|
177
177
|
this.size--;
|
|
178
178
|
oldEntry.delete(item);
|
|
@@ -198,7 +198,7 @@ class LazyBucketSortedSet {
|
|
|
198
198
|
/** @type {LazyBucketSortedSet<T, K>} */
|
|
199
199
|
(this._map.get(key));
|
|
200
200
|
const finishUpdate = oldEntry.startUpdate(item);
|
|
201
|
-
return remove => {
|
|
201
|
+
return (remove) => {
|
|
202
202
|
if (remove) {
|
|
203
203
|
this.size--;
|
|
204
204
|
finishUpdate(true);
|
package/lib/util/SetHelpers.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* @param {Set<T>[]} sets an array of sets being checked for shared elements
|
|
12
12
|
* @returns {Set<T>} returns a new Set containing the intersecting items
|
|
13
13
|
*/
|
|
14
|
-
const intersect = sets => {
|
|
14
|
+
const intersect = (sets) => {
|
|
15
15
|
if (sets.length === 0) return new Set();
|
|
16
16
|
if (sets.length === 1) return new Set(sets[0]);
|
|
17
17
|
let minSize = Infinity;
|
|
@@ -68,7 +68,7 @@ const find = (set, fn) => {
|
|
|
68
68
|
* @param {Set<T> | ReadonlySet<T>} set a set
|
|
69
69
|
* @returns {T | undefined} first item
|
|
70
70
|
*/
|
|
71
|
-
const first = set => {
|
|
71
|
+
const first = (set) => {
|
|
72
72
|
const entry = set.values().next();
|
|
73
73
|
return entry.done ? undefined : entry.value;
|
|
74
74
|
};
|
|
@@ -124,7 +124,7 @@ class StackedCacheMap {
|
|
|
124
124
|
* @returns {Iterator<[K, V]>} iterator
|
|
125
125
|
*/
|
|
126
126
|
[Symbol.iterator]() {
|
|
127
|
-
const iterators = this.stack.map(map => map[Symbol.iterator]());
|
|
127
|
+
const iterators = this.stack.map((map) => map[Symbol.iterator]());
|
|
128
128
|
let current = this.map[Symbol.iterator]();
|
|
129
129
|
return {
|
|
130
130
|
next() {
|
package/lib/util/StackedMap.js
CHANGED
|
@@ -24,7 +24,7 @@ const UNDEFINED_MARKER = Symbol("undefined");
|
|
|
24
24
|
* @param {[K, InternalCell<V>]} pair the internal cell
|
|
25
25
|
* @returns {[K, Cell<V>]} its “safe” representation
|
|
26
26
|
*/
|
|
27
|
-
const extractPair = pair => {
|
|
27
|
+
const extractPair = (pair) => {
|
|
28
28
|
const key = pair[0];
|
|
29
29
|
const val = pair[1];
|
|
30
30
|
if (val === UNDEFINED_MARKER || val === TOMBSTONE) {
|
package/lib/util/TupleSet.js
CHANGED
|
@@ -125,7 +125,7 @@ class TupleSet {
|
|
|
125
125
|
* @param {MapIterator<[T, InnerMap<T, V> | Set<V>]>} it iterator
|
|
126
126
|
* @returns {boolean} result
|
|
127
127
|
*/
|
|
128
|
-
const next = it => {
|
|
128
|
+
const next = (it) => {
|
|
129
129
|
const result = it.next();
|
|
130
130
|
if (result.done) {
|
|
131
131
|
if (iteratorStack.length === 0) return false;
|
package/lib/util/WeakTupleMap.js
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* @param {EXPECTED_ANY} thing thing
|
|
22
22
|
* @returns {boolean} true if is weak
|
|
23
23
|
*/
|
|
24
|
-
const isWeakKey = thing => typeof thing === "object" && thing !== null;
|
|
24
|
+
const isWeakKey = (thing) => typeof thing === "object" && thing !== null;
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* @template {unknown[]} T
|
package/lib/util/cleverMerge.js
CHANGED
|
@@ -123,7 +123,7 @@ const parseCache = new WeakMap();
|
|
|
123
123
|
* @param {T} obj the object
|
|
124
124
|
* @returns {ParsedObject<T>} parsed object
|
|
125
125
|
*/
|
|
126
|
-
const cachedParseObject = obj => {
|
|
126
|
+
const cachedParseObject = (obj) => {
|
|
127
127
|
const entry = parseCache.get(/** @type {EXPECTED_OBJECT} */ (obj));
|
|
128
128
|
if (entry !== undefined) return entry;
|
|
129
129
|
const result = parseObject(obj);
|
|
@@ -138,7 +138,7 @@ const cachedParseObject = obj => {
|
|
|
138
138
|
* @param {T} obj the object
|
|
139
139
|
* @returns {ParsedObject<T>} parsed object
|
|
140
140
|
*/
|
|
141
|
-
const parseObject = obj => {
|
|
141
|
+
const parseObject = (obj) => {
|
|
142
142
|
/** @type {ParsedObjectStatic<T>} */
|
|
143
143
|
const info = new Map();
|
|
144
144
|
/** @type {ParsedObjectDynamic<T> | undefined} */
|
|
@@ -147,7 +147,7 @@ const parseObject = obj => {
|
|
|
147
147
|
* @param {keyof T} p path
|
|
148
148
|
* @returns {Partial<ObjectParsedPropertyEntry<T>>} object parsed property entry
|
|
149
149
|
*/
|
|
150
|
-
const getInfo = p => {
|
|
150
|
+
const getInfo = (p) => {
|
|
151
151
|
const entry = info.get(p);
|
|
152
152
|
if (entry !== undefined) return entry;
|
|
153
153
|
const newEntry = {
|
|
@@ -275,7 +275,7 @@ const VALUE_TYPE_DELETE = 4;
|
|
|
275
275
|
* @param {T} value a single value
|
|
276
276
|
* @returns {VALUE_TYPE_UNDEFINED | VALUE_TYPE_ATOM | VALUE_TYPE_ARRAY_EXTEND | VALUE_TYPE_OBJECT | VALUE_TYPE_DELETE} value type
|
|
277
277
|
*/
|
|
278
|
-
const getValueType = value => {
|
|
278
|
+
const getValueType = (value) => {
|
|
279
279
|
if (value === undefined) {
|
|
280
280
|
return VALUE_TYPE_UNDEFINED;
|
|
281
281
|
} else if (value === DELETE) {
|
|
@@ -457,7 +457,7 @@ const mergeEntries = (firstEntry, secondEntry, internalCaching) => {
|
|
|
457
457
|
}
|
|
458
458
|
if (
|
|
459
459
|
[.../** @type {ByValues} */ (firstEntry.byValues).values()].every(
|
|
460
|
-
value => {
|
|
460
|
+
(value) => {
|
|
461
461
|
const type = getValueType(value);
|
|
462
462
|
return type === VALUE_TYPE_ATOM || type === VALUE_TYPE_DELETE;
|
|
463
463
|
}
|
|
@@ -555,7 +555,7 @@ const mergeSingleValue = (a, b, internalCaching) => {
|
|
|
555
555
|
case VALUE_TYPE_UNDEFINED:
|
|
556
556
|
return b;
|
|
557
557
|
case VALUE_TYPE_DELETE:
|
|
558
|
-
return /** @type {B[]} */ (b).filter(item => item !== "...");
|
|
558
|
+
return /** @type {B[]} */ (b).filter((item) => item !== "...");
|
|
559
559
|
case VALUE_TYPE_ARRAY_EXTEND: {
|
|
560
560
|
/** @type {(A | B)[]} */
|
|
561
561
|
const newArray = [];
|
|
@@ -571,7 +571,7 @@ const mergeSingleValue = (a, b, internalCaching) => {
|
|
|
571
571
|
return newArray;
|
|
572
572
|
}
|
|
573
573
|
case VALUE_TYPE_OBJECT:
|
|
574
|
-
return /** @type {(A | B)[]} */ (b).map(item =>
|
|
574
|
+
return /** @type {(A | B)[]} */ (b).map((item) =>
|
|
575
575
|
item === "..." ? /** @type {A} */ (a) : item
|
|
576
576
|
);
|
|
577
577
|
default:
|
|
@@ -618,7 +618,7 @@ const removeOperations = (obj, keysToKeepOriginalValue = []) => {
|
|
|
618
618
|
/** @type {T[keyof T]} */
|
|
619
619
|
(
|
|
620
620
|
/** @type {EXPECTED_ANY[]} */
|
|
621
|
-
(value).filter(i => i !== "...")
|
|
621
|
+
(value).filter((i) => i !== "...")
|
|
622
622
|
);
|
|
623
623
|
break;
|
|
624
624
|
default:
|
package/lib/util/comparators.js
CHANGED
|
@@ -46,10 +46,10 @@ const { compareRuntime } = require("./runtime");
|
|
|
46
46
|
* @param {RawParameterizedComparator<TArg, T>} fn comparator with argument
|
|
47
47
|
* @returns {ParameterizedComparator<TArg, T>} comparator
|
|
48
48
|
*/
|
|
49
|
-
const createCachedParameterizedComparator = fn => {
|
|
49
|
+
const createCachedParameterizedComparator = (fn) => {
|
|
50
50
|
/** @type {WeakMap<EXPECTED_OBJECT, Comparator<T>>} */
|
|
51
51
|
const map = new WeakMap();
|
|
52
|
-
return arg => {
|
|
52
|
+
return (arg) => {
|
|
53
53
|
const cachedResult = map.get(/** @type {EXPECTED_OBJECT} */ (arg));
|
|
54
54
|
if (cachedResult !== undefined) return cachedResult;
|
|
55
55
|
/**
|
|
@@ -82,7 +82,7 @@ const compareIds = (a, b) => {
|
|
|
82
82
|
* @param {Comparator<T>} elementComparator comparator for elements
|
|
83
83
|
* @returns {Comparator<Iterable<T>>} comparator for iterables of elements
|
|
84
84
|
*/
|
|
85
|
-
const compareIterables = elementComparator => {
|
|
85
|
+
const compareIterables = (elementComparator) => {
|
|
86
86
|
const cacheEntry = compareIteratorsCache.get(elementComparator);
|
|
87
87
|
if (cacheEntry !== undefined) return cacheEntry;
|
|
88
88
|
/**
|
|
@@ -468,7 +468,7 @@ const compareIteratorsCache = new WeakMap();
|
|
|
468
468
|
* @param {Iterable<T>} iterable original ordered list
|
|
469
469
|
* @returns {Comparator<T>} comparator
|
|
470
470
|
*/
|
|
471
|
-
const keepOriginalOrder = iterable => {
|
|
471
|
+
const keepOriginalOrder = (iterable) => {
|
|
472
472
|
/** @type {Map<T, number>} */
|
|
473
473
|
const map = new Map();
|
|
474
474
|
let i = 0;
|
|
@@ -486,21 +486,21 @@ const keepOriginalOrder = iterable => {
|
|
|
486
486
|
* @param {ChunkGraph} chunkGraph the chunk graph
|
|
487
487
|
* @returns {Comparator<Chunk>} comparator
|
|
488
488
|
*/
|
|
489
|
-
const compareChunksNatural = chunkGraph => {
|
|
489
|
+
const compareChunksNatural = (chunkGraph) => {
|
|
490
490
|
const cmpFn = module.exports.compareModulesById(chunkGraph);
|
|
491
491
|
const cmpIterableFn = compareIterables(cmpFn);
|
|
492
492
|
return concatComparators(
|
|
493
493
|
compareSelect(
|
|
494
|
-
chunk => /** @type {string|number} */ (chunk.name),
|
|
494
|
+
(chunk) => /** @type {string|number} */ (chunk.name),
|
|
495
495
|
compareIds
|
|
496
496
|
),
|
|
497
|
-
compareSelect(chunk => chunk.runtime, compareRuntime),
|
|
497
|
+
compareSelect((chunk) => chunk.runtime, compareRuntime),
|
|
498
498
|
compareSelect(
|
|
499
499
|
/**
|
|
500
500
|
* @param {Chunk} chunk a chunk
|
|
501
501
|
* @returns {Iterable<Module>} modules
|
|
502
502
|
*/
|
|
503
|
-
chunk => chunkGraph.getOrderedChunkModulesIterable(chunk, cmpFn),
|
|
503
|
+
(chunk) => chunkGraph.getOrderedChunkModulesIterable(chunk, cmpFn),
|
|
504
504
|
cmpIterableFn
|
|
505
505
|
)
|
|
506
506
|
);
|
|
@@ -519,7 +519,7 @@ const sortWithSourceOrder = (dependencies, dependencySourceOrderMap) => {
|
|
|
519
519
|
* @param {Dependency} dep dependency
|
|
520
520
|
* @returns {number} source order
|
|
521
521
|
*/
|
|
522
|
-
const getSourceOrder = dep => {
|
|
522
|
+
const getSourceOrder = (dep) => {
|
|
523
523
|
if (dependencySourceOrderMap.has(dep)) {
|
|
524
524
|
const { main } = /** @type {DependencySourceOrder} */ (
|
|
525
525
|
dependencySourceOrderMap.get(dep)
|
|
@@ -536,7 +536,7 @@ const sortWithSourceOrder = (dependencies, dependencySourceOrderMap) => {
|
|
|
536
536
|
* @param {number | undefined} sourceOrder sourceOrder
|
|
537
537
|
* @returns {boolean} needReSort
|
|
538
538
|
*/
|
|
539
|
-
const needReSort = sourceOrder => {
|
|
539
|
+
const needReSort = (sourceOrder) => {
|
|
540
540
|
if (typeof sourceOrder === "number") {
|
|
541
541
|
return true;
|
|
542
542
|
}
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
* @param {string} str string
|
|
10
10
|
* @returns {string} quoted meta
|
|
11
11
|
*/
|
|
12
|
-
const quoteMeta = str => str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&");
|
|
12
|
+
const quoteMeta = (str) => str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&");
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* @param {string} str string
|
|
16
16
|
* @returns {string} string
|
|
17
17
|
*/
|
|
18
|
-
const toSimpleString = str => {
|
|
18
|
+
const toSimpleString = (str) => {
|
|
19
19
|
if (`${Number(str)}` === str) {
|
|
20
20
|
return str;
|
|
21
21
|
}
|
|
@@ -26,9 +26,9 @@ const toSimpleString = str => {
|
|
|
26
26
|
* @param {Record<string | number, boolean>} map value map
|
|
27
27
|
* @returns {boolean | ((value: string) => string)} true/false, when unconditionally true/false, or a template function to determine the value at runtime
|
|
28
28
|
*/
|
|
29
|
-
const compileBooleanMatcher = map => {
|
|
30
|
-
const positiveItems = Object.keys(map).filter(i => map[i]);
|
|
31
|
-
const negativeItems = Object.keys(map).filter(i => !map[i]);
|
|
29
|
+
const compileBooleanMatcher = (map) => {
|
|
30
|
+
const positiveItems = Object.keys(map).filter((i) => map[i]);
|
|
31
|
+
const negativeItems = Object.keys(map).filter((i) => !map[i]);
|
|
32
32
|
if (positiveItems.length === 0) return false;
|
|
33
33
|
if (negativeItems.length === 0) return true;
|
|
34
34
|
return compileBooleanMatcherFromLists(positiveItems, negativeItems);
|
|
@@ -43,17 +43,17 @@ const compileBooleanMatcherFromLists = (positiveItems, negativeItems) => {
|
|
|
43
43
|
if (positiveItems.length === 0) return () => "false";
|
|
44
44
|
if (negativeItems.length === 0) return () => "true";
|
|
45
45
|
if (positiveItems.length === 1) {
|
|
46
|
-
return value => `${toSimpleString(positiveItems[0])} == ${value}`;
|
|
46
|
+
return (value) => `${toSimpleString(positiveItems[0])} == ${value}`;
|
|
47
47
|
}
|
|
48
48
|
if (negativeItems.length === 1) {
|
|
49
|
-
return value => `${toSimpleString(negativeItems[0])} != ${value}`;
|
|
49
|
+
return (value) => `${toSimpleString(negativeItems[0])} != ${value}`;
|
|
50
50
|
}
|
|
51
51
|
const positiveRegexp = itemsToRegexp(positiveItems);
|
|
52
52
|
const negativeRegexp = itemsToRegexp(negativeItems);
|
|
53
53
|
if (positiveRegexp.length <= negativeRegexp.length) {
|
|
54
|
-
return value => `/^${positiveRegexp}$/.test(${value})`;
|
|
54
|
+
return (value) => `/^${positiveRegexp}$/.test(${value})`;
|
|
55
55
|
}
|
|
56
|
-
return value => `!/^${negativeRegexp}$/.test(${value})`;
|
|
56
|
+
return (value) => `!/^${negativeRegexp}$/.test(${value})`;
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
/**
|
|
@@ -94,7 +94,7 @@ const popCommonItems = (itemsSet, getKey, condition) => {
|
|
|
94
94
|
* @param {Array<string>} items items
|
|
95
95
|
* @returns {string} common prefix
|
|
96
96
|
*/
|
|
97
|
-
const getCommonPrefix = items => {
|
|
97
|
+
const getCommonPrefix = (items) => {
|
|
98
98
|
let prefix = items[0];
|
|
99
99
|
for (let i = 1; i < items.length; i++) {
|
|
100
100
|
const item = items[i];
|
|
@@ -112,7 +112,7 @@ const getCommonPrefix = items => {
|
|
|
112
112
|
* @param {Array<string>} items items
|
|
113
113
|
* @returns {string} common suffix
|
|
114
114
|
*/
|
|
115
|
-
const getCommonSuffix = items => {
|
|
115
|
+
const getCommonSuffix = (items) => {
|
|
116
116
|
let suffix = items[0];
|
|
117
117
|
for (let i = 1; i < items.length; i++) {
|
|
118
118
|
const item = items[i];
|
|
@@ -130,7 +130,7 @@ const getCommonSuffix = items => {
|
|
|
130
130
|
* @param {Array<string>} itemsArr array of items
|
|
131
131
|
* @returns {string} regexp
|
|
132
132
|
*/
|
|
133
|
-
const itemsToRegexp = itemsArr => {
|
|
133
|
+
const itemsToRegexp = (itemsArr) => {
|
|
134
134
|
if (itemsArr.length === 1) {
|
|
135
135
|
return quoteMeta(itemsArr[0]);
|
|
136
136
|
}
|
|
@@ -165,11 +165,11 @@ const itemsToRegexp = itemsArr => {
|
|
|
165
165
|
if (finishedItems.length === 0 && items.size === 2) {
|
|
166
166
|
const prefix = getCommonPrefix(itemsArr);
|
|
167
167
|
const suffix = getCommonSuffix(
|
|
168
|
-
itemsArr.map(item => item.slice(prefix.length))
|
|
168
|
+
itemsArr.map((item) => item.slice(prefix.length))
|
|
169
169
|
);
|
|
170
170
|
if (prefix.length > 0 || suffix.length > 0) {
|
|
171
171
|
return `${quoteMeta(prefix)}${itemsToRegexp(
|
|
172
|
-
itemsArr.map(i => i.slice(prefix.length, -suffix.length || undefined))
|
|
172
|
+
itemsArr.map((i) => i.slice(prefix.length, -suffix.length || undefined))
|
|
173
173
|
)}${quoteMeta(suffix)}`;
|
|
174
174
|
}
|
|
175
175
|
}
|
|
@@ -190,8 +190,8 @@ const itemsToRegexp = itemsArr => {
|
|
|
190
190
|
// find common prefix: (a1|a2|a3|a4|b5) => (a(1|2|3|4)|b5)
|
|
191
191
|
const prefixed = popCommonItems(
|
|
192
192
|
items,
|
|
193
|
-
item => (item.length >= 1 ? item[0] : false),
|
|
194
|
-
list => {
|
|
193
|
+
(item) => (item.length >= 1 ? item[0] : false),
|
|
194
|
+
(list) => {
|
|
195
195
|
if (list.length >= 3) return true;
|
|
196
196
|
if (list.length <= 1) return false;
|
|
197
197
|
return list[0][1] === list[1][1];
|
|
@@ -201,7 +201,7 @@ const itemsToRegexp = itemsArr => {
|
|
|
201
201
|
const prefix = getCommonPrefix(prefixedItems);
|
|
202
202
|
finishedItems.push(
|
|
203
203
|
`${quoteMeta(prefix)}${itemsToRegexp(
|
|
204
|
-
prefixedItems.map(i => i.slice(prefix.length))
|
|
204
|
+
prefixedItems.map((i) => i.slice(prefix.length))
|
|
205
205
|
)}`
|
|
206
206
|
);
|
|
207
207
|
}
|
|
@@ -209,8 +209,8 @@ const itemsToRegexp = itemsArr => {
|
|
|
209
209
|
// find common suffix: (a1|b1|c1|d1|e2) => ((a|b|c|d)1|e2)
|
|
210
210
|
const suffixed = popCommonItems(
|
|
211
211
|
items,
|
|
212
|
-
item => (item.length >= 1 ? item.slice(-1) : false),
|
|
213
|
-
list => {
|
|
212
|
+
(item) => (item.length >= 1 ? item.slice(-1) : false),
|
|
213
|
+
(list) => {
|
|
214
214
|
if (list.length >= 3) return true;
|
|
215
215
|
if (list.length <= 1) return false;
|
|
216
216
|
return list[0].slice(-2) === list[1].slice(-2);
|
|
@@ -220,7 +220,7 @@ const itemsToRegexp = itemsArr => {
|
|
|
220
220
|
const suffix = getCommonSuffix(suffixedItems);
|
|
221
221
|
finishedItems.push(
|
|
222
222
|
`${itemsToRegexp(
|
|
223
|
-
suffixedItems.map(i => i.slice(0, -suffix.length))
|
|
223
|
+
suffixedItems.map((i) => i.slice(0, -suffix.length))
|
|
224
224
|
)}${quoteMeta(suffix)}`
|
|
225
225
|
);
|
|
226
226
|
}
|
package/lib/util/concatenate.js
CHANGED
|
@@ -22,13 +22,13 @@ const NAMESPACE_OBJECT_EXPORT = "__WEBPACK_NAMESPACE_OBJECT__";
|
|
|
22
22
|
* @param {Variable} variable variable
|
|
23
23
|
* @returns {Reference[]} references
|
|
24
24
|
*/
|
|
25
|
-
const getAllReferences = variable => {
|
|
25
|
+
const getAllReferences = (variable) => {
|
|
26
26
|
let set = variable.references;
|
|
27
27
|
// Look for inner scope variables too (like in class Foo { t() { Foo } })
|
|
28
28
|
const identifiers = new Set(variable.identifiers);
|
|
29
29
|
for (const scope of variable.scope.childScopes) {
|
|
30
30
|
for (const innerVar of scope.variables) {
|
|
31
|
-
if (innerVar.identifiers.some(id => identifiers.has(id))) {
|
|
31
|
+
if (innerVar.identifiers.some((id) => identifiers.has(id))) {
|
|
32
32
|
set = [...set, ...innerVar.references];
|
|
33
33
|
break;
|
|
34
34
|
}
|
|
@@ -53,7 +53,7 @@ const getPathInAst = (ast, node) => {
|
|
|
53
53
|
* @param {Node} n node
|
|
54
54
|
* @returns {Node[] | undefined} result
|
|
55
55
|
*/
|
|
56
|
-
const enterNode = n => {
|
|
56
|
+
const enterNode = (n) => {
|
|
57
57
|
if (!n) return;
|
|
58
58
|
const r = n.range;
|
|
59
59
|
if (r && r[0] <= nr[0] && r[1] >= nr[1]) {
|
package/lib/util/conventions.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* @param {string} string string
|
|
12
12
|
* @returns {string} result
|
|
13
13
|
*/
|
|
14
|
-
const preserveCamelCase = string => {
|
|
14
|
+
const preserveCamelCase = (string) => {
|
|
15
15
|
let result = string;
|
|
16
16
|
let isLastCharLower = false;
|
|
17
17
|
let isLastCharUpper = false;
|
|
@@ -54,7 +54,7 @@ const preserveCamelCase = string => {
|
|
|
54
54
|
* @param {string} input input
|
|
55
55
|
* @returns {string} result
|
|
56
56
|
*/
|
|
57
|
-
module.exports.camelCase = input => {
|
|
57
|
+
module.exports.camelCase = (input) => {
|
|
58
58
|
let result = input.trim();
|
|
59
59
|
|
|
60
60
|
if (result.length === 0) {
|
|
@@ -75,7 +75,7 @@ module.exports.camelCase = input => {
|
|
|
75
75
|
.replace(/^[_.\- ]+/, "")
|
|
76
76
|
.toLowerCase()
|
|
77
77
|
.replace(/[_.\- ]+([\p{Alpha}\p{N}_]|$)/gu, (_, p1) => p1.toUpperCase())
|
|
78
|
-
.replace(/\d+([\p{Alpha}\p{N}_]|$)/gu, m => m.toUpperCase());
|
|
78
|
+
.replace(/\d+([\p{Alpha}\p{N}_]|$)/gu, (m) => m.toUpperCase());
|
|
79
79
|
};
|
|
80
80
|
|
|
81
81
|
/**
|
|
@@ -121,5 +121,5 @@ module.exports.cssExportConvention = (input, convention) => {
|
|
|
121
121
|
* @param {string} input input
|
|
122
122
|
* @returns {string} result
|
|
123
123
|
*/
|
|
124
|
-
module.exports.dashesCamelCase = input =>
|
|
124
|
+
module.exports.dashesCamelCase = (input) =>
|
|
125
125
|
input.replace(/-+(\w)/g, (match, firstLetter) => firstLetter.toUpperCase());
|
|
@@ -22,7 +22,7 @@ const getValidate = memoize(() => require("schema-utils").validate);
|
|
|
22
22
|
*/
|
|
23
23
|
const createSchemaValidation = (check, getSchema, options) => {
|
|
24
24
|
getSchema = memoize(getSchema);
|
|
25
|
-
return value => {
|
|
25
|
+
return (value) => {
|
|
26
26
|
if (check && value && !check(value)) {
|
|
27
27
|
getValidate()(
|
|
28
28
|
getSchema(),
|
package/lib/util/createHash.js
CHANGED
|
@@ -154,7 +154,7 @@ let BatchedHash;
|
|
|
154
154
|
* @param {HashFunction} algorithm the algorithm name or a constructor creating a hash
|
|
155
155
|
* @returns {Hash} the hash
|
|
156
156
|
*/
|
|
157
|
-
module.exports = algorithm => {
|
|
157
|
+
module.exports = (algorithm) => {
|
|
158
158
|
if (typeof algorithm === "function") {
|
|
159
159
|
// eslint-disable-next-line new-cap
|
|
160
160
|
return new BulkUpdateDecorator(() => new algorithm());
|
package/lib/util/deprecation.js
CHANGED
|
@@ -146,7 +146,7 @@ module.exports.arrayToSetDeprecation = (set, name) => {
|
|
|
146
146
|
* @param {number} index index
|
|
147
147
|
* @returns {() => T | undefined} value
|
|
148
148
|
*/
|
|
149
|
-
const createIndexGetter = index => {
|
|
149
|
+
const createIndexGetter = (index) => {
|
|
150
150
|
/**
|
|
151
151
|
* @this {Set<T>} a Set
|
|
152
152
|
* @returns {T | undefined} the value at this location
|
|
@@ -164,7 +164,7 @@ module.exports.arrayToSetDeprecation = (set, name) => {
|
|
|
164
164
|
/**
|
|
165
165
|
* @param {number} index index
|
|
166
166
|
*/
|
|
167
|
-
const defineIndexGetter = index => {
|
|
167
|
+
const defineIndexGetter = (index) => {
|
|
168
168
|
Object.defineProperty(set, index, {
|
|
169
169
|
get: createIndexGetter(index),
|
|
170
170
|
set(value) {
|
|
@@ -199,7 +199,7 @@ module.exports.arrayToSetDeprecation = (set, name) => {
|
|
|
199
199
|
* @param {string} name name
|
|
200
200
|
* @returns {{ new <T = any>(values?: readonly T[] | null): SetDeprecatedArray<T> }} SetDeprecatedArray
|
|
201
201
|
*/
|
|
202
|
-
module.exports.createArrayToSetDeprecationSet = name => {
|
|
202
|
+
module.exports.createArrayToSetDeprecationSet = (name) => {
|
|
203
203
|
let initialized = false;
|
|
204
204
|
|
|
205
205
|
/**
|
|
@@ -275,7 +275,7 @@ const deprecateAllProperties = (obj, message, code) => {
|
|
|
275
275
|
* @param {T} v value
|
|
276
276
|
* @returns {T} result
|
|
277
277
|
*/
|
|
278
|
-
v => (value = v),
|
|
278
|
+
(v) => (value = v),
|
|
279
279
|
message,
|
|
280
280
|
code
|
|
281
281
|
)
|
|
@@ -97,7 +97,7 @@ const subtractSizeFrom = (total, size) => {
|
|
|
97
97
|
* @param {Iterable<Node<T>>} nodes some nodes
|
|
98
98
|
* @returns {Record<string, number>} total size
|
|
99
99
|
*/
|
|
100
|
-
const sumSize = nodes => {
|
|
100
|
+
const sumSize = (nodes) => {
|
|
101
101
|
const sum = Object.create(null);
|
|
102
102
|
for (const node of nodes) {
|
|
103
103
|
addSizeTo(sum, node.size);
|
|
@@ -249,7 +249,7 @@ class Group {
|
|
|
249
249
|
* @param {Iterable<Node<T>>} nodes nodes
|
|
250
250
|
* @returns {number[]} similarities
|
|
251
251
|
*/
|
|
252
|
-
const getSimilarities = nodes => {
|
|
252
|
+
const getSimilarities = (nodes) => {
|
|
253
253
|
// calculate similarities between lexically adjacent nodes
|
|
254
254
|
/** @type {number[]} */
|
|
255
255
|
const similarities = [];
|
|
@@ -292,7 +292,7 @@ module.exports = ({ maxSize, minSize, items, getSize, getKey }) => {
|
|
|
292
292
|
|
|
293
293
|
const nodes = Array.from(
|
|
294
294
|
items,
|
|
295
|
-
item => new Node(item, getKey(item), getSize(item))
|
|
295
|
+
(item) => new Node(item, getKey(item), getSize(item))
|
|
296
296
|
);
|
|
297
297
|
|
|
298
298
|
/** @type {Node<T>[]} */
|
|
@@ -329,12 +329,12 @@ module.exports = ({ maxSize, minSize, items, getSize, getKey }) => {
|
|
|
329
329
|
// We hit an edge case where the working set is already smaller than minSize
|
|
330
330
|
// We merge problematic nodes with the smallest result node to keep minSize intact
|
|
331
331
|
const problemNodes = group.popNodes(
|
|
332
|
-
n => getNumberOfMatchingSizeTypes(n.size, problemTypes) > 0
|
|
332
|
+
(n) => getNumberOfMatchingSizeTypes(n.size, problemTypes) > 0
|
|
333
333
|
);
|
|
334
334
|
if (problemNodes === undefined) return false;
|
|
335
335
|
// Only merge it with result nodes that have the problematic size type
|
|
336
336
|
const possibleResultGroups = result.filter(
|
|
337
|
-
n => getNumberOfMatchingSizeTypes(n.size, problemTypes) > 0
|
|
337
|
+
(n) => getNumberOfMatchingSizeTypes(n.size, problemTypes) > 0
|
|
338
338
|
);
|
|
339
339
|
if (possibleResultGroups.length > 0) {
|
|
340
340
|
const bestGroup = possibleResultGroups.reduce((min, group) => {
|
|
@@ -531,11 +531,11 @@ module.exports = ({ maxSize, minSize, items, getSize, getKey }) => {
|
|
|
531
531
|
|
|
532
532
|
// return the results
|
|
533
533
|
return result.map(
|
|
534
|
-
group =>
|
|
534
|
+
(group) =>
|
|
535
535
|
/** @type {GroupedItems<T>} */
|
|
536
536
|
({
|
|
537
537
|
key: group.key,
|
|
538
|
-
items: group.nodes.map(node => node.item),
|
|
538
|
+
items: group.nodes.map((node) => node.item),
|
|
539
539
|
size: group.size
|
|
540
540
|
})
|
|
541
541
|
);
|
|
@@ -224,7 +224,7 @@ module.exports = (items, getDependencies) => {
|
|
|
224
224
|
|
|
225
225
|
// When roots were found, return them
|
|
226
226
|
if (roots.size > 0) {
|
|
227
|
-
return Array.from(roots, r => r.item);
|
|
227
|
+
return Array.from(roots, (r) => r.item);
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
throw new Error("Implementation of findGraphRoots is broken");
|