1 个不稳定版本
| 0.1.0 | 2024年6月27日 |
|---|
#427 in WebAssembly
98KB
2.5K SLoC
WEPL
WebAssembly 组件 repl。
从源代码构建
您可以通过运行 cargo build --release(或 cargo build 以调试模式构建)来从源代码构建 wepl。
安装 wepl
您可以通过运行 cargo install wepl --locked 从 crates.io 安装 wepl。
您还可以通过运行 cargo install --path . --locked 在本地系统上安装 wepl。
示例
$ wepl mycomponent.wasm
> .exports
uppercase: func(input: string) -> string
> uppercase
uppercase: func(input: string) -> string
> s = "hello"
s: string
> uppercase(s)
"HELLO"
内置函数
可以使用 . 前缀调用内置函数。
支持的功能包括
.imports:打印组件的所有导入列表.exports:打印组件的所有导出列表.link $function $wasm:使用来自 wasm 组件的导出满足导入的函数$func.compose $adapter:使用提供的适配器模块满足导入(例如,与WASI-Virt适配器).type $type:检查作用域中类型的$type定义.help:打印帮助信息(?是此内置的别名)
特性
- 导出函数评估
- 列出导入和导出
- 变量赋值
- 类型检查
- 使用其他 WebAssembly 组件满足导入
- 基本组件组成
兼容性
wepl 目前与 wasmtime 17 版本绑定。与该版本兼容的组件应在 wepl 中运行。
依赖
~52MB
~1M SLoC