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

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.1.4 to 1.1.5

30

index.js

@@ -86,6 +86,5 @@ 'use strict';

case 'change':
fs.unlinkSync(outputFilePath);
return this._handleFile(relativePath, srcDir, destDir, entry, outputFilePath);
return this._handleFile(relativePath, srcDir, destDir, entry, outputFilePath, true);
case 'create':
return this._handleFile(relativePath, srcDir, destDir, entry, outputFilePath);
return this._handleFile(relativePath, srcDir, destDir, entry, outputFilePath, false);
}

@@ -95,6 +94,9 @@ }, this);

Filter.prototype._handleFile = function(relativePath, srcDir, destDir, entry, outputPath) {
Filter.prototype._handleFile = function(relativePath, srcDir, destDir, entry, outputPath, isChange) {
if (this.canProcessFile(relativePath)) {
return this.processAndCacheFile(srcDir, destDir, entry);
return this.processAndCacheFile(srcDir, destDir, entry, isChange);
} else {
if (isChange) {
fs.unlinkSync(outputPath);
}
var srcPath = srcDir + '/' + relativePath;

@@ -163,3 +165,3 @@ return symlinkOrCopySync(srcPath, outputPath);

Filter.prototype.processAndCacheFile = function(srcDir, destDir, entry) {
Filter.prototype.processAndCacheFile = function(srcDir, destDir, entry, isChange) {
var filter = this;

@@ -170,3 +172,3 @@ var relativePath = entry.relativePath;

then(function asyncProcessFile() {
return filter.processFile(srcDir, destDir, relativePath);
return filter.processFile(srcDir, destDir, relativePath, isChange);
}).

@@ -191,3 +193,3 @@ then(undefined,

Filter.prototype.processFile = function(srcDir, destDir, relativePath) {
Filter.prototype.processFile = function(srcDir, destDir, relativePath, isChange) {
var filter = this;

@@ -218,2 +220,12 @@ var inputEncoding = this.inputEncoding;

if (isChange) {
var isSame = fs.readFileSync(outputPath, 'UTF-8') === outputString;
if (isSame) {
this._debug('[change:%s] but was the same, skipping', relativePath, isSame);
return;
} else {
this._debug('[change:%s] but was NOT the same, writing new file', relativePath);
}
}
try {

@@ -233,3 +245,3 @@ fs.writeFileSync(outputPath, outputString, {

return outputString;
});
}.bind(this));
};

@@ -236,0 +248,0 @@

{
"name": "broccoli-persistent-filter",
"version": "1.1.4",
"version": "1.1.5",
"description": "broccoli filter but with a persistent cache",

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

"rimraf": "^2.4.2",
"sinon": "^1.15.3"
"sinon": "^1.15.3",
"sinon-chai": "^2.8.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