var crypto = require('crypto');
var through = require('through2');

var GLOBAL_CACHE = {};

module.exports = function (options) {
  options = options || {};

  var cache = options.cache || GLOBAL_CACHE;
  var firstPass = options.firstPass === true;

  return through.obj(function (file, encoding, done) {
    var newHash = crypto.createHash('sha1').update(file.contents).digest('hex');
    var currentHash = cache[file.path];

    if ((!currentHash && firstPass) || (currentHash && currentHash !== newHash)) {
      this.push(file);
    }

    cache[file.path] = newHash;

    done();
  });
};

@@ -110,17 +110,16 @@
 function
- 
 (options
@@ -122,16 +122,16 @@
 ions) %7B%0A
+
   option
@@ -271,17 +271,16 @@
 function
- 
 (file, e
@@ -295,16 +295,422 @@
  done) %7B
+%0A    // null cannot be hashed%0A    if (file.contents === null) %7B%0A      // if element is really a file, something weird happened, but it's safer%0A      // to assume it was changed (because we cannot said that it wasn't)%0A      // if it's not a file, we don't care, do we? does anybody transform%0A      // directories?%0A      if (file.stat.isFile()) %7B%0A        this.push(file);%0A      %7D%0A%0A      return done();%0A    %7D%0A
 %0A    var

Fix #2 by checking if file content is available