New Upstream Snapshot - node-gulp-newer

Ready changes

Summary

Merged new upstream version: 1.4.0+git20190102.1.063615a (was: 1.4.0).

Resulting package

Built on 2023-01-19T20:27 (took 6m37s)

The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:

apt install -t fresh-snapshots node-gulp-newer

Lintian Result

Diff

diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..e09e401
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,4 @@
+sudo: false
+language: node_js
+node_js:
+  - "8"
diff --git a/debian/changelog b/debian/changelog
index e5aada1..edbde97 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+node-gulp-newer (1.4.0+git20190102.1.063615a-1) UNRELEASED; urgency=low
+
+  * New upstream snapshot.
+
+ -- Debian Janitor <janitor@jelmer.uk>  Thu, 19 Jan 2023 20:24:11 -0000
+
 node-gulp-newer (1.4.0-1) unstable; urgency=medium
 
   * Team upload
diff --git a/index.js b/index.js
index 6588f52..584f54d 100644
--- a/index.js
+++ b/index.js
@@ -69,6 +69,12 @@ function Newer(options) {
    */
   this._map = options.map;
 
+  /**
+   * Key for the timestamp in files' stats object
+   * @type {string}
+   */
+  this._timestamp = options.ctime ? 'ctime' : 'mtime';
+
   /**
    * Promise for the dest file/directory stats.
    * @type {[type]}
@@ -104,6 +110,7 @@ function Newer(options) {
 
   if (options.extra) {
     var extraFiles = [];
+    var timestamp = this._timestamp;
     for (var i = 0; i < options.extra.length; ++i) {
       extraFiles.push(Q.nfcall(glob, options.extra[i]));
     }
@@ -125,7 +132,7 @@ function Newer(options) {
         // We get all the file stats here; find the *latest* modification.
         var latestStat = resolvedStats[0];
         for (var j = 1; j < resolvedStats.length; ++j) {
-          if (resolvedStats[j].mtime > latestStat.mtime) {
+          if (resolvedStats[j][timestamp] > latestStat[timestamp]) {
             latestStat = resolvedStats[j];
           }
         }
@@ -194,10 +201,15 @@ Newer.prototype._transform = function(srcFile, encoding, done) {
       }
     })
     .spread(function(destFileStats, extraFileStats) {
-      var newer = !destFileStats || srcFile.stat.mtime > destFileStats.mtime;
+      var timestamp = self._timestamp;
+      var newer =
+        !destFileStats || srcFile.stat[timestamp] > destFileStats[timestamp];
       // If *any* extra file is newer than a destination file, then ALL
       // are newer.
-      if (extraFileStats && extraFileStats.mtime > destFileStats.mtime) {
+      if (
+        extraFileStats &&
+        extraFileStats[timestamp] > destFileStats[timestamp]
+      ) {
         newer = true;
       }
       if (self._all) {
diff --git a/package.json b/package.json
index 843dc5c..4916731 100644
--- a/package.json
+++ b/package.json
@@ -30,7 +30,7 @@
   "devDependencies": {
     "chai": "^4.1.2",
     "eslint": "^4.14.0",
-    "eslint-config-tschaub": "^9.0.0",
+    "eslint-config-tschaub": "^10.0.0",
     "gulp": "^3.9.1",
     "mocha": "^4.1.0",
     "mock-fs": "^4.4.2",
diff --git a/readme.md b/readme.md
index 015a79d..19e9f69 100644
--- a/readme.md
+++ b/readme.md
@@ -71,6 +71,7 @@ gulp.task('concat', function() {
  * **options.ext** - `string` Source files will be matched to destination files with the provided extension (e.g. '.css').
  * **options.map** - `function` Map relative source paths to relative destination paths (e.g. `function(relativePath) { return relativePath + '.bak'; }`)
  * **options.extra** - `string` or `array` An extra file, file glob, or list of extra files and/or globs, to check for updated time stamp(s). If any of these files are newer than the destination files, then all source files will be passed into the stream.
+ * **options.ctime** - `boolean` Source files will be matched to destination files based on `ctime` rather than `mtime`.
 
 Create a [transform stream](http://nodejs.org/api/stream.html#stream_class_stream_transform_1) that passes through files whose modification time is more recent than the corresponding destination file's modification time.
 
@@ -78,4 +79,6 @@ If `dest` is a directory path, the `newer` stream will check for files in the de
 
 If `dest` is a file path, the `newer` stream will pass through *all* files if *any one* of them has been modified more recently than the destination file.  If the `dest` file does not exist, all source files will be passed through.
 
+By default, the `newer` stream will check files' *modification time*, or `mtime`, which updates when the file contents are changed. If `ctime` is `true`, files' *change time* will be checked instead, which updates when file contents or attributes like the file name or permissions have changed.
+
 [![Current Status](https://secure.travis-ci.org/tschaub/gulp-newer.png?branch=master)](https://travis-ci.org/tschaub/gulp-newer)
diff --git a/spec.js b/spec.js
index 0895097..10cd69a 100644
--- a/spec.js
+++ b/spec.js
@@ -265,7 +265,8 @@ describe('newer()', function() {
         dest: {
           file2: mock.file({
             content: 'file2 content',
-            mtime: new Date(1)
+            mtime: new Date(1),
+            ctime: new Date(1)
           })
         }
       });
@@ -292,6 +293,27 @@ describe('newer()', function() {
 
       write(stream, paths);
     });
+
+    it('passes through all files, checking ctime', function(done) {
+      var stream = newer({dest: 'dest', ctime: true});
+
+      var paths = ['file1', 'file2', 'file3'];
+
+      var calls = 0;
+      stream.on('data', function(file) {
+        assert.equal(file.path, path.resolve(paths[calls]));
+        ++calls;
+      });
+
+      stream.on('error', done);
+
+      stream.on('end', function() {
+        assert.equal(calls, paths.length);
+        done();
+      });
+
+      write(stream, paths);
+    });
   });
 
   describe('dest dir with one newer file', function() {
@@ -299,20 +321,24 @@ describe('newer()', function() {
       mock({
         file1: mock.file({
           content: 'file1 content',
-          mtime: new Date(100)
+          mtime: new Date(100),
+          ctime: new Date(100)
         }),
         file2: mock.file({
           content: 'file2 content',
-          mtime: new Date(100)
+          mtime: new Date(100),
+          ctime: new Date(100)
         }),
         file3: mock.file({
           content: 'file3 content',
-          mtime: new Date(100)
+          mtime: new Date(100),
+          ctime: new Date(100)
         }),
         dest: {
           file2: mock.file({
             content: 'file2 content',
-            mtime: new Date(200)
+            mtime: new Date(200),
+            ctime: new Date(200)
           })
         }
       });
@@ -339,6 +365,27 @@ describe('newer()', function() {
 
       write(stream, paths);
     });
+
+    it('passes through two newer files, checking ctime', function(done) {
+      var stream = newer({dest: 'dest', ctime: true});
+
+      var paths = ['file1', 'file2', 'file3'];
+
+      var calls = 0;
+      stream.on('data', function(file) {
+        assert.notEqual(file.path, path.resolve('file2'));
+        ++calls;
+      });
+
+      stream.on('error', done);
+
+      stream.on('end', function() {
+        assert.equal(calls, paths.length - 1);
+        done();
+      });
+
+      write(stream, paths);
+    });
   });
 
   describe('dest dir with two newer and one older file', function() {
@@ -346,28 +393,34 @@ describe('newer()', function() {
       mock({
         file1: mock.file({
           content: 'file1 content',
-          mtime: new Date(100)
+          mtime: new Date(100),
+          ctime: new Date(100)
         }),
         file2: mock.file({
           content: 'file2 content',
-          mtime: new Date(100)
+          mtime: new Date(100),
+          ctime: new Date(100)
         }),
         file3: mock.file({
           content: 'file3 content',
-          mtime: new Date(100)
+          mtime: new Date(100),
+          ctime: new Date(100)
         }),
         dest: {
           file1: mock.file({
             content: 'file1 content',
-            mtime: new Date(150)
+            mtime: new Date(150),
+            ctime: new Date(150)
           }),
           file2: mock.file({
             content: 'file2 content',
-            mtime: new Date(50)
+            mtime: new Date(50),
+            ctime: new Date(50)
           }),
           file3: mock.file({
             content: 'file3 content',
-            mtime: new Date(150)
+            mtime: new Date(150),
+            ctime: new Date(150)
           })
         }
       });
@@ -394,6 +447,27 @@ describe('newer()', function() {
 
       write(stream, paths);
     });
+
+    it('passes through one newer file, checking ctime', function(done) {
+      var stream = newer({dest: 'dest', ctime: true});
+
+      var paths = ['file1', 'file2', 'file3'];
+
+      var calls = 0;
+      stream.on('data', function(file) {
+        assert.equal(file.path, path.resolve('file2'));
+        ++calls;
+      });
+
+      stream.on('error', done);
+
+      stream.on('end', function() {
+        assert.equal(calls, 1);
+        done();
+      });
+
+      write(stream, paths);
+    });
   });
 
   describe('dest file with first source file newer', function() {
@@ -401,20 +475,24 @@ describe('newer()', function() {
       mock({
         file1: mock.file({
           content: 'file1 content',
-          mtime: new Date(200)
+          mtime: new Date(200),
+          ctime: new Date(200)
         }),
         file2: mock.file({
           content: 'file2 content',
-          mtime: new Date(100)
+          mtime: new Date(100),
+          ctime: new Date(100)
         }),
         file3: mock.file({
           content: 'file3 content',
-          mtime: new Date(100)
+          mtime: new Date(100),
+          ctime: new Date(100)
         }),
         dest: {
           output: mock.file({
             content: 'file2 content',
-            mtime: new Date(150)
+            mtime: new Date(150),
+            ctime: new Date(150)
           })
         }
       });
@@ -441,6 +519,27 @@ describe('newer()', function() {
 
       write(stream, paths);
     });
+
+    it('passes through all source files, checking ctime', function(done) {
+      var stream = newer({dest: 'dest/output', ctime: true});
+
+      var paths = ['file1', 'file2', 'file3'];
+
+      var calls = 0;
+      stream.on('data', function(file) {
+        assert.equal(file.path, path.resolve(paths[calls]));
+        ++calls;
+      });
+
+      stream.on('error', done);
+
+      stream.on('end', function() {
+        assert.equal(calls, paths.length);
+        done();
+      });
+
+      write(stream, paths);
+    });
   });
 
   describe('dest file with second source file newer', function() {
@@ -448,20 +547,24 @@ describe('newer()', function() {
       mock({
         file1: mock.file({
           content: 'file1 content',
-          mtime: new Date(100)
+          mtime: new Date(100),
+          ctime: new Date(100)
         }),
         file2: mock.file({
           content: 'file2 content',
-          mtime: new Date(200)
+          mtime: new Date(200),
+          ctime: new Date(200)
         }),
         file3: mock.file({
           content: 'file3 content',
-          mtime: new Date(100)
+          mtime: new Date(100),
+          ctime: new Date(100)
         }),
         dest: {
           output: mock.file({
             content: 'file2 content',
-            mtime: new Date(150)
+            mtime: new Date(150),
+            ctime: new Date(150)
           })
         }
       });
@@ -488,6 +591,27 @@ describe('newer()', function() {
 
       write(stream, paths);
     });
+
+    it('passes through all source files, checking ctime', function(done) {
+      var stream = newer({dest: 'dest/output', ctime: true});
+
+      var paths = ['file1', 'file2', 'file3'];
+
+      var calls = 0;
+      stream.on('data', function(file) {
+        assert.equal(file.path, path.resolve(paths[calls]));
+        ++calls;
+      });
+
+      stream.on('error', done);
+
+      stream.on('end', function() {
+        assert.equal(calls, paths.length);
+        done();
+      });
+
+      write(stream, paths);
+    });
   });
 
   describe('dest file with last source file newer', function() {
@@ -495,20 +619,24 @@ describe('newer()', function() {
       mock({
         file1: mock.file({
           content: 'file1 content',
-          mtime: new Date(100)
+          mtime: new Date(100),
+          ctime: new Date(100)
         }),
         file2: mock.file({
           content: 'file2 content',
-          mtime: new Date(100)
+          mtime: new Date(100),
+          ctime: new Date(100)
         }),
         file3: mock.file({
           content: 'file3 content',
-          mtime: new Date(200)
+          mtime: new Date(200),
+          ctime: new Date(200)
         }),
         dest: {
           output: mock.file({
             content: 'file2 content',
-            mtime: new Date(150)
+            mtime: new Date(150),
+            ctime: new Date(150)
           })
         }
       });
@@ -535,6 +663,27 @@ describe('newer()', function() {
 
       write(stream, paths);
     });
+
+    it('passes through all source files, checking ctime', function(done) {
+      var stream = newer({dest: 'dest/output', ctime: true});
+
+      var paths = ['file1', 'file2', 'file3'];
+
+      var calls = 0;
+      stream.on('data', function(file) {
+        assert.equal(file.path, path.resolve(paths[calls]));
+        ++calls;
+      });
+
+      stream.on('error', done);
+
+      stream.on('end', function() {
+        assert.equal(calls, paths.length);
+        done();
+      });
+
+      write(stream, paths);
+    });
   });
 
   describe('dest file with no newer source files', function() {
@@ -542,20 +691,24 @@ describe('newer()', function() {
       mock({
         file1: mock.file({
           content: 'file1 content',
-          mtime: new Date(100)
+          mtime: new Date(100),
+          ctime: new Date(100)
         }),
         file2: mock.file({
           content: 'file2 content',
-          mtime: new Date(100)
+          mtime: new Date(100),
+          ctime: new Date(100)
         }),
         file3: mock.file({
           content: 'file3 content',
-          mtime: new Date(100)
+          mtime: new Date(100),
+          ctime: new Date(100)
         }),
         dest: {
           output: mock.file({
             content: 'file2 content',
-            mtime: new Date(150)
+            mtime: new Date(150),
+            ctime: new Date(150)
           })
         }
       });
@@ -582,6 +735,27 @@ describe('newer()', function() {
 
       write(stream, paths);
     });
+
+    it('passes through no source files, checking ctime', function(done) {
+      var stream = newer({dest: 'dest/output', ctime: true});
+
+      var paths = ['file1', 'file2', 'file3'];
+
+      var calls = 0;
+      stream.on('data', function() {
+        done(new Error('Expected no source files'));
+        ++calls;
+      });
+
+      stream.on('error', done);
+
+      stream.on('end', function() {
+        assert.equal(calls, 0);
+        done();
+      });
+
+      write(stream, paths);
+    });
   });
 
   describe('dest file ext and two files', function() {
@@ -589,20 +763,24 @@ describe('newer()', function() {
       mock({
         'file1.ext1': mock.file({
           content: 'file1 content',
-          mtime: new Date(100)
+          mtime: new Date(100),
+          ctime: new Date(100)
         }),
         'file2.ext1': mock.file({
           content: 'file2 content',
-          mtime: new Date(100)
+          mtime: new Date(100),
+          ctime: new Date(100)
         }),
         dest: {
           'file1.ext2': mock.file({
             content: 'file1 content',
-            mtime: new Date(100)
+            mtime: new Date(100),
+            ctime: new Date(100)
           }),
           'file2.ext2': mock.file({
             content: 'file2 content',
-            mtime: new Date(50)
+            mtime: new Date(50),
+            ctime: new Date(50)
           })
         }
       });
@@ -629,6 +807,27 @@ describe('newer()', function() {
 
       write(stream, paths);
     });
+
+    it('passes through one newer file, checking ctime', function(done) {
+      var stream = newer({dest: 'dest', ext: '.ext2', ctime: true});
+
+      var paths = ['file1.ext1', 'file2.ext1'];
+
+      var calls = 0;
+      stream.on('data', function(file) {
+        assert.equal(file.path, path.resolve('file2.ext1'));
+        ++calls;
+      });
+
+      stream.on('error', done);
+
+      stream.on('end', function() {
+        assert.equal(calls, 1);
+        done();
+      });
+
+      write(stream, paths);
+    });
   });
 
   describe('custom mapping between source and dest', function() {
@@ -636,20 +835,24 @@ describe('newer()', function() {
       mock({
         'file1.ext1': mock.file({
           content: 'file1 content',
-          mtime: new Date(100)
+          mtime: new Date(100),
+          ctime: new Date(100)
         }),
         'file2.ext1': mock.file({
           content: 'file2 content',
-          mtime: new Date(100)
+          mtime: new Date(100),
+          ctime: new Date(100)
         }),
         dest: {
           'file1.ext2': mock.file({
             content: 'file1 content',
-            mtime: new Date(100)
+            mtime: new Date(100),
+            ctime: new Date(100)
           }),
           'file2.ext2': mock.file({
             content: 'file2 content',
-            mtime: new Date(50)
+            mtime: new Date(50),
+            ctime: new Date(50)
           })
         }
       });
@@ -682,6 +885,33 @@ describe('newer()', function() {
       write(stream, paths);
     });
 
+    it('passes through one newer file, checking ctime', function(done) {
+      var stream = newer({
+        dest: 'dest',
+        map: function(destPath) {
+          return destPath.replace('.ext1', '.ext2');
+        },
+        ctime: true
+      });
+
+      var paths = ['file1.ext1', 'file2.ext1'];
+
+      var calls = 0;
+      stream.on('data', function(file) {
+        assert.equal(file.path, path.resolve('file2.ext1'));
+        ++calls;
+      });
+
+      stream.on('error', done);
+
+      stream.on('end', function() {
+        assert.equal(calls, 1);
+        done();
+      });
+
+      write(stream, paths);
+    });
+
     it('allows people to join to dest themselves', function(done) {
       var stream = newer({
         map: function(destPath) {

Debdiff

File lists identical (after any substitutions)

No differences were encountered in the control files

More details

Full run details