Skip to content

Releases: napi-rs/wasm-tools

v0.0.2

07 May 11:02
v0.0.2
e933904
Compare
Choose a tag to compare

v0.0.1

15 Apr 15:16
v0.0.1
728330c
Compare
Choose a tag to compare

@napi-rs/wasm-tools

Usage:

// Generate dwarf info and emit wasm

import { join } from 'node:path'
import { readFile, writeFile } from 'node:fs/promises'
import { fileURLToPath } from 'node:url'

import { ModuleConfig } from '@napi-rs/wasm-tools'

const __dirname = join(fileURLToPath(import.meta.url), '..')

const wasm = await readFile(join(__dirname, 'panic.wasm32-wasi.wasm'))

const binary = new ModuleConfig()
  .generateDwarf(true)
  .generateNameSection(true)
  .generateProducersSection(true)
  .preserveCodeTransform(true)
  .parse(wasm)
  .emitWasm(true)

await writeFile(join(__dirname, 'panic.wasm32-wasi.wasm'), binary)