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
2
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.4 to 1.2.5

38

lib/hot-reload/hot-reload.js

@@ -9,2 +9,14 @@ // third-party dependencies

var cwd = process.cwd();
function relPath(filePath) {
return path.relative(cwd, filePath);
}
function leftPad(str, len) {
while (str.length < len) {
str = ' ' + str;
}
return str;
}
function ModuleFilter(moduleUri) {

@@ -40,3 +52,3 @@ this._moduleUri = moduleUri;

events.EventEmitter.call(this);
var _this = this;
var self = this;
this._require = require;

@@ -58,4 +70,4 @@ this._uncacheIncludes = new ModulePathFilters();

this._handleComplete = function() {
if (--_this._pending === 0) {
_this.emit('ready');
if (--self._pending === 0) {
self.emit('ready');
}

@@ -88,3 +100,3 @@ }

HotReloader.prototype.watch = function(dir, recursive) {
var _this = this;
var self = this;
var watchIncludes = this._watchIncludes;

@@ -157,3 +169,3 @@

if (_uncacheExcludes.hasMatch(moduleName)) {
if (this._uncacheExcludes.hasMatch(moduleName)) {
return false;

@@ -178,3 +190,3 @@ }

if (_reloadExcludes.hasMatch(moduleName)) {
if (this._reloadExcludes.hasMatch(moduleName)) {
return false;

@@ -300,3 +312,3 @@ }

watchExcludes = this._watchExcludes,
_this = this;
self = this;

@@ -308,5 +320,5 @@

var now = Date.now();
if (_this._lastReloadTime === null || now - _this._lastReloadTime > _this._reloadDelay) {
if (self._lastReloadTime === null || now - self._lastReloadTime > self._reloadDelay) {
if (_this._watchExcludeFilters.hasMatch(path)) {
if (self._watchExcludeFilters.hasMatch(path)) {
console.log('[hot-reload] Modified file ignored since it is excluded: ' + path + ' ');

@@ -318,4 +330,4 @@ // The file excluded from being watched so ignore the event

console.log('[hot-reload] File modified: ' + path + ' (' + event + ')');
_this._reload(path);
_this._lastReloadTime = now;
self._reload(path);
self._lastReloadTime = now;
}

@@ -350,3 +362,3 @@ }

console.log('[hot-reload] Watching ' + (watchInclude.stat.isDirectory() ? 'directory' : 'file') + ': ' + watchInclude.path);
console.log('[hot-reload] ' + leftPad('Watching ' + (watchInclude.stat.isDirectory() ? 'directory' : 'file'), 18) + ': ' + relPath(watchInclude.path));

@@ -377,2 +389,2 @@ watchInclude.watcher = watcher;

exports.HotReloader = HotReloader;
exports.HotReloader = HotReloader;
{
"name": "hot-reload",
"description": "Triggers reloading of Node.js modules",
"version": "1.2.4",
"version": "1.2.5",
"homepage": "https://github.com/philidem/node-hot-reload",

@@ -6,0 +6,0 @@ "authors": [

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