Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions Nodejs/Product/Npm/SPI/NodeModules.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,19 @@

namespace Microsoft.NodejsTools.Npm.SPI {
internal class NodeModules : AbstractNodeModules {
private Dictionary<string, ModuleInfo> _allModules;
private static readonly string[] _ignoredDirectories = { @"\.bin", @"\.staging" };

public NodeModules(IRootPackage parent, bool showMissingDevOptionalSubPackages, Dictionary<string, ModuleInfo> allModulesToDepth = null, int depth = 0) {
var modulesBase = Path.Combine(parent.Path, NodejsConstants.NodeModulesFolder);
private readonly Dictionary<string, ModuleInfo> _allModules;

public NodeModules(IRootPackage parent, bool showMissingDevOptionalSubPackages, Dictionary<string, ModuleInfo> allModulesToDepth = null, int depth = 0, int maxDepth = 1) {
_allModules = allModulesToDepth ?? new Dictionary<string, ModuleInfo>();

if (depth >= maxDepth) {
return;
}

var modulesBase = Path.Combine(parent.Path, NodejsConstants.NodeModulesFolder);

// This is the first time NodeModules is being created.
// Iterate through directories to add everything that's known to be top-level.
if (depth == 0) {
Expand Down
5 changes: 3 additions & 2 deletions Nodejs/Product/Npm/SPI/RootPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ public RootPackage(
string fullPathToRootDirectory,
bool showMissingDevOptionalSubPackages,
Dictionary<string, ModuleInfo> allModules = null,
int depth = 0) {
int depth = 0,
int maxDepth = 1) {
Path = fullPathToRootDirectory;
var packageJsonFile = System.IO.Path.Combine(fullPathToRootDirectory, "package.json");
try {
Expand All @@ -45,7 +46,7 @@ public RootPackage(
}

try {
Modules = new NodeModules(this, showMissingDevOptionalSubPackages, allModules, depth);
Modules = new NodeModules(this, showMissingDevOptionalSubPackages, allModules, depth, maxDepth);
} catch (PathTooLongException) {
// otherwise we fail to create it completely...
}
Expand Down