webpack 5.100.2 → 5.101.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -10
- package/bin/webpack.js +7 -7
- package/lib/APIPlugin.js +12 -14
- package/lib/AutomaticPrefetchPlugin.js +2 -2
- package/lib/BannerPlugin.js +4 -4
- package/lib/Cache.js +1 -1
- package/lib/CacheFacade.js +7 -7
- package/lib/CaseSensitiveModulesWarning.js +2 -2
- package/lib/Chunk.js +3 -3
- package/lib/ChunkGraph.js +63 -18
- package/lib/ChunkGroup.js +4 -4
- package/lib/CleanPlugin.js +19 -53
- package/lib/CodeGenerationResults.js +3 -3
- package/lib/CompatibilityPlugin.js +6 -6
- package/lib/Compilation.js +168 -116
- package/lib/Compiler.js +37 -37
- package/lib/ConcatenationScope.js +39 -1
- package/lib/ConstPlugin.js +11 -11
- package/lib/ContextExclusionPlugin.js +3 -3
- package/lib/ContextModule.js +12 -11
- package/lib/ContextModuleFactory.js +11 -11
- package/lib/ContextReplacementPlugin.js +5 -5
- package/lib/DefinePlugin.js +24 -22
- package/lib/DelegatedModuleFactoryPlugin.js +1 -1
- package/lib/Dependency.js +2 -1
- package/lib/DllEntryPlugin.js +1 -1
- package/lib/DllReferencePlugin.js +1 -1
- package/lib/DynamicEntryPlugin.js +3 -3
- package/lib/EntryPlugin.js +1 -1
- package/lib/EnvironmentPlugin.js +1 -1
- package/lib/ErrorHelpers.js +2 -2
- package/lib/EvalDevToolModulePlugin.js +2 -2
- package/lib/EvalSourceMapDevToolPlugin.js +5 -5
- package/lib/ExportsInfo.js +9 -9
- package/lib/ExportsInfoApiPlugin.js +2 -2
- package/lib/ExternalModule.js +163 -48
- package/lib/ExternalModuleFactoryPlugin.js +2 -2
- package/lib/ExternalsPlugin.js +45 -0
- package/lib/FileSystemInfo.js +64 -61
- package/lib/FlagAllModulesAsUsedPlugin.js +2 -2
- package/lib/FlagDependencyExportsPlugin.js +7 -7
- package/lib/FlagDependencyUsagePlugin.js +4 -4
- package/lib/FlagEntryExportAsUsedPlugin.js +1 -1
- package/lib/HotModuleReplacementPlugin.js +27 -27
- package/lib/IgnorePlugin.js +3 -3
- package/lib/IgnoreWarningsPlugin.js +4 -4
- package/lib/InitFragment.js +6 -0
- package/lib/InvalidDependenciesModuleWarning.js +1 -1
- package/lib/JavascriptMetaInfoPlugin.js +1 -1
- package/lib/LibManifestPlugin.js +2 -2
- package/lib/LoaderOptionsPlugin.js +1 -1
- package/lib/LoaderTargetPlugin.js +2 -2
- package/lib/MainTemplate.js +1 -1
- package/lib/Module.js +3 -2
- package/lib/ModuleFilenameHelpers.js +3 -3
- package/lib/ModuleGraph.js +23 -38
- package/lib/ModuleInfoHeaderPlugin.js +3 -3
- package/lib/ModuleParseError.js +5 -3
- package/lib/ModuleTemplate.js +3 -2
- package/lib/MultiCompiler.js +29 -24
- package/lib/MultiStats.js +18 -13
- package/lib/MultiWatching.js +1 -1
- package/lib/NoEmitOnErrorsPlugin.js +2 -2
- package/lib/NodeStuffPlugin.js +27 -15
- package/lib/NormalModule.js +23 -23
- package/lib/NormalModuleFactory.js +23 -21
- package/lib/NormalModuleReplacementPlugin.js +3 -3
- package/lib/PrefetchPlugin.js +1 -1
- package/lib/ProgressPlugin.js +11 -11
- package/lib/ProvidePlugin.js +2 -2
- package/lib/RecordIdsPlugin.js +3 -3
- package/lib/ResolverFactory.js +3 -3
- package/lib/RuntimeGlobals.js +20 -0
- package/lib/RuntimePlugin.js +16 -16
- package/lib/RuntimeTemplate.js +35 -26
- package/lib/SizeFormatHelpers.js +1 -1
- package/lib/SourceMapDevToolModuleOptionsPlugin.js +4 -4
- package/lib/SourceMapDevToolPlugin.js +9 -9
- package/lib/Stats.js +2 -2
- package/lib/Template.js +1 -1
- package/lib/TemplatedPathPlugin.js +2 -2
- package/lib/UseStrictPlugin.js +1 -1
- package/lib/WarnCaseSensitiveModulesPlugin.js +1 -1
- package/lib/WarnDeprecatedOptionPlugin.js +1 -1
- package/lib/WarnNoModeSetPlugin.js +1 -1
- package/lib/WatchIgnorePlugin.js +2 -2
- package/lib/Watching.js +12 -14
- package/lib/WebpackIsIncludedPlugin.js +2 -2
- package/lib/WebpackOptionsApply.js +3 -3
- package/lib/asset/AssetGenerator.js +1 -1
- package/lib/asset/AssetModulesPlugin.js +6 -6
- package/lib/async-modules/AsyncModuleHelpers.js +1 -1
- package/lib/async-modules/AwaitDependenciesInitFragment.js +36 -24
- package/lib/async-modules/InferAsyncModulesPlugin.js +3 -3
- package/lib/buildChunkGraph.js +5 -5
- package/lib/cache/AddBuildDependenciesPlugin.js +1 -1
- package/lib/cache/IdleFileCachePlugin.js +5 -5
- package/lib/cache/PackFileCacheStrategy.js +20 -20
- package/lib/cache/ResolverCachePlugin.js +4 -4
- package/lib/cli.js +196 -14
- package/lib/config/browserslistTargetHandler.js +6 -6
- package/lib/config/defaults.js +23 -14
- package/lib/config/normalization.js +41 -38
- package/lib/config/target.js +4 -4
- package/lib/container/ContainerEntryModule.js +3 -3
- package/lib/container/ContainerPlugin.js +3 -3
- package/lib/container/ContainerReferencePlugin.js +3 -3
- package/lib/container/FallbackModule.js +1 -1
- package/lib/container/HoistContainerReferencesPlugin.js +7 -7
- package/lib/container/options.js +4 -4
- package/lib/css/CssGenerator.js +5 -3
- package/lib/css/CssLoadingRuntimeModule.js +1 -1
- package/lib/css/CssModulesPlugin.js +25 -22
- package/lib/css/CssParser.js +5 -5
- package/lib/css/walkCssTokens.js +9 -9
- package/lib/debug/ProfilingPlugin.js +5 -5
- package/lib/dependencies/AMDDefineDependencyParserPlugin.js +4 -4
- package/lib/dependencies/AMDPlugin.js +3 -3
- package/lib/dependencies/AMDRequireArrayDependency.js +1 -1
- package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +3 -3
- package/lib/dependencies/CommonJsExportRequireDependency.js +2 -2
- package/lib/dependencies/CommonJsExportsParserPlugin.js +12 -10
- package/lib/dependencies/CommonJsImportsParserPlugin.js +21 -19
- package/lib/dependencies/CommonJsPlugin.js +2 -2
- package/lib/dependencies/ContextDependency.js +1 -1
- package/lib/dependencies/ContextDependencyHelpers.js +3 -3
- package/lib/dependencies/CssIcssExportDependency.js +2 -2
- package/lib/dependencies/CssLocalIdentifierDependency.js +2 -2
- package/lib/dependencies/CssUrlDependency.js +4 -4
- package/lib/dependencies/DynamicExports.js +5 -5
- package/lib/dependencies/HarmonyAcceptDependency.js +91 -5
- package/lib/dependencies/HarmonyDetectionParserPlugin.js +2 -2
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +17 -13
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +7 -8
- package/lib/dependencies/HarmonyExportInitFragment.js +1 -1
- package/lib/dependencies/HarmonyExports.js +1 -1
- package/lib/dependencies/HarmonyImportDependency.js +28 -9
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +56 -48
- package/lib/dependencies/HarmonyImportSideEffectDependency.js +4 -5
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +3 -4
- package/lib/dependencies/HarmonyModulesPlugin.js +2 -8
- package/lib/dependencies/HarmonyTopLevelThisParserPlugin.js +1 -1
- package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +4 -4
- package/lib/dependencies/ImportMetaPlugin.js +7 -7
- package/lib/dependencies/ImportParserPlugin.js +4 -4
- package/lib/dependencies/JsonExportsDependency.js +7 -2
- package/lib/dependencies/LoaderPlugin.js +4 -4
- package/lib/dependencies/ModuleDependency.js +2 -1
- package/lib/dependencies/ProvidedDependency.js +2 -2
- package/lib/dependencies/PureExpressionDependency.js +1 -1
- package/lib/dependencies/RequireContextDependencyParserPlugin.js +1 -1
- package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +1 -1
- package/lib/dependencies/RequireIncludeDependencyParserPlugin.js +3 -3
- package/lib/dependencies/SystemPlugin.js +3 -3
- package/lib/dependencies/WorkerPlugin.js +5 -5
- package/lib/dependencies/getFunctionExpression.js +1 -1
- package/lib/esm/ExportWebpackRequireRuntimeModule.js +8 -1
- package/lib/esm/ModuleChunkFormatPlugin.js +35 -69
- package/lib/esm/ModuleChunkLoadingPlugin.js +3 -6
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +15 -11
- package/lib/formatLocation.js +2 -2
- package/lib/hmr/HotModuleReplacement.runtime.js +39 -27
- package/lib/hmr/JavascriptHotModuleReplacement.runtime.js +43 -32
- package/lib/hmr/JavascriptHotModuleReplacementHelper.js +1 -1
- package/lib/hmr/LazyCompilationPlugin.js +6 -6
- package/lib/hmr/lazyCompilationBackend.js +6 -6
- package/lib/ids/ChunkModuleIdRangePlugin.js +4 -4
- package/lib/ids/DeterministicChunkIdsPlugin.js +5 -4
- package/lib/ids/DeterministicModuleIdsPlugin.js +2 -2
- package/lib/ids/HashedModuleIdsPlugin.js +1 -1
- package/lib/ids/IdHelpers.js +9 -9
- package/lib/ids/NamedChunkIdsPlugin.js +5 -5
- package/lib/ids/NamedModuleIdsPlugin.js +2 -2
- package/lib/ids/NaturalChunkIdsPlugin.js +2 -2
- package/lib/ids/NaturalModuleIdsPlugin.js +1 -1
- package/lib/ids/OccurrenceChunkIdsPlugin.js +2 -2
- package/lib/ids/OccurrenceModuleIdsPlugin.js +4 -4
- package/lib/ids/SyncModuleIdsPlugin.js +4 -4
- package/lib/index.js +18 -6
- package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +1 -1
- package/lib/javascript/BasicEvaluatedExpression.js +3 -3
- package/lib/javascript/ChunkFormatHelpers.js +70 -0
- package/lib/javascript/CommonJsChunkFormatPlugin.js +10 -21
- package/lib/javascript/EnableChunkLoadingPlugin.js +1 -1
- package/lib/javascript/JavascriptGenerator.js +1 -1
- package/lib/javascript/JavascriptModulesPlugin.js +108 -54
- package/lib/javascript/JavascriptParser.js +80 -78
- package/lib/javascript/JavascriptParserHelpers.js +3 -3
- package/lib/javascript/StartupHelpers.js +2 -2
- package/lib/json/JsonGenerator.js +2 -2
- package/lib/json/JsonModulesPlugin.js +2 -2
- package/lib/library/AbstractLibraryPlugin.js +30 -3
- package/lib/library/AmdLibraryPlugin.js +3 -3
- package/lib/library/AssignLibraryPlugin.js +2 -2
- package/lib/library/EnableLibraryPlugin.js +2 -2
- package/lib/library/ModuleLibraryPlugin.js +49 -31
- package/lib/library/SystemLibraryPlugin.js +6 -4
- package/lib/library/UmdLibraryPlugin.js +14 -14
- package/lib/logging/createConsoleLogger.js +4 -4
- package/lib/logging/runtime.js +3 -3
- package/lib/logging/truncateArgs.js +4 -4
- package/lib/node/CommonJsChunkLoadingPlugin.js +2 -2
- package/lib/node/NodeEnvironmentPlugin.js +1 -1
- package/lib/node/ReadFileChunkLoadingRuntimeModule.js +16 -14
- package/lib/node/ReadFileCompileAsyncWasmPlugin.js +7 -7
- package/lib/node/ReadFileCompileWasmPlugin.js +7 -7
- package/lib/node/RequireChunkLoadingRuntimeModule.js +13 -6
- package/lib/node/nodeConsole.js +2 -2
- package/lib/optimize/AggressiveMergingPlugin.js +2 -2
- package/lib/optimize/AggressiveSplittingPlugin.js +10 -10
- package/lib/optimize/ConcatenatedModule.js +186 -77
- package/lib/optimize/EnsureChunkConditionsPlugin.js +2 -2
- package/lib/optimize/FlagIncludedChunksPlugin.js +2 -2
- package/lib/optimize/InnerGraph.js +5 -5
- package/lib/optimize/InnerGraphPlugin.js +14 -12
- package/lib/optimize/LimitChunkCountPlugin.js +5 -5
- package/lib/optimize/MangleExportsPlugin.js +5 -5
- package/lib/optimize/MergeDuplicateChunksPlugin.js +2 -2
- package/lib/optimize/MinChunkSizePlugin.js +3 -3
- package/lib/optimize/ModuleConcatenationPlugin.js +45 -38
- package/lib/optimize/RealContentHashPlugin.js +23 -23
- package/lib/optimize/RemoveEmptyChunksPlugin.js +2 -2
- package/lib/optimize/RemoveParentModulesPlugin.js +3 -3
- package/lib/optimize/RuntimeChunkPlugin.js +2 -2
- package/lib/optimize/SideEffectsFlagPlugin.js +5 -5
- package/lib/optimize/SplitChunksPlugin.js +20 -20
- package/lib/performance/AssetsOverSizeLimitWarning.js +1 -1
- package/lib/performance/EntrypointsOverSizeLimitWarning.js +2 -2
- package/lib/performance/SizeLimitsPlugin.js +4 -4
- package/lib/prefetch/ChunkPrefetchPreloadPlugin.js +1 -1
- package/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js +3 -3
- package/lib/rules/BasicMatcherRulePlugin.js +1 -1
- package/lib/rules/RuleSetCompiler.js +10 -10
- package/lib/rules/UseEffectRulePlugin.js +2 -2
- package/lib/runtime/GetChunkFilenameRuntimeModule.js +19 -15
- package/lib/runtime/GetMainFilenameRuntimeModule.js +1 -1
- package/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +1 -1
- package/lib/runtime/MakeDeferredNamespaceObjectRuntime.js +1 -1
- package/lib/runtime/StartupChunkDependenciesPlugin.js +2 -2
- package/lib/runtime/StartupChunkDependenciesRuntimeModule.js +3 -3
- package/lib/schemes/DataUriPlugin.js +3 -3
- package/lib/schemes/FileUriPlugin.js +1 -1
- package/lib/schemes/HttpUriPlugin.js +40 -36
- package/lib/schemes/VirtualUrlPlugin.js +1 -1
- package/lib/serialization/BinaryMiddleware.js +11 -11
- package/lib/serialization/FileMiddleware.js +18 -17
- package/lib/serialization/ObjectMiddleware.js +8 -8
- package/lib/serialization/Serializer.js +2 -2
- package/lib/serialization/SerializerMiddleware.js +2 -2
- package/lib/sharing/ConsumeSharedPlugin.js +4 -4
- package/lib/sharing/ProvideSharedPlugin.js +4 -4
- package/lib/sharing/SharePlugin.js +1 -1
- package/lib/sharing/resolveMatchedConfigs.js +1 -1
- package/lib/stats/DefaultStatsFactoryPlugin.js +85 -80
- package/lib/stats/DefaultStatsPresetPlugin.js +15 -15
- package/lib/stats/DefaultStatsPrinterPlugin.js +87 -87
- package/lib/stats/StatsFactory.js +7 -7
- package/lib/stats/StatsPrinter.js +9 -9
- package/lib/url/URLParserPlugin.js +5 -5
- package/lib/util/AsyncQueue.js +4 -4
- package/lib/util/IterableHelpers.js +2 -2
- package/lib/util/LazyBucketSortedSet.js +3 -3
- package/lib/util/SetHelpers.js +2 -2
- package/lib/util/StackedCacheMap.js +1 -1
- package/lib/util/StackedMap.js +1 -1
- package/lib/util/TupleSet.js +1 -1
- package/lib/util/WeakTupleMap.js +1 -1
- package/lib/util/cleverMerge.js +8 -8
- package/lib/util/comparators.js +10 -10
- package/lib/util/compileBooleanMatcher.js +20 -20
- package/lib/util/concatenate.js +3 -3
- package/lib/util/conventions.js +4 -4
- package/lib/util/create-schema-validation.js +1 -1
- package/lib/util/createHash.js +1 -1
- package/lib/util/deprecation.js +4 -4
- package/lib/util/deterministicGrouping.js +7 -7
- package/lib/util/findGraphRoots.js +1 -1
- package/lib/util/fs.js +4 -4
- package/lib/util/identifier.js +14 -14
- package/lib/util/magicComment.js +5 -1
- package/lib/util/memoize.js +1 -1
- package/lib/util/processAsyncTree.js +2 -2
- package/lib/util/propertyName.js +1 -1
- package/lib/util/removeBOM.js +1 -1
- package/lib/util/runtime.js +6 -6
- package/lib/util/semver.js +16 -16
- package/lib/util/serialization.js +5 -5
- package/lib/util/smartGrouping.js +1 -1
- package/lib/validateSchema.js +2 -2
- package/lib/wasm/EnableWasmLoadingPlugin.js +1 -1
- package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +1 -1
- package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +1 -1
- package/lib/wasm-async/UniversalCompileAsyncWasmPlugin.js +4 -4
- package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +13 -9
- package/lib/wasm-sync/WasmFinalizeExportsPlugin.js +2 -2
- package/lib/wasm-sync/WebAssemblyGenerator.js +16 -17
- package/lib/wasm-sync/WebAssemblyInInitialChunkError.js +4 -2
- package/lib/wasm-sync/WebAssemblyParser.js +2 -2
- package/lib/web/FetchCompileAsyncWasmPlugin.js +4 -4
- package/lib/web/FetchCompileWasmPlugin.js +4 -4
- package/lib/web/JsonpChunkLoadingPlugin.js +2 -2
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +1 -1
- package/lib/webpack.js +17 -12
- package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +2 -2
- package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +1 -1
- package/package.json +16 -16
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +4 -0
- package/types.d.ts +275 -64
|
@@ -123,7 +123,7 @@ class HotModuleReplacementPlugin {
|
|
|
123
123
|
const { hotAcceptCallback, hotAcceptWithoutCallback } =
|
|
124
124
|
HotModuleReplacementPlugin.getParserHooks(parser);
|
|
125
125
|
|
|
126
|
-
return expr => {
|
|
126
|
+
return (expr) => {
|
|
127
127
|
const module = parser.state.module;
|
|
128
128
|
const dep = new ConstDependency(
|
|
129
129
|
`${module.moduleArgument}.hot.accept`,
|
|
@@ -145,7 +145,7 @@ class HotModuleReplacementPlugin {
|
|
|
145
145
|
} else if (arg.isArray()) {
|
|
146
146
|
params =
|
|
147
147
|
/** @type {BasicEvaluatedExpression[]} */
|
|
148
|
-
(arg.items).filter(param => param.isString());
|
|
148
|
+
(arg.items).filter((param) => param.isString());
|
|
149
149
|
}
|
|
150
150
|
/** @type {string[]} */
|
|
151
151
|
const requests = [];
|
|
@@ -185,7 +185,7 @@ class HotModuleReplacementPlugin {
|
|
|
185
185
|
* @param {typeof ModuleHotDeclineDependency} ParamDependency dependency
|
|
186
186
|
* @returns {(expr: CallExpression) => boolean | undefined} callback
|
|
187
187
|
*/
|
|
188
|
-
const createDeclineHandler = (parser, ParamDependency) => expr => {
|
|
188
|
+
const createDeclineHandler = (parser, ParamDependency) => (expr) => {
|
|
189
189
|
const module = parser.state.module;
|
|
190
190
|
const dep = new ConstDependency(
|
|
191
191
|
`${module.moduleArgument}.hot.decline`,
|
|
@@ -205,7 +205,7 @@ class HotModuleReplacementPlugin {
|
|
|
205
205
|
} else if (arg.isArray()) {
|
|
206
206
|
params =
|
|
207
207
|
/** @type {BasicEvaluatedExpression[]} */
|
|
208
|
-
(arg.items).filter(param => param.isString());
|
|
208
|
+
(arg.items).filter((param) => param.isString());
|
|
209
209
|
}
|
|
210
210
|
for (const [idx, param] of params.entries()) {
|
|
211
211
|
const dep = new ParamDependency(
|
|
@@ -225,7 +225,7 @@ class HotModuleReplacementPlugin {
|
|
|
225
225
|
* @param {JavascriptParser} parser the parser
|
|
226
226
|
* @returns {(expr: Expression) => boolean | undefined} callback
|
|
227
227
|
*/
|
|
228
|
-
const createHMRExpressionHandler = parser => expr => {
|
|
228
|
+
const createHMRExpressionHandler = (parser) => (expr) => {
|
|
229
229
|
const module = parser.state.module;
|
|
230
230
|
const dep = new ConstDependency(
|
|
231
231
|
`${module.moduleArgument}.hot`,
|
|
@@ -243,13 +243,13 @@ class HotModuleReplacementPlugin {
|
|
|
243
243
|
* @param {JavascriptParser} parser the parser
|
|
244
244
|
* @returns {void}
|
|
245
245
|
*/
|
|
246
|
-
const applyModuleHot = parser => {
|
|
246
|
+
const applyModuleHot = (parser) => {
|
|
247
247
|
parser.hooks.evaluateIdentifier.for("module.hot").tap(
|
|
248
248
|
{
|
|
249
249
|
name: PLUGIN_NAME,
|
|
250
250
|
before: "NodeStuffPlugin"
|
|
251
251
|
},
|
|
252
|
-
expr =>
|
|
252
|
+
(expr) =>
|
|
253
253
|
evaluateToIdentifier(
|
|
254
254
|
"module.hot",
|
|
255
255
|
"module",
|
|
@@ -278,10 +278,10 @@ class HotModuleReplacementPlugin {
|
|
|
278
278
|
* @param {JavascriptParser} parser the parser
|
|
279
279
|
* @returns {void}
|
|
280
280
|
*/
|
|
281
|
-
const applyImportMetaHot = parser => {
|
|
281
|
+
const applyImportMetaHot = (parser) => {
|
|
282
282
|
parser.hooks.evaluateIdentifier
|
|
283
283
|
.for("import.meta.webpackHot")
|
|
284
|
-
.tap(PLUGIN_NAME, expr =>
|
|
284
|
+
.tap(PLUGIN_NAME, (expr) =>
|
|
285
285
|
evaluateToIdentifier(
|
|
286
286
|
"import.meta.webpackHot",
|
|
287
287
|
"import.meta",
|
|
@@ -381,7 +381,7 @@ class HotModuleReplacementPlugin {
|
|
|
381
381
|
chunk,
|
|
382
382
|
compareModulesById(chunkGraph)
|
|
383
383
|
),
|
|
384
|
-
m => /** @type {ModuleId} */ (chunkGraph.getModuleId(m))
|
|
384
|
+
(m) => /** @type {ModuleId} */ (chunkGraph.getModuleId(m))
|
|
385
385
|
);
|
|
386
386
|
}
|
|
387
387
|
});
|
|
@@ -391,7 +391,7 @@ class HotModuleReplacementPlugin {
|
|
|
391
391
|
const fullHashModules = new TupleSet();
|
|
392
392
|
/** @type {TupleSet<Module, RuntimeSpec>} */
|
|
393
393
|
const nonCodeGeneratedModules = new TupleSet();
|
|
394
|
-
compilation.hooks.fullHash.tap(PLUGIN_NAME, hash => {
|
|
394
|
+
compilation.hooks.fullHash.tap(PLUGIN_NAME, (hash) => {
|
|
395
395
|
const chunkGraph = compilation.chunkGraph;
|
|
396
396
|
const records = /** @type {Records} */ (compilation.records);
|
|
397
397
|
for (const chunk of compilation.chunks) {
|
|
@@ -399,7 +399,7 @@ class HotModuleReplacementPlugin {
|
|
|
399
399
|
* @param {Module} module module
|
|
400
400
|
* @returns {string} module hash
|
|
401
401
|
*/
|
|
402
|
-
const getModuleHash = module => {
|
|
402
|
+
const getModuleHash = (module) => {
|
|
403
403
|
if (
|
|
404
404
|
compilation.codeGenerationResults.has(module, chunk.runtime)
|
|
405
405
|
) {
|
|
@@ -524,7 +524,7 @@ class HotModuleReplacementPlugin {
|
|
|
524
524
|
const runtime = keyToRuntime(chunkRuntime[key]);
|
|
525
525
|
allOldRuntime = mergeRuntimeOwned(allOldRuntime, runtime);
|
|
526
526
|
}
|
|
527
|
-
forEachRuntime(allOldRuntime, runtime => {
|
|
527
|
+
forEachRuntime(allOldRuntime, (runtime) => {
|
|
528
528
|
const { path: filename, info: assetInfo } =
|
|
529
529
|
compilation.getPathWithInfo(
|
|
530
530
|
/** @type {NonNullable<OutputNormalized["hotUpdateMainFilename"]>} */
|
|
@@ -588,7 +588,7 @@ class HotModuleReplacementPlugin {
|
|
|
588
588
|
let removedFromRuntime;
|
|
589
589
|
const currentChunk = find(
|
|
590
590
|
compilation.chunks,
|
|
591
|
-
chunk => `${chunk.id}` === key
|
|
591
|
+
(chunk) => `${chunk.id}` === key
|
|
592
592
|
);
|
|
593
593
|
if (currentChunk) {
|
|
594
594
|
chunkId = currentChunk.id;
|
|
@@ -599,22 +599,22 @@ class HotModuleReplacementPlugin {
|
|
|
599
599
|
if (newRuntime === undefined) continue;
|
|
600
600
|
newModules = chunkGraph
|
|
601
601
|
.getChunkModules(currentChunk)
|
|
602
|
-
.filter(module => updatedModules.has(module, currentChunk));
|
|
602
|
+
.filter((module) => updatedModules.has(module, currentChunk));
|
|
603
603
|
newRuntimeModules = [
|
|
604
604
|
...chunkGraph.getChunkRuntimeModulesIterable(currentChunk)
|
|
605
|
-
].filter(module => updatedModules.has(module, currentChunk));
|
|
605
|
+
].filter((module) => updatedModules.has(module, currentChunk));
|
|
606
606
|
const fullHashModules =
|
|
607
607
|
chunkGraph.getChunkFullHashModulesIterable(currentChunk);
|
|
608
608
|
newFullHashModules =
|
|
609
609
|
fullHashModules &&
|
|
610
|
-
[...fullHashModules].filter(module =>
|
|
610
|
+
[...fullHashModules].filter((module) =>
|
|
611
611
|
updatedModules.has(module, currentChunk)
|
|
612
612
|
);
|
|
613
613
|
const dependentHashModules =
|
|
614
614
|
chunkGraph.getChunkDependentHashModulesIterable(currentChunk);
|
|
615
615
|
newDependentHashModules =
|
|
616
616
|
dependentHashModules &&
|
|
617
|
-
[...dependentHashModules].filter(module =>
|
|
617
|
+
[...dependentHashModules].filter((module) =>
|
|
618
618
|
updatedModules.has(module, currentChunk)
|
|
619
619
|
);
|
|
620
620
|
removedFromRuntime = subtractRuntime(oldRuntime, newRuntime);
|
|
@@ -626,7 +626,7 @@ class HotModuleReplacementPlugin {
|
|
|
626
626
|
}
|
|
627
627
|
if (removedFromRuntime) {
|
|
628
628
|
// chunk was removed from some runtimes
|
|
629
|
-
forEachRuntime(removedFromRuntime, runtime => {
|
|
629
|
+
forEachRuntime(removedFromRuntime, (runtime) => {
|
|
630
630
|
const item =
|
|
631
631
|
/** @type {HotUpdateMainContentByRuntimeItem} */
|
|
632
632
|
(
|
|
@@ -665,7 +665,7 @@ class HotModuleReplacementPlugin {
|
|
|
665
665
|
// module is no longer in this runtime combination
|
|
666
666
|
// We (incorrectly) assume that it's not in an overlapping runtime combination
|
|
667
667
|
// and dispose it from the main runtimes the chunk was removed from
|
|
668
|
-
forEachRuntime(removedFromRuntime, runtime => {
|
|
668
|
+
forEachRuntime(removedFromRuntime, (runtime) => {
|
|
669
669
|
// If the module is still used in this runtime, do not dispose it
|
|
670
670
|
// This could create a bad runtime state where the module is still loaded,
|
|
671
671
|
// but no chunk which contains it. This means we don't receive further HMR updates
|
|
@@ -764,7 +764,7 @@ class HotModuleReplacementPlugin {
|
|
|
764
764
|
compilation.hooks.chunkAsset.call(currentChunk, filename);
|
|
765
765
|
}
|
|
766
766
|
}
|
|
767
|
-
forEachRuntime(newRuntime, runtime => {
|
|
767
|
+
forEachRuntime(newRuntime, (runtime) => {
|
|
768
768
|
const item =
|
|
769
769
|
/** @type {HotUpdateMainContentByRuntimeItem} */ (
|
|
770
770
|
hotUpdateMainContentByRuntime.get(
|
|
@@ -829,7 +829,7 @@ To fix this, make sure to include [runtime] in the output.hotUpdateMainFilename
|
|
|
829
829
|
...completelyRemovedModulesArray,
|
|
830
830
|
...Array.from(
|
|
831
831
|
removedModules,
|
|
832
|
-
m =>
|
|
832
|
+
(m) =>
|
|
833
833
|
/** @type {ModuleId} */ (chunkGraph.getModuleId(m))
|
|
834
834
|
)
|
|
835
835
|
]
|
|
@@ -863,28 +863,28 @@ To fix this, make sure to include [runtime] in the output.hotUpdateMainFilename
|
|
|
863
863
|
|
|
864
864
|
normalModuleFactory.hooks.parser
|
|
865
865
|
.for(JAVASCRIPT_MODULE_TYPE_AUTO)
|
|
866
|
-
.tap(PLUGIN_NAME, parser => {
|
|
866
|
+
.tap(PLUGIN_NAME, (parser) => {
|
|
867
867
|
applyModuleHot(parser);
|
|
868
868
|
applyImportMetaHot(parser);
|
|
869
869
|
});
|
|
870
870
|
normalModuleFactory.hooks.parser
|
|
871
871
|
.for(JAVASCRIPT_MODULE_TYPE_DYNAMIC)
|
|
872
|
-
.tap(PLUGIN_NAME, parser => {
|
|
872
|
+
.tap(PLUGIN_NAME, (parser) => {
|
|
873
873
|
applyModuleHot(parser);
|
|
874
874
|
});
|
|
875
875
|
normalModuleFactory.hooks.parser
|
|
876
876
|
.for(JAVASCRIPT_MODULE_TYPE_ESM)
|
|
877
|
-
.tap(PLUGIN_NAME, parser => {
|
|
877
|
+
.tap(PLUGIN_NAME, (parser) => {
|
|
878
878
|
applyImportMetaHot(parser);
|
|
879
879
|
});
|
|
880
|
-
normalModuleFactory.hooks.module.tap(PLUGIN_NAME, module => {
|
|
880
|
+
normalModuleFactory.hooks.module.tap(PLUGIN_NAME, (module) => {
|
|
881
881
|
module.hot = true;
|
|
882
882
|
return module;
|
|
883
883
|
});
|
|
884
884
|
|
|
885
885
|
NormalModule.getCompilationHooks(compilation).loader.tap(
|
|
886
886
|
PLUGIN_NAME,
|
|
887
|
-
context => {
|
|
887
|
+
(context) => {
|
|
888
888
|
context.hot = true;
|
|
889
889
|
}
|
|
890
890
|
);
|
package/lib/IgnorePlugin.js
CHANGED
|
@@ -71,8 +71,8 @@ class IgnorePlugin {
|
|
|
71
71
|
* @returns {void}
|
|
72
72
|
*/
|
|
73
73
|
apply(compiler) {
|
|
74
|
-
compiler.hooks.normalModuleFactory.tap(PLUGIN_NAME, nmf => {
|
|
75
|
-
nmf.hooks.beforeResolve.tap(PLUGIN_NAME, resolveData => {
|
|
74
|
+
compiler.hooks.normalModuleFactory.tap(PLUGIN_NAME, (nmf) => {
|
|
75
|
+
nmf.hooks.beforeResolve.tap(PLUGIN_NAME, (resolveData) => {
|
|
76
76
|
const result = this.checkIgnore(resolveData);
|
|
77
77
|
|
|
78
78
|
if (
|
|
@@ -93,7 +93,7 @@ class IgnorePlugin {
|
|
|
93
93
|
return result;
|
|
94
94
|
});
|
|
95
95
|
});
|
|
96
|
-
compiler.hooks.contextModuleFactory.tap(PLUGIN_NAME, cmf => {
|
|
96
|
+
compiler.hooks.contextModuleFactory.tap(PLUGIN_NAME, (cmf) => {
|
|
97
97
|
cmf.hooks.beforeResolve.tap(PLUGIN_NAME, this.checkIgnore);
|
|
98
98
|
});
|
|
99
99
|
}
|
|
@@ -24,11 +24,11 @@ class IgnoreWarningsPlugin {
|
|
|
24
24
|
* @returns {void}
|
|
25
25
|
*/
|
|
26
26
|
apply(compiler) {
|
|
27
|
-
compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
|
|
28
|
-
compilation.hooks.processWarnings.tap(PLUGIN_NAME, warnings =>
|
|
27
|
+
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
|
|
28
|
+
compilation.hooks.processWarnings.tap(PLUGIN_NAME, (warnings) =>
|
|
29
29
|
warnings.filter(
|
|
30
|
-
warning =>
|
|
31
|
-
!this._ignoreWarnings.some(ignore => ignore(warning, compilation))
|
|
30
|
+
(warning) =>
|
|
31
|
+
!this._ignoreWarnings.some((ignore) => ignore(warning, compilation))
|
|
32
32
|
)
|
|
33
33
|
);
|
|
34
34
|
});
|
package/lib/InitFragment.js
CHANGED
|
@@ -173,6 +173,12 @@ makeSerializable(InitFragment, "webpack/lib/InitFragment");
|
|
|
173
173
|
InitFragment.prototype.merge =
|
|
174
174
|
/** @type {TODO} */
|
|
175
175
|
(undefined);
|
|
176
|
+
InitFragment.prototype.getImported =
|
|
177
|
+
/** @type {TODO} */
|
|
178
|
+
(undefined);
|
|
179
|
+
InitFragment.prototype.setImported =
|
|
180
|
+
/** @type {TODO} */
|
|
181
|
+
(undefined);
|
|
176
182
|
|
|
177
183
|
InitFragment.STAGE_CONSTANTS = 10;
|
|
178
184
|
InitFragment.STAGE_ASYNC_BOUNDARY = 20;
|
|
@@ -18,7 +18,7 @@ class InvalidDependenciesModuleWarning extends WebpackError {
|
|
|
18
18
|
*/
|
|
19
19
|
constructor(module, deps) {
|
|
20
20
|
const orderedDeps = deps ? [...deps].sort() : [];
|
|
21
|
-
const depsList = orderedDeps.map(dep => ` * ${JSON.stringify(dep)}`);
|
|
21
|
+
const depsList = orderedDeps.map((dep) => ` * ${JSON.stringify(dep)}`);
|
|
22
22
|
super(`Invalid dependencies have been reported by plugins or loaders for this module. All reported dependencies need to be absolute paths.
|
|
23
23
|
Invalid dependencies may lead to broken watching and caching.
|
|
24
24
|
As best effort we try to convert all invalid values to absolute paths and converting globs into context dependencies, but this is deprecated behavior.
|
|
@@ -32,7 +32,7 @@ class JavascriptMetaInfoPlugin {
|
|
|
32
32
|
* @param {JavascriptParser} parser the parser
|
|
33
33
|
* @returns {void}
|
|
34
34
|
*/
|
|
35
|
-
const handler = parser => {
|
|
35
|
+
const handler = (parser) => {
|
|
36
36
|
parser.hooks.call.for("eval").tap(PLUGIN_NAME, () => {
|
|
37
37
|
const buildInfo =
|
|
38
38
|
/** @type {BuildInfo} */
|
package/lib/LibManifestPlugin.js
CHANGED
|
@@ -86,7 +86,7 @@ class LibManifestPlugin {
|
|
|
86
86
|
this.options.entryOnly &&
|
|
87
87
|
!someInIterable(
|
|
88
88
|
moduleGraph.getIncomingConnections(module),
|
|
89
|
-
c => c.dependency instanceof EntryDependency
|
|
89
|
+
(c) => c.dependency instanceof EntryDependency
|
|
90
90
|
)
|
|
91
91
|
) {
|
|
92
92
|
continue;
|
|
@@ -129,7 +129,7 @@ class LibManifestPlugin {
|
|
|
129
129
|
mkdirp(
|
|
130
130
|
intermediateFileSystem,
|
|
131
131
|
dirname(intermediateFileSystem, targetPath),
|
|
132
|
-
err => {
|
|
132
|
+
(err) => {
|
|
133
133
|
if (err) return callback(err);
|
|
134
134
|
intermediateFileSystem.writeFile(targetPath, buffer, callback);
|
|
135
135
|
}
|
|
@@ -59,7 +59,7 @@ class LoaderOptionsPlugin {
|
|
|
59
59
|
*/
|
|
60
60
|
apply(compiler) {
|
|
61
61
|
const options = this.options;
|
|
62
|
-
compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
|
|
62
|
+
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
|
|
63
63
|
NormalModule.getCompilationHooks(compilation).loader.tap(
|
|
64
64
|
PLUGIN_NAME,
|
|
65
65
|
(context, module) => {
|
|
@@ -25,10 +25,10 @@ class LoaderTargetPlugin {
|
|
|
25
25
|
* @returns {void}
|
|
26
26
|
*/
|
|
27
27
|
apply(compiler) {
|
|
28
|
-
compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
|
|
28
|
+
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
|
|
29
29
|
NormalModule.getCompilationHooks(compilation).loader.tap(
|
|
30
30
|
PLUGIN_NAME,
|
|
31
|
-
loaderContext => {
|
|
31
|
+
(loaderContext) => {
|
|
32
32
|
loaderContext.target = this.target;
|
|
33
33
|
}
|
|
34
34
|
);
|
package/lib/MainTemplate.js
CHANGED
|
@@ -323,7 +323,7 @@ class MainTemplate {
|
|
|
323
323
|
/**
|
|
324
324
|
* @param {PathData} options context data
|
|
325
325
|
* @returns {string} interpolated path
|
|
326
|
-
*/ options =>
|
|
326
|
+
*/ (options) =>
|
|
327
327
|
compilation.getAssetPath(
|
|
328
328
|
/** @type {string} */
|
|
329
329
|
(compilation.outputOptions.publicPath),
|
package/lib/Module.js
CHANGED
|
@@ -115,9 +115,10 @@ const makeSerializable = require("./util/makeSerializable");
|
|
|
115
115
|
* @property {boolean=} strictHarmonyModule
|
|
116
116
|
* @property {boolean=} async
|
|
117
117
|
* @property {boolean=} sideEffectFree
|
|
118
|
-
* @property {Record<string, string>=} exportsFinalName
|
|
119
118
|
* @property {boolean=} isCSSModule
|
|
120
119
|
* @property {Record<string, string>=} jsIncompatibleExports
|
|
120
|
+
* @property {Record<string, string>=} exportsFinalName
|
|
121
|
+
* @property {string=} factoryExportsBinding
|
|
121
122
|
*/
|
|
122
123
|
|
|
123
124
|
/**
|
|
@@ -775,7 +776,7 @@ class Module extends DependenciesBlock {
|
|
|
775
776
|
fromModule,
|
|
776
777
|
connections
|
|
777
778
|
] of moduleGraph.getIncomingConnectionsByOriginModule(this)) {
|
|
778
|
-
if (!connections.some(c => c.isTargetActive(chunk.runtime))) continue;
|
|
779
|
+
if (!connections.some((c) => c.isTargetActive(chunk.runtime))) continue;
|
|
779
780
|
for (const originChunk of chunkGraph.getModuleChunksIterable(
|
|
780
781
|
/** @type {Module} */ (fromModule)
|
|
781
782
|
)) {
|
|
@@ -96,13 +96,13 @@ const getHash =
|
|
|
96
96
|
* @param {Record<string, () => T>} obj the object to convert to a lazy access object
|
|
97
97
|
* @returns {T} the lazy access object
|
|
98
98
|
*/
|
|
99
|
-
const lazyObject = obj => {
|
|
99
|
+
const lazyObject = (obj) => {
|
|
100
100
|
const newObj = /** @type {T} */ ({});
|
|
101
101
|
for (const key of Object.keys(obj)) {
|
|
102
102
|
const fn = obj[key];
|
|
103
103
|
Object.defineProperty(newObj, key, {
|
|
104
104
|
get: () => fn(),
|
|
105
|
-
set: v => {
|
|
105
|
+
set: (v) => {
|
|
106
106
|
Object.defineProperty(newObj, key, {
|
|
107
107
|
value: v,
|
|
108
108
|
enumerable: true,
|
|
@@ -320,7 +320,7 @@ ModuleFilenameHelpers.replaceDuplicates = (array, fn, comparator) => {
|
|
|
320
320
|
const matchPart = (str, test) => {
|
|
321
321
|
if (!test) return true;
|
|
322
322
|
if (Array.isArray(test)) {
|
|
323
|
-
return test.some(test => matchPart(str, test));
|
|
323
|
+
return test.some((test) => matchPart(str, test));
|
|
324
324
|
}
|
|
325
325
|
if (typeof test === "string") {
|
|
326
326
|
return str.startsWith(test);
|
package/lib/ModuleGraph.js
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
const util = require("util");
|
|
9
9
|
const ExportsInfo = require("./ExportsInfo");
|
|
10
10
|
const ModuleGraphConnection = require("./ModuleGraphConnection");
|
|
11
|
+
const HarmonyImportDependency = require("./dependencies/HarmonyImportDependency");
|
|
11
12
|
const SortableSet = require("./util/SortableSet");
|
|
12
13
|
const WeakTupleMap = require("./util/WeakTupleMap");
|
|
13
14
|
const { sortWithSourceOrder } = require("./util/comparators");
|
|
@@ -33,66 +34,51 @@ const { sortWithSourceOrder } = require("./util/comparators");
|
|
|
33
34
|
const EMPTY_SET = new Set();
|
|
34
35
|
|
|
35
36
|
/**
|
|
37
|
+
* @template {Module | null | undefined} T
|
|
36
38
|
* @param {SortableSet<ModuleGraphConnection>} set input
|
|
37
|
-
* @
|
|
39
|
+
* @param {(connection: ModuleGraphConnection) => T} getKey function to extract key from connection
|
|
40
|
+
* @returns {readonly Map<T, readonly ModuleGraphConnection[]>} mapped by key
|
|
38
41
|
*/
|
|
39
|
-
const
|
|
42
|
+
const getConnectionsByKey = (set, getKey) => {
|
|
40
43
|
const map = new Map();
|
|
41
|
-
/** @type {
|
|
42
|
-
let
|
|
44
|
+
/** @type {T | 0} */
|
|
45
|
+
let lastKey = 0;
|
|
43
46
|
/** @type {ModuleGraphConnection[] | undefined} */
|
|
44
47
|
let lastList;
|
|
45
48
|
for (const connection of set) {
|
|
46
|
-
const
|
|
47
|
-
if (
|
|
49
|
+
const key = getKey(connection);
|
|
50
|
+
if (lastKey === key) {
|
|
48
51
|
/** @type {ModuleGraphConnection[]} */
|
|
49
52
|
(lastList).push(connection);
|
|
50
53
|
} else {
|
|
51
|
-
|
|
52
|
-
const list = map.get(
|
|
54
|
+
lastKey = key;
|
|
55
|
+
const list = map.get(key);
|
|
53
56
|
if (list !== undefined) {
|
|
54
57
|
lastList = list;
|
|
55
58
|
list.push(connection);
|
|
56
59
|
} else {
|
|
57
60
|
const list = [connection];
|
|
58
61
|
lastList = list;
|
|
59
|
-
map.set(
|
|
62
|
+
map.set(key, list);
|
|
60
63
|
}
|
|
61
64
|
}
|
|
62
65
|
}
|
|
63
66
|
return map;
|
|
64
67
|
};
|
|
65
68
|
|
|
69
|
+
/**
|
|
70
|
+
* @param {SortableSet<ModuleGraphConnection>} set input
|
|
71
|
+
* @returns {readonly Map<Module | undefined | null, readonly ModuleGraphConnection[]>} mapped by origin module
|
|
72
|
+
*/
|
|
73
|
+
const getConnectionsByOriginModule = (set) =>
|
|
74
|
+
getConnectionsByKey(set, (connection) => connection.originModule);
|
|
75
|
+
|
|
66
76
|
/**
|
|
67
77
|
* @param {SortableSet<ModuleGraphConnection>} set input
|
|
68
78
|
* @returns {readonly Map<Module | undefined, readonly ModuleGraphConnection[]>} mapped by module
|
|
69
79
|
*/
|
|
70
|
-
const getConnectionsByModule = set =>
|
|
71
|
-
|
|
72
|
-
/** @type {Module | 0} */
|
|
73
|
-
let lastModule = 0;
|
|
74
|
-
/** @type {ModuleGraphConnection[] | undefined} */
|
|
75
|
-
let lastList;
|
|
76
|
-
for (const connection of set) {
|
|
77
|
-
const { module } = connection;
|
|
78
|
-
if (lastModule === module) {
|
|
79
|
-
/** @type {ModuleGraphConnection[]} */
|
|
80
|
-
(lastList).push(connection);
|
|
81
|
-
} else {
|
|
82
|
-
lastModule = module;
|
|
83
|
-
const list = map.get(module);
|
|
84
|
-
if (list !== undefined) {
|
|
85
|
-
lastList = list;
|
|
86
|
-
list.push(connection);
|
|
87
|
-
} else {
|
|
88
|
-
const list = [connection];
|
|
89
|
-
lastList = list;
|
|
90
|
-
map.set(module, list);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
return map;
|
|
95
|
-
};
|
|
80
|
+
const getConnectionsByModule = (set) =>
|
|
81
|
+
getConnectionsByKey(set, (connection) => connection.module);
|
|
96
82
|
|
|
97
83
|
/** @typedef {SortableSet<ModuleGraphConnection>} IncomingConnections */
|
|
98
84
|
/** @typedef {SortableSet<ModuleGraphConnection>} OutgoingConnections */
|
|
@@ -840,8 +826,7 @@ class ModuleGraph {
|
|
|
840
826
|
for (const connection of connections) {
|
|
841
827
|
if (
|
|
842
828
|
!connection.dependency ||
|
|
843
|
-
connection.dependency instanceof
|
|
844
|
-
require("./dependencies/CommonJsSelfReferenceDependency")
|
|
829
|
+
!(connection.dependency instanceof HarmonyImportDependency)
|
|
845
830
|
) {
|
|
846
831
|
continue;
|
|
847
832
|
}
|
|
@@ -956,7 +941,7 @@ class ModuleGraph {
|
|
|
956
941
|
* @param {Module} module the module
|
|
957
942
|
* @returns {ModuleGraph} the module graph
|
|
958
943
|
*/
|
|
959
|
-
module => {
|
|
944
|
+
(module) => {
|
|
960
945
|
const moduleGraph = moduleGraphForModuleMap.get(module);
|
|
961
946
|
if (!moduleGraph) {
|
|
962
947
|
throw new Error(
|
|
@@ -26,7 +26,7 @@ const JavascriptModulesPlugin = require("./javascript/JavascriptModulesPlugin");
|
|
|
26
26
|
* @param {Iterable<T>} iterable iterable
|
|
27
27
|
* @returns {string} joined with comma
|
|
28
28
|
*/
|
|
29
|
-
const joinIterableWithComma = iterable => {
|
|
29
|
+
const joinIterableWithComma = (iterable) => {
|
|
30
30
|
// This is more performant than Array.from().join(", ")
|
|
31
31
|
// as it doesn't create an array
|
|
32
32
|
let str = "";
|
|
@@ -94,7 +94,7 @@ const printExportsInfoToSource = (
|
|
|
94
94
|
? ` -> ${target.module.readableIdentifier(requestShortener)}${
|
|
95
95
|
target.export
|
|
96
96
|
? ` .${target.export
|
|
97
|
-
.map(e => JSON.stringify(e).slice(1, -1))
|
|
97
|
+
.map((e) => JSON.stringify(e).slice(1, -1))
|
|
98
98
|
.join(".")}`
|
|
99
99
|
: ""
|
|
100
100
|
}`
|
|
@@ -165,7 +165,7 @@ class ModuleInfoHeaderPlugin {
|
|
|
165
165
|
*/
|
|
166
166
|
apply(compiler) {
|
|
167
167
|
const { _verbose: verbose } = this;
|
|
168
|
-
compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
|
|
168
|
+
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
|
|
169
169
|
const javascriptHooks =
|
|
170
170
|
JavascriptModulesPlugin.getCompilationHooks(compilation);
|
|
171
171
|
javascriptHooks.renderModulePackage.tap(
|
package/lib/ModuleParseError.js
CHANGED
|
@@ -43,7 +43,7 @@ class ModuleParseError extends WebpackError {
|
|
|
43
43
|
"\nYou may need an appropriate loader to handle this file type.";
|
|
44
44
|
} else if (loaders.length >= 1) {
|
|
45
45
|
message += `\nFile was processed with these loaders:${loaders
|
|
46
|
-
.map(loader => `\n * ${loader}`)
|
|
46
|
+
.map((loader) => `\n * ${loader}`)
|
|
47
47
|
.join("")}`;
|
|
48
48
|
message +=
|
|
49
49
|
"\nYou may need an additional loader to handle the result of these loaders.";
|
|
@@ -75,8 +75,10 @@ class ModuleParseError extends WebpackError {
|
|
|
75
75
|
const linesAfter = sourceLines.slice(lineNumber, lineNumber + 2);
|
|
76
76
|
|
|
77
77
|
message += `${linesBefore
|
|
78
|
-
.map(l => `\n| ${l}`)
|
|
79
|
-
.join(
|
|
78
|
+
.map((l) => `\n| ${l}`)
|
|
79
|
+
.join(
|
|
80
|
+
""
|
|
81
|
+
)}\n> ${theLine}${linesAfter.map((l) => `\n| ${l}`).join("")}`;
|
|
80
82
|
}
|
|
81
83
|
|
|
82
84
|
loc = { start: err.loc };
|
package/lib/ModuleTemplate.js
CHANGED
|
@@ -18,6 +18,7 @@ const memoize = require("./util/memoize");
|
|
|
18
18
|
/** @typedef {import("./ModuleGraph")} ModuleGraph */
|
|
19
19
|
/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */
|
|
20
20
|
/** @typedef {import("./javascript/JavascriptModulesPlugin").ChunkRenderContext} ChunkRenderContext */
|
|
21
|
+
/** @typedef {import("./javascript/JavascriptModulesPlugin").ModuleRenderContext} ModuleRenderContext */
|
|
21
22
|
/** @typedef {import("./util/Hash")} Hash */
|
|
22
23
|
|
|
23
24
|
/**
|
|
@@ -44,7 +45,7 @@ class ModuleTemplate {
|
|
|
44
45
|
/**
|
|
45
46
|
* @template AdditionalOptions
|
|
46
47
|
* @param {string | Tap & IfSet<AdditionalOptions>} options options
|
|
47
|
-
* @param {(source: Source, module: Module,
|
|
48
|
+
* @param {(source: Source, module: Module, moduleRenderContext: ModuleRenderContext, dependencyTemplates: DependencyTemplates) => Source} fn fn
|
|
48
49
|
*/
|
|
49
50
|
(options, fn) => {
|
|
50
51
|
getJavascriptModulesPlugin()
|
|
@@ -69,7 +70,7 @@ class ModuleTemplate {
|
|
|
69
70
|
/**
|
|
70
71
|
* @template AdditionalOptions
|
|
71
72
|
* @param {string | Tap & IfSet<AdditionalOptions>} options options
|
|
72
|
-
* @param {(source: Source, module: Module,
|
|
73
|
+
* @param {(source: Source, module: Module, moduleRenderContext: ModuleRenderContext, dependencyTemplates: DependencyTemplates) => Source} fn fn
|
|
73
74
|
*/
|
|
74
75
|
(options, fn) => {
|
|
75
76
|
getJavascriptModulesPlugin()
|