require-list
Advanced tools
Comparing version 0.1.5 to 0.1.6
@@ -62,6 +62,8 @@ /** | ||
* @param {Number} depth | ||
* @param {Object} checkModule | ||
* @returns {Object} | ||
*/ | ||
function childTree(filepath, depth) { | ||
function childTree(filepath, depth, checkModule) { | ||
depth = depth || 0; | ||
checkModule = checkModule || {}; | ||
if (depth > 10) { | ||
@@ -104,2 +106,3 @@ return {}; | ||
child = require.resolve(path.resolve(path.dirname(filepath), child)); | ||
if (path.extname(child) !== '.js') { | ||
@@ -109,3 +112,10 @@ result[child] = null; | ||
} | ||
result[child] = childTree(child, depth + 1); | ||
if (checkModule[child]) { | ||
result[child] = {}; | ||
continue; | ||
} | ||
checkModule[child] = true; | ||
result[child] = childTree(child, depth + 1, checkModule); | ||
} | ||
@@ -214,3 +224,3 @@ | ||
var str = entrypoint + '\n'; | ||
return convertString(path.dirname(entrypoint), color, str, tree); | ||
return convertString(path.dirname(entrypoint), color, str, tree, '', {}, [ entrypoint ]); | ||
}; |
{ | ||
"name": "require-list", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "require tree list", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17048
260