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

sane

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

sane - npm Package Compare versions

Comparing version 1.0.0-rc1 to 1.0.0

3

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

@@ -31,2 +31,3 @@ "main": "index.js",

"devDependencies": {
"jshint": "^2.5.10",
"mocha": "~1.17.1",

@@ -33,0 +34,0 @@ "rimraf": "~2.2.6"

@@ -38,3 +38,3 @@ sane

```js
var watcher = sane('path/to/dir', ['**/*.js', '**/*.css']);
var watcher = sane('path/to/dir', {glob: ['**/*.js', '**/*.css']});
watcher.on('ready', function () { console.log('ready') });

@@ -53,2 +53,3 @@ watcher.on('change', function (filepath, root, stat) { console.log('file changed', filepath); });

* `watchman`: makes the watcher use [watchman](https://facebook.github.io/watchman/)
* `dot`: enables watching files/directories that start with a dot.

@@ -55,0 +56,0 @@ For the glob pattern documentation, see [minimatch](https://github.com/isaacs/minimatch).

@@ -16,3 +16,3 @@ 'use strict';

/**
* Checks a file relative path against the globs array.
* Assigns options to the watcher.
*

@@ -28,2 +28,3 @@ * @param {NodeWatcher|PollWatcher|WatchmanWatcher} watcher

watcher.globs = opts.glob || [];
watcher.dot = opts.dot || false;
if (!Array.isArray(watcher.globs)) {

@@ -44,7 +45,7 @@ watcher.globs = [watcher.globs];

exports.isFileIncluded = function(globs, relativePath) {
exports.isFileIncluded = function(globs, dot, relativePath) {
var matched;
if (globs.length) {
for (var i = 0; i < globs.length; i++) {
if (minimatch(relativePath, globs[i])) {
if (minimatch(relativePath, globs[i], {dot: dot})) {
matched = true;

@@ -51,0 +52,0 @@ break;

@@ -75,3 +75,3 @@ 'use strict';

var relativePath = path.relative(this.root, filepath);
if (!common.isFileIncluded(this.globs, relativePath)) {
if (!common.isFileIncluded(this.globs, this.dot, relativePath)) {
return false;

@@ -78,0 +78,0 @@ }

@@ -62,2 +62,3 @@ 'use strict';

this.globs,
this.dot,
path.relative(this.root, filepath)

@@ -64,0 +65,0 @@ );

@@ -119,3 +119,3 @@ 'use strict';

if (!common.isFileIncluded(this.globs, changeDescriptor.name)) {
if (!common.isFileIncluded(this.globs, this.dot, changeDescriptor.name)) {
return;

@@ -233,12 +233,13 @@ }

exec('which watchman', function(err, out) {
if (err || out.length === 0) {
console.warn(
'\u001b[31mIt doesn\'t look like you have `watchman` installed',
'\u001b[39m\nSee https://facebook.github.io/watchman/docs/install.html'
);
process.exit(1);
} else {
watchmanInstalled = true;
}
});
if (err || out.length === 0) {
console.warn(
'\u001b[31mIt doesn\'t look like you have `watchman` installed',
'\u001b[39m\nSee',
'https://facebook.github.io/watchman/docs/install.html'
);
process.exit(1);
} else {
watchmanInstalled = true;
}
});
} else {

@@ -245,0 +246,0 @@ return true;

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