New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

watr

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

watr

Light & fast WAT compiler – WebAssembly Text to binary, parse, print, transform

latest
Source
npmnpm
Version
4.3.3
Version published
Weekly downloads
350
146.48%
Maintainers
1
Weekly downloads
 
Created
Source

watr npm test

Light & fast WAT compiler

docs  ·  demo

Usage

import watr, { compile, parse, print } from 'watr'

// compile to binary
const binary = compile('(func (export "f") (result f64) (f64.const 1))', {
  polyfill: false, // transform newer features to MVP
  optimize: true   // fold constants, treeshake, eliminate dead code ...
})
const module = new WebAssembly.Module(binary)
const { f } = new WebAssembly.Instance(module).exports

// parse
parse('(i32.const 42)') // ['i32.const', 42]

// print
print('(module(func(result i32)i32.const 42))') // (module\n  (func (result i32)\n  ...

// instant wasm function
const { add } = watr`(func (export "add") (param i32 i32) (result i32)
  (i32.add (local.get 0) (local.get 1))
)`
add(2, 3) // 5

// instant wasm: interpolate, auto-import ...
const { test } = watr`(func (export "test") (call ${console.log} (i32.const 42)))`
test() // logs 42

CLI

npx watr input.wat              # → input.wasm
npx watr input.wat -o out.wasm  # custom output
npx watr input.wat --print      # pretty-print
npx watr input.wat --minify     # minify
npx watr input.wat --optimize   # fold, treeshake, deadcode
npx watr input.wat --polyfill   # newer features → MVP

Metrics

Used by

  • jz – minimal static JS subset

Keywords

wat

FAQs

Package last updated on 08 Apr 2026

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