mirror of https://github.com/status-im/metro.git
Improve progress bar when using delta dependencies traversal
Reviewed By: davidaurelio Differential Revision: D5901052 fbshipit-source-id: a06584bfbd287f6d8d9b53fb5918dfa7d88bceef
This commit is contained in:
parent
a606e79af0
commit
07d73a3af2
|
@ -132,15 +132,19 @@ async function traverseDependenciesForSingleFile(
|
||||||
dependencyGraph,
|
dependencyGraph,
|
||||||
transformOptions,
|
transformOptions,
|
||||||
edges,
|
edges,
|
||||||
|
() => {
|
||||||
|
total++;
|
||||||
|
onProgress(numProcessed, total);
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
numProcessed++;
|
||||||
|
onProgress(numProcessed, total);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
newDependencies = new Set();
|
newDependencies = new Set();
|
||||||
}
|
}
|
||||||
|
|
||||||
numProcessed += newDependencies.size + 1;
|
|
||||||
total += newDependencies.size;
|
|
||||||
onProgress(numProcessed, total);
|
|
||||||
|
|
||||||
return newDependencies;
|
return newDependencies;
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
@ -177,6 +181,8 @@ async function addDependency(
|
||||||
dependencyGraph: DependencyGraph,
|
dependencyGraph: DependencyGraph,
|
||||||
transformOptions: JSTransformerOptions,
|
transformOptions: JSTransformerOptions,
|
||||||
edges: DependencyEdges,
|
edges: DependencyEdges,
|
||||||
|
onDependencyAdd: () => mixed,
|
||||||
|
onDependencyAdded: () => mixed,
|
||||||
): Promise<Set<string>> {
|
): Promise<Set<string>> {
|
||||||
const parentModule = dependencyGraph.getModuleForPath(parentEdge.path);
|
const parentModule = dependencyGraph.getModuleForPath(parentEdge.path);
|
||||||
const module = dependencyGraph.resolveDependency(
|
const module = dependencyGraph.resolveDependency(
|
||||||
|
@ -197,6 +203,8 @@ async function addDependency(
|
||||||
return new Set();
|
return new Set();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onDependencyAdd();
|
||||||
|
|
||||||
// Create the new edge and traverse all its subdependencies, looking for new
|
// Create the new edge and traverse all its subdependencies, looking for new
|
||||||
// subdependencies recursively.
|
// subdependencies recursively.
|
||||||
dependencyEdge = createEdge(module.path, edges);
|
dependencyEdge = createEdge(module.path, edges);
|
||||||
|
@ -219,6 +227,8 @@ async function addDependency(
|
||||||
dependencyGraph,
|
dependencyGraph,
|
||||||
transformOptions,
|
transformOptions,
|
||||||
edges,
|
edges,
|
||||||
|
onDependencyAdd,
|
||||||
|
onDependencyAdded,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -227,6 +237,8 @@ async function addDependency(
|
||||||
addedDependencies.add(newDependency);
|
addedDependencies.add(newDependency);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onDependencyAdded();
|
||||||
|
|
||||||
return addedDependencies;
|
return addedDependencies;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue