#deno #core #tokio #v8

deno_core

A secure JavaScript/TypeScript runtime built with V8, Rust, and Tokio

41 breaking releases

0.69.0 Nov 23, 2020
0.67.0 Nov 9, 2020
0.51.0 Jul 31, 2020
0.38.0 Mar 28, 2020
0.0.1 Sep 13, 2019

#19 in Web programming

Download history 1390/week @ 2020-08-11 929/week @ 2020-08-18 1315/week @ 2020-08-25 894/week @ 2020-09-01 1330/week @ 2020-09-08 1042/week @ 2020-09-15 1074/week @ 2020-09-22 1926/week @ 2020-09-29 1643/week @ 2020-10-06 1572/week @ 2020-10-13 1692/week @ 2020-10-20 1237/week @ 2020-10-27 844/week @ 2020-11-03 882/week @ 2020-11-10 696/week @ 2020-11-17 579/week @ 2020-11-24

5,303 downloads per month
Used in less than 10 crates

MIT license

220KB
5.5K SLoC

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.dispatch() function to trigger the "dispatch" callback in Rust. The user is responsible for encoding both the request and response into a Uint8Array.

Documentation for this crate is thin at the moment. Please see http_bench_bin_ops.rs and http_bench_json_ops.rs as a simple example of usage.

TypeScript support and a lot of other functionality is not available at this layer. See the CLI for that.

Dependencies

~37MB
~828K SLoC