@webassemblyjs/wasm-edit
> Rewrite a WASM binary
Last updated 2 years ago by xtuc .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install @webassemblyjs/wasm-edit 
SYNC missed versions from official npm registry.

@webassemblyjs/wasm-edit

Rewrite a WASM binary

Replace in-place an AST node in the binary.

Installation

yarn add @webassemblyjs/wasm-edit

Usage

Update:

import { edit } from "@webassemblyjs/wasm-edit";

const binary = [/*...*/];

const visitors = {
  ModuleImport({ node }) {
    node.module = "foo";
    node.name = "bar";
  }
};

const newBinary = edit(binary, visitors);

Replace:

import { edit } from "@webassemblyjs/wasm-edit";

const binary = [/*...*/];

const visitors = {
  Instr(path) {
    const newNode = t.callInstruction(t.indexLiteral(0));
    path.replaceWith(newNode);
  }
};

const newBinary = edit(binary, visitors);

Remove:

import { edit } from "@webassemblyjs/wasm-edit";

const binary = [/*...*/];

const visitors = {
  ModuleExport({ node }) {
    path.remove()
  }
};

const newBinary = edit(binary, visitors);

Insert:

import { add } from "@webassemblyjs/wasm-edit";

const binary = [/*...*/];

const newBinary = add(actualBinary, [
  t.moduleImport("env", "mem", t.memory(t.limit(1)))
]);

Providing the AST

Providing an AST allows you to handle the decoding yourself, here is the API:

addWithAST(Program, ArrayBuffer, Array<Node>): ArrayBuffer;
editWithAST(Program, ArrayBuffer, visitors): ArrayBuffer;

Note that the AST will be updated in-place.

Current Tags

  • 1.11.6                                ...           latest (2 years ago)

80 Versions

  • 1.11.6                                ...           2 years ago
  • 1.11.5                                ...           2 years ago
  • 1.11.3                                ...           2 years ago
  • 1.11.1                                ...           3 years ago
  • 1.11.0                                ...           4 years ago
  • 1.10.1                                ...           4 years ago
  • 1.10.0                                ...           4 years ago
  • 1.9.1                                ...           4 years ago
  • 1.9.0                                ...           5 years ago
  • 1.8.5                                ...           6 years ago
  • 1.8.4                                ...           6 years ago
  • 1.8.3                                ...           6 years ago
  • 1.8.2                                ...           6 years ago
  • 1.8.1                                ...           6 years ago
  • 1.8.0                                ...           6 years ago
  • 1.7.11                                ...           6 years ago
  • 1.7.10                                ...           6 years ago
  • 1.7.9                                ...           6 years ago
  • 1.7.8                                ...           6 years ago
  • 1.7.7                                ...           6 years ago
  • 1.7.6                                ...           6 years ago
  • 1.7.5                                ...           6 years ago
  • 1.7.4                                ...           6 years ago
  • 1.7.3                                ...           6 years ago
  • 1.7.2                                ...           6 years ago
  • 1.7.2-1                                ...           6 years ago
  • 1.7.2-0                                ...           6 years ago
  • 1.7.1                                ...           6 years ago
  • 1.7.0                                ...           6 years ago
  • 1.7.0-3                                ...           6 years ago
  • 1.7.0-2                                ...           6 years ago
  • 1.7.0-1                                ...           6 years ago
  • 1.6.1                                ...           6 years ago
  • 1.7.1-0                                ...           6 years ago
  • 1.7.0-0                                ...           6 years ago
  • 1.6.0                                ...           6 years ago
  • 1.5.13                                ...           6 years ago
  • 1.5.12                                ...           6 years ago
  • 1.5.11                                ...           6 years ago
  • 1.5.10                                ...           7 years ago
  • 1.5.9                                ...           7 years ago
  • 1.5.8                                ...           7 years ago
  • 1.5.7                                ...           7 years ago
  • 1.5.6                                ...           7 years ago
  • 1.5.5                                ...           7 years ago
  • 1.5.4                                ...           7 years ago
  • 1.5.3                                ...           7 years ago
  • 1.5.2                                ...           7 years ago
  • 1.5.1                                ...           7 years ago
  • 1.5.0                                ...           7 years ago
  • 1.4.3                                ...           7 years ago
  • 1.4.2                                ...           7 years ago
  • 1.4.1                                ...           7 years ago
  • 1.4.0                                ...           7 years ago
  • 1.3.3                                ...           7 years ago
  • 1.3.2                                ...           7 years ago
  • 1.3.1                                ...           7 years ago
  • 1.3.0                                ...           7 years ago
  • 1.2.8                                ...           7 years ago
  • 1.2.7                                ...           7 years ago
  • 1.2.6                                ...           7 years ago
  • 1.2.5                                ...           7 years ago
  • 1.2.4                                ...           7 years ago
  • 1.2.3                                ...           7 years ago
  • 1.2.2                                ...           7 years ago
  • 1.2.1                                ...           7 years ago
  • 1.2.0                                ...           7 years ago
  • 1.1.2-y.10                                ...           7 years ago
  • 1.1.2-y.9                                ...           7 years ago
  • 1.1.2-y.8                                ...           7 years ago
  • 1.1.2-y.7                                ...           7 years ago
  • 1.1.2-y.6                                ...           7 years ago
  • 1.1.2-y.5                                ...           7 years ago
  • 1.1.2-y.4                                ...           7 years ago
  • 1.1.2-y.3                                ...           7 years ago
  • 1.1.2-y.2                                ...           7 years ago
  • 1.1.2-y.1                                ...           7 years ago
  • 1.1.2-y.0                                ...           7 years ago
  • 1.1.1                                ...           7 years ago
  • 1.1.0                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dev Dependencies (1)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |