Socket
Socket
Sign inDemoInstall

gaze

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gaze - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

10

lib/gaze.js

@@ -387,4 +387,4 @@ /*

}).forEach(function(file) {
var filepath = path.join(dir, file);
if (!_this._isDir(file)) {
var filepath = path.join(dir, file);
_this.remove(filepath);

@@ -400,7 +400,7 @@ _this.emit('deleted', filepath);

// Is it a matching pattern?
if (_this._isMatch(file)) {
var filepath = path.join(dir, file);
var relFile = path.join(relDir, file);
if (_this._isMatch(relFile)) {
// Add to watch then emit event
_this.add(file, function() {
_this.emit('added', filepath);
_this.add(relFile, function() {
_this.emit('added', path.join(dir, file));
});

@@ -407,0 +407,0 @@ }

{
"name": "gaze",
"description": "A globbing fs.watch wrapper built from the best parts of other fine watch libs.",
"version": "0.3.0",
"version": "0.3.1",
"homepage": "https://github.com/shama/gaze",

@@ -38,3 +38,3 @@ "author": {

"grunt-benchmark": "~0.1.1",
"grunt": "~0.4.0a",
"grunt": "~0.4.0rc3",
"grunt-contrib-nodeunit": "~0.1.1",

@@ -41,0 +41,0 @@ "grunt-contrib-jshint": "~0.1.0"

@@ -154,2 +154,3 @@ # gaze [![Build Status](https://secure.travis-ci.org/shama/gaze.png?branch=master)](http://travis-ci.org/shama/gaze)

## Release History
* 0.3.1 - Fix added events within subfolder patterns.
* 0.3.0 - Handle safewrite events, `forceWatchMethod` option removed, bug fixes and watch optimizations (@rgaskill).

@@ -156,0 +157,0 @@ * 0.2.2 - Fix issue where subsequent add calls dont get watched (@samcday). removeAllListeners on close.

'use strict';
var gaze = require('../lib/gaze.js');
var grunt = require('grunt');
var path = require('path');

@@ -175,28 +176,25 @@ var fs = require('fs');

addedEmitInSubFolders: function(test) {
test.expect(3);
var create = [
path.resolve(__dirname, 'fixtures', 'nested', 'sub', 'added.js'),
path.resolve(__dirname, 'fixtures', 'added.js'),
path.resolve(__dirname, 'fixtures', 'nested', 'added.js')
test.expect(4);
var adds = [
{ pattern: '**/*', file: path.resolve(__dirname, 'fixtures', 'nested', 'sub', 'added.js') },
{ pattern: '**/*', file: path.resolve(__dirname, 'fixtures', 'added.js') },
{ pattern: 'nested/**/*', file: path.resolve(__dirname, 'fixtures', 'nested', 'added.js') },
{ pattern: 'nested/sub/*.js', file: path.resolve(__dirname, 'fixtures', 'nested', 'sub', 'added.js') },
];
var clean = [];
function createFile() {
var file = create.shift();
fs.writeFileSync(file, 'var added = true;');
clean.push(file);
}
gaze('**/*', {debounceDelay:100}, function(err, watcher) {
watcher.on('added', function(filepath) {
test.equal('added.js', path.basename(filepath));
if (create.length < 1) {
clean.forEach(fs.unlinkSync);
grunt.util.async.forEachSeries(adds, function(add, next) {
new gaze.Gaze(add.pattern, function(err, watcher) {
watcher.on('added', function(filepath) {
test.equal('added.js', path.basename(filepath));
fs.unlinkSync(filepath);
watcher.close();
test.done();
} else {
createFile();
}
next();
});
watcher.on('changed', function() { test.ok(false, 'changed event should not have emitted.'); });
watcher.on('deleted', function() { test.ok(false, 'deleted event should not have emitted.'); });
fs.writeFileSync(add.file, 'var added = true;');
});
createFile();
}, function() {
test.done();
});
}
},
};
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