dependency-tree
Advanced tools
Comparing version 5.4.1 to 5.5.0
22
index.js
@@ -100,14 +100,22 @@ var precinct = require('precinct'); | ||
* @param {String} filename | ||
* @return {String[]} | ||
* @return {Object} | ||
*/ | ||
module.exports._getDependencies = function(filename) { | ||
var data = { | ||
dependencies: [], | ||
ast: null, | ||
}; | ||
try { | ||
return precinct.paperwork(filename, { | ||
data.dependencies = precinct.paperwork(filename, { | ||
includeCore: false | ||
}); | ||
data.ast = precinct.ast; | ||
return data; | ||
} catch (e) { | ||
debug('error getting dependencies: ' + e.message); | ||
debug(e.stack); | ||
return []; | ||
return data; | ||
} | ||
@@ -130,3 +138,4 @@ }; | ||
var dependencies = module.exports._getDependencies(config.filename); | ||
var data = module.exports._getDependencies(config.filename); | ||
var dependencies = data.dependencies; | ||
@@ -140,2 +149,3 @@ debug('extracted ' + dependencies.length + ' dependencies: ', dependencies); | ||
directory: config.directory, | ||
ast: data.ast, | ||
config: config.requireConfig, | ||
@@ -159,2 +169,3 @@ webpackConfig: config.webpackConfig | ||
debug('cabinet-resolved all dependencies: ', dependencies); | ||
// Prevents cycles by eagerly marking the current file as read | ||
@@ -165,3 +176,6 @@ // so that any dependent dependencies exit | ||
if (config.filter) { | ||
debug('using filter function to filter out dependencies'); | ||
debug('unfiltered number of dependencies: ' + dependencies.length); | ||
dependencies = dependencies.filter(config.filter); | ||
debug('filtered number of dependencies: ' + dependencies.length); | ||
} | ||
@@ -168,0 +182,0 @@ |
{ | ||
"name": "dependency-tree", | ||
"version": "5.4.1", | ||
"version": "5.5.0", | ||
"description": "Get the dependency tree of a module (as a list)", | ||
@@ -35,4 +35,4 @@ "main": "index.js", | ||
"debug": "~2.2.0", | ||
"filing-cabinet": "~1.2.11", | ||
"precinct": "^3.0.0" | ||
"filing-cabinet": "~1.4.0", | ||
"precinct": "^3.1.1" | ||
}, | ||
@@ -44,3 +44,3 @@ "devDependencies": { | ||
"mocha": "~2.0.1", | ||
"mock-fs": "~3.9.0", | ||
"mock-fs": "~3.11.0", | ||
"rewire": "~2.5.2", | ||
@@ -47,0 +47,0 @@ "sinon": "~1.12.2" |
@@ -473,3 +473,4 @@ import assert from 'assert'; | ||
directory: this._root, | ||
webpackConfig: this._webpackConfig | ||
webpackConfig: this._webpackConfig, | ||
filter: filename => filename.indexOf('filing-cabinet') !== -1 | ||
}); | ||
@@ -482,2 +483,3 @@ | ||
it('resolves aliased modules', function() { | ||
this.timeout(5000); | ||
this._testResolution('aliased'); | ||
@@ -487,2 +489,3 @@ }); | ||
it('resolves unaliased modules', function() { | ||
this.timeout(5000); | ||
this._testResolution('unaliased'); | ||
@@ -489,0 +492,0 @@ }); |
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
26995
697
+ Addedfiling-cabinet@1.4.2(transitive)
+ Addedsass-lookup@1.1.0(transitive)
- Removedfiling-cabinet@1.2.11(transitive)
- Removedsass-lookup@1.0.2(transitive)
Updatedfiling-cabinet@~1.4.0
Updatedprecinct@^3.1.1