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

sane

Package Overview
Dependencies
Maintainers
3
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sane - npm Package Compare versions

Comparing version 4.1.0 to 5.0.0

30

package.json
{
"name": "sane",
"version": "4.1.0",
"version": "5.0.0",
"description": "Sane aims to be fast, small, and reliable file system watcher.",

@@ -32,8 +32,8 @@ "main": "index.js",

"@cnakazawa/watch": "^1.0.3",
"anymatch": "^2.0.0",
"anymatch": "^3.1.1",
"capture-exit": "^2.0.0",
"exec-sh": "^0.3.2",
"execa": "^1.0.0",
"fb-watchman": "^2.0.0",
"micromatch": "^3.1.4",
"exec-sh": "^0.3.4",
"execa": "^4.0.0",
"fb-watchman": "^2.0.1",
"micromatch": "^4.0.2",
"minimist": "^1.1.1",

@@ -43,10 +43,10 @@ "walker": "~1.0.5"

"devDependencies": {
"eslint": "^5.15.1",
"mocha": "^6.0.2",
"prettier": "^1.16.4",
"rimraf": "~2.6.3",
"tmp": "0.0.33"
"eslint": "^6.8.0",
"mocha": "^6.2.2",
"prettier": "^1.19.1",
"rimraf": "~3.0.0",
"tmp": "0.1.0"
},
"engines": {
"node": "6.* || 8.* || >= 10.*"
"node": "10.* || >= 12.*"
},

@@ -56,3 +56,7 @@ "bugs": {

},
"homepage": "https://github.com/amasad/sane"
"homepage": "https://github.com/amasad/sane",
"volta": {
"node": "12.16.1",
"yarn": "1.22.4"
}
}

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

[![CircleCI](https://circleci.com/gh/amasad/sane.svg?style=svg)](https://circleci.com/gh/amasad/sane)
[![Try on repl.it](https://repl-badge.jajoosam.repl.co/try.png)](https://repl.it/@amasad/sane-playground)
![CI](https://github.com/amasad/sane/workflows/CI/badge.svg)

@@ -3,0 +4,0 @@ sane

@@ -220,29 +220,26 @@ 'use strict';

let c = 0;
Object.keys(this.dirRegistery[dir]).forEach(function(file, i, arr) {
fs.lstat(
path.join(dir, file),
function(error, stat) {
if (found) {
return;
}
Object.keys(this.dirRegistery[dir]).forEach((file, i, arr) => {
fs.lstat(path.join(dir, file), (error, stat) => {
if (found) {
return;
}
if (error) {
if (isIgnorableFileError(error)) {
found = true;
callback(file);
} else {
this.emit('error', error);
}
if (error) {
if (isIgnorableFileError(error)) {
found = true;
callback(file);
} else {
if (stat.mtime > closest.mtime) {
stat.file = file;
closest = stat;
}
if (arr.length === ++c) {
callback(closest.file);
}
this.emit('error', error);
}
}.bind(this)
);
}, this);
} else {
if (stat.mtime > closest.mtime) {
stat.file = file;
closest = stat;
}
if (arr.length === ++c) {
callback(closest.file);
}
}
});
});
}

@@ -261,11 +258,7 @@

if (!file) {
this.detectChangedFile(
dir,
event,
function(actualFile) {
if (actualFile) {
this.processChange(dir, event, actualFile);
}
}.bind(this)
);
this.detectChangedFile(dir, event, actualFile => {
if (actualFile) {
this.processChange(dir, event, actualFile);
}
});
} else {

@@ -289,41 +282,38 @@ this.processChange(dir, event, path.normalize(file));

fs.lstat(
fullPath,
function(error, stat) {
if (error && error.code !== 'ENOENT') {
this.emit('error', error);
} else if (!error && stat.isDirectory()) {
// win32 emits usless change events on dirs.
if (event !== 'change') {
this.watchdir(fullPath);
if (
common.isFileIncluded(
this.globs,
this.dot,
this.doIgnore,
relativePath
)
) {
this.emitEvent(ADD_EVENT, relativePath, stat);
}
fs.lstat(fullPath, (error, stat) => {
if (error && error.code !== 'ENOENT') {
this.emit('error', error);
} else if (!error && stat.isDirectory()) {
// win32 emits usless change events on dirs.
if (event !== 'change') {
this.watchdir(fullPath);
if (
common.isFileIncluded(
this.globs,
this.dot,
this.doIgnore,
relativePath
)
) {
this.emitEvent(ADD_EVENT, relativePath, stat);
}
}
} else {
let registered = this.registered(fullPath);
if (error && error.code === 'ENOENT') {
this.unregister(fullPath);
this.stopWatching(fullPath);
this.unregisterDir(fullPath);
if (registered) {
this.emitEvent(DELETE_EVENT, relativePath);
}
} else if (registered) {
this.emitEvent(CHANGE_EVENT, relativePath, stat);
} else {
let registered = this.registered(fullPath);
if (error && error.code === 'ENOENT') {
this.unregister(fullPath);
this.stopWatching(fullPath);
this.unregisterDir(fullPath);
if (registered) {
this.emitEvent(DELETE_EVENT, relativePath);
}
} else if (registered) {
this.emitEvent(CHANGE_EVENT, relativePath, stat);
} else {
if (this.register(fullPath)) {
this.emitEvent(ADD_EVENT, relativePath, stat);
}
if (this.register(fullPath)) {
this.emitEvent(ADD_EVENT, relativePath, stat);
}
}
}.bind(this)
);
}
});
}

@@ -347,35 +337,24 @@

clearTimeout(this.changeTimers[key]);
this.changeTimers[key] = setTimeout(
function() {
delete this.changeTimers[key];
if (type === ADD_EVENT && stat.isDirectory()) {
// Recursively emit add events and watch for sub-files/folders
common.recReaddir(
path.resolve(this.root, file),
function emitAddDir(dir, stats) {
this.watchdir(dir);
this.rawEmitEvent(
ADD_EVENT,
path.relative(this.root, dir),
stats
);
}.bind(this),
function emitAddFile(file, stats) {
this.register(file);
this.rawEmitEvent(
ADD_EVENT,
path.relative(this.root, file),
stats
);
}.bind(this),
function endCallback() {},
this.checkedEmitError,
this.ignored
);
} else {
this.rawEmitEvent(type, file, stat);
}
}.bind(this),
DEFAULT_DELAY
);
this.changeTimers[key] = setTimeout(() => {
delete this.changeTimers[key];
if (type === ADD_EVENT && stat.isDirectory()) {
// Recursively emit add events and watch for sub-files/folders
common.recReaddir(
path.resolve(this.root, file),
function emitAddDir(dir, stats) {
this.watchdir(dir);
this.rawEmitEvent(ADD_EVENT, path.relative(this.root, dir), stats);
}.bind(this),
function emitAddFile(file, stats) {
this.register(file);
this.rawEmitEvent(ADD_EVENT, path.relative(this.root, file), stats);
}.bind(this),
function endCallback() {},
this.checkedEmitError,
this.ignored
);
} else {
this.rawEmitEvent(type, file, stat);
}
}, DEFAULT_DELAY);
}

@@ -382,0 +361,0 @@

@@ -21,3 +21,3 @@ /*

let allPrefixes = ['write', 'rename', 'remove', 'create'];
const allPrefixes = ['write', 'rename', 'remove', 'create'];

@@ -24,0 +24,0 @@ function extractChanges(context) {

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