Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

rainbowatcher/wasmup

Open more actions menu

Repository files navigation

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

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

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 ❤️

About

wasm pack, made easy

Resources

License

Stars

Watchers

Forks

Packages

No packages published
Morty Proxy This is a proxified and sanitized view of the page, visit original site.