rusty_racer 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ea693d067ec0ea289296493726bbecd72444e811218ca35a1beb44bbaf863e7d
4
- data.tar.gz: f1de072c0f64819c07708e47d385c345b7300e54a41c5186b79858ba73e3f7b7
3
+ metadata.gz: b0b742605170382bce639eaa6c8acd1917f6ed4e6f8a5d4f83d40701ffb14b25
4
+ data.tar.gz: ce873858c2a28e9903ca9abec1cc72e061f3561f1cf2c8d5b0ff3694d613ec55
5
5
  SHA512:
6
- metadata.gz: bb7f4c71efcb143172a42c80898a9e10eeadc4c519e4f98e317907483ffd4565e751f7d0946b377964cb4b83b4e026cbe555449fac425b284572f088cb6d012e
7
- data.tar.gz: a859077b54ca976af9466271ada3cd094695b1f896ce09f3bc35d753912dc4e19743f589e322c0f438ca08cc4383bafa5faca16852831dbfd59e80dd74e61614
6
+ metadata.gz: 1e3960b00b14c62813d731ee85c8f41cca8f04a0ff7657446f205dda2f24c5e11fd07b00da000b1d7be503bb00f083cf389f3736fac8d6344343a6ec26a3a11e
7
+ data.tar.gz: 3ee0d6217b064b70362a7e2475e5db840a0b613922f91a418d3548464066ea1824d1c073870e5d9d6da4cdc351fa481e490d667520123675f2b7d730a926d23e
data/README.md CHANGED
@@ -9,6 +9,34 @@ Embed [V8](https://v8.dev/) in Ruby, built on [rusty_v8](https://crates.io/crate
9
9
  > is **thread-confined**: every operation must happen on that owner thread, or it
10
10
  > raises. `Isolate#terminate` is the exception — it is safe from any thread.
11
11
 
12
+ ## Highlights
13
+
14
+ - **ES modules**, including dynamic `import()` with an embedder-owned resolver —
15
+ not just classic scripts.
16
+ - **Faithful value marshalling**: `BigInt`, `Date`, `Map`, `Set`, typed binary
17
+ (`Uint8Array`/`ArrayBuffer` ↔ binary `String`), and shared/cyclic object
18
+ graphs all round-trip — no lossy JSON hop.
19
+ - **In-thread execution** — V8 runs on the calling Ruby thread, with no dedicated
20
+ V8 thread and no per-op thread hop; fast when you run many small ops.
21
+ - **Drop-in [ExecJS](#execjs) runtime** — any ExecJS consumer switches with no
22
+ code change.
23
+ - **Snapshots, realms (`Context`s), host callbacks, and a bytecode cache.**
24
+ - **Precompiled gems** bundle V8 for Linux/macOS × Ruby 3.3–4.0 — no V8 build,
25
+ no Rust toolchain.
26
+
27
+ ### Compared to mini_racer
28
+
29
+ [mini_racer](https://github.com/rubyjs/mini_racer) is the mature, widely-deployed
30
+ incumbent — if you want a battle-tested binding or **Windows** support, reach for
31
+ it. rusty_racer differs where it counts for some workloads: native **ES modules +
32
+ dynamic import** (mini_racer is eval/classic-script oriented); **richer
33
+ marshalling** (the types above round-trip natively instead of through a
34
+ JSON-shaped projection); and **in-thread execution** with no per-op thread hop,
35
+ which is faster for overhead-dominated workloads (lots of tiny `eval`/`call`) and
36
+ at parity once the per-op JS work dominates. It is also younger and
37
+ **experimental** — fewer miles, no Windows yet, no per-isolate memory cap. Parity
38
+ with mini_racer is not a goal; the overlap is convergent evolution, not a port.
39
+
12
40
  ## What it can do
13
41
 
14
42
  Names follow V8's: an `Isolate` is the VM; it hands out `Context`s (v8::Context,
@@ -122,6 +150,28 @@ warm isolate — a per-visit reset that avoids rebuilding the VM. Its contract:
122
150
  suspended on the V8 stack (e.g. resetting a realm from inside one of its own
123
151
  host fns).
124
152
 
153
+ ## ExecJS
154
+
155
+ rusty_racer ships an optional [ExecJS](https://github.com/rails/execjs) runtime,
156
+ so any ExecJS consumer (asset pipelines, CoffeeScript/Babel/Uglify wrappers, …)
157
+ can run on V8-in-Ruby with no code change:
158
+
159
+ ```ruby
160
+ require "rusty_racer/execjs"
161
+ ExecJS.runtime = RustyRacer::ExecJSRuntime.new
162
+
163
+ ExecJS.eval("'foo bar'.toUpperCase()") # => "FOO BAR"
164
+ ctx = ExecJS.compile("function add(a, b) { return a + b }")
165
+ ctx.call("add", 1, 2) # => 3
166
+ ```
167
+
168
+ The adapter is **opt-in** — `rusty_racer` never requires `execjs` itself, so it
169
+ stays a non-dependency; `require "rusty_racer/execjs"` pulls it in only when you
170
+ ask. Values cross with ExecJS's JSON semantics (functions and `undefined` drop
171
+ out, Dates become ISO strings), matching what ExecJS's external runtimes give, so
172
+ results are identical whatever runtime a library picked. The integration is
173
+ verified against ExecJS's own runtime contract suite (`test/execjs_test.rb`).
174
+
125
175
  ## Threading
126
176
 
127
177
  An `Isolate` runs V8 **in-thread** on the Ruby thread that created it, and is
@@ -4,7 +4,7 @@
4
4
  # libv8-rusty needed under the cibuildgem native-per-platform model).
5
5
  [package]
6
6
  name = "rusty_racer"
7
- version = "0.1.1"
7
+ version = "0.1.2"
8
8
  edition = "2021"
9
9
  publish = false
10
10