webpack 5.101.3 → 5.102.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 +21 -26
- package/lib/APIPlugin.js +30 -36
- package/lib/AsyncDependenciesBlock.js +1 -4
- package/lib/BannerPlugin.js +0 -1
- package/lib/Cache.js +7 -6
- package/lib/CacheFacade.js +0 -1
- package/lib/Chunk.js +49 -31
- package/lib/ChunkGraph.js +37 -27
- package/lib/ChunkGroup.js +8 -10
- package/lib/ChunkTemplate.js +1 -1
- package/lib/CleanPlugin.js +3 -3
- package/lib/CodeGenerationResults.js +3 -2
- package/lib/CompatibilityPlugin.js +29 -12
- package/lib/Compilation.js +209 -196
- package/lib/Compiler.js +36 -35
- package/lib/ConcatenationScope.js +6 -1
- package/lib/ConditionalInitFragment.js +1 -1
- package/lib/ConstPlugin.js +6 -5
- package/lib/ContextExclusionPlugin.js +0 -1
- package/lib/ContextModule.js +25 -21
- package/lib/ContextModuleFactory.js +30 -11
- package/lib/ContextReplacementPlugin.js +38 -15
- package/lib/DefinePlugin.js +5 -9
- package/lib/DelegatedModule.js +7 -11
- package/lib/DependenciesBlock.js +0 -2
- package/lib/Dependency.js +9 -11
- package/lib/DependencyTemplates.js +2 -4
- package/lib/DllModule.js +1 -7
- package/lib/DllReferencePlugin.js +2 -4
- package/lib/DynamicEntryPlugin.js +0 -2
- package/lib/EntryOptionPlugin.js +0 -5
- package/lib/EnvironmentNotSupportAsyncWarning.js +0 -3
- package/lib/EvalDevToolModulePlugin.js +4 -3
- package/lib/EvalSourceMapDevToolPlugin.js +3 -4
- package/lib/ExportsInfo.js +50 -49
- package/lib/ExternalModule.js +84 -52
- package/lib/ExternalModuleFactoryPlugin.js +27 -7
- package/lib/ExternalsPlugin.js +24 -17
- package/lib/FileSystemInfo.js +105 -90
- package/lib/FlagDependencyUsagePlugin.js +3 -4
- package/lib/Generator.js +2 -13
- package/lib/GraphHelpers.js +0 -3
- package/lib/HookWebpackError.js +0 -2
- package/lib/HotModuleReplacementPlugin.js +22 -24
- package/lib/HotUpdateChunk.js +0 -3
- package/lib/IgnorePlugin.js +5 -2
- package/lib/InitFragment.js +41 -29
- package/lib/InvalidDependenciesModuleWarning.js +0 -1
- package/lib/LibManifestPlugin.js +4 -6
- package/lib/LoaderOptionsPlugin.js +1 -10
- package/lib/MainTemplate.js +8 -19
- package/lib/Module.js +32 -20
- package/lib/ModuleFactory.js +1 -1
- package/lib/ModuleFilenameHelpers.js +42 -25
- package/lib/ModuleGraph.js +30 -16
- package/lib/ModuleInfoHeaderPlugin.js +0 -1
- package/lib/ModuleTemplate.js +0 -2
- package/lib/ModuleTypeConstants.js +11 -1
- package/lib/MultiCompiler.js +23 -15
- package/lib/MultiWatching.js +6 -10
- package/lib/NodeStuffPlugin.js +2 -10
- package/lib/NormalModule.js +146 -89
- package/lib/NormalModuleFactory.js +132 -42
- package/lib/OptionsApply.js +1 -1
- package/lib/Parser.js +1 -1
- package/lib/ProgressPlugin.js +6 -10
- package/lib/ProvidePlugin.js +5 -7
- package/lib/RawModule.js +1 -6
- package/lib/RecordIdsPlugin.js +10 -6
- package/lib/ResolverFactory.js +0 -2
- package/lib/RuntimeGlobals.js +5 -0
- package/lib/RuntimeModule.js +1 -3
- package/lib/RuntimePlugin.js +26 -22
- package/lib/RuntimeTemplate.js +22 -12
- package/lib/SourceMapDevToolModuleOptionsPlugin.js +2 -2
- package/lib/SourceMapDevToolPlugin.js +11 -18
- package/lib/Stats.js +0 -1
- package/lib/Template.js +6 -11
- package/lib/TemplatedPathPlugin.js +2 -1
- package/lib/WatchIgnorePlugin.js +2 -3
- package/lib/Watching.js +15 -15
- package/lib/WebpackIsIncludedPlugin.js +0 -2
- package/lib/WebpackOptionsApply.js +74 -107
- package/lib/asset/AssetBytesGenerator.js +167 -0
- package/lib/asset/AssetBytesParser.js +37 -0
- package/lib/asset/AssetGenerator.js +22 -37
- package/lib/asset/AssetModulesPlugin.js +34 -16
- package/lib/asset/AssetParser.js +7 -3
- package/lib/asset/AssetSourceGenerator.js +1 -1
- package/lib/asset/RawDataUrlModule.js +3 -2
- package/lib/async-modules/AsyncModuleHelpers.js +6 -4
- package/lib/buildChunkGraph.js +0 -1
- package/lib/cache/MemoryCachePlugin.js +0 -2
- package/lib/cache/MemoryWithGcCachePlugin.js +0 -2
- package/lib/cache/PackFileCacheStrategy.js +14 -1
- package/lib/cache/ResolverCachePlugin.js +9 -15
- package/lib/cache/getLazyHashedEtag.js +1 -1
- package/lib/config/browserslistTargetHandler.js +77 -76
- package/lib/config/defaults.js +162 -23
- package/lib/config/normalization.js +18 -3
- package/lib/config/target.js +1 -1
- package/lib/container/ContainerEntryDependency.js +0 -1
- package/lib/container/ContainerEntryModule.js +3 -7
- package/lib/container/ContainerPlugin.js +1 -2
- package/lib/container/ContainerReferencePlugin.js +0 -1
- package/lib/container/FallbackDependency.js +2 -1
- package/lib/container/FallbackModule.js +6 -7
- package/lib/container/ModuleFederationPlugin.js +0 -1
- package/lib/container/RemoteModule.js +8 -8
- package/lib/container/RemoteRuntimeModule.js +2 -2
- package/lib/css/CssGenerator.js +3 -6
- package/lib/css/CssLoadingRuntimeModule.js +6 -9
- package/lib/css/CssModulesPlugin.js +13 -19
- package/lib/css/CssParser.js +3 -3
- package/lib/css/walkCssTokens.js +2 -2
- package/lib/debug/ProfilingPlugin.js +35 -8
- package/lib/dependencies/AMDDefineDependencyParserPlugin.js +12 -17
- package/lib/dependencies/AMDPlugin.js +2 -2
- package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +1 -2
- package/lib/dependencies/CachedConstDependency.js +0 -4
- package/lib/dependencies/CommonJsExportRequireDependency.js +20 -14
- package/lib/dependencies/CommonJsExportsDependency.js +2 -1
- package/lib/dependencies/CommonJsExportsParserPlugin.js +20 -5
- package/lib/dependencies/CommonJsFullRequireDependency.js +6 -4
- package/lib/dependencies/CommonJsImportsParserPlugin.js +16 -7
- package/lib/dependencies/CommonJsRequireContextDependency.js +1 -1
- package/lib/dependencies/CommonJsSelfReferenceDependency.js +4 -4
- package/lib/dependencies/ConstDependency.js +2 -2
- package/lib/dependencies/ContextDependency.js +9 -4
- package/lib/dependencies/ContextDependencyHelpers.js +2 -2
- package/lib/dependencies/ContextDependencyTemplateAsId.js +9 -9
- package/lib/dependencies/ContextDependencyTemplateAsRequireCall.js +9 -9
- package/lib/dependencies/ContextElementDependency.js +22 -11
- package/lib/dependencies/CssIcssImportDependency.js +0 -2
- package/lib/dependencies/CssIcssSymbolDependency.js +2 -2
- package/lib/dependencies/CssImportDependency.js +0 -8
- package/lib/dependencies/CssLocalIdentifierDependency.js +4 -7
- package/lib/dependencies/CssSelfLocalIdentifierDependency.js +2 -2
- package/lib/dependencies/CssUrlDependency.js +0 -6
- package/lib/dependencies/ExportsInfoDependency.js +7 -9
- package/lib/dependencies/ExternalModuleDependency.js +0 -3
- package/lib/dependencies/ExternalModuleInitFragment.js +1 -1
- package/lib/dependencies/HarmonyAcceptDependency.js +1 -1
- package/lib/dependencies/HarmonyAcceptImportDependency.js +0 -4
- package/lib/dependencies/HarmonyCompatibilityDependency.js +0 -1
- package/lib/dependencies/HarmonyDetectionParserPlugin.js +0 -14
- package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +3 -3
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +4 -1
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +29 -35
- package/lib/dependencies/HarmonyImportDependency.js +33 -14
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +20 -23
- package/lib/dependencies/HarmonyImportSideEffectDependency.js +0 -4
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +46 -31
- package/lib/dependencies/HarmonyModulesPlugin.js +3 -3
- package/lib/dependencies/ImportContextDependency.js +13 -0
- package/lib/dependencies/ImportDependency.js +18 -6
- package/lib/dependencies/ImportEagerDependency.js +2 -3
- package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +8 -5
- package/lib/dependencies/ImportMetaContextPlugin.js +0 -1
- package/lib/dependencies/ImportMetaPlugin.js +3 -2
- package/lib/dependencies/ImportParserPlugin.js +288 -45
- package/lib/dependencies/ImportWeakDependency.js +2 -3
- package/lib/dependencies/JsonExportsDependency.js +0 -1
- package/lib/dependencies/LoaderDependency.js +0 -3
- package/lib/dependencies/LoaderImportDependency.js +0 -3
- package/lib/dependencies/LoaderPlugin.js +11 -5
- package/lib/dependencies/ModuleDecoratorDependency.js +2 -4
- package/lib/dependencies/ModuleDependency.js +3 -9
- package/lib/dependencies/NullDependency.js +2 -0
- package/lib/dependencies/ProvidedDependency.js +6 -8
- package/lib/dependencies/PureExpressionDependency.js +0 -1
- package/lib/dependencies/RequireEnsureDependenciesBlock.js +0 -1
- package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +1 -2
- package/lib/dependencies/RequireIncludeDependency.js +2 -2
- package/lib/dependencies/RequireResolveDependency.js +2 -2
- package/lib/dependencies/RuntimeRequirementsDependency.js +2 -3
- package/lib/dependencies/StaticExportsDependency.js +3 -5
- package/lib/dependencies/URLDependency.js +2 -7
- package/lib/dependencies/URLPlugin.js +1 -2
- package/lib/dependencies/WebAssemblyExportImportedDependency.js +2 -2
- package/lib/dependencies/WebAssemblyImportDependency.js +2 -2
- package/lib/dependencies/WebpackIsIncludedDependency.js +2 -3
- package/lib/dependencies/WorkerDependency.js +2 -3
- package/lib/dependencies/WorkerPlugin.js +4 -12
- package/lib/dependencies/processExportInfo.js +2 -3
- package/lib/esm/ModuleChunkFormatPlugin.js +0 -3
- package/lib/esm/ModuleChunkLoadingPlugin.js +2 -1
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +7 -7
- package/lib/hmr/LazyCompilationPlugin.js +6 -4
- package/lib/hmr/lazyCompilationBackend.js +13 -10
- package/lib/ids/DeterministicChunkIdsPlugin.js +0 -1
- package/lib/ids/HashedModuleIdsPlugin.js +5 -7
- package/lib/ids/IdHelpers.js +1 -1
- package/lib/ids/NamedChunkIdsPlugin.js +1 -6
- package/lib/ids/NamedModuleIdsPlugin.js +1 -5
- package/lib/ids/NaturalChunkIdsPlugin.js +0 -1
- package/lib/ids/NaturalModuleIdsPlugin.js +0 -1
- package/lib/ids/OccurrenceChunkIdsPlugin.js +0 -1
- package/lib/ids/OccurrenceModuleIdsPlugin.js +0 -1
- package/lib/ids/SyncModuleIdsPlugin.js +4 -3
- package/lib/index.js +8 -7
- package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +4 -1
- package/lib/javascript/BasicEvaluatedExpression.js +13 -6
- package/lib/javascript/ChunkFormatHelpers.js +1 -1
- package/lib/javascript/CommonJsChunkFormatPlugin.js +0 -1
- package/lib/javascript/JavascriptGenerator.js +2 -3
- package/lib/javascript/JavascriptModulesPlugin.js +46 -24
- package/lib/javascript/JavascriptParser.js +120 -55
- package/lib/javascript/JavascriptParserHelpers.js +2 -2
- package/lib/javascript/StartupHelpers.js +2 -4
- package/lib/json/JsonData.js +1 -1
- package/lib/json/JsonGenerator.js +4 -5
- package/lib/json/JsonModulesPlugin.js +0 -3
- package/lib/json/JsonParser.js +4 -2
- package/lib/library/AbstractLibraryPlugin.js +2 -2
- package/lib/library/AmdLibraryPlugin.js +0 -1
- package/lib/library/AssignLibraryPlugin.js +23 -12
- package/lib/library/EnableLibraryPlugin.js +7 -11
- package/lib/library/ExportPropertyLibraryPlugin.js +8 -20
- package/lib/library/JsonpLibraryPlugin.js +5 -2
- package/lib/library/ModuleLibraryPlugin.js +88 -43
- package/lib/library/SystemLibraryPlugin.js +15 -6
- package/lib/library/UmdLibraryPlugin.js +12 -18
- package/lib/logging/Logger.js +12 -10
- package/lib/logging/createConsoleLogger.js +15 -14
- package/lib/logging/truncateArgs.js +1 -1
- package/lib/node/CommonJsChunkLoadingPlugin.js +2 -1
- package/lib/node/NodeWatchFileSystem.js +4 -4
- package/lib/node/ReadFileChunkLoadingRuntimeModule.js +2 -2
- package/lib/node/RequireChunkLoadingRuntimeModule.js +5 -2
- package/lib/node/nodeConsole.js +2 -2
- package/lib/optimize/AggressiveSplittingPlugin.js +2 -0
- package/lib/optimize/ConcatenatedModule.js +142 -100
- package/lib/optimize/InnerGraph.js +17 -11
- package/lib/optimize/InnerGraphPlugin.js +0 -3
- package/lib/optimize/ModuleConcatenationPlugin.js +3 -4
- package/lib/optimize/RealContentHashPlugin.js +5 -3
- package/lib/optimize/RuntimeChunkPlugin.js +0 -1
- package/lib/optimize/SideEffectsFlagPlugin.js +3 -10
- package/lib/optimize/SplitChunksPlugin.js +46 -40
- package/lib/performance/SizeLimitsPlugin.js +2 -1
- package/lib/prefetch/ChunkPrefetchFunctionRuntimeModule.js +5 -7
- package/lib/prefetch/ChunkPrefetchPreloadPlugin.js +0 -2
- package/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js +0 -1
- package/lib/prefetch/ChunkPrefetchTriggerRuntimeModule.js +2 -2
- package/lib/prefetch/ChunkPreloadTriggerRuntimeModule.js +2 -2
- package/lib/rules/BasicMatcherRulePlugin.js +0 -2
- package/lib/rules/ObjectMatcherRulePlugin.js +0 -1
- package/lib/rules/RuleSetCompiler.js +8 -6
- package/lib/runtime/BaseUriRuntimeModule.js +2 -2
- package/lib/runtime/CompatRuntimeModule.js +0 -1
- package/lib/runtime/GetChunkFilenameRuntimeModule.js +8 -9
- package/lib/runtime/LoadScriptRuntimeModule.js +0 -2
- package/lib/runtime/MakeDeferredNamespaceObjectRuntime.js +1 -1
- package/lib/runtime/PublicPathRuntimeModule.js +2 -2
- package/lib/runtime/StartupEntrypointRuntimeModule.js +0 -1
- package/lib/runtime/SystemContextRuntimeModule.js +0 -2
- package/lib/runtime/ToBinaryRuntimeModule.js +64 -0
- package/lib/schemes/DataUriPlugin.js +2 -28
- package/lib/schemes/FileUriPlugin.js +5 -2
- package/lib/schemes/HttpUriPlugin.js +4 -2
- package/lib/schemes/VirtualUrlPlugin.js +11 -11
- package/lib/serialization/FileMiddleware.js +1 -1
- package/lib/serialization/NullPrototypeObjectSerializer.js +5 -3
- package/lib/serialization/ObjectMiddleware.js +31 -20
- package/lib/serialization/SerializerMiddleware.js +1 -3
- package/lib/serialization/types.js +1 -1
- package/lib/sharing/ConsumeSharedModule.js +3 -5
- package/lib/sharing/ConsumeSharedPlugin.js +2 -4
- package/lib/sharing/ConsumeSharedRuntimeModule.js +9 -6
- package/lib/sharing/ProvideSharedModule.js +3 -7
- package/lib/sharing/SharePlugin.js +0 -2
- package/lib/sharing/ShareRuntimeModule.js +4 -1
- package/lib/sharing/resolveMatchedConfigs.js +14 -6
- package/lib/sharing/utils.js +0 -6
- package/lib/stats/DefaultStatsFactoryPlugin.js +179 -95
- package/lib/stats/DefaultStatsPresetPlugin.js +15 -9
- package/lib/stats/DefaultStatsPrinterPlugin.js +77 -113
- package/lib/stats/StatsFactory.js +14 -11
- package/lib/url/URLParserPlugin.js +2 -4
- package/lib/util/ArrayHelpers.js +4 -4
- package/lib/util/AsyncQueue.js +1 -0
- package/lib/util/Hash.js +35 -5
- package/lib/util/LazySet.js +2 -2
- package/lib/util/StackedCacheMap.js +0 -2
- package/lib/util/TupleSet.js +9 -4
- package/lib/util/URLAbsoluteSpecifier.js +0 -1
- package/lib/util/WeakTupleMap.js +1 -1
- package/lib/util/chainedImports.js +3 -1
- package/lib/util/cleverMerge.js +15 -18
- package/lib/util/comparators.js +2 -4
- package/lib/util/compileBooleanMatcher.js +11 -9
- package/lib/util/concatenate.js +1 -2
- package/lib/util/create-schema-validation.js +1 -2
- package/lib/util/createHash.js +85 -15
- package/lib/util/dataURL.js +39 -0
- package/lib/util/deprecation.js +29 -31
- package/lib/util/deterministicGrouping.js +34 -30
- package/lib/util/extractSourceMap.js +319 -0
- package/lib/util/findGraphRoots.js +15 -5
- package/lib/util/fs.js +29 -8
- package/lib/util/hash/BatchedHash.js +47 -8
- package/lib/util/hash/wasm-hash.js +53 -13
- package/lib/util/semver.js +9 -8
- package/lib/util/smartGrouping.js +41 -26
- package/lib/util/traverseDestructuringAssignmentProperties.js +45 -0
- package/lib/wasm/EnableWasmLoadingPlugin.js +3 -2
- package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +5 -1
- package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +2 -13
- package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +2 -9
- package/lib/wasm-async/AsyncWebAssemblyParser.js +2 -10
- package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +6 -4
- package/lib/wasm-sync/WebAssemblyGenerator.js +1 -3
- package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +1 -4
- package/lib/wasm-sync/WebAssemblyModulesPlugin.js +2 -7
- package/lib/wasm-sync/WebAssemblyParser.js +1 -13
- package/lib/web/JsonpChunkLoadingPlugin.js +2 -1
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +1 -1
- package/lib/web/JsonpTemplatePlugin.js +0 -1
- package/lib/webpack.js +21 -8
- package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +2 -1
- package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +1 -1
- package/package.json +21 -21
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +93 -96
- package/schemas/plugins/BannerPlugin.check.js +1 -1
- package/schemas/plugins/BannerPlugin.json +4 -0
- package/schemas/plugins/IgnorePlugin.json +1 -1
- package/schemas/plugins/ProgressPlugin.json +1 -1
- package/schemas/plugins/SourceMapDevToolPlugin.check.js +1 -1
- package/schemas/plugins/SourceMapDevToolPlugin.json +5 -1
- package/schemas/plugins/ids/HashedModuleIdsPlugin.check.d.ts +7 -0
- package/schemas/plugins/ids/HashedModuleIdsPlugin.check.js +6 -0
- package/schemas/plugins/{HashedModuleIdsPlugin.json → ids/HashedModuleIdsPlugin.json} +15 -2
- package/schemas/plugins/schemes/VirtualUrlPlugin.json +3 -3
- package/types.d.ts +1699 -706
- package/SECURITY.md +0 -9
- package/schemas/plugins/HashedModuleIdsPlugin.check.d.ts +0 -7
- package/schemas/plugins/HashedModuleIdsPlugin.check.js +0 -6
package/lib/RuntimePlugin.js
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
8
|
const RuntimeGlobals = require("./RuntimeGlobals");
|
|
9
|
-
const { getChunkFilenameTemplate } = require("./css/CssModulesPlugin");
|
|
10
9
|
const RuntimeRequirementsDependency = require("./dependencies/RuntimeRequirementsDependency");
|
|
11
10
|
const JavascriptModulesPlugin = require("./javascript/JavascriptModulesPlugin");
|
|
12
11
|
const AsyncModuleRuntimeModule = require("./runtime/AsyncModuleRuntimeModule");
|
|
@@ -33,16 +32,14 @@ const PublicPathRuntimeModule = require("./runtime/PublicPathRuntimeModule");
|
|
|
33
32
|
const RelativeUrlRuntimeModule = require("./runtime/RelativeUrlRuntimeModule");
|
|
34
33
|
const RuntimeIdRuntimeModule = require("./runtime/RuntimeIdRuntimeModule");
|
|
35
34
|
const SystemContextRuntimeModule = require("./runtime/SystemContextRuntimeModule");
|
|
35
|
+
const ToBinaryRuntimeModule = require("./runtime/ToBinaryRuntimeModule");
|
|
36
36
|
const ShareRuntimeModule = require("./sharing/ShareRuntimeModule");
|
|
37
37
|
const StringXor = require("./util/StringXor");
|
|
38
38
|
const memoize = require("./util/memoize");
|
|
39
39
|
|
|
40
40
|
/** @typedef {import("../declarations/WebpackOptions").LibraryOptions} LibraryOptions */
|
|
41
|
-
/** @typedef {import("../declarations/WebpackOptions").OutputNormalized} OutputNormalized */
|
|
42
41
|
/** @typedef {import("./Chunk")} Chunk */
|
|
43
42
|
/** @typedef {import("./Compiler")} Compiler */
|
|
44
|
-
/** @typedef {import("./Module")} Module */
|
|
45
|
-
/** @typedef {import("./TemplatedPathPlugin").TemplatePath} TemplatePath */
|
|
46
43
|
|
|
47
44
|
const getJavascriptModulesPlugin = memoize(() =>
|
|
48
45
|
require("./javascript/JavascriptModulesPlugin")
|
|
@@ -310,12 +307,10 @@ class RuntimePlugin {
|
|
|
310
307
|
RuntimeGlobals.getChunkScriptFilename,
|
|
311
308
|
(chunk) =>
|
|
312
309
|
getJavascriptModulesPlugin().chunkHasJs(chunk, chunkGraph) &&
|
|
313
|
-
|
|
314
|
-
chunk.
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
: compilation.outputOptions.chunkFilename)
|
|
318
|
-
),
|
|
310
|
+
(chunk.filenameTemplate ||
|
|
311
|
+
(chunk.canBeInitial()
|
|
312
|
+
? compilation.outputOptions.filename
|
|
313
|
+
: compilation.outputOptions.chunkFilename)),
|
|
319
314
|
set.has(RuntimeGlobals.hmrDownloadUpdateHandlers)
|
|
320
315
|
)
|
|
321
316
|
);
|
|
@@ -338,9 +333,17 @@ class RuntimePlugin {
|
|
|
338
333
|
"css",
|
|
339
334
|
"css",
|
|
340
335
|
RuntimeGlobals.getChunkCssFilename,
|
|
341
|
-
(chunk) =>
|
|
342
|
-
getCssModulesPlugin()
|
|
343
|
-
|
|
336
|
+
(chunk) => {
|
|
337
|
+
const cssModulePlugin = getCssModulesPlugin();
|
|
338
|
+
|
|
339
|
+
return (
|
|
340
|
+
cssModulePlugin.chunkHasCss(chunk, chunkGraph) &&
|
|
341
|
+
cssModulePlugin.getChunkFilenameTemplate(
|
|
342
|
+
chunk,
|
|
343
|
+
compilation.outputOptions
|
|
344
|
+
)
|
|
345
|
+
);
|
|
346
|
+
},
|
|
344
347
|
set.has(RuntimeGlobals.hmrDownloadUpdateHandlers)
|
|
345
348
|
)
|
|
346
349
|
);
|
|
@@ -351,8 +354,7 @@ class RuntimePlugin {
|
|
|
351
354
|
.tap(PLUGIN_NAME, (chunk, set) => {
|
|
352
355
|
if (
|
|
353
356
|
/\[(full)?hash(:\d+)?\]/.test(
|
|
354
|
-
|
|
355
|
-
(compilation.outputOptions.hotUpdateChunkFilename)
|
|
357
|
+
compilation.outputOptions.hotUpdateChunkFilename
|
|
356
358
|
)
|
|
357
359
|
) {
|
|
358
360
|
set.add(RuntimeGlobals.getFullHash);
|
|
@@ -363,9 +365,7 @@ class RuntimePlugin {
|
|
|
363
365
|
"javascript",
|
|
364
366
|
"javascript update",
|
|
365
367
|
RuntimeGlobals.getChunkUpdateScriptFilename,
|
|
366
|
-
(_chunk) =>
|
|
367
|
-
/** @type {NonNullable<OutputNormalized["hotUpdateChunkFilename"]>} */
|
|
368
|
-
(compilation.outputOptions.hotUpdateChunkFilename),
|
|
368
|
+
(_chunk) => compilation.outputOptions.hotUpdateChunkFilename,
|
|
369
369
|
true
|
|
370
370
|
)
|
|
371
371
|
);
|
|
@@ -376,8 +376,7 @@ class RuntimePlugin {
|
|
|
376
376
|
.tap(PLUGIN_NAME, (chunk, set) => {
|
|
377
377
|
if (
|
|
378
378
|
/\[(full)?hash(:\d+)?\]/.test(
|
|
379
|
-
|
|
380
|
-
(compilation.outputOptions.hotUpdateMainFilename)
|
|
379
|
+
compilation.outputOptions.hotUpdateMainFilename
|
|
381
380
|
)
|
|
382
381
|
) {
|
|
383
382
|
set.add(RuntimeGlobals.getFullHash);
|
|
@@ -387,8 +386,7 @@ class RuntimePlugin {
|
|
|
387
386
|
new GetMainFilenameRuntimeModule(
|
|
388
387
|
"update manifest",
|
|
389
388
|
RuntimeGlobals.getUpdateManifestFilename,
|
|
390
|
-
|
|
391
|
-
(compilation.outputOptions.hotUpdateMainFilename)
|
|
389
|
+
compilation.outputOptions.hotUpdateMainFilename
|
|
392
390
|
)
|
|
393
391
|
);
|
|
394
392
|
return true;
|
|
@@ -492,6 +490,12 @@ class RuntimePlugin {
|
|
|
492
490
|
compilation.addRuntimeModule(chunk, new NonceRuntimeModule());
|
|
493
491
|
return true;
|
|
494
492
|
});
|
|
493
|
+
compilation.hooks.runtimeRequirementInTree
|
|
494
|
+
.for(RuntimeGlobals.toBinary)
|
|
495
|
+
.tap(PLUGIN_NAME, (chunk) => {
|
|
496
|
+
compilation.addRuntimeModule(chunk, new ToBinaryRuntimeModule());
|
|
497
|
+
return true;
|
|
498
|
+
});
|
|
495
499
|
// TODO webpack 6: remove CompatRuntimeModule
|
|
496
500
|
compilation.hooks.additionalTreeRuntimeRequirements.tap(
|
|
497
501
|
PLUGIN_NAME,
|
package/lib/RuntimeTemplate.js
CHANGED
|
@@ -20,13 +20,10 @@ const compileBooleanMatcher = require("./util/compileBooleanMatcher");
|
|
|
20
20
|
const propertyAccess = require("./util/propertyAccess");
|
|
21
21
|
const { forEachRuntime, subtractRuntime } = require("./util/runtime");
|
|
22
22
|
|
|
23
|
-
/** @typedef {import("
|
|
24
|
-
/** @typedef {import("../declarations/WebpackOptions").OutputNormalized} OutputOptions */
|
|
23
|
+
/** @typedef {import("./config/defaults").OutputNormalizedWithDefaults} OutputOptions */
|
|
25
24
|
/** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */
|
|
26
25
|
/** @typedef {import("./Chunk")} Chunk */
|
|
27
26
|
/** @typedef {import("./ChunkGraph")} ChunkGraph */
|
|
28
|
-
/** @typedef {import("./CodeGenerationResults")} CodeGenerationResults */
|
|
29
|
-
/** @typedef {import("./CodeGenerationResults").CodeGenerationResult} CodeGenerationResult */
|
|
30
27
|
/** @typedef {import("./Compilation")} Compilation */
|
|
31
28
|
/** @typedef {import("./Dependency")} Dependency */
|
|
32
29
|
/** @typedef {import("./Module")} Module */
|
|
@@ -97,10 +94,7 @@ class RuntimeTemplate {
|
|
|
97
94
|
this.globalObject =
|
|
98
95
|
/** @type {string} */
|
|
99
96
|
(getGlobalObject(outputOptions.globalObject));
|
|
100
|
-
this.contentHashReplacement = "X".repeat(
|
|
101
|
-
/** @type {NonNullable<OutputOptions["hashDigestLength"]>} */
|
|
102
|
-
(outputOptions.hashDigestLength)
|
|
103
|
-
);
|
|
97
|
+
this.contentHashReplacement = "X".repeat(outputOptions.hashDigestLength);
|
|
104
98
|
}
|
|
105
99
|
|
|
106
100
|
isIIFE() {
|
|
@@ -113,7 +107,7 @@ class RuntimeTemplate {
|
|
|
113
107
|
|
|
114
108
|
isNeutralPlatform() {
|
|
115
109
|
return (
|
|
116
|
-
!this.
|
|
110
|
+
!this.compilation.compiler.platform.web &&
|
|
117
111
|
!this.compilation.compiler.platform.node
|
|
118
112
|
);
|
|
119
113
|
}
|
|
@@ -172,6 +166,13 @@ class RuntimeTemplate {
|
|
|
172
166
|
: `"${mod}"`;
|
|
173
167
|
}
|
|
174
168
|
|
|
169
|
+
/**
|
|
170
|
+
* @returns {"const" | "var"} return `const` when it is supported, otherwise `var`
|
|
171
|
+
*/
|
|
172
|
+
renderConst() {
|
|
173
|
+
return this.supportsConst() ? "const" : "var";
|
|
174
|
+
}
|
|
175
|
+
|
|
175
176
|
/**
|
|
176
177
|
* @param {string} returnValue return value
|
|
177
178
|
* @param {string} args arguments
|
|
@@ -195,7 +196,7 @@ class RuntimeTemplate {
|
|
|
195
196
|
}
|
|
196
197
|
|
|
197
198
|
/**
|
|
198
|
-
* @param {
|
|
199
|
+
* @param {(string | { expr: string })[]} args args
|
|
199
200
|
* @returns {string} result expression
|
|
200
201
|
*/
|
|
201
202
|
concatenation(...args) {
|
|
@@ -244,7 +245,7 @@ class RuntimeTemplate {
|
|
|
244
245
|
}
|
|
245
246
|
|
|
246
247
|
/**
|
|
247
|
-
* @param {
|
|
248
|
+
* @param {(string | { expr: string })[]} args args (len >= 2)
|
|
248
249
|
* @returns {string} result expression
|
|
249
250
|
* @private
|
|
250
251
|
*/
|
|
@@ -948,7 +949,16 @@ class RuntimeTemplate {
|
|
|
948
949
|
// when the defaultInterop is used (when a ESM imports a CJS module),
|
|
949
950
|
if (exportName.length > 0 && exportName[0] === "default") {
|
|
950
951
|
if (isDeferred && exportsType !== "namespace") {
|
|
951
|
-
const
|
|
952
|
+
const exportsInfo = moduleGraph.getExportsInfo(module);
|
|
953
|
+
const name = exportName.slice(1);
|
|
954
|
+
const used = exportsInfo.getUsedName(name, runtime);
|
|
955
|
+
if (!used) {
|
|
956
|
+
const comment = Template.toNormalComment(
|
|
957
|
+
`unused export ${propertyAccess(exportName)}`
|
|
958
|
+
);
|
|
959
|
+
return `${comment} undefined`;
|
|
960
|
+
}
|
|
961
|
+
const access = `${importVar}.a${propertyAccess(used)}`;
|
|
952
962
|
if (isCall || asiSafe === undefined) {
|
|
953
963
|
return access;
|
|
954
964
|
}
|
|
@@ -14,9 +14,9 @@ const PLUGIN_NAME = "SourceMapDevToolModuleOptionsPlugin";
|
|
|
14
14
|
|
|
15
15
|
class SourceMapDevToolModuleOptionsPlugin {
|
|
16
16
|
/**
|
|
17
|
-
* @param {SourceMapDevToolPluginOptions} options options
|
|
17
|
+
* @param {SourceMapDevToolPluginOptions=} options options
|
|
18
18
|
*/
|
|
19
|
-
constructor(options) {
|
|
19
|
+
constructor(options = {}) {
|
|
20
20
|
this.options = options;
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -19,9 +19,7 @@ const { makePathsAbsolute } = require("./util/identifier");
|
|
|
19
19
|
|
|
20
20
|
/** @typedef {import("webpack-sources").MapOptions} MapOptions */
|
|
21
21
|
/** @typedef {import("webpack-sources").Source} Source */
|
|
22
|
-
/** @typedef {import("../declarations/WebpackOptions").HashFunction} HashFunction */
|
|
23
22
|
/** @typedef {import("../declarations/plugins/SourceMapDevToolPlugin").SourceMapDevToolPluginOptions} SourceMapDevToolPluginOptions */
|
|
24
|
-
/** @typedef {import("./Cache").Etag} Etag */
|
|
25
23
|
/** @typedef {import("./CacheFacade").ItemCacheFacade} ItemCacheFacade */
|
|
26
24
|
/** @typedef {import("./Chunk")} Chunk */
|
|
27
25
|
/** @typedef {import("./Compilation").Asset} Asset */
|
|
@@ -109,7 +107,7 @@ const getTaskForFile = (
|
|
|
109
107
|
source = asset.source();
|
|
110
108
|
}
|
|
111
109
|
if (!sourceMap || typeof source !== "string") return;
|
|
112
|
-
const context =
|
|
110
|
+
const context = compilation.options.context;
|
|
113
111
|
const root = compilation.compiler.root;
|
|
114
112
|
const cachedAbsolutify = makePathsAbsolute.bindContextCache(context, root);
|
|
115
113
|
const modules = sourceMap.sources.map((source) => {
|
|
@@ -162,9 +160,9 @@ class SourceMapDevToolPlugin {
|
|
|
162
160
|
* @returns {void}
|
|
163
161
|
*/
|
|
164
162
|
apply(compiler) {
|
|
165
|
-
const outputFs =
|
|
166
|
-
|
|
167
|
-
|
|
163
|
+
const outputFs =
|
|
164
|
+
/** @type {OutputFileSystem} */
|
|
165
|
+
(compiler.outputFileSystem);
|
|
168
166
|
const sourceMapFilename = this.sourceMapFilename;
|
|
169
167
|
const sourceMappingURLComment = this.sourceMappingURLComment;
|
|
170
168
|
const moduleFilenameTemplate = this.moduleFilenameTemplate;
|
|
@@ -361,7 +359,7 @@ class SourceMapDevToolPlugin {
|
|
|
361
359
|
|
|
362
360
|
/**
|
|
363
361
|
* all modules in defined order (longest identifier first)
|
|
364
|
-
* @type {
|
|
362
|
+
* @type {(string | Module)[]}
|
|
365
363
|
*/
|
|
366
364
|
const allModules = [...moduleToSourceNameMapping.keys()].sort(
|
|
367
365
|
(a, b) => {
|
|
@@ -484,17 +482,12 @@ class SourceMapDevToolPlugin {
|
|
|
484
482
|
const sourceMapString = JSON.stringify(sourceMap);
|
|
485
483
|
if (sourceMapFilename) {
|
|
486
484
|
const filename = file;
|
|
487
|
-
const sourceMapContentHash =
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
(compilation.outputOptions.hashFunction)
|
|
494
|
-
)
|
|
495
|
-
.update(sourceMapString)
|
|
496
|
-
.digest("hex")
|
|
497
|
-
);
|
|
485
|
+
const sourceMapContentHash = usesContentHash
|
|
486
|
+
? createHash(compilation.outputOptions.hashFunction)
|
|
487
|
+
.update(sourceMapString)
|
|
488
|
+
.digest("hex")
|
|
489
|
+
: undefined;
|
|
490
|
+
|
|
498
491
|
const pathParams = {
|
|
499
492
|
chunk,
|
|
500
493
|
filename: options.fileContext
|
package/lib/Stats.js
CHANGED
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
|
|
8
8
|
/** @typedef {import("../declarations/WebpackOptions").StatsOptions} StatsOptions */
|
|
9
9
|
/** @typedef {import("./Compilation")} Compilation */
|
|
10
|
-
/** @typedef {import("./Compilation").NormalizedStatsOptions} NormalizedStatsOptions */
|
|
11
10
|
/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsCompilation} StatsCompilation */
|
|
12
11
|
|
|
13
12
|
class Stats {
|
package/lib/Template.js
CHANGED
|
@@ -10,7 +10,7 @@ const { WEBPACK_MODULE_TYPE_RUNTIME } = require("./ModuleTypeConstants");
|
|
|
10
10
|
const RuntimeGlobals = require("./RuntimeGlobals");
|
|
11
11
|
|
|
12
12
|
/** @typedef {import("webpack-sources").Source} Source */
|
|
13
|
-
/** @typedef {import("
|
|
13
|
+
/** @typedef {import("./config/defaults").OutputNormalizedWithDefaults} OutputOptions */
|
|
14
14
|
/** @typedef {import("./Chunk")} Chunk */
|
|
15
15
|
/** @typedef {import("./ChunkGraph")} ChunkGraph */
|
|
16
16
|
/** @typedef {import("./ChunkGraph").ModuleId} ModuleId */
|
|
@@ -49,7 +49,7 @@ const MATCH_PADDED_HYPHENS_REPLACE_REGEX = /^-|-$/g;
|
|
|
49
49
|
* @property {string} fullHash
|
|
50
50
|
* @property {OutputOptions} outputOptions
|
|
51
51
|
* @property {CodeGenerationResults} codeGenerationResults
|
|
52
|
-
* @property {{javascript: ModuleTemplate}} moduleTemplates
|
|
52
|
+
* @property {{ javascript: ModuleTemplate }} moduleTemplates
|
|
53
53
|
* @property {DependencyTemplates} dependencyTemplates
|
|
54
54
|
* @property {RuntimeTemplate} runtimeTemplate
|
|
55
55
|
* @property {ModuleGraph} moduleGraph
|
|
@@ -79,11 +79,6 @@ const MATCH_PADDED_HYPHENS_REPLACE_REGEX = /^-|-$/g;
|
|
|
79
79
|
* @property {boolean=} auxiliary
|
|
80
80
|
*/
|
|
81
81
|
|
|
82
|
-
/**
|
|
83
|
-
* @typedef {object} HasId
|
|
84
|
-
* @property {number | string} id
|
|
85
|
-
*/
|
|
86
|
-
|
|
87
82
|
/**
|
|
88
83
|
* @typedef {(module: Module) => boolean} ModuleFilterPredicate
|
|
89
84
|
*/
|
|
@@ -226,7 +221,7 @@ class Template {
|
|
|
226
221
|
}
|
|
227
222
|
|
|
228
223
|
/**
|
|
229
|
-
* @param {string|string[]} s string to create prefix for
|
|
224
|
+
* @param {string | string[]} s string to create prefix for
|
|
230
225
|
* @param {string} prefix prefix to compose
|
|
231
226
|
* @returns {string} returns new prefix string
|
|
232
227
|
*/
|
|
@@ -238,7 +233,7 @@ class Template {
|
|
|
238
233
|
}
|
|
239
234
|
|
|
240
235
|
/**
|
|
241
|
-
* @param {string|string[]} str string or string collection
|
|
236
|
+
* @param {string | string[]} str string or string collection
|
|
242
237
|
* @returns {string} returns a single string from array
|
|
243
238
|
*/
|
|
244
239
|
static asString(str) {
|
|
@@ -295,7 +290,7 @@ class Template {
|
|
|
295
290
|
if (modules.length === 0) {
|
|
296
291
|
return null;
|
|
297
292
|
}
|
|
298
|
-
/** @type {{id:
|
|
293
|
+
/** @type {{ id: ModuleId, source: Source | "false" }[]} */
|
|
299
294
|
const allModules = modules.map((module) => ({
|
|
300
295
|
id: /** @type {ModuleId} */ (chunkGraph.getModuleId(module)),
|
|
301
296
|
source: renderModule(module) || "false"
|
|
@@ -309,7 +304,7 @@ class Template {
|
|
|
309
304
|
source.add(`Array(${minId}).concat(`);
|
|
310
305
|
}
|
|
311
306
|
source.add("[\n");
|
|
312
|
-
/** @type {Map<
|
|
307
|
+
/** @type {Map<ModuleId, { id: ModuleId, source: Source | "false" }>} */
|
|
313
308
|
const modules = new Map();
|
|
314
309
|
for (const module of allModules) {
|
|
315
310
|
modules.set(module.id, module);
|
|
@@ -133,7 +133,8 @@ const deprecated = (fn, message, code) => {
|
|
|
133
133
|
);
|
|
134
134
|
};
|
|
135
135
|
|
|
136
|
-
/** @typedef {
|
|
136
|
+
/** @typedef {(pathData: PathData, assetInfo?: AssetInfo) => string} TemplatePathFn */
|
|
137
|
+
/** @typedef {string | TemplatePathFn} TemplatePath */
|
|
137
138
|
|
|
138
139
|
/**
|
|
139
140
|
* @param {TemplatePath} path the raw path
|
package/lib/WatchIgnorePlugin.js
CHANGED
|
@@ -9,7 +9,6 @@ const { groupBy } = require("./util/ArrayHelpers");
|
|
|
9
9
|
const createSchemaValidation = require("./util/create-schema-validation");
|
|
10
10
|
|
|
11
11
|
/** @typedef {import("../declarations/plugins/WatchIgnorePlugin").WatchIgnorePluginOptions} WatchIgnorePluginOptions */
|
|
12
|
-
/** @typedef {import("../declarations/WebpackOptions").WatchOptions} WatchOptions */
|
|
13
12
|
/** @typedef {import("./Compiler")} Compiler */
|
|
14
13
|
/** @typedef {import("./util/fs").TimeInfoEntries} TimeInfoEntries */
|
|
15
14
|
/** @typedef {import("./util/fs").WatchFileSystem} WatchFileSystem */
|
|
@@ -51,12 +50,12 @@ class IgnoringWatchFileSystem {
|
|
|
51
50
|
);
|
|
52
51
|
|
|
53
52
|
const [ignoredFiles, notIgnoredFiles] = groupBy(
|
|
54
|
-
/** @type {
|
|
53
|
+
/** @type {string[]} */
|
|
55
54
|
(files),
|
|
56
55
|
ignored
|
|
57
56
|
);
|
|
58
57
|
const [ignoredDirs, notIgnoredDirs] = groupBy(
|
|
59
|
-
/** @type {
|
|
58
|
+
/** @type {string[]} */
|
|
60
59
|
(dirs),
|
|
61
60
|
ignored
|
|
62
61
|
);
|
package/lib/Watching.js
CHANGED
|
@@ -10,20 +10,20 @@ const Stats = require("./Stats");
|
|
|
10
10
|
/** @typedef {import("../declarations/WebpackOptions").WatchOptions} WatchOptions */
|
|
11
11
|
/** @typedef {import("./Compilation")} Compilation */
|
|
12
12
|
/** @typedef {import("./Compiler")} Compiler */
|
|
13
|
-
/** @typedef {import("./
|
|
13
|
+
/** @typedef {import("./Compiler").ErrorCallback} ErrorCallback */
|
|
14
14
|
/** @typedef {import("./WebpackError")} WebpackError */
|
|
15
15
|
/** @typedef {import("./logging/Logger").Logger} Logger */
|
|
16
16
|
/** @typedef {import("./util/fs").TimeInfoEntries} TimeInfoEntries */
|
|
17
17
|
/** @typedef {import("./util/fs").WatchFileSystem} WatchFileSystem */
|
|
18
|
-
/** @typedef {import("./util/fs").Watcher} Watcher */
|
|
19
18
|
|
|
20
19
|
/**
|
|
21
20
|
* @template T
|
|
22
|
-
* @
|
|
23
|
-
* @
|
|
24
|
-
* @param {T=} result
|
|
21
|
+
* @template [R=void]
|
|
22
|
+
* @typedef {import("./webpack").Callback<T, R>} Callback
|
|
25
23
|
*/
|
|
26
24
|
|
|
25
|
+
/** @typedef {Set<string>} CollectedFiles */
|
|
26
|
+
|
|
27
27
|
class Watching {
|
|
28
28
|
/**
|
|
29
29
|
* @param {Compiler} compiler the compiler
|
|
@@ -34,9 +34,9 @@ class Watching {
|
|
|
34
34
|
this.startTime = null;
|
|
35
35
|
this.invalid = false;
|
|
36
36
|
this.handler = handler;
|
|
37
|
-
/** @type {
|
|
37
|
+
/** @type {ErrorCallback[]} */
|
|
38
38
|
this.callbacks = [];
|
|
39
|
-
/** @type {
|
|
39
|
+
/** @type {ErrorCallback[] | undefined} */
|
|
40
40
|
this._closeCallbacks = undefined;
|
|
41
41
|
this.closed = false;
|
|
42
42
|
this.suspended = false;
|
|
@@ -66,9 +66,9 @@ class Watching {
|
|
|
66
66
|
this._needRecords = true;
|
|
67
67
|
this.watcher = undefined;
|
|
68
68
|
this.pausedWatcher = undefined;
|
|
69
|
-
/** @type {
|
|
69
|
+
/** @type {CollectedFiles | undefined} */
|
|
70
70
|
this._collectedChangedFiles = undefined;
|
|
71
|
-
/** @type {
|
|
71
|
+
/** @type {CollectedFiles | undefined} */
|
|
72
72
|
this._collectedRemovedFiles = undefined;
|
|
73
73
|
this._done = this._done.bind(this);
|
|
74
74
|
process.nextTick(() => {
|
|
@@ -88,12 +88,12 @@ class Watching {
|
|
|
88
88
|
} else {
|
|
89
89
|
for (const file of changedFiles) {
|
|
90
90
|
this._collectedChangedFiles.add(file);
|
|
91
|
-
/** @type {
|
|
91
|
+
/** @type {CollectedFiles} */
|
|
92
92
|
(this._collectedRemovedFiles).delete(file);
|
|
93
93
|
}
|
|
94
94
|
for (const file of /** @type {ReadonlySet<string>} */ (removedFiles)) {
|
|
95
95
|
this._collectedChangedFiles.delete(file);
|
|
96
|
-
/** @type {
|
|
96
|
+
/** @type {CollectedFiles} */
|
|
97
97
|
(this._collectedRemovedFiles).add(file);
|
|
98
98
|
}
|
|
99
99
|
}
|
|
@@ -262,7 +262,7 @@ class Watching {
|
|
|
262
262
|
|
|
263
263
|
/**
|
|
264
264
|
* @param {Error} err error
|
|
265
|
-
* @param {
|
|
265
|
+
* @param {ErrorCallback[]=} cbs callbacks
|
|
266
266
|
*/
|
|
267
267
|
const handleError = (err, cbs) => {
|
|
268
268
|
this.compiler.hooks.failed.call(err);
|
|
@@ -393,7 +393,7 @@ class Watching {
|
|
|
393
393
|
}
|
|
394
394
|
|
|
395
395
|
/**
|
|
396
|
-
* @param {
|
|
396
|
+
* @param {ErrorCallback=} callback signals when the build has completed again
|
|
397
397
|
* @returns {void}
|
|
398
398
|
*/
|
|
399
399
|
invalidate(callback) {
|
|
@@ -451,7 +451,7 @@ class Watching {
|
|
|
451
451
|
}
|
|
452
452
|
|
|
453
453
|
/**
|
|
454
|
-
* @param {
|
|
454
|
+
* @param {ErrorCallback} callback signals when the watcher is closed
|
|
455
455
|
* @returns {void}
|
|
456
456
|
*/
|
|
457
457
|
close(callback) {
|
|
@@ -481,7 +481,7 @@ class Watching {
|
|
|
481
481
|
const shutdown = (err) => {
|
|
482
482
|
this.compiler.hooks.watchClose.call();
|
|
483
483
|
const closeCallbacks =
|
|
484
|
-
/** @type {
|
|
484
|
+
/** @type {ErrorCallback[]} */
|
|
485
485
|
(this._closeCallbacks);
|
|
486
486
|
this._closeCallbacks = undefined;
|
|
487
487
|
for (const cb of closeCallbacks) cb(err);
|
|
@@ -16,10 +16,8 @@ const {
|
|
|
16
16
|
toConstantDependency
|
|
17
17
|
} = require("./javascript/JavascriptParserHelpers");
|
|
18
18
|
|
|
19
|
-
/** @typedef {import("enhanced-resolve").Resolver} Resolver */
|
|
20
19
|
/** @typedef {import("./Compiler")} Compiler */
|
|
21
20
|
/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
|
|
22
|
-
/** @typedef {import("./Module")} Module */
|
|
23
21
|
/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */
|
|
24
22
|
/** @typedef {import("./javascript/JavascriptParser").Range} Range */
|
|
25
23
|
|