🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@contrast/agent-lib

Package Overview
Dependencies
Maintainers
17
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contrast/agent-lib - npm Package Compare versions

Comparing version

to
5.3.0

contrast.linux-arm64-gnu.node

67

index.js

@@ -5,25 +5,52 @@ 'use strict';

const { sep } = require('path');
const suffix = {
linux: '-gnu',
darwin: '',
win32: '-msvc'
}[platform];
const {version} = require('./package.json');
const { version: packageVersion } = require('./package.json');
const { GLIBC, MUSL, familySync, versionSync } = require('detect-libc');
try {
const bindingsPath = `${__dirname}${sep}contrast.${platform}-${process.arch}${suffix}.node`;
module.exports = require(`${bindingsPath}`);
} catch(e) {
const first_failure = e;
// account for alpine (uses its own suffix).
if (platform === 'linux') {
try {
const bindingsPath = `${__dirname}${sep}contrast.${platform}-${process.arch}-musl.node`;
module.exports = require(`${bindingsPath}`);
} catch (e) {
console.log(first_failure);
throw e;
let bindingsPath = () => {
switch (platform) {
case 'linux': {
const family = familySync();
switch (family) {
case GLIBC: {
const glibcVersion = versionSync();
if (glibcVersion) {
const [major, minor] = glibcVersion.split('.');
if (major < 2 || (major == 2 && minor < 17)) {
throw new Error(`Unsupported glibc version. Only version 2.17.0 or above is supported. Detected version ${glibcVersion}`);
}
if (major == 2 && (minor >= 17 && minor < 28)) {
return `${__dirname}${sep}contrast.${platform}-${process.arch}-glibc217.node`
}
}
return `${__dirname}${sep}contrast.${platform}-${process.arch}-gnu.node`;
}
case MUSL: {
return `${__dirname}${sep}contrast.${platform}-${process.arch}-musl.node`;
}
default: {
throw new Error(`Unsupported glibc family. ${family} is not supported.`);
}
}
}
case 'win32': {
return `${__dirname}${sep}contrast.${platform}-${process.arch}-msvc.node`;
}
case 'darwin': {
return `${__dirname}${sep}contrast.${platform}-${process.arch}.node`;
}
default: {
throw new Error(`Unsupported platform. ${platform} is not supported.`);
}
}
}
module.exports.version = version;
try {
module.exports = require(`${bindingsPath()}`);
}
catch (e) {
console.error(e);
throw e;
}
module.exports.version = packageVersion;
{
"name": "@contrast/agent-lib",
"version": "5.2.2",
"version": "5.3.0",
"description": "",

@@ -26,4 +26,7 @@ "keywords": [],

"build:debug": "napi build --platform",
"build:napi_cost": "napi build --platform --release --features napi_cost",
"build:raspv3": "napi build --platform --release --features raspv3",
"format:rs": "cargo fmt",
"test": "mocha test/*.test.js"
"test": "mocha test/*.test.js",
"test:raspv3": "RASPV3_TEST=true mocha test/*.test.js"
},

@@ -40,3 +43,6 @@ "devDependencies": {

"mocha": "^9.2.0"
},
"dependencies": {
"detect-libc": "^2.0.1"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet