76 breaking releases

new 0.104.0 Oct 18, 2021
0.102.0 Oct 4, 2021
0.95.0 Jul 26, 2021
0.82.0 Mar 21, 2021
0.0.1 Sep 13, 2019

#31 in Web programming

Download history 2236/week @ 2021-07-03 2598/week @ 2021-07-10 2946/week @ 2021-07-17 2804/week @ 2021-07-24 2194/week @ 2021-07-31 2692/week @ 2021-08-07 2911/week @ 2021-08-14 2824/week @ 2021-08-21 2312/week @ 2021-08-28 2428/week @ 2021-09-04 4273/week @ 2021-09-11 2571/week @ 2021-09-18 2515/week @ 2021-09-25 2797/week @ 2021-10-02 3030/week @ 2021-10-09 2860/week @ 2021-10-16

11,907 downloads per month
Used in 43 crates (39 directly)

MIT license

4.5MB
9K SLoC

Rust 7.5K SLoC // 0.1% comments TypeScript 1K SLoC // 0.1% comments JavaScript 864 SLoC // 0.1% comments

Deno Core Crate

crates docs

The main dependency of this crate is rusty_v8, which provides the V8-Rust bindings.

This Rust crate contains the essential V8 bindings for Deno's command-line interface (Deno CLI). The main abstraction here is the JsRuntime which provides a way to execute JavaScript.

The JsRuntime implements an event loop abstraction for the executed code that keeps track of all pending tasks (async ops, dynamic module loads). It is user's responsibility to drive that loop by using JsRuntime::run_event_loop method - it must be executed in the context of Rust's future executor (eg. tokio, smol).

In order to bind Rust functions into JavaScript, use the Deno.core.opSync() and Deno.core.opAsync() functions to trigger the "op_fn" callback in JsRuntime::register_op on Rust side. A conventional way to handle "op_fn" callbacks is to use the op_sync and op_async functions.

Documentation for this crate is thin at the moment. Please see hello_world.rs and http_bench_json_ops.rs as examples of usage.

TypeScript support and lots of other functionality are not available at this layer. See the CLI for that.

Dependencies

~52MB
~1M SLoC