Gulp meta-plugin for comparing snapshots of Gulp stream states.
This doesn't touch file contents, it informs you when other things do.
If you'd like save and restore snapshots instead of comparing them, check out gulp-save.
$ npm install gulp-snapshot
var gulp = ;var snapshot = ;var somePlugin = ;gulp;
compare will always compare the last two snapshots taken. Taking three or more snapshots in a row will discard the older ones.
Streamed file contents are supported.
For the callback provided to
this is set to the Gulp stream.
Sadly it doesn't perform a text diff on file contents (yet).
The callback you provide to compare is called with an object like this. All strings are file paths.
/** Files present in the second snapshot that weren't in the first */addedFiles: String;/** Files present in the first snapshot that aren't in the second */removedFiles: String;/** Files with the same unique contents but a changed path, i.e. renames */movedFiles:was: Stringis: String;/** Files with the same non-unique contents given a new path */copiedFiles:was: Stringis: String;/** Files with the same path but changed contents */changedFiles: String;/** True if snapshots are identical (all change collections are empty) */noChanges: Boolean;
Files with null contents are treated as not present in the stream for comparison purposes. So if a plugin nulls out a file's contents, it is treated as a removal, and if it gives a null file content, it is treated as an addition.
Files are compared by hashing their contents with SHA1. Any change in file contents, whether it's whitespace, a BOM, or a single character, will result in a different hash and trigger a
copiedFiles entry specifies originals as an array of paths because of the possibility of multiple identical source files. If you've got duplicate files in the stream on either end of a comparison, the output will be as explicit as possible and won't make any assumptions or take any guesses.
Here's a verbose example that annotates a build pipeline involving gulp-less and gulp-autoprefixer operating on a couple LESS files.
var gulp = ;var less = ;var prefix =var snapshot =gulp;
MIT License (Expat)