Socket
Socket
Sign inDemoInstall

broccoli-persistent-filter

Package Overview
Dependencies
Maintainers
4
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.3.0 to 1.3.1

85

index.js

@@ -6,2 +6,3 @@ 'use strict';

var mkdirp = require('mkdirp');
var rimraf = require('rimraf');
var Promise = require('rsvp').Promise;

@@ -17,3 +18,2 @@ var Plugin = require('broccoli-plugin');

var hashForDep = require('hash-for-dep');
var BlankObject = require('blank-object');
var FSTree = require('fs-tree-diff');

@@ -87,4 +87,5 @@ var heimdall = require('heimdalljs');

this._canProcessCache = new BlankObject();
this._destFilePathCache = new BlankObject();
this._canProcessCache = Object.create(null);
this._destFilePathCache = Object.create(null);
this._needsReset = false;
}

@@ -103,2 +104,10 @@

Filter.prototype.build = function() {
if (this._needsReset) {
this.currentTree = new FSTree();
rimraf.sync(this.outputPath);
mkdirp.sync(this.outputPath);
}
this._needsReset = true;
var srcDir = this.inputPaths[0];

@@ -114,3 +123,3 @@ var destDir = this.outputPath;

var nextTree = new FSTree.fromEntries(entries);
var nextTree = FSTree.fromEntries(entries);
var currentTree = this.currentTree;

@@ -132,41 +141,47 @@

instrumentation.stop();
var plugin = this;
return heimdall.node('applyPatches', ApplyPatchesSchema, function(instrumentation) {
var prevTime = process.hrtime();
return new Promise(function(resolve) {
resolve(heimdall.node('applyPatches', ApplyPatchesSchema, function(instrumentation) {
var prevTime = process.hrtime();
var result = mapSeries(patches, function(patch) {
var operation = patch[0];
var relativePath = patch[1];
var entry = patch[2];
var outputPath = destDir + '/' + (this.getDestFilePath(relativePath) || relativePath);
var outputFilePath = outputPath;
var result = mapSeries(patches, function(patch) {
var operation = patch[0];
var relativePath = patch[1];
var entry = patch[2];
var outputPath = destDir + '/' + (plugin.getDestFilePath(relativePath) || relativePath);
var outputFilePath = outputPath;
this._logger.debug('[operation:%s] %s', operation, relativePath);
plugin._logger.debug('[operation:%s] %s', operation, relativePath);
switch (operation) {
case 'mkdir': {
instrumentation.mkdir++;
return fs.mkdirSync(outputPath);
} case 'rmdir': {
instrumentation.rmdir++;
return fs.rmdirSync(outputPath);
} case 'unlink': {
instrumentation.unlink++;
return fs.unlinkSync(outputPath);
} case 'change': {
instrumentation.change++;
return this._handleFile(relativePath, srcDir, destDir, entry, outputFilePath, true, instrumentation);
} case 'create': {
instrumentation.create++;
return this._handleFile(relativePath, srcDir, destDir, entry, outputFilePath, false, instrumentation);
} default: {
instrumentation.other++;
switch (operation) {
case 'mkdir': {
instrumentation.mkdir++;
return fs.mkdirSync(outputPath);
} case 'rmdir': {
instrumentation.rmdir++;
return fs.rmdirSync(outputPath);
} case 'unlink': {
instrumentation.unlink++;
return fs.unlinkSync(outputPath);
} case 'change': {
instrumentation.change++;
return plugin._handleFile(relativePath, srcDir, destDir, entry, outputFilePath, true, instrumentation);
} case 'create': {
instrumentation.create++;
return plugin._handleFile(relativePath, srcDir, destDir, entry, outputFilePath, false, instrumentation);
} default: {
instrumentation.other++;
}
}
}
}, this);
});
this._logger.info('applyPatches', 'duration:', timeSince(prevTime), JSON.stringify(instrumentation));
plugin._logger.info('applyPatches', 'duration:', timeSince(prevTime), JSON.stringify(instrumentation));
return result;
}));
}).then(function(result) {
plugin._needsReset = false;
return result;
}, this);
});
};

@@ -173,0 +188,0 @@

{
"name": "broccoli-persistent-filter",
"version": "1.3.0",
"version": "1.3.1",
"description": "broccoli filter but with a persistent cache",

@@ -36,3 +36,2 @@ "author": "Stefan Penner <stefan.penner@gmail.com>",

"async-disk-cache": "^1.2.1",
"blank-object": "^1.0.1",
"broccoli-plugin": "^1.0.0",

@@ -46,2 +45,3 @@ "fs-tree-diff": "^0.5.2",

"promise-map-series": "^0.2.1",
"rimraf": "^2.6.1",
"rsvp": "^3.0.18",

@@ -53,5 +53,7 @@ "symlink-or-copy": "^1.0.1",

"broccoli-test-helpers": "^0.0.9",
"broccoli-test-helper": "^1.1.0",
"chai": "^3.5.0",
"chai-as-promised": "^6.0.0",
"chai-files": "^1.4.0",
"co": "^4.6.0",
"coveralls": "^2.11.10",

@@ -62,3 +64,2 @@ "istanbul": "^0.4.2",

"mocha-jshint": "^2.3.1",
"rimraf": "^2.5.4",
"sinon": "^1.15.3",

@@ -65,0 +66,0 @@ "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