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

pathwatcher

Package Overview
Dependencies
Maintainers
2
Versions
130
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pathwatcher - npm Package Compare versions

Comparing version 0.14.2 to 0.15.0

.node-version

116

lib/main.js

@@ -33,19 +33,20 @@ (function() {

HandleWatcher.prototype.onEvent = function(event, filePath, oldFilePath) {
var detectRename,
_this = this;
var detectRename;
switch (event) {
case 'rename':
this.close();
detectRename = function() {
return fs.stat(_this.path, function(err) {
if (err) {
_this.path = filePath;
_this.start();
return _this.emit('change', 'rename', filePath);
} else {
_this.start();
return _this.emit('change', 'change', null);
}
});
};
detectRename = (function(_this) {
return function() {
return fs.stat(_this.path, function(err) {
if (err) {
_this.path = filePath;
_this.start();
return _this.emit('change', 'rename', filePath);
} else {
_this.start();
return _this.emit('change', 'change', null);
}
});
};
})(this);
return setTimeout(detectRename, 100);

@@ -101,4 +102,3 @@ case 'delete':

function PathWatcher(filePath, callback) {
var stats, watcher, _i, _len, _ref,
_this = this;
var stats, watcher, _i, _len, _ref;
this.path = filePath;

@@ -123,43 +123,45 @@ if (process.platform === 'win32') {

}
this.onChange = function(event, newFilePath, oldFilePath) {
switch (event) {
case 'rename':
case 'change':
case 'delete':
if (event === 'rename') {
_this.path = newFilePath;
}
if (typeof callback === 'function') {
callback.call(_this, event, newFilePath);
}
return _this.emit('change', event, newFilePath);
case 'child-rename':
if (_this.isWatchingParent) {
if (_this.path === oldFilePath) {
return _this.onChange('rename', newFilePath);
this.onChange = (function(_this) {
return function(event, newFilePath, oldFilePath) {
switch (event) {
case 'rename':
case 'change':
case 'delete':
if (event === 'rename') {
_this.path = newFilePath;
}
} else {
return _this.onChange('change', '');
}
break;
case 'child-delete':
if (_this.isWatchingParent) {
if (_this.path === newFilePath) {
return _this.onChange('delete', null);
if (typeof callback === 'function') {
callback.call(_this, event, newFilePath);
}
} else {
return _this.onChange('change', '');
}
break;
case 'child-change':
if (_this.isWatchingParent && _this.path === newFilePath) {
return _this.onChange('change', '');
}
break;
case 'child-create':
if (!_this.isWatchingParent) {
return _this.onChange('change', '');
}
}
};
return _this.emit('change', event, newFilePath);
case 'child-rename':
if (_this.isWatchingParent) {
if (_this.path === oldFilePath) {
return _this.onChange('rename', newFilePath);
}
} else {
return _this.onChange('change', '');
}
break;
case 'child-delete':
if (_this.isWatchingParent) {
if (_this.path === newFilePath) {
return _this.onChange('delete', null);
}
} else {
return _this.onChange('change', '');
}
break;
case 'child-change':
if (_this.isWatchingParent && _this.path === newFilePath) {
return _this.onChange('change', '');
}
break;
case 'child-create':
if (!_this.isWatchingParent) {
return _this.onChange('change', '');
}
}
};
})(this);
this.handleWatcher.on('change', this.onChange);

@@ -203,2 +205,6 @@ }

exports.File = require('./file');
exports.Directory = require('./directory');
}).call(this);
{
"main": "./lib/main.js",
"name": "pathwatcher",
"readme": "README.md",
"description": "Watch file events",
"version": "0.14.2",
"version": "0.15.0",
"licenses": [

@@ -22,3 +21,3 @@ {

"scripts": {
"prepublish": "grunt clean coffee lint",
"prepublish": "grunt prepublish",
"test": "grunt test"

@@ -28,7 +27,7 @@ },

"grunt": "~0.4.1",
"grunt-contrib-coffee": "~0.6.6",
"grunt-contrib-coffee": "~0.9.0",
"grunt-cli": "~0.1.7",
"grunt-shell": "~0.2.2",
"coffee-script": "~1.6.2",
"jasmine-focused": "~0.15.0",
"jasmine-tagged": ">=1.1 <2.0",
"rimraf": "~2.2.0",

@@ -41,4 +40,9 @@ "node-cpplint": "~0.1.5",

"bindings": "~1.1.0",
"nan": "0.8.0"
"nan": "0.8.0",
"q": "~1.0.0",
"emissary": "1.x",
"underscore-plus": "~1.x",
"fs-plus": "~2.x",
"async": "~0.2.10"
}
}

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

# Path Watcher Node Module
# Path Watcher Node Module [![Build Status](https://travis-ci.org/atom/node-pathwatcher.png?branch=master)](https://travis-ci.org/atom/node-pathwatcher)

@@ -12,4 +12,3 @@ ## Installing

* Clone the repository
* Run `npm install`
* Run `grunt` to compile the CoffeeScript and native code
* Run `npm install` to install the dependencies
* Run `npm test` to run the specs

@@ -16,0 +15,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