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

defiler

Package Overview
Dependencies
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

defiler - npm Package Compare versions

Comparing version 0.1.2 to 0.2.0

5

CHANGELOG.md

@@ -0,1 +1,6 @@

# v0.2.0
- Send file changes through a queue, so we're only processing one at a time
- Don't lose changes that come in after Gazes are initialized but before first wave of processing is complete
# v0.1.2

@@ -2,0 +7,0 @@

38

dist/index.cjs.js

@@ -81,2 +81,5 @@ 'use strict';

this._dependencies = new Map();
this._processing = false;
this._queue = [];
}

@@ -145,2 +148,3 @@

this._checkBeforeExec('exec');
this._processing = true;
this._ready = new Promise(async res => {

@@ -171,17 +175,11 @@ await Promise.all(this._gazePromises);

await Promise.all(promises);
for (let { gaze, rootPath, read } of this._gazes) {
gaze.on('all', (event, absolutePath) => {
if (event === 'deleted') {
let path$$1 = Defiler._relativePath(rootPath, absolutePath);
this._origFiles.delete(path$$1);
this._files.delete(path$$1);
this.emit('deleted', path$$1);
} else {
this._processPhysicalFile(absolutePath, rootPath, read);
}
this._queue.push({ event, absolutePath, rootPath, read });
this._checkQueue();
});
}
await Promise.all(promises);
this.on('file', file => {

@@ -201,2 +199,3 @@ let origins = new Set();

this._filePromises = null;
this._processing = false;
res();

@@ -266,2 +265,21 @@ });

async _checkQueue() {
if (this._processing) {
return
}
this._processing = true;
while (this._queue.length) {
let { event, absolutePath, rootPath, read } = this._queue.shift();
if (event === 'deleted') {
let path$$1 = Defiler._relativePath(rootPath, absolutePath);
this._origFiles.delete(path$$1);
this._files.delete(path$$1);
this.emit('deleted', path$$1);
} else {
await this._processPhysicalFile(absolutePath, rootPath, read);
}
}
this._processing = false;
}
async _processPhysicalFile(absolutePath, rootPath, read) {

@@ -268,0 +286,0 @@ let fileStat = await new Promise((res, rej) => fs.stat(absolutePath, (err, data) => (err ? rej(err) : res(data))));

@@ -77,2 +77,5 @@ import EventEmitter from 'events';

this._dependencies = new Map();
this._processing = false;
this._queue = [];
}

@@ -141,2 +144,3 @@

this._checkBeforeExec('exec');
this._processing = true;
this._ready = new Promise(async res => {

@@ -167,17 +171,11 @@ await Promise.all(this._gazePromises);

await Promise.all(promises);
for (let { gaze, rootPath, read } of this._gazes) {
gaze.on('all', (event, absolutePath) => {
if (event === 'deleted') {
let path$$1 = Defiler._relativePath(rootPath, absolutePath);
this._origFiles.delete(path$$1);
this._files.delete(path$$1);
this.emit('deleted', path$$1);
} else {
this._processPhysicalFile(absolutePath, rootPath, read);
}
this._queue.push({ event, absolutePath, rootPath, read });
this._checkQueue();
});
}
await Promise.all(promises);
this.on('file', file => {

@@ -197,2 +195,3 @@ let origins = new Set();

this._filePromises = null;
this._processing = false;
res();

@@ -262,2 +261,21 @@ });

async _checkQueue() {
if (this._processing) {
return
}
this._processing = true;
while (this._queue.length) {
let { event, absolutePath, rootPath, read } = this._queue.shift();
if (event === 'deleted') {
let path$$1 = Defiler._relativePath(rootPath, absolutePath);
this._origFiles.delete(path$$1);
this._files.delete(path$$1);
this.emit('deleted', path$$1);
} else {
await this._processPhysicalFile(absolutePath, rootPath, read);
}
}
this._processing = false;
}
async _processPhysicalFile(absolutePath, rootPath, read) {

@@ -264,0 +282,0 @@ let fileStat = await new Promise((res, rej) => stat(absolutePath, (err, data) => (err ? rej(err) : res(data))));

{
"name": "defiler",
"version": "0.1.2",
"version": "0.2.0",
"description": "A small, strange building block",

@@ -5,0 +5,0 @@ "main": "./dist/index.cjs.js",

@@ -35,7 +35,7 @@ # Defiler

## Documents
## Documentation
- [API](https://github.com/Conduitry/defiler/blob/master/API.md)
- [CHANGELOG](https://github.com/Conduitry/defiler/blob/master/CHANGELOG.md)
- [TODO](https://github.com/Conduitry/defiler/blob/master/TODO.md)
- [api](https://github.com/Conduitry/defiler/blob/master/API.md#readme)
- [changelog](https://github.com/Conduitry/defiler/blob/master/CHANGELOG.md#readme)
- [todo](https://github.com/Conduitry/defiler/blob/master/TODO.md#readme)

@@ -46,2 +46,2 @@ ## License

- [MIT License](https://github.com/Conduitry/defiler/blob/master/LICENSE)
- [MIT](https://github.com/Conduitry/defiler/blob/master/LICENSE)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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