Comparing version 4.1.0 to 5.0.0
{ | ||
"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) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
151
51004
1500
1
+ Addedanymatch@3.1.3(transitive)
+ Addedbraces@3.0.3(transitive)
+ Addedcross-spawn@7.0.3(transitive)
+ Addedexeca@4.1.0(transitive)
+ Addedfill-range@7.1.1(transitive)
+ Addedget-stream@5.2.0(transitive)
+ Addedhuman-signals@1.1.1(transitive)
+ Addedis-number@7.0.0(transitive)
+ Addedis-stream@2.0.1(transitive)
+ Addedmerge-stream@2.0.0(transitive)
+ Addedmicromatch@4.0.8(transitive)
+ Addedmimic-fn@2.1.0(transitive)
+ Addednormalize-path@3.0.0(transitive)
+ Addednpm-run-path@4.0.1(transitive)
+ Addedonetime@5.1.2(transitive)
+ Addedpath-key@3.1.1(transitive)
+ Addedpicomatch@2.3.1(transitive)
+ Addedshebang-command@2.0.0(transitive)
+ Addedshebang-regex@3.0.0(transitive)
+ Addedstrip-final-newline@2.0.0(transitive)
+ Addedto-regex-range@5.0.1(transitive)
+ Addedwhich@2.0.2(transitive)
- Removedanymatch@2.0.0(transitive)
- Removedarr-diff@4.0.0(transitive)
- Removedarr-flatten@1.1.0(transitive)
- Removedarr-union@3.1.0(transitive)
- Removedarray-unique@0.3.2(transitive)
- Removedassign-symbols@1.0.0(transitive)
- Removedatob@2.1.2(transitive)
- Removedbase@0.11.2(transitive)
- Removedbraces@2.3.2(transitive)
- Removedcache-base@1.0.1(transitive)
- Removedclass-utils@0.3.6(transitive)
- Removedcollection-visit@1.0.0(transitive)
- Removedcomponent-emitter@1.3.1(transitive)
- Removedcopy-descriptor@0.1.1(transitive)
- Removedcross-spawn@6.0.5(transitive)
- Removeddebug@2.6.9(transitive)
- Removeddecode-uri-component@0.2.2(transitive)
- Removeddefine-property@0.2.51.0.02.0.2(transitive)
- Removedexeca@1.0.0(transitive)
- Removedexpand-brackets@2.1.4(transitive)
- Removedextend-shallow@2.0.13.0.2(transitive)
- Removedextglob@2.0.4(transitive)
- Removedfill-range@4.0.0(transitive)
- Removedfor-in@1.0.2(transitive)
- Removedfragment-cache@0.2.1(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedget-stream@4.1.0(transitive)
- Removedget-value@2.0.6(transitive)
- Removedhas-value@0.3.11.0.0(transitive)
- Removedhas-values@0.1.41.0.0(transitive)
- Removedhasown@2.0.2(transitive)
- Removedis-accessor-descriptor@1.0.1(transitive)
- Removedis-buffer@1.1.6(transitive)
- Removedis-data-descriptor@1.0.1(transitive)
- Removedis-descriptor@0.1.71.0.3(transitive)
- Removedis-extendable@0.1.11.0.1(transitive)
- Removedis-number@3.0.0(transitive)
- Removedis-plain-object@2.0.4(transitive)
- Removedis-stream@1.1.0(transitive)
- Removedis-windows@1.0.2(transitive)
- Removedisarray@1.0.0(transitive)
- Removedisobject@2.1.03.0.1(transitive)
- Removedkind-of@3.2.24.0.06.0.3(transitive)
- Removedmap-cache@0.2.2(transitive)
- Removedmap-visit@1.0.0(transitive)
- Removedmicromatch@3.1.10(transitive)
- Removedmixin-deep@1.3.2(transitive)
- Removedms@2.0.0(transitive)
- Removednanomatch@1.2.13(transitive)
- Removednice-try@1.0.5(transitive)
- Removednormalize-path@2.1.1(transitive)
- Removednpm-run-path@2.0.2(transitive)
- Removedobject-copy@0.1.0(transitive)
- Removedobject-visit@1.0.1(transitive)
- Removedobject.pick@1.3.0(transitive)
- Removedp-finally@1.0.0(transitive)
- Removedpascalcase@0.1.1(transitive)
- Removedpath-key@2.0.1(transitive)
- Removedposix-character-classes@0.1.1(transitive)
- Removedregex-not@1.0.2(transitive)
- Removedremove-trailing-separator@1.1.0(transitive)
- Removedrepeat-element@1.1.4(transitive)
- Removedrepeat-string@1.6.1(transitive)
- Removedresolve-url@0.2.1(transitive)
- Removedret@0.1.15(transitive)
- Removedsafe-regex@1.1.0(transitive)
- Removedsemver@5.7.2(transitive)
- Removedset-value@2.0.1(transitive)
- Removedshebang-command@1.2.0(transitive)
- Removedshebang-regex@1.0.0(transitive)
- Removedsnapdragon@0.8.2(transitive)
- Removedsnapdragon-node@2.1.1(transitive)
- Removedsnapdragon-util@3.0.1(transitive)
- Removedsource-map@0.5.7(transitive)
- Removedsource-map-resolve@0.5.3(transitive)
- Removedsource-map-url@0.4.1(transitive)
- Removedsplit-string@3.1.0(transitive)
- Removedstatic-extend@0.1.2(transitive)
- Removedstrip-eof@1.0.0(transitive)
- Removedto-object-path@0.3.0(transitive)
- Removedto-regex@3.0.2(transitive)
- Removedto-regex-range@2.1.1(transitive)
- Removedunion-value@1.0.1(transitive)
- Removedunset-value@1.0.0(transitive)
- Removedurix@0.1.0(transitive)
- Removeduse@3.1.1(transitive)
- Removedwhich@1.3.1(transitive)
Updatedanymatch@^3.1.1
Updatedexec-sh@^0.3.4
Updatedexeca@^4.0.0
Updatedfb-watchman@^2.0.1
Updatedmicromatch@^4.0.2