Skip to content

Commit b0fa9cc

Browse files
committed
pretty files
1 parent 504bda5 commit b0fa9cc

File tree

98 files changed

+753
-806
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+753
-806
lines changed

declarations.d.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,7 @@ declare module "webpack-sources" {
251251

252252
map(options?: MapOptions): Object;
253253

254-
sourceAndMap(
255-
options?: MapOptions
256-
): {
254+
sourceAndMap(options?: MapOptions): {
257255
source: string | Buffer;
258256
map: Object;
259257
};

lib/CacheFacade.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ class MultiItemCache {
9090
* @returns {Promise<void>} promise signals when the value is stored
9191
*/
9292
storePromise(data) {
93-
return Promise.all(
94-
this._items.map(item => item.storePromise(data))
95-
).then(() => {});
93+
return Promise.all(this._items.map(item => item.storePromise(data))).then(
94+
() => {}
95+
);
9696
}
9797
}
9898

lib/Chunk.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -547,9 +547,8 @@ class Chunk {
547547
xor.add(chunkGraph.getModuleHash(m, this.runtime));
548548
}
549549
xor.updateHash(hash);
550-
const entryModules = chunkGraph.getChunkEntryModulesWithChunkGroupIterable(
551-
this
552-
);
550+
const entryModules =
551+
chunkGraph.getChunkEntryModulesWithChunkGroupIterable(this);
553552
for (const [m, chunkGroup] of entryModules) {
554553
hash.update("entry");
555554
hash.update(`${chunkGraph.getModuleId(m)}`);

lib/Compilation.js

+43-55
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,8 @@ class Compilation {
510510
* @returns {FakeHook<Pick<AsyncSeriesHook<T>, "tap" | "tapAsync" | "tapPromise" | "name">>} fake hook which redirects
511511
*/
512512
const createProcessAssetsHook = (name, stage, getArgs, code) => {
513-
const errorMessage = reason => `Can't automatically convert plugin using Compilation.hooks.${name} to Compilation.hooks.processAssets because ${reason}.
513+
const errorMessage =
514+
reason => `Can't automatically convert plugin using Compilation.hooks.${name} to Compilation.hooks.processAssets because ${reason}.
514515
BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a single Compilation.hooks.processAssets hook.`;
515516
const getOptions = options => {
516517
if (typeof options === "string") options = { name: options };
@@ -1615,9 +1616,8 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
16151616
let creatingModuleDuringBuildSet = undefined;
16161617
if (!recursive && this.buildQueue.isProcessing(originModule)) {
16171618
// Track build dependency
1618-
creatingModuleDuringBuildSet = this.creatingModuleDuringBuild.get(
1619-
originModule
1620-
);
1619+
creatingModuleDuringBuildSet =
1620+
this.creatingModuleDuringBuild.get(originModule);
16211621
if (creatingModuleDuringBuildSet === undefined) {
16221622
creatingModuleDuringBuildSet = new Set();
16231623
this.creatingModuleDuringBuild.set(
@@ -1746,11 +1746,8 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
17461746
module: result
17471747
};
17481748
}
1749-
const {
1750-
fileDependencies,
1751-
contextDependencies,
1752-
missingDependencies
1753-
} = result;
1749+
const { fileDependencies, contextDependencies, missingDependencies } =
1750+
result;
17541751
if (fileDependencies) {
17551752
this.fileDependencies.addAll(fileDependencies);
17561753
}
@@ -2316,7 +2313,8 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
23162313
}
23172314
] of this.entries) {
23182315
if (dependOn && runtime) {
2319-
const err = new WebpackError(`Entrypoint '${name}' has 'dependOn' and 'runtime' specified. This is not valid.
2316+
const err =
2317+
new WebpackError(`Entrypoint '${name}' has 'dependOn' and 'runtime' specified. This is not valid.
23202318
Entrypoints that depend on other entrypoints do not have their own runtime.
23212319
They will use the runtime(s) from referenced entrypoints instead.
23222320
Remove the 'runtime' option from the entrypoint.`);
@@ -2357,11 +2355,12 @@ Remove the 'runtime' option from the entrypoint.`);
23572355
let chunk = this.namedChunks.get(runtime);
23582356
if (chunk) {
23592357
if (!runtimeChunks.has(chunk)) {
2360-
const err = new WebpackError(`Entrypoint '${name}' has a 'runtime' option which points to another entrypoint named '${runtime}'.
2358+
const err =
2359+
new WebpackError(`Entrypoint '${name}' has a 'runtime' option which points to another entrypoint named '${runtime}'.
23612360
It's not valid to use other entrypoints as runtime chunk.
23622361
Did you mean to use 'dependOn: ${JSON.stringify(
2363-
runtime
2364-
)}' instead to allow using entrypoint '${name}' within the runtime of entrypoint '${runtime}'? For this '${runtime}' must always be loaded when '${name}' is used.
2362+
runtime
2363+
)}' instead to allow using entrypoint '${name}' within the runtime of entrypoint '${runtime}'? For this '${runtime}' must always be loaded when '${name}' is used.
23652364
Or do you want to use the entrypoints '${name}' and '${runtime}' independently on the same page with a shared runtime? In this case give them both the same value for the 'runtime' option. It must be a name not already used by an entrypoint.`);
23662365
const entryChunk = entry.getEntrypointChunk();
23672366
err.chunk = entryChunk;
@@ -2621,12 +2620,8 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
26212620
_runCodeGenerationJobs(jobs, callback) {
26222621
let statModulesFromCache = 0;
26232622
let statModulesGenerated = 0;
2624-
const {
2625-
chunkGraph,
2626-
moduleGraph,
2627-
dependencyTemplates,
2628-
runtimeTemplate
2629-
} = this;
2623+
const { chunkGraph, moduleGraph, dependencyTemplates, runtimeTemplate } =
2624+
this;
26302625
const results = this.codeGenerationResults;
26312626
const errors = [];
26322627
asyncLib.eachLimit(
@@ -2773,17 +2768,15 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
27732768
chunkGraphEntries = this._getChunkGraphEntries()
27742769
} = {}) {
27752770
const context = { chunkGraph, codeGenerationResults };
2776-
const additionalModuleRuntimeRequirements = this.hooks
2777-
.additionalModuleRuntimeRequirements;
2771+
const additionalModuleRuntimeRequirements =
2772+
this.hooks.additionalModuleRuntimeRequirements;
27782773
const runtimeRequirementInModule = this.hooks.runtimeRequirementInModule;
27792774
for (const module of modules) {
27802775
if (chunkGraph.getNumberOfModuleChunks(module) > 0) {
27812776
for (const runtime of chunkGraph.getModuleRuntimes(module)) {
27822777
let set;
2783-
const runtimeRequirements = codeGenerationResults.getRuntimeRequirements(
2784-
module,
2785-
runtime
2786-
);
2778+
const runtimeRequirements =
2779+
codeGenerationResults.getRuntimeRequirements(module, runtime);
27872780
if (runtimeRequirements && runtimeRequirements.size > 0) {
27882781
set = new Set(runtimeRequirements);
27892782
} else if (additionalModuleRuntimeRequirements.isUsed()) {
@@ -2823,9 +2816,8 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
28232816
for (const treeEntry of chunkGraphEntries) {
28242817
const set = new Set();
28252818
for (const chunk of treeEntry.getAllReferencedChunks()) {
2826-
const runtimeRequirements = chunkGraph.getChunkRuntimeRequirements(
2827-
chunk
2828-
);
2819+
const runtimeRequirements =
2820+
chunkGraph.getChunkRuntimeRequirements(chunk);
28292821
for (const r of runtimeRequirements) set.add(r);
28302822
}
28312823

@@ -3223,9 +3215,9 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
32233215
runtime,
32243216
runtimeTemplate
32253217
});
3226-
const moduleHashDigest = /** @type {string} */ (moduleHash.digest(
3227-
hashDigest
3228-
));
3218+
const moduleHashDigest = /** @type {string} */ (
3219+
moduleHash.digest(hashDigest)
3220+
);
32293221
chunkGraph.setModuleHashes(
32303222
module,
32313223
runtime,
@@ -3354,10 +3346,11 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
33543346
}
33553347
}
33563348
circularRuntimeChunkInfo.sort(compareSelect(i => i.chunk, byId));
3357-
const err = new WebpackError(`Circular dependency between chunks with runtime (${Array.from(
3358-
circularRuntimeChunkInfo,
3359-
c => c.chunk.name || c.chunk.id
3360-
).join(", ")})
3349+
const err =
3350+
new WebpackError(`Circular dependency between chunks with runtime (${Array.from(
3351+
circularRuntimeChunkInfo,
3352+
c => c.chunk.name || c.chunk.id
3353+
).join(", ")})
33613354
This prevents using hashes of each other and should be avoided.`);
33623355
err.chunk = circularRuntimeChunkInfo[0].chunk;
33633356
this.warnings.push(err);
@@ -3420,15 +3413,14 @@ This prevents using hashes of each other and should be avoided.`);
34203413
moduleGraph: this.moduleGraph,
34213414
runtimeTemplate: this.runtimeTemplate
34223415
});
3423-
const chunkHashDigest = /** @type {string} */ (chunkHash.digest(
3424-
hashDigest
3425-
));
3416+
const chunkHashDigest = /** @type {string} */ (
3417+
chunkHash.digest(hashDigest)
3418+
);
34263419
hash.update(chunkHashDigest);
34273420
chunk.hash = chunkHashDigest;
34283421
chunk.renderedHash = chunk.hash.substr(0, hashDigestLength);
3429-
const fullHashModules = chunkGraph.getChunkFullHashModulesIterable(
3430-
chunk
3431-
);
3422+
const fullHashModules =
3423+
chunkGraph.getChunkFullHashModulesIterable(chunk);
34323424
if (fullHashModules) {
34333425
fullHashChunks.add(chunk);
34343426
} else {
@@ -3459,9 +3451,9 @@ This prevents using hashes of each other and should be avoided.`);
34593451
runtime: chunk.runtime,
34603452
runtimeTemplate
34613453
});
3462-
const moduleHashDigest = /** @type {string} */ (moduleHash.digest(
3463-
hashDigest
3464-
));
3454+
const moduleHashDigest = /** @type {string} */ (
3455+
moduleHash.digest(hashDigest)
3456+
);
34653457
const oldHash = chunkGraph.getModuleHash(module, chunk.runtime);
34663458
chunkGraph.setModuleHashes(
34673459
module,
@@ -3474,9 +3466,9 @@ This prevents using hashes of each other and should be avoided.`);
34743466
const chunkHash = createHash(hashFunction);
34753467
chunkHash.update(chunk.hash);
34763468
chunkHash.update(this.hash);
3477-
const chunkHashDigest = /** @type {string} */ (chunkHash.digest(
3478-
hashDigest
3479-
));
3469+
const chunkHashDigest = /** @type {string} */ (
3470+
chunkHash.digest(hashDigest)
3471+
);
34803472
chunk.hash = chunkHashDigest;
34813473
chunk.renderedHash = chunk.hash.substr(0, hashDigestLength);
34823474
this.hooks.contentHash.call(chunk);
@@ -4051,11 +4043,8 @@ This prevents using hashes of each other and should be avoided.`);
40514043
// Create new chunk graph, chunk and entrypoint for the build time execution
40524044
const chunkGraph = new ChunkGraph(this.moduleGraph);
40534045
const runtime = "build time";
4054-
const {
4055-
hashFunction,
4056-
hashDigest,
4057-
hashDigestLength
4058-
} = this.outputOptions;
4046+
const { hashFunction, hashDigest, hashDigestLength } =
4047+
this.outputOptions;
40594048
const runtimeTemplate = this.runtimeTemplate;
40604049

40614050
const chunk = new Chunk("build time chunk");
@@ -4151,9 +4140,8 @@ This prevents using hashes of each other and should be avoided.`);
41514140
});
41524141
this.chunkGraph = old;
41534142

4154-
const runtimeModules = chunkGraph.getChunkRuntimeModulesIterable(
4155-
chunk
4156-
);
4143+
const runtimeModules =
4144+
chunkGraph.getChunkRuntimeModulesIterable(chunk);
41574145

41584146
// Hash runtime modules
41594147
for (const module of runtimeModules) {

lib/Compiler.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -590,9 +590,8 @@ class Compiler {
590590
allTargetPaths.add(targetPath);
591591

592592
// check if the target file has already been written by this Compiler
593-
const targetFileGeneration = this._assetEmittingWrittenFiles.get(
594-
targetPath
595-
);
593+
const targetFileGeneration =
594+
this._assetEmittingWrittenFiles.get(targetPath);
596595

597596
// create an cache entry for this Source if not already existing
598597
let cacheEntry = this._assetEmittingSourceCache.get(source);
@@ -622,7 +621,8 @@ class Compiler {
622621
}
623622
alreadyWritten();
624623
} else {
625-
const err = new WebpackError(`Prevent writing to file that only differs in casing or query string from already written file.
624+
const err =
625+
new WebpackError(`Prevent writing to file that only differs in casing or query string from already written file.
626626
This will lead to a race-condition and corrupted files on case-insensitive file systems.
627627
${targetPath}
628628
${other}`);

lib/ConcatenationScope.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77

88
/** @typedef {import("./Module")} Module */
99

10-
const MODULE_REFERENCE_REGEXP = /^__WEBPACK_MODULE_REFERENCE__(\d+)_([\da-f]+|ns)(_call)?(_directImport)?(?:_asiSafe(\d))?__$/;
10+
const MODULE_REFERENCE_REGEXP =
11+
/^__WEBPACK_MODULE_REFERENCE__(\d+)_([\da-f]+|ns)(_call)?(_directImport)?(?:_asiSafe(\d))?__$/;
1112

1213
const DEFAULT_EXPORT = "__WEBPACK_DEFAULT_EXPORT__";
1314
const NAMESPACE_OBJECT_EXPORT = "__WEBPACK_NAMESPACE_OBJECT__";

lib/ContextModule.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1016,9 +1016,9 @@ module.exports = webpackEmptyAsyncContext;`;
10161016
this.getSource(this.getSourceString(this.options.mode, context))
10171017
);
10181018
const set = new Set();
1019-
const allDeps = /** @type {ContextElementDependency[]} */ (this.dependencies.concat(
1020-
this.blocks.map(b => b.dependencies[0])
1021-
));
1019+
const allDeps = /** @type {ContextElementDependency[]} */ (
1020+
this.dependencies.concat(this.blocks.map(b => b.dependencies[0]))
1021+
);
10221022
set.add(RuntimeGlobals.module);
10231023
set.add(RuntimeGlobals.hasOwnProperty);
10241024
if (allDeps.length > 0) {

lib/ContextReplacementPlugin.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,10 @@ class ContextReplacementPlugin {
104104
result.regExp = newContentRegExp;
105105
}
106106
if (typeof newContentCreateContextMap === "function") {
107-
result.resolveDependencies = createResolveDependenciesFromContextMap(
108-
newContentCreateContextMap
109-
);
107+
result.resolveDependencies =
108+
createResolveDependenciesFromContextMap(
109+
newContentCreateContextMap
110+
);
110111
}
111112
if (typeof newContentCallback === "function") {
112113
const origResource = result.resource;

lib/DefinePlugin.js

+16-12
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ class RuntimeValue {
8989
module: parser.state.module,
9090
key,
9191
get version() {
92-
return /** @type {string} */ (valueCacheVersions.get(
93-
VALUE_DEP_PREFIX + key
94-
));
92+
return /** @type {string} */ (
93+
valueCacheVersions.get(VALUE_DEP_PREFIX + key)
94+
);
9595
}
9696
});
9797
}
@@ -286,11 +286,13 @@ class DefinePlugin {
286286
);
287287
const { runtimeTemplate } = compilation;
288288

289-
const mainValue = /** @type {Set<string>} */ (provide(
290-
compilation.valueCacheVersions,
291-
VALUE_DEP_MAIN,
292-
() => new Set()
293-
));
289+
const mainValue = /** @type {Set<string>} */ (
290+
provide(
291+
compilation.valueCacheVersions,
292+
VALUE_DEP_MAIN,
293+
() => new Set()
294+
)
295+
);
294296

295297
/**
296298
* Handler
@@ -313,10 +315,12 @@ class DefinePlugin {
313315
);
314316
};
315317

316-
const withValueDependency = (key, fn) => (...args) => {
317-
addValueDependency(key);
318-
return fn(...args);
319-
};
318+
const withValueDependency =
319+
(key, fn) =>
320+
(...args) => {
321+
addValueDependency(key);
322+
return fn(...args);
323+
};
320324

321325
/**
322326
* Walk definitions

lib/EvalSourceMapDevToolPlugin.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ class EvalSourceMapDevToolPlugin {
9191
} else if (m instanceof ConcatenatedModule) {
9292
const concatModule = /** @type {ConcatenatedModule} */ (m);
9393
if (concatModule.rootModule instanceof NormalModule) {
94-
const module = /** @type {NormalModule} */ (concatModule.rootModule);
94+
const module = /** @type {NormalModule} */ (
95+
concatModule.rootModule
96+
);
9597
if (!matchModule(module.resource)) {
9698
return result(source);
9799
}

0 commit comments

Comments
 (0)