Description
The current function recursively traverses the dependency tree to find all dependencies. However, when the dependency graph is very deep and complex, traversing the entire graph can lead to performance issues. To address this, we propose adding a maxDepth option to allow users to set the maximum depth for traversal.
Proposal:
Add a maxDepth option to the traverseDependencies function. This option will accept an integer value specifying the maximum depth to traverse. For example, setting maxDepth to 3 will limit the function to traversing dependencies up to 3 levels deep, ignoring any dependencies beyond that depth.
Expected Behavior:
Users should be able to set the maxDepth option when calling the traverseDependencies function to control the depth of traversal.
Expected Benefits:
Performance Improvement: By limiting the traversal to a specific depth, performance can be enhanced when dealing with large dependency graphs.
Flexibility: Users can adjust the traversal depth according to their needs.
Resource Optimization: Extracting only the necessary information minimizes resource usage.