Socket
Socket
Sign inDemoInstall

enhanced-resolve

Package Overview
Dependencies
Maintainers
1
Versions
130
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

enhanced-resolve - npm Package Compare versions

Comparing version 0.5.4 to 0.5.5

test/CachedInputFileSystem.js

36

lib/CachedInputFileSystem.js

@@ -9,9 +9,12 @@ /*

this.data = {};
this.levels = duration > 0 ? [[], [], [], [], []] : [];
this.levels = duration > 0 ? [[], [], [], [], [], [], [], [], []] : [];
this.count = 0;
this.interval = null;
this.needTickCheck = false;
this.nextTick = null;
this.passive = true;
}
Storage.prototype.ensureTick = function() {
if(!this.interval && this.duration > 0)
if(!this.interval && this.duration > 0 && !this.nextTick)
this.interval = setInterval(this.tick.bind(this), Math.floor(this.duration / this.levels.length));

@@ -42,2 +45,3 @@ };

if(this.duration > 0) {
this.checkTicks();
var data = this.data[name];

@@ -58,13 +62,37 @@ if(data) {

this.count -= decay.length;
decay.length = 0;
this.levels.unshift(decay);
if(this.count == 0) {
clearInterval(this.interval);
this.interval = null;
this.nextTick = null;
return true;
} else if(this.nextTick) {
this.nextTick += Math.floor(this.duration / this.levels.length);
var time = new Date().getTime();
if(this.nextTick > time) {
this.nextTick = null;
this.interval = setInterval(this.tick.bind(this), Math.floor(this.duration / this.levels.length));
return true;
}
} else if(this.passive) {
clearInterval(this.interval);
this.interval = null;
this.nextTick = new Date().getTime() + Math.floor(this.duration / this.levels.length);
} else {
this.passive = true;
}
decay.length = 0;
this.levels.unshift(decay);
};
Storage.prototype.checkTicks = function() {
this.passive = false;
if(this.nextTick) {
while(!this.tick());
}
};
Storage.prototype.purge = function() {
this.count = 0;
clearInterval(this.interval);
this.nextTick = null;
this.data = {};

@@ -71,0 +99,0 @@ this.levels.forEach(function(level) {

2

package.json
{
"name": "enhanced-resolve",
"version": "0.5.4",
"version": "0.5.5",
"author": "Tobias Koppers @sokra",

@@ -5,0 +5,0 @@ "description": "Offers a async require.resolve function. It's highly configurable.",

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