diff --git a/README.md b/README.md index 63d9e67..7922c38 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,8 @@ var list = dependencyTree.toList({ * `filter`: a function used to determine if a module (and its subtree) should be included in the dependency tree - The function should accept an absolute filepath and return a boolean - If the filter returns true, the module is included in the resulting tree - +* `detective`: object with configuration specific to detectives used to find dependencies of a file + - for example `detective.amd.skipLazyLoaded: true` tells the AMD detective to omit inner requires The object form is a mapping of the dependency tree to the filesystem – where every key is an absolute filepath and the value is another object/subtree. diff --git a/index.js b/index.js index 679e88c..e8c420f 100644 --- a/index.js +++ b/index.js @@ -12,6 +12,7 @@ function Config(options) { this.isListForm = options.isListForm; this.requireConfig = options.config || options.requireConfig; this.webpackConfig = options.webpackConfig; + this.detectiveConfig = options.detective || {}; this.filter = options.filter; @@ -106,11 +107,11 @@ module.exports.toList = function(options) { */ module.exports._getDependencies = function(config) { var dependencies; + var precintOptions = config.detectiveConfig; + precintOptions.includeCore = false; try { - dependencies = precinct.paperwork(config.filename, { - includeCore: false - }); + dependencies = precinct.paperwork(config.filename, precintOptions); debug('extracted ' + dependencies.length + ' dependencies: ', dependencies); diff --git a/package.json b/package.json index 5a94f03..d5df11f 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "commander": "~2.6.0", "debug": "~2.2.0", "filing-cabinet": "^1.5.0", - "precinct": "^3.1.1" + "precinct": "^3.2.0" }, "devDependencies": { "babel": "~5.8.38",