All Projects → theduke → Quickjs Rs

theduke / Quickjs Rs

Licence: mit
Rust wrapper for the quickjs Javascript engine.

Programming Languages

javascript
184084 projects - #8 most used programming language
c
50402 projects - #5 most used programming language
rust
11053 projects

Projects that are alternatives of or similar to Quickjs Rs

nashorn
A fork of Oracle's EcmaScript 5.1 engine Nashorn, compatible with Java 7
Stars: ✭ 29 (-87.34%)
Mutual labels:  javascript-engine
Duktape
Duktape - embeddable Javascript engine with a focus on portability and compact footprint
Stars: ✭ 5,076 (+2116.59%)
Mutual labels:  javascript-engine
Quickjspp
QuickJS C++ wrapper
Stars: ✭ 105 (-54.15%)
Mutual labels:  javascript-engine
joke
🎃 Tiny Javascript engine, does not support Typescript (yet).
Stars: ✭ 43 (-81.22%)
Mutual labels:  javascript-engine
Jsc.js
JavaScriptCore on WebAssembly
Stars: ✭ 311 (+35.81%)
Mutual labels:  javascript-engine
Baristacore
BaristaCore is a framework for providing a serverless platform using ChakraCore and .Net Core
Stars: ✭ 24 (-89.52%)
Mutual labels:  javascript-engine
yantra
JavaScript Engine for .NET Standard
Stars: ✭ 32 (-86.03%)
Mutual labels:  javascript-engine
Quickjs
QuickJS是一个小型并且可嵌入的Javascript引擎,它支持ES2020规范,包括模块,异步生成器和代理器。
Stars: ✭ 2,199 (+860.26%)
Mutual labels:  javascript-engine
V8
The official mirror of the V8 Git repository
Stars: ✭ 18,808 (+8113.1%)
Mutual labels:  javascript-engine
Msiejavascriptengine
.NET wrapper for working with the JavaScript engines of Internet Explorer and Edge Legacy (JsRT versions of Chakra, ActiveScript version of Chakra and Classic JavaScript Engine). Project was based on the code of SassAndCoffee.JavaScript and Chakra Sample Hosts.
Stars: ✭ 92 (-59.83%)
Mutual labels:  javascript-engine
escargot
Escargot is a memory optimized JavaScript engine for mid-range devices such as mobile phone, tablet and TV.
Stars: ✭ 98 (-57.21%)
Mutual labels:  javascript-engine
Browser pwn
browser pwn, main work now
Stars: ✭ 293 (+27.95%)
Mutual labels:  javascript-engine
Jsvu
JavaScript (engine) Version Updater
Stars: ✭ 1,192 (+420.52%)
Mutual labels:  javascript-engine
libjs-test262
✅ Tools for running the test262 ECMAScript test suite with SerenityOS's JavaScript engine (LibJS)
Stars: ✭ 20 (-91.27%)
Mutual labels:  javascript-engine
Quickjs
The official repo is at bellard/quickjs.
Stars: ✭ 1,429 (+524.02%)
Mutual labels:  javascript-engine
DuktapeJava
Tiny Powerfull JavaScript Engine On Android Platform integrating with java
Stars: ✭ 74 (-67.69%)
Mutual labels:  javascript-engine
Go Duktape
Duktape JavaScript engine bindings for Go
Stars: ✭ 747 (+226.2%)
Mutual labels:  javascript-engine
Boa
Boa is an embeddable and experimental Javascript engine written in Rust. Currently, it has support for some of the language.
Stars: ✭ 2,509 (+995.63%)
Mutual labels:  javascript-engine
Chakracore Delphi
Delphi and Free Pascal bindings and classes for Microsoft's ChakraCore library
Stars: ✭ 109 (-52.4%)
Mutual labels:  javascript-engine
Chakracore
ChakraCore is an open source Javascript engine with a C API.
Stars: ✭ 8,600 (+3655.46%)
Mutual labels:  javascript-engine

quickjs-rs

Crates.io docs.rs [Build Status

A Rust wrapper for QuickJS.

QuickJS is a new, small Javascript engine by Fabrice Bellard and Charlie Gordon. It is fast and supports the full ES2020 specification.

This crate allows you to easily run and integrate with Javascript code from Rust.

Quickstart

[dependencies]
quick-js = "0.4.1"
use quick_js::{Context, JsValue};

let context = Context::new().unwrap();

// Eval.

let value = context.eval("1 + 2").unwrap();
assert_eq!(value, JsValue::Int(3));

let value = context.eval_as::<String>(" var x = 100 + 250; x.toString() ").unwrap();
assert_eq!(&value, "350");

// Callbacks.

context.add_callback("myCallback", |a: i32, b: i32| a + b).unwrap();

context.eval(r#"
    // x will equal 30
    var x = myCallback(10, 20);
"#).unwrap();

Optional Features

The crate supports the following features:

  • chrono: chrono integration

    • adds a JsValue::Date variant that can be (de)serialized to/from a JS Date
  • bigint: arbitrary precision integer support via num-bigint

  • log: allows forwarding console.log messages to the log crate. Note: must be enabled with ContextBuilder::console(quick_js::console::LogConsole);

  • patched Enabled automatically for some other features, like bigint. You should not need to enable this manually. Applies QuickJS patches that can be found in libquickjs-sys/embed/patches directory.

Installation

By default, quickjs is bundled with the libquickjs-sys crate and automatically compiled, assuming you have the appropriate dependencies.

Windows Support

Windows is only supported with the MSYS2 environment and x86_64-pc-windows-gnu target architecture.

If you have MSYS2 installed and the MSYS bin directory in your path, you can compile quickjs with cargo build --target="x86_64-pc-windows-gnu".

The target can also be configured permanently via a cargo config file or the CARGO_BUILD_TARGET env var.

System installation

To use the system installation, without the bundled feature, first install the required dependencies, and then compile and install quickjs.

# Debian/Ubuntu: apt-get install -y curl xz-utils build-essential gcc-multilib libclang-dev clang
mkdir quickjs 
curl -L https://bellard.org/quickjs/quickjs-2019-07-09.tar.xz | tar xJv -C quickjs --strip-components 1
cd quickjs
sudo make install

You then need to disable the bundled feature in the libquickjs-sys crate to force using the system version.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].