refactor: replace traditional for loops with for...of for better readability (#19516)
Github Actions / lint (push) Waiting to run Details
Github Actions / validate-legacy-node (push) Waiting to run Details
Github Actions / benchmark (1/4) (push) Waiting to run Details
Github Actions / benchmark (2/4) (push) Waiting to run Details
Github Actions / benchmark (3/4) (push) Waiting to run Details
Github Actions / benchmark (4/4) (push) Waiting to run Details
Github Actions / basic (push) Waiting to run Details
Github Actions / unit (push) Waiting to run Details
Github Actions / integration (10.x, macos-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (10.x, macos-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (10.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (10.x, ubuntu-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (10.x, windows-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (10.x, windows-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (12.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (14.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (16.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (18.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (18.x, ubuntu-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (20.x, macos-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (20.x, macos-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (20.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (20.x, ubuntu-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (20.x, windows-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (20.x, windows-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (22.x, macos-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (22.x, macos-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (22.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (22.x, ubuntu-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (22.x, windows-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (22.x, windows-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (23.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (23.x, ubuntu-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (lts/*, ubuntu-latest, a, 1) (push) Blocked by required conditions Details
Github Actions / integration (lts/*, ubuntu-latest, b, 1) (push) Blocked by required conditions Details

This commit is contained in:
Noritaka Kobayashi 2025-05-13 20:53:09 +09:00 committed by GitHub
parent dec18718be
commit 873b1e42aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 26 deletions

View File

@ -2021,8 +2021,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
const unsafeCacheableModule = const unsafeCacheableModule =
/** @type {ModuleWithRestoreFromUnsafeCache} */ /** @type {ModuleWithRestoreFromUnsafeCache} */
(module); (module);
for (let i = 0; i < dependencies.length; i++) { for (const dependency of dependencies) {
const dependency = dependencies[i];
moduleGraph.setResolvedModule( moduleGraph.setResolvedModule(
connectOrigin ? originModule : null, connectOrigin ? originModule : null,
dependency, dependency,
@ -2038,8 +2037,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
} }
} else { } else {
applyFactoryResultDependencies(); applyFactoryResultDependencies();
for (let i = 0; i < dependencies.length; i++) { for (const dependency of dependencies) {
const dependency = dependencies[i];
moduleGraph.setResolvedModule( moduleGraph.setResolvedModule(
connectOrigin ? originModule : null, connectOrigin ? originModule : null,
dependency, dependency,
@ -3435,18 +3433,13 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
*/ */
reportDependencyErrorsAndWarnings(module, blocks) { reportDependencyErrorsAndWarnings(module, blocks) {
let hasProblems = false; let hasProblems = false;
for (let indexBlock = 0; indexBlock < blocks.length; indexBlock++) { for (const block of blocks) {
const block = blocks[indexBlock];
const dependencies = block.dependencies; const dependencies = block.dependencies;
for (let indexDep = 0; indexDep < dependencies.length; indexDep++) { for (const d of dependencies) {
const d = dependencies[indexDep];
const warnings = d.getWarnings(this.moduleGraph); const warnings = d.getWarnings(this.moduleGraph);
if (warnings) { if (warnings) {
for (let indexWar = 0; indexWar < warnings.length; indexWar++) { for (const w of warnings) {
const w = warnings[indexWar];
const warning = new ModuleDependencyWarning(module, w, d.loc); const warning = new ModuleDependencyWarning(module, w, d.loc);
this.warnings.push(warning); this.warnings.push(warning);
hasProblems = true; hasProblems = true;
@ -3454,9 +3447,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
} }
const errors = d.getErrors(this.moduleGraph); const errors = d.getErrors(this.moduleGraph);
if (errors) { if (errors) {
for (let indexErr = 0; indexErr < errors.length; indexErr++) { for (const e of errors) {
const e = errors[indexErr];
const error = new ModuleDependencyError(module, e, d.loc); const error = new ModuleDependencyError(module, e, d.loc);
this.errors.push(error); this.errors.push(error);
hasProblems = true; hasProblems = true;
@ -4161,16 +4152,14 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
}; };
const blocks = block.blocks; const blocks = block.blocks;
for (let indexBlock = 0; indexBlock < blocks.length; indexBlock++) { for (const asyncBlock of blocks) {
const asyncBlock = blocks[indexBlock];
const chunkGroup = const chunkGroup =
/** @type {ChunkGroup} */ /** @type {ChunkGroup} */
(this.chunkGraph.getBlockChunkGroup(asyncBlock)); (this.chunkGraph.getBlockChunkGroup(asyncBlock));
// Grab all chunks from the first Block's AsyncDepBlock // Grab all chunks from the first Block's AsyncDepBlock
const chunks = chunkGroup.chunks; const chunks = chunkGroup.chunks;
// For each chunk in chunkGroup // For each chunk in chunkGroup
for (let indexChunk = 0; indexChunk < chunks.length; indexChunk++) { for (const iteratedChunk of chunks) {
const iteratedChunk = chunks[indexChunk];
chunkGroup.removeChunk(iteratedChunk); chunkGroup.removeChunk(iteratedChunk);
// Recurse // Recurse
this.removeChunkFromDependencies(block, iteratedChunk); this.removeChunkFromDependencies(block, iteratedChunk);
@ -4211,13 +4200,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
} }
summarizeDependencies() { summarizeDependencies() {
for ( for (const child of this.children) {
let indexChildren = 0;
indexChildren < this.children.length;
indexChildren++
) {
const child = this.children[indexChildren];
this.fileDependencies.addAll(child.fileDependencies); this.fileDependencies.addAll(child.fileDependencies);
this.contextDependencies.addAll(child.contextDependencies); this.contextDependencies.addAll(child.contextDependencies);
this.missingDependencies.addAll(child.missingDependencies); this.missingDependencies.addAll(child.missingDependencies);