Socket
Socket
Sign inDemoInstall

@contrast/library-analysis

Package Overview
Dependencies
Maintainers
9
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contrast/library-analysis - npm Package Compare versions

Comparing version 1.13.1 to 1.14.0

34

lib/install/library-usage/index.js

@@ -34,2 +34,4 @@ /*

libraryUsage.bufferedEvents = new Set();
function registerCodeEvent({ script }) {

@@ -68,18 +70,12 @@ const nmIndex = script.lastIndexOf('node_modules');

libraryUsage.codeEventListener = (codeEvent) => {
if (
codeEvent.type !== type ||
codeEvent.script?.indexOf(`node_modules${path.sep}`) === -1 ||
!codeEvent.func
) return;
try {
if (
codeEvent.type !== type ||
codeEvent.script.indexOf(`node_modules${path.sep}`) === -1 ||
!codeEvent.func
) {
return;
}
const { info, updated } = registerCodeEvent(codeEvent);
if (updated) {
messages.emit(Event.LIBRARY_USAGE, {
id: info.hash,
names: Array.from(info.names),
});
libraryUsage.bufferedEvents.add(info);
}

@@ -94,5 +90,17 @@ } catch (err) {

libraryUsage.report = function() {
for (const info of libraryUsage.bufferedEvents) {
messages.emit(Event.LIBRARY_USAGE, {
id: info.hash,
names: Array.from(info.names),
});
libraryUsage.bufferedEvents.delete(info);
}
};
libraryUsage.install = function () {
const evalInterval = config.agent.node.library_usage.reporting.interval_ms;
setCodeEventListener(libraryUsage.codeEventListener, evalInterval);
setInterval(libraryUsage.report, 2000).unref();
};

@@ -99,0 +107,0 @@

{
"name": "@contrast/library-analysis",
"version": "1.13.1",
"version": "1.14.0",
"description": "Handles library reporting and library usage analysis",

@@ -5,0 +5,0 @@ "license": "SEE LICENSE IN LICENSE",

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