Comparing version 2.4.0 to 2.5.0
37
index.js
var through = require('through2'); | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
var chokidar = require('chokidar'); | ||
var xtend = require('xtend'); | ||
module.exports = watchify; | ||
module.exports.args = { | ||
cache: {}, packageCache: {}, fullPaths: true | ||
cache: {}, packageCache: {} | ||
}; | ||
@@ -18,11 +18,21 @@ | ||
b.on('dep', function (dep) { | ||
if (typeof dep.id === 'string') { | ||
cache[dep.id] = dep; | ||
} | ||
if (typeof dep.file === 'string') { | ||
watchFile(dep.file); | ||
} | ||
}); | ||
b.on('reset', collect); | ||
collect(); | ||
function collect () { | ||
b.pipeline.get('deps').push(through.obj(function(row, enc, next) { | ||
if (cache) { | ||
cache[row.file] = { | ||
id: row.file, | ||
source: row.source, | ||
deps: xtend({}, row.deps), | ||
file: row.file | ||
}; | ||
} | ||
watchFile(row.file); | ||
this.push(row); | ||
next(); | ||
})); | ||
} | ||
b.on('file', function (file) { | ||
@@ -73,9 +83,2 @@ watchFile(file); | ||
function watchFile (file) { | ||
fs.lstat(file, function (err, stat) { | ||
if (err || stat.isDirectory()) return; | ||
watchFile_(file); | ||
}); | ||
} | ||
function watchFile_ (file) { | ||
if (!fwatchers[file]) fwatchers[file] = []; | ||
@@ -82,0 +85,0 @@ if (!fwatcherFiles[file]) fwatcherFiles[file] = []; |
{ | ||
"name": "watchify", | ||
"version": "2.4.0", | ||
"version": "2.5.0", | ||
"description": "watch mode for browserify builds", | ||
@@ -10,3 +10,4 @@ "main": "index.js", | ||
"chokidar": "~0.12.1", | ||
"through2": "~0.5.1" | ||
"through2": "~0.5.1", | ||
"xtend": "^4.0.0" | ||
}, | ||
@@ -13,0 +14,0 @@ "devDependencies": { |
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
28694
764
16
4
+ Addedxtend@^4.0.0