webpack 5.99.8 → 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/README.md +0 -3
- 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/CacheFacade.js +2 -1
- package/lib/CaseSensitiveModulesWarning.js +4 -4
- package/lib/Chunk.js +6 -6
- package/lib/ChunkGraph.js +37 -32
- package/lib/ChunkGroup.js +17 -10
- 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 +77 -71
- package/lib/Compiler.js +46 -16
- package/lib/ConcatenationScope.js +15 -6
- package/lib/ConstPlugin.js +65 -45
- package/lib/ContextModule.js +16 -12
- package/lib/ContextModuleFactory.js +4 -3
- package/lib/ContextReplacementPlugin.js +4 -2
- package/lib/CssModule.js +2 -3
- package/lib/DefinePlugin.js +111 -3
- package/lib/DelegatedModuleFactoryPlugin.js +18 -18
- package/lib/Dependency.js +16 -12
- 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 -38
- 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 +61 -56
- package/lib/NormalModuleFactory.js +52 -37
- 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 +34 -8
- 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 +26 -21
- package/lib/asset/AssetModulesPlugin.js +19 -17
- package/lib/asset/AssetSourceGenerator.js +11 -9
- 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/CssUrlDependency.js +1 -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/ModuleDependency.js +1 -1
- package/lib/dependencies/ModuleDependencyTemplateAsRequireId.js +1 -0
- package/lib/dependencies/RequireContextPlugin.js +3 -1
- package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +3 -0
- 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/URLDependency.js +1 -1
- 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 +73 -6
- 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 +136 -81
- 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/ModuleLibraryPlugin.js +4 -1
- 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 +6 -3
- 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 +7 -4
- 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/DataUriPlugin.js +3 -1
- 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 +6 -3
- 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 +28 -22
- 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 +121 -114
- 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 +1261 -366
package/lib/FileSystemInfo.js
CHANGED
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
|
-
const { create: createResolver } = require("enhanced-resolve");
|
|
9
8
|
const nodeModule = require("module");
|
|
10
|
-
const asyncLib = require("neo-async");
|
|
11
9
|
const { isAbsolute } = require("path");
|
|
10
|
+
const { create: createResolver } = require("enhanced-resolve");
|
|
11
|
+
const asyncLib = require("neo-async");
|
|
12
12
|
const { DEFAULTS } = require("./config/defaults");
|
|
13
13
|
const AsyncQueue = require("./util/AsyncQueue");
|
|
14
14
|
const StackedCacheMap = require("./util/StackedCacheMap");
|
|
15
15
|
const createHash = require("./util/createHash");
|
|
16
|
-
const { join,
|
|
16
|
+
const { dirname, join, lstatReadlinkAbsolute, relative } = require("./util/fs");
|
|
17
17
|
const makeSerializable = require("./util/makeSerializable");
|
|
18
18
|
const processAsyncTree = require("./util/processAsyncTree");
|
|
19
19
|
|
|
@@ -313,7 +313,7 @@ class Snapshot {
|
|
|
313
313
|
* @param {number} value start value
|
|
314
314
|
*/
|
|
315
315
|
setStartTime(value) {
|
|
316
|
-
this._flags
|
|
316
|
+
this._flags |= 1;
|
|
317
317
|
this.startTime = value;
|
|
318
318
|
}
|
|
319
319
|
|
|
@@ -350,7 +350,7 @@ class Snapshot {
|
|
|
350
350
|
* @param {FileTimestamps} value file timestamps
|
|
351
351
|
*/
|
|
352
352
|
setFileTimestamps(value) {
|
|
353
|
-
this._flags
|
|
353
|
+
this._flags |= 2;
|
|
354
354
|
this.fileTimestamps = value;
|
|
355
355
|
}
|
|
356
356
|
|
|
@@ -362,7 +362,7 @@ class Snapshot {
|
|
|
362
362
|
* @param {FileHashes} value file hashes
|
|
363
363
|
*/
|
|
364
364
|
setFileHashes(value) {
|
|
365
|
-
this._flags
|
|
365
|
+
this._flags |= 4;
|
|
366
366
|
this.fileHashes = value;
|
|
367
367
|
}
|
|
368
368
|
|
|
@@ -374,7 +374,7 @@ class Snapshot {
|
|
|
374
374
|
* @param {FileTshs} value file tshs
|
|
375
375
|
*/
|
|
376
376
|
setFileTshs(value) {
|
|
377
|
-
this._flags
|
|
377
|
+
this._flags |= 8;
|
|
378
378
|
this.fileTshs = value;
|
|
379
379
|
}
|
|
380
380
|
|
|
@@ -386,7 +386,7 @@ class Snapshot {
|
|
|
386
386
|
* @param {ContextTimestamps} value context timestamps
|
|
387
387
|
*/
|
|
388
388
|
setContextTimestamps(value) {
|
|
389
|
-
this._flags
|
|
389
|
+
this._flags |= 0x10;
|
|
390
390
|
this.contextTimestamps = value;
|
|
391
391
|
}
|
|
392
392
|
|
|
@@ -398,7 +398,7 @@ class Snapshot {
|
|
|
398
398
|
* @param {ContextHashes} value context hashes
|
|
399
399
|
*/
|
|
400
400
|
setContextHashes(value) {
|
|
401
|
-
this._flags
|
|
401
|
+
this._flags |= 0x20;
|
|
402
402
|
this.contextHashes = value;
|
|
403
403
|
}
|
|
404
404
|
|
|
@@ -410,7 +410,7 @@ class Snapshot {
|
|
|
410
410
|
* @param {ContextTshs} value context tshs
|
|
411
411
|
*/
|
|
412
412
|
setContextTshs(value) {
|
|
413
|
-
this._flags
|
|
413
|
+
this._flags |= 0x40;
|
|
414
414
|
this.contextTshs = value;
|
|
415
415
|
}
|
|
416
416
|
|
|
@@ -422,7 +422,7 @@ class Snapshot {
|
|
|
422
422
|
* @param {MissingExistence} value context tshs
|
|
423
423
|
*/
|
|
424
424
|
setMissingExistence(value) {
|
|
425
|
-
this._flags
|
|
425
|
+
this._flags |= 0x80;
|
|
426
426
|
this.missingExistence = value;
|
|
427
427
|
}
|
|
428
428
|
|
|
@@ -434,7 +434,7 @@ class Snapshot {
|
|
|
434
434
|
* @param {ManagedItemInfo} value managed item info
|
|
435
435
|
*/
|
|
436
436
|
setManagedItemInfo(value) {
|
|
437
|
-
this._flags
|
|
437
|
+
this._flags |= 0x100;
|
|
438
438
|
this.managedItemInfo = value;
|
|
439
439
|
}
|
|
440
440
|
|
|
@@ -446,7 +446,7 @@ class Snapshot {
|
|
|
446
446
|
* @param {ManagedFiles} value managed files
|
|
447
447
|
*/
|
|
448
448
|
setManagedFiles(value) {
|
|
449
|
-
this._flags
|
|
449
|
+
this._flags |= 0x200;
|
|
450
450
|
this.managedFiles = value;
|
|
451
451
|
}
|
|
452
452
|
|
|
@@ -458,7 +458,7 @@ class Snapshot {
|
|
|
458
458
|
* @param {ManagedContexts} value managed contexts
|
|
459
459
|
*/
|
|
460
460
|
setManagedContexts(value) {
|
|
461
|
-
this._flags
|
|
461
|
+
this._flags |= 0x400;
|
|
462
462
|
this.managedContexts = value;
|
|
463
463
|
}
|
|
464
464
|
|
|
@@ -470,7 +470,7 @@ class Snapshot {
|
|
|
470
470
|
* @param {ManagedMissing} value managed missing
|
|
471
471
|
*/
|
|
472
472
|
setManagedMissing(value) {
|
|
473
|
-
this._flags
|
|
473
|
+
this._flags |= 0x800;
|
|
474
474
|
this.managedMissing = value;
|
|
475
475
|
}
|
|
476
476
|
|
|
@@ -482,7 +482,7 @@ class Snapshot {
|
|
|
482
482
|
* @param {Children} value children
|
|
483
483
|
*/
|
|
484
484
|
setChildren(value) {
|
|
485
|
-
this._flags
|
|
485
|
+
this._flags |= 0x1000;
|
|
486
486
|
this.children = value;
|
|
487
487
|
}
|
|
488
488
|
|
|
@@ -708,7 +708,6 @@ class SnapshotOptimization {
|
|
|
708
708
|
};
|
|
709
709
|
}
|
|
710
710
|
this._map.set(path, newOptimizationEntry);
|
|
711
|
-
continue;
|
|
712
711
|
} else {
|
|
713
712
|
optimizationEntries.add(optimizationEntry);
|
|
714
713
|
}
|
|
@@ -742,7 +741,6 @@ class SnapshotOptimization {
|
|
|
742
741
|
continue optimizationEntriesLabel;
|
|
743
742
|
}
|
|
744
743
|
nonSharedFiles.add(path);
|
|
745
|
-
continue;
|
|
746
744
|
}
|
|
747
745
|
}
|
|
748
746
|
if (nonSharedFiles.size === 0) {
|
|
@@ -794,8 +792,9 @@ class SnapshotOptimization {
|
|
|
794
792
|
snapshotContent: new Set(commonMap.keys()),
|
|
795
793
|
children: undefined
|
|
796
794
|
};
|
|
797
|
-
if (optimizationEntry.children === undefined)
|
|
795
|
+
if (optimizationEntry.children === undefined) {
|
|
798
796
|
optimizationEntry.children = new Set();
|
|
797
|
+
}
|
|
799
798
|
optimizationEntry.children.add(newEntry);
|
|
800
799
|
storeOptimizationEntry(newEntry);
|
|
801
800
|
this._statSharedSnapshots++;
|
|
@@ -874,8 +873,9 @@ class SnapshotOptimization {
|
|
|
874
873
|
* @returns {string} result
|
|
875
874
|
*/
|
|
876
875
|
const parseString = str => {
|
|
877
|
-
if (str[0] === "'" || str[0] === "`")
|
|
876
|
+
if (str[0] === "'" || str[0] === "`") {
|
|
878
877
|
str = `"${str.slice(1, -1).replace(/"/g, '\\"')}"`;
|
|
878
|
+
}
|
|
879
879
|
return JSON.parse(str);
|
|
880
880
|
};
|
|
881
881
|
|
|
@@ -1199,7 +1199,7 @@ class FileSystemInfo {
|
|
|
1199
1199
|
parallelism: 10,
|
|
1200
1200
|
processor: this._getManagedItemDirectoryInfo.bind(this)
|
|
1201
1201
|
});
|
|
1202
|
-
const _unmanagedPaths =
|
|
1202
|
+
const _unmanagedPaths = [...unmanagedPaths];
|
|
1203
1203
|
this.unmanagedPathsWithSlash =
|
|
1204
1204
|
/** @type {string[]} */
|
|
1205
1205
|
(_unmanagedPaths.filter(p => typeof p === "string")).map(p =>
|
|
@@ -1209,7 +1209,7 @@ class FileSystemInfo {
|
|
|
1209
1209
|
/** @type {RegExp[]} */
|
|
1210
1210
|
(_unmanagedPaths.filter(p => typeof p !== "string"));
|
|
1211
1211
|
|
|
1212
|
-
this.managedPaths =
|
|
1212
|
+
this.managedPaths = [...managedPaths];
|
|
1213
1213
|
this.managedPathsWithSlash =
|
|
1214
1214
|
/** @type {string[]} */
|
|
1215
1215
|
(this.managedPaths.filter(p => typeof p === "string")).map(p =>
|
|
@@ -1219,7 +1219,7 @@ class FileSystemInfo {
|
|
|
1219
1219
|
this.managedPathsRegExps =
|
|
1220
1220
|
/** @type {RegExp[]} */
|
|
1221
1221
|
(this.managedPaths.filter(p => typeof p !== "string"));
|
|
1222
|
-
this.immutablePaths =
|
|
1222
|
+
this.immutablePaths = [...immutablePaths];
|
|
1223
1223
|
this.immutablePathsWithSlash =
|
|
1224
1224
|
/** @type {string[]} */
|
|
1225
1225
|
(this.immutablePaths.filter(p => typeof p === "string")).map(p =>
|
|
@@ -1477,16 +1477,18 @@ class FileSystemInfo {
|
|
|
1477
1477
|
const cache = this._contextHashes.get(path);
|
|
1478
1478
|
if (cache !== undefined) {
|
|
1479
1479
|
const resolved = getResolvedHash(cache);
|
|
1480
|
-
if (resolved !== undefined)
|
|
1480
|
+
if (resolved !== undefined) {
|
|
1481
1481
|
return callback(null, /** @type {string} */ (resolved));
|
|
1482
|
+
}
|
|
1482
1483
|
return this._resolveContextHash(cache, callback);
|
|
1483
1484
|
}
|
|
1484
1485
|
this.contextHashQueue.add(path, (err, _entry) => {
|
|
1485
1486
|
if (err) return callback(err);
|
|
1486
1487
|
const entry = /** @type {ContextHash} */ (_entry);
|
|
1487
1488
|
const resolved = getResolvedHash(entry);
|
|
1488
|
-
if (resolved !== undefined)
|
|
1489
|
+
if (resolved !== undefined) {
|
|
1489
1490
|
return callback(null, /** @type {string} */ (resolved));
|
|
1491
|
+
}
|
|
1490
1492
|
this._resolveContextHash(entry, callback);
|
|
1491
1493
|
});
|
|
1492
1494
|
}
|
|
@@ -1895,8 +1897,9 @@ class FileSystemInfo {
|
|
|
1895
1897
|
});
|
|
1896
1898
|
}
|
|
1897
1899
|
let request = subPath.replace(/\\/g, "/");
|
|
1898
|
-
if (request.endsWith(".js"))
|
|
1900
|
+
if (request.endsWith(".js")) {
|
|
1899
1901
|
request = request.slice(0, -3);
|
|
1902
|
+
}
|
|
1900
1903
|
push({
|
|
1901
1904
|
type: RBDT_RESOLVE_CJS_FILE_AS_CHILD,
|
|
1902
1905
|
context,
|
|
@@ -1931,7 +1934,9 @@ class FileSystemInfo {
|
|
|
1931
1934
|
);
|
|
1932
1935
|
this._warnAboutExperimentalEsmTracking = true;
|
|
1933
1936
|
}
|
|
1937
|
+
|
|
1934
1938
|
const lexer = require("es-module-lexer");
|
|
1939
|
+
|
|
1935
1940
|
lexer.init.then(() => {
|
|
1936
1941
|
this.fs.readFile(path, (err, content) => {
|
|
1937
1942
|
if (err) return callback(err);
|
|
@@ -1945,11 +1950,11 @@ class FileSystemInfo {
|
|
|
1945
1950
|
if (imp.d === -1) {
|
|
1946
1951
|
// import ... from "..."
|
|
1947
1952
|
dependency = parseString(
|
|
1948
|
-
source.
|
|
1953
|
+
source.slice(imp.s - 1, imp.e + 1)
|
|
1949
1954
|
);
|
|
1950
1955
|
} else if (imp.d > -1) {
|
|
1951
1956
|
// import()
|
|
1952
|
-
const expr = source.
|
|
1957
|
+
const expr = source.slice(imp.s, imp.e).trim();
|
|
1953
1958
|
dependency = parseString(expr);
|
|
1954
1959
|
} else {
|
|
1955
1960
|
// e.g. import.meta
|
|
@@ -1969,7 +1974,7 @@ class FileSystemInfo {
|
|
|
1969
1974
|
});
|
|
1970
1975
|
} catch (err1) {
|
|
1971
1976
|
logger.warn(
|
|
1972
|
-
`Parsing of ${path} for build dependencies failed at 'import(${source.
|
|
1977
|
+
`Parsing of ${path} for build dependencies failed at 'import(${source.slice(
|
|
1973
1978
|
imp.s,
|
|
1974
1979
|
imp.e
|
|
1975
1980
|
)})'.\n` +
|
|
@@ -2027,7 +2032,8 @@ class FileSystemInfo {
|
|
|
2027
2032
|
let packageData;
|
|
2028
2033
|
try {
|
|
2029
2034
|
packageData = JSON.parse(
|
|
2030
|
-
/** @type {Buffer} */
|
|
2035
|
+
/** @type {Buffer} */
|
|
2036
|
+
(content).toString("utf8")
|
|
2031
2037
|
);
|
|
2032
2038
|
} catch (parseErr) {
|
|
2033
2039
|
return callback(/** @type {Error} */ (parseErr));
|
|
@@ -2101,8 +2107,9 @@ class FileSystemInfo {
|
|
|
2101
2107
|
switch (type) {
|
|
2102
2108
|
case "d":
|
|
2103
2109
|
resolveContext(context, path, {}, (err, _, result) => {
|
|
2104
|
-
if (expectedResult === false)
|
|
2110
|
+
if (expectedResult === false) {
|
|
2105
2111
|
return callback(err ? undefined : INVALID);
|
|
2112
|
+
}
|
|
2106
2113
|
if (err) return callback(err);
|
|
2107
2114
|
const resultPath = /** @type {ResolveRequest} */ (result).path;
|
|
2108
2115
|
if (resultPath !== expectedResult) return callback(INVALID);
|
|
@@ -2111,8 +2118,9 @@ class FileSystemInfo {
|
|
|
2111
2118
|
break;
|
|
2112
2119
|
case "f":
|
|
2113
2120
|
resolveCjs(context, path, {}, (err, _, result) => {
|
|
2114
|
-
if (expectedResult === false)
|
|
2121
|
+
if (expectedResult === false) {
|
|
2115
2122
|
return callback(err ? undefined : INVALID);
|
|
2123
|
+
}
|
|
2116
2124
|
if (err) return callback(err);
|
|
2117
2125
|
const resultPath = /** @type {ResolveRequest} */ (result).path;
|
|
2118
2126
|
if (resultPath !== expectedResult) return callback(INVALID);
|
|
@@ -2121,8 +2129,9 @@ class FileSystemInfo {
|
|
|
2121
2129
|
break;
|
|
2122
2130
|
case "c":
|
|
2123
2131
|
resolveCjsAsChild(context, path, {}, (err, _, result) => {
|
|
2124
|
-
if (expectedResult === false)
|
|
2132
|
+
if (expectedResult === false) {
|
|
2125
2133
|
return callback(err ? undefined : INVALID);
|
|
2134
|
+
}
|
|
2126
2135
|
if (err) return callback(err);
|
|
2127
2136
|
const resultPath = /** @type {ResolveRequest} */ (result).path;
|
|
2128
2137
|
if (resultPath !== expectedResult) return callback(INVALID);
|
|
@@ -2131,8 +2140,9 @@ class FileSystemInfo {
|
|
|
2131
2140
|
break;
|
|
2132
2141
|
case "e":
|
|
2133
2142
|
resolveEsm(context, path, {}, (err, _, result) => {
|
|
2134
|
-
if (expectedResult === false)
|
|
2143
|
+
if (expectedResult === false) {
|
|
2135
2144
|
return callback(err ? undefined : INVALID);
|
|
2145
|
+
}
|
|
2136
2146
|
if (err) return callback(err);
|
|
2137
2147
|
const resultPath = /** @type {ResolveRequest} */ (result).path;
|
|
2138
2148
|
if (resultPath !== expectedResult) return callback(INVALID);
|
|
@@ -3517,8 +3527,9 @@ class FileSystemInfo {
|
|
|
3517
3527
|
fromFile: (file, stat, callback) => {
|
|
3518
3528
|
// Prefer the cached value over our new stat to report consistent results
|
|
3519
3529
|
const cache = this._fileTimestamps.get(file);
|
|
3520
|
-
if (cache !== undefined)
|
|
3530
|
+
if (cache !== undefined) {
|
|
3521
3531
|
return callback(null, cache === "ignore" ? null : cache);
|
|
3532
|
+
}
|
|
3522
3533
|
|
|
3523
3534
|
const mtime = Number(stat.mtime);
|
|
3524
3535
|
|
|
@@ -4031,7 +4042,7 @@ class FileSystemInfo {
|
|
|
4031
4042
|
}
|
|
4032
4043
|
let data;
|
|
4033
4044
|
try {
|
|
4034
|
-
data = JSON.parse(/** @type {Buffer} */ (content).toString("
|
|
4045
|
+
data = JSON.parse(/** @type {Buffer} */ (content).toString("utf8"));
|
|
4035
4046
|
} catch (parseErr) {
|
|
4036
4047
|
return callback(/** @type {WebpackError} */ (parseErr));
|
|
4037
4048
|
}
|
|
@@ -4050,8 +4061,9 @@ class FileSystemInfo {
|
|
|
4050
4061
|
}
|
|
4051
4062
|
|
|
4052
4063
|
getDeprecatedFileTimestamps() {
|
|
4053
|
-
if (this._cachedDeprecatedFileTimestamps !== undefined)
|
|
4064
|
+
if (this._cachedDeprecatedFileTimestamps !== undefined) {
|
|
4054
4065
|
return this._cachedDeprecatedFileTimestamps;
|
|
4066
|
+
}
|
|
4055
4067
|
/** @type {Map<string, number | null>} */
|
|
4056
4068
|
const map = new Map();
|
|
4057
4069
|
for (const [path, info] of this._fileTimestamps) {
|
|
@@ -4061,8 +4073,9 @@ class FileSystemInfo {
|
|
|
4061
4073
|
}
|
|
4062
4074
|
|
|
4063
4075
|
getDeprecatedContextTimestamps() {
|
|
4064
|
-
if (this._cachedDeprecatedContextTimestamps !== undefined)
|
|
4076
|
+
if (this._cachedDeprecatedContextTimestamps !== undefined) {
|
|
4065
4077
|
return this._cachedDeprecatedContextTimestamps;
|
|
4078
|
+
}
|
|
4066
4079
|
/** @type {Map<string, number | null>} */
|
|
4067
4080
|
const map = new Map();
|
|
4068
4081
|
for (const [path, info] of this._contextTimestamps) {
|
|
@@ -200,20 +200,27 @@ class FlagDependencyExportsPlugin {
|
|
|
200
200
|
name = exportNameOrSpec;
|
|
201
201
|
} else {
|
|
202
202
|
name = exportNameOrSpec.name;
|
|
203
|
-
if (exportNameOrSpec.canMangle !== undefined)
|
|
203
|
+
if (exportNameOrSpec.canMangle !== undefined) {
|
|
204
204
|
canMangle = exportNameOrSpec.canMangle;
|
|
205
|
-
|
|
205
|
+
}
|
|
206
|
+
if (exportNameOrSpec.export !== undefined) {
|
|
206
207
|
fromExport = exportNameOrSpec.export;
|
|
207
|
-
|
|
208
|
+
}
|
|
209
|
+
if (exportNameOrSpec.exports !== undefined) {
|
|
208
210
|
exports = exportNameOrSpec.exports;
|
|
209
|
-
|
|
211
|
+
}
|
|
212
|
+
if (exportNameOrSpec.from !== undefined) {
|
|
210
213
|
from = exportNameOrSpec.from;
|
|
211
|
-
|
|
214
|
+
}
|
|
215
|
+
if (exportNameOrSpec.priority !== undefined) {
|
|
212
216
|
priority = exportNameOrSpec.priority;
|
|
213
|
-
|
|
217
|
+
}
|
|
218
|
+
if (exportNameOrSpec.terminalBinding !== undefined) {
|
|
214
219
|
terminalBinding = exportNameOrSpec.terminalBinding;
|
|
215
|
-
|
|
220
|
+
}
|
|
221
|
+
if (exportNameOrSpec.hidden !== undefined) {
|
|
216
222
|
hidden = exportNameOrSpec.hidden;
|
|
223
|
+
}
|
|
217
224
|
}
|
|
218
225
|
const exportInfo = exportsInfo.getExportInfo(name);
|
|
219
226
|
|
package/lib/Generator.js
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
/** @typedef {import("./ChunkGraph")} ChunkGraph */
|
|
10
10
|
/** @typedef {import("./CodeGenerationResults")} CodeGenerationResults */
|
|
11
11
|
/** @typedef {import("./Compilation")} Compilation */
|
|
12
|
+
/** @typedef {import("./Compilation").AssetInfo} AssetInfo */
|
|
12
13
|
/** @typedef {import("./ConcatenationScope")} ConcatenationScope */
|
|
13
14
|
/** @typedef {import("./DependencyTemplate")} DependencyTemplate */
|
|
14
15
|
/** @typedef {import("./DependencyTemplates")} DependencyTemplates */
|
|
@@ -21,6 +22,15 @@
|
|
|
21
22
|
/** @typedef {import("./util/Hash")} Hash */
|
|
22
23
|
/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */
|
|
23
24
|
|
|
25
|
+
/**
|
|
26
|
+
* @template T
|
|
27
|
+
* @typedef {import("./InitFragment")<T>} InitFragment
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/** @typedef {Map<"url", { [key: string]: string }> & Map<"fullContentHash", string> & Map<"contentHash", string> & Map<"filename", string> & Map<"assetInfo", AssetInfo> & Map<"chunkInitFragments", InitFragment<GenerateContext>[]>} KnownGenerateContextData */
|
|
31
|
+
|
|
32
|
+
/** @typedef {KnownGenerateContextData & Record<string, EXPECTED_ANY>} GenerateContextData */
|
|
33
|
+
|
|
24
34
|
/**
|
|
25
35
|
* @typedef {object} GenerateContext
|
|
26
36
|
* @property {DependencyTemplates} dependencyTemplates mapping from dependencies to templates
|
|
@@ -32,7 +42,7 @@
|
|
|
32
42
|
* @property {ConcatenationScope=} concatenationScope when in concatenated module, information about other concatenated modules
|
|
33
43
|
* @property {CodeGenerationResults=} codeGenerationResults code generation results of other modules (need to have a codeGenerationDependency to use that)
|
|
34
44
|
* @property {string} type which kind of code should be generated
|
|
35
|
-
* @property {() =>
|
|
45
|
+
* @property {() => GenerateContextData=} getData get access to the code generation data
|
|
36
46
|
*/
|
|
37
47
|
|
|
38
48
|
/**
|
|
@@ -68,6 +78,7 @@ class Generator {
|
|
|
68
78
|
*/
|
|
69
79
|
getTypes(module) {
|
|
70
80
|
const AbstractMethodError = require("./AbstractMethodError");
|
|
81
|
+
|
|
71
82
|
throw new AbstractMethodError();
|
|
72
83
|
}
|
|
73
84
|
|
|
@@ -80,6 +91,7 @@ class Generator {
|
|
|
80
91
|
*/
|
|
81
92
|
getSize(module, type) {
|
|
82
93
|
const AbstractMethodError = require("./AbstractMethodError");
|
|
94
|
+
|
|
83
95
|
throw new AbstractMethodError();
|
|
84
96
|
}
|
|
85
97
|
|
|
@@ -95,6 +107,7 @@ class Generator {
|
|
|
95
107
|
{ dependencyTemplates, runtimeTemplate, moduleGraph, type }
|
|
96
108
|
) {
|
|
97
109
|
const AbstractMethodError = require("./AbstractMethodError");
|
|
110
|
+
|
|
98
111
|
throw new AbstractMethodError();
|
|
99
112
|
}
|
|
100
113
|
|