Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/swiftwasm/WasmTransformer
A Swift package for reading, writing, and transformation of WebAssembly binaries
https://github.com/swiftwasm/WasmTransformer
developer-tools swiftwasm wasm webassembly
Last synced: 10 days ago
JSON representation
A Swift package for reading, writing, and transformation of WebAssembly binaries
- Host: GitHub
- URL: https://github.com/swiftwasm/WasmTransformer
- Owner: swiftwasm
- License: apache-2.0
- Created: 2020-10-14T17:52:00.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-03-30T13:02:45.000Z (over 1 year ago)
- Last Synced: 2024-04-13T21:11:28.936Z (7 months ago)
- Topics: developer-tools, swiftwasm, wasm, webassembly
- Language: Swift
- Homepage:
- Size: 195 KB
- Stars: 34
- Watchers: 7
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WasmTransformer
![Test](https://github.com/swiftwasm/swift-wasm-transformer/workflows/Test/badge.svg)
A package which provides transformation operation for WebAssembly binary. Inspired by [Rust implementation](https://github.com/wasmerio/wasmer-js/tree/master/crates/wasm_transformer)
## Available transformations
### `lowerI64Imports`
```swift
public func lowerI64Imports(_ input: [UInt8]) throws -> [UInt8]
```Inserts trampoline functions for imports that have i64 params or returns. This is useful for running Wasm modules in browsers that do not support JavaScript BigInt -> Wasm i64 integration. Especially in the case for i64 WASI Imports.
### `stripCustomSections`
```swift
public func stripCustomSections(_ input: [UInt8]) throws -> [UInt8]
```Strip all custom sections from input WebAssembly binary.
## Testing
1. Set environment variable `SWIFT_TOOLCHAIN` to the path to your SwiftWasm toolchain.
e.g. `$HOME/Library/Developer/Toolchains/swift-wasm-5.7.3-RELEASE.xctoolchain/usr`
2. Set up testing fixtures by: `(cd ./Fixtures/ && npm install && npm run build && make all)`
3. Run `swift test`