webpack 5.85.0 → 5.88.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.
Potentially problematic release.
This version of webpack might be problematic. Click here for more details.
- package/README.md +5 -2
- package/lib/APIPlugin.js +150 -99
- package/lib/AsyncDependenciesBlock.js +3 -3
- package/lib/BannerPlugin.js +2 -1
- package/lib/CaseSensitiveModulesWarning.js +3 -1
- package/lib/Chunk.js +35 -17
- package/lib/ChunkGraph.js +4 -4
- package/lib/ChunkGroup.js +20 -9
- package/lib/CompatibilityPlugin.js +50 -30
- package/lib/Compilation.js +2 -1
- package/lib/Compiler.js +10 -9
- package/lib/ConcatenationScope.js +2 -2
- package/lib/ConditionalInitFragment.js +11 -1
- package/lib/ConstPlugin.js +73 -32
- package/lib/ContextModule.js +8 -3
- package/lib/ContextModuleFactory.js +1 -0
- package/lib/ContextReplacementPlugin.js +13 -0
- package/lib/DelegatedModule.js +15 -3
- package/lib/DelegatedModuleFactoryPlugin.js +6 -0
- package/lib/DependenciesBlock.js +1 -1
- package/lib/Dependency.js +11 -5
- package/lib/DependencyTemplates.js +1 -1
- package/lib/DllEntryPlugin.js +11 -1
- package/lib/DllModule.js +6 -0
- package/lib/DllReferencePlugin.js +13 -1
- package/lib/Entrypoint.js +1 -1
- package/lib/ErrorHelpers.js +1 -0
- package/lib/EvalSourceMapDevToolPlugin.js +6 -1
- package/lib/ExportsInfo.js +22 -4
- package/lib/ExportsInfoApiPlugin.js +14 -5
- package/lib/ExternalModule.js +20 -8
- package/lib/FileSystemInfo.js +52 -24
- package/lib/FlagAllModulesAsUsedPlugin.js +6 -1
- package/lib/FlagDependencyUsagePlugin.js +3 -1
- package/lib/FlagEntryExportAsUsedPlugin.js +4 -0
- package/lib/Generator.js +7 -0
- package/lib/HotModuleReplacementPlugin.js +8 -0
- package/lib/InitFragment.js +28 -5
- package/lib/JavascriptMetaInfoPlugin.js +11 -6
- package/lib/LibManifestPlugin.js +20 -4
- package/lib/Module.js +14 -3
- package/lib/ModuleDependencyError.js +4 -2
- package/lib/ModuleDependencyWarning.js +4 -2
- package/lib/ModuleGraph.js +31 -24
- package/lib/ModuleGraphConnection.js +19 -6
- package/lib/ModuleInfoHeaderPlugin.js +9 -2
- package/lib/ModuleNotFoundError.js +5 -2
- package/lib/ModuleProfile.js +1 -0
- package/lib/ModuleRestoreError.js +2 -0
- package/lib/ModuleStoreError.js +2 -1
- package/lib/ModuleTypeConstants.js +7 -0
- package/lib/MultiWatching.js +4 -0
- package/lib/NodeStuffPlugin.js +32 -6
- package/lib/ProgressPlugin.js +71 -15
- package/lib/ProvidePlugin.js +13 -4
- package/lib/RawModule.js +3 -1
- package/lib/RequireJsStuffPlugin.js +7 -0
- package/lib/RuntimeGlobals.js +5 -0
- package/lib/RuntimeModule.js +3 -3
- package/lib/RuntimePlugin.js +6 -3
- package/lib/RuntimeTemplate.js +22 -4
- package/lib/SourceMapDevToolModuleOptionsPlugin.js +4 -0
- package/lib/SourceMapDevToolPlugin.js +7 -2
- package/lib/UseStrictPlugin.js +10 -3
- package/lib/Watching.js +62 -25
- package/lib/WebpackError.js +6 -5
- package/lib/WebpackIsIncludedPlugin.js +6 -4
- package/lib/WebpackOptionsApply.js +4 -2
- package/lib/WebpackOptionsDefaulter.js +10 -3
- package/lib/asset/AssetGenerator.js +2 -1
- package/lib/asset/AssetParser.js +11 -6
- package/lib/asset/AssetSourceParser.js +8 -3
- package/lib/async-modules/AwaitDependenciesInitFragment.js +4 -0
- package/lib/buildChunkGraph.js +37 -21
- package/lib/cache/IdleFileCachePlugin.js +2 -1
- package/lib/cache/PackFileCacheStrategy.js +53 -22
- package/lib/config/browserslistTargetHandler.js +7 -7
- package/lib/config/defaults.js +43 -26
- package/lib/container/RemoteRuntimeModule.js +1 -1
- package/lib/css/CssExportsGenerator.js +9 -0
- package/lib/css/CssGenerator.js +1 -1
- package/lib/css/CssLoadingRuntimeModule.js +43 -19
- package/lib/css/CssModulesPlugin.js +42 -14
- package/lib/css/CssParser.js +22 -0
- package/lib/dependencies/AMDDefineDependency.js +34 -4
- package/lib/dependencies/AMDDefineDependencyParserPlugin.js +5 -0
- package/lib/dependencies/AMDRuntimeModules.js +2 -2
- package/lib/dependencies/CommonJsExportsParserPlugin.js +14 -4
- package/lib/dependencies/CommonJsImportsParserPlugin.js +169 -59
- package/lib/dependencies/CommonJsPlugin.js +13 -8
- package/lib/dependencies/CommonJsRequireContextDependency.js +2 -2
- package/lib/dependencies/ConstDependency.js +2 -2
- package/lib/dependencies/ContextDependency.js +7 -2
- package/lib/dependencies/CssImportDependency.js +1 -1
- package/lib/dependencies/CssLocalIdentifierDependency.js +5 -0
- package/lib/dependencies/CssUrlDependency.js +3 -3
- package/lib/dependencies/DllEntryDependency.js +5 -0
- package/lib/dependencies/DynamicExports.js +10 -6
- package/lib/dependencies/ExportsInfoDependency.js +14 -4
- package/lib/dependencies/HarmonyCompatibilityDependency.js +2 -1
- package/lib/dependencies/HarmonyDetectionParserPlugin.js +3 -1
- package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +12 -5
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +2 -0
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +4 -4
- package/lib/dependencies/HarmonyExports.js +9 -5
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +40 -27
- package/lib/dependencies/HarmonyImportSideEffectDependency.js +1 -2
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +31 -21
- package/lib/dependencies/HarmonyTopLevelThisParserPlugin.js +15 -3
- package/lib/dependencies/ImportDependency.js +5 -3
- package/lib/dependencies/ImportEagerDependency.js +5 -3
- package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +19 -0
- package/lib/dependencies/ImportMetaPlugin.js +31 -15
- package/lib/dependencies/ImportParserPlugin.js +62 -25
- package/lib/dependencies/ImportWeakDependency.js +5 -3
- package/lib/dependencies/JsonExportsDependency.js +1 -1
- package/lib/dependencies/ModuleDependency.js +1 -1
- package/lib/dependencies/ModuleDependencyTemplateAsId.js +2 -1
- package/lib/dependencies/ProvidedDependency.js +4 -1
- package/lib/dependencies/RequireContextDependencyParserPlugin.js +13 -5
- package/lib/dependencies/RequireEnsureDependenciesBlock.js +5 -2
- package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +6 -1
- package/lib/dependencies/RequireHeaderDependency.js +4 -0
- package/lib/dependencies/RequireIncludeDependencyParserPlugin.js +26 -5
- package/lib/dependencies/RequireResolveHeaderDependency.js +9 -0
- package/lib/dependencies/SystemPlugin.js +17 -5
- package/lib/dependencies/SystemRuntimeModule.js +1 -1
- package/lib/dependencies/URLDependency.js +2 -2
- package/lib/dependencies/URLPlugin.js +9 -4
- package/lib/dependencies/WebAssemblyImportDependency.js +1 -1
- package/lib/dependencies/WorkerPlugin.js +59 -22
- package/lib/esm/ExportWebpackRequireRuntimeModule.js +1 -1
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +1 -1
- package/lib/hmr/HotModuleReplacementRuntimeModule.js +1 -1
- package/lib/ids/HashedModuleIdsPlugin.js +1 -1
- package/lib/ids/SyncModuleIdsPlugin.js +1 -0
- package/lib/javascript/BasicEvaluatedExpression.js +28 -19
- package/lib/javascript/CommonJsChunkFormatPlugin.js +6 -2
- package/lib/javascript/JavascriptModulesPlugin.js +25 -5
- package/lib/javascript/JavascriptParser.js +157 -85
- package/lib/javascript/JavascriptParserHelpers.js +37 -15
- package/lib/json/JsonData.js +2 -2
- package/lib/json/JsonParser.js +25 -12
- package/lib/library/AmdLibraryPlugin.js +2 -2
- package/lib/library/AssignLibraryPlugin.js +13 -1
- package/lib/library/EnableLibraryPlugin.js +4 -0
- package/lib/library/SystemLibraryPlugin.js +1 -1
- package/lib/library/UmdLibraryPlugin.js +20 -2
- package/lib/logging/runtime.js +1 -1
- package/lib/logging/truncateArgs.js +4 -0
- package/lib/node/ReadFileChunkLoadingRuntimeModule.js +10 -6
- package/lib/node/ReadFileCompileAsyncWasmPlugin.js +2 -1
- package/lib/node/RequireChunkLoadingRuntimeModule.js +10 -6
- package/lib/optimize/AggressiveMergingPlugin.js +8 -0
- package/lib/optimize/AggressiveSplittingPlugin.js +9 -2
- package/lib/optimize/EnsureChunkConditionsPlugin.js +3 -0
- package/lib/optimize/FlagIncludedChunksPlugin.js +11 -5
- package/lib/optimize/InnerGraph.js +5 -5
- package/lib/optimize/InnerGraphPlugin.js +2 -1
- package/lib/optimize/LimitChunkCountPlugin.js +29 -4
- package/lib/optimize/MangleExportsPlugin.js +1 -1
- package/lib/optimize/MinMaxSizeWarning.js +5 -0
- package/lib/optimize/ModuleConcatenationPlugin.js +59 -2
- package/lib/optimize/RealContentHashPlugin.js +80 -30
- package/lib/optimize/RemoveParentModulesPlugin.js +6 -0
- package/lib/optimize/RuntimeChunkPlugin.js +9 -1
- package/lib/optimize/SideEffectsFlagPlugin.js +10 -1
- package/lib/optimize/SplitChunksPlugin.js +71 -31
- package/lib/performance/SizeLimitsPlugin.js +7 -4
- package/lib/prefetch/ChunkPrefetchFunctionRuntimeModule.js +4 -2
- package/lib/prefetch/ChunkPrefetchPreloadPlugin.js +3 -1
- package/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js +6 -3
- package/lib/prefetch/ChunkPrefetchTriggerRuntimeModule.js +4 -2
- package/lib/prefetch/ChunkPreloadTriggerRuntimeModule.js +4 -2
- package/lib/rules/BasicEffectRulePlugin.js +4 -0
- package/lib/rules/BasicMatcherRulePlugin.js +5 -0
- package/lib/rules/RuleSetCompiler.js +3 -3
- package/lib/rules/UseEffectRulePlugin.js +6 -4
- package/lib/runtime/AsyncModuleRuntimeModule.js +8 -5
- package/lib/runtime/AutoPublicPathRuntimeModule.js +4 -2
- package/lib/runtime/BaseUriRuntimeModule.js +3 -3
- package/lib/runtime/ChunkNameRuntimeModule.js +1 -1
- package/lib/runtime/CompatGetDefaultExportRuntimeModule.js +5 -2
- package/lib/runtime/CompatRuntimeModule.js +7 -2
- package/lib/runtime/CreateFakeNamespaceObjectRuntimeModule.js +5 -2
- package/lib/runtime/CreateScriptRuntimeModule.js +4 -2
- package/lib/runtime/CreateScriptUrlRuntimeModule.js +4 -2
- package/lib/runtime/DefinePropertyGettersRuntimeModule.js +5 -2
- package/lib/runtime/EnsureChunkRuntimeModule.js +15 -4
- package/lib/runtime/GetChunkFilenameRuntimeModule.js +6 -10
- package/lib/runtime/GetFullHashRuntimeModule.js +4 -3
- package/lib/runtime/GetMainFilenameRuntimeModule.js +5 -2
- package/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +4 -2
- package/lib/runtime/GlobalRuntimeModule.js +1 -1
- package/lib/runtime/HasOwnPropertyRuntimeModule.js +5 -2
- package/lib/runtime/LoadScriptRuntimeModule.js +64 -48
- package/lib/runtime/MakeNamespaceObjectRuntimeModule.js +5 -2
- package/lib/runtime/NonceRuntimeModule.js +1 -1
- package/lib/runtime/OnChunksLoadedRuntimeModule.js +4 -2
- package/lib/runtime/PublicPathRuntimeModule.js +4 -2
- package/lib/runtime/RelativeUrlRuntimeModule.js +5 -2
- package/lib/runtime/RuntimeIdRuntimeModule.js +6 -2
- package/lib/runtime/StartupChunkDependenciesRuntimeModule.js +9 -3
- package/lib/runtime/StartupEntrypointRuntimeModule.js +3 -2
- package/lib/runtime/SystemContextRuntimeModule.js +1 -1
- package/lib/serialization/BinaryMiddleware.js +143 -1
- package/lib/serialization/ErrorObjectSerializer.js +3 -0
- package/lib/serialization/ObjectMiddleware.js +9 -3
- package/lib/serialization/types.js +1 -1
- package/lib/sharing/ConsumeSharedFallbackDependency.js +3 -0
- package/lib/sharing/ConsumeSharedRuntimeModule.js +14 -5
- package/lib/sharing/ProvideSharedDependency.js +11 -0
- package/lib/sharing/ProvideSharedModule.js +4 -0
- package/lib/sharing/ProvideSharedPlugin.js +22 -21
- package/lib/sharing/ShareRuntimeModule.js +12 -5
- package/lib/sharing/resolveMatchedConfigs.js +1 -1
- package/lib/sharing/utils.js +32 -5
- package/lib/util/AsyncQueue.js +4 -2
- package/lib/util/ParallelismFactorCalculator.js +10 -0
- package/lib/util/Semaphore.js +1 -1
- package/lib/util/StackedCacheMap.js +1 -1
- package/lib/util/URLAbsoluteSpecifier.js +1 -1
- package/lib/util/createHash.js +30 -9
- package/lib/util/deprecation.js +10 -3
- package/lib/util/deterministicGrouping.js +50 -11
- package/lib/util/findGraphRoots.js +4 -2
- package/lib/util/memoize.js +3 -3
- package/lib/util/processAsyncTree.js +7 -1
- package/lib/util/registerExternalSerializer.js +1 -1
- package/lib/util/runtime.js +84 -21
- package/lib/util/semver.js +1 -0
- package/lib/util/smartGrouping.js +1 -1
- package/lib/validateSchema.js +6 -2
- package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +6 -2
- package/lib/wasm-async/AsyncWebAssemblyParser.js +7 -3
- package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +14 -7
- package/lib/wasm-sync/WasmFinalizeExportsPlugin.js +3 -1
- package/lib/wasm-sync/WebAssemblyGenerator.js +1 -0
- package/lib/wasm-sync/WebAssemblyParser.js +6 -2
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +14 -4
- package/lib/webpack.js +11 -2
- package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +15 -16
- package/module.d.ts +1 -0
- package/package.json +5 -4
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +52 -6
- package/schemas/plugins/css/CssGeneratorOptions.json +1 -1
- package/schemas/plugins/css/CssParserOptions.json +1 -1
- package/types.d.ts +606 -292
package/lib/Dependency.js
CHANGED
@@ -89,9 +89,9 @@ const getIgnoredModule = memoize(() => {
|
|
89
89
|
|
90
90
|
class Dependency {
|
91
91
|
constructor() {
|
92
|
-
/** @type {Module} */
|
92
|
+
/** @type {Module | undefined} */
|
93
93
|
this._parentModule = undefined;
|
94
|
-
/** @type {DependenciesBlock} */
|
94
|
+
/** @type {DependenciesBlock | undefined} */
|
95
95
|
this._parentDependenciesBlock = undefined;
|
96
96
|
/** @type {number} */
|
97
97
|
this._parentDependenciesBlockIndex = -1;
|
@@ -174,6 +174,12 @@ class Dependency {
|
|
174
174
|
this._loc = loc;
|
175
175
|
}
|
176
176
|
|
177
|
+
/**
|
178
|
+
* @param {number} startLine start line
|
179
|
+
* @param {number} startColumn start column
|
180
|
+
* @param {number} endLine end line
|
181
|
+
* @param {number} endColumn end column
|
182
|
+
*/
|
177
183
|
setLoc(startLine, startColumn, endLine, endColumn) {
|
178
184
|
this._locSL = startLine;
|
179
185
|
this._locSC = startColumn;
|
@@ -247,7 +253,7 @@ class Dependency {
|
|
247
253
|
/**
|
248
254
|
* Returns warnings
|
249
255
|
* @param {ModuleGraph} moduleGraph module graph
|
250
|
-
* @returns {WebpackError[]} warnings
|
256
|
+
* @returns {WebpackError[] | null | undefined} warnings
|
251
257
|
*/
|
252
258
|
getWarnings(moduleGraph) {
|
253
259
|
return null;
|
@@ -256,7 +262,7 @@ class Dependency {
|
|
256
262
|
/**
|
257
263
|
* Returns errors
|
258
264
|
* @param {ModuleGraph} moduleGraph module graph
|
259
|
-
* @returns {WebpackError[]} errors
|
265
|
+
* @returns {WebpackError[] | null | undefined} errors
|
260
266
|
*/
|
261
267
|
getErrors(moduleGraph) {
|
262
268
|
return null;
|
@@ -288,7 +294,7 @@ class Dependency {
|
|
288
294
|
|
289
295
|
/**
|
290
296
|
* @param {string} context context directory
|
291
|
-
* @returns {Module} a module
|
297
|
+
* @returns {Module | null} a module
|
292
298
|
*/
|
293
299
|
createIgnoredModule(context) {
|
294
300
|
return getIgnoredModule();
|
@@ -27,7 +27,7 @@ class DependencyTemplates {
|
|
27
27
|
|
28
28
|
/**
|
29
29
|
* @param {DependencyConstructor} dependency Constructor of Dependency
|
30
|
-
* @returns {DependencyTemplate} template for this dependency
|
30
|
+
* @returns {DependencyTemplate | undefined} template for this dependency
|
31
31
|
*/
|
32
32
|
get(dependency) {
|
33
33
|
return this._map.get(dependency);
|
package/lib/DllEntryPlugin.js
CHANGED
@@ -9,6 +9,8 @@ const DllModuleFactory = require("./DllModuleFactory");
|
|
9
9
|
const DllEntryDependency = require("./dependencies/DllEntryDependency");
|
10
10
|
const EntryDependency = require("./dependencies/EntryDependency");
|
11
11
|
|
12
|
+
/** @typedef {import("./Compiler")} Compiler */
|
13
|
+
|
12
14
|
class DllEntryPlugin {
|
13
15
|
/**
|
14
16
|
* @param {string} context context
|
@@ -21,6 +23,11 @@ class DllEntryPlugin {
|
|
21
23
|
this.options = options;
|
22
24
|
}
|
23
25
|
|
26
|
+
/**
|
27
|
+
* Apply the plugin
|
28
|
+
* @param {Compiler} compiler the compiler instance
|
29
|
+
* @returns {void}
|
30
|
+
*/
|
24
31
|
apply(compiler) {
|
25
32
|
compiler.hooks.compilation.tap(
|
26
33
|
"DllEntryPlugin",
|
@@ -51,7 +58,10 @@ class DllEntryPlugin {
|
|
51
58
|
this.options.name
|
52
59
|
),
|
53
60
|
this.options,
|
54
|
-
|
61
|
+
error => {
|
62
|
+
if (error) return callback(error);
|
63
|
+
callback();
|
64
|
+
}
|
55
65
|
);
|
56
66
|
});
|
57
67
|
}
|
package/lib/DllModule.js
CHANGED
@@ -15,6 +15,7 @@ const makeSerializable = require("./util/makeSerializable");
|
|
15
15
|
/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */
|
16
16
|
/** @typedef {import("./ChunkGraph")} ChunkGraph */
|
17
17
|
/** @typedef {import("./Compilation")} Compilation */
|
18
|
+
/** @typedef {import("./Dependency")} Dependency */
|
18
19
|
/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */
|
19
20
|
/** @typedef {import("./DependencyTemplates")} DependencyTemplates */
|
20
21
|
/** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */
|
@@ -37,6 +38,11 @@ const RUNTIME_REQUIREMENTS = new Set([
|
|
37
38
|
]);
|
38
39
|
|
39
40
|
class DllModule extends Module {
|
41
|
+
/**
|
42
|
+
* @param {string} context context path
|
43
|
+
* @param {Dependency[]} dependencies dependencies
|
44
|
+
* @param {string} name name
|
45
|
+
*/
|
40
46
|
constructor(context, dependencies, name) {
|
41
47
|
super(JAVASCRIPT_MODULE_TYPE_DYNAMIC, context);
|
42
48
|
|
@@ -16,6 +16,7 @@ const makePathsRelative = require("./util/identifier").makePathsRelative;
|
|
16
16
|
/** @typedef {import("../declarations/WebpackOptions").Externals} Externals */
|
17
17
|
/** @typedef {import("../declarations/plugins/DllReferencePlugin").DllReferencePluginOptions} DllReferencePluginOptions */
|
18
18
|
/** @typedef {import("../declarations/plugins/DllReferencePlugin").DllReferencePluginOptionsManifest} DllReferencePluginOptionsManifest */
|
19
|
+
/** @typedef {import("./Compiler")} Compiler */
|
19
20
|
|
20
21
|
const validate = createSchemaValidation(
|
21
22
|
require("../schemas/plugins/DllReferencePlugin.check.js"),
|
@@ -37,6 +38,11 @@ class DllReferencePlugin {
|
|
37
38
|
this._compilationData = new WeakMap();
|
38
39
|
}
|
39
40
|
|
41
|
+
/**
|
42
|
+
* Apply the plugin
|
43
|
+
* @param {Compiler} compiler the compiler instance
|
44
|
+
* @returns {void}
|
45
|
+
*/
|
40
46
|
apply(compiler) {
|
41
47
|
compiler.hooks.compilation.tap(
|
42
48
|
"DllReferencePlugin",
|
@@ -140,7 +146,9 @@ class DllReferencePlugin {
|
|
140
146
|
// If there was an error parsing the manifest file, add the
|
141
147
|
// error as a compilation error to make the compilation fail.
|
142
148
|
if (data.error) {
|
143
|
-
compilation.errors.push(
|
149
|
+
compilation.errors.push(
|
150
|
+
/** @type {DllManifestError} */ (data.error)
|
151
|
+
);
|
144
152
|
}
|
145
153
|
compilation.fileDependencies.add(manifest);
|
146
154
|
}
|
@@ -151,6 +159,10 @@ class DllReferencePlugin {
|
|
151
159
|
}
|
152
160
|
|
153
161
|
class DllManifestError extends WebpackError {
|
162
|
+
/**
|
163
|
+
* @param {string} filename filename of the manifest
|
164
|
+
* @param {string} message error message
|
165
|
+
*/
|
154
166
|
constructor(filename, message) {
|
155
167
|
super();
|
156
168
|
|
package/lib/Entrypoint.js
CHANGED
package/lib/ErrorHelpers.js
CHANGED
@@ -82,6 +82,10 @@ class EvalSourceMapDevToolPlugin {
|
|
82
82
|
return cachedSource;
|
83
83
|
}
|
84
84
|
|
85
|
+
/**
|
86
|
+
* @param {Source} r result
|
87
|
+
* @returns {Source} result
|
88
|
+
*/
|
85
89
|
const result = r => {
|
86
90
|
cache.set(source, r);
|
87
91
|
return r;
|
@@ -160,7 +164,8 @@ class EvalSourceMapDevToolPlugin {
|
|
160
164
|
}
|
161
165
|
sourceMap.sourceRoot = options.sourceRoot || "";
|
162
166
|
const moduleId = chunkGraph.getModuleId(m);
|
163
|
-
sourceMap.file =
|
167
|
+
sourceMap.file =
|
168
|
+
typeof moduleId === "number" ? `${moduleId}.js` : moduleId;
|
164
169
|
|
165
170
|
const footer =
|
166
171
|
this.sourceMapComment.replace(
|
package/lib/ExportsInfo.js
CHANGED
@@ -14,6 +14,8 @@ const { forEachRuntime } = require("./util/runtime");
|
|
14
14
|
/** @typedef {import("./Module")} Module */
|
15
15
|
/** @typedef {import("./ModuleGraph")} ModuleGraph */
|
16
16
|
/** @typedef {import("./ModuleGraphConnection")} ModuleGraphConnection */
|
17
|
+
/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
18
|
+
/** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
17
19
|
/** @typedef {import("./util/Hash")} Hash */
|
18
20
|
|
19
21
|
/** @typedef {typeof UsageState.OnlyPropertiesUsed | typeof UsageState.NoInfo | typeof UsageState.Unknown | typeof UsageState.Used} RuntimeUsageStateType */
|
@@ -44,6 +46,9 @@ class RestoreProvidedData {
|
|
44
46
|
this.otherTerminalBinding = otherTerminalBinding;
|
45
47
|
}
|
46
48
|
|
49
|
+
/**
|
50
|
+
* @param {ObjectSerializerContext} context context
|
51
|
+
*/
|
47
52
|
serialize({ write }) {
|
48
53
|
write(this.exports);
|
49
54
|
write(this.otherProvided);
|
@@ -51,6 +56,10 @@ class RestoreProvidedData {
|
|
51
56
|
write(this.otherTerminalBinding);
|
52
57
|
}
|
53
58
|
|
59
|
+
/**
|
60
|
+
* @param {ObjectDeserializerContext} context context
|
61
|
+
* @returns {RestoreProvidedData} RestoreProvidedData
|
62
|
+
*/
|
54
63
|
static deserialize({ read }) {
|
55
64
|
return new RestoreProvidedData(read(), read(), read(), read());
|
56
65
|
}
|
@@ -301,7 +310,12 @@ class ExportsInfo {
|
|
301
310
|
changed = true;
|
302
311
|
}
|
303
312
|
if (targetKey) {
|
304
|
-
exportInfo.setTarget(
|
313
|
+
exportInfo.setTarget(
|
314
|
+
targetKey,
|
315
|
+
/** @type {ModuleGraphConnection} */ (targetModule),
|
316
|
+
[exportInfo.name],
|
317
|
+
-1
|
318
|
+
);
|
305
319
|
}
|
306
320
|
}
|
307
321
|
if (this._redirectTo !== undefined) {
|
@@ -331,7 +345,7 @@ class ExportsInfo {
|
|
331
345
|
if (targetKey) {
|
332
346
|
this._otherExportsInfo.setTarget(
|
333
347
|
targetKey,
|
334
|
-
targetModule,
|
348
|
+
/** @type {ModuleGraphConnection} */ (targetModule),
|
335
349
|
undefined,
|
336
350
|
priority
|
337
351
|
);
|
@@ -1226,7 +1240,7 @@ class ExportInfo {
|
|
1226
1240
|
/**
|
1227
1241
|
* @param {ModuleGraph} moduleGraph the module graph
|
1228
1242
|
* @param {function(Module): boolean} validTargetModuleFilter a valid target module
|
1229
|
-
* @param {Set<ExportInfo>
|
1243
|
+
* @param {Set<ExportInfo>} alreadyVisited set of already visited export info to avoid circular references
|
1230
1244
|
* @returns {{ module: Module, export: string[] | undefined } | undefined | false} the target, undefined when there is no target, false when no target is valid
|
1231
1245
|
*/
|
1232
1246
|
_findTarget(moduleGraph, validTargetModuleFilter, alreadyVisited) {
|
@@ -1350,7 +1364,11 @@ class ExportInfo {
|
|
1350
1364
|
if (t === null) return undefined;
|
1351
1365
|
if (t.module !== target.module) return undefined;
|
1352
1366
|
if (!t.export !== !target.export) return undefined;
|
1353
|
-
if (
|
1367
|
+
if (
|
1368
|
+
target.export &&
|
1369
|
+
!equals(/** @type {ArrayLike<string>} */ (t.export), target.export)
|
1370
|
+
)
|
1371
|
+
return undefined;
|
1354
1372
|
result = values.next();
|
1355
1373
|
}
|
1356
1374
|
return target;
|
@@ -14,7 +14,9 @@ const ConstDependency = require("./dependencies/ConstDependency");
|
|
14
14
|
const ExportsInfoDependency = require("./dependencies/ExportsInfoDependency");
|
15
15
|
|
16
16
|
/** @typedef {import("./Compiler")} Compiler */
|
17
|
+
/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
|
17
18
|
/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */
|
19
|
+
/** @typedef {import("./javascript/JavascriptParser").Range} Range */
|
18
20
|
|
19
21
|
const PLUGIN_NAME = "ExportsInfoApiPlugin";
|
20
22
|
|
@@ -43,20 +45,27 @@ class ExportsInfoApiPlugin {
|
|
43
45
|
const dep =
|
44
46
|
members.length >= 2
|
45
47
|
? new ExportsInfoDependency(
|
46
|
-
expr.range,
|
48
|
+
/** @type {Range} */ (expr.range),
|
47
49
|
members.slice(0, -1),
|
48
50
|
members[members.length - 1]
|
49
51
|
)
|
50
|
-
: new ExportsInfoDependency(
|
51
|
-
|
52
|
+
: new ExportsInfoDependency(
|
53
|
+
/** @type {Range} */ (expr.range),
|
54
|
+
null,
|
55
|
+
members[0]
|
56
|
+
);
|
57
|
+
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
|
52
58
|
parser.state.module.addDependency(dep);
|
53
59
|
return true;
|
54
60
|
});
|
55
61
|
parser.hooks.expression
|
56
62
|
.for("__webpack_exports_info__")
|
57
63
|
.tap(PLUGIN_NAME, expr => {
|
58
|
-
const dep = new ConstDependency(
|
59
|
-
|
64
|
+
const dep = new ConstDependency(
|
65
|
+
"true",
|
66
|
+
/** @type {Range} */ (expr.range)
|
67
|
+
);
|
68
|
+
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
|
60
69
|
parser.state.module.addPresentationalDependency(dep);
|
61
70
|
return true;
|
62
71
|
});
|
package/lib/ExternalModule.js
CHANGED
@@ -104,9 +104,13 @@ const getSourceForCommonJsExternal = moduleAndSpecifiers => {
|
|
104
104
|
|
105
105
|
/**
|
106
106
|
* @param {string|string[]} moduleAndSpecifiers the module request
|
107
|
+
* @param {string} importMetaName import.meta name
|
107
108
|
* @returns {SourceData} the generated source
|
108
109
|
*/
|
109
|
-
const getSourceForCommonJsExternalInNodeModule =
|
110
|
+
const getSourceForCommonJsExternalInNodeModule = (
|
111
|
+
moduleAndSpecifiers,
|
112
|
+
importMetaName
|
113
|
+
) => {
|
110
114
|
const chunkInitFragments = [
|
111
115
|
new InitFragment(
|
112
116
|
'import { createRequire as __WEBPACK_EXTERNAL_createRequire } from "module";\n',
|
@@ -117,18 +121,18 @@ const getSourceForCommonJsExternalInNodeModule = moduleAndSpecifiers => {
|
|
117
121
|
];
|
118
122
|
if (!Array.isArray(moduleAndSpecifiers)) {
|
119
123
|
return {
|
120
|
-
|
124
|
+
chunkInitFragments,
|
125
|
+
expression: `__WEBPACK_EXTERNAL_createRequire(${importMetaName}.url)(${JSON.stringify(
|
121
126
|
moduleAndSpecifiers
|
122
|
-
)})
|
123
|
-
chunkInitFragments
|
127
|
+
)})`
|
124
128
|
};
|
125
129
|
}
|
126
130
|
const moduleName = moduleAndSpecifiers[0];
|
127
131
|
return {
|
128
|
-
|
132
|
+
chunkInitFragments,
|
133
|
+
expression: `__WEBPACK_EXTERNAL_createRequire(${importMetaName}.url)(${JSON.stringify(
|
129
134
|
moduleName
|
130
|
-
)})${propertyAccess(moduleAndSpecifiers, 1)}
|
131
|
-
chunkInitFragments
|
135
|
+
)})${propertyAccess(moduleAndSpecifiers, 1)}`
|
132
136
|
};
|
133
137
|
};
|
134
138
|
|
@@ -380,6 +384,11 @@ const getSourceForDefaultCase = (optional, request, runtimeTemplate) => {
|
|
380
384
|
};
|
381
385
|
|
382
386
|
class ExternalModule extends Module {
|
387
|
+
/**
|
388
|
+
* @param {string | string[] | Record<string, string | string[]>} request request
|
389
|
+
* @param {TODO} type type
|
390
|
+
* @param {string} userRequest user request
|
391
|
+
*/
|
383
392
|
constructor(request, type, userRequest) {
|
384
393
|
super(JAVASCRIPT_MODULE_TYPE_DYNAMIC, null);
|
385
394
|
|
@@ -557,7 +566,10 @@ class ExternalModule extends Module {
|
|
557
566
|
return getSourceForCommonJsExternal(request);
|
558
567
|
case "node-commonjs":
|
559
568
|
return this.buildInfo.module
|
560
|
-
? getSourceForCommonJsExternalInNodeModule(
|
569
|
+
? getSourceForCommonJsExternalInNodeModule(
|
570
|
+
request,
|
571
|
+
runtimeTemplate.outputOptions.importMetaName
|
572
|
+
)
|
561
573
|
: getSourceForCommonJsExternal(request);
|
562
574
|
case "amd":
|
563
575
|
case "amd-require":
|
package/lib/FileSystemInfo.js
CHANGED
@@ -99,8 +99,8 @@ const INVALID = Symbol("invalid");
|
|
99
99
|
* @typedef {Object} SnapshotOptimizationEntry
|
100
100
|
* @property {Snapshot} snapshot
|
101
101
|
* @property {number} shared
|
102
|
-
* @property {Set<string>} snapshotContent
|
103
|
-
* @property {Set<SnapshotOptimizationEntry>} children
|
102
|
+
* @property {Set<string> | undefined} snapshotContent
|
103
|
+
* @property {Set<SnapshotOptimizationEntry> | undefined} children
|
104
104
|
*/
|
105
105
|
|
106
106
|
/**
|
@@ -115,6 +115,12 @@ const INVALID = Symbol("invalid");
|
|
115
115
|
* @property {Set<string>} resolveDependencies.missing list of missing entries
|
116
116
|
*/
|
117
117
|
|
118
|
+
/**
|
119
|
+
* @typedef {Object} SnapshotOptions
|
120
|
+
* @property {boolean=} hash should use hash to snapshot
|
121
|
+
* @property {boolean=} timestamp should use timestamp to snapshot
|
122
|
+
*/
|
123
|
+
|
118
124
|
const DONE_ITERATOR_RESULT = new Set().keys().next();
|
119
125
|
|
120
126
|
// cspell:word tshs
|
@@ -137,7 +143,7 @@ class SnapshotIterable {
|
|
137
143
|
let state = 0;
|
138
144
|
/** @type {IterableIterator<string>} */
|
139
145
|
let it;
|
140
|
-
/** @type {(Snapshot) => (Map<string, any> | Set<string>)[]} */
|
146
|
+
/** @type {(snapshot: Snapshot) => (Map<string, any> | Set<string>)[]} */
|
141
147
|
let getMaps;
|
142
148
|
/** @type {(Map<string, any> | Set<string>)[]} */
|
143
149
|
let maps;
|
@@ -552,7 +558,7 @@ class SnapshotOptimization {
|
|
552
558
|
}
|
553
559
|
};
|
554
560
|
|
555
|
-
/** @type {SnapshotOptimizationEntry} */
|
561
|
+
/** @type {SnapshotOptimizationEntry | undefined} */
|
556
562
|
let newOptimizationEntry = undefined;
|
557
563
|
|
558
564
|
const capturedFilesSize = capturedFiles.size;
|
@@ -757,10 +763,9 @@ const mergeMaps = (a, b) => {
|
|
757
763
|
|
758
764
|
/**
|
759
765
|
* @template T
|
760
|
-
* @
|
761
|
-
* @param {Set<T
|
762
|
-
* @
|
763
|
-
* @returns {Set<T, K>} joined map
|
766
|
+
* @param {Set<T>} a source map
|
767
|
+
* @param {Set<T>} b joining map
|
768
|
+
* @returns {Set<T>} joined map
|
764
769
|
*/
|
765
770
|
const mergeSets = (a, b) => {
|
766
771
|
if (!b || b.size === 0) return a;
|
@@ -858,8 +863,8 @@ const getManagedItem = (managedPath, path) => {
|
|
858
863
|
|
859
864
|
/**
|
860
865
|
* @template {ContextFileSystemInfoEntry | ContextTimestampAndHash} T
|
861
|
-
* @param {T} entry entry
|
862
|
-
* @returns {T["resolved"] | undefined} the resolved entry
|
866
|
+
* @param {T | null} entry entry
|
867
|
+
* @returns {T["resolved"] | null | undefined} the resolved entry
|
863
868
|
*/
|
864
869
|
const getResolvedTimestamp = entry => {
|
865
870
|
if (entry === null) return null;
|
@@ -868,8 +873,8 @@ const getResolvedTimestamp = entry => {
|
|
868
873
|
};
|
869
874
|
|
870
875
|
/**
|
871
|
-
* @param {ContextHash} entry entry
|
872
|
-
* @returns {string | undefined} the resolved entry
|
876
|
+
* @param {ContextHash | null} entry entry
|
877
|
+
* @returns {string | null | undefined} the resolved entry
|
873
878
|
*/
|
874
879
|
const getResolvedHash = entry => {
|
875
880
|
if (entry === null) return null;
|
@@ -877,6 +882,11 @@ const getResolvedHash = entry => {
|
|
877
882
|
return entry.symlinks === undefined ? entry.hash : undefined;
|
878
883
|
};
|
879
884
|
|
885
|
+
/**
|
886
|
+
* @template T
|
887
|
+
* @param {Set<T>} source source
|
888
|
+
* @param {Set<T>} target target
|
889
|
+
*/
|
880
890
|
const addAll = (source, target) => {
|
881
891
|
for (const key of source) target.add(key);
|
882
892
|
};
|
@@ -1145,6 +1155,11 @@ class FileSystemInfo {
|
|
1145
1155
|
);
|
1146
1156
|
}
|
1147
1157
|
|
1158
|
+
/**
|
1159
|
+
* @param {string} path path
|
1160
|
+
* @param {string} reason reason
|
1161
|
+
* @param {any[]} args arguments
|
1162
|
+
*/
|
1148
1163
|
_log(path, reason, ...args) {
|
1149
1164
|
const key = path + reason;
|
1150
1165
|
if (this._loggedPaths.has(key)) return;
|
@@ -1258,7 +1273,7 @@ class FileSystemInfo {
|
|
1258
1273
|
|
1259
1274
|
/**
|
1260
1275
|
* @param {string} path file path
|
1261
|
-
* @param {function((WebpackError | null)=, string=): void} callback callback function
|
1276
|
+
* @param {function((WebpackError | null)=, (string | null)=): void} callback callback function
|
1262
1277
|
* @returns {void}
|
1263
1278
|
*/
|
1264
1279
|
getFileHash(path, callback) {
|
@@ -1289,7 +1304,7 @@ class FileSystemInfo {
|
|
1289
1304
|
|
1290
1305
|
/**
|
1291
1306
|
* @param {string} path context path
|
1292
|
-
* @param {function((WebpackError | null)=, ContextHash=): void} callback callback function
|
1307
|
+
* @param {function((WebpackError | null)=, (ContextHash | null)=): void} callback callback function
|
1293
1308
|
* @returns {void}
|
1294
1309
|
*/
|
1295
1310
|
_getUnresolvedContextHash(path, callback) {
|
@@ -1320,7 +1335,7 @@ class FileSystemInfo {
|
|
1320
1335
|
|
1321
1336
|
/**
|
1322
1337
|
* @param {string} path context path
|
1323
|
-
* @param {function((WebpackError | null)=, ContextTimestampAndHash=): void} callback callback function
|
1338
|
+
* @param {function((WebpackError | null)=, (ContextTimestampAndHash | null)=): void} callback callback function
|
1324
1339
|
* @returns {void}
|
1325
1340
|
*/
|
1326
1341
|
_getUnresolvedContextTsh(path, callback) {
|
@@ -1383,7 +1398,7 @@ class FileSystemInfo {
|
|
1383
1398
|
const resolveDirectories = new Set();
|
1384
1399
|
/** @type {Set<string>} */
|
1385
1400
|
const resolveMissing = new Set();
|
1386
|
-
/** @type {Map<string, string | false>} */
|
1401
|
+
/** @type {Map<string, string | false | undefined>} */
|
1387
1402
|
const resolveResults = new Map();
|
1388
1403
|
const invalidResolveResults = new Set();
|
1389
1404
|
const resolverContext = {
|
@@ -1391,6 +1406,10 @@ class FileSystemInfo {
|
|
1391
1406
|
contextDependencies: resolveDirectories,
|
1392
1407
|
missingDependencies: resolveMissing
|
1393
1408
|
};
|
1409
|
+
/**
|
1410
|
+
* @param {string} expected expected result
|
1411
|
+
* @returns {string} expected result
|
1412
|
+
*/
|
1394
1413
|
const expectedToString = expected => {
|
1395
1414
|
return expected ? ` (expected ${expected})` : "";
|
1396
1415
|
};
|
@@ -1610,7 +1629,7 @@ class FileSystemInfo {
|
|
1610
1629
|
break;
|
1611
1630
|
}
|
1612
1631
|
// Check commonjs cache for the module
|
1613
|
-
/** @type {NodeModule} */
|
1632
|
+
/** @type {NodeModule | undefined} */
|
1614
1633
|
const module = require.cache[path];
|
1615
1634
|
if (module && Array.isArray(module.children)) {
|
1616
1635
|
children: for (const child of module.children) {
|
@@ -1910,13 +1929,11 @@ class FileSystemInfo {
|
|
1910
1929
|
|
1911
1930
|
/**
|
1912
1931
|
*
|
1913
|
-
* @param {number} startTime when processing the files has started
|
1932
|
+
* @param {number | null | undefined} startTime when processing the files has started
|
1914
1933
|
* @param {Iterable<string>} files all files
|
1915
1934
|
* @param {Iterable<string>} directories all directories
|
1916
1935
|
* @param {Iterable<string>} missing all missing files or directories
|
1917
|
-
* @param {
|
1918
|
-
* @param {boolean=} options.hash should use hash to snapshot
|
1919
|
-
* @param {boolean=} options.timestamp should use timestamp to snapshot
|
1936
|
+
* @param {SnapshotOptions | null | undefined} options options object (for future extensions)
|
1920
1937
|
* @param {function((WebpackError | null)=, (Snapshot | null)=): void} callback callback function
|
1921
1938
|
* @returns {void}
|
1922
1939
|
*/
|
@@ -2053,6 +2070,9 @@ class FileSystemInfo {
|
|
2053
2070
|
}
|
2054
2071
|
return capturedItems;
|
2055
2072
|
};
|
2073
|
+
/**
|
2074
|
+
* @param {Set<string>} capturedFiles captured files
|
2075
|
+
*/
|
2056
2076
|
const processCapturedFiles = capturedFiles => {
|
2057
2077
|
switch (mode) {
|
2058
2078
|
case 3:
|
@@ -2639,6 +2659,10 @@ class FileSystemInfo {
|
|
2639
2659
|
}
|
2640
2660
|
}
|
2641
2661
|
}
|
2662
|
+
/**
|
2663
|
+
* @param {string} path file path
|
2664
|
+
* @param {string} hash hash
|
2665
|
+
*/
|
2642
2666
|
const processFileHashSnapshot = (path, hash) => {
|
2643
2667
|
const cache = this._fileHashes.get(path);
|
2644
2668
|
if (cache !== undefined) {
|
@@ -2921,7 +2945,7 @@ class FileSystemInfo {
|
|
2921
2945
|
|
2922
2946
|
const hash = createHash(this._hashFunction);
|
2923
2947
|
|
2924
|
-
hash.update(content);
|
2948
|
+
hash.update(/** @type {string | Buffer} */ (content));
|
2925
2949
|
|
2926
2950
|
const digest = /** @type {string} */ (hash.digest("hex"));
|
2927
2951
|
|
@@ -2985,7 +3009,7 @@ class FileSystemInfo {
|
|
2985
3009
|
* @param {function(string, IStats, function(Error=, ItemType=): void): void} options.fromFile called when context item is a file
|
2986
3010
|
* @param {function(string, IStats, function(Error=, ItemType=): void): void} options.fromDirectory called when context item is a directory
|
2987
3011
|
* @param {function(string[], ItemType[]): T} options.reduce called from all context items
|
2988
|
-
* @param {function((Error | null)=, (T)=): void} callback callback
|
3012
|
+
* @param {function((Error | null)=, (T | null)=): void} callback callback
|
2989
3013
|
*/
|
2990
3014
|
_readContext(
|
2991
3015
|
{
|
@@ -3172,6 +3196,7 @@ class FileSystemInfo {
|
|
3172
3196
|
* @returns {void}
|
3173
3197
|
*/
|
3174
3198
|
_resolveContextTimestamp(entry, callback) {
|
3199
|
+
/** @type {string[]} */
|
3175
3200
|
const hashes = [];
|
3176
3201
|
let safeTime = 0;
|
3177
3202
|
processAsyncTree(
|
@@ -3280,6 +3305,7 @@ class FileSystemInfo {
|
|
3280
3305
|
* @returns {void}
|
3281
3306
|
*/
|
3282
3307
|
_resolveContextHash(entry, callback) {
|
3308
|
+
/** @type {string[]} */
|
3283
3309
|
const hashes = [];
|
3284
3310
|
processAsyncTree(
|
3285
3311
|
entry.symlinks,
|
@@ -3436,7 +3462,9 @@ class FileSystemInfo {
|
|
3436
3462
|
* @returns {void}
|
3437
3463
|
*/
|
3438
3464
|
_resolveContextTsh(entry, callback) {
|
3465
|
+
/** @type {string[]} */
|
3439
3466
|
const hashes = [];
|
3467
|
+
/** @type {string[]} */
|
3440
3468
|
const tsHashes = [];
|
3441
3469
|
let safeTime = 0;
|
3442
3470
|
processAsyncTree(
|
@@ -3554,7 +3582,7 @@ class FileSystemInfo {
|
|
3554
3582
|
}
|
3555
3583
|
let data;
|
3556
3584
|
try {
|
3557
|
-
data = JSON.parse(content.toString("utf-8"));
|
3585
|
+
data = JSON.parse(/** @type {Buffer} */ (content).toString("utf-8"));
|
3558
3586
|
} catch (e) {
|
3559
3587
|
return callback(e);
|
3560
3588
|
}
|
@@ -8,10 +8,14 @@
|
|
8
8
|
const { getEntryRuntime, mergeRuntimeOwned } = require("./util/runtime");
|
9
9
|
|
10
10
|
/** @typedef {import("./Compiler")} Compiler */
|
11
|
+
/** @typedef {import("./Module").FactoryMeta} FactoryMeta */
|
11
12
|
/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */
|
12
13
|
|
13
14
|
const PLUGIN_NAME = "FlagAllModulesAsUsedPlugin";
|
14
15
|
class FlagAllModulesAsUsedPlugin {
|
16
|
+
/**
|
17
|
+
* @param {string} explanation explanation
|
18
|
+
*/
|
15
19
|
constructor(explanation) {
|
16
20
|
this.explanation = explanation;
|
17
21
|
}
|
@@ -40,7 +44,8 @@ class FlagAllModulesAsUsedPlugin {
|
|
40
44
|
if (module.factoryMeta === undefined) {
|
41
45
|
module.factoryMeta = {};
|
42
46
|
}
|
43
|
-
|
47
|
+
/** @type {FactoryMeta} */
|
48
|
+
(module.factoryMeta).sideEffectFree = false;
|
44
49
|
}
|
45
50
|
});
|
46
51
|
});
|
@@ -332,7 +332,9 @@ class FlagDependencyUsagePlugin {
|
|
332
332
|
}
|
333
333
|
|
334
334
|
while (queue.length) {
|
335
|
-
const [module, runtime] =
|
335
|
+
const [module, runtime] = /** @type {[Module, RuntimeSpec]} */ (
|
336
|
+
queue.dequeue()
|
337
|
+
);
|
336
338
|
processModule(module, runtime, false);
|
337
339
|
}
|
338
340
|
logger.timeEnd("trace exports usage in graph");
|
@@ -12,6 +12,10 @@ const { getEntryRuntime } = require("./util/runtime");
|
|
12
12
|
const PLUGIN_NAME = "FlagEntryExportAsUsedPlugin";
|
13
13
|
|
14
14
|
class FlagEntryExportAsUsedPlugin {
|
15
|
+
/**
|
16
|
+
* @param {boolean} nsObjectUsed true, if the ns object is used
|
17
|
+
* @param {string} explanation explanation for the reason
|
18
|
+
*/
|
15
19
|
constructor(nsObjectUsed, explanation) {
|
16
20
|
this.nsObjectUsed = nsObjectUsed;
|
17
21
|
this.explanation = explanation;
|