Skip to content

feat: add support to WASM via "use wasm" directive#3

Merged
LuanRoger merged 11 commits intomainfrom
feat/wasm-support
Sep 1, 2025
Merged

feat: add support to WASM via "use wasm" directive#3
LuanRoger merged 11 commits intomainfrom
feat/wasm-support

Conversation

@LuanRoger
Copy link
Owner

This pull request introduces WebAssembly (WASM) support to the project, enabling TypeScript files with a special directive to be compiled to WASM using AssemblyScript. The changes add new build scripts, dependencies, and a plugin system to handle WASM compilation and asset emission. Below are the most important changes grouped by theme.

WebAssembly (WASM) Support Integration

  • Added a new wasmSupport plugin in src/wasm/plugin.ts that detects TypeScript files with the "use wasm" directive, compiles them to WASM using AssemblyScript, emits WASM binaries and related assets, and rewrites JS bindings to use the emitted WASM file.
  • Introduced constants for WASM file extensions and directive handling in src/wasm/constants/index.ts, supporting the plugin's compilation and asset emission logic.
  • Exported the wasmSupport plugin from src/wasm/index.ts for use in build configurations.

Build Configuration and Entry Points

  • Added a new build script build:wasm to package.json for compiling WASM-related code, and updated the exports field to include WASM entry points. [1] [2]
  • Updated the main build configuration (tsdown.config.ts) to include the WASM entry point and the plugin for handling WASM files. [1] [2]

Dependency Management

  • Added assemblyscript, binaryen, and long as new dependencies in package.json and pnpm-lock.yaml to support WASM compilation. [1] [2] [3] [4] [5] [6] [7] [8]

TypeScript Configuration

  • Enhanced TypeScript configuration for the dev environment to support stricter type checking and AssemblyScript types.

Miscellaneous

  • Removed unused exports from src/dev/index.ts to clean up the module interface.

@LuanRoger LuanRoger merged commit 8cd4a97 into main Sep 1, 2025
@LuanRoger LuanRoger deleted the feat/wasm-support branch September 1, 2025 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant