Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

broccoli-caching-writer

Package Overview
Dependencies
Maintainers
2
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

broccoli-caching-writer - npm Package Compare versions

Comparing version 2.2.0 to 2.2.1

2

index.js

@@ -9,3 +9,3 @@ 'use strict';

var symlinkOrCopy = require('symlink-or-copy');
var assign = require('lodash-node/modern/object/assign');
var assign = require('lodash.assign');
var Plugin = require('broccoli-plugin');

@@ -12,0 +12,0 @@ var debugGenerator = require('debug');

{
"name": "broccoli-caching-writer",
"version": "2.2.0",
"version": "2.2.1",
"description": "Broccoli plugin that allows simple caching (while still allowing N:N) based on the input tree hash.",

@@ -24,3 +24,3 @@ "main": "index.js",

"debug": "^2.1.1",
"lodash-node": "^3.2.0",
"lodash.assign": "^3.2.0",
"rimraf": "^2.2.8",

@@ -27,0 +27,0 @@ "rsvp": "^3.0.17",

@@ -7,3 +7,3 @@ # Broccoli Caching Writer

Drop-in-replacement for
[broccoli-plugin](https://github.com/broccolijs/broccoli-plugin) adding a thin
[broccoli-writer](https://github.com/broccolijs/broccoli-writer) adding a thin
caching layer based on the computed hash of the input directory trees. If any

@@ -16,6 +16,5 @@ file in an input node has changed, the `build` method will be called,

Say your plugin derives from `Plugin` like so:
```js
var Plugin = require('broccoli-plugin');
var Plugin = require('broccoli-caching-writer');

@@ -26,2 +25,3 @@ MyPlugin.prototype = Object.create(Plugin.prototype);

options = options || {};
// options.inputFiles === array of globs, to consider for the cache key
Plugin.call(this, inputNodes, {

@@ -31,20 +31,12 @@ annotation: options.annotation

}
```
To add caching, simply replace `Plugin` with `CachingWriter`, like so:
```js
var CachingWriter = require('broccoli-caching-writer');
MyPlugin.prototype = Object.create(CachingWriter.prototype);
MyPlugin.prototype.constructor = MyPlugin;
function MyPlugin(inputNodes, options) {
options = options || {};
CachingWriter.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

@@ -70,3 +62,8 @@

## `plugin.listFiles`
list files matched, helpful as it allows us avoid a second glob
## `plugin.listEntries`
list entries (stat objects) of files matched, helpful when further FS information is required on rebuild.
## ZOMG!!! TESTS?!?!!?

@@ -73,0 +70,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc