🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

wasmup

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wasmup

package util for wasm

latest
Source
npmnpm
Version
0.10.5
Version published
Maintainers
1
Created
Source

GitHub Workflow Status GitHub License NPM Version

wasmup

Wasm build, made easy

[!WARNING] It's in early development status, use in your own risk.

features

  • Build a set of code that can run seamlessly in Node.js, Deno, Bun, and browsers.
  • No setup needed, just use directly.
  • The generated package.json in pretty order.
  • Add parameter validation to functions.

Usage

Requires Node.js >=20.19.0.

pnpm install -D wasmup
{
    // ...
    "scripts": {
        "build": "wasmup build --clean .",
    },
}

Runtime usage (Node.js / Bun / Deno / Web)

Use the same ESM API in all runtimes:

import init, { hello_world } from "your-wasm-package"

await init()
console.log(hello_world())

For sync initialization:

  • initSync is only supported in Node.js, Bun and Deno.
  • initSync is not supported in browsers.

For browser deployment:

  • Keep index_bg.wasm accessible by URL.
  • index_bg.wasm should be deployed next to the generated JS entry (or with an equivalent URL mapping).

Configuration

The Wasmup configuration file may be named any of the following:

  • wasmup.config.js
  • wasmup.config.cjs
  • wasmup.config.mjs
  • wasmup.config.ts
  • wasmup.config.mts
  • wasmup.config.cts
  • wasmup.config.json

It should be placed in the root directory of your project and export an configuration objects. Here’s an example:

import { defineConfig } from "wasmup"

export default defineConfig({
    clean: true,
    output: "packages/toml-edit-js",
    scope: "rainbowatcher",
})

wasm-opt options

you can pass wasm-opt params by config in Cargo.toml, details ref to this link: cargo-toml-configuration

[package.metadata.wasm-pack.profile.release]
wasm-opt = [
    # Optimize level 4
    "-O4",
    # Run passes to convergence, continuing while binary size decreases
    "--converge",
    "--strip-debug",
    "--strip-dwarf",
    # flattens out code, removing nesting
    "--flatten",
    # inline small functions
    "--inlining",
    # removes unreachable code
    "--dead-code-elimination",
    "--minify-imports-and-exports-and-modules",
    # Grand Unified Flow Analysis
    "--gufa",
]

License

MIT © Made by ❤️

Keywords

wasm

FAQs

Package last updated on 13 Mar 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