New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

broccoli-caching-writer

Package Overview
Dependencies
Maintainers
1
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 0.5.0 to 0.5.1

25

CHANGELOG.md

@@ -0,2 +1,27 @@

## 0.5.1
* Allow easy inheritance. In your package's `index.js`:
```javascript
var CachingWriter = require('broccoli-caching-writer');
module.exports = CachingWriter.extend({
init: function(inputTrees, options) {
/* do additional setup here */
},
updateCache: function(srcPaths, destDir) {
/* do main processing */
}
});
```
Then in a consuming Brocfile:
```javascript
var MyFoo = require('my-foo'); // package from above
var tree = new MyFoo([someInput], { some: 'options' });
```
## 0.5.0

@@ -3,0 +28,0 @@

2

index.js

@@ -10,2 +10,3 @@ var fs = require('fs');

var generateRandomString = require('./lib/generate-random-string');
var CoreObject = require("core-object");

@@ -58,2 +59,3 @@ function CachingWriter (inputTrees, options) {

};
CachingWriter.__proto__ = CoreObject;
CachingWriter.prototype.constructor = CachingWriter;

@@ -60,0 +62,0 @@

3

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

@@ -21,2 +21,3 @@ "main": "index.js",

"broccoli-kitchen-sink-helpers": "^0.2.5",
"core-object": "0.0.2",
"promise-map-series": "^0.2.0",

@@ -23,0 +24,0 @@ "quick-temp": "^0.1.2",

@@ -57,3 +57,33 @@ # Broccoli Caching Writer

## Inheritance
broccoli-caching-writer inherits from [core-object](https://github.com/stefanpenner/core-object) to allow super simple
inheritance. You can still absolutely use the standard prototypal inheritance, but as you can see below there may be no
need.
Make an `index.js` for your package:
```javascript
var CachingWriter = require('broccoli-caching-writer');
module.exports = CachingWriter.extend({
init: function(inputTrees, options) {
/* do additional setup here */
},
updateCache: function(srcPaths, destDir) {
/* do main processing */
}
});
```
Then in a consuming Brocfile:
```javascript
var MyFoo = require('my-foo'); // package from above
var tree = new MyFoo([someInput], { some: 'options' });
```
## ZOMG!!! TESTS?!?!!?

@@ -60,0 +90,0 @@

@@ -368,2 +368,34 @@ 'use strict';

});
describe('extend', function() {
it('sets the methods correctly', function() {
var TestPlugin = cachingWriter.extend({
foo: function() {}
});
expect(TestPlugin).to.be.a(Function);
expect(TestPlugin.prototype.foo).to.be.a(Function);
});
it('calls CachingWriter constructor', function () {
var MyPlugin = cachingWriter.extend({});
var instance = new MyPlugin("foo");
expect(instance.inputTrees).to.eql(["foo"]);
});
it('can write files to destDir, and they will be in the final output', function(){
var TestWriter = cachingWriter.extend({
updateCache: function(srcDir, destDir) {
fs.writeFileSync(destDir + '/something-cooler.js', 'whoa', {encoding: 'utf8'});
}
});
var tree = new TestWriter(sourcePath);
builder = new broccoli.Builder(tree);
return builder.build().then(function(result) {
var dir = result.directory;
expect(fs.readFileSync(dir + '/something-cooler.js', {encoding: 'utf8'})).to.eql('whoa');
});
});
});
});
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