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/ModuleTemplate.js
CHANGED
|
@@ -163,7 +163,7 @@ Object.defineProperty(ModuleTemplate.prototype, "runtimeTemplate", {
|
|
|
163
163
|
* @this {ModuleTemplate}
|
|
164
164
|
* @returns {RuntimeTemplate} output options
|
|
165
165
|
*/
|
|
166
|
-
function () {
|
|
166
|
+
function runtimeTemplate() {
|
|
167
167
|
return this._runtimeTemplate;
|
|
168
168
|
},
|
|
169
169
|
"ModuleTemplate.runtimeTemplate is deprecated (use Compilation.runtimeTemplate instead)",
|
|
@@ -144,40 +144,40 @@ const WEBPACK_MODULE_TYPE_LAZY_COMPILATION_PROXY = "lazy-compilation-proxy";
|
|
|
144
144
|
/** @typedef {JavaScriptModuleTypes | JSONModuleType | WebAssemblyModuleTypes | CSSModuleTypes | AssetModuleTypes | WebpackModuleTypes | UnknownModuleTypes} ModuleTypes */
|
|
145
145
|
|
|
146
146
|
module.exports.ASSET_MODULE_TYPE = ASSET_MODULE_TYPE;
|
|
147
|
+
module.exports.ASSET_MODULE_TYPE_INLINE = ASSET_MODULE_TYPE_INLINE;
|
|
147
148
|
module.exports.ASSET_MODULE_TYPE_RAW_DATA_URL = ASSET_MODULE_TYPE_RAW_DATA_URL;
|
|
148
|
-
module.exports.ASSET_MODULE_TYPE_SOURCE = ASSET_MODULE_TYPE_SOURCE;
|
|
149
149
|
module.exports.ASSET_MODULE_TYPE_RESOURCE = ASSET_MODULE_TYPE_RESOURCE;
|
|
150
|
-
module.exports.
|
|
151
|
-
module.exports.
|
|
152
|
-
|
|
153
|
-
|
|
150
|
+
module.exports.ASSET_MODULE_TYPE_SOURCE = ASSET_MODULE_TYPE_SOURCE;
|
|
151
|
+
module.exports.CSS_MODULES = [
|
|
152
|
+
CSS_MODULE_TYPE,
|
|
153
|
+
CSS_MODULE_TYPE_GLOBAL,
|
|
154
|
+
CSS_MODULE_TYPE_MODULE,
|
|
155
|
+
CSS_MODULE_TYPE_AUTO
|
|
156
|
+
];
|
|
157
|
+
module.exports.CSS_MODULE_TYPE = CSS_MODULE_TYPE;
|
|
158
|
+
module.exports.CSS_MODULE_TYPE_AUTO = CSS_MODULE_TYPE_AUTO;
|
|
159
|
+
module.exports.CSS_MODULE_TYPE_GLOBAL = CSS_MODULE_TYPE_GLOBAL;
|
|
160
|
+
module.exports.CSS_MODULE_TYPE_MODULE = CSS_MODULE_TYPE_MODULE;
|
|
154
161
|
module.exports.JAVASCRIPT_MODULES = [
|
|
155
162
|
JAVASCRIPT_MODULE_TYPE_AUTO,
|
|
156
163
|
JAVASCRIPT_MODULE_TYPE_DYNAMIC,
|
|
157
164
|
JAVASCRIPT_MODULE_TYPE_ESM
|
|
158
165
|
];
|
|
166
|
+
module.exports.JAVASCRIPT_MODULE_TYPE_AUTO = JAVASCRIPT_MODULE_TYPE_AUTO;
|
|
167
|
+
module.exports.JAVASCRIPT_MODULE_TYPE_DYNAMIC = JAVASCRIPT_MODULE_TYPE_DYNAMIC;
|
|
168
|
+
module.exports.JAVASCRIPT_MODULE_TYPE_ESM = JAVASCRIPT_MODULE_TYPE_ESM;
|
|
159
169
|
module.exports.JSON_MODULE_TYPE = JSON_MODULE_TYPE;
|
|
160
|
-
module.exports.WEBASSEMBLY_MODULE_TYPE_ASYNC = WEBASSEMBLY_MODULE_TYPE_ASYNC;
|
|
161
|
-
module.exports.WEBASSEMBLY_MODULE_TYPE_SYNC = WEBASSEMBLY_MODULE_TYPE_SYNC;
|
|
162
170
|
module.exports.WEBASSEMBLY_MODULES = [
|
|
163
171
|
WEBASSEMBLY_MODULE_TYPE_SYNC,
|
|
164
172
|
WEBASSEMBLY_MODULE_TYPE_SYNC
|
|
165
173
|
];
|
|
166
|
-
module.exports.
|
|
167
|
-
module.exports.
|
|
168
|
-
module.exports.CSS_MODULE_TYPE_MODULE = CSS_MODULE_TYPE_MODULE;
|
|
169
|
-
module.exports.CSS_MODULE_TYPE_AUTO = CSS_MODULE_TYPE_AUTO;
|
|
170
|
-
module.exports.CSS_MODULES = [
|
|
171
|
-
CSS_MODULE_TYPE,
|
|
172
|
-
CSS_MODULE_TYPE_GLOBAL,
|
|
173
|
-
CSS_MODULE_TYPE_MODULE,
|
|
174
|
-
CSS_MODULE_TYPE_AUTO
|
|
175
|
-
];
|
|
176
|
-
module.exports.WEBPACK_MODULE_TYPE_RUNTIME = WEBPACK_MODULE_TYPE_RUNTIME;
|
|
177
|
-
module.exports.WEBPACK_MODULE_TYPE_FALLBACK = WEBPACK_MODULE_TYPE_FALLBACK;
|
|
178
|
-
module.exports.WEBPACK_MODULE_TYPE_REMOTE = WEBPACK_MODULE_TYPE_REMOTE;
|
|
179
|
-
module.exports.WEBPACK_MODULE_TYPE_PROVIDE = WEBPACK_MODULE_TYPE_PROVIDE;
|
|
174
|
+
module.exports.WEBASSEMBLY_MODULE_TYPE_ASYNC = WEBASSEMBLY_MODULE_TYPE_ASYNC;
|
|
175
|
+
module.exports.WEBASSEMBLY_MODULE_TYPE_SYNC = WEBASSEMBLY_MODULE_TYPE_SYNC;
|
|
180
176
|
module.exports.WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE =
|
|
181
177
|
WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE;
|
|
178
|
+
module.exports.WEBPACK_MODULE_TYPE_FALLBACK = WEBPACK_MODULE_TYPE_FALLBACK;
|
|
182
179
|
module.exports.WEBPACK_MODULE_TYPE_LAZY_COMPILATION_PROXY =
|
|
183
180
|
WEBPACK_MODULE_TYPE_LAZY_COMPILATION_PROXY;
|
|
181
|
+
module.exports.WEBPACK_MODULE_TYPE_PROVIDE = WEBPACK_MODULE_TYPE_PROVIDE;
|
|
182
|
+
module.exports.WEBPACK_MODULE_TYPE_REMOTE = WEBPACK_MODULE_TYPE_REMOTE;
|
|
183
|
+
module.exports.WEBPACK_MODULE_TYPE_RUNTIME = WEBPACK_MODULE_TYPE_RUNTIME;
|
package/lib/MultiCompiler.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
8
|
const asyncLib = require("neo-async");
|
|
9
|
-
const {
|
|
9
|
+
const { MultiHook, SyncHook } = require("tapable");
|
|
10
10
|
|
|
11
11
|
const ConcurrentCompilationError = require("./ConcurrentCompilationError");
|
|
12
12
|
const MultiStats = require("./MultiStats");
|
|
@@ -305,7 +305,7 @@ module.exports = class MultiCompiler {
|
|
|
305
305
|
}
|
|
306
306
|
if (edges.size > 0) {
|
|
307
307
|
/** @type {string[]} */
|
|
308
|
-
const lines =
|
|
308
|
+
const lines = [...edges]
|
|
309
309
|
.sort(sortEdges)
|
|
310
310
|
.map(edge => `${edge.source.name} -> ${edge.target.name}`);
|
|
311
311
|
lines.unshift("Circular dependency found in compiler dependencies.");
|
|
@@ -324,7 +324,7 @@ module.exports = class MultiCompiler {
|
|
|
324
324
|
* @deprecated This method should have been private
|
|
325
325
|
* @param {Compiler[]} compilers the child compilers
|
|
326
326
|
* @param {RunWithDependenciesHandler} fn a handler to run for each compiler
|
|
327
|
-
* @param {Callback<
|
|
327
|
+
* @param {Callback<Stats[]>} callback the compiler's handler
|
|
328
328
|
* @returns {void}
|
|
329
329
|
*/
|
|
330
330
|
runWithDependencies(compilers, fn, callback) {
|
|
@@ -355,7 +355,7 @@ module.exports = class MultiCompiler {
|
|
|
355
355
|
return readyCompilers;
|
|
356
356
|
};
|
|
357
357
|
/**
|
|
358
|
-
* @param {Callback<
|
|
358
|
+
* @param {Callback<Stats[]>} callback callback
|
|
359
359
|
* @returns {void}
|
|
360
360
|
*/
|
|
361
361
|
const runCompilers = callback => {
|
|
@@ -370,7 +370,7 @@ module.exports = class MultiCompiler {
|
|
|
370
370
|
});
|
|
371
371
|
},
|
|
372
372
|
(err, results) => {
|
|
373
|
-
callback(err,
|
|
373
|
+
callback(err, results);
|
|
374
374
|
}
|
|
375
375
|
);
|
|
376
376
|
};
|
|
@@ -598,7 +598,7 @@ module.exports = class MultiCompiler {
|
|
|
598
598
|
}
|
|
599
599
|
return watching;
|
|
600
600
|
},
|
|
601
|
-
(compiler, watching,
|
|
601
|
+
(compiler, watching, _callback) => {
|
|
602
602
|
if (compiler.watching !== watching) return;
|
|
603
603
|
if (!watching.running) watching.invalidate();
|
|
604
604
|
},
|
package/lib/NormalModule.js
CHANGED
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
|
+
const querystring = require("querystring");
|
|
8
9
|
const parseJson = require("json-parse-even-better-errors");
|
|
9
10
|
const { getContext, runLoaders } = require("loader-runner");
|
|
10
|
-
const querystring = require("querystring");
|
|
11
11
|
const {
|
|
12
|
+
AsyncSeriesBailHook,
|
|
12
13
|
HookMap,
|
|
13
14
|
SyncHook,
|
|
14
|
-
SyncWaterfallHook
|
|
15
|
-
AsyncSeriesBailHook
|
|
15
|
+
SyncWaterfallHook
|
|
16
16
|
} = require("tapable");
|
|
17
17
|
const {
|
|
18
18
|
CachedSource,
|
|
@@ -38,22 +38,23 @@ const { isSubset } = require("./util/SetHelpers");
|
|
|
38
38
|
const { getScheme } = require("./util/URLAbsoluteSpecifier");
|
|
39
39
|
const {
|
|
40
40
|
compareLocations,
|
|
41
|
-
concatComparators,
|
|
42
41
|
compareSelect,
|
|
42
|
+
concatComparators,
|
|
43
43
|
keepOriginalOrder
|
|
44
44
|
} = require("./util/comparators");
|
|
45
45
|
const createHash = require("./util/createHash");
|
|
46
46
|
const { createFakeHook } = require("./util/deprecation");
|
|
47
47
|
const { join } = require("./util/fs");
|
|
48
48
|
const {
|
|
49
|
-
contextify,
|
|
50
49
|
absolutify,
|
|
50
|
+
contextify,
|
|
51
51
|
makePathsRelative
|
|
52
52
|
} = require("./util/identifier");
|
|
53
53
|
const makeSerializable = require("./util/makeSerializable");
|
|
54
54
|
const memoize = require("./util/memoize");
|
|
55
55
|
|
|
56
56
|
/** @typedef {import("webpack-sources").Source} Source */
|
|
57
|
+
/** @typedef {import("webpack-sources").RawSourceMap} RawSourceMap */
|
|
57
58
|
/** @typedef {import("../declarations/WebpackOptions").Mode} Mode */
|
|
58
59
|
/** @typedef {import("../declarations/WebpackOptions").ResolveOptions} ResolveOptions */
|
|
59
60
|
/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */
|
|
@@ -64,6 +65,7 @@ const memoize = require("./util/memoize");
|
|
|
64
65
|
/** @typedef {import("./DependencyTemplates")} DependencyTemplates */
|
|
65
66
|
/** @typedef {import("./Generator")} Generator */
|
|
66
67
|
/** @typedef {import("./Generator").GenerateErrorFn} GenerateErrorFn */
|
|
68
|
+
/** @typedef {import("./Generator").GenerateContextData} GenerateContextData */
|
|
67
69
|
/** @typedef {import("./Module").BuildInfo} BuildInfo */
|
|
68
70
|
/** @typedef {import("./Module").BuildMeta} BuildMeta */
|
|
69
71
|
/** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */
|
|
@@ -78,14 +80,16 @@ const memoize = require("./util/memoize");
|
|
|
78
80
|
/** @typedef {import("./Module").UnsafeCacheData} UnsafeCacheData */
|
|
79
81
|
/** @typedef {import("./ModuleGraph")} ModuleGraph */
|
|
80
82
|
/** @typedef {import("./ModuleGraphConnection").ConnectionState} ConnectionState */
|
|
81
|
-
/** @typedef {import("./ModuleTypeConstants").
|
|
83
|
+
/** @typedef {import("./ModuleTypeConstants").ModuleTypes} ModuleTypes */
|
|
82
84
|
/** @typedef {import("./NormalModuleFactory")} NormalModuleFactory */
|
|
83
85
|
/** @typedef {import("./NormalModuleFactory").ResourceDataWithData} ResourceDataWithData */
|
|
86
|
+
/** @typedef {import("./NormalModuleFactory").ResourceSchemeData} ResourceSchemeData */
|
|
84
87
|
/** @typedef {import("./Parser")} Parser */
|
|
85
88
|
/** @typedef {import("./Parser").PreparsedAst} PreparsedAst */
|
|
86
89
|
/** @typedef {import("./RequestShortener")} RequestShortener */
|
|
87
90
|
/** @typedef {import("./ResolverFactory").ResolveContext} ResolveContext */
|
|
88
91
|
/** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */
|
|
92
|
+
/** @typedef {import("./ResolverFactory").ResolveRequest} ResolveRequest */
|
|
89
93
|
/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */
|
|
90
94
|
/** @typedef {import("./logging/Logger").Logger} WebpackLogger */
|
|
91
95
|
/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
|
@@ -113,18 +117,6 @@ const memoize = require("./util/memoize");
|
|
|
113
117
|
* @typedef {import("../declarations/LoaderContext").NormalModuleLoaderContext<T>} NormalModuleLoaderContext
|
|
114
118
|
*/
|
|
115
119
|
|
|
116
|
-
/**
|
|
117
|
-
* @typedef {object} SourceMap
|
|
118
|
-
* @property {number} version
|
|
119
|
-
* @property {string[]} sources
|
|
120
|
-
* @property {string} mappings
|
|
121
|
-
* @property {string=} file
|
|
122
|
-
* @property {string=} sourceRoot
|
|
123
|
-
* @property {string[]=} sourcesContent
|
|
124
|
-
* @property {string[]=} names
|
|
125
|
-
* @property {string=} debugId
|
|
126
|
-
*/
|
|
127
|
-
|
|
128
120
|
const getInvalidDependenciesModuleWarning = memoize(() =>
|
|
129
121
|
require("./InvalidDependenciesModuleWarning")
|
|
130
122
|
);
|
|
@@ -157,12 +149,14 @@ const contextifySourceUrl = (context, source, associatedObjectForCache) => {
|
|
|
157
149
|
|
|
158
150
|
/**
|
|
159
151
|
* @param {string} context absolute context path
|
|
160
|
-
* @param {
|
|
152
|
+
* @param {string | RawSourceMap} sourceMap a source map
|
|
161
153
|
* @param {AssociatedObjectForCache=} associatedObjectForCache an object to which the cache will be attached
|
|
162
|
-
* @returns {
|
|
154
|
+
* @returns {string | RawSourceMap} new source map
|
|
163
155
|
*/
|
|
164
156
|
const contextifySourceMap = (context, sourceMap, associatedObjectForCache) => {
|
|
165
|
-
if (!Array.isArray(sourceMap.sources))
|
|
157
|
+
if (typeof sourceMap === "string" || !Array.isArray(sourceMap.sources)) {
|
|
158
|
+
return sourceMap;
|
|
159
|
+
}
|
|
166
160
|
const { sourceRoot } = sourceMap;
|
|
167
161
|
/** @type {(source: string) => string} */
|
|
168
162
|
const mapper = !sourceRoot
|
|
@@ -193,7 +187,7 @@ const contextifySourceMap = (context, sourceMap, associatedObjectForCache) => {
|
|
|
193
187
|
*/
|
|
194
188
|
const asString = input => {
|
|
195
189
|
if (Buffer.isBuffer(input)) {
|
|
196
|
-
return input.toString("
|
|
190
|
+
return input.toString("utf8");
|
|
197
191
|
}
|
|
198
192
|
return input;
|
|
199
193
|
};
|
|
@@ -204,7 +198,7 @@ const asString = input => {
|
|
|
204
198
|
*/
|
|
205
199
|
const asBuffer = input => {
|
|
206
200
|
if (!Buffer.isBuffer(input)) {
|
|
207
|
-
return Buffer.from(input, "
|
|
201
|
+
return Buffer.from(input, "utf8");
|
|
208
202
|
}
|
|
209
203
|
return input;
|
|
210
204
|
};
|
|
@@ -227,7 +221,7 @@ makeSerializable(
|
|
|
227
221
|
"NonErrorEmittedError"
|
|
228
222
|
);
|
|
229
223
|
|
|
230
|
-
/** @typedef {[string | Buffer, string |
|
|
224
|
+
/** @typedef {[string | Buffer, string | RawSourceMap | undefined, PreparsedAst | undefined]} Result */
|
|
231
225
|
|
|
232
226
|
/**
|
|
233
227
|
* @typedef {object} NormalModuleCompilationHooks
|
|
@@ -244,13 +238,13 @@ makeSerializable(
|
|
|
244
238
|
/**
|
|
245
239
|
* @typedef {object} NormalModuleCreateData
|
|
246
240
|
* @property {string=} layer an optional layer in which the module is
|
|
247
|
-
* @property {
|
|
241
|
+
* @property {ModuleTypes | ""} type module type. When deserializing, this is set to an empty string "".
|
|
248
242
|
* @property {string} request request string
|
|
249
243
|
* @property {string} userRequest request intended by user (without loaders from config)
|
|
250
244
|
* @property {string} rawRequest request without resolving
|
|
251
245
|
* @property {LoaderItem[]} loaders list of loaders
|
|
252
246
|
* @property {string} resource path + query of the real resource
|
|
253
|
-
* @property {
|
|
247
|
+
* @property {(ResourceSchemeData & Partial<ResolveRequest>)=} resourceResolveData resource resolve data
|
|
254
248
|
* @property {string} context context directory for resolving
|
|
255
249
|
* @property {string=} matchResource path + query of the matched resource (virtual)
|
|
256
250
|
* @property {Parser} parser the parser used
|
|
@@ -263,8 +257,6 @@ makeSerializable(
|
|
|
263
257
|
/** @type {WeakMap<Compilation, NormalModuleCompilationHooks>} */
|
|
264
258
|
const compilationHooksMap = new WeakMap();
|
|
265
259
|
|
|
266
|
-
/** @typedef {Map<string, EXPECTED_ANY>} CodeGeneratorData */
|
|
267
|
-
|
|
268
260
|
class NormalModule extends Module {
|
|
269
261
|
/**
|
|
270
262
|
* @param {Compilation} compilation the compilation
|
|
@@ -405,7 +397,7 @@ class NormalModule extends Module {
|
|
|
405
397
|
this._isEvaluatingSideEffects = false;
|
|
406
398
|
/** @type {WeakSet<ModuleGraph> | undefined} */
|
|
407
399
|
this._addedSideEffectsBailout = undefined;
|
|
408
|
-
/** @type {
|
|
400
|
+
/** @type {GenerateContextData} */
|
|
409
401
|
this._codeGeneratorData = new Map();
|
|
410
402
|
}
|
|
411
403
|
|
|
@@ -541,7 +533,7 @@ class NormalModule extends Module {
|
|
|
541
533
|
* @param {string} context the compilation context
|
|
542
534
|
* @param {string} name the asset name
|
|
543
535
|
* @param {string | Buffer} content the content
|
|
544
|
-
* @param {(string |
|
|
536
|
+
* @param {(string | RawSourceMap)=} sourceMap an optional source map
|
|
545
537
|
* @param {AssociatedObjectForCache=} associatedObjectForCache object for caching
|
|
546
538
|
* @returns {Source} the created source
|
|
547
539
|
*/
|
|
@@ -569,7 +561,8 @@ class NormalModule extends Module {
|
|
|
569
561
|
name,
|
|
570
562
|
contextifySourceMap(
|
|
571
563
|
context,
|
|
572
|
-
/** @type {
|
|
564
|
+
/** @type {RawSourceMap} */
|
|
565
|
+
(sourceMap),
|
|
573
566
|
associatedObjectForCache
|
|
574
567
|
)
|
|
575
568
|
);
|
|
@@ -587,12 +580,14 @@ class NormalModule extends Module {
|
|
|
587
580
|
* @param {Compilation} compilation the compilation
|
|
588
581
|
* @param {InputFileSystem} fs file system from reading
|
|
589
582
|
* @param {NormalModuleCompilationHooks} hooks the hooks
|
|
590
|
-
* @returns {import("../declarations/LoaderContext").
|
|
583
|
+
* @returns {import("../declarations/LoaderContext").LoaderContext<T>} loader context
|
|
591
584
|
*/
|
|
592
585
|
_createLoaderContext(resolver, options, compilation, fs, hooks) {
|
|
593
586
|
const { requestShortener } = compilation.runtimeTemplate;
|
|
594
587
|
const getCurrentLoaderName = () => {
|
|
595
|
-
const currentLoader = this.getCurrentLoader(
|
|
588
|
+
const currentLoader = this.getCurrentLoader(
|
|
589
|
+
/** @type {LoaderContext<EXPECTED_ANY>} */ (loaderContext)
|
|
590
|
+
);
|
|
596
591
|
if (!currentLoader) return "(not in loader scope)";
|
|
597
592
|
return requestShortener.shorten(currentLoader.loader);
|
|
598
593
|
};
|
|
@@ -601,13 +596,22 @@ class NormalModule extends Module {
|
|
|
601
596
|
*/
|
|
602
597
|
const getResolveContext = () => ({
|
|
603
598
|
fileDependencies: {
|
|
604
|
-
add: d =>
|
|
599
|
+
add: d =>
|
|
600
|
+
/** @type {LoaderContext<EXPECTED_ANY>} */ (
|
|
601
|
+
loaderContext
|
|
602
|
+
).addDependency(d)
|
|
605
603
|
},
|
|
606
604
|
contextDependencies: {
|
|
607
|
-
add: d =>
|
|
605
|
+
add: d =>
|
|
606
|
+
/** @type {LoaderContext<EXPECTED_ANY>} */ (
|
|
607
|
+
loaderContext
|
|
608
|
+
).addContextDependency(d)
|
|
608
609
|
},
|
|
609
610
|
missingDependencies: {
|
|
610
|
-
add: d =>
|
|
611
|
+
add: d =>
|
|
612
|
+
/** @type {LoaderContext<EXPECTED_ANY>} */ (
|
|
613
|
+
loaderContext
|
|
614
|
+
).addMissingDependency(d)
|
|
611
615
|
}
|
|
612
616
|
});
|
|
613
617
|
const getAbsolutify = memoize(() =>
|
|
@@ -668,7 +672,9 @@ class NormalModule extends Module {
|
|
|
668
672
|
* @returns {T} options
|
|
669
673
|
*/
|
|
670
674
|
getOptions: schema => {
|
|
671
|
-
const loader = this.getCurrentLoader(
|
|
675
|
+
const loader = this.getCurrentLoader(
|
|
676
|
+
/** @type {LoaderContext<EXPECTED_ANY>} */ (loaderContext)
|
|
677
|
+
);
|
|
672
678
|
|
|
673
679
|
let { options } = /** @type {LoaderItem} */ (loader);
|
|
674
680
|
|
|
@@ -728,7 +734,9 @@ class NormalModule extends Module {
|
|
|
728
734
|
);
|
|
729
735
|
},
|
|
730
736
|
getLogger: name => {
|
|
731
|
-
const currentLoader = this.getCurrentLoader(
|
|
737
|
+
const currentLoader = this.getCurrentLoader(
|
|
738
|
+
/** @type {LoaderContext<EXPECTED_ANY>} */ (loaderContext)
|
|
739
|
+
);
|
|
732
740
|
return compilation.getLogger(() =>
|
|
733
741
|
[currentLoader && currentLoader.loader, name, this.identifier()]
|
|
734
742
|
.filter(Boolean)
|
|
@@ -816,18 +824,19 @@ class NormalModule extends Module {
|
|
|
816
824
|
|
|
817
825
|
Object.assign(loaderContext, options.loader);
|
|
818
826
|
|
|
827
|
+
// After `hooks.loader.call` is called, the loaderContext is typed as LoaderContext<EXPECTED_ANY>
|
|
819
828
|
hooks.loader.call(
|
|
820
829
|
/** @type {LoaderContext<EXPECTED_ANY>} */
|
|
821
830
|
(loaderContext),
|
|
822
831
|
this
|
|
823
832
|
);
|
|
824
833
|
|
|
825
|
-
return loaderContext;
|
|
834
|
+
return /** @type {LoaderContext<EXPECTED_ANY>} */ (loaderContext);
|
|
826
835
|
}
|
|
827
836
|
|
|
828
837
|
// TODO remove `loaderContext` in webpack@6
|
|
829
838
|
/**
|
|
830
|
-
* @param {
|
|
839
|
+
* @param {LoaderContext<EXPECTED_ANY>} loaderContext loader context
|
|
831
840
|
* @param {number} index index
|
|
832
841
|
* @returns {LoaderItem | null} loader
|
|
833
842
|
*/
|
|
@@ -847,7 +856,7 @@ class NormalModule extends Module {
|
|
|
847
856
|
/**
|
|
848
857
|
* @param {string} context the compilation context
|
|
849
858
|
* @param {string | Buffer} content the content
|
|
850
|
-
* @param {(string |
|
|
859
|
+
* @param {(string | RawSourceMap | null)=} sourceMap an optional source map
|
|
851
860
|
* @param {AssociatedObjectForCache=} associatedObjectForCache object for caching
|
|
852
861
|
* @returns {Source} the created source
|
|
853
862
|
*/
|
|
@@ -868,11 +877,7 @@ class NormalModule extends Module {
|
|
|
868
877
|
return new SourceMapSource(
|
|
869
878
|
content,
|
|
870
879
|
contextifySourceUrl(context, identifier, associatedObjectForCache),
|
|
871
|
-
contextifySourceMap(
|
|
872
|
-
context,
|
|
873
|
-
/** @type {TODO} */ (sourceMap),
|
|
874
|
-
associatedObjectForCache
|
|
875
|
-
)
|
|
880
|
+
contextifySourceMap(context, sourceMap, associatedObjectForCache)
|
|
876
881
|
);
|
|
877
882
|
}
|
|
878
883
|
|
|
@@ -906,10 +911,10 @@ class NormalModule extends Module {
|
|
|
906
911
|
|
|
907
912
|
/**
|
|
908
913
|
* @param {Error | null} err err
|
|
909
|
-
* @param {(Result | null)=}
|
|
914
|
+
* @param {(Result | null)=} result_ result
|
|
910
915
|
* @returns {void}
|
|
911
916
|
*/
|
|
912
|
-
const processResult = (err,
|
|
917
|
+
const processResult = (err, result_) => {
|
|
913
918
|
if (err) {
|
|
914
919
|
if (!(err instanceof Error)) {
|
|
915
920
|
err = new NonErrorEmittedError(err);
|
|
@@ -925,7 +930,8 @@ class NormalModule extends Module {
|
|
|
925
930
|
return callback(error);
|
|
926
931
|
}
|
|
927
932
|
const result = hooks.processResult.call(
|
|
928
|
-
/** @type {Result} */
|
|
933
|
+
/** @type {Result} */
|
|
934
|
+
(result_),
|
|
929
935
|
this
|
|
930
936
|
);
|
|
931
937
|
const source = result[0];
|
|
@@ -998,7 +1004,7 @@ class NormalModule extends Module {
|
|
|
998
1004
|
loaders: this.loaders,
|
|
999
1005
|
context: loaderContext,
|
|
1000
1006
|
/**
|
|
1001
|
-
* @param {LoaderContext<
|
|
1007
|
+
* @param {LoaderContext<EXPECTED_ANY>} loaderContext the loader context
|
|
1002
1008
|
* @param {string} resourcePath the resource Path
|
|
1003
1009
|
* @param {(err: Error | null, result?: string | Buffer) => void} callback callback
|
|
1004
1010
|
*/
|
|
@@ -1245,8 +1251,9 @@ class NormalModule extends Module {
|
|
|
1245
1251
|
const checkDependencies = deps => {
|
|
1246
1252
|
for (const dep of deps) {
|
|
1247
1253
|
if (!ABSOLUTE_PATH_REGEX.test(dep)) {
|
|
1248
|
-
if (nonAbsoluteDependencies === undefined)
|
|
1254
|
+
if (nonAbsoluteDependencies === undefined) {
|
|
1249
1255
|
nonAbsoluteDependencies = new Set();
|
|
1256
|
+
}
|
|
1250
1257
|
nonAbsoluteDependencies.add(dep);
|
|
1251
1258
|
deps.delete(dep);
|
|
1252
1259
|
try {
|
|
@@ -1371,8 +1378,9 @@ class NormalModule extends Module {
|
|
|
1371
1378
|
if (this.factoryMeta.sideEffectFree === false) return true;
|
|
1372
1379
|
}
|
|
1373
1380
|
if (this.buildMeta !== undefined && this.buildMeta.sideEffectFree) {
|
|
1374
|
-
if (this._isEvaluatingSideEffects)
|
|
1381
|
+
if (this._isEvaluatingSideEffects) {
|
|
1375
1382
|
return ModuleGraphConnection.CIRCULAR_CONNECTION;
|
|
1383
|
+
}
|
|
1376
1384
|
this._isEvaluatingSideEffects = true;
|
|
1377
1385
|
/** @type {ConnectionState} */
|
|
1378
1386
|
let current = false;
|
|
@@ -1445,9 +1453,6 @@ class NormalModule extends Module {
|
|
|
1445
1453
|
runtimeRequirements.add(RuntimeGlobals.thisAsExports);
|
|
1446
1454
|
}
|
|
1447
1455
|
|
|
1448
|
-
/**
|
|
1449
|
-
* @type {() => CodeGeneratorData}
|
|
1450
|
-
*/
|
|
1451
1456
|
const getData = () => this._codeGeneratorData;
|
|
1452
1457
|
|
|
1453
1458
|
const sources = new Map();
|
|
@@ -1662,7 +1667,7 @@ class NormalModule extends Module {
|
|
|
1662
1667
|
|
|
1663
1668
|
/**
|
|
1664
1669
|
* @param {ObjectDeserializerContext} context context
|
|
1665
|
-
* @returns {
|
|
1670
|
+
* @returns {NormalModule} module
|
|
1666
1671
|
*/
|
|
1667
1672
|
static deserialize(context) {
|
|
1668
1673
|
const obj = new NormalModule({
|