Skip to content

Commit 7919303

Browse files
committed
allow custom detective
same as browserify#63
1 parent 6898736 commit 7919303

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ function Deps (opts) {
5757
this.transforms = [].concat(opts.transform).filter(Boolean);
5858
this.globalTransforms = [].concat(opts.globalTransform).filter(Boolean);
5959
this.resolver = opts.resolve || browserResolve;
60+
this.detective = opts.detect || detective;
6061
this.options = xtend(opts);
6162
if (!this.options.modules) this.options.modules = {};
6263

@@ -467,6 +468,7 @@ Deps.prototype.walk = function (id, parent, cb) {
467468
};
468469

469470
Deps.prototype.parseDeps = function (file, src, cb) {
471+
var self = this;
470472
if (this.options.noParse === true) return [];
471473
if (/\.json$/.test(file)) return [];
472474

@@ -475,7 +477,7 @@ Deps.prototype.parseDeps = function (file, src, cb) {
475477
return [];
476478
}
477479

478-
try { var deps = detective(src) }
480+
try { var deps = self.detective(src) }
479481
catch (ex) {
480482
var message = ex && ex.message ? ex.message : ex;
481483
this.emit('error', new Error(

0 commit comments

Comments
 (0)