webpack 5.100.2 → 5.101.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -10
- package/bin/webpack.js +7 -7
- package/lib/APIPlugin.js +12 -14
- package/lib/AutomaticPrefetchPlugin.js +2 -2
- package/lib/BannerPlugin.js +4 -4
- package/lib/Cache.js +1 -1
- package/lib/CacheFacade.js +7 -7
- package/lib/CaseSensitiveModulesWarning.js +2 -2
- package/lib/Chunk.js +3 -3
- package/lib/ChunkGraph.js +21 -18
- package/lib/ChunkGroup.js +4 -4
- package/lib/CleanPlugin.js +19 -53
- package/lib/CodeGenerationResults.js +3 -3
- package/lib/CompatibilityPlugin.js +6 -6
- package/lib/Compilation.js +126 -113
- package/lib/Compiler.js +37 -37
- package/lib/ConcatenationScope.js +39 -1
- package/lib/ConstPlugin.js +11 -11
- package/lib/ContextExclusionPlugin.js +3 -3
- package/lib/ContextModule.js +12 -11
- package/lib/ContextModuleFactory.js +11 -11
- package/lib/ContextReplacementPlugin.js +5 -5
- package/lib/DefinePlugin.js +24 -22
- package/lib/DelegatedModuleFactoryPlugin.js +1 -1
- package/lib/DllEntryPlugin.js +1 -1
- package/lib/DllReferencePlugin.js +1 -1
- package/lib/DynamicEntryPlugin.js +3 -3
- package/lib/EntryPlugin.js +1 -1
- package/lib/EnvironmentPlugin.js +1 -1
- package/lib/ErrorHelpers.js +2 -2
- package/lib/EvalDevToolModulePlugin.js +2 -2
- package/lib/EvalSourceMapDevToolPlugin.js +5 -5
- package/lib/ExportsInfo.js +9 -9
- package/lib/ExportsInfoApiPlugin.js +2 -2
- package/lib/ExternalModule.js +163 -48
- package/lib/ExternalModuleFactoryPlugin.js +2 -2
- package/lib/ExternalsPlugin.js +45 -0
- package/lib/FileSystemInfo.js +64 -61
- package/lib/FlagAllModulesAsUsedPlugin.js +2 -2
- package/lib/FlagDependencyExportsPlugin.js +7 -7
- package/lib/FlagDependencyUsagePlugin.js +4 -4
- package/lib/FlagEntryExportAsUsedPlugin.js +1 -1
- package/lib/HotModuleReplacementPlugin.js +27 -27
- package/lib/IgnorePlugin.js +3 -3
- package/lib/IgnoreWarningsPlugin.js +4 -4
- package/lib/InitFragment.js +6 -0
- package/lib/InvalidDependenciesModuleWarning.js +1 -1
- package/lib/JavascriptMetaInfoPlugin.js +1 -1
- package/lib/LibManifestPlugin.js +2 -2
- package/lib/LoaderOptionsPlugin.js +1 -1
- package/lib/LoaderTargetPlugin.js +2 -2
- package/lib/MainTemplate.js +1 -1
- package/lib/Module.js +1 -1
- package/lib/ModuleFilenameHelpers.js +3 -3
- package/lib/ModuleGraph.js +9 -5
- package/lib/ModuleInfoHeaderPlugin.js +3 -3
- package/lib/ModuleParseError.js +5 -3
- package/lib/MultiCompiler.js +29 -24
- package/lib/MultiStats.js +18 -13
- package/lib/MultiWatching.js +1 -1
- package/lib/NoEmitOnErrorsPlugin.js +2 -2
- package/lib/NodeStuffPlugin.js +27 -15
- package/lib/NormalModule.js +23 -23
- package/lib/NormalModuleFactory.js +23 -21
- package/lib/NormalModuleReplacementPlugin.js +3 -3
- package/lib/PrefetchPlugin.js +1 -1
- package/lib/ProgressPlugin.js +11 -11
- package/lib/ProvidePlugin.js +2 -2
- package/lib/RecordIdsPlugin.js +3 -3
- package/lib/ResolverFactory.js +3 -3
- package/lib/RuntimeGlobals.js +20 -0
- package/lib/RuntimePlugin.js +16 -16
- package/lib/RuntimeTemplate.js +35 -26
- package/lib/SizeFormatHelpers.js +1 -1
- package/lib/SourceMapDevToolModuleOptionsPlugin.js +4 -4
- package/lib/SourceMapDevToolPlugin.js +9 -9
- package/lib/Stats.js +2 -2
- package/lib/Template.js +1 -1
- package/lib/TemplatedPathPlugin.js +2 -2
- package/lib/UseStrictPlugin.js +1 -1
- package/lib/WarnCaseSensitiveModulesPlugin.js +1 -1
- package/lib/WarnDeprecatedOptionPlugin.js +1 -1
- package/lib/WarnNoModeSetPlugin.js +1 -1
- package/lib/WatchIgnorePlugin.js +2 -2
- package/lib/Watching.js +12 -12
- package/lib/WebpackIsIncludedPlugin.js +2 -2
- package/lib/WebpackOptionsApply.js +3 -3
- package/lib/asset/AssetGenerator.js +1 -1
- package/lib/asset/AssetModulesPlugin.js +6 -6
- package/lib/async-modules/AsyncModuleHelpers.js +1 -1
- package/lib/async-modules/AwaitDependenciesInitFragment.js +36 -24
- package/lib/async-modules/InferAsyncModulesPlugin.js +3 -3
- package/lib/buildChunkGraph.js +5 -5
- package/lib/cache/AddBuildDependenciesPlugin.js +1 -1
- package/lib/cache/IdleFileCachePlugin.js +5 -5
- package/lib/cache/PackFileCacheStrategy.js +20 -20
- package/lib/cache/ResolverCachePlugin.js +4 -4
- package/lib/cli.js +196 -14
- package/lib/config/browserslistTargetHandler.js +6 -6
- package/lib/config/defaults.js +23 -14
- package/lib/config/normalization.js +41 -38
- package/lib/config/target.js +4 -4
- package/lib/container/ContainerEntryModule.js +3 -3
- package/lib/container/ContainerPlugin.js +3 -3
- package/lib/container/ContainerReferencePlugin.js +3 -3
- package/lib/container/FallbackModule.js +1 -1
- package/lib/container/HoistContainerReferencesPlugin.js +7 -7
- package/lib/container/options.js +4 -4
- package/lib/css/CssGenerator.js +5 -3
- package/lib/css/CssLoadingRuntimeModule.js +1 -1
- package/lib/css/CssModulesPlugin.js +25 -22
- package/lib/css/CssParser.js +5 -5
- package/lib/css/walkCssTokens.js +9 -9
- package/lib/debug/ProfilingPlugin.js +5 -5
- package/lib/dependencies/AMDDefineDependencyParserPlugin.js +4 -4
- package/lib/dependencies/AMDPlugin.js +3 -3
- package/lib/dependencies/AMDRequireArrayDependency.js +1 -1
- package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +3 -3
- package/lib/dependencies/CommonJsExportRequireDependency.js +2 -2
- package/lib/dependencies/CommonJsExportsParserPlugin.js +12 -10
- package/lib/dependencies/CommonJsImportsParserPlugin.js +21 -19
- package/lib/dependencies/CommonJsPlugin.js +2 -2
- package/lib/dependencies/ContextDependency.js +1 -1
- package/lib/dependencies/ContextDependencyHelpers.js +3 -3
- package/lib/dependencies/CssIcssExportDependency.js +2 -2
- package/lib/dependencies/CssLocalIdentifierDependency.js +2 -2
- package/lib/dependencies/CssUrlDependency.js +4 -4
- package/lib/dependencies/DynamicExports.js +5 -5
- package/lib/dependencies/HarmonyAcceptDependency.js +39 -5
- package/lib/dependencies/HarmonyDetectionParserPlugin.js +2 -2
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +17 -13
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +7 -8
- package/lib/dependencies/HarmonyExportInitFragment.js +1 -1
- package/lib/dependencies/HarmonyExports.js +1 -1
- package/lib/dependencies/HarmonyImportDependency.js +28 -9
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +56 -48
- package/lib/dependencies/HarmonyImportSideEffectDependency.js +4 -5
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +3 -4
- package/lib/dependencies/HarmonyModulesPlugin.js +2 -8
- package/lib/dependencies/HarmonyTopLevelThisParserPlugin.js +1 -1
- package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +4 -4
- package/lib/dependencies/ImportMetaPlugin.js +7 -7
- package/lib/dependencies/ImportParserPlugin.js +4 -4
- package/lib/dependencies/JsonExportsDependency.js +1 -1
- package/lib/dependencies/LoaderPlugin.js +4 -4
- package/lib/dependencies/ProvidedDependency.js +2 -2
- package/lib/dependencies/PureExpressionDependency.js +1 -1
- package/lib/dependencies/RequireContextDependencyParserPlugin.js +1 -1
- package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +1 -1
- package/lib/dependencies/RequireIncludeDependencyParserPlugin.js +3 -3
- package/lib/dependencies/SystemPlugin.js +3 -3
- package/lib/dependencies/WorkerPlugin.js +5 -5
- package/lib/dependencies/getFunctionExpression.js +1 -1
- package/lib/esm/ModuleChunkFormatPlugin.js +5 -5
- package/lib/esm/ModuleChunkLoadingPlugin.js +2 -2
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +15 -11
- package/lib/formatLocation.js +2 -2
- package/lib/hmr/HotModuleReplacement.runtime.js +39 -27
- package/lib/hmr/JavascriptHotModuleReplacement.runtime.js +43 -32
- package/lib/hmr/JavascriptHotModuleReplacementHelper.js +1 -1
- package/lib/hmr/LazyCompilationPlugin.js +6 -6
- package/lib/hmr/lazyCompilationBackend.js +6 -6
- package/lib/ids/ChunkModuleIdRangePlugin.js +4 -4
- package/lib/ids/DeterministicChunkIdsPlugin.js +5 -4
- package/lib/ids/DeterministicModuleIdsPlugin.js +2 -2
- package/lib/ids/HashedModuleIdsPlugin.js +1 -1
- package/lib/ids/IdHelpers.js +9 -9
- package/lib/ids/NamedChunkIdsPlugin.js +5 -5
- package/lib/ids/NamedModuleIdsPlugin.js +2 -2
- package/lib/ids/NaturalChunkIdsPlugin.js +2 -2
- package/lib/ids/NaturalModuleIdsPlugin.js +1 -1
- package/lib/ids/OccurrenceChunkIdsPlugin.js +2 -2
- package/lib/ids/OccurrenceModuleIdsPlugin.js +4 -4
- package/lib/ids/SyncModuleIdsPlugin.js +4 -4
- package/lib/index.js +10 -6
- package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +1 -1
- package/lib/javascript/BasicEvaluatedExpression.js +3 -3
- package/lib/javascript/CommonJsChunkFormatPlugin.js +1 -1
- package/lib/javascript/EnableChunkLoadingPlugin.js +1 -1
- package/lib/javascript/JavascriptGenerator.js +1 -1
- package/lib/javascript/JavascriptModulesPlugin.js +16 -16
- package/lib/javascript/JavascriptParser.js +80 -78
- package/lib/javascript/JavascriptParserHelpers.js +3 -3
- package/lib/javascript/StartupHelpers.js +2 -2
- package/lib/json/JsonGenerator.js +2 -2
- package/lib/json/JsonModulesPlugin.js +2 -2
- package/lib/library/AbstractLibraryPlugin.js +3 -3
- package/lib/library/AmdLibraryPlugin.js +3 -3
- package/lib/library/AssignLibraryPlugin.js +2 -2
- package/lib/library/EnableLibraryPlugin.js +2 -2
- package/lib/library/ModuleLibraryPlugin.js +7 -2
- package/lib/library/SystemLibraryPlugin.js +6 -4
- package/lib/library/UmdLibraryPlugin.js +14 -14
- package/lib/logging/createConsoleLogger.js +4 -4
- package/lib/logging/runtime.js +3 -3
- package/lib/logging/truncateArgs.js +4 -4
- package/lib/node/CommonJsChunkLoadingPlugin.js +2 -2
- package/lib/node/NodeEnvironmentPlugin.js +1 -1
- package/lib/node/ReadFileChunkLoadingRuntimeModule.js +16 -14
- package/lib/node/ReadFileCompileAsyncWasmPlugin.js +7 -7
- package/lib/node/ReadFileCompileWasmPlugin.js +7 -7
- package/lib/node/RequireChunkLoadingRuntimeModule.js +6 -4
- package/lib/node/nodeConsole.js +2 -2
- package/lib/optimize/AggressiveMergingPlugin.js +2 -2
- package/lib/optimize/AggressiveSplittingPlugin.js +10 -10
- package/lib/optimize/ConcatenatedModule.js +161 -52
- package/lib/optimize/EnsureChunkConditionsPlugin.js +2 -2
- package/lib/optimize/FlagIncludedChunksPlugin.js +2 -2
- package/lib/optimize/InnerGraph.js +5 -5
- package/lib/optimize/InnerGraphPlugin.js +14 -12
- package/lib/optimize/LimitChunkCountPlugin.js +5 -5
- package/lib/optimize/MangleExportsPlugin.js +5 -5
- package/lib/optimize/MergeDuplicateChunksPlugin.js +2 -2
- package/lib/optimize/MinChunkSizePlugin.js +3 -3
- package/lib/optimize/ModuleConcatenationPlugin.js +45 -38
- package/lib/optimize/RealContentHashPlugin.js +23 -23
- package/lib/optimize/RemoveEmptyChunksPlugin.js +2 -2
- package/lib/optimize/RemoveParentModulesPlugin.js +3 -3
- package/lib/optimize/RuntimeChunkPlugin.js +2 -2
- package/lib/optimize/SideEffectsFlagPlugin.js +5 -5
- package/lib/optimize/SplitChunksPlugin.js +20 -20
- package/lib/performance/AssetsOverSizeLimitWarning.js +1 -1
- package/lib/performance/EntrypointsOverSizeLimitWarning.js +2 -2
- package/lib/performance/SizeLimitsPlugin.js +4 -4
- package/lib/prefetch/ChunkPrefetchPreloadPlugin.js +1 -1
- package/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js +3 -3
- package/lib/rules/BasicMatcherRulePlugin.js +1 -1
- package/lib/rules/RuleSetCompiler.js +10 -10
- package/lib/rules/UseEffectRulePlugin.js +2 -2
- package/lib/runtime/GetChunkFilenameRuntimeModule.js +15 -15
- package/lib/runtime/GetMainFilenameRuntimeModule.js +1 -1
- package/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +1 -1
- package/lib/runtime/MakeDeferredNamespaceObjectRuntime.js +1 -1
- package/lib/runtime/StartupChunkDependenciesPlugin.js +2 -2
- package/lib/runtime/StartupChunkDependenciesRuntimeModule.js +3 -3
- package/lib/schemes/DataUriPlugin.js +3 -3
- package/lib/schemes/FileUriPlugin.js +1 -1
- package/lib/schemes/HttpUriPlugin.js +40 -36
- package/lib/schemes/VirtualUrlPlugin.js +1 -1
- package/lib/serialization/BinaryMiddleware.js +11 -11
- package/lib/serialization/FileMiddleware.js +17 -17
- package/lib/serialization/ObjectMiddleware.js +8 -8
- package/lib/serialization/Serializer.js +2 -2
- package/lib/serialization/SerializerMiddleware.js +2 -2
- package/lib/sharing/ConsumeSharedPlugin.js +4 -4
- package/lib/sharing/ProvideSharedPlugin.js +4 -4
- package/lib/sharing/SharePlugin.js +1 -1
- package/lib/sharing/resolveMatchedConfigs.js +1 -1
- package/lib/stats/DefaultStatsFactoryPlugin.js +85 -80
- package/lib/stats/DefaultStatsPresetPlugin.js +15 -15
- package/lib/stats/DefaultStatsPrinterPlugin.js +87 -87
- package/lib/stats/StatsFactory.js +7 -7
- package/lib/stats/StatsPrinter.js +9 -9
- package/lib/url/URLParserPlugin.js +5 -5
- package/lib/util/AsyncQueue.js +4 -4
- package/lib/util/IterableHelpers.js +2 -2
- package/lib/util/LazyBucketSortedSet.js +3 -3
- package/lib/util/SetHelpers.js +2 -2
- package/lib/util/StackedCacheMap.js +1 -1
- package/lib/util/StackedMap.js +1 -1
- package/lib/util/TupleSet.js +1 -1
- package/lib/util/WeakTupleMap.js +1 -1
- package/lib/util/cleverMerge.js +8 -8
- package/lib/util/comparators.js +10 -10
- package/lib/util/compileBooleanMatcher.js +20 -20
- package/lib/util/concatenate.js +3 -3
- package/lib/util/conventions.js +4 -4
- package/lib/util/create-schema-validation.js +1 -1
- package/lib/util/createHash.js +1 -1
- package/lib/util/deprecation.js +4 -4
- package/lib/util/deterministicGrouping.js +7 -7
- package/lib/util/findGraphRoots.js +1 -1
- package/lib/util/fs.js +3 -3
- package/lib/util/identifier.js +14 -14
- package/lib/util/magicComment.js +5 -1
- package/lib/util/memoize.js +1 -1
- package/lib/util/processAsyncTree.js +2 -2
- package/lib/util/propertyName.js +1 -1
- package/lib/util/removeBOM.js +1 -1
- package/lib/util/runtime.js +6 -6
- package/lib/util/semver.js +16 -16
- package/lib/util/serialization.js +5 -5
- package/lib/util/smartGrouping.js +1 -1
- package/lib/validateSchema.js +2 -2
- package/lib/wasm/EnableWasmLoadingPlugin.js +1 -1
- package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +1 -1
- package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +1 -1
- package/lib/wasm-async/UniversalCompileAsyncWasmPlugin.js +4 -4
- package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +13 -9
- package/lib/wasm-sync/WasmFinalizeExportsPlugin.js +2 -2
- package/lib/wasm-sync/WebAssemblyGenerator.js +14 -14
- package/lib/wasm-sync/WebAssemblyInInitialChunkError.js +4 -2
- package/lib/wasm-sync/WebAssemblyParser.js +2 -2
- package/lib/web/FetchCompileAsyncWasmPlugin.js +4 -4
- package/lib/web/FetchCompileWasmPlugin.js +4 -4
- package/lib/web/JsonpChunkLoadingPlugin.js +2 -2
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +1 -1
- package/lib/webpack.js +17 -12
- package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +2 -2
- package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +1 -1
- package/package.json +13 -13
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +4 -0
- package/types.d.ts +151 -44
package/lib/DefinePlugin.js
CHANGED
|
@@ -130,7 +130,7 @@ class RuntimeValue {
|
|
|
130
130
|
*/
|
|
131
131
|
function getObjKeys(properties) {
|
|
132
132
|
if (!properties) return;
|
|
133
|
-
return new Set([...properties].map(p => p.id));
|
|
133
|
+
return new Set([...properties].map((p) => p.id));
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
/** @typedef {Set<string> | null} ObjKeys */
|
|
@@ -161,7 +161,7 @@ const stringifyObj = (
|
|
|
161
161
|
const arr = Array.isArray(obj);
|
|
162
162
|
if (arr) {
|
|
163
163
|
code = `[${obj
|
|
164
|
-
.map(code =>
|
|
164
|
+
.map((code) =>
|
|
165
165
|
toCode(
|
|
166
166
|
code,
|
|
167
167
|
parser,
|
|
@@ -176,10 +176,10 @@ const stringifyObj = (
|
|
|
176
176
|
} else {
|
|
177
177
|
let keys = Object.keys(obj);
|
|
178
178
|
if (objKeys) {
|
|
179
|
-
keys = objKeys.size === 0 ? [] : keys.filter(k => objKeys.has(k));
|
|
179
|
+
keys = objKeys.size === 0 ? [] : keys.filter((k) => objKeys.has(k));
|
|
180
180
|
}
|
|
181
181
|
code = `{${keys
|
|
182
|
-
.map(key => {
|
|
182
|
+
.map((key) => {
|
|
183
183
|
const code = obj[key];
|
|
184
184
|
return `${JSON.stringify(key)}:${toCode(
|
|
185
185
|
code,
|
|
@@ -286,7 +286,7 @@ const toCode = (
|
|
|
286
286
|
* @param {CodeValue} code code
|
|
287
287
|
* @returns {string | undefined} result
|
|
288
288
|
*/
|
|
289
|
-
const toCacheVersion = code => {
|
|
289
|
+
const toCacheVersion = (code) => {
|
|
290
290
|
if (code === null) {
|
|
291
291
|
return "null";
|
|
292
292
|
}
|
|
@@ -306,7 +306,7 @@ const toCacheVersion = code => {
|
|
|
306
306
|
return `(${code.toString()})`;
|
|
307
307
|
}
|
|
308
308
|
if (typeof code === "object") {
|
|
309
|
-
const items = Object.keys(code).map(key => ({
|
|
309
|
+
const items = Object.keys(code).map((key) => ({
|
|
310
310
|
key,
|
|
311
311
|
value: toCacheVersion(
|
|
312
312
|
/** @type {Record<string, EXPECTED_ANY>} */
|
|
@@ -390,7 +390,7 @@ class DefinePlugin {
|
|
|
390
390
|
* @param {JavascriptParser} parser Parser
|
|
391
391
|
* @returns {void}
|
|
392
392
|
*/
|
|
393
|
-
const handler = parser => {
|
|
393
|
+
const handler = (parser) => {
|
|
394
394
|
const hooked = new Set();
|
|
395
395
|
const mainValue =
|
|
396
396
|
/** @type {ValueCacheVersion} */
|
|
@@ -408,7 +408,7 @@ class DefinePlugin {
|
|
|
408
408
|
/**
|
|
409
409
|
* @param {string} key key
|
|
410
410
|
*/
|
|
411
|
-
const addValueDependency = key => {
|
|
411
|
+
const addValueDependency = (key) => {
|
|
412
412
|
const buildInfo =
|
|
413
413
|
/** @type {BuildInfo} */
|
|
414
414
|
(parser.state.module.buildInfo);
|
|
@@ -495,7 +495,7 @@ class DefinePlugin {
|
|
|
495
495
|
// why 100? Ensures it runs after object define
|
|
496
496
|
stage: 100
|
|
497
497
|
},
|
|
498
|
-
expr => {
|
|
498
|
+
(expr) => {
|
|
499
499
|
const destructed =
|
|
500
500
|
parser.destructuringAssignmentPropertiesFor(expr);
|
|
501
501
|
if (destructed === undefined) {
|
|
@@ -557,7 +557,7 @@ class DefinePlugin {
|
|
|
557
557
|
});
|
|
558
558
|
parser.hooks.evaluateIdentifier
|
|
559
559
|
.for(key)
|
|
560
|
-
.tap(PLUGIN_NAME, expr => {
|
|
560
|
+
.tap(PLUGIN_NAME, (expr) => {
|
|
561
561
|
/**
|
|
562
562
|
* this is needed in case there is a recursion in the DefinePlugin
|
|
563
563
|
* to prevent an endless recursion
|
|
@@ -584,7 +584,7 @@ class DefinePlugin {
|
|
|
584
584
|
res.setRange(/** @type {Range} */ (expr.range));
|
|
585
585
|
return res;
|
|
586
586
|
});
|
|
587
|
-
parser.hooks.expression.for(key).tap(PLUGIN_NAME, expr => {
|
|
587
|
+
parser.hooks.expression.for(key).tap(PLUGIN_NAME, (expr) => {
|
|
588
588
|
addValueDependency(originalKey);
|
|
589
589
|
let strCode = toCode(
|
|
590
590
|
code,
|
|
@@ -613,7 +613,7 @@ class DefinePlugin {
|
|
|
613
613
|
return toConstantDependency(parser, strCode)(expr);
|
|
614
614
|
});
|
|
615
615
|
}
|
|
616
|
-
parser.hooks.evaluateTypeof.for(key).tap(PLUGIN_NAME, expr => {
|
|
616
|
+
parser.hooks.evaluateTypeof.for(key).tap(PLUGIN_NAME, (expr) => {
|
|
617
617
|
/**
|
|
618
618
|
* this is needed in case there is a recursion in the DefinePlugin
|
|
619
619
|
* to prevent an endless recursion
|
|
@@ -640,7 +640,7 @@ class DefinePlugin {
|
|
|
640
640
|
res.setRange(/** @type {Range} */ (expr.range));
|
|
641
641
|
return res;
|
|
642
642
|
});
|
|
643
|
-
parser.hooks.typeof.for(key).tap(PLUGIN_NAME, expr => {
|
|
643
|
+
parser.hooks.typeof.for(key).tap(PLUGIN_NAME, (expr) => {
|
|
644
644
|
addValueDependency(originalKey);
|
|
645
645
|
const codeCode = toCode(
|
|
646
646
|
code,
|
|
@@ -672,20 +672,22 @@ class DefinePlugin {
|
|
|
672
672
|
addValueDependency(key);
|
|
673
673
|
return true;
|
|
674
674
|
});
|
|
675
|
-
parser.hooks.evaluateIdentifier
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
675
|
+
parser.hooks.evaluateIdentifier
|
|
676
|
+
.for(key)
|
|
677
|
+
.tap(PLUGIN_NAME, (expr) => {
|
|
678
|
+
addValueDependency(key);
|
|
679
|
+
return new BasicEvaluatedExpression()
|
|
680
|
+
.setTruthy()
|
|
681
|
+
.setSideEffects(false)
|
|
682
|
+
.setRange(/** @type {Range} */ (expr.range));
|
|
683
|
+
});
|
|
682
684
|
parser.hooks.evaluateTypeof
|
|
683
685
|
.for(key)
|
|
684
686
|
.tap(
|
|
685
687
|
PLUGIN_NAME,
|
|
686
688
|
withValueDependency(key, evaluateToString("object"))
|
|
687
689
|
);
|
|
688
|
-
parser.hooks.expression.for(key).tap(PLUGIN_NAME, expr => {
|
|
690
|
+
parser.hooks.expression.for(key).tap(PLUGIN_NAME, (expr) => {
|
|
689
691
|
addValueDependency(key);
|
|
690
692
|
let strCode = stringifyObj(
|
|
691
693
|
obj,
|
|
@@ -778,7 +780,7 @@ class DefinePlugin {
|
|
|
778
780
|
* @param {Record<string, CodeValue>} definitions Definitions map
|
|
779
781
|
* @returns {void}
|
|
780
782
|
*/
|
|
781
|
-
const walkDefinitionsForKeys = definitions => {
|
|
783
|
+
const walkDefinitionsForKeys = (definitions) => {
|
|
782
784
|
/**
|
|
783
785
|
* @param {Map<string, Set<string>>} map Map
|
|
784
786
|
* @param {string} key key
|
|
@@ -92,7 +92,7 @@ class DelegatedModuleFactoryPlugin {
|
|
|
92
92
|
}
|
|
93
93
|
);
|
|
94
94
|
} else {
|
|
95
|
-
normalModuleFactory.hooks.module.tap(PLUGIN_NAME, module => {
|
|
95
|
+
normalModuleFactory.hooks.module.tap(PLUGIN_NAME, (module) => {
|
|
96
96
|
const request = module.libIdent(this.options);
|
|
97
97
|
if (request && request in this.options.content) {
|
|
98
98
|
const resolved = this.options.content[request];
|
package/lib/DllEntryPlugin.js
CHANGED
|
@@ -102,7 +102,7 @@ class DllReferencePlugin {
|
|
|
102
102
|
return callback();
|
|
103
103
|
});
|
|
104
104
|
|
|
105
|
-
compiler.hooks.compile.tap(PLUGIN_NAME, params => {
|
|
105
|
+
compiler.hooks.compile.tap(PLUGIN_NAME, (params) => {
|
|
106
106
|
let name = this.options.name;
|
|
107
107
|
let sourceType = this.options.sourceType;
|
|
108
108
|
let resolvedContent =
|
|
@@ -43,9 +43,9 @@ class DynamicEntryPlugin {
|
|
|
43
43
|
}
|
|
44
44
|
);
|
|
45
45
|
|
|
46
|
-
compiler.hooks.make.tapPromise(PLUGIN_NAME, compilation =>
|
|
46
|
+
compiler.hooks.make.tapPromise(PLUGIN_NAME, (compilation) =>
|
|
47
47
|
Promise.resolve(this.entry())
|
|
48
|
-
.then(entry => {
|
|
48
|
+
.then((entry) => {
|
|
49
49
|
const promises = [];
|
|
50
50
|
for (const name of Object.keys(entry)) {
|
|
51
51
|
const desc = entry[name];
|
|
@@ -68,7 +68,7 @@ class DynamicEntryPlugin {
|
|
|
68
68
|
this.context,
|
|
69
69
|
EntryPlugin.createDependency(entry, options),
|
|
70
70
|
options,
|
|
71
|
-
err => {
|
|
71
|
+
(err) => {
|
|
72
72
|
if (err) return reject(err);
|
|
73
73
|
resolve();
|
|
74
74
|
}
|
package/lib/EntryPlugin.js
CHANGED
|
@@ -45,7 +45,7 @@ class EntryPlugin {
|
|
|
45
45
|
const dep = EntryPlugin.createDependency(entry, options);
|
|
46
46
|
|
|
47
47
|
compiler.hooks.make.tapAsync(PLUGIN_NAME, (compilation, callback) => {
|
|
48
|
-
compilation.addEntry(context, dep, options, err => {
|
|
48
|
+
compilation.addEntry(context, dep, options, (err) => {
|
|
49
49
|
callback(err);
|
|
50
50
|
});
|
|
51
51
|
});
|
package/lib/EnvironmentPlugin.js
CHANGED
|
@@ -48,7 +48,7 @@ class EnvironmentPlugin {
|
|
|
48
48
|
: this.defaultValues[key];
|
|
49
49
|
|
|
50
50
|
if (value === undefined) {
|
|
51
|
-
compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => {
|
|
51
|
+
compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
|
|
52
52
|
const error = new WebpackError(
|
|
53
53
|
`${PLUGIN_NAME} - ${key} environment variable is undefined.\n\n` +
|
|
54
54
|
"You can pass an object with default values to suppress this warning.\n" +
|
package/lib/ErrorHelpers.js
CHANGED
|
@@ -28,13 +28,13 @@ const cutOffByFlag = (stack, flag) => {
|
|
|
28
28
|
* @param {string} stack stack trace
|
|
29
29
|
* @returns {string} stack trace without the loader execution flag included
|
|
30
30
|
*/
|
|
31
|
-
const cutOffLoaderExecution = stack => cutOffByFlag(stack, loaderFlag);
|
|
31
|
+
const cutOffLoaderExecution = (stack) => cutOffByFlag(stack, loaderFlag);
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* @param {string} stack stack trace
|
|
35
35
|
* @returns {string} stack trace without the webpack options flag included
|
|
36
36
|
*/
|
|
37
|
-
const cutOffWebpackOptions = stack => cutOffByFlag(stack, webpackOptionsFlag);
|
|
37
|
+
const cutOffWebpackOptions = (stack) => cutOffByFlag(stack, webpackOptionsFlag);
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
40
|
* @param {string} stack stack trace
|
|
@@ -55,7 +55,7 @@ class EvalDevToolModulePlugin {
|
|
|
55
55
|
* @returns {void}
|
|
56
56
|
*/
|
|
57
57
|
apply(compiler) {
|
|
58
|
-
compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
|
|
58
|
+
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
|
|
59
59
|
const hooks = JavascriptModulesPlugin.getCompilationHooks(compilation);
|
|
60
60
|
hooks.renderModuleContent.tap(
|
|
61
61
|
PLUGIN_NAME,
|
|
@@ -110,7 +110,7 @@ class EvalDevToolModulePlugin {
|
|
|
110
110
|
);
|
|
111
111
|
hooks.render.tap(
|
|
112
112
|
PLUGIN_NAME,
|
|
113
|
-
source => new ConcatSource(devtoolWarning, source)
|
|
113
|
+
(source) => new ConcatSource(devtoolWarning, source)
|
|
114
114
|
);
|
|
115
115
|
hooks.chunkHash.tap(PLUGIN_NAME, (chunk, hash) => {
|
|
116
116
|
hash.update(PLUGIN_NAME);
|
|
@@ -69,7 +69,7 @@ class EvalSourceMapDevToolPlugin {
|
|
|
69
69
|
*/
|
|
70
70
|
apply(compiler) {
|
|
71
71
|
const options = this.options;
|
|
72
|
-
compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
|
|
72
|
+
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
|
|
73
73
|
const hooks = JavascriptModulesPlugin.getCompilationHooks(compilation);
|
|
74
74
|
new SourceMapDevToolModuleOptionsPlugin(options).apply(compilation);
|
|
75
75
|
const matchModule = ModuleFilenameHelpers.matchObject.bind(
|
|
@@ -88,7 +88,7 @@ class EvalSourceMapDevToolPlugin {
|
|
|
88
88
|
* @param {Source} r result
|
|
89
89
|
* @returns {Source} result
|
|
90
90
|
*/
|
|
91
|
-
const result = r => {
|
|
91
|
+
const result = (r) => {
|
|
92
92
|
cache.set(source, r);
|
|
93
93
|
return r;
|
|
94
94
|
};
|
|
@@ -136,13 +136,13 @@ class EvalSourceMapDevToolPlugin {
|
|
|
136
136
|
sourceMap = { ...sourceMap };
|
|
137
137
|
const context = /** @type {string} */ (compiler.options.context);
|
|
138
138
|
const root = compiler.root;
|
|
139
|
-
const modules = sourceMap.sources.map(source => {
|
|
139
|
+
const modules = sourceMap.sources.map((source) => {
|
|
140
140
|
if (!source.startsWith("webpack://")) return source;
|
|
141
141
|
source = makePathsAbsolute(context, source.slice(10), root);
|
|
142
142
|
const module = compilation.findModule(source);
|
|
143
143
|
return module || source;
|
|
144
144
|
});
|
|
145
|
-
let moduleFilenames = modules.map(module =>
|
|
145
|
+
let moduleFilenames = modules.map((module) =>
|
|
146
146
|
ModuleFilenameHelpers.createFilename(
|
|
147
147
|
module,
|
|
148
148
|
{
|
|
@@ -205,7 +205,7 @@ class EvalSourceMapDevToolPlugin {
|
|
|
205
205
|
);
|
|
206
206
|
hooks.render.tap(
|
|
207
207
|
PLUGIN_NAME,
|
|
208
|
-
source => new ConcatSource(devtoolWarning, source)
|
|
208
|
+
(source) => new ConcatSource(devtoolWarning, source)
|
|
209
209
|
);
|
|
210
210
|
hooks.chunkHash.tap(PLUGIN_NAME, (chunk, hash) => {
|
|
211
211
|
hash.update(PLUGIN_NAME);
|
package/lib/ExportsInfo.js
CHANGED
|
@@ -142,7 +142,7 @@ class ExportsInfo {
|
|
|
142
142
|
if (this._redirectTo !== undefined) {
|
|
143
143
|
/** @type {Exports} */
|
|
144
144
|
const map = new Map(
|
|
145
|
-
Array.from(this._redirectTo.orderedExports, item => [item.name, item])
|
|
145
|
+
Array.from(this._redirectTo.orderedExports, (item) => [item.name, item])
|
|
146
146
|
);
|
|
147
147
|
for (const [key, value] of this._exports) {
|
|
148
148
|
map.set(key, value);
|
|
@@ -402,7 +402,7 @@ class ExportsInfo {
|
|
|
402
402
|
} else {
|
|
403
403
|
if (
|
|
404
404
|
this._otherExportsInfo.setUsedConditionally(
|
|
405
|
-
used => used < UsageState.Unknown,
|
|
405
|
+
(used) => used < UsageState.Unknown,
|
|
406
406
|
UsageState.Unknown,
|
|
407
407
|
runtime
|
|
408
408
|
)
|
|
@@ -465,7 +465,7 @@ class ExportsInfo {
|
|
|
465
465
|
*/
|
|
466
466
|
setUsedForSideEffectsOnly(runtime) {
|
|
467
467
|
return this._sideEffectsOnlyInfo.setUsedConditionally(
|
|
468
|
-
used => used === UsageState.Unused,
|
|
468
|
+
(used) => used === UsageState.Unused,
|
|
469
469
|
UsageState.Used,
|
|
470
470
|
runtime
|
|
471
471
|
);
|
|
@@ -988,7 +988,7 @@ class ExportInfo {
|
|
|
988
988
|
let changed = false;
|
|
989
989
|
if (
|
|
990
990
|
this.setUsedConditionally(
|
|
991
|
-
used => used < UsageState.Unknown,
|
|
991
|
+
(used) => used < UsageState.Unknown,
|
|
992
992
|
UsageState.Unknown,
|
|
993
993
|
runtime
|
|
994
994
|
)
|
|
@@ -1050,7 +1050,7 @@ class ExportInfo {
|
|
|
1050
1050
|
} else if (this._usedInRuntime === undefined) {
|
|
1051
1051
|
if (newValue !== UsageState.Unused && condition(UsageState.Unused)) {
|
|
1052
1052
|
this._usedInRuntime = new Map();
|
|
1053
|
-
forEachRuntime(runtime, runtime =>
|
|
1053
|
+
forEachRuntime(runtime, (runtime) =>
|
|
1054
1054
|
/** @type {UsedInRuntime} */
|
|
1055
1055
|
(this._usedInRuntime).set(/** @type {string} */ (runtime), newValue)
|
|
1056
1056
|
);
|
|
@@ -1058,7 +1058,7 @@ class ExportInfo {
|
|
|
1058
1058
|
}
|
|
1059
1059
|
} else {
|
|
1060
1060
|
let changed = false;
|
|
1061
|
-
forEachRuntime(runtime, _runtime => {
|
|
1061
|
+
forEachRuntime(runtime, (_runtime) => {
|
|
1062
1062
|
const runtime = /** @type {string} */ (_runtime);
|
|
1063
1063
|
const usedInRuntime =
|
|
1064
1064
|
/** @type {UsedInRuntime} */
|
|
@@ -1098,7 +1098,7 @@ class ExportInfo {
|
|
|
1098
1098
|
} else if (this._usedInRuntime === undefined) {
|
|
1099
1099
|
if (newValue !== UsageState.Unused) {
|
|
1100
1100
|
this._usedInRuntime = new Map();
|
|
1101
|
-
forEachRuntime(runtime, runtime =>
|
|
1101
|
+
forEachRuntime(runtime, (runtime) =>
|
|
1102
1102
|
/** @type {UsedInRuntime} */
|
|
1103
1103
|
(this._usedInRuntime).set(/** @type {string} */ (runtime), newValue)
|
|
1104
1104
|
);
|
|
@@ -1106,7 +1106,7 @@ class ExportInfo {
|
|
|
1106
1106
|
}
|
|
1107
1107
|
} else {
|
|
1108
1108
|
let changed = false;
|
|
1109
|
-
forEachRuntime(runtime, _runtime => {
|
|
1109
|
+
forEachRuntime(runtime, (_runtime) => {
|
|
1110
1110
|
const runtime = /** @type {string} */ (_runtime);
|
|
1111
1111
|
const usedInRuntime =
|
|
1112
1112
|
/** @type {UsedInRuntime} */
|
|
@@ -1247,7 +1247,7 @@ class ExportInfo {
|
|
|
1247
1247
|
} else if (
|
|
1248
1248
|
runtime !== undefined &&
|
|
1249
1249
|
[...runtime].every(
|
|
1250
|
-
runtime =>
|
|
1250
|
+
(runtime) =>
|
|
1251
1251
|
!(/** @type {UsedInRuntime} */ (this._usedInRuntime).has(runtime))
|
|
1252
1252
|
)
|
|
1253
1253
|
) {
|
|
@@ -38,7 +38,7 @@ class ExportsInfoApiPlugin {
|
|
|
38
38
|
* @param {JavascriptParser} parser the parser
|
|
39
39
|
* @returns {void}
|
|
40
40
|
*/
|
|
41
|
-
const handler = parser => {
|
|
41
|
+
const handler = (parser) => {
|
|
42
42
|
parser.hooks.expressionMemberChain
|
|
43
43
|
.for("__webpack_exports_info__")
|
|
44
44
|
.tap(PLUGIN_NAME, (expr, members) => {
|
|
@@ -60,7 +60,7 @@ class ExportsInfoApiPlugin {
|
|
|
60
60
|
});
|
|
61
61
|
parser.hooks.expression
|
|
62
62
|
.for("__webpack_exports_info__")
|
|
63
|
-
.tap(PLUGIN_NAME, expr => {
|
|
63
|
+
.tap(PLUGIN_NAME, (expr) => {
|
|
64
64
|
const dep = new ConstDependency(
|
|
65
65
|
"true",
|
|
66
66
|
/** @type {Range} */ (expr.range)
|