Detect changes to a Browserify bundle's source files
Browserify-hash detects changes in a Browserify bundle's source files by generating and comparing a hash for the entry module and its dependency tree.
Begin by requiring browserify-hash:
var bsfyHash = require( 'browserify-hash' );
/**
* Returns if a bundle's source files have changed given its entry module. Hits
* return false, misses return true. First-runs are always misses.
*
* @param {String} entryFile - Path to the Browserify bundle's entry-point
* source file
* @param {Function} cb - Callback to call with encountered errors, and
* the resulting hash
*
* @param {Object} opts - Options object
* @param {Object} [opts.skipMissing=true] - Consider mising files unchanged.
* @param {String} [hashFile='.bsfy-hash'] - JSON file to store the hashes to
* detect changes between runs
* @param {Array} [opts.exclude=[]] - Dependencies to exclude from
* consideration
* @param {Array} [opts.include=[]] - Additional files to include in the
* dep tree
*/
/**
* Generate a hash representing a Browserify bundle's source files.
*
* @param {String} entryFile - Path to the Browserify bundle's entry-point
* source file
* @param {Function} cb - Callback to call with encountered errors, the
* resulting hash, and the raw dependency path ->
* source hash object
*
* @param {Object} opts - Options object
* @param {Object} [opts.bsfy=browserify()] - Provide your own configured
* Browserify instance.
* @param {Array} [opts.exclude=[]] - Dependencies to exclude from
* consideration, e.g., `lodash`, which
* can degrade performance
* @param {Array} [opts.include=[]] - Additional files to include in the
* dep tree
*/
MIT