webpack 5.99.9 → 5.100.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/webpack.js +8 -2
- package/hot/log.js +15 -15
- package/hot/poll.js +1 -0
- package/lib/APIPlugin.js +3 -3
- package/lib/AbstractMethodError.js +1 -0
- package/lib/AutomaticPrefetchPlugin.js +1 -0
- package/lib/BannerPlugin.js +1 -1
- package/lib/CaseSensitiveModulesWarning.js +4 -4
- package/lib/Chunk.js +6 -6
- package/lib/ChunkGraph.js +37 -31
- package/lib/ChunkGroup.js +4 -4
- package/lib/ChunkTemplate.js +1 -1
- package/lib/CleanPlugin.js +94 -17
- package/lib/CodeGenerationResults.js +1 -1
- package/lib/CompatibilityPlugin.js +5 -2
- package/lib/Compilation.js +67 -45
- package/lib/Compiler.js +46 -16
- package/lib/ConcatenationScope.js +15 -6
- package/lib/ConstPlugin.js +5 -3
- package/lib/ContextModule.js +16 -12
- package/lib/ContextModuleFactory.js +4 -3
- package/lib/ContextReplacementPlugin.js +4 -2
- package/lib/CssModule.js +2 -2
- package/lib/DefinePlugin.js +111 -3
- package/lib/DelegatedModuleFactoryPlugin.js +18 -18
- package/lib/Dependency.js +6 -1
- package/lib/DependencyTemplate.js +1 -0
- package/lib/DllEntryPlugin.js +3 -1
- package/lib/DllPlugin.js +4 -3
- package/lib/DllReferencePlugin.js +2 -2
- package/lib/DynamicEntryPlugin.js +1 -1
- package/lib/EntryOptionPlugin.js +5 -0
- package/lib/ErrorHelpers.js +4 -4
- package/lib/EvalDevToolModulePlugin.js +3 -3
- package/lib/EvalSourceMapDevToolPlugin.js +7 -7
- package/lib/ExportsInfo.js +48 -39
- package/lib/ExternalModule.js +15 -11
- package/lib/ExternalModuleFactoryPlugin.js +5 -2
- package/lib/FileSystemInfo.js +51 -36
- package/lib/FlagDependencyExportsPlugin.js +14 -7
- package/lib/FlagDependencyUsagePlugin.js +1 -1
- package/lib/Generator.js +14 -1
- package/lib/HookWebpackError.js +1 -0
- package/lib/HotModuleReplacementPlugin.js +77 -50
- package/lib/IgnorePlugin.js +1 -1
- package/lib/InvalidDependenciesModuleWarning.js +1 -1
- package/lib/JavascriptMetaInfoPlugin.js +0 -1
- package/lib/LibManifestPlugin.js +4 -2
- package/lib/LoaderOptionsPlugin.js +6 -4
- package/lib/MainTemplate.js +2 -2
- package/lib/Module.js +21 -6
- package/lib/ModuleFactory.js +1 -0
- package/lib/ModuleGraph.js +24 -2
- package/lib/ModuleGraphConnection.js +5 -5
- package/lib/ModuleInfoHeaderPlugin.js +2 -1
- package/lib/ModuleParseError.js +1 -0
- package/lib/ModuleSourceTypesConstants.js +12 -12
- package/lib/ModuleTemplate.js +1 -1
- package/lib/ModuleTypeConstants.js +21 -21
- package/lib/MultiCompiler.js +6 -6
- package/lib/NormalModule.js +31 -44
- package/lib/NormalModuleFactory.js +29 -19
- package/lib/NormalModuleReplacementPlugin.js +1 -1
- package/lib/NullFactory.js +1 -0
- package/lib/OptimizationStages.js +1 -1
- package/lib/Parser.js +1 -0
- package/lib/ProgressPlugin.js +12 -5
- package/lib/ProvidePlugin.js +5 -1
- package/lib/RecordIdsPlugin.js +3 -3
- package/lib/RuntimeGlobals.js +175 -155
- package/lib/RuntimeModule.js +1 -0
- package/lib/RuntimePlugin.js +33 -7
- package/lib/RuntimeTemplate.js +111 -11
- package/lib/SourceMapDevToolModuleOptionsPlugin.js +15 -25
- package/lib/SourceMapDevToolPlugin.js +19 -17
- package/lib/Template.js +2 -2
- package/lib/TemplatedPathPlugin.js +1 -1
- package/lib/WarnDeprecatedOptionPlugin.js +7 -8
- package/lib/WatchIgnorePlugin.js +4 -3
- package/lib/WebpackIsIncludedPlugin.js +2 -1
- package/lib/WebpackOptionsApply.js +115 -27
- package/lib/asset/AssetGenerator.js +15 -11
- package/lib/asset/AssetModulesPlugin.js +19 -17
- package/lib/asset/AssetSourceGenerator.js +4 -4
- package/lib/asset/RawDataUrlModule.js +4 -2
- package/lib/async-modules/AwaitDependenciesInitFragment.js +1 -1
- package/lib/buildChunkGraph.js +6 -3
- package/lib/cache/AddBuildDependenciesPlugin.js +5 -6
- package/lib/cache/IdleFileCachePlugin.js +7 -4
- package/lib/cache/MemoryCachePlugin.js +1 -0
- package/lib/cache/MemoryWithGcCachePlugin.js +1 -0
- package/lib/cache/PackFileCacheStrategy.js +26 -20
- package/lib/cache/ResolverCachePlugin.js +16 -8
- package/lib/cli.js +15 -10
- package/lib/config/browserslistTargetHandler.js +3 -3
- package/lib/config/defaults.js +25 -17
- package/lib/config/normalization.js +2 -1
- package/lib/config/target.js +6 -5
- package/lib/container/ContainerPlugin.js +1 -1
- package/lib/container/ContainerReferencePlugin.js +1 -1
- package/lib/container/FallbackModule.js +2 -1
- package/lib/container/HoistContainerReferencesPlugin.js +1 -1
- package/lib/container/ModuleFederationPlugin.js +2 -2
- package/lib/container/RemoteModule.js +1 -1
- package/lib/css/CssGenerator.js +9 -6
- package/lib/css/CssModulesPlugin.js +44 -31
- package/lib/css/CssParser.js +6 -4
- package/lib/css/walkCssTokens.js +33 -37
- package/lib/debug/ProfilingPlugin.js +6 -6
- package/lib/dependencies/AMDDefineDependencyParserPlugin.js +8 -8
- package/lib/dependencies/AMDPlugin.js +12 -8
- package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +28 -26
- package/lib/dependencies/CachedConstDependency.js +1 -5
- package/lib/dependencies/CommonJsExportRequireDependency.js +6 -4
- package/lib/dependencies/CommonJsExportsParserPlugin.js +22 -25
- package/lib/dependencies/CommonJsFullRequireDependency.js +1 -9
- package/lib/dependencies/CommonJsImportsParserPlugin.js +100 -114
- package/lib/dependencies/CommonJsPlugin.js +15 -16
- package/lib/dependencies/ContextDependencyHelpers.js +2 -1
- package/lib/dependencies/ContextDependencyTemplateAsId.js +1 -0
- package/lib/dependencies/ContextDependencyTemplateAsRequireCall.js +1 -0
- package/lib/dependencies/CssIcssExportDependency.js +1 -1
- package/lib/dependencies/CssLocalIdentifierDependency.js +2 -2
- package/lib/dependencies/CssSelfLocalIdentifierDependency.js +2 -1
- package/lib/dependencies/DynamicExports.js +9 -9
- package/lib/dependencies/ExportsInfoDependency.js +1 -1
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +122 -101
- package/lib/dependencies/HarmonyExportExpressionDependency.js +1 -1
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +95 -19
- package/lib/dependencies/HarmonyExportInitFragment.js +1 -1
- package/lib/dependencies/HarmonyImportDependency.js +11 -5
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +238 -162
- package/lib/dependencies/HarmonyImportSideEffectDependency.js +4 -1
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +20 -9
- package/lib/dependencies/HarmonyModulesPlugin.js +23 -12
- package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +1 -0
- package/lib/dependencies/ImportMetaContextPlugin.js +2 -1
- package/lib/dependencies/ImportMetaPlugin.js +2 -2
- package/lib/dependencies/ImportParserPlugin.js +40 -9
- package/lib/dependencies/ImportPlugin.js +3 -1
- package/lib/dependencies/LoaderPlugin.js +1 -0
- package/lib/dependencies/ModuleDependencyTemplateAsRequireId.js +1 -0
- package/lib/dependencies/RequireContextPlugin.js +3 -1
- package/lib/dependencies/RequireEnsurePlugin.js +6 -6
- package/lib/dependencies/RequireIncludeDependencyParserPlugin.js +33 -34
- package/lib/dependencies/RequireIncludePlugin.js +1 -0
- package/lib/dependencies/RuntimeRequirementsDependency.js +1 -1
- package/lib/dependencies/SystemPlugin.js +1 -1
- package/lib/dependencies/URLContextDependency.js +65 -0
- package/lib/dependencies/URLPlugin.js +17 -157
- package/lib/dependencies/WorkerPlugin.js +23 -10
- package/lib/dependencies/processExportInfo.js +2 -1
- package/lib/esm/ModuleChunkFormatPlugin.js +269 -185
- package/lib/esm/ModuleChunkLoadingPlugin.js +39 -1
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +70 -3
- package/lib/hmr/HotModuleReplacement.runtime.js +0 -1
- package/lib/hmr/HotModuleReplacementRuntimeModule.js +1 -1
- package/lib/hmr/JavascriptHotModuleReplacementHelper.js +37 -0
- package/lib/hmr/LazyCompilationPlugin.js +4 -2
- package/lib/hmr/lazyCompilationBackend.js +4 -2
- package/lib/ids/ChunkModuleIdRangePlugin.js +6 -3
- package/lib/ids/DeterministicChunkIdsPlugin.js +30 -35
- package/lib/ids/DeterministicModuleIdsPlugin.js +4 -3
- package/lib/ids/HashedModuleIdsPlugin.js +5 -4
- package/lib/ids/IdHelpers.js +21 -17
- package/lib/ids/NamedChunkIdsPlugin.js +5 -5
- package/lib/ids/NamedModuleIdsPlugin.js +4 -4
- package/lib/ids/NaturalChunkIdsPlugin.js +2 -1
- package/lib/ids/NaturalModuleIdsPlugin.js +1 -1
- package/lib/ids/OccurrenceChunkIdsPlugin.js +3 -2
- package/lib/ids/OccurrenceModuleIdsPlugin.js +1 -1
- package/lib/ids/SyncModuleIdsPlugin.js +1 -1
- package/lib/index.js +13 -3
- package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +113 -119
- package/lib/javascript/BasicEvaluatedExpression.js +2 -1
- package/lib/javascript/ChunkHelpers.js +1 -0
- package/lib/javascript/CommonJsChunkFormatPlugin.js +121 -136
- package/lib/javascript/EnableChunkLoadingPlugin.js +6 -3
- package/lib/javascript/JavascriptGenerator.js +14 -2
- package/lib/javascript/JavascriptModulesPlugin.js +68 -27
- package/lib/javascript/JavascriptParser.js +117 -76
- package/lib/javascript/JavascriptParserHelpers.js +41 -41
- package/lib/javascript/StartupHelpers.js +17 -17
- package/lib/json/JsonGenerator.js +4 -2
- package/lib/json/JsonModulesPlugin.js +2 -2
- package/lib/json/JsonParser.js +1 -1
- package/lib/library/AbstractLibraryPlugin.js +6 -2
- package/lib/library/AssignLibraryPlugin.js +21 -6
- package/lib/library/EnableLibraryPlugin.js +23 -3
- package/lib/library/UmdLibraryPlugin.js +15 -6
- package/lib/logging/createConsoleLogger.js +3 -3
- package/lib/logging/runtime.js +9 -9
- package/lib/node/ReadFileChunkLoadingRuntimeModule.js +4 -22
- package/lib/node/RequireChunkLoadingRuntimeModule.js +4 -22
- package/lib/node/nodeConsole.js +4 -2
- package/lib/optimize/AggressiveMergingPlugin.js +45 -46
- package/lib/optimize/AggressiveSplittingPlugin.js +13 -12
- package/lib/optimize/ConcatenatedModule.js +227 -57
- package/lib/optimize/EnsureChunkConditionsPlugin.js +58 -58
- package/lib/optimize/FlagIncludedChunksPlugin.js +3 -1
- package/lib/optimize/InnerGraph.js +115 -112
- package/lib/optimize/InnerGraphPlugin.js +2 -2
- package/lib/optimize/LimitChunkCountPlugin.js +4 -2
- package/lib/optimize/MangleExportsPlugin.js +4 -3
- package/lib/optimize/MergeDuplicateChunksPlugin.js +80 -81
- package/lib/optimize/MinChunkSizePlugin.js +6 -3
- package/lib/optimize/ModuleConcatenationPlugin.js +31 -22
- package/lib/optimize/RealContentHashPlugin.js +26 -20
- package/lib/optimize/RemoveEmptyChunksPlugin.js +2 -1
- package/lib/optimize/RemoveParentModulesPlugin.js +1 -0
- package/lib/optimize/SideEffectsFlagPlugin.js +3 -2
- package/lib/optimize/SplitChunksPlugin.js +16 -13
- package/lib/rules/BasicEffectRulePlugin.js +4 -2
- package/lib/rules/BasicMatcherRulePlugin.js +3 -1
- package/lib/rules/ObjectMatcherRulePlugin.js +3 -1
- package/lib/rules/RuleSetCompiler.js +6 -3
- package/lib/rules/UseEffectRulePlugin.js +3 -1
- package/lib/runtime/AsyncModuleRuntimeModule.js +64 -9
- package/lib/runtime/CreateFakeNamespaceObjectRuntimeModule.js +1 -1
- package/lib/runtime/MakeDeferredNamespaceObjectRuntime.js +214 -0
- package/lib/runtime/RuntimeIdRuntimeModule.js +2 -1
- package/lib/runtime/StartupChunkDependenciesRuntimeModule.js +8 -7
- package/lib/schemes/FileUriPlugin.js +1 -1
- package/lib/schemes/HttpUriPlugin.js +27 -19
- package/lib/schemes/VirtualUrlPlugin.js +222 -0
- package/lib/serialization/AggregateErrorSerializer.js +1 -1
- package/lib/serialization/BinaryMiddleware.js +5 -4
- package/lib/serialization/FileMiddleware.js +7 -4
- package/lib/serialization/ObjectMiddleware.js +14 -8
- package/lib/serialization/Serializer.js +5 -3
- package/lib/serialization/SerializerMiddleware.js +2 -0
- package/lib/sharing/ConsumeSharedModule.js +1 -1
- package/lib/sharing/ConsumeSharedPlugin.js +3 -3
- package/lib/sharing/ConsumeSharedRuntimeModule.js +2 -2
- package/lib/sharing/ProvideSharedModule.js +1 -1
- package/lib/sharing/ProvideSharedPlugin.js +3 -2
- package/lib/sharing/SharePlugin.js +2 -1
- package/lib/sharing/ShareRuntimeModule.js +3 -5
- package/lib/sharing/utils.js +34 -34
- package/lib/stats/DefaultStatsFactoryPlugin.js +49 -46
- package/lib/stats/DefaultStatsPresetPlugin.js +4 -2
- package/lib/stats/DefaultStatsPrinterPlugin.js +15 -9
- package/lib/stats/StatsFactory.js +4 -2
- package/lib/stats/StatsPrinter.js +3 -2
- package/lib/url/URLParserPlugin.js +266 -0
- package/lib/util/ArrayQueue.js +1 -1
- package/lib/util/AsyncQueue.js +1 -1
- package/lib/util/Hash.js +2 -0
- package/lib/util/IterableHelpers.js +1 -1
- package/lib/util/LazyBucketSortedSet.js +2 -1
- package/lib/util/LazySet.js +11 -6
- package/lib/util/ParallelismFactorCalculator.js +1 -1
- package/lib/util/SetHelpers.js +3 -3
- package/lib/util/SortableSet.js +2 -2
- package/lib/util/StackedCacheMap.js +3 -1
- package/lib/util/StackedMap.js +2 -2
- package/lib/util/StringXor.js +1 -0
- package/lib/util/TupleSet.js +1 -0
- package/lib/util/URLAbsoluteSpecifier.js +1 -1
- package/lib/util/cleverMerge.js +12 -8
- package/lib/util/comparators.js +154 -127
- package/lib/util/compileBooleanMatcher.js +8 -3
- package/lib/util/concatenate.js +8 -7
- package/lib/util/conventions.js +72 -73
- package/lib/util/create-schema-validation.js +2 -1
- package/lib/util/createHash.js +10 -4
- package/lib/util/deprecation.js +69 -66
- package/lib/util/deterministicGrouping.js +4 -2
- package/lib/util/extractUrlAndGlobal.js +1 -1
- package/lib/util/findGraphRoots.js +2 -2
- package/lib/util/fs.js +30 -23
- package/lib/util/hash/md4.js +2 -2
- package/lib/util/hash/wasm-hash.js +4 -2
- package/lib/util/identifier.js +13 -12
- package/lib/util/internalSerializables.js +2 -0
- package/lib/util/magicComment.js +5 -5
- package/lib/util/processAsyncTree.js +1 -1
- package/lib/util/propertyAccess.js +1 -1
- package/lib/util/propertyName.js +1 -1
- package/lib/util/registerExternalSerializer.js +1 -2
- package/lib/util/removeBOM.js +1 -1
- package/lib/util/runtime.js +29 -21
- package/lib/util/semver.js +1 -1
- package/lib/util/serialization.js +3 -0
- package/lib/util/source.js +3 -2
- package/lib/validateSchema.js +1 -0
- package/lib/wasm/EnableWasmLoadingPlugin.js +6 -3
- package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +4 -1
- package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +46 -49
- package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +2 -2
- package/lib/wasm-sync/WebAssemblyGenerator.js +2 -3
- package/lib/wasm-sync/WebAssemblyInInitialChunkError.js +3 -2
- package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +3 -0
- package/lib/wasm-sync/WebAssemblyUtils.js +1 -1
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +4 -22
- package/lib/webpack.js +4 -5
- package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +1 -0
- package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +6 -24
- package/lib/webworker/WebWorkerTemplatePlugin.js +1 -0
- package/package.json +119 -113
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +17 -0
- package/schemas/plugins/schemes/VirtualUrlPlugin.check.d.ts +7 -0
- package/schemas/plugins/schemes/VirtualUrlPlugin.check.js +6 -0
- package/schemas/plugins/schemes/VirtualUrlPlugin.json +77 -0
- package/types.d.ts +1230 -360
|
@@ -384,13 +384,13 @@ class DefaultStatsPresetPlugin {
|
|
|
384
384
|
const defaults = NAMED_PRESETS[/** @type {keyof NamedPresets} */ (key)];
|
|
385
385
|
compilation.hooks.statsPreset
|
|
386
386
|
.for(key)
|
|
387
|
-
.tap(PLUGIN_NAME, (options,
|
|
387
|
+
.tap(PLUGIN_NAME, (options, _context) => {
|
|
388
388
|
applyDefaults(options, defaults);
|
|
389
389
|
});
|
|
390
390
|
}
|
|
391
391
|
compilation.hooks.statsNormalize.tap(PLUGIN_NAME, (options, context) => {
|
|
392
392
|
for (const key of Object.keys(DEFAULTS)) {
|
|
393
|
-
if (options[key] === undefined)
|
|
393
|
+
if (options[key] === undefined) {
|
|
394
394
|
options[key] =
|
|
395
395
|
/** @type {Defaults[DefaultsKeys]} */
|
|
396
396
|
(DEFAULTS[/** @type {DefaultsKeys} */ (key)])(
|
|
@@ -398,6 +398,7 @@ class DefaultStatsPresetPlugin {
|
|
|
398
398
|
context,
|
|
399
399
|
compilation
|
|
400
400
|
);
|
|
401
|
+
}
|
|
401
402
|
}
|
|
402
403
|
for (const key of Object.keys(NORMALIZER)) {
|
|
403
404
|
options[key] =
|
|
@@ -408,4 +409,5 @@ class DefaultStatsPresetPlugin {
|
|
|
408
409
|
});
|
|
409
410
|
}
|
|
410
411
|
}
|
|
412
|
+
|
|
411
413
|
module.exports = DefaultStatsPresetPlugin;
|
|
@@ -277,8 +277,9 @@ const COMPILATION_SIMPLE_PRINTERS = {
|
|
|
277
277
|
(errorsCount === 0 && warningsCount === 0) ||
|
|
278
278
|
timeMessage ||
|
|
279
279
|
hashMessage
|
|
280
|
-
)
|
|
280
|
+
) {
|
|
281
281
|
return `${builtAtMessage}${subjectMessage} ${statusMessage}${timeMessage}${hashMessage}`;
|
|
282
|
+
}
|
|
282
283
|
},
|
|
283
284
|
"compilation.filteredWarningDetailsCount": count =>
|
|
284
285
|
count
|
|
@@ -493,7 +494,7 @@ const MODULE_SIMPLE_PRINTERS = {
|
|
|
493
494
|
const [prefix, resource] = getModuleName(name);
|
|
494
495
|
return `${prefix || ""}${bold(resource || "")}`;
|
|
495
496
|
},
|
|
496
|
-
"module.identifier":
|
|
497
|
+
"module.identifier": _identifier => undefined,
|
|
497
498
|
"module.layer": (layer, { formatLayer }) =>
|
|
498
499
|
layer ? formatLayer(layer) : undefined,
|
|
499
500
|
"module.sizes": printSizes,
|
|
@@ -547,8 +548,9 @@ const MODULE_SIMPLE_PRINTERS = {
|
|
|
547
548
|
if (usedExports === null) return cyan(formatFlag("used exports unknown"));
|
|
548
549
|
if (usedExports === false) return cyan(formatFlag("module unused"));
|
|
549
550
|
if (Array.isArray(usedExports)) {
|
|
550
|
-
if (usedExports.length === 0)
|
|
551
|
+
if (usedExports.length === 0) {
|
|
551
552
|
return cyan(formatFlag("no exports used"));
|
|
553
|
+
}
|
|
552
554
|
const providedExportsCount = Array.isArray(module.providedExports)
|
|
553
555
|
? module.providedExports.length
|
|
554
556
|
: null;
|
|
@@ -569,7 +571,7 @@ const MODULE_SIMPLE_PRINTERS = {
|
|
|
569
571
|
yellow(optimizationBailout),
|
|
570
572
|
"module.issuerPath": (issuerPath, { module }) =>
|
|
571
573
|
module.profile ? undefined : "",
|
|
572
|
-
"module.profile":
|
|
574
|
+
"module.profile": _profile => undefined,
|
|
573
575
|
"module.filteredModules": (filteredModules, { module: { modules } }) =>
|
|
574
576
|
filteredModules > 0
|
|
575
577
|
? `${moreCount(modules, filteredModules)} nested ${plural(
|
|
@@ -829,7 +831,7 @@ const ERROR_PRINTERS = {
|
|
|
829
831
|
" "
|
|
830
832
|
)
|
|
831
833
|
: undefined,
|
|
832
|
-
"error.moduleTrace":
|
|
834
|
+
"error.moduleTrace": _moduleTrace => undefined,
|
|
833
835
|
"error.separator!": () => "\n"
|
|
834
836
|
};
|
|
835
837
|
|
|
@@ -1407,15 +1409,17 @@ const SIMPLE_ELEMENT_JOINERS = {
|
|
|
1407
1409
|
items.map(item => {
|
|
1408
1410
|
switch (item.element) {
|
|
1409
1411
|
case "moduleId":
|
|
1410
|
-
if (moduleReason.moduleId === moduleReason.module && item.content)
|
|
1412
|
+
if (moduleReason.moduleId === moduleReason.module && item.content) {
|
|
1411
1413
|
hasName = true;
|
|
1414
|
+
}
|
|
1412
1415
|
break;
|
|
1413
1416
|
case "module":
|
|
1414
1417
|
if (hasName) return false;
|
|
1415
1418
|
break;
|
|
1416
1419
|
case "resolvedModule":
|
|
1417
|
-
if (moduleReason.module === moduleReason.resolvedModule)
|
|
1420
|
+
if (moduleReason.module === moduleReason.resolvedModule) {
|
|
1418
1421
|
return false;
|
|
1422
|
+
}
|
|
1419
1423
|
break;
|
|
1420
1424
|
case "children":
|
|
1421
1425
|
if (item.content) {
|
|
@@ -1564,7 +1568,7 @@ const RESULT_MODIFIER = {
|
|
|
1564
1568
|
* @returns {string[]} result
|
|
1565
1569
|
*/
|
|
1566
1570
|
const createOrder = (array, preferredOrder) => {
|
|
1567
|
-
const originalArray = array
|
|
1571
|
+
const originalArray = [...array];
|
|
1568
1572
|
/** @type {Set<string>} */
|
|
1569
1573
|
const set = new Set(array);
|
|
1570
1574
|
/** @type {Set<string>} */
|
|
@@ -1621,6 +1625,7 @@ class DefaultStatsPrinterPlugin {
|
|
|
1621
1625
|
`${start}${
|
|
1622
1626
|
typeof str === "string"
|
|
1623
1627
|
? str.replace(
|
|
1628
|
+
// eslint-disable-next-line no-control-regex
|
|
1624
1629
|
/((\u001B\[39m|\u001B\[22m|\u001B\[0m)+)/g,
|
|
1625
1630
|
`$1${start}`
|
|
1626
1631
|
)
|
|
@@ -1851,7 +1856,7 @@ class DefaultStatsPrinterPlugin {
|
|
|
1851
1856
|
const preferredOrder = PREFERRED_ORDERS[key];
|
|
1852
1857
|
stats.hooks.sortElements
|
|
1853
1858
|
.for(key)
|
|
1854
|
-
.tap(PLUGIN_NAME, (elements,
|
|
1859
|
+
.tap(PLUGIN_NAME, (elements, _context) => {
|
|
1855
1860
|
createOrder(elements, preferredOrder);
|
|
1856
1861
|
});
|
|
1857
1862
|
}
|
|
@@ -1886,4 +1891,5 @@ class DefaultStatsPrinterPlugin {
|
|
|
1886
1891
|
});
|
|
1887
1892
|
}
|
|
1888
1893
|
}
|
|
1894
|
+
|
|
1889
1895
|
module.exports = DefaultStatsPrinterPlugin;
|
|
@@ -205,7 +205,7 @@ class StatsFactory {
|
|
|
205
205
|
*/
|
|
206
206
|
_forEachLevelFilter(hookMap, cache, type, items, fn, forceClone) {
|
|
207
207
|
const hooks = this._getAllLevelHooks(hookMap, cache, type);
|
|
208
|
-
if (hooks.length === 0) return forceClone ? items
|
|
208
|
+
if (hooks.length === 0) return forceClone ? [...items] : items;
|
|
209
209
|
let i = 0;
|
|
210
210
|
return items.filter((item, idx) => {
|
|
211
211
|
for (const hook of hooks) {
|
|
@@ -236,8 +236,9 @@ class StatsFactory {
|
|
|
236
236
|
this._inCreate = true;
|
|
237
237
|
return this._create(type, data, baseContext);
|
|
238
238
|
} finally {
|
|
239
|
-
for (const key of Object.keys(this._caches))
|
|
239
|
+
for (const key of Object.keys(this._caches)) {
|
|
240
240
|
this._caches[/** @type {keyof StatsFactoryHooks} */ (key)].clear();
|
|
241
|
+
}
|
|
241
242
|
this._inCreate = false;
|
|
242
243
|
}
|
|
243
244
|
}
|
|
@@ -397,4 +398,5 @@ class StatsFactory {
|
|
|
397
398
|
);
|
|
398
399
|
}
|
|
399
400
|
}
|
|
401
|
+
|
|
400
402
|
module.exports = StatsFactory;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
|
-
const { HookMap,
|
|
8
|
+
const { HookMap, SyncBailHook, SyncWaterfallHook } = require("tapable");
|
|
9
9
|
|
|
10
10
|
/** @typedef {import("./DefaultStatsFactoryPlugin").StatsAsset} StatsAsset */
|
|
11
11
|
/** @typedef {import("./DefaultStatsFactoryPlugin").StatsChunk} StatsChunk */
|
|
@@ -217,7 +217,7 @@ class StatsPrinter {
|
|
|
217
217
|
);
|
|
218
218
|
if (printResult === undefined) {
|
|
219
219
|
if (Array.isArray(object)) {
|
|
220
|
-
const sortedItems = object
|
|
220
|
+
const sortedItems = [...object];
|
|
221
221
|
this._forEachLevel(this.hooks.sortItems, type, h =>
|
|
222
222
|
h.call(
|
|
223
223
|
sortedItems,
|
|
@@ -298,4 +298,5 @@ class StatsPrinter {
|
|
|
298
298
|
);
|
|
299
299
|
}
|
|
300
300
|
}
|
|
301
|
+
|
|
301
302
|
module.exports = StatsPrinter;
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
/*
|
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
+
Author Haijie Xie @hai-x
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
"use strict";
|
|
7
|
+
|
|
8
|
+
const { pathToFileURL } = require("url");
|
|
9
|
+
const CommentCompilationWarning = require("../CommentCompilationWarning");
|
|
10
|
+
const RuntimeGlobals = require("../RuntimeGlobals");
|
|
11
|
+
const UnsupportedFeatureWarning = require("../UnsupportedFeatureWarning");
|
|
12
|
+
const ConstDependency = require("../dependencies/ConstDependency");
|
|
13
|
+
const ContextDependencyHelpers = require("../dependencies/ContextDependencyHelpers");
|
|
14
|
+
const URLContextDependency = require("../dependencies/URLContextDependency");
|
|
15
|
+
const URLDependency = require("../dependencies/URLDependency");
|
|
16
|
+
const BasicEvaluatedExpression = require("../javascript/BasicEvaluatedExpression");
|
|
17
|
+
const { approve } = require("../javascript/JavascriptParserHelpers");
|
|
18
|
+
const InnerGraph = require("../optimize/InnerGraph");
|
|
19
|
+
|
|
20
|
+
/** @typedef {import("estree").MemberExpression} MemberExpression */
|
|
21
|
+
/** @typedef {import("estree").NewExpression} NewExpressionNode */
|
|
22
|
+
/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */
|
|
23
|
+
/** @typedef {import("../ContextModule").ContextMode} ContextMode */
|
|
24
|
+
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
|
|
25
|
+
/** @typedef {import("../NormalModule")} NormalModule */
|
|
26
|
+
/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
|
|
27
|
+
/** @typedef {import("../javascript/JavascriptParser")} Parser */
|
|
28
|
+
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
|
29
|
+
|
|
30
|
+
const PLUGIN_NAME = "URLParserPlugin";
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @param {NormalModule} module module
|
|
34
|
+
* @returns {URL} file url
|
|
35
|
+
*/
|
|
36
|
+
const getUrl = module => pathToFileURL(module.resource);
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @param {Parser} parser parser parser
|
|
40
|
+
* @param {MemberExpression} arg arg
|
|
41
|
+
* @returns {boolean} true when it is `meta.url`, otherwise false
|
|
42
|
+
*/
|
|
43
|
+
const isMetaUrl = (parser, arg) => {
|
|
44
|
+
const chain = parser.extractMemberExpressionChain(arg);
|
|
45
|
+
|
|
46
|
+
if (
|
|
47
|
+
chain.members.length !== 1 ||
|
|
48
|
+
chain.object.type !== "MetaProperty" ||
|
|
49
|
+
chain.object.meta.name !== "import" ||
|
|
50
|
+
chain.object.property.name !== "meta" ||
|
|
51
|
+
chain.members[0] !== "url"
|
|
52
|
+
) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return true;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @type {WeakMap<NewExpressionNode, BasicEvaluatedExpression | undefined>}
|
|
61
|
+
*/
|
|
62
|
+
const getEvaluatedExprCache = new WeakMap();
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @param {NewExpressionNode} expr expression
|
|
66
|
+
* @param {Parser} parser parser parser
|
|
67
|
+
* @returns {BasicEvaluatedExpression | undefined} basic evaluated expression
|
|
68
|
+
*/
|
|
69
|
+
const getEvaluatedExpr = (expr, parser) => {
|
|
70
|
+
let result = getEvaluatedExprCache.get(expr);
|
|
71
|
+
if (result !== undefined) return result;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* @returns {BasicEvaluatedExpression | undefined} basic evaluated expression
|
|
75
|
+
*/
|
|
76
|
+
const evaluate = () => {
|
|
77
|
+
if (expr.arguments.length !== 2) return;
|
|
78
|
+
|
|
79
|
+
const [arg1, arg2] = expr.arguments;
|
|
80
|
+
|
|
81
|
+
if (arg2.type !== "MemberExpression" || arg1.type === "SpreadElement") {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (!isMetaUrl(parser, arg2)) return;
|
|
85
|
+
|
|
86
|
+
return parser.evaluateExpression(arg1);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
result = evaluate();
|
|
90
|
+
getEvaluatedExprCache.set(expr, result);
|
|
91
|
+
|
|
92
|
+
return result;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
class URLParserPlugin {
|
|
96
|
+
/**
|
|
97
|
+
* @param {JavascriptParserOptions} options options
|
|
98
|
+
*/
|
|
99
|
+
constructor(options) {
|
|
100
|
+
this.options = options;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* @param {JavascriptParser} parser the parser
|
|
105
|
+
* @returns {void}
|
|
106
|
+
*/
|
|
107
|
+
apply(parser) {
|
|
108
|
+
const relative = this.options.url === "relative";
|
|
109
|
+
|
|
110
|
+
parser.hooks.canRename.for("URL").tap(PLUGIN_NAME, approve);
|
|
111
|
+
parser.hooks.evaluateNewExpression.for("URL").tap(PLUGIN_NAME, expr => {
|
|
112
|
+
const evaluatedExpr = getEvaluatedExpr(expr, parser);
|
|
113
|
+
const request = evaluatedExpr && evaluatedExpr.asString();
|
|
114
|
+
|
|
115
|
+
if (!request) return;
|
|
116
|
+
const url = new URL(request, getUrl(parser.state.module));
|
|
117
|
+
|
|
118
|
+
return new BasicEvaluatedExpression()
|
|
119
|
+
.setString(url.toString())
|
|
120
|
+
.setRange(/** @type {Range} */ (expr.range));
|
|
121
|
+
});
|
|
122
|
+
parser.hooks.new.for("URL").tap(PLUGIN_NAME, _expr => {
|
|
123
|
+
const expr = /** @type {NewExpressionNode} */ (_expr);
|
|
124
|
+
const { options: importOptions, errors: commentErrors } =
|
|
125
|
+
parser.parseCommentOptions(/** @type {Range} */ (expr.range));
|
|
126
|
+
|
|
127
|
+
if (commentErrors) {
|
|
128
|
+
for (const e of commentErrors) {
|
|
129
|
+
const { comment } = e;
|
|
130
|
+
parser.state.module.addWarning(
|
|
131
|
+
new CommentCompilationWarning(
|
|
132
|
+
`Compilation error while processing magic comment(-s): /*${comment.value}*/: ${e.message}`,
|
|
133
|
+
/** @type {DependencyLocation} */ (comment.loc)
|
|
134
|
+
)
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (importOptions && importOptions.webpackIgnore !== undefined) {
|
|
140
|
+
if (typeof importOptions.webpackIgnore !== "boolean") {
|
|
141
|
+
parser.state.module.addWarning(
|
|
142
|
+
new UnsupportedFeatureWarning(
|
|
143
|
+
`\`webpackIgnore\` expected a boolean, but received: ${importOptions.webpackIgnore}.`,
|
|
144
|
+
/** @type {DependencyLocation} */ (expr.loc)
|
|
145
|
+
)
|
|
146
|
+
);
|
|
147
|
+
return;
|
|
148
|
+
} else if (importOptions.webpackIgnore) {
|
|
149
|
+
if (expr.arguments.length !== 2) return;
|
|
150
|
+
|
|
151
|
+
const [, arg2] = expr.arguments;
|
|
152
|
+
|
|
153
|
+
if (arg2.type !== "MemberExpression" || !isMetaUrl(parser, arg2)) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const dep = new ConstDependency(
|
|
158
|
+
RuntimeGlobals.baseURI,
|
|
159
|
+
/** @type {Range} */ (arg2.range),
|
|
160
|
+
[RuntimeGlobals.baseURI]
|
|
161
|
+
);
|
|
162
|
+
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
|
|
163
|
+
parser.state.module.addPresentationalDependency(dep);
|
|
164
|
+
|
|
165
|
+
return true;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const evaluatedExpr = getEvaluatedExpr(expr, parser);
|
|
170
|
+
if (!evaluatedExpr) return;
|
|
171
|
+
|
|
172
|
+
let request;
|
|
173
|
+
|
|
174
|
+
// static URL
|
|
175
|
+
if ((request = evaluatedExpr.asString())) {
|
|
176
|
+
const [arg1, arg2] = expr.arguments;
|
|
177
|
+
const dep = new URLDependency(
|
|
178
|
+
request,
|
|
179
|
+
[
|
|
180
|
+
/** @type {Range} */ (arg1.range)[0],
|
|
181
|
+
/** @type {Range} */ (arg2.range)[1]
|
|
182
|
+
],
|
|
183
|
+
/** @type {Range} */ (expr.range),
|
|
184
|
+
relative
|
|
185
|
+
);
|
|
186
|
+
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
|
|
187
|
+
parser.state.current.addDependency(dep);
|
|
188
|
+
InnerGraph.onUsage(parser.state, e => (dep.usedByExports = e));
|
|
189
|
+
return true;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (this.options.dynamicUrl === false) return;
|
|
193
|
+
|
|
194
|
+
// context URL
|
|
195
|
+
let include;
|
|
196
|
+
let exclude;
|
|
197
|
+
|
|
198
|
+
if (importOptions) {
|
|
199
|
+
if (importOptions.webpackInclude !== undefined) {
|
|
200
|
+
if (
|
|
201
|
+
!importOptions.webpackInclude ||
|
|
202
|
+
!(importOptions.webpackInclude instanceof RegExp)
|
|
203
|
+
) {
|
|
204
|
+
parser.state.module.addWarning(
|
|
205
|
+
new UnsupportedFeatureWarning(
|
|
206
|
+
`\`webpackInclude\` expected a regular expression, but received: ${importOptions.webpackInclude}.`,
|
|
207
|
+
/** @type {DependencyLocation} */ (expr.loc)
|
|
208
|
+
)
|
|
209
|
+
);
|
|
210
|
+
} else {
|
|
211
|
+
include = importOptions.webpackInclude;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
if (importOptions.webpackExclude !== undefined) {
|
|
215
|
+
if (
|
|
216
|
+
!importOptions.webpackExclude ||
|
|
217
|
+
!(importOptions.webpackExclude instanceof RegExp)
|
|
218
|
+
) {
|
|
219
|
+
parser.state.module.addWarning(
|
|
220
|
+
new UnsupportedFeatureWarning(
|
|
221
|
+
`\`webpackExclude\` expected a regular expression, but received: ${importOptions.webpackExclude}.`,
|
|
222
|
+
/** @type {DependencyLocation} */ (expr.loc)
|
|
223
|
+
)
|
|
224
|
+
);
|
|
225
|
+
} else {
|
|
226
|
+
exclude = importOptions.webpackExclude;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
const dep = ContextDependencyHelpers.create(
|
|
231
|
+
URLContextDependency,
|
|
232
|
+
/** @type {Range} */ (expr.range),
|
|
233
|
+
evaluatedExpr,
|
|
234
|
+
expr,
|
|
235
|
+
this.options,
|
|
236
|
+
{
|
|
237
|
+
include,
|
|
238
|
+
exclude,
|
|
239
|
+
mode: "sync",
|
|
240
|
+
typePrefix: "new URL with import.meta.url",
|
|
241
|
+
category: "url"
|
|
242
|
+
},
|
|
243
|
+
parser
|
|
244
|
+
);
|
|
245
|
+
if (!dep) return;
|
|
246
|
+
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
|
|
247
|
+
dep.optional = Boolean(parser.scope.inTry);
|
|
248
|
+
parser.state.current.addDependency(dep);
|
|
249
|
+
return true;
|
|
250
|
+
});
|
|
251
|
+
parser.hooks.isPure.for("NewExpression").tap(PLUGIN_NAME, _expr => {
|
|
252
|
+
const expr = /** @type {NewExpressionNode} */ (_expr);
|
|
253
|
+
const { callee } = expr;
|
|
254
|
+
if (callee.type !== "Identifier") return;
|
|
255
|
+
const calleeInfo = parser.getFreeInfoFromVariable(callee.name);
|
|
256
|
+
if (!calleeInfo || calleeInfo.name !== "URL") return;
|
|
257
|
+
|
|
258
|
+
const evaluatedExpr = getEvaluatedExpr(expr, parser);
|
|
259
|
+
const request = evaluatedExpr && evaluatedExpr.asString();
|
|
260
|
+
|
|
261
|
+
if (request) return true;
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
module.exports = URLParserPlugin;
|
package/lib/util/ArrayQueue.js
CHANGED
package/lib/util/AsyncQueue.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
|
-
const {
|
|
8
|
+
const { AsyncSeriesHook, SyncHook } = require("tapable");
|
|
9
9
|
const { makeWebpackError } = require("../HookWebpackError");
|
|
10
10
|
const WebpackError = require("../WebpackError");
|
|
11
11
|
const ArrayQueue = require("./ArrayQueue");
|
package/lib/util/Hash.js
CHANGED
|
@@ -16,6 +16,7 @@ class Hash {
|
|
|
16
16
|
*/
|
|
17
17
|
update(data, inputEncoding) {
|
|
18
18
|
const AbstractMethodError = require("../AbstractMethodError");
|
|
19
|
+
|
|
19
20
|
throw new AbstractMethodError();
|
|
20
21
|
}
|
|
21
22
|
|
|
@@ -28,6 +29,7 @@ class Hash {
|
|
|
28
29
|
*/
|
|
29
30
|
digest(encoding) {
|
|
30
31
|
const AbstractMethodError = require("../AbstractMethodError");
|
|
32
|
+
|
|
31
33
|
throw new AbstractMethodError();
|
|
32
34
|
}
|
|
33
35
|
}
|
|
@@ -225,8 +225,9 @@ class LazyBucketSortedSet {
|
|
|
225
225
|
* @returns {void}
|
|
226
226
|
*/
|
|
227
227
|
_appendIterators(iterators) {
|
|
228
|
-
if (this._unsortedItems.size > 0)
|
|
228
|
+
if (this._unsortedItems.size > 0) {
|
|
229
229
|
iterators.push(this._unsortedItems[Symbol.iterator]());
|
|
230
|
+
}
|
|
230
231
|
for (const key of this._keys) {
|
|
231
232
|
const entry = this._map.get(key);
|
|
232
233
|
if (this._leaf) {
|
package/lib/util/LazySet.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
|
-
const makeSerializable = require("./makeSerializable
|
|
8
|
+
const makeSerializable = require("./makeSerializable");
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* @template T
|
|
@@ -39,6 +39,11 @@ const flatten = (targetSet, toDeepMerge) => {
|
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
+
/**
|
|
43
|
+
* @template T
|
|
44
|
+
* @typedef {import("typescript-iterable").SetIterator<T>} SetIterator
|
|
45
|
+
*/
|
|
46
|
+
|
|
42
47
|
/**
|
|
43
48
|
* Like Set but with an addAll method to eventually add items from another iterable.
|
|
44
49
|
* Access methods make sure that all delayed operations are executed.
|
|
@@ -139,7 +144,7 @@ class LazySet {
|
|
|
139
144
|
}
|
|
140
145
|
|
|
141
146
|
/**
|
|
142
|
-
* @returns {
|
|
147
|
+
* @returns {SetIterator<[T, T]>} entries
|
|
143
148
|
*/
|
|
144
149
|
entries() {
|
|
145
150
|
this._deopt = true;
|
|
@@ -156,7 +161,7 @@ class LazySet {
|
|
|
156
161
|
forEach(callbackFn, thisArg) {
|
|
157
162
|
this._deopt = true;
|
|
158
163
|
if (this._needMerge) this._merge();
|
|
159
|
-
// eslint-disable-next-line unicorn/no-array-for-each
|
|
164
|
+
// eslint-disable-next-line unicorn/no-array-for-each, unicorn/no-array-method-this-argument
|
|
160
165
|
this._set.forEach(callbackFn, thisArg);
|
|
161
166
|
}
|
|
162
167
|
|
|
@@ -170,7 +175,7 @@ class LazySet {
|
|
|
170
175
|
}
|
|
171
176
|
|
|
172
177
|
/**
|
|
173
|
-
* @returns {
|
|
178
|
+
* @returns {SetIterator<T>} keys
|
|
174
179
|
*/
|
|
175
180
|
keys() {
|
|
176
181
|
this._deopt = true;
|
|
@@ -179,7 +184,7 @@ class LazySet {
|
|
|
179
184
|
}
|
|
180
185
|
|
|
181
186
|
/**
|
|
182
|
-
* @returns {
|
|
187
|
+
* @returns {SetIterator<T>} values
|
|
183
188
|
*/
|
|
184
189
|
values() {
|
|
185
190
|
this._deopt = true;
|
|
@@ -188,7 +193,7 @@ class LazySet {
|
|
|
188
193
|
}
|
|
189
194
|
|
|
190
195
|
/**
|
|
191
|
-
* @returns {
|
|
196
|
+
* @returns {SetIterator<T>} iterable iterator
|
|
192
197
|
*/
|
|
193
198
|
[Symbol.iterator]() {
|
|
194
199
|
this._deopt = true;
|
|
@@ -31,7 +31,7 @@ class ParallelismFactorCalculator {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
calculate() {
|
|
34
|
-
const segments =
|
|
34
|
+
const segments = [...new Set(this._rangePoints)].sort((a, b) =>
|
|
35
35
|
a < b ? -1 : 1
|
|
36
36
|
);
|
|
37
37
|
const parallelism = segments.map(() => 0);
|
package/lib/util/SetHelpers.js
CHANGED
|
@@ -87,8 +87,8 @@ const combine = (a, b) => {
|
|
|
87
87
|
return set;
|
|
88
88
|
};
|
|
89
89
|
|
|
90
|
-
module.exports.
|
|
91
|
-
module.exports.isSubset = isSubset;
|
|
90
|
+
module.exports.combine = combine;
|
|
92
91
|
module.exports.find = find;
|
|
93
92
|
module.exports.first = first;
|
|
94
|
-
module.exports.
|
|
93
|
+
module.exports.intersect = intersect;
|
|
94
|
+
module.exports.isSubset = isSubset;
|
package/lib/util/SortableSet.js
CHANGED
|
@@ -88,7 +88,7 @@ class SortableSet extends Set {
|
|
|
88
88
|
return;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
const sortedArray =
|
|
91
|
+
const sortedArray = [...this].sort(sortFn);
|
|
92
92
|
super.clear();
|
|
93
93
|
for (let i = 0; i < sortedArray.length; i += 1) {
|
|
94
94
|
super.add(sortedArray[i]);
|
|
@@ -168,7 +168,7 @@ class SortableSet extends Set {
|
|
|
168
168
|
* @returns {T[]} the raw array
|
|
169
169
|
*/
|
|
170
170
|
toJSON() {
|
|
171
|
-
return
|
|
171
|
+
return [...this];
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
|
+
new Map().entries();
|
|
9
|
+
|
|
8
10
|
/**
|
|
9
11
|
* The StackedCacheMap is a data structure designed as an alternative to a Map
|
|
10
12
|
* in situations where you need to handle multiple item additions and
|
|
@@ -128,7 +130,7 @@ class StackedCacheMap {
|
|
|
128
130
|
next() {
|
|
129
131
|
let result = current.next();
|
|
130
132
|
while (result.done && iterators.length > 0) {
|
|
131
|
-
current = /** @type {
|
|
133
|
+
current = /** @type {MapIterator<[K, V]>} */ (iterators.pop());
|
|
132
134
|
result = current.next();
|
|
133
135
|
}
|
|
134
136
|
return result;
|
package/lib/util/StackedMap.js
CHANGED
|
@@ -45,7 +45,7 @@ class StackedMap {
|
|
|
45
45
|
/** @type {Map<K, InternalCell<V>>} */
|
|
46
46
|
this.map = new Map();
|
|
47
47
|
/** @type {Map<K, InternalCell<V>>[]} */
|
|
48
|
-
this.stack = parentStack === undefined ? [] : parentStack
|
|
48
|
+
this.stack = parentStack === undefined ? [] : [...parentStack];
|
|
49
49
|
this.stack.push(this.map);
|
|
50
50
|
}
|
|
51
51
|
|
|
@@ -134,7 +134,7 @@ class StackedMap {
|
|
|
134
134
|
|
|
135
135
|
asArray() {
|
|
136
136
|
this._compress();
|
|
137
|
-
return
|
|
137
|
+
return [...this.map.keys()];
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
asSet() {
|
package/lib/util/StringXor.js
CHANGED
package/lib/util/TupleSet.js
CHANGED