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

chokidar

Package Overview
Dependencies
Maintainers
2
Versions
106
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chokidar - npm Package Compare versions

Comparing version 1.5.0 to 1.5.1

32

lib/fsevents-handler.js

@@ -15,2 +15,6 @@ 'use strict';

// Threshold of duplicate path prefixes at which to start
// consolidating going forward
var consolidateThreshhold = 10;
// Private function: Instantiates the fsevents interface

@@ -38,3 +42,12 @@

var watchContainer;
var parentPath = sysPath.dirname(watchPath);
// If we've accumulated a substantial number of paths that
// could have been consolidated by watching one directory
// above the current one, create a watcher on the parent
// path instead, so that we do consolidate going forward.
if (couldConsolidate(parentPath)) {
watchPath = parentPath;
}
var resolvedPath = sysPath.resolve(path);

@@ -94,2 +107,21 @@ var hasSymlink = resolvedPath !== realPath;

// Decide whether or not we should start a new higher-level
// parent watcher
function couldConsolidate(path) {
var keys = Object.keys(FSEventsWatchers);
var count = 0;
for (var i = 0, len = keys.length; i < len; ++i) {
var watchPath = keys[i];
if (watchPath.indexOf(path) === 0) {
count++;
if (count >= consolidateThreshhold) {
return true;
}
}
}
return false;
}
// returns boolean indicating whether fsevents can be used

@@ -96,0 +128,0 @@ function canUse() {

2

package.json
{
"name": "chokidar",
"description": "A neat wrapper around node.js fs.watch / fs.watchFile / fsevents.",
"version": "1.5.0",
"version": "1.5.1",
"keywords": [

@@ -6,0 +6,0 @@ "fs",

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