QuickJS-aligned JavaScript runtime in MoonBit.
Run a single JavaScript file:
moon run --target native --release cmd/main -- path/to/file.js
Library usage (MoonBit):
moon add Lampese/nocturnejs{
"import": [
{
"path": "Lampese/nocturnejs",
"alias": "njs"
}
]
}let engine = @njs.Engine::new()
let result = engine.eval_result("1 + 2") catch {
err => {
println("error: \{err}")
return
}
}
match result {
Ok(value) => println(engine.value_to_string(value))
Err(err) => println("error: \{engine.format_error(err)}")
}Run test262 with the QuickJS-aligned config:
moon update
git submodule update --init --recursive
git -C test262 apply --check ../test262-config/test262.patch && \
git -C test262 apply ../test262-config/test262.patch
moon run --target native --release cmd/test262 -- -c test262-config/test262.conf| NJS |
|
pass 43,616 (88.23%) fail 49 (0.10%) skipped 5,767 (11.67%) excluded 2,567 (not shown) |
| QJS |
|
pass 43,606 (88.23%) fail 52 (0.11%) skipped 5,767 (11.67%) excluded 2,567 (not shown) |
* Total differs by 7 tests because QuickJS data comes from a historical report snapshot, while we enumerate the current test262 directory.