Socket
Socket
Sign inDemoInstall

broccoli-persistent-filter

Package Overview
Dependencies
Maintainers
3
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

broccoli-persistent-filter - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

19

index.js

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

var name = 'cauliflower-filter:' + (this.constructor.name);
var name = 'broccoli-persistent-filter:' + (this.constructor.name);
if (this.description) {

@@ -204,2 +204,8 @@ name += ' > [' + this.description + ']';

function invoke(context, fn, args) {
return new Promise(function(resolve) {
resolve(fn.apply(context, args));
});
}
Filter.prototype.processFile =

@@ -210,9 +216,10 @@ function processFile(srcDir, destDir, relativePath) {

var outputEncoding = this.outputEncoding;
if (inputEncoding === void 0) inputEncoding = 'utf8';
if (outputEncoding === void 0) outputEncoding = 'utf8';
if (inputEncoding === void 0) { inputEncoding = 'utf8'; }
if (outputEncoding === void 0) { outputEncoding = 'utf8'; }
var contents = fs.readFileSync(
srcDir + '/' + relativePath, { encoding: inputEncoding });
return this.processor.processString(this, contents, relativePath).then(function asyncOutputFilteredFile(result) {
var outputString = result.string;
var string = invoke(this.processor, this.processor.processString, [this, contents, relativePath]);
return string.then(function asyncOutputFilteredFile(outputString) {
var outputPath = self.getDestFilePath(relativePath);

@@ -227,4 +234,2 @@ if (outputPath == null) {

});
return self.processor.done(self, result);
});

@@ -231,0 +236,0 @@ };

@@ -19,6 +19,2 @@ function Processor(options) {

Processor.prototype.done = function(ctx, result) {
return this.processor.done(ctx, result);
};
module.exports = Processor;

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

var Promise = require('rsvp').Promise;
'use strict';

@@ -7,8 +7,4 @@ module.exports = {

processString: function(ctx, contents, relativePath) {
return Promise.resolve({ string: ctx.processString(contents, relativePath) });
},
done: function(ctx) {
return Promise.resolve(ctx.outputPath);
return ctx.processString(contents, relativePath);
}
};

@@ -1,9 +0,7 @@

'use strict';
var md5Hex = require('md5-hex');
var AsyncDiskCache = require('async-disk-cache');
var Promise = require('rsvp').Promise;
module.exports = {
_peristentCache: {},
_cache: {},

@@ -15,3 +13,3 @@ init: function(ctx) {

this._peristentCache = new AsyncDiskCache(ctx.constructor._persistentCacheKey, {
this._cache = new AsyncDiskCache(ctx.constructor._persistentCacheKey, {
compression: 'deflate'

@@ -27,24 +25,18 @@ });

var key = ctx.cacheKeyProcessString(contents, relativePath);
return this._peristentCache.get(key).then(function(entry) {
var result;
var cache = this._cache;
return cache.get(key).then(function(entry) {
if (entry.isCached) {
result = {
string: entry.value,
key: key
};
return entry.value;
} else {
result = {
string: ctx.processString(contents, relativePath),
key: key
};
var string = Promise.resolve(ctx.processString(contents, relativePath));
string.then(function(string) {
return cache.set(key, string).then(function() {
return string;
});
});
}
return result;
});
},
done: function(ctx, result) {
return this._peristentCache.set(result.key, result.string);
}
};
{
"name": "broccoli-persistent-filter",
"version": "1.0.4",
"version": "1.0.5",
"description": "broccoli filter but with a persistent cache",

@@ -5,0 +5,0 @@ "author": "Stefan Penner <stefan.penner@gmail.com>",

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