No description or website provided.
Switch branches/tags
greenkeeper-walk-sync-0.3.1 greenkeeper/broccoli-1.0.0 greenkeeper/broccoli-1.1.0 greenkeeper/broccoli-1.1.1 greenkeeper/broccoli-1.1.2 greenkeeper/broccoli-1.1.3 greenkeeper/broccoli-1.1.4 greenkeeper/broccoli-2.0.0 greenkeeper/broccoli-2.0.1 greenkeeper/broccoli-plugin-1.3.1 greenkeeper/broccoli-plugin-pin-1.3.0 greenkeeper/chai-4.0.0 greenkeeper/chai-4.0.2 greenkeeper/chai-4.1.0 greenkeeper/chai-4.1.1 greenkeeper/chai-4.1.2 greenkeeper/chai-as-promised-7.0.0 greenkeeper/chai-as-promised-7.1.0 greenkeeper/chai-as-promised-7.1.1 greenkeeper/debug-3.1.0 greenkeeper/debug-3.2.0 greenkeeper/debug-3.2.1 greenkeeper/debug-3.2.2 greenkeeper/debug-3.2.3 greenkeeper/debug-4.0.0 greenkeeper/debug-4.0.1 greenkeeper/debug-4.1.0 greenkeeper/mocha-3.4.2 greenkeeper/mocha-3.5.0 greenkeeper/mocha-3.5.1 greenkeeper/mocha-3.5.2 greenkeeper/mocha-3.5.3 greenkeeper/mocha-4.0.0 greenkeeper/mocha-4.0.1 greenkeeper/mocha-4.1.0 greenkeeper/mocha-5.0.0 greenkeeper/mocha-5.0.1 greenkeeper/mocha-5.0.2 greenkeeper/mocha-5.0.3 greenkeeper/mocha-5.0.4 greenkeeper/mocha-5.0.5 greenkeeper/mocha-5.1.0 greenkeeper/mocha-5.1.1 greenkeeper/mocha-5.2.0 greenkeeper/mocha-pin-3.4.1 greenkeeper/rimraf-2.6.2 greenkeeper/rimraf-pin-2.6.1 greenkeeper/rsvp-3.6.0 greenkeeper/rsvp-4.6.1 greenkeeper/rsvp-4.7.0 greenkeeper/rsvp-4.8.0 greenkeeper/rsvp-4.8.1 greenkeeper/rsvp-4.8.2 greenkeeper/rsvp-4.8.3 greenkeeper/rsvp-4.8.4 greenkeeper/rsvp-pin-3.5.0 greenkeeper/walk-sync-0.3.2 greenkeeper/walk-sync-0.3.3 greenkeeper/walk-sync-pin-0.3.1 greenkeeper/walk-sync-pin-0.3.2 improved-eviction-loggin logging master rebuild rebuild2
Nothing to show
Clone or download
stefanpenner Merge pull request #94 from ember-cli/greenkeeper/debug-3.0.0
Update debug to the latest version 🚀
Latest commit 1880cf5 Aug 24, 2017

README.md

Broccoli Caching Writer

Build Status Build status

Drop-in-replacement for broccoli-plugin adding a thin caching layer based on the computed hash of the input directory trees. If any file in an input node has changed, the build method will be called, otherwise (if input is the same) the results of the last build call will be used instead.

Example

var Plugin = require('broccoli-caching-writer');

MyPlugin.prototype = Object.create(Plugin.prototype);
MyPlugin.prototype.constructor = MyPlugin;
function MyPlugin(inputNodes, options) {
  options = options || {};
  // options.inputFiles === array of globs, to consider for the cache key
  Plugin.call(this, inputNodes, {
    annotation: options.annotation
  });
}

MyPlugin.prototype.build = function() {
  // cache has been busted
  // do anything, for example:
  //   1. read from this.inputPaths
  //   2. do something based on the result
  //   3. and then, write to this.outputPath
};

Documentation

new CachingWriter(inputNodes, options)

Call this base class constructor from your subclass constructor.

  • inputNodes: An array of input nodes.

  • options:

    • name, annotation, persistentOutput: Same as broccoli-plugin; see there.

    • cacheInclude (default: []): An array of regular expressions that files and directories in an input node must pass (match at least one pattern) in order to be included in the cache hash for rebuilds. In other words, a whitelist of patterns that identify which files and/or directories can trigger a rebuild.

    • cacheExclude (default: []): An array of regular expressions that files and directories in an input node cannot pass in order to be included in the cache hash for rebuilds. In other words, a blacklist of patterns that identify which files and/or directories will never trigger a rebuild.

      Note, in the case when a file or directory matches both an include and exlude pattern, the exclude pattern wins

plugin.listFiles

list files matched, helpful as it allows us avoid a second glob, lexicographically sorted by relativePath.

plugin.listEntries

list entries (stat objects) of files matched, helpful when further FS information is required on rebuild, lexicographically sorted by relativePath.

ZOMG!!! TESTS?!?!!?

I know, right?

Running the tests:

npm install
npm test

License

This project is distributed under the MIT license.