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/MultiCompiler.js
CHANGED
|
@@ -16,6 +16,7 @@ const ArrayQueue = require("./util/ArrayQueue");
|
|
|
16
16
|
|
|
17
17
|
/** @template T @typedef {import("tapable").AsyncSeriesHook<T>} AsyncSeriesHook<T> */
|
|
18
18
|
/** @template T @template R @typedef {import("tapable").SyncBailHook<T, R>} SyncBailHook<T, R> */
|
|
19
|
+
/** @typedef {import("../declarations/WebpackOptions").WebpackOptions} WebpackOptions */
|
|
19
20
|
/** @typedef {import("../declarations/WebpackOptions").WatchOptions} WatchOptions */
|
|
20
21
|
/** @typedef {import("./Compiler")} Compiler */
|
|
21
22
|
/** @typedef {import("./Stats")} Stats */
|
|
@@ -44,6 +45,8 @@ const ArrayQueue = require("./util/ArrayQueue");
|
|
|
44
45
|
* @property {number=} parallelism how many Compilers are allows to run at the same time in parallel
|
|
45
46
|
*/
|
|
46
47
|
|
|
48
|
+
/** @typedef {ReadonlyArray<WebpackOptions> & MultiCompilerOptions} MultiWebpackOptions */
|
|
49
|
+
|
|
47
50
|
const CLASS_NAME = "MultiCompiler";
|
|
48
51
|
|
|
49
52
|
module.exports = class MultiCompiler {
|
|
@@ -54,7 +57,7 @@ module.exports = class MultiCompiler {
|
|
|
54
57
|
constructor(compilers, options) {
|
|
55
58
|
if (!Array.isArray(compilers)) {
|
|
56
59
|
/** @type {Compiler[]} */
|
|
57
|
-
compilers = Object.keys(compilers).map(name => {
|
|
60
|
+
compilers = Object.keys(compilers).map((name) => {
|
|
58
61
|
/** @type {Record<string, Compiler>} */
|
|
59
62
|
(compilers)[name].name = name;
|
|
60
63
|
return /** @type {Record<string, Compiler>} */ (compilers)[name];
|
|
@@ -65,16 +68,16 @@ module.exports = class MultiCompiler {
|
|
|
65
68
|
/** @type {SyncHook<[MultiStats]>} */
|
|
66
69
|
done: new SyncHook(["stats"]),
|
|
67
70
|
/** @type {MultiHook<SyncHook<[string | null, number]>>} */
|
|
68
|
-
invalid: new MultiHook(compilers.map(c => c.hooks.invalid)),
|
|
71
|
+
invalid: new MultiHook(compilers.map((c) => c.hooks.invalid)),
|
|
69
72
|
/** @type {MultiHook<AsyncSeriesHook<[Compiler]>>} */
|
|
70
|
-
run: new MultiHook(compilers.map(c => c.hooks.run)),
|
|
73
|
+
run: new MultiHook(compilers.map((c) => c.hooks.run)),
|
|
71
74
|
/** @type {SyncHook<[]>} */
|
|
72
75
|
watchClose: new SyncHook([]),
|
|
73
76
|
/** @type {MultiHook<AsyncSeriesHook<[Compiler]>>} */
|
|
74
|
-
watchRun: new MultiHook(compilers.map(c => c.hooks.watchRun)),
|
|
77
|
+
watchRun: new MultiHook(compilers.map((c) => c.hooks.watchRun)),
|
|
75
78
|
/** @type {MultiHook<SyncBailHook<[string, string, EXPECTED_ANY[] | undefined], true | void>>} */
|
|
76
79
|
infrastructureLog: new MultiHook(
|
|
77
|
-
compilers.map(c => c.hooks.infrastructureLog)
|
|
80
|
+
compilers.map((c) => c.hooks.infrastructureLog)
|
|
78
81
|
)
|
|
79
82
|
});
|
|
80
83
|
this.compilers = compilers;
|
|
@@ -94,7 +97,7 @@ module.exports = class MultiCompiler {
|
|
|
94
97
|
const compilerIndex = index;
|
|
95
98
|
let compilerDone = false;
|
|
96
99
|
// eslint-disable-next-line no-loop-func
|
|
97
|
-
compiler.hooks.done.tap(CLASS_NAME, stats => {
|
|
100
|
+
compiler.hooks.done.tap(CLASS_NAME, (stats) => {
|
|
98
101
|
if (!compilerDone) {
|
|
99
102
|
compilerDone = true;
|
|
100
103
|
doneCompilers++;
|
|
@@ -124,7 +127,7 @@ module.exports = class MultiCompiler {
|
|
|
124
127
|
* @param {WebpackError} warning warning
|
|
125
128
|
*/
|
|
126
129
|
const addWarning = (compiler, warning) => {
|
|
127
|
-
compiler.hooks.thisCompilation.tap(CLASS_NAME, compilation => {
|
|
130
|
+
compiler.hooks.thisCompilation.tap(CLASS_NAME, (compilation) => {
|
|
128
131
|
compilation.warnings.push(warning);
|
|
129
132
|
});
|
|
130
133
|
};
|
|
@@ -152,7 +155,7 @@ module.exports = class MultiCompiler {
|
|
|
152
155
|
|
|
153
156
|
get options() {
|
|
154
157
|
return Object.assign(
|
|
155
|
-
this.compilers.map(c => c.options),
|
|
158
|
+
this.compilers.map((c) => c.options),
|
|
156
159
|
this._options
|
|
157
160
|
);
|
|
158
161
|
}
|
|
@@ -254,7 +257,7 @@ module.exports = class MultiCompiler {
|
|
|
254
257
|
* @param {Compiler} compiler compiler
|
|
255
258
|
* @returns {boolean} target was found
|
|
256
259
|
*/
|
|
257
|
-
const targetFound = compiler => {
|
|
260
|
+
const targetFound = (compiler) => {
|
|
258
261
|
for (const edge of edges) {
|
|
259
262
|
if (edge.target === compiler) {
|
|
260
263
|
return true;
|
|
@@ -276,7 +279,7 @@ module.exports = class MultiCompiler {
|
|
|
276
279
|
const dependencies = this.dependencies.get(source);
|
|
277
280
|
if (dependencies) {
|
|
278
281
|
for (const dep of dependencies) {
|
|
279
|
-
const target = this.compilers.find(c => c.name === dep);
|
|
282
|
+
const target = this.compilers.find((c) => c.name === dep);
|
|
280
283
|
if (!target) {
|
|
281
284
|
missing.push(dep);
|
|
282
285
|
} else {
|
|
@@ -289,8 +292,10 @@ module.exports = class MultiCompiler {
|
|
|
289
292
|
}
|
|
290
293
|
}
|
|
291
294
|
/** @type {string[]} */
|
|
292
|
-
const errors = missing.map(
|
|
293
|
-
|
|
295
|
+
const errors = missing.map(
|
|
296
|
+
(m) => `Compiler dependency \`${m}\` not found.`
|
|
297
|
+
);
|
|
298
|
+
const stack = this.compilers.filter((c) => !targetFound(c));
|
|
294
299
|
while (stack.length > 0) {
|
|
295
300
|
const current = stack.pop();
|
|
296
301
|
for (const edge of edges) {
|
|
@@ -307,7 +312,7 @@ module.exports = class MultiCompiler {
|
|
|
307
312
|
/** @type {string[]} */
|
|
308
313
|
const lines = [...edges]
|
|
309
314
|
.sort(sortEdges)
|
|
310
|
-
.map(edge => `${edge.source.name} -> ${edge.target.name}`);
|
|
315
|
+
.map((edge) => `${edge.source.name} -> ${edge.target.name}`);
|
|
311
316
|
lines.unshift("Circular dependency found in compiler dependencies.");
|
|
312
317
|
errors.unshift(lines.join("\n"));
|
|
313
318
|
}
|
|
@@ -334,7 +339,7 @@ module.exports = class MultiCompiler {
|
|
|
334
339
|
* @param {string} d dependency
|
|
335
340
|
* @returns {boolean} when dependency was fulfilled
|
|
336
341
|
*/
|
|
337
|
-
const isDependencyFulfilled = d => fulfilledNames.has(d);
|
|
342
|
+
const isDependencyFulfilled = (d) => fulfilledNames.has(d);
|
|
338
343
|
/**
|
|
339
344
|
* @returns {Compiler[]} compilers
|
|
340
345
|
*/
|
|
@@ -358,12 +363,12 @@ module.exports = class MultiCompiler {
|
|
|
358
363
|
* @param {Callback<Stats[]>} callback callback
|
|
359
364
|
* @returns {void}
|
|
360
365
|
*/
|
|
361
|
-
const runCompilers = callback => {
|
|
366
|
+
const runCompilers = (callback) => {
|
|
362
367
|
if (remainingCompilers.length === 0) return callback(null);
|
|
363
368
|
asyncLib.map(
|
|
364
369
|
getReadyCompilers(),
|
|
365
370
|
(compiler, callback) => {
|
|
366
|
-
fn(compiler, err => {
|
|
371
|
+
fn(compiler, (err) => {
|
|
367
372
|
if (err) return callback(err);
|
|
368
373
|
fulfilledNames.add(compiler.name);
|
|
369
374
|
runCompilers(callback);
|
|
@@ -400,7 +405,7 @@ module.exports = class MultiCompiler {
|
|
|
400
405
|
// running-outdated -> blocked [running--] (when compilation is done)
|
|
401
406
|
|
|
402
407
|
/** @type {Node[]} */
|
|
403
|
-
const nodes = this.compilers.map(compiler => ({
|
|
408
|
+
const nodes = this.compilers.map((compiler) => ({
|
|
404
409
|
compiler,
|
|
405
410
|
setupResult: undefined,
|
|
406
411
|
result: undefined,
|
|
@@ -472,7 +477,7 @@ module.exports = class MultiCompiler {
|
|
|
472
477
|
* @param {Node} node node
|
|
473
478
|
* @returns {void}
|
|
474
479
|
*/
|
|
475
|
-
const nodeInvalidFromParent = node => {
|
|
480
|
+
const nodeInvalidFromParent = (node) => {
|
|
476
481
|
if (node.state === "done") {
|
|
477
482
|
node.state = "blocked";
|
|
478
483
|
} else if (node.state === "running") {
|
|
@@ -486,7 +491,7 @@ module.exports = class MultiCompiler {
|
|
|
486
491
|
* @param {Node} node node
|
|
487
492
|
* @returns {void}
|
|
488
493
|
*/
|
|
489
|
-
const nodeInvalid = node => {
|
|
494
|
+
const nodeInvalid = (node) => {
|
|
490
495
|
if (node.state === "done") {
|
|
491
496
|
node.state = "pending";
|
|
492
497
|
} else if (node.state === "running") {
|
|
@@ -500,7 +505,7 @@ module.exports = class MultiCompiler {
|
|
|
500
505
|
* @param {Node} node node
|
|
501
506
|
* @returns {void}
|
|
502
507
|
*/
|
|
503
|
-
const nodeChange = node => {
|
|
508
|
+
const nodeChange = (node) => {
|
|
504
509
|
nodeInvalid(node);
|
|
505
510
|
if (node.state === "pending") {
|
|
506
511
|
node.state = "blocked";
|
|
@@ -538,7 +543,7 @@ module.exports = class MultiCompiler {
|
|
|
538
543
|
if (
|
|
539
544
|
node.state === "queued" ||
|
|
540
545
|
(node.state === "blocked" &&
|
|
541
|
-
node.parents.every(p => p.state === "done"))
|
|
546
|
+
node.parents.every((p) => p.state === "done"))
|
|
542
547
|
) {
|
|
543
548
|
running++;
|
|
544
549
|
node.state = "starting";
|
|
@@ -554,7 +559,7 @@ module.exports = class MultiCompiler {
|
|
|
554
559
|
if (
|
|
555
560
|
!errored &&
|
|
556
561
|
running === 0 &&
|
|
557
|
-
nodes.every(node => node.state === "done")
|
|
562
|
+
nodes.every((node) => node.state === "done")
|
|
558
563
|
) {
|
|
559
564
|
const stats = [];
|
|
560
565
|
for (const node of nodes) {
|
|
@@ -574,7 +579,7 @@ module.exports = class MultiCompiler {
|
|
|
574
579
|
}
|
|
575
580
|
|
|
576
581
|
/**
|
|
577
|
-
* @param {WatchOptions|WatchOptions[]} watchOptions the watcher's options
|
|
582
|
+
* @param {WatchOptions | WatchOptions[]} watchOptions the watcher's options
|
|
578
583
|
* @param {Callback<MultiStats>} handler signals when the call finishes
|
|
579
584
|
* @returns {MultiWatching} a compiler watcher
|
|
580
585
|
*/
|
|
@@ -653,7 +658,7 @@ module.exports = class MultiCompiler {
|
|
|
653
658
|
(compiler, callback) => {
|
|
654
659
|
compiler.close(callback);
|
|
655
660
|
},
|
|
656
|
-
error => {
|
|
661
|
+
(error) => {
|
|
657
662
|
callback(error);
|
|
658
663
|
}
|
|
659
664
|
);
|
package/lib/MultiStats.js
CHANGED
|
@@ -25,6 +25,8 @@ const indent = (str, prefix) => {
|
|
|
25
25
|
return prefix + rem;
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
+
/** @typedef {undefined | string | boolean | StatsOptions} ChildrenStatsOptions */
|
|
29
|
+
/** @typedef {Omit<StatsOptions, "children"> & { children?: ChildrenStatsOptions | ChildrenStatsOptions[] }} MultiStatsOptions */
|
|
28
30
|
/** @typedef {{ version: boolean, hash: boolean, errorsCount: boolean, warningsCount: boolean, errors: boolean, warnings: boolean, children: NormalizedStatsOptions[] }} ChildOptions */
|
|
29
31
|
|
|
30
32
|
class MultiStats {
|
|
@@ -36,25 +38,25 @@ class MultiStats {
|
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
get hash() {
|
|
39
|
-
return this.stats.map(stat => stat.hash).join("");
|
|
41
|
+
return this.stats.map((stat) => stat.hash).join("");
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
/**
|
|
43
45
|
* @returns {boolean} true if a child compilation encountered an error
|
|
44
46
|
*/
|
|
45
47
|
hasErrors() {
|
|
46
|
-
return this.stats.some(stat => stat.hasErrors());
|
|
48
|
+
return this.stats.some((stat) => stat.hasErrors());
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
/**
|
|
50
52
|
* @returns {boolean} true if a child compilation had a warning
|
|
51
53
|
*/
|
|
52
54
|
hasWarnings() {
|
|
53
|
-
return this.stats.some(stat => stat.hasWarnings());
|
|
55
|
+
return this.stats.some((stat) => stat.hasWarnings());
|
|
54
56
|
}
|
|
55
57
|
|
|
56
58
|
/**
|
|
57
|
-
* @param {
|
|
59
|
+
* @param {undefined | string | boolean | MultiStatsOptions} options stats options
|
|
58
60
|
* @param {CreateStatsOptionsContext} context context
|
|
59
61
|
* @returns {ChildOptions} context context
|
|
60
62
|
*/
|
|
@@ -80,6 +82,9 @@ class MultiStats {
|
|
|
80
82
|
const childOptions = Array.isArray(childrenOptions)
|
|
81
83
|
? childrenOptions[idx]
|
|
82
84
|
: childrenOptions;
|
|
85
|
+
if (typeof childOptions === "boolean") {
|
|
86
|
+
return stat.compilation.createStatsOptions(childOptions, context);
|
|
87
|
+
}
|
|
83
88
|
return stat.compilation.createStatsOptions(
|
|
84
89
|
{
|
|
85
90
|
...baseOptions,
|
|
@@ -93,18 +98,18 @@ class MultiStats {
|
|
|
93
98
|
);
|
|
94
99
|
});
|
|
95
100
|
return {
|
|
96
|
-
version: children.every(o => o.version),
|
|
97
|
-
hash: children.every(o => o.hash),
|
|
98
|
-
errorsCount: children.every(o => o.errorsCount),
|
|
99
|
-
warningsCount: children.every(o => o.warningsCount),
|
|
100
|
-
errors: children.every(o => o.errors),
|
|
101
|
-
warnings: children.every(o => o.warnings),
|
|
101
|
+
version: children.every((o) => o.version),
|
|
102
|
+
hash: children.every((o) => o.hash),
|
|
103
|
+
errorsCount: children.every((o) => o.errorsCount),
|
|
104
|
+
warningsCount: children.every((o) => o.warningsCount),
|
|
105
|
+
errors: children.every((o) => o.errors),
|
|
106
|
+
warnings: children.every((o) => o.warnings),
|
|
102
107
|
children
|
|
103
108
|
};
|
|
104
109
|
}
|
|
105
110
|
|
|
106
111
|
/**
|
|
107
|
-
* @param {(string | boolean |
|
|
112
|
+
* @param {(string | boolean | MultiStatsOptions)=} options stats options
|
|
108
113
|
* @returns {StatsCompilation} json output
|
|
109
114
|
*/
|
|
110
115
|
toJson(options) {
|
|
@@ -130,7 +135,7 @@ class MultiStats {
|
|
|
130
135
|
obj.version = obj.children[0].version;
|
|
131
136
|
}
|
|
132
137
|
if (childOptions.hash) {
|
|
133
|
-
obj.hash = obj.children.map(j => j.hash).join("");
|
|
138
|
+
obj.hash = obj.children.map((j) => j.hash).join("");
|
|
134
139
|
}
|
|
135
140
|
/**
|
|
136
141
|
* @param {StatsCompilation} j stats error
|
|
@@ -179,7 +184,7 @@ class MultiStats {
|
|
|
179
184
|
}
|
|
180
185
|
|
|
181
186
|
/**
|
|
182
|
-
* @param {(string | boolean |
|
|
187
|
+
* @param {(string | boolean | MultiStatsOptions)=} options stats options
|
|
183
188
|
* @returns {string} string output
|
|
184
189
|
*/
|
|
185
190
|
toString(options) {
|
package/lib/MultiWatching.js
CHANGED
|
@@ -16,10 +16,10 @@ class NoEmitOnErrorsPlugin {
|
|
|
16
16
|
* @returns {void}
|
|
17
17
|
*/
|
|
18
18
|
apply(compiler) {
|
|
19
|
-
compiler.hooks.shouldEmit.tap(PLUGIN_NAME, compilation => {
|
|
19
|
+
compiler.hooks.shouldEmit.tap(PLUGIN_NAME, (compilation) => {
|
|
20
20
|
if (compilation.getStats().hasErrors()) return false;
|
|
21
21
|
});
|
|
22
|
-
compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
|
|
22
|
+
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
|
|
23
23
|
compilation.hooks.shouldRecord.tap(PLUGIN_NAME, () => {
|
|
24
24
|
if (compilation.getStats().hasErrors()) return false;
|
|
25
25
|
});
|
package/lib/NodeStuffPlugin.js
CHANGED
|
@@ -74,7 +74,7 @@ class NodeStuffPlugin {
|
|
|
74
74
|
|
|
75
75
|
if (localOptions.global !== false) {
|
|
76
76
|
const withWarning = localOptions.global === "warn";
|
|
77
|
-
parser.hooks.expression.for("global").tap(PLUGIN_NAME, expr => {
|
|
77
|
+
parser.hooks.expression.for("global").tap(PLUGIN_NAME, (expr) => {
|
|
78
78
|
const dep = new ConstDependency(
|
|
79
79
|
RuntimeGlobals.global,
|
|
80
80
|
/** @type {Range} */ (expr.range),
|
|
@@ -94,7 +94,7 @@ class NodeStuffPlugin {
|
|
|
94
94
|
);
|
|
95
95
|
}
|
|
96
96
|
});
|
|
97
|
-
parser.hooks.rename.for("global").tap(PLUGIN_NAME, expr => {
|
|
97
|
+
parser.hooks.rename.for("global").tap(PLUGIN_NAME, (expr) => {
|
|
98
98
|
const dep = new ConstDependency(
|
|
99
99
|
RuntimeGlobals.global,
|
|
100
100
|
/** @type {Range} */ (expr.range),
|
|
@@ -115,10 +115,11 @@ class NodeStuffPlugin {
|
|
|
115
115
|
const setModuleConstant = (expressionName, fn, warning) => {
|
|
116
116
|
parser.hooks.expression
|
|
117
117
|
.for(expressionName)
|
|
118
|
-
.tap(PLUGIN_NAME, expr => {
|
|
118
|
+
.tap(PLUGIN_NAME, (expr) => {
|
|
119
119
|
const dep = new CachedConstDependency(
|
|
120
120
|
JSON.stringify(fn(parser.state.module)),
|
|
121
|
-
/** @type {Range} */
|
|
121
|
+
/** @type {Range} */
|
|
122
|
+
(expr.range),
|
|
122
123
|
expressionName
|
|
123
124
|
);
|
|
124
125
|
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
|
|
@@ -143,7 +144,7 @@ class NodeStuffPlugin {
|
|
|
143
144
|
const setUrlModuleConstant = (expressionName, fn) => {
|
|
144
145
|
parser.hooks.expression
|
|
145
146
|
.for(expressionName)
|
|
146
|
-
.tap(PLUGIN_NAME, expr => {
|
|
147
|
+
.tap(PLUGIN_NAME, (expr) => {
|
|
147
148
|
const dep = new ExternalModuleDependency(
|
|
148
149
|
"url",
|
|
149
150
|
[
|
|
@@ -186,14 +187,19 @@ class NodeStuffPlugin {
|
|
|
186
187
|
"__filename is a Node.js feature and isn't available in browsers."
|
|
187
188
|
);
|
|
188
189
|
break;
|
|
189
|
-
case "node-module":
|
|
190
|
+
case "node-module": {
|
|
191
|
+
const importMetaName =
|
|
192
|
+
/** @type {string} */
|
|
193
|
+
(compilation.outputOptions.importMetaName);
|
|
194
|
+
|
|
190
195
|
setUrlModuleConstant(
|
|
191
196
|
"__filename",
|
|
192
|
-
functionName => `${functionName}(
|
|
197
|
+
(functionName) => `${functionName}(${importMetaName}.url)`
|
|
193
198
|
);
|
|
194
199
|
break;
|
|
200
|
+
}
|
|
195
201
|
case true:
|
|
196
|
-
setModuleConstant("__filename", module =>
|
|
202
|
+
setModuleConstant("__filename", (module) =>
|
|
197
203
|
relative(
|
|
198
204
|
/** @type {InputFileSystem} */ (compiler.inputFileSystem),
|
|
199
205
|
context,
|
|
@@ -205,7 +211,7 @@ class NodeStuffPlugin {
|
|
|
205
211
|
|
|
206
212
|
parser.hooks.evaluateIdentifier
|
|
207
213
|
.for("__filename")
|
|
208
|
-
.tap(PLUGIN_NAME, expr => {
|
|
214
|
+
.tap(PLUGIN_NAME, (expr) => {
|
|
209
215
|
if (!parser.state.module) return;
|
|
210
216
|
const resource = parseResource(parser.state.module.resource);
|
|
211
217
|
return evaluateToString(resource.path)(expr);
|
|
@@ -223,15 +229,20 @@ class NodeStuffPlugin {
|
|
|
223
229
|
"__dirname is a Node.js feature and isn't available in browsers."
|
|
224
230
|
);
|
|
225
231
|
break;
|
|
226
|
-
case "node-module":
|
|
232
|
+
case "node-module": {
|
|
233
|
+
const importMetaName =
|
|
234
|
+
/** @type {string} */
|
|
235
|
+
(compilation.outputOptions.importMetaName);
|
|
236
|
+
|
|
227
237
|
setUrlModuleConstant(
|
|
228
238
|
"__dirname",
|
|
229
|
-
functionName =>
|
|
230
|
-
`${functionName}(
|
|
239
|
+
(functionName) =>
|
|
240
|
+
`${functionName}(${importMetaName}.url + "/..").slice(0, -1)`
|
|
231
241
|
);
|
|
232
242
|
break;
|
|
243
|
+
}
|
|
233
244
|
case true:
|
|
234
|
-
setModuleConstant("__dirname", module =>
|
|
245
|
+
setModuleConstant("__dirname", (module) =>
|
|
235
246
|
relative(
|
|
236
247
|
/** @type {InputFileSystem} */ (compiler.inputFileSystem),
|
|
237
248
|
context,
|
|
@@ -243,10 +254,11 @@ class NodeStuffPlugin {
|
|
|
243
254
|
|
|
244
255
|
parser.hooks.evaluateIdentifier
|
|
245
256
|
.for("__dirname")
|
|
246
|
-
.tap(PLUGIN_NAME, expr => {
|
|
257
|
+
.tap(PLUGIN_NAME, (expr) => {
|
|
247
258
|
if (!parser.state.module) return;
|
|
248
259
|
return evaluateToString(
|
|
249
|
-
/** @type {string} */
|
|
260
|
+
/** @type {string} */
|
|
261
|
+
(parser.state.module.context)
|
|
250
262
|
)(expr);
|
|
251
263
|
});
|
|
252
264
|
}
|
package/lib/NormalModule.js
CHANGED
|
@@ -163,17 +163,17 @@ const contextifySourceMap = (context, sourceMap, associatedObjectForCache) => {
|
|
|
163
163
|
const { sourceRoot } = sourceMap;
|
|
164
164
|
/** @type {(source: string) => string} */
|
|
165
165
|
const mapper = !sourceRoot
|
|
166
|
-
? source => source
|
|
166
|
+
? (source) => source
|
|
167
167
|
: sourceRoot.endsWith("/")
|
|
168
|
-
? source =>
|
|
168
|
+
? (source) =>
|
|
169
169
|
source.startsWith("/")
|
|
170
170
|
? `${sourceRoot.slice(0, -1)}${source}`
|
|
171
171
|
: `${sourceRoot}${source}`
|
|
172
|
-
: source =>
|
|
172
|
+
: (source) =>
|
|
173
173
|
source.startsWith("/")
|
|
174
174
|
? `${sourceRoot}${source}`
|
|
175
175
|
: `${sourceRoot}/${source}`;
|
|
176
|
-
const newSources = sourceMap.sources.map(source =>
|
|
176
|
+
const newSources = sourceMap.sources.map((source) =>
|
|
177
177
|
contextifySourceUrl(context, mapper(source), associatedObjectForCache)
|
|
178
178
|
);
|
|
179
179
|
return {
|
|
@@ -188,7 +188,7 @@ const contextifySourceMap = (context, sourceMap, associatedObjectForCache) => {
|
|
|
188
188
|
* @param {string | Buffer} input the input
|
|
189
189
|
* @returns {string} the converted string
|
|
190
190
|
*/
|
|
191
|
-
const asString = input => {
|
|
191
|
+
const asString = (input) => {
|
|
192
192
|
if (Buffer.isBuffer(input)) {
|
|
193
193
|
return input.toString("utf8");
|
|
194
194
|
}
|
|
@@ -199,7 +199,7 @@ const asString = input => {
|
|
|
199
199
|
* @param {string | Buffer} input the input
|
|
200
200
|
* @returns {Buffer} the converted buffer
|
|
201
201
|
*/
|
|
202
|
-
const asBuffer = input => {
|
|
202
|
+
const asBuffer = (input) => {
|
|
203
203
|
if (!Buffer.isBuffer(input)) {
|
|
204
204
|
return Buffer.from(input, "utf8");
|
|
205
205
|
}
|
|
@@ -279,14 +279,14 @@ class NormalModule extends Module {
|
|
|
279
279
|
beforeParse: new SyncHook(["module"]),
|
|
280
280
|
beforeSnapshot: new SyncHook(["module"]),
|
|
281
281
|
// TODO webpack 6 deprecate
|
|
282
|
-
readResourceForScheme: new HookMap(scheme => {
|
|
282
|
+
readResourceForScheme: new HookMap((scheme) => {
|
|
283
283
|
const hook =
|
|
284
284
|
/** @type {NormalModuleCompilationHooks} */
|
|
285
285
|
(hooks).readResource.for(scheme);
|
|
286
286
|
return createFakeHook(
|
|
287
287
|
/** @type {AsyncSeriesBailHook<[string, NormalModule], string | Buffer | null>} */ ({
|
|
288
288
|
tap: (options, fn) =>
|
|
289
|
-
hook.tap(options, loaderContext =>
|
|
289
|
+
hook.tap(options, (loaderContext) =>
|
|
290
290
|
fn(
|
|
291
291
|
loaderContext.resource,
|
|
292
292
|
/** @type {NormalModule} */ (loaderContext._module)
|
|
@@ -301,7 +301,7 @@ class NormalModule extends Module {
|
|
|
301
301
|
)
|
|
302
302
|
),
|
|
303
303
|
tapPromise: (options, fn) =>
|
|
304
|
-
hook.tapPromise(options, loaderContext =>
|
|
304
|
+
hook.tapPromise(options, (loaderContext) =>
|
|
305
305
|
fn(
|
|
306
306
|
loaderContext.resource,
|
|
307
307
|
/** @type {NormalModule} */ (loaderContext._module)
|
|
@@ -599,19 +599,19 @@ class NormalModule extends Module {
|
|
|
599
599
|
*/
|
|
600
600
|
const getResolveContext = () => ({
|
|
601
601
|
fileDependencies: {
|
|
602
|
-
add: d =>
|
|
602
|
+
add: (d) =>
|
|
603
603
|
/** @type {LoaderContext<EXPECTED_ANY>} */ (
|
|
604
604
|
loaderContext
|
|
605
605
|
).addDependency(d)
|
|
606
606
|
},
|
|
607
607
|
contextDependencies: {
|
|
608
|
-
add: d =>
|
|
608
|
+
add: (d) =>
|
|
609
609
|
/** @type {LoaderContext<EXPECTED_ANY>} */ (
|
|
610
610
|
loaderContext
|
|
611
611
|
).addContextDependency(d)
|
|
612
612
|
},
|
|
613
613
|
missingDependencies: {
|
|
614
|
-
add: d =>
|
|
614
|
+
add: (d) =>
|
|
615
615
|
/** @type {LoaderContext<EXPECTED_ANY>} */ (
|
|
616
616
|
loaderContext
|
|
617
617
|
).addMissingDependency(d)
|
|
@@ -660,7 +660,7 @@ class NormalModule extends Module {
|
|
|
660
660
|
* @param {HashFunction=} type type
|
|
661
661
|
* @returns {Hash} hash
|
|
662
662
|
*/
|
|
663
|
-
createHash: type =>
|
|
663
|
+
createHash: (type) =>
|
|
664
664
|
createHash(
|
|
665
665
|
type ||
|
|
666
666
|
/** @type {HashFunction} */
|
|
@@ -674,7 +674,7 @@ class NormalModule extends Module {
|
|
|
674
674
|
* @param {import("../declarations/LoaderContext").Schema=} schema schema
|
|
675
675
|
* @returns {T} options
|
|
676
676
|
*/
|
|
677
|
-
getOptions: schema => {
|
|
677
|
+
getOptions: (schema) => {
|
|
678
678
|
const loader = this.getCurrentLoader(
|
|
679
679
|
/** @type {LoaderContext<EXPECTED_ANY>} */ (loaderContext)
|
|
680
680
|
);
|
|
@@ -716,7 +716,7 @@ class NormalModule extends Module {
|
|
|
716
716
|
|
|
717
717
|
return /** @type {T} */ (options);
|
|
718
718
|
},
|
|
719
|
-
emitWarning: warning => {
|
|
719
|
+
emitWarning: (warning) => {
|
|
720
720
|
if (!(warning instanceof Error)) {
|
|
721
721
|
warning = new NonErrorEmittedError(warning);
|
|
722
722
|
}
|
|
@@ -726,7 +726,7 @@ class NormalModule extends Module {
|
|
|
726
726
|
})
|
|
727
727
|
);
|
|
728
728
|
},
|
|
729
|
-
emitError: error => {
|
|
729
|
+
emitError: (error) => {
|
|
730
730
|
if (!(error instanceof Error)) {
|
|
731
731
|
error = new NonErrorEmittedError(error);
|
|
732
732
|
}
|
|
@@ -736,7 +736,7 @@ class NormalModule extends Module {
|
|
|
736
736
|
})
|
|
737
737
|
);
|
|
738
738
|
},
|
|
739
|
-
getLogger: name => {
|
|
739
|
+
getLogger: (name) => {
|
|
740
740
|
const currentLoader = this.getCurrentLoader(
|
|
741
741
|
/** @type {LoaderContext<EXPECTED_ANY>} */ (loaderContext)
|
|
742
742
|
);
|
|
@@ -802,7 +802,7 @@ class NormalModule extends Module {
|
|
|
802
802
|
);
|
|
803
803
|
assetsInfo.set(name, assetInfo);
|
|
804
804
|
},
|
|
805
|
-
addBuildDependency: dep => {
|
|
805
|
+
addBuildDependency: (dep) => {
|
|
806
806
|
const buildInfo = /** @type {BuildInfo} */ (this.buildInfo);
|
|
807
807
|
|
|
808
808
|
if (buildInfo.buildDependencies === undefined) {
|
|
@@ -1190,7 +1190,7 @@ class NormalModule extends Module {
|
|
|
1190
1190
|
|
|
1191
1191
|
const hooks = NormalModule.getCompilationHooks(compilation);
|
|
1192
1192
|
|
|
1193
|
-
return this._doBuild(options, compilation, resolver, fs, hooks, err => {
|
|
1193
|
+
return this._doBuild(options, compilation, resolver, fs, hooks, (err) => {
|
|
1194
1194
|
// if we have an error mark module as failed and exit
|
|
1195
1195
|
if (err) {
|
|
1196
1196
|
this.markModuleAsErrored(err);
|
|
@@ -1202,9 +1202,9 @@ class NormalModule extends Module {
|
|
|
1202
1202
|
* @param {Error} e error
|
|
1203
1203
|
* @returns {void}
|
|
1204
1204
|
*/
|
|
1205
|
-
const handleParseError = e => {
|
|
1205
|
+
const handleParseError = (e) => {
|
|
1206
1206
|
const source = /** @type {Source} */ (this._source).source();
|
|
1207
|
-
const loaders = this.loaders.map(item =>
|
|
1207
|
+
const loaders = this.loaders.map((item) =>
|
|
1208
1208
|
contextify(
|
|
1209
1209
|
/** @type {string} */ (options.context),
|
|
1210
1210
|
item.loader,
|
|
@@ -1220,7 +1220,7 @@ class NormalModule extends Module {
|
|
|
1220
1220
|
const handleParseResult = () => {
|
|
1221
1221
|
this.dependencies.sort(
|
|
1222
1222
|
concatComparators(
|
|
1223
|
-
compareSelect(a => a.loc, compareLocations),
|
|
1223
|
+
compareSelect((a) => a.loc, compareLocations),
|
|
1224
1224
|
keepOriginalOrder(this.dependencies)
|
|
1225
1225
|
)
|
|
1226
1226
|
);
|
|
@@ -1252,7 +1252,7 @@ class NormalModule extends Module {
|
|
|
1252
1252
|
/**
|
|
1253
1253
|
* @param {LazySet<string>} deps deps
|
|
1254
1254
|
*/
|
|
1255
|
-
const checkDependencies = deps => {
|
|
1255
|
+
const checkDependencies = (deps) => {
|
|
1256
1256
|
for (const dep of deps) {
|
|
1257
1257
|
if (!ABSOLUTE_PATH_REGEX.test(dep)) {
|
|
1258
1258
|
if (nonAbsoluteDependencies === undefined) {
|