New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

hot-reload

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hot-reload - npm Package Compare versions

Comparing version 1.2.2 to 1.2.3

79

lib/hot-reload/hot-reload.js

@@ -7,2 +7,3 @@ // third-party dependencies

var directoryWalker = require('directory-walker');
var pathFilters = require('path-filters');

@@ -73,8 +74,11 @@ var simpleRegExpReplacements = {

this._uncacheExcludes = [];
this._watchIncludes = {};
this._watchExcludeFilters = [];
this._watchExcludeFilters = pathFilters.create();
this._reloadIncludes = [];
this._reloadExcludes = [];
this._specialReloadIncludes = [];
this._specialReloadExcludes = [];
this._specialReloadIncludes = pathFilters.create();
this._specialReloadExcludes = pathFilters.create();
this._pending = 0;

@@ -183,62 +187,4 @@ this._reloadDelay = 2000;

HotReloader.prototype._addPathFilters = function(target, filter, recursive, matchResult) {
if (Array.isArray(filter)) {
var filters = filter;
for (var i=0, len=filters.length; i<filters; i++) {
this._addPathFilters(target, filters[i], recursive, matchResult);
}
return;
}
var filterFunc;
if (typeof filter === 'string') {
if (isSimpleRegExp(filter)) {
filterFunc = createSimpleRegExpFilter(filter, matchResult);
}
else {
var path = fs.realpathSync(filter);
if (fs.existsSync(path)) {
var stat = fs.statSync(path);
if (stat.isFile()) {
recursive = false;
}
}
recursive = recursive !== false;
filterFunc = function(testPath) {
var match = recursive ? testPath.startsWith(path) : testPath === path;
return match ? matchResult || true : false;
};
}
}
else if (filter.constructor === RegExp) {
filterFunc = function(testPath) {
return testPath.test(filter) ? matchResult || true : false;
}
}
else if (typeof filter === 'function') {
if (matchResult) {
filterFunc = function(path) {
var result = filter(path);
return result ? matchResult : false;
}
}
else {
filterFunc = filter;
}
}
else {
throw new Error("Invalid filter: " + filter + " (" + (typeof filter) + ")");
}
target.push(filterFunc);
return this;
}
HotReloader.prototype.watchExclude = function(filter, recursive) {
this._addPathFilters(this._watchExcludeFilters, filter, recursive);
this._watchExcludeFilters.add(filter, recursive);
return this;

@@ -252,4 +198,3 @@ }

}
this._addPathFilters(this._specialReloadIncludes, filter, recursive, handlerFunc);
this._specialReloadIncludes.add(filter, recursive, handlerFunc);
return this;

@@ -259,3 +204,3 @@ }

HotReloader.prototype.specialReloadExclude = function(filter, recursive) {
this._addPathFilters(this._specialReloadExcludes, filter, recursive);
this._specialReloadExcludes.add(filter, recursive);
return this;

@@ -364,3 +309,3 @@ }

if (this._shouldReloadModule(module.filename)) {
modulesToReload.push(module);
modulesToReload.push(module);
}

@@ -450,3 +395,3 @@ }

else {
handleModified(event, require('path').join(watchInclude.path, filename));
handleModified(event, require('path').join(watchInclude.path, filename));
}

@@ -469,3 +414,3 @@ }

var watcher = fs.watch(
fs.realpathSync(path),
fs.realpathSync(path),
createWatcherFunc(watchInclude));

@@ -472,0 +417,0 @@

5

package.json
{
"name": "hot-reload",
"description": "Triggers reloading of Node.js modules",
"version": "1.2.2",
"version": "1.2.3",
"homepage": "https://github.com/philidem/node-hot-reload",

@@ -18,4 +18,5 @@ "authors": [

"dependencies": {
"directory-walker": "1.2.x"
"directory-walker": "1.2.x",
"path-filters": "1.0.x"
}
}
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