Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

wasm-instrumentation

Package Overview
Dependencies
Maintainers
5
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wasm-instrumentation

WebAssembly instrumentation tool

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
5
Created
Source

Wasm-instrumentation

Wasm-instrumentation is a WebAssembly instrument tool using binaryen to implement function mock and coverage collection.

Install wasm-instrumentation

npm i -D wasm-instrumentation

How to use


import initInstrumenter from "wasm-instrumentation";

export async function instrument() {
  const instrumenter = await initInstrumenter();
  const source = instrumenter.allocateUTF8("./build.wasm");
  const output = instrumenter.allocateUTF8("./build.instrumented.wasm");
  const report = instrumenter.allocateUTF8("covInstrument/traceExpression");
  const sourceMap = instrumenter.allocateUTF8("./build.wasm.map");
  const debugInfo = instrumenter.allocateUTF8("./build.debugInfo.json");
  const expectInfo = instrumenter.allocateUTF8("./build.expectInfo.json");

  instrumenter._wasm_instrument(source, output, report, sourceMap, expectInfo, debugInfo, null, null, true);
}

API

_wasm_instrument(sourceWasm, outputWasm, reportFunctionName, sourceMap, expectInfo, debugInfo, include, exclude, skipLib)
  • sourceWasm: source wasm file path
  • outputWasm: output wasm file path after instrumentation
  • reportFunctionName: instrument function, default: "covInstrument/traceExpression"
  • sourceMap: source map file of source wasm
  • expectInfo: expectInfo file path after instrumentation
  • debugInfo: debugInfo file path after instrumentation
  • includes: An array of Regex indicate which function shoule be included. eg. ["assembly/.","src/."]
  • excludes: An array of Regex indicate which function shoule be excluded. eg. ["test/.*"]
  • skipLib: if skip the Assemblyscript lib functions

Keywords

FAQs

Package last updated on 28 Apr 2024

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