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

@contrast/agent-lib

Package Overview
Dependencies
Maintainers
8
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contrast/agent-lib

This repo contains the node interface to the rust agent-lib.

  • 8.2.1
  • npm
  • Socket score

Version published
Weekly downloads
16K
decreased by-17.08%
Maintainers
8
Weekly downloads
 
Created
Source

agent-lib-node

This repo contains the node interface to the rust agent-lib.

how to build the node bindings

The node bindings are not built when cargo build is executed at the top level of the repo. Building the node bindings requires symbols defined in the node ecosystem; cargo doesn't know about them.

The rust crate used to provide access to node-api (formerly n-api) is the napi-rs crate, which is specified as napi in Cargo.toml. The napi-rs user on github supplies a number of packages, beyond the rust-bindings to node-api, to help build node binaries using rust.

This crate uses the napi cli package to build the node binaries from rust sources.

step-by-step

  1. execute npm install in crates/bindings/node - this installs napi-rs and all the related packages needed to build the node binaries.

  2. execute the command npm run build or npm run build:debug to have the napi-rs cli package build the node binaries from the rust sources. the resulting file will be named contrast.<linux|win32|macos>-<arch><-gnu|msvc|>.node.

  3. To test, run npm test in the current directory.

rasp v3

Raspv3 features and tests are now built with the default build.

build the bindings to compare rust and node timings

In order to compare the rust JSON parser to a native Node implementation, it is necessary to expose a JavaScript API. (It's possible to do one test in rust and the other in node but that uses two different timers and doesn't capture the overhead of transferring the data from node to rust.) There is a feature flag, raw_parsing_api that can be turned on to use for testing.

When running either npm run build or npm run build:debug append -- --features raw_parsing_api to build the software for this testing, e.g.,

npm run build -- --features raw_parsing_api

This will add the rawParse method to the library exports.

release node bindings to npm

See README.md in the scripts directory.

FAQs

Package last updated on 27 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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