webpack 5.112.0 → 5.112.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/webpack.js +13 -7
- package/lib/Compilation.js +198 -61
- package/lib/Compiler.js +12 -25
- package/lib/asset/AssetBytesGenerator.js +14 -6
- package/lib/asset/AssetBytesParser.js +10 -8
- package/lib/asset/AssetGenerator.js +36 -48
- package/lib/asset/AssetModule.js +11 -0
- package/lib/asset/AssetModulesPlugin.js +5 -4
- package/lib/asset/AssetParser.js +8 -8
- package/lib/asset/AssetSourceGenerator.js +16 -8
- package/lib/asset/AssetSourceParser.js +10 -8
- package/lib/asset/WebManifestGenerator.js +11 -6
- package/lib/asset/WebManifestParser.js +3 -3
- package/lib/async-modules/AsyncModuleHelpers.js +8 -2
- package/lib/async-modules/InferAsyncModulesPlugin.js +7 -2
- package/lib/cache/CacheFacade.js +1 -1
- package/lib/cache/PackFileCacheStrategy.js +6 -10
- package/lib/cache/ResolverCachePlugin.js +58 -8
- package/lib/config/WebpackOptionsApply.js +8 -28
- package/lib/config/cli.js +9 -6
- package/lib/config/defaults.js +24 -13
- package/lib/config/getClaimedAssetTypes.js +2 -2
- package/lib/config/target.js +1 -1
- package/lib/context/ContextModule.js +1 -1
- package/lib/context/ContextModuleFactory.js +1 -1
- package/lib/context/ContextReplacementPlugin.js +3 -9
- package/lib/css/CssGenerator.js +40 -47
- package/lib/css/CssModule.js +10 -0
- package/lib/css/CssModulesPlugin.js +13 -6
- package/lib/css/CssParser.js +33 -32
- package/lib/css/conventions.js +1 -1
- package/lib/css/data.js +224 -219
- package/lib/css/syntax-parser.js +1312 -312
- package/lib/css/syntax-printer.js +1142 -1025
- package/lib/debug/ProfilingPlugin.js +65 -43
- package/lib/define/DefinePlugin.js +10 -15
- package/lib/define/DotenvPlugin.js +10 -6
- package/lib/define/EnvironmentPlugin.js +4 -2
- package/lib/dependencies/amd/AMDDefineDependencyParserPlugin.js +1 -2
- package/lib/dependencies/amd/AMDRequireDependenciesBlockParserPlugin.js +4 -1
- package/lib/dependencies/commonjs/CommonJsExportRequireDependency.js +1 -4
- package/lib/dependencies/commonjs/CommonJsExportsParserPlugin.js +18 -33
- package/lib/dependencies/commonjs/CommonJsImportsParserPlugin.js +1 -3
- package/lib/dependencies/commonjs/CommonJsObjectExportDependency.js +4 -4
- package/lib/dependencies/commonjs/CommonJsPlugin.js +2 -5
- package/lib/dependencies/commonjs/RequireEnsureDependenciesBlockParserPlugin.js +4 -1
- package/lib/dependencies/context/ImportMetaContextDependencyParserPlugin.js +1 -2
- package/lib/dependencies/context/ImportMetaGlobDependencyParserPlugin.js +4 -7
- package/lib/dependencies/context/ImportMetaGlobHelpers.js +8 -10
- package/lib/dependencies/core/CachedConstDependency.js +9 -6
- package/lib/dependencies/css/CssIcssExportDependency.js +6 -7
- package/lib/dependencies/css/CssIcssImportDependency.js +1 -3
- package/lib/dependencies/css/CssUrlDependency.js +2 -6
- package/lib/dependencies/esm/ESMDetectionParserPlugin.js +2 -4
- package/lib/dependencies/esm/ESMExportExpressionDependency.js +2 -2
- package/lib/dependencies/esm/ESMExportImportedSpecifierDependency.js +16 -18
- package/lib/dependencies/esm/ESMExportSpecifierDependency.js +20 -3
- package/lib/dependencies/esm/ESMExports.js +2 -10
- package/lib/dependencies/esm/ESMImportDependency.js +17 -2
- package/lib/dependencies/esm/ESMImportDependencyParserPlugin.js +6 -17
- package/lib/dependencies/esm/ESMImportGuard.js +11 -23
- package/lib/dependencies/esm/ESMImportSideEffectDependency.js +1 -1
- package/lib/dependencies/esm/ESMImportSpecifierDependency.js +4 -1
- package/lib/dependencies/esm/ESMLiveExportDependency.js +311 -0
- package/lib/dependencies/esm/ESMLiveExportParserPlugin.js +862 -0
- package/lib/dependencies/esm/ESMModulesPlugin.js +1 -3
- package/lib/dependencies/esm/TopLevelAwaitDependency.js +1 -8
- package/lib/dependencies/helpers/DynamicExports.js +4 -6
- package/lib/dependencies/html/HtmlEntryDependency.js +5 -14
- package/lib/dependencies/html/HtmlInlineHtmlDependency.js +1 -4
- package/lib/dependencies/html/HtmlInlineScriptDependency.js +2 -6
- package/lib/dependencies/html/HtmlInlineStyleDependency.js +1 -4
- package/lib/dependencies/import/ImportParserPlugin.js +3 -6
- package/lib/dependencies/import-meta/ImportMetaPlugin.js +4 -6
- package/lib/dependencies/url/URLParserPlugin.js +1 -1
- package/lib/dependencies/worker/WorkerAndWorkletPlugin.js +51 -20
- package/lib/devtool/ModuleFilenameHelpers.js +1 -1
- package/lib/devtool/SourceMapDevToolPlugin.js +1 -1
- package/lib/dll/DelegatedModule.js +3 -3
- package/lib/dll/DllModule.js +3 -1
- package/lib/dll/DllReferencePlugin.js +1 -4
- package/lib/errors/AbstractMethodError.js +1 -1
- package/lib/errors/ErrorHelpers.js +2 -1
- package/lib/errors/HookWebpackError.js +2 -1
- package/lib/errors/JSONParseError.js +4 -4
- package/lib/errors/WebpackError.js +3 -2
- package/lib/esm/ModuleChunkFormatPlugin.js +36 -1
- package/lib/externals/ExternalModule.js +12 -9
- package/lib/externals/ExternalModuleFactoryPlugin.js +1 -2
- package/lib/externals/ExternalsPlugin.js +1 -1
- package/lib/fs/FileSystemInfo.js +4 -4
- package/lib/graph/AsyncDependenciesBlock.js +1 -1
- package/lib/graph/ChunkGraph.js +5 -0
- package/lib/graph/Dependency.js +8 -2
- package/lib/graph/ExportsInfo.js +1 -1
- package/lib/graph/ModuleGraph.js +14 -3
- package/lib/graph/buildChunkGraph.js +17 -19
- package/lib/graph/findGraphRoots.js +1 -1
- package/lib/hmr/HotModuleReplacement.runtime.js +10 -9
- package/lib/hmr/HotModuleReplacementPlugin.js +5 -11
- package/lib/hmr/JavascriptHotModuleReplacement.runtime.js +16 -19
- package/lib/hmr/LazyCompilationPlugin.js +1 -7
- package/lib/html/HtmlGenerator.js +25 -17
- package/lib/html/HtmlModule.js +11 -1
- package/lib/html/HtmlModulesPlugin.js +12 -11
- package/lib/html/HtmlParser.js +10 -9
- package/lib/html/builtinEmbeddedRenderer.js +31 -33
- package/lib/html/data.js +42 -21
- package/lib/html/htmlMinify.js +4 -1
- package/lib/html/syntax-parser.js +34 -35
- package/lib/html/syntax-printer.js +2 -3
- package/lib/html/xmlMinify.js +4 -1
- package/lib/ids/HashedModuleIdsPlugin.js +1 -1
- package/lib/index.js +13 -12
- package/lib/javascript/APIPlugin.js +7 -13
- package/lib/javascript/BasicEvaluatedExpression.js +5 -5
- package/lib/javascript/CommonJsChunkFormatPlugin.js +2 -7
- package/lib/javascript/ConstPlugin.js +1 -1
- package/lib/javascript/JavascriptGenerator.js +16 -11
- package/lib/javascript/JavascriptMetaInfoPlugin.js +3 -15
- package/lib/javascript/JavascriptModule.js +10 -0
- package/lib/javascript/JavascriptModulesPlugin.js +2 -4
- package/lib/javascript/JavascriptParser.js +99 -11
- package/lib/javascript/ScopeAnalyzer.js +183 -107
- package/lib/javascript/UseStrictPlugin.js +2 -5
- package/lib/javascript/jsMinify.js +1 -1
- package/lib/javascript/regexp.js +2 -2
- package/lib/javascript/syntax-parser.js +2114 -1506
- package/lib/javascript/syntax-printer-data.js +167 -1
- package/lib/javascript/syntax-printer.js +9554 -2782
- package/lib/json/JsonGenerator.js +15 -7
- package/lib/json/JsonModule.js +11 -0
- package/lib/json/JsonParser.js +7 -6
- package/lib/library/AssignLibraryPlugin.js +1 -1
- package/lib/library/JsonpLibraryPlugin.js +1 -1
- package/lib/library/ModuleLibraryPlugin.js +399 -23
- package/lib/loaders/LoaderRunner.js +76 -38
- package/lib/loaders/loadLoader.js +16 -10
- package/lib/module/Generator.js +17 -9
- package/lib/module/Module.js +2 -2
- package/lib/module/NormalModule.js +7 -5
- package/lib/module/NormalModuleFactory.js +11 -17
- package/lib/module/Parser.js +9 -2
- package/lib/module/extractSourceMap.js +69 -18
- package/lib/module/findCaseMismatch.js +2 -2
- package/lib/node/ExternalModuleInitFragment.js +2 -2
- package/lib/node/ReadFileCompileAsyncWasmPlugin.js +4 -12
- package/lib/node/ReadFileCompileWasmPlugin.js +2 -6
- package/lib/node/nodeConsole.js +4 -3
- package/lib/optimize/CircularModulesPlugin.js +1 -1
- package/lib/optimize/ConcatenatedModule.js +4 -8
- package/lib/optimize/FlagDependencyExportsPlugin.js +6 -11
- package/lib/optimize/FlagDependencyUsagePlugin.js +28 -3
- package/lib/optimize/InlineExports.js +4 -7
- package/lib/optimize/LazyBarrels.js +41 -5
- package/lib/optimize/ModuleConcatenationPlugin.js +8 -10
- package/lib/optimize/RealContentHashPlugin.js +2 -6
- package/lib/optimize/SideEffectsFlagPlugin.js +7 -21
- package/lib/optimize/SplitChunksPlugin.js +11 -24
- package/lib/optimize/TupleQueue.js +1 -1
- package/lib/output/CleanPlugin.js +3 -1
- package/lib/output/CopyPlugin.js +3 -4
- package/lib/performance/EvalUsagePlugin.js +1 -3
- package/lib/performance/HotspotsPlugin.js +33 -9
- package/lib/performance/PureAnnotationsPlugin.js +16 -10
- package/lib/performance/TopLevelThisPlugin.js +17 -9
- package/lib/prefetch/ResourceHintPlugin.js +1 -1
- package/lib/provide/ProvidedDependency.js +36 -4
- package/lib/rules/BasicEffectRulePlugin.js +1 -1
- package/lib/rules/RuleSetCompiler.js +15 -5
- package/lib/rules/UseEffectRulePlugin.js +1 -3
- package/lib/runtime/AsyncModuleRuntimeModule.js +7 -1
- package/lib/runtime/GetChunkFilenameRuntimeModule.js +1 -5
- package/lib/runtime/RuntimeGlobals.js +6 -0
- package/lib/runtime/RuntimePlugin.js +2 -0
- package/lib/schemes/HttpUriPlugin.js +1 -2
- package/lib/schemes/VirtualUrlPlugin.js +3 -1
- package/lib/serialization/AggregateErrorSerializer.js +3 -3
- package/lib/serialization/BinaryMiddleware.js +4 -1
- package/lib/serialization/ErrorObjectSerializer.js +2 -5
- package/lib/serialization/ObjectMiddleware.js +17 -15
- package/lib/serialization/PlainObjectSerializer.js +3 -7
- package/lib/serialization/Serializer.js +21 -11
- package/lib/serialization/SerializerMiddleware.js +8 -6
- package/lib/stats/DefaultStatsFactoryPlugin.js +35 -35
- package/lib/stats/DefaultStatsPresetPlugin.js +2 -6
- package/lib/stats/DefaultStatsPrinterPlugin.js +12 -11
- package/lib/stats/StatsFactory.js +194 -24
- package/lib/stats/StatsPrinter.js +126 -13
- package/lib/template/DependencyTemplate.js +1 -1
- package/lib/template/RuntimeTemplate.js +13 -32
- package/lib/template/Template.js +1 -1
- package/lib/util/SourceProcessor.js +146 -29
- package/lib/util/WeakTupleMap.js +10 -4
- package/lib/util/cleverMerge.js +61 -33
- package/lib/util/comparators.js +9 -5
- package/lib/util/dataURL.js +2 -0
- package/lib/util/deprecation.js +4 -3
- package/lib/util/globUtils.js +1 -4
- package/lib/util/internalSerializables.js +2 -0
- package/lib/util/makeSerializable.js +6 -4
- package/lib/util/memoize.js +1 -1
- package/lib/util/parseJson.js +2 -2
- package/lib/util/serialization.js +31 -27
- package/lib/wasm/AsyncWasmModule.js +12 -2
- package/lib/wasm/AsyncWebAssemblyGenerator.js +12 -4
- package/lib/wasm/AsyncWebAssemblyJavascriptGenerator.js +13 -5
- package/lib/wasm/AsyncWebAssemblyParser.js +7 -5
- package/lib/wasm/UniversalCompileAsyncWasmPlugin.js +2 -6
- package/lib/wasm-sync/SyncWasmModule.js +16 -1
- package/lib/wasm-sync/WebAssemblyGenerator.js +15 -10
- package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +13 -5
- package/lib/wasm-sync/WebAssemblyParser.js +10 -12
- package/lib/web/FetchCompileAsyncWasmPlugin.js +4 -12
- package/lib/web/FetchCompileWasmPlugin.js +2 -6
- package/package.json +18 -19
- package/schemas/WebpackOptions.check.js +3 -3
- package/schemas/WebpackOptions.json +2 -2
- package/schemas/plugins/BannerPlugin.check.js +3 -3
- package/schemas/plugins/HtmlGeneratorOptions.check.js +3 -3
- package/schemas/plugins/HtmlParserOptions.check.js +3 -3
- package/schemas/plugins/IgnorePlugin.check.js +3 -3
- package/schemas/plugins/LoaderOptionsPlugin.check.js +3 -3
- package/schemas/plugins/ManifestPlugin.check.js +3 -3
- package/schemas/plugins/ProgressPlugin.check.js +3 -3
- package/schemas/plugins/SSRManifestPlugin.check.js +3 -3
- package/schemas/plugins/SourceMapDevToolPlugin.check.js +3 -3
- package/schemas/plugins/WatchIgnorePlugin.check.js +3 -3
- package/schemas/plugins/asset/AssetGeneratorOptions.check.js +3 -3
- package/schemas/plugins/asset/AssetInlineGeneratorOptions.check.js +3 -3
- package/schemas/plugins/asset/AssetParserOptions.check.js +3 -3
- package/schemas/plugins/asset/AssetResourceGeneratorOptions.check.js +3 -3
- package/schemas/plugins/container/ContainerPlugin.check.js +3 -3
- package/schemas/plugins/container/ContainerReferencePlugin.check.js +3 -3
- package/schemas/plugins/container/ExternalsType.check.js +3 -3
- package/schemas/plugins/container/ModuleFederationPlugin.check.js +3 -3
- package/schemas/plugins/css/CssAutoOrModuleParserOptions.check.js +3 -3
- package/schemas/plugins/css/CssGeneratorOptions.check.js +3 -3
- package/schemas/plugins/css/CssModuleGeneratorOptions.check.js +3 -3
- package/schemas/plugins/css/CssModuleParserOptions.check.js +3 -3
- package/schemas/plugins/css/CssParserOptions.check.js +3 -3
- package/schemas/plugins/debug/ProfilingPlugin.check.js +3 -3
- package/schemas/plugins/define/DotenvPluginOptions.check.js +7 -0
- package/schemas/plugins/define/DotenvPluginOptions.json +3 -0
- package/schemas/plugins/dll/DllPlugin.check.js +3 -3
- package/schemas/plugins/dll/DllReferencePlugin.check.js +3 -3
- package/schemas/plugins/ids/HashedModuleIdsPlugin.check.js +3 -3
- package/schemas/plugins/ids/OccurrenceChunkIdsPlugin.check.js +3 -3
- package/schemas/plugins/ids/OccurrenceModuleIdsPlugin.check.js +3 -3
- package/schemas/plugins/json/JsonModulesPluginGenerator.check.js +3 -3
- package/schemas/plugins/json/JsonModulesPluginParser.check.js +3 -3
- package/schemas/plugins/optimize/AggressiveSplittingPlugin.check.js +3 -3
- package/schemas/plugins/optimize/LimitChunkCountPlugin.check.js +3 -3
- package/schemas/plugins/optimize/MergeDuplicateChunksPlugin.check.js +3 -3
- package/schemas/plugins/optimize/MinChunkSizePlugin.check.js +3 -3
- package/schemas/plugins/output/CleanOptions.check.js +7 -0
- package/schemas/plugins/output/CleanOptions.json +3 -0
- package/schemas/plugins/schemes/HttpUriPlugin.check.js +3 -3
- package/schemas/plugins/schemes/VirtualUrlPlugin.check.js +3 -3
- package/schemas/plugins/sharing/ConsumeSharedPlugin.check.js +3 -3
- package/schemas/plugins/sharing/ProvideSharedPlugin.check.js +3 -3
- package/schemas/plugins/sharing/SharePlugin.check.js +3 -3
- package/types.d.ts +1482 -358
|
@@ -445,8 +445,7 @@ class ExternalModuleFactoryPlugin {
|
|
|
445
445
|
} else if (typeof externals === "object") {
|
|
446
446
|
const resolvedExternals = resolveLayer(
|
|
447
447
|
externals,
|
|
448
|
-
|
|
449
|
-
(contextInfo.issuerLayer)
|
|
448
|
+
contextInfo.issuerLayer
|
|
450
449
|
);
|
|
451
450
|
if (
|
|
452
451
|
Object.prototype.hasOwnProperty.call(resolvedExternals, request)
|
|
@@ -60,7 +60,7 @@ class ExternalsPlugin {
|
|
|
60
60
|
/** @type {InstanceType<ModuleExternalInitFragment>[]} */
|
|
61
61
|
(
|
|
62
62
|
chunkInitFragments
|
|
63
|
-
? /** @type {
|
|
63
|
+
? /** @type {(NonNullable<typeof chunkInitFragments>[number] | InstanceType<ModuleExternalInitFragment>)[]} */
|
|
64
64
|
(chunkInitFragments).filter(
|
|
65
65
|
(fragment) => fragment instanceof ModuleExternalInitFragment
|
|
66
66
|
)
|
package/lib/fs/FileSystemInfo.js
CHANGED
|
@@ -1102,7 +1102,7 @@ const applyMtime = (mtime) => {
|
|
|
1102
1102
|
*/
|
|
1103
1103
|
const mergeMaps = (a, b) => {
|
|
1104
1104
|
if (!b || b.size === 0) return /** @type {Map<T, K>} */ (a);
|
|
1105
|
-
if (!a || a.size === 0) return
|
|
1105
|
+
if (!a || a.size === 0) return b;
|
|
1106
1106
|
/** @type {Map<T, K>} */
|
|
1107
1107
|
const map = new Map(a);
|
|
1108
1108
|
for (const [key, value] of b) {
|
|
@@ -1120,7 +1120,7 @@ const mergeMaps = (a, b) => {
|
|
|
1120
1120
|
*/
|
|
1121
1121
|
const mergeSets = (a, b) => {
|
|
1122
1122
|
if (!b || b.size === 0) return /** @type {Set<T>} */ (a);
|
|
1123
|
-
if (!a || a.size === 0) return
|
|
1123
|
+
if (!a || a.size === 0) return b;
|
|
1124
1124
|
/** @type {Set<T>} */
|
|
1125
1125
|
const map = new Set(a);
|
|
1126
1126
|
for (const item of b) {
|
|
@@ -1290,7 +1290,7 @@ const isExistenceOnly = (entry) => {
|
|
|
1290
1290
|
const contextCacheEntryLacksTimestampHash = (entry) =>
|
|
1291
1291
|
entry !== null &&
|
|
1292
1292
|
typeof entry === "object" &&
|
|
1293
|
-
|
|
1293
|
+
entry.timestampHash === undefined;
|
|
1294
1294
|
|
|
1295
1295
|
/** @typedef {(err?: WebpackError | null, result?: boolean) => void} CheckSnapshotValidCallback */
|
|
1296
1296
|
|
|
@@ -1608,7 +1608,7 @@ class FileSystemInfo {
|
|
|
1608
1608
|
* @private
|
|
1609
1609
|
* @param {string} path path
|
|
1610
1610
|
* @param {string} reason reason
|
|
1611
|
-
* @param {
|
|
1611
|
+
* @param {(string | number | null | undefined | WebpackError)[]} args arguments
|
|
1612
1612
|
*/
|
|
1613
1613
|
_log(path, reason, ...args) {
|
|
1614
1614
|
const key = path + reason;
|
package/lib/graph/ChunkGraph.js
CHANGED
|
@@ -361,6 +361,9 @@ class ChunkGraph {
|
|
|
361
361
|
|
|
362
362
|
/** @type {HashFunction} */
|
|
363
363
|
this._hashFunction = hashFunction;
|
|
364
|
+
// lets the per-module override lookup bail out until something sets one
|
|
365
|
+
/** @type {boolean} */
|
|
366
|
+
this._hasOverwrittenSourceTypes = false;
|
|
364
367
|
|
|
365
368
|
this._getGraphRoots = this._getGraphRoots.bind(this);
|
|
366
369
|
}
|
|
@@ -804,6 +807,7 @@ class ChunkGraph {
|
|
|
804
807
|
cgc.sourceTypesByModule = new WeakMap();
|
|
805
808
|
}
|
|
806
809
|
cgc.sourceTypesByModule.set(module, sourceTypes);
|
|
810
|
+
this._hasOverwrittenSourceTypes = true;
|
|
807
811
|
// Update cgc._modulesBySourceType to invalidate the cache
|
|
808
812
|
cgc._modulesBySourceType = modulesBySourceType(cgc.sourceTypesByModule);
|
|
809
813
|
}
|
|
@@ -839,6 +843,7 @@ class ChunkGraph {
|
|
|
839
843
|
* @returns {SourceTypes | undefined} source types
|
|
840
844
|
*/
|
|
841
845
|
_getOverwrittenModuleSourceTypes(module) {
|
|
846
|
+
if (!this._hasOverwrittenSourceTypes) return;
|
|
842
847
|
let newSet = false;
|
|
843
848
|
/** @type {Set<SourceType> | undefined} */
|
|
844
849
|
let sourceTypes;
|
package/lib/graph/Dependency.js
CHANGED
|
@@ -25,6 +25,7 @@ const memoize = require("../util/memoize");
|
|
|
25
25
|
/** @import WebAssemblyExportImportedDependency from "../dependencies/wasm/WebAssemblyExportImportedDependency" */
|
|
26
26
|
/** @import ConsumeSharedFallbackDependency from "../sharing/ConsumeSharedFallbackDependency" */
|
|
27
27
|
/** @import ProvideForSharedDependency from "../sharing/ProvideForSharedDependency" */
|
|
28
|
+
/** @import ProvidedDependency from "../provide/ProvidedDependency" */
|
|
28
29
|
/** @import LocalModuleDependency from "../dependencies/amd/LocalModuleDependency" */
|
|
29
30
|
/** @import StaticExportsDependency from "../dependencies/core/StaticExportsDependency" */
|
|
30
31
|
/** @import LoaderImportDependency from "../loaders/LoaderImportDependency" */
|
|
@@ -36,6 +37,8 @@ const memoize = require("../util/memoize");
|
|
|
36
37
|
/** @import ESMImportDependency from "../dependencies/esm/ESMImportDependency" */
|
|
37
38
|
/** @import ImportDependency from "../dependencies/import/ImportDependency" */
|
|
38
39
|
/** @import ESMExportImportedSpecifierDependency from "../dependencies/esm/ESMExportImportedSpecifierDependency" */
|
|
40
|
+
/** @import ESMExportSpecifierDependency from "../dependencies/esm/ESMExportSpecifierDependency" */
|
|
41
|
+
/** @import ESMLiveExportDependency from "../dependencies/esm/ESMLiveExportDependency" */
|
|
39
42
|
/** @import ESMImportSideEffectDependency from "../dependencies/esm/ESMImportSideEffectDependency" */
|
|
40
43
|
/** @import DependenciesBlock from "./DependenciesBlock" */
|
|
41
44
|
/** @import Module, { SourceType } from "../module/Module" */
|
|
@@ -171,8 +174,11 @@ const getIgnoredModule = memoize(() => {
|
|
|
171
174
|
* @typedef {{
|
|
172
175
|
* "module-dependency": ModuleDependency,
|
|
173
176
|
* "esm-import": ESMImportDependency,
|
|
177
|
+
* provided: ProvidedDependency,
|
|
174
178
|
* "dynamic-import": ImportDependency,
|
|
175
179
|
* "esm-reexport": ESMExportImportedSpecifierDependency,
|
|
180
|
+
* "esm-export-specifier": ESMExportSpecifierDependency,
|
|
181
|
+
* "esm-live-export": ESMLiveExportDependency,
|
|
176
182
|
* "esm-side-effect-import": ESMImportSideEffectDependency,
|
|
177
183
|
* "css-import": CssImportDependency,
|
|
178
184
|
* entry: EntryDependency,
|
|
@@ -558,7 +564,7 @@ Object.defineProperty(Dependency.prototype, "module", {
|
|
|
558
564
|
/**
|
|
559
565
|
* Returns throws.
|
|
560
566
|
* @deprecated
|
|
561
|
-
* @returns {
|
|
567
|
+
* @returns {void} throws
|
|
562
568
|
*/
|
|
563
569
|
get() {
|
|
564
570
|
throw new Error(
|
|
@@ -605,7 +611,7 @@ Object.defineProperty(Dependency.prototype, "disconnect", {
|
|
|
605
611
|
/**
|
|
606
612
|
* Returns throws.
|
|
607
613
|
* @deprecated
|
|
608
|
-
* @returns {
|
|
614
|
+
* @returns {void} throws
|
|
609
615
|
*/
|
|
610
616
|
get() {
|
|
611
617
|
throw new Error(
|
package/lib/graph/ExportsInfo.js
CHANGED
package/lib/graph/ModuleGraph.js
CHANGED
|
@@ -15,6 +15,7 @@ const ModuleGraphConnection = require("./ModuleGraphConnection");
|
|
|
15
15
|
const isDependencyKind = require("./isDependencyKind");
|
|
16
16
|
|
|
17
17
|
/** @import { ModuleMemCaches } from "../Compilation" */
|
|
18
|
+
/** @import { TupleElement } from "../util/WeakTupleMap" */
|
|
18
19
|
/** @import DependenciesBlock from "./DependenciesBlock" */
|
|
19
20
|
/** @import Dependency, { ExportInfoName } from "./Dependency" */
|
|
20
21
|
/** @import { ExportInfo } from "./ExportsInfo" */
|
|
@@ -138,12 +139,22 @@ class ModuleGraphModule {
|
|
|
138
139
|
* } from "../dependencies/esm/ESMExportImportedSpecifierDependency"
|
|
139
140
|
*/
|
|
140
141
|
|
|
142
|
+
/**
|
|
143
|
+
* A module-level `let` a module library declares in the chunk's scope instead.
|
|
144
|
+
* @typedef {object} LiveBinding
|
|
145
|
+
* @property {string} name the name the chunk's scope declares
|
|
146
|
+
* @property {Set<string>} runtimes the keys of the runtimes declaring it
|
|
147
|
+
* @property {Set<string>} registered the keys of the runtimes where a module mirrors it through the setters a module library registers, not by name
|
|
148
|
+
*/
|
|
149
|
+
|
|
141
150
|
/**
|
|
142
151
|
* Defines the known meta type used by this module.
|
|
143
152
|
* @typedef {object} KnownMeta
|
|
144
153
|
* @property {Map<Module, string>=} importVarMap
|
|
145
154
|
* @property {Map<Module, string>=} deferredImportVarMap
|
|
146
155
|
* @property {boolean=} onDemandExports generate export definitions on demand
|
|
156
|
+
* @property {Map<string, LiveBinding>=} liveBindings module-level `let` names a module library declares in the chunk's scope instead
|
|
157
|
+
* @property {Map<string, LiveBinding>=} liveSetters module-level names a module keeps declared and mirrors to the chunk's scope on each write
|
|
147
158
|
*/
|
|
148
159
|
|
|
149
160
|
/** @typedef {KnownMeta & Record<CommonJsExportRequireDependencyIDsSymbol | ESMImportSpecifierDependencyIDsSymbol | ESMExportImportedSpecifierDependencyIDsSymbol, string[]> & Record<string, EXPECTED_ANY>} Meta */
|
|
@@ -1145,7 +1156,7 @@ class ModuleGraph {
|
|
|
1145
1156
|
|
|
1146
1157
|
/**
|
|
1147
1158
|
* Returns computed value or cached.
|
|
1148
|
-
* @template {
|
|
1159
|
+
* @template {TupleElement[]} T
|
|
1149
1160
|
* @template R
|
|
1150
1161
|
* @param {(moduleGraph: ModuleGraph, ...args: T) => R} fn computer
|
|
1151
1162
|
* @param {T} args arguments
|
|
@@ -1167,7 +1178,7 @@ class ModuleGraph {
|
|
|
1167
1178
|
/**
|
|
1168
1179
|
* Dependency cache provide.
|
|
1169
1180
|
* @template {Dependency} D
|
|
1170
|
-
* @template {
|
|
1181
|
+
* @template {TupleElement[]} ARGS
|
|
1171
1182
|
* @template R
|
|
1172
1183
|
* @param {D} dependency dependency
|
|
1173
1184
|
* @param {[...ARGS, (moduleGraph: ModuleGraph, dependency: D, ...args: ARGS) => R]} args arguments, last argument is a function called with moduleGraph, dependency, ...args
|
|
@@ -1175,7 +1186,7 @@ class ModuleGraph {
|
|
|
1175
1186
|
*/
|
|
1176
1187
|
dependencyCacheProvide(dependency, ...args) {
|
|
1177
1188
|
const fn =
|
|
1178
|
-
/** @type {(moduleGraph: ModuleGraph, dependency: D, ...args:
|
|
1189
|
+
/** @type {(moduleGraph: ModuleGraph, dependency: D, ...args: TupleElement[]) => R} */
|
|
1179
1190
|
(args.pop());
|
|
1180
1191
|
if (this._moduleMemCaches && this._cacheStage) {
|
|
1181
1192
|
const memCache = this._moduleMemCaches.get(
|
|
@@ -192,7 +192,11 @@ const extractBlockModules = (module, moduleGraph, runtime, blockModulesMap) => {
|
|
|
192
192
|
if (modules[i] === m) {
|
|
193
193
|
const merged = /** @type {ConnectionState} */ (modules[i + 1]);
|
|
194
194
|
/** @type {ModuleGraphConnection[]} */
|
|
195
|
-
(
|
|
195
|
+
(
|
|
196
|
+
/** @type {BlockModulesInFlattenTuples[number]} */ (
|
|
197
|
+
modules[i + 2]
|
|
198
|
+
)
|
|
199
|
+
).push(connection);
|
|
196
200
|
if (merged === true) continue outer;
|
|
197
201
|
modules[i + 1] = ModuleGraphConnection.addConnectionStates(
|
|
198
202
|
merged,
|
|
@@ -206,7 +210,8 @@ const extractBlockModules = (module, moduleGraph, runtime, blockModulesMap) => {
|
|
|
206
210
|
modules[length] = state;
|
|
207
211
|
length++;
|
|
208
212
|
/** @type {ModuleGraphConnection[]} */
|
|
209
|
-
(/** @type {
|
|
213
|
+
(/** @type {BlockModulesInFlattenTuples[number]} */ (modules[length])) =
|
|
214
|
+
[connection];
|
|
210
215
|
length++;
|
|
211
216
|
if (length > 30) {
|
|
212
217
|
// To avoid worse case performance, we will use an index map for
|
|
@@ -222,7 +227,11 @@ const extractBlockModules = (module, moduleGraph, runtime, blockModulesMap) => {
|
|
|
222
227
|
if (idx !== undefined) {
|
|
223
228
|
const merged = /** @type {ConnectionState} */ (modules[idx]);
|
|
224
229
|
/** @type {ModuleGraphConnection[]} */
|
|
225
|
-
(
|
|
230
|
+
(
|
|
231
|
+
/** @type {BlockModulesInFlattenTuples[number]} */ (
|
|
232
|
+
modules[idx + 1]
|
|
233
|
+
)
|
|
234
|
+
).push(connection);
|
|
226
235
|
if (merged === true) continue;
|
|
227
236
|
modules[idx] = ModuleGraphConnection.addConnectionStates(
|
|
228
237
|
merged,
|
|
@@ -236,7 +245,7 @@ const extractBlockModules = (module, moduleGraph, runtime, blockModulesMap) => {
|
|
|
236
245
|
length++;
|
|
237
246
|
/** @type {ModuleGraphConnection[]} */
|
|
238
247
|
(
|
|
239
|
-
/** @type {
|
|
248
|
+
/** @type {BlockModulesInFlattenTuples[number]} */
|
|
240
249
|
(modules[length])
|
|
241
250
|
) = [connection];
|
|
242
251
|
length++;
|
|
@@ -635,25 +644,14 @@ const visitModules = (
|
|
|
635
644
|
? entryOptions.asyncChunks
|
|
636
645
|
: chunkGroupInfo.asyncChunks
|
|
637
646
|
};
|
|
638
|
-
chunkGroupInfoMap.set(
|
|
639
|
-
entrypoint,
|
|
640
|
-
/** @type {ChunkGroupInfo} */
|
|
641
|
-
(cgi)
|
|
642
|
-
);
|
|
647
|
+
chunkGroupInfoMap.set(entrypoint, cgi);
|
|
643
648
|
|
|
644
649
|
chunkGraph.connectBlockAndChunkGroup(b, entrypoint);
|
|
645
650
|
if (chunkName) {
|
|
646
|
-
namedAsyncEntrypoints.set(
|
|
647
|
-
chunkName,
|
|
648
|
-
/** @type {ChunkGroupInfo} */
|
|
649
|
-
(cgi)
|
|
650
|
-
);
|
|
651
|
+
namedAsyncEntrypoints.set(chunkName, cgi);
|
|
651
652
|
}
|
|
652
653
|
if (!b.circular && depModule) {
|
|
653
|
-
depModuleAsyncEntrypoints.set(
|
|
654
|
-
depModule,
|
|
655
|
-
/** @type {ChunkGroupInfo} */ (cgi)
|
|
656
|
-
);
|
|
654
|
+
depModuleAsyncEntrypoints.set(depModule, cgi);
|
|
657
655
|
}
|
|
658
656
|
} else {
|
|
659
657
|
entrypoint = /** @type {Entrypoint} */ (cgi.chunkGroup);
|
|
@@ -690,7 +688,7 @@ const visitModules = (
|
|
|
690
688
|
module,
|
|
691
689
|
chunk: entrypoint.chunks[0],
|
|
692
690
|
chunkGroup: entrypoint,
|
|
693
|
-
chunkGroupInfo:
|
|
691
|
+
chunkGroupInfo: cgi
|
|
694
692
|
});
|
|
695
693
|
} else if (!chunkGroupInfo.asyncChunks || !chunkGroupInfo.chunkLoading) {
|
|
696
694
|
// Just queue the block into the current chunk group
|
|
@@ -150,7 +150,7 @@ module.exports = (items, getDependencies) => {
|
|
|
150
150
|
case CANDIDATE_MARKER:
|
|
151
151
|
// This finished SCC was previously considered as root SCC
|
|
152
152
|
// We just found a new incoming edge, so it is no longer a candidate
|
|
153
|
-
rootSCCs.delete(
|
|
153
|
+
rootSCCs.delete(depSCC);
|
|
154
154
|
depSCC.marker = DONE_MARKER;
|
|
155
155
|
break;
|
|
156
156
|
case DONE_MARKER:
|
|
@@ -6,15 +6,15 @@
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
8
|
/** @typedef {string | number} ModuleId */
|
|
9
|
-
/** @typedef {
|
|
9
|
+
/** @typedef {object} HotData */
|
|
10
10
|
/** @typedef {(data: HotData) => void} DisposeHandler */
|
|
11
11
|
/** @typedef {(outdatedDependencies: ModuleId[]) => void} AcceptCallback */
|
|
12
12
|
/** @typedef {(err: Error, context: { moduleId: ModuleId, dependencyId?: ModuleId, module?: HotModule }) => void} AcceptErrorHandler */
|
|
13
13
|
/** @typedef {(status: string) => (Promise<void> | void)} StatusHandler */
|
|
14
|
-
/** @typedef {
|
|
14
|
+
/** @typedef {import("./JavascriptHotModuleReplacement.runtime").ApplyOptions} ApplyOptions */
|
|
15
15
|
/** @typedef {(reportError: (err: Error) => void) => Promise<ModuleId[]>} ApplyFn */
|
|
16
|
-
/** @typedef {(chunkId: ModuleId, fetchPriority?: string) => Promise<
|
|
17
|
-
/** @typedef {(chunkId: ModuleId, importFn: () => Promise<
|
|
16
|
+
/** @typedef {(chunkId: ModuleId, fetchPriority?: string) => Promise<void[] | void>} EnsureChunk */
|
|
17
|
+
/** @typedef {<T>(chunkId: ModuleId, importFn: () => Promise<T>) => Promise<T>} AnalyzableChunkImport */
|
|
18
18
|
/** @typedef {{ (id: ModuleId): unknown, e?: EnsureChunk, ei?: AnalyzableChunkImport, [name: string]: unknown }} WebpackRequire */
|
|
19
19
|
|
|
20
20
|
/**
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
* @property {Record<string, string>=} n the stylesheet name of each updated chunk whose name moved with its content
|
|
33
33
|
*/
|
|
34
34
|
|
|
35
|
-
/** @typedef {(chunkIds: ModuleId[], removedChunks: ModuleId[], removedModules: ModuleId[], promises: Promise<
|
|
35
|
+
/** @typedef {(chunkIds: ModuleId[], removedChunks: ModuleId[], removedModules: ModuleId[], promises: (Promise<void> | undefined)[], applyHandlers: ApplyHandler[], updatedModulesList: ModuleId[], css: CssUpdateManifest | undefined, forceLoadChunks: ModuleId[] | undefined) => void} DownloadUpdateHandler */
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* @typedef {object} HMRManifest
|
|
@@ -363,8 +363,9 @@ module.exports = function () {
|
|
|
363
363
|
}
|
|
364
364
|
|
|
365
365
|
/**
|
|
366
|
-
* @
|
|
367
|
-
* @
|
|
366
|
+
* @template T
|
|
367
|
+
* @param {Promise<T>} promise blocking promise
|
|
368
|
+
* @returns {Promise<T>} the same promise
|
|
368
369
|
*/
|
|
369
370
|
function trackBlockingPromise(promise) {
|
|
370
371
|
switch (currentStatus) {
|
|
@@ -435,7 +436,7 @@ module.exports = function () {
|
|
|
435
436
|
update.f
|
|
436
437
|
);
|
|
437
438
|
return promises;
|
|
438
|
-
}, /** @type {Promise<
|
|
439
|
+
}, /** @type {(Promise<void> | undefined)[]} */ ([]))
|
|
439
440
|
).then(function () {
|
|
440
441
|
return waitForBlockingPromises(function () {
|
|
441
442
|
if (applyOnUpdate) {
|
|
@@ -479,7 +480,7 @@ module.exports = function () {
|
|
|
479
480
|
var results = /** @type {ApplyHandler[]} */ (
|
|
480
481
|
currentUpdateApplyHandlers
|
|
481
482
|
).map(function (handler) {
|
|
482
|
-
return handler(
|
|
483
|
+
return handler(options);
|
|
483
484
|
});
|
|
484
485
|
currentUpdateApplyHandlers = undefined;
|
|
485
486
|
|
|
@@ -53,7 +53,7 @@ const getParserHooks = require("./parserHooks");
|
|
|
53
53
|
/** @import { AssetInfo } from "../Compilation" */
|
|
54
54
|
/** @import Compiler, { Records } from "../Compiler" */
|
|
55
55
|
/** @import CodeGenerationResults from "../module/CodeGenerationResults" */
|
|
56
|
-
/** @import Module
|
|
56
|
+
/** @import Module from "../module/Module" */
|
|
57
57
|
/** @import { CssModuleBuildMeta } from "../css/CssModule" */
|
|
58
58
|
/** @import { HMRJavascriptParserHooks } from "./parserHooks" */
|
|
59
59
|
/** @import RuntimeModule from "../runtime/RuntimeModule" */
|
|
@@ -138,9 +138,7 @@ class HotModuleReplacementPlugin {
|
|
|
138
138
|
);
|
|
139
139
|
dep.loc = parser.getLocation(expr);
|
|
140
140
|
module.addPresentationalDependency(dep);
|
|
141
|
-
|
|
142
|
-
(module.buildInfo).moduleConcatenationBailout =
|
|
143
|
-
"Hot Module Replacement";
|
|
141
|
+
module.buildInfo.moduleConcatenationBailout = "Hot Module Replacement";
|
|
144
142
|
|
|
145
143
|
if (expr.arguments.length >= 1) {
|
|
146
144
|
const arg = parser.evaluateExpression(expr.arguments[0]);
|
|
@@ -198,8 +196,7 @@ class HotModuleReplacementPlugin {
|
|
|
198
196
|
);
|
|
199
197
|
dep.loc = parser.getLocation(expr);
|
|
200
198
|
module.addPresentationalDependency(dep);
|
|
201
|
-
|
|
202
|
-
(module.buildInfo).moduleConcatenationBailout = "Hot Module Replacement";
|
|
199
|
+
module.buildInfo.moduleConcatenationBailout = "Hot Module Replacement";
|
|
203
200
|
if (expr.arguments.length === 1) {
|
|
204
201
|
const arg = parser.evaluateExpression(expr.arguments[0]);
|
|
205
202
|
/** @type {BasicEvaluatedExpression[]} */
|
|
@@ -238,8 +235,7 @@ class HotModuleReplacementPlugin {
|
|
|
238
235
|
);
|
|
239
236
|
dep.loc = parser.getLocation(expr);
|
|
240
237
|
module.addPresentationalDependency(dep);
|
|
241
|
-
|
|
242
|
-
(module.buildInfo).moduleConcatenationBailout = "Hot Module Replacement";
|
|
238
|
+
module.buildInfo.moduleConcatenationBailout = "Hot Module Replacement";
|
|
243
239
|
return true;
|
|
244
240
|
};
|
|
245
241
|
|
|
@@ -684,9 +680,7 @@ class HotModuleReplacementPlugin {
|
|
|
684
680
|
if (hash !== oldHash) {
|
|
685
681
|
if (module.is("runtime")) {
|
|
686
682
|
newRuntimeModules = newRuntimeModules || [];
|
|
687
|
-
newRuntimeModules.push(
|
|
688
|
-
/** @type {RuntimeModule} */ (module)
|
|
689
|
-
);
|
|
683
|
+
newRuntimeModules.push(module);
|
|
690
684
|
} else {
|
|
691
685
|
newModules = newModules || [];
|
|
692
686
|
newModules.push(module);
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
8
|
/** @typedef {string | number} ModuleId */
|
|
9
|
-
/** @typedef {
|
|
9
|
+
/** @typedef {object} HotData */
|
|
10
10
|
/** @typedef {(data: HotData) => void} DisposeHandler */
|
|
11
|
-
/** @typedef {(outdatedDependencies: ModuleId[]) => void} AcceptCallback */
|
|
11
|
+
/** @typedef {(outdatedDependencies: ModuleId[]) => void | Promise<void>} AcceptCallback */
|
|
12
12
|
/** @typedef {(err: unknown, context: { moduleId: ModuleId, dependencyId: ModuleId }) => void} AcceptErrorHandler */
|
|
13
13
|
/** @typedef {(err: unknown, context: { moduleId: ModuleId, module: HotModule }) => void} SelfAcceptErrorHandler */
|
|
14
|
-
/** @typedef {(module: HotModule, exports:
|
|
14
|
+
/** @typedef {(module: HotModule, exports: EXPECTED_OBJECT, require: typeof __webpack_require__) => void} ModuleFactory */
|
|
15
15
|
/** @typedef {{ type: string, moduleId: ModuleId, dependencyId?: ModuleId, error: unknown, originalError?: unknown }} HotErrorEvent */
|
|
16
16
|
/** @typedef {(reportError: (err: unknown) => void) => Promise<ModuleId[]>} ApplyFn */
|
|
17
17
|
|
|
@@ -36,9 +36,10 @@
|
|
|
36
36
|
|
|
37
37
|
/** @typedef {(options: ApplyOptions) => ApplyResult} ApplyHandler */
|
|
38
38
|
/** @typedef {(moduleId: ModuleId, applyHandlers: ApplyHandler[]) => void} InvalidateModuleHandler */
|
|
39
|
-
/** @typedef {(chunkIds: ModuleId[], removedChunks: ModuleId[], removedModules: ModuleId[], promises: Promise<
|
|
40
|
-
/** @typedef {(chunkId: ModuleId, promises: Promise<
|
|
41
|
-
/** @typedef {(webpackRequire:
|
|
39
|
+
/** @typedef {(chunkIds: ModuleId[], removedChunks: ModuleId[], removedModules: ModuleId[], promises: (Promise<void> | undefined)[], applyHandlers: ApplyHandler[], updatedModulesList: ModuleId[], css: ModuleId[] | undefined, forceLoadChunks: ModuleId[] | undefined) => void} DownloadUpdateHandler */
|
|
40
|
+
/** @typedef {(chunkId: ModuleId, promises: (Promise<void> | undefined)[]) => void} EnsureChunkHandler */
|
|
41
|
+
/** @typedef {(webpackRequire: typeof __webpack_require__) => void} RuntimeModuleFn */
|
|
42
|
+
/** @typedef {0 | 1 | null | [() => void, Promise<void>] | [() => void, (err: Error) => void, Promise<void>]} InstalledChunk */
|
|
42
43
|
|
|
43
44
|
/**
|
|
44
45
|
* @typedef {object} Hot
|
|
@@ -77,9 +78,9 @@
|
|
|
77
78
|
|
|
78
79
|
// Globals injected by code generation; declared here only to type the template.
|
|
79
80
|
/* eslint-disable no-unassigned-vars */
|
|
80
|
-
/** @type {Record<ModuleId,
|
|
81
|
+
/** @type {Record<ModuleId, InstalledChunk | undefined>} */
|
|
81
82
|
var $installedChunks$;
|
|
82
|
-
/** @type {(chunkId: ModuleId, updatedModulesList?: ModuleId[]) => Promise<
|
|
83
|
+
/** @type {(chunkId: ModuleId, updatedModulesList?: ModuleId[]) => Promise<void> | undefined} */
|
|
83
84
|
var $loadUpdateChunk$;
|
|
84
85
|
/** @type {Record<ModuleId, HotModule>} */
|
|
85
86
|
var $moduleCache$;
|
|
@@ -115,7 +116,7 @@ module.exports = function () {
|
|
|
115
116
|
function applyHandler(options) {
|
|
116
117
|
if ($ensureChunkHandlers$) delete $ensureChunkHandlers$.$key$Hmr;
|
|
117
118
|
currentUpdateChunks = /** @type {Record<ModuleId, boolean>} */ (
|
|
118
|
-
/** @type {
|
|
119
|
+
/** @type {typeof currentUpdateChunks | undefined} */ (undefined)
|
|
119
120
|
);
|
|
120
121
|
/**
|
|
121
122
|
* @param {ModuleId} updateModuleId updated module id
|
|
@@ -317,7 +318,7 @@ module.exports = function () {
|
|
|
317
318
|
}
|
|
318
319
|
}
|
|
319
320
|
currentUpdate = /** @type {Record<ModuleId, ModuleFactory | false>} */ (
|
|
320
|
-
/** @type {
|
|
321
|
+
/** @type {typeof currentUpdate | undefined} */ (undefined)
|
|
321
322
|
);
|
|
322
323
|
|
|
323
324
|
// Store self accepted outdated modules to require them later by the module system
|
|
@@ -351,7 +352,7 @@ module.exports = function () {
|
|
|
351
352
|
delete $installedChunks$[chunkId];
|
|
352
353
|
});
|
|
353
354
|
currentUpdateRemovedChunks = /** @type {ModuleId[]} */ (
|
|
354
|
-
/** @type {
|
|
355
|
+
/** @type {ModuleId[] | undefined} */ (undefined)
|
|
355
356
|
);
|
|
356
357
|
|
|
357
358
|
var idx;
|
|
@@ -409,7 +410,7 @@ module.exports = function () {
|
|
|
409
410
|
}
|
|
410
411
|
},
|
|
411
412
|
apply: function (reportError) {
|
|
412
|
-
/** @type {Promise<
|
|
413
|
+
/** @type {Promise<void>[]} */
|
|
413
414
|
var acceptPromises = [];
|
|
414
415
|
// insert new code
|
|
415
416
|
for (var updateModuleId in appliedUpdate) {
|
|
@@ -450,7 +451,7 @@ module.exports = function () {
|
|
|
450
451
|
}
|
|
451
452
|
}
|
|
452
453
|
for (var k = 0; k < callbacks.length; k++) {
|
|
453
|
-
/** @type {
|
|
454
|
+
/** @type {void | Promise<void> | undefined} */
|
|
454
455
|
var result;
|
|
455
456
|
try {
|
|
456
457
|
result = callbacks[k].call(null, moduleOutdatedDependencies);
|
|
@@ -491,12 +492,8 @@ module.exports = function () {
|
|
|
491
492
|
}
|
|
492
493
|
}
|
|
493
494
|
}
|
|
494
|
-
if (
|
|
495
|
-
result
|
|
496
|
-
typeof (/** @type {{ then?: unknown }} */ (result).then) ===
|
|
497
|
-
"function"
|
|
498
|
-
) {
|
|
499
|
-
acceptPromises.push(/** @type {Promise<unknown>} */ (result));
|
|
495
|
+
if (result && typeof result.then === "function") {
|
|
496
|
+
acceptPromises.push(result);
|
|
500
497
|
}
|
|
501
498
|
}
|
|
502
499
|
}
|
|
@@ -133,13 +133,7 @@ const collectStaticExternalRequests = (externals, layer) => {
|
|
|
133
133
|
return;
|
|
134
134
|
}
|
|
135
135
|
if (!item || typeof item !== "object" || item instanceof RegExp) return;
|
|
136
|
-
const resolved =
|
|
137
|
-
resolveByProperty(
|
|
138
|
-
/** @type {Record<string, unknown>} */ (item),
|
|
139
|
-
"byLayer",
|
|
140
|
-
layer
|
|
141
|
-
)
|
|
142
|
-
);
|
|
136
|
+
const resolved = resolveByProperty(item, "byLayer", layer);
|
|
143
137
|
for (const [request, value] of Object.entries(resolved)) {
|
|
144
138
|
// `false` explicitly opts the request out of externalization; reserving
|
|
145
139
|
// it would pull the actual module into the entry chunk.
|