wasmasc

Crates.iowasmasc
lib.rswasmasc
version0.1.1
created_at2025-10-25 05:37:55.943857+00
updated_at2025-10-25 10:51:28.141338+00
descriptionAssemblyScript WebAssembly plugin for Wasmrun - compile AssemblyScript projects to WebAssembly
homepagehttps://github.com/anistark/wasmasc
repositoryhttps://github.com/anistark/wasmasc
max_upload_size
id1899748
size52,035
Ani (anistark)

documentation

README

wasmasc

AssemblyScript WebAssembly plugin for Wasmrun - compile AssemblyScript projects to WebAssembly with support for both direct asc compilation and npm/pnpm/yarn/bun build workflows.

Installation

As a Wasmrun Plugin (Recommended)

wasmrun plugin install wasmasc

Wasmrun will automatically detect AssemblyScript projects and prompt you to install this plugin if needed.

From Source

cargo install --path . --features cli

From Crates.io

cargo install wasmasc --features cli

Usage

Via Wasmrun (Recommended)

wasmrun run ./my-asc-project
wasmrun compile ./my-asc-project --optimization size

Standalone CLI (Experimental)

wasmasc compile -p ./my-project -o ./dist
wasmasc compile -p ./my-project --optimization release
wasmasc check-deps
wasmasc can-handle ./my-project

Development

Use just commands for common development tasks:

just dev          # Quick development cycle (format, lint, test, build-cli)
just format       # Format code
just lint         # Lint code
just test         # Run tests
just build        # Build library
just build-cli    # Build with CLI feature
just clean        # Clean build artifacts
just install-cli  # Install locally

Run just --list to see all available commands.

Project Structure

Supports standard AssemblyScript project layouts:

my-asc-project/
├── assembly/
│   ├── index.ts
│   └── main.ts
├── package.json
└── index.ts

Dependencies

Required

  • asc - AssemblyScript compiler (npm install -g asc)
  • node - Node.js runtime

Optional (Package Managers)

The plugin intelligently detects and uses your preferred package manager:

  • npm - Default Node.js package manager
  • yarn - Fast, reliable package manager (detected via yarn.lock)
  • pnpm - Efficient, disk space saving package manager (detected via pnpm-lock.yaml)
  • bun - Fast JavaScript runtime with bundled npm alternative (detected via bun.lockb)

If none are explicitly locked, the plugin falls back to npm.

Capabilities

  • Direct ASC Compilation - Compile .ts files to WebAssembly using asc
  • npm/yarn/pnpm/bun Support - Automatic package manager detection
  • Optimization Levels - Debug, Release, and Size optimizations
  • Project Auto-detection - Recognizes AssemblyScript projects automatically
  • Live Reload - Supports file watching during development
  • Web App Packaging - Not applicable for AssemblyScript

Examples

Basic Compilation

wasmrun compile ./my-asc-project --optimization release

Development with Watching

wasmrun ./my-asc-project

With Custom Output

wasmrun compile ./my-asc-project -o ./custom-dist --optimization size

Troubleshooting

"asc command not found"

Install the AssemblyScript compiler globally:

npm install -g asc

"No package manager found"

Install at least one of: npm, yarn, pnpm, or bun

Plugin not detected

Ensure your project has one of:

  • "asc" or "@asc" in package.json
  • assembly/index.ts or assembly/main.ts
  • .ts files in the project

WASM Plugin Architecture

This plugin is part of the Wasmrun plugin ecosystem. All plugins follow the same FFI-based architecture for dynamic loading and can be updated independently. This plugin implements the Wasm plugin interface and reads its configuration from Cargo.toml. The configuration includes:

  • Extensions: File extensions the plugin handles
  • Entry Files: Priority order for entry point detection
  • Capabilities: What features the plugin supports
  • Dependencies: Required external tools

License

Commit count: 0

cargo fmt