#javascript #run-time

bin+lib easyjsr

easyjs internal JS runtime

4 releases (breaking)

Uses new Rust 2024

0.4.5 Oct 5, 2025
0.3.0 Sep 7, 2025
0.2.0 Sep 6, 2025
0.1.0 Sep 4, 2025

#216 in #run-time

Download history 161/week @ 2025-08-31 180/week @ 2025-09-07 11/week @ 2025-09-14 4/week @ 2025-09-28 119/week @ 2025-10-05 16/week @ 2025-10-12 5/week @ 2025-10-19

240 downloads per month

Apache-2.0

2.5MB
60K SLoC

C 57K SLoC // 0.0% comments C++ 1.5K SLoC // 0.1% comments Rust 1.5K SLoC // 0.0% comments Python 19 SLoC // 0.3% comments

easyjsr

Default runtime for easyjs. Rust wrapper of ejr.

usage

To use with easyjs you can set the runtime to easyjsr. It is also the default runtime.

easyjs repl --runtime easyjsr
> import 'std'
> @print('Hello World')

For developers

This is a really easy to use runtime for embedding in rust projects. Important thing to note is that it does not currently support MSVC builds. Only GNU/Clang. So if using windows make sure to install the correct build system.

rustup target add x86_64-pc-windows-gnu
# And build with
cargo build --target x86_64-pc-windows-gnu

Evaluating JS

let result = ejr.eval("1 + 1");
println!("{}", ejr.val_to_string(result)); // 2

Calling specific functions

let script = r##"
    function say_hello_to(name) {
        console.log('Hello', name);
    }
"##;

let result = ejr.call("say_hello_to", vec!["Jordan"]); // Hello Jordan

Creating callables

fn ___print(msg: String) {
    println!("{msg}");
}

ejr.register_callback("___print", ___print);

// Lambdas
ejr.register_callback("___log", |msg: String| {
    println!("{msg}");
});

Compiling JS into exe

This is mostly for libraries, you usually won't use this in an app.

compile_js_code(code);

// Or as a module
compile_js_code_as_module(code);

Use case

The use case of another JS runtime is specifically to be a high level wrapper for easy FFI use in:

  • Kazoku
  • easyjs
  • Going Up

All projects that use easyjs as scripting.

Dependencies

~8–13MB
~232K SLoC