Skip to content

Commit 6cd35dc

Browse files
committed
Add LLVM WASM support and enhance terminal error handling
1 parent 2f9f4e3 commit 6cd35dc

16 files changed

+7047
-66
lines changed

.vscode/settings.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
"editor.tabSize": 2,
33
"prettier.enable": false,
44
"cSpell.words": [
5-
"rustc"
5+
"nanotar",
6+
"Preopen",
7+
"rustc",
8+
"rustlib",
9+
"wasip"
610
]
711
}

bun.lockb

0 Bytes
Binary file not shown.

lib/src/get_llvm_wasm.ts

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { parseTarGzip } from 'nanotar';
2+
3+
export const get_llvm_wasm = async (): Promise<WebAssembly.Module> => {
4+
const zipped_wasm = await fetch(
5+
// "https://oligamiq.github.io/rust_wasm/v0.1.0/wasm32-wasip1.tar.gz",
6+
"https://oligamiq.github.io/rust_wasm/v0.1.0/llvm_opt.wasm.tar.gz",
7+
);
8+
const files = await parseTarGzip(await zipped_wasm.arrayBuffer());
9+
const file = files[0];
10+
const wasmFile = file.data;
11+
if (!wasmFile) {
12+
throw new Error("Wasm file not found");
13+
}
14+
const wasm = await WebAssembly.compile(wasmFile);
15+
return wasm;
16+
}

lib/src/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
import './sysroot';
22
import './get_rustc_wasm';
3+
import './get_llvm_wasm';

0 commit comments

Comments
 (0)