Comparing version 0.2.3 to 0.2.4
27
index.js
@@ -10,2 +10,5 @@ const promise = require('bluebird'); | ||
} | ||
if (opts.setup) { | ||
this.setup = opts.setup; | ||
} | ||
if (opts.resolve) { | ||
@@ -38,13 +41,23 @@ this.resolve = opts.resolve; | ||
Deptrace.prototype.graph = function (input, parents) { | ||
var ready = promise.resolve(); | ||
var initialCall = (arguments.length === 1); | ||
if (!parents) { | ||
parents = []; | ||
if (typeof this.setup === 'function') { | ||
ready = promise.resolve(this.setup()); | ||
} | ||
} | ||
parents = parents.slice(); | ||
parents.push(input); | ||
var recurse = this._recurse(input, parents); | ||
if (arguments.length === 1) { | ||
recurse = recurse.then(this.format.bind(this, input)); | ||
} | ||
return recurse; | ||
return ready.then(function () { | ||
parents = parents.slice(); | ||
parents.push(input); | ||
var recurse = this._recurse(input, parents); | ||
if (initialCall) { | ||
recurse = recurse.then(this.format.bind(this, input)); | ||
} | ||
return recurse; | ||
}.bind(this)); | ||
}; | ||
@@ -51,0 +64,0 @@ |
{ | ||
"name": "deptrace", | ||
"description": "Trace and format recursive dependency trees asynchronously.", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"homepage": "https://github.com/gitfuse/deptrace", | ||
@@ -24,3 +24,3 @@ "authors": [ | ||
"engines": { | ||
"node": ">= 0.8.0" | ||
"node": ">= 0.10.0" | ||
}, | ||
@@ -38,3 +38,3 @@ "scripts": { | ||
"dependencies": { | ||
"bluebird": "^2.2.1" | ||
"bluebird": "~2.2.1" | ||
}, | ||
@@ -41,0 +41,0 @@ "keywords": [ |
@@ -14,2 +14,5 @@ # deptrace [![Build Status](https://secure.travis-ci.org/gitfuse/deptrace.png)](http://travis-ci.org/gitfuse/deptrace) | ||
const tracer = new Deptrace({ | ||
setup: function () { | ||
// optional method to call before running graph | ||
}, | ||
depsFor: function (input) { | ||
@@ -28,2 +31,9 @@ // extract an array of dependencies from some input | ||
### opts.setup | ||
Use this to perform any setup necessary before running a graph. May return a promise. | ||
Type: `Function` | ||
Default: null | ||
#### opts.depsFor(input) | ||
@@ -30,0 +40,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
9929
78
136
+ Addedbluebird@2.2.2(transitive)
- Removedbluebird@2.11.0(transitive)
Updatedbluebird@~2.2.1